text
stringlengths 4
6.14k
|
|---|
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/switch.h>
#include <linux/workqueue.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <plat/imapx.h>
#ifdef CONFIG_IG_WIFI_SDIO
#define __mmc_rescan(x) sdhci_mmc##x##_detect_change()
#define _mmc_rescan(x) __mmc_rescan(x)
extern void _mmc_rescan(CONFIG_IG_WIFI_SDIO_CHANNEL);
#endif
struct wifi_switch_data {
struct switch_dev sdev;
unsigned gpio_power0;
unsigned gpio_power1;
unsigned gpio_switch;
const char *name_on;
const char *name_off;
const char *state_on;
const char *state_off;
int irq;
//struct work_struct *work;
};
static struct wifi_switch_data *switch_data;
static struct work_struct switch_wifi_work;
void wifi_power(int power)
{
if (power == 1)
{
printk(KERN_INFO "IN WIFI POWER 1");
imapx_gpio_setpin(switch_data->gpio_power0, 1, IG_NMSL);
imapx_gpio_setpin(switch_data->gpio_power1, 1, IG_NMSL);
#ifdef CONFIG_IG_WIFI_SDIO
msleep(1000);
_mmc_rescan(CONFIG_IG_WIFI_SDIO_CHANNEL);
#endif
}
else {
printk(KERN_INFO "IN WIFI POWER 0");
imapx_gpio_setpin(switch_data->gpio_power0, 0, IG_NMSL);
imapx_gpio_setpin(switch_data->gpio_power1, 0, IG_NMSL);
}
}
EXPORT_SYMBOL(wifi_power);
static void gpio_switch_work(struct work_struct *work)
{
// printk("enter function %s, at line %d \n", __func__, __LINE__);
switch_set_state(&switch_data->sdev,
imapx_gpio_getpin(switch_data->gpio_switch, IG_NORMAL));
}
static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
{
// printk("enter function %s, at line %d \n", __func__, __LINE__);
if(imapx_gpio_is_pending(switch_data->gpio_switch, 1))
schedule_work(&switch_wifi_work);
return IRQ_HANDLED;
}
static ssize_t switch_wifi_print_state(struct switch_dev *sdev, char *buf)
{
const char *state;
//printk("enter function %s, at line %d \n", __func__, __LINE__);
if (switch_get_state(sdev))
state = switch_data->state_on;
else
state = switch_data->state_off;
if (state)
return sprintf(buf, "%s\n", state);
return -1;
}
static int wifi_switch_probe(struct platform_device *pdev)
{
struct gpio_switch_platform_data *pdata = pdev->dev.platform_data;
// struct wifi_switch_data *switch_data;
int ret;
//printk("enter function %s, at line %d \n", __func__, __LINE__);
if (!pdata)
return -EBUSY;
switch_data = kzalloc(sizeof(struct wifi_switch_data), GFP_KERNEL);
if (!switch_data)
return -ENOMEM;
switch_data->gpio_power0 = __imapx_name_to_gpio(CONFIG_IG_WIFI_POWER0);
switch_data->gpio_power1 = __imapx_name_to_gpio(CONFIG_IG_WIFI_POWER1);
#if 0
#ifdef CONFIG_IG_KEYS_POWERS
switch_data->gpio_switch = __imapx_name_to_gpio(CONFIG_IG_KEYS_WIFI);
#else
switch_data->gpio_switch = IMAPX_GPIO_ERROR;
#endif
#endif
imapx_gpio_setcfg(switch_data->gpio_power0, IG_OUTPUT, IG_NMSL);
imapx_gpio_setcfg(switch_data->gpio_power1, IG_OUTPUT, IG_NMSL);
printk(KERN_INFO "get into wifi_power");
wifi_power(1);
/* if(switch_data->gpio_switch == IMAPX_GPIO_ERROR)
{
printk(KERN_ERR "get wifi powers/switch pins failed.\n");
return -ENOTTY;
}
*/
switch_data->sdev.name = pdata->name;
// switch_data->gpio = pdata->gpio;
switch_data->name_on = pdata->name_on;
switch_data->name_off = pdata->name_off;
switch_data->state_on = pdata->state_on;
switch_data->state_off = pdata->state_off;
switch_data->sdev.print_state = switch_wifi_print_state;
// printk("switch_gpio is %d\n", switch_data->gpio);
INIT_WORK(&switch_wifi_work, gpio_switch_work);
switch_data->irq = imapx_gpio_to_irq(switch_data->gpio_switch);
ret = request_irq(switch_data->irq, gpio_irq_handler,
IRQF_DISABLED, pdev->name, switch_data);
if (ret < 0)
return ret;
ret = switch_dev_register(&switch_data->sdev);
if (ret < 0)
return ret;
imapx_gpio_setcfg(switch_data->gpio_switch, IG_INPUT, IG_NORMAL);
/* Perform initial detection */
schedule_work(&switch_wifi_work);
// gpio_switch_work(&switch_wifi_work);
imapx_gpio_setirq(switch_data->gpio_switch, FILTER_MAX, IG_BOTH, 1);
// printk("enter function %s, at line %d \n", __func__, __LINE__);
return 0;
}
static int __devexit wifi_switch_remove(struct platform_device *pdev)
{
struct wifi_switch_data *switch_data = platform_get_drvdata(pdev);
cancel_work_sync(&switch_wifi_work);
switch_dev_unregister(&switch_data->sdev);
kfree(switch_data);
return 0;
}
static int wifi_switch_suspend(struct platform_device *pdev, pm_message_t state)
{
//struct wifi_switch_data *switch_data = platform_get_drvdata(pdev);
//schedule_work(&switch_wifi_work);
return 0;
}
static int wifi_switch_resume(struct platform_device *pdev)
{
//struct wifi_switch_data *switch_data = platform_get_drvdata(pdev);
schedule_work(&switch_wifi_work);
return 0;
}
static struct platform_driver wifi_switch_driver = {
.probe = wifi_switch_probe,
.remove = __devexit_p(wifi_switch_remove),
.suspend = wifi_switch_suspend,
.resume = wifi_switch_resume,
.driver = {
.name = "switch-wifi",
.owner = THIS_MODULE,
},
};
static int __init wifi_switch_init(void)
{
printk("wifi_switch module init\n");
return platform_driver_register(&wifi_switch_driver);
}
static void __exit wifi_switch_exit(void)
{
platform_driver_unregister(&wifi_switch_driver);
}
module_init(wifi_switch_init);
//late_initcall(wifi_switch_init);
module_exit(wifi_switch_exit);
MODULE_AUTHOR("Bob.yang <Bob.yang@infotmic.com.cn>");
/* modified by warits on apr.28 to fit new gpio structure */
MODULE_DESCRIPTION("WIFI Switch driver");
MODULE_LICENSE("GPL");
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2008 by Eran Ifrah
// file name : vcimporter.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// 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 VCIMPORTER_H
#define VCIMPORTER_H
#include "codelite_exports.h"
#include "map"
#include "project.h"
#include "project_settings.h"
#include "wx/string.h"
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
struct VcProjectData {
wxString name;
wxString id;
wxString filepath;
wxArrayString deps;
};
class WXDLLIMPEXP_SDK VcImporter
{
wxString m_fileName;
bool m_isOk;
wxFileInputStream* m_is;
wxTextInputStream* m_tis;
std::map<wxString, VcProjectData> m_projects;
wxString m_compiler;
wxString m_compilerLowercase;
public:
VcImporter(const wxString& fileName, const wxString& defaultCompiler);
virtual ~VcImporter();
bool Import(wxString& errMsg);
private:
// read line, skip empty lines
bool ReadLine(wxString& line);
bool OnProject(const wxString& firstLine, wxString& errMsg);
void RemoveGershaim(wxString& str);
void CreateWorkspace();
void CreateProjects();
bool ConvertProject(VcProjectData& data);
void AddConfiguration(ProjectSettingsPtr settings, wxXmlNode* config);
void CreateFiles(wxXmlNode* parent, wxString vdPath, ProjectPtr proj);
wxArrayString SplitString(const wxString& s);
};
#endif // VCIMPORTER_H
|
/*
* $Id$
*
* (C) 2008 by dbt <info@dbox2-tuning.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __gui_widget_progressbar_h__
#define __gui_widget_progressbar_h__
#include "config.h"
#include <gui/color.h>
#include <driver/framebuffer.h>
#include <driver/fontrenderer.h>
#include <system/settings.h>
#include <string>
class CProgressBar
{
private:
CFrameBuffer * frameBuffer;
int font_pbar;
int frame_widht;
int last_width;
int red, green, yellow;
bool blink, invert, bl_changed;
int width, height;
void realpaint(const int pos_x, const int pos_y,
const int value, const int max_value,
const fb_pixel_t activebar_col,
const fb_pixel_t passivebar_col,
const fb_pixel_t backgroundbar_col,
const fb_pixel_t shadowbar_col,
const char *upper_labeltext,
const uint8_t uppertext_col,
const char *iconfile,
bool paintZero);
public:
/* parameters:
blinkenligts: true if you want code to follow progressbar_color. needed, no default.
w, h: width / height of bar. Can later be set with paintProgressbar.
paintProgressBar2 can oly be used if w and h are set.
r, g, b: percentage of the bar where red/green/yellow is used.
only used if blinkenlights == true.
inv: false => red on the left side, true: red on right side. */
CProgressBar(const bool blinkenlights,
const int w = -1,
const int h = -1,
const int r = 40,
const int g = 100,
const int b = 70,
const bool inv = false);
~CProgressBar();
/// void paintProgressBar(...)
/*!
description of parameters:
position of progressbar:
pos_x > start position on screen x
pos_y > start position on screen y
pb_width > with of progressbar
pb_height > height of progressbar
definitions of values:
value > value, you will display
max_value > maximal value that you will display
appearance:
activebar_col > color of inner bar that shows the current value
passivebar_col > color of passive bar
frame_col > general frame color of progressbar, set 0 for no frame
shadowbar_col color > shadow behind progressbar, set 0 for no shadow
upper_labeltext > optional, label text, will be painted upper/left the progressbar
uppertext_col > optional, but necessary with label text, color of label text
iconfile > optional, name of iconfile
paintZero > optional, if set to true and value = 0, then paints a diagonal line instead of active bar as symbolic for a zero value
*/
void paintProgressBar ( const int pos_x,
const int pos_y,
const int pb_width,
const int pb_height,
const int value,
const int max_value,
const fb_pixel_t activebar_col = 0,
const fb_pixel_t passivebar_col = 0,
const fb_pixel_t frame_col = 0,
const fb_pixel_t shadowbar_col = 0,
const char * upper_labeltext = NULL,
const uint8_t uppertext_col = 0,
const char * iconfile = NULL,
bool paintZero = false);
void paintProgressBar2 (const int pos_x,
const int pos_y,
const int value,
const int max_value = 100,
const fb_pixel_t activebar_col = 0,
const fb_pixel_t passivebar_col = 0,
const fb_pixel_t frame_col = 0,
const fb_pixel_t shadowbar_col = 0,
const char * upper_labeltext = NULL,
const uint8_t uppertext_col = 0,
const char * iconfile = NULL,
bool paintZero = false);
void paintProgressBarDefault ( const int pos_x,
const int pos_y,
const int pb_width,
const int pb_height,
const int value,
const int max_value);
};
#endif /* __gui_widget_progressbar_h__ */
|
#ifndef __SCENE_PRIMITIVE_ARRAY__H_
#define __SCENE_PRIMITIVE_ARRAY__H_
/*LICENSE_START*/
/*
* Copyright (C) 2014 Washington University School of Medicine
*
* 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.
*/
/*LICENSE_END*/
#include "SceneObjectArray.h"
namespace caret {
class ScenePrimitiveArray : public SceneObjectArray {
public:
virtual ~ScenePrimitiveArray();
virtual ScenePrimitiveArray* castToScenePrimitiveArray();
virtual const ScenePrimitiveArray* castToScenePrimitiveArray() const;
protected:
ScenePrimitiveArray(const QString& name,
const SceneObjectDataTypeEnum::Enum dataType);
private:
ScenePrimitiveArray(const ScenePrimitiveArray&);
ScenePrimitiveArray& operator=(const ScenePrimitiveArray&);
public:
// ADD_NEW_METHODS_HERE
/**
* Get the values as a boolean.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual bool booleanValue(const int32_t arrayIndex) const = 0;
/**
* Get the values as a float.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual float floatValue(const int32_t arrayIndex) const = 0;
/**
* Get the values as a integer.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual int32_t integerValue(const int32_t arrayIndex) const = 0;
/**
* Get the values as a long integer.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual int64_t longIntegerValue(const int32_t arrayIndex) const = 0;
/**
* Get the values as a string.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual AString stringValue(const int32_t arrayIndex) const = 0;
/**
* Get the values as an unsigned byte.
* @param arrayIndex
* Index of element.
* @return The value.
*/
virtual uint8_t unsignedByteValue(const int32_t arrayIndex) const = 0;
virtual void booleanValues(bool valuesOut[],
const int32_t arrayNumberOfElements,
const bool defaultValue) const;
virtual void booleanValues(std::vector<bool>& valuesOut,
const bool defaultValue) const;
virtual void booleanVectorValues(std::vector<bool>& valuesOut) const;
virtual void floatValues(float valuesOut[],
const int32_t arrayNumberOfElements,
const float defaultValue) const;
virtual void floatValues(std::vector<float>& valuesOut,
const float defaultValue) const;
virtual void floatVectorValues(std::vector<float>& valuesOut) const;
virtual void integerValues(int32_t valuesOut[],
const int32_t arrayNumberOfElements,
const int32_t defaultValue) const;
virtual void integerValues(std::vector<int32_t>& valuesOut,
const int32_t defaultValue) const;
virtual void integerVectorValues(std::vector<int32_t>& valuesOut) const;
virtual void longIntegerValues(int64_t valuesOut[],
const int32_t arrayNumberOfElements,
const int64_t defaultValue) const;
virtual void longIntegerValues(std::vector<int64_t>& valuesOut,
const int64_t defaultValue) const;
virtual void longIntegerVectorValues(std::vector<int64_t>& valuesOut) const;
virtual void stringValues(AString valuesOut[],
const int32_t arrayNumberOfElements,
const AString& defaultValue) const;
virtual void stringValues(std::vector<AString>& valuesOut,
const AString& defaultValue) const;
virtual void stringVectorValues(std::vector<AString>& valuesOut) const;
virtual void unsignedByteValues(uint8_t valuesOut[],
const int32_t arrayNumberOfElements,
const uint8_t defaultValue) const;
virtual void unsignedByteValues(std::vector<uint8_t>& valuesOut,
const uint8_t defaultValue) const;
virtual void unsignedByteVectorValues(std::vector<uint8_t>& valuesOut) const;
private:
// ADD_NEW_MEMBERS_HERE
};
#ifdef __SCENE_PRIMITIVE_ARRAY_DECLARE__
// <PLACE DECLARATIONS OF STATIC MEMBERS HERE>
#endif // __SCENE_PRIMITIVE_ARRAY_DECLARE__
} // namespace
#endif //__SCENE_PRIMITIVE_ARRAY__H_
|
#include <string.h>
void* memset(void* bufptr, int value, size_t size)
{
unsigned char* buf = (unsigned char*) bufptr;
for ( size_t i = 0; i < size; i++ )
buf[i] = (unsigned char) value;
return bufptr;
}
|
// Copyright (C) 2005 - 2022 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "IngameWindow.h"
#include "gameTypes/ServerType.h"
#include <boost/signals2/connection.hpp>
class iwDirectIPConnect : public IngameWindow
{
private:
ServerType serverType_;
boost::signals2::scoped_connection onErrorConnection_;
public:
iwDirectIPConnect(ServerType serverType);
/// Connects to the given server or fills in the info if it has a password
void Connect(const std::string& hostOrIp, unsigned short port, bool isIPv6, bool hasPwd);
private:
void SetStatus(const std::string& text, unsigned color);
void Msg_EditChange(unsigned ctrl_id) override;
void Msg_EditEnter(unsigned ctrl_id) override;
void Msg_ButtonClick(unsigned ctrl_id) override;
void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override;
};
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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.
*
* $URL$
* $Id$
*
*/
#ifndef TOON_FLUX_H
#define TOON_FLUX_H
#include "toon/character.h"
class ToonEngine;
namespace Toon {
class CharacterFlux : public Character {
public:
CharacterFlux(ToonEngine *vm);
virtual ~CharacterFlux();
void setPosition(int32 x, int32 y);
void playStandingAnim();
void playWalkAnim(int32 start, int32 end);
void update(int32 timeIncrement);
int32 getRandomIdleAnim();
void setVisible(bool visible);
static int32 fixFacingForAnimation(int32 originalFacing, int32 animationId);
};
} // End of namespace Toon
#endif
|
#ifndef TORUS_H
#define TORUS_H
#include "objects/solid.h"
#include "transformer.h"
/**
* A mathematical torus.
*
* A torus are the points satisfying
*
* \f[ (x^2 + y^2 + z^2 + R^2 - r^2)^2 - 4R^2(x^2+y^2) = 0 \f]
*
* with volume
*
* \f[ V = \frac{1}{4}\pi^2(r+R)(R-r)^2 \f]
*
* and surface area
*
* \f[ A = \pi^2(R^2 - r^2) \f]
*
* We solve the torus-ray intersection by letting torus be defined by
*
* \f[ T(x,y,z) = (x^2 + y^2 + z^2 + R^2 - r^2)^2 - 4R^2(x^2+y^2) \f]
*
* and ray be defined by
*
* \f[ D(t) = (p_x,p_y,p_z) + t(d_x,d_y,d_z) \f]
*
* Expanding \f$ T(D(t)) = 0 \f$ gives the quartic equation
*
* \f[ a_1 t^4 + a_2 t^3 + a_3 t^2 + a_4 t + a_5 = 0\f]
*
* where
*
\f[ a_1 = d_x^4 + \left(2d_y^2 + 2d_z^2\right)d_x^2 + \left(d_y^4 +
2d_z^2d_y^2 + d_z^4\right) \f] \f[ a_2 = \left(4d_x^3 + \left(4d_y^2 +
4d_z^2\right)d_x\right)p_x + \left(\left(4d_yp_y + 4d_zp_z\right)d_x^2 +
\left(\left(4d_y^3 + 4d_z^2d_y\right)p_y + \left(4d_zp_zd_y^2 +
4d_z^3p_z\right)\right)\right) \f] \f[ a_3 = \left(-2d_x^2 + \left(-2d_y^2 +
2d_z^2\right)\right)R^2 + \left(\left(-2d_x^2 + \left(-2d_y^2 -
2d_z^2\right)\right)r^2 + \left(\left(6d_x^2 + \left(2d_y^2 +
2d_z^2\right)\right)p_x^2 + \left(8d_yp_y + 8d_zp_z\right)d_xp_x +
\left(\left(2p_y^2 + 2p_z^2\right)d_x^2 + \left(\left(6d_y^2 +
2d_z^2\right)p_y^2 + 8d_zp_zd_yp_y + \left(2p_z^2d_y^2 +
6d_z^2p_z^2\right)\right)\right)\right)\right) \f] \f[ a_4 = \left(-4d_xp_x +
\left(-4d_yp_y + 4d_zp_z\right)\right)R^2 + \left(\left(-4d_xp_x +
\left(-4d_yp_y - 4d_zp_z\right)\right)r^2 + \left(4d_xp_x^3 + \left(4d_yp_y +
4d_zp_z\right)p_x^2 + \left(4p_y^2 + 4p_z^2\right)d_xp_x + \left(4d_yp_y^3 +
4d_zp_zp_y^2 + 4p_z^2d_yp_y + 4d_zp_z^3\right)\right)\right) \f] \f[ a_5 = R^4
+ \left(-2r^2 + \left(-2p_x^2 + \left(-2p_y^2 + 2p_z^2\right)\right)\right)R^2
+ \left(r^4 + \left(-2p_x^2 + \left(-2p_y^2 - 2p_z^2\right)\right)r^2 +
\left(p_x^4 + \left(2p_y^2 + 2p_z^2\right)p_x^2 + \left(p_y^4 + 2p_z^2p_y^2 +
p_z^4\right)\right)\right) \f]
*/
class Torus : public Solid, public Transformer {
public:
/// Constructor
Torus(double R, double r, const Material *m);
virtual ~Torus(){};
virtual void transform(const Matrix &m);
virtual AABox getBoundingBox() const;
virtual SceneObject *clone() const;
uint32_t allIntersections(const Ray &ray, Intersection *result) const;
uint32_t maxIntersections() const;
bool inside(const Vector &point) const;
double signedDistance(const Vector &p) const;
private:
double _fastIntersect(const Ray &ray) const;
void _fullIntersect(const Ray &ray, const double t,
Intersection &result) const;
Vector normal(const Vector &point) const;
uint32_t allPositiveRoots(const Ray &world_ray, double roots[4]) const;
double r;
double R;
};
#endif
|
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2011-2013 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
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/>.
For links to further information, or to contact the authors,
see <http://www.tug.org/texworks/>.
*/
// Default paths to TeX binaries on Windows, for TeXworks
#define DEFAULT_BIN_PATHS "c:/texlive/2013/bin;c:/texlive/2012/bin;c:/texlive/2011/bin;c:/texlive/2010/bin;c:/texlive/2009/bin;c:/texlive/2008/bin;c:/texlive/2007/bin;c:/w32tex/bin;c:/Program Files/MiKTeX 3.0/miktex/bin;c:/Program Files (x86)/MiKTeX 3.0/miktex/bin;c:/Program Files/MiKTeX 2.9/miktex/bin;c:/Program Files (x86)/MiKTeX 2.9/miktex/bin;c:/Program Files/MiKTeX 2.8/miktex/bin;c:/Program Files (x86)/MiKTeX 2.8/miktex/bin;c:/Program Files/MiKTeX 2.7/miktex/bin;c:/Program Files (x86)/MiKTeX 2.7/miktex/bin"
|
/*
* scandir, alphasort - scan a directory
*
* implementation for systems that do not have it in libc
*/
#include "../config.h"
#ifndef HAVE_SCANDIR
#include <sys/types.h>
#include <dirent.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
/*
* convenience helper function for scandir's |compar()| function:
* sort directory entries using strcoll(3)
*/
int
alphasort(const void *_a, const void *_b)
{
struct dirent **a = (struct dirent **)_a;
struct dirent **b = (struct dirent **)_b;
return strcoll((*a)->d_name, (*b)->d_name);
}
#define strverscmp(a,b) strcoll(a,b) /* for now */
/*
* convenience helper function for scandir's |compar()| function:
* sort directory entries using GNU |strverscmp()|
*/
int
versionsort(const void *_a, const void *_b)
{
struct dirent **a = (struct dirent **)_a;
struct dirent **b = (struct dirent **)_b;
return strverscmp((*a)->d_name, (*b)->d_name);
}
/*
* The scandir() function reads the directory dirname and builds an
* array of pointers to directory entries using malloc(3). It returns
* the number of entries in the array. A pointer to the array of
* directory entries is stored in the location referenced by namelist.
*
* The select parameter is a pointer to a user supplied subroutine
* which is called by scandir() to select which entries are to be
* included in the array. The select routine is passed a pointer to
* a directory entry and should return a non-zero value if the
* directory entry is to be included in the array. If select is null,
* then all the directory entries will be included.
*
* The compar parameter is a pointer to a user supplied subroutine
* which is passed to qsort(3) to sort the completed array. If this
* pointer is null, the array is not sorted.
*/
int
scandir(const char *dirname,
struct dirent ***ret_namelist,
int (*select)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **))
{
int i, len;
int used, allocated;
DIR *dir;
struct dirent *ent, *ent2;
struct dirent **namelist = NULL;
if ((dir = opendir(dirname)) == NULL)
return -1;
used = 0;
allocated = 2;
namelist = malloc(allocated * sizeof(struct dirent *));
if (!namelist)
goto error;
while ((ent = readdir(dir)) != NULL) {
if (select != NULL && !select(ent))
continue;
/* duplicate struct direct for this entry */
len = offsetof(struct dirent, d_name) + strlen(ent->d_name) + 1;
if ((ent2 = malloc(len)) == NULL)
return -1;
if (used >= allocated) {
allocated *= 2;
namelist = realloc(namelist, allocated * sizeof(struct dirent *));
if (!namelist)
goto error;
}
memcpy(ent2, ent, len);
namelist[used++] = ent2;
}
closedir(dir);
if (compar)
qsort(namelist, used, sizeof(struct dirent *),
(int (*)(const void *, const void *)) compar);
*ret_namelist = namelist;
return used;
error:
if (namelist) {
for (i = 0; i < used; i++)
free(namelist[i]);
free(namelist);
}
return -1;
}
#endif
#if STANDALONE_MAIN
int
main(int argc, char **argv)
{
struct dirent **namelist;
int i, n;
n = scandir("/etc", &namelist, NULL, alphasort);
for (i = 0; i < n; i++)
printf("%s\n", namelist[i]->d_name);
}
#endif
|
#ifndef LOGGING_H
#define LOGGING_H
#define TRACE_DEBUG "DEBUG"
#define TRACE_INFO "INFOR"
#define TRACE_WARNING "WARNI"
#define TRACE_ERROR "ERROR"
#define TRACE_FATAL "FATAL"
void initLoggingFile (const char *path);
void logging (const char *tag, const char *format, ...);
void closeLoggingFile ();
#endif /* LOGGING_H */
|
/*
* OMAP3 voltage domain data
*
* Copyright (C) 2007, 2010 Texas Instruments, Inc.
* Rajendra Nayak <rnayak@ti.com>
* Lesly A M <x0080970@ti.com>
* Thara Gopinath <thara@ti.com>
*
* Copyright (C) 2008, 2011 Nokia Corporation
* Kalle Jokiniemi
* Paul Walmsley
*
* 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/err.h>
#include <linux/init.h>
#include <plat/common.h>
#include <plat/cpu.h>
#include "prm-regbits-34xx.h"
#include "omap_opp_data.h"
#include "voltage.h"
#include "vc.h"
#include "vp.h"
/*
* VDD data
*/
static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
.voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT,
.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
};
static struct omap_vdd_info omap3_vdd1_info = {
.vp_data = &omap3_vp1_data,
.vc_data = &omap3_vc1_data,
.vfsm = &omap3_vdd1_vfsm_data,
.voltdm = {
.name = "mpu",
},
};
static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
.voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT,
.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
};
static struct omap_vdd_info omap3_vdd2_info = {
.vp_data = &omap3_vp2_data,
.vc_data = &omap3_vc2_data,
.vfsm = &omap3_vdd2_vfsm_data,
.voltdm = {
.name = "core",
},
};
/* OMAP3 VDD structures */
static struct omap_vdd_info *omap3_vdd_info[] = {
&omap3_vdd1_info,
&omap3_vdd2_info,
};
/* OMAP3 specific voltage init functions */
static int __init omap3xxx_voltage_early_init(void)
{
s16 prm_mod = OMAP3430_GR_MOD;
s16 prm_irqst_ocp_mod = OCP_MOD;
if (!cpu_is_omap34xx())
return 0;
/*
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
*/
if (cpu_is_omap3630()) {
omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data;
omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data;
omap3_vdd1_info.dep_vdd_info = omap36xx_vddmpu_dep_info;
} else {
omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data;
omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
omap3_vdd1_info.dep_vdd_info = omap34xx_vddmpu_dep_info;
}
return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
omap3_vdd_info,
ARRAY_SIZE(omap3_vdd_info));
};
core_initcall(omap3xxx_voltage_early_init);
|
/*
* Copyright (C) 2016-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <wtf/Forward.h>
namespace JSC {
class VM;
}
namespace WebCore {
class Frame;
Frame* lexicalFrameFromCommonVM();
WEBCORE_EXPORT extern JSC::VM* g_commonVMOrNull;
WEBCORE_EXPORT JSC::VM& commonVMSlow();
inline JSC::VM* commonVMOrNull()
{
return g_commonVMOrNull;
}
inline JSC::VM& commonVM()
{
if (JSC::VM* result = g_commonVMOrNull)
return *result;
return commonVMSlow();
}
void addImpureProperty(const AtomicString&);
} // namespace WebCore
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
*
* 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 <arch/romcc_io.h>
#include "pc87309.h"
static void pc87309_enable_serial(device_t dev, unsigned int iobase)
{
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_iobase(dev, PNP_IDX_IO0, iobase);
pnp_set_enable(dev, 1);
}
|
/*
* Copyright 2010 Cisco Systems, Inc. All rights reserved.
*
* This program is free software; you may 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#include <pthread.h>
#include <time.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
struct sk_buff {
struct sk_buff *next;
struct timespec tstamp;
int buf_size;
int len;
unsigned short frag;
unsigned short csum;
unsigned short ip_summed;
unsigned short csum_offset;
unsigned long long dma_addr;
unsigned char *buf;
unsigned char *data;
unsigned char *transport_hdr;
};
#define CHECKSUM_NONE 0
#define CHECKSUM_COMPLETE 1
#define CHECKSUM_PARTIAL 2
#define CHECKSUM_UNNECESSARY 3
extern __thread struct sk_buff *skb_local_free;
extern __thread int skb_local_count;
struct sk_buff *skb_global_free;
pthread_spinlock_t skb_global_lock;
struct uld;
#define SKB_LOCAL_THRESH 50
struct sk_buff *skb_alloc_new(struct uld *);
static inline struct sk_buff *skb_alloc(struct uld *uld)
{
struct sk_buff *skb;
if (skb_local_free) {
skb = skb_local_free;
skb_local_free = skb->next;
skb->next = NULL;
skb_local_count--;
return skb;
}
pthread_spin_lock(&skb_global_lock);
if (skb_global_free) {
skb = skb_global_free;
skb_global_free = skb->next;
skb->next = NULL;
pthread_spin_unlock(&skb_global_lock);
return skb;
}
skb = skb_alloc_new(uld);
pthread_spin_unlock(&skb_global_lock);
return skb;
}
static void inline skb_free(struct sk_buff *skb)
{
int i;
struct sk_buff *nskb;
while (skb) {
nskb = skb->next;
skb->data = skb->buf;
skb->csum = skb->ip_summed = 0;
skb->frag = skb->len = 0;
skb->next = skb_local_free;
skb_local_free = skb;
skb_local_count++;
skb = nskb;
}
if (skb_local_count > SKB_LOCAL_THRESH) {
pthread_spin_lock(&skb_global_lock);
for (i=0; i<SKB_LOCAL_THRESH/2; i++) {
skb = skb_local_free;
if (!skb)
break;
skb_local_free = skb->next;
skb_local_count--;
skb->next = skb_global_free;
skb_global_free = skb;
}
pthread_spin_unlock(&skb_global_lock);
}
}
static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
{
skb->len -= len;
return skb->data += len;
}
static inline unsigned short skb_ether_protocol(struct sk_buff *skb)
{
struct ethhdr *h = (struct ethhdr *)skb->data;
unsigned short *p;
p = &h->h_proto;
while (*p == htons(ETH_P_8021Q))
p += 2;
return ntohs(*p);
}
static inline unsigned int skb_network_offset(struct sk_buff *skb)
{
struct ethhdr *h = (struct ethhdr *)skb->data;
unsigned short *p;
p = &h->h_proto;
while (*p == htons(ETH_P_8021Q))
p += 2;
return ((unsigned char *)p) + 2 - skb->data;
}
static inline unsigned char *skb_network_header(struct sk_buff *skb)
{
return skb->data + skb_network_offset(skb);
}
static inline int skb_ip_protocol(struct sk_buff *skb)
{
if (skb_ether_protocol(skb) == ETH_P_IP)
return skb_network_header(skb)[9];
if (skb_ether_protocol(skb) == ETH_P_IPV6)
return skb_network_header(skb)[6];
return 0;
}
static inline unsigned char *skb_transport_header(struct sk_buff *skb)
{
unsigned char *h = skb_network_header(skb);
if (skb_ether_protocol(skb) == ETH_P_IP)
return h + 4 * ((*h) & 0xF); /* ihl */
if (skb_ether_protocol(skb) == ETH_P_IPV6)
return h + 20;
return NULL;
}
|
/*-------------------------------------------------------------------------
atanf.c - Computes arctan of a 32-bit float as outlined in [1]
Copyright (C) 2001, 2002, Jesus Calvino-Fraga <jesusc At ieee.org>
This library 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.1, 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
As a special exception, if you link this library with other files,
some of which are compiled with SDCC, to produce an executable,
this library does not by itself cause the resulting executable to
be covered by the GNU General Public License. This exception does
not however invalidate any other reasons why the executable file
might be covered by the GNU General Public License.
-------------------------------------------------------------------------*/
/* [1] William James Cody and W. M. Waite. _Software manual for the
elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
#include <math.h>
#include <errno.h>
#define P0 -0.4708325141E+0
#define P1 -0.5090958253E-1
#define Q0 0.1412500740E+1
#define Q1 0.1000000000E+1
#define P(g,f) ((P1*g+P0)*g*f)
#define Q(g) (Q1*g+Q0)
#define K1 0.2679491924 /* 2-sqrt(3) */
#define K2 0.7320508076 /* sqrt(3)-1 */
#define K3 1.7320508076 /* sqrt(3) */
#ifdef SDCC_mcs51
#define myconst code
#else
#define myconst const
#endif
float atanf(const float x) _MATH_REENTRANT
{
float f, r, g;
int n=0;
static myconst float a[]={ 0.0, 0.5235987756, 1.5707963268, 1.0471975512 };
f=fabsf(x);
if(f>1.0)
{
f=1.0/f;
n=2;
}
if(f>K1)
{
f=((K2*f-1.0)+f)/(K3+f);
// What it is actually wanted is this more accurate formula,
// but SDCC optimizes it and then it does not work:
// f=(((K2*f-0.5)-0.5)+f)/(K3+f);
n++;
}
if(fabsf(f)<EPS) r=f;
else
{
g=f*f;
r=f+P(g,f)/Q(g);
}
if(n>1) r=-r;
r+=a[n];
if(x<0.0) r=-r;
return r;
}
|
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rosegarden
A sequencer and musical notation editor.
Copyright 2000-2010 the Rosegarden development team.
See the AUTHORS file for more details.
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 the file
COPYING included with this distribution for more information.
*/
#include "AudioProcess.h"
#include "MappedEventList.h"
#include <string.h>
#ifndef _MIDIPROCESS_H
#define _MIDIPROCESS_H
namespace Rosegarden
{
class MidiThread : public AudioThread
{
public:
MidiThread(std::string name, // for diagnostics
SoundDriver *driver,
unsigned int sampleRate);
virtual ~MidiThread();
void bufferMidiOut();
// These are the two RingBuffers we use to pass MappedEvents in and out
// of this thread.
//
RingBuffer<MappedEvent> *getMidiOutBuffer() { return m_outBuffer; }
RingBuffer<MappedEvent> *getMidiInBuffer() { return m_inBuffer; }
void logMsg(const std::string &message);
RealTime getTimeOfDay();
// Process note off events as we need to - if we want to force all notes off
// then pass true to the first argument.
//
void processNotesOff(bool everything = false);
// On jump - clear the out buffers
//
void clearBuffersOut();
// Initialise MIDI IN to a given port and set the callback
//
void initialiseMidiIn(unsigned int port);
// The RTMidi MIDI in callback
//
static void midiInCallback(double deltatime, std::vector< unsigned char > *message, void *userData);
// Static method for accessing any recorded/captured MIDI notes
//
static MappedEventList getReturnComposition();
// Ability to set elapsed time to reset this at start of playback/recording
//
static void setElapsedTime(double elapsedTime) { m_elapsedTime = elapsedTime; }
protected:
// A thread-local MappedEventList which is populated and returned to
// the PortableSoundDriver on request.
//
static MappedEventList *m_returnComposition;
// Static locks for the return mappedcomposition thing
//
static pthread_mutex_t m_recLock;
//static pthread_cond_t m_condition;
virtual void threadRun();
void processBuffers();
RingBuffer<MappedEvent> *m_outBuffer;
RingBuffer<MappedEvent> *m_inBuffer;
RealTime m_startTime;
QFile *m_threadLogFile;
// Locally maintained midi output list
//
MappedEventList m_midiOutList;
// Fetch buffer
//
MappedEvent *m_fetchBuffer;
unsigned int m_fetchBufferSize;
// MIDI Note-off handling - copy from SoundDriver
//
NoteOffQueue m_noteOffQueue;
// Keep a track of the current RtMidi output port
//
unsigned int m_currentRtOutPort;
// Keep a track of note ons coming in while recording so we can get durations
//
static std::map<unsigned int, std::multimap<unsigned int, MappedEvent*> > m_noteOnMap;
// Keep a track of elapsed time for events as we only get deltatimes from RtMidi
//
static double m_elapsedTime;
};
}
#endif // MIDIPROCESS_H
|
/*
* The ManaPlus Client
* Copyright (C) 2012-2014 The ManaPlus Developers
*
* 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 EVENTS_INPUTEVENT_H
#define EVENTS_INPUTEVENT_H
#include <map>
#include <vector>
#include "localconsts.h"
typedef std::vector<int> KeysVector;
typedef KeysVector::iterator KeysVectorIter;
typedef KeysVector::const_iterator KeysVectorCIter;
typedef std::map<int, KeysVector> KeyToActionMap;
typedef KeyToActionMap::iterator KeyToActionMapIter;
typedef std::map<int, int> KeyToIdMap;
typedef KeyToIdMap::iterator KeyToIdMapIter;
typedef std::map<int, int> KeyTimeMap;
typedef KeyTimeMap::iterator KeyTimeMapIter;
struct InputEvent final
{
InputEvent(const int action0, const int mask0) :
action(action0),
mask(mask0)
{ }
int action;
int mask;
};
#endif // EVENTS_INPUTEVENT_H
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#ifndef XPATH_ROUTING_HELPER_H
#define XPATH_ROUTING_HELPER_H
#include "ns3/ipv4-xpath-routing.h"
#include "ns3/ipv4-routing-helper.h"
namespace ns3 {
class Ipv4XPathRoutingHelper : public Ipv4RoutingHelper
{
public:
Ipv4XPathRoutingHelper ();
Ipv4XPathRoutingHelper (const Ipv4XPathRoutingHelper &);
Ipv4XPathRoutingHelper* Copy (void) const;
virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const;
Ptr<Ipv4XPathRouting> GetXPathRouting (Ptr<Ipv4> ipv4) const;
};
}
#endif /* XPATH_ROUTING_HELPER_H */
|
//! A singleton abstract class to hold a game state
//! Uses the singleton pattern
#ifndef GAMESTATE_H
#define GAMESTATE_H
// Forward declarations
namespace GfxModule
{
class GfxModuleWrapper;
}
namespace SoundModule
{
class SoundModuleWrapper;
}
namespace InputModule
{
class Input;
}
namespace GameStateModule
{
// Forward declare classes
class GameStateManager;
class GameState
{
private:
//! Singleton pattern. This state cannot be copied
GameState(const GameState &AGameState);
public:
//! Singleton pattern. This state cannot be constructed outside the class hierarchy
GameState(void)
{
// Intentionally left blank
}
//! Virtual destructor. Does nothing
virtual ~GameState(void)
{
// Intentionally left blank
}
//! Virtual. Initialise the state when the state is pushed on top the stack
virtual void PushInitialise(
GfxModule::GfxModuleWrapper* AGfxModule,
SoundModule::SoundModuleWrapper* ASoundModule
)
{
// Intentionally left blank
}
//! Virtual. Cleanup up the state when it is pushed then further into the stack
virtual void PushCleanup(
GfxModule::GfxModuleWrapper* AGfxModule,
SoundModule::SoundModuleWrapper* ASoundModule
)
{
// Intentionally left blank
}
//! Virtual. When the state is popped up to the top of the stack
virtual void PopInitialise(
GfxModule::GfxModuleWrapper* AGfxModule,
SoundModule::SoundModuleWrapper* ASoundModule
)
{
// Intentionally left blank
}
//! Virtual. When the state is popped off the stack
virtual void PopCleanup(
GfxModule::GfxModuleWrapper* AGfxModule,
SoundModule::SoundModuleWrapper* ASoundModule
)
{
// Intentionally left blank
}
//! Virtual. Gets called once per frame when it is on top of the stack
virtual void Update(
GfxModule::GfxModuleWrapper* AGfxModule,
SoundModule::SoundModuleWrapper* ASoundModule,
InputModule::Input* AInputModule,
GameStateModule::GameStateManager* AGameStateManager
)
{
// Intentionally left blank
}
};
}
#endif // GAMESTATE_H
/*
History
=======
2006-06-23: Created the file and class
*/
|
#include <Python.h>
//#define dbg(...) fprintf (stderr, __VA_ARGS__)
#define dbg(...)
extern PyTypeObject pylcmeventlog_type;
extern PyTypeObject pylcm_type;
extern PyTypeObject pylcm_subscription_type;
/* module initialization */
static PyMethodDef lcmmod_methods[] = {
{ NULL, NULL } /* sentinel */
};
PyDoc_STRVAR (lcmmod_doc, "LCM python extension modules");
PyMODINIT_FUNC
init_lcm (void)
{
PyObject *m;
pylcmeventlog_type.ob_type = &PyType_Type;
pylcm_type.ob_type = &PyType_Type;
pylcm_subscription_type.ob_type = &PyType_Type;
m = Py_InitModule3 ("_lcm", lcmmod_methods, lcmmod_doc);
Py_INCREF (&pylcmeventlog_type);
if (PyModule_AddObject (m, "EventLog",
(PyObject *)&pylcmeventlog_type) != 0) {
return;
}
Py_INCREF (&pylcm_type);
if (PyModule_AddObject (m, "LCM", (PyObject *)&pylcm_type) != 0) {
return;
}
Py_INCREF (&pylcm_subscription_type);
if (PyModule_AddObject (m, "LCMSubscription",
(PyObject *)&pylcm_subscription_type) != 0) {
return;
}
}
|
#include<stdio.h>
#include<conio.h>
typedef struct node
{
int info;
struct node *next;
}node_type;
void insert(node_type**,node_type**);
void del(node_type **);
void display(node_type *);
void main()
{
node_type *left=NULL,*right=NULL;
int ch;
do
{
printf("\n menu");
printf("\n 1 for insert \n 2 for delete \n 3 for display \n 4 for exit");
printf("\n enter the choice.");
scanf("%d",&ch);
switch(ch)
{
case 1:
insert(&left,&right);
break;
case 2:
if(left!=NULL)
del(&left);
else
printf("\n Linked list is empty");
break;
case 3:
if(left==NULL)
printf("\n linked list is empty");
else
display(left);
break;
case 4:
break;
default :
printf("\n invalid choice");
}
}while(ch!=4);
}
void insert(node_type **l,node_type **r)
{
node_type *p=(node_type*)malloc(sizeof(node_type));
if(p!=NULL)
{
printf("\n enter the information ");
scanf("%d",&p->info);
if(*l==NULL)
{
*l=*r=p;
}
else
{
(*r)->next=p;
*r=p;
}
(*r)->next=NULL;
}
else
printf("\n node cannot be created");
}
void del(node_type **f)
{
printf("\n the node deleted : %d",(*f)->info);
*f=(*f)->next;
}
void display(node_type *f)
{
printf("\n elements : ");
do
{
printf("\n %d",f->info);
f=f->next;
}while(f!=NULL);
}
|
#if(0)
FTANGLE v1.53, created with UNIX on "Thursday, September 21, 1995 at 15:06."
COMMAND LINE: "web/ftangle web/y_type -A -# --F -= 1.53/web/y_type.h"
RUN TIME: "Saturday, September 23, 1995 at 16:17."
WEB FILE: "web/y_type.web"
CHANGE FILE: (none)
#endif
void HUGE*alloc PROTO((CONST outer_char abbrev[],BUF_SIZE HUGE*pnunits,
size_t nsize,int dn));
SRTN free_mem0 PROTO((void HUGE*p,CONST outer_char why[],BUF_SIZE nunits,
size_t nsize));
void HUGE*get_mem0 PROTO((CONST outer_char why[],BUF_SIZE nunits,
size_t nsize));
|
/*
Copyright (c) 2012-2013 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, 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 OperaImportData_H
#define OperaImportData_H
#include "abstractimporter.h"
class ImportWizard;
class OperaImportData : public AbstractImporter
{
public:
explicit OperaImportData(ImportWizard *parent);
~OperaImportData();
TypeSupportedOptions supportedOption();
bool foundMailer() const;
bool importMails();
bool importAddressBook();
bool importSettings();
QString name() const;
};
#endif /* OperaImportData_H */
|
/*
* song_editor.h - declaration of class songEditor, a window where you can
* setup your songs
*
* Copyright (c) 2004-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _SONG_EDITOR_H
#define _SONG_EDITOR_H
#include "track_container_view.h"
class QLabel;
class QScrollBar;
class comboBox;
class song;
class timeLine;
class toolButton;
class positionLine : public QWidget
{
public:
positionLine( QWidget * _parent );
private:
virtual void paintEvent( QPaintEvent * _pe );
} ;
class songEditor : public trackContainerView
{
Q_OBJECT
public:
songEditor( song * _song, songEditor * & _engine_ptr );
virtual ~songEditor();
public slots:
void scrolled( int _new_pos );
void play();
void record();
void recordAccompany();
void stop();
private slots:
void updateScrollBar( int );
void updatePosition( const midiTime & _t );
void zoomingChanged();
void adjustUiAfterProjectLoad();
private:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void wheelEvent( QWheelEvent * _we );
virtual bool allowRubberband() const;
song * m_s;
QScrollBar * m_leftRightScroll;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_recordButton;
toolButton * m_recordAccompanyButton;
toolButton * m_stopButton;
timeLine * m_timeLine;
toolButton * m_addBBTrackButton;
toolButton * m_addSampleTrackButton;
toolButton * m_addAutomationTrackButton;
toolButton * m_drawModeButton;
toolButton * m_editModeButton;
comboBox * m_zoomingComboBox;
positionLine * m_positionLine;
bool m_scrollBack;
} ;
#endif
|
/* G E T _ I N P . C
*
* Copyright (C) 2019 Duncan Roe */
/* Implement ^<INP> and ^<INPF> run machine opcodes */
/* Headers */
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "alu.h"
bool
get_inp(double *fval, long *val, long *len, char **err)
{
char *endptr; /* 1st char after number */
uint8_t lastch; /* Dump for char we nullify */
int i;
/* Skip whitespace (including tabs) */
for (i = last_Curr->bcurs; i < last_Curr->bchars; i++)
if (!isspace(last_Curr->bdata[i]))
break;
if (i == last_Curr->bchars)
{
*err = "No number before eol";
return false;
} /* if (i == last_Curr->bchars) */
if (!(isdigit(last_Curr->bdata[i]) || last_Curr->bdata[i] == '+' ||
last_Curr->bdata[i] == '-' || (fval && last_Curr->bdata[i] == '.')))
{
*err = "Next item on line is not a number";
return false;
} /* if (!(isdigit(last_Curr->bdata[i] ... */
last_Curr->bcurs = i;
/* Force null termination so strtol() will stop at end */
lastch = last_Curr->bdata[last_Curr->bchars];
last_Curr->bdata[last_Curr->bchars] = 0;
/* Get the value (cast is to conform with strtol prototype) */
errno = 0;
if (val)
*val = strtol((char *)last_Curr->bdata + i, &endptr, 0);
else
*fval = strtod((char *)last_Curr->bdata + i, &endptr);
/* Reinstate zeroed char */
last_Curr->bdata[last_Curr->bchars] = lastch;
/* Check for overflow. Only check errno (previously zeroed) */
/* since LONG_MAX or LONG_MIN might be returned legitimately */
if (errno)
{
*err = strerror(errno);
return false;
} /* if (errno) */
/* All OK. Return length and finish */
*len = endptr - (char *)last_Curr->bdata - i;
return true;
} /* get_inp() */
|
/*
Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
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.
MagickCore string methods.
*/
#ifndef _MAGICKCORE_STRING_H_
#define _MAGICKCORE_STRING_H_
#include <stdarg.h>
#include <time.h>
#include "magick/exception.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef struct _StringInfo
{
char
path[MaxTextExtent];
unsigned char
*datum;
size_t
length,
signature;
} StringInfo;
extern MagickExport char
*AcquireString(const char *),
*CloneString(char **,const char *),
*ConstantString(const char *),
*DestroyString(char *),
**DestroyStringList(char **),
*EscapeString(const char *,const char),
*FileToString(const char *,const size_t,ExceptionInfo *),
*GetEnvironmentValue(const char *),
*StringInfoToHexString(const StringInfo *),
*StringInfoToString(const StringInfo *),
**StringToArgv(const char *,int *),
*StringToken(const char *,char **),
**StringToList(const char *);
extern MagickExport const char
*GetStringInfoPath(const StringInfo *);
extern MagickExport double
InterpretSiPrefixValue(const char *magick_restrict,char **magick_restrict),
*StringToArrayOfDoubles(const char *,ssize_t *, ExceptionInfo *);
extern MagickExport int
CompareStringInfo(const StringInfo *,const StringInfo *);
extern MagickExport MagickBooleanType
ConcatenateString(char **,const char *),
IsStringTrue(const char *),
IsStringNotFalse(const char *),
SubstituteString(char **,const char *,const char *);
extern MagickExport size_t
ConcatenateMagickString(char *,const char *,const size_t)
magick_attribute((__nonnull__)),
CopyMagickString(char *,const char *,const size_t)
magick_attribute((__nonnull__)),
GetStringInfoLength(const StringInfo *);
extern MagickExport ssize_t
FormatMagickSize(const MagickSizeType,const MagickBooleanType,char *),
FormatMagickTime(const time_t,const size_t,char *);
extern MagickExport StringInfo
*AcquireStringInfo(const size_t),
*BlobToStringInfo(const void *,const size_t),
*CloneStringInfo(const StringInfo *),
*ConfigureFileToStringInfo(const char *),
*DestroyStringInfo(StringInfo *),
*FileToStringInfo(const char *,const size_t,ExceptionInfo *),
*SplitStringInfo(StringInfo *,const size_t),
*StringToStringInfo(const char *);
extern MagickExport unsigned char
*GetStringInfoDatum(const StringInfo *);
extern MagickExport void
ConcatenateStringInfo(StringInfo *,const StringInfo *)
magick_attribute((__nonnull__)),
PrintStringInfo(FILE *file,const char *,const StringInfo *),
ResetStringInfo(StringInfo *),
SetStringInfo(StringInfo *,const StringInfo *),
SetStringInfoDatum(StringInfo *,const unsigned char *),
SetStringInfoLength(StringInfo *,const size_t),
SetStringInfoPath(StringInfo *,const char *),
StripString(char *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
|
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
// Modified for Ishiiruka By Tino
#pragma once
#include <memory>
#include "VideoCommon/NativeVertexFormat.h"
extern const float fractionTable[32];
struct VertexLoaderParameters
{
u8* source;
u8* destination;
const TVtxDesc *VtxDesc;
const VAT *VtxAttr;
size_t buf_size;
int vtx_attr_group;
int primitive;
int count;
bool skip_draw;
bool needloaderrefresh;
};
class VertexLoaderUID
{
u32 vid[4];
u64 hash;
size_t platformhash;
public:
VertexLoaderUID(const TVtxDesc& VtxDesc, const VAT& vat);
bool operator < (const VertexLoaderUID &other) const;
bool operator == (const VertexLoaderUID& rh) const;
u64 GetHash() const;
size_t GetplatformHash() const;
u32 GetElement(u32 idx) const;
private:
u64 CalculateHash();
};
namespace std
{
template <>
struct hash<VertexLoaderUID>
{
size_t operator()(const VertexLoaderUID& uid) const
{
return uid.GetplatformHash();
}
};
}
class VertexLoaderBase
{
public:
static std::unique_ptr<VertexLoaderBase> CreateVertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
virtual ~VertexLoaderBase()
{
m_fallback.reset();
}
void SetFallback(std::unique_ptr<VertexLoaderBase>& obj)
{
m_fallback = std::move(obj);
}
VertexLoaderBase* GetFallback()
{
return m_fallback.get();
}
virtual bool EnvironmentIsSupported()
{
return true;
}
virtual bool IsPrecompiled()
{
return false;
}
virtual s32 RunVertices(const VertexLoaderParameters ¶meters) = 0;
virtual bool IsInitialized() = 0;
// For debugging / profiling
void AppendToString(std::string *dest) const;
std::string GetName() const;
// per loader public state
s32 m_VertexSize; // number of bytes of a raw GC vertex
s32 m_native_stride;
PortableVertexDeclaration m_native_vtx_decl;
u32 m_native_components;
// used by VertexLoaderManager
NativeVertexFormat* m_native_vertex_format;
u64 m_numLoadedVertices;
protected:
VertexLoaderBase(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
void InitializeVertexData();
void SetVAT(const VAT &vtx_attr);
// GC vertex format
TVtxAttr m_VtxAttr; // VAT decoded into easy format
TVtxDesc m_VtxDesc; // Not really used currently - or well it is, but could be easily avoided.
VAT m_vat;
std::unique_ptr<VertexLoaderBase> m_fallback;
};
|
#define IN_JSLTYPETAB_C
#include "jsltypetab.h"
#define HASH_FUN(elemp) hashFun(elemp->d->name)
#define HASH_ELEM_EQUAL(e1,e2) ( \
e1->d->bits.symbolType==e2->d->bits.symbolType \
&& strcmp(e1->d->name,e2->d->name)==0 \
)
#include "hash.h"
#include "memory.h" /* For XX_ALLOCC */
#include "hashlist.tc"
|
#ifndef SCGRAPH_MATERIAL_HH
#define SCGRAPH_MATERIAL_HH
#include "color_rgba.h"
/** a material */
struct Material
{
float _shinyness;
ColorRGBA _ambient_reflection;
ColorRGBA _diffuse_reflection;
ColorRGBA _specular_reflection;
ColorRGBA _emissive_color;
Material ();
};
#endif
|
/*
* input.h: header for input.c
*
* Written By Michael Sandrof
*
* Copyright (c) 1990 Michael Sandrof.
* Copyright (c) 1991, 1992 Troy Rollo.
* Copyright (c) 1992-2014 Matthew R. Green.
* 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 AUTHORS ``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 AUTHORS 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.
*
* @(#)$eterna: input.h,v 1.27 2014/03/14 20:59:19 mrg Exp $
*/
#ifndef irc__input_h_
#define irc__input_h_
typedef struct ScreenInputData ScreenInputData;
void set_input(u_char *);
void set_input_raw(u_char *);
void set_input_prompt(u_char *);
u_char *get_input_prompt(void);
u_char *get_input(void);
u_char *get_input_raw(void);
void update_input(int);
void init_input(void);
void input_reset_screen(Screen *);
void input_move_cursor(int);
void change_input_prompt(int);
void cursor_to_input(void);
void input_add_character(u_int, u_char *);
void input_backward_word(u_int, u_char *);
void input_forward_word(u_int, u_char *);
void input_delete_previous_word(u_int, u_char *);
void input_delete_next_word(u_int, u_char *);
void input_clear_to_bol(u_int, u_char *);
void input_clear_line(u_int, u_char *);
void input_end_of_line(u_int, u_char *);
void input_clear_to_eol(u_int, u_char *);
void input_beginning_of_line(u_int, u_char *);
void refresh_inputline(u_int, u_char *);
void input_delete_character(u_int, u_char *);
void input_backspace(u_int, u_char *);
void input_transpose_characters(u_int, u_char *);
void input_yank_cut_buffer(u_int, u_char *);
u_char *function_curpos(u_char *);
/* used by update_input */
#define NO_UPDATE 0
#define UPDATE_ALL 1
#define UPDATE_FROM_CURSOR 2
#define UPDATE_JUST_CURSOR 3
#endif /* irc__input_h_ */
|
/*
The Balsa Asynchronous Hardware Synthesis System
Copyright (C) 1995-2003 Department of Computer Science
The University of Manchester, Oxford Road, Manchester, UK, M13 9PL
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
`BalsaScanSource.h'
Modified automatically generated rex Source.c file
Added code to track file inclusion
*/
#ifndef BALSA_SOURCE_HEADER
#define BALSA_SOURCE_HEADER
#include "rSystem.h"
extern int Balsa (void);
#define BalsaScan_GetLine(file, buffer, size) rRead ((file), (buffer), (size))
#define BalsaScan_CloseSource(file) rClose (file)
extern int BalsaScan_BeginSource (char *fileName);
#endif /* BALSA_SOURCE_HEADER */
|
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <WordPressApi/WordPressApi.h>
#import "WordPressComApi.h"
@class Blog;
@interface WPAccount : NSManagedObject
///-----------------
/// @name Properties
///-----------------
@property (nonatomic, strong) NSNumber *userID;
@property (nonatomic, strong) NSString *avatarURL;
@property (nonatomic, copy) NSString *username;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, strong) NSString *email;
@property (nonatomic, strong) NSSet *blogs;
@property (nonatomic, strong) NSSet *jetpackBlogs;
@property (nonatomic, readonly) NSArray *visibleBlogs;
@property (nonatomic, strong) Blog *defaultBlog;
/**
The OAuth2 auth token for WordPress.com accounts
*/
@property (nonatomic, copy) NSString *authToken;
///------------------
/// @name API Helpers
///------------------
/**
A WordPressComApi object if the account is a WordPress.com account. Otherwise, it returns `nil`
*/
@property (nonatomic, readonly) WordPressComApi *restApi;
@end
@interface WPAccount (CoreDataGeneratedAccessors)
- (void)addBlogsObject:(Blog *)value;
- (void)removeBlogsObject:(Blog *)value;
- (void)addBlogs:(NSSet *)values;
- (void)removeBlogs:(NSSet *)values;
- (void)addJetpackBlogsObject:(Blog *)value;
- (void)removeJetpackBlogsObject:(Blog *)value;
- (void)addJetpackBlogs:(NSSet *)values;
- (void)removeJetpackBlogs:(NSSet *)values;
@end
|
/****************************************************************************/
/*
* uclinux.c -- generic memory mapped MTD driver for uclinux
*
* (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
*
* $Id: uclinux.c,v 1.1.1.1 2010/03/11 21:07:58 kris Exp $
*/
/****************************************************************************/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
/****************************************************************************/
struct map_info uclinux_ram_map = {
.name = "RAM",
};
struct mtd_info *uclinux_ram_mtdinfo;
/****************************************************************************/
struct mtd_partition uclinux_romfs[] = {
{ .name = "ROMfs" }
};
#define NUM_PARTITIONS ARRAY_SIZE(uclinux_romfs)
/****************************************************************************/
int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char **mtdbuf)
{
struct map_info *map = mtd->priv;
*mtdbuf = (u_char *) (map->virt + ((int) from));
*retlen = len;
return(0);
}
/****************************************************************************/
int __init uclinux_mtd_init(void)
{
struct mtd_info *mtd;
struct map_info *mapp;
extern char _ebss;
unsigned long addr = (unsigned long) &_ebss;
mapp = &uclinux_ram_map;
mapp->phys = addr;
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8))));
mapp->bankwidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size);
mapp->virt = ioremap_nocache(mapp->phys, mapp->size);
if (mapp->virt == 0) {
printk("uclinux[mtd]: ioremap_nocache() failed\n");
return(-EIO);
}
simple_map_init(mapp);
mtd = do_map_probe("map_ram", mapp);
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
iounmap(mapp->virt);
return(-ENXIO);
}
mtd->owner = THIS_MODULE;
mtd->point = uclinux_point;
mtd->priv = mapp;
uclinux_ram_mtdinfo = mtd;
add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
return(0);
}
/****************************************************************************/
void __exit uclinux_mtd_cleanup(void)
{
if (uclinux_ram_mtdinfo) {
del_mtd_partitions(uclinux_ram_mtdinfo);
map_destroy(uclinux_ram_mtdinfo);
uclinux_ram_mtdinfo = NULL;
}
if (uclinux_ram_map.virt) {
iounmap((void *) uclinux_ram_map.virt);
uclinux_ram_map.virt = 0;
}
}
/****************************************************************************/
module_init(uclinux_mtd_init);
module_exit(uclinux_mtd_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
MODULE_DESCRIPTION("Generic RAM based MTD for uClinux");
/****************************************************************************/
|
/*
* Copyright (C) 1996-2015 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
/*
NT_auth - Version 2.0
Modified to act as a Squid authenticator module.
Returns OK for a successful authentication, or ERR upon error.
Guido Serassio, Torino - Italy
Uses code from -
Antonino Iannella 2000
Andrew Tridgell 1997
Richard Sharpe 1996
Bill Welliver 1999
* Distributed freely under the terms of the GNU General Public License,
* version 2 or later. See the file COPYING for licensing details
*
* 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, USA.
*/
#ifndef _VALID_H_
#define _VALID_H_
#include "sspwin32.h"
#if HAVE_WINDOWS_H
#include <windows.h>
#endif
#include <lm.h>
#include <sys/types.h>
#undef debug
/************* CONFIGURATION ***************/
/* SMB User verification function */
#define NTV_NO_ERROR 0
#define NTV_SERVER_ERROR 1
#define NTV_GROUP_ERROR 2
#define NTV_LOGON_ERROR 3
#ifndef LOGON32_LOGON_NETWORK
#define LOGON32_LOGON_NETWORK 3
#endif
#define NTV_DEFAULT_DOMAIN "."
extern char * NTAllowedGroup;
extern char * NTDisAllowedGroup;
extern int UseDisallowedGroup;
extern int UseAllowedGroup;
extern int debug_enabled;
extern char Default_NTDomain[DNLEN+1];
extern const char * errormsg;
/**
* Valid_User return codes.
*
* \retval 0 User authenticated successfully.
* \retval 1 Server error.
* \retval 2 Group membership error.
* \retval 3 Logon error; Incorrect password or username given.
*/
int Valid_User(char *UserName, char *Password, char *Group);
/* Debugging stuff */
#if defined(__GNUC__) /* this is really a gcc-ism */
#include <unistd.h>
static char *__foo;
#define debug(X...) if (debug_enabled) { \
fprintf(stderr,"nt_auth[%d](%s:%d): ", getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
#else /* __GNUC__ */
static void
debug(char *format,...)
{
if (debug_enabled) {
va_list args;
va_start(args,format);
fprintf(stderr, "nt_auth[%d]: ",getpid());
vfprintf(stderr, format, args);
va_end(args);
}
}
#endif /* __GNUC__ */
#endif
|
#include <stdio.h>
void main(int argc, const char *argv[]){
printf("Mea Error! =P\n");
return 0;
}
|
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: net command
* FILE: base/applications/network/net/cmdContinue.c
* PURPOSE:
*
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
*/
#include "net.h"
INT cmdContinue(INT argc, WCHAR **argv)
{
SC_HANDLE hManager = NULL;
SC_HANDLE hService = NULL;
SERVICE_STATUS status;
INT nError = 0;
INT i;
if (argc != 3)
{
PrintResourceString(IDS_CONTINUE_SYNTAX);
return 1;
}
for (i = 2; i < argc; i++)
{
if (_wcsicmp(argv[i], L"/help") == 0)
{
PrintResourceString(IDS_CONTINUE_HELP);
return 1;
}
}
hManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ENUMERATE_SERVICE);
if (hManager == NULL)
{
printf("[OpenSCManager] Error: %ld\n", GetLastError());
nError = 1;
goto done;
}
hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
if (hService == NULL)
{
printf("[OpenService] Error: %ld\n", GetLastError());
nError = 1;
goto done;
}
if (!ControlService(hService, SERVICE_CONTROL_CONTINUE, &status))
{
printf("[ControlService] Error: %ld\n", GetLastError());
nError = 1;
}
done:
if (hService != NULL)
CloseServiceHandle(hService);
if (hManager != NULL)
CloseServiceHandle(hManager);
return nError;
}
/* EOF */
|
/*
* arch/arm/mach-netx/generic.c
*
* Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
* 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
*/
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <asm/mach/map.h>
#include <asm/hardware/vic.h>
#include <mach/netx-regs.h>
#include <asm/mach/irq.h>
static struct map_desc netx_io_desc[] __initdata = {
{
.virtual = NETX_IO_VIRT,
.pfn = __phys_to_pfn(NETX_IO_PHYS),
.length = NETX_IO_SIZE,
.type = MT_DEVICE
}
};
void __init netx_map_io(void)
{
iotable_init(netx_io_desc, ARRAY_SIZE(netx_io_desc));
}
static struct resource netx_rtc_resources[] = {
[0] = {
.start = 0x00101200,
.end = 0x00101220,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device netx_rtc_device = {
.name = "netx-rtc",
.id = 0,
.num_resources = ARRAY_SIZE(netx_rtc_resources),
.resource = netx_rtc_resources,
};
static struct platform_device *devices[] __initdata = {
&netx_rtc_device,
};
#if 0
#define DEBUG_IRQ(fmt...) printk(fmt)
#else
#define DEBUG_IRQ(fmt...) while (0) {}
#endif
static void
netx_hif_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
{
unsigned int irq = NETX_IRQ_HIF_CHAINED(0);
unsigned int stat;
stat = ((readl(NETX_DPMAS_INT_EN) &
readl(NETX_DPMAS_INT_STAT)) >> 24) & 0x1f;
while (stat) {
if (stat & 1) {
DEBUG_IRQ("handling irq %d\n", irq);
generic_handle_irq(irq);
}
irq++;
stat >>= 1;
}
}
static int
<<<<<<< HEAD
netx_hif_irq_type(struct irq_data *d, unsigned int type)
=======
netx_hif_irq_type(unsigned int _irq, unsigned int type)
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
{
unsigned int val, irq;
val = readl(NETX_DPMAS_IF_CONF1);
<<<<<<< HEAD
irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
=======
irq = _irq - NETX_IRQ_HIF_CHAINED(0);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
if (type & IRQ_TYPE_EDGE_RISING) {
DEBUG_IRQ("rising edges\n");
val |= (1 << 26) << irq;
}
if (type & IRQ_TYPE_EDGE_FALLING) {
DEBUG_IRQ("falling edges\n");
val &= ~((1 << 26) << irq);
}
if (type & IRQ_TYPE_LEVEL_LOW) {
DEBUG_IRQ("low level\n");
val &= ~((1 << 26) << irq);
}
if (type & IRQ_TYPE_LEVEL_HIGH) {
DEBUG_IRQ("high level\n");
val |= (1 << 26) << irq;
}
writel(val, NETX_DPMAS_IF_CONF1);
return 0;
}
static void
<<<<<<< HEAD
netx_hif_ack_irq(struct irq_data *d)
{
unsigned int val, irq;
irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
=======
netx_hif_ack_irq(unsigned int _irq)
{
unsigned int val, irq;
irq = _irq - NETX_IRQ_HIF_CHAINED(0);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
writel((1 << 24) << irq, NETX_DPMAS_INT_STAT);
val = readl(NETX_DPMAS_INT_EN);
val &= ~((1 << 24) << irq);
writel(val, NETX_DPMAS_INT_EN);
<<<<<<< HEAD
DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
}
static void
netx_hif_mask_irq(struct irq_data *d)
{
unsigned int val, irq;
irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
val = readl(NETX_DPMAS_INT_EN);
val &= ~((1 << 24) << irq);
writel(val, NETX_DPMAS_INT_EN);
DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
}
static void
netx_hif_unmask_irq(struct irq_data *d)
{
unsigned int val, irq;
irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
val = readl(NETX_DPMAS_INT_EN);
val |= (1 << 24) << irq;
writel(val, NETX_DPMAS_INT_EN);
DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
}
static struct irq_chip netx_hif_chip = {
.irq_ack = netx_hif_ack_irq,
.irq_mask = netx_hif_mask_irq,
.irq_unmask = netx_hif_unmask_irq,
.irq_set_type = netx_hif_irq_type,
=======
DEBUG_IRQ("%s: irq %d\n", __func__, _irq);
}
static void
netx_hif_mask_irq(unsigned int _irq)
{
unsigned int val, irq;
irq = _irq - NETX_IRQ_HIF_CHAINED(0);
val = readl(NETX_DPMAS_INT_EN);
val &= ~((1 << 24) << irq);
writel(val, NETX_DPMAS_INT_EN);
DEBUG_IRQ("%s: irq %d\n", __func__, _irq);
}
static void
netx_hif_unmask_irq(unsigned int _irq)
{
unsigned int val, irq;
irq = _irq - NETX_IRQ_HIF_CHAINED(0);
val = readl(NETX_DPMAS_INT_EN);
val |= (1 << 24) << irq;
writel(val, NETX_DPMAS_INT_EN);
DEBUG_IRQ("%s: irq %d\n", __func__, _irq);
}
static struct irq_chip netx_hif_chip = {
.ack = netx_hif_ack_irq,
.mask = netx_hif_mask_irq,
.unmask = netx_hif_unmask_irq,
.set_type = netx_hif_irq_type,
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
};
void __init netx_init_irq(void)
{
int irq;
vic_init(__io(io_p2v(NETX_PA_VIC)), 0, ~0, 0);
for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
<<<<<<< HEAD
irq_set_chip_and_handler(irq, &netx_hif_chip,
handle_level_irq);
=======
set_irq_chip(irq, &netx_hif_chip);
set_irq_handler(irq, handle_level_irq);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
set_irq_flags(irq, IRQF_VALID);
}
writel(NETX_DPMAS_INT_EN_GLB_EN, NETX_DPMAS_INT_EN);
<<<<<<< HEAD
irq_set_chained_handler(NETX_IRQ_HIF, netx_hif_demux_handler);
=======
set_irq_chained_handler(NETX_IRQ_HIF, netx_hif_demux_handler);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
}
static int __init netx_init(void)
{
return platform_add_devices(devices, ARRAY_SIZE(devices));
}
subsys_initcall(netx_init);
|
/********************************************
* *
* Eyüp Can KILINÇDEMİR *
* KARADENİZ TEKNİK UNİVERSİTESİ *
* ceksoft.wordpress.com *
* eyupcankilincdemir@gmail.com *
* *
********************************************/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int sifreli_sayi,sayi,binler,yuzler,onlar,birler,ara_degisken;
printf("Programdan cikmak icin -1 giriniz.\n");
printf("Sifrelenicek sayiyi giriniz:");
scanf("%d",&sayi);
while (sayi!=-1)
{
binler = sayi / 1000; //sayinin binler basamagindaki rakam degiskene atanir
binler = binler + 7;
binler = binler % 10;
yuzler = sayi / 100; //sayinin yuzler basamagindaki rakam degiskene atanir
yuzler = yuzler + 7;
yuzler = yuzler % 10;
onlar = sayi / 10; //sayinin onlar basamagindaki rakam degiskene atanir
onlar = onlar + 7;
onlar = onlar % 10;
birler = sayi % 10; //sayinin birler basamagindaki rakam degiskene atanir
birler = birler + 7;
birler = birler % 10;
ara_degisken = birler; //birler basamagi yuzler basamagiyla yer degistirir
birler = yuzler;
yuzler = ara_degisken;
ara_degisken = onlar; //onlar basamagi birler basamagiyla yer degistirir
onlar = binler;
binler = ara_degisken;
sifreli_sayi = (1000*binler) + (100*yuzler) + (10*onlar) + (birler); //rakamlar basamak degerleriyle carpilip toplanir
printf("Girdiginiz sayi %d dir Sifreli sayiniz %d dir.\n",sayi,sifreli_sayi);
printf("Sifrelenicek sayiyi giriniz:");
scanf("%d",&sayi);
}
printf("Programdan Sonlandirilmistir.");
return 0;
}
|
/*
* NEC PC-9801 keyboard controller driver for Linux
*
* Copyright (c) 1999-2002 Osamu Tomita <tomita@cinet.co.jp>
* Based on i8042.c written by Vojtech Pavlik
*/
/*
* 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/config.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/serio.h>
#include <linux/sched.h>
#include <asm/io.h>
MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
MODULE_DESCRIPTION("NEC PC-9801 keyboard controller driver");
MODULE_LICENSE("GPL");
/*
* Names.
*/
#define KBD98_PHYS_DESC "isa0041/serio0"
/*
* IRQs.
*/
#define KBD98_IRQ 1
/*
* Register numbers.
*/
#define KBD98_COMMAND_REG 0x43
#define KBD98_STATUS_REG 0x43
#define KBD98_DATA_REG 0x41
spinlock_t kbd98io_lock = SPIN_LOCK_UNLOCKED;
static struct serio kbd98_port;
extern struct pt_regs *kbd_pt_regs;
static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs);
/*
* kbd98_flush() flushes all data that may be in the keyboard buffers
*/
static int kbd98_flush(void)
{
unsigned long flags;
spin_lock_irqsave(&kbd98io_lock, flags);
while (inb(KBD98_STATUS_REG) & 0x02) /* RxRDY */
inb(KBD98_DATA_REG);
if (inb(KBD98_STATUS_REG) & 0x38)
printk("98kbd-io: Keyboard error!\n");
spin_unlock_irqrestore(&kbd98io_lock, flags);
return 0;
}
/*
* kbd98_write() sends a byte out through the keyboard interface.
*/
static int kbd98_write(struct serio *port, unsigned char c)
{
unsigned long flags;
spin_lock_irqsave(&kbd98io_lock, flags);
outb(0, 0x5f); /* wait */
outb(0x17, KBD98_COMMAND_REG); /* enable send command */
outb(0, 0x5f); /* wait */
outb(c, KBD98_DATA_REG);
outb(0, 0x5f); /* wait */
outb(0x16, KBD98_COMMAND_REG); /* disable send command */
outb(0, 0x5f); /* wait */
spin_unlock_irqrestore(&kbd98io_lock, flags);
return 0;
}
/*
* kbd98_open() is called when a port is open by the higher layer.
* It allocates the interrupt and enables in in the chip.
*/
static int kbd98_open(struct serio *port)
{
kbd98_flush();
if (request_irq(KBD98_IRQ, kbd98io_interrupt, 0, "kbd98", NULL)) {
printk(KERN_ERR "98kbd-io.c: Can't get irq %d for %s, unregistering the port.\n", KBD98_IRQ, "KBD");
serio_unregister_port(port);
return -1;
}
return 0;
}
static void kbd98_close(struct serio *port)
{
free_irq(KBD98_IRQ, NULL);
kbd98_flush();
}
/*
* Structures for registering the devices in the serio.c module.
*/
static struct serio kbd98_port =
{
.type = SERIO_PC9800,
.write = kbd98_write,
.open = kbd98_open,
.close = kbd98_close,
.driver = NULL,
.name = "PC-9801 Kbd Port",
.phys = KBD98_PHYS_DESC,
};
/*
* kbd98io_interrupt() is the most important function in this driver -
* it handles the interrupts from keyboard, and sends incoming bytes
* to the upper layers.
*/
static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long flags;
unsigned char data;
spin_lock_irqsave(&kbd98io_lock, flags);
data = inb(KBD98_DATA_REG);
spin_unlock_irqrestore(&kbd98io_lock, flags);
serio_interrupt(&kbd98_port, data, 0, regs);
return IRQ_HANDLED;
}
int __init kbd98io_init(void)
{
serio_register_port(&kbd98_port);
printk(KERN_INFO "serio: PC-9801 %s port at %#lx,%#lx irq %d\n",
"KBD",
(unsigned long) KBD98_DATA_REG,
(unsigned long) KBD98_COMMAND_REG,
KBD98_IRQ);
return 0;
}
void __exit kbd98io_exit(void)
{
serio_unregister_port(&kbd98_port);
}
module_init(kbd98io_init);
module_exit(kbd98io_exit);
|
// -------------------------------------------------------------------------
// generator/ecp_g_force.h dla QNX6
// Deklaracje generatorow dla procesow ECP z wykorzystaniem sily
//
// -------------------------------------------------------------------------
#if !defined(_ECP_GEN_EIH_H)
#define _ECP_GEN_EIH_H
#include "base/lib/impconst.h"
#include "base/lib/com_buf.h"
#include "generator/ecp/ecp_g_teach_in.h"
#include "generator/ecp/tff_nose_run/ecp_g_tff_nose_run.h"
#include "base/lib/mrmath/mrmath.h"
namespace mrrocpp {
namespace ecp {
namespace common {
namespace generator {
// --------------------------------------------------------------------------
// Generator trajektorii dla zadania kalibracji ukladu eih.
// Rozni sie od tff_nose_run tym ze zatrzymuje sie po chwili i trzeba go uzywac w petli
class eih_nose_run : public tff_nose_run
{
int count;
public:
// konstruktor
eih_nose_run(common::task::task& _ecp_task, int step = 0);
virtual bool next_step();
}; // end : class ecp_eih_nose_run_generator
} // namespace generator
} // namespace common
} // namespace ecp
} // namespace mrrocpp
#endif
|
/*
mimetypeswidget.h
This file is part of GammaRay, the Qt application inspection and
manipulation tool.
Copyright (C) 2012-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Author: Volker Krause <volker.krause@kdab.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef GAMMARAY_MIMETYPESWIDGET_H
#define GAMMARAY_MIMETYPESWIDGET_H
#include <QWidget>
namespace GammaRay {
namespace Ui {
class MimeTypesWidget;
}
class MimeTypesWidget : public QWidget
{
Q_OBJECT
public:
explicit MimeTypesWidget(QWidget *parent = 0);
~MimeTypesWidget();
private:
QScopedPointer<Ui::MimeTypesWidget> ui;
};
}
#endif // GAMMARAY_MIMETYPESWIDGET_H
|
/*
* UWB Multi-interface Controller device management.
*
* Copyright (C) 2007 Cambridge Silicon Radio Ltd.
*
* This file is released under the GNU GPL v2.
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/uwb/umc.h>
static void umc_device_release(struct device *dev)
{
struct umc_dev *umc = to_umc_dev(dev);
kfree(umc);
}
/**
* umc_device_create - allocate a child UMC device
* @parent: parent of the new UMC device.
* @n: index of the new device.
*
* The new UMC device will have a bus ID of the parent with '-n'
* appended.
*/
struct umc_dev *umc_device_create(struct device *parent, int n)
{
struct umc_dev *umc;
umc = kzalloc(sizeof(struct umc_dev), GFP_KERNEL);
if (umc) {
dev_set_name(&umc->dev, "%s-%d", dev_name(parent), n);
umc->dev.parent = parent;
umc->dev.bus = &umc_bus_type;
umc->dev.release = umc_device_release;
umc->dev.dma_mask = parent->dma_mask;
}
return umc;
}
EXPORT_SYMBOL_GPL(umc_device_create);
/**
* umc_device_register - register a UMC device
* @umc: pointer to the UMC device
*
* The memory resource for the UMC device is acquired and the device
* registered with the system.
*/
int umc_device_register(struct umc_dev *umc)
{
int err;
err = request_resource(umc->resource.parent, &umc->resource);
if (err < 0) {
dev_err(&umc->dev, "can't allocate resource range %pR: %d\n",
&umc->resource, err);
goto error_request_resource;
}
err = device_register(&umc->dev);
if (err < 0)
goto error_device_register;
return 0;
error_device_register:
release_resource(&umc->resource);
error_request_resource:
return err;
}
EXPORT_SYMBOL_GPL(umc_device_register);
/**
* umc_device_unregister - unregister a UMC device
* @umc: pointer to the UMC device
*
* First we unregister the device, make sure the driver can do it's
* resource release thing and then we try to release any left over
* resources. We take a ref to the device, to make sure it doesn't
* disappear under our feet.
*/
void umc_device_unregister(struct umc_dev *umc)
{
struct device *dev;
if (!umc)
return;
dev = get_device(&umc->dev);
device_unregister(&umc->dev);
release_resource(&umc->resource);
put_device(dev);
}
EXPORT_SYMBOL_GPL(umc_device_unregister);
|
/*
* Copyright 2013 Michael Zanetti
*
* 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; version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Michael Zanetti <michael_zanetti@gmx.net>
*/
#ifndef LIGHTS_H
#define LIGHTS_H
#include <QAbstractListModel>
#include <QTimer>
class Light;
class Lights : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles {
RoleId,
RoleName,
RoleModelId,
RoleType,
RoleSwVersion,
RoleOn,
RoleBrightness,
RoleHue,
RoleSaturation,
RoleXY,
RoleCt,
RoleAlert,
RoleEffect,
RoleColorMode,
RoleReachable
};
explicit Lights(QObject *parent = 0);
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QHash<int, QByteArray> roleNames() const;
Q_INVOKABLE Light* get(int index) const;
public slots:
void refresh();
private slots:
void lightsReceived(int id, const QVariant &variant);
void lightDescriptionChanged();
void lightStateChanged();
private:
Light* createLight(int id, const QString &name);
private:
QList<Light*> m_list;
QTimer m_timer;
};
#endif // LIGHTS_H
|
/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
* This file is part of the Linux-8086 C library and is distributed
* under the GNU Library General Public License.
*
* This is a combined alloca/malloc package. It uses a classic algorithm
* and so may be seen to be quite slow compared to more modern routines
* with 'nasty' distributions.
*/
#include "malloc-l.h"
/* Start the alloca with just the dumb version of malloc */
void *(*__alloca_alloc) __P((size_t)) = __mini_malloc;
/* the free list is a single list of free blocks. __freed_list points to
the highest block (highest address) and each block points to the lower
block (lower address). last block points to 0 (initial value of
_freed_list)
*/
mem *__freed_list = 0;
#ifdef VERBOSE
/* NB: Careful here, stdio may use malloc - so we can't */
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
static void pstr __P((char *));
static void phex __P((unsigned));
static void noise __P((char *, mem *));
static void pstr(char *str)
{
write(2, str, strlen(str));
} static void phex(unsigned val)
{
char buf[8];
strcpy(buf, "000");
ltoa((long) val, buf + 3, 16);
pstr(buf + strlen(buf + 4));
} void __noise(char *y, mem * x)
{
pstr("Malloc ");
phex((unsigned) x);
pstr(" sz ");
phex(x ? (unsigned) m_size(x) : 0);
pstr(" nxt ");
phex(x ? (unsigned) m_next(x) : 0);
pstr(" is ");
pstr(y);
pstr("\n");
}
#endif /* */
void free(void *ptr)
{
register mem *top, *chk = (mem *) ptr;
if (chk == 0)
return; /* free(NULL) - be nice */
chk--;
try_this:;
top = (mem *) sbrk(0);
if (m_add(chk, m_size(chk)) >= top) {
noise("FREE brk", chk);
brk((void *) ((uchar *) top - m_size(chk)));
/* Adding this code allow free to release blocks in any order;
* they can still only be allocated from the top of the heap
* tho.
*/
#ifdef __MINI_MALLOC__
if (__alloca_alloc == __mini_malloc && __freed_list) {
chk = __freed_list;
__freed_list = m_next(__freed_list);
goto try_this;
}
#endif /* */
}
else { /* Nope, not sure where this goes, leave it for malloc to deal with */
#ifdef __MINI_MALLOC__
/* check if block is already on free list.
if it is, return without doing nothing */
top = __freed_list;
while (top) {
if (top == chk)
return;
top = m_next(top);
}
/* else add it to free list */
if (!__freed_list || chk > __freed_list) {
/* null free list or block above free list */
m_next(chk) = __freed_list;
__freed_list = chk;
}
else {
/* insert block in free list, ordered by address */
register mem *prev = __freed_list;
top = __freed_list;
while (top && top > chk) {
prev = top;
top = m_next(top);
}
m_next(chk) = top;
m_next(prev) = chk;
}
#else /* */
m_next(chk) = __freed_list;
__freed_list = chk;
#endif /* */
noise("ADD LIST", chk);
}
}
void *__mini_malloc(size_t size)
{
register mem *ptr;
register unsigned int sz;
/* First time round this _might_ be odd, But we won't do that! */
#if 0
sz = (unsigned int) sbrk(0);
if (sz & (sizeof(struct mem_cell) - 1)) {
if (sbrk
(sizeof(struct mem_cell) -
(sz & (sizeof(struct mem_cell) - 1))) < 0)
goto nomem;
}
#endif /* */
if (size == 0)
return 0;
/* Minor oops here, sbrk has a signed argument */
if (size > (((unsigned) -1) >> 1) - sizeof(struct mem_cell) * 3) {
nomem:errno = ENOMEM;
return 0;
}
size += sizeof(struct mem_cell); /* Round up and leave space for size field */
ptr = (mem *) sbrk(size);
if ((int) ptr == -1)
return 0;
m_size(ptr) = size;
noise("CREATE", ptr);
return ptr + 1;
}
|
/**
******************************************************************************
* @file WWDG/WWDG_Example/Inc/main.h
* @author MCD Application Team
* @version V1.1.0
* @date 26-June-2014
* @brief Header for main.c module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2014 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include "stm324x9i_eval.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/***************************************************************************
* Copyright (C) 2004 by Diego "Flameeyes" Pettenò *
* dgp85@users.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. *
***************************************************************************/
#ifndef KSNMPSESSION1_H
#define KSNMPSESSION1_H
#include <libksnmp/session.h>
namespace KSNMP {
/**
@author Flameeyes
@brief SNMPv1 Session descriptor
This class reperesent a SNMPv1 session, and it's used to communicate with
this protocol to the peer.
@sa Session2c
*/
class Session1 : public Session
{
protected:
/**
@brief Community string for session
Every SNMP session must have a community name, which is used as a sort
of 'password' for the SNMP.
The default community strings are 'public' for read-only access, and
'private' for read-write access. Not to say, these values aren't the
most secure ones.
*/
QString m_community;
public:
/**
@brief Peer-Specifying constructor
@param peername Hostname or IP address of the host to open the session to
@param community Community name to use for the session. If not
specified it defaults to 'public'.
This constructor sets the peer name to the one requested, prepare
the connection and waits for connection request.
The optional community parameter is used to set the community name.
@sa Session1::Session()
@sa Session1::setCommunity()
@sa Session::setPeerName()
*/
Session1(const QString &peername = "localhost", const QString &community = "public");
~Session1();
/**
@brief Sets the community name
@param community New community name to set the session to.
@retval true The session is not open, the community name is changed.
@retval false The session is already open, the community name can't be changed.
*/
bool setCommunity(const QString &community)
{
/// \todo need to fix this when the open-session code is done :)
if ( m_session )
return false;
m_community = community;
return true;
}
virtual bool open();
};
};
#endif
|
/*
Copyright (C) 2014 Erik Ogenvik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef STUBDATABASE_H_
#define STUBDATABASE_H_
Database * Database::m_instance = NULL;
int Database::initConnection()
{
return 0;
}
Database::Database() : m_rule_db("rules"),
m_queryInProgress(false),
m_connection(NULL)
{
}
Database::~Database()
{
}
void Database::shutdownConnection()
{
}
int Database::registerRelation(std::string & tablename,
const std::string & sourcetable,
const std::string & targettable,
RelationType kind)
{
return 0;
}
const DatabaseResult Database::selectSimpleRowBy(const std::string & name,
const std::string & column,
const std::string & value)
{
return DatabaseResult(0);
}
Database * Database::instance()
{
if (m_instance == NULL) {
m_instance = new Database();
}
return m_instance;
}
int Database::createInstanceDatabase()
{
return 0;
}
int Database::registerEntityIdGenerator()
{
return 0;
}
int Database::registerEntityTable(const std::map<std::string, int> & chunks)
{
return 0;
}
int Database::registerPropertyTable()
{
return 0;
}
int Database::initRule(bool createTables)
{
return 0;
}
int Database::registerSimpleTable(const std::string & name,
const MapType & row)
{
return 0;
}
int Database::createSimpleRow(const std::string & name,
const std::string & id,
const std::string & columns,
const std::string & values)
{
return 0;
}
const DatabaseResult Database::selectRelation(const std::string & name,
const std::string & id)
{
return DatabaseResult(0);
}
int Database::createRelationRow(const std::string & name,
const std::string & id,
const std::string & other)
{
return 0;
}
int Database::removeRelationRow(const std::string & name,
const std::string & id)
{
return 0;
}
int Database::removeRelationRowByOther(const std::string & name,
const std::string & other)
{
return 0;
}
bool Database::hasKey(const std::string & table, const std::string & key)
{
return false;
}
int Database::putObject(const std::string & table,
const std::string & key,
const MapType & o,
const StringVector & c)
{
return 0;
}
int Database::getTable(const std::string & table,
std::map<std::string, Atlas::Objects::Root> & contents)
{
return 0;
}
int Database::clearPendingQuery()
{
return 0;
}
int Database::updateObject(const std::string & table,
const std::string & key,
const MapType & o)
{
return 0;
}
int Database::clearTable(const std::string & table)
{
return 0;
}
long Database::newId(std::string & id)
{
return 0;
}
void Database::cleanup()
{
if (m_instance != 0) {
delete m_instance;
}
m_instance = 0;
}
int Database::registerThoughtsTable()
{
return 0;
}
const DatabaseResult Database::selectProperties(const std::string & id)
{
return DatabaseResult(0);
}
const DatabaseResult Database::selectEntities(const std::string & loc)
{
return DatabaseResult(0);
}
int Database::encodeObject(const MapType & o,
std::string & data)
{
return 0;
}
int Database::decodeMessage(const std::string & data,
MapType &o)
{
return 0;
}
int Database::insertEntity(const std::string & id,
const std::string & loc,
const std::string & type,
int seq,
const std::string & value)
{
return 0;
}
int Database::updateEntity(const std::string & id,
int seq,
const std::string & location_data,
const std::string & location)
{
return 0;
}
int Database::updateEntityWithoutLoc(const std::string & id,
int seq,
const std::string & location_data)
{
return 0;
}
int Database::dropEntity(long id)
{
return 0;
}
int Database::insertProperties(const std::string & id,
const KeyValues & tuples)
{
return 0;
}
int Database::updateProperties(const std::string & id,
const KeyValues & tuples)
{
return 0;
}
const DatabaseResult Database::selectThoughts(const std::string & loc)
{
return DatabaseResult(0);
}
int Database::replaceThoughts(const std::string & id,
const std::vector<std::string>& thoughts)
{
return 0;
}
int Database::launchNewQuery()
{
return 0;
}
#endif /* STUBDATABASE_H_ */
|
#define DEB(stmt) /* stmt */ /* For debug printing */
#define DEB2(stmt) /* stmt */ /* For debug printing */
#define DEB3(stmt) stmt /* For debug printing */
#define DEB_ALWAYS(stmt) stmt /* Interesting things */
#define _INCLUDE_POSIX_SOURCE 1
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/errno.h>
#include "../../../include/soundcard.h"
extern int errno;
#include "mlib.h"
SEQ_DEFINEBUF (1024);
int seqfd;
mlib_track *tracks[1024];
int ntrks = 0;
int dev = 0;
void
player ()
{
int i, track;
int prev_time = 0;
int ptrs[1024] = { 0 };
unsigned char *ptr;
unsigned char *event;
int time, n = 0;
#if 0
for (track = 0; track < ntrks; track++)
for (i = 0; i < 128; i++)
{
if (tracks[track]->pgm_map[i] != -1)
{
n++;
SEQ_LOAD_GMINSTR (dev, i);
}
tracks[track]->pgm_map[i] = i;
if (n == 0) /* No program changes. Assume pgm# 0 */
SEQ_LOAD_GMINSTR (dev, 0);
if (tracks[track]->drum_map[i] != -1)
SEQ_LOAD_GMDRUM (dev, i);
tracks[track]->drum_map[i] = i;
}
if (n == 0) /* No program changes detected */
SEQ_LOAD_GMINSTR (dev, 0); /* Acoustic piano */
#endif
SEQ_START_TIMER ();
while (1)
{
int best = -1, best_time = 0x7fffffff;
for (i = 0; i < ntrks; i++)
if (ptrs[i] < tracks[i]->len)
{
ptr = &(tracks[i]->events[ptrs[i] * 12]);
event = &ptr[4];
time = *(int *) ptr;
if (time < best_time)
{
best = i;
best_time = time;
}
}
if (best == -1)
return;
ptr = &(tracks[best]->events[ptrs[best] * 12]);
event = &ptr[4];
time = *(int *) ptr;
ptrs[best]++;
if (event[0] < 128)
{
}
else
{
int j;
if (time > prev_time)
{
SEQ_WAIT_TIME (time);
prev_time = time;
}
if (event[0] == EV_SYSEX)
{
event[1] = dev;
}
if ((event[0] & 0xf0) == 0x90)
{
event[1] = dev;
if (event[0] == EV_CHN_COMMON && event[2] == MIDI_PGM_CHANGE)
{
event[4] = tracks[best]->pgm_map[event[4]];
}
}
_SEQ_NEEDBUF (8);
memcpy (&_seqbuf[_seqbufptr], event, 8);
_SEQ_ADVBUF (8);
}
}
}
int
main (int argc, char *argv[])
{
mlib_desc *mdesc;
int was_last;
int tmp, argp = 1;
oss_longname_t song_name;
char *p, *s, *devname="/dev/midi00";;
extern void OSS_set_timebase(int tb);
if (argc < 2)
{
fprintf (stderr, "Usage: %s midifile\n", argv[0]);
exit (-1);
}
if (argc==3)
{
devname=argv[1];
argp++;
}
if ((seqfd = open (devname, O_WRONLY, 0)) == -1)
{
perror (devname);
exit (-1);
}
dev=0;
#ifdef OSSLIB
OSS_init (seqfd, 1024);
#endif
if ((mdesc = mlib_open (argv[argp])) == NULL)
{
fprintf (stderr, "Can't open MIDI file %s: %s\n",
argv[argp], mlib_errmsg ());
exit (-1);
}
ioctl(seqfd, SNDCTL_SETSONG, argv[argp]);
/*
* Extract the file name part of the argument
*/
p=s=argv[argp];
while (*s)
{
if (*s=='/')
p=s+1;
s++;
}
memset(song_name, 0, sizeof(song_name));
strcpy(song_name, p);
#if 1
tmp=MIDI_MODE_TIMED;
if (ioctl(seqfd, SNDCTL_MIDI_SETMODE, &tmp)==-1)
{
perror("SNDCTL_MIDI_SETMODE");
exit(-1);
}
#endif
tmp = mdesc->hdr.division;
printf("Timebase %d\n", tmp);
OSS_set_timebase(tmp);
if (ioctl(seqfd, SNDCTL_MIDI_TIMEBASE, &tmp)==-1)
{
perror("SNDCTL_MIDI_TIMEBASE");
exit(-1);
}
ntrks = 0;
while ((tracks[ntrks] = mlib_loadtrack (mdesc, &was_last)) != NULL)
{
int i;
DEB2 (printf ("Loaded track %03d: len = %d events, flags = %08x\n",
mdesc->curr_trk, tracks[ntrks]->len,
tracks[ntrks]->flags));
ntrks++;
}
if (!was_last)
{
fprintf (stderr, "%s: %s\n", argv[argp], mlib_errmsg ());
exit (-1);
}
tmp = (int) mdesc->timesig;
printf("Timesig %08x\n", tmp);
/*
* Set the current song name (OSS 4.0 feature).
*/
ioctl(seqfd, SNDCTL_SETSONG, song_name);
player ();
SEQ_DELTA_TIME (mdesc->hdr.division * 8);
SEQ_PGM_CHANGE(0, 0, 0);
SEQ_DUMPBUF ();
mlib_close (mdesc);
close (seqfd);
exit (0);
}
|
/* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_TYPESAFE_CB_H
#define CCAN_TYPESAFE_CB_H
#include "config.h"
#define typesafe_cb_cast(desttype, oktype, expr) ((desttype)(expr))
/**
* typesafe_cb_cast3 - only cast an expression if it matches given types
* @desttype: the type to cast to
* @ok1: the first type we allow
* @ok2: the second type we allow
* @ok3: the third type we allow
* @expr: the expression to cast
*
* This is a convenient wrapper for multiple typesafe_cb_cast() calls.
* You can chain them inside each other (ie. use typesafe_cb_cast()
* for expr) if you need more than 3 arguments.
*
* Example:
* // We can take either a long, unsigned long, void * or a const void *.
* void _set_some_value(void *val);
* #define set_some_value(expr) \
* _set_some_value(typesafe_cb_cast3(void *,, \
* long, unsigned long, const void *,\
* (expr)))
*/
#define typesafe_cb_cast3(desttype, ok1, ok2, ok3, expr) \
typesafe_cb_cast(desttype, ok1, \
typesafe_cb_cast(desttype, ok2, \
typesafe_cb_cast(desttype, ok3, \
(expr))))
/**
* typesafe_cb - cast a callback function if it matches the arg
* @rtype: the return type of the callback function
* @atype: the (pointer) type which the callback function expects.
* @fn: the callback function to cast
* @arg: the (pointer) argument to hand to the callback function.
*
* If a callback function takes a single argument, this macro does
* appropriate casts to a function which takes a single atype argument if the
* callback provided matches the @arg.
*
* It is assumed that @arg is of pointer type: usually @arg is passed
* or assigned to a void * elsewhere anyway.
*
* Example:
* void _register_callback(void (*fn)(void *arg), void *arg);
* #define register_callback(fn, arg) \
* _register_callback(typesafe_cb(void, (fn), void*, (arg)), (arg))
*/
#define typesafe_cb(rtype, atype, fn, arg) \
typesafe_cb_cast(rtype (*)(atype), \
rtype (*)(__typeof__(arg)), \
(fn))
/**
* typesafe_cb_preargs - cast a callback function if it matches the arg
* @rtype: the return type of the callback function
* @atype: the (pointer) type which the callback function expects.
* @fn: the callback function to cast
* @arg: the (pointer) argument to hand to the callback function.
*
* This is a version of typesafe_cb() for callbacks that take other arguments
* before the @arg.
*
* Example:
* void _register_callback(void (*fn)(int, void *arg), void *arg);
* #define register_callback(fn, arg) \
* _register_callback(typesafe_cb_preargs(void, void *, \
* (fn), (arg), int), \
* (arg))
*/
#define typesafe_cb_preargs(rtype, atype, fn, arg, ...) \
typesafe_cb_cast(rtype (*)(__VA_ARGS__, atype), \
rtype (*)(__VA_ARGS__, __typeof__(arg)), \
(fn))
/**
* typesafe_cb_postargs - cast a callback function if it matches the arg
* @rtype: the return type of the callback function
* @atype: the (pointer) type which the callback function expects.
* @fn: the callback function to cast
* @arg: the (pointer) argument to hand to the callback function.
*
* This is a version of typesafe_cb() for callbacks that take other arguments
* after the @arg.
*
* Example:
* void _register_callback(void (*fn)(void *arg, int), void *arg);
* #define register_callback(fn, arg) \
* _register_callback(typesafe_cb_postargs(void, (fn), void *, \
* (arg), int), \
* (arg))
*/
#define typesafe_cb_postargs(rtype, atype, fn, arg, ...) \
typesafe_cb_cast(rtype (*)(atype, __VA_ARGS__), \
rtype (*)(__typeof__(arg), __VA_ARGS__), \
(fn))
#endif /* CCAN_CAST_IF_TYPE_H */
|
/*******************************************************************************
* This file is part of OpenWSN, the Open Wireless Sensor Network Platform.
*
* Copyright (C) 2005-2010 zhangwei(TongJi University)
*
* OpenWSN is a 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.
*
* OpenWSN 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.
*
* For non-opensource or commercial applications, please choose commercial license.
* Refer to OpenWSN site http://code.google.com/p/openwsn/ for more detail.
*
* For other questions, you can contact the author through email openwsn#gmail.com
* or the mailing address: Dr. Wei Zhang, Dept. of Control, Dianxin Hall, TongJi
* University, 4800 Caoan Road, Shanghai, China. Zip: 201804
*
******************************************************************************/
#include "../../common/openwsn/hal/hal_configall.h"
#include "../../common/openwsn/hal/hal_foundation.h"
#include "../../common/openwsn/hal/hal_target.h"
#include "../../common/openwsn/hal/hal_debugio.h"
#include "../../common/openwsn/hal/hal_cpu.h"
/*******************************************************************************
* @modified by zhangwei on 2010.05.15
* - ported to winavr 2009. now the project can be built successfully with portable
* winavr 2009 and avrstudio 4.15.
* - rebuild the target binary files
* - revision
******************************************************************************/
int main(void)
{
char * msg = "hello! \r\n";
uint8 i;
/* initialize the target microcontroller(mcu) and the target board */
target_init();
/* open USRAT 0 and set baudrate to 38400. other parameters uses default values.
* by default, this project uses the GAINZ hardware platform. for other platforms
* you may need to modify the initial settings */
dbo_open(0, 38400);
/* output the message character by character */
for (i=0; i<9; i++)
dbo_putchar( msg[i] );
/* output the message as a whole */
dbo_write( msg, 9 );
while (1) {};
return 0;
}
|
// Copyleft 2008 Chris Korda
// 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.
/*
chris korda
revision history:
rev date comments
00 21feb09 initial version
01 01mar09 cycle old palette during tween
02 08mar09 add MixDibs
fractal rendering engine with palette tweening
*/
#ifndef CTWEENENGINE_INCLUDED
#define CTWEENENGINE_INCLUDED
#include "NetEngine.h"
class CTweenEngine : public CNetEngine {
public:
// Construction
CTweenEngine();
// Attributes
void SetPalette(const DPalette& Palette, UINT Quality, UINT CycleLen, double Offset);
bool IsTweening() const;
void SetTweening(bool Enable);
// Operations
void ResetPalette();
void UpdatePalette(const DPalette& Palette, UINT CycleLen, double Offset);
void UpdateTweenPalette(const DPalette& Palette, UINT CycleLen, double Offset);
void TweenPalette();
void MapColorEx(CDib& Dib, const DIB_INFO& Info, bool Mirror, CPoint Origin);
static void MixDibs(CDib& Dst, CDib& Src, const DIB_INFO& Info, double MixPos);
protected:
// Member data
CDWordArray m_OldPal; // palette we're tweening from
CDWordArray m_NewPal; // palette we're tweening to
CDWordArray m_TweenPal; // tween output palette
UINT m_Quality; // current quality
bool m_Tweening; // true if we're tweening palette
double m_TweenPos; // tweening position; 0 == old, 1 == new
double m_TweenDelta; // tweening amount per frame
UINT m_CycleLen; // current cycle length
UINT m_OldCycleLen; // old palette's cycle length
double m_ColorOffset; // current color offset
double m_InitColorOfs; // color offset at start of tween
};
inline bool CTweenEngine::IsTweening() const
{
return(m_Tweening);
}
inline void CTweenEngine::ResetPalette()
{
m_Palette.RemoveAll();
}
#endif
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: FileGLogger.h
* Author: gedas
*
* Created on Pirmadienis, 2016, kovas 28, 22.32
*/
#ifndef FILEGLOGGER_H
#define FILEGLOGGER_H
#include <fstream>
#include <string>
#include "LocalGLogger.h"
namespace GServer {
class FileGLogger : public LocalGLogger {
public:
// ##### Kintamieji #####
// ##### END Kintamieji #####
// #########################################################################
// ##### Metodai #####
/** FileGLOgger **
* metodas skitas sukurti objekta, kuris pranesimus raso i nurodyta
* faila.
* filePath- kelias iki failo, i kuri norima rasyti pranesimus
* debug- jungtis kuri ijungia arba isungia derinimo inforamcijos
* rasyma i pranesimu faila */
FileGLogger(std::string filePath, int debug);
virtual ~FileGLogger();
/* logInfo
* Metodas skirtas pranesti apie informacija */
virtual void logInfo(std::string className, std::string message);
/* logError
* Metodas skirtas pranesti apie klaida */
virtual void logError(std::string className, std::string message);
/* logDebug
* Metodas skirtas pranesti derinimo informacijai */
virtual void logDebug(std::string className, std::string message);
// ##### END Metodai #####
private:
// ##### Kintamieji #####
/* file_descriptor
* Objektas skirtas rasyti duomensi i faila nurodyta konfiguracinaime
* faile LOGGER_FILE_PATH nustatyme.
* Placiau: http://www.cplusplus.com/reference/fstream/ofstream/*/
std::ofstream* logFile;
// ##### END Kintamieji #####
// #########################################################################
// ##### Metodai #####
/* createFileDescriptor
* Metodas skirtas nuskaityti nuskaitymus is konfiguracinio failo ir
* atverti faila pranesimu rasimui nurodytu keliu. Skaityti apie
* file_descriptor
fielPath- kelias ini pranesimu rasymo failo*/
void openLogFile(std::string fielPath);
// ##### END Metodai #####
};
}
#endif /* FILEGLOGGER_H */
|
#ifndef DIALOGS_SETTINGSDIALOG_H
#define DIALOGS_SETTINGSDIALOG_H
#include "../global.h"
#include <QDialog>
#include <memory>
namespace QtUtilities {
class OptionCategoryModel;
class OptionCategoryFilterModel;
class OptionCategory;
class OptionPage;
namespace Ui {
class SettingsDialog;
}
class QT_UTILITIES_EXPORT SettingsDialog : public QDialog {
Q_OBJECT
Q_PROPERTY(bool tabBarAlwaysVisible READ isTabBarAlwaysVisible WRITE setTabBarAlwaysVisible)
public:
explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog() override;
bool isTabBarAlwaysVisible() const;
void setTabBarAlwaysVisible(bool value);
OptionCategoryModel *categoryModel();
OptionCategory *category(int categoryIndex) const;
OptionPage *page(int categoryIndex, int pageIndex) const;
void showCategory(OptionCategory *category);
void setSingleCategory(OptionCategory *singleCategory);
Q_SIGNALS:
void applied();
void resetted();
protected:
void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void currentCategoryChanged(const QModelIndex &index);
void updateTabWidget();
bool apply();
void reset();
private:
std::unique_ptr<Ui::SettingsDialog> m_ui;
OptionCategoryModel *m_categoryModel;
OptionCategoryFilterModel *m_categoryFilterModel;
OptionCategory *m_currentCategory;
bool m_tabBarAlwaysVisible;
};
/*!
* \brief Returns whether the tab bar is always visible.
*
* The tab bar is always visible by default.
*
* \sa SettingsDialog::setTabBarAlwaysVisible()
*/
inline bool SettingsDialog::isTabBarAlwaysVisible() const
{
return m_tabBarAlwaysVisible;
}
/*!
* \brief Returns the category model used by the settings dialog to manage the
* categories.
*/
inline OptionCategoryModel *SettingsDialog::categoryModel()
{
return m_categoryModel;
}
} // namespace QtUtilities
#endif // DIALOGS_SETTINGSDIALOG_H
|
#ifndef OBJECT_H_
#define OBJECT_H_
#include "Config.h"
#include "IDGenerator.h"
#include <string>
namespace buf
{
// FIXME: key_generator may be used in different threads
// XXX: only has id, id may be std::string
template <typename KG = IDGenerator >
class Object
{
public:
typedef KG key_generator;
typedef typename key_generator::key_type key_type;
public:
Object(const key_type& id) : _id(id) {}
virtual ~Object() {}
inline const key_type& id() const { return _id; }
inline key_type& id() { return _id; }
protected:
key_type _id;
};
// XXX: has id but also name
template <typename KG = IDGenerator >
class ObjectN : public Object<KG>
{
public:
typedef KG key_generator;
typedef typename key_generator::key_type key_type;
typedef std::string name_type;
public:
ObjectN(const key_type& id, const name_type& name)
: Object<key_generator>(id), _name(name) {}
virtual ~ObjectN() {}
inline const name_type& name() const { return _name; }
protected:
name_type _name;
};
// XXX: has id and tempid
template <typename KG = IDGenerator, typename TG = IDGenerator >
class ObjectT : public Object<KG>
{
public:
typedef KG key_generator;
typedef TG temp_generator;
typedef typename key_generator::key_type key_type;
typedef typename temp_generator::key_type temp_type;
public:
ObjectT(const key_type& id, const temp_type& tempid)
: Object<key_generator>(id), _tempid(tempid) {}
virtual ~ObjectT() {}
inline const temp_type& tempid() const { return _tempid; }
inline temp_type& tempid() { return _tempid; }
private:
temp_type _tempid;
};
// XXX: has id,name and tempid
template <typename KG = IDGenerator, typename TG = IDGenerator >
class ObjectNT : public Object<KG>
{
public:
typedef KG key_generator;
typedef TG temp_generator;
typedef typename key_generator::key_type key_type;
typedef typename temp_generator::key_type temp_type;
typedef std::string name_type;
public:
ObjectNT(const key_type& id, const name_type& name, const temp_type& tempid)
: Object<key_generator>(id), _tempid(tempid), _name(name) {}
virtual ~ObjectNT() {}
inline const name_type& name() const { return _name; }
inline const temp_type& tempid() const { return _tempid; }
inline temp_type& tempid() { return _tempid; }
private:
temp_type _tempid;
name_type _name;
};
// Create functions
#ifdef __APPLE__
template <typename T>
#else
template <typename T = Object<> >
#endif
static T* Create()
{
typedef typename T::key_generator key_generator;
typedef typename key_generator::key_type key_type;
// XXX: different key_generator will create different key
// XXX: return 0 when _KG is out of key
static key_generator kg;
key_type id = kg.get();
if (id == kg.max())
return 0;
T* obj = BUFNEW T(id);
return obj;
}
#ifdef __APPLE__
template <typename T>
#else
template <typename T = ObjectN<> >
#endif
static T* CreateN(const std::string& name)
{
typedef typename T::key_generator key_generator;
typedef typename key_generator::key_type key_type;
typedef typename T::name_type name_type;
static key_generator kg;
key_type id = kg.get();
if (id == kg.max())
return 0;
T* obj = BUFNEW T(id, name);
return obj;
}
#ifdef __APPLE__
template <typename T>
#else
template <typename T = ObjectT<> >
#endif
static T* CreateT()
{
typedef typename T::key_generator key_generator;
typedef typename key_generator::key_type key_type;
typedef typename T::temp_generator temp_generator;
typedef typename temp_generator::key_type temp_type;
static key_generator kg;
static temp_generator tg;
key_generator id = kg.get();
if (id == kg.max())
return 0;
temp_generator tid = tg.get();
if (tid == tg.max())
return 0;
T* obj = BUFNEW T(id, tid);
return obj;
}
#ifdef __APPLE__
template <typename T>
#else
template <typename T = ObjectNT<> >
#endif
static T* CreateNT(const std::string& name)
{
typedef typename T::key_generator key_generator;
typedef typename key_generator::key_type key_type;
typedef typename T::name_type name_type;
typedef typename T::temp_generator temp_generator;
typedef typename temp_generator::key_type temp_type;
static key_generator kg;
static temp_generator tg;
key_type id = kg.get();
if (id == kg.max())
return 0;
temp_type tid = tg.get();
if (tid == tg.max())
return 0;
T* obj = BUFNEW T(id, name, tid);
return obj;
}
} // namespace buf
#endif // OBJECT_H_
/* vim: set ai si nu sm smd hls is ts=4 sm=4 bs=indent,eol,start */
|
/*
* Milkymist VJ SoC (Software)
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU 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 __HW_SYSCTL_H
#define __HW_SYSCTL_H
#define CSR_REG(x) ((void __iomem *)(x))
#define CSR_GPIO_IN CSR_REG(0xe0001000)
#define CSR_GPIO_OUT CSR_REG(0xe0001004)
#define CSR_GPIO_INTEN CSR_REG(0xe0001008)
#define CSR_TIMER0_CONTROL CSR_REG(0xe0001010)
#define CSR_TIMER0_COMPARE CSR_REG(0xe0001014)
#define CSR_TIMER0_COUNTER CSR_REG(0xe0001018)
#define CSR_TIMER1_CONTROL CSR_REG(0xe0001020)
#define CSR_TIMER1_COMPARE CSR_REG(0xe0001024)
#define CSR_TIMER1_COUNTER CSR_REG(0xe0001028)
#define CSR_TIMER(id, reg) CSR_REG(0xe0001010 + (0x10 * (id)) + (reg))
#define CSR_TIMER_CONTROL(id) CSR_TIMER(id, 0x0)
#define CSR_TIMER_COMPARE(id) CSR_TIMER(id, 0x4)
#define CSR_TIMER_COUNTER(id) CSR_TIMER(id, 0x8)
#define TIMER_ENABLE (0x01)
#define TIMER_AUTORESTART (0x02)
#define CSR_ICAP CSR_REG(0xe0001034)
#define ICAP_READY (0x01)
#define ICAP_CE (0x10000)
#define ICAP_WRITE (0x20000)
#define CSR_CAPABILITIES CSR_REG(0xe0001038)
#define CSR_SYSTEM_ID CSR_REG(0xe000103c)
#endif /* __HW_SYSCTL_H */
|
/*
* Copyright (C) 2016 Matt Kilgore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License v2 as published by the
* Free Software Foundation.
*/
#include <protura/types.h>
#include <protura/debug.h>
#include <protura/string.h>
#include <protura/list.h>
#include <protura/mutex.h>
#include <protura/mm/kmalloc.h>
#include <protura/mm/user_check.h>
#include <arch/spinlock.h>
#include <protura/block/bcache.h>
#include <protura/fs/char.h>
#include <protura/fs/stat.h>
#include <protura/fs/file.h>
#include <protura/fs/inode.h>
#include <protura/fs/file_system.h>
#include <protura/fs/vfs.h>
#include <protura/fs/procfs.h>
#include "procfs_internal.h"
static int procfs_file_read(struct file *filp, struct user_buffer buf, size_t size)
{
struct procfs_inode *pinode = container_of(filp->inode, struct procfs_inode, i);
struct procfs_node *node = pinode->node;
struct procfs_entry *entry = container_of(node, struct procfs_entry, node);
void *p;
size_t data_len, cpysize = 0;
int ret;
pinode->i.atime = protura_current_time_get();
if (entry->ops->read)
return (entry->ops->read) (filp, buf, size);
if (filp->offset > 0)
return 0;
if (!entry->ops->readpage)
return 0;
p = palloc_va(0, PAL_KERNEL);
if (!p)
return -ENOMEM;
ret = (entry->ops->readpage) (p, PG_SIZE, &data_len);
kp(KP_TRACE, "procfs output len: %d\n", data_len);
if (!ret) {
cpysize = (data_len > size)? size: data_len;
ret = user_memcpy_from_kernel(buf, p, cpysize);
}
pfree_va(p, 0);
if (ret) {
return ret;
} else {
filp->offset = cpysize;
return cpysize;
}
}
static int procfs_file_ioctl(struct file *filp, int cmd, struct user_buffer ptr)
{
struct procfs_inode *pinode = container_of(filp->inode, struct procfs_inode, i);
struct procfs_node *node = pinode->node;
struct procfs_entry *entry = container_of(node, struct procfs_entry, node);
if (entry->ops->ioctl)
return (entry->ops->ioctl) (filp, cmd, ptr);
return -EINVAL;
}
struct file_ops procfs_file_file_ops = {
.read = procfs_file_read,
.ioctl = procfs_file_ioctl,
};
struct inode_ops procfs_file_inode_ops = {
/* We have nothing to implement */
};
|
/*
* Copyright 2000-2015 Rochus Keller <mailto:rkeller@nmr.ch>
*
* This file is part of the CARA (Computer Aided Resonance Assignment,
* see <http://cara.nmr.ch/>) NMR Application Framework (NAF) library.
*
* The following is the license that applies to this copy of the
* library. For a license to use the library under conditions
* other than those described here, please email to rkeller@nmr.ch.
*
* GNU General Public License Usage
* This file may be used under the terms of the GNU General Public
* License (GPL) versions 2.0 or 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in
* the packaging of this file. Please review the following information
* to ensure GNU General Public Licensing requirements will be met:
* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
* http://www.gnu.org/copyleft/gpl.html.
*/
#if !defined(_QTL_TIME)
#define _QTL_TIME
typedef struct lua_State lua_State;
namespace Qtl
{
class Time
{
public:
// static int fromString ( const QString &, Qt::DateFormat ) : QTime
static int fromString(lua_State * L); // ( const QString &, const QString & ) : QTime
static int currentTime(lua_State * L); // () : QTime
// static int isValid ( int, int, int, int ) : bool
static int addMSecs(lua_State * L); // ( int ) const : QTime
static int addSecs(lua_State * L); // ( int ) const : QTime
static int elapsed(lua_State * L); // () const : int
static int hour(lua_State * L); // () const : int
static int isNull(lua_State * L); // () const : bool
static int isValid(lua_State * L); // () const : bool
static int minute(lua_State * L); // () const : int
static int msec(lua_State * L); // () const : int
static int msecsTo(lua_State * L); // ( const QTime & ) const : int
static int restart(lua_State * L); // () : int
static int second(lua_State * L); // () const : int
static int secsTo(lua_State * L); // ( const QTime & ) const : int
static int setHMS(lua_State * L); // ( int, int, int, int ) : bool
static int start(lua_State * L); // ()
// static int toString ( const QString & ) const : QString
static int toString(lua_State * L); // ( Qt::DateFormat ) const : QString
static int init(lua_State * L);
static int __eq(lua_State * L);
static int __lt(lua_State * L);
static void install(lua_State * L);
};
}
#endif // !defined(_QTL_TIME)
|
#include "Click_7x10_R_types.h"
const uint32_t _C7X10R_SPI_CFG[ 2 ] =
{
_SPI_FPCLK_DIV2,
_SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_CLK_IDLE_LOW |
_SPI_MASTER |
_SPI_MSB_FIRST |
_SPI_8_BIT |
_SPI_SSM_ENABLE |
_SPI_SS_DISABLE |
_SPI_SSI_1
};
|
/*
Copyright (c) 2007, 2009 Volker Krause <vkrause@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 AKONADI_COLLECTIONSYNC_P_H
#define AKONADI_COLLECTIONSYNC_P_H
#include <akonadi/collection.h>
#include <akonadi/transactionsequence.h>
namespace Akonadi {
/**
@internal
Syncs remote and local collections.
Basic terminology:
- "local": The current state in the Akonadi server
- "remote": The state in the backend, which is also the state the Akonadi
server is supposed to have afterwards.
There are three options to influence the way syncing is done:
- Streaming vs. complete delivery: If streaming is enabled remote collections
do not need to be delivered in a single batch but can be delivered in multiple
chunks. This improves performance but requires an explicit notification
when delivery has been completed.
- Incremental vs. non-incremental: In the incremental case only remote changes
since the last sync have to be delivered, in the non-incremental mode the full
remote state has to be provided. The first is obviously the preferred way,
but requires support by the backend.
- Hierarchical vs. global RIDs: The first requires RIDs to be unique per parent
collection, the second one requires globally unique RIDs (per resource). Those
have different advantages and disadvantages, esp. regarding moving. Which one
to chose mostly depends on what the backend provides in this regard.
*/
class CollectionSync : public Job
{
Q_OBJECT
public:
/**
Creates a new collection synchronzier.
@param resourceId The identifier of the resource we are syncing.
@param parent The parent object.
*/
explicit CollectionSync(const QString &resourceId, QObject *parent = 0);
/**
Destroys this job.
*/
~CollectionSync();
/**
Sets the result of a full remote collection listing.
@param remoteCollections A list of collections.
Important: All of these need a unique remote identifier and parent remote
identifier.
*/
void setRemoteCollections(const Collection::List &remoteCollections);
/**
Sets the result of an incremental remote collection listing.
@param changedCollections A list of remotely added or changed collections.
@param removedCollections A list of remotely deleted collections.
*/
void setRemoteCollections(const Collection::List &changedCollections,
const Collection::List &removedCollections);
/**
Enables streaming, that is not all collections are delivered at once.
Use setRemoteCollections() multiple times when streaming is enabled and call
retrievalDone() when all collections have been retrieved.
Must be called before the first call to setRemoteCollections().
@param streaming enables streaming if set as @c true
*/
void setStreamingEnabled(bool streaming);
/**
Indicate that all collections have been retrieved in streaming mode.
*/
void retrievalDone();
/**
Indicate whether the resource supplies collections with hierarchical or
global remote identifiers. @c false by default.
Must be called before the first call to setRemoteCollections().
@param hierarchical @c true if collection remote IDs are relative to their parents' remote IDs
*/
void setHierarchicalRemoteIds(bool hierarchical);
/**
Do a rollback operation if needed. In read only cases this is a noop.
*/
void rollback();
/**
* Allows to specify parts of the collection that should not be changed if locally available.
*
* This is useful for resources to provide default values during the collection sync, while
* preserving more up-to date values if available.
*
* Use CONTENTMIMETYPES as identifier to not overwrite the content mimetypes.
*
* @since 4.14
*/
void setKeepLocalChanges(const QSet<QByteArray> &parts);
protected:
void doStart();
private:
class Private;
Private *const d;
Q_PRIVATE_SLOT(d, void localCollectionsReceived(const Akonadi::Collection::List &localCols))
Q_PRIVATE_SLOT(d, void localCollectionFetchResult(KJob *job))
Q_PRIVATE_SLOT(d, void updateLocalCollectionResult(KJob *job))
Q_PRIVATE_SLOT(d, void createLocalCollectionResult(KJob *job))
Q_PRIVATE_SLOT(d, void deleteLocalCollectionsResult(KJob *job))
Q_PRIVATE_SLOT(d, void transactionSequenceResult(KJob *job))
};
}
#endif
|
/*
* SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int, flags)
*/
#include <errno.h>
#include "maps.h"
#include "sanitise.h"
#include "trinity.h"
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
static void sanitise_getrandom(__unused__ struct syscallrecord *rec)
{
(void) common_set_mmap_ptr_len();
}
static unsigned long getrandom_flags[] = {
GRND_NONBLOCK, GRND_RANDOM,
};
struct syscallentry syscall_getrandom = {
.name = "getrandom",
.num_args = 3,
.arg1name = "buf",
.arg1type = ARG_MMAP,
.arg2name = "count",
.arg3name = "flags",
.arg3type = ARG_LIST,
.arg3list = ARGLIST(getrandom_flags),
.sanitise = sanitise_getrandom,
};
|
#include <linux/blkdev.h>
/* hm. sometimes this pragma is ignored :(
* use BUILD_BUG_ON instead.
#pragma GCC diagnostic warning "-Werror"
*/
/* in Commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f (between Linux-3.1 and 3.2)
make_request() becomes type void. Before it had type int.
*/
void drbd_make_request(struct request_queue *q, struct bio *bio)
{
}
void foo(void)
{
BUILD_BUG_ON(!(__same_type(&drbd_make_request, make_request_fn)));
}
|
/*
* atmel-pcm.c -- ALSA PCM interface for the Atmel atmel SoC.
*
* Copyright (C) 2005 SAN People
* Copyright (C) 2008 Atmel
*
* Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com>
*
* Based on at91-pcm. by:
* Frank Mandarino <fmandarino@endrelia.com>
* Copyright 2006 Endrelia Technologies Inc.
*
* Based on pxa2xx-pcm.c by:
*
* Author: Nicolas Pitre
* Created: Nov 30, 2004
* Copyright: (C) 2004 MontaVista Software, 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 Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include "atmel-pcm.h"
static int atmel_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
int stream)
{
struct snd_pcm_substream *substream = pcm->streams[stream].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer;
size_t size = ATMEL_SSC_DMABUF_SIZE;
buf->dev.type = SNDRV_DMA_TYPE_DEV;
buf->dev.dev = pcm->card->dev;
buf->private_data = NULL;
buf->area = dma_alloc_coherent(pcm->card->dev, size,
&buf->addr, GFP_KERNEL);
pr_debug("atmel-pcm: alloc dma buffer: area=%p, addr=%p, size=%zu\n",
(void *)buf->area, (void *)buf->addr, size);
if (!buf->area)
return -ENOMEM;
buf->bytes = size;
return 0;
}
int atmel_pcm_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma)
{
return remap_pfn_range(vma, vma->vm_start,
substream->dma_buffer.addr >> PAGE_SHIFT,
vma->vm_end - vma->vm_start, vma->vm_page_prot);
}
EXPORT_SYMBOL_GPL(atmel_pcm_mmap);
static u64 atmel_pcm_dmamask = DMA_BIT_MASK(32);
int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm;
int ret = 0;
if (!card->dev->dma_mask)
card->dev->dma_mask = &atmel_pcm_dmamask;
if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
pr_debug("atmel-pcm: allocating PCM playback DMA buffer\n");
ret = atmel_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK);
if (ret)
goto out;
}
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
pr_debug("atmel-pcm: allocating PCM capture DMA buffer\n");
ret = atmel_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE);
if (ret)
goto out;
}
out:
return ret;
}
EXPORT_SYMBOL_GPL(atmel_pcm_new);
void atmel_pcm_free(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
for (stream = 0; stream < 2; stream++) {
substream = pcm->streams[stream].substream;
if (!substream)
continue;
buf = &substream->dma_buffer;
if (!buf->area)
continue;
dma_free_coherent(pcm->card->dev, buf->bytes,
buf->area, buf->addr);
buf->area = NULL;
}
}
EXPORT_SYMBOL_GPL(atmel_pcm_free);
|
/*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Sun Microsystems nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* This file contains support for handling frames, or (method,location) pairs. */
#include "hprof.h"
/*
* Frames map 1-to-1 to (methodID,location) pairs.
* When no line number is known, -1 should be used.
*
* Frames are mostly used in traces (see hprof_trace.c) and will be marked
* with their status flag as they are written out to the hprof output file.
*
*/
enum LinenoState {
LINENUM_UNINITIALIZED = 0,
LINENUM_AVAILABLE = 1,
LINENUM_UNAVAILABLE = 2
};
typedef struct FrameKey {
jmethodID method;
jlocation location;
} FrameKey;
typedef struct FrameInfo {
unsigned short lineno;
unsigned char lineno_state; /* LinenoState */
unsigned char status;
SerialNumber serial_num;
} FrameInfo;
static FrameKey*
get_pkey(FrameIndex index)
{
void *key_ptr;
int key_len;
table_get_key(gdata->frame_table, index, &key_ptr, &key_len);
HPROF_ASSERT(key_len==sizeof(FrameKey));
HPROF_ASSERT(key_ptr!=NULL);
return (FrameKey*)key_ptr;
}
static FrameInfo *
get_info(FrameIndex index)
{
FrameInfo *info;
info = (FrameInfo*)table_get_info(gdata->frame_table, index);
return info;
}
static void
list_item(TableIndex i, void *key_ptr, int key_len, void *info_ptr, void *arg)
{
FrameKey key;
FrameInfo *info;
HPROF_ASSERT(key_ptr!=NULL);
HPROF_ASSERT(key_len==sizeof(FrameKey));
HPROF_ASSERT(info_ptr!=NULL);
key = *((FrameKey*)key_ptr);
info = (FrameInfo*)info_ptr;
debug_message(
"Frame 0x%08x: method=%p, location=%d, lineno=%d(%d), status=%d \n",
i, (void*)key.method, (jint)key.location,
info->lineno, info->lineno_state, info->status);
}
void
frame_init(void)
{
gdata->frame_table = table_initialize("Frame",
1024, 1024, 1023, (int)sizeof(FrameInfo));
}
FrameIndex
frame_find_or_create(jmethodID method, jlocation location)
{
FrameIndex index;
static FrameKey empty_key;
FrameKey key;
jboolean new_one;
key = empty_key;
key.method = method;
key.location = location;
new_one = JNI_FALSE;
index = table_find_or_create_entry(gdata->frame_table,
&key, (int)sizeof(key), &new_one, NULL);
if ( new_one ) {
FrameInfo *info;
info = get_info(index);
info->lineno_state = LINENUM_UNINITIALIZED;
if ( location < 0 ) {
info->lineno_state = LINENUM_UNAVAILABLE;
}
info->serial_num = gdata->frame_serial_number_counter++;
}
return index;
}
void
frame_list(void)
{
debug_message(
"--------------------- Frame Table ------------------------\n");
table_walk_items(gdata->frame_table, &list_item, NULL);
debug_message(
"----------------------------------------------------------\n");
}
void
frame_cleanup(void)
{
table_cleanup(gdata->frame_table, NULL, NULL);
gdata->frame_table = NULL;
}
void
frame_set_status(FrameIndex index, jint status)
{
FrameInfo *info;
info = get_info(index);
info->status = (unsigned char)status;
}
void
frame_get_location(FrameIndex index, SerialNumber *pserial_num,
jmethodID *pmethod, jlocation *plocation, jint *plineno)
{
FrameKey *pkey;
FrameInfo *info;
jint lineno;
pkey = get_pkey(index);
*pmethod = pkey->method;
*plocation = pkey->location;
info = get_info(index);
lineno = (jint)info->lineno;
if ( info->lineno_state == LINENUM_UNINITIALIZED ) {
info->lineno_state = LINENUM_UNAVAILABLE;
if ( gdata->lineno_in_traces ) {
if ( pkey->location >= 0 && !isMethodNative(pkey->method) ) {
lineno = getLineNumber(pkey->method, pkey->location);
if ( lineno >= 0 ) {
info->lineno = (unsigned short)lineno; /* save it */
info->lineno_state = LINENUM_AVAILABLE;
}
}
}
}
if ( info->lineno_state == LINENUM_UNAVAILABLE ) {
lineno = -1;
}
*plineno = lineno;
*pserial_num = info->serial_num;
}
jint
frame_get_status(FrameIndex index)
{
FrameInfo *info;
info = get_info(index);
return (jint)info->status;
}
|
/**
@file system_ADUCRF101.h
@brief: CMSIS Cortex-M3 Device Peripheral Access Layer Header File
for the ADuCRF101
@version v0.2
@author PAD CSE group
@date March 09th 2012
@section disclaimer Disclaimer
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES INC. ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE
DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES INC. BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
YOU ASSUME ANY AND ALL RISK FROM THE USE OF THIS CODE OR SUPPORT FILE.
IT IS THE RESPONSIBILITY OF THE PERSON INTEGRATING THIS CODE INTO AN APPLICATION
TO ENSURE THAT THE RESULTING APPLICATION PERFORMS AS REQUIRED AND IS SAFE.
**/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup aducrf101_system
* @{
*/
#ifndef __SYSTEM_ADUCRF101_H__
#define __SYSTEM_ADUCRF101_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize the system
*
* @param none
* @return none
*
* Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
/**
* @brief Update internal SystemCoreClock variable
*
* @param none
* @return none
*
* Updates the internal SystemCoreClock with current core
* Clock retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
/**
* @brief Sets the system external clock frequency
*
* @param ExtClkFreq External clock frequency in Hz
* @return none
*
* Sets the clock frequency of the source connected to P0.5 clock input source
*/
extern void SetSystemExtClkFreq (uint32_t ExtClkFreq);
/**
* @brief Gets the system external clock frequency
*
* @return External Clock frequency
*
* Gets the clock frequency of the source connected to P0.5 clock input source
*/
extern uint32_t GetSystemExtClkFreq (void);
#ifdef __cplusplus
}
#endif
#endif /* __SYSTEM_ADUCRF101_H__ */
/**
* @}
*/
/**
* @}
*/
|
/***************************************************************************
qgsvectorlayerdiagramprovider.h
--------------------------------------
Date : September 2015
Copyright : (C) 2015 by Martin Dobias
Email : wonder dot sk at gmail dot 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. *
* *
***************************************************************************/
#ifndef QGSVECTORLAYERDIAGRAMPROVIDER_H
#define QGSVECTORLAYERDIAGRAMPROVIDER_H
#define SIP_NO_FILE
#include "qgis_core.h"
#include "qgslabelingengine.h"
#include "qgslabelfeature.h"
#include "qgsdiagramrenderer.h"
/**
* \ingroup core
* Class that adds extra information to QgsLabelFeature for labeling of diagrams
*
* \note this class is not a part of public API yet. See notes in QgsLabelingEngine
* \note not available in Python bindings
*/
class QgsDiagramLabelFeature : public QgsLabelFeature
{
public:
//! Create label feature, takes ownership of the geometry instance
QgsDiagramLabelFeature( QgsFeatureId id, geos::unique_ptr geometry, QSizeF size )
: QgsLabelFeature( id, std::move( geometry ), size ) {}
//! Store feature's attributes - used for rendering of diagrams
void setAttributes( const QgsAttributes &attrs ) { mAttributes = attrs; }
//! Gets feature's attributes - used for rendering of diagrams
const QgsAttributes &attributes() { return mAttributes; }
protected:
//! Stores attribute values for diagram rendering
QgsAttributes mAttributes;
};
class QgsAbstractFeatureSource;
/**
* \ingroup core
* \brief The QgsVectorLayerDiagramProvider class implements support for diagrams within
* the labeling engine. Parameters for the diagrams are taken from the layer settings.
*
* \note this class is not a part of public API yet. See notes in QgsLabelingEngine
* \note not available in Python bindings
* \since QGIS 2.12
*/
class CORE_EXPORT QgsVectorLayerDiagramProvider : public QgsAbstractLabelProvider
{
public:
//! Convenience constructor to initialize the provider from given vector layer
explicit QgsVectorLayerDiagramProvider( QgsVectorLayer *layer, bool ownFeatureLoop = true );
//! Clean up
~QgsVectorLayerDiagramProvider() override;
QList<QgsLabelFeature *> labelFeatures( QgsRenderContext &context ) override;
void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;
// new virtual methods
/**
* Prepare for registration of features. Must be called after provider has been added to engine (uses its map settings)
* \param context render context.
* \param attributeNames list of attribute names to which additional required attributes shall be added
* \returns Whether the preparation was successful - if not, the provider shall not be used
*/
virtual bool prepare( const QgsRenderContext &context, QSet<QString> &attributeNames );
/**
* Register a feature for labeling as one or more QgsLabelFeature objects stored into mFeatures
*
* \param feature feature for diagram
* \param context render context. The QgsExpressionContext contained within the render context
* must have already had the feature and fields sets prior to calling this method.
* \param obstacleGeometry optional obstacle geometry, if a different geometry to the feature's geometry
* should be used as an obstacle for labels (e.g., if the feature has been rendered with an offset point
* symbol, the obstacle geometry should represent the bounds of the offset symbol). If not set,
* the feature's original geometry will be used as an obstacle for labels. Ownership of obstacleGeometry
* is transferred.
*/
virtual void registerFeature( QgsFeature &feature, QgsRenderContext &context, const QgsGeometry &obstacleGeometry = QgsGeometry() );
protected:
//! initialization method - called from constructors
void init();
//! helper method to register one diagram feautre
QgsLabelFeature *registerDiagram( QgsFeature &feat, QgsRenderContext &context, const QgsGeometry &obstacleGeometry = QgsGeometry() );
protected:
//! Diagram layer settings
QgsDiagramLayerSettings mSettings;
//! Diagram renderer instance (owned by mSettings)
QgsDiagramRenderer *mDiagRenderer = nullptr;
// these are needed only if using own renderer loop
//! Layer's fields
QgsFields mFields;
//! Layer's CRS
QgsCoordinateReferenceSystem mLayerCrs;
//! Layer's feature source
QgsAbstractFeatureSource *mSource = nullptr;
//! Whether layer's feature source is owned
bool mOwnsSource;
//! List of generated label features (owned by the provider)
QList<QgsLabelFeature *> mFeatures;
};
#endif // QGSVECTORLAYERDIAGRAMPROVIDER_H
|
/*
randompool.c
(P)RNG, relies on system /dev/random to get the data.
Copyright:
Copyright (c) 2002, 2003 SFNT Finland Oy.
All rights reserved.
*/
#include "sshincludes.h"
#include "sshcrypt.h"
#include "sshcrypt_i.h"
#include "sshrandom_i.h"
#define SSH_DEBUG_MODULE "SshRandomPool"
typedef struct SshRandomPoolStateRec {
/* Pool buffer, allocated memory */
unsigned char *pool;
/* Current read offset to pool */
size_t pool_offset;
/* Length of the pool true data. (offset + len) is the end of valid
data, where offset is the start of valid data - thus between
add_entropy (offset + len) is a constant.*/
size_t pool_len;
/* Size of the pool */
size_t pool_size;
} *SshRandomPoolState, SshRandomPoolStateStruct;
static SshCryptoStatus
ssh_random_pool_get_bytes(void *context, unsigned char *buf, size_t buflen)
{
SshRandomPoolState state = (SshRandomPoolState) context;
SSH_DEBUG(5, ("Reading, offset=%d len=%d size=%d buflen=%d",
state->pool_offset, state->pool_len, state->pool_size,
buflen));
/* See if we can satisfy `buflen' bytes from the pool */
if (state->pool_len < buflen)
return SSH_CRYPTO_DATA_TOO_LONG;
SSH_ASSERT(state->pool_len >= buflen);
memcpy(buf, state->pool + state->pool_offset, buflen);
state->pool_len -= buflen;
state->pool_offset += buflen;
SSH_ASSERT(state->pool_offset + state->pool_len <= state->pool_size);
/* Request more random noise when the pool length is less than 1/4
of the pool size. */
if (4 * state->pool_len <= state->pool_size)
ssh_crypto_library_request_noise();
return SSH_CRYPTO_OK;
}
static SshCryptoStatus
ssh_random_pool_add_entropy(void *context,
const unsigned char *buf, size_t buflen,
size_t estimated_entropy_bits)
{
SshRandomPoolState state = (SshRandomPoolState) context;
SSH_DEBUG(5, ("Adding entropy, offset=%d len=%d size=%d buflen=%d",
state->pool_offset, state->pool_len, state->pool_size,
buflen));
/* Check if we can put `buflen' bytes into end of current pool */
if (state->pool_size - (state->pool_offset + state->pool_len) < buflen)
{
size_t new_size;
unsigned char *new_pool;
/* No - do two things: allocate compact buffer */
new_size = state->pool_len + buflen;
if ((new_pool = ssh_malloc(new_size)) == NULL)
return SSH_CRYPTO_NO_MEMORY;
memcpy(new_pool, state->pool + state->pool_offset, state->pool_len);
ssh_free(state->pool);
state->pool = new_pool;
state->pool_offset = 0;
state->pool_size = new_size;
}
SSH_ASSERT(state->pool_size - state->pool_len >= buflen);
/* Yeah, we have enough space at the end */
memcpy(state->pool + state->pool_len, buf, buflen);
state->pool_len += buflen;
SSH_ASSERT((state->pool_offset + state->pool_len) <= state->pool_size);
return SSH_CRYPTO_OK;
}
static SshCryptoStatus
ssh_random_pool_init(void **context_ret)
{
SshRandomPoolState state;
if (!(state = ssh_calloc(1, sizeof(*state))))
return SSH_CRYPTO_NO_MEMORY;
state->pool_offset = state->pool_len = state->pool_size = 0;
state->pool = NULL;
*context_ret = state;
return SSH_CRYPTO_OK;
}
static void
ssh_random_pool_uninit(void *context)
{
SshRandomPoolState state = (SshRandomPoolState) context;
ssh_free(state->pool);
ssh_free(state);
}
const SshRandomDefStruct ssh_random_pool = {
"pool",
0,
ssh_random_pool_init, ssh_random_pool_uninit,
ssh_random_pool_add_entropy, ssh_random_pool_get_bytes
};
/* Internal (but not static) function */
SshCryptoStatus
ssh_random_pool_get_length(SshRandom handle, size_t *size_ret)
{
SshRandomPoolState state;
SshRandomObject random;
if (!(random = SSH_CRYPTO_HANDLE_TO_RANDOM(handle)))
return SSH_CRYPTO_HANDLE_INVALID;
if (random->ops != &ssh_random_pool)
return SSH_CRYPTO_UNSUPPORTED;
state = (SshRandomPoolState) random->context;
*size_ret = state->pool_len;
return SSH_CRYPTO_OK;
}
|
#ifndef __CUSTOM_HEURISTIC_H_
#define __CUSTOM_HEURISTIC_H_
int apply_custom_fit(void);
#endif
|
/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
#define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
#include "backends/graphics/sdl/resvm-sdl-graphics.h"
/**
* SDL Surface based graphics manager
*
* Used when rendering the launcher, or games with TinyGL
*/
class SurfaceSdlGraphicsManager : public ResVmSdlGraphicsManager {
public:
SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window, const Capabilities &capabilities);
virtual ~SurfaceSdlGraphicsManager();
// GraphicsManager API - Features
virtual bool hasFeature(OSystem::Feature f) override;
// GraphicsManager API - Graphics mode
virtual void setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) override;
virtual Graphics::PixelBuffer getScreenPixelBuffer() override;
virtual int16 getHeight() override;
virtual int16 getWidth() override;
// GraphicsManager API - Draw methods
virtual void updateScreen() override;
// GraphicsManager API - Overlay
virtual void showOverlay() override;
virtual void hideOverlay() override;
virtual void clearOverlay() override;
virtual void grabOverlay(void *buf, int pitch) override;
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
/* Render the passed Surfaces besides the game texture.
* This is used for widescreen support in the Grim engine.
* Note: we must copy the Surfaces, as they are free()d after this call.
*/
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override;
// GraphicsManager API - Mouse
virtual void warpMouse(int x, int y) override;
// SdlGraphicsManager API
virtual void transformMouseCoordinates(Common::Point &point) override;
protected:
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Renderer *_renderer;
SDL_Texture *_screenTexture;
void deinitializeRenderer();
SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);
#endif
SDL_Surface *_screen;
SDL_Surface *_subScreen;
SDL_Surface *_overlayscreen;
bool _overlayDirty;
Math::Rect2d _gameRect;
SDL_Surface *_sideSurfaces[2];
void drawOverlay();
void drawSideTextures();
void closeOverlay();
};
#endif
|
/*
** FamiTracker - NES/Famicom sound tracker
** Copyright (C) 2005-2014 Jonathan Liss
**
** 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. To obtain a
** copy of the GNU Library General Public License, write to the Free
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Any permitted reproduction of these routines, in whole or in part,
** must bear this legend.
*/
#pragma once
//
// Text chunk renderer
//
class CChunkRenderText;
typedef void (CChunkRenderText::*renderFunc_t)(CChunk *pChunk, CFile *pFile);
struct stChunkRenderFunc {
chunk_type_t type;
renderFunc_t function;
};
class CChunkRenderText
{
public:
CChunkRenderText(CFile *pFile);
void StoreChunks(const std::vector<CChunk*> &Chunks);
// // //
private:
static const stChunkRenderFunc RENDER_FUNCTIONS[];
private:
void DumpStrings(const CStringA &preStr, const CStringA &postStr, CStringArray &stringArray, CFile *pFile) const;
void WriteFileString(const CStringA &str, CFile *pFile) const;
void StoreByteString(const char *pData, int Len, CStringA &str, int LineBreak) const;
void StoreByteString(const CChunk *pChunk, CStringA &str, int LineBreak) const;
private:
void StoreHeaderChunk(CChunk *pChunk, CFile *pFile);
void StoreInstrumentListChunk(CChunk *pChunk, CFile *pFile);
void StoreInstrumentChunk(CChunk *pChunk, CFile *pFile);
void StoreSequenceChunk(CChunk *pChunk, CFile *pFile);
// // //
void StoreSongListChunk(CChunk *pChunk, CFile *pFile);
void StoreSongChunk(CChunk *pChunk, CFile *pFile);
void StoreFrameListChunk(CChunk *pChunk, CFile *pFile);
void StoreFrameChunk(CChunk *pChunk, CFile *pFile);
void StorePatternChunk(CChunk *pChunk, CFile *pFile);
// // //
private:
CStringArray m_headerStrings;
CStringArray m_instrumentListStrings;
CStringArray m_instrumentStrings;
CStringArray m_sequenceStrings;
// // //
CStringArray m_songListStrings;
CStringArray m_songStrings;
CStringArray m_songDataStrings;
// // //
CFile *m_pFile;
};
|
#undef CONFIG_SENSORS_SIS5595
|
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRANSPORTS_H
#define TRANSPORTS_H
#include "GameObject.h"
#include <map>
#include <set>
#include <string>
class TransportPath
{
public:
struct PathNode
{
uint32 mapid;
float x,y,z;
uint32 actionFlag;
uint32 delay;
};
void SetLength(const unsigned int sz)
{
i_nodes.resize(sz);
}
unsigned int Size(void) const { return i_nodes.size(); }
bool Empty(void) const { return i_nodes.empty(); }
void Resize(unsigned int sz) { i_nodes.resize(sz); }
void Clear(void) { i_nodes.clear(); }
PathNode* GetNodes(void) { return static_cast<PathNode *>(&i_nodes[0]); }
PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; }
const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; }
protected:
std::vector<PathNode> i_nodes;
};
class Transport : private GameObject
{
public:
explicit Transport();
// prevent using Transports as normal GO, but allow call some inherited functions
using GameObject::IsTransport;
using GameObject::GetEntry;
using GameObject::GetGUID;
using GameObject::GetGUIDLow;
using GameObject::GetMapId;
using GameObject::GetPositionX;
using GameObject::GetPositionY;
using GameObject::GetPositionZ;
using GameObject::BuildCreateUpdateBlockForPlayer;
using GameObject::BuildOutOfRangeUpdateBlock;
bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags);
bool GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids);
void Update(uint32 p_time);
bool AddPassenger(Player* passenger);
bool RemovePassenger(Player* passenger);
void CheckForEvent(uint32 entry, uint32 wp_id);
typedef std::set<Player*> PlayerSet;
PlayerSet const& GetPassengers() const { return m_passengers; }
std::string m_name;
private:
struct WayPoint
{
WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false), id(0) {}
WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _id) :
mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport), id(_id) {}
uint32 mapid;
float x;
float y;
float z;
bool teleport;
uint32 id;
};
typedef std::map<uint32, WayPoint> WayPointMap;
WayPointMap::iterator m_curr;
WayPointMap::iterator m_next;
uint32 m_pathTime;
uint32 m_timer;
PlayerSet m_passengers;
public:
WayPointMap m_WayPoints;
uint32 m_nextNodeTime;
uint32 m_period;
private:
void TeleportTransport(uint32 newMapid, float x, float y, float z);
WayPointMap::iterator GetNextWayPoint();
};
#endif
|
/*
* module.h Interface to the RADIUS module system.
*
* Version: $Id$
*
*/
#ifndef RADIUS_MODULES_H
#define RADIUS_MODULES_H
#include <freeradius-devel/ident.h>
RCSIDH(modules_h, "$Id$")
#include <freeradius-devel/conffile.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*packetmethod)(void *instance, REQUEST *request);
typedef enum rlm_components {
RLM_COMPONENT_AUTH = 0,
RLM_COMPONENT_AUTZ, /* 1 */
RLM_COMPONENT_PREACCT, /* 2 */
RLM_COMPONENT_ACCT, /* 3 */
RLM_COMPONENT_SESS, /* 4 */
RLM_COMPONENT_PRE_PROXY, /* 5 */
RLM_COMPONENT_POST_PROXY, /* 6 */
RLM_COMPONENT_POST_AUTH, /* 7 */
#ifdef WITH_COA
RLM_COMPONENT_RECV_COA, /* 8 */
RLM_COMPONENT_SEND_COA, /* 9 */
#endif
RLM_COMPONENT_COUNT /* 8 / 10: How many components are there */
} rlm_components_t;
typedef struct section_type_value_t {
const char *section;
const char *typename;
int attr;
} section_type_value_t;
extern const section_type_value_t section_type_value[];
#define RLM_TYPE_THREAD_SAFE (0 << 0)
#define RLM_TYPE_THREAD_UNSAFE (1 << 0)
#define RLM_TYPE_CHECK_CONFIG_SAFE (1 << 1)
#define RLM_TYPE_HUP_SAFE (1 << 2)
#define RLM_MODULE_MAGIC_NUMBER ((uint32_t) (0xf4ee4ad3))
#define RLM_MODULE_INIT RLM_MODULE_MAGIC_NUMBER
typedef struct module_t {
uint32_t magic; /* may later be opaque struct */
const char *name;
int type;
int (*instantiate)(CONF_SECTION *mod_cs, void **instance);
int (*detach)(void *instance);
packetmethod methods[RLM_COMPONENT_COUNT];
} module_t;
typedef enum rlm_rcodes {
RLM_MODULE_REJECT, /* immediately reject the request */
RLM_MODULE_FAIL, /* module failed, don't reply */
RLM_MODULE_OK, /* the module is OK, continue */
RLM_MODULE_HANDLED, /* the module handled the request, so stop. */
RLM_MODULE_INVALID, /* the module considers the request invalid. */
RLM_MODULE_USERLOCK, /* reject the request (user is locked out) */
RLM_MODULE_NOTFOUND, /* user not found */
RLM_MODULE_NOOP, /* module succeeded without doing anything */
RLM_MODULE_UPDATED, /* OK (pairs modified) */
RLM_MODULE_NUMCODES /* How many return codes there are */
} rlm_rcodes_t;
int setup_modules(int, CONF_SECTION *);
int detach_modules(void);
int module_hup(CONF_SECTION *modules);
int module_authorize(int type, REQUEST *request);
int module_authenticate(int type, REQUEST *request);
int module_preacct(REQUEST *request);
int module_accounting(int type, REQUEST *request);
int module_checksimul(int type, REQUEST *request, int maxsimul);
int module_pre_proxy(int type, REQUEST *request);
int module_post_proxy(int type, REQUEST *request);
int module_post_auth(int type, REQUEST *request);
#ifdef WITH_COA
int module_recv_coa(int type, REQUEST *request);
int module_send_coa(int type, REQUEST *request);
#define MODULE_NULL_COA_FUNCS ,NULL,NULL
#else
#define MODULE_NULL_COA_FUNCS
#endif
int indexed_modcall(int comp, int idx, REQUEST *request);
/*
* For now, these are strongly tied together.
*/
int virtual_servers_load(CONF_SECTION *config);
void virtual_servers_free(time_t when);
#ifdef __cplusplus
}
#endif
#endif /* RADIUS_MODULES_H */
|
#ifndef ARTERY_NETWORKINTERFACETABLE_H_
#define ARTERY_NETWORKINTERFACETABLE_H_
#include "artery/application/NetworkInterface.h"
#include "artery/utility/Channel.h"
#include <memory>
#include <unordered_set>
namespace artery
{
/**
* NetworkInterfaceTable maintains NetworkInterfaces registered at a Middleware
*/
class NetworkInterfaceTable
{
public:
using TableContainer = std::unordered_set<std::shared_ptr<NetworkInterface>>;
/**
* Select the first NetworkInterfaces operating on a particular channel.
*
* \param ch NetworkInterface shall operate on this channel
* \return shared pointer to found NetworkInterface (might be empty)
*/
std::shared_ptr<NetworkInterface> select(ChannelNumber ch) const;
/**
* Get all managed NetworkInterfaces.
*/
const TableContainer& all() const;
/**
* Insert a NetworkInterface
*
* \param ifc NetworkInterface instance
*/
void insert(std::shared_ptr<NetworkInterface> ifc);
private:
TableContainer mInterfaces;
};
} // namespace artery
#endif
|
#if defined(__GNUC__)
#ident "University of Edinburgh $Id$"
#else
static char _WarperSourceViewer_h[] = "University of Edinburgh $Id$";
#endif
/*!
* \file WarperSourceViewer.h
* \author Zsolt Husz
* \date October 2008
* \version $Id$
* \par
* Address:
* MRC Human Genetics Unit,
* MRC Institute of Genetics and Molecular Medicine,
* University of Edinburgh,
* Western General Hospital,
* Edinburgh, EH4 2XU, UK.
* \par
* Copyright (C), [2014],
* The University Court of the University of Edinburgh,
* Old College, Edinburgh, UK.
*
* 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.
* \brief Viewer displaying source objects
* \ingroup UI
*/
#ifndef WARPERSOURCEVIEWER_H
#define WARPERSOURCEVIEWER_H
#include "WarperViewer.h"
class QXmlStreamWriter;
/*!
* \brief Warping source object viewer class.
* Viewer class displaying source objects. It has feature
* point views.
*
* \ingroup UI
*/
class WarperSourceViewer : public WarperViewer
{
Q_OBJECT
public:
/*!
* \ingroup UI
* \brief Constructor
* \param objectViewerModel model managing the viewer
* \param is3D if viewer is for 3D objects
* \param fPointModel landmark model
* \param AddAction pointer referring add landmark action
* Qt event
* \param DeleteAction pointer referring delete landmark
* action Qt event
* \param MoveAction pointer referring move landmark action
* Qt event
* \param RemovelElemAction pointer referring remove element
* action Qt event
*
*/
WarperSourceViewer (ObjectViewerModel *objectViewerModel, bool is3D,
LandmarkController* fPointModel, QAction * AddAction,
QAction * DeleteAction, QAction * MoveAction,
QAction * RemovelElemAction);
/*!
* \ingroup UI
* \brief Checks if viewer accepts object.
* \return true if viewer object is a source object
*/
virtual bool accepting(WoolzObject * object );
/*!
* \ingroup UI
* \brief Returns the default object transparency.
* \return 0, all source objects are visible
*/
virtual int initialTransparency(WoolzObject * ) {return 0;}
/*!
* \ingroup UI
* \brief Configures the view
*
*/
virtual void init();
/*!
* \ingroup Control
* \brief Saves model in xml format.
* \param xmlWriter output xml stream
* \param header true of header should be written
* \return true if succeded, false if not
*/
virtual bool saveAsXml(QXmlStreamWriter *xmlWriter);
protected:
/*!
* \ingroup UI
* \brief Returns the background colour of the viewer
* Reimplemented form ObjectViewer
* \return colour
*/
virtual QColor getBackgroundColour();
/*!
* \ingroup UI
* \brief Processes the signal of landmark addition
* It forwards the signal to the appropiate source model.
* \param point point to add
*/
virtual void addLandmark(const WlzDVertex3 point);
public:
static const char * xmlTag; /*!< xml section tag string */
};
#endif // WARPERSOURCEVIEWER_H
|
/* This file is part of the KDE libraries
Copyright (C) 2004-2005 Anders Lund <anders@alweb.dk>
Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
Copyright (C) 2001-2004 Christoph Cullmann <cullmann@kde.org>
Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
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 __KATE_SPELL_H__
#define __KATE_SPELL_H__
#include "katecursor.h"
class KateView;
class KAction;
class KSpell;
class KateSpell : public QObject {
Q_OBJECT
public:
KateSpell(KateView *);
~KateSpell();
void createActions(KActionCollection *);
void updateActions();
// spellcheck from cursor, selection
private slots:
void spellcheckFromCursor();
// defined here in anticipation of pr view selections ;)
void spellcheckSelection();
void spellcheck();
/**
* Spellcheck a defined portion of the text.
*
* @param from Where to start the check
* @param to Where to end. If this is (0,0), it will be set to the end of the document.
*/
void spellcheck(const KateTextCursor &from, const KateTextCursor &to = KateTextCursor());
void ready(KSpell *);
void misspelling(const QString &, const QStringList &, unsigned int);
void corrected(const QString &, const QString &, unsigned int);
void spellResult(const QString &);
void spellCleanDone();
void locatePosition(uint pos, uint &line, uint &col);
private:
KateView *m_view;
KAction *m_spellcheckSelection;
KSpell *m_kspell;
// define the part of the text to check
KateTextCursor m_spellStart, m_spellEnd;
// keep track of where we are.
KateTextCursor m_spellPosCursor;
uint m_spellLastPos;
};
#endif
// kate: space-indent on; indent-width 2; replace-tabs on;
|
/* Common code for ARM software single stepping support.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef ARM_GET_NEXT_PCS_H
#define ARM_GET_NEXT_PCS_H 1
/* Forward declaration. */
struct arm_get_next_pcs;
/* get_next_pcs operations. */
struct arm_get_next_pcs_ops
{
ULONGEST (*read_mem_uint) (CORE_ADDR memaddr, int len, int byte_order);
CORE_ADDR (*syscall_next_pc) (struct arm_get_next_pcs *self, CORE_ADDR pc);
CORE_ADDR (*addr_bits_remove) (struct arm_get_next_pcs *self, CORE_ADDR val);
int (*is_thumb) (struct arm_get_next_pcs *self);
};
/* Context for a get_next_pcs call on ARM. */
struct arm_get_next_pcs
{
/* Operations implementations. */
struct arm_get_next_pcs_ops *ops;
/* Byte order for data. */
int byte_order;
/* Byte order for code. */
int byte_order_for_code;
/* Thumb2 breakpoint instruction. */
const gdb_byte *arm_thumb2_breakpoint;
/* Registry cache. */
struct regcache *regcache;
};
/* Initialize arm_get_next_pcs. */
void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
struct arm_get_next_pcs_ops *ops,
int byte_order,
int byte_order_for_code,
const gdb_byte *arm_thumb2_breakpoint,
struct regcache *regcache);
/* Find the next possible PCs after the current instruction executes. */
VEC (CORE_ADDR) *arm_get_next_pcs (struct arm_get_next_pcs *self,
CORE_ADDR pc);
/* Find the next possible PCs for thumb mode. */
VEC (CORE_ADDR) *thumb_get_next_pcs_raw (struct arm_get_next_pcs *self,
CORE_ADDR pc);
/* Find the next possible PCs for arm mode. */
VEC (CORE_ADDR) *arm_get_next_pcs_raw (struct arm_get_next_pcs *self,
CORE_ADDR pc);
#endif /* ARM_GET_NEXT_PCS_H */
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
/** Wraps another input stream, and reads from it using an intermediate buffer
If you're using an input stream such as a file input stream, and making lots of
small read accesses to it, it's probably sensible to wrap it in one of these,
so that the source stream gets accessed in larger chunk sizes, meaning less
work for the underlying stream.
*/
class JUCE_API BufferedInputStream : public InputStream
{
public:
//==============================================================================
/** Creates a BufferedInputStream from an input source.
@param sourceStream the source stream to read from
@param bufferSize the size of reservoir to use to buffer the source
@param deleteSourceWhenDestroyed whether the sourceStream that is passed in should be
deleted by this object when it is itself deleted.
*/
BufferedInputStream (InputStream* sourceStream,
int bufferSize,
bool deleteSourceWhenDestroyed);
/** Creates a BufferedInputStream from an input source.
@param sourceStream the source stream to read from - the source stream must not
be deleted until this object has been destroyed.
@param bufferSize the size of reservoir to use to buffer the source
*/
BufferedInputStream (InputStream& sourceStream, int bufferSize);
/** Destructor.
This may also delete the source stream, if that option was chosen when the
buffered stream was created.
*/
~BufferedInputStream();
//==============================================================================
/** Returns the next byte that would be read by a call to readByte() */
char peekByte();
int64 getTotalLength() override;
int64 getPosition() override;
bool setPosition (int64 newPosition) override;
int read (void* destBuffer, int maxBytesToRead) override;
String readString() override;
bool isExhausted() override;
private:
//==============================================================================
OptionalScopedPointer<InputStream> source;
int bufferSize;
int64 position, lastReadPos = 0, bufferStart, bufferOverlap = 128;
HeapBlock<char> buffer;
bool ensureBuffered();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferedInputStream)
};
} // namespace juce
|
//========================================================================================
//
// $HeadURL: svn://localhost/izine/iZinePlns/Codebase/trunk/iZinePublishUI/Source/Controls/TreeViewHeader/IZPTVColumnsInfo.h $
// $Revision: 2644 $
// $Date: 2011-03-31 09:47:39 +0200 (Thu, 31 Mar 2011) $
// $Author: rajkumar.sehrawat $
//
// Creator: Raj Kumar Sehrawat
// Created: 11-10-2010
// Copyright: 2008-2010 iZine Publish. All rights reserved.
//
// Description:
//========================================================================================
#ifndef _h_IZPTVColumnsInfo_
#define _h_IZPTVColumnsInfo_
#pragma once
enum enTVColumnType
{
eTVColType_Empty, //No widget created, used for indentation.
eTVColType_Label,
eTVColType_Chkbox,
eTVColType_Icon,
eTVColType_RolloverIconButton,
eTVColTypeCount
};
struct ZPTVColumnInfo
{
typedef object_type data_type; //To support K2Vector
int mColID; //Logical ID of column.
int mMinWidth; //0 Means no limit
int mMaxWidth; //0 Means no limit
int mMinHeight; //0 Means no limit
int mMaxHeight; //0 Means no limit
bool mCanHide; //false if always visible, like Task Subject
bool mCanChangePosition; //true if DnD is allowed.
enTVColumnType mColType;
PMString mColDispName; //Display name for the column in header/context menu.
PMString mContextMenuDispName; //If empty then mColDispName is used
ZPTVColumnInfo()
: mColID(0), mMinWidth( 0 ), mMaxWidth( 0 ), mMinHeight( 0 ), mMaxHeight( 0 )
, mCanHide( true ), mCanChangePosition( true ), mColType( eTVColType_Label )
{}
};
class IZPTVColumnsInfo : public IPMUnknown
{
public:
enum { kDefaultIID = IID_IZPTVCOLUMNSINFO };
typedef K2Vector<ZPTVColumnInfo> ZPTVColumnInfoArr;
virtual void InitCoumnsInfo(
int inTreeType ) = 0; //1 Tasks, 2 Assets
virtual int GetColumnCount() const = 0;
virtual const ZPTVColumnInfo & GetNthColumnInfo(
const int inColumnIndex ) const = 0;
virtual const ZPTVColumnInfo & GetColumnInfoForColID(
const int inColID ) const = 0;
virtual bool ContainsColumnInfoForColID(
const int inColID ) const = 0;
virtual const WidgetID & GetColumnWidgetStartID() const = 0;
static void GetTaskTreeColumnsInfo(
ZPTVColumnInfoArr & oColumnsInfo );
static void GetAssetsTreeColumnsInfo(
ZPTVColumnInfoArr & oColumnsInfo );
};
extern const ZPTVColumnInfo kZPEmptyTVColumnInfo;
#endif //_h_IZPTVColumnsInfo_
|
/*
* ntfs-3g_common.h - Common declarations for ntfs-3g and lowntfs-3g.
*
* Copyright (c) 2010-2011 Jean-Pierre Andre
* Copyright (c) 2010 Erik Larsson
*
* This program/include file 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/include 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 (in the main directory of the NTFS-3G
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _NTFS_3G_COMMON_H
#define _NTFS_3G_COMMON_H
#include "inode.h"
struct ntfs_options {
char *mnt_point; /* Mount point */
char *options; /* Mount options */
char *device; /* Device to mount */
#if !defined(__AROS__) && !defined(AMIGA)
char *arg_device; /* Device requested in argv */
#endif
} ;
typedef enum {
NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */
NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */
NF_STREAMS_INTERFACE_OPENXATTR, /* Same, not limited to "user." */
NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */
} ntfs_fuse_streams_interface;
struct DEFOPTION {
const char *name;
int type;
int flags;
} ;
/* Options, order not significant */
enum {
OPT_RO,
OPT_NOATIME,
OPT_ATIME,
OPT_RELATIME,
OPT_DMTIME,
OPT_FAKE_RW,
OPT_FSNAME,
OPT_NO_DEF_OPTS,
OPT_DEFAULT_PERMISSIONS,
OPT_PERMISSIONS,
OPT_ACL,
OPT_UMASK,
OPT_FMASK,
OPT_DMASK,
OPT_UID,
OPT_GID,
OPT_SHOW_SYS_FILES,
OPT_HIDE_HID_FILES,
OPT_HIDE_DOT_FILES,
OPT_IGNORE_CASE,
OPT_WINDOWS_NAMES,
OPT_COMPRESSION,
OPT_NOCOMPRESSION,
OPT_SILENT,
OPT_RECOVER,
OPT_NORECOVER,
OPT_REMOVE_HIBERFILE,
OPT_SYNC,
OPT_BIG_WRITES,
OPT_LOCALE,
OPT_NFCONV,
OPT_NONFCONV,
OPT_STREAMS_INTERFACE,
OPT_USER_XATTR,
OPT_NOAUTO,
OPT_DEBUG,
OPT_NO_DETACH,
OPT_REMOUNT,
OPT_BLKSIZE,
OPT_INHERIT,
OPT_ADDSECURIDS,
OPT_STATICGRPS,
OPT_USERMAPPING,
OPT_XATTRMAPPING,
OPT_EFS_RAW,
} ;
/* Option flags */
enum {
FLGOPT_BOGUS = 1,
FLGOPT_STRING = 2,
FLGOPT_OCTAL = 4,
FLGOPT_DECIMAL = 8,
FLGOPT_APPEND = 16,
FLGOPT_NOSUPPORT = 32,
FLGOPT_OPTIONAL = 64
} ;
typedef enum {
ATIME_ENABLED,
ATIME_DISABLED,
ATIME_RELATIVE
} ntfs_atime_t;
typedef struct {
ntfs_volume *vol;
unsigned int uid;
unsigned int gid;
unsigned int fmask;
unsigned int dmask;
ntfs_fuse_streams_interface streams;
ntfs_atime_t atime;
u64 dmtime;
BOOL ro;
BOOL show_sys_files;
BOOL hide_hid_files;
BOOL hide_dot_files;
BOOL windows_names;
BOOL ignore_case;
BOOL compression;
BOOL acl;
BOOL silent;
BOOL recover;
BOOL hiberfile;
BOOL sync;
BOOL big_writes;
BOOL debug;
BOOL no_detach;
BOOL blkdev;
BOOL mounted;
#ifdef HAVE_SETXATTR /* extended attributes interface required */
BOOL efs_raw;
#ifdef XATTR_MAPPINGS
char *xattrmap_path;
#endif /* XATTR_MAPPINGS */
#endif /* HAVE_SETXATTR */
struct fuse_chan *fc;
BOOL inherit;
unsigned int secure_flags;
char *usermap_path;
char *abs_mnt_point;
struct PERMISSIONS_CACHE *seccache;
struct SECURITY_CONTEXT security;
struct open_file *open_files; /* only defined in lowntfs-3g */
u64 latest_ghost;
} ntfs_fuse_context_t;
extern const char *EXEC_NAME;
#ifdef FUSE_INTERNAL
#define FUSE_TYPE "integrated FUSE"
#else
#define FUSE_TYPE "external FUSE"
#endif
extern const char xattr_ntfs_3g[];
extern const char nf_ns_user_prefix[];
extern const int nf_ns_user_prefix_len;
extern const char nf_ns_system_prefix[];
extern const int nf_ns_system_prefix_len;
extern const char nf_ns_security_prefix[];
extern const int nf_ns_security_prefix_len;
extern const char nf_ns_trusted_prefix[];
extern const int nf_ns_trusted_prefix_len;
int ntfs_strappend(char **dest, const char *append);
int ntfs_strinsert(char **dest, const char *append);
char *parse_mount_options(ntfs_fuse_context_t *ctx,
const struct ntfs_options *popts, BOOL low_fuse);
#if !defined(__AROS__) && !defined(AMIGA)
int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void),
int argc, char *argv[]);
#endif
int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx,
char *list, size_t size, BOOL prefixing);
#endif /* _NTFS_3G_COMMON_H */
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
/*
* 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: random.h
* DESC: definitions and externs for random number generators
*
* HISTORY: Created 6/ 6/1989
* LAST CHANGED:
*
* Copyright (c) 1989, Robert Leyland and Scott Anderson
****************************************************************************/
/* ----------------------------DEFINES------------------------------------ */
#ifndef SLOW_N_STUPID
#define TABLE_SIZE 1117 /* a "nice" prime number */
#define _FAST_ fast_random()
#else /* FAST_N_UGLY */
#define TABLE_SIZE ( (1 << 10) - 1 )
#define _FAST_ ( random_table[ fast_index++ & TABLE_SIZE ] )
#endif
#define FASTRAND(n) ( (int) ( (unsigned int)_FAST_ % (n) ) )
#define SFASTRAND(n) ( (int)_FAST_ % (n) )
#define AND_FASTRAND(n) ( (int)_FAST_ & (n) )
#define RAND(n) ( (int) ( (unsigned int)Random() % (n) ) )
#define SRAND(n) ( (int)Random() % (n) )
#define AND_RAND(n) ( (int)Random() & (n) )
#define INDEXED_RANDOM(x) (random_table[x])
/* ----------------------------GLOBALS/EXTERNS---------------------------- */
extern DWORD random_table[TABLE_SIZE];
extern COUNT fast_index; /* fast random cycling index */
|
/** \file cmdline_progress_display.h */ // -*-c++-*-
// Copyright (C) 2010 Daniel Burrows
//
// 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; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
#ifndef APTITUDE_GENERIC_VIEWS_PROGRESS_H
#define APTITUDE_GENERIC_VIEWS_PROGRESS_H
namespace aptitude
{
namespace util
{
class progress_info;
}
namespace views
{
/** \brief A general class for displaying a single line of
* progress information.
*
* The progress information is delivered as a progress_info
* object. A blank progress_info causes the display to be
* erased. A "pulse" mode progress_info displays a message with
* no percent indicator. And a "bar" mode progress_info displays
* a message with a percent indicator.
*/
class progress
{
public:
virtual ~progress();
/** \brief Set the currently displayed progress.
*
* \param progress The new progress information to display.
*/
virtual void set_progress(const aptitude::util::progress_info &progress) = 0;
/** \brief Mark the currently displayed progress (if any) as done. */
virtual void done() = 0;
};
}
}
#endif // APTITUDE_GENERIC_VIEWS_PROGRESS_H
|
/**
* ${project-name} - a GNU/Linux console-based file manager
*
* Implementation of different actions related to iface
*
* Copyright 2008 Sergey I. Sharybin <g.ulairi@gmail.com>
* Copyright 2008 Alex A. Smirnov <sceptic13@gmail.com>
*
* This program can be distributed under the terms of the GNU GPL.
* See the file COPYING.
*/
#include "iface.h"
#include "messages.h"
#include "i18n.h"
#include "util.h"
/********
* User's backend
*/
/**
* Prompted exiting from program
*/
void
iface_act_exit (void)
{
if (message_box (L"fm", _(L"Are you sure you want to quit?"),
MB_YESNO | MB_DEFBUTTON_1) == MR_YES)
{
do_exit ();
}
}
|
/* Copyright (c) 2011-2012, The Linux Foundation. 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 version 2 and
* only 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.
*
*/
#ifndef __APR_US_H__
#define __APR_US_H__
#include <mach/qdsp6v2/apr.h>
/* */
/* */
#define USM_SESSION_CMD_RUN 0x00012306
struct usm_stream_cmd_run {
struct apr_hdr hdr;
u32 flags;
u32 msw_ts;
u32 lsw_ts;
} __packed;
/* */
#define USM_STREAM_CMD_OPEN_READ 0x00012309
struct usm_stream_cmd_open_read {
struct apr_hdr hdr;
u32 uMode;
u32 src_endpoint;
u32 pre_proc_top;
u32 format;
} __packed;
#define USM_STREAM_CMD_OPEN_WRITE 0x00011271
struct usm_stream_cmd_open_write {
struct apr_hdr hdr;
u32 format;
} __packed;
#define USM_STREAM_CMD_CLOSE 0x0001230A
/* */
#define USM_STREAM_CMD_SET_ENC_PARAM 0x0001230B
/* */
#define USM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00011272
/* */
#define USM_PARAM_ID_ENCDEC_ENC_CFG_BLK 0x0001230D
/* */
/* */
struct usm_cfg_common {
u16 ch_cfg;
u16 bits_per_sample;
u32 sample_rate;
u32 dev_id;
u32 data_map;
} __packed;
/* */
#define USM_MAX_CFG_DATA_SIZE 100
struct usm_encode_cfg_blk {
u32 frames_per_buf;
u32 format_id;
/* */
u32 cfg_size;
struct usm_cfg_common cfg_common;
/* */
u8 transp_data[USM_MAX_CFG_DATA_SIZE];
} __packed;
struct usm_stream_cmd_encdec_cfg_blk {
struct apr_hdr hdr;
u32 param_id;
u32 param_size;
struct usm_encode_cfg_blk enc_blk;
} __packed;
struct us_encdec_cfg {
u32 format_id;
struct usm_cfg_common cfg_common;
u16 params_size;
u8 *params;
} __packed;
struct usm_stream_media_format_update {
struct apr_hdr hdr;
u32 format_id;
/* */
u32 cfg_size;
struct usm_cfg_common cfg_common;
/* */
u8 transp_data[USM_MAX_CFG_DATA_SIZE];
} __packed;
/* */
#define USM_SESSION_CMD_SIGNAL_DETECT_MODE 0x00012719
struct usm_session_cmd_detect_info {
struct apr_hdr hdr;
u32 detect_mode;
u32 skip_interval;
u32 algorithm_cfg_size;
} __packed;
/* */
#define USM_SESSION_EVENT_SIGNAL_DETECT_RESULT 0x00012720
#endif /* */
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 by Michael Sevakis
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "system.h"
#include "avic-imx31.h"
#include "spi-imx31.h"
#include "mc13783.h"
#include "ccm-imx31.h"
#include "sdma-imx31.h"
#include "dvfs_dptc-imx31.h"
#include "kernel.h"
#include "thread.h"
static __attribute__((interrupt("IRQ"))) void EPIT1_HANDLER(void)
{
EPITSR1 = EPITSR_OCIF; /* Clear the pending status */
/* Run through the list of tick tasks */
call_tick_tasks();
}
void INIT_ATTR tick_start(unsigned int interval_in_ms)
{
ccm_module_clock_gating(CG_EPIT1, CGM_ON_RUN_WAIT); /* EPIT1 module
clock ON - before writing
regs! */
EPITCR1 &= ~(EPITCR_OCIEN | EPITCR_EN); /* Disable the counter */
CCM_WIMR0 &= ~CCM_WIMR0_IPI_INT_EPIT1; /* Clear wakeup mask */
/* mcu_main_clk = 528MHz = 27MHz * 2 * ((9 + 7/9) / 1)
* CLKSRC = ipg_clk = 528MHz / 4 / 2 = 66MHz,
* EPIT Output Disconnected,
* Enabled in wait mode
* Prescale 1/2640 for 25KHz
* Reload from modulus register,
* Compare interrupt enabled,
* Count from load value */
EPITCR1 = EPITCR_CLKSRC_IPG_CLK | EPITCR_WAITEN | EPITCR_IOVW |
((2640-1) << EPITCR_PRESCALER_POS) | EPITCR_RLD |
EPITCR_OCIEN | EPITCR_ENMOD;
EPITLR1 = interval_in_ms*25; /* Count down from interval */
EPITCMPR1 = 0; /* Event when counter reaches 0 */
EPITSR1 = EPITSR_OCIF; /* Clear any pending interrupt */
avic_enable_int(INT_EPIT1, INT_TYPE_IRQ, INT_PRIO_DEFAULT,
EPIT1_HANDLER);
EPITCR1 |= EPITCR_EN; /* Enable the counter */
}
void INIT_ATTR kernel_device_init(void)
{
sdma_init();
spi_init();
enable_interrupt(IRQ_FIQ_STATUS);
mc13783_init();
dvfs_dptc_init(); /* Init also sets default points */
#ifndef BOOTLOADER
dvfs_wfi_monitor(true); /* Monitor the WFI signal */
dvfs_start(); /* Should be ok to start even so early */
dptc_start();
#endif
}
void tick_stop(void)
{
avic_disable_int(INT_EPIT1); /* Disable insterrupt */
EPITCR1 &= ~(EPITCR_OCIEN | EPITCR_EN); /* Disable counter */
EPITSR1 = EPITSR_OCIF; /* Clear pending */
ccm_module_clock_gating(CG_EPIT1, CGM_OFF); /* Turn off module clock */
}
|
/*
* Copyright (C) 2011 Hendrik Leppkes
* http://www.1f0.de
*
* 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, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*/
#pragma once
#include <Unknwn.h> // IUnknown and GUID Macros
// {3E114919-E6F7-41EA-91D6-929821EB0993}
DEFINE_GUID(IID_ILAVFSettings,
0x3e114919, 0xe6f7, 0x41ea, 0x91, 0xd6, 0x92, 0x98, 0x21, 0xeb, 0x9, 0x93);
[uuid("3E114919-E6F7-41EA-91D6-929821EB0993")]
interface ILAVFSettings : public IUnknown
{
// Switch to Runtime Config mode. This will reset all settings to default, and no changes to the settings will be saved
// You can use this to programmatically configure LAV Splitter without interfering with the users settings in the registry.
// Subsequent calls to this function will reset all settings back to defaults, even if the mode does not change.
//
// Note that calling this function during playback is not supported and may exhibit undocumented behaviour.
// For smooth operations, it must be called before LAV Splitter opens a file.
STDMETHOD(SetRuntimeConfig)(BOOL bRuntimeConfig) = 0;
// Retrieve the preferred languages as ISO 639-2 language codes, comma seperated
// If the result is NULL, no language has been set
// Memory for the string will be allocated, and has to be free'ed by the caller with CoTaskMemFree
STDMETHOD(GetPreferredLanguages)(WCHAR **ppLanguages) = 0;
// Set the preferred languages as ISO 639-2 language codes, comma seperated
// To reset to no preferred language, pass NULL or the empty string
STDMETHOD(SetPreferredLanguages)(WCHAR *pLanguages) = 0;
// Retrieve the preferred subtitle languages as ISO 639-2 language codes, comma seperated
// If the result is NULL, no language has been set
// If no subtitle language is set, the main language preference is used.
// Memory for the string will be allocated, and has to be free'ed by the caller with CoTaskMemFree
STDMETHOD(GetPreferredSubtitleLanguages)(WCHAR **ppLanguages) = 0;
// Set the preferred subtitle languages as ISO 639-2 language codes, comma seperated
// To reset to no preferred language, pass NULL or the empty string
// If no subtitle language is set, the main language preference is used.
STDMETHOD(SetPreferredSubtitleLanguages)(WCHAR *pLanguages) = 0;
// Get the current subtitle mode
// 0 = No Subs; 1 = Forced Subs; 2 = All subs
STDMETHOD_(DWORD,GetSubtitleMode)() = 0;
// Set the current subtitle mode
// 0 = No Subs; 1 = Forced Subs; 2 = All subs
STDMETHOD(SetSubtitleMode)(DWORD dwMode) = 0;
// Get the subtitle matching language flag
// TRUE = Only subtitles with a language in the preferred list will be used; FALSE = All subtitles will be used
STDMETHOD_(BOOL,GetSubtitleMatchingLanguage)() = 0;
// Set the subtitle matching language flag
// TRUE = Only subtitles with a language in the preferred list will be used; FALSE = All subtitles will be used
STDMETHOD(SetSubtitleMatchingLanguage)(BOOL dwMode) = 0;
// Control wether a special "Forced Subtitles" stream will be created for PGS subs
STDMETHOD_(BOOL,GetPGSForcedStream)() = 0;
// Control wether a special "Forced Subtitles" stream will be created for PGS subs
STDMETHOD(SetPGSForcedStream)(BOOL bFlag) = 0;
// Get the PGS forced subs config
// TRUE = only forced PGS frames will be shown, FALSE = all frames will be shown
STDMETHOD_(BOOL,GetPGSOnlyForced)() = 0;
// Set the PGS forced subs config
// TRUE = only forced PGS frames will be shown, FALSE = all frames will be shown
STDMETHOD(SetPGSOnlyForced)(BOOL bForced) = 0;
// Get the VC-1 Timestamp Processing mode
// 0 - No Timestamp Correction, 1 - Always Timestamp Correction, 2 - Auto (Correction for Decoders that need it)
STDMETHOD_(int,GetVC1TimestampMode)() = 0;
// Set the VC-1 Timestamp Processing mode
// 0 - No Timestamp Correction, 1 - Always Timestamp Correction, 2 - Auto (Correction for Decoders that need it)
STDMETHOD(SetVC1TimestampMode)(int iMode) = 0;
// Set whether substreams (AC3 in TrueHD, for example) should be shown as a seperate stream
STDMETHOD(SetSubstreamsEnabled)(BOOL bSubStreams) = 0;
// Check whether substreams (AC3 in TrueHD, for example) should be shown as a seperate stream
STDMETHOD_(BOOL,GetSubstreamsEnabled)() = 0;
// Set if the ffmpeg parsers should be used for video streams
STDMETHOD(SetVideoParsingEnabled)(BOOL bEnabled) = 0;
// Query if the ffmpeg parsers are being used for video streams
STDMETHOD_(BOOL,GetVideoParsingEnabled)() = 0;
// Set if LAV Splitter should try to fix broken HD-PVR streams
STDMETHOD(SetFixBrokenHDPVR)(BOOL bEnabled) = 0;
// Query if LAV Splitter should try to fix broken HD-PVR streams
STDMETHOD_(BOOL,GetFixBrokenHDPVR)() = 0;
// Control wether the givne format is enabled
STDMETHOD_(HRESULT,SetFormatEnabled)(const char *strFormat, BOOL bEnabled) = 0;
// Check if the given format is enabled
STDMETHOD_(BOOL,IsFormatEnabled)(const char *strFormat) = 0;
// Set if LAV Splitter should always completely remove the filter connected to its Audio Pin when the audio stream is changed
STDMETHOD(SetStreamSwitchRemoveAudio)(BOOL bEnabled) = 0;
// Query if LAV Splitter should always completely remove the filter connected to its Audio Pin when the audio stream is changed
STDMETHOD_(BOOL,GetStreamSwitchRemoveAudio)() = 0;
};
|
/*
* Copyright (C) 2011 Anton Burdinuk
* clark15b@gmail.com
* https://tsdemuxer.googlecode.com/svn/trunk/xupnpd
*/
#ifndef __SOAP_H
#define __SOAP_H
namespace soap
{
class string
{
protected:
char* ptr;
int size;
public:
string(void):ptr(0),size(0) {}
~string(void) { clear(); }
void clear(void);
int length(void) const { return size; }
const char* c_str(void) const { return ptr?ptr:""; }
void swap(string& s);
void trim_right(void);
friend class string_builder;
friend class ctx;
};
struct chunk
{
enum { max_size=64 };
char* ptr;
int size;
chunk* next;
};
class string_builder
{
protected:
chunk *beg,*end;
int add_chunk(void);
public:
string_builder(void):beg(0),end(0) {}
~string_builder(void) { clear(); }
void clear(void);
void add(int ch)
{
if(!end || end->size>=chunk::max_size)
if(add_chunk())
return;
((unsigned char*)end->ptr)[end->size++]=ch;
}
void add(const char* s,int len);
void swap(string& s);
};
struct node
{
node* parent;
node* next;
node* beg;
node* end;
char* name;
char* data;
int len;
node(void):parent(0),next(0),beg(0),end(0),name(0),data(0),len(0) {}
~node(void) { clear(); }
void init(void) { parent=next=beg=end=0; name=data=0; len=0; }
node* add_node(void);
void clear(void);
node* find_child(const char* s,int l);
node* find(const char* s);
const char* operator[](const char* s)
{
return find_data(s);
}
const char* find_data(const char* s)
{
node* pp=find(s);
if(pp && pp->data)
return pp->data;
return "";
}
};
class ctx
{
protected:
node* cur;
short st;
short st_close_tag;
short st_quot;
short st_text;
short err;
string_builder data;
enum { max_tok_size=64 };
char tok[max_tok_size];
int tok_size;
void tok_add(unsigned char ch)
{
if(tok_size<max_tok_size-1)
((unsigned char*)tok)[tok_size++]=ch;
}
void tok_reset(void) { tok_size=0; }
void ch_push(unsigned char ch) { data.add(ch); }
void tok_push(void);
void tag_open(const char* s,int len);
void tag_close(const char* s,int len);
void data_push(void);
public:
int line;
public:
ctx(node* root):cur(root),st(0),err(0),line(0),tok_size(0),st_close_tag(0),st_quot(0),st_text(0) {}
void begin(void);
int parse(const char* buf,int len);
int end(void);
};
int parse(const char* s,int l,node* root);
}
#endif /* __SOAP_H */
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GFX_ANIMATION_THROB_ANIMATION_H_
#define UI_GFX_ANIMATION_THROB_ANIMATION_H_
#include "ui/gfx/animation/slide_animation.h"
namespace gfx {
class GFX_EXPORT ThrobAnimation : public SlideAnimation {
public:
explicit ThrobAnimation(AnimationDelegate* target);
virtual ~ThrobAnimation() {}
void StartThrobbing(int cycles_til_stop);
void SetThrobDuration(int duration) { throb_duration_ = duration; }
virtual void Reset() OVERRIDE;
virtual void Reset(double value) OVERRIDE;
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void SetSlideDuration(int duration) OVERRIDE;
void set_cycles_remaining(int value) { cycles_remaining_ = value; }
int cycles_remaining() const { return cycles_remaining_; }
protected:
virtual void Step(base::TimeTicks time_now) OVERRIDE;
private:
void ResetForSlide();
int slide_duration_;
int throb_duration_;
int cycles_remaining_;
bool throbbing_;
DISALLOW_COPY_AND_ASSIGN(ThrobAnimation);
};
}
#endif
|
/*
This file is part of BGSLibrary.
BGSLibrary 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.
BGSLibrary 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 BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <iostream>
#include <cv.h>
#include <highgui.h>
#include "IBGS.h"
class WeightedMovingMeanBGS : public IBGS
{
private:
bool firstTime;
cv::Mat img_input_prev_1;
cv::Mat img_input_prev_2;
bool enableWeight;
bool enableThreshold;
int threshold;
bool showOutput;
bool showBackground;
public:
WeightedMovingMeanBGS();
~WeightedMovingMeanBGS();
void process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel);
private:
void saveConfig();
void loadConfig();
};
|
/********************
PhyloBayes MPI. Copyright 2010-2013 Nicolas Lartillot, Nicolas Rodrigue, Daniel Stubbs, Jacques Richer.
PhyloBayes 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.
PhyloBayes 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 PhyloBayes. If not, see <http://www.gnu.org/licenses/>.
**********************/
#ifndef CODONMUTSELSBDPSUB_H
#define CODONMUTSELSBDPSUB_H
#include "CodonMutSelSBDPProfileProcess.h"
#include "UniformRateProcess.h"
#include "GeneralPathSuffStatMatrixSubstitutionProcess.h"
class CodonMutSelSBDPSubstitutionProcess : public virtual CodonMutSelSBDPProfileProcess, public virtual UniformRateProcess, public virtual GeneralPathSuffStatMatrixSubstitutionProcess {
// s'inspirer de GeneralPathSuffStatGTRSubstitutionProcess
// et GeneralPathSuffStatRASCATGTRSubstitutionProcess
public:
CodonMutSelSBDPSubstitutionProcess() {}
virtual ~CodonMutSelSBDPSubstitutionProcess() {}
virtual int GetNstate() {return GetNcodon();}
protected:
void Create() {
CodonMutSelSBDPProfileProcess::Create();
UniformRateProcess::Create();
GeneralPathSuffStatMatrixSubstitutionProcess::Create();
}
void Delete() {
GeneralPathSuffStatMatrixSubstitutionProcess::Delete();
UniformRateProcess::Delete();
CodonMutSelSBDPProfileProcess::Delete();
}
};
#endif
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_
#define CHROME_BROWSER_AUTOMATION_AUTOMATION_UTIL_H_
#pragma once
#include <string>
#include "base/basictypes.h"
class AutomationProvider;
class Browser;
class DictionaryValue;
class GURL;
class TabContents;
namespace IPC {
class Message;
}
namespace automation_util {
Browser* GetBrowserAt(int index);
TabContents* GetTabContentsAt(int browser_index, int tab_index);
void GetCookies(const GURL& url,
TabContents* contents,
int* value_size,
std::string* value);
void SetCookie(const GURL& url,
const std::string& value,
TabContents* contents,
int* response_value);
void DeleteCookie(const GURL& url,
const std::string& cookie_name,
TabContents* contents,
bool* success);
void GetCookiesJSON(AutomationProvider* provider,
DictionaryValue* args,
IPC::Message* reply_message);
void DeleteCookieJSON(AutomationProvider* provider,
DictionaryValue* args,
IPC::Message* reply_message);
void SetCookieJSON(AutomationProvider* provider,
DictionaryValue* args,
IPC::Message* reply_message);
}
#endif
|
// 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 SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__
#define SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__
#include <linux/filter.h>
#include <utility>
#include <vector>
namespace sandbox {
class SandboxBPFPolicy;
class Verifier {
public:
static bool VerifyBPF(SandboxBPF* sandbox,
const std::vector<struct sock_filter>& program,
const SandboxBPFPolicy& policy,
const char** err);
static uint32_t EvaluateBPF(const std::vector<struct sock_filter>& program,
const struct arch_seccomp_data& data,
const char** err);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Verifier);
};
}
#endif
|
//-----------------------------------------------------------------------------
// File: VerilogWireWriter.h
//-----------------------------------------------------------------------------
// Project: Kactus2
// Author: Esko Pekkarinen
// Date: 21.08.2014
//
// Description:
// Class for writing a Verilog wire declaration.
//-----------------------------------------------------------------------------
#ifndef VERILOGWIREWRITER_H
#define VERILOGWIREWRITER_H
#include <Plugins/VerilogGenerator/common/Writer.h>
#include "../veriloggeneratorplugin_global.h"
#include <Plugins/common/HDLParser/HDLParserCommon.h>
//-----------------------------------------------------------------------------
//! Class for writing a Verilog wire declaration.
//-----------------------------------------------------------------------------
class VERILOGGENERATORPLUGIN_EXPORT VerilogWireWriter : public Writer
{
public:
//! The constructor.
VerilogWireWriter(QString name, QPair<QString, QString> bounds, QPair<QString, QString> array);
//! The destructor.
virtual ~VerilogWireWriter();
/*!
* Writes the wire to given output.
*
* @param [in] output The output to write to.
*/
virtual void write(QTextStream& output) const;
private:
// Disable copying.
VerilogWireWriter(VerilogWireWriter const& rhs);
VerilogWireWriter& operator=(VerilogWireWriter const& rhs);
/*!
* Creates a Verilog wire declaration.
*
* @return The Verilog wire declaration for this wire.
*/
QString createDeclaration() const;
/*!
* Gets the formatted size for the wire.
*
* @return The formatted size.
*/
QString formattedSize(QPair<QString, QString> const& bounds) const;
//! The wire.
QString name_;
QPair<QString, QString> bounds_;
QPair<QString, QString> array_;
};
#endif // VERILOGWIREWRITER_H
|
/**
* @file sam3x_eth.h
* @brief SAM3X Ethernet MAC controller
*
* @section License
*
* Copyright (C) 2010-2013 Oryx Embedded. All rights reserved.
*
* This file is part of CycloneTCP Open.
*
* 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.
*
* @author Oryx Embedded (www.oryx-embedded.com)
* @version 1.3.8
**/
#ifndef _SAM3X_ETH_H
#define _SAM3X_ETH_H
//TX buffers
#define SAM3X_TX_BUFFER_COUNT 3
#define SAM3X_TX_BUFFER_SIZE 1536
//RX buffers
#define SAM3X_RX_BUFFER_COUNT 72
#define SAM3X_RX_BUFFER_SIZE 128
//RMII signals
#define EMAC_RMII_MASK (PIO_PB9A_EMDIO | PIO_PB8A_EMDC | \
PIO_PB7A_ERXER | PIO_PB6A_ERX1 | PIO_PB5A_ERX0 | PIO_PB4A_ERXDV | \
PIO_PB3A_ETX1 | PIO_PB2A_ETX0 | PIO_PB1A_ETXEN | PIO_PB0A_ETXCK)
//TX buffer descriptor flags
#define EMAC_TX_USED 0x80000000
#define EMAC_TX_WRAP 0x40000000
#define EMAC_TX_ERROR 0x20000000
#define EMAC_TX_UNDERRUN 0x10000000
#define EMAC_TX_EXHAUSTED 0x08000000
#define EMAC_TX_NO_CRC 0x00010000
#define EMAC_TX_LAST 0x00008000
#define EMAC_TX_LENGTH 0x000007FF
//RX buffer descriptor flags
#define EMAC_RX_ADDRESS 0xFFFFFFFC
#define EMAC_RX_WRAP 0x00000002
#define EMAC_RX_OWNERSHIP 0x00000001
#define EMAC_RX_BROADCAST 0x80000000
#define EMAC_RX_MULTICAST_HASH 0x40000000
#define EMAC_RX_UNICAST_HASH 0x20000000
#define EMAC_RX_EXT_ADDR 0x10000000
#define EMAC_RX_SAR1 0x04000000
#define EMAC_RX_SAR2 0x02000000
#define EMAC_RX_SAR3 0x01000000
#define EMAC_RX_SAR4 0x00800000
#define EMAC_RX_TYPE_ID 0x00400000
#define EMAC_RX_VLAN_TAG 0x00200000
#define EMAC_RX_PRIORITY_TAG 0x00100000
#define EMAC_RX_VLAN_PRIORITY 0x000E0000
#define EMAC_RX_CFI 0x00010000
#define EMAC_RX_EOF 0x00008000
#define EMAC_RX_SOF 0x00004000
#define EMAC_RX_OFFSET 0x00003000
#define EMAC_RX_LENGTH 0x00000FFF
/**
* @brief Transmit buffer descriptor
**/
typedef struct
{
uint32_t address;
uint32_t status;
} Sam3xTxBufferDesc;
/**
* @brief Receive buffer descriptor
**/
typedef struct
{
uint32_t address;
uint32_t status;
} Sam3xRxBufferDesc;
//SAM3X Ethernet MAC driver
extern const NicDriver sam3xEthDriver;
//SAM3X Ethernet MAC related functions
error_t sam3xEthInit(NetInterface *interface);
void sam3xEthInitBufferDesc(NetInterface *interface);
void sam3xEthTick(NetInterface *interface);
void sam3xEthEnableIrq(NetInterface *interface);
void sam3xEthDisableIrq(NetInterface *interface);
void sam3xEthRxEventHandler(NetInterface *interface);
error_t sam3xEthSetMacFilter(NetInterface *interface);
error_t sam3xEthSendPacket(NetInterface *interface,
const ChunkedBuffer *buffer, size_t offset);
uint_t sam3xEthReceivePacket(NetInterface *interface,
uint8_t *buffer, uint_t size);
void sam3xEthWritePhyReg(uint8_t phyAddr, uint8_t regAddr, uint16_t data);
uint16_t sam3xEthReadPhyReg(uint8_t phyAddr, uint8_t regAddr);
#endif
|
/*
* Copyright (c) 2005, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* 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 would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* This sample test aims to check the following assertions:
*
* If SA_NODEFER is not set in sa_flags, the caught signal is added to the
* thread's signal mask during the handler execution.
* The steps are:
* -> register a signal handler for SIGTSTP
* -> raise SIGTSTP
* -> In handler, check for reentrance then raise SIGTSTP again.
* The test fails if signal handler if reentered or signal is not pending when raised again.
*/
/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */
#define _POSIX_C_SOURCE 200112L
/******************************************************************************/
/*************************** standard includes ********************************/
/******************************************************************************/
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/******************************************************************************/
/*************************** Test framework *******************************/
/******************************************************************************/
#include "../testfrmw/testfrmw.h"
#include "../testfrmw/testfrmw.c"
/* This header is responsible for defining the following macros:
* UNRESOLVED(ret, descr);
* where descr is a description of the error and ret is an int
* (error code for example)
* FAILED(descr);
* where descr is a short text saying why the test has failed.
* PASSED();
* No parameter.
*
* Both three macros shall terminate the calling process.
* The testcase shall not terminate in any other maneer.
*
* The other file defines the functions
* void output_init()
* void output(char * string, ...)
*
* Those may be used to output information.
*/
/******************************************************************************/
/**************************** Configuration ***********************************/
/******************************************************************************/
#ifndef VERBOSE
#define VERBOSE 1
#endif
#define SIGNAL SIGTSTP
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
int called = 0;
void handler(int sig)
{
int ret;
sigset_t pending;
called++;
if (called == 2)
{
FAILED("Signal was not masked in signal handler");
}
if (called == 1)
{
/* Raise the signal again. It should be masked */
ret = raise(SIGNAL);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to raise SIGTSTP again");
}
/* check the signal is pending */
ret = sigpending(&pending);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to get pending signal set");
}
ret = sigismember(&pending, SIGNAL);
if (ret != 1)
{
FAILED("signal is not pending");
}
}
called++;
}
/* main function */
int main()
{
int ret;
struct sigaction sa;
/* Initialize output */
output_init();
/* Set the signal handler */
sa.sa_flags = 0;
sa.sa_handler = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Install the signal handler for SIGTSTP */
ret = sigaction(SIGNAL, &sa, 0);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to set signal handler");
}
ret = raise(SIGNAL);
if (ret != 0)
{
UNRESOLVED(ret, "Failed to raise SIGTSTP");
}
while (called != 4)
sched_yield();
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
|
/*
* Copyright (C) Dag Henning Liodden Sørbø <daghenning@lioddensorbo.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef GUIUTILS_H
#define GUIUTILS_H
#include <QFont>
#include <QLayout>
#define MAX_FONT_SIZE 1000
class GuiUtils {
public:
static QColor backgroundColor() {return QColor(Qt::white);}
static QColor foregroundColor() {return QColor(Qt::black);}
static int calcMaxFontSize(const QFont& originalFont, const QString& text, const QRect& boundingBox)
{
QFontMetrics originalMetrics(originalFont);
bool fontTooLarge = originalMetrics.width(text) >= boundingBox.width() || originalMetrics.height() >= boundingBox.height();
int inc = 2;
int size = originalFont.pointSize();
QFont f = originalFont;
if (!fontTooLarge) {
// try to increase font size
for (int i = 1; i <= MAX_FONT_SIZE; i += inc) {
f.setPointSize(size + i);
QFontMetrics fm(f);
if (fm.width(text) >= boundingBox.width() || fm.height() >= boundingBox.height()) {
return size + i - inc;
}
}
}
if (fontTooLarge) {
for (int i = 1; i <= MAX_FONT_SIZE && size - i > 1; i += inc) {
// try to decrease font size
f.setPointSize(size - i);
QFontMetrics fm(f);
if (fm.width(text) < boundingBox.width() && fm.height() < boundingBox.height()) {
return size - i;
}
}
}
return size; // should never get this far
}
static void clearLayout(QLayout* layout) {
QLayoutItem* item;
while ((item = layout->takeAt(0)) != 0) {
if (item->layout()) {
clearLayout(item->layout());
} else if (item->widget()) {
delete item->widget();
} else if (item->spacerItem()) {
delete item->spacerItem();
}
delete item;
}
}
};
#endif // GUIUTILS_H
|
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
#include <windows.h>
#include <winsock2.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <sys/types.h>
#include "java_net_SocketOutputStream.h"
#include "net_util.h"
#include "jni_util.h"
/************************************************************************
* SocketOutputStream
*/
static jfieldID IO_fd_fdID;
/*
* Class: java_net_SocketOutputStream
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_net_SocketOutputStream_init(JNIEnv *env, jclass cls) {
IO_fd_fdID = NET_GetFileDescriptorID(env);
}
/*
* Class: java_net_SocketOutputStream
* Method: socketWrite
* Signature: (Ljava/io/FileDescriptor;[BII)V
*/
JNIEXPORT void JNICALL
Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
jobject fdObj, jbyteArray data,
jint off, jint len) {
char *bufP;
char BUF[MAX_BUFFER_LEN];
int buflen;
int fd;
if (IS_NULL(fdObj)) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
return;
} else {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
}
if (IS_NULL(data)) {
JNU_ThrowNullPointerException(env, "data argument");
return;
}
/*
* Use stack allocate buffer if possible. For large sizes we allocate
* an intermediate buffer from the heap (up to a maximum). If heap is
* unavailable just use our stack buffer.
*/
if (len <= MAX_BUFFER_LEN) {
bufP = BUF;
buflen = MAX_BUFFER_LEN;
} else {
buflen = min(MAX_HEAP_BUFFER_LEN, len);
bufP = (char *)malloc((size_t)buflen);
if (bufP == NULL) {
bufP = BUF;
buflen = MAX_BUFFER_LEN;
}
}
while(len > 0) {
int loff = 0;
int chunkLen = min(buflen, len);
int llen = chunkLen;
int retry = 0;
(*env)->GetByteArrayRegion(env, data, off, chunkLen, (jbyte *)bufP);
while(llen > 0) {
int n = send(fd, bufP + loff, llen, 0);
if (n > 0) {
llen -= n;
loff += n;
continue;
}
/*
* Due to a bug in Windows Sockets (observed on NT and Windows
* 2000) it may be necessary to retry the send. The issue is that
* on blocking sockets send/WSASend is supposed to block if there
* is insufficient buffer space available. If there are a large
* number of threads blocked on write due to congestion then it's
* possile to hit the NT/2000 bug whereby send returns WSAENOBUFS.
* The workaround we use is to retry the send. If we have a
* large buffer to send (>2k) then we retry with a maximum of
* 2k buffer. If we hit the issue with <=2k buffer then we backoff
* for 1 second and retry again. We repeat this up to a reasonable
* limit before bailing out and throwing an exception. In load
* conditions we've observed that the send will succeed after 2-3
* attempts but this depends on network buffers associated with
* other sockets draining.
*/
if (WSAGetLastError() == WSAENOBUFS) {
if (llen > MAX_BUFFER_LEN) {
buflen = MAX_BUFFER_LEN;
chunkLen = MAX_BUFFER_LEN;
llen = MAX_BUFFER_LEN;
continue;
}
if (retry >= 30) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
"No buffer space available - exhausted attempts to queue buffer");
if (bufP != BUF) {
free(bufP);
}
return;
}
Sleep(1000);
retry++;
continue;
}
/*
* Send failed - can be caused by close or write error.
*/
if (WSAGetLastError() == WSAENOTSOCK) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
NET_ThrowCurrent(env, "socket write error");
}
if (bufP != BUF) {
free(bufP);
}
return;
}
len -= chunkLen;
off += chunkLen;
}
if (bufP != BUF) {
free(bufP);
}
}
|
//*****************************************************************************
// Mishira: An audiovisual production tool for broadcasting live video
//
// Copyright (C) 2014 Lucas Murray <lucas@polyflare.com>
// 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.
//*****************************************************************************
#ifndef SYNCLAYER_H
#define SYNCLAYER_H
#include "layer.h"
#include "layerfactory.h"
#include <QtGui/QColor>
class LayerDialog;
//=============================================================================
class SyncLayer : public Layer
{
friend class SyncLayerFactory;
private: // Members -----------------------------------------------------------
VidgfxVertBuf * m_vertBufA; // Moving metronome
VidgfxVertBuf * m_vertBufB; // Static center
VidgfxVertBuf * m_vertBufC; // Static center
QColor m_color;
bool m_refMetronomeDelayed;
bool m_metronomeReffed;
private: // Constructor/destructor --------------------------------------------
SyncLayer(LayerGroup *parent);
~SyncLayer();
public: // Methods ------------------------------------------------------------
void setColor(const QColor &color);
QColor getColor() const;
private:
void updateMetronome(VidgfxContext *gfx, uint frameNum);
public: // Interface ----------------------------------------------------------
virtual void initializeResources(VidgfxContext *gfx);
virtual void updateResources(VidgfxContext *gfx);
virtual void destroyResources(VidgfxContext *gfx);
virtual void render(
VidgfxContext *gfx, Scene *scene, uint frameNum, int numDropped);
virtual quint32 getTypeId() const;
virtual bool hasSettingsDialog();
virtual LayerDialog * createSettingsDialog(QWidget *parent = NULL);
virtual void serialize(QDataStream *stream) const;
virtual bool unserialize(QDataStream *stream);
protected:
virtual void showEvent();
virtual void hideEvent();
virtual void parentShowEvent();
virtual void parentHideEvent();
};
//=============================================================================
inline QColor SyncLayer::getColor() const
{
return m_color;
}
//=============================================================================
class SyncLayerFactory : public LayerFactory
{
public: // Interface ----------------------------------------------------------
virtual quint32 getTypeId() const;
virtual QByteArray getTypeString() const;
virtual Layer * createBlankLayer(LayerGroup *parent);
virtual Layer * createLayerWithDefaults(LayerGroup *parent);
virtual QString getAddLayerString() const;
};
//=============================================================================
#endif // SYNCLAYER_H
|
#ifndef strings_h
#define strings_h
/* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided
* for both */
#include <intrin.h>
#pragma intrinsic(_BitScanForward)
static __forceinline int ffsl(long x)
{
unsigned long i;
if (_BitScanForward(&i, x))
return (i + 1);
return (0);
}
static __forceinline int ffs(int x)
{
return (ffsl(x));
}
#endif
|
/** @file
The form data for user profile manager driver.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __USER_PROFILE_MANAGER_DATA_H__
#define __USER_PROFILE_MANAGER_DATA_H__
#include <Guid/UserProfileManagerHii.h>
//
// Form ID
//
#define FORMID_USER_MANAGE 0x0001
#define FORMID_MODIFY_USER 0x0002
#define FORMID_DEL_USER 0x0003
#define FORMID_USER_INFO 0x0004
#define FORMID_MODIFY_IP 0x0005
#define FORMID_MODIFY_AP 0x0006
#define FORMID_LOAD_DP 0x0007
#define FORMID_CONNECT_DP 0x0008
#define FORMID_PERMIT_LOAD_DP 0x0009
#define FORMID_FORBID_LOAD_DP 0x000A
#define FORMID_PERMIT_CONNECT_DP 0x000B
#define FORMID_FORBID_CONNECT_DP 0x000C
//
// Label ID
//
#define LABEL_USER_MANAGE_FUNC 0x0010
#define LABEL_USER_DEL_FUNC 0x0020
#define LABEL_USER_MOD_FUNC 0x0030
#define LABEL_USER_INFO_FUNC 0x0040
#define LABEL_IP_MOD_FUNC 0x0050
#define LABEL_AP_MOD_FUNC 0x0060
#define LABEL_PERMIT_LOAD_FUNC 0x0070
#define LABLE_FORBID_LOAD_FUNC 0x0080
#define LABEL_END 0x00F0
//
// First form key (Add/modify/del user profile).
// First 2 bits (bit 16~15).
//
#define KEY_MODIFY_USER 0x4000
#define KEY_DEL_USER 0x8000
#define KEY_ADD_USER 0xC000
#define KEY_FIRST_FORM_MASK 0xC000
//
// Second form key (Display new form /Select user / modify device path in access policy).
// Next 2 bits (bit 14~13).
//
#define KEY_ENTER_NEXT_FORM 0x0000
#define KEY_SELECT_USER 0x1000
#define KEY_MODIFY_AP_DP 0x2000
#define KEY_OPEN_CLOSE_FORM_ACTION 0x3000
#define KEY_SECOND_FORM_MASK 0x3000
//
// User profile information form key.
// Next 3 bits (bit 12~10).
//
#define KEY_MODIFY_NAME 0x0200
#define KEY_MODIFY_IP 0x0400
#define KEY_MODIFY_AP 0x0600
#define KEY_MODIFY_INFO_MASK 0x0E00
//
// Specified key, used in VFR (KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_NAME).
//
#define KEY_MODIFY_USER_NAME 0x5200
//
// Modify identity policy form key.
// Next 3 bits (bit 9~7).
//
#define KEY_MODIFY_PROV 0x0040
#define KEY_MODIFY_MTYPE 0x0080
#define KEY_MODIFY_CONN 0x00C0
#define KEY_ADD_IP_OP 0x0100
#define KEY_IP_RETURN_UIF 0x0140
#define KEY_MODIFY_IP_MASK 0x01C0
//
// Specified key.
//
#define KEY_ADD_LOGICAL_OP 0x5500
#define KEY_IP_RETURN 0x5540
//
// Modify access policy form key.
// Next 3 bits (bit 9~7).
//
#define KEY_MODIFY_RIGHT 0x0040
#define KEY_MODIFY_SETUP 0x0080
#define KEY_MODIFY_BOOT 0x00C0
#define KEY_MODIFY_LOAD 0x0100
#define KEY_MODIFY_CONNECT 0x0140
#define KEY_AP_RETURN_UIF 0x0180
#define KEY_MODIFY_AP_MASK 0x01C0
//
// Specified key.
//
#define KEY_LOAD_DP 0x5700
#define KEY_CONN_DP 0x5740
#define KEY_AP_RETURN 0x5780
//
// Device path form key.
// Next 2 bits (bit 6~5).
//
#define KEY_PERMIT_MODIFY 0x0010
#define KEY_FORBID_MODIFY 0x0020
#define KEY_DISPLAY_DP_MASK 0x0030
//
// Specified key.
//
#define KEY_LOAD_PERMIT 0x5710
#define KEY_LOAD_FORBID 0x5720
#define KEY_CONNECT_PERMIT 0x5750
#define KEY_CONNECT_FORBID 0x5760
//
// Device path modify key.
// 2 bits (bit 12~11).
//
#define KEY_LOAD_PERMIT_MODIFY 0x0000
#define KEY_LOAD_FORBID_MODIFY 0x0400
#define KEY_CONNECT_PERMIT_MODIFY 0x0800
#define KEY_CONNECT_FORBID_MODIFY 0x0C00
#define KEY_MODIFY_DP_MASK 0x0C00
//
// The permissions usable when configuring the platform.
//
#define ACCESS_SETUP_RESTRICTED 1
#define ACCESS_SETUP_NORMAL 2
#define ACCESS_SETUP_ADMIN 3
//
// Question ID for the question used in each form (KEY_OPEN_CLOSE_FORM_ACTION | FORMID_FORM_USER_MANAGE)
// This ID is used in FORM OPEN/CLOSE CallBack action.
//
#define QUESTIONID_USER_MANAGE 0x3001
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.