text stringlengths 4 6.14k |
|---|
//
// srecord - manipulate eprom load files
// Copyright (C) 2004, 2006-2008, 2010, 2012 Peter Miller
//
// 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 Lesser General Public License
// along with this program. If not, see
// <http://www.gnu.org/licenses/>.
//
#ifndef SRECORD_OUTPUT_FILE_AOMF_H
#define SRECORD_OUTPUT_FILE_AOMF_H
#include <srecord/output/file.h>
namespace srecord
{
/**
* The srecord::output_file_aomf class is used to represent the output
* state of a file in Intel Absolute Object Module Format (AOMF).
*/
class output_file_aomf:
public output_file
{
public:
/**
* The destructor.
*/
virtual ~output_file_aomf();
private:
/**
* A constructor. The input will be read from the named file
* (or the standard input if the file name is "-").
*
* @param file_name
* The name of the file to be written.
*/
output_file_aomf(const std::string &file_name);
public:
/**
* The create class method is used to create new dynamically
* allocated instances of this class.
*
* @param file_name
* The file name to open to write data to. The name "-" is
* understood to mean the standard output.
*/
static pointer create(const std::string &file_name);
protected:
// See base class for documentation.
void write(const record &);
// See base class for documentation.
bool preferred_block_size_set(int nbytes);
// See base class for documentation.
int preferred_block_size_get(void) const;
// See base class for documentation.
void line_length_set(int);
// See base class for documentation.
void address_length_set(int);
// See base class for documentation.
const char *format_name(void) const;
private:
/**
* The emit_record method is used to emit records in the AOMF format.
* Each has an 8-but type, a 16-bit little-endian length, a payload,
* and an 8-bit 2s complement checksum.
*/
void emit_record(int, const unsigned char *, size_t);
/**
* The module_header_record method is used to write an AOMF Module
* Header Record.
*/
void module_header_record(const char*);
/**
* The content_record method is used to write an AOMF Content Record.
*/
void content_record(unsigned long address, const unsigned char *data,
size_t length);
/**
* The module_header_record method is used to write an AOMF Module
* End Record.
*/
void module_end_record(const char*);
/**
* See base class for documentation. We are over-riding it
* because we use raw binary, so we call the #put_char method.
* This method also tracks the byte_offset, so that we can
* align to specific boundaries. Calls the #checksum_add method.
*/
void put_byte(unsigned char);
/**
* The byte_offset instance variable is used to track the location
* in the output file. Maintained by the #put_byte method.
*/
unsigned long byte_offset;
/**
* The module_name instance variable is used to remember the
* information form the Module Header Record for reproduction in
* the Module End Record (they are required to agree).
*/
std::string module_name;
/**
* The copy constructor. Do not use.
*/
output_file_aomf(const output_file_aomf &);
/**
* The assignment operator. Do not use.
*/
output_file_aomf &operator=(const output_file_aomf &);
};
};
// vim: set ts=8 sw=4 et :
#endif // SRECORD_OUTPUT_FILE_AOMF_H
|
/*
IBEX UK LTD http://www.ibexuk.com
Electronic Product Design Specialists
RELEASED SOFTWARE
The MIT License (MIT)
Copyright (c) 2013, IBEX UK Ltd, http://ibexuk.com
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.
*/
//Project Name: FAT FILING SYSTEM FAT16 & FAT 32 DRIVER
//NXP LPC2365 SAMPLE PROJECT C CODE HEADER FILE
//*****************************
//*****************************
//********** DEFINES **********
//*****************************
//*****************************
#ifndef MAIN_C_INIT //(Include this section only once for each source file that includes this header file)
#define MAIN_C_INIT
//------------------------
//----- USER DEFINES -----
//------------------------
//----------------------
//----- IO DEFINES -----
//----------------------
#define LED1(state) (state ? (FIO2CLR = 0x00000004) : (FIO2SET = 0x00000004))
#define LED2(state) (state ? (FIO2CLR = 0x00000008) : (FIO2SET = 0x00000008))
//--------------------------
//----- SWITCH DEFINES -----
//--------------------------
#define SWITCH_1_PRESSED switches_debounced & 0x01
#define SWITCH_1_NEW_PRESS switches_new & 0x01
typedef enum _TEST_APPLICATION_STATE
{
TA_PROCESS_WAIT_FOR_CARD,
TA_PROCESS_CARD_INSERTED,
TA_PROCESS_DELETE_AND_CREATE_FILES,
TA_PROCESS_CARD_OPERTATION_DONE,
TA_PROCESS_ERROR
} TEST_APPLICATION_STATE;
#endif
//*******************************
//*******************************
//********** FUNCTIONS **********
//*******************************
//*******************************
#ifdef MAIN_C
//-----------------------------------
//----- INTERNAL ONLY FUNCTIONS -----
//-----------------------------------
void initialise (void);
void read_switches (void);
void process_mode (void);
void timer0_irq_handler (void);
//-----------------------------------------
//----- INTERNAL & EXTERNAL FUNCTIONS -----
//-----------------------------------------
//(Also defined below as extern)
#else
//------------------------------
//----- EXTERNAL FUNCTIONS -----
//------------------------------
#endif
//****************************
//****************************
//********** MEMORY **********
//****************************
//****************************
#ifdef MAIN_C
//--------------------------------------------
//----- INTERNAL ONLY MEMORY DEFINITIONS -----
//--------------------------------------------
BYTE read_switches_flag;
WORD user_mode_10ms_timer;
BYTE test_application_state = TA_PROCESS_WAIT_FOR_CARD;
//--------------------------------------------------
//----- INTERNAL & EXTERNAL MEMORY DEFINITIONS -----
//--------------------------------------------------
//(Also defined below as extern)
BYTE switches_debounced = 0;
BYTE switches_new = 0;
WORD general_use_10ms_timer;
WORD general_use_100ms_timer;
#else
//---------------------------------------
//----- EXTERNAL MEMORY DEFINITIONS -----
//---------------------------------------
extern BYTE switches_debounced;
extern BYTE switches_new;
extern WORD general_use_10ms_timer;
extern WORD general_use_100ms_timer;
#endif
|
/*
* Copyright (C) 2013 Andreas Steffen
* HSR 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.
*/
/**
*
* @defgroup imv_database_t imv_database
* @{ @ingroup libimcv_imv
*/
#ifndef IMV_DATABASE_H_
#define IMV_DATABASE_H_
#include "imv_session.h"
#include "imv_workitem.h"
#include <tncifimv.h>
#include <library.h>
typedef struct imv_database_t imv_database_t;
/**
* IMV database interface
*/
struct imv_database_t {
/**
* Create or get a session associated with a TNCCS connection
*
* @param conn_id TNCCS Connection ID
* @param ar_id_type Access Requestor identity type
* @param ar_id_value Access Requestor identity value
* @return Session associated with TNCCS Connection
*/
imv_session_t* (*add_session)(imv_database_t *this,
TNC_ConnectionID conn_id,
uint32_t ar_id_type, chunk_t ar_id_value);
/**
* Remove and delete a session
*
* @param session Session
*/
void (*remove_session)(imv_database_t *this, imv_session_t *session);
/**
* Add final recommendation to a session database entry
*
* @param session Session
* @param rec Final recommendation
*/
void (*add_recommendation)(imv_database_t *this, imv_session_t *session,
TNC_IMV_Action_Recommendation rec);
/**
* Announce session start/stop to policy script
*
* @param session Session
* @param start TRUE if session start, FALSE if session stop
* @return TRUE if command successful, FALSE otherwise
*/
bool (*policy_script)(imv_database_t *this, imv_session_t *session,
bool start);
/**
* Finalize a workitem
*
* @param workitem Workitem to be finalized
*/
bool (*finalize_workitem)(imv_database_t *this, imv_workitem_t *workitem);
/**
* Get database handle
*
* @return Database handle
*/
database_t* (*get_database)(imv_database_t *this);
/**
* Destroys an imv_database_t object
*/
void (*destroy)(imv_database_t *this);
};
/**
* Create an imv_database_t instance
*
* @param uri Database uri
* @param script Policy Manager script
*/
imv_database_t* imv_database_create(char *uri, char *script);
#endif /** IMV_DATABASE_H_ @}*/
|
/* linux/include/asm/arch/gnand/GNAND_config.h
*
* Copyright (c) 2008 Nuvoton technology corporation
* All rights reserved.
*
* 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.
*
* Changelog:
*
* 2008/08/19 jcao add this file for nuvoton all nand driver.
*/
#ifndef _GNAND_CONFIG_H_
#define _GNAND_CONFIG_H_
#define W90P910
#ifdef W90P910
#define NON_CACHE_BIT 0x80000000
#endif
#ifdef W90P710
#define NON_CACHE_BIT 0x80000000
#endif
#ifdef W99702
#define NON_CACHE_BIT 0x10000000
#endif
#define OP_THRESHOLD 256 /* maximum number of operation history */
#define OP_CMD_LEN 32
#define L2PN_RESERVED 8
#define GNAND_GET16_L(bptr,n) (bptr[n] | (bptr[n+1] << 8))
#define GNAND_GET32_L(bptr,n) (bptr[n] | (bptr[n+1] << 8) | (bptr[n+2] << 16) | (bptr[n+3] << 24))
#define GNAND_PUT16_L(bptr,n,val) bptr[n] = val & 0xFF; \
bptr[n+1] = (val >> 8) & 0xFF;
#define GNAND_PUT32_L(bptr,n,val) bptr[n] = val & 0xFF; \
bptr[n+1] = (val >> 8) & 0xFF; \
bptr[n+2] = (val >> 16) & 0xFF; \
bptr[n+3] = (val >> 24) & 0xFF;
#define GNAND_GET16_B(bptr,n) ((bptr[n]) << 8 | bptr[n+1])
#define GNAND_GET32_B(bptr,n) ((bptr[n] << 24) | (bptr[n+1] << 16) | (bptr[n+2] << 8) | bptr[n+3])
#define GNAND_PUT16_B(bptr,n,val) bptr[n+1] = val & 0xFF; \
bptr[n] = (val >> 8) & 0xFF;
#define GNAND_PUT32_B(bptr,n,val) bptr[n+3] = val & 0xFF; \
bptr[n+2] = (val >> 8) & 0xFF; \
bptr[n+1] = (val >> 16) & 0xFF; \
bptr[n] = (val >> 24) & 0xFF;
#define GNAND_min(x,y) (((x) < (y)) ? (x) : (y))
#define GNAND_MIN(x,y) (((x) < (y)) ? (x) : (y))
#define GNAND_max(x,y) (((x) > (y)) ? (x) : (y))
#define GNAND_MAX(x,y) (((x) > (y)) ? (x) : (y))
#endif /* _GNAND_CONFIG_H_ */
|
/*!
* \file fir_filter.h
* \brief Adapts a gnuradio gr_fir_filter designed with pm_remez
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR 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.
*
* GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_FIR_FILTER_H_
#define GNSS_SDR_FIR_FILTER_H_
#include <cmath>
#include <string>
#include <vector>
#include <gnuradio/gr_complex.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/blocks/float_to_char.h>
#include <gnuradio/blocks/float_to_complex.h>
#include <gnuradio/blocks/float_to_short.h>
#include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/filter/fir_filter_fff.h>
#include "gnss_block_interface.h"
#include "complex_byte_to_float_x2.h"
#include "byte_x2_to_complex_byte.h"
#include "short_x2_to_cshort.h"
#include "cshort_to_float_x2.h"
class ConfigurationInterface;
/*!
* \brief This class adapts a GNU Radio gr_fir_filter designed with pm_remez
*
* See Parks-McClellan FIR filter design, http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm
* Calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response
* given a set of band edges, the desired response on those bands, and the weight given
* to the error in those bands.
*/
class FirFilter: public GNSSBlockInterface
{
public:
//! Constructor
FirFilter(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams);
//! Destructor
virtual ~FirFilter();
std::string role()
{
return role_;
}
//! Returns "Fir_Filter"
std::string implementation()
{
return "Fir_Filter";
}
size_t item_size()
{
return 0;
}
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
gr::filter::fir_filter_ccf::sptr fir_filter_ccf_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string taps_item_type_;
std::vector <float> taps_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
void init();
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_1_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_2_;
gr::blocks::float_to_char::sptr float_to_char_1_;
gr::blocks::float_to_char::sptr float_to_char_2_;
byte_x2_to_complex_byte_sptr char_x2_cbyte_;
gr::blocks::float_to_complex::sptr float_to_complex_;
cshort_to_float_x2_sptr cshort_to_float_x2_;
gr::blocks::float_to_short::sptr float_to_short_1_;
gr::blocks::float_to_short::sptr float_to_short_2_;
short_x2_to_cshort_sptr short_x2_to_cshort_;
};
#endif
|
/*
* hotp.h - library internal function prototypes
* Copyright (C) 2013-2015 Simon Josefsson
*
* 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
*
*/
#ifndef HOTP_H
#define HOTP_H
extern int
_oath_hotp_generate2 (const char *secret,
size_t secret_length,
uint64_t moving_factor,
unsigned digits,
bool add_checksum,
size_t truncation_offset, int flags, int32_t *output_otp);
#endif /* HOTP_H */
|
/* read-file.c -- read file contents into a string
Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
Written by Simon Josefsson and Bruno Haible.
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, 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 <config.h>
#include "read-file.h"
/* Get fstat. */
#include <sys/stat.h>
/* Get ftello. */
#include <stdio.h>
/* Get SIZE_MAX. */
#include <stdint.h>
/* Get malloc, realloc, free. */
#include <stdlib.h>
/* Get errno. */
#include <errno.h>
/* Read a STREAM and return a newly allocated string with the content,
and set *LENGTH to the length of the string. The string is
zero-terminated, but the terminating zero byte is not counted in
*LENGTH. On errors, *LENGTH is undefined, errno preserves the
values set by system functions (if any), and NULL is returned. */
char *
fread_file (FILE *stream, size_t *length)
{
char *buf = NULL;
size_t alloc = BUFSIZ;
/* For a regular file, allocate a buffer that has exactly the right
size. This avoids the need to do dynamic reallocations later. */
{
struct stat st;
if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode))
{
off_t pos = ftello (stream);
if (pos >= 0 && pos < st.st_size)
{
off_t alloc_off = st.st_size - pos;
/* '1' below, accounts for the trailing NUL. */
if (SIZE_MAX - 1 < alloc_off)
{
errno = ENOMEM;
return NULL;
}
alloc = alloc_off + 1;
}
}
}
if (!(buf = malloc (alloc)))
return NULL; /* errno is ENOMEM. */
{
size_t size = 0; /* number of bytes read so far */
int save_errno;
for (;;)
{
/* This reads 1 more than the size of a regular file
so that we get eof immediately. */
size_t requested = alloc - size;
size_t count = fread (buf + size, 1, requested, stream);
size += count;
if (count != requested)
{
save_errno = errno;
if (ferror (stream))
break;
/* Shrink the allocated memory if possible. */
if (size < alloc - 1)
{
char *smaller_buf = realloc (buf, size + 1);
if (smaller_buf != NULL)
buf = smaller_buf;
}
buf[size] = '\0';
*length = size;
return buf;
}
{
char *new_buf;
if (alloc == SIZE_MAX)
{
save_errno = ENOMEM;
break;
}
if (alloc < SIZE_MAX - alloc / 2)
alloc = alloc + alloc / 2;
else
alloc = SIZE_MAX;
if (!(new_buf = realloc (buf, alloc)))
{
save_errno = errno;
break;
}
buf = new_buf;
}
}
free (buf);
errno = save_errno;
return NULL;
}
}
static char *
internal_read_file (const char *filename, size_t *length, const char *mode)
{
FILE *stream = fopen (filename, mode);
char *out;
int save_errno;
if (!stream)
return NULL;
out = fread_file (stream, length);
save_errno = errno;
if (fclose (stream) != 0)
{
if (out)
{
save_errno = errno;
free (out);
}
errno = save_errno;
return NULL;
}
return out;
}
/* Open and read the contents of FILENAME, and return a newly
allocated string with the content, and set *LENGTH to the length of
the string. The string is zero-terminated, but the terminating
zero byte is not counted in *LENGTH. On errors, *LENGTH is
undefined, errno preserves the values set by system functions (if
any), and NULL is returned. */
char *
read_file (const char *filename, size_t *length)
{
return internal_read_file (filename, length, "r");
}
/* Open (on non-POSIX systems, in binary mode) and read the contents
of FILENAME, and return a newly allocated string with the content,
and set LENGTH to the length of the string. The string is
zero-terminated, but the terminating zero byte is not counted in
the LENGTH variable. On errors, *LENGTH is undefined, errno
preserves the values set by system functions (if any), and NULL is
returned. */
char *
read_binary_file (const char *filename, size_t *length)
{
return internal_read_file (filename, length, "rb");
}
|
#ifndef INCLUDED_volk_8ic_deinterleave_real_16i_a16_H
#define INCLUDED_volk_8ic_deinterleave_real_16i_a16_H
#include <inttypes.h>
#include <stdio.h>
#if LV_HAVE_SSE4_1
#include <smmintrin.h>
/*!
\brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
\param complexVector The complex input vector
\param iBuffer The I buffer output data
\param num_points The number of complex data values to be deinterleaved
*/
static inline void volk_8ic_deinterleave_real_16i_a16_sse4_1(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
unsigned int number = 0;
const int8_t* complexVectorPtr = (int8_t*)complexVector;
int16_t* iBufferPtr = iBuffer;
__m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
__m128i complexVal, outputVal;
unsigned int eighthPoints = num_points / 8;
for(number = 0; number < eighthPoints; number++){
complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
complexVal = _mm_shuffle_epi8(complexVal, moveMask);
outputVal = _mm_cvtepi8_epi16(complexVal);
outputVal = _mm_slli_epi16(outputVal, 7);
_mm_store_si128((__m128i*)iBufferPtr, outputVal);
iBufferPtr += 8;
}
number = eighthPoints * 8;
for(; number < num_points; number++){
*iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 128;
complexVectorPtr++;
}
}
#endif /* LV_HAVE_SSE4_1 */
#if LV_HAVE_GENERIC
/*!
\brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
\param complexVector The complex input vector
\param iBuffer The I buffer output data
\param num_points The number of complex data values to be deinterleaved
*/
static inline void volk_8ic_deinterleave_real_16i_a16_generic(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
unsigned int number = 0;
const int8_t* complexVectorPtr = (const int8_t*)complexVector;
int16_t* iBufferPtr = iBuffer;
for(number = 0; number < num_points; number++){
*iBufferPtr++ = ((int16_t)(*complexVectorPtr++)) * 128;
complexVectorPtr++;
}
}
#endif /* LV_HAVE_GENERIC */
#endif /* INCLUDED_volk_8ic_deinterleave_real_16i_a16_H */
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-cen-xr-w32-bld/build/security/manager/ssl/public/nsISMimeCert.idl
*/
#ifndef __gen_nsISMimeCert_h__
#define __gen_nsISMimeCert_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.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: nsISMimeCert */
#define NS_ISMIMECERT_IID_STR "66710f97-a4dd-49f1-a906-fe0ebc5924c0"
#define NS_ISMIMECERT_IID \
{0x66710f97, 0xa4dd, 0x49f1, \
{ 0xa9, 0x06, 0xfe, 0x0e, 0xbc, 0x59, 0x24, 0xc0 }}
class NS_NO_VTABLE NS_SCRIPTABLE nsISMimeCert : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISMIMECERT_IID)
/* void saveSMimeProfile (); */
NS_SCRIPTABLE NS_IMETHOD SaveSMimeProfile(void) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISMimeCert, NS_ISMIMECERT_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISMIMECERT \
NS_SCRIPTABLE NS_IMETHOD SaveSMimeProfile(void);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISMIMECERT(_to) \
NS_SCRIPTABLE NS_IMETHOD SaveSMimeProfile(void) { return _to SaveSMimeProfile(); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSISMIMECERT(_to) \
NS_SCRIPTABLE NS_IMETHOD SaveSMimeProfile(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->SaveSMimeProfile(); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsSMimeCert : public nsISMimeCert
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISMIMECERT
nsSMimeCert();
private:
~nsSMimeCert();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsSMimeCert, nsISMimeCert)
nsSMimeCert::nsSMimeCert()
{
/* member initializers and constructor code */
}
nsSMimeCert::~nsSMimeCert()
{
/* destructor code */
}
/* void saveSMimeProfile (); */
NS_IMETHODIMP nsSMimeCert::SaveSMimeProfile()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsISMimeCert_h__ */
|
//# MWIos.h: IO stream to a unique file
//#
//# Copyright (C) 2005
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@astron.nl
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# MWIos.h:
//#
//# Copyright (C) 2007
//# ASTRON (Netherlands Institute for Radio Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
//#
//# This file is part of the LOFAR software suite.
//# The LOFAR software suite 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.
//#
//# The LOFAR software suite is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License along
//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
//#
//# $Id$
#ifndef LOFAR_LMWCOMMON_MWIOSTREAM_H
#define LOFAR_LMWCOMMON_MWIOSTREAM_H
// @file
// @brief IO stream to a unique file
// @author Ger van Diepen (diepen AT astron nl)
#include <iostream>
#include <fstream>
#include <string>
#define MWCOUT MWIos::os()
namespace LOFAR { namespace CEP {
// @ingroup LMWCommon
// @brief IO stream to a unique file
// MPI has the problem that the output of cout is unpredictable.
// Therefore the output of tMWControl is using a separate output
// file for each rank.
// This class makes this possible. The alias MWCOUT can be used for it.
//
// Note that everything is static, so no destructor is called.
// The clear function can be called at the end of the program to
// delete the internal object, otherwise tools like valgrind will
// complain about a memory leak.
class MWIos
{
public:
// Define the name of the output file.
static void setName (const std::string& name)
{ itsName = name; }
// Get access to its ostream.
// It creates the ostream if not done yet.
static std::ofstream& os()
{ if (!itsIos) makeIos(); return *itsIos; }
// Remove the ostream (otherwise there'll be a memory leak).
static void clear()
{ delete itsIos; }
private:
// Make the ostream if not done yet.
static void makeIos();
static std::string itsName;
static std::ofstream* itsIos;
};
}} //# end namespaces
#endif
|
// ***********************************************************************
// * License and Disclaimer *
// * *
// * Copyright 2016 Simone Riggi *
// * *
// * This file is part of Caesar. *
// * Caesar 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. *
// * Caesar 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 *
// * Caesar. If not, see http://www.gnu.org/licenses/. *
// ***********************************************************************
/**
* @file FITSWriter.h
* @class FITSWriter
* @brief FITSWriter
*
* Image writer class for FITS files
* @author S. Riggi
* @date 20/01/2015
*/
#ifndef _FITS_WRITER_h
#define _FITS_WRITER_h 1
#include <TObject.h>
//CFITSIO headers
#include <fitsio.h>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <string>
#include <stdexcept>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
namespace Caesar {
class Image;
class ImgMetaData;
class FITSWriter : public TObject {
public:
/**
\brief Class constructor: initialize structures.
*/
FITSWriter();
/**
* \brief Class destructor: free allocated memory
*/
virtual ~FITSWriter();
public:
/**
* \brief Write image to FITS file
*/
static int WriteFITS(Image* img,std::string outfilename,bool recreate=true);
private:
/**
* \brief Initialize python interface
*/
//static int Init();
/**
* \brief Writing metadata keywords
*/
static int WriteFITSKeywords(Image* img,fitsfile* fp);
/**
* \brief Handle error in FITS operations
*/
static void HandleError(int& status,fitsfile* fp);
private:
ClassDef(FITSWriter,1)
};
#ifdef __MAKECINT__
#pragma link C++ class FITSWriter+;
#endif
}//close namespace
#endif
|
#include "ceptr.h"
Signal *signal_new(Receptor *r,Address from, Address to,Symbol noun,void *surface){
return _signal_new(from,to,time(NULL),noun,surface,size_of_named_surface(r,noun,surface));
}
void receptor_free(Receptor *r) {
_data_free(&r->data);
stack_free(r);
}
|
/*
* SPDX-FileCopyrightText: (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* SPDX-License-Identifier: BSD-1-Clause
* Generated by asn1c-0.9.22 (http://lionet.info/asn1c)
* From ASN.1 module "RRLP-Components"
* found in "../rrlp-components.asn"
*/
#ifndef _GANSSAlmanacModel_H
#define _GANSSAlmanacModel_H
#include <asn_application.h>
/* Including external dependencies */
#include "SVIDMASK.h"
#include "SeqOfGANSSAlmanacElement.h"
#include <NativeInteger.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* GANSSAlmanacModel */
typedef struct GANSSAlmanacModel
{
long weekNumber;
SVIDMASK_t svIDMask;
long *toa /* OPTIONAL */;
long *ioda /* OPTIONAL */;
SeqOfGANSSAlmanacElement_t ganssAlmanacList;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} GANSSAlmanacModel_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacModel;
#ifdef __cplusplus
}
#endif
#endif /* _GANSSAlmanacModel_H_ */
#include <asn_internal.h>
|
/*
* 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 <vector>
namespace caspar { namespace core {
enum class pixel_format
{
gray = 0,
bgra,
rgba,
argb,
abgr,
ycbcr,
ycbcra,
luma,
bgr,
rgb,
count,
invalid,
};
struct pixel_format_desc final
{
struct plane
{
int linesize = 0;
int width = 0;
int height = 0;
int size = 0;
int stride = 0;
plane() = default;
plane(int width, int height, int stride)
: linesize(width * stride)
, width(width)
, height(height)
, size(width * height * stride)
, stride(stride)
{
}
};
pixel_format_desc() = default;
pixel_format_desc(pixel_format format)
: format(format)
{
}
pixel_format format = pixel_format::invalid;
std::vector<plane> planes;
};
}} // namespace caspar::core |
#ifndef EXP_H
#define EXP_H
#include <string>
class Node;
class ExpItem;
class Type;
class Lval;
#include "node.h"
#include "expitem.h"
#include "type.h"
#include "lval.h"
class Exp : public Node {
public:
std::string _dotFormat();
enum Var {ICONST_T, STRLIT_T, CHRLIT_T, BOLLIT_T, NULL_T, ID_T, UNOP_T, BINOP_T, IFLINE_T, FCALL_T, DOT_T, ACC_T, SUBSC_T, ALLOC_T, ALLOCARRAY_T, LVAL_T} v;
Exp(Var v, std::string s); //icsont, strlit, charlit, bollit, null, id
Exp(Var v, std::string s, Exp * exp); //unop
Exp(Var v, Exp * l, std::string s, Exp * r); //binop
Exp(Var v, Exp * cond, Exp * t, Exp * f); //ifline
Exp(Var v, std::string func, ExpItem * args); //fcall
Exp(Var v, Exp * exp, std::string field); //acc / dot
Exp(Var v, Exp * exp, Exp * subs); //subs
Exp(Var v, Type * t); //alloc
Exp(Var v, Type * t, Exp * exp); //alloc_array
Exp(Var v, Lval * l); //lval
std::string id;
std::string fid;
Exp * l;
Exp * m;
Exp * r;
ExpItem * args;
Type * t;
Lval * lval;
};
#endif
|
/**
@author Contributions from the community; see CONTRIBUTORS.md
@date 2005-2016
@copyright MPL2; see LICENSE.txt
*/
#import "DKRastGroup.h"
/** @brief Captures the output of its contained renderers in an image
This class implements a special rendergroup that captures the output of its contained renderers in an image, then
allows that image to be manipulated or processed (e.g. by core image) before rendering it back to the drawing. This
allows us to leverage all sorts of imaging code to extend the range of available styles and effects.
*/
@interface DKCIFilterRastGroup : DKRastGroup <NSCoding, NSCopying> {
NSString* m_filter;
NSDictionary* m_arguments;
NSImage* m_cache;
}
+ (DKCIFilterRastGroup*)effectGroupWithFilter:(NSString*)filter;
- (void)setFilter:(NSString*)filter;
- (NSString*)filter;
- (void)setArguments:(NSDictionary*)dict;
- (NSDictionary*)arguments;
- (void)invalidateCache;
@end
@interface NSImage (CoreImage)
/** @brief Draws the specified image using Core Image. */
- (void)drawAtPoint:(NSPoint)point fromRect:(NSRect)fromRect coreImageFilter:(NSString*)filterName arguments:(NSDictionary*)arguments;
/** @brief Gets a bitmap representation of the image, or creates one if the image does not have any. */
- (NSBitmapImageRep*)bitmapImageRepresentation;
@end
#define CIIMAGE_PADDING 32.0f
@interface NSBitmapImageRep (CoreImage)
/** @brief Draws the specified image representation using Core Image. */
- (void)drawAtPoint:(NSPoint)point fromRect:(NSRect)fromRect coreImageFilter:(NSString*)filterName arguments:(NSDictionary*)arguments;
@end
|
/*
* Copyright (C) 2011-2012 DarkCore <http://www.darkpeninsula.eu/>
* Copyright (C) 2011-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.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/>.
*/
#ifndef __BATTLEGROUNDRB_H
#define __BATTLEGROUNDRB_H
class Battleground;
class BattlegroundRBScore : public BattlegroundScore
{
public:
BattlegroundRBScore() {};
virtual ~BattlegroundRBScore() {};
};
class BattlegroundRB : public Battleground
{
public:
BattlegroundRB();
~BattlegroundRB();
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
private:
};
#endif
|
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: ue_phy.h
*
* Description: Top-level class wrapper for PHY layer.
*
* Reference:
*****************************************************************************/
#include "srslte/srslte.h"
#include "srslte/utils/queue.h"
#ifndef UEPHY_H
#define UEPHY_H
#define SYNC_MODE_CV 0
#define SYNC_MODE_CALLBACK 1
#define SYNC_MODE SYNC_MODE_CV
namespace srslte {
typedef _Complex float cf_t;
class ue_phy
{
public:
typedef enum {DOWNLINK, UPLINK} direction_t;
typedef enum {
PDCCH_UL_SEARCH_CRNTI = 0,
PDCCH_UL_SEARCH_RA_PROC,
PDCCH_UL_SEARCH_SPS,
PDCCH_UL_SEARCH_TEMPORAL,
PDCCH_UL_SEARCH_TPC_PUSCH,
PDCCH_UL_SEARCH_TPC_PUCCH
} pdcch_ul_search_t;
typedef enum {
PDCCH_DL_SEARCH_CRNTI = 0,
PDCCH_DL_SEARCH_SIRNTI,
PDCCH_DL_SEARCH_PRNTI,
PDCCH_DL_SEARCH_RARNTI,
PDCCH_DL_SEARCH_TEMPORAL,
PDCCH_DL_SEARCH_SPS
} pdcch_dl_search_t;
/* Uplink/Downlink scheduling grant generated by a successfully decoded PDCCH */
class sched_grant {
public:
uint16_t get_rnti();
uint32_t get_rv();
void set_rv(uint32_t rv);
bool get_ndi();
bool get_cqi_request();
uint32_t get_harq_process();
private:
union {
srslte_ra_ul_dci_t ul_grant;
srslte_ra_dl_dci_t dl_grant;
};
direction_t dir;
};
/* Uplink scheduling assignment. The MAC instructs the PHY to prepare an UL packet (PUSCH or PUCCH)
* for transmission. The MAC must call generate_pusch() to set the packet ready for transmission
*/
class ul_buffer : public queue::element {
public:
ul_buffer(srslte_cell_t cell);
void generate_pusch(sched_grant pusch_grant, uint8_t *payload, srslte_uci_data_t uci_data);
void generate_pucch(srslte_uci_data_t uci_data);
private:
srslte_ue_ul_t ue_ul;
bool signal_generated = false;
cf_t* signal_buffer = NULL;
uint32_t tti = 0;
};
/* Class for the processing of Downlink buffers. The MAC obtains a buffer for a given TTI and then
* gets ul/dl scheduling grants and/or processes phich/pdsch channels
*/
class dl_buffer : public queue::element {
public:
dl_buffer(srslte_cell_t cell);
sched_grant get_ul_grant(pdcch_ul_search_t mode, uint32_t rnti);
sched_grant get_dl_grant(pdcch_dl_search_t mode, uint32_t rnti);
bool decode_phich(sched_grant pusch_grant);
bool decode_pdsch(sched_grant pdsch_grant, uint8_t *payload); // returns true or false for CRC OK/KO
private:
srslte_ue_dl_t ue_dl;
srslte_phich_t phich;
cf_t *signal_buffer = NULL;
bool sf_symbols_and_ce_done = false;
bool pdcch_llr_extracted = false;
uint32_t tti = 0;
};
#if SYNC_MODE==SYNC_MODE_CALLBACK
typedef (*ue_phy_tti_clock_fcn_t) (void);
ue_phy(ue_phy_tti_clock_fcn_t tti_clock_callback);
#else
ue_phy();
#endif
~ue_phy();
void measure(); // TBD
void dl_bch();
void start_rxtx();
void stop_rxtx();
void init_prach();
void send_prach(/* prach_cfg_t in prach.h with power, seq idx, etc */);
void set_param();
uint32_t get_tti();
#if SYNC_MODE==SYNC_MODE_CV
std::condition_variable tti_cv;
std::mutex tti_mutex;
#endif
ul_buffer get_ul_buffer(uint32_t tti);
dl_buffer get_dl_buffer(uint32_t tti);
private:
enum {
IDLE, MEASURE, RX_BCH, RXTX
} phy_state;
bool prach_initiated = false;
bool prach_ready_to_send = false;
srslte_prach_t prach;
queue ul_buffer_queue;
queue dl_buffer_queue;
pthread_t radio_thread;
void *radio_handler;
};
}
#endif
|
/*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of MayaDataModel.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __MayaDM_NONLINEAR_H__
#define __MayaDM_NONLINEAR_H__
#include "MayaDMTypes.h"
#include "MayaDMConnectables.h"
#include "MayaDMGeometryFilter.h"
namespace MayaDM
{
class NonLinear : public GeometryFilter
{
public:
public:
NonLinear():GeometryFilter(){}
NonLinear(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
:GeometryFilter(file, name, parent, "nonLinear", shared, create){}
virtual ~NonLinear(){}
void setMatrix(const matrix& ma)
{
if(ma == identity) return;
fprintf(mFile,"\tsetAttr \".ma\" -type \"matrix\" ");
ma.write(mFile);
fprintf(mFile,";\n");
}
void getDeformerData()const
{
fprintf(mFile,"\"%s.dd\"",mName.c_str());
}
void getMatrix()const
{
fprintf(mFile,"\"%s.ma\"",mName.c_str());
}
protected:
NonLinear(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
:GeometryFilter(file, name, parent, nodeType, shared, create) {}
};
}//namespace MayaDM
#endif//__MayaDM_NONLINEAR_H__
|
/****************************************************************************
**
** 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 QDESKTOPSERVICES_H
#define QDESKTOPSERVICES_H
#include <QtCore/qstring.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_DESKTOPSERVICES
class QStringList;
class QUrl;
class QObject;
class Q_GUI_EXPORT QDesktopServices
{
public:
static bool openUrl(const QUrl &url);
static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method);
static void unsetUrlHandler(const QString &scheme);
enum StandardLocation {
DesktopLocation,
DocumentsLocation,
FontsLocation,
ApplicationsLocation,
MusicLocation,
MoviesLocation,
PicturesLocation,
TempLocation,
HomeLocation,
DataLocation,
CacheLocation
};
static QString storageLocation(StandardLocation type);
static QString displayName(StandardLocation type);
};
#endif // QT_NO_DESKTOPSERVICES
QT_END_NAMESPACE
QT_END_HEADER
#endif // QDESKTOPSERVICES_H
|
#include "../../src/multimedia/controls/qmetadatawritercontrol.h"
|
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
/* SIPX_USE_NATIVE_PTHREADS define enable use of standard pthread implementation
* of synchonization primitives instead of sipX re-implementation of them. This
* re-implementation was created to work around the fact that the LinuxThreads
* implementation of pthreads did not have a timed version of semaphore wait
* (sem_timedwait()). These days NPTL is widely adopted, thus solving this
* problem more efficiently. So, if you're not forced to use a pthreads
* implementation without sem_timedwait() (e.g. on OS X) it is better to
* define SIPX_USE_NATIVE_PTHREADS.
* See the original comment about the sipX implementation below #else.
*/
#ifndef _PT_MUTEX_H
#define _PT_MUTEX_H
#if !defined(__APPLE__) && !defined(ANDROID)
/* Also see pt_csem.h */
#define SIPX_USE_NATIVE_PTHREADS
//#undef SIPX_USE_NATIVE_PTHREADS
#endif
#include <pthread.h>
#ifdef SIPX_USE_NATIVE_PTHREADS // [
#define pt_mutex_t pthread_mutex_t
#if defined(__linux__) && !defined(PTHREAD_MUTEX_RECURSIVE)
# define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
#endif
//#define pt_mutex_init(mutex) pthread_mutex_init((mutex), NULL)
static inline int pt_mutex_init(pthread_mutex_t *mutex)
{
pthread_mutexattr_t a;
pthread_mutexattr_init(&a);
pthread_mutexattr_settype(&a,PTHREAD_MUTEX_RECURSIVE);
return pthread_mutex_init(mutex, &a);
}
#define pt_mutex_lock(mutex) pthread_mutex_lock((mutex))
#define pt_mutex_timedlock(mutex, timeout) pthread_mutex_timedlock((mutex), (timeout))
#define pt_mutex_trylock(mutex) pthread_mutex_trylock((mutex))
#define pt_mutex_unlock(mutex) pthread_mutex_unlock((mutex))
#define pt_mutex_destroy(mutex) pthread_mutex_destroy((mutex))
#else // SIPX_USE_NATIVE_PTHREADS ][
/* The default LinuxThreads implementation does not have support for timing
* out while waiting for a synchronization object. Since I've already ported
* the rest of the OS dependent files to that interface, we can just drop in a
* mostly-compatible replacement written in C (like pthreads itself) that uses
* the pthread_cond_timedwait function and a mutex to build all the other
* synchronization objecs with timeout capabilities. */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pt_mutex {
unsigned int count;
pthread_t thread;
pthread_mutex_t mutex;
pthread_cond_t cond;
} pt_mutex_t;
void dumpPtMutex(pt_mutex_t* mutex);
int pt_mutex_init(pt_mutex_t *mutex);
int pt_mutex_lock(pt_mutex_t *mutex);
int pt_mutex_timedlock(pt_mutex_t *mutex,const struct timespec *timeout);
int pt_mutex_trylock(pt_mutex_t *mutex);
int pt_mutex_unlock(pt_mutex_t *mutex);
int pt_mutex_destroy(pt_mutex_t *mutex);
#ifdef __cplusplus
}
#endif
#endif // SIPX_USE_NATIVE_PTHREADS ]
#endif /* _PT_MUTEX_H */
|
/*
* Copyright (c) 2011 Citrix Systems, Inc.
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <logging.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include "backtrace.h"
typedef struct _xc_log_buffer {
int level;
char *name;
} xc_log_buffer;
/* Only 0-7 loglevels are supported. Others
* should be one of these initial 8 loglevels */
static const xc_log_buffer xc_log_strings[] = {
[XC_LOG_EMERG].level=LOG_EMERG, [XC_LOG_EMERG].name="Emergency",
[XC_LOG_ALERT].level=LOG_ALERT, [XC_LOG_ALERT].name="Alert",
[XC_LOG_CRIT].level=LOG_CRIT, [XC_LOG_CRIT].name="Critical",
[XC_LOG_ERR].level=LOG_ERR, [XC_LOG_ERR].name="Error",
[XC_LOG_WARNING].level=LOG_WARNING, [XC_LOG_WARNING].name="Warning",
[XC_LOG_NOTICE].level=LOG_NOTICE, [XC_LOG_NOTICE].name="Notice",
[XC_LOG_INFO].level=LOG_INFO, [XC_LOG_INFO].name="Info",
[XC_LOG_DEBUG].level=LOG_DEBUG, [XC_LOG_DEBUG].name="Debug",
[XC_LOG_FATAL].level=LOG_ERR, [XC_LOG_FATAL].name="Fatal",
[XC_LOG_SENTINAL].level=-1, [XC_LOG_SENTINAL].name=NULL
};
void
xc_log_init (const char* prefix)
{
int extra_opts = 0;
if (isatty(STDERR_FILENO))
extra_opts = LOG_PERROR;
openlog(prefix, LOG_CONS | LOG_NOWAIT | extra_opts | LOG_PID, \
LOG_USER);
}
int
xc_log_set_mask (int mask)
{
return setlogmask(mask);
}
void
xc_log (int flags, const char *file, const char *function, int line, const char *fmt, ...)
{
if ( flags >= XC_LOG_SENTINAL || flags < 0 )
return;
if ( xc_log_strings[flags].level < LOG_EMERG || xc_log_strings[flags].level > LOG_DEBUG )
return;
int fatal = ( flags == XC_LOG_FATAL );
size_t size = 1 + strlen(fmt) + strlen(xc_log_strings[flags].name) + 3;
char *format = (char *)malloc(size * sizeof(char));
if (!format) {
syslog (LOG_ERR, "malloc failed");
return;
}
va_list ap;
sprintf (format, "[%s] %s", xc_log_strings[flags].name, fmt);
/* Syslog */
syslog (LOG_DEBUG, "[%s] %s:%s:%d", xc_log_strings[flags].name, file, function, line);
va_start (ap, fmt);
vsyslog (LOG_USER | xc_log_strings[flags].level, format, ap);
va_end (ap);
free(format);
if ( fatal ) {
dump_backtrace ();
abort ();
}
return;
}
void
xc_log_exit (void)
{
closelog();
return;
}
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3Support module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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, Digia gives you certain additional
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef Q3GRIDLAYOUT_H
#define Q3GRIDLAYOUT_H
#include <QtGui/qboxlayout.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Qt3SupportLight)
class Q3GridLayout : public QGridLayout
{
public:
inline explicit Q3GridLayout(QWidget *parent)
: QGridLayout(parent) { setMargin(0); setSpacing(0); }
inline Q3GridLayout(QWidget *parent, int nRows, int nCols = 1, int margin = 0,
int spacing = -1, const char *name = 0)
: QGridLayout(parent, nRows, nCols, margin, spacing, name) {}
inline Q3GridLayout(int nRows, int nCols = 1, int spacing = -1, const char *name = 0)
: QGridLayout(nRows, nCols, spacing, name) {}
inline Q3GridLayout(QLayout *parentLayout, int nRows =1, int nCols = 1, int spacing = -1,
const char *name = 0)
: QGridLayout(parentLayout, nRows, nCols, spacing, name) {}
private:
Q_DISABLE_COPY(Q3GridLayout)
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // Q3GRIDLAYOUT_H
|
/*
Copyright (C) 2010 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gmp.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpq_poly.h"
char * fmpq_poly_get_str(const fmpq_poly_t poly)
{
slong i;
size_t j;
size_t len; /* Upper bound on the length */
size_t denlen; /* Size of the denominator in base 10 */
mpz_t z;
mpq_t q;
char * str;
if (poly->length == 0)
{
str = (char *) flint_malloc(2 * sizeof(char));
str[0] = '0';
str[1] = '\0';
return str;
}
mpz_init(z);
if (*poly->den == WORD(1))
{
denlen = 0;
}
else
{
fmpz_get_mpz(z, poly->den);
denlen = mpz_sizeinbase(z, 10);
}
len = (size_t) ceil(log10((double) (poly->length + 1))) + (size_t) 2;
for (i = 0; i < poly->length; i++)
{
fmpz_get_mpz(z, poly->coeffs + i);
len += mpz_sizeinbase(z, 10) + (size_t) 1;
if (mpz_sgn(z))
len += denlen + (size_t) 2;
}
mpq_init(q);
str = (char *) flint_malloc(len * sizeof(char));
j = flint_sprintf(str, "%li", poly->length);
str[j++] = ' ';
for (i = 0; i < poly->length; i++)
{
str[j++] = ' ';
fmpz_get_mpz(mpq_numref(q), poly->coeffs + i);
fmpz_get_mpz(mpq_denref(q), poly->den);
mpq_canonicalize(q);
mpq_get_str(str + j, 10, q);
j += strlen(str + j);
}
mpq_clear(q);
mpz_clear(z);
return str;
}
|
#include "../../src/designer/src/lib/sdk/sdk_global.h"
|
/*************************************************************************
Copyright (C) 2010 Nokia Corporation.
These OHM Modules are 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
version 2.1 of the License.
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.
*************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "plugin.h"
#include "dbusif.h"
#include "fsif.h"
#include "dresif.h"
#include "privacy.h"
#include "mute.h"
#include "bluetooth.h"
#include "audio.h"
int DBG_PRIVACY, DBG_MUTE, DBG_BT, DBG_AUDIO, DBG_DBUS, DBG_FS, DBG_DRES;
OHM_DEBUG_PLUGIN(media,
OHM_DEBUG_FLAG("privacy" , "privacy override" , &DBG_PRIVACY ),
OHM_DEBUG_FLAG("mute" , "mute" , &DBG_MUTE ),
OHM_DEBUG_FLAG("bluetooth", "bluetooth override" , &DBG_BT ),
OHM_DEBUG_FLAG("audio" , "audio streams" , &DBG_AUDIO ),
OHM_DEBUG_FLAG("dbus" , "D-Bus interface" , &DBG_DBUS ),
OHM_DEBUG_FLAG("fact" , "factstore interface", &DBG_FS ),
OHM_DEBUG_FLAG("dres" , "dres interface" , &DBG_DRES )
);
static void plugin_init(OhmPlugin *plugin)
{
OHM_DEBUG_INIT(media);
dbusif_init(plugin);
fsif_init(plugin);
dresif_init(plugin);
privacy_init(plugin);
mute_init(plugin);
bluetooth_init(plugin);
audio_init(plugin);
#if 0
DBG_PRIVACY = DBG_MUTE = DBG_BT = DBG_AUDIO = TRUE;
DBG_DBUS = DBG_FS = DBG_DRES = TRUE;
#endif
}
static void plugin_destroy(OhmPlugin *plugin)
{
fsif_exit(plugin);
dbusif_exit(plugin);
}
OHM_PLUGIN_DESCRIPTION(
"OHM media manager", /* description */
"0.0.1", /* version */
"janos.f.kovacs@nokia.com", /* author */
OHM_LICENSE_LGPL, /* license */
plugin_init, /* initalize */
plugin_destroy, /* destroy */
NULL /* notify */
);
OHM_PLUGIN_PROVIDES(
"maemo.media"
);
OHM_PLUGIN_DBUS_SIGNALS(
{ NULL, DBUS_POLICY_DECISION_INTERFACE, DBUS_INFO_SIGNAL,
NULL, dbusif_info, NULL },
{ NULL, DBUS_POLICY_DECISION_INTERFACE, DBUS_POLICY_NEW_SESSION_SIGNAL,
NULL, dbusif_session_notification, NULL }
);
/*
* Local Variables:
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
* vim:set expandtab shiftwidth=4:
*/
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QMLINSPECTOR_GLOBAL_H
#define QMLINSPECTOR_GLOBAL_H
#include <QtCore/QtGlobal>
#if defined(QMLINSPECTOR_LIBRARY)
# define QMLINSPECTOR_EXPORT Q_DECL_EXPORT
#else
# define QMLINSPECTOR_EXPORT Q_DECL_IMPORT
#endif
#endif // QMLINSPECTOR_GLOBAL_H
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation 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.0, 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 are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MYCLASS3_H
#define MYCLASS3_H
#include <QObject>
//! [0]
class MyClass : public QObject
{
Q_OBJECT
Q_CLASSINFO("Author", "Oscar Peterson")
Q_CLASSINFO("Status", "Active")
public:
MyClass(QObject *parent = 0);
~MyClass();
};
//! [0]
#endif
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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, Digia gives you certain additional
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSCRIPTECMAERROR_P_H
#define QSCRIPTECMAERROR_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.
//
#include "qscriptecmacore_p.h"
#ifndef QT_NO_SCRIPT
QT_BEGIN_NAMESPACE
namespace QScript { namespace Ecma {
class Error: public Core
{
public:
Error(QScriptEnginePrivate *engine);
virtual ~Error();
virtual void execute(QScriptContextPrivate *context);
virtual void mark(QScriptEnginePrivate *eng, int generation);
void newError(QScriptValueImpl *result, const QString &message = QString());
void newEvalError(QScriptValueImpl *result, const QString &message = QString());
void newRangeError(QScriptValueImpl *result, const QString &message = QString());
void newReferenceError(QScriptValueImpl *result, const QString &message = QString());
void newSyntaxError(QScriptValueImpl *result, const QString &message = QString());
void newTypeError(QScriptValueImpl *result, const QString &message = QString());
void newURIError(QScriptValueImpl *result, const QString &message = QString());
bool isEvalError(const QScriptValueImpl &value) const;
bool isRangeError(const QScriptValueImpl &value) const;
bool isReferenceError(const QScriptValueImpl &value) const;
bool isSyntaxError(const QScriptValueImpl &value) const;
bool isTypeError(const QScriptValueImpl &value) const;
bool isURIError(const QScriptValueImpl &value) const;
static QStringList backtrace(const QScriptValueImpl &error);
QScriptValueImpl evalErrorCtor;
QScriptValueImpl rangeErrorCtor;
QScriptValueImpl referenceErrorCtor;
QScriptValueImpl syntaxErrorCtor;
QScriptValueImpl typeErrorCtor;
QScriptValueImpl uriErrorCtor;
QScriptValueImpl evalErrorPrototype;
QScriptValueImpl rangeErrorPrototype;
QScriptValueImpl referenceErrorPrototype;
QScriptValueImpl syntaxErrorPrototype;
QScriptValueImpl typeErrorPrototype;
QScriptValueImpl uriErrorPrototype;
protected:
static QScriptValueImpl method_toString(QScriptContextPrivate *context, QScriptEnginePrivate *eng, QScriptClassInfo *classInfo);
static QScriptValueImpl method_backtrace(QScriptContextPrivate *context, QScriptEnginePrivate *eng, QScriptClassInfo *classInfo);
private:
void newError(QScriptValueImpl *result, const QScriptValueImpl &proto,
const QString &message = QString());
void newErrorPrototype(QScriptValueImpl *result, const QScriptValueImpl &proto,
QScriptValueImpl &ztor, const QString &name);
};
} } // namespace QScript::Ecma
QT_END_NAMESPACE
#endif // QT_NO_SCRIPT
#endif // QSCRIPTECMAERROR_P_H
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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, Digia gives you certain additional
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FOORECORD_H
#define FOORECORD_H
#include <qdeclarativendefrecord.h>
QTM_USE_NAMESPACE
//! [Foo declaration]
class QDeclarativeNdefFooRecord : public QDeclarativeNdefRecord
{
Q_OBJECT
Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged)
public:
explicit QDeclarativeNdefFooRecord(QObject *parent = 0);
Q_INVOKABLE QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent = 0);
~QDeclarativeNdefFooRecord();
int foo() const;
void setFoo(int value);
signals:
void fooChanged();
};
//! [Foo declaration]
#endif // FOORECORD_H
|
/*
* PAM-PKCS11 UID mapper module
* Copyright (C) 2005 Juan Antonio Martinez <jonsito@teleline.es>
* pam-pkcs11 is copyright (C) 2003-2004 of Mario Strasser <mast@gmx.net>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#define __UID_MAPPER_C_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "../common/cert_st.h"
#include "../scconf/scconf.h"
#include "../common/debug.h"
#include "../common/error.h"
#include "../common/strings.h"
#include "../common/cert_info.h"
#include "mapper.h"
#include "uid_mapper.h"
/*
* This mapper uses the Unique ID (UID) entry on the certificate to
* find user name.
*/
static const char *mapfile = "none";
static int ignorecase = 0;
static int debug = 0;
/**
* Return the list of UID's on this certificate
*/
static char ** uid_mapper_find_entries(X509 *x509, void *context) {
char **entries= cert_info(x509,CERT_UID,ALGORITHM_NULL);
if (!entries) {
DBG("get_unique_id() failed");
return NULL;
}
return entries;
}
/*
parses the certificate and return the map of the first UID entry found
If no UID found or map error, return NULL
*/
static char * uid_mapper_find_user(X509 *x509, void *context, int *match) {
char *res;
char **entries= cert_info(x509,CERT_UID,ALGORITHM_NULL);
if (!entries) {
DBG("get_unique_id() failed");
return NULL;
}
DBG1("trying to map uid entry '%s'",entries[0]);
res = mapfile_find(mapfile,entries[0],ignorecase,match);
if (!res) {
DBG("Error in map process");
return NULL;
}
return clone_str(res);
}
/*
* parses the certificate and try to macht any UID in the certificate
* with provided user
*/
static int uid_mapper_match_user(X509 *x509, const char *login, void *context) {
char *str;
int match_found = 0;
char **entries = cert_info(x509,CERT_UID,ALGORITHM_NULL);
if (!entries) {
DBG("get_unique_id() failed");
return -1;
}
/* parse list of uids until match */
for (str=*entries; str && (match_found==0); str=*++entries) {
int res=0;
DBG1("trying to map & match uid entry '%s'",str);
res = mapfile_match(mapfile,str,login,ignorecase);
if (!res) {
DBG("Error in map&match process");
return -1; /* or perhaps should be "continue" ??*/
}
if (res>0) match_found=1;
}
return match_found;
}
_DEFAULT_MAPPER_END
static mapper_module * init_mapper_st(scconf_block *blk, const char *name) {
mapper_module *pt= malloc(sizeof(mapper_module));
if (!pt) return NULL;
pt->name = name;
pt->block = blk;
pt->context = NULL;
pt->entries = uid_mapper_find_entries;
pt->finder = uid_mapper_find_user;
pt->matcher = uid_mapper_match_user;
pt->deinit = mapper_module_end;
return pt;
}
#ifndef UID_MAPPER_STATIC
mapper_module * mapper_module_init(scconf_block *blk,const char *mapper_name) {
#else
mapper_module * uid_mapper_module_init(scconf_block *blk,const char *mapper_name) {
#endif
mapper_module *pt;
if (blk) {
debug= scconf_get_bool(blk,"debug",0);
mapfile = scconf_get_str(blk,"mapfile",mapfile);
ignorecase = scconf_get_bool(blk,"ignorecase",ignorecase);
} else {
DBG1("No block declaration for mapper '%s'", mapper_name);
}
set_debug_level(debug);
pt= init_mapper_st(blk,mapper_name);
if(pt) DBG3("UniqueID mapper started. debug: %d, mapfile: %s, icase: %d",debug,mapfile,ignorecase);
else DBG("UniqueID mapper initialization failed");
return pt;
}
|
/*
Copyright (C) 2010,2011 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include "flint.h"
#include "ulong_extras.h"
#include "nmod_vec.h"
#include "nmod_mat.h"
int
nmod_mat_solve_vec(mp_ptr x, const nmod_mat_t A, mp_srcptr b)
{
nmod_mat_t X, B;
int result;
slong i, m;
m = A->r;
if (m == 0)
return 1;
/* This is a bit of a hack. There should be a function to create
a window into a vector */
nmod_mat_window_init(X, A, 0, 0, m, 1);
nmod_mat_window_init(B, A, 0, 0, m, 1);
for (i = 0; i < m; i++) X->rows[i] = x + i;
for (i = 0; i < m; i++) B->rows[i] = (mp_ptr) (b + i);
result = nmod_mat_solve(X, A, B);
nmod_mat_window_clear(X);
nmod_mat_window_clear(B);
return result;
}
|
/* MyCpp - MyNC C++ helper library
* Copyright (C) 2009-2010 Dmitry Shatrov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MYCPP__STREAM_OUT_H__
#define __MYCPP__STREAM_OUT_H__
#include <mycpp/types.h>
#include <mycpp/object.h>
#include <mycpp/io_exception.h>
#include <mycpp/internal_exception.h>
namespace MyCpp {
class StreamOut : public virtual Object
{
public:
virtual IOResult write (const unsigned char *buf,
unsigned long len,
unsigned long *nwritten)
throw (IOException,
InternalException) = 0;
};
}
#endif /* __MYCPP__STREAM_OUT_H__ */
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CHECKOUTPROGRESSWIZARDPAGE_H
#define CHECKOUTPROGRESSWIZARDPAGE_H
#include <QSharedPointer>
#include <QWizardPage>
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
class QLabel;
QT_END_NAMESPACE
namespace Utils { class OutputFormatter; }
namespace VcsBase {
class Command;
namespace Internal {
class CheckoutProgressWizardPage : public QWizardPage
{
Q_OBJECT
public:
enum State { Idle, Running, Failed, Succeeded };
explicit CheckoutProgressWizardPage(QWidget *parent = 0);
~CheckoutProgressWizardPage();
void setStartedStatus(const QString &startedStatus);
void start(Command *command);
virtual bool isComplete() const;
bool isRunning() const{ return m_state == Running; }
void terminate();
signals:
void terminated(bool success);
private slots:
void slotFinished(bool ok, int exitCode, const QVariant &cookie);
void slotOutput(const QString &text);
void slotError(const QString &text);
private:
QPlainTextEdit *m_logPlainTextEdit;
Utils::OutputFormatter *m_formatter;
QLabel *m_statusLabel;
Command *m_command;
QString m_startedStatus;
QString m_error;
bool m_overwriteOutput;
State m_state;
};
} // namespace Internal
} // namespace VcsBase
#endif // CHECKOUTPROGRESSWIZARDPAGE_H
|
/*
* Copyright (C) 2016 Endless Mobile, Inc.
*
* SPDX-License-Identifier: LGPL-2.0+
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Krzesimir Nowak <krzesimir@kinvolk.io>
*/
#pragma once
#include <ostree.h>
G_BEGIN_DECLS
/* ostree can use g_autoptr backports from libglnx when glib is too
* old, but still avoid exposing them to users that also have an old
* glib */
#if defined(OSTREE_COMPILATION) || GLIB_CHECK_VERSION(2, 44, 0)
/*
* The following types have no specific clear/free/unref functions, so
* they can be used as the stack-allocated variables or as the
* g_autofree heap-allocated variables.
*
* OstreeRepoTransactionStats
* OstreeRepoImportArchiveOptions
* OstreeRepoExportArchiveOptions
* OstreeRepoCheckoutOptions
*/
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeDiffItem, ostree_diff_item_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoCommitModifier, ostree_repo_commit_modifier_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoDevInoCache, ostree_repo_devino_cache_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeAsyncProgress, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeBootconfigParser, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeCommitSizesEntry, ostree_commit_sizes_entry_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeDeployment, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeGpgVerifyResult, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeKernelArgs, ostree_kernel_args_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeMutableTree, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepo, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFile, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSePolicy, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSysroot, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSysrootUpgrader, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (OstreeRepoCommitTraverseIter, ostree_repo_commit_traverse_iter_clear)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeCollectionRef, ostree_collection_ref_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeCollectionRefv, ostree_collection_ref_freev, NULL)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRemote, ostree_remote_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinder, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderAvahi, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderConfig, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderMount, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderOverride, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, ostree_repo_finder_result_free)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, ostree_repo_finder_result_freev, NULL)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSign, g_object_unref)
#endif
G_END_DECLS
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtScript module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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, Digia gives you certain additional
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSCRIPTVALUEITERATOR_H
#define QSCRIPTVALUEITERATOR_H
#include <QtScript/qscriptvalue.h>
#ifndef QT_NO_SCRIPT
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Script)
class QString;
class QScriptString;
class QScriptValueIteratorPrivate;
class Q_SCRIPT_EXPORT QScriptValueIterator
{
public:
QScriptValueIterator(const QScriptValue &value);
~QScriptValueIterator();
bool hasNext() const;
void next();
bool hasPrevious() const;
void previous();
QString name() const;
QScriptString scriptName() const;
QScriptValue value() const;
void setValue(const QScriptValue &value);
QScriptValue::PropertyFlags flags() const;
void remove();
void toFront();
void toBack();
QScriptValueIterator& operator=(QScriptValue &value);
private:
QScriptValueIteratorPrivate *d_ptr;
Q_DECLARE_PRIVATE(QScriptValueIterator)
Q_DISABLE_COPY(QScriptValueIterator)
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QT_NO_SCRIPT
#endif // QSCRIPTVALUEITERATOR_H
|
/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it 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.
**
****************************************************************************/
#ifndef PT_QAPPLICATION_H
#define PT_QAPPLICATION_H
#include <QObject>
/**
* Test performance of the MApplication constructor.
* The constructor is created in process and as part of a newly created process.
*
* The most timeconsuming parts of the constructor can be verified by the following tests:
* - pt_qapplication
* - pt_mcomponentdata
*/
class Pt_MApplication : public QObject
{
Q_OBJECT
private slots:
/**
* Test how long it takes to launch an application which is quitting immediately.
*/
void processCreation();
/**
* Test the performance of the mapplication constructor.
*
* This test creates a new process and thus includes process creation overhead.
* Callgrind results are meaningless since the child process is not traced.
*/
void processCreationAndConstructor();
/**
* Test the performance of the mapplication constructor.
*/
void uncachedConstructor();
/**
* Execute the constructor a second time to evaluate caching possibilities.
*/
void cachedConstructor();
private:
/**
* Executes the current programm with a given parameter.
*/
void executeSelf(const QLatin1String ¶meter);
};
#endif // PT_QAPPLICATION_H
|
/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it 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.
**
****************************************************************************/
#ifndef CUSTOMSELECTABLELABEL_H
#define CUSTOMSELECTABLELABEL_H
#include <MRichTextEdit>
#include <MTextEditView>
#include <MWidget>
class MLabel;
class MTextEditModel;
class MLayout;
class MLinearLayoutPolicy;
class MLabelHighlighter;
class QTimer;
class CustomEditView : public MTextEditView
{
Q_OBJECT
public:
explicit CustomEditView(MTextEdit *controller) : MTextEditView(controller) {}
virtual ~CustomEditView() {}
int cursorPosition(const QPointF &hitPoint) { return MTextEditView::cursorPosition(hitPoint); }
};
class CustomEdit : public MRichTextEdit
{
Q_OBJECT
public:
CustomEdit(QGraphicsItem *parent = 0) : MRichTextEdit(MTextEditModel::MultiLine, QString(), parent) { setView(new CustomEditView(this)); }
virtual ~CustomEdit() {}
bool startSelection(const QPointF &hitPoint);
protected:
QPointF startPoint(const QPointF &hitPoint) const;
int cursorPosition(const QPointF &hitPoint) const;
};
class CustomSelectableLabel : public MWidget
{
Q_OBJECT
public:
CustomSelectableLabel(QString const &text = "", QGraphicsItem *parent = 0);
virtual ~CustomSelectableLabel();
void setStyleName(const QString &name);
void setText(const QString &text);
void addHighlighter(MLabelHighlighter *highlighter);
void removeHighlighter(MLabelHighlighter *highlighter);
void removeAllHighlighters();
protected:
virtual void tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGesture* gesture);
bool selecting;
MLabel *label;
CustomEdit *edit;
const MTextEditModel *editModel;
MLayout *layout;
MLinearLayoutPolicy *labelPolicy;
MLinearLayoutPolicy *editPolicy;
QTimer *hitTimer;
QPointF hitPoint;
protected Q_SLOTS:
void switchToEdit();
void switchToLabel();
void hitTimeout();
void onEditModelModified(const QList<const char *>& modifications);
};
#endif // CUSTOMSELECTABLELABEL_H
|
#ifndef __GUIDEDFILTER_H__
#define __GUIDEDFILTER_H__
#include <opencv2/core/core.hpp>
cv::Mat guidedFilter(cv::Mat &I, cv::Mat &p, int r, double eps);
#endif // end of __GUIDEDFILTER_H__
|
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (c) 2012-2014 The plumed team
(see the PEOPLE file at the root of the distribution for a list of names)
See http://www.plumed-code.org for more information.
This file is part of plumed, version 2.
plumed 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.
plumed 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 plumed. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#ifndef __PLUMED_tools_HistogramBead_h
#define __PLUMED_tools_HistogramBead_h
#include <cmath>
#include <string>
#include <vector>
#include "Exception.h"
#include "Tools.h"
namespace PLMD {
class Keywords;
class Log;
/**
\ingroup TOOLBOX
A class for calculating whether or not values are within a given range using : \f$ \sum_i \int_a^b G( s_i, \sigma*(b-a) ) \f$
*/
class HistogramBead{
private:
bool init;
double lowb;
double highb;
double width;
enum {gaussian,triangular} type;
enum {unset,periodic,notperiodic} periodicity;
double min, max, max_minus_min, inv_max_minus_min;
double difference( const double& d1, const double& d2 ) const ;
public:
static void registerKeywords( Keywords& keys );
static void generateBins( const std::string& params, const std::string& dd, std::vector<std::string>& bins );
HistogramBead();
std::string description() const ;
bool hasBeenSet() const;
void isNotPeriodic();
void isPeriodic( const double& mlow, const double& mhigh );
void setKernelType( const std::string& ktype );
void set(const std::string& params, const std::string& dd, std::string& errormsg);
void set(double l, double h, double w);
double calculate(double x, double&df) const;
double lboundDerivative( const double& x ) const;
double uboundDerivative( const double& x ) const;
double getlowb() const ;
double getbigb() const ;
};
inline
bool HistogramBead::hasBeenSet() const {
return init;
}
inline
void HistogramBead::isNotPeriodic(){
periodicity=notperiodic;
}
inline
void HistogramBead::isPeriodic( const double& mlow, const double& mhigh ){
periodicity=periodic; min=mlow; max=mhigh;
max_minus_min=max-min;
plumed_massert(max_minus_min>0, "your function has a very strange domain?");
inv_max_minus_min=1.0/max_minus_min;
}
inline
double HistogramBead::getlowb() const { return lowb; }
inline
double HistogramBead::getbigb() const { return highb; }
inline
double HistogramBead::difference( const double& d1, const double& d2 ) const {
if(periodicity==notperiodic){
return d2-d1;
} else if(periodicity==periodic){
// Make sure the point is in the target range
double newx=d1*inv_max_minus_min;
newx=Tools::pbc(newx);
newx*=max_minus_min;
return d2-newx;
} else plumed_merror("periodicty was not set");
return 0;
}
}
#endif
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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/>.
*/
#ifndef __GIMP_CURVE_H__
#define __GIMP_CURVE_H__
#include "gimpdata.h"
#define GIMP_TYPE_CURVE (gimp_curve_get_type ())
#define GIMP_CURVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CURVE, GimpCurve))
#define GIMP_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CURVE, GimpCurveClass))
#define GIMP_IS_CURVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CURVE))
#define GIMP_IS_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CURVE))
#define GIMP_CURVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CURVE, GimpCurveClass))
typedef struct _GimpCurveClass GimpCurveClass;
struct _GimpCurve
{
GimpData parent_instance;
GimpCurveType curve_type;
gint n_points;
GimpVector2 *points;
gint n_samples;
gdouble *samples;
gboolean identity; /* whether the curve is an identiy mapping */
};
struct _GimpCurveClass
{
GimpDataClass parent_class;
};
GType gimp_curve_get_type (void) G_GNUC_CONST;
GimpData * gimp_curve_new (const gchar *name);
GimpData * gimp_curve_get_standard (void);
void gimp_curve_reset (GimpCurve *curve,
gboolean reset_type);
void gimp_curve_set_curve_type (GimpCurve *curve,
GimpCurveType curve_type);
GimpCurveType gimp_curve_get_curve_type (GimpCurve *curve);
void gimp_curve_set_n_points (GimpCurve *curve,
gint n_points);
gint gimp_curve_get_n_points (GimpCurve *curve);
void gimp_curve_set_n_samples (GimpCurve *curve,
gint n_samples);
gint gimp_curve_get_n_samples (GimpCurve *curve);
gint gimp_curve_get_closest_point (GimpCurve *curve,
gdouble x);
void gimp_curve_set_point (GimpCurve *curve,
gint point,
gdouble x,
gdouble y);
void gimp_curve_move_point (GimpCurve *curve,
gint point,
gdouble y);
void gimp_curve_delete_point (GimpCurve *curve,
gint point);
void gimp_curve_get_point (GimpCurve *curve,
gint point,
gdouble *x,
gdouble *y);
void gimp_curve_set_curve (GimpCurve *curve,
gdouble x,
gdouble y);
gboolean gimp_curve_is_identity (GimpCurve *curve);
void gimp_curve_get_uchar (GimpCurve *curve,
gint n_samples,
guchar *samples);
#endif /* __GIMP_CURVE_H__ */
|
/*
* Copyright (C) 2009 The Android Open Source Project
*
* 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.
*/
#define _CODEGEN_C
#define _ARMV7_A_NEON
#include "Dalvik.h"
#include "interp/InterpDefs.h"
#include "libdex/OpCode.h"
#include "libdex/OpCodeNames.h"
#include "compiler/CompilerInternals.h"
#include "compiler/codegen/arm/ArmLIR.h"
#include "mterp/common/FindInterface.h"
#include "compiler/codegen/arm/Ralloc.h"
#include "compiler/codegen/arm/Codegen.h"
#include "compiler/Loop.h"
#include "ArchVariant.h"
/* Architectural independent building blocks */
#include "../CodegenCommon.c"
/* Thumb2-specific factory utilities */
#include "../Thumb2/Factory.c"
/* Factory utilities dependent on arch-specific features */
#include "../CodegenFactory.c"
/* Thumb2-specific codegen routines */
#include "../Thumb2/Gen.c"
/* Thumb2+VFP codegen routines */
#include "../FP/Thumb2VFP.c"
/* Thumb2-specific register allocation */
#include "../Thumb2/Ralloc.c"
/* MIR2LIR dispatcher and architectural independent codegen routines */
#include "../CodegenDriver.c"
/* Architecture manifest */
#include "ArchVariant.c"
|
#include "sqlite3.c"
#include "sqlc.h" /* types needed for SQLiteNative_JNI.c */
#include "SQLiteNative_JNI.c"
#include "sqlc.c"
|
/**
* @ingroup Grid
*
* @{
*/
#define ELM_OBJ_GRID_CLASS elm_obj_grid_class_get()
const Eo_Class *elm_obj_grid_class_get(void) EINA_CONST;
extern EAPI Eo_Op ELM_OBJ_GRID_BASE_ID;
enum
{
ELM_OBJ_GRID_SUB_ID_SIZE_SET,
ELM_OBJ_GRID_SUB_ID_SIZE_GET,
ELM_OBJ_GRID_SUB_ID_PACK,
ELM_OBJ_GRID_SUB_ID_UNPACK,
ELM_OBJ_GRID_SUB_ID_CLEAR,
ELM_OBJ_GRID_SUB_ID_CHILDREN_GET,
ELM_OBJ_GRID_SUB_ID_LAST
};
#define ELM_OBJ_GRID_ID(sub_id) (ELM_OBJ_GRID_BASE_ID + sub_id)
/**
* @def elm_obj_grid_size_set
* @since 1.8
*
* Set the virtual size of the grid
*
* @param[in] w
* @param[in] h
*
* @see elm_grid_size_set
*/
#define elm_obj_grid_size_set(w, h) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)
/**
* @def elm_obj_grid_size_get
* @since 1.8
*
* Get the virtual size of the grid
*
* @param[out] w
* @param[out] h
*
* @see elm_grid_size_get
*/
#define elm_obj_grid_size_get(w, h) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_SIZE_GET), EO_TYPECHECK(Evas_Coord *, w), EO_TYPECHECK(Evas_Coord *, h)
/**
* @def elm_obj_grid_pack
* @since 1.8
*
* Pack child at given position and size
*
* @param[in] subobj
* @param[in] x
* @param[in] y
* @param[in] w
* @param[in] h
*
* @see elm_grid_pack
*/
#define elm_obj_grid_pack(subobj, x, y, w, h) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_PACK), EO_TYPECHECK(Evas_Object *, subobj), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)
/**
* @def elm_obj_grid_unpack
* @since 1.8
*
* Unpack a child from a grid object
*
* @param[in] subobj
*
* @see elm_grid_unpack
*/
#define elm_obj_grid_unpack(subobj) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_UNPACK), EO_TYPECHECK(Evas_Object *, subobj)
/**
* @def elm_obj_grid_clear
* @since 1.8
*
* Faster way to remove all child objects from a grid object.
*
* @param[in] clear
*
* @see elm_grid_clear
*/
#define elm_obj_grid_clear(clear) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_CLEAR), EO_TYPECHECK(Eina_Bool, clear)
/**
* @def elm_obj_grid_children_get
* @since 1.8
*
* Get the list of the children for the grid.
*
* @param[out] ret
*
* @see elm_grid_children_get
*/
#define elm_obj_grid_children_get(ret) ELM_OBJ_GRID_ID(ELM_OBJ_GRID_SUB_ID_CHILDREN_GET), EO_TYPECHECK(Eina_List **, ret)
/**
* @}
*/
|
/*
* Copyright 2010-2012 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.
*/
#import <Foundation/Foundation.h>
#import "S3Response.h"
/** Contains the response from a getObject operation.
*
* \ingroup S3
*/
@interface S3GetObjectResponse:S3Response {
NSMutableDictionary *metadata;
NSOutputStream *outputStream;
NSDate *lastModified;
NSString *contentType;
}
/**
* The value of the Last-Modified header, indicating the
* date and time at which Amazon S3 last recorded a
* modification to the associated object.
*/
@property (nonatomic, retain) NSDate *lastModified;
/**
* The Content-Type HTTP header, which indicates the type
* of content stored in the associated object. The value
* of this header is a standard MIME type.
*/
@property (nonatomic, retain) NSString *contentType;
/** Get the value for a user-defined metadata key.
* @param aKey The key of the metadata.
* @return The metadata value corresponding to the supplied key.
*/
-(NSString *)getMetadataForKey:(NSString *)aKey;
/** Set the output stream for the response data.
*
* If this is set, then the response will write the data
* to the supplied stream instead of making it available through
* the data property.
*/
-(void)setOutputStream:(NSOutputStream *)stream;
@end
|
/*
* Copyright 2015 Facebook, 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 THRIFT_TEST_EXPECT_SAME_H
#define THRIFT_TEST_EXPECT_SAME_H
#include <folly/Demangle.h>
#include <gtest/gtest.h>
#include <string>
#include <tuple>
#include <typeinfo>
struct expect_same {
expect_same(char const *filename, std::size_t line):
filename_(filename),
line_(line)
{}
template <typename LHS, typename RHS>
void check() const {
using type = std::tuple<std::string, std::size_t, char const *, bool>;
auto const lhs_name = folly::demangle(typeid(LHS));
auto const rhs_name = folly::demangle(typeid(RHS));
type const lhs(filename_, line_, lhs_name.c_str(), true);
type const rhs(
filename_, line_,
lhs_name == rhs_name ? lhs_name.c_str() : rhs_name.c_str(),
std::is_same<LHS, RHS>::value
);
EXPECT_EQ(lhs, rhs);
}
private:
std::string const filename_;
std::size_t const line_;
};
#define EXPECT_SAME expect_same(__FILE__, __LINE__).check
#endif // THRIFT_TEST_EXPECT_SAME_H
|
/******************************************************************
Copyright 2015, Jiang Xiao-tang
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 CORE_GPCOMPUTEPOINT_H
#define CORE_GPCOMPUTEPOINT_H
#include "head.h"
#include "core/GPFunctionDataBase.h"
#include "lowlevelAPI/GPContents.h"
#include <vector>
#include "core/GPStatusContent.h"
class GPComputePoint:public GPRefCount
{
public:
typedef GPContents::GP_Unit ContentWrap;
GPComputePoint(const GPFunction* f);
virtual ~GPComputePoint();
/*inputs can only has one content*/
bool receive(GPPtr<ContentWrap> inputs, int n);
inline const GPFunction* get() const {return mF;}
const std::vector<bool>& flags() const {return mFlags;}
int map(double* value, int n);
inline bool completed() const {return mComplte;}
GPContents* compute();
private:
bool _computeCompleteStatus() const;
const GPFunction* mF;
std::vector<bool> mFlags;
std::vector<GPPtr<ContentWrap>> mCache;
bool mComplte;
std::vector<GPPtr<GPStatusContent> > mStatus;
};
#endif
|
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <sys/time.h>
#include <vector>
#include <sys/time.h>
#define USEC 0.000001
using std::cerr;
using std::cout;
using std::endl;
using std::string;
using std::vector;
inline void printTime(int tile, struct timeval start, struct timeval stop) {
double time = (double) stop.tv_sec + (double) stop.tv_usec * USEC
- (double) start.tv_sec - (double) start.tv_usec * USEC;
cout << tile << "," << time << endl;
}
|
/* GRAPHITE2 LICENSING
Copyright 2010, SIL International
All rights reserved.
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 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 also have received a copy of the GNU Lesser General Public
License along with this library in the file named "LICENSE".
If not, write to the Free Software Foundation, 51 Franklin Street,
Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
internet at http://www.fsf.org/licenses/lgpl.html.
Alternatively, the contents of this file may be used under the terms of the
Mozilla Public License (http://mozilla.org/MPL) or 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.
*/
#pragma once
#include "inc/Main.h"
namespace graphite2 {
class sparse
{
typedef unsigned long mask_t;
static const unsigned char SIZEOF_CHUNK = (sizeof(mask_t) - sizeof(uint16))*8;
struct chunk
{
mask_t mask:SIZEOF_CHUNK;
uint16 offset;
};
public:
typedef uint16 key;
typedef uint16 value;
template<typename I>
sparse(I first, const I last);
sparse() throw();
~sparse() throw();
value operator [] (int k) const throw();
operator bool () const throw();
size_t capacity() const throw();
size_t size() const throw();
size_t _sizeof() const throw();
CLASS_NEW_DELETE;
private:
union {
chunk * map;
value * values;
} m_array;
key m_nchunks;
};
inline
sparse::sparse() throw() : m_nchunks(0)
{
m_array.map = 0;
}
template <typename I>
sparse::sparse(I attr, const I last)
: m_nchunks(0)
{
// Find the maximum extent of the key space.
size_t n_values=0;
for (I i = attr; i != last; ++i, ++n_values)
{
const key k = i->id / SIZEOF_CHUNK;
if (k >= m_nchunks) m_nchunks = k+1;
}
m_array.values = grzeroalloc<value>((m_nchunks*sizeof(chunk) + sizeof(value)/2)/sizeof(value) + n_values*sizeof(value));
if (m_array.values == 0 || m_nchunks == 0)
{
free(m_array.values); m_array.map=0;
return;
}
chunk * ci = m_array.map;
ci->offset = (m_nchunks*sizeof(chunk) + sizeof(value)-1)/sizeof(value);
value * vi = m_array.values + ci->offset;
for (; attr != last; ++attr, ++vi)
{
const typename I::value_type v = *attr;
chunk * const ci_ = m_array.map + v.id/SIZEOF_CHUNK;
if (ci != ci_)
{
ci = ci_;
ci->offset = vi - m_array.values;
}
ci->mask |= 1UL << (SIZEOF_CHUNK - 1 - (v.id % SIZEOF_CHUNK));
*vi = v.value;
}
}
inline
sparse::operator bool () const throw()
{
return m_array.map != 0;
}
inline
size_t sparse::capacity() const throw()
{
return m_nchunks;
}
inline
size_t sparse::_sizeof() const throw()
{
return sizeof(sparse) + size()*sizeof(value) + m_nchunks*sizeof(chunk);
}
} // namespace graphite2
|
/*
* twemproxy - A fast and lightweight proxy for memcached protocol.
* Copyright (C) 2011 Twitter, 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <nc_core.h>
#include <nc_server.h>
#include <nc_hashkit.h>
#define MODULA_CONTINUUM_ADDITION 10 /* # extra slots to build into continuum */
#define MODULA_POINTS_PER_SERVER 1
rstatus_t
modula_update(struct server_pool *pool)
{
uint32_t nserver; /* # server - live and dead */
uint32_t nlive_server; /* # live server */
uint32_t pointer_per_server; /* pointers per server proportional to weight */
uint32_t pointer_counter; /* # pointers on continuum */
uint32_t points_per_server; /* points per server */
uint32_t continuum_index; /* continuum index */
uint32_t continuum_addition; /* extra space in the continuum */
uint32_t server_index; /* server index */
uint32_t weight_index; /* weight index */
uint32_t total_weight; /* total live server weight */
int64_t now; /* current timestamp in usec */
now = nc_usec_now();
if (now < 0) {
return NC_ERROR;
}
nserver = array_n(&pool->server);
nlive_server = 0;
total_weight = 0;
pool->next_rebuild = 0LL;
for (server_index = 0; server_index < nserver; server_index++) {
struct server *server = array_get(&pool->server, server_index);
if (pool->auto_eject_hosts) {
if (server->next_retry <= now) {
server->next_retry = 0LL;
nlive_server++;
} else if (pool->next_rebuild == 0LL ||
server->next_retry < pool->next_rebuild) {
pool->next_rebuild = server->next_retry;
}
} else {
nlive_server++;
}
ASSERT(server->weight > 0);
/* count weight only for live servers */
if (!pool->auto_eject_hosts || server->next_retry <= now) {
total_weight += server->weight;
}
}
pool->nlive_server = nlive_server;
if (nlive_server == 0) {
ASSERT(pool->continuum != NULL);
ASSERT(pool->ncontinuum != 0);
log_debug(LOG_DEBUG, "no live servers for pool %"PRIu32" '%.*s'",
pool->idx, pool->name.len, pool->name.data);
return NC_OK;
}
log_debug(LOG_DEBUG, "%"PRIu32" of %"PRIu32" servers are live for pool "
"%"PRIu32" '%.*s'", nlive_server, nserver, pool->idx,
pool->name.len, pool->name.data);
continuum_addition = MODULA_CONTINUUM_ADDITION;
points_per_server = MODULA_POINTS_PER_SERVER;
/*
* Allocate the continuum for the pool, the first time, and every time we
* add a new server to the pool
*/
if (total_weight > pool->nserver_continuum) {
struct continuum *continuum;
uint32_t nserver_continuum = total_weight + MODULA_CONTINUUM_ADDITION;
uint32_t ncontinuum = nserver_continuum * MODULA_POINTS_PER_SERVER;
continuum = nc_realloc(pool->continuum, sizeof(*continuum) * ncontinuum);
if (continuum == NULL) {
return NC_ENOMEM;
}
pool->continuum = continuum;
pool->nserver_continuum = nserver_continuum;
/* pool->ncontinuum is initialized later as it could be <= ncontinuum */
}
/* update the continuum with the servers that are live */
continuum_index = 0;
pointer_counter = 0;
for (server_index = 0; server_index < nserver; server_index++) {
struct server *server = array_get(&pool->server, server_index);
if (pool->auto_eject_hosts && server->next_retry > now) {
continue;
}
for (weight_index = 0; weight_index < server->weight; weight_index++) {
pointer_per_server = 1;
pool->continuum[continuum_index].index = server_index;
pool->continuum[continuum_index++].value = 0;
pointer_counter += pointer_per_server;
}
}
pool->ncontinuum = pointer_counter;
log_debug(LOG_VERB, "updated pool %"PRIu32" '%.*s' with %"PRIu32" of "
"%"PRIu32" servers live in %"PRIu32" slots and %"PRIu32" "
"active points in %"PRIu32" slots", pool->idx,
pool->name.len, pool->name.data, nlive_server, nserver,
pool->nserver_continuum, pool->ncontinuum,
(pool->nserver_continuum + continuum_addition) * points_per_server);
return NC_OK;
}
int
modula_dispatch(struct server_pool *pool, struct continuum *continuum, uint32_t ncontinuum, uint32_t hash)
{
struct continuum *c;
ASSERT(continuum != NULL);
ASSERT(ncontinuum != 0);
c = continuum + hash % ncontinuum;
return (int)c->index;
}
|
// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
#pragma once
#define FULLY_CONNECTED_NULL_BIAS_0_OUT_CH 5
#define FULLY_CONNECTED_NULL_BIAS_0_IN_CH 33
#define FULLY_CONNECTED_NULL_BIAS_0_INPUT_W 1
#define FULLY_CONNECTED_NULL_BIAS_0_INPUT_H 1
#define FULLY_CONNECTED_NULL_BIAS_0_DST_SIZE 10
#define FULLY_CONNECTED_NULL_BIAS_0_INPUT_SIZE 33
#define FULLY_CONNECTED_NULL_BIAS_0_OUT_ACTIVATION_MIN -128
#define FULLY_CONNECTED_NULL_BIAS_0_OUT_ACTIVATION_MAX 127
#define FULLY_CONNECTED_NULL_BIAS_0_INPUT_BATCHES 2
#define FULLY_CONNECTED_NULL_BIAS_0_OUTPUT_MULTIPLIER 1250979488
#define FULLY_CONNECTED_NULL_BIAS_0_OUTPUT_SHIFT -9
#define FULLY_CONNECTED_NULL_BIAS_0_ACCUMULATION_DEPTH 33
#define FULLY_CONNECTED_NULL_BIAS_0_INPUT_OFFSET 128
#define FULLY_CONNECTED_NULL_BIAS_0_OUTPUT_OFFSET 28
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Enum2459695545.h"
#include "mscorlib_Mono_Math_BigInteger_Sign874893935.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Mono.Math.BigInteger/Sign
struct Sign_t874893935
{
public:
// System.Int32 Mono.Math.BigInteger/Sign::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Sign_t874893935, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2013 Couchbase, 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 SRC_WORKLOAD_H_
#define SRC_WORKLOAD_H_ 1
#include "config.h"
#include <string>
#include "common.h"
typedef enum {
HIGH_BUCKET_PRIORITY=6,
LOW_BUCKET_PRIORITY=2,
NO_BUCKET_PRIORITY=0
} bucket_priority_t;
typedef enum {
READ_HEAVY,
WRITE_HEAVY,
MIXED
} workload_pattern_t;
/**
* Workload optimization policy
*/
class WorkLoadPolicy {
public:
WorkLoadPolicy(int m, int s)
: maxNumWorkers(m), maxNumShards(s), workloadPattern(READ_HEAVY) { }
size_t getNumShards(void) {
return maxNumShards;
}
bucket_priority_t getBucketPriority(void) {
if (maxNumWorkers < HIGH_BUCKET_PRIORITY) {
return LOW_BUCKET_PRIORITY;
}
return HIGH_BUCKET_PRIORITY;
}
size_t getNumWorkers(void) {
return maxNumWorkers;
}
workload_pattern_t getWorkLoadPattern(void) {
return workloadPattern;
}
std::string stringOfWorkLoadPattern(void) {
switch (workloadPattern) {
case READ_HEAVY:
return "read_heavy";
case WRITE_HEAVY:
return "write_heavy";
default:
return "mixed";
}
}
void setWorkLoadPattern(workload_pattern_t pattern) {
workloadPattern = pattern;
}
private:
int maxNumWorkers;
int maxNumShards;
volatile workload_pattern_t workloadPattern;
};
#endif // SRC_WORKLOAD_H_
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define C_LUCY_FILEHANDLE
#include "Lucy/Util/ToolSet.h"
#include "Lucy/Store/FileHandle.h"
int32_t FH_object_count = 0;
FileHandle*
FH_do_open(FileHandle *self, String *path, uint32_t flags) {
FileHandleIVARS *const ivars = FH_IVARS(self);
ivars->path = path ? Str_Clone(path) : Str_new_from_trusted_utf8("", 0);
ivars->flags = flags;
// Track number of live FileHandles released into the wild.
FH_object_count++;
ABSTRACT_CLASS_CHECK(self, FILEHANDLE);
return self;
}
void
FH_Destroy_IMP(FileHandle *self) {
FileHandleIVARS *const ivars = FH_IVARS(self);
FH_Close(self);
DECREF(ivars->path);
SUPER_DESTROY(self, FILEHANDLE);
// Decrement count of FileHandle objects in existence.
FH_object_count--;
}
bool
FH_Grow_IMP(FileHandle *self, int64_t length) {
UNUSED_VAR(self);
UNUSED_VAR(length);
return true;
}
void
FH_Set_Path_IMP(FileHandle *self, String *path) {
FileHandleIVARS *const ivars = FH_IVARS(self);
DECREF(ivars->path);
ivars->path = Str_Clone(path);
}
String*
FH_Get_Path_IMP(FileHandle *self) {
return FH_IVARS(self)->path;
}
|
@import ObjectiveC;
@class NSArray;
@interface Predicate : NSObject
+ (nonnull Predicate *)truePredicate;
+ (nonnull Predicate *)not;
+ (nonnull Predicate *)and:(nonnull NSArray *)subpredicates;
+ (nonnull Predicate *)or:(nonnull NSArray *)subpredicates;
@end
|
/* $OpenBSD$ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
* Copyright (c) 2014 Tiago Cunha <tcunha@users.sourceforge.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#include "tmux.h"
/* Parse an embedded style of the form "fg=colour,bg=colour,bright,...". */
int
style_parse(const struct grid_cell *defgc, struct grid_cell *gc,
const char *in)
{
const char delimiters[] = " ,";
char tmp[32];
int val;
size_t end;
u_char fg, bg, attr, flags;
if (*in == '\0')
return (0);
if (strchr(delimiters, in[strlen(in) - 1]) != NULL)
return (-1);
fg = gc->fg;
bg = gc->bg;
attr = gc->attr;
flags = gc->flags;
do {
end = strcspn(in, delimiters);
if (end > (sizeof tmp) - 1)
return (-1);
memcpy(tmp, in, end);
tmp[end] = '\0';
if (strcasecmp(tmp, "default") == 0) {
fg = defgc->fg;
bg = defgc->bg;
attr = defgc->attr;
flags &= ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
flags |=
defgc->flags & (GRID_FLAG_FG256|GRID_FLAG_BG256);
} else if (end > 3 && strncasecmp(tmp + 1, "g=", 2) == 0) {
if ((val = colour_fromstring(tmp + 3)) == -1)
return (-1);
if (*in == 'f' || *in == 'F') {
if (val != 8) {
if (val & 0x100) {
flags |= GRID_FLAG_FG256;
val &= ~0x100;
} else
flags &= ~GRID_FLAG_FG256;
fg = val;
} else {
fg = defgc->fg;
flags &= ~GRID_FLAG_FG256;
flags |= defgc->flags & GRID_FLAG_FG256;
}
} else if (*in == 'b' || *in == 'B') {
if (val != 8) {
if (val & 0x100) {
flags |= GRID_FLAG_BG256;
val &= ~0x100;
} else
flags &= ~GRID_FLAG_BG256;
bg = val;
} else {
bg = defgc->bg;
flags &= ~GRID_FLAG_BG256;
flags |= defgc->flags & GRID_FLAG_BG256;
}
} else
return (-1);
} else if (strcasecmp(tmp, "none") == 0)
attr = 0;
else if (end > 2 && strncasecmp(tmp, "no", 2) == 0) {
if ((val = attributes_fromstring(tmp + 2)) == -1)
return (-1);
attr &= ~val;
} else {
if ((val = attributes_fromstring(tmp)) == -1)
return (-1);
attr |= val;
}
in += end + strspn(in + end, delimiters);
} while (*in != '\0');
gc->fg = fg;
gc->bg = bg;
gc->attr = attr;
gc->flags = flags;
return (0);
}
/* Convert style to a string. */
const char *
style_tostring(struct grid_cell *gc)
{
int c, off = 0, comma = 0;
static char s[256];
*s = '\0';
if (gc->fg != 8) {
if (gc->flags & GRID_FLAG_FG256)
c = gc->fg | 0x100;
else
c = gc->fg;
off += xsnprintf(s, sizeof s, "fg=%s", colour_tostring(c));
comma = 1;
}
if (gc->bg != 8) {
if (gc->flags & GRID_FLAG_BG256)
c = gc->bg | 0x100;
else
c = gc->bg;
off += xsnprintf(s + off, sizeof s - off, "%sbg=%s",
comma ? "," : "", colour_tostring(c));
comma = 1;
}
if (gc->attr != 0 && gc->attr != GRID_ATTR_CHARSET) {
xsnprintf(s + off, sizeof s - off, "%s%s",
comma ? "," : "", attributes_tostring(gc->attr));
}
if (*s == '\0')
return ("default");
return (s);
}
/* Synchronize new -style option with the old one. */
void
style_update_new(struct options *oo, const char *name, const char *newname)
{
int value;
struct grid_cell *gc;
/* It's a colour or attribute, but with no -style equivalent. */
if (newname == NULL)
return;
gc = options_get_style(oo, newname);
value = options_get_number(oo, name);
if (strstr(name, "-bg") != NULL)
colour_set_bg(gc, value);
else if (strstr(name, "-fg") != NULL)
colour_set_fg(gc, value);
else if (strstr(name, "-attr") != NULL)
gc->attr = value;
}
/* Synchronize all the old options with the new -style one. */
void
style_update_old(struct options *oo, const char *name, struct grid_cell *gc)
{
char newname[128];
int c, size;
size = strrchr(name, '-') - name;
if (gc->flags & GRID_FLAG_BG256)
c = gc->bg | 0x100;
else
c = gc->bg;
xsnprintf(newname, sizeof newname, "%.*s-bg", size, name);
options_set_number(oo, newname, c);
if (gc->flags & GRID_FLAG_FG256)
c = gc->fg | 0x100;
else
c = gc->fg;
xsnprintf(newname, sizeof newname, "%.*s-fg", size, name);
options_set_number(oo, newname, c);
xsnprintf(newname, sizeof newname, "%.*s-attr", size, name);
options_set_number(oo, newname, gc->attr);
}
/* Apply a style. */
void
style_apply(struct grid_cell *gc, struct options *oo, const char *name)
{
struct grid_cell *gcp;
memcpy(gc, &grid_default_cell, sizeof *gc);
gcp = options_get_style(oo, name);
if (gcp->flags & GRID_FLAG_FG256)
colour_set_fg(gc, gcp->fg | 0x100);
else
colour_set_fg(gc, gcp->fg);
if (gcp->flags & GRID_FLAG_BG256)
colour_set_bg(gc, gcp->bg | 0x100);
else
colour_set_bg(gc, gcp->bg);
gc->attr |= gcp->attr;
}
/* Apply a style, updating if default. */
void
style_apply_update(struct grid_cell *gc, struct options *oo, const char *name)
{
struct grid_cell *gcp;
gcp = options_get_style(oo, name);
if (gcp->fg != 8) {
if (gcp->flags & GRID_FLAG_FG256)
colour_set_fg(gc, gcp->fg | 0x100);
else
colour_set_fg(gc, gcp->fg);
}
if (gcp->bg != 8) {
if (gcp->flags & GRID_FLAG_BG256)
colour_set_bg(gc, gcp->bg | 0x100);
else
colour_set_bg(gc, gcp->bg);
}
if (gcp->attr != 0)
gc->attr |= gcp->attr;
}
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkConjugateGradientLineSearchOptimizerv4_h
#define itkConjugateGradientLineSearchOptimizerv4_h
#include "itkGradientDescentLineSearchOptimizerv4.h"
#include "itkOptimizerParameterScalesEstimator.h"
#include "itkWindowConvergenceMonitoringFunction.h"
namespace itk
{
/**
*\class ConjugateGradientLineSearchOptimizerv4Template
* \brief Conjugate gradient descent optimizer with a golden section line search for nonlinear optimization.
*
* ConjugateGradientLineSearchOptimizer implements a conjugate gradient descent optimizer
* that is followed by a line search to find the best value for the learning rate.
* At each iteration the current position is updated according to
*
* \f[
* p_{n+1} = p_n
* + \mbox{learningRateByGoldenSectionLineSearch}
* \, d
* \f]
*
* where d is defined as the Polak-Ribiere conjugate gradient.
*
* Options are identical to the superclass's.
*
* \ingroup ITKOptimizersv4
*/
template <typename TInternalComputationValueType>
class ITK_TEMPLATE_EXPORT ConjugateGradientLineSearchOptimizerv4Template
: public GradientDescentLineSearchOptimizerv4Template<TInternalComputationValueType>
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(ConjugateGradientLineSearchOptimizerv4Template);
/** Standard class type aliases. */
using Self = ConjugateGradientLineSearchOptimizerv4Template;
using Superclass = GradientDescentLineSearchOptimizerv4Template<TInternalComputationValueType>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
/** Run-time type information (and related methods). */
itkTypeMacro(ConjugateGradientLineSearchOptimizerv4Template, Superclass);
/** New macro for creation of through a Smart Pointer */
itkNewMacro(Self);
/** It should be possible to derive the internal computation type from the class object. */
using InternalComputationValueType = TInternalComputationValueType;
/** Derivative type */
using DerivativeType = typename Superclass::DerivativeType;
/** Metric type over which this class is templated */
using MeasureType = typename Superclass::MeasureType;
/** Type for the convergence checker */
using ConvergenceMonitoringType = itk::Function::WindowConvergenceMonitoringFunction<TInternalComputationValueType>;
void
StartOptimization(bool doOnlyInitialization = false) override;
protected:
/** Advance one Step following the gradient direction.
* Includes transform update. */
void
AdvanceOneStep() override;
/** Default constructor */
ConjugateGradientLineSearchOptimizerv4Template() = default;
/** Destructor */
~ConjugateGradientLineSearchOptimizerv4Template() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
private:
DerivativeType m_LastGradient;
DerivativeType m_ConjugateGradient;
};
/** This helps to meet backward compatibility */
using ConjugateGradientLineSearchOptimizerv4 = ConjugateGradientLineSearchOptimizerv4Template<double>;
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkConjugateGradientLineSearchOptimizerv4.hxx"
#endif
#endif
|
/*
* 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/cognito-idp/CognitoIdentityProvider_EXPORTS.h>
#include <aws/cognito-idp/CognitoIdentityProviderRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace CognitoIdentityProvider
{
namespace Model
{
/**
*/
class AWS_COGNITOIDENTITYPROVIDER_API DeleteIdentityProviderRequest : public CognitoIdentityProviderRequest
{
public:
DeleteIdentityProviderRequest();
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The user pool ID.</p>
*/
inline const Aws::String& GetUserPoolId() const{ return m_userPoolId; }
/**
* <p>The user pool ID.</p>
*/
inline void SetUserPoolId(const Aws::String& value) { m_userPoolIdHasBeenSet = true; m_userPoolId = value; }
/**
* <p>The user pool ID.</p>
*/
inline void SetUserPoolId(Aws::String&& value) { m_userPoolIdHasBeenSet = true; m_userPoolId = std::move(value); }
/**
* <p>The user pool ID.</p>
*/
inline void SetUserPoolId(const char* value) { m_userPoolIdHasBeenSet = true; m_userPoolId.assign(value); }
/**
* <p>The user pool ID.</p>
*/
inline DeleteIdentityProviderRequest& WithUserPoolId(const Aws::String& value) { SetUserPoolId(value); return *this;}
/**
* <p>The user pool ID.</p>
*/
inline DeleteIdentityProviderRequest& WithUserPoolId(Aws::String&& value) { SetUserPoolId(std::move(value)); return *this;}
/**
* <p>The user pool ID.</p>
*/
inline DeleteIdentityProviderRequest& WithUserPoolId(const char* value) { SetUserPoolId(value); return *this;}
/**
* <p>The identity provider name.</p>
*/
inline const Aws::String& GetProviderName() const{ return m_providerName; }
/**
* <p>The identity provider name.</p>
*/
inline void SetProviderName(const Aws::String& value) { m_providerNameHasBeenSet = true; m_providerName = value; }
/**
* <p>The identity provider name.</p>
*/
inline void SetProviderName(Aws::String&& value) { m_providerNameHasBeenSet = true; m_providerName = std::move(value); }
/**
* <p>The identity provider name.</p>
*/
inline void SetProviderName(const char* value) { m_providerNameHasBeenSet = true; m_providerName.assign(value); }
/**
* <p>The identity provider name.</p>
*/
inline DeleteIdentityProviderRequest& WithProviderName(const Aws::String& value) { SetProviderName(value); return *this;}
/**
* <p>The identity provider name.</p>
*/
inline DeleteIdentityProviderRequest& WithProviderName(Aws::String&& value) { SetProviderName(std::move(value)); return *this;}
/**
* <p>The identity provider name.</p>
*/
inline DeleteIdentityProviderRequest& WithProviderName(const char* value) { SetProviderName(value); return *this;}
private:
Aws::String m_userPoolId;
bool m_userPoolIdHasBeenSet;
Aws::String m_providerName;
bool m_providerNameHasBeenSet;
};
} // namespace Model
} // namespace CognitoIdentityProvider
} // namespace Aws
|
/*
* 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/ecr/ECR_EXPORTS.h>
#include <aws/ecr/model/Repository.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace ECR
{
namespace Model
{
class AWS_ECR_API CreateRepositoryResult
{
public:
CreateRepositoryResult();
CreateRepositoryResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
CreateRepositoryResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The repository that was created.</p>
*/
inline const Repository& GetRepository() const{ return m_repository; }
/**
* <p>The repository that was created.</p>
*/
inline void SetRepository(const Repository& value) { m_repository = value; }
/**
* <p>The repository that was created.</p>
*/
inline void SetRepository(Repository&& value) { m_repository = std::move(value); }
/**
* <p>The repository that was created.</p>
*/
inline CreateRepositoryResult& WithRepository(const Repository& value) { SetRepository(value); return *this;}
/**
* <p>The repository that was created.</p>
*/
inline CreateRepositoryResult& WithRepository(Repository&& value) { SetRepository(std::move(value)); return *this;}
private:
Repository m_repository;
};
} // namespace Model
} // namespace ECR
} // namespace Aws
|
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// Enterprise License Manager API (licensing/v1)
// Description:
// Licensing API to view and manage license for your domain.
// Documentation:
// https://developers.google.com/google-apps/licensing/
#import "GTLRLicensingObjects.h"
#import "GTLRLicensingQuery.h"
#import "GTLRLicensingService.h"
|
/*
* Copyright 2012-2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdint.h>
#define MAX_BKEY_LENG 31
#define MAX_EFLAG_LENG 31
typedef struct {
unsigned char from_bkey[MAX_BKEY_LENG];
unsigned char to_bkey[MAX_BKEY_LENG];
uint8_t from_nbkey;
uint8_t to_nbkey;
} bkey_range;
typedef union {
uint64_t ival;
unsigned char cval[MAX_BKEY_LENG];
} bkey1_t;
typedef struct {
bkey1_t from_bkey;
bkey1_t to_bkey;
uint8_t from_nbkey;
uint8_t to_nbkey;
} bkey1_range;
typedef struct {
union {
uint64_t ui;
unsigned char uc[MAX_BKEY_LENG];
} val;
uint8_t len;
} bkey2_t;
typedef struct {
bkey2_t from_bkey;
bkey2_t to_bkey;
} bkey2_range;
typedef union {
uint64_t u64;
struct {
unsigned char val[MAX_BKEY_LENG];
uint8_t len;
} u8;
} bkey3_t;
typedef struct {
bkey3_t from_bkey;
bkey3_t to_bkey;
} bkey3_range;
typedef struct {
unsigned char bitwval[MAX_EFLAG_LENG];
unsigned char compval[MAX_EFLAG_LENG];
uint8_t nbitwval;
uint8_t ncompval;
uint8_t fwhere;
uint8_t bitwise_op;
uint8_t compare_op;
uint8_t reserved[5];
} elem_filter;
typedef struct {
elem_filter efilter;
uint8_t reserved;
bkey1_range bkrange;
} msg_body1;
typedef struct {
elem_filter efilter;
uint32_t reserved1;
uint32_t reserved2;
bkey1_range bkrange;
} msg_body2;
typedef struct {
elem_filter efilter;
uint8_t reserved[8];
bkey1_range bkrange;
} msg_body3;
main()
{
char dummy[2];
char a1;
bkey1_t bkey1;
char b1;
bkey1_range bkey1range;
char a2;
bkey2_t bkey2;
char b2;
bkey2_range bkey2range;
char a3;
bkey3_t bkey3;
char b3;
bkey3_range bkey3range;
fprintf(stderr, "bkey_range=%d, elem_filter=%d\n",
sizeof(bkey_range), sizeof(elem_filter));
fprintf(stderr, "a1=(%x) bkey1_t=(%x,%d), b1=(%x) bkey1_range=(%x,%d)\n",
&a1, &bkey1, sizeof(bkey1), &b1, &bkey1range, sizeof(bkey1range));
fprintf(stderr, "a2=(%x) bkey2_t=(%x,%d), b2=(%x) bkey2_range=(%x,%d)\n",
&a2, &bkey2, sizeof(bkey2), &b2, &bkey2range, sizeof(bkey2range));
fprintf(stderr, "a3=(%x) bkey3_t=(%x,%d), b3=(%x) bkey3_range=(%x,%d)\n",
&a3, &bkey3, sizeof(bkey3), &b3, &bkey3range, sizeof(bkey3range));
fprintf(stderr, "msg_body1=%d, msg_body2=%d, msg_body3=%d\n",
sizeof(msg_body1), sizeof(msg_body2), sizeof(msg_body3));
}
|
/*
* Copyright 2010-2012 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.
*/
#import "../AmazonServiceRequest.h"
#import "EC2Request.h"
#import "EC2PurchaseReservedInstancesOfferingRequest.h"
/**
* Purchase Reserved Instances Offering Request Marshaller
*/
@interface EC2PurchaseReservedInstancesOfferingRequestMarshaller:NSObject {
}
+(AmazonServiceRequest *)createRequest:(EC2PurchaseReservedInstancesOfferingRequest *)purchaseReservedInstancesOfferingRequest;
@end
|
//
// AppDelegate.h
// 截屏、模糊背景图片、获取当前上下文图片
//
// Created by huangchengdu on 15/11/24.
// Copyright © 2015年 huangchengdu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* calculator_impl.h
*
* \date Oct 5, 2011
* \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
#ifndef CALCULATOR_IMPL_H_
#define CALCULATOR_IMPL_H_
#include "celix_errno.h"
#include "calculator_service.h"
typedef struct calculator {
} calculator_t;
calculator_t* calculator_create(void);
void calculator_destroy(calculator_t *calculator);
int calculator_add(calculator_t *calculator, double a, double b, double *result);
int calculator_sub(calculator_t *calculator, double a, double b, double *result);
int calculator_sqrt(calculator_t *calculator, double a, double *result);
#endif /* CALCULATOR_IMPL_H_ */
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _NPL_OS_TYPES_H
#define _NPL_OS_TYPES_H
#include <nuttx/config.h>
#include <time.h>
#include <signal.h>
#include <stdbool.h>
#include <pthread.h>
#include <semaphore.h>
#include <sched.h>
#include <mqueue.h>
/* The highest and lowest task priorities */
#define OS_TASK_PRI_HIGHEST (sched_get_priority_max(SCHED_RR))
#define OS_TASK_PRI_LOWEST (sched_get_priority_min(SCHED_RR))
typedef uint32_t ble_npl_time_t;
typedef int32_t ble_npl_stime_t;
//typedef int os_sr_t;
typedef int ble_npl_stack_t;
struct ble_npl_event {
uint8_t ev_queued;
ble_npl_event_fn *ev_cb;
void *ev_arg;
};
struct ble_npl_eventq {
mqd_t mq;
};
struct ble_npl_callout {
struct ble_npl_event c_ev;
struct ble_npl_eventq *c_evq;
uint32_t c_ticks;
timer_t c_timer;
bool c_active;
};
struct ble_npl_mutex {
pthread_mutex_t lock;
pthread_mutexattr_t attr;
struct timespec wait;
};
struct ble_npl_sem {
sem_t lock;
};
struct ble_npl_task {
pthread_t handle;
pthread_attr_t attr;
struct sched_param param;
const char* name;
};
typedef void *(*ble_npl_task_func_t)(void *);
int ble_npl_task_init(struct ble_npl_task *t, const char *name, ble_npl_task_func_t func,
void *arg, uint8_t prio, ble_npl_time_t sanity_itvl,
ble_npl_stack_t *stack_bottom, uint16_t stack_size);
int ble_npl_task_remove(struct ble_npl_task *t);
uint8_t ble_npl_task_count(void);
void ble_npl_task_yield(void);
#endif // _NPL_OS_TYPES_H
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/appsync/AppSync_EXPORTS.h>
#include <aws/appsync/AppSyncRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>
namespace Aws
{
namespace Http
{
class URI;
} //namespace Http
namespace AppSync
{
namespace Model
{
/**
*/
class AWS_APPSYNC_API UntagResourceRequest : public AppSyncRequest
{
public:
UntagResourceRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "UntagResource"; }
Aws::String SerializePayload() const override;
void AddQueryStringParameters(Aws::Http::URI& uri) const override;
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline const Aws::String& GetResourceArn() const{ return m_resourceArn; }
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; }
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; }
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); }
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); }
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline UntagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;}
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline UntagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;}
/**
* <p>The <code>GraphqlApi</code> ARN.</p>
*/
inline UntagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;}
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline const Aws::Vector<Aws::String>& GetTagKeys() const{ return m_tagKeys; }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline bool TagKeysHasBeenSet() const { return m_tagKeysHasBeenSet; }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline void SetTagKeys(const Aws::Vector<Aws::String>& value) { m_tagKeysHasBeenSet = true; m_tagKeys = value; }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline void SetTagKeys(Aws::Vector<Aws::String>&& value) { m_tagKeysHasBeenSet = true; m_tagKeys = std::move(value); }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline UntagResourceRequest& WithTagKeys(const Aws::Vector<Aws::String>& value) { SetTagKeys(value); return *this;}
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline UntagResourceRequest& WithTagKeys(Aws::Vector<Aws::String>&& value) { SetTagKeys(std::move(value)); return *this;}
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline UntagResourceRequest& AddTagKeys(const Aws::String& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline UntagResourceRequest& AddTagKeys(Aws::String&& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(std::move(value)); return *this; }
/**
* <p>A list of <code>TagKey</code> objects.</p>
*/
inline UntagResourceRequest& AddTagKeys(const char* value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; }
private:
Aws::String m_resourceArn;
bool m_resourceArnHasBeenSet;
Aws::Vector<Aws::String> m_tagKeys;
bool m_tagKeysHasBeenSet;
};
} // namespace Model
} // namespace AppSync
} // namespace Aws
|
#pragma once
// NOLINT(namespace-envoy)
// This file is part of the QUICHE platform implementation, and is not to be
// consumed or referenced directly by other Envoy code. It serves purely as a
// porting layer for QUICHE.
#include "test/common/quic/platform/quic_expect_bug_impl.h"
#define EXPECT_EPOLL_BUG_IMPL EXPECT_QUIC_BUG_IMPL
|
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
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 "paddle/utils/Util.h"
#include <stdio.h>
#include "hl_gpu.h"
#include "paddle/gserver/dataproviders/DataProvider.h"
#include "paddle/gserver/gradientmachines/GradientMachine.h"
#include <stdlib.h>
#include <fstream>
#include "ParameterUpdater.h"
#include "TrainerConfig.pb.h"
#include "TrainerConfigHelper.h"
namespace paddle {
/**
* Configuration for parameter utils.
*/
struct ParameterUtilConfig {
DISABLE_COPY(ParameterUtilConfig);
ParameterUtilConfig(bool save_only_one,
int saving_period,
bool load_save_parameters_in_pserver,
std::string config)
: save_only_one_(save_only_one),
saving_period_(saving_period),
load_save_param_pserver_(load_save_parameters_in_pserver),
config_(config) {}
bool save_only_one_;
int saving_period_;
bool load_save_param_pserver_;
std::string config_;
};
/**
* ParameterUtil
* Utility class for loading and saving parameters
*/
class ParameterUtil {
public:
/**
* Ctor.
*
* @param config
* @param intconfig
* @param gradientMachine
* @param parameterUpdater
* @return
*/
ParameterUtil(const std::shared_ptr<TrainerConfigHelper> &config,
std::unique_ptr<ParameterUtilConfig> &&intconfig,
const GradientMachinePtr &gradientMachine,
const std::shared_ptr<ParameterUpdater> ¶meterUpdater);
/// Load parameter from the saved parameter file as pass passId
/// if loadsave_parameters_in_pserver is set, some parameters MUST
/// load in pserver, which is "remote".
/// loadParameters can choose to load local/remote parameter, or both.
bool loadParameters(int passId, bool local = true, bool remote = false);
/// load parameters given path info
void loadParametersWithPath(const std::string &dir,
bool local = true,
bool remote = false);
/// Save parameter to dist for pass passId
/// passInnerId means saving times in one pass, some users want to
/// save parameters when have processed some batches in one pass
/// passInnerId = 0 means do not need to save in one inner pass
void saveParameters(int passId, int passInnerId = 0);
/// save parameters for one pass, when passInnerId > 0 means saving
/// the passInnerId times in one pass
void saveParametersOnePass(int passId, int passInnerId = 0);
/// delete parameter from disk via passId
void deleteParameters(int passId, int passInnerId = 0);
/// save config given path info
void saveConfigWithPath(const std::string &path);
/**
* Try to load parameter from config.
* @return true if can load from trainer config.
*/
inline bool tryLoadParametersFromConfig() {
auto &c = config_->getConfig();
if (!c.init_model_path().empty()) {
loadParametersWithPath(c.init_model_path());
return true;
} else if (c.start_pass() > 0) {
CHECK(loadParameters(c.start_pass() - 1));
return true;
} else {
return false;
}
}
private:
std::shared_ptr<TrainerConfigHelper> config_;
std::unique_ptr<ParameterUtilConfig> intConfig_;
GradientMachinePtr gserver_;
std::shared_ptr<ParameterUpdater> pUpdater_;
};
} // namespace paddle
|
//
// GTMSignalHandler.h
//
// Copyright 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
//
#import <Foundation/Foundation.h>
#import "GTMDefines.h"
// GTMSignalHandler.
//
// This is a very simple, easy-to-use class for registering handlers that get
// called when a specific signal is delivered. Also handy for ignoring
// inconvenient signals. Ignoring SIGKILL is not support for what should be
// obvious reasons. You can pass nil for target & action to ignore the signal.
//
// Example of how to catch SIGABRT and SIGTERM while ignring SIGWINCH:
// GTMSignalHandler *abrt, *term, *winch;
// abrt = [[GTMSignalHandler alloc]
// initWithSignal:SIGABRT
// target:self
// action:@selector(handleAbort:)];
//
// term = [[GTMSignalHandler alloc]
// initWithSignal:SIGTERM
// target:self
// action:@selector(handleTerm:)];
//
// winch = [[GTMSignalHandler alloc] initWithSignal:SIGWINCH
// initWithSignal:SIGWINCH
// target:nil
// action:NULL
//
// -(void)handleTerm:(int)signo {
// .. do stuff ..
// }
//
// Release the handler when you're no longer interested in handling that signal.
// Note that signal(SIG_IGN, signo) is performed on each signal handled by
// objects of this class, and those do not get un-done.
//
// Multiple handlers for the same signal is NOT supported.
//
// kqueue() is used to handle the signals, and the default runloop for the first
// signal handler is used for signal delivery, so keep that in mind when you're
// using this class. This class explicitly does not handle arbitrary runloops
// and threading.
//
@interface GTMSignalHandler : NSObject {
@private
int signo_;
GTM_WEAK id target_;
SEL action_;
}
// Returns a retained signal handler object that will invoke |handler| on the
// |target| whenever a signal of number |signo| is delivered to the process.
-(id)initWithSignal:(int)signo
target:(id)target
action:(SEL)action;
// Invalidates the handler so that it isn't listening anymore.
- (void)invalidate;
@end
|
// Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and University of
// of Connecticut School of Medicine.
// All rights reserved.
// Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and The University
// of Manchester.
// All rights reserved.
// Copyright (C) 2009 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., EML Research, gGmbH, University of Heidelberg,
// and The University of Manchester.
// All rights reserved.
#ifndef CQSpinBoxDelegate_H
#define CQSpinBoxDelegate_H
#include <QItemDelegate>
class CQSpinBoxDelegate : public QItemDelegate
{
Q_OBJECT
public:
CQSpinBoxDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif //CQSpinBoxDelegate_H
|
#include <stdlib.h>
#include <hyperscene.h>
void initX(void **data){
}
void deleteX(void *data){
}
void XpreRender(void *data){
}
void XpostRender(void *data){
}
void XvisibleNode(void *data, HPSnode *node){
}
void XupdateNode(void *data, HPSnode *node){
}
HPSextension x = {initX,
XpreRender,
XpostRender,
XvisibleNode,
XupdateNode,
deleteX};
HPSextension *X = &x; //external
|
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef HitTestingTransformState_h
#define HitTestingTransformState_h
#include "AffineTransform.h"
#include "FloatPoint.h"
#include "FloatQuad.h"
#include "IntSize.h"
#include "TransformationMatrix.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
// FIXME: Now that TransformState lazily creates its TransformationMatrix it takes up less space.
// So there's really no need for a ref counted version. So This class should be removed and replaced
// with TransformState. There are some minor differences (like the way translate() works slightly
// differently than move()) so care has to be taken when this is done.
class HitTestingTransformState : public RefCounted<HitTestingTransformState> {
public:
static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
{
return adoptRef(new HitTestingTransformState(p, quad, area));
}
static PassRefPtr<HitTestingTransformState> create(const HitTestingTransformState& other)
{
return adoptRef(new HitTestingTransformState(other));
}
enum TransformAccumulation { FlattenTransform, AccumulateTransform };
void translate(int x, int y, TransformAccumulation);
void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation);
FloatPoint mappedPoint() const;
FloatQuad mappedQuad() const;
FloatQuad mappedArea() const;
LayoutRect boundsOfMappedArea() const;
void flatten();
FloatPoint m_lastPlanarPoint;
FloatQuad m_lastPlanarQuad;
FloatQuad m_lastPlanarArea;
TransformationMatrix m_accumulatedTransform;
bool m_accumulatingTransform;
private:
HitTestingTransformState(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
: m_lastPlanarPoint(p)
, m_lastPlanarQuad(quad)
, m_lastPlanarArea(area)
, m_accumulatingTransform(false)
{
}
HitTestingTransformState(const HitTestingTransformState& other)
: RefCounted<HitTestingTransformState>()
, m_lastPlanarPoint(other.m_lastPlanarPoint)
, m_lastPlanarQuad(other.m_lastPlanarQuad)
, m_lastPlanarArea(other.m_lastPlanarArea)
, m_accumulatedTransform(other.m_accumulatedTransform)
, m_accumulatingTransform(other.m_accumulatingTransform)
{
}
void flattenWithTransform(const TransformationMatrix&);
};
} // namespace WebCore
#endif // HitTestingTransformState_h
|
// Copyright 2013, Beeri 15. All rights reserved.
// Author: Roman Gershman (romange@gmail.com)
//
#ifndef VARZ_STATS_H
#define VARZ_STATS_H
#include <atomic>
#include <functional>
#include <mutex>
#include <unordered_map>
#include <string>
#include "base/integral_types.h"
#include "strings/stringpiece.h"
#include "strings/unique_strings.h"
#include "util/stats/sliding_counter.h"
namespace http {
class VarzListNode {
public:
explicit VarzListNode(const char* name);
virtual ~VarzListNode();
// Appends string representations of each active node in the list to res.
// Used for outputting the current state.
static void IterateValues(std::function<void(const std::string&, const std::string&)> cb);
protected:
virtual std::string PrintHTML() const = 0;
private:
// Returns the head to varz linked list. Note that the list becomes invalid after at least one
// linked list node was destroyed.
static VarzListNode* & global_list();
const char* name_;
VarzListNode* next_;
VarzListNode* prev_;
};
/**
Represents a family (map) of counters. Each counter has its own key name.
**/
class VarzMapCount : public VarzListNode {
public:
explicit VarzMapCount(const char* varname) : VarzListNode(varname) {}
// Increments key by delta.
void IncBy(StringPiece key, int32 delta);
void Inc(StringPiece key) { IncBy(key, 1); }
private:
std::string PrintHTML() const override;
mutable std::mutex mutex_;
StringPieceMap<long> map_counts_;
};
// represents a family of averages.
class VarzMapAverage : public VarzListNode {
public:
explicit VarzMapAverage(const char* varname) : VarzListNode(varname) {}
void IncBy(const string& key, double delta);
private:
string PrintHTML() const override;
mutable std::mutex mutex_;
std::unordered_map<string, std::pair<double, unsigned long>> map_;
};
class VarzCount : public VarzListNode {
public:
explicit VarzCount(const char* varname) : VarzListNode(varname) {}
void IncBy(int32 delta) { val_ += delta; }
void Inc() { IncBy(1); }
private:
string PrintHTML() const override;
std::atomic_long val_;
};
class VarzQps : public VarzListNode {
public:
explicit VarzQps(const char* varname) : VarzListNode(varname) {}
void Inc() { val_.Inc(); }
private:
string PrintHTML() const override;
mutable util::QPSCount val_;
};
class VarzFunction : public VarzListNode {
public:
explicit VarzFunction(const char* varname, std::function<string()> cb)
: VarzListNode(varname), cb_(cb) {}
private:
string PrintHTML() const override { return cb_(); }
std::function<string()> cb_;
};
} // namespace http
#endif // VARZ_STATS_H |
/* $FreeBSD: soc2013/dpl/head/sys/arm/include/sigframe.h 129241 2004-05-14 11:46:45Z cognet $ */
#include <machine/frame.h>
|
/*
* custom-macros.h
*
* Created on: 2015-05-21
* Author: Moustafa S. Ibrahim
*/
#ifndef CUSTOM_MACROS_H_
#define CUSTOM_MACROS_H_
namespace MostCV {
#define ALL(v) ((v).begin()), ((v).end())
#define RALL(v) ((v).rbegin()), ((v).rend())
#define SZ(v) ((int)((v).size()))
#define CLR(v, d) memset(v, d, sizeof(v))
#define REP(i, v) for(int i=0;i<SZ(v);++i)
#define REPI(i, j, v) for(int i=(j);i<SZ(v);++i)
//#define REPIT(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define REPIT(i, c) for(auto i = (c).begin(); i != (c).end(); i++)
#define LP(i, n) for(int i=0;i<(int)(n);++i)
#define LPI(i, j, n) for(int i=(j);i<(int)(n);++i)
#define LPD(i, j, n) for(int i=(j);i>=(int)(n);--i)
#define REPA(v) lpi(i, 0, SZ(v)) lpi(j, 0, SZ(v[i]))
// ToDo: http://www.quora.com/What-are-some-macros-that-are-used-in-programming-contests
}
#endif /* CUSTOM_MACROS_H_ */
|
/////////////////////////////////////////////////////////////////////////////
// ARGSS - Copyright (c) 2009 - 2010, Alejandro Marzini (vgvgf)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/////////////////////////////////////////////////////////////////////////////
#ifndef _ARGSS_SPRITE_H_
#define _ARGSS_SPRITE_H_
///////////////////////////////////////////////////////////
// Headers
///////////////////////////////////////////////////////////
#include "aruby.h"
namespace ARGSS {
///////////////////////////////////////////////////////
/// ARGSS::Sprite namespace
///////////////////////////////////////////////////////
namespace ASprite {
///////////////////////////////////////////////////
/// Initialize Sprite class.
///////////////////////////////////////////////////
void Init();
///////////////////////////////////////////////////
/// Check if Sprite is disposed.
/// An error will be raised if it is disposed.
///////////////////////////////////////////////////
void CheckDisposed(VALUE id);
/// Sprite class id.
extern VALUE id;
///////////////////////////////////////////////////
/// Sprite instance methods.
///////////////////////////////////////////////////
//@{
VALUE rinitialize(int argc, VALUE* argv, VALUE self);
VALUE rdispose(VALUE self);
VALUE rdisposedQ(VALUE self);
VALUE rflash(VALUE self, VALUE color, VALUE duration);
VALUE rupdate(VALUE self);
VALUE rwidth(VALUE self);
VALUE rheight(VALUE self);
VALUE rviewport(VALUE self);
VALUE rviewportE(VALUE self, VALUE viewport);
VALUE rbitmap(VALUE self);
VALUE rbitmapE(VALUE self, VALUE bitmap);
VALUE rsrc_rect(VALUE self);
VALUE rsrc_rectE(VALUE self, VALUE src_rect);
VALUE rvisible(VALUE self);
VALUE rvisibleE(VALUE self, VALUE visible);
VALUE rx(VALUE self);
VALUE rfx(VALUE self);
VALUE rxE(VALUE self, VALUE x);
VALUE ry(VALUE self);
VALUE rfy(VALUE self);
VALUE ryE(VALUE self, VALUE y);
VALUE rz(VALUE self);
VALUE rzE(VALUE self, VALUE z);
VALUE rox(VALUE self);
VALUE roxE(VALUE self, VALUE ox);
VALUE roy(VALUE self);
VALUE royE(VALUE self, VALUE oy);
VALUE rzoom_x(VALUE self);
VALUE rzoom_xE(VALUE self, VALUE zoom_x);
VALUE rzoom_y(VALUE self);
VALUE rzoom_yE(VALUE self, VALUE zoom_y);
VALUE rangle(VALUE self);
VALUE rangleE(VALUE self, VALUE angle);
VALUE rmirror(VALUE self);
VALUE rmirrorE(VALUE self, VALUE mirror);
VALUE rflipx(VALUE self);
VALUE rflipxE(VALUE self, VALUE flipx);
VALUE rflipy(VALUE self);
VALUE rflipyE(VALUE self, VALUE flipy);
VALUE rbush_depth(VALUE self);
VALUE rbush_depthE(VALUE self, VALUE bush_depth);
VALUE ropacity(VALUE self);
VALUE ropacityE(VALUE self, VALUE opacity);
VALUE rblend_type(VALUE self);
VALUE rblend_typeE(VALUE self, VALUE blend_type);
VALUE rcolor(VALUE self);
VALUE rcolorE(VALUE self, VALUE color);
VALUE rtone(VALUE self);
VALUE rtoneE(VALUE self, VALUE tone);
//@}
};
};
#endif
|
/* Public domain */
#include <core/core.h>
static Uint32
DUMMY_GetTicks(void)
{
static Uint32 t = 0;
return t++;
}
static void
DUMMY_Delay(Uint32 ticks)
{
}
const AG_TimeOps agTimeOps_dummy = {
"dummy",
NULL, /* init */
NULL, /* destroy */
DUMMY_GetTicks,
DUMMY_Delay
};
|
extern zend_class_entry *ice_mvc_route_collector_ce;
ZEPHIR_INIT_CLASS(Ice_Mvc_Route_Collector);
PHP_METHOD(Ice_Mvc_Route_Collector, setRouteParser);
PHP_METHOD(Ice_Mvc_Route_Collector, setDataGenerator);
PHP_METHOD(Ice_Mvc_Route_Collector, __construct);
PHP_METHOD(Ice_Mvc_Route_Collector, addRoute);
PHP_METHOD(Ice_Mvc_Route_Collector, getData);
ZEND_BEGIN_ARG_INFO_EX(arginfo_ice_mvc_route_collector_setrouteparser, 0, 0, 1)
ZEND_ARG_INFO(0, routeParser)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ice_mvc_route_collector_setdatagenerator, 0, 0, 1)
ZEND_ARG_INFO(0, dataGenerator)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ice_mvc_route_collector___construct, 0, 0, 0)
ZEND_ARG_OBJ_INFO(0, routeParser, Ice\\Mvc\\Route\\Parser\\ParserInterface, 1)
ZEND_ARG_OBJ_INFO(0, dataGenerator, Ice\\Mvc\\Route\\DataGenerator\\DataGeneratorInterface, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_ice_mvc_route_collector_addroute, 0, 0, 2)
ZEND_ARG_INFO(0, httpMethod)
#if PHP_VERSION_ID >= 70200
ZEND_ARG_TYPE_INFO(0, route, IS_STRING, 0)
#else
ZEND_ARG_INFO(0, route)
#endif
ZEND_ARG_INFO(0, handler)
ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(ice_mvc_route_collector_method_entry) {
PHP_ME(Ice_Mvc_Route_Collector, setRouteParser, arginfo_ice_mvc_route_collector_setrouteparser, ZEND_ACC_PUBLIC)
PHP_ME(Ice_Mvc_Route_Collector, setDataGenerator, arginfo_ice_mvc_route_collector_setdatagenerator, ZEND_ACC_PUBLIC)
PHP_ME(Ice_Mvc_Route_Collector, __construct, arginfo_ice_mvc_route_collector___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Ice_Mvc_Route_Collector, addRoute, arginfo_ice_mvc_route_collector_addroute, ZEND_ACC_PUBLIC)
PHP_ME(Ice_Mvc_Route_Collector, getData, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
|
/* Copyright (c) 2014, ENEA Software AB
* Copyright (c) 2014, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __OFPI_QUEUE_H_
#define __OFPI_QUEUE_H_
#include "api/ofp_queue.h"
#endif /* __OFPI_QUEUE_H__ */
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "base/values.h"
#include "chrome/browser/notifications/notification_delegate.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/notifications/notification_types.h"
// Representation of a notification to be shown to the user.
// On non-Ash platforms these are rendered as HTML, sometimes described by a
// data url converted from text + icon data. On Ash they are rendered as
// formated text and icon data.
class Notification {
public:
// Initializes a notification with HTML content.
Notification(const GURL& origin_url,
const GURL& content_url,
const string16& display_source,
const string16& replace_id,
NotificationDelegate* delegate);
// Initializes a notification with text content. On non-ash platforms, this
// creates an HTML representation using a data: URL for display.
Notification(const GURL& origin_url,
const GURL& icon_url,
const string16& title,
const string16& body,
WebKit::WebTextDirection dir,
const string16& display_source,
const string16& replace_id,
NotificationDelegate* delegate);
// Initializes a notification with a given type. Takes ownership of
// optional_fields.
Notification(ui::notifications::NotificationType type,
const GURL& icon_url,
const string16& title,
const string16& body,
WebKit::WebTextDirection dir,
const string16& display_source,
const string16& replace_id,
const DictionaryValue* optional_fields,
NotificationDelegate* delegate);
// Initializes a notification with text content and an icon image. Currently
// only used on Ash. Does not generate content_url_.
Notification(const GURL& origin_url,
const gfx::ImageSkia& icon,
const string16& title,
const string16& body,
WebKit::WebTextDirection dir,
const string16& display_source,
const string16& replace_id,
NotificationDelegate* delegate);
Notification(const Notification& notification);
~Notification();
Notification& operator=(const Notification& notification);
// If this is a HTML notification.
bool is_html() const { return is_html_; }
ui::notifications::NotificationType type() const {
return type_;
}
// The URL (may be data:) containing the contents for the notification.
const GURL& content_url() const { return content_url_; }
// Title and message text of the notification.
const string16& title() const { return title_; }
const string16& body() const { return body_; }
// The origin URL of the script which requested the notification.
const GURL& origin_url() const { return origin_url_; }
// A url for the icon to be shown (optional).
const GURL& icon_url() const { return icon_url_; }
// An image for the icon to be shown (optional).
const gfx::ImageSkia& icon() const { return icon_; }
// A display string for the source of the notification.
const string16& display_source() const { return display_source_; }
// A unique identifier used to update (replace) or remove a notification.
const string16& replace_id() const { return replace_id_; }
const DictionaryValue* optional_fields() const {
return optional_fields_.get();
}
void Display() const { delegate()->Display(); }
void Error() const { delegate()->Error(); }
void Click() const { delegate()->Click(); }
void ButtonClick(int index) const { delegate()->ButtonClick(index); }
void Close(bool by_user) const { delegate()->Close(by_user); }
std::string notification_id() const { return delegate()->id(); }
content::RenderViewHost* GetRenderViewHost() const {
return delegate()->GetRenderViewHost();
}
private:
NotificationDelegate* delegate() const { return delegate_.get(); }
// The type of notification we'd like displayed.
ui::notifications::NotificationType type_;
// The Origin of the page/worker which created this notification.
GURL origin_url_;
// Image data for the associated icon, used by Ash when available.
gfx::ImageSkia icon_;
// URL for the icon associated with the notification. Requires delegate_
// to have a non NULL RenderViewHost.
GURL icon_url_;
// If this is a HTML notification, the content is in |content_url_|. If
// false, the data is in |title_| and |body_|.
bool is_html_;
// The URL of the HTML content of the toast (may be a data: URL for simple
// string-based notifications).
GURL content_url_;
// The content for a text notification.
string16 title_;
string16 body_;
// The display string for the source of the notification. Could be
// the same as origin_url_, or the name of an extension.
string16 display_source_;
// The replace ID for the notification.
string16 replace_id_;
scoped_ptr<DictionaryValue> optional_fields_;
// A proxy object that allows access back to the JavaScript object that
// represents the notification, for firing events.
scoped_refptr<NotificationDelegate> delegate_;
};
#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
|
/**
* \file sha2.h
*
* \brief SHA-224 and SHA-256 cryptographic hash function
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef POLARSSL_SHA2_H
#define POLARSSL_SHA2_H
#include <string.h>
/**
* \brief SHA-256 context structure
*/
typedef struct
{
unsigned long total[2]; /*!< number of bytes processed */
unsigned long state[8]; /*!< intermediate digest state */
unsigned char buffer[64]; /*!< data block being processed */
unsigned char ipad[64]; /*!< HMAC: inner padding */
unsigned char opad[64]; /*!< HMAC: outer padding */
int is224; /*!< 0 => SHA-256, else SHA-224 */
}
sha2_context;
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief SHA-256 context setup
*
* \param ctx context to be initialized
* \param is224 0 = use SHA256, 1 = use SHA224
*/
void sha2_starts( sha2_context *ctx, int is224 );
/**
* \brief SHA-256 process buffer
*
* \param ctx SHA-256 context
* \param input buffer holding the data
* \param ilen length of the input data
*/
void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
/**
* \brief SHA-256 final digest
*
* \param ctx SHA-256 context
* \param output SHA-224/256 checksum result
*/
void sha2_finish( sha2_context *ctx, unsigned char output[32] );
/**
* \brief Output = SHA-256( input buffer )
*
* \param input buffer holding the data
* \param ilen length of the input data
* \param output SHA-224/256 checksum result
* \param is224 0 = use SHA256, 1 = use SHA224
*/
void sha2( const unsigned char *input, size_t ilen,
unsigned char output[32], int is224 );
/**
* \brief Output = SHA-256( file contents )
*
* \param path input file name
* \param output SHA-224/256 checksum result
* \param is224 0 = use SHA256, 1 = use SHA224
*
* \return 0 if successful, 1 if fopen failed,
* or 2 if fread failed
*/
int sha2_file( const char *path, unsigned char output[32], int is224 );
/**
* \brief SHA-256 HMAC context setup
*
* \param ctx HMAC context to be initialized
* \param key HMAC secret key
* \param keylen length of the HMAC key
* \param is224 0 = use SHA256, 1 = use SHA224
*/
void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, size_t keylen,
int is224 );
/**
* \brief SHA-256 HMAC process buffer
*
* \param ctx HMAC context
* \param input buffer holding the data
* \param ilen length of the input data
*/
void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
/**
* \brief SHA-256 HMAC final digest
*
* \param ctx HMAC context
* \param output SHA-224/256 HMAC checksum result
*/
void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
/**
* \brief SHA-256 HMAC context reset
*
* \param ctx HMAC context to be reset
*/
void sha2_hmac_reset( sha2_context *ctx );
/**
* \brief Output = HMAC-SHA-256( hmac key, input buffer )
*
* \param key HMAC secret key
* \param keylen length of the HMAC key
* \param input buffer holding the data
* \param ilen length of the input data
* \param output HMAC-SHA-224/256 result
* \param is224 0 = use SHA256, 1 = use SHA224
*/
void sha2_hmac( const unsigned char *key, size_t keylen,
const unsigned char *input, size_t ilen,
unsigned char output[32], int is224 );
/**
* \brief Checkup routine
*
* \return 0 if successful, or 1 if the test failed
*/
int sha2_self_test( int verbose );
#ifdef __cplusplus
}
#endif
#endif /* sha2.h */
|
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
#define RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
#if defined(DART_PRECOMPILED_RUNTIME)
#error "AOT runtime should not use compiler sources (including header files)"
#endif // defined(DART_PRECOMPILED_RUNTIME)
#include "vm/compiler/backend/locations.h"
#include "vm/compiler/ffi/native_location.h"
#include "vm/compiler/ffi/native_type.h"
#include "vm/compiler/runtime_api.h"
#include "vm/thread.h"
namespace dart {
namespace compiler {
namespace ffi {
// Describes a change of stack frame where the stack or base register or stack
// offset may change. This class allows easily rebasing stack locations across
// frame manipulations.
//
// If the stack offset register matches 'old_base', it is changed to 'new_base'
// and 'stack_delta_in_bytes' (# of bytes) is applied.
//
// This class can be used to rebase both Locations and NativeLocations.
class FrameRebase : public ValueObject {
public:
FrameRebase(Zone* zone,
const Register old_base,
const Register new_base,
intptr_t stack_delta_in_bytes)
: zone_(zone),
old_base_(old_base),
new_base_(new_base),
stack_delta_in_bytes_(stack_delta_in_bytes) {}
const NativeLocation& Rebase(const NativeLocation& loc) const;
Location Rebase(const Location loc) const;
private:
Zone* zone_;
const Register old_base_;
const Register new_base_;
const intptr_t stack_delta_in_bytes_;
};
} // namespace ffi
} // namespace compiler
} // namespace dart
#endif // RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
|
#include "ccv.h"
int main(int argc, char** argv)
{
ccv_dense_matrix_t* image = 0;
ccv_unserialize(argv[1], &image, CCV_SERIAL_ANY_FILE);
ccv_dense_matrix_t* a = ccv_dense_matrix_new(image->rows, image->cols, CCV_32F | CCV_C1, 0, 0);
ccv_dense_matrix_t* b = ccv_dense_matrix_new(5, 5, CCV_32F | CCV_C1, 0, 0);
int i, j;
for (i = 0; i < image->rows; i++)
for (j = 0; j < image->cols; j++)
a->data.fl[i * a->cols + j] = (image->data.ptr[i * image->step + j * 3] * 29 + image->data.ptr[i * image->step + j * 3 + 1] * 61 + image->data.ptr[i * image->step + j * 3 + 2] * 10) / 100;
double tb = 0;
for (i = 0; i < b->rows; i++)
for (j = 0; j < b->cols; j++)
tb += b->data.fl[i * b->cols + j] = exp(-((i - b->rows / 2) * (i - b->rows / 2) + (j - b->cols / 2) * (j - b->cols / 2)) / 10);
for (i = 0; i < b->rows; i++)
for (j = 0; j < b->cols; j++)
b->data.fl[i * b->cols + j] /= tb;
ccv_dense_matrix_t* x = 0;
ccv_filter(a, b, (ccv_matrix_t**)&x, 0);
ccv_dense_matrix_t* imx = ccv_dense_matrix_new(x->rows, x->cols, CCV_8U | CCV_C1, 0, 0);
for (i = 0; i < x->rows; i++)
for (j = 0; j < x->cols; j++)
imx->data.ptr[i * imx->step + j] = ccv_clamp((int)x->data.fl[i * x->cols + j], 0, 255);
int len;
ccv_serialize(imx, argv[2], &len, CCV_SERIAL_JPEG_FILE, 0);
ccv_matrix_free(image);
ccv_matrix_free(a);
ccv_matrix_free(b);
ccv_matrix_free(x);
ccv_matrix_free(imx);
ccv_garbage_collect();
return 0;
}
|
/*
* Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IntSize_h
#define IntSize_h
#include <wtf/Platform.h>
#if OS(DARWIN)
typedef struct CGSize CGSize;
#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
typedef struct CGSize NSSize;
#else
typedef struct _NSSize NSSize;
#endif
#endif
namespace WebCore {
class IntSize {
public:
IntSize() : m_width(0), m_height(0) { }
IntSize(int width, int height) : m_width(width), m_height(height) { }
int width() const { return m_width; }
int height() const { return m_height; }
void setWidth(int width) { m_width = width; }
void setHeight(int height) { m_height = height; }
bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
bool isZero() const { return !m_width && !m_height; }
float aspectRatio() const { return static_cast<float>(m_width) / static_cast<float>(m_height); }
void expand(int width, int height)
{
m_width += width;
m_height += height;
}
void scale(float widthScale, float heightScale)
{
m_width = static_cast<int>(static_cast<float>(m_width) * widthScale);
m_height = static_cast<int>(static_cast<float>(m_height) * heightScale);
}
void scale(float scale)
{
this->scale(scale, scale);
}
IntSize expandedTo(const IntSize& other) const
{
return IntSize(m_width > other.m_width ? m_width : other.m_width,
m_height > other.m_height ? m_height : other.m_height);
}
IntSize shrunkTo(const IntSize& other) const
{
return IntSize(m_width < other.m_width ? m_width : other.m_width,
m_height < other.m_height ? m_height : other.m_height);
}
void clampNegativeToZero()
{
*this = expandedTo(IntSize());
}
void clampToMinimumSize(const IntSize& minimumSize)
{
if (m_width < minimumSize.width())
m_width = minimumSize.width();
if (m_height < minimumSize.height())
m_height = minimumSize.height();
}
int area() const
{
return m_width * m_height;
}
int diagonalLengthSquared() const
{
return m_width * m_width + m_height * m_height;
}
IntSize transposedSize() const
{
return IntSize(m_height, m_width);
}
#if OS(DARWIN)
explicit IntSize(const CGSize&); // don't do this implicitly since it's lossy
operator CGSize() const;
#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
explicit IntSize(const NSSize &); // don't do this implicitly since it's lossy
operator NSSize() const;
#endif
#endif
private:
int m_width, m_height;
};
inline IntSize& operator+=(IntSize& a, const IntSize& b)
{
a.setWidth(a.width() + b.width());
a.setHeight(a.height() + b.height());
return a;
}
inline IntSize& operator-=(IntSize& a, const IntSize& b)
{
a.setWidth(a.width() - b.width());
a.setHeight(a.height() - b.height());
return a;
}
inline IntSize operator+(const IntSize& a, const IntSize& b)
{
return IntSize(a.width() + b.width(), a.height() + b.height());
}
inline IntSize operator-(const IntSize& a, const IntSize& b)
{
return IntSize(a.width() - b.width(), a.height() - b.height());
}
inline IntSize operator-(const IntSize& size)
{
return IntSize(-size.width(), -size.height());
}
inline bool operator==(const IntSize& a, const IntSize& b)
{
return a.width() == b.width() && a.height() == b.height();
}
inline bool operator!=(const IntSize& a, const IntSize& b)
{
return a.width() != b.width() || a.height() != b.height();
}
} // namespace WebCore
#endif // IntSize_h
|
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1992, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*/
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: v_undo.c,v 10.6 2001/06/25 15:19:36 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
#include <bitstring.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../common/common.h"
#include "vi.h"
/*
* v_Undo -- U
* Undo changes to this line.
*
* PUBLIC: int v_Undo __P((SCR *, VICMD *));
*/
int
v_Undo(SCR *sp, VICMD *vp)
{
/*
* Historically, U reset the cursor to the first column in the line
* (not the first non-blank). This seems a bit non-intuitive, but,
* considering that we may have undone multiple changes, anything
* else (including the cursor position stored in the logging records)
* is going to appear random.
*/
vp->m_final.cno = 0;
/*
* !!!
* Set up the flags so that an immediately subsequent 'u' will roll
* forward, instead of backward. In historic vi, a 'u' following a
* 'U' redid all of the changes to the line. Given that the user has
* explicitly discarded those changes by entering 'U', it seems likely
* that the user wants something between the original and end forms of
* the line, so starting to replay the changes seems the best way to
* get to there.
*/
F_SET(sp->ep, F_UNDO);
sp->ep->lundo = BACKWARD;
return (log_setline(sp));
}
/*
* v_undo -- u
* Undo the last change.
*
* PUBLIC: int v_undo __P((SCR *, VICMD *));
*/
int
v_undo(SCR *sp, VICMD *vp)
{
EXF *ep;
/* Set the command count. */
VIP(sp)->u_ccnt = sp->ccnt;
/*
* !!!
* In historic vi, 'u' toggled between "undo" and "redo", i.e. 'u'
* undid the last undo. However, if there has been a change since
* the last undo/redo, we always do an undo. To make this work when
* the user can undo multiple operations, we leave the old semantic
* unchanged, but make '.' after a 'u' do another undo/redo operation.
* This has two problems.
*
* The first is that 'u' didn't set '.' in historic vi. So, if a
* user made a change, realized it was in the wrong place, does a
* 'u' to undo it, moves to the right place and then does '.', the
* change was reapplied. To make this work, we only apply the '.'
* to the undo command if it's the command immediately following an
* undo command. See vi/vi.c:getcmd() for the details.
*
* The second is that the traditional way to view the numbered cut
* buffers in vi was to enter the commands "1pu.u.u.u. which will
* no longer work because the '.' immediately follows the 'u' command.
* Since we provide a much better method of viewing buffers, and
* nobody can think of a better way of adding in multiple undo, this
* remains broken.
*
* !!!
* There is change to historic practice for the final cursor position
* in this implementation. In historic vi, if an undo was isolated to
* a single line, the cursor moved to the start of the change, and
* then, subsequent 'u' commands would not move it again. (It has been
* pointed out that users used multiple undo commands to get the cursor
* to the start of the changed text.) Nvi toggles between the cursor
* position before and after the change was made. One final issue is
* that historic vi only did this if the user had not moved off of the
* line before entering the undo command; otherwise, vi would move the
* cursor to the most attractive position on the changed line.
*
* It would be difficult to match historic practice in this area. You
* not only have to know that the changes were isolated to one line,
* but whether it was the first or second undo command as well. And,
* to completely match historic practice, we'd have to track users line
* changes, too. This isn't worth the effort.
*/
ep = sp->ep;
if (!F_ISSET(ep, F_UNDO)) {
F_SET(ep, F_UNDO);
ep->lundo = BACKWARD;
} else if (!F_ISSET(vp, VC_ISDOT))
ep->lundo = ep->lundo == BACKWARD ? FORWARD : BACKWARD;
switch (ep->lundo) {
case BACKWARD:
return (log_backward(sp, &vp->m_final));
case FORWARD:
return (log_forward(sp, &vp->m_final));
default:
abort();
}
/* NOTREACHED */
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53b.c
Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml
Template File: sources-vasinks-53b.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Copy a fixed string into data
* Sinks: vprintf
* GoodSink: vprintf with a format string
* BadSink : vprintf without a format string
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include <stdarg.h>
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
#ifndef OMITBAD
/* bad function declaration */
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_badSink(char * data);
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53b_badSink(char * data)
{
CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_goodG2BSink(char * data);
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53b_goodG2BSink(char * data)
{
CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_goodB2GSink(char * data);
void CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53b_goodB2GSink(char * data)
{
CWE134_Uncontrolled_Format_String__char_listen_socket_vprintf_53c_goodB2GSink(data);
}
#endif /* OMITGOOD */
|
/* $NetBSD: endian_machdep.h,v 1.1 2000/05/25 22:11:59 is Exp $ */
#include <powerpc/endian_machdep.h>
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE690_NULL_Deref_From_Return__wchar_t_realloc_02.c
Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml
Template File: source-sinks-02.tmpl.c
*/
/*
* @description
* CWE: 690 Unchecked Return Value To NULL Pointer
* BadSource: realloc Allocate data using realloc()
* Sinks:
* GoodSink: Check to see if the data allocation failed and if not, use data
* BadSink : Don't check for NULL and use data
* Flow Variant: 02 Control flow: if(1) and if(0)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE690_NULL_Deref_From_Return__wchar_t_realloc_02_bad()
{
wchar_t * data;
data = NULL; /* Initialize data */
/* POTENTIAL FLAW: Allocate memory without checking if the memory allocation function failed */
data = (wchar_t *)realloc(data, 20*sizeof(wchar_t));
if(1)
{
/* FLAW: Initialize memory buffer without checking to see if the memory allocation function failed */
wcscpy(data, L"Initialize");
printWLine(data);
free(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing 1 to 0 */
static void goodB2G1()
{
wchar_t * data;
data = NULL; /* Initialize data */
/* POTENTIAL FLAW: Allocate memory without checking if the memory allocation function failed */
data = (wchar_t *)realloc(data, 20*sizeof(wchar_t));
if(0)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Check to see if the memory allocation function was successful before initializing the memory buffer */
if (data != NULL)
{
wcscpy(data, L"Initialize");
printWLine(data);
free(data);
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing statements in if */
static void goodB2G2()
{
wchar_t * data;
data = NULL; /* Initialize data */
/* POTENTIAL FLAW: Allocate memory without checking if the memory allocation function failed */
data = (wchar_t *)realloc(data, 20*sizeof(wchar_t));
if(1)
{
/* FIX: Check to see if the memory allocation function was successful before initializing the memory buffer */
if (data != NULL)
{
wcscpy(data, L"Initialize");
printWLine(data);
free(data);
}
}
}
void CWE690_NULL_Deref_From_Return__wchar_t_realloc_02_good()
{
goodB2G1();
goodB2G2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE690_NULL_Deref_From_Return__wchar_t_realloc_02_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE690_NULL_Deref_From_Return__wchar_t_realloc_02_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE665_Improper_Initialization__char_ncat_63b.c
Label Definition File: CWE665_Improper_Initialization.label.xml
Template File: sources-sink-63b.tmpl.c
*/
/*
* @description
* CWE: 665 Improper Initialization
* BadSource: Do not initialize data properly
* GoodSource: Initialize data
* Sinks: ncat
* BadSink : Copy string to data using strncat
* Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE665_Improper_Initialization__char_ncat_63b_badSink(char * * dataPtr)
{
char * data = *dataPtr;
{
size_t sourceLen;
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
sourceLen = strlen(source);
/* POTENTIAL FLAW: If data is not initialized properly, strncat() may not function correctly */
strncat(data, source, sourceLen);
printLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE665_Improper_Initialization__char_ncat_63b_goodG2BSink(char * * dataPtr)
{
char * data = *dataPtr;
{
size_t sourceLen;
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
sourceLen = strlen(source);
/* POTENTIAL FLAW: If data is not initialized properly, strncat() may not function correctly */
strncat(data, source, sourceLen);
printLine(data);
}
}
#endif /* OMITGOOD */
|
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
#define CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
class CefBrowser;
class CefSchemeRegistrar;
namespace scheme_test {
// Register the scheme.
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
// Create the scheme handler.
void InitTest();
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace scheme_test
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
// g2o - General Graph Optimization
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef G2O_STUFF_MISC_H
#define G2O_STUFF_MISC_H
#include <cmath>
#include "g2o/stuff/macros.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/** @addtogroup utils **/
// @{
/** \file misc.h
* \brief some general case utility functions
*
* This file specifies some general case utility functions
**/
namespace g2o {
/**
* return the square value
*/
template <typename T>
inline T square(T x)
{
return x*x;
}
/**
* return the hypot of x and y
*/
template <typename T>
inline T hypot(T x, T y)
{
return (T) (sqrt(x*x + y*y));
}
/**
* return the squared hypot of x and y
*/
template <typename T>
inline T hypot_sqr(T x, T y)
{
return x*x + y*y;
}
/**
* convert from degree to radian
*/
inline double deg2rad(double degree)
{
return degree * 0.01745329251994329576;
}
/**
* convert from radian to degree
*/
inline double rad2deg(double rad)
{
return rad * 57.29577951308232087721;
}
/**
* normalize the angle
*/
inline double normalize_theta(double theta)
{
if (theta >= -M_PI && theta < M_PI)
return theta;
double multiplier = floor(theta / (2*M_PI));
theta = theta - multiplier*2*M_PI;
if (theta >= M_PI)
theta -= 2*M_PI;
if (theta < -M_PI)
theta += 2*M_PI;
return theta;
}
/**
* inverse of an angle, i.e., +180 degree
*/
inline double inverse_theta(double th)
{
return normalize_theta(th + M_PI);
}
/**
* average two angles
*/
inline double average_angle(double theta1, double theta2)
{
double x, y;
x = cos(theta1) + cos(theta2);
y = sin(theta1) + sin(theta2);
if(x == 0 && y == 0)
return 0;
else
return std::atan2(y, x);
}
/**
* sign function.
* @return the sign of x. +1 for x > 0, -1 for x < 0, 0 for x == 0
*/
template <typename T>
inline int sign(T x)
{
if (x > 0)
return 1;
else if (x < 0)
return -1;
else
return 0;
}
/**
* clamp x to the interval [l, u]
*/
template <typename T>
inline T clamp(T l, T x, T u)
{
if (x < l)
return l;
if (x > u)
return u;
return x;
}
/**
* wrap x to be in the interval [l, u]
*/
template <typename T>
inline T wrap(T l, T x, T u)
{
T intervalWidth = u - l;
while (x < l)
x += intervalWidth;
while (x > u)
x -= intervalWidth;
return x;
}
/**
* tests whether there is a NaN in the array
*/
inline bool arrayHasNaN(const double* array, int size, int* nanIndex = 0)
{
for (int i = 0; i < size; ++i)
if (g2o_isnan(array[i])) {
if (nanIndex)
*nanIndex = i;
return true;
}
return false;
}
/**
* The following two functions are used to force linkage with static libraries.
*/
extern "C"
{
typedef void (* ForceLinkFunction) (void);
}
struct ForceLinker
{
ForceLinker(ForceLinkFunction function) { (function)(); }
};
} // end namespace
// @}
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_
#define SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_
#include <vector>
#include "base/macros.h"
#include "sync/engine/model_type_sync_worker.h"
#include "sync/engine/non_blocking_sync_common.h"
namespace syncer {
// Receives and records commit requests sent through the ModelTypeSyncWorker.
//
// This class also includes features intended to help mock out server behavior.
// It has some basic functionality to keep track of server state and generate
// plausible UpdateResponseData and CommitResponseData messages.
class MockModelTypeSyncWorker : public ModelTypeSyncWorker {
public:
MockModelTypeSyncWorker();
virtual ~MockModelTypeSyncWorker();
// Implementation of ModelTypeSyncWorker.
virtual void EnqueueForCommit(const CommitRequestDataList& list) OVERRIDE;
// Getters to inspect the requests sent to this object.
size_t GetNumCommitRequestLists() const;
CommitRequestDataList GetNthCommitRequestList(size_t n) const;
bool HasCommitRequestForTagHash(const std::string& tag_hash) const;
CommitRequestData GetLatestCommitRequestForTagHash(
const std::string& tag_hash) const;
// Functions to produce state as though it came from a real server and had
// been filtered through a real ModelTypeSyncWorker.
// Returns an UpdateResponseData representing an update received from
// the server. Updates server state accordingly.
//
// The |version_offset| field can be used to emulate stale data (ie. versions
// going backwards), reflections and redeliveries (ie. several instances of
// the same version) or new updates.
UpdateResponseData UpdateFromServer(
int64 version_offset,
const std::string& tag_hash,
const sync_pb::EntitySpecifics& specifics);
// Returns an UpdateResponseData representing a tombstone update from the
// server. Updates server state accordingly.
UpdateResponseData TombstoneFromServer(int64 version_offset,
const std::string& tag_hash);
// Returns a commit response that indicates a successful commit of the
// given |request_data|. Updates server state accordingly.
CommitResponseData SuccessfulCommitResponse(
const CommitRequestData& request_data);
private:
// Generate an ID string.
static std::string GenerateId(const std::string& tag_hash);
// Retrieve or set the server version.
int64 GetServerVersion(const std::string& tag_hash);
void SetServerVersion(const std::string& tag_hash, int64 version);
// A record of past commits requests.
std::vector<CommitRequestDataList> commit_request_lists_;
// Map of versions by client tag.
// This is an essential part of the mocked server state.
std::map<const std::string, int64> server_versions_;
DISALLOW_COPY_AND_ASSIGN(MockModelTypeSyncWorker);
};
} // namespace syncer
#endif // SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DisplayItemClient_h
#define DisplayItemClient_h
#include "platform/PlatformExport.h"
#include "platform/heap/Heap.h"
#include "wtf/text/WTFString.h"
namespace blink {
class DisplayItemClientInternalVoid;
using DisplayItemClient = const DisplayItemClientInternalVoid*;
inline DisplayItemClient toDisplayItemClient(const void* object) { return static_cast<DisplayItemClient>(object); }
// Used to pass DisplayItemClient and debugName() (called only when needed) from
// core/layout module etc. to platform/paint module.
// The instance must not out-live the object. Long-time reference to a client must
// use DisplayItemClient.
class PLATFORM_EXPORT DisplayItemClientWrapper {
DISALLOW_NEW(); // Allow allocated in stack or in another object only.
public:
template <typename T>
DisplayItemClientWrapper(const T& object)
: m_displayItemClient(object.displayItemClient())
, m_object(reinterpret_cast<const GenericClass&>(object))
, m_debugNameInvoker(&invokeDebugName<T>)
{ }
DisplayItemClientWrapper(const DisplayItemClientWrapper& other)
: m_displayItemClient(other.m_displayItemClient)
, m_object(other.m_object)
, m_debugNameInvoker(other.m_debugNameInvoker)
{ }
DisplayItemClient displayItemClient() const { return m_displayItemClient; }
String debugName() const { return m_debugNameInvoker(m_object); }
private:
DisplayItemClientWrapper& operator=(const DisplayItemClientWrapper&) = delete;
class GenericClass;
template <typename T>
static String invokeDebugName(const GenericClass& object) { return reinterpret_cast<const T&>(object).debugName(); }
DisplayItemClient m_displayItemClient;
const GenericClass& m_object;
using DebugNameInvoker = String(*)(const GenericClass&);
DebugNameInvoker m_debugNameInvoker;
};
}
#endif // DisplayItemClient_h
|
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// StreamImpl.h: Defines the abstract rx::StreamImpl class.
#ifndef LIBANGLE_RENDERER_STREAMIMPL_H_
#define LIBANGLE_RENDERER_STREAMIMPL_H_
#include "common/angleutils.h"
namespace rx
{
class StreamImpl : angle::NonCopyable
{
public:
explicit StreamImpl() {}
virtual ~StreamImpl() {}
};
} // namespace rx
#endif // LIBANGLE_RENDERER_STREAMIMPL_H_
|
//
// ConsentViewController.h
// E-Mission
//
// Created by Gautham Kesineni on 8/5/14.
// Copyright (c) 2014 Kalyanaraman Shankari. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MasterNavController.h"
@interface ConsentViewController : UIViewController <UIWebViewDelegate, UIAlertViewDelegate>
@property (strong, nonatomic) IBOutlet UIWebView *conditionWebView;
+ (NSString*)termsVersionNumber;
- (IBAction)onAgreeTerms:(id)sender;
- (IBAction)onRefuseTerms:(id)sender;
@end
|
#ifndef MAPRED_DEBUG_COORDINATOR_CLIENT_H
#define MAPRED_DEBUG_COORDINATOR_CLIENT_H
#include "core/constants.h"
#include "mapreduce/common/CoordinatorClientInterface.h"
class Params;
/**
DebugCoordinatorClient is a coordinator client with minimal functionality. It
does not connect to any kind of persistent backing store, but instead draws
information from the global params object:
INPUT_DISK_LIST: list of input disks to read input files from. Files should
be named *input_*
NUM_PARTITIONS: the number of partitions, or files, for the job
*/
class DebugCoordinatorClient : public CoordinatorClientInterface {
public:
/// Constructor
/**
\param params the global params object.
\param phaseName the name of the phase
\param diskID the ID of the disk to get read requests from
*/
DebugCoordinatorClient(
const Params& params, const std::string& phaseName, uint64_t diskID);
/// Destructor
virtual ~DebugCoordinatorClient() {}
/**
Get the next read request, which is generated from the disks and files in
the specified input directory.
\return a read request object, or NULL if all read requests have been
retrieved
*/
ReadRequest* getNextReadRequest();
/**
Get the JobInfo corresponding to the directories and partitions stored in
params. The job ID is ignored.
\param jobID ignored
\return a JobInfo object corresponding to the directories and partitions
stored in params
*/
JobInfo* getJobInfo(uint64_t jobID);
/// Store all outputs in the root directory of the disk.
const themis::URL& getOutputDirectory(uint64_t jobID);
/// Not implemented, returns NULL.
RecoveryInfo* getRecoveryInfo(uint64_t jobID);
/// Not implemented, aborts
void notifyNodeFailure(const std::string& peerIPAddress);
/// Not implemented, aborts
void notifyDiskFailure(
const std::string& peerIPAddress, const std::string& diskPath);
/// Not implemented
void setNumPartitions(uint64_t jobID, uint64_t numPartitions);
/// Not implemented
void waitOnBarrier(const std::string& barrierName);
/// Not implemented
void uploadSampleStatistics(
uint64_t jobID, uint64_t inputBytes, uint64_t intermediateBytes);
/// Not implemented
void getSampleStatisticsSums(
uint64_t jobId, uint64_t numNodes, uint64_t& inputBytes,
uint64_t& intermediateBytes);
/// Not implemented
uint64_t getNumPartitions(uint64_t jobID);
private:
const uint64_t numPartitions;
const uint64_t diskID;
StringList files;
StringList::iterator nextFile;
themis::URL outputDirectory;
};
#endif // MAPRED_DEBUG_COORDINATOR_CLIENT_H
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_FONT_ACCESS_CONTEXT_H_
#define CONTENT_PUBLIC_BROWSER_FONT_ACCESS_CONTEXT_H_
#include "base/callback_forward.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "third_party/blink/public/mojom/font_access/font_access.mojom.h"
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
defined(OS_MAC)
#define PLATFORM_HAS_LOCAL_FONT_ENUMERATION_IMPL 1
#endif
namespace content {
class CONTENT_EXPORT FontAccessContext {
public:
using FindAllFontsCallback =
base::OnceCallback<void(blink::mojom::FontEnumerationStatus,
std::vector<blink::mojom::FontMetadata>)>;
virtual void FindAllFonts(FindAllFontsCallback callback) = 0;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_FONT_ACCESS_CONTEXT_H_
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_EXTERNAL_MOJO_PUBLIC_CPP_EXTERNAL_MOJO_BROKER_H_
#define CHROMECAST_EXTERNAL_MOJO_PUBLIC_CPP_EXTERNAL_MOJO_BROKER_H_
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "chromecast/external_mojo/public/mojom/connector.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
namespace service_manager {
class Connector;
} // namespace service_manager
namespace chromecast {
namespace external_mojo {
// Manages connections from Mojo services in external processes. May be used
// either in a standalone broker process, or embedded into a Chromium process.
class ExternalMojoBroker {
public:
explicit ExternalMojoBroker(const std::string& broker_path);
ExternalMojoBroker(const ExternalMojoBroker&) = delete;
ExternalMojoBroker& operator=(const ExternalMojoBroker&) = delete;
~ExternalMojoBroker();
// Initializes the embedded into a Chromium process (eg in cast_shell).
// |connector| is the ServiceManager connector within the Chromium process.
// |external_services_to_proxy| is a list of the names of external services
// that should be made accessible to Mojo services running within Chromium.
void InitializeChromium(
std::unique_ptr<service_manager::Connector> connector,
const std::vector<std::string>& external_services_to_proxy);
mojo::PendingRemote<mojom::ExternalConnector> CreateConnector();
void BindConnector(mojo::PendingReceiver<mojom::ExternalConnector> receiver);
private:
class ConnectorImpl;
class ReadWatcher;
std::unique_ptr<ConnectorImpl> connector_;
std::unique_ptr<ReadWatcher> read_watcher_;
};
} // namespace external_mojo
} // namespace chromecast
#endif // CHROMECAST_EXTERNAL_MOJO_PUBLIC_CPP_EXTERNAL_MOJO_BROKER_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE195_Signed_to_Unsigned_Conversion_Error__rand_memcpy_03.c
Label Definition File: CWE195_Signed_to_Unsigned_Conversion_Error.label.xml
Template File: sources-sink-03.tmpl.c
*/
/*
* @description
* CWE: 195 Signed to Unsigned Conversion Error
* BadSource: rand Set data to result of rand(), which may be zero
* GoodSource: Positive integer
* Sink: memcpy
* BadSink : Copy strings using memcpy() with the length of data
* Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_memcpy_03_bad()
{
int data;
/* Initialize data */
data = -1;
if(5==5)
{
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign conversion could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the 5==5 to 5!=5 */
static void goodG2B1()
{
int data;
/* Initialize data */
data = -1;
if(5!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign conversion could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
int data;
/* Initialize data */
data = -1;
if(5==5)
{
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
}
{
char source[100];
char dest[100] = "";
memset(source, 'A', 100-1);
source[100-1] = '\0';
if (data < 100)
{
/* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,
* the sign conversion could result in a very large number */
memcpy(dest, source, data);
dest[data] = '\0'; /* NULL terminate */
}
printLine(dest);
}
}
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_memcpy_03_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE195_Signed_to_Unsigned_Conversion_Error__rand_memcpy_03_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE195_Signed_to_Unsigned_Conversion_Error__rand_memcpy_03_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.