text stringlengths 4 6.14k |
|---|
// *************************************************************************
//
// Copyright 2004-2010 Bruno PAGES .
//
// This file is part of the BOUML Uml Toolkit.
//
// 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.
//
// e-mail : bouml@free.fr
// home : http://bouml.free.fr
//
// *************************************************************************
#ifndef UMLCOMPONENT_H
#define UMLCOMPONENT_H
#include "UmlBaseComponent.h"
//Added by qt3to4:
#include <Q3CString>
class UmlPackage;
// This class manages 'components'
// You can modify it as you want (except the constructor)
class UmlComponent : public UmlBaseComponent {
public:
UmlComponent(void * id, const Q3CString & n)
: UmlBaseComponent(id, n) { };
};
#endif
|
/*
* Copyright (C) 2012-2016 Jacob R. Lifshay
* This file is part of GamePuzzle.
*
* GamePuzzle is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GamePuzzle 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 GamePuzzle; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef SUBGAME_MAIN_MAIN_H_
#define SUBGAME_MAIN_MAIN_H_
#include "subgame/subgame.h"
#include "subgame/main/connection.h"
#include "subgame/main/machine.h"
#include "subgame/main/door.h"
#include "subgame/main/toggle_switch.h"
#include "subgame/main/and_gate.h"
#include "subgame/main/or_gate.h"
#include "subgame/main/run_game.h"
#include "ui/label.h"
namespace programmerjake
{
namespace game_puzzle
{
namespace subgames
{
namespace main
{
class MainGame final : public Subgame
{
private:
std::shared_ptr<Audio> backgroundMusic;
std::shared_ptr<Audio> doorOpenSound;
std::shared_ptr<Door> door;
std::vector<std::shared_ptr<Machine>> machines;
std::shared_ptr<ui::Label> instructionsLabel;
bool didReset = false;
float doorPosition = -0.4;
float afterOpenTimeLeft = 1;
bool doorOpen = false;
public:
MainGame(std::shared_ptr<GameState> gameState, ui::GameUi *gameUi);
virtual std::shared_ptr<PlayingAudio> startBackgroundMusic() override
{
return backgroundMusic->play();
}
void addMachine(std::shared_ptr<Machine> machine)
{
machines.push_back(machine);
if(didReset)
{
add(machine);
add(machine->output);
machine->output->layout();
}
}
virtual void reset() override
{
didReset = true;
std::vector<std::shared_ptr<Element>> elements(begin(), end());
for(std::shared_ptr<Element> e : elements)
{
remove(e);
}
for(auto &machine : machines)
{
add(machine);
add(machine->output);
machine->output->layout();
}
add(instructionsLabel);
Subgame::reset();
}
virtual void layout() override
{
instructionsLabel->moveBottomTo(minY);
Subgame::layout();
}
virtual void move(double deltaTime) override
{
Subgame::move(deltaTime);
if(door->open.get())
{
if(!doorOpen)
doorOpenSound->play()->detach();
doorOpen = true;
}
if(doorOpen)
{
if(doorPosition < 1)
{
doorPosition += deltaTime;
if(doorPosition > 1)
doorPosition = 1;
}
else if(afterOpenTimeLeft > 0)
{
afterOpenTimeLeft -= deltaTime;
}
else
{
quit();
}
}
}
virtual void clear(Renderer &renderer) override;
};
}
}
}
}
#endif /* SUBGAME_MAIN_MAIN_H_ */
|
/*******************************************************************************
* Userspace Tunnel with Firewall 1.0. *
* Copyright (C) 2011-averyfarwaydate Luca Bertoncello *
* Hartigstrasse, 12 - 01127 Dresden Deutschland *
* E-Mail: lucabert@lucabert.de, lucabert@lucabert.com *
* http://www.lucabert.de/ http://www.lucabert.com/ *
* *
* Based on the idea from: http://code.google.com/p/tb-tun/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
*******************************************************************************/
#ifndef CTRL_H_
#define CTRL_H_
#define SHM_CTRLID 6667
enum ctrlCommand
{
NOCMD, GETINFO, SETVERBOSE, QUIT, GETCONNTRACKS, FLUSHCONNTRACKS, DELETECONNTRACK
};
struct ctrlMem
{
enum ctrlCommand cmd;
char param[255];
uint8_t executeCmd : 1;
uint8_t validAnswer : 1;
uint8_t lastAnswer : 1;
uint8_t gotAnswer : 1;
char answer[1024];
};
#ifdef SOURCE_ctrl
int shmctrlid;
struct ctrlMem *shmCtrl;
#else
extern struct ctrlMem *shmCtrl;
#endif
/**
* Manage the control thread
*
* @param void *args Connection's data
*/
void ctrl(void *args);
/**
* Send the answer to the control program and
* wait until it got it
*/
void sendAnswer(void);
/**
* Free the allocated shared memory for the control interface
*
* @return int 0 if no error, -1 if errors
*/
int freeCtrlSpace();
/**
* Destroy the allocated shared memory for the control interface
*
* @return int 0 if no error, -1 if errors
*/
int destroyCtrlSpace();
/**
* Get to from server allocated shared memory for the control interface
*
* @return int 0 if no error, -1 if errors
*/
int bindToCtrlSpace(void);
#endif // CTRL_H_
|
/************************************************************************
* *
* Copyright (C) 2009 by Geir Erikstad *
* geirr@baldr.no *
* *
* This file is part of Niflheim. *
* *
* Niflheim 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. *
* *
* Niflheim 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 Niflheim. If not, see <http://www.gnu.org/licenses/>. *
* *
************************************************************************/
#ifndef GINNUNGAGAP_AVATARPROXY_H
#define GINNUNGAGAP_AVATARPROXY_H
#include <Proxy.h>
#include "Avatar.h"
#include "Uuid.h"
namespace ggg
{
class AvatarProxy : public Proxy, public niflheim::Avatar
{
public:
AvatarProxy(const Uuid& objectId);
~AvatarProxy();
/* Event */
void updateView(const niflheim::AvatarsView& avatarsView);
void move(const niflheim::Direction& direction);
void changeWorld(const ggg::dist_ptr<niflheim::World>& newWorld);
void deactivate();
void activate();
void deleteAvatar();
};
}
#endif
|
//
// UnicodeConverter.h
//
// $Id: //poco/svn/Foundation/include/Poco/UnicodeConverter.h#2 $
//
// Library: Foundation
// Package: Text
// Module: UnicodeConverter
//
// Definition of the UnicodeConverter class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Foundation_UnicodeConverter_INCLUDED
#define Foundation_UnicodeConverter_INCLUDED
#include "Poco/Foundation.h"
namespace Poco {
class Foundation_API UnicodeConverter
/// A convenience class that converts strings from
/// UTF-8 encoded std::strings to UTF-16 encoded std::wstrings
/// and vice-versa.
///
/// This class is mainly used for working with the Unicode Windows APIs
/// and probably won't be of much use anywhere else.
{
public:
static void toUTF16(const std::string& utf8String, std::wstring& utf16String);
/// Converts the given UTF-8 encoded string into an UTF-16 encoded wstring.
static void toUTF16(const char* utf8String, int length, std::wstring& utf16String);
/// Converts the given UTF-8 encoded character sequence into an UTF-16 encoded string.
static void toUTF16(const char* utf8String, std::wstring& utf16String);
/// Converts the given zero-terminated UTF-8 encoded character sequence into an UTF-16 encoded wstring.
static void toUTF8(const std::wstring& utf16String, std::string& utf8String);
/// Converts the given UTF-16 encoded wstring into an UTF-8 encoded string.
static void toUTF8(const wchar_t* utf16String, int length, std::string& utf8String);
/// Converts the given zero-terminated UTF-16 encoded wide character sequence into an UTF-8 encoded wstring.
static void toUTF8(const wchar_t* utf16String, std::string& utf8String);
/// Converts the given UTF-16 encoded zero terminated character sequence into an UTF-8 encoded string.
};
} // namespace Poco
#endif // Foundation_UnicodeConverter_INCLUDED
|
//
// Created by Matthias Stumpp on 03.06.13.
// Copyright (c) 2013 Matthias Stumpp. All rights reserved.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import <Foundation/Foundation.h>
#import "APPFetchEntryByInsertingEntryQuery.h"
@interface APPVideoUnlikeVideo : APPFetchEntryByInsertingEntryQuery
@end |
/*
*
* Copyright (c) National ICT Australia, 2006
*
* 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
*/
/* NICTA */
/* 13/02/2006 Implemented carl.vanschaik at nicta.com.au */
/* mem03.c */
/*
* NAME
* mem03.c
*
* DESCRIPTION
* - create two files, write known data to the files.
* - mmap the files, verify data
* - unmap files
* - remmap files, swap virtual addresses ie: file1 at file2's address, etc
*
* REASONING
* - If the kernel fails to correctly flush the TLB entry, the second mmap
* will not show the correct data.
*
*
* RESTRICTIONS
* None
*/
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include "test.h"
#include "usctest.h"
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h> /* definitions for open() */
#include <sys/mman.h> /* definitions for mmap() */
#include <fcntl.h> /* definition of open() */
#include <sys/user.h>
#define FAILED (-1) /* return status for all funcs indicating failure */
#define SUCCESS 0 /* return status for all routines indicating success */
static void setup();
static void cleanup();
char *TCID = "mem03"; /* Test program identifier. */
int TST_TOTAL = 1; /* Total number of test cases. */
int f1 = -1, f2 = -1;
char *mm1 = NULL, *mm2 = NULL;
/*--------------------------------------------------------------------*/
int main()
{
char tmp1[] = "./tmp.file.1";
char tmp2[] = "./tmp.file.2";
char str1[] = "testing 123";
char str2[] = "my test mem";
setup();
if ((f1 = open(tmp1, O_RDWR | O_CREAT, S_IREAD | S_IWRITE)) == -1)
tst_brkm(TFAIL, cleanup, "failed to open/create file %s", tmp1);
if ((f2 = open(tmp2, O_RDWR | O_CREAT, S_IREAD | S_IWRITE)) == -1)
tst_brkm(TFAIL, cleanup, "failed to open/create file %s", tmp2);
write(f1, str1, strlen(str1));
write(f2, str2, strlen(str2));
{
char *save_mm1, *save_mm2;
mm1 = mmap(0, 64, PROT_READ, MAP_PRIVATE, f1, 0);
mm2 = mmap(0, 64, PROT_READ, MAP_PRIVATE, f2, 0);
if ((mm1 == (void *)-1) || (mm2 == (void *)-1))
tst_brkm(TFAIL, cleanup, "mmap failed");
save_mm1 = mm1;
save_mm2 = mm2;
if (strncmp(str1, mm1, strlen(str1)))
tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp1);
if (strncmp(str2, mm2, strlen(str2)))
tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp2);
munmap(mm1, 64);
munmap(mm2, 64);
mm1 = mmap(save_mm2, 64, PROT_READ, MAP_PRIVATE, f1, 0);
mm2 = mmap(save_mm1, 64, PROT_READ, MAP_PRIVATE, f2, 0);
if ((mm1 == (void *)-1) || (mm2 == (void *)-1))
tst_brkm(TFAIL, cleanup, "second mmap failed");
if (mm1 != save_mm2) {
printf("mmap not using same address\n");
}
if (mm2 != save_mm1) {
printf("mmap not using same address\n");
}
if (strncmp(str1, mm1, strlen(str1)))
tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp1);
if (strncmp(str2, mm2, strlen(str2)))
tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp2);
munmap(mm1, 64);
munmap(mm2, 64);
}
tst_resm(TPASS, "%s memory test succeeded", TCID);
/* clean up and exit */
cleanup();
tst_exit();
}
/*
* setup() - performs all ONE TIME setup for this test
*/
void setup(void)
{
/*
* Create a temporary directory and cd into it.
*/
tst_tmpdir();
}
/*
* cleanup() - performs all the ONE TIME cleanup for this test at completion
* or premature exit.
*/
void cleanup(void)
{
if (mm1)
munmap(mm1, 64);
if (mm2)
munmap(mm2, 64);
if (f1 != -1)
close(f1);
if (f2 != -1)
close(f2);
tst_rmdir();
} |
#ifndef COIN_SOPOLYGONOFFSETELEMENT_H
#define COIN_SOPOLYGONOFFSETELEMENT_H
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg SIM about acquiring
* a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
#include <Inventor/elements/SoReplacedElement.h>
class COIN_DLL_API SoPolygonOffsetElement : public SoReplacedElement {
typedef SoReplacedElement inherited;
SO_ELEMENT_HEADER(SoPolygonOffsetElement);
public:
static void initClass(void);
protected:
virtual ~SoPolygonOffsetElement();
public:
enum Style {
FILLED = 0x01,
LINES = 0x02,
POINTS = 0x04
};
virtual void init(SoState * state);
static void set(SoState * state, SoNode * node, float factor, float units,
Style styles, SbBool on);
static void get(SoState * state, float & factor, float & units,
Style & styles, SbBool & on);
static void getDefault(float & factor, float & units, Style & styles,
SbBool & on);
protected:
Style style;
SbBool active;
float offsetfactor;
float offsetunits;
virtual void setElt(float factor, float units, Style styles, SbBool on);
};
#endif // !COIN_SOPOLYGONOFFSETELEMENT_H
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by IDA_SYNC_PLUGIN.rc
//
#define IDS_PLUGIN_TITLE 100
#define IDS_PLUGIN_HELP 101
#define IDS_PLUGIN_COMMENT 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif
|
/*
* Copyright (c) 2010, STMicroelectronics.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the Contiki OS
*
* $Id: button-sensor.c,v 1.1 2010/10/25 09:03:39 salvopitru Exp $
*/
/*---------------------------------------------------------------------------*/
/**
* \file
* Button sensor.
* \author
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
*/
/*---------------------------------------------------------------------------*/
#include "dev/button-sensor.h"
#include "hal.h"
#include "hal/micro/micro-common.h"
#include "hal/micro/cortexm3/micro-common.h"
#include BOARD_HEADER
#define DEBOUNCE 1
#if DEBOUNCE
static struct timer debouncetimer;
#endif
#define FALSE 0
#define TRUE 1
uint8_t button_flags = 0;
#define BUTTON_ACTIVE_FLG 0x01
#define BUTTON_PRESSED_FLG 0x02
#define BUTTON_HAS_BEEN_PRESSED() (button_flags & BUTTON_PRESSED_FLG)
#define BUTTON_HAS_BEEN_RELEASED() (!(button_flags & BUTTON_PRESSED_FLG))
#define BUTTON_SET_PRESSED() (button_flags |= BUTTON_PRESSED_FLG)
#define BUTTON_SET_RELEASED() (button_flags &= ~BUTTON_PRESSED_FLG)
/*---------------------------------------------------------------------------*/
static void
init(void)
{
#if DEBOUNCE
timer_set(&debouncetimer, 0);
#endif
/* Configure GPIO for BUTTONSs */
halInitButton();
}
/*---------------------------------------------------------------------------*/
static void
activate(void)
{
button_flags |= BUTTON_ACTIVE_FLG;
}
/*---------------------------------------------------------------------------*/
static void
deactivate(void)
{
button_flags &= ~BUTTON_ACTIVE_FLG;
}
/*---------------------------------------------------------------------------*/
static int
active(void)
{
return (button_flags & BUTTON_ACTIVE_FLG)? 1 : 0;
}
/*---------------------------------------------------------------------------*/
static int
value(int type)
{
if(!active()){
return 0;
}
#if DEBOUNCE
if(timer_expired(&debouncetimer)) {
if(halGetButtonStatus(BUTTON_S1) == BUTTON_PRESSED){
timer_set(&debouncetimer, CLOCK_SECOND / 10);
if(BUTTON_HAS_BEEN_RELEASED()){ // Button has been previously released.
sensors_changed(&button_sensor);
}
BUTTON_SET_PRESSED();
return 1;
}
else {
BUTTON_SET_RELEASED();
return 0;
}
}
else {
return 0;
}
#else
if(halGetButtonStatus(BUTTON_S1) == BUTTON_PRESSED){
sensors_changed(&button_sensor);
return 1;
}
else {
return 0;
}
#endif
}
/*---------------------------------------------------------------------------*/
static int
configure(int type, int value)
{
switch(type){
case SENSORS_HW_INIT:
init();
return 1;
case SENSORS_ACTIVE:
if(value)
activate();
else
deactivate();
return 1;
}
return 0;
}
/*---------------------------------------------------------------------------*/
static int
status(int type)
{
switch(type) {
case SENSORS_READY:
return active();
}
return 0;
}
/*---------------------------------------------------------------------------*/
#if 0
void BUTTON_S1_ISR(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
//sensors_handle_irq(IRQ_BUTTON);
if(INT_GPIOFLAG & BUTTON_S1_FLAG_BIT) {
#if DEBOUNCE
if(timer_expired(&debouncetimer)) {
timer_set(&debouncetimer, CLOCK_SECOND / 5);
sensors_changed(&button_sensor);
}
#else
sensors_changed(&button_sensor);
#endif
}
INT_GPIOFLAG = BUTTON_S1_FLAG_BIT;
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
#endif
/*---------------------------------------------------------------------------*/
SENSORS_SENSOR(button_sensor, BUTTON_SENSOR,
value, configure, status);
|
//
// Copyright (c) 2009, Markus Rickert
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef _RL_HAL_SCHUNKFPSF5_H_
#define _RL_HAL_SCHUNKFPSF5_H_
#include <set>
#include "RangeSensor.h"
#include "Serial.h"
#include "types.h"
namespace rl
{
namespace hal
{
class SchunkFpsF5 : public RangeSensor
{
public:
SchunkFpsF5(const ::std::string& device = "/dev/ttyS0");
virtual ~SchunkFpsF5();
void close();
void getDistances(::rl::math::Vector& distances) const;
::std::size_t getDistancesCount() const;
::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
::rl::math::Real getTemperature() const;
::rl::math::Real getVoltage() const;
bool isA() const;
bool isArea() const;
bool isB() const;
bool isC() const;
bool isClosed() const;
bool isOpened() const;
bool isReCalc() const;
bool isRecord() const;
bool isUpdate() const;
void open();
void start();
void step();
void stop();
protected:
private:
uint16_t crc(const uint8_t* buf, const ::std::size_t& len) const;
::std::size_t recv(uint8_t* buf, const ::std::size_t& len, const uint8_t& command);
void send(uint8_t* buf, const ::std::size_t& len);
bool a;
bool area;
bool b;
bool c;
bool closed;
::std::set< ::std::pair< ::rl::math::Real, ::rl::math::Real > > fulcrums;
::rl::math::Real interpolated;
bool opened;
bool reCalc;
bool record;
Serial serial;
::rl::math::Real temperature;
bool update;
::rl::math::Real value;
::rl::math::Real voltage;
};
}
}
#endif // _RL_HAL_SCHUNKFPSF5_H_
|
/*
* ======== imports ========
*/
/*
* ======== forward declarations for intrinsics ========
*/
void test122_TestProg_pollen__reset__E();
void test122_TestProg_pollen__ready__E();
void test122_TestProg_pollen__shutdown__E(uint8 i);
/*
* ======== extern definition ========
*/
extern struct test122_SleepWakeImpl_ test122_SleepWakeImpl;
/*
* ======== struct module definition (unit SleepWakeImpl) ========
*/
struct test122_SleepWakeImpl_ {
};
typedef struct test122_SleepWakeImpl_ test122_SleepWakeImpl_;
/*
* ======== function members (unit SleepWakeImpl) ========
*/
extern void test122_SleepWakeImpl_sleep__E( uint8 mode );
extern void test122_SleepWakeImpl_wake__E();
extern void test122_SleepWakeImpl_targetInit__I();
/*
* ======== data members (unit SleepWakeImpl) ========
*/
|
/*
* WengoPhone, a voice over Internet phone
* Copyright (C) 2004-2006 Wengo
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OWLIST_H
#define OWLIST_H
#include <vector>
#include <algorithm>
/**
* List.
*
* @see java.util.List<E>
* @see QList
* @author Tanguy Krotoff
*/
template<typename T>
class List : public std::vector<T> {
public:
/**
* Appends the specified element to the end of this list.
*
* @param element element to be appended to this list
*/
void operator+=(const T & element) {
this->push_back(element);
}
/**
* Removes the first occurrence in this list of the specified element.
*
* Does not delete the element, just remove it from the list.
*
* @param element to remove from the list
* @return true if the element was removed; false otherwise
*/
bool remove(const T & element) {
typename std::vector<T>::iterator it = std::find(this->begin(), this->end(), element);
if (it != this->end()) {
this->erase(it);
return true;
}
return false;
}
/**
* @see remove()
*/
bool operator-=(const T & element) {
return remove(element);
}
/**
* Gets the number of occurrences of an element contained in this list.
*
* @param element element to find inside this list
* @return number of occurrences of the specified element contained in this list
*/
unsigned contains(const T & element) const {
unsigned j = 0;
for (unsigned i = 0; i < this->size(); i++) {
if ((*this)[i] == element) {
j++;
}
}
return j;
}
};
#endif //OWLIST_H
|
/**
******************************************************************************
* @file FatFs/FatFs_uSD_RTOS/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.0.1
* @date 26-February-2014
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
extern void xPortSysTickHandler(void);
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
xPortSysTickHandler();
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles DMA2 Stream 3 interrupt request.
* @param None
* @retval None
*/
void DMA2_Stream3_IRQHandler(void)
{
BSP_SD_DMA_Rx_IRQHandler();
}
/**
* @brief This function handles DMA2 Stream 6 interrupt request.
* @param None
* @retval None
*/
void DMA2_Stream6_IRQHandler(void)
{
BSP_SD_DMA_Tx_IRQHandler();
}
/**
* @brief This function handles SDIO interrupt request.
* @param None
* @retval None
*/
void SDIO_IRQHandler(void)
{
BSP_SD_IRQHandler();
}
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Copyright (C) 2013-2020 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* This code is a complete clean re-write of the stress tool by
* Colin Ian King <colin.king@canonical.com> and attempts to be
* backwardly compatible with the stress tool by Amos Waterland
* <apw@rossby.metr.ou.edu> but has more stress tests and more
* functionality.
*
*/
#include "stress-ng.h"
static const stress_help_t help[] = {
{ NULL, "spawn N", "start N workers spawning stress-ng using posix_spawn" },
{ NULL, "spawn-ops N", "stop after N spawn bogo operations" },
{ NULL, NULL, NULL }
};
#if defined(HAVE_SPAWN_H) && \
defined(HAVE_POSIX_SPAWN)
/*
* stress_spawn_supported()
* check that we don't run this as root
*/
static int stress_spawn_supported(const char *name)
{
/*
* Don't want to run this when running as root as
* this could allow somebody to try and run another
* executable as root.
*/
if (geteuid() == 0) {
pr_inf("%s stressor must not run as root, skipping the stressor\n", name);
return -1;
}
return 0;
}
/*
* stress_spawn()
* stress by forking and spawn'ing
*/
static int stress_spawn(const stress_args_t *args)
{
char path[PATH_MAX + 1];
ssize_t len;
uint64_t spawn_fails = 0, spawn_calls = 0;
static char *argv_new[] = { NULL, "--exec-exit", NULL };
static char *env_new[] = { NULL };
/*
* Don't want to run this when running as root as
* this could allow somebody to try and run another
* spawnable process as root.
*/
if (geteuid() == 0) {
pr_inf("%s: running as root, won't run test.\n", args->name);
return EXIT_FAILURE;
}
/*
* Determine our own self as the spawnutable, e.g. run stress-ng
*/
len = readlink("/proc/self/exe", path, sizeof(path));
if (len < 0 || len > PATH_MAX) {
if (errno == ENOENT) {
pr_inf("%s: skipping stressor, can't determine stress-ng "
"executable name\n", args->name);
return EXIT_NOT_IMPLEMENTED;
}
pr_fail("%s: readlink on /proc/self/exe failed\n", args->name);
return EXIT_FAILURE;
}
path[len] = '\0';
argv_new[0] = path;
do {
int ret;
pid_t pid;
spawn_calls++;
ret = posix_spawn(&pid, path, NULL, NULL, argv_new, env_new);
if (ret < 0) {
pr_fail_err("posix_spawn()");
spawn_fails++;
} else {
int status;
/* Parent, wait for child */
(void)shim_waitpid(pid, &status, 0);
inc_counter(args);
if (WEXITSTATUS(status) != EXIT_SUCCESS)
spawn_fails++;
}
} while (keep_stressing());
if ((spawn_fails > 0) && (g_opt_flags & OPT_FLAGS_VERIFY)) {
pr_fail("%s: %" PRIu64 " spawns failed (%.2f%%)\n",
args->name, spawn_fails,
(double)spawn_fails * 100.0 / (double)(spawn_calls));
}
return EXIT_SUCCESS;
}
stressor_info_t stress_spawn_info = {
.stressor = stress_spawn,
.supported = stress_spawn_supported,
.class = CLASS_SCHEDULER | CLASS_OS,
.help = help
};
#else
stressor_info_t stress_spawn_info = {
.stressor = stress_not_implemented,
.class = CLASS_SCHEDULER | CLASS_OS,
.help = help
};
#endif
|
// Copyright (c) 2008 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// 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.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: https://github.com/CGAL/cgal/blob/releases/CGAL-4.14.1/GraphicsView/include/CGAL/Qt/PainterOstream.h $
// $Id: PainterOstream.h ee57fc2 %aI Sébastien Loriot
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Andreas Fabri <Andreas.Fabri@geometryfactory.com>
// Laurent Rineau <Laurent.Rineau@geometryfactory.com>
#ifndef CGAL_QT_PAINTER_OSTREAM_H
#define CGAL_QT_PAINTER_OSTREAM_H
#include <CGAL/license/GraphicsView.h>
#include <QPainter>
#include <QPen>
#include <QRectF>
#include <QPainterPath>
#include <CGAL/Qt/Converter.h>
namespace CGAL {
template <class CK>
class Circular_arc_point_2;
template <class CK>
class Circular_arc_2;
template <class CK>
class Line_arc_2;
namespace internal {
template < class K >
struct Is_circular_kernel : public has_Circular_arc_point_2< K >
{ };
template < class K, bool b = Is_circular_kernel< K >::value >
struct Circular_kernel_2_types
{
struct Circular_arc_point_2 { };
struct Circular_arc_2 { };
struct Line_arc_2 { };
};
template < class K >
struct Circular_kernel_2_types< K, true >
{
typedef typename K::Circular_arc_point_2 Circular_arc_point_2;
typedef typename K::Circular_arc_2 Circular_arc_2;
typedef typename K::Line_arc_2 Line_arc_2;
};
}
namespace Qt {
template <typename K>
class PainterOstream {
private:
QPainter* qp;
Converter<K> convert;
typedef typename K::Point_2 Point_2;
typedef typename K::Segment_2 Segment_2;
typedef typename K::Ray_2 Ray_2;
typedef typename K::Line_2 Line_2;
typedef typename K::Triangle_2 Triangle_2;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
typedef typename K::Circle_2 Circle_2;
typedef typename internal::Circular_kernel_2_types<K>::Circular_arc_point_2
Circular_arc_point_2;
typedef typename internal::Circular_kernel_2_types<K>::Circular_arc_2
Circular_arc_2;
typedef typename internal::Circular_kernel_2_types<K>::Line_arc_2
Line_arc_2;
public:
PainterOstream(QPainter* p, QRectF rect = QRectF())
: qp(p), convert(rect)
{}
PainterOstream& operator<<(const Point_2& p)
{
qp->drawPoint(convert(p));
return *this;
}
PainterOstream& operator<<(const Segment_2& s)
{
qp->drawLine(convert(s.source()), convert(s.target()));
return *this;
}
PainterOstream& operator<<(const Ray_2& r)
{
qp->drawLine(convert(r));
return *this;
}
PainterOstream& operator<<(const Line_2& l)
{
qp->drawLine(convert(l));
return *this;
}
PainterOstream& operator<<(const Triangle_2& t)
{
qp->drawPolygon(convert(t));
return *this;
}
PainterOstream& operator<<(const Iso_rectangle_2& r)
{
qp->drawRect(convert(r));
return *this;
}
PainterOstream& operator<<(const Bbox_2& bb)
{
qp->drawRect(convert(bb));
return *this;
}
PainterOstream& operator<<(const Circle_2& c)
{
qp->drawEllipse(convert(c.bbox()));
return *this;
}
PainterOstream& operator<<(const Circular_arc_point_2& p)
{
typedef typename K::Point_2 Point_2;
(*this) << Point_2(to_double(p.x()), to_double(p.y()));
return *this;
}
PainterOstream& operator<<(const Circular_arc_2& arc)
{
const typename K::Circle_2 & circ = arc.supporting_circle();
const typename K::Point_2 & center = circ.center();
const typename K::Circular_arc_point_2 & source = arc.source();
const typename K::Circular_arc_point_2 & target = arc.target();
double asource = std::atan2( -to_double(source.y() - center.y()),
to_double(source.x() - center.x()));
double atarget = std::atan2( -to_double(target.y() - center.y()),
to_double(target.x() - center.x()));
std::swap(asource, atarget);
double aspan = atarget - asource;
if(aspan < 0.)
aspan += 2 * CGAL_PI;
const double coeff = 180*16/CGAL_PI;
qp->drawArc(convert(circ.bbox()),
(int)(asource * coeff),
(int)(aspan * coeff));
return *this;
}
PainterOstream& operator<<(const Line_arc_2& arc)
{
(*this) << Segment_2(Point_2(to_double(arc.source().x()), to_double(arc.source().y())),
Point_2(to_double(arc.target().x()), to_double(arc.target().y())));
return *this;
}
void draw_parabola_segment(const Point_2& center, const Line_2& line,
const Point_2& source, const Point_2& target)
{
if (CGAL::collinear(source,target,center))
qp->drawLine(convert(source), convert(target));
else
{
const Point_2 proj_source = line.projection(source);
const Point_2 proj_target = line.projection(target);
const Point_2 intersection = circumcenter(proj_source,
proj_target,
center);
// Property: "intersection" is the intersection of the two tangent
// lines in source and target.
QPainterPath path;
path.moveTo(convert(source));
path.quadTo(convert(intersection), convert(target));
qp->drawPath(path);
}
}
};
} // namespace Qt
} // namespace CGAL
#endif // CGAL_QT_PAINTER_OSTREAM_H
|
/*
* This source code is part of
*
* G R O M A C S
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2009, The GROMACS Development Team
*
* Gromacs is a library for molecular simulation and trajectory analysis,
* written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
* a full list of developers and information, check out http://www.gromacs.org
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
* As a special exception, you may use this file as part of a free software
* library without restriction. Specifically, if other files instantiate
* templates or use macros or inline functions from this file, or you compile
* this file and link it with other files to produce an executable, this
* file does not by itself cause the resulting executable to be covered by
* the GNU Lesser General Public License.
*
* In plain-speak: do not worry about classes/macros/templates either - only
* changes to the library have to be LGPL, not an application linking with it.
*
* To help fund GROMACS development, we humbly ask that you cite
* the papers people have written on it - you can find them on the website!
*/
/*! \file nb_kernel213_f77_double.c
* \brief Wrapper for fortran nonbonded kernel 213
*
* \internal
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef F77_FUNC
#define F77_FUNC(name,NAME) name ## _
#endif
/* Declarations of Fortran routines.
* We avoid using underscores in F77 identifiers for portability!
*/
void
F77_FUNC(f77dkernel213,F77DKERNEL213)
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work);
void
F77_FUNC(f77dkernel213nf,F77DKERNEL213NF)
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work);
void
nb_kernel213_f77_double
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work)
{
F77_FUNC(f77dkernel213,F77DKERNEL213)
(nri,iinr,jindex,jjnr,shift,shiftvec,fshift,gid,pos,faction,
charge,facel,krf,crf,Vc,type,ntype,vdwparam,Vvdw,tabscale,
VFtab,invsqrta,dvda,gbtabscale,GBtab,nthreads,count,mtx,
outeriter,inneriter,work);
}
void
nb_kernel213nf_f77_double
(int * nri, int iinr[],
int jindex[], int jjnr[],
int shift[], double shiftvec[],
double fshift[], int gid[],
double pos[], double faction[],
double charge[], double * facel,
double * krf, double * crf,
double Vc[], int type[],
int * ntype, double vdwparam[],
double Vvdw[], double * tabscale,
double VFtab[], double invsqrta[],
double dvda[], double * gbtabscale,
double GBtab[], int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work)
{
F77_FUNC(f77dkernel213nf,F77DKERNEL213NF)
(nri,iinr,jindex,jjnr,shift,shiftvec,fshift,gid,pos,faction,
charge,facel,krf,crf,Vc,type,ntype,vdwparam,Vvdw,tabscale,
VFtab,invsqrta,dvda,gbtabscale,GBtab,nthreads,count,mtx,
outeriter,inneriter,work);
}
|
/*
* Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "krb5_locl.h"
RCSID("$Id: get_in_tkt_with_keytab.c 15477 2005-06-17 04:56:44Z lha $");
krb5_error_code KRB5_LIB_FUNCTION
krb5_keytab_key_proc (krb5_context context,
krb5_enctype enctype,
krb5_salt salt,
krb5_const_pointer keyseed,
krb5_keyblock **key)
{
krb5_keytab_key_proc_args *args = rk_UNCONST(keyseed);
krb5_keytab keytab = args->keytab;
krb5_principal principal = args->principal;
krb5_error_code ret;
krb5_keytab real_keytab;
krb5_keytab_entry entry;
if(keytab == NULL)
krb5_kt_default(context, &real_keytab);
else
real_keytab = keytab;
ret = krb5_kt_get_entry (context, real_keytab, principal,
0, enctype, &entry);
if (keytab == NULL)
krb5_kt_close (context, real_keytab);
if (ret)
return ret;
ret = krb5_copy_keyblock (context, &entry.keyblock, key);
krb5_kt_free_entry(context, &entry);
return ret;
}
krb5_error_code KRB5_LIB_FUNCTION
krb5_get_in_tkt_with_keytab (krb5_context context,
krb5_flags options,
krb5_addresses *addrs,
const krb5_enctype *etypes,
const krb5_preauthtype *pre_auth_types,
krb5_keytab keytab,
krb5_ccache ccache,
krb5_creds *creds,
krb5_kdc_rep *ret_as_reply)
{
krb5_keytab_key_proc_args a;
a.principal = creds->client;
a.keytab = keytab;
return krb5_get_in_tkt (context,
options,
addrs,
etypes,
pre_auth_types,
krb5_keytab_key_proc,
&a,
NULL,
NULL,
creds,
ccache,
ret_as_reply);
}
|
/*
* Copyright 2010-2014 The pygit2 contributors
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2,
* as published by the Free Software Foundation.
*
* In addition to the permissions in the GNU General Public License,
* the authors give you unlimited permission to link the compiled
* version of this file into combinations with other programs,
* and to distribute those combinations without any restriction
* coming from the use of this file. (The General Public License
* restrictions do apply in other respects; for example, they cover
* modification of the file, and distribution when not linked into
* a combined executable.)
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDE_pygit2_index_h
#define INCLUDE_pygit2_index_h
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <git2.h>
PyObject* Index_add(Index *self, PyObject *args);
PyObject* Index_add_all(Index *self, PyObject *pylist);
PyObject* Index_clear(Index *self);
PyObject* Index_find(Index *self, PyObject *py_path);
PyObject* Index_read(Index *self, PyObject *args);
PyObject* Index_write(Index *self);
PyObject* Index_iter(Index *self);
PyObject* Index_getitem(Index *self, PyObject *value);
PyObject* Index_read_tree(Index *self, PyObject *value);
PyObject* Index_write_tree(Index *self, PyObject *args);
Py_ssize_t Index_len(Index *self);
int Index_setitem(Index *self, PyObject *key, PyObject *value);
PyObject* wrap_index(git_index *index, Repository *repo);
#endif
|
/*
* Declare directives for structure packing. No padding will be provided
* between the members of packed structures, and therefore, there is no
* guarantee that structure members will be aligned.
*
* Declaring packed structures is compiler specific. In order to handle all
* cases, packed structures should be delared as:
*
* #include <packed_section_start.h>
*
* typedef BWL_PRE_PACKED_STRUCT struct foobar_t {
* some_struct_members;
* } BWL_POST_PACKED_STRUCT foobar_t;
*
* #include <packed_section_end.h>
*
*
* Copyright (C) 1999-2012, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
* $Id: packed_section_end.h 241182 2011-02-17 21:50:03Z $
*/
#ifdef BWL_PACKED_SECTION
#undef BWL_PACKED_SECTION
#else
#error "BWL_PACKED_SECTION is NOT defined!"
#endif
#undef BWL_PRE_PACKED_STRUCT
#undef BWL_POST_PACKED_STRUCT
|
#ifndef __NORMAL_SOCKET_H__
#define __NORMAL_SOCKET_H__
#include <asm/sockios.h>
/* For setsockoptions(2) */
#define SOL_SOCKET 1
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
/* To add :#define SO_REUSEPORT 15 */
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
/* Socket filtering */
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
#define SO_PEERNAME 28
#define SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
#endif /* __NORMAL_SOCKET_H__ */
|
/* Task_4
*
* This routine serves as a low priority test task that should exit
* a soon as it runs to test the taskexitted user extension.
* execute.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "system.h"
rtems_task Task_4(
rtems_task_argument argument
)
{
buffered_io_flush();
puts( "TA4 - exitting task" );
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
/* FIFO dir */
#define FIFO "/tmp/myfifio"
/* main function */
int main(int argc, char **argv)
{
char buf[100];
int fd;
/* 创建fifo */
if(mkfifo(FIFO, O_CREAT|O_EXCL) < 0)
{
printf("creat fifo error!\r\n");
if(EEXIST != errno)
{
printf("EEXIST != errno!\r\n");
exit(1);
}
}
printf("preparing for reading bytes...\r\n");
memset(buf, 0, sizeof(buf));
/* 打开fifo */
fd = open(FIFO, O_RDONLY|O_NONBLOCK, 0);
if(-1 == fd)
{
printf("open fifo error!\r\n");
exit(1);
}
while(1)
{
memset(buf, 0, sizeof(buf));
/* 读取fifo */
if(-1 == read(fd, buf, 100))
{
printf("read fifo error!\r\n");
}
printf("read %s from %s\r\n", buf, FIFO);
sleep(2);
}
pause();
unlink(FIFO);
}
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* NAME
* modify_ldt02.c
*
* DESCRIPTION
* Testcase to check the error conditions for modify_ldt(2)
*
* ALGORITHM
* block1:
* Create a segment at entry 0 and a valid base address.
* Read the contents of the segment thru' fs register.
* Validate the data.
* Write an invalid base address into entry 0.
* Read the contents of entry 0 in the child process.
* Verify that a SIGSEGV is incurred.
*
* USAGE
* modify_ldt02
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS
* None
*/
#include "config.h"
#include "test.h"
#include "usctest.h"
TCID_DEFINE(modify_ldt02);
int TST_TOTAL = 1;
#if defined(__i386__) && defined(HAVE_MODIFY_LDT)
#ifdef HAVE_ASM_LDT_H
#include <asm/ldt.h>
#endif
extern int modify_ldt(int, void *, unsigned long);
#include <asm/unistd.h>
#include <string.h>
#include <sys/wait.h>
#include <errno.h>
/* Newer ldt.h files use user_desc, instead of modify_ldt_ldt_s */
#ifdef HAVE_STRUCT_USER_DESC
typedef struct user_desc modify_ldt_s;
#elif HAVE_STRUCT_MODIFY_LDT_LDT_S
typedef struct modify_ldt_ldt_s modify_ldt_s;
#else
typedef struct modify_ldt_ldt_t {
unsigned int entry_number;
unsigned long int base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
unsigned int empty:25;
} modify_ldt_s;
#endif
int create_segment(void *, size_t);
int read_segment(unsigned int);
void cleanup(void);
void setup(void);
#define FAILED 1
int main(int ac, char **av)
{
int lc;
char *msg;
int val, pid, status;
int flag;
int seg[4];
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
}
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
//block1:
tst_resm(TINFO, "Enter block 1");
flag = 0;
seg[0] = 12345;
if (create_segment(seg, sizeof(seg)) == -1) {
tst_brkm(TINFO, cleanup, "Creation of segment failed");
}
val = read_segment(0);
if (val != seg[0]) {
tst_resm(TFAIL, "Invalid value read %d, expected %d",
val, seg[0]);
flag = FAILED;
}
if (flag) {
tst_resm(TINFO, "block 1 FAILED");
} else {
tst_resm(TINFO, "block 1 PASSED");
}
tst_resm(TINFO, "Exit block 1");
//block2:
tst_resm(TINFO, "Enter block 2");
flag = 0;
if (create_segment(0, 10) == -1) {
tst_brkm(TINFO, cleanup, "Creation of segment failed");
}
tst_flush();
if ((pid = FORK_OR_VFORK()) == 0) {
val = read_segment(0);
exit(1);
}
(void)waitpid(pid, &status, 0);
if (WEXITSTATUS(status) != 0) {
flag = FAILED;
tst_resm(TFAIL, "Did not generate SEGV, child returned "
"unexpected status");
}
if (flag) {
tst_resm(TINFO, "block 2 FAILED");
} else {
tst_resm(TINFO, "block 2 PASSED");
}
}
cleanup();
tst_exit();
}
int create_segment(void *seg, size_t size)
{
modify_ldt_s entry;
entry.entry_number = 0;
entry.base_addr = (unsigned long)seg;
entry.limit = size;
entry.seg_32bit = 1;
entry.contents = 0;
entry.read_exec_only = 0;
entry.limit_in_pages = 0;
entry.seg_not_present = 0;
return modify_ldt(1, &entry, sizeof(entry));
}
int read_segment(unsigned int index)
{
int res;
__asm__ __volatile__("\n\
push $0x0007;\n\
pop %%fs;\n\
movl %%fs:(%1), %0":"=r"(res)
:"r"(index * sizeof(int)));
return res;
}
void sigsegv_handler(int sig)
{
tst_resm(TINFO, "received signal: %d", sig);
exit(0);
}
/*
* setup() - performs all ONE TIME setup for this test
*/
void setup(void)
{
struct sigaction act;
memset(&act, 0, sizeof(act));
sigemptyset(&act.sa_mask);
tst_sig(FORK, DEF_HANDLER, cleanup);
act.sa_handler = sigsegv_handler;
(void)sigaction(SIGSEGV, &act, NULL);
TEST_PAUSE;
}
/*
* cleanup() - performs all the ONE TIME cleanup for this test at completion
* or premature exit.
*/
void cleanup(void)
{
/*
* print timing status if that option was specified.
* print errno log if that option was specified
*/
TEST_CLEANUP;
}
#elif HAVE_MODIFY_LDT
int main()
{
tst_resm(TCONF,
"modify_ldt is available but not tested on the platform than __i386__");
tst_exit();
}
#else /* if defined(__i386__) */
int main()
{
tst_resm(TINFO, "modify_ldt02 test only for ix86");
tst_exit();
}
#endif /* if defined(__i386__) */
|
/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fwrite(p, n, m, s) _IO_fwrite (p, n, m, s)
#endif
/* Write the word (int) W to STREAM. */
int
putw (int w, FILE *stream)
{
/* Is there a better way? */
if (fwrite ((const void *) &w, sizeof (w), 1, stream) < 1)
return EOF;
return 0;
}
|
#ifndef _LINUX_PID_H
#define _LINUX_PID_H
enum pid_type
{
PIDTYPE_PID,
PIDTYPE_TGID,
PIDTYPE_PGID,
PIDTYPE_SID,
PIDTYPE_MAX
};
struct pid
{
/* Try to keep pid_chain in the same cacheline as nr for find_pid */
int nr;
struct hlist_node pid_chain;
/* list of pids with the same nr, only one of them is in the hash */
struct list_head pid_list;
};
#define pid_task(elem, type) \
list_entry(elem, struct task_struct, pids[type].pid_list)
/*
* attach_pid() and detach_pid() must be called with the tasklist_lock
* write-held.
*/
extern int FASTCALL(attach_pid(struct task_struct *task, enum pid_type type, int nr));
extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
/*
* look up a PID in the hash table. Must be called with the tasklist_lock
* held.
*/
extern struct pid *FASTCALL(find_pid(enum pid_type, int));
extern int alloc_pidmap(void);
extern void FASTCALL(free_pidmap(int));
extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thread);
#define do_each_task_pid(who, type, task) \
if ((task = find_task_by_pid_type(type, who))) { \
do {
#define while_each_task_pid(who, type, task) \
} while (task = pid_task((task)->pids[type].pid_list.next,\
type), \
hlist_unhashed(&(task)->pids[type].pid_chain)); \
} \
#endif /* _LINUX_PID_H */
|
/*****************************************************************************
* voutgl.h: MacOS X OpenGL provider
*****************************************************************************
* Copyright (C) 2001-2007 the VideoLAN team
* $Id$
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCOpenGLVoutView.h"
#import "voutagl.h"
struct vout_sys_t
{
NSAutoreleasePool * o_pool;
VLCOpenGLVoutView * o_glview;
bool b_saved_frame;
NSRect s_frame;
bool b_got_frame;
/* Mozilla plugin-related variables */
bool b_embedded;
AGLContext agl_ctx;
AGLDrawable agl_drawable;
int i_offx, i_offy;
int i_width, i_height;
WindowRef theWindow;
WindowGroupRef winGroup;
bool b_clipped_out;
Rect clipBounds, viewBounds;
};
|
/* amortips.h
**
** Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
**
*/
/*
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program in a file called COPYING; if not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301, USA.
*/
/*
** Bug reports and questions can be sent to kde-devel@kde.org
*/
#ifndef AMORTIPS_H
#define AMORTIPS_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qstrlist.h>
class QFile;
//---------------------------------------------------------------------------
//
// AmorTips selects random tips from a data file
//
class AmorTips
{
public:
AmorTips();
bool setFile(const QString& file);
void reset();
QString tip();
protected:
bool readKTips();
bool read(const QString& file);
bool readTip(QFile &file);
protected:
QStringList mTips;
};
#endif // AMORTIPS_H
|
#ifndef _check_h
#define _check_h
void check_rho(double **, int N);
void print_rho(double **, int N);
#endif
|
/*
* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGTextContentElement_h
#define SVGTextContentElement_h
#include "SVGAnimatedBoolean.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedLength.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGGraphicsElement.h"
namespace WebCore {
enum SVGLengthAdjustType {
SVGLengthAdjustUnknown,
SVGLengthAdjustSpacing,
SVGLengthAdjustSpacingAndGlyphs
};
template<>
struct SVGPropertyTraits<SVGLengthAdjustType> {
static unsigned highestEnumValue() { return SVGLengthAdjustSpacingAndGlyphs; }
static String toString(SVGLengthAdjustType type)
{
switch (type) {
case SVGLengthAdjustUnknown:
return emptyString();
case SVGLengthAdjustSpacing:
return ASCIILiteral("spacing");
case SVGLengthAdjustSpacingAndGlyphs:
return ASCIILiteral("spacingAndGlyphs");
}
ASSERT_NOT_REACHED();
return emptyString();
}
static SVGLengthAdjustType fromString(const String& value)
{
if (value == "spacingAndGlyphs")
return SVGLengthAdjustSpacingAndGlyphs;
if (value == "spacing")
return SVGLengthAdjustSpacing;
return SVGLengthAdjustUnknown;
}
};
class SVGTextContentElement : public SVGGraphicsElement, public SVGExternalResourcesRequired {
public:
// Forward declare enumerations in the W3C naming scheme, for IDL generation.
enum {
LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown,
LENGTHADJUST_SPACING = SVGLengthAdjustSpacing,
LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs
};
unsigned getNumberOfChars();
float getComputedTextLength();
float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&);
SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&);
SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&);
FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&);
float getRotationOfChar(unsigned charnum, ExceptionCode&);
int getCharNumAtPosition(const SVGPoint&);
void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&);
static SVGTextContentElement* elementFromRenderer(RenderObject*);
// textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro
// as its getter needs special handling (return getComputedTextLength(), instead of m_textLength).
SVGLength& specifiedTextLength() { return m_specifiedTextLength; }
Ref<SVGAnimatedLength> textLengthAnimated();
static const SVGPropertyInfo* textLengthPropertyInfo();
protected:
SVGTextContentElement(const QualifiedName&, Document&);
virtual bool isValid() const override { return SVGTests::isValid(); }
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
virtual bool isPresentationAttribute(const QualifiedName&) const override;
virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
virtual void svgAttributeChanged(const QualifiedName&) override;
virtual bool selfHasRelativeLengths() const override;
private:
virtual bool isTextContent() const override final { return true; }
static bool isSupportedAttribute(const QualifiedName&);
// Custom 'textLength' property
static void synchronizeTextLength(SVGElement* contextElement);
static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement);
mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength;
SVGLength m_specifiedTextLength;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement)
DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType)
DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
END_DECLARE_ANIMATED_PROPERTIES
};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SVGTextContentElement)
static bool isType(const WebCore::SVGElement& element) { return element.isTextContent(); }
static bool isType(const WebCore::Node& node) { return is<WebCore::SVGElement>(node) && isType(downcast<WebCore::SVGElement>(node)); }
SPECIALIZE_TYPE_TRAITS_END()
#endif
|
#ifndef _SMP_TYPES_H
#define _SMP_TYPES_H
#include <__kstdlib/__ktypes.h>
#define CPUID_INVALID ((cpu_t)~0)
typedef uarch_t cpu_t;
enum bspPlugTypeE
{
BSP_PLUGTYPE_NOTBSP=0,
BSP_PLUGTYPE_FIRSTPLUG,
BSP_PLUGTYPE_HOTPLUG
};
#ifdef __cplusplus
/* There are C files which include this file, so any C++ code in here
* should be properly guarded.
**/
#endif
#endif
|
/***************************************************************************
* Copyright (C) 2007 by Allis Tauri *
* allista@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 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef AVRTUNERWINDOW_H
#define AVRTUNERWINDOW_H
/**
@author Allis Tauri <allista@gmail.com>
*/
#include <gtkmm.h>
#include <gtksourceviewmm.h>
#include <sigc++/sigc++.h>
using namespace Gtk;
using namespace Glib;
using namespace gtksourceview;
class AVRTunerWindow: public Window
{
public:
AVRTunerWindow() : Window() {};
AVRTunerWindow(GtkWindow* window, const RefPtr<Gtk::Builder>& _builder);
virtual ~AVRTunerWindow() { delete ConfigSourceView; };
private:
///core stuff
///signal handlers
void show_log_toggle();
void test_config_toggle();
void clear_log_clicked();
void revert();
void save();
void save_as();
void undo();
void redo();
void init();
void update_meters();
///all the gtkmm stuff
///builder
RefPtr<Builder> builder;
///toolbar
Toolbar *ConfigToolbar;
///area stack
Notebook *MainStack;
///buttons
ToggleButton *ShowLogButton;
ToggleButton *TestConfigButton;
Button *ClearLogButton;
FileChooserButton* ConfigChooserButton;
ToolButton *RevertButton;
ToolButton *SaveButton;
ToolButton *SaveAsButton;
ToolButton *UndoButton;
ToolButton *RedoButton;
ToolButton *InitButton;
CheckButton *ShowMotionCheckbox;
///text areas
TextView *LogTextView;
SourceView *ConfigSourceView;
RefPtr<SourceBuffer> ConfigSourceBuffer;
///meters
ProgressBar *MotionProgressBar;
ProgressBar *NoiseProgressBar;
Label *MotionValueLable;
Label *NoiseValueLable;
};
#endif
|
/* Company : Nequeo Pty Ltd, http://www.nequeo.com.au/
* Copyright : Copyright © Nequeo Pty Ltd 2012 http://www.nequeo.com.au/
*
* File : MemoryBlock.h
* Purpose : Manages a memory buffer.
*
*/
/*
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include "stdafx.h"
using namespace System;
namespace Nequeo
{
namespace Collections
{
namespace Pool
{
/// <summary>
/// Provides memory buffer managment.
/// </summary>
template <typename T>
class MemoryBlockImp
{
public:
explicit MemoryBlockImp(size_t length);
~MemoryBlockImp();
// Copy constructor (copy semantics).
MemoryBlockImp(const MemoryBlockImp<T>& other);
MemoryBlockImp<T>& operator=(const MemoryBlockImp<T>& other);
// Move constructor (move semantics).
MemoryBlockImp(MemoryBlockImp<T>&& other);
MemoryBlockImp<T>& operator=(MemoryBlockImp<T>&& other);
T* GetData();
T GetElement(int&& index);
size_t Length() const;
private:
bool _disposed;
size_t _length; // The length of the resource.
T* _data; // The resource.
};
}
}
} |
/*
* -- SuperLU routine (version 2.0) --
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
* and Lawrence Berkeley National Lab.
* November 15, 1997
*
*/
#include "slu_ddefs.h"
/*
* Convert a full matrix into a sparse matrix format.
*/
int
sp_dconvert(int m, int n, double *A, int lda, int kl, int ku,
double *a, int *asub, int *xa, int *nnz)
{
int lasta = 0;
int i, j, ilow, ihigh;
int *row;
double *val;
for (j = 0; j < n; ++j) {
xa[j] = lasta;
val = &a[xa[j]];
row = &asub[xa[j]];
ilow = SUPERLU_MAX(0, j - ku);
ihigh = SUPERLU_MIN(n-1, j + kl);
for (i = ilow; i <= ihigh; ++i) {
val[i-ilow] = A[i + j*lda];
row[i-ilow] = i;
}
lasta += ihigh - ilow + 1;
}
xa[n] = *nnz = lasta;
return 0;
}
|
/* Test the stack overflow handler.
Copyright (C) 2002-2006 Bruno Haible <bruno@clisp.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sigsegv.h"
#include <stdio.h>
#include <limits.h>
#if HAVE_STACK_OVERFLOW_RECOVERY
#if defined _WIN32 && !defined __CYGWIN__
/* Windows doesn't have sigset_t. */
typedef int sigset_t;
# define sigemptyset(set)
# define sigprocmask(how,set,oldset)
#else
/* Unix */
# include "config.h"
#endif
#include <stddef.h> /* needed for NULL on SunOS4 */
#include <stdlib.h> /* for abort, exit */
#include <signal.h>
#include <setjmp.h>
#if HAVE_SETRLIMIT
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
#endif
#ifndef SIGSTKSZ
# define SIGSTKSZ 16384
#endif
jmp_buf mainloop;
sigset_t mainsigset;
volatile int pass = 0;
void
stackoverflow_handler (int emergency, stackoverflow_context_t scp)
{
pass++;
printf ("Stack overflow %d caught.\n", pass);
sigprocmask (SIG_SETMASK, &mainsigset, NULL);
sigsegv_leave_handler ();
longjmp (mainloop, emergency ? -1 : pass);
}
volatile int *
recurse_1 (int n, volatile int *p)
{
if (n < INT_MAX)
*recurse_1 (n + 1, p) += n;
return p;
}
volatile int
recurse (volatile int n)
{
return *recurse_1 (n, &n);
}
/* glibc says: Users should use SIGSTKSZ as the size of user-supplied
buffers. */
char mystack[SIGSTKSZ];
int
main ()
{
sigset_t emptyset;
#if HAVE_SETRLIMIT && defined RLIMIT_STACK
/* Before starting the endless recursion, try to be friendly to the user's
machine. On some Linux 2.2.x systems, there is no stack limit for user
processes at all. We don't want to kill such systems. */
struct rlimit rl;
rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */
setrlimit (RLIMIT_STACK, &rl);
#endif
/* Install the stack overflow handler. */
if (stackoverflow_install_handler (&stackoverflow_handler,
mystack, sizeof (mystack))
< 0)
exit (2);
/* Save the current signal mask. */
sigemptyset (&emptyset);
sigprocmask (SIG_BLOCK, &emptyset, &mainsigset);
/* Provoke two stack overflows in a row. */
switch (setjmp (mainloop))
{
case -1:
printf ("emergency exit\n"); exit (1);
case 0: case 1:
printf ("Starting recursion pass %d.\n", pass + 1);
recurse (0);
printf ("no endless recursion?!\n"); exit (1);
case 2:
break;
default:
abort ();
}
printf ("Test passed.\n");
exit (0);
}
#else
int
main ()
{
return 77;
}
#endif
|
void dispatch_isr(void *arg);
int32_t sched_rr(void);
int32_t sched_lottery(void);
int32_t sched_priorityrr(void);
int32_t sched_rma(void);
int32_t sched_dma(void);
int32_t sched_edf(void);
int32_t sched_llf(void);
|
#pragma once
#include "Population.h"
//*****************************************************************************
// STRUCTURE: PopulationNode
// desc: This structure contains the node for a linear linked
// list of populations
//*****************************************************************************
struct PopulationNode
{
CPopulation* population;
CPopulationData* data;
int generation;
PopulationNode* next;
PopulationNode* prev;
};
//*****************************************************************************
// STRUCTURE: CPopulationData
// desc: This class contains statistics for the population
//*****************************************************************************
class CPopulationData
{
public:
CPopulationData();
~CPopulationData();
/**
* desc: set the number of organisms in population
* param: num - set number of organisms
*/
void setNumOrganisms(int num);
/**
* desc: get the number of organisms in population
* ret: number of organisms in population
*/
int getNumOrganisms();
/**
* desc: set the number of valid organisms in population
* param: num - number to set
*/
void setNumValidOrganisms(int num);
/**
* desc: get the number of valid organisms in population
* ret: number of valid organisms in population
*/
int getNumValidOrganisms();
/**
* desc: set the index of the organism with the highest fitness
* param: id - index of parent 1 in population
*/
void setParent1Index(int id);
/**
* desc: get the index of the organism with the highest fitness
* ret: index of parent 1 if it has been set,
* -1 if parent 1 has not be set
*/
int getParent1Index();
/**
* desc: set the index of the organism with the second highest fitness
* param: id - index of parent 2 in population
*/
void setParent2Index(int id);
/**
* desc: get the index of the organism with the second highest fitness
* ret: index of parent 2 if it has been set,
* -1 if parent 2 has not be set
*/
int getParent2Index();
/**
* desc: set the lowest fitness value in population
* param: num - lowest fitness value
*/
void setLowestFitness(float num);
/**
* desc: get the lowest fitness value in population
* ret: lowest fitness value
*/
float getLowestFitness();
/**
* desc: set the highest fitness value in population
* param: num - highest fitness value
*/
void setHighestFitness(float num);
/**
* desc: get the highest fitness value in population
* ret: highest fitness value
*/
float getHighestFitness();
/**
* desc: set the average fitness value in population
* param: num - average fitness value
*/
void setAverageFitness(float num);
/**
* desc: get the average fitness value in population
* ret: average fitness value
*/
float getAverageFitness();
/**
* desc: set the lowest execution time in population
* param: num - lowest execution time
*/
void setLowestExecutionTime(int num);
/**
* desc: get the lowest execution time in population
* ret: lowest execution time
*/
int getLowestExecutionTime();
/**
* desc: set the highest execution time in population
* param: num - highest execution time
*/
void setHighestExecutionTime(int num);
/**
* desc: get the highest execution time in population
* ret: highest execution time
*/
int getHighestExecutionTime();
/**
* desc: set the average execution time in population
* param: num - average execution time
*/
void setAverageExecutionTime(float num);
/**
* desc: get the average execution time in population
* ret: average execution time
*/
float getAverageExecutionTime();
private:
int mNumOrganisms;
int mNumValidOrganisms;
int mParent1Index;
int mParent2Index;
float mLowestFitness;
float mHighestFitness;
float mAverageFitness;
int mLowestExecutionTime;
int mHighestExecutionTime;
float mAverageExecutionTime;
};
|
/*
chronyd/chronyc - Programs for keeping computer clocks accurate.
**********************************************************************
* Copyright (C) Richard P. Curnow 1997-2002
* Copyright (C) Miroslav Lichvar 2014
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
**********************************************************************
=======================================================================
Header for the part of the software that deals with the set of
current NTP servers and peers, which can resolve an IP address into
a source record for further processing.
*/
#ifndef GOT_NTP_SOURCES_H
#define GOT_NTP_SOURCES_H
#include "ntp.h"
#include "addressing.h"
#include "srcparams.h"
#include "ntp_core.h"
#include "reports.h"
/* Status values returned by operations that indirectly result from user
input. */
typedef enum {
NSR_Success, /* Operation successful */
NSR_NoSuchSource, /* Remove - attempt to remove a source that is not known */
NSR_AlreadyInUse, /* AddSource - attempt to add a source that is already known */
NSR_TooManySources, /* AddSource - too many sources already present */
NSR_InvalidAF /* AddSource - attempt to add a source with invalid address family */
} NSR_Status;
/* Procedure to add a new server or peer source. */
extern NSR_Status NSR_AddSource(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourceParameters *params);
/* Procedure to add a new server, peer source, or pool of servers specified by
name instead of address. The name is resolved in exponentially increasing
intervals until it succeeds or fails with a non-temporary error. */
extern void NSR_AddSourceByName(char *name, int port, int pool, NTP_Source_Type type, SourceParameters *params);
/* Function type for handlers to be called back when an attempt
* (possibly unsuccessful) to resolve unresolved sources ends */
typedef void (*NSR_SourceResolvingEndHandler)(void);
/* Set the handler, or NULL to disable the notification */
extern void NSR_SetSourceResolvingEndHandler(NSR_SourceResolvingEndHandler handler);
/* Procedure to start resolving unresolved sources */
extern void NSR_ResolveSources(void);
/* Procedure to start all sources */
extern void NSR_StartSources(void);
/* Start new sources automatically */
extern void NSR_AutoStartSources(void);
/* Procedure to remove a source */
extern NSR_Status NSR_RemoveSource(NTP_Remote_Address *remote_addr);
/* Procedure to remove all sources */
extern void NSR_RemoveAllSources(void);
/* Procedure to try to find a replacement for a bad source */
extern void NSR_HandleBadSource(IPAddr *address);
/* This routine is called by ntp_io when a new packet arrives off the network */
extern void NSR_ProcessReceive(NTP_Packet *message, struct timeval *now, double now_err, NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr, int length);
/* Initialisation function */
extern void NSR_Initialise(void);
/* Finalisation function */
extern void NSR_Finalise(void);
/* This routine is used to indicate that sources whose IP addresses
match a particular subnet should be set online again. Returns a
flag indicating whether any hosts matched the address */
extern int NSR_TakeSourcesOnline(IPAddr *mask, IPAddr *address);
/* This routine is used to indicate that sources whose IP addresses
match a particular subnet should be set offline. Returns a flag
indicating whether any hosts matched the address */
extern int NSR_TakeSourcesOffline(IPAddr *mask, IPAddr *address);
extern int NSR_ModifyMinpoll(IPAddr *address, int new_minpoll);
extern int NSR_ModifyMaxpoll(IPAddr *address, int new_maxpoll);
extern int NSR_ModifyMaxdelay(IPAddr *address, double new_max_delay);
extern int NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio);
extern int NSR_ModifyMaxdelaydevratio(IPAddr *address, double new_max_delay_ratio);
extern int NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum);
extern int NSR_ModifyPolltarget(IPAddr *address, int new_poll_target);
extern int NSR_InitiateSampleBurst(int n_good_samples, int n_total_samples, IPAddr *mask, IPAddr *address);
extern void NSR_ReportSource(RPT_SourceReport *report, struct timeval *now);
extern void NSR_GetActivityReport(RPT_ActivityReport *report);
#endif /* GOT_NTP_SOURCES_H */
|
/*
Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
DCP-o-matic 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.
DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
#include "controls.h"
#include "lib/spl.h"
class DCPContent;
class PlaylistControls : public Controls
{
public:
PlaylistControls (wxWindow* parent, boost::shared_ptr<FilmViewer> viewer);
void log (wxString s);
void set_film (boost::shared_ptr<Film> film);
/** This is so that we can tell our parent player to reset the film
when we have created one from a SPL. We could call a method
in the player's DOMFrame but we don't have that in a header.
*/
boost::signals2::signal<void (boost::weak_ptr<Film>)> ResetFilm;
void play ();
void stop ();
private:
void play_clicked ();
void pause_clicked ();
void stop_clicked ();
void next_clicked ();
void previous_clicked ();
void add_playlist_to_list (SPL spl);
void update_content_directory ();
void update_playlist_directory ();
void spl_selection_changed ();
void select_playlist (int selected, int position);
void started ();
void stopped ();
void setup_sensitivity ();
void config_changed (int);
void viewer_finished ();
void reset_film ();
void update_current_content ();
bool can_do_previous ();
bool can_do_next ();
void deselect_playlist ();
boost::optional<dcp::EncryptedKDM> get_kdm_from_directory (boost::shared_ptr<DCPContent> dcp);
wxButton* _play_button;
wxButton* _pause_button;
wxButton* _stop_button;
wxButton* _next_button;
wxButton* _previous_button;
ContentView* _content_view;
wxButton* _refresh_content_view;
wxListCtrl* _spl_view;
wxButton* _refresh_spl_view;
wxListCtrl* _current_spl_view;
std::vector<SPL> _playlists;
boost::optional<int> _selected_playlist;
int _selected_playlist_position;
};
|
#include "LibSensors.h"
#ifdef HAVE_SENSORS_SENSORS_H
#include <dlfcn.h>
#include <errno.h>
#include <math.h>
#include <sensors/sensors.h>
#include "XUtils.h"
#ifdef BUILD_STATIC
#define sym_sensors_init sensors_init
#define sym_sensors_cleanup sensors_cleanup
#define sym_sensors_get_detected_chips sensors_get_detected_chips
#define sym_sensors_snprintf_chip_name sensors_snprintf_chip_name
#define sym_sensors_get_features sensors_get_features
#define sym_sensors_get_subfeature sensors_get_subfeature
#define sym_sensors_get_value sensors_get_value
#define sym_sensors_get_label sensors_get_label
#else
static int (*sym_sensors_init)(FILE*);
static void (*sym_sensors_cleanup)(void);
static const sensors_chip_name* (*sym_sensors_get_detected_chips)(const sensors_chip_name*, int*);
static int (*sym_sensors_snprintf_chip_name)(char*, size_t, const sensors_chip_name*);
static const sensors_feature* (*sym_sensors_get_features)(const sensors_chip_name*, int*);
static const sensors_subfeature* (*sym_sensors_get_subfeature)(const sensors_chip_name*, const sensors_feature*, sensors_subfeature_type);
static int (*sym_sensors_get_value)(const sensors_chip_name*, int, double*);
static char* (*sym_sensors_get_label)(const sensors_chip_name*, const sensors_feature*);
static void* dlopenHandle = NULL;
#endif /* BUILD_STATIC */
int LibSensors_init(FILE* input) {
#ifdef BUILD_STATIC
return sym_sensors_init(input);
#else
if (!dlopenHandle) {
/* Find the unversioned libsensors.so (symlink) and prefer that, but Debian has .so.5 and Fedora .so.4 without
matching symlinks (unless people install the -dev packages) */
dlopenHandle = dlopen("libsensors.so", RTLD_LAZY);
if (!dlopenHandle)
dlopenHandle = dlopen("libsensors.so.5", RTLD_LAZY);
if (!dlopenHandle)
dlopenHandle = dlopen("libsensors.so.4", RTLD_LAZY);
if (!dlopenHandle)
goto dlfailure;
/* Clear any errors */
dlerror();
#define resolve(symbolname) do { \
*(void **)(&sym_##symbolname) = dlsym(dlopenHandle, #symbolname); \
if (!sym_##symbolname || dlerror() != NULL) \
goto dlfailure; \
} while(0)
resolve(sensors_init);
resolve(sensors_cleanup);
resolve(sensors_get_detected_chips);
resolve(sensors_snprintf_chip_name);
resolve(sensors_get_features);
resolve(sensors_get_subfeature);
resolve(sensors_get_value);
resolve(sensors_get_label);
#undef resolve
}
return sym_sensors_init(input);
dlfailure:
if (dlopenHandle) {
dlclose(dlopenHandle);
dlopenHandle = NULL;
}
return -1;
#endif /* BUILD_STATIC */
}
void LibSensors_cleanup(void) {
#ifdef BUILD_STATIC
sym_sensors_cleanup();
#else
if (dlopenHandle) {
sym_sensors_cleanup();
dlclose(dlopenHandle);
dlopenHandle = NULL;
}
#endif /* BUILD_STATIC */
}
void LibSensors_getCPUTemperatures(CPUData* cpus, unsigned int cpuCount) {
for (unsigned int i = 0; i <= cpuCount; i++)
cpus[i].temperature = NAN;
#ifndef BUILD_STATIC
if (!dlopenHandle)
return;
#endif /* !BUILD_STATIC */
unsigned int coreTempCount = 0;
int n = 0;
for (const sensors_chip_name *chip = sym_sensors_get_detected_chips(NULL, &n); chip; chip = sym_sensors_get_detected_chips(NULL, &n)) {
char buffer[32];
sym_sensors_snprintf_chip_name(buffer, sizeof(buffer), chip);
if (!String_startsWith(buffer, "coretemp") &&
!String_startsWith(buffer, "cpu_thermal") &&
!String_startsWith(buffer, "k10temp") &&
!String_startsWith(buffer, "zenpower"))
continue;
int m = 0;
for (const sensors_feature *feature = sym_sensors_get_features(chip, &m); feature; feature = sym_sensors_get_features(chip, &m)) {
if (feature->type != SENSORS_FEATURE_TEMP)
continue;
char* label = sym_sensors_get_label(chip, feature);
if (!label)
continue;
unsigned int tempId;
if (String_startsWith(label, "Package ")) {
tempId = 0;
} else if (String_startsWith(label, "temp")) {
/* Raspberry Pi has only temp1 */
tempId = 0;
} else if (String_startsWith(label, "Tdie")) {
tempId = 0;
} else if (String_startsWith(label, "Core ")) {
tempId = 1 + atoi(label + strlen("Core "));
} else {
tempId = UINT_MAX;
}
free(label);
if (tempId > cpuCount)
continue;
const sensors_subfeature *sub_feature = sym_sensors_get_subfeature(chip, feature, SENSORS_SUBFEATURE_TEMP_INPUT);
if (sub_feature) {
double temp;
int r = sym_sensors_get_value(chip, sub_feature->number, &temp);
if (r != 0)
continue;
cpus[tempId].temperature = temp;
if (tempId > 0)
coreTempCount++;
}
}
}
const double packageTemp = cpus[0].temperature;
/* Only package temperature - copy to all cpus */
if (coreTempCount == 0 && !isnan(packageTemp)) {
for (unsigned int i = 1; i <= cpuCount; i++)
cpus[i].temperature = packageTemp;
return;
}
/* No package temperature - set to max core temperature */
if (isnan(packageTemp) && coreTempCount != 0) {
double maxTemp = NAN;
for (unsigned int i = 1; i <= cpuCount; i++) {
const double coreTemp = cpus[i].temperature;
if (isnan(coreTemp))
continue;
maxTemp = MAXIMUM(maxTemp, coreTemp);
}
cpus[0].temperature = maxTemp;
}
/* Half the temperatures, probably HT/SMT - copy to second half */
const unsigned int delta = cpuCount / 2;
if (coreTempCount == delta) {
for (unsigned int i = 1; i <= delta; i++)
cpus[i + delta].temperature = cpus[i].temperature;
}
}
#endif /* HAVE_SENSORS_SENSORS_H */
|
/*
* Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
* Created by: rusty.lynch REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
Test case for assertion #2 of the sigaction system call that shows
sigaction (when used with a non-null oact pointer) changes the action
for a signal.
Steps:
1. Call sigaction to set handler for SIGURG to use handler1
2. Call sigaction again to set handler for SIGURG to use handler2,
but this time use a non-null oarg and verify the sa_handler for
oarg is set for handler1.
*/
#include <signal.h>
#include <stdio.h>
#include "posixtest.h"
int handler_called = 0;
void handler1(int signo)
{
}
void handler2(int signo)
{
}
int main()
{
struct sigaction act;
struct sigaction oact;
act.sa_handler = handler1;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGURG, &act, 0) == -1) {
perror("Unexpected error while attempting to setup test "
"pre-conditions");
return PTS_UNRESOLVED;
}
act.sa_handler = handler2;
sigemptyset(&act.sa_mask);
if (sigaction(SIGURG, &act, &oact) == -1) {
perror("Unexpected error while attempting to setup test "
"pre-conditions");
return PTS_UNRESOLVED;
}
if (oact.sa_handler == handler1) {
printf("Test PASSED\n");
return PTS_PASS;
}
printf("Test Failed\n");
return PTS_FAIL;
}
|
// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name settings.h - The game settings headerfile. */
//
// (c) Copyright 2000-2006 by Andreas Arens and Jimmy Salmon
//
// 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; only version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
#ifndef __SETTINGS_H__
#define __SETTINGS_H__
//@{
#include <vector>
/*----------------------------------------------------------------------------
-- Declarations
----------------------------------------------------------------------------*/
class CFile;
class CMap;
/*----------------------------------------------------------------------------
-- Settings
----------------------------------------------------------------------------*/
struct SettingsPresets {
int PlayerColor; /// Color of a player
int Race; /// Race of the player
int Team; /// Team of player -- NOT SELECTABLE YET
int Type; /// Type of player (for network games)
};
/**
** Settings structure
**
** This structure one day should contain all common game settings,
** in-game, or pre-start, and the individual (per player) presets.
** This allows central maintenance, easy (network-)negotiation,
** simplifies load/save/reinitialization, etc...
**
*/
struct Settings {
int NetGameType; /// Multiplayer or single player
// Individual presets:
// For single-player game only Presets[0] will be used..
SettingsPresets Presets[PlayerMax];
// Common settings:
int Resources; /// Preset resource factor
int NumUnits; /// Preset # of units
int Opponents; /// Preset # of ai-opponents
int Difficulty; /// Terrain type (summer,winter,...)
int GameType; /// Game type (melee, free for all,...)
bool NoFogOfWar; /// No fog of war
bool Inside; /// If game uses interior tileset
int RevealMap; /// Reveal map
int MapRichness; /// Map richness
};
#define SettingsPresetMapDefault -1 /// Special: Use map supplied
/**
** Single or multiplayer settings
*/
#define SettingsSinglePlayerGame 1
#define SettingsMultiPlayerGame 2
/**
** GameType settings
*/
enum GameTypes {
SettingsGameTypeMapDefault = SettingsPresetMapDefault,
SettingsGameTypeMelee = 0,
SettingsGameTypeFreeForAll,
SettingsGameTypeTopVsBottom,
SettingsGameTypeLeftVsRight,
SettingsGameTypeManVsMachine,
SettingsGameTypeManTeamVsMachine
// Future game type ideas
#if 0
SettingsGameTypeOneOnOne,
SettingsGameTypeCaptureTheFlag,
SettingsGameTypeGreed,
SettingsGameTypeSlaughter,
SettingsGameTypeSuddenDeath,
SettingsGameTypeTeamMelee,
SettingsGameTypeTeamCaptureTheFlag
#endif
};
/*----------------------------------------------------------------------------
-- Variables
----------------------------------------------------------------------------*/
extern Settings GameSettings; /// Game settings
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
/// Show stats
extern void ShowStats();
/// Create a game
extern void CreateGame(const std::string &filename, CMap *map);
/// Init Setting to default values
extern void InitSettings();
//@}
#endif // !__SETTINGS_H__
|
/*
* CSVTaskReportElement.h - TaskJuggler
*
* Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* $Id$
*/
#ifndef _CSVTaskReportElement_h_
#define _CSVTaskReportElement_h_
#include "CSVReportElement.h"
class CSVTaskReportElement : public CSVReportElement
{
public:
CSVTaskReportElement(Report* r, const QString& df, int dl);
~CSVTaskReportElement() { };
bool generate();
} ;
#endif
|
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_EXT_OP_H
#define _GDSP_EXT_OP_H
void dsp_op_ext_ops_pro(uint16 _Opcode);
void dsp_op_ext_ops_epi(uint16 _Opcode);
#endif
|
/*
* NatFeat host CD-ROM access, Win32 CD-ROM driver
*
* ARAnyM (C) 2014 ARAnyM developer team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef NFCDROM_WIN32_H
#define NFCDROM_WIN32_H
/*--- Includes ---*/
#include "nfcdrom.h"
#include "win32_supp.h"
#undef NOERROR /* conflicts with jpgdh.h */
#include "parameters.h"
class CdromDriverWin32 : public CdromDriver
{
private:
/* for each possible opened drive */
struct {
char *device;
HANDLE handle;
int usecount;
} cddrives[CD_MAX_DRIVES];
bool drives_scanned;
int numcds;
protected:
int OpenDrive(memptr device);
void CloseDrive(int drive);
int32 cd_read(memptr device, memptr buffer, uint32 first, uint32 length);
int32 cd_status(memptr device, memptr ext_status);
int32 cd_ioctl(memptr device, uint16 opcode, memptr buffer);
int32 cd_startaudio(memptr device, uint32 dummy, memptr buffer);
int32 cd_stopaudio(memptr device);
int32 cd_setsongtime(memptr device, uint32 dummy, uint32 start_msf, uint32 end_msf);
int32 cd_gettoc(memptr device, uint32 dummy, memptr buffer);
int32 cd_discinfo(memptr device, memptr buffer);
int cd_winioctl(int drive, DWORD code, LPVOID in = NULL, DWORD insize = 0, LPVOID out = NULL, DWORD outsize = 0, LPDWORD returned = NULL);
int cd_win_playtracks(int drive, unsigned char first, unsigned char last);
public:
CdromDriverWin32();
virtual ~CdromDriverWin32();
virtual int Count();
virtual const char *DeviceName(int drive);
};
#endif /* NFCDROM_WIN32_H */
|
/***************************************************************************
startdeathbatt.h - description
-------------------
begin : Fri Jan 5 2001
copyright : (C) 2001 by Andreas Agorander
email : Bluefire@linux.nu
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef STARTDEATHBATT_H
#define STARTDEATHBATT_H
#include "startsbatt.h"
/**
*@author Andreas Agorander
*/
class StartDeathBatt : public StartsBatt
{
Q_OBJECT
public:
StartDeathBatt();
};
#endif
|
/*
* portamento.c
*
* Copyright 2010 Evan Buswell
*
* This file is part of Cshellsynth.
*
* Cshellsynth 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.
*
* Cshellsynth 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 Cshellsynth. If not, see <http://www.gnu.org/licenses/>.
*/
#include <jack/jack.h>
#include <math.h>
#include "cshellsynth/portamento.h"
#include "cshellsynth/filter.h"
#include "atomic-float.h"
static int cs_porta_process(jack_nframes_t nframes, void *arg) {
cs_porta_t *self = (cs_porta_t *) arg;
float *in_buffer = in_buffer; /* suppress uninitialized warning */
float *lag_buffer = lag_buffer; /* suppress uninitialized warning */
float *out_buffer = (float *)jack_port_get_buffer(self->out_port, nframes);
if(out_buffer == NULL) {
return -1;
}
float in = atomic_float_read(&self->in);
if(isnanf(in)) {
in_buffer = (float *)jack_port_get_buffer(self->in_port, nframes);
if(in_buffer == NULL) {
return -1;
}
}
float lag = atomic_float_read(&self->lag);
if(isnanf(lag)) {
lag_buffer = (float *)jack_port_get_buffer(self->lag_port, nframes);
if(lag_buffer == NULL) {
return -1;
}
}
jack_nframes_t i;
for(i = 0; i < nframes; i++) {
double c_in = (double) (isnanf(in) ? in_buffer[i] : in);
if(c_in != self->target) {
self->target = c_in;
self->start = self->last;
}
if(self->last != self->target) {
self->last += (self->target - self->start) / ((double) (isnanf(lag) ? lag_buffer[i] : lag));
if(self->start <= self->target) {
/* going up */
if(self->last > self->target) {
self->last = self->target;
}
} else {
/* going down */
if(self->last < self->target) {
self->last = self->target;
}
}
}
out_buffer[i] = self->last;
}
return 0;
}
void cs_porta_set_lag(cs_porta_t *self, float lag) {
atomic_float_set(&self->lag, lag * jack_get_sample_rate(self->client));
}
int cs_porta_init(cs_porta_t *self, const char *client_name, jack_options_t flags, char *server_name) {
int r = cs_filter_init((cs_filter_t *) self, client_name, flags, server_name);
if(r != 0) {
return r;
}
self->lag_port = jack_port_register(self->client, "lag", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
if(self->lag_port == NULL) {
cs_filter_destroy((cs_filter_t *) self);
return -1;
};
atomic_float_set(&self->lag, NAN);
self->start = 0.0;
self->target = 0.0;
self->last = 0.0;
r = jack_set_process_callback(self->client, cs_porta_process, self);
if(r != 0) {
cs_filter_destroy((cs_filter_t *) self);
return r;
}
r = jack_activate(self->client);
if(r != 0) {
cs_filter_destroy((cs_filter_t *) self);
return r;
}
return 0;
}
|
/*
* Copyright (C) 2013-2020 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
* Copyright (C) 2013 Sourcefire, Inc.
*
* Authors: Steven Morgan (smorgan@sourcefire.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef __XZ_IFACE_H
#define __XZ_IFACE_H
#include "7z/Xz.h"
#include "clamav-types.h"
#include "others.h"
struct CLI_XZ {
CXzUnpacker state;
ECoderStatus status;
unsigned char *next_in;
unsigned char *next_out;
SizeT avail_in;
SizeT avail_out;
};
int cli_XzInit(struct CLI_XZ *);
void cli_XzShutdown(struct CLI_XZ *);
int cli_XzDecode(struct CLI_XZ *);
#define XZ_RESULT_OK 0
#define XZ_RESULT_DATA_ERROR 1
#define XZ_STREAM_END 2
#define XZ_DIC_HEURISTIC 3
#define CLI_XZ_OBUF_SIZE 1024 * 1024
#define CLI_XZ_IBUF_SIZE CLI_XZ_OBUF_SIZE >> 2 /* compression ratio 25% */
#endif /* __XZ_IFACE_H */
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:43 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/usb/serial/edgeport/ti.h */
|
/*
* arch/arm/mach-omap1/include/mach/io.h
*/
#include <plat/io.h>
|
/* FreeS/WAN log functions (log.h)
* Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* RCSID $Id: starterlog.h,v 1.1 2004-01-20 20:47:42 mcr Exp $
*/
#ifndef _STARTER_LOG_H_
#define _STARTER_LOG_H_
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_ERR 2
#define LOG_LEVEL_DEBUG 3
extern void starter_log (int level, const char *fmt, ...);
extern void starter_use_log (int debug, int console, int syslog);
extern void passert_fail(const char *pred_str, const char *file_str, unsigned long line_no);
extern int showonly;
extern void *xmalloc(size_t s);
extern char *xstrdup(char *s);
extern void *xrealloc(void *o, size_t s);
#endif /* _STARTER_LOG_H_ */
|
/* $Id: paristio.h,v 1.5.2.1 2001/04/15 16:25:21 karim Exp $
Copyright (C) 2000 The PARI group.
This file is part of the PARI/GP package.
PARI/GP 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. It is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY WHATSOEVER.
Check the License for details. You should have received a copy of it, along
with the package; see the file 'COPYING'. If not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains memory and I/O management definitions */
typedef unsigned char *byteptr;
typedef struct stackzone
{
long zonetop, bot, top, avma, memused;
} stackzone;
typedef struct entree {
char *name;
ulong valence;
void *value;
long menu;
char *code;
struct entree *next;
char *help;
void *args;
} entree;
typedef struct PariOUT {
void (*putch)(char);
void (*puts)(char*);
void (*flush)(void); /* Finalize a report of a non fatal-error. */
void (*die)(void); /* If not-NULL, should be called to finalize
a report of a fatal error (no "\n" required). */
} PariOUT;
typedef struct pariFILE {
FILE *file;
int type;
char *name;
struct pariFILE* prev;
struct pariFILE* next;
} pariFILE;
/* Common global variables: */
extern PariOUT *pariOut, *pariErr;
extern FILE *pari_outfile, *logfile, *infile, *errfile;
extern ulong avma,bot,top,memused;
extern byteptr diffptr;
extern entree **varentries;
extern char *errmessage[], *current_psfile;
#define is_universal_constant(x) ((GEN)(x) >= gzero && (GEN)(x) <= gi)
#define copyifstack(x,y) {ulong t=(ulong)(x); \
(y)=(t>=bot &&t<top)? lcopy((GEN)t): t;}
#define icopyifstack(x,y) {ulong t=(ulong)(x); \
(y)=(t>=bot &&t<top)? licopy((GEN)t): t;}
#define isonstack(x) ((ulong)(x)>=bot && (ulong)(x)<top)
/* Define this to (1) locally (in a given file, NOT here) to check
* "random" garbage collecting
*/
#ifdef DYNAMIC_STACK
# define low_stack(x,l) (avma < (l))
#else
# define low_stack(x,l) (avma < (x))
#endif
#define stack_lim(av,n) (bot + (((av)-bot)>>(n)))
#ifndef SIG_IGN
# define SIG_IGN (void(*)())1
#endif
#ifndef SIGINT
# define SIGINT 2
#endif
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/attributes.h"
#include "vorbisdsp.h"
#include "vorbis.h"
av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
{
dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
#if (ARCH_AARCH64 == 1)
if (ARCH_AARCH64)
ff_vorbisdsp_init_aarch64(dsp);
#endif
#if (ARCH_ARM == 1)
if (ARCH_ARM)
ff_vorbisdsp_init_arm(dsp);
#endif
#if (ARCH_PPC == 1)
if (ARCH_PPC)
ff_vorbisdsp_init_ppc(dsp);
#endif
#if (ARCH_X86 == 1)
if (ARCH_X86)
ff_vorbisdsp_init_x86(dsp);
#endif
}
|
/* Socket helper functions
*
* Copyright (C) 2017-2021 Joachim Wiberg <troglobit@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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "queue.h"
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sysexits.h>
#include <time.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "log.h"
struct sock {
LIST_ENTRY(sock) link;
int sd;
void (*cb)(int, void *arg);
void *arg;
};
static int max_fdnum = -1;
static LIST_HEAD(slist, sock) sock_list = LIST_HEAD_INITIALIZER();
int nfds(void)
{
return max_fdnum + 1;
}
/*
* register socket/fd/pipe created elsewhere, optional callback
*/
int socket_register(int sd, void (*cb)(int, void *), void *arg)
{
struct sock *entry;
entry = malloc(sizeof(*entry));
if (!entry) {
smclog(LOG_ERR, "Failed allocating memory registering socket: %s", strerror(errno));
exit(EX_OSERR);
}
entry->sd = sd;
entry->cb = cb;
entry->arg = arg;
LIST_INSERT_HEAD(&sock_list, entry, link);
#if !defined(HAVE_SOCK_CLOEXEC) && defined(HAVE_FCNTL_H)
fcntl(sd, F_SETFD, fcntl(sd, F_GETFD) | FD_CLOEXEC);
#endif
/* Keep track for select() */
if (sd > max_fdnum)
max_fdnum = sd;
return sd;
}
/*
* create socket, with optional callback for reading inbound data
*/
int socket_create(int domain, int type, int proto, void (*cb)(int, void *), void *arg)
{
int val = 0;
int sd;
#ifdef HAVE_SOCK_CLOEXEC
type |= SOCK_CLOEXEC;
#endif
sd = socket(domain, type, proto);
if (sd < 0)
return -1;
if (domain == AF_UNIX)
goto done;
#ifdef HAVE_IPV6_MULTICAST_HOST
if (domain == AF_INET6) {
if (setsockopt(sd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val, sizeof(val)))
smclog(LOG_WARNING, "failed disabling IPV6_MULTICAST_LOOP: %s", strerror(errno));
#ifdef IPV6_MULTICAST_ALL
if (setsockopt(sd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &val, sizeof(val)))
smclog(LOG_WARNING, "failed disabling IPV6_MULTICAST_ALL: %s", strerror(errno));
#endif
} else
#endif /* HAVE_IPV6_MULTICAST_HOST */
{
if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val)))
smclog(LOG_WARNING, "failed disabling IP_MULTICAST_LOOP: %s", strerror(errno));
#ifdef IP_MULTICAST_ALL
if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_ALL, &val, sizeof(val)))
smclog(LOG_WARNING, "failed disabling IP_MULTICAST_ALL: %s", strerror(errno));
#endif
}
done:
if (socket_register(sd, cb, arg) < 0) {
close(sd);
return -1;
}
return sd;
}
int socket_close(int sd)
{
struct sock *entry, *tmp;
LIST_FOREACH_SAFE(entry, &sock_list, link, tmp) {
if (entry->sd == sd) {
LIST_REMOVE(entry, link);
close(entry->sd);
free(entry);
return 0;
}
}
errno = ENOENT;
return -1;
}
int socket_poll(struct timeval *timeout)
{
int num;
fd_set fds;
struct sock *entry;
FD_ZERO(&fds);
LIST_FOREACH(entry, &sock_list, link)
FD_SET(entry->sd, &fds);
num = select(nfds(), &fds, NULL, NULL, timeout);
if (num <= 0) {
/* Log all errors, except when signalled, ignore failures. */
if (num < 0 && EINTR != errno)
smclog(LOG_WARNING, "Failed select(): %s", strerror(errno));
return num;
}
LIST_FOREACH(entry, &sock_list, link) {
if (!FD_ISSET(entry->sd, &fds))
continue;
if (entry->cb)
entry->cb(entry->sd, entry->arg);
}
return num;
}
/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/
|
/*+
*
* FrameGrid.h
*
* Copyright © 2004 David C. Salmon. All Rights Reserved.
*
* Coordinate grid object for frame.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
#import <Cocoa/Cocoa.h>
class StrInputStream;
class StrOutputStream;
class WorldPoint;
class graphics;
@interface FrameGrid : NSObject
{
DlFloat32 _xSpacing;
DlFloat32 _ySpacing;
bool _gridSnap;
bool _gridOn;
}
+ (FrameGrid*)createWithSpacing: (DlFloat32)spc on: (BOOL)on;
+ (FrameGrid*)createWithSpacing: (DlFloat32)spc gridOn: (BOOL)on andVisible: (BOOL) vis;
+ (FrameGrid*)createFromFile:(StrInputStream&) s;
- (WorldPoint) spacing;
- (void) setSpacing: (const WorldPoint&) point;
- (bool) snapOn;
- (void) setSnapOn: (bool) on;
- (bool) gridOn;
- (void) setGridOn: (bool) on;
- (WorldPoint) snapTo: (const WorldPoint&) point;
- (void) saveToFile:(StrOutputStream&) s;
- (void) drawRect: (const NSRect&) r withGraphics: (graphics*) g;
- (BOOL) isEqual: (FrameGrid*) grid;
@end
|
/*
* The ManaPlus Client
* Copyright (C) 2011-2019 The ManaPlus Developers
* Copyright (C) 2019-2022 Andrei Karas
*
* This file is part of The ManaPlus Client.
*
* 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
* 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 RESOURCES_BEINGSLOT_H
#define RESOURCES_BEINGSLOT_H
#include "enums/simpletypes/itemcolor.h"
#include "resources/item/cardslist.h"
#include <string>
#include "localconsts.h"
struct BeingSlot final
{
BeingSlot() :
spriteId(0),
cardsId(zeroCards),
colorId(ItemColor_one),
color()
{
}
A_DEFAULT_COPY(BeingSlot)
int spriteId;
CardsList cardsId;
ItemColor colorId;
std::string color;
};
extern BeingSlot *emptyBeingSlot;
#endif // RESOURCES_BEINGSLOT_H
|
#ifndef BOARDVIEW_H_
#define BOARDVIEW_H_
#include <QGraphicsView>
class ResizableView: public QGraphicsView
{
Q_OBJECT
public:
ResizableView(QWidget *parent = 0);
ResizableView(QGraphicsScene * scene, QWidget * parent = 0);
~ResizableView();
protected:
void wheelEvent(QWheelEvent *event);
virtual void resizeEvent(QResizeEvent * event);
};
#endif /* BOARDVIEW_H_ */
|
/* Copyright (C) 1991-93,96,97,98,99,2001,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#include <features.h>
#ifdef __cplusplus
extern "C" {
#endif
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
#undef FNM_NOESCAPE
#undef FNM_PERIOD
/* Bits set in the FLAGS argument to `fnmatch'. */
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
#endif
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
#define FNM_NOMATCH 1
/* This value is returned if the implementation does not support
`fnmatch'. Since this is not the case here it will never be
returned but the conformance test suites still require the symbol
to be defined. */
#ifdef _XOPEN_SOURCE
# define FNM_NOSYS (-1)
#endif
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch (const char *__pattern, const char *__name,
int __flags);
libc_hidden_proto(fnmatch)
#ifdef __cplusplus
}
#endif
#endif /* fnmatch.h */
|
/* AbiWord
* Copyright (C) 2001 AbiSource, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef IE_EXP_AWT_H
#define IE_EXP_AWT_H
#include "ie_exp_AbiWord_1.h"
class PD_Document;
// The exporter/writer for AbiWord Templates
class ABI_EXPORT IE_Exp_AWT_Sniffer : public IE_ExpSniffer
{
friend class IE_Exp;
public:
IE_Exp_AWT_Sniffer ();
virtual ~IE_Exp_AWT_Sniffer () {}
virtual bool recognizeSuffix (const char * szSuffix);
virtual bool getDlgLabels (const char ** szDesc,
const char ** szSuffixList,
IEFileType * ft);
virtual UT_Error constructExporter (PD_Document * pDocument,
IE_Exp ** ppie);
};
class ABI_EXPORT IE_Exp_AWT : public IE_Exp_AbiWord_1
{
public:
IE_Exp_AWT(PD_Document * pDocument);
virtual ~IE_Exp_AWT();
};
#endif /* IE_EXP_AWT_H */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2016 Intel Corporation..
* Copyright (C) 2017 Advanced Micro Devices
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <stdint.h>
#include <assert.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
#include <cpu/amd/msr.h>
#include <cpu/x86/mtrr.h>
#include <smp/node.h>
#include <bootblock_common.h>
#include <amdblocks/agesawrapper.h>
#include <amdblocks/agesawrapper_call.h>
#include <soc/pci_devs.h>
#include <soc/cpu.h>
#include <soc/northbridge.h>
#include <soc/southbridge.h>
#include <amdblocks/psp.h>
#include <timestamp.h>
#include <halt.h>
#if CONFIG_PI_AGESA_TEMP_RAM_BASE < 0x100000
#error "Error: CONFIG_PI_AGESA_TEMP_RAM_BASE must be >= 1MB"
#endif
#if CONFIG_PI_AGESA_CAR_HEAP_BASE < 0x100000
#error "Error: CONFIG_PI_AGESA_CAR_HEAP_BASE must be >= 1MB"
#endif
/* Set the MMIO Configuration Base Address, Bus Range, and misc MTRRs. */
static void amd_initmmio(void)
{
msr_t mmconf;
msr_t mtrr_cap = rdmsr(MTRR_CAP_MSR);
int mtrr;
mmconf.hi = 0;
mmconf.lo = CONFIG_MMCONF_BASE_ADDRESS | MMIO_RANGE_EN
| fms(CONFIG_MMCONF_BUS_NUMBER) << MMIO_BUS_RANGE_SHIFT;
wrmsr(MMIO_CONF_BASE, mmconf);
/*
* todo: AGESA currently writes variable MTRRs. Once that is
* corrected, un-hardcode this MTRR.
*
* Be careful not to use get_free_var_mtrr/set_var_mtrr pairs
* where all cores execute the path. Both cores within a compute
* unit share MTRRs. Programming core0 has the appearance of
* modifying core1 too. Using the pair again will create
* duplicate copies.
*/
mtrr = (mtrr_cap.lo & MTRR_CAP_VCNT) - SOC_EARLY_VMTRR_FLASH;
set_var_mtrr(mtrr, FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);
mtrr = (mtrr_cap.lo & MTRR_CAP_VCNT) - SOC_EARLY_VMTRR_CAR_HEAP;
set_var_mtrr(mtrr, CONFIG_PI_AGESA_CAR_HEAP_BASE,
CONFIG_PI_AGESA_HEAP_SIZE, MTRR_TYPE_WRBACK);
mtrr = (mtrr_cap.lo & MTRR_CAP_VCNT) - SOC_EARLY_VMTRR_TEMPRAM;
set_var_mtrr(mtrr, CONFIG_PI_AGESA_TEMP_RAM_BASE,
CONFIG_PI_AGESA_HEAP_SIZE, MTRR_TYPE_UNCACHEABLE);
}
asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
amd_initmmio();
/*
* Call lib/bootblock.c main with BSP, shortcut for APs
*/
if (!boot_cpu()) {
void (*ap_romstage_entry)(void) =
(void (*)(void))get_ap_entry_ptr();
ap_romstage_entry(); /* execution does not return */
halt();
}
/* TSC cannot be relied upon. Override the TSC value passed in. */
bootblock_main_with_timestamp(timestamp_get(), NULL, 0);
}
void bootblock_soc_early_init(void)
{
/*
* This call (sb_reset_i2c_slaves) was originally early at
* bootblock_c_entry, but had to be moved here. There was an
* unexplained delay in the middle of the i2c transaction when
* we had it in bootblock_c_entry. Moving it to this point
* (or adding delays) fixes the issue. It seems like the processor
* just pauses but we don't know why.
*/
sb_reset_i2c_slaves();
bootblock_fch_early_init();
post_code(0x90);
}
void bootblock_soc_init(void)
{
if (CONFIG(STONEYRIDGE_UART))
assert(CONFIG_UART_FOR_CONSOLE >= 0
&& CONFIG_UART_FOR_CONSOLE <= 1);
u32 val = cpuid_eax(1);
printk(BIOS_DEBUG, "Family_Model: %08x\n", val);
bootblock_fch_init();
/* Initialize any early i2c buses. */
i2c_soc_early_init();
}
|
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_KIOMEDIASTREAM_H
#define PHONON_KIOMEDIASTREAM_H
#include <Phonon/AbstractMediaStream>
#include <KIO/Job>
class QUrl;
namespace Phonon {
class KioMediaStreamPrivate;
class KioMediaStream : public AbstractMediaStream
{
Q_OBJECT
Q_DECLARE_PRIVATE(KioMediaStream)
public:
explicit KioMediaStream(const QUrl &url, QObject *parent = 0);
~KioMediaStream();
protected:
void reset();
void needData();
void enoughData();
void seekStream(qint64);
KioMediaStreamPrivate *d_ptr;
private:
Q_PRIVATE_SLOT(d_func(), void _k_bytestreamData(KIO::Job *, const QByteArray &))
Q_PRIVATE_SLOT(d_func(), void _k_bytestreamResult(KJob *))
Q_PRIVATE_SLOT(d_func(), void _k_bytestreamTotalSize(KJob *, qulonglong))
Q_PRIVATE_SLOT(d_func(), void _k_bytestreamFileJobOpen(KIO::Job *))
Q_PRIVATE_SLOT(d_func(), void _k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t))
Q_PRIVATE_SLOT(d_func(), void _k_read())
};
} // namespace Phonon
#endif // PHONON_KIOMEDIASTREAM_H
|
/**
******************************************************************************
* @file CRYP/CRYP_AES_GCM/Src/stm32f4xx_hal_msp.c
* @author MCD Application Team
* @version V1.0.1
* @date 09-October-2015
* @brief HAL MSP module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/** @addtogroup STM32F4xx_HAL_Examples
* @{
*/
/** @defgroup HAL_MSP
* @brief HAL MSP module.
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup HAL_MSP_Private_Functions
* @{
*/
/**
* @brief Initializes the CRYP MSP.
* This function configures the hardware resources used in this example:
* - CRYP's clock enable
* @param hcryp: CRYP handle pointer
* @retval None
*/
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
{
/* Enable CRYP clock */
__HAL_RCC_CRYP_CLK_ENABLE();
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Copyright (C) 2017 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this Program; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
namespace KODI
{
namespace KEYBOARD
{
class IKeyboardInputHandler;
/*!
* \ingroup mouse
* \brief Interface for classes that can provide keyboard input
*/
class IKeyboardInputProvider
{
public:
virtual ~IKeyboardInputProvider() = default;
/*!
* \brief Registers a handler to be called on keyboard input
*
* \param handler The handler to receive keyboard input provided by this class
* \param bPromiscuous True to observe all events without affecting the
* input's destination
*/
virtual void RegisterKeyboardHandler(IKeyboardInputHandler* handler, bool bPromiscuous) = 0;
/*!
* \brief Unregisters handler from keyboard input
*
* \param handler The handler that was receiving keyboard input
*/
virtual void UnregisterKeyboardHandler(IKeyboardInputHandler* handler) = 0;
};
}
}
|
/*
** Job Arranger for ZABBIX
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
** $Date:: 2013-05-29 13:20:33 +0900 #$
** $Revision: 4677 $
** $Author: ossinfra@FITECHLABS.CO.JP $
**/
#ifndef JOBARG_JASELFMON_H
#define JOBARG_JASELFMON_H
extern int CONFIG_JASELFMON_INTERVAL;
void main_jaselfmon_loop();
#endif
|
/* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
*
* Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* S5PV210 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <plat/gpio-cfg.h>
#include <plat/regs-sdhci.h>
#include <plat/sdhci.h>
static void s5pv210_cfg_gpios(unsigned int start, unsigned int nr,
unsigned int cfg)
{
for (; nr > 0; nr--, start++) {
s3c_gpio_setpull(start, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(start, S3C_GPIO_DRVSTR_3X);
s3c_gpio_cfgpin(start, cfg);
}
}
void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
{
struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
/* Set all the necessary GPG0/GPG1 pins to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG0(0), 2, S3C_GPIO_SFN(2));
switch (width) {
case 8:
/* GPG1[3:6] special-function 3 */
s5pv210_cfg_gpios(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3));
case 4:
/* GPG0[3:6] special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2));
default:
break;
}
if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
}
}
void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
{
struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
/* Set all the necessary GPG1[0:1] pins to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG1(0), 2, S3C_GPIO_SFN(2));
/* Data pin GPG1[3:6] to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(2));
if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
}
}
void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
{
struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
/* Set all the necessary GPG2[0:1] pins to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2));
switch (width) {
case 8:
/* Data pin GPG3[3:6] to special-function 3 */
s5pv210_cfg_gpios(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3));
case 4:
/* Data pin GPG2[3:6] to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2));
default:
break;
}
if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
}
}
void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
{
struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
/* Set all the necessary GPG3[0:1] pins to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG3(0), 2, S3C_GPIO_SFN(2));
/* Data pin GPG3[3:6] to special-function 2 */
s5pv210_cfg_gpios(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(2));
if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP);
s3c_gpio_cfgpin(S5PV210_GPG3(2), S3C_GPIO_SFN(2));
}
}
|
#ifndef _OS_H_INCLUDED
#define _OS_H_INCLUDED
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
typedef off_t off64_t;
#define lseek64(fd, offset, whence) lseek((fd), (offset), (whence))
#define open64(path, flags, mode) open((path), (flags), (mode))
#define ftruncate64(fd, length) ftruncate((fd), (length))
#define O_LARGEFILE 0
#endif
#ifdef _AIX
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
#endif
#if defined(__WIN__)
typedef __int64 BIGINT;
typedef _Null_terminated_ const char *PCSZ;
#else // !__WIN__
typedef longlong BIGINT;
#define FILE_BEGIN SEEK_SET
#define FILE_CURRENT SEEK_CUR
#define FILE_END SEEK_END
typedef const char *PCSZ;
#endif // !__WIN__
#if !defined(__WIN__)
typedef const void *LPCVOID;
typedef const char *LPCTSTR;
typedef const char *LPCSTR;
typedef unsigned char BYTE;
typedef char *LPSTR;
typedef char *LPTSTR;
typedef char *PSZ;
typedef long BOOL;
typedef int INT;
#if !defined(NODW)
/*
sqltypes.h from unixODBC incorrectly defines
DWORD as "unsigned int" instead of "unsigned long" on 64-bit platforms.
Add "#define NODW" into all files including this file that include
sqltypes.h (through sql.h or sqlext.h).
*/
typedef unsigned long DWORD;
#endif /* !NODW */
#undef HANDLE
typedef int HANDLE;
#define stricmp strcasecmp
#define _stricmp strcasecmp
#define strnicmp strncasecmp
#define _strnicmp strncasecmp
#ifdef PATH_MAX
#define _MAX_PATH PATH_MAX
#else
#define _MAX_PATH FN_REFLEN
#endif
#define _MAX_DRIVE 3
#define _MAX_DIR FN_REFLEN
#define _MAX_FNAME FN_HEADLEN
#define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1)
#define __stdcall
#endif /* !__WIN__ */
#endif /* _OS_H_INCLUDED */
|
// -*- C++ -*-
//=============================================================================
/**
* @file os_timeb.h
*
* additional definitions for date and time
*
* $Id: os_timeb.h 80826 2008-03-04 14:51:23Z wotte $
*
* @author Don Hinton <dhinton@dresystems.com>
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
#ifndef ACE_OS_INCLUDE_SYS_OS_TIMEB_H
#define ACE_OS_INCLUDE_SYS_OS_TIMEB_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/os_include/sys/os_types.h"
#if !defined (ACE_LACKS_SYS_TIMEB_H)
# include /**/ <sys/timeb.h>
#endif /* !ACE_LACKS_SYS_TIMEB_H */
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x560)
# define _ftime ftime
# define _timeb timeb
#endif /* __BORLANDC__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_OS_TIMEB_H */
|
/*
* tst_libext2fs.c
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "ext2_fs.h"
#include "ext2fsP.h"
#include "ss/ss.h"
#include "debugfs.h"
/*
* Hook in new commands into debugfs
* Override debugfs's prompt
*/
const char *debug_prog_name = "tst_libext2fs";
extern ss_request_table libext2fs_cmds;
ss_request_table *extra_cmds = &libext2fs_cmds;
static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
blk64_t *blocknr, e2_blkcnt_t blockcnt,
blk64_t ref_block, int ref_offset,
void *private EXT2FS_ATTR((unused)))
{
printf("%6d %8llu (%d %llu)\n", blockcnt, *blocknr,
ref_offset, ref_block);
return 0;
}
void do_block_iterate(int argc, char **argv)
{
const char *usage = "block_iterate <file> <flags";
ext2_ino_t ino;
int err = 0;
int flags = 0;
if (common_args_process(argc, argv, 2, 3, argv[0], usage, 0))
return;
ino = string_to_inode(argv[1]);
if (!ino)
return;
if (argc > 2) {
flags = parse_ulong(argv[2], argv[0], "flags", &err);
if (err)
return;
}
flags |= BLOCK_FLAG_READ_ONLY;
ext2fs_block_iterate3(current_fs, ino, flags, NULL,
print_blocks_proc, NULL);
putc('\n', stdout);
}
|
/*****************************************************************************
(c) Cambridge Silicon Radio Limited 2011
All rights reserved and confidential information of CSR
Refer to LICENSE.txt included with this source for details
on the license terms.
*****************************************************************************/
/* Note: this is an auto-generated file. */
#ifndef CSR_WIFI_NME_TASK_H__
#define CSR_WIFI_NME_TASK_H__
#include <linux/types.h>
#include "csr_sched.h"
#ifndef CSR_WIFI_NME_ENABLE
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_task.h
#endif
#define CSR_WIFI_NME_LOG_ID 0x1203FFFF
extern CsrSchedQid CSR_WIFI_NME_IFACEQUEUE;
#endif /* CSR_WIFI_NME_TASK_H__ */
|
/*****************************************************************************
* Copyright (C) 2006 Imre Kelényi
*-------------------------------------------------------------------
* This file is part of SymTorrent
*
* SymTorrent 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.
*
* SymTorrent 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 Symella; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
#ifndef WRITEBUFFER_H
#define WRITEBUFFER_H
#include <e32base.h>
const TUint KWriteBrufferGranularity = 32;
class CWriteBuffer : public CBase
{
public:
~CWriteBuffer();
void ConstructL();
void Read(TDes8& aDes);
void AppendL(const TDesC8& aDes);
inline TPtr8 Ptr() const;
inline TInt Size() const;
inline void Reset();
private:
// CBufSeg* iBuffer;
CBufFlat* iBuffer;
};
inline TInt CWriteBuffer::Size() const {
return iBuffer->Size();
}
inline TPtr8 CWriteBuffer::Ptr() const {
return iBuffer->Ptr(0);
}
inline void CWriteBuffer::Reset() {
iBuffer->Reset();
}
#endif
|
// This file is part of SVO - Semi-direct Visual Odometry.
//
// Copyright (C) 2014 Christian Forster <forster at ifi dot uzh dot ch>
// (Robotics and Perception Group, University of Zurich, Switzerland).
//
// SVO 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 any later version.
//
// SVO 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 SVO_POINT_H_
#define SVO_POINT_H_
#include <boost/noncopyable.hpp>
#include <svo/global.h>
namespace g2o {
class VertexSBAPointXYZ;
}
typedef g2o::VertexSBAPointXYZ g2oPoint;
namespace svo {
class Feature;
typedef Eigen::Matrix<double, 2, 3> Matrix23d;
/// A 3D point on the surface of the scene.
class Point : boost::noncopyable
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
enum PointType {
TYPE_DELETED,
TYPE_CANDIDATE,
TYPE_UNKNOWN,
TYPE_GOOD
};
static int point_counter_; //!< Counts the number of created points. Used to set the unique id.
int id_; //!< Unique ID of the point.
Vector3d pos_; //!< 3d pos of the point in the world coordinate frame.
Vector3d normal_; //!< Surface normal at point.
Matrix3d normal_information_; //!< Inverse covariance matrix of normal estimation.
bool normal_set_; //!< Flag whether the surface normal was estimated or not.
std::list<Feature*> obs_; //!< References to keyframes which observe the point.
size_t n_obs_; //!< Number of obervations: Keyframes AND successful reprojections in intermediate frames.
g2oPoint* v_pt_; //!< Temporary pointer to the point-vertex in g2o during bundle adjustment.
int last_published_ts_; //!< Timestamp of last publishing.
int last_projected_kf_id_; //!< Flag for the reprojection: don't reproject a pt twice.
PointType type_; //!< Quality of the point.
int n_failed_reproj_; //!< Number of failed reprojections. Used to assess the quality of the point.
int n_succeeded_reproj_; //!< Number of succeeded reprojections. Used to assess the quality of the point.
int last_structure_optim_; //!< Timestamp of last point optimization
Point(const Vector3d& pos);
Point(const Vector3d& pos, Feature* ftr);
~Point();
/// Add a reference to a frame.
void addFrameRef(Feature* ftr);
/// Remove reference to a frame.
bool deleteFrameRef(Frame* frame);
/// Initialize point normal. The inital estimate will point towards the frame.
void initNormal();
/// Check whether mappoint has reference to a frame.
Feature* findFrameRef(Frame* frame);
/// Get Frame with similar viewpoint.
bool getCloseViewObs(const Vector3d& pos, Feature*& obs) const;
/// Get number of observations.
inline size_t nRefs() const { return obs_.size(); }
/// Optimize point position through minimizing the reprojection error.
void optimize(const size_t n_iter);
/// Jacobian of point projection on unit plane (focal length = 1) in frame (f).
inline static void jacobian_xyz2uv(
const Vector3d& p_in_f,
const Matrix3d& R_f_w,
Matrix23d& point_jac)
{
const double z_inv = 1.0/p_in_f[2];
const double z_inv_sq = z_inv*z_inv;
point_jac(0, 0) = z_inv;
point_jac(0, 1) = 0.0;
point_jac(0, 2) = -p_in_f[0] * z_inv_sq;
point_jac(1, 0) = 0.0;
point_jac(1, 1) = z_inv;
point_jac(1, 2) = -p_in_f[1] * z_inv_sq;
point_jac = - point_jac * R_f_w;
}
};
} // namespace svo
#endif // SVO_POINT_H_
|
/* RealBoy Emulator: Free, Fast, Yet Accurate, Game Boy/Game Boy Color Emulator.
* Copyright (C) 2013 Sergio Andrés Gómez del Real
*
* 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 Library 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.
*/
/* Misc */
#define NULLZ 0
/* Offsets to registers in address space */
#define DIV_REG 0xff04 // DIV
#define TIMA_REG 0xff05 // TIMA
#define TMA_REG 0xff06 // TMA
#define TAC_REG 0xff07 // TAC
#define LCDC_REG 0xff40 // LCD Control
#define LCDS_REG 0xff41 // LCD Status
#define SCR_X 0xff43 // SCROLL X
#define LY_REG 0xff44 // LY
#define LYC_REG 0xff45 // LYC
#define SPD_REG 0xff4d // Speed
#define VRAM_DMA_SRC 0xff51 // VRAM DMA Source
#define VRAM_DMA_DST 0xff53 // VRAM DMA Destination
#define VRAM_DMA 0xff55 // VRAM DMA
#define IR_REG 0xff0f // Interrupt Request
#define IE_REG 0xffff // Interrupt Enable
/* Interrupt masks in LCD Status register */
#define LY_LYC_FLAG 0x4 // LY/LYC coincidence
#define H_BLN_INT 0x08 // HBLANK interrupt
#define V_BLN_INT 0x10 // VBLANK interrupt
#define OAM_INT 0x20 // OAM interrupt
#define LY_LYC_INT 0x40 // LY/LYC coincidence interrupt
/* Bit-control masks for set, reset and bit operations */
#define BIT_1 0x01
#define BIT_2 0x02
#define BIT_3 0x04
#define BIT_4 0x08
#define BIT_5 0x10
#define BIT_6 0x20
#define BIT_7 0x40
#define BIT_8 0x80
/* Flag (F) register masks */
#define F_ZERO 0x80 // zero flag
#define F_SUBTRACT 0x40 // add/subtract flag
#define F_HCARRY 0x20 // half carry flag
#define F_CARRY 0x10 // carry flag
/* Addressing modes */
#define REG 0x02 // operand is register
#define REG_IND 0x04 // operand is in memory pointed by register
#define IMM 0x08 // operand is immediate
#define IMM_IND 0x10 // operand is in memory pointed by immediate value
/* Addressing bytes or words */
#define BYTE ~0xff
#define WORD ~0xffff
#define DELAY 0x4
#define RD_XOR_WR 0x2
#define RD_WR 0x1
struct cpu_state {
Uint8 *pc;
Uint8 cpu_halt;
Uint8 inst_is_cb;
Uint8 just_enabled;
Uint8 del_wr;
Uint16 del_io;
Uint8 *del_addr;
Uint8 cur_tcks;
Uint32 write_is_delayed;
Uint8 div_ctrl;
long tac_on;
long tac_counter;
long tac_reload;
long hdma_on;
long hbln_dma_dst;
long hbln_dma_src;
long hbln_dma;
Uint32 cpu_cur_mode;
Uint32 ime_flag;
} cpu_state;
extern long spr_extr_cycles[11];
extern long spr_cur_extr;
extern long lcd_vbln_hbln_ctrl;
extern long gb_clk_rate;
extern long gb_line_clks;
extern long gb_vbln_clks[2];
extern long gb_oam_clks[2];
extern long gb_hblank_clks[2];
extern long gb_vram_clks[2];
extern Uint32 skip_next_frame;
extern long ints_offs[5];
extern long chg_gam;
extern Uint32 gboy_mode; // Game Boy/Color Game Boy mode
extern long nb_spr;
extern int gbddb;
extern Uint32 fullscreen;
extern void mem_wr(Uint16, Uint8, Uint8 *);
extern Uint8 mem_rd(Uint16, Uint8 *);
extern void io_ctrl_wr(Uint8, Uint8);
extern long proc_evts();
extern void vid_frame_update();
extern int frame_skip();
extern void render_scanline(long);
extern void gddb_main(int, Uint8 *, Uint8 *);
/*
* Instruction format:
* opcode, dest addr, dest, src addr, src, unit
*/
struct z80_set {
Uint8 format[8];
char name[16];
long length;
void (*func)(struct z80_set *);
};
struct regs_sets {
union regs {
Uint8 UByte[2];
Sint8 SByte[2];
Uint16 UWord;
Sint16 SWord;
} regs[10];
} regs_sets;
|
/*
* proc_gpio: AR5315 GPIO pins in /proc/gpio/
* by olg
* modification for Danube support by Sebastian Gottschall <s.gottschall@newmedia-net.de>
* GPL'ed
* some code stolen from Yoshinori Sato <ysato@users.sourceforge.jp>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/gpio.h>
#include <asm/uaccess.h> /* for copy_from_user */
#include <lantiq.h>
#define MAXGPIO 24
#define GPIO_IN (1<<6)
#define GPIO_OUT (1<<7)
#define GPIO_DIR (1<<8)
#define PIN_MASK 0x3f
extern void ltq_stp_set(struct gpio_chip *chip, unsigned offset, int value);
static void set_gpio_out(int pin, int val)
{
ltq_stp_set(NULL, pin, val);
}
static void set_gpio_in(int pin, int val)
{
ltq_stp_set(NULL, pin, val);
}
static int get_gpio_in(int pin)
{
return 0;
}
static int get_gpio_out(int pin)
{
return 0;
}
static void set_dir(int pin, int dir)
{
}
static int get_dir(int pin)
{
return 0;
}
#define PROCFS_MAX_SIZE 64
extern const char *get_arch_type(void);
static struct proc_dir_entry *proc_gpio, *gpio_dir;
//Masks for data exchange through "void *data" pointer
//The buffer used to store the data returned by the proc file
static char procfs_buffer[PROCFS_MAX_SIZE];
static unsigned long procfs_buffer_size = 0;
static int
gpio_proc_read(char *buf, char **start, off_t offset,
int len, int *eof, void *data)
{
u32 reg = 0;
if ((unsigned int)data & GPIO_IN) {
reg = get_gpio_in(((unsigned int)data) & PIN_MASK);
}
if ((unsigned int)data & GPIO_OUT) {
reg = get_gpio_out(((unsigned int)data) & PIN_MASK);
}
if ((unsigned int)data & GPIO_DIR) {
reg = get_dir(((unsigned int)data) & PIN_MASK);
}
if (reg)
buf[0] = '1';
else
buf[0] = '0';
buf[1] = 0;
*eof = 1;
return (2);
}
static int
gpio_proc_write(struct file *file, const char *buffer, unsigned long count,
void *data)
{
u32 reg = 0;
/* get buffer size */
procfs_buffer_size = count;
if (procfs_buffer_size > PROCFS_MAX_SIZE) {
procfs_buffer_size = PROCFS_MAX_SIZE;
}
/* write data to the buffer */
if (copy_from_user(procfs_buffer, buffer, procfs_buffer_size)) {
return -EFAULT;
}
procfs_buffer[procfs_buffer_size] = 0;
if (procfs_buffer[0] == '0' || procfs_buffer[0] == 'i')
reg = 0;
if (procfs_buffer[0] == '1' || procfs_buffer[0] == 'o')
reg = 1;
if ((unsigned int)data & GPIO_IN) {
set_gpio_in(((unsigned int)data) & PIN_MASK, reg);
}
if ((unsigned int)data & GPIO_OUT) {
set_gpio_out(((unsigned int)data) & PIN_MASK, reg);
}
if ((unsigned int)data & GPIO_DIR) {
set_dir(((unsigned int)data) & PIN_MASK, reg);
}
return procfs_buffer_size;
}
__init int register_stp_proc(void)
{
unsigned char i;
unsigned int flag = 0;
char proc_name[64];
int gpiocount = MAXGPIO;
/* create directory gpio */
gpio_dir = proc_mkdir("gpiostp", NULL);
if (gpio_dir == NULL)
goto fault;
for (i = 0; i < gpiocount * 3; i++) //create for every GPIO "x_in"," x_out" and "x_dir"
{
if (i / gpiocount == 0) {
flag = GPIO_IN;
sprintf(proc_name, "%i_in", i);
}
if (i / gpiocount == 1) {
flag = GPIO_OUT;
sprintf(proc_name, "%i_out", i % gpiocount);
}
if (i / gpiocount == 2) {
flag = GPIO_DIR;
sprintf(proc_name, "%i_dir", i % gpiocount);
}
proc_gpio = create_proc_entry(proc_name, S_IRUGO, gpio_dir);
if (proc_gpio) {
proc_gpio->read_proc = gpio_proc_read;
proc_gpio->write_proc = gpio_proc_write;
//proc_gpio->owner = THIS_MODULE;
proc_gpio->data = (void *)((i % gpiocount) | flag);
} else
goto fault;
}
printk(KERN_NOTICE
"gpio_proc: module loaded and /proc/gpio/ created\n");
return 0;
fault:
return -EFAULT;
}
|
/* AIXMLElement.h
*
* Created by Peter Hosey on 2006-06-07.
*
* This class is explicitly released under the BSD license with the following modification:
* It may be used without reproduction of its copyright notice within The Adium Project.
*
* This class was created for use in the Adium project, which is released under the GPL.
* The release of this specific class (AIXMLElement) under BSD in no way changes the licensing of any other portion
* of the Adium project.
*
****
Copyright © 2006 Peter Hosey, Colin Barrett
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 Peter Hosey nor the names of his 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.
*/
//FIXME: This class is not CodingStyle compliant.
@interface AIXMLElement : NSObject <NSCopying> {
NSString *name;
NSMutableArray *attributeNames;
NSMutableArray *attributeValues;
NSMutableArray *contents;
BOOL selfCloses;
}
+ (id) elementWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName;
- (id) initWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName;
+ (id) elementWithName:(NSString *)newName;
- (id) initWithName:(NSString *)newName;
#pragma mark Accessors
- (NSString *) name;
- (unsigned)numberOfAttributes;
- (NSDictionary *)attributes;
- (void) setAttributeNames:(NSArray *)newAttrNames values:(NSArray *)newAttrVals;
- (void)setValue:(NSString *)attrVal forAttribute:(NSString *)attrName;
- (NSString *)valueForAttribute:(NSString *)attrName;
@property (readwrite, nonatomic) BOOL selfCloses;
#pragma mark Contents
//NSString: Unescaped string data (will be escaped when making XML data).
//AIXMLElement: Sub-element (e.g. span in a p).
- (void) addEscapedObject:(id)obj;
- (void) addObject:(id)obj;
- (void) addObjectsFromArray:(NSArray *)array;
- (void) insertObject:(id)obj atIndex:(unsigned)idx;
- (NSArray *)contents;
- (void)setContents:(NSArray *)newContents;
- (NSString *)contentsAsXMLString;
#pragma mark XML representation
- (NSString *) XMLString;
- (void) appendXMLStringtoString:(NSMutableString *)string;
- (NSData *) UTF8XMLData;
- (void) appendUTF8XMLBytesToData:(NSMutableData *)data;
@end
|
/*
* This is free software: see GPL.txt
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <unistd.h>
#include "tasks.h"
#include "event_create.h"
#include "pid_filter.h"
#include "l4trace_read.h"
#define MAX_CPUS 8
static int *cpu_events;
static int *last_pid_run; // for each cpu
static unsigned int previous_pid=0;
#define dprintf(...)
//#define dprintf printf
static int create(unsigned long long int time, unsigned int pid, const char *name,
int cpu)
{
unsigned int i = 0, found = 0, existing = 0;
static struct task_set *ts;
if (ts == NULL) {
ts = taskset_init();
}
//if (time != current_time) abort();
while(!found) {
unsigned int task_pid;
int task_cpu;
if (taskset_nth_task(ts, i++, &task_pid, &task_cpu)) {
if (pid == task_pid) {
existing = 1;
if (cpu == task_cpu) {
found = 1;
}
}
} else {
found = 2;
}
}
if (found == 2) {
//create
taskset_add_task(ts, pid, cpu, (void *)1);
evt_creation(pid, name, cpu, time);
if (!existing)
evt_activation(pid, cpu, time);
return 0;
} else {
return 1;
}
}
/*
static void attributes_parse(const char *attributes, char *name,
unsigned int *curr_pid, unsigned int *cpu,
unsigned int *prev_pid, char *prev_state)
{
int done = 0;
const char *p = attributes;
char attr[32], val[32];
while (!done) {
while ((*p != 0) && (*p != ' '))
p++;
if (*p == 0) {
done = 1;
} else {
p++;
sscanf(p, "%[^=]=%s", attr, val);
dprintf("Attr: %s = %s\n", attr, val);
if ((strcmp(attr, "pid") == 0) || (strcmp(attr, "next_pid") == 0)) {
*curr_pid = atoi(val);
}
if ((strcmp(attr, "comm") == 0) || (strcmp(attr, "next_comm") == 0)) {
strcpy(name, val);
}
if ((strcmp(attr, "target_cpu") == 0)) {
*cpu = atoi(val);
}
if ((strcmp(attr, "prev_pid") == 0)) {
*prev_pid = atoi(val);
}
if ((strcmp(attr, "prev_state") == 0)) {
*prev_state = val[0];
}
}
}
}
*/
static void trace(unsigned long long int time, int current_pid,
const char *name, int cpu, char *event)/*,
const char *prev_name, int prev_pid)*/
{
if (strcmp(event,"00000009")==0) {
create(time, current_pid, name, cpu);
evt_activation(current_pid, cpu, time);
} else
if (strcmp(event,"00000000")==0) {
evt_activation(current_pid, cpu, time);
} else
if (strcmp(event,"00000001")==0) {
evt_dispatch(0,current_pid, cpu, time);
} else
if (strcmp(event,"00000002")==0) {
evt_dispatch(current_pid,0, cpu, time);
} else
if (strcmp(event,"00000003")==0) {
evt_deactivation(current_pid, cpu, time);
}
else {
dprintf("Unknown event %s",event);
}
/*
if (event==9) {
create(time, current_pid, name, cpu);
evt_activation(current_pid, cpu, time);
}
if (strcmp(event, "sched_switch:") == 0) {
dprintf("Switch %d -> %d\n", prev_pid, current_pid);
create(time, current_pid, name, cpu);
create(time, prev_pid, prev_name, cpu);
if ((last_pid_run[cpu] != -1) && (last_pid_run[cpu] != prev_pid)) {
fprintf(stderr, "[%d]Error! %d != %d... Correcting\n", cpu,
last_pid_run[cpu], prev_pid);
prev_pid = last_pid_run[cpu];
}
//dispatch
if (current_pid == 0) {
cpu_events[cpu] = 1;
}
last_pid_run[cpu] = current_pid; //Last pid scheduled
if (prev_state != 'R') {
evt_deactivation(prev_pid, cpu, time);
}
evt_dispatch(prev_pid, current_pid, cpu, time);
}*/
}
long long int l4trace_parse(FILE * f)
{
char line[256];
char *res;
long long int current_time = -1;
if (cpu_events == NULL) {
cpu_events = (int *) malloc(MAX_CPUS * sizeof(int));
}
if (last_pid_run == NULL) {
int i;
last_pid_run = (int *) malloc(MAX_CPUS * sizeof(int));
for (i = 0; i < MAX_CPUS; i++) {
last_pid_run[i] = -1;
}
}
res = fgets(line, sizeof(line), f);
if (res) {
//char taskc[24], to, tasko[24], cstate, ostate, sched[6];
char taskc[24];
char event[32];
//unsigned int cpul, cpur, cprio, oprio, opid, cpid;
unsigned int cpu, current_pid;
static int start;
unsigned long us;
int i = 0;
current_time = 0;
if (line[0] != '#') {
cpu=1;
//sscanf(line, "%[^[][%d]%lu.%lu:%s%[^!]",
sscanf(line, "%s %s %lu",
taskc, event, &us);
dprintf("Task %s at %lu on CPU %d does %s\n", taskc, us,
cpu, event);
current_time=us;
if (strcmp(taskc,"????")!=0)
sscanf(taskc, "%x", ¤t_pid);
else current_pid=0;
if (start == 0) {
start = 1;
evt_start(current_time);
for (i = 0; i < MAX_CPUS; i++) {
create(current_time, 0, "idle\0", i);
cpu_events[i] = 0;
evt_initialize(0, i, current_time);
}
}
if ((current_pid != 0) && (cpu_events[cpu] == 0)) {
cpu_events[cpu] = 1;
create(current_time, current_pid, taskc, cpu);
last_pid_run[cpu] = current_pid; //Last pid scheduled
evt_dispatch(0, current_pid, cpu, current_time);
}
dprintf("%s", line);
trace(current_time, current_pid, taskc, cpu, event);
//, taskc,previous_pid);
previous_pid=current_pid;
}
} else {
free(cpu_events);
free(last_pid_run);
}
return current_time;
}
|
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "rawstr.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "tool_cb_hdr.h"
#include "memdebug.h" /* keep this as LAST include */
static char *parse_filename(const char *ptr, size_t len);
/*
** callback for CURLOPT_HEADERFUNCTION
*/
size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
{
struct OutStruct *outs = userdata;
const char *str = ptr;
const size_t cb = size * nmemb;
const char *end = (char*)ptr + cb;
/*
* Once that libcurl has called back tool_header_cb() the returned value
* is checked against the amount that was intended to be written, if
* it does not match then it fails with CURLE_WRITE_ERROR. So at this
* point returning a value different from sz*nmemb indicates failure.
*/
size_t failure = (size * nmemb) ? 0 : 1;
if(!outs->config)
return failure;
#ifdef DEBUGBUILD
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
warnf(outs->config, "Header data exceeds single call write limit!\n");
return failure;
}
#endif
if((cb > 20) && checkprefix("Content-disposition:", str)) {
const char *p = str + 20;
/* look for the 'filename=' parameter
(encoded filenames (*=) are not supported) */
for(;;) {
char *filename;
size_t len;
while(*p && (p < end) && !ISALPHA(*p))
p++;
if(p > end - 9)
break;
if(memcmp(p, "filename=", 9)) {
/* no match, find next parameter */
while((p < end) && (*p != ';'))
p++;
continue;
}
p += 9;
/* this expression below typecasts 'cb' only to avoid
warning: signed and unsigned type in conditional expression
*/
len = (ssize_t)cb - (p - str);
filename = parse_filename(p, len);
if(filename) {
outs->filename = filename;
outs->alloc_filename = TRUE;
outs->s_isreg = TRUE;
outs->fopened = FALSE;
outs->stream = NULL;
break;
}
else
return failure;
}
}
return cb;
}
/*
* Copies a file name part and returns an ALLOCATED data buffer.
*/
static char *parse_filename(const char *ptr, size_t len)
{
char *copy;
char *p;
char *q;
char stop = '\0';
/* simple implementation of strndup() */
copy = malloc(len+1);
if(!copy)
return NULL;
memcpy(copy, ptr, len);
copy[len] = '\0';
p = copy;
if(*p == '\'' || *p == '"') {
/* store the starting quote */
stop = *p;
p++;
}
else
stop = ';';
/* if the filename contains a path, only use filename portion */
q = strrchr(copy, '/');
if(q) {
p = q + 1;
if(!*p) {
Curl_safefree(copy);
return NULL;
}
}
/* If the filename contains a backslash, only use filename portion. The idea
is that even systems that don't handle backslashes as path separators
probably want the path removed for convenience. */
q = strrchr(p, '\\');
if(q) {
p = q + 1;
if(!*p) {
Curl_safefree(copy);
return NULL;
}
}
/* scan for the end letter and stop there */
q = p;
while(*q) {
if(q[1] && (q[0] == '\\'))
q++;
else if(q[0] == stop)
break;
q++;
}
*q = '\0';
/* make sure the file name doesn't end in \r or \n */
q = strchr(p, '\r');
if(q)
*q = '\0';
q = strchr(p, '\n');
if(q)
*q = '\0';
if(copy != p)
memmove(copy, p, strlen(p) + 1);
/* in case we built debug enabled, we allow an evironment variable
* named CURL_TESTDIR to prefix the given file name to put it into a
* specific directory
*/
#ifdef DEBUGBUILD
{
char *tdir = curlx_getenv("CURL_TESTDIR");
if(tdir) {
char buffer[512]; /* suitably large */
snprintf(buffer, sizeof(buffer), "%s/%s", tdir, copy);
Curl_safefree(copy);
copy = strdup(buffer); /* clone the buffer, we don't use the libcurl
aprintf() or similar since we want to use the
same memory code as the "real" parse_filename
function */
curl_free(tdir);
}
}
#endif
return copy;
}
|
/* $Id: win32_v.h 22152 2011-02-26 20:13:14Z rubidium $ */
/*
* This file is part of OpenCoaster Tycoon.
* OpenCoaster Tycoon is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenCoaster Tycoon 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 OpenCoaster Tycoon. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file win32_v.h Base of the Windows video driver. */
#ifndef VIDEO_WIN32_H
#define VIDEO_WIN32_H
#include "video_driver.hpp"
class VideoDriver_Win32: public VideoDriver {
public:
/* virtual */ const char *Start(const char * const *param);
/* virtual */ void Stop();
/* virtual */ void MakeDirty(int left, int top, int width, int height);
/* virtual */ void MainLoop();
/* virtual */ bool ChangeResolution(int w, int h);
/* virtual */ bool ToggleFullscreen(bool fullscreen);
/* virtual */ const char *GetName() const { return "win32"; }
bool MakeWindow(bool full_screen);
};
class FVideoDriver_Win32: public VideoDriverFactory<FVideoDriver_Win32> {
public:
static const int priority = 10;
/* virtual */ const char *GetName() { return "win32"; }
/* virtual */ const char *GetDescription() { return "Win32 GDI Video Driver"; }
/* virtual */ Driver *CreateInstance() { return new VideoDriver_Win32(); }
};
#endif /* VIDEO_WIN32_H */
|
// -*- C++ -*-
//=============================================================================
/**
* @file os_stddef.h
*
* standard type definitions
*
* @author Don Hinton <dhinton@dresystems.com>
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
// From https://publications.opengroup.org/t101
#ifndef ACE_OS_INCLUDE_OS_STDDEF_H
#define ACE_OS_INCLUDE_OS_STDDEF_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if !defined (ACE_LACKS_STDDEF_H)
# include /**/ <stddef.h>
#endif /* !ACE_LACKS_STDDEF_H */
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
// Signed integer type of the result of subtracting two pointers.
#if defined (ACE_LACKS_PTRDIFF_T)
# if !defined (ACE_PTRDIFF_T_TYPE)
# define ACE_PTRDIFF_T_TYPE unsigned long
# endif /* !ACE_PTRDIFF_T_TYPE */
typedef ACE_PTRDIFF_T_TYPE ptrdiff_t;
#endif /* ACE_LACKS_PTRDIFF_T */
/*
Integer type whose range of values can represent distinct wide-character
codes for all members of the largest character set specified among the
locales supported by the compilation environment: the null character has
the code value 0 and each member of the portable character set has a code
value equal to its value when used as the lone character in an integer
character constant.
*/
#if defined (ACE_LACKS_WCHAR_T)
# if !defined (ACE_WCHAR_T_TYPE)
# define ACE_WCHAR_T_TYPE long
# endif /* !ACE_WCHAR_T_TYPE */
typedef ACE_WCHAR_T_TYPE wchar_t;
#endif /* ACE_LACKS_WCHAR_T */
// Unsigned integer type of the result of the sizeof operator.
#if defined (ACE_LACKS_SIZE_T)
# if !defined (ACE_SIZE_T_TYPE)
# define ACE_SIZE_T_TYPE unsigned int
# endif /* !ACE_SIZE_T_TYPE */
typedef ACE_SIZE_T_TYPE size_t;
#endif /* ACE_LACKS_SIZE_T */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDDEF_H */
|
/*
* Copyright © 2009 Red Hat, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
*/
#ifndef HB_H_IN
#error "Include <hb.h> instead."
#endif
#ifndef HB_BLOB_H
#define HB_BLOB_H
#include "hb-common.h"
HB_BEGIN_DECLS
typedef enum {
HB_MEMORY_MODE_DUPLICATE,
HB_MEMORY_MODE_READONLY,
HB_MEMORY_MODE_WRITABLE,
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE
} hb_memory_mode_t;
typedef struct hb_blob_t hb_blob_t;
hb_blob_t *
hb_blob_create (const char *data,
unsigned int length,
hb_memory_mode_t mode,
void *user_data,
hb_destroy_func_t destroy);
hb_blob_t *
hb_blob_create_sub_blob (hb_blob_t *parent,
unsigned int offset,
unsigned int length);
hb_blob_t *
hb_blob_get_empty (void);
hb_blob_t *
hb_blob_reference (hb_blob_t *blob);
void
hb_blob_destroy (hb_blob_t *blob);
hb_bool_t
hb_blob_set_user_data (hb_blob_t *blob,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
void *
hb_blob_get_user_data (hb_blob_t *blob,
hb_user_data_key_t *key);
void
hb_blob_make_immutable (hb_blob_t *blob);
hb_bool_t
hb_blob_is_immutable (hb_blob_t *blob);
unsigned int
hb_blob_get_length (hb_blob_t *blob);
const char *
hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
char *
hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
HB_END_DECLS
#endif
|
// This file is part of Notepad++ project
// Copyright (C)2003 Don HO <don.h@free.fr>
//
// 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.
//
// Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the
// following:
// 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield.
// 3. Links to a library or executes a program that does any of the above.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SPLITTER_H
#define SPLITTER_H
#ifndef RESOURCE_H
#include "resource.h"
#endif //RESOURCE_H
#define SV_HORIZONTAL 0x00000001
#define SV_VERTICAL 0x00000002
#define SV_FIXED 0x00000004
#define SV_ENABLERDBLCLK 0x00000008
#define SV_ENABLELDBLCLK 0x00000010
#define SV_RESIZEWTHPERCNT 0x00000020
#define WM_GETSPLITTER_X (SPLITTER_USER + 1)
#define WM_GETSPLITTER_Y (SPLITTER_USER + 2)
#define WM_DOPOPUPMENU (SPLITTER_USER + 3)
#define WM_RESIZE_CONTAINER (SPLITTER_USER + 4)
const int HIEGHT_MINIMAL = 15;
enum Arrow {ARROW_LEFT, ARROW_UP, ARROW_RIGHT, ARROW_DOWN};
typedef bool WH;
const bool WIDTH = true;
const bool HEIGHT = false;
typedef bool ZONE_TYPE;
const bool TOP_LEFT = true;
const bool BOTTOM_RIGHT = false;
enum SplitterMode {
DYNAMIC, LEFT_FIX, RIGHT_FIX
};
class Splitter : public Window
{
public:
Splitter();
~Splitter(){};
void destroy() {
::DestroyWindow(_hSelf);
};
void resizeSpliter(RECT *pRect = NULL);
void init(HINSTANCE hInst, HWND hPere, int splitterSize,
int iSplitRatio, DWORD dwFlags);
void rotate();
int getPhisicalSize() const {
return _spiltterSize;
};
private:
RECT _rect;
int _splitPercent;
int _spiltterSize;
bool _isDraged;
DWORD _dwFlags;
bool _isFixed;
static bool _isHorizontalRegistered;
static bool _isVerticalRegistered;
static bool _isHorizontalFixedRegistered;
static bool _isVerticalFixedRegistered;
RECT _clickZone2TL, _clickZone2BR;
static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
int getClickZone(WH which);
void adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone);
void drawSplitter();
bool isVertical() const {return (_dwFlags & SV_VERTICAL) != 0;};
void paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir);
void gotoTopLeft();
void gotoRightBouuom();
bool isInLeftTopZone(const POINT &p) const {
return (((p.x >= _clickZone2TL.left) && (p.x <= _clickZone2TL.left + _clickZone2TL.right)) &&
(p.y >= _clickZone2TL.top) && (p.y <= _clickZone2TL.top + _clickZone2TL.bottom));
};
bool isInRightBottomZone(const POINT &p) const {
return (((p.x >= _clickZone2BR.left) &&
(p.x <= _clickZone2BR.left + _clickZone2BR.right)) &&
(p.y >= _clickZone2BR.top) &&
(p.y <= _clickZone2BR.top + _clickZone2BR.bottom));
};
int getSplitterFixPosX() {
long result = long(::SendMessage(_hParent, WM_GETSPLITTER_X, 0, 0));
return (LOWORD(result) - ((HIWORD(result) == RIGHT_FIX) ? _spiltterSize : 0));
};
int getSplitterFixPosY() {
long result = long(::SendMessage(_hParent, WM_GETSPLITTER_Y, 0, 0));
return (LOWORD(result) - ((HIWORD(result) == RIGHT_FIX) ? _spiltterSize : 0));
};
};
#endif //SPLITTER_H
|
/*
* Interface to SPI flash
*
* Copyright (C) 2008 Atmel Corporation
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _SPI_FLASH_H_
#define _SPI_FLASH_H_
#include <spi.h>
#include <linux/types.h>
#include <linux/compiler.h>
#define ENOTSUPP 524 /* Operation is not supported */
struct spi_flash {
struct spi_slave *spi;
const char *name;
/* Total flash size */
u32 size;
/* Write (page) size */
u32 page_size;
/* Erase (sector) size */
u32 sector_size;
/* Erase (block) size */
u32 block_size;
/* 3 or 4 byte address width */
u32 addr_width;
u8 read_opcode;
u8 write_opcode;
u16 berase_timeout; /* Bulk erase timeout */
int (*read)(struct spi_flash *flash, u32 offset,
size_t len, void *buf);
int (*write)(struct spi_flash *flash, u32 offset,
size_t len, const void *buf);
int (*erase)(struct spi_flash *flash, u32 offset,
size_t len);
int (*berase)(struct spi_flash *flash); /* Bulk Erase */
};
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode);
void spi_flash_free(struct spi_flash *flash);
static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
size_t len, void *buf)
{
return flash->read(flash, offset, len, buf);
}
static inline int spi_flash_write(struct spi_flash *flash, u32 offset,
size_t len, const void *buf)
{
return flash->write(flash, offset, len, buf);
}
static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
size_t len)
{
return flash->erase(flash, offset, len);
}
static inline int spi_flash_berase(struct spi_flash *flash)
{
if (!flash->berase)
return -ENOTSUPP;
return flash->berase(flash);
}
void spi_boot(void) __noreturn;
#endif /* _SPI_FLASH_H_ */
|
/***************************************************************************
qgsindexedfeature - QgsIndexFeature
-----------------------------------
begin : 15.1.2016
Copyright : (C) 2016 Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef QGSINDEXEDFEATURE_H
#define QGSINDEXEDFEATURE_H
#define SIP_NO_FILE
#include <QVector>
#include "qgsfeature.h"
/** \ingroup core
* Temporarily used structure to cache order by information
* \note not available in Python bindings
*/
class QgsIndexedFeature
{
public:
QVector<QVariant> mIndexes;
QgsFeature mFeature;
};
#endif // QGSINDEXEDFEATURE_H
|
/*
* IRC - Internet Relay Chat, contrib/m_clearchan.c
* Copyright (C) 2002 Hybrid Development Team
* Copyright (C) 2004 ircd-ratbox Development Team
*
* 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 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: m_clearchan.c 26421 2009-01-18 17:38:16Z jilles $
*/
#include "stdinc.h"
#include "ratbox_lib.h"
#include "struct.h"
#include "channel.h"
#include "client.h"
#include "hash.h"
#include "match.h"
#include "ircd.h"
#include "numeric.h"
#include "s_user.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "send.h"
#include "s_log.h"
#include "parse.h"
#include "modules.h"
#include "packet.h"
static int mo_clearchan(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
struct Message clearchan_msgtab = {
"CLEARCHAN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_clearchan, 2}}
};
mapi_clist_av2 clearchan_clist[] = { &clearchan_msgtab, NULL };
DECLARE_MODULE_AV2(clearchan, NULL, NULL, clearchan_clist, NULL, NULL, "$Revision: 26421 $");
/*
** mo_clearchan
** parv[0] = sender prefix
** parv[1] = channel
*/
static int
mo_clearchan(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
struct membership *msptr;
struct Client *target_p;
rb_dlink_node *ptr;
rb_dlink_node *next_ptr;
/* admins only */
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, ":%s NOTICE %s :You have no A flag", me.name, parv[0]);
return 0;
}
if((chptr = find_channel(parv[1])) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if(IsMember(source_p, chptr))
{
sendto_one(source_p, ":%s NOTICE %s :*** Please part %s before using CLEARCHAN",
me.name, source_p->name, parv[1]);
return 0;
}
/* quickly make everyone a peon.. */
RB_DLINK_FOREACH(ptr, chptr->members.head)
{
msptr = ptr->data;
msptr->flags &= ~CHFL_CHANOP | CHFL_VOICE;
}
sendto_wallops_flags(UMODE_WALLOP, &me,
"CLEARCHAN called for [%s] by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "CLEARCHAN called for [%s] by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
if(*chptr->chname != '&')
{
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :CLEARCHAN called for [%s] by %s!%s@%s",
me.name, parv[1], source_p->name, source_p->username, source_p->host);
/* SJOIN the user to give them ops, and lock the channel */
sendto_server(client_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s +ntsi :@%s",
me.name, (long)(chptr->channelts - 1), chptr->chname, source_p->name);
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name, source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, chptr->chname, source_p->name);
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
/* Take the TS down by 1, so we don't see the channel taken over
* again. */
if(chptr->channelts)
chptr->channelts--;
chptr->mode.mode = MODE_SECRET | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS;
chptr->mode.key[0] = '\0';
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
{
msptr = ptr->data;
target_p = msptr->client_p;
/* skip the person we just added.. */
if(is_chanop(msptr))
continue;
sendto_channel_local(ALL_MEMBERS, chptr,
":%s KICK %s %s :CLEARCHAN",
source_p->name, chptr->chname, target_p->name);
if(*chptr->chname != '&')
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
":%s KICK %s %s :CLEARCHAN",
source_p->name, chptr->chname, target_p->name);
remove_user_from_channel(msptr);
}
/* Join the user themselves to the channel down here, so they dont see a nicklist
* or people being kicked */
sendto_one(source_p, ":%s!%s@%s JOIN %s",
source_p->name, source_p->username, source_p->host, chptr->chname);
channel_member_names(chptr, source_p, 1);
return 0;
}
|
/* linux/arch/arm/mach-s3c2410/mach-smdk2413.c
*
* Copyright (c) 2006 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
* Thanks to Dimity Andric (TomTom) and Steven Ryu (Samsung) for the
* loans of SMDK2413 to work with.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/hardware.h>
#include <asm/hardware/iomd.h>
#include <asm/setup.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
//#include <asm/debug-ll.h>
#include <asm/arch/regs-serial.h>
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-lcd.h>
#include <asm/arch/idle.h>
#include <asm/arch/fb.h>
#include "s3c2410.h"
#include "s3c2412.h"
#include "clock.h"
#include "devs.h"
#include "cpu.h"
#include "common-smdk.h"
static struct map_desc smdk2413_iodesc[] __initdata = {
};
static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
/* IR port */
[2] = {
.hwport = 2,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x43,
.ufcon = 0x51,
}
};
static struct platform_device *smdk2413_devices[] __initdata = {
&s3c_device_usb,
//&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
};
static struct s3c24xx_board smdk2413_board __initdata = {
.devices = smdk2413_devices,
.devices_count = ARRAY_SIZE(smdk2413_devices)
};
static void __init smdk2413_fixup(struct machine_desc *desc,
struct tag *tags, char **cmdline,
struct meminfo *mi)
{
if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
mi->nr_banks=1;
mi->bank[0].start = 0x30000000;
mi->bank[0].size = SZ_64M;
mi->bank[0].node = 0;
}
}
static void __init smdk2413_map_io(void)
{
s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
s3c24xx_set_board(&smdk2413_board);
}
static void __init smdk2413_machine_init(void)
{
smdk_machine_init();
}
MACHINE_START(S3C2413, "S3C2413")
/* Maintainer: Ben Dooks <ben@fluff.org> */
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
.fixup = smdk2413_fixup,
.init_irq = s3c24xx_init_irq,
.map_io = smdk2413_map_io,
.init_machine = smdk2413_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
MACHINE_START(SMDK2413, "SMDK2413")
/* Maintainer: Ben Dooks <ben@fluff.org> */
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
.fixup = smdk2413_fixup,
.init_irq = s3c24xx_init_irq,
.map_io = smdk2413_map_io,
.init_machine = smdk2413_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
|
// 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 PPAPI_THUNK_AUDIO_INPUT_API_H_
#define PPAPI_THUNK_AUDIO_INPUT_API_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
namespace ppapi {
class TrackedCallback;
namespace thunk {
class PPB_AudioInput_API {
public:
virtual ~PPB_AudioInput_API() {}
virtual int32_t EnumerateDevices0_2(
PP_Resource* devices,
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
void* user_data) = 0;
virtual int32_t Open0_2(PP_Resource device_ref,
PP_Resource config,
PPB_AudioInput_Callback_0_2 audio_input_callback_0_2,
void* user_data,
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t Open(PP_Resource device_ref,
PP_Resource config,
PPB_AudioInput_Callback audio_input_callback,
void* user_data,
scoped_refptr<TrackedCallback> callback) = 0;
virtual PP_Resource GetCurrentConfig() = 0;
virtual PP_Bool StartCapture() = 0;
virtual PP_Bool StopCapture() = 0;
virtual void Close() = 0;
};
}
}
#endif
|
/*
* Copyright (C) 2008-2010 Geometer Plus <contact@geometerplus.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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __HHCREFERENCECOLLECTOR_H__
#define __HHCREFERENCECOLLECTOR_H__
#include <vector>
#include "../html/HtmlReader.h"
class CHMReferenceCollection;
class HHCReferenceCollector : public HtmlReader {
public:
HHCReferenceCollector(CHMReferenceCollection &collection);
private:
void startDocumentHandler();
void endDocumentHandler();
bool tagHandler(const HtmlTag &tag);
bool characterDataHandler(const char*, size_t, bool);
private:
CHMReferenceCollection &myReferenceCollection;
};
#endif /* __HHCREFERENCECOLLECTOR_H__ */
|
#ifndef __PERF_MAP_H
#define __PERF_MAP_H
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/rbtree.h>
#include <stdio.h>
#include <stdbool.h>
#include "types.h"
enum map_type {
MAP__FUNCTION = 0,
MAP__VARIABLE,
};
#define MAP__NR_TYPES (MAP__VARIABLE + 1)
extern const char *map_type__name[MAP__NR_TYPES];
struct dso;
struct ref_reloc_sym;
struct map_groups;
struct machine;
struct map {
union {
struct rb_node rb_node;
struct list_head node;
};
u64 start;
u64 end;
enum map_type type;
u32 priv;
u64 pgoff;
/* ip -> dso rip */
u64 (*map_ip)(struct map *, u64);
/* dso rip -> ip */
u64 (*unmap_ip)(struct map *, u64);
struct dso *dso;
struct map_groups *groups;
};
struct kmap {
struct ref_reloc_sym *ref_reloc_sym;
struct map_groups *kmaps;
};
struct map_groups {
struct rb_root maps[MAP__NR_TYPES];
struct list_head removed_maps[MAP__NR_TYPES];
struct machine *machine;
};
/* Native host kernel uses -1 as pid index in machine */
#define HOST_KERNEL_ID (-1)
#define DEFAULT_GUEST_KERNEL_ID (0)
struct machine {
struct rb_node rb_node;
pid_t pid;
char *root_dir;
struct list_head user_dsos;
struct list_head kernel_dsos;
struct map_groups kmaps;
struct map *vmlinux_maps[MAP__NR_TYPES];
};
static inline
struct map *machine__kernel_map(struct machine *self, enum map_type type)
{
return self->vmlinux_maps[type];
}
static inline struct kmap *map__kmap(struct map *self)
{
return (struct kmap *)(self + 1);
}
static inline u64 map__map_ip(struct map *map, u64 ip)
{
return ip - map->start + map->pgoff;
}
static inline u64 map__unmap_ip(struct map *map, u64 ip)
{
return ip + map->start - map->pgoff;
}
static inline u64 identity__map_ip(struct map *map __used, u64 ip)
{
return ip;
}
/* rip/ip <-> addr suitable for passing to `objdump --start-address=` */
u64 map__rip_2objdump(struct map *map, u64 rip);
u64 map__objdump_2ip(struct map *map, u64 addr);
struct symbol;
typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
void map__init(struct map *self, enum map_type type,
u64 start, u64 end, u64 pgoff, struct dso *dso);
struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
u64 pgoff, u32 pid, char *filename,
enum map_type type, char *cwd, int cwdlen);
void map__delete(struct map *self);
struct map *map__clone(struct map *self);
int map__overlap(struct map *l, struct map *r);
size_t map__fprintf(struct map *self, FILE *fp);
int map__load(struct map *self, symbol_filter_t filter);
struct symbol *map__find_symbol(struct map *self,
u64 addr, symbol_filter_t filter);
struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
symbol_filter_t filter);
void map__fixup_start(struct map *self);
void map__fixup_end(struct map *self);
void map__reloc_vmlinux(struct map *self);
size_t __map_groups__fprintf_maps(struct map_groups *self,
enum map_type type, int verbose, FILE *fp);
void maps__insert(struct rb_root *maps, struct map *map);
struct map *maps__find(struct rb_root *maps, u64 addr);
void map_groups__init(struct map_groups *self);
int map_groups__clone(struct map_groups *self,
struct map_groups *parent, enum map_type type);
size_t map_groups__fprintf(struct map_groups *self, int verbose, FILE *fp);
size_t map_groups__fprintf_maps(struct map_groups *self, int verbose, FILE *fp);
typedef void (*machine__process_t)(struct machine *self, void *data);
void machines__process(struct rb_root *self, machine__process_t process, void *data);
struct machine *machines__add(struct rb_root *self, pid_t pid,
const char *root_dir);
struct machine *machines__find_host(struct rb_root *self);
struct machine *machines__find(struct rb_root *self, pid_t pid);
struct machine *machines__findnew(struct rb_root *self, pid_t pid);
char *machine__mmap_name(struct machine *self, char *bf, size_t size);
int machine__init(struct machine *self, const char *root_dir, pid_t pid);
static inline bool machine__is_default_guest(struct machine *self)
{
return self ? self->pid == DEFAULT_GUEST_KERNEL_ID : false;
}
static inline bool machine__is_host(struct machine *self)
{
return self ? self->pid == HOST_KERNEL_ID : false;
}
static inline void map_groups__insert(struct map_groups *self, struct map *map)
{
maps__insert(&self->maps[map->type], map);
map->groups = self;
}
static inline struct map *map_groups__find(struct map_groups *self,
enum map_type type, u64 addr)
{
return maps__find(&self->maps[type], addr);
}
struct symbol *map_groups__find_symbol(struct map_groups *self,
enum map_type type, u64 addr,
struct map **mapp,
symbol_filter_t filter);
struct symbol *map_groups__find_symbol_by_name(struct map_groups *self,
enum map_type type,
const char *name,
struct map **mapp,
symbol_filter_t filter);
static inline
struct symbol *machine__find_kernel_symbol(struct machine *self,
enum map_type type, u64 addr,
struct map **mapp,
symbol_filter_t filter)
{
return map_groups__find_symbol(&self->kmaps, type, addr, mapp, filter);
}
static inline
struct symbol *machine__find_kernel_function(struct machine *self, u64 addr,
struct map **mapp,
symbol_filter_t filter)
{
return machine__find_kernel_symbol(self, MAP__FUNCTION, addr, mapp, filter);
}
static inline
struct symbol *map_groups__find_function_by_name(struct map_groups *self,
const char *name, struct map **mapp,
symbol_filter_t filter)
{
return map_groups__find_symbol_by_name(self, MAP__FUNCTION, name, mapp, filter);
}
int map_groups__fixup_overlappings(struct map_groups *self, struct map *map,
int verbose, FILE *fp);
struct map *map_groups__find_by_name(struct map_groups *self,
enum map_type type, const char *name);
struct map *machine__new_module(struct machine *self, u64 start, const char *filename);
void map_groups__flush(struct map_groups *self);
#endif /* __PERF_MAP_H */
|
/*
*** Column-Major 3x3 Matrix class
*** src/math/matrix3.h
Copyright T. Youngs 2012-2018
This file is part of Dissolve.
Dissolve 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.
Dissolve 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 Dissolve. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DISSOLVE_MATRIX3_H
#define DISSOLVE_MATRIX3_H
#include "templates/vector3.h"
// Column-major 3x3 matrix
class Matrix3
{
public:
// Constructor
Matrix3();
private:
// Matrix
double matrix_[9];
/*
* Operators
*/
public:
Matrix3 operator*(const Matrix3& B) const;
Matrix3 operator*(const double a) const;
Matrix3 operator+(const Matrix3& B) const;
Matrix3 operator-(const Matrix3& B) const;
Vec3<double> operator*(const Vec3<double>& v) const;
Matrix3& operator*=(const Matrix3& B);
Matrix3& operator*=(const double a);
double& operator[](int);
/*
* General Routines
*/
public:
// Reset the matrix to the identity
void setIdentity();
// Prints the matrix to stdout
void print() const;
// Set the zero matrix
void zero();
// Return matrix array
double* matrix();
// Return transpose of current matrix
Matrix3& transpose();
// Calculate determinant
double determinant() const;
// Invert matrix
void invert();
// Return maximal element
double max() const;
/*
* Column Operations
*/
public:
// Copy column contents to supplied Vec3
Vec3<double> columnAsVec3(int col) const;
// Set specified row from supplied triplet of values
void setRow(int row, double x, double y, double z);
// Set specified column from supplied values
void setColumn(int col, double a, double b, double c);
// Set specified column from supplied Vec3
void setColumn(int col, const Vec3<double> vec);
// Adjust specified column from supplied values
void adjustColumn(int col, double a, double b, double c);
// Adjust specified column from supplied Vec3
void adjustColumn(int col, const Vec3<double> vec);
// Calculate column magnitude
double columnMagnitude(int column) const;
// Multiply single column by single value
void columnMultiply(int col, double d);
// Multiply columns by values in supplied vector
void columnMultiply(const Vec3<double> vec);
// Normalise specified column to 1
void columnNormalise(int column);
// Orthogonalise rotation matrix column w.r.t. one (or two) other columns)
void orthogonaliseColumn(int targetcol, int orthcol1, int orthocol2 = -1);
/*
* Rotations
*/
public:
// Create rotation matrix about X
void createRotationX(double angle);
// Create XY rotation matrix
void createRotationXY(double anglex, double angley);
// Create rotation matrix about Y
void createRotationY(double angle);
// Create rotation matrix about Z
void createRotationZ(double angle);
// Create axis rotation quaternion
void createRotationAxis(double ax, double ay, double az, double angle, bool normalise);
// Apply rotation about X axis
void applyRotationX(double angle);
// Apply axis rotation quaternion
void applyRotationAxis(double ax, double ay, double az, double angle, bool normalise);
/*
* Scaling
*/
public:
// Apply a general scaling to the matrix (as glScaled would to)
void applyScaling(double scalex, double scaley, double scalez);
// Apply a general scaling to the matrix (as glScaled would to)
void applyScaling(Vec3<double> scaling);
// Apply an xy-scaling to the matrix
void applyScalingXY(double scalex, double scaley);
// Apply an x-scaling to the matrix
void applyScalingX(double scale);
// Apply a y-scaling to the matrix
void applyScalingY(double scale);
// Apply a z-scaling to the matrix
void applyScalingZ(double scale);
/*
* Transforms
*/
public:
// Transform coordinates supplied and return as Vec3<double>
Vec3<double> transform(double x, double y, double z) const;
// Transform coordinates supplied and return as Vec3<double>
Vec3<double> transform(const Vec3<double> vec) const;
/*
* Special Functions
*/
public:
// Construct 'cross-product' matrix of the supplied vector using cyclic permutations
void makeCrossProductMatrix(Vec3<double>& v);
};
#endif
|
/*
*
* Copyright (C) 2017 Devon Richards
* ckb-mviz 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.
*
* ckb-mviz 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 ckb-mviz. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <pulse/simple.h>
#include "../ckb/ckb-anim.h"
#include "kiss_fftr.h"
void ckb_info(){
// Plugin info
CKB_NAME("Music Visualization");
CKB_VERSION("0.2");
CKB_COPYRIGHT("2017", "RULER501");
CKB_LICENSE("GPLv2");
CKB_GUID("{097D69F0-70B2-48B8-AFE2-25CA1DB0D92C}");
CKB_DESCRIPTION("A collection of music visualization effects");
// Effect parameters
CKB_PARAM_AGRADIENT("color", "Fade color:", "", "ffffffff");
CKB_PARAM_BOOL("power", "Use Power instead of Magnitude?", 0);
// Timing/input parameters
CKB_KPMODE(CKB_KP_NONE);
CKB_TIMEMODE(CKB_TIME_ABSOLUTE);
CKB_REPEAT(FALSE);
CKB_LIVEPARAMS(TRUE);
// Presets
CKB_PRESET_START("Default");
CKB_PRESET_PARAM("power", "0");
CKB_PRESET_PARAM("trigger", "0");
CKB_PRESET_PARAM("kptrigger", "1");
CKB_PRESET_END;
}
double powers[2048] = { 0.f };
kiss_fft_cpx* inbuf;
kiss_fft_cpx* outbuf;
ckb_gradient animcolor = { 0 };
pa_simple *pas = NULL;
int power = 0;
void ckb_init(ckb_runctx* context){
static const pa_sample_spec ss ={
.format = PA_SAMPLE_S16LE,
.rate = 44100,
.channels = 1
};
pas = pa_simple_new(NULL, "CKB Music Viz", PA_STREAM_RECORD, NULL, "CKB Music Viz", &ss, NULL, NULL, NULL);
inbuf = malloc(2048*sizeof(kiss_fft_cpx));
outbuf = malloc(2048*sizeof(kiss_fft_cpx));
}
void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
CKB_PARSE_AGRADIENT("color", &animcolor){}
CKB_PARSE_BOOL("power", &power);
}
void anim_add(ckb_key* press, float x, float y){
return;
}
void anim_remove(float x, float y){
return;
}
void ckb_keypress(ckb_runctx* context, ckb_key* key, int x, int y, int state){
return;
}
void ckb_start(ckb_runctx* context, int state){
return;
}
void ckb_time(ckb_runctx* context, double delta){
return;
}
int max(int a, int b){
return a > b ? a : b;
}
int min(int a, int b){
return a < b ? a : b;
}
int gcounter = 0;
void getFreqDec(){
int16_t data[2048];
pa_simple_read(pas, data, sizeof(data), NULL);
for(int j=0; j<2048; j++){
inbuf[j].r = data[j];
inbuf[j].i = 0;
}
kiss_fft_cfg config = kiss_fft_alloc(2048, 0, NULL, NULL);
kiss_fft(config, inbuf, outbuf);
for(unsigned int j=0; j < 2048; j++)
if(power)
powers[j] = outbuf[j].r*outbuf[j].r + outbuf[j].i*outbuf[j].i;
else
powers[j] = sqrt(outbuf[j].r*outbuf[j].r + outbuf[j].i*outbuf[j].i);
kiss_fft_free(config);
kiss_fft_cleanup();
}
int ckb_frame(ckb_runctx* context){
CKB_KEYCLEAR(context);
ckb_key* keys = context->keys;
ckb_key* maxkey = keys+context->keycount-1;
getFreqDec();
unsigned int frames = context->width*context->height - 1;
int height = context->height;
for(ckb_key* key = keys; key < maxkey; key++){
int posl = height*key->x + key->y - 1;
posl = max(posl, 0);
int posr = height*key->x + key->y + 1;
posr = max(posr, 0);
int lowi = floorf(pow(2,posl*11.f/frames));
int highi = ceilf(pow(2,posr*11.f/frames));
highi= min(highi, (int)sizeof(powers)/sizeof(double)-1);
lowi = max(lowi, 0);
double total = 0;
unsigned int height = context->height;
for(unsigned int i = lowi; i <= highi; i++)
total += powers[i];
total /= highi - lowi + 1;
float a, r, g, b;
ckb_grad_color(&a, &r, &g, &b, &animcolor, total/(power ? 150994944.f : 12288.f));
ckb_alpha_blend(key, a, r, g, b);
}
return 0;
}
|
/*
* Reverse regular expression library
* Copyright (C) 2013 Piotr Duszyński <piotr[at]duszynski.eu>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking portspoof statically or dynamically with other modules is making
* a combined work based on Portspoof. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
* In addition, as a special exception, the copyright holder of Portspoof
* gives you permission to combine Portspoof with free software programs or
* libraries that are released under the GNU LGPL. You may copy
* and distribute such a system following the terms of the GNU GPL for
* Portspoof and the licenses of the other code concerned.
*
* Note that people who make modified versions of Portspoof are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
* to release a modified version without this exception; this exception
* also makes it possible to release a modified version which carries
* forward this exception.
*/
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
typedef vector<char> wektor;
wektor process_regex(std::string str);
wektor revregexn(wektor str);
wektor escape_hex(wektor str,int start_offset,int end_offset);
wektor fill_specialchars(wektor str,int start_offset,int end_offset);
wektor revregex_process_bracket(wektor str,int start_offset,int end_offset);
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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 Street #330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glib/gi18n.h>
#include <glib-object.h>
#include <gthumb.h>
#include "actions.h"
#define BROWSER_DATA_KEY "photobucket-browser-data"
static const char *ui_info =
"<ui>"
" <menubar name='MenuBar'>"
" <menu name='File' action='FileMenu'>"
" <menu name='Export' action='ExportMenu'>"
" <placeholder name='Web_Services'>"
" <menuitem action='File_Export_PhotoBucket'/>"
" </placeholder>"
" </menu>"
" </menu>"
" </menubar>"
" <popup name='ExportPopup'>"
" <placeholder name='Web_Services'>"
" <menuitem action='File_Export_PhotoBucket'/>"
" </placeholder>"
" </popup>"
"</ui>";
static GtkActionEntry action_entries[] = {
{ "File_Export_PhotoBucket", "photobucket",
N_("Photobucket..."), NULL,
N_("Upload photos to Photobucket"),
G_CALLBACK (gth_browser_activate_action_export_photobucket) },
};
typedef struct {
GtkActionGroup *action_group;
} BrowserData;
static void
browser_data_free (BrowserData *data)
{
g_free (data);
}
void
pb__gth_browser_construct_cb (GthBrowser *browser)
{
BrowserData *data;
GError *error = NULL;
guint merge_id;
g_return_if_fail (GTH_IS_BROWSER (browser));
data = g_new0 (BrowserData, 1);
data->action_group = gtk_action_group_new ("PhotoBucket Actions");
gtk_action_group_set_translation_domain (data->action_group, NULL);
gtk_action_group_add_actions (data->action_group,
action_entries,
G_N_ELEMENTS (action_entries),
browser);
gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->action_group, 0);
merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
if (merge_id == 0) {
g_warning ("building ui failed: %s", error->message);
g_clear_error (&error);
}
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
|
#ifndef CONCURRENT_SET_H_
#define CONCURRENT_SET_H_
#include <map>
#include <boost/thread.hpp>
template <class T>
class concurrent_set {
typedef typename std::set<T> set_type;
typedef typename set_type::size_type size_type;
typedef typename set_type::iterator iterator;
private:
set_type aset;
mutable boost::mutex lock;
public:
concurrent_set() : aset() { }
std::pair<iterator, bool>
insert(const T &elem) {
boost::mutex::scoped_lock guard(lock);
return aset.insert(elem);
}
bool empty() const {
boost::mutex::scoped_lock guard(lock);
return aset.empty();
}
size_type size() const {
boost::mutex::scoped_lock guard(lock);
return aset.size();
}
iterator insert(iterator, const T &x) {
boost::mutex::scoped_lock guard(lock);
return aset.insert(x);
}
void erase(iterator position) {
boost::mutex::scoped_lock guard(lock);
aset.erase(position);
}
size_type erase(const T& x) {
boost::mutex::scoped_lock guard(lock);
return aset.erase(x);
}
void clear() {
boost::mutex::scoped_lock guard(lock);
aset.clear();
}
iterator begin() const {
boost::mutex::scoped_lock guard(lock);
return aset.begin();
}
iterator end() const {
boost::mutex::scoped_lock guard(lock);
return aset.end();
}
};
#endif /*CONCURRENT_SET_H_*/
|
#ifndef _GRAPH_LIST_H
#define _GRAPH_LIST_H
#include "list_single.h"
#define WHITE 0
#define GRAY 1
#define BLACK 2
typedef struct vertex_node{
char value; /* data element */
} vertex_t;
typedef struct index_node {
int key; /* index value */
schain_t chain; /* index chain */
} index_t;
typedef struct edge_node {
int v; /* edge start-vertex */
int w; /* edge end-vertex */
} edge_t;
typedef struct graph {
int direct; /* graph attribute */
vertex_t *vset; /* the vertex set */
int V, E; /* the number of vertex and edge */
slist_t *lists; /* vertex list */
} graph_t;
#endif
|
/*
* decode.h
*
* ShowEQ Distributed under GPL
* http://www.hackersquest.gomp.ch/
*/
#ifndef EQDECODE_H
#define EQDECODE_H
#define FLAG_COMP 0x1000 // Compressed packet
#define FLAG_COMBINED 0x2000 // Combined packet
#define FLAG_CRYPTO 0x4000 // Encrypted packet
#define FLAG_IMPLICIT 0x8000 // Packet with implicit length
#define FLAG_DECODE (FLAG_COMP | FLAG_COMBINED | FLAG_IMPLICIT | FLAG_CRYPTO)
#endif // EQDECODE_H
|
/**
* $Id$
* Copyright (C) 2008 - 2014 Nils Asmussen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#include <common.h>
#include <mem/layout.h>
#include <mem/pagetables.h>
#include <spinlock.h>
#include <lockguard.h>
#include <cpu.h>
#include <string.h>
#include <assert.h>
class PageDir : public PageDirBase {
friend class PageDirBase;
class PTAllocator : public PageTables::Allocator {
public:
explicit PTAllocator(uintptr_t physStart,size_t count)
: _phys(physStart), _end(physStart + count * PAGE_SIZE) {
}
virtual frameno_t allocPage() override {
return 0;
}
virtual frameno_t allocPT() override {
assert(_phys < _end);
frameno_t frame = _phys / PAGE_SIZE;
_phys += PAGE_SIZE;
return frame;
}
virtual void freePage(frameno_t) override {
}
virtual void freePT(frameno_t) override {
}
private:
uintptr_t _phys;
uintptr_t _end;
};
public:
explicit PageDir() : PageDirBase(), freeKStack(), lock(), pts() {
}
PageTables *getPageTables() {
return &pts;
}
static void flushTLB() {
CPU::setCR3(CPU::getCR3());
}
/**
* Enables NXE if possible.
*/
static void enableNXE();
/**
* Creates a kernel-stack at an unused address.
*
* @return the used address
*/
uintptr_t createKernelStack();
/**
* Removes the given kernel-stack
*
* @param addr the address of the kernel-stack
*/
void removeKernelStack(uintptr_t addr);
private:
static void setWriteProtection(bool enabled) {
if(enabled)
CPU::setCR0(CPU::getCR0() | CPU::CR0_WRITE_PROTECT);
else
CPU::setCR0(CPU::getCR0() & ~CPU::CR0_WRITE_PROTECT);
}
static uintptr_t mapToTemp(frameno_t frame);
static void unmapFromTemp();
uintptr_t freeKStack;
SpinLock lock;
PageTables pts;
static uintptr_t freeAreaAddr;
static uint8_t sharedPtbls[][PAGE_SIZE];
};
inline void PageTables::flushAddr(uintptr_t addr,bool wasPresent) {
if(wasPresent)
asm volatile ("invlpg (%0)" : : "r" (addr));
}
inline void PageTables::flushPT(uintptr_t) {
// nothing to do
}
inline uintptr_t PageDirBase::getPhysAddr() const {
const PageDir *pdir = static_cast<const PageDir*>(this);
return pdir->pts.getRoot();
}
inline bool PageDirBase::isInUserSpace(uintptr_t virt,size_t count) {
return virt + count <= KERNEL_AREA && virt + count >= virt;
}
inline uintptr_t PageDirBase::getAccess(frameno_t frame) {
if(frame * PAGE_SIZE < DIR_MAP_AREA_SIZE)
return DIR_MAP_AREA + frame * PAGE_SIZE;
return PageDir::mapToTemp(frame);
}
inline void PageDirBase::removeAccess(frameno_t frame) {
if(frame * PAGE_SIZE >= DIR_MAP_AREA_SIZE)
PageDir::unmapFromTemp();
}
inline bool PageDirBase::isPresent(uintptr_t virt) const {
const PageDir *pdir = static_cast<const PageDir*>(this);
return pdir->pts.isPresent(virt);
}
inline frameno_t PageDirBase::getFrameNo(uintptr_t virt) const {
const PageDir *pdir = static_cast<const PageDir*>(this);
return pdir->pts.getFrameNo(virt);
}
inline void PageDirBase::zeroToUser(void *dst,size_t count) {
PageDir::setWriteProtection(false);
memclear(dst,count);
PageDir::setWriteProtection(true);
}
inline size_t PageDirBase::getPageCount() const {
const PageDir *pdir = static_cast<const PageDir*>(this);
return pdir->pts.getPageCount();
}
inline void PageDirBase::print(OStream &os,uint parts) const {
const PageDir *pdir = static_cast<const PageDir*>(this);
pdir->pts.print(os,parts);
}
|
/**
* @file test_sample_queue.c
* @author Sushant Sundaresh
* @date 2016-12-04
* @details
* Tests the sample queue and data accessors in isolation prior
* to on-device testing.
*/
#include "test_helpers.h"
#include "data.h"
#include "timer_driver.h"
#include "sample_queue.h"
/* Unit under test */
static sSampleQueue uut;
static sData test_data, observed_data;
static uint8_t test_bytes[MAX_DATA_BYTES];
static sTicks test_clock;
/* Output Parsing */
static void clear_test_clock_ (void) {
int k;
for (k = 0; k < CLOCK_BYTE_WIDTH; k++) {
test_clock.count[k] = 0;
}
}
static void set_test_clock_ (uint8_t msb, uint8_t misb, uint8_t lsb) {
test_clock.count[0] = msb;
test_clock.count[1] = misb;
test_clock.count[2] = lsb;
}
static void set_test_bytes_ (uint8_t msb, uint8_t misb, uint8_t lsb) {
test_bytes[0] = msb;
test_bytes[1] = misb;
test_bytes[2] = lsb;
}
static bool create_sample_(sData *data, eDataType type, uint8_t *bytes, uint8_t num_bytes, sTicks *timestamp) {
bool success = true;
success = success & (ksuccess == data_set_type(data, type));
int k;
for (k = 0; k < num_bytes; k++) {
success = success && (ksuccess == data_add_byte(data, bytes[k]));
}
success = success && (ksuccess == data_set_ticks(data,timestamp));
return success;
}
static void clear_sample_(sData *data) {
data_set_type(data, kdatatype_unset);
}
static bool compare_samples_(sData *a, sData *b) {
bool types, bytes, ticks;
eDataType atype = a->type;
eDataType btype = b->type;
types = atype == btype;
uint8_t abytes[MAX_DATA_BYTES]; uint8_t alen;
uint8_t bbytes[MAX_DATA_BYTES]; uint8_t blen;
data_get_bytes(a,abytes,&alen);
data_get_bytes(b,bbytes,&blen);
bytes = (alen == blen);
int k;
if (bytes) {
for (k = 0; k < alen; k++) {
bytes = bytes && (abytes[k] == bbytes[k]);
}
}
sTicks aticks, bticks;
data_get_ticks(a, &aticks);
data_get_ticks(b, &bticks);
ticks = true;
for (k = CLOCK_BYTE_WIDTH-1; k > -1; k--) {
ticks = ticks && (aticks.count[k] == bticks.count[k]);
}
return types && bytes && ticks;
}
/* Unit Test */
int main (int argc, char **argv) {
(void) argc; (void) argv;
clear_test_clock_();
/* Vector 0: Queue Initialization */
if (!check(kerror == sampleq_init(NULL))) { return 1; }
if (!check(ksuccess == sampleq_init(&uut))) { return 1; }
increment_test_vector();
/* Vector 1: Data Size Checking */
if (!check(create_sample_(&test_data, kdatatype_unset, test_bytes, 0, &test_clock))) { return 1; }
if (!check(!create_sample_(&test_data, kdatatype_unset, test_bytes, 1, &test_clock))) { return 1; }
increment_test_vector();
/* Vector 2: Data bytes and clock setting, and empty queue enq and deq */
set_test_bytes_(4,5,6);
set_test_clock_(3,2,1);
if (!check(create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock))) { return 1; }
clear_sample_(&observed_data);
if (!check(kfailure == sampleq_dequeue(&uut, &observed_data))) { return 1; }
if (!check(ksuccess == sampleq_enqueue(&uut, &test_data))) { return 1; }
if (!check(ksuccess == sampleq_dequeue(&uut, &observed_data))) { return 1; }
if (!check(compare_samples_(&test_data, &observed_data))) { return 1; }
increment_test_vector();
/* Vector 3: Test full and empty conditions */
sampleq_init(&uut);
int k = 0;
do {
set_test_bytes_(k+2,k+1,k+0);
set_test_clock_(k+0,k+1,k+2);
create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock);
k++;
} while (sampleq_enqueue(&uut, &test_data) == ksuccess);
if (!check(SAMPLE_QUEUE_LENGTH+1 == k)) { return 1; }
k = 0;
while (sampleq_dequeue(&uut, &observed_data) == ksuccess) {
set_test_bytes_(k+2,k+1,k+0);
set_test_clock_(k+0,k+1,k+2);
create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock);
if (!check(compare_samples_(&test_data, &observed_data))) { return 1; }
k++;
}
if (!check(SAMPLE_QUEUE_LENGTH == k)) { return 1; }
increment_test_vector();
/* Vector 4: Test wraparound */
sampleq_init(&uut);
set_test_clock_(0,0,0);
k = 0;
do {
set_test_bytes_(0,0,k);
create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock);
k++;
} while (sampleq_enqueue(&uut, &test_data) == ksuccess);
sampleq_dequeue(&uut, &observed_data);
sampleq_dequeue(&uut, &observed_data);
do {
set_test_bytes_(0,0,k);
create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock);
k++;
} while (sampleq_enqueue(&uut, &test_data) == ksuccess);
if (!check(uut.buffer[0].bytes[2] == k-2)) { return 1; }
increment_test_vector();
/* Vector 5: Write then read a sample with less than the maximum number of bytes */
set_test_bytes_(0,0,0);
create_sample_(&test_data, kdatatype_bmp180_barometry, test_bytes, 3, &test_clock);
set_test_bytes_(1,2,3);
create_sample_(&test_data, kdatatype_bmp180_thermometry, test_bytes, 2, &test_clock);
if (!check(test_data.bytes[0] == 1)) { return 1; }
if (!check(test_data.bytes[1] == 2)) { return 1; }
if (!check(test_data.bytes[2] == 0)) { return 1; }
increment_test_vector();
return 0;
} |
/*
* LEDs driver for the "User LED" on WeTek.Play
*
* Copyright (C) 2015 Memphiz <memphiz@kodi.tv>
*
* Based on leds.rb532
*/
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/amlogic/aml_gpio_consumer.h>
#include <mach/am_regs.h>
#include <plat/regops.h>
#define GPIO_OWNER_WIFILED "WIFILED"
#define GPIO_OWNER_ETHLED "ETHLED"
static void wetekplay_powerled_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
if (brightness) {
//printk(KERN_INFO "%s() LED BLUE\n", __FUNCTION__);
aml_set_reg32_bits(SECBUS2_REG_ADDR(0), 1, 0, 1); // set TEST_n output mode
aml_set_reg32_bits(AOBUS_REG_ADDR(0x24), 1, 31, 1); // set TEST_n pin H
}
else {
//printk(KERN_INFO "%s() LED RED\n", __FUNCTION__);
aml_set_reg32_bits(SECBUS2_REG_ADDR(0), 1, 0, 1); // set TEST_n output mode
aml_set_reg32_bits(AOBUS_REG_ADDR(0x24), 0, 31, 1); // set TEST_n pin L
}
}
static enum led_brightness wetekplay_powerled_get(struct led_classdev *cdev)
{
if (aml_get_reg32_bits(AOBUS_REG_ADDR(0x24), 31, 1))
return 255;
else
return 0;
}
static void wetekplay_wifiled_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
if (brightness) {
//printk(KERN_INFO "%s() LED BLUE\n", __FUNCTION__);
amlogic_gpio_direction_output(GPIOC_8, 1, GPIO_OWNER_WIFILED);
}
else {
//printk(KERN_INFO "%s() LED OFF\n", __FUNCTION__);
amlogic_gpio_direction_output(GPIOC_8, 0, GPIO_OWNER_WIFILED);
}
}
static enum led_brightness wetekplay_wifiled_get(struct led_classdev *cdev)
{
if (amlogic_get_value(GPIOC_8, GPIO_OWNER_WIFILED))
return 255;
else
return 0;
}
static void wetekplay_ethled_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
if (brightness) {
//printk(KERN_INFO "%s() LED BLUE\n", __FUNCTION__);
amlogic_gpio_direction_output(GPIOC_14, 1, GPIO_OWNER_ETHLED);
}
else {
//printk(KERN_INFO "%s() LED OFF\n", __FUNCTION__);
amlogic_gpio_direction_output(GPIOC_14, 0, GPIO_OWNER_ETHLED);
}
}
static enum led_brightness wetekplay_ethled_get(struct led_classdev *cdev)
{
if (amlogic_get_value(GPIOC_14, GPIO_OWNER_ETHLED))
return 255;
else
return 0;
}
static struct led_classdev wetekplay_powerled = {
.name = "power",
.brightness_set = wetekplay_powerled_set,
.brightness_get = wetekplay_powerled_get,
.default_trigger = "default-on",
};
static struct led_classdev wetekplay_wifiled = {
.name = "network",
.brightness_set = wetekplay_wifiled_set,
.brightness_get = wetekplay_wifiled_get,
};
static struct led_classdev wetekplay_ethled = {
.name = "status",
.brightness_set = wetekplay_ethled_set,
.brightness_get = wetekplay_ethled_get,
};
static int wetekplay_led_probe(struct platform_device *pdev)
{
amlogic_gpio_request(GPIOC_8, GPIO_OWNER_WIFILED);
amlogic_gpio_request(GPIOC_14, GPIO_OWNER_ETHLED);
led_classdev_register(&pdev->dev, &wetekplay_powerled);
led_classdev_register(&pdev->dev, &wetekplay_wifiled);
return led_classdev_register(&pdev->dev, &wetekplay_ethled);
}
static int wetekplay_led_remove(struct platform_device *pdev)
{
amlogic_gpio_free(GPIOC_8, GPIO_OWNER_WIFILED);
amlogic_gpio_free(GPIOC_14, GPIO_OWNER_ETHLED);
led_classdev_unregister(&wetekplay_powerled);
led_classdev_unregister(&wetekplay_wifiled);
led_classdev_unregister(&wetekplay_ethled);
return 0;
}
#ifdef CONFIG_USE_OF
static const struct of_device_id amlogic_wetekplayled_dt_match[]={
{ .compatible = "amlogic,wetekplay-led",
},
{},
};
#else
#define amlogic_wetekplayled_dt_match, NULL
#endif
static struct platform_driver wetekplay_led_driver = {
.probe = wetekplay_led_probe,
.remove = wetekplay_led_remove,
.driver = {
.name = "wetekplay-led",
.of_match_table = amlogic_wetekplayled_dt_match,
},
};
static int __init
wetekplay_led_init_module(void)
{
int err;
printk("wetekplay_led_init_module\n");
if ((err = platform_driver_register(&wetekplay_led_driver))) {
return err;
}
return err;
}
static void __exit
wetekplay_led_remove_module(void)
{
platform_driver_unregister(&wetekplay_led_driver);
printk("wetekplay-led module removed.\n");
}
//module_platform_driver(wetekplay_led_driver);
module_init(wetekplay_led_init_module);
module_exit(wetekplay_led_remove_module);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Power LED support for WeTek.Play");
MODULE_AUTHOR("Memphiz <memphiz@kodi.tv>");
MODULE_ALIAS("platform:wetekplay-led");
|
// Combat Simulator Project
// Copyright (C) 2002-2005 The Combat Simulator Project
// http://csp.sourceforge.net
//
// 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.
/**
* @file LogoScreen.h
*
**/
#ifndef __CSPSIM_LOGOSCREEN_H__
#define __CSPSIM_LOGOSCREEN_H__
#include <csp/cspsim/BaseScreen.h>
#include <osg/ref_ptr>
namespace osg {
class Camera;
class Texture2D;
}
namespace csp {
/** A screen for displaying a series of static images.
*
* TODO This class is currently specialized to display a fixed set of images
* during startup, but should be generalized.
*/
class LogoScreen : public BaseScreen {
public:
LogoScreen();
virtual ~LogoScreen();
virtual void onInit();
virtual void onExit();
virtual void onUpdate(double dt);
private:
osg::ref_ptr<osg::Camera> m_Camera;
osg::ref_ptr<osg::Texture2D> m_Texture;
};
} // namespace csp
#endif // __CSPSIM_LOGOSCREEN_H__
|
/**************************************************************************
Copyright 2021 Donour Sizemore
This file is part of RacePi
RacePi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2.
RacePi 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 RacePi. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
#ifndef __ESP32_CAN_PROCESSOR_
#define __ESP32_CAN_PROCESSOR_
// TODO: configure RX filters
// Configure ESP32 CAN driver with specified TX/RX pins.
// returns:
// -1 on install failure
// -2 on setup failure
int16_t setup_can_driver(uint8_t tx_gpio, uint8_t rx_gpio);
#endif//__ESP32_CAN_PROCESSOR_
|
/* This file is part of the KDE project
*
* Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KSSLSETTINGS_H
#define _KSSLSETTINGS_H
#include <qstring.h>
#include <qvaluelist.h>
#include <kconfig.h>
class KSSLSettingsPrivate;
/**
* KDE SSL Settings
*
* This class contains some of the SSL settings for easy use.
*
* @author George Staikos <staikos@kde.org>
* @see KSSL
* @short KDE SSL Settings
*/
class KIO_EXPORT KSSLSettings {
public:
/**
* Construct a KSSL Settings object
*
* @param readConfig read in the configuration immediately if true
*/
KSSLSettings(bool readConfig = true);
/**
* Destroy this KSSL Settings object
*/
~KSSLSettings();
/**
* Does the user allow SSLv2
* @return true if the user allows SSLv2
*/
bool sslv2() const;
/**
* Does the user allow SSLv3
* @return true if the user allows SSLv3
*/
bool sslv3() const;
/**
* Does the user allow TLSv1
* @return true if the user allows TLSv1
*/
bool tlsv1() const;
/**
* Does the user want to be warned on entering SSL mode
* @return true if the user wants to be warned
*/
bool warnOnEnter() const;
/**
* Change the user's warnOnEnter() setting
* @since 3.3
* @param x true if the user is to be warned
* @see warnOnEnter
*/
void setWarnOnEnter(bool x);
/**
* Does the user want to be warned on sending unencrypted data
* @return true if the user wants to be warned
* @see setWarnOnUnencrypted
*/
bool warnOnUnencrypted() const;
/**
* Change the user's warnOnUnencrypted() setting
* @param x true if the user is to be warned
* @see warnOnUnencrypted
*/
void setWarnOnUnencrypted(bool x);
/**
* Does the user want to be warned on leaving SSL mode
* @return true if the user wants to be warned
*/
bool warnOnLeave() const;
/**
* Change the user's warnOnLeave() setting
* @since 3.3
* @param x true if the user is to be warned
* @see warnOnLeave
*/
void setWarnOnLeave(bool x);
/**
* Does the user want to be warned during mixed SSL/non-SSL mode
* @return true if the user wants to be warned
*/
bool warnOnMixed() const;
/**
* Do not use this
* @deprecated
*/
bool warnOnSelfSigned() const KDE_DEPRECATED;
/**
* Do not use this
* @deprecated
*/
bool warnOnRevoked() const KDE_DEPRECATED;
/**
* Do not use this
* @deprecated
*/
bool warnOnExpired() const KDE_DEPRECATED;
/**
* Does the user want to use the Entropy Gathering Daemon?
* @return true if the user wants to use EGD
*/
bool useEGD() const;
/**
* Does the user want to use an entropy file?
* @return true if the user wants to use an entropy file
*/
bool useEFile() const;
/**
* Change the user's TLSv1 preference
* @param enabled true if TLSv1 is enabled
*/
void setTLSv1(bool enabled);
/**
* Change the user's SSLv2 preference
* @param enabled true if SSLv2 is enabled
*/
void setSSLv2(bool enabled);
/**
* Change the user's SSLv3 preference
* @param enabled true if SSLv3 is enabled
*/
void setSSLv3(bool enabled);
/**
* Does the user want X.509 client certificates to always be sent when
* possible?
* @return true if the user always wants a certificate sent
*/
bool autoSendX509() const;
/**
* Does the user want to be prompted to send X.509 client certificates
* when possible?
* @return true if the user wants to be prompted
*/
bool promptSendX509() const;
/**
* Get the OpenSSL cipher list for selecting the list of ciphers to
* use in a connection.
* @return the cipher list
*/
QString getCipherList();
/**
* Get the configured path to the entropy gathering daemon or entropy
* file.
* @return the path
*/
QString &getEGDPath();
/**
* Load the user's settings.
*/
void load();
/**
* Revert to default settings.
*/
void defaults();
/**
* Save the current settings.
*/
void save();
private:
KConfig *m_cfg;
bool m_bUseSSLv2, m_bUseSSLv3, m_bUseTLSv1;
bool m_bWarnOnEnter, m_bWarnOnUnencrypted, m_bWarnOnLeave, m_bWarnOnMixed;
bool m_bWarnSelfSigned, m_bWarnRevoked, m_bWarnExpired;
QValueList< QString > v2ciphers, v2selectedciphers, v3ciphers, v3selectedciphers;
QValueList< int > v2bits, v3bits;
KSSLSettingsPrivate *d;
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.