text stringlengths 4 6.14k |
|---|
#ifndef __designer_panel__
#define __designer_panel__
#include "menu_bar.h"
#include <map>
#include <wx/aui/auibook.h>
#include <wx/choicebk.h>
#include <wx/collpane.h>
#include <wx/listbook.h>
#include <wx/notebook.h>
#include <wx/ribbon/bar.h>
#include <wx/scrolwin.h>
#include <wx/toolbook.h>
#include <wx/treebook.h>
class DesignerContainerPanel;
class HintFrame;
struct SizeritemData {
SizeritemData(wxWindow* win, wxSizerItem* item)
: m_parentWin(win)
, m_sizeritem(item)
{
}
wxWindow* m_parentWin;
wxSizerItem* m_sizeritem;
};
class DesignerPanel : public wxScrolledWindow
{
bool m_constructing;
wxString m_xrcLoaded;
DesignerContainerPanel* m_mainPanel = nullptr;
wxWindow* m_hintedWin;
wxWindow* m_parentWin;
wxSizerItem* m_hintedSizeritem;
wxWindow* m_hintedContainer;
wxString m_selecteItem;
std::map<wxString, wxWindow*> m_windows;
std::map<int, SizeritemData> m_sizeritems;
protected:
void RecurseConnectEvents(wxWindow* pclComponent);
void RecurseDisconnectEvents(wxWindow* pclComponent);
void StoreSizersRecursively(wxSizer* sizer, wxWindow* container);
void DoDrawSurroundingMarker(wxWindow* win);
void DoMarkSizeritem(wxSizerItem* szitem, wxWindow* container);
void ClearStaleOutlines() const;
void MarkOutline(wxDC& dc, wxRect* rect = NULL) const;
void MarkBorders(wxDC& dc) const;
void DoMarkBorders(wxDC& dc, wxRect rr, int bdrwidth, int flags) const;
wxPoint GetOutlineOffset() const; // Needed for pages in a wxNotebook with top/left tabs
void DoNotebookPageChangeEvent(wxEvent& e);
void DoAuiBookChanged(wxAuiNotebookEvent& e);
void DoClear();
void DoLoadXRC(int topLeveWinType);
void DoControlSelected(wxEvent& e);
public:
void OnTreeListCtrlFocus(wxFocusEvent& e);
public:
DesignerPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& position = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
virtual ~DesignerPanel();
DECLARE_EVENT_TABLE()
void OnUpdatePreview(wxCommandEvent& e);
void OnClearPreview(wxCommandEvent& e);
void OnLoadPreview(wxCommandEvent& e);
void OnMouseLeftDown(wxMouseEvent& e);
void OnControlFocus(wxFocusEvent& event);
void OnNotebookPageChanged(wxNotebookEvent& e);
void OnListbookPageChanged(wxListbookEvent& e);
void OnToolbookPageChanged(wxToolbookEvent& e);
void OnChoicebookPageChanged(wxChoicebookEvent& e);
void OnTreebookPageChanged(wxTreebookEvent& e);
void OnAuiPageChanged(wxAuiNotebookEvent& e);
void OnAuiPageChanging(wxAuiNotebookEvent& e);
void OnAuiToolClicked(wxCommandEvent& e);
void OnHighlightControl(wxCommandEvent& e);
void OnRadioBox(wxCommandEvent& e);
void OnRibbonPageChanged(wxRibbonBarEvent& e);
void OnSize(wxSizeEvent& event);
};
#endif // __designer_panel__
|
/*
*
* oFono - Open Source Telephony - RIL Modem Support
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2012 Canonical, Ltd. All rights reserved.
* Copyright (C) 2015 Ratchanan Srirattanamet.
*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <gril.h>
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
#include <ofono/log.h>
#include <ofono/types.h>
#include "qcom_msim_modem.h"
static int qcom_msim_modem_init(void)
{
DBG("");
qcom_msim_radio_settings_init();
return 0;
}
static void qcom_msim_modem_exit(void)
{
DBG("");
qcom_msim_radio_settings_exit();
}
OFONO_PLUGIN_DEFINE(qcommsimmodem, "Qualcomm multi-sim modem driver", VERSION,
OFONO_PLUGIN_PRIORITY_DEFAULT,
qcom_msim_modem_init, qcom_msim_modem_exit)
|
/*
* Last updated: July 22, 2008
* ~Keripo
*
* Copyright (C) 2008 Keripo
*
* 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.
*/
/* == Volume code == */
#include <fcntl.h>
#include <sys/soundcard.h>
#include <sys/ioctl.h>
static int ipod_mixer;
static int ipod_volume;
static int volume_current = -1;
static void ipod_update_volume()
{
if (volume_current != ipod_volume) {
volume_current = ipod_volume;
int vol;
vol = volume_current << 8 | volume_current;
ioctl(ipod_mixer, SOUND_MIXER_WRITE_PCM, &vol);
}
}
static void ipod_init_sound()
{
ipod_mixer = open("/dev/mixer", O_RDWR);
ipod_volume = 50; // Good default
ipod_update_volume();
}
static void ipod_exit_sound()
{
close(ipod_mixer);
}
/* == Backlight code == */
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#define BACKLIGHT_OFF 0
#define BACKLIGHT_ON 1
#define FBIOSET_BACKLIGHT _IOW('F', 0x25, int)
static int backlight_current;
static int ipod_ioctl(int request, int *arg)
{
int fd;
fd = open("/dev/fb0", O_NONBLOCK);
if (fd < 0) fd = open("/dev/fb/0", O_NONBLOCK);
if (fd < 0) return -1;
if (ioctl(fd, request, arg) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
static void ipod_set_backlight(int backlight)
{
ipod_ioctl(FBIOSET_BACKLIGHT, (int *)(long)backlight);
}
static void ipod_toggle_backlight()
{
if (backlight_current == 0) {
ipod_set_backlight(BACKLIGHT_ON);
backlight_current = 1;
} else {
ipod_set_backlight(BACKLIGHT_OFF);
backlight_current = 0;
}
}
static void ipod_init_backlight()
{
ipod_set_backlight(BACKLIGHT_ON);
backlight_current = 1;
}
/* == Input code == */
#include <stdio.h>
#include <fcntl.h>
#include <termios.h>
#include <linux/kd.h>
#define KEY_MENU 50 // Up
#define KEY_PLAY 32 // Down
#define KEY_REWIND 17 // Left
#define KEY_FORWARD 33 // Right
#define KEY_ACTION 28 // Select
#define KEY_HOLD 35 // Exit
#define SCROLL_L 38 // Counter-clockwise
#define SCROLL_R 19 // Clockwise
#define KEY_NULL -1 // No key event
#define KEYCODE(a) (a & 0x7f) // Use to get keycode of scancode.
#define KEYSTATE(a) (a & 0x80) // Check if key is pressed or lifted
static int console;
static struct termios stored_settings;
static int ipod_get_keypress()
{
int press = 0;
if (read(console, &press, 1) != 1)
return KEY_NULL;
return press;
}
static void ipod_init_input()
{
struct termios new_settings;
console = open("/dev/console", O_RDONLY | O_NONBLOCK);
tcgetattr(console, &stored_settings);
new_settings = stored_settings;
new_settings.c_lflag &= ~(ICANON | ECHO | ISIG);
new_settings.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON | BRKINT);
new_settings.c_cc[VTIME] = 0;
new_settings.c_cc[VMIN] = 0;
tcsetattr(console, TCSAFLUSH, &new_settings);
ioctl(console, KDSKBMODE, K_MEDIUMRAW);
}
static void ipod_exit_input()
{
// Causes screwy characters to appear
//tcsetattr(console, TCSAFLUSH, &stored_settings);
close(console);
}
/* == Main loop == */
#define SCROLL_MOD_NUM 3 // Via experimentation
#define SCROLL_MOD(n) \
({ \
static int scroll_count = 0; \
int use = 0; \
if (++scroll_count >= n) { \
scroll_count -= n; \
use = 1; \
} \
(use == 1); \
})
void ipod_init_volume_control()
{
ipod_init_sound();
ipod_init_input();
ipod_init_backlight();
int input, exit;
exit = 0;
while (exit != 1) {
input = ipod_get_keypress();
if (!KEYSTATE(input)) { // Pressed
input = KEYCODE(input);
switch (input) {
case SCROLL_R:
if (SCROLL_MOD(SCROLL_MOD_NUM)) {
ipod_volume++;
if (ipod_volume > 70)
ipod_volume = 70; // To be safe - 70 is VERY loud
ipod_update_volume();
}
break;
case KEY_ACTION:
ipod_toggle_backlight();
break;
case SCROLL_L:
if (SCROLL_MOD(SCROLL_MOD_NUM)) {
ipod_volume--;
if (ipod_volume < 0)
ipod_volume = 0; // Negative volume DNE!
ipod_update_volume();
}
break;
case KEY_MENU:
exit = 1;
break;
default:
break;
}
}
}
printf("Exiting...\n");
ipod_exit_sound();
ipod_exit_input();
}
|
/*
* These are the public elements of the Linux kernel AX.25 code. A similar
* file netrom.h exists for the NET/ROM protocol.
*/
#ifndef AX25_KERNEL_H
#define AX25_KERNEL_H
#define AX25_MTU 256
#define AX25_MAX_DIGIS 8
#define AX25_WINDOW 1
#define AX25_T1 2
#define AX25_N2 3
#define AX25_T3 4
#define AX25_T2 5
#define AX25_BACKOFF 6
#define AX25_EXTSEQ 7
#define AX25_PIDINCL 8
#define AX25_IDLE 9
#define AX25_PACLEN 10
#define AX25_IAMDIGI 12
#define AX25_KILL 99
#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0)
#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3)
#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7)
#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8)
#define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9)
#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10)
#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11)
#define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12)
#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13)
#define AX25_SET_RT_IPMODE 2
#define AX25_NOUID_DEFAULT 0
#define AX25_NOUID_BLOCK 1
typedef struct
{
char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */
} ax25_address;
struct sockaddr_ax25
{
sa_family_t sax25_family;
ax25_address sax25_call;
int sax25_ndigis;
/* Digipeater ax25_address sets follow */
};
#define sax25_uid sax25_ndigis
struct full_sockaddr_ax25
{
struct sockaddr_ax25 fsa_ax25;
ax25_address fsa_digipeater[AX25_MAX_DIGIS];
};
struct ax25_routes_struct
{
ax25_address port_addr;
ax25_address dest_addr;
unsigned char digi_count;
ax25_address digi_addr[AX25_MAX_DIGIS];
};
struct ax25_route_opt_struct
{
ax25_address port_addr;
ax25_address dest_addr;
int cmd;
int arg;
};
struct ax25_ctl_struct
{
ax25_address port_addr;
ax25_address source_addr;
ax25_address dest_addr;
unsigned int cmd;
unsigned long arg;
unsigned char digi_count;
ax25_address digi_addr[AX25_MAX_DIGIS];
};
/* this will go away. Please do not export to user land */
struct ax25_info_struct_depreciated
{
unsigned int n2, n2count;
unsigned int t1, t1timer;
unsigned int t2, t2timer;
unsigned int t3, t3timer;
unsigned int idle, idletimer;
unsigned int state;
unsigned int rcv_q, snd_q;
};
struct ax25_info_struct
{
unsigned int n2, n2count;
unsigned int t1, t1timer;
unsigned int t2, t2timer;
unsigned int t3, t3timer;
unsigned int idle, idletimer;
unsigned int state;
unsigned int rcv_q, snd_q;
unsigned int vs, vr, va, vs_max;
unsigned int paclen;
unsigned int window;
};
struct ax25_fwd_struct
{
ax25_address port_from;
ax25_address port_to;
};
#endif
|
/*
* AscNHalf MMORPG Server
* Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/>
* Copyright (C) 2010 AscNHalf Team <http://ascnhalf.scymex.info/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _SHARED_RC4ENGINE_H
#define _SHARED_RC4ENGINE_H
class RC4Engine
{
unsigned char perm[256];
unsigned char index1, index2;
bool Initialized;
public:
//! RC4Engine constructor. Must supply a key and the length of that array.
RC4Engine(const unsigned char * keybytes, unsigned int keylen)
{
Setup(keybytes, keylen);
}
RC4Engine() : Initialized(false) {}
//! Destructor
~RC4Engine() { }
//! Initializes permutation, etc.
void Setup(const unsigned char * keybytes, const unsigned int keylen)
{
unsigned int i = 0;
unsigned char j = 0, k;
// Initialize RC4 state (all bytes to 0)
for(; i < 256; ++i)
perm[i] = (uint8)i;
// Set index values
index1 = index2 = 0;
// Randomize the permutation
for(j = 0, i = 0; i < 256; ++i)
{
j += perm[i] + keybytes[i % keylen];
k = perm[i];
perm[i] = perm[j];
perm[j] = k;
}
Initialized = true;
}
//! Processes the specified array. The same function is used for both
// encryption and decryption.
void Process(unsigned char * input, unsigned char * output, unsigned int len)
{
unsigned int i = 0;
unsigned char j, k;
for(; i < len; ++i)
{
index1++;
index2 += perm[index1];
k = perm[index1];
perm[index1] = perm[index2];
perm[index2] = k;
j = perm[index1] + perm[index2];
output[i] = input[i] ^ perm[j];
}
}
};
//! Reverses the bytes in an array in the opposite order.
__inline void ReverseBytes(unsigned char * Pointer, unsigned int Length)
{
unsigned char * Temp = (unsigned char*)malloc(Length);
memcpy(Temp, Pointer, Length);
for(unsigned int i = 0; i < Length; ++i)
Pointer[i] = Temp[Length - i - 1];
free(Temp);
}
#endif // _SHARED_RC4ENGINE_H
|
// SPDX-License-Identifier: GPL-2.0
#ifndef LOCATIONINFORMATION_H
#define LOCATIONINFORMATION_H
#include "ui_locationInformation.h"
#include <stdint.h>
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
class LocationInformationWidget : public QGroupBox {
Q_OBJECT
public:
LocationInformationWidget(QWidget *parent = 0);
virtual bool eventFilter(QObject*, QEvent*);
protected:
void showEvent(QShowEvent *);
public slots:
void acceptChanges();
void rejectChanges();
void updateGpsCoordinates();
void markChangedWidget(QWidget *w);
void enableEdition();
void resetState();
void resetPallete();
void on_diveSiteCoordinates_textChanged(const QString& text);
void on_diveSiteDescription_textChanged(const QString& text);
void on_diveSiteName_textChanged(const QString& text);
void on_diveSiteNotes_textChanged();
void reverseGeocode();
void mergeSelectedDiveSites();
private slots:
void updateLabels();
signals:
void startEditDiveSite(uint32_t uuid);
void endEditDiveSite();
void coordinatesChanged();
void startFilterDiveSite(uint32_t uuid);
void stopFilterDiveSite();
void requestCoordinates();
void endRequestCoordinates();
private:
Ui::LocationInformation ui;
bool modified;
QAction *acceptAction, *rejectAction;
};
class DiveLocationFilterProxyModel : public QSortFilterProxyModel {
Q_OBJECT
public:
DiveLocationFilterProxyModel(QObject *parent = 0);
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
virtual bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const;
};
class DiveLocationModel : public QAbstractTableModel {
Q_OBJECT
public:
enum columns{UUID, NAME, LATITUDE, LONGITUDE, DESCRIPTION, NOTES, COLUMNS};
DiveLocationModel(QObject *o = 0);
void resetModel();
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const;
int columnCount(const QModelIndex& parent = QModelIndex()) const;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
private:
QString new_ds_value[2];
};
class DiveLocationListView : public QListView {
Q_OBJECT
public:
DiveLocationListView(QWidget *parent = 0);
protected:
virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous);
signals:
void currentIndexChanged(const QModelIndex& current);
};
class DiveLocationLineEdit : public QLineEdit {
Q_OBJECT
public:
enum DiveSiteType { NO_DIVE_SITE, NEW_DIVE_SITE, EXISTING_DIVE_SITE };
DiveLocationLineEdit(QWidget *parent =0 );
void refreshDiveSiteCache();
void setTemporaryDiveSiteName(const QString& s);
bool eventFilter(QObject*, QEvent*);
void itemActivated(const QModelIndex& index);
DiveSiteType currDiveSiteType() const;
uint32_t currDiveSiteUuid() const;
void fixPopupPosition();
void setCurrentDiveSiteUuid(uint32_t uuid);
signals:
void diveSiteSelected(uint32_t uuid);
void entered(const QModelIndex& index);
void currentChanged(const QModelIndex& index);
protected:
void keyPressEvent(QKeyEvent *ev);
void focusOutEvent(QFocusEvent *ev);
void showPopup();
private:
using QLineEdit::setText;
DiveLocationFilterProxyModel *proxy;
DiveLocationModel *model;
DiveLocationListView *view;
DiveSiteType currType;
uint32_t currUuid;
};
#endif
|
/*
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
* $Id: error.c,v 1.1 2010/09/29 21:11:21 oliverschmidt Exp $
*/
#include <stdlib.h>
#include "sys/log.h"
#include "lib/error.h"
/*-----------------------------------------------------------------------------------*/
void
error_exit(void)
{
log_message("Press any key to continue ...", "");
ctk_arch_getkey();
exit(EXIT_FAILURE);
}
/*-----------------------------------------------------------------------------------*/
|
#include "ir_distance_hw.h"
void system_init( void );
void system_init()
{
ADC1_Init();
// Initialize hardware UART1 module on PORTA at 115200 bps, 8 data, no parity and 1 stop bit :
UART1_Init_Advanced(115200, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART1_PA9_10);
ir_measure_init( ADC1_Read, 4, RESOLUTION_12 );
UART1_Write_Text( "Here and Ready\r\n" );
}
void main()
{
char tmp_text[20];
system_init();
while( 1 )
{
sprintf( tmp_text, "Distance is: %4.2f\r\n", ir_measure_cm() );
UART1_Write_Text( tmp_text );
Delay_ms( 500 );
}
} |
/* PR optimization/12510 */
/* Origin: Lars Skovlund <lskovlun@image.dk> */
/* Reduced testcase by Volker Reichelt <reichelt@igpm.rwth-aachen.de> */
/* Verify that one splitting pass is not missing on x86 at -O1 */
/* { dg-do compile } */
/* { dg-options "-O -mcpu=i686" { target i?86-*-* } } */
extern foo(double);
void bar(double x, double y)
{
foo (x);
if (y) x = y ? 0 : 1/y;
else if (y) x = y < 1 ? 1 : y;
else x = 1/y < 1 ? 1 : x;
foo (x);
}
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Save to raw, headerless h264 data.
* \arg File name extension: h264
* \ingroup formats
* \arg See \ref AstVideo
*/
/*** MODULEINFO
<support_level>core</support_level>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/mod_format.h"
#include "asterisk/module.h"
#include "asterisk/endian.h"
/* Some Ideas for this code came from makeh264e.c by Jeffrey Chilton */
/* Portions of the conversion code are by guido@sienanet.it */
/*! \todo Check this buf size estimate, it may be totally wrong for large frame video */
#define BUF_SIZE 4096 /* Two Real h264 Frames */
struct h264_desc {
unsigned int lastts;
};
static int h264_open(struct ast_filestream *s)
{
unsigned int ts;
int res;
if ((res = fread(&ts, 1, sizeof(ts), s->f)) < sizeof(ts)) {
ast_log(LOG_WARNING, "Empty file!\n");
return -1;
}
return 0;
}
static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)
{
int res;
int mark = 0;
unsigned short len;
unsigned int ts;
struct h264_desc *fs = (struct h264_desc *)s->_private;
/* Send a frame from the file to the appropriate channel */
if ((res = fread(&len, 1, sizeof(len), s->f)) < 1)
return NULL;
len = ntohs(len);
mark = (len & 0x8000) ? 1 : 0;
len &= 0x7fff;
if (len > BUF_SIZE) {
ast_log(LOG_WARNING, "Length %d is too long\n", len);
len = BUF_SIZE; /* XXX truncate */
}
s->fr.frametype = AST_FRAME_VIDEO;
ast_format_set(&s->fr.subclass.format, AST_FORMAT_H264, 0);
s->fr.mallocd = 0;
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
if (res)
ast_log(LOG_WARNING, "Short read (%d of %d) (%s)!\n", res, len, strerror(errno));
return NULL;
}
s->fr.samples = fs->lastts;
s->fr.datalen = len;
if (mark) {
ast_format_set_video_mark(&s->fr.subclass.format);
}
s->fr.delivery.tv_sec = 0;
s->fr.delivery.tv_usec = 0;
if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
fs->lastts = ntohl(ts);
*whennext = fs->lastts * 4/45;
} else
*whennext = 0;
return &s->fr;
}
static int h264_write(struct ast_filestream *s, struct ast_frame *f)
{
int res;
unsigned int ts;
unsigned short len;
int mark;
if (f->frametype != AST_FRAME_VIDEO) {
ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
return -1;
}
mark = ast_format_get_video_mark(&f->subclass.format) ? 0x8000 : 0;
if (f->subclass.format.id != AST_FORMAT_H264) {
ast_log(LOG_WARNING, "Asked to write non-h264 frame (%s)!\n", ast_getformatname(&f->subclass.format));
return -1;
}
ts = htonl(f->samples);
if ((res = fwrite(&ts, 1, sizeof(ts), s->f)) != sizeof(ts)) {
ast_log(LOG_WARNING, "Bad write (%d/4): %s\n", res, strerror(errno));
return -1;
}
len = htons(f->datalen | mark);
if ((res = fwrite(&len, 1, sizeof(len), s->f)) != sizeof(len)) {
ast_log(LOG_WARNING, "Bad write (%d/2): %s\n", res, strerror(errno));
return -1;
}
if ((res = fwrite(f->data.ptr, 1, f->datalen, s->f)) != f->datalen) {
ast_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
return -1;
}
return 0;
}
static int h264_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
{
/* No way Jose */
return -1;
}
static int h264_trunc(struct ast_filestream *fs)
{
int fd;
off_t cur;
if ((fd = fileno(fs->f)) < 0) {
ast_log(AST_LOG_WARNING, "Unable to determine file descriptor for h264 filestream %p: %s\n", fs, strerror(errno));
return -1;
}
if ((cur = ftello(fs->f)) < 0) {
ast_log(AST_LOG_WARNING, "Unable to determine current position in h264 filestream %p: %s\n", fs, strerror(errno));
return -1;
}
/* Truncate file to current length */
return ftruncate(fd, cur);
}
static off_t h264_tell(struct ast_filestream *fs)
{
off_t offset = ftell(fs->f);
return offset; /* XXX totally bogus, needs fixing */
}
static struct ast_format_def h264_f = {
.name = "h264",
.exts = "h264",
.open = h264_open,
.write = h264_write,
.seek = h264_seek,
.trunc = h264_trunc,
.tell = h264_tell,
.read = h264_read,
.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
.desc_size = sizeof(struct h264_desc),
};
static int load_module(void)
{
ast_format_set(&h264_f.format, AST_FORMAT_H264, 0);
if (ast_format_def_register(&h264_f))
return AST_MODULE_LOAD_FAILURE;
return AST_MODULE_LOAD_SUCCESS;
}
static int unload_module(void)
{
return ast_format_def_unregister(h264_f.name);
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw H.264 data",
.load = load_module,
.unload = unload_module,
.load_pri = AST_MODPRI_APP_DEPEND
);
|
/**
******************************************************************************
* @file BSP/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.2.3
* @date 09-October-2015
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void EXTI0_IRQHandler(void);
void EXTI2_IRQHandler(void);
void EXTI15_10_IRQHandler(void);
#ifdef EE_M24LR64
void EEPROM_I2C_DMA_TX_IRQHandler(void);
void EEPROM_I2C_DMA_RX_IRQHandler(void);
#endif /*EE_M24LR64*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
* $Id$
* Copyright (C) 2008 - 2014 Nils Asmussen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <sys/common.h>
#include <sys/debug.h>
#include <sys/io.h>
#include <sys/proc.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "../modules.h"
static void sig_segf(A_UNUSED int sig) {
printf("GOT SIGSEGV!\n");
exit(EXIT_FAILURE);
}
int mod_fault(A_UNUSED int argc,A_UNUSED char *argv[]) {
uint *ptr;
int fd;
if(signal(SIGSEGV,sig_segf) == SIG_ERR)
error("Unable to set signal-handler");
printf("I am evil ^^\n");
fd = open((char*)0x12345678,O_RDONLY);
ptr = (uint*)0xFFFFFFFF;
*ptr = 1;
printf("Never printed\n");
close(fd);
return EXIT_SUCCESS;
}
|
#ifndef _regexsf_misc_Utils_H_
#define _regexsf_misc_Utils_H_
#include "../common.h"
namespace regexsf {
// TODO some of this is in boost/utility?...
class Utils {
public:
template <typename Iter> static Iter next(Iter iter) {
return ++iter;
}
template <typename Iter, typename Cont> static bool isLast(Iter iter, const Cont& cont) {
return (iter != cont.end()) && (next(iter) == cont.end());
}
static unsigned int parseUInt(const TString& s);
};
};
#endif
|
#ifndef __ASM_ARCH_HARDWARE_H
#define __ASM_ARCH_HARDWARE_H
#define IO_BASE 0xF0000000
#define IO_SIZE 0x00100000
#define IO_START 0x80000000
#define IO_ADDRESS(x) (((x) & 0x000fffff) | IO_BASE)
#endif
|
/*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/seterr.h>
#include <rtems/posix/time.h>
/*
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
*/
int clock_getcpuclockid(
pid_t pid,
clockid_t *clock_id
)
{
rtems_set_errno_and_return_minus_one( ENOSYS );
}
|
#include <stdio.h>
void increment (void);
void increment (void)
{
static int static_var = 0;
printf ("%d\n", static_var);
++static_var;
return;
}
int main (void)
{
increment ();
increment ();
increment ();
increment ();
return 0;
}
|
/*
* The ManaPlus Client
* Copyright (C) 2004 The Mana World Development Team
* Copyright (C) 2011-2015 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 NET_BEINGHANDLER_H
#define NET_BEINGHANDLER_H
#include "being/being.h"
#include "enums/being/rank.h"
namespace Net
{
class BeingHandler notfinal
{
public:
virtual ~BeingHandler()
{ }
virtual void requestNameById(const BeingId id) const = 0;
virtual void requestNameByCharId(const int id) const = 0;
virtual void undress(Being *const being) const = 0;
virtual void requestRanks(const RankT rank) const = 0;
};
} // namespace Net
extern Net::BeingHandler *beingHandler;
#endif // NET_BEINGHANDLER_H
|
/* ---------------------------------------------------------------------------
_modulong.c - 32 bit modulus routines for pic14 devices
Copyright (C) 2005, Raphael Neider <rneider AT web.de>
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.
-------------------------------------------------------------------------*/
unsigned long
_modulong (unsigned long a, unsigned long b)
{
unsigned char count = 1;
/* prevent endless loop (division by zero exception?!?) */
if (!b) return (unsigned long)-1;
/* it would suffice to make b >= a, but that test is
* more complex and will fail if a has its MSB set */
while (!(b & (1UL << (8*sizeof(unsigned long)-1)))) {
b <<= 1;
++count;
} // while
/* now subtract all the powers of two (of b) that "fit" into a */
while (count) {
if (a >= b) {
a -= b;
} // if
b >>= 1;
--count;
} // while
return a;
}
|
/* Copyright (C) 2014 by John Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef BITMAP_H
#define BITMAP_H
#define EW_BITMAP_TYPE_GUESS 0
#ifdef HAVE_LIBPNG
#define EW_BITMAP_TYPE_PNG 1
#endif
#define EW_BITMAP_STRETCH_NONE 0
#define EW_BITMAP_STRETCH_TILE 1
#define EW_BITMAP_STRETCH_FILL 2
#define EW_BITMAP_STRETCH_CENTER 3
typedef struct _ew_bitmap
{
char *fname;
int bitmap_type;
int stretch;
long int bmp_size;
unsigned char *bmp_data;
} EW_BITMAP;
EFI_STATUS ew_create_bitmap(WINDOW **w, RECT *loc, WINDOW *parent, EW_BITMAP *info);
#endif
|
/**
******************************************************************************
* @file RTC/RTC_Tamper/Src/stm32f4xx_hal_msp.c
* @author MCD Application Team
* @version V1.1.1
* @date 09-October-2015
* @brief HAL MSP module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/** @addtogroup stm32f4xx_HAL_Examples
* @{
*/
/** @defgroup RTC_Tamper
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup HAL_MSP_Private_Functions
* @{
*/
/**
* @brief RTC MSP Initialization
* This function configures the hardware resources used in this example
* @param hrtc: RTC handle pointer
*
* @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select
* the RTC clock source; in this case the Backup domain will be reset in
* order to modify the RTC Clock source, as consequence RTC registers (including
* the backup registers) and RCC_BDCR register are set to their reset values.
*
* @retval None
*/
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
/*##-2- Configure LSE/LSI as RTC clock source ###############################*/
#ifdef RTC_CLOCK_SOURCE_LSE
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
#elif defined (RTC_CLOCK_SOURCE_LSI)
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
#else
#error Please select the RTC Clock source inside the main.h file
#endif /*RTC_CLOCK_SOURCE_LSE*/
/*##-3- Enable RTC peripheral Clocks #######################################*/
/* Enable RTC Clock */
__HAL_RCC_RTC_ENABLE();
/*##-4- Configure the NVIC for RTC Tamper ###################################*/
HAL_NVIC_SetPriority(TAMP_STAMP_IRQn, 0x0F, 0);
HAL_NVIC_EnableIRQ(TAMP_STAMP_IRQn);
}
/**
* @brief RTC MSP De-Initialization
* This function frees the hardware resources used in this example:
* - Disable the Peripheral's clock
* @param hrtc: RTC handle pointer
* @retval None
*/
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
{
/*##-1- Reset peripherals ##################################################*/
__HAL_RCC_RTC_DISABLE();
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/* This is a trivial uptime program. I hereby release this program
* into the public domain. I disclaim any responsibility for this
* program --- use it at your own risk. (as if there were any.. ;-)
* -michaelkjohnson (johnsonm@sunsite.unc.edu)
*
* Modified by Larry Greenfield to give a more traditional output,
* count users, etc. (greenfie@gauss.rutgers.edu)
*
* Modified by mkj again to fix a few tiny buglies.
*
* Modified by J. Cowley to add printing the uptime message to a
* string (for top) and to optimize file handling. 19 Mar 1993.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <utmp.h>
#include <sys/ioctl.h>
#include "whattime.h"
#include "sysinfo.h"
static char buf[128];
static double av[3];
char *sprint_uptime(void) {
struct utmp *utmpstruct;
int upminutes, uphours, updays;
int pos;
struct tm *realtime;
time_t realseconds;
int numuser;
double uptime_secs, idle_secs;
/* first get the current time */
time(&realseconds);
realtime = localtime(&realseconds);
pos = sprintf(buf, " %02d:%02d:%02d ",
realtime->tm_hour, realtime->tm_min, realtime->tm_sec);
/* read and calculate the amount of uptime */
uptime(&uptime_secs, &idle_secs);
updays = (int) uptime_secs / (60*60*24);
strcat (buf, "up ");
pos += 3;
if (updays)
pos += sprintf(buf + pos, "%d day%s, ", updays, (updays != 1) ? "s" : "");
upminutes = (int) uptime_secs / 60;
uphours = upminutes / 60;
uphours = uphours % 24;
upminutes = upminutes % 60;
if(uphours)
pos += sprintf(buf + pos, "%2d:%02d, ", uphours, upminutes);
else
pos += sprintf(buf + pos, "%d min, ", upminutes);
/* count the number of users */
numuser = 0;
setutent();
while ((utmpstruct = getutent())) {
if ((utmpstruct->ut_type == USER_PROCESS) &&
(utmpstruct->ut_name[0] != '\0'))
numuser++;
}
endutent();
pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s");
loadavg(&av[0], &av[1], &av[2]);
pos += sprintf(buf + pos, " load average: %.2f, %.2f, %.2f",
av[0], av[1], av[2]);
return buf;
}
void print_uptime(void)
{
printf("%s\n", sprint_uptime());
}
|
/*
* This file is part of the coreboot project.
*
* Copyright 2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef SOC_INTEL_COMMON_MSR_H
#define SOC_INTEL_COMMON_MSR_H
#define MSR_CORE_THREAD_COUNT 0x35
#define IA32_FEATURE_CONTROL 0x3a
#define FEATURE_CONTROL_LOCK (1)
#define CPUID_VMX (1 << 5)
#define CPUID_SMX (1 << 6)
#define SGX_GLOBAL_ENABLE (1 << 18)
#define PLATFORM_INFO_SET_TDP (1 << 29)
#define MSR_PLATFORM_INFO 0xce
#define MSR_PMG_CST_CONFIG_CONTROL 0xe2
/* Set MSR_PMG_CST_CONFIG_CONTROL[3:0] for Package C-State limit */
#define PKG_C_STATE_LIMIT_C2_MASK 0x2
/* Set MSR_PMG_CST_CONFIG_CONTROL[7:4] for Core C-State limit*/
#define CORE_C_STATE_LIMIT_C10_MASK 0x70
/* Set MSR_PMG_CST_CONFIG_CONTROL[10] to IO redirect to MWAIT */
#define IO_MWAIT_REDIRECT_MASK 0x400
/* Set MSR_PMG_CST_CONFIG_CONTROL[15] to lock CST_CFG [0-15] bits */
#define CST_CFG_LOCK_MASK 0x8000
#define MSR_BIOS_UPGD_TRIG 0x7a
#define SGX_ACTIVATE_BIT (1)
#define MSR_PMG_IO_CAPTURE_BASE 0xe4
#define MSR_POWER_MISC 0x120
#define ENABLE_IA_UNTRUSTED (1 << 6)
#define FLUSH_DL1_L2 (1 << 8)
#define MSR_EMULATE_PM_TMR 0x121
#define EMULATE_DELAY_OFFSET_VALUE 20
#define EMULATE_PM_TMR_EN (1 << 16)
#define MSR_FEATURE_CONFIG 0x13c
#define FEATURE_CONFIG_RESERVED_MASK 0x3ULL
#define FEATURE_CONFIG_LOCK (1 << 0)
#define IA32_MCG_CAP 0x179
#define SMM_MCA_CAP_MSR 0x17d
#define SMM_CPU_SVRSTR_BIT 57
#define SMM_CPU_SVRSTR_MASK (1 << (SMM_CPU_SVRSTR_BIT - 32))
#define MSR_FLEX_RATIO 0x194
#define FLEX_RATIO_LOCK (1 << 20)
#define FLEX_RATIO_EN (1 << 16)
#define MSR_IA32_PERF_CTL 0x199
#define IA32_MISC_ENABLE 0x1a0
/* This is burst mode BIT 38 in MSR_IA32_MISC_ENABLES MSR at offset 1A0h */
#define BURST_MODE_DISABLE (1 << 6)
#define MSR_TEMPERATURE_TARGET 0x1a2
#define MSR_PREFETCH_CTL 0x1a4
#define PREFETCH_L1_DISABLE (1 << 0)
#define PREFETCH_L2_DISABLE (1 << 2)
#define MSR_MISC_PWR_MGMT 0x1aa
#define MISC_PWR_MGMT_EIST_HW_DIS (1 << 0)
#define MISC_PWR_MGMT_ISST_EN (1 << 6)
#define MISC_PWR_MGMT_ISST_EN_INT (1 << 7)
#define MISC_PWR_MGMT_ISST_EN_EPP (1 << 12)
#define MSR_TURBO_RATIO_LIMIT 0x1ad
#define PRMRR_PHYS_BASE_MSR 0x1f4
#define PRMRR_PHYS_MASK_MSR 0x1f5
#define PRMRR_PHYS_MASK_LOCK (1 << 10)
#define PRMRR_PHYS_MASK_VALID (1 << 11)
#define MSR_POWER_CTL 0x1fc
#define MSR_EVICT_CTL 0x2e0
#define UNCORE_PRMRR_PHYS_BASE_MSR 0x2f4
#define UNCORE_PRMRR_PHYS_MASK_MSR 0x2f5
#define MSR_SGX_OWNEREPOCH0 0x300
#define MSR_SGX_OWNEREPOCH1 0x301
#define IA32_MC0_CTL 0x400
#define IA32_MC0_STATUS 0x401
#define SMM_FEATURE_CONTROL_MSR 0x4e0
#define SMM_CPU_SAVE_EN (1 << 1)
#define MSR_PKG_POWER_SKU_UNIT 0x606
#define MSR_C_STATE_LATENCY_CONTROL_0 0x60a
#define MSR_C_STATE_LATENCY_CONTROL_1 0x60b
#define MSR_C_STATE_LATENCY_CONTROL_2 0x60c
#define MSR_PKG_POWER_LIMIT 0x610
/*
* For Mobile, RAPL default PL1 time window value set to 28 seconds.
* RAPL time window calculation defined as follows:
* Time Window = (float)((1+X/4)*(2*^Y), X Corresponds to [23:22],
* Y to [21:17] in MSR 0x610. 28 sec is equal to 0x6e.
*/
#define MB_POWER_LIMIT1_TIME_DEFAULT 0x6e
#define MSR_PKG_POWER_SKU 0x614
#define MSR_DDR_RAPL_LIMIT 0x618
#define MSR_C_STATE_LATENCY_CONTROL_3 0x633
#define MSR_C_STATE_LATENCY_CONTROL_4 0x634
#define MSR_C_STATE_LATENCY_CONTROL_5 0x635
#define IRTL_VALID (1 << 15)
#define IRTL_1_NS (0 << 10)
#define IRTL_32_NS (1 << 10)
#define IRTL_1024_NS (2 << 10)
#define IRTL_32768_NS (3 << 10)
#define IRTL_1048576_NS (4 << 10)
#define IRTL_33554432_NS (5 << 10)
#define IRTL_RESPONSE_MASK (0x3ff)
#define MSR_COUNTER_24_MHZ 0x637
#define MSR_CONFIG_TDP_NOMINAL 0x648
#define MSR_CONFIG_TDP_LEVEL1 0x649
#define MSR_CONFIG_TDP_LEVEL2 0x64a
#define MSR_CONFIG_TDP_CONTROL 0x64b
#define MSR_TURBO_ACTIVATION_RATIO 0x64c
#define PKG_POWER_LIMIT_MASK (0x7fff)
#define PKG_POWER_LIMIT_EN (1 << 15)
#define PKG_POWER_LIMIT_CLAMP (1 << 16)
#define PKG_POWER_LIMIT_TIME_SHIFT 17
#define PKG_POWER_LIMIT_TIME_MASK (0x7f)
/* SMM save state MSRs */
#define SMBASE_MSR 0xc20
#define IEDBASE_MSR 0xc22
#define MSR_IA32_PQR_ASSOC 0x0c8f
/* MSR bits 33:32 encode slot number 0-3 */
#define IA32_PQR_ASSOC_MASK (1 << 0 | 1 << 1)
#define MSR_IA32_L3_MASK_1 0x0c91
#define MSR_IA32_L3_MASK_2 0x0c92
#define MSR_L2_QOS_MASK(reg) (0xd10 + reg)
/* MTRR_CAP_MSR bits */
#define SMRR_SUPPORTED (1<<11)
#define PRMRR_SUPPORTED (1<<12)
#define SGX_SUPPORTED (1<<2)
#endif /* SOC_INTEL_COMMON_MSR_H */
|
#ifndef SVO_RELOCALIZATION_IMG_ALING_SE2_H
#define SVO_RELOCALIZATION_IMG_ALING_SE2_H
#include <opencv2/opencv.hpp>
#include <sophus/se2.h>
#include <vikit/nlls_solver.h>
namespace reloc
{
class SecondOrderMinimizationSE2 : public vk::NLLSSolver<3,Sophus::SE2>
{
public:
SecondOrderMinimizationSE2 (const cv::Mat& im, const cv::Mat& im_template);
virtual ~SecondOrderMinimizationSE2 ();
protected:
virtual double
computeResiduals (
const Sophus::SE2& model,
bool linearize_system,
bool compute_weight_scale = false);
virtual int
solve();
virtual void
update(const Sophus::SE2& old_model, Sophus::SE2& new_model);
virtual void
startIteration();
virtual void
finishIteration();
private:
/* data */
cv::Mat im_;
cv::Mat im_template_;
cv::Mat im_template_grad_x_;
cv::Mat im_template_grad_y_;
};
} /* reloc */
#endif /* end of include guard: SVO_RELOCALIZATION_IMG_ALING_SE2_H */
|
/***************************************************************************
* Copyright (C) 2016 by Jan Grulich <jgrulich@redhat.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* 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 POWERDEVIL_BUNDLEDACTIONS_WIRELESSPOWERSAVINGCONFIG_H
#define POWERDEVIL_BUNDLEDACTIONS_WIRELESSPOWERSAVINGCONFIG_H
#include <powerdevilactionconfig.h>
class QComboBox;
namespace PowerDevil {
namespace BundledActions {
class WirelessPowerSavingConfig : public PowerDevil::ActionConfig
{
Q_OBJECT
Q_DISABLE_COPY(WirelessPowerSavingConfig)
public:
WirelessPowerSavingConfig(QObject* parent, const QVariantList&);
~WirelessPowerSavingConfig() override;
void save() override;
void load() override;
QList< QPair< QString, QWidget* > > buildUi() override;
private:
QComboBox *m_btCombobox;
QComboBox *m_wifiCombobox;
QComboBox *m_wwanCombobox;
};
}
}
#endif // POWERDEVIL_BUNDLEDACTIONS_WIRELESSPOWERSAVINGCONFIG_H
|
// Copyright (C) 1999-2000 Id Software, Inc.
//
// bg_local.h -- local definitions for the bg (both games) files
#define MIN_WALK_NORMAL 0.7f // can't walk on very steep slopes
#define TIMER_LAND 130
#define TIMER_GESTURE (34*66+50)
#define OVERCLIP 1.001f
// all of the locals will be zeroed before each
// pmove, just to make damn sure we don't have
// any differences when running on client or server
typedef struct
{
vec3_t forward, right, up;
float frametime;
int msec;
qboolean walking;
qboolean groundPlane;
trace_t groundTrace;
float impactSpeed;
vec3_t previous_origin;
vec3_t previous_velocity;
int previous_waterlevel;
} pml_t;
#include "namespace_begin.h"
extern pml_t pml;
// movement parameters
extern float pm_stopspeed;
extern float pm_duckScale;
extern float pm_swimScale;
extern float pm_wadeScale;
extern float pm_accelerate;
extern float pm_airaccelerate;
extern float pm_wateraccelerate;
extern float pm_flyaccelerate;
extern float pm_friction;
extern float pm_waterfriction;
extern float pm_flightfriction;
extern int c_pmove;
extern int forcePowerNeeded[NUM_FORCE_POWER_LEVELS][NUM_FORCE_POWERS];
// Had to add these here because there was no file access within the BG right now.
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
#include "namespace_end.h"
//PM anim utility functions:
#include "namespace_begin.h"
qboolean PM_SaberInParry( int move );
qboolean PM_SaberInKnockaway( int move );
qboolean PM_SaberInReflect( int move );
qboolean PM_SaberInStart( int move );
qboolean PM_InSaberAnim( int anim );
qboolean PM_InKnockDown( playerState_t *ps );
qboolean PM_PainAnim( int anim );
qboolean PM_JumpingAnim( int anim );
qboolean PM_LandingAnim( int anim );
qboolean PM_SpinningAnim( int anim );
qboolean PM_InOnGroundAnim ( int anim );
qboolean PM_InRollComplete( playerState_t *ps, int anim );
int PM_AnimLength( int index, animNumber_t anim );
int PM_GetSaberStance(void);
float PM_GroundDistance(void);
qboolean PM_SomeoneInFront(trace_t *tr);
saberMoveName_t PM_SaberFlipOverAttackMove(void);
saberMoveName_t PM_SaberJumpAttackMove( void );
void PM_ClipVelocity( vec3_t in, vec3_t normal, vec3_t out, float overbounce );
void PM_AddTouchEnt( int entityNum );
void PM_AddEvent( int newEvent );
qboolean PM_SlideMove( qboolean gravity );
void PM_StepSlideMove( qboolean gravity );
void PM_StartTorsoAnim( int anim );
void PM_ContinueLegsAnim( int anim );
void PM_ForceLegsAnim( int anim );
void PM_BeginWeaponChange( int weapon );
void PM_FinishWeaponChange( void );
void PM_SetAnim(int setAnimParts,int anim,int setAnimFlags, int blendTime);
void PM_WeaponLightsaber(void);
void PM_SetSaberMove(short newMove);
void PM_SetForceJumpZStart(float value);
void BG_CycleInven(playerState_t *ps, int direction);
#include "namespace_end.h"
|
//
// This file is part of Gambit
// Copyright (c) 1994-2010, The Gambit Project (http://www.gambit-project.org)
//
// FILE: src/tools/enumpoly/behavextend.h
// Algorithms for extending behavior profiles to Nash equilibria
//
// 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 BEHAVEXTEND_H
#define BEHAVEXTEND_H
#include "libgambit/libgambit.h"
class algExtendsToNash {
public:
bool ExtendsToNash(const Gambit::MixedBehavProfile<double> &p_solution,
const Gambit::BehavSupport &p_littleSupport,
const Gambit::BehavSupport &p_bigSupport);
};
class algExtendsToAgentNash {
public:
bool ExtendsToAgentNash(const Gambit::MixedBehavProfile<double> &p_solution,
const Gambit::BehavSupport &p_littleSupport,
const Gambit::BehavSupport &p_bigSupport);
};
#endif // BEHAVEXTEND_H
|
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2007 Joerg Wunsch
*
* 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/>.
*/
/* $Id: avrdude.h 1294 2014-03-12 23:03:18Z joerg_wunsch $ */
#ifndef avrdude_h
#define avrdude_h
extern char * progname; /* name of program, for messages */
extern char progbuf[]; /* spaces same length as progname */
extern int ovsigck; /* override signature check (-F) */
extern int verbose; /* verbosity level (-v, -vv, ...) */
extern int quell_progress; /* quiteness level (-q, -qq) */
#if defined(WIN32NATIVE)
#include "ac_cfg.h"
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(HAVE_USLEEP)
int usleep(unsigned int us);
#endif
#if !defined(HAVE_GETTIMEOFDAY)
struct timezone;
int gettimeofday(struct timeval *tv, struct timezone *tz);
#endif /* HAVE_GETTIMEOFDAY */
#ifdef __cplusplus
}
#endif
#endif /* defined(WIN32NATIVE) */
#include <stdio.h>
struct list_walk_cookie
{
FILE *f;
const char *prefix;
void* obj;
};
#endif
|
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: bing.wei.liu REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
* Test that pthread_mutexattr_setprioceiling()
*
* It MAY fail if:
*
* [EINVAL] - 'attr' or 'prioceiling' is invalid.
* [EPERM] - The caller doesn't have the privilege to perform the operation.
*
* Steps:
* 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init()
* 2. Call pthread_mutexattr_setprioceiling() with an invalid prioceiling value.
*
*/
#include <pthread.h>
#include <stdio.h>
#include <sched.h>
#include <errno.h>
#include "posixtest.h"
int main()
{
/* Make sure there is prioceiling capability. */
/* #ifndef _POSIX_PRIORITY_SCHEDULING
fprintf(stderr,"prioceiling attribute is not available for testing\n");
return PTS_UNRESOLVED;
#endif */
pthread_mutexattr_t mta;
int prioceiling, ret;
/* Set 'prioceiling' out of SCHED_FIFO boundry. */
prioceiling = sched_get_priority_max(SCHED_FIFO);
prioceiling++;
/* Set the prioceiling to an invalid prioceiling. */
if ((ret = pthread_mutexattr_setprioceiling(&mta, prioceiling)) == 0) {
printf
("Test PASSED: *Note: Returned 0 instead of EINVAL when passed an invalid 'proceiling' to pthread_mutexattr_setprioceiling, but standard says 'may' fail.\n");
return PTS_PASS;
}
if (ret != EINVAL) {
printf
("Test FAILED: Invalid return code %d. Expected EINVAL or 0.\n",
ret);
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
}
|
// Copyleft 2012 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 26mar12 initial version
01 13apr12 standardize thread function
02 13apr12 add OnEndSlotChange
03 23may12 add dtor, output queue pointer
04 31may12 remove worker thread
05 01jun12 refactor bypass and pause
parallel engine plugin output tap
*/
#pragma once
#include "FrameQueue.h"
class CFFEngine;
class CFFPluginEx;
class CEngineTap : public WObject {
public:
// Construction
CEngineTap();
// Attributes
bool IsAttached() const;
bool IsBypassed() const;
CFFPluginEx *GetPlugin();
const CFFPluginEx *GetPlugin() const;
void SetPlugin(CFFPluginEx *Plugin);
CFrameQueue *GetOutputQueue();
void SetOutputQueue(CFrameQueue *Queue);
LPCTSTR GetPluginName() const;
// Operations
bool Attach(CFFPluginEx& Plugin);
bool Detach();
bool Bypass(bool Enable);
void RunInit();
bool Pause(bool Enable);
int OnEndSlotChange();
protected:
// Data members
CFrameQueue *m_OutputQueue; // pointer to output frame queue
CFFPluginEx *m_Plugin; // pointer to attached plugin
CFFPluginEx *m_PausePlugin; // pointer to connected plugin at start of pause
UINT m_PluginUID; // tapped plugin's unique ID
WEvent m_OutputEvent; // event for diverting helper output token ring
bool m_IsBypassed; // true if bypassed
bool m_IsPaused; // true if paused
// Helpers
bool Work();
bool Connect(CFFPluginEx& Plugin);
bool Disconnect(CFFPluginEx& Plugin);
bool SuspendOutput(CFFPluginEx& Plugin, bool Enable);
static UINT ThreadFunc(LPVOID Arg);
};
inline bool CEngineTap::IsAttached() const
{
return(m_Plugin != NULL);
}
inline bool CEngineTap::IsBypassed() const
{
return(m_IsBypassed);
}
inline CFFPluginEx *CEngineTap::GetPlugin()
{
return(m_Plugin);
}
inline const CFFPluginEx *CEngineTap::GetPlugin() const
{
return(m_Plugin);
}
inline CFrameQueue *CEngineTap::GetOutputQueue()
{
return(m_OutputQueue);
}
inline void CEngineTap::SetOutputQueue(CFrameQueue *Queue)
{
m_OutputQueue = Queue;
}
|
/*******************************************************************************
* File Name: USBUART_1_hid.h
* Version 2.60
*
* Description:
* Header File for the USFS component. Contains prototypes and constant values.
*
********************************************************************************
* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_USBFS_USBUART_1_hid_H)
#define CY_USBFS_USBUART_1_hid_H
#include "cytypes.h"
/***************************************
* Prototypes of the USBUART_1_hid API.
***************************************/
uint8 USBUART_1_UpdateHIDTimer(uint8 interface) ;
uint8 USBUART_1_GetProtocol(uint8 interface) ;
/***************************************
*Renamed Functions for backward compatible
***************************************/
#define USBUART_1_bGetProtocol USBUART_1_GetProtocol
/***************************************
* Constants for USBUART_1_hid API.
***************************************/
#define USBUART_1_PROTOCOL_BOOT (0x00u)
#define USBUART_1_PROTOCOL_REPORT (0x01u)
/* Request Types (HID Chapter 7.2) */
#define USBUART_1_HID_GET_REPORT (0x01u)
#define USBUART_1_HID_GET_IDLE (0x02u)
#define USBUART_1_HID_GET_PROTOCOL (0x03u)
#define USBUART_1_HID_SET_REPORT (0x09u)
#define USBUART_1_HID_SET_IDLE (0x0Au)
#define USBUART_1_HID_SET_PROTOCOL (0x0Bu)
/* Descriptor Types (HID Chapter 7.1) */
#define USBUART_1_DESCR_HID_CLASS (0x21u)
#define USBUART_1_DESCR_HID_REPORT (0x22u)
#define USBUART_1_DESCR_HID_PHYSICAL (0x23u)
/* Report Request Types (HID Chapter 7.2.1) */
#define USBUART_1_HID_GET_REPORT_INPUT (0x01u)
#define USBUART_1_HID_GET_REPORT_OUTPUT (0x02u)
#define USBUART_1_HID_GET_REPORT_FEATURE (0x03u)
#endif /* End CY_USBFS_USBUART_1_hid_H */
/* [] END OF FILE */
|
#ifndef CSVSTREAM_H_
#define CSVSTREAM_H_
// Uncomment following line to enable debugging messages
// #define DEBUG
#include <iostream>
#include <cstring>
#include <vector>
#include <cassert>
//#include <itpp/itbase.h>
//using namespace itpp;//comment by jignbo
#include "armadillo"//add by jingbo
using namespace std;
using namespace arma;
#define debug_msg(msg)
/**
* This class provides support for reading from and
* writing to CSV (comma separated values) files. At the moment,
* it only supports reading to and writing from matrices, and does
* not (yet) work like a proper C++ stream, although support for
* streamed input/output will be added later.
*/
class csvstream
{
public:
csvstream();
virtual ~csvstream();
int read(mat &matrix, const string filename);
int write(const mat matrix, const string filename, int decimals = 5);
};
#endif /*CSVSTREAM_H_*/
|
/*
* gedit-notebook.h
* This file is part of gedit
*
* Copyright (C) 2005 - Paolo Maggi
*
* 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/>.
*/
/*
* Modified by the gedit Team, 2005. See the AUTHORS file for a
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*/
/* This file is a modified version of the epiphany file ephy-notebook.h
* Here the relevant copyright:
*
* Copyright (C) 2002 Christophe Fergeau
* Copyright (C) 2003 Marco Pesenti Gritti
* Copyright (C) 2003, 2004 Christian Persch
*
*/
#ifndef GEDIT_NOTEBOOK_H
#define GEDIT_NOTEBOOK_H
#include <gedit/gedit-tab.h>
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define GEDIT_TYPE_NOTEBOOK (gedit_notebook_get_type ())
#define GEDIT_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebook))
#define GEDIT_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
#define GEDIT_IS_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_NOTEBOOK))
#define GEDIT_IS_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_NOTEBOOK))
#define GEDIT_NOTEBOOK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
/* This is now used in multi-notebook but we keep the same enum for
* backward compatibility since it is used in the gsettings schema */
typedef enum
{
GEDIT_NOTEBOOK_SHOW_TABS_NEVER,
GEDIT_NOTEBOOK_SHOW_TABS_AUTO,
GEDIT_NOTEBOOK_SHOW_TABS_ALWAYS
} GeditNotebookShowTabsModeType;
/* Private structure type */
typedef struct _GeditNotebookPrivate GeditNotebookPrivate;
/*
* Main object structure
*/
typedef struct _GeditNotebook GeditNotebook;
struct _GeditNotebook
{
GtkNotebook notebook;
/*< private >*/
GeditNotebookPrivate *priv;
};
/*
* Class definition
*/
typedef struct _GeditNotebookClass GeditNotebookClass;
struct _GeditNotebookClass
{
GtkNotebookClass parent_class;
/* Signals */
void (* tab_close_request) (GeditNotebook *notebook,
GeditTab *tab);
void (* show_popup_menu) (GeditNotebook *notebook,
GdkEvent *event,
GeditTab *tab);
gboolean(* change_to_page) (GeditNotebook *notebook,
gint page_num);
};
/*
* Public methods
*/
GType gedit_notebook_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_notebook_new (void);
void gedit_notebook_add_tab (GeditNotebook *nb,
GeditTab *tab,
gint position,
gboolean jump_to);
void gedit_notebook_move_tab (GeditNotebook *src,
GeditNotebook *dest,
GeditTab *tab,
gint dest_position);
void gedit_notebook_remove_all_tabs (GeditNotebook *nb);
void gedit_notebook_set_close_buttons_sensitive
(GeditNotebook *nb,
gboolean sensitive);
gboolean gedit_notebook_get_close_buttons_sensitive
(GeditNotebook *nb);
G_END_DECLS
#endif /* GEDIT_NOTEBOOK_H */
/* ex:set ts=8 noet: */
|
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, July 31, 1995 5:02 pm PDT */
#include "private/gc_priv.h"
#if defined(MANUAL_VDB)
/* Stubborn object (hard to change, nearly immutable) allocation. */
/* This interface is deprecated. We mostly emulate it using */
/* MANUAL_VDB. But that imposes the additional constraint that */
/* written, but not yet GC_dirty()ed objects must be referenced */
/* by a stack. */
GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
GC_API void GC_CALL GC_end_stubborn_change(void *p)
{
GC_dirty(p);
}
/*ARGSUSED*/
GC_API void GC_CALL GC_change_stubborn(void *p)
{
}
#else /* !MANUAL_VDB */
GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
/*ARGSUSED*/
GC_API void GC_CALL GC_end_stubborn_change(void *p)
{
}
/*ARGSUSED*/
GC_API void GC_CALL GC_change_stubborn(void *p)
{
}
#endif /* !MANUAL_VDB */
|
/*
* lwan - simple web server
* Copyright (c) 2014 Leandro A. F. Pereira <leandro@hardinfo.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 any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#include "lwan.h"
bool lwan_http_authorize_init(void);
void lwan_http_authorize_shutdown(void);
bool
lwan_http_authorize(struct lwan_request *request,
struct lwan_value *authorization,
const char *realm,
const char *password_file);
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
* Copyright (C) 2013 Sage Electronic Engineering, LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "agesawrapper.h"
#include "amdlib.h"
#include "BiosCallOuts.h"
#include "heapManager.h"
#include "SB800.h"
#include <stdlib.h>
#include <cbfs.h>
#include <string.h>
#include <device/dram/ddr3.h>
#define SPD_SIZE 128
#define SPD_CRC_HI 127
#define SPD_CRC_LO 126
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr);
const BIOS_CALLOUT_STRUCT BiosCallouts[] =
{
{AGESA_ALLOCATE_BUFFER, agesa_AllocateBuffer },
{AGESA_DEALLOCATE_BUFFER, agesa_DeallocateBuffer },
{AGESA_LOCATE_BUFFER, agesa_LocateBuffer },
{AGESA_DO_RESET, agesa_Reset },
{AGESA_READ_SPD, BiosReadSpd_from_cbfs },
{AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported },
{AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
{AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopSuccess },
{AGESA_HOOKBEFORE_DRAM_INIT, board_BeforeDramInit },
{AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY, agesa_NoopSuccess },
{AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess },
{AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
};
const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
AGESA_STATUS BiosReadSpd_from_cbfs(UINT32 Func, UINT32 Data, VOID *ConfigPtr)
{
AGESA_STATUS Status;
#ifdef __PRE_RAM__
AGESA_READ_SPD_PARAMS *info = ConfigPtr;
if (info->MemChannelId > 0)
return AGESA_UNSUPPORTED;
if (info->SocketId != 0)
return AGESA_UNSUPPORTED;
if (info->DimmId != 0)
return AGESA_UNSUPPORTED;
char *spd_file;
size_t spd_file_len;
printk(BIOS_DEBUG, "read SPD\n");
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab,
&spd_file_len);
if (!spd_file)
die("file [spd.bin] not found in CBFS");
if (spd_file_len < SPD_SIZE)
die("Missing SPD data.");
memcpy((char*)info->Buffer, spd_file, SPD_SIZE);
u16 crc = spd_ddr3_calc_crc(info->Buffer, SPD_SIZE);
if (((info->Buffer[SPD_CRC_LO] == 0) && (info->Buffer[SPD_CRC_HI] == 0))
|| (info->Buffer[SPD_CRC_LO] != (crc & 0xff))
|| (info->Buffer[SPD_CRC_HI] != (crc >> 8))) {
printk(BIOS_WARNING, "SPD has a invalid or zero-valued CRC\n");
info->Buffer[SPD_CRC_LO] = crc & 0xff;
info->Buffer[SPD_CRC_HI] = crc >> 8;
u16 i;
printk(BIOS_WARNING, "\nDisplay the SPD");
for (i = 0; i < SPD_SIZE; i++) {
if((i % 16) == 0x00)
printk(BIOS_WARNING, "\n%02x: ",i);
printk(BIOS_WARNING, "%02x ", info->Buffer[i]);
}
printk(BIOS_WARNING, "\n");
}
Status = AGESA_SUCCESS;
#else
Status = AGESA_UNSUPPORTED;
#endif
return Status;
}
/* Call the host environment interface to provide a user hook opportunity. */
static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
{
// Unlike AMD/Inagua, this board is unable to vary the RAM voltage.
// Make sure the right speed settings are selected.
((MEM_DATA_STRUCT*)ConfigPtr)->ParameterListPtr->DDR3Voltage = VOLT1_5;
return AGESA_SUCCESS;
}
|
//! Instance of a search filter object. New in 0.9.5. \n
//! This object contains a preprocessed search query; used to perform filtering similar to Media Library Search or Album List's "filter" box. \n
//! Use search_filter_manager API to instantiate search_filter objects.
class search_filter : public service_base {
public:
//! For backwards compatibility with older (0.9.5 alpha) revisions of this API. Do not call.
virtual bool test_locked(const metadb_handle_ptr & p_item,const file_info * p_info) = 0;
//! Use this to run this filter on a group of items.
//! @param data Items to test.
//! @param out Pointer to a buffer (size at least equal to number of items in the source list) receiving the results.
virtual void test_multi(metadb_handle_list_cref data, bool * out) = 0;
FB2K_MAKE_SERVICE_INTERFACE(search_filter,service_base);
};
//! New in 0.9.5.3. You can obtain a search_filter_v2 pointer by using service_query() on a search_filter pointer, or from search_filter_manager_v2::create_ex().
class search_filter_v2 : public search_filter {
public:
virtual bool get_sort_pattern(titleformat_object::ptr & out, int & direction) = 0;
//! Abortable version of test_multi(). If the abort_callback object becomes signaled while the operation is being performed, contents of the output buffer are undefined and the operation will fail with exception_aborted.
virtual void test_multi_ex(metadb_handle_list_cref data, bool * out, abort_callback & abort) = 0;
FB2K_MAKE_SERVICE_INTERFACE(search_filter_v2, search_filter)
};
//! New in 0.9.5.4. You can obtain a search_filter_v2 pointer by using service_query() on a search_filter/search_filter_v2 pointer.
class search_filter_v3 : public search_filter_v2 {
public:
//! Returns whether the sort pattern returned by get_sort_pattern() was set by the user explicitly using "SORT BY" syntax or whether it was determined implicitly from some other part of the query. It's recommended to use this to determine whether to create a force-sorted autoplaylist or not.
virtual bool is_sort_explicit() = 0;
FB2K_MAKE_SERVICE_INTERFACE(search_filter_v3, search_filter_v2)
};
//! Entrypoint class to instantiate search_filter objects. New in 0.9.5.
class search_filter_manager : public service_base {
public:
//! Creates a search_filter object. Throws an exception on failure (such as an error in the query). It's recommended that you relay the exception message to the user if this function fails.
virtual search_filter::ptr create(const char * p_query) = 0;
//! Retrieves the search expression manual string. See also: show_manual().
virtual void get_manual(pfc::string_base & p_out) = 0;
void show_manual() {
pfc::string8 temp;
get_manual(temp);
popup_message::g_show(temp,"Search Expression Reference");
}
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(search_filter_manager);
};
//! New in 0.9.5.3.
class search_filter_manager_v2 : public search_filter_manager {
public:
enum {
KFlagAllowSort = 1 << 0,
};
//! Creates a search_filter object. Throws an exception on failure (such as an error in the query). It's recommended that you relay the exception message to the user if this function fails.
//! @param changeNotify A completion_notify callback object that will get called each time the query's behavior changes as a result of some external event (such as system time change). The caller must refresh query results each time this callback is triggered. The status parameter of it's on_completion() parameter is unused and always set to zero.
virtual search_filter_v2::ptr create_ex(const char * query, completion_notify::ptr changeNotify, t_uint32 flags) = 0;
//! Opens the search query syntax reference document, typically an external HTML in user's default web browser.
virtual void show_manual() = 0;
FB2K_MAKE_SERVICE_INTERFACE(search_filter_manager_v2, search_filter_manager);
};
|
#pragma once
#include "types.h"
extern u16 kcode[4];
extern u32 vks[4];
extern u8 rt[4], lt[4];
extern s8 joyx[4], joyy[4];
extern void* x11_win;
extern void* x11_disp;
enum DreamcastController //вот он пульт)
{
DC_BTN_C = 1,
DC_BTN_B = 1<<1,
DC_BTN_A = 1<<2,
DC_BTN_START = 1<<3,
DC_DPAD_UP = 1<<4,
DC_DPAD_DOWN = 1<<5,
DC_DPAD_LEFT = 1<<6,
DC_DPAD_RIGHT = 1<<7,
DC_BTN_Z = 1<<8,
DC_BTN_Y = 1<<9,
DC_BTN_X = 1<<10,
DC_BTN_D = 1<<11,
DC_DPAD2_UP = 1<<12,
DC_DPAD2_DOWN = 1<<13,
DC_DPAD2_LEFT = 1<<14,
DC_DPAD2_RIGHT = 1<<15,
DC_AXIS_LT = 0X10000,
DC_AXIS_RT = 0X10001,
DC_AXIS_X = 0X20000,
DC_AXIS_Y = 0X20001,
};
|
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder 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.
*/
int foo(int a, int b, int c) {
int arr[5] = { 1, 2, 3, 4, 5 };
int d = 4;
int *p = &d;
return a + b + c + arr[4] + arr[0] + *p;
}
int main() {
int a, b, c;
a = 2;
b = 1;
c = 3;
int d = 4;
int *p = &d;
int i;
for (i = 0; i < 12345; i++) {
*p = foo(a, b, c);
}
return *p;
}
|
/** \file src/arch/gtk3/widgets/printeroutputdevicewidget.c
* \brief Widget to control printer output device settings
*
* Written by
* Bas Wassink <b.wassink@ziggo.nl>
*
* Controls the following resource(s):
* Printer[4-6]TextDevice
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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 "vice.h"
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "basewidgets.h"
#include "resourcehelpers.h"
#include "widgethelpers.h"
#include "debug_gtk3.h"
#include "resources.h"
#include "printer.h"
#include "printeroutputdevicewidget.h"
/** \brief List of text output devices
*/
static ui_radiogroup_entry_t device_list[] = {
{ "#1 (file dump)", 0 },
{ "#2 (exec)", 1 },
{ "#3 (exec)", 2 },
{ NULL, -1 }
};
/** \brief Create widget to control the "Printer[4-6]TextDevice resource
*
* \param[in] device number (4-6)
*
* \return GtkGrid
*/
GtkWidget *printer_output_device_widget_create(int device)
{
GtkWidget *grid;
GtkWidget *radio_group;
grid = uihelpers_create_grid_with_label("Output device", 1);
radio_group = resource_radiogroup_create_sprintf("Printer%dTextDevice",
device_list, GTK_ORIENTATION_VERTICAL, device);
gtk_grid_attach(GTK_GRID(grid), radio_group, 0, 1, 1, 1);
gtk_widget_show_all(grid);
return grid;
}
|
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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
*/
#include "charConv.h"
#include "mpc.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
/*#include <stdio.h>*/
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO_CODESET
#include <locale.h>
#include <langinfo.h>
#endif
#endif
static char * localeCharset = NULL;
#ifdef HAVE_ICONV
#include <iconv.h>
iconv_t char_conv_iconv;
char * char_conv_to = NULL;
char * char_conv_from = NULL;
#endif
#define BUFFER_SIZE 1024
int setCharSetConversion(char * to, char * from) {
#ifdef HAVE_ICONV
if(char_conv_to && strcmp(to,char_conv_to)==0 &&
char_conv_from && strcmp(from,char_conv_from)==0)
{
return 0;
}
closeCharSetConversion();
if((char_conv_iconv = iconv_open(to,from))==(iconv_t)(-1)) return -1;
char_conv_to = strdup(to);
char_conv_from = strdup(from);
return 0;
#endif
return -1;
}
char * convStrDup(char * string) {
#ifdef HAVE_ICONV
char buffer[BUFFER_SIZE];
size_t inleft = strlen(string);
char * ret;
size_t outleft;
size_t retlen = 0;
size_t err;
char * bufferPtr;
if(!char_conv_to) return NULL;
ret = strdup("");
while(inleft) {
bufferPtr = buffer;
outleft = BUFFER_SIZE;
err = iconv(char_conv_iconv,&string,&inleft,&bufferPtr,
&outleft);
if(outleft==BUFFER_SIZE || (err<0 && errno!=E2BIG)) {
free(ret);
return NULL;
}
ret = realloc(ret,retlen+BUFFER_SIZE-outleft+1);
memcpy(ret+retlen,buffer,BUFFER_SIZE-outleft);
retlen+=BUFFER_SIZE-outleft;
ret[retlen] = '\0';
}
return ret;
#endif
return NULL;
}
void closeCharSetConversion() {
#ifdef HAVE_ICONV
if(char_conv_to) {
iconv_close(char_conv_iconv);
free(char_conv_to);
free(char_conv_from);
char_conv_to = NULL;
char_conv_from = NULL;
}
#endif
}
void setLocaleCharset() {
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO_CODESET
char * originalLocale;
char * charset = NULL;
if((originalLocale = setlocale(LC_CTYPE,""))) {
char * temp;
if((temp = nl_langinfo(CODESET))) {
charset = strdup(temp);
}
if(!setlocale(LC_CTYPE,originalLocale));
}
if(localeCharset) free(localeCharset);
if(charset) {
localeCharset = strdup(charset);
free(charset);
return;
}
/*printf("localCharset: %s\n",localeCharset);*/
#endif
#endif
localeCharset = strdup("ISO-8859-1");
}
char * toUtf8(char * from) {
static char * to = NULL;
if(to) free(to);
setCharSetConversion("UTF-8", localeCharset);
to = convStrDup(from);
if(!to) to = strdup(from);
return to;
}
char * fromUtf8(char * from) {
static char * to = NULL;
if(to) free(to);
setCharSetConversion(localeCharset, "UTF-8");
to = convStrDup(from);
if(!to) {
/*printf("not able to convert: %s\n",from);*/
to = strdup(from);
}
return to;
}
|
/*
* Copyright (C) 2013-2020 Graeme Gott <graeme@gottcode.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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WHISKERMENU_PLUGIN_H
#define WHISKERMENU_PLUGIN_H
#define PLUGIN_WEBSITE "https://docs.xfce.org/panel-plugins/xfce4-whiskermenu-plugin"
#include <string>
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
namespace WhiskerMenu
{
class Window;
class Plugin
{
public:
explicit Plugin(XfcePanelPlugin* plugin);
~Plugin();
Plugin(const Plugin&) = delete;
Plugin(Plugin&&) = delete;
Plugin& operator=(const Plugin&) = delete;
Plugin& operator=(Plugin&&) = delete;
GtkWidget* get_button() const
{
return m_button;
}
enum ButtonStyle
{
ShowIcon = 0x1,
ShowText = 0x2,
ShowIconAndText = ShowIcon | ShowText
};
ButtonStyle get_button_style() const;
std::string get_button_title() const;
static std::string get_button_title_default();
std::string get_button_icon_name() const;
void focus_lost()
{
m_focus_out_time = g_get_monotonic_time();
}
void reload();
void set_button_style(ButtonStyle style);
void set_button_title(const std::string& title);
void set_button_icon_name(const std::string& icon);
void set_configure_enabled(bool enabled);
void set_loaded(bool loaded);
private:
void button_toggled(GtkToggleButton* button);
void menu_hidden();
void configure();
void icon_changed(const gchar* icon);
void mode_changed(XfcePanelPlugin*, XfcePanelPluginMode mode);
gboolean remote_event(XfcePanelPlugin*, gchar* name, GValue* value);
void save();
void show_about();
gboolean size_changed(XfcePanelPlugin*, gint size);
void update_size();
void show_menu(bool at_cursor);
private:
XfcePanelPlugin* m_plugin;
Window* m_window;
GtkWidget* m_button;
GtkBox* m_button_box;
GtkLabel* m_button_label;
GtkImage* m_button_icon;
int m_opacity;
bool m_file_icon;
gint64 m_focus_out_time;
};
}
#endif // WHISKERMENU_PLUGIN_H
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NET_ASYNC_DNS_FIELD_TRIAL_H_
#define CHROME_BROWSER_NET_ASYNC_DNS_FIELD_TRIAL_H_
namespace chrome_browser_net {
bool ConfigureAsyncDnsFieldTrial();
}
#endif
|
#pragma once
#include <vector>
class Vec3;
class IUnit;
class Utility
{
public:
Utility();
~Utility();
static float d(IUnit* unit, IUnit* unit2);
static float d(IUnit* unit, Vec3 pos);
static float d(Vec3 pos, Vec3 pos2);
static bool IsCastableType(IUnit* unit, bool includeTurrets = false);
static bool IsAlly(IUnit* unit);
static bool IsEnemy(IUnit* unit);
static int CountEnemiesInRange(IUnit* unit, float range);
private:
static IUnit* player;
static std::vector<int> goodTypes;
static bool InVector(int obj, std::vector<int> vector);
};
|
/* UOL Messenger
* Copyright (c) 2005 Universo Online S/A
*
* Direitos Autorais Reservados
* All rights reserved
*
* Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
* sob os termos da Licença Pública Geral GNU conforme publicada pela Free
* Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
* qualquer versão posterior.
* Este programa é distribuído na expectativa de que seja útil, porém,
* SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE
* OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
* do GNU para mais detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
* com este programa; se não, escreva para a Free Software Foundation, Inc.,
* no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
*
* 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.
*
* Universo Online S/A - A/C: UOL Messenger 5o. Andar
* Avenida Brigadeiro Faria Lima, 1.384 - Jardim Paulistano
* São Paulo SP - CEP 01452-002 - BRASIL */
#pragma once
#include "ISettings.h"
#include <interfaces/IUOLMessengerProfileElement.h>
class CProfileElement : public ISettings,
public IUOLMessengerProfileElement
{
public:
CProfileElement();
CProfileElement(CString strName, CString strPath, BOOL bRememberPass, BOOL bAuthentication);
virtual ~CProfileElement(void);
virtual void InitTagProcessMap();
virtual void Load(MSXML::IXMLDOMNodePtr pNode, const CString& strKey);
virtual void Save(MSXML::IXMLDOMNodePtr pNode, const CString& strKey);
CString GetProfileName();
void SetProfileName(const CString& strName);
CString GetProfileNickName();
void SetProfileNickname(const CString& strNickname);
IUOLMessengerUserIconPtr GetUserIcon();
void SetUserIcon(IUOLMessengerUserIconPtr pUserIcon);
CString GetProfilePassword();
void SetProfilePassword(const CString& strPassword);
CString GetProfilePath();
void SetProfilePath(const CString& strPath);
BOOL IsEnableAuthentication();
void SetEnableAuthentication(BOOL bAuthentication);
BOOL IsEnableRememberPass();
void SetEnableRememberPass(BOOL bRememberPass);
protected:
DECLARE_SETTINGS_CALLBACK(CProfileElement, Name);
DECLARE_SETTINGS_CALLBACK(CProfileElement, Nickname);
DECLARE_SETTINGS_CALLBACK(CProfileElement, IconPath);
DECLARE_SETTINGS_CALLBACK(CProfileElement, Path);
DECLARE_SETTINGS_CALLBACK(CProfileElement, Password);
DECLARE_SETTINGS_CALLBACK(CProfileElement, RememberPass);
DECLARE_SETTINGS_CALLBACK(CProfileElement, Authentication);
DECLARE_SETTINGS_CALLBACK(CProfileElement, AutoOpen);
private:
CString m_strName;
CString m_strNickname;
IUOLMessengerUserIconPtr m_pUserIcon;
CString m_strPath;
CString m_strPassword;
BOOL m_bRememberPass;
BOOL m_bAuthentication;
CProcessMap ms_tagProcess;
};
MAKEAUTOPTR(CProfileElement); |
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CANVAS_DECORATION_H_
#define _KIS_CANVAS_DECORATION_H_
#include <QObject>
#include <krita_export.h>
#include <kis_canvas2.h>
class QPoint;
class QRect;
class QRectF;
class QPainter;
class KoViewConverter;
class KisCoordinatesConverter;
class KisView2;
/**
* This class is the base class for object that draw a decoration on the canvas,
* for instance, selections, grids, tools, ...
*/
class KRITAUI_EXPORT KisCanvasDecoration : public QObject
{
Q_OBJECT
public:
KisCanvasDecoration(const QString& id, const QString& name, KisView2 * parent);
~KisCanvasDecoration();
const QString& id() const;
const QString& name() const;
/**
* @return whether the decoration is visible.
*/
bool visible() const;
/**
* Will paint the decoration on the QPainter, if the visible is set to true.
*
* @param updateRect dirty rect in document pixels
*/
void paint(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas);
public slots:
/**
* Set if the decoration is visible or not.
*/
virtual void setVisible(bool v);
/**
* If decoration is visible, hide it, if not show it.
*/
void toggleVisibility();
protected:
virtual void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter,KisCanvas2* canvas) = 0;
/**
* @return the parent KisView
*/
KisView2* view() const;
private:
struct Private;
Private* const d;
};
#endif
|
/*
* This file is part of the KDE libraries
* Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
*
*
* 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 KMOBJECT_H
#define KMOBJECT_H
#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
#warning internal header, do not use except if you are a KDEPrint developer
#endif
/**
* @internal
* This class is internal to KDEPrint and is not intended to be
* used outside it. Please do not make use of this header, except
* if you're a KDEPrint developer. The API might change in the
* future and binary compatibility might be broken.
*/
class KMObject
{
public:
KMObject();
bool isDiscarded() const;
void setDiscarded(bool on = true);
protected:
bool m_discarded;
};
inline KMObject::KMObject() : m_discarded(false)
{ }
inline bool KMObject::isDiscarded() const
{ return m_discarded; }
inline void KMObject::setDiscarded(bool on)
{ m_discarded = on; }
#endif
|
/*--------------------------------------------------------
* Implementierung Basic-Befehl "vpeek" und "vpoke"
* =====================================
* Uwe Berger (bergeruw@gmx.net); 2010
*
*
* Have fun!
* ---------
*
----------------------------------------------------------*/
#include <stdint.h>
#ifndef __UBASIC_CVARS_H__
#define __UBASIC_CVARS_H__
// Strukturdefinition fuer Variablenpointertabelle
typedef struct {
#if USE_PROGMEM
char var_name[MAX_NAME_LEN+1];
#else
char *var_name;
#endif
int16_t *pvar;
} cvars_t;
// exportierbare Prototypen
void vpoke_statement(void); //setzen
int16_t vpeek_expression(void); //lesen
#endif /* __UBASIC_CVARS_H__ */
|
/*
* Stuff used by all variants of the driver
*
* Copyright (c) 2001 by Stefan Eilers,
* Hansjoerg Lipp <hjlipp@web.de>,
* Tilman Schmidt <tilman@imap.cc>.
*
* =====================================================================
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
*/
#include "gigaset.h"
static ssize_t show_cidmode(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct cardstate *cs = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", cs->cidmode);
}
static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct cardstate *cs = dev_get_drvdata(dev);
long int value;
char *end;
value = simple_strtol(buf, &end, 0);
while (*end)
if (!isspace(*end++))
return -EINVAL;
if (value < 0 || value > 1)
return -EINVAL;
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS;
cs->waiting = 1;
if (!gigaset_add_event(cs, &cs->at_state, EV_PROC_CIDMODE,
NULL, value, NULL)) {
cs->waiting = 0;
mutex_unlock(&cs->mutex);
return -ENOMEM;
}
gigaset_schedule_event(cs);
wait_event(cs->waitqueue, !cs->waiting);
mutex_unlock(&cs->mutex);
return count;
}
static DEVICE_ATTR(cidmode, S_IRUGO | S_IWUSR, show_cidmode, set_cidmode);
/* free sysfs for device */
void gigaset_free_dev_sysfs(struct cardstate *cs)
{
if (!cs->tty_dev)
return;
gig_dbg(DEBUG_INIT, "removing sysfs entries");
device_remove_file(cs->tty_dev, &dev_attr_cidmode);
}
/* initialize sysfs for device */
void gigaset_init_dev_sysfs(struct cardstate *cs)
{
if (!cs->tty_dev)
return;
gig_dbg(DEBUG_INIT, "setting up sysfs");
if (device_create_file(cs->tty_dev, &dev_attr_cidmode))
pr_err("could not create sysfs attribute\n");
}
|
/*
Arduino.h - Main include file for the Arduino SDK
Copyright (c) 2005-2013 Arduino Team. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Arduino_h
#define Arduino_h
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
// some libraries and sketches depend on this
// AVR stuff, assuming Arduino.h or WProgram.h
// automatically includes it...
#include <avr/pgmspace.h>
#include "binary.h"
#include "itoa.h"
#ifdef __cplusplus
extern "C"{
#endif // __cplusplus
#include "wiring_constants.h"
//#define MQX_LOG
void yield(void);
void user_task1(void);
void user_task2(void);
void user_task3(void);
/* sketch */
extern void setup( void ) ;
extern void loop( void ) ;
/* Define attribute */
#if defined ( __CC_ARM ) /* Keil uVision 4 */
#define WEAK (__attribute__ ((weak)))
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
#define WEAK __weak
#elif defined ( __GNUC__ ) /* GCC CS */
#define WEAK __attribute__ ((weak))
#endif
/* Definitions and types for pins */
typedef enum _EAnalogChannel
{
NO_ADC=-1,
A0=0,
A1,
A2,
A3,
A4,
A5
} EAnalogChannel ;
#define ADC_CHANNEL_NUMBER_NONE 0xffffffff
// Definitions for PWM channels
typedef enum _EPWMChannel
{
NOT_ON_PWM=-1,
PWM_CH0=0,
PWM_CH1,
PWM_CH2,
PWM_CH3,
PWM_CH4,
PWM_CH5,
PWM_CH6,
PWM_CH7,
NMAX_PWMS
} EPWMChannel ;
#ifdef __cplusplus
} // extern "C"
#include "WCharacter.h"
#include "WString.h"
#include "Tone.h"
#include "WMath.h"
#include "HardwareSerial.h"
#include "wiring_pulse.h"
#endif // __cplusplus
// Include board variant
#include "variant.h"
#include "wiring.h"
#include "wiring_digital.h"
#include "wiring_analog.h"
#include "wiring_shift.h"
#include "WInterrupts.h"
#include "uty_mqx.h"
// delayMicroseconds() and micros() function are powered by hw_timer1
#define MICRO_SEC_BY_HWTIMER1
#define ARDUINO_UDOO_NEO
/*
// USB Device
#define USB_VID 0x2341 // arduino LLC vid
#define USB_PID_LEONARDO 0x0034
#define USB_PID_MICRO 0x0035
#define USB_PID_DUE 0x003E
#include "USB/USBDesc.h"
#include "USB/USBCore.h"
#include "USB/USBAPI.h"
*/
#endif // Arduino_h
|
/*
Copyright (c) 2013, 2014 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 SPECIALNOTIFIERJOB_H
#define SPECIALNOTIFIERJOB_H
#include <QObject>
#include <Akonadi/Item>
#include <QStringList>
class KJob;
class SpecialNotifierJob : public QObject
{
Q_OBJECT
public:
explicit SpecialNotifierJob(const QStringList &listEmails, const QString &path, Akonadi::Item::Id id, QObject *parent = 0);
~SpecialNotifierJob();
Q_SIGNALS:
void displayNotification(const QPixmap &pixmap, const QString &message);
private Q_SLOTS:
void slotSearchJobFinished( KJob *job );
void slotItemFetchJobDone(KJob*);
private:
void emitNotification(const QPixmap &pixmap);
QStringList mListEmails;
QString mSubject;
QString mFrom;
QString mPath;
};
#endif // SPECIALNOTIFIERJOB_H
|
/*
* OpenRPT report writer and rendering engine
* Copyright (C) 2001-2011 by OpenMFG, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Please contact info@openmfg.com with any questions on this license.
*/
#ifndef __LOGINOPTIONS_H__
#define __LOGINOPTIONS_H__
#include <QDialog>
#include "parameter.h"
#include "ui_loginOptions.h"
class loginOptions : public QDialog, public Ui::loginOptions
{
Q_OBJECT
public:
loginOptions(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0);
~loginOptions();
QString _databaseURL;
public slots:
virtual void set( const ParameterList & pParams );
protected slots:
virtual void languageChange();
virtual void sSave();
};
#endif // LOGINOPTIONS_H
|
//****************
// モーション再生
//****************
#ifndef _MOTIONPLAYER_H_
#define _MOTIONPLAYER_H_
#include "VMDMotion.h"
class cPMDModel;
class cMotionPlayer
{
private :
cPMDModel *m_pPMDModel;
cVMDMotion *m_pVMDMotion;
cPMDBone **m_ppBoneList;
cPMDFace **m_ppFaceList;
float m_fOldFrame,
m_fFrame;
bool m_bLoop; // モーションをループするかどうか
float m_fInterpolateFrameMax; // モーション補間用
float m_fInterpolateFrameNow;
void getMotionPosRot( const MotionDataList *pMotionData, float fFrame, Vector3 *pvec3Pos, Vector4 *pvec4Rot );
float getFaceRate( const FaceDataList *pFaceData, float fFrame );
public :
cMotionPlayer( void );
~cMotionPlayer( void );
void setup( cPMDModel *pPMDModel, cVMDMotion *pMotion, bool bLoop, float fInterpolateFrame );
bool update( float fElapsedFrame );
void clear( void );
// 2009/07/15 Ru--en
void rewind( void );
void setLoop( bool bLoop );
//p_g_
float getCurrentFrame();
void clearCurrentFrame();
};
#endif // _MOTIONPLAYER_H_
|
// ----------------------------------------------------------------------------
// NAME : Gre Miller User ID: gnmiller
// DUE DATE : 10/31/14
// PROGRAM ASSIGNMENT 3
// FILE NAME : thread.h
// PROGRAM PURPOSE :
// Contains declarations for classes and global variables for sharing among
// threads.
// ----------------------------------------------------------------------------
#ifndef GNMILLER_THREAD_H
#define GNMILLER_THREAD_H
#include "ThreadClass.h"
extern Semaphore *wall, *f_wall;
extern Mutex *s_lock;
extern int s_count, f_count;
extern int *x; // the array to search
extern int *w; // the array to use for finding the max (0s, and 1s)
/* initiliaze the array w to all 1s */
class initializeThread : public Thread {
public:
initializeThread(int i, int m);
private:
void ThreadFunc();
int my_i,max;
};
/* iterate over pairs of ints in the array and set value in w accordingly */
class seekerThread : public Thread {
public:
seekerThread(int i, int j, int m, int t);
private:
void ThreadFunc();
int my_i, my_j, max, total;
};
/* iterate over the list and check if i am the max */
class greatestThread : public Thread {
public:
greatestThread(int i);
private:
void ThreadFunc();
int my_i;
};
#endif |
/*
* Copyright (C) 2010 Xfce Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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.
*/
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
typedef struct
{
const gchar *name;
const gchar *email;
}
ContributorInfo;
typedef struct
{
const gchar *name;
const ContributorInfo *contributors;
}
ContributorGroup;
/*
static const ContributorInfo xfce_contributors_lead[] =
{
{ "Olivier Fourdan", "fourdan@xfce.org" },
{ NULL, NULL }
};
*/
static const ContributorInfo xfce_contributors_core[] =
{
{ "Brian J. Tarricone", "kelnos@xfce.org" },
{ "Jannis Pohlmann", "jannis@xfce.org" },
{ "Jérôme Guelfucci", "jeromeg@xfce.org" },
{ "Nick Schermer", "nick@xfce.org" },
{ "Olivier Fourdan", "fourdan@xfce.org" },
{ "Stephan Arts", "stephan@xfce.org" },
{ NULL, NULL }
};
static const ContributorInfo xfce_contributors_active[] =
{
{ "Ali Abdallah", "aliov@xfce.org" },
{ "Benedikt Meurer", "benny@xfce.org" },
{ "David Mohr", "squisher@xfce.org" },
{ "Enrico Tröger", "enrico.troeger@uvena.de" },
{ "Jasper Huijsmans", "jasper@xfce.org" },
{ "Jean-François Wauthy", "pollux@xfce.org" },
{ "Landry Breuil", "landry@openbsd.org" },
{ "Lionel Le Folgoc", "mrpouit@gmail.com" },
{ "Mike Massonnet", "mmassonnet@gmail.com" },
{ "Yves-Alexis Perez", "corsac@debian.org" },
{ NULL, NULL }
};
static const ContributorInfo xfce_contributors_server[] =
{
{ "Auke Kok", "sofar@foo-projects.org" },
{ "Brian J. Tarricone", "kelnos@xfce.org" },
{ "Jannis Pohlmann", "jannis@xfce.org" },
{ "Jean-François Wauthy", "pollux@xfce.org" },
{ "Nick Schermer", "nick@xfce.org" },
{ "Samuel Verstraete", "elangelo@xfce.org" },
{ NULL, NULL }
};
static const ContributorInfo xfce_contributors_goodies_supervision[] =
{
{ "Jannis Pohlmann", "jannis@xfce.org" },
{ NULL, NULL }
};
static const ContributorInfo xfce_contributors_translators_supervision[] =
{
{ "Maximilian Schleiss", "maximilian@xfce.org" },
{ "Mike Massonnet", "mmassonnet@gmail.com" },
{ NULL, NULL }
};
static const ContributorInfo xfce_contributors_previous[] =
{
{ "Bernhard Walle", "bernhard.walle@gmx.de" },
{ "Biju Chacko", "botsie@xfce.org" },
{ "Craig Betts", "craig.betts@dfrc.nasa.gov" },
{ "Daichi Kawahata", "daichi@xfce.org" },
{ "Danny Milosavljevic", "dannym@xfce.org" },
{ "Darren Salt", "linux@youmustbejoking.demon.co.uk" },
{ "Edscott Wilson García", "edscott@xfce.org" },
{ "Eduard Roccatello", "eduard@xfce.org" },
{ "Ejvend Nielsen", "prophet@sphere-x.net" },
{ "Erik Touve", "etouve@earthlink.net" },
{ "Erik Harrison", "erikharrison@xfce.org" },
{ "François Le Clainche", "fleclainche@wanadoo.fr" },
{ "Jens Guballa", "j.guballa@t-online.de" },
{ "Jens Luedicke", "jens@irs-net.com" },
{ "Joakim Andreasson", "joakim.andreasson@gmx.net" },
{ "Karsten Luetkewitz", "phrep@plskthx.org" },
{ "Martin Loschwitz", "madkiss@debian.org" },
{ "Michael Mosier", "michael@spyonit.com" },
{ "Mickaël Graf", "korbinus@xfce.org" },
{ "Pau Rul·lan Ferragut", "paurullan@bulma.net" },
{ "Thomas Leonard", "tal00r@ecs.soton.ac.uk" },
{ "Tobias Henle", "tobias@page23.de" },
{ "Xavier Maillard", "zedek@fxgsproject.org" },
{ NULL, NULL }
};
static const ContributorGroup xfce_contributors[] =
{
/*{ N_("Project Lead"),
xfce_contributors_lead
},*/
{ N_("Core developers"),
xfce_contributors_core
},
{ N_("Active contributors"),
xfce_contributors_active
},
{ N_("Servers maintained by"),
xfce_contributors_server
},
{ N_("Goodies supervision"),
xfce_contributors_goodies_supervision
},
{ N_("Translations supervision"),
xfce_contributors_translators_supervision
},
{ N_("Translators"),
NULL /* data from translators.h will be used here */
},
{ N_("Previous contributors"),
xfce_contributors_previous
}
};
|
/* ------------------------------------------------------------------
* Copyright (C) 2008 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/*********************************************************************************/
/* ------------------------------------------------------------------- */
/* MPEG-4 ShadowSyncSampleAtom Class */
/* ------------------------------------------------------------------- */
/*********************************************************************************/
/*
This ShadowSyncSampleAtom Class provides an optional set of synch samples
when seeking or for similar purposes.
*/
#ifndef SHADOWSYNCSAMPLEATOM_H_INCLUDED
#define SHADOWSYNCSAMPLEATOM_H_INCLUDED
#ifndef OSCL_FILE_IO_H_INCLUDED
#include "oscl_file_io.h"
#endif
#ifndef FULLATOM_H_INCLUDED
#include "fullatom.h"
#endif
class ShadowSyncSampleAtom : public FullAtom
{
public:
ShadowSyncSampleAtom(uint8 version, uint32 flags); // Constructor
ShadowSyncSampleAtom(ShadowSyncSampleAtom atom); // Copy Constructor
virtual ~ShadowSyncSampleAtom();
// Member gets and sets
uint32 getEntryCount()
{
return _entryCount;
}
// Adding to and getting the shadow and sync sample number values
void addShadowSampleNumber(uint32 sample);
vector<uint32>* getShadowSampleNumbers()
{
return _pshadowSampleNumbers;
}
uint32 getShadowSampleNumberAt(int32 index);
void addSyncSampleNumber(uint32 sample);
vector<uint32>* getSyncSampleNumbers()
{
return _psyncSampleNumbers;
}
uint32 getSyncSampleNUmberAt(int32 index);
// Rendering the Atom in proper format (bitlengths, etc.) to an ostream
virtual void renderToFileStream(ofstream &os);
// Reading in the Atom components from an input stream
virtual void readFromFileStream(ifstream &is);
private:
uint32 _entryCount;
vector<uint32>* _pshadowSampleNumbers;
vector<uint32>* _psyncSampleNumbers;
};
#endif // SHADOWSYNCSAMPLEATOM_H_INCLUDED
|
/* $Id: SUPR0IdcClient-linux.c $ */
/** @file
* VirtualBox Support Driver - IDC Client Lib, Linux Specific Code.
*/
/*
* Copyright (C) 2008-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
#include "../SUPR0IdcClientInternal.h"
#include <VBox/err.h>
int VBOXCALL supR0IdcNativeOpen(PSUPDRVIDCHANDLE pHandle, PSUPDRVIDCREQCONNECT pReq)
{
return supR0IdcNativeCall(pHandle, SUPDRV_IDC_REQ_CONNECT, &pReq->Hdr);
}
int VBOXCALL supR0IdcNativeClose(PSUPDRVIDCHANDLE pHandle, PSUPDRVIDCREQHDR pReq)
{
return supR0IdcNativeCall(pHandle, SUPDRV_IDC_REQ_DISCONNECT, pReq);
}
int VBOXCALL supR0IdcNativeCall(PSUPDRVIDCHANDLE pHandle, uint32_t iReq, PSUPDRVIDCREQHDR pReq)
{
int rc = SUPDrvLinuxIDC(iReq, pReq);
if (RT_SUCCESS(rc))
rc = pReq->rc;
NOREF(pHandle);
return rc;
}
|
/******************************************************************************
*
* $Id: misc.c 56 2011-03-31 02:57:01Z yamada.rj $
*
* -- Copyright Notice --
*
* Copyright (c) 2009 Asahi Kasei Microdevices Corporation, Japan
* All Rights Reserved.
*
* This software program is proprietary program of Asahi Kasei Microdevices
* Corporation("AKM") licensed to authorized Licensee under Software License
* Agreement (SLA) executed between the Licensee and AKM.
*
* Use of the software by unauthorized third party, or use of the software
* beyond the scope of the SLA is strictly prohibited.
*
* -- End Asahi Kasei Microdevices Copyright Notice --
*
******************************************************************************/
#include "misc.h"
#include "AKCommon.h"
#include <fcntl.h>
#include <linux/input.h>
/*#include <linux/time.h>*//* ns_to_timespec() */
static int s_fdForm = -1; /*!< FD to formation detect device */
struct AKMD_INTERVAL {
long interval; /*!< Measurement interval, 32-bit is enough for HDOE */
int16 decimator; /*!< HDOE decimator */
};
static struct AKMD_INTERVAL s_interval[] = {
{ 10000000, 10 }, /* 100Hz */
{ 16666667, 6 }, /* 60Hz SENSOR_DELAY_FASTEST */
{ 20000000, 5 }, /* 50Hz SENSOR_DELAY_GAME */
{ 25000000, 4 }, /* 40Hz */
{ 50000000, 2 }, /* 20Hz */
{ 62500000, 2 }, /* 16Hz SENSOR_DELAY_UI */
{ 100000000, 1 }, /* 10Hz */
{ 125000000, 1 } /* 8Hz SENSOR_DELAY_NORMAL */
};
/*!
Sleep function in millisecond.
@param[in] msec Suspend time in millisecond.
*/
inline void msleep(signed int msec) {
usleep(1000 * msec);
}
/*!
Open device driver which detects current formation. This is just a stab of
interface. Therefore, this function do nothing.
@return If function succeeds, the return value is 1. Otherwise, the return
value is 0.
*/
int16 misc_openForm(void) {
if (s_fdForm < 0) {
s_fdForm = 0;
}
return 1;
}
/*!
Close device driver
*/
void misc_closeForm(void) {
if (s_fdForm != -1) {
s_fdForm = -1;
}
}
/*!
Get current formation This is just a stab of interface. Therefore, this
function do nothing.
@return The number represents current form.
*/
int16 misc_checkForm(void) {
return 0;
}
/*!
Convert from int64_t value to timespec structure
@return timespec value
@param[in] val int64_t value
*/
struct timespec int64_to_timespec(int64_t val) {
struct timespec ret;
ret.tv_sec = (long) (val / 1000000000);
ret.tv_nsec = val - ret.tv_sec;
return ret;
}
/*!
Convert from timespec structure to int64_t value
@return int64_t value
@param[in] val timespec value
*/
int64_t timespec_to_int64(struct timespec* val) {
return ((int64_t)(val->tv_sec * 1000000000) + (int64_t)val->tv_nsec);
}
/*!
Calculate the difference between two timespec structure.
This function cannot calculate the difference larger than 1 second.
@return the difference in int64_t type value.
@param[in] begin
@param[in] end
*/
int64_t CalcDuration(struct timespec* begin, struct timespec* end) {
struct timespec diff;
if ((diff.tv_nsec = begin->tv_nsec - end->tv_nsec) < 0) {
diff.tv_nsec += 1000000000;
diff.tv_sec = begin->tv_sec - end->tv_sec - 1;
} else {
diff.tv_sec = begin->tv_sec - end->tv_sec;
}
if (diff.tv_sec < 0) {
return 0; /* Minimum nanosec */
}
return timespec_to_int64(&diff);
}
/*!
Search and open an input event file by name. This function search the
directory "/dev/input/".
@return When this function succeeds, the return value is a file descriptor
to the found event file. If fails, the return value is -1.
@param[in] name The name of input device to be searched.
*/
int openInputDevice(const char* name) {
const int NUM_EVENT = 16;
const int BUFSIZE = 32;
const int NAMESIZE = 128;
char buf[BUFSIZE];
char evName[NAMESIZE];
int i;
int fd;
for (i = 0; i < NUM_EVENT; i++) {
if (snprintf(buf, BUFSIZE, "/dev/input/event%d", i) < 0) {
break;
}
fd = open(buf, O_RDONLY | O_NONBLOCK);
if (fd >= 0) {
if (ioctl(fd, EVIOCGNAME(NAMESIZE - 1), &evName) >= 1) {
AKMDEBUG(DBG_LEVEL2, "event%d(%d): %s\n", i, fd, evName);
if (!strncmp(name, evName, strlen(name))) {
break;
}
}
close(fd);
}
fd = -1;
}
AKMDEBUG(DBG_LEVEL2, "AccInit(%s):fd=%d\n", name, fd);
return fd;
}
/*!
Get valid measurement interval and HDOE decimator.
@return If this function succeeds, the return value is 1. Otherwise 0.
@param[in,out] time Input a requirement of sensor measurement interval.
The closest interval will be returned as output.
@param[out] hdoe_interval When the output interval value is set to looper,
this decimation value should be used to decimate the HDOE.
*/
int16 GetHDOEDecimator(int64_t* time, int16* hdoe_interval) {
const int n = (sizeof(s_interval) / sizeof(s_interval[0]));
int i;
int64_t org;
org = *time;
for (i = 0; i < n; i++) {
*time = s_interval[i].interval;
*hdoe_interval = s_interval[i].decimator;
if (org <= *time) {
break;
}
}
AKMDEBUG(DBG_LEVEL3, "HDOEDecimator:%lld,%lld\n", org, *time);
return 1;
}
/*!
This function convert coordinate system.
@retval 1 Conversion succeeds.
@retval 0 Conversion failed.
@param[in] pat Conversion pattern number.
@param[in,out] Original vector as input, converted data as output.
*/
int16 ConvertCoordinate(
const AKMD_PATNO pat,
int16vec* vec)
{
int16 tmp;
switch(pat){
// Obverse
case PAT1:
// This is Android default
break;
case PAT2:
tmp = vec->u.x;
vec->u.x = vec->u.y;
vec->u.y = -tmp;
break;
case PAT3:
vec->u.x = -(vec->u.x);
vec->u.y = -(vec->u.y);
break;
case PAT4:
tmp = vec->u.x;
vec->u.x = -(vec->u.y);
vec->u.y = tmp;
break;
// Reverse
case PAT5:
vec->u.x = -(vec->u.x);
vec->u.z = -(vec->u.z);
break;
case PAT6:
tmp = vec->u.x;
vec->u.x = vec->u.y;
vec->u.y = tmp;
vec->u.z = -(vec->u.z);
break;
case PAT7:
vec->u.y = -(vec->u.y);
vec->u.z = -(vec->u.z);
break;
case PAT8:
tmp = vec->u.x;
vec->u.x = -(vec->u.y);
vec->u.y = -tmp;
vec->u.z = -(vec->u.z);
break;
default:
return 0;
}
return 1;
}
|
/**********************************************************************
Audacity: A Digital Audio Editor
EditToolbar.h
Dominic Mazzoni
Shane T. Mueller
Leland Lucius
**********************************************************************/
#ifndef __AUDACITY_EDIT_TOOLBAR__
#define __AUDACITY_EDIT_TOOLBAR__
#include <wx/defs.h>
#include "ToolBar.h"
#include "../Theme.h"
#include "../Experimental.h"
class wxCommandEvent;
class wxDC;
class wxImage;
class wxWindow;
class AButton;
enum {
ETBCutID,
ETBCopyID,
ETBPasteID,
ETBTrimID,
ETBSilenceID,
ETBUndoID,
ETBRedoID,
#ifdef EXPERIMENTAL_SYNC_LOCK
ETBSyncLockID,
#endif
ETBZoomInID,
ETBZoomOutID,
#if 0 // Disabled for version 1.2.0 since it doesn't work quite right...
ETBZoomToggleID,
#endif
ETBZoomSelID,
ETBZoomFitID,
#if defined(EXPERIMENTAL_EFFECTS_RACK)
ETBEffectsID,
#endif
ETBNumButtons
};
class EditToolBar:public ToolBar {
public:
EditToolBar();
virtual ~EditToolBar();
void Create(wxWindow *parent);
void OnButton(wxCommandEvent & event);
void Populate();
void Repaint(wxDC * WXUNUSED(dc)) {};
void EnableDisableButtons();
void UpdatePrefs();
private:
AButton *AddButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
int id, const wxChar *label, bool toggle = false);
void AddSeparator();
void MakeButtons();
void RegenerateTooltips();
AButton *mButtons[ETBNumButtons];
wxImage *upImage;
wxImage *downImage;
wxImage *hiliteImage;
public:
DECLARE_CLASS(EditToolBar);
DECLARE_EVENT_TABLE();
};
#endif
|
/*
*** Analysis Node - Process2D
*** src/analyse/nodes/process2d.h
Copyright T. Youngs 2012-2018
This file is part of Dissolve.
Dissolve is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Dissolve is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Dissolve. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DISSOLVE_ANALYSISPROCESS2D_H
#define DISSOLVE_ANALYSISPROCESS2D_H
#include "analyse/nodes/node.h"
#include "math/data2d.h"
#include "base/charstring.h"
#include "templates/reflist.h"
// Forward Declarations
class AnalysisCollect2DNode;
class AnalysisSelectNode;
class Data2D;
class LineParser;
class NodeContextStack;
// Analysis Node - Process2D
class AnalysisProcess2DNode : public AnalysisNode
{
public:
// Constructor
AnalysisProcess2DNode(AnalysisCollect2DNode* target = NULL);
// Destructor
~AnalysisProcess2DNode();
/*
* Node Keywords
*/
public:
// Node Keywords
enum Process2DNodeKeyword { EndProcess2DKeyword, FactorKeyword, LabelValueKeyword, LabelXKeyword, LabelYKeyword, NormaliseToOneKeyword, NSitesKeyword, NumberDensityKeyword, SaveKeyword, nProcess2DNodeKeywords };
// Convert string to control keyword
static Process2DNodeKeyword normalise2DNodeKeyword(const char* s);
// Convert control keyword to string
static const char* normalise2DNodeKeyword(Process2DNodeKeyword nk);
/*
* Data
*/
private:
// Collect2D node which we are normalising
AnalysisCollect2DNode* collectNode_;
// Reference to sites against which we will normalise by population
RefList<AnalysisSelectNode,double> sitePopulationNormalisers_;
// Reference to sites against which we will normalise by number density
RefList<AnalysisSelectNode,double> numberDensityNormalisers_;
// Whether to normalise by supplied factor
bool normaliseByFactor_;
// Normalisation factor to apply (if requested)
double normalisationFactor_;
// Whether to normalise summed histogram value to 1.0
bool normaliseToOne_;
// Whether to save data after normalisation
bool saveData_;
// Value label
CharString valueLabel_;
// Axis labels
CharString xAxisLabel_, yAxisLabel_;
public:
// Add site population normaliser
void addSitePopulationNormaliser(AnalysisSelectNode* selectNode);
// Add number density normaliser
void addNumberDensityNormaliser(AnalysisSelectNode* selectNode);
// Set whether to normalise by factor
void setNormaliseByFactor(bool on);
// Set normalisation factor
void setNormalisationFactor(double factor);
// Set whether to normalise summed histogram value to 1.0
void setNormaliseToOne(bool b);
// Return whether to normalise summed histogram value to 1.0
bool normaliseToOne() const;
// Set whether to save processed data
void setSaveData(bool on);
// Set value label
void setValueLabel(const char* label);
// Return value label
const char* valueLabel() const;
// Set x axis label
void setXAxisLabel(const char* label);
// Return x axis label
const char* xAxisLabel() const;
// Set y axis label
void setYAxisLabel(const char* label);
// Return y axis label
const char* yAxisLabel() const;
/*
* Execute
*/
public:
// Prepare any necessary data, ready for execution
bool prepare(Configuration* cfg, const char* prefix, GenericList& targetList);
// Execute node, targetting the supplied Configuration
AnalysisNode::NodeExecutionResult execute(ProcessPool& procPool, Configuration* cfg, const char* prefix, GenericList& targetList);
// Finalise any necessary data after execution
bool finalise(ProcessPool& procPool, Configuration* cfg, const char* prefix, GenericList& targetList);
/*
* Read / Write
*/
public:
// Read structure from specified LineParser
bool read(LineParser& parser, NodeContextStack& contextStack);
// Write structure to specified LineParser
bool write(LineParser& parser, const char* prefix);
};
#endif
|
/*
* Copyright (C) 2015 Red Hat
*
* This file is part of tlog.
*
* Tlog 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.
*
* Tlog 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 tlog; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
#include <stdlib.h>
#include <assert.h>
#include <signal.h>
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <locale.h>
#include <langinfo.h>
#include <tlog/rc.h>
#include <tlog/rec.h>
#include <tlog/rec_session_conf.h>
#include <tlog/misc.h>
/**
* Let GNU TLS know we don't need implicit global initialization, which opens
* /dev/urandom and can replace standard FDs in case they were closed.
*/
int
_gnutls_global_init_skip(void)
{
return 1;
}
int
main(int argc, char **argv)
{
tlog_grc grc;
uid_t euid;
gid_t egid;
struct tlog_errs *errs = NULL;
struct json_object *conf = NULL;
char *cmd_help = NULL;
int std_fds[] = {0, 1, 2};
const char *charset;
const char *shell_path;
char **shell_argv = NULL;
int status = 1;
int signal = 0;
/* Remember effective UID/GID so we can return to them later */
euid = geteuid();
egid = getegid();
/* Drop the privileges temporarily in case we're SUID/SGID */
if (seteuid(getuid()) < 0) {
grc = TLOG_GRC_ERRNO;
tlog_errs_pushc(&errs, grc);
tlog_errs_pushs(&errs, "Failed setting EUID");
goto cleanup;
}
if (setegid(getgid()) < 0) {
grc = TLOG_GRC_ERRNO;
tlog_errs_pushc(&errs, grc);
tlog_errs_pushs(&errs, "Failed setting EGID");
goto cleanup;
}
/* Check if stdin/stdout/stderr are closed and stub them with /dev/null */
/* NOTE: Must be done first to avoid FD takeover by other code */
while (true) {
int fd = open("/dev/null", O_RDWR);
if (fd < 0) {
grc = TLOG_GRC_ERRNO;
tlog_errs_pushc(&errs, grc);
tlog_errs_pushs(&errs, "Failed opening /dev/null");
goto cleanup;
} else if (fd >= (int)TLOG_ARRAY_SIZE(std_fds)) {
close(fd);
break;
} else {
std_fds[fd] = -1;
}
}
/* Set locale from environment variables */
if (setlocale(LC_ALL, "") == NULL) {
grc = TLOG_GRC_ERRNO;
tlog_errs_pushc(&errs, grc);
tlog_errs_pushs(&errs,
"Failed setting locale from environment variables");
goto cleanup;
}
/* Read configuration and command-line usage message */
grc = tlog_rec_session_conf_load(&errs, &cmd_help, &conf, argc, argv);
if (grc != TLOG_RC_OK) {
goto cleanup;
}
/* Check that the character encoding is supported */
charset = nl_langinfo(CODESET);
if (strcmp(charset, "UTF-8") != 0) {
if (strcmp(charset, "ANSI_X3.4-1968") == 0) {
tlog_errs_pushf(&errs, "Locale charset is ANSI_X3.4-1968 (ASCII)");
tlog_errs_pushf(&errs, "Assuming locale environment is lost "
"and charset is UTF-8");
} else {
grc = TLOG_RC_FAILURE;
tlog_errs_pushf(&errs, "Unsupported locale charset: %s", charset);
goto cleanup;
}
}
/* Prepare shell command line */
grc = tlog_rec_session_conf_get_shell(&errs, conf,
&shell_path, &shell_argv);
if (grc != TLOG_RC_OK) {
tlog_errs_pushs(&errs, "Failed building shell command line");
goto cleanup;
}
/*
* Set the SHELL environment variable to the actual shell. Otherwise
* programs trying to spawn the user's shell would start tlog-rec-session
* instead.
*/
if (setenv("SHELL", shell_path, /*overwrite=*/1) != 0) {
grc = TLOG_GRC_ERRNO;
tlog_errs_pushc(&errs, grc);
tlog_errs_pushs(&errs, "Failed to set SHELL environment variable");
goto cleanup;
}
/* Run */
grc = tlog_rec(&errs, euid, egid, cmd_help, conf,
TLOG_REC_OPT_LOCK_SESS | TLOG_REC_OPT_DROP_PRIVS,
shell_path, shell_argv,
std_fds[0], std_fds[1], std_fds[2],
&status, &signal);
cleanup:
/* Print error stack, if any */
tlog_errs_print(stderr, errs);
/* Free shell argv list */
if (shell_argv != NULL) {
size_t i;
for (i = 0; shell_argv[i] != NULL; i++) {
free(shell_argv[i]);
}
free(shell_argv);
}
json_object_put(conf);
free(cmd_help);
tlog_errs_destroy(&errs);
/* Reproduce the exit signal to get proper exit status */
if (signal != 0) {
raise(signal);
}
/* Signal error if tlog error occurred */
if (grc != TLOG_RC_OK) {
return 1;
}
/* Mimick Bash exit status generation */
return WIFSIGNALED(status)
? 128 + WTERMSIG(status)
: WEXITSTATUS(status);
}
|
#include <p18cxxx.h>
#include "board.h"
#include "setup.h"
#include "comb-dev.h"
void mux_init(void) {
MUX_EN_H = 0;
MUX_EN_L = 0;
MUX_A0 = 0;
MUX_A1 = 0;
MUX_A2 = 0;
}
void mux_select(BYTE channel) {
MUX_EN_H = bitget(channel, 3);
MUX_EN_L = ~MUX_EN_H;
MUX_A0 = bitget(channel, 0);
MUX_A1 = bitget(channel, 1);
MUX_A2 = bitget(channel, 2);
//__delay_ms(5); // time for output stability
}
// EOF
|
/*
* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Barry Leslie
*
* 2010-06-09
*/
#pragma once
class PBMSDaemon {
public:
typedef enum {DaemonUnknown, DaemonStartUp, DaemonRunning, DaemonShuttingDown, DaemonError} DaemonState;
private:
static DaemonState pbd_state;
static char pbd_home_dir[PATH_MAX];
public:
static void setDaemonState(DaemonState state);
static bool isDaemonState(DaemonState state) { return (pbd_state == state);}
static const char *getPBMSDir() { return pbd_home_dir;}
};
|
/*
* OpenVPN-GUI -- A Windows GUI for OpenVPN.
*
* Copyright (C) 2004 Mathias Sundman <mathias@nilings.se>
*
* 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 included with this
* distribution); if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define MIN_PASSWORD_LEN 8
struct user_auth {
char username[50];
char password[50];
};
void CheckPrivateKeyPassphrasePrompt (char *line, int config);
void CheckAuthUsernamePrompt (char *line, int config);
void CheckAuthPasswordPrompt (char *line);
BOOL CALLBACK PassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AuthPasswordDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void ShowChangePassphraseDialog(int config);
BOOL CALLBACK ChangePassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void ChangePassphraseThread(int config);
int ConfirmNewPassword(HWND hwndDlg);
int NewPasswordLengh(HWND hwndDlg);
int ChangePasswordPEM(HWND hwndDlg);
int ChangePasswordPKCS12(HWND hwndDlg);
int GetKeyFilename(int config, char *keyfilename, unsigned int keyfilenamesize, int *keyfile_format);
|
/* This file is auto generated, version 2 */
/* SMP PREEMPT */
#define UTS_MACHINE "arm"
#define UTS_VERSION "#2 SMP PREEMPT Tue Dec 18 16:06:06 CST 2012"
#define LINUX_COMPILE_BY "drowningchild"
#define LINUX_COMPILE_HOST "drowningchild-5520"
#define LINUX_COMPILER "gcc version 4.4.3 (GCC) "
|
#ifndef __BTPHY_RF_H
#define __BTPHY_RF_H
#include <stdint.h>
#include "ubertooth.h"
/* Num of bytes left in fifo when FIFO_EMPTY int trigger 64usec */
#define PHY_MIN_FIFO_BYTES 16
#define PHY_FIFO_THRESHOLD (32-PHY_MIN_FIFO_BYTES)
#define WAIT_CC2400_STATE(state) while((cc2400_get(FSMSTATE) & 0x1f) != (state));
#define FS_TUNED() (cc2400_status() & FS_LOCK)
#define WAIT_FS_TUNED() while(!FS_TUNED())
#define RF_EXPECTED_RX_CLKN_OFFSET 610 // (29usec of rf warmup + 32usec of sw)
typedef void (*btbr_int_cb_t)(void *arg);
#define MAX_AC_ERRORS_DEFAULT 1
typedef struct {
uint16_t freq_off_reg;
uint16_t max_ac_errors;
btbr_int_cb_t int_handler;
void *int_arg;
} rf_state_t;
extern volatile rf_state_t rf_state;
void btphy_rf_init(void);
void btphy_rf_off(void);
void btphy_rf_set_freq_off(uint8_t off);
void btphy_rf_set_max_ac_errors(uint8_t max_ac_errors);
void btphy_rf_cfg_sync(uint32_t sync);
void btphy_rf_tune_chan(uint16_t channel, int tx);
void btphy_rf_fifo_write(uint8_t *data, unsigned len);
void btphy_rf_enable_int(btbr_int_cb_t cb, void*cb_arg, int tx);
void btphy_rf_disable_int(void);
static inline void btphy_rf_idle(void)
{
cc2400_strobe(SRFOFF);
TXLED_CLR;
RXLED_CLR;
}
static inline void btphy_rf_tx(void)
{
cc2400_strobe(STX);
TXLED_SET;
}
static inline void btphy_rf_rx(void)
{
cc2400_strobe(SRX);
RXLED_SET;
}
/* cc2400 configure for un-buffered rx */
static inline void btphy_rf_cfg_rx(void)
{
/* un-buffered mode, packet w/ sync word detection */
cc2400_set(GRMDM, 0x4E1|(rf_state.max_ac_errors<<13));
// 0 XX 00 1 001 11 0 00 0 1
// | | | | | +--------> CRC off
// | | | | +-----------> sync word: 32 MSB bits of SYNC_WORD
// | | | +---------------> 1 preamble bytes of (0)1010101
// | | +-----------------> packet mode
// | +--------------------> un-buffered mode // use sync word to trigger
// +-----------------------> sync error bits allowed: N
cc2400_set(IOCFG, 0x170|(GIO_PKT<<9));
}
/* cc2400 configure for buffered tx */
static inline void btphy_rf_cfg_tx(void)
{
cc2400_set(GRMDM, 0x0CE1);
// 0 00 01 1 001 11 0 00 0 1
// | | | | +--------> CRC off
// | | | +-----------> sync word: 32 MSB bits of SYNC_WORD
// | | +---------------> 1 preamble bytes of (0)1010101
// | +-----------------> packet mode / sync word detection
// +--------------------> buffered mode
cc2400_set(IOCFG, 0x170|(GIO_FIFO_EMPTY<<9));
}
#endif
|
/* smplayer2, GUI front-end for mplayer2.
Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.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 _OSPARSER_H_
#define _OSPARSER_H_
#include <QObject>
#include <QByteArray>
#include <QList>
#include <QDomDocument>
class OSSubtitle {
public:
QString movie, releasename, link, iso639, language, date;
QString format, comments, detail, rating, files, user;
};
class OSParser {
public:
OSParser();
~OSParser();
bool parseXml(QByteArray text);
QList<OSSubtitle> subtitleList() { return s_list; };
static QString calculateHash(QString filename);
protected:
QDomDocument dom_document;
QList <OSSubtitle> s_list;
};
#endif
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(lj/charmm/coul/msm,PairLJCharmmCoulMSM)
#else
#ifndef LMP_PAIR_LJ_CHARMM_COUL_MSM_H
#define LMP_PAIR_LJ_CHARMM_COUL_MSM_H
#include "pair_lj_charmm_coul_long.h"
namespace LAMMPS_NS {
class PairLJCharmmCoulMSM : public PairLJCharmmCoulLong {
public:
PairLJCharmmCoulMSM(class LAMMPS *);
virtual ~PairLJCharmmCoulMSM();
virtual void compute(int, int);
virtual double single(int, int, int, int, double, double, double, double &);
virtual void compute_outer(int, int);
virtual void *extract(const char *, int &);
protected:
int nmax;
double **ftmp;
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file.
E: Pair style lj/charmm/coul/long requires atom attribute q
The atom style defined does not have these attributes.
E: Pair inner cutoff >= Pair outer cutoff
The specified cutoffs for the pair style are inconsistent.
E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial
with kspace_style MSM
The kspace scalar pressure option cannot be used to obtain per-atom virial.
E: Must use 'kspace_modify pressure/scalar no' for rRESPA with kspace_style MSM
The kspace scalar pressure option cannot (yet) be used with rRESPA.
E: Pair cutoff < Respa interior cutoff
One or more pairwise cutoffs are too short to use with the specified
rRESPA cutoffs.
E: Pair inner cutoff < Respa interior cutoff
One or more pairwise cutoffs are too short to use with the specified
rRESPA cutoffs.
E: Pair style is incompatible with KSpace style
If a pair style with a long-range Coulombic component is selected,
then a kspace style must also be used.
*/
|
/* Program name management.
Copyright (C) 2001-2003 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, 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 _PROGNAME_H
#define _PROGNAME_H
#include <stdbool.h>
/* Programs using this file should do the following in main():
set_program_name (argv[0]);
*/
#ifdef __cplusplus
extern "C" {
#endif
/* String containing name the program is called with. */
extern DLL_VARIABLE const char *program_name;
/* Set program_name, based on argv[0]. */
extern void set_program_name (const char *argv0);
#if ENABLE_RELOCATABLE
/* Set program_name, based on argv[0], and original installation prefix and
directory, for relocatability. */
extern void set_program_name_and_installdir (const char *argv0,
const char *orig_installprefix,
const char *orig_installdir);
#define set_program_name(ARG0) \
set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
/* Return the full pathname of the current executable, based on the earlier
call to set_program_name_and_installdir. Return NULL if unknown. */
extern char *get_full_program_name (void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _PROGNAME_H */
|
/* Written by Peter Ekberg, peda@lysator.liu.se */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
char *
strdup(const char *s)
{
char *buf;
size_t len;
len = strlen(s)+1;
buf = (char *)malloc(sizeof(char) * len);
if(buf!=NULL)
memcpy((void *)buf, (const void *)s, len);
return(buf);
}
|
/**
Author: Iason Sarantopoulos
Institute: AUTh (Aristotle University of Thessaloniki)
Last update: 28/02/2015
This file is part of BAD (Barretthand AUTh Driver). BAD is a
basic driver to control a BarrettHand under Linux. This driver does not
provide real-time capabilities.
BAD is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
BAD 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/>.
*/
#include <cmath>
#include <vector>
#include "BarrettHand.h"
using namespace std;
#define HEIGHT 4
#define WIDTH 4
/**
* A class for the current state of the hand which includes data, as finger position
* and strain gauges values.
*/
class HandState {
BHand *hand; /**< A pointer to the object of the hand in use */
vector<vector<double> > jointPos; /**< 3x3 matrix. 3 fingers with 3 joints each. (elements are the angle Theta_i in rads) */
int F3; /**< The outer link offset, about 40 degrees. */
vector<double> strain; /**< 3x1 vector for the SG values. 3 fingers with one sensor each. */
bool brokenAway; /**< If true the Torque Switch mechanism has been engaged. */
public:
HandState(BHand* myHand);
~HandState();
void setJointPos(vector<vector<double> > newJointPos);
vector<vector<double> > getJointPos();
void setStrain(vector<double> newStrain);
vector<double> getStrain();
void update();
void printOut();
double innerLinkJointAngle(int JP);
double outerLinkJointAngle(int P, int JP);
};
class Kinematics {
// Aw, A1, A2, A3, Dw, D3: distances in mm
// F2, F3: angles in degrees
int r[3], j[3];
double Aw, A1, A2, A3, Dw, D3, F2, F3;
double A[3][4], a[3][4], D[3][4], theta[3][4];
public:
Kinematics();
~Kinematics();
// forward();
vector<vector<double> > multiplyMatrices(vector<vector<double> > T1, vector<vector<double> > T2);
vector<vector<double> > HTMatrix(double theta, double A, double alpha, double d);
vector<vector<double> > findHTmatrix(int finger, HandState state);
vector<vector<double> > homogeneousTF(int finger, HandState state);
vector<vector<double> > inverseKinematics(int finger, double *p);
//int init();
//int reset();
};
|
#include <stdio.h>
static int count = 0;
int main(void)
{
while (1) {
int core;
asm ("rdhwr %0,$0" : "=r"(core));
printf("Hello from %d\n", core);
}
return 0;
}
|
#ifndef DOCK_SHADEREDITOR
#define DOCK_SHADEREDITOR
#include "../imgui_docks/dock.h"
#include <string>
#include "../imgui/imgui_dock.h"
#include "../tr_local.h"
class DockShaders : public Dock {
public:
shaderProgram_t *shader = NULL;
int currentItem = 4; // select lightall shader for start menu
//std::string filename;
/*ImGui::*/Dock *imguidock;
DockShaders();
virtual const char *label();
virtual void imgui();
void recompileShader();
//void recompileFragmentShader();
};
#endif |
#ifndef _SPARC64_LDC_H
#define _SPARC64_LDC_H
#include <asm/hypervisor.h>
extern int ldom_domaining_enabled;
extern void ldom_set_var(const char *var, const char *value);
extern void ldom_reboot(const char *boot_command);
extern void ldom_power_off(void);
struct ldc_channel_config {
void (*event)(void *arg, int event);
u32 mtu;
unsigned int rx_irq;
unsigned int tx_irq;
u8 mode;
#define LDC_MODE_RAW 0x00
#define LDC_MODE_UNRELIABLE 0x01
#define LDC_MODE_RESERVED 0x02
#define LDC_MODE_STREAM 0x03
u8 debug;
#define LDC_DEBUG_HS 0x01
#define LDC_DEBUG_STATE 0x02
#define LDC_DEBUG_RX 0x04
#define LDC_DEBUG_TX 0x08
#define LDC_DEBUG_DATA 0x10
};
#define LDC_EVENT_RESET 0x01
#define LDC_EVENT_UP 0x02
#define LDC_EVENT_DATA_READY 0x04
#define LDC_STATE_INVALID 0x00
#define LDC_STATE_INIT 0x01
#define LDC_STATE_BOUND 0x02
#define LDC_STATE_READY 0x03
#define LDC_STATE_CONNECTED 0x04
struct ldc_channel;
/* Allocate state for a channel. */
extern struct ldc_channel *ldc_alloc(unsigned long id,
const struct ldc_channel_config *cfgp,
void *event_arg);
/* Shut down and free state for a channel. */
extern void ldc_free(struct ldc_channel *lp);
/* Register TX and RX queues of the link with the hypervisor. */
extern int ldc_bind(struct ldc_channel *lp, const char *name);
extern int ldc_connect(struct ldc_channel *lp);
extern int ldc_disconnect(struct ldc_channel *lp);
extern int ldc_state(struct ldc_channel *lp);
/* Read and write operations. Only valid when the link is up. */
extern int ldc_write(struct ldc_channel *lp, const void *buf,
unsigned int size);
extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
#define LDC_MAP_SHADOW 0x01
#define LDC_MAP_DIRECT 0x02
#define LDC_MAP_IO 0x04
#define LDC_MAP_R 0x08
#define LDC_MAP_W 0x10
#define LDC_MAP_X 0x20
#define LDC_MAP_RW (LDC_MAP_R | LDC_MAP_W)
#define LDC_MAP_RWX (LDC_MAP_R | LDC_MAP_W | LDC_MAP_X)
#define LDC_MAP_ALL 0x03f
struct ldc_trans_cookie {
u64 cookie_addr;
u64 cookie_size;
};
struct scatterlist;
extern int ldc_map_sg(struct ldc_channel *lp,
struct scatterlist *sg, int num_sg,
struct ldc_trans_cookie *cookies, int ncookies,
unsigned int map_perm);
extern int ldc_map_single(struct ldc_channel *lp,
void *buf, unsigned int len,
struct ldc_trans_cookie *cookies, int ncookies,
unsigned int map_perm);
extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
int ncookies);
extern int ldc_copy(struct ldc_channel *lp, int copy_dir,
void *buf, unsigned int len, unsigned long offset,
struct ldc_trans_cookie *cookies, int ncookies);
static inline int ldc_get_dring_entry(struct ldc_channel *lp,
void *buf, unsigned int len,
unsigned long offset,
struct ldc_trans_cookie *cookies,
int ncookies)
{
return ldc_copy(lp, LDC_COPY_IN, buf, len, offset, cookies, ncookies);
}
static inline int ldc_put_dring_entry(struct ldc_channel *lp,
void *buf, unsigned int len,
unsigned long offset,
struct ldc_trans_cookie *cookies,
int ncookies)
{
return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
}
extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
struct ldc_trans_cookie *cookies,
int *ncookies, unsigned int map_perm);
extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
unsigned int len,
struct ldc_trans_cookie *cookies, int ncookies);
#endif /* _SPARC64_LDC_H */
|
#ifndef _IR_I2C
#define _IR_I2C
#include <media/ir-common.h>
struct IR_i2c;
struct IR_i2c {
struct ir_scancode_table *ir_codes;
struct i2c_client *c;
struct input_dev *input;
struct ir_input_state ir;
unsigned char old;
struct delayed_work work;
char name[32];
char phys[32];
int (*get_key)(struct IR_i2c*, u32*, u32*);
};
enum ir_kbd_get_key_fn {
IR_KBD_GET_KEY_CUSTOM = 0,
IR_KBD_GET_KEY_PIXELVIEW,
IR_KBD_GET_KEY_PV951,
IR_KBD_GET_KEY_HAUP,
IR_KBD_GET_KEY_KNC1,
IR_KBD_GET_KEY_FUSIONHDTV,
IR_KBD_GET_KEY_HAUP_XVR,
IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,
};
struct IR_i2c_init_data {
struct ir_scancode_table *ir_codes;
const char *name;
int type;
int (*get_key)(struct IR_i2c*, u32*, u32*);
enum ir_kbd_get_key_fn internal_get_key_func;
};
#endif
|
#ifndef _LISTHELP_H
#define _LISTHELP_H
#include <linux/config.h>
#include <linux/list.h>
#include <linux/netfilter_ipv4/lockhelp.h>
/* Header to do more comprehensive job than linux/list.h; assume list
is first entry in structure. */
/* Return pointer to first true entry, if any, or NULL. A macro
required to allow inlining of cmpfn. */
#define LIST_FIND(head, cmpfn, type, args...) \
({ \
const struct list_head *__i = (head); \
\
ASSERT_READ_LOCK(head); \
do { \
__i = __i->next; \
if (__i == (head)) { \
__i = NULL; \
break; \
} \
} while (!cmpfn((const type)__i , ## args)); \
(type)__i; \
})
#define LIST_FIND_W(head, cmpfn, type, args...) \
({ \
const struct list_head *__i = (head); \
\
ASSERT_WRITE_LOCK(head); \
do { \
__i = __i->next; \
if (__i == (head)) { \
__i = NULL; \
break; \
} \
} while (!cmpfn((type)__i , ## args)); \
(type)__i; \
})
static inline int
__list_cmp_same(const void *p1, const void *p2)
{
return p1 == p2;
}
/* Is this entry in the list? */
static inline int
list_inlist(struct list_head *head, const void *entry)
{
return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL;
}
/* Delete from list. */
#ifdef CONFIG_NETFILTER_DEBUG
#define LIST_DELETE(head, oldentry) \
do { \
ASSERT_WRITE_LOCK(head); \
if (!list_inlist(head, oldentry)) \
printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \
__FILE__, __LINE__, #oldentry, oldentry, #head); \
else list_del((struct list_head *)oldentry); \
} while(0)
#else
#define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry)
#endif
/* Append. */
static inline void
list_append(struct list_head *head, void *new)
{
ASSERT_WRITE_LOCK(head);
list_add((new), (head)->prev);
}
/* Prepend. */
static inline void
list_prepend(struct list_head *head, void *new)
{
ASSERT_WRITE_LOCK(head);
list_add(new, head);
}
/* Insert according to ordering function; insert before first true. */
#define LIST_INSERT(head, new, cmpfn) \
do { \
struct list_head *__i; \
ASSERT_WRITE_LOCK(head); \
for (__i = (head)->next; \
!cmpfn((new), (typeof (new))__i) && __i != (head); \
__i = __i->next); \
list_add((struct list_head *)(new), __i->prev); \
} while(0)
/* If the field after the list_head is a nul-terminated string, you
can use these functions. */
static inline int __list_cmp_name(const void *i, const char *name)
{
return strcmp(name, i+sizeof(struct list_head)) == 0;
}
/* Returns false if same name already in list, otherwise does insert. */
static inline int
list_named_insert(struct list_head *head, void *new)
{
if (LIST_FIND(head, __list_cmp_name, void *,
new + sizeof(struct list_head)))
return 0;
list_prepend(head, new);
return 1;
}
/* Find this named element in the list. */
#define list_named_find(head, name) \
LIST_FIND(head, __list_cmp_name, void *, name)
#endif /*_LISTHELP_H*/
|
/*
* acpi.c - Architecture-Specific Low-Level ACPI Support
*
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
* Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
* Copyright (C) 2001 Patrick Mochel <mochel@osdl.org>
* Copyright (C) 2002 Andi Kleen, SuSE Labs (x86-64 port)
* Copyright (C) 2003 Pavel Machek, SuSE Labs
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/bootmem.h>
#include <linux/acpi.h>
#include <linux/cpumask.h>
#include <asm/mpspec.h>
#include <asm/io.h>
#include <asm/apic.h>
#include <asm/apicdef.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/io_apic.h>
#include <asm/proto.h>
#include <asm/tlbflush.h>
/* --------------------------------------------------------------------------
Low-Level Sleep Support
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_SLEEP
#ifndef CONFIG_ACPI_PV_SLEEP
/* address in low memory of the wakeup routine. */
unsigned long acpi_wakeup_address = 0;
unsigned long acpi_video_flags;
extern char wakeup_start, wakeup_end;
extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
static pgd_t low_ptr;
static void init_low_mapping(void)
{
pgd_t *slot0 = pgd_offset(current->mm, 0UL);
low_ptr = *slot0;
set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
WARN_ON(num_online_cpus() != 1);
local_flush_tlb();
}
#endif
/**
* acpi_save_state_mem - save kernel state
*
* Create an identity mapped page table and copy the wakeup routine to
* low memory.
*/
int acpi_save_state_mem(void)
{
#ifndef CONFIG_ACPI_PV_SLEEP
init_low_mapping();
memcpy((void *)acpi_wakeup_address, &wakeup_start,
&wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
#endif
return 0;
}
/*
* acpi_restore_state
*/
void acpi_restore_state_mem(void)
{
#ifndef CONFIG_ACPI_PV_SLEEP
set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
local_flush_tlb();
#endif
}
/**
* acpi_reserve_bootmem - do _very_ early ACPI initialisation
*
* We allocate a page in low memory for the wakeup
* routine for when we come back from a sleep state. The
* runtime allocator allows specification of <16M pages, but not
* <1M pages.
*/
void __init acpi_reserve_bootmem(void)
{
#ifndef CONFIG_ACPI_PV_SLEEP
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
printk(KERN_CRIT
"ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
#endif
}
#ifndef CONFIG_ACPI_PV_SLEEP
static int __init acpi_sleep_setup(char *str)
{
while ((str != NULL) && (*str != '\0')) {
if (strncmp(str, "s3_bios", 7) == 0)
acpi_video_flags = 1;
if (strncmp(str, "s3_mode", 7) == 0)
acpi_video_flags |= 2;
str = strchr(str, ',');
if (str != NULL)
str += strspn(str, ", \t");
}
return 1;
}
__setup("acpi_sleep=", acpi_sleep_setup);
#endif /* CONFIG_ACPI_PV_SLEEP */
#endif /*CONFIG_ACPI_SLEEP */
void acpi_pci_link_exit(void)
{
}
|
/****************************************************************************
Author : Gabriele 'matrix' Gristina <gabriele.gristina@gmail.com>
Date : Sun Jan 10 13:59:37 CET 2021
Version: 0.1beta
License: GNU General Public License v3 or any later version (see LICENSE.txt)
*****************************************************************************
Copyright (C) 2020-2021 <Gabriele Gristina>
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/>.
****************************************************************************/
// trust me...i'm a dolphin :P
// too many allocations, too many free to manage, I need dolphin macros :)
// they could be buggy, but if you know how to fix them, do it
#define MEMORY_FREE_ADD(a) { freeList[freeListIdx++] = (void *)(a); }
#define MEMORY_FREE_ALL { int t=freeListIdx; while (t-- > 0) if (freeList[t]!=NULL) { free (freeList[t]); freeList[t]=NULL; } if (freeList!=NULL) { free (freeList); freeList=NULL; } }
#define MEMORY_FREE_DEL(a) { for (int i=0;i<freeListIdx;i++) { if(freeList[i] && a==freeList[i]) { free(freeList[i]); freeList[i]=NULL; break; } } }
#define MEMORY_FREE_LIST(a,i) { if (i > 0) { int t=(int)i; do { if (a[t]!=NULL) { free(a[t]); a[t]=NULL; } } while (--t >= 0); MEMORY_FREE_DEL(a) } }
#define MEMORY_FREE_LIST_Z(a,i) { int t=(int)i; do { if (a[t]!=NULL) { free(a[t]); a[t]=NULL; } } while (--t >= 0); MEMORY_FREE_DEL(a) }
#define MEMORY_FREE_OPENCL(c,i) { int t=(int)i; do { if (c.contexts[t]) clReleaseContext (c.contexts[t]); if (c.keystreams[t]) clReleaseMemObject (c.keystreams[t]); \
if (c.candidates[t]) clReleaseMemObject (c.candidates[t]); if (c.matches[t]) clReleaseMemObject (c.matches[t]); \
if (c.matches_found[t]) clReleaseMemObject (c.matches_found[t]); if (c.commands[t]) clReleaseCommandQueue (c.commands[t]); \
if (c.kernels[t]) clReleaseKernel (c.kernels[t]); if (c.programs[t]) clReleaseProgram (c.programs[t]); } while (--t >= 0); }
|
/*
File: ISL23345.h
Author: J. Ian Lindsay
Date: 2014.03.10
Copyright (C) 2014 J. Ian Lindsay
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
This is the class that represents an ISL23345 digital potentiometer.
*/
#ifndef ISL23345_DIGIPOT_H
#define ISL23345_DIGIPOT_H 1
#include <inttypes.h>
#ifdef ARDUINO
#include "Arduino.h"
#else
#include <stdio.h>
#include <stdlib.h>
#endif
/*
*
*
*/
class ISL23345 {
public:
ISL23345(uint8_t i2c_addr);
~ISL23345(void);
int8_t init(void); // Perform bus-related init tasks.
void preserveOnDestroy(bool);
int8_t setValue(uint8_t pot, uint8_t val); // Sets the value of the given pot.
uint8_t getValue(uint8_t pot);
int8_t reset(void); // Sets all volumes levels to zero.
int8_t reset(uint8_t); // Sets all volumes levels to given.
int8_t disable(void);
int8_t enable(void);
bool enabled(void);
uint16_t getRange(void); // Discover the range of this pot.
void dumpToLog(void);
static const int8_t ISL23345_ERROR_DEVICE_DISABLED; // A caller tried to set a wiper while the device is disabled. This may work...
static const int8_t ISL23345_ERROR_PEGGED_MAX; // There was no error, but a call to change a wiper setting pegged the wiper at its highest position.
static const int8_t ISL23345_ERROR_PEGGED_MIN; // There was no error, but a call to change a wiper setting pegged the wiper at its lowest position.
static const int8_t ISL23345_ERROR_NO_ERROR; // There was no error.
static const int8_t ISL23345_ERROR_ABSENT; // The ISL23345 appears to not be connected to the bus.
static const int8_t ISL23345_ERROR_BUS; // Something went wrong with the i2c bus.
static const int8_t ISL23345_ERROR_ALREADY_AT_MAX; // A caller tried to increase the value of the wiper beyond its maximum.
static const int8_t ISL23345_ERROR_ALREADY_AT_MIN; // A caller tried to decrease the value of the wiper below its minimum.
static const int8_t ISL23345_ERROR_INVALID_POT; // The ISL23345 only has 4 potentiometers.
private:
uint8_t I2C_ADDRESS;
bool dev_init;
bool dev_enabled;
bool preserve_state_on_destroy;
uint8_t values[4];
};
#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 CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_CONTENT_VIEW_H_
#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_CONTENT_VIEW_H_
#import <Cocoa/Cocoa.h>
#import "ui/base/cocoa/base_view.h"
namespace autofill {
class AutofillPopupController;
}
@interface AutofillPopupViewCocoa : BaseView {
@private
__weak autofill::AutofillPopupController* controller_;
}
- (id)initWithController:(autofill::AutofillPopupController*)controller
frame:(NSRect)frame;
- (void)controllerDestroyed;
@end
#endif
|
/****
Copyright (c) 2014, University of Tuebingen
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder 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.
****
Author: Benjamin Buchfink
****/
#ifndef ALIGN_H_
#define ALIGN_H_
#include "../data/reference.h"
#include "../basic/statistics.h"
#include "../basic/score_matrix.h"
#include "../basic/shape_config.h"
#include "../search/sse_dist.h"
#include "../search/collision.h"
#include "../search/hit_filter.h"
#include "../search/align_ungapped.h"
template<typename _val, typename _locr, typename _locq, typename _locl>
void align(const _locq q_pos,
const _val *query,
_locr s,
Statistics &stats,
const unsigned sid,
hit_filter<_val,_locr,_locq,_locl> &hf)
{
stats.inc(Statistics::TENTATIVE_MATCHES0);
const _val* subject = ref_seqs<_val>::data_->data(s);
if(fast_match(query, subject) < program_options::min_identities)
return;
stats.inc(Statistics::TENTATIVE_MATCHES1);
unsigned delta, len;
int score;
if((score = xdrop_ungapped<_val,_locr,_locq>(query, subject, shape_config::get().get_shape(sid).length_, delta, len)) < program_options::min_ungapped_raw_score)
return;
if(!is_primary_hit<_val,_locr>(query-delta, subject-delta, delta, sid, len))
return;
stats.inc(Statistics::TENTATIVE_MATCHES2);
hf.push(s, score);
}
#endif /* ALIGN_H_ */
|
/*
* host_os.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Copyright (C) 2008 Texas Instruments, Inc.
*
* This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _HOST_OS_H_
#define _HOST_OS_H_
#include <linux/atomic.h>
#include <linux/semaphore.h>
#include <linux/uaccess.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/syscalls.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/ctype.h>
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/vmalloc.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <plat/clock.h>
#include <linux/clk.h>
#include <plat/mailbox.h>
#include <linux/pagemap.h>
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
/* TODO -- Remove, once BP defines them */
#define INT_DSP_MMU_IRQ 28
#define PRCM_VDD1 1
extern struct platform_device *omap_dspbridge_dev;
extern struct device *bridge;
#endif
|
/*
* Qtstalker stock charter
*
* Copyright (C) 2001-2010 Stefan S. Stratigakos
*
* 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 CHART_OBJECT_SELL_HPP
#define CHART_OBJECT_SELL_HPP
#include "ChartObject.h"
class ChartObjectSell : public ChartObject
{
public:
ChartObjectSell ();
void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) const;
int info (Entity &);
void move (QPoint);
int create ();
};
#endif
|
/*
* Router ID for zebra daemon.
*
* Copyright (C) 2004 James R. Leu
*
* This file is part of Quagga routing suite.
*
* Quagga 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.
*
* Quagga 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 GNU Zebra; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <zebra.h>
#include "if.h"
#include "vty.h"
#include "sockunion.h"
#include "prefix.h"
#include "stream.h"
#include "command.h"
#include "memory.h"
#include "ioctl.h"
#include "connected.h"
#include "network.h"
#include "log.h"
#include "table.h"
#include "rib.h"
#include "zebra/zserv.h"
#include "zebra/router-id.h"
#include "zebra/redistribute.h"
static struct zlist rid_all_sorted_list;
static struct zlist rid_lo_sorted_list;
static struct prefix rid_user_assigned;
/* master zebra server structure */
extern struct zebra_t zebrad;
static struct connected *
router_id_find_node (struct zlist *l, struct connected *ifc)
{
struct zlistnode *node;
struct connected *c;
for (ALL_LIST_ELEMENTS_RO (l, node, c))
if (prefix_same (ifc->address, c->address))
return c;
return NULL;
}
static int
router_id_bad_address (struct connected *ifc)
{
if (ifc->address->family != AF_INET)
return 1;
/* non-redistributable addresses shouldn't be used for RIDs either */
if (!zebra_check_addr (ifc->address))
return 1;
return 0;
}
void
router_id_get (struct prefix *p)
{
struct zlistnode *node;
struct connected *c;
p->u.prefix4.s_addr = 0;
p->family = AF_INET;
p->prefixlen = 32;
if (rid_user_assigned.u.prefix4.s_addr)
p->u.prefix4.s_addr = rid_user_assigned.u.prefix4.s_addr;
else if (!list_isempty (&rid_lo_sorted_list))
{
node = listtail (&rid_lo_sorted_list);
c = listgetdata (node);
p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
}
else if (!list_isempty (&rid_all_sorted_list))
{
node = listtail (&rid_all_sorted_list);
c = listgetdata (node);
p->u.prefix4.s_addr = c->address->u.prefix4.s_addr;
}
}
static void
router_id_set (struct prefix *p)
{
struct prefix p2;
struct zlistnode *node;
struct zserv *client;
rid_user_assigned.u.prefix4.s_addr = p->u.prefix4.s_addr;
router_id_get (&p2);
for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client))
zsend_router_id_update (client, &p2);
}
void
router_id_add_address (struct connected *ifc)
{
struct zlist *l = NULL;
struct zlistnode *node;
struct prefix before;
struct prefix after;
struct zserv *client;
if (router_id_bad_address (ifc))
return;
router_id_get (&before);
if (!strncmp (ifc->ifp->name, "lo", 2)
|| !strncmp (ifc->ifp->name, "dummy", 5))
l = &rid_lo_sorted_list;
else
l = &rid_all_sorted_list;
if (!router_id_find_node (l, ifc))
listnode_add (l, ifc);
router_id_get (&after);
if (prefix_same (&before, &after))
return;
for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client))
zsend_router_id_update (client, &after);
}
void
router_id_del_address (struct connected *ifc)
{
struct connected *c;
struct zlist *l;
struct prefix after;
struct prefix before;
struct zlistnode *node;
struct zserv *client;
if (router_id_bad_address (ifc))
return;
router_id_get (&before);
if (!strncmp (ifc->ifp->name, "lo", 2)
|| !strncmp (ifc->ifp->name, "dummy", 5))
l = &rid_lo_sorted_list;
else
l = &rid_all_sorted_list;
if ((c = router_id_find_node (l, ifc)))
listnode_delete (l, c);
router_id_get (&after);
if (prefix_same (&before, &after))
return;
for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client))
zsend_router_id_update (client, &after);
}
void
router_id_write (struct vty *vty)
{
if (rid_user_assigned.u.prefix4.s_addr)
vty_out (vty, "router-id %s%s", inet_ntoa (rid_user_assigned.u.prefix4),
VTY_NEWLINE);
}
DEFUN (router_id,
router_id_cmd,
"router-id A.B.C.D",
"Manually set the router-id\n"
"IP address to use for router-id\n")
{
struct prefix rid;
rid.u.prefix4.s_addr = inet_addr (argv[0]);
if (!rid.u.prefix4.s_addr)
return CMD_WARNING;
rid.prefixlen = 32;
rid.family = AF_INET;
router_id_set (&rid);
return CMD_SUCCESS;
}
DEFUN (no_router_id,
no_router_id_cmd,
"no router-id",
NO_STR
"Remove the manually configured router-id\n")
{
struct prefix rid;
rid.u.prefix4.s_addr = 0;
rid.prefixlen = 0;
rid.family = AF_INET;
router_id_set (&rid);
return CMD_SUCCESS;
}
static int
router_id_cmp (void *a, void *b)
{
unsigned int A, B;
A = ((struct connected *) a)->address->u.prefix4.s_addr;
B = ((struct connected *) b)->address->u.prefix4.s_addr;
if (A > B)
return 1;
else if (A < B)
return -1;
return 0;
}
void
router_id_init (void)
{
install_element (CONFIG_NODE, &router_id_cmd);
install_element (CONFIG_NODE, &no_router_id_cmd);
memset (&rid_all_sorted_list, 0, sizeof (rid_all_sorted_list));
memset (&rid_lo_sorted_list, 0, sizeof (rid_lo_sorted_list));
memset (&rid_user_assigned, 0, sizeof (rid_user_assigned));
rid_all_sorted_list.cmp = router_id_cmp;
rid_lo_sorted_list.cmp = router_id_cmp;
rid_user_assigned.family = AF_INET;
rid_user_assigned.prefixlen = 32;
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: hxcbobj.h,v 1.5 2005/03/14 19:36:40 bobclark Exp $
*
* Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the RealNetworks Public
* Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (the "RCSL") available at
* http://www.helixcommunity.org/content/rcsl, in which case the RCSL
* will apply. You may also obtain the license terms directly from
* RealNetworks. You may not use this file except in compliance with
* the RPSL or, if you have a valid RCSL with RealNetworks applicable
* to this file, the RCSL. Please see the applicable RPSL or RCSL for
* the rights, obligations and limitations governing use of the
* contents of the file.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL") in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your version of
* this file only under the terms of the GPL, and not to allow others
* to use your version of this file under the terms of either the RPSL
* or RCSL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient may
* use your version of this file under the terms of any one of the
* RPSL, the RCSL or the GPL.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the
* portions it created.
*
* This file, and the files included with this file, is distributed
* and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
* ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _HXCBOBJ_H_
#define _HXCBOBJ_H_
#include "hxengin.h"
typedef void (*fGenericCBFunc)(void* pParam);
class CHXGenericCallback : public IHXCallback
{
public:
CHXGenericCallback(void* pParam, fGenericCBFunc pFunc);
virtual ~CHXGenericCallback();
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
STDMETHOD(Func)(THIS);
void CallbackScheduled(CallbackHandle hHandle) {m_PendingHandle = hHandle;}
void CallbackCanceled() {m_PendingHandle = 0;}
CallbackHandle GetPendingCallback() {return m_PendingHandle;}
HXBOOL IsCallbackPending() { return (m_PendingHandle ? TRUE : FALSE); }
// Helper functions for commonly-used tasks
void ScheduleRelative(IHXScheduler* pScheduler, UINT32 ulMs);
void Cancel(IHXScheduler* pScheduler);
protected:
LONG32 m_lRefCount;
fGenericCBFunc m_fpCB;
void* m_pParam;
CallbackHandle m_PendingHandle;
};
#endif //_HXCBOBJ_H_
|
#ifndef SRC_SYSTEM_ALIYUN_IOT_CA_H_
#define SRC_SYSTEM_ALIYUN_IOT_CA_H_
const char *aliyun_iot_ca_get(void);
#endif /* _SYSTEM_ALIYUN_IOT_CA_H_ */
|
/* SpiralSound - Copyleft (C) 2017 Andy Preston <edgeeffect@gmail.com>
* Based on SpiralSynthModular - Copyleft (C) 2000 David Griffiths <dave@pawfal.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 SpiralINFO
#define SpiralINFO
using namespace std;
class SpiralInfo {
public:
SpiralInfo();
int bufferSize;
int sampleRate;
/*
long MAXSAMPLE;
float VALUECONV;
int FILTERGRAN;
*/
};
#endif |
//
// CallInfoWindowController.h
// ACE
//
// Created by Ruben Semerjyan on 10/12/15.
// Copyright © 2015 VTCSecure. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface CallInfoWindowController : NSWindowController
@end
|
/*
* Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __MTD_TRANS_H__
#define __MTD_TRANS_H__
#include <linux/mutex.h>
#include <linux/kref.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>
struct hd_geometry;
struct mtd_info;
struct mtd_blktrans_ops;
struct file;
struct inode;
struct mtd_blktrans_dev {
struct mtd_blktrans_ops *tr;
struct list_head list;
struct mtd_info *mtd;
struct mutex lock;
int devnum;
bool bg_stop;
unsigned long size;
int readonly;
int open;
struct kref ref;
struct gendisk *disk;
struct attribute_group *disk_attributes;
struct workqueue_struct *wq;
struct work_struct work;
struct request_queue *rq;
spinlock_t queue_lock;
void *priv;
fmode_t file_mode;
};
struct mtd_blktrans_ops {
char *name;
int major;
int part_bits;
int blksize;
int blkshift;
/* Access functions */
int (*readsect)(struct mtd_blktrans_dev *dev,
unsigned long block, char *buffer);
int (*writesect)(struct mtd_blktrans_dev *dev,
unsigned long block, char *buffer);
int (*discard)(struct mtd_blktrans_dev *dev,
unsigned long block, unsigned nr_blocks);
void (*background)(struct mtd_blktrans_dev *dev);
/* Block layer ioctls */
int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
int (*flush)(struct mtd_blktrans_dev *dev);
/* Called with mtd_table_mutex held; no race with add/remove */
int (*open)(struct mtd_blktrans_dev *dev);
void (*release)(struct mtd_blktrans_dev *dev);
/* Called on {de,}registration and on subsequent addition/removal
of devices, with mtd_table_mutex held. */
void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
void (*remove_dev)(struct mtd_blktrans_dev *dev);
struct list_head devs;
struct list_head list;
struct module *owner;
};
extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
#endif /* __MTD_TRANS_H__ */
|
/*
* \brief Timer session interface
* \author Norman Feske
* \author Markus Partheymueller
* \date 2006-08-15
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
* Copyright (C) 2012 Intel Corporation
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_
#define _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_
#include <base/signal.h>
#include <session/session.h>
namespace Timer { struct Session; }
struct Timer::Session : Genode::Session
{
typedef Genode::Signal_context_capability Signal_context_capability;
static const char *service_name() { return "Timer"; }
virtual ~Session() { }
/**
* Program single timeout (relative from now in microseconds)
*/
virtual void trigger_once(unsigned us) = 0;
/**
* Program periodic timeout (in microseconds)
*
* The first period will be triggered after 'us' at the latest,
* but it might be triggered earlier as well.
*/
virtual void trigger_periodic(unsigned us) = 0;
/**
* Register timeout signal handler
*/
virtual void sigh(Genode::Signal_context_capability sigh) = 0;
/**
* Return number of elapsed milliseconds since session creation
*/
virtual unsigned long elapsed_ms() const = 0;
/**
* Client-side convenience function for sleeping the specified number
* of milliseconds
*/
virtual void msleep(unsigned ms) = 0;
/**
* Client-side convenience function for sleeping the specified number
* of microseconds
*/
virtual void usleep(unsigned us) = 0;
/*********************
** RPC declaration **
*********************/
GENODE_RPC(Rpc_trigger_once, void, trigger_once, unsigned);
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, unsigned);
GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
GENODE_RPC(Rpc_elapsed_ms, unsigned long, elapsed_ms);
GENODE_RPC_INTERFACE(Rpc_trigger_once, Rpc_trigger_periodic,
Rpc_sigh, Rpc_elapsed_ms);
};
#endif /* _INCLUDE__TIMER_SESSION__TIMER_SESSION_H_ */
|
/*
* Copyright (C) 2008-2011 WCloudCore <http://www.wcloudcore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_BLOOD_FURNACE_H
#define DEF_BLOOD_FURNACE_H
#define DATA_THE_MAKER 1
#define DATA_BROGGOK 2
#define DATA_KELIDAN_THE_MAKER 3
#define TYPE_THE_MAKER_EVENT 4
#define TYPE_BROGGOK_EVENT 5
#define TYPE_KELIDAN_THE_BREAKER_EVENT 6
#define DATA_DOOR1 7
#define DATA_DOOR2 8
#define DATA_DOOR3 9
#define DATA_DOOR4 10
#define DATA_DOOR5 11
#define DATA_DOOR6 12
#define DATA_PRISON_CELL1 13
#define DATA_PRISON_CELL2 14
#define DATA_PRISON_CELL3 15
#define DATA_PRISON_CELL4 16
#define DATA_PRISON_CELL5 17
#define DATA_PRISON_CELL6 18
#define DATA_PRISON_CELL7 19
#define DATA_PRISON_CELL8 20
#endif |
/*
* tslib/src/ts_config.c
*
* Copyright (C) 2001 Russell King.
*
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
* $Id: ts_config.c,v 1.5 2004/10/19 22:01:27 dlowder Exp $
*
* Read the configuration and load the appropriate drivers.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "tslib-private.h"
/* Maximum line size is BUF_SIZE - 2
* -1 for fgets and -1 to test end of line
*/
#define BUF_SIZE 512
int ts_config(struct tsdev *ts)
{
char buf[BUF_SIZE], *p;
FILE *f;
int line = 0;
int ret = 0;
char *conffile;
if( (conffile = getenv("TSLIB_CONFFILE")) == NULL) {
conffile = strdup (TS_CONF);
}
f = fopen(conffile, "r");
if (!f) {
perror("Couldnt open tslib config file");
return -1;
}
buf[BUF_SIZE - 2] = '\0';
while ((p = fgets(buf, BUF_SIZE, f)) != NULL) {
char *e;
char *tok;
char *module_name;
line++;
/* Chomp */
e = strchr(p, '\n');
if (e) {
*e = '\0';
}
/* Did we read a whole line? */
if (buf[BUF_SIZE - 2] != '\0') {
ts_error("%s: line %d too long\n", conffile, line);
break;
}
tok = strsep(&p, " \t");
/* Ignore comments or blank lines.
* Note: strsep modifies p (see man strsep)
*/
if (p==NULL || *tok == '#')
continue;
/* Search for the option. */
if (strcasecmp(tok, "module") == 0) {
module_name = strsep(&p, " \t");
ret = ts_load_module(ts, module_name, p);
}
else if (strcasecmp(tok, "module_raw") == 0) {
module_name = strsep(&p, " \t");
ret = ts_load_module_raw(ts, module_name, p);
} else {
ts_error("%s: Unrecognised option %s:%d:%s\n", conffile, line, tok);
break;
}
if (ret != 0) {
ts_error("Couldnt load module %s\n", module_name);
break;
}
}
if (ts->list_raw == NULL) {
ts_error("No raw modules loaded.\n");
ret = -1;
}
fclose(f);
return ret;
}
|
/* -*- Mode: c; c-basic-offset: 2 -*-
*
* strcasecmp.c - strcasecmp compatibility
*
* This file is in the public domain.
*
*/
#ifdef HAVE_CONFIG_H
#include <rasqal_config.h>
#endif
#ifdef WIN32
#include <win32_rasqal_config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "rasqal.h"
#include "rasqal_internal.h"
#ifndef STANDALONE
int
rasqal_strcasecmp(const char* s1, const char* s2)
{
register int c1, c2;
while(*s1 && *s2) {
c1 = tolower(RASQAL_GOOD_CAST(int, *s1));
c2 = tolower(RASQAL_GOOD_CAST(int, *s2));
if (c1 != c2)
return (c1 - c2);
s1++;
s2++;
}
return RASQAL_GOOD_CAST(int, (*s1 - *s2));
}
int
rasqal_strncasecmp(const char* s1, const char* s2, size_t n)
{
register int c1, c2;
while(*s1 && *s2 && n) {
c1 = tolower(RASQAL_GOOD_CAST(int, *s1));
c2 = tolower(RASQAL_GOOD_CAST(int, *s2));
if (c1 != c2)
return (c1 - c2);
s1++;
s2++;
n--;
}
return 0;
}
#endif /* not STANDALONE */
#ifdef STANDALONE
#include <stdio.h>
/* one more prototype */
int main(int argc, char *argv[]);
static int
assert_strcasecmp (const char *s1, const char *s2, int expected)
{
int result=strcasecmp(s1, s2);
result=(result>0) ? 1 : ((result <0) ? -1 : 0);
if (result != expected)
{
fprintf(stderr, "FAIL strcasecmp (%s, %s) gave %d != %d\n",
s1, s2, result, expected);
return 1;
}
return 0;
}
static int
assert_strncasecmp (const char *s1, const char *s2, size_t size, int expected)
{
int result=strncasecmp(s1, s2, size);
result=(result>0) ? 1 : ((result <0) ? -1 : 0);
if (result != expected)
{
fprintf(stderr, "FAIL strncasecmp (%s, %s, %u) gave %d != %d\n",
s1, s2, RASQAL_GOOD_CAST(unsigned int, size), result, expected);
return 1;
}
return 0;
}
int
main(int argc, char *argv[])
{
int failures=0;
failures += assert_strcasecmp("foo", "foo", 0);
failures += assert_strcasecmp("foo", "FOO", 0);
failures += assert_strcasecmp("foo", "BaR", 1);
failures += assert_strncasecmp("foo", "foobar", 3, 0);
failures += assert_strncasecmp("foo", "FOOxyz", 3, 0);
failures += assert_strncasecmp("foo", "BaRfoo", 3, 1);
return failures;
}
#endif /* STANDALONE */
|
#ifndef SYSTEM_H_INCLUDED
#define SYSTEM_H_INCLUDED
/*
In this file are defined all the os basic functions:
#Memory functions
memcpy
memset
memsetw
#Strings functions
strcpy
strlen
strcmp
strcat
#IO functions
inportb
outportb
*/
void* memcpy(void* dest, const void* src, int count);
void* memset(void* dest, char val, int count);
unsigned short* memsetw(unsigned short* dest, unsigned short val, int count);
int strlen(const char* str);
void strcpy(char* dest, const char* source);
int strcmp(const char* a, const char* b);
void strcat(char* dest, const char* source);
void strrev(char* dest);
unsigned char inportb (unsigned short _port);
void outportb (unsigned short _port, unsigned char _data);
int isdigit(char c);
// kmalloc used! memory to be freed
int itoa(int number, int base, char* dest);
int utoa(unsigned int number, int base, char* dest);
int atoi(char* str, int* len);
int ends_with(const char* src, const char* s);
#endif // SYSTEM_H_INCLUDED
|
/*****************************************************************************
74123 monoflop emulator - there are 2 monoflops per chips
74123 pins and assigned interface variables/functions
TTL74123_trigger_comp_w [ 1] /1TR VCC [16]
TTL74123_trigger_w [ 2] 1TR 1RCext [15]
TTL74123_reset_comp_w [ 3] /1RST 1Cext [14]
TTL74123_output_comp_r [ 4] /1Q 1Q [13] TTL74123_output_r
TTL74123_output_r [ 5] 2Q /2Q [12] TTL74123_output_comp_r
[ 6] 2Cext /2RST [11] TTL74123_reset_comp_w
[ 7] 2RCext 2TR [10] TTL74123_trigger_w
[ 8] GND /2TR [9] TTL74123_trigger_comp_w
All resistor values in Ohms.
All capacitor values in Farads.
Truth table:
R A B | Q /Q
----------|-------
L X X | L H
X H X | L H
X X L | L H
H L _- |_-_ -_-
H -_ H |_-_ -_-
_- L H |_-_ -_-
------------------
A = trigger_comp
B = trigger
R = reset_comp
L = lo (0)
H = hi (1)
X = any state
_- = raising edge
-_ = falling edge
_-_ = positive pulse
-_- = negative pulse
*****************************************************************************/
#ifndef TTL74123_H
#define TTL74123_H
#define MAX_TTL74123 4
/* The interface structure */
struct TTL74123_interface {
float res;
float cap;
void (*output_changed_cb)(void);
};
void TTL74123_unconfig(void);
void TTL74123_config(int which, const struct TTL74123_interface *intf);
void TTL74123_trigger_w(int which, int data);
void TTL74123_trigger_comp_w(int which, int data);
void TTL74123_reset_comp_w(int which, int data);
int TTL74123_output_r(int which);
int TTL74123_output_comp_r(int which);
#endif
|
/**
******************************************************************************
* @file stnucleolib.h
* @date 10-October-2015
* @brief This is the main STNucleoLib include file to access the
* API functions
******************************************************************************
* @attention
*
* Copyright (C) 2015 Ettore Barattelli
*
* This file is part of STNucleoLib.
*
* STNucleoLib 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.
*
* STNucleoLib 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 STNucleoLib. If not, see <http://www.gnu.org/licenses/>.
*
*******************************************************************************/
#ifndef STNUCLEOLIB_H_
#define STNUCLEOLIB_H_
#include "stnucleof411re_definitions.h"
#include "stm32f4xx_hal_gpio.h"
/*! Pin logic state enumerator */
typedef enum
{
LOW = GPIO_PIN_RESET, /*!< LOW (0) state */
HIGH = GPIO_PIN_SET /*!< HIGH (1) state */
} STNucleoPinState_t;
/*! Pin direction enumerator */
typedef enum
{
INPUT = GPIO_MODE_INPUT, /*!< INPUT pin direction */
OUTPUT = GPIO_MODE_OUTPUT_PP /*!< OUTPUT pin direction */
} STNucleoPinMode_t;
/*! Arduino connector pin enumerator */
typedef enum
{
D0, /*!< Arduino connector pin D0 */
D1, /*!< Arduino connector pin D1 */
D2, /*!< Arduino connector pin D2 */
D3, /*!< Arduino connector pin D3 */
D4, /*!< Arduino connector pin D4 */
D5, /*!< Arduino connector pin D5 */
D6, /*!< Arduino connector pin D6 */
D7, /*!< Arduino connector pin D7 */
D8, /*!< Arduino connector pin D8 */
D9, /*!< Arduino connector pin D9 */
D10, /*!< Arduino connector pin D10 */
D11, /*!< Arduino connector pin D11 */
D12, /*!< Arduino connector pin D12 */
D13, /*!< Arduino connector pin D13 */
D14, /*!< Arduino connector pin D14 */
D15, /*!< Arduino connector pin D15 */
A0, /*!< Arduino connector pin A0 */
A1, /*!< Arduino connector pin A1 */
A2, /*!< Arduino connector pin A2 */
A3, /*!< Arduino connector pin A3 */
A4, /*!< Arduino connector pin A4 */
A5 /*!< Arduino connector pin A5 */
} STNucleoArduinoPin_t;
/*!
* @brief Function to initialize the STNucleoLib library.
*
* This function initializes the STNucleoLib library.
* This should be the first function called by main.
* It initializes the system clock and the required peripherals
*
* @param None
* @return None
*/
extern void stnucleoInit(void);
/*!
* @brief Function to set the pin direction of an Arduino connector pin.
*
* @param[in] pin Arduino connector pin to configure
* @param[in] mode Pin direction
* @return None
*/
extern void pinMode(const STNucleoArduinoPin_t pin, const STNucleoPinMode_t mode);
/*!
* @brief Function to set the logic state of an Arduino connector pin.
*
* @param[in] pin Arduino connector pin to write
* @param[in] state Pin logic state
* @return None
*/
extern void digitalWrite(const STNucleoArduinoPin_t pin, const STNucleoPinState_t state);
/*!
* @brief Function to set the logic state of an Arduino connector pin.
*
* @param[in] pin Arduino connector pin to read
* @return state Pin logic state
*/
extern STNucleoPinState_t digitalRead(const STNucleoArduinoPin_t pin);
/*!
* @brief Function to wait for a given time (in milliseconds)
*
* @param[in] ms Milliseconds to wait
* @return None
*/
extern void delay(const uint64_t ms);
/*!
* @brief Function to get the number of milliseconds elapsed since system start
*
* @param None
* @return ms Milliseconds elapsed since system start
*/
extern uint64_t millis(void);
/*!
* @brief Function to print a string on the serial line
*
* @param[in] format printf-like format string
* @param[in] va_args Other printf-like parameters
* @return None
*/
extern void serialPrint(const char *format, ...);
#endif /* STNUCLEOLIB_H_ */
|
#ifndef DISPLAYSDL2_H
#define DISPLAYSDL2_H
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <iostream>
class DisplaySDL2
{
private:
unsigned int x,y;
unsigned int width,height;
std::string title;
SDL_Window *window;
SDL_GLContext context;
bool initGL();
public:
DisplaySDL2(int x,int y, int width, int height, std::string title);
void CleanScreen(float r, float g, float b, float a);
void SwapBuffers();
void Delay(uint32_t ms);
bool UserWannaQuit();
void Quit();
};
#endif
|
/**
******************************************************************************
* @file PolarSSL/SSL_Client/Inc/ssl_client.h
* @author MCD Application Team
* @version V1.4.1
* @date 09-October-2015
* @brief This file contains the functions prototype for SSL client file.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __SSL_CLIENT_H
#define __SSL_CLIENT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stdlib.h>
/* Exported types ------------------------------------------------------------*/
typedef struct
{
uint32_t State;
}rng_state;
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void ssl_client(void const * argument);
int RandVal(void* arg, unsigned char *data, size_t size);
#ifdef __cplusplus
}
#endif
#endif /* __SSL_CLIENT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/***************************************************************************
* Copyright (C) 2005 by Alex Graf *
* grafal@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 KMLWRITER_H
#define KMLWRITER_H
#include <QTextStream>
#include "FlightPoint.h"
#include "FlightPointList.h"
#include "Flight.h"
#include "WayPoint.h"
/**
@author Alex Graf
*/
class KmlWriter
{
public:
KmlWriter();
~KmlWriter();
void setFlight(Flight &flight);
void setDeparture(int index);
void set1stTurnPoint(int index);
void set2ndTurnPoint(int index);
void set3rdTurnPoint(int index);
void setFinish(int index);
void setFlightPoints(FlightPointList &flightPoints);
void setTriangle(bool triangle);
bool save(const QString &name);
private:
Flight m_flight;
int m_departure;
int m_1stTurnPoint;
int m_2ndTurnPoint;
int m_3rdTurnPoint;
int m_finish;
FlightPointList m_flightPointList;
bool m_triangle;
void streamCoordinates(QTextStream& s);
void streamOLC(QTextStream& s);
void streamStart(QTextStream& s);
void streamLanding(QTextStream& s);
};
#endif
|
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Corporation
*
* BSD LICENSE
*
* Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
* 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 Intel Corporation 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.
*
*
* version: QAT1.5.L.1.11.0-36
*
*****************************************************************************/
/******************************************************************************
* @file adf_wireless_main.c
*
* @description
* This file contains the function definitions for wireless control
* path layer.
*
*****************************************************************************/
#include "cpa.h"
#include "icp_adf_init.h"
#include "icp_adf_cfg.h"
#include "icp_platform.h"
#include "icp_accel_devices.h"
#include "adf_init.h"
#include "adf_wireless_events.h"
#include "adf_transport_ctrl.h"
#include "adf_wireless.h"
#include "adf_platform.h"
STATIC subservice_registation_handle_t wireless_reg_handle;
STATIC char* subsystem_name = WIRELESS_SUBSYSTEM_NAME;
/*
* wireless_EventHandler - User proxy event dispatcher
* Call appropriate event handler function in wireless control plane
*/
STATIC CpaStatus wireless_EventHandler( icp_accel_dev_t *accel_dev,
icp_adf_subsystemEvent_t event, void* param )
{
CpaStatus stat = CPA_STATUS_SUCCESS;
ICP_CHECK_FOR_NULL_PARAM(accel_dev);
switch( event )
{
case ICP_ADF_EVENT_INIT :
stat = adf_wirelessEventInit( accel_dev );
break;
case ICP_ADF_EVENT_START :
stat = CPA_STATUS_SUCCESS;
break;
case ICP_ADF_EVENT_STOP :
stat = CPA_STATUS_SUCCESS;
break;
case ICP_ADF_EVENT_SHUTDOWN :
stat = adf_wirelessEventShutdown( accel_dev );
break;
default:
stat = CPA_STATUS_SUCCESS;
}
return stat;
}
/*
* adf_wirelessRegister
* Register wireless event dispatcher into ADF
*/
CpaStatus adf_wirelessRegister( void )
{
wireless_reg_handle.subsystem_name = subsystem_name;
wireless_reg_handle.subserviceEventHandler = wireless_EventHandler;
return icp_adf_subsystemRegister( &wireless_reg_handle );
}
/*
* adf_wirelessUnregister
* Unregister wireless event dispatcher from ADF
*/
CpaStatus adf_wirelessUnregister( void )
{
return icp_adf_subsystemUnregister( &wireless_reg_handle );
}
|
#ifndef _LINUX_ELF_EM_H
#define _LINUX_ELF_EM_H
/* These constants define the various ELF target machines */
#define EM_NONE 0
#define EM_M32 1
#define EM_SPARC 2
#define EM_386 3
#define EM_68K 4
#define EM_88K 5
#define EM_486 6 /* Perhaps disused */
#define EM_860 7
#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
/* Next two are historical and binaries and
modules of these types will be rejected by
Linux. */
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
#define EM_PARISC 15 /* HPPA */
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* PowerPC64 */
#define EM_SPU 23 /* Cell BE SPU */
#define EM_ARM 40 /* ARM 32 bit */
#define EM_SH 42 /* SuperH */
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
#define EM_IA_64 50 /* HP/Intel IA-64 */
#define EM_X86_64 62 /* AMD x86-64 */
#define EM_S390 22 /* IBM S/390 */
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Renesas M32R */
#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
#define EM_L1OM 180 /* Intel L1OM */
#define EM_K1OM 181 /* Intel K1OM */
#define EM_TI_C6000 140 /* TI C6X DSPs */
#define EM_AARCH64 183 /* ARM 64 bit */
#define EM_FRV 0x5441 /* Fujitsu FR-V */
#define EM_AVR32 0x18ad /* Atmel AVR32 */
/*
* This is an interim value that we will use until the committee comes
* up with a final number.
*/
#define EM_ALPHA 0x9026
/* Bogus old v850 magic number, used by old tools. */
#define EM_CYGNUS_V850 0x9080
/* Bogus old m32r magic number, used by old tools. */
#define EM_CYGNUS_M32R 0x9041
/* This is the old interim value for S/390 architecture */
#define EM_S390_OLD 0xA390
/* Also Panasonic/MEI MN10300, AM33 */
#define EM_CYGNUS_MN10300 0xbeef
#endif /* _LINUX_ELF_EM_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.