text
stringlengths
4
6.14k
/* The 27 tests below excercise all combinations of 0/1/unknown values for an #if...#elif...#elif...#else combination */ #if zero delete part 1 of 0-0-0 #elif zero delete part 2 of 0-0-0 #elif zero delete part 3 of 0-0-0 #else keep part 4 of 0-0-0 #endif #if zero delete part 1 of 0-0-1 #elif zero delete part 2 of 0-0-1 #elif one keep part 3 of 0-0-1 #else delete part 4 of 0-0-1 #endif #if zero delete part 1 of 0-0-? #elif zero delete part 2 of 0-0-? #elif whatever keep part 3 of 0-0-? #else keep part 4 of 0-0-? #endif -------------------------- #if zero delete part 1 of 0-1-0 #elif one keep part 2 of 0-1-0 #elif zero delete part 3 of 0-1-0 #else keep part 4 of 0-1-0 #endif #if zero delete part 1 of 0-1-1 #elif one keep part 2 of 0-1-1 #elif one delete part 3 of 0-1-1 #else delete part 4 of 0-1-1 #endif #if zero delete part 1 of 0-1-? #elif one keep part 2 of 0-1-? #elif whatever delete part 3 of 0-1-? #else delete part 4 of 0-1-? #endif -------------------------- #if zero delete part 1 of 0-?-0 #elif whatever keep part 2 of 0-?-0 #elif zero delete part 3 of 0-?-0 #else keep part 4 of 0-?-0 #endif #if zero delete part 1 of 0-?-1 #elif whatever keep part 2 of 0-?-1 #elif one keep part 3 of 0-?-1 #else delete part 4 of 0-?-1 #endif #if zero delete part 1 of 0-?-? #elif whatever keep part 2 of 0-?-? #elif whatever keep part 3 of 0-?-? #else keep part 4 of 0-?-? #endif ========================== #if one keep part 1 of 1-0-0 #elif zero delete part 2 of 1-0-0 #elif zero delete part 3 of 1-0-0 #else delete part 4 of 1-0-0 #endif #if one keep part 1 of 1-0-1 #elif zero delete part 2 of 1-0-1 #elif one delete part 3 of 1-0-1 #else delete part 4 of 1-0-1 #endif #if one keep part 1 of 1-0-? #elif zero delete part 2 of 1-0-? #elif whatever delete part 3 of 1-0-? #else delete part 4 of 1-0-? #endif -------------------------- #if one keep part 1 of 1-1-0 #elif one delete part 2 of 1-1-0 #elif zero delete part 3 of 1-1-0 #else delete part 4 of 1-1-0 #endif #if one keep part 1 of 1-1-1 #elif one delete part 2 of 1-1-1 #elif one delete part 3 of 1-1-1 #else delete part 4 of 1-1-1 #endif #if one keep part 1 of 1-1-? #elif one delete part 2 of 1-1-? #elif whatever delete part 3 of 1-1-? #else delete part 4 of 1-1-? #endif -------------------------- #if one keep part 1 of 1-?-0 #elif whatever delete part 2 of 1-?-0 #elif zero delete part 3 of 1-?-0 #else delete part 4 of 1-?-0 #endif #if one keep part 1 of 1-?-1 #elif whatever delete part 2 of 1-?-1 #elif one delete part 3 of 1-?-1 #else delete part 4 of 1-?-1 #endif #if one keep part 1 of 1-?-? #elif whatever delete part 2 of 1-?-? #elif whatever delete part 3 of 1-?-? #else delete part 4 of 1-?-? #endif ========================== #if something keep part 1 of ?-0-0 #elif zero delete part 2 of ?-0-0 #elif zero delete part 3 of ?-0-0 #else keep part 4 of ?-0-0 #endif #if something keep part 1 of ?-0-1 #elif zero delete part 2 of ?-0-1 #elif one /* preserve comment */ keep part 3 of ?-0-1 #else delete part 4 of ?-0-1 #endif #if something keep part 1 of ?-0-? #elif zero delete part 2 of ?-0-? #elif whatever keep part 3 of ?-0-? #else keep part 4 of ?-0-? #endif -------------------------- #if something keep part 1 of ?-1-0 #elif one keep part 2 of ?-1-0 #elif zero delete part 3 of ?-1-0 #else delete part 4 of ?-1-0 #endif #if something keep part 1 of ?-1-1 #elif one keep part 2 of ?-1-1 #elif one delete part 3 of ?-1-1 #else delete part 4 of ?-1-1 #endif #if something keep part 1 of ?-1-? #elif one keep part 2 of ?-1-? #elif whatever delete part 3 of ?-1-? #else delete part 4 of ?-1-? #endif -------------------------- #if something keep part 1 of ?-?-0 #elif whatever keep part 2 of ?-?-0 #elif zero delete part 3 of ?-?-0 #else keep part 4 of ?-?-0 #endif #if something keep part 1 of ?-?-1 #elif whatever keep part 2 of ?-?-1 #elif one keep part 3 of ?-?-1 #else delete part 4 of ?-?-1 #endif #if something keep part 1 of ?-?-? #elif whatever keep part 2 of ?-?-? #elif unknown keep part 3 of ?-?-? #else keep part 4 of ?-?-? #endif ==========================
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/ram/RAM_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace RAM { namespace Model { enum class ResourceRegionScope { NOT_SET, REGIONAL, GLOBAL }; namespace ResourceRegionScopeMapper { AWS_RAM_API ResourceRegionScope GetResourceRegionScopeForName(const Aws::String& name); AWS_RAM_API Aws::String GetNameForResourceRegionScope(ResourceRegionScope value); } // namespace ResourceRegionScopeMapper } // namespace Model } // namespace RAM } // namespace Aws
/*********************************************************************************************************************** * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only * intended for use with Renesas products. No other uses are authorized. This * software is owned by Renesas Electronics Corporation and is protected under * all applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software * and to discontinue the availability of this software. By using this software, * you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * * Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved. ***********************************************************************************************************************/ /*********************************************************************************************************************** * File Name : r_cg_it_user.c * Version : Applilet3 for RL78/L12 V1.00.00 [23 Mar 2012] * Device(s) : R5F10RLC * Tool-Chain : GNURL78 v12.03 * Description : This file implements device driver for IT module. * Creation Date: 21/01/2013 ***********************************************************************************************************************/ /*********************************************************************************************************************** Includes ***********************************************************************************************************************/ /* Header files inclusion */ #include "r_cg_macrodriver.h" #include "r_cg_it.h" #include "interrupt_handlers.h" #include "r_cg_userdefine.h" /*********************************************************************************************************************** * Function Name: R_IT_Create_UserInit * Description : This function adds user code after initializing IT module. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_IT_Create_UserInit (void) { /* supply IT clock */ RTCEN = 1U; /* disable IT operation */ ITMC = _0000_IT_OPERATION_DISABLE; /* disable INTIT interrupt */ ITMK = 1U; /* clear INTIT interrupt flag */ ITIF = 0U; /* Set INTIT low priority */ ITPR1 = 1U; ITPR0 = 1U; /* Set the compare value */ ITMC = _0FFF_ITMCMP_VALUE; } /*********************************************************************************************************************** * End of function R_IT_Create_UserInit ***********************************************************************************************************************/ /*********************************************************************************************************************** * Function Name: INT_IT * Description : This function is INTIT interrupt service routine. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void INT_IT (void) { /* Toggle LED output */ KernelClock(); /* Clear the IT interrupt flag */ ITIF = 0u; } /*********************************************************************************************************************** * End of function INT_IT ***********************************************************************************************************************/
/* Copyright 2015 LE, Duc-Anh Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_TEXT_H #define CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_TEXT_H #include "../../../Portable/CommonTypes.h" #include "../CharacterValue.h" namespace CLDEPlus { namespace Foundation { namespace Data { namespace Type { class Text : public CharacterValue { char *_buffer = nullptr; public: explicit Text(string const &text); explicit Text(char const *text); explicit Text(unsigned long length); Text(Text const &) = default; Text(Text &&) = default; Text &operator=(Text const &) = default; Text &operator=(Text &&) = default; ~Text(); // Value virtual void *PointerToBuffer() override; virtual size_t getActualSize() override; // IPrintable virtual string ToString() const override; }; } } } } #endif //CLOUD_E_CPLUS_FOUNDATION_DATA_TYPE_TEXT_H
// MainFrm.h : Schnittstelle der Klasse CMainFrame // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MAINFRM_H__9222C98D_6036_11D2_B3F3_006097A8F69A__INCLUDED_) #define AFX_MAINFRM_H__9222C98D_6036_11D2_B3F3_006097A8F69A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CMainFrame : public CFrameWnd { protected: // Nur aus Serialisierung erzeugen CMainFrame(); DECLARE_DYNCREATE(CMainFrame) // Attribute public: // Operationen public: // Überladungen // Vom Klassenassistenten generierte Überladungen virtueller Funktionen //{{AFX_VIRTUAL(CMainFrame) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL // Implementierung public: virtual ~CMainFrame(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Eingebundene Elemente der Steuerleiste CStatusBar m_wndStatusBar; CToolBar m_wndToolBar; // Generierte Message-Map-Funktionen protected: //{{AFX_MSG(CMainFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); // HINWEIS - An dieser Stelle werden Member-Funktionen vom Klassen-Assistenten eingefügt und entfernt. // Innerhalb dieser generierten Quelltextabschnitte NICHTS VERÄNDERN! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein. #endif // !defined(AFX_MAINFRM_H__9222C98D_6036_11D2_B3F3_006097A8F69A__INCLUDED_)
#ifndef LMARK_H #define LMARK_H #include <QFileInfo> #include <QString> #include <QRect> #include <QVector> class MarkInfo { public: QRect rect; QString tag; MarkInfo(); MarkInfo(QRect r, QString t); bool operator ==(const MarkInfo& m); }; /** *Ò»¸öÎļþµÄ±ê¼Ç¼¯ */ class LMark { public: QString fileName; QVector<MarkInfo> markinfos; LMark(); LMark(QString f); LMark(QString f, QVector<MarkInfo> i); ~LMark(); int addMark(MarkInfo& m); }; #endif // LMARK_H
typedef int INT; typedef enum _INTEL_CACHE_TYPE { IntelCacheNull, IntelCacheTrace } INTEL_CACHE_TYPE; struct bft { unsigned int a:3; unsigned int b:1; // an anonymous bitfield signed int :2; // with typedef INT x:1; // made of sizeof unsigned int abc: sizeof(int); // enums are integers! INTEL_CACHE_TYPE Type : 5; }; int main() { struct bft bf; assert(bf.a<=7); assert(bf.b<=1); bf.Type=IntelCacheTrace; }
#ifndef PUBLIC_DKC_H_INCLUDED #define PUBLIC_DKC_H_INCLUDED #include <stdio.h> #include "DVM_code.h" typedef struct DKC_Compiler_tag DKC_Compiler; DKC_Compiler *DKC_create_compiler(void); DVM_ExecutableList *DKC_compile(DKC_Compiler *compiler, FILE *fp, char *path); void DKC_dispose_compiler(DKC_Compiler *compiler); #endif /* PUBLIC_DKC_H_INCLUDED */
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #pragma once #include <string> namespace doris { struct AuthInfo { std::string user; std::string passwd; std::string cluster; std::string user_ip; // -1 as unset int64_t auth_code = -1; }; template<class T> void set_request_auth(T* req, const AuthInfo& auth) { if (auth.auth_code != -1) { // if auth_code is set, no need to set other info req->__set_auth_code(auth.auth_code); // user name and passwd is unused, but they are required field. // so they have to be set. req->user = ""; req->passwd = ""; } else { req->user = auth.user; req->passwd = auth.passwd; if (!auth.cluster.empty()) { req->__set_cluster(auth.cluster); } req->__set_user_ip(auth.user_ip); } } }
/* Copyright 2016 Vanderbilt University Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifdef __cplusplus extern "C" { #endif #include "ibp/ibp_visibility.h" #include "opque.h" int ibp_sync_execute(opque_t *q, int nthreads); #ifdef __cplusplus } #endif
/* ============================================================================ * Introduction to Operating Systems * CS 8803, GT OMSCS * * Unauthorized copying of this file, via any medium is strictly prohibited. * * "priority-readers-and-writers.h" * Defines entry points for "Priority Readers and Writers" in Problem Set 1. ============================================================================ */ #ifndef PS1_PRIORITY_READERS_AND_WRITERS_H_ #define PS1_PRIORITY_READERS_AND_WRITERS_H_ int main(int argc, char **argv); void *readerMain(void *threadArgument); void *writerMain(void *threadArgument); #endif // PS1_PRIORITY_READERS_AND_WRITERS_H_
#define SPOT 1 enum id_action {ID_FOLD, ID_CALL, ID_BET, ID_RAISE, ID_ALLIN, ID_SMALLBLIND, ID_BIGBLIND, ID_ANTE, ID_NACTIONS}; std::string str_action[] = {"FOLD", "CALL", "BET", "RAISE", "ALL_IN", "SMALL_BLIND", "BIG_BLIND", "ANTE"}; enum id_street {ID_BLINDS, ID_PREFLOP, ID_FLOP, ID_TURN, ID_RIVER, ID_NSTREETS}; std::string str_street1[] = {"BLINDS", "PREFLOP", "FLOP", "TURN", "RIVER"}; std::string str_street2[] = {"BLINDS", "PREFLOP", "POSTFLOP", "POSTTURN", "POSTRIVER"}; // todo: make MERGE a template for both arguments below // example template arguments: <ID_MERGE, rapidxml::xml_node<>*> template<ID_SITE siteID, typename nodeType> class Spot { /************** method declarations ******************/ // defined for each hand history type in files like Spot_XML.h, Spot_Pokerstars.h, etc. private: unsigned int parseAmt(); id_action parseType(); bool advanceNode(); nodeType getNextNode(); unsigned int parseNextToAct(); bool nodeToNextStreet(); bool nodeToEnd(); void processBlindsAndAntes(); void processWinnings(); id_street parseStreetID(); nodeType parseFirstNode(nodeType); public: void awardWinnings(); /************** DATA MEMBERS ********************/ private: // data members nodeType node; Hand<siteID, nodeType> * hand; unsigned int * const stacks; unsigned int * const inFront; // inFront[i] is the amount in front of player i for the current street unsigned int * const inFront_prev; // like above, but for previous streets together bool * const hasCards; unsigned int nextToAct; id_street streetID; bool reachedEnd; /***************** FULLY DEFINED FUNCTIONS *****************/ private: // todo: make these templates somehow? // returns ID_NACTIONS if the type given is something other than the "action" types // these are skipped static id_action getActionID(std::string actionStr) { for (unsigned int i = ID_FOLD; i != ID_NACTIONS; i++) { if (str_action[i] == actionStr) return (id_action)i; } return ID_NACTIONS; } // returns ID_NSTREETS if the type given is not a street name (means end of hand?) static id_street getStreetID(std::string streetStr) { for (unsigned int i = ID_BLINDS; i != ID_NSTREETS; i++) { if (streetStr == str_street1[i] || streetStr == str_street2[i]) return (id_street)i; } return ID_NSTREETS; } void check() { // check invariants assert(hasCards[nextToAct]); // sum of inFront + stacks = chips in play } bool advanceStreet() { // add inFront[] values to inFront_prev[] array_helpers::plus(this->inFront_prev, this->inFront, this->inFront_prev, this->hand->getNSeatsAtTable()); // subtract the inFront values from each stack array_helpers::minus<unsigned int>(this->stacks, this->stacks, this->inFront, this->hand->getNSeatsAtTable(), true); // reset inFront[] to all 0 memset(this->inFront, 0, sizeof(unsigned int) * this->hand->getNSeatsAtTable()); if (this->nodeToNextStreet()) { this->nextToAct = this->parseNextToAct(); return true; } else return false; // move node, then call resetActionVars() } // process the current action // find the next spot in this street // if there is one, reset the Spot variables to reflect it // if there isn't, return false bool advanceSpot() { this->processAction(); if (this->advanceNode()) { this->nextToAct = this->parseNextToAct(); return true; } else return false; } // todo: count BLINDS and PREFLOP as same street // so a RAISE from the blinds sets a new total for that combined "PREFLOP" street void processAction() { unsigned int amt; id_action action = parseType(); switch(action) { case ID_FOLD: hasCards[nextToAct] = false; break; case ID_BET: case ID_ALLIN: case ID_CALL: case ID_SMALLBLIND: case ID_BIGBLIND: amt = parseAmt(); inFront[nextToAct] += amt; break; case ID_ANTE: // antes are not included in the "inFront" for the preflop betting round; basically they're a separate street amt = parseAmt(); this->stacks[nextToAct] -= amt; inFront_prev[nextToAct] += amt; break; case ID_RAISE: amt = parseAmt(); inFront[nextToAct] = amt; // when you raise, the amt given is not the amt of the raise but the new total inFront for that street break; } // other possibilities we don't have to do anything with: "CHAT", etc. } // todo: make sure you call this with a hand object that is actually at the beginning of a hand // (not after updateStacksPostHand) // todo: initialize hasCards public: Spot(Hand<siteID, nodeType> * h, nodeType node) : node(parseFirstNode(node)), hand(h), stacks(new unsigned int[h->getNSeatsAtTable()]), inFront(new unsigned int[h->getNSeatsAtTable()]), inFront_prev(new unsigned int [h->getNSeatsAtTable()]), hasCards(new bool[h->getNSeatsAtTable()]), reachedEnd(false) { memset(inFront, 0, sizeof(unsigned int) * h->getNSeatsAtTable()); memset(inFront_prev, 0, sizeof(unsigned int) * h->getNSeatsAtTable()); h->getWasDealtin(this->hasCards); h->getStacks(this->stacks); this->nextToAct = this->parseNextToAct(); this->streetID = this->parseStreetID(); // parse the blinds processBlindsAndAntes(); } void getStacks(unsigned int * dest) { memcpy(dest, this->stacks, sizeof(unsigned int) * this->hand->getNSeatsAtTable()); } bool advance() { if (advanceSpot()) return true; else if (advanceStreet()) return true; else { // reached end of hand this->nodeToEnd(); this->reachedEnd = true; return false; } } ~Spot() { delete[] stacks; delete[] inFront_prev; delete[] inFront; delete[] hasCards; } };
/*========================================================================= * * Copyright RTK Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #ifndef rtkReg23ProjectionGeometry_h #define rtkReg23ProjectionGeometry_h //RTK #include "rtkThreeDCircularProjectionGeometry.h" #include "rtkWin32Header.h" //ITK #include <itkPoint.h> #include <itkMatrix.h> namespace rtk { /** \class Reg23ProjectionGeometry * \brief {A simple utility class which makes the REG23 projection geometry * compatible with RTK's geometry.} * * REG23 geometry (open-radART, plastimatch) is very simplicistic: a perspective * projection is defined by a source position (S) in world coordinate system * (WCS), a detector position (R) in WCS and the detector orientation in WCS * by the detector row vector (r) and the detector column vector (c). * * In order to make RTK aware of this geometry, the parameters mentioned above * have to be brought into RTK's native geometry format. This is achieved by * deriving from RTK's circular 3D projection geometry class and adding a new * dedicated method for adding a REG23 projection. Internally, this method * converts the S,R,r,c set into Euler angles and offsets as required by RTK's * native projection geometry definition format. * * @warning {The detector offset and direction is fully modeled by the resultant * RTK geometry entry. This means that the projection stack input into back- * projection filters or forward-projectors is expected to have zero-origin and * identity-direction!} * * @see rtk::ThreeDCircularProjectionGeometry * * \test {TestReg23ProjectionGeometry.cxx} * * @author phil steininger * @version 1.0 */ class RTK_EXPORT Reg23ProjectionGeometry : public rtk::ThreeDCircularProjectionGeometry { public: /** General typedefs **/ typedef Reg23ProjectionGeometry Self; typedef rtk::ThreeDCircularProjectionGeometry Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self) /** * @brief Add a REG23-based geometry set to the RTK projections list. * @param sourcePosition absolute position of the point source S in WCS * @param detectorPosition absolute position of the detector origin R in WCS * @param detectorRowVector absolute direction vector indicating the * orientation of the detector's rows r (sometimes referred to as v1) * @param detectorColumnVector absolute direction vector indicating the * orientation of the detector's columns c (sometimes referred to as v2) * @return TRUE if the projection could be added to the RTK projections list */ bool AddReg23Projection(const PointType &sourcePosition, const PointType &detectorPosition, const VectorType &detectorRowVector, const VectorType &detectorColumnVector); protected: /** Standard constructor. **/ Reg23ProjectionGeometry(); /** Destructor. **/ ~Reg23ProjectionGeometry() ITK_OVERRIDE; private: /** Purposely not implemented. **/ Reg23ProjectionGeometry(const Self&); /** Purposely not implemented. **/ void operator=(const Self&); }; } #endif // rtkReg23ProjectionGeometry_h
// // DeviceTableViewCell.h // Stream // // Created by Ben Brown on 10/3/15. // Copyright (c) 2015 Ben Brown. All rights reserved. // #import <UIKit/UIKit.h> #import "DeviceInnerView.h" #import "BarDayItemView.h" @interface GalView : UIView { IBOutlet UILabel *curGalLabel, *galLabel; } - (void)setGalLabelStr:(NSString *)str; @end @interface DeviceTableViewCell : UITableViewCell { @public IBOutlet DeviceInnerView *innerView; IBOutlet UILabel *curDateLabel; IBOutlet GalView *galView; UIImageView *imgView; NSMutableArray *dayArr; NSArray *someWeekData; } - (void)selectDay:(BarDayItemView *)itemView; - (void)selectWeekItem:(UITapGestureRecognizer *)rec; - (void)setWeekData:(NSArray *)weekData withFrame:(CGRect)rect; - (UIView *)showAddStream:(BOOL)yesOrNo; - (void)setCurDate:(NSDate *)date; - (void)setDateStr:(NSString *)str; - (void)setCurGals:(double)curGals; @end
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2011 by QuickDic, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ // TODO: Migrate to GCD sockets (GCDAsyncSocket). This will resolve a number of really ugly issues: // * Lower thread counts // * Explicit synchronization (no more conditions, flags, or race conditons!) // * Maybe even synchronize with the context itself (when TIMOB-6990 complete) #ifdef USE_TI_NETWORKSOCKET #import <Foundation/Foundation.h> #import "TiStreamProxy.h" #import "AsyncSocket.h" #import "TiNetworkSocketProxy.h" // Used to determine the type of processing typedef enum { TO_BUFFER = 1, TO_STREAM, TO_CALLBACK, } ReadDestination; @interface TiNetworkSocketTCPProxy : TiStreamProxy<AsyncSocketDelegate, TiStreamInternal> { AsyncSocket* socket; SocketState internalState; NSCondition* listening; NSThread* socketThread; // We have to have an explicit "host" property because of some 'fun' undocumented KVO // behavior - it turns out that KVO 'getters' also look for '-(type)_key' signature // selectors. TiProxy has a '_host' function. NSString* host; // We offer synchronous I/O. The underlying socket implementation is asynchronous. // So we need to ensure our own synchronicity by signaling a condition when operations // complete. NSCondition* ioCondition; NSUInteger readDataLength; NSError* socketError; // In order to put the accepted socket on the right run loop, and make sure it's constructed // properly, we need THESE as well... NSMutableDictionary* acceptArgs; NSRunLoop* acceptRunLoop; BOOL accepting; // And, last but not least, in order to make sure that socket run loops are configured AND ACTIVE before performing any work on them, // we need to be able to signal that they're NSCondition* readyCondition; BOOL socketReady; // Information used to hash callbacks and asynch ops to tags. int asynchTagCount; NSMutableDictionary* operationInfo; KrollCallback* connected; KrollCallback* accepted; KrollCallback* closed; KrollCallback* error; } // Properties: // -- Stored on TiProxy dynprops -- // int port // ---- @property (nonatomic, readwrite, retain) NSString* host; @property (nonatomic, readonly) NSNumber* state; // Req's local processing @property (nonatomic, readwrite, retain) KrollCallback* connected; @property (nonatomic, readwrite, retain) KrollCallback* accepted; @property (nonatomic, readwrite, retain) KrollCallback* closed; @property (nonatomic, readwrite, retain) KrollCallback* error; // Public API -(void)connect:(id)_void; -(void)listen:(id)arg; // arg[0]: int maxAcceptQueueSize : queue size -(void)accept:(id)arg; // arg[0]: Object params : callbacks for created socket -(void)close:(id)_void; @end #endif
//------------------------------------------------------------------------------ // Copyright (c) 2018 by contributors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //------------------------------------------------------------------------------ /* This file defines the Trainer class. */ #ifndef XLEARN_SOLVER_TRAINER_H_ #define XLEARN_SOLVER_TRAINER_H_ #include <vector> #include "src/base/common.h" #include "src/base/format_print.h" #include "src/reader/reader.h" #include "src/data/model_parameters.h" #include "src/loss/loss.h" #include "src/loss/metric.h" namespace xLearn { //------------------------------------------------------------------------------ // Trainer is the core class of xLearn, which can perform // standard training process (training set and test set), as // well as the cross-validation training process. //------------------------------------------------------------------------------ class Trainer { public: // Constructor and Destructor Trainer() {} ~Trainer() {} // Invoke this function before we use this class void Initialize(std::vector<Reader*>& reader_list, int epoch, Model* model, Loss* loss, Metric* metric, bool early_stop, int stop_window, bool quiet) { CHECK_NE(reader_list.empty(), true); CHECK_GT(epoch, 0); CHECK_GT(stop_window, 0); CHECK_NOTNULL(model); CHECK_NOTNULL(loss); // Do not check metric == nullptr reader_list_ = reader_list; epoch_ = epoch; model_ = model; loss_ = loss; metric_ = metric; early_stop_ = early_stop; stop_window_ = stop_window; quiet_ = quiet; } // Training without cross-validation void Train(); // Training using cross-validation void CVTrain(); // Save model to disk file void SaveModel(const std::string& filename) { CHECK_NE(filename.empty(), true); CHECK_NE(filename.compare("none"), 0); model_->Serialize(filename); } // Save txt model to disk file void SaveTxtModel(const std::string& filename) { CHECK_NE(filename.empty(), true); CHECK_NE(filename.compare("none"), 0); model_->SerializeToTXT(filename); } protected: /* The reader_list_ contains both of the training data and the validation data. */ std::vector<Reader*> reader_list_; /* Number of epoch */ int epoch_; /* Using early-stopping ? */ bool early_stop_; /* Window size for early stopping */ int stop_window_; /* quiet training ? */ bool quiet_; /* Model parameter */ Model* model_; /* Loss function */ Loss* loss_; /* Evaluation metric */ Metric* metric_; /* Store each metric info of cross-validation */ std::vector<MetricInfo> metric_info_; // Basic train function void train(std::vector<Reader*>& train_reader, std::vector<Reader*>& test_reader); // Calculate gradient and update model. // Return training loss. real_t calc_gradient(std::vector<Reader*>& reader_list); // Calculate loss value and evaluation metric. MetricInfo calc_metric(std::vector<Reader*>& reader_list); // Calculate average metric for cross-validation void show_average_metric(); // Print information during the training. void show_head_info(bool validate); void show_train_info(real_t tr_loss, real_t te_loss, real_t te_metric, real_t time_cost, bool validate, index_t epoch); private: DISALLOW_COPY_AND_ASSIGN(Trainer); }; } // namespace xLearn #endif // XLEARN_SOLVER_TRAINER_H_
// // MGSUserDefaultsUtilities.h // Fragaria // // Created by Jim Derry on 3/4/15. // // #import <Cocoa/Cocoa.h> /** * This class implements some utilities required by MGSUserDefaults tests. **/ @interface MGSUserDefaultsUtilities : NSObject /** * Returns a dictionary of all visible properties of an object, including * those from all its superclasses. Courtesy of Duncan Babbage. * @param object The object for which you want to retrieve property * information. **/ + (NSDictionary *)propertiesOfObject:(id)object; /** * Returns a dictionary of all visible properties of a class, including * those from all its superclasses. Courtesy of Duncan Babbage. * @param class The class for which you want to retrieve property information. **/ + (NSDictionary *)propertiesOfClass:(Class)class; /** * Returns a dictionary of all visible properties that are specific to * a subclass. Properties for its superclasses are not included. * Courtesy of Duncan Babbage. * @param class The class for which you want to retrieve property information. **/ + (NSDictionary *)propertiesOfSubclass:(Class)class; @end
// // GADVideoControllerDelegate.h // Google Mobile Ads SDK // // Copyright (c) 2017 Google Inc. All rights reserved. // #import <GoogleMobileAds/GADVideoController.h> #import <GoogleMobileAds/GoogleMobileAdsDefines.h> GAD_ASSUME_NONNULL_BEGIN /// The GADVideoControllerDelegate protocol defines methods that are called by the video controller /// object in response to the video events that occured throught the lifetime of the video rendered /// by an ad. @protocol GADVideoControllerDelegate<NSObject> @optional /// Tells the delegate that the video controller's video playback has ended. - (void)videoControllerDidEndVideoPlayback:(GADVideoController *)videoController; @end GAD_ASSUME_NONNULL_END
/* Copyright 2016 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "headers.h" NSYNC_CPP_START_ struct thd_args { void (*f) (void *); void *arg; }; static void *body (void *v) { struct thd_args *args = (struct thd_args *) v; (*args->f) (args->arg); free (args); return (NULL); } void nsync_start_thread_ (void (*f) (void *), void *arg) { struct thd_args *args = (struct thd_args *) malloc (sizeof (*args)); pthread_t t; args->f = f; args->arg = arg; pthread_create (&t, NULL, body, args); pthread_detach (t); } NSYNC_CPP_END_
#ifndef QFACTIONCREATOR_H #define QFACTIONCREATOR_H #include <QObject> #include <QQmlParserStatus> #include <QFAppDispatcher> #include <QPointer> #include "priv/qfsignalproxy.h" class QFActionCreator : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QFDispatcher* dispatcher READ dispatcher WRITE setDispatcher NOTIFY dispatcherChanged) public: explicit QFActionCreator(QObject *parent = 0); QFDispatcher *dispatcher() const; void setDispatcher(QFDispatcher *value); public slots: QString genKeyTable(); void dispatch(QString type, QJSValue message = QJSValue()); signals: void dispatcherChanged(); protected: void classBegin(); void componentComplete(); private: QPointer<QFDispatcher> m_dispatcher; QList<QFSignalProxy*> m_proxyList; }; #endif // QFACTIONCREATOR_H
/*! * @file ubridge10.h * @brief __ubirch#1 r0.3k0.1__ board specific defines * * @author Matthias L. Jugel * @date 2016-05-01 * * @copyright &copy; 2015 ubirch GmbH (https://ubirch.com) * * ``` * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ``` */ #include "spirit1.h" #ifndef _USENSE_BOARD_H_ #define _USENSE_BOARD_H_ //! @{ #define BOARD_USENSE #define BOARD "uSense" #define BOARD_MODE_RUN 0 #define BOARD_MODE_VLPR 1 #define BOARD_MODE_HSRUN 2 #define BOARD_SYSTICK_1MS (SystemCoreClock / 1000 - 1) #define BOARD_SYSTICK_100MS (SystemCoreClock / 100 - 1) // amount of LEDs available on the board #define BOARD_LEDS 1 #define BOARD_LED0(on) // on-board button (PTD0) //#define BOARD_BUTTON0_PORT PORTD //#define BOARD_BUTTON0_GPIO GPIOD //#define BOARD_BUTTON0_PORT_CLOCK kCLOCK_PortD //#define BOARD_BUTTON0_PIN 0 //#define BOARD_BUTTON0_IRQ PORTD_IRQn //#define BOARD_BUTTON0_HANDLER PORTD_IRQHandler // KL82z NMI pin (PTA4) #define BOARD_NMI_PORT PORTA #define BOARD_NMI_GPIO GPIOA #define BOARD_NMI_PORT_CLOCK kCLOCK_PortA #define BOARD_NMI_PIN 4 // I2C configuration #define BOARD_I2C I2C1 #define BOARD_I2C_CLOCK I2C1_CLK_SRC #define BOARD_I2C_PORT PORTC #define BOARD_I2C_PORT_CLOCK kCLOCK_PortC #define BOARD_I2C_ALT kPORT_MuxAlt2 #define BOARD_I2C_SCL_PIN 10U #define BOARD_I2C_SDA_PIN 11U // SPI configuration // TODO add SPI config // timer interrupt (PIT) #define BOARD_TIMER PIT #define BOARD_TIMER_IRQ PIT0_IRQn #define BOARD_TIMER_HANDLER PIT0_IRQHandler //! LPUART1 (RX - PTA1, TX - PTA2) #define BOARD_DEBUG_TYPE DEBUG_CONSOLE_DEVICE_TYPE_LPUART #define BOARD_DEBUG_UART LPUART0 #define BOARD_DEBUG_CLK_FREQ CLOCK_GetPllFllSelClkFreq() #define BOARD_DEBUG_IRQ LPUART0_IRQn #define BOARD_DEBUG_IRQ_HANDLER LPUART0_IRQHandler #define BOARD_DEBUG_BAUD 115200 #define BOARD_DEBUG_PORT PORTA #define BOARD_DEBUG_PORT_CLOCK kCLOCK_PortA #define BOARD_DEBUG_RX_PIN 1U #define BOARD_DEBUG_RX_ALT kPORT_MuxAlt2 #define BOARD_DEBUG_TX_PIN 2U #define BOARD_DEBUG_TX_ALT kPORT_MuxAlt2 //! @} #endif // _USENSE_BOARD_H_
// // AmpleGPS.h // // // Created by dial on 4/16/16. // // #ifndef AMPLEGPS_H #define AMPLEGPS_H #endif /* AmpleGPS_h */ // char *nmeaPrefix = "$GP";// keep in mind that 'GP" may be changed // The prefix will be removed asap in order to save some bytes #define GPRMC_NMEA "RMC" #define GPVTG_NMEA "VTG" #define GPGGA_NMEA "GGA" #define GPGSA_NMEA "GSA" #define GPGSV_NMEA "GSV" #define GPGLL_NMEA "GLL" #include "Arduino.h" #define MAXLINELENGTH 87 // max length for NMEA sentences to parse: 82 + '$'+ checksum (*00) +'\0' [=87] #define MAXSATELLITES 16 // supposed to be 16, but some are carried on while not in sight const float half_piRad PROGMEM = 0.017453293;// = π/180 const uint16_t doubleEarth PROGMEM = 12742;// = 2 * 6371// diameter of the Earth enum {//GPS_Mode GPS_PAUSED = 0, GPS_DO_NOT_PARSE = (1 << 0), GPS_NEW_COORDS = (1 << 1), GPS_NEW_TIME = (1 << 2), GPS_UPDATE_SATS = (1 << 3), GPS_RESERVED = (1 << 4), GPS_COMPLETE_DATA = (1 << 5), GPS_VIEW_UNPARSED = (1 << 6), } ;//GPS_Mode_t; typedef int (*callBackFunction) (uint8_t callBackMode); typedef struct gsv_satellite { //inserted for GPGSV @dial uint8_t number; //4 = SV PRN number uint8_t elevation; //5 = Elevation in degrees, 90 maximum uint16_t azimuth; //6 = Azimuth, degrees from true north, 000 to 359 uint8_t strength; //7 = SNR, 00-99 dB (null when not tracking) }GSV_Satellite; class AmpleGPS { public: uint16_t milliseconds; char readBuffer[MAXLINELENGTH]; uint8_t bufferIndex=0; char nmeaSentence[81];//82 -'GP' +'/0'; char *checksumString; uint16_t nmeaCheckSum; uint8_t hour, minute, seconds, year, month, day; uint8_t mode; callBackFunction callBack; float latitudeDegrees, longitudeDegrees, altitude; float speedOnGround, bearing, HDOP; boolean fix; uint8_t fixquality, satellitesCount; GSV_Satellite satellitesBuffer[MAXSATELLITES]; boolean gsv_isDirty; char *unparsedSentence; char readSentence(char c); boolean parseSentence(char *nmeaSentence); void begin(); float getDistanceInKm( float targetLat, float targetLon); private: char *parseSingleSatellite(char *p, gsv_satellite *aSatellite); char *parseSingleCoord (char *p, float *degreeValue); char *parsePairOfCoords (char *p); char *parseTime(char *p); int performCallBack(uint8_t suggestedMode); };
#pragma once #include "ofMain.h" #include "pingPongFbo.h" class testApp : public ofBaseApp { public: static const int Width = 512; static const int Height = 512; public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void loadShaders(); private: ofShader mGameShader; ofShader mWarpShader; ofShader mLenseShader; pingPongFbo mFbos; ofPlanePrimitive mPlane; ofFbo mRenderFbo; bool mMouseDown; bool mSpawn; bool mReset; bool mDoRotate; float mAngle; float mMouseDx; int mMouseX0; float mMouseX0Time; int mFrame; };
/* ** $Id: llex.h 4116 2012-04-12 22:35:23Z olereinhardt $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ #ifndef llex_h #define llex_h #include <lua/lobject.h> #include <lua/lzio.h> #define FIRST_RESERVED 257 /* maximum length of a reserved word */ #define TOKEN_LEN (sizeof("function")/sizeof(char)) /* * WARNING: if you change the order of this enumeration, * grep "ORDER RESERVED" */ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, /* other terminal symbols */ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, TK_NAME, TK_STRING, TK_EOS }; /* number of reserved words */ #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) /* array with token `names' */ LUAI_DATA const char *const luaX_tokens []; typedef union { lua_Number r; TString *ts; } SemInfo; /* semantics information */ typedef struct Token { int token; SemInfo seminfo; } Token; typedef struct LexState { int current; /* current character (charint) */ int linenumber; /* input line counter */ int lastline; /* line of last token `consumed' */ Token t; /* current token */ Token lookahead; /* look ahead token */ struct FuncState *fs; /* `FuncState' is private to the parser */ struct lua_State *L; ZIO *z; /* input stream */ Mbuffer *buff; /* buffer for tokens */ TString *source; /* current source name */ char decpoint; /* locale decimal point */ } LexState; LUAI_FUNC void luaX_init (lua_State *L); LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source); LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC void luaX_lookahead (LexState *ls); LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); #endif
/** * Copyright (c) 2014 Los Alamos National Security, LLC * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * LA-CC 10-123 */ #ifndef LGNCG_COMP_RESTRICTION_H_INCLUDED #define LGNCG_COMP_RESTRICTION_H_INCLUDED #include "vector.h" #include "sparsemat.h" #include "utils.h" #include "tids.h" #include "legion.h" namespace lgncg { /** * responsible for setting up the task launch of the compute restriction * operation. */ static inline void restriction(SparseMatrix &A, Vector &rf, LegionRuntime::HighLevel::Context &ctx, LegionRuntime::HighLevel::HighLevelRuntime *lrt) { using namespace LegionRuntime::HighLevel; int idx = 0; ArgumentMap argMap; IndexLauncher il(LGNCG_RESTRICTION_TID, A.mgData->Axf.lDom(), TaskArgument(NULL, 0), argMap); // A.mgData->Axf il.add_region_requirement( RegionRequirement(A.mgData->Axf.lp(), 0, READ_ONLY, EXCLUSIVE, A.mgData->Axf.lr) ); il.add_field(idx++, A.mgData->Axf.fid); // rf il.add_region_requirement( RegionRequirement(rf.lp(), 0, READ_ONLY, EXCLUSIVE, rf.lr) ); il.add_field(idx++, rf.fid); // A.mgData->rc il.add_region_requirement( RegionRequirement(A.mgData->rc.lp(), 0, WRITE_DISCARD, EXCLUSIVE, A.mgData->rc.lr) ); il.add_field(idx++, A.mgData->rc.fid); // A.mgData->f2cOp il.add_region_requirement( RegionRequirement(A.mgData->f2cOp.lp(), 0, READ_ONLY, EXCLUSIVE, A.mgData->f2cOp.lr) ); il.add_field(idx++, A.mgData->f2cOp.fid); // execute the thing... (void)lrt->execute_index_space(ctx, il); } /** * */ inline void restrictionTask( const LegionRuntime::HighLevel::Task *task, const std::vector<LegionRuntime::HighLevel::PhysicalRegion> &rgns, LegionRuntime::HighLevel::Context ctx, LegionRuntime::HighLevel::HighLevelRuntime *lrt ) { using namespace LegionRuntime::HighLevel; using namespace LegionRuntime::Accessor; using LegionRuntime::Arrays::Rect; (void)ctx; (void)lrt; static const uint8_t AxfRID = 0; static const uint8_t rfRID = 1; static const uint8_t rcRID = 2; static const uint8_t f2cRID = 3; // A.mgData->Axf, rf, A.mgData->rc, A.mgData->f2cOp assert(4 == rgns.size()); // name the regions const PhysicalRegion &Axfpr = rgns[AxfRID]; const PhysicalRegion &rfpr = rgns[rfRID]; const PhysicalRegion &rcpr = rgns[rcRID]; const PhysicalRegion &f2cpr = rgns[f2cRID]; // convenience typedefs typedef RegionAccessor<AccessorType::Generic, double> GDRA; typedef RegionAccessor<AccessorType::Generic, int64_t> GLRA; // vectors GDRA Axf = Axfpr.get_field_accessor(0).typeify<double>(); const Domain AxfDom = lrt->get_index_space_domain( ctx, task->regions[AxfRID].region.get_index_space() ); GDRA rf = rfpr.get_field_accessor(0).typeify<double>(); const Domain rfDom = lrt->get_index_space_domain( ctx, task->regions[rfRID].region.get_index_space() ); GDRA rc = rcpr.get_field_accessor(0).typeify<double>(); const Domain rcDom = lrt->get_index_space_domain( ctx, task->regions[rcRID].region.get_index_space() ); GLRA f2c = f2cpr.get_field_accessor(0).typeify<int64_t>(); const Domain f2cDom = lrt->get_index_space_domain( ctx, task->regions[f2cRID].region.get_index_space() ); Rect<1> myGridBounds = AxfDom.get_rect<1>(); Rect<1> rec; ByteOffset boff[1]; // Axf const double *const Axfp = Axf.raw_rect_ptr<1>(myGridBounds, rec, boff); bool offd = offsetsAreDense<1, double>(myGridBounds, boff); assert(offd); // rf myGridBounds = rfDom.get_rect<1>(); const double *const rfp = rf.raw_rect_ptr<1>(myGridBounds, rec, boff); offd = offsetsAreDense<1, double>(myGridBounds, boff); assert(offd); // rc myGridBounds = rcDom.get_rect<1>(); double *rcp = rc.raw_rect_ptr<1>(myGridBounds, rec, boff); offd = offsetsAreDense<1, double>(myGridBounds, boff); assert(offd); // f2c myGridBounds = f2cDom.get_rect<1>(); Rect<1> f2csr; ByteOffset f2cOff[1]; const int64_t *const f2cp = f2c.raw_rect_ptr<1>(myGridBounds, f2csr, f2cOff); offd = offsetsAreDense<1, int64_t>(myGridBounds, boff); assert(offd); // now, actually perform the computation const int64_t nc = rcDom.get_rect<1>().volume(); for (int64_t i = 0; i < nc; ++i) { rcp[i] = rfp[f2cp[i]] - Axfp[f2cp[i]]; } } } #endif
#ifndef _O5M_H #define _O5M_H #include <string> #include <stdint.h> #include <vector> #include "fixeddeque.h" #include <map> #include <iostream> #include <memory> #ifdef PYTHON_AWARE #include <Python.h> #endif #include "OsmData.h" void TestDecodeNumber(); void TestEncodeNumber(); ///Decodes a binary o5m stream and fires a series of events to the output object derived from IDataStreamHandler class O5mDecode : public OsmDecoder { protected: std::istream handle; int64_t lastObjId; int64_t lastTimeStamp; int64_t lastChangeSet; FixedDeque<std::string> stringPairs; std::map<std::string, int> stringPairsDict; double lastLat; double lastLon; int64_t lastRefNode; int64_t lastRefWay; int64_t lastRefRelation; bool finished, stopProcessing; unsigned refTableLengthThreshold; unsigned refTableMaxSize; //Various buffers to avoid continuously reallocating memory std::string tmpBuff; class MetaData tmpMetaData; std::string combinedRawTmpBuff; std::vector<int64_t> tmpRefsBuff; TagMap tmpTagsBuff; std::vector<std::string> tmpRefRolesBuff, tmpRefTypeStrBuff; void DecodeBoundingBox(); void DecodeSingleString(std::istream &stream, std::string &out); void ConsiderAddToStringRefTable(const std::string &firstStr, const std::string &secondStr); void AddBuffToStringRefTable(const std::string &buff); void DecodeMetaData(std::istream &nodeDataStream, class MetaData &out); bool ReadStringPair(std::istream &stream, std::string &firstStr, std::string &secondStr); void DecodeNode(); void DecodeWay(); void DecodeRelation(); public: O5mDecode(std::streambuf &handleIn); virtual ~O5mDecode(); void ResetDeltaCoding(); bool DecodeNext(); void DecodeHeader(); void DecodeFinish(); }; ///Encodes a stream of map objects into an o5m output binary stream class O5mEncodeBase : public IDataStreamHandler { protected: int64_t lastObjId; int64_t lastTimeStamp; int64_t lastChangeSet; FixedDeque<std::string> stringPairs; std::map<std::string, int> stringPairsDict; double lastLat; double lastLon; int64_t lastRefNode; int64_t lastRefWay; int64_t lastRefRelation; unsigned refTableLengthThreshold; unsigned refTableMaxSize; int64_t runningRefOffset; bool writtenHeader; void WriteStart(bool isDiff); void EncodeMetaData(const class MetaData &metaData, std::ostream &outStream); void WriteStringPair(const std::string &firstString, const std::string &secondString, std::ostream &tmpStream); void AddToRefTable(const std::string &encodedStrings); size_t FindStringPairsIndex(std::string needle, bool &indexFound); virtual void write (const char* s, std::streamsize n); virtual void operator<< (const std::string &val); public: O5mEncodeBase(); virtual ~O5mEncodeBase(); void ResetDeltaCoding(); bool Sync(); bool Reset(); bool Finish(); bool StoreIsDiff(bool); bool StoreBounds(double x1, double y1, double x2, double y2); bool StoreNode(int64_t objId, const class MetaData &metaData, const TagMap &tags, double lat, double lon); bool StoreWay(int64_t objId, const class MetaData &metaData, const TagMap &tags, const std::vector<int64_t> &refs); bool StoreRelation(int64_t objId, const class MetaData &metaData, const TagMap &tags, const std::vector<std::string> &refTypeStrs, const std::vector<int64_t> &refIds, const std::vector<std::string> &refRoles); }; class O5mEncode : public O5mEncodeBase { private: std::ostream handle; protected: virtual void write (const char* s, std::streamsize n) { this->handle.write(s, n); } virtual void operator<< (const std::string &val) { this->handle << val; } public: O5mEncode(std::streambuf &handle); virtual ~O5mEncode(); }; #ifdef PYTHON_AWARE class PyO5mEncode : public O5mEncodeBase { private: PyObject* m_PyObj; PyObject* m_Write; protected: virtual void write (const char* s, std::streamsize n); virtual void operator<< (const std::string &val); public: PyO5mEncode(PyObject* obj); virtual ~PyO5mEncode(); }; #endif //PYTHON_AWARE #endif //_O5M_H
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "RuntimeAssetCacheInterface.h" #include "RuntimeAssetCacheBPHooks.generated.h" /** Forward declarations */ class IRuntimeAssetCacheBuilder; class FOnRuntimeAssetCacheAsyncComplete; UCLASS() class URuntimeAssetCacheBPHooks : public UBlueprintFunctionLibrary { GENERATED_BODY() public: UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static FVoidPtrParam GetSynchronous(TScriptInterface<IRuntimeAssetCacheBuilder> CacheBuilder); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static int32 GetAsynchronous(TScriptInterface<IRuntimeAssetCacheBuilder> CacheBuilder, const FOnRuntimeAssetCacheAsyncComplete& CompletionDelegate); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static int32 GetCacheSize(FName Bucket); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static bool ClearCache(FName Bucket); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static void WaitAsynchronousCompletion(int32 Handle); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static FVoidPtrParam GetAsynchronousResults(int32 Handle); UFUNCTION(BlueprintCallable, Category = RuntimeAssetCache) static bool PollAsynchronousCompletion(int32 Handle); };
class Nuller; class Stream; struct FileTime; struct Date : RelOps< Date, Moveable<Date> > { byte day; byte month; int16 year; void Serialize(Stream& s); bool IsValid() const; void Set(int scalar); int Get() const; static Date Low() { return Date(-4000, 1, 1); } static Date High() { return Date(4000, 1, 1); } Date() { year = -32768; day = month = 0; } Date(const Nuller&) { year = -32768; day = month = 0; } Date(int y, int m, int d) { day = d; month = m; year = y; } }; inline unsigned GetHashValue(Date t) { return 512 * t.year + 32 * t.month + t.day; } inline bool operator==(Date a, Date b) { return a.day == b.day && a.month == b.month && a.year == b.year; } bool operator<(Date a, Date b); int operator-(Date a, Date b); Date operator+(Date a, int b); Date operator+(int a, Date b); Date operator-(Date a, int b); Date& operator+=(Date& a, int b); Date& operator-=(Date& a, int b); bool IsLeapYear(int year); int GetDaysOfMonth(int m, int y); int DayOfWeek(Date date); Date LastDayOfMonth(Date d); Date FirstDayOfMonth(Date d); Date LastDayOfYear(Date d); Date FirstDayOfYear(Date d); Date AddMonths(Date date, int months); Date AddYears(Date date, int years); Date GetSysDate(); String DayName(int i, int lang = 0); String DyName(int i, int lang = 0); String MonthName(int i, int lang = 0); String MonName(int i, int lang = 0); void SetDateFormat(const char *fmt); void SetDateScan(const char *scan); void SetDateFilter(const char *seps); const char *StrToDate(Date& d, const char *s); String Format(Date date); int CharFilterDate(int c); template<> inline String AsString(const Date& date) { return Format(date); } struct Time : Date, RelOps< Time, Moveable<Time> > { byte hour; byte minute; byte second; void Serialize(Stream& s); static Time High() { return Time(4000, 1, 1); } static Time Low() { return Time(-4000, 1, 1); } void Set(int64 scalar); int64 Get() const; Time() { hour = minute = second = 0; } Time(const Nuller&) { hour = minute = second = 0; } Time(int y, int m, int d, int h = 0, int n = 0, int s = 0) { day = d; month = m; year = y; hour = h; minute = n; second = s; } Time(FileTime filetime); FileTime AsFileTime() const; }; inline Time ToTime(const Date& d) { return Time(d.year, d.month, d.day); } inline unsigned GetHashValue(Time t) { return t.second + 32 * (t.minute + 32 * (t.hour + 16 * (t.day + 32 * (t.month + 8 * t.year)))); } bool operator==(Time a, Time b); bool operator<(Time a, Time b); int64 operator-(Time a, Time b); Time operator+(Time a, int64 seconds); Time operator+(int64 seconds, Time a); Time operator-(Time a, int64 secs); Time& operator+=(Time& a, int64 secs); Time& operator-=(Time& a, int64 secs); inline Time operator+(Time a, int i) { return a + int64(i); } inline Time operator-(Time a, int i) { return a - int64(i); } inline Time& operator+=(Time& a, int i) { return a += int64(i); } inline Time& operator-=(Time& a, int i) { return a -= int64(i); } inline Time operator+(Time a, double i) { return a + int64(i); } inline Time operator-(Time a, double i) { return a - int64(i); } inline Time& operator+=(Time& a, double i) { return a += int64(i); } inline Time& operator-=(Time& a, double i) { return a -= int64(i); } Time GetSysTime(); String Format(Time time, bool seconds = true); template<> inline String AsString(const Time& time) { return Format(time); }
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com> #ifndef NV_CORE_H #error "Do not include this file directly." #endif // Function linkage #define DLL_IMPORT __declspec(dllimport) #define DLL_EXPORT __declspec(dllexport) #define DLL_EXPORT_CLASS DLL_EXPORT // Function calling modes #define NV_CDECL __cdecl #define NV_STDCALL __stdcall #define NV_FASTCALL __fastcall #define NV_DEPRECATED #define NV_PURE #define NV_CONST // Set standard function names. #define snprintf _snprintf #if _MSC_VER < 1500 # define vsnprintf _vsnprintf #endif #define chdir _chdir #define getcwd _getcwd #ifndef va_copy #define va_copy(a, b) (a) = (b) #endif #if !defined restrict #define restrict #endif // Ignore gcc attributes. #define __attribute__(X) #if !defined __FUNC__ #define __FUNC__ __FUNCTION__ #endif #define NV_NOINLINE __declspec(noinline) #define NV_FORCEINLINE __forceinline /* // Type definitions typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned __int64 uint64; typedef signed __int64 int64; // Aliases typedef uint32 uint; */ // Unwanted VC++ warnings to disable. /* #pragma warning(disable : 4244) // conversion to float, possible loss of data #pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch #pragma warning(disable : 4100) // unreferenced formal parameter #pragma warning(disable : 4514) // unreferenced inline function has been removed #pragma warning(disable : 4710) // inline function not expanded #pragma warning(disable : 4127) // Conditional expression is constant #pragma warning(disable : 4305) // truncation from 'const double' to 'float' #pragma warning(disable : 4505) // unreferenced local function has been removed #pragma warning(disable : 4702) // unreachable code in inline expanded function #pragma warning(disable : 4711) // function selected for automatic inlining #pragma warning(disable : 4725) // Pentium fdiv bug #pragma warning(disable : 4786) // Identifier was truncated and cannot be debugged. #pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup */ #pragma warning(1 : 4705) // Report unused local variables. #pragma warning(1 : 4555) // Expression has no effect.
////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2015, Brendan Bolles // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////////// //------------------------------------------ // // OpenEXR_Premiere_Export.h // // OpenEXR plug-in for Adobe Premiere // //------------------------------------------ #ifndef _OPENEXR_PREMIERE_EXPORT_H #define _OPENEXR_PREMIERE_EXPORT_H #include "PrSDKStructs.h" #include "PrSDKExport.h" #include "PrSDKExportFileSuite.h" #include "PrSDKExportInfoSuite.h" #include "PrSDKExportParamSuite.h" #include "PrSDKSequenceRenderSuite.h" #include "PrSDKPPixCreatorSuite.h" #include "PrSDKPPixCacheSuite.h" #include "PrSDKMemoryManagerSuite.h" #include "PrSDKWindowSuite.h" #include "PrSDKAppInfoSuite.h" #ifdef PRMAC_ENV #include <wchar.h> #endif extern "C" { DllExport PREMPLUGENTRY xSDKExport ( csSDK_int32 selector, exportStdParms *stdParms, void *param1, void *param2); } #endif // _OPENEXR_PREMIERE_EXPORT_H
/* * YAFFS: Yet another Flash File System . A NAND-flash specific file system. * * Copyright (C) 2002-2018 Aleph One Ltd. * * Created by Timothy Manning <timothy@yaffs.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 as * published by the Free Software Foundation. * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ #ifndef __test_yaffs_unlink_h__ #define __test_yaffs_unlink_h__ #include "lib.h" #include "yaffsfs.h" #include "test_yaffs_open.h" #include "test_yaffs_access.h" int test_yaffs_unlink(void); int test_yaffs_unlink_clean(void); #endif
/* * MyTempNodeType.h * * Created on: 2015年12月16日 * Author: moss */ #ifndef MYTEMPNODETYPE_H_ #define MYTEMPNODETYPE_H_ #include <khala/TempNodeType.h> class MyTempNodeType: public khala::TempNodeType { public: MyTempNodeType(); virtual ~MyTempNodeType(); virtual bool onDevTypeMsg(khala::InfoNodePtr& infoNodePtr, Json::Value& msg, khala::Timestamp time); virtual bool onTimeMsg(khala::InfoNodePtr& infoNodePtr, Json::Value& msg, khala::Timestamp time); virtual void setRegisterMsg(khala::RegisterHandler& handler); }; #endif /* MYTEMPNODETYPE_H_ */
/*************************************************************************************************\ MPGameBrowser.h : Interface for the MPGameBrowser component. //---------------------------------------------------------------------------// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// \*************************************************************************************************/ #pragma once #ifndef MPGAMEBROWSER_H #define MPGAMEBROWSER_H //#include "mechgui/logisticsscreen.h" //#include "mechgui/asystem.h" //#include "mechgui/alistbox.h" //#include "attributemeter.h" //#include "simplecamera.h" //#include "multplyr.h" //#include "mechgui/aanim.h" //#include "mphostgame.h" class aButton; // struct _MC2Session; class aStyle3TextListItem : public aTextListItem { public: aStyle3TextListItem() { hasAnimation = false; normalcolour = 0xff808080; } virtual int32_t init(FitIniFile* file, const std::wstring_view& blockName); virtual void render(void); protected: bool hasAnimation; aAnimGroup animGroup; int32_t normalcolour; }; class aGameListItem : public aListItem { public: aGameListItem(void); virtual int32_t init(FitIniFile* file, const std::wstring_view& blockName); virtual void update(void); void setSessionInfo(_MC2Session* pSessions); const std::wstring_view& getSessionName(void); const std::wstring_view& getText(int32_t which); const MC2Session* getSession(void) { return (&session); } aGameListItem& operator=(const aGameListItem&); protected: MC2Session session; aObject allTechGraphic; aStyle3TextListItem gameName; aStyle3TextListItem numPlayers; aStyle3TextListItem mapName; aTextListItem latency; aRect allTechRect; aRect gameNameRect; aRect numPlayersRect; aRect mapNameRect; aRect latencyRect; aObject pingIcon; }; class MPGameBrowser : public LogisticsScreen { public: MPGameBrowser(void); virtual ~MPGameBrowser(void); void init(FitIniFile* file); bool isDone(void); virtual void begin(void); virtual void end(void); virtual void render(int32_t xOffset, int32_t yOffset); virtual void render(void); virtual void update(void); virtual int32_t handleMessage(uint32_t, uint32_t); private: int32_t indexOfButtonWithID(int32_t id); aListBox gameList; aGameListItem items[256]; aGameListItem templateItem; MPHostGame hostDlg; bool bHosting; bool bShowErrorDlg; int32_t sortOrder; int32_t bSortUpward; int32_t oldScrollPos; }; #endif // end of file ( MPGameBrowser.h )
//===========================================================================// // AttributeMeter.h : Implementation of the AttributeMeter component. // //---------------------------------------------------------------------------// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// #pragma once #ifndef ATTRIBUTEMETER_H #define ATTRIBUTEMETER_H //#include "utilities.h" class FitIniFile; constexpr const float MAX_ARMOR_RANGE = 432.f; constexpr const float MAX_SPEED_RANGE = 35.f; constexpr const float MAX_JUMP_RANGE = 125.f; /************************************************************************************************** CLASS DESCRIPTION AttributeMeter: **************************************************************************************************/ class AttributeMeter { public: AttributeMeter(void) noexcept { } void update(void); void render(void); void render(int32_t xOffset, int32_t yOffset); void init(FitIniFile* file, const std::wstring_view& headerName); void setValue(float val) { m_percent = val < 0 ? 0 : val; } void setAddedValue(float val) { m_addedpercent = val < 0 ? 0 : val; } void setcolourMin(uint32_t newcolour) { m_mincolour = newcolour; } void setcolourMax(uint32_t newcolour) { m_maxcolour = newcolour; } void setAddedcolourMin(uint32_t newcolour) { m_addedmincolour = newcolour; } void setAddedcolourMax(uint32_t newcolour) { m_addedmaxcolour = newcolour; } void showGUIWindow(bool show) { m_doshow = show; } bool pointInside(int32_t mouseX, int32_t mouseY) const; private: RECT m_outsiderect{}; uint32_t m_unitheight = 0; uint32_t m_unitwidth = 0; uint32_t m_unitcount = 0; uint32_t m_skipwidth = 0; uint32_t m_rectcolour = 0; uint32_t m_mincolour = 0xff005392; uint32_t m_maxcolour = 0xffcdeaff; uint32_t m_addedmincolour = 0; uint32_t m_addedmaxcolour = 0; uint32_t m_numbars = 0; uint32_t m_helpid = 0; float m_percent = 0; float m_addedpercent = 0; bool m_doshow = true; }; #endif // end of file ( AttributeMeter.h )
/* * RudeSkinnedMesh.h * golf * * Created by Robert Rose on 9/20/08. * Copyright 2008 Bork 3D LLC. All rights reserved. * */ #ifndef __H_RudeSkinnedMesh #define __H_RudeSkinnedMesh #include "RudeMesh.h" class RudeObject; class RudeSkinnedMesh : public RudeMesh { public: RudeSkinnedMesh(RudeObject *owner); ~RudeSkinnedMesh(); virtual int Load(const char *name); virtual void NextFrame(float delta); virtual void Render(); virtual float GetFrame() { return m_frame; } virtual void SetFrame(float f); virtual void AnimateTo(float f); void SetAnimate(bool a) { m_animate = a; } private: float m_frame; float m_toFrame; float m_fps; bool m_animateTo; bool m_animate; }; #endif
char* utoa64_sse(uint64_t v) { // v is 16-digit number = abcdefghijklmnop const __m128i div_10000 = _mm_set1_epi32(DIV_10000); const __m128i mul_10000 = _mm_set1_epi32(10000); const int div_10000_shift = 45; const __m128i div_100 = _mm_set1_epi16(DIV_100); const __m128i mul_100 = _mm_set1_epi16(100); const int div_100_shift = 3; const __m128i div_10 = _mm_set1_epi16(DIV_10); const __m128i mul_10 = _mm_set1_epi16(10); const __m128i ascii0 = _mm_set1_epi8('0'); // can't be easliy done in SSE const uint32_t a = v / 100000000; // 8-digit number: abcdefgh const uint32_t b = v % 100000000; // 8-digit number: ijklmnop // [ 3 | 2 | 1 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 0 ] // x = [ 0 | ijklmnop | 0 | abcdefgh ] __m128i x = _mm_set_epi64x(b, a); // x div 10^4 = [ 0 | ijkl | 0 | abcd ] __m128i x_div_10000; x_div_10000 = _mm_mul_epu32(x, div_10000); x_div_10000 = _mm_srli_epi64(x_div_10000, div_10000_shift); // x mod 10^4 = [ 0 | mnop | 0 | efgh ] __m128i x_mod_10000; x_mod_10000 = _mm_mul_epu32(x_div_10000, mul_10000); x_mod_10000 = _mm_sub_epi32(x, x_mod_10000); // y = [ mnop | ijkl | efgh | abcd ] __m128i y = _mm_or_si128(x_div_10000, _mm_slli_epi64(x_mod_10000, 32)); // y_div_100 = [ 0 | mn | 0 | ij | 0 | ef | 0 | ab ] __m128i y_div_100; y_div_100 = _mm_mulhi_epu16(y, div_100); y_div_100 = _mm_srli_epi16(y_div_100, div_100_shift); // y_mod_100 = [ 0 | op | 0 | kl | 0 | gh | 0 | cd ] __m128i y_mod_100; y_mod_100 = _mm_mullo_epi16(y_div_100, mul_100); y_mod_100 = _mm_sub_epi16(y, y_mod_100); // z = [ mn | op | ij | kl | ef | gh | ab | cd ] __m128i z = _mm_or_si128(y_div_100, _mm_slli_epi32(y_mod_100, 16)); // z_div_10 = [ 0 | m | 0 | o | 0 | i | 0 | k | 0 | e | 0 | g | 0 | a | 0 | c ] __m128i z_div_10 = _mm_mulhi_epu16(z, div_10); // z_mod_10 = [ 0 | n | 0 | p | 0 | j | 0 | l | 0 | f | 0 | h | 0 | b | 0 | d ] __m128i z_mod_10; z_mod_10 = _mm_mullo_epi16(z_div_10, mul_10); z_mod_10 = _mm_sub_epi16(z, z_mod_10); // interleave z_mod_10 and z_div_10 - // tmp = [ m | n | o | p | i | j | k | l | e | f | g | h | a | b | c | d ] __m128i tmp = _mm_or_si128(z_div_10, _mm_slli_epi16(z_mod_10, 8)); // determine number of leading zeros uint16_t mask = ~_mm_movemask_epi8(_mm_cmpeq_epi8(tmp, _mm_setzero_si128())); uint32_t offset = __builtin_ctz(mask | 0x8000); // convert to ascii tmp = _mm_add_epi8(tmp, ascii0); // and save result _mm_storeu_si128((__m128i*)utoa_buffer, tmp); return &utoa_buffer[offset]; }
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2016-2021 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #pragma once #include <modules/base/basemoduledefine.h> #include <inviwo/core/datastructures/volume/volume.h> namespace inviwo { namespace util { IVW_MODULE_BASE_API std::unique_ptr<Volume> divergenceVolume(const Volume& volume); IVW_MODULE_BASE_API std::unique_ptr<Volume> divergenceVolume(std::shared_ptr<const Volume> volume); } // namespace util } // namespace inviwo
#ifndef _VM_ #define _VM_ #include <set> #include <string> #include "utils/func_option.h" #include "sysinfo/vm/dynamic/vm_base.h" #include "sysinfo/vm/dynamic/vm_cpu_usage.h" #include "sysinfo/vm/dynamic/vm_cache_miss.h" #include "exec/cpu_mig.h" #include <mutex> class Host; class VM; class VmSet { friend class Vsf; public: static VmSet* get_instance(); std::set<VM> init_vms(Host *host); std::set<VM> init_vms(Host *host, std::string vm_cmd); private: VmSet(); ~VmSet(); void set_param(std::map<Option, std::map<OptionParam, OptionParamVal> > ops); void clear_param(std::vector<Option> ops); void set_param_by_option(const Option& op, std::map<OptionParam, OptionParamVal>& op_param); void delete_callback(Option op); std::mutex init_vms_mutex_; FuncOption *func_option_; VmBase *vm_base_; VmCpuUsage *vm_cpu_usage_; VmCacheMiss *vm_cache_miss_; }; class VM { public: VM(VmId vm_id); VM &operator=(const VM &v); //OP_VM_BASE VmId vm_id() const; std::string name() const; std::string uuid() const; int vsocket_num() const; int vcore_num() const; int vhpthread_num() const; int total_mem_size() const; std::set<pid_t> vcpu_ids() const; int vcpu_num() const; std::set<pid_t> stable_vmthread_ids() const; int stable_vmthread_num() const; std::set<pid_t> volatile_vmthread_ids() const; int volatile_vmthread_num() const; //OP_VM_CPU_USAGE int sys_cpu_usage() const; int cpu_usage() const; int cpu_usage(pid_t vmthread_id) const; HpthreadId running_on_hpthread(pid_t vmthread_id) const; //OP_VM_CACHE_MISS CacheMissData cache_miss() const; CacheMissData cache_miss(pid_t vmthread_id) const; //VCPU MIG void set_vcpu_mig(pid_t vmthread_id, std::set<HpthreadId> hpthread_ids) const; private: VmId vm_id_; VmBase *vm_base_; VmCpuUsage *vm_cpu_usage_; VmCacheMiss *vm_cache_miss_; CpuMig *cpu_mig_; }; bool operator<(const VM &lv, const VM &rv); #endif
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2014-2015 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #ifndef IVW_PYTHONSCRIPT_H #define IVW_PYTHONSCRIPT_H #include <modules/python3/python3moduledefine.h> #include <inviwo/core/common/inviwo.h> namespace inviwo { /** * Class for handling storage, compile and running of Python Scripts. * Used by PythonScriptEditor and PythonModule * */ class IVW_MODULE_PYTHON3_API PythonScript { public: PythonScript(); /** * Frees the stored byte code. Make sure that the * Python interpreter is still initialized * when deleting the script. */ ~PythonScript(); /** * Sets the source for the Python (replacing the current source). */ void setSource(const std::string& source); /** * Returns the script's source. */ std::string getSource() const; /** * Runs the script once, * if the script has changed since last compile a new compile call will be issued. * * If an error occurs, the error message is logged to the inviwo logger and python standard output. * * @return true, if script execution has been successful */ bool run(bool outputInfo = true); private: bool checkCompileError(); bool checkRuntimeError(); /** * Compiles the script source to byte code, which speeds up script execution * and is generally recommended, since it also produces more clear error messages. * * If an error occurs, the error message is stored and can be retrieved through getLog(). * * @param logErrors if true, error messages are also passed to the logger. * The internal log buffer is not affected by this parameter. * * @return true, if script compilation has been successful */ bool compile(bool outputInfo = true); std::string source_; void* byteCode_; bool isCompileNeeded_; }; } // namespace #endif // IVW_PYTHONSCRIPT_H
#pragma once /************************************************************************/ /* A value struct vector that supports efficient sorting */ /************************************************************************/ template<typename VT, typename ST> struct ValStructVec { ValStructVec(){clear();} inline int size() const {return sz;} inline void clear() {sz = 0; structVals.clear(); valIdxes.clear();} inline void reserve(int resSz){clear(); structVals.reserve(resSz); valIdxes.reserve(resSz); } inline void pushBack(const VT& val, const ST& structVal) {valIdxes.push_back(make_pair(val, sz)); structVals.push_back(structVal); sz++;} inline const VT& operator ()(int i) const {return valIdxes[i].first;} // Should be called after sort inline const ST& operator [](int i) const {return structVals[valIdxes[i].second];} // Should be called after sort inline VT& operator ()(int i) {return valIdxes[i].first;} // Should be called after sort inline ST& operator [](int i) {return structVals[valIdxes[i].second];} // Should be called after sort void sort(bool descendOrder = true); const vector<ST> &getSortedStructVal(); void append(const ValStructVec<VT, ST> &newVals, int startV = 0); vector<ST> structVals; // struct values private: int sz; // size of the value struct vector vector<pair<VT, int>> valIdxes; // Indexes after sort bool smaller() {return true;}; vector<ST> sortedStructVals; }; template<typename VT, typename ST> void ValStructVec<VT, ST>::append(const ValStructVec<VT, ST> &newVals, int startV) { int sz = newVals.size(); for (int i = 0; i < sz; i++) pushBack((float)((i+300)*startV)/*newVals(i)*/, newVals[i]); } template<typename VT, typename ST> void ValStructVec<VT, ST>::sort(bool descendOrder /* = true */) { if (descendOrder) std::sort(valIdxes.begin(), valIdxes.end(), std::greater<pair<VT, int>>()); else std::sort(valIdxes.begin(), valIdxes.end(), std::less<pair<VT, int>>()); } template<typename VT, typename ST> const vector<ST>& ValStructVec<VT, ST>::getSortedStructVal() { sortedStructVals.resize(sz); for (int i = 0; i < sz; i++) sortedStructVals[i] = structVals[valIdxes[i].second]; return sortedStructVals; } /* void valStructVecDemo() { ValStructVec<int, string> sVals; sVals.pushBack(3, "String 3"); sVals.pushBack(5, "String 5"); sVals.pushBack(4, "String 4"); sVals.pushBack(1, "String 1"); sVals.sort(false); for (int i = 0; i < sVals.size(); i++) printf("%d, %s\n", sVals(i), _S(sVals[i])); } */
/** * Copyright 2013: James Steven Supancic III **/ #include "using.hpp" #pragma once class Evaluator { private: PXCSmartPtr<PXCSession>&session; UtilRender renderer_depth; PXCSmartPtr<PXCAccelerator> accel; PXCSmartPtr<UtilRender> renderer_blob; PXCSmartPtr<PXCGesture> gestureDetector; PXCGesture::ProfileInfo detector_profile; UtilCmdLine cmdline; UtilCaptureFile capture; //FILE* log; protected: PXCDetection detect(PXCSmartPtr<PXCImage> & loaded_PXC, Mat Z, int iterations = 100); vector<PXCDetection> detect_all(PXCSmartPtr<PXCImage> & loaded_PXC, Mat Z, int iterations = 100); void vis_detection(Mat&RGB,Mat&Z,Mat&UV,Rect&bb_gt,PXCDetection&detection); public: PXCDetection detect(Mat Z, Mat Conf, Mat UV, Mat RGB, int iterations = 100); Evaluator(PXCSmartPtr<PXCSession>&session); virtual ~Evaluator(); void eval(string dir = "Z:\\dropbox\\data\\Yi_Test\\"); void eval_video(string video_file); void eval_bin(string directory); void logToFiles(string im_file, string label_file, Rect BB); };
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once #include <string> #include <unordered_map> #include <vector> #include "TinyXml2\tinyxml2.h" class LanguageTranslator { public: LanguageTranslator(); LanguageTranslator(std::wstring langFileName); void LoadTranslations(); /// <summary> /// Translates the provided string to the current locale. If no translation /// is available, the original string is returned. /// </summary> const std::wstring &Translate(const std::wstring &str); const std::wstring TranslateAndReplace( const std::wstring &str, const std::wstring &arg); /// <summary> /// Replaces the placeholder(s) in str with args, but does not perform a /// translation lookup. /// </summary> const std::wstring Replace( const std::wstring &str, const std::wstring &arg); const std::wstring &LanguageName(); const std::wstring &Author(); public: static std::vector<std::wstring> CurrentLocale(); private: tinyxml2::XMLDocument _xml; tinyxml2::XMLElement *_root; std::unordered_map<std::wstring, std::wstring> _translations; std::wstring _author; std::wstring _name; std::wstring _id; std::vector<std::wstring> _regions; };
/* * POK header * * The following file is a part of the POK project. Any modification should * made according to the POK licence. You CANNOT use this file or a part of * this file is this part of a file for your own project * * For more information on the POK licence, please see our LICENCE FILE * * Please follow the coding guidelines described in doc/CODING_GUIDELINES * * Copyright (c) 2007-2009 POK team * * Created by julien on Sat Jan 31 20:12:07 2009 */ #include <core/dependencies.h> #ifdef POK_CONFIG_NEEDS_FUNC_CALLOC #include <types.h> #include <core/allocator.h> void *calloc(size_t count, size_t size) { return pok_allocator_allocate (count * size); } #endif
/* $Id: thres.c,v 1.1 2014/03/05 21:15:11 weerd Exp $ */ /* * Copyright (c) 2004 Daniel Hartmeier * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDERS 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. * */ static const char rcsid[] = "$Id: thres.c,v 1.1 2014/03/05 21:15:11 weerd Exp $"; #include <stdlib.h> #include <string.h> static double val_u = 0.0; static double val_d = 0.0; static double val_s = 0.0; static double val_c = 0.0; static int eval_val(const char **, double *); static int eval_arg(const char **, double *); static int eval_cond(const char **); static int eval_term(const char **); enum { COND_OP_EQUAL, COND_OP_UNEQUAL, COND_OP_LESS, COND_OP_LESSEQUAL, COND_OP_MORE, COND_OP_MOREEQUAL }; static int eval_val(const char **s, double *d) { while (**s == ' ') (*s)++; if (**s == '(') { (*s)++; if (eval_arg(s, d)) return (-1); while (**s == ' ') (*s)++; if (**s != ')') return (-1); (*s)++; return (0); } switch (**s) { case 'u': *d = val_u; (*s)++; break; case 'd': *d = val_d; (*s)++; break; case 's': *d = val_s; (*s)++; break; case 'c': *d = val_c; (*s)++; break; default: { char *t; *d = strtod(*s, &t); if (t == *s) return (-1); *s = t; } } return (0); } static int eval_arg(const char **s, double *d) { if (eval_val(s, d)) return (-1); while (**s == ' ') (*s)++; while (**s == '+' || **s == '-' || **s == '*' || **s == '/') { char op = *((*s)++); double e; if (eval_val(s, &e)) return (-1); switch (op) { case '+': *d += e; break; case '-': *d -= e; break; case '*': *d *= e; break; case '/': if (e == 0.0) *d = 0.0; else *d /= e; break; } while (**s == ' ') (*s)++; } return (0); } static int eval_cond(const char **s) { double a, b; int op = -1; while (**s == ' ') (*s)++; if (eval_arg(s, &a)) return (-1); if (!**s) return (-1); if (!strncmp(*s, "<=", 2)) { op = COND_OP_LESSEQUAL; *s += 2; } else if (!strncmp(*s, ">=", 2)) { op = COND_OP_MOREEQUAL; *s += 2; } else if (!strncmp(*s, "!=", 2)) { op = COND_OP_UNEQUAL; *s += 2; } else if (**s == '<') { op = COND_OP_LESS; (*s)++; } else if (**s == '>') { op = COND_OP_MORE; (*s)++; } else if (**s == '=') { op = COND_OP_EQUAL; (*s)++; } else return (-1); if (eval_arg(s, &b)) return (-1); switch (op) { case COND_OP_EQUAL: return (a == b); case COND_OP_UNEQUAL: return (a != b); case COND_OP_LESS: return (a < b); case COND_OP_LESSEQUAL: return (a <= b); case COND_OP_MORE: return (a > b); case COND_OP_MOREEQUAL: return (a >= b); default: return (-1); } } static int eval_term(const char **s) { int r; while (**s == ' ') (*s)++; if ((r = eval_cond(s)) < 0) return (-1); while (**s == ' ') (*s)++; while (**s == '|' || **s == '&') { char op = *((*s)++); int q; switch (op) { case '|': break; case '&': break; default: return (-1); } while (**s == ' ') (*s)++; if ((q = eval_cond(s)) < 0) return (-1); r = (op == '|' ? r || q : r && q); } return (r); } int thres_eval(const char *thres, int modsum, int modcount) { char *e; long l; int moddown; if (thres == NULL || !*thres) return (0); l = strtol(thres, &e, 10); if (!*e) return (modsum >= l); moddown = (modcount - modsum) / 2; val_c = modcount; val_s = modsum; val_u = modcount - moddown; val_d = moddown; return (eval_term(&thres)); }
#pragma once #include "VulkanDef.h" #define DECLARE_FUNCTION(functionName) PFN_##functionName functionName = nullptr; namespace Framework { namespace Vulkan { class CInstance { public: CInstance() = default; CInstance(const VkInstanceCreateInfo&); CInstance(const CInstance&) = delete; CInstance(CInstance&&); virtual ~CInstance(); bool IsEmpty() const; void Reset(); CInstance& operator =(const CInstance&) = delete; CInstance& operator =(CInstance&&); operator VkInstance() const; DECLARE_FUNCTION(vkDestroyInstance) DECLARE_FUNCTION(vkCreateDevice) DECLARE_FUNCTION(vkDestroyDevice) DECLARE_FUNCTION(vkEnumeratePhysicalDevices) DECLARE_FUNCTION(vkGetDeviceProcAddr) DECLARE_FUNCTION(vkGetPhysicalDeviceMemoryProperties) DECLARE_FUNCTION(vkGetPhysicalDeviceProperties) DECLARE_FUNCTION(vkGetPhysicalDeviceQueueFamilyProperties) //VK_EXT_debug_report DECLARE_FUNCTION(vkCreateDebugReportCallbackEXT) DECLARE_FUNCTION(vkDestroyDebugReportCallbackEXT) //VK_KHR_surface DECLARE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) DECLARE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR) DECLARE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR) DECLARE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR) #if defined(VK_USE_PLATFORM_ANDROID_KHR) //VK_KHR_android_surface DECLARE_FUNCTION(vkCreateAndroidSurfaceKHR) #endif #if defined(VK_USE_PLATFORM_XCB_KHR) //VK_KHR_xcb_surface DECLARE_FUNCTION(vkCreateXcbSurfaceKHR) #endif #if defined(VK_USE_PLATFORM_WIN32_KHR) //VK_KHR_win32_surface DECLARE_FUNCTION(vkCreateWin32SurfaceKHR) #endif private: void Create(const VkInstanceCreateInfo&); VkInstance m_handle = VK_NULL_HANDLE; }; } } #undef DECLARE_FUNCTION
// ================================================================== // ROCS - Toolkit for Robots Comprehending Space // Copyright (C) 2010 Arnaud Ramey, Andrzej Pronobis // // This file is part of ROCS. // // ROCS is free software: you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation, either version 3 // of the License, or (at your option) any later version. // // ROCS 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 General Public License // along with ROCS. If not, see <http://www.gnu.org/licenses/>. // ================================================================== /*! * \file ChannelCache.h * * \date Sep 27, 2010 * \author Arnaud Ramey, Andrzej Pronobis * * Contains declaration of the ChannelCache class. */ #ifndef CCHANNELCACHE_H_ #define CCHANNELCACHE_H_ #include <vector> namespace rocs { namespace math { template<typename _T> class Matrix_; } namespace cv { //using rocs::math::Matrix_; //template<class _T> class Matrix_; class Img; enum ChannelType { CT_UNKNOWN = 0, CT_L, CT_C1, CT_C2 }; /*! * Class storing a cache of channels. */ class ChannelCache { public: /*! Default constructor. */ inline ChannelCache(const Img &image) : _image(&image) { } ; /*! Destructor. Deletes all the channels. */ ~ChannelCache(); public: /*! Creates a new channel on the basis of the input image. If an identical channel already exists a new one will not be created. */ void createChannel(ChannelType channelType); /*! Returns a pointer to a matrix containing pixels of the channel. */ const math::Matrix_<double> *getChannel(ChannelType channelType) const; private: /*! Pointer to the input image. */ const Img* _image; /*! List storing pointers to channels. */ std::vector<math::Matrix_<double> *> _channelList; /*! List of types of channels in the _channelList. */ std::vector<ChannelType> _channelTypeList; }; } // end namespace cv } // end namespace rocs #endif /* CCHANNELCACHE_H_ */
#include "global.h" #include "pkg.h" void pkg_add_value(global_t *g, int v) { g->pkg->value = v; }
// Copyright (c) Lauri Mäkinen 2014 - 2015 // All rights reserved. #ifndef ENGINE_RTTI_OBJECT_H #define ENGINE_RTTI_OBJECT_H #include "engine/rtti/RTTI.h" #include "engine/Context.h" PROPELLER_FORWARD_DECLARE_2(engine, rtti, Class); namespace engine { namespace rtti { class Object : public Context { public: Object(void *context) : Context(context) { } void* operator new(size_t); void operator delete(void*); static engine::rtti::Class *getStaticTypeInfo(); virtual Class *getTypeInfo() = 0; #ifdef _EDITOR // virtual const String &getSourcePath() = 0; #endif }; template <typename T1, typename T2> T1* dynamicCast(T2 *ptr) { if (ptr == NULL) return NULL; engine::rtti::Class *target = T1::getStaticTypeInfo(); engine::rtti::Class *src = ptr->getTypeInfo(); // Target and the source is the same if (target == src) return (T1*)(ptr); //Find if ptr has T1 in one of its baseclasses. if (engine::rtti::RTTI::isDerivedFrom(target, src)) return (T1*)(ptr); if (engine::rtti::RTTI::isDerivedFrom(src, target)) return (T1*)(ptr); // if the source is object, the cast is always correct because everything is derived from it. if (src == Object::getStaticTypeInfo()) return (T1*)(ptr); // Cast failed, return NULL! #ifndef _EDITOR return NULL; #else //DEBUG_PRINT("dynamic_cast used because rcc++ RTTI merging gives invalid dynamicCasts!"); return dynamic_cast<T1*>(ptr); #endif } template <typename T> static T *generate(ContextData *context) { return engine::rtti::dynamicCast<T>(rtti::RTTI::generateSerializable(T::getStaticTypeInfo()->getTypeName(), context)); } } } #endif
/** * @file ptrace.h * @brief * @author Denis Deryugin <deryugin.denis@gmail.com> * @version * @date 19.07.2019 */ #ifndef AARCH64_PTRACE_H_ #define AARCH64_PTRACE_H_ #ifndef __ASSEMBLER__ #include <stdint.h> typedef struct pt_regs { uint64_t x[31]; } pt_regs_t; static inline void ptregs_retcode(struct pt_regs *ptregs, int retcode) { ptregs->x[0] = retcode; } #endif /* __ASSEMBLER__ */ #endif /* AARCH64_PTRACE_H_ */
//////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2017, Kuba Sejdak <kuba.sejdak@gmail.com> // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //////////////////////////////////////////////////////////////////////////////////// #ifndef PAGEPOOL_H #define PAGEPOOL_H #include "page.h" #include <os/chain.h> namespace Memory { class PagePool { public: static PagePool& instance() { static PagePool object; return object; } bool init(); os::chain<Page> allocatePages(unsigned int count); void releasePages(os::chain<Page>& pages); unsigned int pagesCount(); unsigned int freePagesCount(); private: PagePool(); private: Page m_initialPage; os::chain<Page> m_allPages; unsigned int m_pagesCount; unsigned int m_freePagesCount; }; } // namespace Memory #endif
/* * Copyright (c) 2014, STMicroelectronics International N.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <tee/tee_obj.h> #include <stdlib.h> #include <tee_api_defines.h> #include <mm/tee_mmu.h> #include <tee/tee_fs.h> #include <tee/tee_pobj.h> #include <trace.h> void tee_obj_add(struct tee_ta_ctx *ctx, struct tee_obj *o) { TAILQ_INSERT_TAIL(&ctx->objects, o, link); } TEE_Result tee_obj_get(struct tee_ta_ctx *ctx, uint32_t obj_id, struct tee_obj **obj) { struct tee_obj *o; TAILQ_FOREACH(o, &ctx->objects, link) { if (obj_id == (uint32_t) o) { *obj = o; return TEE_SUCCESS; } } return TEE_ERROR_BAD_PARAMETERS; } void tee_obj_close(struct tee_ta_ctx *ctx, struct tee_obj *o) { TAILQ_REMOVE(&ctx->objects, o, link); if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) && o->fd >= 0) { tee_file_ops.close(o->fd); tee_pobj_release(o->pobj); } if (o->cleanup) o->cleanup(o->data, true); free(o->data); free(o); } void tee_obj_close_all(struct tee_ta_ctx *ctx) { struct tee_obj_head *objects = &ctx->objects; while (!TAILQ_EMPTY(objects)) tee_obj_close(ctx, TAILQ_FIRST(objects)); }
// // BBMediaPickerAssetCollectionViewLayout.h // BBFrameworks // // Created by William Towe on 7/29/15. // Copyright (c) 2015 Bion Bilateral, LLC. All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import <UIKit/UIKit.h> @interface BBMediaPickerAssetCollectionViewLayout : UICollectionViewFlowLayout @property (assign,nonatomic) NSInteger numberOfColumns; @end
#ifndef VIEW_3D_H #define VIEW_3D_H #include <QWidget> #include <QPainter> #include <QtMath> #include <allOrder.h> #include <openglview.h> #include <iostream> #include <viewobj.h> namespace Ui { class CView3D; } class CView3D : public QWidget { Q_OBJECT public: explicit CView3D(QWidget *parent = 0); ~CView3D(); public slots: void Get(QString auth_key); void ShowInfomation(); void Show3d(); private: OpenGLView *view; QString m_auth_key; bool m_flag; Ui::CView3D *ui; ViewObj *mesh_model_; }; #endif // VIEW_3D_H
// 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 TOOLS_GN_BUILDER_RECORD_H_ #define TOOLS_GN_BUILDER_RECORD_H_ #include <memory> #include <set> #include <utility> #include "gn/item.h" #include "gn/location.h" class ParseNode; // This class is used by the builder to manage the loading of the dependency // tree. It holds a reference to an item and links to other records that the // item depends on, both resolved ones, and unresolved ones. // // If a target depends on another one that hasn't been defined yet, we'll make // a placeholder BuilderRecord with no item, and try to load the buildfile // associated with the new item. The item will get filled in when we encounter // the declaration for the item (or when we're done and realize there are // undefined items). // // You can also have null item pointers when the target is not required for // the current build (should_generate is false). class BuilderRecord { public: using BuilderRecordSet = std::set<BuilderRecord*>; enum ItemType { ITEM_UNKNOWN, ITEM_TARGET, ITEM_CONFIG, ITEM_TOOLCHAIN, ITEM_POOL }; BuilderRecord(ItemType type, const Label& label); ItemType type() const { return type_; } const Label& label() const { return label_; } // Returns a user-ready name for the given type. e.g. "target". static const char* GetNameForType(ItemType type); // Returns true if the given item is of the given type. static bool IsItemOfType(const Item* item, ItemType type); // Returns the type enum for the given item. static ItemType TypeOfItem(const Item* item); Item* item() { return item_.get(); } const Item* item() const { return item_.get(); } void set_item(std::unique_ptr<Item> item) { item_ = std::move(item); } // Indicates from where this item was originally referenced from that caused // it to be loaded. For targets for which we encountered the declaration // before a reference, this will be the empty range. const ParseNode* originally_referenced_from() const { return originally_referenced_from_; } void set_originally_referenced_from(const ParseNode* pn) { originally_referenced_from_ = pn; } bool should_generate() const { return should_generate_; } void set_should_generate(bool sg) { should_generate_ = sg; } bool resolved() const { return resolved_; } void set_resolved(bool r) { resolved_ = r; } bool can_resolve() const { return item_ && unresolved_deps_.empty(); } // All records this one is depending on. Note that this includes gen_deps for // targets, which can have cycles. BuilderRecordSet& all_deps() { return all_deps_; } const BuilderRecordSet& all_deps() const { return all_deps_; } // Unresolved records this one is depending on. A subset of all... above. BuilderRecordSet& unresolved_deps() { return unresolved_deps_; } const BuilderRecordSet& unresolved_deps() const { return unresolved_deps_; } // Records that are waiting on this one to be resolved. This is the other // end of the "unresolved deps" arrow. BuilderRecordSet& waiting_on_resolution() { return waiting_on_resolution_; } const BuilderRecordSet& waiting_on_resolution() const { return waiting_on_resolution_; } void AddGenDep(BuilderRecord* record); void AddDep(BuilderRecord* record); private: ItemType type_; Label label_; std::unique_ptr<Item> item_; const ParseNode* originally_referenced_from_ = nullptr; bool should_generate_ = false; bool resolved_ = false; BuilderRecordSet all_deps_; BuilderRecordSet unresolved_deps_; BuilderRecordSet waiting_on_resolution_; BuilderRecord(const BuilderRecord&) = delete; BuilderRecord& operator=(const BuilderRecord&) = delete; }; #endif // TOOLS_GN_BUILDER_RECORD_H_
#include <stdlib.h> #include <stddef.h> // size_t #include <limits.h> // UCHAR_MAX #include <ctype.h> #include "Scrape.h" #include "URLCommon.h" #include "macros.h" #include "dbg.h" static int dualDecodeInfoHash( const char *input, size_t length, char *compactHash, char *infoHash ) { int c = 0, h = 0; for ( int i = 0; (i < length) && (c < 20) && (h < 40); i++, c++, h++ ) { if ( input[i] == '%' ) { if ( i + 2 > length ) return -1; char encodedChar[3] = { input[i + 1], input[i + 2], '\0' }; long decodedChar = strtol( encodedChar, NULL, 16 ); if ( decodedChar < UCHAR_MAX ) compactHash[c] = (char)decodedChar; else return -2; infoHash[h++] = tolower( input[i + 1] ); infoHash[h] = tolower( input[i + 2] ); i += 2; } else { compactHash[c] = input[i]; snprintf( infoHash + h++, 3, "%02x", input[i] ); } } // don't null terminate compactHash. infoHash[h] = '\0'; return h; } ScrapeData *ScrapeData_new( void ) { ScrapeData *scrape = malloc( sizeof(*scrape) ); if ( !scrape ) return NULL; scrape->next = NULL; return scrape; } void ScrapeData_free( ScrapeData *scrape ) { ScrapeData *scratch = scrape; while ( scratch ) { scrape = scratch->next; free( scratch ); scratch = scrape; } } void ScrapeData_dump( ScrapeData *scrape ) { int i = 0; while ( scrape ) { dbg_info( "Info hash %d: %s", i++, scrape->infoHash ); scrape = scrape->next; } } typedef struct _ScrapeCallback ScrapeCallbackData; struct _ScrapeCallback { ScrapeData *top; ScrapeData *last; }; static int ScrapeData_parse( void *data, const char *key, size_t keyLength, const char *value, size_t valueLength ) { if ( EqualLiteralLength( key, keyLength, "info_hash" ) ) { ScrapeCallbackData *cbd = data; if ( !cbd->top ) { cbd->top = ScrapeData_new( ); if ( !cbd->top ) return ScrapeError_unknown; cbd->last->next = cbd->top; } if ( dualDecodeInfoHash( value, valueLength, cbd->top->compactHash, cbd->top->infoHash ) != 40 ) return ScrapeError_malformedInfoHash; // ugh. cbd->last = cbd->top; cbd->top = cbd->last->next; } else return ScrapeError_invalidRequest; return ScrapeError_okay; } ScrapeError ScrapeData_fromQuery( ScrapeData *scrape, const char *query, size_t queryLength ) { ScrapeCallbackData data = { .top = scrape }; int e = parseQueryString( query, queryLength, ScrapeData_parse, &data ); if ( e ) return e; // this will only be true if no info_hash keys are encountered in the // query. if ( data.last == NULL ) return 1; ScrapeData_dump( scrape ); return ScrapeError_okay; }
// 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LOCAL_TO_REMOTE_SYNCER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LOCAL_TO_REMOTE_SYNCER_H_ #include "chrome/browser/sync_file_system/sync_callbacks.h" #include "chrome/browser/sync_file_system/sync_task.h" namespace sync_file_system { namespace drive_backend { class LocalToRemoteSyncer : public SyncTask { public: LocalToRemoteSyncer(); virtual ~LocalToRemoteSyncer(); virtual void Run(const SyncStatusCallback& callback) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(LocalToRemoteSyncer); }; } // namespace drive_backend } // namespace sync_file_system #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LOCAL_TO_REMOTE_SYNCER_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 CC_RESOURCES_DISPLAY_LIST_RECORDING_SOURCE_H_ #define CC_RESOURCES_DISPLAY_LIST_RECORDING_SOURCE_H_ #include "base/memory/scoped_ptr.h" #include "cc/resources/recording_source.h" namespace cc { class DisplayItemList; class DisplayListRasterSource; class CC_EXPORT DisplayListRecordingSource : public RecordingSource { public: explicit DisplayListRecordingSource(const gfx::Size& grid_cell_size); ~DisplayListRecordingSource() override; // RecordingSource overrides. bool UpdateAndExpandInvalidation(ContentLayerClient* painter, Region* invalidation, const gfx::Size& layer_size, const gfx::Rect& visible_layer_rect, int frame_number, RecordingMode recording_mode) override; scoped_refptr<RasterSource> CreateRasterSource( bool can_use_lcd_text) const override; gfx::Size GetSize() const final; void SetEmptyBounds() override; void SetSlowdownRasterScaleFactor(int factor) override; void SetGatherPixelRefs(bool gather_pixel_refs) override; void SetBackgroundColor(SkColor background_color) override; void SetRequiresClear(bool requires_clear) override; bool IsSuitableForGpuRasterization() const override; void SetUnsuitableForGpuRasterizationForTesting() override; gfx::Size GetTileGridSizeForTesting() const override; protected: void Clear(); gfx::Rect recorded_viewport_; gfx::Size size_; int slow_down_raster_scale_factor_for_debug_; bool gather_pixel_refs_; bool requires_clear_; bool is_solid_color_; SkColor solid_color_; SkColor background_color_; int pixel_record_distance_; gfx::Size grid_cell_size_; scoped_refptr<DisplayItemList> display_list_; private: friend class DisplayListRasterSource; void DetermineIfSolidColor(); bool is_suitable_for_gpu_rasterization_; DISALLOW_COPY_AND_ASSIGN(DisplayListRecordingSource); }; } // namespace cc #endif // CC_RESOURCES_DISPLAY_LIST_RECORDING_SOURCE_H_
#ifndef _TYPES_H typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long LONGWORD; typedef void *ADDRESS; #define _TYPES_H #endif
// 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ #define CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ #include <vector> class Browser; namespace autofill { class AutofillProfile; class CreditCard; void AddTestProfile(Browser* browser, const AutofillProfile& profile); void SetTestProfile(Browser* browser, const AutofillProfile& profile); void SetTestProfiles(Browser* browser, std::vector<AutofillProfile>* profiles); void AddTestCreditCard(Browser* browser, const CreditCard& card); void AddTestServerCreditCard(Browser* browser, const CreditCard& card); void AddTestAutofillData(Browser* browser, const AutofillProfile& profile, const CreditCard& card); void WaitForPersonalDataChange(Browser* browser); } // namespace autofill #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_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 <UIKit/UIKit.h> #import <ABI41_0_0React/ABI41_0_0RCTComponentViewProtocol.h> #import <ABI41_0_0React/ABI41_0_0RCTTouchableComponentViewProtocol.h> #import <ABI41_0_0React/ABI41_0_0UIView+ComponentViewProtocol.h> #import <ABI41_0_0React/components/view/ViewEventEmitter.h> #import <ABI41_0_0React/components/view/ViewProps.h> #import <ABI41_0_0React/core/EventEmitter.h> #import <ABI41_0_0React/core/LayoutMetrics.h> #import <ABI41_0_0React/core/Props.h> NS_ASSUME_NONNULL_BEGIN /** * UIView class for <View> component. */ @interface ABI41_0_0RCTViewComponentView : UIView <ABI41_0_0RCTComponentViewProtocol, ABI41_0_0RCTTouchableComponentViewProtocol> { @protected ABI41_0_0facebook::ABI41_0_0React::LayoutMetrics _layoutMetrics; ABI41_0_0facebook::ABI41_0_0React::SharedViewProps _props; ABI41_0_0facebook::ABI41_0_0React::SharedViewEventEmitter _eventEmitter; } /** * Represents the `UIView` instance that is being automatically attached to * the component view and laid out using on `layoutMetrics` (especially `size` * and `padding`) of the component. * This view must not be a component view; it's just a convenient way * to embed/bridge pure native views as component views. * Defaults to `nil`. Assign `nil` to remove view as subview. */ @property (nonatomic, strong, nullable) UIView *contentView; /** * Provides access to `nativeId` prop of the component. * It might be used by subclasses (which need to refer to the view from * other platform-specific external views or systems by some id) or * by debugging/inspection tools. * Defaults to `nil`. */ @property (nonatomic, strong, nullable) NSString *nativeId; /** * Provides access to `foregroundColor` prop of the component. * Must be used by subclasses only. */ @property (nonatomic, strong, nullable) UIColor *foregroundColor; /** * Returns the object - usually (sub)view - which represents this * component view in terms of accessibility. * All accessibility properties will be applied to this object. * May be overridden in subclass which needs to be accessiblitywise * transparent in favour of some subview. * Defaults to `self`. */ @property (nonatomic, strong, nullable, readonly) NSObject *accessibilityElement; /** * Insets used when hit testing inside this view. */ @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; /** * Enforcing `call super` semantic for overridden methods from `ABI41_0_0RCTComponentViewProtocol`. * The methods update the instance variables. */ - (void)updateProps:(ABI41_0_0facebook::ABI41_0_0React::Props::Shared const &)props oldProps:(ABI41_0_0facebook::ABI41_0_0React::Props::Shared const &)oldProps NS_REQUIRES_SUPER; - (void)updateEventEmitter:(ABI41_0_0facebook::ABI41_0_0React::EventEmitter::Shared const &)eventEmitter NS_REQUIRES_SUPER; - (void)updateLayoutMetrics:(ABI41_0_0facebook::ABI41_0_0React::LayoutMetrics const &)layoutMetrics oldLayoutMetrics:(ABI41_0_0facebook::ABI41_0_0React::LayoutMetrics const &)oldLayoutMetrics NS_REQUIRES_SUPER; - (void)finalizeUpdates:(ABI41_0_0RNComponentViewUpdateMask)updateMask NS_REQUIRES_SUPER; - (void)prepareForRecycle NS_REQUIRES_SUPER; /* * This is a fragment of temporary workaround that we need only temporary and will get rid of soon. */ - (NSString *)componentViewName_DO_NOT_USE_THIS_IS_BROKEN; @end NS_ASSUME_NONNULL_END
/* * solutionset.h * * Created on: 1-oct-2015 * Author: M. El-Kebir */ #ifndef SOLUTIONSET_H #define SOLUTIONSET_H #include "utils.h" #include "solution.h" #include "realtensor.h" #include "statetree.h" #include "perfectphylotree.h" namespace gm { class SolutionSet { public: typedef std::vector<Solution> SolutionVector; typedef SolutionVector::const_iterator SolutionVectorIt; typedef SolutionVector::iterator SolutionVectorNonConstIt; typedef std::vector<StateTree> StateTreeVector; SolutionSet(); int solutionCount() const { return _sol.size(); } const Solution& solution(int idx) const { assert(0 <= idx && idx < _sol.size()); return _sol[idx]; } void clear() { _sol.clear(); } void add(const Solution& sol); void add(const SolutionSet& sols); void sort(); int unique(); friend std::ostream& operator<<(std::ostream& out, const SolutionSet& sols); friend std::istream& operator>>(std::istream& in, SolutionSet& sols); private: typedef std::map<std::string, std::map<std::string, int > > Map; typedef std::map<std::string, int> StringIntMap; typedef StringIntMap::const_iterator StringIntMapIt; private: SolutionVector _sol; struct Compare { bool operator()(const Solution& sol1, const Solution& sol2) { return sol1.distance() < sol2.distance(); } }; }; std::ostream& operator<<(std::ostream& out, const SolutionSet& sols); std::istream& operator>>(std::istream& in, SolutionSet& sols); } // namespace gm #endif // SOLUTIONSET_H
/* ============================================================================ * Copyright (c) 2011 Michael A. Jackson (BlueQuartz Software) * Copyright (c) 2011 Singanallur Venkatakrishnan (Purdue University) * 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 Singanallur Venkatakrishnan, Michael A. Jackson, the Pudue * Univeristy, BlueQuartz Software 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. * * This code was written under United States Air Force Contract number * FA8650-07-D-5800 * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #ifndef SINOGRAMBINWRITER_H_ #define SINOGRAMBINWRITER_H_ #include "MXA/MXA.h" #include "MXA/Common/MXASetGetMacros.h" #include "MBIRLib/MBIRLib.h" #include "MBIRLib/GenericFilters/TomoFilter.h" #include "MBIRLib/Reconstruction/ReconstructionStructures.h" /** * @class SinogramBinWriter SinogramBinWriter.h TomoEngine/IO/SinogramBinWriter.h * @brief * @author Michael A. Jackson for BlueQuartz Software * @date Dec 9, 2011 * @version 1.0 */ class MBIRLib_EXPORT SinogramBinWriter : public TomoFilter { public: MXA_SHARED_POINTERS(SinogramBinWriter) MXA_STATIC_NEW_MACRO(SinogramBinWriter) MXA_STATIC_NEW_SUPERCLASS(TomoFilter, SinogramBinWriter) MXA_TYPE_MACRO_SUPER(SinogramBinWriter, TomoFilter) virtual ~SinogramBinWriter(); MXA_INSTANCE_PROPERTY(RealVolumeType::Pointer, Data) MXA_INSTANCE_PROPERTY(RealArrayType::Pointer, I_0)//Gains MXA_INSTANCE_PROPERTY(RealArrayType::Pointer, Mu)//Offset void execute(); protected: SinogramBinWriter(); private: SinogramBinWriter(const SinogramBinWriter&); // Copy Constructor Not Implemented void operator=(const SinogramBinWriter&); // Operator '=' Not Implemented }; #endif /* SINOGRAMBINWRITER_H_ */
#ifndef __ffi_h__ #define __ffi_h__ #ifdef __cplusplus extern "C" { #endif void* hashmap_create(); void hashmap_destroy(void* h); void hashmap_insert(void* h, const unsigned char* key, unsigned int nK, const unsigned char* val, unsigned int nV); void hashmap_lookup(void* h, const unsigned char* key, unsigned int nK, unsigned char** pVal, unsigned int* pNV); void hashmap_delete(void* h, const unsigned char* key, unsigned int nK); unsigned int hashmap_size(const void* h); void* iter_create(void* h); void iter_destroy(void* it); int iter_hasNext(void* h, void* it); void iter_next(void* h, void* it, unsigned char** pKey, unsigned int* pNK, unsigned char** pVal, unsigned int* pNV); #ifdef __cplusplus } #endif #endif
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef TERA_SDK_SCHEMA_IMPL_H_ #define TERA_SDK_SCHEMA_IMPL_H_ #include <string> #include "proto/table_meta.pb.h" #include "sdk/tera.h" namespace tera { /// 列族描述 class CFDescImpl : public ColumnFamilyDescriptor { public: /// 列族名字仅允许使用字母、数字和下划线构造, 长度不超过256 CFDescImpl(const std::string& cf_name, int32_t id, const std::string& lg_name); /// id int32_t Id() const; const std::string& Name() const; const std::string& LocalityGroup() const; /// 历史版本保留时间, 不设置时为0, 表示无限大永久保存 void SetTimeToLive(int32_t ttl); int32_t TimeToLive() const; /// 在TTL内,最多存储的版本数 void SetMaxVersions(int32_t max_versions); int32_t MaxVersions() const; /// 最少存储的版本数,即使超出TTL,也至少保留min_versions个版本 void SetMinVersions(int32_t min_versions); int32_t MinVersions() const; /// 存储限额, MBytes void SetDiskQuota(int64_t quota); int64_t DiskQuota() const; /// ACL void SetAcl(ACL acl); ACL Acl() const; void SetType(const std::string& type); const std::string& Type() const; private: int32_t _id; std::string _name; std::string _lg_name; int32_t _max_versions; int32_t _min_versions; int32_t _ttl; int64_t _acl; int32_t _owner; int32_t _disk_quota; std::string _type; }; /// 局部性群组描述 class LGDescImpl : public LocalityGroupDescriptor { public: /// 局部性群组名字仅允许使用字母、数字和下划线构造,长度不超过256 LGDescImpl(const std::string& lg_name, int32_t id); /// Id read only int32_t Id() const; /// Name read only const std::string& Name() const; /// Compress type void SetCompress(CompressType type); CompressType Compress() const; /// Block size void SetBlockSize(int block_size); int BlockSize() const; /// Store type void SetStore(StoreType type); StoreType Store() const; /// Bloomfilter void SetUseBloomfilter(bool use_bloomfilter); bool UseBloomfilter() const; /// Memtable On Leveldb (disable/enable) bool UseMemtableOnLeveldb() const; void SetUseMemtableOnLeveldb(bool use_mem_ldb); /// Memtable-LDB WriteBuffer Size int32_t MemtableLdbWriteBufferSize() const; void SetMemtableLdbWriteBufferSize(int32_t buffer_size); /// Memtable-LDB Block Size int32_t MemtableLdbBlockSize() const; void SetMemtableLdbBlockSize(int32_t block_size); /// sst file size, in Bytes int32_t SstSize() const; void SetSstSize(int32_t sst_size); private: int32_t _id; std::string _name; CompressType _compress_type; StoreType _store_type; int _block_size; bool _use_bloomfilter; bool _use_memtable_on_leveldb; int32_t _memtable_ldb_write_buffer_size; int32_t _memtable_ldb_block_size; int32_t _sst_size; // in bytes }; /// 表描述符. class TableDescImpl { public: /// 表格名字仅允许使用字母、数字和下划线构造,长度不超过256 TableDescImpl(const std::string& tb_name, bool is_kv); ~TableDescImpl(); void SetTableName(const std::string& name); std::string TableName() const; /// 设置为kv表(无列),建表完成后无法改变 void SetKvOnly(); /// 增加一个localitygroup LocalityGroupDescriptor* AddLocalityGroup(const std::string& lg_name); /// 获取默认localitygroup,仅用于kv表 LocalityGroupDescriptor* DefaultLocalityGroup(); /// 删除一个localitygroup bool RemoveLocalityGroup(const std::string& lg_name); /// 获取localitygroup const LocalityGroupDescriptor* LocalityGroup(int32_t id) const; const LocalityGroupDescriptor* LocalityGroup(const std::string& lg_name) const; /// 获取localitygroup数量 int32_t LocalityGroupNum() const; /// 增加一个columnfamily ColumnFamilyDescriptor* AddColumnFamily(const std::string& cf_name, const std::string& lg_name); ColumnFamilyDescriptor* DefaultColumnFamily(); /// 删除一个columnfamily void RemoveColumnFamily(const std::string& cf_name); /// 获取所有的colmnfamily const ColumnFamilyDescriptor* ColumnFamily(int32_t id) const; const ColumnFamilyDescriptor* ColumnFamily(const std::string& cf_name) const; int32_t ColumnFamilyNum() const; /// Raw Key Mode void SetRawKey(RawKeyType type); RawKeyType RawKey() const; void SetSplitSize(int64_t size); int64_t SplitSize() const; void SetMergeSize(int64_t size); int64_t MergeSize() const; void DisableWal(); bool IsWalDisabled() const; /// 插入snapshot int32_t AddSnapshot(uint64_t snapshot); /// 获取snapshot uint64_t Snapshot(int32_t id) const; /// Snapshot数量 int32_t SnapshotNum() const; /// 是否为kv表 bool IsKv() const; private: typedef std::map<std::string, LGDescImpl*> LGMap; typedef std::map<std::string, CFDescImpl*> CFMap; std::string _name; bool _kv_only; LGMap _lg_map; std::vector<LGDescImpl*> _lgs; CFMap _cf_map; std::vector<CFDescImpl*> _cfs; int32_t _next_lg_id; int32_t _next_cf_id; std::vector<uint64_t> _snapshots; static const std::string DEFAULT_LG_NAME; static const std::string DEFAULT_CF_NAME; RawKeyType _raw_key_type; int64_t _split_size; int64_t _merge_size; bool _disable_wal; }; } // namespace tera #endif // TERA_SDK_SCHEMA_IMPL_H_
#ifndef PLANNING_INTERPOLATOR_H #define PLANNING_INTERPOLATOR_H #include <KrisLibrary/planning/CSpace.h> #include <memory> /** @ingroup MotionPlanning * @brief A base class for all 1D interpolators. */ class Interpolator { public: virtual ~Interpolator() {} virtual void Eval(Real u,Config& x) const=0; virtual Real Length() const=0; virtual const Config& Start() const=0; virtual const Config& End() const=0; virtual Real ParamStart() const { return 0; } virtual Real ParamEnd() const { return 1; } }; /** @ingroup MotionPlanning * @brief An interpolator that reverses another one. */ class ReverseInterpolator : public Interpolator { public: ReverseInterpolator(const std::shared_ptr<Interpolator>& base); virtual ~ReverseInterpolator() {} virtual void Eval(Real u,Config& x) const { base->Eval(1.0-u,x); } virtual Real Length() const { return base->Length(); } virtual const Config& Start() const { return base->End(); } virtual const Config& End() const { return base->Start(); } std::shared_ptr<Interpolator> base; }; typedef std::shared_ptr<Interpolator> InterpolatorPtr; #endif
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED #define MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED // MITK #include "MitkMapperExtExports.h" #include "mitkBaseRenderer.h" #include "mitkCommon.h" #include "mitkImage.h" #include "mitkVtkMapper.h" // VTK #include <vtkFixedPointVolumeRayCastMapper.h> #include <vtkGPUVolumeRayCastMapper.h> #include <vtkImageChangeInformation.h> #include <vtkSmartPointer.h> #include <vtkVersionMacros.h> #include <vtkVolumeProperty.h> #include "vtkMitkGPUVolumeRayCastMapper.h" namespace mitk { /************************************************************************/ /* Properties that influence the mapper are: * * - \b "level window": for the level window of the volume data * - \b "LookupTable" : for the lookup table of the volume data * - \b "TransferFunction" (mitk::TransferFunctionProperty): for the used transfer function of the volume data ************************************************************************/ //##Documentation //## @brief Vtk-based mapper for VolumeData //## //## @ingroup Mapper class MITKMAPPEREXT_EXPORT GPUVolumeMapper3D : public VtkMapper { public: mitkClassMacro(GPUVolumeMapper3D, VtkMapper); itkFactorylessNewMacro(Self) itkCloneMacro(Self) virtual const mitk::Image *GetInput(); vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override; void ApplyProperties(vtkActor *actor, mitk::BaseRenderer *renderer) override; static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false); /** Returns true if this Mapper currently allows for Level-of-Detail rendering. * This reflects whether this Mapper currently invokes StartEvent, EndEvent, and * ProgressEvent on BaseRenderer. */ bool IsLODEnabled(BaseRenderer *renderer = nullptr) const override; bool IsMIPEnabled(BaseRenderer *renderer = nullptr); bool IsGPUEnabled(BaseRenderer *renderer = nullptr); bool IsRAYEnabled(BaseRenderer *renderer = nullptr); void MitkRenderVolumetricGeometry(mitk::BaseRenderer *renderer) override; protected: GPUVolumeMapper3D(); ~GPUVolumeMapper3D() override; bool IsRenderable(mitk::BaseRenderer *renderer); void InitCommon(); void DeinitCommon(); void InitCPU(mitk::BaseRenderer *renderer); void DeinitCPU(mitk::BaseRenderer *renderer); void GenerateDataCPU(mitk::BaseRenderer *renderer); bool InitGPU(mitk::BaseRenderer *renderer); void DeinitGPU(mitk::BaseRenderer *); void GenerateDataGPU(mitk::BaseRenderer *); bool InitRAY(mitk::BaseRenderer *renderer); void DeinitRAY(mitk::BaseRenderer *renderer); void GenerateDataRAY(mitk::BaseRenderer *renderer); void InitVtkMapper(mitk::BaseRenderer *renderer); void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override; void CreateDefaultTransferFunctions(); void UpdateTransferFunctions(mitk::BaseRenderer *renderer); vtkSmartPointer<vtkVolume> m_Volumenullptr; bool m_commonInitialized; vtkSmartPointer<vtkImageChangeInformation> m_UnitSpacingImageFilter; vtkSmartPointer<vtkPiecewiseFunction> m_DefaultOpacityTransferFunction; vtkSmartPointer<vtkPiecewiseFunction> m_DefaultGradientTransferFunction; vtkSmartPointer<vtkColorTransferFunction> m_DefaultColorTransferFunction; vtkSmartPointer<vtkPiecewiseFunction> m_BinaryOpacityTransferFunction; vtkSmartPointer<vtkPiecewiseFunction> m_BinaryGradientTransferFunction; vtkSmartPointer<vtkColorTransferFunction> m_BinaryColorTransferFunction; class LocalStorage : public mitk::Mapper::BaseLocalStorage { public: // NO SMARTPOINTER HERE vtkRenderWindow *m_VtkRenderWindow; bool m_cpuInitialized; vtkSmartPointer<vtkVolume> m_VolumeCPU; vtkSmartPointer<vtkFixedPointVolumeRayCastMapper> m_MapperCPU; vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyCPU; bool m_gpuSupported; bool m_gpuInitialized; vtkSmartPointer<vtkVolume> m_VolumeGPU; vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyGPU; bool m_raySupported; bool m_rayInitialized; vtkSmartPointer<vtkVolume> m_VolumeRAY; vtkSmartPointer<vtkGPUVolumeRayCastMapper> m_MapperRAY; vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyRAY; LocalStorage() { m_VtkRenderWindow = nullptr; m_cpuInitialized = false; m_gpuInitialized = false; m_gpuSupported = true; // assume initially gpu slicing is supported m_rayInitialized = false; m_raySupported = true; // assume initially gpu raycasting is supported } ~LocalStorage() override { if (m_cpuInitialized && m_MapperCPU && m_VtkRenderWindow) m_MapperCPU->ReleaseGraphicsResources(m_VtkRenderWindow); if (m_rayInitialized && m_MapperRAY && m_VtkRenderWindow) m_MapperRAY->ReleaseGraphicsResources(m_VtkRenderWindow); } }; mitk::LocalStorageHandler<LocalStorage> m_LSH; }; } // namespace mitk #endif /* MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED */
/* $OpenBSD: armcap.c,v 1.5 2014/06/12 15:49:27 deraadt Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <setjmp.h> #include <signal.h> #include <crypto.h> #include "arm_arch.h" unsigned int OPENSSL_armcap_P; #if __ARM_ARCH__ >= 7 static sigset_t all_masked; static sigjmp_buf ill_jmp; static void ill_handler (int sig) { siglongjmp(ill_jmp, sig); } /* * Following subroutines could have been inlined, but it's not all * ARM compilers support inline assembler... */ void _armv7_neon_probe(void); #endif #if defined(__GNUC__) && __GNUC__>=2 void OPENSSL_cpuid_setup(void) __attribute__((constructor)); #endif void OPENSSL_cpuid_setup(void) { #ifndef __OpenBSD__ char *e; #endif #if __ARM_ARCH__ >= 7 struct sigaction ill_oact, ill_act; sigset_t oset; #endif static int trigger = 0; if (trigger) return; trigger = 1; #ifndef __OpenBSD__ if ((e = getenv("OPENSSL_armcap"))) { OPENSSL_armcap_P = strtoul(e, NULL, 0); return; } #endif OPENSSL_armcap_P = 0; #if __ARM_ARCH__ >= 7 sigfillset(&all_masked); sigdelset(&all_masked, SIGILL); sigdelset(&all_masked, SIGTRAP); sigdelset(&all_masked, SIGFPE); sigdelset(&all_masked, SIGBUS); sigdelset(&all_masked, SIGSEGV); memset(&ill_act, 0, sizeof(ill_act)); ill_act.sa_handler = ill_handler; ill_act.sa_mask = all_masked; sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset); sigaction(SIGILL, &ill_act, &ill_oact); if (sigsetjmp(ill_jmp, 1) == 0) { _armv7_neon_probe(); OPENSSL_armcap_P |= ARMV7_NEON; } sigaction (SIGILL, &ill_oact, NULL); sigprocmask(SIG_SETMASK, &oset, NULL); #endif }
#pragma once #ifndef TIIO_QUANTEL_INCLUDED #define TIIO_QUANTEL_INCLUDED //#include "timage_io.h" #include "tiio.h" //=========================================================================== namespace Tiio { Tiio::Reader *makeQntReader(); Tiio::Writer *makeQntWriter(); } // namespace #endif
#ifndef CHANNEL_TRANSPORT_H #define CHANNEL_TRANSPORT_H #include "AVTransport.h" class VoiceChannelTransport:public webrtc::Transport{ public: VoiceChannelTransport(webrtc::VoENetwork* voe_network, int channel, VoiceTransport *transport, bool STOR): channel_(channel), voe_network_(voe_network), transport_(transport), STOR_(STOR){ int registered = voe_network_->RegisterExternalTransport(channel, *this); assert(registered == 0); (void)(registered); } virtual ~VoiceChannelTransport() { transport_ = NULL; } public: virtual int SendPacket(int channel, const void *data, size_t len) { return transport_->sendRTPPacketA(data, len); } virtual int SendRTCPPacket(int channel, const void *data, size_t len){ return transport_->sendRTCPPacketA(data, len, STOR_); } private: int channel_; webrtc::VoENetwork* voe_network_; VoiceTransport *transport_; bool STOR_; }; class VideoChannelTransport:public webrtc::Transport{ public: VideoChannelTransport(webrtc::ViENetwork* vie_network, int channel, VideoTransport *transport, bool STOR): channel_(channel), vie_network_(vie_network), transport_(transport), STOR_(STOR){ int registered = vie_network_->RegisterSendTransport(channel, *this); assert(registered == 0); (void)(registered); } virtual ~VideoChannelTransport() { transport_ = NULL; } public: virtual int SendPacket(int channel, const void *data, size_t len){ return transport_->sendRTPPacketV(data, len); } virtual int SendRTCPPacket(int channel, const void *data, size_t len){ return transport_->sendRTCPPacketV(data, len, STOR_); } private: int channel_; webrtc::ViENetwork* vie_network_; VideoTransport *transport_; bool STOR_; }; #endif
#ifndef __hash_hash_murmur_h #define __hash_hash_murmur_h #include <stdint.h> uint32_t hash_murmur3_32( const uint8_t *key , uint32_t len , uint32_t seed); #endif
/* * Copyright (C) 2006 Apple Computer, Inc. * Copyright (C) 2009 Google, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef RenderSVGForeignObject_h #define RenderSVGForeignObject_h #if ENABLE(SVG) #include "AffineTransform.h" #include "FloatPoint.h" #include "FloatRect.h" #include "RenderSVGBlock.h" namespace WebCore { class SVGForeignObjectElement; class RenderSVGForeignObject FINAL : public RenderSVGBlock { public: explicit RenderSVGForeignObject(SVGForeignObjectElement&); virtual ~RenderSVGForeignObject(); SVGForeignObjectElement& foreignObjectElement() const; virtual void paint(PaintInfo&, const LayoutPoint&); virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE; virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE; virtual bool requiresLayer() const { return false; } virtual void layout(); virtual FloatRect objectBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); } virtual FloatRect strokeBoundingBox() const { return FloatRect(FloatPoint(), m_viewport.size()); } virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(FloatPoint(), m_viewport.size()); } virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; virtual bool isSVGForeignObject() const { return true; } virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE; virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } private: void graphicsElement() const WTF_DELETED_FUNCTION; virtual const char* renderName() const OVERRIDE { return "RenderSVGForeignObject"; } virtual void updateLogicalWidth() OVERRIDE; virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; virtual const AffineTransform& localToParentTransform() const; virtual AffineTransform localTransform() const { return m_localTransform; } bool m_needsTransformUpdate : 1; FloatRect m_viewport; AffineTransform m_localTransform; mutable AffineTransform m_localToParentTransform; }; } #endif #endif
/**************************************************************************************/ /* Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 */ /* Washington University, Mallinckrodt Institute of Radiology. */ /* All Rights Reserved. */ /* This software may not be reproduced, copied, or distributed without written */ /* permission of Washington University. For further information contact A. Z. Snyder. */ /**************************************************************************************/ /*$Header: /home/usr/shimonyj/diff4dfp/RCS/get_dti_params.c,v 1.4 2012/06/15 01:30:37 avi Exp $*/ /*$Log: get_dti_params.c,v $ * Revision 1.4 2012/06/15 01:30:37 avi * tolerate (meaningless) vector components on b = 0 input lines * * Revision 1.3 2007/08/30 05:09:08 avi * JSSutil.h compliant * * Revision 1.2 2000/12/19 01:46:58 avi * copyright * * Revision 1.1 2000/10/05 05:46:35 avi * Initial revision **/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <math.h> #include <JSSutil.h> void get_dti_nrc_test () { extern int dti_dimen (char *file); extern int get_dti_params_nrc (char *file, int n, float *b_vals, float **q_vals); int i, j, k, n; float **q_vals, *b_vals; char file[] = "/home/usr/shimonyj/diff4dfp/tp7_params.dat"; if ((n = dti_dimen (file)) <= 0) exit (-1); b_vals = vector (1, n); q_vals = matrix (1, n, 1, 3); get_dti_params_nrc (file, n, b_vals, q_vals); free_matrix (q_vals, 1, n, 1, 3); free_vector (b_vals, 1, n); exit (0); } int dti_dimen (char *file) { FILE *fp; char *ptr, string[256]; int i, k, n; if (access (file, R_OK) || !(fp = fopen (file, "r"))) return -1; while (1) { if (!(fgets (string, 256, fp))) { fclose (fp); return -1; } if (ptr = strchr (string, '#')) *ptr = '\0'; if (k = sscanf (string, "%d", &n) != 1) continue; fclose (fp); printf ("dti_dimen=%d\n", n); return n; } } int get_dti_params_nrc (char *file, int n, float *b_vals, float **q_vals) { FILE *fp; char *ptr, string[256]; float v[4]; double q; int i, j, k, l; if (access (file, R_OK) || !(fp = fopen (file, "r"))) return -1; i = 0; while (i <= n) { if (!(fgets (string, 256, fp))) goto ERRF; if (ptr = strchr (string, '#')) *ptr = '\0'; if (!i) { if (k = sscanf (string, "%d", &j) != 1) continue; if (j != n) goto ERRF; } else { k = sscanf (string, "%f%f%f%f", v + 0, v + 1, v + 2, v + 3); if (!k) continue; b_vals[i] = v[0] / 1000.; if (k == 1 || v[0] == 0.) { for (j = 1; j <= 3; j++) q_vals[i][j] = 0.0; } else if (k == 4) { q = 0; for (j = 1; j <= 3; j++) q += v[j] * v[j]; for (j = 1; j <= 3; j++) q_vals[i][j] = v[j] / sqrt (q); } else { fprintf (stderr, "input line field count not 1 or 4\n"); return -1; } printf ("%10.4f%10.4f%10.4f%10.4f\n", b_vals[i], q_vals[i][1], q_vals[i][2], q_vals[i][3]); } i++; } fclose (fp); return 0; ERRF: fprintf (stderr, "%s parse error\n", file); fclose (fp); return -1; }
#ifndef mozilla_psm__CryptoUtil_h #define mozilla_psm__CryptoUtil_h #include <mozilla/RefPtr.h> #include "mozilla/Types.h" #ifdef MOZILLA_INTERNAL_API #define MOZ_CRYPTO_API(x) MOZ_EXPORT_API(x) #else #define MOZ_CRYPTO_API(x) MOZ_IMPORT_API(x) #endif #endif // mozilla_psm__CryptoUtil_h
/* Copyright (c) 2010-2019, Delft University of Technology * All rigths reserved * * This file is part of the Tudat. Redistribution and use in source and * binary forms, with or without modification, are permitted exclusively * under the terms of the Modified BSD license. You should have received * a copy of the license with this file. If not, please or visit: * http://tudat.tudelft.nl/LICENSE. */ #ifndef TUDAT_CREATETHRUSTMODELGUIDANCE_H #define TUDAT_CREATETHRUSTMODELGUIDANCE_H #include "Tudat/Astrodynamics/SystemModels/engineModel.h" #include "Tudat/Astrodynamics/Propulsion/thrustGuidance.h" #include "Tudat/Astrodynamics/Propagators/environmentUpdateTypes.h" #include "Tudat/Astrodynamics/Propulsion/thrustMagnitudeWrapper.h" #include "Tudat/SimulationSetup/EnvironmentSetup/body.h" #include "Tudat/SimulationSetup/EnvironmentSetup/createFlightConditions.h" #include "Tudat/SimulationSetup/PropagationSetup/thrustSettings.h" #include "Tudat/Astrodynamics/Ephemerides/ephemeris.h" #include "Tudat/Astrodynamics/SystemModels/engineModel.h" namespace tudat { namespace simulation_setup { //! Function to retrieve the effective thrust direction from a set of thrust sources. /*! * Function to retrieve the effective thrust direction from a set of thrust sources. * \param thrustDirections List of functions returning thrust directions. * \param thrustMagnitudes List of functions returning thrust magnitude. * \return Effective thrust direction. */ Eigen::Vector3d getCombinedThrustDirection( const std::vector< std::function< Eigen::Vector3d( )> >& thrustDirections, const std::vector< std::function< double( )> >& thrustMagnitudes ); //! Function to create a function that returns the thrust direction in the body-fixed frame. /*! * Function to create a function that returns the thrust direction in the body-fixed frame. * \param thrustMagnitudeSettings Settings for the thrust magnitude * \param bodyMap List of body objects that comprises the environment * \param bodyName Name of body for which thrust is to be created. * \return Function that returns the thrust direction in the body-fixed frame. */ std::function< Eigen::Vector3d( ) > getBodyFixedThrustDirection( const std::shared_ptr< ThrustMagnitudeSettings > thrustMagnitudeSettings, const NamedBodyMap& bodyMap, const std::string bodyName ); //! Function to create a wrapper object that computes the thrust magnitude /*! * Function to create a wrapper object that computes the thrust magnitude * \param thrustMagnitudeSettings Settings for the thrust magnitude * \param bodyMap List of body objects that comprises the environment * \param nameOfBodyWithGuidance Name of body for which thrust is to be created. * \param magnitudeUpdateSettings Environment update settings that are required to compute the thrust direction (updated * by function as needed). * \return Object used during propagation to compute the thrust direction */ std::shared_ptr< propulsion::ThrustMagnitudeWrapper > createThrustMagnitudeWrapper( const std::shared_ptr< ThrustMagnitudeSettings > thrustMagnitudeSettings, const NamedBodyMap& bodyMap, const std::string& nameOfBodyWithGuidance, std::map< propagators::EnvironmentModelsToUpdate, std::vector< std::string > >& magnitudeUpdateSettings ); //! Function to update the thrust magnitude and direction to current time. /*! * Function to update the thrust magnitude and direction to current time. * \param thrustMagnitudeWrapper Object used during propagation to compute the thrust magnitude * \param thrustDirectionGuidance Object used during propagation to compute the body-fixed thrust direction * \param currentTime Time to which objects are to be updated. */ void updateThrustMagnitudeAndDirection( const std::shared_ptr< propulsion::ThrustMagnitudeWrapper > thrustMagnitudeWrapper, const std::shared_ptr< propulsion::BodyFixedForceDirectionGuidance > thrustDirectionGuidance, const double currentTime ); //! Function to reset the current time variable of the thrust magnitude and direction wrappers /*! * Function to reset the current time variable of the thrust magnitude and direction wrappers. This function does not * update the actual thrust direction and guidance; it is typically used to reset the current time to NaN, thereby signalling * the need to recompute the magnitude/direction upon next call to update functions * \param thrustMagnitudeWrapper Object used during propagation to compute the thrust magnitude * \param thrustDirectionGuidance Object used during propagation to compute the body-fixed thrust direction * \param currentTime New current time variable that is to be set. */ void resetThrustMagnitudeAndDirectionTime( const std::shared_ptr< propulsion::ThrustMagnitudeWrapper > thrustMagnitudeWrapper, const std::shared_ptr< propulsion::BodyFixedForceDirectionGuidance > thrustDirectionGuidance, const double currentTime = TUDAT_NAN ); } // namespace simulation_setup } // namespace tudat #endif // TUDAT_CREATETHRUSTMODELGUIDANCE_H
/** * @file compfwd.h * @brief SBML Comp C structure declarations * @author Lucian Smith * *<!--------------------------------------------------------------------------- * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * * Copyright (C) 2013-2014 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany * * Copyright 2011-2012 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * * 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. A copy of the license agreement is provided * in the file named "LICENSE.txt" included with this software distribution * and also available online as http://sbml.org/software/libsbml/license.html *------------------------------------------------------------------------- --> */ #ifndef compfwd_h__ #define compfwd_h__ /** * Forward declaration of all opaque C types. * * Declaring all types up-front avoids "redefinition of type 'Foo'" compile * errors and allows our combined C/C++ headers to depend minimally upon * each other. Put another way, the type definitions below serve the same * purpose as "class Foo;" forward declarations in C++ code. */ #ifdef __cplusplus # define CLASS_OR_STRUCT class #else # define CLASS_OR_STRUCT struct #endif /* __cplusplus */ LIBSBML_CPP_NAMESPACE_BEGIN /** @cond (!conly) */ /** * @var typedef class SBaseRef SBaseRef_t * @copydoc SBaseRef */ typedef CLASS_OR_STRUCT SBaseRef SBaseRef_t; /** * @var typedef class Deletion Deletion_t * @copydoc Deletion */ typedef CLASS_OR_STRUCT Deletion Deletion_t; /** * @var typedef class ExternalModelDefinition ExternalModelDefinition_t * @copydoc ExternalModelDefinition */ typedef CLASS_OR_STRUCT ExternalModelDefinition ExternalModelDefinition_t; /** * @var typedef class Port Port_t * @copydoc Port */ typedef CLASS_OR_STRUCT Port Port_t; /** * @var typedef class ReplacedBy ReplacedBy_t * @copydoc ReplacedBy */ typedef CLASS_OR_STRUCT ReplacedBy ReplacedBy_t; /** * @var typedef class ReplacedElement ReplacedElement_t * @copydoc ReplacedElement */ typedef CLASS_OR_STRUCT ReplacedElement ReplacedElement_t; /** * @var typedef class Submodel Submodel_t * @copydoc Submodel */ typedef CLASS_OR_STRUCT Submodel Submodel_t; /** * @var typedef class SBMLDocumentPlugin SBMLDocumentPlugin_t * @copydoc SBMLDocumentPlugin */ typedef CLASS_OR_STRUCT CompSBMLDocumentPlugin CompSBMLDocumentPlugin_t; /** @endcond */ /** @cond doxygenLibsbmlInternal */ /** * @var typedef class ModelPlugin ModelPlugin_t * @copydoc ModelPlugin */ typedef CLASS_OR_STRUCT CompModelPlugin CompModelPlugin_t; /** @endcond */ /** @cond (!conly) */ /** * @var typedef class ModelDefinition ModelDefinition_t * @copydoc ModelDefinition */ typedef CLASS_OR_STRUCT ModelDefinition ModelDefinition_t; /** @endcond */ LIBSBML_CPP_NAMESPACE_END #undef CLASS_OR_STRUCT #endif /* compfwd_h__ */
/** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2014 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ #ifndef XENIA_UI_UI_EVENT_H_ #define XENIA_UI_UI_EVENT_H_ namespace xe { namespace ui { class Control; class UIEvent { public: UIEvent(Control* control = nullptr) : control_(control) {} virtual ~UIEvent() = default; Control* control() const { return control_; } private: Control* control_; }; class KeyEvent : public UIEvent { public: KeyEvent(Control* control, int key_code) : UIEvent(control), handled_(false), key_code_(key_code) {} ~KeyEvent() override = default; bool is_handled() const { return handled_; } void set_handled(bool value) { handled_ = value; } int key_code() const { return key_code_; } private: bool handled_; int key_code_; }; class MouseEvent : public UIEvent { public: enum class Button { kNone = 0, kLeft, kRight, kMiddle, kX1, kX2, }; public: MouseEvent(Control* control, Button button, int32_t x, int32_t y, int32_t dx = 0, int32_t dy = 0) : UIEvent(control), handled_(false), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {} ~MouseEvent() override = default; bool is_handled() const { return handled_; } void set_handled(bool value) { handled_ = value; } Button button() const { return button_; } int32_t x() const { return x_; } int32_t y() const { return y_; } int32_t dx() const { return dx_; } int32_t dy() const { return dy_; } private: bool handled_; Button button_; int32_t x_; int32_t y_; int32_t dx_; int32_t dy_; }; } // namespace ui } // namespace xe #endif // XENIA_UI_UI_EVENT_H_
/** * \file * * \brief User board initialization template * */ #include <asf.h> #include <board.h> #include <conf_board.h> #include "nrf24l01p.h" #include "ms5607_02ba_dev.h" void board_init(void) { /* This function is meant to contain board-specific initialization code * for, e.g., the I/O pins. The initialization can rely on application- * specific board configuration, found in conf_board.h. */ pmic_init(); sysclk_init(); ioport_init(); dma_enable(); nrf24l01p_init(); // ms5607_02ba_init(); }
/************************************************************************** *** *** Copyright (c) 1995-2000 Regents of the University of California, *** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov *** Copyright (c) 2000-2007 Regents of the University of Michigan, *** Saurabh N. Adya, Jarrod A. Roy, David A. Papa and *** Igor L. Markov *** *** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu *** Original Affiliation: UCLA, Computer Science Department, *** Los Angeles, CA 90095-1596 USA *** *** 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. *** *** ***************************************************************************/ //! author="Igor Markov, Nov 16, 1997" #ifndef _VERBOSITY_H_ #define _VERBOSITY_H_ #include <iostream> #include <vector> //: Click to see more comments for verbosity // The goal of standardization of verbosity options // is to be able to produce consistent diagnostics // when using multiple packages. For example, if you // run package B with option "silent" and it uses // package A, then package A should also understand // "silent". // // Use model: constructors of complicated objects // can receive optional parameters. // A Verbosity object will be one of them // (with default "silent"). // If an object wishes to write some // diagnostics, it first looks at // the verbosity level for this type // of diagnostics and decides whether // to write diags or not. // // Note: ATM stderr/cerr output should // not be affected by class Verbosity // // Class Verbosity stores "verbosity levels" // for a variable number of "diagnostic types". // // A verbosity level is an unsigned which tells // how much diagnostic output of a given type // should be printed to cout. Verbosity level // 0 means "silent" and the bigger the level, // the more output should be printed (level // K contains all output of level N if K>=N). // // At present, verbosity levels are required for // at least three diagnostic types (see comments // in the definition of clas Verbosity). Required // diag. types have additional support in // class Verbose. // Tentative general requirements: for each type, // output with levels < 10^(k+1) should // be O(n^k) - long (wrt the program input). // // Usage: this class can be used as is or as a base class. // // Note: if needed, we can add extensions to handle // output to different diagnostic streams // (e.g. for each type) class Verbosity { std::vector<unsigned> _levels; void _ctructFromString(const char* levels); public: Verbosity(); // the default is "silent" Verbosity(const char* levels); // space or underscore-separated unsigneds // can also be "silent" and "0" (same as "0 0 0", same as "0_0_0") Verbosity(int argc, const char* argv[]); // catches -verb Verbosity(unsigned numArgs, unsigned forActions, unsigned forSysRes, unsigned forMajStats, ...); Verbosity(const std::vector<unsigned>&); Verbosity(const Verbosity& v) : _levels(v._levels) {} // Verbosity& operator=(const Verbosity&); unsigned getNumTypes() const { return _levels.size(); } unsigned& operator[](unsigned diagType); unsigned getForActions(void) const { return _levels[0]; } unsigned getForSysRes(void) const { return _levels[1]; } unsigned getForMajStats(void) const { return _levels[2]; } void setForActions(unsigned verb) { _levels[0] = verb; } void setForSysRes(unsigned verb) { _levels[1] = verb; } void setForMajStats(unsigned verb) { _levels[2] = verb; } // unsigned & forActions; //// "verbosity for actions" means writing "doing this, doing that" //// with more or less detail, depending on the level // unsigned & forSysRes; //// "verbosity for system resources" means writing //// how much memory/CPU time/etc was used //// in more or fewer places depending on the level // unsigned & forMajStats; //// "verbosity for major stats" means writing //// quantities/sizes of importants components, //// on more or fewer occasions, depending on the level friend std::ostream& operator<<(std::ostream& os, const Verbosity& verbsty); }; std::ostream& operator<<(std::ostream& os, const Verbosity& verbsty); #endif
/* ============================================================================ Copyright (c) 2008-2014, Broadcom 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, 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. ============================================================================ */ /******************************************************************************* Copyright 2010 Broadcom Corporation. All rights reserved. Unless you and Broadcom execute a separate written software license agreement governing use of this software, this software is licensed to you under the terms of the GNU General Public License version 2, available at http://www.gnu.org/copyleft/gpl.html (the "GPL"). Notwithstanding the above, under no circumstances may you combine this software in any way with any other Broadcom software provided under a license other than the GPL, without Broadcom's express prior written consent. *******************************************************************************/ #ifndef _V3D_LINUX_H_ #define _V3D_LINUX_H_ #include <linux/ioctl.h> #define V3D_DEV_NAME "v3d" #define BCM_V3D_MAGIC 'V' #ifdef __KERNEL__ #define V3D_MEMPOOL_SIZE SZ_32M #else #ifdef BRCM_V3D_OPT #define V3D_MEMPOOL_SIZE (0) #else #define V3D_MEMPOOL_SIZE (56*1024*1024) #endif #endif typedef struct { void *ptr; // virtual address unsigned int addr; // physical address unsigned int size; } mem_t; typedef struct { uint32_t v3d_irq_flags; uint32_t qpu_irq_flags; uint32_t early_suspend; } gl_irq_flags_t; typedef enum { V3D_JOB_INVALID = 0, V3D_JOB_BIN, V3D_JOB_REND, V3D_JOB_BIN_REND, V3D_JOB_LAST } v3d_job_type_e; typedef enum { V3D_JOB_STATUS_INVALID = 0, V3D_JOB_STATUS_READY, V3D_JOB_STATUS_RUNNING, V3D_JOB_STATUS_SUCCESS, V3D_JOB_STATUS_ERROR, V3D_JOB_STATUS_NOT_FOUND, V3D_JOB_STATUS_TIMED_OUT, V3D_JOB_STATUS_SKIP, V3D_JOB_STATUS_LAST } v3d_job_status_e; typedef struct { v3d_job_type_e job_type; uint32_t job_id; uint32_t v3d_ct0ca; uint32_t v3d_ct0ea; uint32_t v3d_ct1ca; uint32_t v3d_ct1ea; uint32_t v3d_vpm_size; } v3d_job_post_t; typedef struct { uint32_t job_id; v3d_job_status_e job_status; int32_t timeout; } v3d_job_status_t; enum { V3D_CMD_GET_MEMPOOL = 0x80, V3D_CMD_WAIT_IRQ, V3D_CMD_READ_REG, V3D_CMD_SOFT_RESET, V3D_CMD_TURN_ON, V3D_CMD_TURN_OFF, V3D_CMD_EARLY_SUSPEND, #ifdef BRCM_V3D_OPT V3D_CMD_POST_JOB, V3D_CMD_WAIT_JOB, V3D_CMD_FLUSH_JOB, V3D_CMD_ACQUIRE, V3D_CMD_RELEASE, #endif V3D_CMD_LAST }; #define V3D_IOCTL_GET_MEMPOOL _IOR(BCM_V3D_MAGIC, V3D_CMD_GET_MEMPOOL, mem_t) #define V3D_IOCTL_WAIT_IRQ _IOR(BCM_V3D_MAGIC, V3D_CMD_WAIT_IRQ, unsigned int) #define V3D_IOCTL_READ_REG _IOR(BCM_V3D_MAGIC, V3D_CMD_READ_REG, unsigned int) #define V3D_IOCTL_TURN_ON _IO(BCM_V3D_MAGIC, V3D_CMD_TURN_ON) #define V3D_IOCTL_TURN_OFF _IO(BCM_V3D_MAGIC, V3D_CMD_TURN_OFF) #define V3D_IOCTL_SOFT_RESET _IO(BCM_V3D_MAGIC, V3D_CMD_SOFT_RESET) #define V3D_IOCTL_EARLY_SUSPEND _IO(BCM_V3D_MAGIC, V3D_CMD_EARLY_SUSPEND) #ifdef BRCM_V3D_OPT #define V3D_IOCTL_POST_JOB _IOW(BCM_V3D_MAGIC, V3D_CMD_POST_JOB, v3d_job_post_t) #define V3D_IOCTL_WAIT_JOB _IOWR(BCM_V3D_MAGIC, V3D_CMD_WAIT_JOB, v3d_job_status_t) #define V3D_IOCTL_FLUSH_JOB _IOW(BCM_V3D_MAGIC, V3D_CMD_FLUSH_JOB) #define V3D_IOCTL_ACQUIRE _IOW(BCM_V3D_MAGIC, V3D_CMD_ACQUIRE) #define V3D_IOCTL_RELEASE _IOW(BCM_V3D_MAGIC, V3D_CMD_RELEASE) #endif enum { V3D_SUSPEND = 1, V3D_RESUME }; #endif
#include <stdlib.h> int main(int argc, char **argv) { int x; int r = rand(); if (0 != r) { x = 42; } else { x = 7; } return x; }
/* * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". * * Author: Ceriel J.H. Jacobs */ /* $Id$ */ #define __NO_DEFS #include <math.h> #include <pc_err.h> extern _trp(); #define NITER 5 static double Ldexp(fl,exp) double fl; int exp; { extern double _fef(); int sign = 1; int currexp; if (fl<0) { fl = -fl; sign = -1; } fl = _fef(fl,&currexp); exp += currexp; if (exp > 0) { while (exp>30) { fl *= (double) (1L << 30); exp -= 30; } fl *= (double) (1L << exp); } else { while (exp<-30) { fl /= (double) (1L << 30); exp += 30; } fl /= (double) (1L << -exp); } return sign * fl; } double _sqt(x) double x; { extern double _fef(); int exponent; double val; if (x <= 0) { if (x < 0) _trp(ESQT); return 0; } val = _fef(x, &exponent); if (exponent & 1) { exponent--; val *= 2; } val = Ldexp(val + 1.0, exponent/2 - 1); /* was: val = (val + 1.0)/2.0; val = Ldexp(val, exponent/2); */ for (exponent = NITER - 1; exponent >= 0; exponent--) { val = (val + x / val) / 2.0; } return val; }
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2012, John Haddon. 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 John Haddon nor the names of // any other contributors to this software 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 GAFFERSCENE_DELETEPRIMITIVEVARIABLE_H #define GAFFERSCENE_DELETEPRIMITIVEVARIABLE_H #include "GafferScene/PrimitiveVariableProcessor.h" namespace GafferScene { class DeletePrimitiveVariables : public PrimitiveVariableProcessor { public : DeletePrimitiveVariables( const std::string &name=defaultName<DeletePrimitiveVariables>() ); virtual ~DeletePrimitiveVariables(); IE_CORE_DECLARERUNTIMETYPEDEXTENSION( GafferScene::DeletePrimitiveVariables, DeletePrimitiveVariablesTypeId, PrimitiveVariableProcessor ); protected : virtual void processPrimitiveVariable( const ScenePath &path, const Gaffer::Context *context, IECore::ConstPrimitivePtr inputGeometry, IECore::PrimitiveVariable &inputVariable ) const; }; IE_CORE_DECLAREPTR( DeletePrimitiveVariables ) } // namespace GafferScene #endif // GAFFERSCENE_DELETEPRIMITIVEVARIABLE_H
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_COMPONENTS_PHONEHUB_BROWSER_TABS_MODEL_PROVIDER_H_ #define ASH_COMPONENTS_PHONEHUB_BROWSER_TABS_MODEL_PROVIDER_H_ #include <ostream> #include "ash/components/phonehub/browser_tabs_model.h" #include "base/observer_list.h" #include "base/observer_list_types.h" namespace chromeos { namespace phonehub { // Responsible for providing BrowserTabsModel information to observers. class BrowserTabsModelProvider { public: class Observer : public base::CheckedObserver { public: ~Observer() override = default; virtual void OnBrowserTabsUpdated( bool is_sync_enabled, const std::vector<BrowserTabsModel::BrowserTabMetadata>& browser_tabs_metadata) = 0; }; BrowserTabsModelProvider(const BrowserTabsModelProvider&) = delete; BrowserTabsModelProvider* operator=(const BrowserTabsModelProvider&) = delete; virtual ~BrowserTabsModelProvider(); void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); // Used to manually request updates for the latest browser tab metadata, // instead of lazily waiting for an update to occur on its own. This may be // advantageous when the user opens the PhoneHub tray immediately after // visiting a link on the connected phone's Chrome Browser. virtual void TriggerRefresh() = 0; protected: BrowserTabsModelProvider(); void NotifyBrowserTabsUpdated( bool is_sync_enabled, const std::vector<BrowserTabsModel::BrowserTabMetadata> browser_tabs_metadata); private: base::ObserverList<Observer> observer_list_; }; } // namespace phonehub } // namespace chromeos // TODO(https://crbug.com/1164001): remove after the migration is finished. namespace ash { namespace phonehub { using ::chromeos::phonehub::BrowserTabsModelProvider; } } // namespace ash #endif // ASH_COMPONENTS_PHONEHUB_BROWSER_TABS_MODEL_PROVIDER_H_
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <memory> #include <string> #include "AnalogInput.h" #include "LiveWindow/LiveWindowSendable.h" #include "PIDSource.h" #include "SensorBase.h" #include "networktables/NetworkTableEntry.h" namespace frc { /** * Handle operation of an analog accelerometer. * The accelerometer reads acceleration directly through the sensor. Many * sensors have multiple axis and can be treated as multiple devices. Each is * calibrated by finding the center value over a period of time. */ class AnalogAccelerometer : public SensorBase, public PIDSource, public LiveWindowSendable { public: explicit AnalogAccelerometer(int channel); explicit AnalogAccelerometer(AnalogInput* channel); explicit AnalogAccelerometer(std::shared_ptr<AnalogInput> channel); virtual ~AnalogAccelerometer() = default; double GetAcceleration() const; void SetSensitivity(double sensitivity); void SetZero(double zero); double PIDGet() override; void UpdateTable() override; void StartLiveWindowMode() override; void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr<nt::NetworkTable> subTable) override; private: void InitAccelerometer(); std::shared_ptr<AnalogInput> m_analogInput; double m_voltsPerG = 1.0; double m_zeroGVoltage = 2.5; nt::NetworkTableEntry m_valueEntry; }; } // namespace frc
/* * Copyright (c) 2019, 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 qpg6105 compile-time configuration constants for OpenThread. */ #ifndef OPENTHREAD_CORE_QPG6105_CONFIG_H_ #define OPENTHREAD_CORE_QPG6105_CONFIG_H_ /** * @def OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE * * Define to 1 if you want use legacy transmit done. * */ #define OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE 1 /** * @def OPENTHREAD_CONFIG_PLATFORM_INFO * * The platform-specific string to insert into the OpenThread version string. * */ #define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6105" #endif // OPENTHREAD_CORE_QPG6105_CONFIG_H_
/* * Copyright 2011 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT2_H_ #define SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT2_H_ #include "sfntly/table/bitmap/index_sub_table.h" namespace sfntly { class IndexSubTableFormat2 : public IndexSubTable, public RefCounted<IndexSubTableFormat2> { public: static int32_t GetDataLength(ReadableFontData* data, int32_t offset, int32_t first, int32_t last); // Note: the constructor does not implement offset/length form provided in // Java to avoid heavy lifting in constructors. Callers to call // GetDataLength() static method of the derived class to get proper // length and slice ahead. IndexSubTableFormat2(ReadableFontData* data, int32_t first, int32_t last); virtual ~IndexSubTableFormat2(); virtual int32_t NumGlyphs(); virtual int32_t GlyphOffset(int32_t glyph_id); virtual int32_t GlyphLength(int32_t glyph_id); private: int32_t Loca(int32_t loca_index); int32_t image_size_; }; } // namespace sfntly #endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT1_H_
/* * * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef GRPC_CORE_SUPPORT_TMPFILE_H #define GRPC_CORE_SUPPORT_TMPFILE_H #include <stdio.h> #include <grpc/support/slice.h> #ifdef __cplusplus extern "C" { #endif /* Creates a temporary file from a prefix. If tmp_filename is not NULL, *tmp_filename is assigned the name of the created file and it is the responsibility of the caller to gpr_free it unless an error occurs in which case it will be set to NULL. */ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename); #ifdef __cplusplus } #endif #endif /* GRPC_CORE_SUPPORT_TMPFILE_H */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE401_Memory_Leak__int64_t_realloc_18.c Label Definition File: CWE401_Memory_Leak.c.label.xml Template File: sources-sinks-18.tmpl.c */ /* * @description * CWE: 401 Memory Leak * BadSource: realloc Allocate data using realloc() * GoodSource: Allocate data on the stack * Sinks: * GoodSink: call free() on data * BadSink : no deallocation of data * Flow Variant: 18 Control flow: goto statements * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE401_Memory_Leak__int64_t_realloc_18_bad() { int64_t * data; data = NULL; goto source; source: /* POTENTIAL FLAW: Allocate memory on the heap */ data = (int64_t *)realloc(data, 100*sizeof(int64_t)); if (data == NULL) {exit(-1);} /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); goto sink; sink: /* POTENTIAL FLAW: No deallocation */ ; /* empty statement needed for some flow variants */ } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G() - use badsource and goodsink by reversing the blocks on the second goto statement */ static void goodB2G() { int64_t * data; data = NULL; goto source; source: /* POTENTIAL FLAW: Allocate memory on the heap */ data = (int64_t *)realloc(data, 100*sizeof(int64_t)); if (data == NULL) {exit(-1);} /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); goto sink; sink: /* FIX: Deallocate memory */ free(data); } /* goodG2B() - use goodsource and badsink by reversing the blocks on the first goto statement */ static void goodG2B() { int64_t * data; data = NULL; goto source; source: /* FIX: Use memory allocated on the stack with ALLOCA */ data = (int64_t *)ALLOCA(100*sizeof(int64_t)); /* Initialize and make use of data */ data[0] = 5LL; printLongLongLine(data[0]); goto sink; sink: /* POTENTIAL FLAW: No deallocation */ ; /* empty statement needed for some flow variants */ } void CWE401_Memory_Leak__int64_t_realloc_18_good() { goodB2G(); goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE401_Memory_Leak__int64_t_realloc_18_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE401_Memory_Leak__int64_t_realloc_18_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#define GIT_VERSION "-g74892ac"
/*========================================================================= Program: Visualization Toolkit Module: vtkPlaneSource.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 vtkPlaneSource - create an array of quadrilaterals located in a plane // .SECTION Description // vtkPlaneSource creates an m x n array of quadrilaterals arranged as // a regular tiling in a plane. The plane is defined by specifying an // origin point, and then two other points that, together with the // origin, define two axes for the plane. These axes do not have to be // orthogonal - so you can create a parallelogram. (The axes must not // be parallel.) The resolution of the plane (i.e., number of subdivisions) is // controlled by the ivars XResolution and YResolution. // // By default, the plane is centered at the origin and perpendicular to the // z-axis, with width and height of length 1 and resolutions set to 1. // // There are three convenience methods that allow you to easily move the // plane. The first, SetNormal(), allows you to specify the plane // normal. The effect of this method is to rotate the plane around the center // of the plane, aligning the plane normal with the specified normal. The // rotation is about the axis defined by the cross product of the current // normal with the new normal. The second, SetCenter(), translates the center // of the plane to the specified center point. The third method, Push(), // allows you to translate the plane along the plane normal by the distance // specified. (Negative Push values translate the plane in the negative // normal direction.) Note that the SetNormal(), SetCenter() and Push() // methods modify the Origin, Point1, and/or Point2 instance variables. // .SECTION Caveats // The normal to the plane will point in the direction of the cross product // of the first axis (Origin->Point1) with the second (Origin->Point2). This // also affects the normals to the generated polygons. #ifndef __vtkPlaneSource_h #define __vtkPlaneSource_h #include "vtkFiltersSourcesExport.h" // For export macro #include "vtkPolyDataAlgorithm.h" class VTKFILTERSSOURCES_EXPORT vtkPlaneSource : public vtkPolyDataAlgorithm { public: void PrintSelf(ostream& os, vtkIndent indent); vtkTypeMacro(vtkPlaneSource,vtkPolyDataAlgorithm); // Description: // Construct plane perpendicular to z-axis, resolution 1x1, width // and height 1.0, and centered at the origin. static vtkPlaneSource *New(); // Description: // Specify the resolution of the plane along the first axes. vtkSetMacro(XResolution,int); vtkGetMacro(XResolution,int); // Description: // Specify the resolution of the plane along the second axes. vtkSetMacro(YResolution,int); vtkGetMacro(YResolution,int); // Description: // Set the number of x-y subdivisions in the plane. void SetResolution(const int xR, const int yR); void GetResolution(int& xR,int& yR) { xR=this->XResolution; yR=this->YResolution;}; // Description: // Specify a point defining the origin of the plane. vtkSetVector3Macro(Origin,double); vtkGetVectorMacro(Origin,double,3); // Description: // Specify a point defining the first axis of the plane. void SetPoint1(double x, double y, double z); void SetPoint1(double pnt[3]); vtkGetVectorMacro(Point1,double,3); // Description: // Specify a point defining the second axis of the plane. void SetPoint2(double x, double y, double z); void SetPoint2(double pnt[3]); vtkGetVectorMacro(Point2,double,3); // Description: // Set/Get the center of the plane. Works in conjunction with the plane // normal to position the plane. Don't use this method to define the plane. // Instead, use it to move the plane to a new center point. void SetCenter(double x, double y, double z); void SetCenter(double center[3]); vtkGetVectorMacro(Center,double,3); // Description: // Set/Get the plane normal. Works in conjunction with the plane center to // orient the plane. Don't use this method to define the plane. Instead, use // it to rotate the plane around the current center point. void SetNormal(double nx, double ny, double nz); void SetNormal(double n[3]); vtkGetVectorMacro(Normal,double,3); // Description: // Translate the plane in the direction of the normal by the // distance specified. Negative values move the plane in the // opposite direction. void Push(double distance); protected: vtkPlaneSource(); ~vtkPlaneSource() {}; int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); int XResolution; int YResolution; double Origin[3]; double Point1[3]; double Point2[3]; double Normal[3]; double Center[3]; int UpdatePlane(double v1[3], double v2[3]); private: vtkPlaneSource(const vtkPlaneSource&); // Not implemented. void operator=(const vtkPlaneSource&); // Not implemented. }; #endif
/* $NetBSD: profile.h,v 1.12 1998/09/11 16:46:31 jonathan Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Ralph Campbell. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)profile.h 8.1 (Berkeley) 6/10/93 */ #ifndef _MIPS_PROFILE_H_ #define _MIPS_PROFILE_H_ #ifdef _KERNEL /* * Declare non-profiled _splhigh() /_splx() entrypoints for _mcount. * see MCOUNT_ENTER and MCOUNT_EXIT. */ #define _KERNEL_MCOUNT_DECL \ extern int _splhigh __P((void)); extern int _splx __P((int)); #else /* !_KERNEL */ /* Make __mcount static. */ #define _KERNEL_MCOUNT_DECL static #endif /* !_KERNEL */ #ifdef _KERNEL # define _PROF_CPLOAD "" #else # define _PROF_CPLOAD ".cpload $25;" #endif #define _MCOUNT_DECL \ _KERNEL_MCOUNT_DECL \ void __attribute__((unused)) __mcount #define MCOUNT \ __asm__(".globl _mcount;" \ ".type _mcount,@function;" \ "_mcount:;" \ ".set noreorder;" \ ".set noat;" \ _PROF_CPLOAD \ "sw $4,8($29);" \ "sw $5,12($29);" \ "sw $6,16($29);" \ "sw $7,20($29);" \ "sw $1,0($29);" \ "sw $31,4($29);" \ "move $5,$31;" \ "jal __mcount;" \ "move $4,$1;" \ "lw $4,8($29);" \ "lw $5,12($29);" \ "lw $6,16($29);" \ "lw $7,20($29);" \ "lw $31,4($29);" \ "lw $1,0($29);" \ "addu $29,$29,8;" \ "j $31;" \ "move $31,$1;" \ ".set reorder;" \ ".set at"); #ifdef _KERNEL /* * The following two macros do splhigh and splx respectively. * They have to be defined this way because these are real * functions on the MIPS, and we do not want to invoke mcount * recursively. */ #define MCOUNT_ENTER s = _splhigh() #define MCOUNT_EXIT _splx(s) #endif /* _KERNEL */ #endif /* _MIPS_PROFILE_H_ */
// Copyright 2021 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_OPTIMIZATION_GUIDE_CORE_PAGE_CONTENT_ANNOTATIONS_COMMON_H_ #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_PAGE_CONTENT_ANNOTATIONS_COMMON_H_ #include <string> #include <vector> #include "base/callback.h" #include "components/optimization_guide/core/entity_metadata.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace optimization_guide { // The status of a page content annotation execution. enum class ExecutionStatus { // Status is unknown. kUnknown = 0, // Execution finished successfully. kSuccess = 1, // Execution is still pending. kPending = 2, // Execution failed for some reason internal to Opt Guide. These failures // should not happen and result in a DCHECK in non-production builds. kErrorInternalError = 3, // Execution failed because the model file is not available. kErrorModelFileNotAvailable = 4, // Execution failed because the model file could not be loaded into TFLite. kErrorModelFileNotValid = 5, // Execution failed because the input was empty or otherwise invalid. kErrorEmptyOrInvalidInput = 6, }; // The type of annotation that is being done on the given input. enum class AnnotationType { kUnknown, // The input will be annotated with the topics on the page. These topics are // fairly high-level like "sports" or "news". kPageTopics, // The input will be annotated for the visibility of the content. kContentVisibility, // The input will be annotated with the entity IDs on the page, for example // listing the IDs of all the proper nouns on a page. To map the IDs back to // human-readable strings, use `EntityMetadataProvider`. kPageEntities, }; std::string ExecutionStatusToString(ExecutionStatus status); std::string AnnotationTypeToString(AnnotationType type); // A weighted string value. class WeightedString { public: WeightedString(const std::string& value, double weight); WeightedString(const WeightedString&); ~WeightedString(); std::string value() const { return value_; } double weight() const { return weight_; } std::string ToString() const; bool operator==(const WeightedString& other) const; friend std::ostream& operator<<(std::ostream& stream, const WeightedString& ws); private: std::string value_; // In the range of [0.0, 1.0]. double weight_ = 0; }; // The result of an execution, and all associated data. class BatchAnnotationResult { public: // Creates a result for a page topics annotation. static BatchAnnotationResult CreatePageTopicsResult( const std::string& input, ExecutionStatus status, absl::optional<std::vector<WeightedString>> topics); // Creates a result for a page entities annotation. static BatchAnnotationResult CreatePageEntitiesResult( const std::string& input, ExecutionStatus status, absl::optional<std::vector<ScoredEntityMetadata>> entities); // Creates a result for a content visibility annotation. static BatchAnnotationResult CreateContentVisibilityResult( const std::string& input, ExecutionStatus status, absl::optional<double> visibility_score); // Creates a result where the AnnotationType and output are not set. static BatchAnnotationResult CreateEmptyAnnotationsResult( const std::string& input, ExecutionStatus status); BatchAnnotationResult(const BatchAnnotationResult&); ~BatchAnnotationResult(); std::string input() const { return input_; } AnnotationType type() const { return type_; } ExecutionStatus status() const { return status_; } absl::optional<std::vector<WeightedString>> topics() const { return topics_; } absl::optional<std::vector<ScoredEntityMetadata>> entities() const { return entities_; } absl::optional<double> visibility_score() const { return visibility_score_; } std::string ToString() const; bool operator==(const BatchAnnotationResult& other) const; friend std::ostream& operator<<(std::ostream& stream, const BatchAnnotationResult& result); private: BatchAnnotationResult(); std::string input_; AnnotationType type_ = AnnotationType::kUnknown; ExecutionStatus status_ = ExecutionStatus::kUnknown; // Output for page topics annotations, set only if the |type_| matches and the // execution was successful. absl::optional<std::vector<WeightedString>> topics_; // Output for page entities annotations, set only if the |type_| matches and // the execution was successful. absl::optional<std::vector<ScoredEntityMetadata>> entities_; // Output for visisbility score annotations, set only if the |type_| matches // and the execution was successful. absl::optional<double> visibility_score_; }; using BatchAnnotationCallback = base::OnceCallback<void(const std::vector<BatchAnnotationResult>&)>; // Creates a vector of |BatchAnnotationResult| from the given |inputs| where // each result's status is set to |status|. Useful for creating an Annotation // response with a single error. std::vector<BatchAnnotationResult> CreateEmptyBatchAnnotationResultsWithStatus( const std::vector<std::string>& inputs, ExecutionStatus status); } // namespace optimization_guide #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_PAGE_CONTENT_ANNOTATIONS_COMMON_H_
/* * Copyright (c) 2014,2015 Apple Inc. All rights reserved. * * corecrypto Internal Use License Agreement * * IMPORTANT: This Apple corecrypto software is supplied to you by Apple Inc. ("Apple") * in consideration of your agreement to the following terms, and your download or use * of this Apple software constitutes acceptance of these terms. If you do not agree * with these terms, please do not download or use this Apple software. * * 1. As used in this Agreement, the term "Apple Software" collectively means and * includes all of the Apple corecrypto materials provided by Apple here, including * but not limited to the Apple corecrypto software, frameworks, libraries, documentation * and other Apple-created materials. In consideration of your agreement to abide by the * following terms, conditioned upon your compliance with these terms and subject to * these terms, Apple grants you, for a period of ninety (90) days from the date you * download the Apple Software, a limited, non-exclusive, non-sublicensable license * under Apple’s copyrights in the Apple Software to make a reasonable number of copies * of, compile, and run the Apple Software internally within your organization only on * devices and computers you own or control, for the sole purpose of verifying the * security characteristics and correct functioning of the Apple Software; provided * that you must retain this notice and the following text and disclaimers in all * copies of the Apple Software that you make. You may not, directly or indirectly, * redistribute the Apple Software or any portions thereof. The Apple Software is only * licensed and intended for use as expressly stated above and may not be used for other * purposes or in other contexts without Apple's prior written permission. Except as * expressly stated in this notice, no other rights or licenses, express or implied, are * granted by Apple herein. * * 2. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES * OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING * THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS, * SYSTEMS, OR SERVICES. APPLE DOES NOT WARRANT THAT THE APPLE SOFTWARE WILL MEET YOUR * REQUIREMENTS, THAT THE OPERATION OF THE APPLE SOFTWARE WILL BE UNINTERRUPTED OR * ERROR-FREE, THAT DEFECTS IN THE APPLE SOFTWARE WILL BE CORRECTED, OR THAT THE APPLE * SOFTWARE WILL BE COMPATIBLE WITH FUTURE APPLE PRODUCTS, SOFTWARE OR SERVICES. NO ORAL * OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE * WILL CREATE A WARRANTY. * * 3. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING * IN ANY WAY OUT OF THE USE, REPRODUCTION, COMPILATION OR OPERATION OF THE APPLE * SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * 4. This Agreement is effective until terminated. Your rights under this Agreement will * terminate automatically without notice from Apple if you fail to comply with any term(s) * of this Agreement. Upon termination, you agree to cease all use of the Apple Software * and destroy all copies, full or partial, of the Apple Software. This Agreement will be * governed and construed in accordance with the laws of the State of California, without * regard to its choice of law rules. * * You may report security issues about Apple products to product-security@apple.com, * as described here:  https://www.apple.com/support/security/. Non-security bugs and * enhancement requests can be made via https://bugreport.apple.com as described * here: https://developer.apple.com/bug-reporting/ * * EA1350 * 10/5/15 */ #import <XCTest/XCTest.h> #import <corecrypto/ccz.h> @interface CCZKATValidation : XCTestCase { ccz *a, *b, *c, *d, *r; unsigned expected_reallocs; struct ccz a_c; struct ccz b_c; struct ccz c_c; struct ccz lsra_c; struct ccz lsra8_c; struct ccz lsra64_c; struct ccz lsra65_c; struct ccz lsla_c; struct ccz lsla64_c; struct ccz lsla65_c; struct ccz sumab_c; struct ccz diffba_c; struct ccz prodab_c; struct ccz squarea_c; } - (void) setUp; - (void) tearDown; @end
// GWCityAskInitInfo.h // // 请求申请建立新的城市 // ////////////////////////////////////////////////////// #ifndef __GWCITYASKINITINFO_H__ #define __GWCITYASKINITINFO_H__ #include "Type.h" #include "Packet.h" #include "PacketFactory.h" namespace Packets { class GWCityAskInitInfo : public Packet { public: GWCityAskInitInfo( ){} ; virtual ~GWCityAskInitInfo( ){} ; //公用继承接口 virtual BOOL Read( SocketInputStream& iStream ) ; virtual BOOL Write( SocketOutputStream& oStream ) const ; virtual UINT Execute( Player* pPlayer ) ; virtual PacketID_t GetPacketID() const { return PACKET_GW_CITYASKINITINFO; } virtual UINT GetPacketSize() const { return 0; } public: private: }; class GWCityAskInitInfoFactory : public PacketFactory { public: Packet* CreatePacket() { return new GWCityAskInitInfo() ; } PacketID_t GetPacketID() const { return PACKET_GW_CITYASKINITINFO ; } UINT GetPacketMaxSize() const { return 0; } }; class GWCityAskInitInfoHandler { public: static UINT Execute( GWCityAskInitInfo* pPacket, Player* pPlayer ) ; }; }; using namespace Packets ; #endif
// // ODViewController.h // ODCoreDataManagerSample // // Created by Olivier Demolliens on 12/05/13. // Copyright (c) 2013 Olivier Demolliens. All rights reserved. // #import <UIKit/UIKit.h> @interface ODViewController : UIViewController @end
#pragma once #include <df/platform.h> #include <df/system/NonCopyable.h> #include <pthread.h> namespace df { namespace priv { /// windows thread implementation class ThreadImpl : NonCopyable { public: ThreadImpl( void (*functionPtr)(void *), void * userData ); ~ThreadImpl(); void join(); uint32 getID(); void terminate() private: pthread_t _thread; ///< posix thread handle uint32 _threadId; ///< thread identifier struct ThreadStartInfo { void (*functionPtr)(void *); ///< Pointer to the function to be executed. void * userData; ///< Function argument for the thread function. } _info; static void* entryPoint(void* userData); }; static uint32 pthread_t_to_ID(const pthread_t &handle); } // namespace priv } // namespace df
/**************************************************************************** ***************************************************************************** ** Copyright (c) 1998-2013 ** ** Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre ** ** ** ** Copyright (c) 2003-2008 ** ** University of Tennessee, Innovative Computing Laboratory ** ** ** ** See the file COPYRIGHT in the package base directory for details ** ****************************************************************************/ #ifndef EARL_FORK_REP_H #define EARL_FORK_REP_H /* *---------------------------------------------------------------------------- * * class Fork_rep * * Event of creating a team of threads. * *---------------------------------------------------------------------------- */ #include "Team_rep.h" namespace earl { class Fork_rep : public Team_rep { public: Fork_rep(State& state, EventBuffer* buffer, Location* loc, double time) : Team_rep(state, buffer, loc, time) {} virtual bool is_type(etype type) const; virtual etype get_type() const { return FORK; } virtual std::string get_typestr() const { return "FORK"; } virtual void trans(State& state); }; } #endif
#ifndef ENGPAR_CONTAINER_H #define ENGPAR_CONTAINER_H #include <sstream> #include <unordered_map> namespace engpar { template <class T> class Container { typedef std::unordered_map<int,T> Data; public: typedef typename Data::iterator iterator; Container() {my_total=0;} iterator begin() { return d.begin(); } T total() { return my_total; } typedef std::pair<const int, T> Item; const Item* iterate(iterator& itr) { if( itr == d.end() ) return NULL; else return &(*itr++); } iterator end() { return d.end(); } T& operator[](int key) { return d[key]; } T get(int key) { return d[key]; } void increment(int key) { my_total++; d[key]++; } void increment2(int key) { d[key]++; } void set(int key, T value) { iterator old = d.find(key); if (old!=d.end()) my_total-=old->second;; my_total+=value; d[key] = value; } bool has(int key) { return (d.count(key) != 0); } size_t size() { return d.size(); } std::string print(const char* name) { std::stringstream s; s << name << "\n"; const Item* i; iterator itr = begin(); while( (i = iterate(itr)) ) s << " "<<i->first << " -> " << i->second << "\n"; return s.str(); } protected: Data d; T my_total; }; } #endif
/**************************************************************************** * Copyright (c) 1993, 1994 * Century Computing, Inc. * ALL RIGHTS RESERVED * * The software (programs, data bases and/or documentation) on or in * any media can not be reproduced, disclosed, or used except under * the terms of the TAE Plus Software License Agreement. * ***************************************************************************/ /* Vm_OpenStdout - open stdout for TAE 'c' application programs. * * CHANGE LOG: * * 16-dec-87 Created...tpl * 07-feb-89 Conditionalize s_lower() for UNIX; rename to .c ...ljn * 22-jul-92 PR1519: Label as CLASSIC...kbs * */ #include "taeconf.inp" #include "terminc.inc" #include "parblk.inc" #include "tmhost.inp" #include "vminc.inc" #include <stdio.h> #include "taeintproto.h" /* */ CLASSIC_FUNCTION FILE * Vm_OpenStdout ( Id h /* in: parblk handle */ ) { IMPORT FILE *stdo_file; /* pointer to stdout file */ IMPORT BOOL term_std; /* true if terminal is stdout */ IMPORT CODE applic_type; /* application type ('c') */ IMPORT TEXT pm_type[], pk_type[]; struct VARIABLE *v; CODE termtype; COUNT termlines; COUNT termcols; TEXT msgbuf[STRINGSIZ+1]; TEXT **stdr_ptr = 0; /* stdrec string vector pointer */ COUNT len; TEXT filemode[2]; /* create or append */ FILE *stdo_ptr; struct VM_STRUCT *vm; vm = (struct VM_STRUCT *)h; t_init(&termlines, &termcols, &termtype); /* initialize terminal pkg */ Vm_Call (h); /* application init */ v = Vm_Find(h, "_STDOUT"); /* get the string */ if ( v == NULL ) x_error( (*vm).npblk.mode,pm_type, pk_type, (uintptr_t) "_STDOUT", 0, 0); else if ((*v).v_type != V_STRING) x_error( (*vm).npblk.mode,pm_type, pk_type, (uintptr_t) "_STDOUT", 0, 0); else stdr_ptr = (TEXT **) (*v).v_cvp; /* get value pointer */ term_std = (s_equal(TERMINAL, stdr_ptr[0])); /* filename = terminal ? */ s_copy ( "w", filemode ); if (!s_equal(stdr_ptr[1] , "CREATE")) s_copy ( "a", filemode ); #ifdef UNIX s_lower ( stdr_ptr[0] ); #endif stdo_ptr = fopen(stdr_ptr[0], filemode); /* open the file */ if (stdo_ptr == NULL) { if ((*vm).npblk.mode == P_ABORT) { len = s_copy("Could not open standard output file ", msgbuf); s_bcopy(stdr_ptr[0], &msgbuf[len], STRINGSIZ); t_write(msgbuf, T_STDCC); /* errmsg to terminal*/ z_exit(-1, "TAE-STDOPEN"); /* set SFI, SKEY */ } } else stdo_file = stdo_ptr; /* save stdout ptr globally */ applic_type = C_TYPE; /* 'c' language application */ return (stdo_ptr); }
/* $OpenBSD: fpu_arith.h,v 1.2 1997/08/08 08:25:48 downsj Exp $ */ /* $NetBSD: fpu_arith.h,v 1.2 1994/11/20 20:52:35 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Lawrence Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)fpu_arith.h 8.1 (Berkeley) 6/11/93 */ /* * Extended-precision arithmetic. * * We hold the notion of a `carry register', which may or may not be a * machine carry bit or register. On the SPARC, it is just the machine's * carry bit. * * In the worst case, you can compute the carry from x+y as * (unsigned)(x + y) < (unsigned)x * and from x+y+c as * ((unsigned)(x + y + c) <= (unsigned)x && (y|c) != 0) * for example. */ /* set up for extended-precision arithemtic */ #define FPU_DECL_CARRY /* * We have three kinds of add: * add with carry: r = x + y + c * add (ignoring current carry) and set carry: c'r = x + y + 0 * add with carry and set carry: c'r = x + y + c * The macros use `C' for `use carry' and `S' for `set carry'. * Note that the state of the carry is undefined after ADDC and SUBC, * so if all you have for these is `add with carry and set carry', * that is OK. * * The same goes for subtract, except that we compute x - y - c. * * Finally, we have a way to get the carry into a `regular' variable, * or set it from a value. SET_CARRY turns 0 into no-carry, nonzero * into carry; GET_CARRY sets its argument to 0 or 1. */ #define FPU_ADDC(r, x, y) \ asm volatile("addx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_ADDS(r, x, y) \ asm volatile("addcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_ADDCS(r, x, y) \ asm volatile("addxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_SUBC(r, x, y) \ asm volatile("subx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_SUBS(r, x, y) \ asm volatile("subcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_SUBCS(r, x, y) \ asm volatile("subxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y)) #define FPU_GET_CARRY(r) asm volatile("addx %%g0,%%g0,%0" : "=r"(r)) #define FPU_SET_CARRY(v) asm volatile("addcc %0,-1,%%g0" : : "r"(v)) #define FPU_SHL1_BY_ADD /* shift left 1 faster by ADDC than (a<<1)|(b>>31) */