text stringlengths 4 6.14k |
|---|
//$Id: DripSend.h,v 1.1.1.1 2007/11/05 19:09:11 jpolastre Exp $
/*
* Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* @author Gilman Tolle <get@cs.berkeley.edu>
*/
enum {
AM_DRIPSEND = 75,
};
typedef struct AddressMsg {
uint16_t source;
uint16_t dest;
uint8_t data[0];
} AddressMsg;
|
/*
+-----------------------------------------------------------+
| Copyright (c) 2017 Collet Valentin |
+-----------------------------------------------------------+
| This source file is subject to version the BDS license, |
| that is bundled with this package in the file LICENSE |
+-----------------------------------------------------------+
| Author: Collet Valentin <valentin@famillecollet.com> |
+-----------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gevent.h"
/*****************************/
/* Class information getters */
/*****************************/
static int le_gevent;
static zend_object_handlers gevent_object_handlers;
static zend_class_entry * gevent_class_entry_ce;
zend_class_entry * gevent_get_class_entry(){
return gevent_class_entry_ce;
}
zend_object_handlers * gevent_get_object_handlers(){
return &gevent_object_handlers;
}
zend_object * gevent_ctor(zend_class_entry *ce, GdkEvent * event){
zend_object * tor = gevent_object_new(ce);
ze_gevent_object * obj = php_gevent_fetch_object(tor);
//obj->std.handlers = &gevent_object_handlers;
obj->event_ptr = gevent_new();
return tor;
}
/****************************/
/* Memory handling function */
/****************************/
gevent_ptr gevent_new(){
gevent_ptr tor = ecalloc(1, sizeof(gevent_t));
return tor;
}
zend_object *gevent_object_new(zend_class_entry *class_type){
ze_gevent_object *intern;
intern = ecalloc(1, sizeof(ze_gevent_object) + zend_object_properties_size(class_type));
zend_object_std_init (&intern->std, class_type);
object_properties_init (&intern->std, class_type);
intern->std.handlers = &gevent_object_handlers;
return &intern->std;
}
void gevent_dtor(gevent_ptr intern){
efree(intern);
}
void gevent_object_free_storage(zend_object *object){
ze_gevent_object *intern = php_gevent_fetch_object(object);
if (!intern) {
return;
}
if (intern->event_ptr){
gevent_dtor(intern->event_ptr);
}
intern->event_ptr = NULL;
zend_object_std_dtor(&intern->std);
}
void gevent_free_resource(zend_resource *rsrc) {
gevent_ptr event = (gevent_ptr) rsrc->ptr;
gevent_dtor(event);
}
/***************/
/* PHP Methods */
/***************/
GEVENT_METHOD(__construct){}
static const zend_function_entry gevent_class_functions[] = {
PHP_ME(GEvent, __construct , arginfo_pggi_void, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
PHP_FE_END
};
/*****************************/
/* Object handling functions */
/*****************************/
zval *gevent_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
return std_object_handlers.read_property(object, member, type, cache_slot, rv);
}
HashTable *gevent_get_properties(zval *object){
//G_H_UPDATE_INIT(zend_std_get_properties(object));
//return G_H_UPDATE_RETURN;
return zend_std_get_properties(object);
}
PHP_WRITE_PROP_HANDLER_TYPE gevent_write_property(zval *object, zval *member, zval *value, void **cache_slot){
PHP_WRITE_PROP_HANDLER_RETURN(std_object_handlers.write_property(object, member, value, cache_slot));
}
/*******************************/
/* GEvent Class Initialization */
/*******************************/
#define DECLARE_GEVENT_PROP(name) \
DECLARE_CLASS_PROPERTY(gevent_class_entry_ce, name)
#define GEVENT_CONSTANT(name, value) \
zend_declare_class_constant_long(gevent_class_entry_ce, name, sizeof(name)-1, value);
void gevent_init(int module_number){
zend_class_entry ce;
le_gevent = zend_register_list_destructors_ex(gevent_free_resource, NULL, "PGGI\\GDK\\Event", module_number);
memcpy(&gevent_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
gevent_object_handlers.offset = XtOffsetOf(ze_gevent_object, std);
gevent_object_handlers.free_obj = gevent_object_free_storage;
gevent_object_handlers.clone_obj = NULL;
gevent_object_handlers.read_property = gevent_read_property;
gevent_object_handlers.get_properties = gevent_get_properties;
gevent_object_handlers.write_property = gevent_write_property;
INIT_CLASS_ENTRY(ce, "PGGI\\GDK\\Event", gevent_class_functions);
ce.create_object = gevent_object_new;
gevent_class_entry_ce = zend_register_internal_class(&ce);
}
|
#ifndef GDSMS_H
#define GDSMS_H
// includes
#include <inttypes.h>
#include <string.h>
#include <ctype.h>
/**
* Object for process sms data
*/
class GDSms
{
public:
GDSms();
/** Phone number string */
char *m_number;
/** Phone number buffer size */
uint8_t m_numberSize;
/** SMS body string */
char *m_message;
/** SMS body buffer size */
uint8_t m_messageSize;
/** Last count number from @see parseSMSMessage */
uint8_t m_lastParamCount;
/**
* Cleaning SMS Text Data buffer.
*
* @return FALSE if no buffer avilable!
*/
bool cleanSMS();
/**
* Set a phone number to buffer.
*
* @param number Copy this number to buffer
* @return If function are success
*/
bool setNumber(char *number);
/**
* Check is all data are set for full functionality.
*
* @return TRUE is all data set
*/
bool isReady();
/**
* Parse message for internal processing.
* It work like strtok with ' '. Set also the first element to
* uppercase. This is the command to GPSDog.
*
* @return Count of parsed elements
*/
uint8_t parseSMSMessage();
/**
* Get a element of the parsed message.
* @see parseSMSMessage();
*
* @param idx The element they will have
* @return A pointer to this element in message
*/
char* getParseElement(uint8_t idx);
/**
* Get a element of the parsed message as Uppercase.
* @see parseSMSMessage();
*
* @param idx The element they will have
* @return A pointer to element or NULL
*/
char* getParseElementUpper(uint8_t idx);
/**
* Extract GPSDog command from message.
* Use first @see parseSMSMessage!
*
* @return The parsed GPSDog SMS command
*/
char* getSMSCommand() {
return getParseElementUpper(0);
}
};
#endif
// vim: set sts=4 sw=4 ts=4 et:
|
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* PCF8583 rotorfreq (i2c) pool interval
*
* Determines how often the sensor is read out.
*
* @reboot_required true
* @group Sensors
* @unit us
*/
PARAM_DEFINE_INT32(PCF8583_POOL, 1000000);
/**
* PCF8583 rotorfreq (i2c) i2c address
*
* @reboot_required true
* @group Sensors
* @value 80 Address 0x50 (80)
* @value 81 Address 0x51 (81)
*/
PARAM_DEFINE_INT32(PCF8583_ADDR, 80);
/**
* PCF8583 rotorfreq (i2c) pulse reset value
*
* Internal device counter is reset to 0 when overun this value,
* counter is able to store upto 6 digits
* reset of counter takes some time - measurement with reset has worse accurancy.
* 0 means reset counter after every measurement.
*
* @reboot_required true
* @group Sensors
*/
PARAM_DEFINE_INT32(PCF8583_RESET, 500000);
/**
* PCF8583 rotorfreq (i2c) pulse count
*
* Nmumber of signals per rotation of actuator
*
* @reboot_required true
* @group Sensors
* @min 1
*/
PARAM_DEFINE_INT32(PCF8583_MAGNET, 2);
|
// Copyright (c) 2010 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.
// A test utility that makes it easy to assert the exact presence of
// protobuf extensions in an extensible message. Example code:
//
// sync_pb::EntitySpecifics value; // Set up a test value.
// value.MutableExtension(sync_pb::bookmark);
//
// ProtoExtensionValidator<sync_pb::EntitySpecifics> good_expectation(value);
// good_expectation.ExpectHasExtension(sync_pb::bookmark);
// good_expectation.ExpectHasNoOtherFieldsOrExtensions();
//
// ProtoExtensionValidator<sync_pb::EntitySpecifics> bad_expectation(value);
// bad_expectation.ExpectHasExtension(sync_pb::preference); // Fails, no pref
// bad_expectation.ExpectHasNoOtherFieldsOrExtensions(); // Fails, bookmark
#ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
#define CHROME_BROWSER_SYNC_TEST_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
#pragma once
#include "base/string_util.h"
#include "chrome/browser/sync/test/engine/syncer_command_test.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace browser_sync {
template<typename MessageType>
class ProtoExtensionValidator {
public:
explicit ProtoExtensionValidator(const MessageType& proto)
: proto_(proto) {
}
template<typename ExtensionTokenType>
void ExpectHasExtension(ExtensionTokenType token) {
EXPECT_TRUE(proto_.HasExtension(token))
<< "Proto failed to contain expected extension";
proto_.ClearExtension(token);
EXPECT_FALSE(proto_.HasExtension(token));
}
void ExpectNoOtherFieldsOrExtensions() {
EXPECT_EQ(MessageType::default_instance().SerializeAsString(),
proto_.SerializeAsString())
<< "Proto contained additional unexpected extensions.";
}
private:
MessageType proto_;
DISALLOW_COPY_AND_ASSIGN(ProtoExtensionValidator);
};
} // namespace browser_sync
#endif // CHROME_BROWSER_SYNC_TEST_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
|
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
#include "../src/rlencode.h"
// libmo_unpack needs this symbol defined ... *rolls eyes*
void MO_syslog(int value, char *message, const function *const caller)
{
}
START_TEST(test_compress)
{
float fatvec[5] = {3, 6, 6, 6, 9};
int fatlen = 5;
float thinvec[10];
int thinlen = 10;
float bmdi = 6;
function *parent = NULL;
int rc;
rc = runlen_encode(fatvec, fatlen, thinvec, &thinlen, bmdi, parent);
ck_assert_int_eq(rc, 0);
ck_assert_int_eq(thinlen, 4);
}
END_TEST
START_TEST(test_compress_result_larger)
{
float fatvec[5] = {0, 2, 0, 4, 0};
int fatlen = 5;
float thinvec[5];
int thinlen = 5;
float bmdi = 0;
function *parent = NULL;
int rc;
rc = runlen_encode(fatvec, fatlen, thinvec, &thinlen, bmdi, parent);
ck_assert_int_eq(rc, 1);
}
END_TEST
START_TEST(test_decompress)
{
float fatvec[5];
int fatlen = 5;
float thinvec[4] = {3, 6, 3, 9};
int thinlen = 4;
float bmdi = 6;
function *parent = NULL;
int rc;
rc = runlen_decode(fatvec, fatlen, thinvec, thinlen, bmdi, parent);
ck_assert_int_eq(rc, 0);
ck_assert(fatvec[0] == 3);
ck_assert(fatvec[1] == 6);
}
END_TEST
Suite *rle_suite()
{
Suite *s;
TCase *tc_core;
s = suite_create("RLE");
tc_core = tcase_create("Core");
tcase_add_test(tc_core, test_compress);
tcase_add_test(tc_core, test_compress_result_larger);
tcase_add_test(tc_core, test_decompress);
suite_add_tcase(s, tc_core);
return s;
}
int main(void)
{
int number_failed;
Suite *s;
SRunner *sr;
s = rle_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE758_Undefined_Behavior__int64_t_malloc_use_02.c
Label Definition File: CWE758_Undefined_Behavior.alloc.label.xml
Template File: point-flaw-02.tmpl.c
*/
/*
* @description
* CWE: 758 Undefined Behavior
* Sinks: malloc_use
* GoodSink: Initialize then use data
* BadSink : Use data from malloc without initialization
* Flow Variant: 02 Control flow: if(1) and if(0)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE758_Undefined_Behavior__int64_t_malloc_use_02_bad()
{
if(1)
{
{
int64_t * pointer = (int64_t *)malloc(sizeof(int64_t));
if (pointer == NULL) {exit(-1);}
int64_t data = *pointer; /* FLAW: the value pointed to by pointer is undefined */
free(pointer);
printLongLongLine(data);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(0) instead of if(1) */
static void good1()
{
if(0)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
int64_t data;
int64_t * pointer = (int64_t *)malloc(sizeof(int64_t));
if (pointer == NULL) {exit(-1);}
data = 5LL;
*pointer = data; /* FIX: Assign a value to the thing pointed to by pointer */
{
int64_t data = *pointer;
printLongLongLine(data);
}
free(pointer);
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(1)
{
{
int64_t data;
int64_t * pointer = (int64_t *)malloc(sizeof(int64_t));
if (pointer == NULL) {exit(-1);}
data = 5LL;
*pointer = data; /* FIX: Assign a value to the thing pointed to by pointer */
{
int64_t data = *pointer;
printLongLongLine(data);
}
free(pointer);
}
}
}
void CWE758_Undefined_Behavior__int64_t_malloc_use_02_good()
{
good1();
good2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE758_Undefined_Behavior__int64_t_malloc_use_02_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE758_Undefined_Behavior__int64_t_malloc_use_02_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkGibbsTrackingView_h
#define QmitkGibbsTrackingView_h
#include <berryISelectionListener.h>
#include <QmitkFunctionality.h>
#include "ui_QmitkGibbsTrackingViewControls.h"
#include <mitkQBallImage.h>
#include <QThread>
#include <mitkFiberBundle.h>
#include <QTime>
#include <itkImage.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <itkDiffusionTensor3D.h>
#include <mitkTensorImage.h>
class QmitkGibbsTrackingView;
class QmitkTrackingWorker : public QObject
{
Q_OBJECT
public:
QmitkTrackingWorker(QmitkGibbsTrackingView* view);
public slots:
void run();
private:
QmitkGibbsTrackingView* m_View;
};
/*!
\brief View for global fiber tracking (Gibbs tracking)
\sa QmitkFunctionality
\ingroup Functionalities
*/
typedef itk::Image< float, 3 > FloatImageType;
namespace itk
{
template<class X>
class GibbsTrackingFilter;
}
class QmitkGibbsTrackingView : public QmitkFunctionality
{
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT
public:
typedef itk::Image<float,3> ItkFloatImageType;
typedef itk::Vector<float, QBALL_ODFSIZE> OdfVectorType;
typedef itk::Image<OdfVectorType, 3> ItkQBallImgType;
typedef itk::Image< itk::DiffusionTensor3D<float>, 3 > ItkTensorImage;
typedef itk::GibbsTrackingFilter< ItkQBallImgType > GibbsTrackingFilterType;
static const std::string VIEW_ID;
QmitkGibbsTrackingView();
virtual ~QmitkGibbsTrackingView();
virtual void CreateQtPartControl(QWidget *parent) override;
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) override;
virtual void StdMultiWidgetNotAvailable() override;
signals:
protected slots:
void StartGibbsTracking();
void StopGibbsTracking();
void AfterThread(); ///< update gui etc. after tracking has finished
void BeforeThread(); ///< start timer etc.
void TimerUpdate();
void SetMask();
void AdvancedSettings(); ///< show/hide advanced tracking options
void SaveTrackingParameters(); ///< save tracking parameters to xml file
void LoadTrackingParameters(); ///< load tracking parameters from xml file
/** update labels if parameters have changed */
void SetParticleWidth(int value);
void SetParticleLength(int value);
void SetInExBalance(int value);
void SetFiberLength(int value);
void SetParticleWeight(int value);
void SetStartTemp(int value);
void SetEndTemp(int value);
void SetCurvatureThreshold(int value);
void SetRandomSeed(int value);
void SetOutputFile();
private:
// Visualization & GUI
void GenerateFiberBundle(); ///< generate fiber bundle from tracking output and add to datanode
void UpdateGUI(); ///< update button activity etc. dpending on current datamanager selection
void UpdateTrackingStatus(); ///< update textual status display of the tracking process
/// \brief called by QmitkFunctionality when DataManager's selection has changed
virtual void OnSelectionChanged( std::vector<mitk::DataNode*> nodes ) override;
/// \brief called when DataNode is removed to stop gibbs tracking after node is removed
virtual void NodeRemoved(const mitk::DataNode * node) override;
void UpdateIteraionsGUI(unsigned long iterations); ///< update iterations label text
Ui::QmitkGibbsTrackingViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
/** data objects */
mitk::DataNode::Pointer m_TrackingNode; ///< actual node that is tracked
mitk::FiberBundle::Pointer m_FiberBundle; ///< tracking output
ItkFloatImageType::Pointer m_MaskImage; ///< used to reduce the algorithms search space. tracking only inside of the mask.
mitk::TensorImage::Pointer m_TensorImage; ///< actual image that is tracked
mitk::QBallImage::Pointer m_QBallImage; ///< actual image that is tracked
ItkQBallImgType::Pointer m_ItkQBallImage; ///< actual image that is tracked
ItkTensorImage::Pointer m_ItkTensorImage; ///< actual image that is tracked
/** data nodes */
mitk::DataNode::Pointer m_ImageNode;
mitk::DataNode::Pointer m_MaskImageNode;
mitk::DataNode::Pointer m_FiberBundleNode;
/** flags etc. */
bool m_ThreadIsRunning;
QTimer* m_TrackingTimer;
QTime m_TrackingTime;
unsigned long m_ElapsedTime;
QString m_OutputFileName;
/** global tracker and friends */
itk::SmartPointer<GibbsTrackingFilterType> m_GlobalTracker;
QmitkTrackingWorker m_TrackingWorker;
QThread m_TrackingThread;
friend class QmitkTrackingWorker;
};
#endif // _QMITKGibbsTrackingVIEW_H_INCLUDED
|
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dumprestore.h 8.2 (Berkeley) 1/21/94
*
* $FreeBSD: src/include/protocols/dumprestore.h,v 1.10 2002/07/17 02:03:19 mckusick Exp $
*/
#ifndef _PROTOCOLS_DUMPRESTORE_H_
#define _PROTOCOLS_DUMPRESTORE_H_
/*
* TP_BSIZE is the size of file blocks on the dump tapes.
* Note that TP_BSIZE must be a multiple of DEV_BSIZE.
*
* NTREC is the number of TP_BSIZE blocks that are written
* in each tape record. HIGHDENSITYTREC is the number of
* TP_BSIZE blocks that are written in each tape record on
* 6250 BPI or higher density tapes.
*
* TP_NINDIR is the number of indirect pointers in a TS_INODE
* or TS_ADDR record. Note that it must be a power of two.
*/
#define TP_BSIZE 1024
#define NTREC 10
#define HIGHDENSITYTREC 32
#define TP_NINDIR (TP_BSIZE/2)
#define LBLSIZE 16
#define NAMELEN 64
#define OFS_MAGIC (int)60011
#define NFS_MAGIC (int)60012
#ifndef FS_UFS2_MAGIC
#define FS_UFS2_MAGIC (int)0x19540119
#endif
#define CHECKSUM (int)84446
union u_spcl {
char dummy[TP_BSIZE];
struct s_spcl {
int32_t c_type; /* record type (see below) */
int32_t c_old_date; /* date of this dump */
int32_t c_old_ddate; /* date of previous dump */
int32_t c_volume; /* dump volume number */
int32_t c_old_tapea; /* logical block of this record */
ino_t c_inumber; /* number of inode */
int32_t c_magic; /* magic number (see above) */
int32_t c_checksum; /* record checksum */
/*
* Start old dinode structure, expanded for binary
* compatibility with UFS1.
*/
u_int16_t c_mode; /* file mode */
int16_t c_spare1[3]; /* old nlink, ids */
u_int64_t c_size; /* file byte count */
int32_t c_old_atime; /* old last access time, seconds */
int32_t c_atimensec; /* last access time, nanoseconds */
int32_t c_old_mtime; /* old last modified time, secs */
int32_t c_mtimensec; /* last modified time, nanosecs */
int32_t c_spare2[2]; /* old ctime */
int32_t c_rdev; /* for devices, device number */
int32_t c_birthtimensec; /* creation time, nanosecs */
int64_t c_birthtime; /* creation time, seconds */
int64_t c_atime; /* last access time, seconds */
int64_t c_mtime; /* last modified time, seconds */
int32_t c_spare4[7]; /* old block pointers */
u_int32_t c_file_flags; /* status flags (chflags) */
int32_t c_spare5[2]; /* old blocks, generation number */
u_int32_t c_uid; /* file owner */
u_int32_t c_gid; /* file group */
int32_t c_spare6[2]; /* previously unused spares */
/*
* End old dinode structure.
*/
int32_t c_count; /* number of valid c_addr entries */
char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */
char c_label[LBLSIZE]; /* dump label */
int32_t c_level; /* level of this dump */
char c_filesys[NAMELEN]; /* name of dumpped file system */
char c_dev[NAMELEN]; /* name of dumpped device */
char c_host[NAMELEN]; /* name of dumpped host */
int32_t c_flags; /* additional information */
int32_t c_old_firstrec; /* first record on volume */
int64_t c_date; /* date of this dump */
int64_t c_ddate; /* date of previous dump */
int64_t c_tapea; /* logical block of this record */
int64_t c_firstrec; /* first record on volume */
int32_t c_spare[24]; /* reserved for future uses */
} s_spcl;
} u_spcl;
#define spcl u_spcl.s_spcl
/*
* special record types
*/
#define TS_TAPE 1 /* dump tape header */
#define TS_INODE 2 /* beginning of file record */
#define TS_ADDR 4 /* continuation of file record */
#define TS_BITS 3 /* map of inodes on tape */
#define TS_CLRI 6 /* map of inodes deleted since last dump */
#define TS_END 5 /* end of volume marker */
/*
* flag values
*/
/* None at the moment */
#define DUMPOUTFMT "%-32s %c %s" /* for printf */
/* name, level, ctime(date) */
#define DUMPINFMT "%32s %c %[^\n]\n" /* inverse for scanf */
#endif /* !_DUMPRESTORE_H_ */
|
/**
* @file: ArraysSBMLErrorTable.h
* @brief: Implementation of the ArraysSBMLErrorTable class
* @author: SBMLTeam
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2009-2013 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* 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. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution
* and also available online as http://sbml.org/software/libsbml/license.html
* ------------------------------------------------------------------------ -->
*/
#ifndef ArraysSBMLErrorTable_H__
#define ArraysSBMLErrorTable_H__
#include <sbml/packages/arrays/validator/ArraysSBMLError.h>
LIBSBML_CPP_NAMESPACE_BEGIN
/** @cond doxygenLibsbmlInternal */
static const packageErrorTableEntry arraysErrorTable[] =
{
//8010100
{ ArraysUnknownError,
"Unknown error from arrays",
LIBSBML_CAT_GENERAL_CONSISTENCY,
LIBSBML_SEV_ERROR,
"Unknown error from arrays",
{ " "
}
}
};
LIBSBML_CPP_NAMESPACE_END
/** @endcond doxygenLibsbmlInternal */
#endif /* ArraysSBMLErrorTable_h__ */
|
/*
* $Id: XMMediaStream.h,v 1.14 2008/10/24 12:22:02 hfriederich Exp $
*
* Copyright (c) 2005-2008 XMeeting Project ("http://xmeeting.sf.net").
* All rights reserved.
* Copyright (c) 2005-2008 Hannes Friederich. All rights reserved.
*/
#ifndef __XM_MEDIA_STREAM_H__
#define __XM_MEDIA_STREAM_H__
#include <ptlib.h>
#include <opal/mediastrm.h>
#include <rtp/rtp.h>
#include "XMTypes.h"
class XMConnection;
/**
* OpalMediaStream wrapper for QuickTime codecs (sending)
* The packetizers directly assemble the RTP data frame through the
* API presented here
**/
class XMMediaStream : public OpalMediaStream
{
PCLASSINFO(XMMediaStream, OpalMediaStream);
public:
XMMediaStream(XMConnection & connection,
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
bool isSource);
~XMMediaStream();
virtual void OnPatchStart();
virtual bool Close();
virtual bool ReadPacket(RTP_DataFrame & packet);
virtual bool WritePacket(RTP_DataFrame & packet);
virtual bool IsSynchronous() const { return false; }
virtual bool RequiresPatchThread() const { return false; }
virtual bool ExecuteCommand(const OpalMediaCommand & command);
// packetizer methods
static void SetTimeStamp(unsigned mediaID, unsigned timeStamp);
static void AppendData(unsigned mediaID, void *data, unsigned lenght);
static void SendPacket(unsigned mediaID, bool setMarker);
static void HandleDidStopTransmitting(unsigned mediaID);
private:
unsigned GetKeyFrameInterval(XMCodecIdentifier identifier);
XMConnection & connection;
RTP_DataFrame dataFrame;
unsigned timeStampBase;
bool hasStarted;
bool isTerminated;
};
#endif // __XM_MEDIA_STREAM_H__
|
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Data Differential's libhostle
*
* Copyright (C) 2012 Data Differential, http://datadifferential.com/
* Copyright (C) 2015 Andrew Hutchings <andrew@linuxjedi.co.uk>
*
* 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.
*
* * The names of its contributors may not be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "config.h"
#include "src/function.h"
#include "src/initialize.h"
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
static int not_until= 500;
static struct function_st __function;
static pthread_once_t function_lookup_once = PTHREAD_ONCE_INIT;
static void set_local(void)
{
__function= set_function("write", "HOSTILE_WRITE");
}
#define __WRITE_DEFAULT_ERROR ECONNRESET
static __thread int __default_error= __WRITE_DEFAULT_ERROR;
ssize_t LIBHOSTILE_API write(int fd, const void *buf, size_t count)
{
hostile_initialize();
(void) pthread_once(&function_lookup_once, set_local);
if (__function.frequency)
{
if ((--not_until < 0) && !(rand() % __function.frequency))
{
int ret= -1;
struct stat statbuf;
fstat(fd, &statbuf);
if (S_ISSOCK(statbuf.st_mode))
{
switch (__default_error)
{
case EIO:
close(fd);
errno= EIO;
break;
case ENETDOWN:
close(fd);
errno= ENETDOWN;
break;
case ECONNRESET:
default:
close(fd);
errno= ECONNRESET;
break;
}
}
else
{
switch (__default_error)
{
case EIO:
errno= EIO;
ret= 0;
break;
case ENOSPC:
errno= ENOSPC;
ret= 0;
break;
case EFBIG:
default:
errno= EFBIG;
ret= 0;
break;
}
}
return ret;
}
}
ssize_t ret= __function.function.write(fd, buf, count);
return ret;
}
|
// Copyright 2021 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 ASH_WEBUI_PROJECTOR_APP_PROJECTOR_MESSAGE_HANDLER_H_
#define ASH_WEBUI_PROJECTOR_APP_PROJECTOR_MESSAGE_HANDLER_H_
#include <set>
#include "ash/webui/projector_app/projector_app_client.h"
#include "ash/webui/projector_app/projector_oauth_token_fetcher.h"
#include "ash/webui/projector_app/projector_xhr_sender.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "google_apis/gaia/google_service_auth_error.h"
namespace signin {
struct AccessTokenInfo;
} // namespace signin
namespace ash {
// Enum to record the different errors that may occur in the Projector app.
enum class ProjectorError {
kNone = 0,
kOther,
kTokenFetchFailure,
};
// Handles messages from the Projector WebUIs (i.e. chrome://projector).
class ProjectorMessageHandler : public content::WebUIMessageHandler,
public ProjectorAppClient::Observer {
public:
ProjectorMessageHandler();
ProjectorMessageHandler(const ProjectorMessageHandler&) = delete;
ProjectorMessageHandler& operator=(const ProjectorMessageHandler&) = delete;
~ProjectorMessageHandler() override;
base::WeakPtr<ProjectorMessageHandler> GetWeakPtr();
// content::WebUIMessageHandler:
void RegisterMessages() override;
// ProjectorAppClient:Observer:
void OnNewScreencastPreconditionChanged(bool can_start) override;
// Used to notify the SWA the SODA installation progress.
void OnSodaProgress(int combined_progress);
// Used to notify the SWA that SODA installation failed.
void OnSodaError();
void set_web_ui_for_test(content::WebUI* web_ui) { set_web_ui(web_ui); }
// ProjectorAppClient::Observer:
// Notifies the Projector SWA the pending screencasts' state change and
// updates the pending list in Projector SWA.
void OnScreencastsPendingStatusChanged(
const std::set<PendingScreencast>& pending_screencast) override;
private:
// Requested by the Projector SWA to list the available accounts (primary and
// secondary accounts) in the current session. The list of accounts will be
// used in the account picker in the SWA.
void GetAccounts(const base::Value::ConstListView args);
// Requested by the Projector SWA to check if it is possible to start a new
// Projector session.
void CanStartProjectorSession(const base::Value::ConstListView args);
// Requested by the Projector SWA to start a new Projector session if it is
// possible.
void StartProjectorSession(const base::Value::ConstListView args);
// Requested by the Projector SWA to get access to the OAuth token for the
// account email provided in the `args`.
void GetOAuthTokenForAccount(const base::Value::ConstListView args);
// Requested by the Projector SWA to send XHR request.
void SendXhr(const base::Value::ConstListView args);
// Requested by the Projector SWA on whether it should show the "new
// screencast" button.
void ShouldShowNewScreencastButton(const base::Value::ConstListView args);
// Requested by the Projector SWA to check if SODA is not available and should
// be downloaded. Returns false if the device doesn't support SODA.
void ShouldDownloadSoda(const base::Value::ConstListView args);
// Requested by the Projector SWA to trigger SODA installation.
void InstallSoda(const base::Value::ConstListView args);
// Called by the Projector SWA when an error occurred.
void OnError(const base::Value::ConstListView args);
// Called when OAuth token fetch request is completed by
// ProjectorOAuthTokenFetcher. Resolves the javascript promise created by
// ProjectorBrowserProxy.getOAuthTokenForAccount by calling the
// `js_callback_id`.
void OnAccessTokenRequestCompleted(const std::string& js_callback_id,
const std::string& email,
GoogleServiceAuthError error,
const signin::AccessTokenInfo& info);
// Called when the XHR request is completed. Resolves the javascript promise
// created by ProjectorBrowserProxy.sendXhr by calling the `js_callback_id`.
void OnXhrRequestCompleted(const std::string& js_callback_id,
bool success,
const std::string& response_body,
const std::string& error);
// Requested by the Projector SWA to fetch a list of screencasts pending to
// upload or failed to upload.
void GetPendingScreencasts(const base::Value::ConstListView args);
ProjectorOAuthTokenFetcher oauth_token_fetcher_;
std::unique_ptr<ProjectorXhrSender> xhr_sender_;
base::WeakPtrFactory<ProjectorMessageHandler> weak_ptr_factory_{this};
};
} // namespace ash
#endif // ASH_WEBUI_PROJECTOR_APP_PROJECTOR_MESSAGE_HANDLER_H_
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
#define MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "media/base/video_frame.h"
#include "media/base/video_frame_layout.h"
#include "mojo/public/cpp/system/buffer.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace media {
// A derived class of media::VideoFrame holding a mojo::SharedBufferHandle
// which is mapped on constructor and remains so for the lifetime of the
// object. These frames are ref-counted.
class MojoSharedBufferVideoFrame : public VideoFrame {
public:
// Callback called when this object is destructed. Ownership of the shared
// memory is transferred to the callee.
using MojoSharedBufferDoneCB =
base::OnceCallback<void(mojo::ScopedSharedBufferHandle buffer,
size_t capacity)>;
// Creates a new I420 or NV12 frame in shared memory with provided parameters
// (coded_size() == natural_size() == visible_rect()), or returns nullptr.
// Buffers for the frame are allocated but not initialized. The caller must
// not make assumptions about the actual underlying sizes, but check the
// returned VideoFrame instead. |format| must be either PIXEL_FORMAT_I420 or
// PIXEL_FORMAT_NV12.
static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultForTesting(
const VideoPixelFormat format,
const gfx::Size& dimensions,
base::TimeDelta timestamp);
// Creates a YUV frame backed by shared memory from in-memory YUV frame.
// Internally the data from in-memory YUV frame will be copied to a
// consecutive block in shared memory. Will return null on failure.
static scoped_refptr<MojoSharedBufferVideoFrame> CreateFromYUVFrame(
const VideoFrame& frame);
// Creates a MojoSharedBufferVideoFrame that uses the memory in |handle|.
// This will take ownership of |handle|, so the caller can no longer use it.
// |mojo_shared_buffer_done_cb|, if not null, is called on destruction,
// and is passed ownership of |handle|. |handle| must be writable. |offsets|
// and |strides| should be in plane order.
static scoped_refptr<MojoSharedBufferVideoFrame> Create(
VideoPixelFormat format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
mojo::ScopedSharedBufferHandle handle,
size_t mapped_size,
std::vector<uint32_t> offsets,
std::vector<int32_t> strides,
base::TimeDelta timestamp);
// Returns the offsets relative to the start of |shared_buffer| for the
// |plane| specified.
size_t PlaneOffset(size_t plane) const;
// Returns a reference to the mojo shared memory handle. Caller should
// duplicate the handle if they want to extend the lifetime of the buffer.
const mojo::SharedBufferHandle& Handle() const;
// Returns the size of the shared memory.
size_t MappedSize() const;
// Sets the callback to be called to free the shared buffer. If not null,
// it is called on destruction, and is passed ownership of |handle|.
void SetMojoSharedBufferDoneCB(
MojoSharedBufferDoneCB mojo_shared_buffer_done_cb);
private:
friend class MojoDecryptorService;
MojoSharedBufferVideoFrame(const VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
mojo::ScopedSharedBufferHandle handle,
size_t mapped_size,
base::TimeDelta timestamp);
~MojoSharedBufferVideoFrame() override;
// Initializes the MojoSharedBufferVideoFrame by creating a mapping onto
// the shared memory, and then setting offsets as specified.
bool Init(std::vector<uint32_t> offsets);
uint8_t* shared_buffer_data() {
return reinterpret_cast<uint8_t*>(shared_buffer_mapping_.get());
}
mojo::ScopedSharedBufferHandle shared_buffer_handle_;
mojo::ScopedSharedBufferMapping shared_buffer_mapping_;
size_t shared_buffer_size_;
size_t offsets_[kMaxPlanes];
MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_;
DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame);
};
} // namespace media
#endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_KEYBOARD_UI_SHAPED_WINDOW_TARGETER_H_
#define ASH_KEYBOARD_UI_SHAPED_WINDOW_TARGETER_H_
#include <memory>
#include <vector>
#include "base/macros.h"
#include "ui/aura/window_targeter.h"
namespace keyboard {
// A WindowTargeter for windows with hit-test areas that can be defined by a
// list of rectangles.
class ShapedWindowTargeter : public aura::WindowTargeter {
public:
explicit ShapedWindowTargeter(std::vector<gfx::Rect> hit_test_rects);
ShapedWindowTargeter(const ShapedWindowTargeter&) = delete;
ShapedWindowTargeter& operator=(const ShapedWindowTargeter&) = delete;
~ShapedWindowTargeter() override;
private:
// aura::WindowTargeter:
std::unique_ptr<aura::WindowTargeter::HitTestRects> GetExtraHitTestShapeRects(
aura::Window* target) const override;
std::vector<gfx::Rect> hit_test_rects_;
};
} // namespace keyboard
#endif // ASH_KEYBOARD_UI_SHAPED_WINDOW_TARGETER_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-34.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate memory for a string, but do not allocate space for NULL terminator
* GoodSource: Allocate enough memory for a string and the NULL terminator
* Sinks: ncpy
* BadSink : Copy string to data using strncpy()
* Flow Variant: 34 Data flow: use of a union containing two methods of accessing the same data (within the same function)
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING "AAAAAAAAAA"
typedef union
{
char * unionFirst;
char * unionSecond;
} CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_unionType;
#ifndef OMITBAD
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_bad()
{
char * data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_unionType myUnion;
data = NULL;
/* FLAW: Did not leave space for a null terminator */
data = (char *)malloc(10*sizeof(char));
if (data == NULL) {exit(-1);}
myUnion.unionFirst = data;
{
char * data = myUnion.unionSecond;
{
char source[10+1] = SRC_STRING;
/* Copy length + 1 to include NUL terminator from source */
/* POTENTIAL FLAW: data may not have enough space to hold source */
strncpy(data, source, strlen(source) + 1);
printLine(data);
free(data);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_unionType myUnion;
data = NULL;
/* FIX: Allocate space for a null terminator */
data = (char *)malloc((10+1)*sizeof(char));
if (data == NULL) {exit(-1);}
myUnion.unionFirst = data;
{
char * data = myUnion.unionSecond;
{
char source[10+1] = SRC_STRING;
/* Copy length + 1 to include NUL terminator from source */
/* POTENTIAL FLAW: data may not have enough space to hold source */
strncpy(data, source, strlen(source) + 1);
printLine(data);
free(data);
}
}
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_ncpy_34_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// -*- C++ -*-
#ifndef _writer_verilog_self_shell_h_
#define _writer_verilog_self_shell_h_
#include "writer/verilog/common.h"
namespace iroha {
namespace writer {
namespace verilog {
class SelfShell {
public:
SelfShell(const IDesign *design, const PortSet *ports, bool reset_polarity,
EmbeddedModules *embedded_modules);
void WriteWireDecl(ostream &os);
void WritePortConnection(ostream &os);
void WriteShellFSM(ostream &os);
private:
void ProcessModule(IModule *mod);
void ProcessResource(IResource *res);
void GenConnection(const string &sig, ostream &os);
const IDesign *design_;
const PortSet *ports_;
bool reset_polarity_;
EmbeddedModules *embedded_modules_;
vector<IResource *> axi_;
vector<IResource *> ext_input_;
vector<IResource *> ext_output_;
vector<IResource *> ext_task_entry_;
vector<IResource *> ext_task_call_;
vector<IResource *> ext_task_wait_;
vector<IResource *> ext_ram_;
vector<IResource *> sram_if_;
};
} // namespace verilog
} // namespace writer
} // namespace iroha
#endif // _writer_verilog_self_shell_h_
|
/**
* @author: Lefteris Karapetsas
* @licence: BSD3 (Check repository root for details)
*/
#ifndef RF_STRING_COMMON_H
#define RF_STRING_COMMON_H
#include <rflib/string/xdecl.h>
#include <rflib/string/retrieval.h>
#include <rflib/defs/defarg.h>
#include <rflib/defs/imex.h>
#include <rflib/utils/sanity.h>
#include <rflib/datastructs/mbuffer.h>
#include <rflib/persistent/buffers.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
//! Printf format specifier for RFString
#define RFS_PF "%.*s"
//! Printf argument macro for RFstring, to be used in conjuction with the 'PF'
#define RFS_PA(i_str_) \
rf_string_length_bytes(i_str_), rf_string_data(i_str_)
//! For printfs, evaluate val_ as bool and output string representation
#define FMT_BOOL(val_) (val_) ? "true" : "false"
#if 0 /* TODO: Using this I get address always evaluates to true in some cases,
think how we can get rid of that warning */
#if RF_OPTION_DEBUG
#define RFS_PA(i_str_) \
(i_str_) ? rf_string_length_bytes(i_str_) : 0, \
(i_str_) ? rf_string_data(i_str_) : ""
#else
#define RFS_PA(i_str_) \
rf_string_length_bytes(i_str_), rf_string_data(i_str_)
#endif
#endif
/**
* Create a temporary string from a literal with optional printf-like arguments.
*
* Wrap around @ref RFS_PUSH() and @ref RFS_POP() to make sure the temporary
* string is freed
*
* @param ret Pass a string pointer by reference to have it point to the
* temporary string position in the buffer
* @param s A string literal
* @param ... Optional prinflike arguments
* @return A pointer to the temporary string or NULL in failure
*/
#define RFS(...) RF_SELECT_STRING_CREATE_LOCAL(__VA_ARGS__)
/**
* Just like @ref RFS() but kills the program in case of failure
*/
#define RFS_OR_DIE(...) RF_SELECT_STRING_CREATE_LOCAL_OR_DIE(__VA_ARGS__)
/**
* Just like @ref RFS() but the resulting string is null terminated. It is useful
* to create temporary strings to provide to APIs that accept nullterminated cstrings
*/
#define RFS_NT(...) RF_SELECT_STRING_CREATE_LOCAL_NT(__VA_ARGS__)
/**
* Just like @ref RFS() but the resulting string is null terminated and the
* program is killed in case of failure
*/
#define RFS_NT_OR_DIE(...) RF_SELECT_STRING_CREATE_LOCAL_OR_DIE_NT(__VA_ARGS__)
/**
* Remember the current point in the string buffer.
*
* Should be used to save a state of the string buffer at any given point before
* using @ref RFS(). Should always have an equivalent @ref RFS_POP()
*/
#define RFS_PUSH() rf_mbuffer_push(RF_TSBUFFM)
/**
* Pop a bookmarked string buffer point
*
* Used to pop back a buffer position saved by a push.
* Should always have an equivalent @ref RFS_POP()
*/
#define RFS_POP() rf_mbuffer_pop(RF_TSBUFFM)
/**
* Reads the formatted string and the va_args and fills in
* the string buffer returning the string's size in bytes (not including null termination)
* Can realloc the buffer if not enough space remains
*
* @param fmt[in] The formatted string
* @param size[out] The string's byte size not including the null
* terminating character
* @param buff_ptr[out] The pointer to the beginning of the String
* in the internal buffer
* @return Returns @c true in success and @c false in failure
*/
bool rf_strings_buffer_fillfmt(
const char *fmt,
unsigned int *size,
char **buff_ptr,
va_list args
);
/* -- internal functions used in the above API -- */
i_DECLIMEX_ struct RFstring *i_rf_string_create_local(
bool null_terminate,
const char *s
);
i_DECLIMEX_ struct RFstring *i_rf_string_create_local_or_die(
bool null_terminate,
const char *s
);
i_DECLIMEX_ struct RFstring *i_rf_string_create_localv(const char *s, ...);
i_DECLIMEX_ struct RFstring *i_rf_string_create_localv_or_die(
const char *s,
...
);
#define RF_SELECT_STRING_CREATE_LOCAL(...) \
RP_SELECT_FUNC_IF_NARGIS(i_SELECT_RF_STRING_CREATELOCAL, 1, __VA_ARGS__)
#define i_SELECT_RF_STRING_CREATELOCAL1(slit_) \
i_rf_string_create_local(false, slit_)
#define i_SELECT_RF_STRING_CREATELOCAL0(...) \
i_rf_string_create_localv(__VA_ARGS__)
#define RF_SELECT_STRING_CREATE_LOCAL_NT(...) \
RP_SELECT_FUNC_IF_NARGIS(i_SELECT_RF_STRING_CREATELOCAL_NT, 1, __VA_ARGS__)
#define i_SELECT_RF_STRING_CREATELOCAL_NT1(slit_) \
i_rf_string_create_local(true, slit_)
#define i_SELECT_RF_STRING_CREATELOCAL_NT0(...) \
i_rf_string_create_localv(__VA_ARGS__)
#define RF_SELECT_STRING_CREATE_LOCAL_OR_DIE(...) \
RP_SELECT_FUNC_IF_NARGIS(i_SELECT_RF_STRING_CREATELOCAL_OR_DIE, 1, __VA_ARGS__)
#define i_SELECT_RF_STRING_CREATELOCAL_OR_DIE1(slit_) \
i_rf_string_create_local_or_die(false, slit_)
#define i_SELECT_RF_STRING_CREATELOCAL_OR_DIE0(...) \
i_rf_string_create_localv_or_die(__VA_ARGS__)
#define RF_SELECT_STRING_CREATE_LOCAL_OR_DIE_NT(...) \
RP_SELECT_FUNC_IF_NARGIS(i_SELECT_RF_STRING_CREATELOCAL_OR_DIE_NT, 1, __VA_ARGS__)
#define i_SELECT_RF_STRING_CREATELOCAL_OR_DIE_NT1(slit_) \
i_rf_string_create_local_or_die(true, slit_)
#define i_SELECT_RF_STRING_CREATELOCAL_OR_DIE_NT0(...) \
i_rf_string_create_localv_or_die(__VA_ARGS__)
#ifdef __cplusplus
}//closing bracket for calling from C++
#endif
#endif//include guards end
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FWL_CARET_IMP_H
#define _FWL_CARET_IMP_H
#include "xfa/include/fwl/core/fwl_timer.h"
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
class CFWL_WidgetImpDelegate;
class IFWL_Widget;
class CFWL_CaretImp;
class CFWL_CaretImpDelegate;
class CFWL_CaretImp : public CFWL_WidgetImp {
public:
CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
virtual ~CFWL_CaretImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
virtual FWL_ERR Initialize();
virtual FWL_ERR Finalize();
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE);
virtual FWL_ERR GetFrequency(FX_DWORD& elapse);
virtual FWL_ERR SetFrequency(FX_DWORD elapse);
virtual FWL_ERR SetColor(CFX_Color crFill);
protected:
FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
class CFWL_CaretTimer : public IFWL_Timer {
public:
CFWL_CaretTimer(CFWL_CaretImp* m_pCaret);
~CFWL_CaretTimer() override {}
int32_t Run(FWL_HTIMER hTimer) override;
CFWL_CaretImp* m_pCaret;
};
CFWL_CaretTimer* m_pTimer;
FWL_HTIMER m_hTimer;
FX_DWORD m_dwElapse;
CFX_Color m_crFill;
FX_BOOL m_bSetColor;
friend class CFWL_CaretImpDelegate;
friend class CFWL_CaretTimer;
};
class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate {
public:
CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner);
int32_t OnProcessMessage(CFWL_Message* pMessage) override;
FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL) override;
protected:
CFWL_CaretImp* m_pOwner;
};
#endif
|
#include "res.h"
/*
* long ftype;
* short iconid;
* Str255 filename;
*/
long fref(data, maxl, rcp)
char *data;
long maxl;
struct res *rcp;
{
char *skipsp(), *getline(), *lp;
char *outp(), *outs(), *outl(), *outc();
char *datap = data;
int iconid;
if ((lp = skipsp(getline())) == 0)
fatal("no type specified");
checktype(lp);
datap = outc(datap, lp[0], &maxl);
datap = outc(datap, lp[1], &maxl);
datap = outc(datap, lp[2], &maxl);
datap = outc(datap, lp[3], &maxl);
if ((lp = getline()) == 0 || sscanf(lp, "%d", &iconid) != 1)
fatal("bad icon id");
datap = outs(datap, iconid, &maxl);
datap = outc(datap, (char)0, &maxl);
return (datap - data);
}
|
#pragma once
#ifndef STYLEINDEXLINEEDIT_H
#define STYLEINDEXLINEEDIT_H
#include "tcommon.h"
#include "toonzqt/lineedit.h"
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
// forward declaration
class TPaletteHandle;
//=============================================================================
namespace DVGui
{
class DVAPI StyleIndexLineEdit : public LineEdit
{
TPaletteHandle *m_pltHandle;
public:
StyleIndexLineEdit();
~StyleIndexLineEdit();
void setPaletteHandle(TPaletteHandle *pltHandle) { m_pltHandle = pltHandle; }
TPaletteHandle *getPaletteHandle() { return m_pltHandle; }
protected:
void paintEvent(QPaintEvent *pe);
};
} //namspace
#endif
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_OVERLAY_AGENT_VIEWS_H_
#define COMPONENTS_UI_DEVTOOLS_VIEWS_OVERLAY_AGENT_VIEWS_H_
#include <vector>
#include "components/ui_devtools/Overlay.h"
#include "components/ui_devtools/overlay_agent.h"
#include "components/ui_devtools/views/dom_agent_views.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_delegate.h"
#include "ui/events/event.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
class RenderText;
}
namespace ui_devtools {
enum HighlightRectsConfiguration {
NO_DRAW,
R1_CONTAINS_R2,
R1_HORIZONTAL_FULL_LEFT_R2,
R1_TOP_FULL_LEFT_R2,
R1_BOTTOM_FULL_LEFT_R2,
R1_TOP_PARTIAL_LEFT_R2,
R1_BOTTOM_PARTIAL_LEFT_R2,
R1_INTERSECTS_R2
};
enum RectSide { TOP_SIDE, LEFT_SIDE, RIGHT_SIDE, BOTTOM_SIDE };
class OverlayAgentViews : public OverlayAgent,
public ui::EventHandler,
public ui::LayerDelegate {
public:
~OverlayAgentViews() override;
// Creates a platform-specific instance.
static std::unique_ptr<OverlayAgentViews> Create(DOMAgent* dom_agent);
int pinned_id() const { return pinned_id_; }
void SetPinnedNodeId(int pinned_id);
// Overlay::Backend:
protocol::Response setInspectMode(
const protocol::String& in_mode,
protocol::Maybe<protocol::Overlay::HighlightConfig> in_highlightConfig)
override;
protocol::Response highlightNode(
std::unique_ptr<protocol::Overlay::HighlightConfig> highlight_config,
protocol::Maybe<int> node_id) override;
protocol::Response hideHighlight() override;
HighlightRectsConfiguration highlight_rect_config() const {
return highlight_rect_config_;
}
// Return the id of the UI element located at |event|'s root location.
// The function first searches for the targeted window, then the targeted
// widget (if one exists), then the targeted view (if one exists). Return 0 if
// no valid target is found.
virtual int FindElementIdTargetedByPoint(ui::LocatedEvent* event) const = 0;
protected:
OverlayAgentViews(DOMAgent* dom_agent);
private:
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest,
MouseEventsGenerateFEEventsInInspectMode);
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightRects);
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightNonexistentNode);
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightWidget);
#if defined(USE_AURA)
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightWindow);
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightEmptyOrInvisibleWindow);
#endif
// Start handling events intended for inspectable elements.
virtual void InstallPreTargetHandler() = 0;
// Stop handling events intended for inspectable elements.
virtual void RemovePreTargetHandler() = 0;
protocol::Response HighlightNode(int node_id, bool show_size = false);
// Returns true when there is any visible element to highlight.
bool UpdateHighlight(
const std::pair<gfx::NativeWindow, gfx::Rect>& window_and_screen_bounds);
// Shows the distances between the nodes identified by |pinned_id| and
// |element_id| in the highlight overlay.
void ShowDistancesInHighlightOverlay(int pinned_id, int element_id);
// ui:EventHandler:
void OnMouseEvent(ui::MouseEvent* event) override;
void OnKeyEvent(ui::KeyEvent* event) override;
// ui::LayerDelegate:
void OnPaintLayer(const ui::PaintContext& context) override;
void OnDeviceScaleFactorChanged(float old_device_scale_factor,
float new_device_scale_factor) override {}
ui::Layer* layer_for_highlighting() { return layer_for_highlighting_.get(); }
std::unique_ptr<gfx::RenderText> render_text_;
bool show_size_on_canvas_ = false;
HighlightRectsConfiguration highlight_rect_config_;
bool is_swap_ = false;
// The layer used to paint highlights, and its offset from the screen origin.
std::unique_ptr<ui::Layer> layer_for_highlighting_;
gfx::Vector2d layer_for_highlighting_screen_offset_;
// Hovered and pinned element bounds in screen coordinates; empty if none.
gfx::Rect hovered_rect_;
gfx::Rect pinned_rect_;
int pinned_id_ = 0;
DISALLOW_COPY_AND_ASSIGN(OverlayAgentViews);
};
} // namespace ui_devtools
#endif // COMPONENTS_UI_DEVTOOLS_VIEWS_OVERLAY_AGENT_VIEWS_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_PALETTE_TOOLS_METALAYER_MODE_H_
#define ASH_SYSTEM_PALETTE_TOOLS_METALAYER_MODE_H_
#include "ash/ash_export.h"
#include "ash/highlighter/highlighter_controller.h"
#include "ash/public/cpp/assistant/assistant_state.h"
#include "ash/system/palette/common_palette_tool.h"
#include "base/memory/weak_ptr.h"
#include "ui/events/event_handler.h"
namespace ash {
// A palette tool that lets the user select a screen region to be passed
// to the Assistant framework.
//
// Unlike other palette tools, it can be activated not only through the stylus
// menu, but also by the stylus button click.
class ASH_EXPORT MetalayerMode : public CommonPaletteTool,
public ui::EventHandler,
public AssistantStateObserver,
public HighlighterController::Observer {
public:
explicit MetalayerMode(Delegate* delegate);
~MetalayerMode() override;
private:
// Whether the metalayer feature is enabled by the user. This is different
// from |enabled| which means that the palette tool is currently selected by
// the user.
bool feature_enabled() const {
return assistant_enabled_ && assistant_context_enabled_ &&
assistant_allowed_state_ ==
chromeos::assistant::AssistantAllowedState::ALLOWED;
}
// Whether the tool is in "loading" state.
bool loading() const {
return feature_enabled() &&
assistant_status_ == chromeos::assistant::AssistantStatus::NOT_READY;
}
// Whether the tool can be selected from the menu (only true when enabled
// by the user and fully loaded).
bool selectable() const {
return feature_enabled() &&
assistant_status_ != chromeos::assistant::AssistantStatus::NOT_READY;
}
// PaletteTool:
PaletteGroup GetGroup() const override;
PaletteToolId GetToolId() const override;
void OnEnable() override;
void OnDisable() override;
const gfx::VectorIcon& GetActiveTrayIcon() const override;
views::View* CreateView() override;
// CommonPaletteTool:
const gfx::VectorIcon& GetPaletteIcon() const override;
// ui::EventHandler:
void OnTouchEvent(ui::TouchEvent* event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
// AssistantStateObserver:
void OnAssistantStatusChanged(
chromeos::assistant::AssistantStatus status) override;
void OnAssistantSettingsEnabled(bool enabled) override;
void OnAssistantContextEnabled(bool enabled) override;
void OnAssistantFeatureAllowedChanged(
chromeos::assistant::AssistantAllowedState state) override;
// HighlighterController::Observer:
void OnHighlighterEnabledChanged(HighlighterEnabledState state) override;
// Update the state of the tool based on the current availability of the tool.
void UpdateState();
// Update the palette menu item based on the current availability of the tool.
void UpdateView();
// Called when the metalayer session is complete.
void OnMetalayerSessionComplete();
chromeos::assistant::AssistantStatus assistant_status_ =
chromeos::assistant::AssistantStatus::NOT_READY;
bool assistant_enabled_ = false;
bool assistant_context_enabled_ = false;
chromeos::assistant::AssistantAllowedState assistant_allowed_state_ =
chromeos::assistant::AssistantAllowedState::ALLOWED;
base::TimeTicks previous_stroke_end_;
// True when the mode is activated via the stylus barrel button.
bool activated_via_button_ = false;
base::WeakPtrFactory<MetalayerMode> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MetalayerMode);
};
} // namespace ash
#endif // ASH_SYSTEM_PALETTE_TOOLS_METALAYER_MODE_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 SERVICES_AUDIO_SYNC_READER_H_
#define SERVICES_AUDIO_SYNC_READER_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/process/process.h"
#include "base/sync_socket.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "media/base/audio_bus.h"
#include "services/audio/output_controller.h"
#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
#endif
namespace audio {
// An OutputController::SyncReader implementation using SyncSocket. This is used
// by OutputController to provide a low latency data source for transmitting
// audio packets between the Audio Service process and the process where the
// mojo client runs.
class SyncReader : public OutputController::SyncReader {
public:
// Constructor: Creates and maps shared memory; and initializes a SyncSocket
// pipe, assigning the client handle to |foreign_socket|. The caller must
// confirm IsValid() returns true before any other methods are called.
SyncReader(base::RepeatingCallback<void(const std::string&)> log_callback,
const media::AudioParameters& params,
base::CancelableSyncSocket* foreign_socket);
~SyncReader() override;
// Returns true if the SyncReader initialized successfully, and
// TakeSharedMemoryRegion() will return a valid region.
bool IsValid() const;
// Transfers shared memory region ownership to a caller. It shouldn't be
// called more than once.
base::UnsafeSharedMemoryRegion TakeSharedMemoryRegion();
void set_max_wait_timeout_for_test(base::TimeDelta time) {
maximum_wait_time_ = time;
}
// OutputController::SyncReader implementation.
void RequestMoreData(base::TimeDelta delay,
base::TimeTicks delay_timestamp,
int prior_frames_skipped) override;
void Read(media::AudioBus* dest) override;
void Close() override;
private:
// Blocks until data is ready for reading or a timeout expires. Returns false
// if an error or timeout occurs.
bool WaitUntilDataIsReady();
const base::RepeatingCallback<void(const std::string&)> log_callback_;
base::UnsafeSharedMemoryRegion shared_memory_region_;
base::WritableSharedMemoryMapping shared_memory_mapping_;
// Mutes all incoming samples. This is used to prevent audible sound
// during automated testing.
const bool mute_audio_for_testing_;
// Denotes that the most recent socket error has been logged. Used to avoid
// log spam.
bool had_socket_error_;
// Socket for transmitting audio data.
base::CancelableSyncSocket socket_;
const uint32_t output_bus_buffer_size_;
// Shared memory wrapper used for transferring audio data to Read() callers.
std::unique_ptr<media::AudioBus> output_bus_;
// Track the number of times the renderer missed its real-time deadline and
// report a UMA stat during destruction.
size_t renderer_callback_count_;
size_t renderer_missed_callback_count_;
size_t trailing_renderer_missed_callback_count_;
// The maximum amount of time to wait for data from the renderer. Calculated
// from the parameters given at construction.
base::TimeDelta maximum_wait_time_;
// The index of the audio buffer we're expecting to be sent from the renderer;
// used to block with timeout for audio data.
uint32_t buffer_index_;
DISALLOW_COPY_AND_ASSIGN(SyncReader);
};
} // namespace audio
#endif // SERVICES_AUDIO_SYNC_READER_H_
|
/* Copyright (c) 2010-2018, Delft University of Technology
* All rigths reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
* a copy of the license with this file. If not, please or visit:
* http://tudat.tudelft.nl/LICENSE.
*/
#ifndef TUDAT_OBSERVABLETYPES_H
#define TUDAT_OBSERVABLETYPES_H
#include <string>
#include <Eigen/Core>
#include "Tudat/Astrodynamics/ObservationModels/linkTypeDefs.h"
namespace tudat
{
namespace observation_models
{
//! Enum for types of observations
enum ObservableType
{
one_way_range = 0,
angular_position = 1,
position_observable = 2,
one_way_doppler = 3,
one_way_differenced_range = 4,
n_way_range = 5,
two_way_doppler = 6,
euler_angle_313_observable = 7
};
//! Function to get the name (string) associated with a given observable type.
/*!
* Function to get the name (string) associated with a given observable type.
* \param observableType Type of observable.
* \param numberOfLinkEnds Number of link ends in observable
* \return Name of observable
*/
std::string getObservableName( const ObservableType observableType, const int numberOfLinkEnds );
//! Function to get the observable type.ssociated with the name (string) of observable.
/*!
* Function to get the observable type.ssociated with the name (string) of observable.
* \param observableName of observable
* \return Type of observable.
*/
ObservableType getObservableType( const std::string& observableName );
//! Function to get the size of an observable of a given type.
/*!
* Function to get the size of an observable of a given type.
* \param observableType Type of observable.
* \return Size of observable.
*/
int getObservableSize( const ObservableType observableType );
//! Function to get the indices in link end times/states for a given link end type and observable type
/*!
* Function to get the indices in link end times/states for a given link end type and observable type
* \param observableType Type of observable for which link end indices are to be returned
* \param linkEndType Type of link end for which link end indices are to be returned
* \param numberOfLinkEnds Number of link ends in observable
* \return Indices in link end times/states for given link end type and observable type
*/
std::vector< int > getLinkEndIndicesForLinkEndTypeAtObservable(
const ObservableType observableType, const LinkEndType linkEndType, const int numberOfLinkEnds );
void checkObservationResidualDiscontinuities(
Eigen::Block< Eigen::VectorXd > observationBlock,
const ObservableType observableType );
} // namespace observation_models
} // namespace tudat
#endif // TUDAT_OBSERVABLETYPES_H
|
//
// HMMProblemAGKi.h
// HMM
//
// Created by Mikhail Yudelson on 9/13/12.
//
//
#ifndef __HMM__HMMProblemAGKi__
#define __HMM__HMMProblemAGKi__
#include "HMMProblemAGK.h"
#include "StripedArray.h"
#include "utils.h"
#include <stdio.h>
#include <map>
#include <string>
class HMMProblemAGKi : public HMMProblemAGK {
public:
HMMProblemAGKi(struct param *param); // sizes=={nK, nK, nK} by default
virtual ~HMMProblemAGKi();
virtual void setGradA (struct data* dt, FitBit *fb, NPAR kg_flag);
void fit(); // return -LL for the model
protected:
virtual void init(struct param *param); // non-fit specific initialization
virtual void destroy(); // non-fit specific descruction
virtual NUMBER GradientDescent(); // fit alternating
private:
};
#endif /* defined(__HMM__HMMProblemAGKi__) */
|
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_VIDEO_CODING_SOURCE_QM_SELECT_DATA_H_
#define WEBRTC_MODULES_VIDEO_CODING_SOURCE_QM_SELECT_DATA_H_
/***************************************************************
*QMSelectData.h
* This file includes parameters used by the Quality Modes selection process
****************************************************************/
#include "typedefs.h"
namespace webrtc
{
//Initial level of buffer in secs: should corresponds to wrapper settings
#define INIT_BUFFER_LEVEL 0.5
//
//PARAMETERS FOR QM SELECTION
//
//Threshold of (max) buffer size below which we consider too low (underflow)
#define PERC_BUFFER_THR 0.10
//Threshold on rate mismatch
#define MAX_RATE_MM 0.5
//Threshold on the occurrences of low buffer levels
#define MAX_BUFFER_LOW 0.5
//Factor for transitional rate for going back up in resolution
#define TRANS_RATE_SCALE_UP_SPATIAL 1.25
#define TRANS_RATE_SCALE_UP_TEMP 1.25
//Maximum possible transitional rate: (units in kbps), for 30fps
const WebRtc_UWord16 kMaxRateQm[7] = {
100, //QCIF
500, //CIF
800, //VGA
1500, //4CIF
2000, //720 HD 4:3,
2500, //720 HD 16:9
3000 //1080HD
};
//Scale for transitional rate: based on content class
// motion=L/H/D,spatial==L/H/D: for low, high, middle levels
const float kScaleTransRateQm[18] = {
//4CIF and lower
0.25f, // L, L
0.75f, // L, H
0.75f, // L, D
0.75f, // H ,L
0.50f, // H, H
0.50f, // H, D
0.50f, // D, L
0.625f, // D, D
0.25f, // D, H
//over 4CIF: WHD, HD
0.25f, // L, L
0.75f, // L, H
0.75f, // L, D
0.75f, // H ,L
0.50f, // H, H
0.50f, // H, D
0.50f, // D, L
0.625f, // D, D
0.25f // D, H
};
//Control the total amount of down-sampling allowed
#define MAX_SPATIAL_DOWN_FACT 4
#define MAX_TEMP_DOWN_FACT 4
#define MAX_SPATIAL_TEMP_DOWN_FACT 8
//
//
//
//PARAMETETS FOR SETTING LOW/HIGH VALUES OF METRICS:
//
//Threshold to determine if high amount of zero_motion
#define HIGH_ZERO_MOTION_SIZE 0.95
//Thresholds for motion: motion level is derived from motion vectors: motion = size_nz*magn_nz
#define HIGH_MOTION 0.7
#define LOW_MOTION 0.4
//Thresholds for motion: motion level is from NFD
#define HIGH_MOTION_NFD 0.075
#define LOW_MOTION_NFD 0.04
//Thresholds for spatial prediction error: this is appLied on the min(2x2,1x2,2x1)
#define HIGH_TEXTURE 0.035
#define LOW_TEXTURE 0.025
//Used to reduce thresholds for HD scenes: correction factor since higher
//correlation in HD scenes means lower spatial prediction error
#define SCALE_TEXTURE_HD 0.9;
//Thresholds for distortion and horizontalness: applied on product: horiz_nz/dist_nz
#define COHERENCE_THR 1.0
#define COH_MAX 10
//
//
#define RATE_RED_SPATIAL_2X2 0.6 //percentage reduction in transitional bitrate where 2x2 is selected over 1x2/2x1
#define SPATIAL_ERR_2X2_VS_H 0.1 //percentage to favor 2x2
#define SPATIAL_ERR_2X2_VS_V 0.1 //percentage to favor 2x2 over V
#define SPATIAL_ERR_V_VS_H 0.1 //percentage to favor H over V
//Minimum image size for a spatial mode selection: no spatial down-sampling if input size <= MIN_IMAGE_SIZE
#define MIN_IMAGE_SIZE 25344 //176*144
//Minimum frame rate for temporal mode: no frame rate reduction if incomingFrameRate <= MIN_FRAME_RATE
#define MIN_FRAME_RATE_QM 8
//Avoid outliers in seq-rate MM
#define THRESH_SUM_MM 1000
const WebRtc_UWord32 kFrameSizeTh[6] = {
// boundaries for the closest standard frame size
63360, //between 176*144 and 352*288
204288, //between 352*288 and 640*480
356352, //between 640*480 and 704*576
548352, //between 704*576 and 960*720
806400, //between 960*720 and 1280*720
1497600, // between 1280*720 and 1920*1080
};
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CODING_SOURCE_QM_SELECT_DATA_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 UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_
#define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_
#include "ui/gfx/native_widget_types.h"
#include "ui/views/views_export.h"
namespace gfx{
class Size;
}
namespace views {
class Combobox;
class KeyEvent;
class View;
class VIEWS_EXPORT NativeComboboxWrapper {
public:
// Updates the combobox's content from its model.
virtual void UpdateFromModel() = 0;
// Updates the selected index from the associated combobox.
virtual void UpdateSelectedIndex() = 0;
// Updates the enabled state of the combobox from the associated view.
virtual void UpdateEnabled() = 0;
// Returns the selected index.
virtual int GetSelectedIndex() const = 0;
// Returns true if the combobox dropdown is open.
virtual bool IsDropdownOpen() const = 0;
// Returns the preferred size of the combobox.
virtual gfx::Size GetPreferredSize() = 0;
// Retrieves the view that hosts the native control.
virtual View* GetView() = 0;
// Sets the focus to the button.
virtual void SetFocus() = 0;
// Invoked when a key is pressed/release on combobox. Subclasser should
// return true if the event has been processed and false otherwise.
// See also View::OnKeyPressed/OnKeyReleased.
virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0;
virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0;
// Invoked when focus is being moved from or to the combobox.
// See also View::OnFocus/OnBlur.
virtual void HandleFocus() = 0;
virtual void HandleBlur() = 0;
// Returns a handle to the underlying native view for testing.
virtual gfx::NativeView GetTestingHandle() const = 0;
static NativeComboboxWrapper* CreateWrapper(Combobox* combobox);
protected:
virtual ~NativeComboboxWrapper() {}
};
} // namespace views
#endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_
|
/*-
* Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
/*
* Defines for converting physical address to VideoCore bus address and back
*/
#ifndef _BCM2835_VCBUS_H_
#define _BCM2835_VCBUS_H_
#define BCM2835_VCBUS_SDRAM_CACHED 0x40000000
#define BCM2835_VCBUS_IO_BASE 0x7E000000
#define BCM2835_VCBUS_SDRAM_UNCACHED 0xC0000000
#ifdef SOC_BCM2836
#define BCM2835_ARM_IO_BASE 0x3f000000
#define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED
#else
#define BCM2835_ARM_IO_BASE 0x20000000
#define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_CACHED
#endif
#define BCM2835_ARM_IO_SIZE 0x01000000
/*
* Convert physical address to VC bus address. Should be used
* when submitting address over mailbox interface
*/
#define PHYS_TO_VCBUS(pa) ((pa) + BCM2835_VCBUS_SDRAM_BASE)
/* Check whether pa bellong top IO window */
#define BCM2835_ARM_IS_IO(pa) (((pa) >= BCM2835_ARM_IO_BASE) && \
((pa) < BCM2835_ARM_IO_BASE + BCM2835_ARM_IO_SIZE))
/*
* Convert physical address in IO space to VC bus address.
*/
#define IO_TO_VCBUS(pa) ((pa - BCM2835_ARM_IO_BASE) + \
BCM2835_VCBUS_IO_BASE)
/*
* Convert address from VC bus space to physical. Should be used
* when address is returned by VC over mailbox interface. e.g.
* framebuffer base
*/
#define VCBUS_TO_PHYS(vca) ((vca) & ~(BCM2835_VCBUS_SDRAM_BASE))
#endif /* _BCM2835_VCBUS_H_ */
|
/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor 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 __STRING_EXT_H
#define __STRING_EXT_H
#if defined(NCSW_LINUX) && defined(__KERNEL__)
#include <linux/kernel.h>
#include <linux/string.h>
extern char * strtok ( char * str, const char * delimiters );
#elif defined(__KERNEL__)
#include "linux/types.h"
#include "linux/posix_types.h"
#include "linux/string.h"
#elif defined(NCSW_FREEBSD)
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
extern char *strtok(char *str, const char *delimiters);
#else
#include <string.h>
#endif /* defined(NCSW_LINUX) && defined(__KERNEL__) */
#include "std_ext.h"
#endif /* __STRING_EXT_H */
|
//
// Created by HannahStandPC on 14.10.2017.
//
#include<iostream.h>
int main(void)
{
printf("Hello World");
return 0;
}
|
#pragma once
template<typename TElem, int QSize>
class ProducerConsumerQueue
{
public:
ProducerConsumerQueue() : mOccupiedSize( 0 ), mQueueOffset( 0 )
{
memset( mQueueArray, 0, sizeof( mQueueArray ) );
InitializeConditionVariable( &mNotFull );
InitializeConditionVariable( &mNotEmpty );
InitializeSRWLock( &mSRWLock );
}
~ProducerConsumerQueue() {}
// 큐에 집어 넣는다
bool Produce( const TElem& item, bool waitUntilConsume = true )
{
// 쓰기니까 exclusive
AcquireSRWLockExclusive( &mSRWLock );
while ( mOccupiedSize == QSize )
{
// 가득 차 있는 경우
if ( waitUntilConsume )
{
/// 큐에 넣을 공간 생길때까지 잔다.
// mNotFull이 true가 될 때까지 락을 풀어 놓음 - 꺼내갈 수 있게
SleepConditionVariableSRW( &mNotFull, &mSRWLock, INFINITE, 0 );
}
else
{
// 락을 풀고, 못 넣었다! 리턴
ReleaseSRWLockExclusive( &mSRWLock );
return false;
}
}
// 지금 차 있는 데이터 시작 점 + 지금 차 있는 데이터 크기 = 지금 쓸 자리
mQueueArray[( mQueueOffset + mOccupiedSize ) % QSize] = item;
++mOccupiedSize;
ReleaseSRWLockExclusive( &mSRWLock );
// 채워놨다!
WakeConditionVariable( &mNotEmpty );
return true;
}
// 큐에서 뺀다
bool Consume( TElem& item, bool waitUntilProduce = true )
{
// 뺄 때도 변경이 생기므로 exclusive
AcquireSRWLockExclusive( &mSRWLock );
while ( mOccupiedSize == 0 )
{
if ( waitUntilProduce )
{
/// 큐에 아이템 들어올때까지 잔다
// mNotEmpty가 true가 될 때까지 락을 풀어 놓음 - 채울 수 있게
SleepConditionVariableSRW( &mNotEmpty, &mSRWLock, INFINITE, 0 );
}
else
{
ReleaseSRWLockExclusive( &mSRWLock );
return false;
}
}
item = mQueueArray[mQueueOffset];
--mOccupiedSize;
// 시작점을 꺼내가니까 시작점을 밀기
if ( ++mQueueOffset == QSize )
mQueueOffset = 0;
ReleaseSRWLockExclusive( &mSRWLock );
// 꺼내갔다!
WakeConditionVariable( &mNotFull );
return true;
}
private:
TElem mQueueArray[QSize];
uint32_t mOccupiedSize;
uint32_t mQueueOffset;
CONDITION_VARIABLE mNotFull;
CONDITION_VARIABLE mNotEmpty;
SRWLOCK mSRWLock;
};
|
//
// BaseTextViewController.h
// APP_iOS
//
// Created by Li on 15/8/26.
// Copyright (c) 2015年 Li. All rights reserved.
//
#import "BaseViewController.h"
#define kDefaultNumber 20
@interface BaseTextViewController : BaseViewController
typedef void (^BaseTextViewControllerBlock)(BaseTextViewController *VC, NSString *text);
@property (copy) BaseTextViewControllerBlock block;
@property (strong, nonatomic) IBOutlet UITextView *contentTextView;
@property (strong, nonatomic) IBOutlet UILabel *numberLabel;
@property (nonatomic, assign) NSUInteger numberOfWords; /**< 最大字数 */
@property (nonatomic, assign) NSString *defaultContent; /**< 默认内容 */
@property (nonatomic) UIKeyboardType keyboardType; /**< 键盘类型 */
@end
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "NSView.h"
#import "NSPopoverDelegate.h"
@class IDESharedTestResultsViewController, NSPopover, NSString;
@interface IDESharedTestResultsPerfMetricBadgeView : NSView <NSPopoverDelegate>
{
NSPopover *_iterationPopover;
BOOL _showsPopover;
BOOL _suppressBadgeBorder;
id <IDESharedTests_PerfMetric> _perfMetric;
id <IDESharedTests_TestRun> _testRun;
id _representedItem;
IDESharedTestResultsViewController *_hostTestResultsViewController;
id _badgeClickedBlock;
}
- (void).cxx_destruct;
- (void)_showPopover;
@property(copy, nonatomic) id badgeClickedBlock; // @synthesize badgeClickedBlock=_badgeClickedBlock;
- (void)drawRect:(struct CGRect)arg1;
@property __weak IDESharedTestResultsViewController *hostTestResultsViewController; // @synthesize hostTestResultsViewController=_hostTestResultsViewController;
@property(readonly, nonatomic) BOOL isShowingPopover;
- (void)mouseDown:(id)arg1;
@property(retain, nonatomic) id <IDESharedTests_PerfMetric> perfMetric; // @synthesize perfMetric=_perfMetric;
- (void)popoverDidClose:(id)arg1;
@property(retain) id representedItem; // @synthesize representedItem=_representedItem;
@property BOOL showsPopover; // @synthesize showsPopover=_showsPopover;
@property BOOL suppressBadgeBorder; // @synthesize suppressBadgeBorder=_suppressBadgeBorder;
@property(retain, nonatomic) id <IDESharedTests_TestRun> testRun; // @synthesize testRun=_testRun;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
|
#ifndef CONSTANTS_H_GUARD
#define CONSTANTS_H_GUARD
#ifdef __cplusplus
extern "C" {
#endif
/* SCS VERSION NUMBER ---------------------------------------------- */
#define SCS_VERSION ("1.1.6") /* string literals automatically null-terminated */
/* SCS returns one of the following integers: */
#define SCS_INFEASIBLE_INACCURATE (-7)
#define SCS_UNBOUNDED_INACCURATE (-6)
#define SCS_SIGINT (-5)
#define SCS_FAILED (-4)
#define SCS_INDETERMINATE (-3)
#define SCS_INFEASIBLE (-2) /* primal infeasible, dual unbounded */
#define SCS_UNBOUNDED (-1) /* primal unbounded, dual infeasible */
#define SCS_UNFINISHED (0) /* never returned, used as placeholder */
#define SCS_SOLVED (1)
#define SCS_SOLVED_INACCURATE (2)
/* DEFAULT SOLVER PARAMETERS AND SETTINGS -------------------------- */
#define MAX_ITERS (2500)
#define EPS (1E-3)
#define ALPHA (1.5)
#define RHO_X (1E-3)
#define SCALE (1.0)
#define CG_RATE (2.0)
#define VERBOSE (1)
#define NORMALIZE (1)
#define WARM_START (0)
#ifdef __cplusplus
}
#endif
#endif
|
//
// Created by Nima on 4/4/16.
//
#import <Foundation/Foundation.h>
#import "IMImojiSession.h"
/**
* @abstract Set of options for retrieving Categories within IMImojiSession
*/
@interface IMCategoryFetchOptions : NSObject
/**
* @abstract classification Type of category classification to retrieve
*/
@property(nonatomic) IMImojiSessionCategoryClassification classification;
/**
* @abstract When set, instructs the server to return categories relevant to the search phrase.
*/
@property(nonatomic, strong, nullable) NSString *contextualSearchPhrase;
/**
* @abstract Used in conjunction with contextualSearchPhrase to identify the locale of the phrase.
*/
@property(nonatomic, strong, nullable) NSLocale *contextualSearchLocale;
/**
* @abstract A bit-field of one or more IMImojiObjectLicenseStyle values to filter the categories on.
*/
@property(nonatomic, strong, nullable) NSNumber *licenseStyles;
+ (nonnull instancetype)optionsWithClassification:(IMImojiSessionCategoryClassification)classification;
+ (nonnull instancetype)optionsWithClassification:(IMImojiSessionCategoryClassification)classification
contextualSearchPhrase:(nullable NSString *)contextualSearchPhrase;
+ (nonnull instancetype)optionsWithClassification:(IMImojiSessionCategoryClassification)classification
contextualSearchPhrase:(nullable NSString *)contextualSearchPhrase
contextualSearchLocale:(nullable NSLocale *)contextualSearchLocale;
@end
|
/*
* em.h
*
*/
#ifndef __EM_H__
#define __EM_H__
#include <vector>
#include "tree.h"
#include "parameters.h"
#include "alignment.h"
#include "model.h"
#include "state_list.h"
#include "matrix.h"
double joint_prob(Tree &T, Parameters &Par, long idleaf, long idhid);
double joint_prob_leaves(Tree &T, Parameters &Par, long idleaf);
double log_likelihood(Tree &T, Parameters &Par, Counts &data);
double KL_divergence(Tree &T, Parameters &Par1, Parameters &Par2);
double entropy(Tree &T, Parameters &Par);
double joint_prob_fast(Tree &T, Parameters &Par, StateList &sl, long idleaf, long idhid);
double joint_prob_leaves_fast(Tree &T, Parameters &Par, StateList &sl, long idleaf);
double log_likelihood_fast(Tree &T, Parameters &Par, Counts &data, StateList &sl);
double KL_divergence_fast(Tree &T, Parameters &Par1, Parameters &Par2, StateList &sl);
double entropy_fast(Tree &T, Parameters &Par, StateList &sl);
void two_node_marginalization(Tree &T, Matrix &F, long a, long b, StateList &sl, TMatrix &N);
void one_node_marginalization(Tree &T, Matrix &F, long a, StateList &sl, Root &s);
std::tuple<float,int> EMalgorithm(Tree &T, Model &Mod, Parameters &Par, Counts &data, double eps, bool silent=false);
void MLE_all_obs(Tree &T, Model &Mod, Parameters &Par, Matrix &F, StateList &sl);
#endif
|
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <getopt.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libcgc.h"
struct opts {
enum cgc_shader_type type;
bool help;
};
static void usage(FILE *fp, const char *program)
{
fprintf(fp, "usage: %s [options] FILE\n", program);
}
static int parse_command_line(struct opts *opts, int argc, char *argv[])
{
static const struct option options[] = {
{ "fragment", 0, NULL, 'F' },
{ "help", 0, NULL, 'h' },
{ "vertex", 0, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
int opt;
memset(opts, 0, sizeof(*opts));
opts->type = CGC_SHADER_FRAGMENT;
while ((opt = getopt_long(argc, argv, "FhvV", options, NULL)) != -1) {
switch (opt) {
case 'F':
opts->type = CGC_SHADER_FRAGMENT;
break;
case 'h':
opts->help = true;
break;
case 'v':
opts->type = CGC_SHADER_VERTEX;
break;
default:
fprintf(stderr, "invalid option '%c'\n", opt);
return -1;
}
}
return optind;
}
/**
* This only works if the code is provided through static storage. Allocating
* memory and passing the pointer into CgDrv_Compile() will segfault.
*/
int main(int argc, char *argv[])
{
struct cgc_shader *shader;
size_t length;
struct opts opts;
char code[65536];
FILE *fp;
int err;
err = parse_command_line(&opts, argc, argv);
if (err < 0) {
return 1;
}
if (opts.help) {
usage(stdout, argv[0]);
return 0;
}
if (err < argc) {
fp = fopen(argv[err], "r");
if (!fp) {
fprintf(stderr, "failed to open `%s': %m\n", argv[1]);
return 1;
}
} else {
printf("reading stdin\n");
fp = stdin;
}
length = fread(code, 1, sizeof(code), fp);
if (length == 0) {
}
code[length] = '\0';
fclose(fp);
shader = cgc_compile(opts.type, code, length);
if (shader) {
cgc_shader_dump(shader, stdout);
cgc_shader_free(shader);
}
return 0;
}
|
#include <stdio.h>
#include <stdlib.h>
#include "mydiv.h"
int main(){
float scores[]={80, 95, 10, 30, 100};
float result[MAX_SIZE];
printf("*scores = %f\n", *scores);
printf("scores[0] = %f\n", scores[0]);
printf("scores[1] = %d\n", &scores[1]);
myArrayDiv(scores, 10.0, result);
puts(" ");
int i;
for(i = 0; i < MAX_SIZE; ++i){
printf(" %f", result[i]);
}
puts(" ");
// 12 / 4
/*
int a = 12;
int b = 0;
if (b != 0)
printf("mydiv(%d, %d) = %d", a,b,mydiv(a,b));
else
puts("Division byu zero is invalid.");
*/
return 0;
}
|
//
// ROTossableView.h
// RoundedFilter
//
// Created by bw on 8/31/14.
// Copyright (c) 2014 rounded. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ROTossableViewDelegate
- (void)cardWasTossed;
@end
@interface ROTossableView : UIView
@property (nonatomic, assign) id <ROTossableViewDelegate> delegate;
@end
|
#ifndef LIBHHMAP_H
#define LIBHHMAP_H
typedef unsigned int uint;
HHSet *hhmapnew(ulong n, ulong (*)(ulong), int (*)(ulong, ulong));
int hhmapput(HHSet *, uint, uint);
uint hhmapget(HHSet *, uint);
uint hhmapdel(HHSet *, uint);
#endif
|
/*--------------------------------------------------*/
/* */
/* The MIT License (MIT) */
/* */
/* Copyright (c) 2014 Mobily TEAM */
/* */
/* Permission is hereby granted, free of charge, */
/* to any person obtaining a copy of this software */
/* and associated documentation files */
/* (the "Software"), to deal in the Software */
/* without restriction, including without */
/* limitation the rights to use, copy, modify, */
/* merge, publish, distribute, sublicense, */
/* and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished */
/* to do so, subject to the following conditions: */
/* */
/* The above copyright notice and this permission */
/* notice shall be included in all copies or */
/* substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT */
/* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */
/* INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR */
/* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL */
/* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR */
/* ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR */
/* OTHERWISE, ARISING FROM, OUT OF OR IN */
/* CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */
/* */
/*--------------------------------------------------*/
#import <MobilyCore/MobilyBuilder.h>
/*--------------------------------------------------*/
@interface MobilyBadgeView : UIView< MobilyBuilderObject >
@property(nonatomic, readwrite, copy) IBInspectable NSString* text;
@property(nonatomic, readwrite, assign) IBInspectable UIEdgeInsets textInsets;
@property(nonatomic, readwrite, strong) IBInspectable UIColor* textColor;
@property(nonatomic, readwrite, strong) IBInspectable UIFont* textFont;
@property(nonatomic, readwrite, strong) IBInspectable UIColor* textShadowColor;
@property(nonatomic, readwrite, assign) IBInspectable CGFloat textShadowRadius;
@property(nonatomic, readwrite, assign) IBInspectable CGSize textShadowOffset;
@property(nonatomic, readwrite, assign) IBInspectable CGSize minimumSize;
@property(nonatomic, readwrite, assign) IBInspectable CGSize maximumSize;
- (void)setup NS_REQUIRES_SUPER;
@end
/*--------------------------------------------------*/
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_COMMON_INDEXEDPOOL
#define PX_PHYSICS_COMMON_INDEXEDPOOL
#include "PsArray.h"
#include "CmBitMap.h"
#include "PsBasicTemplates.h"
namespace physx
{
namespace Cm
{
class IndexedPoolEntry
{
public:
PxU32 getPoolIndex() const { return mIndex; }
IndexedPoolEntry() {}
private:
PxU32 mIndex;
IndexedPoolEntry(PxU32 index): mIndex(index) {}
template <class, PxU32> friend class IndexedPool;
};
/*!
Allocator for pools of data structures
Also decodes indices (which can be computed from handles)
EltsPerSlab must be a power of two, and T must inherit publicly from IndexedPoolEntry
*/
template <class T, PxU32 EltsPerSlab>
class IndexedPool
{
PX_NOCOPY(IndexedPool)
public:
static const PxU32 LOG2_ELTS_PER_SLAB = Ps::LogTwo<EltsPerSlab>::value;
IndexedPool() : mSlabs(PX_DEBUG_EXP("indexedPoolSlabs")), mFreeList(PX_DEBUG_EXP("indexedPoolFreeList"))
{
PX_COMPILE_TIME_ASSERT(EltsPerSlab && !(EltsPerSlab & (EltsPerSlab-1))); // non-0 power of 2
Cm::IndexedPoolEntry* dummy = static_cast<Cm::IndexedPoolEntry *>(static_cast<T *>(0)); // must inherit from IndexedPoolEntry
PX_UNUSED(dummy);
}
~IndexedPool()
{
for(PxU32 i=0;i<mSlabs.size();i++)
{
for(PxU32 j=0;j<EltsPerSlab;j++)
{
if(mUsedBitmap.boundedTest(i*EltsPerSlab+j))
mSlabs[i][j].~T();
}
PX_FREE_AND_RESET(mSlabs[i]);
}
}
PX_FORCE_INLINE T* construct()
{
T* t = reinterpret_cast<T*>(get());
if(t)
new (t) T();
return t;
}
template<class A1>
PX_FORCE_INLINE T* construct(const A1& a)
{
T* t = reinterpret_cast<T*>(get());
if(t)
new (t) T (a);
return t;
}
template<class A1, class A2>
PX_FORCE_INLINE T* construct(const A1& a, const A2& b)
{
T* t = reinterpret_cast<T*>(get());
if(t)
new (t) T (a, b);
return t;
}
template<class A1, class A2, class A3>
PX_FORCE_INLINE T* construct(const A1& a, const A2& b, const A3& c)
{
T* t = reinterpret_cast<T*>(get());
if(t)
new (t) T (a, b, c);
return t;
}
template<class A1, class A2, class A3, class A4>
PX_FORCE_INLINE T* construct(const A1& a, const A2& b, const A3& c, const A4& d)
{
T* t = reinterpret_cast<T*>(get());
if(t)
new (t) T (a, b, c, d);
return t;
}
void destroy(T* element)
{
PxU32 i = element->getPoolIndex();
mUsedBitmap.growAndReset(i);
mFreeList.pushBack(element);
}
PX_FORCE_INLINE const T& operator[](PxU32 index) const
{
PX_ASSERT(index<mSlabs.size()*EltsPerSlab && mUsedBitmap.boundedTest(index));
return mSlabs[index>>LOG2_ELTS_PER_SLAB][index&(EltsPerSlab-1)];
}
PX_FORCE_INLINE T& operator[](PxU32 index)
{
PX_ASSERT(index<mSlabs.size()*EltsPerSlab && mUsedBitmap.boundedTest(index));
return mSlabs[index>>LOG2_ELTS_PER_SLAB][index&(EltsPerSlab-1)];
}
class Iterator
{
public:
PX_INLINE Iterator(Cm::IndexedPool<T, EltsPerSlab>& pool) : mPool(pool), mBitmapIter(mPool.mUsedBitmap)
{
mIndex = mBitmapIter.getNext();
}
PX_INLINE T& operator*() { return mPool[mIndex]; }
PX_INLINE const T& operator*() const { return mPool[mIndex]; }
PX_INLINE Iterator& operator++() { mIndex = mBitmapIter.getNext(); return *this; }
PX_INLINE bool done() const { return mIndex == Cm::BitMap::Iterator::DONE; }
private:
Iterator& operator=(const Iterator&);
Cm::IndexedPool<T, EltsPerSlab>& mPool;
Cm::BitMap::Iterator mBitmapIter;
PxU32 mIndex;
};
private:
PX_INLINE T* get()
{
if(mFreeList.size() == 0 && !extend())
return 0;
T* element = mFreeList.popBack();
mUsedBitmap.growAndSet(element->getPoolIndex());
return element;
}
bool extend()
{
T* mAddr = reinterpret_cast<T*>(PX_ALLOC(EltsPerSlab * sizeof(T), PX_DEBUG_EXP("char")));
if(!mAddr)
return false;
mFreeList.reserve(EltsPerSlab);
for(PxI32 i=EltsPerSlab-1;i>=0;i--)
{
IndexedPoolEntry *e = static_cast<IndexedPoolEntry *>(reinterpret_cast<T *>(mAddr+i));
new(e)IndexedPoolEntry(mSlabs.size()*EltsPerSlab+i);
mFreeList.pushBack(mAddr+i);
}
mSlabs.pushBack(mAddr);
mUsedBitmap.growAndReset(mSlabs.size()*EltsPerSlab-1); //make sure the bitmap is up to size
return true;
}
Ps::Array<T*> mSlabs;
Ps::Array<T*> mFreeList;
Cm::BitMap mUsedBitmap;
friend class Iterator;
};
} // namespace Cm
}
#endif
|
//
// NSString+SwpDate.h
// swp_song
//
// Created by swp_song on 16/6/2.
// Copyright © 2016年 swp_song. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (SwpDate)
/**
* @author swp_song
*
* @brief swpDateGetSystemDateWithDateFormat: ( 获取当前系统时间,按照指定格式转换成字符串 )
*
* @param dateFormat dateFormat
*
* @return NSString
*/
+ (NSString *)swpDateGetSystemDateWithDateFormat:(NSString *)dateFormat;
/**
* @author swp_song
*
* @brief swpDateFormatDate: ( 格式化时间,按照指定格式 )
*
* @param formatDate formatDate
*
* @param formatString formatString
*
* @return NSString
*/
+ (NSString *)swpDateFormatDate:(NSDate *)formatDate formatString:(NSString *)formatString;
@end
NS_ASSUME_NONNULL_END
|
//
// BSGEventUploader.h
// Bugsnag
//
// Created by Nick Dowell on 16/02/2021.
// Copyright © 2021 Bugsnag Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@class BugsnagApiClient;
@class BugsnagConfiguration;
@class BugsnagEvent;
@class BugsnagNotifier;
NS_ASSUME_NONNULL_BEGIN
@interface BSGEventUploader : NSObject
- (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration notifier:(BugsnagNotifier *)notifier;
- (void)storeEvent:(BugsnagEvent *)event;
- (void)uploadEvent:(BugsnagEvent *)event completionHandler:(nullable void (^)(void))completionHandler;
- (void)uploadStoredEvents;
- (void)uploadStoredEventsAfterDelay:(NSTimeInterval)delay;
- (void)uploadLatestStoredEvent:(void (^)(void))completionHandler;
@end
NS_ASSUME_NONNULL_END
|
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_CONVEX_POINT_CLOUD_SHAPE_H
#define BT_CONVEX_POINT_CLOUD_SHAPE_H
#include "btPolyhedralConvexShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
#include "LinearMath/btAlignedObjectArray.h"
///The btConvexPointCloudShape implements an implicit convex hull of an array of vertices.
ATTRIBUTE_ALIGNED16(class) btConvexPointCloudShape : public btPolyhedralConvexShape
{
btVector3* m_unscaledPoints;
int m_numPoints;
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btConvexPointCloudShape(btVector3* points,int numPoints, const btVector3& localScaling,bool computeAabb = true)
{
m_localScaling = localScaling;
m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE;
m_unscaledPoints = points;
m_numPoints = numPoints;
if (computeAabb)
recalcLocalAabb();
}
void setPoints (btVector3* points, int numPoints, bool computeAabb = true)
{
m_unscaledPoints = points;
m_numPoints = numPoints;
if (computeAabb)
recalcLocalAabb();
}
SIMD_FORCE_INLINE btVector3* getUnscaledPoints()
{
return m_unscaledPoints;
}
SIMD_FORCE_INLINE const btVector3* getUnscaledPoints() const
{
return m_unscaledPoints;
}
SIMD_FORCE_INLINE int getNumPoints() const
{
return m_numPoints;
}
SIMD_FORCE_INLINE btVector3 getScaledPoint( int index) const
{
return m_unscaledPoints[index] * m_localScaling;
}
#ifndef __SPU__
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
#endif
//debugging
virtual const char* getName()const {return "ConvexPointCloud";}
virtual int getNumVertices() const;
virtual int getNumEdges() const;
virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
virtual void getVertex(int i,btVector3& vtx) const;
virtual int getNumPlanes() const;
virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
///in case we receive negative scaling
virtual void setLocalScaling(const btVector3& scaling);
};
#endif //BT_CONVEX_POINT_CLOUD_SHAPE_H
|
#pragma once
#include <vector>
#include <absl/types/optional.h>
#include "chainerx/array_fwd.h"
#include "chainerx/backward_fwd.h"
#include "chainerx/device.h"
#include "chainerx/dtype.h"
#include "chainerx/graph.h"
#include "chainerx/shape.h"
namespace chainerx {
class BackwardContext;
namespace internal {
class ArrayBody;
class ArrayNode;
// Throws GradientError in case of mismatch in gradient array props.
void AccumulateGrad(absl::optional<Array>& target_grad, Array partial_grad, const Shape& shape, Dtype dtype, Device& device);
// Throws GradientError in case of mismatch in gradient array props.
void SetGrad(absl::optional<Array>& target_grad, Array grad, const Shape& shape, Dtype dtype, Device& device);
} // namespace internal
// Updates the gradients held by the input arrays using backpropagation.
//
// This functions is not thread safe.
void Backward(
const Array& output,
const absl::optional<BackpropId>& backprop_id = absl::nullopt,
DoubleBackpropOption double_backprop = DoubleBackpropOption::kDisable,
const absl::optional<float>& loss_scale = absl::nullopt);
// Updates the gradients held by the input arrays using backpropagation.
//
// This functions is not thread safe.
void Backward(
const std::vector<ConstArrayRef>& outputs,
const absl::optional<BackpropId>& backprop_id = absl::nullopt,
DoubleBackpropOption double_backprop = DoubleBackpropOption::kDisable,
const absl::optional<float>& loss_scale = absl::nullopt);
// Returns gradient arrays for all inputs.
std::vector<absl::optional<Array>> Grad(
const std::vector<ConstArrayRef>& outputs,
const std::vector<ConstArrayRef>& inputs,
const absl::optional<BackpropId>& backprop_id = absl::nullopt,
DoubleBackpropOption double_backprop = DoubleBackpropOption::kDisable,
bool set_grad = false,
bool retain_grad = false,
const std::vector<ConstArrayRef>& grad_outputs = {},
const absl::optional<float>& loss_scale = absl::nullopt);
} // namespace chainerx
|
#ifndef P2PTEST_H
#define P2PTEST_H
#include "include/MPI/Environment.h"
#include "include/MPI/Communicator.h"
int P2PTest( _MYNAMESPACE_::MPI::Environment::CommPtr &comm );
int BcastTest( _MYNAMESPACE_::MPI::Environment::CommPtr &comm );
int CorrectiveTest( _MYNAMESPACE_::MPI::Environment::CommPtr &comm );
int CorrectiveAllTest( _MYNAMESPACE_::MPI::Environment::CommPtr &comm );
int WindowObjectTest( _MYNAMESPACE_::MPI::Environment::CommPtr &comm );
#endif // P2PTEST_H
|
//
// MRCReposItemViewModel.h
// MVVMReactiveCocoa
//
// Created by leichunfeng on 15/1/14.
// Copyright (c) 2015年 leichunfeng. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MRCOwnedReposViewModel.h"
@interface MRCReposItemViewModel : NSObject
@property (strong, nonatomic, readonly) OCTRepository *repository;
@property (copy, nonatomic) NSAttributedString *name;
@property (copy, nonatomic) NSString *updateTime;
@property (copy, nonatomic, readonly) NSString *language;
@property (assign, nonatomic) CGFloat height;
@property (copy, nonatomic) NSAttributedString *repoDescription;
@property (assign, nonatomic, readonly) MRCReposViewModelOptions options;
- (instancetype)initWithRepository:(OCTRepository *)repository options:(MRCReposViewModelOptions)options;
@end
|
#include <jni.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <magick/api.h>
#include "jmagick.h"
//#include "magick_ImageInfo.h"
/*
* Class: magick_QuantizeInfo
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_magick_QuantizeInfo_init
(JNIEnv *env, jobject self)
{
QuantizeInfo *quantizeInfo = NULL;
jfieldID fid = 0;
quantizeInfo =
(QuantizeInfo*) getHandle(env, self, "quantizeInfoHandle", &fid);
if (quantizeInfo == NULL) {
quantizeInfo = (QuantizeInfo *) AcquireMemory(sizeof(QuantizeInfo));
if (quantizeInfo == NULL) {
throwMagickException(env, "Unable to allow memory for handle");
return;
}
}
GetQuantizeInfo(quantizeInfo);
setHandle(env, self, "quantizeInfoHandle", (void*) quantizeInfo, &fid);
}
/*
* Class: magick_QuantizeInfo
* Method: destroyQuantizeInfo
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_magick_QuantizeInfo_destroyQuantizeInfo
(JNIEnv *env, jobject self)
{
QuantizeInfo *quantizeInfo = NULL;
jfieldID handleFid = 0;
quantizeInfo = (QuantizeInfo*) getHandle(env, self,
"quantizeInfoHandle", &handleFid);
if (quantizeInfo != NULL) {
setHandle(env, self, "quantizeInfoHandle", NULL, &handleFid);
DestroyQuantizeInfo(quantizeInfo);
}
}
/*
* Class: magick_QuantizeInfo
* Method: setNumberColors
* Signature: (I)V
*/
setIntMethod(Java_magick_QuantizeInfo_setNumberColors,
number_colors,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: getNumberColors
* Signature: ()I
*/
getIntMethod(Java_magick_QuantizeInfo_getNumberColors,
number_colors,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: setTreeDepth
* Signature: (I)V
*/
setIntMethod(Java_magick_QuantizeInfo_setTreeDepth,
tree_depth,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: getTreeDepth
* Signature: ()I
*/
getIntMethod(Java_magick_QuantizeInfo_getTreeDepth,
tree_depth,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: setDither
* Signature: (I)V
*/
setIntMethod(Java_magick_QuantizeInfo_setDither,
dither,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: getDither
* Signature: ()I
*/
getIntMethod(Java_magick_QuantizeInfo_getDither,
dither,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: setColorspace
* Signature: (I)V
*/
setIntMethod(Java_magick_QuantizeInfo_setColorspace,
colorspace,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: getColorspace
* Signature: ()I
*/
getIntMethod(Java_magick_QuantizeInfo_getColorspace,
colorspace,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: setMeasureError
* Signature: (I)V
*/
setIntMethod(Java_magick_QuantizeInfo_setMeasureError,
measure_error,
"quantizeInfoHandle",
QuantizeInfo)
/*
* Class: magick_QuantizeInfo
* Method: getMeasureError
* Signature: ()I
*/
getIntMethod(Java_magick_QuantizeInfo_getMeasureError,
measure_error,
"quantizeInfoHandle",
QuantizeInfo)
|
#pragma once
#include "CocoaDeviceTools.h"
#include "CocoaGLManager.h"
#include "CocoaUXEvent.h"
#include "CocoaViews.h"
inline std::string NSToCppString(void *s);
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#ifndef __UNIX_PRODUCTSOFTWAREFEATURES_H
#define __UNIX_PRODUCTSOFTWAREFEATURES_H
#include "CIM_ClassBase.h"
#include "UNIX_ProductSoftwareFeaturesDeps.h"
#define PROPERTY_PRODUCT "Product"
#define PROPERTY_COMPONENT "Component"
class UNIX_ProductSoftwareFeatures :
public CIM_ClassBase
{
public:
UNIX_ProductSoftwareFeatures();
~UNIX_ProductSoftwareFeatures();
virtual Boolean initialize();
virtual Boolean load(int&);
virtual Boolean finalize();
virtual Boolean find(Array<CIMKeyBinding>&);
virtual Boolean validateKey(CIMKeyBinding&) const;
virtual void setScope(CIMName);
virtual Boolean getProduct(CIMProperty&) const;
virtual CIMInstance getProduct() const;
virtual Boolean getComponent(CIMProperty&) const;
virtual CIMInstance getComponent() const;
private:
CIMName currentScope;
# include "UNIX_ProductSoftwareFeaturesPrivate.h"
};
#endif /* UNIX_PRODUCTSOFTWAREFEATURES */
|
#ifndef BITMAP_ROUTINES
#define BITMAP_ROUTINES
/*
Misc bitmap routines headers
*/
#include "includes.prl"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos/dos.h>
#include <exec/types.h> /* The Amiga data types file. */
#include <exec/memory.h> /* The Amiga data types file. */
#include <exec/libraries.h>
#include <intuition/intuition.h> /* Intuition data strucutres, etc. */
#include <libraries/dos.h> /* Official return codes defined here */
#include <devices/keyboard.h>
#include <clib/exec_protos.h> /* Exec function prototypes */
#include <clib/alib_protos.h>
#include <clib/graphics_protos.h> /* Exec function prototypes */
#include <clib/intuition_protos.h> /* Intuition function prototypes */
PLANEPTR load_getmem(UBYTE *name, ULONG size);
PLANEPTR load_getchipmem(UBYTE *name, ULONG size);
PLANEPTR load_zlib_getchipmem(UBYTE *name, ULONG size, ULONG zip_size);
struct BitMap *load_zlib_file_as_bitmap(UBYTE *name, ULONG input_size, ULONG output_size, UWORD width, UWORD height, UWORD depth);
struct BitMap *load_file_as_bitmap(UBYTE *name, ULONG byte_size, UWORD width, UWORD height, UWORD depth);
struct BitMap *load_array_as_bitmap(UWORD *bitmap_array, ULONG array_size, UWORD width, UWORD height, UWORD depth);
void load_file_into_existing_bitmap(struct BitMap *new_bitmap, BYTE *name, ULONG byte_size, UWORD depth);
void free_allocated_bitmap(struct BitMap *allocated_bitmap);
void disp_whack(struct BitMap *src_BitMap, struct BitMap *dest_BitMap, UWORD width, UWORD height, UWORD x, UWORD y, UWORD depth);
void disp_interleaved_st_format(PLANEPTR data, struct BitMap *dest_BitMap, UWORD width, UWORD height, UWORD src_y, UWORD x, UWORD y, UWORD depth);
#define FREE_ALLOCATED_BITMAP(ptr_name) /*printf("free_allocated_bitmap(%s) : 0x%x\n", #ptr_name, ptr_name);*/ free_allocated_bitmap(ptr_name);
/* Simple bitblit */
#define BLIT_BITMAP_S(SRC_BITMAP, DEST_BITMAP, WIDTH, HEIGHT, X, Y) BltBitMap(SRC_BITMAP, 0, 0, \
DEST_BITMAP, X, Y, \
WIDTH, HEIGHT, \
0xC0, 0xFF, NULL);
#define FREE_BITMAP(BITMAP_TMP) ;
#endif // #ifndef BITMAP_ROUTINES |
/*
* Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2015 Intel Corporation.
*
* 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.
*/
#pragma once
#include <string>
#include <mraa/aio.h>
namespace upm {
/**
* @brief GroveEMG Muscle Signal reader sensor library
* @defgroup groveemg libupm-groveemg
* @ingroup seeed analog electric
*/
/**
* @library groveemg
* @sensor groveemg
* @comname Grove EMG Sensor
* @type electric
* @man seeed
* @con analog
*
* @brief API for the GroveEMG Muscle Signal Reader Sensor
*
* GroveEMG Muscle Signal reader gathers small muscle signals,
* then processes and returns the result
*
* @image html groveemg.jpg
* @snippet groveemg.cxx Interesting
*/
class GroveEMG {
public:
/**
* GroveEMG sensor constructor
*
* @param pin analog pin to use
*/
GroveEMG(int pin);
/**
* GroveEMG Destructor
*/
~GroveEMG();
/**
* Calibrate the GroveEMG Sensor
*/
void calibrate();
/**
* Measure the muscle signals from the sensor
*
* @return the muscle output as analog voltage
*/
int value();
private:
mraa_aio_context m_aio;
};
}
|
//
// SXDistrictViewController.h
// 88 - SX团购HD
//
// Created by 董 尚先 on 15/2/5.
// Copyright (c) 2015年 shangxianDante. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SXDistrictViewController : UIViewController
/** 这个控制器显示的所有区域数据 */
@property (nonatomic, strong) NSArray *districts;
@end
|
//
// UserManager.h
// _BusinessApp_
//
// Created by Gytenis Mikulėnas on 4/19/14.
// Copyright (c) 2015 Gytenis Mikulėnas
// https://github.com/GitTennis/SuccessFramework
//
// 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. All rights reserved.
//
#import "UserManagerProtocol.h"
#import "UserObject.h"
@interface UserManager : NSObject <UserManagerProtocol>
@end
|
/**********************************************************************************
* Copyright (c) 2008-2010 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are 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 Materials.
*
* THE MATERIALS ARE 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
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
**********************************************************************************/
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
/* OpenGL dependencies. */
#ifndef __OPENCL_CL_GL_EXT_H
#define __OPENCL_CL_GL_EXT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include "CL/cl_gl.h"
#endif
/*
* For each extension, follow this template
* / * cl_VEN_extname extension */
/* #define cl_VEN_extname 1
* ... define new types, if any
* ... define new tokens, if any
* ... define new APIs, if any
*
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
* This allows us to avoid having to decide whether to include GL headers or GLES here.
*/
/*
* cl_khr_gl_event extension
* See section 9.9 in the OpenCL 1.1 spec for more information
*/
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
extern CL_API_ENTRY cl_event CL_API_CALL
clCreateEventFromGLsyncKHR(cl_context /* context */,
cl_GLsync /* cl_GLsync */,
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
#ifdef __cplusplus
}
#endif
#endif /* __OPENCL_CL_GL_EXT_H */
|
/*
Copyright (c) 2013 250bpm s.r.o. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#include "fsm.h"
#include "worker.h"
#include "../utils/win.h"
struct nn_usock {
/* The state machine. */
struct nn_fsm fsm;
int state;
union {
/* The actual underlying socket. Can be used as a HANDLE too. */
SOCKET s;
/* Named pipe handle. Cannot be used as a SOCKET. */
HANDLE p;
};
/* For NamedPipes, closing an accepted pipe differs from other pipes.
If the NamedPipe was accepted, this member is set to 1. 0 otherwise. */
int isaccepted;
/* Asynchronous operations being executed on the socket. */
struct nn_worker_op in;
struct nn_worker_op out;
/* When accepting new socket, they have to be created with same
type as the listening socket. Thus, in listening socket we
have to store its exact type. */
int domain;
int type;
int protocol;
/* Events raised by the usock. */
struct nn_fsm_event event_established;
struct nn_fsm_event event_sent;
struct nn_fsm_event event_received;
struct nn_fsm_event event_error;
/* In ACCEPTING state points to the socket being accepted.
In BEING_ACCEPTED state points to the listener socket. */
struct nn_usock *asock;
/* Buffer allocated for output of AcceptEx function. If accepting is not
done on this socket, the field is set to NULL. */
void *ainfo;
/* For NamedPipes, we store the address inside the socket. */
struct sockaddr_un pipename;
/* For now we allocate a new buffer for each write to a named pipe. */
void *pipesendbuf;
/* Errno remembered in NN_USOCK_ERROR state */
int errnum;
};
|
// Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
#pragma once
#include "../../../Core/Prefix.h"
#include "DX11.h"
#if PLATFORMOS_ACTIVE != PLATFORMOS_WINDOWS
#pragma message("IncludeDX11.h -- only valid for Windows API targets. Exclude from inclusion for other targets.")
#endif
// include windows in a controlled manner (before d3d11 includes it!)
// (try to limit including DX11.h to just this place)
#include "../../../Core/WinAPI/IncludeWindows.h"
#if DX_VERSION == DX_VERSION_11_1
#include <d3d11_1.h>
#else
#include <d3d11.h>
#endif
|
#include "network.h"
#include "utils.h"
#include "parser.h"
#include "option_list.h"
#include "blas.h"
#include "classifier.h"
#include <sys/time.h>
void demo_art(char *cfgfile, char *weightfile, int cam_index)
{
#ifdef OPENCV
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);
srand(2222222);
CvCapture * cap;
cap = cvCaptureFromCAM(cam_index);
char *window = "ArtJudgementBot9000!!!";
if(!cap) error("Couldn't connect to webcam.\n");
cvNamedWindow(window, CV_WINDOW_NORMAL);
cvResizeWindow(window, 512, 512);
int i;
int idx[] = {37, 401, 434};
int n = sizeof(idx)/sizeof(idx[0]);
while(1){
image in = get_image_from_stream(cap);
image in_s = resize_image(in, net.w, net.h);
show_image(in, window);
float *p = network_predict(net, in_s.data);
printf("\033[2J");
printf("\033[1;1H");
float score = 0;
for(i = 0; i < n; ++i){
float s = p[idx[i]];
if (s > score) score = s;
}
score = score;
printf("I APPRECIATE THIS ARTWORK: %10.7f%%\n", score*100);
printf("[");
int upper = 30;
for(i = 0; i < upper; ++i){
printf("%c", ((i+.5) < score*upper) ? 219 : ' ');
}
printf("]\n");
free_image(in_s);
free_image(in);
cvWaitKey(1);
}
#endif
}
void run_art(int argc, char **argv)
{
int cam_index = find_int_arg(argc, argv, "-c", 0);
char *cfg = argv[2];
char *weights = argv[3];
demo_art(cfg, weights, cam_index);
}
|
/**********************************************************************
ruby.h -
$Author$
created at: Sun 10 12:06:15 Jun JST 2007
Copyright (C) 2007-2008 Yukihiro Matsumoto
**********************************************************************/
#ifndef RUBY_H
#define RUBY_H 1
#define HAVE_RUBY_DEFINES_H 1
#define HAVE_RUBY_ENCODING_H 1
#define HAVE_RUBY_INTERN_H 1
#define HAVE_RUBY_IO_H 1
#define HAVE_RUBY_MISSING_H 1
#define HAVE_RUBY_ONIGURUMA_H 1
#define HAVE_RUBY_RE_H 1
#define HAVE_RUBY_REGEX_H 1
#define HAVE_RUBY_RUBY_H 1
#define HAVE_RUBY_ST_H 1
#define HAVE_RUBY_UTIL_H 1
#define HAVE_RUBY_VERSION_H 1
#define HAVE_RUBY_VM_H 1
#ifdef _WIN32
#define HAVE_RUBY_WIN32_H 1
#endif
#include "ruby/ruby.h"
extern int rubby;
VALUE get_reversal(void);
#endif /* RUBY_H */
|
/**************************************************************************//**
* @file efr32mg14p_lesense_st.h
* @brief EFR32MG14P_LESENSE_ST register and bit field definitions
* @version 5.4.0
******************************************************************************
* # License
* <b>Copyright 2017 Silicon Laboratories, Inc. www.silabs.com</b>
******************************************************************************
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software.@n
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.@n
* 3. This notice may not be removed or altered from any source distribution.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc.
* has no obligation to support this Software. Silicon Laboratories, Inc. is
* providing the Software "AS IS", with no express or implied warranties of any
* kind, including, but not limited to, any implied warranties of
* merchantability or fitness for any particular purpose or warranties against
* infringement of any proprietary rights of a third party.
*
* Silicon Laboratories, Inc. will not be liable for any consequential,
* incidental, or special damages, or any other relief, or for any claim by
* any third party, arising from your use of this Software.
*
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__ICCARM__)
#pragma system_include /* Treat file as system include file. */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* Treat file as system include file. */
#endif
/**************************************************************************//**
* @addtogroup Parts
* @{
******************************************************************************/
/**************************************************************************//**
* @brief LESENSE_ST LESENSE ST Register
* @ingroup EFR32MG14P_LESENSE
*****************************************************************************/
typedef struct {
__IOM uint32_t TCONFA; /**< State Transition Configuration a */
__IOM uint32_t TCONFB; /**< State Transition Configuration B */
} LESENSE_ST_TypeDef;
/** @} End of group Parts */
#ifdef __cplusplus
}
#endif
|
// ----------------------------------------------------------------------- PLATFORM
#include "utils/src/common/platform.h"
// --------------------------------------------------------------------------------
#ifdef COMPILER_VISUAL_STUDIO
#pragma warning(disable : 4786)
#ifndef WINVER // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#endif // COMPILER_VISUAL_STUDIO
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <functional>
#include <iostream>
#include <sstream>
#include <limits>
#include <float.h>
#include <list>
#include <math.h>
#include <time.h>
#include "utils/src/common/rdocommon.h"
#include "utils/src/debug/rdodebug.h"
|
#ifndef FRAMESOURCESTATUSINDEX_H
#define FRAMESOURCESTATUSINDEX_H
#include "eirFrameSource.h"
#include "../eirBase/Enumeration.h"
#define FRAMESOURCESTATUSINDEX_ENUM(NV) \
NV(Initialization, = 0) \
NV(FirstConnection,) \
NV(LastConnection,) \
NV(Configured,) \
NV(LastStarted,) \
NV(Pause,) \
NV(Finished,) \
NV(Error,) \
NV(UserBegin, = 31) \
NV(UserEnd, = 63) \
/* Plugins inheriting FrameSourcePlugin should register indexes
between UserBegin+1 and UserEnd-1.
*/
class EIRFRAMESOURCESHARED_EXPORT FrameSourceStatusIndex
: public Enumeration
{
DECLARE_ENUMERATION(FrameSourceStatusIndex,
FRAMESOURCESTATUSINDEX_ENUM)
};
#endif // FRAMESOURCESTATUSINDEX_H
|
30 mtime=1386528019.522031874
30 atime=1386528021.117011934
30 ctime=1386528019.522031874
|
/**************************************************************************************************
* *
* This file is part of HPIPM. *
* *
* HPIPM -- High-Performance Interior Point Method. *
* Copyright (C) 2019 by Gianluca Frison. *
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
* All rights reserved. *
* *
* The 2-Clause BSD License *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, this *
* list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright notice, *
* this list of conditions and the following disclaimer in the documentation *
* and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
* *
**************************************************************************************************/
#ifndef HPIPM_D_DENSE_QP_UTILS_H_
#define HPIPM_D_DENSE_QP_UTILS_H_
#include <blasfeo_target.h>
#include <blasfeo_common.h>
#include "hpipm_d_dense_qp_dim.h"
#include "hpipm_d_dense_qp.h"
#include "hpipm_d_dense_qp_sol.h"
#include "hpipm_d_dense_qp_ipm.h"
#ifdef __cplusplus
extern "C" {
#endif
//
void d_dense_qp_dim_print(struct d_dense_qp_dim *qp_dim);
//
//void d_dense_qp_dim_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim);
//
void d_dense_qp_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp *qp);
//
//void d_dense_qp_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim, struct d_dense_qp *qp);
//
void d_dense_qp_sol_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_sol *dense_qp_sol);
//
//void d_dense_qp_ipm_arg_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *arg);
//
void d_dense_qp_res_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_res *dense_qp_res);
//
void d_dense_qp_arg_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *qp_ipm_arg);
#ifdef __cplusplus
} // #extern "C"
#endif
#endif // HPIPM_D_DENSE_QP_UTILS_H_
|
//
// c3dSpan.h
// HelloOpenGL
//
// Created by wantnon (yang chao) on 14-2-19.
//
//
#ifndef __HelloOpenGL__c3dSpan__
#define __HelloOpenGL__c3dSpan__
#include <iostream>
using namespace std;
class Cc3dSpan{
protected:
float m_spanX;
float m_spanY;
float m_spanZ;
public:
Cc3dSpan(){
initMembers();
}
Cc3dSpan(float spanX,float spanY,float spanZ){
initMembers();
init(spanX,spanY,spanZ);
}
virtual~Cc3dSpan(){}
void init(float spanX,float spanY,float spanZ){
m_spanX=spanX;
m_spanY=spanY;
m_spanZ=spanZ;
}
void setSpanX(float spanX){
m_spanX=spanX;
}
void setSpanY(float spanY){
m_spanY=spanY;
}
void setSpanZ(float spanZ){
m_spanZ=spanZ;
}
float getSpanX()const{return m_spanX;}
float getSpanY()const{return m_spanY;}
float getSpanZ()const{return m_spanZ;}
protected:
void initMembers(){
m_spanX=0;
m_spanY=0;
m_spanZ=0;
}
};
#endif /* defined(__HelloOpenGL__c3dSpan__) */
|
#include "Core.h"
#include "DiscordRpc.h" |
/*
* libjingle
* Copyright 2004--2005, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __THREAD_H__
#define __THREAD_H__
#include "talk/base/messagequeue.h"
#include <algorithm>
#include <list>
#include <vector>
#ifdef POSIX
#include <pthread.h>
#endif
#ifdef WIN32
#include "talk/base/win32.h"
#endif
namespace cricket {
class Thread;
class ThreadManager {
public:
ThreadManager();
~ThreadManager();
static Thread *CurrentThread();
static void SetCurrent(Thread *thread);
void Add(Thread *thread);
void Remove(Thread *thread);
private:
Thread *main_thread_;
std::vector<Thread *> threads_;
CriticalSection crit_;
#ifdef POSIX
static pthread_key_t key_;
#endif
#ifdef WIN32
static DWORD key_;
#endif
};
class Thread;
struct _SendMessage {
_SendMessage() {}
Thread *thread;
Message msg;
bool *ready;
};
class Thread : public MessageQueue {
public:
Thread(SocketServer* ss = 0);
virtual ~Thread();
static inline Thread* Current() {
return ThreadManager::CurrentThread();
}
inline bool IsCurrent() const {
return (ThreadManager::CurrentThread() == this);
}
virtual void Start();
virtual void Stop();
virtual void Loop(int cms = -1);
virtual void Send(MessageHandler *phandler, uint32 id = 0,
MessageData *pdata = NULL);
// From MessageQueue
virtual void Clear(MessageHandler *phandler, uint32 id = (uint32)-1);
virtual void ReceiveSends();
#ifdef WIN32
HANDLE GetHandle() {
return thread_;
}
#endif
private:
static void *PreLoop(void *pv);
void Join();
std::list<_SendMessage> sendlist_;
bool started_;
bool has_sends_;
#ifdef POSIX
pthread_t thread_;
#endif
#ifdef WIN32
HANDLE thread_;
#endif
friend class ThreadManager;
};
// AutoThread automatically installs itself at construction
// uninstalls at destruction, if a Thread object is
// _not already_ associated with the current OS thread.
class AutoThread : public Thread {
public:
AutoThread(SocketServer* ss = 0);
virtual ~AutoThread();
};
} // namespace cricket
#endif // __THREAD_H__
|
/*
* Copyright (C) 2015, 2016 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.
*/
#pragma once
#include <functional>
#if LOG_DISABLED
#define LOG_WITH_STREAM(channel, commands) ((void)0)
#else
#define LOG_WITH_STREAM(channel, commands) do { \
WebCore::TextStream stream(WebCore::TextStream::LineMode::SingleLine); \
commands; \
WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), "%s", stream.release().utf8().data()); \
} while (0)
#endif // !LOG_DISABLED
|
/* horst - Highly Optimized Radio Scanning Tool
*
* Copyright (C) 2005-2011 Bruno Randolf (br1@einfach.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/******************* HISTORY *******************/
#include <stdlib.h>
#include "display.h"
#include "main.h"
#include "util.h"
#define SIGN_POS LINES-17
#define TYPE_POS SIGN_POS+1
#define RATE_POS LINES-2
void
update_history_win(WINDOW *win)
{
int i;
int col = COLS-2;
int sig, noi = 0, rat;
if (col > MAX_HISTORY)
col = 4 + MAX_HISTORY;
werase(win);
wattron(win, WHITE);
box(win, 0 , 0);
print_centered(win, 0, COLS, " Signal/Noise/Rate History ");
mvwhline(win, SIGN_POS, 1, ACS_HLINE, col);
mvwhline(win, SIGN_POS+2, 1, ACS_HLINE, col);
mvwvline(win, 1, 4, ACS_VLINE, LINES-3);
wattron(win, GREEN);
mvwprintw(win, 2, 1, "dBm");
mvwprintw(win, normalize_db(30, SIGN_POS - 1) + 1, 1, "-30");
mvwprintw(win, normalize_db(40, SIGN_POS - 1) + 1, 1, "-40");
mvwprintw(win, normalize_db(50, SIGN_POS - 1) + 1, 1, "-50");
mvwprintw(win, normalize_db(60, SIGN_POS - 1) + 1, 1, "-60");
mvwprintw(win, normalize_db(70, SIGN_POS - 1) + 1, 1, "-70");
mvwprintw(win, normalize_db(80, SIGN_POS - 1) + 1, 1, "-80");
mvwprintw(win, normalize_db(90, SIGN_POS - 1) + 1, 1, "-90");
mvwprintw(win, SIGN_POS-1, 1, "-99");
mvwprintw(win, 1, col-6, "Signal");
wattron(win, RED);
mvwprintw(win, 2, col-5, "Noise");
wattron(win, CYAN);
mvwprintw(win, TYPE_POS, 1, "TYP");
mvwprintw(win, 3, col-11, "Packet Type");
wattron(win, A_BOLD);
wattron(win, BLUE);
mvwprintw(win, 4, col-4, "Rate");
mvwprintw(win, RATE_POS-12, 1, "54M");
mvwprintw(win, RATE_POS-11, 1, "48M");
mvwprintw(win, RATE_POS-10, 1, "36M");
mvwprintw(win, RATE_POS-9, 1, "24M");
mvwprintw(win, RATE_POS-8, 1, "18M");
mvwprintw(win, RATE_POS-7, 1, "12M");
mvwprintw(win, RATE_POS-6, 1, "11M");
mvwprintw(win, RATE_POS-5, 1, " 9M");
mvwprintw(win, RATE_POS-4, 1, " 6M");
mvwprintw(win, RATE_POS-3, 1, "5.M");
mvwprintw(win, RATE_POS-2, 1, " 2M");
mvwprintw(win, RATE_POS-1, 1, " 1M");
wattroff(win, A_BOLD);
i = hist.index - 1;
while (col > 4 && hist.signal[i] != 0)
{
sig = normalize_db(-hist.signal[i], SIGN_POS - 1);
if (hist.noise[i])
noi = normalize_db(-hist.noise[i], SIGN_POS - 1);
wattron(win, ALLGREEN);
mvwvline(win, sig + 1, col, ACS_BLOCK, SIGN_POS - sig - 1);
if (hist.noise[i]) {
wattron(win, ALLRED);
mvwvline(win, noi + 1, col, '=', SIGN_POS - noi -1);
}
wattron(win, get_packet_type_color(hist.type[i]));
mvwprintw(win, TYPE_POS, col, "%c", \
get_packet_type_char(hist.type[i]));
if (hist.retry[i])
mvwprintw(win, TYPE_POS+1, col, "r");
switch (hist.rate[i]/2) {
case 54: rat = 12; break;
case 48: rat = 11; break;
case 36: rat = 10; break;
case 24: rat = 9; break;
case 18: rat = 8; break;
case 12: rat = 7; break;
case 11: rat = 6; break;
case 9: rat = 5; break;
case 6: rat = 4; break;
case 5: rat = 3; break;
case 2: rat = 2; break;
case 1: rat = 1; break;
default: rat = 0;
}
wattron(win, A_BOLD);
wattron(win, BLUE);
mvwvline(win, RATE_POS - rat, col, 'x', rat);
wattroff(win, A_BOLD);
i--;
col--;
if (i < 0)
i = MAX_HISTORY-1;
}
wnoutrefresh(win);
}
|
/* Return string associated with given attribute.
Copyright (C) 2003, 2005, 2008, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
This file is free software; you can redistribute it and/or modify
it under the terms of either
* 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
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
or both in parallel, as here.
elfutils 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 copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "libdwP.h"
#include <string.h>
int
dwarf_haschildren (die)
Dwarf_Die *die;
{
/* Find the abbreviation entry. */
Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
if (unlikely (abbrevp == DWARF_END_ABBREV))
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;
}
return abbrevp->has_children;
}
INTDEF (dwarf_haschildren)
|
/* fs/ internal definitions
*
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.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
* 2 of the License, or (at your option) any later version.
*/
#include <linux/lglock.h>
struct super_block;
struct file_system_type;
struct linux_binprm;
struct path;
struct mount;
/*
* block_dev.c
*/
#ifdef CONFIG_BLOCK
extern void __init bdev_cache_init(void);
extern int __sync_blockdev(struct block_device *bdev, int wait);
#else
static inline void bdev_cache_init(void)
{
}
static inline int __sync_blockdev(struct block_device *bdev, int wait)
{
return 0;
}
#endif
/*
* char_dev.c
*/
extern void __init chrdev_init(void);
/*
* namespace.c
*/
extern int copy_mount_options(const void __user *, unsigned long *);
extern int copy_mount_string(const void __user *, char **);
extern struct vfsmount *lookup_mnt(struct path *);
extern int finish_automount(struct vfsmount *, struct path *);
extern int sb_prepare_remount_readonly(struct super_block *);
extern void __init mnt_init(void);
extern struct lglock vfsmount_lock;
extern int __mnt_want_write(struct vfsmount *);
extern int __mnt_want_write_file(struct file *);
extern void __mnt_drop_write(struct vfsmount *);
extern void __mnt_drop_write_file(struct file *);
/*
* fs_struct.c
*/
extern void chroot_fs_refs(const struct path *, const struct path *);
/*
* file_table.c
*/
extern void file_sb_list_add(struct file *f, struct super_block *sb);
extern void file_sb_list_del(struct file *f);
extern void mark_files_ro(struct super_block *);
extern struct file *get_empty_filp(void);
/*
* super.c
*/
extern int do_remount_sb(struct super_block *, int, void *, int);
extern bool grab_super_passive(struct super_block *sb);
extern struct dentry *mount_fs(struct file_system_type *,
int, const char *, void *);
extern struct super_block *user_get_super(dev_t);
/*
* open.c
*/
struct open_flags {
int open_flag;
umode_t mode;
int acc_mode;
int intent;
};
extern struct file *do_filp_open(int dfd, struct filename *pathname,
const struct open_flags *op, int flags);
extern struct file *do_file_open_root(struct dentry *, struct vfsmount *,
const char *, const struct open_flags *, int lookup_flags);
extern long do_handle_open(int mountdirfd,
struct file_handle __user *ufh, int open_flag);
extern int open_check_o_direct(struct file *f);
/*
* inode.c
*/
extern spinlock_t inode_sb_list_lock;
extern void inode_add_lru(struct inode *inode);
/*
* fs-writeback.c
*/
extern void inode_wb_list_del(struct inode *inode);
extern int get_nr_dirty_inodes(void);
extern void evict_inodes(struct super_block *);
extern int invalidate_inodes(struct super_block *, bool);
/*
* dcache.c
*/
extern struct dentry *__d_alloc(struct super_block *, const struct qstr *);
/*
* read_write.c
*/
extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
|
/*
* acpikcfg.h - ACPI based Kernel Configuration Manager External Interfaces
*
* Copyright (C) 2000 Intel Corp.
* Copyright (C) 2000 J.I. Lee <jung-ik.lee@intel.com>
*/
#include <linux/config.h>
#ifdef CONFIG_ACPI_KERNEL_CONFIG
u32 __init acpi_cf_init (void * rsdp);
u32 __init acpi_cf_terminate (void );
u32 __init
acpi_cf_get_pci_vectors (
struct pci_vector_struct **vectors,
int *num_pci_vectors
);
#ifdef CONFIG_ACPI_KERNEL_CONFIG_DEBUG
void __init
acpi_cf_print_pci_vectors (
struct pci_vector_struct *vectors,
int num_pci_vectors
);
#endif
#endif /* CONFIG_ACPI_KERNEL_CONFIG */
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
//
// Thread-safe (provides internal synchronization)
#ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_
#define STORAGE_LEVELDB_DB_TABLE_CACHE_H_
#include <string>
#include <stdint.h>
#include "db/dbformat.h"
#include "leveldb/cache.h"
#include "leveldb/table.h"
#include "port/port.h"
namespace leveldb {
class Env;
class TableCache {
public:
TableCache(const std::string& dbname, const Options* options, int entries);
~TableCache();
// Return an iterator for the specified file number (the corresponding
// file length must be exactly "file_size" bytes). If "tableptr" is
// non-NULL, also sets "*tableptr" to point to the Table object
// underlying the returned iterator, or NULL if no Table object underlies
// the returned iterator. The returned "*tableptr" object is owned by
// the cache and should not be deleted, and is valid for as long as the
// returned iterator is live.
Iterator* NewIterator(const ReadOptions& options,
uint64_t file_number,
uint64_t file_size,
Table** tableptr = NULL);
// If a seek to internal key "k" in specified file finds an entry,
// call (*handle_result)(arg, found_key, found_value).
Status Get(const ReadOptions& options,
uint64_t file_number,
uint64_t file_size,
const Slice& k,
void* arg,
void (*handle_result)(void*, const Slice&, const Slice&));
// Evict any entry for the specified file number
void Evict(uint64_t file_number);
private:
Env* const env_;
const std::string dbname_;
const Options* options_;
Cache* cache_; // key:val = sst file number : table * + file *
Status FindTable(uint64_t file_number, uint64_t file_size, Cache::Handle**);
};
} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_TABLE_CACHE_H_
|
/*
File: ext2grp.h
Copyright (C) 2008 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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 the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef __cplusplus
extern "C" {
#endif
unsigned int ext2_fix_group(alloc_data_t *list_search_space, disk_t *disk, partition_t *partition);
unsigned int ext2_fix_inode(alloc_data_t *list_search_space, disk_t *disk, partition_t *partition);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
|
/*
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf 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/>.
*/
/** \file
* Target independent plotting (interface).
*/
#ifndef _NETSURF_DESKTOP_PLOTTERS_H_
#define _NETSURF_DESKTOP_PLOTTERS_H_
#include <stdbool.h>
#include <stdio.h>
#include "desktop/plot_style.h"
struct bitmap;
struct rect;
typedef unsigned long bitmap_flags_t;
#define BITMAPF_NONE 0
#define BITMAPF_REPEAT_X 1
#define BITMAPF_REPEAT_Y 2
enum path_command {
PLOTTER_PATH_MOVE,
PLOTTER_PATH_CLOSE,
PLOTTER_PATH_LINE,
PLOTTER_PATH_BEZIER,
};
/** Set of target specific plotting functions.
*
* The functions are:
* arc - Plots an arc, around (x,y), from anticlockwise from angle1 to
* angle2. Angles are measured anticlockwise from horizontal, in
* degrees.
* disc - Plots a circle, centered on (x,y), which is optionally filled.
* line - Plots a line from (x0,y0) to (x1,y1). Coordinates are at
* centre of line width/thickness.
* path - Plots a path consisting of cubic Bezier curves. Line colour is
* given by c and fill colour is given by fill.
* polygon - Plots a filled polygon with straight lines between points.
* The lines around the edge of the ploygon are not plotted. The
* polygon is filled with the non-zero winding rule.
* rectangle - Plots a rectangle outline. The line can be solid, dotted or
* dashed. Top left corner at (x0,y0) and rectangle has given
* width and height.
* fill - Plots a filled rectangle. Top left corner at (x0,y0), bottom
* right corner at (x1,y1). Note: (x0,y0) is inside filled area,
* but (x1,y1) is below and to the right. See diagram below.
* clip - Sets a clip rectangle for subsequent plots.
* text - Plots text. (x,y) is the coordinate of the left hand side of
* the text's baseline. The text is UTF-8 encoded. The colour, c,
* is the colour of the text. Background colour, bg, may be used
* optionally to attempt to provide anti-aliased text without
* screen reads. Font information is provided in the style.
* bitmap - Tiled plot of a bitmap image. (x,y) gives the top left
* coordinate of an explicitly placed tile. From this tile the
* image can repeat in all four directions -- up, down, left and
* right -- to the extents given by the current clip rectangle.
* The bitmap_flags say whether to tile in the x and y
* directions. If not tiling in x or y directions, the single
* image is plotted. The width and height give the dimensions
* the image is to be scaled to.
* group_start - Start of a group of objects. Used when plotter implements
* export to a vector graphics file format. (Optional.)
* group_end - End of the most recently started group. (Optional.)
* flush - Only used internally by the knockout code. Should be NULL in
* any front end display plotters or export plotters.
*
* Plotter options:
* option_knockout - Optimisation particularly for unaccelerated screen
* redraw. It tries to avoid plotting to the same area
* more than once. See desktop/knockout.c
*
* Coordinates are from top left of canvas and (0,0) is the top left grid
* denomination. If a "fill" is drawn from (0,0) to (4,3), the result is:
*
* 0 1 2 3 4 5
* +-+-+-+-+-+-
* 0 |#|#|#|#| |
* +-+-+-+-+-+-
* 1 |#|#|#|#| |
* +-+-+-+-+-+-
* 2 |#|#|#|#| |
* +-+-+-+-+-+-
* 3 | | | | | |
*/
struct plotter_table {
/* clipping operations */
bool (*clip)(const struct rect *clip);
/* shape primatives */
bool (*arc)(int x, int y, int radius, int angle1, int angle2, const plot_style_t *pstyle);
bool (*disc)(int x, int y, int radius, const plot_style_t *pstyle);
bool (*line)(int x0, int y0, int x1, int y1, const plot_style_t *pstyle);
bool (*rectangle)(int x0, int y0, int x1, int y1, const plot_style_t *pstyle);
bool (*polygon)(const int *p, unsigned int n, const plot_style_t *pstyle);
/* complex path (for SVG) */
bool (*path)(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
/* Image */
bool (*bitmap)(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags);
/**
* Text.
*
* \param x x coordinate
* \param y y coordinate
* \param text UTF-8 string to plot
* \param length length of string, in bytes
* \param fstyle plot style for this text
* \return true on success, false on error and error reported
*/
bool (*text)(int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle);
/* optional callbacks */
bool (*group_start)(const char *name); /**< optional, may be NULL */
bool (*group_end)(void); /**< optional, may be NULL */
bool (*flush)(void); /**< optional, may be NULL */
/* flags */
bool option_knockout; /**< set if knockout rendering is required */
};
/* Redraw context */
struct redraw_context {
/** Redraw to show interactive features, such as active selections
* etc. Should be off for printing. */
bool interactive;
/** Render background images. May want it off for printing. */
bool background_images;
/** Current plotters, must be assigned before use. */
const struct plotter_table *plot;
};
#endif
|
/*
*
* Copyright (C) International Business Machines Corp., 2004, 2005, 2007
*
* 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
*/
/*
* NAME
* Tspi_TPM_ReadCounter02.c
*
* DESCRIPTION
* This test will verify that Tspi_TPM_ReadCounter returns TSS_E_INVALID_HANDLE
* when its passed one.
*
* ALGORITHM
* Setup:
* Create Context
* Connect Context
* GetTPMObject
*
* Test: Call ReadCounter. If this is unsuccessful check for
* type of error, and make sure it returns the proper return code
*
* Cleanup:
* Free Memory associated with the context
* Close Context
* Print error/success messages
*
* USAGE: First parameter is --options
* -v or --version
* Second Parameter is the version of the test case to be run.
* This test case is currently only implemented for 1.1
*
* HISTORY
* Kent Yoder <kyoder@users.sf.net>, 05/07
*
* RESTRICTIONS
* None.
*/
#include "common.h"
int main(int argc, char **argv)
{
char version;
version = parseArgs( argc, argv );
if (version == TESTSUITE_TEST_TSS_1_2)
main_v1_2(version);
else if (version)
print_NA();
else
print_wrongVersion();
}
main_v1_2(char version)
{
char *nameOfFunction = "Tspi_TPM_ReadCounter02";
TSS_HCONTEXT hContext;
TSS_RESULT result;
UINT32 pCount;
print_begin_test(nameOfFunction);
//Create Context
result = Tspi_Context_Create(&hContext);
if (result != TSS_SUCCESS) {
print_error("Tspi_Context_Create ", result);
exit(result);
}
//Connect Context
result = Tspi_Context_Connect(hContext, get_server(GLOBALSERVER));
if (result != TSS_SUCCESS) {
print_error("Tspi_Context_Connect", result);
exit(result);
}
// Read Counter
result = Tspi_TPM_ReadCounter(0xffffffff, &pCount);
if (TSS_ERROR_CODE(result) != TSS_E_INVALID_HANDLE) {
if(!checkNonAPI(result)){
print_error(nameOfFunction, result);
print_end_test(nameOfFunction);
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
exit(result);
}
else{
print_error_nonapi(nameOfFunction, result);
print_end_test(nameOfFunction);
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
exit(result);
}
}
else{
print_success(nameOfFunction, result);
print_end_test(nameOfFunction);
Tspi_Context_FreeMemory(hContext, NULL);
Tspi_Context_Close(hContext);
exit(0);
}
}
|
/* $Id$
*
* linux/arch/sh/boards/se/770x/setup.c
*
* Copyright (C) 2000 Kazumoto Kojima
*
* Hitachi SolutionEngine Support.
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <asm/io.h>
#include <asm/se/se.h>
#include <asm/se/smc37c93x.h>
/*
* Configure the Super I/O chip
*/
static void __init smsc_config(int index, int data)
{
outb_p(index, INDEX_PORT);
outb_p(data, DATA_PORT);
}
static void __init init_smsc(void)
{
outb_p(CONFIG_ENTER, CONFIG_PORT);
outb_p(CONFIG_ENTER, CONFIG_PORT);
/* FDC */
smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
/* IDE1 */
smsc_config(CURRENT_LDN_INDEX, LDN_IDE1);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IRQ_SELECT_INDEX, 14); /* IRQ14 */
/* AUXIO (GPIO): to use IDE1 */
smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
/* COM1 */
smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IO_BASE_HI_INDEX, 0x03);
smsc_config(IO_BASE_LO_INDEX, 0xf8);
smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
/* COM2 */
smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IO_BASE_HI_INDEX, 0x02);
smsc_config(IO_BASE_LO_INDEX, 0xf8);
smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
/* RTC */
smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
/* XXX: PARPORT, KBD, and MOUSE will come here... */
outb_p(CONFIG_EXIT, CONFIG_PORT);
}
const char *get_system_type(void)
{
return "SolutionEngine";
}
/*
* Initialize the board
*/
void __init platform_setup(void)
{
init_smsc();
/* XXX: RTC setting comes here */
}
|
/*
* get.c -- implementation of TTGet*_* methods
*
*
* Copyright (C) 2002 by Massimiliano Ghilardi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*/
#ifdef CONF_SOCKET_PTHREADS
# include <pthread.h>
#endif
#include "mutex.h"
#include "TT.h"
#include "TTextern.h"
#include "TTassert.h"
#include "utils.h"
#include "inlines.h"
#include "array.h"
#include "getset_m4.h"
/* array of tt*_field_first */
static ttopaque field_array_first[] = {
#define el(o) TT_CAT(o,_field_first),
TT_LIST(el)
#undef el
};
/* array of tt*_field_last */
static ttopaque field_array_last[] = {
#define el(o) TT_CAT(o,_field_first),
TT_LIST(el)
#undef el
};
#define field_array_n (sizeof(field_array_first)/sizeof(field_array_first[0]))
/* return the first field id of an object given a generic field id of the object */
static ttopaque FieldFirst(tt_obj field) {
ttopaque i;
for (i = 0; i < field_array_n; i++) {
if ((ttopaque)field > field_array_first[i] && (ttopaque)field < field_array_last[i])
return field_array_first[i];
}
return (ttopaque)0;
}
static ttopaque GetArraySize_ttfield(TT_CONST ttfield f, TT_CONST tt_obj o) {
ttuint i;
ttopaque type, saved_type, size = 0;
ttarg param[2], op;
type = saved_type = f->type;
size = TTGetSize_ttclass(TTFromType_ttclass(type));
param[0].value = 0;
if (type & ttclass_type_array) {
param[0].value = (type >>= ttclass_type_array_firstbit) & e_MFP;
param[1].value = (type >>= e_WFP) & e_MFP;
op.value = (type >>= e_WFP) & e_MOP;
if (op.value == e_OPZ) {
/* zero-terminated array */
if (TTGetValue_ttfield((tt_obj)f->id, o, &op) && TTIsArrayType_ttclass(op.type))
return op.size;
return 0;
}
/* extract length params from arguments if needed */
for (i = 0; i < 2; i++) {
if (param[i].value & e_FFP) {
TTAssertAlways(TTGetValue_ttfield
((tt_obj)(FieldFirst((tt_obj)f->id) + (param[i].value & ~e_FFP)),
o, ¶m[i]));
}
}
switch (op.value) {
case e_SET:
/* param[0].value = param[0].value; */
break;
case e_ADD:
param[0].value += param[1].value;
break;
case e_MUL:
param[0].value *= param[1].value;
break;
default:
/* illegal operation ? */
param[0].value = 0;
break;
}
}
return size * (ttopaque)param[0].value;
}
/* ttobj exported_field methods */
ttbyte TTGetField_ttobj(/*TT_CONST*/ tt_obj a0, /*TT_CONST*/ tt_obj which, TT_ARG_WRITE TT_ARG_ARRAY((1)) ttarg *value) {
return TTGetValue_ttfield(which, a0, value);
}
ttbyte TTSetField_ttobj(tt_obj a0, /*TT_CONST*/ tt_obj which, TT_ARG_READ TT_ARG_ARRAY((1)) ttarg *value) {
return TTSetValue_ttfield(which, a0, value);
}
ttbyte TTChangeField_ttobj(tt_obj a0, /*TT_CONST*/ tt_obj which, ttany nand_value, ttany xor_value) {
return TTChangeValue_ttfield(which, a0, nand_value, xor_value);
}
/* ttfield exported_field methods */
ttbyte TTGetValue_ttfield(/*TT_CONST*/ tt_obj which, /*TT_CONST*/ tt_obj a0, TT_ARG_WRITE TT_ARG_ARRAY((1)) ttarg *value) {
TT_ARG_READ ttobj o = ID2OBJ((opaque)a0);
TT_ARG_READ ttfield f = ID2(ttfield,(opaque)which);
if (o && f && getset_GetField(o, which, &value->value)) {
if (TTIsArrayType_ttclass(value->type = f->type))
value->size = GetArraySize_ttfield(f, a0);
return TT_TRUE;
}
return TT_FALSE;
}
ttbyte TTSetValue_ttfield(/*TT_CONST*/ tt_obj which, tt_obj a0, TT_ARG_READ TT_ARG_ARRAY((1)) ttarg *value) {
ttobj o = ID2OBJ((opaque)a0);
return o && getset_SetField(o, which, value);
}
ttbyte TTChangeValue_ttfield(/*TT_CONST*/ tt_obj which, tt_obj a0, ttany nand_value, ttany xor_value) {
ttarg value;
if (TTGetValue_ttfield(which, a0, &value) && !TTIsArrayType_ttclass(value.type)) {
value.value = (value.value & ~nand_value) ^ xor_value;
return TTSetValue_ttfield(which, a0, &value);
}
return TT_FALSE;
}
|
/*
* libhugetlbfs - Easy use of Linux hugepages
* Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation.
*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/mman.h>
#include <hugetlbfs.h>
#include "hugetests.h"
/*
* Test rationale:
*
* Some kernel have a bug in the positioning of the test against
* i_size. This bug means that attempting to instantiate a page
* beyond the end of a hugepage file can result in an OOM and SIGKILL
* instead of the correct SIGBUS.
*
* This bug was fixed by commit ebed4bfc8da8df5b6b0bc4a5064a949f04683509.
*/
static void sigbus_handler(int signum, siginfo_t *si, void *uc)
{
PASS();
}
int main(int argc, char *argv[])
{
long hpage_size;
int fd, fdx;
unsigned long totpages;
void *p, *q;
int i;
int err;
struct sigaction sa = {
.sa_sigaction = sigbus_handler,
.sa_flags = SA_SIGINFO,
};
test_init(argc, argv);
hpage_size = check_hugepagesize();
totpages = get_huge_page_counter(hpage_size, HUGEPAGES_TOTAL);
fd = hugetlbfs_unlinked_fd();
if (fd < 0)
FAIL("hugetlbfs_unlinked_fd()");
p = mmap(NULL, hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (p == MAP_FAILED)
FAIL("mmap(): %s", strerror(errno));
err = ftruncate(fd, 0);
if (err)
FAIL("ftruncate(): %s", strerror(errno));
/* Now slurp up all the available pages */
fdx = hugetlbfs_unlinked_fd();
if (fdx < 0)
FAIL("hugetlbfs_unlinked_fd() 2");
q = mmap(NULL, totpages * hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED,
fdx, 0);
if (q == MAP_FAILED)
FAIL("mmap() reserving all pages: %s", strerror(errno));
/* Touch the pages to ensure they're removed from the pool */
for (i = 0; i < totpages; i++) {
volatile char *x = (volatile char *)q + i*hpage_size;
*x = 0;
}
/* SIGBUS is what *should* happen */
err = sigaction(SIGBUS, &sa, NULL);
if (err)
FAIL("sigaction(): %s", strerror(errno));
*((volatile unsigned int *)p);
/* Should have SIGBUSed above, or (failed the test) with SIGKILL */
FAIL("Didn't SIGBUS or OOM");
}
|
#pragma once
#ifdef USE_MEMMANAGER
#undef new
#undef malloc
#undef realloc
#undef _msize
#undef free
#endif
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
#include <stdbool.h>
#include <sys/types.h>
#include "sd-id128.h"
#include "sd-journal.h"
#include "hashmap.h"
#include "journal-def.h"
#include "journal-file.h"
#include "list.h"
#include "set.h"
typedef struct Match Match;
typedef struct Location Location;
typedef struct Directory Directory;
typedef enum MatchType {
MATCH_DISCRETE,
MATCH_OR_TERM,
MATCH_AND_TERM
} MatchType;
struct Match {
MatchType type;
Match *parent;
LIST_FIELDS(Match, matches);
/* For concrete matches */
char *data;
size_t size;
le64_t le_hash;
/* For terms */
LIST_HEAD(Match, matches);
};
struct Location {
LocationType type;
bool seqnum_set;
bool realtime_set;
bool monotonic_set;
bool xor_hash_set;
uint64_t seqnum;
sd_id128_t seqnum_id;
uint64_t realtime;
uint64_t monotonic;
sd_id128_t boot_id;
uint64_t xor_hash;
};
struct Directory {
char *path;
int wd;
bool is_root;
};
struct sd_journal {
int toplevel_fd;
char *path;
char *prefix;
OrderedHashmap *files;
MMapCache *mmap;
Location current_location;
JournalFile *current_file;
uint64_t current_field;
Match *level0, *level1, *level2;
pid_t original_pid;
int inotify_fd;
unsigned current_invalidate_counter, last_invalidate_counter;
usec_t last_process_usec;
/* Iterating through unique fields and their data values */
char *unique_field;
JournalFile *unique_file;
uint64_t unique_offset;
/* Iterating through known fields */
JournalFile *fields_file;
uint64_t fields_offset;
uint64_t fields_hash_table_index;
char *fields_buffer;
size_t fields_buffer_allocated;
int flags;
bool on_network:1;
bool no_new_files:1;
bool no_inotify:1;
bool unique_file_lost:1; /* File we were iterating over got
removed, and there were no more
files, so sd_j_enumerate_unique
will return a value equal to 0. */
bool fields_file_lost:1;
bool has_runtime_files:1;
bool has_persistent_files:1;
size_t data_threshold;
Hashmap *directories_by_path;
Hashmap *directories_by_wd;
Hashmap *errors;
};
char *journal_make_match_string(sd_journal *j);
void journal_print_header(sd_journal *j);
#define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval) \
for (sd_journal_restart_data(j); ((retval) = sd_journal_enumerate_data((j), &(data), &(l))) > 0; )
|
/* color.h
* Definitions for colors
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef __COLOR_H__
#define __COLOR_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Data structure holding RGB value for a color, 16 bits per channel.
*/
typedef struct {
guint16 red;
guint16 green;
guint16 blue;
} color_t;
/*
* Convert a color_t to a 24-bit RGB value, reducing each channel to
* 8 bits and combining them.
*/
inline static unsigned int
color_t_to_rgb(const color_t *color) {
return (((color->red >> 8) << 16)
| ((color->green >> 8) << 8)
| (color->blue >> 8));
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
|
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: stdio.c,v 1.4 2004/03/05 05:11:59 marka Exp $ */
#include <config.h>
#include <io.h>
#include <errno.h>
#include <isc/stdio.h>
#include "errno2result.h"
isc_result_t
isc_stdio_open(const char *filename, const char *mode, FILE **fp) {
FILE *f;
f = fopen(filename, mode);
if (f == NULL)
return (isc__errno2result(errno));
*fp = f;
return (ISC_R_SUCCESS);
}
isc_result_t
isc_stdio_close(FILE *f) {
int r;
r = fclose(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_stdio_seek(FILE *f, long offset, int whence) {
int r;
r = fseek(f, offset, whence);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) {
isc_result_t result = ISC_R_SUCCESS;
size_t r;
clearerr(f);
r = fread(ptr, size, nmemb, f);
if (r != nmemb) {
if (feof(f))
result = ISC_R_EOF;
else
result = isc__errno2result(errno);
}
if (nret != NULL)
*nret = r;
return (result);
}
isc_result_t
isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
size_t *nret)
{
isc_result_t result = ISC_R_SUCCESS;
size_t r;
clearerr(f);
r = fwrite(ptr, size, nmemb, f);
if (r != nmemb)
result = isc__errno2result(errno);
if (nret != NULL)
*nret = r;
return (result);
}
isc_result_t
isc_stdio_flush(FILE *f) {
int r;
r = fflush(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_stdio_sync(FILE *f) {
int r;
r = _commit(_fileno(f));
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
|
/***********************************************************************************
* *
* Voreen - The Volume Rendering Engine *
* *
* Copyright (C) 2005-2013 University of Muenster, Germany. *
* Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> *
* For a list of authors please refer to the file "CREDITS.txt". *
* *
* This file is part of the Voreen software package. Voreen is free software: *
* you can redistribute it and/or modify it under the terms of the GNU General *
* Public License version 2 as published by the Free Software Foundation. *
* *
* Voreen 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 in the file *
* "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. *
* *
* For non-commercial academic use see the license exception specified in the file *
* "LICENSE-academic.txt". To get information about commercial licensing please *
* contact the authors. *
* *
***********************************************************************************/
#ifndef VRN_ISOLATEDCONNECTEDIMAGEFILTER_H
#define VRN_ISOLATEDCONNECTEDIMAGEFILTER_H
#include "modules/itk/processors/itkprocessor.h"
#include "voreen/core/processors/volumeprocessor.h"
#include "voreen/core/ports/volumeport.h"
#include "voreen/core/ports/geometryport.h"
#include <string>
#include "voreen/core/properties/boolproperty.h"
#include "voreen/core/datastructures/geometry/pointlistgeometry.h"
#include "voreen/core/properties/voxeltypeproperty.h"
namespace voreen {
class VolumeBase;
class IsolatedConnectedImageFilterITK : public ITKProcessor {
public:
IsolatedConnectedImageFilterITK();
virtual Processor* create() const;
virtual std::string getCategory() const { return "Volume Processing/Segmentation/RegionGrowing"; }
virtual std::string getClassName() const { return "IsolatedConnectedImageFilterITK"; }
virtual CodeState getCodeState() const { return CODE_STATE_STABLE; }
protected:
virtual void setDescriptions() {
setDescription("<a href=\"http://www.itk.org/Doxygen/html/classitk_1_1IsolatedConnectedImageFilter.html\">Go to ITK-Doxygen-Description</a>");
}
template<class T>
void isolatedConnectedImageFilterITK();
virtual void process();
private:
VolumePort inport1_;
VolumePort outport1_;
GeometryPort seedPointPort1_;
GeometryPort seedPointPort2_;
BoolProperty enableProcessing_;
std::vector<tgt::vec3> seedPoints1;
std::vector<tgt::vec3> seedPoints2;
VoxelTypeProperty replaceValue_;
VoxelTypeProperty isolatedValueTolerance_;
VoxelTypeProperty upper_;
VoxelTypeProperty lower_;
BoolProperty findUpperThreshold_;
static const std::string loggerCat_;
};
}
#endif
|
#include "xmlvm.h"
#include "org_apache_harmony_niochar_charset_additional_IBM865_Encoder.h"
//XMLVM_BEGIN_NATIVE_IMPLEMENTATION
//XMLVM_END_NATIVE_IMPLEMENTATION
void org_apache_harmony_niochar_charset_additional_IBM865_Encoder_nEncode___long_int_char_1ARRAY_int_int_1ARRAY(JAVA_OBJECT me, JAVA_LONG n1, JAVA_INT n2, JAVA_OBJECT n3, JAVA_INT n4, JAVA_OBJECT n5)
{
//XMLVM_BEGIN_NATIVE[org_apache_harmony_niochar_charset_additional_IBM865_Encoder_nEncode___long_int_char_1ARRAY_int_int_1ARRAY]
XMLVM_UNIMPLEMENTED_NATIVE_METHOD();
//XMLVM_END_NATIVE
}
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 AMD
* Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
*
* 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef USB_CH9_H
#define USB_CH9_H
#include <compiler.h>
#define USB_DIR_OUT 0 /* to device */
#define USB_DIR_IN 0x80 /* to host */
/*
* USB types, the second of three bRequestType fields
*/
#define USB_TYPE_MASK (0x03 << 5)
#define USB_TYPE_STANDARD (0x00 << 5)
#define USB_TYPE_CLASS (0x01 << 5)
#define USB_TYPE_VENDOR (0x02 << 5)
#define USB_TYPE_RESERVED (0x03 << 5)
/*
* USB recipients, the third of three bRequestType fields
*/
#define USB_RECIP_MASK 0x1f
#define USB_RECIP_DEVICE 0x00
#define USB_RECIP_INTERFACE 0x01
#define USB_RECIP_ENDPOINT 0x02
#define USB_RECIP_OTHER 0x03
/* From Wireless USB 1.0 */
#define USB_RECIP_PORT 0x04
#define USB_RECIP_RPIPE 0x05
/*
* Standard requests, for the bRequest field of a SETUP packet.
*
* These are qualified by the bRequestType field, so that for example
* TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
* by a GET_STATUS request.
*/
#define USB_REQ_GET_STATUS 0x00
#define USB_REQ_CLEAR_FEATURE 0x01
#define USB_REQ_SET_FEATURE 0x03
#define USB_REQ_SET_ADDRESS 0x05
#define USB_REQ_GET_DESCRIPTOR 0x06
#define USB_REQ_SET_DESCRIPTOR 0x07
#define USB_REQ_GET_CONFIGURATION 0x08
#define USB_REQ_SET_CONFIGURATION 0x09
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
#define USB_REQ_GET_ENCRYPTION 0x0E
#define USB_REQ_RPIPE_ABORT 0x0E
#define USB_REQ_SET_HANDSHAKE 0x0F
#define USB_REQ_RPIPE_RESET 0x0F
#define USB_REQ_GET_HANDSHAKE 0x10
#define USB_REQ_SET_CONNECTION 0x11
#define USB_REQ_SET_SECURITY_DATA 0x12
#define USB_REQ_GET_SECURITY_DATA 0x13
#define USB_REQ_SET_WUSB_DATA 0x14
#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
#define USB_REQ_LOOPBACK_DATA_READ 0x16
#define USB_REQ_SET_INTERFACE_DS 0x17
#define USB_DT_DEBUG 0x0a
#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
/*
* USB Packet IDs (PIDs)
*/
/* token */
#define USB_PID_OUT 0xe1
#define USB_PID_IN 0x69
#define USB_PID_SOF 0xa5
#define USB_PID_SETUP 0x2d
/* handshake */
#define USB_PID_ACK 0xd2
#define USB_PID_NAK 0x5a
#define USB_PID_STALL 0x1e
#define USB_PID_NYET 0x96
/* data */
#define USB_PID_DATA0 0xc3
#define USB_PID_DATA1 0x4b
#define USB_PID_DATA2 0x87
#define USB_PID_MDATA 0x0f
/* Special */
#define USB_PID_PREAMBLE 0x3c
#define USB_PID_ERR 0x3c
#define USB_PID_SPLIT 0x78
#define USB_PID_PING 0xb4
#define USB_PID_UNDEF_0 0xf0
#define USB_PID_DATA_TOGGLE 0x88
struct usb_ctrlrequest {
u8 bRequestType;
u8 bRequest;
u16 wValue;
u16 wIndex;
u16 wLength;
} __packed;
struct usb_debug_descriptor {
u8 bLength;
u8 bDescriptorType;
/* bulk endpoints with 8 byte maxpacket */
u8 bDebugInEndpoint;
u8 bDebugOutEndpoint;
};
#endif
|
#ifndef _ALTOVA_INCLUDED_sap_ALTOVA_xs_ALTOVA_Cboolean
#define _ALTOVA_INCLUDED_sap_ALTOVA_xs_ALTOVA_Cboolean
namespace sap
{
namespace xs
{
class Cboolean : public TypeBase
{
public:
sap_EXPORT Cboolean(xercesc::DOMNode* const& init);
sap_EXPORT Cboolean(Cboolean const& init);
void operator=(Cboolean const& other) { m_node = other.m_node; }
static altova::meta::SimpleType StaticInfo() { return altova::meta::SimpleType(types + _altova_ti_xs_altova_Cboolean); }
void operator= (const bool& value)
{
altova::XmlFormatter* Formatter = static_cast<altova::XmlFormatter*>(altova::AnySimpleTypeFormatter);
XercesTreeOperations::SetValue(GetNode(), Formatter->Format(value));
}
operator bool()
{
return CastAs<bool >::Do(GetNode(), 0);
}
};
} // namespace xs
} // namespace sap
#endif // _ALTOVA_INCLUDED_sap_ALTOVA_xs_ALTOVA_Cboolean
|
/*
* This file is part of the coreboot project.
*
* Copyright 2014 Rockchip Inc.
*
* 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <arch/cache.h>
#include <arch/exception.h>
#include <arch/io.h>
#include <arch/stages.h>
#include <armv7.h>
#include <assert.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <delay.h>
#include <program_loading.h>
#include <soc/sdram.h>
#include <soc/clock.h>
#include <soc/pwm.h>
#include <soc/grf.h>
#include <soc/rk808.h>
#include <soc/tsadc.h>
#include <stdlib.h>
#include <symbols.h>
#include <timestamp.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "board.h"
static void regulate_vdd_log(unsigned int mv)
{
unsigned int duty_ns;
const u32 period_ns = 2000; /* pwm period: 2000ns */
const u32 max_regulator_mv = 1350; /* 1.35V */
const u32 min_regulator_mv = 870; /* 0.87V */
write32(&rk3288_grf->iomux_pwm1, IOMUX_PWM1);
assert((mv >= min_regulator_mv) && (mv <= max_regulator_mv));
duty_ns = (max_regulator_mv - mv) * period_ns /
(max_regulator_mv - min_regulator_mv);
pwm_init(1, period_ns, duty_ns);
}
static void configure_l2ctlr(void)
{
uint32_t l2ctlr;
l2ctlr = read_l2ctlr();
l2ctlr &= 0xfffc0000; /* clear bit0~bit17 */
/*
* Data RAM write latency: 2 cycles
* Data RAM read latency: 2 cycles
* Data RAM setup latency: 1 cycle
* Tag RAM write latency: 1 cycle
* Tag RAM read latency: 1 cycle
* Tag RAM setup latency: 1 cycle
*/
l2ctlr |= (1 << 3 | 1 << 0);
write_l2ctlr(l2ctlr);
}
void main(void)
{
timestamp_add_now(TS_START_ROMSTAGE);
console_init();
exception_init();
configure_l2ctlr();
tsadc_init();
/* Need to power cycle SD card to ensure it is properly reset. */
sdmmc_power_off();
/* vdd_log 1200mv is enough for ddr run 666Mhz */
regulate_vdd_log(1200);
timestamp_add_now(TS_BEFORE_INITRAM);
sdram_init(get_sdram_config());
timestamp_add_now(TS_AFTER_INITRAM);
/* Now that DRAM is up, add mappings for it and DMA coherency buffer. */
mmu_config_range((uintptr_t)_dram/MiB,
sdram_size_mb(), DCACHE_WRITEBACK);
mmu_config_range((uintptr_t)_dma_coherent/MiB,
_dma_coherent_size/MiB, DCACHE_OFF);
cbmem_initialize_empty();
run_ramstage();
}
|
/*
* Copyright (C) 2011, Alexander Boettcher <boettcher@tudos.org>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of NUL (NOVA user land).
*
* NUL is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* NUL 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 version 2 for more details.
*/
#pragma once
#include "nul/capalloc.h"
#include "parent.h"
struct AdmissionProtocol : public GenericProtocol {
typedef struct para {
enum type { TYPE_APERIODIC = 1, TYPE_PERIODIC, TYPE_SPORADIC, TYPE_SYSTEM} type; //XXX TYPE_SYSTEM unnecessary, here to support old legacy prio layout
para(enum type _type = TYPE_APERIODIC) : type(_type), wcet(0), period(0) {}
unsigned wcet;
unsigned period;
//unsigned rel_deadline; //rel_deadline
//unsigned rtime; //release time
//unsigned mit; (minimal interarrival time)
} sched;
enum {
TYPE_SC_ALLOC = ParentProtocol::TYPE_GENERIC_END,
TYPE_SC_USAGE,
TYPE_GET_USAGE_CAP,
TYPE_REBIND_USAGE_CAP,
TYPE_SET_NAME,
TYPE_SC_PUSH,
};
unsigned alloc_sc(Utcb &utcb, unsigned idx_ec, struct para p,
unsigned cpu, char const * name)
{
return call_server(init_frame(utcb, TYPE_SC_ALLOC)
<< Utcb::TypedMapCap(idx_ec, DESC_TYPE_CAP | DESC_RIGHT_SC) << p << cpu << Utcb::String(name), true);
}
/*
* Returns subsumed time (since creation) of all SCs on all CPUs or of one named SC of a client
* cap_sel client - capability obtained by using get_usage_cap method
* uint64 con_tim - time value spent in microseconds since SC was created
*/
unsigned get_statistics(Utcb &utcb, cap_sel client, uint64 &con_time, const char * name = "") {
if (!client) return EPERM;
unsigned res = call_server(init_frame(utcb, TYPE_SC_USAGE) << Utcb::TypedIdentifyCap(client) << Utcb::String(name), false);
utcb >> con_time;
utcb.drop_frame();
return res;
}
unsigned rebind_usage_cap(Utcb &utcb, cap_sel client) {
cap_sel crdout;
Crd client_crd = Crd(client, 0, DESC_CAP_ALL);
if (!client) return EPERM;
unsigned char res = nova_syscall(NOVA_LOOKUP, client_crd.value(), 0, 0, 0, &crdout);
assert(res == NOVA_ESUCCESS && crdout != 0); //sanity check for used cap;
return call_server(init_frame(utcb, TYPE_REBIND_USAGE_CAP) << Utcb::TypedIdentifyCap(client) << client_crd, true);
}
unsigned get_usage_cap(Utcb &utcb, cap_sel client) {
cap_sel crdout;
Crd client_crd = Crd(client, 0, DESC_CAP_ALL);
if (!client) return EPERM;
unsigned char res = nova_syscall(NOVA_LOOKUP, client_crd.value(), 0, 0, 0, &crdout);
assert(res == NOVA_ESUCCESS && crdout == 0); //sanity check for unused cap;
return call_server(init_frame(utcb, TYPE_GET_USAGE_CAP) << client_crd, true);
}
unsigned get_pseudonym(Utcb &utcb, unsigned client_id) {
return ParentProtocol::get_pseudonym(utcb, _service, _instance, _cap_base + CAP_PSEUDONYM, client_id);
}
unsigned set_name(Utcb &utcb, char const * name, unsigned long name_len = ~0UL) {
return call_server(init_frame(utcb, TYPE_SET_NAME) << Utcb::String(name, name_len), true);
}
explicit AdmissionProtocol(unsigned cap_base, unsigned instance=0, bool blocking = true) : GenericProtocol("admission", instance, cap_base, blocking) {}
};
|
#include "../../corelibs/U2Core/src/datatype/U2RawData.h"
|
/***********************************************************
* --- OpenSURF --- *
* This library is distributed under the GNU GPL. Please *
* use the contact form at http://www.chrisevansdev.com *
* for more information. *
* *
* C. Evans, Research Into Robust Visual Features, *
* MSc University of Bristol, 2008. *
* *
************************************************************/
#ifndef IPOINT_H_
#define IPOINT_H_
#include <vector>
#include <cmath>
#include <opencv/cxcore.h>
//-------------------------------------------------------
class Ipoint; // Pre-declaration
typedef std::vector < Ipoint > IpVec;
typedef std::vector < std::pair < Ipoint, Ipoint > >IpPairVec;
//-------------------------------------------------------
//! Ipoint operations
void getMatches(IpVec &ipts1, IpVec &ipts2, IpPairVec &matches);
bool translateCorners(IpPairVec &matches, const CvPoint src_corners[4], CvPoint dst_corners[4]);
//-------------------------------------------------------
class Ipoint
{
public:
//! Destructor
~Ipoint()
{
};
//! Constructor
Ipoint(): orientation(0)
{
};
//! Gets the distance in descriptor space between Ipoints
float operator-(const Ipoint &rhs)
{
float sum = 0.f;
for (int i = 0; i < 64; ++i) {
sum += (this->descriptor[i] - rhs.descriptor[i]) * (this->descriptor[i] - rhs.descriptor[i]);
}
return sqrt(sum);
};
//! Coordinates of the detected interest point
float x, y;
//! Detected scale
float scale;
//! Orientation measured anti-clockwise from +ve x-axis
float orientation;
//! Sign of laplacian for fast matching purposes
int laplacian;
//! Vector of descriptor components
float descriptor[64];
//! Placeholds for point motion (can be used for frame to frame motion analysis)
float dx, dy;
//! Used to store cluster index
int clusterIndex;
};
//-------------------------------------------------------
#endif
|
/*
* Originally from linux/arch/arm/lib/delay.S
*
* Copyright (C) 1995, 1996 Russell King
* Copyright (c) 2010, The Linux Foundation. All rights reserved.
* Copyright (C) 1993 Linus Torvalds
* Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
* Copyright (C) 2005-2006 Atmel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/timex.h>
void delay_loop(unsigned long loops)
{
asm volatile(
"1: subs %0, %0, #1 \n"
" bhi 1b \n"
:
: "r" (loops)
);
}
#ifdef ARCH_HAS_READ_CURRENT_TIMER
void read_current_timer_delay_loop(unsigned long loops)
{
unsigned long bclock, now;
read_current_timer(&bclock);
do {
read_current_timer(&now);
} while ((now - bclock) < loops);
}
#endif
static void (*delay_fn)(unsigned long) = delay_loop;
void set_delay_fn(void (*fn)(unsigned long))
{
delay_fn = fn;
}
void __delay(unsigned long loops)
{
delay_fn(loops);
}
EXPORT_SYMBOL(__delay);
void __const_udelay(unsigned long xloops)
{
unsigned long lpj;
unsigned long loops;
xloops >>= 14;
lpj = loops_per_jiffy >> 10;
loops = lpj * xloops;
loops >>= 6;
if (loops)
__delay(loops);
}
EXPORT_SYMBOL(__const_udelay);
void __udelay(unsigned long usecs)
{
__const_udelay(usecs * ((2199023UL*HZ)>>11));
}
EXPORT_SYMBOL(__udelay);
|
/* This file is part of the KDE project
* Copyright (C) 2002, 2003 Robert JACOLIN <rjacolin@ifrance.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __KWORD_LATEX_IMPORT_KWORDGENERATOR__
#define __KWORD_LATEX_IMPORT_KWORDGENERATOR__
#include <KoStore.h>
#include "element.h"
#include <QList>
class KwordGenerator
{
QList<Element*>* _root;
public:
KwordGenerator() {
}
explicit KwordGenerator(QList<Element*>* root) {
_root = root;
}
~KwordGenerator() { }
void convert(KoStore*);
};
#endif /* __KWORD_LATEX_IMPORT_KWORDGENERATOR__ */
|
#if !defined(CONDITIONS_CIRCE_MIRROR_H)
#define CONDITIONS_CIRCE_MIRROR_H
/* This module implements Mirror Circe */
#include "solving/machinery/solve.h"
/* Try to solve in solve_nr_remaining half-moves.
* @param si slice index
* @note assigns solve_result the length of solution found and written, i.e.:
* previous_move_is_illegal the move just played is illegal
* this_move_is_illegal the move being played is illegal
* immobility_on_next_move the moves just played led to an
* unintended immobility on the next move
* <=n+1 length of shortest solution found (n+1 only if in next
* branch)
* n+2 no solution found in this branch
* n+3 no solution found in next branch
* (with n denominating solve_nr_remaining)
*/
void mirror_circe_override_relevant_side_solve(slice_index si);
#endif
|
#undef CONFIG_ISI
|
/*
* This file is part of DDE/Linux2.6.
*
* (c) 2006-2012 Bjoern Doebel <doebel@os.inf.tu-dresden.de>
* Christian Helmuth <ch12@os.inf.tu-dresden.de>
* economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of TUD:OS and distributed under the terms of the
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
#include <l4/dde/linux26/dde26_net.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include "local.h"
/* Callback function to be called if a network packet arrives and needs to
* be handled by netif_rx() or netif_receive_skb()
*/
linux_rx_callback l4dde26_rx_callback = NULL;
/* Register a netif_rx callback function.
*
* \return pointer to old callback function
*/
linux_rx_callback l4dde26_register_rx_callback(linux_rx_callback cb)
{
linux_rx_callback old = l4dde26_rx_callback;
l4dde26_rx_callback = cb;
DEBUG_MSG("New rx callback @ %p.", cb);
return old;
}
|
#define MFBSOLIDFILLAREA xf1bppSolidBlackArea
#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea
#define OPEQ &=~
#define EQWHOLEWORD =0
#include "mfbmap.h"
#include "../../../mfb/mfbpntarea.c"
|
/* Copyright (C) 2007 P.L. Lucas
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __OUTPUT_H__
#define __OUTPUT_H__
#include <QString>
#include <stdio.h>
class Output
{
public:
virtual void write(QString s)=0;
};
class FILEOutput: public Output
{
public:
void write(QString s);
FILE *out;
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.