text stringlengths 4 6.14k |
|---|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <coreplugin/find/textfindconstants.h>
#include <QFont>
#include <QMenu>
#include <QPrinter>
#include <QString>
#include <QUrl>
#include <QWidget>
namespace Help {
namespace Internal {
class HelpViewer : public QWidget
{
Q_OBJECT
public:
enum class Action {
NewPage = 0x01,
ExternalWindow = 0x02
};
Q_DECLARE_FLAGS(Actions, Action)
explicit HelpViewer(QWidget *parent = nullptr);
~HelpViewer() override;
virtual void setViewerFont(const QFont &font) = 0;
virtual void setScale(qreal scale) = 0;
void setFontZoom(int percentage);
void setScrollWheelZoomingEnabled(bool enabled);
bool isScrollWheelZoomingEnabled() const;
virtual QString title() const = 0;
virtual QUrl source() const = 0;
virtual void setSource(const QUrl &url) = 0;
virtual void setHtml(const QString &html) = 0;
virtual QString selectedText() const = 0;
virtual bool isForwardAvailable() const = 0;
virtual bool isBackwardAvailable() const = 0;
virtual void addBackHistoryItems(QMenu *backMenu) = 0;
virtual void addForwardHistoryItems(QMenu *forwardMenu) = 0;
void setActionVisible(Action action, bool visible);
bool isActionVisible(Action action);
virtual bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = nullptr) = 0;
bool handleForwardBackwardMouseButtons(QMouseEvent *e);
static bool isLocalUrl(const QUrl &url);
static bool canOpenPage(const QString &url);
static QString mimeFromUrl(const QUrl &url);
static bool launchWithExternalApp(const QUrl &url);
void home();
void scaleUp();
void scaleDown();
void resetScale();
virtual void copy() = 0;
virtual void stop() = 0;
virtual void forward() = 0;
virtual void backward() = 0;
virtual void print(QPrinter *printer) = 0;
signals:
void sourceChanged(const QUrl &);
void titleChanged();
void printRequested();
void forwardAvailable(bool);
void backwardAvailable(bool);
void loadFinished();
void newPageRequested(const QUrl &url);
void externalPageRequested(const QUrl &url);
protected:
void wheelEvent(QWheelEvent *event) override;
void slotLoadStarted();
void slotLoadFinished();
void restoreOverrideCursor();
Actions m_visibleActions;
bool m_scrollWheelZoomingEnabled = true;
int m_loadOverrideStack = 0;
private:
void incrementZoom(int steps);
void applyZoom(int percentage);
};
} // namespace Internal
} // namespace Help
|
#include "meta.h"
#include "../util.h"
/* AUS (found in various Capcom games) */
VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("aus",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x41555320) /* "AUS " */
goto fail;
loop_flag = (read_32bitLE(0x0c,streamFile)!=0);
channel_count = read_32bitLE(0xC,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->num_samples = read_32bitLE(0x08,streamFile);
if(read_16bitLE(0x06,streamFile)==0x02) {
vgmstream->coding_type = coding_XBOX;
vgmstream->layout_type=layout_none;
} else {
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x800;
}
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile);
}
vgmstream->meta_type = meta_AUS;
/* open the file for reading */
{
int i;
STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
|
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
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 ETL_ARMV5_NO_STL_INCLUDED
#define ETL_ARMV5_NO_STL_INCLUDED
//*****************************************************************************
// ARM Compiler Version 5
//*****************************************************************************
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_ARM5
#define ETL_CPP11_SUPPORTED 0
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT (__cplusplus < 201103L)
#define ETL_NO_LARGE_CHAR_SUPPORT (__cplusplus < 201103L)
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0
#define ETL_NO_STL
#endif
|
// Copyright (c) 2005 - 2017 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef AIJHHELPER_H_INCLUDED
#define AIJHHELPER_H_INCLUDED
#pragma once
//#define DEBUG_AI
#include "gameTypes/BuildingType.h"
#include "gameTypes/Direction.h"
#include "gameTypes/MapCoordinates.h"
#include <vector>
namespace AIEvent {
class Base;
}
namespace AIJH {
class AIPlayerJH;
class PositionSearch;
enum JobState
{
JOB_WAITING,
JOB_EXECUTING_START,
JOB_EXECUTING_ROAD1,
JOB_EXECUTING_ROAD2,
JOB_EXECUTING_ROAD2_2,
JOB_FINISHED,
JOB_FAILED
};
enum SearchMode
{
SEARCHMODE_NONE,
SEARCHMODE_RADIUS,
SEARCHMODE_GLOBAL
};
class Job
{
public:
Job(AIPlayerJH& aijh);
virtual ~Job() = default;
virtual void ExecuteJob() = 0;
JobState GetState() const { return state; }
void SetState(JobState s) { state = s; }
protected:
AIPlayerJH& aijh;
JobState state;
};
class JobWithTarget
{
public:
JobWithTarget() : target(MapPoint::Invalid()) {}
inline MapPoint GetTarget() const { return target; }
void SetTarget(MapPoint newTarget) { target = newTarget; }
protected:
MapPoint target;
};
class BuildJob : public Job, public JobWithTarget
{
public:
BuildJob(AIPlayerJH& aijh, BuildingType type, MapPoint around, SearchMode searchMode = SEARCHMODE_RADIUS)
: Job(aijh), type(type), around(around), searchMode(searchMode)
{
RTTR_Assert(type != BLD_NOTHING);
}
~BuildJob() override = default;
void ExecuteJob() override;
inline BuildingType GetType() const { return type; }
inline MapPoint GetAround() const { return around; }
private:
BuildingType type;
MapPoint around;
SearchMode searchMode;
std::vector<Direction> route;
void TryToBuild();
void BuildMainRoad();
void TryToBuildSecondaryRoad();
};
class ConnectJob : public Job, public JobWithTarget
{
public:
ConnectJob(AIPlayerJH& aijh, MapPoint flagPos) : Job(aijh), flagPos(flagPos) {}
~ConnectJob() override = default;
void ExecuteJob() override;
MapPoint getFlag() const { return flagPos; }
private:
MapPoint flagPos;
std::vector<Direction> route;
};
class EventJob : public Job
{
public:
EventJob(AIPlayerJH& aijh, AIEvent::Base* ev) : Job(aijh), ev(ev) {}
~EventJob() override;
void ExecuteJob() override;
AIEvent::Base* GetEvent() const { return ev; }
private:
AIEvent::Base* ev;
};
class SearchJob : public Job
{
public:
SearchJob(AIPlayerJH& aijh, PositionSearch* search) : Job(aijh), search(search) {}
~SearchJob() override;
void ExecuteJob() override;
private:
PositionSearch* search;
};
} // namespace AIJH
#endif //! AIJHHELPER_H_INCLUDED
|
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
* Copyright (C) 2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Andrea Azzarone <azzaronea@gmail.com>
*/
#ifndef UNITYSHELL_UNITYSHELL_PRIVATE_H
#define UNITYSHELL_UNITYSHELL_PRIVATE_H
#include <string>
namespace unity
{
namespace impl
{
enum class ActionModifiers
{
NONE = 0,
USE_NUMPAD,
USE_SHIFT,
USE_SHIFT_NUMPAD
};
std::string CreateActionString(std::string const& modifiers,
char shortcut,
ActionModifiers flag = ActionModifiers::NONE);
} // namespace impl
} // namespace unity
#endif // UNITYSHELL_UNITYSHELL_PRIVATE_H
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "aggregation_global.h"
#include <QObject>
#include <QList>
#include <QHash>
#include <QReadWriteLock>
#include <QReadLocker>
namespace Aggregation {
class AGGREGATION_EXPORT Aggregate : public QObject
{
Q_OBJECT
public:
Aggregate(QObject *parent = nullptr);
~Aggregate() override;
void add(QObject *component);
void remove(QObject *component);
template <typename T> T *component() {
QReadLocker locker(&lock());
for (QObject *component : qAsConst(m_components)) {
if (T *result = qobject_cast<T *>(component))
return result;
}
return nullptr;
}
template <typename T> QList<T *> components() {
QReadLocker locker(&lock());
QList<T *> results;
for (QObject *component : qAsConst(m_components)) {
if (T *result = qobject_cast<T *>(component)) {
results << result;
}
}
return results;
}
static Aggregate *parentAggregate(QObject *obj);
static QReadWriteLock &lock();
signals:
void changed();
private:
void deleteSelf(QObject *obj);
static QHash<QObject *, Aggregate *> &aggregateMap();
QList<QObject *> m_components;
};
// get a component via global template function
template <typename T> T *query(Aggregate *obj)
{
if (!obj)
return nullptr;
return obj->template component<T>();
}
template <typename T> T *query(QObject *obj)
{
if (!obj)
return nullptr;
T *result = qobject_cast<T *>(obj);
if (!result) {
QReadLocker locker(&Aggregate::lock());
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
result = (parentAggregation ? query<T>(parentAggregation) : nullptr);
}
return result;
}
// get all components of a specific type via template function
template <typename T> QList<T *> query_all(Aggregate *obj)
{
if (!obj)
return QList<T *>();
return obj->template components<T>();
}
template <typename T> QList<T *> query_all(QObject *obj)
{
if (!obj)
return QList<T *>();
QReadLocker locker(&Aggregate::lock());
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
QList<T *> results;
if (parentAggregation)
results = query_all<T>(parentAggregation);
else if (T *result = qobject_cast<T *>(obj))
results.append(result);
return results;
}
} // namespace Aggregation
|
/*
ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _HALCONF_COMMUNITY_H_
#define _HALCONF_COMMUNITY_H_
/**
* @brief Enables the community overlay.
*/
#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
#define HAL_USE_COMMUNITY TRUE
#endif
/**
* @brief Enables the FSMC subsystem.
*/
#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__)
#define HAL_USE_FSMC FALSE
#endif
/**
* @brief Enables the NAND subsystem.
*/
#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__)
#define HAL_USE_NAND FALSE
#endif
/**
* @brief Enables the 1-wire subsystem.
*/
#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__)
#define HAL_USE_ONEWIRE FALSE
#endif
/**
* @brief Enables the EICU subsystem.
*/
#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
#define HAL_USE_EICU FALSE
#endif
/**
* @brief Enables the CRC subsystem.
*/
#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__)
#define HAL_USE_CRC TRUE
#endif
/**
* @brief Enables the USBH subsystem.
*/
#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
#define HAL_USE_USBH FALSE
#endif
/**
* @brief Enables the EEPROM subsystem.
*/
#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__)
#define HAL_USE_EEPROM FALSE
#endif
/**
* @brief Enables the TIMCAP subsystem.
*/
#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__)
#define HAL_USE_TIMCAP FALSE
#endif
/*===========================================================================*/
/* FSMCNAND driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define NAND_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
/* 1-wire driver related settings. */
/*===========================================================================*/
/**
* @brief Enables strong pull up feature.
* @note Disabling this option saves both code and data space.
*/
#define ONEWIRE_USE_STRONG_PULLUP FALSE
/**
* @brief Enables search ROM feature.
* @note Disabling this option saves both code and data space.
*/
#define ONEWIRE_USE_SEARCH_ROM FALSE
/*===========================================================================*/
/* EEProm driver related settings. */
/*===========================================================================*/
#define EEPROM_USE_EE24XX FALSE
#define EEPROM_USE_EE25XX TRUE
/*===========================================================================*/
/* CRC driver settings. */
/*===========================================================================*/
#define rccEnableCRC(lp) rccEnableAHB(RCC_AHBENR_CRCEN, lp)
#define rccDisableCRC(lp) rccDisableAHB(RCC_AHBENR_CRCEN, lp)
/**
* @brief Enables DMA engine when performing CRC transactions.
* @note Enabling this option also enables asynchronous API.
*/
#if !defined(CRC_USE_DMA) || defined(__DOXYGEN__)
#define CRC_USE_DMA FALSE
#endif
/**
* @brief Enables the @p crcAcquireUnit() and @p crcReleaseUnit() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(CRC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define CRC_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* _HALCONF_COMMUNITY_H_ */
/** @} */
|
/*
falab - free algorithm lab
Copyright (C) 2012 luolongzhi 罗龙智 (Chengdu, China)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
filename: fa_huffman.h
version : v1.0.0
time : 2012/08/22 - 2012/10/05
author : luolongzhi ( falab2012@gmail.com luolongzhi@gmail.com )
code URL: http://code.google.com/p/falab/
*/
#ifndef _FA_HUFFMAN_H
#define _FA_HUFFMAN_H
#ifdef __cplusplus
extern "C"
{
#endif
#define INTENSITY_HCB 15
#define INTENSITY_HCB2 14
void fa_huffman_rom_init();
int fa_noiseless_huffman_bitcount(int *x_quant, int sfb_num, int *sfb_offset,
int *quant_hufftab_no, int *quant_bits);
int fa_huffman_encode_mdctline(int *x_quant, int sfb_num, int *sfb_offset, int *quant_hufftab_no,
int *max_sfb, int *x_quant_code, int *x_quant_bits);
#ifdef __cplusplus
}
#endif
#endif
|
/*
Ps2 library for host side (pinguino) to communicate
with a device (keyboard, mouse, etc..).
Samuele Paganoni.
*/
#ifndef __PS2_H__
#define __PS2_H__
#include <delay.c>
/*
5V 5V
| |
10K 10K
Hardware: | | Front:
------------ | | ---------- ------------
| | clk | | 5V---|4 | | 6 || 5 |
| 0|-----------|-------|5 PS2 | | 4 || 3 |
| Pinguino | | | DIN | | 2 1 |
| 1|-------------------|1 CONN. | ------------
| | data GND--|3 |
------------ ----------
*/
/*Used pin definition.*/
#define PS2_CLOCK_PIN PORTBbits.RB0
#define PS2_DATA_PIN PORTBbits.RB1
/*Pin direction.*/
#define PS2_CLOCK_DIR TRISBbits.TRISB0
#define PS2_DATA_DIR TRISBbits.TRISB1
/*Wait for the idle state of the bus.*/
#define ps2_wait_idle() while(PS2_DATA_PIN==0|PS2_CLOCK_PIN==0)
/*Inhibits the transmission of the devices.*/
#define ps2_inhibit() PS2_CLOCK_DIR==0;PS2_CLOCK_PIN==0;Delayus(100)
/*Host request to send.*/
#define ps2_rts() PS2_DATA_DIR=0;PS2_DATA_PIN=0;PS2_CLOCK_DIR=1
/*Buffer length in byte.*/
#define PS2_BUFFER_SIZE 30
/*Global variables.*/
volatile unsigned char ps2_rxpointer,ps2_txpointer;
volatile unsigned char ps2_buffer[PS2_BUFFER_SIZE];
const unsigned char vett[]={1,2,4,8,16,32,64,128};
/*Initializes the library.*/
void ps2_init()
{
PS2_CLOCK_DIR=1;
PS2_DATA_DIR=1;
ps2_rxpointer=0;
ps2_txpointer=0;
INTCONbits.INT0IE=1;
INTCON2bits.INTEDG0=0;
INTCONbits.GIE=1;
}
unsigned char ps2_readfrom()
{
unsigned char readed=0,i;
while(PS2_CLOCK_PIN==0);
for(i=0;i<8;i++)
{
while(PS2_CLOCK_PIN==1);
readed+=(PS2_DATA_PIN*vett[i]);
while(PS2_CLOCK_PIN==0);
}
while(PS2_CLOCK_PIN==1);
while(PS2_CLOCK_PIN==0);
while(PS2_CLOCK_PIN==1);
ps2_wait_idle();
return readed;
}
/*Write a byte to the device.*/
void ps2_write(unsigned char dta)
{
unsigned char i,p=1;
INTCONbits.INT0IE=0;
ps2_inhibit();
ps2_rts();
while(PS2_CLOCK_PIN==1);
for(i=0;i<8;i++)
{
PS2_DATA_PIN=dta;
p=p^PS2_DATA_PIN;
dta=dta>>1;
while(PS2_CLOCK_PIN==0);
while(PS2_CLOCK_PIN==1);
}
PS2_DATA_PIN=p;
while(PS2_CLOCK_PIN==0);
while(PS2_CLOCK_PIN==1);
PS2_DATA_DIR=1;
while(PS2_DATA_PIN==1);
while(PS2_CLOCK_PIN==1);
ps2_wait_idle();
INTCONbits.INT0IE=1;
}
/*Checks the availability of a byte.*/
unsigned char ps2_available()
{
return (ps2_rxpointer!=ps2_txpointer);
}
/*Reads a byte from the buffer.*/
unsigned char ps2_read()
{
unsigned char tmp=ps2_buffer[ps2_txpointer];
if(ps2_txpointer<PS2_BUFFER_SIZE)
ps2_txpointer++;
else
ps2_txpointer=0;
return tmp;
}
/*Interrupt routine, called from UserInterrupt.*/
void ps2_isr()
{
if(INTCONbits.INT0IF)
{
if(PS2_CLOCK_PIN==0)
{
ps2_buffer[ps2_rxpointer]=ps2_readfrom();
if(ps2_rxpointer<PS2_BUFFER_SIZE)
ps2_rxpointer++;
else
ps2_rxpointer=0;
INTCONbits.INT0IF=0;
}
}
}
#endif
|
// This file is part of InfiniteSky.
// Copyright (c) InfiniteSky Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#include <windows.h>
#include <iostream>
#include <string>
#include "DLLInjector.h"
#include "ManualMapDLLInject.h"
//#include "..\TS1 Private Server\Ini.h"
using namespace std;
int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow); |
/* This is an automatic generated file
DO NOT EDIT! SEE ERR_FCTS.SRC and SCANERR.PL.
Error printing function providing a wrapper for STRINGS
*/
#include "../config.h"
#include "../include/misc.h"
#include "../err_fcts.h"
#include "../strings.h"
#undef error_on_off
void error_on_off(void)
{ displayError(TEXT_ERROR_ON_OR_OFF);
}
|
#include "parselib.c"
// === BNF Grammar =====
// XML = <TAG> INNER </TAG>
// TAG = [0-9a-zA-Z]+
// INNER = XML INNER | [^<>]*
int main(int argc, char * argv[]) {
init("<people><name>ccc</name><tel>313534</tel> at kinmen</people>");
XML();
}
int XML() {
printf("<XML>");
skip("<"); TAG(); skip(">");
INNER();
skip("</"); TAG(); skip(">");
printf("</XML>");
}
int TAG() {
scan("%[0-9a-zA-Z]");
printf("?%s?", token);
}
int INNER() {
printf("<INNER>");
if (isHead("</")) {
} else if (isHead("<")) {
XML();
INNER();
} else {
scan("%[^<>]");
printf("text(%s)", token);
}
printf("</INNER>");
}
|
//
// GravatarServiceFactory.h
// gravtarlib
//
// Created by Magnus Ernstsson on 10/22/10.
// Copyright 2010 Patchwork Solutions AB. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GravatarService.h"
#import "GravatarServiceDelegate.h"
/**
* Service factory class for the gravatar services.
*/
@interface GravatarServiceFactory : NSObject {
}
/**
* Creates and returns an initialized GravatarService that will return a
* UIImage using the delegate method gravatarServiceDone:withImage if
* successful. If the service failed during execution
* gitHubService:didFailWithError: will be called instead.
* Can be cancelled using cancelRequest. If cancelled, no more message will be
* sent to the delegate.
* @param gravatarId The precalculated gravatar id to get a UIImage from.
* @param defaultImage The default image to use if a gravatar is not registered.
* One of the predefiend gravatarServerImages can be used
* or a url could be specified.
* @param size The size of the requested image. Images are always square.
* Needs to be between 1 and 512 pixels.
* @param delegate The delegate object for the service.
* @return The service for the request.
*/
+(id<GravatarService>)requestUIImageByGravatarId:(NSString *)gravtarId
defaultImage:(NSString *)defaultImage
size:(NSInteger)size
delegate:(id<GravatarServiceDelegate>)delegate;
/**
* Creates and returns an initialized GravatarService that will return a
* default sized UIImage using the delegate method gravatarServiceDone:withImage
* if successful. If the service failed during execution
* gitHubService:didFailWithError: will be called instead.
* Can be cancelled using cancelRequest. If cancelled, no more message will be
* sent to the delegate.
* @param gravatarId The precalculated gravatar id to get a UIImage from.
* @param defaultImage The default image to use if a gravatar is not registered.
* One of the predefiend gravatarServerImages can be used
* or a url could be specified.
* @param delegate The delegate object for the service.
* @return The service for the request.
*/
+(id<GravatarService>)requestUIImageByGravatarId:(NSString *)gravtarId
defaultImage:(NSString *)defaultImage
delegate:(id<GravatarServiceDelegate>)delegate;
/**
* Creates and returns an initialized GravatarService that will return a
* UIImage using the delegate method gravatarServiceDone:withImage if
* successful. If the service failed during execution
* gitHubService:didFailWithError: will be called instead.
* Can be cancelled using cancelRequest. If cancelled, no more message will be
* sent to the delegate.
* @param email The email address to get a UIImage from.
* @param defaultImage The default image to use if a gravatar is not registered.
* One of the predefiend gravatarServerImages can be used
* or a url could be specified.
* @param size The size of the requested image. Images are always square.
* Needs to be between 1 and 512 pixels.
* @param delegate The delegate object for the service.
* @return The service for the request.
*/
+(id<GravatarService>)requestUIImageByEmail:(NSString *)email
defaultImage:(NSString *)defaultImage
size:(NSInteger)size
delegate:(id<GravatarServiceDelegate>)delegate;
/**
* Creates and returns an initialized GravatarService that will return a
* default sized UIImage using the delegate method gravatarServiceDone:withImage
* if successful. If the service failed during execution
* gitHubService:didFailWithError: will be called instead.
* Can be cancelled using cancelRequest. If cancelled, no more message will be
* sent to the delegate.
* @param email The email address to get a UIImage from.
* @param defaultImage The default image to use if a gravatar is not registered.
* One of the predefiend gravatarServerImages can be used
* or a url could be specified.
* @param delegate The delegate object for the service.
* @return The service for the request.
*/
+(id<GravatarService>)requestUIImageByEmail:(NSString *)email
defaultImage:(NSString *)defaultImage
delegate:(id<GravatarServiceDelegate>)delegate;
@end
|
/*****************************************************************************
@(#) src/lib/streams.h
-----------------------------------------------------------------------------
Copyright (c) 2008-2015 Monavacon Limited <http://www.monavacon.com/>
Copyright (c) 2001-2008 OpenSS7 Corporation <http://www.openss7.com/>
Copyright (c) 1997-2001 Brian F. G. Bidulock <bidulock@openss7.org>
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation; version 3 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 Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>, or
write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
02139, USA.
-----------------------------------------------------------------------------
U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software on
behalf of the U.S. Government ("Government"), the following provisions apply
to you. If the Software is supplied by the Department of Defense ("DoD"), it
is classified as "Commercial Computer Software" under paragraph 252.227-7014
of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any
successor regulations) and the Government is acquiring only the license rights
granted herein (the license rights customarily provided to non-Government
users). If the Software is supplied to any unit or agency of the Government
other than DoD, it is classified as "Restricted Computer Software" and the
Government's rights in the Software are defined in paragraph 52.227-19 of the
Federal Acquisition Regulations ("FAR") (or any successor regulations) or, in
the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR
(or any successor regulations).
-----------------------------------------------------------------------------
Commercial licensing and support of this software is available from OpenSS7
Corporation at a fee. See http://www.openss7.com/
*****************************************************************************/
#ifndef __LOCAL_STREAMS_H__
#define __LOCAL_STREAMS_H__
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#define _GNU_SOURCE 1
#define _REENTRANT
#define _THREAD_SAFE
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stropts.h>
#include <sys/stat.h>
#include <pthread.h>
#if __GNUC__ < 3
#define inline inline
#define noinline extern
#else
#define inline __attribute__((always_inline))
#define noinline static __attribute__((noinline))
#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define __hot __attribute__((section(".text.hot")))
#define __unlikely __attribute__((section(".text.unlikely")))
extern int pthread_setcanceltype(int type, int *oldtype);
#endif /* __LOCAL_STREAMS_H__ */
|
// swad_firewall_database.h: firewall to mitigate denial of service attacks, operations with database
#ifndef _SWAD_FW_DB
#define _SWAD_FW_DB
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Fir_DB_LogAccess (void);
unsigned Fir_DB_GetNumClicksFromLog (void);
void Fir_DB_PurgeFirewallLog (void);
void Fir_DB_BanIP (void);
unsigned Fir_DB_GetNumBansIP (void);
#endif
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2016. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation, either version 3 or (at your option) any *
* later version. This program is distributed without any warranty. See *
* the file COPYING.gpl-v3 for details. *
\*************************************************************************/
int
vis_f1(int k)
{
int vis_comm(int j);
return vis_comm(k) / 2;
}
|
/*
Copyright (C) 2020 Daniel Schultz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#define FMPZ_MPOLY_FACTOR_INLINES_C
#define ulong ulongxx /* interferes with system includes */
#include <stdlib.h>
#include <stdio.h>
#undef ulong
#include <gmp.h>
#include "flint.h"
#include "ulong_extras.h"
#include "fmpz_mpoly_factor.h"
|
/*
* Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
* Contact: http://www.qt-project.org/legal
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#if !defined(__T_SECONDNAME_H__)
#define __T_SECONDNAME_H__
#include <e32base.h>
#include <e32def.h>
#include <e32test.h>
#include <f32file.h>
#include <s32file.h>
#include <s32mem.h>
#include <cntdb.h>
#include <cntdef.h>
#include <cntitem.h>
#include <cntfield.h>
#include <cntfldst.h>
#include <cntvcard.h>
#include <vtoken.h>
/** Parameter object to encapsulate test data. */
class TTestData
{
public:
TTestData(const TDesC8& aImportVCard, const TDesC8& aUpdateVCard,
const TDesC8& aVersitToken, const TUid aFieldUid,
const TDesC& aFieldContent, const TDesC& aUpdatedFieldContent,
const TDesC& aImportFilename, const TDesC& aExportFilename);
void SetVCardMapping(TUid aVCardMapping);
public:
const TDesC8& iImportVCard;
const TDesC8& iUpdateVCard;
const TDesC8& iVersitToken;
const TUid iFieldUid;
const TDesC& iFieldContent;
const TDesC& iUpdatedFieldContent;
const TDesC& iImportFilename;
const TDesC& iExportFilename;
TUid iVCardMapping;
};
/** Base class for new contact field vCard tests. */
class CNewFieldTestBase : public CBase
{
public:
~CNewFieldTestBase();
protected:
CParserVCard* CreateVCardLC(const TDesC8& aContents);
void WriteVCardL(const TDesC& aFileName, CParserVCard& aVCard);
TBool CheckSingleFieldValue(CContactItemFieldSet& aFieldSet, TTestData& aTd, const TDesC& aExpectedValue);
TContactItemId CreateContactL();
CParserVCard* ParseVCardLC(const TDesC& aFilename);
CArrayPtr<CContactItem>* ImportVCardLC(const TDesC& aFilename, TBool aConnectWhitespaceOption = ETrue);
void ExportVCardL(const TDesC& aFilename, CArrayPtr<CContactItem>* aContactArray);
protected:
void TestImportL(TTestData& aTd);
void TestExportL(TTestData& aTd);
void TestUpdateL(TTestData& aTd);
protected:
CNewFieldTestBase(RTest& aTest, RFs& aFs);
CNewFieldTestBase();
void BaseConstructL();
protected:
CContactDatabase* iDb;
RTest& iTest;
RFs& iFs;
};
/** Tests for second name field (X-EPOCSECONDNAME). */
class CSecondNameTest : public CNewFieldTestBase
{
public:
static CSecondNameTest* NewLC(RTest& aTest, RFs& aFs);
void RunTestsL();
~CSecondNameTest();
private:
CSecondNameTest(RTest& aTest, RFs& aFs);
void ConstructL();
};
/** Tests for SIP identity field (X-SIP). */
class CSipIdTest : public CNewFieldTestBase
{
public:
static CSipIdTest* NewLC(RTest& aTest, RFs& aFs);
void RunTestsL();
~CSipIdTest();
private:
CSipIdTest(RTest& aTest, RFs& aFs);
void ConstructL();
void RunTestCaseL(const TDesC8& aImportVCard, const TDesC8& aUpdateVCard, TUid aVCardMapping);
};
/** Tests for Wireless Village identity field (X-WV-ID). */
class CWvIdTest : public CNewFieldTestBase
{
public:
static CWvIdTest* NewLC(RTest& aTest, RFs& aFs);
void RunTestsL();
~CWvIdTest();
private:
CWvIdTest(RTest& aTest, RFs& aFs);
void ConstructL();
};
/** Test for fields limitation at import time - related to defect INC077129 */
class CFieldLimitationTest : public CNewFieldTestBase
{
public:
static CFieldLimitationTest* NewLC(RTest& aTest, RFs& aFs);
void RunTestsL();
~CFieldLimitationTest();
private:
CFieldLimitationTest(RTest& aTest, RFs& aFs);
void ConstructL();
void RunTestCaseL(const TDesC8& aImportVCard, const TDesC8& aVersitToken, TUid aCardMapping, const TDesC16& aExpectedValue);
};
#endif
|
/*
* Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
*
* Description: Base audio decoder element
* Created on: Aug 2, 2009
* Author: Rob Clark <rob@ti.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.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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gstomx_base_audiodec.h"
#include "gstomx.h"
#include <string.h> /* for memset */
#define CHANNELS_DEFAULT 2
#define SAMPLERATE_DEFAULT 44100
GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static void
type_base_init (gpointer g_class)
{
}
static void
type_class_init (gpointer g_class,
gpointer class_data)
{
}
static gboolean
sink_setcaps (GstPad *pad,
GstCaps *caps)
{
GstStructure *structure;
GstOmxBaseFilter *omx_base;
GstOmxBaseAudioDec *self;
GOmxCore *gomx;
omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
self = GST_OMX_BASE_AUDIODEC (omx_base);
gomx = (GOmxCore *) omx_base->gomx;
GST_INFO_OBJECT (omx_base, "getcaps (sink): %" GST_PTR_FORMAT, caps);
self->rate = SAMPLERATE_DEFAULT;
self->channels = CHANNELS_DEFAULT;
{
g_return_val_if_fail (caps, FALSE);
g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "rate", &self->rate);
gst_structure_get_int (structure, "channels", &self->channels);
}
return gst_pad_set_caps (pad, caps);
}
static void
settings_changed_cb (GOmxCore *core)
{
GstOmxBaseFilter *omx_base;
guint rate;
guint channels;
omx_base = core->object;
GST_DEBUG_OBJECT (omx_base, "settings changed");
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
if (rate == 0)
{
/** @todo: this shouldn't happen. */
GST_WARNING_OBJECT (omx_base, "Bad samplerate");
rate = 44100;
}
}
{
GstCaps *new_caps;
new_caps = gst_caps_new_simple ("audio/x-raw-int",
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, rate,
"signed", G_TYPE_BOOLEAN, TRUE,
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"channels", G_TYPE_INT, channels,
NULL);
GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
gst_pad_set_caps (omx_base->srcpad, new_caps);
}
}
static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
GstOmxBaseFilter *omx_base;
omx_base = GST_OMX_BASE_FILTER (instance);
GST_DEBUG_OBJECT (omx_base, "start");
omx_base->gomx->settings_changed_cb = settings_changed_cb;
gst_pad_set_setcaps_function (omx_base->sinkpad,
(sink_setcaps));
}
|
/*
Copyright (C) 2010 William Hart
Copyright (C) 2011 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "nmod_poly.h"
#include "ulong_extras.h"
void
nmod_poly_inflate(nmod_poly_t result, const nmod_poly_t input, ulong inflation)
{
if (input->length <= 1 || inflation == 1)
{
nmod_poly_set(result, input);
}
else if (inflation == 0)
{
mp_limb_t v = nmod_poly_evaluate_nmod(input, 1);
nmod_poly_zero(result);
nmod_poly_set_coeff_ui(result, 0, v);
}
else
{
slong i, j, res_length = (input->length - 1) * inflation + 1;
nmod_poly_fit_length(result, res_length);
for (i = input->length - 1; i > 0; i--)
{
result->coeffs[i * inflation] = input->coeffs[i];
for (j = i * inflation - 1; j > (i - 1) * inflation; j--)
result->coeffs[j] = 0;
}
result->coeffs[0] = input->coeffs[0];
result->length = res_length;
}
}
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef CALLGRINDCONTROLLER_H
#define CALLGRINDCONTROLLER_H
#include <QObject>
#include <qprocess.h>
#include <utils/ssh/sshconnection.h>
#include <utils/ssh/sshremoteprocess.h>
#include <utils/ssh/sftpchannel.h>
#include <valgrind/valgrind_global.h>
namespace Valgrind {
class ValgrindProcess;
namespace Callgrind {
class VALGRINDSHARED_EXPORT CallgrindController : public QObject
{
Q_OBJECT
Q_ENUMS(Option)
public:
enum Option {
Unknown,
Dump,
ResetEventCounters,
Pause, UnPause
};
explicit CallgrindController(QObject *parent = 0);
virtual ~CallgrindController();
void run(Valgrind::Callgrind::CallgrindController::Option option);
void setValgrindProcess(ValgrindProcess *process);
ValgrindProcess *valgrindProcess() { return m_valgrindProc; }
/**
* Make data file available locally, triggers @c localParseDataAvailable.
*
* If the valgrind process was run remotely, this transparently
* downloads the data file first and returns a local path.
*/
void getLocalDataFile();
Q_SIGNALS:
void finished(Valgrind::Callgrind::CallgrindController::Option option);
void localParseDataAvailable(const QString &file);
void statusMessage(const QString &msg);
private Q_SLOTS:
void processError(QProcess::ProcessError);
void processFinished(int, QProcess::ExitStatus);
void foundRemoteFile(const QByteArray &file);
void sftpInitialized();
void sftpJobFinished(Utils::SftpJobId job, const QString &error);
private:
void cleanupTempFile();
// callgrind_control process
Valgrind::ValgrindProcess *m_process;
// valgrind process
Valgrind::ValgrindProcess *m_valgrindProc;
Option m_lastOption;
// remote callgrind support
Utils::SshConnection::Ptr m_ssh;
QString m_tempDataFile;
Utils::SshRemoteProcess::Ptr m_findRemoteFile;
Utils::SftpChannel::Ptr m_sftp;
Utils::SftpJobId m_downloadJob;
QByteArray m_remoteFile;
};
} // namespace Callgrind
} // namespace Valgrind
#endif // CALLGRINDCONTROLLER_H
|
/*
Copyright (C) 2012 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "arf.h"
int
arf_sub_fmpz_naive(arf_t z, const arf_t x, const fmpz_t y, slong prec, arf_rnd_t rnd)
{
arf_t t;
int r;
arf_init(t);
arf_set_fmpz(t, y);
r = arf_sub(z, x, t, prec, rnd);
arf_clear(t);
return r;
}
int main()
{
slong iter, iter2;
flint_rand_t state;
flint_printf("sub_fmpz....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
{
arf_t x, z, v;
fmpz_t y;
slong prec, r1, r2;
arf_rnd_t rnd;
arf_init(x);
arf_init(z);
arf_init(v);
fmpz_init(y);
for (iter2 = 0; iter2 < 100; iter2++)
{
arf_randtest_special(x, state, 2000, 10);
fmpz_randtest(y, state, 2000);
prec = 2 + n_randint(state, 2000);
if (n_randint(state, 10) == 0 && fmpz_bits(ARF_EXPREF(x)) < 10)
{
prec = ARF_PREC_EXACT;
}
switch (n_randint(state, 5))
{
case 0: rnd = ARF_RND_DOWN; break;
case 1: rnd = ARF_RND_UP; break;
case 2: rnd = ARF_RND_FLOOR; break;
case 3: rnd = ARF_RND_CEIL; break;
default: rnd = ARF_RND_NEAR; break;
}
switch (n_randint(state, 2))
{
case 0:
r1 = arf_sub_fmpz(z, x, y, prec, rnd);
r2 = arf_sub_fmpz_naive(v, x, y, prec, rnd);
if (!arf_equal(z, v) || r1 != r2)
{
flint_printf("FAIL!\n");
flint_printf("prec = %wd, rnd = %d\n\n", prec, rnd);
flint_printf("x = "); arf_print(x); flint_printf("\n\n");
flint_printf("y = "); fmpz_print(y); flint_printf("\n\n");
flint_printf("z = "); arf_print(z); flint_printf("\n\n");
flint_printf("v = "); arf_print(v); flint_printf("\n\n");
flint_printf("r1 = %wd, r2 = %wd\n", r1, r2);
flint_abort();
}
break;
default:
r2 = arf_sub_fmpz_naive(v, x, y, prec, rnd);
r1 = arf_sub_fmpz(x, x, y, prec, rnd);
if (!arf_equal(x, v) || r1 != r2)
{
flint_printf("FAIL (aliasing)!\n");
flint_printf("prec = %wd, rnd = %d\n\n", prec, rnd);
flint_printf("x = "); arf_print(x); flint_printf("\n\n");
flint_printf("y = "); fmpz_print(y); flint_printf("\n\n");
flint_printf("v = "); arf_print(v); flint_printf("\n\n");
flint_printf("r1 = %wd, r2 = %wd\n", r1, r2);
flint_abort();
}
break;
}
}
arf_clear(x);
arf_clear(z);
arf_clear(v);
fmpz_clear(y);
}
flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
|
/*
* Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
*
* 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
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include "gstomxh264dec.h"
GST_DEBUG_CATEGORY_STATIC (gst_omx_h264_dec_debug_category);
#define GST_CAT_DEFAULT gst_omx_h264_dec_debug_category
/* prototypes */
static gboolean gst_omx_h264_dec_is_format_change (GstOMXVideoDec * dec,
GstOMXPort * port, GstVideoCodecState * state);
static gboolean gst_omx_h264_dec_set_format (GstOMXVideoDec * dec,
GstOMXPort * port, GstVideoCodecState * state);
enum
{
PROP_0
};
/* class initialization */
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (gst_omx_h264_dec_debug_category, "omxh264dec", 0, \
"debug category for gst-omx video decoder base class");
G_DEFINE_TYPE_WITH_CODE (GstOMXH264Dec, gst_omx_h264_dec,
GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT);
static void
gst_omx_h264_dec_class_init (GstOMXH264DecClass * klass)
{
GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
videodec_class->is_format_change =
GST_DEBUG_FUNCPTR (gst_omx_h264_dec_is_format_change);
videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h264_dec_set_format);
videodec_class->cdata.default_sink_template_caps = "video/x-h264, "
"alignment=(string)au, "
"width=(int) [1,MAX], " "height=(int) [1,MAX]";
gst_element_class_set_static_metadata (element_class,
"OpenMAX H.264 Video Decoder",
"Codec/Decoder/Video",
"Decode H.264 video streams",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.avc");
}
static void
gst_omx_h264_dec_init (GstOMXH264Dec * self)
{
}
static gboolean
gst_omx_h264_dec_is_format_change (GstOMXVideoDec * dec,
GstOMXPort * port, GstVideoCodecState * state)
{
return FALSE;
}
static gboolean
gst_omx_h264_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port,
GstVideoCodecState * state)
{
gboolean ret;
OMX_PARAM_PORTDEFINITIONTYPE port_def;
gst_omx_port_get_port_definition (port, &port_def);
port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone;
printf("\e[31m%s:%s:%d\e[0m\n",__func__,__FILE__,__LINE__);
return ret;
}
|
/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MPANNABLEVIEWPORT_P_H
#define MPANNABLEVIEWPORT_P_H
#include "mpannablewidget_p.h"
#include <QPropertyAnimation>
class QGraphicsWidget;
class MStyle;
class MPositionIndicator;
class QGraphicsLinearLayout;
class MPannableViewportLayout;
class MPannableViewportPrivate : public MPannableWidgetPrivate
{
Q_DECLARE_PUBLIC(MPannableViewport)
public:
MPannableViewportPrivate();
virtual ~MPannableViewportPrivate();
QGraphicsWidget *pannedWidget;
MPannableViewportLayout *viewportLayout;
MPositionIndicator *positionIndicator;
qreal rangeHeightExtension; // Amount of range extended vertically
qreal inputMethodAreaHeight; // Height of software input panel
QPropertyAnimation scrollToAnimation;
/*!
* \brief Sets new value of the range attribute with emitting
* rangeChanged() signal if needed.
*/
void setNewRange(const QRectF &newRange);
void setInputMethodArea(const QRect &imArea);
void updateExtendedVerticalRange();
void applyAutoRange();
void scrollTo(const QPointF &panningPosition,
int duration = 0,
const QEasingCurve &easingCurve = QEasingCurve(QEasingCurve::Linear));
bool isTopmostVerticallyPannableViewport() const;
void sendOnDisplayChangeEventToMWidgets(QGraphicsItem *item,
MOnDisplayChangeEvent *event);
void _q_resolvePannedWidgetIsOnDisplay();
void _q_positionIndicatorEnabledChanged();
void _q_pannedWidgetWidthOutOfViewport();
void _q_pannedWidgetHeightOutOfViewport();
void _q_ensureFocusedPannedWidgetIsVisible();
void _q_handleInputMethodAreaChanged(const QRect &);
};
#endif
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef PLUGIN2_H
#define PLUGIN2_H
#include <extensionsystem/iplugin.h>
#include <QtCore/QObject>
namespace Plugin2 {
class MyPlugin2 : public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
MyPlugin2();
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
};
} // Plugin2
#endif // PLUGIN2_H
|
/*
* common.h
* Copyright (C) 2018 Meltytech, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMON_H
#define COMMON_H
#include <SDL.h>
SDL_AudioDeviceID sdl2_open_audio( const SDL_AudioSpec* desired, SDL_AudioSpec* obtained );
#endif // COMMON_H
|
/**********************************************************************
* $Id
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2001-2002 Vivid Solutions Inc.
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#ifndef GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
#define GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
#include <vector>
#include <geos/geom/GeometryComponentFilter.h>
#include <geos/geom/Geometry.h> // to be removed when we have the .inl
#include <geos/geom/Coordinate.h> // to be removed when we have the .inl
#include <geos/geom/LineString.h> // to be removed when we have the .inl
#include <geos/geom/Point.h> // to be removed when we have the .inl
//#include <geos/platform.h>
namespace geos {
namespace geom { // geos::geom
namespace util { // geos::geom::util
/**
* Extracts a single representative {@link Coordinate}
* from each connected component of a {@link Geometry}.
*
* @version 1.9
*/
class ComponentCoordinateExtracter : public GeometryComponentFilter
{
private:
Coordinate::ConstVect &comps;
public:
/**
* Push the linear components from a single geometry into
* the provided vector.
* If more than one geometry is to be processed, it is more
* efficient to create a single ComponentCoordinateFilter instance
* and pass it to multiple geometries.
*/
static void getCoordinates(const Geometry &geom, std::vector<const Coordinate*> &ret)
{
ComponentCoordinateExtracter cce(ret);
geom.apply_ro(&cce);
}
/**
* Constructs a ComponentCoordinateFilter with a list in which
* to store Coordinates found.
*/
ComponentCoordinateExtracter( std::vector<const Coordinate*> &newComps)
:
comps(newComps)
{}
void filter_rw( Geometry * geom)
{
if ( geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING
|| geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
|| geom->getGeometryTypeId() == geos::geom::GEOS_POINT )
comps.push_back( geom->getCoordinate() );
//if ( typeid( *geom ) == typeid( LineString )
// || typeid( *geom ) == typeid( Point ) )
//if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
// comps.push_back(ls);
}
void filter_ro( const Geometry * geom)
{
//if ( typeid( *geom ) == typeid( LineString )
// || typeid( *geom ) == typeid( Point ) )
if ( geom->getGeometryTypeId() == geos::geom::GEOS_LINEARRING
|| geom->getGeometryTypeId() == geos::geom::GEOS_LINESTRING
|| geom->getGeometryTypeId() == geos::geom::GEOS_POINT )
comps.push_back( geom->getCoordinate() );
//if ( const Coordinate *ls=dynamic_cast<const Coordinate *>(geom) )
// comps.push_back(ls);
}
};
} // namespace geos.geom.util
} // namespace geos.geom
} // namespace geos
#endif //GEOS_GEOM_UTIL_COMPONENTCOORDINATEEXTRACTER_H
/**********************************************************************
* $Log$
*
**********************************************************************/
|
// IFC SDK : IFC2X3 C++ Early Classes
// Copyright (C) 2009 CSTB
//
// 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.
// The full license is in Licence.txt file included with this
// distribution or is available at :
// http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
//
// 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.
#ifndef IFC2X3_IFCRELASSOCIATESCONSTRAINT_H
#define IFC2X3_IFCRELASSOCIATESCONSTRAINT_H
#include <ifc2x3/DefinedTypes.h>
#include <ifc2x3/Export.h>
#include <ifc2x3/IfcRelAssociates.h>
#include <Step/BaseVisitor.h>
#include <Step/ClassType.h>
#include <Step/Referenced.h>
#include <Step/SPFData.h>
#include <Step/String.h>
#include <string>
namespace ifc2x3 {
class CopyOp;
class IfcConstraint;
/**
* Generated class for the IfcRelAssociatesConstraint Entity.
*
*/
class IFC2X3_EXPORT IfcRelAssociatesConstraint : public IfcRelAssociates {
public:
/**
* Accepts a read/write Step::BaseVisitor.
*
* @param visitor the read/write Step::BaseVisitor to accept
*/
virtual bool acceptVisitor(Step::BaseVisitor *visitor);
/**
* Returns the class type as a human readable std::string.
*
*/
virtual const std::string &type() const;
/**
* Returns the Step::ClassType of this specific class. Useful to compare with the isOfType method for example.
*
*/
static const Step::ClassType &getClassType();
/**
* Returns the Step::ClassType of the instance of this class. (might be a subtype since it is virtual and overloaded).
*
*/
virtual const Step::ClassType &getType() const;
/**
* Compares this instance's Step::ClassType with the one passed as parameter. Checks the type recursively (to the mother classes).
*
* @param t
*/
virtual bool isOfType(const Step::ClassType &t) const;
/**
* Gets the value of the explicit attribute 'Intent'.
*
*/
virtual IfcLabel getIntent();
/**
* (const) Returns the value of the explicit attribute 'Intent'.
*
* @return the value of the explicit attribute 'Intent'
*/
virtual const IfcLabel getIntent() const;
/**
* Sets the value of the explicit attribute 'Intent'.
*
* @param value
*/
virtual void setIntent(const IfcLabel &value);
/**
* unset the attribute 'Intent'.
*
*/
virtual void unsetIntent();
/**
* Test if the attribute 'Intent' is set.
*
* @return true if set, false if unset
*/
virtual bool testIntent() const;
/**
* Gets the value of the explicit attribute 'RelatingConstraint'.
*
*/
virtual IfcConstraint *getRelatingConstraint();
/**
* (const) Returns the value of the explicit attribute 'RelatingConstraint'.
*
* @return the value of the explicit attribute 'RelatingConstraint'
*/
virtual const IfcConstraint *getRelatingConstraint() const;
/**
* Sets the value of the explicit attribute 'RelatingConstraint'.
*
* @param value
*/
virtual void setRelatingConstraint(const Step::RefPtr< IfcConstraint > &value);
/**
* unset the attribute 'RelatingConstraint'.
*
*/
virtual void unsetRelatingConstraint();
/**
* Test if the attribute 'RelatingConstraint' is set.
*
* @return true if set, false if unset
*/
virtual bool testRelatingConstraint() const;
friend class ExpressDataSet;
protected:
/**
* @param id
* @param args
*/
IfcRelAssociatesConstraint(Step::Id id, Step::SPFData *args);
virtual ~IfcRelAssociatesConstraint();
/**
*/
virtual bool init();
/**
* @param obj
* @param copyop
*/
virtual void copy(const IfcRelAssociatesConstraint &obj, const CopyOp ©op);
private:
/**
*/
static Step::ClassType s_type;
/**
*/
Step::String m_intent;
/**
*/
Step::RefPtr< IfcConstraint > m_relatingConstraint;
};
}
#endif // IFC2X3_IFCRELASSOCIATESCONSTRAINT_H
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef LIBMESH_CELL_INF_PRISM_H
#define LIBMESH_CELL_INF_PRISM_H
#include "libmesh/libmesh_config.h"
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
// Local includes
#include "libmesh/cell_inf.h"
namespace libMesh
{
/**
* The \p InfPrism is an element in 3D with 4 sides.
* The \f$ 5^{th} \f$ side is theoretically located at infinity,
* and therefore not accounted for.
* However, one could say that the \f$ 5^{th} \f$ side actually
* @e does exist in the mesh, since the outer nodes are located
* at a specific distance from the mesh origin (and therefore
* define a side). Still, this face is not to be used!
*
* \author Daniel Dreyer
* \date 2003
* \brief The base class for all 3D infinite prismatic element types.
*/
class InfPrism : public InfCell
{
public:
/**
* Default infinite prism element, takes number of nodes and
* parent. Derived classes implement 'true' elements.
*/
InfPrism(const unsigned int nn, Elem * p, Node ** nodelinkdata) :
InfCell(nn, InfPrism::n_sides(), p, _elemlinks_data, nodelinkdata)
{}
/**
* @returns the \p Point associated with local \p Node \p i,
* in master element rather than physical coordinates.
*/
virtual Point master_point (const unsigned int i) const libmesh_override
{
libmesh_assert_less(i, this->n_nodes());
return Point(_master_points[i][0],
_master_points[i][1],
_master_points[i][2]);
}
/**
* @returns 4. Infinite elements have one side less
* than their conventional counterparts, since one
* side is supposed to be located at infinity.
*/
virtual unsigned int n_sides() const libmesh_override { return 4; }
/**
* @returns 6. All infinite prisms (in our
* setting) have 6 vertices.
*/
virtual unsigned int n_vertices() const libmesh_override { return 6; }
/**
* @returns 6. All infinite prismahedrals have 6 edges,
* 3 lying in the base, and 3 perpendicular to the base.
*/
virtual unsigned int n_edges() const libmesh_override { return 6; }
/**
* @returns 4. All prisms have 4 faces.
*/
virtual unsigned int n_faces() const libmesh_override { return 4; }
/**
* @returns 4.
*/
virtual unsigned int n_children() const libmesh_override { return 4; }
/**
* @returns true if the specified (local) node number is a
* "mid-edge" node on an infinite element edge.
*/
virtual bool is_mid_infinite_edge_node(const unsigned int i) const
libmesh_override { return (i > 2 && i < 6); }
/**
* @returns true if the specified child is on the specified side.
*/
virtual bool is_child_on_side(const unsigned int c,
const unsigned int s) const libmesh_override;
/**
* @returns true if the specified edge is on the specified side.
*/
virtual bool is_edge_on_side(const unsigned int e,
const unsigned int s) const libmesh_override;
/**
* Don't hide Elem::key() defined in the base class.
*/
using Elem::key;
/**
* @returns an id associated with the \p s side of this element.
* The id is not necessarily unique, but should be close. This is
* particularly useful in the \p MeshBase::find_neighbors() routine.
*/
virtual dof_id_type key (const unsigned int s) const libmesh_override;
/**
* @returns a primitive (3-noded) tri or (4-noded) infquad for
* face i.
*/
virtual UniquePtr<Elem> side_ptr (const unsigned int i) libmesh_override;
protected:
/**
* Data for links to parent/neighbor/interior_parent elements.
*/
Elem * _elemlinks_data[5+(LIBMESH_DIM>3)];
/**
* Master element node locations
*/
static const Real _master_points[12][3];
};
} // namespace libMesh
#endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
#endif // LIBMESH_CELL_INF_PRISM_H
|
/*
* Copyright (C) 2014 Paul Stoffregen <paul@pjrc.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.
*
* 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
*/
/* automatically generated from boot_2xxx.armasm */
#include "boot_2xxx.h"
const unsigned int boot_2xxx[] = {
7, 0xe28f000c, 0xe5901000, 0xe3a00001, 0xe5810000, 0xe3a0f000, 0xe01fc040
};
|
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * 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 Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PerformanceResourceTiming_h
#define PerformanceResourceTiming_h
#if ENABLE(RESOURCE_TIMING)
#include "PerformanceEntry.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class Document;
class KURL;
class ResourceLoadTiming;
class ResourceRequest;
class ResourceResponse;
class PerformanceResourceTiming : public PerformanceEntry {
public:
static PassRefPtr<PerformanceResourceTiming> create(const AtomicString& initiatorType, const ResourceRequest& request, const ResourceResponse& response, double initiationTime, double finishTime, Document* requestingDocument)
{
return adoptRef(new PerformanceResourceTiming(initiatorType, request, response, initiationTime, finishTime, requestingDocument));
}
AtomicString initiatorType() const;
double redirectStart() const;
double redirectEnd() const;
double fetchStart() const;
double domainLookupStart() const;
double domainLookupEnd() const;
double connectStart() const;
double connectEnd() const;
double secureConnectionStart() const;
double requestStart() const;
double responseStart() const;
double responseEnd() const;
virtual bool isResource() { return true; }
private:
PerformanceResourceTiming(const AtomicString& initatorType, const ResourceRequest&, const ResourceResponse&, double initiationTime, double finishTime, Document*);
~PerformanceResourceTiming();
double resourceTimeToDocumentMilliseconds(int deltaMilliseconds) const;
AtomicString m_initiatorType;
RefPtr<ResourceLoadTiming> m_timing;
double m_finishTime;
RefPtr<Document> m_requestingDocument;
};
}
#endif // ENABLE(RESOURCE_TIMING)
#endif // !defined(PerformanceResourceTiming_h)
|
//
// Copyright 2016 Timo Kloss
//
// 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 machine_h
#define machine_h
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include "io_chip.h"
#include "video_chip.h"
#include "audio_chip.h"
#define PERSISTENT_RAM_SIZE 4096
struct Core;
// 64 KB
struct Machine {
// 0x0000
uint8_t cartridgeRom[0x8000]; // 32 KB
// 0x8000
struct VideoRam videoRam; // 8 KB
// 0xA000
uint8_t workingRam[0x4000]; // 16 KB
// 0xE000
uint8_t persistentRam[PERSISTENT_RAM_SIZE]; // 4 KB
// 0xF000
uint8_t reservedMemory[0xFE00 - 0xF000];
// 0xFE00
struct SpriteRegisters spriteRegisters; // 256 B
// 0xFF00
struct ColorRegisters colorRegisters; // 32 B
// 0xFF20
struct VideoRegisters videoRegisters;
uint8_t reservedVideo[0x20 - sizeof(struct VideoRegisters)];
// 0xFF40
struct AudioRegisters audioRegisters;
// 0xFF70
struct IORegisters ioRegisters;
uint8_t reservedIO[0x10 - sizeof(struct IORegisters)];
// 0xFF80
uint8_t reservedRegisters[0x10000 - 0xFF80];
};
struct MachineInternals {
struct AudioInternals audioInternals;
bool hasAccessedPersistent;
bool hasChangedPersistent;
bool isEnergySaving;
int energySavingTimer;
};
void machine_init(struct Core *core);
void machine_reset(struct Core *core, bool resetPersistent);
int machine_peek(struct Core *core, int address);
bool machine_poke(struct Core *core, int address, int value);
void machine_enableAudio(struct Core *core);
void machine_suspendEnergySaving(struct Core *core, int numUpdates);
#endif /* machine_h */
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2014. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU Affero General Public License as published *
* by the Free Software Foundation, either version 3 or (at your option) *
* any later version. This program is distributed without any warranty. *
* See the file COPYING.agpl-v3 for details. *
\*************************************************************************/
/* Listing 10-3 */
#define _XOPEN_SOURCE
#include <time.h>
#include <locale.h>
#include "tlpi_hdr.h"
#define SBUF_SIZE 1000
int
main(int argc, char *argv[])
{
struct tm tm;
char sbuf[SBUF_SIZE];
char *ofmt;
if (argc < 3 || strcmp(argv[1], "--help") == 0)
usageErr("%s input-date-time in-format [out-format]\n", argv[0]);
if (setlocale(LC_ALL, "") == NULL)
errExit("setlocale"); /* Use locale settings in conversions */
memset(&tm, 0, sizeof(struct tm)); /* Initialize 'tm' */
if (strptime(argv[1], argv[2], &tm) == NULL)
fatal("strptime");
tm.tm_isdst = -1; /* Not set by strptime(); tells mktime()
to determine if DST is in effect */
printf("calendar time (seconds since Epoch): %ld\n", (long) mktime(&tm));
ofmt = (argc > 3) ? argv[3] : "%H:%M:%S %A, %d %B %Y %Z";
if (strftime(sbuf, SBUF_SIZE, ofmt, &tm) == 0)
fatal("strftime returned 0");
printf("strftime() yields: %s\n", sbuf);
exit(EXIT_SUCCESS);
}
|
/*
* Value data handle functions
*
* Copyright (C) 2009-2015, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This software is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software 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 Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined( _LIBESEDB_VALUE_DATA_HANDLE_H )
#define _LIBESEDB_VALUE_DATA_HANDLE_H
#include <common.h>
#include <types.h>
#include "libesedb_libcdata.h"
#include "libesedb_libcerror.h"
#include "libesedb_libfvalue.h"
#if defined( __cplusplus )
extern "C" {
#endif
int libesedb_value_data_handle_read_value_entries(
libfvalue_data_handle_t *data_handle,
const uint8_t *data,
size_t data_size,
int encoding,
uint32_t data_flags,
libcerror_error_t **error );
#if defined( __cplusplus )
}
#endif
#endif
|
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __LUMINANCESOURCE_H__
#define __LUMINANCESOURCE_H__
/*
* LuminanceSource.h
* zxing
*
* Copyright 2010 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/common/Counted.h>
#include <zxing/common/Array.h>
#include <string.h>
namespace zxing {
class LuminanceSource : public Counted {
private:
const int width;
const int height;
public:
LuminanceSource(int width, int height);
virtual ~LuminanceSource();
int getWidth() const { return width; }
int getHeight() const { return height; }
// Callers take ownership of the returned memory and must call delete [] on it themselves.
virtual ArrayRef<char> getRow(int y, ArrayRef<char> row) const = 0;
virtual ArrayRef<char> getMatrix() const = 0;
virtual bool isCropSupported() const;
virtual Ref<LuminanceSource> crop(int left, int top, int width, int height) const;
virtual bool isRotateSupported() const;
virtual Ref<LuminanceSource> invert() const;
virtual Ref<LuminanceSource> rotateCounterClockwise() const;
operator std::string () const;
};
}
#endif /* LUMINANCESOURCE_H_ */
|
// -*- Mode:C++ -*-
/************************************************************************\
* *
* This file is part of Avango. *
* *
* Copyright 1997 - 2008 Fraunhofer-Gesellschaft zur Foerderung der *
* angewandten Forschung (FhG), Munich, Germany. *
* *
* Avango 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, version 3. *
* *
* Avango 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 Lesser General Public *
* License along with Avango. If not, see <http://www.gnu.org/licenses/>. *
* *
* Avango is a trademark owned by FhG. *
* *
\************************************************************************/
#if !defined(AVANGO_TOOLS_UNIONSELECTOR_H)
#define AVANGO_TOOLS_UNIONSELECTOR_H
/**
* \file
* \ingroup av_tools
*/
#include <avango/tools/Selector.h>
#include "windows_specific_tools.h"
namespace av
{
namespace tools
{
/**
* UnionSelector class passes the union of two sets of targets.
*
* \ingroup av_tools
*/
class AV_TOOLS_DLL UnionSelector : public Selector
{
AV_FC_DECLARE();
public:
/**
* Constructor.
*/
UnionSelector();
protected:
/**
* Destructor made protected to prevent allocation on stack.
*/
virtual ~UnionSelector();
public:
/**
* Defines the input target sets whose union is passed to SelectedTargets.
*/
MFTargetHolder TargetSet1;
MFTargetHolder TargetSet2;
/* virtual */ void evaluate();
};
using SFUnionSelector = SingleField<Link<UnionSelector> >;
using MFUnionSelector = MultiField<Link<UnionSelector> >;
}
#ifdef AV_INSTANTIATE_FIELD_TEMPLATES
template class AV_TOOLS_DLL SingleField<Link<tools::UnionSelector> >;
template class AV_TOOLS_DLL MultiField<Link<tools::UnionSelector> >;
#endif
}
#endif
|
/*******************************************************************************
Copyright (c) 2001-2008, Perforce Software, 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 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 PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/*******************************************************************************
* Name : p4mergedata.h
*
* Author : Tony Smith <tony@perforce.com> or <tony@smee.org>
*
* Description : Class for holding merge data
*
******************************************************************************/
class P4MergeData
{
public:
P4MergeData( lua_State *_L, ClientUser *ui, ClientMerge *m, StrPtr &hint );
void SetDebug( int d ) { debug = d; }
int GetYourName();
int GetTheirName();
int GetBaseName();
int GetYourPath();
int GetTheirPath();
int GetBasePath();
int GetResultPath();
int GetMergeHint();
int RunMergeTool();
private:
lua_State * L;
int debug;
ClientUser * ui;
StrBuf hint;
ClientMerge * merger;
StrBuf yours;
StrBuf theirs;
StrBuf base;
};
|
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Interned strings.
*/
#ifndef _DALVIK_INTERN
#define _DALVIK_INTERN
bool dvmStringInternStartup(void);
void dvmStringInternShutdown(void);
StringObject* dvmLookupInternedString(StringObject* strObj);
StringObject* dvmLookupImmortalInternedString(StringObject* strObj);
bool dvmIsWeakInternedString(const StringObject* strObj);
#endif /*_DALVIK_INTERN*/
|
// Md4.h : header file
//
/* md4.c - an implementation of MD4 Message-Digest Algorithm
* based on RFC 1320.
*
*/
/////////////////////////////////////////////////////////////////////////////////////////////
// //
// MD4 - An implementation of MD4 Message-Digest Algorithm. //
// Based on RFC 1320. //
// //
/////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#define md4_block_size 64
#define md4_hash_size 16
/* algorithm context */
typedef struct _md4_ctx
{
UINT32 message[md4_block_size/4]; /* 512-bit buffer for leftovers */
UINT64 length; /* number of processed bytes */
UINT32 hash[4]; /* 128-bit algorithm internal hashing state */
} md4_ctx;
class CMd4
{
public:
CMd4(void);
virtual ~CMd4(void);
private:
static void process_block(UINT32 state[4], const UINT32* x);
public:
void Init(md4_ctx* ctx);
void Update(md4_ctx* ctx, const UINT8* msg, UINT32 size);
void Digest(md4_ctx* ctx, UINT8 result[16]);
};
|
/* The Image Registration Toolkit (IRTK)
*
* Copyright 2008-2015 Imperial College London
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. */
#ifndef _IRTKDEFINES_H
#define _IRTKDEFINES_H
// ===========================================================================
// General
// ===========================================================================
/// Whether to build for execution on Microsoft Windows
#define WINDOWS (defined (_WIN32) || defined (WIN32) || defined (_WINDOWS))
/// Precision of floating point types to use by default
/// 0: single-precision 1: double-precision
#define USE_FLOAT_BY_DEFAULT 0
// ===========================================================================
// CUDA
// ===========================================================================
// ---------------------------------------------------------------------------
#ifndef IRTKCU_API
# if __CUDACC__
# define IRTKCU_API __device__ __host__
# else
# define IRTKCU_API
# endif
#endif
// ---------------------------------------------------------------------------
#ifndef IRTKCU_HOST_API
# if __CUDACC__
# define IRTKCU_HOST_API __host__
# else
# define IRTKCU_HOST_API
# endif
#endif
// ---------------------------------------------------------------------------
#ifndef IRTKCU_DEVICE_API
# if __CUDACC__
# define IRTKCU_DEVICE_API __device__
# else
# define IRTKCU_DEVICE_API
# endif
#endif
// =============================================================================
// irtkAssert
// =============================================================================
// -----------------------------------------------------------------------------
#ifndef NDEBUG
# define irtkAssert(condition, message) \
do { \
if (!(condition)) { \
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
<< " line " << __LINE__ << ": " << message << std::endl; \
std::exit(EXIT_FAILURE); \
} \
} while (false)
#else
# define irtkAssert(condition, message) do { } while (false)
#endif
// =============================================================================
// VTK 5/6 transition
// =============================================================================
#ifdef HAS_VTK
#include <vtkConfigure.h>
// Auxiliary macro to set VTK filter input
#if VTK_MAJOR_VERSION >= 6
# define SetVTKInput(filter, dataset) (filter)->SetInputData(dataset);
#else
# define SetVTKInput(filter, dataset) (filter)->SetInput(dataset);
#endif
// Auxiliary macro to set VTK filter input connection
#if VTK_MAJOR_VERSION >= 6
# define SetVTKConnection(filter2, filter1) (filter2)->SetInputConnection((filter1)->GetOutputPort());
#else
# define SetVTKConnection(filter2, filter1) (filter2)->SetInput((filter1)->GetOutput());
#endif
#endif // HAS_VTK
#endif
|
#ifndef SF1_AD_RECOMMENDER_H_
#define SF1_AD_RECOMMENDER_H_
#include <util/singleton.h>
#include <common/type_defs.h>
#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <am/matrix/matrix_db.h>
#include <vector>
#include <boost/unordered_map.hpp>
#include <util/PriorityQueue.h>
namespace sf1r
{
struct ScoredAdItem
{
std::string key;
double score;
};
class ScoreSortedAdQueue
{
class Queue_ : public izenelib::util::PriorityQueue<ScoredAdItem>
{
public:
Queue_(size_t size)
{
initialize(size);
}
protected:
bool lessThan(const ScoredAdItem& o1, const ScoredAdItem& o2) const
{
if (std::fabs(o1.score - o2.score) < std::numeric_limits<score_t>::epsilon())
{
return o1.key < o2.key;
}
return (o1.score < o2.score);
}
};
public:
ScoreSortedAdQueue(size_t size) : queue_(size)
{
}
~ScoreSortedAdQueue() {}
bool insert(const ScoredAdItem& doc)
{
return queue_.insert(doc);
}
ScoredAdItem pop()
{
return queue_.pop();
}
const ScoredAdItem& top()
{
return queue_.top();
}
ScoredAdItem& operator[](size_t pos)
{
return queue_[pos];
}
ScoredAdItem& getAt(size_t pos)
{
return queue_.getAt(pos);
}
size_t size()
{
return queue_.size();
}
void clear() {}
private:
Queue_ queue_;
};
class AdRecommender
{
public:
static const int MAX_AD_ITEMS = 1024*1024;
typedef std::vector<double> LatentVecT;
typedef std::vector<std::pair<std::string, std::string> > FeatureT;
AdRecommender();
~AdRecommender();
void init(const std::string& data_path, bool use_ad_feature);
void recommend(const std::string& user_str_id,
const FeatureT& user_info, std::size_t max_return,
std::vector<std::string>& recommended_items,
std::vector<double>& score_list);
void recommendFromCand(const std::string& user_str_id,
const FeatureT& user_info, std::size_t max_return,
std::vector<std::string>& recommended_doclist,
std::vector<double>& score_list);
void update(const std::string& user_str_id, const FeatureT& user_info,
const std::string& ad_docid, bool is_clicked);
void load();
void save();
void dumpUserLatent();
void deleteAdDoc(const std::string& docid);
//void setMaxAdDocId(docid_t max_docid);
void updateAdFeatures(const std::string& ad_docid, const std::vector<std::string>& features);
private:
//typedef izenelib::am::MatrixDB<uint32_t, double> MatrixType;
//typedef MatrixType::row_type RowType;
typedef boost::unordered_map<std::string, LatentVecT> LatentVecContainerT;
//typedef std::vector<LatentVecT> AdLatentVecContainerT;
typedef std::map<std::string, std::set<uint32_t> > AdFeatureContainerT;
void doRecommend(const std::string& user_str_id,
const FeatureT& user_info, std::size_t max_return,
std::vector<std::string>& recommended_items,
std::vector<double>& score_list, bool rec_for_unview);
void getAdLatentVecKeys(const std::string& ad_docid, std::vector<std::string>& ad_latentvec_keys);
void getUserLatentVecKeys(const FeatureT& user_info, std::vector<std::string>& user_latentvec_keys);
void getCombinedUserLatentVec(const std::vector<std::string>& latentvec_keys, LatentVecT& latent_vec);
void getCombinedUserLatentVec(const std::vector<LatentVecT*>& latentvec_list, LatentVecT& latent_vec);
std::string data_path_;
bool use_ad_feature_;
LatentVecContainerT ad_latent_vec_list_;
LatentVecContainerT user_feature_latent_vec_list_;
std::size_t clicked_num_;
std::size_t impression_num_;
double ratio_;
double learning_rate_;
LatentVecT default_latent_;
// total clicked number and last clicked time to evaluate the popularity of ad.
boost::unordered_map<std::string, std::pair<uint32_t, uint64_t> > ad_clicked_data_;
// the last activity time for user. remove dead user period.
boost::unordered_map<std::string, uint64_t> user_activity_list_;
std::vector<std::string> ad_feature_value_list_;
boost::unordered_map<std::string, uint32_t> ad_feature_value_id_list_;
AdFeatureContainerT ad_features_map_;
std::bitset<MAX_AD_ITEMS> unviewed_items_;
boost::shared_mutex user_latent_lock_;
boost::shared_mutex ad_latent_lock_;
boost::shared_mutex ad_feature_lock_;
};
} //namespace sf1r
#endif
|
/*
* Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Full C support initialization
*
* Initialization of full C support: zero the .bss and call z_cstart().
*
* Stack is available in this module, but not the global data/bss until their
* initialization is performed.
*/
#include <kernel_internal.h>
#include <linker/linker-defs.h>
__weak void z_arm64_mm_init(bool is_primary_core) { }
extern FUNC_NORETURN void z_cstart(void);
extern void z_arm64_mm_init(bool is_primary_core);
static inline void z_arm64_bss_zero(void)
{
uint64_t *p = (uint64_t *)__bss_start;
uint64_t *end = (uint64_t *)__bss_end;
while (p < end) {
*p++ = 0U;
}
}
/**
*
* @brief Prepare to and run C code
*
* This routine prepares for the execution of and runs C code.
*
* @return N/A
*/
void z_arm64_prep_c(void)
{
/* Initialize tpidrro_el0 with our struct _cpu instance address */
write_tpidrro_el0((uintptr_t)&_kernel.cpus[0]);
z_arm64_bss_zero();
#ifdef CONFIG_XIP
z_data_copy();
#endif
z_arm64_mm_init(true);
z_arm64_interrupt_init();
z_cstart();
CODE_UNREACHABLE;
}
#if CONFIG_MP_NUM_CPUS > 1
extern FUNC_NORETURN void z_arm64_secondary_start(void);
void z_arm64_secondary_prep_c(void)
{
z_arm64_secondary_start();
CODE_UNREACHABLE;
}
#endif
|
#pragma once
#include <cstdint>
#include <string>
#include "envoy/config/metrics/v3/stats.pb.h"
#include "envoy/stats/histogram.h"
#include "envoy/stats/stats.h"
#include "envoy/stats/store.h"
#include "common/common/matchers.h"
#include "common/common/non_copyable.h"
#include "common/stats/metric_impl.h"
#include "circllhist.h"
namespace Envoy {
namespace Stats {
class HistogramSettingsImpl : public HistogramSettings {
public:
HistogramSettingsImpl() = default;
HistogramSettingsImpl(const envoy::config::metrics::v3::StatsConfig& config);
// HistogramSettings
const ConstSupportedBuckets& buckets(absl::string_view stat_name) const override;
static ConstSupportedBuckets& defaultBuckets();
private:
using Config = std::pair<Matchers::StringMatcherImpl, ConstSupportedBuckets>;
const std::vector<Config> configs_{};
};
/**
* Implementation of HistogramStatistics for circllhist.
*/
class HistogramStatisticsImpl : public HistogramStatistics, NonCopyable {
public:
HistogramStatisticsImpl();
/**
* HistogramStatisticsImpl object is constructed using the passed in histogram.
* @param histogram_ptr pointer to the histogram for which stats will be calculated. This pointer
* will not be retained.
*/
HistogramStatisticsImpl(
const histogram_t* histogram_ptr,
ConstSupportedBuckets& supported_buckets = HistogramSettingsImpl::defaultBuckets());
static ConstSupportedBuckets& defaultSupportedBuckets();
void refresh(const histogram_t* new_histogram_ptr);
// HistogramStatistics
std::string quantileSummary() const override;
std::string bucketSummary() const override;
const std::vector<double>& supportedQuantiles() const final;
const std::vector<double>& computedQuantiles() const override { return computed_quantiles_; }
ConstSupportedBuckets& supportedBuckets() const override { return supported_buckets_; }
const std::vector<uint64_t>& computedBuckets() const override { return computed_buckets_; }
uint64_t sampleCount() const override { return sample_count_; }
double sampleSum() const override { return sample_sum_; }
private:
ConstSupportedBuckets& supported_buckets_;
std::vector<double> computed_quantiles_;
std::vector<uint64_t> computed_buckets_;
uint64_t sample_count_;
double sample_sum_;
};
class HistogramImplHelper : public MetricImpl<Histogram> {
public:
HistogramImplHelper(StatName name, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags, SymbolTable& symbol_table)
: MetricImpl<Histogram>(name, tag_extracted_name, stat_name_tags, symbol_table) {}
HistogramImplHelper(SymbolTable& symbol_table) : MetricImpl<Histogram>(symbol_table) {}
// RefcountInterface
void incRefCount() override { refcount_helper_.incRefCount(); }
bool decRefCount() override { return refcount_helper_.decRefCount(); }
uint32_t use_count() const override { return refcount_helper_.use_count(); }
private:
RefcountHelper refcount_helper_;
};
/**
* Histogram implementation for the heap.
*/
class HistogramImpl : public HistogramImplHelper {
public:
HistogramImpl(StatName name, Unit unit, Store& parent, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags)
: HistogramImplHelper(name, tag_extracted_name, stat_name_tags, parent.symbolTable()),
unit_(unit), parent_(parent) {}
~HistogramImpl() override {
// We must explicitly free the StatName here in order to supply the
// SymbolTable reference. An RAII alternative would be to store a
// reference to the SymbolTable in MetricImpl, which would cost 8 bytes
// per stat.
MetricImpl::clear(symbolTable());
}
// Stats::Histogram
Unit unit() const override { return unit_; };
void recordValue(uint64_t value) override { parent_.deliverHistogramToSinks(*this, value); }
bool used() const override { return true; }
SymbolTable& symbolTable() final { return parent_.symbolTable(); }
private:
Unit unit_;
// This is used for delivering the histogram data to sinks.
Store& parent_;
};
/**
* Null histogram implementation.
* No-ops on all calls and requires no underlying metric or data.
*/
class NullHistogramImpl : public HistogramImplHelper {
public:
explicit NullHistogramImpl(SymbolTable& symbol_table)
: HistogramImplHelper(symbol_table), symbol_table_(symbol_table) {}
~NullHistogramImpl() override { MetricImpl::clear(symbol_table_); }
bool used() const override { return false; }
SymbolTable& symbolTable() override { return symbol_table_; }
Unit unit() const override { return Unit::Null; };
void recordValue(uint64_t) override {}
private:
SymbolTable& symbol_table_;
};
} // namespace Stats
} // namespace Envoy
|
// Copyright 2013-2016 Stanford University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef STOKE_SRC_SYMSTATE_SIMPLIFY_H
#define STOKE_SRC_SYMSTATE_SIMPLIFY_H
#include "src/symstate/bitvector.h"
#include "src/symstate/bool.h"
#include <map>
namespace stoke {
class SymSimplify {
public:
/** Simplify a given bit vector */
SymBitVector simplify(const SymBitVector& b);
/** Simplify a given bool */
SymBool simplify(const SymBool& b);
/** Simplify a given array */
SymArray simplify(const SymArray& b);
/** Constructions a new simplifier. Any node sharing will be preserved for all circuits simplified with this simplifier. */
SymSimplify() {}
private:
/** Simplification cache for bools. */
std::map<SymBoolAbstract*, SymBoolAbstract*> cache_bool1_;
std::map<SymBoolAbstract*, SymBoolAbstract*> cache_bool2_;
std::map<SymBoolAbstract*, SymBoolAbstract*> cache_bool3_;
/** Simplification cache for bitvectors. */
std::map<SymBitVectorAbstract*, SymBitVectorAbstract*> cache_bits1_;
std::map<SymBitVectorAbstract*, SymBitVectorAbstract*> cache_bits2_;
std::map<SymBitVectorAbstract*, SymBitVectorAbstract*> cache_bits3_;
/** Simplification cache for arrays. */
std::map<SymArrayAbstract*, SymArrayAbstract*> cache_array1_;
std::map<SymArrayAbstract*, SymArrayAbstract*> cache_array2_;
std::map<SymArrayAbstract*, SymArrayAbstract*> cache_array3_;
};
} // namespace stoke
#endif
|
//
// APError.h
// Appacitive-iOS-SDK
//
// Created by Kauserali Hafizji on 29/08/12.
// Copyright (c) 2012 Appacitive Software Pvt. Ltd. All rights reserved.
//
@interface APError : NSError
@property (nonatomic, strong) NSString *referenceId;
@property (nonatomic, strong) NSString *version;
@property (nonatomic, strong) NSString *statusCode;
@end
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkFreeSurferAsciiMeshIO_h
#define itkFreeSurferAsciiMeshIO_h
#include "ITKIOMeshExport.h"
#include "itkMeshIOBase.h"
#include <fstream>
namespace itk
{
/** \class FreeSurferAsciiMeshIO
* \brief This class defines how to read and write freesurfer ASCII surface format.
* To use IO factory, define the suffix as *.fsa.
* \ingroup IOFilters
* \ingroup ITKIOMesh
*/
class ITKIOMesh_EXPORT FreeSurferAsciiMeshIO:public MeshIOBase
{
public:
/** Standard class typedefs. */
typedef FreeSurferAsciiMeshIO Self;
typedef MeshIOBase Superclass;
typedef SmartPointer< const Self > ConstPointer;
typedef SmartPointer< Self > Pointer;
typedef Superclass::SizeValueType SizeValueType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(FreeSurferAsciiMeshIO, MeshIOBase);
/*-------- This part of the interfaces deals with reading data. ----- */
/** Determine if the file can be read with this MeshIO implementation.
* \param FileNameToRead The name of the file to test for reading.
* \post Sets classes MeshIOBase::m_FileName variable to be FileNameToWrite
* \return Returns true if this MeshIO can read the file specified.
*/
virtual bool CanReadFile(const char *FileNameToRead) ITK_OVERRIDE;
/** Set the spacing and dimension information for the set filename. */
virtual void ReadMeshInformation() ITK_OVERRIDE;
/** Reads the data from disk into the memory buffer provided. */
virtual void ReadPoints(void *buffer) ITK_OVERRIDE;
virtual void ReadCells(void *buffer) ITK_OVERRIDE;
virtual void ReadPointData(void *buffer) ITK_OVERRIDE;
virtual void ReadCellData(void *buffer) ITK_OVERRIDE;
/*-------- This part of the interfaces deals with writing data. ----- */
/** Determine if the file can be written with this MeshIO implementation.
* \param FileNameToWrite The name of the file to test for writing.
* \post Sets classes MeshIOBase::m_FileName variable to be FileNameToWrite
* \return Returns true if this MeshIO can write the file specified.
*/
virtual bool CanWriteFile(const char *FileNameToWrite) ITK_OVERRIDE;
/** Set the spacing and dimension information for the set filename. */
virtual void WriteMeshInformation() ITK_OVERRIDE;
/** Writes the data to disk from the memory buffer provided. Make sure
* that the IORegions has been set properly. */
virtual void WritePoints(void *buffer) ITK_OVERRIDE;
virtual void WriteCells(void *buffer) ITK_OVERRIDE;
virtual void WritePointData(void *buffer) ITK_OVERRIDE;
virtual void WriteCellData(void *buffer) ITK_OVERRIDE;
virtual void Write() ITK_OVERRIDE;
protected:
/** Write points to output stream */
template< typename T >
void WritePoints(T *buffer, std::ofstream & outputFile, T label = itk::NumericTraits< T >::ZeroValue())
{
outputFile.precision(6);
SizeValueType index = 0;
for ( SizeValueType ii = 0; ii < this->m_NumberOfPoints; ii++ )
{
for ( unsigned int jj = 0; jj < this->m_PointDimension; jj++ )
{
outputFile << std::fixed << buffer[index++] << " ";
}
outputFile << label << '\n';
}
}
template< typename T >
void WriteCells(T *buffer, std::ofstream & outputFile, T label = itk::NumericTraits< T >::ZeroValue())
{
const unsigned int numberOfCellPoints = 3;
SizeValueType index = 0;
T *data = new T[this->m_NumberOfCells * numberOfCellPoints];
ReadCellsBuffer(buffer, data);
for ( SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
{
for ( unsigned int jj = 0; jj < numberOfCellPoints; jj++ )
{
outputFile << data[index++] << " ";
}
outputFile << label << '\n';
}
delete[] data;
}
/** Read cells from a data buffer, used when writting cells */
template< typename TInput, typename TOutput >
void ReadCellsBuffer(TInput *input, TOutput *output)
{
if ( input && output )
{
for ( SizeValueType ii = 0; ii < this->m_NumberOfCells; ii++ )
{
for ( unsigned int jj = 0; jj < 3; jj++ )
{
/** point identifiers start from the third elements, first element is cellType, the second is numberOfPoints */
output[ii * 3 + jj] = static_cast< TOutput >( input[5 * ii + jj + 2] );
}
}
}
}
protected:
FreeSurferAsciiMeshIO();
virtual ~FreeSurferAsciiMeshIO(){}
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
void OpenFile();
void CloseFile();
private:
FreeSurferAsciiMeshIO(const Self &) ITK_DELETE_FUNCTION;
void operator=(const Self &) ITK_DELETE_FUNCTION;
std::ifstream m_InputFile;
};
} // end namespace itk
#endif
|
/* $NetBSD: pat.h,v 1.2 2014/03/18 18:20:42 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Taylor R. Campbell.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ASM_PAT_H_
#define _ASM_PAT_H_
#endif /* _ASM_PAT_H_ */
|
/*
* Copyright (c) 2019 Brett Witherspoon
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ti_cc13xx_cc26xx_pinmux
#include <device.h>
#include <errno.h>
#include <sys/__assert.h>
#include <drivers/pinmux.h>
#include <driverlib/ioc.h>
static int pinmux_cc13xx_cc26xx_set(const struct device *dev, uint32_t pin,
uint32_t func)
{
ARG_UNUSED(dev);
__ASSERT_NO_MSG(pin < NUM_IO_MAX);
__ASSERT_NO_MSG(func < NUM_IO_PORTS);
IOCIOPortIdSet(pin, func);
return 0;
}
static int pinmux_cc13xx_cc26xx_get(const struct device *dev, uint32_t pin,
uint32_t *func)
{
ARG_UNUSED(dev);
__ASSERT_NO_MSG(pin < NUM_IO_MAX);
*func = IOCPortConfigureGet(pin) & IOC_IOCFG0_PORT_ID_M;
return 0;
}
static int pinmux_cc13xx_cc26xx_pullup(const struct device *dev, uint32_t pin,
uint8_t func)
{
ARG_UNUSED(dev);
__ASSERT_NO_MSG(pin < NUM_IO_MAX);
switch (func) {
case PINMUX_PULLUP_ENABLE:
IOCIOPortPullSet(pin, IOC_IOPULL_UP);
return 0;
case PINMUX_PULLUP_DISABLE:
IOCIOPortPullSet(pin, IOC_NO_IOPULL);
return 0;
}
return -EINVAL;
}
static int pinmux_cc13xx_cc26xx_input(const struct device *dev, uint32_t pin,
uint8_t func)
{
ARG_UNUSED(dev);
__ASSERT_NO_MSG(pin < NUM_IO_MAX);
switch (func) {
case PINMUX_INPUT_ENABLED:
IOCIOInputSet(pin, IOC_INPUT_ENABLE);
return 0;
case PINMUX_OUTPUT_ENABLED:
IOCIOInputSet(pin, IOC_INPUT_DISABLE);
return 0;
}
return -EINVAL;
}
static int pinmux_cc13xx_cc26xx_init(const struct device *dev)
{
ARG_UNUSED(dev);
return 0;
}
static const struct pinmux_driver_api pinmux_cc13xx_cc26xx_driver_api = {
.set = pinmux_cc13xx_cc26xx_set,
.get = pinmux_cc13xx_cc26xx_get,
.pullup = pinmux_cc13xx_cc26xx_pullup,
.input = pinmux_cc13xx_cc26xx_input,
};
DEVICE_DT_INST_DEFINE(0, &pinmux_cc13xx_cc26xx_init, device_pm_control_nop,
NULL, NULL, PRE_KERNEL_1,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&pinmux_cc13xx_cc26xx_driver_api);
|
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2004-2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "freerds.h"
#include <winpr/pipe.h>
#include <winpr/path.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/sspicli.h>
#include <winpr/environment.h>
#include <freerdp/freerdp.h>
void* freerds_client_thread(void* arg)
{
int fps;
DWORD status;
DWORD nCount;
HANDLE events[8];
HANDLE PackTimer;
LARGE_INTEGER due;
rdsModuleConnector* connector = (rdsModuleConnector*) arg;
fps = connector->fps;
PackTimer = CreateWaitableTimer(NULL, TRUE, NULL);
due.QuadPart = 0;
SetWaitableTimer(PackTimer, &due, 1000 / fps, NULL, NULL, 0);
nCount = 0;
events[nCount++] = PackTimer;
events[nCount++] = connector->StopEvent;
events[nCount++] = connector->hClientPipe;
while (1)
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
if (WaitForSingleObject(connector->StopEvent, 0) == WAIT_OBJECT_0)
{
break;
}
if (WaitForSingleObject(connector->hClientPipe, 0) == WAIT_OBJECT_0)
{
if (freerds_transport_receive(connector) < 0)
break;
}
if (status == WAIT_OBJECT_0)
{
freerds_message_server_queue_pack(connector);
}
if (connector->fps != fps)
{
fps = connector->fps;
due.QuadPart = 0;
SetWaitableTimer(PackTimer, &due, 1000 / fps, NULL, NULL, 0);
}
}
CloseHandle(PackTimer);
return NULL;
}
int freerds_client_get_event_handles(rdsModuleConnector* connector, HANDLE* events, DWORD* nCount)
{
if (connector)
{
if (connector->ServerQueue)
{
events[*nCount] = MessageQueue_Event(connector->ServerQueue);
(*nCount)++;
}
}
return 0;
}
int freerds_client_check_event_handles(rdsModuleConnector* connector)
{
int status = 0;
if (!connector)
return 0;
while (WaitForSingleObject(MessageQueue_Event(connector->ServerQueue), 0) == WAIT_OBJECT_0)
{
status = freerds_message_server_queue_process_pending_messages(connector);
}
return status;
}
|
/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief ARCv2 system fatal error handler
*
* This module provides the _SysFatalErrorHandler() routine for ARCv2 BSPs.
*/
#include <nanokernel.h>
#include <toolchain.h>
#include <sections.h>
#ifdef CONFIG_PRINTK
#include <misc/printk.h>
#define PRINTK(...) printk(__VA_ARGS__)
#else
#define PRINTK(...)
#endif
#ifdef CONFIG_MICROKERNEL
extern void _TaskAbort(void);
static inline void nonEssentialTaskAbort(void)
{
PRINTK("Fatal fault in task ! Aborting task.\n");
_TaskAbort();
}
#define NON_ESSENTIAL_TASK_ABORT() nonEssentialTaskAbort()
#else
#define NON_ESSENTIAL_TASK_ABORT() \
do {/* nothing */ \
} while ((0))
#endif
/**
*
* @brief Fatal error handler
*
* This routine implements the corrective action to be taken when the system
* detects a fatal error.
*
* This sample implementation attempts to abort the current thread and allow
* the system to continue executing, which may permit the system to continue
* functioning with degraded capabilities.
*
* System designers may wish to enhance or substitute this sample
* implementation to take other actions, such as logging error (or debug)
* information to a persistent repository and/or rebooting the system.
*
* @param reason the fatal error reason
* @param pEsf pointer to exception stack frame
*
* @return N/A
*/
void _SysFatalErrorHandler(unsigned int reason, const NANO_ESF * pEsf)
{
nano_context_type_t curCtx = sys_execution_context_type_get();
ARG_UNUSED(reason);
ARG_UNUSED(pEsf);
if ((curCtx == NANO_CTX_ISR) || _is_thread_essential(NULL)) {
PRINTK("Fatal fault in %s ! Spinning...\n",
NANO_CTX_ISR == curCtx
? "ISR"
: NANO_CTX_FIBER == curCtx ? "essential fiber"
: "essential task");
for (;;)
; /* spin forever */
}
if (NANO_CTX_FIBER == curCtx) {
PRINTK("Fatal fault in fiber ! Aborting fiber.\n");
fiber_abort();
return;
}
NON_ESSENTIAL_TASK_ABORT();
}
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 1998-2018. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
#ifndef _DB_TREE_H
#define _DB_TREE_H
#include "erl_db_util.h"
typedef struct tree_db_term {
struct tree_db_term *left, *right; /* left and right child */
int balance; /* tree balancing value */
DbTerm dbterm; /* The actual term */
} TreeDbTerm;
typedef struct {
Uint pos; /* Current position on stack */
Uint slot; /* "Slot number" of top element or 0 if not set */
TreeDbTerm** array; /* The stack */
} DbTreeStack;
typedef struct db_table_tree {
DbTableCommon common;
/* Tree-specific fields */
TreeDbTerm *root; /* The tree root */
Uint deletion; /* Being deleted */
erts_atomic_t is_stack_busy;
DbTreeStack static_stack;
} DbTableTree;
/*
** Function prototypes, looks the same (except the suffix) for all
** table types. The process is always an [in out] parameter.
*/
void db_initialize_tree(void);
int db_create_tree(Process *p, DbTable *tbl);
void
erts_db_foreach_thr_prgr_offheap_tree(void (*func)(ErlOffHeap *, void *),
void *arg);
#endif /* _DB_TREE_H */
|
/*! @file OIDAuthState+Mac.h
@brief AppAuth iOS SDK
@copyright
Copyright 2016 Google Inc. All Rights Reserved.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <TargetConditionals.h>
#if TARGET_OS_OSX
#import <AppKit/AppKit.h>
#import "OIDAuthState.h"
NS_ASSUME_NONNULL_BEGIN
/*! @brief macOS specific convenience methods for @c OIDAuthState.
*/
@interface OIDAuthState (Mac)
/*! @brief Convenience method to create a @c OIDAuthState by presenting an authorization request
and performing the authorization code exchange in the case of code flow requests. For
the hybrid flow, the caller should validate the id_token and c_hash, then perform the token
request (@c OIDAuthorizationService.performTokenRequest:callback:)
and update the OIDAuthState with the results (@c
OIDAuthState.updateWithTokenResponse:error:).
@param authorizationRequest The authorization request to present.
@param presentingWindow The window to present the authentication flow.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
@discussion This method adopts ASWebAuthenticationSession for macOS 10.15 and above or the default browser otherwise.
*/
+ (id<OIDExternalUserAgentSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
presentingWindow:(NSWindow *)presentingWindow
callback:(OIDAuthStateAuthorizationCallback)callback;
/*! @param authorizationRequest The authorization request to present.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
@discussion This method uses the default browser to present the authentication flow.
*/
+ (id<OIDExternalUserAgentSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
callback:(OIDAuthStateAuthorizationCallback)callback
__deprecated_msg("For macOS 10.15 and above please use "
"authStateByPresentingAuthorizationRequest:presentingWindow:callback:");
@end
NS_ASSUME_NONNULL_END
#endif // TARGET_OS_OSX
|
//
// OKGKScoreWrapper.h
// OpenKit
//
// Created by Suneet Shah on 6/13/13.
// Copyright (c) 2013 OpenKit. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>
#import "OKScoreProtocol.h"
@interface OKGKScoreWrapper : NSObject<OKScoreProtocol>
@property (nonatomic, strong) GKScore *score;
@property (nonatomic, strong) GKPlayer *player;
// Rank is a read only property of GKScore, and since we are showing social scores ranked against each other, we need a way to store a local rank
@property (nonatomic, strong) NSString *explicitlySetRank;
-(void)setRank:(NSInteger)rank;
@end
|
//
// KYTopic.h
// QiPa
//
// Created by 欧阳凯 on 15/12/3.
// Copyright © 2015年 kaylio. All rights reserved.
//
#import <Foundation/Foundation.h>
// 帖子分类
typedef enum : NSUInteger {
KYTopicTypeAll = 1, // 全部
KYTopicTypePicture = 10, // 图片
KYTopicTypeWord = 29, /** 段子 */
KYTopicTypeVoice = 31, /** 音频 */
KYTopicTypeVideo = 41 /** 视频 */
} KYTopicType;
@interface KYTopic : NSObject
/** 发布时间 */
@property (nonatomic, copy) NSString *created_at;
/** 小图 */
@property (nonatomic, copy) NSString *small_image;
/** 中图 */
@property (nonatomic, copy) NSString *middle_image;
/** 大图 */
@property (nonatomic, copy) NSString *large_image;
/** 是否为gif */
@property (nonatomic, assign) BOOL is_gif;
/** 声音时长 */
@property (nonatomic, copy) NSString *voicetime;
@property (nonatomic, copy) NSString *videotime;
/** 声音大小 */
@property (nonatomic, copy) NSString *voicelength;
/** 播放次数 */
@property (nonatomic, assign) NSInteger playcount;
/** 踩数量 */
@property (nonatomic, copy) NSString *cai;
/** 顶数量 */
@property (nonatomic, copy) NSString *ding;
/** 评论次数 */
@property (nonatomic, copy) NSString *comment;
/** 转发次数 */
@property (nonatomic, copy) NSString *repost;
/** 用户的头像 */
@property (nonatomic, copy) NSString *profile_image;
/** 文字内容 */
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) NSInteger width;
@property (nonatomic, assign) NSInteger height;
@property (nonatomic, assign) KYTopicType type;
/***** 额外增加的属性 ******/
/** cell的高度 */
@property (nonatomic, assign) CGFloat cellHeight;
/** 中间图片的frame */
@property (nonatomic, assign) CGRect pictureFrame;
/** 是否为长图(大图) */
@property (nonatomic, assign, getter=isBigPicture) BOOL bigPicture;
/** 最热评论 */
//@property (nonatomic, strong) XMGComment *topComment;
//@property (nonatomic, strong) NSArray *top_cmt;
//@property (nonatomic, copy) NSString *bimageuri;
//
//@property (nonatomic, copy) NSString *theme_type;
//
//@property (nonatomic, copy) NSString *hate;
//
//@property (nonatomic, copy) NSString *passtime;
//
//@property (nonatomic, copy) NSString *tag;
//
//@property (nonatomic, copy) NSString *cdn_img;
//
//@property (nonatomic, copy) NSString *theme_name;
//
//@property (nonatomic, copy) NSString *create_time;
//
//
//@property (nonatomic, strong) NSArray *themes;
//
//
//@property (nonatomic, copy) NSString *status;
//
//
//@property (nonatomic, copy) NSString *bookmark;
//
//@property (nonatomic, copy) NSString *screen_name;
//
//
//@property (nonatomic, copy) NSString *love;
//
//@property (nonatomic, copy) NSString *user_id;
//
//@property (nonatomic, copy) NSString *theme_id;
//
//@property (nonatomic, copy) NSString *original_pid;
//
//@property (nonatomic, copy) NSString *image_small;
//
//@property (nonatomic, copy) NSString *weixin_url;
//
//@property (nonatomic, copy) NSString *voiceuri;
//
//@property (nonatomic, copy) NSString *videouri;
@end
|
/*
Copyright (c) 2007-2009 Cyrus Daboo. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// CSearchCriteriaContainer.h
#ifndef __CSEARCHCRITERIACONTAINER__MULBERRY__
#define __CSEARCHCRITERIACONTAINER__MULBERRY__
#include "CBroadcaster.h"
#include "CListener.h"
#include "CWndAligner.h"
#include "CGrayBackground.h"
#include "CFilterItem.h"
// Classes
class CSearchCriteria;
class CSearchItem;
class CCriteriaBase;
typedef std::vector<CCriteriaBase*> CCriteriaBaseList;
class CSearchCriteriaContainer : public CWnd, public CBroadcaster, public CListener, public CWndAligner
{
friend class CSearchBase;
friend class CSearchCriteria;
friend class CSearchCriteriaLocal;
friend class CSearchCriteriaSIEVE;
public:
// Messages for broadcast
enum
{
eBroadcast_SearchCriteriaContainerResized = 'rsiz'
};
CSearchCriteriaContainer();
virtual ~CSearchCriteriaContainer();
virtual BOOL Create(const CRect& rect, CWnd* pParentWnd);
unsigned long GetCount() const
{ return mCriteriaItems.size(); }
void SetTopLevel()
{ mTopLevel = true; }
void SetRules(bool rules)
{ mRules = rules; }
bool SetInitialFocus();
protected:
CStatic mBorder;
CButton mMoreBtn;
CButton mFewerBtn;
CButton mClearBtn;
bool mTopLevel;
bool mRules;
CFilterItem::EType mFilterType; // Used to toggle local/SIEVE switches
virtual void ListenTo_Message(long msg, void* param); // Respond to list changes
void RecalcLayout();
// message handlers
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMore();
afx_msg void OnFewer();
afx_msg void OnClear();
void InitGroup(CFilterItem::EType type, const CSearchItem* spec);
void InitCriteria(const CSearchItem* spec = NULL);
void AddCriteria(const CSearchItem* spec = NULL, bool use_or = true);
void RemoveCriteria();
void RemoveAllCriteria();
void SelectNextCriteria(CSearchCriteria* previous);
CSearchItem* ConstructSearch() const;
private:
CCriteriaBaseList mCriteriaItems;
protected:
DECLARE_MESSAGE_MAP()
};
#endif
|
//
// Created by Jiang Lu on 14-4-1.
// Copyright (C) 2013-2014, Infthink (Beijing) Technology Co., Ltd.
//
#import <Foundation/Foundation.h>
/**
* A category that adds some convenience methods to NSDictionary for setting and safely looking up
* values of various types. These methods are particularly useful for getting and setting fields of
* JSON data objects.
*
* @ingroup Utilities
*/
@interface NSDictionary (MSFKTypedValueLookup)
/**
* Looks up an NSString value for a key, with a given fallback value.
*
* @param key The key.
* @param defaultValue The default value to return if the key is not found or if its value is not
* an NSString.
* @return The value of the key, if it was found and was an NSString; otherwise the default value.
*/
- (NSString *)msfk_stringForKey:(NSString *)key withDefaultValue:(NSString *)defaultValue;
/**
* Looks up an NSString value for a key, with a fallback value of <code>nil</code>.
*
* @param key The key.
* @return The value of the key, if found it was found and was an NSString; otherwise
* <code>nil</code>.
*/
- (NSString *)msfk_stringForKey:(NSString *)key;
/**
* Looks up an NSInteger value for a key, with a given fallback value.
*
* @param key The key.
* @param defaultValue The default value to return if the key is not found or if its value is not
* an NSNumber.
* @return The value of the key, if it was found and was an NSNumber; otherwise the default value.
*/
- (NSInteger)msfk_integerForKey:(NSString *)key withDefaultValue:(NSInteger)defaultValue;
/**
* Looks up an NSUInteger value for a key, with a given fallback value.
*
* @param key The key.
* @param defaultValue The default value to return if the key is not found or if its value is not
* an NSNumber.
* @return The value of the key, if it was found and was an NSNumber; otherwise the default value.
*/
- (NSUInteger)msfk_uintegerForKey:(NSString *)key withDefaultValue:(NSUInteger)defaultValue;
/**
* Looks up an NSInteger value for a key, with a fallback value of <code>0</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSNumber; otherwise <code>0</code>.
*/
- (NSInteger)msfk_integerForKey:(NSString *)key;
/**
* Looks up an NSUInteger value for a key, with a fallback value of <code>0</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSNumber; otherwise <code>0</code>.
*/
- (NSUInteger)msfk_uintegerForKey:(NSString *)key;
/**
* Looks up a double value for a key, with a given fallback value.
*
* @param key The key.
* @param defaultValue The default value to return if the key is not found or if its value is not
* an NSNumber.
* @return The value of the key, if it was found and was an NSNumber; otherwise the default value.
*/
- (double)msfk_doubleForKey:(NSString *)key withDefaultValue:(double)defaultValue;
/**
* Looks up a double value for a key, with a fallback value of <code>0.0</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSNumber; otherwise <code>0.0</code>.
*/
- (double)msfk_doubleForKey:(NSString *)key;
/**
* Looks up a BOOL value for a key, with a given fallback value.
*
* @param key The key.
* @param defaultValue The default value to return if the key is not found or if its value is not
* an NSNumber.
* @return The value of the key, if it was found and was an NSNumber; otherwise the default value.
*/
- (BOOL)msfk_boolForKey:(NSString *)key withDefaultValue:(BOOL)defaultValue;
/**
* Looks up a BOOL value for a key, with a fallback value of <code>NO</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSNumber; otherwise <code>NO</code>.
*/
- (BOOL)msfk_boolForKey:(NSString *)key;
/**
* Looks up an NSDictionary value for a key, with a fallback value of <code>nil</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSDictionary; otherwise
* <code>nil</code>.
*/
- (NSDictionary *)msfk_dictionaryForKey:(NSString *)key;
/**
* Looks up an NSArray value for a key, with a fallback value of <code>nil</code>.
*
* @param key The key.
* @return The value of the key, if it was found and was an NSArray; otherwise
* <code>nil</code>.
*/
- (NSArray *)msfk_arrayForKey:(NSString *)key;
/**
* Sets an NSString value for a key.
*
* @param value The value.
* @param key The key.
*/
- (void)msfk_setStringValue:(NSString *)value forKey:(NSString *)key;
/**
* Sets an NSInteger value for a key.
*
* @param value The value.
* @param key The key.
*/
- (void)msfk_setIntegerValue:(NSInteger)value forKey:(NSString *)key;
/**
* Sets an NSUInteger value for a key.
*
* @param value The value.
* @param key The key.
*/
- (void)msfk_setUIntegerValue:(NSUInteger)value forKey:(NSString *)key;
/**
* Sets a double value for a key.
*
* @param value The value.
* @param key The key.
*/
- (void)msfk_setDoubleValue:(double)value forKey:(NSString *)key;
/**
* Sets a BOOL value for a key.
*
* @param value The value.
* @param key The key.
*/
- (void)msfk_setBoolValue:(BOOL)value forKey:(NSString *)key;
@end
|
/*
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include <string>
#include "util/serializer.h"
#include "kernel/declaration.h"
#include "kernel/inductive/inductive.h"
namespace lean {
serializer & operator<<(serializer & s, level const & l);
level read_level(deserializer & d);
inline deserializer & operator>>(deserializer & d, level & l) { l = read_level(d); return d; }
serializer & operator<<(serializer & s, levels const & ls);
levels read_levels(deserializer & d);
serializer & operator<<(serializer & s, level_param_names const & ps);
level_param_names read_level_params(deserializer & d);
inline deserializer & operator>>(deserializer & d, level_param_names & ps) { ps = read_level_params(d); return d; }
serializer & operator<<(serializer & s, expr const & e);
expr read_expr(deserializer & d);
inline deserializer & operator>>(deserializer & d, expr & e) { e = read_expr(d); return d; }
serializer & operator<<(serializer & s, declaration const & d);
declaration read_declaration(deserializer & d);
typedef std::tuple<level_param_names, unsigned, list<inductive::inductive_decl>> inductive_decls;
serializer & operator<<(serializer & s, inductive_decls const & ds);
inductive_decls read_inductive_decls(deserializer & d);
void register_macro_deserializer(std::string const & k, macro_definition_cell::reader rd);
void initialize_kernel_serializer();
void finalize_kernel_serializer();
}
|
#ifndef ALI_ONS_ONS_TOPIC_SEARCH_TYPESH
#define ALI_ONS_ONS_TOPIC_SEARCH_TYPESH
#include <stdio.h>
#include <string>
#include <vector>
namespace aliyun {
struct OnsOnsTopicSearchRequestType {
std::string ons_region_id;
std::string ons_platform;
std::string prevent_cache;
std::string search;
};
struct OnsOnsTopicSearchPublishInfoDoType {
long id;
int channel_id;
std::string channel_name;
std::string region_id;
std::string region_name;
std::string topic;
std::string owner;
int relation;
std::string relation_name;
int status;
std::string status_name;
int appkey;
long create_time;
long update_time;
std::string remark;
};
struct OnsOnsTopicSearchResponseType {
std::vector<OnsOnsTopicSearchPublishInfoDoType> data;
std::string help_url;
};
} // end namespace
#endif
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <assert.h>
#include "syscfg/syscfg.h"
#include "hal/hal_timer.h"
#include "os/os_cputime.h"
static void
cmac_periph_create_timers(void)
{
int rc;
(void)rc;
#if MYNEWT_VAL(TIMER_0)
rc = hal_timer_init(0, NULL);
assert(rc == 0);
#endif
#if MYNEWT_VAL(OS_CPUTIME_TIMER_NUM) >= 0
rc = os_cputime_init(MYNEWT_VAL(OS_CPUTIME_FREQ));
assert(rc == 0);
#endif
}
void
cmac_periph_create(void)
{
cmac_periph_create_timers();
}
|
//
// SFFieldGroupManager.h
// SFiOSKit
//
// Created by yangzexin on 11/6/13.
// Copyright (c) 2013 yangzexin. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SFFieldGroupManager : NSObject
@property (nonatomic, readonly) NSArray *fields;
@property (nonatomic, assign) BOOL setReturnKeyAutomatically;
@property (nonatomic, assign, readonly) CGFloat keyboardHeight;
@property (nonatomic, assign) CGFloat keyboardInset;
@property (nonatomic, assign) id<UITextFieldDelegate> textFieldDelegate;
@property (nonatomic, copy) void(^fieldPositor)(id field);
@property (nonatomic, copy) void(^doneHandler)();
@property (nonatomic, assign) UIView *fieldsContainView;
- (void)resignFirstResponder;
- (void)becomeFirstResponder;
- (BOOL)isFirstResponder;
- (void)addTextField:(UITextField *)textField;
- (void)addTextField:(UITextField *)textField setDelegate:(BOOL)setDelegate;
- (void)addTextView:(UITextView *)textView;
- (void)removeItem:(id)item;
- (void)fieldWillBeginEditing:(id)field;
- (void)fieldDidEndEditing:(id)field;
- (void)fieldWillReturn:(id)field;
@end
|
// Protocol Buffers for Swift
//
// Copyright 2014 Alexey Khohklov(AlexeyXo).
// Copyright 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef swift_MESSAGE_FIELD_H
#define swift_MESSAGE_FIELD_H
#include <map>
#include <string>
#include "swift_field.h"
namespace google {
namespace protobuf {
namespace compiler {
namespace swift {
class MessageFieldGenerator : public FieldGenerator {
public:
explicit MessageFieldGenerator(const FieldDescriptor* descriptor);
~MessageFieldGenerator();
void GenerateExtensionSource(io::Printer* printer) const;
void GenerateSynthesizeSource(io::Printer* printer) const;
void GenerateInitializationSource(io::Printer* printer) const;
void GenerateMembersSource(io::Printer* printer) const;
void GenerateBuilderMembersSource(io::Printer* printer) const;
void GenerateMergingCodeSource(io::Printer* printer) const;
void GenerateBuildingCodeSource(io::Printer* printer) const;
void GenerateParsingCodeSource(io::Printer* printer) const;
void GenerateSerializationCodeSource(io::Printer* printer) const;
void GenerateSerializedSizeCodeSource(io::Printer* printer) const;
void GenerateDescriptionCodeSource(io::Printer* printer) const;
void GenerateIsEqualCodeSource(io::Printer* printer) const;
void GenerateHashCodeSource(io::Printer* printer) const;
string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
};
class RepeatedMessageFieldGenerator : public FieldGenerator {
public:
explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor);
~RepeatedMessageFieldGenerator();
void GenerateExtensionSource(io::Printer* printer) const;
void GenerateSynthesizeSource(io::Printer* printer) const;
void GenerateInitializationSource(io::Printer* printer) const;
void GenerateMembersSource(io::Printer* printer) const;
void GenerateBuilderMembersSource(io::Printer* printer) const;
void GenerateMergingCodeSource(io::Printer* printer) const;
void GenerateBuildingCodeSource(io::Printer* printer) const;
void GenerateParsingCodeSource(io::Printer* printer) const;
void GenerateSerializationCodeSource(io::Printer* printer) const;
void GenerateSerializedSizeCodeSource(io::Printer* printer) const;
void GenerateDescriptionCodeSource(io::Printer* printer) const;
void GenerateIsEqualCodeSource(io::Printer* printer) const;
void GenerateHashCodeSource(io::Printer* printer) const;
string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
};
} // namespace swift
} // namespace compiler
} // namespace protobuf
} // namespace google
#endif // swift_MESSAGE_FIELD_H
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/iotanalytics/IoTAnalytics_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/iotanalytics/model/BatchPutMessageErrorEntry.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace IoTAnalytics
{
namespace Model
{
class AWS_IOTANALYTICS_API BatchPutMessageResult
{
public:
BatchPutMessageResult();
BatchPutMessageResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
BatchPutMessageResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline const Aws::Vector<BatchPutMessageErrorEntry>& GetBatchPutMessageErrorEntries() const{ return m_batchPutMessageErrorEntries; }
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline void SetBatchPutMessageErrorEntries(const Aws::Vector<BatchPutMessageErrorEntry>& value) { m_batchPutMessageErrorEntries = value; }
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline void SetBatchPutMessageErrorEntries(Aws::Vector<BatchPutMessageErrorEntry>&& value) { m_batchPutMessageErrorEntries = std::move(value); }
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline BatchPutMessageResult& WithBatchPutMessageErrorEntries(const Aws::Vector<BatchPutMessageErrorEntry>& value) { SetBatchPutMessageErrorEntries(value); return *this;}
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline BatchPutMessageResult& WithBatchPutMessageErrorEntries(Aws::Vector<BatchPutMessageErrorEntry>&& value) { SetBatchPutMessageErrorEntries(std::move(value)); return *this;}
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline BatchPutMessageResult& AddBatchPutMessageErrorEntries(const BatchPutMessageErrorEntry& value) { m_batchPutMessageErrorEntries.push_back(value); return *this; }
/**
* <p>A list of any errors encountered when sending the messages to the
* channel.</p>
*/
inline BatchPutMessageResult& AddBatchPutMessageErrorEntries(BatchPutMessageErrorEntry&& value) { m_batchPutMessageErrorEntries.push_back(std::move(value)); return *this; }
private:
Aws::Vector<BatchPutMessageErrorEntry> m_batchPutMessageErrorEntries;
};
} // namespace Model
} // namespace IoTAnalytics
} // namespace Aws
|
#undef HAVE_GETADDRINFO
|
/* Boolean object interface */
#ifndef Py_BOOLOBJECT_H
#define Py_BOOLOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef PyIntObject PyBoolObject;
PyAPI_DATA(PyTypeObject) PyBool_Type;
#define PyBool_Check(x) ((x)->ob_type == &PyBool_Type)
/* Py_False and Py_True are the only two bools in existence.
Don't forget to apply Py_INCREF() when returning either!!! */
/* Don't use these directly */
PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
/* Use these macros */
#define Py_False ((PyObject *) &_Py_ZeroStruct)
#define Py_True ((PyObject *) &_Py_TrueStruct)
/* Macros for returning Py_True or Py_False, respectively */
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
/* Function to return a bool from a C long */
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
#ifdef __cplusplus
}
#endif
#endif /* !Py_BOOLOBJECT_H */
|
/*
Copyright (c) 2007-2009 Cyrus Daboo. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// CSubPanelController
// Class that implements a tab control and manages its panels as well
#ifndef __CSUBPANELCONTROLLER__MULBERRY__
#define __CSUBPANELCONTROLLER__MULBERRY__
class CTabPanel;
class CSubPanelController : public CWnd
{
public:
CSubPanelController();
~CSubPanelController();
// Add/removing pages
virtual unsigned long AddPanel(CTabPanel* aPanel);
virtual void RemovePanel(CTabPanel* aPanel);
virtual void RemovePanel(unsigned long index);
virtual long GetCurrentIndex() const
{ return mCurrentIndex; }
virtual unsigned long GetPanelCount() const
{ return mPanels.size(); }
virtual CTabPanel* GetCurrentPanel()
{ return mCurrentPanel; }
// Managing data in panels
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void SetContent(void* data); // Set data
virtual void UpdateContent(void* data); // Force update of data
virtual void SetPanelContent(void* data); // Set data
virtual void UpdatePanelContent(void* data); // Force update of data
// Switching between panels
virtual void SetPanel(long index); // Force update of display panel
protected:
typedef std::vector<CTabPanel*> CTabPanelList;
CTabPanelList mPanels;
CTabPanel* mCurrentPanel;
long mCurrentIndex;
// Panel management
virtual void InstallPanel(CTabPanel* aPanel);
virtual void DestroyPanel(CTabPanel* aPanel);
};
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Fluent Bit
* ==========
* Copyright (C) 2015-2022 The Fluent Bit Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include <fluent-bit/flb_utils.h>
#include <fluent-bit/flb_input_plugin.h>
#include "fw.h"
#include "fw_conn.h"
#include "fw_config.h"
struct flb_in_fw_config *fw_config_init(struct flb_input_instance *i_ins)
{
char tmp[16];
int ret = -1;
const char *p;
struct flb_in_fw_config *config;
config = flb_calloc(1, sizeof(struct flb_in_fw_config));
if (!config) {
flb_errno();
return NULL;
}
ret = flb_input_config_map_set(i_ins, (void *)config);
if (ret == -1) {
flb_plg_error(i_ins, "config map set error");
flb_free(config);
return NULL;
}
p = flb_input_get_property("unix_path", i_ins);
if (p == NULL) {
/* Listen interface (if not set, defaults to 0.0.0.0:24224) */
flb_input_net_default_listener("0.0.0.0", 24224, i_ins);
config->listen = i_ins->host.listen;
snprintf(tmp, sizeof(tmp) - 1, "%d", i_ins->host.port);
config->tcp_port = flb_strdup(tmp);
}
if (!config->unix_path) {
flb_debug("[in_fw] Listen='%s' TCP_Port=%s",
config->listen, config->tcp_port);
}
return config;
}
int fw_config_destroy(struct flb_in_fw_config *config)
{
if (config->unix_path) {
unlink(config->unix_path);
}
else {
flb_free(config->tcp_port);
}
flb_free(config);
return 0;
}
|
/*=========================================================================
Library: TubeTK
Copyright 2010 Kitware Inc. 28 Corporate Drive,
Clifton Park, NY, 12065, USA.
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef __tubeSegmentUsingOtsuThreshold_h
#define __tubeSegmentUsingOtsuThreshold_h
// ITK includes
#include <itkObject.h>
#include <itkOtsuThresholdImageFilter.h>
// TubeTK includes
#include "tubeWrappingMacros.h"
namespace tube
{
/** \class SegmentUsingOtsuThreshold
*
* \ingroup TubeTKITK
*/
template< class TInputPixel, unsigned int Dimension,
class TMaskPixel = unsigned char >
class SegmentUsingOtsuThreshold:
public itk::Object
{
public:
/** Standard class typedefs. */
typedef SegmentUsingOtsuThreshold Self;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
typedef itk::Image< TInputPixel, Dimension > InputImageType;
typedef itk::Image< TMaskPixel, Dimension > MaskImageType;
typedef MaskImageType OutputImageType;
typedef itk::OtsuThresholdImageFilter< InputImageType,
OutputImageType > FilterType;
/** Method for creation through the object factory. */
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( SegmentUsingOtsuThreshold, Object );
/** Set/Get mask image */
tubeWrapSetConstObjectMacro( MaskImage, MaskImageType, Filter );
tubeWrapGetConstObjectMacro( MaskImage, MaskImageType, Filter );
/** Set/Get mask value */
tubeWrapSetMacro( MaskValue, TInputPixel, Filter );
tubeWrapGetMacro( MaskValue, TInputPixel, Filter );
/** Set/Get input image */
tubeWrapSetConstObjectMacro( Input, InputImageType, Filter );
tubeWrapGetConstObjectMacro( Input, InputImageType, Filter );
/** Runs the thresholding algorithm */
tubeWrapUpdateMacro( Filter );
/** Get output segmentation mask */
tubeWrapGetObjectMacro( Output, OutputImageType, Filter );
/** Get output threshold */
tubeWrapGetMacro( Threshold, TInputPixel, Filter );
protected:
SegmentUsingOtsuThreshold( void );
~SegmentUsingOtsuThreshold() {}
void PrintSelf( std::ostream & os, itk::Indent indent ) const;
private:
/** itkSegmentUsingOtsuThresholdFilter parameters **/
SegmentUsingOtsuThreshold( const Self & );
void operator=( const Self & );
typename FilterType::Pointer m_Filter;
};
} // End namespace tube
#ifndef ITK_MANUAL_INSTANTIATION
#include "tubeSegmentUsingOtsuThreshold.hxx"
#endif
#endif // End !defined( __tubeSegmentUsingOtsuThreshold_h )
|
#pragma once
#include "stdafx.h"
#include "Feature.h"
#include "PixelwiseComparison.h"
#include "SIFTComparison.h"
#include "ImageProfile.h"
#include "ImageMetadata.h"
#include "ImageHistogram.h"
#include "BOWHistogram.h"
#include "TaskFactory.h"
#include "VerboseOutput.h"
#include <tclap/CmdLine.h>
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv/highgui.h"
#include <string>
#include <list>
using namespace cv;
using namespace std;
class Comparison
{
private:
list<Feature*> tasks;
list<Feature*> tasksFromXML1;
list<Feature*> tasksFromXML2;
int level;
void setCommandlineArguments(Feature* task);
void setTasksCmdArgs(list<Feature*>* tasks);
bool canExecute( Feature* task1 );
public:
Comparison(void);
~Comparison(void);
void read(string* filename1, string* filename2);
void addCommandLineArgs(TCLAP::CmdLine* cmd);
void parseCommandLineArgs();
void execute();
void level3(string *filename1, string *filename2);
void writeOutput(void);
void setLevel( int& level );
void createTasks( string* file1, string* file2 );
};
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2011 by TiBountyHunter, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#if defined(USE_TI_XML) || defined(USE_TI_NETWORK)
#import "TiProxy.h"
#import "TiDOMNodeProxy.h"
@interface TiDOMCharacterDataProxy : TiDOMNodeProxy {
@private
}
@property(nonatomic,copy,readwrite) NSString * data;
@property(nonatomic,readonly) NSNumber * length;
-(NSString *) substringData:(id)args;
-(void) appendData:(id)args;
-(void) insertData:(id)args;
-(void) deleteData:(id)args;
-(void) replaceData:(id)args;
@end
#endif
|
// This is core/vnl/vnl_matrix_ref.h
#ifndef vnl_matrix_ref_h_
#define vnl_matrix_ref_h_
#ifdef VCL_NEEDS_PRAGMA_INTERFACE
#pragma interface
#endif
//:
// \file
// \brief vnl_matrix reference to user-supplied storage.
// \author Andrew W. Fitzgibbon, Oxford RRG
// \date 04 Aug 96
//
// \verbatim
// Modifications
// Documentation updated by Ian Scott 12 Mar 2000
// Feb.2002 - Peter Vanroose - brief doxygen comment placed on single line
// \endverbatim
//
//-----------------------------------------------------------------------------
#include <vnl/vnl_matrix.h>
#include "vnl/vnl_export.h"
//: vnl_matrix reference to user-supplied storage
// vnl_matrix_ref is a vnl_matrix for which the data space has been
// supplied externally. This is useful for two main tasks:
// (a) Treating some row-based "C" matrix as a vnl_matrix in order to
// perform vnl_matrix operations on it.
//
// This is a dangerous class. I believe that I've covered all the bases, but
// it's really only intended for interfacing with the Fortran routines.
//
// The big warning is that returning a vnl_matrix_ref pointer will free non-heap
// memory if deleted through a vnl_matrix pointer. This should be
// very difficult though, as vnl_matrix_ref objects may not be constructed using
// operator new, and are therefore unlikely to be the unwitting subject
// of an operator delete.
template <class T>
class VNL_TEMPLATE_EXPORT vnl_matrix_ref : public vnl_matrix<T>
{
typedef vnl_matrix<T> Base;
public:
// Constructors/Destructors--------------------------------------------------
vnl_matrix_ref(unsigned int m, unsigned int n, T *datablck) {
Base::data = vnl_c_vector<T>::allocate_Tptr(m);
for (unsigned int i = 0; i < m; ++i)
Base::data[i] = datablck + i * n;
Base::num_rows = m;
Base::num_cols = n;
#if VCL_HAS_SLICED_DESTRUCTOR_BUG
this->vnl_matrix_own_data = 0;
#endif
}
vnl_matrix_ref(vnl_matrix_ref<T> const & other) : vnl_matrix<T>() {
Base::data = vnl_c_vector<T>::allocate_Tptr(other.rows());
for (unsigned int i = 0; i < other.rows(); ++i)
Base::data[i] = const_cast<T*>(other.data_block()) + i * other.cols();
Base::num_rows = other.rows();
Base::num_cols = other.cols();
#if VCL_HAS_SLICED_DESTRUCTOR_BUG
this->vnl_matrix_own_data = 0;
#endif
}
~vnl_matrix_ref() {
Base::data[0] = VXL_NULLPTR; // Prevent base dtor from releasing our memory
}
//: Reference to self to make non-const temporaries.
// This is intended for passing vnl_matrix_fixed objects to
// functions that expect non-const vnl_matrix references:
// \code
// void mutator( vnl_matrix<double>& );
// ...
// vnl_matrix_fixed<double,5,3> my_m;
// mutator( m ); // Both these fail because the temporary vnl_matrix_ref
// mutator( m.as_ref() ); // cannot be bound to the non-const reference
// mutator( m.as_ref().non_const() ); // works
// \endcode
// \attention Use this only to pass the reference to a
// function. Otherwise, the underlying object will be destructed and
// you'll be left with undefined behaviour.
vnl_matrix_ref& non_const() { return *this; }
private:
//: Resizing is disallowed
bool resize (unsigned int, unsigned int) { return false; }
//: Resizing is disallowed
bool make_size (unsigned int, unsigned int) { return false; }
//: Resizing is disallowed
bool set_size (unsigned int, unsigned int) { return false; }
//: Copy constructor from vnl_matrix<T> is disallowed
// (because it would create a non-const alias to the matrix)
vnl_matrix_ref(vnl_matrix<T> const &) {}
};
#endif // vnl_matrix_ref_h_
|
//===-- llvm/MC/MCAsmInfoELF.h - ELF Asm info -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCASMINFOELF_H
#define LLVM_MC_MCASMINFOELF_H
#include "llvm/MC/MCAsmInfo.h"
namespace llvm {
class MCAsmInfoELF : public MCAsmInfo {
virtual void anchor();
const MCSection *getNonexecutableStackSection(MCContext &Ctx) const final;
protected:
MCAsmInfoELF();
};
}
#endif
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2012 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIBCBIO_TYPES_H
#define LIBCBIO_TYPES_H 1
#ifndef LIBCBIO_CBIO_H
#error "Include libcbio/cbio.h instead"
#endif
#include <sys/types.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**< Document contents compressed via Snappy */
#define CBIO_DOC_IS_COMPRESSED 128
/* Content Type Reasons (content_meta & 0x0F): */
/**< Document is valid JSON data */
#define CBIO_DOC_IS_JSON 0
/**< Document was checked, and was not valid JSON */
#define CBIO_DOC_INVALID_JSON 1
/**< Document was checked, and contained reserved keys,
was not inserted as JSON. */
#define CBIO_DOC_INVALID_JSON_KEY 2
/**< Document was not checked (DB running in non-JSON mode) */
#define CBIO_DOC_NON_JSON_MODE 3
struct libcbio_st;
typedef struct libcbio_st *libcbio_t;
struct libcbio_document_st;
typedef struct libcbio_document_st *libcbio_document_t;
typedef enum {
CBIO_OPEN_RDONLY,
CBIO_OPEN_RW,
CBIO_OPEN_CREATE
} libcbio_open_mode_t;
typedef enum {
CBIO_SUCCESS = 0x00,
CBIO_ERROR_ENOMEM,
CBIO_ERROR_EIO,
CBIO_ERROR_EINVAL,
CBIO_ERROR_INTERNAL,
CBIO_ERROR_OPEN_FILE,
CBIO_ERROR_CORRUPT,
CBIO_ERROR_ENOENT,
CBIO_ERROR_NO_HEADER,
CBIO_ERROR_HEADER_VERSION,
CBIO_ERROR_CHECKSUM_FAIL
} cbio_error_t;
#ifdef __cplusplus
}
#endif
#endif
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ARANGOD_BASICS_ENCODING_UTILS_H
#define ARANGOD_BASICS_ENCODING_UTILS_H 1
#include <velocypack/Buffer.h>
namespace arangodb {
namespace encoding {
bool gzipUncompress(uint8_t* compressed, size_t compressedLength,
arangodb::velocypack::Buffer<uint8_t>& uncompressed);
bool gzipDeflate(uint8_t* compressed, size_t compressedLength,
arangodb::velocypack::Buffer<uint8_t>& uncompressed);
} // namespace encoding
} // namespace arangodb
#endif
|
/*
* DS1307.h
* library for Seeed RTC module
*
* Copyright (c) 2013 seeed technology inc.
* Author : FrankieChu
* Create Time : Jan 2013
* Change Log :
*
* The MIT License (MIT)
*
* 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 __DS1307_H__
#define __DS1307_H__
#include <Arduino.h>
#define DS1307_I2C_ADDRESS 0x68
#define MON 1
#define TUE 2
#define WED 3
#define THU 4
#define FRI 5
#define SAT 6
#define SUN 7
class DS1307
{
private:
uint8_t decToBcd(uint8_t val);
uint8_t bcdToDec(uint8_t val);
public:
void begin();
void startClock(void);
void stopClock(void);
void setTime(void);
void getTime(void);
void fillByHMS(uint8_t _hour, uint8_t _minute, uint8_t _second);
void fillByYMD(uint16_t _year, uint8_t _month, uint8_t _day);
void fillDayOfWeek(uint8_t _dow);
uint8_t second;
uint8_t minute;
uint8_t hour;
uint8_t dayOfWeek;// day of week, 1 = Monday
uint8_t dayOfMonth;
uint8_t month;
uint16_t year;
};
#endif
|
/*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#import <Foundation/Foundation.h>
/**
* This is the the DNS domain name of the endpoint your Token Vending
* Machine is running. (For example, if your TVM is running at
* http://mytvm.elasticbeanstalk.com this parameter should be set to
* mytvm.elasticbeanstalk.com.)
*/
#define TOKEN_VENDING_MACHINE_URL @"CHANGE ME"
/**
* This is the App Name you may have provided in the AWS Elastic Beanstalk
* configuration. It was the value provided for PARAM2. If no value was
* provided it should be defaulted to "MyMobileAppName".
*/
#define APP_NAME @"MyMobileAppName"
/**
* This indiciates whether or not the TVM is supports SSL connections.
*/
#define USE_SSL NO
#define CREDENTIALS_ALERT_MESSAGE @"Please update the Constants.h file with your credentials or Token Vending Machine URL."
#define ACCESS_KEY_ID @"USED_ONLY_FOR_TESTING" // Leave this value as is.
#define SECRET_KEY @"USED_ONLY_FOR_TESTING" // Leave this value as is.
@interface Constants:NSObject {
}
+(UIAlertView *)credentialsAlert;
+(UIAlertView *)errorAlert:(NSString *)message;
+(UIAlertView *)expiredCredentialsAlert;
@end
|
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined (MONGOC_INSIDE) && !defined (MONGOC_COMPILATION)
# error "Only <mongoc.h> can be included directly."
#endif
#ifndef MONGOC_READ_PREFS_H
#define MONGOC_READ_PREFS_H
#include <bson.h>
BSON_BEGIN_DECLS
typedef struct _mongoc_read_prefs_t mongoc_read_prefs_t;
typedef enum
{
MONGOC_READ_PRIMARY = (1 << 0),
MONGOC_READ_SECONDARY = (1 << 1),
MONGOC_READ_PRIMARY_PREFERRED = (1 << 2) | MONGOC_READ_PRIMARY,
MONGOC_READ_SECONDARY_PREFERRED = (1 << 2) | MONGOC_READ_SECONDARY,
MONGOC_READ_NEAREST = (1 << 3) | MONGOC_READ_SECONDARY,
} mongoc_read_mode_t;
mongoc_read_prefs_t *mongoc_read_prefs_new (mongoc_read_mode_t read_mode);
mongoc_read_prefs_t *mongoc_read_prefs_copy (const mongoc_read_prefs_t *read_prefs);
void mongoc_read_prefs_destroy (mongoc_read_prefs_t *read_prefs);
mongoc_read_mode_t mongoc_read_prefs_get_mode (const mongoc_read_prefs_t *read_prefs);
void mongoc_read_prefs_set_mode (mongoc_read_prefs_t *read_prefs,
mongoc_read_mode_t mode);
const bson_t *mongoc_read_prefs_get_tags (const mongoc_read_prefs_t *read_prefs);
void mongoc_read_prefs_set_tags (mongoc_read_prefs_t *read_prefs,
const bson_t *tags);
void mongoc_read_prefs_add_tag (mongoc_read_prefs_t *read_prefs,
const bson_t *tag);
bool mongoc_read_prefs_is_valid (const mongoc_read_prefs_t *read_prefs);
BSON_END_DECLS
#endif /* MONGOC_READ_PREFS_H */
|
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)setvbuf.c 8.2 (Berkeley) 11/16/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/lib/libc/stdio/setvbuf.c 251009 2013-04-23 13:33:13Z emaste $");
#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
#include "un-namespace.h"
#include "local.h"
#include "libc_private.h"
/*
* Set one of the three kinds of buffering, optionally including
* a buffer.
*/
int
setvbuf(FILE * __restrict fp, char * __restrict buf, int mode, size_t size)
{
int ret, flags;
size_t iosize;
int ttyflag;
/*
* Verify arguments. The `int' limit on `size' is due to this
* particular implementation. Note, buf and size are ignored
* when setting _IONBF.
*/
if (mode != _IONBF)
if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
return (EOF);
FLOCKFILE(fp);
/*
* Write current buffer, if any. Discard unread input (including
* ungetc data), cancel line buffering, and free old buffer if
* malloc()ed. We also clear any eof condition, as if this were
* a seek.
*/
ret = 0;
(void)__sflush(fp);
if (HASUB(fp))
FREEUB(fp);
fp->_r = fp->_lbfsize = 0;
flags = fp->_flags;
if (flags & __SMBF)
free((void *)fp->_bf._base);
flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SOFF | __SNPT | __SEOF);
/* If setting unbuffered mode, skip all the hard work. */
if (mode == _IONBF)
goto nbf;
/*
* Find optimal I/O size for seek optimization. This also returns
* a `tty flag' to suggest that we check isatty(fd), but we do not
* care since our caller told us how to buffer.
*/
flags |= __swhatbuf(fp, &iosize, &ttyflag);
if (size == 0) {
buf = NULL; /* force local allocation */
size = iosize;
}
/* Allocate buffer if needed. */
if (buf == NULL) {
if ((buf = malloc(size)) == NULL) {
/*
* Unable to honor user's request. We will return
* failure, but try again with file system size.
*/
ret = EOF;
if (size != iosize) {
size = iosize;
buf = malloc(size);
}
}
if (buf == NULL) {
/* No luck; switch to unbuffered I/O. */
nbf:
fp->_flags = flags | __SNBF;
fp->_w = 0;
fp->_bf._base = fp->_p = fp->_nbuf;
fp->_bf._size = 1;
FUNLOCKFILE(fp);
return (ret);
}
flags |= __SMBF;
}
/*
* Kill any seek optimization if the buffer is not the
* right size.
*
* SHOULD WE ALLOW MULTIPLES HERE (i.e., ok iff (size % iosize) == 0)?
*/
if (size != iosize)
flags |= __SNPT;
/*
* Fix up the FILE fields, and set __cleanup for output flush on
* exit (since we are buffered in some way).
*/
if (mode == _IOLBF)
flags |= __SLBF;
fp->_flags = flags;
fp->_bf._base = fp->_p = (unsigned char *)buf;
fp->_bf._size = size;
/* fp->_lbfsize is still 0 */
if (flags & __SWR) {
/*
* Begin or continue writing: see __swsetup(). Note
* that __SNBF is impossible (it was handled earlier).
*/
if (flags & __SLBF) {
fp->_w = 0;
fp->_lbfsize = -fp->_bf._size;
} else
fp->_w = size;
} else {
/* begin/continue reading, or stay in intermediate state */
fp->_w = 0;
}
__cleanup = _cleanup;
FUNLOCKFILE(fp);
return (ret);
}
|
#ifndef __worms_h__
#define __worms_h__
#include <iostream>
//#pragma warn -inl
#include <jcalist.h>
/*format
*
*
* _|0,..., idx,... wormsize(w) - 1
* 0|XXX
* .|XXXXX
* .|XXXXXX getx(w, idx) gety(w, idx)
* .|XXX
* w|X
* .|XXX
* .|XXXXXX
* .|XX
* .|XXX
* totalworms() - 1
*/
class worms
{
public:
worms() { set(0, 0); }
worms(const double swlong, const double swlat)
{ set(swlong, swlat); }
public:
int wormstotal() const
{
//int i = 0;
//while (getNode(i)) { i++; }
return myworms.size();
}
//assume format is correct
int wormsize(const int w) const
{
jca::list<int>::node* n = getNode(w);
return n && n->next ? n->next->t : -1;
}
//[0, wormsize - 1] shift segments to left
//-1 || i > wormsize add segment to worm
void add(const double lon, const double lat, const int w, const int idx = -1)
{
jca::list<jca::list<int>::node*>::node* wn = myworms.getNode(w);
if (wn)
{
jca::list<int>::node* n = wn->t;
n = n->next;
if (0 <= idx && idx < n->t)
{
int size = n->t - 1;
//pull x0 and y0 two nodes and reset
jca::list<int>::node* x = xys.pulNode(n->next);
x->set((lon - swlon) * 60);
jca::list<int>::node* y = xys.pulNode(n->next);
y->set((lat - swlat) * 60);
//insnodes at tail of worm
if (wn->next)
{
jca::list<int>::node* n2 = wn->next->t;
while (size > idx)
{
n2 = n2->prev;
n2 = n2->prev;
}
xys.insNode(x, n2);
xys.insNode(y, n2);
}
else
{
xys.addNode(x);
xys.addNode(y);
}
}
else
{
jca::list<int>::node* x = new jca::list<int>::node((lon - swlon) * 60);
jca::list<int>::node* y = new jca::list<int>::node((lat - swlat) * 60);
if (wn->next)
{
jca::list<int>::node* n = wn->next->t;
xys.insNode(x, n);
xys.insNode(y, n);
}
else
{
xys.addNode(x);
xys.addNode(y);
}
n->t++;
}
}
}
int addWorm(const double lon, const double lat, const int rgb = 0)
{
xys.add(rgb);
myworms.add(xys.getHead()->prev);
xys.add(1);
int x = (int)(lon - swlon) * 60;
int y = (int)(lat - swlat) * 60;
xys.add(x);
xys.add(y);
return wormstotal() - 1;
}
void setrgb(const int w, const int rgb)
{
jca::list<int>::node* n = getNode(w);
if (n && n->next) n->next->t = rgb;
}
void setx(const double lon, const int w, const int idx)
{
jca::list<int>::node* n = getNodex(w, idx);
if (n) n->t = (int)(lon - swlon) * 60;
}
void sety(const double lat, const int w, const int idx)
{
jca::list<int>::node* n = getNodey(w, idx);
if (n) n->t = (int)(lat - swlat) * 60;
}
int getrgb(const int w) const
{
jca::list<int>::node* n = getNode(w);
return n ? n->t : -1;
}
int getx(const int w, const int idx) const
{
jca::list<int>::node* n = getNodex(w, idx);
return n ? n->t : -1;
}
int gety(const int w, const int idx) const
{
jca::list<int>::node* n = getNodey(w, idx);
return n ? n->t : -1;
}
void remove(const int w)
{
jca::list<int>::node* n = getNode(w);
if (n) xys.remove(n->i, n->i + 1 + 1 + n->t * 2);
}
void removeAll()
{
const int size = wormstotal();
for (int i = 0; i < size; i++)
remove(0);
}
void printAll()
{ printAll(std::cout); }
std::ostream& printAll(std::ostream& sout) const
{
jca::list<int>::node* n = xys.getHead()->next;
while (n)
{
sout << n->t << ' ';
n = n->next;
}
return sout;
}
void printSizes(std::ostream& sout) const
{
const int size = wormstotal();
for (int i = 0; i < size; i++)
{ sout << wormsize(i) << ' '; }
}
void printHeads(std::ostream& sout) const
{
const int size = wormstotal();
for (int i = 0; i < size; i++)
{ sout << " " << getx(i, 0) << " " << gety(i, 0); }
}
public:
void test(const int xmax, const int ymax);
void set(const double swlong, const double swlat)
{ worms::swlon = swlong; worms::swlat = swlat; }
jca::list<int>& getLst() { return xys; }
jca::list<int>::node* getHead() const { return xys.getHead(); }
private:
jca::list<int> xys;
jca::list<jca::list<int>::node*> myworms;
double swlon, swlat;
private:
jca::list<int>::node* getNode(const int w) const
{ return myworms.get(w); }
jca::list<int>::node* getNodex(const int w, const int idx) const
{
jca::list<int>::node* n = getNode(w);
n = n->next ? n->next : 0; //skip rgb
if (n && 0 <= idx && idx < n->t)
{
n = n->next; //skip size
for (int i = 0; i < idx; i++)
{
n = n->next;
n = n->next;
}
return n;
}
return 0;
}
jca::list<int>::node* getNodey(const int w, const int idx) const
{
jca::list<int>::node* n = getNodex(w, idx);
return n ? n->next : 0;
}
};
/*
std::ostream& operator<<(std::ostream& os, const worms& w)
{ return w.printAll(os); }
std::ostream& operator<<(std::ostream& os, const worms* w)
{ return w->printAll(os); }
*/
#endif //define __worms_h__
|
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Keith Muller of the University of California, San Diego and Lance
* Visser of Convex Computer Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)extern.h 8.3 (Berkeley) 4/2/94
* $FreeBSD: soc2013/dpl/head/bin/dd/extern.h 251670 2013-05-10 18:43:36Z eadler $
*/
void block(void);
void block_close(void);
void dd_out(int);
void def(void);
void def_close(void);
void jcl(char **);
void pos_in(void);
void pos_out(void);
void summary(void);
void siginfo_handler(int);
void terminate(int);
void unblock(void);
void unblock_close(void);
extern IO in, out;
extern STAT st;
extern void (*cfunc)(void);
extern uintmax_t cpy_cnt;
extern size_t cbsz;
extern u_int ddflags;
extern uintmax_t files_cnt;
extern const u_char *ctab;
extern const u_char a2e_32V[], a2e_POSIX[];
extern const u_char e2a_32V[], e2a_POSIX[];
extern const u_char a2ibm_32V[], a2ibm_POSIX[];
extern u_char casetab[];
extern char fill_char;
extern volatile sig_atomic_t need_summary;
|
/*
* Copyright (c) 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software written by Ken Arnold and
* published in UNIX Review, Vol. 6, No. 8.
*
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/libexec/ftpd/popen.c 229125 2011-12-23 15:00:37Z cperciva $");
#include <sys/types.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <errno.h>
#include <glob.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "extern.h"
#include "pathnames.h"
#include <syslog.h>
#include <time.h>
#define MAXUSRARGS 100
#define MAXGLOBARGS 1000
/*
* Special version of popen which avoids call to shell. This ensures noone
* may create a pipe to a hidden program as a side effect of a list or dir
* command.
*/
static int *pids;
static int fds;
FILE *
ftpd_popen(char *program, char *type)
{
char *cp;
FILE *iop;
int argc, gargc, pdes[2], pid;
char **pop, *argv[MAXUSRARGS], *gargv[MAXGLOBARGS];
if (((*type != 'r') && (*type != 'w')) || type[1])
return (NULL);
if (!pids) {
if ((fds = getdtablesize()) <= 0)
return (NULL);
if ((pids = malloc(fds * sizeof(int))) == NULL)
return (NULL);
memset(pids, 0, fds * sizeof(int));
}
if (pipe(pdes) < 0)
return (NULL);
/* break up string into pieces */
for (argc = 0, cp = program; argc < MAXUSRARGS; cp = NULL) {
if (!(argv[argc++] = strtok(cp, " \t\n")))
break;
}
argv[argc - 1] = NULL;
/* glob each piece */
gargv[0] = argv[0];
for (gargc = argc = 1; argv[argc] && gargc < (MAXGLOBARGS-1); argc++) {
glob_t gl;
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE;
memset(&gl, 0, sizeof(gl));
gl.gl_matchc = MAXGLOBARGS;
flags |= GLOB_LIMIT;
if (glob(argv[argc], flags, NULL, &gl))
gargv[gargc++] = strdup(argv[argc]);
else if (gl.gl_pathc > 0) {
for (pop = gl.gl_pathv; *pop && gargc < (MAXGLOBARGS-1);
pop++)
gargv[gargc++] = strdup(*pop);
}
globfree(&gl);
}
gargv[gargc] = NULL;
iop = NULL;
fflush(NULL);
pid = (strcmp(gargv[0], _PATH_LS) == 0) ? fork() : vfork();
switch(pid) {
case -1: /* error */
(void)close(pdes[0]);
(void)close(pdes[1]);
goto pfree;
/* NOTREACHED */
case 0: /* child */
if (*type == 'r') {
if (pdes[1] != STDOUT_FILENO) {
dup2(pdes[1], STDOUT_FILENO);
(void)close(pdes[1]);
}
dup2(STDOUT_FILENO, STDERR_FILENO); /* stderr too! */
(void)close(pdes[0]);
} else {
if (pdes[0] != STDIN_FILENO) {
dup2(pdes[0], STDIN_FILENO);
(void)close(pdes[0]);
}
(void)close(pdes[1]);
}
/* Drop privileges before proceeding */
if (getuid() != geteuid() && setuid(geteuid()) < 0)
_exit(1);
if (strcmp(gargv[0], _PATH_LS) == 0) {
/* Reset getopt for ls_main() */
optreset = optind = optopt = 1;
/* Close syslogging to remove pwd.db missing msgs */
closelog();
/* Trigger to sense new /etc/localtime after chroot */
if (getenv("TZ") == NULL) {
setenv("TZ", "", 0);
tzset();
unsetenv("TZ");
tzset();
}
exit(ls_main(gargc, gargv));
}
execv(gargv[0], gargv);
_exit(1);
}
/* parent; assume fdopen can't fail... */
if (*type == 'r') {
iop = fdopen(pdes[0], type);
(void)close(pdes[1]);
} else {
iop = fdopen(pdes[1], type);
(void)close(pdes[0]);
}
pids[fileno(iop)] = pid;
pfree: for (argc = 1; gargv[argc] != NULL; argc++)
free(gargv[argc]);
return (iop);
}
int
ftpd_pclose(FILE *iop)
{
int fdes, omask, status;
pid_t pid;
/*
* pclose returns -1 if stream is not associated with a
* `popened' command, or, if already `pclosed'.
*/
if (pids == 0 || pids[fdes = fileno(iop)] == 0)
return (-1);
(void)fclose(iop);
omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
while ((pid = waitpid(pids[fdes], &status, 0)) < 0 && errno == EINTR)
continue;
(void)sigsetmask(omask);
pids[fdes] = 0;
if (pid < 0)
return (pid);
if (WIFEXITED(status))
return (WEXITSTATUS(status));
return (1);
}
|
/*-
* Copyright (c) 2009 Konstantin Belousov <kib@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: soc2013/dpl/head/sys/sys/_kstack_cache.h 228849 2011-12-16 10:56:16Z kib $
*/
#ifndef _SYS__KSTACK_CACHE_H
#define _SYS__KSTACK_CACHE_H
struct kstack_cache_entry {
struct vm_object *ksobj;
struct kstack_cache_entry *next_ks_entry;
};
extern struct kstack_cache_entry *kstack_cache;
#endif
|
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBOPENCM3_MEMORYMAP_H
#define LIBOPENCM3_MEMORYMAP_H
#include "../../cm3/memorymap.h"
/* --- STM32F4 specific peripheral definitions ----------------------------- */
/* Memory map for all busses */
#define PERIPH_BASE 0x40000000
#define PERIPH_BASE_APB1 (PERIPH_BASE + 0x00000)
#define PERIPH_BASE_APB2 (PERIPH_BASE + 0x10000)
#define PERIPH_BASE_AHB1 (PERIPH_BASE + 0x20000)
#define PERIPH_BASE_AHB2 0x50000000
#define PERIPH_BASE_AHB3 0x60000000
/* Register boundary addresses */
/* APB1 */
#define TIM2_BASE (PERIPH_BASE_APB1 + 0x0000)
#define TIM3_BASE (PERIPH_BASE_APB1 + 0x0400)
#define TIM4_BASE (PERIPH_BASE_APB1 + 0x0800)
#define TIM5_BASE (PERIPH_BASE_APB1 + 0x0c00)
#define TIM6_BASE (PERIPH_BASE_APB1 + 0x1000)
#define TIM7_BASE (PERIPH_BASE_APB1 + 0x1400)
#define TIM12_BASE (PERIPH_BASE_APB1 + 0x1800)
#define TIM13_BASE (PERIPH_BASE_APB1 + 0x1c00)
#define TIM14_BASE (PERIPH_BASE_APB1 + 0x2000)
/* PERIPH_BASE_APB1 + 0x2400 (0x4000 2400 - 0x4000 27FF): Reserved */
#define RTC_BASE (PERIPH_BASE_APB1 + 0x2800)
#define WWDG_BASE (PERIPH_BASE_APB1 + 0x2c00)
#define IWDG_BASE (PERIPH_BASE_APB1 + 0x3000)
/* PERIPH_BASE_APB1 + 0x3400 (0x4000 3400 - 0x4000 37FF): Reserved */
#define SPI2_I2S_BASE (PERIPH_BASE_APB1 + 0x3800)
#define SPI3_I2S_BASE (PERIPH_BASE_APB1 + 0x3c00)
/* PERIPH_BASE_APB1 + 0x4000 (0x4000 4000 - 0x4000 3FFF): Reserved */
#define USART2_BASE (PERIPH_BASE_APB1 + 0x4400)
#define USART3_BASE (PERIPH_BASE_APB1 + 0x4800)
#define UART4_BASE (PERIPH_BASE_APB1 + 0x4c00)
#define UART5_BASE (PERIPH_BASE_APB1 + 0x5000)
#define I2C1_BASE (PERIPH_BASE_APB1 + 0x5400)
#define I2C2_BASE (PERIPH_BASE_APB1 + 0x5800)
#define I2C3_BASE (PERIPH_BASE_APB1 + 0x5C00)
/* PERIPH_BASE_APB1 + 0x6000 (0x4000 6000 - 0x4000 63FF): Reserved */
#define BX_CAN1_BASE (PERIPH_BASE_APB1 + 0x6400)
#define BX_CAN2_BASE (PERIPH_BASE_APB1 + 0x6800)
/* PERIPH_BASE_APB1 + 0x6C00 (0x4000 6C00 - 0x4000 6FFF): Reserved */
#define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000)
#define DAC_BASE (PERIPH_BASE_APB1 + 0x7400)
/* PERIPH_BASE_APB1 + 0x7800 (0x4000 7800 - 0x4000 FFFF): Reserved */
/* APB2 */
#define TIM1_BASE (PERIPH_BASE_APB2 + 0x0000)
#define TIM8_BASE (PERIPH_BASE_APB2 + 0x0400)
/* PERIPH_BASE_APB2 + 0x0800 (0x4001 0800 - 0x4001 0FFF): Reserved */
#define USART1_BASE (PERIPH_BASE_APB2 + 0x1000)
#define USART6_BASE (PERIPH_BASE_APB2 + 0x1400)
/* PERIPH_BASE_APB2 + 0x1800 (0x4001 1800 - 0x4001 1FFF): Reserved */
#define ADC1_BASE (PERIPH_BASE_APB2 + 0x2000)
#define ADC2_BASE (PERIPH_BASE_APB2 + 0x2000)
#define ADC3_BASE (PERIPH_BASE_APB2 + 0x2000)
/* PERIPH_BASE_APB2 + 0x2400 (0x4001 2400 - 0x4001 27FF): Reserved */
#define SDIO_BASE (PERIPH_BASE_APB2 + 0x2800)
/* PERIPH_BASE_APB2 + 0x2C00 (0x4001 2C00 - 0x4001 2FFF): Reserved */
#define SPI1_BASE (PERIPH_BASE_APB2 + 0x3000)
/* PERIPH_BASE_APB2 + 0x3400 (0x4001 3400 - 0x4001 37FF): Reserved */
#define SYSCFG_BASE (PERIPH_BASE_APB2 + 0x3800)
#define EXTI_BASE (PERIPH_BASE_APB2 + 0x3C00)
#define TIM9_BASE (PERIPH_BASE_APB2 + 0x4000)
#define TIM10_BASE (PERIPH_BASE_APB2 + 0x4400)
#define TIM11_BASE (PERIPH_BASE_APB2 + 0x4800)
/* PERIPH_BASE_APB2 + 0x4C00 (0x4001 4C00 - 0x4001 FFFF): Reserved */
/* AHB1 */
#define GPIO_PORT_A_BASE (PERIPH_BASE_AHB1 + 0x0000)
#define GPIO_PORT_B_BASE (PERIPH_BASE_AHB1 + 0x0400)
#define GPIO_PORT_C_BASE (PERIPH_BASE_AHB1 + 0x0800)
#define GPIO_PORT_D_BASE (PERIPH_BASE_AHB1 + 0x0C00)
#define GPIO_PORT_E_BASE (PERIPH_BASE_AHB1 + 0x1000)
#define GPIO_PORT_F_BASE (PERIPH_BASE_AHB1 + 0x1400)
#define GPIO_PORT_G_BASE (PERIPH_BASE_AHB1 + 0x1800)
#define GPIO_PORT_H_BASE (PERIPH_BASE_AHB1 + 0x1C00)
#define GPIO_PORT_I_BASE (PERIPH_BASE_AHB1 + 0x2000)
/* PERIPH_BASE_AHB1 + 0x2400 (0x4002 2400 - 0x4002 2FFF): Reserved */
#define CRC_BASE (PERIPH_BASE_AHB1 + 0x3000)
/* PERIPH_BASE_AHB1 + 0x3400 (0x4002 3400 - 0x4002 37FF): Reserved */
#define RCC_BASE (PERIPH_BASE_AHB1 + 0x3800)
#define FLASH_MEM_INTERFACE_BASE (PERIPH_BASE_AHB1 + 0x3C00)
#define BKPSRAM_BASE (PERIPH_BASE_AHB1 + 0x4000)
/* PERIPH_BASE_AHB1 + 0x5000 (0x4002 5000 - 0x4002 5FFF): Reserved */
#define DMA1_BASE (PERIPH_BASE_AHB1 + 0x6000)
#define DMA2_BASE (PERIPH_BASE_AHB1 + 0x6400)
/* PERIPH_BASE_AHB1 + 0x6800 (0x4002 6800 - 0x4002 7FFF): Reserved */
#define ETHERNET_BASE (PERIPH_BASE_AHB1 + 0x8000)
/* PERIPH_BASE_AHB1 + 0x9400 (0x4002 9400 - 0x4003 FFFF): Reserved */
#define USB_OTG_HS_BASE (PERIPH_BASE_AHB1 + 0x20000)
/* PERIPH_BASE_AHB1 + 0x60000 (0x4008 0000 - 0x4FFF FFFF): Reserved */
/* AHB2 */
#define USB_OTG_FS_BASE (PERIPH_BASE_AHB2 + 0x0000)
/* PERIPH_BASE_AHB2 + 0x40000 (0x5004 0000 - 0x5004 FFFF): Reserved */
#define DCMI_BASE (PERIPH_BASE_AHB2 + 0x50000)
/* PERIPH_BASE_AHB2 + 0x50400 (0x5005 0400 - 0x5006 07FF): Reserved */
#define RNG_BASE (PERIPH_BASE_AHB2 + 0x60800)
/* PERIPH_BASE_AHB2 + 0x61000 (0x5006 1000 - 0x5FFF FFFF): Reserved */
/* AHB3 */
#define FSMC_BASE (PERIPH_BASE_AHB3 + 0x40000000)
/* PPIB */
#define DBGMCU_BASE (PPBI_BASE + 0x00042000)
#endif
|
//%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.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#include "CIMFixtureBase.h"
class UNIX_VLANEndpointSettingDataFixture :
public CIMFixtureBase
{
public:
UNIX_VLANEndpointSettingDataFixture();
~UNIX_VLANEndpointSettingDataFixture();
virtual void Run();
};
|
#ifdef KSW_CPU_DISPATCH
#include <stdlib.h>
#include "ksw2.h"
#define SIMD_SSE 0x1
#define SIMD_SSE2 0x2
#define SIMD_SSE3 0x4
#define SIMD_SSSE3 0x8
#define SIMD_SSE4_1 0x10
#define SIMD_SSE4_2 0x20
#define SIMD_AVX 0x40
#define SIMD_AVX2 0x80
#define SIMD_AVX512F 0x100
#ifndef _MSC_VER
// adapted from https://github.com/01org/linux-sgx/blob/master/common/inc/internal/linux/cpuid_gnu.h
void __cpuidex(int cpuid[4], int func_id, int subfunc_id)
{
#if defined(__x86_64__)
__asm__ volatile ("cpuid"
: "=a" (cpuid[0]), "=b" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
: "0" (func_id), "2" (subfunc_id));
#else // on 32bit, ebx can NOT be used as PIC code
__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
: "=a" (cpuid[0]), "=r" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
: "0" (func_id), "2" (subfunc_id));
#endif
}
#endif
static int ksw_simd = -1;
static int x86_simd(void)
{
int flag = 0, cpuid[4], max_id;
__cpuidex(cpuid, 0, 0);
max_id = cpuid[0];
if (max_id == 0) return 0;
__cpuidex(cpuid, 1, 0);
if (cpuid[3]>>25&1) flag |= SIMD_SSE;
if (cpuid[3]>>26&1) flag |= SIMD_SSE2;
if (cpuid[2]>>0 &1) flag |= SIMD_SSE3;
if (cpuid[2]>>9 &1) flag |= SIMD_SSSE3;
if (cpuid[2]>>19&1) flag |= SIMD_SSE4_1;
if (cpuid[2]>>20&1) flag |= SIMD_SSE4_2;
if (cpuid[2]>>28&1) flag |= SIMD_AVX;
if (max_id >= 7) {
__cpuidex(cpuid, 7, 0);
if (cpuid[1]>>5 &1) flag |= SIMD_AVX2;
if (cpuid[1]>>16&1) flag |= SIMD_AVX512F;
}
return flag;
}
void ksw_extz2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez)
{
extern void ksw_extz2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
extern void ksw_extz2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
if (ksw_simd < 0) ksw_simd = x86_simd();
if (ksw_simd & SIMD_SSE4_1)
ksw_extz2_sse41(km, qlen, query, tlen, target, m, mat, q, e, w, zdrop, end_bonus, flag, ez);
else if (ksw_simd & SIMD_SSE2)
ksw_extz2_sse2(km, qlen, query, tlen, target, m, mat, q, e, w, zdrop, end_bonus, flag, ez);
else abort();
}
void ksw_extd2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez)
{
extern void ksw_extd2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
extern void ksw_extd2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
if (ksw_simd < 0) ksw_simd = x86_simd();
if (ksw_simd & SIMD_SSE4_1)
ksw_extd2_sse41(km, qlen, query, tlen, target, m, mat, q, e, q2, e2, w, zdrop, end_bonus, flag, ez);
else if (ksw_simd & SIMD_SSE2)
ksw_extd2_sse2(km, qlen, query, tlen, target, m, mat, q, e, q2, e2, w, zdrop, end_bonus, flag, ez);
else abort();
}
void ksw_exts2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez)
{
extern void ksw_exts2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez);
extern void ksw_exts2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez);
if (ksw_simd < 0) ksw_simd = x86_simd();
if (ksw_simd & SIMD_SSE4_1)
ksw_exts2_sse41(km, qlen, query, tlen, target, m, mat, q, e, q2, noncan, zdrop, junc_bonus, flag, junc, ez);
else if (ksw_simd & SIMD_SSE2)
ksw_exts2_sse2(km, qlen, query, tlen, target, m, mat, q, e, q2, noncan, zdrop, junc_bonus, flag, junc, ez);
else abort();
}
#endif
|
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
#include "zz_const.h"
#include "lb_init_const.h"
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
void Zoltan_Migrate_Init(struct Zoltan_Migrate_Struct *mig)
{
mig->Auto_Migrate = ZOLTAN_AUTO_MIGRATE_DEF;
mig->Only_Proc_Changes = ZOLTAN_MIGRATE_ONLY_PROC_CHANGES_DEF;
mig->Pre_Migrate_PP = NULL;
mig->Mid_Migrate_PP = NULL;
mig->Post_Migrate_PP = NULL;
mig->Pre_Migrate = NULL;
mig->Mid_Migrate = NULL;
mig->Post_Migrate = NULL;
mig->Pre_Migrate_PP_Fort = NULL;
mig->Mid_Migrate_PP_Fort = NULL;
mig->Post_Migrate_PP_Fort = NULL;
mig->Pre_Migrate_Fort = NULL;
mig->Mid_Migrate_Fort = NULL;
mig->Post_Migrate_Fort = NULL;
mig->Pre_Migrate_PP_Data = NULL;
mig->Mid_Migrate_PP_Data = NULL;
mig->Post_Migrate_PP_Data = NULL;
mig->Pre_Migrate_Data = NULL;
mig->Mid_Migrate_Data = NULL;
mig->Post_Migrate_Data = NULL;
}
void Zoltan_LB_Init(struct Zoltan_LB_Struct *lb, int num_proc)
{
int i;
lb->Num_Global_Parts = num_proc;
lb->Num_Global_Parts_Param = -1;
lb->Num_Local_Parts_Param = -1;
lb->Prev_Global_Parts_Param = -2;
lb->Prev_Local_Parts_Param = -2;
lb->Single_Proc_Per_Part = 1;
lb->PartDist = NULL;
lb->ProcDist = NULL;
lb->Part_Info_Max_Len = 0;
lb->Part_Info_Len = 0;
lb->Part_Info = NULL;
lb->Method = RCB;
lb->LB_Fn = Zoltan_RCB;
lb->Remap_Flag = 1;
lb->Remap = NULL;
lb->OldRemap = NULL;
lb->Return_Lists = ZOLTAN_LB_RETURN_LISTS_DEF;
lb->Uniform_Parts = 1;
lb->Data_Structure = NULL;
lb->Free_Structure = Zoltan_RCB_Free_Structure;
lb->Copy_Structure = Zoltan_RCB_Copy_Structure;
lb->Point_Assign = Zoltan_RB_Point_Assign;
lb->Box_Assign = Zoltan_RB_Box_Assign;
lb->Imb_Tol_Len = 10;
lb->Imbalance_Tol = (float *)ZOLTAN_MALLOC((lb->Imb_Tol_Len)*sizeof(float));
for (i=0; i<lb->Imb_Tol_Len; i++)
lb->Imbalance_Tol[i] = ZOLTAN_LB_IMBALANCE_TOL_DEF;
strcpy(lb->Approach, ZOLTAN_LB_APPROACH_DEF);
}
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_STATUS_METRICS_PROVIDER_DELEGATE_H_
#define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_STATUS_METRICS_PROVIDER_DELEGATE_H_
#include <vector>
#include "base/gtest_prod_util.h"
#include "build/build_config.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/signin/core/browser/signin_status_metrics_provider_delegate.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/browser_list_observer.h"
#endif // !defined(OS_ANDROID)
class ChromeSigninStatusMetricsProviderDelegate
: public SigninStatusMetricsProviderDelegate,
#if !defined(OS_ANDROID)
public BrowserListObserver,
#endif
public IdentityManagerFactory::Observer {
public:
ChromeSigninStatusMetricsProviderDelegate();
ChromeSigninStatusMetricsProviderDelegate(
const ChromeSigninStatusMetricsProviderDelegate&) = delete;
ChromeSigninStatusMetricsProviderDelegate& operator=(
const ChromeSigninStatusMetricsProviderDelegate&) = delete;
~ChromeSigninStatusMetricsProviderDelegate() override;
private:
FRIEND_TEST_ALL_PREFIXES(ChromeSigninStatusMetricsProviderDelegateTest,
UpdateStatusWhenBrowserAdded);
// SigninStatusMetricsProviderDelegate:
void Initialize() override;
AccountsStatus GetStatusOfAllAccounts() override;
std::vector<signin::IdentityManager*> GetIdentityManagersForAllAccounts()
override;
#if !defined(OS_ANDROID)
// BrowserListObserver:
void OnBrowserAdded(Browser* browser) override;
#endif
// IdentityManagerFactoryObserver:
void IdentityManagerCreated(
signin::IdentityManager* identity_manager) override;
// Updates the sign-in status right after a new browser is opened.
void UpdateStatusWhenBrowserAdded(bool signed_in);
};
#endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_STATUS_METRICS_PROVIDER_DELEGATE_H_
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* SCP UART module for MT8195 specific */
#include "uart_regs.h"
/*
* UARTN == 0, SCP UART0
* UARTN == 1, SCP UART1
* UARTN == 2, AP UART1
*/
#define UARTN CONFIG_UART_CONSOLE
void uart_init_pinmux(void)
{
#if UARTN == 0
SCP_UART_CK_SEL |= UART0_CK_SEL_VAL(UART_CK_SEL_ULPOSC);
SCP_SET_CLK_CG |= CG_UART0_MCLK | CG_UART0_BCLK | CG_UART0_RST;
/* set AP GPIO102 and GPIO103 to alt func 5 */
AP_GPIO_MODE12_CLR = 0x77000000;
AP_GPIO_MODE12_SET = 0x55000000;
#endif
}
|
//===========================================================================
// uncore_manager.h
//===========================================================================
/*
Copyright (c) 2015 Princeton University
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 Princeton 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 PRINCETON UNIVERSITY "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 PRINCETON UNIVERSITY 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 UNCORE_MANAGER_H
#define UNCORE_MANAGER_H
#include <string>
#include <inttypes.h>
#include <fstream>
#include <sstream>
#include <list>
#include <pthread.h>
#include "system.h"
#include "thread_sched.h"
#include "xml_parser.h"
#include "cache.h"
#include "network.h"
#include "common.h"
#include "mpi.h"
class UncoreManager
{
public:
void init(XmlSim* xml_sim);
void getSimStartTime();
void getSimFinishTime();
int allocCore(int prog_id, int thread_id);
int deallocCore(int prog_id, int thread_id);
int getCoreId(int prog_id, int thread_id);
int uncore_access(int core_id, InsMem* ins_mem, int64_t timer);
void report(ofstream *result);
~UncoreManager();
private:
struct timespec sim_start_time;
struct timespec sim_finish_time;
System sys;
ThreadSched thread_sched;
};
#endif // UNCORE_MANAGER_H
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PREFS_PREF_SET_OBSERVER_H_
#define CHROME_BROWSER_PREFS_PREF_SET_OBSERVER_H_
#pragma once
#include <set>
#include "base/basictypes.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_service.h"
#include "content/public/browser/notification_observer.h"
// Observes the state of a set of preferences and allows to query their combined
// managed bits.
class PrefSetObserver : public content::NotificationObserver {
public:
// Initialize with an empty set of preferences.
PrefSetObserver(PrefService* pref_service,
content::NotificationObserver* observer);
virtual ~PrefSetObserver();
// Add a |pref| to the set of preferences to observe.
void AddPref(const std::string& pref);
// Remove |pref| from the set of observed peferences.
void RemovePref(const std::string& pref);
// Check whether |pref| is in the set of observed preferences.
bool IsObserved(const std::string& pref);
// Check whether any of the observed preferences has the managed bit set.
bool IsManaged();
// Create a pref set observer for all preferences relevant to proxies.
static PrefSetObserver* CreateProxyPrefSetObserver(
PrefService* pref_service,
content::NotificationObserver* observer);
// Create a pref set observer for all preferences relevant to default search.
static PrefSetObserver* CreateDefaultSearchPrefSetObserver(
PrefService* pref_service,
content::NotificationObserver* observer);
// Create a pref set observer for preferences accessed by ProtectorService.
static PrefSetObserver* CreateProtectedPrefSetObserver(
PrefService* pref_service,
content::NotificationObserver* observer);
private:
// Overridden from content::NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
typedef std::set<std::string> PrefSet;
PrefSet prefs_;
PrefService* pref_service_;
PrefChangeRegistrar registrar_;
content::NotificationObserver* observer_;
DISALLOW_COPY_AND_ASSIGN(PrefSetObserver);
};
#endif // CHROME_BROWSER_PREFS_PREF_SET_OBSERVER_H_
|
//===============================================================================================//
// Copyright (c) 2011, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// 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 Harmony Security 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.
//===============================================================================================//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "LoadLibraryR.h"
#define BREAK_WITH_ERROR( e ) { printf( "[-] %s. Error=%d", e, GetLastError() ); break; }
// Simple app to inject a reflective DLL into a process vis its process ID.
int main( int argc, char * argv[] )
{
HANDLE hFile = NULL;
HANDLE hModule = NULL;
HANDLE hProcess = NULL;
LPVOID lpBuffer = NULL;
DWORD dwLength = 0;
DWORD dwBytesRead = 0;
DWORD dwProcessId = 0;
#ifdef _WIN64
char * cpDllFile = "reflective_dll.x64.dll";
#else
char * cpDllFile = "reflective_dll.dll";
#endif
do
{
if( argc < 2 )
{
printf( "Usage: inject.exe <pid> [dll_file]" );
break;
}
dwProcessId = atoi( argv[1] );
if( dwProcessId == 0 )
BREAK_WITH_ERROR( "Please pass in a valid process ID" );
if( argc >= 3 )
cpDllFile = argv[2];
hFile = CreateFileA( cpDllFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( hFile == INVALID_HANDLE_VALUE )
BREAK_WITH_ERROR( "Failed to open the DLL file" );
dwLength = GetFileSize( hFile, NULL );
if( dwLength == INVALID_FILE_SIZE )
BREAK_WITH_ERROR( "Failed to get the DLL file size" );
lpBuffer = HeapAlloc( GetProcessHeap(), 0, dwLength );
if( !lpBuffer )
BREAK_WITH_ERROR( "Failed to get the DLL file size" );
if( ReadFile( hFile, lpBuffer, dwLength, &dwBytesRead, NULL ) == FALSE )
BREAK_WITH_ERROR( "Failed to alloc a buffer!" );
hProcess = OpenProcess( PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, dwProcessId );
if( !hProcess )
BREAK_WITH_ERROR( "Failed to open the target process" );
hModule = LoadRemoteLibraryR( hProcess, lpBuffer, dwLength, NULL );
if( !hModule )
BREAK_WITH_ERROR( "Failed to inject the DLL" );
printf( "[+] Injected the '%s' DLL into process %d.", cpDllFile, dwProcessId );
} while( 0 );
if( lpBuffer )
HeapFree( GetProcessHeap(), 0, lpBuffer );
if( hProcess )
CloseHandle( hProcess );
return 0;
} |
/*
* Copyright (c) 2014, ARM Limited and Contributors. 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 ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __XLAT_TABLES_H__
#define __XLAT_TABLES_H__
#include <stdint.h>
/*
* Flags for building up memory mapping attributes.
* These are organised so that a clear bit gives a more restrictive mapping
* that a set bit, that way a bitwise-and two sets of attributes will never give
* an attribute which has greater access rights that any of the original
* attributes.
*/
typedef enum {
MT_DEVICE = 0 << 0,
MT_MEMORY = 1 << 0,
MT_RO = 0 << 1,
MT_RW = 1 << 1,
MT_SECURE = 0 << 2,
MT_NS = 1 << 2
} mmap_attr;
/*
* Structure for specifying a single region of memory.
*/
typedef struct {
unsigned long base;
unsigned long size;
mmap_attr attr;
} mmap_region;
extern void mmap_add_region(unsigned long base, unsigned long size,
unsigned attr);
extern void mmap_add(const mmap_region *mm);
extern void init_xlat_tables(void);
extern uint64_t l1_xlation_table[];
#endif /* __XLAT_TABLES_H__ */
|
// FaceTools.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#pragma once
void MeshFace(TopoDS_Face face, double pixels_per_mm);
void DrawFace(TopoDS_Face face,void(*callbackfunc)(const double* x, const double* n), bool just_one_average_normal);
void DrawFaceWithCommands(TopoDS_Face face);
gp_Dir GetFaceNormalAtUV(const TopoDS_Face &face, double u, double v, gp_Pnt *pos);
|
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MediaKeyError_h
#define MediaKeyError_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
namespace blink {
class MediaKeyError FINAL : public RefCountedWillBeGarbageCollectedFinalized<MediaKeyError>, public ScriptWrappable {
public:
enum {
MEDIA_KEYERR_UNKNOWN = 1,
MEDIA_KEYERR_CLIENT,
MEDIA_KEYERR_SERVICE,
MEDIA_KEYERR_OUTPUT,
MEDIA_KEYERR_HARDWARECHANGE,
MEDIA_KEYERR_DOMAIN
};
typedef unsigned short Code;
static PassRefPtrWillBeRawPtr<MediaKeyError> create(Code code, unsigned long systemCode = 0)
{
return adoptRefWillBeNoop(new MediaKeyError(code, systemCode));
}
Code code() const { return m_code; }
unsigned long systemCode() { return m_systemCode; }
void trace(Visitor*) { }
private:
MediaKeyError(Code code, unsigned long systemCode) : m_code(code), m_systemCode(systemCode)
{
ScriptWrappable::init(this);
}
Code m_code;
unsigned long m_systemCode;
};
} // namespace blink
#endif
|
/*
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
* This file is used to generate the function stubs for ibprof.
* Each suffix (e.g. NONE, PROF, ERR, etc.) signifies a run-time
* option for ibprof callbacks. In order to add a new option,
* all that is required is to add the following three macros:
*
* #define PRE_SUFFIX
* - what to do before the original is called
* #define POST_SUFFIX(func_name)
* - what to do after the original is called (w/o a return value)
* #define POST_RET_SUFFIX(func_name)
* - what to do after the original is called (return value is "ret")
*
* Also, need to add a single line using this macro in the .c file.
*/
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((uintptr_t) &((TYPE *)0)->MEMBER)
#endif
#define PRETEND_USED(var) do { (void)(var); } while (0)
/* Mock mode - do nothing (can be used to compare run-time against no-ibprof runs) */
#define PRE_NONE(func_name)
#define POST_NONE(func_name)
#define POST_RET_NONE(func_name)
/* Verbose mode - output the name of the functions entered and left */
#define PRE_VERBOSE(func_name) IBPROF_TRACE("IN %s:%s\n", __FILE__, __FUNCTION__);
#define POST_VERBOSE(func_name) PRETEND_USED(flip_ret); \
IBPROF_TRACE("OUT %s:%s\n", __FILE__, __FUNCTION__);
#define POST_RET_VERBOSE(func_name) PRETEND_USED(flip_ret); \
IBPROF_TRACE("OUT %s:%s\n", __FILE__, __FUNCTION__);
/* Profiling mode - collect timing information about function run-times */
#define PRE_PROF(func_name) \
double tm_start; \
tm_start = ibprof_timestamp();
#define POST_PROF(func_name) \
ibprof_update(IBPROF_MODULE_MXM, TBL_CALL_NUMBER(func_name), \
ibprof_timestamp_diff(tm_start));
#define POST_RET_PROF(func_name) \
ibprof_update(IBPROF_MODULE_MXM, TBL_CALL_NUMBER(func_name), \
ibprof_timestamp_diff(tm_start));
/* Error-injection mode - return an error with some probability */
#define PRE_ERR(func_name) \
double tm_start; \
int64_t err = 0; \
tm_start = ibprof_timestamp();
#define POST_ERR(func_name) \
ibprof_update_ex(IBPROF_MODULE_MXM, TBL_CALL_NUMBER(func_name), \
ibprof_timestamp_diff(tm_start), &err);
#define POST_RET_ERR(func_name) \
if ((rand() % 100) < ibprof_conf_get_int(IBPROF_ERR_PERCENT)) ret = (flip_ret ? ((typeof(ret))1) : ((typeof(ret))0)); \
err = (flip_ret ? (ret != 0) : (ret == 0)); \
ibprof_update_ex(IBPROF_MODULE_MXM, TBL_CALL_NUMBER(func_name), \
ibprof_timestamp_diff(tm_start), &err);
/* TODO: Stack-tracing mode - collect information about the origin of function calls */
#define PRE_TRACE(func_name)
#define POST_TRACE(func_name)
#define POST_RET_TRACE(func_name)
/*
* Common macros, presenting the function stubs
*/
#define PRE_(func_name) f = mxm_module_context.mean.func_name;
#define POST_(func_name)
#define POST_RET_(func_name)
#define FUNC_BODY_INT(type, func_name, ...) \
int ret; \
int flip_ret = 1; \
EMPLOY_TYPE(func_name) *f; \
f = mxm_module_context.noble.func_name; \
PRE_##type(func_name) \
INTERNAL_CHECK(); \
ret = f(__VA_ARGS__); \
POST_RET_##type(func_name) \
PRETEND_USED(flip_ret); \
return ret;
#define FUNC_BODY_VOID(type, func_name, ...) \
int flip_ret = 0; \
EMPLOY_TYPE(func_name) *f; \
f = mxm_module_context.noble.func_name; \
PRE_##type(func_name) \
INTERNAL_CHECK(); \
f(__VA_ARGS__); \
POST_##type(func_name) \
PRETEND_USED(flip_ret);
#define FUNC_BODY_PTR(type, func_name, ...) \
void* ret; \
int flip_ret = 0; \
EMPLOY_TYPE(func_name) *f; \
f = mxm_module_context.noble.func_name; \
PRE_##type(func_name) \
INTERNAL_CHECK(); \
ret = f(__VA_ARGS__); \
POST_RET_##type(func_name) \
PRETEND_USED(flip_ret); \
return ret;
#define EMPLOY_TYPE(func_name) __type_of_##func_name
#define DECLARE_TYPE(func_name) \
typedef typeof(func_name) EMPLOY_TYPE(func_name);
#define DECLARE_STRUCT_MEMBER(func_name) \
EMPLOY_TYPE(func_name) * func_name;
#define TBL_CALL_NUMBER(func_name) \
offsetof(struct mxm_module_api_t, func_name) / sizeof(void*)
#define TBL_CALL_ENRTY(func_name) \
{ TBL_CALL_NUMBER(func_name), #func_name, NULL},
|
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Console output module for Chrome EC */
#include "console.h"
#include "uart.h"
#include "usb_console.h"
#include "util.h"
/* Default to all channels active */
#ifndef CC_DEFAULT
#define CC_DEFAULT CC_ALL
#endif
static uint32_t channel_mask = CC_DEFAULT;
static uint32_t channel_mask_saved = CC_DEFAULT;
/*
* List of channel names; must match enum console_channel.
*
* We could do something fancy and macro-y with this like ec.tasklist, so that
* the channel name list and console_channel enum come from the same header
* file. That's clever, but I'm not convinced it's more readable or
* maintainable than the two simple lists we have now.
*
* We could also try to get clever with #ifdefs or board-specific lists of
* channel names, so that for example boards without port80 support don't waste
* binary size on the channel name string for "port80". Pruning the channel
* list might also become more important if we have >32 channels - for example,
* if we decide to replace enum console_channel with enum module_id.
*/
static const char * const channel_names[] = {
"command",
"accel",
"charger",
"chipset",
"clock",
"dma",
"events",
"gesture",
"gpio",
"hostcmd",
"i2c",
"keyboard",
"keyscan",
"lidangle",
#ifdef HAS_TASK_LIGHTBAR
"lightbar",
#endif
"lpc",
"motionlid",
"motionsense",
#ifdef HAS_TASK_PDCMD
"pdhostcmd",
#endif
"port80",
"pwm",
"spi",
#ifdef CONFIG_SPS
"sps",
#endif
"switch",
"system",
"task",
"thermal",
"tpm",
"usb",
"usbcharge",
"usbpd",
"vboot",
"hook",
};
BUILD_ASSERT(ARRAY_SIZE(channel_names) == CC_CHANNEL_COUNT);
/* ensure that we are not silently masking additional channels */
BUILD_ASSERT(CC_CHANNEL_COUNT <= 8*sizeof(uint32_t));
/*****************************************************************************/
/* Channel-based console output */
int cputs(enum console_channel channel, const char *outstr)
{
int rv1, rv2;
/* Filter out inactive channels */
if (!(CC_MASK(channel) & channel_mask))
return EC_SUCCESS;
rv1 = usb_puts(outstr);
rv2 = uart_puts(outstr);
return rv1 == EC_SUCCESS ? rv2 : rv1;
}
int cprintf(enum console_channel channel, const char *format, ...)
{
int rv1, rv2;
va_list args;
/* Filter out inactive channels */
if (!(CC_MASK(channel) & channel_mask))
return EC_SUCCESS;
usb_va_start(args, format);
rv1 = usb_vprintf(format, args);
usb_va_end(args);
va_start(args, format);
rv2 = uart_vprintf(format, args);
va_end(args);
return rv1 == EC_SUCCESS ? rv2 : rv1;
}
int cprints(enum console_channel channel, const char *format, ...)
{
int r, rv;
va_list args;
/* Filter out inactive channels */
if (!(CC_MASK(channel) & channel_mask))
return EC_SUCCESS;
rv = cprintf(channel, "[%T ");
va_start(args, format);
r = uart_vprintf(format, args);
if (r)
rv = r;
va_end(args);
usb_va_start(args, format);
r = usb_vprintf(format, args);
if (r)
rv = r;
usb_va_end(args);
r = cputs(channel, "]\n");
return r ? r : rv;
}
void cflush(void)
{
uart_flush_output();
}
/*****************************************************************************/
/* Console commands */
/* Set active channels */
static int command_ch(int argc, char **argv)
{
int i;
char *e;
/* If one arg, save / restore, or set the mask */
if (argc == 2) {
if (strcasecmp(argv[1], "save") == 0) {
channel_mask_saved = channel_mask;
return EC_SUCCESS;
} else if (strcasecmp(argv[1], "restore") == 0) {
channel_mask = channel_mask_saved;
return EC_SUCCESS;
} else {
/* Set the mask */
int m = strtoi(argv[1], &e, 0);
if (*e)
return EC_ERROR_PARAM1;
/* No disabling the command output channel */
channel_mask = m | CC_MASK(CC_COMMAND);
return EC_SUCCESS;
}
}
/* Print the list of channels */
ccputs(" # Mask E Channel\n");
for (i = 0; i < CC_CHANNEL_COUNT; i++) {
ccprintf("%2d %08x %c %s\n",
i, CC_MASK(i),
(channel_mask & CC_MASK(i)) ? '*' : ' ',
channel_names[i]);
cflush();
}
return EC_SUCCESS;
};
DECLARE_CONSOLE_COMMAND(chan, command_ch,
"[ save | restore | <mask> ]",
"Save, restore, get or set console channel mask",
NULL);
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cat_13.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml
Template File: sources-sink-13.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: cat
* BadSink : Copy string to data using wcscat
* Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cat_13_bad()
{
wchar_t * data;
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
if(GLOBAL_CONST_FIVE==5)
{
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */
wcscat(data, source);
printWLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_FIVE==5 to GLOBAL_CONST_FIVE!=5 */
static void goodG2B1()
{
wchar_t * data;
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
if(GLOBAL_CONST_FIVE!=5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */
wcscat(data, source);
printWLine(data);
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBadBuffer[50];
wchar_t dataGoodBuffer[100];
if(GLOBAL_CONST_FIVE==5)
{
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */
wcscat(data, source);
printWLine(data);
}
}
void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cat_13_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cat_13_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_declare_cat_13_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#import "CLPUIObject.h"
@interface CLPUIPlugin : CLPUIObject
@property (nonatomic, assign, readwrite, getter=isEnabled) BOOL enabled;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE126_Buffer_Overread__CWE129_connect_socket_68b.c
Label Definition File: CWE126_Buffer_Overread__CWE129.label.xml
Template File: sources-sinks-68b.tmpl.c
*/
/*
* @description
* CWE: 126 Buffer Overread
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Larger than zero but less than 10
* Sinks:
* GoodSink: Ensure the array index is valid
* BadSink : Improperly check the array index by not checking the upper bound
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
extern int CWE126_Buffer_Overread__CWE129_connect_socket_68_badData;
extern int CWE126_Buffer_Overread__CWE129_connect_socket_68_goodG2BData;
extern int CWE126_Buffer_Overread__CWE129_connect_socket_68_goodB2GData;
#ifndef OMITBAD
void CWE126_Buffer_Overread__CWE129_connect_socket_68b_badSink()
{
int data = CWE126_Buffer_Overread__CWE129_connect_socket_68_badData;
{
int buffer[10] = { 0 };
/* POTENTIAL FLAW: Attempt to access an index of the array that is above the upper bound
* This check does not check the upper bounds of the array index */
if (data >= 0)
{
printIntLine(buffer[data]);
}
else
{
printLine("ERROR: Array index is negative");
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE126_Buffer_Overread__CWE129_connect_socket_68b_goodG2BSink()
{
int data = CWE126_Buffer_Overread__CWE129_connect_socket_68_goodG2BData;
{
int buffer[10] = { 0 };
/* POTENTIAL FLAW: Attempt to access an index of the array that is above the upper bound
* This check does not check the upper bounds of the array index */
if (data >= 0)
{
printIntLine(buffer[data]);
}
else
{
printLine("ERROR: Array index is negative");
}
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE126_Buffer_Overread__CWE129_connect_socket_68b_goodB2GSink()
{
int data = CWE126_Buffer_Overread__CWE129_connect_socket_68_goodB2GData;
{
int buffer[10] = { 0 };
/* FIX: Properly validate the array index and prevent a buffer overread */
if (data >= 0 && data < (10))
{
printIntLine(buffer[data]);
}
else
{
printLine("ERROR: Array index is out-of-bounds");
}
}
}
#endif /* OMITGOOD */
|
#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"
@interface CPTestAppPieChartController : UIViewController <CPPieChartDataSource>
{
@private
CPXYGraph *pieChart;
NSMutableArray *dataForChart;
}
@property(readwrite, retain, nonatomic) NSMutableArray *dataForChart;
@end
|
#include <framebuffer.h>
#include <hthread.h>
#include <stream.h>
#include <stdio.h>
extern int pixelate_run;
void* pixelate_thread( void *arg )
{
framebuffer_t *frame;
stream_node_t *node;
// Get the argument to the thread
node = (stream_node_t*)arg;
// Make sure that the input buffer is valid
if( node->input == NULL )
{
fprintf(stderr,"sobel node must be used with a valid input buffer\n");
exit(1 );
}
// Make sure that the output buffer is valid
if( node->output == NULL )
{
fprintf(stderr,"sobel node must be used with a valid output buffer\n");
exit(1 );
}
// Run the sobel thread
while( 1 )
{
// Get an image from the input buffer
frame = buffer_remove( node->input );
// Determine if we should stop processing
if( frame != NULL && pixelate_run )
{
// Process the image if we can otherwise pass on the input image
framebuffer_pixelate( frame, 4, 4 );
}
// Place the image on the output buffer
buffer_insert( node->output, frame );
}
// Finish running the thread
return NULL;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.