text
stringlengths
4
6.14k
// // PKHUDWideBaseView.h // PKHUD // // Created by djzhang on 8/10/15. // Copyright (c) 2015 djzhang. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> /// Provides a wide base view, which you can subclass and add additional views to. @interface PKHUDWideBaseView : UIView @end
/** * @license Apache-2.0 * * Copyright (c) 2020 The Stdlib Authors. * * 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. */ /** * Benchmark `dsnanmeanwd`. */ #include "stdlib/stats/base/dsnanmeanwd.h" #include <stdlib.h> #include <stdio.h> #include <math.h> #include <time.h> #include <sys/time.h> #define NAME "dsnanmeanwd" #define ITERATIONS 1000000 #define REPEATS 3 #define MIN 1 #define MAX 6 /** * Prints the TAP version. */ void print_version() { printf( "TAP version 13\n" ); } /** * Prints the TAP summary. * * @param total total number of tests * @param passing total number of passing tests */ void print_summary( int total, int passing ) { printf( "#\n" ); printf( "1..%d\n", total ); // TAP plan printf( "# total %d\n", total ); printf( "# pass %d\n", passing ); printf( "#\n" ); printf( "# ok\n" ); } /** * Prints benchmarks results. * * @param iterations number of iterations * @param elapsed elapsed time in seconds */ void print_results( int iterations, double elapsed ) { double rate = (double)iterations / elapsed; printf( " ---\n" ); printf( " iterations: %d\n", iterations ); printf( " elapsed: %0.9f\n", elapsed ); printf( " rate: %0.9f\n", rate ); printf( " ...\n" ); } /** * Returns a clock time. * * @return clock time */ double tic() { struct timeval now; gettimeofday( &now, NULL ); return (double)now.tv_sec + (double)now.tv_usec/1.0e6; } /** * Generates a random number on the interval [0,1]. * * @return random number */ float rand_float() { int r = rand(); return (float)r / ( (float)RAND_MAX + 1.0f ); } /* * Runs a benchmark. * * @param iterations number of iterations * @param len array length * @return elapsed time in seconds */ double benchmark( int iterations, int len ) { double elapsed; float x[ len ]; double v; double t; int i; for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*20000.0f ) - 10000.0f; } v = 0.0; t = tic(); for ( i = 0; i < iterations; i++ ) { v = stdlib_strided_dsnanmeanwd( len, x, 1 ); if ( v != v ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; if ( v != v ) { printf( "should not return NaN\n" ); } return elapsed; } /** * Main execution sequence. */ int main( void ) { double elapsed; int count; int iter; int len; int i; int j; // Use the current time to seed the random number generator: srand( time( NULL ) ); print_version(); count = 0; for ( i = MIN; i <= MAX; i++ ) { len = pow( 10, i ); iter = ITERATIONS / pow( 10, i-1 ); for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); elapsed = benchmark( iter, len ); print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } } print_summary( count, count ); }
/* * Copyright [2016] [Subhabrata Ghosh] * * 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. * */ // // Created by Subhabrata Ghosh on 31/08/16. // #ifndef WATERGATE_ENV_H #define WATERGATE_ENV_H #include <vector> #include "config.h" #include "file_utils.h" #include "__app.h" #include "log_utils.h" #include "metrics.h" #define CONFIG_ENV_PARAM_TEMPDIR "env.config.tempdir" #define CONFIG_ENV_PARAM_WORKDIR "env.config.workdir" #define CONST_DEFAULT_DIR "/tmp/watergate" #define CONST_CONFIG_ENV_PARAM_APPNAME "app.name" #define CONST_CONFIG_ENV_PATH "env" #define CHECK_ENV_STATE(env) do { \ if (IS_NULL(env)) { \ throw runtime_error("Environment handle is NULL"); \ } \ CHECK_STATE_AVAILABLE(env->get_state()); \ } while(0) using namespace com::wookler::reactfs::common; REACTFS_NS_COMMON class __env { private: __state__ state; Config *config; __app *app; Path *work_dir = nullptr; Path *temp_dir = nullptr; void setup_defaults() { this->app = new __app(CONST_CONFIG_ENV_PARAM_APPNAME); CHECK_ALLOC(this->app, TYPE_NAME(__app)); this->work_dir = new Path(CONST_DEFAULT_DIR); CHECK_ALLOC(this->work_dir, TYPE_NAME(string)); string appdir = this->app->get_app_directory(); if (!IS_EMPTY(appdir)) { this->work_dir->append(appdir); } this->work_dir->append("work"); if (!this->work_dir->exists()) { this->work_dir->create(0755); } this->temp_dir = new Path(CONST_DEFAULT_DIR); CHECK_ALLOC(this->temp_dir, TYPE_NAME(string)); if (!IS_EMPTY(appdir)) { this->temp_dir->append(appdir); } this->temp_dir->append("temp"); if (!this->temp_dir->exists()) { this->temp_dir->create(0755); } } public: ~__env(); void create(string filename) { create(filename, common_consts::EMPTY_STRING); } void create(string filename, string app_name); const __state__ get_state() const { return state; } Config *get_config() const { CHECK_STATE_AVAILABLE(this->state); return this->config; } const Path *get_work_dir() const; const Path *get_temp_dir() const; const __app *get_app() const { return app; } Path *get_work_dir(string name, mode_t mode) const; Path *get_temp_dir(string name, mode_t mode) const; }; REACTFS_NS_COMMON_END #endif //WATERGATE_ENV_H
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SLING_FRAME_DECODER_H_ #define SLING_FRAME_DECODER_H_ #include <string> #include "sling/base/macros.h" #include "sling/frame/object.h" #include "sling/frame/store.h" #include "sling/stream/input.h" namespace sling { // The decoder decodes objects in binary format and loads them into a store. class Decoder { public: // Initializes decoder with store where objects should be stored and input // where objects are read from. Decoder(Store *store, Input *input); // Decodes the next object from the input. Object Decode(); // Decodes all objects from the input and returns the last value. Object DecodeAll(); // Returns true when there are no more objects in the input. bool done() { return input_->done(); } // Decodes object from input and returns handle to it. Handle DecodeObject(); // Skips frames in the input which are already in the store. void set_skip_known_frames(bool b) { skip_known_frames_ = b; } private: // Decodes frame from input. Handle DecodeFrame(int slots, int replace); // Decodes string from input. Handle DecodeString(int size); // Decodes array from input. Handle DecodeArray(); // Decodes unbound symbol from input. Handle DecodeSymbol(int name_size); // Decodes bound symbol from input. Handle DecodeLink(int name_size); // Gets the current location in the stack. Word Mark() { return stack_.offset(stack_.end()); } // Pushes value onto stack. void Push(Handle h) { *stack_.push() = h; } // Replaces element on top of stack. void ReplaceTop(Handle h) { stack_.pop(); *stack_.push() = h; } // Pops elements off the stack. void Release(Word mark) { stack_.set_end(stack_.address(mark)); } // Returns handle for reference. Handle Reference(uint32 index) { Handle *h = references_.base() + index; CHECK(h < references_.end()); return *h; } // Object store for storing decoded objects. Store *store_; // Decoder input. Input *input_; // References to previously decoded objects. HandleSpace references_; // Stack for storing intermediate values while decoding objects. HandleSpace stack_; // Frames that already exist in the store can be skipped by the decoder. bool skip_known_frames_ = false; DISALLOW_IMPLICIT_CONSTRUCTORS(Decoder); }; } // namespace sling #endif // SLING_FRAME_DECODER_H_
#ifndef ReachMap_VISUAL_H #define ReachMap_VISUAL_H #include <map_creator/WorkSpace.h> namespace Ogre { class Vector3; class Quaternion; } namespace rviz { class Arrow; class Shape; } namespace workspace_visualization { class ReachMapDisplay; class ReachMapVisual { public: ReachMapVisual(Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node, rviz::DisplayContext* display); virtual ~ReachMapVisual(); void setMessage(const map_creator::WorkSpace::ConstPtr& msg, bool do_display_arrow, bool do_display_sphere, int low_ri, int high_ri, int shape_choice, int disect_choice); void setFramePosition(const Ogre::Vector3& position); void setFrameOrientation(const Ogre::Quaternion& orientation); void setColorArrow(float r, float g, float b, float a); void setSizeArrow(float l); void setColorSphere(float r, float g, float b, float a); void setSizeSphere(float l); void setColorSpherebyRI(float alpha); private: std::vector< boost::shared_ptr< rviz::Arrow > > arrow_; std::vector< boost::shared_ptr< rviz::Shape > > sphere_; std::vector< int > colorRI_; Ogre::SceneNode* frame_node_; Ogre::SceneManager* scene_manager_; }; } // end namespace workspace_visualization #endif // ReachMap_VISUAL_H
#ifndef IU_ATLHEADERS_H #define IU_ATLHEADERS_H #pragma once #ifndef _UNICODE #define UNICODE #define _UNICODE #endif //#define _WTL_USE_CSTRING #ifndef _WTL_NO_CSTRING #define _WTL_NO_CSTRING #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #ifndef NOMINMAX #define NOMINMAX #endif //#include <winsock2.h> #include <windows.h> #include <tchar.h> #include <ShellAPI.h> #include <atlstr.h> #include <atlbase.h> #include <atlapp.h> #include <atlwin.h> #include <atlframe.h> #include <atlctrls.h> #include <atldlgs.h> #include <atlddx.h> #include <atlgdi.h> #include <atlmisc.h> #include <atlcoll.h> #include <atltheme.h> #include <atlcrack.h> #include "atlctrlx.h" #include "Core/CommonDefs.h" typedef CAtlArray<CString> CStringList; #ifndef IU_SHELLEXT extern CAppModule _Module; #else extern HINSTANCE hDllInstance; #endif #endif
// Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the // University of Virginia, University of Heidelberg, and University // of Connecticut School of Medicine. // All rights reserved. // Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc., University of Heidelberg, and University of // of Connecticut School of Medicine. // All rights reserved. // Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc., University of Heidelberg, and The University // of Manchester. // All rights reserved. // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc., EML Research, gGmbH, University of Heidelberg, // and The University of Manchester. // All rights reserved. // Copyright (C) 2006 - 2007 by Pedro Mendes, Virginia Tech Intellectual // Properties, Inc. and EML Research, gGmbH. // All rights reserved. /** * COptMethodLevenbergMarquardt class */ #ifndef COPASI_COptMethodLevenbergMarquardt #define COPASI_COptMethodLevenbergMarquardt #include <vector> #include "copasi/core/CMatrix.h" #include "copasi/optimization/COptMethod.h" class CRandom; class COptMethodLevenbergMarquardt : public COptMethod { // Operations public: /** * Specific constructor * @param const CDataContainer * pParent * @param const CTaskEnum::Method & methodType (default: LevenbergMarquardt) * @param const CTaskEnum::Task & taskType (default: optimization) */ COptMethodLevenbergMarquardt(const CDataContainer * pParent, const CTaskEnum::Method & methodType = CTaskEnum::Method::LevenbergMarquardt, const CTaskEnum::Task & taskType = CTaskEnum::Task::optimization); /** * Copy Constructor * @param const COptMethodLevenbergMarquardt & src * @param const CDataContainer * pParent (default: NULL) */ COptMethodLevenbergMarquardt(const COptMethodLevenbergMarquardt & src, const CDataContainer * pParent); /** * Destructor */ virtual ~COptMethodLevenbergMarquardt(); /** * Execute the optimization algorithm calling simulation routine * when needed. It is noted that this procedure can give feedback * of its progress by the callback function set with SetCallback. * @ return success; */ virtual bool optimise(); /** * Returns the maximum verbosity at which the method can log. */ virtual unsigned C_INT32 getMaxLogVerbosity() const; private: /** * Default Constructor */ COptMethodLevenbergMarquardt(); /** * Initialize contained objects. */ void initObjects(); /** * Initialize arrays and pointer. * @return bool success */ virtual bool initialize(); /** * Cleanup arrays and pointers. * @return bool success */ virtual bool cleanup(); /** * Evaluate the objective function * @return bool continue */ const C_FLOAT64 & evaluate(); /** * Calculate the gradient of the objective at the current parameters */ void gradient(); /** * Calculate the Hessian of the objective at the current point */ void hessian(); // Attributes private: /** * The maximum number of iterations */ unsigned C_INT32 mIterationLimit; /** * The tolerance */ C_FLOAT64 mTolerance; /** * The modulation factor */ C_FLOAT64 mModulation; /** * The number of iterations */ unsigned C_INT32 mIteration; /** * Count of algorithm leaving parameter space */ unsigned C_INT32 mParameterOutOfBounds; /** * Handle to the process report item "Current Iteration" */ size_t mhIteration; /** * number of parameters */ size_t mVariableSize; /** * The current solution guess */ CVector< C_FLOAT64 > mCurrent; /** * The last individual */ CVector< C_FLOAT64 > mBest; /** * The gradient */ CVector< C_FLOAT64 > mGradient; /** * The step taken */ CVector< C_FLOAT64 > mStep; /** * The Hessian matrix */ CMatrix<C_FLOAT64> mHessian; /** * The Hessian matrix modified according to Levenberg-Marquardt */ CMatrix<C_FLOAT64> mHessianLM; /** * Vector for temporary values */ CVector< C_FLOAT64 > mTemp; /** * The best value found so far */ C_FLOAT64 mBestValue; /** * The result of a function evaluation */ C_FLOAT64 mEvaluationValue; /** * if no improvement was made after # stalled iterations * stop */ unsigned C_INT32 mStopAfterStalledIterations; /** * Flag indicating whether the computation shall continue */ bool mContinue; /** * Indicate whether we have access to the residuals, i.e., it is a * fitting problem we are working on. */ bool mHaveResiduals; /** * The transpose jacobian of the residuals. */ CMatrix< C_FLOAT64 > mResidualJacobianT; C_FLOAT64 mInitialLamda; C_FLOAT64 mLambdaUp; C_FLOAT64 mLambdaDown; }; #endif // COPASI_COptMethodLevenbergMarquardt
/** * @file * @brief * * @date 26.11.13 * @author Ilia Vaprol */ #ifndef ARM_HAL_MMU_H_ #define ARM_HAL_MMU_H_ /** * First-level descriptor format (VMSAv6, subpages disabled) */ #define L1D_TYPE_SD 0x00002 /* section descriptor */ #define L1D_B 0x00004 /* bufferable */ #define L1D_C 0x00008 /* cacheable */ #define L1D_XN 0x00010 /* not executable */ #define L1D_AP_FULL 0x00C00 /* full access permissions (APX must be 0) */ #define L1D_S 0x10000 /* shared */ #define L1D_NG 0x20000 /* not global */ #define L1D_BASE(n) (0x100000 + n) /* section base address */ #define L1D_TEX_OFFSET 6 #define L1D_TEX_MASK (0x7 << L1D_TEX_OFFSET) #define L1D_TEX_B (1 << L1D_TEX_OFFSET) #define L1D_TEX_C (2 << L1D_TEX_OFFSET) #define L1D_TEX_USE (4 << L1D_TEX_OFFSET) #endif /* ARM_HAL_MMU_H_ */
// // Copyright (c) 2009, Markus Rickert // 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. // #ifndef BODYDELEGATE_H #define BODYDELEGATE_H #include <QItemDelegate> class BodyDelegate : public QItemDelegate { Q_OBJECT public: BodyDelegate(QObject* parent = nullptr); virtual ~BodyDelegate(); QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const; void setEditorData(QWidget* editor, const QModelIndex& index) const; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const; void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const; public slots: void valueChanged(double d); protected: private: }; #endif // BODYDELEGATE_H
/** * @file * * @date 25.11.2011 * @author Alexander Kalmuk */ #ifndef NET_L3_IPV4_IP_FRAGMENT_H #define NET_L3_IPV4_IP_FRAGMENT_H #include <stdint.h> #include <net/skbuff.h> /* 1 second - Minimum Segment Lifetime. Just some suitable constant, * not from any document */ #define MSL 1 struct sk_buff; /** * return sk_buff containing complete data */ extern struct sk_buff *ip_defrag(struct sk_buff *skb); /* When skb is large then interface MTU we split it into * number of smaller pieces. They are linked into sk_buff_head. * We return NULL if we don't have enough memory. * During this operation we don't touch the original skb */ extern int ip_frag(const struct sk_buff *skb, uint32_t mtu, struct sk_buff_head *tx_buf); #endif /* NET_L3_IPV4_IP_FRAGMENT_H */
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "CoreUObject.h" #include "Engine.h" #include "KismetCompiler.h" #include "SourceCodeNavigation.h" #include "DefaultValueHelper.h" // You should place include statements to your module's private header files here. You only need to // add includes for headers that are used in most of your module's source files though.
// Copyright (c) 2020 The Orbit 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 ORBIT_GL_TIME_GRAPH_LAYOUT_H_ #define ORBIT_GL_TIME_GRAPH_LAYOUT_H_ #include <math.h> #include <stdint.h> #include <algorithm> #include "OrbitBase/ThreadUtils.h" class TimeGraphLayout { public: TimeGraphLayout(); const float kMinScale = 0.333f; const float kMaxScale = 3.f; float GetTextBoxHeight() const { return text_box_height_ * scale_; } float GetTextCoresHeight() const { return core_height_ * scale_; } float GetThreadStateTrackHeight() const { return thread_state_track_height_ * scale_; } float GetEventTrackHeightFromTid(uint32_t tid = orbit_base::kInvalidThreadId) const; float GetVariableTrackHeight() const { return variable_track_height_ * scale_; } float GetTrackContentBottomMargin() const { return track_content_bottom_margin_ * scale_; } float GetTrackContentTopMargin() const { return track_content_top_margin_ * scale_; } float GetTrackLabelOffsetX() const { return track_label_offset_x_; } float GetSliderWidth() const { return slider_width_; } float GetTimeBarHeight() const { return time_bar_height_; } float GetTimeBarMargin() const { return time_bar_margin_; } float GetTrackTabWidth() const { return track_tab_width_; } float GetTrackTabHeight() const { return track_tab_height_ * scale_; } float GetTrackTabOffset() const { return track_tab_offset_; } float GetTrackIndentOffset() const { return track_indent_offset_; } float GetCollapseButtonSize(int indentation_level) const; float GetCollapseButtonOffset() const { return collapse_button_offset_; } float GetRoundingRadius() const { return rounding_radius_ * scale_; } float GetRoundingNumSides() const { return rounding_num_sides_; } float GetTextOffset() const { return text_offset_ * scale_; } float GetBottomMargin() const; float GetTracksTopMargin() const { return GetTimeBarHeight() + GetTimeBarMargin(); } float GetRightMargin() const { return right_margin_; } float GetSpaceBetweenTracks() const { return space_between_tracks_ * scale_; } float GetSpaceBetweenCores() const { return space_between_cores_ * scale_; } float GetSpaceBetweenGpuDepths() const { return space_between_gpu_depths_ * scale_; } float GetSpaceBetweenThreadPanes() const { return space_between_thread_panes_ * scale_; } float GetSpaceBetweenSubtracks() const { return space_between_subtracks_ * scale_; } float GetToolbarIconHeight() const { return toolbar_icon_height_; } float GetGenericFixedSpacerWidth() const { return generic_fixed_spacer_width_; } float GetScale() const { return scale_; } void SetScale(float value) { scale_ = std::clamp(value, kMinScale, kMaxScale); } void SetDrawProperties(bool value) { draw_properties_ = value; } bool DrawProperties(); bool GetDrawTrackBackground() const { return draw_track_background_; } uint32_t GetFontSize() const { return font_size_; } [[nodiscard]] uint32_t CalculateZoomedFontSize() const { return lround(GetFontSize() * GetScale()); } protected: float text_box_height_; float core_height_; float thread_state_track_height_; float event_track_height_; float all_threads_event_track_scale_; float variable_track_height_; float track_content_bottom_margin_; float track_content_top_margin_; float track_label_offset_x_; float slider_width_; float time_bar_height_; float time_bar_margin_; float track_tab_width_; float track_tab_height_; float track_tab_offset_; float track_indent_offset_; float collapse_button_offset_; float collapse_button_size_; float collapse_button_decrease_per_indentation_; float rounding_radius_; float rounding_num_sides_; float text_offset_; float right_margin_; uint32_t font_size_; float space_between_cores_; float space_between_gpu_depths_; float space_between_tracks_; float space_between_thread_panes_; float space_between_subtracks_; float generic_fixed_spacer_width_; float toolbar_icon_height_; float scale_; bool draw_properties_ = false; bool draw_track_background_ = true; private: float GetEventTrackHeight() const { return event_track_height_ * scale_; } float GetAllThreadsEventTrackScale() const { return all_threads_event_track_scale_; } }; #endif // ORBIT_GL_TIME_GRAPH_LAYOUT_H_
/*- * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@bluezbox.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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef __UTILS_H__ #define __UTILS_H__ const char *id2string(uint32_t); #endif /* __UTILS_H__ */
/* * Copyright (c) 2014 Ambroz Bizjak * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AMBROLIB_STATIC_ARRAY_H #define AMBROLIB_STATIC_ARRAY_H #include <stddef.h> #include <aprinter/meta/TypeSequence.h> #include <aprinter/meta/TypeSequenceMakeInt.h> #include <aprinter/base/ProgramMemory.h> #include <aprinter/BeginNamespace.h> template <typename ElemType, int Size> struct StaticArrayStruct { ElemType arr[Size]; }; template <typename, template<int> class, typename> struct StaticArrayHelper; template <typename ElemType, template<int> class ElemValue, typename... Indices> struct StaticArrayHelper<ElemType, ElemValue, TypeSequence<Indices...>> { static constexpr StaticArrayStruct<ElemType, sizeof...(Indices)> getHelperStruct() { return StaticArrayStruct<ElemType, sizeof...(Indices)>{{ElemValue<Indices::Value>::value()...}}; } }; template <typename ElemType, int Size, template<int> class ElemValue> class StaticArray { public: static size_t const Length = Size; static ElemType readAt (size_t index) { return ProgPtr<ElemType>::Make(data.arr)[index]; } private: static StaticArrayStruct<ElemType, Size> AMBRO_PROGMEM const data; }; template <typename ElemType, int Size, template<int> class ElemValue> StaticArrayStruct<ElemType, Size> AMBRO_PROGMEM const StaticArray<ElemType, Size, ElemValue>::data = StaticArrayHelper<ElemType, ElemValue, TypeSequenceMakeInt<Size>>::getHelperStruct(); #include <aprinter/EndNamespace.h> #endif
#ifndef AT_NOISE_PERLIN_H #define AT_NOISE_PERLIN_H #include "pstdint.h" struct at_perlin { unsigned char _state[256]; }; #ifdef __cplusplus extern "C" { #endif void at_perlin_seed(struct at_perlin *per, uint32_t (*f)(void *), void *v); double at_perlin_get_2d(struct at_perlin *per, double x, double y); double at_perlin_get_3d(struct at_perlin *per, double x, double y, double z); double at_perlin_get_4d( struct at_perlin *per, double x, double y, double z, double w); #ifdef __cplusplus } #endif #endif
/** * @file /Tzar/src/libc/stdio/setbuf.c * @author zanethorn * @version 1.0 * @date Feb 22, 2018 * * @section LICENSE * * BSD 2-clause License * * Copyright (c) 2018 Zane Thorn * * 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. * * @section DESCRIPTION * * TODO: Describe setbuf.c * */
/* @LICENSE(MUSLC_MIT) */ #include "stdio_impl.h" /* This function makes no attempt to protect the user from his/her own * stupidity. If called any time but when then ISO C standard specifically * allows it, all hell can and will break loose, especially with threads! * * This implementation ignores all arguments except the buffering type, * and uses the existing buffer allocated alongside the FILE object. * In the case of stderr where the preexisting buffer is length 1, it * is not possible to set line buffering or full buffering. */ int setvbuf(FILE *f, char *buf, int type, size_t size) { f->lbf = EOF; if (type == _IONBF) f->buf_size = 0; else if (type == _IOLBF) f->lbf = '\n'; f->flags |= F_SVB; return 0; }
/* ==== Author: Relja Arandjelovic (relja@robots.ox.ac.uk) Visual Geometry Group, Department of Engineering Science University of Oxford ==== Copyright: The library belongs to Relja Arandjelovic and the University of Oxford. No usage or redistribution is allowed without explicit permission. */ #ifndef _MEDIAN_COMPUTER_H_ #define _MEDIAN_COMPUTER_H_ #include <stdint.h> #include <vector> #include "macros.h" class medianComputer { public: medianComputer(); void add(float value); float getMedian(); private: void addQuantized(float value); std::vector<float> values_; std::vector<uint32_t> hist_; uint32_t totalNum_; float min_, max_; }; #endif
#pragma once #include <stdexcept> #include <sqlite3.h> // An exception in sqlite. struct SqliteError : std::runtime_error { SqliteError(int result) : std::runtime_error(sqlite3_errstr(result)) { } SqliteError(int result, const std::string &context) : std::runtime_error( sqlite3_errstr(result) + std::string(" (") + context + ")") { } SqliteError(const std::string &errMsg) : std::runtime_error(errMsg) { } SqliteError(const std::string &errMsg, const std::string &context) : std::runtime_error(errMsg + " (" + context + ")") { } };
/* * Copyright (C) 2010. sparkling.liang@hotmail.com, barbecue.jb@gmail.com. * All rights reserved. */ #ifndef __TIME_UTIL_H_ #define __TIME_UTIL_H_ #include "HP_Config.h" #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <sys/timeb.h> #else #include <sys/time.h> #endif namespace hpsl { class CTimeUtil { static bool m_bMonotonicTime; public: // check whether it's monotonic time static void DetectMonotonic(); static inline bool IsMonotonicTime() {return m_bMonotonicTime;} // time operations static inline void TimeClear(struct timeval *ptv) { ptv->tv_sec = ptv->tv_usec = 0; } static inline void TimeSet(struct timeval *ptv, int sec, int usec) { ptv->tv_sec = sec; ptv->tv_usec = usec; } static inline bool TimeGreater(const struct timeval *ptv1, const struct timeval *ptv2) { if(ptv1->tv_sec == ptv2->tv_sec) return (ptv1->tv_usec > ptv2->tv_usec); return (ptv1->tv_sec > ptv2->tv_sec); } static inline bool TimeLess(const struct timeval *ptv1, const struct timeval *ptv2) { if(ptv1->tv_sec == ptv2->tv_sec) return (ptv1->tv_usec < ptv2->tv_usec); return (ptv1->tv_sec < ptv2->tv_sec); } static inline bool TimeEuqal(const struct timeval *ptv1, const struct timeval *ptv2) { return ((ptv1->tv_sec==ptv2->tv_sec) && (ptv1->tv_usec==ptv2->tv_usec)); } static inline void TimeAdd(const struct timeval *ptv1, const struct timeval *ptv2, struct timeval *vvp) { vvp->tv_sec = ptv1->tv_sec + ptv2->tv_sec; vvp->tv_usec = ptv1->tv_usec + ptv2->tv_usec; if(vvp->tv_usec >= 1000000) { vvp->tv_sec++; vvp->tv_usec -= 1000000; } } static inline void TimeSub(const struct timeval *ptv1, const struct timeval *ptv2, struct timeval *vvp) { vvp->tv_sec = ptv1->tv_sec - ptv2->tv_sec; vvp->tv_usec = ptv1->tv_usec - ptv2->tv_usec; if(vvp->tv_usec < 0) { vvp->tv_sec--; vvp->tv_usec += 1000000; } } // get system time static int GetSysTime(struct timeval *ptv); }; } #endif // __TIME_UTIL_H_
#ifndef CVRP_INTRA_CROSS_EXCHANGE_H #define CVRP_INTRA_CROSS_EXCHANGE_H /* This file is part of VROOM. Copyright (c) 2015-2021, Julien Coupey. All rights reserved (see LICENSE). */ #include "algorithms/local_search/operator.h" namespace vroom { namespace cvrp { class IntraCrossExchange : public ls::Operator { private: bool _gain_upper_bound_computed; Gain _normal_s_gain; Gain _reversed_s_gain; Gain _normal_t_gain; Gain _reversed_t_gain; protected: bool reverse_s_edge; bool reverse_t_edge; const bool check_s_reverse; const bool check_t_reverse; bool s_normal_t_normal_is_valid; bool s_normal_t_reverse_is_valid; bool s_reverse_t_reverse_is_valid; bool s_reverse_t_normal_is_valid; std::vector<Index> _moved_jobs; const Index _first_rank; const Index _last_rank; virtual void compute_gain() override; public: IntraCrossExchange(const Input& input, const utils::SolutionState& sol_state, RawRoute& s_route, Index s_vehicle, Index s_rank, Index t_rank, bool check_s_reverse, bool check_t_reverse); // Compute and store all possible cost depending on whether edges // are reversed or not. Return only an upper bound for gain as // precise gain requires validity information. Gain gain_upper_bound(); virtual bool is_valid() override; virtual void apply() override; virtual std::vector<Index> addition_candidates() const override; virtual std::vector<Index> update_candidates() const override; }; } // namespace cvrp } // namespace vroom #endif
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" //#include <stdio.h> //#include <tchar.h> // TODO: reference additional headers your program requires here
#pragma once #include <gtkmm/drawingarea.h> #include "litehtml/containers/linux/container_linux.h" #include "http_loader.h" class browser_window; class html_widget : public Gtk::DrawingArea, public container_linux { litehtml::tstring m_url; litehtml::tstring m_base_url; litehtml::document::ptr m_html; litehtml::context* m_html_context; int m_rendered_width; litehtml::tstring m_cursor; litehtml::tstring m_clicked_url; browser_window* m_browser; http_loader m_http; public: html_widget(litehtml::context* html_context, browser_window* browser); virtual ~html_widget(); void open_page(const litehtml::tstring& url); void update_cursor(); protected: virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); virtual void get_client_rect(litehtml::position& client) const override; virtual void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el) override; virtual void set_cursor(const litehtml::tchar_t* cursor) override; virtual void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl) override; virtual void set_caption(const litehtml::tchar_t* caption) override; virtual void set_base_url(const litehtml::tchar_t* base_url) override; virtual Glib::RefPtr<Gdk::Pixbuf> get_image(const litehtml::tchar_t* url, bool redraw_on_ready); virtual void make_url( const litehtml::tchar_t* url, const litehtml::tchar_t* basepath, litehtml::tstring& out ); virtual void get_preferred_width_vfunc(int& minimum_width, int& natural_width) const; virtual void get_preferred_height_vfunc(int& minimum_height, int& natural_height) const; virtual void on_size_allocate(Gtk::Allocation& allocation); virtual bool on_button_press_event(GdkEventButton* event); virtual bool on_button_release_event(GdkEventButton* event); virtual bool on_motion_notify_event(GdkEventMotion* event); private: void load_text_file(const litehtml::tstring& url, litehtml::tstring& out); };
#import "FDNullOrEmpty.h" #pragma mark Enumerations typedef NS_ENUM(NSInteger, FDKeychainAccessibility) { FDKeychainAccessibleWhenUnlocked, FDKeychainAccessibleAfterFirstUnlock, }; #pragma mark - Class Interface @interface FDKeychain : NSObject #pragma mark - Static Methods + (NSData *)rawDataForKey: (NSString *)key forService: (NSString *)service inAccessGroup: (NSString *)accessGroup error: (NSError **)error; + (NSData *)rawDataForKey: (NSString *)key forService: (NSString *)service error: (NSError **)error; + (id)itemForKey: (NSString *)key forService: (NSString *)service inAccessGroup: (NSString *)accessGroup error: (NSError **)error; + (id)itemForKey: (NSString *)key forService: (NSString *)service error: (NSError **)error; + (void)saveItem: (id<NSCoding>)item forKey: (NSString *)key forService: (NSString *)service inAccessGroup: (NSString *)accessGroup withAccessibility: (FDKeychainAccessibility)accessibility error: (NSError **)error; + (void)saveItem: (id<NSCoding>)item forKey: (NSString *)key forService: (NSString *)service error: (NSError **)error; + (void)deleteItemForKey: (NSString *)key forService: (NSString *)service inAccessGroup: (NSString *)accessGroup error: (NSError **)error; + (void)deleteItemForKey: (NSString *)key forService: (NSString *)service error: (NSError **)error; @end
/**************************************************************************** **This file is part of the Motorcar 3D windowing framework ** ** **Copyright (C) 2014 Forrest Reiling ** ** ** You may use this file under the terms of the BSD license as follows: ** ** "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 ** 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 GLCAMERANODE_H #define GLCAMERANODE_H #include <geometry.h> #include <gl/viewport.h> #include <scenegraph/virtualnode.h> struct wl_global; #include <wayland-server.h> #include <wayland-server-protocol.h> #include <motorcar-server-protocol.h> namespace motorcar { class Display; class ViewPoint : public VirtualNode { public: //centerOfProjection: center of projection in camera space, applied as a translation to the projection matrix ViewPoint(float near, float far, Display *display, SceneGraphNode *parent, glm::mat4 transform = glm::mat4(), glm::vec4 viewPortParams = glm::vec4(0,0,1,1), glm::vec3 centerOfProjection = glm::vec3(0)); ~ViewPoint(); void updateViewMatrix(); void updateProjectionMatrix(); glm::mat4 viewMatrix() const; glm::mat4 projectionMatrix() const; //returns camera vertical field of view in degrees float fov(Display *display); Geometry::Ray worldRayAtDisplayPosition(float pixelX, float pixelY); ViewPort *viewport() const; void setViewport(ViewPort *viewport); glm::vec4 centerOfFocus() const; motorcar_viewpoint *viewpointHandle() const; void setViewpointHandle(motorcar_viewpoint *viewpointHandle); void sendViewMatrixToClients(); void sendProjectionMatrixToClients(); void sendViewPortToClients(); void sendCurrentStateToSingleClient(wl_resource *resource); wl_global *global() const; void setGlobal(wl_global *global); ViewPort *clientColorViewport() const; void setClientColorViewport(ViewPort *clientColorViewport); ViewPort *clientDepthViewport() const; void setClientDepthViewport(ViewPort *clientDepthViewport); Display *display() const; Geometry::Rectangle *bufferGeometry() const; void setBufferGeometry(Geometry::Rectangle *bufferGeometry); private: Display *m_display; float near, far; ViewPort *m_viewport; ViewPort *m_clientColorViewport; ViewPort *m_clientDepthViewport; //center of projection information glm::vec4 m_centerOfFocus; glm::mat4 m_COFTransform; Geometry::Rectangle *m_bufferGeometry; //cached matrices glm::mat4 m_viewMatrix, m_projectionMatrix, m_viewProjectionMatrix; struct motorcar_viewpoint *m_viewpointHandle; struct wl_global *m_global; std::vector<struct wl_resource*> m_resources; static void destroy_func(struct wl_resource *resource); static void bind_func(struct wl_client *client, void *data, uint32_t version, uint32_t id); struct wl_array m_viewArray, m_projectionArray; }; } #endif // GLCAMERANODE_H
/* Copyright (c) 2015-2016 Kamil Rytarowski 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 <assert.h> #include <stddef.h> #include <stdlib.h> #include <gtk/gtk.h> #include "window.h" struct bwindow_gtk { int argc; char **argv; GtkWidget *window; GtkWidget *textview; GThread *gui_thread; }; static int create(void *opaque) { assert(opaque); return 0; } static void on_destroy(GtkWidget *widget, gpointer data) { gtk_main_quit(); } static gpointer gtk_gui_main(gpointer data) { struct bwindow_gtk *this = (struct bwindow_gtk*)data; assert(this); assert(this->argc > 0); assert(this->argv); assert(this->argv[0]); gtk_init(&this->argc, &this->argv); /* create a new window */ this->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(GTK_WIDGET(this->window), "destroy", G_CALLBACK(on_destroy), NULL); this->textview = gtk_text_view_new(); gtk_widget_show(this->window); gtk_widget_show(this->textview); gtk_main(); } static int init(void *opaque, int argc, char **argv) { struct bwindow_gtk *this = (struct bwindow_gtk*)opaque; assert(this); assert(argc > 0); assert(argv); assert(argv[0]); this->argc = argc; this->argv = argv; this->gui_thread = g_thread_new("GUI", gtk_gui_main, this); return 0; } static int get_size(void *this, size_t *x, size_t *y) { assert(this); assert(x); assert(y); *x = 0; *y = 0; return 0; } static int deinit(void *opaque) { assert(opaque); return 0; } static void destroy(void *opaque) { assert(opaque); } int bwindow_gtk_register(struct bwindow *wnd) { assert(wnd); wnd->priv = malloc(sizeof(struct bwindow_gtk)); if (wnd->priv == NULL) { return -1; } wnd->create = create; wnd->init = init; wnd->get_size = get_size; wnd->deinit = deinit; wnd->destroy = destroy; return 0; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @class NSMutableArray, NSString, NSTask; @interface XCSSHAgent : NSObject { NSString *sshAgentSocket; NSTask *sshAgentTask; NSMutableArray *validIdentities; NSMutableArray *_identities; } + (id)sharedInstance; - (BOOL)_startSSHAgent; - (void)addValidIdentity:(id)arg1; - (void)checkIdentities; - (void)dealloc; - (id)identities; - (id)init; - (BOOL)isRunning; - (void)loadIdentities; - (id)readFileHandle:(id)arg1 untilString:(id)arg2 timeout:(long long)arg3; - (void)setSocket:(id)arg1; - (id)setupEnvironment; - (id)socket; - (BOOL)start; - (BOOL)submitPassphrase:(id)arg1; - (BOOL)submitPassphrase:(id)arg1 forIdentity:(id)arg2; - (id)validIdentities; - (BOOL)validPassphrase; - (BOOL)validSSHAgent; - (BOOL)validSocket; - (BOOL)validSocket:(id)arg1; - (BOOL)verifySSHAgentAddResponse:(id)arg1; - (BOOL)verifyStateFile:(id)arg1; @end
#pragma once #include "TArc/Controls/ControlProxy.h" #include <QWidget> namespace DAVA { class EmptyWidget : public ControlProxyImpl<QWidget> { using TBase = ControlProxyImpl<QWidget>; public: enum class Fields : uint32 { FieldCount }; DECLARE_CONTROL_PARAMS(Fields); EmptyWidget(const Params& params, DataWrappersProcessor* wrappersProcessor, Reflection model, QWidget* parent = nullptr); EmptyWidget(const Params& params, ContextAccessor* accessor, Reflection model, QWidget* parent = nullptr); protected: void UpdateControl(const ControlDescriptor& descriptor) override; void mousePressEvent(QMouseEvent* e) override; void mouseReleaseEvent(QMouseEvent* e) override; void mouseMoveEvent(QMouseEvent* e) override; }; } // namespace DAVA
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22b.c Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-22b.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: file Read input from a file * GoodSource: Copy a fixed string into data * Sinks: swprintf * GoodSink: snwprintf with "%s" as the third argument and data as the fourth * BadSink : snwprintf with data as the third argument * Flow Variant: 22 Control flow: Flow controlled by value of a global variable. Sink functions are in a separate file from sources. * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define SNPRINTF _snwprintf #else #define SNPRINTF swprintf #endif #ifndef OMITBAD /* The global variable below is used to drive control flow in the sink function */ extern int CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_badGlobal; void CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_badSink(wchar_t * data) { if(CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_badGlobal) { { wchar_t dest[100] = L""; /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ SNPRINTF(dest, 100-1, data); printWLine(dest); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* The global variables below are used to drive control flow in the sink functions. */ extern int CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G1Global; extern int CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G2Global; extern int CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodG2BGlobal; /* goodB2G1() - use badsource and goodsink by setting the static variable to false instead of true */ void CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G1Sink(wchar_t * data) { if(CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G1Global) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { wchar_t dest[100] = L""; /* FIX: Specify the format disallowing a format string vulnerability */ SNPRINTF(dest, 100-1, L"%s", data); printWLine(dest); } } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ void CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G2Sink(wchar_t * data) { if(CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodB2G2Global) { { wchar_t dest[100] = L""; /* FIX: Specify the format disallowing a format string vulnerability */ SNPRINTF(dest, 100-1, L"%s", data); printWLine(dest); } } } /* goodG2B() - use goodsource and badsink */ void CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodG2BSink(wchar_t * data) { if(CWE134_Uncontrolled_Format_String__wchar_t_file_snprintf_22_goodG2BGlobal) { { wchar_t dest[100] = L""; /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ SNPRINTF(dest, 100-1, data); printWLine(dest); } } } #endif /* OMITGOOD */
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SIMPLEARRAY_H #define SIMPLEARRAY_H #include "config.h" #include <algorithm> /** * Simple array template that creates a T * array * */ template <typename T> class SimpleArray { public: typedef unsigned int size_type; typedef T* iterator; typedef const T* const_iterator; SimpleArray(): m_data( 0 ), m_size( 0 ) { } /** * Creates an array with specified size */ explicit SimpleArray( size_type size ):m_data(0), m_size(0) { allocate( size ); } SimpleArray( const SimpleArray<T>& copyMe ):m_data(0), m_size(0) { copy( copyMe ); } virtual ~SimpleArray() { delete [] m_data; } SimpleArray<T>& operator = ( const SimpleArray<T>& rhs ) { copy( rhs ); } void copy( const SimpleArray<T>& copyMe ) { if ( this == &copyMe ) return; allocate( copyMe.size() ); for (size_type i = 0; i < size(); ++i ) { m_data[ i ] = copyMe.m_data[ i ]; } } /// allocates array with specified size, will not copy old data void allocate( size_type size ) { delete [] m_data; m_data = new T[size]; m_size = size; } void swap( SimpleArray<T>& other ) { std::swap( other.m_data, m_data ); std::swap( other.m_size, m_size ); } /// @return start of array const_iterator begin() const { return data(); } /// @return start of array iterator begin() { return data(); } /// @return end of array, out side buffer const_iterator end() const { return data() + size(); } /// @return end of array, out side buffer iterator end() { return data() + size(); } /// @return size of array size_type size() const { return m_size; } /// @return item in array at position index T& operator []( size_type index ) { return m_data[index]; } /// @return item in array at position index const T& operator [] ( size_type index ) const { return m_data[index]; } T& get( size_type index ) { return m_data[ index ]; } const T& get( size_type index ) const { return m_data[ index ]; } /// @return pointer to array T* data() { return m_data; } /// @return pointer to array const T* data() const { return m_data; } /** * Release data pointer * Internal data will be cleared. * @return pointer to data */ T* release() { T* returnData = m_data; m_data = NULL; m_size = 0; return returnData; } private: T* m_data; size_type m_size; }; #endif
/* * 2007 – 2013 Copyright Northwestern University * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details. */ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #ifndef AIMLIBTEST_STDAFX_H_INCLUDED #define AIMLIBTEST_STDAFX_H_INCLUDED #if !defined( __GNUC__ ) #include <tchar.h> #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #endif // __GNUC__ #include <stdio.h> #endif // AIMLIBTEST_STDAFX_H_INCLUDED
// 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 CHROME_BROWSER_AUTOFILL_WALLET_WALLET_TEST_UTIL_H_ #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_TEST_UTIL_H_ #include "base/memory/scoped_ptr.h" namespace autofill { namespace wallet { class Instrument; class Address; scoped_ptr<Instrument> GetTestInstrument(); scoped_ptr<Address> GetTestShippingAddress(); scoped_ptr<Address> GetTestAddress(); } // namespace wallet } // namespace autofill #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_TEST_UTIL_H_
#pragma once #include <AglVector3.h> #include <AglVector4.h> #include <AglMatrix.h> #include <AglParticleSystemHeader.h> #include "RendererSceneInfo.h" // ======================================================================================= // ParticleCBuffer // ======================================================================================= ///--------------------------------------------------------------------------------------- /// \brief Stores all the values used by the particle constant buffer. /// /// # ParticleCBuffer /// Detailed description..... /// Created on: 16-1-2013 ///--------------------------------------------------------------------------------------- struct ParticleCBuffer { float worldMat[16]; float color[4]; float uvRect[4]; //float variousFloats[4]; //Containing fadeIn, fadeOut, particleMaxAge, maxOpacity float fadeIn; float fadeOut; float particleMaxAge; float maxOpacity; int alignment; int spawnSpace; int particleSpace; float pad; //padding void setWorldMat( const float p_worldMat[16] ) { memcpy( worldMat, p_worldMat, sizeof(float)*16 ); } void setParticleData(const AglParticleSystemHeader& p_header, const float p_worldMat[16] ) { setWorldMat( p_worldMat ); setRect(AglVector4(0.0f,0.0f,1.0f,1.0f)); setColor( p_header.color ); setFadeIn( p_header.fadeInStop ); setFadeOut( p_header.fadeOutStart ); setParticleMaxAge( p_header.particleAge ); setMaxOpacity( p_header.maxOpacity ); setAlignment( p_header.alignmentType ); setSpawnSpace( p_header.spawnSpace ); setParticleSpace( p_header.particleSpace ); } void setRect(const AglVector4& p_normalizedRect){ uvRect[0] = p_normalizedRect[0]; uvRect[1] = p_normalizedRect[1]; uvRect[2] = p_normalizedRect[2]; uvRect[3] = p_normalizedRect[3]; } void setColor(const AglVector4& p_color){ color[0] = p_color[0]; color[1] = p_color[1]; color[2] = p_color[2]; color[3] = p_color[3]; } void setFadeIn(const float& p_fadeIn){ fadeIn = p_fadeIn; } void setFadeOut(const float& p_fadeOut){ fadeOut = p_fadeOut; } void setParticleMaxAge(const float& p_maxAge){ particleMaxAge = p_maxAge; } void setMaxOpacity(const float& p_maxOpacity){ maxOpacity = p_maxOpacity; } void setAlignment(const int& p_alignment) { if (p_alignment == AglParticleSystemHeader::OBSERVER) alignment = 0; else if (p_alignment == AglParticleSystemHeader::SCREEN) alignment = 1; else if (p_alignment == AglParticleSystemHeader::WORLD) alignment = 2; else alignment = 3; } void setSpawnSpace( int p_relative ) { spawnSpace = p_relative; } void setParticleSpace( int p_space ) { particleSpace = p_space; } };
/*========================================================================= Program: Visualization Toolkit Module: vtkOpenGLImageAlgorithmHelper.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 vtkOpenGLImageAlgorithmHelper - Help image algorithms use the GPU // .SECTION Description // Designed to make it easier to accelerate an image algorithm on the GPU #ifndef vtkOpenGLImageAlgorithmHelper_h #define vtkOpenGLImageAlgorithmHelper_h #include "vtkRenderingOpenGL2Module.h" // For export macro #include "vtkObject.h" #include "vtkOpenGLHelper.h" // used for ivars #include "vtkSmartPointer.h" // for ivar class vtkOpenGLRenderWindow; class vtkRenderWindow; class vtkImageData; class vtkDataArray; class vtkOpenGLImageAlgorithmCallback { public: virtual void InitializeShaderUniforms(vtkShaderProgram * /* program */) {}; virtual void UpdateShaderUniforms( vtkShaderProgram * /* program */, int /* zExtent */) {}; virtual ~vtkOpenGLImageAlgorithmCallback() {}; vtkOpenGLImageAlgorithmCallback() {}; private: vtkOpenGLImageAlgorithmCallback(const vtkOpenGLImageAlgorithmCallback&) VTK_DELETE_FUNCTION; void operator=(const vtkOpenGLImageAlgorithmCallback&) VTK_DELETE_FUNCTION; }; class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLImageAlgorithmHelper : public vtkObject { public: static vtkOpenGLImageAlgorithmHelper *New(); vtkTypeMacro(vtkOpenGLImageAlgorithmHelper,vtkObject); void PrintSelf(ostream& os, vtkIndent indent); void Execute( vtkOpenGLImageAlgorithmCallback *cb, vtkImageData *inImage, vtkDataArray *inData, vtkImageData *outData, int outExt[6], const char *vertexCode, const char *fragmentCode, const char *geometryCode ); // Description: // Set the render window to get the OpenGL resources from void SetRenderWindow(vtkRenderWindow *renWin); protected: vtkOpenGLImageAlgorithmHelper(); virtual ~vtkOpenGLImageAlgorithmHelper(); vtkSmartPointer<vtkOpenGLRenderWindow> RenderWindow; vtkOpenGLHelper Quad; private: vtkOpenGLImageAlgorithmHelper(const vtkOpenGLImageAlgorithmHelper&) VTK_DELETE_FUNCTION; void operator=(const vtkOpenGLImageAlgorithmHelper&) VTK_DELETE_FUNCTION; }; #endif // VTK-HeaderTest-Exclude: vtkOpenGLImageAlgorithmHelper.h
/** * @file * * @brief * * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ #include <kdbplugin.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #define BACKENDNAME "timeofday" #define BACKENDVERSION "0.0.1" struct _TimeofdayInfo { struct timeval start; struct timeval last; int nrget; int nrset; int nrerr; }; typedef struct _TimeofdayInfo TimeofdayInfo; int elektraTimeofdayOpen (Plugin * handle, Key *); int elektraTimeofdayClose (Plugin * handle, Key *); int elektraTimeofdayGet (Plugin * handle, KeySet * ks, Key * parentKey); int elektraTimeofdaySet (Plugin * handle, KeySet * ks, Key * parentKey); int elektraTimeofdayError (Plugin * handle, KeySet * ks, Key * parentKey); Plugin * ELEKTRA_PLUGIN_EXPORT (timeofday);
/* Erica Sadun, http://ericasadun.com https://github.com/erica/iOS-Drawing/tree/master/C08/Quartz%20Book%20Pack/Bezier */ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #define ABI38_0_0RNSVGNULLPOINT CGRectNull.origin @interface ABI38_0_0RNSVGBezierElement : NSObject // Element storage @property (nonatomic, assign) CGPathElementType elementType; @property (nonatomic, assign) CGPoint point; @property (nonatomic, assign) CGPoint controlPoint1; @property (nonatomic, assign) CGPoint controlPoint2; // Instance creation + (instancetype) elementWithPathElement: (CGPathElement) element; + (NSArray *) elementsFromCGPath:(CGPathRef)path; @end
/**************************************************************************************** Copyright (C) 2015 Autodesk, Inc. All rights reserved. Use of this software is subject to the terms of the Autodesk license agreement provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. ****************************************************************************************/ //! \file fbxperipheral.h #ifndef _FBXSDK_CORE_PERIPHERAL_H_ #define _FBXSDK_CORE_PERIPHERAL_H_ #include <fbxsdk/fbxsdk_def.h> #include <fbxsdk/fbxsdk_nsbegin.h> class FbxObject; /** FbxPeripheral is an interface to load/unload content of FbxObject from memory to somewhere you defined, for example, to a temporary file on disk . * \nosubgrouping * You need to inherited your own peripheral class from this class and overload * the functions to control what information of a FbxObject you want to load/unload, * and where you are going to load/unload these information to. * For example, you can ask an object to dump itself on disk to free some memory and vice-versa * when you want to load/unload this object from your scene flexibly. */ class FBXSDK_DLL FbxPeripheral { public: /** * \name Constructor and Destructor */ //@{ //!Constructor. FbxPeripheral(); //!Destructor. virtual ~FbxPeripheral(); //@} /** Reset the peripheral to its initial state. */ virtual void Reset() = 0; /** Unload the content of pObject. * \param pObject Object whose content is to be offloaded into * the peripheral storage area. * \return \c true if the object content has been successfully transferred. * \c false otherwise. */ virtual bool UnloadContentOf(FbxObject* pObject) = 0; /** Load the content of pObject. * \param pObject Object whose content is to be loaded from * the peripheral storage area. * \return \c true if the object content has been successfully transferred. * \c false otherwise. */ virtual bool LoadContentOf(FbxObject* pObject) = 0; /** Check if this peripheral can unload the given object content. * \param pObject Object whose content has to be transferred. * \return \c true if the peripheral can handle this object content and * has enough space in its storage area.\c false otherwise. */ virtual bool CanUnloadContentOf(FbxObject* pObject) = 0; /** Check if this peripheral can load the given object content. * \param pObject Object whose content has to be transferred. * \return \c true if the peripheral can handle this object content. * \c false otherwise. */ virtual bool CanLoadContentOf(FbxObject* pObject) = 0; /** Initialize the connections of an object * \param pObject Object on which the request for connection is done. */ virtual void InitializeConnectionsOf(FbxObject* pObject) = 0; /** Uninitialize the connections of an object * \param pObject Object on which the request for disconnection is done. */ virtual void UninitializeConnectionsOf(FbxObject* pObject) = 0; }; // predefined offload peripherals extern FBXSDK_DLL FbxPeripheral* NULL_PERIPHERAL; extern FBXSDK_DLL FbxPeripheral* TMPFILE_PERIPHERAL; #include <fbxsdk/fbxsdk_nsend.h> #endif /* _FBXSDK_CORE_PERIPHERAL_H_ */
/*------------------------------------------------------------------------------ * * Copyright (c) 2011, EURid. All rights reserved. * The YADIFA TM software product is provided under the BSD 3-clause license: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of EURid 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. * *------------------------------------------------------------------------------ * * DOCUMENTATION */ /** @defgroup streaming Streams * @ingroup dnscore * @brief * * * * @{ * *----------------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include "dnscore/bytearray_output_stream.h" #define BYTE_ARRAY_OUTPUT_STREAM_TAG 0x534f4142 /* BAOS */ #define BYTE_ARRAY_OUTPUT_STREAM_DATA_TAG 0x41544144534f4142 /* BAOSDATA */ #define BYTE_ARRAY_OUTPUT_STREAM_BUFF_TAG 0x46465542534f4142 /* BAOSBUFF */ typedef struct bytearray_output_stream_data bytearray_output_stream_data; #define BYTEARRAY_STARTSIZE 1024 /* flags */ struct bytearray_output_stream_data { u8* buffer; u32 buffer_size; u32 buffer_offset; u8 flags; }; static ya_result bytearray_write(output_stream* stream, const u8* buffer, u32 len) { if(len == 0) { return 0; } bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; u8* src = data->buffer; ya_result ret; u32 remaining = data->buffer_size - data->buffer_offset; if(len > remaining) { /* Either we can resize, either we have to trunk */ if((data->flags & BYTEARRAY_DYNAMIC) != 0) { u8* newbuffer; u32 newsize = data->buffer_size; do { newsize = newsize * 2; } while(newsize < data->buffer_size + len); MALLOC_OR_DIE(u8*, newbuffer, newsize, BYTE_ARRAY_OUTPUT_STREAM_TAG); MEMCOPY(newbuffer, data->buffer, data->buffer_offset); if((data->flags & BYTEARRAY_OWNED) != 0) { free(data->buffer); } data->buffer = newbuffer; data->buffer_size = newsize; data->flags |= BYTEARRAY_OWNED; } else { len = remaining; } } MEMCOPY(&data->buffer[data->buffer_offset], buffer, len); data->buffer_offset += len; return len; } static ya_result bytearray_flush(output_stream* stream) { return SUCCESS; } static void bytearray_close(output_stream* stream) { bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; if((data->flags & BYTEARRAY_OWNED) != 0) { free(data->buffer); } free(data); output_stream_set_void(stream); } static output_stream_vtbl bytearray_output_stream_vtbl = { bytearray_write, bytearray_flush, bytearray_close, "bytearray_output_stream", }; void bytearray_output_stream_init_ex(u8* array, u32 size, output_stream* out_stream, u8 flags) { bytearray_output_stream_data* data; MALLOC_OR_DIE(bytearray_output_stream_data*, data, sizeof (bytearray_output_stream_data), BYTE_ARRAY_OUTPUT_STREAM_DATA_TAG); if(array == NULL) { flags |= BYTEARRAY_OWNED; if(size == 0) { flags |= BYTEARRAY_DYNAMIC; size = BYTEARRAY_STARTSIZE; } MALLOC_OR_DIE(u8*, array, size, BYTE_ARRAY_OUTPUT_STREAM_BUFF_TAG); } data->buffer = array; data->buffer_size = size; data->buffer_offset = 0; data->flags = flags; out_stream->data = data; out_stream->vtbl = &bytearray_output_stream_vtbl; } void bytearray_output_stream_init(u8* array, u32 size, output_stream* out_stream) { bytearray_output_stream_init_ex(array, size, out_stream, 0); } void bytearray_output_stream_reset(output_stream* stream) { bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; data->buffer_offset = 0; } u32 bytearray_output_stream_size(output_stream* stream) { bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; return data->buffer_offset; } u8* bytearray_output_stream_buffer(output_stream* stream) { bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; return data->buffer; } u8* bytearray_output_stream_detach(output_stream* stream) { bytearray_output_stream_data* data = (bytearray_output_stream_data*)stream->data; data->flags &= ~BYTEARRAY_OWNED; return data->buffer; } /** @} */ /*----------------------------------------------------------------------------*/
#ifndef GTRN_TRACKER_H #define GTRN_TRACKER_H #include <opencv/cv.h> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include "mtf/ThirdParty/GOTURN/helper/bounding_box.h" #include "mtf/ThirdParty/GOTURN/train/example_generator.h" #include "mtf/ThirdParty/GOTURN/network/regressor.h" class GoturnTracker { public: GoturnTracker(const bool show_tracking); // Estimate the location of the target object in the current image. virtual void Track(const cv::Mat& image_curr, RegressorBase* regressor, BoundingBox* bbox_estimate_uncentered); // Initialize the tracker with the ground-truth bounding box of the first frame. void Init(const cv::Mat& image_curr, const BoundingBox& bbox_gt, RegressorBase* regressor); // Initialize the tracker with the ground-truth bounding box of the first frame. // VOTRegion is an object for initializing the tracker when using the VOT Tracking dataset. void Init(const std::string& image_curr_path, const VOTRegion& region, RegressorBase* regressor); private: // Show the tracking output, for debugging. void ShowTracking(const cv::Mat& target_pad, const cv::Mat& curr_search_region, const BoundingBox& bbox_estimate) const; // Predicted prior location of the target object in the current image. // This should be a tight (high-confidence) prior prediction area. We will // add padding to this region. BoundingBox bbox_curr_prior_tight_; // Estimated previous location of the target object. BoundingBox bbox_prev_tight_; // Full previous image. cv::Mat image_prev_; // Whether to visualize the tracking results bool show_tracking_; }; #endif // TRACKER_H
/*============================================================================ 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 __I_DATA_STORAGE_INSPECTOR_PROVIDER_H #define __I_DATA_STORAGE_INSPECTOR_PROVIDER_H #include <mitkServiceInterface.h> #include <MitkQtWidgetsExports.h> class QmitkAbstractDataStorageInspector; namespace mitk { /** * \ingroup MicroServices_Interfaces * * \brief The common interface for all DataStorage inspector providers. * * Implementations of this interface must be registered as a service * to make themselves available via the service registry. * * It is recommended to derive new implementations from QmitkDataStorageInspectorProviderBase * which provide correct service registration semantics. * * \sa QmitkDataStorageInspectorProviderBase */ struct MITKQTWIDGETS_EXPORT IDataStorageInspectorProvider { virtual ~IDataStorageInspectorProvider(); /** * \brief returns an inspector instance represented by the provider. */ virtual QmitkAbstractDataStorageInspector* CreateInspector() const = 0; /** Return the uniqe ID for the inspector type provided.*/ virtual std::string GetInspectorID() const = 0; /** Return the display name (e.g. used in the UI) for the inspector type provided.*/ virtual std::string GetInspectorDisplayName() const = 0; /** Returns a description of the inspector type provided.*/ virtual std::string GetInspectorDescription() const = 0; /** * @brief Service property name for the inspector ID. * * The property value must be of type \c std::string. * * @return The property name. */ static std::string PROP_INSPECTOR_ID(); }; } // namespace mitk MITK_DECLARE_SERVICE_INTERFACE(mitk::IDataStorageInspectorProvider, "org.mitk.IDataStorageInspectorProvider") #endif /* __I_DATA_STORAGE_INSPECTOR_PROVIDER_H */
#ifndef BALL_H #define BALL_H #include "cvec.h" #include <iostream> class Ball { Cvec3 accel; //accel Cvec3 pos; //current position Cvec3 prevPos; //old position Cvec3 normal; // normal bool canMove; public: Ball() {} Ball(Cvec3 pos) : accel(Cvec3()), pos(pos), prevPos(pos), normal(Cvec3()), canMove(true) {} void resetAccel() { accel = Cvec3(); } void setAccel(Cvec3 a) { accel = a; } void resetNormal() { normal = Cvec3(); } void setNormal(Cvec3 n) { normal = n; } void addNormal (Cvec3 n) { normal += n.normalize(); } Cvec3& getNormal() { return normal; } void newForce(Cvec3 force) { accel += force; } void minusForce(Cvec3 force) { accel -= force; } Cvec3& getPos() { return pos; } void movePos(const Cvec3 v) { if(canMove) pos += v; } void setPos(const Cvec3 v) { pos = v; } void fixMovement() { canMove = false; } void unfixMovement() { canMove = true; } void timeStep() { if(canMove) { Cvec3 tmp = pos; //account for air resistance in calculating distance moved pos = accel * 0.25 + pos + (pos - prevPos) * 0.9; prevPos = tmp; resetAccel(); } } }; #endif //ball_h
#ifndef SPECIES_H #define SPECIES_H #include <string> #include <cmath> #include "poly.h" #include "ffm_settings.h" /*!\brief The Species class holds and manipulates data representing individual plant species. */ class Species{ public: /*!\brief Categorises leaf type*/ enum LeafFormType {ROUND_LEAF, FLAT_LEAF}; // constructors Species(); Species ( const double& composition, const std::string& name, const Poly& crown, const double& liveLeafMoisture, const double& deadLeafMoisture, const double& proportionDead, const double& silicaFreeAshContent, const double& ignitionTemperature, const LeafFormType& leafForm, const double& leafThickness, const double& leafWidth, const double& leafLength, const double& leafSeparation, const double& stemOrder, const double& clumpDiameter, const double& clumpSeparation ); Species ( const double& composition, const std::string& name, const double& hc, const double& he, const double& ht, const double& hp, const double& width, const double& liveLeafMoisture, const double& deadLeafMoisture, const double& propDead, const double& silFreeAshCont, const double& ignitTemp, const LeafFormType& leafForm, const double& leafThick, const double& leafWidth, const double& leafLength, const double& leafSep, const double& stemOrder, const double& clumpDiam, const double& clumpSep ); //accessors bool isValid() const; double composition() const; std::string name() const; Poly crown() const; double liveLeafMoisture() const; double deadLeafMoisture() const; double propDead() const; double silFreeAshCont() const; double ignitTemp() const; LeafFormType leafForm() const; double leafThick() const; double leafWidth() const; double leafLength() const; double leafSep() const; double stemOrder() const; double clumpDiam() const; double clumpSep() const; //mutators void composition(const double& composition); // other methods double width() const; double leafMoisture() const; double ignitionTemp(bool modelIt = false) const; double ignitionDelayTime(const double& temperature) const; double flameDuration() const; bool isGrass() const; double leafFlameLength() const; double flameLength(const double& lengthIgnited) const; double leafAreaIndex() const; std::string printToString() const; std::string printComposition() const; std::string printLiveLeafMoisture() const; std::string printDeadLeafMoisture() const; std::string printPropDead() const; std::string printSilFreeAshCont() const; std::string printIgnitTemp() const; std::string printIgnitionTemp() const; //prints the result of ignitionTemp() std::string printLeafForm() const; std::string printLeafThick() const; std::string printLeafWidth() const; std::string printLeafLength() const; std::string printLeafSep() const; std::string printStemOrder() const; std::string printClumpSep() const; std::string printClumpDiam() const; std::string printCrown() const; double leavesPerClump() const; bool operator==(const Species&) const; bool sameSpecies(const Species&) const; private: bool isValid_ = false; double composition_ = 0; std::string name_ = std::string(); Poly crown_ = Poly();; double liveLeafMoisture_ = -99; // proportion of oven dried weight, no percentages double deadLeafMoisture_ = -99; // proportion of oven dried weight, no percentages double propDead_ = -99; //proportion, no percentages double silFreeAshCont_ = -99; // proportion, no percentages double ignitTemp_ = -99; LeafFormType leafForm_ = ROUND_LEAF; double leafThick_ = -99; double leafWidth_ = -99; double leafLength_ = -99; double leafSep_ = -99; double stemOrder_ = -99; double clumpSep_ = -99; double clumpDiam_ = -99; }; #include "species_inline.h" #endif
// Copyright (c) 2012 The Chromium Embedded Framework 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 CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_ #define CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_ #pragma once #include "include/cef_command_line.h" #include "libcef/common/value_base.h" #include "base/command_line.h" // CefCommandLine implementation class CefCommandLineImpl : public CefValueBase<CefCommandLine, CommandLine> { public: CefCommandLineImpl(CommandLine* value, bool will_delete, bool read_only); // CefCommandLine methods. virtual bool IsValid() OVERRIDE; virtual bool IsReadOnly() OVERRIDE; virtual CefRefPtr<CefCommandLine> Copy() OVERRIDE; virtual void InitFromArgv(int argc, const char* const* argv) OVERRIDE; virtual void InitFromString(const CefString& command_line) OVERRIDE; virtual void Reset() OVERRIDE; virtual CefString GetCommandLineString() OVERRIDE; virtual CefString GetProgram() OVERRIDE; virtual void SetProgram(const CefString& program) OVERRIDE; virtual bool HasSwitches() OVERRIDE; virtual bool HasSwitch(const CefString& name) OVERRIDE; virtual CefString GetSwitchValue(const CefString& name) OVERRIDE; virtual void GetSwitches(SwitchMap& switches) OVERRIDE; virtual void AppendSwitch(const CefString& name) OVERRIDE; virtual void AppendSwitchWithValue(const CefString& name, const CefString& value) OVERRIDE; virtual bool HasArguments() OVERRIDE; virtual void GetArguments(ArgumentList& arguments) OVERRIDE; virtual void AppendArgument(const CefString& argument) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(CefCommandLineImpl); }; #endif // CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_
#ifndef MANIFOLD_MCP_CACHE_DEBUG_H #define MANIFOLD_MCP_CACHE_DEBUG_H #ifndef MCP_DBG_FILTER #define MCP_DBG_FILTER true #endif #ifdef DBG_MCP_CACHE_L1_CACHE #define DBG_L1_CACHE(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << s; \ } #define DBG_L1_CACHE_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "L1 node= " << node_id << " " << s; \ } #define DBG_L1_CACHE_TICK_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "\n@ " << Manifold::NowTicks() << " L1 node= " << node_id << " " << s; \ } #define DBG_LLP_CACHE_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "LLP node= " << node_id << " " << s; \ } #else #define DBG_L1_CACHE(ostr, s) #define DBG_L1_CACHE_ID(ostr, s) #define DBG_L1_CACHE_TICK_ID(ostr, s) #define DBG_LLP_CACHE_ID(ostr, s) #endif #ifdef DBG_MCP_CACHE_L2_CACHE #define DBG_L2_CACHE(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << s; \ } #define DBG_L2_CACHE_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "L2 node= " << node_id << " " << s; \ } #define DBG_L2_CACHE_TICK_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "\n@ " << Manifold::NowTicks() << " L2 node= " << node_id << " " << s; \ } #define DBG_LLS_CACHE_ID(ostr, s) \ if (MCP_DBG_FILTER) { \ ostr << "LLS node= " << node_id << " " << s; \ } #else #define DBG_L2_CACHE(ostr, s) #define DBG_L2_CACHE_ID(ostr, s) #define DBG_L2_CACHE_TICK_ID(ostr, s) #define DBG_LLS_CACHE_ID(ostr, s) #endif namespace manifold { namespace mcp_cache_namespace { } // namespace mcp_cache_namespace } //namespace manifold #endif
/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */ /* */ /* Use of this source code is governed by a BSD-style license */ /* that can be found in the LICENSE file in the root of the source */ /* tree. An additional intellectual property rights grant can be found */ /* in the file PATENTS. All contributing project authors may */ /* be found in the AUTHORS file in the root of the source tree. */ /* This file automatically generated by configure. Do not edit! */ #ifndef VPX_CONFIG_H #define VPX_CONFIG_H #define RESTRICT #define INLINE __forceinline #define ARCH_ARM 0 #define ARCH_MIPS 0 #define ARCH_X86 0 #define ARCH_X86_64 1 #define ARCH_PPC32 0 #define ARCH_PPC64 0 #define HAVE_EDSP 0 #define HAVE_MEDIA 0 #define HAVE_NEON 0 #define HAVE_NEON_ASM 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MIPS64 0 #define HAVE_MMX 1 #define HAVE_SSE 1 #define HAVE_SSE2 1 #define HAVE_SSE3 1 #define HAVE_SSSE3 1 #define HAVE_SSE4_1 1 #define HAVE_AVX 1 #define HAVE_AVX2 1 #define HAVE_ALTIVEC 0 #define HAVE_VPX_PORTS 1 #define HAVE_STDINT_H 0 #define HAVE_ALT_TREE_LAYOUT 0 #define HAVE_PTHREAD_H 0 #define HAVE_SYS_MMAN_H 0 #define HAVE_UNISTD_H 0 #define CONFIG_EXTERNAL_BUILD 1 #define CONFIG_INSTALL_DOCS 0 #define CONFIG_INSTALL_BINS 1 #define CONFIG_INSTALL_LIBS 1 #define CONFIG_INSTALL_SRCS 0 #define CONFIG_USE_X86INC 1 #define CONFIG_DEBUG 0 #define CONFIG_GPROF 0 #define CONFIG_GCOV 0 #define CONFIG_RVCT 0 #define CONFIG_GCC 0 #define CONFIG_MSVS 1 #define CONFIG_PIC 0 #define CONFIG_BIG_ENDIAN 0 #define CONFIG_CODEC_SRCS 0 #define CONFIG_DEBUG_LIBS 0 #define CONFIG_FAST_UNALIGNED 1 #define CONFIG_MEM_MANAGER 0 #define CONFIG_MEM_TRACKER 0 #define CONFIG_MEM_CHECKS 0 #define CONFIG_DEQUANT_TOKENS 0 #define CONFIG_DC_RECON 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_POSTPROC 1 #define CONFIG_VP9_POSTPROC 0 #define CONFIG_MULTITHREAD 1 #define CONFIG_INTERNAL_STATS 0 #define CONFIG_VP8_ENCODER 1 #define CONFIG_VP8_DECODER 1 #define CONFIG_VP9_ENCODER 1 #define CONFIG_VP9_DECODER 1 #define CONFIG_VP8 1 #define CONFIG_VP9 1 #define CONFIG_ENCODERS 1 #define CONFIG_DECODERS 1 #define CONFIG_STATIC_MSVCRT 0 #define CONFIG_SPATIAL_RESAMPLING 1 #define CONFIG_REALTIME_ONLY 1 #define CONFIG_ONTHEFLY_BITPACKING 0 #define CONFIG_ERROR_CONCEALMENT 0 #define CONFIG_SHARED 0 #define CONFIG_STATIC 1 #define CONFIG_SMALL 0 #define CONFIG_POSTPROC_VISUALIZER 0 #define CONFIG_OS_SUPPORT 1 #define CONFIG_UNIT_TESTS 0 #define CONFIG_WEBM_IO 1 #define CONFIG_LIBYUV 1 #define CONFIG_DECODE_PERF_TESTS 0 #define CONFIG_ENCODE_PERF_TESTS 0 #define CONFIG_MULTI_RES_ENCODING 1 #define CONFIG_TEMPORAL_DENOISING 1 #define CONFIG_VP9_TEMPORAL_DENOISING 1 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_VP9_HIGHBITDEPTH 0 #define CONFIG_EXPERIMENTAL 0 #define CONFIG_SIZE_LIMIT 0 #define CONFIG_SPATIAL_SVC 0 #define CONFIG_FP_MB_STATS 0 #define CONFIG_EMULATE_HARDWARE 0 #endif /* VPX_CONFIG_H */
/* $OpenBSD: x_sig.c,v 1.7 2014/06/12 15:49:27 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * 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 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 cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #include <stdio.h> #include "cryptlib.h" #include <openssl/asn1t.h> #include <openssl/x509.h> ASN1_SEQUENCE(X509_SIG) = { ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR), ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING) } ASN1_SEQUENCE_END(X509_SIG) IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)
#ifndef MVMAIN_H #define MVMAIN_H #include "ui_SVMainUI.h" #include "NetStateList.h" #include <QFileSystemWatcher> class SVMain : public QMainWindow, private Ui::SVMainUI { Q_OBJECT public: SVMain(QWidget *parent = 0); void set_scroll_pos_range(int xc, int yc, int xm, int ym); void set_steps(int x1, int y1, int xp, int yp); void set_status(const char *status); signals: void state_change(); public slots: void track(int); void state_changed(); void close(); void net_list_closed(); void auto_reload_toggle(bool); private: NetStateList *nlist; QFileSystemWatcher *schem_watch; }; #endif
// Copyright 2016-present 650 Industries. All rights reserved. #import <EXGL_CPP/UEXGL.h> #import <ABI44_0_0EXGL/ABI44_0_0EXGLContext.h> #import <ABI44_0_0ExpoModulesCore/ABI44_0_0EXModuleRegistry.h> NS_ASSUME_NONNULL_BEGIN @interface ABI44_0_0EXGLView : UIView <ABI44_0_0EXGLContextDelegate> - (instancetype)initWithModuleRegistry:(ABI44_0_0EXModuleRegistry *)moduleRegistry; - (UEXGLContextId)exglCtxId; // AR - (void)setArSessionManager:(id)arSessionManager; - (void)maybeStopARSession; @property (nonatomic, copy, nullable) ABI44_0_0EXDirectEventBlock onSurfaceCreate; @property (nonatomic, assign) NSNumber *msaaSamples; // "protected" @property (nonatomic, strong, nullable) ABI44_0_0EXGLContext *glContext; @property (nonatomic, strong, nullable) EAGLContext *uiEaglCtx; @end NS_ASSUME_NONNULL_END
//////////////////////////////////////////////////////////////////////////////////// /// /// \file globalwaypointlistdriver.h /// \brief This file contains the implementation of the Global Waypoint List /// Driver service. /// /// <br>Author(s): Daniel Barber /// <br>Created: 23 April 2010 /// <br>Copyright (c) 2010 /// <br>Applied Cognition and Training in Immersive Virtual Environments /// <br>(ACTIVE) Laboratory /// <br>Institute for Simulation and Training (IST) /// <br>University of Central Florida (UCF) /// <br>All rights reserved. /// <br>Email: dbarber@ist.ucf.edu /// <br>Web: http://active.ist.ucf.edu /// /// Redistribution and use in source and binary forms, with or without /// modification, are permitted provided that the following conditions are met: /// * Redistributions of source code must retain the above copyright /// notice, this list of conditions and the following disclaimer. /// * Redistributions in binary form must reproduce the above copyright /// notice, this list of conditions and the following disclaimer in the /// documentation and/or other materials provided with the distribution. /// * Neither the name of the ACTIVE LAB, IST, UCF, 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 ACTIVE LAB''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 UCF 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 __JAUS_MOBILITY_GLOBAL_WAYPOINT_LIST_DRIVER__H #define __JAUS_MOBILITY_GLOBAL_WAYPOINT_LIST_DRIVER__H #include "jaus/mobility/drivers/listdriver.h" #include "jaus/mobility/drivers/globalwaypointdriver.h" namespace JAUS { //////////////////////////////////////////////////////////////////////////////////// /// /// \class GlobalWaypointListDriver /// \brief This class is used to drive a platform to multiple waypoints. /// /// This is a basic implementation of a GlobalWaypointListDriver, it just /// processes the messages and makes the available, overload from it or /// use it to drive to waypoints. /// //////////////////////////////////////////////////////////////////////////////////// class JAUS_MOBILITY_DLL GlobalWaypointListDriver : public ListDriver { public: const static std::string Name; ///< Name of this service. GlobalWaypointListDriver(const double updateRateHz = 2); virtual ~GlobalWaypointListDriver(); // Method called to begin/continue execution of a list. virtual void ExecuteList(const double speedMetersPerSecond); // Method called to check if an element type (message payload) is supported. virtual bool IsElementSupported(const Message* message) const; // Method called whenever a message is received. virtual void Receive(const Message* message); // Creates messages associated with this service. virtual Message* CreateMessage(const UShort messageCode) const; // Generates Global Waypoint Driver related events. virtual bool GenerateEvent(const Events::Subscription& info) const; // Adds support for Report Global Waypoint events. virtual bool IsEventSupported(const Events::Type type, const double requestedPeriodicRate, const Message* queryMessage, double& confirmedPeriodicRate, std::string& errorMessage) const; // Gets the current active waypoint element in list. JAUS::SetGlobalWaypoint GetCurrentWaypoint() const; // Gets the list of waypoints so far. std::vector<JAUS::SetGlobalWaypoint> GetWaypointList() const; // Prints status to console. virtual void PrintStatus() const; }; } #endif /* End of File */
/* BFD support for the FRV processor. Copyright 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #define FRV_ARCH(MACHINE, NAME, DEFAULT, NEXT) \ { \ 32, /* 32 bits in a word */ \ 32, /* 32 bits in an address */ \ 8, /* 8 bits in a byte */ \ bfd_arch_frv, /* architecture */ \ MACHINE, /* which machine */ \ "frv", /* architecture name */ \ NAME, /* machine name */ \ 4, /* default alignment */ \ DEFAULT, /* is this the default? */ \ bfd_default_compatible, /* architecture comparison fn */ \ bfd_default_scan, /* string to architecture convert fn */ \ NEXT /* next in list */ \ } static const bfd_arch_info_type arch_info_300 = FRV_ARCH (bfd_mach_fr300, "fr300", FALSE, (bfd_arch_info_type *)0); static const bfd_arch_info_type arch_info_400 = FRV_ARCH (bfd_mach_fr400, "fr400", FALSE, &arch_info_300); static const bfd_arch_info_type arch_info_450 = FRV_ARCH (bfd_mach_fr450, "fr450", FALSE, &arch_info_400); static const bfd_arch_info_type arch_info_500 = FRV_ARCH (bfd_mach_fr500, "fr500", FALSE, &arch_info_450); static const bfd_arch_info_type arch_info_550 = FRV_ARCH (bfd_mach_fr550, "fr550", FALSE, &arch_info_500); static const bfd_arch_info_type arch_info_simple = FRV_ARCH (bfd_mach_frvsimple, "simple", FALSE, &arch_info_550); static const bfd_arch_info_type arch_info_tomcat = FRV_ARCH (bfd_mach_frvtomcat, "tomcat", FALSE, &arch_info_simple); const bfd_arch_info_type bfd_frv_arch = FRV_ARCH (bfd_mach_frv, "frv", TRUE, &arch_info_tomcat);
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_ #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_ #pragma once #include <string> #include <vector> #include "base/basictypes.h" #include "base/file_path.h" #include "base/id_map.h" #include "base/observer_list.h" #include "base/time.h" namespace gdata { // This class tracks all the in-flight GData operation objects and manage their // lifetime. class GDataOperationRegistry { public: GDataOperationRegistry(); virtual ~GDataOperationRegistry(); // Unique ID to identify each operation. typedef int32 OperationID; // Enumeration type for indicating the direction of the operation. enum OperationType { OPERATION_UPLOAD, OPERATION_DOWNLOAD, OPERATION_OTHER, }; enum OperationTransferState { OPERATION_NOT_STARTED, OPERATION_STARTED, OPERATION_IN_PROGRESS, OPERATION_COMPLETED, OPERATION_FAILED, OPERATION_SUSPENDED, }; static std::string OperationTypeToString(OperationType type); static std::string OperationTransferStateToString( OperationTransferState state); // Structure that packs progress information of each operation. struct ProgressStatus { ProgressStatus(OperationType type, const FilePath& file_path); // For debugging std::string ToString() const; OperationID operation_id; // Type of the operation: upload/download. OperationType operation_type; // GData path of the file dealt with the current operation. FilePath file_path; // Current state of the transfer; OperationTransferState transfer_state; // The time when the operation is initiated. base::Time start_time; // Current fraction of progress of the operation. int64 progress_current; // Expected total number of bytes to be transferred in the operation. // -1 if no expectation is available (yet). int64 progress_total; }; typedef std::vector<ProgressStatus> ProgressStatusList; // Observer interface for listening changes in the active set of operations. class Observer { public: // Called when a GData operation started, made some progress, or finished. virtual void OnProgressUpdate(const ProgressStatusList& list) = 0; // Called when GData authentication failed. virtual void OnAuthenticationFailed() {} protected: virtual ~Observer() {} }; // Base class for operations that this registry class can maintain. // The Operation objects are owned by the registry. In particular, calling // NotifyFinish() causes the registry to delete the Operation object itself. class Operation { public: explicit Operation(GDataOperationRegistry* registry); Operation(GDataOperationRegistry* registry, OperationType type, const FilePath& file_path); virtual ~Operation(); // Cancels the ongoing operation. NotifyFinish() is called and the Operation // object is deleted once the cancellation is done in DoCancel(). void Cancel(); // Retrieves the current progress status of the operation. const ProgressStatus& progress_status() const { return progress_status_; } protected: // Notifies the registry about current status. void NotifyStart(); void NotifyProgress(int64 current, int64 total); void NotifyFinish(OperationTransferState status); // Notifies suspend/resume, used for chunked upload operations. // The initial upload operation should issue "start" "progress"* "suspend". // The subsequent operations will call "resume" "progress"* "suspend", // and the last one will do "resume" "progress"* "finish". // In other words, "suspend" is similar to "finish" except it lasts to live // until the next "resume" comes. "Resume" is similar to "start", except // that it removes the existing "suspend" operation. void NotifySuspend(); void NotifyResume(); // Notifies that authentication has failed. void NotifyAuthFailed(); private: // Does the cancellation. virtual void DoCancel() = 0; GDataOperationRegistry* const registry_; ProgressStatus progress_status_; }; // Cancels all in-flight operations. void CancelAll(); // Cancels ongoing operation for a given virtual |file_path|. Returns true if // the operation was found and canceled. bool CancelForFilePath(const FilePath& file_path); // Obtains the list of currently active operations. ProgressStatusList GetProgressStatusList(); // Sets the observer. void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); private: // Handlers for notifications from Operations. friend class Operation; // The registry assigns a fresh operation ID and return it to *id. void OnOperationStart(Operation* operation, OperationID* id); void OnOperationProgress(OperationID operation); void OnOperationFinish(OperationID operation); void OnOperationSuspend(OperationID operation); void OnOperationResume(Operation* operation, ProgressStatus* new_status); void OnOperationAuthFailed(); bool IsFileTransferOperation(const Operation* operation) const; typedef IDMap<Operation, IDMapOwnPointer> OperationIDMap; OperationIDMap in_flight_operations_; ObserverList<Observer> observer_list_; DISALLOW_COPY_AND_ASSIGN(GDataOperationRegistry); }; } // namespace gdata #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATION_REGISTRY_H_
/* LUFA Library Copyright (C) Dean Camera, 2012. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. */ /** \file * * Header file for VirtualSerial.c. */ #ifndef _VIRTUALSERIAL_H_ #define _VIRTUALSERIAL_H_ /* Includes: */ #include <avr/io.h> #include <avr/wdt.h> #include <avr/power.h> #include <avr/interrupt.h> #include <string.h> #include <stdio.h> #include "Descriptors.h" #include <LUFA/Version.h> #include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/Buttons.h> #include <LUFA/Platform/XMEGA/ClockManagement.h> #include <LUFA/Drivers/USB/USB.h> /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY 0 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ #define LEDMASK_USB_ENUMERATING (LEDS_RED | LEDS_GREEN) /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ #define LEDMASK_USB_READY (LEDS_GREEN) /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ #define LEDMASK_USB_ERROR (LEDS_RED) /* Function Prototypes: */ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ControlRequest(void); void Boot_Jump(void); #endif
#ifndef _NPY_PRIVATE__UFUNC_TYPE_RESOLUTION_H_ #define _NPY_PRIVATE__UFUNC_TYPE_RESOLUTION_H_ NPY_NO_EXPORT int PyUFunc_SimpleBinaryComparisonTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_NegativeTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_OnesLikeTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_SimpleUniformOperationTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_AbsoluteTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_IsNaTTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_IsFiniteTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_AdditionTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_SubtractionTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_MultiplicationTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_TrueDivisionTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_DivisionTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_RemainderTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); NPY_NO_EXPORT int PyUFunc_DivmodTypeResolver(PyUFuncObject *ufunc, NPY_CASTING casting, PyArrayObject **operands, PyObject *type_tup, PyArray_Descr **out_dtypes); /* * Does a linear search for the best inner loop of the ufunc. * * Note that if an error is returned, the caller must free the non-zero * references in out_dtype. This function does not do its own clean-up. */ NPY_NO_EXPORT int linear_search_type_resolver(PyUFuncObject *self, PyArrayObject **op, NPY_CASTING input_casting, NPY_CASTING output_casting, int any_object, PyArray_Descr **out_dtype); /* * Does a linear search for the inner loop of the ufunc specified by type_tup. * * Note that if an error is returned, the caller must free the non-zero * references in out_dtype. This function does not do its own clean-up. */ NPY_NO_EXPORT int type_tuple_type_resolver(PyUFuncObject *self, PyObject *type_tup, PyArrayObject **op, NPY_CASTING input_casting, NPY_CASTING casting, int any_object, PyArray_Descr **out_dtype); NPY_NO_EXPORT int PyUFunc_DefaultLegacyInnerLoopSelector(PyUFuncObject *ufunc, PyArray_Descr **dtypes, PyUFuncGenericFunction *out_innerloop, void **out_innerloopdata, int *out_needs_api); NPY_NO_EXPORT int raise_no_loop_found_error(PyUFuncObject *ufunc, PyObject **dtypes); #endif
/* * Copyright (c) 2016, SRCH2 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the SRCH2 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 SRCH2 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. */ /* * LowerCaseFilter.h * * Created on: 2013-5-17 */ //This class is used to transform the English letters to lower case #ifndef __CORE_ANALYZER_LOWERCASEFILTER_H__ #define __CORE_ANALYZER_LOWERCASEFILTER_H__ #include "TokenStream.h" #include "TokenFilter.h" namespace srch2 { namespace instantsearch { /* * LowerCaseFilter transform English letter in token to lower case * for example: Token: "School" -> "school" */ class LowerCaseFilter:public TokenFilter { public: LowerCaseFilter(TokenStream* tokenStream); bool processToken(); virtual ~LowerCaseFilter(); private: void transformToLowerCase(std::vector<CharType> &token); }; }} #endif /* __CORE_ANALYZER__LOWERCASEFILTER_H__ */
#pragma once #include "gloox/gloox.h" #include "gloox/client.h" #include "gloox/message.h" #include "gloox/rostermanager.h" #include "gloox/messagehandler.h" #include "gloox/messagesession.h" #include "gloox/rosterlistener.h" #include "gloox/connectionlistener.h" #include "gloox/presencehandler.h" #include "gloox/messagesessionhandler.h" #include "gloox/messageeventhandler.h" #include "gloox/messageeventfilter.h" #include "gloox/chatstatehandler.h" #include "gloox/chatstatefilter.h" #include "gloox/disco.h" #include "gloox/lastactivity.h" #include "gloox/loghandler.h" #include "gloox/logsink.h" #include "gloox/connectiontcpclient.h" #include "gloox/connectionsocks5proxy.h" #include "gloox/connectionhttpproxy.h" #ifndef _WIN32 # include <unistd.h> #endif #include <iostream> #include <string> #if defined( WIN32 ) || defined( _WIN32 ) # include <windows.h> #endif class XmppClient; class XmppListener : public gloox::ConnectionListener, gloox::MessageHandler, gloox::RosterListener, gloox::MessageSessionHandler, gloox::LogHandler, gloox::MessageEventHandler, gloox::ChatStateHandler, gloox::PresenceHandler { public: XmppListener(XmppClient* delegate = 0); virtual ~XmppListener(); void setup( const std::string& username = "", const std::string& server = "", const bool enableLogging = false ); void openConnection(bool toggle = false); const gloox::Client& getClient() const; bool isConnected() const { return mIsConnected; } std::string server() const { return mServer; } std::string username() const { return mUsername; } virtual bool sendMessage( const gloox::JID& recipient, const std::string& message, const std::string& subject ); protected: virtual void onConnect(); virtual void onDisconnect( gloox::ConnectionError e ); virtual bool onTLSConnect( const gloox::CertInfo& info ); virtual void handleMessage( const gloox::Message& msg, gloox::MessageSession* session ); virtual void handleMessageEvent( const gloox::JID& from, gloox::MessageEventType event ); virtual void handleChatState( const gloox::JID& from, gloox::ChatStateType state ); virtual void handleMessageSession( gloox::MessageSession* session ); virtual void handleLog( gloox::LogLevel level, gloox::LogArea area, const std::string& message ); virtual void handlePresence( const gloox::Presence& presence ); // satisfy interfaces for gloox::RosterListener virtual void handleRoster( const gloox::Roster& roster ); virtual void handleRosterPresence( const gloox::RosterItem& item, const std::string& resource, gloox::Presence::PresenceType presence, const std::string& msg ); virtual void handleRosterError( const gloox::IQ& iq ) {} virtual void handleItemAdded( const gloox::JID& jid ) {} virtual void handleItemSubscribed( const gloox::JID& jid ) {} virtual void handleItemRemoved( const gloox::JID& jid ) {} virtual void handleItemUpdated( const gloox::JID& jid ) {} virtual void handleItemUnsubscribed( const gloox::JID& jid ) {} virtual void handleSelfPresence( const gloox::RosterItem& item, const std::string& resource, gloox::Presence::PresenceType presence, const std::string& msg ) {} virtual bool handleSubscriptionRequest( const gloox::JID& jid, const std::string& msg ) { return false; } virtual bool handleUnsubscriptionRequest( const gloox::JID& jid, const std::string& msg ) { return false; } virtual void handleNonrosterPresence( const gloox::Presence& presence ) {} private: bool mIsConnected; std::string mServer; std::string mUsername; gloox::Client* mClient; gloox::MessageSession* mSession; gloox::MessageEventFilter* mMessageEventFilter; gloox::ChatStateFilter* mChatStateFilter; XmppClient* mDelegate; };
/* * Copyright (c) 2014 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include <limits.h> #include <math.h> #include "vp10/encoder/aq_complexity.h" #include "vp10/encoder/aq_variance.h" #include "vp10/encoder/encodeframe.h" #include "vp10/common/seg_common.h" #include "vp10/encoder/segmentation.h" #include "vpx_ports/system_state.h" #define AQ_C_SEGMENTS 5 #define DEFAULT_AQ2_SEG 3 // Neutral Q segment #define AQ_C_STRENGTHS 3 static const double aq_c_q_adj_factor[AQ_C_STRENGTHS][AQ_C_SEGMENTS] = { {1.75, 1.25, 1.05, 1.00, 0.90}, {2.00, 1.50, 1.15, 1.00, 0.85}, {2.50, 1.75, 1.25, 1.00, 0.80} }; static const double aq_c_transitions[AQ_C_STRENGTHS][AQ_C_SEGMENTS] = { {0.15, 0.30, 0.55, 2.00, 100.0}, {0.20, 0.40, 0.65, 2.00, 100.0}, {0.25, 0.50, 0.75, 2.00, 100.0} }; static const double aq_c_var_thresholds[AQ_C_STRENGTHS][AQ_C_SEGMENTS] = { {-4.0, -3.0, -2.0, 100.00, 100.0}, {-3.5, -2.5, -1.5, 100.00, 100.0}, {-3.0, -2.0, -1.0, 100.00, 100.0} }; #define DEFAULT_COMPLEXITY 64 static int get_aq_c_strength(int q_index, vpx_bit_depth_t bit_depth) { // Approximate base quatizer (truncated to int) const int base_quant = vp10_ac_quant(q_index, 0, bit_depth) / 4; return (base_quant > 10) + (base_quant > 25); } void vp10_setup_in_frame_q_adj(VP10_COMP *cpi) { VP10_COMMON *const cm = &cpi->common; struct segmentation *const seg = &cm->seg; // Make SURE use of floating point in this function is safe. vpx_clear_system_state(); if (cm->frame_type == KEY_FRAME || cpi->refresh_alt_ref_frame || (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) { int segment; const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth); // Clear down the segment map. memset(cpi->segmentation_map, DEFAULT_AQ2_SEG, cm->mi_rows * cm->mi_cols); vp10_clearall_segfeatures(seg); // Segmentation only makes sense if the target bits per SB is above a // threshold. Below this the overheads will usually outweigh any benefit. if (cpi->rc.sb64_target_rate < 256) { vp10_disable_segmentation(seg); return; } vp10_enable_segmentation(seg); // Select delta coding method. seg->abs_delta = SEGMENT_DELTADATA; // Default segment "Q" feature is disabled so it defaults to the baseline Q. vp10_disable_segfeature(seg, DEFAULT_AQ2_SEG, SEG_LVL_ALT_Q); // Use some of the segments for in frame Q adjustment. for (segment = 0; segment < AQ_C_SEGMENTS; ++segment) { int qindex_delta; if (segment == DEFAULT_AQ2_SEG) continue; qindex_delta = vp10_compute_qdelta_by_rate(&cpi->rc, cm->frame_type, cm->base_qindex, aq_c_q_adj_factor[aq_strength][segment], cm->bit_depth); // For AQ complexity mode, we dont allow Q0 in a segment if the base // Q is not 0. Q0 (lossless) implies 4x4 only and in AQ mode 2 a segment // Q delta is sometimes applied without going back around the rd loop. // This could lead to an illegal combination of partition size and q. if ((cm->base_qindex != 0) && ((cm->base_qindex + qindex_delta) == 0)) { qindex_delta = -cm->base_qindex + 1; } if ((cm->base_qindex + qindex_delta) > 0) { vp10_enable_segfeature(seg, segment, SEG_LVL_ALT_Q); vp10_set_segdata(seg, segment, SEG_LVL_ALT_Q, qindex_delta); } } } } #define DEFAULT_LV_THRESH 10.0 #define MIN_DEFAULT_LV_THRESH 8.0 #define VAR_STRENGTH_STEP 0.25 // Select a segment for the current block. // The choice of segment for a block depends on the ratio of the projected // bits for the block vs a target average and its spatial complexity. void vp10_caq_select_segment(VP10_COMP *cpi, MACROBLOCK *mb, BLOCK_SIZE bs, int mi_row, int mi_col, int projected_rate) { VP10_COMMON *const cm = &cpi->common; const int mi_offset = mi_row * cm->mi_cols + mi_col; const int bw = num_8x8_blocks_wide_lookup[BLOCK_64X64]; const int bh = num_8x8_blocks_high_lookup[BLOCK_64X64]; const int xmis = VPXMIN(cm->mi_cols - mi_col, num_8x8_blocks_wide_lookup[bs]); const int ymis = VPXMIN(cm->mi_rows - mi_row, num_8x8_blocks_high_lookup[bs]); int x, y; int i; unsigned char segment; if (0) { segment = DEFAULT_AQ2_SEG; } else { // Rate depends on fraction of a SB64 in frame (xmis * ymis / bw * bh). // It is converted to bits * 256 units. const int target_rate = (cpi->rc.sb64_target_rate * xmis * ymis * 256) / (bw * bh); double logvar; double low_var_thresh; const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth); vpx_clear_system_state(); low_var_thresh = (cpi->oxcf.pass == 2) ? VPXMAX(cpi->twopass.mb_av_energy, MIN_DEFAULT_LV_THRESH) : DEFAULT_LV_THRESH; vp10_setup_src_planes(mb, cpi->Source, mi_row, mi_col); logvar = vp10_log_block_var(cpi, mb, bs); segment = AQ_C_SEGMENTS - 1; // Just in case no break out below. for (i = 0; i < AQ_C_SEGMENTS; ++i) { // Test rate against a threshold value and variance against a threshold. // Increasing segment number (higher variance and complexity) = higher Q. if ((projected_rate < target_rate * aq_c_transitions[aq_strength][i]) && (logvar < (low_var_thresh + aq_c_var_thresholds[aq_strength][i]))) { segment = i; break; } } } // Fill in the entires in the segment map corresponding to this SB64. for (y = 0; y < ymis; y++) { for (x = 0; x < xmis; x++) { cpi->segmentation_map[mi_offset + y * cm->mi_cols + x] = segment; } } }
/* * Copyright (c) 2017, 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 * @brief * This file includes the platform-specific initializers. */ #include <openthread/config.h> #include <stdio.h> #include <openthread/types.h> #include "platform-cc2652.h" #include "inc/hw_types.h" #include "inc/hw_ccfg.h" #include "inc/hw_ccfg_simple_struct.h" extern const ccfg_t __ccfg; const char *dummy_ccfg_ref = ((const char *)(&(__ccfg))); /** * Function documented in platform-cc2652.h */ void PlatformInit(int argc, char *argv[]) { (void) argc; (void) argv; while (dummy_ccfg_ref == NULL) { /* * This provides a code reference to the customer configuration area of * the flash, otherwise the data is skipped by the linker and not put * into the final flash image. */ } cc2652AlarmInit(); cc2652RandomInit(); cc2652RadioInit(); } /** * Function documented in platform-cc2652.h */ void PlatformProcessDrivers(otInstance *aInstance) { // should sleep and wait for interrupts here cc2652UartProcess(); cc2652RadioProcess(aInstance); cc2652AlarmProcess(aInstance); }
#ifndef __TB_AADL_UART_Driver_types__H #define __TB_AADL_UART_Driver_types__H #include "tb_smaccmcopter_types.h" /************************************************************************** Copyright (c) 2013-2016 Rockwell Collins and the University of Minnesota. Developed with the sponsorship of the Defense Advanced Research Projects Agency (DARPA). Permission is hereby granted, free of charge, to any person obtaining a copy of this data, including any software or models in source or binary form, as well as any drawings, specifications, and documentation (collectively "the Data"), to deal in the Data without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Data, and to permit persons to whom the Data 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 Data. THE DATA 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, SPONSORS, DEVELOPERS, CONTRIBUTORS, 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 DATA OR THE USE OR OTHER DEALINGS IN THE DATA. **************************************************************************/ /************************************************************************** ***AUTOGENERATED CODE: DO NOT MODIFY*** This header section contains the AADL gluecode interfaces used by the client for the thread implementations. **************************************************************************/ bool tb_UART_Driver_write_self2decrypt(const SMACCM_DATA__UART_Packet_i * self2decrypt); // reader prototype for encrypt2self bool tb_UART_Driver_read_encrypt2self(SMACCM_DATA__UART_Packet_i * encrypt2self); bool tb_UART_Driver_write_self2encrypt(const bool * self2encrypt); ////////////////////////////////////////////////////////////////////////// // // Note: thread is declared EXTERNAL; user should provide run() function. // ////////////////////////////////////////////////////////////////////////// #endif // __TB_AADL_UART_Driver_types__H
/* * logsumexp2_emxutil.c * * Code generation for function 'logsumexp2_emxutil' * * C source code generated on: Tue Jan 14 10:28:31 2014 * */ /* Include files */ #include "rt_nonfinite.h" #include "logsumexp2.h" #include "logsumexp2_emxutil.h" /* Function Definitions */ void emxEnsureCapacity(const emlrtStack *sp, emxArray__common *emxArray, int32_T oldNumel, int32_T elementSize, const emlrtRTEInfo *srcLocation) { int32_T newNumel; int32_T i; void *newData; newNumel = 1; for (i = 0; i < emxArray->numDimensions; i++) { newNumel = (int32_T)emlrtSizeMulR2012b((uint32_T)newNumel, (uint32_T) emxArray->size[i], srcLocation, sp); } if (newNumel > emxArray->allocatedSize) { i = emxArray->allocatedSize; if (i < 16) { i = 16; } while (i < newNumel) { i = (int32_T)emlrtSizeMulR2012b((uint32_T)i, 2U, srcLocation, sp); } newData = emlrtCallocMex((uint32_T)i, (uint32_T)elementSize); if (newData == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } if (emxArray->data != NULL) { memcpy(newData, emxArray->data, (uint32_T)(elementSize * oldNumel)); if (emxArray->canFreeData) { emlrtFreeMex(emxArray->data); } } emxArray->data = newData; emxArray->allocatedSize = i; emxArray->canFreeData = TRUE; } } void emxFree_boolean_T(emxArray_boolean_T **pEmxArray) { if (*pEmxArray != (emxArray_boolean_T *)NULL) { if ((*pEmxArray)->canFreeData) { emlrtFreeMex((void *)(*pEmxArray)->data); } emlrtFreeMex((void *)(*pEmxArray)->size); emlrtFreeMex((void *)*pEmxArray); *pEmxArray = (emxArray_boolean_T *)NULL; } } void emxFree_int32_T(emxArray_int32_T **pEmxArray) { if (*pEmxArray != (emxArray_int32_T *)NULL) { if ((*pEmxArray)->canFreeData) { emlrtFreeMex((void *)(*pEmxArray)->data); } emlrtFreeMex((void *)(*pEmxArray)->size); emlrtFreeMex((void *)*pEmxArray); *pEmxArray = (emxArray_int32_T *)NULL; } } void emxFree_real_T(emxArray_real_T **pEmxArray) { if (*pEmxArray != (emxArray_real_T *)NULL) { if ((*pEmxArray)->canFreeData) { emlrtFreeMex((void *)(*pEmxArray)->data); } emlrtFreeMex((void *)(*pEmxArray)->size); emlrtFreeMex((void *)*pEmxArray); *pEmxArray = (emxArray_real_T *)NULL; } } void emxInit_boolean_T(const emlrtStack *sp, emxArray_boolean_T **pEmxArray, int32_T numDimensions, const emlrtRTEInfo *srcLocation, boolean_T doPush) { emxArray_boolean_T *emxArray; int32_T i; *pEmxArray = (emxArray_boolean_T *)emlrtMallocMex(sizeof(emxArray_boolean_T)); if ((void *)*pEmxArray == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } if (doPush) { emlrtPushHeapReferenceStackR2012b(sp, (void *)pEmxArray, (void (*)(void *)) emxFree_boolean_T); } emxArray = *pEmxArray; emxArray->data = (boolean_T *)NULL; emxArray->numDimensions = numDimensions; emxArray->size = (int32_T *)emlrtMallocMex((uint32_T)(sizeof(int32_T) * numDimensions)); if ((void *)emxArray->size == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } emxArray->allocatedSize = 0; emxArray->canFreeData = TRUE; for (i = 0; i < numDimensions; i++) { emxArray->size[i] = 0; } } void emxInit_int32_T(const emlrtStack *sp, emxArray_int32_T **pEmxArray, int32_T numDimensions, const emlrtRTEInfo *srcLocation, boolean_T doPush) { emxArray_int32_T *emxArray; int32_T i; *pEmxArray = (emxArray_int32_T *)emlrtMallocMex(sizeof(emxArray_int32_T)); if ((void *)*pEmxArray == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } if (doPush) { emlrtPushHeapReferenceStackR2012b(sp, (void *)pEmxArray, (void (*)(void *)) emxFree_int32_T); } emxArray = *pEmxArray; emxArray->data = (int32_T *)NULL; emxArray->numDimensions = numDimensions; emxArray->size = (int32_T *)emlrtMallocMex((uint32_T)(sizeof(int32_T) * numDimensions)); if ((void *)emxArray->size == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } emxArray->allocatedSize = 0; emxArray->canFreeData = TRUE; for (i = 0; i < numDimensions; i++) { emxArray->size[i] = 0; } } void emxInit_real_T(const emlrtStack *sp, emxArray_real_T **pEmxArray, int32_T numDimensions, const emlrtRTEInfo *srcLocation, boolean_T doPush) { emxArray_real_T *emxArray; int32_T i; *pEmxArray = (emxArray_real_T *)emlrtMallocMex(sizeof(emxArray_real_T)); if ((void *)*pEmxArray == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } if (doPush) { emlrtPushHeapReferenceStackR2012b(sp, (void *)pEmxArray, (void (*)(void *)) emxFree_real_T); } emxArray = *pEmxArray; emxArray->data = (real_T *)NULL; emxArray->numDimensions = numDimensions; emxArray->size = (int32_T *)emlrtMallocMex((uint32_T)(sizeof(int32_T) * numDimensions)); if ((void *)emxArray->size == NULL) { emlrtHeapAllocationErrorR2012b(srcLocation, sp); } emxArray->allocatedSize = 0; emxArray->canFreeData = TRUE; for (i = 0; i < numDimensions; i++) { emxArray->size[i] = 0; } } /* End of code generation (logsumexp2_emxutil.c) */
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ #define VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_ #include "views/widget/root_view.h" namespace views { class MenuController; class SubmenuView; // MenuHostRootView is the RootView of the window showing the menu. // SubmenuView's scroll view is added as a child of MenuHostRootView. // MenuHostRootView forwards relevant events to the MenuController. // // As all the menu items are owned by the root menu item, care must be taken // such that when MenuHostRootView is deleted it doesn't delete the menu items. class MenuHostRootView : public RootView { public: MenuHostRootView(Widget* widget, SubmenuView* submenu); // When invoked subsequent events are NOT forwarded to the MenuController. void suspend_events() { suspend_events_ = true; } virtual bool OnMousePressed(const MouseEvent& event); virtual bool OnMouseDragged(const MouseEvent& event); virtual void OnMouseReleased(const MouseEvent& event, bool canceled); virtual void OnMouseMoved(const MouseEvent& event); virtual void ProcessOnMouseExited(); virtual bool ProcessMouseWheelEvent(const MouseWheelEvent& e); private: // Returns the MenuController for this MenuHostRootView. MenuController* GetMenuController(); // The SubmenuView we contain. SubmenuView* submenu_; // Whether mouse dragged/released should be forwarded to the MenuController. bool forward_drag_to_menu_controller_; // Whether events are suspended. If true, no events are forwarded to the // MenuController. bool suspend_events_; DISALLOW_COPY_AND_ASSIGN(MenuHostRootView); }; } // namespace views #endif // VIEWS_CONTROLS_MENU_MENU_HOST_ROOT_VIEW_H_
/*- * Copyright (c) 2005-2006 The FreeBSD Project * All rights reserved. * * Author: Victor Cruceru <soc-victor@freebsd.org> * * Redistribution of this software and documentation 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 or documentation must retain the above * copyright notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This C file contains code developed by Poul-Henning Kamp under the * following license: * * FreeBSD: src/sbin/mdconfig/mdconfig.c,v 1.33.2.1 2004/09/14 03:32:21 jmg Exp * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * * $FreeBSD$ */ /* * Host Resources MIB implementation for bsnmpd. */ #include <paths.h> #include <stdlib.h> #include <string.h> #include <syslog.h> #include <unistd.h> #include "hostres_snmp.h" #include "hostres_oid.h" #include "hostres_tree.h" /* Internal id got after we'll register this module with the agent */ static u_int host_registration_id = 0; /* This our hostres module */ static struct lmodule *hostres_module; /* See the generated file hostres_oid.h */ static const struct asn_oid oid_host = OIDX_host; /* descriptor to access kernel memory */ kvm_t *hr_kd; /* * HOST RESOURCES mib module finalization hook. * Returns 0 on success, < 0 on error */ static int hostres_fini(void) { if (hr_kd != NULL) (void)kvm_close(hr_kd); fini_storage_tbl(); fini_fs_tbl(); fini_processor_tbl(); fini_disk_storage_tbl(); fini_device_tbl(); fini_partition_tbl(); fini_network_tbl(); fini_printer_tbl(); fini_swrun_tbl(); fini_swins_tbl(); fini_scalars(); if (host_registration_id > 0) or_unregister(host_registration_id); HRDBG("done."); return (0); } /* * HOST RESOURCES mib module initialization hook. * Returns 0 on success, < 0 on error */ static int hostres_init(struct lmodule *mod, int argc __unused, char *argv[] __unused) { hostres_module = mod; /* * NOTE: order of these calls is important here! */ if ((hr_kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open")) == NULL) { syslog(LOG_ERR, "kvm_open failed: %m "); return (-1); } /* * The order is relevant here, because some table depend on each other. */ init_device_tbl(); /* populates partition table too */ if (init_disk_storage_tbl()) { hostres_fini(); return (-1); } init_processor_tbl(); init_printer_tbl(); /* * populate storage and FS tables. Must be done after device * initialisation because the FS refresh code calls into the * partition refresh code. */ init_storage_tbl(); /* also the hrSWRunPerfTable's support is initialized here */ init_swrun_tbl(); init_swins_tbl(); HRDBG("done."); return (0); } /* * HOST RESOURCES mib module start operation * returns nothing */ static void hostres_start(void) { host_registration_id = or_register(&oid_host, "The MIB module for Host Resource MIB (RFC 2790).", hostres_module); start_device_tbl(hostres_module); start_processor_tbl(hostres_module); start_network_tbl(); HRDBG("done."); } /* this identifies the HOST RESOURCES mib module */ const struct snmp_module config = { "This module implements the host resource mib (rfc 2790)", hostres_init, hostres_fini, NULL, /* idle function, do not use it */ NULL, NULL, hostres_start, NULL, /* proxy a PDU */ hostres_ctree, /* see the generated hostres_tree.h */ hostres_CTREE_SIZE, /* see the generated hostres_tree.h */ NULL }; /** * Make an SNMP DateAndTime from a struct tm. This should be in the library. */ int make_date_time(u_char *str, const struct tm *tm, u_int decisecs) { str[0] = (u_char)((tm->tm_year + 1900) >> 8); str[1] = (u_char)(tm->tm_year + 1900); str[2] = tm->tm_mon + 1; str[3] = tm->tm_mday; str[4] = tm->tm_hour; str[5] = tm->tm_min; str[6] = tm->tm_sec; str[7] = decisecs; if (tm->tm_gmtoff < 0) str[8] = '-'; else str[8] = '+'; str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600); str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60); return (11); }
/* * 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. */ #pragma once #include <ABI43_0_0React/ABI43_0_0renderer/components/root/RootShadowNode.h> #include <ABI43_0_0React/ABI43_0_0renderer/core/ConcreteComponentDescriptor.h> namespace ABI43_0_0facebook { namespace ABI43_0_0React { using RootComponentDescriptor = ConcreteComponentDescriptor<RootShadowNode>; } // namespace ABI43_0_0React } // namespace ABI43_0_0facebook
/* +-----------------------------------------------------------+ | Copyright (c) 2017 Collet Valentin | +-----------------------------------------------------------+ | This source file is subject to version the BDS license, | | that is bundled with this package in the file LICENSE | +-----------------------------------------------------------+ | Author: Collet Valentin <valentin@famillecollet.com> | +-----------------------------------------------------------+ */ #ifndef __GTOOL_BUTTON_DEF__ #define __GTOOL_BUTTON_DEF__ #include <gtk/gtk.h> #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "zend.h" #include "zend_API.h" #include "../commons/hub.h" #include "gtoolitem.h" ZEND_BEGIN_ARG_INFO_EX(arginfo_gtool_button_construct, 0, 0, 1) ZEND_ARG_INFO(0, icon) ZEND_ARG_INFO(0, label) ZEND_END_ARG_INFO() zend_class_entry * gtool_button_get_class_entry(); zend_object_handlers * gtool_button_get_object_handlers(); #define GTOOL_BUTTON_ICON_NAME "iconName" #define GTOOL_BUTTON_ICON_WIDGET "iconWidget" #define GTOOL_BUTTON_ICON_LABEL "label" #define GTOOL_BUTTON_LABEL_WIDGET "labelWidget" #define GTOOL_BUTTON_USE_UNDERLINE "useUnderline" PHP_METHOD(GToolButton, __construct); zval *gtool_button_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); HashTable *gtool_button_get_properties(zval *object); PHP_WRITE_PROP_HANDLER_TYPE gtool_button_write_property(zval *object, zval *member, zval *value, void **cache_slot); void gtool_button_init(int module_number); #endif
// // ILMPushProvider.h // InLocoMedia-iOS-SDK-Engage // // Created by Gabriel Falcone on 1/20/18. // Copyright © 2018 InLocoMedia. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** This class holds the properties to request a device register. */ @interface ILMPushProvider : NSObject @property (nonatomic, readonly) NSString *name; @property (nonatomic, readonly) NSString *token; - (instancetype)initWithName:(NSString *)providerName token:(NSString *)providerToken; - (instancetype)init NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
#pragma once #include <Arduino.h> #include <Wire.h> #include "lightness.h" /* Section 7.3: Register definitions */ #define PCA9685_BASE_ADDRESS 0x40 #define PCA9685_MODE1 0x00 #define PCA9685_MODE2 0x01 #define PCA9685_ALLCALLADR 0x05 #define PCA9685_PRESCALE 0xFE #define PCA9685_LED0 0x06 class PCA9685_RGB { public: PCA9685_RGB(byte pcaAddress = PCA9685_BASE_ADDRESS); byte pcaAddress; void begin(), setAll(const byte red, const byte green, const byte blue), setAll(const byte greyscale), setLed(const byte led, const byte red, const byte green, const byte blue), setLed(const byte led, const byte greyscale); private: const static byte outputs = 5; void writeRegister(byte regAddress, byte regData), setGroupLevels(byte group, pwm_grey_t levels), setGroupLevels(byte group, pwm_rgb_t levels); };
// 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_IMPORT_MANAGER_H_ #define TOOLS_GN_IMPORT_MANAGER_H_ #include <map> #include <memory> #include <mutex> #include <string> #include <unordered_set> #include <vector> #include "base/macros.h" class Err; class ParseNode; class Scope; class SourceFile; // Provides a cache of the results of importing scopes so the results can // be re-used rather than running the imported files multiple times. class ImportManager { public: ImportManager(); ~ImportManager(); // Does an import of the given file into the given scope. On error, sets the // error and returns false. bool DoImport(const SourceFile& file, const ParseNode* node_for_err, Scope* scope, Err* err); std::vector<SourceFile> GetImportedFiles() const; private: struct ImportInfo; // Protects access to imports_ and imports_in_progress_. Do not hold when // actually executing imports. std::mutex imports_lock_; // Owning pointers to the scopes. using ImportMap = std::map<SourceFile, std::unique_ptr<ImportInfo>>; ImportMap imports_; std::unordered_set<std::string> imports_in_progress_; DISALLOW_COPY_AND_ASSIGN(ImportManager); }; #endif // TOOLS_GN_IMPORT_MANAGER_H_
// RXObjectType.m // Created by Rob Rix on 2010-04-19 // Copyright 2010 Monochrome Industries #include "RXObjectType.h" __strong const char *RXObjectTypeGetName(RXObjectTypeRef self) { return self->name; }
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2022, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See: https://www.mrpt.org/License | +------------------------------------------------------------------------+ */ #pragma once #include <mrpt/math/TPoint3D.h> #include <mrpt/opengl/CRenderizableShaderTriangles.h> #include <mrpt/opengl/CRenderizableShaderWireFrame.h> namespace mrpt::opengl { /** A solid or wireframe box in 3D, defined by 6 rectangular faces parallel to *the planes X, Y and Z (note that the object can be translated and rotated *afterwards as any other CRenderizable object using the "object pose" in the *base class). * Three drawing modes are possible: * - Wireframe: setWireframe(true). Used color is the CRenderizable color * - Solid box: setWireframe(false). Used color is the CRenderizable color * - Solid box with border: setWireframe(false) + enableBoxBorder(true). Solid *color is the CRenderizable color, border line can be set with *setBoxBorderColor(). * * ![mrpt::opengl::CBox](preview_CBox.png) * * \sa opengl::COpenGLScene,opengl::CRenderizable * \ingroup mrpt_opengl_grp */ class CBox : public CRenderizableShaderTriangles, public CRenderizableShaderWireFrame { DEFINE_SERIALIZABLE(CBox, mrpt::opengl) public: /** @name Renderizable shader API virtual methods * @{ */ void render(const RenderContext& rc) const override; void renderUpdateBuffers() const override; virtual shader_list_t requiredShaders() const override { // May use up to two shaders (triangles and lines): return {DefaultShaderID::WIREFRAME, DefaultShaderID::TRIANGLES}; } void onUpdateBuffers_Wireframe() override; void onUpdateBuffers_Triangles() override; void freeOpenGLResources() override { CRenderizableShaderTriangles::freeOpenGLResources(); CRenderizableShaderWireFrame::freeOpenGLResources(); } /** @} */ mrpt::math::TBoundingBox getBoundingBox() const override; /** * Ray tracing. * \sa mrpt::opengl::CRenderizable */ bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override; inline void setLineWidth(float width) { m_lineWidth = width; CRenderizable::notifyChange(); } inline float getLineWidth() const { return m_lineWidth; } inline void setWireframe(bool is_wireframe = true) { m_wireframe = is_wireframe; CRenderizable::notifyChange(); } inline bool isWireframe() const { return m_wireframe; } inline void enableBoxBorder(bool drawBorder = true) { m_draw_border = drawBorder; CRenderizable::notifyChange(); } inline bool isBoxBorderEnabled() const { return m_draw_border; } inline void setBoxBorderColor(const mrpt::img::TColor& c) { m_solidborder_color = c; CRenderizable::notifyChange(); } inline mrpt::img::TColor getBoxBorderColor() const { return m_solidborder_color; } /** Set the position and size of the box, from two corners in 3D */ void setBoxCorners( const mrpt::math::TPoint3D& corner1, const mrpt::math::TPoint3D& corner2); void getBoxCorners( mrpt::math::TPoint3D& corner1, mrpt::math::TPoint3D& corner2) const { corner1 = m_corner_min; corner2 = m_corner_max; } /** Basic empty constructor. Set all parameters to default. */ CBox() = default; /** Constructor with all the parameters */ CBox( const mrpt::math::TPoint3D& corner1, const mrpt::math::TPoint3D& corner2, bool is_wireframe = false, float lineWidth = 1.0); /** Destructor */ ~CBox() override = default; protected: /** Corners coordinates */ mrpt::math::TPoint3D m_corner_min = {-1, -1, -1}, m_corner_max = {1, 1, 1}; /** true: wireframe, false (default): solid */ bool m_wireframe{false}; /** Draw line borders to solid box with the given linewidth (default: true) */ bool m_draw_border{true}; /** Color of the solid box borders. */ mrpt::img::TColor m_solidborder_color = {0, 0, 0}; }; } // namespace mrpt::opengl
// // test_AMService.h // SDM_MD_Tests // // Created by Sam Marshall on 3/29/14. // Copyright (c) 2014 Sam Marshall. All rights reserved. // #ifndef SDM_MD_Tests_test_AMService_h #define SDM_MD_Tests_test_AMService_h #include "test_Type.h" void Test_Compatibility_AMService(struct am_device *apple, SDMMD_AMDeviceRef sdm); void Test_Functionality_AMService(struct am_device *apple, SDMMD_AMDeviceRef sdm); SDM_MD_TestResponse SDM_MD_Test_AMDeviceStartService(struct am_device *apple, SDMMD_AMDeviceRef sdm, char *type); SDM_MD_TestResponse SDM_MD_Test_AMDeviceSecureStartService(struct am_device *apple, SDMMD_AMDeviceRef sdm, char *type); SDM_MD_TestResponse SDM_MD_Test_AMDeviceLookupApplications(struct am_device *apple, SDMMD_AMDeviceRef sdm, char *type); #endif
/* Copyright (c) 2008-2013, Northwestern 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 the Northwestern 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 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 _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CUVP_II #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CUVP_II #include "type_iso.CANY.h" namespace AIMXML { namespace iso { class CUVP_II : public ::AIMXML::iso::CANY { public: AIMXML_EXPORT CUVP_II(xercesc::DOMNode* const& init); AIMXML_EXPORT CUVP_II(CUVP_II const& init); void operator=(CUVP_II const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CUVP_II); } MemberAttribute<double,_altova_mi_iso_altova_CUVP_II_altova_probability, 0, 0> probability; // probability Cdouble MemberElement<iso::CII, _altova_mi_iso_altova_CUVP_II_altova_value2> value2; struct value2 { typedef Iterator<iso::CII> iterator; }; AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CUVP_II
/* * Copyright (c) 2013-2015 Chun-Ying Huang * * This file is part of Smart Beholder (SB). * * SB is free software; you can redistribute it and/or modify it * under the terms of the 3-clause BSD License as published by the * Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause * * SB 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. * * You should have received a copy of the 3-clause BSD License along with SB; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __SERVER_LIVE555_H__ #define __SERVER_LIVE555_H__ int live_server_register_client(void *ccontext); int live_server_unregister_client(void *ccontext); #endif /* __SERVER_LIVE555_H__ */
/* $OpenBSD: phantomas.c,v 1.1 2002/12/18 23:52:45 mickey Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Michael Shalayeff. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES 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 MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <machine/pdc.h> #include <machine/iomod.h> #include <machine/autoconf.h> #include <hppa/dev/cpudevs.h> struct cfdriver phantomas_cd = { NULL, "phantomas", DV_DULL }; struct phantomas_softc { struct device sc_dev; }; int phantomasmatch(struct device *, void *, void *); void phantomasattach(struct device *, struct device *, void *); struct cfattach phantomas_ca = { sizeof(struct phantomas_softc), phantomasmatch, phantomasattach }; int phantomasmatch(struct device *parent, void *cfdata, void *aux) { struct confargs *ca = aux; if (ca->ca_type.iodc_type != HPPA_TYPE_BCPORT || ca->ca_type.iodc_sv_model != HPPA_BCPORT_PHANTOM) return (0); return (1); } void phantomasattach(struct device *parent, struct device *self, void *aux) { struct confargs *ca = aux, nca; printf("\n"); nca = *ca; nca.ca_name = "phantomas"; nca.ca_hpamask = HPPA_IOSPACE; pdc_scanbus(self, &nca, MAXMODBUS); }
/* * Copyright (C) 2009 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 WebSecurityPolicy_h #define WebSecurityPolicy_h #include "../platform/WebCommon.h" #include "../platform/WebReferrerPolicy.h" namespace blink { class WebString; class WebURL; class WebSecurityPolicy { public: // Registers a URL scheme to be treated as a local scheme (i.e., with the // same security rules as those applied to "file" URLs). This means that // normal pages cannot link to or access URLs of this scheme. BLINK_EXPORT static void registerURLSchemeAsLocal(const WebString&); // Registers a URL scheme to be treated as a noAccess scheme. This means // that pages loaded with this URL scheme cannot access pages loaded with // any other URL scheme. BLINK_EXPORT static void registerURLSchemeAsNoAccess(const WebString&); // Registers a URL scheme to be treated as display-isolated. This means // that pages cannot display these URLs unless they are from the same // scheme. For example, pages in other origin cannot create iframes or // hyperlinks to URLs with the scheme. BLINK_EXPORT static void registerURLSchemeAsDisplayIsolated(const WebString&); // Registers a URL scheme to generate mixed content warnings when resources whose // schemes are not registered as "secure" are embedded. BLINK_EXPORT static void registerURLSchemeAsRestrictingMixedContent(const WebString&); // Subresources transported by secure schemes do not trigger mixed content // warnings. For example, https and data are secure schemes because they // cannot be corrupted by active network attackers. BLINK_EXPORT static void registerURLSchemeAsSecure(const WebString&); // Returns true if the scheme has been registered as a secure scheme. BLINK_EXPORT static bool shouldTreatURLSchemeAsSecure(const WebString&); // Registers a non-HTTP URL scheme which can be sent CORS requests. BLINK_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&); // Registers a URL scheme whose resources can be loaded regardless of a page's Content Security Policy. BLINK_EXPORT static void registerURLSchemeAsBypassingContentSecurityPolicy(const WebString&); // Registers a URL scheme for which some kinds of resources bypass Content Security Policy. // This enum should be kept in sync with Source/platform/weborigin/SchemeRegistry.h. // Enforced in AssertMatchingEnums.cpp. enum PolicyAreas : uint32_t { PolicyAreaNone = 0, PolicyAreaImage = 1 << 0, PolicyAreaStyle = 1 << 1, // Add more policy areas as needed by clients. PolicyAreaAll = ~static_cast<uint32_t>(0), }; BLINK_EXPORT static void registerURLSchemeAsBypassingContentSecurityPolicy(const WebString& scheme, PolicyAreas); // Registers a URL scheme as strictly empty documents, allowing them to // commit synchronously. BLINK_EXPORT static void registerURLSchemeAsEmptyDocument(const WebString&); // Support for whitelisting access to origins beyond the same-origin policy. BLINK_EXPORT static void addOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains); BLINK_EXPORT static void removeOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains); BLINK_EXPORT static void resetOriginAccessWhitelists(); // Returns the referrer modified according to the referrer policy for a // navigation to a given URL. If the referrer returned is empty, the // referrer header should be omitted. BLINK_EXPORT static WebString generateReferrerHeader(WebReferrerPolicy, const WebURL&, const WebString& referrer); // Registers an URL scheme to not allow manipulation of the loaded page // by bookmarklets or javascript: URLs typed in the omnibox. BLINK_EXPORT static void registerURLSchemeAsNotAllowingJavascriptURLs(const WebString&); private: WebSecurityPolicy(); }; } // namespace blink #endif
// // PatternFormatterTest.h // // $Id$ // // Definition of the PatternFormatterTest class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef PatternFormatterTest_INCLUDED #define PatternFormatterTest_INCLUDED #include "Poco/Foundation.h" #include "CppUnit/TestCase.h" class PatternFormatterTest: public CppUnit::TestCase { public: PatternFormatterTest(const std::string& name); ~PatternFormatterTest(); void testPatternFormatter(); void setUp(); void tearDown(); static CppUnit::Test* suite(); private: }; #endif // PatternFormatterTest_INCLUDED
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H_ #define ASH_COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H_ #include <memory> #include "ash/components/proximity_auth/messenger_observer.h" #include "ash/components/proximity_auth/remote_device_life_cycle.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/timer/timer.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos { namespace secure_channel { class ClientChannel; class SecureChannelClient; } // namespace secure_channel } // namespace chromeos namespace proximity_auth { class Messenger; // Implementation of RemoteDeviceLifeCycle. class RemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycle, public chromeos::secure_channel::ConnectionAttempt::Delegate, public MessengerObserver { public: // Creates the life cycle for controlling the given |remote_device|. // |proximity_auth_client| is not owned. RemoteDeviceLifeCycleImpl( chromeos::multidevice::RemoteDeviceRef remote_device, absl::optional<chromeos::multidevice::RemoteDeviceRef> local_device, chromeos::secure_channel::SecureChannelClient* secure_channel_client); RemoteDeviceLifeCycleImpl(const RemoteDeviceLifeCycleImpl&) = delete; RemoteDeviceLifeCycleImpl& operator=(const RemoteDeviceLifeCycleImpl&) = delete; ~RemoteDeviceLifeCycleImpl() override; // RemoteDeviceLifeCycle: void Start() override; chromeos::multidevice::RemoteDeviceRef GetRemoteDevice() const override; chromeos::secure_channel::ClientChannel* GetChannel() const override; RemoteDeviceLifeCycle::State GetState() const override; Messenger* GetMessenger() override; void AddObserver(Observer* observer) override; void RemoveObserver(Observer* observer) override; private: // Transitions to |new_state|, and notifies observers. void TransitionToState(RemoteDeviceLifeCycle::State new_state); // Transtitions to FINDING_CONNECTION state. Creates and starts // |connection_finder_|. void FindConnection(); // Creates the messenger which parses status updates. void CreateMessenger(); // chromeos::secure_channel::ConnectionAttempt::Delegate: void OnConnectionAttemptFailure( chromeos::secure_channel::mojom::ConnectionAttemptFailureReason reason) override; void OnConnection(std::unique_ptr<chromeos::secure_channel::ClientChannel> channel) override; // MessengerObserver: void OnDisconnected() override; // The remote device being controlled. const chromeos::multidevice::RemoteDeviceRef remote_device_; // Represents this device (i.e. this Chromebook) for a particular profile. absl::optional<chromeos::multidevice::RemoteDeviceRef> local_device_; // The entrypoint to the SecureChannel API. chromeos::secure_channel::SecureChannelClient* secure_channel_client_; // The current state in the life cycle. RemoteDeviceLifeCycle::State state_; // Observers added to the life cycle. base::ObserverList<Observer>::Unchecked observers_{ base::ObserverListPolicy::EXISTING_ONLY}; // The messenger for sending and receiving messages in the // SECURE_CHANNEL_ESTABLISHED state. std::unique_ptr<Messenger> messenger_; std::unique_ptr<chromeos::secure_channel::ConnectionAttempt> connection_attempt_; // Ownership is eventually passed to |messenger_|. std::unique_ptr<chromeos::secure_channel::ClientChannel> channel_; // After authentication fails, this timer waits for a period of time before // retrying the connection. base::OneShotTimer authentication_recovery_timer_; base::WeakPtrFactory<RemoteDeviceLifeCycleImpl> weak_ptr_factory_{this}; }; } // namespace proximity_auth #endif // ASH_COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_LIFE_CYCLE_IMPL_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. // The pure virtual class for send side loss detection algorithm. #ifndef QUICHE_QUIC_CORE_CONGESTION_CONTROL_LOSS_DETECTION_INTERFACE_H_ #define QUICHE_QUIC_CORE_CONGESTION_CONTROL_LOSS_DETECTION_INTERFACE_H_ #include "quic/core/congestion_control/send_algorithm_interface.h" #include "quic/core/quic_config.h" #include "quic/core/quic_packets.h" #include "quic/core/quic_time.h" #include "quic/core/quic_types.h" #include "quic/platform/api/quic_export.h" namespace quic { class QuicUnackedPacketMap; class RttStats; class QUIC_EXPORT_PRIVATE LossDetectionInterface { public: virtual ~LossDetectionInterface() {} virtual void SetFromConfig(const QuicConfig& config, Perspective perspective) = 0; struct QUIC_NO_EXPORT DetectionStats { // Maximum sequence reordering observed in newly acked packets. QuicPacketCount sent_packets_max_sequence_reordering = 0; QuicPacketCount sent_packets_num_borderline_time_reorderings = 0; // Total detection response time for lost packets from this detection. // See QuicConnectionStats for the definition of detection response time. float total_loss_detection_response_time = 0.0; }; // Called when a new ack arrives or the loss alarm fires. virtual DetectionStats DetectLosses( const QuicUnackedPacketMap& unacked_packets, QuicTime time, const RttStats& rtt_stats, QuicPacketNumber largest_newly_acked, const AckedPacketVector& packets_acked, LostPacketVector* packets_lost) = 0; // Get the time the LossDetectionAlgorithm wants to re-evaluate losses. // Returns QuicTime::Zero if no alarm needs to be set. virtual QuicTime GetLossTimeout() const = 0; // Called when |packet_number| was detected lost but gets acked later. virtual void SpuriousLossDetected( const QuicUnackedPacketMap& unacked_packets, const RttStats& rtt_stats, QuicTime ack_receive_time, QuicPacketNumber packet_number, QuicPacketNumber previous_largest_acked) = 0; virtual void OnConfigNegotiated() = 0; virtual void OnMinRttAvailable() = 0; virtual void OnUserAgentIdKnown() = 0; virtual void OnConnectionClosed() = 0; // Called when a reordering is detected by the loss algorithm, but _before_ // the reordering_shift and reordering_threshold are consulted to see whether // it is a loss. virtual void OnReorderingDetected() = 0; }; } // namespace quic #endif // QUICHE_QUIC_CORE_CONGESTION_CONTROL_LOSS_DETECTION_INTERFACE_H_
/* * The Amsterdam Compiler Kit * See the copyright notice in the ACK home directory, in the file "Copyright". */ #ifndef LANG_CEM_CEMCOM_ANSI_INIT_H #define LANG_CEM_CEMCOM_ANSI_INIT_H /* lang/cem/cemcom.ansi/init.c */ void init_pp(); #endif /* LANG_CEM_CEMCOM_ANSI_INIT_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 COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_ #include "base/macros.h" #include "components/metrics/metrics_provider.h" // The base class for collecting the sign-in status of all opened profiles // during one UMA session and recording the status in a histogram before the UMA // log is uploaded. class SigninStatusMetricsProviderBase : public metrics::MetricsProvider { public: SigninStatusMetricsProviderBase(); SigninStatusMetricsProviderBase(const SigninStatusMetricsProviderBase&) = delete; SigninStatusMetricsProviderBase& operator=( const SigninStatusMetricsProviderBase&) = delete; ~SigninStatusMetricsProviderBase() override; // Possible sign-in status of all opened profiles during one UMA session. For // MIXED_SIGNIN_STATUS, at least one signed-in profile and at least one // unsigned-in profile were opened between two UMA log uploads. Some statuses // are not applicable to all platforms. // // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum SigninStatus { ALL_PROFILES_SIGNED_IN, ALL_PROFILES_NOT_SIGNED_IN, MIXED_SIGNIN_STATUS, UNKNOWN_SIGNIN_STATUS, ERROR_GETTING_SIGNIN_STATUS, SIGNIN_STATUS_MAX, }; // Sets the value of |signin_status_|. It ensures that |signin_status_| will // not be changed if its value is already ERROR_GETTING_SIGNIN_STATUS. void UpdateSigninStatus(SigninStatus new_status); SigninStatus signin_status() const { return signin_status_; } protected: // Record the sign in status into the proper histogram bucket. This should be // called exactly once for each UMA session. void RecordSigninStatusHistogram(SigninStatus signin_status); // Resets the value of |signin_status_| to be UNKNOWN_SIGNIN_STATUS regardless // of its current value; void ResetSigninStatus(); private: // Sign-in status of all profiles seen so far. SigninStatus signin_status_; }; #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_
/* * Copyright 2014 The guava 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 __GUAVA_MODULE_H__ #define __GUAVA_MODULE_H__ #include "guava.h" #include "guava_router/guava_router.h" #include "guava_handler.h" #include "guava_request.h" typedef struct { PyObject_HEAD guava_server_t *server; char *ip; int port; int backlog; char auto_reload; } Server; typedef struct { PyObject_HEAD guava_router_t *router; } Router; typedef struct { PyObject_HEAD guava_session_store_t *store; } SessionStore; typedef struct { PyObject_HEAD guava_handler_t *handler; } Handler; typedef struct { PyObject_HEAD guava_handler_t *handler; } RedirectHandler; typedef struct { PyObject_HEAD guava_handler_t *handler; } StaticHandler; typedef struct { PyObject_HEAD guava_request_t *req; } Request; typedef struct { PyObject_HEAD guava_response_t *resp; } Response; typedef struct { PyObject_HEAD guava_response_t *resp; PyObject *owned_resp; guava_request_t *req; PyObject *owned_req; PyObject *SESSION; guava_router_t *router; } Controller; typedef struct { PyObject_HEAD guava_cookie_t data; } Cookie; extern PyTypeObject HandlerType; extern PyTypeObject RedirectHandlerType; extern PyTypeObject StaticHandlerType; extern PyTypeObject RouterType; extern PyTypeObject RequestType; extern PyTypeObject ControllerType; extern PyTypeObject CookieType; extern PyObject *Handler_new(PyTypeObject *type, PyObject *args, PyObject *kwds); #endif /* !__GUAVA_MODULE_H__ */
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V1_H_ #define UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V1_H_ #include <text-input-unstable-v1-client-protocol.h> #include <string> #include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h" namespace gfx { class Rect; } namespace ui { class WaylandConnection; class WaylandWindow; class ZWPTextInputWrapperV1 : public ZWPTextInputWrapper { public: explicit ZWPTextInputWrapperV1(zwp_text_input_manager_v1* text_input_manager); ~ZWPTextInputWrapperV1() override; void Initialize(WaylandConnection* connection, ZWPTextInputWrapperClient* client) override; void Reset() override; void Activate(WaylandWindow* window) override; void Deactivate() override; void ShowInputPanel() override; void HideInputPanel() override; void SetCursorRect(const gfx::Rect& rect) override; void SetSurroundingText(const base::string16& text, const gfx::Range& selection_range) override; private: void ResetInputEventState(); // zwp_text_input_v1_listener static void OnEnter(void* data, struct zwp_text_input_v1* text_input, struct wl_surface* surface); static void OnLeave(void* data, struct zwp_text_input_v1* text_input); static void OnModifiersMap(void* data, struct zwp_text_input_v1* text_input, struct wl_array* map); static void OnInputPanelState(void* data, struct zwp_text_input_v1* text_input, uint32_t state); static void OnPreeditString(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* text, const char* commit); static void OnPreeditStyling(void* data, struct zwp_text_input_v1* text_input, uint32_t index, uint32_t length, uint32_t style); static void OnPreeditCursor(void* data, struct zwp_text_input_v1* text_input, int32_t index); static void OnCommitString(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* text); static void OnCursorPosition(void* data, struct zwp_text_input_v1* text_input, int32_t index, int32_t anchor); static void OnDeleteSurroundingText(void* data, struct zwp_text_input_v1* text_input, int32_t index, uint32_t length); static void OnKeysym(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, uint32_t time, uint32_t key, uint32_t state, uint32_t modifiers); static void OnLanguage(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, const char* language); static void OnTextDirection(void* data, struct zwp_text_input_v1* text_input, uint32_t serial, uint32_t direction); WaylandConnection* connection_ = nullptr; wl::Object<zwp_text_input_v1> obj_; ZWPTextInputWrapperClient* client_; int32_t preedit_cursor_; }; } // namespace ui #endif // UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V1_H_
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ** following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, this list of conditions and the following ** disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ** following disclaimer in the documentation and/or other materials provided with the distribution. ** * Neither the name of the ETH Zurich 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. ** ***********************************************************************************************************************/ #pragma once #include "../visualizationbase_api.h" #include "TextRenderer.h" #include "ItemWithNode.h" #include "TextStyle.h" #include "ModelBase/src/nodes/Text.h" namespace Visualization { class VISUALIZATIONBASE_API VText : public Super<ItemWithNode<VText, TextRenderer, Model::Text>> { ITEM_COMMON_CUSTOM_STYLENAME(VText, TextStyle) public: VText(Item* parent, NodeType* node, const StyleType* style = itemStyles().get()); virtual bool setText(const QString& newText); virtual bool moveCursor(CursorMoveDirection dir = MoveDefault, QPoint reference = QPoint()) override; protected: virtual QString currentText(); }; }
#import <Foundation/Foundation.h> @interface HYDProperty : NSObject @property (strong, nonatomic) NSString *name; @property (strong, nonatomic) NSDictionary *attributes; - (id)initWithName:(NSString *)name attributes:(NSDictionary *)attributes; - (NSString *)encodingType; - (NSString *)ivarName; - (Class)classType; - (BOOL)isEncodingType:(const char *)encoding; - (BOOL)isObjCObjectType; @end
/* Generates contents of opcode switch from ip_spec.t Call is: mkswitch prefix ip_spec.t cases [ functions ] Note: The u flag has been implemented by just copying and adjusting the code for 2, which is almost identical to that for 4. When this has stabilized, combine. */ /* $Id$ */ #include <stdio.h> extern FILE *popen(); char *progname; FILE *ifp; /* Input File Pointer */ FILE *ofp; /* Output File Pointer */ FILE *ffp = 0; /* Function File Pointer */ char *Prefix; /* Prefix for function name */ main(argc, argv) int argc; char **argv; { char mnem[8]; /* Mnemonic */ char flgs[8]; /* Flags */ char command[32]; progname = argv[0]; if (argc < 4 || argc >5) { fatal("usage is: %s prefix ip_spec.t cases [ functions ]\n", argv[0]); } Prefix = argv[1]; if ((ifp = fopen(argv[2], "r")) == 0) { fatal("cannot open '%s' for reading\n", argv[2]); } if ((ofp = fopen(argv[3], "w")) == 0) { fatal("cannot open '%s' for writing\n", argv[3]); } if (argc == 5) { /* Need to store functions */ sprintf(command, "sort | uniq > %s", argv[4]); if ((ffp = popen(command, "w")) == 0) { fatal("cannot popen '%s'\n", command); } } /* Start reading the input file */ while (fscanf(ifp, "%s %s", mnem, flgs) >= 0) { int i; char *p; char *base; int cnt, first; /* check flags */ for (p = flgs; *p; p++) { if (!in("-ms2u4eNPwo", *p)) { fatal("bad flags ip_spec: %s\n", flgs); } } if ( in(flgs, '-') + in(flgs, 'm') + in(flgs, 's') + in(flgs, '2') + in(flgs, 'u') + in(flgs, '4') != 1 ) { fatal("duplicate or missing opcode flag ip_spec: %s\n", flgs); } if ( in(flgs, 'N') + in(flgs, 'P') > 1 ) { fatal("duplicate restriction flags ip_spec: %s\n", flgs); } /* capitalize mnemonic */ for (p = mnem; *p; p++) { *p += ('A' - 'a'); } /* scan rest of line */ if ( in(flgs, '-') || in(flgs, '2') || in(flgs, 'u') || in(flgs, '4') ) { fscanf(ifp, " %d \n", &first); } else { fscanf(ifp, " %d %d \n", &cnt, &first); } /* determine base */ if (in(flgs, 'e')) /* Escaped (secondary) opcode */ base = "SEC_BASE"; else if (in(flgs, '4')) /* Escaped (tertiary) opcode */ base = "TERT_BASE"; else base = "PRIM_BASE"; /* analyse the opcode */ if (in(flgs, '-')) { /* No arguments */ NoArgs(base, first, mnem); } else if (in(flgs, 'm')) { /* Mini */ for (i = 0; i<cnt; i++) { Mini(i, flgs, base, first, mnem); } } else if (in(flgs, 's')) { /* Shortie */ for (i = 0; i<cnt; i++) { Shortie(i, flgs, base, first, mnem); } } else if (in(flgs, '2')) { /* Two byte signed */ TwoSgn(flgs, base, first, mnem); } else if (in(flgs, 'u')) { /* Two byte unsigned */ TwoUns(flgs, base, first, mnem); } else if (in(flgs, '4')) { /* Four byte signed */ FourSgn(flgs, base, first, mnem); } else { fatal("no opcode flag in ip_spec %s\n", flgs); } } exit(0); } NoArgs(base, first, mnem) char *base; int first; char *mnem; { fprintf(ofp, "\t\tcase %s+%d:\t%s%sz(); break;\n", base, first, Prefix, mnem); if (ffp) { fprintf(ffp, "%s%sz() {", Prefix, mnem); fprintf(ffp, "LOG((\"@ %s%sz()\"));}\n", Prefix, mnem); } } Mini(i, flgs, base, first, mnem) int i; char *flgs; char *base; int first; char *mnem; { char arg[16]; int newi = in(flgs, 'N') ? (-i-1) : in(flgs, 'o') ? (i+1) : i; switch (newi) { case -1: sprintf(arg, "%s", in(flgs, 'w') ? "-wsize" : "-1L"); break; case 0: sprintf(arg, "0L"); break; case 1: sprintf(arg, "%s", in(flgs, 'w') ? "wsize" : "1L"); break; default: sprintf(arg, "%dL%s", newi, in(flgs, 'w') ? "*wsize" : ""); break; } fprintf(ofp, "\t\tcase %s+%d:\t%s%sm(%s); break;\n", base, first+i, Prefix, mnem, arg); if (ffp) { fprintf(ffp, "%s%sm(arg) long arg; {", Prefix, mnem); fprintf(ffp, "LOG((\"@ %s%sm(%%d)\", arg));}\n", Prefix, mnem); } } Shortie(i, flgs, base, first, mnem) int i; char *flgs; char *base; int first; char *mnem; { char arg[16]; int newi = in(flgs, 'N') ? (-i-1) : in(flgs, 'o') ? (i+1) : i; sprintf(arg, "%dL, %s", newi, (in(flgs, 'w') ? "wsize" : "1L")); fprintf(ofp, "\t\tcase %s+%d:\t%s%ss(%s); break;\n", base, first+i, Prefix, mnem, arg); if (ffp) { fprintf(ffp, "%s%ss(hob, wfac) long hob; size wfac; {", Prefix, mnem); fprintf(ffp, "LOG((\"@ %s%ss(%%d)\", hob, wfac));", Prefix, mnem); fprintf(ffp, " newPC(PC+1);}\n"); } } TwoSgn(flgs, base, first, mnem) char *flgs; char *base; int first; char *mnem; { char *xy = in(flgs, 'P') ? "p2" : in(flgs, 'N') ? "n2" : "l2"; fprintf(ofp, "\t\tcase %s+%d:\t%s%s%s(%s); break;\n", base, first, Prefix, mnem, xy, in(flgs, 'w') ? "wsize" : "1L"); if (ffp) { fprintf(ffp, "%s%s%s(arg) long arg; {", Prefix, mnem, xy); fprintf(ffp, "LOG((\"@ %s%s%s(%%d)\", arg));", Prefix, mnem, xy); fprintf(ffp, " newPC(PC+2);}\n"); } } TwoUns(flgs, base, first, mnem) char *flgs; char *base; int first; char *mnem; { char *xy = "u"; fprintf(ofp, "\t\tcase %s+%d:\t%s%s%s(%s); break;\n", base, first, Prefix, mnem, xy, in(flgs, 'w') ? "wsize" : "1L"); if (ffp) { fprintf(ffp, "%s%s%s(arg) long arg; {", Prefix, mnem, xy); fprintf(ffp, "LOG((\"@ %s%s%s(%%d)\", arg));", Prefix, mnem, xy); fprintf(ffp, " newPC(PC+2);}\n"); } } FourSgn(flgs, base, first, mnem) char *flgs; char *base; int first; char *mnem; { char *xy = in(flgs, 'P') ? "p4" : in(flgs, 'N') ? "n4" : "l4"; fprintf(ofp, "\t\tcase %s+%d:\t%s%s%s(%s); break;\n", base, first, Prefix, mnem, xy, in(flgs, 'w') ? "wsize" : "1L"); if (ffp) { fprintf(ffp, "%s%s%s(arg) long arg; {", Prefix, mnem, xy); fprintf(ffp, "LOG((\"@ %s%s%s(%%d)\", arg));", Prefix, mnem, xy); fprintf(ffp, " newPC(PC+4);}\n"); } } int in(flgs, c) char *flgs; char c; { while (*flgs) if (c == *flgs++) return 1; return 0; } fatal(fmt, str) char *fmt; char *str; { fprintf(stderr, "%s, (fatal error): ", progname); fprintf(stderr, fmt, str); fprintf(stderr, "\n"); exit(1); }
/* Copyright (c) 2008-2013, Northwestern 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 the Northwestern 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 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 _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CBAG_INT_NonNeg #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CBAG_INT_NonNeg #include "type_iso.CCOLL_INT_NonNeg.h" namespace AIMXML { namespace iso { class CBAG_INT_NonNeg : public ::AIMXML::iso::CCOLL_INT_NonNeg { public: AIMXML_EXPORT CBAG_INT_NonNeg(xercesc::DOMNode* const& init); AIMXML_EXPORT CBAG_INT_NonNeg(CBAG_INT_NonNeg const& init); void operator=(CBAG_INT_NonNeg const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CBAG_INT_NonNeg); } MemberElement<iso::CINT_NonNeg, _altova_mi_iso_altova_CBAG_INT_NonNeg_altova_item> item; struct item { typedef Iterator<iso::CINT_NonNeg> iterator; }; AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CBAG_INT_NonNeg
// Simple program to send and record ping packets from neighbors over time. // No complicated MAC or timing is used. Rahter, this is meant to discover // asymmetric paths present in the environment. // // Temporary results are stored into flash. Writting to flash is known to be // expensive, but with fresh batteries this application should still run long // enough to give good results. // // Written By: Cyrus Hall <hallc@lu.unisi.ch> // Date: March 6th 2006 // #include <string.h> #include "mos.h" #include "msched.h" #include "clock.h" #include "printf.h" #include "node_id.h" #include "clock.h" #include "com.h" #include "command_daemon.h" #include "led.h" #include "mutex.h" #include "cc2420.h" #include "log.h" #define RECORD_SIZE 8 static comBuf send_buf; void ping_generator(void) { //com_ioctl(IFACE_RADIO, CC2420_TX_POWER, 0x70); //com_ioctl(IFACE_RADIO, CC2420_HIGH_POWER_MODE); com_ioctl(IFACE_RADIO, CC2420_LOW_POWER_MODE); //high byte first buf_insert16(send_buf.data, 0, mos_node_id_get()); send_buf.data[2] = '\0'; //padding to get the radio to send send_buf.size = 3; mos_thread_sleep(1000); while(1) { com_send(IFACE_RADIO, &send_buf); mos_led_toggle(0); mos_thread_sleep(30000); //once every 60 seconds } } void ping_listener(void) { comBuf *recv_buf; uint8_t buf[RECORD_SIZE]; uint16_t rssi; com_mode(IFACE_RADIO, IF_LISTEN); while(1) { recv_buf = com_recv(IFACE_RADIO); rssi = cc2420_get_last_rssi(); if(recv_buf != NULL) { mos_led_toggle(1); printf("recved pkt from %d, rssi %d.\n", buf_extract16(recv_buf->data, 0), rssi); //this procedure uses RECORD_SIZE bytes each write buf_insert32(buf, 0, mos_get_realtime()); buf[4] = recv_buf->data[0]; buf[5] = recv_buf->data[1]; buf_insert32(buf, 6, rssi); if(append_log(buf) == 0) { printf("log is full, quiting.\n"); com_free_buf(recv_buf); return; } com_free_buf(recv_buf); } } } // Print the recorded results to the serial void query_flash() { uint8_t *buf; uint32_t time; uint16_t i, node, rssi; i = 0; printf("---B(%d)---\n", mos_node_id_get()); mos_mutex_lock(&open_log.file_lock); while((buf = read_log_index(i++, NULL)) != NULL) { time = buf_extract32(buf, 0); node = buf_extract16(buf, 4); rssi = buf_extract16(buf, 6); if(time == 0 && node == 0) { printf("reset\n"); } else { //printf("@%l, ping <- %d\n", time, node); printf("%l:%d %d\n", time, node, rssi); } } printf("---E---\n"); mos_mutex_unlock(&open_log.file_lock); } uint8_t read_buf[RECORD_SIZE]; // MOS main init function - initialize devices, filesystem, start threads void start(void) { //clear_log(); mos_command_daemon_init(); mos_register_function("dump", query_flash); mos_register_function("clear", clear_log); reopen_log("log", 0xFFFF, RECORD_SIZE, 0xFF, &read_buf[0]); printf("Starting threads.\n"); mos_thread_new(mos_command_daemon, 192, PRIORITY_NORMAL); printf("\t...command daemon\n"); mos_thread_new(ping_generator, 192, PRIORITY_NORMAL); printf("\t...ping_generator\n"); mos_thread_new(ping_listener, 192, PRIORITY_NORMAL); printf("\t...ping_listener\n"); }
/* * Copyright (c) 2008,2009, Yale Laboratory of Networked Systems * 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 Yale 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 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 ADMIN_STATE_H #define ADMIN_STATE_H #include <stdexcept> #include <queue> #include <map> #include <boost/foreach.hpp> #include <boost/thread.hpp> #include <p4pserver/boost_random.h> #include <p4pserver/logging.h> #include "global_state.h" class admin_error : public std::runtime_error { public: admin_error(const std::string& err) : std::runtime_error(err) {} }; class admin_no_txn_error : public admin_error { public: admin_no_txn_error() : admin_error("No transaction in progress") {} }; class admin_duplicate_txn_error : public admin_error { public: admin_duplicate_txn_error() : admin_error("Transaction already in progress") {} }; class admin_wrong_token_error : public admin_error { public: admin_wrong_token_error() : admin_error("Incorrect token") {} }; class admin_token_generation_error : public admin_error { public: admin_token_generation_error(const std::string& err) : admin_error("Failed to generate token: " + err) {} }; class AdminState; typedef boost::shared_ptr<AdminState> AdminStatePtr; class AdminAction; typedef boost::shared_ptr<AdminAction> AdminActionPtr; class AdminState { public: typedef boost::random_device RNG; typedef uint64_t Token; enum TxnType { TXN_DIRECT_WRITE, TXN_COPY_ON_WRITE, }; static const Token INVALID_TOKEN; static bool string_to_token(const std::string& s, Token& token); static std::string token_to_string(const Token& token); AdminState(); ~AdminState(); Token get_token() const { return token_; } TxnType get_txn_type() const { return txn_type_; } Token txn_begin(const TxnType& type); AdminActionPtr txn_apply(const Token& token, AdminActionPtr action); bool txn_commit(const Token& token); void txn_rollback(const Token& token); /* Methods for use by classes derived from AdminAction */ typedef std::pair<DistributedObjectPtr, boost::shared_ptr<const ReadableLock> > ReadLockRecord; typedef std::pair<DistributedObjectPtr, boost::shared_ptr<const WritableLock> > WriteLockRecord; /* Get the current state being modified */ WriteLockRecord root_ref(); ReadLockRecord read_object_ref(const ReadLockRecord& parent, DistributedObjectPtr obj); WriteLockRecord write_object_ref(const WriteLockRecord& parent, DistributedObjectPtr obj); log4cpp::Category& get_logger() { return logger_; } private: typedef std::list<AdminActionPtr> ActionLog; template <class LockType> void clear_locks(std::map<DistributedObjectPtr, LockType>& ring) { ring.clear(); } template <class LockType> LockType find_lock(const std::map<DistributedObjectPtr, LockType>& ring, DistributedObjectPtr obj) { return (ring.find(obj) != ring.end()) ? ring.find(obj)->second : LockType(); } static const unsigned int MAX_TOKEN_GENERATE_ATTEMPTS = 3; void generate_token(); void check_txn_token(const Token& token); void rollback_changes(); bool process_changes(); DistributedObjectPtr get_target_object(DistributedObjectPtr obj); boost::shared_ptr<const ReadableLock> get_read_lock(DistributedObjectPtr obj); boost::shared_ptr<const WritableLock> get_write_lock(DistributedObjectPtr obj); void clear_txn_state(); //mutable log4cpp::Category& logger_; RNG rng_; boost::mutex mutex_; Token token_; TxnType txn_type_; GlobalStatePtr new_state_; std::map<DistributedObjectPtr, boost::shared_ptr<const UpgradableReadLock> > old_state_locks_; std::map<DistributedObjectPtr, boost::shared_ptr<const WritableLock> > write_locks_; ActionLog unapplied_changes_; ActionLog applied_changes_; boost::thread* monitor_thread_; }; class AdminAction { public: AdminAction() : admin_state_(NULL) {} virtual ~AdminAction() {} virtual bool commit(AdminState* admin) throw (admin_error); virtual bool rollback(AdminState* admin); AdminState::ReadLockRecord get_net_read() throw (admin_error); AdminState::WriteLockRecord get_net_write() throw (admin_error); AdminState::ReadLockRecord get_views_read() throw (admin_error); AdminState::WriteLockRecord get_views_write() throw (admin_error); AdminState* get_admin_state() { return admin_state_; } private: AdminState* admin_state_; }; #endif
// Copyright 2010-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef MOZC_WIN32_TIP_TIP_RANGE_UTIL_H_ #define MOZC_WIN32_TIP_TIP_RANGE_UTIL_H_ #include <Windows.h> #include <InputScope.h> #include <msctf.h> #include <string> #include <vector> #include "base/port.h" namespace mozc { namespace win32 { namespace tsf { // A utility class to handle ITfRange object. class TipRangeUtil { public: // Sets the specified |range| into |context|. // Returns the general result code. static HRESULT SetSelection( ITfContext *context, TfEditCookie edit_cookie, ITfRange *range, TfActiveSelEnd active_sel_end); // Retrieves the default selection from |context| into |range|. // Returns the general result code. static HRESULT GetDefaultSelection( ITfContext *context, TfEditCookie edit_cookie, ITfRange **range, TfActiveSelEnd *active_sel_end); // Retrieves the text from |range| into |text|. // Returns the general result code. static HRESULT GetText( ITfRange *range, TfEditCookie edit_cookie, wstring *text); // Retrieves the input scopes from |range| into |input_scopes|. // Returns the general result code. static HRESULT GetInputScopes(ITfRange *range, TfEditCookie read_cookie, vector<InputScope> *input_scopes); // Checks whether or not |range_test| becomes a subset of |range_cover|. static bool IsRangeCovered(TfEditCookie edit_cookie, ITfRange *range_test, ITfRange *range_cover); // Returns the result of ITfContextView::GetTextExt with a workaround for a // TSF bug which prevents an IME from receiving TF_E_NOLAYOUT error code // correctly from ITfContextView::GetTextExt. The workaround may or may not // work depending on the attached application implements // ITextStoreACP::GetACPFromPoint. static HRESULT GetTextExt(ITfContextView *context_view, TfEditCookie read_cookie, ITfRange *range, RECT *rect, bool *clipped); private: DISALLOW_IMPLICIT_CONSTRUCTORS(TipRangeUtil); }; } // namespace tsf } // namespace win32 } // namespace mozc #endif // MOZC_WIN32_TIP_TIP_RANGE_UTIL_H_
/* ========================================================================= */ /* ------------------------------------------------------------------------- */ /*! \file template.c \date March 2014 \author Nicu Tofan \brief implementation of a template */ /* ------------------------------------------------------------------------- */ /* ========================================================================= */ // // // // /* INCLUDES ------------------------------------------------------------ */ #include "logic.h" #include "template.h" #include <string.h> #include <stdlib.h> /* INCLUDES ============================================================ */ // // // // /* DEFINITIONS --------------------------------------------------------- */ static int logic_template_unchain (logic_template_t *item); /* DEFINITIONS ========================================================= */ // // // // /* DATA ---------------------------------------------------------------- */ /* DATA ================================================================ */ // // // // /* FUNCTIONS ----------------------------------------------------------- */ LOGIC_EXPORT func_exit_code_t logic_template_new ( xpotepu_logic_t * parent, logic_template_t **tpl) { DBG_ASSERT(parent != NULL); DBG_ASSERT(tpl != NULL); logic_template_t * item = NULL; func_exit_code_t ret = FUNC_OK; for (;;) { // allocate and clear item = (logic_template_t*)malloc (sizeof(logic_template_t)); if (item == NULL) { ret = FUNC_MEMORY_ERROR; break; } memset (item, 0, sizeof(logic_template_t)); // set known members item->parent_ = parent; // insert it in the list item->next_ = parent->tpl_; parent->tpl_ = item; break; } *tpl = item; return ret; } LOGIC_EXPORT void logic_template_free (logic_template_t **tpl) { logic_template_t * item = *tpl; if (item != NULL) { // extract and clear logic_template_unchain (item); memset (item, 0, sizeof(logic_template_t)); // release it free (item); *tpl = NULL; } } static int logic_template_unchain (logic_template_t *item) { int ret = 0; // extract it from the chain if (item->parent_ != NULL) { logic_template_t * prev = NULL; logic_template_t * iter = item->parent_->tpl_; while (iter != NULL) { if (iter == item) { if (prev == NULL) { item->parent_->tpl_ = item->next_; } else { prev->next_ = item->next_; } ret = 1; break; } prev = iter; iter = iter->next_; } } return ret; } /* FUNCTIONS =========================================================== */ // // // // /* ------------------------------------------------------------------------- */ /* ========================================================================= */
/******************************************************************************* * Copyright (C) ST-Ericsson SA 2011 * License terms: 3-clause BSD license ******************************************************************************/ #ifndef INCLUSION_GUARD_R_Z_TRANSPORT_LAYER_H #define INCLUSION_GUARD_R_Z_TRANSPORT_LAYER_H /** * @addtogroup ldr_communication_serv * @{ * @addtogroup z_family * @{ * @addtogroup ldr_z_transport_layer Z Transport layer * TI functionalities for sending Z packets, Initialization and * polling receiver and transmitter. * * @{ */ /******************************************************************************* * Includes ******************************************************************************/ #include "t_communication_service.h" #include "error_codes.h" /******************************************************************************* * Declaration of functions ******************************************************************************/ /** * Initializes the transport layer for Z protocol family. * * @param [in] Communication_p Communication module context. * * @retval E_SUCCESS After successful execution. * @retval E_FAILED_TO_INIT_TL unsuccessful initialization. * @retval E_ALLOCATE_FAILED failed to allocate memory space. */ ErrorCode_e Z_Transport_Initialize(const Communication_t *const Communication_p); /** * Shut Down the transport layer for Z protocol family. * * @param [in] Communication_p Communication module context. * * @retval E_SUCCESS After successful execution. */ ErrorCode_e Z_Transport_Shutdown(const Communication_t *const Communication_p); /** * Handles all registered TL processes for Z protocol family. * * @param [in] Communication_p Communication module context. * * @retval E_SUCCESS After successful execution. */ ErrorCode_e Z_Transport_Poll(Communication_t *Communication_p); /** * Function for sending packet in Z protocol family. * * @param [in] Communication_p Communication module context. * @param [in] InputData_p Pointer to the input data. * * @retval E_SUCCESS After successful execution. * @retval E_FAILED_TO_ALLOCATE_COMM_BUFFER Failed to allocate communication * buffer. */ ErrorCode_e Z_Transport_Send(Communication_t *Communication_p, void *InputData_p); /** @} */ /** @} */ /** @} */ #endif // INCLUSION_GUARD_R_Z_TRANSPORT_LAYER_H
#import "GPUImageTwoInputFilter.h" @interface GPUImageLookupFilter : GPUImageTwoInputFilter // How To Use: // 1) Use your favourite photo editing application to apply a filter to lookup.png // For this to work properly each pixel color must not depend on other pixels (e.g. blur will not work). // If you need more complex filter you can create as many lookup tables as required. // E.g. color_balance_lookup_1.png -> GPUImageGaussianBlurFilter -> color_balance_lookup_2.png // 2) Use you new lookup.png file as a second input for GPUImageLookupFilter. // Examples: // TODO: These could be made into GPUImage effects. //- (UIImage*)applyMissEtikateFilter:(UIImage*)image //{ // GPUImagePicture *stillImageSource = [[[GPUImagePicture alloc] initWithImage:image] autorelease]; // GPUImagePicture *lookupImageSource = [[[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup_etikate.png"]] autorelease]; // // GPUImageLookupFilter *lookupFilter = [[[GPUImageLookupFilter alloc] init] autorelease]; // [stillImageSource addTarget:lookupFilter]; // [lookupImageSource addTarget:lookupFilter]; // // [stillImageSource processImage]; // [lookupImageSource processImage]; // return [lookupFilter imageFromCurrentlyProcessedOutput]; //} //- (UIImage*)applySoftEleganceFilter:(UIImage*)image //{ // GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:image]; // GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup_elegance_1.png"]]; // // GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init]; // [stillImageSource addTarget:lookupFilter]; // [lookupImageSource addTarget:lookupFilter]; // // GPUImageGaussianBlurFilter *gaussianBlur = [[GPUImageGaussianBlurFilter alloc] init]; // gaussianBlur.blurSize = 9.7; // [lookupFilter addTarget:gaussianBlur]; // // [stillImageSource processImage]; // [lookupImageSource processImage]; // // UIImage *processedImage = [lookupFilter imageFromCurrentlyProcessedOutput]; // UIImage *blurredImage = [gaussianBlur imageFromCurrentlyProcessedOutput]; // [processedImage retain]; // [blurredImage retain]; // // [gaussianBlur release]; // [lookupFilter release]; // [stillImageSource release]; // [lookupImageSource release]; // // GPUImagePicture *processedSource = [[[GPUImagePicture alloc] initWithImage:processedImage] autorelease]; // GPUImagePicture *blurredSource = [[[GPUImagePicture alloc] initWithImage:blurredImage] autorelease]; // [processedImage release]; // [blurredImage release]; // // GPUImageAlphaBlendFilter *alphaBlend = [[[GPUImageAlphaBlendFilter alloc] init] autorelease]; // alphaBlend.mix = 0.14; // [processedSource addTarget:alphaBlend]; // [blurredSource addTarget:alphaBlend]; // // lookupImageSource = [[[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup_elegance_2.png"]] autorelease]; // // lookupFilter = [[[GPUImageLookupFilter alloc] init] autorelease]; // [alphaBlend addTarget:lookupFilter]; // [lookupImageSource addTarget:lookupFilter]; // // [processedSource processImage]; // [blurredSource processImage]; // [lookupImageSource processImage]; // return [lookupFilter imageFromCurrentlyProcessedOutput]; //} // Additional Info: // Lookup texture is organised as 8x8 quads of 64x64 pixels representing all possible RGB colors: //for (int by = 0; by < 8; by++) { // for (int bx = 0; bx < 8; bx++) { // for (int g = 0; g < 64; g++) { // for (int r = 0; r < 64; r++) { // image.setPixel(r + bx * 64, g + by * 64, qRgb((int)(r * 255.0 / 63.0 + 0.5), // (int)(g * 255.0 / 63.0 + 0.5), // (int)((bx + by * 8.0) * 255.0 / 63.0 + 0.5))); // } // } // } //} @end
#ifndef TH_GENERIC_FILE #define TH_GENERIC_FILE "generic/THLapack.c" #else void THLapack_(gesv)(int n, int nrhs, real *a, int lda, int *ipiv, real *b, int ldb, int* info) { #ifdef __LAPACK__ #if defined(TH_REAL_IS_DOUBLE) extern void dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info); dgesv_(&n, &nrhs, a, &lda, ipiv, b, &ldb, info); #else extern void sgesv_(int *n, int *nrhs, float *a, int *lda, int *ipiv, float *b, int *ldb, int *info); sgesv_(&n, &nrhs, a, &lda, ipiv, b, &ldb, info); #endif #else THError("gesv : Lapack library not found in compile time\n"); #endif return; } void THLapack_(gels)(char trans, int m, int n, int nrhs, real *a, int lda, real *b, int ldb, real *work, int lwork, int *info) { #ifdef __LAPACK__ #if defined(TH_REAL_IS_DOUBLE) extern void dgels_(char *trans, int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *work, int *lwork, int *info); dgels_(&trans, &m, &n, &nrhs, a, &lda, b, &ldb, work, &lwork, info); #else extern void sgels_(char *trans, int *m, int *n, int *nrhs, float *a, int *lda, float *b, int *ldb, float *work, int *lwork, int *info); sgels_(&trans, &m, &n, &nrhs, a, &lda, b, &ldb, work, &lwork, info); #endif #else THError("gels : Lapack library not found in compile time\n"); #endif } void THLapack_(syev)(char jobz, char uplo, int n, real *a, int lda, real *w, real *work, int lwork, int *info) { #ifdef __LAPACK__ #if defined(TH_REAL_IS_DOUBLE) extern void dsyev_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *info); dsyev_(&jobz, &uplo, &n, a, &lda, w, work, &lwork, info); #else extern void ssyev_(char *jobz, char *uplo, int *n, float *a, int *lda, float *w, float *work, int *lwork, int *info); ssyev_(&jobz, &uplo, &n, a, &lda, w, work, &lwork, info); #endif #else THError("syev : Lapack library not found in compile time\n"); #endif } void THLapack_(gesvd)(char jobu, char jobvt, int m, int n, real *a, int lda, real *s, real *u, int ldu, real *vt, int ldvt, real *work, int lwork, int *info) { #ifdef __LAPACK__ #if defined(TH_REAL_IS_DOUBLE) extern void dgesvd_(char *jobu, char *jobvt, int *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info); dgesvd_( &jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, work, &lwork, info); #else extern void sgesvd_(char *jobu, char *jobvt, int *m, int *n, float *a, int *lda, float *s, float *u, int *ldu, float *vt, int *ldvt, float *work, int *lwork, int *info); sgesvd_( &jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, work, &lwork, info); #endif #else THError("gesvd : Lapack library not found in compile time\n"); #endif } #endif
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_WEB_APPLICATIONS_PENDING_APP_MANAGER_IMPL_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_PENDING_APP_MANAGER_IMPL_H_ #include <memory> #include <string> #include <vector> #include "base/callback.h" #include "base/containers/circular_deque.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "chrome/browser/web_applications/components/external_install_options.h" #include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/components/pending_app_manager.h" #include "chrome/browser/web_applications/components/web_app_url_loader.h" #include "chrome/browser/web_applications/pending_app_install_task.h" class GURL; class Profile; namespace content { class WebContents; } // namespace content namespace web_app { class PendingAppRegistrationTaskBase; // Installs, uninstalls, and updates any External Web Apps. This class should // only be used from the UI thread. class PendingAppManagerImpl : public PendingAppManager { public: explicit PendingAppManagerImpl(Profile* profile); ~PendingAppManagerImpl() override; // PendingAppManager: void Install(ExternalInstallOptions install_options, OnceInstallCallback callback) override; void InstallApps(std::vector<ExternalInstallOptions> install_options_list, const RepeatingInstallCallback& callback) override; void UninstallApps(std::vector<GURL> uninstall_urls, ExternalInstallSource install_source, const UninstallCallback& callback) override; void Shutdown() override; void SetUrlLoaderForTesting(std::unique_ptr<WebAppUrlLoader> url_loader); protected: virtual void ReleaseWebContents(); virtual std::unique_ptr<PendingAppInstallTask> CreateInstallationTask( ExternalInstallOptions install_options); virtual std::unique_ptr<PendingAppRegistrationTaskBase> StartRegistration( GURL launch_url); void OnRegistrationFinished(const GURL& launch_url, RegistrationResultCode result) override; Profile* profile() { return profile_; } private: struct TaskAndCallback; void PostMaybeStartNext(); void MaybeStartNext(); void StartInstallationTask(std::unique_ptr<TaskAndCallback> task); bool RunNextRegistration(); void CreateWebContentsIfNecessary(); void OnUrlLoaded(WebAppUrlLoader::Result result); void OnInstalled(PendingAppInstallTask::Result result); void CurrentInstallationFinished(const base::Optional<std::string>& app_id, InstallResultCode code); Profile* const profile_; ExternallyInstalledWebAppPrefs externally_installed_app_prefs_; // unique_ptr so that it can be replaced in tests. std::unique_ptr<WebAppUrlLoader> url_loader_; std::unique_ptr<content::WebContents> web_contents_; std::unique_ptr<TaskAndCallback> current_install_; base::circular_deque<std::unique_ptr<TaskAndCallback>> pending_installs_; std::unique_ptr<PendingAppRegistrationTaskBase> current_registration_; base::circular_deque<GURL> pending_registrations_; base::WeakPtrFactory<PendingAppManagerImpl> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(PendingAppManagerImpl); }; } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_PENDING_APP_MANAGER_IMPL_H_
/* ECE-C433 Project 2 * Part 1b * Author: Sean Barag */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #include <pcap/pcap.h> void main() { /* check for root uid :) */ if( getuid() != 0 ) { fprintf(stderr, "Error: You must this application as root, either via sudo or su.\nExiting...\n"); exit(-1); } /* return for various functions */ int status = 0; /* error buffer */ char errbuf[PCAP_ERRBUF_SIZE]; /* linked list of all devices that can be opened with pcap_open_live and * friends */ pcap_if_t *all_devs; /* iterator for all_devs. I want to maintain that list's HEAD */ pcap_if_t *devs_it; /* temporary storage for an interface's address info */ pcap_addr_t *temp_addr; char *addr; char *nm; /* populate all_devs */ status = pcap_findalldevs(&all_devs, errbuf); if( status != 0 ) { fprintf(stderr, "pcap_findalldevs() failed. The following error was produced:\n\t%s\n", errbuf); exit(-1); } else if( all_devs == NULL ) { printf("No devices were found. Bummer!\n"); } else { devs_it = all_devs; printf("Name\tIP address\tNetmask\n------\t---------------\t---------------\n"); while( devs_it != NULL ) { /* avoid loopback */ if( devs_it->flags != PCAP_IF_LOOPBACK ) { temp_addr = devs_it->addresses; while( temp_addr != NULL ) { if( temp_addr->netmask != NULL ) { /* check for IPv4 */ if( temp_addr->addr->sa_family == AF_INET && temp_addr->netmask->sa_family == AF_INET ) { /* It seems you can't have two calls to inet_ntoa * in a single printf, or you'll get the first * returned value printed twice. WEIRD. */ printf("%6s\t%15s", devs_it->name, // name inet_ntoa( ( (struct sockaddr_in *)temp_addr->addr)->sin_addr ) ); // IP printf("\t%15s\n", inet_ntoa( ( (struct sockaddr_in *)temp_addr->netmask)->sin_addr ) ); // netmask } } temp_addr = temp_addr->next; } } devs_it = devs_it->next; } } /* free the list of devices */ pcap_freealldevs(all_devs); }
/* * 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. */ #pragma once #include <ABI44_0_0React/ABI44_0_0renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h> #include <ABI44_0_0React/ABI44_0_0renderer/core/ConcreteComponentDescriptor.h> namespace ABI44_0_0facebook { namespace ABI44_0_0React { class LegacyViewManagerInteropComponentDescriptor final : public ConcreteComponentDescriptor<LegacyViewManagerInteropShadowNode> { public: using ConcreteComponentDescriptor::ConcreteComponentDescriptor; LegacyViewManagerInteropComponentDescriptor( ComponentDescriptorParameters const &parameters); /* * Returns `name` and `handle` based on a `flavor`, not on static data from * `LegacyViewManagerInteropShadowNode`. */ ComponentHandle getComponentHandle() const override; ComponentName getComponentName() const override; protected: void adopt(ShadowNode::Unshared shadowNode) const override; private: std::shared_ptr<void> const _coordinator; }; } // namespace ABI44_0_0React } // namespace ABI44_0_0facebook
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ** following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, this list of conditions and the ** following disclaimer. ** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ** following disclaimer in the documentation and/or other materials provided with the distribution. ** * Neither the name of the ETH Zurich 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. ** **********************************************************************************************************************/ #pragma once #include "../comments_api.h" #include "VisualizationBase/src/items/Item.h" #include "VisualizationBase/src/items/ItemStyle.h" #include "VisualizationBase/src/items/ItemWithNode.h" #include "VisualizationBase/src/renderer/ModelRenderer.h" #include "../nodes/CommentDiagram.h" #include "../nodes/CommentNode.h" namespace Comments { class VCommentDiagramShape; class VCommentDiagramConnector; class COMMENTS_API VCommentDiagram : public Super<Visualization::ItemWithNode<VCommentDiagram, Visualization::Item, CommentDiagram> > { ITEM_COMMON_CUSTOM_STYLENAME(VCommentDiagram, Visualization::ItemStyle) public: VCommentDiagram(Visualization::Item* parent, NodeType* node); void resize(QSize size); QPoint lastRightClick() const; void setLastRightClick(QPoint pos); bool editing() const; void toggleEditing(); bool showConnectorPoints() const; void setShowConnectorPoints(bool show); QPair<int,int> lastConnector() const; void setLastConnector(int shape, int point); VCommentDiagramShape* diagramShape(int index); protected: virtual void determineChildren() override; virtual void updateGeometry(int availableWidth, int availableHeight) override; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; private: const static int EDIT_OUTLINE_SIZE = 10; QVector<VCommentDiagramShape*> shapes_; QVector<VCommentDiagramConnector*> connectors_; bool editing_{}; bool showConnectorPoints_{}; QPair<int,int> lastConnector_{-1, -1}; QPoint lastRightClick_; template <class T> void synchronizeWithNodes(const QVector<Model::Node*>& nodes, QVector<T*>& destination); void clearChildren(); }; inline QPoint VCommentDiagram::lastRightClick() const { return lastRightClick_; } inline void VCommentDiagram::setLastRightClick(QPoint pos) { lastRightClick_ = pos; } inline bool VCommentDiagram::editing() const { return editing_; } inline bool VCommentDiagram::showConnectorPoints() const { return editing() && showConnectorPoints_; } inline QPair<int,int> VCommentDiagram::lastConnector() const { return lastConnector_; } inline void VCommentDiagram::setLastConnector(int shape, int point) { lastConnector_ = qMakePair(shape, point); } inline VCommentDiagramShape* VCommentDiagram::diagramShape(int index) { return shapes_.at(index);} } /* namespace Comments */
// Copyright 2019 The Cobalt Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef STARBOARD_ELF_LOADER_RELOCATIONS_H_ #define STARBOARD_ELF_LOADER_RELOCATIONS_H_ #include "starboard/elf_loader/elf.h" #include "starboard/elf_loader/dynamic_section.h" #include "starboard/elf_loader/program_table.h" namespace starboard { namespace elf_loader { enum RelocationType { RELOCATION_TYPE_UNKNOWN = 0, RELOCATION_TYPE_ABSOLUTE = 1, RELOCATION_TYPE_RELATIVE = 2, RELOCATION_TYPE_PC_RELATIVE = 3, RELOCATION_TYPE_COPY = 4, }; // class representing the ELF relocations. class Relocations { public: Relocations(Addr base_memory_address, DynamicSection* dynamic_section, ExportedSymbols* exported_symbols); // Initialize the relocation tables. bool InitRelocations(); // Apply all the relocations. bool ApplyAllRelocations(); // Apply a set of relocations. bool ApplyRelocations(const rel_t* rel, size_t rel_count); // Apply an individual relocation. bool ApplyRelocation(const rel_t* rel); // Apply a resolved symbol relocation. #if defined(USE_RELA) bool ApplyResolvedReloc(const Rela* rela, Addr sym_addr); #else bool ApplyResolvedReloc(const Rel* rel, Addr sym_addr); #endif // Convert an ELF relocation type info a RelocationType value. RelocationType GetRelocationType(Word r_type); // Resolve a symbol address. bool ResolveSymbol(Word rel_type, Word rel_symbol, Addr reloc, Addr* sym_addr); // Checks if there are any text relocations. bool HasTextRelocations(); private: Addr base_memory_address_; DynamicSection* dynamic_section_; Addr plt_relocations_; size_t plt_relocations_size_; Addr* plt_got_; Addr relocations_; size_t relocations_size_; bool has_text_relocations_; bool has_symbolic_; ExportedSymbols* exported_symbols_; Relocations(const Relocations&) = delete; void operator=(const Relocations&) = delete; }; } // namespace elf_loader } // namespace starboard #endif // STARBOARD_ELF_LOADER_RELOCATIONS_H_
// Copyright(C) 1999-2017 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // // * Neither the name of NTESS nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef IOSS_Ioss_Quad6_h #define IOSS_Ioss_Quad6_h #include <Ioss_CodeTypes.h> // for IntVector #include <Ioss_ElementTopology.h> // for ElementTopology // STL Includes namespace Ioss { class Quad6 : public Ioss::ElementTopology { public: static constexpr auto name = "quad6"; static void factory(); Quad6(const Quad6 &) = delete; ~Quad6() override; ElementShape shape() const override { return ElementShape::QUAD; } int spatial_dimension() const override; int parametric_dimension() const override; bool is_element() const override { return true; } int order() const override; bool edges_similar() const override { return false; } // true if all edges have same topology int number_corner_nodes() const override; int number_nodes() const override; int number_edges() const override; int number_faces() const override; int number_nodes_edge(int edge = 0) const override; int number_nodes_face(int face = 0) const override; int number_edges_face(int face = 0) const override; Ioss::IntVector edge_connectivity(int edge_number) const override; Ioss::IntVector face_connectivity(int face_number) const override; Ioss::IntVector element_connectivity() const override; Ioss::ElementTopology *face_type(int face_number = 0) const override; Ioss::ElementTopology *edge_type(int edge_number = 0) const override; private: static Quad6 instance_; Quad6(); }; } // namespace Ioss #endif
/* * Copyright (C) 2003 Fujio Nobori (toh@fuji-climb.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: PortForwarder_inc.h,v 1.6 2006/11/05 14:23:25 ozawa Exp $ */ #ifndef PORTFORWARDER_INC_H #define PORTFORWARDER_INC_H #define FD_SETSIZE 128 /* default is 64 in winsock2.h. is this value safe enough? */ #include <winsock2.h> #define APP_NAME "PortForwarder" #define PF_STAT_NOT_CONNECTED 0 #define PF_STAT_CONNECTING 1 #define PF_STAT_CONNECTED 2 #define PF_STAT_DISCONNECTING 3 #define PF_STRING_NOT_CONNECTED TEXT("Not connected") #define PF_STRING_CONNECTING TEXT("Connecting...") #define PF_STRING_CONNECTED TEXT("Connected") #define PF_STRING_DISCONNECTING TEXT("Disconnecting...") #define MSG_THREAD_END WM_APP + 1 #define MSG_TRAY_CLICKED WM_APP + 2 #define MSG_FATAL_CALLED WM_APP + 3 #define MSG_CONNECTED WM_APP + 4 #define MSG_SHOW_MESSAGEBOX WM_APP + 6 #define MSG_GET_PASSPHRASE WM_APP + 7 #define MAX_LINE 1024 #define MAX_HOST_NUM 10 #define IN_LOOPBACKNET 127 #define EINPROGRESS WSAEWOULDBLOCK #define strcasecmp(s1, s2) _stricmp(s1, s2) #define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) #define strerror(errno) GetErrMsg() #ifndef _INC_IO /* io.h has write() and read(), but it seems those doesn't * work for sockets. */ #define close(s) closesocket(s) int write(SOCKET s, void *buf, int len); int read(SOCKET s, void *buf, int len); int isatty(int handle); #ifdef _PFPROXY_ extern BOOL isProxy; /* TRUE = using proxy command. FALSE = not */ extern HANDLE hProxy; /* process handle of the proxy command */ extern HANDLE hWriteToProxy; /* pipe handle: PF --> proxy's stdin */ extern HANDLE hReadFromProxy; /* pipe handle: PF <-- proxy's stdout */ #define PIPE_IN_DUMMY_SOCKET ((SOCKET)(-2)) /* dummy for variable 'connection_in' */ #define PIPE_OUT_DUMMY_SOCKET ((SOCKET)(-3)) /* dummy for variable 'connection_out' */ int myselect(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, const struct timeval *timeout); /* pipe operation added select() */ #define select(n, r, w, e, t) (myselect(n, r, w, e, t)) #endif /* _PFPROXY_ */ #endif /* _INC_IO */ char* GetErrMsg(); void ThreadExit(); unsigned int sleep(unsigned int seconds); /* Struct for MessageBox info. */ typedef struct msgboxinfo { char* caption; const char* message; unsigned int type; unsigned int result; } msgboxinfo; /* Struct for AskPassphraseDialog info. */ typedef struct askpassinfo { const char* prompt; char* result; } askpassinfo; /* dummy __attribute__ to compile by non GCC */ #ifndef __attribute__ #define __attribute__(x) #endif /* __attribute__ */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ int main(); int GetStatus(); void SetStatus(int stat); extern char pf_option[64]; #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* PORTFORWARDER_INC_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 EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_ #include <memory> #include "base/macros.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_gatt_connection.h" #include "extensions/browser/api/api_resource.h" #include "extensions/browser/api/api_resource_manager.h" namespace extensions { // An ApiResource wrapper for a device::BluetoothGattConnection. class BluetoothLowEnergyConnection : public ApiResource { public: explicit BluetoothLowEnergyConnection( bool persistent, const std::string& owner_extension_id, std::unique_ptr<device::BluetoothGattConnection> connection); ~BluetoothLowEnergyConnection() override; // Returns a pointer to the underlying connection object. device::BluetoothGattConnection* GetConnection() const; // ApiResource override. bool IsPersistent() const override; // This resource should be managed on the UI thread. static const content::BrowserThread::ID kThreadId = content::BrowserThread::UI; private: friend class ApiResourceManager<BluetoothLowEnergyConnection>; static const char* service_name() { return "BluetoothLowEnergyConnectionManager"; } // True, if this resource should be persistent. bool persistent_; // The connection is owned by this instance and will automatically disconnect // when deleted. std::unique_ptr<device::BluetoothGattConnection> connection_; DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection); }; } // namespace extensions #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_
#include <pthread.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <assert.h> #define THREAD_SIZE 8 void *job1(void *arg) { pthread_t pid = pthread_self(); sleep(1); printf("job1: print %p\n", arg); printf("job1: pthread_self: %lu\n", pid); sleep(1); return arg; } void *job2(void *arg) { pthread_t pid = pthread_self(); sleep(1); printf("job2: print %p\n", arg); printf("job2: pthread_self: %lu\n", pid); sleep(1); pthread_exit(NULL); return arg; } void *job3(void *arg) { pthread_t pid = pthread_self(); pthread_detach(pid); sleep(1); printf("job3: print %p\n", arg); printf("job3: pthread_self: %lu\n", pid); sleep(1); return arg; } void *job4(void *arg) { pthread_t pid = pthread_self(); pthread_detach(pid); sleep(1); printf("job4: print %p\n", arg); printf("job4: pthread_self: %lu\n", pid); sleep(1); return arg; } int main() { pthread_t tid1[THREAD_SIZE]; pthread_t tid2[THREAD_SIZE]; pthread_t tid3[THREAD_SIZE]; pthread_t tid4[THREAD_SIZE]; int i; void *res; for (i = 0; i < THREAD_SIZE; i++) { assert(pthread_create(&tid1[i], NULL, job1, (void*)i) == 0); assert(pthread_create(&tid2[i], NULL, job2, (void*)i) == 0); assert(pthread_create(&tid3[i], NULL, job3, (void*)i) == 0); assert(pthread_create(&tid4[i], NULL, job4, (void*)i) == 0); } for (i = 0; i < THREAD_SIZE; i++) { assert(pthread_join(tid1[i], &res) == 0); assert(res == (void*)i); assert(pthread_join(tid2[i], &res) == 0); assert(res == NULL); } return 0; }