text
stringlengths 4
6.14k
|
|---|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65a.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.string.label.xml
Template File: sources-sink-65a.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate using malloc() and set data pointer to a small buffer
* GoodSource: Allocate using malloc() and set data pointer to a large buffer
* Sinks: snprintf
* BadSink : Copy string to data using snprintf
* 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>
#ifdef _WIN32
#define SNPRINTF _snprintf
#else
#define SNPRINTF snprintf
#endif
#ifndef OMITBAD
/* bad function declaration */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65b_badSink(char * data);
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65_bad()
{
char * data;
/* define a function pointer */
void (*funcPtr) (char *) = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65b_badSink;
data = NULL;
/* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */
data = (char *)malloc(50*sizeof(char));
if (data == NULL) {exit(-1);}
data[0] = '\0'; /* null terminate */
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65b_goodG2BSink(char * data);
static void goodG2B()
{
char * data;
void (*funcPtr) (char *) = CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65b_goodG2BSink;
data = NULL;
/* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */
data = (char *)malloc(100*sizeof(char));
if (data == NULL) {exit(-1);}
data[0] = '\0'; /* null terminate */
funcPtr(data);
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_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()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_snprintf_65_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef CAMERA_SETTINGS_H_
#define CAMERA_SETTINGS_H_
#ifndef _CYCLOPS_RESOLUTION_
#define _CYCLOPS_RESOLUTION_ 128
#endif
#define _CYCLOPS_RESOLUTION_H _CYCLOPS_RESOLUTION_ //non square not fully implimented yet
#define _CYCLOPS_RESOLUTION_W _CYCLOPS_RESOLUTION_
#ifndef _CYCLOPS_COLOR_DEPTH_
#define _CYCLOPS_COLOR_DEPTH_ 1 //1 for B&W
#endif //2 for YCbCr
//3 for RGB
#ifndef _CYCLOPS_IMAGE_NFRAMES_
#define _CYCLOPS_IMAGE_NFRAMES_ 1
#endif
#endif
|
// tools.h
//
// Copyright (c) 2014 Sébastien MICHOY
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer. Redistributions in binary
// form must reproduce the above copyright notice, this list of conditions and
// the following disclaimer in the documentation and/or other materials
// provided with the distribution. Neither the name of the nor the names of
// its contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef _TOOLS_H_
#define _TOOLS_H_
#include "main.h"
struct tabs_list
{
tab_type *tab_original;
tab_type *tab_cpy;
tab_type *tab_verified;
int tab_verified_filled;
};
float exec_sort(void(*sort)(tab_type *, unsigned int), char *name, struct tabs_list *tabs_list, unsigned int size);
void display_results(char *name, float **results, unsigned int tab_sizes_length, unsigned int number_of_tests);
void free_results(float ***results, unsigned int number_of_sorting, unsigned int tab_sizes_length);
void free_tabs(tab_type **tab_original, tab_type **tab_cpy, tab_type **tab_verified);
void generate_results(float ****results, unsigned int number_of_sorting, unsigned int tab_sizes_length, unsigned int number_of_tests);
void generate_tabs(tab_type **tab_original, tab_type **tab_cpy, tab_type **tab_verified, unsigned int size);
#endif
|
/*
FreeRTOS+TCP V2.0.7
Copyright (C) 2017 Amazon.com, Inc. or its affiliates. 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, 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.
http://aws.amazon.com/freertos
http://www.FreeRTOS.org
*/
/* Standard includes. */
#include <stdint.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_Sockets.h"
#include "NetworkBufferManagement.h"
/* Hardware includes. */
#include "hwEthernet.h"
/* Demo includes. */
#include "NetworkInterface.h"
#if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES != 1
#define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eProcessBuffer
#else
#define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eConsiderFrameForProcessing( ( pucEthernetBuffer ) )
#endif
/* When a packet is ready to be sent, if it cannot be sent immediately then the
task performing the transmit will block for niTX_BUFFER_FREE_WAIT
milliseconds. It will do this a maximum of niMAX_TX_ATTEMPTS before giving
up. */
#define niTX_BUFFER_FREE_WAIT ( ( TickType_t ) 2UL / portTICK_PERIOD_MS )
#define niMAX_TX_ATTEMPTS ( 5 )
/* The length of the queue used to send interrupt status words from the
interrupt handler to the deferred handler task. */
#define niINTERRUPT_QUEUE_LENGTH ( 10 )
/*-----------------------------------------------------------*/
/*
* A deferred interrupt handler task that processes
*/
extern void vEMACHandlerTask( void *pvParameters );
/*-----------------------------------------------------------*/
/* The queue used to communicate Ethernet events with the IP task. */
extern QueueHandle_t xNetworkEventQueue;
/* The semaphore used to wake the deferred interrupt handler task when an Rx
interrupt is received. */
SemaphoreHandle_t xEMACRxEventSemaphore = NULL;
/*-----------------------------------------------------------*/
BaseType_t xNetworkInterfaceInitialise( void )
{
BaseType_t xStatus, xReturn;
extern uint8_t ucMACAddress[ 6 ];
/* Initialise the MAC. */
vInitEmac();
while( lEMACWaitForLink() != pdPASS )
{
vTaskDelay( 20 );
}
vSemaphoreCreateBinary( xEMACRxEventSemaphore );
configASSERT( xEMACRxEventSemaphore );
/* The handler task is created at the highest possible priority to
ensure the interrupt handler can return directly to it. */
xTaskCreate( vEMACHandlerTask, "EMAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
xReturn = pdPASS;
return xReturn;
}
/*-----------------------------------------------------------*/
BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer )
{
extern void vEMACCopyWrite( uint8_t * pucBuffer, uint16_t usLength );
vEMACCopyWrite( pxNetworkBuffer->pucBuffer, pxNetworkBuffer->xDataLength );
/* Finished with the network buffer. */
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
return pdTRUE;
}
/*-----------------------------------------------------------*/
|
#ifndef PARSER_H_
#define PARSER_H_
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
class Parser
{
public:
void Init(const std::string &filename);
bool GetData(std::vector<double> &d);
private:
std::vector<std::vector<double> > data;
};
#endif
|
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Does nothing. Should be overridden by child.
*/
virtual void visit() { }
};
}
#endif
|
/****************************************************************************
**
** Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
**
** This file is part of the documentation of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://www.trolltech.com/products/qt/opensource.html
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://www.trolltech.com/products/qt/licensing.html or contact the
** sales department at sales@trolltech.com.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef CLIENT_H
#define CLIENT_H
#include <QTcpSocket>
#include <QtCore>
class QTcpSocket;
class Client : public QObject
{
Q_OBJECT
public:
Client();
~Client();
void sendMessage(signed short forward, signed short rotation, signed short upDown, bool emergencyButton, bool handControl);
void setConfig(QString hosts, int port);
private:
QTcpSocket *tcpSocket;
QDataStream *dataStream;
QString hosts;
int port;
void openConnection();
private slots:
void disconnected();
};
#endif
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef BERRYIWORKBENCHPARTREFERENCE_H_
#define BERRYIWORKBENCHPARTREFERENCE_H_
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryIPropertyChangeListener.h"
namespace berry {
struct IWorkbenchPart;
struct IWorkbenchPage;
/**
* \ingroup org_blueberry_ui_qt
*
* Implements a reference to a IWorkbenchPart.
* The IWorkbenchPart will not be instanciated until the part
* becomes visible or the API getPart is sent with true;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*/
struct BERRY_UI_QT IWorkbenchPartReference : public Object
{
berryObjectMacro(berry::IWorkbenchPartReference)
~IWorkbenchPartReference() override;
/**
* Returns the IWorkbenchPart referenced by this object.
* Returns <code>null</code> if the editors was not instantiated or
* it failed to be restored. Tries to restore the editor
* if <code>restore</code> is true.
*/
virtual SmartPointer<IWorkbenchPart> GetPart(bool restore) = 0;
/**
* @see IWorkbenchPart#getTitleImage
*/
virtual QIcon GetTitleImage() const = 0;
/**
* @see IWorkbenchPart#getTitleToolTip
*/
virtual QString GetTitleToolTip() const = 0;
/**
* @see IWorkbenchPartSite#getId
*/
virtual QString GetId() const = 0;
/**
* @see IWorkbenchPart#addPropertyListener
*/
virtual void AddPropertyListener(IPropertyChangeListener* listener) = 0;
/**
* @see IWorkbenchPart#removePropertyListener
*/
virtual void RemovePropertyListener(IPropertyChangeListener* listener) = 0;
/**
* Returns the workbench page that contains this part
*/
virtual SmartPointer<IWorkbenchPage> GetPage() const = 0;
/**
* Returns the name of the part, as it should be shown in tabs.
*
* @return the part name
*/
virtual QString GetPartName() const = 0;
/**
* Returns the content description for the part (or the empty string if none)
*
* @return the content description for the part
*/
virtual QString GetContentDescription() const = 0;
/**
* Returns true if the part is pinned otherwise returns false.
*/
virtual bool IsPinned() const = 0;
/**
* Returns whether the part is dirty (i.e. has unsaved changes).
*
* @return <code>true</code> if the part is dirty, <code>false</code> otherwise
*/
virtual bool IsDirty() const = 0;
/**
* Return an arbitrary property from the reference. If the part has been
* instantiated, it just delegates to the part. If not, then it looks in its
* own cache of properties. If the property is not available or the part has
* never been instantiated, it can return <code>null</code>.
*
* @param key
* The property to return. Must not be <code>null</code>.
* @return The String property, or <code>null</code>.
*/
virtual QString GetPartProperty(const QString& key) const = 0;
/**
* Add a listener for changes in the arbitrary properties set.
*
* @param listener
* Must not be <code>null</code>.
*/
//virtual void addPartPropertyListener(IPropertyChangeListener listener) = 0;
/**
* Remove a listener for changes in the arbitrary properties set.
*
* @param listener
* Must not be <code>null</code>.
*/
//virtual void removePartPropertyListener(IPropertyChangeListener listener) = 0;
};
} // namespace berry
#endif /*BERRYIWORKBENCHPARTREFERENCE_H_*/
|
/*
TxSSA: Tech-X Sparse Spectral Approximation
Copyright (C) 2012 Tech-X Corporation, 5621 Arapahoe Ave, Boulder CO 80303
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 Tech-X Corporation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
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.
*/
/*
Authors:
1. Chetan Jhurani (chetan.jhurani@gmail.com, jhurani@txcorp.com)
For more information and relevant publications, visit
http://www.ices.utexas.edu/~chetan/
2. Travis M. Austin (austin@txcorp.com)
Contact address:
Tech-X Corporation
5621 Arapahoe Ave
Boulder, CO 80303
http://www.txcorp.com
*/
#include "blas/blas_functions.h"
#include "fortran/fort_wrap_func_def.h"
FORT_WRAP_FUNC_DEF_all(BLAS, axpy, AXPY)
FORT_WRAP_FUNC_DEF_all(BLAS, copy, COPY)
FORT_WRAP_FUNC_DEF_all(BLAS, gemm, GEMM)
FORT_WRAP_FUNC_DEF_all(BLAS, gemv, GEMV)
FORT_WRAP_FUNC_DEF_all(BLAS, syrk, SYRK)
FORT_WRAP_FUNC_DEF_complex(BLAS, herk, HERK)
FORT_WRAP_FUNC_DEF_all(BLAS, symm, SYMM)
FORT_WRAP_FUNC_DEF_all(BLAS, trsm, TRSM)
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEPIXELACCESSOR_H
#define MITKIMAGEPIXELACCESSOR_H
#include "mitkImageDataItem.h"
#include "mitkImage.h"
namespace mitk {
/**
* @brief Provides templated image access for all inheriting classes
* @tparam TPixel defines the PixelType
* @tparam VDimension defines the dimension for accessing data
* @ingroup Data
*/
template <class TPixel, unsigned int VDimension = 3>
class ImagePixelAccessor
{
friend class Image;
public:
typedef itk::Index<VDimension> IndexType;
typedef ImagePixelAccessor<TPixel,VDimension> ImagePixelAccessorType;
typedef Image::ConstPointer ImageConstPointer;
/** Get Dimensions from ImageDataItem */
int GetDimension (int i) const
{
return m_ImageDataItem->GetDimension(i);
}
protected:
/** \param ImageDataItem* specifies the allocated image part */
ImagePixelAccessor(ImageConstPointer iP, const mitk::ImageDataItem* iDI)
: m_ImageDataItem(iDI)
{
if(iDI == nullptr)
{
m_ImageDataItem = iP->GetChannelData();
}
CheckData(iP.GetPointer());
}
/** Destructor */
virtual ~ImagePixelAccessor()
{
}
void CheckData(const Image* image)
{
// Check if Dimensions are correct
if(m_ImageDataItem == nullptr)
{
if(image->GetDimension() != VDimension)
{
mitkThrow() << "Invalid ImageAccessor: The Dimensions of ImageAccessor and Image are not equal. They have to be equal if an entire image is requested";
}
}
else
{
if(m_ImageDataItem->GetDimension() != VDimension)
{
mitkThrow() << "Invalid ImageAccessor: The Dimensions of ImageAccessor and ImageDataItem are not equal.";
}
}
// Check if PixelType is correct
if(!(image->GetPixelType() == mitk::MakePixelType< itk::Image<TPixel, VDimension> >()
|| image->GetPixelType() == mitk::MakePixelType< itk::VectorImage<TPixel, VDimension> >(image->GetPixelType().GetNumberOfComponents())) )
{
mitkThrow() << "Invalid ImageAccessor: PixelTypes of Image and ImageAccessor are not equal";
}
}
protected:
// protected members
/** Holds the specified ImageDataItem */
const ImageDataItem* m_ImageDataItem;
/** \brief Pointer to the used Geometry.
* Since Geometry can be different to the Image (if memory was forced to be coherent) it is necessary to store Geometry separately.
*/
BaseGeometry::Pointer m_Geometry;
/** \brief A Subregion defines an arbitrary area within the image.
* If no SubRegion is defined, the whole ImageDataItem or Image is regarded.
* A subregion (e.g. subvolume) can lead to non-coherent memory access where every dimension has a start- and end-offset.
*/
itk::ImageRegion<VDimension>* m_SubRegion;
/** \brief Stores all extended properties of an ImageAccessor.
* The different flags in mitk::ImageAccessorBase::Options can be unified by bitwise operations.
*/
int m_Options;
/** Get memory offset for a given image index */
unsigned int GetOffset(const IndexType & idx) const
{
const unsigned int * imageDims = m_ImageDataItem->m_Dimensions;
unsigned int offset = 0;
switch(VDimension)
{
case 4:
offset += idx[3]*imageDims[0]*imageDims[1]*imageDims[2];
case 3:
offset += idx[2]*imageDims[0]*imageDims[1];
case 2:
offset += idx[0] + idx[1]*imageDims[0];
break;
}
return offset;
}
};
}
#endif // MITKIMAGEACCESSOR_H
|
// Copyright 2017-present 650 Industries. All rights reserved.
#import <ABI43_0_0ExpoModulesCore/ABI43_0_0EXPermissionsInterface.h>
@interface ABI43_0_0EXFacebookAdsAppTrackingPermissionRequester : NSObject<ABI43_0_0EXPermissionsRequester>
@end
|
/*****************************************************************************
Copyright (c) 2011, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function dtrsen
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/
#include "lapacke.h"
#include "lapacke_utils.h"
lapack_int LAPACKE_dtrsen_work( int matrix_order, char job, char compq,
const lapack_logical* select, lapack_int n,
double* t, lapack_int ldt, double* q,
lapack_int ldq, double* wr, double* wi,
lapack_int* m, double* s, double* sep,
double* work, lapack_int lwork,
lapack_int* iwork, lapack_int liwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_dtrsen( &job, &compq, select, &n, t, &ldt, q, &ldq, wr, wi, m, s,
sep, work, &lwork, iwork, &liwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int ldq_t = MAX(1,n);
lapack_int ldt_t = MAX(1,n);
double* t_t = NULL;
double* q_t = NULL;
/* Check leading dimension(s) */
if( ldq < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_dtrsen_work", info );
return info;
}
if( ldt < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_dtrsen_work", info );
return info;
}
/* Allocate memory for temporary array T */
t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
if( t_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrix T */
LAPACKE_dge_trans( matrix_order, n, n, t, ldt, t_t, ldt_t );
/* Query optimal working array(s) size if requested */
if( liwork == -1 || lwork == -1 ) {
LAPACK_dtrsen( &job, &compq, select, &n, t_t, &ldt_t, q, &ldq_t, wr,
wi, m, s, sep, work, &lwork, iwork, &liwork, &info );
LAPACKE_free( t_t );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
if( LAPACKE_lsame( compq, 'v' ) ) {
q_t = (double*)LAPACKE_malloc( sizeof(double) * ldq_t * MAX(1,n) );
if( q_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
if( LAPACKE_lsame( compq, 'v' ) ) {
LAPACKE_dge_trans( matrix_order, n, n, q, ldq, q_t, ldq_t );
}
/* Call LAPACK function and adjust info */
LAPACK_dtrsen( &job, &compq, select, &n, t_t, &ldt_t, q_t, &ldq_t, wr,
wi, m, s, sep, work, &lwork, iwork, &liwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, t_t, ldt_t, t, ldt );
if( LAPACKE_lsame( compq, 'v' ) ) {
LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
}
/* Release memory and exit */
if( LAPACKE_lsame( compq, 'v' ) ) {
LAPACKE_free( q_t );
}
exit_level_1:
LAPACKE_free( t_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dtrsen_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_dtrsen_work", info );
}
return info;
}
|
// 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.
// This file is of the same format as file that generated by
// base/android/jni_generator/jni_generator.py
// For
// com/google/vr/cardboard/DisplaySynchronizer
// Local modification includes:
// 1. Remove all implementaiton, only keep definition.
// 2. Use absolute path instead of relative path.
// 3. Removed all helper functions such as: Create.
// 4. Added function RegisterDisplaySynchronizerNatives at the end of this file.
#ifndef com_google_vr_cardboard_DisplaySynchronizer_JNI
#define com_google_vr_cardboard_DisplaySynchronizer_JNI
#include "base/android/jni_android.h"
// ----------------------------------------------------------------------------
// Native JNI methods
// ----------------------------------------------------------------------------
#include <jni.h>
#include <atomic>
#include <type_traits>
#include "base/android/jni_generator/jni_generator_helper.h"
#include "base/android/jni_int_wrapper.h"
// Step 1: forward declarations.
namespace {
const char kDisplaySynchronizerClassPath[] =
"com/google/vr/cardboard/DisplaySynchronizer";
// Leaking this jclass as we cannot use LazyInstance from some threads.
std::atomic<jclass> g_DisplaySynchronizer_clazz __attribute__((unused))
(nullptr);
#define DisplaySynchronizer_clazz(env) \
base::android::LazyGetClass(env, kDisplaySynchronizerClassPath, \
&g_DisplaySynchronizer_clazz)
} // namespace
namespace DisplaySynchronizer {
extern "C" __attribute__((visibility("default"))) jlong
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate(
JNIEnv* env,
jobject jcaller,
jclass classLoader,
jobject appContext);
// Step 2: method stubs.
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer,
jlong expectedInterval,
jlong vsyncOffset);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate(
JNIEnv* env,
jobject jcaller,
jlong nativeDisplaySynchronizer,
jlong syncTime,
jint currentRotation);
extern "C" __attribute__((visibility("default"))) void
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeOnMetricsChanged(
JNIEnv* env,
jobject obj,
jlong native_object);
// Step 3: RegisterNatives.
static const JNINativeMethod kMethodsDisplaySynchronizer[] = {
{"nativeCreate",
"("
"Ljava/lang/ClassLoader;"
"Landroid/content/Context;"
")"
"J",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeCreate)},
{"nativeDestroy",
"("
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeDestroy)},
{"nativeReset",
"("
"J"
"J"
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeReset)},
{"nativeUpdate",
"("
"J"
"J"
"I"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeUpdate)},
{"nativeOnMetricsChanged",
"("
"J"
")"
"V",
reinterpret_cast<void*>(
Java_com_google_vr_cardboard_DisplaySynchronizer_nativeOnMetricsChanged)},
};
static bool RegisterNativesImpl(JNIEnv* env) {
if (base::android::IsSelectiveJniRegistrationEnabled(env))
return true;
const int kMethodsDisplaySynchronizerSize =
std::extent<decltype(kMethodsDisplaySynchronizer)>();
if (env->RegisterNatives(DisplaySynchronizer_clazz(env),
kMethodsDisplaySynchronizer,
kMethodsDisplaySynchronizerSize) < 0) {
jni_generator::HandleRegistrationError(env, DisplaySynchronizer_clazz(env),
__FILE__);
return false;
}
return true;
}
static bool RegisterDisplaySynchronizerNatives(JNIEnv* env) {
return RegisterNativesImpl(env);
}
} // namespace DisplaySynchronizer
#endif // com_google_vr_cardboard_DisplaySynchronizer_JNI
|
/*
* Copyright (c) 2009, Cybozu Labs, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the <ORGANIZATION> nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <Python.h>
#include <errno.h>
#include <sys/epoll.h>
#include <unistd.h>
#include "picoev.h"
#include "time_cache.h"
#ifndef PICOEV_EPOLL_DEFER_DELETES
# define PICOEV_EPOLL_DEFER_DELETES 1
#endif
typedef struct picoev_loop_epoll_st {
picoev_loop loop;
int epfd;
struct epoll_event events[1024];
} picoev_loop_epoll;
picoev_globals picoev;
picoev_loop* picoev_create_loop(int max_timeout)
{
picoev_loop_epoll* loop;
/* init parent */
assert(PICOEV_IS_INITED);
if ((loop = (picoev_loop_epoll*)malloc(sizeof(picoev_loop_epoll))) == NULL) {
return NULL;
}
if (picoev_init_loop_internal(&loop->loop, max_timeout) != 0) {
free(loop);
return NULL;
}
/* init myself */
if ((loop->epfd = epoll_create(picoev.max_fd)) == -1) {
picoev_deinit_loop_internal(&loop->loop);
free(loop);
return NULL;
}
loop->loop.now = current_msec / 1000;
return &loop->loop;
}
int picoev_destroy_loop(picoev_loop* _loop)
{
picoev_loop_epoll* loop = (picoev_loop_epoll*)_loop;
if (close(loop->epfd) != 0) {
return -1;
}
picoev_deinit_loop_internal(&loop->loop);
free(loop);
return 0;
}
int picoev_update_events_internal(picoev_loop* _loop, int fd, int events)
{
picoev_loop_epoll* loop = (picoev_loop_epoll*)_loop;
picoev_fd* target = picoev.fds + fd;
struct epoll_event ev;
int epoll_ret;
assert(PICOEV_FD_BELONGS_TO_LOOP(&loop->loop, fd));
if (unlikely((events & PICOEV_READWRITE) == target->events)) {
return 0;
}
ev.events = ((events & PICOEV_READ) != 0 ? EPOLLIN : 0)
| ((events & PICOEV_WRITE) != 0 ? EPOLLOUT : 0);
ev.data.fd = fd;
#define SET(op, check_error) do { \
epoll_ret = epoll_ctl(loop->epfd, op, fd, &ev); \
assert(! check_error || epoll_ret == 0); \
} while (0)
#if PICOEV_EPOLL_DEFER_DELETES
if ((events & PICOEV_DEL) != 0) {
/* nothing to do */
} else if ((events & PICOEV_READWRITE) == 0) {
SET(EPOLL_CTL_DEL, 1);
} else {
SET(EPOLL_CTL_MOD, 0);
if (epoll_ret != 0) {
assert(errno == ENOENT);
SET(EPOLL_CTL_ADD, 1);
}
}
#else
if ((events & PICOEV_READWRITE) == 0) {
SET(EPOLL_CTL_DEL, 1);
} else {
SET(target->events == 0 ? EPOLL_CTL_ADD : EPOLL_CTL_MOD, 1);
}
#endif
#undef SET
target->events = events;
return 0;
}
int picoev_poll_once_internal(picoev_loop* _loop, int max_wait)
{
picoev_loop_epoll* loop = (picoev_loop_epoll*)_loop;
int i, nevents;
Py_BEGIN_ALLOW_THREADS
nevents = epoll_wait(loop->epfd, loop->events,
sizeof(loop->events) / sizeof(loop->events[0]),
max_wait * 1000);
Py_END_ALLOW_THREADS
cache_time_update();
if (nevents == -1) {
return -1;
}
for (i = 0; likely(i < nevents); ++i) {
struct epoll_event* event = loop->events + i;
picoev_fd* target = picoev.fds + event->data.fd;
if (loop->loop.loop_id == target->loop_id && likely((target->events & PICOEV_READWRITE) != 0)) {
int revents = ((event->events & EPOLLIN) != 0 ? PICOEV_READ : 0) | ((event->events & EPOLLOUT) != 0 ? PICOEV_WRITE : 0);
if (likely(revents != 0)) {
(*target->callback)(&loop->loop, event->data.fd, revents, target->cb_arg);
}
} else {
#if PICOEV_EPOLL_DEFER_DELETES
event->events = 0;
epoll_ctl(loop->epfd, EPOLL_CTL_DEL, event->data.fd, event);
#endif
}
}
return 0;
}
|
#include <stdio.h>
#include <stdlib.h>
#include "Logging.h"
#include "memutils.h"
#include "path.h"
int main(int argc, char *argv[]){
char *currDir = NULL;
char relPath[] = "../doc";
char testPart[] = "/foo/bar/test.txt";
char *filePart = NULL;
char *newDir = NULL;
Logging_setup(argv[0], LOG_TOSTDERR | LOG_LEVELTRACE, NULL);
currDir = getCurrentDirectory();
Logging_infof("Current directory is: \"%s\"", currDir);
newDir = getCombinedPath(currDir, relPath);
Logging_infof("Doc directory is: \"%s\"", newDir);
filePart = getPathPart(testPart, PATH_FILE);
Logging_infof("The file part of \"%s\" with extension is: \"%s\"",
testPart, filePart);
mu_free(filePart);
filePart = getPathPart(testPart, PATH_FILEONLY);
Logging_infof("The file part of \"%s\" without extension is: \"%s\"",
testPart, filePart);
mu_free(filePart);
mu_free(newDir);
mu_free(currDir);
exit(EXIT_SUCCESS);
}
|
#ifndef edan_internal_variant_layout_base_h_
#define edan_internal_variant_layout_base_h_
#include<utility>
#include<memory>
#include<vector>
#include<variant>
#include<string>
namespace edan {
template < //class Self,
class Tb_
>
class basic_layout_dataset_variant_base
{
public:
std::variant < std::vector<int>,
std::vector<double>,
std::vector<std::string>
> __data;
public:
basic_layout_dataset_variant_base() noexcept
{ }
basic_layout_dataset_variant_base(Tb_&& data) noexcept
: __data(std::move(data))
{ }
basic_layout_dataset_variant_base(const Tb_& data) noexcept
: __data(data)
{ }
/*
basic_layout_dataset_variant_base(std::vector<Tp_> vec) noexcept
: __data(vec)
{ }
*/
/*
auto& operator[](int idx)
{
std::variant < int,
double,
std::string
> my_variant(__data[]);
if(__data.index()==0)
{
my_variant = std::get<0>(__data)[idx];
return std::get<0>(my_variant);
}
else if(__data.index()==1)
{
my_variant = std::get<1>(__data)[idx];
return std::get<1>(my_variant);
}
else if(__data.index()==2)
{
my_variant = std::get<2>(__data)[idx];
return std::get<2>(my_variant);
}
}
const auto& operator[](int _idx) const
{
return std::get<0>(__data)[_idx];
}
*/
/*
basic_layout_dataset_variant_base(const Self& other) noexcept
: __data(other.__data)
{ }
basic_layout_dataset_variant_base(const Self&& other) noexcept
: __data(std::move(other.__data))
{ }
Self& operator=(const Self& other) noexcept
{
__data = other.__data;
return *this;
}
Self& operator=(const Self&& other) noexcept
{
__data = std::move(other.__data);
return *this;
}
*/
// Need to rewrite function
auto& data() const noexcept
{
return __data;
}
auto& data() noexcept
{
return __data;
}
// overloading == operator?
//
};
}
#endif
|
#ifndef DALE_LEXER
#define DALE_LEXER
#include <vector>
#include "../Error/Error.h"
#include "../Token/Token.h"
#include "../Utils/Utils.h"
namespace dale {
/*! Lexer
The lexer class. A new lexer should be created for each file: see
Unit.
*/
class Lexer {
private:
/*! The file pointer for the current file. */
FILE *file;
/*! The current position. */
Position current;
/*! A stack of "ungot" tokens. See ungetToken. */
std::vector<Token *> ungot_tokens;
/*! The file buffer. */
char buf[8193];
/*! The number of bytes remaining to be processed from buf. */
int count;
/*! The index of the next byte to be processed from buf. */
int index;
/*! Whether buf was last populated by pushText. */
bool been_pushed;
/*! Whether the current position needs to be reset. */
bool reset_position;
/*! Whether to process input line-by-line. */
bool line_buffered;
/*! Get the next character. */
int getchar_();
/*! Unget a character. */
void ungetchar_(char c);
public:
/*! Construct a new lexer.
* @param file The file to read.
* @param line_buffered Whether to process input line-by-line.
*/
explicit Lexer(FILE *file, bool line_buffered = false);
~Lexer();
/*! Get the next token.
* @param token The token buffer.
* @param error The error buffer.
*
* On success, token will be populated. On failure, error will
* be set accordingly, and token will be in an indeterminate
* state.
*/
bool getNextToken(Token *token, Error *error);
/*! Unget the token.
* @param token The token.
*
* This copies the token.
*/
void ungetToken(Token *token);
/*! Push text into the lexer.
* @param str The text.
*
* This must be done before any data is read from the lexer.
*/
void pushText(const char *text);
};
}
#endif
|
#ifndef __UI_EDITOR_INTROSPECTION_PROPERTY__
#define __UI_EDITOR_INTROSPECTION_PROPERTY__
#include "ValueProperty.h"
namespace DAVA
{
class UIControl;
class UIDataBindingComponent;
class UILayoutSourceRectComponent;
}
class IntrospectionProperty : public ValueProperty
{
public:
IntrospectionProperty(DAVA::BaseObject* object, const DAVA::Type* componentType, const DAVA::String& name, const DAVA::Reflection& ref, const IntrospectionProperty* prototypeProperty);
protected:
IntrospectionProperty(DAVA::BaseObject* object, DAVA::int32 componentType, const DAVA::String& name, const DAVA::Reflection& ref, const IntrospectionProperty* prototypeProperty);
virtual ~IntrospectionProperty();
public:
static IntrospectionProperty* Create(DAVA::BaseObject* object, const DAVA::Type* componentType, const DAVA::String& name, const DAVA::Reflection& ref, const IntrospectionProperty* sourceProperty);
void Accept(PropertyVisitor* visitor) override;
DAVA::uint32 GetFlags() const override;
ePropertyType GetType() const override;
const EnumMap* GetEnumMap() const override;
const DAVA::String& GetDisplayName() const override;
DAVA::Any GetValue() const override;
DAVA::Any GetSerializationValue() const override;
DAVA::BaseObject* GetBaseObject() const
{
return object;
}
void DisableResetFeature();
void ResetValue() override;
void Refresh(DAVA::int32 refreshFlags) override;
bool IsBindable() const override;
bool IsBound() const override;
DAVA::int32 GetBindingUpdateMode() const override;
DAVA::String GetBindingExpression() const override;
void SetBindingExpression(const DAVA::String& expression, DAVA::int32 bindingUpdateMode) override;
DAVA::String GetFullFieldName() const;
bool HasError() const override;
DAVA::String GetErrorString() const override;
bool IsReadOnly() const override;
void ComponentWithPropertyWasInstalled();
void ComponentWithPropertyWasUninstalled();
protected:
void SetBindingExpressionImpl(const DAVA::String& expression, DAVA::int32 bindingUpdateMode);
void ResetBindingExpression();
void ApplyValue(const DAVA::Any& value) override;
DAVA::BaseObject* object = nullptr;
DAVA::Reflection reflection;
DAVA::int32 flags;
DAVA::String bindingExpression;
DAVA::int32 bindingMode = 0;
bool forceReadOnly = false;
private:
DAVA::UIControl* GetLinkedControl();
bool bindable = false;
bool bound = false;
const DAVA::Type* componentType = nullptr;
DAVA::RefPtr<DAVA::UIDataBindingComponent> bindingComponent;
void SetLayoutSourceRectValue(const DAVA::Any& value);
DAVA::RefPtr<DAVA::UILayoutSourceRectComponent> sourceRectComponent;
};
#endif //__UI_EDITOR_INTROSPECTION_PROPERTY__
|
/**
Copyright 2009-2017 National Technology and Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA-0003525, the U.S. Government
retains certain rights in this software.
Sandia National Laboratories is a multimission laboratory managed and operated
by National Technology and Engineering Solutions of Sandia, LLC., a wholly
owned subsidiary of Honeywell International, Inc., for the U.S. Department of
Energy's National Nuclear Security Administration under contract DE-NA0003525.
Copyright (c) 2009-2017, NTESS
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 Sandia Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Questions? Contact sst-macro-help@sandia.gov
*/
#ifndef SERIALIZE_ARRAY_H
#define SERIALIZE_ARRAY_H
#include <sprockit/serializer.h>
namespace sprockit {
namespace pvt {
template <class TPtr, class IntType>
class ser_array_wrapper
{
public:
TPtr& bufptr;
IntType& sizeptr;
ser_array_wrapper(TPtr& buf, IntType& size) :
bufptr(buf), sizeptr(size) {}
};
template <class TPtr>
class raw_ptr_wrapper
{
public:
TPtr*& bufptr;
raw_ptr_wrapper(TPtr*& ptr) :
bufptr(ptr) {}
};
}
template <class T, int N>
class serialize<T[N]> {
public:
void operator()(T arr[N], serializer& ser){
ser.array<T,N>(arr);
}
};
/** I have typedefing pointers, but no other way.
* T could be "void and TPtr void* */
template <class TPtr, class IntType>
pvt::ser_array_wrapper<TPtr,IntType>
array(TPtr& buf, IntType& size)
{
return pvt::ser_array_wrapper<TPtr,IntType>(buf, size);
}
template <class TPtr>
inline pvt::raw_ptr_wrapper<TPtr>
raw_ptr(TPtr*& ptr)
{
return pvt::raw_ptr_wrapper<TPtr>(ptr);
}
template <class TPtr, class IntType>
inline void
operator&(serializer& ser, pvt::ser_array_wrapper<TPtr,IntType> arr){
ser.binary(arr.bufptr, arr.sizeptr);
}
// Needed only because the default version in serialize.h can't get
// the template expansions quite right trying to look through several
// levels of expansion
template <class TPtr>
inline void
operator&(serializer& ser, pvt::raw_ptr_wrapper<TPtr> ptr){
ser.primitive(ptr.bufptr);
}
}
#endif // SERIALIZE_ARRAY_H
|
/* dlasq5.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Subroutine */ int dlasq5_(integer *i0, integer *n0, doublereal *z__,
integer *pp, doublereal *tau, doublereal *dmin__, doublereal *dmin1,
doublereal *dmin2, doublereal *dn, doublereal *dnm1, doublereal *dnm2,
logical *ieee)
{
/* System generated locals */
integer i__1;
doublereal d__1, d__2;
/* Local variables */
doublereal d__;
integer j4, j4p2;
doublereal emin, temp;
/* -- LAPACK routine (version 3.2) -- */
/* -- Contributed by Osni Marques of the Lawrence Berkeley National -- */
/* -- Laboratory and Beresford Parlett of the Univ. of California at -- */
/* -- Berkeley -- */
/* -- November 2008 -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* Purpose */
/* ======= */
/* DLASQ5 computes one dqds transform in ping-pong form, one */
/* version for IEEE machines another for non IEEE machines. */
/* Arguments */
/* ========= */
/* I0 (input) INTEGER */
/* First index. */
/* N0 (input) INTEGER */
/* Last index. */
/* Z (input) DOUBLE PRECISION array, dimension ( 4*N ) */
/* Z holds the qd array. EMIN is stored in Z(4*N0) to avoid */
/* an extra argument. */
/* PP (input) INTEGER */
/* PP=0 for ping, PP=1 for pong. */
/* TAU (input) DOUBLE PRECISION */
/* This is the shift. */
/* DMIN (output) DOUBLE PRECISION */
/* Minimum value of d. */
/* DMIN1 (output) DOUBLE PRECISION */
/* Minimum value of d, excluding D( N0 ). */
/* DMIN2 (output) DOUBLE PRECISION */
/* Minimum value of d, excluding D( N0 ) and D( N0-1 ). */
/* DN (output) DOUBLE PRECISION */
/* d(N0), the last value of d. */
/* DNM1 (output) DOUBLE PRECISION */
/* d(N0-1). */
/* DNM2 (output) DOUBLE PRECISION */
/* d(N0-2). */
/* IEEE (input) LOGICAL */
/* Flag for IEEE or non IEEE arithmetic. */
/* ===================================================================== */
/* Parameter adjustments */
--z__;
/* Function Body */
if (*n0 - *i0 - 1 <= 0) {
return 0;
}
j4 = (*i0 << 2) + *pp - 3;
emin = z__[j4 + 4];
d__ = z__[j4] - *tau;
*dmin__ = d__;
*dmin1 = -z__[j4];
if (*ieee) {
/* Code for IEEE arithmetic. */
if (*pp == 0) {
i__1 = *n0 - 3 << 2;
for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
z__[j4 - 2] = d__ + z__[j4 - 1];
temp = z__[j4 + 1] / z__[j4 - 2];
d__ = d__ * temp - *tau;
*dmin__ = min(*dmin__,d__);
z__[j4] = z__[j4 - 1] * temp;
/* Computing MIN */
d__1 = z__[j4];
emin = min(d__1,emin);
}
} else {
i__1 = *n0 - 3 << 2;
for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
z__[j4 - 3] = d__ + z__[j4];
temp = z__[j4 + 2] / z__[j4 - 3];
d__ = d__ * temp - *tau;
*dmin__ = min(*dmin__,d__);
z__[j4 - 1] = z__[j4] * temp;
/* Computing MIN */
d__1 = z__[j4 - 1];
emin = min(d__1,emin);
}
}
/* Unroll last two steps. */
*dnm2 = d__;
*dmin2 = *dmin__;
j4 = (*n0 - 2 << 2) - *pp;
j4p2 = j4 + (*pp << 1) - 1;
z__[j4 - 2] = *dnm2 + z__[j4p2];
z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
*dnm1 = z__[j4p2 + 2] * (*dnm2 / z__[j4 - 2]) - *tau;
*dmin__ = min(*dmin__,*dnm1);
*dmin1 = *dmin__;
j4 += 4;
j4p2 = j4 + (*pp << 1) - 1;
z__[j4 - 2] = *dnm1 + z__[j4p2];
z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
*dn = z__[j4p2 + 2] * (*dnm1 / z__[j4 - 2]) - *tau;
*dmin__ = min(*dmin__,*dn);
} else {
/* Code for non IEEE arithmetic. */
if (*pp == 0) {
i__1 = *n0 - 3 << 2;
for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
z__[j4 - 2] = d__ + z__[j4 - 1];
if (d__ < 0.) {
return 0;
} else {
z__[j4] = z__[j4 + 1] * (z__[j4 - 1] / z__[j4 - 2]);
d__ = z__[j4 + 1] * (d__ / z__[j4 - 2]) - *tau;
}
*dmin__ = min(*dmin__,d__);
/* Computing MIN */
d__1 = emin, d__2 = z__[j4];
emin = min(d__1,d__2);
}
} else {
i__1 = *n0 - 3 << 2;
for (j4 = *i0 << 2; j4 <= i__1; j4 += 4) {
z__[j4 - 3] = d__ + z__[j4];
if (d__ < 0.) {
return 0;
} else {
z__[j4 - 1] = z__[j4 + 2] * (z__[j4] / z__[j4 - 3]);
d__ = z__[j4 + 2] * (d__ / z__[j4 - 3]) - *tau;
}
*dmin__ = min(*dmin__,d__);
/* Computing MIN */
d__1 = emin, d__2 = z__[j4 - 1];
emin = min(d__1,d__2);
}
}
/* Unroll last two steps. */
*dnm2 = d__;
*dmin2 = *dmin__;
j4 = (*n0 - 2 << 2) - *pp;
j4p2 = j4 + (*pp << 1) - 1;
z__[j4 - 2] = *dnm2 + z__[j4p2];
if (*dnm2 < 0.) {
return 0;
} else {
z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
*dnm1 = z__[j4p2 + 2] * (*dnm2 / z__[j4 - 2]) - *tau;
}
*dmin__ = min(*dmin__,*dnm1);
*dmin1 = *dmin__;
j4 += 4;
j4p2 = j4 + (*pp << 1) - 1;
z__[j4 - 2] = *dnm1 + z__[j4p2];
if (*dnm1 < 0.) {
return 0;
} else {
z__[j4] = z__[j4p2 + 2] * (z__[j4p2] / z__[j4 - 2]);
*dn = z__[j4p2 + 2] * (*dnm1 / z__[j4 - 2]) - *tau;
}
*dmin__ = min(*dmin__,*dn);
}
z__[j4 + 2] = *dn;
z__[(*n0 << 2) - *pp] = emin;
return 0;
/* End of DLASQ5 */
} /* dlasq5_ */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__char_min_postdec_03.c
Label Definition File: CWE191_Integer_Underflow.label.xml
Template File: sources-sinks-03.tmpl.c
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: min Set data to the min value for char
* GoodSource: Set data to a small, non-zero number (negative two)
* Sinks: decrement
* GoodSink: Ensure there will not be an underflow before decrementing data
* BadSink : Decrement data, which can cause an Underflow
* Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE191_Integer_Underflow__char_min_postdec_03_bad()
{
char data;
data = ' ';
if(5==5)
{
/* POTENTIAL FLAW: Use the minimum size of the data type */
data = CHAR_MIN;
}
if(5==5)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
char result = data;
printHexCharLine(result);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second 5==5 to 5!=5 */
static void goodB2G1()
{
char data;
data = ' ';
if(5==5)
{
/* POTENTIAL FLAW: Use the minimum size of the data type */
data = CHAR_MIN;
}
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Add a check to prevent an underflow from occurring */
if (data > CHAR_MIN)
{
data--;
char result = data;
printHexCharLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
char data;
data = ' ';
if(5==5)
{
/* POTENTIAL FLAW: Use the minimum size of the data type */
data = CHAR_MIN;
}
if(5==5)
{
/* FIX: Add a check to prevent an underflow from occurring */
if (data > CHAR_MIN)
{
data--;
char result = data;
printHexCharLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodG2B1() - use goodsource and badsink by changing the first 5==5 to 5!=5 */
static void goodG2B1()
{
char data;
data = ' ';
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */
data = -2;
}
if(5==5)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
char result = data;
printHexCharLine(result);
}
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
char data;
data = ' ';
if(5==5)
{
/* FIX: Use a small, non-zero value that will not cause an underflow in the sinks */
data = -2;
}
if(5==5)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
char result = data;
printHexCharLine(result);
}
}
}
void CWE191_Integer_Underflow__char_min_postdec_03_good()
{
goodB2G1();
goodB2G2();
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()...");
CWE191_Integer_Underflow__char_min_postdec_03_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE191_Integer_Underflow__char_min_postdec_03_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#import "DBStatusBackgroundView.h"
#import "DBStatusBarItemView.h"
@class DBStatusWindowController;
@protocol PanelControllerDelegate <NSObject>
@optional
- (DBStatusBarItemView *)statusItemViewForPanelController:(DBStatusWindowController *)controller;
@end
#pragma mark -
@interface DBStatusWindowController : NSWindowController <NSWindowDelegate>
@property (nonatomic, assign) IBOutlet DBStatusBackgroundView *backgroundView;
@property (nonatomic, assign) BOOL hasActivePanel;
@property (nonatomic, assign) id<PanelControllerDelegate> delegate;
- (id)initWithDelegate:(id<PanelControllerDelegate>)delegate windowNibName:(NSString *)windowNibName;
- (NSTimeInterval)openPanelWithDuration:(NSTimeInterval)duration;
- (NSTimeInterval)openPanel;
- (void)closePanel;
- (void)windowResized:(NSWindow *)aWindow;
@end
|
//
// Created by mwo on 6/11/15.
//
#ifndef XMREG01_CMDLINEOPTIONS_H
#define XMREG01_CMDLINEOPTIONS_H
#include <iostream>
#include <string>
#include <boost/program_options.hpp>
#include <boost/optional.hpp>
namespace xmreg
{
using namespace std;
using namespace boost::program_options;
/**
* Manages program options of this example program.
*
* Basically a wrapper for boost::program_options
*/
class CmdLineOptions {
variables_map vm;
public:
CmdLineOptions(int acc, const char *avv[]);
template<typename T>
boost::optional<T> get_option(const string & opt_name) const;
};
}
#endif //XMREG01_CMDLINEOPTIONS_H
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "Buttons/Button.h"
class InternalButton : public Button {
public:
InternalButton() = default;
explicit InternalButton(bool inverted);
virtual ~InternalButton() = default;
void SetInverted(bool inverted);
void SetPressed(bool pressed);
virtual bool Get();
private:
bool m_pressed = false;
bool m_inverted = false;
};
|
/* process text input from stdin
write parsed output to stdout
utterances terminated with newline
type "quit" to exit
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "parse.h"
#include "pconf.h"
#include "globals_parse.h"
void strip_line();
extern char dict_file[LABEL_LEN],
priority_file[LABEL_LEN],
frames_file[LABEL_LEN],
*grammar_file;
static char line[LINE_LEN]; /* input line buffer */
static char outbuf[10000], /* output text buffer for parses */
*out_ptr= outbuf;
static int utt_num;
int main(argc, argv)
int argc;
char **argv;
{
FILE *fp;
char *s;
int i;
/* set command line or config file parms */
config(argc, argv);
/* read grammar, initialize parser, malloc space, etc */
init_parse(dir, dict_file, grammar_file, frames_file, priority_file);
/* terminal input */
fp= stdin; fprintf(stderr, "READY\n");
/* for each utterance */
for( utt_num= 1; fgets(line, LINE_LEN-1, fp); ) {
/* if printing comment */
if (*line == ';' ) { printf("%s\n", line); continue; }
/* if non-printing comment */
if (*line == '#' ) { continue; }
/* if blank line */
for(s= line; isspace((int)*s); s++); if( strlen(s) < 2 ) continue;
/* strip out punctuation, comments, etc, to uppercase */
strip_line(line);
/* check for terminate */
if( !strncmp(line, "QUIT", 4) ) exit(1);
/* clear output buffer */
out_ptr= outbuf; *out_ptr= 0;
/* echo the line */
if (verbose > 1){
sprintf(out_ptr, ";;;%d %s\n", utt_num, line);
out_ptr += strlen(out_ptr);
}
/* assign word strings to slots in frames */
parse(line, gram);
if( PROFILE ) print_profile();
/* print parses to buffer */
if( num_parses > MAX_PARSES ) num_parses= MAX_PARSES;
if( ALL_PARSES ) {
for(i= 0; i < num_parses; i++ ) {
sprintf(out_ptr, "PARSE_%d:\n", i);
out_ptr += strlen(out_ptr);
print_parse(i, out_ptr, extract, gram);
out_ptr += strlen(out_ptr);
sprintf(out_ptr, "END_PARSE\n");
out_ptr += strlen(out_ptr);
}
}
else {
print_parse(0, out_ptr, extract, gram);
out_ptr += strlen(out_ptr);
}
sprintf(out_ptr, "\n");
out_ptr += strlen(out_ptr);
if( verbose ) {
if( num_parses > 0) printf("%s", outbuf);
fflush(stdout);
}
/* clear parser temps */
reset(num_nets);
utt_num++;
}
return(1);
}
void strip_line(line)
char *line;
{
char *from, *to;
for(from= to= line; ;from++ ) {
if( !(*from) ) break;
switch(*from) {
/* filter these out */
case '(' :
case ')' :
case '[' :
case ']' :
case ':' :
case ';' :
case '?' :
case '!' :
case '\n' :
break;
/* replace with space */
case ',' :
case '\\' :
*to++ = ' ';
break;
case '#' :
for( ++from; *from != '#' && *from; from++);
if( *from == '#' ) from++;
break;
case '-' :
/* if partial word, delete word */
if( isspace( (int) *(from+1) ) ) {
while( (to != line) && !isspace( (int) *(--to) ) ) ;
/* replace with space */
*to++ = ' ';
}
else {
/* copy char */
*to++ = *from;
}
break;
default:
/* copy char */
*to++ = (islower((int)*from)) ? (char) toupper((int)*from) : *from;
}
if( !from ) break;
}
*to= 0;
}
|
// 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 CHROMEOS_NETWORK_MOCK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
#define CHROMEOS_NETWORK_MOCK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
#include "base/basictypes.h"
#include "base/values.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/managed_network_configuration_handler.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
class CHROMEOS_EXPORT MockManagedNetworkConfigurationHandler
: public ManagedNetworkConfigurationHandler {
public:
MockManagedNetworkConfigurationHandler();
virtual ~MockManagedNetworkConfigurationHandler();
// ManagedNetworkConfigurationHandler overrides
MOCK_METHOD1(AddObserver, void(NetworkPolicyObserver* observer));
MOCK_METHOD1(RemoveObserver, void(NetworkPolicyObserver* observer));
MOCK_CONST_METHOD3(
GetProperties,
void(const std::string& service_path,
const network_handler::DictionaryResultCallback& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_METHOD4(GetManagedProperties,
void(const std::string& userhash,
const std::string& service_path,
const network_handler::DictionaryResultCallback& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_CONST_METHOD4(
SetProperties,
void(const std::string& service_path,
const base::DictionaryValue& user_settings,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_CONST_METHOD4(
CreateConfiguration,
void(const std::string& userhash,
const base::DictionaryValue& properties,
const network_handler::StringResultCallback& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_CONST_METHOD3(
RemoveConfiguration,
void(const std::string& service_path,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_METHOD3(SetPolicy,
void(onc::ONCSource onc_source,
const std::string& userhash,
const base::ListValue& network_configs_onc));
MOCK_CONST_METHOD3(FindPolicyByGUID,
const base::DictionaryValue*(const std::string userhash,
const std::string& guid,
onc::ONCSource* onc_source));
MOCK_CONST_METHOD2(
FindPolicyByGuidAndProfile,
const base::DictionaryValue*(const std::string& guid,
const std::string& profile_path));
private:
DISALLOW_COPY_AND_ASSIGN(MockManagedNetworkConfigurationHandler);
};
} // namespace chromeos
#endif // CHROMEOS_NETWORK_MOCK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
|
#ifndef SHELL_DEBUGGER_H
#define SHELL_DEBUGGER_H
#include "reos_debugger.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ShellDebuggerData ShellDebuggerData;
typedef struct ShellDebuggerCommand ShellDebuggerCommand;
typedef struct ShellDebuggerOption ShellDebuggerOption;
typedef struct ShellBreakCondition ShellBreakCondition;
typedef int (*ShellDebuggerCommandFunc)(ReOS_Debugger *, ShellDebuggerCommand *, ReOS_Kernel *);
struct ShellDebuggerData
{
ShellDebuggerCommand *last_command;
void *break_debuggers;
int break_num;
int display;
int cont;
PrintInstFunc print_inst;
PrintInputFunc print_input;
};
struct ShellDebuggerCommand
{
char *name;
ReOS_SimpleList *options;
};
struct ShellBreakCondition
{
ReOS_Debugger *shell_debugger;
int num;
int enabled;
int deleted;
int line;
int opcode;
int index;
};
struct ShellDebuggerOption
{
char *key_name;
int value_is_num;
union
{
int value_num;
char *value_str;
};
};
ReOS_Debugger *new_shell_debugger();
void free_shell_debugger(ReOS_Debugger *);
void free_shell_debugger_command(ShellDebuggerCommand *);
void free_shell_debugger_option(ShellDebuggerOption *);
void shell_debugger_prompt(ReOS_Debugger *, ReOS_Kernel *);
ShellDebuggerCommand *parse_shell_command(char *);
void shell_debugger_print_state(ShellDebuggerData *, ReOS_Kernel *);
void shell_debugger_print_threadlist(ShellDebuggerData *, ReOS_Kernel *, ReOS_ThreadList *, int);
void shell_debugger_print_thread(ShellDebuggerData *, ReOS_Kernel *, ReOS_Thread *);
void shell_debugger_print_pattern(ShellDebuggerData *, ReOS_Kernel *);
void breakpoint_debugger_check_break(ReOS_Debugger *, ReOS_Kernel *);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_TONE_GENERATOR_H_
#define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_TONE_GENERATOR_H_
#include "modules/audio_coding/neteq/dtmf_tone_generator.h"
#include "test/gmock.h"
namespace webrtc {
class MockDtmfToneGenerator : public DtmfToneGenerator {
public:
virtual ~MockDtmfToneGenerator() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD3(Init, int(int fs, int event, int attenuation));
MOCK_METHOD0(Reset, void());
MOCK_METHOD2(Generate, int(size_t num_samples, AudioMultiVector* output));
MOCK_CONST_METHOD0(initialized, bool());
};
} // namespace webrtc
#endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_TONE_GENERATOR_H_
|
#include "../../lib/libduck.h"
int main(void);
int main(void)
{
puts("Tasks linked list:\n");
__asm__("int $0x82" ::"a"(0x05));
}
|
#ifndef OPTIM_UTILS_H
#define OPTIM_UTILS_H
#include <cstdio>
#include <vector>
#include <cassert>
#include <cmath>
#include <float.h>
#include "matrix.h"
//Compute the gradient by central difference
std::vector<double> gradient(double (*f)(std::vector<double>), const std::vector<double>& x, double tol)
{
std::vector<double> grad(x.size());
std::vector<double> forward = x;
std::vector<double> backward = x;
double delta;
double diff=2.0;
double grad_approx1,grad_approx2;
int count;
for(int i=0;i<x.size();i++)
{
forward = x;
backward = x;
delta=1e-3;
count=0;
diff=2.0*tol;
while(diff>tol && count<10)
{
count++;
forward.at(i)+=delta;
backward.at(i)-=delta;
grad_approx1=(f(forward)-f(backward))/(2.0*delta);
delta*=0.5;
forward.at(i)-=delta;
backward.at(i)+=delta;
grad_approx2=(f(forward)-f(backward))/(2.0*delta);
diff = fabs(grad_approx2-grad_approx1) / grad_approx1;
}
grad.at(i)=grad_approx2;
}
return grad;
}
void print_sol(double fval ,int iters,std::vector<double>& x)
{
printf("Solution found in %d iterations\n",iters);
printf("Decision variables: %d\n",x.size());
printf("Minimum cost: %f\n",fval);
printf("Solution:\n");
for(int i=0;i<x.size();i++)
{
printf("%f\n",x.at(i));
}
return;
}
#endif
|
/*
* alloc.c
*
* memory allocation and deallocation
*
* David A. McGrew
* Cisco Systems, Inc.
*/
/*
*
* Copyright (c) 2001-2006 Cisco Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of the Cisco Systems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "alloc.h"
#include "crypto_kernel.h"
/* the debug module for memory allocation */
debug_module_t mod_alloc = {
0, /* debugging is off by default */
"alloc" /* printable name for module */
};
/*
* Nota bene: the debugging statements for crypto_alloc() and
* crypto_free() have identical prefixes, which include the addresses
* of the memory locations on which they are operating. This fact can
* be used to locate memory leaks, by turning on memory debugging,
* grepping for 'alloc', then matching alloc and free calls by
* address.
*/
#ifdef SRTP_KERNEL_LINUX
#include <linux/interrupt.h>
void *
crypto_alloc(size_t size) {
void *ptr;
ptr = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
if (ptr) {
debug_print(mod_alloc, "(location: %p) allocated", ptr);
} else {
debug_print(mod_alloc, "allocation failed (asked for %d bytes)\n", size);
}
return ptr;
}
void
crypto_free(void *ptr) {
debug_print(mod_alloc, "(location: %p) freed", ptr);
kfree(ptr);
}
#elif defined(HAVE_STDLIB_H)
void *
crypto_alloc(size_t size) {
void *ptr;
ptr = malloc(size);
if (ptr) {
debug_print(mod_alloc, "(location: %p) allocated", ptr);
} else
debug_print(mod_alloc, "allocation failed (asked for %d bytes)\n", size);
return ptr;
}
void
crypto_free(void *ptr) {
debug_print(mod_alloc, "(location: %p) freed", ptr);
free(ptr);
}
#else /* we need to define our own memory allocation routines */
#error no memory allocation defined yet
#endif
|
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Flutter/Flutter.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MockBinaryMessenger : NSObject <FlutterBinaryMessenger>
@property(nonatomic, retain) NSObject *result;
@property(nonatomic, retain) NSObject<FlutterMessageCodec> *codec;
@property(nonatomic, retain) NSMutableDictionary<NSString *, FlutterBinaryMessageHandler> *handlers;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCodec:(NSObject<FlutterMessageCodec> *)codec NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END
|
#pragma once
#include <memory>
#include <SFGUI/SFGUI.hpp>
#include "chatwindow.h"
class IGame;
namespace Gui{
class BamGui {
public:
void buttonClick();
void init(IGame& game);
void display(sf::RenderWindow& target);
void handleEvent(sf::Event& event);
void logic();
bool hasFocus();
private:
sfg::SFGUI mSfgui;
sfg::Desktop mDesktop;
ChatWindow::Ptr mChatWindow;
};
}
|
//
// TestConvenienceCategories.h
// CoreData+JSON
//
// Copyright (c) 2010, emdentec (Elliot Neal)
// 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 emdentec 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 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
@interface TestConvenienceCategories : SenTestCase {
}
- (void)testDictionaryCategory;
- (void)testValueTranformerCategory;
@end
|
/*
* Copyright (c) 2016 CartoDB. All rights reserved.
* Copying and using this code is allowed only according
* to license terms, as given in https://cartodb.com/terms/
*/
#ifndef _CARTO_GEOMUTILS_H_
#define _CARTO_GEOMUTILS_H_
#include <vector>
namespace carto {
class MapBounds;
class MapPos;
class MapVec;
class GeomUtils {
public:
static double DistanceFromPoint(const MapPos& pos, const MapPos& p);
static double DistanceFromLine(const MapPos& pos, const MapPos& a, const MapPos& b);
static double DistanceFromLineSegment(const MapPos& pos, const MapPos& a, const MapPos& b);
static MapPos CalculateNearestPointOnLineSegment(const MapPos& pos, const MapPos& a, const MapPos& b);
static bool IsConvexPolygonClockwise(const std::vector<MapPos>& polygon);
static bool IsConcavePolygonClockwise(const std::vector<MapPos>& polygon);
static bool PointInsidePolygon(const std::vector<MapPos>& polygon, const MapPos& point);
static MapPos CalculatePointInsidePolygon(const std::vector<MapPos>& polygon, const std::vector<std::vector<MapPos> >& holes);
static MapPos CalculatePointOnLine(const std::vector<MapPos>& line);
static bool PolygonsIntersect(const std::vector<MapPos>& polygon1, const std::vector<MapPos>& polygon2);
static std::vector<MapPos> CalculateConvexHull(std::vector<MapPos> points);
private:
GeomUtils();
static bool PointsInsidePolygonEdges(const std::vector<MapPos>& polygon, const std::vector<MapPos>& points);
};
}
#endif
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
#define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
#include "chrome/browser/history/history_types.h"
struct DownloadCreateInfo;
namespace sql {
class Connection;
}
namespace history {
// Maintains a table of downloads.
class DownloadDatabase {
public:
// Must call InitDownloadTable before using any other functions.
DownloadDatabase();
virtual ~DownloadDatabase();
// Get all the downloads from the database.
void QueryDownloads(std::vector<DownloadCreateInfo>* results);
// Update the state of one download. Returns true if successful.
bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle);
// Update the path of one download. Returns true if successful.
bool UpdateDownloadPath(const std::wstring& path, DownloadID db_handle);
// Create a new database entry for one download and return its primary db id.
int64 CreateDownload(const DownloadCreateInfo& info);
// Remove a download from the database.
void RemoveDownload(DownloadID db_handle);
// Remove all completed downloads that started after |remove_begin|
// (inclusive) and before |remove_end|. You may use null Time values
// to do an unbounded delete in either direction. This function ignores
// all downloads that are in progress or are waiting to be cancelled.
void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
// Search for downloads matching the search text.
void SearchDownloads(std::vector<int64>* results,
const std::wstring& search_text);
protected:
// Returns the database for the functions in this interface.
virtual sql::Connection& GetDB() = 0;
// Creates the downloads table if needed.
bool InitDownloadTable();
// Used to quickly clear the downloads. First you would drop it, then you
// would re-initialize it.
bool DropDownloadTable();
private:
DISALLOW_COPY_AND_ASSIGN(DownloadDatabase);
};
} // namespace history
#endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_TEST_PARALLEL_TEST_LAUNCHER_H_
#define BASE_TEST_PARALLEL_TEST_LAUNCHER_H_
#include <map>
#include <string>
#include "base/callback.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
class CommandLine;
namespace base {
class SequencedWorkerPoolOwner;
class Timer;
// Launches child gtest process in parallel. Keeps track of running processes,
// prints a message in case no output is produced for a while.
class ParallelTestLauncher {
public:
// Constructor. |jobs| is the maximum number of tests launched in parallel.
explicit ParallelTestLauncher(size_t jobs);
~ParallelTestLauncher();
// Callback called after a child process finishes. First argument is the exit
// code, second one is child process elapsed time, third one is true if
// the child process was terminated because of a timeout, and fourth one
// contains output of the child (stdout and stderr together).
typedef Callback<void(int, const TimeDelta&, bool, const std::string&)>
LaunchChildGTestProcessCallback;
// Launches a child process (assumed to be gtest-based binary) using
// |command_line|. If |wrapper| is not empty, it is prepended to the final
// command line. If the child process is still running after |timeout|, it
// is terminated. After the child process finishes |callback| is called
// on the same thread this method was called.
void LaunchChildGTestProcess(const CommandLine& command_line,
const std::string& wrapper,
base::TimeDelta timeout,
const LaunchChildGTestProcessCallback& callback);
// Similar to above, but with processes sharing the same value of |token_name|
// being serialized, with order matching order of calls of this method.
void LaunchNamedSequencedChildGTestProcess(
const std::string& token_name,
const CommandLine& command_line,
const std::string& wrapper,
base::TimeDelta timeout,
const LaunchChildGTestProcessCallback& callback);
// Resets the output watchdog, indicating some test results have been printed
// out. If a pause between the calls exceeds an internal treshold, a message
// will be printed listing all child processes we're still waiting for.
void ResetOutputWatchdog();
private:
void LaunchSequencedChildGTestProcess(
SequencedWorkerPool::SequenceToken sequence_token,
const CommandLine& command_line,
const std::string& wrapper,
base::TimeDelta timeout,
const LaunchChildGTestProcessCallback& callback);
// Called on a worker thread after a child process finishes.
void OnLaunchTestProcessFinished(
size_t sequence_number,
const LaunchChildGTestProcessCallback& callback,
int exit_code,
const TimeDelta& elapsed_time,
bool was_timeout,
const std::string& output);
// Called by the delay timer when no output was made for a while.
void OnOutputTimeout();
// Make sure we don't accidentally call the wrong methods e.g. on the worker
// pool thread. With lots of callbacks used this is non-trivial.
// Should be the first member so that it's destroyed last: when destroying
// other members, especially the worker pool, we may check the code is running
// on the correct thread.
ThreadChecker thread_checker_;
// Watchdog timer to make sure we do not go without output for too long.
DelayTimer<ParallelTestLauncher> timer_;
// Monotonically increasing sequence number to uniquely identify each
// launched child process.
size_t launch_sequence_number_;
// Map of currently running child processes, keyed by the sequence number.
typedef std::map<size_t, CommandLine> RunningProcessesMap;
RunningProcessesMap running_processes_map_;
// Worker pool used to launch processes in parallel.
scoped_ptr<SequencedWorkerPoolOwner> worker_pool_owner_;
DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher);
};
} // namespace base
#endif // BASE_TEST_PARALLEL_TEST_LAUNCHER_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_connect_socket_postinc_52c.c
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-52c.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: increment
* GoodSink: Ensure there will not be an overflow before incrementing data
* BadSink : Increment data, which can cause an overflow
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#ifndef OMITBAD
void CWE190_Integer_Overflow__int_connect_socket_postinc_52c_badSink(int data)
{
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
data++;
int result = data;
printIntLine(result);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE190_Integer_Overflow__int_connect_socket_postinc_52c_goodG2BSink(int data)
{
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
data++;
int result = data;
printIntLine(result);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE190_Integer_Overflow__int_connect_socket_postinc_52c_goodB2GSink(int data)
{
/* FIX: Add a check to prevent an overflow from occurring */
if (data < INT_MAX)
{
data++;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
#endif /* OMITGOOD */
|
#pragma once
#ifndef __DAVA_Reflection__
#include "Reflection/Reflection.h"
#endif
#define IMPL__DAVA_REFLECTION(Cls) \
template <typename FT__> \
friend struct DAVA::ReflectionDetail::ReflectionInitializerRunner; \
static void Dava__ReflectionInitializer() { Dava__ReflectionInitializerS(); } \
static void Dava__ReflectionInitializerS()
#define IMPL__DAVA_VIRTUAL_REFLECTION(Cls, ...) \
using Cls__BaseTypes = std::tuple<__VA_ARGS__>; \
const DAVA::ReflectedType* Dava__GetReflectedType() const override; \
static void Dava__ReflectionRegisterBases(); \
static void Dava__ReflectionInitializerV(); \
static void Dava__ReflectionInitializer() \
{ \
static bool registred = false; \
if (!registred) { \
registred = true; \
Dava__ReflectionRegisterBases(); \
Dava__ReflectionInitializerV(); \
} \
} \
template <typename FT__> \
friend struct DAVA::ReflectionDetail::ReflectionInitializerRunner
namespace DAVA
{
namespace ReflectionDetail
{
template <typename T>
struct ReflectionInitializerRunner
{
protected:
template <typename U, void (*)()>
struct SFINAE
{
};
template <typename U>
static char Test(SFINAE<U, &U::Dava__ReflectionInitializer>*);
template <typename U>
static int Test(...);
static const bool value = std::is_same<decltype(Test<T>(0)), char>::value;
inline static void RunImpl(std::true_type)
{
// T has TypeInitializer function,
// so we should run it
T::Dava__ReflectionInitializer();
}
inline static void RunImpl(std::false_type)
{
// T don't have TypeInitializer function,
// so nothing to do here
}
public:
static void Run()
{
using CheckType = typename std::conditional<std::is_class<T>::value, ReflectionInitializerRunner<T>, std::false_type>::type;
RunImpl(std::integral_constant<bool, CheckType::value>());
}
};
} // ReflectionDetail
} // namespace DAVA
|
/* /////////////////////////////////////////////////////////////////////////
* File: incl.unixstl.h
*
* Purpose: #includes the UNIXSTL root header and verifies the version.
*
* Created: 8th November 2007
* Updated: 10th January 2017
*
* Home: http://recls.org/
*
* Copyright (c) 2003-2017, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted in accordance with the license and warranty
* information described in recls.h (included in this distribution, or
* available from http://recls.org/)
*
* ////////////////////////////////////////////////////////////////////// */
#ifndef RECLS_INCL_SRC_H_INCL_UNIXSTL
#define RECLS_INCL_SRC_H_INCL_UNIXSTL
/* ////////////////////////////////////////////////////////////////////// */
#include "incl.stlsoft.h"
#ifdef UNIXSTL_INCL_UNIXSTL_H_UNIXSTL
# error Must not #include unixstl/unixstl.h before this file
#endif /* UNIXSTL_INCL_UNIXSTL_H_UNIXSTL */
#include <unixstl/unixstl.h> /* If the compiler cannot find this, you are not using STLSoft 1.9.1 or later, as required. */
#if !defined(_UNIXSTL_VER) || \
_UNIXSTL_VER < 0x010704ff
# error Requires UNIXSTL 1.7.4, or later. (www.stlsoft.org/downloads.html)
#endif /* UNIXSTL version */
/* /////////////////////////////////////////////////////////////////////////
* compatibility
*/
#ifdef _UNIXSTL_NO_NAMESPACE
# error recls 1.9+ is not compatible with UNIXSTL namespace suppression
#endif /* _UNIXSTL_NO_NAMESPACE */
/* ////////////////////////////////////////////////////////////////////// */
#endif /* !RECLS_INCL_SRC_H_INCL_UNIXSTL */
/* ///////////////////////////// end of file //////////////////////////// */
|
#ifndef __APARSE_H__
#define __APARSE_H__
#include <string>
#include <vector>
#include <map>
using namespace std;
struct NumElement;
struct Expression;
struct MutiCheckNode;
typedef enum CompareOperator
{
COPER_EQUAL,
COPER_NOTEQUAL,
COPER_LESS,
COPER_BIG,
COPER_NUMBER
};
typedef enum ValueType
{
VALUETYPE_INT = 0,
VALUETYPE_FLOAT,
VALUETYPE_DOUBLE,
VALUETYPE_STRING,
VALUETYPE_BOOL,
VALUETYPE_NUMBER
};
typedef enum RelationshipOperator
{
ROPER_AND,
ROPER_OR,
ROPER_NUMBER
};
struct Expression
{
bool is_param;
string param_name;
unsigned param_index;
ValueType type;
string value;
int int_value;
bool is_null;
Expression():is_param(false), param_name(""), param_index(0), type(VALUETYPE_STRING), value("1"), int_value(0), is_null(false){}
};
struct TowParamCompare
{
Expression l_expr;
Expression r_expr;
CompareOperator c_oper;
TowParamCompare() : c_oper(COPER_EQUAL){}
};
struct OneParamCompare
{
Expression expr;
};
struct CheckNode
{
bool result;
bool result_is_not;
bool use_two_param_compare;
OneParamCompare one_compare;
TowParamCompare two_compare;
vector<MutiCheckNode> muti_node;
CheckNode() : result_is_not(false), use_two_param_compare(false){}
};
struct MutiCheckNode
{
CheckNode node;
RelationshipOperator oper;
MutiCheckNode() : oper(ROPER_AND){}
};
struct ResultNode
{
bool isChecked;
bool result;
const CheckNode* node;
ResultNode () : isChecked(false), result(false), node(NULL){}
};
struct ParameterValue
{
ValueType type;
const void* value;
int len;
ParameterValue() : type(VALUETYPE_STRING), value(NULL), len(0){}
};
class Parse
{
public:
Parse();
~Parse();
int setExpression(const string& expr_);
bool getResult(const vector<ParameterValue>& params_) const;
const vector<string>& getParaNames() const;
void Dump() const;
private:
int setNode(const string& expr_, CheckNode& node_);
void setNodeValue(const string& expr_, CheckNode& node_);
int getNodeExpression(const string& expr_, string& node_expr_,
RelationshipOperator& rs_oper_, string& left_expr_,
bool& is_muti_node_, bool& is_not_result) const;
ValueType getValueType(const string& expr_) const;
bool getNodeResult(const CheckNode& node_, const vector<ParameterValue>& params_) const;
bool getResult(const CheckNode& node_, const vector<ParameterValue>& params_) const;
private:
CheckNode _description;
vector<string> _param_names;
};
#endif
|
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_TEST_MOCK_BITRATE_ALLOCATOR_H_
#define CALL_TEST_MOCK_BITRATE_ALLOCATOR_H_
#include <string>
#include "call/bitrate_allocator.h"
#include "test/gmock.h"
namespace webrtc {
class MockBitrateAllocator : public BitrateAllocatorInterface {
public:
MOCK_METHOD2(AddObserver,
void(BitrateAllocatorObserver*, MediaStreamAllocationConfig));
MOCK_METHOD1(RemoveObserver, void(BitrateAllocatorObserver*));
MOCK_CONST_METHOD1(GetStartBitrate, int(BitrateAllocatorObserver*));
};
} // namespace webrtc
#endif // CALL_TEST_MOCK_BITRATE_ALLOCATOR_H_
|
/* $NetBSD: db_memrw.c,v 1.3 2003/08/10 22:22:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford for Wasabi Systems, Inc.
*
* 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
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* 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.
*/
/*
* Mach Operating System
* Copyright (c) 1992 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.
*/
/*
* Interface to the debugger for virtual memory read/write.
* This is a simple version for kernels with writable text.
* For an example of read-only kernel text, see the file:
* sys/arch/sun3/sun3/db_memrw.c
*
* ALERT! If you want to access device registers with a
* specific size, then the read/write functions have to
* make sure to do the correct sized pointer access.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.3 2003/08/10 22:22:31 scw Exp $");
#include <sys/param.h>
#include <sys/proc.h>
#include <uvm/uvm_extern.h>
#include <machine/db_machdep.h>
#include <ddb/db_access.h>
/*
* Read bytes from kernel address space for debugger.
*/
void
db_read_bytes(db_addr_t addr, size_t size, char *data)
{
char *src = (char *)(intptr_t)addr;
if (size == 8) {
*((register_t*)data) = *((register_t*)src);
return;
}
if (size == 4) {
*((int*)data) = *((int*)src);
return;
}
if (size == 2) {
*((short*)data) = *((short*)src);
return;
}
while (size > 0) {
--size;
*data++ = *src++;
}
}
/*
* Write bytes to kernel address space for debugger.
*/
void
db_write_bytes(db_addr_t addr, size_t size, char *data)
{
char *dst = (char *)(intptr_t)addr;
extern char etext[];
int in_text = 0;
if (dst < etext && (dst + size) >= (char *)SH5_KSEG0_BASE) {
char *dp;
for (dp = dst; dp < &dst[size]; dp += 32)
asm volatile("ocbp %0, 0; icbi %0, 0; synci"
: : "r"(dp));
in_text = 1;
}
if (size == 8) {
*((register_t*)dst) = *((register_t*)data);
if (in_text)
asm volatile("ocbp %0, 0; synci" :: "r"(dst));
return;
}
if (size == 4) {
*((int*)dst) = *((int*)data);
if (in_text)
asm volatile("ocbp %0, 0; synci" :: "r"(dst));
return;
}
if (size == 2) {
*((short*)dst) = *((short*)data);
if (in_text)
asm volatile("ocbp %0, 0; synci" :: "r"(dst));
return;
}
while (size > 0) {
--size;
*dst = *data++;
if (in_text)
asm volatile("ocbp %0, 0; synci" :: "r"(dst));
dst++;
}
}
|
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <onevision/3dmodel/cloud.h>
int cloud_allocate_data( cloud_t* nuage, size_t size, void* data ) {
int i ;
nuage->data_size = size ;
nuage->data = malloc ( nuage->nb_points * size ) ;
if ( nuage->points == NULL ) {
errno = ENOMEM ;
return -1 ;
}
for (i=0; i<nuage->nb_points; i++)
memcpy( nuage->data + i*nuage->data_size, data, size ) ;
return nuage->nb_points ;
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_listen_socket_predec_54b.c
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-54b.tmpl.c
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Set data to a small, non-zero number (negative two)
* Sinks: decrement
* GoodSink: Ensure there will not be an underflow before decrementing data
* BadSink : Decrement data, which can cause an Underflow
* 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"
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#ifndef OMITBAD
/* bad function declaration */
void CWE191_Integer_Underflow__int_listen_socket_predec_54c_badSink(int data);
void CWE191_Integer_Underflow__int_listen_socket_predec_54b_badSink(int data)
{
CWE191_Integer_Underflow__int_listen_socket_predec_54c_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE191_Integer_Underflow__int_listen_socket_predec_54c_goodG2BSink(int data);
void CWE191_Integer_Underflow__int_listen_socket_predec_54b_goodG2BSink(int data)
{
CWE191_Integer_Underflow__int_listen_socket_predec_54c_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE191_Integer_Underflow__int_listen_socket_predec_54c_goodB2GSink(int data);
void CWE191_Integer_Underflow__int_listen_socket_predec_54b_goodB2GSink(int data)
{
CWE191_Integer_Underflow__int_listen_socket_predec_54c_goodB2GSink(data);
}
#endif /* OMITGOOD */
|
/*
* Copyright (c) 1980, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)netisr.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/netisr.h,v 1.21 2000/02/13 03:31:56 peter Exp $
*/
#ifndef _NET_NETISR_H_
#define _NET_NETISR_H_
/*
* The networking code runs off software interrupts.
*
* You can switch into the network by doing splnet() and return by splx().
* The software interrupt level for the network is higher than the software
* level for the clock (so you can enter the network in routines called
* at timeout time).
*/
/*
* Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
* word which is used to de-multiplex a single software
* interrupt used for scheduling the network code to calls
* on the lowest level routine of each protocol.
*/
#define NETISR_IP 2 /* same as AF_INET */
#define NETISR_NS 6 /* same as AF_NS */
#define NETISR_ATALK 16 /* same as AF_APPLETALK */
#define NETISR_ARP 18 /* same as AF_LINK */
#define NETISR_IPX 23 /* same as AF_IPX */
#define NETISR_USB 25 /* USB soft interrupt */
#define NETISR_PPP 27 /* PPP soft interrupt */
#define NETISR_IPV6 28 /* same as AF_INET6 */
#define NETISR_NATM 29 /* same as AF_NATM */
#define NETISR_NETGRAPH 31 /* same as AF_NETGRAPH */
#ifndef LOCORE
#ifdef _KERNEL
extern volatile unsigned int netisr; /* scheduling bits for network */
#define schednetisr(anisr) { netisr |= 1 << (anisr); setsoftnet(); }
typedef void netisr_t __P((void));
int register_netisr __P((int, netisr_t *));
int unregister_netisr __P((int));
#endif
#endif
#endif
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_
#include <map>
#include <set>
#include <string>
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/extensions/api/mdns/dns_sd_registry.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function.h"
namespace content {
class BrowserContext;
}
namespace extensions {
class DnsSdRegistry;
// MDnsAPI is instantiated with the profile and will listen for extensions that
// register listeners for the chrome.mdns extension API. It will use a registry
// class to start the mDNS listener process (if necessary) and observe new
// service events to dispatch them to registered extensions.
class MDnsAPI : public BrowserContextKeyedAPI,
public EventRouter::Observer,
public DnsSdRegistry::DnsSdObserver {
public:
explicit MDnsAPI(content::BrowserContext* context);
~MDnsAPI() override;
static MDnsAPI* Get(content::BrowserContext* context);
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<MDnsAPI>* GetFactoryInstance();
// Used to mock out the DnsSdRegistry for testing.
void SetDnsSdRegistryForTesting(scoped_ptr<DnsSdRegistry> registry);
protected:
// Retrieve an instance of the registry. Lazily created when needed.
virtual DnsSdRegistry* dns_sd_registry();
// Gets the list of mDNS event listeners.
virtual const extensions::EventListenerMap::ListenerList& GetEventListeners();
private:
FRIEND_TEST_ALL_PREFIXES(MDnsAPIDiscoveryTest,
ServiceListenersAddedAndRemoved);
typedef std::map<std::string, int> ServiceTypeCounts;
friend class BrowserContextKeyedAPIFactory<MDnsAPI>;
// EventRouter::Observer:
void OnListenerAdded(const EventListenerInfo& details) override;
void OnListenerRemoved(const EventListenerInfo& details) override;
// DnsSdRegistry::Observer
void OnDnsSdEvent(const std::string& service_type,
const DnsSdRegistry::DnsSdServiceList& services) override;
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
return "MDnsAPI";
}
static const bool kServiceIsCreatedWithBrowserContext = true;
static const bool kServiceIsNULLWhileTesting = true;
// Update the current list of service types and update the registry.
void UpdateMDnsListeners();
// Write a message to the consoles of extensions listening to a given service
// type.
void WriteToConsole(const std::string& service_type,
content::ConsoleMessageLevel level,
const std::string& message);
// Returns true if an extension or platform app |extension_id| is allowed to
// listen to mDNS events for |service_type|.
virtual bool IsMDnsAllowed(const std::string& extension_id,
const std::string& service_type) const;
// Finds all all the valid listeners of the mdns.onServiceList event and
// filters them by service type if |service_type_filter| is non-empty.
// The list of extensions with active listeners is written to |extension_ids|,
// if non-null.
// The counts for each service type are output to |service_type_counts|, if
// non-null.
void GetValidOnServiceListListeners(const std::string& service_type_filter,
std::set<std::string>* extension_ids,
ServiceTypeCounts* service_type_counts);
// Ensure methods are only called on UI thread.
base::ThreadChecker thread_checker_;
content::BrowserContext* const browser_context_;
// Lazily created on first access and destroyed with this API class.
scoped_ptr<DnsSdRegistry> dns_sd_registry_;
// Count of active listeners per service type, saved from the previous
// invocation of UpdateMDnsListeners().
ServiceTypeCounts prev_service_counts_;
DISALLOW_COPY_AND_ASSIGN(MDnsAPI);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_
|
/* Version of 20 September 1989. */
typedef unsigned char ByteType;
typedef unsigned int HalfWord;
typedef unsigned short QuarterWord;
struct JtR_FEAL8_CTX {
QuarterWord K[16];
HalfWord K89;
HalfWord K1011;
HalfWord K1213;
HalfWord K1415;
};
void feal_SetKey(ByteType * KP, struct JtR_FEAL8_CTX *ctx);
void feal_Encrypt(ByteType * Plain, ByteType * Cipher, struct JtR_FEAL8_CTX *ctx);
// void Decrypt(ByteType * Cipher, ByteType * Plain);
void feal_Decrypt(ByteType * Cipher, ByteType * Plain, struct JtR_FEAL8_CTX *ctx);
|
/* Copyright (c) 2012 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 CRAS_CARD_CONFIG_H_
#define CRAS_CARD_CONFIG_H_
struct cras_card_config;
struct cras_volume_curve;
/* Creates a configuration based on the config file specified.
* Args:
* config_path - Path containing the config files.
* card_name - Name of the card to load a configuration for.
* Returns:
* A pointer to the created config on success, NULL on failure.
*/
struct cras_card_config *cras_card_config_create(const char *config_path,
const char *card_name);
/* Destroys a configuration returned by cras_card_config_create().
* Args:
* card_config - Card configuration returned by cras_card_config_create()
*/
void cras_card_config_destroy(struct cras_card_config *card_config);
/* Returns the apporpriate volume curve to use for the control given by name.
* Args:
* card_config - Card configuration returned by cras_card_config_create()
* Returns:
* The specialized curve for the control if there is one, otherwise the
* default volume curve.
*/
struct cras_volume_curve *cras_card_config_get_volume_curve_for_control(
const struct cras_card_config *card_config,
const char *control_name);
#endif /* CRAS_CARD_CONFIG_H_ */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_console_system_82.h
Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
Template File: sources-sink-82.tmpl.h
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* BadSink : Execute command in data using system()
* Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define FULL_COMMAND "dir "
#else
#include <unistd.h>
#define FULL_COMMAND "ls "
#endif
namespace CWE78_OS_Command_Injection__char_console_system_82
{
class CWE78_OS_Command_Injection__char_console_system_82_base
{
public:
/* pure virtual function */
virtual void action(char * data) = 0;
};
#ifndef OMITBAD
class CWE78_OS_Command_Injection__char_console_system_82_bad : public CWE78_OS_Command_Injection__char_console_system_82_base
{
public:
void action(char * data);
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE78_OS_Command_Injection__char_console_system_82_goodG2B : public CWE78_OS_Command_Injection__char_console_system_82_base
{
public:
void action(char * data);
};
#endif /* OMITGOOD */
}
|
// 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_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
#define COMPONENTS_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
namespace web_modal {
class TestWebContentsModalDialogManagerDelegate
: public WebContentsModalDialogManagerDelegate {
public:
TestWebContentsModalDialogManagerDelegate();
TestWebContentsModalDialogManagerDelegate(
const TestWebContentsModalDialogManagerDelegate&) = delete;
TestWebContentsModalDialogManagerDelegate& operator=(
const TestWebContentsModalDialogManagerDelegate&) = delete;
// WebContentsModalDialogManagerDelegate overrides:
void SetWebContentsBlocked(content::WebContents* web_contents,
bool blocked) override;
WebContentsModalDialogHost* GetWebContentsModalDialogHost() override;
bool IsWebContentsVisible(content::WebContents* web_contents) override;
void set_web_contents_visible(bool visible) {
web_contents_visible_ = visible;
}
void set_web_contents_modal_dialog_host(WebContentsModalDialogHost* host) {
web_contents_modal_dialog_host_ = host;
}
bool web_contents_blocked() const { return web_contents_blocked_; }
private:
bool web_contents_visible_;
bool web_contents_blocked_;
WebContentsModalDialogHost* web_contents_modal_dialog_host_; // Not owned.
};
} // namespace web_modal
#endif // COMPONENTS_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
|
#pragma once
#include <avr-halib/interrupts/interrupt.h>
#include <avr-halib/interrupts/InterruptManager/InterruptBinding.h>
#include <avr-halib/interrupts/InterruptManager/Slot.h>
#include <boost/mpl/vector.hpp>
namespace avr_halib
{
namespace interrupts
{
namespace atmega128rfa1
{
struct Timer5
{
/** \brief interrupts defined by this device **/
enum Interrupts
{
capture = 46, /**< input capture **/
matchA = 47, /**< compare match in unit A **/
matchB = 48, /**< compare match in unit B **/
matchC = 49, /**< compare match in unit C **/
overflow = 50 /**< timer overflow **/
};
typedef avr_halib::interrupts::interrupt_manager::Slot<capture, avr_halib::interrupts::interrupt_manager::Binding::DynamicPlainFunction> CaptureSlot;
typedef avr_halib::interrupts::interrupt_manager::Slot<matchA, avr_halib::interrupts::interrupt_manager::Binding::DynamicPlainFunction> MatchASlot;
typedef avr_halib::interrupts::interrupt_manager::Slot<matchB, avr_halib::interrupts::interrupt_manager::Binding::DynamicPlainFunction> MatchBSlot;
typedef avr_halib::interrupts::interrupt_manager::Slot<matchC, avr_halib::interrupts::interrupt_manager::Binding::DynamicPlainFunction> MatchCSlot;
typedef avr_halib::interrupts::interrupt_manager::Slot<overflow, avr_halib::interrupts::interrupt_manager::Binding::DynamicPlainFunction> OverflowSlot;
typedef boost::mpl::vector<CaptureSlot, MatchASlot, MatchBSlot, MatchCSlot, OverflowSlot>::type Slots;
};
}
}
}
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SEARCH_ENGINES_ANDROID_TEMPLATE_URL_SERVICE_ANDROID_H_
#define COMPONENTS_SEARCH_ENGINES_ANDROID_TEMPLATE_URL_SERVICE_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
// Android wrapper of the TemplateUrlService which provides access from the Java
// layer. Note that on Android, there's only a single profile, and therefore
// a single instance of this wrapper.
class TemplateUrlServiceAndroid : public TemplateURLServiceObserver {
public:
explicit TemplateUrlServiceAndroid(TemplateURLService* template_url_service);
TemplateUrlServiceAndroid(const TemplateUrlServiceAndroid&) = delete;
TemplateUrlServiceAndroid& operator=(const TemplateUrlServiceAndroid&) =
delete;
~TemplateUrlServiceAndroid() override;
base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
void Load(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
void SetUserSelectedDefaultSearchProvider(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jkeyword);
jboolean IsLoaded(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj) const;
jboolean IsDefaultSearchManaged(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
jboolean IsSearchByImageAvailable(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
jboolean IsDefaultSearchEngineGoogle(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
jboolean IsSearchResultsPageFromDefaultSearchProvider(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& jurl);
base::android::ScopedJavaLocalRef<jstring> GetUrlForSearchQuery(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jquery,
const base::android::JavaParamRef<jobjectArray>& jsearch_params);
base::android::ScopedJavaLocalRef<jstring> GetSearchQueryForUrl(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& jurl);
base::android::ScopedJavaLocalRef<jobject> GetUrlForVoiceSearchQuery(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jquery);
base::android::ScopedJavaLocalRef<jobject> GetUrlForContextualSearchQuery(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jquery,
const base::android::JavaParamRef<jstring>& jalternate_term,
jboolean jshould_prefetch,
const base::android::JavaParamRef<jstring>& jprotocol_version);
base::android::ScopedJavaLocalRef<jstring> GetSearchEngineUrlFromTemplateUrl(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jkeyword);
int GetSearchEngineTypeFromTemplateUrl(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jkeyword);
// Adds a search engine, set by Play API. Sets it as DSE if possible.
// Returns true if search engine was successfully added, false if search
// engine from Play API with such keyword already existed (e.g. from previous
// attempt to set search engine).
jboolean SetPlayAPISearchEngine(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jname,
const base::android::JavaParamRef<jstring>& jkeyword,
const base::android::JavaParamRef<jstring>& jsearch_url,
const base::android::JavaParamRef<jstring>& jsuggest_url,
const base::android::JavaParamRef<jstring>& jfavicon_url,
jboolean set_as_default);
// Adds a custom search engine, sets |jkeyword| as its short_name and keyword,
// and sets its date_created as |age_in_days| days before the current time.
base::android::ScopedJavaLocalRef<jstring> AddSearchEngineForTesting(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jkeyword,
jint age_in_days);
// Finds the search engine whose keyword matches |jkeyword| and sets its
// last_visited time as the current time.
base::android::ScopedJavaLocalRef<jstring> UpdateLastVisitedForTesting(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& jkeyword);
// Get all the available search engines and add them to the
// |template_url_list_obj| list.
void GetTemplateUrls(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& template_url_list_obj);
// Get current default search engine.
base::android::ScopedJavaLocalRef<jobject> GetDefaultSearchEngine(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
private:
void OnTemplateURLServiceLoaded();
// TemplateUrlServiceObserver:
void OnTemplateURLServiceChanged() override;
base::android::ScopedJavaGlobalRef<jobject> java_ref_;
// Pointer to the TemplateUrlService for the main profile.
TemplateURLService* template_url_service_;
base::CallbackListSubscription template_url_subscription_;
};
#endif // COMPONENTS_SEARCH_ENGINES_ANDROID_TEMPLATE_URL_SERVICE_ANDROID_H_
|
/* -*- Mode: C; tab-width:2 -*- */
/* ex: set ts=2 shiftwidth=2 softtabstop=2 cindent: */
#include <sys_module.h>
#include <string.h>
#define LED_DEBUG
#include <led_dbg.h>
#define BASE_NODE_ID 0
#define TEST_PID DFLT_APP_ID0
#define OTHER_PID DFLT_APP_ID1
/* this is a new message type which specifies our test driver's packet type
* both the python test script, and the message handler will need to handle messages of this type
*/
#define MSG_TEST_DATA (MOD_MSG_START + 1)
#define MSG_DATA_WAIT (MOD_MSG_START + 2)
#define MSG_TRANS_READY (MOD_MSG_START + 3)
/* this is the timer specifications */
#define TEST_APP_TID 0
#define TEST_APP_INTERVAL 1024
/* messagees for when MSG_INIT and MSG_FINAL are sent
*/
#define START_DATA 100
#define FINAL_DATA 200
#define TEST_FAIL 155
#define TEST_PASS 255
/* if your driver has more than one sensor, or device, which can be polled
* include more states here
*/
enum {
TEST_APP_INIT=0,
TEST_APP_FINAL,
TEST_APP_WAIT,
};
/* if you wish to store more information, such as a history of previous values
* include the appropriate data structure here
*/
typedef struct {
uint8_t pid;
uint8_t count;
uint8_t state;
} app_state_t;
/* struct specifying how the data will be sent throug the network and the uart.
* this specifies an id, which wil be unique to each node
* and the other field will hold the data recieved from the sensor
* feel free to add more fields such as a packet counter or other information to assist
* you testing
*/
typedef struct {
uint8_t id;
uint8_t state;
uint8_t data;
} data_msg_t;
static int8_t generic_test_msg_handler(void *state, Message *msg);
/* for most tests, this won't need changing, except for possibly the name of the module handler
*/
static const mod_header_t mod_header SOS_MODULE_HEADER = {
.mod_id = TEST_PID,
.state_size = sizeof(app_state_t),
.num_timers = 1,
.num_sub_func = 0,
.num_prov_func = 0,
.platform_type = HW_TYPE,
.processor_type = MCU_TYPE,
.code_id = ehtons(TEST_PID),
.module_handler = generic_test_msg_handler,
};
static int8_t send_new_data(uint8_t state, uint8_t data){
/* out data message that will be sent through the uart or network */
data_msg_t *data_msg;
// create a message with a appropriate size
data_msg = (data_msg_t *) sys_malloc ( sizeof(data_msg_t) );
if ( data_msg ) {
sys_led(LED_GREEN_TOGGLE);
// copy all the data you wish to send
data_msg->id = sys_id();
data_msg->state = state;
data_msg->data = data;
/* if you are running this test on multiple nodes at the same time you will need this
* but if you are running it on just one node at a time, you only need the call to sys_post_uart
*/
if (sys_id() == 0){
sys_post_uart (
TEST_PID,
MSG_TEST_DATA,
sizeof(data_msg_t),
data_msg,
SOS_MSG_RELEASE,
BCAST_ADDRESS);
} else {
sys_post_net (
TEST_PID,
MSG_TEST_DATA,
sizeof(data_msg_t),
data_msg,
SOS_MSG_RELEASE,
BASE_NODE_ID);
}
} else
sys_led(LED_RED_ON);
return SOS_OK;
}
static int8_t generic_test_msg_handler(void *state, Message *msg)
{
app_state_t *s = (app_state_t *) state;
switch ( msg->type ) {
/* do any initialization steps here,
* in general it is good to set all the leds to off so that you can analyze what happens later more accurately
* also be sure to start and enable any timers which your driver might need
*/
case MSG_INIT:
sys_led(LED_GREEN_OFF);
sys_led(LED_YELLOW_OFF);
sys_led(LED_RED_OFF);
s->state = TEST_APP_INIT;
s->count = 0;
s->pid = msg->did;
sys_timer_start(TEST_APP_TID, TEST_APP_INTERVAL, SLOW_TIMER_REPEAT);
send_new_data(START_DATA, 0);
break;
case MSG_ERROR:
s->state = TEST_APP_INIT;
s->count = 0;
s->pid = msg->did;
sys_timer_start(TEST_APP_TID, TEST_APP_INTERVAL, SLOW_TIMER_REPEAT);
send_new_data(START_DATA, 0);
break;
case MSG_FINAL:
sys_timer_stop(TEST_APP_TID);
s->state = TEST_APP_FINAL;
send_new_data(FINAL_DATA, 1);
break;
/* here we handle messages of type MSG_TEST_DATA
* in most cases, only the base station node should be doing this since it is the only one connected to the uart
* if your test does not use multiple nodes, or your messages are sent via another module, this is not needed
*/
case MSG_TEST_DATA:
{
uint8_t *payload;
uint8_t msg_len;
msg_len = msg->len;
payload = sys_msg_take_data(msg);
sys_post_uart(
s->pid,
MSG_TEST_DATA,
msg_len,
payload,
SOS_MSG_RELEASE,
BCAST_ADDRESS);
}
break;
case MSG_DATA_WAIT:
{
s->state = TEST_APP_WAIT;
}
break;
case MSG_TIMER_TIMEOUT:
{
switch(s->state){
case TEST_APP_INIT:
{
uint8_t *d;
d = (uint8_t *) sys_malloc(sizeof(uint8_t));
*d = s->count;
sys_shm_open(sys_shm_name(TEST_PID, 0), d);
sys_shm_open(sys_shm_name(TEST_PID, 1), d);
s->state = TEST_APP_FINAL;
}
break;
case TEST_APP_WAIT:
{
uint8_t *d;
d = (uint8_t*) sys_shm_get(sys_shm_name(TEST_PID, 0));
*d = s->count;
sys_shm_update(sys_shm_name(TEST_PID, 0), d);
sys_shm_update(sys_shm_name(TEST_PID, 1), d);
s->count++;
}
break;
case TEST_APP_FINAL:
{
sys_post_value(
OTHER_PID,
MSG_TRANS_READY,
0,
0);
}
break;
default:
return -EINVAL;
break;
}
}
break;
default:
return -EINVAL;
break;
}
return SOS_OK;
}
#ifndef _MODULE_
mod_header_ptr generic_test_get_header() {
return sos_get_header_address(mod_header);
}
#endif
|
/*
* Copyright (c) 2004-2005, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: lc.h,v 1.1 2011-08-04 11:02:33 hansrempel Exp $
*/
/**
* \addtogroup pt
* @{
*/
/**
* \defgroup lc Local continuations
* @{
*
* Local continuations form the basis for implementing protothreads. A
* local continuation can be <i>set</i> in a specific function to
* capture the state of the function. After a local continuation has
* been set can be <i>resumed</i> in order to restore the state of the
* function at the point where the local continuation was set.
*
*
*/
/**
* \file lc.h
* Local continuations
* \author
* Adam Dunkels <adam@sics.se>
*
*/
#ifdef DOXYGEN
/**
* Initialize a local continuation.
*
* This operation initializes the local continuation, thereby
* unsetting any previously set continuation state.
*
* \hideinitializer
*/
#define LC_INIT(lc)
/**
* Set a local continuation.
*
* The set operation saves the state of the function at the point
* where the operation is executed. As far as the set operation is
* concerned, the state of the function does <b>not</b> include the
* call-stack or local (automatic) variables, but only the program
* counter and such CPU registers that needs to be saved.
*
* \hideinitializer
*/
#define LC_SET(lc)
/**
* Resume a local continuation.
*
* The resume operation resumes a previously set local continuation, thus
* restoring the state in which the function was when the local
* continuation was set. If the local continuation has not been
* previously set, the resume operation does nothing.
*
* \hideinitializer
*/
#define LC_RESUME(lc)
/**
* Mark the end of local continuation usage.
*
* The end operation signifies that local continuations should not be
* used any more in the function. This operation is not needed for
* most implementations of local continuation, but is required by a
* few implementations.
*
* \hideinitializer
*/
#define LC_END(lc)
/**
* \var typedef lc_t;
*
* The local continuation type.
*
* \hideinitializer
*/
#endif /* DOXYGEN */
#ifndef __LC_H__
#define __LC_H__
#ifdef LC_CONF_INCLUDE
//#include LC_CONF_INCLUDE
#else
#include "lc-switch.h"
#endif /* LC_CONF_INCLUDE */
#endif /* __LC_H__ */
/** @} */
/** @} */
|
/*
* Copyright (c) 2009 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _OBJC_FILE_NEW_H
# define _OBJC_FILE_NEW_H
//# if __OBJC2__
# include "objc-runtime-new.h"
__BEGIN_DECLS
// classref_t is not fixed up at launch; use remapClass() to convert
extern SEL *_getObjc2SelectorRefs(const header_info *hi, size_t *count);
extern message_ref_t *_getObjc2MessageRefs(const header_info *hi, size_t *count);
extern Class*_getObjc2ClassRefs(const header_info *hi, size_t *count);
extern Class*_getObjc2SuperRefs(const header_info *hi, size_t *count);
extern classref_t *_getObjc2ClassList(const header_info *hi, size_t *count);
extern classref_t *_getObjc2NonlazyClassList(const header_info *hi, size_t *count);
extern category_t **_getObjc2CategoryList(const header_info *hi, size_t *count);
extern category_t **_getObjc2NonlazyCategoryList(const header_info *hi, size_t *count);
extern protocol_t **_getObjc2ProtocolList(const header_info *hi, size_t *count);
extern protocol_t **_getObjc2ProtocolRefs(const header_info *hi, size_t *count);
__END_DECLS
//# endif
#endif
|
// ----------------------------------------------------------------------------
// MinimalDevice.h
//
// Authors:
// Peter Polidoro peterpolidoro@gmail.com
// ----------------------------------------------------------------------------
#ifndef MINIMAL_DEVICE_H
#define MINIMAL_DEVICE_H
#include <Functor.h>
#include <ModularServer.h>
#include "Constants.h"
class MinimalDevice
{
public:
void setup();
void startServer();
void update();
private:
modular_server::ModularServer modular_server_;
modular_server::Pin pins_[constants::PIN_COUNT_MAX];
modular_server::Property properties_[constants::PROPERTY_COUNT_MAX];
modular_server::Parameter parameters_[constants::PARAMETER_COUNT_MAX];
modular_server::Function functions_[constants::FUNCTION_COUNT_MAX];
modular_server::Callback callbacks_[constants::CALLBACK_COUNT_MAX];
// Handlers
};
#endif
|
// 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 UI_GTK_PRINTING_GTK_UTIL_H_
#define UI_GTK_PRINTING_GTK_UTIL_H_
#include "ui/gfx/geometry/size.h"
namespace printing {
class PrintingContextLinux;
class PrintSettings;
} // namespace printing
typedef struct _GtkPrintSettings GtkPrintSettings;
typedef struct _GtkPageSetup GtkPageSetup;
// Obtains the paper size through Gtk.
gfx::Size GetPdfPaperSizeDeviceUnitsGtk(
printing::PrintingContextLinux* context);
// Initializes a PrintSettings object from the provided Gtk printer objects.
void InitPrintSettingsGtk(GtkPrintSettings* settings,
GtkPageSetup* page_setup,
printing::PrintSettings* print_settings);
#endif // UI_GTK_PRINTING_GTK_UTIL_H_
|
#pragma once
#include "gl\glew.h"
#include "wx\glcanvas.h"
#include "wx\wx.h"
#include "wx\aui\aui.h"
#include "wx\panel.h"
#include "wx\tglbtn.h"
#include "wx\listctrl.h"
#include "wxPLplotwindow.h"
#include "Core/Core.h"
#include "Geometry_Implementation.h"
typedef void (*selection_callback_type)(const boost::container::list<void*>&,const boost::container::list<void*>&,const boost::container::list<void*>&,boost::container::vector<pair<string,string>>&);
typedef void (*double_click_callback_type)(const boost::container::list<void*>&,boost::container::vector<pair<string,string>>&,boost::container::vector<boost::container::vector<string>>&);
typedef bool (*submission_callback_type)(const boost::container::list<void*>&,const boost::container::vector<string>&,const boost::container::vector<string>&);
typedef float (*pixel_size_callback_type)(float);
typedef void (*reschedule_callback_type)(void*, int);
using namespace polaris;
//#include "io/Io.h"
//#include "User_Space\User_Space.h"
//#include "../User_Space/User_Space_with_odb.h"
//#include "Geometry_Implementation.h"
//implementation class Antares_Implementation;
|
//
// This file is subject to the software licence as defined in
// the file 'LICENCE.txt' included in this source code package.
//
#import "CREnumerator.h"
@interface CRSelectiveEnumerator : CREnumerator
- (id) initWithEnumerator:(NSEnumerator *)enumerator filter:(CRWhereBlock)filter;
@end
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PRINTING_UNITS_H_
#define PRINTING_UNITS_H_
#include "printing/printing_export.h"
namespace printing {
// Length of an inch in 0.001mm unit.
constexpr int kMicronsPerInch = 25400;
// Mil is a thousandth of an inch.
constexpr float kMicronsPerMil = 25.4f;
constexpr int kMilsPerInch = 1000;
// Length of an inch in CSS's 1pt unit.
// http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc
constexpr int kPointsPerInch = 72;
// Length of an inch in CSS's 1px unit.
// http://dev.w3.org/csswg/css3-values/#the-px-unit
constexpr int kPixelsPerInch = 96;
// Dpi used to save to PDF or Cloud Print.
constexpr int kDefaultPdfDpi = 300;
// LETTER: 8.5 x 11 inches
constexpr float kLetterWidthInch = 8.5f;
constexpr float kLetterHeightInch = 11.0f;
// LEGAL: 8.5 x 14 inches
constexpr float kLegalWidthInch = 8.5f;
constexpr float kLegalHeightInch = 14.0f;
// A4: 8.27 x 11.69 inches
constexpr float kA4WidthInch = 8.27f;
constexpr float kA4HeightInch = 11.69f;
// A3: 11.69 x 16.54 inches
constexpr float kA3WidthInch = 11.69f;
constexpr float kA3HeightInch = 16.54f;
// Converts from one unit system to another using integer arithmetics.
PRINTING_EXPORT int ConvertUnit(double value, int old_unit, int new_unit);
// Converts from one unit system to another using doubles.
PRINTING_EXPORT double ConvertUnitDouble(double value,
double old_unit,
double new_unit);
// Converts from 1 pixel to 1 point using integers.
PRINTING_EXPORT int ConvertPixelsToPoint(int pixels);
// Converts from 1 pixel to 1 point using doubles.
PRINTING_EXPORT double ConvertPixelsToPointDouble(double pixels);
// Converts from 1 point to 1 pixel using doubles.
PRINTING_EXPORT double ConvertPointsToPixelDouble(double points);
} // namespace printing
#endif // PRINTING_UNITS_H_
|
/// @file
/// @author Boris Mikic
/// @version 3.0
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php
///
/// @section DESCRIPTION
///
/// Defines an animator that can move objects vertically.
#ifndef APRILUI_MOVER_Y_H
#define APRILUI_MOVER_Y_H
#include <hltypes/hstring.h>
#include "Animator.h"
namespace aprilui
{
namespace Animators
{
class apriluiExport MoverY : public Animator
{
public:
MoverY(chstr name);
~MoverY();
static Animator* createInstance(chstr name);
void update(float k);
protected:
float _getObjectValue();
void _setObjectValue(float value);
};
}
}
#endif
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_WEBRTC_LOG_H_
#define CONTENT_PUBLIC_BROWSER_WEBRTC_LOG_H_
#include <string>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "content/common/content_export.h"
#include "media/media_buildflags.h"
namespace content {
class CONTENT_EXPORT WebRtcLog {
public:
// When set, |callback| receives log messages regarding, for example, media
// devices (webcams, mics, etc) that were initially requested in the render
// process associated with the RenderProcessHost with |render_process_id|.
static void SetLogMessageCallback(
int render_process_id,
base::RepeatingCallback<void(const std::string&)> callback);
static void ClearLogMessageCallback(int render_process_id);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcLog);
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_WEBRTC_LOG_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_MOJOM_TRAITS_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_MOJOM_TRAITS_H_
#include "base/containers/span.h"
#include "base/strings/string16.h"
#include "mojo/public/cpp/base/string16_mojom_traits.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "skia/public/mojom/bitmap_skbitmap_mojom_traits.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/notifications/platform_notification_data.h"
#include "third_party/blink/public/mojom/notifications/notification.mojom-forward.h"
#include "url/gurl.h"
#include "url/mojom/url_gurl_mojom_traits.h"
namespace mojo {
template <>
struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::NotificationActionType,
blink::PlatformNotificationActionType> {
static blink::mojom::NotificationActionType ToMojom(
blink::PlatformNotificationActionType input);
static bool FromMojom(blink::mojom::NotificationActionType input,
blink::PlatformNotificationActionType* out);
};
template <>
struct BLINK_COMMON_EXPORT
StructTraits<blink::mojom::NotificationActionDataView,
blink::PlatformNotificationAction> {
static blink::PlatformNotificationActionType type(
const blink::PlatformNotificationAction& action) {
return action.type;
}
static const std::string& action(
const blink::PlatformNotificationAction& action) {
return action.action;
}
static const base::string16& title(
const blink::PlatformNotificationAction& action) {
return action.title;
}
static const GURL& icon(const blink::PlatformNotificationAction& action) {
return action.icon;
}
static const base::Optional<base::string16>& placeholder(
const blink::PlatformNotificationAction& action) {
return action.placeholder.as_optional_string16();
}
static bool Read(
blink::mojom::NotificationActionDataView notification_action,
blink::PlatformNotificationAction* platform_notification_action);
};
template <>
struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::NotificationDataDataView,
blink::PlatformNotificationData> {
static const base::string16& title(
const blink::PlatformNotificationData& data) {
return data.title;
}
static blink::mojom::NotificationDirection direction(
const blink::PlatformNotificationData& data) {
return data.direction;
}
static const std::string& lang(const blink::PlatformNotificationData& data) {
return data.lang;
}
static const base::string16& body(
const blink::PlatformNotificationData& data) {
return data.body;
}
static const std::string& tag(const blink::PlatformNotificationData& data) {
return data.tag;
}
static const GURL& image(const blink::PlatformNotificationData& data) {
return data.image;
}
static const GURL& icon(const blink::PlatformNotificationData& data) {
return data.icon;
}
static const GURL& badge(const blink::PlatformNotificationData& data) {
return data.badge;
}
static const base::span<const int32_t> vibration_pattern(
const blink::PlatformNotificationData& data) {
// TODO(https://crbug.com/798466): Store as int32s to avoid this cast.
return base::make_span(
reinterpret_cast<const int32_t*>(data.vibration_pattern.data()),
data.vibration_pattern.size());
}
static double timestamp(const blink::PlatformNotificationData& data) {
return data.timestamp.ToJsTime();
}
static bool renotify(const blink::PlatformNotificationData& data) {
return data.renotify;
}
static bool silent(const blink::PlatformNotificationData& data) {
return data.silent;
}
static bool require_interaction(const blink::PlatformNotificationData& data) {
return data.require_interaction;
}
static const base::span<const uint8_t> data(
const blink::PlatformNotificationData& data) {
// TODO(https://crbug.com/798466): Align data types to avoid this cast.
return base::make_span(reinterpret_cast<const uint8_t*>(data.data.data()),
data.data.size());
}
static const std::vector<blink::PlatformNotificationAction>& actions(
const blink::PlatformNotificationData& data) {
return data.actions;
}
static base::Optional<base::Time> show_trigger_timestamp(
const blink::PlatformNotificationData& data) {
return data.show_trigger_timestamp;
}
static bool Read(blink::mojom::NotificationDataDataView notification_data,
blink::PlatformNotificationData* platform_notification_data);
};
template <>
struct BLINK_COMMON_EXPORT
StructTraits<blink::mojom::NotificationResourcesDataView,
blink::NotificationResources> {
static const SkBitmap& image(const blink::NotificationResources& resources) {
return resources.image;
}
static const SkBitmap& icon(const blink::NotificationResources& resources) {
return resources.notification_icon;
}
static const SkBitmap& badge(const blink::NotificationResources& resources) {
return resources.badge;
}
static const std::vector<SkBitmap>& action_icons(
const blink::NotificationResources& resources) {
return resources.action_icons;
}
static bool Read(blink::mojom::NotificationResourcesDataView in,
blink::NotificationResources* out);
};
} // namespace mojo
#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_NOTIFICATIONS_NOTIFICATION_MOJOM_TRAITS_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_RELOAD_BUTTON_H__
#define CHROME_BROWSER_UI_VIEWS_RELOAD_BUTTON_H__
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/timer.h"
#include "ui/views/controls/button/image_button.h"
class CommandUpdater;
class LocationBarView;
////////////////////////////////////////////////////////////////////////////////
//
// ReloadButton
//
// The reload button in the toolbar, which changes to a stop button when a page
// load is in progress. Trickiness comes from the desire to have the 'stop'
// button not change back to 'reload' if the user's mouse is hovering over it
// (to prevent mis-clicks).
//
////////////////////////////////////////////////////////////////////////////////
class ReloadButton : public views::ToggleImageButton,
public views::ButtonListener {
public:
enum Mode { MODE_RELOAD = 0, MODE_STOP };
// The button's class name.
static const char kViewClassName[];
ReloadButton(LocationBarView* location_bar, CommandUpdater* command_updater);
virtual ~ReloadButton();
// Ask for a specified button state. If |force| is true this will be applied
// immediately.
void ChangeMode(Mode mode, bool force);
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* /* button */,
const views::Event& event) OVERRIDE;
// Overridden from views::View:
virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
virtual bool GetTooltipText(const gfx::Point& p,
string16* tooltip) const OVERRIDE;
virtual std::string GetClassName() const OVERRIDE;
private:
friend class ReloadButtonTest;
void OnDoubleClickTimer();
void OnStopToReloadTimer();
base::OneShotTimer<ReloadButton> double_click_timer_;
base::OneShotTimer<ReloadButton> stop_to_reload_timer_;
// These may be NULL when testing.
LocationBarView* location_bar_;
CommandUpdater* command_updater_;
// The mode we should be in assuming no timers are running.
Mode intended_mode_;
// The currently-visible mode - this may differ from the intended mode.
Mode visible_mode_;
// The delay times for the timers. These are members so that tests can modify
// them.
base::TimeDelta double_click_timer_delay_;
base::TimeDelta stop_to_reload_timer_delay_;
// TESTING ONLY
// True if we should pretend the button is hovered.
bool testing_mouse_hovered_;
// Increments when we would tell the browser to "reload", so
// test code can tell whether we did so (as there may be no |browser_|).
int testing_reload_count_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButton);
};
#endif // CHROME_BROWSER_UI_VIEWS_RELOAD_BUTTON_H__
|
/* $OpenBSD: pcy_map.c,v 1.3 2014/06/12 15:49:31 deraadt Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2004.
*/
/* ====================================================================
* Copyright (c) 2004 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include "cryptlib.h"
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "pcy_int.h"
/* Set policy mapping entries in cache.
* Note: this modifies the passed POLICY_MAPPINGS structure
*/
int
policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps)
{
POLICY_MAPPING *map;
X509_POLICY_DATA *data;
X509_POLICY_CACHE *cache = x->policy_cache;
int i;
int ret = 0;
if (sk_POLICY_MAPPING_num(maps) == 0) {
ret = -1;
goto bad_mapping;
}
for (i = 0; i < sk_POLICY_MAPPING_num(maps); i++) {
map = sk_POLICY_MAPPING_value(maps, i);
/* Reject if map to or from anyPolicy */
if ((OBJ_obj2nid(map->subjectDomainPolicy) == NID_any_policy) ||
(OBJ_obj2nid(map->issuerDomainPolicy) == NID_any_policy)) {
ret = -1;
goto bad_mapping;
}
/* Attempt to find matching policy data */
data = policy_cache_find_data(cache, map->issuerDomainPolicy);
/* If we don't have anyPolicy can't map */
if (!data && !cache->anyPolicy)
continue;
/* Create a NODE from anyPolicy */
if (!data) {
data = policy_data_new(NULL, map->issuerDomainPolicy,
cache->anyPolicy->flags &
POLICY_DATA_FLAG_CRITICAL);
if (!data)
goto bad_mapping;
data->qualifier_set = cache->anyPolicy->qualifier_set;
/*map->issuerDomainPolicy = NULL;*/
data->flags |= POLICY_DATA_FLAG_MAPPED_ANY;
data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;
if (!sk_X509_POLICY_DATA_push(cache->data, data)) {
policy_data_free(data);
goto bad_mapping;
}
} else
data->flags |= POLICY_DATA_FLAG_MAPPED;
if (!sk_ASN1_OBJECT_push(data->expected_policy_set,
map->subjectDomainPolicy))
goto bad_mapping;
map->subjectDomainPolicy = NULL;
}
ret = 1;
bad_mapping:
if (ret == -1)
x->ex_flags |= EXFLAG_INVALID_POLICY;
sk_POLICY_MAPPING_pop_free(maps, POLICY_MAPPING_free);
return ret;
}
|
/*
* Copyright (c) 2013, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#import "ABI9_0_0RCTBridgeModule.h"
@interface ABI9_0_0RCTImagePickerManager : NSObject <ABI9_0_0RCTBridgeModule>
@end
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAST_NET_RTCP_RTCP_UTILITY_H_
#define MEDIA_CAST_NET_RTCP_RTCP_UTILITY_H_
#include <stddef.h>
#include <stdint.h>
#include "base/big_endian.h"
#include "base/macros.h"
#include "media/cast/logging/logging_defines.h"
#include "media/cast/net/cast_transport_config.h"
#include "media/cast/net/rtcp/rtcp_defines.h"
namespace media {
namespace cast {
// RFC 3550 page 44, including end null.
static const size_t kRtcpCnameSize = 256;
static const uint32_t kCast = ('C' << 24) + ('A' << 16) + ('S' << 8) + 'T';
static const uint32_t kCst2 = ('C' << 24) + ('S' << 16) + ('T' << 8) + '2';
static const uint8_t kReceiverLogSubtype = 2;
static const size_t kRtcpMaxReceiverLogMessages = 256;
static const size_t kRtcpMaxCastLossFields = 100;
struct RtcpCommonHeader {
uint8_t V; // Version.
bool P; // Padding.
uint8_t IC; // Item count / subtype.
uint8_t PT; // Packet Type.
size_t length_in_octets;
};
class RtcpParser {
public:
RtcpParser(uint32_t local_ssrc, uint32_t remote_ssrc);
~RtcpParser();
bool Parse(base::BigEndianReader* reader);
bool has_sender_report() const { return has_sender_report_; }
const RtcpSenderInfo& sender_report() const {
return sender_report_;
}
bool has_last_report() const { return has_last_report_; }
uint32_t last_report() const { return last_report_; }
uint32_t delay_since_last_report() const { return delay_since_last_report_; }
bool has_receiver_log() const { return !receiver_log_.empty(); }
const RtcpReceiverLogMessage& receiver_log() const { return receiver_log_; }
RtcpReceiverLogMessage* mutable_receiver_log() { return & receiver_log_; }
bool has_cast_message() const { return has_cast_message_; }
const RtcpCastMessage& cast_message() const { return cast_message_; }
RtcpCastMessage* mutable_cast_message() { return &cast_message_; }
// Return if successfully parsed the extended feedback.
bool has_cst2_message() const { return has_cst2_message_; }
bool has_receiver_reference_time_report() const {
return has_receiver_reference_time_report_;
}
const RtcpReceiverReferenceTimeReport&
receiver_reference_time_report() const {
return receiver_reference_time_report_;
}
bool has_picture_loss_indicator() const {
return has_picture_loss_indicator_;
}
private:
bool ParseCommonHeader(base::BigEndianReader* reader,
RtcpCommonHeader* parsed_header);
bool ParseSR(base::BigEndianReader* reader, const RtcpCommonHeader& header);
bool ParseRR(base::BigEndianReader* reader, const RtcpCommonHeader& header);
bool ParseReportBlock(base::BigEndianReader* reader);
bool ParsePli(base::BigEndianReader* reader, const RtcpCommonHeader& header);
bool ParseApplicationDefined(base::BigEndianReader* reader,
const RtcpCommonHeader& header);
bool ParseCastReceiverLogFrameItem(base::BigEndianReader* reader);
bool ParseFeedbackCommon(base::BigEndianReader* reader,
const RtcpCommonHeader& header);
bool ParseExtendedReport(base::BigEndianReader* reader,
const RtcpCommonHeader& header);
bool ParseExtendedReportReceiverReferenceTimeReport(
base::BigEndianReader* reader,
uint32_t remote_ssrc);
bool ParseExtendedReportDelaySinceLastReceiverReport(
base::BigEndianReader* reader);
const uint32_t local_ssrc_;
const uint32_t remote_ssrc_;
bool has_sender_report_;
RtcpSenderInfo sender_report_;
uint32_t last_report_;
uint32_t delay_since_last_report_;
bool has_last_report_;
// |receiver_log_| is a vector vector, no need for has_*.
RtcpReceiverLogMessage receiver_log_;
bool has_cast_message_;
RtcpCastMessage cast_message_;
bool has_cst2_message_;
bool has_receiver_reference_time_report_;
RtcpReceiverReferenceTimeReport receiver_reference_time_report_;
// Tracks recently-parsed RTP timestamps so that the truncated values can be
// re-expanded into full-form.
RtpTimeTicks last_parsed_sr_rtp_timestamp_;
RtpTimeTicks last_parsed_frame_log_rtp_timestamp_;
// Indicates if sender received the Pli message from the receiver.
bool has_picture_loss_indicator_;
DISALLOW_COPY_AND_ASSIGN(RtcpParser);
};
// Converts a log event type to an integer value.
// NOTE: We have only allocated 4 bits to represent the type of event over the
// wire. Therefore, this function can only return values from 0 to 15.
uint8_t ConvertEventTypeToWireFormat(CastLoggingEvent event);
// The inverse of |ConvertEventTypeToWireFormat()|.
CastLoggingEvent TranslateToLogEventFromWireFormat(uint8_t event);
// Splits an NTP timestamp having a microsecond timebase into the standard two
// 32-bit integer wire format.
void ConvertTimeToFractions(int64_t ntp_time_us,
uint32_t* seconds,
uint32_t* fractions);
// Maps a base::TimeTicks value to an NTP timestamp comprised of two components.
void ConvertTimeTicksToNtp(const base::TimeTicks& time,
uint32_t* ntp_seconds,
uint32_t* ntp_fractions);
// Create a NTP diff from seconds and fractions of seconds; delay_fraction is
// fractions of a second where 0x80000000 is half a second.
uint32_t ConvertToNtpDiff(uint32_t delay_seconds, uint32_t delay_fraction);
// Maps an NTP timestamp, comprised of two components, to a base::TimeTicks
// value.
base::TimeTicks ConvertNtpToTimeTicks(uint32_t ntp_seconds,
uint32_t ntp_fractions);
bool IsRtcpPacket(const uint8_t* packet, size_t length);
uint32_t GetSsrcOfSender(const uint8_t* rtcp_buffer, size_t length);
} // namespace cast
} // namespace media
#endif // MEDIA_CAST_NET_RTCP_RTCP_UTILITY_H_
|
/*
* 2007 2013 Copyright Northwestern University
*
* Distributed under the OSI-approved BSD 3-Clause License.
* See http://ncip.github.com/annotation-and-image-markup/LICENSE.txt for details.
*/
#ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_BL_NonNull
#define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_BL_NonNull
#include "type_iso.CANY.h"
namespace AIMXML
{
namespace iso
{
class CNPPD_BL_NonNull : public ::AIMXML::iso::CANY
{
public:
AIMXML_EXPORT CNPPD_BL_NonNull(xercesc::DOMNode* const& init);
AIMXML_EXPORT CNPPD_BL_NonNull(CNPPD_BL_NonNull const& init);
void operator=(CNPPD_BL_NonNull const& other) { m_node = other.m_node; }
static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CNPPD_BL_NonNull); }
MemberElement<iso::CUVP_BL_NonNull, _altova_mi_iso_altova_CNPPD_BL_NonNull_altova_item> item;
struct item { typedef Iterator<iso::CUVP_BL_NonNull> iterator; };
AIMXML_EXPORT void SetXsiType();
};
} // namespace iso
} // namespace AIMXML
#endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_BL_NonNull
|
//
// object_input.h
// x2d
//
// Created by Alex Kremer on 7/26/12.
// Copyright (c) 2012 godexsoft. All rights reserved.
//
#pragma once
#ifndef __X2D_OBJECT_INPUT_H__
#define __X2D_OBJECT_INPUT_H__
#include "base_object.h"
#include "glm.hpp"
#include "log.h"
#include <deque>
namespace x2d {
// forward declare kernel to make friends
class kernel;
namespace input {
class object_input_manager
: public base_object
{
public:
object_input_manager(kernel& k)
: base_object(k)
{
connect_touch_input(CAMERA_SPACE);
}
void register_object(object* obj);
void deregister_object(object* obj);
void touch_input_began(space s, const std::vector<touch>& touches);
void touch_input_moved(space s, const std::vector<touch>& touches);
void touch_input_ended(space s, const std::vector<touch>& touches);
private:
enum input_state
{
RELEASED = 0,
PRESSED,
};
typedef std::map<object*, input_state> obj_map;
obj_map objects_;
};
} // namespace input
} // namespace x2d
using namespace x2d::input;
#endif // __X2D_OBJECT_INPUT_H__
|
#import <Flutter/Flutter.h>
@interface SharedPreferencesPlugin : NSObject<FlutterPlugin>
@end
|
////////////////////////////////////////////////////////////////////////////////
/// ///
/// AliFemtoShareQualityCorrFctn - A correlation function that saves the ///
/// amount of sharing and splitting hits per pair as a function of qinv ///
/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu ///
/// ///
////////////////////////////////////////////////////////////////////////////////
#ifndef AliFemtoShareQualityCorrFctn_hh
#define AliFemtoShareQualityCorrFctn_hh
#include "TH1D.h"
#include "TH2D.h"
#include "AliFemtoCorrFctn.h"
class AliFemtoShareQualityCorrFctn : public AliFemtoCorrFctn {
public:
AliFemtoShareQualityCorrFctn(const char* title, const int& nbins, const float& QinvLo, const float& QinvHi);
AliFemtoShareQualityCorrFctn(const AliFemtoShareQualityCorrFctn& aCorrFctn);
virtual ~AliFemtoShareQualityCorrFctn();
AliFemtoShareQualityCorrFctn& operator=(const AliFemtoShareQualityCorrFctn& aCorrFctn);
virtual AliFemtoString Report();
virtual void AddRealPair(AliFemtoPair* aPair);
virtual void AddMixedPair(AliFemtoPair* aPair);
virtual void Finish();
void WriteHistos();
virtual TList* GetOutputList();
private:
TH2D *fShareNumerator; // Share fraction for real pairs
TH2D *fShareDenominator; // share fraction for mixed pairs
TH2D *fQualityNumerator; // quality for real pairs
TH2D *fQualityDenominator; // quality for mixed pairs
TH2D *fTPCSepNumerator; // TPCSep for real pairs
TH2D *fTPCSepDenominator; // TPCSep for mixed pairs
#ifdef __ROOT__
ClassDef(AliFemtoShareQualityCorrFctn, 1)
#endif
};
#endif
|
#ifndef DB_CLUSTER_H
#define DB_CLUSTER_H
#include <stdint.h>
#include <assert.h>
#include <util/atomic.h>
#include <raft/raft.pb.h>
namespace db {
class Cluster {
public:
explicit Cluster(const raft::Config &config)
: config_(config) {
util::atomic_set(&refs_, 0);
}
/*
* Reference count management (so Cluster do not disappear out from
* under live iterators)
*/
void Ref() {
util::atomic_inc(&refs_);
}
void Unref() {
assert(util::atomic_read(&refs_) >= 1);
if (util::atomic_dec_and_test(&refs_)) {
delete this;
}
}
const raft::Config& config() const { return config_; }
private:
util::atomic_t refs_;
raft::Config config_;
private:
/* Private since only Unref() should be used to delete it */
~Cluster() { }
/* No copying allowed */
Cluster(const Cluster &);
void operator=(const Cluster &);
};
} // namespace db
#endif /* DB_CLUSTER_H */
|
/* IEEE754 floating point arithmetic
* single precision
*/
/*
* MIPS floating point support
* Copyright (C) 1994-2000 Algorithmics Ltd.
*
* ########################################################################
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* ########################################################################
*/
#include "ieee754sp.h"
ieee754sp ieee754sp_mul(ieee754sp x, ieee754sp y)
{
COMPXSP;
COMPYSP;
EXPLODEXSP;
EXPLODEYSP;
CLEARCX;
FLUSHXSP;
FLUSHYSP;
switch (CLPAIR(xc, yc)) {
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
SETCX(IEEE754_INVALID_OPERATION);
return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y);
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
return y;
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
return x;
/* Infinity handling */
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
SETCX(IEEE754_INVALID_OPERATION);
return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y);
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
return ieee754sp_inf(xs ^ ys);
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
return ieee754sp_zero(xs ^ ys);
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
SPDNORMX;
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
SPDNORMY;
break;
case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
SPDNORMX;
break;
case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
break;
}
/* rm = xm * ym, re = xe+ye basically */
assert(xm & SP_HIDDEN_BIT);
assert(ym & SP_HIDDEN_BIT);
{
int re = xe + ye;
int rs = xs ^ ys;
unsigned rm;
/* shunt to top of word */
xm <<= 32 - (SP_MBITS + 1);
ym <<= 32 - (SP_MBITS + 1);
/* multiply 32bits xm,ym to give high 32bits rm with stickness
*/
{
unsigned short lxm = xm & 0xffff;
unsigned short hxm = xm >> 16;
unsigned short lym = ym & 0xffff;
unsigned short hym = ym >> 16;
unsigned lrm;
unsigned hrm;
lrm = lxm * lym; /* 16 * 16 => 32 */
hrm = hxm * hym; /* 16 * 16 => 32 */
{
unsigned t = lxm * hym; /* 16 * 16 => 32 */
{
unsigned at = lrm + (t << 16);
hrm += at < lrm;
lrm = at;
}
hrm = hrm + (t >> 16);
}
{
unsigned t = hxm * lym; /* 16 * 16 => 32 */
{
unsigned at = lrm + (t << 16);
hrm += at < lrm;
lrm = at;
}
hrm = hrm + (t >> 16);
}
rm = hrm | (lrm != 0);
}
/*
* sticky shift down to normal rounding precision
*/
if ((int) rm < 0) {
rm = (rm >> (32 - (SP_MBITS + 1 + 3))) |
((rm << (SP_MBITS + 1 + 3)) != 0);
re++;
} else {
rm = (rm >> (32 - (SP_MBITS + 1 + 3 + 1))) |
((rm << (SP_MBITS + 1 + 3 + 1)) != 0);
}
assert(rm & (SP_HIDDEN_BIT << 3));
SPNORMRET2(rs, re, rm, "mul", x, y);
}
}
|
/*-
* Copyright (c) 2014 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Semihalf under
* the sponsorship of the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_DEBUG_MONITOR_H_
#define _MACHINE_DEBUG_MONITOR_H_
#ifdef DDB
#include <machine/db_machdep.h>
enum dbg_access_t {
HW_BREAKPOINT_X = 0,
HW_WATCHPOINT_R = 1,
HW_WATCHPOINT_W = 2,
HW_WATCHPOINT_RW = HW_WATCHPOINT_R | HW_WATCHPOINT_W,
};
#if __ARM_ARCH >= 6
void dbg_monitor_init(void);
void dbg_monitor_init_secondary(void);
void dbg_show_watchpoint(void);
int dbg_setup_watchpoint(db_expr_t, db_expr_t, enum dbg_access_t);
int dbg_remove_watchpoint(db_expr_t, db_expr_t);
void dbg_resume_dbreg(void);
#else /* __ARM_ARCH >= 6 */
static __inline void
dbg_show_watchpoint(void)
{
}
static __inline int
dbg_setup_watchpoint(db_expr_t addr __unused, db_expr_t size __unused,
enum dbg_access_t access __unused)
{
return (ENXIO);
}
static __inline int
dbg_remove_watchpoint(db_expr_t addr __unused, db_expr_t size __unused)
{
return (ENXIO);
}
static __inline void
dbg_monitor_init(void)
{
}
static __inline void
dbg_monitor_init_secondary(void)
{
}
static __inline void
dbg_resume_dbreg(void)
{
}
#endif /* __ARM_ARCH < 6 */
#else /* DDB */
static __inline void
dbg_monitor_init(void)
{
}
#endif
#endif /* _MACHINE_DEBUG_MONITOR_H_ */
|
// Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
//
// X Macro include for commonly used DXGI-compatible
// formats.
//
// We don't need to include every single DXGI format here.
// But it's convenient to use formats that are compatible
// with the DXGI list (at least for simple, uncompressed
// formats). Some compressed formats
//
_EXP( R32G32B32A32, TYPELESS, None, 32*4 )
_EXP( R32G32B32A32, FLOAT, None, 32*4 )
_EXP( R32G32B32A32, UINT, None, 32*4 )
_EXP( R32G32B32A32, SINT, None, 32*4 )
_EXP( R32G32B32, TYPELESS, None, 32*3 )
_EXP( R32G32B32, FLOAT, None, 32*3 )
_EXP( R32G32B32, UINT, None, 32*3 )
_EXP( R32G32B32, SINT, None, 32*3 )
_EXP( R16G16B16A16, TYPELESS, None, 16*4 )
_EXP( R16G16B16A16, FLOAT, None, 16*4 )
_EXP( R16G16B16A16, UNORM, None, 16*4 )
_EXP( R16G16B16A16, UINT, None, 16*4 )
_EXP( R16G16B16A16, SNORM, None, 16*4 )
_EXP( R16G16B16A16, SINT, None, 16*4 )
_EXP( R32G32, TYPELESS, None, 32*2 )
_EXP( R32G32, FLOAT, None, 32*2 )
_EXP( R32G32, UINT, None, 32*2 )
_EXP( R32G32, SINT, None, 32*2 )
//
// These formats don't suit our macros (but aren't very useful)
//
// DXGI_FORMAT_R32G8X24_TYPELESS = 19,
// DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
// DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
// DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
//
_EXP( R10G10B10A2, TYPELESS, None, 32 )
_EXP( R10G10B10A2, UNORM, None, 32 )
_EXP( R10G10B10A2, UINT, None, 32 )
_EXP( R11G11B10, FLOAT, None, 32 )
_EXP( R8G8B8A8, TYPELESS, None, 8*4 )
_EXP( R8G8B8A8, UNORM, None, 8*4 )
_EXP( R8G8B8A8, UNORM_SRGB, None, 8*4 )
_EXP( R8G8B8A8, UINT, None, 8*4 )
_EXP( R8G8B8A8, SNORM, None, 8*4 )
_EXP( R8G8B8A8, SINT, None, 8*4 )
_EXP( R16G16, TYPELESS, None, 16*2 )
_EXP( R16G16, FLOAT, None, 16*2 )
_EXP( R16G16, UNORM, None, 16*2 )
_EXP( R16G16, UINT, None, 16*2 )
_EXP( R16G16, SNORM, None, 16*2 )
_EXP( R16G16, SINT, None, 16*2 )
_EXP( R32, TYPELESS, None, 32 )
_EXP( D32, FLOAT, None, 32 )
_EXP( R32, FLOAT, None, 32 )
_EXP( R32, UINT, None, 32 )
_EXP( R32, SINT, None, 32 )
//
// These formats don't suit our macros (but are useful!)
//
// DXGI_FORMAT_R24G8_TYPELESS = 44,
// DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
// DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
// DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
//
_EXP( R8G8, TYPELESS, None, 8*2 )
_EXP( R8G8, UNORM, None, 8*2 )
_EXP( R8G8, UINT, None, 8*2 )
_EXP( R8G8, SNORM, None, 8*2 )
_EXP( R8G8, SINT, None, 8*2 )
_EXP( R16, TYPELESS, None, 16 )
_EXP( R16, FLOAT, None, 16 )
_EXP( D16, UNORM, None, 16 )
_EXP( R16, UNORM, None, 16 )
_EXP( R16, UINT, None, 16 )
_EXP( R16, SNORM, None, 16 )
_EXP( R16, SINT, None, 16 )
_EXP( R8, TYPELESS, None, 8 )
_EXP( R8, UNORM, None, 8 )
_EXP( R8, UINT, None, 8 )
_EXP( R8, SNORM, None, 8 )
_EXP( R8, SINT, None, 8 )
_EXP( A8, UNORM, None, 8 )
_EXP( R1, UNORM, None, 1 )
_EXP( R9G9B9E5, SHAREDEXP, None, 32 )
_EXP( R8G8_B8G8, UNORM, None, 16 )
_EXP( G8R8_G8B8, UNORM, None, 16 )
_EXP( BC1, TYPELESS, BlockCompression, 4 )
_EXP( BC1, UNORM, BlockCompression, 4 )
_EXP( BC1, UNORM_SRGB, BlockCompression, 4 )
_EXP( BC2, TYPELESS, BlockCompression, 8 )
_EXP( BC2, UNORM, BlockCompression, 8 )
_EXP( BC2, UNORM_SRGB, BlockCompression, 8 )
_EXP( BC3, TYPELESS, BlockCompression, 8 )
_EXP( BC3, UNORM, BlockCompression, 8 )
_EXP( BC3, UNORM_SRGB, BlockCompression, 8 )
_EXP( BC4, TYPELESS, BlockCompression, 8 )
_EXP( BC4, UNORM, BlockCompression, 8 )
_EXP( BC4, SNORM, BlockCompression, 8 )
_EXP( BC5, TYPELESS, BlockCompression, 8 )
_EXP( BC5, UNORM, BlockCompression, 8 )
_EXP( BC5, SNORM, BlockCompression, 8 )
_EXP( BC6H, TYPELESS, BlockCompression, 8 )
_EXP( BC6H, UF16, BlockCompression, 8 )
_EXP( BC6H, SF16, BlockCompression, 8 )
_EXP( BC7, TYPELESS, BlockCompression, 8 )
_EXP( BC7, UNORM, BlockCompression, 8 )
_EXP( BC7, UNORM_SRGB, BlockCompression, 8 )
_EXP( B5G6R5, UNORM, None, 16 )
_EXP( B5G5R5A1, UNORM, None, 16 )
_EXP( B8G8R8A8, TYPELESS, None, 8*4 )
_EXP( B8G8R8A8, UNORM, None, 8*4 )
_EXP( B8G8R8A8, UNORM_SRGB, None, 8*4 )
_EXP( B8G8R8X8, TYPELESS, None, 8*4 )
_EXP( B8G8R8X8, UNORM, None, 8*4 )
_EXP( B8G8R8X8, UNORM_SRGB, None, 8*4 )
//
// Some less common types
//
// DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
//
|
/**
* See Copyright Notice in picrin.h
*/
#ifndef PICRIN_LIB_H
#define PICRIN_LIB_H
#if defined(__cplusplus)
extern "C" {
#endif
struct pic_lib {
PIC_OBJECT_HEADER
pic_value name;
struct pic_env *env;
struct pic_dict *exports;
};
#define pic_lib_p(o) (pic_type(o) == PIC_TT_LIB)
#define pic_lib_ptr(o) ((struct pic_lib *)pic_ptr(o))
#if defined(__cplusplus)
}
#endif
#endif
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SHELL_NATIVE_RUNNER_H_
#define MOJO_SHELL_NATIVE_RUNNER_H_
#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/process/process_handle.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/shell/public/interfaces/shell_client.mojom.h"
namespace base {
class FilePath;
}
namespace mojo {
class Identity;
namespace shell {
// Shell requires implementations of NativeRunner and NativeRunnerFactory to run
// native applications.
class NativeRunner {
public:
virtual ~NativeRunner() {}
// Loads the app in the file at |app_path| and runs it on some other
// thread/process. Returns a ShellClient handle the shell can use to connect
// to the the app.
virtual mojom::ShellClientPtr Start(
const base::FilePath& app_path,
const Identity& target,
bool start_sandboxed,
const base::Callback<void(base::ProcessId)>& pid_available_callback,
const base::Closure& app_completed_callback) = 0;
};
class NativeRunnerFactory {
public:
virtual ~NativeRunnerFactory() {}
virtual scoped_ptr<NativeRunner> Create(const base::FilePath& app_path) = 0;
};
} // namespace shell
} // namespace mojo
#endif // MOJO_SHELL_NATIVE_RUNNER_H_
|
#ifndef __V3S_REG_DE_H__
#define __V3S_REG_DE_H__
#include <types.h>
#define V3S_DE_BASE (0x01000000)
#define V3S_DE_MUX_GLB (0x00100000 + 0x00000)
#define V3S_DE_MUX_BLD (0x00100000 + 0x01000)
#define V3S_DE_MUX_CHAN (0x00100000 + 0x02000)
#define V3S_DE_MUX_VSU (0x00100000 + 0x20000)
#define V3S_DE_MUX_GSU1 (0x00100000 + 0x30000)
#define V3S_DE_MUX_GSU2 (0x00100000 + 0x40000)
#define V3S_DE_MUX_GSU3 (0x00100000 + 0x50000)
#define V3S_DE_MUX_FCE (0x00100000 + 0xa0000)
#define V3S_DE_MUX_BWS (0x00100000 + 0xa2000)
#define V3S_DE_MUX_LTI (0x00100000 + 0xa4000)
#define V3S_DE_MUX_PEAK (0x00100000 + 0xa6000)
#define V3S_DE_MUX_ASE (0x00100000 + 0xa8000)
#define V3S_DE_MUX_FCC (0x00100000 + 0xaa000)
#define V3S_DE_MUX_DCSC (0x00100000 + 0xb0000)
struct de_clk_t {
u32_t gate_cfg;
u32_t bus_cfg;
u32_t rst_cfg;
u32_t div_cfg;
u32_t sel_cfg;
};
struct de_glb_t {
u32_t ctl;
u32_t status;
u32_t dbuff;
u32_t size;
};
struct de_bld_t {
u32_t fcolor_ctl;
struct {
u32_t fcolor;
u32_t insize;
u32_t offset;
u32_t dum;
} attr[4];
u32_t dum0[15];
u32_t route;
u32_t premultiply;
u32_t bkcolor;
u32_t output_size;
u32_t bld_mode[4];
u32_t dum1[4];
u32_t ck_ctl;
u32_t ck_cfg;
u32_t dum2[2];
u32_t ck_max[4];
u32_t dum3[4];
u32_t ck_min[4];
u32_t dum4[3];
u32_t out_ctl;
};
struct de_vi_t {
struct {
u32_t attr;
u32_t size;
u32_t coord;
u32_t pitch[3];
u32_t top_laddr[3];
u32_t bot_laddr[3];
} cfg[4];
u32_t fcolor[4];
u32_t top_haddr[3];
u32_t bot_haddr[3];
u32_t ovl_size[2];
u32_t hori[2];
u32_t vert[2];
};
struct de_ui_t {
struct {
u32_t attr;
u32_t size;
u32_t coord;
u32_t pitch;
u32_t top_laddr;
u32_t bot_laddr;
u32_t fcolor;
u32_t dum;
} cfg[4];
u32_t top_haddr;
u32_t bot_haddr;
u32_t ovl_size;
};
#endif /* __V3S_REG_DE_H__ */
|
// Macro Guard
#ifndef CSE473_SINGLETON_H
#define CSE473_SINGLETON_H
/*============================================================================//
SingletonType.h: header file for generic singletons
Purpose is to allow user to create singleton object of arbitrary type.
Implementation: Shane J. Neph, June 2004, University of Washington
//============================================================================*/
template <typename T>
class SingletonType {
~SingletonType() { /* */ }
public:
static T* Instance() {
static T val;
return(&val);
}
};
#endif // CSE473_SINGLETON_H
|
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#pragma once
#ifndef __AFXOLE_H__
#include <afxole.h>
#endif
#include "afxcontrolbarutil.h"
#ifdef _AFX_PACKING
#pragma pack(push, _AFX_PACKING)
#endif
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, off)
#endif
/////////////////////////////////////////////////////////////////////////////
// CMFCToolBarDropSource command target
class CMFCToolBarDropSource : public COleDropSource
{
public:
CMFCToolBarDropSource();
virtual ~CMFCToolBarDropSource();
// Attributes
public:
BOOL m_bDeleteOnDrop;
BOOL m_bEscapePressed;
BOOL m_bDragStarted;
HCURSOR m_hcurDelete;
HCURSOR m_hcurMove;
HCURSOR m_hcurCopy;
// Overrides
public:
virtual SCODE GiveFeedback(DROPEFFECT dropEffect);
virtual SCODE QueryContinueDrag(BOOL bEscapePressed, DWORD dwKeyState);
virtual BOOL OnBeginDrag(CWnd* pWnd);
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, on)
#endif
#ifdef _AFX_PACKING
#pragma pack(pop)
#endif
|
// Director.h
//
// Director object
// MenuItem
//
// a menu item
struct MenuItem
{
TCHAR Text[MAX_PATH]; // text for menu
TCHAR Verb[MAX_PATH]; // verb for command - open, explore, menu, uninstall, back
TCHAR Document[MAX_PATH]; // document/executable for command
TCHAR Directory[MAX_PATH]; // directory for command
ULONG Spacing; // number of extra lines after menu item
MenuItem* Next; // next item in menu
RECT Area; // area of menu item in window
};
// Menu
//
// a menu
struct Menu
{
TCHAR Name[MAX_PATH]; // name of menu
TCHAR Bitmap[MAX_PATH]; // name of bitmap for menu
TCHAR FontName[MAX_PATH]; // font name for menu text
ULONG FontSize; // font size (pixels)
ULONG FontWeight; // font weight
COLORREF ColourNormal; // normal colour (0x00BBGGRR)
COLORREF ColourSelected; // selected colour (0x00BBGGRR)
ULONG LeftBorder; // x of left border (pixels)
ULONG TopBorder; // y of top border (pixels)
ULONG LineSpacing; // spacing between lines (pixels)
MenuItem* Item; // first item in menu
Menu* Next; // next menu in list
Menu(); // set defaults
Menu(FILE* fd); // load from file
~Menu(); // delete
};
// Director
//
// top-level control
struct Director
{
// data loaded from file
TCHAR WindowTitle[MAX_PATH]; // title for main window
TCHAR AppName[MAX_PATH]; // app name in registry
TCHAR ExeName[MAX_PATH]; // executable name in registry
TCHAR UninstallString[MAX_PATH]; // uninstall string
TCHAR AppPath[MAX_PATH]; // application path
Menu* MenuList; // list of menus
Menu* PreInstall; // preinstall menu
Menu* PostInstall; // postinstall menu
Menu* Active; // active menu
Director(); // create default menus
Director(FILE* fd); // load from file
~Director(); // delete
void LoadRegistryStrings(); // load UninstallString[] and RunString[] from the registry
Menu* FindMenu(TCHAR* name); // find a named menu
};
|
/* Test divi4 for SPU
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Sony Computer Entertainment Inc nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "simdmath.h"
#include "common-test.h"
#include "testutils.h"
int main()
{
TEST_SET_START("20040928161739EJL","EJL", "divi4");
int x0n = 0xffccb78d;
int x0d = 0x0 ;
int x0q = 0x0 ;
int x0r = 0xffccb78d;
int x1n = 0xff978333;
int x1d = 0xff976bb6;
int x1q = 0x0 ;
int x1r = 0xff978333;
int x2n = 0x5e146 ;
int x2d = 0xd14ebe0e;
int x2q = 0x0 ;
int x2r = 0x5e146 ;
int x3n = 0xf0e91618;
int x3d = 0xfddff7ac;
int x3q = 0x7 ;
int x3r = 0xffc95064;
int x4n = 0xf2128d9d;
int x4d = 0xe0f76 ;
int x4q = 0xffffff03;
int x4r = 0xfff7d53b;
int x5n = 0xda1ba2ce;
int x5d = 0x4c9 ;
int x5q = 0xfff814d3;
int x5r = 0xfffffd23;
int x6n = 0xdd4426a6;
int x6d = 0xf8d245cf;
int x6q = 0x4 ;
int x6r = 0xf9fb0f6a;
int x7n = 0xd1d5ae9 ;
int x7d = 0x333ab105;
int x7q = 0x0 ;
int x7r = 0xd1d5ae9 ;
int x8n = 0x3e0c6 ;
int x8d = 0xfff24255;
int x8q = 0x0 ;
int x8r = 0x3e0c6 ;
int x9n = 0xfd6fe27e;
int x9d = 0xf32454 ;
int x9q = 0xfffffffe;
int x9r = 0xff562b26;
int x10n =0xfb150f79;
int x10d =0xf521 ;
int x10q =0xfffffade;
int x10r =0xffff42db;
int x11n =0xfe88071f;
int x11d =0xfff937c2;
int x11q =0x37 ;
int x11r =0xfffd0c71;
vec_int4 x0n_v = (vec_int4){ x0n, x1n, x2n, x3n };
vec_int4 x1n_v = (vec_int4){ x4n, x5n, x6n, x7n };
vec_int4 x2n_v = (vec_int4){ x8n, x9n, x10n, x11n };
vec_int4 x0d_v = (vec_int4){ x0d, x1d, x2d, x3d };
vec_int4 x1d_v = (vec_int4){ x4d, x5d, x6d, x7d };
vec_int4 x2d_v = (vec_int4){ x8d, x9d, x10d, x11d };
vec_int4 x0q_v = (vec_int4){ x0q, x1q, x2q, x3q };
vec_int4 x1q_v = (vec_int4){ x4q, x5q, x6q, x7q };
vec_int4 x2q_v = (vec_int4){ x8q, x9q, x10q, x11q };
vec_int4 x0r_v = (vec_int4){ x0r, x1r, x2r, x3r };
vec_int4 x1r_v = (vec_int4){ x4r, x5r, x6r, x7r };
vec_int4 x2r_v = (vec_int4){ x8r, x9r, x10r, x11r };
divi4_t res;
TEST_START("divi4");
res = divi4(x0n_v, x0d_v);
TEST_CHECK("20040928161846EJL", allequal_int4( res.quot, x0q_v ) && allequal_int4( res.rem, x0r_v ), 0);
res = divi4(x1n_v, x1d_v);
TEST_CHECK("20040928161851EJL", allequal_int4( res.quot, x1q_v ) && allequal_int4( res.rem, x1r_v ), 0);
res = divi4(x2n_v, x2d_v);
TEST_CHECK("20040928161855EJL", allequal_int4( res.quot, x2q_v ) && allequal_int4( res.rem, x2r_v ), 0);
TEST_SET_DONE();
TEST_EXIT();
}
|
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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 (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GTK_ALIGNMENT_H__
#define __GTK_ALIGNMENT_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkbin.h>
G_BEGIN_DECLS
#define GTK_TYPE_ALIGNMENT (gtk_alignment_get_type ())
#define GTK_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ALIGNMENT, GtkAlignment))
#define GTK_ALIGNMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ALIGNMENT, GtkAlignmentClass))
#define GTK_IS_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ALIGNMENT))
#define GTK_IS_ALIGNMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ALIGNMENT))
#define GTK_ALIGNMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ALIGNMENT, GtkAlignmentClass))
typedef struct _GtkAlignment GtkAlignment;
typedef struct _GtkAlignmentPrivate GtkAlignmentPrivate;
typedef struct _GtkAlignmentClass GtkAlignmentClass;
struct _GtkAlignment
{
GtkBin bin;
/*< private >*/
GtkAlignmentPrivate *priv;
};
/**
* GtkAlignmentClass:
* @parent_class: The parent class.
*/
struct _GtkAlignmentClass
{
GtkBinClass parent_class;
/*< private >*/
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GDK_AVAILABLE_IN_ALL
GType gtk_alignment_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_alignment_new (gfloat xalign,
gfloat yalign,
gfloat xscale,
gfloat yscale);
GDK_AVAILABLE_IN_ALL
void gtk_alignment_set (GtkAlignment *alignment,
gfloat xalign,
gfloat yalign,
gfloat xscale,
gfloat yscale);
GDK_AVAILABLE_IN_ALL
void gtk_alignment_set_padding (GtkAlignment *alignment,
guint padding_top,
guint padding_bottom,
guint padding_left,
guint padding_right);
GDK_AVAILABLE_IN_ALL
void gtk_alignment_get_padding (GtkAlignment *alignment,
guint *padding_top,
guint *padding_bottom,
guint *padding_left,
guint *padding_right);
G_END_DECLS
#endif /* __GTK_ALIGNMENT_H__ */
|
/* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern void signal(int sig , void *func ) ;
extern float strtof(char const *str , char const *endptr ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned short input[1] , unsigned short output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
void megaInit(void)
{
{
}
}
void RandomFunc(unsigned short input[1] , unsigned short output[1] )
{
unsigned short state[1] ;
unsigned short local1 ;
char copy11 ;
char copy12 ;
char copy14 ;
{
state[0UL] = (input[0UL] + 914778474UL) - (unsigned short)29623;
local1 = 0UL;
while (local1 < 1UL) {
if (state[0UL] < local1) {
if (state[0UL] != local1) {
copy11 = *((char *)(& state[local1]) + 0);
*((char *)(& state[local1]) + 0) = *((char *)(& state[local1]) + 1);
*((char *)(& state[local1]) + 1) = copy11;
copy11 = *((char *)(& state[local1]) + 1);
*((char *)(& state[local1]) + 1) = *((char *)(& state[local1]) + 0);
*((char *)(& state[local1]) + 0) = copy11;
copy12 = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy12;
copy12 = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = copy12;
} else {
state[local1] += state[local1];
}
} else {
copy14 = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy14;
state[local1] += state[local1];
}
local1 ++;
}
output[0UL] = (state[0UL] + 681723154UL) - (unsigned short)10364;
}
}
int main(int argc , char *argv[] )
{
unsigned short input[1] ;
unsigned short output[1] ;
int randomFuns_i5 ;
unsigned short randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned short )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == (unsigned short)31026) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
|
// CDVHeyzapAds.h
//
// Copyright 2015 Heyzap, Inc. 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, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#import "CDVBasePlugin.h"
@interface CDVHeyzapAds : CDVBasePlugin
- (void)start:(CDVInvokedUrlCommand *)command;
- (void)mediationTestSuite:(CDVInvokedUrlCommand *)command;
- (void)remoteData:(CDVInvokedUrlCommand *)command;
- (void)onIAPComplete:(CDVInvokedUrlCommand *)command;
@end
|
// Copyright (c) 2011-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef RPCCONSOLE_H
#define RPCCONSOLE_H
#include "guiutil.h"
#include "net.h"
#include "peertablemodel.h"
#include <QWidget>
class ClientModel;
namespace Ui {
class RPCConsole;
}
QT_BEGIN_NAMESPACE
class QMenu;
class QItemSelection;
QT_END_NAMESPACE
/** Local Bitcoin RPC console. */
class RPCConsole: public QWidget
{
Q_OBJECT
public:
explicit RPCConsole(QWidget *parent);
~RPCConsole();
void setClientModel(ClientModel *model);
enum MessageClass {
MC_ERROR,
MC_DEBUG,
CMD_REQUEST,
CMD_REPLY,
CMD_ERROR
};
protected:
virtual bool eventFilter(QObject* obj, QEvent *event);
void keyPressEvent(QKeyEvent *);
private slots:
void on_lineEdit_returnPressed();
void on_tabWidget_currentChanged(int index);
/** open the debug.log from the current datadir */
void on_openDebugLogfileButton_clicked();
/** change the time range of the network traffic graph */
void on_sldGraphRange_valueChanged(int value);
/** update traffic statistics */
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
/** Show custom context menu on Peers tab */
void showPeersTableContextMenu(const QPoint& point);
/** Show custom context menu on Bans tab */
void showBanTableContextMenu(const QPoint& point);
/** Hides ban table if no bans are present */
void showOrHideBanTableIfRequired();
/** clear the selected node */
void clearSelectedNode();
/** clear traffic graph */
void on_btnClearTrafficGraph_clicked();
public slots:
void clear();
void message(int category, const QString &message, bool html = false);
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks shown in the UI */
void setNumBlocks(int count);
/** Set number of masternodes shown in the UI */
void setMasternodeCount(const QString &strMasternodes);
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */
void scrollToEnd();
/** Handle selection of peer in peers list */
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
/** Handle updated peer information */
void peerLayoutChanged();
/** Disconnect a selected node on the Peers tab */
void disconnectSelectedNode();
/** Ban a selected node on the Peers tab */
void banSelectedNode(int bantime);
/** Unban a selected node on the Bans tab */
void unbanSelectedNode();
/** Show folder with wallet backups in default browser */
void showBackups();
signals:
// For RPC command executor
void stopExecutor();
void cmdRequest(const QString &command);
private:
static QString FormatBytes(quint64 bytes);
void startExecutor();
void setTrafficGraphRange(int mins);
/** show detailed information on ui about selected node */
void updateNodeDetail(const CNodeCombinedStats *stats);
enum ColumnWidths
{
ADDRESS_COLUMN_WIDTH = 200,
SUBVERSION_COLUMN_WIDTH = 100,
PING_COLUMN_WIDTH = 80,
BANSUBNET_COLUMN_WIDTH = 200,
BANTIME_COLUMN_WIDTH = 250
};
Ui::RPCConsole *ui;
ClientModel *clientModel;
QStringList history;
int historyPtr;
NodeId cachedNodeid;
QMenu *peersTableContextMenu;
QMenu *banTableContextMenu;
};
#endif // RPCCONSOLE_H
|
/*
* TrackingAllocator.h
*
* Created on: May 18, 2013
* Author: tsharpe
*/
#ifndef TRACKINGALLOCATOR_H_
#define TRACKINGALLOCATOR_H_
#include <scoped_allocator>
#include <memory>
class MemUse
{
public:
MemUse( char const* type ) : mType(type) {}
~MemUse()
{ if ( mTotalAllocated > gMinReportSize ) report(); }
size_t getNAllocs() const { return mNAllocs; }
size_t getTotalAllocated() const { return mTotalAllocated; }
size_t getCurrentInUse() const { return mInUse; }
size_t getMaxUsed() const { return mMaxUsed; }
void alloc( size_t nBytes )
{ mNAllocs += 1; mTotalAllocated += nBytes;
if ( (mInUse += nBytes) > mMaxUsed ) mMaxUsed = mInUse; }
void free( size_t nBytes )
{ mInUse -= nBytes; }
void report();
static void setMinReportSize( size_t minReportSize )
{ gMinReportSize = minReportSize; }
private:
char const* mType;
size_t mNAllocs = 0;
size_t mTotalAllocated = 0;
size_t mInUse = 0;
size_t mMaxUsed = 0;
static size_t gMinReportSize;
};
template <class T>
class TrackingAllocator
: public std::scoped_allocator_adaptor<std::allocator<T>>
{
typedef std::scoped_allocator_adaptor<std::allocator<T>> BaseT;
public:
typedef unsigned long size_type;
typedef long difference_type;
typedef T* pointer;
typedef T const* const_pointer;
typedef T& reference;
typedef T const& const_reference;
typedef T value_type;
TrackingAllocator() : mMemUse(new MemUse("TrackingAllocator")) {}
template <class U>
TrackingAllocator( TrackingAllocator<U> const& that )
: mMemUse(that.mMemUse) {}
TrackingAllocator( TrackingAllocator const& )=default;
TrackingAllocator( TrackingAllocator&& a )
: mMemUse(a.mMemUse) {} // it's actually a copy
TrackingAllocator& operator=( TrackingAllocator const& )=default;
TrackingAllocator& operator=( TrackingAllocator&& a )
{ mMemUse = a.mMemUse; return *this; } // it's actually a copy
template <class U>
struct rebind { typedef TrackingAllocator<U> other; };
pointer allocate( size_type n, void* hint = 0 )
{ mMemUse->alloc(n*sizeof(T)); return BaseT::allocate(n,hint); }
void deallocate( pointer p, size_type n )
{ mMemUse->free(n*sizeof(T)); BaseT::deallocate(p,n); }
bool operator==( TrackingAllocator const& that )
{ return mMemUse == that.mMemUse; }
bool operator!=( TrackingAllocator const& that )
{ return !(*this == that); }
private:
std::shared_ptr<MemUse> mMemUse;
template <class U> friend class TrackingAllocator;
};
template <class T>
struct DefaultAllocator
{
#ifndef TRACK_MEMUSE
typedef std::allocator<T> type;
#else
typedef TrackingAllocator<T> type;
#endif
};
#endif /* TRACKINGALLOCATOR_H_ */
|
//
// WQCommonCustomItem.h
// SomeUIKit
//
// Created by WangQiang on 2017/4/1.
// Copyright © 2017年 WangQiang. All rights reserved.
//
#import "WQCommonBaseItem.h"
//#import "WQCommonCellProtocol.h"
@interface WQCommonCustomItem : WQCommonBaseItem
+(NSString *)customIdentifire;
/**须遵守 WQCommonCellProtocol*/
@property (assign ,nonatomic) Class cellClass;
@end
|
//
// The MIT License (MIT)
//
// Copyright (c) 2014 BZObjectStore
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "BZObjectStoreModelInterface.h"
#import <AutoCoding.h>
@class BZReferenceConditionModel;
@interface BZReferenceFromConditionModel : NSObject<OSModelInterface>
@property (nonatomic,strong) NSNumber<OSIdenticalAttribute> *code;
@property (nonatomic,strong) NSString *name;
@property (nonatomic,assign) NSInteger price;
@property (nonatomic,strong) BZReferenceConditionModel *to;
@end
|
/************************************************************************************
* *
* Copyright (c) 2013 Axel Menzel <info@axelmenzel.de> *
* *
* This file is part of the Runtime Type Reflection System (RTTR). *
* *
* Permission is hereby granted, free of charge, to any person obtaining *
* a copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
* SOFTWARE. *
* *
*************************************************************************************/
#ifndef __RTTR_STATICASSERT_H__
#define __RTTR_STATICASSERT_H__
namespace RTTR
{
namespace impl
{
template<bool> struct CompileTimeError;
template<> struct CompileTimeError<true> {}; // only true is defined
} // end namespace impl
} // end namespace RTTR
#define RTTR_STATIC_ASSERT(x, msg) { RTTR::impl::CompileTimeError<(x)> ERROR_##msg; (void)ERROR_##msg; }
#endif // __RTTR_STATICASSERT_H__
|
//
// YIConfigUtil+Cache.h
// Emma
//
// Created by efeng on 15/7/23.
// Copyright (c) 2015年 weiboyi. All rights reserved.
//
#import "YIConfigUtil.h"
@interface YIConfigUtil (Cache)
@end
|
//
// JLTwitterPermissions.h
//
// Created by Joseph Laws on 11/3/14.
// Copyright (c) 2014 Joe Laws. All rights reserved.
//
#import "JLPermissionsCore.h"
@interface JLTwitterPermission : JLPermissionsCore
+ (instancetype)sharedInstance;
/**
* Uses the default dialog which is identical to the system permission dialog
*
* @param completion the block that will be executed on the main thread
*when access is granted or denied. May be called immediately if access was
*previously established
*/
- (void)authorize:(AuthorizationHandler)completion;
/**
* This is identical to the call other call, however it allows you to specify
*your own custom text for the dialog window rather than using the standard
*system dialog
*
* @param messageTitle custom alert message title
* @param message custom alert message
* @param cancelTitle custom cancel button message
* @param grantTitle custom grant button message
* @param completion the block that will be executed on the main thread
*when access is granted or denied. May be called immediately if access was
*previously established
*/
- (void)authorizeWithTitle:(NSString *)messageTitle
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
grantTitle:(NSString *)grantTitle
completion:(AuthorizationHandler)completion;
@end
|
#include "GenericTaskDeclarations.h"
#include "GenericSharedDeclarations.h"
#include "GenericSyncDeclarations.h"
#include <stdlib.h>
#include <string.h>
GenericTaskDeclarations_VoidFuture_t GenericTaskDeclarations_runTaskAndGetVoidFuture(GenericTaskDeclarations_Task_t task)
{
pthread_t pth;
if ( task.argsSize == 0 )
{
pthread_create(&pth,0,task.fun,0);
} else
{
void* args = malloc(task.argsSize);
memcpy(args,task.args,task.argsSize);
pthread_create(&pth,0,task.fun,args);
}
return (GenericTaskDeclarations_VoidFuture_t){ .pth = pth };
}
void GenericTaskDeclarations_saveAndJoinVoidFuture(GenericTaskDeclarations_VoidFuture_t future)
{
GenericTaskDeclarations_joinVoidFuture(&future);
}
void* GenericTaskDeclarations_saveFutureAndGetResult(GenericTaskDeclarations_Future_t future)
{
GenericTaskDeclarations_getFutureResult(&future);
}
GenericTaskDeclarations_Future_t GenericTaskDeclarations_runTaskAndGetFuture(GenericTaskDeclarations_Task_t task)
{
pthread_t pth;
if ( task.argsSize == 0 )
{
pthread_create(&pth,0,task.fun,0);
} else
{
void* args = malloc(task.argsSize);
memcpy(args,task.args,task.argsSize);
pthread_create(&pth,0,task.fun,args);
}
return (GenericTaskDeclarations_Future_t){ .pth = pth };
}
void* GenericTaskDeclarations_getFutureResult(GenericTaskDeclarations_Future_t* future)
{
if ( !(future->finished) )
{
pthread_join(future->pth,&(future->result));
future->finished = true;
}
return future->result;
}
void GenericTaskDeclarations_joinVoidFuture(GenericTaskDeclarations_VoidFuture_t* future)
{
if ( !(future->finished) )
{
pthread_join(future->pth,0);
future->finished = true;
}
}
|
/*------------------------------------------------------------------
* test_strremovews_s
*
*
*------------------------------------------------------------------
*/
#include "test_private.h"
#include "safe_str_lib.h"
#define LEN ( 128 )
int main()
{
errno_t rc;
int ind;
uint32_t len;
char str[LEN];
/*--------------------------------------------------*/
len = 5;
rc = strremovews_s(NULL, len);
if (rc != ESNULLP) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
/*--------------------------------------------------*/
len = 0;
rc = strremovews_s("test", len);
if (rc != ESZEROL) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
/*--------------------------------------------------*/
len = 99999;
rc = strremovews_s("test", len);
if (rc != ESLEMAX) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, "ABCDEFGHIJK");
len = 1;
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
if (str[0] != '\0') {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, "ABCDEFGHIJK");
len = 2;
rc = strremovews_s(str, len);
if (rc != ESUNTERM) {
printf("%s %u Error rc=%u --%s--\n",
__FUNCTION__, __LINE__, rc, str );
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, " ABCDEFGHIJK");
len = 3;
rc = strremovews_s(str, len);
if (rc != ESUNTERM) {
printf("%s %u Error rc=%u --%s--\n",
__FUNCTION__, __LINE__, rc, str );
}
if (str[0] != '\0') {
printf("%s %u Error rc=%u --%s--\n",
__FUNCTION__, __LINE__, rc, str );
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, " ABCDEFGHIJK");
len = 9;
rc = strremovews_s(str, len);
if (rc != ESUNTERM) {
printf("%s %u Error rc=%u --%s--\n",
__FUNCTION__, __LINE__, rc, str );
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, "A");
len = 1;
/* a one char string will be emptied - str[0]=='\0' */
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
if (str[0] != '\0') {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, "ABC");
len = 8;
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
if (str[0] != 'A') {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy(str, " B");
len = strlen(str);
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
if (str[0] != 'B') {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy(str, " C ");
len = strlen(str);
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
ind = strcmp(str, "C");
if (ind != 0) {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy(str, " NowISTHETimE 1 2 ");
len = strlen(str);
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
ind = strcmp(str, "NowISTHETimE 1 2");
if (ind != 0) {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, " q q21ego");
len = strlen(str);
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
ind = strcmp(str, "q q21ego");
if (ind != 0) {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
strzero_s(str, LEN);
strcpy (str, " 1 2 3 4 ");
len = strlen(str);
rc = strremovews_s(str, len);
if (rc != EOK) {
printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc );
}
ind = strcmp(str, "1 2 3 4");
if (ind != 0) {
printf("%s %u Error -%s- \n",
__FUNCTION__, __LINE__, str);
}
/*--------------------------------------------------*/
return (0);
}
|
/**************************************************************************//**
* @file ezr32wg_burtc_ret.h
* @brief EZR32WG_BURTC_RET register and bit field definitions
* @version 5.4.0
******************************************************************************
* # License
* <b>Copyright 2017 Silicon Laboratories, Inc. www.silabs.com</b>
******************************************************************************
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software.@n
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.@n
* 3. This notice may not be removed or altered from any source distribution.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc.
* has no obligation to support this Software. Silicon Laboratories, Inc. is
* providing the Software "AS IS", with no express or implied warranties of any
* kind, including, but not limited to, any implied warranties of
* merchantability or fitness for any particular purpose or warranties against
* infringement of any proprietary rights of a third party.
*
* Silicon Laboratories, Inc. will not be liable for any consequential,
* incidental, or special damages, or any other relief, or for any claim by
* any third party, arising from your use of this Software.
*
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__ICCARM__)
#pragma system_include /* Treat file as system include file. */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* Treat file as system include file. */
#endif
/**************************************************************************//**
* @addtogroup Parts
* @{
******************************************************************************/
/**************************************************************************//**
* @brief BURTC_RET EZR32WG BURTC RET
*****************************************************************************/
typedef struct {
__IOM uint32_t REG; /**< Retention Register */
} BURTC_RET_TypeDef;
/** @} End of group Parts */
#ifdef __cplusplus
}
#endif
|
/*
* File: clht_lb.h
* Author: Vasileios Trigonakis <vasileios.trigonakis@epfl.ch>
* Description: lock-based cache-line hash table with no resizing
* clht_lb.h is part of ASCYLIB
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Vasileios Trigonakis <vasileios.trigonakis@epfl.ch>
* Distributed Programming Lab (LPD), EPFL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef _CLHT_LB_H_
#define _CLHT_LB_H_
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include "atomic_ops.h"
#include "utils.h"
#include "ssmem.h"
#define true 1
#define false 0
#define READ_ONLY_FAIL
#if defined(DEBUG)
# define DPP(x) x++
#else
# define DPP(x)
#endif
#define CACHE_LINE_SIZE 64
#define ENTRIES_PER_BUCKET 3
#ifndef ALIGNED
# if __GNUC__ && !SCC
# define ALIGNED(N) __attribute__ ((aligned (N)))
# else
# define ALIGNED(N)
# endif
#endif
#if defined(__sparc__)
# define PREFETCHW(x)
# define PREFETCH(x)
# define PREFETCHNTA(x)
# define PREFETCHT0(x)
# define PREFETCHT1(x)
# define PREFETCHT2(x)
# define PAUSE asm volatile("rd %%ccr, %%g0\n\t" \
::: "memory")
# define _mm_pause() PAUSE
# define _mm_mfence() __asm__ __volatile__("membar #LoadLoad | #LoadStore | #StoreLoad | #StoreStore");
# define _mm_lfence() __asm__ __volatile__("membar #LoadLoad | #LoadStore");
# define _mm_sfence() __asm__ __volatile__("membar #StoreLoad | #StoreStore");
#elif defined(__tile__)
# define _mm_lfence() arch_atomic_read_barrier()
# define _mm_sfence() arch_atomic_write_barrier()
# define _mm_mfence() arch_atomic_full_barrier()
# define _mm_pause() cycle_relax()
#endif
#define CAS_U64_BOOL(a, b, c) (CAS_U64(a, b, c) == b)
inline int is_power_of_two(unsigned int x);
typedef uintptr_t clht_addr_t;
typedef volatile uintptr_t clht_val_t;
typedef uint64_t clht_lock_t;
typedef struct ALIGNED(CACHE_LINE_SIZE) bucket_s
{
clht_lock_t lock;
clht_addr_t key[ENTRIES_PER_BUCKET];
clht_val_t val[ENTRIES_PER_BUCKET];
struct bucket_s* next;
} bucket_t;
typedef struct ALIGNED(CACHE_LINE_SIZE) clht
{
union
{
struct
{
struct clht_hashtable_s* ht;
uint8_t next_cache_line[CACHE_LINE_SIZE - (sizeof(void*))];
};
uint8_t padding[2 * CACHE_LINE_SIZE];
};
} clht_t;
typedef struct ALIGNED(CACHE_LINE_SIZE) clht_hashtable_s
{
union
{
struct
{
size_t num_buckets;
bucket_t* table;
};
uint8_t padding[1 * CACHE_LINE_SIZE];
};
} clht_hashtable_t;
static inline void
_mm_pause_rep(uint64_t w)
{
while (w--)
{
_mm_pause();
}
}
#define TAS_WITH_FAI
/* #define TAS_WITH_TAS */
/* #define TAS_WITH_CAS */
/* #define TAS_WITH_SWAP */
#if defined(XEON)
# define TAS_RLS_MFENCE() _mm_mfence();
#else
# define TAS_RLS_MFENCE()
#endif
#if defined(TAS_WITH_FAI)
# define LOCK_ACQ(lock) \
while (FAI_U64(lock)) \
{ \
_mm_pause(); \
DPP(put_num_restarts); \
}
#elif defined(TAS_WITH_TAS)
# define LOCK_ACQ(lock) \
while (TAS_U8((uint8_t*) (lock))) \
{ \
_mm_pause(); \
DPP(put_num_restarts); \
}
#elif defined(TAS_WITH_SWAP)
# define LOCK_ACQ(lock) \
while (SWAP_U64(lock, 1)) \
{ \
_mm_pause(); \
DPP(put_num_restarts); \
}
#endif
#define LOCK_RLS(lock) \
TAS_RLS_MFENCE(); \
*lock = 0;
/* Create a new hashtable. */
clht_hashtable_t* clht_hashtable_create(uint64_t num_buckets );
clht_t* clht_create(uint64_t num_buckets);
/* Hash a key for a particular hashtable. */
uint64_t clht_hash(clht_hashtable_t* hashtable, clht_addr_t key );
/* Insert a key-value pair into a hashtable. */
int clht_put(clht_t* h, clht_addr_t key, clht_val_t val);
/* Retrieve a key-value pair from a hashtable. */
clht_val_t clht_get(clht_hashtable_t* hashtable, clht_addr_t key);
/* Remove a key-value pair from a hashtable. */
clht_val_t clht_remove(clht_t* hashtable, clht_addr_t key);
/* Dealloc the hashtable */
void clht_destroy(clht_hashtable_t* hashtable);
size_t clht_size(clht_hashtable_t* hashtable);
void clht_print(clht_hashtable_t* hashtable);
bucket_t* clht_bucket_create();
const char* clht_type_desc();
#endif /* _CLHT_LB_H_ */
|
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(unicode_maketrans__doc__,
"maketrans(x, y=None, z=None, /)\n"
"--\n"
"\n"
"Return a translation table usable for str.translate().\n"
"\n"
"If there is only one argument, it must be a dictionary mapping Unicode\n"
"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
"Character keys will be then converted to ordinals.\n"
"If there are two arguments, they must be strings of equal length, and\n"
"in the resulting dictionary, each character in x will be mapped to the\n"
"character at the same position in y. If there is a third argument, it\n"
"must be a string, whose characters will be mapped to None in the result.");
#define UNICODE_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)unicode_maketrans, METH_VARARGS|METH_STATIC, unicode_maketrans__doc__},
static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
static PyObject *
unicode_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y = NULL;
PyObject *z = NULL;
if (!PyArg_ParseTuple(args, "O|UU:maketrans",
&x, &y, &z)) {
goto exit;
}
return_value = unicode_maketrans_impl(x, y, z);
exit:
return return_value;
}
/*[clinic end generated code: output=4a86dd108d92d104 input=a9049054013a1b77]*/
|
// Demonstrate partitioning rresamp work in separate blocks
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
#include <math.h>
#include "liquid.h"
#define OUTPUT_FILENAME "rresamp_crcf_partition_example.m"
int main(int argc, char*argv[])
{
// options
unsigned int P = 4; // output rate (interpolation factor)
unsigned int Q = 5; // input rate (decimation factor)
unsigned int m = 8; // resampling filter semi-length (filter delay)
float bw = 0.5f; // resampling filter bandwidth
float As = 60.0f; // resampling filter stop-band attenuation [dB]
unsigned int n = 10; // block size
// create two identical resampler objects
rresamp_crcf q0 = rresamp_crcf_create_kaiser(P,Q,m,bw,As);
rresamp_crcf q1 = rresamp_crcf_create_kaiser(P,Q,m,bw,As);
// full input, output buffers
float complex buf_in [2*Q*n]; // input buffer
float complex buf_out_0[2*P*n]; // output, normal resampling operation
float complex buf_out_1[2*P*n]; // output, partitioned into 2 blocks
// generate input signal (pulse)
unsigned int i;
for (i=0; i<2*Q*n; i++)
buf_in[i] = liquid_hamming(i,2*Q*n) * cexpf(_Complex_I*2*M_PI*0.037f*i);
// run resampler normally in one large block (2*Q*n inputs, 2*P*n outputs)
rresamp_crcf_execute_block(q0, buf_in, 2*n, buf_out_0);
// reset and run with separate resamplers (e.g. in two threads)
rresamp_crcf_reset(q0);
// first block runs as normal
rresamp_crcf_execute_block(q0, buf_in, n, buf_out_1);
// initialize second block with Q*m samples to account for delay
for (i=0; i<m; i++)
rresamp_crcf_write(q1, buf_in + Q*n - (m-i)*Q);
// run remainder of second block as normal
rresamp_crcf_execute_block(q1, buf_in + Q*n, n, buf_out_1 + P*n);
// clean up allocated objects
rresamp_crcf_destroy(q0);
rresamp_crcf_destroy(q1);
// compute RMS error between output buffers
float rmse = 0.0f;
for (i=0; i<2*P*n; i++) {
float complex err = buf_out_0[i] - buf_out_1[i];
rmse += crealf( err * conjf(err) );
}
rmse = sqrtf( rmse / (float)(2*P*n) );
printf("rmse=%.3g\n", rmse);
// export results to file for plotting
FILE * fid = fopen(OUTPUT_FILENAME,"w");
fprintf(fid,"%% %s: auto-generated file\n",OUTPUT_FILENAME);
fprintf(fid,"clear all; close all;\n");
fprintf(fid,"P = %u; Q = %u; m = %u; n= %u;\n", P, Q, m, n);
fprintf(fid,"x = zeros(1,2*Q*n);\n");
fprintf(fid,"y = zeros(1,2*P*n);\n");
fprintf(fid,"z = zeros(1,2*P*n);\n");
fprintf(fid,"r = P/Q;\n");
for (i=0; i<2*Q*n; i++)
fprintf(fid,"x(%3u) = %12.8f + 1i*%12.8f;\n", i+1, crealf(buf_in[i]), cimagf(buf_in[i]));
for (i=0; i<2*P*n; i++)
fprintf(fid,"y(%3u) = %12.8f + 1i*%12.8f;\n", i+1, crealf(buf_out_0[i]), cimagf(buf_out_0[i]));
for (i=0; i<2*P*n; i++)
fprintf(fid,"z(%3u) = %12.8f + 1i*%12.8f;\n", i+1, crealf(buf_out_1[i]), cimagf(buf_out_1[i]));
fprintf(fid,"\n\n");
fprintf(fid,"%% plot time-domain result\n");
fprintf(fid,"tx=0:(2*Q*n-1);\n");
fprintf(fid,"ty=[(0:(2*P*n-1))]/r-m;\n");
fprintf(fid,"figure('Color','white','position',[500 500 800 600]);\n");
fprintf(fid,"subplot(2,1,1);\n");
fprintf(fid," plot(tx,real(x), '-','LineWidth',2,'Color',[0.5 0.5 0.5],...\n");
fprintf(fid," ty,real(y)*sqrt(r),'o','LineWidth',2,'Color',[0.5 0.5 0.5],'MarkerSize',3,...\n");
fprintf(fid," ty,real(z)*sqrt(r),'o','LineWidth',2,'Color',[0.0 0.2 0.5],'MarkerSize',1);\n");
fprintf(fid," legend('original','resampled (normal)','resampled (partitions)','location','northeast');");
fprintf(fid," xlabel('Input Sample Index');\n");
fprintf(fid," ylabel('Real Signal');\n");
fprintf(fid," grid on;\n");
fprintf(fid," title('Comparison of Normal and Partitioned rresamp, RMSE=%.3g');\n", rmse);
fprintf(fid,"subplot(2,1,2);\n");
fprintf(fid," plot(tx,imag(x), '-','LineWidth',2,'Color',[0.5 0.5 0.5],...\n");
fprintf(fid," ty,imag(y)*sqrt(r),'o','LineWidth',2,'Color',[0.5 0.5 0.5],'MarkerSize',3,...\n");
fprintf(fid," ty,imag(z)*sqrt(r),'o','LineWidth',2,'Color',[0.0 0.5 0.2],'MarkerSize',1);\n");
fprintf(fid," legend('original','resampled (normal)','resampled (partitions)','location','northeast');");
fprintf(fid," xlabel('Input Sample Index');\n");
fprintf(fid," ylabel('Real Signal');\n");
fprintf(fid," grid on;\n");
fclose(fid);
printf("results written to %s\n",OUTPUT_FILENAME);
return 0;
}
|
/*
* swiftree.h
*
* Copyright (c) 2014, Alessandro Pezzato
*/
#ifndef swiftree_SWIFTREE_FWD_H_
#define swiftree_SWIFTREE_FWD_H_
namespace swiftree {
class Tree;
class TreeImpl;
} /* namespace swiftree */
#endif /* swiftree_SWIFTREE_FWD_H_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.