text
stringlengths 4
6.14k
|
|---|
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018.10.30 SummerGift first version
* 2019.03.05 whj4674672 add stm32h7
*/
#ifndef __DRV_USART_H__
#define __DRV_USART_H__
#include <rtthread.h>
#include "rtdevice.h"
#include <rthw.h>
#include <drv_common.h>
#include "drv_dma.h"
int rt_hw_usart_init(void);
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) \
|| defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4)
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
#elif defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32H7)
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) */
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F2) \
|| defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32G4)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#endif
/* stm32 config class */
struct stm32_uart_config
{
const char *name;
USART_TypeDef *Instance;
IRQn_Type irq_type;
struct dma_config *dma_rx;
struct dma_config *dma_tx;
};
/* stm32 uart dirver class */
struct stm32_uart
{
UART_HandleTypeDef handle;
struct stm32_uart_config *config;
#ifdef RT_SERIAL_USING_DMA
struct
{
DMA_HandleTypeDef handle;
rt_size_t last_index;
} dma_rx;
struct
{
DMA_HandleTypeDef handle;
} dma_tx;
#endif
rt_uint16_t uart_dma_flag;
struct rt_serial_device serial;
};
#endif /* __DRV_USART_H__ */
|
/*
* Copyright (C) 2008 Peter Grasch <peter.grasch@bedahr.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SIMON_SIMONDNETWORKCONFIGURATION_H_932B7362E7CC428398A5F279795080B6
#define SIMON_SIMONDNETWORKCONFIGURATION_H_932B7362E7CC428398A5F279795080B6
#include <KCModule>
#include <QVariantList>
#include "ui_simondnetworkconfiguration.h"
class SimondNetworkConfiguration : public KCModule
{
Q_OBJECT
private:
Ui::NetworkConfiguration ui;
private slots:
void slotChanged();
public:
explicit SimondNetworkConfiguration(QWidget* parent, const QVariantList& args=QVariantList());
void save();
void load();
~SimondNetworkConfiguration();
};
#endif
|
/*
Copyright (C) 2010 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/memento_command.h"
#include "evoral/Parameter.hpp"
#include "ardour/session.h"
namespace ARDOUR {
class MidiSource;
class AutomationList;
/** A class for late-binding a MidiSource and a Parameter to an AutomationList */
class MidiAutomationListBinder : public MementoCommandBinder<ARDOUR::AutomationList>
{
public:
MidiAutomationListBinder (boost::shared_ptr<ARDOUR::MidiSource>, Evoral::Parameter);
MidiAutomationListBinder (XMLNode *, ARDOUR::Session::SourceMap const &);
ARDOUR::AutomationList* get () const;
void add_state (XMLNode *);
private:
boost::shared_ptr<ARDOUR::MidiSource> _source;
Evoral::Parameter _parameter;
};
}
|
/*
IGraph library.
Copyright (C) 2021 The igraph development team <igraph@igraph.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <igraph.h>
#include "test_utilities.inc"
int main() {
igraph_t g_empty, g_lm;
igraph_vector_t result;
igraph_vs_t vids;
igraph_rng_seed(igraph_rng_default(), 42);
igraph_vector_init(&result, 0);
igraph_vs_all(&vids);
igraph_small(&g_empty, 0, 0, -1);
igraph_small(&g_lm, 6, 1, 0,1, 0,2, 1,1, 1,3, 2,0, 2,3, 3,4, 3,4, -1);
printf("No vertices:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_empty, &result, vids, /*order*/ 1,
/*mode*/ IGRAPH_ALL, /*mindist*/ 0) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 0:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 0,
/*mode*/ IGRAPH_ALL, /*mindist*/ 0) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 1, ignoring direction:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 1,
/*mode*/ IGRAPH_ALL, /*mindist*/ 0) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 1, only checking IGRAPH_IN:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 1,
/*mode*/ IGRAPH_IN, /*mindist*/ 0) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 10, ignoring direction:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 10,
/*mode*/ IGRAPH_ALL, /*mindist*/ 0) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 2, mindist 2, IGRAPH_OUT:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 2,
/*mode*/ IGRAPH_OUT, /*mindist*/ 2) == IGRAPH_SUCCESS);
print_vector(&result);
printf("Directed graph with loops and multi-edges, order 4, mindist 4, IGRAPH_ALL:\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 4,
/*mode*/ IGRAPH_ALL, /*mindist*/ 4) == IGRAPH_SUCCESS);
print_vector(&result);
VERIFY_FINALLY_STACK();
igraph_set_error_handler(igraph_error_handler_ignore);
printf("Negative order.\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ -4,
/*mode*/ IGRAPH_ALL, /*mindist*/ 4) == IGRAPH_EINVAL);
printf("Negative mindist.\n");
IGRAPH_ASSERT(igraph_neighborhood_size(&g_lm, &result, vids, /*order*/ 4,
/*mode*/ IGRAPH_ALL, /*mindist*/ -4) == IGRAPH_EINVAL);
igraph_vector_destroy(&result);
igraph_destroy(&g_empty);
igraph_destroy(&g_lm);
VERIFY_FINALLY_STACK();
return 0;
}
|
/* Install given floating-point environment and raise exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Huggins-Daines <dhd@debian.org>, 2000
The GNU C 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.1 of the License, or (at your option) any later version.
The GNU C 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 the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <string.h>
int
feupdateenv (const fenv_t *envp)
{
union { unsigned long long l; unsigned int sw[2]; } s;
fenv_t temp;
/* Get the current exception status */
__asm__ ("fstd %%fr0,0(%1) \n\t"
"fldd 0(%1),%%fr0 \n\t"
: "=m" (s.l) : "r" (&s.l));
memcpy(&temp, envp, sizeof(fenv_t));
/* Currently raised exceptions not cleared */
temp.__status_word |= s.sw[0] & (FE_ALL_EXCEPT << 27);
/* Install new environment. */
fesetenv (&temp);
/* Success. */
return 0;
}
|
/*
* AAC decoder data
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* AAC decoder data
* @author Oded Shimon ( ods15 ods15 dyndns org )
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
*/
#ifndef AVCODEC_AACDECTAB_H
#define AVCODEC_AACDECTAB_H
#include "libavutil/audioconvert.h"
#include "aac.h"
#include <stdint.h>
/* @name ltp_coef
* Table of the LTP coefficients
*/
static const float ltp_coef[8] = {
0.570829, 0.696616, 0.813004, 0.911304,
0.984900, 1.067894, 1.194601, 1.369533,
};
/* @name tns_tmp2_map
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
* The suffix _M_N[] indicate the values of coef_compress and coef_res
* respectively.
* @{
*/
static const float tns_tmp2_map_1_3[4] = {
0.00000000, -0.43388373, 0.64278758, 0.34202015,
};
static const float tns_tmp2_map_0_3[8] = {
0.00000000, -0.43388373, -0.78183150, -0.97492790,
0.98480773, 0.86602539, 0.64278758, 0.34202015,
};
static const float tns_tmp2_map_1_4[8] = {
0.00000000, -0.20791170, -0.40673664, -0.58778524,
0.67369562, 0.52643216, 0.36124167, 0.18374951,
};
static const float tns_tmp2_map_0_4[16] = {
0.00000000, -0.20791170, -0.40673664, -0.58778524,
-0.74314481, -0.86602539, -0.95105654, -0.99452192,
0.99573416, 0.96182561, 0.89516330, 0.79801720,
0.67369562, 0.52643216, 0.36124167, 0.18374951,
};
static const float * const tns_tmp2_map[4] = {
tns_tmp2_map_0_3,
tns_tmp2_map_0_4,
tns_tmp2_map_1_3,
tns_tmp2_map_1_4
};
// @}
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 };
static const uint8_t aac_channel_layout_map[7][5][2] = {
{ { TYPE_SCE, 0 }, },
{ { TYPE_CPE, 0 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
};
static const int64_t aac_channel_layout[8] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE,
0,
};
#endif /* AVCODEC_AACDECTAB_H */
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <assert.h>
#include <exception>
// System.Reflection.Emit.ModuleBuilder
struct ModuleBuilder_t973;
// System.Object
struct Object_t;
// System.Type[]
struct TypeU5BU5D_t194;
// System.Reflection.MemberInfo
struct MemberInfo_t;
// System.Reflection.Emit.TokenGenerator
struct TokenGenerator_t970;
#include "codegen/il2cpp-codegen.h"
// System.Void System.Reflection.Emit.ModuleBuilder::.cctor()
extern "C" void ModuleBuilder__cctor_m5685 (Object_t * __this /* static, unused */, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Reflection.Emit.ModuleBuilder::get_next_table_index(System.Object,System.Int32,System.Boolean)
extern "C" int32_t ModuleBuilder_get_next_table_index_m5686 (ModuleBuilder_t973 * __this, Object_t * ___obj, int32_t ___table, bool ___inc, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Type[] System.Reflection.Emit.ModuleBuilder::GetTypes()
extern "C" TypeU5BU5D_t194* ModuleBuilder_GetTypes_m5687 (ModuleBuilder_t973 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Reflection.Emit.ModuleBuilder::getToken(System.Reflection.Emit.ModuleBuilder,System.Object)
extern "C" int32_t ModuleBuilder_getToken_m5688 (Object_t * __this /* static, unused */, ModuleBuilder_t973 * ___mb, Object_t * ___obj, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Reflection.Emit.ModuleBuilder::GetToken(System.Reflection.MemberInfo)
extern "C" int32_t ModuleBuilder_GetToken_m5689 (ModuleBuilder_t973 * __this, MemberInfo_t * ___member, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.Reflection.Emit.ModuleBuilder::RegisterToken(System.Object,System.Int32)
extern "C" void ModuleBuilder_RegisterToken_m5690 (ModuleBuilder_t973 * __this, Object_t * ___obj, int32_t ___token, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Reflection.Emit.TokenGenerator System.Reflection.Emit.ModuleBuilder::GetTokenGenerator()
extern "C" Object_t * ModuleBuilder_GetTokenGenerator_m5691 (ModuleBuilder_t973 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
|
/*
* Copyright (C) 2011 Peter Grasch <peter.grasch@bedahr.org>
* Copyright (C) 2012 Vladislav Sitalo <root@stvad.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef JULIUSRECOGNIZER_H
#define JULIUSRECOGNIZER_H
#include "recognizer.h"
#include <QMutex>
#include <QString>
#include "simonrecognizer_export.h"
class KProcess;
class SIMONRECOGNIZER_EXPORT JuliusRecognizer : public Recognizer
{
private:
KProcess *m_juliusProcess;
bool isBeingKilled;
QMutex recognitionLock;
QMutex initializationLock;
private:
bool blockTillPrompt(QByteArray *data=0);
QByteArray readData();
bool startProcess();
public:
JuliusRecognizer();
bool init(RecognitionConfiguration* config);
QList<RecognitionResult> recognize(const QString& file);
bool uninitialize();
virtual ~JuliusRecognizer();
};
#endif // JULIUSRECOGNIZER_H
|
#pragma once
#include <OpenEXR/ImathVec.h>
#include <string>
struct RenderSettings
{
// maximum path length allowed in the path tracer (1 = direct
// illumination only).
int m_pathtracerMaxNumBounces;
// Max number of accumulated samples before the render finishes
int m_pathtracerMaxSamples;
// rendered image resolution in pixels
Imath::V2i m_imageResolution;
// Viewport within which to render the image. This may not match the
// resolution of the rendered image, in which case stretching or squashing
// will occur.
int m_viewport[4];
float m_wireframeOpacity;
float m_wireframeThickness;
std::string m_backgroundImage;
Imath::V3f m_backgroundColor[2]; // gradient (top/bottom)
int m_backgroundRotationDegrees;
};
|
#ifndef DATTO_CLIENT_DEVICE_SYNCHRONIZER_DEVICE_SYNCHRONIZER_INTERFACE_H_
#define DATTO_CLIENT_DEVICE_SYNCHRONIZER_DEVICE_SYNCHRONIZER_INTERFACE_H_
#include <memory>
#include "backup/backup_coordinator.h"
#include "backup_status_tracker/sync_count_handler.h"
#include "block_device/block_device.h"
#include "block_device/mountable_block_device.h"
#include "unsynced_sector_manager/unsynced_sector_manager.h"
namespace datto_linux_client {
// Existance of this class allows for easier mocking in unit tests
// The real work is done in DeviceSynchronizer
class DeviceSynchronizerInterface {
public:
// Precondition: source_device must be both traced and mounted
virtual void DoSync(std::shared_ptr<BackupCoordinator> coordinator,
std::shared_ptr<SyncCountHandler> count_handler) = 0;
virtual std::shared_ptr<const MountableBlockDevice>
source_device() const = 0;
virtual std::shared_ptr<const UnsyncedSectorManager>
sector_manager() const = 0;
virtual std::shared_ptr<const BlockDevice> destination_device() const = 0;
virtual ~DeviceSynchronizerInterface() {}
DeviceSynchronizerInterface(const DeviceSynchronizerInterface &) = delete;
DeviceSynchronizerInterface&
operator=(const DeviceSynchronizerInterface &) = delete;
protected:
DeviceSynchronizerInterface() {}
};
}
#endif // DATTO_CLIENT_DEVICE_SYNCHRONIZER_DEVICE_SYNCHRONIZER_INTERFACE_H_
|
#ifndef _HEAD_HACK_CLIENT
#define _HEAD_HACK_CLIENT
#define SOCKET_SEND_MAXLEN 1024
int init_client_connect();
int handle_send(int sock_fd, const char *msg);
#endif
|
/*
* Definitions for akm8975 compass chip.
*/
#ifndef AKM8975_H
#define AKM8975_H
#include <linux/ioctl.h>
#define AKM8975_I2C_NAME "akm8975"
/*! \name AK8975 operation mode
\anchor AK8975_Mode
Defines an operation mode of the AK8975.*/
/*! @{*/
#define AK8975_MODE_SNG_MEASURE 0x01
#define AK8975_MODE_SELF_TEST 0x08
#define AK8975_MODE_FUSE_ACCESS 0x0F
#define AK8975_MODE_POWERDOWN 0x00
/*! @}*/
#define SENSOR_DATA_SIZE 8
#define RWBUF_SIZE 16
/*! \name AK8975 register address
\anchor AK8975_REG
Defines a register address of the AK8975.*/
/*! @{*/
#define AK8975_REG_WIA 0x00
#define AK8975_REG_INFO 0x01
#define AK8975_REG_ST1 0x02
#define AK8975_REG_HXL 0x03
#define AK8975_REG_HXH 0x04
#define AK8975_REG_HYL 0x05
#define AK8975_REG_HYH 0x06
#define AK8975_REG_HZL 0x07
#define AK8975_REG_HZH 0x08
#define AK8975_REG_ST2 0x09
#define AK8975_REG_CNTL 0x0A
#define AK8975_REG_RSV 0x0B
#define AK8975_REG_ASTC 0x0C
#define AK8975_REG_TS1 0x0D
#define AK8975_REG_TS2 0x0E
#define AK8975_REG_I2CDIS 0x0F
/*! @}*/
/*! \name AK8975 fuse-rom address
\anchor AK8975_FUSE
Defines a read-only address of the fuse ROM of the AK8975.*/
/*! @{*/
#define AK8975_FUSE_ASAX 0x10
#define AK8975_FUSE_ASAY 0x11
#define AK8975_FUSE_ASAZ 0x12
/*! @}*/
#define AKMIO 0xA1
/* IOCTLs for AKM library */
#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[SENSOR_DATA_SIZE])
#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short [4][3][3])
/* IOCTLs for APPs */
#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)/* NOT use */
#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)/* NOT use */
#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)/* NOT use */
#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) /* NOT use */
#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
/* */
#define ECS_IOCTL_APP_SET_PFLAG _IOR(AKMIO, 0x1B, short) /* Get proximity flag */
#define ECS_IOCTL_APP_GET_PFLAG _IOR(AKMIO, 0x1C, short) /* Set proximity flag */
/* */
#define ECS_IOCTL_GET_ACCEL_PATH _IOR(AKMIO, 0x20, char[30])
#define ECS_IOCTL_ACCEL_INIT _IOR(AKMIO, 0x21, int[7])
#define ECS_IOCTL_GET_ALAYOUT_INIO _IOR(AKMIO, 0x22, signed short[18])
#define ECS_IOCTL_GET_HLAYOUT_INIO _IOR(AKMIO, 0x23, signed short[18])
#define AKMD2_TO_ACCEL_IOCTL_READ_XYZ _IOWR(AKMIO, 0x31, int)
#define AKMD2_TO_ACCEL_IOCTL_ACCEL_INIT _IOWR(AKMIO, 0x32, int)
/* original source
struct akm8975_platform_data {
char layouts[3][3];
char project_name[64];
int gpio_DRDY;
};
*/
#endif
|
/* $Id: UIMachineDefs.h $ */
/** @file
* VBox Qt GUI - Defines for Virtual Machine classes.
*/
/*
* Copyright (C) 2010-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef __UIMachineDefs_h__
#define __UIMachineDefs_h__
/* Global includes */
#include <iprt/cdefs.h>
/* Machine elements enum: */
enum UIVisualElement
{
UIVisualElement_WindowTitle = RT_BIT(0),
UIVisualElement_MouseIntegrationStuff = RT_BIT(1),
UIVisualElement_IndicatorPoolStuff = RT_BIT(2),
UIVisualElement_HDStuff = RT_BIT(3),
UIVisualElement_CDStuff = RT_BIT(4),
UIVisualElement_FDStuff = RT_BIT(5),
UIVisualElement_NetworkStuff = RT_BIT(6),
UIVisualElement_USBStuff = RT_BIT(7),
UIVisualElement_SharedFolderStuff = RT_BIT(8),
UIVisualElement_Display = RT_BIT(9),
UIVisualElement_VideoCapture = RT_BIT(10),
UIVisualElement_FeaturesStuff = RT_BIT(11),
#ifndef Q_WS_MAC
UIVisualElement_MiniToolBar = RT_BIT(12),
#endif /* !Q_WS_MAC */
UIVisualElement_AllStuff = 0xFFFF
};
/* Mouse states enum: */
enum UIMouseStateType
{
UIMouseStateType_MouseCaptured = RT_BIT(0),
UIMouseStateType_MouseAbsolute = RT_BIT(1),
UIMouseStateType_MouseAbsoluteDisabled = RT_BIT(2),
UIMouseStateType_MouseNeedsHostCursor = RT_BIT(3)
};
/* Machine View states enum: */
enum UIViewStateType
{
UIViewStateType_KeyboardCaptured = RT_BIT(0),
UIViewStateType_HostKeyPressed = RT_BIT(1)
};
#endif // __UIMachineDefs_h__
|
#ifndef __TYPES_V7__
#define __TYPES_V7__
#if defined(_WIN32) && defined(_MSC_VER)
# define ALIGN_PREFIX(bytes) __declspec(align(bytes))
# define ALIGN_POSTFIX(bytes)
# define FUNC_DEF_INLINE __inline
# define FUNC_DEF_EXTERN_INLINE extern __inline
#elif defined(__GNUC__)
# define ALIGN_PREFIX(bytes)
# define ALIGN_POSTFIX(bytes) __attribute__ ((aligned(bytes)))
# if defined (_DEBUG)
# define FUNC_DEF_EXTERN_INLINE extern __inline
# define FUNC_DEF_INLINE static __inline
# else
# define FUNC_DEF_EXTERN_INLINE extern __inline
# define FUNC_DEF_INLINE static __inline
# endif
#else
# define ALIGN_PREFIX(bytes)
# define ALIGN_POSTFIX(bytes)
# error UNKNOWN COMPILER AND OS
#endif
#define ALIGN16_PREFIX ALIGN_PREFIX(16)
#define ALIGN16_POSTFIX ALIGN_POSTFIX(16)
#define FUNC_CALL_TYPE __fastcall
#define FUNC_DEF_EXTERN extern
typedef signed long long int64;
typedef signed int int32;
typedef signed short int16;
typedef signed char int8;
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef float float4[4];
typedef int32 int32_4[4];
typedef float float44[4][4];
typedef float ALIGN16_PREFIX vec4[4] ALIGN16_POSTFIX;
typedef int32 ALIGN16_PREFIX ivec4[4] ALIGN16_POSTFIX;
typedef float ALIGN16_PREFIX mtx[4][4] ALIGN16_POSTFIX;
typedef float ALIGN16_PREFIX quat[4] ALIGN16_POSTFIX;
typedef union _intf {
float f;
int32 i;
} intf;
#endif//__TYPES__
|
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <asm/setup.h>
#include <linux/pagemap.h>
struct st_read_proc {
char *name;
int (*read_proc)(char *, char **, off_t, int, int *, void *);
};
extern unsigned int get_pd_charge_flag(void);
extern unsigned int get_boot_into_recovery_flag(void);
extern unsigned int resetmode_is_normal(void);
extern unsigned int get_boot_into_recovery_flag(void);
/* same as in proc_misc.c */
static int proc_calc_metrics(char *page, char **start, off_t off,
int count, int *eof, int len)
{
if (len <= off + count)
*eof = 1;
*start = page + off;
len -= off;
if (len > count)
len = count;
if (len < 0)
len = 0;
return len;
}
static int app_tag_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len = 0;
u32 charge_flag = 0;
u32 recovery_flag = 0;
u32 reset_normal_flag = 0;
recovery_flag = get_boot_into_recovery_flag();
charge_flag = get_pd_charge_flag();
reset_normal_flag = resetmode_is_normal();
len = snprintf(page, PAGE_SIZE,
"recovery_flag:\n%d\n"
"charge_flag:\n%d\n"
"reset_normal_flag:\n%d\n",
recovery_flag,
charge_flag,
reset_normal_flag);
return proc_calc_metrics(page, start, off, count, eof, len);
}
static struct st_read_proc simple_ones[] = {
{"app_info", app_tag_read_proc},
{NULL,}
};
void __init proc_app_info_init(void)
{
struct st_read_proc *p;
for (p = simple_ones; p->name; p++)
create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
}
|
#ifndef _PLOT_H_
#define _PLOT_H_ 1
#include <qwt_plot.h>
class RectItem;
class QwtInterval;
class Plot: public QwtPlot
{
Q_OBJECT
public:
Plot( QWidget *parent, const QwtInterval & );
virtual void updateLayout();
void setRectOfInterest( const QRectF & );
Q_SIGNALS:
void resized( double xRatio, double yRatio );
private:
RectItem *d_rectOfInterest;
};
#endif
|
/* GStreamer
* Copyright (C) <2009> Руслан Ижбулатов <lrn1986 _at_ gmail _dot_ com>
*
* 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.1 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst-i18n-plugin.h>
#include "gstvideomeasure.h"
#include "gstvideomeasure_ssim.h"
#include "gstvideomeasure_collector.h"
GstEvent *
gst_event_new_measured (guint64 framenumber, GstClockTime timestamp,
const gchar * metric, const GValue * mean, const GValue * lowest,
const GValue * highest)
{
GstStructure *str = gst_structure_new (GST_EVENT_VIDEO_MEASURE,
"event", G_TYPE_STRING, "frame-measured",
"offset", G_TYPE_UINT64, framenumber,
"timestamp", GST_TYPE_CLOCK_TIME, timestamp,
"metric", G_TYPE_STRING, metric,
NULL);
gst_structure_set_value (str, "mean", mean);
gst_structure_set_value (str, "lowest", lowest);
gst_structure_set_value (str, "highest", highest);
return gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, str);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean res;
#ifdef ENABLE_NLS
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
res = gst_element_register (plugin, "ssim", GST_RANK_NONE, GST_TYPE_SSIM);
res &= gst_element_register (plugin, "measurecollector", GST_RANK_NONE,
GST_TYPE_MEASURE_COLLECTOR);
return res;
}
GST_PLUGIN_DEFINE2 (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
videomeasure,
"Various video measurers",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
#pragma once
/*
* Copyright (C) 2005-2015 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <memory>
#include <string>
#include <vector>
class CEvent;
namespace KODI
{
namespace MESSAGING
{
class CApplicationMessenger;
class ThreadMessage
{
friend CApplicationMessenger;
public:
ThreadMessage()
: ThreadMessage{ 0, -1, -1, nullptr }
{
}
explicit ThreadMessage(uint32_t messageId)
: ThreadMessage{ messageId, -1, -1, nullptr }
{
}
ThreadMessage(uint32_t messageId, int p1, int p2, void* payload)
: dwMessage{ messageId }
, param1{ p1 }
, param2{ p2 }
, lpVoid{ payload }
{
}
ThreadMessage(uint32_t messageId, int p1, int p2, void* payload, std::string param, std::vector<std::string> vecParams)
: dwMessage{ messageId }
, param1{ p1 }
, param2{ p2 }
, lpVoid{ payload }
, strParam( param )
, params( vecParams )
{
}
ThreadMessage(const ThreadMessage& other)
: dwMessage(other.dwMessage),
param1(other.param1),
param2(other.param2),
lpVoid(other.lpVoid),
strParam(other.strParam),
params(other.params),
waitEvent(other.waitEvent),
result(other.result)
{
}
ThreadMessage(ThreadMessage&& other)
: dwMessage(other.dwMessage),
param1(other.param1),
param2(other.param2),
lpVoid(other.lpVoid),
strParam(std::move(other.strParam)),
params(std::move(other.params)),
waitEvent(std::move(other.waitEvent)),
result(std::move(other.result))
{
}
ThreadMessage& operator=(const ThreadMessage& other)
{
if (this == &other)
return *this;
dwMessage = other.dwMessage;
param1 = other.param1;
param2 = other.param2;
lpVoid = other.lpVoid;
strParam = other.strParam;
params = other.params;
waitEvent = other.waitEvent;
result = other.result;
return *this;
}
ThreadMessage& operator=(ThreadMessage&& other)
{
if (this == &other)
return *this;
dwMessage = other.dwMessage;
param1 = other.param1;
param2 = other.param2;
lpVoid = other.lpVoid;
strParam = std::move(other.strParam);
params = std::move(other.params);
waitEvent = std::move(other.waitEvent);
result = std::move(other.result);
return *this;
}
uint32_t dwMessage;
int param1;
int param2;
void* lpVoid;
std::string strParam;
std::vector<std::string> params;
void SetResult(int res)
{
//On posted messages result will be zero, since they can't
//retrieve the response we silently ignore this to let message
//handlers not have to worry about it
if (result)
*result = res;
}
protected:
std::shared_ptr<CEvent> waitEvent;
std::shared_ptr<int> result;
};
}
}
|
/*
* CCITT Fax Group 3 and 4 decompression
* Copyright (c) 2008 Konstantin Shishkov
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* CCITT Fax Group 3 and 4 decompression
* @file
* @author Konstantin Shishkov
*/
#ifndef AVCODEC_FAXCOMPR_H
#define AVCODEC_FAXCOMPR_H
#include "avcodec.h"
#include "tiff.h"
/**
* initialize upacker code
*/
void ff_ccitt_unpack_init(void);
/**
* unpack data compressed with CCITT Group 3 1/2-D or Group 4 method
*/
int ff_ccitt_unpack(AVCodecContext *avctx,
const uint8_t *src, int srcsize,
uint8_t *dst, int height, int stride,
enum TiffCompr compr, int opts);
#endif /* AVCODEC_FAXCOMPR_H */
|
#include <stdio.h>
#include <l4/sys/kdebug.h>
void fork_to_background(void);
void fork_to_background(void)
{
printf("unimplemented: %s\n", __func__);
enter_kdebug();
}
|
#include "../../../../../../src/reports/processor/style/color.h"
|
#ifndef _XmDataF_h
#define _XmDataF_h
#include <Xm/Xm.h>
#include <Xm/TextF.h>
#include <Xm/Ext.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct _XmDataFieldClassRec *XmDataFieldWidgetClass;
typedef struct _XmDataFieldRec *XmDataFieldWidget;
/* Function Name: XmCreateDataField
* Description: Creation Routine for UIL and ADA.
* Arguments: parent - the parent widget.
* name - the name of the widget.
* args, num_args - the number and list of args.
* Returns: The Widget created.
*/
Widget XmCreateDataField(
#ifndef _NO_PROTO
Widget, String, ArgList, Cardinal
#endif
);
/*
* Variable argument list functions
*/
extern Widget XmVaCreateDataField(
Widget parent,
char *name,
...);
extern Widget XmVaCreateManagedDataField(
Widget parent,
char *name,
...);
Boolean _XmDataFieldReplaceText(
#ifndef _NO_PROTO
XmDataFieldWidget, XEvent*, XmTextPosition, XmTextPosition, char*, int, Boolean
#endif
);
void XmDataFieldSetString(
#ifndef _NO_PROTO
Widget, char*
#endif
);
extern char * XmDataFieldGetString(
#ifndef _NO_PROTO
Widget
#endif
);
extern wchar_t * XmDataFieldGetStringWcs(
#ifndef _NO_PROTO
Widget
#endif
);
void _XmDataFieldSetClipRect(
#ifndef _NO_PROTO
XmDataFieldWidget
#endif
);
void _XmDataFieldDrawInsertionPoint(
#ifndef _NO_PROTO
XmDataFieldWidget, Boolean
#endif
);
void XmDataFieldSetHighlight(
#ifndef _NO_PROTO
Widget, XmTextPosition, XmTextPosition, XmHighlightMode
#endif
);
void XmDataFieldSetAddMode(
#ifndef _NO_PROTO
Widget, Boolean
#endif
);
char * XmDataFieldGetSelection(
#ifndef _NO_PROTO
Widget
#endif
);
void XmDataFieldSetSelection(
#ifndef _NO_PROTO
Widget, XmTextPosition, XmTextPosition, Time
#endif
);
void _XmDataFieldSetSel2(
#ifndef _NO_PROTO
Widget, XmTextPosition, XmTextPosition, Boolean, Time
#endif
);
Boolean XmDataFieldGetSelectionPosition(
#ifndef _NO_PROTO
Widget, XmTextPosition *, XmTextPosition *
#endif
);
XmTextPosition XmDataFieldXYToPos(
#ifndef _NO_PROTO
Widget, Position, Position
#endif
);
void XmDataFieldShowPosition(
#ifndef _NO_PROTO
Widget, XmTextPosition
#endif
);
Boolean XmDataFieldCut(
#ifndef _NO_PROTO
Widget, Time
#endif
);
Boolean XmDataFieldCopy(
#ifndef _NO_PROTO
Widget, Time
#endif
);
Boolean XmDataFieldPaste(
#ifndef _NO_PROTO
Widget
#endif
);
void XmDataFieldSetEditable(
#ifndef _NO_PROTO
Widget, Boolean
#endif
);
void XmDataFieldSetInsertionPosition(
#ifndef _NO_PROTO
Widget, XmTextPosition
#endif
);
extern WidgetClass xmDataFieldWidgetClass;
typedef struct _XmDataFieldCallbackStruct {
Widget w; /* The XmDataField */
String text; /* Proposed string */
Boolean accept; /* Accept return value, for validation */
} XmDataFieldCallbackStruct;
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif /* _XmDataF_h */
|
#ifndef OFP_VERSION_H
#define OFP_VERSION_H 1
#include <openflow/openflow-common.h>
#include "util.h"
#include "openvswitch/ofp-util.h"
#define OFP_VERSION_LONG_OPTIONS \
{"version", no_argument, NULL, 'V'}, \
{"protocols", required_argument, NULL, 'O'}
#define OFP_VERSION_OPTION_HANDLERS \
case 'V': \
ovs_print_version(OFP10_VERSION, OFP13_VERSION); \
exit(EXIT_SUCCESS); \
\
case 'O': \
set_allowed_ofp_versions(optarg); \
break;
uint32_t get_allowed_ofp_versions(void);
void set_allowed_ofp_versions(const char *string);
void mask_allowed_ofp_versions(uint32_t);
void add_allowed_ofp_versions(uint32_t);
void ofp_version_usage(void);
#endif
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-cen-xr-w32-bld/build/netwerk/base/public/nsPISocketTransportService.idl
*/
#ifndef __gen_nsPISocketTransportService_h__
#define __gen_nsPISocketTransportService_h__
#ifndef __gen_nsISocketTransportService_h__
#include "nsISocketTransportService.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsPISocketTransportService */
#define NS_PISOCKETTRANSPORTSERVICE_IID_STR "83123036-81c0-47cb-8d9c-bd85d29a1b3f"
#define NS_PISOCKETTRANSPORTSERVICE_IID \
{0x83123036, 0x81c0, 0x47cb, \
{ 0x8d, 0x9c, 0xbd, 0x85, 0xd2, 0x9a, 0x1b, 0x3f }}
/**
* This is a private interface used by the internals of the networking library.
* It will never be frozen. Do not use it in external code.
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsPISocketTransportService : public nsISocketTransportService {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PISOCKETTRANSPORTSERVICE_IID)
/**
* init/shutdown routines.
*/
/* void init (); */
NS_SCRIPTABLE NS_IMETHOD Init(void) = 0;
/* void shutdown (); */
NS_SCRIPTABLE NS_IMETHOD Shutdown(void) = 0;
/**
* controls whether or not the socket transport service should poke
* the autodialer on connection failure.
*/
/* attribute boolean autodialEnabled; */
NS_SCRIPTABLE NS_IMETHOD GetAutodialEnabled(PRBool *aAutodialEnabled) = 0;
NS_SCRIPTABLE NS_IMETHOD SetAutodialEnabled(PRBool aAutodialEnabled) = 0;
/**
* controls the TCP sender window clamp
*/
/* readonly attribute long sendBufferSize; */
NS_SCRIPTABLE NS_IMETHOD GetSendBufferSize(PRInt32 *aSendBufferSize) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPISocketTransportService, NS_PISOCKETTRANSPORTSERVICE_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSPISOCKETTRANSPORTSERVICE \
NS_SCRIPTABLE NS_IMETHOD Init(void); \
NS_SCRIPTABLE NS_IMETHOD Shutdown(void); \
NS_SCRIPTABLE NS_IMETHOD GetAutodialEnabled(PRBool *aAutodialEnabled); \
NS_SCRIPTABLE NS_IMETHOD SetAutodialEnabled(PRBool aAutodialEnabled); \
NS_SCRIPTABLE NS_IMETHOD GetSendBufferSize(PRInt32 *aSendBufferSize);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSPISOCKETTRANSPORTSERVICE(_to) \
NS_SCRIPTABLE NS_IMETHOD Init(void) { return _to Init(); } \
NS_SCRIPTABLE NS_IMETHOD Shutdown(void) { return _to Shutdown(); } \
NS_SCRIPTABLE NS_IMETHOD GetAutodialEnabled(PRBool *aAutodialEnabled) { return _to GetAutodialEnabled(aAutodialEnabled); } \
NS_SCRIPTABLE NS_IMETHOD SetAutodialEnabled(PRBool aAutodialEnabled) { return _to SetAutodialEnabled(aAutodialEnabled); } \
NS_SCRIPTABLE NS_IMETHOD GetSendBufferSize(PRInt32 *aSendBufferSize) { return _to GetSendBufferSize(aSendBufferSize); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSPISOCKETTRANSPORTSERVICE(_to) \
NS_SCRIPTABLE NS_IMETHOD Init(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(); } \
NS_SCRIPTABLE NS_IMETHOD Shutdown(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Shutdown(); } \
NS_SCRIPTABLE NS_IMETHOD GetAutodialEnabled(PRBool *aAutodialEnabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAutodialEnabled(aAutodialEnabled); } \
NS_SCRIPTABLE NS_IMETHOD SetAutodialEnabled(PRBool aAutodialEnabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAutodialEnabled(aAutodialEnabled); } \
NS_SCRIPTABLE NS_IMETHOD GetSendBufferSize(PRInt32 *aSendBufferSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSendBufferSize(aSendBufferSize); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class _MYCLASS_ : public nsPISocketTransportService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSPISOCKETTRANSPORTSERVICE
_MYCLASS_();
private:
~_MYCLASS_();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, nsPISocketTransportService)
_MYCLASS_::_MYCLASS_()
{
/* member initializers and constructor code */
}
_MYCLASS_::~_MYCLASS_()
{
/* destructor code */
}
/* void init (); */
NS_IMETHODIMP _MYCLASS_::Init()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void shutdown (); */
NS_IMETHODIMP _MYCLASS_::Shutdown()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean autodialEnabled; */
NS_IMETHODIMP _MYCLASS_::GetAutodialEnabled(PRBool *aAutodialEnabled)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP _MYCLASS_::SetAutodialEnabled(PRBool aAutodialEnabled)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute long sendBufferSize; */
NS_IMETHODIMP _MYCLASS_::GetSendBufferSize(PRInt32 *aSendBufferSize)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsPISocketTransportService_h__ */
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_show_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pgritsen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/08/05 19:31:02 by pgritsen #+# #+# */
/* Updated: 2017/08/05 19:31:04 by pgritsen ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_stock_par.h"
void ft_putchar(char c);
void ft_putstr(char *str)
{
int it;
it = 0;
while (str[it] != 0)
ft_putchar(str[it++]);
}
void ft_putnbr(int nb)
{
long int mult;
long int nb_t;
mult = 1;
nb_t = nb;
if (nb_t < 0)
{
ft_putchar('-');
nb_t *= -1;
}
if (nb_t == 0)
ft_putchar('0');
while (nb_t / mult != 0)
mult *= 10;
while (mult > 1)
{
mult /= 10;
if (mult == 0)
ft_putchar(nb_t + 48);
else
ft_putchar(nb_t / mult + 48);
nb_t %= mult;
}
}
void ft_show_tab(struct s_stock_par *par)
{
int it;
int argv_it;
it = 0;
while (par[it].str)
{
ft_putstr(par[it].copy);
ft_putchar('\n');
ft_putnbr(par[it].size_param);
ft_putchar('\n');
argv_it = 0;
while (par[it].tab[argv_it])
{
ft_putstr(par[it].tab[argv_it]);
ft_putchar('\n');
argv_it++;
}
it++;
}
}
|
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/StandardSamples/SizeDistributionModelsBuilder.h
//! @brief Defines various sample builder classes to test DA, LMA, SSCA approximations
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#ifndef SIZEDISTRIBUTIONMODELSBUILDER_H
#define SIZEDISTRIBUTIONMODELSBUILDER_H
#include "IMultiLayerBuilder.h"
//! Creates the sample demonstrating size distribution model in decoupling approximation.
//! Equivalent of Examples/python/simulation/ex03_InterferenceFunctions/ApproximationDA.py
//! @ingroup standard_samples
class BA_CORE_API_ SizeDistributionDAModelBuilder : public IMultiLayerBuilder
{
public:
SizeDistributionDAModelBuilder(){}
MultiLayer* buildSample() const;
};
//! Creates the sample demonstrating size distribution model in local monodisperse approximation.
//! Equivalent of Examples/python/simulation/ex03_InterferenceFunctions/ApproximationLMA.py
//! @ingroup standard_samples
class BA_CORE_API_ SizeDistributionLMAModelBuilder : public IMultiLayerBuilder
{
public:
SizeDistributionLMAModelBuilder(){}
MultiLayer* buildSample() const;
};
//! Creates the sample demonstrating size distribution model in size space coupling approximation.
//! Equivalent of Examples/python/simulation/ex03_InterferenceFunctions/ApproximationSSCA.py
//! @ingroup standard_samples
class BA_CORE_API_ SizeDistributionSSCAModelBuilder : public IMultiLayerBuilder
{
public:
SizeDistributionSSCAModelBuilder(){}
MultiLayer* buildSample() const;
};
//! Builds sample: size spacing correlation approximation (IsGISAXS example #15).
//! @ingroup standard_samples
class BA_CORE_API_ CylindersInSSCABuilder : public IMultiLayerBuilder
{
public:
CylindersInSSCABuilder(){}
MultiLayer* buildSample() const;
};
#endif // SIZEDISTRIBUTIONMODELSBUILDER_H
|
#ifdef TI83P
# include <ti83pdefs.h>
# include <ti83p.h>
void YName() __naked
{
__asm
push af
push hl
push iy
ld iy,#flags___dw
BCALL(_YName___db)
pop iy
pop hl
pop af
ret
__endasm;
}
#endif
|
/*
* UFTP - UDP based FTP with multicast
*
* Copyright (C) 2001-2013 Dennis A. Bush, Jr. bush@tcnj.edu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional permission under GNU GPL version 3 section 7
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, the copyright holder
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef _CLIENT_FILEINFO_H
#define _CLIENT_FILEINFO_H
void handle_fileinfo(struct group_list_t *group, const unsigned char *message,
unsigned meslen, struct timeval rxtime);
void send_fileinfo_ack(struct group_list_t *group, int restart);
#endif // _CLIENT_FILEINFO_H
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RARCH_POSIX_STRING_H
#define __RARCH_POSIX_STRING_H
#ifdef _WIN32
#include "../msvc/msvc_compat.h"
#ifdef __cplusplus
extern "C" {
#endif
#undef strcasecmp
#undef strdup
#undef isblank
#undef strtok_r
#define strcasecmp(a, b) rarch_strcasecmp__(a, b)
#define strdup(orig) rarch_strdup__(orig)
#define isblank(c) rarch_isblank__(c)
#define strtok_r(str, delim, saveptr) rarch_strtok_r__(str, delim, saveptr)
int strcasecmp(const char *a, const char *b);
char *strdup(const char *orig);
int isblank(int c);
char *strtok_r(char *str, const char *delim, char **saveptr);
#ifdef __cplusplus
}
#endif
#endif
#endif
|
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifdef __CLING__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class o2::parameters::GRPObject + ;
#endif
|
// Copyright Aaron Smith 2009
//
// This file is part of Gity.
//
// Gity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gity. If not, see <http://www.gnu.org/licenses/>.
#import <Cocoa/Cocoa.h>
#import <GDKit/GDKit.h>
#import "GTBaseGitTask.h"
#import "GTGitCommitLoadInfo.h"
#import "GittyDocument.h"
#import "GTCallback.h"
#import "GTGitCommit.h"
@interface GTOpLoadHistory : GTBaseGitTask {
BOOL detatchedHead;
GTGitCommitLoadInfo * loadInfo;
//GTCallback * callback;
NSMutableArray * commits;
}
//- (id) initWithGD:(GittyDocument *) _gd andLoadInfo:(GTGitCommitLoadInfo *) _loadInfo andCallback:(GTCallback *) _callback;
- (id) initWithGD:(GittyDocument *) _gd andLoadInfo:(GTGitCommitLoadInfo *) _loadInfo;
//- (void) readSTDOUTC;
//- (void) readSTDOUTCPP;
@end
|
#ifndef _INTERNAL_H
#define _INTERNAL_H
#include "pluginmain.h"
//menu identifiers
#define MENU_ANALYSIS 0
//functions
void internalInit(PLUG_INITSTRUCT* initStruct);
void internalStop();
void internalSetup();
#endif // _TEST_H
|
/*
dev: Mickeymouse, Moutarde and Nepta
manager: Word
Copyright © 2011
You should have received a copy of the
GNU General Public License along with this program.
If not, see <http://www.gnu.org/licenses/>.
*/
#include "bullet.h"
/**
* \fn Bullet* createBullet(Tower *tower)
* \brief create a new bullet
* a new bullet which doesn't have
* \param tower the tower the bullet belong to
*/
Bullet* createBullet(Tower *tower){
Bullet *bullet = malloc(sizeof (Bullet));
bullet->type = tower->type->typeBul;
bullet->position = searchEnemy(tower);
return bullet;
}
/**
* \fn void drawBullet(Bullet *bullet)
* \brief draw a bullet
*
* \param bullet a bullet to draw
*/
void drawBullet(Bullet *bullet){
SDL_Rect position;
position.x = 280; //=xx
position.y = 280; //=yy
blitToViewport(_viewport, bullet->type->image, NULL, &position);
}
/**
* \fn void animateBullet(Bullet *bullet)
* \brief move the bullet to an enemy and draw it
* Depreciated, recode your own function!
* \param bullet the bullet to animate
*/
void animateBullet(Bullet *bullet){
/* if(!(bullet->position->xx == bullet->position->x && bullet->position->yy == bullet->position->y)){*/
drawBullet(bullet);
/* }*/
}
|
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSViewController.h"
@class TSThread;
NS_ASSUME_NONNULL_BEGIN
@protocol SelectThreadViewControllerDelegate <NSObject>
- (void)threadWasSelected:(TSThread *)thread;
- (BOOL)canSelectBlockedContact;
- (nullable UIView *)createHeaderWithSearchBar:(UISearchBar *)searchBar;
@end
#pragma mark -
// A base class for views used to pick a single signal user, either by
// entering a phone number or picking from your contacts.
@interface SelectThreadViewController : OWSViewController
@property (nonatomic, weak) id<SelectThreadViewControllerDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
|
/*
Copyright © 2014-2015 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILETRANSFERWIDGET_H
#define FILETRANSFERWIDGET_H
#include <QWidget>
#include <QTime>
#include "src/chatlog/chatlinecontent.h"
#include "src/core/corestructs.h"
namespace Ui {
class FileTransferWidget;
}
class QVariantAnimation;
class QPushButton;
class FileTransferWidget : public QWidget
{
Q_OBJECT
public:
explicit FileTransferWidget(QWidget* parent, ToxFile file);
virtual ~FileTransferWidget();
void autoAcceptTransfer(const QString& path);
bool isActive() const;
protected slots:
void onFileTransferInfo(ToxFile file);
void onFileTransferAccepted(ToxFile file);
void onFileTransferCancelled(ToxFile file);
void onFileTransferPaused(ToxFile file);
void onFileTransferResumed(ToxFile file);
void onFileTransferFinished(ToxFile file);
void fileTransferRemotePausedUnpaused(ToxFile file, bool paused);
void fileTransferBrokenUnbroken(ToxFile file, bool broken);
protected:
QString getHumanReadableSize(qint64 size);
void hideWidgets();
void setupButtons();
void handleButton(QPushButton* btn);
void showPreview(const QString& filename);
void acceptTransfer(const QString& filepath);
void setBackgroundColor(const QColor& c, bool whiteFont);
void setButtonColor(const QColor& c);
bool drawButtonAreaNeeded() const;
virtual void paintEvent(QPaintEvent*) final override;
private slots:
void onTopButtonClicked();
void onBottomButtonClicked();
void onPreviewButtonClicked();
private:
static QPixmap scaleCropIntoSquare(const QPixmap &source, int targetSize);
private:
Ui::FileTransferWidget *ui;
ToxFile fileInfo;
QTime lastTick;
quint64 lastBytesSent = 0;
QVariantAnimation* backgroundColorAnimation = nullptr;
QVariantAnimation* buttonColorAnimation = nullptr;
QColor backgroundColor;
QColor buttonColor;
static const uint8_t TRANSFER_ROLLING_AVG_COUNT = 4;
uint8_t meanIndex = 0;
qreal meanData[TRANSFER_ROLLING_AVG_COUNT] = {0.0};
bool active;
};
#endif // FILETRANSFERWIDGET_H
|
/*
* Copyright (c) 2000-2005, 2008-2011 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@
*/
/*
* Modification History
*
* June 1, 2001 Allan Nathanson <ajn@apple.com>
* - public API conversion
*
* March 31, 2000 Allan Nathanson <ajn@apple.com>
* - initial revision
*/
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <SystemConfiguration/SystemConfiguration.h>
#include <SystemConfiguration/SCPrivate.h>
#include "SCDynamicStoreInternal.h"
#include "config.h" /* MiG generated file */
Boolean
SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
{
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
kern_return_t status;
int sc_status;
if (store == NULL) {
/* sorry, you must provide a session */
_SCErrorSet(kSCStatusNoStoreSession);
return FALSE;
}
switch (storePrivate->notifyStatus) {
case NotifierNotRegistered :
/* if no notifications have been registered */
return TRUE;
case Using_NotifierInformViaRunLoop :
CFRunLoopSourceInvalidate(storePrivate->rls);
storePrivate->rls = NULL;
return TRUE;
case Using_NotifierInformViaDispatch :
(void) SCDynamicStoreSetDispatchQueue(store, NULL);
return TRUE;
default :
break;
}
if (storePrivate->server == MACH_PORT_NULL) {
/* sorry, you must have an open session to play */
sc_status = kSCStatusNoStoreServer;
goto done;
}
status = notifycancel(storePrivate->server, (int *)&sc_status);
if (__SCDynamicStoreCheckRetryAndHandleError(store,
status,
&sc_status,
"SCDynamicStoreNotifyCancel notifycancel()")) {
sc_status = kSCStatusOK;
}
done :
/* set notifier inactive */
storePrivate->notifyStatus = NotifierNotRegistered;
if (sc_status != kSCStatusOK) {
_SCErrorSet(sc_status);
return FALSE;
}
return TRUE;
}
|
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef FRAMEWORK_CALLBACKREGISTRY_H
#define FRAMEWORK_CALLBACKREGISTRY_H
/// @file CallbackRegistry.h
/// @author Matthias Richter
/// @since 2018-04-26
/// @brief A generic registry for callbacks
#include "Framework/TypeTraits.h"
#include <tuple>
#include <stdexcept> // runtime_error
#include <utility> // declval
namespace o2
{
namespace framework
{
template <typename KeyT, KeyT _id, typename CallbackT>
struct RegistryPair {
using id = std::integral_constant<KeyT, _id>;
using type = CallbackT;
type callback;
};
template <typename CallbackId, typename... Args>
class CallbackRegistry
{
public:
// FIXME:
// - add more checks
// - recursive check of the argument pack
// - required to be of type RegistryPair
// - callback type is specialization of std::function
// - extend to variable return type
static constexpr std::size_t size = sizeof...(Args);
// set callback for slot
template <typename U>
void set(CallbackId id, U&& cb)
{
set<size>(id, cb);
}
// execute callback at specified slot with argument pack
template <typename... TArgs>
auto operator()(CallbackId id, TArgs&&... args)
{
exec<size>(id, std::forward<TArgs>(args)...);
}
private:
// helper trait to check whether class has a constructor taking callback as argument
template <class T, typename CB>
struct has_matching_callback {
template <class U, typename V>
static int check(decltype(U(std::declval<V>()))*);
template <typename U, typename V>
static char check(...);
static const bool value = sizeof(check<T, CB>(nullptr)) == sizeof(int);
};
// set the callback function of the specified id
// this iterates over defined slots and sets the matching callback
template <std::size_t pos, typename U>
typename std::enable_if<pos != 0>::type set(CallbackId id, U&& cb)
{
if (std::tuple_element<pos - 1, decltype(mStore)>::type::id::value != id) {
return set<pos - 1>(id, cb);
}
// note: there are two substitutions, the one for callback matching the slot type sets the
// callback, while the other substitution should never be called
setAt<pos - 1, typename std::tuple_element<pos - 1, decltype(mStore)>::type::type>(cb);
}
// termination of the recursive loop
template <std::size_t pos, typename U>
typename std::enable_if<pos == 0>::type set(CallbackId id, U&& cb)
{
}
// set the callback at specified slot position
template <std::size_t pos, typename U, typename F>
typename std::enable_if<has_matching_callback<U, F>::value == true>::type setAt(F&& cb)
{
// create a new std::function object and init with the callback function
std::get<pos>(mStore).callback = (U)(cb);
}
// substitution for not matching callback
template <std::size_t pos, typename U, typename F>
typename std::enable_if<has_matching_callback<U, F>::value == false>::type setAt(F&& cb)
{
throw std::runtime_error("mismatch in function substitution at position " + std::to_string(pos));
}
// exec callback of specified id
template <std::size_t pos, typename... TArgs>
typename std::enable_if<pos != 0>::type exec(CallbackId id, TArgs&&... args)
{
if (std::tuple_element<pos - 1, decltype(mStore)>::type::id::value != id) {
return exec<pos - 1>(id, std::forward<TArgs>(args)...);
}
// build a callable function type from the result type of the slot and the
// argument pack, this is used to selcet the matching substitution
using FunT = typename std::tuple_element<pos - 1, decltype(mStore)>::type::type;
using ResT = typename FunT::result_type;
using CheckT = std::function<ResT(TArgs...)>;
FunT& fct = std::get<pos - 1>(mStore).callback;
auto& storedTypeId = fct.target_type();
execAt<pos - 1, FunT, CheckT>(std::forward<TArgs>(args)...);
}
// termination of the recursive loop
template <std::size_t pos, typename... TArgs>
typename std::enable_if<pos == 0>::type exec(CallbackId id, TArgs&&... args)
{
}
// exec callback at specified slot
template <std::size_t pos, typename U, typename V, typename... TArgs>
typename std::enable_if<std::is_same<U, V>::value == true>::type execAt(TArgs&&... args)
{
if (std::get<pos>(mStore).callback) {
std::get<pos>(mStore).callback(std::forward<TArgs>(args)...);
}
}
// substitution for not matching argument pack
template <std::size_t pos, typename U, typename V, typename... TArgs>
typename std::enable_if<std::is_same<U, V>::value == false>::type execAt(TArgs&&... args)
{
}
// store of RegistryPairs
std::tuple<Args...> mStore;
};
} // namespace framework
} // namespace o2
#endif // FRAMEWORK_CALLBACKREGISTRY_H
|
/* Moonshine - a Lua-based chat client
*
* Copyright (C) 2010 Dylan William Hardison
*
* This file is part of Moonshine.
*
* Moonshine is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Moonshine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moonshine. If not, see <http://www.gnu.org/licenses/>.
*/
#include <moonshine/async-queue-source.h>
#include <glib.h>
#include <unistd.h>
static guint tag = 0;
void my_free_func(gpointer data)
{
g_print("free: %s\n", ((GString *)data)->str);
g_string_free((GString *)data, TRUE);
}
void my_pool_func(gpointer data, gpointer userdata)
{
static int count = 1;
GAsyncQueue *queue = userdata;
GString *name = data;
GString *msg = g_string_new("");
g_string_printf(msg, "count: %d", count++);
g_print("- %s\n", name->str);
g_string_free(name, TRUE);
g_print("queue: %s\n", msg->str);
g_async_queue_push(queue, msg);
}
gboolean my_queue_func(gpointer data, gpointer userdata)
{
GString *msg = data;
GString *prefix = userdata;
g_print("%s%s\n", prefix->str, msg->str);
g_string_free(msg, TRUE);
return TRUE;
}
gboolean my_start_func(gpointer userdata)
{
GAsyncQueue *queue = g_async_queue_new_full(my_free_func);
GThreadPool *pool = g_thread_pool_new(my_pool_func, g_async_queue_ref(queue), 1, TRUE, NULL);
tag = ms_async_queue_add_watch(queue, my_queue_func, g_string_new("msg: "), my_free_func);
g_async_queue_unref(queue);
g_thread_pool_push(pool, g_string_new("foo"), NULL);
g_thread_pool_push(pool, g_string_new("bar"), NULL);
g_thread_pool_push(pool, g_string_new("baz"), NULL);
return FALSE;
}
gboolean my_beep_func(gpointer userdata)
{
g_print("beep!\n");
return FALSE;
}
gboolean my_stop_func(gpointer userdata)
{
g_print("stopping...\n");
gboolean rv = g_source_remove(tag);
g_print("g_source_remove(%d): %s\n", tag, rv ? "TRUE" : "FALSE");
return FALSE;
}
int main(int argc, char *argv[])
{
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
g_thread_init(NULL);
g_timeout_add(10, my_start_func, NULL);
//g_timeout_add(1000, my_beep_func, NULL);
//g_timeout_add(5000, my_beep_func, NULL);
g_timeout_add(5000, my_stop_func, NULL);
g_main_loop_run(loop);
return 0;
}
|
/*
* linux/kernel/math/div.c
*
* (C) 1991 Linus Torvalds
*/
/*
* temporary real division routine.
*/
#include <linux/math_emu.h>
static void shift_left(int * c)
{
__asm__ __volatile__("movl (%0),%%eax ; addl %%eax,(%0)\n\t"
"movl 4(%0),%%eax ; adcl %%eax,4(%0)\n\t"
"movl 8(%0),%%eax ; adcl %%eax,8(%0)\n\t"
"movl 12(%0),%%eax ; adcl %%eax,12(%0)"
::"r" ((long) c):"ax");
}
static void shift_right(int * c)
{
__asm__("shrl $1,12(%0) ; rcrl $1,8(%0) ; rcrl $1,4(%0) ; rcrl $1,(%0)"
::"r" ((long) c));
}
static int try_sub(int * a, int * b)
{
char ok;
__asm__ __volatile__("movl (%1),%%eax ; subl %%eax,(%2)\n\t"
"movl 4(%1),%%eax ; sbbl %%eax,4(%2)\n\t"
"movl 8(%1),%%eax ; sbbl %%eax,8(%2)\n\t"
"movl 12(%1),%%eax ; sbbl %%eax,12(%2)\n\t"
"setae %%al":"=a" (ok):"c" ((long) a),"d" ((long) b));
return ok;
}
static void div64(int * a, int * b, int * c)
{
int tmp[4];
int i;
unsigned int mask = 0;
c += 4;
for (i = 0 ; i<64 ; i++) {
if (!(mask >>= 1)) {
c--;
mask = 0x80000000;
}
tmp[0] = a[0]; tmp[1] = a[1];
tmp[2] = a[2]; tmp[3] = a[3];
if (try_sub(b,tmp)) {
*c |= mask;
a[0] = tmp[0]; a[1] = tmp[1];
a[2] = tmp[2]; a[3] = tmp[3];
}
shift_right(b);
}
}
void fdiv(const temp_real * src1, const temp_real * src2, temp_real * result)
{
int i,sign;
int a[4],b[4],tmp[4] = {0,0,0,0};
sign = (src1->exponent ^ src2->exponent) & 0x8000;
if (!(src2->a || src2->b)) {
set_ZE();
return;
}
i = (src1->exponent & 0x7fff) - (src2->exponent & 0x7fff) + 16383;
if (i<0) {
set_UE();
result->exponent = sign;
result->a = result->b = 0;
return;
}
a[0] = a[1] = 0;
a[2] = src1->a;
a[3] = src1->b;
b[0] = b[1] = 0;
b[2] = src2->a;
b[3] = src2->b;
while (b[3] >= 0) {
i++;
shift_left(b);
}
div64(a,b,tmp);
if (tmp[0] || tmp[1] || tmp[2] || tmp[3]) {
while (i && tmp[3] >= 0) {
i--;
shift_left(tmp);
}
if (tmp[3] >= 0)
set_DE();
} else
i = 0;
if (i>0x7fff) {
set_OE();
return;
}
if (tmp[0] || tmp[1])
set_PE();
result->exponent = i | sign;
result->a = tmp[2];
result->b = tmp[3];
}
|
#ifndef _UI_UTILS_H
#define _UI_UTILS_H
namespace QSanUiUtils {
// This is in no way a generic diation fuction. It is some dirty trick that
// produces a shadow image for a pixmap whose foreground mask is binaryImage
QImage produceShadow(const QImage &image, QColor shadowColor, int radius, double decade);
void makeGray(QPixmap &pixmap);
namespace QSanFreeTypeFont {
int *loadFont(const QString &fontPath);
QString resolveFont(const QString &fontName);
// @param painter
// Device to be painted on
// @param font
// Pointer returned by loadFont used to index a font
// @param text
// Text to be painted
// @param fontSize [IN, OUT]
// Suggested width and height of each character in pixels. If the
// bounding box cannot contain the text using the suggested font
// size, font size may be shrinked. The output value will be the
// actual font size used.
// @param boundingBox
// Text will be painted in the center of the bounding box on the device
// @param orient
// Suggest whether the text is laid out horizontally or vertically.
// @return True if succeed.
bool paintQString(QPainter *painter, QString text,
int *font, QColor color,
QSize &fontSize, int spacing, int weight, QRect boundingBox,
Qt::Orientation orient, Qt::Alignment align);
// Currently, we online support horizotal layout for multiline text
bool paintQStringMultiLine(QPainter *painter, QString text,
int *font, QColor color,
QSize &fontSize, int spacing, QRect boundingBox,
Qt::Alignment align);
}
}
#endif
|
#pragma once
/*
* Nanoflann helper classes
* Copyright (C) 2019 Wayne Mogg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nanoflann.h"
#include "coord.h"
#include "typeset.h"
//
// TypeSet to nanoflann kd-tree adaptor class
//
class CoordTypeSetAdaptor
{
public:
CoordTypeSetAdaptor( const TypeSet<Coord>& obj ) : obj_(obj) {}
inline size_t kdtree_get_point_count() const { return obj_.size(); }
inline Pos::Ordinate_Type kdtree_get_pt(const size_t idx, const size_t dim) const
{
return dim==0 ? obj_[idx].x : obj_[idx].y;
}
template <class BBOX>
bool kdtree_get_bbox(BBOX& ) const { return false; }
const TypeSet<Coord>& obj_;
};
typedef nanoflann::KDTreeSingleIndexAdaptor<
nanoflann::L2_Simple_Adaptor<Pos::Ordinate_Type, CoordTypeSetAdaptor >,
CoordTypeSetAdaptor,
2> CoordKDTree;
|
#include <SDL_events.h>
class Engine
{
public:
static bool StaticInit();
virtual ~Engine();
static std::unique_ptr< Engine > sInstance;
virtual int Run();
void SetShouldKeepRunning( bool inShouldKeepRunning ) { mShouldKeepRunning = inShouldKeepRunning; }
virtual void HandleEvent( SDL_Event* inEvent );
protected:
Engine();
virtual void DoFrame();
private:
int DoRunLoop();
bool mShouldKeepRunning;
};
|
/*
File: Carbon.h
Contains: Master include for all of Carbon
Version: QuickTime 7.3
Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved.
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __CARBON__
#define __CARBON__
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __APPLICATIONSERVICES__
#include "ApplicationServices.h"
#endif
#ifndef __APPLICATIONSERVICES__
#include "ApplicationServices.h"
#endif
#ifndef __HIOBJECT__
#include "HIObject.h"
#endif
#ifndef __HITOOLBAR__
#include "HIToolbar.h"
#endif
#ifndef __HIVIEW__
#include "HIView.h"
#endif
#ifndef __HITEXTUTILS__
#include "HITextUtils.h"
#endif
#ifndef __HISHAPE__
#include "HIShape.h"
#endif
#ifndef __BALLOONS__
#include "Balloons.h"
#endif
#ifndef __EVENTS__
#include "Events.h"
#endif
#ifndef __NOTIFICATION__
#include "Notification.h"
#endif
#ifndef __DRAG__
#include "Drag.h"
#endif
#ifndef __CONTROLS__
#include "Controls.h"
#endif
#ifndef __APPEARANCE__
#include "Appearance.h"
#endif
#ifndef __MACWINDOWS__
#include "MacWindows.h"
#endif
#ifndef __TEXTEDIT__
#include "TextEdit.h"
#endif
#ifndef __MENUS__
#include "Menus.h"
#endif
#ifndef __DIALOGS__
#include "Dialogs.h"
#endif
#ifndef __LISTS__
#include "Lists.h"
#endif
#ifndef __CARBONEVENTSCORE__
#include "CarbonEventsCore.h"
#endif
#ifndef __CARBONEVENTS__
#include "CarbonEvents.h"
#endif
#ifndef __TEXTSERVICES__
#include "TextServices.h"
#endif
#ifndef __SCRAP__
#include "Scrap.h"
#endif
#ifndef __MACTEXTEDITOR__
#include "MacTextEditor.h"
#endif
#ifndef __MACHELP__
#include "MacHelp.h"
#endif
#ifndef __CONTROLDEFINITIONS__
#include "ControlDefinitions.h"
#endif
#ifndef __TSMTE__
#include "TSMTE.h"
#endif
#ifndef __TRANSLATIONEXTENSIONS__
#include "TranslationExtensions.h"
#endif
#ifndef __TRANSLATION__
#include "Translation.h"
#endif
#ifndef __AEINTERACTION__
#include "AEInteraction.h"
#endif
#ifndef __TYPESELECT__
#include "TypeSelect.h"
#endif
#ifndef __MACAPPLICATION__
#include "MacApplication.h"
#endif
#ifndef __KEYBOARDS__
#include "Keyboards.h"
#endif
#ifndef __IBCARBONRUNTIME__
#include "IBCarbonRuntime.h"
#endif
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __SOUND__
#include "Sound.h"
#endif
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __OSA__
#include "OSA.h"
#endif
#ifndef __OSACOMP__
#include "OSAComp.h"
#endif
#ifndef __OSAGENERIC__
#include "OSAGeneric.h"
#endif
#ifndef __APPLESCRIPT__
#include "AppleScript.h"
#endif
#ifndef __ASDEBUGGING__
#include "ASDebugging.h"
#endif
#ifndef __ASREGISTRY__
#include "ASRegistry.h"
#endif
#ifndef __FINDERREGISTRY__
#include "FinderRegistry.h"
#endif
#ifndef __DIGITALHUBREGISTRY__
#include "DigitalHubRegistry.h"
#endif
#ifndef __APPLICATIONSERVICES__
#include "ApplicationServices.h"
#endif
#ifndef __PMAPPLICATION__
#include "PMApplication.h"
#endif
#ifndef __NAVIGATION__
#include "Navigation.h"
#endif
#ifndef __APPLICATIONSERVICES__
#include "ApplicationServices.h"
#endif
#ifndef __COLORPICKER__
#include "ColorPicker.h"
#endif
#ifndef __CMCALIBRATOR__
#include "CMCalibrator.h"
#endif
#ifndef __NSL__
#include "NSL.h"
#endif
#ifndef __FONTPANEL__
#include "FontPanel.h"
#endif
#ifndef __HTMLRENDERING__
#include "HTMLRendering.h"
#endif
#ifndef __SPEECHRECOGNITION__
#include "SpeechRecognition.h"
#endif
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __KEYCHAINHI__
#include "KeychainHI.h"
#endif
#ifndef __URLACCESS__
#include "URLAccess.h"
#endif
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __APPLEHELP__
#include "AppleHelp.h"
#endif
#ifndef __CORESERVICES__
#include "CoreServices.h"
#endif
#ifndef __ICAAPPLICATION__
#include "ICAApplication.h"
#endif
#ifndef __ICADEVICE__
#include "ICADevice.h"
#endif
#ifndef __ICACAMERA__
#include "ICACamera.h"
#endif
#endif /* __CARBON__ */
|
/* Header File for abc controller for use in simulink */
#ifndef _ABC_CONTROLLER_
#define _ABC_CONTROLLER_
#include <stdio.h>
#include <math.h>
#define TRUE 1
#define FALSE 0
#include <limits.h>
#include "abc_controller_type.h"
extern void ABC_Controller(double input[16], double output[4], double bona_in[5], double save_data[12]);
extern float Derivative(float Prev_value, float Current_value, float Delta_t);
extern float lag_filter(float X, float tau, float Y_last);
#endif /* _ABC_CONTROLLER_ */
|
/*
* Copyright (C) 2009-2011 Andy Spencer <andy753421@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h>
#include <glib.h>
#include <gdk/gdkgl.h>
#include <gdk/gdkkeysyms.h>
#include <objects/grits-volume.h>
#include <objects/grits-callback.h>
#include <objects/marching.h>
#include <GL/gl.h>
#include <rsl.h>
#include <tester.h>
/******************
* iso ball setup *
******************/
static double dist = 0.75;
static gdouble distp(VolPoint *a,
gdouble bx, gdouble by, gdouble bz)
{
return 1/((a->c.x-bx)*(a->c.x-bx) +
(a->c.y-by)*(a->c.y-by) +
(a->c.z-bz)*(a->c.z-bz)) * 0.10;
//return 1-MIN(1,sqrt((a->c.x-bx)*(a->c.x-bx) +
// (a->c.y-by)*(a->c.y-by) +
// (a->c.z-bz)*(a->c.z-bz)));
}
static VolGrid *load_balls(float dist, int xs, int ys, int zs)
{
VolGrid *grid = vol_grid_new(xs, ys, zs);
for (int x = 0; x < xs; x++)
for (int y = 0; y < ys; y++)
for (int z = 0; z < zs; z++) {
VolPoint *point = vol_grid_get(grid, x, y, z);
point->c.x = ((double)x/(xs-1)*2-1);
point->c.y = ((double)y/(ys-1)*2-1);
point->c.z = ((double)z/(zs-1)*2-1);
point->value =
distp(point, -dist, 0, 0) +
distp(point, dist, 0, 0);
point->value *= 100;
}
return grid;
}
/***************
* radar setup *
***************/
/* Load the radar into a Grits Volume */
static void _cart_to_sphere(VolCoord *out, VolCoord *in)
{
gdouble angle = in->x;
gdouble dist = in->y;
gdouble tilt = in->z;
gdouble lx = sin(angle);
gdouble ly = cos(angle);
gdouble lz = sin(tilt);
out->x = (ly*dist)/20000;
out->y = (lz*dist)/10000-0.5;
out->z = (lx*dist)/20000-1.5;
}
static VolGrid *load_radar(gchar *file, gchar *site)
{
/* Load radar file */
RSL_read_these_sweeps("all", NULL);
Radar *rad = RSL_wsr88d_to_radar(file, site);
Volume *vol = RSL_get_volume(rad, DZ_INDEX);
RSL_sort_rays_in_volume(vol);
/* Count dimensions */
Sweep *sweep = vol->sweep[0];
Ray *ray = sweep->ray[0];
gint nsweeps = vol->h.nsweeps;
gint nrays = sweep->h.nrays/(1/sweep->h.beam_width)+1;
gint nbins = ray->h.nbins /(1000/ray->h.gate_size);
nbins = MIN(nbins, 100);
/* Convert to VolGrid */
VolGrid *grid = vol_grid_new(nrays, nbins, nsweeps);
gint rs, bs, val;
gint si=0, ri=0, bi=0;
for (si = 0; si < nsweeps; si++) {
sweep = vol->sweep[si];
rs = 1.0/sweep->h.beam_width;
for (ri = 0; ri < nrays; ri++) {
/* TODO: missing rays, pick ri based on azimuth */
ray = sweep->ray[(ri*rs) % sweep->h.nrays];
bs = 1000/ray->h.gate_size;
for (bi = 0; bi < nbins; bi++) {
if (bi*bs >= ray->h.nbins)
break;
val = ray->h.f(ray->range[bi*bs]);
if (val == BADVAL || val == RFVAL ||
val == APFLAG || val == NOECHO ||
val == NOTFOUND_H || val == NOTFOUND_V ||
val > 80)
val = 0;
VolPoint *point = vol_grid_get(grid, ri, bi, si);
point->value = val;
point->c.x = deg2rad(ray->h.azimuth);
point->c.y = bi*bs*ray->h.gate_size + ray->h.range_bin1;
point->c.z = deg2rad(ray->h.elev);
} } }
/* Convert to spherical coords */
for (si = 0; si < nsweeps; si++)
for (ri = 0; ri < nrays; ri++)
for (bi = 0; bi < nbins; bi++) {
VolPoint *point = vol_grid_get(grid, ri, bi, si);
if (point->c.y == 0)
point->value = nan("");
else
_cart_to_sphere(&point->c, &point->c);
}
return grid;
}
/**********
* Common *
**********/
static gboolean key_press(GritsTester *tester, GdkEventKey *event, GritsVolume *volume)
{
if (event->keyval == GDK_KEY_v) grits_volume_set_level(volume, volume->level-0.5);
else if (event->keyval == GDK_KEY_V) grits_volume_set_level(volume, volume->level+0.5);
else if (event->keyval == GDK_KEY_d) dist += 0.5;
else if (event->keyval == GDK_KEY_D) dist -= 0.5;
return FALSE;
}
/********
* Main *
********/
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GritsTester *tester = grits_tester_new();
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(tester));
gtk_widget_show_all(window);
/* Grits Volume */
VolGrid *balls_grid = load_balls(dist, 50, 50, 50);
GritsVolume *balls = grits_volume_new(balls_grid);
balls->proj = GRITS_VOLUME_CARTESIAN;
balls->disp = GRITS_VOLUME_SURFACE;
balls->color[0] = (0.8)*0xff;
balls->color[1] = (0.6)*0xff;
balls->color[2] = (0.2)*0xff;
balls->color[3] = (1.0)*0xff;
grits_volume_set_level(balls, 50);
grits_tester_add(tester, GRITS_OBJECT(balls));
g_signal_connect(tester, "key-press-event", G_CALLBACK(key_press), balls);
/* Grits Volume */
//char *file = "/home/andy/.cache/grits/nexrad/level2/KGWX/KGWX_20101130_0459.raw";
//char *file = "/home/andy/.cache/grits/nexrad/level2/KTLX/KTLX_19990503_2351.raw";
//VolGrid *radar_grid = load_radar(file, "KTLX");
//GritsVolume *radar = grits_volume_new(radar_grid);
//radar->proj = GRITS_VOLUME_SPHERICAL;
//radar->disp = GRITS_VOLUME_SURFACE;
//radar->color[0] = (0.8)*0xff;
//radar->color[1] = (0.6)*0xff;
//radar->color[2] = (0.2)*0xff;
//radar->color[3] = (1.0)*0xff;
//grits_volume_set_level(radar, 50);
//grits_tester_add(tester, GRITS_OBJECT(radar));
//g_signal_connect(tester, "key-press-event", G_CALLBACK(key_press), radar);
/* Go */
gtk_main();
return 0;
}
|
/*
* Copyright (C) 2008-2009 Martin Willi
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "eap_aka_3gpp2_card.h"
#include <daemon.h>
typedef struct private_eap_aka_3gpp2_card_t private_eap_aka_3gpp2_card_t;
/**
* Private data of an eap_aka_3gpp2_card_t object.
*/
struct private_eap_aka_3gpp2_card_t {
/**
* Public eap_aka_3gpp2_card_t interface.
*/
eap_aka_3gpp2_card_t public;
/**
* AKA functions
*/
eap_aka_3gpp2_functions_t *f;
/**
* do sequence number checking?
*/
bool seq_check;
/**
* SQN stored in this pseudo-USIM
*/
char sqn[AKA_SQN_LEN];
};
/**
* Functions from eap_aka_3gpp2_provider.c
*/
bool eap_aka_3gpp2_get_k(identification_t *id, char k[AKA_K_LEN]);
void eap_aka_3gpp2_get_sqn(char sqn[AKA_SQN_LEN], int offset);
METHOD(simaka_card_t, get_quintuplet, status_t,
private_eap_aka_3gpp2_card_t *this, identification_t *id,
char rand[AKA_RAND_LEN], char autn[AKA_AUTN_LEN], char ck[AKA_CK_LEN],
char ik[AKA_IK_LEN], char res[AKA_RES_MAX], int *res_len)
{
char *amf, *mac;
char k[AKA_K_LEN], ak[AKA_AK_LEN], sqn[AKA_SQN_LEN], xmac[AKA_MAC_LEN];
if (!eap_aka_3gpp2_get_k(id, k))
{
DBG1(DBG_IKE, "no EAP key found for %Y to authenticate with AKA", id);
return FAILED;
}
/* AUTN = SQN xor AK | AMF | MAC */
DBG3(DBG_IKE, "received autn %b", autn, AKA_AUTN_LEN);
DBG3(DBG_IKE, "using K %b", k, AKA_K_LEN);
DBG3(DBG_IKE, "using rand %b", rand, AKA_RAND_LEN);
memcpy(sqn, autn, AKA_SQN_LEN);
amf = autn + AKA_SQN_LEN;
mac = autn + AKA_SQN_LEN + AKA_AMF_LEN;
/* XOR anonymity key AK into SQN to decrypt it */
if (!this->f->f5(this->f, k, rand, ak))
{
return FAILED;
}
DBG3(DBG_IKE, "using ak %b", ak, AKA_AK_LEN);
memxor(sqn, ak, AKA_SQN_LEN);
DBG3(DBG_IKE, "using sqn %b", sqn, AKA_SQN_LEN);
/* calculate expected MAC and compare against received one */
if (!this->f->f1(this->f, k, rand, sqn, amf, xmac))
{
return FAILED;
}
if (!memeq_const(mac, xmac, AKA_MAC_LEN))
{
DBG1(DBG_IKE, "received MAC does not match XMAC");
DBG3(DBG_IKE, "MAC %b\nXMAC %b", mac, AKA_MAC_LEN, xmac, AKA_MAC_LEN);
return FAILED;
}
if (this->seq_check && memcmp(this->sqn, sqn, AKA_SQN_LEN) >= 0)
{
DBG3(DBG_IKE, "received SQN %b\ncurrent SQN %b",
sqn, AKA_SQN_LEN, this->sqn, AKA_SQN_LEN);
return INVALID_STATE;
}
/* update stored SQN to the received one */
memcpy(this->sqn, sqn, AKA_SQN_LEN);
/* CK/IK, calculate RES */
if (!this->f->f3(this->f, k, rand, ck) ||
!this->f->f4(this->f, k, rand, ik) ||
!this->f->f2(this->f, k, rand, res))
{
return FAILED;
}
*res_len = AKA_RES_MAX;
return SUCCESS;
}
METHOD(simaka_card_t, resync, bool,
private_eap_aka_3gpp2_card_t *this, identification_t *id,
char rand[AKA_RAND_LEN], char auts[AKA_AUTS_LEN])
{
char amf[AKA_AMF_LEN], k[AKA_K_LEN], aks[AKA_AK_LEN], macs[AKA_MAC_LEN];
if (!eap_aka_3gpp2_get_k(id, k))
{
DBG1(DBG_IKE, "no EAP key found for %Y to resync AKA", id);
return FALSE;
}
/* AMF is set to zero in resync */
memset(amf, 0, AKA_AMF_LEN);
if (!this->f->f5star(this->f, k, rand, aks) ||
!this->f->f1star(this->f, k, rand, this->sqn, amf, macs))
{
return FALSE;
}
/* AUTS = SQN xor AKS | MACS */
memcpy(auts, this->sqn, AKA_SQN_LEN);
memxor(auts, aks, AKA_AK_LEN);
memcpy(auts + AKA_AK_LEN, macs, AKA_MAC_LEN);
return TRUE;
}
METHOD(eap_aka_3gpp2_card_t, destroy, void,
private_eap_aka_3gpp2_card_t *this)
{
free(this);
}
/**
* See header
*/
eap_aka_3gpp2_card_t *eap_aka_3gpp2_card_create(eap_aka_3gpp2_functions_t *f)
{
private_eap_aka_3gpp2_card_t *this;
INIT(this,
.public = {
.card = {
.get_triplet = (void*)return_false,
.get_quintuplet = _get_quintuplet,
.resync = _resync,
.get_pseudonym = (void*)return_null,
.set_pseudonym = (void*)nop,
.get_reauth = (void*)return_null,
.set_reauth = (void*)nop,
},
.destroy = _destroy,
},
.f = f,
.seq_check = lib->settings->get_bool(lib->settings,
"%s.plugins.eap-aka-3gpp2.seq_check",
#ifdef SEQ_CHECK /* handle legacy compile time configuration as default */
TRUE,
#else /* !SEQ_CHECK */
FALSE,
#endif /* SEQ_CHECK */
lib->ns),
);
eap_aka_3gpp2_get_sqn(this->sqn, 0);
return &this->public;
}
|
/*
This file is part of Darling.
Copyright (C) 2017 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface NSVBTestedFault : NSObject
@end
|
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Fit/RootAdapter/GSLMultiMinimizer.h
//! @brief Declares class GSLMultiMinimizer.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#ifndef GSLMULTIMINIMIZER_H
#define GSLMULTIMINIMIZER_H
#include "MinimizerConstants.h"
#include "RootMinimizerAdapter.h"
namespace ROOT { namespace Math { class GSLMinimizer; } }
//! Wrapper for the CERN ROOT facade of the GSL multi minimizer family (gradient descent based).
//! @ingroup fitting_internal
class BA_CORE_API_ GSLMultiMinimizer : public RootMinimizerAdapter
{
public:
explicit GSLMultiMinimizer(const std::string& algorithmName = AlgorithmNames::ConjugateFR);
~GSLMultiMinimizer();
//! Sets minimizer internal print level.
void setPrintLevel(int value);
int printLevel() const;
//! Sets maximum number of iterations. This is an internal minimizer setting which has
//! no direct relation to the number of objective function calls (e.g. numberOfIteraction=5
//! might correspond to ~100 objective function calls).
void setMaxIterations(int value);
int maxIterations() const;
std::string statusToString() const override;
protected:
void propagateOptions() override;
const root_minimizer_t* rootMinimizer() const override;
private:
std::unique_ptr<ROOT::Math::GSLMinimizer> m_gsl_minimizer;
};
#endif // GSLMULTIMINIMIZER_H
|
/*
Free Download Manager Copyright (c) 2003-2014 FreeDownloadManager.ORG
*/
#ifndef __COMMON_H_
#define __COMMON_H_
#include "system.h"
#include "fsinet.h"
#define SAFE_DELETE_ARRAY(a) {if (a) {delete [] a; a = NULL;}}
#endif
|
#ifndef REPLY_H
#define REPLY_H
#include <QNetworkReply>
class Reply : public QObject
{
Q_OBJECT
public:
int _id;
QNetworkReply *res;
Reply(int id, QNetworkReply *net){
res = net;
_id = id;
connect(res,SIGNAL(uploadProgress(qint64,qint64)),this,SLOT(progress(qint64,qint64)));
}
signals:
void percentReady(int percent,int id);
public slots:
void progress(qint64 up,qint64 to){
float per = (float)100/(float)to*(float)up;
percentReady((int)per,_id);
}
};
#endif
|
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _VITELOTTE_BEZIER_PATH_
#define _VITELOTTE_BEZIER_PATH_
#include <cassert>
#include <vector>
#include <Eigen/Geometry>
namespace Vitelotte
{
enum BezierSegmentType
{
BEZIER_EMPTY = 0,
BEZIER_LINEAR = 2,
BEZIER_QUADRATIC = 3,
BEZIER_CUBIC = 4
};
template < typename _Vector >
class BezierSegment {
public:
typedef typename _Vector::Scalar Scalar;
typedef _Vector Vector;
typedef BezierSegment<Vector> Self;
public:
inline BezierSegment()
: m_type(BEZIER_EMPTY) {}
inline BezierSegment(BezierSegmentType type, const Vector* points)
: m_type(type) {
std::copy(points, points + type, m_points);
}
inline BezierSegmentType type() const { return m_type; }
inline void setType(BezierSegmentType type) { m_type = type; }
inline const Vector& point(unsigned i) const {
assert(i < m_type);
return m_points[i];
}
inline Vector& point(unsigned i) {
assert(i < m_type);
return m_points[i];
}
inline Self getBackward() const {
Self seg;
seg.setType(type());
for(unsigned i = 0; i < type(); ++i) {
seg.point(type() - 1 - i) = point(i);
}
return seg;
}
void split(Scalar pos, Self& head, Self& tail) {
assert(m_type != BEZIER_EMPTY);
// All the points of de Casteljau Algorithm
Vector pts[10];
Vector* levels[] = {
&pts[9],
&pts[7],
&pts[4],
pts
};
// Initialize the current level.
std::copy(m_points, m_points + type(), levels[type() - 1]);
// Compute all the points
for(int level = type()-1; level >= 0; --level) {
for(int i = 0; i < level; ++i) {
levels[level-1][i] = (Scalar(1) - pos) * levels[level][i]
+ pos * levels[level][i+1];
}
}
// Set the segments
head.setType(type());
tail.setType(type());
const unsigned last = type() - 1;
for(unsigned i = 0; i < type(); ++i) {
head.point(i) = levels[last - i][0];
tail.point(i) = levels[i][i];
}
}
template < typename InIt >
void refineUniform(InIt out, unsigned nSplit) {
Self head;
Self tail = *this;
*(out++) = std::make_pair(Scalar(0), point(0));
for(unsigned i = 0; i < nSplit; ++i) {
Scalar x = Scalar(i+1) / Scalar(nSplit + 1);
tail.split(x, head, tail);
*(out++) = std::make_pair(x, tail.point(0));
}
*(out++) = std::make_pair(Scalar(1), point(type()-1));
}
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
private:
BezierSegmentType m_type;
Vector m_points[4];
};
template < typename _Vector >
class BezierPath
{
public:
typedef _Vector Vector;
public:
static unsigned size(BezierSegmentType type) { return unsigned(type); }
public:
inline BezierPath() {}
inline unsigned nPoints() const { return m_points.size(); }
inline unsigned nSegments() const { return m_segments.size(); }
inline BezierSegmentType type(unsigned si) const { return m_segments.at(si).type; }
inline unsigned nPoints(unsigned si) const { return size(type(si)); }
inline const Vector& point(unsigned pi) const { return m_points.at(pi); }
inline Vector& point(unsigned pi) { return m_points.at(pi); }
inline const Vector& point(unsigned si, unsigned pi) const
{
assert(si < nSegments() && pi < nPoints(si));
return m_points.at(m_segments[si].firstPoint + pi);
}
inline Vector& point(unsigned si, unsigned pi)
{
assert(si < nSegments() && pi < nPoints(si));
return m_points.at(m_segments[si].firstPoint + pi);
}
inline void setFirstPoint(const Vector& point)
{
assert(nPoints() == 0);
m_points.push_back(point);
}
unsigned addSegment(BezierSegmentType type, const Vector* points)
{
assert(nPoints() != 0);
unsigned si = nSegments();
Segment s;
s.type = type;
s.firstPoint = nPoints() - 1;
m_segments.push_back(s);
for(unsigned i = 0; i < nPoints(si) - 1; ++i)
{
m_points.push_back(points[i]);
}
return si;
}
BezierSegment<Vector> getSegment(unsigned si) const {
assert(si < nSegments());
return BezierSegment<Vector>(type(si), &m_points[m_segments[si].firstPoint]);
}
private:
struct Segment {
BezierSegmentType type;
unsigned firstPoint;
};
typedef std::vector<Vector> PointList;
typedef std::vector<Segment> SegmentList;
private:
PointList m_points;
SegmentList m_segments;
};
}
#endif
|
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "opj_includes.h"
opj_image_t* opj_image_create0(void)
{
opj_image_t *image = (opj_image_t*)opj_calloc(1, sizeof(opj_image_t));
return image;
}
opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts,
opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
{
int compno;
opj_image_t *image = NULL;
image = (opj_image_t*) opj_calloc(1, sizeof(opj_image_t));
if (image) {
image->color_space = clrspc;
image->numcomps = numcmpts;
/* allocate memory for the per-component information */
image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(
opj_image_comp_t));
if (!image->comps) {
fprintf(stderr, "Unable to allocate memory for image.\n");
opj_image_destroy(image);
return NULL;
}
/* create the individual image components */
for (compno = 0; compno < numcmpts; compno++) {
opj_image_comp_t *comp = &image->comps[compno];
comp->dx = cmptparms[compno].dx;
comp->dy = cmptparms[compno].dy;
comp->w = cmptparms[compno].w;
comp->h = cmptparms[compno].h;
comp->x0 = cmptparms[compno].x0;
comp->y0 = cmptparms[compno].y0;
comp->prec = cmptparms[compno].prec;
comp->bpp = cmptparms[compno].bpp;
comp->sgnd = cmptparms[compno].sgnd;
comp->data = (int*) opj_calloc(comp->w * comp->h, sizeof(int));
if (!comp->data) {
fprintf(stderr, "Unable to allocate memory for image.\n");
opj_image_destroy(image);
return NULL;
}
}
}
return image;
}
void OPJ_CALLCONV opj_image_destroy(opj_image_t *image)
{
int i;
if (image) {
if (image->comps) {
/* image components */
for (i = 0; i < image->numcomps; i++) {
opj_image_comp_t *image_comp = &image->comps[i];
if (image_comp->data) {
opj_free(image_comp->data);
}
}
opj_free(image->comps);
}
opj_free(image);
}
}
|
/*
* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Robert Nagy, ronag89@gmail.com
*/
#pragma once
#include <common/except.h>
#include <string>
namespace caspar { namespace ffmpeg {
struct ffmpeg_error : virtual caspar_exception{};
struct averror_bsf_not_found : virtual ffmpeg_error{};
struct averror_decoder_not_found : virtual ffmpeg_error{};
struct averror_demuxer_not_found : virtual ffmpeg_error{};
struct averror_encoder_not_found : virtual ffmpeg_error{};
struct averror_eof : virtual ffmpeg_error{};
struct averror_exit : virtual ffmpeg_error{};
struct averror_filter_not_found : virtual ffmpeg_error{};
struct averror_muxer_not_found : virtual ffmpeg_error{};
struct averror_option_not_found : virtual ffmpeg_error{};
struct averror_patchwelcome : virtual ffmpeg_error{};
struct averror_protocol_not_found : virtual ffmpeg_error{};
struct averror_stream_not_found : virtual ffmpeg_error{};
std::string av_error_str(int errn);
void throw_on_ffmpeg_error(int ret, const char* source, const char* func, const char* local_func, const char* file, int line);
void throw_on_ffmpeg_error(int ret, const std::wstring& source, const char* func, const char* local_func, const char* file, int line);
//#define THROW_ON_ERROR(ret, source, func) throw_on_ffmpeg_error(ret, source, __FUNC__, __FILE__, __LINE__)
#define THROW_ON_ERROR_STR_(call) #call
#define THROW_ON_ERROR_STR(call) THROW_ON_ERROR_STR_(call)
#define THROW_ON_ERROR(ret, func, source) \
throw_on_ffmpeg_error(ret, source, func, __FUNCTION__, __FILE__, __LINE__);
#define THROW_ON_ERROR2(call, source) \
[&]() -> int \
{ \
int ret = call; \
throw_on_ffmpeg_error(ret, source, THROW_ON_ERROR_STR(call), __FUNCTION__, __FILE__, __LINE__); \
return ret; \
}()
#define LOG_ON_ERROR2(call, source) \
[&]() -> int \
{ \
int ret = -1;\
try{ \
ret = call; \
throw_on_ffmpeg_error(ret, source, THROW_ON_ERROR_STR(call), __FUNCTION__, __FILE__, __LINE__); \
return ret; \
}catch(...){CASPAR_LOG_CURRENT_EXCEPTION();} \
return ret; \
}()
#define FF_RET(ret, func) \
caspar::ffmpeg::throw_on_ffmpeg_error(ret, L"", func, __FUNCTION__, __FILE__, __LINE__);
#define FF(call) \
[&]() -> int \
{ \
auto ret = call; \
caspar::ffmpeg::throw_on_ffmpeg_error(static_cast<int>(ret), L"", THROW_ON_ERROR_STR(call), __FUNCTION__, __FILE__, __LINE__); \
return ret; \
}()
}}
|
/*
* PktGen by Steffen Schulz © 2009
*
* Braindead TCP server that waits for a packet and then
* - replies with stream of packets
* - with inter-packet delays read as integers from stdin
*
* Disables Nagle Algo to prevent buffering in local network stack
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
#define DEBUG (1)
/* Basic signal handler closes nfq hooks on exit */
static void sig_handler(int signum) {
printf("\nCaught Signal ...\n\n");
exit(0);
}
int main(int argc, char **argv) {
struct sockaddr_in sin;
struct sockaddr_in sout;
int s = socket(AF_INET,SOCK_STREAM,0);
unsigned int slen = sizeof(sout);
unsigned int len = 0;
char line[500];
long delay = 0;
unsigned int cntr = 0;
int port = 1194;
int tmp = 0;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = INADDR_ANY;
/* make stdin non-blocking, i.e. optional */
int flags = fcntl(0, F_GETFL, 0);
flags |= O_NONBLOCK;
fcntl(0, F_SETFL, flags);
/* close nfq hooks on exit */
if (signal(SIGINT, sig_handler) == SIG_IGN)
signal(SIGINT, SIG_IGN);
if (signal(SIGHUP, sig_handler) == SIG_IGN)
signal(SIGHUP, SIG_IGN);
if (signal(SIGTERM, sig_handler) == SIG_IGN)
signal(SIGTERM, SIG_IGN);
// wait for conn, store peer in sout
bind(s, (struct sockaddr *)&sin, sizeof(sin));
listen(s, 2);
int c = accept(s, (struct sockaddr *)&sout, &tmp);
tmp=1;
if (setsockopt(c, IPPROTO_TCP, TCP_NODELAY, &tmp, sizeof(tmp)) < 0)
fprintf(stderr, "Error when disabling buffer..\n");
printf("Got connection from %s:%d, start sending..\n",
inet_ntoa(sout.sin_addr), ntohs(sout.sin_port));
len = snprintf(line, 499, "%010d\n",cntr++);
send(c, line, len+1,0);
while (1) {
if (fgets(line, 49, stdin)) {
delay = atol(line);
}
else {
if (argc > 1)
exit(0);
delay = 5000;
}
if (delay < 0)
delay = 0;
usleep(delay);
len = snprintf(line, 499, "%010d\n",cntr++);
send(c, line, len+1,0);
}
}
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_SVGPolylineElement_h
#define mozilla_dom_SVGPolylineElement_h
#include "nsSVGPolyElement.h"
nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
typedef nsSVGPolyElement SVGPolylineElementBase;
namespace mozilla {
namespace dom {
class SVGPolylineElement MOZ_FINAL : public SVGPolylineElementBase
{
protected:
SVGPolylineElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope) MOZ_OVERRIDE;
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
public:
// nsIContent interface
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
} // namespace mozilla
} // namespace dom
#endif // mozilla_dom_SVGPolylineElement_h
|
/*
* Copyright (C) 2015-2018 Département de l'Instruction Publique (DIP-SEM)
*
* Copyright (C) 2013 Open Education Foundation
*
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour
* l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of OpenBoard.
*
* OpenBoard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* OpenBoard is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBIDLETIMER_H_
#define UBIDLETIMER_H_
#include <QObject>
#include <QDateTime>
class QEvent;
class UBIdleTimer : public QObject
{
Q_OBJECT
public:
UBIdleTimer(QObject *parent = 0);
virtual ~UBIdleTimer();
protected:
bool eventFilter(QObject *obj, QEvent *event);
virtual void timerEvent(QTimerEvent *event);
private:
QDateTime mLastInputEventTime;
bool mCursorIsHidden;
};
#endif /* UBIDLETIMER_H_ */
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CPlayerStats.h
* PURPOSE: Player statistics class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
class CPlayerStats;
#pragma once
#include <vector>
using namespace std;
struct sStat
{
unsigned short id;
float value;
};
class CPlayerStats
{
public:
~CPlayerStats();
bool GetStat(unsigned short usID, float& fValue);
void SetStat(unsigned short usID, float fValue);
vector<sStat*>::const_iterator IterBegin() { return m_List.begin(); }
vector<sStat*>::const_iterator IterEnd() { return m_List.end(); }
unsigned short GetSize() { return static_cast<unsigned short>(m_List.size()); }
private:
vector<sStat*> m_List;
};
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
/* SIXEL context. */
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"
#if defined(_WIN32) && !defined(_XBOX)
#include "../common/win32_common.h"
#endif
static enum gfx_ctx_api sixel_ctx_api = GFX_CTX_NONE;
static void gfx_ctx_sixel_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{
}
static bool gfx_ctx_sixel_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_sixel_update_window_title(void *data, void *data2)
{
const settings_t *settings = config_get_ptr();
video_frame_info_t *video_info = (video_frame_info_t*)data2;
#if defined(_WIN32) && !defined(_XBOX)
const ui_window_t *window = ui_companion_driver_get_window_ptr();
char title[128];
title[0] = '\0';
if (settings->bools.video_memory_show)
{
uint64_t mem_bytes_used = frontend_driver_get_used_memory();
uint64_t mem_bytes_total = frontend_driver_get_total_memory();
char mem[128];
mem[0] = '\0';
snprintf(
mem, sizeof(mem), " || MEM: %.2f/%.2fMB", mem_bytes_used / (1024.0f * 1024.0f),
mem_bytes_total / (1024.0f * 1024.0f));
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
}
video_driver_get_window_title(title, sizeof(title));
if (window && title[0])
window->set_title(&main_window, title);
#endif
}
static void gfx_ctx_sixel_get_video_size(void *data,
unsigned *width, unsigned *height)
{
(void)data;
}
static void *gfx_ctx_sixel_init(
video_frame_info_t *video_info, void *video_driver)
{
(void)video_driver;
return (void*)"sixel";
}
static void gfx_ctx_sixel_destroy(void *data)
{
(void)data;
}
static bool gfx_ctx_sixel_set_video_mode(void *data,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
return true;
}
static void gfx_ctx_sixel_input_driver(void *data,
const char *joypad_name,
input_driver_t **input, void **input_data)
{
(void)data;
#ifdef HAVE_UDEV
*input_data = input_udev.init(joypad_name);
if (*input_data)
{
*input = &input_udev;
return;
}
#endif
*input = NULL;
*input_data = NULL;
}
static bool gfx_ctx_sixel_has_focus(void *data)
{
return true;
}
static bool gfx_ctx_sixel_suppress_screensaver(void *data, bool enable)
{
return true;
}
static bool gfx_ctx_sixel_get_metrics(void *data,
enum display_metric_types type, float *value)
{
return false;
}
static enum gfx_ctx_api gfx_ctx_sixel_get_api(void *data)
{
return sixel_ctx_api;
}
static bool gfx_ctx_sixel_bind_api(void *data,
enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
return true;
}
static void gfx_ctx_sixel_show_mouse(void *data, bool state)
{
(void)data;
}
static void gfx_ctx_sixel_swap_interval(void *data, int interval)
{
(void)data;
(void)interval;
}
static void gfx_ctx_sixel_set_flags(void *data, uint32_t flags)
{
(void)data;
(void)flags;
}
static uint32_t gfx_ctx_sixel_get_flags(void *data)
{
uint32_t flags = 0;
return flags;
}
static void gfx_ctx_sixel_swap_buffers(void *data, void *data2)
{
(void)data;
}
const gfx_ctx_driver_t gfx_ctx_sixel = {
gfx_ctx_sixel_init,
gfx_ctx_sixel_destroy,
gfx_ctx_sixel_get_api,
gfx_ctx_sixel_bind_api,
gfx_ctx_sixel_swap_interval,
gfx_ctx_sixel_set_video_mode,
gfx_ctx_sixel_get_video_size,
NULL, /* get_refresh_rate */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
gfx_ctx_sixel_get_metrics,
NULL,
gfx_ctx_sixel_update_window_title,
gfx_ctx_sixel_check_window,
gfx_ctx_sixel_set_resize,
gfx_ctx_sixel_has_focus,
gfx_ctx_sixel_suppress_screensaver,
true, /* has_windowed */
gfx_ctx_sixel_swap_buffers,
gfx_ctx_sixel_input_driver,
NULL,
NULL,
NULL,
gfx_ctx_sixel_show_mouse,
"sixel",
gfx_ctx_sixel_get_flags,
gfx_ctx_sixel_set_flags,
NULL,
NULL,
NULL
};
|
/*
* Vortex OpenSplice
*
* This software and documentation are Copyright 2006 to TO_YEAR ADLINK
* Technology Limited, its affiliated companies and licensors. All rights
* reserved.
*
* Licensed under the ADLINK Software License Agreement Rev 2.7 2nd October
* 2014 (the "License"); you may not use this file except in compliance with
* the License.
* You may obtain a copy of the License at:
* $OSPL_HOME/LICENSE
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/** \file os/linux/code/os_time.c
* \brief Linux time management
*
* Implements time management for Linux
* by including the generic Linux implementation
*/
#include "../linux/code/os_time.c"
|
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=517c8bf7f36b294cbbcb0a52dcc9b1d1922986ce$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DOMNODE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_DOMNODE_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_dom_capi.h"
#include "include/cef_dom.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefDOMNodeCToCpp
: public CefCToCppRefCounted<CefDOMNodeCToCpp, CefDOMNode, cef_domnode_t> {
public:
CefDOMNodeCToCpp();
// CefDOMNode methods.
Type GetType() OVERRIDE;
bool IsText() OVERRIDE;
bool IsElement() OVERRIDE;
bool IsEditable() OVERRIDE;
bool IsFormControlElement() OVERRIDE;
CefString GetFormControlElementType() OVERRIDE;
bool IsSame(CefRefPtr<CefDOMNode> that) OVERRIDE;
CefString GetName() OVERRIDE;
CefString GetValue() OVERRIDE;
bool SetValue(const CefString& value) OVERRIDE;
CefString GetAsMarkup() OVERRIDE;
CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
CefRefPtr<CefDOMNode> GetParent() OVERRIDE;
CefRefPtr<CefDOMNode> GetPreviousSibling() OVERRIDE;
CefRefPtr<CefDOMNode> GetNextSibling() OVERRIDE;
bool HasChildren() OVERRIDE;
CefRefPtr<CefDOMNode> GetFirstChild() OVERRIDE;
CefRefPtr<CefDOMNode> GetLastChild() OVERRIDE;
CefString GetElementTagName() OVERRIDE;
bool HasElementAttributes() OVERRIDE;
bool HasElementAttribute(const CefString& attrName) OVERRIDE;
CefString GetElementAttribute(const CefString& attrName) OVERRIDE;
void GetElementAttributes(AttributeMap& attrMap) OVERRIDE;
bool SetElementAttribute(const CefString& attrName,
const CefString& value) OVERRIDE;
CefString GetElementInnerText() OVERRIDE;
CefRect GetElementBounds() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_DOMNODE_CTOCPP_H_
|
// Copyright Hugh Perkins 2015 hughperkins at gmail
//
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
// although this looks a bit odd perhaps, this way we dont need to change the existing
// qlearning api much, so dont need to break anything that works already
#pragma once
#include <stdexcept>
#include <iostream>
#include <string>
#include "qlearning/QLearner.h"
#include "trainers/Trainer.h"
class ScenarioProxy : public Scenario {
public:
const int numActions;
const int planes;
const int size;
// float *perception; // NOT owned by us, dont delete
// float lastReward;
// int thisAction;
// bool isReset;
ScenarioProxy( int numActions, int planes, int size ) :
numActions(numActions), planes(planes), size(size) {
}
virtual int getPerceptionSize() {
return size;
}
virtual int getPerceptionPlanes() {
return planes;
}
virtual void getPerception( float *perception ) {
// perception = this->perception;
throw std::runtime_error("getPerception not implemented");
}
virtual void reset() {
// noop?
throw std::runtime_error("reset not implemented");
}
virtual int getNumActions() {
// std::cout << "numActions: " << numActions << std::endl;
return numActions;
// throw runtime_error("getNumActions not implemented");
}
virtual float act( int index ) {
// this->thisAction = index;
// return lastReward;
throw std::runtime_error("act not implemented");
}
virtual bool hasFinished() {
// return isReset;
throw std::runtime_error("hasFinished not implemented");
}
};
// The advantage of this over the original QLearning is that it doesnt do any callbacks
// so it should be super-easy to wrap, using Lua, Python, etc ...
class QLearner2 {
QLearner *qlearner;
ScenarioProxy *scenario;
NeuralNet *net;
// int planes;
// int size;
// int numActions;
public:
QLearner2( Trainer *trainer, NeuralNet *net, int numActions, int planes, int size ) : net(net) {
scenario = new ScenarioProxy( numActions, planes, size );
qlearner = new QLearner( trainer, scenario, net );
}
~QLearner2() {
delete qlearner;
delete scenario;
}
// QLearner2 *setPlanes( int planes ) {
// this->planes = planes;
// scenario->planes = planes;
// return this;
// }
// QLearner2 *setSize( int size ) {
// this->size = size;
// scenario->size = size;
// return this;
// }
// QLearner2 *setNumActions( int numActions ) {
// this->numActions = numActions;
// scenario->numActions = numActions;
// return this;
// }
int step(double lastReward, bool wasReset, float *perception) {
// scenario->lastReward = lastReward;
// scenario->isReset = isReset;
// scenario->perception = currentPerception;
int action = qlearner->step( lastReward, wasReset, perception );
return action;
}
void setLambda( float lambda ) { qlearner->setLambda( lambda ); }
void setMaxSamples( int maxSamples ) { qlearner->setMaxSamples( maxSamples ); }
void setEpsilon( float epsilon ) { qlearner->setEpsilon( epsilon ); }
// void setLearningRate( float learningRate ) { qlearner->setLearningRate( learningRate ); }
};
|
/*
This file is part of SUPPL - the supplemental library for DOS
Copyright (C) 1996-2000 Steffen Kaiser
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $RCSfile: eestrcon.c,v $
$Locker: $ $Name: $ $State: Exp $
char *EStrConcat(int argcnt, ...)
Concats up to argcnt strings together and malloc() a buffer that will
receive the result.
If one of the string == NULL, this string is ignored.
On failure, the program is terminated with the "out of memory" error.
Return:
the malloc'ed buffer
ob(ject): EStrConcat
su(bsystem): error
ty(pe): H
sh(ort description): Concat several strings together
lo(ng description): Concats several strings together, by using the
\tok{StrConcat()} function, and terminates the program on failure
with the error message: "Out of memory"
pr(erequistes):
re(lated to): StrConcat
se(condary subsystems): dynstr
in(itialized by):
wa(rning):
bu(gs):
va(lue): constructed dynamic string
fi(le): eestrcon.c
*/
#include "initsupl.loc"
#ifndef _MICROC_
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#endif
#include "dynstr.h"
#include "msgs.h"
#include "suppldbg.h"
#ifdef RCS_Version
static char const rcsid[] =
"$Id: eestrcon.c,v 1.1 2006/06/17 03:25:02 blairdude Exp $";
#endif
#ifdef _MICROC_
register char *EStrConcat(int argcnt)
{ unsigned cnt, *poi;
unsigned Xcnt, *Xpoi;
unsigned length;
char *h, *p;
DBG_ENTER1
cnt = nargs();
DBG_ENTER2("EStrConcat", "error")
DBG_ARGUMENTS( ("argcnt=%u cnt=%u", argcnt, cnt) )
Xpoi = poi = cnt * 2 - 2 + &argcnt;
Xcnt = cnt = min(cnt, *poi);
for(length = 1; cnt--;)
if(*--poi) length += strlen(*poi);
chkHeap
if((h = p = malloc(length)) == 0)
Esuppl_noMem();
chkHeap
while(Xcnt--)
if(*--Xpoi)
p = stpcpy(p, *Xpoi);
chkHeap
DBG_RETURN_S( h)
}
#else /* !_MICROC_ */
char *EStrConcat(int argcnt, ...)
{ va_list strings;
char *p, *s;
size_t length, l;
DBG_ENTER("EStrConcat", Suppl_error)
DBG_ARGUMENTS( ("argcnt=%u cnt=%u", argcnt, argcnt) )
va_start(strings, argcnt);
chkHeap
p = Estrdup("");
chkHeap
length = 1;
while(argcnt--) {
s = va_arg(strings, char *);
if(s && *s) {
l = length - 1;
Eresize(p, length += strlen(s));
strcpy(p + l, s);
}
}
va_end(strings);
chkHeap
DBG_RETURN_S( p)
}
#endif /* _MICROC_ */
|
/*
* opencog/embodiment/Control/OperationalAvatarController/HCTestAgent.h
*
* Copyright (C) 2002-2009 Novamente LLC
* All Rights Reserved
* Author(s): Nil Geisweiller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License v3 as
* published by the Free Software Foundation and including the exceptions
* at http://opencog.org/wiki/Licenses
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, write to:
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef HCTESTAGENT_H
#define HCTESTAGENT_H
#include <opencog/server/Agent.h>
#include "MessageSender.h"
namespace opencog { namespace oac {
using namespace opencog;
/**
* That class is in charge of executing a scenario to test hillclimbing
* hosted by LS
*/
class HCTestAgent : public Agent
{
enum HCTestMode {
HCT_IDLE,
HCT_INIT,
HCT_WAIT1,
HCT_WAIT2,
HCT_WAIT3,
HCT_WAIT4
};
private:
HCTestMode mode;
unsigned long cycle;
std::string schemaName;
std::vector<std::string> schemaArguments;
std::string avatarId;
std::string ownerId;
AtomSpace* atomSpace;
MessageSender* sender;
unsigned int learning_time1;
unsigned int learning_time2;
unsigned long max_cycle;
public:
virtual const ClassInfo& classinfo() const {
return info();
}
static const ClassInfo& info() {
static const ClassInfo _ci("OperationalAvatarController::HCTestAgent");
return _ci;
}
HCTestAgent();
/**
* @param lt1 Time (in second) to wait for the first learning iteration
* @param lt2 Time (in second) to wait for the second learning iteration
* @param mc Maximum number of cycles to run
*/
void init(std::string sn, std::vector<std::string> schemaArgs,
std::string b, std::string a, AtomSpace* as, MessageSender* s,
unsigned int lt1 = 10, unsigned int lt2 = 100,
unsigned long mc = 10000);
~HCTestAgent();
void run(opencog::CogServer* ne);
void setWait2() {
mode = HCT_WAIT2;
}
void setWait4() {
mode = HCT_WAIT4;
}
}; // class
} } // namespace opencog::oac
#endif
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWIZARD_WIN_P_H
#define QWIZARD_WIN_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
#include <qt_windows.h>
#include <qobject.h>
#include <qwidget.h>
#include <qabstractbutton.h>
#include <QtGui/private/qwidget_p.h>
QT_BEGIN_NAMESPACE
class QVistaBackButton : public QAbstractButton
{
public:
QVistaBackButton(QWidget *widget);
QSize sizeHint() const;
inline QSize minimumSizeHint() const
{ return sizeHint(); }
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
void paintEvent(QPaintEvent *event);
};
class QWizard;
class QVistaHelper : public QObject
{
public:
QVistaHelper(QWizard *wizard);
~QVistaHelper();
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event);
bool handleWinEvent(MSG *message, long *result);
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
void hideBackButton() { if (backButton_) backButton_->hide(); }
void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
static int titleBarSize() { return frameSize() + captionSize(); }
static int topPadding() { return 8; }
static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); }
private:
static HFONT getCaptionFont(HANDLE hTheme);
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
static bool drawBlackRect(const QRect &rect, HDC hdc);
static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
static int backButtonSize() { return 31; } // ### should be queried from back button itself
static int iconSize() { return 16; } // Standard Aero
static int padding() { return 7; } // Standard Aero
static int leftMargin() { return backButtonSize() + padding(); }
static int glowSize() { return 10; }
int titleOffset();
bool resolveSymbols();
void drawTitleBar(QPainter *painter);
void setMouseCursor(QPoint pos);
void collapseTopFrameStrut();
bool winEvent(MSG *message, long *result);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
static bool is_vista;
static VistaState cachedVistaState;
static bool isCompositionEnabled();
static bool isThemeActive();
enum Changes { resizeTop, movePosition, noChange } change;
QPoint pressedPos;
bool pressed;
QRect rtTop;
QRect rtTitle;
QWizard *wizard;
QVistaBackButton *backButton_;
};
QT_END_NAMESPACE
#endif // QT_NO_STYLE_WINDOWSVISTA
#endif // QT_NO_WIZARD
#endif // QWIZARD_WIN_P_H
|
//
// ZipDataInfo.h
//
// $Id: //poco/1.4/Zip/include/Poco/Zip/ZipDataInfo.h#1 $
//
// Library: Zip
// Package: Zip
// Module: ZipDataInfo
//
// Definition of the ZipDataInfo class.
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Zip_ZipDataInfo_INCLUDED
#define Zip_ZipDataInfo_INCLUDED
#include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipCommon.h"
#include "Poco/Zip/ZipUtil.h"
namespace Poco {
namespace Zip {
class Zip_API ZipDataInfo
/// A ZipDataInfo stores a Zip data descriptor
{
public:
static const char HEADER[ZipCommon::HEADER_SIZE];
ZipDataInfo();
/// Creates a header with all fields (except the header field) set to 0
ZipDataInfo(std::istream& in, bool assumeHeaderRead);
/// Creates the ZipDataInfo.
~ZipDataInfo();
/// Destroys the ZipDataInfo.
bool isValid() const;
Poco::UInt32 getCRC32() const;
void setCRC32(Poco::UInt32 crc);
Poco::UInt32 getCompressedSize() const;
void setCompressedSize(Poco::UInt32 size);
Poco::UInt32 getUncompressedSize() const;
void setUncompressedSize(Poco::UInt32 size);
static Poco::UInt32 getFullHeaderSize();
const char* getRawHeader() const;
private:
enum
{
HEADER_POS = 0,
CRC32_POS = HEADER_POS + ZipCommon::HEADER_SIZE,
CRC32_SIZE = 4,
COMPRESSED_POS = CRC32_POS + CRC32_SIZE,
COMPRESSED_SIZE = 4,
UNCOMPRESSED_POS = COMPRESSED_POS + COMPRESSED_SIZE,
UNCOMPRESSED_SIZE = 4,
FULLHEADER_SIZE = UNCOMPRESSED_POS + UNCOMPRESSED_SIZE
};
char _rawInfo[FULLHEADER_SIZE];
bool _valid;
};
inline const char* ZipDataInfo::getRawHeader() const
{
return _rawInfo;
}
inline bool ZipDataInfo::isValid() const
{
return _valid;
}
inline Poco::UInt32 ZipDataInfo::getCRC32() const
{
return ZipUtil::get32BitValue(_rawInfo, CRC32_POS);
}
inline void ZipDataInfo::setCRC32(Poco::UInt32 crc)
{
return ZipUtil::set32BitValue(crc, _rawInfo, CRC32_POS);
}
inline Poco::UInt32 ZipDataInfo::getCompressedSize() const
{
return ZipUtil::get32BitValue(_rawInfo, COMPRESSED_POS);
}
inline void ZipDataInfo::setCompressedSize(Poco::UInt32 size)
{
return ZipUtil::set32BitValue(size, _rawInfo, COMPRESSED_POS);
}
inline Poco::UInt32 ZipDataInfo::getUncompressedSize() const
{
return ZipUtil::get32BitValue(_rawInfo, UNCOMPRESSED_POS);
}
inline void ZipDataInfo::setUncompressedSize(Poco::UInt32 size)
{
return ZipUtil::set32BitValue(size, _rawInfo, UNCOMPRESSED_POS);
}
inline Poco::UInt32 ZipDataInfo::getFullHeaderSize()
{
return FULLHEADER_SIZE;
}
} } // namespace Poco::Zip
#endif // Zip_ZipDataInfo_INCLUDED
|
/**********************************************************************
* $Id$
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2007 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/buffer/OffsetSegmentString.java r378 (JTS-1.12)
*
**********************************************************************/
#ifndef GEOS_OP_BUFFER_OFFSETSEGMENTSTRING_H
#define GEOS_OP_BUFFER_OFFSETSEGMENTSTRING_H
#include <geos/geom/Coordinate.h> // for inlines
#include <geos/geom/CoordinateSequence.h> // for inlines
#include <geos/geom/CoordinateArraySequence.h> // for composition
#include <geos/geom/PrecisionModel.h> // for inlines
#include <vector>
#include <memory>
#include <cassert>
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
/// A dynamic list of the vertices in a constructed offset curve.
//
/// Automatically removes close vertices
/// which are closer than a given tolerance.
///
/// @author Martin Davis
///
class OffsetSegmentString
{
private:
geom::CoordinateArraySequence* ptList;
const geom::PrecisionModel* precisionModel;
/** \brief
* The distance below which two adjacent points on the curve
* are considered to be coincident.
*
* This is chosen to be a small fraction of the offset distance.
*/
double minimumVertexDistance;
/** \brief
* Tests whether the given point is redundant relative to the previous
* point in the list (up to tolerance)
*
* @param pt
* @return true if the point is redundant
*/
bool isRedundant(const geom::Coordinate& pt) const
{
if (ptList->size() < 1)
return false;
const geom::Coordinate& lastPt = ptList->back();
double ptDist = pt.distance(lastPt);
if (ptDist < minimumVertexDistance)
return true;
return false;
}
public:
friend std::ostream& operator<< (std::ostream& os, const OffsetSegmentString& node);
OffsetSegmentString()
:
ptList(new geom::CoordinateArraySequence()),
precisionModel(NULL),
minimumVertexDistance (0.0)
{
}
~OffsetSegmentString()
{
delete ptList;
}
void reset()
{
if ( ptList ) ptList->clear();
else ptList = new geom::CoordinateArraySequence();
precisionModel = NULL;
minimumVertexDistance = 0.0;
}
void setPrecisionModel(const geom::PrecisionModel* nPrecisionModel)
{
precisionModel = nPrecisionModel;
}
void setMinimumVertexDistance(double nMinVertexDistance)
{
minimumVertexDistance = nMinVertexDistance;
}
void addPt(const geom::Coordinate& pt)
{
assert(precisionModel);
geom::Coordinate bufPt = pt;
precisionModel->makePrecise(bufPt);
// don't add duplicate (or near-duplicate) points
if (isRedundant(bufPt))
{
return;
}
// we ask to allow repeated as we checked this ourself
// (JTS uses a vector for ptList, not a CoordinateSequence,
// we should do the same)
ptList->add(bufPt, true);
}
void addPts(const geom::CoordinateSequence& pts, bool isForward)
{
if ( isForward ) {
for (size_t i=0, n=pts.size(); i<n; ++i) {
addPt(pts[i]);
}
} else {
for (size_t i=pts.size(); i>0; --i) {
addPt(pts[i-1]);
}
}
}
/// Check that points are a ring
//
/// add the startpoint again if they are not
void closeRing()
{
if (ptList->size() < 1) return;
const geom::Coordinate& startPt = ptList->front();
const geom::Coordinate& lastPt = ptList->back();
if (startPt.equals(lastPt)) return;
// we ask to allow repeated as we checked this ourself
ptList->add(startPt, true);
}
/// Get coordinates by taking ownership of them
//
/// After this call, the coordinates reference in
/// this object are dropped. Calling twice will
/// segfault...
///
/// FIXME: refactor memory management of this
///
geom::CoordinateSequence* getCoordinates()
{
closeRing();
geom::CoordinateSequence* ret = ptList;
ptList = 0;
return ret;
}
inline int size() const { return ptList ? ptList->size() : 0 ; }
};
inline std::ostream& operator<< (std::ostream& os,
const OffsetSegmentString& lst)
{
if ( lst.ptList )
{
os << *(lst.ptList);
}
else
{
os << "empty (consumed?)";
}
return os;
}
} // namespace geos.operation.buffer
} // namespace geos.operation
} // namespace geos
#endif // ndef GEOS_OP_BUFFER_OFFSETSEGMENTSTRING_H
|
/* Swfdec
* Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
*
* 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.1 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "swfdec_video.h"
#include "swfdec_as_internal.h"
#include "swfdec_as_strings.h"
#include "swfdec_debug.h"
#include "swfdec_net_stream.h"
#include "swfdec_player_internal.h"
#include "swfdec_sandbox.h"
SWFDEC_AS_NATIVE (667, 1, swfdec_video_attach_video)
void
swfdec_video_attach_video (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SwfdecVideoMovie *video;
SwfdecAsObject *o;
SWFDEC_AS_CHECK (SWFDEC_TYPE_VIDEO_MOVIE, &video, "O", &o);
if (o == NULL || !SWFDEC_IS_VIDEO_PROVIDER (o->relay)) {
SWFDEC_WARNING ("calling attachVideo without a NetStream object");
swfdec_video_movie_set_provider (video, NULL);
return;
}
swfdec_video_movie_set_provider (video, SWFDEC_VIDEO_PROVIDER (o->relay));
}
SWFDEC_AS_NATIVE (667, 2, swfdec_video_clear)
void
swfdec_video_clear (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SwfdecVideoMovie *video;
SWFDEC_AS_CHECK (SWFDEC_TYPE_VIDEO_MOVIE, &video, "");
swfdec_video_movie_clear (video);
}
static void
swfdec_video_get_width (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SwfdecVideoMovie *video;
guint w;
SWFDEC_AS_CHECK (SWFDEC_TYPE_VIDEO_MOVIE, &video, "");
if (video->provider) {
w = swfdec_video_provider_get_width (video->provider);
} else {
w = 0;
}
*rval = swfdec_as_value_from_integer (cx, w);
}
static void
swfdec_video_get_height (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SwfdecVideoMovie *video;
guint h;
SWFDEC_AS_CHECK (SWFDEC_TYPE_VIDEO_MOVIE, &video, "");
if (video->provider) {
h = swfdec_video_provider_get_height (video->provider);
} else {
h = 0;
}
*rval = swfdec_as_value_from_integer (cx, h);
}
static void
swfdec_video_get_deblocking (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SWFDEC_STUB ("Video.deblocking (get)");
*rval = swfdec_as_value_from_integer (cx, 0);
}
static void
swfdec_video_set_deblocking (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SWFDEC_STUB ("Video.deblocking (set)");
}
static void
swfdec_video_get_smoothing (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SWFDEC_STUB ("Video.smoothing (get)");
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, TRUE);
}
static void
swfdec_video_set_smoothing (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SWFDEC_STUB ("Video.smoothing (set)");
}
void
swfdec_video_movie_init_properties (SwfdecAsContext *cx)
{
SwfdecAsValue val;
SwfdecAsObject *video, *proto;
// FIXME: We should only initialize if the prototype Object has not been
// initialized by any object's constructor with native properties
// (TextField, TextFormat, XML, XMLNode at least)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_Video, &val);
if (!SWFDEC_AS_VALUE_IS_OBJECT (val))
return;
video = SWFDEC_AS_VALUE_GET_OBJECT (val);
swfdec_as_object_get_variable (video, SWFDEC_AS_STR_prototype, &val);
if (!SWFDEC_AS_VALUE_IS_OBJECT (val))
return;
proto = SWFDEC_AS_VALUE_GET_OBJECT (val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_width,
swfdec_video_get_width, NULL);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_height,
swfdec_video_get_height, NULL);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_deblocking,
swfdec_video_get_deblocking, swfdec_video_set_deblocking);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_smoothing,
swfdec_video_get_smoothing, swfdec_video_set_smoothing);
}
|
/*
Copyright (c) 2013, 2014 Daniel Vrátil <dvratil@redhat.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_SEARCHREQUEST_H
#define AKONADI_SEARCHREQUEST_H
#include <QObject>
#include <QVector>
#include <QSet>
#include <QStringList>
namespace Akonadi {
namespace Server {
class Connection;
class SearchRequest: public QObject
{
Q_OBJECT
public:
SearchRequest( const QByteArray &connectionId );
~SearchRequest();
void setQuery( const QString &query );
QString query() const;
void setCollections( const QVector<qint64> &collections );
QVector<qint64> collections() const;
void setMimeTypes( const QStringList &mimeTypes );
QStringList mimeTypes() const;
void setRemoteSearch( bool remote );
bool remoteSearch() const;
/**
* Whether results should be stored after they are emitted via resultsAvailable(),
* so that they can be extracted via results() after the search is over. This
* is disabled by default.
*/
void setStoreResults( bool storeResults );
QByteArray connectionId() const;
void exec();
QSet<qint64> results() const;
Q_SIGNALS:
void resultsAvailable( const QSet<qint64> &results );
private:
void searchPlugins();
void emitResults( const QSet<qint64> &results );
QByteArray mConnectionId;
QString mQuery;
QVector<qint64> mCollections;
QStringList mMimeTypes;
bool mRemoteSearch;
bool mStoreResults;
QSet<qint64> mResults;
};
} // namespace Server
} // namespace Akonadi
#endif // AKONADI_SEARCHREQUEST_H
|
#ifndef AVIO_H
#define AVIO_H
#include "patch.h"
/* output byte stream handling */
typedef INT64 offset_t;
/* unbuffered I/O */
typedef struct {
unsigned char *buffer;
int buffer_size;
unsigned char *buf_ptr, *buf_end;
void *opaque;
int (*read_packet)(void *opaque, UINT8 *buf, int buf_size);
void (*write_packet)(void *opaque, UINT8 *buf, int buf_size);
int (*seek)(void *opaque, offset_t offset, int whence);
offset_t pos; /* position in the file of the current buffer */
int must_flush; /* true if the next seek should flush */
int eof_reached; /* true if eof reached */
int write_flag; /* true if open for writing */
int is_streamed;
int max_packet_size;
OutputBuf out_buf;
} ByteIOContext;
int init_put_byte(ByteIOContext *s);
void put_byte(ByteIOContext *s, int b);
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
void put_le64(ByteIOContext *s, UINT64 val);
void put_be64(ByteIOContext *s, UINT64 val);
void put_le32(ByteIOContext *s, unsigned int val);
void put_be32(ByteIOContext *s, unsigned int val);
void put_le16(ByteIOContext *s, unsigned int val);
void put_be16(ByteIOContext *s, unsigned int val);
void put_tag(ByteIOContext *s, const char *tag);
void put_be64_double(ByteIOContext *s, double val);
void put_strz(ByteIOContext *s, const char *buf);
offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence);
offset_t url_fskip(ByteIOContext *s, offset_t offset);
offset_t url_ftell(ByteIOContext *s);
int url_feof(ByteIOContext *s);
void put_flush_packet(ByteIOContext *s);
int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
int get_byte(ByteIOContext *s);
unsigned int get_le32(ByteIOContext *s);
UINT64 get_le64(ByteIOContext *s);
unsigned int get_le16(ByteIOContext *s);
double get_be64_double(ByteIOContext *s);
char *get_strz(ByteIOContext *s, char *buf, int maxlen);
unsigned int get_be16(ByteIOContext *s);
unsigned int get_be32(ByteIOContext *s);
UINT64 get_be64(ByteIOContext *s);
int get_mem_buffer_size( ByteIOContext* stBuf );
char *get_str(ByteIOContext *s, char *buf, int maxlen);
static inline int url_is_streamed(ByteIOContext *s)
{
return s->is_streamed;
}
#endif
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "librepo/version.h"
#include "fixtures.h"
#include "testsys.h"
#include "test_version.h"
START_TEST(test_version_check_macro)
{
ck_assert(LR_VERSION_CHECK(LR_VERSION_MAJOR,
LR_VERSION_MINOR,
LR_VERSION_PATCH));
ck_assert(LR_VERSION_CHECK(0, 0, 0));
ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR,
LR_VERSION_MINOR,
LR_VERSION_PATCH+1)));
ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR,
LR_VERSION_MINOR+1,
LR_VERSION_PATCH)));
ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR+1,
LR_VERSION_MINOR,
LR_VERSION_PATCH)));
}
END_TEST
Suite *
version_suite(void)
{
Suite *s = suite_create("version");
TCase *tc = tcase_create("Main");
tcase_add_test(tc, test_version_check_macro);
suite_add_tcase(s, tc);
return s;
}
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.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 the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QS60MAINAPPLICATION_P_H
#define QS60MAINAPPLICATION_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
#include <qglobal.h>
#include <apparc.h>
QT_BEGIN_NAMESPACE
CApaApplication *newS60Application();
QT_END_NAMESPACE
#endif // QS60MAINAPPLICATION_P_H
|
/*
题目:定义Fibonacci 数列如下:
/ 0 n=0
f(n)= 1 n=1
\ f(n-1)+f(n-2) n=2
输入n,用最快的方法求该数列的第n 项。
分析:在很多C 语言教科书中讲到递归函数的时候,都会用Fibonacci 作为例子。
因此很多程序员对这道题的递归解法非常熟悉,但....呵呵,你知道的。。
ANSWER:
This is the traditional problem of application of mathematics...
let A=
{1 1}
{1 0}
f(n) = A^(n-1)[0,0]
this gives a O(log n) solution.
int f(int n) {
int A[4] = {1,1,1,0};
int result[4];
power(A, n, result);
return result[0];
}
void multiply(int[] A, int[] B, int _r) {
_r[0] = A[0]*B[0] + A[1]*B[2];
_r[1] = A[0]*B[1] + A[1]*B[3];
_r[2] = A[2]*B[0] + A[3]*B[2];
_r[3] = A[2]*B[1] + A[3]*B[3];
}
void power(int[] A, int n, int _r) {
if (n==1) { memcpy(A, _r, 4*sizeof(int)); return; }
int tmp[4];
power(A, n>>1, _r);
multiply(_r, _r, tmp);
if (n & 1 == 1) {
multiply(tmp, A, _r);
} else {
memcpy(_r, tmp, 4*sizeof(int));
}
}
*/
#include <stdio.h>
#include <stdlib.h>
int fibonacci(int n)
{
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;
} else {
int fn[3] = {0};
fn[0] = 0;
fn[1] = 1;
while (n >= 2) {
fn[2] = fn[0] + fn[1];
fn[0] = fn[1];
fn[1] = fn[2];
n--;
}
return fn[2];
}
}
/*
------ ----
f[n+1] = [ 1, 1] ^n f[1]
f[n] [ 1, 0] f[0]
------ ----
*/
unsigned int fibonacci2(unsigned int n)
{
if (n == 0) {
return 0;
} else if(n == 1) {
return 1;
} else {
int a[4] = {1, 1, 1, 0};
int ret[4] = {1, 1, 1, 0};
while (n-- > 1) {
ret[0] = ret[0] * a[0] + ret[1] * a[2];
ret[1] = ret[0] * a[1] + ret[1] * a[3];
ret[2] = ret[2] * a[0] + ret[3] * a[2];
ret[3] = ret[2] * a[1] + ret[3] * a[3];
}
return ret[2];
}
}
int main(void)
{
int n;
int ret;
printf("Please input number:");
scanf("%d", &n);
ret = fibonacci(n);
printf("1.The result is %d\n", ret);
ret = fibonacci2(n);
printf("2.The result is %d\n", ret);
return 0;
}
|
/***************************************************************************
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2002 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef _RayFeature_h_
#define _RayFeature_h_
#include <App/DocumentObject.h>
#include <App/PropertyLinks.h>
#include <App/PropertyFile.h>
#include <App/PropertyStandard.h>
#include "RaySegment.h"
namespace Raytracing
{
class Property;
/** Base class of all Feature classes in FreeCAD
*/
//class RayFeature: public Part::PartFeature
class AppRaytracingExport RayFeature: public Raytracing::RaySegment
{
PROPERTY_HEADER(Raytracing::RayFeature);
public:
/// Constructor
RayFeature(void);
App::PropertyLink Source;
App::PropertyColor Color;
/** @name methods overide Feature */
//@{
/// recalculate the Feature
App::DocumentObjectExecReturn *execute(void);
/// returns the type name of the ViewProvider
const char* getViewProviderName(void) const {
return "Gui::ViewProviderDocumentObject";
}
//@}
};
} //namespace Raytracing
#endif //_RayFeature_h_
|
#ifndef AIK_PROCESS_FUNC_H
#define AIK_PROCESS_FUNC_H
int proc_aikclient_init(void * sub_proc,void * para);
int proc_aikclient_start(void * sub_proc,void * para);
#endif
|
/*
* Copyright © 2009 Adrian Johnson
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Author: Adrian Johnson <ajohnson@redneon.com>
*/
#include "cairo-test.h"
#include <float.h>
#define SIZE 256
/* This test is designed to test the accuracy of the rendering of mesh
* patterns.
*
* Color accuracy is tested by a square patch covering the whole
* surface with black and white corners.
*
* Extents accuracy is checked by a small red square patch at the
* center of the surface which should measure 2x2 pixels.
*/
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_pattern_t *pattern;
double offset;
cairo_test_paint_checkered (cr);
pattern = cairo_pattern_create_mesh ();
cairo_mesh_pattern_begin_patch (pattern);
cairo_mesh_pattern_move_to (pattern, 0, 0);
cairo_mesh_pattern_line_to (pattern, 1, 0);
cairo_mesh_pattern_line_to (pattern, 1, 1);
cairo_mesh_pattern_line_to (pattern, 0, 1);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 0, 0, 0, 0);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 1, 1, 1, 1);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 2, 0, 0, 0);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 3, 1, 1, 1);
cairo_mesh_pattern_end_patch (pattern);
cairo_mesh_pattern_begin_patch (pattern);
/* A small 1x1 red patch, that should be rendered as a 2x2 red
* square in the center of the image */
offset = 0.5 / SIZE;
cairo_mesh_pattern_move_to (pattern, 0.5 + offset, 0.5 + offset);
cairo_mesh_pattern_line_to (pattern, 0.5 + offset, 0.5 - offset);
cairo_mesh_pattern_line_to (pattern, 0.5 - offset, 0.5 - offset);
cairo_mesh_pattern_line_to (pattern, 0.5 - offset, 0.5 + offset);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 0, 1, 0, 0);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 1, 1, 0, 0);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 2, 1, 0, 0);
cairo_mesh_pattern_set_corner_color_rgb (pattern, 3, 1, 0, 0);
cairo_mesh_pattern_end_patch (pattern);
cairo_scale (cr, SIZE, SIZE);
cairo_set_source (cr, pattern);
cairo_paint (cr);
cairo_pattern_destroy (pattern);
return CAIRO_TEST_SUCCESS;
}
CAIRO_TEST (mesh_pattern_accuracy,
"Paint mesh pattern",
"mesh, pattern", /* keywords */
NULL, /* requirements */
SIZE, SIZE,
NULL, draw)
|
/**
* Copyright 2005-2007 ECMWF
*
* Licensed under the GNU Lesser General Public License which
* incorporates the terms and conditions of version 3 of the GNU
* General Public License.
* See LICENSE and gpl-3.0.txt for details.
*/
/***************************************************************************
* Enrico Fucile *
***************************************************************************/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
START_CLASS_DEF
CLASS = action
IMPLEMENTS = dump
IMPLEMENTS = destroy;execute
MEMBERS = char *name
MEMBERS = int append
MEMBERS = int padtomultiple
END_CLASS_DEF
*/
/* START_CLASS_IMP */
/*
Don't edit anything between START_CLASS_IMP and END_CLASS_IMP
Instead edit values between START_CLASS_DEF and END_CLASS_DEF
or edit "action.class" and rerun ./make_class.pl
*/
static void init_class (grib_action_class*);
static void dump (grib_action* d, FILE*,int);
static void destroy (grib_context*,grib_action*);
static int execute(grib_action* a,grib_handle* h);
typedef struct grib_action_write {
grib_action act;
/* Members defined in write */
char *name;
int append;
int padtomultiple;
} grib_action_write;
static grib_action_class _grib_action_class_write = {
0, /* super */
"action_class_write", /* name */
sizeof(grib_action_write), /* size */
0, /* inited */
&init_class, /* init_class */
0, /* init */
&destroy, /* destroy */
&dump, /* dump */
0, /* xref */
0, /* create_accessor*/
0, /* notify_change */
0, /* reparse */
&execute, /* execute */
0, /* compile */
};
grib_action_class* grib_action_class_write = &_grib_action_class_write;
static void init_class(grib_action_class* c)
{
}
/* END_CLASS_IMP */
extern int errno;
grib_action* grib_action_create_write( grib_context* context, const char* name,int append,int padtomultiple)
{
char buf[1024];
grib_action_write* a =NULL;
grib_action_class* c = grib_action_class_write;
grib_action* act = (grib_action*)grib_context_malloc_clear_persistent(context,c->size);
act->op = grib_context_strdup_persistent(context,"section");
act->cclass = c;
a = (grib_action_write*)act;
act->context = context;
a->name = grib_context_strdup_persistent(context,name);
sprintf(buf,"write%p",(void*)a->name);
act->name = grib_context_strdup_persistent(context,buf);
a->append=append;
a->padtomultiple=padtomultiple;
return act;
}
static int execute(grib_action* act, grib_handle *h)
{
int ioerr=0;
grib_action_write* a = (grib_action_write*) act;
int err =GRIB_SUCCESS;
size_t size;
const void* buffer=NULL;
char* filename;
char string[1024]={0,};
grib_file* of=NULL;
if ((err=grib_get_message(h,&buffer,&size))!= GRIB_SUCCESS) {
grib_context_log(act->context,GRIB_LOG_ERROR,"unable to get message\n");
return err;
}
if (strlen(a->name)!=0) {
err = grib_recompose_name(h,NULL,a->name,string,0);
filename=string;
} else {
filename = act->context->outfilename ? act->context->outfilename : "filter.out";
}
if (a->append) of=grib_file_open(filename,"a",&err);
else of=grib_file_open(filename,"w",&err);
if (!of || !of->handle) {
grib_context_log(act->context,GRIB_LOG_ERROR,"unable to open file %s\n",filename);
return GRIB_IO_PROBLEM;
}
if (h->gts_header)
fwrite(h->gts_header,1,h->gts_header_len,of->handle);
if(fwrite(buffer,1,size,of->handle) != size) {
ioerr=errno;
grib_context_log(act->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),
"Error writing to %s",filename);
return GRIB_IO_PROBLEM;
}
if (a->padtomultiple) {
char* zeros;
size_t padding=a->padtomultiple - size%a->padtomultiple;
/* printf("XXX padding=%d size=%d padtomultiple=%d\n",padding,size,a->padtomultiple); */
zeros=calloc(padding,1);
if(fwrite(zeros,1,padding,of->handle) != padding) {
ioerr=errno;
grib_context_log(act->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),
"Error writing to %s",filename);
return GRIB_IO_PROBLEM;
}
free(zeros);
}
if (h->gts_header) {
char gts_trailer[4]={'\x0D','\x0D','\x0A','\x03'};
fwrite(gts_trailer,1,4,of->handle);
}
grib_file_close(filename,&err);
if (err != GRIB_SUCCESS) {
grib_context_log(act->context,GRIB_LOG_ERROR,"unable to get message\n");
return err;
}
return err;
}
static void dump(grib_action* act, FILE* f, int lvl)
{
}
static void destroy(grib_context* context,grib_action* act)
{
grib_action_write* a = (grib_action_write*) act;
grib_context_free_persistent(context, a->name);
grib_context_free_persistent(context, act->name);
grib_context_free_persistent(context, act->op);
}
|
/*
* The code in this file is placed in public domain.
* Contact: Hedede <Haddayn@gmail.com>
*/
#ifndef aw_traits_decay_h
#define aw_traits_decay_h
#include <type_traits>
namespace aw {
template<typename T>
using decay = typename std::decay<T>::type;
template<typename T>
using decay_t = std::decay<T>;
} // namespace aw
#endif//aw_traits_decay_h
|
/* pushback.h - header for pushback.c */
#ifndef pushback_H
#define pushback_H 1
struct pb_file {
unsigned buff_amt;
ub1 pb_buff[RDSZ];
int fd;
ub1* next;
};
typedef struct pb_file pb_file;
#ifdef __cplusplus
extern "C" {
#endif
U_EXPORT int pb_push(pb_file*, void*, int);
U_EXPORT int pb_read(pb_file*, void*, int);
U_EXPORT void pb_init(pb_file*, int fd, ub1* data);
#ifdef __cplusplus
}
#endif
#endif
|
#include "../../src/corelib/tsampleinfolist.h"
|
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
//
// This file is part of Bytecoin.
//
// Bytecoin is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Bytecoin 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 Bytecoin. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <list>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/member.hpp>
#include "P2pProtocolTypes.h"
#include "CryptoNoteConfig.h"
namespace CryptoNote {
class ISerializer;
/************************************************************************/
/* */
/************************************************************************/
class PeerlistManager {
struct by_time{};
struct by_id{};
struct by_addr{};
typedef boost::multi_index_container<
PeerlistEntry,
boost::multi_index::indexed_by<
// access by peerlist_entry::net_adress
boost::multi_index::ordered_unique<boost::multi_index::tag<by_addr>, boost::multi_index::member<PeerlistEntry, NetworkAddress, &PeerlistEntry::adr> >,
// sort by peerlist_entry::last_seen<
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_time>, boost::multi_index::member<PeerlistEntry, uint64_t, &PeerlistEntry::last_seen> >
>
> peers_indexed;
public:
class Peerlist {
public:
Peerlist(peers_indexed& peers, size_t maxSize);
size_t count() const;
bool get(PeerlistEntry& entry, size_t index) const;
void trim();
private:
peers_indexed& m_peers;
const size_t m_maxSize;
};
PeerlistManager();
bool init(bool allow_local_ip);
size_t get_white_peers_count() const { return m_peers_white.size(); }
size_t get_gray_peers_count() const { return m_peers_gray.size(); }
bool merge_peerlist(const std::list<PeerlistEntry>& outer_bs);
bool get_peerlist_head(std::list<PeerlistEntry>& bs_head, uint32_t depth = CryptoNote::P2P_DEFAULT_PEERS_IN_HANDSHAKE) const;
bool get_peerlist_full(std::list<PeerlistEntry>& pl_gray, std::list<PeerlistEntry>& pl_white) const;
bool get_white_peer_by_index(PeerlistEntry& p, size_t i) const;
bool get_gray_peer_by_index(PeerlistEntry& p, size_t i) const;
bool append_with_peer_white(const PeerlistEntry& pr);
bool append_with_peer_gray(const PeerlistEntry& pr);
bool set_peer_just_seen(PeerIdType peer, uint32_t ip, uint32_t port);
bool set_peer_just_seen(PeerIdType peer, const NetworkAddress& addr);
bool set_peer_unreachable(const PeerlistEntry& pr);
bool is_ip_allowed(uint32_t ip) const;
void trim_white_peerlist();
void trim_gray_peerlist();
void serialize(ISerializer& s);
Peerlist& getWhite();
Peerlist& getGray();
private:
std::string m_config_folder;
bool m_allow_local_ip;
peers_indexed m_peers_gray;
peers_indexed m_peers_white;
Peerlist m_whitePeerlist;
Peerlist m_grayPeerlist;
};
}
|
/****************************************************************************
**
** Jreen
**
** Copyright © 2012 Ruslan Nigmatullin <euroelessar@yandex.ru>
**
*****************************************************************************
**
** $JREEN_BEGIN_LICENSE$
** Jreen is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Jreen 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 Jreen. If not, see <http://www.gnu.org/licenses/>.
** $JREEN_END_LICENSE$
**
****************************************************************************/
#ifndef JREEN_JINGLETRANSPORTICE_P_H
#define JREEN_JINGLETRANSPORTICE_P_H
#include "jingletransport.h"
#ifdef HAVE_IRISICE
#include <QList>
#include "3rdparty/icesupport/ice176.h"
#include "3rdparty/icesupport/udpportreserver.h"
//#include <nice.h>
namespace Jreen
{
namespace JingleIce
{
class Transport : public JingleTransport
{
Q_OBJECT
public:
Transport(JingleContent *content);
~Transport();
virtual void send(int component, const QByteArray &data);
virtual void setRemoteInfo(const JingleTransportInfo::Ptr &info, bool final);
private slots:
void onIceStarted();
void onIceError(XMPP::Ice176::Error error);
void onIceLocalCandidatesReady(const QList<XMPP::Ice176::Candidate> &candidates);
void onIceComponentReady(int component);
void onIceReadyRead(int);
private:
XMPP::Ice176 *m_ice;
XMPP::UdpPortReserver *m_portReserver;
QSet<int> m_ready;
};
typedef XMPP::Ice176::Candidate Candidate;
class TransportInfo : public JingleTransportInfo
{
J_PAYLOAD(Jreen::JingleIce::TransportInfo)
public:
QList<Candidate> candidates;
QString pwd;
QString ufrag;
};
class TransportFactory : public JingleTransportFactory<TransportInfo>
{
public:
TransportFactory();
virtual JingleTransport *createObject(JingleContent *content);
virtual void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes);
virtual void handleEndElement(const QStringRef &name, const QStringRef &uri);
virtual void handleCharacterData(const QStringRef &text);
virtual void serialize(Payload *obj, QXmlStreamWriter *writer);
virtual Payload::Ptr createPayload();
private:
int m_depth;
TransportInfo::Ptr m_info;
};
}
}
#endif // HAVE_IRISICE
#endif // JREEN_JINGLETRANSPORTICE_P_H
|
/*
pkTriggerCord
Copyright (C) 2011-2014 Andras Salamon <andras.salamon@melda.info>
Remote control of Pentax DSLR cameras.
Support for K200D added by Jens Dreyer <jens.dreyer@udo.edu> 04/2011
Support for K-r added by Vincenc Podobnik <vincenc.podobnik@gmail.com> 06/2011
Support for K-30 added by Camilo Polymeris <cpolymeris@gmail.com> 09/2012
Support for K-01 added by Ethan Queen <ethanqueen@gmail.com> 01/2013
based on:
PK-Remote
Remote control of Pentax DSLR cameras.
Copyright (C) 2008 Pontus Lidman <pontus@lysator.liu.se>
PK-Remote for Windows
Copyright (C) 2010 Tomasz Kos
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
and GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PSLR_MODEL_H
#define PSLR_MODEL_H
#include "pslr_enum.h"
#include "pslr_scsi.h"
#define MAX_RESOLUTION_SIZE 4
#define MAX_STATUS_BUF_SIZE 452
#define MAX_SEGMENTS 4
typedef struct ipslr_handle ipslr_handle_t;
typedef struct {
int32_t nom;
int32_t denom;
} pslr_rational_t;
typedef struct {
uint16_t bufmask;
uint32_t current_iso;
pslr_rational_t current_shutter_speed;
pslr_rational_t current_aperture;
pslr_rational_t lens_max_aperture;
pslr_rational_t lens_min_aperture;
pslr_rational_t set_shutter_speed;
pslr_rational_t set_aperture;
pslr_rational_t max_shutter_speed;
uint32_t auto_bracket_mode; // 1: on, 0: off
pslr_rational_t auto_bracket_ev;
uint32_t auto_bracket_picture_count;
uint32_t fixed_iso;
uint32_t jpeg_resolution;
uint32_t jpeg_saturation;
uint32_t jpeg_quality;
uint32_t jpeg_contrast;
uint32_t jpeg_sharpness;
uint32_t jpeg_image_tone;
uint32_t jpeg_hue;
pslr_rational_t zoom;
int32_t focus;
uint32_t image_format;
uint32_t raw_format;
uint32_t light_meter_flags;
pslr_rational_t ec;
uint32_t custom_ev_steps;
uint32_t custom_sensitivity_steps;
uint32_t exposure_mode;
uint32_t exposure_submode;
uint32_t user_mode_flag;
uint32_t ae_metering_mode;
uint32_t af_mode;
uint32_t af_point_select;
uint32_t selected_af_point;
uint32_t focused_af_point;
uint32_t auto_iso_min;
uint32_t auto_iso_max;
uint32_t drive_mode;
uint32_t shake_reduction;
uint32_t white_balance_mode;
uint32_t white_balance_adjust_mg;
uint32_t white_balance_adjust_ba;
uint32_t flash_mode;
int32_t flash_exposure_compensation; // 1/256
int32_t manual_mode_ev; // 1/10
uint32_t color_space;
uint32_t lens_id1;
uint32_t lens_id2;
uint32_t battery_1;
uint32_t battery_2;
uint32_t battery_3;
uint32_t battery_4;
} pslr_status;
typedef void (*ipslr_status_parse_t)(ipslr_handle_t *p, pslr_status *status);
typedef struct {
uint32_t id; // Pentax model ID
const char *name; // name
bool old_scsi_command; // 1 for *ist cameras, 0 for the newer cameras
bool need_exposure_mode_conversion; // is exposure_mode_conversion required
int buffer_size; // buffer size in bytes
int max_jpeg_stars; // maximum jpeg stars
int jpeg_resolutions[MAX_RESOLUTION_SIZE]; // jpeg resolution table
int jpeg_property_levels; // 5 [-2, 2] or 7 [-3,3] or 9 [-4,4]
int fastest_shutter_speed; // fastest shutter speed denominator
int base_iso_min; // base iso minimum
int base_iso_max; // base iso maximum
int extended_iso_min; // extended iso minimum
int extended_iso_max; // extended iso maximum
pslr_jpeg_image_tone_t max_supported_image_tone; // last supported jpeg image tone
ipslr_status_parse_t parser_function; // parse function for status buffer
} ipslr_model_info_t;
typedef struct {
uint32_t offset;
uint32_t addr;
uint32_t length;
} ipslr_segment_t;
struct ipslr_handle {
int fd;
pslr_status status;
uint32_t id;
ipslr_model_info_t *model;
ipslr_segment_t segments[MAX_SEGMENTS];
uint32_t segment_count;
uint32_t offset;
uint8_t status_buffer[MAX_STATUS_BUF_SIZE];
};
ipslr_model_info_t *find_model_by_id( uint32_t id );
int get_hw_jpeg_quality( ipslr_model_info_t *model, int user_jpeg_stars);
uint32_t get_uint32(uint8_t *buf);
void hexdump(uint8_t *buf, uint32_t bufLen);
#endif
|
/**************************************************************************/
/* */
/* This file is part of CINV. */
/* */
/* Copyright (C) 2009-2011 */
/* LIAFA (University of Paris Diderot and CNRS) */
/* */
/* */
/* 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, version 3. */
/* */
/* It 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. */
/* */
/* See the GNU Lesser General Public License version 3. */
/* for more details (enclosed in the file LICENSE). */
/* */
/**************************************************************************/
#ifndef SHAPE_MANAGER_H_
#define SHAPE_MANAGER_H_
#include "hgraph_fun.h"
#include "shape_fun.h"
#include "ap_pcons0.h"
#include "ap_passign0.h"
#include "ap_manager.h"
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C"
{
#endif
/* *INDENT-ON* */
/* ********************************************************************** */
/* Manager */
/* ********************************************************************** */
/* ============================================================ */
/* Internal Representation */
/* ============================================================ */
/* manager-local data specific to shapes */
struct _shape_internal_t
{
/* current function */
ap_funid_t funid;
/* local parameters for current function */
ap_funopt_t *funopt;
/* hash-tables */
hgraph_t *hgraphs; /* heap graphs */
pcons0_t *pcons; /* ptr constraints */
passign0_t *passigns; /* ptr assignments */
/* manager of the segment domains */
size_t size_scons;
ap_manager_t **man_scons; /* array of scons_size managers */
size_t man_mset; /* position of the mset manager/constraint */
size_t man_ucons; /* position of the ucons manager/constraint */
/* max number for anonymous nodes for closure */
size_t max_anon;
size_t segm_anon;
/* count errors and files */
int error_;
long int filenum;
/* default dimensions */
size_t intdim;
size_t realdim;
/* approximate meet for hgraphs */
int meet_algo;
/* TODO: other data */
/* back-pointer */
ap_manager_t *man;
};
typedef struct _shape_internal_t shape_internal_t;
/* Abstract data type of library-specific manager options. */
/* ============================================================ */
/* Basic management. */
/* ============================================================ */
/* called by each function to setup and get manager-local data */
static inline shape_internal_t *
shape_init_from_manager (ap_manager_t * man, ap_funid_t id, size_t size)
{
shape_internal_t *pr = (shape_internal_t *) man->internal;
pr->funid = id;
pr->funopt = man->option.funopt + id;
man->result.flag_exact = man->result.flag_best = true;
/* TODO: set other internal data from manager */
/* DO NOT TOUCH TO THE hgraphs FIELD! */
return pr;
}
/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* SHAPE_MANAGER_H_ */
|
#pragma once
#include "SamplingMethod.h"
namespace PcapDotNet { namespace Core
{
/// <summary>
/// This sampling method defines that we have to return 1 packet every given time-interval.
/// In other words, if the interval is set to 10 milliseconds, the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed.
/// </summary>
public ref class SamplingMethodFirstAfterInterval sealed : SamplingMethod
{
public:
/// <summary>
/// Constructs by giving an interval in milliseconds.
/// </summary>
/// <param name="intervalInMs">The number of milliseconds to wait between packets sampled.</param>
/// <exception cref="System::ArgumentOutOfRangeException">The given number of milliseconds is negative.</exception>
SamplingMethodFirstAfterInterval(int intervalInMs);
/// <summary>
/// Constructs by giving an interval as TimeSpan.
/// </summary>
/// <param name="interval">The time to wait between packets sampled.</param>
/// <exception cref="System::ArgumentOutOfRangeException">The interval is negative or larger than 2^31 milliseconds.</exception>
SamplingMethodFirstAfterInterval(System::TimeSpan interval);
internal:
virtual property int Method
{
int get() override;
}
/// <summary>
/// Indicates the 'waiting time' in milliseconds before one packet got accepted.
/// In other words, if 'value = 10', the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed.
/// </summary>
virtual property int Value
{
int get() override;
}
private:
int _intervalInMs;
};
}}
|
#pragma once
#include "Session.h"
#pragma once
#include "NetPacket.h"
class ChatSession: public Session
{
public:
void HandlePing(NetPacket * NetPacket);
void HandleEnterRoom(NetPacket * recvPack);
void HandleLevaeRoom(NetPacket * recvPack);
void HandlePlayerMessage(NetPacket * recvPack);
unsigned int RoomId() const { return m_roomId; }
private:
bool authenticated;
unsigned int m_roomId;
};
|
/**
******************************************************************************
* @file DMA/DMA_FLASHToRAM/Src/stm32f1xx_it.c
* @author MCD Application Team
* @version V1.3.0
* @date 18-December-2015
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_it.h"
/** @addtogroup STM32F1xx_HAL_Examples
* @{
*/
/** @addtogroup DMA_FLASHToRAM
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
extern DMA_HandleTypeDef DmaHandle;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M3 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
HAL_IncTick();
}
/******************************************************************************/
/* STM32F1xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f1xx.s). */
/******************************************************************************/
/**
* @brief This function handles DMA channel interrupt request.
* @param None
* @retval None
*/
void DMA_INSTANCE_IRQHANDLER(void)
{
/* Check the interrupt and clear flag */
HAL_DMA_IRQHandler(&DmaHandle);
}
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
******************************************************************************
* @file main.h
* @author MCD Application Team
* @version V1.3.0
* @date 18-December-2015
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© Copyright © 2015 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution 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 STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
#include "GUI.h"
/* EVAL includes component */
#include "stm3210e_eval.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
//
// Mixer.h
// Tonic
//
// Created by Nick Donaldson on 2/9/13.
//
// See LICENSE.txt for license and usage information.
//
//! A mixer is like an adder but acts as a source and allows dynamic removal
#ifndef __Tonic__Mixer__
#define __Tonic__Mixer__
#include "Synth.h"
#include "CompressorLimiter.h"
using std::vector;
namespace Tonic {
namespace Tonic_ {
class Mixer_ : public BufferFiller_ {
private:
TonicFrames workSpace_;
vector<BufferFiller> inputs_;
void computeSynthesisBlock(const SynthesisContext_ &context);
public:
Mixer_();
void addInput(BufferFiller input);
void removeInput(BufferFiller input);
};
inline void Mixer_::computeSynthesisBlock(const SynthesisContext_ &context)
{
// Clear buffer
outputFrames_.clear();
// Tick and add inputs
for (unsigned int i=0; i<inputs_.size(); i++){
// Tick each bufferFiller every time, with our context (for now).
inputs_[i].tick(workSpace_, context);
outputFrames_ += workSpace_;
}
}
}
class Mixer : public TemplatedBufferFiller<Tonic_::Mixer_>{
public:
void addInput(BufferFiller input){
gen()->lockMutex();
gen()->addInput(input);
gen()->unlockMutex();
}
void removeInput(BufferFiller input){
gen()->lockMutex();
gen()->removeInput(input);
gen()->unlockMutex();
}
};
}
#endif /* defined(__Tonic__Mixer__) */
|
/*
* Copyright 2014 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MONGOC_IOVEC_H
#define MONGOC_IOVEC_H
#include <bson.h>
#ifndef _WIN32
# include <sys/uio.h>
#endif
BSON_BEGIN_DECLS
#ifdef _WIN32
typedef struct
{
size_t iov_len;
char *iov_base;
} mongoc_iovec_t;
#else
typedef struct iovec mongoc_iovec_t;
#endif
BSON_END_DECLS
#endif /* MONGOC_IOVEC_H */
|
// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include "paddle/fluid/framework/ir/fuse_pass_base.h"
#include "paddle/fluid/framework/ir/graph.h"
namespace paddle {
namespace framework {
namespace ir {
/*
* \brief Fuse the FC and activation operators into single OneDNN's
* FC with post-op.
*
* \note Currently only GeLU, hardswish, sigmoid, mish and tanh are supported
* as an activation function.
*/
class FuseFCActOneDNNPass : public FusePassBase {
public:
virtual ~FuseFCActOneDNNPass() {}
protected:
void ApplyImpl(ir::Graph *graph) const override;
void FuseFCAct(ir::Graph *graph, const std::string &act_types) const;
};
} // namespace ir
} // namespace framework
} // namespace paddle
|
/*
* Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* File: PeerProvider.h
* Author: rmartins
*
* Created on July 26, 2010, 6:13 PM
*/
#ifndef PEERPROVIDER_H
#define PEERPROVIDER_H
#include <stheno/core/p2p/discovery/DiscoveryProvider.h>
#include <stheno/core/p2p/common/PeerMap.h>
#include <stheno/core/p2p/mesh/Mesh.h>
class PeerProvider: public DiscoveryProvider {
public:
static const UInt PEER_PROVIDER;
PeerProvider(MeshPtr& meshService);
virtual ~PeerProvider();
virtual void close();
virtual DiscoveryQueryReply* executeQuery(
DiscoveryQuery* query,
DiscoveryQoS* qos = 0) throw (DiscoveryException&);
virtual AsyncDiscoveryQueryReply* executeAsyncQuery(
DiscoveryQuery* query,
DiscoveryQoS* qos = 0,
ACE_Time_Value* timeout = 0) throw (DiscoveryException&);
virtual void cancelAsyncQuery(AsyncDiscoveryQueryReply* token) throw (DiscoveryException&);
virtual UInt getProviderID();
//caller must free list
virtual list<UInt>& getProvidedEvents();
protected:
list<UInt> m_providedEvents;
MeshPtr m_meshService;
PeerMapPtr& getPeerMap();
};
#endif /* PEERPROVIDER_H */
|
//
// YWUserTool.h
// YiWobao
//
// Created by 刘毕涛 on 16/5/6.
// Copyright © 2016年 浙江蚁窝投资管理有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
@class YWUser;
@interface YWUserTool : NSObject
+ (void)saveAccount:(YWUser *)account;
+ (YWUser *)account;
+ (void)quit;
@end
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/alexaforbusiness/AlexaForBusiness_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace AlexaForBusiness
{
namespace Model
{
class AWS_ALEXAFORBUSINESS_API CreateAddressBookResult
{
public:
CreateAddressBookResult();
CreateAddressBookResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
CreateAddressBookResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The ARN of the newly created address book.</p>
*/
inline const Aws::String& GetAddressBookArn() const{ return m_addressBookArn; }
/**
* <p>The ARN of the newly created address book.</p>
*/
inline void SetAddressBookArn(const Aws::String& value) { m_addressBookArn = value; }
/**
* <p>The ARN of the newly created address book.</p>
*/
inline void SetAddressBookArn(Aws::String&& value) { m_addressBookArn = std::move(value); }
/**
* <p>The ARN of the newly created address book.</p>
*/
inline void SetAddressBookArn(const char* value) { m_addressBookArn.assign(value); }
/**
* <p>The ARN of the newly created address book.</p>
*/
inline CreateAddressBookResult& WithAddressBookArn(const Aws::String& value) { SetAddressBookArn(value); return *this;}
/**
* <p>The ARN of the newly created address book.</p>
*/
inline CreateAddressBookResult& WithAddressBookArn(Aws::String&& value) { SetAddressBookArn(std::move(value)); return *this;}
/**
* <p>The ARN of the newly created address book.</p>
*/
inline CreateAddressBookResult& WithAddressBookArn(const char* value) { SetAddressBookArn(value); return *this;}
private:
Aws::String m_addressBookArn;
};
} // namespace Model
} // namespace AlexaForBusiness
} // namespace Aws
|
// AnyChatCallCenterServerDlg.h : header file
//
#if !defined(AFX_ANYCHATCALLCENTERSERVERDLG_H__69ADA4B7_BCD7_435B_A14D_20271C905BA1__INCLUDED_)
#define AFX_ANYCHATCALLCENTERSERVERDLG_H__69ADA4B7_BCD7_435B_A14D_20271C905BA1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <list>
class CAnyChatCallCenterServerDlg : public CDialog
{
// Construction
public:
CAnyChatCallCenterServerDlg(CWnd* pParent = NULL); // standard constructor
public:
CString m_strLogInfo; ///< ±£´æÈÕÖ¾ÐÅÏ¢
// ÏÔʾÈÕÖ¾ÐÅÏ¢
void AppendLogString(CString logstr);
// ³õʼ»¯ÒµÎñ¶ÓÁÐ
void InitAnyChatQueue(void);
// Dialog Data
//{{AFX_DATA(CAnyChatCallCenterServerDlg)
enum { IDD = IDD_ANYCHATCALLCENTERSERVER_DIALOG };
CEdit m_ctrlEditLog;
CComboBox m_ComboStyle;
int m_iTargetId;
BOOL m_bShowUserLog;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAnyChatCallCenterServerDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CAnyChatCallCenterServerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnDestroy();
afx_msg void OnButtonSendbuf();
afx_msg void OnButtonTransFile();
afx_msg void OnButtonTransBufferEx();
afx_msg void OnButtonTransBuffer();
afx_msg void OnButtonStartRecord();
afx_msg void OnButtonStopRecord();
afx_msg void OnCheckShowLog();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnButtonKickOut();
afx_msg void OnButtonHangUp();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANYCHATCALLCENTERSERVERDLG_H__69ADA4B7_BCD7_435B_A14D_20271C905BA1__INCLUDED_)
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/eks/EKS_EXPORTS.h>
#include <aws/eks/model/Cluster.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace EKS
{
namespace Model
{
class AWS_EKS_API RegisterClusterResult
{
public:
RegisterClusterResult();
RegisterClusterResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
RegisterClusterResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
inline const Cluster& GetCluster() const{ return m_cluster; }
inline void SetCluster(const Cluster& value) { m_cluster = value; }
inline void SetCluster(Cluster&& value) { m_cluster = std::move(value); }
inline RegisterClusterResult& WithCluster(const Cluster& value) { SetCluster(value); return *this;}
inline RegisterClusterResult& WithCluster(Cluster&& value) { SetCluster(std::move(value)); return *this;}
private:
Cluster m_cluster;
};
} // namespace Model
} // namespace EKS
} // namespace Aws
|
// Copyright (C) 2004 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_MISC_API_KERNEl_1_
#include "misc_api_kernel_2.h"
#endif
|
/*
* File: NetWork.h
* Author: guoxinhua
*
* Created on 2014年9月24日, 下午5:14
*/
#ifndef CP_NETWORK_H
#define CP_NETWORK_H
#ifdef __cplusplus
extern "C" {
#endif
#define CP_REACTOR_MAXEVENTS 4096
#define CP_MAX_EVENT 1024
#define CP_BUFFER_SIZE (1024*1024)
#define CP_MAX_UINT 4294967295
#define EPOLL_CLOSE 10
#define CP_CLIENT_EOF_STR "\r\n^CON^eof\r\n"
#define CP_TOO_MANY_CON "not enough con"
#define CP_TOO_MANY_CON_ERR "ERROR!not enough con"
#define CP_MULTI_PROCESS_ERR "ERROR!the connection object create in parent process and use in multi process,please create in every process"
#define CP_CLIENT_EOF_LEN strlen(CP_CLIENT_EOF_STR)
#define CP_HEADER_CON_SUCCESS "CON_SUCCESS!"
#define CP_HEADER_ERROR "ERROR!"
#define CP_PDO_HEADER_STATE "PDOStatement!"
#define CP_RELEASE_HEADER "r"
#define CP_RELEASE_HEADER_LEN 1
typedef int (*epoll_wait_handle)(int fd);
int cpEpoll_add(int epfd, int fd, int fdtype);
int cpEpoll_set(int fd, int fdtype);
int cpEpoll_del(int epfd, int fd);
int cpEpoll_wait(epoll_wait_handle*, struct timeval *timeo, int epfd);
void cpEpoll_free();
CPINLINE int cpEpoll_event_set(int fdtype);
#ifdef __cplusplus
}
#endif
#endif /* NETWORK_H */
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2001, 2010 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
#include "db_config.h"
#include "db_int.h"
/*
* __os_id --
* Return the current process ID.
*
* PUBLIC: void __os_id __P((DB_ENV *, pid_t *, db_threadid_t*));
*/
void
__os_id(dbenv, pidp, tidp)
DB_ENV *dbenv;
pid_t *pidp;
db_threadid_t *tidp;
{
/*
* We can't depend on dbenv not being NULL, this routine is called
* from places where there's no DB_ENV handle.
*
* We cache the pid in the ENV handle, getting the process ID is a
* fairly slow call on lots of systems.
*/
if (pidp != NULL) {
if (dbenv == NULL) {
#if defined(HAVE_VXWORKS)
*pidp = taskIdSelf();
#else
*pidp = getpid();
#endif
} else
*pidp = dbenv->env->pid_cache;
}
if (tidp != NULL) {
#if defined(DB_WIN32)
*tidp = GetCurrentThreadId();
#elif defined(HAVE_MUTEX_UI_THREADS)
*tidp = thr_self();
#elif defined(HAVE_PTHREAD_SELF)
*tidp = pthread_self();
#else
/*
* Default to just getpid.
*/
*tidp = 0;
#endif
}
}
|
#import "DockSquadImporter.h"
@interface DockSquadImporteriOS : DockSquadImporter
@end
|
#include "config/config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/errno.h>
#include <string.h>
#include "dispatch_test.h"
#define _test_print(_file, _line, _desc, \
_expr, _fmt1, _val1, _fmt2, _val2) do { \
const char* _exprstr = _expr ? "PASS" : "FAIL"; \
char _linestr[BUFSIZ]; \
if (!_expr) { \
snprintf(_linestr, sizeof(_linestr), \
" (%s:%ld)", _file, _line); \
} else { \
_linestr[0] = 0; \
} \
if (_fmt2 == 0) { \
printf("\tValue: " _fmt1 "\n" \
"[%s] %s%s\n", \
_val1, \
_exprstr, \
_desc, \
_linestr); \
} else { \
printf("\tActual: " _fmt1 "\n" \
"\tExpected: " _fmt2 "\n" \
"[%s] %s%s\n", \
_val1, \
_val2, \
_exprstr, \
_desc, \
_linestr); \
} \
if (!_expr) { \
printf("\t%s:%ld\n", _file, _line); \
} \
fflush(stdout); \
} while (0);
void
test_start(const char* desc) {
printf("\n==================================================\n");
printf("[TEST] %s\n", desc);
printf("[PID] %d\n", getpid());
printf("==================================================\n\n");
usleep(100000); // give 'gdb --waitfor=' a chance to find this proc
}
#define test_ptr_null(a,b) _test_ptr_null(__FILE__, __LINE__, a, b)
void
_test_ptr_null(const char* file, long line, const char* desc, const void* ptr) {
_test_print(file, line, desc,
(ptr == NULL), "%p", ptr, "%p", (void*)0);
}
#define test_ptr_notnull(a,b) _test_ptr_notnull(__FILE__, __LINE__, a, b)
void
_test_ptr_notnull(const char* file, long line, const char* desc, const void* ptr) {
_test_print(file, line, desc,
(ptr != NULL), "%p", ptr, "%p", ptr ?: (void*)~0);
}
#define test_ptr(a,b,c) _test_ptr(__FILE__, __LINE__, a, b, c)
void
_test_ptr(const char* file, long line, const char* desc, const void* actual, const void* expected) {
_test_print(file, line, desc,
(actual == expected), "%p", actual, "%p", expected);
}
#define test_long(a,b,c) _test_long(__FILE__, __LINE__, a, b, c)
void
_test_long(const char* file, long line, const char* desc, long actual, long expected) {
_test_print(file, line, desc,
(actual == expected), "%ld", actual, "%ld", expected);
}
#define test_long_less_than(a, b, c) _test_long_less_than(__FILE__, __LINE__, a, b, c)
void
_test_long_less_than(const char* file, long line, const char* desc, long actual, long expected_max) {
_test_print(file, line, desc, (actual < expected_max), "%ld", actual, "<%ld", expected_max);
}
#define test_double_less_than(d, v, m) _test_double_less_than(__FILE__, __LINE__, d, v, m)
void
_test_double_less_than(const char* file, long line, const char* desc, double val, double max_expected) {
_test_print(file, line, desc, (val < max_expected), "%f", val, "<%f", max_expected);
}
#define test_double_less_than_or_equal(d, v, m) _test_double_less_than(__FILE__, __LINE__, d, v, m)
void
_test_double_less_than_or_equal(const char* file, long line, const char* desc, double val, double max_expected) {
_test_print(file, line, desc, (val <= max_expected), "%f", val, "<%f", max_expected);
}
#define test_errno(a,b,c) _test_errno(__FILE__, __LINE__, a, b, c)
void
_test_errno(const char* file, long line, const char* desc, long actual, long expected) {
char* actual_str;
char* expected_str;
asprintf(&actual_str, "%ld\t%s", actual, actual ? strerror(actual) : "");
asprintf(&expected_str, "%ld\t%s", expected, expected ? strerror(expected) : "");
_test_print(file, line, desc,
(actual == expected), "%s", actual_str, "%s", expected_str);
free(actual_str);
free(expected_str);
}
//#include <spawn.h>
extern char **environ;
void
test_stop(void) {
test_stop_after_delay((void *)(intptr_t)0);
}
void
test_stop_after_delay(void *delay) {
#if HAVE_LEAKS
int res;
pid_t pid;
char pidstr[10];
#endif
if (delay != NULL) {
sleep((int)(intptr_t)delay);
}
#if HAVE_LEAKS
if (getenv("NOLEAKS")) _exit(EXIT_SUCCESS);
/* leaks doesn't work against debug variant malloc */
if (getenv("DYLD_IMAGE_SUFFIX")) _exit(EXIT_SUCCESS);
snprintf(pidstr, sizeof(pidstr), "%d", getpid());
char* args[] = { "./leaks-wrapper", pidstr, NULL };
res = posix_spawnp(&pid, args[0], NULL, NULL, args, environ);
if (res == 0 && pid > 0) {
int status;
waitpid(pid, &status, 0);
test_long("Leaks", status, 0);
} else {
perror(args[0]);
}
#endif
_exit(EXIT_SUCCESS);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.