text stringlengths 4 6.14k |
|---|
// Copyright (c) 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 SOURCE_FUZZ_TRANSFORMATION_WRAP_EARLY_TERMINATOR_IN_FUNCTION_H_
#define SOURCE_FUZZ_TRANSFORMATION_WRAP_EARLY_TERMINATOR_IN_FUNCTION_H_
#include "source/fuzz/protobufs/spirvfuzz_protobufs.h"
#include "source/fuzz/transformation.h"
#include "source/fuzz/transformation_context.h"
#include "source/opt/ir_context.h"
namespace spvtools {
namespace fuzz {
class TransformationWrapEarlyTerminatorInFunction : public Transformation {
public:
explicit TransformationWrapEarlyTerminatorInFunction(
const protobufs::TransformationWrapEarlyTerminatorInFunction& message);
TransformationWrapEarlyTerminatorInFunction(
uint32_t fresh_id,
const protobufs::InstructionDescriptor& early_terminator_instruction,
uint32_t returned_value_id);
// - |message_.fresh_id| must be fresh.
// - |message_.early_terminator_instruction| must identify an early terminator
// instruction, i.e. an instruction with opcode OpKill, OpUnreachable or
// OpTerminateInvocation.
// - A suitable wrapper function for the early terminator must exist, and it
// must be distinct from the function containing
// |message_.early_terminator_instruction|.
// - If the enclosing function has non-void return type then
// |message_.returned_value_instruction| must be the id of an instruction of
// the return type that is available at the point of the early terminator
// instruction.
bool IsApplicable(
opt::IRContext* ir_context,
const TransformationContext& transformation_context) const override;
// An OpFunctionCall instruction to an appropriate wrapper function is
// inserted before |message_.early_terminator_instruction|, and
// |message_.early_terminator_instruction| is replaced with either OpReturn
// or OpReturnValue |message_.returned_value_instruction| depending on whether
// the enclosing function's return type is void.
void Apply(opt::IRContext* ir_context,
TransformationContext* transformation_context) const override;
std::unordered_set<uint32_t> GetFreshIds() const override;
protobufs::Transformation ToMessage() const override;
static opt::Function* MaybeGetWrapperFunction(opt::IRContext* ir_context,
SpvOp early_terminator_opcode);
private:
protobufs::TransformationWrapEarlyTerminatorInFunction message_;
};
} // namespace fuzz
} // namespace spvtools
#endif // SOURCE_FUZZ_TRANSFORMATION_WRAP_EARLY_TERMINATOR_IN_FUNCTION_H_
|
/*=========================================================================
Library: CTK
Copyright (c) Kitware Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef __ctkDICOMIndexer_h
#define __ctkDICOMIndexer_h
// Qt includes
#include <QObject>
#include <QSqlDatabase>
#include "ctkDICOMCoreExport.h"
#include "ctkDICOMDatabase.h"
class ctkDICOMIndexerPrivate;
/// \ingroup DICOM_Core
///
/// \brief Indexes DICOM images located in local directory into an Sql database
///
class CTK_DICOM_CORE_EXPORT ctkDICOMIndexer : public QObject
{
Q_OBJECT
Q_PROPERTY(bool backgroundImportEnabled READ isBackgroundImportEnabled WRITE setBackgroundImportEnabled)
Q_PROPERTY(bool importing READ isImporting)
public:
explicit ctkDICOMIndexer(QObject *parent = 0);
virtual ~ctkDICOMIndexer();
Q_INVOKABLE void setDatabase(ctkDICOMDatabase* database);
Q_INVOKABLE ctkDICOMDatabase* database();
/// If enabled, addDirectory and addFile... methods return immediately
/// indexing is performed in a background thread,
/// and progress and completion are indicated by signals.
/// Disabled by default.
void setBackgroundImportEnabled(bool);
bool isBackgroundImportEnabled() const;
/// Returns with true if background importing is currently in progress.
bool isImporting();
///
/// \brief Adds directory to database and optionally copies files to
/// destinationDirectory.
///
/// Scan the directory using Dcmtk and populate the database with all the
/// DICOM images accordingly.
///
/// If includeHidden is set to false then hidden files and folders are not added.
/// DICOM folders may be created based on series or study name, which sometimes start
/// with a . character, therefore it is advisable to include hidden files and folders.
///
Q_INVOKABLE void addDirectory(const QString& directoryName, bool copyFile = false, bool includeHidden = true);
/// Kept for backward compatibility
Q_INVOKABLE void addDirectory(ctkDICOMDatabase* db, const QString& directoryName, bool copyFile = false, bool includeHidden = true);
///
/// \brief Adds directory to database by using DICOMDIR and optionally copies files to
/// destinationDirectory.
/// Scan the directory using Dcmtk and populate the database with all the
/// DICOM images accordingly.
/// \return Returns false if there was an error while processing the DICOMDIR file.
///
Q_INVOKABLE bool addDicomdir(const QString& directoryName, bool copyFile = false);
/// Kept for backward compatibility
Q_INVOKABLE bool addDicomdir(ctkDICOMDatabase* db, const QString& directoryName, bool copyFile = false);
///
/// \brief Adds a QStringList containing the file path to database and optionally copies files to
/// destinationDirectory.
///
/// Scan the directory using Dcmtk and populate the database with all the
/// DICOM images accordingly.
///
Q_INVOKABLE void addListOfFiles(const QStringList& listOfFiles, bool copyFile = false);
/// Kept for backward compatibility
Q_INVOKABLE void addListOfFiles(ctkDICOMDatabase* db, const QStringList& listOfFiles, bool copyFile = false);
///
/// \brief Adds a file to database and optionally copies the file to
/// the database folder.
/// If destinationDirectory is non-empty string then the file is copied
/// to the database folder (exact value of destinationDirectoryName does not matter,
/// only if the string is empty or not).
///
/// Scan the file using Dcmtk and populate the database with all the
/// DICOM fields accordingly.
///
Q_INVOKABLE void addFile(const QString filePath, bool copyFile = false);
/// Kept for backward compatibility
Q_INVOKABLE void addFile(ctkDICOMDatabase* db, const QString filePath, bool copyFile = false);
///
/// \brief Wait for all the indexing operations to complete
/// This can be useful to ensure that importing is completed when background indexing is enabled.
/// msecTimeout specifies a maximum timeout. If <0 then it means wait indefinitely.
Q_INVOKABLE void waitForImportFinished(int msecTimeout = -1);
Q_SIGNALS:
/// Description of current phase of the indexing (parsing, importing, ...)
void progressStep(QString);
/// Detailed information about the current progress (e.g., name of currently processed file)
void progressDetail(QString);
/// Progress in percentage
void progress(int);
/// Indexing is completed.
void indexingComplete(int patientsAdded, int studiesAdded, int seriesAdded, int imagesAdded);
void updatingDatabase(bool);
public Q_SLOTS:
/// Stop indexing (all completed indexing results will be added to the database)
void cancel();
protected Q_SLOTS:
void databaseFilenameChanged();
void tagsToPrecacheChanged();
void tagsToExcludeFromStorageChanged();
protected:
QScopedPointer<ctkDICOMIndexerPrivate> d_ptr;
private:
Q_DECLARE_PRIVATE(ctkDICOMIndexer);
Q_DISABLE_COPY(ctkDICOMIndexer);
};
#endif
|
//
// (C) 2005 Vojtech Janota
// (C) 2003 Xuan Thang Nguyen
//
// This library is free software, you can redistribute it
// and/or modify
// it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation;
// either version 2 of the License, or any later version.
// The library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
#ifndef __INET_RSVPPATHMSG_H
#define __INET_RSVPPATHMSG_H
#include "RSVPPathMsg_m.h"
namespace inet {
/**
* RSVP PATH message
*
* This class adds convenience get() and set() methods to the generated
* base class, but no extra data.
*/
class INET_API RSVPPathMsg : public RSVPPathMsg_Base
{
public:
RSVPPathMsg(const char *name = nullptr, int kind = PATH_MESSAGE) : RSVPPathMsg_Base(name, kind) {}
RSVPPathMsg(const RSVPPathMsg& other) : RSVPPathMsg_Base(other) {}
RSVPPathMsg& operator=(const RSVPPathMsg& other) { RSVPPathMsg_Base::operator=(other); return *this; }
virtual RSVPPathMsg *dup() const override { return new RSVPPathMsg(*this); }
inline IPv4Address getSrcAddress() { return getSender_descriptor().Sender_Template_Object.SrcAddress; }
inline int getLspId() { return getSender_descriptor().Sender_Template_Object.Lsp_Id; }
inline IPv4Address getNHOP() { return getHop().Next_Hop_Address; }
inline IPv4Address getLIH() { return getHop().Logical_Interface_Handle; }
inline double getBW() { return getSender_descriptor().Sender_Tspec_Object.req_bandwidth; }
inline SenderTemplateObj_t& getSenderTemplate() { return getSender_descriptor().Sender_Template_Object; }
inline void setSenderTemplate(const SenderTemplateObj_t& s) { getSender_descriptor().Sender_Template_Object = s; }
inline SenderTspecObj_t& getSenderTspec() { return getSender_descriptor().Sender_Tspec_Object; }
inline void setSenderTspec(const SenderTspecObj_t& s) { getSender_descriptor().Sender_Tspec_Object = s; }
};
/**
* RSVP PATH TEAR message
*
* This class adds convenience get() and set() methods to the generated
* base class, but no extra data.
*/
class INET_API RSVPPathTear : public RSVPPathTear_Base
{
public:
RSVPPathTear(const char *name = nullptr, int kind = PTEAR_MESSAGE) : RSVPPathTear_Base(name, kind) {}
RSVPPathTear(const RSVPPathTear& other) : RSVPPathTear_Base(other) {}
RSVPPathTear& operator=(const RSVPPathTear& other) { RSVPPathTear_Base::operator=(other); return *this; }
virtual RSVPPathTear *dup() const override { return new RSVPPathTear(*this); }
inline IPv4Address getNHOP() { return getHop().Next_Hop_Address; }
inline IPv4Address getLIH() { return getHop().Logical_Interface_Handle; }
inline IPv4Address getSrcAddress() { return getSenderTemplate().SrcAddress; }
inline int getLspId() { return getSenderTemplate().Lsp_Id; }
};
/**
* RSVP PATH ERROR message
*
* This class adds convenience get() and set() methods to the generated
* base class, but no extra data.
*/
class INET_API RSVPPathError : public RSVPPathError_Base
{
public:
RSVPPathError(const char *name = nullptr, int kind = PERROR_MESSAGE) : RSVPPathError_Base(name, kind) {}
RSVPPathError(const RSVPPathError& other) : RSVPPathError_Base(other) {}
RSVPPathError& operator=(const RSVPPathError& other) { RSVPPathError_Base::operator=(other); return *this; }
virtual RSVPPathError *dup() const override { return new RSVPPathError(*this); }
inline IPv4Address getSrcAddress() { return getSender_descriptor().Sender_Template_Object.SrcAddress; }
inline int getLspId() { return getSender_descriptor().Sender_Template_Object.Lsp_Id; }
inline double getBW() { return getSender_descriptor().Sender_Tspec_Object.req_bandwidth; }
inline SenderTemplateObj_t& getSenderTemplate() { return getSender_descriptor().Sender_Template_Object; }
inline void setSenderTemplate(const SenderTemplateObj_t& s) { getSender_descriptor().Sender_Template_Object = s; }
inline SenderTspecObj_t& getSenderTspec() { return getSender_descriptor().Sender_Tspec_Object; }
inline void setSenderTspec(const SenderTspecObj_t& s) { getSender_descriptor().Sender_Tspec_Object = s; }
};
} // namespace inet
#endif // ifndef __INET_RSVPPATHMSG_H
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkFFTWHalfHermitianToRealInverseFFTImageFilter_h
#define itkFFTWHalfHermitianToRealInverseFFTImageFilter_h
#include "itkHalfHermitianToRealInverseFFTImageFilter.h"
#include "itkFFTWCommon.h"
namespace itk
{
/** \class FFTWHalfHermitianToRealInverseFFTImageFilter
*
* \brief FFTW-based reverse Fast Fourier Transform
*
* This filter computes the reverse Fourier transform of an image. The
* implementation is based on the FFTW library.
*
* This filter is multithreaded and supports input images of any size.
*
* This implementation was taken from the Insight Journal paper:
* http://hdl.handle.net/10380/3154
* or http://insight-journal.com/browse/publication/717
*
* \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.
*
* \ingroup FourierTransform
* \ingroup MultiThreaded
* \ingroup ITKFFT
*
* \sa FFTWGlobalConfiguration
* \sa InverseFFTImageFilter
*/
template< typename TInputImage, typename TOutputImage=Image< typename TInputImage::PixelType::value_type, TInputImage::ImageDimension> >
class FFTWHalfHermitianToRealInverseFFTImageFilter:
public HalfHermitianToRealInverseFFTImageFilter< TInputImage, TOutputImage >
{
public:
/** Standard class typedefs. */
typedef TInputImage InputImageType;
typedef typename InputImageType::PixelType InputPixelType;
typedef typename InputImageType::SizeType InputSizeType;
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::PixelType OutputPixelType;
typedef typename OutputImageType::RegionType OutputRegionType;
typedef typename OutputImageType::SizeType OutputSizeType;
typedef FFTWHalfHermitianToRealInverseFFTImageFilter Self;
typedef HalfHermitianToRealInverseFFTImageFilter< InputImageType, OutputImageType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** The proxy type is a wrapper for the FFTW API since the proxy is
* only defined over double and float, trying to use any other pixel
* type is unsupported, as is trying to use double if only the float
* FFTW version is configured in, or float if only double is
* configured. */
typedef typename fftw::Proxy< OutputPixelType > FFTWProxyType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(FFTWHalfHermitianToRealInverseFFTImageFilter,
HalfHermitianToRealInverseFFTImageFilter);
/** Define the image dimension. */
itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
/** Set/Get the behavior of wisdom plan creation. The default is
* provided by FFTWGlobalConfiguration::GetPlanRigor().
*
* The parameter is one of the FFTW planner rigor flags FFTW_ESTIMATE, FFTW_MEASURE,
* FFTW_PATIENT, FFTW_EXHAUSTIVE provided by FFTWGlobalConfiguration.
* /sa FFTWGlobalConfiguration
*/
virtual void SetPlanRigor( const int & value )
{
// Use that method to check the value.
FFTWGlobalConfiguration::GetPlanRigorName( value );
if( m_PlanRigor != value )
{
m_PlanRigor = value;
this->Modified();
}
}
itkGetConstReferenceMacro( PlanRigor, int );
void SetPlanRigor( const std::string & name )
{
this->SetPlanRigor( FFTWGlobalConfiguration::GetPlanRigorValue( name ) );
}
protected:
FFTWHalfHermitianToRealInverseFFTImageFilter();
virtual ~FFTWHalfHermitianToRealInverseFFTImageFilter() {}
virtual void UpdateOutputData(DataObject *output);
virtual void BeforeThreadedGenerateData();
void ThreadedGenerateData(const OutputRegionType& outputRegionForThread,
ThreadIdType threadId);
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
private:
FFTWHalfHermitianToRealInverseFFTImageFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
bool m_CanUseDestructiveAlgorithm;
int m_PlanRigor;
};
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkFFTWHalfHermitianToRealInverseFFTImageFilter.hxx"
#endif
#endif //itkFFTWHalfHermitianToRealInverseFFTImageFilter_h
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ce/CostExplorer_EXPORTS.h>
#include <aws/ce/model/CostCategorySplitChargeRuleParameterType.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace CostExplorer
{
namespace Model
{
/**
* <p>The parameters for a split charge method. </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/ce-2017-10-25/CostCategorySplitChargeRuleParameter">AWS
* API Reference</a></p>
*/
class AWS_COSTEXPLORER_API CostCategorySplitChargeRuleParameter
{
public:
CostCategorySplitChargeRuleParameter();
CostCategorySplitChargeRuleParameter(Aws::Utils::Json::JsonView jsonValue);
CostCategorySplitChargeRuleParameter& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The parameter type. </p>
*/
inline const CostCategorySplitChargeRuleParameterType& GetType() const{ return m_type; }
/**
* <p>The parameter type. </p>
*/
inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; }
/**
* <p>The parameter type. </p>
*/
inline void SetType(const CostCategorySplitChargeRuleParameterType& value) { m_typeHasBeenSet = true; m_type = value; }
/**
* <p>The parameter type. </p>
*/
inline void SetType(CostCategorySplitChargeRuleParameterType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); }
/**
* <p>The parameter type. </p>
*/
inline CostCategorySplitChargeRuleParameter& WithType(const CostCategorySplitChargeRuleParameterType& value) { SetType(value); return *this;}
/**
* <p>The parameter type. </p>
*/
inline CostCategorySplitChargeRuleParameter& WithType(CostCategorySplitChargeRuleParameterType&& value) { SetType(std::move(value)); return *this;}
/**
* <p>The parameter values. </p>
*/
inline const Aws::Vector<Aws::String>& GetValues() const{ return m_values; }
/**
* <p>The parameter values. </p>
*/
inline bool ValuesHasBeenSet() const { return m_valuesHasBeenSet; }
/**
* <p>The parameter values. </p>
*/
inline void SetValues(const Aws::Vector<Aws::String>& value) { m_valuesHasBeenSet = true; m_values = value; }
/**
* <p>The parameter values. </p>
*/
inline void SetValues(Aws::Vector<Aws::String>&& value) { m_valuesHasBeenSet = true; m_values = std::move(value); }
/**
* <p>The parameter values. </p>
*/
inline CostCategorySplitChargeRuleParameter& WithValues(const Aws::Vector<Aws::String>& value) { SetValues(value); return *this;}
/**
* <p>The parameter values. </p>
*/
inline CostCategorySplitChargeRuleParameter& WithValues(Aws::Vector<Aws::String>&& value) { SetValues(std::move(value)); return *this;}
/**
* <p>The parameter values. </p>
*/
inline CostCategorySplitChargeRuleParameter& AddValues(const Aws::String& value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }
/**
* <p>The parameter values. </p>
*/
inline CostCategorySplitChargeRuleParameter& AddValues(Aws::String&& value) { m_valuesHasBeenSet = true; m_values.push_back(std::move(value)); return *this; }
/**
* <p>The parameter values. </p>
*/
inline CostCategorySplitChargeRuleParameter& AddValues(const char* value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }
private:
CostCategorySplitChargeRuleParameterType m_type;
bool m_typeHasBeenSet;
Aws::Vector<Aws::String> m_values;
bool m_valuesHasBeenSet;
};
} // namespace Model
} // namespace CostExplorer
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/model/InstanceEventWindowStateChange.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
class AWS_EC2_API DeleteInstanceEventWindowResponse
{
public:
DeleteInstanceEventWindowResponse();
DeleteInstanceEventWindowResponse(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
DeleteInstanceEventWindowResponse& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>The state of the event window.</p>
*/
inline const InstanceEventWindowStateChange& GetInstanceEventWindowState() const{ return m_instanceEventWindowState; }
/**
* <p>The state of the event window.</p>
*/
inline void SetInstanceEventWindowState(const InstanceEventWindowStateChange& value) { m_instanceEventWindowState = value; }
/**
* <p>The state of the event window.</p>
*/
inline void SetInstanceEventWindowState(InstanceEventWindowStateChange&& value) { m_instanceEventWindowState = std::move(value); }
/**
* <p>The state of the event window.</p>
*/
inline DeleteInstanceEventWindowResponse& WithInstanceEventWindowState(const InstanceEventWindowStateChange& value) { SetInstanceEventWindowState(value); return *this;}
/**
* <p>The state of the event window.</p>
*/
inline DeleteInstanceEventWindowResponse& WithInstanceEventWindowState(InstanceEventWindowStateChange&& value) { SetInstanceEventWindowState(std::move(value)); return *this;}
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline DeleteInstanceEventWindowResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline DeleteInstanceEventWindowResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
InstanceEventWindowStateChange m_instanceEventWindowState;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace EC2
} // namespace Aws
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef PAGESPEED_OPT_LOGGING_LOG_RECORD_TEST_HELPER_H_
#define PAGESPEED_OPT_LOGGING_LOG_RECORD_TEST_HELPER_H_
#include "pagespeed/kernel/base/string.h"
#include "pagespeed/kernel/http/image_types.pb.h"
#include "pagespeed/opt/logging/enums.pb.h"
#include "pagespeed/opt/logging/log_record.h"
#include "pagespeed/opt/logging/logging_proto.h"
#include "test/pagespeed/kernel/base/gmock.h"
using ::testing::_;
using ::testing::Matcher;
using ::testing::StrEq;
namespace net_instaweb {
class AbstractMutex;
// Captures all the arguments to LogImageRewriteActivity so that we can mock it
// in test.
struct ImageRewriteInfo {
ImageRewriteInfo(const char* id, const GoogleString& url,
RewriterApplication::Status status, bool is_image_inlined,
bool is_critical_image, bool is_url_rewritten, int size,
bool try_low_res_src_insertion, bool low_res_src_inserted,
ImageType low_res_image_type, int low_res_data_size)
: id_(id),
url_(url),
status_(status),
is_image_inlined_(is_image_inlined),
is_critical_image_(is_critical_image),
is_url_rewritten_(is_url_rewritten),
size_(size),
try_low_res_src_insertion_(try_low_res_src_insertion),
low_res_src_inserted_(low_res_src_inserted),
low_res_image_type_(low_res_image_type),
low_res_data_size_(low_res_data_size) {}
const char* id_;
GoogleString url_;
RewriterApplication::Status status_;
bool is_image_inlined_;
bool is_critical_image_;
bool is_url_rewritten_;
int size_;
bool try_low_res_src_insertion_;
bool low_res_src_inserted_;
ImageType low_res_image_type_;
int low_res_data_size_;
};
// A custom matcher to match more than 10 arguments allowed by MOCK_METHOD*
// macros.
Matcher<ImageRewriteInfo> LogImageRewriteActivityMatcher(
Matcher<const char*> id, Matcher<const GoogleString&> url,
Matcher<RewriterApplication::Status> status, Matcher<bool> is_image_inlined,
Matcher<bool> is_critical_image, Matcher<bool> is_url_rewritten,
Matcher<int> size, Matcher<bool> try_low_res_src_insertion,
Matcher<bool> low_res_src_inserted, Matcher<ImageType> low_res_image_type,
Matcher<int> low_res_data_size);
// A class which helps mock the methods of LogRecord for testing.
class MockLogRecord : public LogRecord {
public:
explicit MockLogRecord(AbstractMutex* mutex) : LogRecord(mutex) {}
~MockLogRecord() override {}
void LogImageRewriteActivity(const char* id, const GoogleString& url,
RewriterApplication::Status status,
bool is_image_inlined, bool is_critical_image,
bool is_url_rewritten, int size,
bool try_low_res_src_insertion,
bool low_res_src_inserted,
ImageType low_res_image_type,
int low_res_data_size) override {
ImageRewriteInfo info(id, url, status, is_image_inlined, is_critical_image,
is_url_rewritten, size, try_low_res_src_insertion,
low_res_src_inserted, low_res_image_type,
low_res_data_size);
MockLogImageRewriteActivity(info);
}
MOCK_METHOD1(MockLogImageRewriteActivity, void(ImageRewriteInfo));
};
} // namespace net_instaweb
#endif // PAGESPEED_OPT_LOGGING_LOG_RECORD_TEST_HELPER_H_
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layout_RenderFrameParent_h
#define mozilla_layout_RenderFrameParent_h
#include "mozilla/layout/PRenderFrameParent.h"
#include "mozilla/layers/ShadowLayersManager.h"
#include <map>
#include "nsDisplayList.h"
#include "Layers.h"
class nsContentView;
class nsFrameLoader;
class nsSubDocumentFrame;
namespace mozilla {
namespace layers {
class ShadowLayersParent;
}
namespace layout {
class RenderFrameParent : public PRenderFrameParent,
public mozilla::layers::ShadowLayersManager
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ContainerLayer ContainerLayer;
typedef mozilla::layers::Layer Layer;
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::ShadowLayersParent ShadowLayersParent;
typedef FrameMetrics::ViewID ViewID;
public:
typedef std::map<ViewID, nsRefPtr<nsContentView> > ViewMap;
RenderFrameParent(nsFrameLoader* aFrameLoader);
virtual ~RenderFrameParent();
void Destroy();
/**
* Helper function for getting a non-owning reference to a scrollable.
* @param aId The ID of the frame.
*/
nsContentView* GetContentView(ViewID aId = FrameMetrics::ROOT_SCROLL_ID);
void ContentViewScaleChanged(nsContentView* aView);
virtual void ShadowLayersUpdated(bool isFirstPaint) MOZ_OVERRIDE;
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsSubDocumentFrame* aFrame,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
LayerManager* aManager,
const nsIntRect& aVisibleRect);
void OwnerContentChanged(nsIContent* aContent);
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
protected:
NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
NS_OVERRIDE virtual PLayersParent* AllocPLayers(LayerManager::LayersBackend* aBackendType,
int* aMaxTextureSize);
NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
private:
void BuildViewMap();
ShadowLayersParent* GetShadowLayers() const;
ContainerLayer* GetRootLayer() const;
nsRefPtr<nsFrameLoader> mFrameLoader;
nsRefPtr<ContainerLayer> mContainer;
// This contains the views for all the scrollable frames currently in the
// painted region of our remote content.
ViewMap mContentViews;
// True after Destroy() has been called, which is triggered
// originally by nsFrameLoader::Destroy(). After this point, we can
// no longer safely ask the frame loader to find its nearest layer
// manager, because it may have been disconnected from the DOM.
// It's still OK to *tell* the frame loader that we've painted after
// it's destroyed; it'll just ignore us, and we won't be able to
// find an nsIFrame to invalidate. See ShadowLayersUpdated().
//
// Prefer the extra bit of state to null'ing out mFrameLoader in
// Destroy() so that less code needs to be special-cased for after
// Destroy().
//
// It's possible for mFrameLoader==null and
// mFrameLoaderDestroyed==false.
bool mFrameLoaderDestroyed;
// this is gfxRGBA because that's what ColorLayer wants.
gfxRGBA mBackgroundColor;
};
} // namespace layout
} // namespace mozilla
/**
* A DisplayRemote exists solely to graft a child process's shadow
* layer tree (for a given RenderFrameParent) into its parent
* process's layer tree.
*/
class nsDisplayRemote : public nsDisplayItem
{
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
public:
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
RenderFrameParent* aRemoteFrame)
: nsDisplayItem(aBuilder, aFrame)
, mRemoteFrame(aRemoteFrame)
{}
NS_OVERRIDE
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerParameters& aParameters)
{ return mozilla::LAYER_ACTIVE; }
NS_OVERRIDE
virtual already_AddRefed<Layer>
BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerParameters& aContainerParameters);
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
private:
RenderFrameParent* mRemoteFrame;
};
/**
* nsDisplayRemoteShadow is a way of adding display items for frames in a
* separate process, for hit testing only. After being processed, the hit
* test state will contain IDs for any remote frames that were hit.
*
* The frame should be its respective render frame parent.
*/
class nsDisplayRemoteShadow : public nsDisplayItem
{
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
public:
nsDisplayRemoteShadow(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
nsRect aRect,
ViewID aId)
: nsDisplayItem(aBuilder, aFrame)
, mRect(aRect)
, mId(aId)
{}
NS_OVERRIDE nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
{
*aSnap = false;
return mRect;
}
virtual PRUint32 GetPerFrameKey()
{
NS_ABORT();
return 0;
}
NS_OVERRIDE void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
NS_DISPLAY_DECL_NAME("Remote-Shadow", TYPE_REMOTE_SHADOW)
private:
nsRect mRect;
ViewID mId;
};
#endif // mozilla_layout_RenderFrameParent_h
|
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "soc/spi_periph.h"
#include "stddef.h"
/*
Bunch of constants for every SPI peripheral: GPIO signals, irqs, hw addr of registers etc
*/
const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
{
.spiclk_out = SPICLK_OUT_MUX_IDX,
.spiclk_in = 0,/* SPI clock is not an input signal*/
.spid_out = SPID_OUT_IDX,
.spiq_out = SPIQ_OUT_IDX,
.spiwp_out = SPIWP_OUT_IDX,
.spihd_out = SPIHD_OUT_IDX,
.spid_in = SPID_IN_IDX,
.spiq_in = SPIQ_IN_IDX,
.spiwp_in = SPIWP_IN_IDX,
.spihd_in = SPIHD_IN_IDX,
.spics_out = {SPICS0_OUT_IDX, SPICS1_OUT_IDX},/* SPI0/1 do not have CS2 now */
.spics_in = 0,/* SPI cs is not an input signal*/
.spiclk_iomux_pin = SPI_IOMUX_PIN_NUM_CLK,
.spid_iomux_pin = SPI_IOMUX_PIN_NUM_MOSI,
.spiq_iomux_pin = SPI_IOMUX_PIN_NUM_MISO,
.spiwp_iomux_pin = SPI_IOMUX_PIN_NUM_WP,
.spihd_iomux_pin = SPI_IOMUX_PIN_NUM_HD,
.spics0_iomux_pin = SPI_IOMUX_PIN_NUM_CS,
.irq = ETS_SPI1_INTR_SOURCE,
.irq_dma = -1,
.module = PERIPH_SPI_MODULE,
.hw = (spi_dev_t *) &SPIMEM1,
.func = SPI_FUNC_NUM,
}, {
.spiclk_out = FSPICLK_OUT_IDX,
.spiclk_in = FSPICLK_IN_IDX,
.spid_out = FSPID_OUT_IDX,
.spiq_out = FSPIQ_OUT_IDX,
.spiwp_out = FSPIWP_OUT_IDX,
.spihd_out = FSPIHD_OUT_IDX,
.spid_in = FSPID_IN_IDX,
.spiq_in = FSPIQ_IN_IDX,
.spiwp_in = FSPIWP_IN_IDX,
.spihd_in = FSPIHD_IN_IDX,
.spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX},
.spics_in = FSPICS0_IN_IDX,
.spiclk_iomux_pin = SPI2_IOMUX_PIN_NUM_CLK,
.spid_iomux_pin = SPI2_IOMUX_PIN_NUM_MOSI,
.spiq_iomux_pin = SPI2_IOMUX_PIN_NUM_MISO,
.spiwp_iomux_pin = SPI2_IOMUX_PIN_NUM_WP,
.spihd_iomux_pin = SPI2_IOMUX_PIN_NUM_HD,
.spics0_iomux_pin = SPI2_IOMUX_PIN_NUM_CS,
.irq = ETS_SPI2_INTR_SOURCE,
.irq_dma = -1,
.module = PERIPH_SPI2_MODULE,
.hw = &GPSPI2,
.func = SPI2_FUNC_NUM,
}
};
|
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
//
// MainViewController.h
// CordovaApp
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import <Cordova/CDVViewController.h>
#import <Cordova/CDVCommandDelegateImpl.h>
#import <Cordova/CDVCommandQueue.h>
@interface MainViewController : CDVViewController
@end
@interface MainCommandDelegate : CDVCommandDelegateImpl
@end
@interface MainCommandQueue : CDVCommandQueue
@end
|
/**************************************************************************
*
* Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
*/
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <asm/bug.h>
#include <drm/drm_global.h>
struct drm_global_item {
struct mutex mutex;
void *object;
int refcount;
};
static struct drm_global_item glob[DRM_GLOBAL_NUM];
void drm_global_init(void)
{
int i;
for (i = 0; i < DRM_GLOBAL_NUM; ++i) {
struct drm_global_item *item = &glob[i];
#ifdef __NetBSD__
linux_mutex_init(&item->mutex);
#else
mutex_init(&item->mutex);
#endif
item->object = NULL;
item->refcount = 0;
}
}
void drm_global_release(void)
{
int i;
for (i = 0; i < DRM_GLOBAL_NUM; ++i) {
struct drm_global_item *item = &glob[i];
(void)item; /* ignore */
BUG_ON(item->object != NULL);
BUG_ON(item->refcount != 0);
}
}
int drm_global_item_ref(struct drm_global_reference *ref)
{
int ret;
struct drm_global_item *item = &glob[ref->global_type];
mutex_lock(&item->mutex);
if (item->refcount == 0) {
item->object = kzalloc(ref->size, GFP_KERNEL);
if (unlikely(item->object == NULL)) {
ret = -ENOMEM;
goto out_err;
}
ref->object = item->object;
ret = ref->init(ref);
if (unlikely(ret != 0))
goto out_err;
}
++item->refcount;
ref->object = item->object;
mutex_unlock(&item->mutex);
return 0;
out_err:
mutex_unlock(&item->mutex);
item->object = NULL;
return ret;
}
EXPORT_SYMBOL(drm_global_item_ref);
void drm_global_item_unref(struct drm_global_reference *ref)
{
struct drm_global_item *item = &glob[ref->global_type];
mutex_lock(&item->mutex);
BUG_ON(item->refcount == 0);
BUG_ON(ref->object != item->object);
if (--item->refcount == 0) {
ref->release(ref);
item->object = NULL;
}
mutex_unlock(&item->mutex);
}
EXPORT_SYMBOL(drm_global_item_unref);
|
/*
* librdkafka - The Apache Kafka C/C++ library
*
* Copyright (c) 2015 Magnus Edenhill
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _RDKAFKA_SASL_INT_H_
#define _RDKAFKA_SASL_INT_H_
struct rd_kafka_sasl_provider {
const char *name;
/**< Per client-instance (rk) initializer */
int (*init) (rd_kafka_t *rk, char *errstr, size_t errstr_size);
/**< Per client-instance (rk) destructor */
void (*term) (rd_kafka_t *rk);
/**< Returns rd_true if provider is ready to be used, else rd_false */
rd_bool_t (*ready) (rd_kafka_t *rk);
int (*client_new) (rd_kafka_transport_t *rktrans,
const char *hostname,
char *errstr, size_t errstr_size);
int (*recv) (struct rd_kafka_transport_s *s,
const void *buf, size_t size,
char *errstr, size_t errstr_size);
void (*close) (struct rd_kafka_transport_s *);
void (*broker_init) (rd_kafka_broker_t *rkb);
void (*broker_term) (rd_kafka_broker_t *rkb);
int (*conf_validate) (rd_kafka_t *rk,
char *errstr, size_t errstr_size);
};
#ifdef _WIN32
extern const struct rd_kafka_sasl_provider rd_kafka_sasl_win32_provider;
#endif
#if WITH_SASL_CYRUS
extern const struct rd_kafka_sasl_provider rd_kafka_sasl_cyrus_provider;
void rd_kafka_sasl_cyrus_global_term (void);
int rd_kafka_sasl_cyrus_global_init (void);
#endif
extern const struct rd_kafka_sasl_provider rd_kafka_sasl_plain_provider;
#if WITH_SASL_SCRAM
extern const struct rd_kafka_sasl_provider rd_kafka_sasl_scram_provider;
#endif
#if WITH_SASL_OAUTHBEARER
extern const struct rd_kafka_sasl_provider rd_kafka_sasl_oauthbearer_provider;
#endif
void rd_kafka_sasl_auth_done (rd_kafka_transport_t *rktrans);
int rd_kafka_sasl_send (rd_kafka_transport_t *rktrans,
const void *payload, int len,
char *errstr, size_t errstr_size);
#endif /* _RDKAFKA_SASL_INT_H_ */
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/kms/KMS_EXPORTS.h>
#include <aws/kms/KMSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace KMS
{
namespace Model
{
/**
*/
class AWS_KMS_API EnableKeyRequest : public KMSRequest
{
public:
EnableKeyRequest();
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline const Aws::String& GetKeyId() const{ return m_keyId; }
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline void SetKeyId(const Aws::String& value) { m_keyIdHasBeenSet = true; m_keyId = value; }
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline void SetKeyId(Aws::String&& value) { m_keyIdHasBeenSet = true; m_keyId = std::move(value); }
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline void SetKeyId(const char* value) { m_keyIdHasBeenSet = true; m_keyId.assign(value); }
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline EnableKeyRequest& WithKeyId(const Aws::String& value) { SetKeyId(value); return *this;}
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline EnableKeyRequest& WithKeyId(Aws::String&& value) { SetKeyId(std::move(value)); return *this;}
/**
* <p>A unique identifier for the customer master key. This value can be a globally
* unique identifier or the fully specified ARN to a key.</p> <ul> <li> <p>Key ARN
* Example -
* arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</p>
* </li> <li> <p>Globally Unique Key ID Example -
* 12345678-1234-1234-1234-123456789012</p> </li> </ul>
*/
inline EnableKeyRequest& WithKeyId(const char* value) { SetKeyId(value); return *this;}
private:
Aws::String m_keyId;
bool m_keyIdHasBeenSet;
};
} // namespace Model
} // namespace KMS
} // namespace Aws
|
/* $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* etchmap.h -- generic string to object map
*/
#ifndef ETCHMAP_H
#define ETCHMAP_H
#include "etch.h"
#include "etch_hash.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ETCHMAP_MAX_IKEYSIZE 31
void* etchmap_find (etch_hashtable*, const unsigned int key, void** out);
void* etchmap_findx (etch_hashtable*, char* key, void** out);
void* etchmap_findxw (etch_hashtable*, wchar_t* key, void** out);
void* etchmap_findxl (etch_hashtable*, char* key, unsigned keylen, void** out);
void* etchmap_find_by_hash (etch_hashtable*, const unsigned hash, void** out);
void* etchmap_del (etch_hashtable*, const unsigned int key);
void* etchmap_delx (etch_hashtable*, char* key);
void* etchmap_delxw (etch_hashtable*, wchar_t* key);
void* etchmap_delxl (etch_hashtable*, char* ckey, const unsigned keylen);
int etchmap_add (etch_hashtable*, const unsigned int key, void* data);
int etchmap_addx (etch_hashtable*, char* key, void* data);
int etchmap_addxw (etch_hashtable*, wchar_t* key, void* data);
int etchmap_insert (etch_hashtable*, const unsigned, void*, const int is_check);
int etchmap_insertx (etch_hashtable*, char* key, void* data, const int is_check);
int etchmap_insertxw (etch_hashtable*, wchar_t* key, void* data, const int is_check);
int etchmap_insertxl (etch_hashtable*, char*, const unsigned, void*, const int);
int etchmap_insertxlw (etch_hashtable*, wchar_t*, const unsigned, void*, const int);
int etchmap_count(etch_hashtable*);
etch_hashitem* etchmap_current(etch_hashtable*);
int etchmap_map_add (etch_hashtable* map, etch_object* key, etch_object* value);
int etchmap_map_find(etch_hashtable* map, etch_object* key, etch_hashitem** out);
int etchmap_set_add (etch_hashtable* set, etch_object* key);
int etchmap_is_object_key(etch_hashtable*);
int string_to_etchobject_clear_handler (char* key, etch_object* value);
int string_to_genericobject_clear_handler (char* key, void* value);
#ifdef __cplusplus
}
#endif
#endif /* #ifndef ETCHMAP_H*/
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <string.h>
#include <assert.h>
#include "nrf.h"
#include "mcu/nrf51_hal.h"
#include <hal/hal_flash_int.h>
#define NRF51_FLASH_SECTOR_SZ 1024
static int nrf51_flash_read(const struct hal_flash *dev, uint32_t address,
void *dst, uint32_t num_bytes);
static int nrf51_flash_write(const struct hal_flash *dev, uint32_t address,
const void *src, uint32_t num_bytes);
static int nrf51_flash_erase_sector(const struct hal_flash *dev,
uint32_t sector_address);
static int nrf51_flash_sector_info(const struct hal_flash *dev, int idx,
uint32_t *address, uint32_t *sz);
static int nrf51_flash_init(const struct hal_flash *dev);
static const struct hal_flash_funcs nrf51_flash_funcs = {
.hff_read = nrf51_flash_read,
.hff_write = nrf51_flash_write,
.hff_erase_sector = nrf51_flash_erase_sector,
.hff_sector_info = nrf51_flash_sector_info,
.hff_init = nrf51_flash_init
};
const struct hal_flash nrf51_flash_dev = {
.hf_itf = &nrf51_flash_funcs,
.hf_base_addr = 0x00000000,
.hf_size = 256 * 1024, /* XXX read from factory info? */
.hf_sector_cnt = 256, /* XXX read from factory info? */
.hf_align = 1,
.hf_erased_val = 0xff,
};
#define NRF51_FLASH_READY() (NRF_NVMC->READY == NVMC_READY_READY_Ready)
static int
nrf51_flash_wait_ready(void)
{
int i;
for (i = 0; i < 100000; i++) {
if (NRF_NVMC->READY == NVMC_READY_READY_Ready) {
return 0;
}
}
return -1;
}
static int
nrf51_flash_read(const struct hal_flash *dev, uint32_t address, void *dst,
uint32_t num_bytes)
{
memcpy(dst, (void *)address, num_bytes);
return 0;
}
/*
* Flash write is done by writing 4 bytes at a time at a word boundary.
*/
static int
nrf51_flash_write(const struct hal_flash *dev, uint32_t address,
const void *src, uint32_t num_bytes)
{
int sr;
int rc = -1;
uint32_t val;
int cnt;
uint32_t tmp;
if (nrf51_flash_wait_ready()) {
return -1;
}
__HAL_DISABLE_INTERRUPTS(sr);
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; /* Enable erase OP */
tmp = address & 0x3;
if (tmp) {
if (nrf51_flash_wait_ready()) {
goto out;
}
/*
* Starts at a non-word boundary. Read 4 bytes which were there
* before, update with new data, and write back.
*/
val = *(uint32_t *)(address & ~0x3);
cnt = 4 - tmp;
if (cnt > num_bytes) {
cnt = num_bytes;
}
memcpy((uint8_t *)&val + tmp, src, cnt);
*(uint32_t *)(address & ~0x3) = val;
address += cnt;
num_bytes -= cnt;
src += cnt;
}
while (num_bytes >= sizeof(uint32_t)) {
/*
* Write data 4 bytes at a time.
*/
if (nrf51_flash_wait_ready()) {
goto out;
}
memcpy(&val, src, sizeof(uint32_t));
*(uint32_t *)address = val;
address += sizeof(uint32_t);
src += sizeof(uint32_t);
num_bytes -= sizeof(uint32_t);
}
if (num_bytes) {
/*
* Deal with the trailing bytes.
*/
val = *(uint32_t *)address;
memcpy(&val, src, num_bytes);
if (nrf51_flash_wait_ready()) {
goto out;
}
*(uint32_t *)address = val;
}
rc = 0;
if (nrf51_flash_wait_ready()) {
rc = -1;
}
out:
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
__HAL_ENABLE_INTERRUPTS(sr);
return rc;
}
static int
nrf51_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_address)
{
int sr;
int rc = -1;
if (nrf51_flash_wait_ready()) {
return -1;
}
__HAL_DISABLE_INTERRUPTS(sr);
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; /* Enable erase OP */
if (nrf51_flash_wait_ready()) {
goto out;
}
NRF_NVMC->ERASEPAGE = sector_address;
if (nrf51_flash_wait_ready()) {
goto out;
}
rc = 0;
out:
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; /* Disable erase OP */
__HAL_ENABLE_INTERRUPTS(sr);
return rc;
}
static int
nrf51_flash_sector_info(const struct hal_flash *dev, int idx,
uint32_t *address, uint32_t *sz)
{
assert(idx < nrf51_flash_dev.hf_sector_cnt);
*address = idx * NRF51_FLASH_SECTOR_SZ;
*sz = NRF51_FLASH_SECTOR_SZ;
return 0;
}
static int
nrf51_flash_init(const struct hal_flash *dev)
{
return 0;
}
|
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998, 1999 Alexander Larsson
*
* paginate_psprint.[ch] -- pagination code for the postscript backend
* Copyright (C) 1999 James Henstridge
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _PAGINATE_PSPRINT_H
#define _PAGINATE_PSPRINT_H
#include <stdio.h>
#include <glib.h>
#include "diagram.h"
#include "diagramdata.h"
void paginate_psprint (Diagram *dia, FILE *file);
void diagram_print_ps (Diagram *dia);
#endif
|
/*
Copyright (c) 2007 Cyrus Daboo. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
CCalendarNotifier.h
Author:
Description: Represents a node in a calendar store calendar hierarchy
*/
#ifndef CCalendarNotifier_H
#define CCalendarNotifier_H
#include "CCalendarNotification.h"
#include "CICalendarDateTime.h"
#include "CICalendarVAlarm.h"
namespace iCal
{
};
namespace calstore {
class CCalendarNotifier
{
public:
static CCalendarNotifier sCalendarNotifier;
CCalendarNotifier();
~CCalendarNotifier();
void Start();
void Stop();
void Pause(bool pause);
void AddAlarm(iCal::CICalendarVAlarm* alarm);
void RemoveAlarm(iCal::CICalendarVAlarm* alarm);
void ChangedAlarm(iCal::CICalendarVAlarm* alarm);
void Poll();
protected:
CCalendarNotificationMap mAlarms; // All alarms known to system
CCalendarNotificationSet mNotifications; // All notifications for 'active' alarms
CCalendarNotification* GenerateNotification(iCal::CICalendarVAlarm* alarm) const;
void UpdateNotification(CCalendarNotification_ptr& notification); // Update to next notification in alarm set or remove it
void ExecuteNotification(); // Always the one on the top of the stack
void ExecuteAlarm(iCal::CICalendarVAlarm* alarm); // Do alarm
};
} // namespace calstore
#endif // CCalendarNotifier_H
|
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* xds/core/v3/authority.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef XDS_CORE_V3_AUTHORITY_PROTO_UPB_H_
#define XDS_CORE_V3_AUTHORITY_PROTO_UPB_H_
#include "upb/msg_internal.h"
#include "upb/decode.h"
#include "upb/decode_fast.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct xds_core_v3_Authority;
typedef struct xds_core_v3_Authority xds_core_v3_Authority;
extern const upb_msglayout xds_core_v3_Authority_msginit;
/* xds.core.v3.Authority */
UPB_INLINE xds_core_v3_Authority *xds_core_v3_Authority_new(upb_arena *arena) {
return (xds_core_v3_Authority *)_upb_msg_new(&xds_core_v3_Authority_msginit, arena);
}
UPB_INLINE xds_core_v3_Authority *xds_core_v3_Authority_parse(const char *buf, size_t size,
upb_arena *arena) {
xds_core_v3_Authority *ret = xds_core_v3_Authority_new(arena);
if (!ret) return NULL;
if (!upb_decode(buf, size, ret, &xds_core_v3_Authority_msginit, arena)) return NULL;
return ret;
}
UPB_INLINE xds_core_v3_Authority *xds_core_v3_Authority_parse_ex(const char *buf, size_t size,
const upb_extreg *extreg, int options,
upb_arena *arena) {
xds_core_v3_Authority *ret = xds_core_v3_Authority_new(arena);
if (!ret) return NULL;
if (!_upb_decode(buf, size, ret, &xds_core_v3_Authority_msginit, extreg, options, arena)) {
return NULL;
}
return ret;
}
UPB_INLINE char *xds_core_v3_Authority_serialize(const xds_core_v3_Authority *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &xds_core_v3_Authority_msginit, arena, len);
}
UPB_INLINE upb_strview xds_core_v3_Authority_name(const xds_core_v3_Authority *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); }
UPB_INLINE void xds_core_v3_Authority_set_name(xds_core_v3_Authority *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* XDS_CORE_V3_AUTHORITY_PROTO_UPB_H_ */
|
// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _BSDIFF_EXTENTS_H_
#define _BSDIFF_EXTENTS_H_
#include <vector>
#include "bsdiff/extents_file.h"
namespace bsdiff {
// Parses a string representation |ex_str| and populates the vector |extents|
// of ex_t. The string is expected to be a comma-separated list of pairs of the
// form "offset:length". An offset may be -1 or a non-negative integer; the
// former indicates a sparse extent (consisting of zeros). A length is a
// positive integer. Returns whether the parsing was successful.
bool ParseExtentStr(const char* ex_str, std::vector<ex_t>* extents);
} // namespace bsdiff
#endif // _BSDIFF_EXTENTS_H_
|
// Copyright ©2005, 2006 Freescale Semiconductor, Inc.
// Please see the License for the specific language governing rights and
// limitations under the License.
/* Copyright© 1996 - 1997 Metrowerks Corp. All rights reserved
---------------------------------------<< ¥ >>----------------------------------------
FILE: LGADialogBox.h
CLASSES: LGADialogBox
DESCRIPTION:
AUTHOR: Robin Mair
CREATION DATE : 96.03.21
---------------------------------------<< ¥ >>----------------------------------------
THEORY OF OPERATION
---------------------------------------<< ¥ >>----------------------------------------
*/
#ifndef _H_LGADialogBox
#define _H_LGADialogBox
#pragma once
#if defined (__CFM68K__) && !defined (__USING_STATIC_LIBS__)
#pragma import on
#endif
// ¥ POWERPLANT HEADERS
#include <LWindow.h>
#include <LListener.h>
//====================================================================================
// LGADialogBox
//====================================================================================
class LGADialogBox : public LWindow,
public LListener
{
//====<< ¥ CLASS ID ¥ >>===========================================================
public:
enum { class_ID = 'gdlb' };
//====<< ¥ FIELDS ¥ >>=============================================================
protected:
PaneIDT mDefaultButtonID; // Pane ID for the default button
PaneIDT mCancelButtonID; // Pane ID for the cancel button
//====<< ¥ METHODS ¥ >>============================================================
//----<< ¥ INITIALIZATION & DISPOSAL ¥ >>------------------------------------------
public:
LGADialogBox (); // ¥ Default Constructor
LGADialogBox ( const LGADialogBox &inOriginal );
// ¥ Copy Constructor
LGADialogBox ( LStream *inStream ); // ¥ Stream Constructor
LGADialogBox ( SWindowInfo &inWindowInfo );
// ¥ Parameterized Constructor
LGADialogBox ( ResIDT inWINDid,
UInt32 inAttributes,
LCommander* inSuperCommander );
// ¥ Parameterized Constructor
virtual ~LGADialogBox (); // ¥ Destructor
virtual void FinishCreateSelf ();
//----<< ¥ ACCESSORS ¥ >>----------------------------------------------------------
virtual void SetDefaultButton ( PaneIDT inButtonID );
virtual void SetCancelButton ( PaneIDT inButtonID );
//----<< ¥ KEY PRESS ¥ >>----------------------------------------------------------
virtual Boolean HandleKeyPress ( const EventRecord &inKeyEvent );
// ¥ OVERRIDE
//----<< ¥ LISTENING ¥ >>----------------------------------------------------------
virtual void ListenToMessage ( MessageT inMessage,
void* ioParam ); // ¥ OVERRIDE
}; // LGADialogBox
//====================================================================================
// TYPES
//====================================================================================
struct SLGADialogResponse
{
LGADialogBox* dialogBox;
void* messageParam;
};
#if defined (__CFM68K__) && !defined (__USING_STATIC_LIBS__)
#pragma import reset
#endif
#endif
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
#import "NSSecureCoding.h"
@class NSArray, NSMutableArray;
@interface XCPointerEventPath : NSObject <NSSecureCoding>
{
NSMutableArray *_pointerEvents;
_Bool _immutable;
unsigned long long _pathType;
unsigned long long _index;
}
+ (_Bool)supportsSecureCoding;
@property _Bool immutable; // @synthesize immutable=_immutable;
@property unsigned long long index; // @synthesize index=_index;
@property(readonly) unsigned long long pathType; // @synthesize pathType=_pathType;
- (id)description;
- (id)firstEventAfterOffset:(double)arg1;
- (id)lastEventBeforeOffset:(double)arg1;
- (void)_addPointerEvent:(id)arg1;
- (void)releaseButton:(unsigned long long)arg1 atOffset:(double)arg2;
- (void)pressButton:(unsigned long long)arg1 atOffset:(double)arg2;
- (void)liftUpAtOffset:(double)arg1;
- (void)moveToPoint:(struct CGPoint)arg1 atOffset:(double)arg2;
- (void)pressDownWithPressure:(double)arg1 atOffset:(double)arg2;
- (void)pressDownAtOffset:(double)arg1;
@property(readonly) NSArray *pointerEvents;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)initForMouseAtPoint:(struct CGPoint)arg1 offset:(double)arg2;
- (id)initForTouchAtPoint:(struct CGPoint)arg1 offset:(double)arg2;
- (id)init;
- (void)dealloc;
@end
|
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* 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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include "config.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "mgt/mgt.h"
#include "vsm_priv.h"
#include "common/heritage.h"
#include "common/vsmw.h"
static struct vsmw *mgt_vsmw;
/*--------------------------------------------------------------------
*/
void
mgt_SHM_static_alloc(const void *ptr, ssize_t size,
const char *class, const char *ident)
{
void *p;
p = VSMW_Allocf(mgt_vsmw, NULL, class, size, "%s", ident);
AN(p);
memcpy(p, ptr, size);
}
/*--------------------------------------------------------------------
* Exit handler that clears the owning pid from the SHMLOG
*/
static void
mgt_shm_atexit(void)
{
/* Do not let VCC kill our VSM */
if (getpid() != heritage.mgt_pid)
return;
VJ_master(JAIL_MASTER_FILE);
VSMW_Destroy(&mgt_vsmw);
if (!MGT_DO_DEBUG(DBG_VTC_MODE)) {
AZ(system("rm -rf " VSM_MGT_DIRNAME));
AZ(system("rm -rf " VSM_CHILD_DIRNAME));
}
VJ_master(JAIL_MASTER_LOW);
}
/*--------------------------------------------------------------------
* Initialize VSM subsystem
*/
void
mgt_SHM_Init(void)
{
int fd;
VJ_master(JAIL_MASTER_FILE);
AZ(system("rm -rf " VSM_MGT_DIRNAME));
AZ(mkdir(VSM_MGT_DIRNAME, 0755));
fd = open(VSM_MGT_DIRNAME, O_RDONLY);
VJ_fix_fd(fd, JAIL_FIXFD_VSMMGT);
VJ_master(JAIL_MASTER_LOW);
mgt_vsmw = VSMW_New(fd, 0640, "_.index");
AN(mgt_vsmw);
heritage.proc_vsmw = mgt_vsmw;
/* Setup atexit handler */
AZ(atexit(mgt_shm_atexit));
}
void
mgt_SHM_ChildNew(void)
{
VJ_master(JAIL_MASTER_FILE);
AZ(system("rm -rf " VSM_CHILD_DIRNAME));
AZ(mkdir(VSM_CHILD_DIRNAME, 0750));
heritage.vsm_fd = open(VSM_CHILD_DIRNAME, O_RDONLY);
assert(heritage.vsm_fd >= 0);
VJ_fix_fd(heritage.vsm_fd, JAIL_FIXFD_VSMWRK);
VJ_master(JAIL_MASTER_LOW);
MCH_Fd_Inherit(heritage.vsm_fd, "VSMW");
heritage.param = VSMW_Allocf(mgt_vsmw, NULL, VSM_CLASS_PARAM,
sizeof *heritage.param, "");
AN(heritage.param);
*heritage.param = mgt_param;
heritage.panic_str_len = 64 * 1024;
heritage.panic_str = VSMW_Allocf(mgt_vsmw, NULL, "Panic",
heritage.panic_str_len, "");
AN(heritage.panic_str);
}
void
mgt_SHM_ChildDestroy(void)
{
closefd(&heritage.vsm_fd);
if (!MGT_DO_DEBUG(DBG_VTC_MODE)) {
VJ_master(JAIL_MASTER_FILE);
AZ(system("rm -rf " VSM_CHILD_DIRNAME));
VJ_master(JAIL_MASTER_LOW);
}
VSMW_Free(mgt_vsmw, (void**)&heritage.panic_str);
VSMW_Free(mgt_vsmw, (void**)&heritage.param);
}
|
#ifndef __ASM_SPINLOCK_H
#define __ASM_SPINLOCK_H
#include <asm-generic/spinlock.h>
#endif
|
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
* 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.
* 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.
*
* @(#)echo.c 8.2 (Berkeley) 5/4/95
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/bin/sh/bltin/echo.c 128001 2004-04-06 20:06:54Z markm $");
/*
* Echo command.
*/
#define main echocmd
#include "bltin.h"
/* #define eflag 1 */
int
main(int argc, char *argv[])
{
char **ap;
char *p;
char c;
int count;
int nflag = 0;
#ifndef eflag
int eflag = 0;
#endif
ap = argv;
if (argc)
ap++;
if ((p = *ap) != NULL) {
if (equal(p, "-n")) {
nflag++;
ap++;
} else if (equal(p, "-e")) {
#ifndef eflag
eflag++;
#endif
ap++;
}
}
while ((p = *ap++) != NULL) {
while ((c = *p++) != '\0') {
if (c == '\\' && eflag) {
switch (*p++) {
case 'a': c = '\a'; break;
case 'b': c = '\b'; break;
case 'c': return 0; /* exit */
case 'e': c = '\033'; break;
case 'f': c = '\f'; break;
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case 'v': c = '\v'; break;
case '\\': break; /* c = '\\' */
case '0':
c = 0;
count = 3;
while (--count >= 0 && (unsigned)(*p - '0') < 8)
c = (c << 3) + (*p++ - '0');
break;
default:
p--;
break;
}
}
putchar(c);
}
if (*ap)
putchar(' ');
}
if (! nflag)
putchar('\n');
return 0;
}
|
/*
* $NetBSD: pread.c,v 1.2 1997/03/22 01:48:38 thorpej Exp $
*/
/*-
* Copyright (c) 1996
* Matthias Drochner. 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 for the NetBSD Project
* by Matthias Drochner.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/sys/boot/i386/libi386/pread.c 119525 2003-08-25 23:28:32Z obrien $");
/* read into destination in flat addr space */
#include <stand.h>
#include "libi386.h"
#ifdef SAVE_MEMORY
#define BUFSIZE (1*1024)
#else
#define BUFSIZE (4*1024)
#endif
static char buf[BUFSIZE];
int
pread(fd, dest, size)
int fd;
vm_offset_t dest;
int size;
{
int rsize;
rsize = size;
while (rsize > 0) {
int count, got;
count = (rsize < BUFSIZE ? rsize : BUFSIZE);
got = read(fd, buf, count);
if (got < 0)
return (-1);
/* put to physical space */
vpbcopy(buf, dest, got);
dest += got;
rsize -= got;
if (got < count)
break; /* EOF */
}
return (size - rsize);
}
|
#ifndef ZFLYEMNEURONLAYERMATCHER_H
#define ZFLYEMNEURONLAYERMATCHER_H
#include <map>
#include <vector>
#include <utility>
#include "zmatrix.h"
class ZFlyEmNeuron;
class ZFlyEmLayerFeatureSequence :
public std::vector<std::pair<double, double> > {
public:
ZFlyEmLayerFeatureSequence();
double getLayer(size_t index) const;
double getValue(size_t index) const;
void append(double layer, double value);
inline size_t getLayerNumber() const { return size(); }
private:
};
class ZFlyEmNeuronLayerMatcher
{
public:
ZFlyEmNeuronLayerMatcher();
double match(ZFlyEmNeuron *neuron1, ZFlyEmNeuron *neuron2);
inline void setLayerScale(double scale) { m_layerScale = scale; }
void print() const;
private:
double match(const ZFlyEmLayerFeatureSequence &seq1,
const ZFlyEmLayerFeatureSequence &seq2);
double computeSimilarity(double layer1, double value1,
double layer2, double value2) const;
ZFlyEmLayerFeatureSequence computeLayerFeature(ZFlyEmNeuron *neuron) const;
void addMatched(double v1, double v2);
private:
double m_matchingScore;
std::vector<std::pair<double, double> > m_matchingResult;
double m_layerScale;
double m_layerBaseFactor;
};
#endif // ZFLYEMNEURONLAYERMATCHER_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81.h
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Initialize data as a large string
* GoodSource: Initialize data as a small string
* Sinks: loop
* BadSink : Copy data to string using a loop
* Flow Variant: 81 Data flow: data passed in a parameter to a virtual method called via a reference
*
* */
#include "std_testcase.h"
#include <wchar.h>
namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81
{
class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81_base
{
public:
/* pure virtual function */
virtual void action(wchar_t * data) const = 0;
};
#ifndef OMITBAD
class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81_bad : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITGOOD */
}
|
#include "erfa.h"
double eraGst06(double uta, double utb, double tta, double ttb,
double rnpb[3][3])
/*
** - - - - - - - - -
** e r a G s t 0 6
** - - - - - - - - -
**
** Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
**
** Given:
** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2)
** tta,ttb double TT as a 2-part Julian Date (Notes 1,2)
** rnpb double[3][3] nutation x precession x bias matrix
**
** Returned (function value):
** double Greenwich apparent sidereal time (radians)
**
** Notes:
**
** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
** Julian Dates, apportioned in any convenient way between the
** argument pairs. For example, JD=2450123.7 could be expressed in
** any of these ways, among others:
**
** Part A Part B
**
** 2450123.7 0.0 (JD method)
** 2451545.0 -1421.3 (J2000 method)
** 2400000.5 50123.2 (MJD method)
** 2450123.5 0.2 (date & time method)
**
** The JD method is the most natural and convenient to use in
** cases where the loss of several decimal digits of resolution
** is acceptable (in the case of UT; the TT is not at all critical
** in this respect). The J2000 and MJD methods are good compromises
** between resolution and convenience. For UT, the date & time
** method is best matched to the algorithm that is used by the Earth
** rotation angle function, called internally: maximum precision is
** delivered when the uta argument is for 0hrs UT1 on the day in
** question and the utb argument lies in the range 0 to 1, or vice
** versa.
**
** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation
** and TT to predict the effects of precession-nutation. If UT1 is
** used for both purposes, errors of order 100 microarcseconds
** result.
**
** 3) Although the function uses the IAU 2006 series for s+XY/2, it is
** otherwise independent of the precession-nutation model and can in
** practice be used with any equinox-based NPB matrix.
**
** 4) The result is returned in the range 0 to 2pi.
**
** Called:
** eraBpn2xy extract CIP X,Y coordinates from NPB matrix
** eraS06 the CIO locator s, given X,Y, IAU 2006
** eraAnp normalize angle into range 0 to 2pi
** eraEra00 Earth rotation angle, IAU 2000
** eraEors equation of the origins, given NPB matrix and s
**
** Reference:
**
** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
**
** Copyright (C) 2013-2019, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
double x, y, s, era, eors, gst;
/* Extract CIP coordinates. */
eraBpn2xy(rnpb, &x, &y);
/* The CIO locator, s. */
s = eraS06(tta, ttb, x, y);
/* Greenwich apparent sidereal time. */
era = eraEra00(uta, utb);
eors = eraEors(rnpb, s);
gst = eraAnp(era - eors);
return gst;
}
/*----------------------------------------------------------------------
**
**
** Copyright (C) 2013-2019, NumFOCUS Foundation.
** All rights reserved.
**
** This library is derived, with permission, from the International
** Astronomical Union's "Standards of Fundamental Astronomy" library,
** available from http://www.iausofa.org.
**
** The ERFA version is intended to retain identical functionality to
** the SOFA library, but made distinct through different function and
** file names, as set out in the SOFA license conditions. The SOFA
** original has a role as a reference standard for the IAU and IERS,
** and consequently redistribution is permitted only in its unaltered
** state. The ERFA version is not subject to this restriction and
** therefore can be included in distributions which do not support the
** concept of "read only" software.
**
** Although the intent is to replicate the SOFA API (other than
** replacement of prefix names) and results (with the exception of
** bugs; any that are discovered will be fixed), SOFA is not
** responsible for any errors found in this version of the library.
**
** If you wish to acknowledge the SOFA heritage, please acknowledge
** that you are using a library derived from SOFA, rather than SOFA
** itself.
**
**
** TERMS AND CONDITIONS
**
** 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 Standards Of Fundamental Astronomy Board,
** the International Astronomical Union nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
**
*/
|
// Copyright 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_MUS_GLES2_GPU_STATE_H_
#define COMPONENTS_MUS_GLES2_GPU_STATE_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "gpu/command_buffer/service/mailbox_manager_impl.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "ui/gl/gl_share_group.h"
namespace mus {
// We need to share these across all CommandBuffer instances so that contexts
// they create can share resources with each other via mailboxes.
class GpuState : public base::RefCounted<GpuState> {
public:
GpuState();
// We run the CommandBufferImpl on the control_task_runner, which forwards
// most method class to the CommandBufferDriver, which runs on the "driver",
// thread (i.e., the thread on which GpuImpl instances are created).
scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() {
return control_thread_.task_runner();
}
void StopControlThread();
// These objects are intended to be used on the "driver" thread (i.e., the
// thread on which GpuImpl instances are created).
gfx::GLShareGroup* share_group() const { return share_group_.get(); }
gpu::gles2::MailboxManager* mailbox_manager() const {
return mailbox_manager_.get();
}
gpu::SyncPointManager* sync_point_manager() const {
return sync_point_manager_.get();
}
private:
friend class base::RefCounted<GpuState>;
~GpuState();
base::Thread control_thread_;
scoped_ptr<gpu::SyncPointManager> sync_point_manager_;
scoped_refptr<gfx::GLShareGroup> share_group_;
scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
};
} // namespace mus
#endif // COMPONENTS_MUS_GLES2_GPU_STATE_H_
|
/******************************************************************************
This source file is part of the Avogadro project.
Copyright 2013 Kitware, Inc.
This source code is released under the New BSD License, (the "License").
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 AVOGADRO_QTPLUGINS_LINEFORMATINPUT_H
#define AVOGADRO_QTPLUGINS_LINEFORMATINPUT_H
#include <avogadro/qtgui/extensionplugin.h>
#include <QtCore/QMap>
#include <string>
namespace Avogadro {
namespace Io {
class FileFormat;
}
namespace QtPlugins {
/**
* @brief Load single-line molecule descriptors through an input dialog.
*/
class LineFormatInput : public QtGui::ExtensionPlugin
{
Q_OBJECT
public:
explicit LineFormatInput(QObject* parent_ = nullptr);
~LineFormatInput() override;
QString name() const override { return tr("LineFormatInput"); }
QString description() const override;
QList<QAction*> actions() const override;
QStringList menuPath(QAction*) const override;
public slots:
void setMolecule(QtGui::Molecule*) override;
private slots:
void showDialog();
private:
QList<QAction*> m_actions;
/// Maps identifier to extension:
QMap<QString, std::string> m_formats;
QtGui::Molecule* m_molecule;
Io::FileFormat* m_reader;
std::string m_descriptor;
};
inline QString LineFormatInput::description() const
{
return tr("Load single-line molecule descriptors through an input dialog.");
}
} // namespace QtPlugins
} // namespace Avogadro
#endif // AVOGADRO_QTPLUGINS_LINEFORMATINPUT_H
|
#ifndef LIB_INCLUDE_TICK_HAWKES_MODEL_BASE_MODEL_HAWKES_LEASTSQ_H_
#define LIB_INCLUDE_TICK_HAWKES_MODEL_BASE_MODEL_HAWKES_LEASTSQ_H_
// License: BSD 3 clause
#include "tick/base/base.h"
#include "tick/hawkes/model/base/model_hawkes_list.h"
#include "tick/hawkes/model/base/model_hawkes_single.h"
/** \class ModelHawkesLeastSq
* \brief Base class of Hawkes models handling several realizations
*/
class DLL_PUBLIC ModelHawkesLeastSq : public ModelHawkesList {
protected:
//! @brief Flag telling if precompations arrays have been allocated or not
bool weights_allocated;
//! @bbrief aggregated model used to compute loss, gradient and hessian
std::unique_ptr<ModelHawkesSingle> aggregated_model;
public:
//! @brief Constructor
//! \param max_n_threads : number of cores to be used for multithreading. If
//! negative, the number of physical cores will be used \param
//! optimization_level : 0 corresponds to no optimization and 1 to use of
//! faster (approximated) exponential function
ModelHawkesLeastSq(const int max_n_threads = 1,
const unsigned int optimization_level = 0);
void incremental_set_data(const SArrayDoublePtrList1D ×tamps,
double end_time);
/**
* @brief Precomputations of intermediate values
* They will be used to compute faster loss and gradient
*/
void compute_weights();
/**
* @brief Compute loss
* \param coeffs : Point in which loss is computed
* \return Loss' value
*/
double loss(const ArrayDouble &coeffs) override;
/**
* @brief Compute loss corresponding to sample i (between 0 and rand_max =
* dim) \param i : selected dimension \param coeffs : Point in which loss is
* computed \return Loss' value
*/
double loss_i(const ulong i, const ArrayDouble &coeffs) override;
/**
* @brief Compute gradient
* \param coeffs : Point in which gradient is computed
* \param out : Array in which the value of the gradient is stored
*/
void grad(const ArrayDouble &coeffs, ArrayDouble &out) override;
/**
* @brief Compute gradient corresponding to sample i (between 0 and rand_max =
* dim) \param i : selected dimension \param coeffs : Point in which gradient
* is computed \param out : Array in which the value of the gradient is stored
*/
void grad_i(const ulong i, const ArrayDouble &coeffs,
ArrayDouble &out) override;
protected:
//! @brief allocate arrays to store precomputations
virtual void allocate_weights() {}
//! @brief synchronize aggregate_model with this instance
virtual void synchronize_aggregated_model() {}
virtual void compute_weights_timestamps_list() {}
virtual void compute_weights_timestamps(
const SArrayDoublePtrList1D ×tamps, double end_time) {}
public:
template <class Archive>
void serialize(Archive &ar) {
ar(cereal::make_nvp("ModelHawkesList",
cereal::base_class<ModelHawkesList>(this)));
ar(CEREAL_NVP(weights_allocated));
ar(CEREAL_NVP(aggregated_model));
}
BoolStrReport compare(const ModelHawkesLeastSq &that, std::stringstream &ss) {
ss << get_class_name() << std::endl;
auto are_equal = ModelHawkesList::compare(that, ss) &&
TICK_CMP_REPORT(ss, weights_allocated) &&
TICK_CMP_REPORT_PTR(ss, aggregated_model.get());
return BoolStrReport(are_equal, ss.str());
}
BoolStrReport compare(const ModelHawkesLeastSq &that) {
std::stringstream ss;
return compare(that, ss);
}
BoolStrReport operator==(const ModelHawkesLeastSq &that) {
return ModelHawkesLeastSq::compare(that);
}
};
#endif // LIB_INCLUDE_TICK_HAWKES_MODEL_BASE_MODEL_HAWKES_LEASTSQ_H_
|
#ifndef _LIST_H_
#define _LIST_H_
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, md) ((size_t)&((type *)0)->md)
#endif
#ifndef container_of
#define container_of(ptr, type, member) \
((type *)((char *)(ptr) - offsetof(type, member)))
#endif
struct list_item {
struct list_item *next;
struct list_item *prev;
};
struct list {
struct list_item *head;
struct list_item *tail;
};
#define LIST_INIT(name) { 0, 0 }
#define LIST(name) \
struct list name = LIST_INIT(name)
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
static inline void list_init(struct list *list)
{
list->head = 0;
list->tail = 0;
}
static inline void list_append(struct list *list, struct list_item *item)
{
item->next = 0;
item->prev = list->tail;
if (list->tail != 0)
list->tail->next = item;
else
list->head = item;
list->tail = item;
}
static inline void list_prepend(struct list *list, struct list_item *item)
{
item->prev = 0;
item->next = list->head;
if (list->head == 0)
list->tail = item;
list->head = item;
}
static inline void list_insert(struct list *list, struct list_item *after, struct list_item *item)
{
if (after == 0) {
list_prepend(list, item);
return;
}
item->prev = after;
item->next = after->next;
after->next = item;
if (item->next)
item->next->prev = item;
if (list->tail == after)
list->tail = item;
}
static inline void list_remove(struct list *list, struct list_item *item)
{
if (item->next)
item->next->prev = item->prev;
if (list->head == item) {
list->head = item->next;
if (list->head == 0)
list->tail = 0;
} else {
item->prev->next = item->next;
if (list->tail == item)
list->tail = item->prev;
}
item->prev = item->next = 0;
}
static inline struct list_item *list_pop(struct list *list)
{
struct list_item *item;
item = list->head;
if (item == 0)
return 0;
list_remove(list, item);
return item;
}
static inline struct list_item *list_last(struct list *list)
{
return list->tail;
}
static inline struct list_item *list_first(struct list *list)
{
return list->head;
}
static inline struct list_item *list_next(struct list_item *item)
{
return item->next;
}
#define list_push list_append
#define list_for_each(_list, _iter) \
for (_iter = (_list)->head; (_iter) != 0; _iter = (_iter)->next)
#define list_for_each_after(_node, _iter) \
for (_iter = (_node)->next; (_iter) != 0; _iter = (_iter)->next)
#define list_for_each_safe(_list, _iter, _bkup) \
for (_iter = (_list)->head; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
#define list_for_each_safe_after(_node, _iter, _bkup) \
for (_iter = (_node)->next; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
#endif
|
/*
* This is the program called to deliver mail
* on systems where we try to maintain compatibility
* with the standard message format.
*/
char *Mailprog = "/usr/ucb/Mail";
|
/****************************/
/* THIS IS OPEN SOURCE CODE */
/****************************/
/**
* @file linux-L2unit.h
* @author Heike Jagode
* jagode@eecs.utk.edu
* Mods: < your name here >
* < your email address >
* BGPM / L2unit component
*
* Tested version of bgpm (early access)
*
* @brief
* This file has the source code for a component that enables PAPI-C to
* access hardware monitoring counters for BG/Q through the bgpm library.
*/
#ifndef _PAPI_L2UNIT_H
#define _PAPI_L2UNIT_H
#include "papi.h"
#include "papi_internal.h"
#include "papi_vector.h"
#include "papi_memory.h"
#include "extras.h"
#include "../../../linux-bgq-common.h"
/************************* DEFINES SECTION ***********************************
*******************************************************************************/
/* this number assumes that there will never be more events than indicated */
#define L2UNIT_MAX_COUNTERS UPC_L2_NUM_COUNTERS
#define L2UNIT_MAX_EVENTS PEVT_L2UNIT_LAST_EVENT
#define OFFSET ( PEVT_PUNIT_LAST_EVENT + 1 )
/* Stores private information for each event */
typedef struct L2UNIT_register
{
unsigned int selector;
/* Signifies which counter slot is being used */
/* Indexed from 1 as 0 has a special meaning */
} L2UNIT_register_t;
/* Used when doing register allocation */
typedef struct L2UNIT_reg_alloc
{
L2UNIT_register_t ra_bits;
} L2UNIT_reg_alloc_t;
typedef struct L2UNIT_overflow
{
int threshold;
int EventIndex;
} L2UNIT_overflow_t;
/* Holds control flags */
typedef struct L2UNIT_control_state
{
int EventGroup;
int EventGroup_local[512];
int count;
long long counters[L2UNIT_MAX_COUNTERS];
int overflow; // overflow enable
int overflow_count;
L2UNIT_overflow_t overflow_list[512];
int bgpm_eventset_applied; // BGPM eventGroup applied yes or no flag
} L2UNIT_control_state_t;
/* Holds per-thread information */
typedef struct L2UNIT_context
{
L2UNIT_control_state_t state;
} L2UNIT_context_t;
#endif /* _PAPI_L2UNIT_H */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68b.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE193.label.xml
Template File: sources-sink-68b.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Point data to a buffer that does not have space for a NULL terminator
* GoodSource: Point data to a buffer that includes space for a NULL terminator
* Sink: cpy
* BadSink : Copy string to data using wcscpy()
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING L"AAAAAAAAAA"
extern wchar_t * CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68_badData;
extern wchar_t * CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68_goodG2BData;
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68b_badSink()
{
wchar_t * data = CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68_badData;
{
wchar_t source[10+1] = SRC_STRING;
/* POTENTIAL FLAW: data may not have enough space to hold source */
wcscpy(data, source);
printWLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68b_goodG2BSink()
{
wchar_t * data = CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_cpy_68_goodG2BData;
{
wchar_t source[10+1] = SRC_STRING;
/* POTENTIAL FLAW: data may not have enough space to hold source */
wcscpy(data, source);
printWLine(data);
}
}
#endif /* OMITGOOD */
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMarkerUtilities.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 vtkMarkerUtilities - Utilities for generating marker images
//
// .SECTION Description
// This class programmatically generates markers of a specified size
// for various marker styles.
//
// .SECTION See Also
// vtkPlotLine, vtkPlotPoints
#ifndef vtkMarkerUtilities_h
#define vtkMarkerUtilities_h
#include "vtkRenderingContext2DModule.h" // For export macro
#include "vtkObject.h"
class vtkImageData;
class VTKRENDERINGCONTEXT2D_EXPORT vtkMarkerUtilities : public vtkObject
{
public:
vtkTypeMacro(vtkMarkerUtilities, vtkObject);
virtual void PrintSelf(ostream &os, vtkIndent indent);
//BTX
// Description:
// Enum containing various marker styles that can be used in a plot.
enum {
NONE = 0,
CROSS,
PLUS,
SQUARE,
CIRCLE,
DIAMOND
};
//ETX
// Description:
// Generate the requested symbol of a particular style and size.
static void GenerateMarker(vtkImageData *data, int style, int width);
//BTX
protected:
vtkMarkerUtilities();
~vtkMarkerUtilities();
private:
vtkMarkerUtilities(const vtkMarkerUtilities &); // Not implemented.
void operator=(const vtkMarkerUtilities &); // Not implemented.
//ETX
};
#endif //vtkMarkerUtilities_h
|
/*++
Copyright (c) 2011, kontais
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
GlxPci.h
Abstract:
--*/
#ifndef _GLX_PCI_H_
#define _GLX_PCI_H_
//
// PCI bus device function
//
#define CS5536_PCI_BUS 0
#define CS5536_PCI_IDSEL 14
#define CS5536_PCI_FUNC_ISA 0
#define CS5536_PCI_FUNC_FLASH 1
#define CS5536_PCI_FUNC_IDE 2
#define CS5536_PCI_FUNC_ACC 3
#define CS5536_PCI_FUNC_OHCI 4
#define CS5536_PCI_FUNC_EHCI 5
#define CS5536_PCI_FUNC_UDC 6
#define CS5536_PCI_FUNC_OTG 7
#define CS5536_PCI_FUNC_START 0
#define CS5536_PCI_FUNC_END 7
#define CS5536_PCI_FUNC_COUNT (CS5536_PCI_FUNC_END - CS5536_PCI_FUNC_START + 1)
/* MSR access through PCI configuration space */
#define PCI_MSR_CTRL 0x00f0
#define PCI_MSR_ADDR 0x00f4
#define PCI_MSR_LO32 0x00f8
#define PCI_MSR_HI32 0x00fc
#endif /* _GLX_PCI_H_ */
|
/*
* Copyright (c) 1989 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include <popper.h>
RCSID("$Id$");
/*
* msg: Send a formatted line to the POP client
*/
int
pop_msg(POP *p, int stat, const char *format, ...)
{
char *mp;
char message[MAXLINELEN];
va_list ap;
va_start(ap, format);
/* Point to the message buffer */
mp = message;
/* Format the POP status code at the beginning of the message */
snprintf (mp, sizeof(message), "%s ",
(stat == POP_SUCCESS) ? POP_OK : POP_ERR);
/* Point past the POP status indicator in the message message */
mp += strlen(mp);
/* Append the message (formatted, if necessary) */
if (format)
vsnprintf (mp, sizeof(message) - strlen(message),
format, ap);
/* Log the message if debugging is turned on */
#ifdef DEBUG
if (p->debug && stat == POP_SUCCESS)
pop_log(p,POP_DEBUG,"%s",message);
#endif /* DEBUG */
/* Log the message if a failure occurred */
if (stat != POP_SUCCESS)
pop_log(p,POP_PRIORITY,"%s",message);
/* Append the <CR><LF> */
strlcat(message, "\r\n", sizeof(message));
/* Send the message to the client */
fputs(message, p->output);
fflush(p->output);
va_end(ap);
return(stat);
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_wchar_t_alloca_ncpy_09.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml
Template File: sources-sink-09.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: ncpy
* BadSink : Copy string to data using wcsncpy
* Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_wchar_t_alloca_ncpy_09_bad()
{
wchar_t * data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
if(GLOBAL_CONST_TRUE)
{
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
wcsncpy(data, source, 100-1);
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */
static void goodG2B1()
{
wchar_t * data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
if(GLOBAL_CONST_FALSE)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
wcsncpy(data, source, 100-1);
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t * dataBadBuffer = (wchar_t *)ALLOCA(50*sizeof(wchar_t));
wchar_t * dataGoodBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
if(GLOBAL_CONST_TRUE)
{
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
wcsncpy(data, source, 100-1);
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
}
}
void CWE121_Stack_Based_Buffer_Overflow__CWE805_wchar_t_alloca_ncpy_09_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()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_wchar_t_alloca_ncpy_09_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_wchar_t_alloca_ncpy_09_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Nintendo Game Boy GBS music file emulator core
// Game_Music_Emu $vers
#ifndef GBS_CORE_H
#define GBS_CORE_H
#include "Gme_Loader.h"
#include "Rom_Data.h"
#include "Gb_Cpu.h"
#include "Gb_Apu.h"
class Gbs_Core : public Gme_Loader {
public:
// GBS file header
struct header_t
{
enum { size = 112 };
char tag [ 3];
byte vers;
byte track_count;
byte first_track;
byte load_addr [ 2];
byte init_addr [ 2];
byte play_addr [ 2];
byte stack_ptr [ 2];
byte timer_modulo;
byte timer_mode;
char game [32]; // strings can be 32 chars, NOT terminated
char author [32];
char copyright [32];
// True if header has valid file signature
bool valid_tag() const;
};
// Header for currently loaded file
header_t const& header() const { return header_; }
// Sound chip
Gb_Apu& apu() { return apu_; }
// ROM data
Rom_Data const& rom_() const { return rom; }
// Adjusts music tempo, where 1.0 is normal. Can be changed while playing.
void set_tempo( double );
// Starts track, where 0 is the first. Uses specified APU mode.
blargg_err_t start_track( int, Gb_Apu::mode_t = Gb_Apu::mode_cgb );
// Ends time frame at time t
typedef int time_t; // clock count
blargg_err_t end_frame( time_t t );
// Clocks between calls to play routine
time_t play_period() const { return play_period_; }
protected:
typedef int addr_t;
// Current time
time_t time() const { return cpu.time() + end_time; }
// Runs emulator to time t
blargg_err_t run_until( time_t t );
// Runs CPU until time becomes >= 0
void run_cpu();
// Reads/writes memory and I/O
int read_mem( addr_t );
void write_mem( addr_t, int );
// Implementation
public:
Gbs_Core();
~Gbs_Core();
virtual void unload();
protected:
virtual blargg_err_t load_( Data_Reader& );
private:
enum { ram_addr = 0xA000 };
enum { io_base = 0xFF00 };
enum { hi_page = io_base - ram_addr };
Rom_Data rom;
int tempo;
time_t end_time;
time_t play_period_;
time_t next_play;
header_t header_;
Gb_Cpu cpu;
Gb_Apu apu_;
byte ram [0x4000 + 0x2000 + Gb_Cpu::cpu_padding];
void update_timer();
void jsr_then_stop( byte const [] );
void set_bank( int n );
void write_io_inline( int offset, int data, int base );
void write_io_( int offset, int data );
int read_io( int offset );
void write_io( int offset, int data );
};
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE427_Uncontrolled_Search_Path_Element__char_console_54c.c
Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml
Template File: sources-sink-54c.tmpl.c
*/
/*
* @description
* CWE: 427 Uncontrolled Search Path Element
* BadSource: console Read input from the console
* GoodSource: Use a hardcoded path
* Sink:
* BadSink : Set the environment variable
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define NEW_PATH "%SystemRoot%\\system32"
#define PUTENV _putenv
#else
#define NEW_PATH "/bin"
#define PUTENV putenv
#endif
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE427_Uncontrolled_Search_Path_Element__char_console_54d_badSink(char * data);
void CWE427_Uncontrolled_Search_Path_Element__char_console_54c_badSink(char * data)
{
CWE427_Uncontrolled_Search_Path_Element__char_console_54d_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE427_Uncontrolled_Search_Path_Element__char_console_54d_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE427_Uncontrolled_Search_Path_Element__char_console_54c_goodG2BSink(char * data)
{
CWE427_Uncontrolled_Search_Path_Element__char_console_54d_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
/*
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
* Copyright (C) 2005 Eric Seidel <eric@webkit.org>
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FEBlend_h
#define FEBlend_h
#include "core/platform/graphics/filters/FilterEffect.h"
#include "core/platform/graphics/filters/Filter.h"
namespace WebCore {
enum BlendModeType {
FEBLEND_MODE_UNKNOWN = 0,
FEBLEND_MODE_NORMAL = 1,
FEBLEND_MODE_MULTIPLY = 2,
FEBLEND_MODE_SCREEN = 3,
FEBLEND_MODE_DARKEN = 4,
FEBLEND_MODE_LIGHTEN = 5
};
class FEBlend : public FilterEffect {
public:
static PassRefPtr<FEBlend> create(Filter*, BlendModeType);
BlendModeType blendMode() const;
bool setBlendMode(BlendModeType);
void platformApplyGeneric(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray,
unsigned colorArrayLength);
void platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray,
unsigned colorArrayLength);
virtual SkImageFilter* createImageFilter(SkiaImageFilterBuilder*);
virtual TextStream& externalRepresentation(TextStream&, int indention) const;
private:
FEBlend(Filter*, BlendModeType);
virtual void applySoftware() OVERRIDE;
virtual bool applySkia() OVERRIDE;
BlendModeType m_mode;
};
} // namespace WebCore
#endif // FEBlend_h
|
void dummy (void)
{}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__short_min_sub_18.c
Label Definition File: CWE191_Integer_Underflow.label.xml
Template File: sources-sinks-18.tmpl.c
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: min Set data to the min value for short
* GoodSource: Set data to a small, non-zero number (negative two)
* Sinks: sub
* GoodSink: Ensure there will not be an underflow before subtracting 1 from data
* BadSink : Subtract 1 from data, which can cause an Underflow
* Flow Variant: 18 Control flow: goto statements
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE191_Integer_Underflow__short_min_sub_18_bad()
{
short data;
data = 0;
goto source;
source:
/* POTENTIAL FLAW: Use the minimum size of the data type */
data = SHRT_MIN;
goto sink;
sink:
{
/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */
short result = data - 1;
printIntLine(result);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G() - use badsource and goodsink by reversing the blocks on the second goto statement */
static void goodB2G()
{
short data;
data = 0;
goto source;
source:
/* POTENTIAL FLAW: Use the minimum size of the data type */
data = SHRT_MIN;
goto sink;
sink:
/* FIX: Add a check to prevent an underflow from occurring */
if (data > SHRT_MIN)
{
short result = data - 1;
printIntLine(result);
}
else
{
printLine("data value is too large to perform subtraction.");
}
}
/* goodG2B() - use goodsource and badsink by reversing the blocks on the first goto statement */
static void goodG2B()
{
short data;
data = 0;
goto source;
source:
/* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */
data = -2;
goto sink;
sink:
{
/* POTENTIAL FLAW: Subtracting 1 from data could cause an underflow */
short result = data - 1;
printIntLine(result);
}
}
void CWE191_Integer_Underflow__short_min_sub_18_good()
{
goodB2G();
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE191_Integer_Underflow__short_min_sub_18_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE191_Integer_Underflow__short_min_sub_18_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE390_Error_Without_Action__fgets_wchar_t_15.c
Label Definition File: CWE390_Error_Without_Action__fgets.label.xml
Template File: point-flaw-15.tmpl.c
*/
/*
* @description
* CWE: 390 Detection of Error Condition Without Action
* Sinks:
* GoodSink: Check if fgetws() failed and handle errors properly
* BadSink : Check to see if fgetws() failed, but do nothing about it
* Flow Variant: 15 Control flow: switch(6)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE390_Error_Without_Action__fgets_wchar_t_15_bad()
{
switch(6)
{
case 6:
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
printWLine(L"Please enter a string: ");
/* FLAW: check the return value, but do nothing if there is an error */
if (fgetws(data, 100, stdin) == NULL)
{
/* do nothing */
}
printWLine(data);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() changes the switch to switch(5) */
static void good1()
{
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
printWLine(L"Please enter a string: ");
/* FIX: check the return value and handle errors properly */
if (fgetws(data, 100, stdin) == NULL)
{
printWLine(L"fgetws failed!");
exit(1);
}
printWLine(data);
}
break;
}
}
/* good2() reverses the blocks in the switch */
static void good2()
{
switch(6)
{
case 6:
{
/* By initializing dataBuffer, we ensure this will not be the
* CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() */
wchar_t dataBuffer[100] = L"";
wchar_t * data = dataBuffer;
printWLine(L"Please enter a string: ");
/* FIX: check the return value and handle errors properly */
if (fgetws(data, 100, stdin) == NULL)
{
printWLine(L"fgetws failed!");
exit(1);
}
printWLine(data);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
void CWE390_Error_Without_Action__fgets_wchar_t_15_good()
{
good1();
good2();
}
#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()...");
CWE390_Error_Without_Action__fgets_wchar_t_15_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE390_Error_Without_Action__fgets_wchar_t_15_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65a.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml
Template File: sources-sink-65a.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sinks: cpy
* BadSink : Copy string to data using wcscpy
* Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65b_badSink(wchar_t * data);
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65_bad()
{
wchar_t * data;
/* define a function pointer */
void (*funcPtr) (wchar_t *) = CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65b_badSink;
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = L'\0'; /* null terminate */
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65b_goodG2BSink(wchar_t * data);
static void goodG2B()
{
wchar_t * data;
void (*funcPtr) (wchar_t *) = CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65b_goodG2BSink;
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
funcPtr(data);
}
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cpy_65_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright NVIDIA Corporation 2002-2014
// 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 NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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
/** @file */
#include <dp/util/Reflection.h>
#include <dp/util/Observer.h>
#include <dp/sg/core/Event.h>
#include <dp/sg/core/CoreTypes.h>
#include <boost/type_traits.hpp>
#include <memory>
namespace dp
{
namespace sg
{
namespace core
{
// serves as base class for 'handled' objects
class HandledObject : public dp::util::Reflection, public std::enable_shared_from_this<HandledObject>
{
public:
virtual ~HandledObject();
virtual HandledObjectSharedPtr clone() const = 0;
template<typename T> dp::util::SharedPtr<T> getSharedPtr() const;
protected:
HandledObject();
HandledObject( const HandledObject & );
HandledObject& operator=(const HandledObject & rhs);
using std::enable_shared_from_this<HandledObject>::shared_from_this; // hide this from using with SharedPtrs
};
inline HandledObject::HandledObject()
{
/* do nothing! */
}
inline HandledObject::HandledObject( const HandledObject &rhs )
: Reflection( rhs )
{
/* do nothing! */
}
inline HandledObject::~HandledObject()
{
}
inline HandledObject& HandledObject::operator=( const HandledObject &rhs )
{
Reflection::operator=( rhs );
return( *this );
}
template <typename T>
inline dp::util::SharedPtr<T> HandledObject::getSharedPtr() const
{
DP_STATIC_ASSERT(( boost::is_base_of<HandledObject,T>::value ));
return( HandledObjectSharedPtr( const_cast<HandledObject*>(this)->shared_from_this() ).staticCast<T>() );
}
//! Detects if the WeakPtr \a p is a WeakPtr to a specified (templated) type.
/** \returns \c true if \a p is a WeakPtr to the specified type, \c false otherwise. */
template<typename T>
inline bool isPtrTo( const HandledObjectWeakPtr & p )
{
return( dynamic_cast<const T*>( p ) != nullptr );
}
}//namespace core
}//namespace sg
}//namespace dp
|
// Copyright (c) 2015 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Jane Tournois
#ifndef CGAL_POLYGON_MESH_PROCESSING_BOUNDING_BOX_H
#define CGAL_POLYGON_MESH_PROCESSING_BOUNDING_BOX_H
#include <CGAL/Bbox_3.h>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
#include <boost/foreach.hpp>
namespace CGAL {
namespace Polygon_mesh_processing {
/*!
* \ingroup PkgPolygonMeshProcessing
* computes a bounding box of a polygon mesh.
*
* @tparam PolygonMesh a model of `HalfedgeListGraph`
* that has an internal property map for `CGAL::vertex_point_t`
* @tparam NamedParameters a sequence of \ref namedparameters
*
* @param pmesh a polygon mesh
* @param np optional sequence of \ref namedparameters among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `pmesh` \cgalParamEnd
* \cgalNamedParamsEnd
*
* @return a bounding box of `pmesh`
*/
template<typename PolygonMesh, typename NamedParameters>
CGAL::Bbox_3 bbox_3(const PolygonMesh& pmesh,
const NamedParameters& np)
{
using boost::choose_const_pmap;
using boost::get_param;
typename GetVertexPointMap<PolygonMesh, NamedParameters>::const_type
vpm = choose_const_pmap(get_param(np, CGAL::vertex_point),
pmesh,
CGAL::vertex_point);
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
halfedge_descriptor h0 = *(halfedges(pmesh).first);
CGAL::Bbox_3 bb = get(vpm, target(h0, pmesh)).bbox();
BOOST_FOREACH(halfedge_descriptor h, halfedges(pmesh))
{
bb += get(vpm, target(h, pmesh)).bbox();
}
return bb;
}
template<typename PolygonMesh>
CGAL::Bbox_3 bbox_3(const PolygonMesh& pmesh)
{
return bbox_3(pmesh,
CGAL::Polygon_mesh_processing::parameters::all_default());
}
}
}
#endif //CGAL_POLYGON_MESH_PROCESSING_BOUNDING_BOX_H
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_INPUT_SCROLL_ELASTICITY_HELPER_H_
#define CC_INPUT_SCROLL_ELASTICITY_HELPER_H_
#include "base/time/time.h"
#include "cc/cc_export.h"
#include "ui/gfx/geometry/scroll_offset.h"
#include "ui/gfx/geometry/vector2d_f.h"
namespace cc {
class LayerTreeHostImpl;
// ScrollElasticityHelper is based on
// WebKit/Source/platform/mac/ScrollElasticityController.h
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*/
// Interface between a LayerTreeHostImpl and the ScrollElasticityController. It
// would be possible, in principle, for LayerTreeHostImpl to implement this
// interface itself. This artificial boundary is introduced to reduce the amount
// of logic and state held directly inside LayerTreeHostImpl.
class CC_EXPORT ScrollElasticityHelper {
public:
static ScrollElasticityHelper* CreateForLayerTreeHostImpl(
LayerTreeHostImpl* host_impl);
virtual ~ScrollElasticityHelper() {}
virtual bool IsUserScrollable() const = 0;
// The amount that the view is stretched past the normal allowable bounds.
virtual gfx::Vector2dF StretchAmount() const = 0;
virtual void SetStretchAmount(const gfx::Vector2dF& stretch_amount) = 0;
// Functions for the scrolling of the root scroll layer.
virtual gfx::ScrollOffset ScrollOffset() const = 0;
virtual gfx::ScrollOffset MaxScrollOffset() const = 0;
virtual void ScrollBy(const gfx::Vector2dF& delta) = 0;
// Requests that another frame happens for the controller to continue ticking
// animations.
virtual void RequestOneBeginFrame() = 0;
};
} // namespace cc
#endif // CC_INPUT_SCROLL_ELASTICITY_HELPER_H_
|
/*
* Copyright (c) 2016, Seraphim Sense Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 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.
*/
#import <UIKit/UIKit.h>
@interface ANSearchResultCell : UITableViewCell
@property (nonatomic, weak) IBOutlet UILabel *nameLabel;
@property (nonatomic, weak) IBOutlet UILabel *idLabel;
@property (nonatomic, weak) IBOutlet UIImageView *braceletView;
@property (nonatomic, weak) IBOutlet UIImageView *activityView;
@property (nonatomic, weak) IBOutlet UIView *borderView;
@end
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_
#define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_
#include <vector>
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace dom_distiller {
// Handler class for DOM Distiller page operations.
class DomDistillerHandler : public content::WebUIMessageHandler {
public:
DomDistillerHandler();
virtual ~DomDistillerHandler();
// content::WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
// Callback for the "requestEntries" message. This synchronously requests the
// list of entries and returns it to the front end.
virtual void HandleRequestEntries(const ListValue* args);
private:
// Factory for the creating refs in callbacks.
base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler);
};
} // namespace dom_distiller
#endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_
|
/*============================================================================
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
Package, Release 3c, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014 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. 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 <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
#include "softfloat.h"
extFloat80_t
softfloat_addMagsExtF80(
uint_fast16_t uiA64,
uint_fast64_t uiA0,
uint_fast16_t uiB64,
uint_fast64_t uiB0,
bool signZ
)
{
int_fast32_t expA;
uint_fast64_t sigA;
int_fast32_t expB;
uint_fast64_t sigB;
int_fast32_t expDiff;
uint_fast16_t uiZ64;
uint_fast64_t uiZ0, sigZ, sigZExtra;
struct exp32_sig64 normExpSig;
int_fast32_t expZ;
struct uint64_extra sig64Extra;
struct uint128 uiZ;
union { struct extFloat80M s; extFloat80_t f; } uZ;
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
expA = expExtF80UI64( uiA64 );
sigA = uiA0;
expB = expExtF80UI64( uiB64 );
sigB = uiB0;
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
expDiff = expA - expB;
if ( ! expDiff ) {
if ( expA == 0x7FFF ) {
if ( (sigA | sigB) & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) {
goto propagateNaN;
}
uiZ64 = uiA64;
uiZ0 = uiA0;
goto uiZ;
}
sigZ = sigA + sigB;
sigZExtra = 0;
if ( ! expA ) {
normExpSig = softfloat_normSubnormalExtF80Sig( sigZ );
expZ = normExpSig.exp + 1;
sigZ = normExpSig.sig;
goto roundAndPack;
}
expZ = expA;
goto shiftRight1;
}
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
if ( expDiff < 0 ) {
if ( expB == 0x7FFF ) {
if ( sigB & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) goto propagateNaN;
uiZ64 = packToExtF80UI64( signZ, 0x7FFF );
uiZ0 = uiB0;
goto uiZ;
}
expZ = expB;
if ( ! expA ) {
++expDiff;
sigZExtra = 0;
if ( ! expDiff ) goto newlyAligned;
}
sig64Extra = softfloat_shiftRightJam64Extra( sigA, 0, -expDiff );
sigA = sig64Extra.v;
sigZExtra = sig64Extra.extra;
} else {
if ( expA == 0x7FFF ) {
if ( sigA & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) goto propagateNaN;
uiZ64 = uiA64;
uiZ0 = uiA0;
goto uiZ;
}
expZ = expA;
if ( ! expB ) {
--expDiff;
sigZExtra = 0;
if ( ! expDiff ) goto newlyAligned;
}
sig64Extra = softfloat_shiftRightJam64Extra( sigB, 0, expDiff );
sigB = sig64Extra.v;
sigZExtra = sig64Extra.extra;
}
newlyAligned:
sigZ = sigA + sigB;
if ( sigZ & UINT64_C( 0x8000000000000000 ) ) goto roundAndPack;
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
shiftRight1:
sig64Extra = softfloat_shortShiftRightJam64Extra( sigZ, sigZExtra, 1 );
sigZ = sig64Extra.v | UINT64_C( 0x8000000000000000 );
sigZExtra = sig64Extra.extra;
++expZ;
roundAndPack:
return
softfloat_roundPackToExtF80(
signZ, expZ, sigZ, sigZExtra, extF80_roundingPrecision );
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
propagateNaN:
uiZ = softfloat_propagateNaNExtF80UI( uiA64, uiA0, uiB64, uiB0 );
uiZ64 = uiZ.v64;
uiZ0 = uiZ.v0;
uiZ:
uZ.s.signExp = uiZ64;
uZ.s.signif = uiZ0;
return uZ.f;
}
|
//
// TwilioAccessManager.h
// TwilioAccessManager
//
// Copyright © 2015 Twilio. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol TwilioAccessManagerDelegate;
/** Shared Access Manager for Twilio clients. Manages sharing an access token as well as notifications upon token expiry.
*/
@interface TwilioAccessManager : NSObject
/** Delegate for token expiry and error notifications. */
@property (nonatomic, weak) id<TwilioAccessManagerDelegate> delegate;
/**
Creates a new Access Manager instance initialized with the specified token.
@param token The client token.
@param delegate Delegate for token expiry and error notifications.
*/
+ (instancetype)accessManagerWithToken:(NSString *)token delegate:(id<TwilioAccessManagerDelegate>)delegate;
/**
Updates the client token for consumers of this Access Manager instance.
@param token The updated client token.
*/
- (void)updateToken:(NSString *)token;
/**
Returns the current client token being used by this Access Manager instance.
@return The current client token.
*/
- (NSString *)token;
/**
Returns the identity associated with the current client token.
@return The current client token's identity.
*/
- (NSString *)identity;
/**
Determines whether the current client token is past its expiration time.
@return BOOL indicting whether the current client token is expired.
*/
- (BOOL)isExpired;
/**
Obtains the expiration date for the current client token.
@return Expiration date for the current client token.
*/
- (NSDate *)expirationDate;
@end
/**
Delegate to be notified events related to client tokens and this Access Manager.
*/
@protocol TwilioAccessManagerDelegate <NSObject>
/**
Called when the associated client token has expired.
@param accessManager The Access Manager whose token has expired.
*/
- (void)accessManagerTokenExpired:(TwilioAccessManager *)accessManager;
/**
Called when the Access Manager encounters an error.
@param accessManager The Access Manager
@param error The error encountered
*/
- (void)accessManager:(TwilioAccessManager *)accessManager error:(NSError *)error;
@end
|
// MESSAGE GPS_LOCAL_ORIGIN_SET PACKING
#define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET 71
typedef struct __mavlink_gps_local_origin_set_t
{
int32_t latitude; ///< Latitude (WGS84), expressed as * 1E7
int32_t longitude; ///< Longitude (WGS84), expressed as * 1E7
int32_t altitude; ///< Altitude(WGS84), expressed as * 1000
} mavlink_gps_local_origin_set_t;
/**
* @brief Pack a gps_local_origin_set message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param latitude Latitude (WGS84), expressed as * 1E7
* @param longitude Longitude (WGS84), expressed as * 1E7
* @param altitude Altitude(WGS84), expressed as * 1000
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_local_origin_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000
return mavlink_finalize_message(msg, system_id, component_id, i);
}
/**
* @brief Pack a gps_local_origin_set message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param latitude Latitude (WGS84), expressed as * 1E7
* @param longitude Longitude (WGS84), expressed as * 1E7
* @param altitude Altitude(WGS84), expressed as * 1000
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_local_origin_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
}
/**
* @brief Encode a gps_local_origin_set struct into a message
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_local_origin_set C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_local_origin_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_local_origin_set_t* gps_local_origin_set)
{
return mavlink_msg_gps_local_origin_set_pack(system_id, component_id, msg, gps_local_origin_set->latitude, gps_local_origin_set->longitude, gps_local_origin_set->altitude);
}
/**
* @brief Send a gps_local_origin_set message
* @param chan MAVLink channel to send the message
*
* @param latitude Latitude (WGS84), expressed as * 1E7
* @param longitude Longitude (WGS84), expressed as * 1E7
* @param altitude Altitude(WGS84), expressed as * 1000
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
{
mavlink_message_t msg;
mavlink_msg_gps_local_origin_set_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, latitude, longitude, altitude);
mavlink_send_uart(chan, &msg);
}
#endif
// MESSAGE GPS_LOCAL_ORIGIN_SET UNPACKING
/**
* @brief Get field latitude from gps_local_origin_set message
*
* @return Latitude (WGS84), expressed as * 1E7
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_latitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload)[0];
r.b[2] = (msg->payload)[1];
r.b[1] = (msg->payload)[2];
r.b[0] = (msg->payload)[3];
return (int32_t)r.i;
}
/**
* @brief Get field longitude from gps_local_origin_set message
*
* @return Longitude (WGS84), expressed as * 1E7
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_longitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(int32_t))[3];
return (int32_t)r.i;
}
/**
* @brief Get field altitude from gps_local_origin_set message
*
* @return Altitude(WGS84), expressed as * 1000
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_altitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[3];
return (int32_t)r.i;
}
/**
* @brief Decode a gps_local_origin_set message into a struct
*
* @param msg The message to decode
* @param gps_local_origin_set C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_local_origin_set_decode(const mavlink_message_t* msg, mavlink_gps_local_origin_set_t* gps_local_origin_set)
{
gps_local_origin_set->latitude = mavlink_msg_gps_local_origin_set_get_latitude(msg);
gps_local_origin_set->longitude = mavlink_msg_gps_local_origin_set_get_longitude(msg);
gps_local_origin_set->altitude = mavlink_msg_gps_local_origin_set_get_altitude(msg);
}
|
//*****************************************************************************
/*!
\file xsi_uitoolkit.h
\brief UIToolkit class declaration.
© Copyright 1998-2002 Avid Technology, Inc. and its licensors. All rights
reserved. This file contains confidential and proprietary information of
Avid Technology, Inc., and is subject to the terms of the SOFTIMAGE|XSI
end user license agreement (or EULA).
*/
//*****************************************************************************
#if (_MSC_VER > 1000) || defined(SGI_COMPILER)
#pragma once
#endif
#ifndef __XSIUITOOLKIT_H__
#define __XSIUITOOLKIT_H__
#include <xsi_base.h>
#include <xsi_value.h>
#include <xsi_status.h>
#pragma warning(disable:4251)
namespace XSI {
class ProgressBar;
//*****************************************************************************
/*! \class UIToolkit xsi_uitoolkit.h
\brief Provides access to XSI user interface tools such as the ProgressBar object and the MsgBox function.
\sa Application::GetUIToolkit
*/
//*****************************************************************************
class SICPPSDKDECL UIToolkit : public CBase
{
public:
/*! Default constructor. */
UIToolkit();
/*! Default destructor. */
~UIToolkit();
/*! Constructor.
\param in_ref constant reference object.
*/
UIToolkit(const CRef& in_ref);
/*! Copy constructor.
\param in_obj constant class object.
*/
UIToolkit(const UIToolkit& in_obj);
/*! Returns true if a given class type is compatible with this API class.
\param in_ClassID class type.
\return true if the class is compatible, false otherwise.
*/
bool IsA( siClassID in_ClassID) const;
/*! Returns the type of the API class.
\return The class type.
*/
siClassID GetClassID() const;
/*! Creates an object from another object. The newly created object is set to empty
if the input object is not compatible.
\param in_obj constant class object.
\return The new UIToolkit object.
*/
UIToolkit& operator=(const UIToolkit& in_obj);
/*! Creates an object from a reference object. The newly created object is
set to empty if the input reference object is not compatible.
\param in_ref constant class object.
\return The new UIToolkit object.
*/
UIToolkit& operator=(const CRef& in_ref);
/*! Returns an instance of a ProgressBar object.
\return Instance of a ProgressBar object.
*/
ProgressBar GetProgressBar() const;
/*! This is identical to the Win32 MessageBox function and provides the ability to pop
up a simple modal message window in %XSI. The application is frozen and the user is
forced to click a button to dismiss the window.
By default only an OK button is displayed, but flags like siMsgAbortRetryIgnore and
siMsgYesNo are supported to change this behavior. By default no icon is displayed, but
flags like siMsgQuestion can be used to help indicate the nature and importance of the
message (see ::siMsgBoxFlags).
This function does not block execution of scripts in batch mode. When %XSI runs in batch
mode the routine returns immediately with the default button as the returned value. By
default the first button is considered the default button, but this can be changed by
specifying the flag siMsgDefaultButton2 or siMsgDefaultButton3.
For further details please refer the Win32 documentation on MessageBox.
\param in_strMsg Message to display on the screen.
\param in_Flags Flags to control the appearance of the dialog (see ::siMsgBoxFlags).
\param in_strCaption Text to show in the title of the Message Box. Often this is used to
describe the source of the message box, for example the name of a plug-in or perhaps
a script filename. By default the standard XSI title is used.
\retval out_result The button pressed as defined in ::siMsgButtonPressed.
\return CStatus::OK success
\return CStatus::Fail failure
*/
CStatus MsgBox( const CString& in_strMsg, LONG in_Flags,
const CString& in_strCaption, LONG& out_result );
private:
UIToolkit * operator&() const;
UIToolkit * operator&();
};
};
#endif // __XSIUITOOLKIT_H__
|
//
// PTDeveloperManager.h
// PT
//
// Created by gengych on 16/4/12.
// Copyright © 2016年 中信网络科技. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* @ingroup frameworkHelpModuleModuleEnum
* HTML模版来源路径枚举 <br/>
* <table>
* <tr>
* <td>PTHTML_DataZip</td>
* <td>HTML模版来自 data.zip</td>
* </tr>
* <tr>
* <td>PTHTML_WWW</td>
* <td>HTML模版来自 ios平台内部的 www 目录</td>
* </tr>
* </table>
*/
typedef enum : NSUInteger {
PTHTML_DataZip = 1, //!< HTML模版来自 data.zip.
PTHTML_WWW = 2, //!< HTML模版来自 ios平台内部的 www 目录.
} PTHTML_SourceType;
/**
* @ingroup frameworkHelpModuleClass
* @brief 对框架存在的所有 开发方式 进行统一管理;例如:文件验签、开发模式 等模式
*/
@interface PTDeveloperManager : NSObject
/**
* 以懒惰方式实现的单例模式
* @return 返回PTDeveloperManager对象
*/
+ (id)getInstance;
/**
* 初始化 开发配置 信息
*/
- (void)initialization;
/**
* 是否支持本地网络
* @return
* <table>
* <tr>
* <td>
* YES
* </td>
* <td>
* 使用本地网络环境
* </td>
* </tr>
* <tr>
* <td>
* NO
* </td>
* <td>
* 使用真实的网络环境
* </td>
* </tr>
* </table>
*/
- (BOOL)DEV_LOCAL_NETWORK;
/**
* 是否从Settings.bundle中读取服务器地址
* @return
* <table>
* <tr>
* <td>
* YES
* </td>
* <td>
* 从Settings.bundle中读取服务器地址
* </td>
* </tr>
* <tr>
* <td>
* NO
* </td>
* <td>
* 使用生产的服务器地址
* </td>
* </tr>
* </table>
*/
- (BOOL)DEV_SERVER_URL_FROM_SETTINGS;
/**
* 打开 模板文件校验
*/
- (BOOL)DEV_OPEN_TEMPLATE_CHECK;
/**
* 打开 握手成功后 资源文件更新
*/
- (BOOL)DEV_OPEN_RESOURCE_UPDATE;
/**
* 使用HTML类型 data.zip|www目录|远程主机www目录
* @return html类型
*/
- (PTHTML_SourceType)getHTMLSourceType;
@end
|
//---------------------------------------------------------------------------
// csved_stat.h
//
// produce record/field stats for CSV files
//
// Copyright (C) 2012 Neil Butterworth
//---------------------------------------------------------------------------
#ifndef INC_CSVED_STAT_H
#define INC_CSVED_STAT_H
#include "a_base.h"
#include "csved_command.h"
namespace CSVED {
class StatCommand : public Command {
public:
StatCommand( const std::string & name,
const std::string & desc );
int Execute( ALib::CommandLine & cmd );
private:
void OutputStats( IOManager & io, const std::string & fname,
int lines, int maxf, int minf );
};
}
#endif
|
/**
websocketopcode.h
Websocket protocol opcodes featuring websocket frame types
see https://tools.ietf.org/html/rfc6455
@author Bertrand Martel
@version 1.0
*/
#ifndef WEBSOCKETOPCODE_H
#define WEBSOCKETOPCODE_H
/** continuation frame type */
#define CONTINUATION_FRAME 0
/** text frame type */
#define TEXT_FRAME 1
/** binary frame type */
#define BINARY_FRAME 2
/** connection close frame type */
#define CONNECTION_CLOSE_FRAME 8
/** ping frame type */
#define PING_FRAME 9
/** pong frame type */
#define PONG_FRAME 10
/** non control frame type (frame value is fictive => between 0x03 and 0x07) */
#define NON_CONTROL_FRAME 0
/** control frames type (frame value is fictive => between 0x0B and 0x0F */
#define CONTROL_FRAME 0
#endif // WEBSOCKETOPCODE_H
|
////////////////////////////////////////////////////////////////////////////////
// Copyright AllSeen Alliance. All rights reserved.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <alljoyn/Status.h>
#import "AJNSecurityCredentials.h"
#import "AJNMessage.h"
/**
* Protocol to allow authentication mechanisms to interact with the application
*/
@protocol AJNAuthenticationListener <NSObject>
@required
/**
* Authentication mechanism requests user credentials. If the user name is not an empty string
* the request is for credentials for that specific user. A count allows the listener to decide
* whether to allow or reject multiple authentication attempts to the same peer.
*
* @param authenticationMechanism The name of the authentication mechanism issuing the request.
* @param peerName The name of the remote peer being authenticated. On the initiating side this will be a well-known-name for the remote peer. On the accepting side this will be the unique bus name for the remote peer.
* @param authenticationCount Count (starting at 1) of the number of authentication request attempts made.
* @param userName The user name for the credentials being requested.
* @param mask A bit mask identifying the credentials being requested. The application may return none, some or all of the requested credentials.
*
* @return The credentials returned. The caller should return nil if the request is being rejected. If the request is rejected the authentication is complete.
*/
- (AJNSecurityCredentials *)requestSecurityCredentialsWithAuthenticationMechanism:(NSString *)authenticationMechanism peerName:(NSString *)peerName authenticationCount:(uint16_t)authenticationCount userName:(NSString *)userName credentialTypeMask:(AJNSecurityCredentialType)mask;
/**
* Reports successful or unsuccessful completion of authentication.
*
* @param authenticationMechanism The name of the authentication mechanism that was used or an empty string if the authentication failed.
* @param peerName The name of the remote peer being authenticated. On the initiating side this will be a well-known-name for the remote peer. On the accepting side this will be the unique bus name for the remote peer.
* @param success true if the authentication was successful, otherwise false.
*/
- (void)authenticationUsing:(NSString *)authenticationMechanism forRemotePeer:(NSString *)peerName didCompleteWithStatus:(BOOL)success;
@optional
/**
* Authentication mechanism requests verification of credentials from a remote peer.
*
* @param authenticationMechanism The name of the authentication mechanism issuing the request.
* @param peerName The name of the remote peer being authenticated. On the initiating side this will be a well-known-name for the remote peer. On the accepting side this will be the unique bus name for the remote peer.
* @param credentials The credentials to be verified.
*
* @return The listener should return true if the credentials are acceptable or false if the
* credentials are being rejected.
*/
- (BOOL)verifySecurityCredentials:(AJNSecurityCredentials *)credentials usingAuthenticationMechanism:(NSString *)authenticationMechanism forRemotePeer:(NSString *)peerName;
/**
* Optional method that if implemented allows an application to monitor security violations. This
* function is called when an attempt to decrypt an encrypted messages failed or when an unencrypted
* message was received on an interface that requires encryption. The message contains only
* header information.
*
* @param errorCode A status code indicating the type of security violation.
* @param message The message that cause the security violation.
*/
- (void)securityViolationOccurredWithErrorCode:(QStatus)errorCode forMessage:(AJNMessage *)message;
@end
|
// projection.h
/* Copyright 2009 10gen Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "pch.h"
#include "jsobj.h"
namespace mongo {
/**
* given a document and a projection specification
* can transform the document
* currently supports specifying which fields and $slice
*/
class Projection {
public:
class KeyOnly {
public:
KeyOnly() : _stringSize(0) {}
BSONObj hydrate( const BSONObj& key ) const;
void addNo() { _add( false , "" ); }
void addYes( const string& name ) { _add( true , name ); }
private:
void _add( bool b , const string& name ) {
_include.push_back( b );
_names.push_back( name );
_stringSize += name.size();
}
vector<bool> _include; // one entry per field in key. true iff should be in output
vector<string> _names; // name of field since key doesn't have names
int _stringSize;
};
Projection() :
_include(true) ,
_special(false) ,
_includeID(true) ,
_skip(0) ,
_limit(-1) ,
_hasNonSimple(false) {
}
/**
* called once per lifetime
* e.g. { "x" : 1 , "a.y" : 1 }
*/
void init( const BSONObj& spec );
/**
* @return the spec init was called with
*/
BSONObj getSpec() const { return _source; }
/**
* transforms in according to spec
*/
BSONObj transform( const BSONObj& in ) const;
/**
* transforms in according to spec
*/
void transform( const BSONObj& in , BSONObjBuilder& b ) const;
/**
* @return if the keyPattern has all the information needed to return then
* return a new KeyOnly otherwise null
* NOTE: a key may have modified the actual data
* which has to be handled above this (arrays, geo)
*/
KeyOnly* checkKey( const BSONObj& keyPattern ) const;
private:
/**
* appends e to b if user wants it
* will descend into e if needed
*/
void append( BSONObjBuilder& b , const BSONElement& e ) const;
void add( const string& field, bool include );
void add( const string& field, int skip, int limit );
void appendArray( BSONObjBuilder& b , const BSONObj& a , bool nested=false) const;
bool _include; // true if default at this level is to include
bool _special; // true if this level can't be skipped or included without recursing
//TODO: benchmark vector<pair> vs map
typedef map<string, boost::shared_ptr<Projection> > FieldMap;
FieldMap _fields;
BSONObj _source;
bool _includeID;
// used for $slice operator
int _skip;
int _limit;
bool _hasNonSimple;
};
}
|
// The MIT License (MIT)
//
// Copyright (c) 2014 Jens Meder
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <AudioToolbox/AudioToolbox.h>
@interface JMAudioStream : NSObject
{
@protected
AudioQueueRef _queueObject;
AudioStreamBasicDescription _audioFormat;
}
@property (NS_NONATOMIC_IOSONLY, getter=isRunning, readonly) BOOL running;
-(instancetype)initWithAudioFormat:(AudioStreamBasicDescription)format;
@end
|
// Copyright (C) 2011-2012 by Tapjoy Inc.
//
// This file is part of the Tapjoy SDK.
//
// By using the Tapjoy SDK in your software, you agree to the terms of the Tapjoy SDK License Agreement.
//
// The Tapjoy SDK is bound by the Tapjoy SDK License Agreement and can be found here: https://www.tapjoy.com/sdk/license
/*! \enum TJCResponseError
* \brief Tapjoy Connect response error codes.
*/
typedef enum TJCResponseError
{
kTJCInternetFailure = 0,
kTJCStatusNotOK = 1,
kTJCRequestTimeOut = 2
} TJCResponseError;
/*! \protocol TJCFetchResponseDelegate
* \brief The Tapjoy fetch response protocol.
*/
@protocol TJCFetchResponseDelegate <NSObject>
@required
/*! \fn fetchResponseSuccessWithData:withRequestTag:(void* dict, int aTag)
* \brief Called when a request succeeds.
*
* \param dataObj
* \param aTag
* \return n/a
*/
-(void)fetchResponseSuccessWithData:(void*)dataObj withRequestTag:(int)aTag;
/*! \fn fetchResponseError:errorDescription:requestTag:(TJCResponseError errorType, id errorDescObj, int aTag)
* \brief Called when an error occurs.
*
* \param errorType
* \param errorDescObj
* \param aTag
* \return n/a
*/
-(void)fetchResponseError:(TJCResponseError)errorType errorDescription:(id)errorDescObj requestTag:(int) aTag;
@end
|
#warning This header is deprecated, #import <UI…+PromiseKit.h> instead.
#import <UIActionSheet+PromiseKit.h>
#import <UIAlertView+PromiseKit.h>
#import <UIViewController+PromiseKit.h>
|
//
// Created by lionell on 4/4/15.
//
#ifndef LAB_2_TESTLIB_H
#define LAB_2_TESTLIB_H
#include <vector>
#include <iostream>
#include "Train.h"
class BasicTest {
public:
BasicTest() {}
virtual void initialize() {}
virtual void describe() {}
virtual bool run() = 0;
virtual void finalize() {}
virtual ~BasicTest() {}
};
class Tester {
private:
std::vector<BasicTest*> tests;
public:
Tester() {}
void add(BasicTest* test);
void run_all_tests();
};
#endif //LAB_2_TESTLIB_H
|
#ifndef _WLC_SHELL_SURFACE_H_
#define _WLC_SHELL_SURFACE_H_
#include <wayland-server-protocol.h>
const struct wl_shell_surface_interface wl_shell_surface_implementation;
#endif /* _WLC_SHELL_SURFACE_H_ */
|
/* Copyright (c) 2012-2014, The Linux 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:
* * 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 Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _PLATFORM_MSM_SHARED_MSM_PANEL_H_
#define _PLATFORM_MSM_SHARED_MSM_PANEL_H_
#include <stdint.h>
#include <dev/fbcon.h>
#define TRUE 1
#define FALSE 0
/* panel type list */
#define NO_PANEL 0xffff /* No Panel */
#define MDDI_PANEL 1 /* MDDI */
#define EBI2_PANEL 2 /* EBI2 */
#define LCDC_PANEL 3 /* internal LCDC type */
#define EXT_MDDI_PANEL 4 /* Ext.MDDI */
#define TV_PANEL 5 /* TV */
#define HDMI_PANEL 6 /* HDMI TV */
#define DTV_PANEL 7 /* DTV */
#define MIPI_VIDEO_PANEL 8 /* MIPI */
#define MIPI_CMD_PANEL 9 /* MIPI */
#define WRITEBACK_PANEL 10 /* Wifi display */
#define LVDS_PANEL 11 /* LVDS */
#define EDP_PANEL 12 /* EDP */
enum mdss_mdp_pipe_type {
MDSS_MDP_PIPE_TYPE_VIG,
MDSS_MDP_PIPE_TYPE_RGB,
MDSS_MDP_PIPE_TYPE_DMA,
};
enum msm_mdp_hw_revision {
MDP_REV_20 = 1,
MDP_REV_22,
MDP_REV_30,
MDP_REV_303,
MDP_REV_304,
MDP_REV_31,
MDP_REV_40,
MDP_REV_41,
MDP_REV_42,
MDP_REV_43,
MDP_REV_44,
MDP_REV_50,
};
/* panel info type */
struct lcd_panel_info {
uint32_t vsync_enable;
uint32_t refx100;
uint32_t v_back_porch;
uint32_t v_front_porch;
uint32_t v_pulse_width;
uint32_t hw_vsync_mode;
uint32_t vsync_notifier_period;
uint32_t rev;
};
struct hdmi_panel_info {
uint32_t h_back_porch;
uint32_t h_front_porch;
uint32_t h_pulse_width;
uint32_t v_back_porch;
uint32_t v_front_porch;
uint32_t v_pulse_width;
};
struct lcdc_panel_info {
uint32_t h_back_porch;
uint32_t h_front_porch;
uint32_t h_pulse_width;
uint32_t v_back_porch;
uint32_t v_front_porch;
uint32_t v_pulse_width;
uint32_t border_clr;
uint32_t underflow_clr;
uint32_t hsync_skew;
/* Pad width */
uint32_t xres_pad;
/* Pad height */
uint32_t yres_pad;
uint8_t dual_pipe;
uint8_t split_display;
uint8_t pipe_swap;
uint8_t dst_split;
};
struct mipi_panel_info {
char mode; /* video/cmd */
char interleave_mode;
int eof_bllp_power;
uint32_t bitclock;
char crc_check;
char ecc_check;
char dst_format; /* shared by video and command */
char num_of_lanes;
char data_lane0;
char data_lane1;
char data_lane2;
char data_lane3;
char dlane_swap; /* data lane swap */
char rgb_swap;
char b_sel;
char g_sel;
char r_sel;
char rx_eot_ignore;
char tx_eot_append;
char t_clk_post; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
char t_clk_pre; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
char vc; /* virtual channel */
struct mipi_dsi_phy_ctrl *dsi_phy_db;
struct mdss_dsi_phy_ctrl *mdss_dsi_phy_db;
struct mdss_dsi_pll_config *dsi_pll_config;
struct mipi_dsi_cmd *panel_cmds;
int num_of_panel_cmds;
/* video mode */
char pulse_mode_hsa_he;
char hfp_power_stop;
char hbp_power_stop;
char hsa_power_stop;
char eof_bllp_power_stop;
char bllp_power_stop;
char traffic_mode;
char frame_rate;
/* command mode */
char interleave_max;
char insert_dcs_cmd;
char wr_mem_continue;
char wr_mem_start;
char te_sel;
char stream; /* 0 or 1 */
char mdp_trigger;
char dma_trigger;
uint32_t dsi_pclk_rate;
/* The packet-size should not bet changed */
char no_max_pkt_size;
/* Clock required during LP commands */
char force_clk_lane_hs;
char lane_swap;
uint8_t dual_dsi;
uint8_t broadcast;
uint8_t mode_gpio_state;
uint32_t signature;
uint32_t use_enable_gpio;
};
struct edp_panel_info {
int max_lane_count;
unsigned long max_link_clk;
};
enum lvds_mode {
LVDS_SINGLE_CHANNEL_MODE,
LVDS_DUAL_CHANNEL_MODE,
};
struct lvds_panel_info {
enum lvds_mode channel_mode;
/* Channel swap in dual mode */
char channel_swap;
};
struct msm_panel_info {
uint32_t xres;
uint32_t yres;
uint32_t bpp;
uint32_t type;
uint32_t wait_cycle;
uint32_t clk_rate;
uint32_t orientation;
/* Select pipe type for handoff */
uint32_t pipe_type;
char lowpowerstop;
struct lcd_panel_info lcd;
struct lcdc_panel_info lcdc;
struct mipi_panel_info mipi;
struct lvds_panel_info lvds;
struct hdmi_panel_info hdmi;
struct edp_panel_info edp;
int (*on) (void);
int (*off) (void);
int (*pre_on) (void);
int (*pre_off) (void);
int (*prepare) (void);
int (*early_config) (void *pdata);
int (*config) (void *pdata);
int (*rotate) (void);
};
struct msm_fb_panel_data {
struct msm_panel_info panel_info;
struct fbcon_config fb;
int mdp_rev;
int rotate;
/* function entry chain */
int (*power_func) (int enable);
int (*clk_func) (int enable);
int (*bl_func) (int enable);
int (*pll_clk_func) (int enable, struct msm_panel_info *);
int (*post_power_func)(int enable);
int (*pre_init_func)(void);
};
#endif
|
/* Copyright (c) 2011-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "unichar.h"
#include "message-parser.h"
#include "fts-parser.h"
static const struct fts_parser_vfuncs *parsers[] = {
&fts_parser_html,
&fts_parser_script,
&fts_parser_tika
};
static const char *plaintext_content_types[] = {
"text/plain",
"message/delivery-status",
"message/disposition-notification",
"application/pgp-signature"
};
bool fts_parser_init(struct mail_user *user,
const char *content_type, const char *content_disposition,
struct fts_parser **parser_r)
{
unsigned int i;
if (str_array_find(plaintext_content_types, content_type)) {
/* we probably don't want/need to allow parsers to handle
plaintext? */
return FALSE;
}
for (i = 0; i < N_ELEMENTS(parsers); i++) {
*parser_r = parsers[i]->try_init(user, content_type,
content_disposition);
if (*parser_r != NULL)
return TRUE;
}
return FALSE;
}
struct fts_parser *fts_parser_text_init(void)
{
return i_new(struct fts_parser, 1);
}
static bool data_has_nuls(const unsigned char *data, size_t size)
{
size_t i;
for (i = 0; i < size; i++) {
if (data[i] == '\0')
return TRUE;
}
return FALSE;
}
static void replace_nul_bytes(buffer_t *buf)
{
unsigned char *data;
size_t i, size;
data = buffer_get_modifiable_data(buf, &size);
for (i = 0; i < size; i++) {
if (data[i] == '\0')
data[i] = ' ';
}
}
void fts_parser_more(struct fts_parser *parser, struct message_block *block)
{
if (parser->v.more != NULL)
parser->v.more(parser, block);
if (!uni_utf8_data_is_valid(block->data, block->size) ||
data_has_nuls(block->data, block->size)) {
/* output isn't valid UTF-8. make it. */
if (parser->utf8_output == NULL) {
parser->utf8_output =
buffer_create_dynamic(default_pool, 4096);
} else {
buffer_set_used_size(parser->utf8_output, 0);
}
(void)uni_utf8_get_valid_data(block->data, block->size,
parser->utf8_output);
replace_nul_bytes(parser->utf8_output);
block->data = parser->utf8_output->data;
block->size = parser->utf8_output->used;
}
}
int fts_parser_deinit(struct fts_parser **_parser)
{
struct fts_parser *parser = *_parser;
int ret = 0;
*_parser = NULL;
if (parser->utf8_output != NULL)
buffer_free(&parser->utf8_output);
if (parser->v.deinit != NULL)
ret = parser->v.deinit(parser);
else
i_free(parser);
return ret;
}
void fts_parsers_unload(void)
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(parsers); i++) {
if (parsers[i]->unload != NULL)
parsers[i]->unload();
}
}
|
30 atime=1386491102.681026353
30 ctime=1384254877.871227088
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <device/device.h>
#include <device/pnp.h>
#include <superio/conf_mode.h>
#include <superio/hwm5_conf.h>
#include <console/console.h>
#include <pc80/keyboard.h>
#include <option.h>
#include "w83627hf.h"
static void enable_hwm_smbus(struct device *dev)
{
u8 reg8;
/* Configure pins 91/92 as SDA/SCL (I2C bus). */
reg8 = pnp_read_config(dev, 0x2b);
reg8 &= 0x3f;
pnp_write_config(dev, 0x2b, reg8);
}
static void init_acpi(struct device *dev)
{
u8 value;
unsigned int power_on = get_uint_option("power_on_after_fail", 1);
pnp_enter_conf_mode(dev);
pnp_set_logical_device(dev);
value = pnp_read_config(dev, 0xE4);
value &= ~(3 << 5);
if (power_on)
value |= (1 << 5);
pnp_write_config(dev, 0xE4, value);
pnp_exit_conf_mode(dev);
}
static void init_hwm(u16 base)
{
u8 reg, value;
int i;
u8 hwm_reg_values[] = {
/* reg mask data */
0x40, 0xff, 0x81, /* Start HWM. */
0x48, 0xaa, 0x2a, /* Set SMBus base to 0x2a (0x54 >> 1). */
0x4a, 0x21, 0x21, /* Set T2 SMBus base to 0x92>>1 and T3 SMBus base to 0x94>>1. */
0x4e, 0x80, 0x00,
0x43, 0x00, 0xff,
0x44, 0x00, 0x3f,
0x4c, 0xbf, 0x18,
0x4d, 0xff, 0x80, /* Turn off beep */
};
for (i = 0; i < ARRAY_SIZE(hwm_reg_values); i += 3) {
reg = hwm_reg_values[i];
value = pnp_read_hwm5_index(base, reg);
value &= 0xff & hwm_reg_values[i + 1];
value |= 0xff & hwm_reg_values[i + 2];
printk(BIOS_DEBUG, "base = 0x%04x, reg = 0x%02x, "
"value = 0x%02x\n", base, reg, value);
pnp_write_hwm5_index(base, reg, value);
}
}
static void w83627hf_init(struct device *dev)
{
struct resource *res0;
if (!dev->enabled)
return;
switch (dev->path.pnp.device) {
case W83627HF_KBC:
pc_keyboard_init(NO_AUX_DEVICE);
break;
case W83627HF_HWM:
res0 = find_resource(dev, PNP_IDX_IO0);
init_hwm(res0->base);
break;
case W83627HF_ACPI:
init_acpi(dev);
break;
}
}
static void w83627hf_pnp_enable_resources(struct device *dev)
{
pnp_enable_resources(dev);
pnp_enter_conf_mode(dev);
switch (dev->path.pnp.device) {
case W83627HF_HWM:
printk(BIOS_DEBUG, "W83627HF HWM SMBus enabled\n");
enable_hwm_smbus(dev);
break;
}
pnp_exit_conf_mode(dev);
}
static struct device_operations ops = {
.read_resources = pnp_read_resources,
.set_resources = pnp_set_resources,
.enable_resources = w83627hf_pnp_enable_resources,
.enable = pnp_alt_enable,
.init = w83627hf_init,
.ops_pnp_mode = &pnp_conf_mode_8787_aa,
};
static struct pnp_info pnp_dev_info[] = {
{ NULL, W83627HF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
{ NULL, W83627HF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
{ NULL, W83627HF_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
{ NULL, W83627HF_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
{ NULL, W83627HF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
0x07ff, 0x07ff, },
{ NULL, W83627HF_CIR, PNP_IO0 | PNP_IRQ0, 0x07f8, },
{ NULL, W83627HF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
0x07ff, 0x07fe, },
{ NULL, W83627HF_GPIO2, },
{ NULL, W83627HF_GPIO3, },
{ NULL, W83627HF_ACPI, },
{ NULL, W83627HF_HWM, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
};
static void enable_dev(struct device *dev)
{
pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_winbond_w83627hf_ops = {
CHIP_NAME("Winbond W83627HF Super I/O")
.enable_dev = enable_dev,
};
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
Copyright 2012 Michael Olbrich
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
typedef enum EmergencyAction {
EMERGENCY_ACTION_NONE,
EMERGENCY_ACTION_REBOOT,
EMERGENCY_ACTION_REBOOT_FORCE,
EMERGENCY_ACTION_REBOOT_IMMEDIATE,
EMERGENCY_ACTION_POWEROFF,
EMERGENCY_ACTION_POWEROFF_FORCE,
EMERGENCY_ACTION_POWEROFF_IMMEDIATE,
_EMERGENCY_ACTION_MAX,
_EMERGENCY_ACTION_INVALID = -1
} EmergencyAction;
#include "macro.h"
#include "manager.h"
int emergency_action(Manager *m, EmergencyAction action, const char *reboot_arg, const char *reason);
const char* emergency_action_to_string(EmergencyAction i) _const_;
EmergencyAction emergency_action_from_string(const char *s) _pure_;
|
/*****************************************************************************
Copyright(c) 2012 FCI Inc. All Rights Reserved
File name : fc8150_spi.c
Description : API of 1-SEG baseband module
*******************************************************************************/
#ifndef __FC8150_SPI__
#define __FC8150_SPI__
#ifdef __cplusplus
extern "C" {
#endif
extern int fc8150_spi_init(HANDLE hDevice, u16 param1, u16 param2);
extern int fc8150_spi_byteread(HANDLE hDevice, u16 addr, u8 *data);
extern int fc8150_spi_wordread(HANDLE hDevice, u16 addr, u16 *data);
extern int fc8150_spi_longread(HANDLE hDevice, u16 addr, u32 *data);
extern int fc8150_spi_bulkread(HANDLE hDevice, u16 addr, u8 *data, u16 length);
extern int fc8150_spi_bytewrite(HANDLE hDevice, u16 addr, u8 data);
extern int fc8150_spi_wordwrite(HANDLE hDevice, u16 addr, u16 data);
extern int fc8150_spi_longwrite(HANDLE hDevice, u16 addr, u32 data);
extern int fc8150_spi_bulkwrite(HANDLE hDevice, u16 addr, u8* data, u16 length);
extern int fc8150_spi_dataread(HANDLE hDevice, u16 addr, u8* data, u32 length);
extern int fc8150_spi_deinit(HANDLE hDevice);
#ifdef __cplusplus
}
#endif
#endif //
|
#ifndef _X86_DEBUGREG_H
#define _X86_DEBUGREG_H
/* Indicate the register numbers for a number of the specific
debug registers. Registers 0-3 contain the addresses we wish to trap on */
#define DR_FIRSTADDR 0
#define DR_LASTADDR 3
#define DR_STATUS 6
#define DR_CONTROL 7
/* Define a few things for the status register. We can use this to determine
which debugging register was responsible for the trap. The other bits
are either reserved or not of interest to us. */
#define DR_TRAP0 (0x1) /* db0 */
#define DR_TRAP1 (0x2) /* db1 */
#define DR_TRAP2 (0x4) /* db2 */
#define DR_TRAP3 (0x8) /* db3 */
#define DR_STEP (0x4000) /* single-step */
#define DR_SWITCH (0x8000) /* task switch */
/* Now define a bunch of things for manipulating the control register.
The top two bytes of the control register consist of 4 fields of 4
bits - each field corresponds to one of the four debug registers,
and indicates what types of access we trap on, and how large the data
field is that we are looking at */
#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */
#define DR_CONTROL_SIZE 4 /* 4 control bits per register */
#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */
#define DR_RW_WRITE (0x1)
#define DR_IO (0x2)
#define DR_RW_READ (0x3)
#define DR_LEN_1 (0x0) /* Settings for data length to trap on */
#define DR_LEN_2 (0x4)
#define DR_LEN_4 (0xC)
#define DR_LEN_8 (0x8)
/* The low byte to the control register determine which registers are
enabled. There are 4 fields of two bits. One bit is "local", meaning
that the processor will reset the bit after a task switch and the other
is global meaning that we have to explicitly reset the bit. */
#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */
#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */
#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */
#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */
#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */
#define DR7_ACTIVE_MASK (DR_LOCAL_ENABLE_MASK|DR_GLOBAL_ENABLE_MASK)
/* The second byte to the control register has a few special things.
We can slow the instruction pipeline for instructions coming via the
gdt or the ldt if we want to. I am not sure why this is an advantage */
#define DR_CONTROL_RESERVED_ZERO (~0xffff27fful) /* Reserved, read as zero */
#define DR_CONTROL_RESERVED_ONE (0x00000400ul) /* Reserved, read as one */
#define DR_LOCAL_EXACT_ENABLE (0x00000100ul) /* Local exact enable */
#define DR_GLOBAL_EXACT_ENABLE (0x00000200ul) /* Global exact enable */
#define DR_GENERAL_DETECT (0x00002000ul) /* General detect enable */
#define write_debugreg(reg, val) do { \
unsigned long __val = val; \
asm volatile ( "mov %0,%%db" #reg : : "r" (__val) ); \
} while (0)
#define read_debugreg(reg) ({ \
unsigned long __val; \
asm volatile ( "mov %%db" #reg ",%0" : "=r" (__val) ); \
__val; \
})
long set_debugreg(struct vcpu *, unsigned int reg, unsigned long value);
void activate_debugregs(const struct vcpu *);
#endif /* _X86_DEBUGREG_H */
|
/**
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef WIN32
#ifndef _WIN32_SERVICE_
#define _WIN32_SERVICE_
bool WinServiceInstall();
bool WinServiceUninstall();
bool WinServiceRun();
#endif // _WIN32_SERVICE_
#endif // WIN32
|
/* Backport some stuff if needed.
*/
#if KERNEL_VERSION(3, 14, 0) > LINUX_VERSION_CODE
static inline u32 reciprocal_scale(u32 val, u32 ep_ro)
{
return (u32)(((u64) val * ep_ro) >> 32);
}
#endif
#if KERNEL_VERSION(3, 17, 0) > LINUX_VERSION_CODE
#define ktime_get_ns() ktime_to_ns(ktime_get())
#endif
#if KERNEL_VERSION(3, 18, 0) > LINUX_VERSION_CODE
static inline void qdisc_qstats_backlog_dec(struct Qdisc *sch,
const struct sk_buff *skb)
{
sch->qstats.backlog -= qdisc_pkt_len(skb);
}
static inline void qdisc_qstats_backlog_inc(struct Qdisc *sch,
const struct sk_buff *skb)
{
sch->qstats.backlog += qdisc_pkt_len(skb);
}
static inline void __qdisc_qstats_drop(struct Qdisc *sch, int count)
{
sch->qstats.drops += count;
}
static inline void qdisc_qstats_drop(struct Qdisc *sch)
{
sch->qstats.drops++;
}
#define codel_stats_copy_queue(a, b, c, d) gnet_stats_copy_queue(a, c)
#define codel_watchdog_schedule_ns(a, b, c) qdisc_watchdog_schedule_ns(a, b)
#endif
|
#ifndef _LINUX_PRCTL_H
#define _LINUX_PRCTL_H
/* Values to pass as first argument to prctl() */
#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */
#define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
/* Get/set current->mm->dumpable */
#define PR_GET_DUMPABLE 3
#define PR_SET_DUMPABLE 4
/* Get/set unaligned access control bits (if meaningful) */
#define PR_GET_UNALIGN 5
#define PR_SET_UNALIGN 6
# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
/* Get/set whether or not to drop capabilities on setuid() away from
* uid 0 (as per security/commoncap.c) */
#define PR_GET_KEEPCAPS 7
#define PR_SET_KEEPCAPS 8
/* Get/set floating-point emulation control bits (if meaningful) */
#define PR_GET_FPEMU 9
#define PR_SET_FPEMU 10
# define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */
# define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */
/* Get/set floating-point exception mode (if meaningful) */
#define PR_GET_FPEXC 11
#define PR_SET_FPEXC 12
# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */
# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */
# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */
# define PR_FP_EXC_UND 0x040000 /* floating point underflow */
# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */
# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */
# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */
# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */
# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
# define PR_FP_EXC_PRECISE 3 /* precise exception mode */
/* Get/set whether we use statistical process timing or accurate timestamp
* based process timing */
#define PR_GET_TIMING 13
#define PR_SET_TIMING 14
# define PR_TIMING_STATISTICAL 0 /* Normal, traditional,
statistical process timing */
# define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based
process timing */
#define PR_SET_NAME 15 /* Set process name */
#define PR_GET_NAME 16 /* Get process name */
/* Get/set process endian */
#define PR_GET_ENDIAN 19
#define PR_SET_ENDIAN 20
# define PR_ENDIAN_BIG 0
# define PR_ENDIAN_LITTLE 1 /* True little endian mode */
# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
/* Get/set process seccomp mode */
#define PR_GET_SECCOMP 21
#define PR_SET_SECCOMP 22
/* Get/set the capability bounding set (as per security/commoncap.c) */
#define PR_CAPBSET_READ 23
#define PR_CAPBSET_DROP 24
/* Get/set the process' ability to use the timestamp counter instruction */
#define PR_GET_TSC 25
#define PR_SET_TSC 26
# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
/* Get/set securebits (as per security/commoncap.c) */
#define PR_GET_SECUREBITS 27
#define PR_SET_SECUREBITS 28
/*
* Get/set the timerslack as used by poll/select/nanosleep
* A value of 0 means "use default"
*/
#define PR_SET_TIMERSLACK 29
#define PR_GET_TIMERSLACK 30
#define PR_TASK_PERF_EVENTS_DISABLE 31
#define PR_TASK_PERF_EVENTS_ENABLE 32
/*
* Set early/late kill mode for hwpoison memory corruption.
* This influences when the process gets killed on a memory corruption.
*/
#define PR_MCE_KILL 33
# define PR_MCE_KILL_CLEAR 0
# define PR_MCE_KILL_SET 1
# define PR_MCE_KILL_LATE 0
# define PR_MCE_KILL_EARLY 1
# define PR_MCE_KILL_DEFAULT 2
#define PR_MCE_KILL_GET 34
/*
* Tune up process memory map specifics.
*/
#define PR_SET_MM 35
# define PR_SET_MM_START_CODE 1
# define PR_SET_MM_END_CODE 2
# define PR_SET_MM_START_DATA 3
# define PR_SET_MM_END_DATA 4
# define PR_SET_MM_START_STACK 5
# define PR_SET_MM_START_BRK 6
# define PR_SET_MM_BRK 7
/*
* Set specific pid that is allowed to ptrace the current task.
* A value of 0 mean "no process".
*/
#define PR_SET_PTRACER 0x59616d61
# define PR_SET_PTRACER_ANY ((unsigned long)-1)
#define PR_SET_CHILD_SUBREAPER 36
#define PR_GET_CHILD_SUBREAPER 37
/* Sets the timerslack for arbitrary threads
* arg2 slack value, 0 means "use default"
* arg3 pid of the thread whose timer slack needs to be set
*/
//#define PR_SET_TIMERSLACK_PID 41
#define PR_SET_VMA 0x53564d41
# define PR_SET_VMA_ANON_NAME 0
#endif /* _LINUX_PRCTL_H */
|
/*********************************************************************
This is a library for our Monochrome OLEDs based on SSD1306 drivers
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/category/63_98
These displays use SPI to communicate, 4 or 5 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above, and the splash screen must be included in any redistribution
*********************************************************************/
#if ARDUINO >= 100
#include "Arduino.h"
#define WIRE_WRITE Wire.write
#else
#include "WProgram.h"
#define WIRE_WRITE Wire.send
#endif
#ifdef __SAM3X8E__
typedef volatile RwReg PortReg;
typedef uint32_t PortMask;
#else
typedef volatile uint8_t PortReg;
typedef uint8_t PortMask;
#endif
#include <SPI.h>
#include <Adafruit_GFX.h>
#define BLACK 0
#define WHITE 1
#define INVERSE 2
#define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D
// Address for 128x32 is 0x3C
// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)
/*=========================================================================
SSD1306 Displays
-----------------------------------------------------------------------
The driver is used in multiple displays (128x64, 128x32, etc.).
Select the appropriate display below to create an appropriately
sized framebuffer, etc.
SSD1306_128_64 128x64 pixel display
SSD1306_128_32 128x32 pixel display
SSD1306_96_16
-----------------------------------------------------------------------*/
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_128_32
// #define SSD1306_96_16
/*=========================================================================*/
#if defined SSD1306_128_64 && defined SSD1306_128_32
#error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
#error "At least one SSD1306 display must be specified in SSD1306.h"
#endif
#if defined SSD1306_128_64
#define SSD1306_LCDWIDTH 128
#define SSD1306_LCDHEIGHT 64
#endif
#if defined SSD1306_128_32
#define SSD1306_LCDWIDTH 128
#define SSD1306_LCDHEIGHT 32
#endif
#if defined SSD1306_96_16
#define SSD1306_LCDWIDTH 96
#define SSD1306_LCDHEIGHT 16
#endif
#define SSD1306_SETCONTRAST 0x81
#define SSD1306_DISPLAYALLON_RESUME 0xA4
#define SSD1306_DISPLAYALLON 0xA5
#define SSD1306_NORMALDISPLAY 0xA6
#define SSD1306_INVERTDISPLAY 0xA7
#define SSD1306_DISPLAYOFF 0xAE
#define SSD1306_DISPLAYON 0xAF
#define SSD1306_SETDISPLAYOFFSET 0xD3
#define SSD1306_SETCOMPINS 0xDA
#define SSD1306_SETVCOMDETECT 0xDB
#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
#define SSD1306_SETPRECHARGE 0xD9
#define SSD1306_SETMULTIPLEX 0xA8
#define SSD1306_SETLOWCOLUMN 0x00
#define SSD1306_SETHIGHCOLUMN 0x10
#define SSD1306_SETSTARTLINE 0x40
#define SSD1306_MEMORYMODE 0x20
#define SSD1306_COLUMNADDR 0x21
#define SSD1306_PAGEADDR 0x22
#define SSD1306_COMSCANINC 0xC0
#define SSD1306_COMSCANDEC 0xC8
#define SSD1306_SEGREMAP 0xA0
#define SSD1306_CHARGEPUMP 0x8D
#define SSD1306_EXTERNALVCC 0x1
#define SSD1306_SWITCHCAPVCC 0x2
// Scrolling #defines
#define SSD1306_ACTIVATE_SCROLL 0x2F
#define SSD1306_DEACTIVATE_SCROLL 0x2E
#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
class Adafruit_SSD1306 : public Adafruit_GFX {
public:
Adafruit_SSD1306(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS);
Adafruit_SSD1306(int8_t RST);
void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool reset=true);
void ssd1306_command(uint8_t c);
void ssd1306_data(uint8_t c);
void clearDisplay(void);
void invertDisplay(uint8_t i);
void display();
void startscrollright(uint8_t start, uint8_t stop);
void startscrollleft(uint8_t start, uint8_t stop);
void startscrolldiagright(uint8_t start, uint8_t stop);
void startscrolldiagleft(uint8_t start, uint8_t stop);
void stopscroll(void);
void dim(uint8_t contrast);
void drawPixel(int16_t x, int16_t y, uint16_t color);
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
private:
int8_t _i2caddr, _vccstate, sid, sclk, dc, rst, cs;
void fastSPIwrite(uint8_t c);
boolean hwSPI;
PortReg *mosiport, *clkport, *csport, *dcport;
PortMask mosipinmask, clkpinmask, cspinmask, dcpinmask;
inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline));
inline void drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color) __attribute__((always_inline));
};
|
#ifndef _M68K_PGTABLE_H
#define _M68K_PGTABLE_H
#include <linux/config.h>
#include <asm/setup.h>
#ifndef __ASSEMBLY__
#include <asm/processor.h>
#include <linux/threads.h>
/*
* This file contains the functions and defines necessary to modify and use
* the m68k page table tree.
*/
#include <asm/virtconvert.h>
/* Certain architectures need to do special things when pte's
* within a page table are directly modified. Thus, the following
* hook is made available.
*/
#define set_pte(pteptr, pteval) \
do{ \
*(pteptr) = (pteval); \
} while(0)
/* PMD_SHIFT determines the size of the area a second-level page table can map */
#ifdef CONFIG_SUN3
#define PMD_SHIFT 17
#else
#define PMD_SHIFT 22
#endif
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE-1))
/* PGDIR_SHIFT determines what a third-level page table entry can map */
#ifdef CONFIG_SUN3
#define PGDIR_SHIFT 17
#else
#define PGDIR_SHIFT 25
#endif
#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
#define PGDIR_MASK (~(PGDIR_SIZE-1))
/*
* entries per page directory level: the m68k is configured as three-level,
* so we do have PMD level physically.
*/
#ifdef CONFIG_SUN3
#define PTRS_PER_PTE 16
#define PTRS_PER_PMD 1
#define PTRS_PER_PGD 2048
#else
#define PTRS_PER_PTE 1024
#define PTRS_PER_PMD 8
#define PTRS_PER_PGD 128
#endif
#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
#define FIRST_USER_PGD_NR 0
/* Virtual address region for use by kernel_map() */
#ifdef CONFIG_SUN3
#define KMAP_START 0x0DC00000
#define KMAP_END 0x0E000000
#else
#define KMAP_START 0xd0000000
#define KMAP_END 0xf0000000
#endif
#ifndef CONFIG_SUN3
/* Just any arbitrary offset to the start of the vmalloc VM area: the
* current 8MB value just means that there will be a 8MB "hole" after the
* physical memory until the kernel virtual memory starts. That means that
* any out-of-bounds memory accesses will hopefully be caught.
* The vmalloc() routines leaves a hole of 4kB between each vmalloced
* area for the same reason. ;)
*/
#define VMALLOC_OFFSET (8*1024*1024)
#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
#define VMALLOC_VMADDR(x) ((unsigned long)(x))
#define VMALLOC_END KMAP_START
#else
extern unsigned long vmalloc_end;
#define VMALLOC_START 0x0f800000
#define VMALLOC_VMADDR(x) ((unsigned long)(x))
#define VMALLOC_END vmalloc_end
#endif /* CONFIG_SUN3 */
/* zero page used for uninitialized stuff */
extern unsigned long empty_zero_page;
/*
* BAD_PAGETABLE is used when we need a bogus page-table, while
* BAD_PAGE is used for a bogus page.
*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
extern pte_t __bad_page(void);
extern pte_t * __bad_pagetable(void);
#define BAD_PAGETABLE __bad_pagetable()
#define BAD_PAGE __bad_page()
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
/* number of bits that fit into a memory pointer */
#define BITS_PER_PTR (8*sizeof(unsigned long))
/* to align the pointer to a pointer address */
#define PTR_MASK (~(sizeof(void*)-1))
/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
/* 64-bit machines, beware! SRB. */
#define SIZEOF_PTR_LOG2 2
/*
* Check if the addr/len goes up to the end of a physical
* memory chunk. Used for DMA functions.
*/
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
/*
* It makes no sense to consider whether we cross a memory boundary if
* we support just one physical chunk of memory.
*/
extern inline int mm_end_of_chunk (unsigned long addr, int len)
{
return 0;
}
#else
int mm_end_of_chunk (unsigned long addr, int len);
#endif
extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
/*
* The m68k doesn't have any external MMU info: the kernel page
* tables contain all the necessary information. The Sun3 does, but
* they are updated on demand.
*/
extern inline void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
{
}
#ifdef CONFIG_SUN3
/* Macros to (de)construct the fake PTEs representing swap pages. */
#define SWP_TYPE(x) ((x).val & 0x7F)
#define SWP_OFFSET(x) (((x).val) >> 7)
#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) | ((offset) << 7)) })
#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define swp_entry_to_pte(x) ((pte_t) { (x).val })
#else
/* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */
#define SWP_TYPE(x) (((x).val >> 3) & 0x1ff)
#define SWP_OFFSET(x) ((x).val >> 12)
#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 3) | ((offset) << 12) })
#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define swp_entry_to_pte(x) ((pte_t) { (x).val })
#endif /* CONFIG_SUN3 */
#endif /* !__ASSEMBLY__ */
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
#define io_remap_page_range remap_page_range
/* MMU-specific headers */
#ifdef CONFIG_SUN3
#include <asm/sun3_pgtable.h>
#else
#include <asm/motorola_pgtable.h>
#endif
#ifndef __ASSEMBLY__
#include <asm-generic/pgtable.h>
#endif /* !__ASSEMBLY__ */
/*
* No page table caches to initialise
*/
#define pgtable_cache_init() do { } while (0)
#endif /* _M68K_PGTABLE_H */
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2013 Red Hat, Inc.
*/
#ifndef NMT_NEWT_POPUP_H
#define NMT_NEWT_POPUP_H
#include "nmt-newt-button.h"
#define NMT_TYPE_NEWT_POPUP (nmt_newt_popup_get_type ())
#define NMT_NEWT_POPUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_POPUP, NmtNewtPopup))
#define NMT_NEWT_POPUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_POPUP, NmtNewtPopupClass))
#define NMT_IS_NEWT_POPUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMT_TYPE_NEWT_POPUP))
#define NMT_IS_NEWT_POPUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMT_TYPE_NEWT_POPUP))
#define NMT_NEWT_POPUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMT_TYPE_NEWT_POPUP, NmtNewtPopupClass))
struct _NmtNewtPopup {
NmtNewtButton parent;
};
typedef struct {
NmtNewtButtonClass parent;
} NmtNewtPopupClass;
GType nmt_newt_popup_get_type (void);
typedef struct {
char *label;
char *id;
} NmtNewtPopupEntry;
NmtNewtWidget *nmt_newt_popup_new (NmtNewtPopupEntry *entries);
int nmt_newt_popup_get_active (NmtNewtPopup *popup);
void nmt_newt_popup_set_active (NmtNewtPopup *popup,
int active);
const char *nmt_newt_popup_get_active_id (NmtNewtPopup *popup);
void nmt_newt_popup_set_active_id (NmtNewtPopup *popup,
const char *active_id);
#endif /* NMT_NEWT_POPUP_H */
|
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <mach/std_types.h>
#include <machine/locore.h>
#include <sys/time.h>
#include <kern/time_stamp.h>
/*
* ts.c - kern_timestamp system call.
*/
kern_return_t
kern_timestamp(struct tsval *tsp)
{
/*
temp.low_val = 0;
temp.high_val = ts_tick_count;
*/
time_value_t temp;
temp = time;
if (copyout(&temp,
tsp,
sizeof(struct tsval)) != KERN_SUCCESS)
return(KERN_INVALID_ADDRESS);
return(KERN_SUCCESS);
}
/*
* Initialization procedure.
*/
void timestamp_init(void)
{
ts_tick_count = 0;
}
|
#include <common.h>
#include <command.h>
#include <asm/mipsregs.h>
#include <asm/addrspace.h>
#include <config.h>
#include <version.h>
#include "ar7240_soc.h"
extern int wasp_ddr_initial_config(uint32_t refresh);
extern int ar7240_ddr_find_size(void);
#ifdef COMPRESSED_UBOOT
# define prmsg(...)
#else
# define prmsg printf
#endif
void
wasp_usb_initial_config(void)
{
#define unset(a) (~(a))
if ((ar7240_reg_rd(WASP_BOOTSTRAP_REG) & WASP_REF_CLK_25) == 0) {
ar7240_reg_wr_nf(AR934X_SWITCH_CLOCK_SPARE,
ar7240_reg_rd(AR934X_SWITCH_CLOCK_SPARE) |
SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SET(2));
} else {
ar7240_reg_wr_nf(AR934X_SWITCH_CLOCK_SPARE,
ar7240_reg_rd(AR934X_SWITCH_CLOCK_SPARE) |
SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SET(5));
}
udelay(1000);
ar7240_reg_wr(AR7240_RESET,
ar7240_reg_rd(AR7240_RESET) |
RST_RESET_USB_PHY_SUSPEND_OVERRIDE_SET(1));
udelay(1000);
ar7240_reg_wr(AR7240_RESET,
ar7240_reg_rd(AR7240_RESET) &
unset(RST_RESET_USB_PHY_RESET_SET(1)));
udelay(1000);
ar7240_reg_wr(AR7240_RESET,
ar7240_reg_rd(AR7240_RESET) &
unset(RST_RESET_USB_PHY_ARESET_SET(1)));
udelay(1000);
ar7240_reg_wr(AR7240_RESET,
ar7240_reg_rd(AR7240_RESET) &
unset(RST_RESET_USB_HOST_RESET_SET(1)));
udelay(1000);
if ((ar7240_reg_rd(AR7240_REV_ID) & 0xf) == 0) {
/* Only for WASP 1.0 */
ar7240_reg_wr(0xb8116c84 ,
ar7240_reg_rd(0xb8116c84) & unset(1<<20));
}
}
void wasp_gpio_config(void)
{
#if 0
/* Disable clock obs */
ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e0ff));
/* Enable eth Switch LEDs */
#ifdef CONFIG_K31
ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) | 0xd8));
#else
ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) | 0xfa));
#endif
#endif
}
int
wasp_mem_config(void)
{
#ifdef CONFIG_AP123
extern void ath_ddr_tap_cal(void);
#endif
unsigned int type, reg32;
type = wasp_ddr_initial_config(CFG_DDR_REFRESH_VAL);
#ifdef CONFIG_AP123
ath_ddr_tap_cal();
#ifndef COMPRESSED_UBOOT
printf("Tap value selected = 0x%x [0x%x - 0x%x]\n",
ar7240_reg_rd(AR7240_DDR_TAP_CONTROL0),
ar7240_reg_rd(0xbd007f10), ar7240_reg_rd(0xbd007f14));
#endif
#endif
/* Take WMAC out of reset */
reg32 = ar7240_reg_rd(AR7240_RESET);
reg32 = reg32 & ~AR7240_RESET_WMAC;
ar7240_reg_wr_nf(AR7240_RESET, reg32);
/* Switching regulator settings */
ar7240_reg_wr_nf(0x18116c40, 0x633c8176); /* AR_PHY_PMU1 */
ar7240_reg_wr_nf(0x18116c44, 0x10380000); /* AR_PHY_PMU2 */
wasp_usb_initial_config();
wasp_gpio_config();
reg32 = ar7240_ddr_find_size();
return reg32;
}
long int initdram(int board_type)
{
return (wasp_mem_config());
}
#ifdef COMPRESSED_UBOOT
int checkboard(char *s)
#else
int checkboard(void)
#endif
{
#ifdef COMPRESSED_UBOOT
#if CONFIG_AP123
strcpy(s, "U-boot AP123\n");
#elif CONFIG_MI124
strcpy(s, "U-boot MI124\n");
#else
strcpy(s, "U-boot DB120\n");
#endif
#endif
#if CONFIG_AP123
prmsg("U-boot AP123\n");
#elif CONFIG_MI124
prmsg("U-boot MI124\n");
#else
prmsg("U-boot DB120\n");
#endif
return 0;
}
|
/* config.h for Windows NT */
#ifndef __CONFIG_H
#define __CONFIG_H
/*
* IPv6 requirements
*/
/*
* For VS.NET most of the IPv6 types and structures are defined
*/
#if _MSC_VER > 1200
#define HAVE_STRUCT_SOCKADDR_STORAGE
#define ISC_PLATFORM_HAVEIPV6
#define ISC_PLATFORM_HAVEIN6PKTINFO
#define NO_OPTION_NAME_WARNINGS
#else
typedef int socklen_t; /* VS 6.0 doesn't know about socklen_t */
#endif
/*
* Some types don't exist in VS V6
*/
#if _MSC_VER < 1300
typedef unsigned int uintptr_t;
#endif
#define ISC_PLATFORM_NEEDIN6ADDRANY
#define HAVE_SOCKADDR_IN6
/*
* The type of the socklen_t defined for getnameinfo() and getaddrinfo()
* is int for VS compilers on Windows but the type is already declared
*/
#define GETSOCKNAME_SOCKLEN_TYPE socklen_t
/*
* An attempt to cut down the number of warnings generated during compilation.
* All of these should be benign to disable.
*/
#pragma warning(disable: 4100) /* unreferenced formal parameter */
#pragma warning(disable: 4101) /* unreferenced local variable */
#pragma warning(disable: 4127) /* conditional expression is constant */
/*
* Windows NT Configuration Values
*/
#if defined _DEBUG /* Use VC standard macro definitions */
# define DEBUG 1
#endif
#if !defined _WIN32_WINNT || _WIN32_WINNT < 0x0400
# error Please define _WIN32_WINNT in the project settings/makefile
#endif
#define __windows__ 1
/*
* ANSI C compliance enabled
*/
#define __STDC__ 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Prevent inclusion of winsock.h in windows.h */
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
#ifndef __RPCASYNC_H__
#define __RPCASYNC_H__
#endif
/*
* VS.NET's version of wspiapi.h has a bug in it
* where it assigns a value to a variable inside
* an if statement. It should be comparing them.
* We prevent inclusion since we are not using this
* code so we don't have to see the warning messages
*/
#ifndef _WSPIAPI_H_
#define _WSPIAPI_H_
#endif
#define OPEN_BCAST_SOCKET 1 /* for ntp_io.c */
#define TYPEOF_IP_MULTICAST_LOOP BOOL
#define SETSOCKOPT_ARG_CAST (const char *)
#define HAVE_RANDOM
#define MAXHOSTNAMELEN 64
#define AUTOKEY
/*
* Multimedia timer enable
*/
#define USE_MM_TIMER
/*
* Use 32-bit time definitions
* VS 2005 defaults to 64-bit time
* Leave commented out for now
*/
//#define _USE_32BIT_TIME_T
/* Enable OpenSSL */
#define OPENSSL 1
/*
* Include standard stat information
*/
#include <isc/stat.h>
/*
* Miscellaneous functions that Microsoft maps
* to other names
*/
#define inline __inline
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define stricmp _stricmp
#define strcasecmp _stricmp
#define isascii __isascii
#define finite _finite
#define random rand
#define srandom srand
#define fdopen _fdopen
#define read _read
#define open _open
#define close _close
#define write _write
#define strdup _strdup
#define stat _stat /* struct stat from <sys/stat.h> */
#define unlink _unlink
#define fchmod( _x, _y );
#define lseek _lseek
#define pipe _pipe
#define dup2 _dup2
#define sleep(x) Sleep((DWORD) x * 1000 /* milliseconds */ );
#define pid_t int /* PID is an int */
#define ssize_t int /* ssize is an int */
/*
* Map the stream to the file number
*/
#define STDOUT_FILENO _fileno(stdout)
#define STDERR_FILENO _fileno(stderr)
/*
* We need to include string.h first before we override strerror
* otherwise we can get errors during the build
*/
#include <string.h>
/* Point to a local version for error string handling */
# define strerror NTstrerror
char *NTstrerror(int errnum);
int NT_set_process_priority(void); /* Define this function */
# define MCAST /* Enable Multicast Support */
# define MULTICAST_NONEWSOCKET /* Don't create a new socket for mcast address */
# define REFCLOCK /* from ntpd.mak */
# define CLOCK_LOCAL /* from ntpd.mak */
//# define CLOCK_PARSE
/* # define CLOCK_ATOM */
/* # define CLOCK_SHM */ /* from ntpd.mak */
# define CLOCK_HOPF_SERIAL /* device 38, hopf DCF77/GPS serial line receiver */
# define CLOCK_HOPF_PCI /* device 39, hopf DCF77/GPS PCI-Bus receiver */
# define CLOCK_NMEA
# define CLOCK_PALISADE /* from ntpd.mak */
# define CLOCK_DUMBCLOCK
# define CLOCK_TRIMBLEDC
# define CLOCK_TRIMTSIP 1
# define CLOCK_JUPITER
# define NTP_LITTLE_ENDIAN /* from libntp.mak */
# define NTP_POSIX_SOURCE
# define SYSLOG_FILE /* from libntp.mak */
# define SYSV_TIMEOFDAY /* for ntp_unixtime.h */
# define SIZEOF_SIGNED_CHAR 1
# define SIZEOF_TIME_T 4
# define SIZEOF_INT 4 /* for ntp_types.h */
//# define HAVE_NET_IF_H
# define QSORT_USES_VOID_P
# define HAVE_SETVBUF
# define HAVE_VSPRINTF
# define HAVE_SNPRINTF
# define HAVE_VSNPRINTF
# define HAVE_PROTOTYPES /* from ntpq.mak */
# define HAVE_MEMMOVE
# define HAVE_TERMIOS_H
# define HAVE_ERRNO_H
# define HAVE_STDARG_H
# define HAVE_NO_NICE
# define HAVE_MKTIME
# define TIME_WITH_SYS_TIME
# define HAVE_IO_COMPLETION_PORT
# define ISC_PLATFORM_NEEDNTOP
# define ISC_PLATFORM_NEEDPTON
# define HAVE_VPRINTF
#define HAVE_LIMITS_H 1
#define HAVE_STRDUP 1
#define HAVE_STRCHR 1
#define HAVE_FCNTL_H 1
# define NEED_S_CHAR_TYPEDEF
# define USE_PROTOTYPES /* for ntp_types.h */
#define ULONG_CONST(a) a ## UL
# define NOKMEM
# define RETSIGTYPE void
# ifndef STR_SYSTEM
# define STR_SYSTEM "WINDOWS/NT"
# endif
#define SIOCGIFFLAGS SIO_GET_INTERFACE_LIST /* used in ntp_io.c */
/* Include Windows headers */
#include <windows.h>
#include <winsock2.h>
#endif /* __config */
|
#include "../../corelibs/U2Lang/src/model/QueryDesignerRegistry.h"
|
#include "../../corelibs/U2Lang/src/support/NoFailTaskWrapper.h"
|
// **********************************************************************
//
// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef FILE_TRACKER_H
#define FILE_TRACKER_H
#include <IceUtil/Shared.h>
#include <Slice/Parser.h>
namespace Slice
{
class SLICE_API FileException : public ::IceUtil::Exception
{
public:
FileException(const char*, int, const std::string&);
~FileException() throw();
virtual std::string ice_name() const;
virtual void ice_print(std::ostream&) const;
virtual FileException* ice_clone() const;
virtual void ice_throw() const;
std::string reason() const;
private:
static const char* _name;
const std::string _reason;
};
class FileTracker;
typedef IceUtil::Handle<FileTracker> FileTrackerPtr;
class SLICE_API FileTracker : public ::IceUtil::SimpleShared
{
public:
FileTracker();
~FileTracker();
static FileTrackerPtr instance();
void setSource(const std::string&);
void setOutput(const std::string&, bool);
void addFile(const std::string&);
void addDirectory(const std::string&);
void cleanup();
void dumpxml();
private:
std::string escape(const std::string&) const;
std::list<std::pair< std::string, bool> > _files;
std::string _source;
std::map<std::string, std::string> _errors;
std::map<std::string, std::list<std::string> > _generated;
std::map<std::string, std::list<std::string> >::iterator _curr;
};
}
#endif
|
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*
* Test that if clock_settime() changes the value for CLOCK_REALTIME,
* an absolute timer which would now have expired in the past
* will expire immediately (with no error).
*
* Steps:
* - get time T0
* - create/enable a timer to expire at T1 = T0 + TIMEROFFSET
* - set time forward to T1 + CLOCKOFFSET
* - ensure that timer has expired with no error
*
* signal SIGTOTEST is used.
*/
#include <stdio.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include "posixtest.h"
#include "helpers.h"
#define TIMEROFFSET 9
#define CLOCKOFFSET 4
#define SHORTTIME 1
#define SIGTOTEST SIGALRM
struct timespec tpreset;
void handler(int signo)
{
printf("Caught signal\n");
printf("Test PASSED\n");
setBackTime(tpreset);
exit(PTS_PASS);
}
int main(int argc, char *argv[])
{
struct sigevent ev;
struct sigaction act;
struct timespec tpT0, tpclock;
struct itimerspec its;
timer_t tid;
int flags = 0;
/*
* set up sigevent for timer
* set up sigaction to catch signal
*/
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGTOTEST;
act.sa_handler=handler;
act.sa_flags=0;
if (sigemptyset(&act.sa_mask) != 0) {
perror("sigemptyset() was not successful\n");
return PTS_UNRESOLVED;
}
if (sigaction(SIGTOTEST, &act, 0) != 0) {
perror("sigaction() was not successful\n");
return PTS_UNRESOLVED;
}
if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) {
perror("clock_gettime() was not successful\n");
return PTS_UNRESOLVED;
}
if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
perror("timer_create() did not return success\n");
return PTS_UNRESOLVED;
}
flags |= TIMER_ABSTIME;
its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = tpT0.tv_sec + TIMEROFFSET;
its.it_value.tv_nsec = tpT0.tv_nsec;
if (timer_settime(tid, flags, &its, NULL) != 0) {
perror("timer_settime() did not return success\n");
return PTS_UNRESOLVED;
}
tpclock.tv_sec = its.it_value.tv_sec + CLOCKOFFSET;
tpclock.tv_nsec = its.it_value.tv_nsec;
getBeforeTime(&tpreset);
if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) {
printf("clock_settime() was not successful\n");
return PTS_UNRESOLVED;
}
sleep(SHORTTIME);
printf("timer should have expired _immediately_\n");
tpreset.tv_sec += SHORTTIME;
setBackTime(tpreset);
return PTS_FAIL;
}
|
/****************************************************************************
*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2017 by Inria. All rights reserved.
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* See the file LICENSE.txt at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using ViSP with software that can not be combined with the GNU
* GPL, please contact Inria about acquiring a ViSP Professional
* Edition License.
*
* See http://visp.inria.fr for more information.
*
* This software was developed at:
* Inria Rennes - Bretagne Atlantique
* Campus Universitaire de Beaulieu
* 35042 Rennes Cedex
* France
*
* If you have questions regarding the use of this file, please contact
* Inria at visp@inria.fr
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Description:
* Interface with the image for feature display.
*
* Authors:
* Eric Marchand
*
*****************************************************************************/
#ifndef vpProjectionDisplay_H
#define vpProjectionDisplay_H
/*!
\file vpProjectionDisplay.h
\brief interface with the image for feature display
*/
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_DISPLAY)
#include <visp3/core/vpCameraParameters.h>
#include <visp3/core/vpColor.h>
#include <visp3/core/vpForwardProjection.h>
#include <visp3/core/vpImage.h>
#include <visp3/core/vpPoint.h>
#include <visp3/gui/vpDisplayD3D.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayGTK.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <list>
/*!
\class vpProjectionDisplay
\ingroup group_gui_projection
\brief interface with the image for feature display
*/
class VISP_EXPORT vpProjectionDisplay
{
private:
vpImage<unsigned char> Icam;
vpImage<unsigned char> Iext;
#if defined VISP_HAVE_X11
vpDisplayX dIcam;
vpDisplayX dIext;
#elif defined VISP_HAVE_GTK
vpDisplayGTK dIcam;
vpDisplayGTK dIext;
#elif defined VISP_HAVE_GDI
vpDisplayGDI dIcam;
vpDisplayGDI dIext;
#elif defined VISP_HAVE_OPENCV
vpDisplayOpenCV dIcam;
vpDisplayOpenCV dIext;
#elif defined(VISP_HAVE_D3D9)
vpDisplayD3D dIcam;
vpDisplayD3D dIext;
#endif
public:
void init();
void init(int select);
void close();
static int internalView() { return 0x01; }
static int externalView() { return 0x02; }
/*! Default constructor. */
vpProjectionDisplay()
: Icam(), Iext(),
#if defined(VISP_HAVE_DISPLAY)
dIcam(), dIext(),
#endif
listFp(), o(), x(), y(), z(), traj()
{
init();
}
explicit vpProjectionDisplay(int select)
: Icam(), Iext(),
#if defined(VISP_HAVE_DISPLAY)
dIcam(), dIext(),
#endif
listFp(), o(), x(), y(), z(), traj()
{
init(select);
}
void insert(vpForwardProjection &fp);
void display(vpImage<unsigned char> &I, const vpHomogeneousMatrix &cextMo, const vpHomogeneousMatrix &cMo,
const vpCameraParameters &cam, const vpColor &color, const bool &displayTraj = false,
const unsigned int thickness = 1);
void displayCamera(vpImage<unsigned char> &I, const vpHomogeneousMatrix &cextMo, const vpHomogeneousMatrix &cMo,
const vpCameraParameters &cam, const unsigned int thickness = 1);
private:
std::list<vpForwardProjection *> listFp;
vpPoint o;
vpPoint x;
vpPoint y;
vpPoint z;
vpMatrix traj;
};
#endif
#endif
/*
* Local variables:
* c-basic-offset: 2
* End:
*/
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/spinbutt.h
// Purpose: wxSpinButtonBase class
// Author: Julian Smart, Vadim Zeitlin
// Modified by:
// Created: 23.07.99
// RCS-ID: $Id: spinbutt.h 66625 2011-01-07 17:42:39Z SC $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_BASE_
#define _WX_SPINBUTT_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_SPINBTN
#include "wx/control.h"
#include "wx/event.h"
#include "wx/range.h"
#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
// ----------------------------------------------------------------------------
// The wxSpinButton is like a small scrollbar than is often placed next
// to a text control.
//
// Styles:
// wxSP_HORIZONTAL: horizontal spin button
// wxSP_VERTICAL: vertical spin button (the default)
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
// wxSP_WRAP: value wraps at either end
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl
{
public:
// ctor initializes the range with the default (0..100) values
wxSpinButtonBase() { m_min = 0; m_max = 100; }
// accessors
virtual int GetValue() const = 0;
virtual int GetMin() const { return m_min; }
virtual int GetMax() const { return m_max; }
wxRange GetRange() const { return wxRange( GetMin(), GetMax() );}
// operations
virtual void SetValue(int val) = 0;
virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
virtual void SetRange(int minVal, int maxVal)
{
m_min = minVal;
m_max = maxVal;
}
void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); }
// is this spin button vertically oriented?
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
protected:
// the range value
int m_min;
int m_max;
wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase);
};
// ----------------------------------------------------------------------------
// include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/spinbutt.h"
#elif defined(__WXMSW__)
#include "wx/msw/spinbutt.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/spinbutt.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/spinbutt.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/spinbutt.h"
#elif defined(__WXMAC__)
#include "wx/osx/spinbutt.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/spinbutt.h"
#elif defined(__WXPM__)
#include "wx/os2/spinbutt.h"
#endif
// ----------------------------------------------------------------------------
// the wxSpinButton event
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent
{
public:
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxNotifyEvent(commandType, winid)
{
}
wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {}
// get the current value of the control
int GetValue() const { return m_commandInt; }
void SetValue(int value) { m_commandInt = value; }
int GetPosition() const { return m_commandInt; }
void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const { return new wxSpinEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent)
};
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
#define wxSpinEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSpinEventFunction, func)
// macros for handling spin events: notice that we must use the real values of
// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN])
// here as otherwise the event tables could end up with non-initialized
// (because of undefined initialization order of the globals defined in
// different translation units) references in them
#define EVT_SPIN_UP(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func))
#define EVT_SPIN_DOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func))
#define EVT_SPIN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func))
#endif // wxUSE_SPINBTN
#endif
// _WX_SPINBUTT_H_BASE_
|
/*
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
* Copyright (C) 2007 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
* UCRL-CODE-235197
*
* This file is part of the SPL, Solaris Porting Layer.
* For details, see <http://zfsonlinux.org/>.
*
* The SPL is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* The SPL is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SPL_CONDVAR_H
#define _SPL_CONDVAR_H
#include <linux/module.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/callo.h>
#include <sys/wait.h>
/*
* The kcondvar_t struct is protected by mutex taken externally before
* calling any of the wait/signal funs, and passed into the wait funs.
*/
#define CV_MAGIC 0x346545f4
#define CV_DESTROY 0x346545f5
typedef struct {
int cv_magic;
spl_wait_queue_head_t cv_event;
spl_wait_queue_head_t cv_destroy;
atomic_t cv_refs;
atomic_t cv_waiters;
kmutex_t *cv_mutex;
} kcondvar_t;
typedef enum { CV_DEFAULT = 0, CV_DRIVER } kcv_type_t;
extern void __cv_init(kcondvar_t *, char *, kcv_type_t, void *);
extern void __cv_destroy(kcondvar_t *);
extern void __cv_wait(kcondvar_t *, kmutex_t *);
extern void __cv_wait_io(kcondvar_t *, kmutex_t *);
extern void __cv_wait_sig(kcondvar_t *, kmutex_t *);
extern clock_t __cv_timedwait(kcondvar_t *, kmutex_t *, clock_t);
extern clock_t __cv_timedwait_io(kcondvar_t *, kmutex_t *, clock_t);
extern clock_t __cv_timedwait_sig(kcondvar_t *, kmutex_t *, clock_t);
extern clock_t cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t,
hrtime_t res, int flag);
extern clock_t cv_timedwait_sig_hires(kcondvar_t *, kmutex_t *, hrtime_t,
hrtime_t res, int flag);
extern void __cv_signal(kcondvar_t *);
extern void __cv_broadcast(kcondvar_t *c);
#define cv_init(cvp, name, type, arg) __cv_init(cvp, name, type, arg)
#define cv_destroy(cvp) __cv_destroy(cvp)
#define cv_wait(cvp, mp) __cv_wait(cvp, mp)
#define cv_wait_io(cvp, mp) __cv_wait_io(cvp, mp)
#define cv_wait_sig(cvp, mp) __cv_wait_sig(cvp, mp)
#define cv_wait_interruptible(cvp, mp) cv_wait_sig(cvp, mp)
#define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t)
#define cv_timedwait_io(cvp, mp, t) __cv_timedwait_io(cvp, mp, t)
#define cv_timedwait_sig(cvp, mp, t) __cv_timedwait_sig(cvp, mp, t)
#define cv_timedwait_interruptible(cvp, mp, t) cv_timedwait_sig(cvp, mp, t)
#define cv_signal(cvp) __cv_signal(cvp)
#define cv_broadcast(cvp) __cv_broadcast(cvp)
#endif /* _SPL_CONDVAR_H */
|
#ifndef _imgconv_h_
#define _imgconv_h_
#define UYVY_GET_AVG_Y(uyvy) (((((uyvy) >> 24) & 0xFF) + (((uyvy) >> 8) & 0xFF)) >> 1)
#define UYVY_GET_U(uyvy) (((uyvy) ) & 0xFF)
#define UYVY_GET_V(uyvy) (((uyvy) >> 16) & 0xFF)
#define COMPUTE_UYVY2YRGB(uyvy, Y, R, G, B) \
{ \
Y = UYVY_GET_AVG_Y(uyvy); \
const int gv = UYVY_GET_V(uyvy); \
const int gu = UYVY_GET_U(uyvy); \
int v = Y + yuv2rgb_RV[gv]; \
R = COERCE(v, 0, 255); \
v = Y + yuv2rgb_GU[gu] + yuv2rgb_GV[gv]; \
G = COERCE(v, 0, 255); \
v = Y + yuv2rgb_BU[gu]; \
B = COERCE(v, 0, 255); \
} \
#define UYVY_PACK(u,y1,v,y2) ((u) & 0xFF) | (((y1) & 0xFF) << 8) | (((v) & 0xFF) << 16) | (((y2) & 0xFF) << 24);
extern int yuv2rgb_RV[256];
extern int yuv2rgb_GU[256];
extern int yuv2rgb_GV[256];
extern int yuv2rgb_BU[256];
/** http://www.martinreddy.net/gfx/faqs/colorconv.faq
* BT 601:
* R'= Y' + 0.000*U' + 1.403*V'
* G'= Y' - 0.344*U' - 0.714*V'
* B'= Y' + 1.773*U' + 0.000*V'
*
* BT 709:
* R'= Y' + 0.0000*Cb + 1.5701*Cr
* G'= Y' - 0.1870*Cb - 0.4664*Cr
* B'= Y' - 1.8556*Cb + 0.0000*Cr
*/
void precompute_yuv2rgb();
void yuv2rgb(int Y, int U, int V, int* R, int* G, int* B);
uint32_t rgb2yuv422(int R, int G, int B);
void uyvy_split(uint32_t uyvy, int* Y, int* U, int* V);
void little_cleanup(void* BP, void* MP);
void yuv_resize(uint32_t* src, int src_w, int src_h, uint32_t* dst, int dst_w, int dst_h);
void yuv_halfcopy(uint32_t* dst, uint32_t* src, int w, int h, int top_half);
void bmp_zoom(uint8_t* dst, uint8_t* src, int x0, int y0, int denx, int deny);
void yuvcpy_main(uint32_t* dst, uint32_t* src, int num_pix, int X);
int yuv411_to_422(uint32_t addr);
void yuv411_to_rgb(uint32_t addr, int* Y, int* R, int* G, int* B);
/* you can get pixoff with the *2LV(x,y)/2 macros, e.g. BM2LV(x,y)/2 or LV(x,y)/2 */
uint32_t yuv422_get_pixel(uint32_t* buf, int pixoff);
#endif /* _imgconv_h_ */
|
/* Mach-O arm declarations for BFD.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef _MACH_O_ARM_H
#define _MACH_O_ARM_H
/* ARM relocations. */
#define BFD_MACH_O_ARM_RELOC_VANILLA 0 /* Generic relocation. */
#define BFD_MACH_O_ARM_RELOC_PAIR 1 /* Second entry in a pair. */
#define BFD_MACH_O_ARM_RELOC_SECTDIFF 2 /* Subtract with a PAIR. */
#define BFD_MACH_O_ARM_RELOC_LOCAL_SECTDIFF 3 /* Like above, but local ref. */
#define BFD_MACH_O_ARM_RELOC_PB_LA_PTR 4 /* Prebound lazy pointer. */
#define BFD_MACH_O_ARM_RELOC_BR24 5 /* 24bit branch. */
#define BFD_MACH_O_THUMB_RELOC_BR22 6 /* 22bit branch. */
#define BFD_MACH_O_THUMB_32BIT_BRANCH 7 /* Obselete. */
#define BFD_MACH_O_ARM_RELOC_HALF 8
#define BFD_MACH_O_ARM_RELOC_HALF_SECTDIFF 9
#endif /* _MACH_O_ARM_H */
|
/*--------------------------------------------------------------------*/
/*--- Printing libc stuff. pub_core_libcprint.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2000-2012 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_LIBCPRINT_H
#define __PUB_CORE_LIBCPRINT_H
//--------------------------------------------------------------------
// PURPOSE: This module contains all the libc code that is related to
// higher-level (ie. higher than DebugLog) printing, eg. VG_(printf)().
//--------------------------------------------------------------------
#include "pub_tool_libcprint.h"
/* An output file descriptor wrapped up with a Bool indicating whether
or not the fd is a socket. */
typedef
struct { Int fd; Bool is_socket; }
OutputSink;
/* And the destinations for normal and XML output. */
extern OutputSink VG_(log_output_sink);
extern OutputSink VG_(xml_output_sink);
/* Get the elapsed wallclock time since startup into buf, which must
16 chars long. This is unchecked. It also relies on the
millisecond timer having been set to zero by an initial read in
m_main during startup. */
void VG_(elapsed_wallclock_time) ( /*OUT*/HChar* buf );
/* Call this if the executable is missing. This function prints an
error message, then shuts down the entire system. */
__attribute__((noreturn))
extern void VG_(err_missing_prog) ( void );
/* Similarly - complain and stop if there is some kind of config
error. */
__attribute__((noreturn))
extern void VG_(err_config_error) ( const HChar* format, ... );
#endif // __PUB_CORE_LIBCPRINT_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef ATOM_CLASS
// clang-format off
AtomStyle(line,AtomVecLine);
// clang-format on
#else
#ifndef LMP_ATOM_VEC_LINE_H
#define LMP_ATOM_VEC_LINE_H
#include "atom_vec.h"
namespace LAMMPS_NS {
class AtomVecLine : public AtomVec {
public:
struct Bonus {
double length, theta;
int ilocal;
};
struct Bonus *bonus;
AtomVecLine(class LAMMPS *);
~AtomVecLine();
void init();
void grow_pointers();
void copy_bonus(int, int, int);
void clear_bonus();
int pack_comm_bonus(int, int *, double *);
void unpack_comm_bonus(int, int, double *);
int pack_border_bonus(int, int *, double *);
int unpack_border_bonus(int, int, double *);
int pack_exchange_bonus(int, double *);
int unpack_exchange_bonus(int, double *);
int size_restart_bonus();
int pack_restart_bonus(int, double *);
int unpack_restart_bonus(int, double *);
void data_atom_bonus(int, char **);
double memory_usage_bonus();
void create_atom_post(int);
void data_atom_post(int);
void pack_data_pre(int);
void pack_data_post(int);
int pack_data_bonus(double *, int);
void write_data_bonus(FILE *, int, double *, int);
// unique to AtomVecLine
void set_length(int, double);
int nlocal_bonus;
private:
int *line;
double *radius, *rmass;
double **omega;
int nghost_bonus, nmax_bonus;
int line_flag;
double rmass_one;
void grow_bonus();
void copy_bonus_all(int, int);
// void consistency_check(int, char *);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Atom_style line can only be used in 2d simulations
Self-explanatory.
E: Per-processor system is too big
The number of owned atoms plus ghost atoms on a single
processor must fit in 32-bit integer.
E: Invalid atom type in Atoms section of data file
Atom types must range from 1 to specified # of types.
E: Invalid density in Atoms section of data file
Density value cannot be <= 0.0.
E: Assigning line parameters to non-line atom
Self-explanatory.
E: Inconsistent line segment in data file
The end points of the line segment are not equal distances from the
center point which is the atom coordinate.
*/
|
/*
* Author: Chad Froebel <chadfroebel@gmail.com>
*
* Ported to Note 3 (n9005) and extended : Jean-Pierre Rasquin <yank555.lu@gmail.com>
* Ported to Note 4 (n910T): LoungeKatt <twistedumbrella@gmail.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LINUX_FASTCHG_H
#define _LINUX_FASTCHG_H
#define FAST_CHARGE_VERSION "v1.0 by Yank555.lu"
#define AC_LEVELS "1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100"
#define USB_LEVELS "460 500 600 700 800 900 1000"
#define ANY_LEVELS "0 to 2100"
extern int force_fast_charge;
#define FAST_CHARGE_DISABLED 0 /* default */
#define FAST_CHARGE_FORCE_AC 1
#define FAST_CHARGE_FORCE_CUSTOM_MA 2
extern int ac_charge_level;
#define AC_CHARGE_1000 1000
#define AC_CHARGE_1100 1100
#define AC_CHARGE_1200 1200
#define AC_CHARGE_1300 1300
#define AC_CHARGE_1400 1400
#define AC_CHARGE_1500 1500
#define AC_CHARGE_1600 1600
#define AC_CHARGE_1700 1700
#define AC_CHARGE_1800 1800 /* default */
#define AC_CHARGE_1900 1900
#define AC_CHARGE_2000 2000
#define AC_CHARGE_2100 2100
extern int usb_charge_level;
#define USB_CHARGE_460 460 /* default */
#define USB_CHARGE_500 500
#define USB_CHARGE_600 600
#define USB_CHARGE_700 700
#define USB_CHARGE_800 800
#define USB_CHARGE_900 900
#define USB_CHARGE_1000 1000
#define MAX_CHARGE_LEVEL 2100 /* Whatever happens, this is the limit */
extern int failsafe;
#define FAIL_SAFE_ENABLED 1 /* default */
#define FAIL_SAFE_DISABLED 0
#endif
|
/* -*- mode: c++; c-basic-offset:4 -*-
view/searchbar.h
This file is part of Kleopatra, the KDE keymanager
Copyright (c) 2007 Klarälvdalens Datakonsult AB
Kleopatra is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Kleopatra is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
In addition, as a special exception, the copyright holders give
permission to link the code of this program with any edition of
the Qt library by Trolltech AS, Norway (or with modified versions
of Qt that use the same license as Qt), and distribute linked
combinations including the two. You must obey the GNU General
Public License in all respects for all of the code used other than
Qt. If you modify this file, you may extend this exception to
your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from
your version.
*/
#ifndef __KLEOPATRA_VIEW_SEARCHBAR_H__
#define __KLEOPATRA_VIEW_SEARCHBAR_H__
#include <QWidget>
#include <utils/pimpl_ptr.h>
#include <boost/shared_ptr.hpp>
namespace Kleo {
class KeyFilter;
class SearchBar : public QWidget {
Q_OBJECT
public:
explicit SearchBar( QWidget * parent=0, Qt::WindowFlags f=0 );
~SearchBar();
QString stringFilter() const;
const boost::shared_ptr<KeyFilter> & keyFilter() const;
public Q_SLOTS:
void setStringFilter( const QString & text );
void setKeyFilter( const boost::shared_ptr<Kleo::KeyFilter> & filter );
void setChangeStringFilterEnabled( bool enable );
void setChangeKeyFilterEnabled( bool enable );
Q_SIGNALS:
void stringFilterChanged( const QString & text );
void keyFilterChanged( const boost::shared_ptr<Kleo::KeyFilter> & filter );
private:
class Private;
kdtools::pimpl_ptr<Private> d;
Q_PRIVATE_SLOT( d, void slotKeyFilterChanged(int) )
};
}
#endif // __KLEOPATRA_VIEW_SEARCHBAR_H__
|
/* $Id: os_bri.h,v 1.1 2011/07/05 16:51:40 ian Exp $ */
#ifndef __DIVA_OS_BRI_REV_1_H__
#define __DIVA_OS_BRI_REV_1_H__
int diva_bri_init_card(diva_os_xdi_adapter_t * a);
#endif
|
#include "../src/gui/image/qimageiohandler.h"
|
/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* file distributed with this source distribution.
*
* Additional copyright for this file:
* Copyright (C) 1999-2000 Revolution Software Ltd.
* This code is based on source code created by Revolution Software,
* used with permission.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef ICB_D_DEBUG
#define ICB_D_DEBUG
#include "engines/icb/p4_generic.h"
#include "engines/icb/common/px_rccommon.h"
#include "engines/icb/common/px_string.h"
#include "engines/icb/common/px_array.h"
#include "engines/icb/debug_pc.h"
namespace ICB {
extern bool8 terminate_debugging;
// This flag indicates whether or not the debug simulated feature is activated or not.
extern bool8 debug_auto_save;
// And this controls how frequently the autosave gets done.
#define DEBUG_AUTO_SAVE_SKIP_CYCLES 10
#define EXCEPTION_LOG "exception_log.txt"
#define PXTRY
#define PXCATCH if (0) {
#define PXENDCATCH }
// headup switch stub mode
void Headup_debug_switcher();
void Reset_headup_switcher();
} // End of namespace ICB
#endif // #ifndef D_DEBUG
|
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rubber Band Library
An audio time-stretching and pitch-shifting library.
Copyright 2007-2012 Particular Programs Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
Alternatively, if you have a valid commercial licence for the
Rubber Band Library obtained by agreement with the copyright
holders, you may redistribute and/or modify it under the terms
described in that licence.
If you wish to distribute code using the Rubber Band Library
under terms other than those of the GNU General Public License,
you must obtain a valid commercial licence before doing so.
*/
#ifndef _CONSTANT_AUDIO_CURVE_H_
#define _CONSTANT_AUDIO_CURVE_H_
#include "dsp/AudioCurveCalculator.h"
namespace RubberBand
{
class ConstantAudioCurve : public AudioCurveCalculator
{
public:
ConstantAudioCurve(Parameters parameters);
virtual ~ConstantAudioCurve();
virtual float processFloat(const float *R__ mag, int increment);
virtual double processDouble(const double *R__ mag, int increment);
virtual void reset();
};
}
#endif
|
#include "stdarg.h"
#include <stdio.h>
#include <stdint.h>
extern const unsigned long dv[];
/*
static const unsigned long dv[] = {
// 4294967296 // 32 bit unsigned max
1000000000, // +0
100000000, // +1
10000000, // +2
1000000, // +3
100000, // +4
// 65535 // 16 bit unsigned max
10000, // +5
1000, // +6
100, // +7
10, // +8
1, // +9
};
*/
int puts(const char* s)
{
while(*s != '\0')
{
putchar(*s);
s++;
}
return 0;
}
static void xtoa(unsigned long x, const unsigned long *dp)
{
char c;
unsigned long d;
if(x)
{
while(x < *dp) ++dp;
do {
d = *dp++;
c = '0';
while(x >= d) ++c, x -= d;
putchar(c);
} while(!(d & 1));
}
else
putchar('0');
}
static void puth(unsigned n, unsigned char format)
{
static const char hexl[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
static const char hex[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
if (format == 'x')
putchar(hexl[n & 15]);
else
putchar(hex[n & 15]);
}
int printf(const char *format, ...)
{
char c;
int i;
long n;
int len;
#ifdef MSP430
if (!uartattached)
return 0;
#endif
va_list a;
va_start(a, format);
while(c = *format++)
{
len = 0;
if(c == '%')
{
retry:
switch(c = *format++)
{
case '0':
if (*format >= '0' || *format <= '9')
{
len = *format - '0';
format++;
goto retry;
}
case 's': // String
puts(va_arg(a, char*));
break;
case 'c': // Char
putchar((char)va_arg(a, int));
break;
case 'd':
case 'i': // 16 bit Integer
i = va_arg(a, int);
if(i < 0) i = -i, putchar('-');
xtoa((unsigned)i, dv + 5);
break;
case 'u': // 16 bit Unsigned
i = va_arg(a, unsigned int);
xtoa((unsigned)i, dv + 5);
break;
case 'l': // 32 bit Long
if (*format == 'u' || *format == 'd')
{
format++;
// fallthrough
}
case 'n': // 32 bit uNsigned loNg
n = va_arg(a, long);
if(c == 'l' && n < 0) n = -n, putchar('-');
xtoa((unsigned long)n, dv);
break;
case 'p':
n = va_arg(a, long);
// 20bit pointer
puth(n >> 16, c);
puth(n >> 12, c);
puth(n >> 8, c);
puth(n >> 4, c);
puth(n, c);
break;
case 'X':
case 'x': // 16 bit heXadecimal
i = va_arg(a, int);
if (len == 4 || len == 0)
{
puth(i >> 12, c);
puth(i >> 8, c);
}
puth(i >> 4, c);
puth(i, c);
break;
case 0:
return 0;
default:
if (c > '0' && c <= '9')
{
len = c - '0';
goto retry;
}
goto bad_fmt;
}
}
else
{
bad_fmt:
putchar(c);
}
}
va_end(a);
return 0;
} |
/*##########################################################################
atarirle.h
Common RLE-based motion object management functions for early 90's
Atari raster games.
##########################################################################*/
#ifndef __ATARIRLE__
#define __ATARIRLE__
/*##########################################################################
CONSTANTS
##########################################################################*/
/* maximum number of motion object processors */
#define ATARIRLE_MAX 1
#define ATARIRLE_PRIORITY_SHIFT 12
#define ATARIRLE_BANK_SHIFT 15
#define ATARIRLE_PRIORITY_MASK ((~0 << ATARIRLE_PRIORITY_SHIFT) & 0xffff)
#define ATARIRLE_DATA_MASK (ATARIRLE_PRIORITY_MASK ^ 0xffff)
#define ATARIRLE_CONTROL_MOGO 1
#define ATARIRLE_CONTROL_ERASE 2
#define ATARIRLE_CONTROL_FRAME 4
#define ATARIRLE_COMMAND_NOP 0
#define ATARIRLE_COMMAND_DRAW 1
#define ATARIRLE_COMMAND_CHECKSUM 2
/*##########################################################################
TYPES & STRUCTURES
##########################################################################*/
/* description for an eight-word mask */
struct atarirle_entry
{
UINT16 data[8];
};
/* description of the motion objects */
struct atarirle_desc
{
UINT8 region; /* region where the GFX data lives */
UINT16 spriteramentries; /* number of entries in sprite RAM */
UINT16 leftclip; /* left clip coordinate */
UINT16 rightclip; /* right clip coordinate */
UINT16 palettebase; /* base palette entry */
UINT16 maxcolors; /* maximum number of colors */
struct atarirle_entry codemask; /* mask for the code index */
struct atarirle_entry colormask; /* mask for the color */
struct atarirle_entry xposmask; /* mask for the X position */
struct atarirle_entry yposmask; /* mask for the Y position */
struct atarirle_entry scalemask; /* mask for the scale factor */
struct atarirle_entry hflipmask; /* mask for the horizontal flip */
struct atarirle_entry ordermask; /* mask for the order */
struct atarirle_entry prioritymask; /* mask for the priority */
struct atarirle_entry vrammask; /* mask for the VRAM target */
};
/*##########################################################################
FUNCTION PROTOTYPES
##########################################################################*/
/* setup/shutdown */
int atarirle_init(int map, const struct atarirle_desc *desc);
/* control handlers */
void atarirle_control_w(int map, UINT8 bits);
void atarirle_command_w(int map, UINT8 command);
VIDEO_EOF( atarirle );
/* write handlers */
WRITE16_HANDLER( atarirle_0_spriteram_w );
WRITE32_HANDLER( atarirle_0_spriteram32_w );
/* render helpers */
mame_bitmap *atarirle_get_vram(int map, int idx);
/*##########################################################################
GLOBAL VARIABLES
##########################################################################*/
extern UINT16 *atarirle_0_spriteram;
extern UINT32 *atarirle_0_spriteram32;
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.