text stringlengths 4 6.14k |
|---|
#ifndef MEMORYMANAGER_H
#define MEMORYMANAGER_H
#include "core_global.h"
#include <QObject>
#include <Windows.h>
class CORE_SYMBOL MemoryManager : public QObject
{
Q_OBJECT
public:
explicit MemoryManager(QObject *parent = 0);
Q_INVOKABLE static uchar ReadByte(ulong ulBase, ulong iOffset);
Q_INVOKABLE static ushort ReadShort(ulong ulBase, ulong iOffset);
Q_INVOKABLE static ulong ReadLong(ulong ulBase, ulong iOffset);
Q_INVOKABLE static double ReadDouble(ulong ulBase, ulong iOffset);
Q_INVOKABLE static bool WriteByte(ulong ulBase, ulong iOffset, char value);
Q_INVOKABLE static bool WriteShort(ulong ulBase, ulong iOffset, short value);
Q_INVOKABLE static bool WriteLong(ulong ulBase, ulong iOffset, long value);
Q_INVOKABLE static bool WriteDouble(ulong ulBase, ulong iOffset, double value);
Q_INVOKABLE static bool WriteCode(ulong Addr, QString Array, int nop_count);
template <typename T>
static T Read (unsigned long ulBase, unsigned long iOffset);
template <typename T>
static bool Write(unsigned long ulBase, int iOffset, T iValue);
static DWORD Write_Hook(char code[], DWORD Prev, DWORD Next, int nop_count);
static BOOL Write_code(DWORD Addr, char Array[], int nop_count);
static BOOL DetourHook(__in BOOL bState, DWORD addy, __inout PVOID *ppPointer,__in PVOID pDetour);
static int ChartoByte(char Array[], BYTE b[]);
static bool JumpCall(bool bJump, unsigned long ulAddress, void *Function, unsigned long ulNops);
};
template <typename T>
T MemoryManager::Read (unsigned long ulBase, unsigned long iOffset)
{
//FIXME MemoryManager::Read: Better way?
__try
{
return *(T*)(*(unsigned long*)ulBase + iOffset);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
return 0;
}
}
template <typename T>
bool MemoryManager::Write(unsigned long ulBase, int iOffset, T iValue)
{
//FIXME MemoryManager::Write: Better way?
__try
{
*(T*)(*(unsigned long*)ulBase + iOffset) = iValue;
return true;
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
return false;
}
}
#endif // MEMORYMANAGER_H
|
#define CONFIG_BLK_DEV_AEC62XX 1
|
void delay_us(unsigned int n);
void delay_ms(unsigned int n);
void SetCPUSpeed(u8 FreNum);
__interrupt void Timer_A1 (void);
void TimerInit();
extern u8 CPUFrequene;
extern u16 TimerCounter;
#define OneSec 500
#define MAXCounter 4*OneSec
|
/* soapESBServiceSoapService.h
Generated by gSOAP 2.8.24 from ESBServiceWSDL.h
gSOAP XML Web services tools
Copyright (C) 2000-2015, Robert van Engelen, Genivia Inc. All Rights Reserved.
The soapcpp2 tool and its generated software are released under the GPL.
This program is released under the GPL with the additional exemption that
compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
A commercial use license is available from Genivia Inc., contact@genivia.com
--------------------------------------------------------------------------------
*/
#ifndef soapESBServiceSoapService_H
#define soapESBServiceSoapService_H
#include "soapH.h"
class SOAP_CMAC ESBServiceSoapService : public soap
{ public:
/// Variables globally declared in ESBServiceWSDL.h (non-static)
/// Constructor
ESBServiceSoapService();
/// Copy constructor
ESBServiceSoapService(const ESBServiceSoapService&);
/// Construct from another engine state
ESBServiceSoapService(const struct soap&);
/// Constructor with engine input+output mode control
ESBServiceSoapService(soap_mode iomode);
/// Constructor with engine input and output mode control
ESBServiceSoapService(soap_mode imode, soap_mode omode);
/// Destructor deletes deserialized data and engine context
virtual ~ESBServiceSoapService();
/// Delete all deserialized data (with soap_destroy() and soap_end())
virtual void destroy();
/// Delete all deserialized data and reset to defaults
virtual void reset();
/// Initializer used by constructor
virtual void ESBServiceSoapService_init(soap_mode imode, soap_mode omode);
/// Create a new copy
virtual ESBServiceSoapService *copy() SOAP_PURE_VIRTUAL;
/// Copy assignment
ESBServiceSoapService& operator=(const ESBServiceSoapService&);
/// Close connection (normally automatic)
virtual int soap_close_socket();
/// Force close connection (can kill a thread blocked on IO)
virtual int soap_force_close_socket();
/// Return sender-related fault to sender
virtual int soap_senderfault(const char *string, const char *detailXML);
/// Return sender-related fault with SOAP 1.2 subcode to sender
virtual int soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML);
/// Return receiver-related fault to sender
virtual int soap_receiverfault(const char *string, const char *detailXML);
/// Return receiver-related fault with SOAP 1.2 subcode to sender
virtual int soap_receiverfault(const char *subcodeQName, const char *string, const char *detailXML);
/// Print fault
virtual void soap_print_fault(FILE*);
#ifndef WITH_LEAN
/// Print fault to stream
#ifndef WITH_COMPAT
virtual void soap_stream_fault(std::ostream&);
#endif
/// Put fault into buffer
virtual char *soap_sprint_fault(char *buf, size_t len);
#endif
/// Disables and removes SOAP Header from message
virtual void soap_noheader();
/// Get SOAP Header structure (NULL when absent)
virtual const SOAP_ENV__Header *soap_header();
/// Run simple single-thread (iterative, non-SSL) service on port until a connection error occurs (returns error code or SOAP_OK), use this->bind_flag = SO_REUSEADDR to rebind for a rerun
virtual int run(int port);
#if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
/// Run simple single-thread SSL service on port until a connection error occurs (returns error code or SOAP_OK), use this->bind_flag = SO_REUSEADDR to rebind for a rerun
virtual int ssl_run(int port);
#endif
/// Bind service to port (returns master socket or SOAP_INVALID_SOCKET)
virtual SOAP_SOCKET bind(const char *host, int port, int backlog);
/// Accept next request (returns socket or SOAP_INVALID_SOCKET)
virtual SOAP_SOCKET accept();
#if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
/// Then accept SSL handshake, when SSL is used
virtual int ssl_accept();
#endif
/// Serve this request (returns error code or SOAP_OK)
virtual int serve();
/// Used by serve() to dispatch a request (returns error or SOAP_OK)
virtual int dispatch();
///
/// Service operations (you should define these):
/// Note: compile with -DWITH_PURE_VIRTUAL for pure virtual methods
///
/// Web service operation 'ESBOperation' (returns error code or SOAP_OK)
virtual int ESBOperation(std::string session, std::string inputs, std::string &results) SOAP_PURE_VIRTUAL;
};
#endif
|
// -!- c++ -!- //////////////////////////////////////////////////////////////
//
// System :
// Module :
// Object Name : $RCSfile$
// Revision : $Revision$
// Date : $Date$
// Author : $Author$
// Created By : Robert Heller
// Created : Sat Jul 3 10:11:26 2021
// Last Modified : <210703.1252>
//
// Description
//
// Notes
//
// History
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 Robert Heller D/B/A Deepwoods Software
// 51 Locke Hill Road
// Wendell, MA 01379-9728
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __MAIN_H
#define __MAIN_H
/** @mainpage Examples using the LayoutControlDB with OpenLCB and Dispatcher
* This documents examples using the Model Railroad System to interface with
* model railroad layouts using the LayoutControlDB DB when configuring
* hardware LCC nodes and/or creating virtual (software) LCC nodes, typically
* CTC Panel programs using Dispatcher.
* @anchor toc
* @htmlonly
* <div class="contents">
* <div class="textblock"><ol type="1">
* <li><a class="el" href="LayoutControlDBExample.html">Layout Control DB Example</a><ol type="1">
* <li><a class="el" href="LayoutControlDBExample.html#capture">Capturing the eventids from the Tower-LCC</a></li>
* <li><a class="el" href="LayoutControlDBExample.html#panel">Next we use the layout control DB to build a CTC Panel</a><li>
* </ol></li>
* </ol></div></div>
* @endhtmlonly
*
*/
#endif // __MAIN_H
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
/********************************************************************************
* SRS Labs CONFIDENTIAL
* @Copyright 2010 by SRS Labs.
* All rights reserved.
*
* Description:
* SRS HP360 types, constants
*
* Author: Zesen Zhuang
*
* RCS keywords:
* $Id$
* $Author$
* $Date$
*
********************************************************************************/
#ifndef __SRS_HP360_DEF_H__
#define __SRS_HP360_DEF_H__
#include "srs_typedefs.h"
/*Data type definition here:*/
typedef struct _SRSHp360Obj{int _;} * SRSHp360Obj;
#define SRS_HP360_OBJ_SIZE (sizeof(_SRSHp360Obj_t)+26*4*sizeof(srs_int32)+32)
#define SRS_HP360_WORKSPACE_SIZE(blksize) (sizeof(srs_int32)*(blksize)*5+8)
/////////////////////////////////////////////////////////////////////////////////////////////////
//SRS Internal Use:
typedef struct
{
int Enable; //enable, 0: disabled, non-zero: enabled
srs_int16 InputGain;
srs_int16 OutputGain;
srs_int16 BypassGain;
int Delaylen;
const srs_int16 *FrontFilter1Coef;
const srs_int16 *FrontFilter2Coef;
const srs_int16 *RearFilter1Coef;
const srs_int16 *RearFilter2Coef;
} _SRSHp360Settings_t;
typedef struct
{
srs_int32 LFrontFilter1State[2];
srs_int32 LFrontFilter2State[2];
srs_int32 RFrontFilter1State[2];
srs_int32 RFrontFilter2State[2];
srs_int32 LRearFilter1State[2];
srs_int32 LRearFilter2State[2];
srs_int32 RRearFilter1State[2];
srs_int32 RRearFilter2State[2];
srs_int32 *Ldelaybuf;
srs_int32 *Rdelaybuf;
srs_int32 *SLdelaybuf;
srs_int32 *SRdelaybuf;
} _SRSHp360State_t;
typedef struct
{
_SRSHp360Settings_t Settings;
_SRSHp360State_t State;
} _SRSHp360Obj_t;
#endif //__SRS_HP360_DEF_H__
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_
#define COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_
#include <string>
#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/policy/policy_export.h"
namespace policy {
class ExternalDataManager;
class POLICY_EXPORT ExternalDataFetcher {
public:
typedef base::Callback<void(scoped_ptr<std::string>)> FetchCallback;
ExternalDataFetcher(base::WeakPtr<ExternalDataManager> manager,
const std::string& policy);
ExternalDataFetcher(const ExternalDataFetcher& other);
~ExternalDataFetcher();
static bool Equals(const ExternalDataFetcher* first,
const ExternalDataFetcher* second);
void Fetch(const FetchCallback& callback) const;
private:
base::WeakPtr<ExternalDataManager> manager_;
const std::string policy_;
};
}
#endif
|
/*-------------------------------------------------------------------
| |
| binet_parser.h |
| Created by Ilya Shoshin (galarius), 26.08.2015 |
| |
| Functions to save and load Binet's formula |
| |
------------------------------------------------------------------*/
#ifndef FIBONACCI_BINNET_GENERALIZATION_BINET_PARSER_H
#define FIBONACCI_BINNET_GENERALIZATION_BINET_PARSER_H
#include <string>
#include "common.h"
/*
Load coefficients {k} and roots {x} from file for specified p-number.
File format:
```
p=<delimeter>{p}
k=<delimeter>{k1}<delimeter>{k2}<delimeter>...
x=<delimeter>{x1}<delimeter>{x2}<delimeter>...
...
```
@param fileName
@param p p-number
@param k out parameter, coefficients
@param x out parameter, roots
@param delimeter delimeter for csv format
*/
bool load_formula(const std::string& fileName, const size_t p, dcarray& k, dcarray& x, const char delimeter);
/*
Save coefficients {k} and roots {x} to file for specified p-number.
File format:
```
p=<delimeter>{p}
k=<delimeter>{k1}<delimeter>{k2}<delimeter>...
x=<delimeter>{x1}<delimeter>{x2}<delimeter>...
...
```
@param fileName
@param p p-number
@param k coefficients
@param x roots
@param delimeter delimeter for csv format
*/
bool save_formula(const std::string& fileName, const size_t p, const dcarray& k, const dcarray& x, const char delimeter);
#endif /* FIBONACCI_BINNET_GENERALIZATION_BINET_PARSER_H */ |
// Copyright (c) 2013 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 TOOLS_GN_GYP_HELPER_H_
#define TOOLS_GN_GYP_HELPER_H_
#include <string>
#include "base/basictypes.h"
class Err;
class SourceDir;
class SourceFile;
class Target;
class GypHelper {
public:
GypHelper();
~GypHelper();
SourceFile GetGypFileForTarget(const Target* target, Err* err) const;
std::string GetNameForTarget(const Target* target) const;
std::string GetFullRefForTarget(const Target* target) const;
std::string GetFileReference(const SourceFile& file) const;
std::string GetDirReference(const SourceDir& dir, bool include_slash) const;
private:
DISALLOW_COPY_AND_ASSIGN(GypHelper);
};
#endif
|
#ifndef _LABEL_ERR_H_
#define _LABEL_ERR_H_
#define ERR_SUCCESS 0
#define ERR_LABELOP_BASE 0x08000000
#define ERR_LOAD_LIBRARY_FILEOP ERR_LABELOP_BASE + 1 //¼ÓÔØFILEOP¶¯Ì¬¿âʧ°Ü£¬ÕÒ²»µ½¶¯Ì¬¿âÎļþ»ò¶¯Ì¬¿â²»ÕýÈ·
#define ERR_NOT_IMPLEMENT ERR_LABELOP_BASE + 2 //¸Ã·½·¨Î´ÊµÏÖ
#define ERR_NOT_LABELLED ERR_LABELOP_BASE + 3 //²»ÊÇÃܱêÎļþ
#define ERR_ALREADY_LABELLED ERR_LABELOP_BASE + 4 //ÒÑÊÇÃܱêÎļþ
#define ERR_FILEOP_BASE 0x04000000
#define ERR_LOAD_LIBRARY_CODER ERR_FILEOP_BASE + 1 //¼ÓÔØCODER¶¯Ì¬¿âʧ°Ü£¬ÕÒ²»µ½¶¯Ì¬¿âÎļþ»ò¶¯Ì¬¿â²»ÕýÈ·
#define ERR_LOAD_LIBRARY_CIPHER ERR_FILEOP_BASE + 2 //¼ÓÔØCIPHER¶¯Ì¬¿âʧ°Ü£¬ÕÒ²»µ½¶¯Ì¬¿âÎļþ»ò¶¯Ì¬¿â²»ÕýÈ·
#define ERR_FILEOP_ALLOC_MEMORY ERR_FILEOP_BASE + 3 //ÄÚ´æ·ÖÅäʧ°Ü
#define ERR_OPEN_FILE ERR_FILEOP_BASE + 4 //¶ÁÎļþʧ°Ü
#define ERR_WRITE_FILE ERR_FILEOP_BASE + 5 //дÎļþʧ°Ü
#define ERR_OPERATE_FILE ERR_FILEOP_BASE + 6 //Îļþ²Ù×÷ʧ°Ü£¨¸ÄÃû»òɾ³ý£©
#define ERR_INTERPOLATED ERR_FILEOP_BASE + 7 //ÃܱêÎļþ±»´Û¸Ä
#define ERR_CIPHER_BASE 0x02000000
#define ERR_CIPHER_PARAM_INVALID ERR_CIPHER_BASE + 1 //²ÎÊýÎÞЧ£¨µØÖ·Îª¿Õ£©
#define ERR_ALG_NOT_SUPPORT ERR_CIPHER_BASE + 2 //Ëã·¨²»Ö§³Ö
#define ERR_DATA_LEN_INVALID ERR_CIPHER_BASE + 3 //Êý¾Ý³¤¶È²»ÕýÈ·
#define ERR_READ_FILE ERR_CIPHER_BASE + 4 //¶ÁÈ¡ÎļþÊý¾Ýʧ°Ü
#define ERR_PUBKEY_ENCRYPT ERR_CIPHER_BASE + 5 //¹«Ô¿¼ÓÃÜʧ°Ü
#define ERR_PRIKEY_DECRYPT ERR_CIPHER_BASE + 6 //˽Կ½âÃÜʧ°Ü
#define ERR_SIGN ERR_CIPHER_BASE + 7 //Ç©Ãûʧ°Ü
#define ERR_VERIFY ERR_CIPHER_BASE + 8 //Ñéǩʧ°Ü
#define ERR_CODER_BASE 0x01000000
#define ERR_HANDLE_INVALID ERR_CODER_BASE + 1 //¾ä±úÎÞЧ£¨±êÇ©¾ä±úΪ¿Õ£©
#define ERR_DATA_INVALID ERR_CODER_BASE + 2 //Êý¾ÝÎÞЧ£¨±êÇ©ÖеÄÊý¾ÝµØÖ·Îª¿Õ£©
#define ERR_OPERATE_MEMORY ERR_CODER_BASE + 3 //ÄÚ´æ²Ù×÷Òì³££¨±êÇ©ÖеÄÊý¾Ý²Ù×÷Òì³££©
#define ERR_CODER_PARAM_INVALID ERR_CODER_BASE + 4 //²ÎÊýÎÞЧ£¨µØÖ·Îª¿Õ£©
#define ERR_CODER_ALLOC_MEMORY ERR_CODER_BASE + 5 //ÄÚ´æ·ÖÅäʧ°Ü
#endif
|
/*
* This file is a part of KNOSSOS.
*
* (C) Copyright 2007-2016
* Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V.
*
* KNOSSOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 of
* the 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, see <http://www.gnu.org/licenses/>.
*
*
* For further information, visit https://knossostool.org
* or contact knossos-team@mpimf-heidelberg.mpg.de
*/
#ifndef SEGMENTATIONSPLIT_H
#define SEGMENTATIONSPLIT_H
#include "coordinate.h"
#include <QObject>
#include <unordered_set>
class brush_t {
public:
enum class mode_t {
two_dim, three_dim
};
enum class view_t {
xy, xz, zy, arb
};
enum class shape_t {
angular, round
};
int radius = 1;
bool inverse = false;
mode_t mode = mode_t::two_dim;
view_t view = view_t::xy;
shape_t shape = shape_t::round;
floatCoordinate v1{1, 0, 0};
floatCoordinate v2{0, 1, 0};
floatCoordinate n{0, 0, 1};
};
class brush_subject : public QObject, private brush_t {
Q_OBJECT
public:
brush_t value() const {
return static_cast<brush_t>(*this);
}
void setInverse(const bool newInverse) {
inverse = newInverse;
emit inverseChanged(inverse);
}
bool isInverse() const {
return inverse;
}
void setMode(const mode_t newMode) {
mode = newMode;
emit modeChanged(mode);
}
mode_t getMode() const {
return mode;
}
void setRadius(const int newRadius) {
radius = newRadius;
emit radiusChanged(radius);
}
int getRadius() const {
return radius;
}
void setView(const view_t newView, const floatCoordinate & newV1, const floatCoordinate & newV2, const floatCoordinate & newN) {
view = newView;
v1 = newV1;
v2 = newV2;
n = newN;
}
view_t getView() const {
return view;
}
void setShape(const shape_t newShape) {
shape = newShape;
emit shapeChanged(shape);
}
shape_t getShape() const {
return shape;
}
signals:
void inverseChanged(const bool);
void modeChanged(const mode_t);
void radiusChanged(const int);
void shapeChanged(const shape_t);
};
void subobjectBucketFill(const Coordinate & seed, const Coordinate & center, const uint64_t fillsoid, const brush_t & brush);
void connectedComponent(const Coordinate & seed);
void verticalSplittingPlane(const Coordinate & seed);
#endif//SEGMENTATIONSPLIT_H
|
/*****************************************************************
* libircservice is (C) CopyRight PTlink IRC Software 1999-2004 *
* http://software.pt-link.net *
* This program is distributed under GNU Public License *
* Please read the file COPYING for copyright information. *
*****************************************************************
Description: sample service that will join every channel when its created
and leave it when it gets empty
* $Id: changuard.c 33 2010-05-10 02:46:01Z openglx $
*/
#include "setup.h"
#include "ircservice.h"
#define SERVICENAME "ChanGuard"
/* internal functions declaration */
void ev_chan_join(IRC_Chan* chan, IRC_ChanNode* cn);
void ev_chan_part(IRC_Chan* chan, IRC_ChanNode* cn);
IRC_User* changuard_user; /* info user */
/* this is called after join */
void ev_chan_join(IRC_Chan* chan, IRC_ChanNode* cn)
{
int remote_users = chan->users_count - chan->lusers_count;
if(remote_users == 1 ) /* first user joining the channel */
{
irc_ChanJoin(changuard_user, chan->name, CU_MODE_OP);
}
}
/* this is called before the part */
void ev_chan_part(IRC_Chan* chan, IRC_ChanNode* cn)
{
int remote_users = chan->users_count - chan->lusers_count;
/* we must count 1 for our user */
if(remote_users == 1)
irc_ChanPart(changuard_user, chan);
}
/* main program */
int main(void)
{
int cr;
/* set server service info */
irc_Init(IRCDTYPE, SERVERNAME, "Sample IRC Service", stderr);
/* Create the service user */
changuard_user = irc_CreateLocalUser(SERVICENAME,"Services","PTlink.net","PTlink.net",
"Sample IRC Service","+r");
/* Add user events */
irc_AddEvent(ET_CHAN_JOIN, ev_chan_join);
irc_AddEvent(ET_CHAN_PART, ev_chan_part);
printf("Connecting to "CONNECTO"\n");
cr = irc_FullConnect(CONNECTO,6667, CONNECTPASS, 0);
if(cr<0)
{
printf("Error connecting to irc server: %s\n", irc_GetLastMsg());
return 1;
}
else
printf("--- Connected ----\n");
/* Loop while connected */
irc_LoopWhileConnected();
printf("Connection terminated: %s\n", irc_GetLastMsg());
return 0;
}
|
/*
* 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 main() {
volatile float fNan = __builtin_nanf("");
if (__builtin_fpclassify(11, 12, 13, 14, 15, fNan) != 11) {
return 1;
}
volatile float fInf = __builtin_inff();
if (__builtin_fpclassify(11, 12, 13, 14, 15, fInf) != 12) {
return 1;
}
volatile float fOne = 1.f;
if (__builtin_fpclassify(11, 12, 13, 14, 15, fOne) != 13) {
return 1;
}
volatile float fZero = 0.f;
if (__builtin_fpclassify(11, 12, 13, 14, 15, fZero) != 15) {
return 1;
}
volatile double dNan = __builtin_nan("");
if (__builtin_fpclassify(11, 12, 13, 14, 15, dNan) != 11) {
return 1;
}
volatile double dInf = __builtin_inf();
if (__builtin_fpclassify(11, 12, 13, 14, 15, dInf) != 12) {
return 1;
}
volatile double dOne = 1.;
if (__builtin_fpclassify(11, 12, 13, 14, 15, dOne) != 13) {
return 1;
}
volatile double dZero = 0.;
if (__builtin_fpclassify(11, 12, 13, 14, 15, dZero) != 15) {
return 1;
}
#ifdef __clang__ // TODO: dragonegg uses native calls which do not work with X86_FP80
volatile long double lNan = __builtin_nanl("");
if (__builtin_fpclassify(11, 12, 13, 14, 15, lNan) != 11) {
return 1;
}
volatile long double lInf = __builtin_infl();
if (__builtin_fpclassify(11, 12, 13, 14, 15, lInf) != 12) {
return 1;
}
volatile long double lOne = 1.;
if (__builtin_fpclassify(11, 12, 13, 14, 15, lOne) != 13) {
return 1;
}
volatile long double lZero = 0.;
if (__builtin_fpclassify(11, 12, 13, 14, 15, lZero) != 15) {
return 1;
}
#endif
return 0;
}
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
*/
#ifdef _KERNEL
#include <sys/systm.h>
#else
#include <errno.h>
#include <string.h>
#endif
#include <sys/debug.h>
#include <sys/fs/zfs.h>
#include <sys/inttypes.h>
#include <sys/types.h>
#include "zfeature_common.h"
/*
* Set to disable all feature checks while opening pools, allowing pools with
* unsupported features to be opened. Set for testing only.
*/
boolean_t zfeature_checks_disable = B_FALSE;
zfeature_info_t spa_feature_table[SPA_FEATURES];
/*
* Valid characters for feature guids. This list is mainly for aesthetic
* purposes and could be expanded in the future. There are different allowed
* characters in the guids reverse dns portion (before the colon) and its
* short name (after the colon).
*/
static int
valid_char(char c, boolean_t after_colon)
{
return ((c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == (after_colon ? '_' : '.'));
}
/*
* Every feature guid must contain exactly one colon which separates a reverse
* dns organization name from the feature's "short" name (e.g.
* "com.company:feature_name").
*/
boolean_t
zfeature_is_valid_guid(const char *name)
{
int i;
boolean_t has_colon = B_FALSE;
i = 0;
while (name[i] != '\0') {
char c = name[i++];
if (c == ':') {
if (has_colon)
return (B_FALSE);
has_colon = B_TRUE;
continue;
}
if (!valid_char(c, has_colon))
return (B_FALSE);
}
return (has_colon);
}
boolean_t
zfeature_is_supported(const char *guid)
{
spa_feature_t i;
if (zfeature_checks_disable)
return (B_TRUE);
for (i = 0; i < SPA_FEATURES; i++) {
zfeature_info_t *feature = &spa_feature_table[i];
if (strcmp(guid, feature->fi_guid) == 0)
return (B_TRUE);
}
return (B_FALSE);
}
int
zfeature_lookup_name(const char *name, spa_feature_t *res)
{
spa_feature_t i;
for (i = 0; i < SPA_FEATURES; i++) {
zfeature_info_t *feature = &spa_feature_table[i];
if (strcmp(name, feature->fi_uname) == 0) {
if (res != NULL)
*res = i;
return (0);
}
}
return (ENOENT);
}
boolean_t
zfeature_depends_on(spa_feature_t fid, spa_feature_t check) {
zfeature_info_t *feature = &spa_feature_table[fid];
int i;
for (i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) {
if (feature->fi_depends[i] == check)
return (B_TRUE);
}
return (B_FALSE);
}
static void
zfeature_register(spa_feature_t fid, const char *guid, const char *name,
const char *desc, boolean_t readonly, boolean_t mos,
boolean_t activate_on_enable, const spa_feature_t *deps)
{
zfeature_info_t *feature = &spa_feature_table[fid];
static spa_feature_t nodeps[] = { SPA_FEATURE_NONE };
ASSERT(name != NULL);
ASSERT(desc != NULL);
ASSERT(!readonly || !mos);
ASSERT3U(fid, <, SPA_FEATURES);
ASSERT(zfeature_is_valid_guid(guid));
if (deps == NULL)
deps = nodeps;
feature->fi_feature = fid;
feature->fi_guid = guid;
feature->fi_uname = name;
feature->fi_desc = desc;
feature->fi_can_readonly = readonly;
feature->fi_mos = mos;
feature->fi_activate_on_enable = activate_on_enable;
feature->fi_depends = deps;
}
void
zpool_feature_init(void)
{
zfeature_register(SPA_FEATURE_ASYNC_DESTROY,
"com.delphix:async_destroy", "async_destroy",
"Destroy filesystems asynchronously.", B_TRUE, B_FALSE,
B_FALSE, NULL);
zfeature_register(SPA_FEATURE_EMPTY_BPOBJ,
"com.delphix:empty_bpobj", "empty_bpobj",
"Snapshots use less space.", B_TRUE, B_FALSE,
B_FALSE, NULL);
zfeature_register(SPA_FEATURE_LZ4_COMPRESS,
"org.illumos:lz4_compress", "lz4_compress",
"LZ4 compression algorithm support.", B_FALSE, B_FALSE,
B_TRUE, NULL);
zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM,
"com.delphix:spacemap_histogram", "spacemap_histogram",
"Spacemaps maintain space histograms.", B_TRUE, B_FALSE,
B_FALSE, NULL);
zfeature_register(SPA_FEATURE_ENABLED_TXG,
"com.delphix:enabled_txg", "enabled_txg",
"Record txg at which a feature is enabled", B_TRUE, B_FALSE,
B_FALSE, NULL);
{
static const spa_feature_t hole_birth_deps[] = {
SPA_FEATURE_ENABLED_TXG,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_HOLE_BIRTH,
"com.delphix:hole_birth", "hole_birth",
"Retain hole birth txg for more precise zfs send",
B_FALSE, B_TRUE, B_TRUE, hole_birth_deps);
}
zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET,
"com.delphix:extensible_dataset", "extensible_dataset",
"Enhanced dataset functionality, used by other features.",
B_FALSE, B_FALSE, B_FALSE, NULL);
{
static const spa_feature_t bookmarks_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_BOOKMARKS,
"com.delphix:bookmarks", "bookmarks",
"\"zfs bookmark\" command",
B_TRUE, B_FALSE, B_FALSE, bookmarks_deps);
}
zfeature_register(SPA_FEATURE_EMBEDDED_DATA,
"com.delphix:embedded_data", "embedded_data",
"Blocks which compress very well use even less space.",
B_FALSE, B_TRUE, B_TRUE, NULL);
}
|
/* linux/arch/arm/plat-s3c/include/plat/ide.h
*
* Copyright (C) 2009 Samsung Electronics
* http://samsungsemi.com
*
* S3C IDE device definition.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <mach/map.h>
#include <plat/regs-gpio.h>
#include <plat/gpio-cfg.h>
#include <mach/gpio.h>
#include <plat/ide.h>
static struct resource s3c_cfcon_resource[] = {
[0] = {
.start = S5PV2XX_PA_CFCON,
.end = S5PV2XX_PA_CFCON + SZ_1M - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_CFC,
.end = IRQ_CFC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device s3c_device_cfcon = {
.name = "s3c-ide",
.id = 0,
.num_resources = ARRAY_SIZE(s3c_cfcon_resource),
.resource = s3c_cfcon_resource,
};
EXPORT_SYMBOL(s3c_device_cfcon);
void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
{
struct s3c_ide_platdata *pd;
pd = (struct s3c_ide_platdata *)kmemdup(pdata,
sizeof(struct s3c_ide_platdata), GFP_KERNEL);
if (!pd) {
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
return;
}
s3c_device_cfcon.dev.platform_data = pd;
}
void s5pv2xx_ide_setup_gpio(void)
{
u8 i;
/* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
for (i = 0; i < 8; i++) {
s3c_gpio_cfgpin(S5PV2XX_GPJ0(i), S3C_GPIO_SFN(4));
s3c_gpio_setpull(S5PV2XX_GPJ0(i), S3C_GPIO_PULL_NONE);
}
writel(0xffff, S5PV2XX_GPJ0DRV);
/*CF_Data[0 - 7] */
for (i = 0; i < 8; i++) {
s3c_gpio_cfgpin(S5PV2XX_GPJ2(i), S3C_GPIO_SFN(4));
s3c_gpio_setpull(S5PV2XX_GPJ2(i), S3C_GPIO_PULL_NONE);
}
writel(0xffff, S5PV2XX_GPJ2DRV);
/* CF_Data[8 - 15] */
for (i = 0; i < 8; i++) {
s3c_gpio_cfgpin(S5PV2XX_GPJ3(i), S3C_GPIO_SFN(4));
s3c_gpio_setpull(S5PV2XX_GPJ3(i), S3C_GPIO_PULL_NONE);
}
writel(0xffff, S5PV2XX_GPJ3DRV);
/* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
for (i = 0; i < 4; i++) {
s3c_gpio_cfgpin(S5PV2XX_GPJ4(i), S3C_GPIO_SFN(4));
s3c_gpio_setpull(S5PV2XX_GPJ4(i), S3C_GPIO_PULL_NONE);
}
writel(0xff, S5PV2XX_GPJ4DRV);
}
|
/***************************************************************************
base class for query dialogs
-----------------------------------------------------------------------
begin : Thu Nov 25 20:50:53 MET 1999
copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
(C) 2001 The KDE-EDU team
(C) 2005 Peter Hedlund <peter.hedlund@kdemail.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. *
* *
***************************************************************************/
#ifndef Query_Dlg_Base_H
#define Query_Dlg_Base_H
#include <time.h>
#include <stdlib.h>
#include <kdialogbase.h>
#include <QueryManager.h>
#include <grammarmanager.h>
class kvoctrainExpr;
class kvoctrainDoc;
class QLineEdit;
class QMultiLineEdit;
class QLabel;
class QRadioButton;
class QueryDlgBase : public KDialogBase
{
Q_OBJECT
public:
enum Result { Unknown, Known, Timeout, StopIt };
QueryDlgBase(const QString & caption, QWidget *parent = 0, const char *name = 0, bool modal = false);
virtual ~QueryDlgBase ();
bool smartCompare (const QString&, const QString&, int level) const;
bool verifyField(QLineEdit *field, const QString &really);
void resetField (QLineEdit *field);
bool verifyField(QMultiLineEdit *field, const QString &really,
bool mixed);
void resetField (QMultiLineEdit *field);
void verifyButton(QRadioButton *radio, bool is_ok, QWidget *widget2 = 0);
void resetButton (QRadioButton *radio, QWidget *widget2 = 0);
// Show string after selceting known/unknown
// depending on progress and randomness
QString getOKComment(int percent);
QString getNOKComment(int percent);
QString getTimeoutComment(int percent);
int getRandom(int range)
{
// srand((unsigned int)time((time_t *)NULL));
return (int) (range * ((1.0*rand())/RAND_MAX));
}
virtual void initFocus() const;
signals:
void sigQueryChoice(QueryDlgBase::Result);
void sigEditEntry(int row, int col);
protected:
virtual void closeEvent(QCloseEvent*e);
virtual void slotUser1();
struct RB_Label {
RB_Label (QRadioButton* _rb, QLabel *_label)
: rb(_rb), label(_label) {}
QRadioButton *rb;
QLabel *label;
};
int q_row,
q_ocol,
q_tcol;
kvoctrainDoc *kv_doc;
kvoctrainExpr *kv_exp;
QString translation;
QTimer *qtimer;
int timercount;
};
#endif // Query_Dlg_Base_H
|
/* Copyright (C) 2000-2002 MySQL AB
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
/*
Lock databases against read or write.
*/
#include "myrg_def.h"
int myrg_lock_database(MYRG_INFO *info, int lock_type)
{
int error,new_error;
MYRG_TABLE *file;
error=0;
for (file=info->open_tables ; file != info->end_table ; file++)
{
#ifdef _WIN32
/*
Make sure this table is marked as owned by a merge table.
The semaphore is never released as long as table remains
in memory. This should be refactored into a more generic
approach (observer pattern)
*/
(file->table)->owned_by_merge = TRUE;
#endif
if ((new_error=mi_lock_database(file->table,lock_type)))
{
error=new_error;
if (lock_type != F_UNLCK)
{
while (--file >= info->open_tables)
mi_lock_database(file->table, F_UNLCK);
break;
}
}
}
return(error);
}
|
/*
*
* Copyright (c) Red Hat Inc., 2007
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* NAME
* posix_fadvise01.c
*
* DESCRIPTION
* Check the value that posix_fadvise returns for wrong ADVISE value.
*
* USAGE
* posix_fadvise01
*
* HISTORY
* 11/2007 Initial version by Masatake YAMATO <yamato@redhat.com>
*
* RESTRICTIONS
* None
*/
#define _XOPEN_SOURCE 600
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include "test.h"
#include "safe_macros.h"
#include "lapi/syscalls.h"
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 32
#endif
#ifndef __NR_fadvise64
#define __NR_fadvise64 0
#endif
void setup();
void cleanup();
TCID_DEFINE(posix_fadvise01);
char fname[] = "/bin/cat"; /* test executable to open */
int fd = -1; /* initialized in open */
int expected_return = 0;
int defined_advise[] = {
POSIX_FADV_NORMAL,
POSIX_FADV_SEQUENTIAL,
POSIX_FADV_RANDOM,
POSIX_FADV_NOREUSE,
POSIX_FADV_WILLNEED,
POSIX_FADV_DONTNEED,
};
#define defined_advise_total ARRAY_SIZE(defined_advise)
int TST_TOTAL = defined_advise_total;
int main(int ac, char **av)
{
int lc;
int i;
/* Check this system has fadvise64 system which is used
in posix_fadvise. */
if ((_FILE_OFFSET_BITS != 64) && (__NR_fadvise64 == 0)) {
tst_resm(TWARN,
"This test can only run on kernels that implements ");
tst_resm(TWARN, "fadvise64 which is used from posix_fadvise");
exit(0);
}
/*
* parse standard options
*/
tst_parse_opts(ac, av, NULL, NULL);
/*
* perform global setup for test
*/
setup();
/*
* check looping state if -i option given on the command line
*/
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
/* loop through the test cases */
for (i = 0; i < defined_advise_total; i++) {
TEST(posix_fadvise(fd, 0, 0, defined_advise[i]));
/* Man page says:
"On error, an error number is returned." */
if (TEST_RETURN == expected_return) {
tst_resm(TPASS, "call succeeded expectedly");
} else {
tst_resm(TFAIL,
"unexpected return value - %ld : %s, advise %d - "
"expected %d",
TEST_RETURN,
strerror(TEST_RETURN),
defined_advise[i], expected_return);
}
}
}
/*
* cleanup and exit
*/
cleanup();
tst_exit();
}
/*
* setup() - performs all ONE TIME setup for this test.
*/
void setup(void)
{
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
fd = SAFE_OPEN(cleanup, fname, O_RDONLY);
}
/*
* cleanup() - performs all ONE TIME cleanup for this test at
* completion or premature exit.
*/
void cleanup(void)
{
if (fd != -1) {
close(fd);
}
}
|
#ifndef LISTALIGADA_H_INCLUDED
#define LISTALIGADA_H_INCLUDED
typedef struct {
int chave;
int valor;
} ITEM;
typedef struct NO {
ITEM item;
struct NO *proximo;
} NO;
typedef struct {
NO *inicio;
NO *fim;
} LISTA_LIGADA;
void criar(LISTA_LIGADA *lista);
int vazia(LISTA_LIGADA *lista);
void imprimir(LISTA_LIGADA *lista);
int buscar(LISTA_LIGADA *lista, int chave, ITEM *item);
int inserir(LISTA_LIGADA *lista, ITEM *item);
int remover_fim(LISTA_LIGADA *lista);
#endif // LISTALIGADA_H_INCLUDED
|
// Scintilla source code edit control
/** @file ILexer.h
** Interface between Scintilla and lexers.
**/
// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef ILEXER_H
#define ILEXER_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
#ifdef _WIN32
#define SCI_METHOD __stdcall
#else
#define SCI_METHOD
#endif
enum { dvOriginal=0, dvLineEnd=1 };
class IDocument {
public:
virtual int SCI_METHOD Version() const = 0;
virtual void SCI_METHOD SetErrorStatus(int status) = 0;
virtual int SCI_METHOD Length() const = 0;
virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0;
virtual char SCI_METHOD StyleAt(int position) const = 0;
virtual int SCI_METHOD LineFromPosition(int position) const = 0;
virtual int SCI_METHOD LineStart(int line) const = 0;
virtual int SCI_METHOD GetLevel(int line) const = 0;
virtual int SCI_METHOD SetLevel(int line, int level) = 0;
virtual int SCI_METHOD GetLineState(int line) const = 0;
virtual int SCI_METHOD SetLineState(int line, int state) = 0;
virtual void SCI_METHOD StartStyling(int position, char mask) = 0;
virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0;
virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0;
virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0;
virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0;
virtual int SCI_METHOD CodePage() const = 0;
virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
virtual const char * SCI_METHOD BufferPointer() = 0;
virtual int SCI_METHOD GetLineIndentation(int line) = 0;
};
class IDocumentWithLineEnd : public IDocument {
public:
virtual int SCI_METHOD LineEnd(int line) const = 0;
virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0;
virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0;
};
enum { lvOriginal=0, lvSubStyles=1 };
class ILexer {
public:
virtual int SCI_METHOD Version() const = 0;
virtual void SCI_METHOD Release() = 0;
virtual const char * SCI_METHOD PropertyNames() = 0;
virtual int SCI_METHOD PropertyType(const char *name) = 0;
virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0;
virtual const char * SCI_METHOD DescribeWordListSets() = 0;
virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0;
virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
};
class ILexerWithSubStyles : public ILexer {
public:
virtual int SCI_METHOD LineEndTypesSupported() = 0;
virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
virtual void SCI_METHOD FreeSubStyles() = 0;
virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
virtual const char * SCI_METHOD GetSubStyleBases() = 0;
};
class ILoader {
public:
virtual int SCI_METHOD Release() = 0;
// Returns a status code from SC_STATUS_*
virtual int SCI_METHOD AddData(char *data, int length) = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif
|
/*
* sheeptypes.h - Typedef wrapper for multiple platforms
*
* SheepShear, 2012 Alexander von Gluck
*
* 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 __SHEEPTYPES_H
#define __SHEEPTYPES_H
/*
* Set datatype sizes
* All SIZEOF_X defines are in bytes
* Should work for most common compilers
*/
#if defined(__SIZEOF_LONG__)
#define SIZEOF_SHORT __SIZEOF_SHORT__
#define SIZEOF_INT __SIZEOF_INT__
#define SIZEOF_LONG __SIZEOF_LONG__
#define SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
#define SIZEOF_VOID_P __SIZEOF_POINTER__
#elif defined(_LP64) || defined(__LP64__)
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 8
#elif defined(_ILP64) || defined(__ILP64__)
#define SIZEOF_SHORT 2
#define SIZEOF_INT 8
#define SIZEOF_LONG 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 8
#elif defined(_LLP64) || defined(__LLP64__)
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 8
#elif defined(_ILP32) || defined(__ILP32__)
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 4
#elif defined(_LP32) || defined(__LP32__)
#define SIZEOF_SHORT 2
#define SIZEOF_INT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 4
#elif defined(__i386__)
#warning WARNING: Guessing type sizes!
#define SIZEOF_SHORT 2
#define SIZEOF_INT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_VOID_P 4
#else
#error Set datatype size detection for compiler
#endif
#if defined(__HAIKU__)
#include <SupportDefs.h>
#else
typedef unsigned char uint8;
typedef signed char int8;
#if SIZEOF_SHORT == 2
typedef unsigned short uint16;
typedef short int16;
#elif SIZEOF_INT == 2
typedef unsigned int uint16;
typedef int int16;
#else
#error "No 2 byte type, you lose."
#endif
#if SIZEOF_INT == 4
typedef unsigned int uint32;
typedef int int32;
#elif SIZEOF_LONG == 4
typedef unsigned long uint32;
typedef long int32;
#else
#error "No 4 byte type, you lose."
#endif
#if SIZEOF_LONG == 8
typedef unsigned long uint64;
typedef long int64;
#elif SIZEOF_LONG_LONG == 8
typedef unsigned long long uint64;
typedef long long int64;
#else
#error "No 8 byte type, you lose."
#endif
#if SIZEOF_VOID_P == 4
typedef uint32 uintptr;
typedef int32 intptr;
#elif SIZEOF_VOID_P == 8
typedef uint64 uintptr;
typedef int64 intptr;
#else
#error "Unsupported size of pointer"
#endif
#endif /* !HAIKU */
#if SIZEOF_LONG == 8
#define VAL64(a) (a ## l)
#define UVAL64(a) (a ## ul)
#elif SIZEOF_LONG_LONG == 8
#define VAL64(a) (a ## LL)
#define UVAL64(a) (a ## uLL)
#endif
#endif /* __SHEEPTYPES_H */
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/IMCore.framework/Frameworks/IMDAppleServices.framework/IMDAppleServices
*/
#import <IMDAppleServices/IMSystemMonitorListener.h>
#import <IMDAppleServices/IMDAppleServices-Structs.h>
@class NSNumber, NSDate, NSMutableArray, FTMessageDelivery, FTPushHandler;
@interface IMDAppleIDSRegistrationCenter : NSObject <IMSystemMonitorListener> {
NSMutableArray *_queuedRegistrations; // 4 = 0x4
NSMutableArray *_queuedProvisionings; // 8 = 0x8
NSMutableArray *_queuedDeregistrations; // 12 = 0xc
NSMutableArray *_handlers; // 16 = 0x10
BOOL _shouldUseAbsinthe; // 20 = 0x14
BOOL _isBuildingContext; // 21 = 0x15
NACContextOpaque_Ref _validationContext; // 24 = 0x18
BOOL _validationContextDisabled; // 28 = 0x1c
NSDate *_validateContextDate; // 32 = 0x20
NSNumber *_validateContextTTL; // 36 = 0x24
NSMutableArray *_validationContextQueue; // 40 = 0x28
FTMessageDelivery *_httpMessageDelivery; // 44 = 0x2c
FTPushHandler *_pushHandler; // 48 = 0x30
}
+ (id)sharedInstance; // 0xef05
- (void)removeListener:(id)listener; // 0x157a1
- (void)addListener:(id)listener; // 0x15721
- (id)activeRegistrations; // 0x15649
- (void)cancelActionsForRegistrationInfo:(id)registrationInfo; // 0x153e1
- (BOOL)sendDeregistration:(id)deregistration; // 0x1523d
- (BOOL)sendRegistration:(id)registration; // 0x14ff5
- (BOOL)provisionRegistration:(id)registration; // 0x14ca1
- (BOOL)isDeregistering:(id)deregistering; // 0x14c7d
- (BOOL)isRegistering:(id)registering; // 0x14c21
- (void)_sendProvisionRegistration:(id)registration; // 0x135c5
- (void)_sendDeregistration:(id)deregistration; // 0x12eb5
- (void)_sendRegistration:(id)registration; // 0x11ba9
- (BOOL)_hasRegistration:(id)registration inQueue:(id)queue; // 0x119b5
- (void)_notifyDeregistrationSuccess:(id)success; // 0x11715
- (void)_notifyDeregistrationFailure:(id)failure error:(int)error info:(id)info; // 0x1145d
- (void)_notifyRegistrationSuccess:(id)success; // 0x111c9
- (void)_notifyRegistrationFailure:(id)failure error:(int)error info:(id)info; // 0x10e81
- (void)_notifyProvisionSuccess:(id)success; // 0x10bc5
- (void)_notifyProvisionFailure:(id)failure error:(int)error info:(id)info; // 0x1091d
- (void)buildValidationCredentialsIfNeeded; // 0x1088d
- (BOOL)_queueBuildingValidationDataIfNecessaryForMessage:(id)message; // 0x10471
- (void)_sendAbsintheValidationCertRequestIfNeeded; // 0xf771
- (void)__cleanupValidationInfo; // 0xf66d
- (void)__flushValidationQueue; // 0xf47d
- (void)__failValidationQueue; // 0xf2dd
- (void)__queueValidationMessage:(id)message; // 0xf209
- (void)dealloc; // 0xf0d1
- (id)init; // 0xefb9
- (BOOL)retainWeakReference; // 0xefb5
- (BOOL)allowsWeakReference; // 0xefb1
@end
|
#ifndef SRC_COUWBAT_MODEL_COUWBAT_TX_QUEUE_H_
#define SRC_COUWBAT_MODEL_COUWBAT_TX_QUEUE_H_
#include "ns3/network-module.h"
#include <deque>
#include <map>
namespace ns3
{
typedef Ptr<Packet> PacketType;
typedef std::deque<PacketType> PacketQueueType;
/**
* \ingroup couwbat
*
* \brief A simple transmission queue for CR-BS and CR-STA.
*
* Contains separate queues for every destination MAC address.
* Furthermore, it has two queues per destination MAC: normal and high priority.
* Priorities are assigned according to packet size, whereby smaller packets are placed
* into the high priority queue and mostly sent before larger packets. This is done
* to prevent TCP connections from choking by prioritizing smaller service packets (e.g. SYN/ACK pairs)
* over larger data packets.
*
* The parameters and thresholds for prioritization are configured in couwbat.h/.cc
*/
class CouwbatTxQueue
{
public:
// TODO handle broadcast addr
void Enqueue (const Mac48Address dest, PacketType packet);
void Reenqueue (const Mac48Address dest, PacketType packet);
PacketType Peek (const Mac48Address dest);
PacketType Pop (const Mac48Address dest, bool &retransmission);
void Clear (const Mac48Address dest);
void ClearAll ();
int GetQueueSize (const Mac48Address dest);
private:
std::map<const Mac48Address, PacketQueueType> m_queues;
std::map<const Mac48Address, PacketQueueType> m_priorityQueues;
std::map<const Mac48Address, uint32_t> m_reenqueueCount;
std::map<const Mac48Address, uint32_t> m_priorityReenqueueCount;
int m_priorityRatioCounter;
bool m_flagLastPeekPriority;
};
}
#endif /* SRC_COUWBAT_MODEL_COUWBAT_TX_QUEUE_H_ */
|
/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
extern void *ObjectReference_Cmds[];
|
#include "logmoko_mem.h"
void *lmk_malloc(size_t size) {
return (void *) malloc(size);
}
void lmk_free(void *addr) {
if (addr != NULL) {
free(addr);
}
}
|
/*---------------------------------------------------------------------------
-- Vertical Shmup Demo --
-----------------------------------------------------------------------------
-- --
-- This is an example demo for MaRTE OS. --
-- --
-- author: Alvaro Garcia Cuesta --
-- website: www.binarynonsense.com --
-- --
-- file: keyboard.c --
-- --
-- this file contains [...] --
-----------------------------------------------------------------------------
-- License --
-----------------------------------------------------------------------------
-- --
-- This 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. --
-- See COPYING file for more info about the license --
-- --
-----------------------------------------------------------------------------
-- last update: 25 Aug 2014 --
---------------------------------------------------------------------------*/
#include <intr.h> // may need to add CPP_BEGIN_DECLS & CPP_END_DECLS in this marte's file
//#include <stdio.h>
#include <sys/pio.h>
#include "keyboard.h"
unsigned char pressedKeys[128] = {0};
static int gamingKBD_irq_handler (void *area, intr_t irq)
{
unsigned char scancode = inb(0x60);
if (scancode & 0x80)
{//key released
pressedKeys[scancode - 128] = 0;
}
else
{//key pressed
pressedKeys[scancode] = 1;
}
//return POSIX_INTR_HANDLED_NOTIFY;
//return POSIX_INTR_HANDLED_DO_NOT_NOTIFY;
return 0;
}
void init_keyboard()
{
// int i;
// for(i=0;i<128;i++){
// pressedKeys[i]=0;
// }
posix_intr_associate(KEYBOARD_HWINTERRUPT, gamingKBD_irq_handler, ((void *)0), 0); //((void *)0)==NULL
}
/*int posix_intr_associate (intr_t intr,
int (*intr_handler) (void * area, intr_t intr),
volatile void * area,
size_t areasize);*/
//posix_intr_associate(int, int (*)(void*, int), void volatile*, unsigned int)
|
#ifndef _SW_LINE_H_
#define _SW_LINE_H_
#include <math.h>
#include <iostream>
using std :: ostream;
using std :: cout;
using std :: endl;
typedef float line_t;
class swLine
{
private:
line_t a_, b_, c_; //line is ax + by + c = 0;
public:
swLine ();
swLine (line_t x0, line_t y0, line_t x1, line_t y1);
swLine (line_t a, line_t b, line_t c);
~swLine ();
line_t a () const {return a_;}
line_t b () const {return b_;}
line_t c () const {return c_;}
bool OK () {cout << "a = " << a_ << " b = " << b_ << endl; return a_ != 0 && b_ != 0;}
bool gen_new (line_t x0, line_t y0, line_t x1, line_t y1);
bool is_on_line (line_t x0, line_t y0);
bool is_normal_less (line_t x0, line_t y0, line_t max_height);
bool is_normal_more (line_t x0, line_t y0, line_t min_height);
line_t normal (line_t x0, line_t y0);
friend ostream& operator << (ostream& s, const swLine& l);
};
swLine :: swLine () :
a_ (0),
b_ (0),
c_ (0)
{}
swLine :: swLine (line_t x0, line_t y0, line_t x1, line_t y1) :
a_ (0),
b_ (0),
c_ (0)
{
gen_new (x0, y0, x1, y1);
}
swLine :: swLine (line_t a, line_t b, line_t c) :
a_ (a),
b_ (b),
c_ (c)
{}
swLine :: ~swLine ()
{
a_ = b_ = c_ = 0;
}
bool swLine :: gen_new (line_t x0, line_t y0, line_t x1, line_t y1)
{
swREPORT;
if (x0 == x1 && x0 != 0)
{
// cout << "I AM BIIIIG KREVEDKO!!!! " << x0 << ' ' << x1 << endl;
// getch ();
}
if (x0 == x1) return false;
a_ = (y0 - y1) / (x0 - x1);
b_ = - 1;
c_ = - (a_ * x0 + b_ * y0);
return true;
}
bool swLine :: is_on_line (line_t x0, line_t y0)
{
swREPORT;
return (a_ * x0 + b_ * y0 + c_ == 0);
}
bool swLine :: is_normal_less (line_t x0, line_t y0, line_t max_height)
{
swREPORT;
float norm = normal (x0, y0);
bool res = (norm <= max_height);
/*
int static true_res = 0;
int static false_res = 0;
if (res) true_res ++;
else false_res ++;
cout << *this << endl;
cout << '(' << x0 << ", " << y0 << ')' << endl;
cout << "norm = " << norm << ' ';
cout << "true = " << true_res << " false = " << false_res << endl << endl;
*/
return res;
}
bool swLine :: is_normal_more (line_t x0, line_t y0, line_t min_height)
{
swREPORT;
return (normal (x0, y0) >= min_height);
}
line_t swLine :: normal (line_t x0, line_t y0)
{
swREPORT;
if (a_ == 0 &&
b_ == 0) return 0;
return fabs (a_ * x0 + b_ * y0 + c_) / sqrt (a_ * a_ + b_ * b_);
}
ostream& operator << (ostream& s, const swLine& l)
{
s << l.a () << "x + " << l.b () << "y + " << l.c () << " = 0;";
return s;
}
#endif
|
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
* Copyright (C) 1998-1999 Brian Bruns
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <tds.h>
#include <sybdb.h>
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#ifdef dbopen
#undef dbopen
#endif
TDS_RCSID(var, "$Id: dbopen.c,v 1.15 2011/05/16 08:51:40 freddy77 Exp $");
/**
* Normally not used.
* The function is linked in only if the --enable-sybase-compat configure option is used.
* Cf. sybdb.h dbopen() macros, and dbdatecrack().
*/
DBPROCESS *
dbopen(LOGINREC * login, const char *server)
{
#if MSDBLIB
return tdsdbopen(login, server, 1);
#else
return tdsdbopen(login, server, 0);
#endif
}
|
#ifndef __MDFN_DRIVERS_N_JOYSTICK_H
#define __MDFN_DRIVERS_N_JOYSTICK_H
#include <utility>
#include <vector>
#include <list>
class Joystick
{
public:
Joystick();
virtual ~Joystick();
INLINE uint64 ID(void) { return id; } // Should be guaranteed unique if at all possible, but if it's not, JoystickManager will handle clashes.
INLINE const char *Name(void) { return name; }
INLINE unsigned NumAxes(void) { return num_axes; }
INLINE unsigned NumRelAxes(void) { return num_rel_axes; }
INLINE unsigned NumButtons(void) { return num_buttons; }
INLINE int16 GetAxis(unsigned axis) { return axis_state[axis]; } // return value should be -32767 through 32767 for stick-type axes, and 0 through 32767
// for analog buttons(if that information is even available, which it is commonly not).
// If an axis is an analog button and the value returned will be 0 through 32767, then you must
// also implement the IsAxisButton() method.
INLINE int GetRelAxis(unsigned rel_axis) { return rel_axis_state[rel_axis]; }
INLINE bool GetButton(unsigned button) { return button_state[button]; }
virtual bool IsAxisButton(unsigned axis);
virtual void SetRumble(uint8 weak_intensity, uint8 strong_intensity);
virtual unsigned HatToAxisCompat(unsigned hat);
virtual unsigned HatToButtonCompat(unsigned hat);
protected:
void CalcOldStyleID(unsigned num_axes, unsigned num_balls, unsigned num_hats, unsigned num_buttons);
char name[256];
unsigned num_axes;
unsigned num_rel_axes;
unsigned num_buttons;
uint64 id;
std::vector<int16> axis_state;
std::vector<int> rel_axis_state;
std::vector<bool> button_state;
};
class JoystickDriver
{
public:
JoystickDriver();
virtual ~JoystickDriver();
virtual unsigned NumJoysticks(); // Cached internally on JoystickDriver instantiation.
virtual Joystick *GetJoystick(unsigned index);
virtual void UpdateJoysticks(void);
};
struct JoystickManager_Cache
{
Joystick *joystick;
uint64 UniqueID;
enum
{
AXIS_CONFIG_TYPE_GENERIC = 0,
AXIS_CONFIG_TYPE_ANABUTTON_POSPRESS,
AXIS_CONFIG_TYPE_ANABUTTON_NEGPRESS
};
// Helpers for input configuration(may have semantics that differ from what the names would suggest)!
int config_prio; // Set to -1 to exclude this joystick instance from configuration, 0 is normal, 1 is SPECIALSAUCEWITHBACON.
std::vector<int16> axis_config_type;
bool prev_state_valid;
std::vector<int16> prev_axis_state;
std::vector<int> axis_hysterical_ax_murderer;
std::vector<bool> prev_button_state;
std::vector<int32> rel_axis_accum_state;
};
class JoystickManager
{
public:
JoystickManager();
~JoystickManager();
unsigned DetectAnalogButtonsForChangeCheck(void);
void Reset_BC_ChangeCheck(void);
bool Do_BC_ChangeCheck(ButtConfig *bc); // TODO: , bool hint_analog); // hint_analog = true if the emulated button is an analog button/axis/whatever, false if it's digital(binary 0/1).
// affects sort order if multiple events come in during the debouncey time period.
void SetAnalogThreshold(double thresh); // 0.0..-1.0...
void UpdateJoysticks(void);
void SetRumble(const std::vector<ButtConfig> &bc, uint8 weak_intensity, uint8 strong_intensity);
bool TestButton(const ButtConfig &bc);
int TestAnalogButton(const ButtConfig &bc);
unsigned GetIndexByUniqueID(uint64 unique_id); // Returns ~0U if joystick was not found.
unsigned GetUniqueIDByIndex(unsigned index);
private:
int AnalogThreshold;
std::vector<JoystickDriver *> JoystickDrivers;
std::vector<JoystickManager_Cache> JoystickCache;
ButtConfig BCPending;
int BCPending_Prio;
uint32 BCPending_Time;
uint32 BCPending_CCCC;
};
#endif
|
/*
C-Dogs SDL
A port of the legendary (and fun) action/arcade cdogs.
Copyright (c) 2015-2019 Cong Xu
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "draw/draw_buffer.h"
#include "hud/hud.h"
#include "screen_shake.h"
#define CAMERA_SPLIT_PADDING 40
typedef enum
{
SPECTATE_NONE,
SPECTATE_FOLLOW,
SPECTATE_FREE
} SpectateMode;
typedef struct
{
DrawBuffer Buffer;
struct vec2 lastPosition;
HUD HUD;
ScreenShake shake;
SpectateMode spectateMode;
// UID of actor to follow; only used if camera is in follow mode
int FollowActorUID;
// Immediately enter follow mode on the next player that joins the game
// This is used for when the game has no players; all spectators should
// immediately follow the next player to join
bool FollowNextPlayer;
int NumViews;
} Camera;
void CameraInit(Camera *camera);
void CameraReset(Camera *camera);
void CameraTerminate(Camera *camera);
void CameraInput(Camera *camera, const int cmd, const int lastCmd);
void CameraUpdate(Camera *camera, const int ticks, const int ms);
void CameraDraw(Camera *camera, const HUDDrawData drawData);
void CameraDrawMode(const Camera *camera);
bool CameraIsSingleScreen(void);
|
/*
*****************************************************************************
*
* File: send_spa_packet.c
*
* Purpose: Function to send a SPA data packet out onto the network.
*
* Fwknop is developed primarily by the people listed in the file 'AUTHORS'.
* Copyright (C) 2009-2014 fwknop developers and contributors. For a full
* list of contributors, see the file 'CREDITS'.
*
* License (GNU General Public License):
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*****************************************************************************
*/
#include "fwknop_client.h"
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
/* Send the SPA data via UDP packet.
*/
int
send_spa_packet(fwknop_options_t *options)
{
int sock, res=0, sd_len, error;
struct addrinfo *result, *rp, hints;
char port_str[MAX_PORT_STR_LEN];
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
sprintf(port_str, "%d", options->spa_dst_port);
error = getaddrinfo(options->spa_server_str, port_str, &hints, &result);
if (error != 0)
{
LOGV("Error in getaddrinfo: %s\n", gai_strerror(error));
return -1;
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
sock = socket(rp->ai_family, rp->ai_socktype,
rp->ai_protocol);
if (sock < 0)
continue;
if ((error = (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1)))
break; /* made it */
close(sock);
}
if (rp == NULL)
{
LOGV("Error: Unable to create socket.");
return -1;
}
freeaddrinfo(result);
sd_len = strlen(options->spa_data);
res = send(sock, options->spa_data, sd_len, 0);
if(res < 0)
LOGV("send_spa_packet: write error: ");
else if(res != sd_len)
LOGV("Warning: bytes sent (%i) not spa data length (%i).\n",
res, sd_len
);
close(sock);
return(res);
}
/***EOF***/
|
/* *************************************************************************
* Copyright 2010 Jakob Gruber *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
************************************************************************* */
#ifndef CURSESFRAME_H
#define CURSESFRAME_H
#include <ncurses.h>
#include <string>
#define C_DEF (COLOR_PAIR(5))
#define C_DEF_HL1 (COLOR_PAIR(2))
#define C_DEF_HL2 (COLOR_PAIR(3))
#define C_DEF_HL3 (COLOR_PAIR(6))
#define C_DEF_HL4 (COLOR_PAIR(7))
#define C_DEF_HL5 (COLOR_PAIR(8))
#define C_DEF_HL6 (COLOR_PAIR(9))
#define C_INV (COLOR_PAIR(1))
#define C_INV_HL1 (COLOR_PAIR(4))
class FrameInfo;
class CursesFrame
{
public:
CursesFrame(FrameInfo *frameinfo);
virtual ~CursesFrame();
void reposition(int termw, int termh);
void setbackground(chtype col);
void setheader(std::string str);
void setfooter(std::string str);
virtual void refresh();
void printw(std::string str, int attr = 0);
void mvprintw(int x, int y, std::string str, int attr = 0);
void move(int x, int y);
void clear();
void setfocused(bool b)
{
focused = b;
}
int usableheight() const;
int usablewidth() const;
protected:
std::string fitstrtowin(std::string in, int x = -1) const;
std::string escapestring(std::string str) const;
const std::string overflowind;
WINDOW *w_main,
*w_border;
std::string header,
footer;
bool focused;
FrameInfo *finfo;
};
#endif // CURSESFRAME_H
|
/*
* Copyright (c) 2005, Eric Crahen
*
* 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 __ZTEXCEPTIONS_H__
#define __ZTEXCEPTIONS_H__
#include "zthread/Config.h"
#include <string>
namespace ZThread {
/**
* @class Synchronization_Exception
*
* Serves as a general base class for the Exception hierarchy used within
* this package.
*
*/
class Synchronization_Exception {
// Restrict heap allocation
static void * operator new(size_t size);
static void * operator new[](size_t size);
std::string _msg;
public:
/**
* Create a new exception with a default error message 'Synchronization
* Exception'
*/
Synchronization_Exception() : _msg("Synchronization exception") { }
/**
* Create a new exception with a given error message
*
* @param const char* - error message
*/
Synchronization_Exception(const char* msg) : _msg(msg) { }
/**
* Get additional info about the exception
*
* @return const char* for the error message
*/
const char* what() const {
return _msg.c_str();
}
};
/**
* @class Interrupted_Exception
*
* Used to describe an interrupted operation that would have normally
* blocked the calling thread
*/
class Interrupted_Exception : public Synchronization_Exception {
public:
//! Create a new exception
Interrupted_Exception() : Synchronization_Exception("Thread interrupted") { }
//! Create a new exception
Interrupted_Exception(const char* msg) : Synchronization_Exception(msg) { }
};
/**
* @class Deadlock_Exception
*
* Thrown when deadlock has been detected
*/
class Deadlock_Exception : public Synchronization_Exception {
public:
//! Create a new exception
Deadlock_Exception() : Synchronization_Exception("Deadlock detected") { }
//! Create a new exception
Deadlock_Exception(const char* msg) : Synchronization_Exception(msg) { }
};
/**
* @class InvalidOp_Exception
*
* Thrown when performing an illegal operation this object
*/
class InvalidOp_Exception : public Synchronization_Exception {
public:
//! Create a new exception
InvalidOp_Exception() : Synchronization_Exception("Invalid operation") { }
//! Create a new exception
InvalidOp_Exception(const char* msg) : Synchronization_Exception(msg) { }
};
/**
* @class Initialization_Exception
*
* Thrown when the system has no more resources to create new
* synchronization controls
*/
class Initialization_Exception : public Synchronization_Exception {
public:
//! Create a new exception
Initialization_Exception() : Synchronization_Exception("Initialization error") { }
//! Create a new exception
Initialization_Exception(const char*msg) : Synchronization_Exception(msg) { }
};
/**
* @class Cancellation_Exception
*
* Cancellation_Exceptions are thrown by 'Canceled' objects.
* @see Cancelable
*/
class Cancellation_Exception : public Synchronization_Exception {
public:
//! Create a new Cancelltion_Exception
Cancellation_Exception() : Synchronization_Exception("Canceled") { }
//! Create a new Cancelltion_Exception
Cancellation_Exception(const char*msg) : Synchronization_Exception(msg) { }
};
/**
* @class Timeout_Exception
*
* There is no need for error messaged simply indicates the last
* operation timed out
*/
class Timeout_Exception : public Synchronization_Exception {
public:
//! Create a new Timeout_Exception
Timeout_Exception() : Synchronization_Exception("Timeout") { }
//! Create a new
Timeout_Exception(const char*msg) : Synchronization_Exception(msg) { }
};
/**
* @class NoSuchElement_Exception
*
* The last operation that was attempted on a Queue could not find
* the item that was indicated (during that last Queue method invocation)
*/
class NoSuchElement_Exception {
public:
//! Create a new exception
NoSuchElement_Exception() {}
};
/**
* @class InvalidTask_Exception
*
* Thrown when a task is not valid (e.g. null or start()ing a thread with
* no overriden run() method)
*/
class InvalidTask_Exception : public InvalidOp_Exception {
public:
//! Create a new exception
InvalidTask_Exception() : InvalidOp_Exception("Invalid task") {}
};
/**
* @class BrokenBarrier_Exception
*
* Thrown when a Barrier is broken because one of the participating threads
* has been interrupted.
*/
class BrokenBarrier_Exception : public Synchronization_Exception {
public:
//! Create a new exception
BrokenBarrier_Exception() : Synchronization_Exception("Barrier broken") { }
//! Create a new exception
BrokenBarrier_Exception(const char* msg) : Synchronization_Exception(msg) { }
};
/**
* @class Future_Exception
*
* Thrown when there is an error using a Future.
*/
class Future_Exception : public Synchronization_Exception {
public:
//! Create a new exception
Future_Exception() : Synchronization_Exception() { }
//! Create a new exception
Future_Exception(const char* msg) : Synchronization_Exception(msg) { }
};
};
#endif // __ZTEXCEPTIONS_H__
|
/*
* a52.h
* Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of a52dec, a free ATSC A-52 stream decoder.
* See http://liba52.sourceforge.net/ for updates.
*
* Modified for use with MPlayer, changes contained in liba52_changes.diff.
* detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
* $Id: a52.h 18786 2006-06-22 13:34:00Z diego $
*
* a52dec 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.
*
* a52dec 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 A52_H
#define A52_H
#ifndef LIBA52_DOUBLE
typedef float sample_t;
#else
typedef double sample_t;
#endif
typedef struct a52_state_s a52_state_t;
#define A52_CHANNEL 0
#define A52_MONO 1
#define A52_STEREO 2
#define A52_3F 3
#define A52_2F1R 4
#define A52_3F1R 5
#define A52_2F2R 6
#define A52_3F2R 7
#define A52_CHANNEL1 8
#define A52_CHANNEL2 9
#define A52_DOLBY 10
#define A52_CHANNEL_MASK 15
#define A52_LFE 16
#define A52_ADJUST_LEVEL 32
a52_state_t * a52_init (uint32_t mm_accel);
sample_t * a52_samples (a52_state_t * state);
int a52_syncinfo (uint8_t * buf, int * flags,
int * sample_rate, int * bit_rate);
int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
sample_t * level, sample_t bias);
void a52_dynrng (a52_state_t * state,
sample_t (* call) (sample_t, void *), void * data);
int a52_block (a52_state_t * state);
void a52_free (a52_state_t * state);
void* a52_resample_init(uint32_t mm_accel,int flags,int chans);
extern int (* a52_resample) (float * _f, int16_t * s16);
uint16_t crc16_block(uint8_t *data,uint32_t num_bytes);
#endif /* A52_H */
|
/*
* QEMU CRIS CPU
*
* Copyright (c) 2012 SUSE LINUX Products GmbH
*
* 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, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>
*/
#ifndef QEMU_CRIS_CPU_QOM_H
#define QEMU_CRIS_CPU_QOM_H
#include "qom/cpu.h"
#define TYPE_CRIS_CPU "cris-cpu"
#define CRIS_CPU_CLASS(klass) \
OBJECT_CLASS_CHECK(CRISCPUClass, (klass), TYPE_CRIS_CPU)
#define CRIS_CPU(obj) \
OBJECT_CHECK(CRISCPU, (obj), TYPE_CRIS_CPU)
#define CRIS_CPU_GET_CLASS(obj) \
OBJECT_GET_CLASS(CRISCPUClass, (obj), TYPE_CRIS_CPU)
/**
* CRISCPUClass:
* @parent_realize: The parent class' realize handler.
* @parent_reset: The parent class' reset handler.
* @vr: Version Register value.
*
* A CRIS CPU model.
*/
typedef struct CRISCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/
DeviceRealize parent_realize;
void (*parent_reset)(CPUState *cpu);
uint32_t vr;
} CRISCPUClass;
/**
* CRISCPU:
* @env: #CPUCRISState
*
* A CRIS CPU.
*/
typedef struct CRISCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/
CPUCRISState env;
} CRISCPU;
static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
{
return CRIS_CPU(container_of(env, CRISCPU, env));
}
#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e))
#endif
|
// eCos memory layout - Thu May 30 10:21:41 2002
// This is a generated file - do not edit
#ifndef __ASSEMBLER__
#include <cyg/infra/cyg_type.h>
#include <stddef.h>
#endif
#include <pkgconf/hal_microblaze_platform.h>
#define CYGMEM_REGION_bram MON_BRAM_BASE
#define CYGMEM_REGION_bram_SIZE MON_BRAM_HIGH
#define CYGMEM_REGION_bram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
#define CYGMEM_REGION_ram MON_MEMORY_BASE
#define CYGMEM_REGION_ram_SIZE (MON_MEMORY_HIGH - MON_MEMORY_BASE + 1)
#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__reserved_vectors) [];
#endif
#define CYGMEM_SECTION_reserved_vectors (CYG_LABEL_NAME (__reserved_vectors))
#define CYGMEM_SECTION_reserved_vectors_SIZE (0x200)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__reserved_vsr_table) [];
#endif
#define CYGMEM_SECTION_reserved_vsr_table (CYG_LABEL_NAME (__reserved_vsr_table))
#define CYGMEM_SECTION_reserved_vsr_table_SIZE (0x200)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__reserved_virtual_table) [];
#endif
#define CYGMEM_SECTION_reserved_virtual_table (CYG_LABEL_NAME (__reserved_virtual_table))
#define CYGMEM_SECTION_reserved_virtual_table_SIZE (0x200)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__heap1) [];
#endif
#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
#define CYGMEM_SECTION_heap1_SIZE (MON_MEMORY_HIGH - (size_t) CYG_LABEL_NAME (__heap1))
|
/*
* OMAP Secure API infrastructure.
*
* Copyright (C) 2011 Texas Instruments, Inc.
* Santosh Shilimkar <santosh.shilimkar@ti.com>
*
*
* This program is free software,you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/memblock.h>
#include <linux/cpu_pm.h>
#include <asm/cacheflush.h>
#include <asm/memblock.h>
#include <mach/omap-secure.h>
#include "common.h"
#include "clockdomain.h"
static unsigned int ppa_service_0_index;
static phys_addr_t omap_secure_memblock_base;
static struct clockdomain *l4_secure_clkdm;
/**
* omap_sec_dispatcher: Routine to dispatch low power secure
* service routines
* @idx: The HAL API index
* @flag: The flag indicating criticality of operation
* @nargs: Number of valid arguments out of four.
* @arg1, arg2, arg3 args4: Parameters passed to secure API
*
* Return the non-zero error value on failure.
*/
u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2,
u32 arg3, u32 arg4)
{
u32 ret = 0;
u32 param[5];
param[0] = nargs;
param[1] = arg1;
param[2] = arg2;
param[3] = arg3;
param[4] = arg4;
if (!l4_secure_clkdm) {
if (cpu_is_omap54xx())
l4_secure_clkdm = clkdm_lookup("l4sec_clkdm");
else
l4_secure_clkdm = clkdm_lookup("l4_secure_clkdm");
}
if (!l4_secure_clkdm) {
pr_err("%s: failed to get l4_secure_clkdm\n", __func__);
return -EINVAL;
}
clkdm_wakeup(l4_secure_clkdm);
/*
* Secure API needs physical address
* pointer for the parameters
*/
flush_cache_all();
outer_clean_range(__pa(param), __pa(param + 5));
ret = omap_smc2(idx, flag, __pa(param));
clkdm_allow_idle(l4_secure_clkdm);
return ret;
}
/* Allocate the memory to save secure ram */
int __init omap_secure_ram_reserve_memblock(void)
{
u32 size = OMAP_SECURE_RAM_STORAGE;
size = ALIGN(size, SZ_1M);
omap_secure_memblock_base = arm_memblock_steal(size, SZ_1M);
return 0;
}
phys_addr_t omap_secure_ram_mempool_base(void)
{
return omap_secure_memblock_base;
}
#ifdef CONFIG_CPU_PM
static int secure_notifier(struct notifier_block *self, unsigned long cmd,
void *v)
{
switch (cmd) {
case CPU_CLUSTER_PM_EXIT:
/*
* Dummy dispatcher call after OSWR and OFF
* Restore the right return Kernel address (with MMU on) for
* subsequent calls to secure ROM. Otherwise the return address
* will be to a PA return address and the system will hang.
*/
omap_secure_dispatcher(ppa_service_0_index,
FLAG_START_CRITICAL,
0, 0, 0, 0, 0);
break;
}
return NOTIFY_OK;
}
static struct notifier_block secure_notifier_block = {
.notifier_call = secure_notifier,
};
static int __init secure_pm_init(void)
{
if (omap_type() != OMAP2_DEVICE_TYPE_GP)
cpu_pm_register_notifier(&secure_notifier_block);
if (cpu_is_omap44xx())
ppa_service_0_index = OMAP4_PPA_SERVICE_0;
else if (cpu_is_omap54xx())
ppa_service_0_index = OMAP5_PPA_SERVICE_0;
return 0;
}
early_initcall(secure_pm_init);
#endif
|
/* in_flac - Winamp2 FLAC input plugin
* Copyright (C) 2002,2003,2004,2005 Josh Coalson
*
* 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.
*/
/*
* prototypes
*/
ULONGLONG FileSize(const char *fileName);
void ReadTags(const char *fileName, FLAC__StreamMetadata **tags, BOOL forDisplay);
void InitInfobox();
void DeinitInfobox();
void DoInfoBox(HINSTANCE inst, HWND hwnd, const char *filename);
|
/**
* \file test-xIndexPageFault.c
* \author Christian Eder ( ederc@mathematik.uni-kl.de )
* \date October 2012
* \brief Unit test for xIndexPageFault for xmalloc.
* This file is part of XMALLOC, licensed under the GNU General
* Public License version 3. See COPYING for more information.
*/
#include <stdio.h>
#include "xmalloc-config.h"
#include "xmalloc.h"
int main() {
int i;
// xPageShifts is NULL in the beginning
__XMALLOC_ASSERT(xPageShifts == NULL);
xPageIndexFault(30,32);
// now xPageShifts should have length 3 and all entries should be zero
__XMALLOC_ASSERT(xPageShifts != NULL);
__XMALLOC_ASSERT(xPageShifts[0] == 0);
__XMALLOC_ASSERT(xPageShifts[1] == 0);
__XMALLOC_ASSERT(xPageShifts[2] == 0);
xPageIndexFault(40,44);
// now xPageShifts should have length 15 and all entries should be zero
for (i=0; i < 15; i++)
__XMALLOC_ASSERT(xPageShifts[i] == 0);
xPageIndexFault(20,34);
// now xPageShifts should have length 25 and all entries should be zero. there
// has to be an offset of 10
for (i=0; i < 25; i++)
__XMALLOC_ASSERT(xPageShifts[i] == 0);
return 0;
}
|
#ifndef _SICKSAXIS_H_
#define _SICKSAXIS_H_
#define SS_HEAP_SIZE 4096
#define SS_MAX_DEV 8
#define SS_VENDOR_ID 0x054C
#define SS_PRODUCT_ID 0x0268
#define SS_PAYLOAD_SIZE 49
struct SS_BUTTONS
{
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
uint8_t select : 1;
uint8_t L3 : 1;
uint8_t R3 : 1;
uint8_t start : 1;
uint8_t up : 1;
uint8_t right : 1;
uint8_t down : 1;
uint8_t left : 1;
uint8_t L2 : 1;
uint8_t R2 : 1;
uint8_t L1 : 1;
uint8_t R1 : 1;
uint8_t triangle : 1;
uint8_t circle : 1;
uint8_t cross : 1;
uint8_t square : 1;
uint8_t PS : 1;
uint8_t not_used : 7;
#else
uint8_t left : 1;
uint8_t down : 1;
uint8_t right : 1;
uint8_t up : 1;
uint8_t start : 1;
uint8_t R3 : 1;
uint8_t L3 : 1;
uint8_t select : 1;
uint8_t square : 1;
uint8_t cross : 1;
uint8_t circle : 1;
uint8_t triangle : 1;
uint8_t R1 : 1;
uint8_t L1 : 1;
uint8_t R2 : 1;
uint8_t L2 : 1;
uint8_t not_used : 7;
uint8_t PS : 1;
#endif
};
struct SS_ANALOG
{
uint8_t x;
uint8_t y;
};
struct SS_DPAD_SENSITIVE
{
uint8_t up;
uint8_t right;
uint8_t down;
uint8_t left;
};
struct SS_SHOULDER_SENSITIVE
{
uint8_t L2;
uint8_t R2;
uint8_t L1;
uint8_t R1;
};
struct SS_BUTTON_SENSITIVE
{
uint8_t triangle;
uint8_t circle;
uint8_t cross;
uint8_t square;
};
struct SS_MOTION
{
uint16_t acc_x;
uint16_t acc_y;
uint16_t acc_z;
uint16_t z_gyro;
};
struct SS_GAMEPAD
{
uint8_t hid_data;
uint8_t unk0;
struct SS_BUTTONS buttons;
uint8_t unk1;
struct SS_ANALOG left_analog;
struct SS_ANALOG right_analog;
uint32_t unk2;
struct SS_DPAD_SENSITIVE dpad_sens;
struct SS_SHOULDER_SENSITIVE shoulder_sens;
struct SS_BUTTON_SENSITIVE button_sens;
uint16_t unk3;
uint8_t unk4;
uint8_t status;
uint8_t power_rating;
uint8_t comm_status;
uint32_t unk5;
uint32_t unk6;
uint8_t unk7;
struct SS_MOTION motion;
}__attribute__((packed));
#if 0
struct SS_ATTRIBUTE_RUMBLE
{
uint8_t duration_right;
uint8_t power_right;
uint8_t duration_left;
uint8_t power_left;
};
struct SS_ATTRIBUTES
{
struct SS_ATTRIBUTE_RUMBLE rumble;
int led;
};
typedef void (*ss_usb_callback)(void *usrdata);
struct ss_device {
struct SS_GAMEPAD pad;
struct SS_ATTRIBUTES attributes;
int device_id, fd;
int connected, enabled, reading;
ss_usb_callback read_callback;
ss_usb_callback removal_callback;
void *read_usrdata, *removal_usrdata;
}__attribute__((aligned(32)));
#endif
#endif |
/******************************************************************************
* Copyright 2011 Matteo Valdina
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef ZLOGGERAPPENDER_H__
#define ZLOGGERAPPENDER_H__
#include "zObject.h"
class zLoggerAppender : public zObject {
public:
zLoggerAppender(void);
virtual ~zLoggerAppender(void);
virtual void writeLine(char* line) = 0;
};
#endif // ZLOGGERAPPENDER_H__
|
/*
* DiscoCheck, an UCI chess engine. Copyright (C) 2010-2014 Lucas Braesch.
*
* DiscoCheck 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.
*
* DiscoCheck 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/>.
*/
#pragma once
#include "types.h"
extern void init_pst();
extern void print_pst();
extern int get_pst(int color, int piece, int sq);
|
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "lib/generic/queue.h"
#include <string.h>
void queue_init_impl(struct queue *q, size_t item_size)
{
q->len = 0;
q->item_size = item_size;
q->head = q->tail = NULL;
/* Take 128 B (two x86 cache lines), except a small margin
* that the allocator can use for its overhead.
* Normally (64-bit pointers) this means 16 B header + 13*8 B data. */
q->chunk_cap = (128 - offsetof(struct queue_chunk, data)
- sizeof(size_t)
) / item_size;
if (!q->chunk_cap) q->chunk_cap = 1; /* item_size big enough by itself */
}
void queue_deinit_impl(struct queue *q)
{
if (kr_fails_assert(q))
return;
struct queue_chunk *p = q->head;
while (p != NULL) {
struct queue_chunk *pf = p;
p = p->next;
free(pf);
}
#ifndef NDEBUG
memset(q, 0, sizeof(*q));
#endif
}
static struct queue_chunk * queue_chunk_new(const struct queue *q)
{
/* size_t cast is to avoid unintended sign-extension */
struct queue_chunk *c = malloc(offsetof(struct queue_chunk, data)
+ (size_t) q->chunk_cap * (size_t) q->item_size);
if (unlikely(!c)) abort(); // simplify stuff
memset(c, 0, offsetof(struct queue_chunk, data));
c->cap = q->chunk_cap;
/* ->begin and ->end are zero, i.e. we optimize for _push
* and not _push_head, by default. */
return c;
}
/* Return pointer to the space for the new element. */
void * queue_push_impl(struct queue *q)
{
kr_require(q);
struct queue_chunk *t = q->tail; // shorthand
if (unlikely(!t)) {
kr_require(!q->head && !q->len);
q->head = q->tail = t = queue_chunk_new(q);
} else
if (t->end == t->cap) {
if (t->begin * 2 >= t->cap) {
/* Utilization is below 50%, so let's shift (no overlap).
* (size_t cast is to avoid unintended sign-extension) */
memcpy(t->data, t->data + t->begin * q->item_size,
(size_t) (t->end - t->begin) * (size_t) q->item_size);
t->end -= t->begin;
t->begin = 0;
} else {
/* Let's grow the tail by another chunk. */
kr_require(!t->next);
t->next = queue_chunk_new(q);
t = q->tail = t->next;
}
}
kr_require(t->end < t->cap);
++(q->len);
++(t->end);
return t->data + q->item_size * (t->end - 1);
}
/* Return pointer to the space for the new element. */
void * queue_push_head_impl(struct queue *q)
{
/* When we have choice, we optimize for further _push_head,
* i.e. when shifting or allocating a chunk,
* we store items on the tail-end of the chunk. */
kr_require(q);
struct queue_chunk *h = q->head; // shorthand
if (unlikely(!h)) {
kr_require(!q->tail && !q->len);
h = q->head = q->tail = queue_chunk_new(q);
h->begin = h->end = h->cap;
} else
if (h->begin == 0) {
if (h->end * 2 <= h->cap) {
/* Utilization is below 50%, so let's shift (no overlap).
* Computations here are simplified due to h->begin == 0.
* (size_t cast is to avoid unintended sign-extension) */
const int cnt = h->end;
memcpy(h->data + (h->cap - cnt) * q->item_size, h->data,
(size_t) cnt * (size_t) q->item_size);
h->begin = h->cap - cnt;
h->end = h->cap;
} else {
/* Let's grow the head by another chunk. */
h = queue_chunk_new(q);
h->next = q->head;
q->head = h;
h->begin = h->end = h->cap;
}
}
kr_require(h->begin > 0);
--(h->begin);
++(q->len);
return h->data + q->item_size * h->begin;
}
|
#ifndef RECYCLE_H
#define RECYCLE_H
/*
--------------------------------------------------------------------
By Bob Jenkins, September 1996. recycle.h
You may use this code in any way you wish, and it is free. No warranty.
This manages memory for commonly-allocated structures.
It allocates RESTART to REMAX items at a time.
Timings have shown that, if malloc is used for every new structure,
malloc will consume about 90% of the time in a program. This
module cuts down the number of mallocs by an order of magnitude.
This also decreases memory fragmentation, and freeing all structures
only requires freeing the root.
--------------------------------------------------------------------
*/
#include <stddef.h>
#define RESTART 0
#define REMAX 32000
typedef struct recycle recycle;
struct recycle {
recycle *next;
};
typedef struct reroot {
struct recycle *list; /* list of malloced blocks */
struct recycle *trash; /* list of deleted items */
size_t size; /* size of an item */
size_t logsize; /* log_2 of number of items in a block */
int numleft; /* number of bytes left in this block */
} reroot;
/* make a new recycling root */
reroot *remkroot(size_t mysize);
/* free a recycling root and all the items it has made */
void refree(struct reroot *r);
/* get a new (cleared) item from the root */
#define renew(r) ((r)->numleft ? \
(((char *)((r)->list+1))+((r)->numleft-=(r)->size)) : renewx(r))
char *renewx(struct reroot *r);
/* delete an item; let the root recycle it */
/* void redel(/o_ struct reroot *r, struct recycle *item _o/); */
#define redel(root,item) { \
((recycle *)item)->next=(root)->trash; \
(root)->trash=(recycle *)(item); \
}
/* malloc, but complain to stderr and exit program if no joy */
/* use plain free() to free memory allocated by remalloc() */
void *remalloc(size_t len, const char *purpose);
#endif /* RECYCLE_H */
|
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
struct stack_array {
StackItem *s;
int N;
};
StackArray STACKinitArray(int maxN) {
StackArray s=(StackArray)malloc(sizeof(*s));
s->s=(StackItem*)malloc(maxN*sizeof(StackItem));
s->N=0;
return(s);
}
typedef struct STACKnode *link;
struct STACKnode {
StackItem data;
link next;
};
struct stack_list {
link head;
int N;
};
link STACKnew(StackItem data, link next) {
link x=(link)malloc(sizeof(*x));
x->data=data;
x->next=next;
return(x);
}
StackList STACKinitList(void) {
StackList s=(StackList)malloc(sizeof(*s)) ;
s->head=NULL;
s->N=0;
return(s);
}
int STACKemptyArray(StackArray s) {
return((s->N)==0);
}
int STACKemptyList(StackList s) {
return(s->head==NULL);
}
void STACKpushArray(StackArray s, StackItem data) {
s->s[s->N++]=data;
return;
}
void STACKpushList(StackList s, StackItem data) {
s->head=STACKnew(data, s->head);
return;
}
StackItem STACKpopArray(StackArray s) {
if (STACKemptyArray(s)) {
return(STACKitemSetVoid());
}
return(s->s[--(s->N)]);
}
StackItem STACKpopList(StackList s) {
if (STACKemptyList(s)) {
return(STACKitemSetVoid());
}
StackItem data;
link tmp;
data=s->head->data;
tmp=s->head->next;
free(s->head);
s->head=tmp;
return(data);
}
|
//
// FILE: Set.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.11
// PURPOSE: SET library for Arduino
// URL:
//
// HISTORY:
// see Set.cpp file
//
#ifndef Set_h
#define Set_h
#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif
#define SET_LIB_VERSION "0.1.11"
class Set
{
public:
explicit Set(const bool clear = true); // create empty Set
Set(const Set &t); // create copy Set
void clr(); // clear the Set
void invert(); // flip all elements in the Set
uint16_t count() const; // return the #elements
bool isEmpty();
bool isFull();
void add(const uint8_t); // add element to the Set
void sub(const uint8_t); // remove element from Set
void invert(const uint8_t); // flip element in Set
bool has(const uint8_t); // element is in Set
Set operator + (const Set &); // union
Set operator - (const Set &); // diff
Set operator * (const Set &); // intersection
void operator += (const Set &); // union
void operator -= (const Set &); // diff
void operator *= (const Set &); // intersection
bool operator == (const Set &) const; // equal
bool operator != (const Set &) const; // not equal
bool operator <= (const Set &) const; // is subSet,
// a superSet b is not implemented as one could
// say b subSet a (b <= a)
// a <= b
// iterating through the Set
// returns value or -1 if not exist
int first(); // find first element
int next(); // find next element
int prev(); // find previous element
int last(); // find last element
private:
uint8_t _mem[32]; // can hold 0..255
uint8_t masks[8] = {1, 2, 4, 8, 16, 32, 64, 128};
int _current;
int findNext(const uint8_t, const uint8_t); // helper for first, next
int findPrev(const uint8_t, const uint8_t); // helper for last, prev
};
#endif
//
// END OF FILE
// |
// Simple (educational purposes only) AVL Tree implementation in C.
// Copyright (C) 2013 Tadeusz Magura-Witkowski
// 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
// 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/>.
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
struct node {
int key;
struct node *l;
struct node *r;
int bf;
};
static int node_height(struct node *node) {
if(node == NULL)
return 0;
if(node->bf > 0) {
return 1 + node_height(node->r);
} else {
return 1 + node_height(node->l);
}
}
static void recalculate_bf(struct node *node) {
assert(node != NULL);
node->bf = node_height(node->r) - node_height(node->l);
}
static struct node * new_node(int key) {
struct node *nnode = malloc(sizeof(struct node));
assert(nnode != NULL);
nnode->key = key;
nnode->l = nnode->r = NULL;
nnode->bf = 0;
return nnode;
}
static void del_node(struct node *node) {
assert(node != NULL);
if(node->l)
del_node(node->l);
if(node->r)
del_node(node->r);
free(node);
}
static struct node * rotate_rr(struct node *node);
static struct node * rotate_ll(struct node *node);
static struct node * rotate_rr(struct node *node) { // Right Right Case
assert(node != NULL);
assert(node->r != NULL);
struct node *nnode = node->r;
node->r = nnode->l;
nnode->l = node;
recalculate_bf(node);
recalculate_bf(nnode);
return nnode;
}
static struct node * rotate_ll(struct node *node) { // Left Left Case
assert(node != NULL);
assert(node->l != NULL);
struct node *nnode = node->l;
node->l = nnode->r;
nnode->r = node;
recalculate_bf(node);
recalculate_bf(nnode);
return nnode;
}
static struct node * rotate_rl(struct node *node) { // Right Left Case
assert(node != NULL);
node->r = rotate_ll(node->r);
return rotate_rr(node);
}
static struct node * rotate_lr(struct node *node) { // Left Right Cast
assert(node != NULL);
node->l = rotate_rr(node->l);
return rotate_ll(node);
}
static struct node * add_node(struct node *root, struct node *node) {
assert(node != NULL);
if(root == NULL) {
return node;
}
if(node->key > root->key) {
if(root->r) {
root->r = add_node(root->r, node);
} else {
root->r = node;
}
recalculate_bf(root);
if(root->bf >= 2) {
if(node->key > root->r->key)
root = rotate_rr(root);
else
root = rotate_rl(root);
}
} else if(node->key < root->key) {
if(root->l) {
root->l = add_node(root->l, node);
} else {
root->l = node;
}
recalculate_bf(root);
if(root->bf <= -2) {
if(node->key < root->l->key)
root = rotate_ll(root);
else
root = rotate_lr(root);
}
} else {
del_node(node);
}
assert(root->bf < 2 && root->bf > -2);
return root;
}
static void print_spaces(struct node *node, int spaced) {
int i = 0;
for(; i<spaced-4; i++) putchar(' ');
if(node)
printf("%4d", node->key);
else
printf(" ");
i = 0;
for(; i<spaced; i++) putchar(' ');
}
// kod ponizej chyba byl najciekawsza rozkmina z tego wszystkiego :)
// czyt. rekurencyjne "splaszczanie" drzewa (do arraya), coby go wygodnie wyswietlic
static void flatten_tree(struct node *node, int level, struct node **node_array, int *node_array_pos) {
node_array[ node_array_pos[level]++ ] = node;
if(node == NULL)
return;
flatten_tree(node->l, level+1, node_array, node_array_pos);
flatten_tree(node->r, level+1, node_array, node_array_pos);
}
static void print_tree(struct node *root) {
assert(root != NULL);
int tree_height = node_height(root)+1;
int num_nodes = ((1<<(tree_height))-1);
struct node **node_array = malloc(sizeof(struct node *) * num_nodes);
int *node_array_pos = malloc(sizeof(int) * tree_height);
if(!node_array || !node_array_pos)
return;
int i = 0;
for(; i<tree_height; i++) {
node_array_pos[i] = (1<<i) - 1;
}
// we won't fill in all the positions [children of null nodes] with flatten_tree()
memset(node_array, 0, sizeof(struct node *) * num_nodes);
flatten_tree(root, 0, node_array, node_array_pos);
tree_height--;
int max_height = (((1<<(tree_height)))*4) /2;
struct node **node_array_ptr = node_array;
for(i=0; i<tree_height; i++) {
int on_this_level = (1<<i); // nodes
while(on_this_level--) {
print_spaces(*(node_array_ptr), max_height);
node_array_ptr++;
}
max_height = max_height/2;
printf("\n");
}
free(node_array);
free(node_array_pos);
}
int main(int argc, char const *argv[]) {
struct node *root = NULL;
int entered_number;
for(;;) {
printf("> ");
if(!scanf("%d", &entered_number))
break;
root = add_node(root, new_node(entered_number));
print_tree(root);
}
del_node(root);
return 0;
}
|
/*
* magpole.h
* Patrick Alken
*/
#ifndef INCLUDED_magpole_h
#define INCLUDED_magpole_h
#include <msynth/msynth.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_rng.h>
typedef struct
{
double theta_pole; /* pole co-latitude (radians) */
double phi_pole; /* pole longitude (radians) */
size_t N; /* number of samples for Monte-Carlo */
msynth_workspace *igrf_workspace_p;
gsl_rng *rng_p;
} magpole_workspace;
typedef struct
{
double r; /* geocentric radius in km */
double t; /* decimal year */
magpole_workspace *w;
} magpole_params;
/*
* Prototypes
*/
magpole_workspace *magpole_alloc(const size_t N);
void magpole_free(magpole_workspace *w);
int magpole_calc(const double t, const double r, magpole_workspace *w);
#endif /* INCLUDED_magpole_h */
|
/**
* Mandelbulber v2, a 3D fractal generator ,=#MKNmMMKmmßMNWy,
* ,B" ]L,,p%%%,,,§;, "K
* Copyright (C) 2016-17 Mandelbulber Team §R-==%w["'~5]m%=L.=~5N
* ,=mm=§M ]=4 yJKA"/-Nsaj "Bw,==,,
* This file is part of Mandelbulber. §R.r= jw",M Km .mM FW ",§=ß., ,TN
* ,4R =%["w[N=7]J '"5=],""]]M,w,-; T=]M
* Mandelbulber is free software: §R.ß~-Q/M=,=5"v"]=Qf,'§"M= =,M.§ Rz]M"Kw
* you can redistribute it and/or §w "xDY.J ' -"m=====WeC=\ ""%""y=%"]"" §
* modify it under the terms of the "§M=M =D=4"N #"%==A%p M§ M6 R' #"=~.4M
* GNU General Public License as §W =, ][T"]C § § '§ e===~ U !§[Z ]N
* published by the 4M",,Jm=,"=e~ § § j]]""N BmM"py=ßM
* Free Software Foundation, ]§ T,M=& 'YmMMpM9MMM%=w=,,=MT]M m§;'§,
* either version 3 of the License, TWw [.j"5=~N[=§%=%W,T ]R,"=="Y[LFT ]N
* or (at your option) TW=,-#"%=;[ =Q:["V"" ],,M.m == ]N
* any later version. J§"mr"] ,=,," =="""J]= M"M"]==ß"
* §= "=C=4 §"eM "=B:m|4"]#F,§~
* Mandelbulber is distributed in "9w=,,]w em%wJ '"~" ,=,,ß"
* the hope that it will be useful, . "K= ,=RMMMßM"""
* 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 Mandelbulber. If not, see <http://www.gnu.org/licenses/>.
*
* ###########################################################################
*
* Authors: Krzysztof Marczak (buddhi1980@gmail.com)
*
* Widget which contains UI for effects
*/
#ifndef MANDELBULBER2_QT_DOCK_EFFECTS_H_
#define MANDELBULBER2_QT_DOCK_EFFECTS_H_
#include <QWidget>
#include "src/parameters.hpp"
// forward declarations
class cAutomatedWidgets;
namespace Ui
{
class cDockEffects;
}
class cDockEffects : public QWidget
{
Q_OBJECT
public:
explicit cDockEffects(QWidget *parent = nullptr);
~cDockEffects();
void SynchronizeInterfaceBasicFogEnabled(cParameterContainer *par) const;
void SynchronizeInterfaceDOFEnabled(cParameterContainer *par) const;
void SynchronizeInterfaceLights(cParameterContainer *par) const;
void SynchronizeInterfaceRandomLights(cParameterContainer *par) const;
double GetAuxLightManualPlacementDistance() const;
void SetAuxLightManualPlacementDistance(double dist) const;
void UpdateLabelAverageDOFSamples(const QString &avg);
void UpdateLabelAverageDOFNoise(const QString &avg);
private slots:
static void slotPressedButtonAutoFog();
void slotChangedComboAmbientOcclusionMode(int index) const;
static void slotEditedLineEditManualLightPlacementDistance(const QString &text);
static void slotPressedButtonSetDOFByMouse();
static void slotPressedButtonSetFogByMouse();
void slotPressedButtonSetLight1ByMouse() const;
static void slotPressedButtonSetLight2ByMouse();
static void slotPressedButtonSetLight3ByMouse();
static void slotPressedButtonSetLight4ByMouse();
static void slotPressedButtonUpdatePostEffects();
static void slotPressedButtonPlaceRandomLightsByMouse();
void slotChangedPlaceLightBehindObjects(int state);
private:
void ConnectSignals() const;
Ui::cDockEffects *ui;
cAutomatedWidgets *automatedWidgets;
};
#endif /* MANDELBULBER2_QT_DOCK_EFFECTS_H_ */
|
/*
* handle serial ttys
*
* Copyright (c) Paul Downey (@psd), Andrew Back (@9600) 2009
*
* http://github.com/psd/MrNo/tree/master
*
* 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/>
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libgen.h>
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include "base.h"
#include "tty.h"
struct tty_t
{
char *filename;
int fd;
useconds_t delay;
useconds_t retry;
};
/*
* assert terminal settings
*/
static int tty_stty(const char *ttyname, int fd)
{
struct termios termios;
if (verbose)
fprintf(stderr, "asserting stty settings ..\n");
if (tcgetattr(fd, &termios)) {
fprintf(stderr, "tcgetattr failed %s: %s\n", ttyname, strerror(errno));
return FAIL;
}
cfmakeraw(&termios);
/*
* assert 8 bits, no parity, one stop bit
*/
termios.c_cflag &= ~(CSIZE | PARENB);
termios.c_cflag |= (CS8 | CSTOPB);
if (cfsetospeed(&termios, B9600)) {
fprintf(stderr, "cfsetospeed failed %s: %s\n", ttyname, strerror(errno));
return FAIL;
}
if (tcsetattr(fd, TCSAFLUSH, &termios)) {
fprintf(stderr, "tcsetattr failed %s: %s\n", ttyname, strerror(errno));
return FAIL;
}
return OK;
}
/*
* open a tty, assert settings
*/
tty_t tty_open(const char *ttyname, int stty, useconds_t delay, useconds_t retry)
{
struct tty_t *tty;
int fd;
if (0 > (fd = open(ttyname, O_RDWR|O_NONBLOCK))) {
fprintf(stderr, "failed to open %s: %s\n", ttyname, strerror(errno));
return NULL;
}
if (verbose)
fprintf(stderr, "opened tty %s as %d\n", ttyname, fd);
if (stty)
if (tty_stty(ttyname, fd))
return NULL;
if (NULL == (tty = malloc(sizeof(struct tty_t)))) {
fprintf(stderr, "malloc tty failed: %s\n", strerror(errno));
return NULL;
}
tty->fd = fd;
tty->filename = strdup(ttyname);
tty->delay = delay;
tty->retry = retry;
return tty;
}
/*
* write to a tty
*/
int tty_write(tty_t p, const char *buff, int len)
{
struct tty_t *tty = p;
int i;
int n;
if (verbose)
fprintf(stderr, "%s: ", tty->filename);
if (tty->delay) {
for (i = 0; i < len; i++) {
if (1 != write(tty->fd, buff+i, 1)) {
fprintf(stderr, "write failed %s: %s\n", tty->filename, strerror(errno));
return FAIL;
}
if (verbose)
write(2, buff+i, 1);
usleep(tty->delay);
}
} else {
again:
if (len != (n = write(tty->fd, buff, len))) {
fprintf(stderr, "write %d\n", n);
switch (errno) {
case 0:
if (verbose)
fprintf(stderr, "write %s: %s\n", tty->filename, strerror(errno));
break;
case EAGAIN:
if (verbose)
fprintf(stderr, "write %s: %s\n", tty->filename, strerror(errno));
usleep(tty->retry);
goto again;
default:
fprintf(stderr, "write failed %s: %s\n", tty->filename, strerror(errno));
return FAIL;
}
}
if (verbose)
write(2, buff, len);
}
if (verbose)
write(2, "\n", 1);
return OK;
}
|
/*
* Copyright (c) 2015, Intel Corporation
*
* 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.
*/
/** \file
* \brief Acceleration: dump code.
*/
#ifndef ACCEL_DUMP_H
#define ACCEL_DUMP_H
#if defined(DUMP_SUPPORT)
#include <cstdio>
union AccelAux;
namespace ue2 {
void dumpAccelInfo(FILE *f, const AccelAux &accel);
} // namespace ue2
#endif // DUMP_SUPPORT
#endif // ACCEL_DUMP_H
|
/*
* Adyton: A Network Simulator for Opportunistic Networks
* Copyright (C) 2015 Nikolaos Papanikos, Dimitrios-Georgios Akestoridis,
* and Evangelos Papapetrou
*
* This file is part of Adyton.
*
* Adyton 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.
*
* Adyton 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 Adyton. If not, see <http://www.gnu.org/licenses/>.
*
* Written by Nikolaos Papanikos.
*/
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#ifndef MAC_H
#define MAC_H
#include "../core/MAC.h"
#endif
#ifndef PACKET_BUFFER_H
#define PACKET_BUFFER_H
#include "../core/PacketBuffer.h"
#endif
#ifndef PACKET_H
#define PACKET_H
#include "../core/Packet.h"
#endif
#ifndef STATS_H
#define STATS_H
#include "../core/Statistics.h"
#endif
#ifndef SETTINGS_H
#define SETTINGS_H
#include "../core/Settings.h"
#endif
#ifndef GOD_H
#define GOD_H
#include "../core/God.h"
#endif
#ifndef DELETION_MECHANISMS_H
#define DELETION_MECHANISMS_H
#include "../deletion-mechanisms/DeletionMechanisms.h"
#endif
#ifndef SCHEDULING_POLICIES_H
#define SCHEDULING_POLICIES_H
#include "../scheduling-policies/SchedulingPolicies.h"
#endif
#ifndef CONGESTION_MECHANISMS_H
#define CONGESTION_MECHANISMS_H
#include "../congestion-control/CongestionControlMechanisms.h"
#endif
class Routing
{
public:
Routing(PacketPool *PP,MAC *mc,PacketBuffer *Bf,int NID,Statistics *St,Settings *S,God *G);
virtual ~Routing();
virtual void recv(double rTime,int pktID)=0;
virtual void NewContact(double CTime,int NID)=0;
virtual void ContactRemoved(double CTime,int NID)=0;
virtual void Contact(double CTime,int NID)=0;
virtual void Finalize(void);
virtual void NoCostRecv(PacketPool *PP,MAC *mc,PacketBuffer *Bf,int NID,Statistics *St,Settings *S);
protected:
PacketPool *pktPool;
MAC *Mlayer;
PacketBuffer *Buf;
Statistics *Stat;
int NodeID;
God *SimGod;
DeletionMechanism *DM;
Settings *Set;
SchedulingPolicy *sch;
CongestionControl *CC;
bool NCenabled;
virtual void ReceptionAntipacket(Header *hd,Packet *pkt,int PID,double CurrentTime);
virtual void ReceptionAntipacketResponse(Header *hd,Packet *pkt,int PID,double CurrentTime);
virtual void SendDirectPackets(double CTime,int NID);
virtual void SendVaccine(double CTime,int NID,int *info);
virtual void SendDirectSummary(double CTime,int NID);
virtual void AfterDirectTransfers(double CTime,int NID);
virtual void ReceptionDirectSummary(Header *hd,Packet *pkt,int PID,double CurrentTime);
virtual void ReceptionDirectRequest(Header *hd,Packet *pkt,int PID,double CurrentTime);
virtual void SendPacket(double STime, int pktID,int nHop,int RepValue);
virtual void SendBufferReq(double CTime,int NID);
virtual void ReceptionBufferReq(Header *hd,Packet *pkt,int PID,double CurrentTime);
virtual void ReceptionBufferRsp(Header *hd,Packet *pkt,int PID,double CurrentTime);
};
|
#ifndef MultispeciesCoalescentMigrationODE_H
#define MultispeciesCoalescentMigrationODE_H
#include "AbstractBirthDeathProcess.h"
#include "RateMatrix.h"
#include <vector>
namespace RevBayesCore {
/**
* @brief Multispecies-coalescent-migration ODE.
*
*
* This class represents the ordinary differential equations for the
* multispecies-coalescent-migration model.
* Sebastian Hoehna 8/11/17
*
*/
class MultispeciesCoalescentMigrationODE {
public:
MultispeciesCoalescentMigrationODE( const std::vector<double> &t, const RateGenerator* q, double r, size_t n_ind, size_t n_pop);
void operator() ( const std::vector< double > &x, std::vector< double > &dxdt , const double t );
private:
std::vector<double> theta; //!< vector of population sizes
size_t num_individuals; //!< the number of individuals
size_t num_populations; //!< the number of individuals
const RateGenerator* Q; //!< migration rate matrix
double rate; //!< clock rate for migration rates
};
}
#endif
|
#ifndef __AFC_VM_RETURN_EXPRESSION_H__
#define __AFC_VM_RETURN_EXPRESSION_H__
#include "../public/vm.h"
namespace afc {
namespace vm {
class Compilation;
class Expression;
unique_ptr<Expression> NewReturnExpression(Compilation* compilation,
unique_ptr<Expression> expr);
} // namespace vm
} // namespace afc
#endif // __AFC_VM_RETURN_EXPRESSION_H__
|
#pragma once
#include <tstring.h>
#include <matrix.h>
#include <toys/toy_util.h>
class CConversionScene;
class CConversionMeshInstance;
class CConversionSceneNode;
class CGeppetto
{
public:
CGeppetto(bool bForce=false, const tstring& sCWD="");
public:
bool BuildFiles(const tstring& sOutput, const tstring& sInput, const tstring& sPhysics="", bool bGlobalTransforms = false);
bool BuildFromInputScript(const tstring& sScript);
void LoadFromFiles(const tstring& sMesh, const tstring& sPhysics);
void LoadMeshInstanceIntoToy(CConversionScene* pScene, CConversionMeshInstance* pMeshInstance, const Matrix4x4& mParentTransformations, CToyUtil* pToy);
void LoadSceneNodeIntoToy(CConversionScene* pScene, CConversionSceneNode* pNode, const Matrix4x4& mParentTransformations, CToyUtil* pToy);
void LoadSceneIntoToy(CConversionScene* pScene, CToyUtil* pToy);
void LoadMeshInstanceIntoToyPhysics(CConversionScene* pScene, CConversionMeshInstance* pMeshInstance, const Matrix4x4& mParentTransformations, CToyUtil* pToy);
void LoadSceneNodeIntoToyPhysics(CConversionScene* pScene, CConversionSceneNode* pNode, const Matrix4x4& mParentTransformations, CToyUtil* pToy);
void LoadSceneIntoToyPhysics(CConversionScene* pScene, CToyUtil* pToy);
bool LoadSceneAreas(class CData* pData);
tstring GetPath(const tstring& sPath);
protected:
bool Compile();
private:
CToyUtil t;
tstring m_sOutput;
time_t m_iBinaryModificationTime;
bool m_bForceCompile;
tstring m_sCWD;
};
|
// channelAssistant.h : PROJECT_NAME Ó¦ÓóÌÐòµÄÖ÷Í·Îļþ
//
#pragma once
#ifndef __AFXWIN_H__
#error "ÔÚ°üº¬´ËÎļþ֮ǰ°üº¬¡°stdafx.h¡±ÒÔÉú³É PCH Îļþ"
#endif
#include "vgChanresource.h" // Ö÷·ûºÅ
// CchannelAssistantApp:
// ÓйشËÀàµÄʵÏÖ£¬Çë²ÎÔÄ channelAssistant.cpp
//
class CchannelAssistantApp : public CWinApp
{
public:
CchannelAssistantApp();
// ÖØÐ´
public:
virtual BOOL InitInstance();
// ʵÏÖ
DECLARE_MESSAGE_MAP()
};
extern CchannelAssistantApp theApp; |
/*
* WAX Device Driver
*
* (c) Copyright 2000 The Puffin Group Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* by Helge Deller <deller@gmx.de>
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/types.h>
#include <asm/io.h>
#include <asm/hardware.h>
#include "gsc.h"
#define WAX_GSC_IRQ 7 /* Hardcoded Interrupt for GSC */
static void wax_choose_irq(struct parisc_device *dev, void *ctrl)
{
int irq;
switch (dev->id.sversion)
{
case 0x73: irq = 1; break; /* i8042 General */
case 0x8c: irq = 6; break; /* Serial */
case 0x90: irq = 10; break; /* EISA */
default: return; /* Unknown */
}
gsc_asic_assign_irq(ctrl, irq, &dev->irq);
switch (dev->id.sversion)
{
case 0x73: irq = 2; break; /* i8042 High-priority */
case 0x90: irq = 0; break; /* EISA NMI */
default: return; /* No secondary IRQ */
}
gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
}
static void __init
wax_init_irq(struct gsc_asic *wax)
{
unsigned long base = wax->hpa;
/* Wax-off */
gsc_writel(0x00000000, base + OFFSET_IMR);
/* clear pending interrupts */
gsc_readl(base + OFFSET_IRR);
/* We're not really convinced we want to reset the onboard
* devices. Firmware does it for us...
*/
/* Resets */
// gsc_writel(0xFFFFFFFF, base+0x1000); /* HIL */
// gsc_writel(0xFFFFFFFF, base+0x2000); /* RS232-B on Wax */
}
static int __init wax_init_chip(struct parisc_device *dev)
{
struct gsc_asic *wax;
struct parisc_device *parent;
struct gsc_irq gsc_irq;
int ret;
wax = kzalloc(sizeof(*wax), GFP_KERNEL);
if (!wax)
{
return -ENOMEM;
}
wax->name = "wax";
wax->hpa = dev->hpa.start;
wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
/* Stop wax hissing for a bit */
wax_init_irq(wax);
/* the IRQ wax should use */
dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ);
if (dev->irq < 0)
{
printk(KERN_ERR "%s(): cannot get GSC irq\n",
__func__);
kfree(wax);
return -EBUSY;
}
wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax);
if (ret < 0)
{
kfree(wax);
return ret;
}
/* enable IRQ's for devices below WAX */
gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
/* Done init'ing, register this driver */
ret = gsc_common_setup(dev, wax);
if (ret)
{
kfree(wax);
return ret;
}
gsc_fixup_irqs(dev, wax, wax_choose_irq);
/* On 715-class machines, Wax EISA is a sibling of Wax, not a child. */
parent = parisc_parent(dev);
if (parent->id.hw_type != HPHW_IOA)
{
gsc_fixup_irqs(parent, wax, wax_choose_irq);
}
return ret;
}
static struct parisc_device_id wax_tbl[] =
{
{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008e },
{ 0, }
};
MODULE_DEVICE_TABLE(parisc, wax_tbl);
struct parisc_driver wax_driver =
{
.name = "wax",
.id_table = wax_tbl,
.probe = wax_init_chip,
};
|
/*
WDL - scsrc.h
Copyright (C) 2007, Cockos Incorporated
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
This file provides for an object to source a SHOUTcast (www.shoutcast.com) stream.
It uses the lameencdec.h interface (and lame_enc.dll) to encode, and JNetLib to send the data.
This object will not auto-reconnect on disconnect. If GetStatus() returns error, the callee needs to
delete the object and create a new one.
*/
#ifndef _WDL_SCSRC_H_
#define _WDL_SCSRC_H_
#include <time.h>
#include "jnetlib/connection.h"
#include "jnetlib/httpget.h"
#include "lameencdec.h"
#include "wdlstring.h"
#include "fastqueue.h"
#include "queue.h"
#include "mutex.h"
#include "resample.h"
class WDL_ShoutcastSource
{
public:
WDL_ShoutcastSource(const char *host, const char *pass, const char *name, bool pub=false,
const char *genre=NULL, const char *url=NULL,
int nch=2, int srate=44100, int kbps=128,
const char *ircchan=NULL
);
~WDL_ShoutcastSource();
int GetStatus(); // returns 0 if connected/connecting, >0 if disconnected, -1 if failed connect (or other error) from the start
void GetStatusText(char *buf, int bufsz); // gets status text
void SetCurTitle(const char *title);
int GetSampleRate() { return m_srate; }
void OnSamples(float **samples, int nch, int chspread, int frames, double srate);
int RunStuff(); // returns nonzero if work done
void *userData;
int totalBitrate; // 0 for normal, otherwise if using NSV (below) set to kbps of total stream
// allows hooking to say, I dunno, package in some other format such as NSV?
void (*sendProcessor)(void *userData, WDL_Queue *dataout, WDL_Queue *data);
int GetAudioBitrate() { return m_br*1000; }
private:
WDL_Queue m_procdata;
LameEncoder *m_encoder;
int m_encoder_splsin;
WDL_String m_host,m_pass,m_url,m_genre,m_name,m_ircchan;
int m_br;
bool m_pub;
time_t m_titlecon_start,m_sendcon_start;
unsigned int m_bytesout;
int m_state;
int m_nch,m_srate;
WDL_Resampler m_rs;
WDL_FastQueue m_samplequeue; // interleaved samples (float)
JNL_HTTPGet *m_titlecon;
JNL_Connection *m_sendcon;
WDL_TypedBuf<float> m_workbuf;
WDL_Mutex m_samplemutex;
WDL_Mutex m_titlemutex;
char m_title[512];
bool m_needtitle;
bool m_is_postmode;
unsigned int m_postmode_session;
int m_post_bytesleft;
int m_post_postsleft;
void PostModeConnect();
};
#endif // _WDL_SCSRC_H_ |
/*
* Copyright (C) 2009 Niek Linnenbank
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FILESYSTEM_LINN_FILE_H
#define __FILESYSTEM_LINN_FILE_H
#ifndef __HOST__
#include <File.h>
#include <FileSystemMessage.h>
#include <Types.h>
#include "LinnFileSystem.h"
#include "LinnInode.h"
#include "IOBuffer.h"
#include <errno.h>
/**
* @defgroup linn LinnFS (Linnenbank Filesystem)
* @{
*/
/**
* Represents a file on a mounted LinnFS filesystem.
*/
class LinnFile : public File
{
public:
/**
* Constructor function.
* @param fs LinnFS filesystem pointer.
* @param inode Inode pointer.
*/
LinnFile(LinnFileSystem *fs, LinnInode *inode);
/**
* Destructor function.
*/
~LinnFile();
/**
* @brief Read out the file.
*
* @param buffer Input/Output buffer to write bytes to.
* @param size Number of bytes to copy at maximum.
* @param offset Offset in the file to start reading.
* @return Number of bytes read, or Error number.
*
* @see IOBuffer
*/
Error read(IOBuffer *buffer, Size size, Size offset);
private:
/** Filesystem pointer. */
LinnFileSystem *fs;
/** Inode pointer. */
LinnInode *inode;
};
/**
* @}
*/
#endif /* __HOST__ */
#endif /* __FILESYSTEM_LINN_FILE_H */
|
#ifndef _WRITER_H_
#define _WRITER_H_
void write_to_vhd();
#endif
|
//
// test_thread_pool.cpp
//
// Created by Jonathan Tompson on 7/10/12.
//
// There's a lot of code borrowed from Prof Alberto Lerner's code repository
// (I took his distributed computing class, which was amazing), particularly
// the test unit stuff.
#include <stdlib.h> // exit
#include <thread>
#include <sstream>
#include "test_unit/test_unit.h"
#include "test_unit/test_util.h"
#include "jtil/threading/thread.h"
#include "jtil/threading/callback.h"
#include "jtil/threading/thread_pool.h"
#define NUM_WORKERS 4 // Should be as many as the number of avaliable cores
#define NUM_TASK_REQUESTS 1001 // A non-trivial number
#define COUNT_STRIDE 11
#define NUM_TEST_REPEATS 11
using jtil::threading::ThreadPool;
using tests::CounterThreadSafe;
using jtil::threading::Callback;
using jtil::threading::MakeCallableOnce;
using jtil::threading::MakeCallableMany;
// Create a thread pool, add one task and then request a stop
TEST(ThreadPool, CreateAddOnceAndStop) {
ThreadPool tp(NUM_WORKERS);
CounterThreadSafe c;
// Create the callback associated with counter increments and add the task
Callback<void>* threadBody = MakeCallableOnce(&CounterThreadSafe::incBy, &c,
COUNT_STRIDE);
tp.addTask(threadBody);
// Wait until the task has been sent for execution
while (tp.count()>0) {
std::this_thread::yield();
}
// Request a stop (which will return once the task has finished)
tp.stop();
// Make sure the thread ran:
// a) There should be no waiting tasks left (since we waited for tp.count=0)
EXPECT_EQ(tp.count(), 0);
// b) The counter should have incremented.
EXPECT_EQ(c.count(), COUNT_STRIDE);
}
// Create a thread pool, add many tasks (similar to before but more of them),
// and make sure we're adding tasks with different methods.
TEST(ThreadPool, CreateAddManyAndStop) {
CounterThreadSafe c;
// Repeat the test many times, each time with a new TP. This will catch any
// race conditions that might happen between the stop thread and destructor.
for (int i = 0; i < NUM_TEST_REPEATS; i ++) {
ThreadPool* tp = new ThreadPool(NUM_WORKERS);
// Create the callback associated with one counter increment and add it
Callback<void>* threadBodyInc = MakeCallableMany(&CounterThreadSafe::incBy,
&c, COUNT_STRIDE);
Callback<void>* threadBody = MakeCallableMany(&CounterThreadSafe::inc, &c);
for ( int i = 0; i < NUM_TASK_REQUESTS; i ++)
tp->addTask(threadBodyInc);
for ( int i = 0; i < NUM_TASK_REQUESTS; i ++)
tp->addTask(threadBody);
// Request a stop by placing a stop request on the queue (to check that
// recursive stops aren't an issue)
Callback<void>* p_StopTask = MakeCallableOnce(&ThreadPool::stop,
tp);
tp->addTask(p_StopTask);
// Wait until the tasks are sent for execution (including stop task)
while (tp->count()>0) {
std::this_thread::yield();
}
// Make sure the thread ran:
// a) There should be no waiting tasks left (since we waited for tp.count=0)
EXPECT_EQ(tp->count(), 0);
// Note: There is an important test here: Destructor may be called before
// stop task has finished.
delete tp; // destructor will wait for stop to finish
// Since we created the tasks with MakeCallableMany we need to delete them
delete threadBodyInc;
delete threadBody;
// b) The counter should have incremented
EXPECT_EQ(c.count(), (COUNT_STRIDE + 1) * NUM_TASK_REQUESTS);
c.reset();
}
}
// Create a thread pool, request a stop, then add tasks and make sure they
// don't execute
TEST(ThreadPool, CreateAfterStopped) {
ThreadPool tp(NUM_WORKERS);
CounterThreadSafe c;
tp.stop();
// Create the callback associated with one counter increment and add the task
Callback<void>* threadBody = MakeCallableOnce(&CounterThreadSafe::incBy, &c,
COUNT_STRIDE);
tp.addTask(threadBody);
// We want to test that threadBody isn't executed. Try yielding this thread
// a few times to make sure that we give the TP enough time to make a mistake.
for (int i = 0; i < 101; i ++) {
std::this_thread::yield();
}
// Make sure the thread DIDN'T run:
// a) There should be no waiting tasks left
EXPECT_EQ(tp.count(), 1);
// b) The counter shouldn't have incremented.
EXPECT_EQ(c.count(), 0);
}
#include "test_thread_pool_lerner.h"
|
/* error.c - Error handling
Copyright (C) 2000, 2001 Thomas Moestl
Copyright (C) 2003, 2004, 2005, 2011 Paul A. Rombouts
This file is part of the pdnsd package.
pdnsd 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.
pdnsd 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 pdnsd; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
#ifndef WIN32
#include <syslog.h>
#else
#include "event.h"
#endif
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include "error.h"
#include "helpers.h"
#include "conff.h"
pthread_mutex_t loglock = PTHREAD_MUTEX_INITIALIZER;
volatile short int use_log_lock=0;
/*
* Initialize a mutex for io-locking in order not to produce gibberish on
* multiple simultaneous errors.
*/
/* This is now defined as an inline function in error.h */
#if 0
void init_log_lock(void)
{
use_log_lock=1;
}
#endif
/* We crashed? Ooops... */
void crash_msg(char *msg)
{
log_error("%s", msg);
log_error("pdnsd probably crashed due to a bug. Please consider sending a bug");
log_error("report to p.a.rombouts@home.nl or tmoestl@gmx.net");
}
/* Log a warning, error or info message.
* If we are a daemon, use the syslog. s is a format string like in printf,
* the optional following arguments are the arguments like in printf */
void log_message(int prior, const char *s, ...)
{
int gotlock=0;
va_list va;
FILE *f;
#ifdef WIN32
CHAR buf[1024];
WORD eventType;
LPTSTR pInsertStrings[1] = {NULL};
#endif
if (use_log_lock) {
gotlock=softlock_mutex(&loglock);
/* If we failed to get the lock and the type of the
message is "info" or less important, then don't bother. */
if(!gotlock && prior>=LOG_INFO)
return;
}
if (global.daemon) {
#ifdef WIN32
HANDLE hEventLog = RegisterEventSource(NULL, TEXT("pdnsd"));
#else
openlog("pdnsd",LOG_PID,LOG_DAEMON);
#endif
va_start(va,s);
#ifdef WIN32
switch (prior&LOG_PRIMASK)
{
case LOG_EMERG:
case LOG_ALERT:
case LOG_CRIT:
case LOG_ERR:
eventType = EVENTLOG_ERROR_TYPE;
break;
case LOG_WARNING:
eventType = EVENTLOG_WARNING_TYPE;
break;
case LOG_NOTICE:
case LOG_INFO:
case LOG_DEBUG:
default:
eventType = EVENTLOG_INFORMATION_TYPE;
break;
}
vsprintf(buf,s,va);
ReportEvent(hEventLog,
eventType,
0, /* category */
LOG_MESSAGE, /* event ID */
NULL, /* user ID */
1, /* number of strings */
0, /* binary data size */
(LPCTSTR*)pInsertStrings, /* error string */
NULL /* binary data */
);
#else
vsyslog(prior,s,va);
#endif
va_end(va);
#ifdef WIN32
DeregisterEventSource(hEventLog);
#else
closelog();
#endif
}
else {
f=stderr;
#if DEBUG > 0
goto printtofile;
}
if(debug_p) {
f=dbg_file;
printtofile:
#endif
{
char ts[sizeof "* 12/31 23:59:59| "];
time_t tt = time(NULL);
struct tm tm;
if(!localtime_r(&tt, &tm) || strftime(ts, sizeof(ts), "* %m/%d %T| ", &tm) <=0)
ts[0]=0;
fprintf(f,"%spdnsd: %s: ", ts,
prior<=LOG_CRIT?"critical":
prior==LOG_ERR?"error":
prior==LOG_WARNING?"warning":
"info");
}
va_start(va,s);
vfprintf(f,s,va);
va_end(va);
{
const char *p=strchr(s,0);
if(!p || p==s || *(p-1)!='\n')
fputc('\n',f);
}
}
if (gotlock)
pthread_mutex_unlock(&loglock);
}
#if DEBUG > 0
/* XXX: The timestamp generation makes this a little heavy-weight */
void debug_msg(int c, const char *fmt, ...)
{
va_list va;
if (!c) {
char ts[sizeof "12/31 23:59:59"];
time_t tt = time(NULL);
struct tm tm;
unsigned *id;
if(localtime_r(&tt, &tm) && strftime(ts, sizeof(ts), "%m/%d %T", &tm) > 0) {
if((id = (unsigned *)pthread_getspecific(thrid_key)))
fprintf(dbg_file,"%u %s| ", *id, ts);
else
fprintf(dbg_file,"- %s| ", ts);
}
}
va_start(va,fmt);
vfprintf(dbg_file,fmt,va);
va_end(va);
fflush(dbg_file);
}
#endif /* DEBUG */
|
/*----------------------------------------------------------------------------
* spp2pgs - Generates BluRay PG Stream from Subtitles or AviSynth scripts
* by Giton Xu <adm@subelf.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 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/>.
*----------------------------------------------------------------------------*/
#pragma once
#include "StillImage.h"
#include "FrameStreamAdvisor.h"
#include "GraphicalTypes.h"
#include "FrameStream.h"
namespace spp2pgs
{
class BgraFrame
:public StillImage
{
public:
static int const PixelSize = 4;
BgraFrame(Size frameSize);
int ReadNextOf(FrameStream * stream);
inline int GetFrameIndex() const { return this->index; }
bool IsIdenticalTo(BgraFrame *frame);
bool IsBlank();
~BgraFrame();
protected:
bool IsExplicitIdenticalTo(StillImage const *image) const override;
bool IsExplicitBlank() const override;
void ExplicitEraseTransparents() const override;
void ExplicitErase(Rect rect) const override;
private:
FrameStreamAdvisor const * advisor;
int index;
};
} |
#include "mylist.h"
/* traverse_char.c
pre: takes a t_node*
post: posts every char contained within the nodes in the linked list pointed to by the t_node*
*/
void traverse_char(t_node* node){
if(node){
if(node->elem)
my_char(*((char*)node->elem));
else
my_str("NULL");
node = node->next;
for(; node; node = node->next){
my_char(' ');
if(node->elem)
my_char(*((char*)node->elem));
else
my_str("NULL");
}
}
}
|
/* to compile this, your MIKENET_DIR environment variable
must be set to the appropriate directory. putting this
at the bottom of your .cshrc file will do the trick:
setenv MIKENET_DIR ~mharm/mikenet/default/
This demo program solves the xor problem.
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#ifdef unix
#include <unistd.h>
#endif
#include <mikenet/simulator.h>
#include "simconfig.h"
#include "model.h"
#include "hearing.h"
#include "reading.h"
#define REP 100
#define ITER 10000000
char feature[3000][100];
float compute_sem_error(Example *ex)
{
float e=0.0,e1;
int i,j;
for(i=0;i<semantics->numUnits;i++)
{
e1 = fabs(semantics->outputs[SAMPLES-1][i] -
get_value(ex->targets,semantics->index,SAMPLES-1,i));
e += e1*e1;
}
return e;
}
void get_name(char *tag, char *name)
{
char *p;
p=strstr(tag,"Word:");
p+= 5;
p=strtok(p," \t\n");
strcpy(name,p);
}
int main(int argc,char *argv[])
{
float clamp=0.01;
float o;
float v;
Real sse,e;
int tai=0,on;
FILE *f;
char name[255];
float time=SECONDS;
int wrongs=0,wrong=0,wrongtot;
char weightFile[4000];
int reset=1;
int j;
ExampleSet *examples;
Example *ex;
int i,count;
Real error;
Real epsilon,range;
int runfor=SAMPLES,junk;
#ifdef BLAS
default_useBlas=1;
fprintf(stderr,"Using blas!\n");
#else
default_useBlas=0;
fprintf(stderr,"NOT using blas!\n");
#endif
announce_version();
strcpy(default_compressor,"/usr/bin/gzip");
strcpy(default_decompressor,"/usr/bin/gunzip");
/* don't buffer output */
setbuf(stdout,NULL);
/* set random number seed to process id
(only unix machines have getpid call) */
mikenet_set_seed(555);
/* a default learning rate */
epsilon=0.001;
/* default weight range */
range=0.01;
/* what are the command line arguments? */
for(i=1;i<argc;i++)
{
if (strcmp(argv[i],"-seed")==0)
{
mikenet_set_seed(atol(argv[i+1]));
i++;
}
else if (strncmp(argv[i],"-epsilon",5)==0)
{
epsilon=atof(argv[i+1]);
i++;
}
else if (strncmp(argv[i],"-noreset",5)==0)
{
reset=0;
}
else if (strncmp(argv[i],"-clamp",5)==0)
{
clamp=atof(argv[i+1]);
i++;
}
else if (strcmp(argv[i],"-tai")==0)
{
tai=1;
}
else if (strncmp(argv[i],"-runfor",5)==0)
{
runfor=atoi(argv[i+1]);
i++;
}
else if (strncmp(argv[i],"-time",5)==0)
{
time=atoi(argv[i+1]);
i++;
}
else if (strcmp(argv[i],"-range")==0)
{
range=atof(argv[i+1]);
i++;
}
else if ((strncmp(argv[i],"-weight",5)==0) ||
(strncmp(argv[i],"-load",5)==0))
{
strcpy(weightFile,argv[i+1]);
i++;
}
else if (strcmp(argv[i],"-errorRadius")==0)
{
default_errorRadius=atof(argv[i+1]);
i++;
}
else
{
fprintf(stderr,"unknown argument: %s\n",argv[i]);
exit(-1);
}
}
default_softClampThresh=clamp;
default_errorRamp=RAMP_ERROR;
build_hearing_model(runfor,0.1,0.1,-3.0,-3.0);
hearing->integrationConstant=(float)time/(float)hearing->runfor;
examples=load_examples("ps.pat",runfor);
error=0.0;
count=1;
wrongs=0;
wrongtot=0;
precompute_topology(hearing,phonology);
/* loop for ITER number of times */
for(i=0;i<=150;i++)
{
/* get j'th example from exampleset */
ex=&examples->examples[(i*25)%(examples->numExamples-1)];
crbp_forward(hearing,ex);
sse = compute_sem_error(ex);
/* crbp_compute_gradients(hearing,ex);
crbp_apply_deltas(hearing); */
if (i % 10 ==0)
printf("%d sse %f\n",i,sse);
}
return 0;
}
|
#define VEC_ADD_LEN 369
#define VEC_ADD_POS 252
#define VEC_ADD_HALF_POS 263
#define VEC_ADD_HALF_IMPROVED_POS 285
#define VEC_ADD_BYTE_POS 306
#define VEC_ADD_BYTE_IMPROVED_POS 327
#define ADD_FLOAT_POS 358
|
#ifndef SOUND_PROCESSOR_SHORTCUTS_H
#define SOUND_PROCESSOR_SHORTCUTS_H
#ifndef PROCESSOR
#error "PROCESSOR identifier is not defined"
#endif
#define PROPERTY(a_type, a_name, a_value) \
SOUND_REGISTER_PROPERTY(PROCESSOR, a_type, a_name, a_value)
#define PARAMETER(a_type, a_name, a_value) \
SOUND_REGISTER_PARAMETER(PROCESSOR, a_type, a_name, a_value)
#define COMMAND(a_command) \
SOUND_REGISTER_COMMAND(PROCESSOR, a_command)
#define INSTANTIATE \
SOUND_INSTANTIATE(Sound::Processor::PROCESSOR)
#define INITIALIZE \
this->initVectors( \
Command::PROCESSOR::_End, \
Parameter::PROCESSOR::_End, \
Property::PROCESSOR::_End);
#endif // SOUND_PROCESSOR_SHORTCUTS_H
|
#ifndef ANTIDOS_H
#define ANTIDOS_H
#include <QWidget>
#include <QHash>
#include <ctime>
#include <QTimer>
class QSpinBox;
class QLineEdit;
class QCheckBox;
class AntiDosWindow : public QWidget
{
Q_OBJECT
public:
AntiDosWindow();
public slots:
void apply();
private:
QSpinBox *max_people_per_ip, *max_commands_per_user, *max_kb_per_user, *max_login_per_ip, *ban_after_x_kicks;
QLineEdit *trusted_ips, *notificationsChannel;
QCheckBox *aDosOn;
};
/* A class to detect flood and ban DoSing IPs */
class AntiDos : public QObject
{
Q_OBJECT
friend class AntiDosWindow;
friend class ScriptEngine;
public:
AntiDos();
static AntiDos * obj() {
return instance;
}
/* Returns true if an ip is allowed a new connection */
bool connecting(const QString &ip);
/* Warned that a new command is issued, with what length */
bool transferBegin(int id, int length, const QString &ip);
/* Warned that a player/IP disconnected */
void disconnect(const QString &ip, int id);
/* Changes the shows IP of the proxy using player */
bool changeIP(const QString &newIp, const QString &oldIp);
int numberOfDiffIps();
QString notificationsChannel;
signals:
/* If rules are infriged, kick / ban the corresponding id/ip in functions
of the number of times rules are infriged */
void kick(int id);
void ban(const QString &ip);
public slots:
/* Reloads all DOS data */
void init();
protected slots:
void clearData();
private:
QHash<QString, int> connectionsPerIp;
QHash<QString, QList<time_t> > loginsPerIp;
QHash<int, QList<QPair<time_t, size_t> > > transfersPerId;
QHash<int, size_t> sizeOfTransfers;
QHash<QString, QList<time_t> > kicksPerIp;
QTimer timer;
static AntiDos *instance;
QStringList trusted_ips;
int max_people_per_ip, max_commands_per_user, max_kb_per_user, max_login_per_ip, ban_after_x_kicks;
bool on;
void addKick(const QString &ip);
};
#endif // ANTIDOS_H
|
/*
* gnome-keyring
*
* Copyright (C) 2008 Stefan Walter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 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
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include "gkd-secret-dispatch.h"
#include "gkd-secret-secret.h"
#include "gkd-secret-service.h"
#include "gkd-secret-session.h"
#include "egg/egg-secure-memory.h"
#include <glib-object.h>
#include <string.h>
static void
destroy_with_owned_memory (gpointer data)
{
GkdSecretSecret *secret = data;
g_free (secret->parameter);
g_free (secret->value);
}
GkdSecretSecret*
gkd_secret_secret_new_take_memory (GkdSecretSession *session,
gpointer parameter, gsize n_parameter,
gpointer value, gsize n_value)
{
GkdSecretSecret *secret;
g_return_val_if_fail (GKD_SECRET_IS_SESSION (session), NULL);
secret = g_slice_new0 (GkdSecretSecret);
secret->session = g_object_ref (session);
secret->parameter = parameter;
secret->n_parameter = n_parameter;
secret->value = value;
secret->n_value = n_value;
secret->destroy_func = destroy_with_owned_memory;
secret->destroy_data = secret;
return secret;
}
GkdSecretSecret*
gkd_secret_secret_parse (GkdSecretService *service, DBusMessage *message,
DBusMessageIter *iter, DBusError *derr)
{
GkdSecretSecret *secret;
GkdSecretSession *session;
DBusMessageIter struc, array;
void *parameter, *value;
int n_value, n_parameter;
char *path;
g_return_val_if_fail (GKD_SECRET_IS_SERVICE (service), NULL);
g_return_val_if_fail (message, NULL);
g_return_val_if_fail (iter, NULL);
g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRUCT, NULL);
dbus_message_iter_recurse (iter, &struc);
/* Get the path */
if (dbus_message_iter_get_arg_type (&struc) != DBUS_TYPE_OBJECT_PATH) {
dbus_set_error (derr, DBUS_ERROR_INVALID_ARGS, "Invalid secret argument");
return NULL;
}
dbus_message_iter_get_basic (&struc, &path);
/* Get the parameter */
if (!dbus_message_iter_next (&struc) ||
dbus_message_iter_get_arg_type (&struc) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&struc) != DBUS_TYPE_BYTE) {
dbus_set_error (derr, DBUS_ERROR_INVALID_ARGS, "Invalid secret argument");
return NULL;
}
dbus_message_iter_recurse (&struc, &array);
dbus_message_iter_get_fixed_array (&array, ¶meter, &n_parameter);
/* Get the value */
if (!dbus_message_iter_next (&struc) ||
dbus_message_iter_get_arg_type (&struc) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&struc) != DBUS_TYPE_BYTE) {
dbus_set_error (derr, DBUS_ERROR_INVALID_ARGS, "Invalid secret argument");
return NULL;
}
dbus_message_iter_recurse (&struc, &array);
dbus_message_iter_get_fixed_array (&array, &value, &n_value);
/* Try to lookup the session */
session = gkd_secret_service_lookup_session (service, path,
dbus_message_get_sender (message));
if (session == NULL) {
dbus_set_error (derr, SECRET_ERROR_NO_SESSION,
"The session wrapping the secret does not exist");
return NULL;
}
secret = g_slice_new0 (GkdSecretSecret);
secret->session = g_object_ref (session);
secret->parameter = parameter;
secret->n_parameter = n_parameter;
secret->value = value;
secret->n_value = n_value;
/* All the memory is owned by the message */
secret->destroy_data = dbus_message_ref (message);
secret->destroy_func = (GDestroyNotify)dbus_message_unref;
return secret;
}
void
gkd_secret_secret_append (GkdSecretSecret *secret, DBusMessageIter *iter)
{
DBusMessageIter struc, array;
const gchar *path;
int length;
path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (secret->session));
g_return_if_fail (path);
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL, &struc);
dbus_message_iter_append_basic (&struc, DBUS_TYPE_OBJECT_PATH, &path);
dbus_message_iter_open_container (&struc, DBUS_TYPE_ARRAY, "y", &array);
length = secret->n_parameter;
dbus_message_iter_append_fixed_array (&array, DBUS_TYPE_BYTE, &(secret->parameter), length);
dbus_message_iter_close_container (&struc, &array);
dbus_message_iter_open_container (&struc, DBUS_TYPE_ARRAY, "y", &array);
length = secret->n_value;
dbus_message_iter_append_fixed_array (&array, DBUS_TYPE_BYTE, &(secret->value), length);
dbus_message_iter_close_container (&struc, &array);
dbus_message_iter_close_container (iter, &struc);
}
void
gkd_secret_secret_free (gpointer data)
{
GkdSecretSecret *secret;
if (!data)
return;
secret = data;
/*
* These are not usually actual plain text secrets. However in
* the case that they are, we want to clear them from memory.
*
* This is not foolproof in any way. If they're plaintext, they would
* have been sent over DBus, and through all sorts of processes.
*/
egg_secure_clear (secret->parameter, secret->n_parameter);
egg_secure_clear (secret->value, secret->n_value);
g_object_unref (secret->session);
/* Call the destructor of memory */
if (secret->destroy_func)
(secret->destroy_func) (secret->destroy_data);
g_slice_free (GkdSecretSecret, secret);
}
|
//
// ExtendedShowInformationController.h
// Get_iPlayer GUI
//
// Created by Thomas Willson on 8/7/14.
//
//
#import <Foundation/Foundation.h>
#import "Programme.h"
@interface ExtendedShowInformationController : NSObject {
IBOutlet NSTableView *searchResultsTable;
IBOutlet NSArrayController *searchResultsArrayController;
IBOutlet NSProgressIndicator *retrievingInfoIndicator;
IBOutlet NSTextField *loadingLabel;
IBOutlet NSView *loadingView;
IBOutlet NSView *infoView;
IBOutlet NSPopover *popover;
IBOutlet NSImageView *imageView;
IBOutlet NSTextField *seriesNameField;
IBOutlet NSTextField *episodeNameField;
IBOutlet NSTextField *numbersField;
IBOutlet NSTextField *durationField;
IBOutlet NSTextField *categoriesField;
IBOutlet NSTextField *firstBroadcastField;
IBOutlet NSTextField *lastBroadcastField;
IBOutlet NSTextView *descriptionView;
IBOutlet NSDictionaryController *modeSizeController;
IBOutlet NSTextField *typeField;
}
@end
|
/* Parabench - A parallel file system benchmark
* Copyright (C) 2009-2010 Dennis Runz
* University of Heidelberg
*
* 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/>.
*/
#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <glib.h>
#include <glib/gprintf.h>
void _log(const gchar* prefix, const gchar* message, ...)
{
/* format message */
gchar buffer[255];
va_list args;
va_start(args, message);
vsprintf(buffer, message, args);
va_end(args);
/* get current time of day */
gchar* time = time_str();
g_printf("[%d / %s] %s%s\n", rank, time, prefix, buffer);
g_free(time);
}
void _error(const gchar* message, ...)
{
/* format message */
gchar buffer[255];
va_list args;
va_start(args, message);
vsprintf(buffer, message, args);
va_end(args);
_log("Runtime Error: ", buffer);
#ifdef HAVE_MPI
MPI_Abort(MPI_COMM_WORLD, -1);
#else
exit(-1);
#endif
}
#ifdef HAVE_MPI
void ErrorMPI(gchar* location, gint error_code, gboolean quit)
{
char error_string[BUFSIZ];
gint length_of_error_string;//, error_class;
// MPI_Error_class(error_code, &error_class);
// MPI_Error_string(error_class, error_string, &length_of_error_string);
// g_printf("[%d] Runtime error (%s): %s\n", rank, location, error_string);
MPI_Error_string(error_code, error_string, &length_of_error_string);
_log("MPI Runtime Error: ", error_string);
/* get current time of day */
/*gchar* time = time_str();
MPI_Error_string(error_code, error_string, &length_of_error_string);
if (location != NULL)
g_printf("[%d / %s] MPI Runtime Error (%s): %s\n", rank, time, location, error_string);
else
g_printf("[%d / %s] MPI Runtime Error: %s\n", rank, time, error_string);
g_free(time);*/
if (quit) {
MPI_Abort(MPI_COMM_WORLD, error_code);
exit(-1);
}
}
#endif
gchar* time_str()
{
/* get current time of day */
GString* timeBuffer = g_string_new("");
gint time_hh, time_mm, time_ss, time_ms;
GTimeVal timeval;
g_get_current_time(&timeval);
time_hh=1+(timeval.tv_sec/3600)%24;
time_mm=(timeval.tv_sec/60)%60;
time_ss=(timeval.tv_sec)%60;
time_ms=(timeval.tv_usec)/1000;
g_string_append_printf(timeBuffer, "%02d:%02d:%02d.%03d", time_hh, time_mm, time_ss, time_ms);
return g_string_free(timeBuffer, FALSE);
}
gchar* date_str()
{
/* get current time of day */
//GTimeVal timeval;
//g_get_current_time(&timeval);
/* get current date */
GString* dateBuffer = g_string_new("");
GDate* date = g_date_new();
g_date_set_time(date, time(NULL));
//g_date_set_time_val(date, &timeval); // Not available in glib 2.8
gint day = g_date_get_day(date);
gint month = g_date_get_month(date);
gint year = g_date_get_year(date);
g_string_append_printf(dateBuffer, "%02d.%02d.%04d", day, month, year);
g_date_free(date);
return g_string_free(dateBuffer, FALSE);
}
|
/**
* arch/arm/mac-sa1100/jornada720_ssp.c
*
* Copyright (C) 2006/2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
* Copyright (C) 2006 Filip Zyzniewski <filip.zyzniewski@tefnet.pl>
*
* 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.
*
* SSP driver for the HP Jornada 710/720/728
*/
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <mach/jornada720.h>
#include <asm/hardware/ssp.h>
static DEFINE_SPINLOCK(jornada_ssp_lock);
static unsigned long jornada_ssp_flags;
/**
* jornada_ssp_reverse - reverses input byte
*
* we need to reverse all data we receive from the mcu due to its physical location
* returns : 01110111 -> 11101110
*/
u8 inline jornada_ssp_reverse(u8 byte)
{
return
((0x80 & byte) >> 7) |
((0x40 & byte) >> 5) |
((0x20 & byte) >> 3) |
((0x10 & byte) >> 1) |
((0x08 & byte) << 1) |
((0x04 & byte) << 3) |
((0x02 & byte) << 5) |
((0x01 & byte) << 7);
};
EXPORT_SYMBOL(jornada_ssp_reverse);
/**
* jornada_ssp_byte - waits for ready ssp bus and sends byte
*
* waits for fifo buffer to clear and then transmits, if it doesn't then we will
* timeout after <timeout> rounds. Needs mcu running before its called.
*
* returns : %mcu output on success
* : %-ETIMEDOUT on timeout
*/
int jornada_ssp_byte(u8 byte)
{
int timeout = 400000;
u16 ret;
while ((GPLR & GPIO_GPIO10))
{
if (!--timeout)
{
printk(KERN_WARNING "SSP: timeout while waiting for transmit\n");
return -ETIMEDOUT;
}
cpu_relax();
}
ret = jornada_ssp_reverse(byte) << 8;
ssp_write_word(ret);
ssp_read_word(&ret);
return jornada_ssp_reverse(ret);
};
EXPORT_SYMBOL(jornada_ssp_byte);
/**
* jornada_ssp_inout - decide if input is command or trading byte
*
* returns : (jornada_ssp_byte(byte)) on success
* : %-ETIMEDOUT on timeout failure
*/
int jornada_ssp_inout(u8 byte)
{
int ret, i;
/* true means command byte */
if (byte != TXDUMMY)
{
ret = jornada_ssp_byte(byte);
/* Proper return to commands is TxDummy */
if (ret != TXDUMMY)
{
for (i = 0; i < 256; i++)/* flushing bus */
if (jornada_ssp_byte(TXDUMMY) == -1)
{
break;
}
return -ETIMEDOUT;
}
}
else /* Exchange TxDummy for data */
{
ret = jornada_ssp_byte(TXDUMMY);
}
return ret;
};
EXPORT_SYMBOL(jornada_ssp_inout);
/**
* jornada_ssp_start - enable mcu
*
*/
void jornada_ssp_start(void)
{
spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags);
GPCR = GPIO_GPIO25;
udelay(50);
return;
};
EXPORT_SYMBOL(jornada_ssp_start);
/**
* jornada_ssp_end - disable mcu and turn off lock
*
*/
void jornada_ssp_end(void)
{
GPSR = GPIO_GPIO25;
spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags);
return;
};
EXPORT_SYMBOL(jornada_ssp_end);
static int jornada_ssp_probe(struct platform_device *dev)
{
int ret;
GPSR = GPIO_GPIO25;
ret = ssp_init();
/* worked fine, lets not bother with anything else */
if (!ret)
{
printk(KERN_INFO "SSP: device initialized with irq\n");
return ret;
}
printk(KERN_WARNING "SSP: initialization failed, trying non-irq solution \n");
/* init of Serial 4 port */
Ser4MCCR0 = 0;
Ser4SSCR0 = 0x0387;
Ser4SSCR1 = 0x18;
/* clear out any left over data */
ssp_flush();
/* enable MCU */
jornada_ssp_start();
/* see if return value makes sense */
ret = jornada_ssp_inout(GETBRIGHTNESS);
/* seems like it worked, just feed it with TxDummy to get rid of data */
if (ret == TXDUMMY)
{
jornada_ssp_inout(TXDUMMY);
}
jornada_ssp_end();
/* failed, lets just kill everything */
if (ret == -ETIMEDOUT)
{
printk(KERN_WARNING "SSP: attempts failed, bailing\n");
ssp_exit();
return -ENODEV;
}
/* all fine */
printk(KERN_INFO "SSP: device initialized\n");
return 0;
};
static int jornada_ssp_remove(struct platform_device *dev)
{
/* Note that this doesn't actually remove the driver, since theres nothing to remove
* It just makes sure everything is turned off */
GPSR = GPIO_GPIO25;
ssp_exit();
return 0;
};
struct platform_driver jornadassp_driver =
{
.probe = jornada_ssp_probe,
.remove = jornada_ssp_remove,
.driver = {
.name = "jornada_ssp",
},
};
static int __init jornada_ssp_init(void)
{
return platform_driver_register(&jornadassp_driver);
}
module_init(jornada_ssp_init);
|
/* main.c generated by valac 0.22.0, the Vala compiler
* generated from main.vala, do not modify */
/* Copyright 2014 Mike Krüger
*
* This file is part of indicator-ecputemp
*
* Hello Again 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.
*
* Hello Again 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 indicator-ecputemp. If not, see http://www.gnu.org/licenses/.
*/
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#define ECPUTEMP_TYPE_ECT_INDICATOR (ecputemp_ect_indicator_get_type ())
#define ECPUTEMP_ECT_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ECPUTEMP_TYPE_ECT_INDICATOR, ecputempectIndicator))
#define ECPUTEMP_ECT_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ECPUTEMP_TYPE_ECT_INDICATOR, ecputempectIndicatorClass))
#define ECPUTEMP_IS_ECT_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ECPUTEMP_TYPE_ECT_INDICATOR))
#define ECPUTEMP_IS_ECT_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ECPUTEMP_TYPE_ECT_INDICATOR))
#define ECPUTEMP_ECT_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ECPUTEMP_TYPE_ECT_INDICATOR, ecputempectIndicatorClass))
typedef struct _ecputempectIndicator ecputempectIndicator;
typedef struct _ecputempectIndicatorClass ecputempectIndicatorClass;
#define _ecputemp_ect_indicator_unref0(var) ((var == NULL) ? NULL : (var = (ecputemp_ect_indicator_unref (var), NULL)))
gint ecputemp_main (gchar** args, int args_length1);
gpointer ecputemp_ect_indicator_ref (gpointer instance);
void ecputemp_ect_indicator_unref (gpointer instance);
GParamSpec* ecputemp_param_spec_ect_indicator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void ecputemp_value_set_ect_indicator (GValue* value, gpointer v_object);
void ecputemp_value_take_ect_indicator (GValue* value, gpointer v_object);
gpointer ecputemp_value_get_ect_indicator (const GValue* value);
GType ecputemp_ect_indicator_get_type (void) G_GNUC_CONST;
ecputempectIndicator* ecputemp_ect_indicator_new (void);
ecputempectIndicator* ecputemp_ect_indicator_construct (GType object_type);
gint ecputemp_main (gchar** args, int args_length1) {
gint result = 0;
ecputempectIndicator* mainIndicator = NULL;
ecputempectIndicator* _tmp0_ = NULL;
_tmp0_ = ecputemp_ect_indicator_new ();
_ecputemp_ect_indicator_unref0 (mainIndicator);
mainIndicator = _tmp0_;
result = 0;
_ecputemp_ect_indicator_unref0 (mainIndicator);
return result;
}
int main (int argc, char ** argv) {
g_type_init ();
return ecputemp_main (argv, argc);
}
|
/* GUI_Notifications.h */
/* Copyright (C) 2011-2016 Lucio Carreras
*
* This file is part of sayonara player
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GUI_NOTIFICATIONS_H
#define GUI_NOTIFICATIONS_H
#include "Interfaces/PreferenceDialog/PreferenceWidgetInterface.h"
#include "Interfaces/Notification/NotificationHandler.h"
#include "GUI/Preferences/ui_GUI_Notifications.h"
class GUI_Notifications :
public PreferenceWidgetInterface,
private Ui::GUI_Notifications
{
Q_OBJECT
friend class PreferenceWidgetInterface;
friend class PreferenceInterface<SayonaraWidget>;
public:
explicit GUI_Notifications(QWidget *parent=nullptr);
virtual ~GUI_Notifications();
void commit() override;
void revert() override;
private slots:
void notifications_changed();
protected:
void language_changed() override;
QString get_action_name() const override;
private:
NotificationHandler* _notification_handler=nullptr;
private:
void init_ui() override;
};
#endif // GUI_NOTIFICATIONS_H
|
#ifndef MUPDF_FITZ_GLYPH_H
#define MUPDF_FITZ_GLYPH_H
#include "mupdf/fitz/system.h"
#include "mupdf/fitz/context.h"
#include "mupdf/fitz/geometry.h"
#include "mupdf/fitz/store.h"
#include "mupdf/fitz/colorspace.h"
/*
Glyphs represent a run length encoded set of pixels for a 2
dimensional region of a plane.
*/
typedef struct fz_glyph_s fz_glyph;
/*
fz_glyph_bbox: Return the bounding box for a glyph.
*/
fz_irect *fz_glyph_bbox(fz_context *ctx, fz_glyph *glyph, fz_irect *bbox);
/*
fz_glyph_width: Return the width of the glyph in pixels.
*/
int fz_glyph_width(fz_context *ctx, fz_glyph *glyph);
/*
fz_glyph_height: Return the height of the glyph in pixels.
*/
int fz_glyph_height(fz_context *ctx, fz_glyph *glyph);
/*
fz_new_glyph_from_pixmap: Create a new glyph from a pixmap
Returns a pointer to the new glyph. Throws exception on failure to
allocate.
*/
fz_glyph *fz_new_glyph_from_pixmap(fz_context *ctx, fz_pixmap *pix);
/*
fz_new_glyph_from_8bpp_data: Create a new glyph from 8bpp data
x, y: X and Y position for the glyph
w, h: Width and Height for the glyph
sp: Source Pointer to data
span: Increment from line to line of data
Returns a pointer to the new glyph. Throws exception on failure to
allocate.
*/
fz_glyph *fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span);
/*
fz_new_glyph_from_1bpp_data: Create a new glyph from 1bpp data
x, y: X and Y position for the glyph
w, h: Width and Height for the glyph
sp: Source Pointer to data
span: Increment from line to line of data
Returns a pointer to the new glyph. Throws exception on failure to
allocate.
*/
fz_glyph *fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span);
/*
fz_keep_glyph: Take a reference to a glyph.
pix: The glyph to increment the reference for.
Returns pix.
*/
fz_glyph *fz_keep_glyph(fz_context *ctx, fz_glyph *pix);
/*
fz_drop_glyph: Drop a reference and free a glyph.
Decrement the reference count for the glyph. When no
references remain the glyph will be freed.
*/
void fz_drop_glyph(fz_context *ctx, fz_glyph *pix);
/*
Glyphs represent a set of pixels for a 2 dimensional region of a
plane.
x, y: The minimum x and y coord of the region in pixels.
w, h: The width and height of the region in pixels.
samples: The sample data. The sample data is in a compressed format
designed to give reasonable compression, and to be fast to plot from.
The first sizeof(int) * h bytes of the table, when interpreted as
ints gives the offset within the data block of that lines data. An
offset of 0 indicates that that line is completely blank.
The data for individual lines is a sequence of bytes:
00000000 = end of lines data
LLLLLL00 = extend the length given in the next run by the 6 L bits
given here.
LLLLLL01 = A run of length L+1 transparent pixels.
LLLLLE10 = A run of length L+1 solid pixels. If E then this is the
last run on this line.
LLLLLE11 = A run of length L+1 intermediate pixels followed by L+1
bytes of literal pixel data. If E then this is the last run
on this line.
*/
struct fz_glyph_s
{
fz_storable storable;
int x, y, w, h;
fz_pixmap *pixmap;
size_t size;
unsigned char data[1];
};
fz_irect *fz_glyph_bbox_no_ctx(fz_glyph *src, fz_irect *bbox);
static inline size_t
fz_glyph_size(fz_context *ctx, fz_glyph *glyph)
{
if (glyph == NULL)
return 0;
return sizeof(fz_glyph) + glyph->size + fz_pixmap_size(ctx, glyph->pixmap);
}
#endif
|
/* $Header: /cvsroot/nco/nco/src/nco/nco_getopt.h,v 1.2 2003/01/09 01:05:05 zender Exp $ */
/* "my_getopt" package is "drop-in" replacement for GNU getopt()
by Benjamin Sittler <bsittler@iname.com> downloaded from
http://www.geocities.com/ResearchTriangle/Node/9405/#my_getopt
It is distributed under BSD-like license.
Modifications:
20030101: Downloaded source
20030108: Renamed my_getopt.h, my_getopt.c to nco_getopt.c, nco_getopt.h */
/* Original, unmodified license header: */
/*
* my_getopt.h - interface to my re-implementation of getopt.
* Copyright 1997, 2000, 2001, 2002, Benjamin Sittler
*
* 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 MY_GETOPT_H_INCLUDED
#define MY_GETOPT_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/* UNIX-style short-argument parser */
extern int my_getopt(int argc, char * argv[], const char *opts);
extern int my_optind, my_opterr, my_optopt;
extern char *my_optarg;
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
/* human-readable values for has_arg */
#undef no_argument
#define no_argument 0
#undef required_argument
#define required_argument 1
#undef optional_argument
#define optional_argument 2
/* GNU-style long-argument parsers */
extern int my_getopt_long(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind);
extern int my_getopt_long_only(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind);
extern int _my_getopt_internal(int argc, char * argv[], const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#undef getopt
#define getopt my_getopt
#undef getopt_long
#define getopt_long my_getopt_long
#undef getopt_long_only
#define getopt_long_only my_getopt_long_only
#undef _getopt_internal
#define _getopt_internal _my_getopt_internal
#undef opterr
#define opterr my_opterr
#undef optind
#define optind my_optind
#undef optopt
#define optopt my_optopt
#undef optarg
#define optarg my_optarg
#ifdef __cplusplus
}
#endif
#endif /* MY_GETOPT_H_INCLUDED */
|
/**
* \file
*
* \author Georg Hopp
*
* \copyright
* Copyright © 2013 Georg Hopp
*
* 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/>.
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>
#include "application/application.h"
#include "hash.h"
#include "session.h"
#include "utils/memory.h"
#define VERSION_JSON "{\"version\":\"%s\"}"
char *
controllerVersionRead(Application app, Session sess, Hash args)
{
char * buffer;
size_t nbuffer;
nbuffer = snprintf(NULL, 0, VERSION_JSON, app->version? app->version : "");
buffer = memMalloc(nbuffer);
sprintf(buffer, VERSION_JSON, app->version? app->version : "");
return buffer;
}
// vim: set ts=4 sw=4:
|
//
// CS251 Data Structures
// Hash Table
//
#include <assert.h>
#include <stdlib.h>
#include <string.h>
// Each list entry stores data
template <typename Data>
struct ListEntry {
Data _data;
ListEntry * _next;
};
// This is a Hash table that maps string keys to objects of type Data
template <typename Data>
class ListGeneric {
public:
ListEntry<Data> * _head;
ListGeneric();
void insert(Data data);
bool remove(Data &data);
};
template <typename Data>
ListGeneric<Data>::ListGeneric()
{
_head = NULL;
}
template <typename Data>
void ListGeneric<Data>::insert(Data data)
{
ListEntry<Data> * e = new ListEntry<Data>;
e->_data = data;
e->_next = _head;
_head = e;
}
template <typename Data>
bool ListGeneric<Data>::remove(Data &data)
{
if (_head==NULL) {
return false;
}
ListEntry<Data> * e = _head;
data = e->_data;
_head = e->_next;
delete e;
return true;
}
template <typename Data>
class ListGenericIterator {
ListEntry<Data> *_currentEntry; // Points to the current node
ListGeneric<Data> * _list;
public:
ListGenericIterator(ListGeneric<Data> * list);
bool next(Data & data);
};
template <typename Data>
ListGenericIterator<Data>::ListGenericIterator(ListGeneric<Data> * list)
{
_list = list;
_currentEntry = _list->_head;
}
template <typename Data>
bool ListGenericIterator<Data>::next(Data & data)
{
if (_currentEntry == NULL) {
return false;
}
data = _currentEntry->_data;
_currentEntry = _currentEntry->_next;
return true;
}
|
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* 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 disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL 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 LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY 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.
*
*****************************************************************************/
// ****************************************************************************
// M3DPluginInfo.h
// ****************************************************************************
#ifndef M3D_PLUGIN_INFO_H
#define M3D_PLUGIN_INFO_H
#include <DatabasePluginInfo.h>
#include <database_plugin_exports.h>
class avtDatabase;
class avtDatabaseWriter;
// ****************************************************************************
// Class: M3DDatabasePluginInfo
//
// Purpose:
// Classes that provide all the information about the M3D plugin.
// Portions are separated into pieces relevant to the appropriate
// components of VisIt.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
class M3DGeneralPluginInfo : public virtual GeneralDatabasePluginInfo
{
public:
virtual const char *GetName() const;
virtual const char *GetVersion() const;
virtual const char *GetID() const;
virtual bool EnabledByDefault() const;
virtual bool HasWriter() const;
virtual std::vector<std::string> GetDefaultFilePatterns() const;
virtual bool AreDefaultFilePatternsStrict() const;
virtual bool OpensWholeDirectory() const;
};
class M3DCommonPluginInfo : public virtual CommonDatabasePluginInfo, public virtual M3DGeneralPluginInfo
{
public:
virtual DatabaseType GetDatabaseType();
virtual avtDatabase *SetupDatabase(const char * const *list,
int nList, int nBlock);
};
class M3DMDServerPluginInfo : public virtual MDServerDatabasePluginInfo, public virtual M3DCommonPluginInfo
{
public:
// this makes compilers happy... remove if we ever have functions here
virtual void dummy();
};
class M3DEnginePluginInfo : public virtual EngineDatabasePluginInfo, public virtual M3DCommonPluginInfo
{
public:
virtual avtDatabaseWriter *GetWriter(void);
};
#endif
|
/*
* Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of DogeChat, the extensible chat client.
*
* DogeChat 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.
*
* DogeChat 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 DogeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DOGECHAT_RELAY_IRC_H
#define DOGECHAT_RELAY_IRC_H 1
struct t_relay_client;
#define RELAY_IRC_DATA(client, var) \
(((struct t_relay_irc_data *)client->protocol_data)->var)
struct t_relay_irc_data
{
char *address; /* client address (used when sending */
/* data to client) */
int password_ok; /* password received and OK? */
char *nick; /* nick for client */
int user_received; /* command "USER" received */
int cap_ls_received; /* 1 if CAP LS was received */
int cap_end_received; /* 1 if CAP END was received */
int connected; /* 1 if client is connected as IRC */
/* client */
int server_capabilities; /* server capabilities enabled (one */
/* bit per capability) */
struct t_hook *hook_signal_irc_in2; /* signal "irc_in2" */
struct t_hook *hook_signal_irc_outtags; /* signal "irc_outtags" */
struct t_hook *hook_signal_irc_disc; /* signal "irc_disconnected" */
struct t_hook *hook_hsignal_irc_redir; /* hsignal "irc_redirection_..."*/
};
enum t_relay_irc_command
{
RELAY_IRC_CMD_JOIN = 0,
RELAY_IRC_CMD_PART,
RELAY_IRC_CMD_QUIT,
RELAY_IRC_CMD_NICK,
RELAY_IRC_CMD_PRIVMSG,
/* number of relay irc commands */
RELAY_IRC_NUM_CMD,
};
enum t_relay_irc_server_capab
{
RELAY_IRC_CAPAB_SERVER_TIME = 0,
/* number of server capabilities */
RELAY_IRC_NUM_CAPAB,
};
extern int relay_irc_search_backlog_commands_tags (const char *tag);
extern void relay_irc_recv (struct t_relay_client *client,
const char *data);
extern void relay_irc_close_connection (struct t_relay_client *client);
extern void relay_irc_alloc (struct t_relay_client *client);
extern void relay_irc_alloc_with_infolist (struct t_relay_client *client,
struct t_infolist *infolist);
extern void relay_irc_free (struct t_relay_client *client);
extern int relay_irc_add_to_infolist (struct t_infolist_item *item,
struct t_relay_client *client);
extern void relay_irc_print_log (struct t_relay_client *client);
#endif /* DOGECHAT_RELAY_IRC_H */
|
/*
* Passwdm: CLI-based password manager.
* Copyright (C) 2012 Daniel Gibbs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_H
#define DATABASE_H
#include <stdint.h>
#define DATABASE_KEY_SIZE 32
struct database_header {
uint32_t signature;
uint32_t signature2;
uint32_t signature3;
uint32_t signature4;
};
struct database {
char *name;
int fd;
unsigned char key[DATABASE_KEY_SIZE];
struct database_header *header;
};
int create_database(struct database **, char *, char *);
int open_database(struct database **, char *, char *);
int save_database(struct database *);
void close_database(struct database *);
void database_perror(char *);
#endif
|
/* Copyright © Richard Kettlewell.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MMUI_H
#define MMUI_H
#include "mandy.h"
namespace mmui {
class MandelbrotWindow;
class ControlPanel;
class JuliaWindow;
class JuliaView;
extern MandelbrotWindow *mandelbrot;
extern JuliaWindow *julia;
} // namespace mmui
#endif /* MMUI_H */
/*
Local Variables:
mode:c++
c-basic-offset:2
comment-column:40
fill-column:79
indent-tabs-mode:nil
End:
*/
|
/**
******************************************************************************
* @file spark_wiring.h
* @author Satish Nair, Zachary Crockett, Zach Supalla and Mohit Bhoite
* @version V1.0.0
* @date 13-March-2013
* @brief Header for spark_wiring.c module
******************************************************************************
Copyright (c) 2013-2015 Particle Industries, Inc. 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 3 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, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/
#ifndef SPARK_WIRING_H
#define SPARK_WIRING_H
#include "pinmap_hal.h"
#include "gpio_hal.h"
#include "adc_hal.h"
#include "dac_hal.h"
#include "pwm_hal.h"
#include "rng_hal.h"
#include "config.h"
#include "spark_macros.h"
#include "debug.h"
#include "spark_wiring_arduino.h"
#include "spark_wiring_constants.h"
#include "spark_wiring_stream.h"
#include "spark_wiring_printable.h"
#include "spark_wiring_ipaddress.h"
#include "spark_wiring_cellularsignal.h"
#include "spark_wiring_wifi.h"
#include "spark_wiring_cellular.h"
#include "spark_wiring_character.h"
#include "spark_wiring_random.h"
#include "spark_wiring_system.h"
#include "spark_wiring_cloud.h"
#include "spark_wiring_rgb.h"
#include "spark_wiring_ticks.h"
/* To prevent build error, we are undefining and redefining DAC here */
#undef DAC
#define DAC DAC1
#ifdef __cplusplus
extern "C" {
#endif
/*
* ADC
*/
void setADCSampleTime(uint8_t ADC_SampleTime);
int32_t analogRead(uint16_t pin);
/*
* GPIO
*/
void pinMode(uint16_t pin, PinMode mode);
PinMode getPinMode(uint16_t pin);
bool pinAvailable(uint16_t pin);
void digitalWrite(uint16_t pin, uint8_t value);
int32_t digitalRead(uint16_t pin);
void analogWrite(uint16_t pin, uint16_t value);
long map(long value, long fromStart, long fromEnd, long toStart, long toEnd);
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
void serialReadLine(Stream *serialObj, char *dst, int max_len, system_tick_t timeout);
uint32_t pulseIn(pin_t pin, uint16_t value);
#ifdef __cplusplus
}
#endif
#endif /* SPARK_WIRING_H_ */
|
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef AUDIOMANAGER_H
#define AUDIOMANAGER_H
#include <QObject>
#include <QProcess>
#include <QMap>
#include <QTimer>
#include <QDateTime>
#include <tvariantanimation.h>
#include <pulse/context.h>
#include <pulse/glib-mainloop.h>
#include <pulse/volume.h>
#include <pulse/introspect.h>
#include <pulse/subscribe.h>
#include <pulse/stream.h>
class AudioManager : public QObject
{
Q_OBJECT
public:
explicit AudioManager(QObject *parent = 0);
int MasterVolume();
public slots:
void setMasterVolume(int volume);
void changeVolume(int volume);
void attenuateStreams();
void silenceStreams();
void restoreStreams(bool immediate = false);
private:
pa_context* pulseContext = NULL;
pa_mainloop_api* pulseLoopApi = NULL;
static void pulseStateChanged(pa_context *c, void *userdata);
static void pulseGetSinks(pa_context *c, const pa_sink_info *i, int eol, void *userdata);
static void pulseGetDefaultSink(pa_context *c, const pa_sink_info *i, int eol, void *userdata);
static void pulseSubscribe(pa_context *c, pa_subscription_event_type_t t, uint32_t index, void *userdata);
static void pulseServerInfo(pa_context *c, const pa_server_info *i, void *userdata);
static void pulseGetSources(pa_context *c, const pa_source_info *i, int eol, void *userdata);
static void pulseGetInputSinks(pa_context *c, const pa_sink_input_info *i, int eol, void *userdata);
static void pulseGetClients(pa_context *c, const pa_client_info*i, int eol, void *userdata);
QMap<int, pa_cvolume> originalStreamVolumes;
int attenuateRequests = 0;
bool pulseAvailable = false;
bool attenuateMode = false;
int defaultSinkIndex = -1;
QList<uint> tsClientIndices;
QList<uint> newTsClientIndices;
pa_cvolume defaultSinkVolume;
QSettings settings;
};
#endif // AUDIOMANAGER_H
|
/* Copyright (c) 2012-2015 Todd Freed <todd.freed@gmail.com>
This file is part of fab.
fab 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.
fab 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 fab. If not, see <http://www.gnu.org/licenses/>. */
#include "xapi.h"
#include "xlinux/xstdio.h"
#include "xlinux/xunistd.h"
#include "xlinux/xstdlib.h"
#include "narrator.h"
#include "fd.internal.h"
#include "vtable.h"
#include "macros.h"
narrator * APIDATA g_narrator_stdout;
narrator * APIDATA g_narrator_stderr;
//
// static
//
static xapi __attribute__((nonnull)) fd_sayvf(narrator * const restrict N, const char * const restrict fmt, va_list va)
{
enter;
narrator_fd *n = containerof(N, typeof(*n), base);
fatal(xvdprintf, n->fd, fmt, va);
finally : coda;
}
static xapi __attribute__((nonnull)) fd_sayw(narrator * const restrict N, const void * const restrict b, size_t l)
{
enter;
narrator_fd *n = containerof(N, typeof(*n), base);
fatal(axwrite, n->fd, b, l);
finally : coda;
}
static xapi __attribute__((nonnull)) fd_seek(narrator * const restrict N, off_t offset, int whence, off_t * restrict res)
{
enter;
narrator_fd *n = containerof(N, typeof(*n), base);
fatal(xlseek, n->fd, offset, whence, res);
finally : coda;
}
static xapi __attribute__((nonnull(1, 2))) fd_read(narrator * restrict N, void * dst, size_t count, size_t * restrict r)
{
enter;
narrator_fd *n = containerof(N, typeof(*n), base);
fatal(axread, n->fd,dst, count);
if(r) {
*r = count;
}
finally : coda;
}
static xapi __attribute__((nonnull)) fd_flush(narrator * const restrict N)
{
enter;
finally : coda;
}
static xapi __attribute__((nonnull)) fd_destroy(narrator * const restrict N)
{
enter;
finally : coda;
}
struct narrator_vtable API narrator_fd_vtable = NARRATOR_VTABLE(fd);
//
// public
//
xapi fd_setup()
{
enter;
narrator_fd *fd;
fatal(narrator_fd_create, &fd, 1);
g_narrator_stdout = &fd->base;
fatal(narrator_fd_create, &fd, 2);
g_narrator_stderr = &fd->base;
finally : coda;
}
xapi fd_cleanup()
{
enter;
fatal(narrator_fd_free, containerof(g_narrator_stdout, narrator_fd, base));
fatal(narrator_fd_free, containerof(g_narrator_stderr, narrator_fd, base));
finally : coda;
}
//
// api
//
xapi API narrator_fd_create(narrator_fd ** const restrict n, int fd)
{
enter;
narrator_fd *nfd;
fatal(xmalloc, &nfd, sizeof(*nfd));
nfd->base.vtab = &narrator_fd_vtable;
nfd->fd = fd;
*n = nfd;
finally : coda;
}
xapi API narrator_fd_free(narrator_fd * const restrict n)
{
enter;
fatal(fd_destroy, &n->base);
wfree(n);
finally : coda;
}
|
/************************************* open_iA ************************************ *
* ********** A tool for visual analysis and processing of 3D CT images ********** *
* *********************************************************************************** *
* Copyright (C) 2016-2021 C. Heinzl, M. Reiter, A. Reh, W. Li, M. Arikan, Ar. & Al. *
* Amirkhanov, J. Weissenböck, B. Fröhler, M. Schiwarth, P. Weinberger *
* *********************************************************************************** *
* 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/ *
* *********************************************************************************** *
* Contact: FH OÖ Forschungs & Entwicklungs GmbH, Campus Wels, CT-Gruppe, *
* Stelzhamerstraße 23, 4600 Wels / Austria, Email: c.heinzl@fh-wels.at *
* ************************************************************************************/
#pragma once
#include "iAVolumeSettings.h"
#include <QSharedPointer>
#include "ui_modalityProperties.h"
#include "qthelper/iAQTtoUIConnector.h"
typedef iAQTtoUIConnector<QDialog, Ui_modalityProperties> dlg_modalityPropertiesUI;
class iAModality;
class vtkRenderer;
class dlg_modalityProperties : public dlg_modalityPropertiesUI
{
Q_OBJECT
public:
dlg_modalityProperties(QWidget * parent, QSharedPointer<iAModality> modality);
bool spacingChanged();
double const * newSpacing();
public slots:
void OKButtonClicked();
private:
QSharedPointer<iAModality> m_modality;
iAVolumeSettings m_volumeSettings;
bool m_spacingChanged;
double const * m_currentSpacing;
}; |
#ifndef CONVERTFLIPGRAYSCALE
#define CONVERTFLIPGRAYSCALE
#include <iostream>
#include "bmpimage.h"
using namespace std;
int ConvertFlipGrayscale(BMPImage *image);
#endif // CONVERTFLIPGRAYSCALE
|
/**************************************************************************
* Meerkat Browser: Web browser controlled by the user, not vice-versa.
* Copyright (C) 2013 - 2016 Michal Dutkiewicz aka Emdek <michal@emdek.pl>
* Copyright (C) 2014 - 2016 Jan Bajer aka bajasoft <jbajer@gmail.com>
* Copyright (C) 2014 Piotr Wójcik <chocimier@tlen.pl>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**************************************************************************/
#ifndef MEERKAT_PREFERENCESGENERALPAGEWIDGET_H
#define MEERKAT_PREFERENCESGENERALPAGEWIDGET_H
#include <QtWidgets/QWidget>
namespace Meerkat
{
namespace Ui
{
class PreferencesGeneralPageWidget;
}
class PreferencesGeneralPageWidget : public QWidget
{
Q_OBJECT
public:
explicit PreferencesGeneralPageWidget(QWidget *parent = nullptr);
~PreferencesGeneralPageWidget();
protected:
void changeEvent(QEvent *event);
protected slots:
void useCurrentAsHomePage();
void useBookmarkAsHomePage(QAction *action);
void restoreHomePage();
void setupAcceptLanguage();
void save();
private:
QString m_acceptLanguage;
Ui::PreferencesGeneralPageWidget *m_ui;
signals:
void settingsModified();
};
}
#endif
|
/*
* This file is protected by Copyright. Please refer to the COPYRIGHT file
* distributed with this source distribution.
*
* This file is part of GNUHAWK.
*
* GNUHAWK is free software: you can redistribute it and/or modify is 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.
*
* GNUHAWK 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 VECTOR_TO_STREAM_FF_IMPL_H
#define VECTOR_TO_STREAM_FF_IMPL_H
#include "vector_to_stream_ff_base.h"
class vector_to_stream_ff_i : public vector_to_stream_ff_base
{
public:
vector_to_stream_ff_i(const char *uuid, const char *label);
~vector_to_stream_ff_i();
//
// createBlock
//
// Create the actual GNU Radio Block to that will perform the work method. The resulting
// block object is assigned to gr_stpr
//
// Add property change callbacks for getter/setter methods
//
//
void createBlock();
//
// createOutputSRI
//
// Called by setupIOMappings when an output mapping is defined. For each output mapping
// defined, a call to createOutputSRI will be issued with the associated output index.
// This default SRI and StreamID will be saved to the mapping and pushed down stream via pushSRI.
// The subclass is responsible for overriding behavior of this method. The index provide matches
// the stream index number that will be use by the GR Block object
//
// @param idx : output stream index number to associate the returned SRI object with
// @return sri : default SRI object passed down stream over a RedHawk port
//
BULKIO::StreamSRI createOutputSRI( int32_t idx );
};
#endif
|
/*
* Bespin style config for Qt4 and swiss army cli tool
* Copyright 2007-2012 by Thomas Lübking <thomas.luebking@gmail.com>
*
* 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
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library 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 DIALOG_H
#define DIALOG_H
#include <QDialog>
class Dialog : public QDialog {
Q_OBJECT
public:
Dialog() : QDialog(0, Qt::Window){}
public slots:
void setLayoutDirection(bool rtl) {
QDialog::setLayoutDirection(rtl ? Qt::RightToLeft : Qt::LeftToRight);
}
};
#endif // DIALOG_H
|
//
// EasyAVPlayerController.h
// EasyAVPlayer
//
// Created by Yangsc on 2016/12/11.
// Copyright (c) Yangsc https://github.com/yangsanchao
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@class EasyAVPlayerController;
@protocol EasyAVPlayerControllerDelegate <NSObject>
- (void)easyAVPlayerControllerIsReadyToPlay:(EasyAVPlayerController *)playerController;
- (void)easyAVPlayerControllerReachEnd:(EasyAVPlayerController *)playerController;
- (void)easyAVPlayerControllerBuffering:(EasyAVPlayerController *)playerController;
- (void)easyAVPlayerControllerBufferFinished:(EasyAVPlayerController *)playerController;
- (void)easyAVPlayerController:(EasyAVPlayerController *)playerController currentPlayTime:(NSTimeInterval)currentPlayTime;
- (void)easyAVPlayerController:(EasyAVPlayerController *)playerController loadedDuration:(NSTimeInterval)duration;
- (void)easyAVPlayerController:(EasyAVPlayerController *)playerController error:(NSError *)error;
@end
@interface EasyAVPlayerController : NSObject
#pragma mark - properties
#pragma mark
@property (nonatomic, strong) UIView *playerView;
@property (nonatomic, assign) float totalDuration;
@property (nonatomic, assign) float currentPlayTime;
@property (nonatomic, assign) float loadedDuration;
@property (nonatomic, assign) BOOL isPlaying;
@property (nonatomic, assign) float volume;
@property (nonatomic, strong) NSString *videoGravity;
@property (nonatomic, weak) id<EasyAVPlayerControllerDelegate> avDelegate;
#pragma mark - function
#pragma mark
- (instancetype)initWithframe:(CGRect)frame;
- (void)playURL:(NSString *)url;
- (void)stop;
- (void)play;
- (void)pause;
- (void)seekTo:(NSTimeInterval)time;
- (void)resume;
@end
|
/*
* This file is protected by Copyright. Please refer to the COPYRIGHT file
* distributed with this source distribution.
*
* This file is part of GNUHAWK.
*
* GNUHAWK is free software: you can redistribute it and/or modify is 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.
*
* GNUHAWK 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 INTERLEAVER_IMPL_H
#define INTERLEAVER_IMPL_H
#include "interleaver_base.h"
class interleaver_i : public interleaver_base
{
public:
interleaver_i(const char *uuid, const char *label);
~interleaver_i();
//
// createBlock
//
// Create the actual GNU Radio Block to that will perform the work method. The resulting
// block object is assigned to gr_stpr
//
// Add property change callbacks for getter/setter methods
//
//
void createBlock();
//
// createOutputSRI
//
// Called by setupIOMappings when an output mapping is defined. For each output mapping
// defined, a call to createOutputSRI will be issued with the associated output index.
// This default SRI and StreamID will be saved to the mapping and pushed down stream via pushSRI.
// The subclass is responsible for overriding behavior of this method. The index provide matches
// the stream index number that will be use by the GR Block object
//
// @param idx : output stream index number to associate the returned SRI object with
// @return sri : default SRI object passed down stream over a RedHawk port
//
BULKIO::StreamSRI createOutputSRI( int32_t oidx, int32_t &in_idx );
};
#endif
|
// ³ÌÐòÇåµ¥ 5.14 convert.c ³ÌÐò
// convert.c -- ×Ô¶¯ÀàÐÍת»»
#include<stdio.h>
int main(void)
{
char ch;
int i;
float fl;
fl = i = ch = 'C'; // 9th
printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); // 10th
ch = ch + 1; // 11th
i = fl + 2 * ch; // 12th
fl = 2.0 * ch + i; // 13th
printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); // 14th
ch = 1107; // 15th
printf("Now ch = %c\n", ch); // 16th
ch = 80.89; // 17th
printf("Now ch = %c\n", ch); // 18th
return 0;
}
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: game_sa/CSettingsSA.h
* PURPOSE: Header file for game settings class
* DEVELOPERS: Ed Lyons <eai@opencoding.net>
* Sebas Lamers <sebasdevelopment@gmx.com>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CGAMESA_SETTINGS
#define __CGAMESA_SETTINGS
// R* have this info inside CMenuManager but I can't believe that makes much sense
#include <game/CSettings.h>
#include "Common.h"
#define CLASS_CMenuManager 0xBA6748
#define FUNC_CMenuManager_Save 0x57C660
#define VAR_bMouseSteering 0xC1CC02
#define VAR_bMouseFlying 0xC1CC03
#define VAR_fFxQuality 0xA9AE54
#define VAR_fMouseSensivity 0xB6EC1C
#define CLASS_CAudioEngine 0xB6BC90
#define FUNC_CAudioEngine_SetEffectsMasterVolume 0x506E10
#define FUNC_CAudioEngine_SetMusicMasterVolume 0x506DE0
#define CLASS_CGamma 0xC92134
#define FUNC_CGamma_SetGamma 0x747200
struct CSettingsSAInterface // see code around 0x57CE9A for where these are
{
BYTE pad1[4];
float fStatsScrollSpeed; // 0x4
BYTE pad2[0x34];
DWORD dwBrightness;
float fDrawDistance;
bool bSubtitles; // 0x44
bool pad3[5];
bool bLegend; // 0x4A
bool bUseWideScreen; // 0x4B
bool bFrameLimiter; // 0x4C
bool bAutoRetune; // 0x4D
bool pad4;
BYTE ucSfxVolume; // 0x4F
BYTE ucRadioVolume; // 0x50
BYTE ucRadioEq; // 0x51
BYTE ucRadioStation; // 0x52
BYTE pad5[0x5E];
bool bInvertPadX1; // 0xB1
bool bInvertPadY1; // 0xB2
bool bInvertPadX2; // 0xB3
bool bInvertPadY2; // 0xB4
bool bSwapPadAxis1; // 0xB5
bool bSwapPadAxis2; // 0xB6
BYTE pad6[0x19];
bool bUseKeyboardAndMouse; // 0xD0
BYTE pad7[3];
DWORD dwVideoMode; // 0xD4
DWORD dwPrevVideoMode; // 0xD8
};
class CSettingsSA : public CGameSettings
{
friend class COffsets;
private:
CSettingsSAInterface* m_pInterface;
public:
CSettingsSA ( void );
bool IsFrameLimiterEnabled ( void );
void SetFrameLimiterEnabled ( bool bEnabled );
bool IsWideScreenEnabled ( void );
void SetWideScreenEnabled ( bool bEnabled );
unsigned int GetNumVideoModes ( void );
VideoMode * GetVideoModeInfo ( VideoMode * modeInfo, unsigned int modeIndex );
unsigned int GetCurrentVideoMode ( void );
void SetCurrentVideoMode ( unsigned int modeIndex, bool bOnRestart );
unsigned char GetRadioVolume ( void );
void SetRadioVolume ( unsigned char ucVolume );
unsigned char GetSFXVolume ( void );
void SetSFXVolume ( unsigned char ucVolume );
float GetDrawDistance ( void );
void SetDrawDistance ( float fDrawDistance );
unsigned int GetBrightness ( void );
void SetBrightness ( unsigned int uiBrightness );
unsigned int GetFXQuality ( void );
void SetFXQuality ( unsigned int fxQualityId );
float GetMouseSensivity ( void );
void SetMouseSensivity ( float fSensivity );
void Save ( void );
private:
static unsigned long FUNC_GetNumVideoModes;
static unsigned long FUNC_GetVideoModeInfo;
static unsigned long FUNC_GetCurrentVideoMode;
static unsigned long FUNC_SetCurrentVideoMode;
static unsigned long FUNC_SetRadioVolume;
static unsigned long FUNC_SetDrawDistance;
};
#endif
|
/** \file File.h
** \date 2005-04-25
** \author grymse@alhem.net
**/
/*
Copyright (C) 2004-2010 Anders Hedstrom
This library is made available under the terms of the GNU GPL, with
the additional exemption that compiling, linking, and/or using OpenSSL
is allowed.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.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 _SOCKETS_File_H
#define _SOCKETS_File_H
#include "sockets-config.h"
#include "IFile.h"
#include <stdio.h>
#ifdef SOCKETS_NAMESPACE
namespace SOCKETS_NAMESPACE {
#endif
/** IFile implementation of a disk file.
\ingroup file */
class File : public IFile
{
public:
File();
File(FILE *);
/** convenience: calls fopen() */
File(const std::string& path, const std::string& mode);
~File();
bool fopen(const std::string& path, const std::string& mode);
void fclose() const;
size_t fread(char *, size_t, size_t) const;
size_t fwrite(const char *, size_t, size_t);
char *fgets(char *, int) const;
void fprintf(const char *format, ...);
off_t size() const;
bool eof() const;
void reset_read() const;
void reset_write();
const std::string& Path() const;
private:
File(const File& ) {} // copy constructor
File& operator=(const File& ) { return *this; } // assignment operator
std::string m_path;
std::string m_mode;
mutable FILE *m_fil;
bool m_b_close;
mutable long m_rptr;
long m_wptr;
};
#ifdef SOCKETS_NAMESPACE
}
#endif
#endif // _SOCKETS_File_H
|
#if defined __gnu_linux__
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "error.h"
#include "file.h"
#include "flac.h"
#include "mp3.h"
#include "opus.h"
#include "playback.h"
#include "vorbis.h"
#include "wav.h"
/**
* Test the various decoder modules in ctrmus.
*/
int main(int argc, char *argv[])
{
struct decoder_fn decoder;
enum file_types ft;
const char *file = argv[1];
int16_t *buffer = NULL;
FILE *out;
if(argc != 2)
{
puts("FILE is required.");
printf("%s FILE\n", argv[0]);
return 0;
}
switch(ft = getFileType(file))
{
case FILE_TYPE_WAV:
setWav(&decoder);
break;
case FILE_TYPE_FLAC:
setFlac(&decoder);
break;
case FILE_TYPE_OPUS:
setOpus(&decoder);
break;
case FILE_TYPE_MP3:
setMp3(&decoder);
break;
case FILE_TYPE_VORBIS:
setVorbis(&decoder);
break;
default:
puts("Unsupported file.");
goto err;
}
printf("Type: %s\n", fileToStr(ft));
if((*decoder.init)(file) != 0)
{
puts("Unable to initialise decoder.");
goto err;
}
if((*decoder.channels)() > 2 || (*decoder.channels)() < 1)
{
puts("Unable to obtain number of channels.");
goto err;
}
out = fopen("out", "wb");
buffer = malloc(decoder.buffSize * sizeof(int16_t));
while(true)
{
size_t read = (*decoder.decode)(&buffer[0]);
if(read <= 0)
break;
fwrite(buffer, read * sizeof(int16_t), 1, out);
}
(*decoder.exit)();
free(buffer);
fclose(out);
return 0;
err:
puts("Error");
return -1;
}
#else
#pragma message ( "Test ignored for 3DS build." )
#endif
|
#ifndef EXPANDEDBASISFUNCTIONS_H
#define EXPANDEDBASISFUNCTIONS_H
#include "BasisFunctions.h"
#include <armadillo>
#include <vector>
class expandedBasisFunctions : public BasisFunctions
{
public:
expandedBasisFunctions(std::vector<BasisFunctions*> BF, arma::vec coeffs) : BF(BF), coeffs(coeffs), n(coeffs.n_elem) {}
private:
std::vector<BasisFunctions*> BF;
arma::vec coeffs;
int n;
public:
double eval(const Walker *walker, int i) {
int k = 0;
double val = 0;
while (k != n) {
val += coeffs(k)*BF.at(k)->eval(walker, i);
k++;
}
return val;
}
};
#endif // EXPANDEDBASISFUNCTIONS_H
|
#ifndef _GPS_POINT_H_
#define _GPS_POINT_H_
#define EARTH_RADIUS 6371
#include "util.h"
#include <iostream>
using namespace std;
class GPSPoint
{
public:
GPSPoint(double time, double lat, double lon)
: time(time), lat(lat), lon(lon) {}
GPSPoint(bits64* triple)
: GPSPoint(triple[0].dbl, triple[1].dbl, triple[2].dbl) {}
GPSPoint()
: GPSPoint(0, 0, 0) {}
double get_time() const { return time; }
double get_longitude() const { return lon; }
double get_latitude() const { return lat; }
/// Calculates the Euclidian distance between this point and another
double distance(GPSPoint& other) const;
/// Calculates the distance between this point and another in kilometres
double distance_kms(GPSPoint& other) const;
/// Writes a point to an ostream in a human-readable format
friend ostream& operator<<(ostream& os, const GPSPoint& p);
private:
double time, lat, lon;
};
#endif
|
/* $Xorg: XGtFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Hewlett-Packard not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
/* $XFree86: xc/lib/Xi/XGtFocus.c,v 3.4 2002/10/16 00:37:29 dawes Exp $ */
/***********************************************************************
*
* XGetDeviceFocus - Get the focus of an input device.
*
*/
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/Xlibint.h>
#include <X11/extensions/XInput.h>
#include <X11/extensions/extutil.h>
#include "XIint.h"
int
XGetDeviceFocus (dpy, dev, focus, revert_to, time)
register Display *dpy;
XDevice *dev;
Window *focus;
int *revert_to;
Time *time;
{
xGetDeviceFocusReq *req;
xGetDeviceFocusReply rep;
XExtDisplayInfo *info = XInput_find_display (dpy);
LockDisplay (dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
return (NoSuchExtension);
GetReq(GetDeviceFocus,req);
req->reqType = info->codes->major_opcode;
req->ReqType = X_GetDeviceFocus;
req->deviceid = dev->device_id;
(void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
*focus = rep.focus;
*revert_to = rep.revertTo;
*time = rep.time;
UnlockDisplay(dpy);
SyncHandle();
return (Success);
}
|
/*
* wm8350.h - WM8903 audio codec interface
*
* Copyright 2008 Wolfson Microelectronics PLC.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef _WM8350_H
#define _WM8350_H
#include <sound/soc.h>
#include <linux/mfd/wm8350/audio.h>
enum wm8350_jack
{
WM8350_JDL = 1,
WM8350_JDR = 2,
};
int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
struct snd_soc_jack *jack, int report);
int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *jack,
int detect_report, int short_report);
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.