text
stringlengths
4
6.14k
/*************************************************************************** * Copyright (C) 2005 by * * Alejandro Perez Mendez alex@um.es * * Pedro J. Fernandez Ruiz pedroj@um.es * * * * This software may be modified and distributed under the terms * * of the Apache license. See the LICENSE file for details. * ***************************************************************************/ #ifndef OPENIKEV2IDTEMPLATEDOMAINNAME_H #define OPENIKEV2IDTEMPLATEDOMAINNAME_H #include <libopenikev2/idtemplate.h> namespace openikev2 { /** This class implements the IdTemplate abstract class, requiring that the type was RFC822 or FQDN and that the domain was the indicated one @author Alejandro Perez Mendez, Pedro J. Fernandez Ruiz <alex@um.es, pedroj@um.es> */ class IdTemplateDomainName : public IdTemplate { /****************************** ATTRIBUTES ******************************/ protected: string domainname; /**< Domain name */ /****************************** METHODS ******************************/ public: IdTemplateDomainName( string domainname ); virtual bool match( const ID& id ) const; virtual auto_ptr<IdTemplate> clone() const; virtual string toStringTab( uint8_t tabs ) const; virtual ~IdTemplateDomainName(); }; } #endif
// // Copyright 2020 Google LLC // // 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 THIRD_PARTY_CLOUD_SPANNER_EMULATOR_TESTS_COMMON_ROW_READER_H_ #define THIRD_PARTY_CLOUD_SPANNER_EMULATOR_TESTS_COMMON_ROW_READER_H_ #include <memory> #include <vector> #include "zetasql/public/type.h" #include "zetasql/public/value.h" #include "absl/memory/memory.h" #include "backend/access/read.h" #include "backend/common/case.h" #include "common/errors.h" #include "tests/common/row_cursor.h" #include "absl/status/status.h" namespace google { namespace spanner { namespace emulator { namespace test { // A helper RowCursor which wraps another RowCursor and exposes a subset of its // columns. class ColumnRemappedRowCursor : public backend::RowCursor { public: ColumnRemappedRowCursor(std::unique_ptr<RowCursor> wrapped_cursor, std::vector<std::string> column_names) : wrapped_cursor_(std::move(wrapped_cursor)) { for (const std::string& column_name : column_names) { for (int i = 0; i < wrapped_cursor_->NumColumns(); ++i) { if (wrapped_cursor_->ColumnName(i) == column_name) { column_index_map_.push_back(i); break; } } } ZETASQL_DCHECK_EQ(column_index_map_.size(), column_names.size()); } bool Next() override { return wrapped_cursor_->Next(); } absl::Status Status() const override { return wrapped_cursor_->Status(); } int NumColumns() const override { return column_index_map_.size(); } const std::string ColumnName(int i) const override { return wrapped_cursor_->ColumnName(column_index_map_[i]); } const zetasql::Value ColumnValue(int i) const override { return wrapped_cursor_->ColumnValue(column_index_map_[i]); } const zetasql::Type* ColumnType(int i) const override { return wrapped_cursor_->ColumnType(column_index_map_[i]); } private: std::unique_ptr<backend::RowCursor> wrapped_cursor_; std::vector<int> column_index_map_; }; // A fake implementation of DBReader for testing purposes. // // 'index' and 'key_set' in the input are ignored. class TestRowReader : public backend::RowReader { public: struct Table { std::vector<std::string> column_names; std::vector<const zetasql::Type*> column_types; std::vector<std::vector<zetasql::Value>> column_values; }; explicit TestRowReader(backend::CaseInsensitiveStringMap<Table> tables) : tables_(tables) {} absl::Status Read(const backend::ReadArg& read_arg, std::unique_ptr<backend::RowCursor>* cursor) override { std::string table_name = read_arg.table; if (!tables_.contains(table_name)) { return google::spanner::emulator::error::TableNotFound(table_name); } *cursor = absl::make_unique<ColumnRemappedRowCursor>( absl::make_unique<TestRowCursor>(tables_[table_name].column_names, tables_[table_name].column_types, tables_[table_name].column_values), read_arg.columns); return absl::OkStatus(); } private: backend::CaseInsensitiveStringMap<Table> tables_; }; } // namespace test } // namespace emulator } // namespace spanner } // namespace google #endif // THIRD_PARTY_CLOUD_SPANNER_EMULATOR_TESTS_COMMON_ROW_READER_H_
// // QYCycleCollectReform.h // 骑阅 // // Created by chen liang on 2017/3/24. // Copyright © 2017年 chen liang. All rights reserved. // #import <Foundation/Foundation.h> #import "CTAPIBaseManager.h" @interface QYCycleCollectReform : NSObject<CTAPIManagerDataReformer> @end
/* * RoleBulletYellow.h * * Created on: 2015-11-6 * Author: hsy */ #ifndef ROLEBULLETYELLOW_H_ #define ROLEBULLETYELLOW_H_ #include "Role.h" class RoleBulletYellow: public Role, public Sprite { public: RoleBulletYellow(); virtual ~RoleBulletYellow(); // from Role virtual void hit(Role* target); virtual void gotDamage(int damage); virtual void gotSupply(int supply); virtual void down(); virtual bool init(float x, float y); static RoleBulletYellow* create(float x, float y); }; #endif /* ROLEBULLETYELLOW_H_ */
// // UIBarButtonItem+DCBarButtonItem.h // CDDStoreDemo // // Created by apple on 2017/3/19. // Copyright © 2017年 apple. All rights reserved. // #import <UIKit/UIKit.h> @interface UIBarButtonItem (DCBarButtonItem) #pragma - Highlighted + (UIBarButtonItem *)ItemWithImage:(UIImage *)image WithHighlighted:(UIImage *)HighlightedImage Target:(id)target action:(SEL)action; #pragma - Selected + (UIBarButtonItem *)ItemWithImage:(UIImage *)image WithSelected:(UIImage *)SelectedImage Target:(id)target action:(SEL)action; #pragma - title + (UIBarButtonItem *)backItemWithImage:(UIImage *)image WithHighlightedImage:(UIImage *)HighlightedImage Target:(id)target action:(SEL)action title:(NSString *)title; @end
// // Document.h // HXTemplateWorkshopOSX_Sample // // Created by Jean-François CONTART on 16/03/2016. // // #import <Cocoa/Cocoa.h> @interface Document : NSPersistentDocument @end
/* * Copyright 2014 Olivier WENGER * http://www.magicspark.org/ or http://oulydev.free.fr/ * * 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 __MMF2EXT_ISHELLLINK_COMMON_H__ #define __MMF2EXT_ISHELLLINK_COMMON_H__ #if defined(_DEBUG) && defined(WIN32) #define _CRTDBG_MAP_ALLOC (1) #endif #define IN_EXT_VERSION2 #define COXSDK // ---------------------------------------------- // VERSION AND BUILD YOUR EXTENSION CAN WORK WITH // ---------------------------------------------- //#define TGFEXT // TGF, MMF Standard and MMF Pro #define MMFEXT // MMF Standard and MMF Pro //#define PROEXT // MMF Pro only // Build number of the minimum required version of MMF #define MINBUILD (246) // General includes #include "ccxhdr.h" #include "Surface.h" // Specific to this cox #include "resource.h" #include "main.h" // Globals and Prototypes extern HINSTANCE hInstLib; extern short actionsInfos[]; extern short conditionsInfos[]; extern short expressionsInfos[]; short (WINAPI * ActionJumps[])(LPRDATA rdPtr, long param1, long param2); long (WINAPI * ConditionJumps[])(LPRDATA rdPtr, long param1, long param2); long (WINAPI * ExpressionJumps[])(LPRDATA rdPtr, long param); // Used to ensure the MMF version is 1.5, you can safely ignore this #if defined(MMFEXT) #define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= MINBUILD && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_HOME) == 0) #elif defined(PROEXT) #define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= MINBUILD && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20 && ((v->mvGetVersion() & MMFVERFLAG_MASK) & MMFVERFLAG_PRO) != 0) #else #define IS_COMPATIBLE(v) (v->mvGetVersion != NULL && (v->mvGetVersion() & MMFBUILD_MASK) >= MINBUILD && (v->mvGetVersion() & MMFVERSION_MASK) >= MMFVERSION_20) #endif #endif /* __MMF2EXT_ISHELLLINK_COMMON_H__ */ /* END OF FILE */
/* * ScoreData.h * mert - Minimum Error Rate Training * * Created by Nicola Bertoldi on 13/05/08. * */ #ifndef MERT_SCORE_DATA_H_ #define MERT_SCORE_DATA_H_ #include <iosfwd> #include <vector> #include <stdexcept> #include <string> #include "ScoreArray.h" #include "ScoreStats.h" namespace MosesTuning { class Scorer; class ScoreData { private: // Do not allow the user to instanciate without arguments. ScoreData() {} scoredata_t m_array; idx2name m_index_to_array_name; // map from index to name of array name2idx m_array_name_to_index; // map from name to index of array Scorer* m_scorer; std::string m_score_type; std::size_t m_num_scores; public: ScoreData(Scorer* scorer); ~ScoreData() {} void clear() { m_array.clear(); } inline ScoreArray& get(std::size_t idx) { return m_array.at(idx); } inline const ScoreArray& get(std::size_t idx) const { return m_array.at(idx); } inline bool exists(int sent_idx) const { return existsInternal(getIndex(sent_idx)); } inline bool existsInternal(int sent_idx) const { return (sent_idx > -1 && sent_idx < static_cast<int>(m_array.size())) ? true : false; } inline ScoreStats& get(std::size_t i, std::size_t j) { return m_array.at(i).get(j); } inline const ScoreStats& get(std::size_t i, std::size_t j) const { return m_array.at(i).get(j); } std::string name() const { return m_score_type; } std::string name(const std::string &score_type) { return m_score_type = score_type; } void add(ScoreArray& e); void add(const ScoreStats& e, int sent_idx); std::size_t NumberOfScores() const { return m_num_scores; } std::size_t size() const { return m_array.size(); } void save(const std::string &file, bool bin=false); void save(std::ostream* os, bool bin=false); void save(bool bin=false); void load(std::istream* is); void load(const std::string &file); bool check_consistency() const; void setIndex(); inline int getIndex(const int idx) const { name2idx::const_iterator i = m_array_name_to_index.find(idx); if (i != m_array_name_to_index.end()) return i->second; else return -1; } inline int getName(std::size_t idx) const { idx2name::const_iterator i = m_index_to_array_name.find(idx); if (i != m_index_to_array_name.end()) throw std::runtime_error("there is no entry at index " + idx); return i->second; } }; } #endif // MERT_SCORE_DATA_H_
// // Tool.h // 报时器 // // Created by Yumi on 15/12/18. // Copyright (c) 2015年 yumi. All rights reserved. // #import <Foundation/Foundation.h> @interface Tool : NSObject + (void)playSound:(NSString *)soundName; + (void)disposeSound:(NSString *)soundName; + (void)disposeAllSounds; + (NSDate *)dateWithTime:(NSString *)time; + (BOOL)isSharpTime:(NSString *)time; + (void)archiveTimes:(NSArray *)times; + (NSArray *)unarchiveTimes; + (void)archivePreference:(id)obj ForKey:(NSString *)key; + (id)unarchivePreferenceForKey:(NSString *)key; + (void)registerLocalNotification; + (void)scheduleLocalNotificationWithSoundName:(NSString *)soundName fireTime:(NSString *)time; + (void)cancelLocalNotifications; + (BOOL)isLaterIOS8; @end
/** * @copyright Copyright 2017 The J-PET Framework 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 find a copy of the License in the LICENCE file. * * 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. * * @file ImageReco.h */ #ifndef IMAGERECO_H #define IMAGERECO_H #ifdef __CINT__ //when cint is used instead of compiler, override word is not recognized //nevertheless it's needed for checking if the structure of project is correct #define override #endif #include "JPetUserTask/JPetUserTask.h" #include <memory> /** * @brief Image reconstruction module which should be used for quick, rough data tests. * * It implements a simple image reconstruction algorithm adapted from G. Korcyl's code. * It is equivalent to one back-projection without any filtering but including TOF information, * with the assumption that TOF error = 0. Before reconstructruction, the data are not preselected * it should be preselected using FilterEvents Task. * The point of annihilation is reconstructed for all combination of registered hits in given events. * Additional optional options: * - ImageReco_Annihilation_Point_Z_float * - ImageReco_Xrange_On_3D_Histogram_int * - ImageReco_Yrange_On_3D_Histogram_int * - ImageReco_Zrange_On_3D_Histogram_int * - ImageReco_Bin_Multiplier_double */ class ImageReco : public JPetUserTask { public: ImageReco(const char* name); virtual ~ImageReco(); virtual bool init() override; virtual bool exec() override; virtual bool terminate() override; private: /* Calculated as: * x = hit1.X + (vdx / 2.0) + ((vdx / sqrt(|vdx^2 + vdy^2 + vdz^2|) * TOF)) * y = hit1.Y + (vdy / 2.0) + ((vdy / sqrt(|vdx^2 + vdy^2 + vdz^2|) * TOF)) * z = hit1.Z + (vdz / 2.0) + ((vdz / sqrt(|vdx^2 + vdy^2 + vdz^2|) * TOF)) * * Where TOF is calculated as: * if hit1.Y > hit2.Y * TOF = ((hit1.timeA + hit1.timeB) / 2.0) - ((hit2.timeA + hit2.timeB) / 2.0) * 30 * else: * TOF = ((hit2.timeA + hit2.timeB) / 2.0) - ((hit1.timeA + hit1.timeB) / 2.0) * 30 */ bool calculateAnnihilationPoint(const JPetHit& firstHit, const JPetHit& secondHit); void setUpOptions(); const std::string kCutOnAnnihilationPointZKey = "ImageReco_Annihilation_Point_Z_float"; const std::string kXRangeOn3DHistogramKey = "ImageReco_Xrange_On_3D_Histogram_int"; const std::string kYRangeOn3DHistogramKey = "ImageReco_Yrange_On_3D_Histogram_int"; const std::string kZRangeOn3DHistogramKey = "ImageReco_Zrange_On_3D_Histogram_int"; const std::string kBinMultiplierKey = "ImageReco_Bin_Multiplier_double"; int fXRange = 50; int fYRange = 50; int fZRange = 30; double fBinMultiplier = 12; int fNumberOfBinsX = fXRange * fBinMultiplier; //1 bin is 8.33 mm, TBufferFile cannot write more then 1073741822 bytes int fNumberOfBinsY = fYRange * fBinMultiplier; int fNnumberOfBinsZ = fZRange * fBinMultiplier; float fANNIHILATION_POINT_Z = 23; const int kNumberOfHitsInEventHisto = 10; const int kNumberOfConditions = 6; }; #endif /* !IMAGERECO_H */
// Copyright 2015, 2016 Thomas Trapp // // 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 HEXT_BUILTINS_H_INCLUDED #define HEXT_BUILTINS_H_INCLUDED /// @file /// Contains every predefined CaptureFunction. #include "hext/CaptureFunction.h" #include "hext/Visibility.h" namespace hext { /// A CaptureFunction that returns the text of an HTML element. /// The intent is to mimic functions like jQuery's text(), IE's innerText() or /// textContent(). /// /// @par Example: /// ~~~~~~~~~~~~~ /// GumboNode * node = ...; // <div> like<div>a</div>rolling stone</div> /// assert(TextBuiltin(node) == "like a rolling stone"); /// ~~~~~~~~~~~~~ /// /// @param node: A pointer to a GumboNode. /// @returns A string containing the HTML element's text. HEXT_PUBLIC extern const CaptureFunction TextBuiltin; /// A CaptureFunction that returns the inner HTML of an HTML element. /// The intent is to mimic innerHtml(). /// /// @par Example: /// ~~~~~~~~~~~~~ /// GumboNode * node = ...; // <div> like<div>a</div>rolling stone</div> /// assert(InnerHtmlBuiltin(node) == " like<div>a</div>rolling stone"); /// ~~~~~~~~~~~~~ /// /// @param node: A pointer to a GumboNode. /// @returns A string containing the HTML element's inner HTML. HEXT_PUBLIC extern const CaptureFunction InnerHtmlBuiltin; /// A CaptureFunction that returns the inner HTML of an HTML element without /// tags. /// /// @par Example: /// ~~~~~~~~~~~~~ /// GumboNode * node = ...; // <div> like<div>a</div>rolling stone</div> /// assert(StripTagsBuiltin(node) == " likearolling stone"); /// ~~~~~~~~~~~~~ /// /// @param node: A pointer to a GumboNode. /// @returns A string containing the HTML element's inner HTML without tags. HEXT_PUBLIC extern const CaptureFunction StripTagsBuiltin; } // namespace hext #endif // HEXT_BUILTINS_H_INCLUDED
// // AboutDetailViewController.h // StoryBoardTest // // Created by zhanglei on 16/5/1. // Copyright © 2016年 zhanglei. All rights reserved. // #import <UIKit/UIKit.h> @interface AboutDetailViewController : UIViewController @end
static const uint8_t fs_imgui_color_glsl[89] = { 0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I..J...va 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // v_color0;.void 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // main ().{. gl_F 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; static const uint8_t fs_imgui_color_dx9[137] = { 0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|..... 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9. 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111..... 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................ 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... }; static const uint8_t fs_imgui_color_dx11[260] = { 0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xf4, 0x00, 0x44, 0x58, 0x42, 0x43, // FSH....I....DXBC 0xa6, 0x7f, 0x08, 0xe2, 0x95, 0xbd, 0x5f, 0xa3, 0x3f, 0x5b, 0x58, 0x8e, 0x54, 0x0f, 0x89, 0x67, // ......_.?[X.T..g 0x01, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // ............,... 0x80, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // ........ISGNL... 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8....... 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D............... 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET... 0x53, 0x48, 0x44, 0x52, 0x38, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, // SHDR8...@....... 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // b...........e... 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // . ......6.... .. 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>... 0x00, 0x00, 0x00, 0x00, // .... };
// // JSKSunEarthMoonView.h // Rotation // // Created by Joshua Kaden on 3/23/14. // Copyright (c) 2014 Chadford Software. 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. // #import <UIKit/UIKit.h> @interface JSKSunEarthMoonView : UIView @end
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "Particles/ParticleSystemComponent.h" /** * Class for FParticleSysParam struct customization */ class FParticleSysParamStructCustomization : public IPropertyTypeCustomization { public: static TSharedRef<IPropertyTypeCustomization> MakeInstance(); FParticleSysParamStructCustomization(); /** IPropertyTypeCustomization instance */ virtual void CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; virtual void CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; protected: /** Called by the combo box to generate each row of the widget */ TSharedRef<SWidget> OnGenerateComboWidget(TSharedPtr<FString> InComboString); /** Called when the combo box selection changes, when a new parameter type is selected */ void OnComboSelectionChanged(TSharedPtr<FString> InSelectedItem, ESelectInfo::Type SelectInfo); /** Called to obtain an FText representing the current combo box selection */ FText GetParameterTypeName() const; private: /** Cached handle to the struct property */ TSharedPtr<IPropertyHandle> PropertyHandle; /** Current parameter type */ int32 ParameterType; /** A list of parameter type names */ TArray<TSharedPtr<FString>> ParameterTypeNames; /** A list of parameter type tooltips */ TArray<FText> ParameterTypeToolTips; /** Delegates called by each property widget to determine their visibility */ EVisibility GetScalarVisibility() const; EVisibility GetScalarLowVisibility() const; EVisibility GetVectorVisibility() const; EVisibility GetVectorLowVisibility() const; EVisibility GetColorVisibility() const; EVisibility GetActorVisibility() const; EVisibility GetMaterialVisibility() const; };
#ifndef Py_LIMITED_API #ifndef Py_LONGINTREPR_H #define Py_LONGINTREPR_H #ifdef __cplusplus extern "C" { #endif /* This is published for the benefit of "friends" marshal.c and _decimal.c. */ /* Parameters of the long integer representation. There are two different sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit integer type, and one set for 15-bit digits with each digit stored in an unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at configure time or in pyport.h, is used to decide which digit size to use. Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' should be an unsigned integer type able to hold all integers up to PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, and that overflow is handled by taking the result modulo 2**N for some N > PyLong_SHIFT. The majority of the code doesn't care about the precise value of PyLong_SHIFT, but there are some notable exceptions: - long_pow() requires that PyLong_SHIFT be divisible by 5 - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 - long_hash() requires that PyLong_SHIFT is *strictly* less than the number of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) conversion functions - the long <-> size_t/Py_ssize_t conversion functions expect that PyLong_SHIFT is strictly less than the number of bits in a size_t - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 - NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single digit; with the current values this forces PyLong_SHIFT >= 9 The values 15 and 30 should fit all of the above requirements, on any platform. */ #if PYLONG_BITS_IN_DIGIT == 30 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ defined HAVE_INT64_T && defined HAVE_INT32_T) #error "30-bit long digits requested, but the necessary types are not available on this platform" #endif typedef PY_UINT32_T digit; typedef PY_INT32_T sdigit; /* signed variant of digit */ typedef PY_UINT64_T twodigits; typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 30 #define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ #elif PYLONG_BITS_IN_DIGIT == 15 typedef unsigned short digit; typedef short sdigit; /* signed variant of digit */ typedef unsigned long twodigits; typedef long stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 15 #define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ #else #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" #endif #define PyLong_BASE ((digit)1 << PyLong_SHIFT) #define PyLong_MASK ((digit)(PyLong_BASE - 1)) #if PyLong_SHIFT % 5 != 0 #error "longobject.c requires that PyLong_SHIFT be divisible by 5" #endif /* Long integer representation. The absolute value of a number is equal to SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) Negative numbers are represented with ob_size < 0; zero is represented by ob_size == 0. In a normalized number, ob_digit[abs(ob_size)-1] (the most significant digit) is never zero. Also, in all cases, for all valid i, 0 <= ob_digit[i] <= MASK. The allocation function takes care of allocating extra memory so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. CAUTION: Generic code manipulating subtypes of PyVarObject has to aware that longs abuse ob_size's sign bit. */ struct _longobject { PyObject_VAR_HEAD digit ob_digit[1]; }; PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); /* Return a copy of src. */ PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus } #endif #endif /* !Py_LONGINTREPR_H */ #endif /* Py_LIMITED_API */
// Copyright (c) 2022, WNProject Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #pragma once #ifndef __WN_MULTI_TASKING_SHARED_MUTEX_H__ #define __WN_MULTI_TASKING_SHARED_MUTEX_H__ #include "WNMultiTasking/inc/internal/shared_mutex_base.h" #include "WNMultiTasking/inc/lock_guard.h" #include "core/inc/utilities.h" namespace wn { namespace multi_tasking { class shared_mutex final : internal::shared_mutex_base { public: shared_mutex() : base() {} void lock() { base::lock(); } bool try_lock() { return base::try_lock(); } void unlock() { base::unlock(); } void lock_shared() { base::lock_shared(); } bool try_lock_shared() { return base::try_lock_shared(); } void unlock_shared() { base::unlock_shared(); } private: using base = internal::shared_mutex_base; }; } // namespace multi_tasking } // namespace wn #endif // __WN_MULTI_TASKING_SHARED_MUTEX_H__
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_REFLECTION_ASSEMBLYPRODUCTATTRIBUTE_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_REFLECTION_ASSEMBLYPRODUCTATTRIBUTE_H #include <mscorlib/System/mscorlib_System_Attribute.h> #include <mscorlib/System/mscorlib_System_String.h> #include <mscorlib/System/Runtime/InteropServices/mscorlib_System_Runtime_InteropServices__Attribute.h> #include <mscorlib/System/mscorlib_System_Object.h> namespace mscorlib { namespace System { class Type; } } namespace mscorlib { namespace System { namespace Reflection { class AssemblyProductAttribute : public mscorlib::System::Attribute , public virtual mscorlib::System::Runtime::InteropServices::_Attribute { public: AssemblyProductAttribute(mscorlib::System::String product) : mscorlib::System::Attribute(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Reflection.AssemblyProductAttribute")) , mscorlib::System::Runtime::InteropServices::_Attribute(NULL) { MonoType *__parameter_types__[1]; void *__parameters__[1]; __parameter_types__[0] = Global::GetType("mscorlib", "System", "String"); __parameters__[0] = (MonoObject*)product; __native_object__ = Global::New("mscorlib", "System.Reflection", "AssemblyProductAttribute", 1, __parameter_types__, __parameters__); }; AssemblyProductAttribute(mscorlib::NativeTypeInfo *nativeTypeInfo) : mscorlib::System::Attribute(nativeTypeInfo) , mscorlib::System::Runtime::InteropServices::_Attribute(NULL) { }; AssemblyProductAttribute(MonoObject *nativeObject) : mscorlib::System::Attribute(nativeObject) , mscorlib::System::Runtime::InteropServices::_Attribute(nativeObject) { }; ~AssemblyProductAttribute() { }; AssemblyProductAttribute & operator=(AssemblyProductAttribute &value) { __native_object__ = value.GetNativeObject(); return value; }; bool operator==(AssemblyProductAttribute &value) { return mscorlib::System::Object::Equals(value); }; operator MonoObject*() { return __native_object__; }; MonoObject* operator=(MonoObject* value) { return __native_object__ = value; }; virtual MonoObject* GetNativeObject() override { return __native_object__; }; //Public Properties __declspec(property(get=get_Product)) mscorlib::System::String Product; __declspec(property(get=get_TypeId)) mscorlib::System::Object TypeId; //Get Set Properties Methods // Get:Product mscorlib::System::String get_Product() const; // Get:TypeId mscorlib::System::Object get_TypeId() const; protected: private: }; } } } #endif
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "Engine.h" class FCompilerResultsLog; class UBlueprint; #define KISMET_COMPILER_MODULENAME "KismetCompiler" ////////////////////////////////////////////////////////////////////////// // IKismetCompilerInterface class IBlueprintCompiler { public: virtual void PreCompile(UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions) { PreCompile(Blueprint); } virtual bool CanCompile(const UBlueprint* Blueprint) = 0; virtual void Compile(UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions, FCompilerResultsLog& Results, TArray<UObject*>* ObjLoaded) = 0; virtual void PostCompile(UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions) { PostCompile(Blueprint); } virtual bool GetBlueprintTypesForClass(UClass* ParentClass, UClass*& OutBlueprintClass, UClass*& OutBlueprintGeneratedClass) const { OutBlueprintClass = nullptr; OutBlueprintGeneratedClass = nullptr; return false; } protected: virtual void PreCompile(UBlueprint* Blueprint) { } virtual void PostCompile(UBlueprint* Blueprint) { } }; class IKismetCompilerInterface : public IModuleInterface { public: /** * Compiles a blueprint. * * @param Blueprint The blueprint to compile. * @param Results The results log for warnings and errors. * @param Options Compiler options. */ virtual void CompileBlueprint(class UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions, FCompilerResultsLog& Results, TSharedPtr<class FBlueprintCompileReinstancer> ParentReinstancer = NULL, TArray<UObject*>* ObjLoaded = NULL)=0; /** * Compiles a user defined structure. * * @param Struct The structure to compile. * @param Results The results log for warnings and errors. */ virtual void CompileStructure(class UUserDefinedStruct* Struct, FCompilerResultsLog& Results)=0; /** * Attempts to recover a corrupted blueprint package. * * @param Blueprint The blueprint to recover. */ virtual void RecoverCorruptedBlueprint(class UBlueprint* Blueprint)=0; /** * Clears the blueprint's generated classes, and consigns them to oblivion * * @param Blueprint The blueprint to clear the classes for */ virtual void RemoveBlueprintGeneratedClasses(class UBlueprint* Blueprint)=0; /** * Gets a list of all compilers for blueprints. You can register new compilers through this list. */ virtual TArray<IBlueprintCompiler*>& GetCompilers() = 0; /** * Get the blueprint class and generated blueprint class for a particular class type. Not every * blueprint is a normal UBlueprint, like UUserWidget blueprints should be UWidgetBlueprints. */ virtual void GetBlueprintTypesForClass(UClass* ParentClass, UClass*& OutBlueprintClass, UClass*& OutBlueprintGeneratedClass) const = 0; }; ////////////////////////////////////////////////////////////////////////// // FKismet2CompilerModule /** * The Kismet 2 Compiler module */ class FKismet2CompilerModule : public IKismetCompilerInterface { public: // Implementation of the IKismetCompilerInterface virtual void CompileBlueprint(class UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions, FCompilerResultsLog& Results, TSharedPtr<class FBlueprintCompileReinstancer> ParentReinstancer = NULL, TArray<UObject*>* ObjLoaded = NULL) override; virtual void CompileStructure(class UUserDefinedStruct* Struct, FCompilerResultsLog& Results) override; virtual void RecoverCorruptedBlueprint(class UBlueprint* Blueprint) override; virtual void RemoveBlueprintGeneratedClasses(class UBlueprint* Blueprint) override; virtual TArray<IBlueprintCompiler*>& GetCompilers() override { return Compilers; } virtual void GetBlueprintTypesForClass(UClass* ParentClass, UClass*& OutBlueprintClass, UClass*& OutBlueprintGeneratedClass) const override; // End implementation private: void CompileBlueprintInner(class UBlueprint* Blueprint, const FKismetCompilerOptions& CompileOptions, FCompilerResultsLog& Results, TSharedPtr<FBlueprintCompileReinstancer> Reinstancer, TArray<UObject*>* ObjLoaded); TArray<IBlueprintCompiler*> Compilers; };
/*============================================================================= Name : FMEPinDetailsViewController.h System : FME Alerts Language : Objective-C Purpose : TBD Copyright (c) 2013 - 2014, Safe Software Inc. All rights reserved. Redistribution and use of this sample code 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 SAMPLE CODE 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 SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================*/ #import <UIKit/UIKit.h> @interface FMEPinDetailsViewController : UIViewController @property (nonatomic, copy) NSString * title; @property (nonatomic, copy) NSString * details; @property (nonatomic, copy) NSString * date; @property (nonatomic, copy) NSString * location; @property (nonatomic, copy) NSArray * messages; // all messages @property (nonatomic) NSUInteger messageIndex; @end
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #ifndef _NGX_ARRAY_H_INCLUDED_ #define _NGX_ARRAY_H_INCLUDED_ #include <ngx_config.h> #include <ngx_core.h> //xjzhang, ʵÏÖÁËÒ»¸ö¶¯Ì¬¿ÉÔö³¤µÄarray£¬¹¦ÄÜÀàËÆvector; typedef struct { void *elts;//xjzhang, Ö¸ÏòarrayÆðʼλÖã» ngx_uint_t nelts;//xjzhang, ÒѾ­Ê¹ÓõÄarrayÔªËØ¸öÊý£» size_t size;//xjzhang, arrayÖиöÔªËØµÄ¸öÊý£» ngx_uint_t nalloc;//xjzhang, arrayÖÐÿ¸öÔªËØµÄ´óС£» ngx_pool_t *pool;//xjzhang, arrayËùÔÚµÄpool£» } ngx_array_t; ngx_array_t *ngx_array_create(ngx_pool_t *p, ngx_uint_t n, size_t size); void ngx_array_destroy(ngx_array_t *a); void *ngx_array_push(ngx_array_t *a); void *ngx_array_push_n(ngx_array_t *a, ngx_uint_t n); static ngx_inline ngx_int_t ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size) { /* * set "array->nelts" before "array->elts", otherwise MSVC thinks * that "array->nelts" may be used without having been initialized */ array->nelts = 0; array->size = size; array->nalloc = n; array->pool = pool; array->elts = ngx_palloc(pool, n * size); if (array->elts == NULL) { return NGX_ERROR; } return NGX_OK; } #endif /* _NGX_ARRAY_H_INCLUDED_ */
/* * Copyright (C) 2010, 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: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AudioBasicProcessorNode_h #define AudioBasicProcessorNode_h #include "AudioNode.h" #include <memory> #include <wtf/RefCounted.h> #include <wtf/Threading.h> namespace WebCore { class AudioBus; class AudioNodeInput; class AudioProcessor; // AudioBasicProcessorNode is an AudioNode with one input and one output where the input and output have the same number of channels. class AudioBasicProcessorNode : public AudioNode { public: AudioBasicProcessorNode(AudioContext&, float sampleRate); // AudioNode void process(size_t framesToProcess) override; void pullInputs(size_t framesToProcess) override; void reset() override; void initialize() override; void uninitialize() override; // Called in the main thread when the number of channels for the input may have changed. void checkNumberOfChannelsForInput(AudioNodeInput*) override; // Returns the number of channels for both the input and the output. unsigned numberOfChannels(); protected: double tailTime() const override; double latencyTime() const override; AudioProcessor* processor() { return m_processor.get(); } std::unique_ptr<AudioProcessor> m_processor; }; } // namespace WebCore #endif // AudioBasicProcessorNode_h
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #include <ngx_config.h> #include <ngx_core.h> /* * The code and lookup tables are based on the algorithm * described at http://www.w3.org/TR/PNG/ * * The 256 element lookup table takes 1024 bytes, and it may be completely * cached after processing about 30-60 bytes of data. So for short data * we use the 16 element lookup table that takes only 64 bytes and align it * to CPU cache line size. Of course, the small table adds code inside * CRC32 loop, but the cache misses overhead is bigger than overhead of * the additional code. For example, ngx_crc32_short() of 16 bytes of data * takes half as much CPU clocks than ngx_crc32_long(). */ static uint32_t ngx_crc32_table16[] = { 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; uint32_t ngx_crc32_table256[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; uint32_t *ngx_crc32_table_short = ngx_crc32_table16; /* * 初始化crc */ ngx_int_t ngx_crc32_table_init(void) { void *p; if (((uintptr_t) ngx_crc32_table_short & ~((uintptr_t) ngx_cacheline_size - 1)) == (uintptr_t) ngx_crc32_table_short) { return NGX_OK; } p = ngx_alloc(16 * sizeof(uint32_t) + ngx_cacheline_size, ngx_cycle->log); if (p == NULL) { return NGX_ERROR; } p = ngx_align_ptr(p, ngx_cacheline_size); ngx_memcpy(p, ngx_crc32_table16, 16 * sizeof(uint32_t)); ngx_crc32_table_short = p; return NGX_OK; }
// // MTJSONUtilsTests.h // MTJSONUtilsTests // // Created by Adam Kirk on 8/16/12. // Copyright (c) 2012 Mysterious Trousers. All rights reserved. // #import <SenTestingKit/SenTestingKit.h> @interface MTJSONUtilsTests : SenTestCase @property (strong, nonatomic) NSDictionary *testDictionary; @end
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2014-2021 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #pragma once #include <modules/base/basemoduledefine.h> #include <inviwo/core/datastructures/light/baselightsource.h> #include <inviwo/core/properties/compositeproperty.h> #include <inviwo/core/ports/dataoutport.h> #include <inviwo/core/properties/ordinalproperty.h> #include <inviwo/core/properties/cameraproperty.h> #include <inviwo/core/properties/positionproperty.h> #include <inviwo/core/processors/processor.h> namespace inviwo { class SpotLight; /** \docpage{org.inviwo.Spotlightsource, Spot light source} * ![](org.inviwo.Spotlightsource.png?classIdentifier=org.inviwo.Spotlightsource) * * Produces a spot light source, spreading light in the shape of a cone. * The direction of the cone will be computed as glm::normalize(vec3(0) - lightPos) * when specified in world space and normalize(camera_.getLookTo() - lightPos) when specified in * view space. * * * * * ### Properties * * __Light Source Position__ Start point of the cone. * * __Light power (%)__ Increases/decreases light strength. * * __Light size__ ... * * __Light Cone Radius Angle__ Cone radius angle of the light source * * __Color__ Flux density per solid angle, W*s*r^-1 (intensity) * * __Light Fall Off Angle__ Fall off angle of the light source * */ class IVW_MODULE_BASE_API SpotLightSourceProcessor : public Processor { public: SpotLightSourceProcessor(); virtual ~SpotLightSourceProcessor() = default; virtual const ProcessorInfo getProcessorInfo() const override; static const ProcessorInfo processorInfo_; protected: virtual void process() override; /** * Update light source parameters. Transformation will be given in texture space. * * @param lightSource * @return */ void updateSpotLightSource(SpotLight* lightSource); private: DataOutport<LightSource> outport_; CameraProperty camera_; //< Link camera in order to specify position in view space. PositionProperty lightPosition_; CompositeProperty lighting_; FloatProperty lightPowerProp_; FloatVec2Property lightSize_; FloatVec3Property lightDiffuse_; FloatProperty lightConeRadiusAngle_; FloatProperty lightFallOffAngle_; std::shared_ptr<SpotLight> lightSource_; }; } // namespace inviwo
#ifndef __OPTEXTPROVIDER_H__ #define __OPTEXTPROVIDER_H__ #include "cocos2d.h" #include "ui/CocosGUI.h" #include "cocostudio/CocoStudio.h" using namespace std; class OPTextProvider { public: OPTextProvider(); virtual ~OPTextProvider(); string getStory(); string getQuestion(int num); string getAnswer1Correct(int num); string getAnswer2(int num); string getAnswer3(int num); private: int currentPhonemeNum; }; #endif
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // TNT Basic // CKeyQueue.h // © Mark Tully 2003 // 20/9/03 // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ /* ***** BEGIN LICENSE BLOCK ***** * * Copyright (c) 2003, Mark Tully and John Treece-Birch * 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. * * ***** END LICENSE BLOCK ***** */ #pragma once // raw key format // mac os modifiers in upper 8 bits // class CKeyQueue { public: enum { kTBKeyModRepeatingKey = (1<<0) }; union STBRawKeycode // union to allow easy access of bits in raw code { struct { UInt8 tbMods,macMods,scancode,charcode; } b; UInt32 rawcode; }; static const UInt32 kCharCodeShift = 0; static const UInt32 kScancodeShift = 8; static const UInt32 kMacKeyModifiersShift = 16; static const UInt32 kTBKeyModifiersShift = 24; static const UInt32 kMaxKeysInQueue = 20; void QueueKeyByScancode( UInt32 inScancode, UInt32 inModifiers, bool inIsRepeating); void QueueKeyByRawcode( UInt32 inRawcode, bool inIsRepeating); bool PopKey( UInt32 &outRawKey); bool PeekKey( UInt32 &outRawKey); void Flush(); static UInt8 ScancodeAndModsToCharcode( UInt8 inScancode, UInt8 inModifiers); protected: struct SKeyboardEvent { enum { kDataIsRawcodeMissingCharCode, kDataIsRawcode } dataType; STBRawKeycode rawcode; }; static UInt32 sKeyMapState; UInt16 mQStart,mQEnd; SKeyboardEvent mQ[kMaxKeysInQueue]; SKeyboardEvent &EventAlloc(); public: CKeyQueue() : mQStart(0), mQEnd(0) {} };
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once #include "UnrealAudioModule.h" #if ENABLE_UNREAL_AUDIO namespace UAudio { static const uint32 ENTITY_INDEX_BITS = 24; static const uint32 ENTITY_INDEX_MASK = (1 << ENTITY_INDEX_BITS) - 1; static const uint32 ENTITY_GENERATION_BITS = 8; static const uint32 ENTITY_GENERATION_MASK = (1 << ENTITY_GENERATION_BITS) - 1; static const uint32 ENTITY_INDEX_INVALID = INDEX_NONE; /** An entity handle. */ struct FEntityHandle { public: /** * Static constructor. * * @param InId Identifier for the in. */ static FEntityHandle Create(uint32 InId = INDEX_NONE) { FEntityHandle Result; Result.Id = InId; return Result; } /** * Query if this object is initialized. * * @return true if initialized, false if not. */ bool IsInitialized() const { return Id != INDEX_NONE; } /** * Gets the index. * * @return The index. */ uint32 GetIndex() const { return Id & ENTITY_INDEX_MASK; } /** * Gets the generation. * * @return The generation. */ uint32 GetGeneration() const { return (Id >> ENTITY_GENERATION_BITS) & ENTITY_GENERATION_MASK; } /** The identifier. */ uint32 Id; }; /** * Manages entity handles for weak-referencing of resources between threads and processes. */ class FEntityManager { public: /** * Constructor. * * @param InMinNumFreeIndices The minimum number free indices. */ FEntityManager(uint32 InMinNumFreeIndices) : NumFreeEntities(0) , MinNumFreeIndices(InMinNumFreeIndices) { } /** Destructor. */ ~FEntityManager() { } /** * Creates the entity. * * @return The new entity. */ FEntityHandle CreateEntity() { uint32 NewEntityIndex = ENTITY_INDEX_INVALID; if (NumFreeEntities > MinNumFreeIndices) { FreeEntityIndices.Dequeue(NewEntityIndex); --NumFreeEntities; } else { NewEntityIndex = EntityGenerations.Num(); EntityGenerations.Add(0); check(NewEntityIndex < (1 << ENTITY_INDEX_BITS)); } return CreateHandle(NewEntityIndex, EntityGenerations[NewEntityIndex]); } /** * Releases the entity described by Handle. * * @param Handle The handle. */ void ReleaseEntity(const FEntityHandle& Handle) { uint32 EntityIndex = Handle.GetIndex(); uint8 Generation = Handle.GetGeneration(); EntityGenerations[EntityIndex] = ++Generation; ++NumFreeEntities; FreeEntityIndices.Enqueue(EntityIndex); } /** * Query if 'Handle' is valid entity. * * @param Handle The handle. * * @return true if valid entity, false if not. */ bool IsValidEntity(FEntityHandle Handle) const { if (Handle.Id == ENTITY_INDEX_INVALID) { return false; } uint32 EntityIndex = Handle.GetIndex(); uint8 Generation = Handle.GetGeneration(); return EntityGenerations[EntityIndex] == Generation; } private: /** * Creates a handle. * * @param EntityIndex Zero-based index of the entity. * @param EntityGeneration The entity generation. * * @return The new handle. */ FEntityHandle CreateHandle(uint32 EntityIndex, uint8 EntityGeneration) const { return FEntityHandle::Create(EntityIndex | (EntityGeneration << ENTITY_INDEX_BITS)); } /** Number of free entities. */ uint32 NumFreeEntities; /** The minimum number free indices. */ uint32 MinNumFreeIndices; /** The free entity indices. */ TQueue<uint32> FreeEntityIndices; /** The entity generations. */ TArray<uint8> EntityGenerations; }; } #endif // #if ENABLE_UNREAL_AUDIO
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. /*============================================================================================= IOSPlatformCompilerSetup.h: pragmas, version checks and other things for the iOS compiler ==============================================================================================*/ #pragma once
#ifndef IV_LV5_JSARRAY_ITERATOR_H_ #define IV_LV5_JSARRAY_ITERATOR_H_ #include <iv/forward.h> #include <iv/lv5/error_check.h> #include <iv/lv5/property.h> #include <iv/lv5/jsval.h> #include <iv/lv5/jsobject_fwd.h> #include <iv/lv5/jsobject_with_tuple.h> #include <iv/lv5/map.h> #include <iv/lv5/slot.h> #include <iv/lv5/class.h> #include <iv/lv5/context.h> namespace iv { namespace lv5 { enum class ArrayIterationKind { KEY, VALUE, KEY_PLUS_VALUE, SPARSE_KEY, SPARSE_VALUE, SPARSE_KEY_PLUS_VALUE }; typedef JSObjectWithTuple< JSObject*, uint32_t, ArrayIterationKind> JSArrayIteratorSuper; class JSArrayIterator : public JSArrayIteratorSuper { public: enum Index { ITERATED = 0, INDEX = 1, KIND = 2 }; static JSArrayIterator* New(Context* ctx, JSObject* iterated, ArrayIterationKind kind) { return new JSArrayIterator( ctx, ctx->global_data()->array_iterator_map(), Unique(), iterated, 0U, kind); } static JSArrayIterator* As(JSObject* obj) { if (obj->IsTuple() && static_cast<JSObjectTuple*>(obj)->unique() == Unique()) { return static_cast<JSArrayIterator*>(obj); } return nullptr; } private: static uintptr_t Unique() { static const char* const kUniqueSymbol = "ArrayIteratorKey"; return reinterpret_cast<uintptr_t>(kUniqueSymbol); } IV_FORWARD_CONSTRUCTOR(JSArrayIterator, JSArrayIteratorSuper) }; } } // namespace iv::lv5 #endif // IV_LV5_JSARRAY_ITERATOR_H_
/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. last mod: $Id: os_types.h 17712 2010-12-03 17:10:02Z xiphmont $ ********************************************************************/ #ifndef _OS_TYPES_H #define _OS_TYPES_H /* make it easy on the folks that want to compile the libs with a different malloc than stdlib */ #define _ogg_malloc malloc #define _ogg_calloc calloc #define _ogg_realloc realloc #define _ogg_free free #if defined(_WIN32) # if defined(__CYGWIN__) # include <stdint.h> typedef int16_t ogg_int16_t; typedef uint16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef uint32_t ogg_uint32_t; typedef int64_t ogg_int64_t; typedef uint64_t ogg_uint64_t; # elif defined(__MINGW32__) # include <sys/types.h> typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; typedef unsigned long long ogg_uint64_t; # elif defined(__MWERKS__) typedef long long ogg_int64_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; # else /* MSVC/Borland */ typedef __int64 ogg_int64_t; typedef __int32 ogg_int32_t; typedef unsigned __int32 ogg_uint32_t; typedef __int16 ogg_int16_t; typedef unsigned __int16 ogg_uint16_t; # endif #elif defined(__MACOS__) # include <sys/types.h> typedef SInt16 ogg_int16_t; typedef UInt16 ogg_uint16_t; typedef SInt32 ogg_int32_t; typedef UInt32 ogg_uint32_t; typedef SInt64 ogg_int64_t; #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ # include <inttypes.h> typedef int16_t ogg_int16_t; typedef uint16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef uint32_t ogg_uint32_t; typedef int64_t ogg_int64_t; #elif defined(__HAIKU__) /* Haiku */ # include <sys/types.h> typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; #elif defined(__BEOS__) /* Be */ # include <inttypes.h> typedef int16_t ogg_int16_t; typedef uint16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef uint32_t ogg_uint32_t; typedef int64_t ogg_int64_t; #elif defined (__EMX__) /* OS/2 GCC */ typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; #elif defined (DJGPP) /* DJGPP */ typedef short ogg_int16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; #elif defined(R5900) /* PS2 EE */ typedef long ogg_int64_t; typedef int ogg_int32_t; typedef unsigned ogg_uint32_t; typedef short ogg_int16_t; #elif defined(__SYMBIAN32__) /* Symbian GCC */ typedef signed short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef signed int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long int ogg_int64_t; #elif defined(__TMS320C6X__) /* TI C64x compiler */ typedef signed short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef signed int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long int ogg_int64_t; #elif defined(ANDROID) # include <stdint.h> typedef int16_t ogg_int16_t; typedef uint16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef uint32_t ogg_uint32_t; typedef int64_t ogg_int64_t; typedef uint64_t ogg_uint64_t; # elif defined(LINUX) # include <sys/types.h> typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; typedef unsigned long long ogg_uint64_t; #else # include <ogg/config_types.h> #endif #endif /* _OS_TYPES_H */
#ifndef INPUT_H #define INPUT_H extern int keysPres, keysHold, keysReleased; extern styluspos_t stylus, oldStylus; void updateInput(void); bool TouchinArea(int x, int y, int x2, int y2); bool TouchedArea(int x, int y, int x2, int y2); #endif
// // Copyright (c) 2013 Caitlin Potter and Contributors // 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 __TimedText_UtilityPrivate__ #define __TimedText_UtilityPrivate__ #include <climits> namespace TimedText { int allocMore(int alloc, int extra); } // TimedText #endif // __TimedText_UtilityPrivate__
#include <stdint.h> #include <stddef.h> #include "effects.h" // new = ((old - old_min) / (old_max - old_min)) * (new_max - new_min) + new_min // old_min = 0 // old_max = RAINBOW_LENGTH // new_min = 0 // new_max = framelen // new = (i / RAINBOW_LENGTH) * framelen static void rainbow(struct render_args* args) { int i; int j; int num_pixels = args->framelen/3; int rate = args->effect->argument ? args->effect->argument : 1; for (i = 0, j = 0; i < num_pixels; i++, j += 3) { char* pixel = &args->framebuf[j]; int k = (num_pixels - i) * RAINBOW_LENGTH / num_pixels; int c = rate * args->framenum + k; pixel[0] = 0x80 | RAINBOW_G(c) >> 1; pixel[1] = 0x80 | RAINBOW_R(c) >> 1; pixel[2] = 0x80 | RAINBOW_B(c) >> 1; } } static void rainbow_panels(struct render_args* args) { int i; for (i = 0; i < args->framelen; i += 3) { args->framebuf[i+0] = RAINBOW_R(args->framenum); args->framebuf[i+1] = RAINBOW_G(args->framenum); args->framebuf[i+2] = RAINBOW_B(args->framenum); } } static void rolling_rainbow_panels(struct render_args* args) { int i; int j; int scale = RAINBOW_LENGTH / NUM_PANELS; for (i = 0, j = 0; j < args->framelen; i++, j += 3) { char* pixel = &args->framebuf[j]; int c = args->framenum + i * scale; pixel[0] = RAINBOW_R(c); pixel[1] = RAINBOW_G(c); pixel[2] = RAINBOW_B(c); } } struct effect effect_treads_rainbow = { .name = "rainbow", .arg_desc = "cycle rate", .arg_default = 10, .render = rainbow, }; struct effect effect_barrel_rainbow = { .name = "rainbow", .arg_desc = "cycle rate", .arg_default = 20, .render = rainbow, }; struct effect effect_panels_rainbow = { .name = "rainbow", .arg_desc = "N/A", .render = rainbow_panels, }; struct effect effect_panels_rolling_rainbow = { .name = "rolling rainbow", .arg_desc = "N/A", .render = rolling_rainbow_panels, };
/*Daala video codec Copyright (c) 2012 Daala project contributors. 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 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.*/ #if !defined(_pvq_H) # define _pvq_H (1) # include "internal.h" # include "filter.h" extern const double *OD_BASIS_MAG[2][OD_NBSIZES + 1]; extern const int OD_QM8_Q4_FLAT[]; extern const int OD_QM8_Q4_HVS[]; # define PVQ_MAX_PARTITIONS (1 + 3*(OD_NBSIZES-1)) # define OD_NOREF_ADAPT_SPEED (4) /* Normalized lambda for PVQ quantizer. Since we normalize the gain by q, the distortion is normalized by q^2 and lambda does not need the q^2 factor. At high rate, this would be log(2)/6, but we're using a slightly more aggressive value taken from: Li, Xiang, et al. "Laplace distribution based Lagrangian rate distortion optimization for hybrid video coding." Circuits and Systems for Video Technology, IEEE Transactions on 19.2 (2009): 193-205. */ # define OD_PVQ_LAMBDA (.136) #define OD_PVQ_SKIP_ZERO 1 #define OD_PVQ_SKIP_COPY 2 /* Largest PVQ partition is half the coefficients of largest block size. */ #define MAXN (OD_BSIZE_MAX*OD_BSIZE_MAX/2) #define OD_COMPAND_SCALE (256 << OD_COEFF_SHIFT) #define OD_COMPAND_SCALE_1 (1./OD_COMPAND_SCALE) #define OD_QM_SIZE (20) #define OD_FLAT_QM 0 #define OD_HVS_QM 1 int od_qm_get_index(int bs, int band); extern const double *const OD_PVQ_BETA[2][OD_NPLANES_MAX][OD_NBSIZES + 1]; void od_apply_qm(od_coeff *out, int out_stride, od_coeff *in, int in_stride, int bs, int dec, int inverse, const int *qm); int od_compute_householder(double *r, int n, double gr, int *sign); void od_apply_householder(double *x, const double *r, int n); void od_pvq_synthesis_partial(od_coeff *xcoeff, const od_coeff *ypulse, const double *r, int n, int noref, double g, double theta, int m, int s); double od_gain_expand(double cg, int q0, double beta); double od_pvq_compute_gain(od_coeff *x, int n, int q0, double *g, double beta); int od_pvq_compute_max_theta(double qcg, double beta); double od_pvq_compute_theta(int t, int max_theta); int od_pvq_compute_k(double qcg, int itheta, double theta, int noref, int n, double beta, int nodesync); int od_vector_is_null(const od_coeff *x, int len); #endif
/** * The BSD 2-Clause License (aka "FreeBSD License") * * Copyright (c) 2012, Benjamin Thiel, Kamil Kloch * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ #import <UIKit/UIKit.h> #import "FirstViewController.h" @interface PDRAppDelegate : NSObject <UIApplicationDelegate> { FirstViewController *mainVC; UIBackgroundTaskIdentifier backgroundTask; } @property (nonatomic, retain) IBOutlet UIWindow *window; @end
/* Serge Voilokov, 2015 * helpers for libxml2. */ #include "xml.h" #include <string.h> #include <stdbool.h> #include <err.h> #include <libxml/tree.h> const char * get_ctext(const xmlNodePtr node) { xmlNodePtr n; if (node == NULL) return NULL; for (n = node->children; n != NULL; n = n->next) if (n->type == XML_TEXT_NODE) return (char *)n->content; return NULL; } const char * get_attr(const xmlNodePtr node, const char *name) { if (node == NULL && node->type != XML_ELEMENT_NODE) return NULL; xmlNodePtr n = (xmlNodePtr)((xmlElementPtr)node)->attributes; for (; n != NULL; n = n->next) if (n->type == XML_ATTRIBUTE_NODE && xmlStrEqual(n->name, BAD_CAST(name)) == 1) return get_ctext(n); return NULL; } xmlNodePtr first_el(xmlNodePtr parent_node, const char *name) { xmlNodePtr n; if (parent_node == NULL) return NULL; for (n = parent_node->children; n != NULL; n = n->next) if (n->type == XML_ELEMENT_NODE && xmlStrEqual(n->name, BAD_CAST(name)) == 1) return n; return NULL; } xmlNodePtr next_el(xmlNodePtr node) { xmlNodePtr n; for (n = node->next; n != NULL; n = n->next) if (n->type == XML_ELEMENT_NODE && xmlStrEqual(n->name, node->name) == 1) return n; return NULL; } void print_element_names(xmlNode *a_node, int depth) { xmlNode *n = NULL; for (n = a_node; n != NULL; n = n->next) { if (n->type == XML_ELEMENT_NODE) printf("%*s%s\n", depth*4, "", n->name); print_element_names(n->children, depth+1); } }
#include <stdlib.h> #include <stdio.h> #include "hash.h" #include "obj.h" void check_map(symmap* m, char* key) { printf("Getting \"%s\"\n", key); obj* o = map_get(m, key); if(o) printf("%s: %f\n", key, o->num_value); else printf("Key %s not set in map.\n", key); } int main(int argc, char const *argv[]) { symmap* m = new_map(SYM); map_put(m, "hello", new_number(2.0)); map_put(m, "world", new_number(3.0)); map_put(m, "haiku", new_number(4.5)); map_iter i = map_start(); cell* cur; while((cur = map_next(m, i))) { printf("%s: %f\n", cur->key, cur->val->num_value); } return 0; }
#ifndef _ETL_STM32F4XX_APB_H_INCLUDED #define _ETL_STM32F4XX_APB_H_INCLUDED #include "etl/stm32f4xx/types.h" namespace etl { namespace stm32f4xx { enum class ApbPeripheral : HalfWord { /* * APB1 peripherals */ #define ETL_STM32F4XX_APB_PERIPH(slot, name) name = (0 << 8) | slot, #define ETL_STM32F4XX_APB_RESERVED(slot) /* nothing */ #include "etl/stm32f4xx/apb1_peripherals.def" #undef ETL_STM32F4XX_APB_RESERVED #undef ETL_STM32F4XX_APB_PERIPH /* * APB2 peripherals */ #define ETL_STM32F4XX_APB_PERIPH(slot, name) name = (1 << 8) | slot, #define ETL_STM32F4XX_APB_RESERVED(slot) /* nothing */ #include "etl/stm32f4xx/apb2_peripherals.def" #undef ETL_STM32F4XX_APB_RESERVED #undef ETL_STM32F4XX_APB_PERIPH }; inline unsigned get_bus_index(ApbPeripheral p) { return (static_cast<Word>(p) >> 8) & 0xFF; } inline unsigned get_slot_index(ApbPeripheral p) { return static_cast<Word>(p) & 0xFF; } } // namespace stm32f4xx } // namespace etl #endif // _ETL_STM32F4XX_APB_H_INCLUDED
// ------------------------------------------------------------- // Copyright (C) 2013- Adam Petrone // 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. // ------------------------------------------------------------- #pragma once #include "mem.h" #ifndef memset #include <string.h> #endif #include <assert.h> namespace gemini { template <class T> class stack { public: typedef T value_type; typedef T* value_pointer; stack(gemini::Allocator& _allocator) : allocator(_allocator) , data(nullptr) , stack_pointer(0) { stack_pointer = ~0u; max_capacity = 0; } stack& operator=(const stack& other) = delete; void push(const T& item) { if (!data && max_capacity == 0) { grow(16); } if (stack_pointer+1 >= max_capacity) { grow(max_capacity << 1); } data[++stack_pointer] = item; } T pop() { validate_range(); T item = data[stack_pointer--]; return item; } T& top() { validate_range(); return const_cast<T&>(data[stack_pointer]); } const T& top() const { validate_range(); return data[stack_pointer]; } size_t size() const { return stack_pointer + 1; } bool empty() const { return stack_pointer == ~0u; } void clear(bool purge = true) { stack_pointer = ~0u; max_capacity = 0; if (purge) { deallocate(data); data = nullptr; } } private: inline void validate_range() { assert(stack_pointer >= 0 && stack_pointer < ~0u); } value_pointer allocate(size_t count) { return MEMORY2_NEW_ARRAY(allocator, value_type, count); } void deallocate(value_pointer pointer) { MEMORY2_DELETE_ARRAY(allocator, pointer); } // grow to capacity void grow(size_t capacity) { if (capacity > max_capacity) { value_pointer expanded_data = allocate(capacity); assert(expanded_data != nullptr); if (data) { memcpy(expanded_data, data, sizeof(value_type) * max_capacity); deallocate(data); } data = expanded_data; max_capacity = static_cast<uint32_t>(capacity); } } gemini::Allocator& allocator; value_pointer data; uint32_t stack_pointer; uint32_t max_capacity; }; // class stack } // namespace gemini
#define BLOM_FUNCTIONCODE_SQRT 6.787002974586943e258 #define BLOM_FUNCTIONCODE_CBRT 6.871677530132464e73 #define BLOM_FUNCTIONCODE_ABS2 7.2149180411838e153 #define BLOM_FUNCTIONCODE_INV 1.8694146810200795e214 #define BLOM_FUNCTIONCODE_LOG 3.072139762561035e227 #define BLOM_FUNCTIONCODE_LOG10 1.3008333002874937e151 #define BLOM_FUNCTIONCODE_LOG2 2.756457323727305e298 #define BLOM_FUNCTIONCODE_LOG1P 1.49777792888929e229 #define BLOM_FUNCTIONCODE_EXP 3.087099439508759e26 #define BLOM_FUNCTIONCODE_EXP2 1.7225116272476006e102 #define BLOM_FUNCTIONCODE_EXPM1 1.3322219315824665e66 #define BLOM_FUNCTIONCODE_SIN 8.160312687370002e289 #define BLOM_FUNCTIONCODE_COS 5.995962363956785e182 #define BLOM_FUNCTIONCODE_TAN 6.06538084694128e108 #define BLOM_FUNCTIONCODE_SEC 3.761682409315633e219 #define BLOM_FUNCTIONCODE_CSC 2.3827219060533857e256 #define BLOM_FUNCTIONCODE_COT 2.340901543431591e38 #define BLOM_FUNCTIONCODE_SIND 7.167388897840193e111 #define BLOM_FUNCTIONCODE_COSD 2.1034112031227215e229 #define BLOM_FUNCTIONCODE_TAND 3.4101722654422374e215 #define BLOM_FUNCTIONCODE_SECD 4.782623990103259e152 #define BLOM_FUNCTIONCODE_CSCD 3.493369210377664e183 #define BLOM_FUNCTIONCODE_COTD 1.377829611836105e143 #define BLOM_FUNCTIONCODE_ASIN 1.4039721185904976e305 #define BLOM_FUNCTIONCODE_ACOS 3.028041295240331e260 #define BLOM_FUNCTIONCODE_ATAN 5.9662034462235014e302 #define BLOM_FUNCTIONCODE_ASEC 1.749984978615809e20 #define BLOM_FUNCTIONCODE_ACSC 2.83718991706545e268 #define BLOM_FUNCTIONCODE_ACOT 2.3743014564382177e227 #define BLOM_FUNCTIONCODE_ASIND 1.0664869727443039e21 #define BLOM_FUNCTIONCODE_ACOSD 7.923010730523758e146 #define BLOM_FUNCTIONCODE_ATAND 1.429055808151039e73 #define BLOM_FUNCTIONCODE_ASECD 5.864649192589765e61 #define BLOM_FUNCTIONCODE_ACSCD 6.28431871164116e99 #define BLOM_FUNCTIONCODE_ACOTD 3.9745321341042863e186 #define BLOM_FUNCTIONCODE_SINH 3.658069097772286e254 #define BLOM_FUNCTIONCODE_COSH 3.666788804481359e213 #define BLOM_FUNCTIONCODE_TANH 4.441908794491874e299 #define BLOM_FUNCTIONCODE_SECH 2.468603509708096e97 #define BLOM_FUNCTIONCODE_CSCH 4.211101243507703e252 #define BLOM_FUNCTIONCODE_COTH 3.923024296285439e258 #define BLOM_FUNCTIONCODE_ASINH 4.4445768861475435e290 #define BLOM_FUNCTIONCODE_ACOSH 3.2410004384909543e263 #define BLOM_FUNCTIONCODE_ATANH 1.2260328880471385e181 #define BLOM_FUNCTIONCODE_ASECH 3.161822103735589e215 #define BLOM_FUNCTIONCODE_ACSCH 4.181917759320675e63 #define BLOM_FUNCTIONCODE_ACOTH 1.1320250433917125e113 #define BLOM_FUNCTIONCODE_ERF 1.3359475238592115e258 #define BLOM_FUNCTIONCODE_ERFC 1.0868192027408293e213 #define BLOM_FUNCTIONCODE_ERFI 7.179340665229212e75 #define BLOM_FUNCTIONCODE_GAMMA 3.218174281250592e109 #define BLOM_FUNCTIONCODE_LGAMMA 2.2789390811242867e111 #define BLOM_FUNCTIONCODE_DIGAMMA 6.786726993879676e184 #define BLOM_FUNCTIONCODE_AIRY 5.221838728910594e184 #define BLOM_FUNCTIONCODE_AIRYPRIME 8.907102508504025e67 #define BLOM_FUNCTIONCODE_AIRYAI 4.459661172510443e228 #define BLOM_FUNCTIONCODE_AIRYBI 2.68356528063496e103 #define BLOM_FUNCTIONCODE_AIRYAIPRIME 4.784483653611051e267 #define BLOM_FUNCTIONCODE_AIRYBIPRIME 1.4342945771827317e113 #define BLOM_FUNCTIONCODE_BESSELJ0 5.310985015484287e75 #define BLOM_FUNCTIONCODE_BESSELJ1 8.773435254306818e250 #define BLOM_FUNCTIONCODE_BESSELY0 1.3589820550138703e228 #define BLOM_FUNCTIONCODE_BESSELY1 1.4132712442173636e231 #define BLOM_FUNCTIONCODE_MINVAL 3.6893488147419103e19
// 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_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ #define CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_ #include <string> #include "base/basictypes.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "ppapi/c/pp_instance.h" class Profile; namespace content { class BrowserPpapiHost; } namespace user_prefs { class PrefRegistrySyncable; } namespace chrome { // This class allows asynchronously fetching a unique device ID. The callback // passed in when calling Start() will be called when the ID has been fetched // or on error. class DeviceIDFetcher : public base::RefCountedThreadSafe<DeviceIDFetcher> { public: typedef base::Callback<void(const std::string&)> IDCallback; explicit DeviceIDFetcher(int render_process_id); // Schedules the request operation. Returns false if a request is in progress, // true otherwise. bool Start(const IDCallback& callback); // Called to register the |kEnableDRM| and |kDRMSalt| preferences. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); // Return the path where the legacy device ID is stored (for ChromeOS only). static base::FilePath GetLegacyDeviceIDPath( const base::FilePath& profile_path); private: ~DeviceIDFetcher(); // Checks the preferences for DRM (whether DRM is enabled and getting the drm // salt) on the UI thread. void CheckPrefsOnUIThread(); // Compute the device ID on the UI thread with the given salt and machine ID. void ComputeOnUIThread(const std::string& salt, const std::string& machine_id); // Legacy method used to get the device ID for ChromeOS. void LegacyComputeOnBlockingPool(const base::FilePath& profile_path, const std::string& salt); // Runs the callback passed into Start() on the IO thread with the device ID // or the empty string on failure. void RunCallbackOnIOThread(const std::string& id); friend class base::RefCountedThreadSafe<DeviceIDFetcher>; // The callback to run when the ID has been fetched. IDCallback callback_; // Whether a request is in progress. bool in_progress_; int render_process_id_; DISALLOW_COPY_AND_ASSIGN(DeviceIDFetcher); }; } // namespace chrome #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_DEVICE_ID_FETCHER_H_
/* This file is part of the YAZ toolkit. * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** * \file * \brief UCS4 decoding and encoding */ #if HAVE_CONFIG_H #include <config.h> #endif #include <assert.h> #include <errno.h> #include <string.h> #include "iconv-p.h" static unsigned long read_UCS4(yaz_iconv_t cd, yaz_iconv_decoder_t d, unsigned char *inp, size_t inbytesleft, size_t *no_read) { unsigned long x = 0; if (inbytesleft < 4) { yaz_iconv_set_errno(cd, YAZ_ICONV_EINVAL); /* incomplete input */ *no_read = 0; } else { x = (inp[0]<<24) | (inp[1]<<16) | (inp[2]<<8) | inp[3]; *no_read = 4; } return x; } static unsigned long read_UCS4LE(yaz_iconv_t cd, yaz_iconv_decoder_t d, unsigned char *inp, size_t inbytesleft, size_t *no_read) { unsigned long x = 0; if (inbytesleft < 4) { yaz_iconv_set_errno(cd, YAZ_ICONV_EINVAL); /* incomplete input */ *no_read = 0; } else { x = (inp[3]<<24) | (inp[2]<<16) | (inp[1]<<8) | inp[0]; *no_read = 4; } return x; } static size_t write_UCS4(yaz_iconv_t cd, yaz_iconv_encoder_t en, unsigned long x, char **outbuf, size_t *outbytesleft) { unsigned char *outp = (unsigned char *) *outbuf; if (*outbytesleft >= 4) { *outp++ = (unsigned char) (x>>24); *outp++ = (unsigned char) (x>>16); *outp++ = (unsigned char) (x>>8); *outp++ = (unsigned char) x; (*outbytesleft) -= 4; } else { yaz_iconv_set_errno(cd, YAZ_ICONV_E2BIG); return (size_t)(-1); } *outbuf = (char *) outp; return 0; } static size_t write_UCS4LE(yaz_iconv_t cd, yaz_iconv_encoder_t en, unsigned long x, char **outbuf, size_t *outbytesleft) { unsigned char *outp = (unsigned char *) *outbuf; if (*outbytesleft >= 4) { *outp++ = (unsigned char) x; *outp++ = (unsigned char) (x>>8); *outp++ = (unsigned char) (x>>16); *outp++ = (unsigned char) (x>>24); (*outbytesleft) -= 4; } else { yaz_iconv_set_errno(cd, YAZ_ICONV_E2BIG); return (size_t)(-1); } *outbuf = (char *) outp; return 0; } yaz_iconv_encoder_t yaz_ucs4_encoder(const char *tocode, yaz_iconv_encoder_t e) { if (!yaz_matchstr(tocode, "UCS4")) e->write_handle = write_UCS4; else if (!yaz_matchstr(tocode, "UCS4LE")) e->write_handle = write_UCS4LE; else return 0; return e; } yaz_iconv_decoder_t yaz_ucs4_decoder(const char *tocode, yaz_iconv_decoder_t d) { if (!yaz_matchstr(tocode, "UCS4")) d->read_handle = read_UCS4; else if (!yaz_matchstr(tocode, "UCS4LE")) d->read_handle = read_UCS4LE; else return 0; return d; } /* * Local variables: * c-basic-offset: 4 * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */
/* * Copyright (c) 2005, Peter Sommerlad and IFS Institute for Software at HSR Rapperswil, Switzerland * All rights reserved. * * This library/application is free software; you can redistribute and/or modify it under the terms of * the license that is included with this library/application in the file license.txt. */ #ifndef _SegStorAllocatorNewDelete_H #define _SegStorAllocatorNewDelete_H #include "ITOStorage.h"//lint !e537 namespace coast { //! Segregated Storage Allocator for operator new/delete /*! Caution: This class is only intended for AnyImpl's! Subclassing from one of the various AnyImpl classes can lead to space leaks because of a possible size differences. */ template<typename T> class SegStorAllocatorNewDelete { public: static void *operator new( size_t, Allocator *a ) { return a->Malloc<sizeof(T)>(); } static void *operator new( size_t t ) { return operator new(t, storage::Global()); } static void operator delete( void *ptr, Allocator *a ) { a->Free<sizeof(T)>(ptr); } static void operator delete( void *ptr ) { operator delete(ptr, static_cast<T*>(ptr)->MyAllocator()); } static void *operator new[]( size_t sz, Allocator *a ) { if (a) { void *ptr = a->Malloc(sz + memory::AlignedSize<Allocator *>::value); memory::allocatorFor(ptr) = a; // remember address of responsible Allocator return reinterpret_cast<char *>(ptr) + memory::AlignedSize<Allocator *>::value; // needs cast because of pointer arithmetic } return a; } static void operator delete[]( void *ptr ) { void *realPtr = memory::realPtrFor(ptr); Allocator *a = memory::allocatorFor(realPtr); if (a) { memory::safeFree(a, realPtr); } else { free(realPtr); } } }; } #endif /* _SegStorAllocatorNewDelete_H */
/* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef Sk2DPathEffect_DEFINED #define Sk2DPathEffect_DEFINED #include "SkPath.h" #include "SkPathEffect.h" #include "SkMatrix.h" class SK_API Sk2DPathEffect : public SkPathEffect { public: bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const SK_OVERRIDE; protected: /** New virtual, to be overridden by subclasses. This is called once from filterPath, and provides the uv parameter bounds for the path. Subsequent calls to next() will receive u and v values within these bounds, and then a call to end() will signal the end of processing. */ virtual void begin(const SkIRect& uvBounds, SkPath* dst) const; virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const; virtual void end(SkPath* dst) const; /** Low-level virtual called per span of locations in the u-direction. The default implementation calls next() repeatedly with each location. */ virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; const SkMatrix& getMatrix() const { return fMatrix; } // protected so that subclasses can call this during unflattening explicit Sk2DPathEffect(const SkMatrix& mat); void flatten(SkWriteBuffer&) const SK_OVERRIDE; private: SkMatrix fMatrix, fInverse; bool fMatrixIsInvertible; // illegal Sk2DPathEffect(const Sk2DPathEffect&); Sk2DPathEffect& operator=(const Sk2DPathEffect&); friend class Sk2DPathEffectBlitter; typedef SkPathEffect INHERITED; }; class SK_API SkLine2DPathEffect : public Sk2DPathEffect { public: static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); } virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const SK_OVERRIDE; SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) protected: SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) : Sk2DPathEffect(matrix), fWidth(width) {} void flatten(SkWriteBuffer&) const SK_OVERRIDE; void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; private: SkScalar fWidth; typedef Sk2DPathEffect INHERITED; }; class SK_API SkPath2DPathEffect : public Sk2DPathEffect { public: /** * Stamp the specified path to fill the shape, using the matrix to define * the latice. */ static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) { return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); } SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) protected: SkPath2DPathEffect(const SkMatrix&, const SkPath&); void flatten(SkWriteBuffer&) const SK_OVERRIDE; void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; private: SkPath fPath; typedef Sk2DPathEffect INHERITED; }; #endif
#ifndef CHEF_H #define CHEF_H #include <apf.h> #include <apfMesh2.h> #include <gmi.h> #include <phInput.h> struct RStream; struct GRStream; namespace chef { /** @brief read and write to and from files */ void cook(gmi_model*& g, apf::Mesh2*& m); /** @brief read and write to and from files and load control info*/ void cook(gmi_model*& g, apf::Mesh2*& m, ph::Input& ctrl); /** @brief read from stream and write to files */ void cook(gmi_model*& g, apf::Mesh2*& m, ph::Input& ctrl, RStream* in); /** @brief read from files and write to stream */ void cook(gmi_model*& g, apf::Mesh2*& m, ph::Input& ctrl, GRStream* out); /** @brief read and write to and from streams */ void cook(gmi_model*& g, apf::Mesh2*& m, ph::Input& ctrl, RStream* in, GRStream* out); /** @brief read and attach fields from files */ void readAndAttachFields(ph::Input& ctrl, apf::Mesh2*& m); /** @brief load balance the partition then reorder the vertices */ void balanceAndReorder(ph::Input& ctrl, apf::Mesh2* m); /** @brief load balance the partition */ void balance(ph::Input& ctrl, apf::Mesh2* m); /** @brief adapt the mesh using the given szFld */ void adapt(apf::Mesh2* m, apf::Field* szFld); /** @brief adapt the mesh based on input control */ void adapt(apf::Mesh2* m, apf::Field* szFld, ph::Input& ctrl); /** @brief uniformly refine the mesh */ void uniformRefinement(ph::Input& ctrl, apf::Mesh2* m); /** @brief read fields from the mesh and write to files */ void preprocess(apf::Mesh2*& m, ph::Input& ctrl); /** @brief read fields from the mesh and write to streams */ void preprocess(apf::Mesh2*& m, ph::Input& ctrl, GRStream* out); } #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 CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_DELEGATE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_DELEGATE_H_ #include <unordered_map> #include "base/callback.h" #include "base/macros.h" #include "chromeos/services/secure_channel/pending_connection_request_delegate.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { namespace secure_channel { // Test PendingConnectionRequestDelegate implementation. class FakePendingConnectionRequestDelegate : public PendingConnectionRequestDelegate { public: FakePendingConnectionRequestDelegate(); FakePendingConnectionRequestDelegate( const FakePendingConnectionRequestDelegate&) = delete; FakePendingConnectionRequestDelegate& operator=( const FakePendingConnectionRequestDelegate&) = delete; ~FakePendingConnectionRequestDelegate() override; const absl::optional<FailedConnectionReason>& GetFailedConnectionReasonForId( const base::UnguessableToken& request_id); void set_closure_for_next_delegate_callback(base::OnceClosure closure) { closure_for_next_delegate_callback_ = std::move(closure); } private: // PendingConnectionRequestDelegate: void OnRequestFinishedWithoutConnection( const base::UnguessableToken& request_id, FailedConnectionReason reason) override; std::unordered_map<base::UnguessableToken, absl::optional<FailedConnectionReason>, base::UnguessableTokenHash> request_id_to_failed_connection_reason_map_; base::OnceClosure closure_for_next_delegate_callback_; }; } // namespace secure_channel } // namespace chromeos #endif // CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_DELEGATE_H_
#ifndef DYLOCXX__TEST__DOMAIN_FILTER_TEST_H__INCLUDED #define DYLOCXX__TEST__DOMAIN_FILTER_TEST_H__INCLUDED #include <gtest/gtest.h> #include "test_base.h" namespace dyloc { namespace test { class DomainFilterTest : public dyloc::test::TestBase { }; } // namespace dyloc } // namespace test #endif // DYLOCXX__TEST__DOMAIN_FILTER_TEST_H__INCLUDED
/* * Copyright © 2009 CNRS * Copyright © 2009 inria. All rights reserved. * Copyright © 2009 Université Bordeaux 1 * Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. */ #include <hwloc.h> #include <stdio.h> extern int do_test(void); int main(int argc, char *argv[]) { /* Make the test be in a separate library that will fail to link properly if hwloc forces compilation with visibility enabled. */ return do_test(); }
// // Copyright (c) Zach Wily // 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 Zach Wily 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. // #import <Cocoa/Cocoa.h> @class CIFilter; @class CIImage; @interface ZWTransitionImageView : NSView { NSImage *image; NSImage *oldImage; NSImage *actualOldImage; BOOL imageIsBlank; NSRect mattedImageRect; CIImage *inputShadingImage; // an environment-map image that the transitionFilter may use in generating the transition effect CIFilter *transitionFilter; // the Core Image transition filter that will generate the animation frames NSRect imageRect; // the subrect of the AnimatingTabView where the animating image should be composited NSAnimation *animation; } - (NSImage *)image; - (void)setImage:(NSImage *)newImage; @end
// 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. // This file is used to define IPC::ParamTraits<> specializations for a number // of types so that they can be serialized over IPC. IPC::ParamTraits<> // specializations for basic types (like int and std::string) and types in the // 'base' project can be found in ipc/ipc_message_utils.h. This file contains // specializations for types that are used by the content code, and which need // manual serialization code. This is usually because they're not structs with // public members, or because the same type is being used in multiple // *_messages.h headers. #ifndef CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ #define CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ /*FIXME #include "content/common/content_param_traits_macros.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/npruntime_util.h" #include "webkit/glue/webcursor.h" */ namespace net { class IPEndPoint; } namespace ui { class Range; } namespace content { // Define the NPVariant_Param struct and its enum here since it needs manual // serialization code. enum NPVariant_ParamEnum { NPVARIANT_PARAM_VOID, NPVARIANT_PARAM_NULL, NPVARIANT_PARAM_BOOL, NPVARIANT_PARAM_INT, NPVARIANT_PARAM_DOUBLE, NPVARIANT_PARAM_STRING, // Used when when the NPObject is running in the caller's process, so we // create an NPObjectProxy in the other process. NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID, // Used when the NPObject we're sending is running in the callee's process // (i.e. we have an NPObjectProxy for it). In that case we want the callee // to just use the raw pointer. NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID, }; struct NPVariant_Param { NPVariant_Param(); ~NPVariant_Param(); NPVariant_ParamEnum type; bool bool_value; int int_value; double double_value; std::string string_value; int npobject_routing_id; }; struct NPIdentifier_Param { NPIdentifier_Param(); ~NPIdentifier_Param(); NPIdentifier identifier; }; } // namespace content namespace IPC { template <> struct ParamTraits<net::IPEndPoint> { typedef net::IPEndPoint param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* p); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<content::NPVariant_Param> { typedef content::NPVariant_Param param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<content::NPIdentifier_Param> { typedef content::NPIdentifier_Param param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<ui::Range> { typedef ui::Range param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<WebCursor> { typedef WebCursor param_type; static void Write(Message* m, const param_type& p) { p.Serialize(m); } static bool Read(const Message* m, PickleIterator* iter, param_type* r) { return r->Deserialize(iter); } static void Log(const param_type& p, std::string* l) { l->append("<WebCursor>"); } }; typedef const WebKit::WebInputEvent* WebInputEventPointer; template <> struct ParamTraits<WebInputEventPointer> { typedef WebInputEventPointer param_type; static void Write(Message* m, const param_type& p); // Note: upon read, the event has the lifetime of the message. static bool Read(const Message* m, PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); }; } // namespace IPC #endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_
/* $Id: //depot/blt/lib/libc/qsort.c#1 $ */ /* $OpenBSD: qsort.c,v 1.5 1997/06/20 11:19:38 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/types.h> #include <stdlib.h> static __inline char *med3 (char *, char *, char *, int (*)()); static __inline void swapfunc (char *, char *, int, int); #define min(a, b) (a) < (b) ? a : b /* * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". */ #define swapcode(TYPE, parmi, parmj, n) { \ long i = (n) / sizeof (TYPE); \ register TYPE *pi = (TYPE *) (parmi); \ register TYPE *pj = (TYPE *) (parmj); \ do { \ register TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ } #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; static __inline void swapfunc(a, b, n, swaptype) char *a, *b; int n, swaptype; { if (swaptype <= 1) swapcode(long, a, b, n) else swapcode(char, a, b, n) } #define swap(a, b) \ if (swaptype == 0) { \ long t = *(long *)(a); \ *(long *)(a) = *(long *)(b); \ *(long *)(b) = t; \ } else \ swapfunc(a, b, es, swaptype) #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) static __inline char * med3(a, b, c, cmp) char *a, *b, *c; int (*cmp)(); { return cmp(a, b) < 0 ? (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c )); } void qsort(aa, n, es, cmp) void *aa; size_t n, es; int (*cmp)(); { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; int d, r, swaptype, swap_cnt; register char *a = aa; loop: SWAPINIT(a, es); swap_cnt = 0; if (n < 7) { for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es) for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; pl -= es) swap(pl, pl - es); return; } pm = (char *)a + (n / 2) * es; if (n > 7) { pl = (char *)a; pn = (char *)a + (n - 1) * es; if (n > 40) { d = (n / 8) * es; pl = med3(pl, pl + d, pl + 2 * d, cmp); pm = med3(pm - d, pm, pm + d, cmp); pn = med3(pn - 2 * d, pn - d, pn, cmp); } pm = med3(pl, pm, pn, cmp); } swap(a, pm); pa = pb = (char *)a + es; pc = pd = (char *)a + (n - 1) * es; for (;;) { while (pb <= pc && (r = cmp(pb, a)) <= 0) { if (r == 0) { swap_cnt = 1; swap(pa, pb); pa += es; } pb += es; } while (pb <= pc && (r = cmp(pc, a)) >= 0) { if (r == 0) { swap_cnt = 1; swap(pc, pd); pd -= es; } pc -= es; } if (pb > pc) break; swap(pb, pc); swap_cnt = 1; pb += es; pc -= es; } if (swap_cnt == 0) { /* Switch to insertion sort */ for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; pl -= es) swap(pl, pl - es); return; } pn = (char *)a + n * es; r = min(pa - (char *)a, pb - pa); vecswap(a, pb - r, r); r = min(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) qsort(a, r / es, es, cmp); if ((r = pd - pc) > es) { /* Iterate rather than recurse to save stack space */ a = pn - r; n = r / es; goto loop; } /* qsort(pn - r, r / es, es, cmp);*/ }
/** * @author: Lefteris Karapetsas * @licence: BSD3 (Check repository root for details) */ #include <rflib/defs/inline.h> #include <rflib/defs/types.h> #include <rflib/defs/retcodes.h> #include "rf_int.ph" char hexU [] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ,'A', 'B', 'C', 'D', 'E', 'F' }; char hexL [] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ,'a', 'b', 'c', 'd', 'e', 'f' }; //force creation of external symbols for inline functions i_INLINE_INS int intToStr(int64_t i, char *buff); i_INLINE_INS int uintToStr(uint64_t i, char *buff); i_INLINE_INS int uintToUHexStr(uint64_t i, char *buff); i_INLINE_INS int uintToLHexStr(uint64_t i, char *buff);
/***************************************************************************** Copyright (c) 2011, Intel Corp. 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 Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function zsytrs2 * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #include "lapacke.h" #include "lapacke_utils.h" lapack_int LAPACKE_zsytrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ) { lapack_int info = 0; lapack_complex_double* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zsytrs2", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zsy_nancheck( matrix_order, uplo, n, a, lda ) ) { return -5; } if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -8; } #endif /* Allocate memory for working array(s) */ work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_zsytrs2_work( matrix_order, uplo, n, nrhs, a, lda, ipiv, b, ldb, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zsytrs2", info ); } return info; }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncat_06.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-06.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: ncat * BadSink : Copy data to string using strncat * Flow Variant: 06 Control flow: if(STATIC_CONST_FIVE==5) and if(STATIC_CONST_FIVE!=5) * * */ #include "std_testcase.h" #include <wchar.h> /* The variable below is declared "const", so a tool should be able * to identify that reads of this will always give its initialized value. */ static const int STATIC_CONST_FIVE = 5; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncat_06_bad() { char * data; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} if(STATIC_CONST_FIVE==5) { /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ memset(data, 'A', 100-1); /* fill with 'A's */ data[100-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strncat(dest, data, strlen(data)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_FIVE==5 to STATIC_CONST_FIVE!=5 */ static void goodG2B1() { char * data; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} if(STATIC_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strncat(dest, data, strlen(data)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} if(STATIC_CONST_FIVE==5) { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strncat(dest, data, strlen(data)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncat_06_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncat_06_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_ncat_06_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifndef PE_UTILS_H #define PE_UTILS_H namespace pe { void print(const char* format, ...) __attribute__((format(printf,1,2))); void fail(const char* format, ...) __attribute__((noreturn, format(printf,1,2))); void failByAssert(const char* cond, const char* file, int line) __attribute__((noreturn)); } #define ASSERT(c) ((c)?((void)0):pe::failByAssert(#c,__FILE__,__LINE__)) #define CALL(c) ASSERT((c)==0) #endif
/******************************************************************************/ /** @file generic_dictionary_test.h @author IonDB Project @brief Entry point for dictionary tests. @copyright Copyright 2017 The University of British Columbia, IonDB Project Contributors (see AUTHORS.md) @par Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @par 1.Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. @par 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. @par 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. @par 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. */ /******************************************************************************/ #if !defined(GENERIC_DICTIONARY_TEST_H_) #define GENERIC_DICTIONARY_TEST_H_ #if defined(__cplusplus) extern "C" { #endif #include <stdlib.h> #include <limits.h> #include "../../planck-unit/src/planck_unit.h" #include "../../../key_value/kv_system.h" #include "../../../dictionary/dictionary_types.h" #include "./../../../dictionary/dictionary.h" #include "./../../../dictionary/ion_master_table.h" #define ION_GTEST_DATA "Test data, please ignore! 123 123 abc abc" int get_count_index_by_key( ion_key_t needle, ion_key_t *haystack, int length, ion_dictionary_t *dictionary ); typedef struct generic_test { ion_dictionary_t dictionary; ion_handler_initializer_t init_dict_handler; ion_key_type_t key_type; ion_key_size_t key_size; ion_value_size_t value_size; ion_dictionary_size_t dictionary_size; ion_dictionary_handler_t handler; } ion_generic_test_t; void init_generic_dictionary_test( ion_generic_test_t *test, ion_handler_initializer_t init_dict_handler, ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, ion_dictionary_size_t dictionary_size ); void cleanup_generic_dictionary_test( ion_generic_test_t *test ); void dictionary_test_init( ion_generic_test_t *test, planck_unit_test_t *tc ); void dictionary_test_insert_get( ion_generic_test_t *test, int num_to_insert, ion_key_t *keys, ion_result_count_t *counts, int length, planck_unit_test_t *tc ); void dictionary_test_insert_get_edge_cases( ion_generic_test_t *test, ion_key_t *keys, ion_result_count_t *counts, int length, planck_unit_test_t *tc ); void dictionary_test_delete( ion_generic_test_t *test, ion_key_t key_to_delete, ion_result_count_t count, planck_unit_test_t *tc ); void dictionary_test_update( ion_generic_test_t *test, ion_key_t key_to_update, ion_value_t update_with, ion_result_count_t count, planck_unit_test_t *tc ); void dictionary_test_equality( ion_generic_test_t *test, ion_key_t eq_key, planck_unit_test_t *tc ); void dictionary_test_range( ion_generic_test_t *test, ion_key_t lower_bound, ion_key_t upper_bound, planck_unit_test_t *tc ); void dictionary_test_all_records( ion_generic_test_t *test, int expected_count, planck_unit_test_t *tc ); void dictionary_test_open_close( ion_generic_test_t *test, planck_unit_test_t *tc ); #if defined(__cplusplus) } #endif #endif
#ifndef PERFORMANCE_PROFILER_H_ #define PERFORMANCE_PROFILER_H_ #include <omp.h> namespace itomp_cio_planner { class PerformanceProfiler: public Singleton<PerformanceProfiler> { public: PerformanceProfiler() : num_threads_(1), get_time_func_(NULL) { } virtual ~PerformanceProfiler() { } // non thread-safe functions. should be called after omp_set_num_threads() void initialize(double (*get_time_func)(), int num_threads); void addEntry(const char* entry_name); // clear last iteration void startIteration(); void printIterationTime(bool show_percentage = false); void printTotalTime(bool show_percentage = false); // thread-safe functions (in openMP) void startTimer(const char* entry_name); void endTimer(const char* entry_name); protected: class Entry { public: Entry(int num_threads); void initialize(int num_threads); void startIteration(); void startTimer(double (*get_time_func)()); void endTimer(double (*get_time_func)()); double getTotalElapsed() const; double getIterationElapsed() const; std::vector<double> timer_start_time_; std::vector<double> total_elapsed_; std::vector<double> iteration_elpased_; }; //double getROSWallTime(); std::map<std::string, Entry> entries_; int num_threads_; double (*get_time_func_)(); }; inline void PerformanceProfiler::initialize(double (*get_time_func)(), int num_threads) { get_time_func_ = get_time_func; // omp_get_num_threads doesn't work num_threads_ = num_threads;//omp_get_num_threads(); for (std::map<std::string, Entry>::iterator it = entries_.begin(); it != entries_.end(); ++it) it->second.initialize(num_threads_); } inline void PerformanceProfiler::addEntry(const char* entry_name) { entries_.insert(std::make_pair(entry_name, Entry(num_threads_))); } inline void PerformanceProfiler::startIteration() { for (std::map<std::string, Entry>::iterator it = entries_.begin(); it != entries_.end(); ++it) { it->second.startIteration(); } } inline void PerformanceProfiler::printIterationTime(bool show_percentage) { std::cout << "Elapsed Time\n"; std::cout.precision(std::numeric_limits<double>::digits10); double sum = 0.0; for (std::map<std::string, Entry>::iterator it = entries_.begin(); it != entries_.end(); ++it) { double elapsed = it->second.getIterationElapsed(); std::cout << it->first << " : " << std::fixed << elapsed << std::endl; sum += elapsed; } } inline void PerformanceProfiler::printTotalTime(bool show_percentage) { std::cout << "Total Elapsed Time\n"; std::cout.precision(std::numeric_limits<double>::digits10); double sum = 0.0; for (std::map<std::string, Entry>::iterator it = entries_.begin(); it != entries_.end(); ++it) { double elapsed = it->second.getTotalElapsed(); std::cout << it->first << " : " << std::fixed << elapsed << std::endl; sum += elapsed; } } // thread-safe inline void PerformanceProfiler::startTimer(const char* entry_name) { entries_.find(entry_name)->second.startTimer(get_time_func_); } inline void PerformanceProfiler::endTimer(const char* entry_name) { entries_.find(entry_name)->second.endTimer(get_time_func_); } /* inline double PerformanceProfiler::getROSWallTime() { return ros::WallTime::now().toSec(); } */ //////////////////////////////////////////////////////////////////////////////// inline PerformanceProfiler::Entry::Entry(int num_threads) { initialize(num_threads); } inline void PerformanceProfiler::Entry::initialize(int num_threads) { timer_start_time_.resize(num_threads, 0.0); total_elapsed_.resize(num_threads, 0.0); iteration_elpased_.resize(num_threads, 0.0); } inline void PerformanceProfiler::Entry::startIteration() { for (int i = 0; i < iteration_elpased_.size(); ++i) iteration_elpased_[i] = 0.0; } inline void PerformanceProfiler::Entry::startTimer(double (*get_time_func)()) { int thread_index = omp_get_thread_num(); timer_start_time_[thread_index] = (*get_time_func)(); } inline void PerformanceProfiler::Entry::endTimer(double (*get_time_func)()) { int thread_index = omp_get_thread_num(); double elapsed = (*get_time_func)() - timer_start_time_[thread_index]; iteration_elpased_[thread_index] += elapsed; total_elapsed_[thread_index] += elapsed; } inline double PerformanceProfiler::Entry::getTotalElapsed() const { double sum = 0.0; for (int i = 0; i < total_elapsed_.size(); ++i) sum += total_elapsed_[i]; return sum; } inline double PerformanceProfiler::Entry::getIterationElapsed() const { double sum = 0.0; for (int i = 0; i < iteration_elpased_.size(); ++i) sum += iteration_elpased_[i]; return sum; } } #endif /* PERFORMANCE_PROFILER_H_ */
/* dppt02.f -- translated by f2c (version 20061008). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static doublereal c_b5 = -1.; static integer c__1 = 1; static doublereal c_b7 = 1.; /* Subroutine */ int dppt02_(char *uplo, integer *n, integer *nrhs, doublereal *a, doublereal *x, integer *ldx, doublereal *b, integer * ldb, doublereal *rwork, doublereal *resid) { /* System generated locals */ integer b_dim1, b_offset, x_dim1, x_offset, i__1; doublereal d__1, d__2; /* Local variables */ integer j; doublereal eps; doublereal anorm, bnorm; doublereal xnorm; /* -- LAPACK test routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* DPPT02 computes the residual in the solution of a symmetric system */ /* of linear equations A*x = b when packed storage is used for the */ /* coefficient matrix. The ratio computed is */ /* RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS), */ /* where EPS is the machine precision. */ /* Arguments */ /* ========= */ /* UPLO (input) CHARACTER*1 */ /* Specifies whether the upper or lower triangular part of the */ /* symmetric matrix A is stored: */ /* = 'U': Upper triangular */ /* = 'L': Lower triangular */ /* N (input) INTEGER */ /* The number of rows and columns of the matrix A. N >= 0. */ /* NRHS (input) INTEGER */ /* The number of columns of B, the matrix of right hand sides. */ /* NRHS >= 0. */ /* A (input) DOUBLE PRECISION array, dimension (N*(N+1)/2) */ /* The original symmetric matrix A, stored as a packed */ /* triangular matrix. */ /* X (input) DOUBLE PRECISION array, dimension (LDX,NRHS) */ /* The computed solution vectors for the system of linear */ /* equations. */ /* LDX (input) INTEGER */ /* The leading dimension of the array X. LDX >= max(1,N). */ /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */ /* On entry, the right hand side vectors for the system of */ /* linear equations. */ /* On exit, B is overwritten with the difference B - A*X. */ /* LDB (input) INTEGER */ /* The leading dimension of the array B. LDB >= max(1,N). */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (N) */ /* RESID (output) DOUBLE PRECISION */ /* The maximum over the number of right hand sides of */ /* norm(B - A*X) / ( norm(A) * norm(X) * EPS ). */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Executable Statements .. */ /* Quick exit if N = 0 or NRHS = 0. */ /* Parameter adjustments */ --a; x_dim1 = *ldx; x_offset = 1 + x_dim1; x -= x_offset; b_dim1 = *ldb; b_offset = 1 + b_dim1; b -= b_offset; --rwork; /* Function Body */ if (*n <= 0 || *nrhs <= 0) { *resid = 0.; return 0; } /* Exit with RESID = 1/EPS if ANORM = 0. */ eps = dlamch_("Epsilon"); anorm = dlansp_("1", uplo, n, &a[1], &rwork[1]); if (anorm <= 0.) { *resid = 1. / eps; return 0; } /* Compute B - A*X for the matrix of right hand sides B. */ i__1 = *nrhs; for (j = 1; j <= i__1; ++j) { dspmv_(uplo, n, &c_b5, &a[1], &x[j * x_dim1 + 1], &c__1, &c_b7, &b[j * b_dim1 + 1], &c__1); /* L10: */ } /* Compute the maximum over the number of right hand sides of */ /* norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) . */ *resid = 0.; i__1 = *nrhs; for (j = 1; j <= i__1; ++j) { bnorm = dasum_(n, &b[j * b_dim1 + 1], &c__1); xnorm = dasum_(n, &x[j * x_dim1 + 1], &c__1); if (xnorm <= 0.) { *resid = 1. / eps; } else { /* Computing MAX */ d__1 = *resid, d__2 = bnorm / anorm / xnorm / eps; *resid = max(d__1,d__2); } /* L20: */ } return 0; /* End of DPPT02 */ } /* dppt02_ */
/* $Id$ This file is part of libmspcore Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ #ifndef MSP_DEBUG_DEMANGLE_H_ #define MSP_DEBUG_DEMANGLE_H_ #include <string> namespace Msp { namespace Debug { inline std::string demangle(const std::string &); } // namespace Debug } // namespace Msp /* The Source Implementation */ /* $Id$ This file is part of libmspcore Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ #include <cstdlib> #include <cxxabi.h> #include "demangle.h" namespace Msp { namespace Debug { inline std::string demangle(const std::string &sym) { #ifdef __GNUC__ int status; char *dm=abi::__cxa_demangle(sym.c_str(), 0, 0, &status); std::string result; if(status==0) result=dm; else result=sym; free(dm); return result; #else return sym; #endif } } // namespace Debug } // namespace Msp #endif /* EOF */
// Generated by gencpp from file path_follower/Pose2D.msg // DO NOT EDIT! #ifndef PATH_FOLLOWER_MESSAGE_POSE2D_H #define PATH_FOLLOWER_MESSAGE_POSE2D_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> namespace path_follower { template <class ContainerAllocator> struct Pose2D_ { typedef Pose2D_<ContainerAllocator> Type; Pose2D_() : x(0.0) , y(0.0) , theta(0.0) , angle(0.0) { } Pose2D_(const ContainerAllocator& _alloc) : x(0.0) , y(0.0) , theta(0.0) , angle(0.0) { (void)_alloc; } typedef double _x_type; _x_type x; typedef double _y_type; _y_type y; typedef double _theta_type; _theta_type theta; typedef double _angle_type; _angle_type angle; typedef boost::shared_ptr< ::path_follower::Pose2D_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::path_follower::Pose2D_<ContainerAllocator> const> ConstPtr; }; // struct Pose2D_ typedef ::path_follower::Pose2D_<std::allocator<void> > Pose2D; typedef boost::shared_ptr< ::path_follower::Pose2D > Pose2DPtr; typedef boost::shared_ptr< ::path_follower::Pose2D const> Pose2DConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::path_follower::Pose2D_<ContainerAllocator> & v) { ros::message_operations::Printer< ::path_follower::Pose2D_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace path_follower namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False} // {'std_msgs': ['/opt/ros/indigo/share/std_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/indigo/share/geometry_msgs/cmake/../msg'], 'sensor_msgs': ['/opt/ros/indigo/share/sensor_msgs/cmake/../msg'], 'path_follower': ['/home/luciawen/Desktop/control_ws/src/path_follower/msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::path_follower::Pose2D_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsFixedSize< ::path_follower::Pose2D_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::path_follower::Pose2D_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::path_follower::Pose2D_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::path_follower::Pose2D_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::path_follower::Pose2D_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::path_follower::Pose2D_<ContainerAllocator> > { static const char* value() { return "170a89b25e2e5ad972c2ab2a2b4c6f26"; } static const char* value(const ::path_follower::Pose2D_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x170a89b25e2e5ad9ULL; static const uint64_t static_value2 = 0x72c2ab2a2b4c6f26ULL; }; template<class ContainerAllocator> struct DataType< ::path_follower::Pose2D_<ContainerAllocator> > { static const char* value() { return "path_follower/Pose2D"; } static const char* value(const ::path_follower::Pose2D_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::path_follower::Pose2D_<ContainerAllocator> > { static const char* value() { return "float64 x\n\ float64 y\n\ float64 theta\n\ float64 angle #steering wheel angle (rad)\n\ \n\ "; } static const char* value(const ::path_follower::Pose2D_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::path_follower::Pose2D_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.x); stream.next(m.y); stream.next(m.theta); stream.next(m.angle); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct Pose2D_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::path_follower::Pose2D_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::path_follower::Pose2D_<ContainerAllocator>& v) { s << indent << "x: "; Printer<double>::stream(s, indent + " ", v.x); s << indent << "y: "; Printer<double>::stream(s, indent + " ", v.y); s << indent << "theta: "; Printer<double>::stream(s, indent + " ", v.theta); s << indent << "angle: "; Printer<double>::stream(s, indent + " ", v.angle); } }; } // namespace message_operations } // namespace ros #endif // PATH_FOLLOWER_MESSAGE_POSE2D_H
#include "spacewar.h" //************************************************************ // externals // extern volatile int xinit, yinit; extern void cline(int, int); extern void point(rkt_data *); //************************************************************ // // rkt1 // // draws rocket # 1 // /* Description: Draws rocket 1 made of five lines. This rocket looks like the starship enterprise. Also draws rocket 1 torpedos as points. */ void rocket1(rkt_data *rkt1) { int dif_yx, sum_yx; int xfin, yfin; dif_yx = (rkt1->ysize >> 1) - (rkt1->xsize >> 1); sum_yx = (rkt1->ysize >> 1) + (rkt1->xsize >> 1); xinit = rkt1->xdisp + rkt1->xsize; yinit = rkt1->ydisp + rkt1->ysize; xfin = rkt1->xdisp - (rkt1->xsize >> 1); yfin = rkt1->ydisp - (rkt1->ysize >> 1); cline(xfin, yfin); // draw line #1 xfin = xinit - dif_yx; yfin = yinit + sum_yx; xinit -= sum_yx; yinit -= dif_yx; cline(xfin, yfin); // draw line #2 xfin = xinit + sum_yx; yfin = yinit + dif_yx; cline(xfin, yfin); // draw line #3 xfin = xinit + dif_yx; yfin = yinit - sum_yx; cline(xfin, yfin); // draw line #4 xfin = xinit - sum_yx + dif_yx; yfin = yinit - sum_yx - dif_yx; cline(xfin, yfin); // draw line #5 point(rkt1); // update and draw rkt1's torpedoes }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_DRAG_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_DRAG_MOJOM_TRAITS_H_ #include <stdint.h> #include "mojo/public/cpp/base/big_buffer.h" #include "mojo/public/cpp/base/file_path_mojom_traits.h" #include "mojo/public/cpp/bindings/array_traits_web_vector.h" #include "mojo/public/cpp/bindings/string_traits_wtf.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "mojo/public/cpp/bindings/union_traits.h" #include "services/network/public/mojom/referrer_policy.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/data_transfer/data_transfer.mojom-shared.h" #include "third_party/blink/public/mojom/drag/drag.mojom-shared.h" #include "third_party/blink/public/mojom/file_system_access/file_system_access_data_transfer_token.mojom-blink.h" #include "third_party/blink/public/platform/web_drag_data.h" #include "third_party/blink/renderer/platform/mojo/kurl_mojom_traits.h" #include "third_party/blink/renderer/platform/mojo/string16_mojom_traits.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { template <typename T> class WebVector; } namespace mojo { template <> struct PLATFORM_EXPORT StructTraits<blink::mojom::DragItemStringDataView, blink::WebDragData::Item> { static WTF::String string_type(blink::WebDragData::Item item); static WTF::String string_data(const blink::WebDragData::Item& item); static WTF::String title(const blink::WebDragData::Item& item); static absl::optional<blink::KURL> base_url( const blink::WebDragData::Item& item); static bool Read(blink::mojom::DragItemStringDataView data, blink::WebDragData::Item* out); }; template <> struct PLATFORM_EXPORT StructTraits<blink::mojom::DataTransferFileDataView, blink::WebDragData::Item> { static base::FilePath path(const blink::WebDragData::Item& item); static base::FilePath display_name(const blink::WebDragData::Item& item); static mojo::PendingRemote< blink::mojom::blink::FileSystemAccessDataTransferToken> file_system_access_token(const blink::WebDragData::Item& item); static bool Read(blink::mojom::DataTransferFileDataView data, blink::WebDragData::Item* out); }; template <> struct PLATFORM_EXPORT StructTraits<blink::mojom::DragItemBinaryDataView, blink::WebDragData::Item> { static mojo_base::BigBuffer data(const blink::WebDragData::Item& item); static bool is_accessible_from_start_frame( const blink::WebDragData::Item& item); static blink::KURL source_url(const blink::WebDragData::Item& item); static base::FilePath filename_extension( const blink::WebDragData::Item& item); static WTF::String content_disposition(const blink::WebDragData::Item& item); static bool Read(blink::mojom::DragItemBinaryDataView data, blink::WebDragData::Item* out); }; template <> struct PLATFORM_EXPORT StructTraits<blink::mojom::DragItemFileSystemFileDataView, blink::WebDragData::Item> { static blink::KURL url(const blink::WebDragData::Item& item); static int64_t size(const blink::WebDragData::Item& item); static WTF::String file_system_id(const blink::WebDragData::Item& item); static bool Read(blink::mojom::DragItemFileSystemFileDataView data, blink::WebDragData::Item* out); }; template <> struct PLATFORM_EXPORT UnionTraits<blink::mojom::DragItemDataView, blink::WebDragData::Item> { static const blink::WebDragData::Item& string( const blink::WebDragData::Item& item) { return item; } static const blink::WebDragData::Item& file( const blink::WebDragData::Item& item) { return item; } static const blink::WebDragData::Item& binary( const blink::WebDragData::Item& item) { return item; } static const blink::WebDragData::Item& file_system_file( const blink::WebDragData::Item& item) { return item; } static bool Read(blink::mojom::DragItemDataView data, blink::WebDragData::Item* out); static blink::mojom::DragItemDataView::Tag GetTag( const blink::WebDragData::Item& item); }; template <> struct PLATFORM_EXPORT StructTraits<blink::mojom::DragDataDataView, blink::WebDragData> { static blink::WebVector<blink::WebDragData::Item> items( const blink::WebDragData& drag_data); static WTF::String file_system_id(const blink::WebDragData& drag_data); static network::mojom::ReferrerPolicy referrer_policy( const blink::WebDragData& drag_data); static bool Read(blink::mojom::DragDataDataView data, blink::WebDragData* out); }; } // namespace mojo #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_DRAG_MOJOM_TRAITS_H_
// // AssimpImageCache.h // AssimpKit-iOS // // Created by The Almighty Dwayne Coussement on 12/07/2018. // #import <Foundation/Foundation.h> #import <ImageIO/ImageIO.h> NS_ASSUME_NONNULL_BEGIN @interface AssimpImageCache : NSObject - (CGImageRef)cachedFileAtPath:(NSString *)path; - (void)storeImage:(CGImageRef)image toPath:(NSString *)path; @end NS_ASSUME_NONNULL_END
/**/ #include <stdio.h> #include <math.h> int main() { int n,digit,neg; printf("\nEnter an integer > "); scanf("%d",&n); if (n<1) neg=1;// while (n==0){ printf("\n%d",n); break; } digit=0; while (n!=0){ digit=n%10; // {if ((neg)&&(fabs(n)<10)) printf("\n%d",digit);// if ((neg)&&(fabs(n)>=10)) printf("\n%d",digit/(-1));// if (!neg) printf("\n%d",digit); // } n=(n-digit)/10; } printf("\nThat's all, have a nice day!"); return 0; }
/* * Copyright 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. */ // // TarGenerator generates a tar byte stream (uncompressed). // // A tar byte stream consists of a series of file headers, each followed by // the actual file data. Each file header starts on a block-aligned offset // with the blocksize 512. The start of data for each file is also // block-aligned. Zero-padding is added at the end of the file's data, // if necessary to block-align... // // The normal usage is to call the AddFile() method for each file to add to the // archive, then make one or more calls to AddFileBytes() to give the file's // data. Then repeat this sequence for each file to be added. When done, // call Finalize(). #ifndef O3D_IMPORT_CROSS_TAR_GENERATOR_H_ #define O3D_IMPORT_CROSS_TAR_GENERATOR_H_ #include <map> #include <string> #include "base/basictypes.h" #include "core/cross/types.h" #include "import/cross/iarchive_generator.h" #include "import/cross/memory_buffer.h" #include "import/cross/memory_stream.h" namespace o3d { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class TarGenerator : public IArchiveGenerator { public: explicit TarGenerator(StreamProcessor *callback_client) : callback_client_(callback_client), data_block_buffer_(TAR_BLOCK_SIZE), // initialized to zeroes data_buffer_stream_(data_block_buffer_, TAR_BLOCK_SIZE) {} // Call AddFile() for each file entry, followed by calls to AddFileBytes() // for the file's data. Returns true on success. virtual bool AddFile(const String &file_name, size_t file_size); // Call to "push" bytes to be processed - our client will get called back // with the byte stream, with files rounded up to the nearest block size // (with zero padding) virtual int AddFileBytes(MemoryReadStream *stream, size_t n); // Must call this after all files and file data have been written virtual void Close(bool success); private: // Returns true on success. bool AddEntry(const String &file_name, size_t file_size, bool is_directory); // Returns true on success. bool AddDirectory(const String &file_name); // Returns true on success. bool AddDirectoryEntryIfNeeded(const String &file_name); // Checksum for each header void ComputeCheckSum(uint8 *header); // Writes a head block. void WriteHeader(const String& filename, size_t file_size, char type, int mode, int user_id, int group_id, int mod_time); // flushes buffered file data to the client callback // if |flush_padding_zeroes| is |true| then flush a complete block // with zero padding even if less was buffered void FlushDataBuffer(bool flush_padding_zeroes); enum {TAR_HEADER_SIZE = 512}; enum {TAR_BLOCK_SIZE = 512}; StreamProcessor *callback_client_; // Buffers file data here - file data is in multiples of TAR_BLOCK_SIZE MemoryBuffer<uint8> data_block_buffer_; MemoryWriteStream data_buffer_stream_; // We use DirectoryMap to keep track of which directories we've already // written out headers for. The client doesn't need to explicitly // add the directory entries. Instead, the files will be stripped to their // base path and entries added for the directories as needed... struct StrCmp { bool operator()(const std::string &s1, const std::string &s2) const { return strcmp(s1.c_str(), s2.c_str()) < 0; } }; typedef std::map<const std::string, bool, StrCmp> DirectoryMap; DirectoryMap directory_map_; DISALLOW_COPY_AND_ASSIGN(TarGenerator); }; } // namespace o3d #endif // O3D_IMPORT_CROSS_TAR_GENERATOR_H_
// Copyright (c) 2012, HTW Berlin / Project HardMut // (http://www.hardmut-projekt.de) // // 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 HTW Berlin / INKA Research Group nor the names // of its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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. // // PageElementPersistency.h // iDiary2 // // Created by Markus Konrad on 13.07.11. // Copyright 2011 INKA Forschungsgruppe. All rights reserved. // #import <Foundation/Foundation.h> @protocol PageElementPersistencyProtocol <NSObject> -(id)saveElementStatus; -(void)loadElementStatus:(id)saveData; -(NSString *)getIdentifer; @end @interface PersistentPageElement : NSObject { NSString *identifier; id<PageElementPersistencyProtocol> element; // the element that handles loading / saving. retained NSObject *data; // the saved data or nil. retained } @property (nonatomic,readonly) NSString *identifier; @property (nonatomic,readonly) id<PageElementPersistencyProtocol> element; @property (nonatomic,readonly) id data; -(id)initElement:(id<PageElementPersistencyProtocol>) pElement withIdentifier:(NSString *)ident; -(void)save; -(void)load; -(void)clear; @end
// // TapItHelpers.h // TapIt-iOS-Sample // // Created by Nick Penteado on 5/16/13. // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> UIInterfaceOrientation TapItInterfaceOrientation(); UIWindow *TapItKeyWindow(); UIViewController *TapItTopViewController(); CGFloat TapItStatusBarHeight(); CGRect TapItApplicationFrame(UIInterfaceOrientation orientation); CGRect TapItScreenBounds(UIInterfaceOrientation orientation); CGAffineTransform TapItRotationTransformForOrientation(UIInterfaceOrientation orientation);
/* * ExprEvaluator.h * * This file is part of the "XieXie 2.0 Project" (Copyright (c) 2014 by Lukas Hermanns) * See "LICENSE.txt" for license information. */ #ifndef __XX_EXPR_EVALUATOR_H__ #define __XX_EXPR_EVALUATOR_H__ #include "Visitor.h" class ErrorReporter; namespace ContextAnalyzer { using namespace AbstractSyntaxTrees; /** Base class for all compile-time expression evaluators. \see ExprBoolEvaluator \see ExprIntEvaluator \see ExprFloatEvaluator */ class ExprEvaluator : protected Visitor { protected: DECL_VISIT_PROC( CastExpr ); DECL_VISIT_PROC( ProcCallExpr ); DECL_VISIT_PROC( PostfixValueExpr ); DECL_VISIT_PROC( InstanceOfExpr ); DECL_VISIT_PROC( AllocExpr ); DECL_VISIT_PROC( VarAccessExpr ); DECL_VISIT_PROC( InitListExpr ); DECL_VISIT_PROC( RangeExpr ); ErrorReporter* errorReporter_ = nullptr; }; } // /namespace SyntaxAnalyzer #endif // ================================================================================
#ifndef THREAD_H #define THREAD_H #define ACQUIRE_SUCCESS 0 #define ACQUIRE_WAIT 1 #define ACQUIRE_UNNECESSARY (-1) #include <unistd.h> #include <vector> #include "VirtualMachine.h" #include "Machine.h" #include <iostream> #include <queue> #include <cstring> #include "Mutex.h" using namespace std; #define NUM_RQS 4 #define VM_THREAD_PRIORITY_NIL ((TVMThreadPriority)0x00) class Thread; extern queue<Thread*> *readyQ[NUM_RQS]; typedef void (*ThreadEntry)(void *param); class Mutex; class Thread { static TVMThreadID nextID; //increment every time a thread is created. Decrement never. SMachineContext context; TVMThreadPriority priority; volatile TVMThreadState state; TVMThreadID id; volatile int ticks; uint8_t *stackBase; TVMMemorySize stackSize; TVMThreadEntry entry; void *param; volatile int cd; //calldata vector<Mutex*> *heldMutex; Mutex* waiting; public: Thread(); Thread(const TVMThreadPriority &pri, const TVMThreadState &st, TVMThreadIDRef tid, uint8_t *sb, TVMMemorySize ss, const ThreadEntry &entryFunc, void *p); ~Thread(); int acquireMutex(Mutex* mtx, TVMTick timeout); // m void decrementTicks(); Mutex* findMutex(TVMMutexID id); // m volatile int getcd(); SMachineContext* getContextRef(); TVMThreadEntry getEntry(); TVMThreadIDRef getIDRef(); TVMThreadPriority getPriority(); volatile TVMThreadState getState(); volatile int getTicks(); void releaseAllMutex(); bool releaseMutex(TVMMutexID); // m void setcd(volatile int calldata); void setContext(SMachineContext c); void setID(TVMThreadID newID); void setPriority(TVMThreadPriority pri); void setState(TVMThreadState newstate); void setTicks(volatile int newticks); void stopWaiting(); }; #endif
// // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2010 Alessandro Tasora // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file at the top level of the distribution // and at http://projectchrono.org/license-chrono.txt. // #ifndef CHC_ABSOLUTEAABB_H #define CHC_ABSOLUTEAABB_H ////////////////////////////////////////////////// // // ChCAbsoluteAABB.h // // Header for defining axis-aligned bounding // boxes in absolute space, to be used with // the 'sweep and prune' broad-phase // collision detection stage. // // HEADER file for CHRONO, // Multibody dynamics engine // // ------------------------------------------------ // www.deltaknowledge.com // ------------------------------------------------ /////////////////////////////////////////////////// namespace chrono { namespace collision { /// Class for end point, to be used for X or Y or Z lists of /// the 'sweep and prune' broad-phase collision. template<class coll_model_type> class ChIntervalEndpoint { public: /// Constructor ChIntervalEndpoint(void):m_type(0),m_model(0){}; /// Initialize void init(coll_model_type* model, const unsigned int & type) { assert(model); assert(type==0 || type==1); this->m_model = model; this->m_type = type; }; public: double m_value; ///< scalar value of the endpoint. coll_model_type* m_model; ///< pointer to the body. unsigned int m_type; ///< start point=0; end point =1; }; /// Header for defining AABB (axis-aligned bounding /// boxes) in absolute space, to be used with /// the 'sweep and prune' broad-phase /// collision detection stage. This AABB is made of eight /// ChIntervalEndpoint() items. template<class coll_model_type> class ChAbsoluteAABB { public: ChAbsoluteAABB(void):m_model(0){}; void init(coll_model_type* amodel) { if(!m_model) { m_model = amodel; m_beginX.init(amodel,0); m_beginY.init(amodel,0); m_beginZ.init(amodel,0); m_endX.init(amodel,1); m_endY.init(amodel,1); m_endZ.init(amodel,1); } assert(m_model); }; public: coll_model_type* m_model; ///< A pointer to the corresponding collision model this AABB encloses. ChIntervalEndpoint<coll_model_type> m_beginX; ChIntervalEndpoint<coll_model_type> m_beginY; ChIntervalEndpoint<coll_model_type> m_beginZ; ChIntervalEndpoint<coll_model_type> m_endX; ChIntervalEndpoint<coll_model_type> m_endY; ChIntervalEndpoint<coll_model_type> m_endZ; }; } // END_OF_NAMESPACE____ } // END_OF_NAMESPACE____ #endif
/* * This file is part of the Soletta Project * * Copyright (C) 2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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. */ #include <sys/stat.h> #include "sol-certificate.h" #define SOL_LOG_DOMAIN &_sol_certificate_log_domain #include "sol-log-internal.h" #include "sol-util.h" #include "sol-util.h" #include "sol-vector.h" SOL_LOG_INTERNAL_DECLARE(_sol_certificate_log_domain, "certificate"); struct sol_cert { int refcnt; char *filename; }; static struct sol_ptr_vector storage = SOL_PTR_VECTOR_INIT; static const char *const search_paths[] = { "ssl/certs", "ssl/private", "pki/tls/certs", "pki/tls/private", NULL, }; static char * find_cert(const char *filename, const char *const paths[]) { const char *ssl_cert_dir = getenv("SSL_CERT_DIR"); struct sol_buffer buffer = SOL_BUFFER_INIT_EMPTY; struct stat st; int idx; int r; /* Check absolute path */ if (stat(filename, &st) == 0 && S_ISREG(st.st_mode) && st.st_mode & S_IRUSR) return strdup(filename); /* Check SSL_CERT_DIR */ if (ssl_cert_dir) { r = sol_buffer_append_printf(&buffer, "%s/%s", ssl_cert_dir, filename); SOL_INT_CHECK(r, != 0, NULL); if (stat(buffer.data, &st) == 0 && S_ISREG(st.st_mode) && st.st_mode & S_IRUSR) return sol_buffer_steal(&buffer, NULL); sol_buffer_reset(&buffer); } /* Search known paths */ for (idx = 0; search_paths[idx] != 0; idx++) { r = sol_buffer_append_printf(&buffer, "%s/%s/%s", SYSCONF, search_paths[idx], filename); SOL_INT_CHECK(r, != 0, NULL); if (stat(buffer.data, &st) == 0 && S_ISREG(st.st_mode) && st.st_mode & S_IRUSR) return sol_buffer_steal(&buffer, NULL); sol_buffer_reset(&buffer); } sol_buffer_fini(&buffer); return NULL; } SOL_API struct sol_cert * sol_cert_load_from_file(const char *filename) { struct sol_cert *cert; char *path; int idx; int r; SOL_NULL_CHECK(filename, NULL); SOL_PTR_VECTOR_FOREACH_IDX (&storage, cert, idx) { if (streq(cert->filename, filename)) { cert->refcnt++; return cert; } } path = find_cert(filename, search_paths); if (path == NULL) { SOL_WRN("Certificate not found: %s", filename); return NULL; } cert = calloc(1, sizeof(*cert)); SOL_NULL_CHECK_GOTO(cert, cert_alloc_error); cert->refcnt++; cert->filename = path; r = sol_ptr_vector_append(&storage, cert); SOL_INT_CHECK_GOTO(r, != 0, insert_error); return cert; insert_error: free(cert); cert_alloc_error: free(path); return NULL; } SOL_API void sol_cert_unref(struct sol_cert *cert) { if (cert == NULL) return; cert->refcnt--; if (cert->refcnt > 0) return; sol_ptr_vector_remove(&storage, cert); free(cert->filename); free(cert); } SOL_API const char * sol_cert_get_filename(const struct sol_cert *cert) { SOL_NULL_CHECK(cert, NULL); return cert->filename; }
#ifndef MUDUO_BASE_TYPES_H #define MUDUO_BASE_TYPES_H #define MUDUO_STD_STRING #include <stdint.h> #ifdef MUDUO_STD_STRING #include <string> #else // !MUDUO_STD_STRING #include <ext/vstring.h> #include <ext/vstring_fwd.h> #endif /// /// The most common stuffs. /// namespace muduo { #ifdef MUDUO_STD_STRING using std::string; #else // !MUDUO_STD_STRING typedef __gnu_cxx::__sso_string string; #endif // Taken from google-protobuf stubs/common.h // // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // http://code.google.com/p/protobuf/ // // 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. // Author: kenton@google.com (Kenton Varda) and others // // Contains basic types and utilities used by the rest of the library. // // Use implicit_cast as a safe version of static_cast or const_cast // for upcasting in the type hierarchy (i.e. casting a pointer to Foo // to a pointer to SuperclassOfFoo or casting a pointer to Foo to // a const pointer to Foo). // When you use implicit_cast, the compiler checks that the cast is safe. // Such explicit implicit_casts are necessary in surprisingly many // situations where C++ demands an exact type match instead of an // argument type convertable to a target type. // // The From type can be inferred, so the preferred syntax for using // implicit_cast is the same as for static_cast etc.: // // implicit_cast<ToType>(expr) // // implicit_cast would have been part of the C++ standard library, // but the proposal was submitted too late. It will probably make // its way into the language in the future. template<typename To, typename From> inline To implicit_cast(From const &f) { return f; } // When you upcast (that is, cast a pointer from type Foo to type // SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts // always succeed. When you downcast (that is, cast a pointer from // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because // how do you know the pointer is really of type SubclassOfFoo? It // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus, // when you downcast, you should use this macro. In debug mode, we // use dynamic_cast<> to double-check the downcast is legal (we die // if it's not). In normal mode, we do the efficient static_cast<> // instead. Thus, it's important to test in debug mode to make sure // the cast is legal! // This is the only place in the code we should use dynamic_cast<>. // In particular, you SHOULDN'T be using dynamic_cast<> in order to // do RTTI (eg code like this: // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo); // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo); // You should design the code some other way not to need this. template<typename To, typename From> // use like this: down_cast<T*>(foo); inline To down_cast(From* f) { // so we only accept pointers // Ensures that To is a sub-type of From *. This test is here only // for compile-time type checking, and has no overhead in an // optimized build at run-time, as it will be optimized away // completely. if (false) { implicit_cast<From*, To>(0); } #if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI) assert(f == NULL || dynamic_cast<To>(f) != NULL); // RTTI: debug mode only! #endif return static_cast<To>(f); } } #endif
/* $OpenBSD: radioio.h,v 1.1 2001/10/04 19:17:59 gluk Exp $ */ /* $RuOBSD: radioio.h,v 1.3 2001/09/29 17:10:16 pva Exp $ */ /* * Copyright (c) 2001 Maxim Tsyplakov <tm@oganer.net>, * Vladimir Popov <jumbo@narod.ru> * 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 AUTHORS ``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 AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _SYS_RADIOIO_H_ #define _SYS_RADIOIO_H_ #define MIN_FM_FREQ 87500 #define MAX_FM_FREQ 108000 #define IF_FREQ 10700 #define RADIO_CAPS_DETECT_STEREO (1<<0) #define RADIO_CAPS_DETECT_SIGNAL (1<<1) #define RADIO_CAPS_SET_MONO (1<<2) #define RADIO_CAPS_HW_SEARCH (1<<3) #define RADIO_CAPS_HW_AFC (1<<4) #define RADIO_CAPS_REFERENCE_FREQ (1<<5) #define RADIO_CAPS_LOCK_SENSITIVITY (1<<6) #define RADIO_CAPS_RESERVED1 (1<<7) #define RADIO_CAPS_RESERVED2 (0xFF<<8) #define RADIO_CARD_TYPE (0xFF<<16) #define RADIO_INFO_STEREO (1<<0) #define RADIO_INFO_SIGNAL (1<<1) /* Radio device operations */ #define RIOCSMUTE _IOW('R', 21, u_long) /* set mute/unmute */ #define RIOCGMUTE _IOR('R', 21, u_long) /* get mute state */ #define RIOCGVOLU _IOR('R', 22, u_long) /* get volume */ #define RIOCSVOLU _IOW('R', 22, u_long) /* set volume */ #define RIOCGMONO _IOR('R', 23, u_long) /* get mono/stereo */ #define RIOCSMONO _IOW('R', 23, u_long) /* toggle mono/stereo */ #define RIOCGFREQ _IOR('R', 24, u_long) /* get frequency (in kHz) */ #define RIOCSFREQ _IOW('R', 24, u_long) /* set frequency (in kHz) */ #define RIOCSSRCH _IOW('R', 25, u_long) /* search up/down */ #define RIOCGCAPS _IOR('R', 26, u_long) /* get card capabilities */ #define RIOCGINFO _IOR('R', 27, u_long) /* get generic information */ #define RIOCSREFF _IOW('R', 28, u_long) /* set reference frequency */ #define RIOCGREFF _IOR('R', 28, u_long) /* get reference frequency */ #define RIOCSLOCK _IOW('R', 29, u_long) /* set lock sensetivity */ #define RIOCGLOCK _IOR('R', 29, u_long) /* get lock sensetivity */ #endif /* _SYS_RADIOIO_H_ */
/***************************************************************************/ /* */ /* ftbase.c */ /* */ /* Single object library component (body only). */ /* */ /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #include <freetype/ft2build.h> #define FT_MAKE_OPTION_SINGLE_OBJECT #include "ftpic.c" #include "basepic.c" #include "ftadvanc.h" #include "ftcalc.h" #include "ftdbgmem.c" #include "ftgloadr.h" #include "ftobjs.h" #include "ftoutln.h" #include "ftrfork.h" #include "ftsnames.h" #include "ftstream.h" #include "fttrigon.h" #include "ftutil.h" #if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON ) #include "ftmac.c" #endif /* END */
#ifndef spset_E5B1474873A2487f92C1EDB0FA95CAEA #define spset_E5B1474873A2487f92C1EDB0FA95CAEA /** * Description: Implementation for a sparse set of integers in the range [0, m). * Requirement: È(sizeof(int) * m) memory * * Insertion & deletion are constant time operations. * Set allocation is a constant time operation when memory allocation is constant. * Iteration through the set is a constant time operation [O(n) where n is the number of * items in the set]. * Clearing the set is a constant time operation. */ #include <stdlib.h> #include <stdbool.h> #ifdef __cplusplus extern "C" { #endif /** * The set, by default, is defined for unsigned int; simply define * this macro before including this header to change the element type. */ #ifndef SPARSE_SET_ELEMENT_TYPE #define SPARSE_SET_ELEMENT_TYPE unsigned int #endif typedef struct { SPARSE_SET_ELEMENT_TYPE *dense; size_t *sparse; size_t cardinality; size_t capacity; } sparse_set_t; /** * Allocates and initializes a new sparse set, with the given capacity. */ sparse_set_t sparse_set_init (size_t capacity); /** * Clears the sparse set. * This is a constant time operation. */ void sparse_set_clear (sparse_set_t *set); /** * Returns the cardinality of the sparse set. */ const size_t sparse_set_size (sparse_set_t *set); /** * Returns the maximum capacity of the sparse set. * Indices can be in the range [0, capacity). */ const size_t sparse_set_capacity (sparse_set_t *set); /* * Returns true if elem is a member of the set, false otherwise. */ bool sparse_set_is_member (sparse_set_t *set, SPARSE_SET_ELEMENT_TYPE elem); /** * Insert the given element in the set, provided that: * - it's not in the set already * - there's enough space for it */ bool sparse_set_add_member (sparse_set_t *set, SPARSE_SET_ELEMENT_TYPE elem); /* * Remove an arbitrary element from the set. * XXX what */ SPARSE_SET_ELEMENT_TYPE sparse_set_pop (sparse_set_t *set); /* * Remove the given element from the set, provided that it's already a member. */ void sparse_set_remove_member (sparse_set_t *set, SPARSE_SET_ELEMENT_TYPE elem); /** * Change the maximum size of the set. */ void sparse_set_resize (sparse_set_t *set, size_t new_capacity); /** * Destroy and deallocate a set. */ void sparse_set_free (sparse_set_t *set); #ifdef __cplusplus } #endif #endif
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_NETWORK_SERVICE_CLIENT_H_ #define CONTENT_BROWSER_NETWORK_SERVICE_CLIENT_H_ #include <memory> #include <string> #include <vector> #include "base/memory/memory_pressure_listener.h" #include "base/unguessable_token.h" #include "build/build_config.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h" #include "net/cert/cert_database.h" #include "services/network/public/mojom/network_change_manager.mojom.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/url_loader_network_service_observer.mojom.h" #include "url/gurl.h" #if defined(OS_ANDROID) #include "base/android/application_status_listener.h" #endif namespace content { class WebRtcConnectionsObserver; class CONTENT_EXPORT NetworkServiceClient : public network::mojom::URLLoaderNetworkServiceObserver, #if defined(OS_ANDROID) public net::NetworkChangeNotifier::ConnectionTypeObserver, public net::NetworkChangeNotifier::MaxBandwidthObserver, public net::NetworkChangeNotifier::IPAddressObserver, public net::NetworkChangeNotifier::DNSObserver, #endif public net::CertDatabase::Observer { public: NetworkServiceClient(); NetworkServiceClient(const NetworkServiceClient&) = delete; NetworkServiceClient& operator=(const NetworkServiceClient&) = delete; ~NetworkServiceClient() override; mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver> BindURLLoaderNetworkServiceObserver(); // net::CertDatabase::Observer implementation: void OnCertDBChanged() override; void OnMemoryPressure( base::MemoryPressureListener::MemoryPressureLevel memory_presure_level); // Called when there is a change in the count of media connections that // require low network latency. void OnPeerToPeerConnectionsCountChange(uint32_t count); #if defined(OS_ANDROID) void OnApplicationStateChange(base::android::ApplicationState state); // net::NetworkChangeNotifier::ConnectionTypeObserver implementation: void OnConnectionTypeChanged( net::NetworkChangeNotifier::ConnectionType type) override; // net::NetworkChangeNotifier::MaxBandwidthObserver implementation: void OnMaxBandwidthChanged( double max_bandwidth_mbps, net::NetworkChangeNotifier::ConnectionType type) override; // net::NetworkChangeNotifier::IPAddressObserver implementation: void OnIPAddressChanged() override; // net::NetworkChangeNotifier::DNSObserver implementation: void OnDNSChanged() override; #endif private: // network::mojom::URLLoaderNetworkServiceObserver overrides. void OnSSLCertificateError(const GURL& url, int net_error, const net::SSLInfo& ssl_info, bool fatal, OnSSLCertificateErrorCallback response) override; void OnCertificateRequested( const absl::optional<base::UnguessableToken>& window_id, const scoped_refptr<net::SSLCertRequestInfo>& cert_info, mojo::PendingRemote<network::mojom::ClientCertificateResponder> cert_responder) override; void OnAuthRequired( const absl::optional<base::UnguessableToken>& window_id, uint32_t request_id, const GURL& url, bool first_auth_attempt, const net::AuthChallengeInfo& auth_info, const scoped_refptr<net::HttpResponseHeaders>& head_headers, mojo::PendingRemote<network::mojom::AuthChallengeResponder> auth_challenge_responder) override; void OnClearSiteData(const GURL& url, const std::string& header_value, int load_flags, OnClearSiteDataCallback callback) override; void OnLoadingStateUpdate(network::mojom::LoadInfoPtr info, OnLoadingStateUpdateCallback callback) override; void OnDataUseUpdate(int32_t network_traffic_annotation_id_hash, int64_t recv_bytes, int64_t sent_bytes) override; void Clone( mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver> listener) override; std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; std::unique_ptr<WebRtcConnectionsObserver> webrtc_connections_observer_; #if defined(OS_ANDROID) std::unique_ptr<base::android::ApplicationStatusListener> app_status_listener_; mojo::Remote<network::mojom::NetworkChangeManager> network_change_manager_; #endif mojo::ReceiverSet<network::mojom::URLLoaderNetworkServiceObserver> url_loader_network_service_observers_; }; } // namespace content #endif // CONTENT_BROWSER_NETWORK_SERVICE_CLIENT_H_
/****************************************************************************** * Spine Runtimes Software License v2.5 * * Copyright (c) 2013-2016, Esoteric Software * All rights reserved. * * You are granted a perpetual, non-exclusive, non-sublicensable, and * non-transferable license to use, install, execute, and perform the Spine * Runtimes software and derivative works solely for personal or internal * use. Without the written permission of Esoteric Software (see Section 2 of * the Spine Software License Agreement), you may not (a) modify, translate, * adapt, or develop new applications using the Spine Runtimes or otherwise * create derivative works or improvements of the Spine Runtimes or (b) remove, * delete, alter, or obscure any trademarks or any copyright, trademark, patent, * or other intellectual property or proprietary rights notices on or in the * Software, including any copy thereof. Redistributions in binary or source * form must include this license and terms. * * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF * USE, DATA, OR PROFITS) 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 SPINE_SKIN_H_ #define SPINE_SKIN_H_ #include <spine/Attachment.h> #ifdef __cplusplus extern "C" { #endif struct spSkeleton; typedef struct spSkin { const char* const name; #ifdef __cplusplus spSkin() : name(0) { } #endif } spSkin; /* Private structs, needed by Skeleton */ typedef struct _Entry _Entry; struct _Entry { int slotIndex; const char* name; spAttachment* attachment; _Entry* next; }; typedef struct { spSkin super; _Entry* entries; } _spSkin; spSkin* spSkin_create (const char* name); void spSkin_dispose (spSkin* self); /* The Skin owns the attachment. */ void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment); /* Returns 0 if the attachment was not found. */ spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name); /* Returns 0 if the slot or attachment was not found. */ const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex); /** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */ void spSkin_attachAll (const spSkin* self, struct spSkeleton* skeleton, const spSkin* oldspSkin); #ifdef SPINE_SHORT_NAMES typedef spSkin Skin; #define Skin_create(...) spSkin_create(__VA_ARGS__) #define Skin_dispose(...) spSkin_dispose(__VA_ARGS__) #define Skin_addAttachment(...) spSkin_addAttachment(__VA_ARGS__) #define Skin_getAttachment(...) spSkin_getAttachment(__VA_ARGS__) #define Skin_getAttachmentName(...) spSkin_getAttachmentName(__VA_ARGS__) #define Skin_attachAll(...) spSkin_attachAll(__VA_ARGS__) #endif #ifdef __cplusplus } #endif #endif /* SPINE_SKIN_H_ */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__malloc_wchar_t_memmove_08.c Label Definition File: CWE124_Buffer_Underwrite__malloc.label.xml Template File: sources-sink-08.tmpl.c */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sink: memmove * BadSink : Copy string to data using memmove * Flow Variant: 08 Control flow: if(staticReturnsTrue()) and if(staticReturnsFalse()) * * */ #include "std_testcase.h" #include <wchar.h> /* The two function below always return the same value, so a tool * should be able to identify that calls to the functions will always * return a fixed value. */ static int staticReturnsTrue() { return 1; } static int staticReturnsFalse() { return 0; } #ifndef OMITBAD void CWE124_Buffer_Underwrite__malloc_wchar_t_memmove_08_bad() { wchar_t * data; data = NULL; if(staticReturnsTrue()) { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; /* FLAW: Set data pointer to before the allocated memory buffer */ data = dataBuffer - 8; } } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memmove(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); /* INCIDENTAL CWE-401: Memory Leak - data may not point to location * returned by malloc() so can't safely call free() on it */ } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the staticReturnsTrue() to staticReturnsFalse() */ static void goodG2B1() { wchar_t * data; data = NULL; if(staticReturnsFalse()) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; } } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memmove(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); /* INCIDENTAL CWE-401: Memory Leak - data may not point to location * returned by malloc() so can't safely call free() on it */ } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { wchar_t * data; data = NULL; if(staticReturnsTrue()) { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; } } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memmove(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); /* INCIDENTAL CWE-401: Memory Leak - data may not point to location * returned by malloc() so can't safely call free() on it */ } } void CWE124_Buffer_Underwrite__malloc_wchar_t_memmove_08_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE124_Buffer_Underwrite__malloc_wchar_t_memmove_08_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE124_Buffer_Underwrite__malloc_wchar_t_memmove_08_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* $KAME: natpt_var.h,v 1.40 2002/12/16 09:21:50 fujisawa Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 and 2001 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 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 project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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. */ extern int natpt_enable; extern int natpt_initialized; extern int natpt_error; extern int natpt_param; extern u_int natpt_debug; extern u_int natpt_dump; extern struct in6_addr natpt_prefix; extern u_int natpt_forceFragment4; extern u_int natpt_uselog; extern u_int natpt_usesyslog; extern caddr_t natptctl_vars[]; /* * */ /* natpt_dispatch.c */ caddr_t natpt_pyldaddr __P((struct ip6_hdr *, caddr_t, int *, struct ip6_frag **)); int natpt_setPrefix __P((caddr_t)); int natpt_setValue __P((caddr_t)); int natpt_getValue __P((caddr_t)); int natpt_testLog __P((caddr_t)); int natpt_break __P((const char *)); /* natpt_log.c */ void natpt_logTSlot __P((int, struct tSlot *, char, int)); void natpt_logFSlot __P((int, struct fragment *, char)); void natpt_logMsg __P((int, char *, ...)); void natpt_logMBuf __P((int, struct mbuf *, ...)); void natpt_logIp4 __P((int, struct ip *, ...)); void natpt_logIp6 __P((int, struct ip6_hdr *, ...)); int natpt_log __P((int, int, void *, size_t)); int natpt_logIN6addr __P((int, char *, struct in6_addr *)); struct mbuf *natpt_lbuf __P((int, int, size_t)); int natpt_ntop __P((int, const void *, char *, size_t)); /* natpt_rule.c */ struct cSlot *natpt_lookForRule6 __P((struct pcv *)); struct sockaddr_in *natpt_reverseLookForRule6 __P((struct sockaddr_in6 *sin6)); struct cSlot *natpt_lookForRule4 __P((struct pcv *)); int natpt_setRules __P((caddr_t)); int natpt_openTemporaryRule __P((int, struct pAddr *, struct pAddr *)); int natpt_prependRule __P((struct cSlot *)); int natpt_renumRules __P((caddr_t)); int natpt_rmRules __P((caddr_t)); int natpt_flushRules __P((caddr_t)); int natpt_setOnOff __P((int)); void natpt_init_rule __P((void)); /* natpt_trans.c */ struct mbuf *natpt_translateIPv6To4 __P((struct pcv *, struct pAddr *)); struct mbuf *natpt_translateIPv4To6 __P((struct pcv *, struct pAddr *)); struct mbuf *natpt_translateIPv4To4 __P((struct pcv *, struct pAddr *)); struct mbuf *natpt_translateFragment6 __P((struct pcv *, struct pAddr *)); struct mbuf *natpt_translateFragment4to6 __P((struct pcv *, struct pAddr *)); struct mbuf *natpt_translateFragment4to4 __P((struct pcv *, struct pAddr *)); /* natpt_tslot.c */ struct tSlot *natpt_lookForHash4 __P((struct pcv *)); struct tSlot *natpt_lookForHash6 __P((struct pcv *)); struct tSlot *natpt_internHash4 __P((struct cSlot *, struct pcv *)); struct tSlot *natpt_internHash6 __P((struct cSlot *, struct pcv *)); struct tSlot *natpt_openIncomingV4Conn __P((int, struct pAddr *, struct pAddr *)); struct tSlot *natpt_checkICMP6return __P((struct pcv *)); struct tSlot *natpt_checkICMP __P((struct pcv *)); struct pAddr *natpt_remapRemote4Port __P((struct cSlot *, struct pAddr *)); struct fragment *natpt_internFragment6 __P((struct pcv *, struct tSlot *)); struct fragment *natpt_internFragment4 __P((struct pcv *, struct tSlot *)); struct tSlot *natpt_lookForFragment6 __P((struct pcv *)); struct tSlot *natpt_lookForFragment4 __P((struct pcv *)); void natpt_removeFragmentEntry __P((struct fragment *)); int natpt_sessions __P((caddr_t)); int natpt_xlate __P((caddr_t)); void natpt_init_tslot __P((void)); /* natpt_usrreq.c */ void natpt_input __P((struct mbuf *, struct sockproto *, struct sockaddr *, struct sockaddr *));
#ifndef NODE_SQLITE3_SRC_DATABASE_H #define NODE_SQLITE3_SRC_DATABASE_H #include <node.h> #include <string> #include <queue> //#include "../include/sqlcipher/sqlite3.h" #include <sqlite3.h> #include "async.h" using namespace v8; using namespace node; namespace node_sqlcipher { class Database; class Database : public ObjectWrap { public: static Persistent<FunctionTemplate> constructor_template; static void Init(Handle<Object> target); static inline bool HasInstance(Handle<Value> val) { if (!val->IsObject()) return false; Local<Object> obj = val->ToObject(); return constructor_template->HasInstance(obj); } struct Baton { uv_work_t request; Database* db; Persistent<Function> callback; int status; std::string message; Baton(Database* db_, Handle<Function> cb_) : db(db_), status(SQLITE_OK) { db->Ref(); request.data = this; callback = Persistent<Function>::New(cb_); } virtual ~Baton() { db->Unref(); callback.Dispose(); } }; struct OpenBaton : Baton { std::string filename; std::string password; int mode; OpenBaton(Database* db_, Handle<Function> cb_, const char* filename_, const char* password_, int mode_) : Baton(db_, cb_), filename(filename_), password(password_), mode(mode_) {} }; struct ExecBaton : Baton { std::string sql; ExecBaton(Database* db_, Handle<Function> cb_, const char* sql_) : Baton(db_, cb_), sql(sql_) {} }; struct LoadExtensionBaton : Baton { std::string filename; std::string password; LoadExtensionBaton(Database* db_, Handle<Function> cb_, const char* filename_, const char* password_) : Baton(db_, cb_), filename(filename_), password(password_) {} }; typedef void (*Work_Callback)(Baton* baton); struct Call { Call(Work_Callback cb_, Baton* baton_, bool exclusive_ = false) : callback(cb_), exclusive(exclusive_), baton(baton_) {}; Work_Callback callback; bool exclusive; Baton* baton; }; struct ProfileInfo { std::string sql; sqlite3_int64 nsecs; }; struct UpdateInfo { int type; std::string database; std::string table; sqlite3_int64 rowid; }; bool IsOpen() { return open; } bool IsLocked() { return locked; } typedef Async<std::string, Database> AsyncTrace; typedef Async<ProfileInfo, Database> AsyncProfile; typedef Async<UpdateInfo, Database> AsyncUpdate; friend class Statement; protected: Database() : ObjectWrap(), handle(NULL), open(false), locked(false), pending(0), serialize(false), debug_trace(NULL), debug_profile(NULL), update_event(NULL) { } ~Database() { RemoveCallbacks(); sqlite3_close(handle); handle = NULL; open = false; } static Handle<Value> New(const Arguments& args); static void Work_BeginOpen(Baton* baton); static void Work_Open(uv_work_t* req); static void Work_AfterOpen(uv_work_t* req); static Handle<Value> OpenGetter(Local<String> str, const AccessorInfo& accessor); void Schedule(Work_Callback callback, Baton* baton, bool exclusive = false); void Process(); static Handle<Value> Exec(const Arguments& args); static void Work_BeginExec(Baton* baton); static void Work_Exec(uv_work_t* req); static void Work_AfterExec(uv_work_t* req); static Handle<Value> Wait(const Arguments& args); static void Work_Wait(Baton* baton); static Handle<Value> Close(const Arguments& args); static void Work_BeginClose(Baton* baton); static void Work_Close(uv_work_t* req); static void Work_AfterClose(uv_work_t* req); static Handle<Value> LoadExtension(const Arguments& args); static void Work_BeginLoadExtension(Baton* baton); static void Work_LoadExtension(uv_work_t* req); static void Work_AfterLoadExtension(uv_work_t* req); static Handle<Value> Serialize(const Arguments& args); static Handle<Value> Parallelize(const Arguments& args); static Handle<Value> Configure(const Arguments& args); static void SetBusyTimeout(Baton* baton); static void RegisterTraceCallback(Baton* baton); static void TraceCallback(void* db, const char* sql); static void TraceCallback(Database* db, std::string* sql); static void RegisterProfileCallback(Baton* baton); static void ProfileCallback(void* db, const char* sql, sqlite3_uint64 nsecs); static void ProfileCallback(Database* db, ProfileInfo* info); static void RegisterUpdateCallback(Baton* baton); static void UpdateCallback(void* db, int type, const char* database, const char* table, sqlite3_int64 rowid); static void UpdateCallback(Database* db, UpdateInfo* info); void RemoveCallbacks(); protected: sqlite3* handle; bool open; bool locked; unsigned int pending; bool serialize; std::queue<Call*> queue; AsyncTrace* debug_trace; AsyncProfile* debug_profile; AsyncUpdate* update_event; }; } #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkInterpolateDataSetAttributes.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 vtkInterpolateDataSetAttributes - interpolate scalars, vectors, etc. and other dataset attributes // .SECTION Description // vtkInterpolateDataSetAttributes is a filter that interpolates data set // attribute values between input data sets. The input to the filter // must be datasets of the same type, same number of cells, and same // number of points. The output of the filter is a data set of the same // type as the input dataset and whose attribute values have been // interpolated at the parametric value specified. // // The filter is used by specifying two or more input data sets (total of N), // and a parametric value t (0 <= t <= N-1). The output will contain // interpolated data set attributes common to all input data sets. (For // example, if one input has scalars and vectors, and another has just // scalars, then only scalars will be interpolated and output.) #ifndef __vtkInterpolateDataSetAttributes_h #define __vtkInterpolateDataSetAttributes_h #include "vtkDataSetAlgorithm.h" class vtkDataSetCollection; class VTK_GRAPHICS_EXPORT vtkInterpolateDataSetAttributes : public vtkDataSetAlgorithm { public: static vtkInterpolateDataSetAttributes *New(); vtkTypeRevisionMacro(vtkInterpolateDataSetAttributes,vtkDataSetAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Return the list of inputs to this filter. vtkDataSetCollection *GetInputList(); // Description: // Specify interpolation parameter t. vtkSetClampMacro(T,double,0.0,VTK_DOUBLE_MAX); vtkGetMacro(T,double); protected: vtkInterpolateDataSetAttributes(); ~vtkInterpolateDataSetAttributes(); virtual void ReportReferences(vtkGarbageCollector*); int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); int FillInputPortInformation(int port, vtkInformation *info); vtkDataSetCollection *InputList; // list of data sets to interpolate double T; // interpolation parameter private: vtkInterpolateDataSetAttributes(const vtkInterpolateDataSetAttributes&); // Not implemented. void operator=(const vtkInterpolateDataSetAttributes&); // Not implemented. }; #endif
/* * The olsr.org Optimized Link-State Routing daemon(olsrd) * Copyright (c) 2008, Sven-Ola Tuecke (sven-ola@gmx.de) * 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 olsr.org, olsrd 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. * * Visit http://www.olsr.org for more information. * * If you find this software useful feel free to make a donation * to the project. For more information see the website or contact * the copyright holders. * */ #ifndef _FPM_H #define _FPM_H #ifdef USE_FPM #if 0 /* * Use this to find implicit number conversions when compiling * Note: comparing pointers is unsigned, so do not use to run. */ typedef void *fpm; typedef signed long sfpm; typedef unsigned long ufpm; #define FPM_BIT 12 #elif 0 /* * Use this for extra long 64 bit calculations */ typedef long long fpm; typedef signed long long sfpm; typedef unsigned long long ufpm; #define FPM_BIT 24 #else /* * The standard math should function with only 32 bits */ typedef long fpm; typedef signed long sfpm; typedef unsigned long ufpm; #define FPM_BIT 10 #endif #define FPM_NUM (1 << FPM_BIT) #define FPM_MSK (FPM_NUM - 1) #define FPM_MAX ((sfpm)(~(ufpm)0 >> 1) >> FPM_BIT) #define FPM_MIN ((sfpm)-1 - FPM_MAX) #define FPM_INT_MAX ((sfpm)(~(ufpm)0 >> 1)) #define FPM_INT_MIN ((sfpm)-1 - FPM_INT_MAX) #define itofpm_def(a) (fpm)((sfpm)((a) << FPM_BIT)) #define ftofpm_def(a) (fpm)((sfpm)((a) * FPM_NUM)) #define fpmtoi_def(a) (int)((sfpm)(a) >> FPM_BIT) #define fpmtof_def(a) ((float)(sfpm)(a) / FPM_NUM) #define fpmadd_def(a, b) (fpm)((sfpm)(a) + (sfpm)(b)) #define fpmsub_def(a, b) (fpm)((sfpm)(a) - (sfpm)(b)) #define fpmmul_def(a, b) (fpm)(((sfpm)(a) * (sfpm)(b)) >> FPM_BIT) #define fpmdiv_def(a, b) (fpm)(((sfpm)(a) << FPM_BIT) / (sfpm)(b)) /* * Special: first or second factor is an integer */ #define fpmimul_def(a, b) (fpm)((int)(a) * (sfpm)(b)) #define fpmmuli_def(a, b) (fpm)((sfpm)(a) * (int)(b)) /* * Special: divisor is an integer */ #define fpmidiv_def(a, b) (fpm)((sfpm)(a) / (int)(b)) #if 0 /* * Special: uses long long for larger numbers, currently unused */ #define fpmlmul_def(a, b) (sfpm)(((long long)(a) * (b)) >> FPM_BIT) #define fpmldiv_def(a, b) (sfpm)(((long long)(a) << FPM_BIT) / (b)) #endif #ifdef NDEBUG #define itofpm itofpm_def #define ftofpm ftofpm_def #define fpmtoi fpmtoi_def #define fpmtof fpmtof_def #define fpmadd fpmadd_def #define fpmsub fpmsub_def #define fpmmul fpmmul_def #define fpmdiv fpmdiv_def #define fpmimul fpmimul_def #define fpmmuli fpmmuli_def #define fpmidiv fpmidiv_def #if 0 #define fpmlmul fpmlmul_def #define fpmldiv fpmldiv_def #endif #else /* NDEBUG */ fpm itofpm(int i); fpm ftofpm(float f); int fpmtoi(fpm a); float fpmtof(fpm a); fpm fpmadd(fpm a, fpm b); fpm fpmsub(fpm a, fpm b); fpm fpmmul(fpm a, fpm b); fpm fpmdiv(fpm a, fpm b); fpm fpmimul(int a, fpm b); fpm fpmmuli(fpm a, int b); fpm fpmidiv(fpm a, int b); #if 0 fpm fpmlmul(fpm a, fpm b); fpm fpmldiv(fpm a, fpm b); #endif #endif /* NDEBUG */ #define INFINITE_ETX itofpm(FPM_MAX) #define MIN_LINK_QUALITY ftofpm(0.01) #define ZERO_ETX itofpm(0) #define CEIL_LQDIFF ftofpm(1.1) #define FLOOR_LQDIFF ftofpm(0.9) fpm atofpm(const char *); const char *fpmtoa(fpm); const char *etxtoa(fpm); #else /* USE_FPM */ #define INFINITE_ETX ((float)(1 << 30)) #define ZERO_ETX 0.0 #define MIN_LINK_QUALITY 0.01 #define CEIL_LQDIFF 1.1 #define FLOOR_LQDIFF 0.9 float atofpm(const char *); const char *fpmtoa(float); const char *etxtoa(float); #endif /* USE_FPM */ #endif /* * Local Variables: * c-basic-offset: 2 * indent-tabs-mode: nil * End: */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ #define CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/webui/help/version_updater.h" namespace content { class BrowserContext; class WebContents; } class VersionUpdaterCros : public VersionUpdater, public chromeos::UpdateEngineClient::Observer { public: VersionUpdaterCros(const VersionUpdaterCros&) = delete; VersionUpdaterCros& operator=(const VersionUpdaterCros&) = delete; // VersionUpdater implementation. void CheckForUpdate(StatusCallback callback, PromoteCallback) override; void SetChannel(const std::string& channel, bool is_powerwash_allowed) override; void GetChannel(bool get_current_channel, ChannelCallback callback) override; void GetEolInfo(EolInfoCallback callback) override; void SetUpdateOverCellularOneTimePermission(StatusCallback callback, const std::string& update_version, int64_t update_size) override; // Gets the last update status, without triggering a new check or download. void GetUpdateStatus(StatusCallback callback); protected: friend class VersionUpdater; // Clients must use VersionUpdater::Create(). explicit VersionUpdaterCros(content::WebContents* web_contents); ~VersionUpdaterCros() override; private: // UpdateEngineClient::Observer implementation. void UpdateStatusChanged(const update_engine::StatusResult& status) override; // Callback from UpdateEngineClient::RequestUpdateCheck(). void OnUpdateCheck(chromeos::UpdateEngineClient::UpdateCheckResult result); // Callback from UpdateEngineClient::SetUpdateOverCellularOneTimePermission(). void OnSetUpdateOverCellularOneTimePermission(bool success); // Callback from UpdateEngineClient::GetChannel(). void OnGetChannel(ChannelCallback cb, const std::string& current_channel); // Callback from UpdateEngineClient::GetEolInfo(). void OnGetEolInfo(EolInfoCallback cb, chromeos::UpdateEngineClient::EolInfo eol_info); // BrowserContext in which the class was instantiated. content::BrowserContext* context_; // Callback used to communicate update status to the client. StatusCallback callback_; // Last state received via UpdateStatusChanged(). update_engine::Operation last_operation_; // True if an update check should be scheduled when the update engine is idle. bool check_for_update_when_idle_; base::WeakPtrFactory<VersionUpdaterCros> weak_ptr_factory_{this}; }; #endif // CHROME_BROWSER_UI_WEBUI_HELP_VERSION_UPDATER_CHROMEOS_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ #include <string> #include "content/public/browser/web_contents_delegate.h" class Profile; class TabSpecificContentSettings; namespace content { class WebContents; } namespace user_prefs { class PrefRegistrySyncable; } class MediaStreamDevicesController { public: MediaStreamDevicesController(content::WebContents* web_contents, const content::MediaStreamRequest& request, const content::MediaResponseCallback& callback); virtual ~MediaStreamDevicesController(); // Registers the prefs backing the audio and video policies. static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); // Public method to be called before creating the MediaStreamInfoBarDelegate. // This function will check the content settings exceptions and take the // corresponding action on exception which matches the request. bool DismissInfoBarAndTakeActionOnSettings(); // Public methods to be called by MediaStreamInfoBarDelegate; bool has_audio() const { return microphone_requested_; } bool has_video() const { return webcam_requested_; } const std::string& GetSecurityOriginSpec() const; void Accept(bool update_content_setting); void Deny(bool update_content_setting); private: enum DevicePolicy { POLICY_NOT_SET, ALWAYS_DENY, ALWAYS_ALLOW, }; // Called by GetAudioDevicePolicy and GetVideoDevicePolicy to check // the currently set capture device policy. DevicePolicy GetDevicePolicy(const char* policy_name) const; // Returns true if the origin of the request has been granted the media // access before, otherwise returns false. bool IsRequestAllowedByDefault() const; // Returns true if the media access for the origin of the request has been // blocked before. Otherwise returns false. bool IsRequestBlockedByDefault() const; // Returns true if the media section in content settings is set to // |CONTENT_SETTING_BLOCK|, otherwise returns false. bool IsDefaultMediaAccessBlocked() const; // Returns true if the origin is a secure scheme, otherwise returns false. bool IsSchemeSecure() const; // Returns true if request's origin is from internal objects like // chrome://URLs, otherwise returns false. bool ShouldAlwaysAllowOrigin() const; // Sets the permission of the origin of the request. This is triggered when // the users deny the request or allow the request for https sites. void SetPermission(bool allowed) const; content::WebContents* web_contents_; // The owner of this class needs to make sure it does not outlive the profile. Profile* profile_; // Weak pointer to the tab specific content settings of the tab for which the // MediaStreamDevicesController was created. The tab specific content // settings are associated with a the web contents of the tab. The // MediaStreamDeviceController must not outlive the web contents for which it // was created. TabSpecificContentSettings* content_settings_; // The original request for access to devices. const content::MediaStreamRequest request_; // The callback that needs to be Run to notify WebRTC of whether access to // audio/video devices was granted or not. content::MediaResponseCallback callback_; bool microphone_requested_; bool webcam_requested_; DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); }; #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
/* * $Id: artist.h 350 2009-06-15 16:43:37Z chripppa $ */ #ifndef __RB_ARTIST_H #define __RB_ARTIST_H typedef struct { ds_artist_t *real; } rb_ds_artist; VALUE Init_Artist (VALUE mDespotify); VALUE ARTIST2VALUE (ds_artist_t *a); #define VALUE2ARTIST(obj, var) \ Data_Get_Struct ((obj), rb_ds_artist, (var)) #endif
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_SERVICE_H_ #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_SERVICE_H_ #include <memory> #include <vector> #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" namespace data_reduction_proxy { class DataStore; class DataUsageBucket; class DataUsageStore; // Callback for loading the historical data usage. using HistoricalDataUsageCallback = base::OnceCallback<void(std::unique_ptr<std::vector<DataUsageBucket>>)>; // Callback for loading data usage for the current bucket. using LoadCurrentDataUsageCallback = base::OnceCallback<void(std::unique_ptr<DataUsageBucket>)>; // Contains and initializes all Data Reduction Proxy objects that have a // lifetime based on the DB task runner. class DBDataOwner { public: explicit DBDataOwner(std::unique_ptr<DataStore> store); virtual ~DBDataOwner(); // Initializes all the DB objects. Must be called on the DB task runner. void InitializeOnDBThread(); // Loads data usage history stored in |DataStore|. void LoadHistoricalDataUsage(std::vector<DataUsageBucket>* data_usage); // Loads the last stored data usage bucket from |DataStore| into |bucket|. void LoadCurrentDataUsageBucket(DataUsageBucket* bucket); // Stores |current| to |DataStore|. void StoreCurrentDataUsageBucket(std::unique_ptr<DataUsageBucket> current); // Deletes all historical data usage from storage. void DeleteHistoricalDataUsage(); // Deletes browsing history for the given data range from storage. void DeleteBrowsingHistory(const base::Time& start, const base::Time& end); // Returns a weak pointer to self for use on UI thread. base::WeakPtr<DBDataOwner> GetWeakPtr(); private: std::unique_ptr<DataStore> store_; std::unique_ptr<DataUsageStore> data_usage_; base::SequenceChecker sequence_checker_; base::WeakPtrFactory<DBDataOwner> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(DBDataOwner); }; } // namespace data_reduction_proxy #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_SERVICE_H_
/* * Automatically Tuned Linear Algebra Software v3.9.14 * (C) Copyright 1999 Antoine P. Petitet * * 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 ATLAS group or the names of its contributers may * not be used to endorse or promote products derived from this * software without specific 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 ATLAS GROUP OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #include "atlas_misc.h" #include "atlas_tst.h" #include "atlas_f77blas.h" void Mjoin( PATL, f77swap ) ( const int N, TYPE * X, const int INCX, TYPE * Y, const int INCY ) { #ifdef ATL_FunkyInts const F77_INTEGER F77N = N, F77incx = INCX, F77incy = INCY; #else #define F77N N #define F77incx INCX #define F77incy INCY #endif if( INCX < 0 ) X -= ( ( 1 - N ) * INCX ) SHIFT; if( INCY < 0 ) Y -= ( ( 1 - N ) * INCY ) SHIFT; F77swap( &F77N, X, &F77incx, Y, &F77incy ); }
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "blis.h" void bli_trmm_blk_var2b( obj_t* a, obj_t* b, obj_t* c, trmm_t* cntl, trmm_thrinfo_t* thread) { obj_t a_pack_s; obj_t b1_pack_s, c1_pack_s; obj_t b1, c1; obj_t* a_pack = NULL; obj_t* b1_pack = NULL; obj_t* c1_pack = NULL; dim_t i; dim_t b_alg; dim_t n_trans; if( thread_am_ochief( thread ) ) { // Initialize object for packing A bli_obj_init_pack( &a_pack_s ); bli_packm_init( a, &a_pack_s, cntl_sub_packm_a( cntl ) ); // Scale C by beta (if instructed). bli_scalm_int( &BLIS_ONE, c, cntl_sub_scalm( cntl ) ); } a_pack = thread_obroadcast( thread, &a_pack_s ); // Initialize pack objects for B and C that are passed into packm_init(). if( thread_am_ichief( thread ) ) { bli_obj_init_pack( &b1_pack_s ); bli_obj_init_pack( &c1_pack_s ); } b1_pack = thread_ibroadcast( thread, &b1_pack_s ); c1_pack = thread_ibroadcast( thread, &c1_pack_s ); // Pack A (if instructed). bli_packm_int( a, a_pack, cntl_sub_packm_a( cntl ), trmm_thread_sub_opackm( thread ) ); // Query dimension in partitioning direction. n_trans = bli_obj_width_after_trans( *b ); dim_t start, end; bli_get_range_weighted( thread, 0, n_trans, bli_determine_reg_blocksize( b, cntl_blocksize( cntl ) ), bli_obj_is_upper( *c ), &start, &end ); // Partition along the n dimension. for ( i = start; i < end; i += b_alg ) { // Determine the current algorithmic blocksize. b_alg = bli_determine_blocksize_b( i, end, b, cntl_blocksize( cntl ) ); // Acquire partitions for B1 and C1. bli_acquire_mpart_r2l( BLIS_SUBPART1, i, b_alg, b, &b1 ); bli_acquire_mpart_r2l( BLIS_SUBPART1, i, b_alg, c, &c1 ); // Initialize objects for packing A1 and B1. if( thread_am_ichief( thread ) ) { bli_packm_init( &b1, b1_pack, cntl_sub_packm_b( cntl ) ); bli_packm_init( &c1, c1_pack, cntl_sub_packm_c( cntl ) ); } thread_ibarrier( thread ); // Pack B1 (if instructed). bli_packm_int( &b1, b1_pack, cntl_sub_packm_b( cntl ), trmm_thread_sub_ipackm( thread ) ); // Pack C1 (if instructed). bli_packm_int( &c1, c1_pack, cntl_sub_packm_c( cntl ), trmm_thread_sub_ipackm( thread ) ); // Perform trmm subproblem. bli_trmm_int( &BLIS_ONE, a_pack, b1_pack, &BLIS_ONE, c1_pack, cntl_sub_trmm( cntl ), trmm_thread_sub_trmm( thread ) ); // Unpack C1 (if C1 was packed). bli_unpackm_int( c1_pack, &c1, cntl_sub_unpackm_c( cntl ), trmm_thread_sub_ipackm( thread ) ); } // If any packing buffers were acquired within packm, release them back // to the memory manager. thread_obarrier( thread ); if( thread_am_ochief( thread ) ) bli_obj_release_pack( a_pack ); if( thread_am_ichief( thread ) ) { bli_obj_release_pack( b1_pack ); bli_obj_release_pack( c1_pack ); } }
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SYNC_TEST_NULL_DIRECTORY_CHANGE_DELEGATE_H_ #define CHROME_BROWSER_SYNC_TEST_NULL_DIRECTORY_CHANGE_DELEGATE_H_ #pragma once #include "base/compiler_specific.h" #include "chrome/browser/sync/syncable/directory_change_delegate.h" namespace syncable { // DirectoryChangeDelegate that does nothing in all delegate methods. class NullDirectoryChangeDelegate : public DirectoryChangeDelegate { public: virtual ~NullDirectoryChangeDelegate(); virtual void HandleCalculateChangesChangeEventFromSyncApi( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) OVERRIDE; virtual void HandleCalculateChangesChangeEventFromSyncer( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) OVERRIDE; virtual ModelTypeSet HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) OVERRIDE; virtual void HandleTransactionCompleteChangeEvent( ModelTypeSet models_with_changes) OVERRIDE; }; } // namespace syncable #endif // CHROME_BROWSER_SYNC_TEST_NULL_DIRECTORY_CHANGE_DELEGATE_H_
/* * File: i2c.h * Author: matthewheins * * Created on February 2, 2014, 9:53 PM */ #ifndef I2C_H #define I2C_H #include "app.h" #define MAX_I2C_BUFFER_LENGTH 150 #define GESTIC_I2C_ADDR 0x42 // default i2c address of MGC3130 #define MGC3130_ADDRESS_READ GESTIC_I2C_ADDR<<1 | 0x01 #define MGC3130_ADDRESS_WRITE GESTIC_I2C_ADDR<<1 & 0XFE #define MAX_LEN_TO_GESTIC 16 /* maximum length of message to be transferred * to GestIC. Used to setup buffers * Possible values: 4...255*/ /*I2C MGC3130 States*/ enum{ SET_START_CONDITION = 0, SEND_SLAVE_ADDRESS, START_RECEIVER, GET_MESSAGE_LENGTH, CLOCK_MESSAGE_BYTE, RECEIVE_MESSAGE_BYTE, SEND_STOP_CONDITION }; #define MGC3130_ADDRESS 0x42<<1 #define MAX_LEN_TO_GESTIC 16 /* maximum length of message to be transferred * to GestIC. Used to setup buffers * Possible values: 4...255*/ #define NUMBER_OF_MGC3130_BYTES 16 #define NUMBER_OF_MGC3130_POSITION_BYTES 20 #define MGC3130_MESSAGE_TYPE_POSITION_DATA 0x98 #define MGC3130_MSG_LENGTH_BYTE 0 #define MGC3130_MSG_FLAG_BYTE 1 #define MGC3130_MESSAGE_ID 3 #define MGC3130_DATA_OUTPUT_CONFIG_BYTE_1 4 #define MGC3130_DATA_OUTPUT_CONFIG_BYTE_2 5 #define MGC3130_TIME_STAMP 6 #define MGC3130_SYSTEM_INFO 7 #define MGC3130_DSP_INFO_LENGTH 2 #define MGC3130_DATA_START_BYTE 8 #define MGC3130_GESTURE_LENGTH 4 #define MGC3130_TOUCH_LENGTH 4 #define MGC3130_AIRWHEEL_LENGTH 2 #define MGC3130_POSITION_LENGTH 6 #define MGC3130_DSP_STATUS_PRESENT_MASK 0x01 #define MGC3130_GESTURE_PRESENT_MASK 0x02 #define MGC3130_TOUCH_PRESENT_MASK 0x04 #define MGC3130_AIRWHEEL_PRESENT_MASK 0x08 #define MGC3130_POSITION_PRESENT_MASK 0x10 #define MGC3130_POSITION_VALID_MASK 0x01 #define MGC3130_AIRWHEEL_VALID_MASK 0x02 #define MGC3130_TOUCH_BYTE_1 12 #define MGC3130_TOUCH_BYTE_2 13 #define MGC3130_AIRWHEEL_BYTE_1 16 #define MGC3130_X_POS_LOW_BYTE 18 #define MGC3130_X_POS_HIGH_BYTE 19 #define MGC3130_Y_POS_LOW_BYTE 20 #define MGC3130_Y_POS_HIGH_BYTE 21 #define MGC3130_Z_POS_LOW_BYTE 22 #define MGC3130_Z_POS_HIGH_BYTE 23 //Gesture masks #define MGC3130_FLICK_LEFT_TO_RIGHT 0x02 #define MGC3130_FLICK_RIGHT_TO_LEFT 0x03 #define MGC3130_FLICK_SOUTH_TO_NORTH 0x04 #define MGC3130_FLICK_NORTH_TO_SOUTH 0x05 #define MGC3130_CIRCLE_CLOCKWISE 0x06 #define MGC3130_CIRCLE_COUNTER_CLOCKWISE 0x07 #define MGC3130_INVALID_SAMPLE_MASK 0xC0000200 //Touch Masks #define MGC3130_NO_TOUCH 0x0000 #define MGC3130_TOUCH_BOTTOM 0x0001 #define MGC3130_TOUCH_LEFT 0x0002 #define MGC3130_TOUCH_TOP 0x0004 #define MGC3130_TOUCH_RIGHT 0x0008 #define MGC3130_TOUCH_CENTER 0x0010 #define MGC3130_TAP_BOTTOM 0x0020 #define MGC3130_TAP_LEFT 0x0040 #define MGC3130_TAP_TOP 0x0080 #define MGC3130_TAP_RIGHT 0x0100 #define MGC3130_TAP_CENTER 0x0200 #define MGC3130_DOUBLE_TAP_BOTTOM 0x0400 #define MGC3130_DOUBLE_TAP_LEFT 0x0800 #define MGC3130_DOUBLE_TAP_TOP 0x1000 #define MGC3130_DOUBLE_TAP_RIGHT 0x2000 #define MGC3130_DOUBLE_TAP_CENTER 0x4000 //MGC3130 Message IDs #define MGC3130_SYSTEM_STATUS 0x15 #define MGC3130_REQUEST_MESSAGE 0x06 #define MGC3130_FW_VERSION_INFO 0x83 #define MGC3130_SET_RUNTIME_PARAMETER 0xA2 #define MGC3130_SENSOR_DATA_OUTPUT 0x91 #define MGC3130_HEADER_SIZE_BYTE 1 #define MGC3130_HEADER_FLAGS_BYTE 2 #define MGC3130_HEADER_SEQ_BYTE 3 #define MGC3130_HEADER_ID_BYTE 4 #define ENABLE_MGC3130_INTERRUPT 1 #define DISABLE_MGC3130_INTERRUPT 1 #define MGC3130_NO_DATA_MASK 0xFFFF #define MGC3130_MAX_VALUE 0xFFFF #define LENGTH_OF_SET_RUNTIME_PARAMETER_MESSAGE 16 #define DATA_OUTPUT_ENABLE_MASK 0xA0 #define MSG_ID_CHANNEL_MAPPING_S 0x65 #define MSG_ID_CHANNEL_MAPPING_W 0x66 #define MSG_ID_CHANNEL_MAPPING_N 0x67 #define MSG_ID_CHANNEL_MAPPING_E 0x68 #define MSG_ID_CHANNEL_MAPPING_C 0x69 enum{ RX0 = 0, RX1, RX2, RX3, RX4 }; void resetMGC3130(void); uint8_t mgc3130_extract_pos_and_gest_data(uint8_t * u8ReceiveBuffer, pos_and_gesture_data * position_and_gesture); void zero_pos_and_gest_data(pos_and_gesture_data * position_and_gesture); void initI2C_MGC3130(int baudRate, int clockFrequency); void initMGC3130(void); void readMGC3130FirmwareVersion(void); void configureMGC3130(unsigned char * message); uint8_t readStatusMessage(void); uint8_t mgc3130StateMachine(pos_and_gesture_data * pos_and_gesture_struct); extern unsigned char msgMGC3130Configure[LENGTH_OF_SET_RUNTIME_PARAMETER_MESSAGE] ; extern unsigned char msgMGC3130InvertNorth[LENGTH_OF_SET_RUNTIME_PARAMETER_MESSAGE]; extern unsigned char msgMGC3130InvertSouth[LENGTH_OF_SET_RUNTIME_PARAMETER_MESSAGE]; #endif /* I2C_H */
/* * Copyright (c) 2015, Nagoya 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 Autoware 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 PURE_PURSUIT_VIZ_H #define PURE_PURSUIT_VIZ_H // ROS includes #include <ros/ros.h> #include <geometry_msgs/TwistStamped.h> #include <geometry_msgs/PoseStamped.h> #include <visualization_msgs/Marker.h> // C++ includes #include <memory> // User defined includes #include "waypoint_follower/libwaypoint_follower.h" namespace waypoint_follower { // display the next waypoint by markers. visualization_msgs::Marker displayNextWaypoint(geometry_msgs::Point position); // display the next target by markers. visualization_msgs::Marker displayNextTarget(geometry_msgs::Point target); double calcRadius(geometry_msgs::Point target, geometry_msgs::Pose current_pose); // generate the locus of pure pursuit std::vector<geometry_msgs::Point> generateTrajectoryCircle(geometry_msgs::Point target, geometry_msgs::Pose current_pose); // display the locus of pure pursuit by markers. visualization_msgs::Marker displayTrajectoryCircle(std::vector<geometry_msgs::Point> traj_circle_array); // display the search radius by markers. visualization_msgs::Marker displaySearchRadius(geometry_msgs::Point current_pose, double search_radius); } #endif // PURE_PURSUIT_VIZ_H
// // Demo3ViewController.h // GQFlowController // // Created by 钱国强 on 13-7-17. // Copyright (c) 2013年 Qian GuoQiang. All rights reserved. // #import <UIKit/UIKit.h> @interface Demo3ViewController : UIViewController @end
/*- * Copyright (c) 1999-2001 Robert N. M. Watson * All rights reserved. * * This software was developed by Robert Watson for the TrustedBSD Project. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /* * Developed by the TrustedBSD Project. * Support for extended filesystem attributes. */ #ifndef _UFS_UFS_EXTATTR_H_ #define _UFS_UFS_EXTATTR_H_ #define UFS_EXTATTR_MAGIC 0x00b5d5ec #define UFS_EXTATTR_VERSION 0x00000003 #define UFS_EXTATTR_FSROOTSUBDIR ".attribute" #define UFS_EXTATTR_SUBDIR_SYSTEM "system" #define UFS_EXTATTR_SUBDIR_USER "user" #define UFS_EXTATTR_MAXEXTATTRNAME 65 /* including null */ #define UFS_EXTATTR_ATTR_FLAG_INUSE 0x00000001 /* attr has been set */ #define UFS_EXTATTR_PERM_KERNEL 0x00000000 #define UFS_EXTATTR_PERM_ROOT 0x00000001 #define UFS_EXTATTR_PERM_OWNER 0x00000002 #define UFS_EXTATTR_PERM_ANYONE 0x00000003 #define UFS_EXTATTR_UEPM_INITIALIZED 0x00000001 #define UFS_EXTATTR_UEPM_STARTED 0x00000002 #define UFS_EXTATTR_CMD_START 0x00000001 #define UFS_EXTATTR_CMD_STOP 0x00000002 #define UFS_EXTATTR_CMD_ENABLE 0x00000003 #define UFS_EXTATTR_CMD_DISABLE 0x00000004 struct ufs_extattr_fileheader { u_int uef_magic; /* magic number for sanity checking */ u_int uef_version; /* version of attribute file */ u_int uef_size; /* size of attributes, w/o header */ }; struct ufs_extattr_header { u_int ueh_flags; /* flags for attribute */ u_int ueh_len; /* local defined length; <= uef_size */ u_int32_t ueh_i_gen; /* generation number for sanity */ /* data follows the header */ }; /* * This structure defines the required fields of an extended-attribute header. */ struct extattr { int32_t ea_length; /* length of this attribute */ int8_t ea_namespace; /* name space of this attribute */ int8_t ea_contentpadlen; /* bytes of padding at end of attribute */ int8_t ea_namelength; /* length of attribute name */ char ea_name[1]; /* null-terminated attribute name */ /* extended attribute content follows */ }; /* * These macros are used to access and manipulate an extended attribute: * * EXTATTR_NEXT(eap) returns a pointer to the next extended attribute * following eap. * EXTATTR_CONTENT(eap) returns a pointer to the extended attribute * content referenced by eap. * EXTATTR_CONTENT_SIZE(eap) returns the size of the extended attribute * content referenced by eap. * EXTATTR_SET_LENGTHS(eap, contentsize) called after initializing the * attribute name to calculate and set the ea_length, ea_namelength, * and ea_contentpadlen fields of the extended attribute structure. */ #define EXTATTR_NEXT(eap) \ ((struct extattr *)(((void *)(eap)) + (eap)->ea_length)) #define EXTATTR_CONTENT(eap) (((void *)(eap)) + EXTATTR_BASE_LENGTH(eap)) #define EXTATTR_CONTENT_SIZE(eap) \ ((eap)->ea_length - EXTATTR_BASE_LENGTH(eap) - (eap)->ea_contentpadlen) #define EXTATTR_BASE_LENGTH(eap) \ ((sizeof(struct extattr) + (eap)->ea_namelength + 7) & ~7) #define EXTATTR_SET_LENGTHS(eap, contentsize) do { \ KASSERT(((eap)->ea_name[0] != 0), \ ("Must initialize name before setting lengths")); \ (eap)->ea_namelength = strlen((eap)->ea_name); \ (eap)->ea_contentpadlen = ((contentsize) % 8) ? \ 8 - ((contentsize) % 8) : 0; \ (eap)->ea_length = EXTATTR_BASE_LENGTH(eap) + \ (contentsize) + (eap)->ea_contentpadlen; \ } while (0) #ifdef _KERNEL #include <sys/_sx.h> struct vnode; LIST_HEAD(ufs_extattr_list_head, ufs_extattr_list_entry); struct ufs_extattr_list_entry { LIST_ENTRY(ufs_extattr_list_entry) uele_entries; struct ufs_extattr_fileheader uele_fileheader; int uele_attrnamespace; char uele_attrname[UFS_EXTATTR_MAXEXTATTRNAME]; struct vnode *uele_backing_vnode; }; struct ucred; struct ufs_extattr_per_mount { struct sx uepm_lock; struct ufs_extattr_list_head uepm_list; struct ucred *uepm_ucred; int uepm_flags; }; void ufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm); void ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm); int ufs_extattr_start(struct mount *mp, struct thread *td); int ufs_extattr_autostart(struct mount *mp, struct thread *td); int ufs_extattr_stop(struct mount *mp, struct thread *td); int ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename, int attrnamespace, const char *attrname); int ufs_getextattr(struct vop_getextattr_args *ap); int ufs_deleteextattr(struct vop_deleteextattr_args *ap); int ufs_setextattr(struct vop_setextattr_args *ap); void ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td); #else /* User-level definition of KASSERT for macros above */ #define KASSERT(cond, str) do { \ if (!(cond)) { printf("panic: "); printf(str); printf("\n"); exit(1); }\ } while (0) #endif /* !_KERNEL */ #endif /* !_UFS_UFS_EXTATTR_H_ */
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef XFA_FWL_CFWL_APP_H_ #define XFA_FWL_CFWL_APP_H_ #include <memory> #include "core/fxcrt/timerhandler_iface.h" #include "xfa/fwl/cfwl_widgetmgr.h" class CFWL_NoteDriver; class CFWL_WidgetMgr; enum FWL_KeyFlag { FWL_KEYFLAG_Ctrl = 1 << 0, FWL_KEYFLAG_Alt = 1 << 1, FWL_KEYFLAG_Shift = 1 << 2, FWL_KEYFLAG_Command = 1 << 3, FWL_KEYFLAG_LButton = 1 << 4, FWL_KEYFLAG_RButton = 1 << 5, FWL_KEYFLAG_MButton = 1 << 6 }; class CFWL_App { public: class AdapterIface { public: virtual ~AdapterIface() = default; virtual CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() = 0; virtual TimerHandlerIface* GetTimerHandler() = 0; }; explicit CFWL_App(AdapterIface* pAdapter); ~CFWL_App(); AdapterIface* GetAdapterNative() const { return m_pAdapterNative.Get(); } CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr.get(); } CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); } private: UnownedPtr<AdapterIface> const m_pAdapterNative; std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr; std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver; }; #endif // XFA_FWL_CFWL_APP_H_
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <better/map.h> #include <better/small_vector.h> #include <ABI39_0_0React/core/Props.h> #include <ABI39_0_0React/core/RawProps.h> #include <ABI39_0_0React/core/RawPropsKey.h> #include <ABI39_0_0React/core/RawPropsKeyMap.h> #include <ABI39_0_0React/core/RawPropsPrimitives.h> #include <ABI39_0_0React/core/RawValue.h> namespace ABI39_0_0facebook { namespace ABI39_0_0React { /* * Specialized (to a particular type of Props) parser that provides the most * efficient access to `RawProps` content. */ class RawPropsParser final { public: /* * Default constructor. * To be used by `ConcreteComponentDescriptor` only. */ RawPropsParser() = default; /* * To be used by `ConcreteComponentDescriptor` only. */ template <typename PropsT> void prepare() noexcept { static_assert( std::is_base_of<Props, PropsT>::value, "PropsT must be a descendant of Props"); RawProps emptyRawProps{}; emptyRawProps.parse(*this); PropsT({}, emptyRawProps); postPrepare(); } private: friend class ComponentDescriptor; template <class ShadowNodeT> friend class ConcreteComponentDescriptor; friend class RawProps; /* * To be used by `RawProps` only. */ void preparse(RawProps const &rawProps) const noexcept; /* * Non-generic part of `prepare`. */ void postPrepare() noexcept; /* * To be used by `RawProps` only. */ RawValue const *at(RawProps const &rawProps, RawPropsKey const &key) const noexcept; mutable better::small_vector<RawPropsKey, kNumberOfPropsPerComponentSoftCap> keys_{}; mutable RawPropsKeyMap nameToIndex_{}; mutable int size_{0}; mutable bool ready_{false}; }; } // namespace ABI39_0_0React } // namespace ABI39_0_0facebook
/* * Copyright 2019 VMware * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <UIKit/UIKit.h> @interface CRFourButtonTableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIButton *aButton; @property (weak, nonatomic) IBOutlet UIButton *bButton; @property (weak, nonatomic) IBOutlet UIButton *cButton; @property (weak, nonatomic) IBOutlet UIButton *dButton; @end
// 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 CPU_INSTRUCTIONS_H_ #define CPU_INSTRUCTIONS_H_ #include "zen/int.h" namespace cpu { typedef uint32_t Instruction; // http://aelmahmoudy.users.sourceforge.net/electronix/arm/chapter2.htm // // Branch instructions contain a signed 2's complement 24 bit offset. This is // shifted left two bits, sign extended to 32 bits, and added to the PC. The // instruction can therefore specify a branch of +/- 32Mbytes. The branch // offset must take account of the prefetch operation, which causes the PC to // be 2 words (8 bytes) ahead of the current instruction. // inline Instruction CreateBranchInstruction(uint32_t offset) { return 0xEA000000 | (offset & 0xFFFFFF); } } #endif // CPU_INSTRUCTIONS_H_
/* Copyright (c) 2016, Pollard Banknote Limited All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. 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. */ #ifndef PBL_CPP_TRAITS_RANK_H #define PBL_CPP_TRAITS_RANK_H #ifndef CPP11 #include "integral_constant.h" namespace cpp11 { template< class T > struct rank : public integral_constant< std::size_t, 0 >{}; template< class T > struct rank< T[] > : public integral_constant< std::size_t, rank< T >::value + 1 >{}; template< class T, std::size_t N > struct rank< T[N] > : public integral_constant< std::size_t, rank< T >::value + 1 >{}; } #else #ifndef CPP17 #ifdef CPP14 namespace cpp17 { template< class T > constexpr std::size_t rank_v = std::rank< T >::value; } #endif #endif #endif // ifndef CPP11 #endif // PBL_CPP_TRAITS_RANK_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 MEDIA_CAST_SENDER_AUDIO_SENDER_H_ #define MEDIA_CAST_SENDER_AUDIO_SENDER_H_ #include <memory> #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/tick_clock.h" #include "base/time/time.h" #include "media/base/audio_bus.h" #include "media/cast/cast_config.h" #include "media/cast/cast_sender.h" #include "media/cast/sender/frame_sender.h" namespace media { namespace cast { class AudioEncoder; // Not thread safe. Only called from the main cast thread. // This class owns all objects related to sending audio, objects that create RTP // packets, congestion control, audio encoder, parsing and sending of // RTCP packets. // Additionally it posts a bunch of delayed tasks to the main thread for various // timeouts. class AudioSender : public FrameSender { public: AudioSender(scoped_refptr<CastEnvironment> cast_environment, const FrameSenderConfig& audio_config, StatusChangeOnceCallback status_change_cb, CastTransport* const transport_sender); ~AudioSender() final; // Note: It is not guaranteed that |audio_frame| will actually be encoded and // sent, if AudioSender detects too many frames in flight. Therefore, clients // should be careful about the rate at which this method is called. void InsertAudio(std::unique_ptr<AudioBus> audio_bus, const base::TimeTicks& recorded_time); base::WeakPtr<AudioSender> AsWeakPtr(); protected: int GetNumberOfFramesInEncoder() const final; base::TimeDelta GetInFlightMediaDuration() const final; private: // Called by the |audio_encoder_| with the next EncodedFrame to send. void OnEncodedAudioFrame(int encoder_bitrate, std::unique_ptr<SenderEncodedFrame> encoded_frame, int samples_skipped); // Encodes AudioBuses into EncodedFrames. std::unique_ptr<AudioEncoder> audio_encoder_; // The number of audio samples enqueued in |audio_encoder_|. int samples_in_encoder_; // NOTE: Weak pointers must be invalidated before all other member variables. base::WeakPtrFactory<AudioSender> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(AudioSender); }; } // namespace cast } // namespace media #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_