text stringlengths 4 6.14k |
|---|
/*******************************************************************************
* Surfer web browser *
* Copyright (C) 2010 Andrianov Ivan *
* *
* 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 DOWNLOADITEM_H
#define DOWNLOADITEM_H
#include <QtCore>
#include <QtGui>
#include <QtWebKit>
class DownloadItem : public QObject
{
Q_OBJECT
public:
DownloadItem(const QUrl & from, const QUrl & to, QObject * parent = 0);
bool isFinished() const;
int progress() const;
qint64 received() const;
qint64 total() const;
QUrl from() const;
QUrl to() const;
public slots:
void start();
void stop();
private:
bool m_isFinished;
int m_progress;
qint64 m_received;
qint64 m_total;
QUrl m_from;
QUrl m_to;
QNetworkReply * m_reply;
QFile m_file;
private slots:
void afterFinish();
void setProgress(qint64 received, qint64 total);
signals:
void started();
void progressChanged(int progress);
void finished();
};
#endif // DOWNLOADITEM_H
|
/*
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
which should be included with this package. The terms are also available at
http://www.gnu.org/licenses/gpl-3.0.html
*/
#import <Cocoa/Cocoa.h>
#import "MGTableView.h"
@interface MGGeneralLedgerTableView : MGTableView {}
@end
|
//
// N3TrueN3TrueCalorimeterHitColl.h
//
// Created by Stefano Torre on 31/12/11.
//
#ifndef N3TRUECALORIMETERHITCOLL_H_
#define N3TRUECALORIMETERHITCOLL_H_
#include "Hereward/Edm/StorableObject.h"
#include "Hereward/Edm/ConstHandle.h"
#include "Hereward/Edm/Handle.h"
#include "Hereward/Edm/Link.h"
#include "Hereward/Edm/ConstLink.h"
#include "Hereward/Edm/Handle.h"
#include "Hereward/StorableContainers/ValueVector.h"
#include "NemoObjects/N3TrueCalorimeterHit.h"
class EventRecord;
class N3TrueCalorimeterHitColl;
typedef ConstHandle<N3TrueCalorimeterHitColl> N3TrueCalorimeterHitColl_ch;
typedef Handle<N3TrueCalorimeterHitColl> N3TrueCalorimeterHitColl_h;
typedef ConstLink<N3TrueCalorimeterHitColl> N3TrueCalorimeterHitColl_cl;
typedef Link<N3TrueCalorimeterHitColl> N3TrueCalorimeterHitColl_l;
class N3TrueCalorimeterHitColl : public StorableObject {
public:
//-------------------------------------------------------------------------
// typedef's for the collection
//-------------------------------------------------------------------------
typedef N3TrueCalorimeterHit value_type;
typedef std::vector<value_type> N3TrueCalorimeterHitList;
typedef N3TrueCalorimeterHitList::iterator iterator;
typedef N3TrueCalorimeterHitList::const_iterator const_iterator;
typedef N3TrueCalorimeterHit& reference;
typedef const N3TrueCalorimeterHit& const_reference;
typedef N3TrueCalorimeterHit* pointer;
typedef const N3TrueCalorimeterHit* const_pointer;
typedef N3TrueCalorimeterHitList::difference_type difference_type;
typedef N3TrueCalorimeterHitList::size_type size_type;
typedef N3TrueCalorimeterHitList CollType;
typedef N3TrueCalorimeterHitList collection_type;
//-------------------------------------------------------------------------
// Creation
//-------------------------------------------------------------------------
N3TrueCalorimeterHitColl();
N3TrueCalorimeterHitColl(const N3TrueCalorimeterHitColl& rhs);
virtual N3TrueCalorimeterHitColl* clone(void);
//-------------------------------------------------------------------------
// EDM requirements
//-------------------------------------------------------------------------
virtual void destroy();
virtual void deallocate();
//-------------------------------------------------------------------------
// Assignemnt
//-------------------------------------------------------------------------
N3TrueCalorimeterHitColl& operator = (const N3TrueCalorimeterHitColl& rhs);
//-------------------------------------------------------------------------
// Additional functions to make class functional
//-------------------------------------------------------------------------
N3TrueCalorimeterHitList& contents();
const N3TrueCalorimeterHitList& contents() const;
void add(N3TrueCalorimeterHit& hit);
static bool find(EventRecord*, N3TrueCalorimeterHitColl_ch&);
static bool find(EventRecord*, N3TrueCalorimeterHitColl_ch&, const std::string& );
virtual std::string class_name() const;
virtual Version_t class_version() const;
virtual void print(std::ostream& os = std::cout) const;
virtual bool postread(EventRecord* p);
protected:
virtual ~N3TrueCalorimeterHitColl();
private:
ValueVector<N3TrueCalorimeterHit> container_;
ClassDef(N3TrueCalorimeterHitColl, 1)
};
inline N3TrueCalorimeterHitColl::N3TrueCalorimeterHitList& N3TrueCalorimeterHitColl::contents() {
return container_.contents();
}
inline const
N3TrueCalorimeterHitColl::N3TrueCalorimeterHitList& N3TrueCalorimeterHitColl::contents() const {
return container_.contents();
}
inline void N3TrueCalorimeterHitColl::add(N3TrueCalorimeterHit& hit) {
container_.contents().push_back(hit);
}
#endif
|
/*copyright 2010 Simon Graeser*/
/*
This file is part of Pina.
Pina 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.
Pina 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 Pina. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLLADA_FALLOFF_EXPONENT_H
#define COLLADA_FALLOFF_EXPONENT_H
#include "../Element.h"
#define THIS Falloff_exponent
namespace PINA_NAMESPACE{
/**
@brief Describes the falloff exponent of a spotlight.
*/
class THIS: public Element{
public:
THIS(XmlElement* h = 0);
std::string getName() const;
~THIS();
XmlElement* toXmlElement();
static const std::string Name;
void order();
STATIC_CHECKED_FUNCTIONS;
typedef NullType Types;
/* attributes */
Attribute<std::string> attrib_sid;
/* data */
float value;
private:
};
}/*PINA_NAMESPACE*/
#undef THIS
#endif
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Geeetech A20M pin assignment
*/
#define LCD_PINS_RS 5
#define LCD_PINS_ENABLE 36
#define LCD_PINS_D4 21
#define LCD_PINS_D7 6
#define SPEAKER // The speaker can produce tones
#if IS_NEWPANEL
#define BTN_EN1 16
#define BTN_EN2 17
#define BTN_ENC 19
#endif
#include "pins_GT2560_V3.h"
|
//
// UMGSMMAP_ProvideSIWFSNumberRes.h
// ulibgsmmap
//
// © 2016 by Andreas Fink
//
//
#import <ulibasn1/ulibasn1.h>
#import "UMGSMMAP_asn1_protocol.h"
#import "UMGSMMAP_ISDN_AddressString.h"
#import "UMGSMMAP_ExtensionContainer.h"
@interface UMGSMMAP_ProvideSIWFSNumberRes : UMASN1Sequence<UMGSMMAP_asn1_protocol>
{
NSString *operationName;
UMGSMMAP_ISDN_AddressString *sIWFSNumber;
UMGSMMAP_ExtensionContainer *extensionContainer;
}
@property(readwrite,strong) NSString *operationName;
@property(readwrite,strong) UMGSMMAP_ISDN_AddressString *sIWFSNumber;
@property(readwrite,strong) UMGSMMAP_ExtensionContainer *extensionContainer;
- (void)processBeforeEncode;
- (UMGSMMAP_ProvideSIWFSNumberRes *)processAfterDecodeWithContext:(id)context;
- (NSString *)objectName;
- (id)objectValue;
- (UMASN1Object<UMGSMMAP_asn1_protocol> *)decodeASN1opcode:(int64_t)opcode
operationType:(UMTCAP_Operation)operation
operationName:(NSString **)xop
withContext:(id)context;
@end
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "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 The Qt Company Ltd 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ASSISTANT_H
#define ASSISTANT_H
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QProcess;
QT_END_NAMESPACE
class Assistant
{
public:
Assistant();
~Assistant();
void showDocumentation(const QString &file);
private:
bool startAssistant();
QProcess *proc;
};
#endif
|
/*
* Copyright 2016 Tomas Cernik, Tom.Cernik@gmail.com
* All rights reserved.
*
* This file is part of NeuralNetworkLib
*
* NeuralNetworkLib 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.
*
* NeuralNetworkLib 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 NeuralNetworkLib. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
#include <random>
namespace NeuralNetwork {
namespace ProblemSets {
typedef std::pair<std::vector<float>, std::vector<float>> TrainingPattern;
std::vector<TrainingPattern> Chess3X3(float min, std::size_t patterns) {
std::vector<TrainingPattern> ret;
std::mt19937 _generator(rand());
std::uniform_real_distribution<> _distribution(min,1);
float step = (1.0-min)/3.0;
for(std::size_t i=0;i<patterns;i++) {
float x=_distribution(_generator);
float y=_distribution(_generator);
int classX= (static_cast<int>((x-min)/step) + static_cast<int>((y-min)/step)) % 2;
if(classX == 0) {
ret.push_back({{x,y},{min}});
} else {
ret.push_back({{x,y},{1.0}});
}
}
return ret;
}
}
} |
/*=========================================================================
Program: ParaView
Module: pqDefaultMainWindow.h
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
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 AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#ifndef pqDefaultMainWindow_h
#define pqDefaultMainWindow_h
#include <QMainWindow>
#include "pqApplicationComponentsModule.h"
class PQAPPLICATIONCOMPONENTS_EXPORT pqDefaultMainWindow : public QMainWindow
{
Q_OBJECT
typedef QMainWindow Superclass;
public:
pqDefaultMainWindow(QWidget* parent=0, Qt::WindowFlags flags=0);
~pqDefaultMainWindow();
private:
pqDefaultMainWindow(const pqDefaultMainWindow&); // Not implemented.
void operator=(const pqDefaultMainWindow&); // Not implemented.
class pqInternals;
pqInternals* Internals;
};
#endif
|
#ifndef TUBEROM_F100_H
#define TUBEROM_F100_H
#include "inttypes.h"
extern uint16_t tuberom_f100[0x0800];
extern uint16_t tuberom_f100_high[0x0100];
#endif
|
/**
* Project WeldingMeter
* @file jpg_data.h
* @author Gerd Bartelt - www.sebulli.com
* @brief header file for jpg_data.c
*
* @copyright GPL3
*
* 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 __jpg_data_H
#define __jpg_data_H
/* includes ---------------------------------------------------------*/
#include <stdint.h>
/* global variables -------------------------------------------------*/
extern const uint8_t JPG_INTRO_DATA[];
extern const int JPG_INTRO_LENGTH;
extern const uint8_t JPG_BACKGROUND_DATA[];
extern const int JPG_BACKGROUND_LENGTH;
extern const uint8_t JPG_SETTINGS_DATA[];
extern const int JPG_SETTINGS_LENGTH;
/* Function prototypes -------------------------------------------------*/
#endif // __jpg_data_H
|
#pragma once
#include "Entities/Stats.h"
#include "Effect.h"
#include <memory>
#include <vector>
namespace Battle
{
/**
* @brief Stores information relevant to Battles for a character
*/
class BattleProfile
{
public:
Entities::Stats Stats;
struct
{
int Physical;
// TODO: Add more
} Resistances;
std::vector<std::unique_ptr<Effect>> ActiveEffects;
/**
* @brief Constructor
*
* @param stats character stats
*/
BattleProfile(const Entities::Stats& stats);
private:
};
} /* namespace Battle */ |
/*
This file is part of GNUnet.
Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
GNUnet 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, or (at your
option) any later version.
GNUnet 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 GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @author Florian Dold
* @author Christian Grothoff
* @file set/gnunet-service-set_protocol.h
* @brief Peer-to-Peer messages for gnunet set
*/
#ifndef SET_PROTOCOL_H
#define SET_PROTOCOL_H
#include "platform.h"
#include "gnunet_common.h"
GNUNET_NETWORK_STRUCT_BEGIN
struct OperationRequestMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
*/
struct GNUNET_MessageHeader header;
/**
* Operation to request, values from `enum GNUNET_SET_OperationType`
*/
uint32_t operation GNUNET_PACKED;
/**
* For Intersection: my element count
*/
uint32_t element_count GNUNET_PACKED;
/**
* Application-specific identifier of the request.
*/
struct GNUNET_HashCode app_id;
/* rest: optional message */
};
/**
* Message containing buckets of an invertible bloom filter.
*
* If an IBF has too many buckets for an IBF message,
* it is split into multiple messages.
*/
struct IBFMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
*/
struct GNUNET_MessageHeader header;
/**
* Order of the whole ibf, where
* num_buckets = 2^order
*/
uint8_t order;
/**
* Padding, must be 0.
*/
uint8_t reserved;
/**
* Offset of the strata in the rest of the message
*/
uint16_t offset GNUNET_PACKED;
/**
* Salt used when hashing elements for this IBF.
*/
uint32_t salt GNUNET_PACKED;
/* rest: buckets */
};
/**
* During intersection, the first (and possibly second) message
* send it the number of elements in the set, to allow the peers
* to decide who should start with the Bloom filter.
*/
struct IntersectionElementInfoMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO
*/
struct GNUNET_MessageHeader header;
/**
* mutator used with this bloomfilter.
*/
uint32_t sender_element_count GNUNET_PACKED;
};
/**
* Bloom filter messages exchanged for set intersection calculation.
*/
struct BFMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
*/
struct GNUNET_MessageHeader header;
/**
* Number of elements the sender still has in the set.
*/
uint32_t sender_element_count GNUNET_PACKED;
/**
* XOR of all hashes over all elements remaining in the set.
* Used to determine termination.
*/
struct GNUNET_HashCode element_xor_hash;
/**
* Mutator used with this bloomfilter.
*/
uint32_t sender_mutator GNUNET_PACKED;
/**
* Total length of the bloomfilter data.
*/
uint32_t bloomfilter_total_length GNUNET_PACKED;
/**
* Number of bits (k-value) used in encoding the bloomfilter.
*/
uint32_t bits_per_element GNUNET_PACKED;
/**
* rest: the sender's bloomfilter
*/
};
/**
* Last message, send to confirm the final set. Contains the element
* count as it is possible that the peer determined that we were done
* by getting the empty set, which in that case also needs to be
* communicated.
*/
struct IntersectionDoneMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
*/
struct GNUNET_MessageHeader header;
/**
* Final number of elements in intersection.
*/
uint32_t final_element_count GNUNET_PACKED;
/**
* XOR of all hashes over all elements remaining in the set.
*/
struct GNUNET_HashCode element_xor_hash;
};
GNUNET_NETWORK_STRUCT_END
#endif
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-PDU-Contents"
* found in "../support/ngap-r16.1.0/38413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "NGAP_AMFConfigurationUpdateFailure.h"
asn_TYPE_member_t asn_MBR_NGAP_AMFConfigurationUpdateFailure_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct NGAP_AMFConfigurationUpdateFailure, protocolIEs),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_NGAP_ProtocolIE_Container_6976P47,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"protocolIEs"
},
};
static const ber_tlv_tag_t asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_NGAP_AMFConfigurationUpdateFailure_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */
};
asn_SEQUENCE_specifics_t asn_SPC_NGAP_AMFConfigurationUpdateFailure_specs_1 = {
sizeof(struct NGAP_AMFConfigurationUpdateFailure),
offsetof(struct NGAP_AMFConfigurationUpdateFailure, _asn_ctx),
asn_MAP_NGAP_AMFConfigurationUpdateFailure_tag2el_1,
1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
1, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_NGAP_AMFConfigurationUpdateFailure = {
"AMFConfigurationUpdateFailure",
"AMFConfigurationUpdateFailure",
&asn_OP_SEQUENCE,
asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1,
sizeof(asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1)
/sizeof(asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1[0]), /* 1 */
asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1, /* Same as above */
sizeof(asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1)
/sizeof(asn_DEF_NGAP_AMFConfigurationUpdateFailure_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_NGAP_AMFConfigurationUpdateFailure_1,
1, /* Elements count */
&asn_SPC_NGAP_AMFConfigurationUpdateFailure_specs_1 /* Additional specs */
};
|
#include "commWrapper.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int waitFrame(int sock, char str[], int maxSize);
int waitFrame(int sock, char str[], int maxSize) //str should at least have ......
{
int cnt=0, i;
do
{
i=recv(sock,str+cnt,maxSize-cnt,0);
if((i==0)||(i==-1)) return -1;
cnt+=i;
}while(str[cnt-1]!='$');
str[cnt-1]='\0';
return 0;
}
int waitMessage(int sock, PMESSAGE pMessage)
{
char str[128], strMessage[16];
if(waitFrame(sock, str, 128)==-1) return -1;
sscanf(str,"%s%u%u",strMessage, &(pMessage->param1), &(pMessage->param2));
if(strcmp(strMessage,"lcm")==0) pMessage->type=LCM;
else pMessage->type=GCD;
return 0;
}
int waitAnswer(int sock, uint32_t *pValue)
{
char str[128];
waitFrame(sock, str, 128);
sscanf(str,"%u", pValue);
return 0;
}
int sendAnswer(int sock, uint32_t value)
{
char str[32];
sprintf(str,"%u$",value);
send(sock,str,strlen(str),0);
return 0;
}
int remoteGCD(int sock, uint32_t n, uint32_t m, uint32_t *pResult)
{
char str[32];
sprintf(str,"gcd %u %u$",n,m);
send(sock,str,strlen(str),0);
waitFrame(sock, str,32);
sscanf(str, "%d",pResult);
return 0;
}
int remoteLCM(int sock, uint32_t n, uint32_t m, uint32_t *pResult)
{
char str[32];
sprintf(str,"lcm %u %u$",n,m);
send(sock,str,strlen(str),0);
waitFrame(sock, str, 32);
sscanf(str, "%u", pResult);
return 0;
}
int connectToServer(int *pSockConnection, char* serverIP, int serverPort)
{
struct sockaddr_in sAddr;
if((*pSockConnection=socket(PF_INET,SOCK_STREAM,0))==-1)
{
return -1;
}
sAddr.sin_family=AF_INET;
sAddr.sin_addr.s_addr=inet_addr(serverIP);
sAddr.sin_port=htons(serverPort);
if(connect(*pSockConnection,(struct sockaddr*)&sAddr,sizeof(sAddr))==-1)
{
close(*pSockConnection);
return -1;
}
return 0;
}
int initServerSocket(int *pServerSock, char* serverIP, int serverPort)
{
struct sockaddr_in sAddr;
if((*pServerSock=socket(PF_INET,SOCK_STREAM,0))==-1)
{
perror("error creating the socket\n");
return -1;
}
sAddr.sin_family=AF_INET;
sAddr.sin_addr.s_addr=inet_addr(serverIP);
sAddr.sin_port=htons(serverPort);
if(bind(*pServerSock,(struct sockaddr*)&sAddr,sizeof(sAddr))==-1)
{
perror("I coundn't bind\n");
return -1;
}
if(listen(*pServerSock,2)==-1)
{
printf("I coundn't listen\n");
return -1;
}
return 0;
}
int waitConexion(int serverSock, int *psockConnection)
{
struct sockaddr_in cAddr;
socklen_t sockLen;
char str[30];
sockLen=sizeof(cAddr);
if((*psockConnection = accept(serverSock,(struct sockaddr*)&cAddr,&sockLen))==-1)
{
return -1;
}
printf("I have been connected from:\n");
strcpy(str,inet_ntoa(cAddr.sin_addr));
printf("\tIP address: %s\n",str);
printf("\tport: %u\n",(unsigned int)cAddr.sin_port);
return 0;
}
|
/*
* A Command & Conquer: Renegade SSGM Plugin, containing all the single player mission scripts
* Copyright(C) 2017 Neijwiert
*
* 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 <scripts.h>
/*
M01 -> 103378
*/
class M01_HON_Escorts_Warroom_MCT_ZoneController_JDG : public ScriptImpClass
{
private:
virtual void Entered(GameObject *obj, GameObject *enterer);
}; |
#ifndef CALCULPARSER_H
#define CALCULPARSER_H
#include<string>
class CalculParser
{
public:
CalculParser();
CalculParser(const std::string& device, size_t deb, size_t fin);
~CalculParser();
std::string m_Device;
size_t m_Deb;
size_t m_Fin;
};
#endif // CALCULPARSER_H
|
#pragma once
#include <PositioningLayout.h>
#include <TextLayout.h>
#include <statemachine/StateMachine.h>
class Stats: public PositioningLayout
{
public:
Stats(unsigned int time, unsigned int points, std::function<void()> playAgain);
Layout::EventFunction getHoverListener(std::shared_ptr<Texture> buttonBg, std::shared_ptr<Texture> buttonHoverBg);
};
|
#ifndef GENERIC_VECTOR_H
#define GENERIC_VECTOR_H
#include <stdio.h>
#include <stdlib.h>
typedef struct Vector {
int max_size;
void** elements;
int current_size;
} vector;
void init_vector(vector* v);
void free_vector_elements(vector* v);
static void double_vector_size(vector* v);
void add_element_to_vector(vector* v, void* element);
void* get_element_from_vector(vector* v, int elementIndex);
int get_size(vector* v);
#endif
|
/*******************************************************************************
* This file is part of KaHyPar.
*
* Copyright (C) 2015 Tobias Heuer <tobias.heuer@gmx.net>
*
* KaHyPar 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.
*
* KaHyPar 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 KaHyPar. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include <limits>
#include <vector>
#include "kahypar/partition/context.h"
#include "kahypar/partition/metrics.h"
namespace kahypar {
class IInitialPartitioner {
public:
IInitialPartitioner(const IInitialPartitioner&) = delete;
IInitialPartitioner(IInitialPartitioner&&) = delete;
IInitialPartitioner& operator= (const IInitialPartitioner&) = delete;
IInitialPartitioner& operator= (IInitialPartitioner&&) = delete;
void partition() {
partitionImpl();
}
virtual ~IInitialPartitioner() = default;
protected:
IInitialPartitioner() = default;
private:
virtual void partitionImpl() = 0;
};
} // namespace kahypar
|
//
// Copyright-Only Dedication (based on United States law)
//
// The person or persons who have associated their work with this document (the
// "Dedicator") hereby dedicate the entire copyright in the work of authorship
// identified below (the "Work") to the public domain.
//
// Dedicator makes this dedication for the benefit of the public at large and
// to the detriment of Dedicator's heirs and successors. Dedicator intends this
// dedication to be an overt act of relinquishment in perpetuity of all present
// and future rights under copyright law, whether vested or contingent, in the
// Work. Dedicator understands that such relinquishment of all rights includes
// the relinquishment of all rights to enforce (by lawsuit or otherwise) those
// copyrights in the Work.
//
// Dedicator recognizes that, once placed in the public domain, the Work may be
// freely reproduced, distributed, transmitted, used, modified, built upon, or
// otherwise exploited by anyone for any purpose, commercial or non-commercial,
// and in any way, including by methods that have not yet been invented or
// conceived.
//
|
/*
voiphopper - VoIP Hopper
Copyright (C) 2012 Jason Ostrom <jpo@pobox.com>
This file is part of VoIP Hopper.
VoIP Hopper 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.
VoIP Hopper 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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "pathnames.h"
#include "kversion.h"
#include "dhcpclient.h"
#include "dhcpcd.h"
extern char *ConfigDir;
extern char *IfNameExt;
extern int prev_ip_addr;
extern dhcpInterface DhcpIface;
char cache_file[128];
int readDhcpCache() {
int i,o;
snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,ConfigDir,IfNameExt);
i=open(cache_file,O_RDONLY);
if ( i == -1 ) return -1;
o=read(i,(char *)&DhcpIface,sizeof(dhcpInterface));
close(i);
if ( o != sizeof(dhcpInterface) ) return -1;
if ( strncmp(DhcpIface.version,VERSION,sizeof(DhcpIface.version)) ) return -1;
prev_ip_addr = DhcpIface.ciaddr;
return 0;
}
/*****************************************************************************/
void deleteDhcpCache()
{
snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,ConfigDir,IfNameExt);
unlink(cache_file);
}
|
/*
Copyright (C) Cfengine AS
This file is part of Cfengine 3 - written and maintained by Cfengine AS.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; version 3.
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
To the extent this program is licensed as part of the Enterprise
versions of Cfengine, the applicable Commerical Open Source License
(COSL) may apply to this file if you as a licensee so wish it. See
included file COSL.txt.
*/
#include "cf3.defs.h"
void CfHtmlHeader(Writer *writer, char *title, char *css, char *webdriver, char *header)
{
if (title == NULL)
{
title = "Cfengine Knowledge";
}
WriterWriteF(writer, "<html>\n"
" <head>\n"
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
" <meta http-equiv=\"refresh\" CONTENT=\"150\">\n"
" <title>%s</title>\n"
" <link rel=\"stylesheet\" href=\"%s\" type=\"text/css\" media=\"screen\" />\n"
" <link rel=\"stylesheet\" href=\"hand_%s\" type=\"text/css\" media=\"handheld\" />\n"
" </head>\n" " <body>\n", title, css, css);
if (header && strlen(header) > 0)
{
if (strlen(LICENSE_COMPANY) > 0)
{
WriterWriteF(writer, "<div id=\"company\">%s</div>\n%s\n", LICENSE_COMPANY, header);
}
else
{
WriterWriteF(writer, "%s\n", header);
}
}
WriterWriteF(writer, "<div id=\"primary\">\n");
}
/*****************************************************************************/
void CfHtmlFooter(Writer *writer, char *footer)
{
if (strlen(footer) > 0)
{
WriterWriteF(writer, "%s", footer);
}
WriterWriteF(writer, "</div></body></html>\n");
}
/*****************************************************************************/
int IsHtmlHeader(char *s)
{
char *str[] = { "<html>", "</html>", "<body>", "</body>",
"<title>", "<meta", "<link", "head>",
"<div id=\"primary\">", NULL
};
int i;
for (i = 0; str[i] != NULL; i++)
{
if (strstr(s, str[i]))
{
return true;
}
}
return false;
}
/*****************************************************************************/
void CfHtmlTitle(FILE *fp, char *title)
{
fprintf(fp, "<h1>%s</h1>\n", title);
}
|
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a 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 FSF - Free Software
* Foundation
*/
#ifndef __LOGREMOTE_H
#define __LOGREMOTE_H
#ifndef ARGV0
#define ARGV0 "ossec-remoted"
#endif
#include "config/remote-config.h"
#include "sec.h"
/** Function prototypes **/
/* Read remoted config */
int RemotedConfig(const char *cfgfile, remoted *cfg);
/* Handle Remote connections */
void HandleRemote(int position, int uid) __attribute__((noreturn));
/* Handle Syslog */
void HandleSyslog(void) __attribute__((noreturn));
/* Handle Syslog TCP */
void HandleSyslogTCP(void) __attribute__((noreturn));
/* Handle Secure connections */
void HandleSecure(void) __attribute__((noreturn));
/* Forward active response events */
void *AR_Forward(void *arg) __attribute__((noreturn));
/* Initialize the manager */
void manager_init(int isUpdate);
/* Wait for messages from the agent to analyze */
void *wait_for_msgs(void *none);
/* Save control messages */
void save_controlmsg(unsigned int agentid, char *msg);
/* Send message to agent */
int send_msg(unsigned int agentid, const char *msg);
/* Initializing send_msg */
void send_msg_init(void);
int check_keyupdate(void);
void key_lock(void);
void key_unlock(void);
void keyupdate_init(void);
/** Global variables **/
extern keystore keys;
extern remoted logr;
#endif /* __LOGREMOTE_H */
|
#ifndef MUSICDOWNLOADQUERYFACTORY_H
#define MUSICDOWNLOADQUERYFACTORY_H
/***************************************************************************
* This file is part of the TTK Music Player project
* Copyright (C) 2015 - 2022 Greedysky Studio
* 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 "ttksingleton.h"
#include "musicabstractdownloadrequest.h"
class MusicSimilarRequest;
class MusicSongSuggestRequest;
class MusicCommentsRequest;
class MusicDiscoverListRequest;
class MusicAbstractQueryRequest;
class MusicDownloadImageRequest;
class MusicTranslationRequest;
/*! @brief The class of produce the download query class by type.
* @author Greedysky <greedysky@163.com>
*/
class TTK_MODULE_EXPORT MusicDownLoadQueryFactory
{
TTK_DECLARE_MODULE(MusicDownLoadQueryFactory)
public:
/*!
* Make query request object by type.
*/
MusicAbstractQueryRequest *makeQueryRequest(QObject *parent = nullptr);
/*!
* Make movie request object by type.
*/
MusicAbstractQueryRequest *makeMovieRequest(QObject *parent = nullptr);
/*!
* Make album request object by type.
*/
MusicAbstractQueryRequest *makeAlbumRequest(QObject *parent = nullptr);
/*!
* Make artist request object by type.
*/
MusicAbstractQueryRequest *makeArtistRequest(QObject *parent = nullptr);
/*!
* Make artist category request object by type.
*/
MusicAbstractQueryRequest *makeArtistListRequest(QObject *parent = nullptr);
/*!
* Make toplist request object by type.
*/
MusicAbstractQueryRequest *makeToplistRequest(QObject *parent = nullptr);
/*!
* Make playlist request object by type.
*/
MusicAbstractQueryRequest *makePlaylistRequest(QObject *parent = nullptr);
/*!
* Make recommend request object by type.
*/
MusicAbstractQueryRequest *makeRecommendRequest(QObject *parent = nullptr);
/*!
* Make similar song query request object by type.
*/
MusicAbstractQueryRequest *makeSimilarSongRequest(QObject *parent = nullptr);
/*!
* Make similar query request object by type.
*/
MusicSimilarRequest *makeSimilarArtistRequest(QObject *parent = nullptr);
/*!
* Make suggest request object by type.
*/
MusicSongSuggestRequest *makeSuggestRequest(QObject *parent = nullptr);
/*!
* Make song comment request object by type.
*/
MusicCommentsRequest *makeSongCommentRequest(QObject *parent = nullptr);
/*!
* Make playlist comment request object by type.
*/
MusicCommentsRequest *makePlaylistCommentRequest(QObject *parent = nullptr);
/*!
* Make discover list request object by type.
*/
MusicDiscoverListRequest *makeDiscoverListRequest(QObject *parent = nullptr);
/*!
* Make translation object by type.
*/
MusicTranslationRequest *makeTranslationRequest(QObject *parent = nullptr);
/*!
* Make download small picture object by type.
*/
MusicAbstractDownLoadRequest *makeSmallPictureRequest(const QString &url, const QString &save, MusicObject::DownloadType type, QObject *parent = nullptr);
/*!
* Make download lrc object by type.
*/
MusicAbstractDownLoadRequest *makeLrcRequest(const QString &url, const QString &save, MusicObject::DownloadType type, QObject *parent = nullptr);
/*!
* Make download big picture object by type.
*/
MusicDownloadImageRequest *makeBigPictureRequest(const QString &name, const QString &save, QObject *parent = nullptr);
protected:
DECLARE_SINGLETON_CLASS(MusicDownLoadQueryFactory)
};
#define G_DOWNLOAD_QUERY_PTR makeMusicDownLoadQueryFactory()
TTK_MODULE_EXPORT MusicDownLoadQueryFactory* makeMusicDownLoadQueryFactory();
#endif // MUSICDOWNLOADQUERYFACTORY_H
|
#include <oak/misc.h>
@interface OakHTMLOutputView : NSView
- (void)loadRequest:(NSURLRequest*)aRequest environment:(std::map<std::string, std::string> const&)anEnvironment autoScrolls:(BOOL)flag;
- (void)stopLoadingWithUserInteraction:(BOOL)askUserFlag completionHandler:(void(^)(BOOL didStop))handler;
- (void)loadHTMLString:(NSString*)someHTML;
@property (nonatomic) NSUUID* commandIdentifier; // UUID from initial load request
@property (nonatomic, getter = isRunningCommand, readonly) BOOL runningCommand;
// Read-only access to the webview is given to allow reading page title, etc.
@property (nonatomic, readonly) WebView* webView;
@property (nonatomic, readonly) BOOL needsNewWebView;
@end
|
/* Etui - Multi-document rendering library using the EFL
* Copyright (C) 2013 Vincent Torri
*
* 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/>.
*/
#ifndef ETUI_MODULE_DJVU_H
#define ETUI_MODULE_DJVU_H
Eina_Bool etui_module_djvu_init(void);
void etui_module_djvu_shutdown(void);
#endif
|
/*
Liquid War 6 is a unique multiplayer wargame.
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Christian Mauduit <ufoot@ufoot.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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/>.
Liquid War 6 homepage : http://www.gnu.org/software/liquidwar6/
Contact author : ufoot@ufoot.org
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include "../bot.h"
#include "mod-random-internal.h"
_mod_random_context_t *
_mod_random_init (lw6sys_context_t * sys_context, int argc, const char *argv[], lw6bot_data_t * data)
{
_mod_random_context_t *random_context = NULL;
lw6sys_log (sys_context, LW6SYS_LOG_INFO, _x_ ("random init"));
random_context = (_mod_random_context_t *) LW6SYS_CALLOC (sys_context, sizeof (_mod_random_context_t));
if (random_context)
{
random_context->last_move_round = -1;
random_context->pos_x = -1;
random_context->pos_y = -1;
}
return random_context;
}
void
_mod_random_quit (lw6sys_context_t * sys_context, _mod_random_context_t * random_context)
{
lw6sys_log (sys_context, LW6SYS_LOG_INFO, _x_ ("random quit"));
LW6SYS_FREE (sys_context, random_context);
}
|
#include"marocs.h"
#include"splstr.h"
#include<assert.h>
#include<string.h>
#include<stdlib.h>
#define DEFAULT_SIZE 32
#ifdef SPLSTR_DEBUG
unsigned int round_log(unsigned size)
#else
static unsigned int round_log(unsigned size)
#endif /*SPLSTR_DEBUG*/
{
unsigned int i=DEFAULT_SIZE;
while(i<size)
{
i<<=1;
}
return i;
}
#ifdef SPLSTR_DEBUG
void splstr_realloc(splstr* s_str,unsigned int size)
#else
static void splstr_realloc(splstr* s_str,unsigned int size)
#endif /*SPLSTR_DEBUG*/
{
char* new_str;
char* old_str=s_str->str;
unsigned int length=s_str->length;
size=round_log(size);
if(size<s_str->length)
{
WARN("Realloc Lose Data,Refuse");
return;
}
new_str=(char*)malloc(size);
memcpy(new_str,old_str,length+1);
free(old_str);
s_str->max_cap=size;
s_str->str=new_str;
}
/* insert char at front , back ,and middle*/
void splstr_push_front(splstr* s_str,char c)
{
splstr_insert_char(s_str,0,c);
}
void splstr_push_back(splstr* s_str,char c)
{
splstr_insert_char(s_str,s_str->length,c);
}
void splstr_insert_char(splstr* s_str,unsigned int pos,char c)
{
char* str;
unsigned int i;
unsigned int length=s_str->length;
int size;
if(pos>length)
{
WARN("Pos Out Of Range");
pos=length;
}
if(length+1==s_str->max_cap)
{
splstr_realloc(s_str,s_str->max_cap+1);
}
str=s_str->str;
size=length-pos;
for(i=0;i<=size;i++)
{
str[pos+size-i+1]=str[pos+size-i];
}
str[pos]=c;
s_str->length++;
}
/*insert strings*/
void splstr_insert_str(splstr* d_str,unsigned int pos,const char* s_str)
{
unsigned int s_length=strlen(s_str);
char* str;
unsigned int i;
unsigned int d_length=d_str->length;
unsigned size;
if(pos>d_length)
{
WARN("Pos Out Of Range");
pos=d_length;
}
if(d_length+s_length+1>d_str->max_cap)
{
splstr_realloc(d_str,d_length+s_length+1);
}
str=d_str->str;
size=d_length-pos;
for(i=0;i<=size;i++)
{
str[pos+size-i+s_length]=str[pos+size-i];
}
memcpy(str+pos,s_str,s_length);
d_str->length+=s_length;
}
void splstr_insert_splstr(splstr* d_str,unsigned pos,splstr* s_str)
{
splstr_insert_str(d_str,pos,s_str->str);
}
/*remove strings*/
void splstr_remove_range(splstr* s_str,unsigned int begin,unsigned int end)
{
if(end<begin)
{
WARN("Error Range");
return ;
}
return splstr_remove(s_str,begin,end-begin+1);
}
void splstr_remove(splstr* s_str,unsigned int pos,unsigned int size)
{
unsigned int s_length=s_str->length;
char* str=s_str->str;
unsigned int i;
if(pos>=s_length)
{
WARN("Pos Out Of Range");
return ;
}
if(pos+size>s_length)
{
size=s_length-pos;
}
for(i=pos+size;i<=s_length;i++)
{
str[i-size]=str[i];
}
s_str->length-=size;
}
void splstr_keep_front(splstr* s_str,unsigned int size)
{
if(size>s_str->length)
{
WARN("Size Out Of Range");
return ;
}
s_str->length=size;
s_str->str[size]='\0';
}
void splstr_drop_tail(splstr* s_str,unsigned int size)
{
if(size>s_str->length)
{
size=s_str->length;
}
s_str->length-=size;
s_str->str[s_str->length]='\0';
}
/*splstr assignment and copy*/
void splstr_copy(splstr* d_str,splstr* s_str)
{
splstr_assign(d_str,s_str->str);
}
void splstr_assign(splstr* d_str,const char* s_str)
{
unsigned int s_length=strlen(s_str);
char* str;
if(s_length+1>d_str->max_cap)
{
splstr_realloc(d_str,s_length+1);
}
str=d_str->str;
memcpy(str,s_str,s_length+1);
d_str->length=s_length;
}
/*substring */
void splstr_substr(splstr* s_str,unsigned int begin,unsigned int size)
{
unsigned int i;
char* str=s_str->str;
unsigned int length=s_str->length;
if(begin>=length)
{
WARN("Parameter Out Of Range");
s_str->str[0]='\0';
s_str->length=0;
return;
}
if(begin+size>length)
{
size=length-begin;
}
for(i=0;i<size;i++)
{
str[i]=str[i+begin];
}
str[size]='\0';
s_str->length=size;
}
void splstr_substr_range(splstr* s_str,unsigned int begin,unsigned int end)
{
if(end<begin)
{
WARN("Error Range");
splstr_substr(s_str,0,0);
return ;
}
splstr_substr(s_str,begin,end-begin+1);
}
splstr* splstr_create_substr(splstr* s_str,unsigned int begin,unsigned int size)
{
unsigned int length=s_str->length;
splstr* result=splstr_alloc();
splstr_init(result);
if(begin>=length)
{
WARN("Parameter Out Of Range");
return result;
}
if(begin+size>length)
{
size=length-begin;
}
if(size+1>result->length)
{
splstr_realloc(result,size+1);
}
memcpy(result->str,s_str->str+begin,size);
result->length=size;
result->str[size]='\0';
return result;
}
splstr* splstr_create_substr_range(splstr* s_str,unsigned int begin,unsigned int end)
{
splstr* result=NULL;
if(end<begin)
{
result=splstr_alloc();
WARN("Error Range");
splstr_init(result);
return result;
}
return splstr_create_substr(s_str,begin,end-begin+1);
}
/*length*/
int splstr_length(splstr* s_str)
{
return s_str->length;
}
/*memory alloc and free*/
splstr* splstr_alloc()
{
return (splstr*) malloc(sizeof(splstr));
}
void splstr_free(splstr* s_str)
{
splstr_destory(s_str);
free(s_str);
}
/*init and destory*/
void splstr_init(splstr* s_str)
{
s_str->max_cap=DEFAULT_SIZE;
s_str->length=0;
s_str->str=(char*)malloc(DEFAULT_SIZE);
s_str->str[0]='\0';
}
void splstr_init_str(splstr* s_str,const char* str)
{
unsigned length=strlen(str);
unsigned max_cap=round_log(length);
s_str->max_cap=max_cap;
s_str->length=length;
s_str->str=(char*)malloc(max_cap);
memcpy(s_str->str,str,length+1);
}
void splstr_destory(splstr* s_str)
{
free(s_str->str);
s_str->length=0;
s_str->max_cap=0;
s_str->str=NULL;
}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include "cbfi.h"
int main(){
mkdir("testmakedir",077);
printf("errno:%d \n",errno);
assert(errno==0);
mkdir("testmakedir2",077);
printf("errno:%d \n",errno);
assert(errno==0);
opendir("testmakedir");
printf("errno:%d \n",errno);
assert(errno==0);
opendir("testmakedir2");
printf("errno:%d \n",errno);
assert(errno==0);
rmdir("testmakedir");
assert(errno==0);
rmdir("testmakedir2");
assert(errno==0);
return 0;
} |
#ifndef SEQELEMENTMISMATCHDIALOG_H
#define SEQELEMENTMISMATCHDIALOG_H
//(*Headers(SeqElementMismatchDialog)
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/radiobut.h>
#include <wx/choice.h>
#include <wx/dialog.h>
//*)
class SeqElementMismatchDialog: public wxDialog
{
public:
SeqElementMismatchDialog(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
virtual ~SeqElementMismatchDialog();
//(*Declarations(SeqElementMismatchDialog)
wxRadioButton* RadioButtonRename;
wxRadioButton* RadioButtonAdd;
wxStaticText* StaticTextMessage;
wxChoice* ChoiceModels;
wxRadioButton* RadioButtonDelete;
//*)
protected:
//(*Identifiers(SeqElementMismatchDialog)
static const long ID_STATICTEXT1;
static const long ID_RADIOBUTTON1;
static const long ID_RADIOBUTTON2;
static const long ID_RADIOBUTTON3;
static const long ID_CHOICE1;
//*)
private:
//(*Handlers(SeqElementMismatchDialog)
//*)
DECLARE_EVENT_TABLE()
};
#endif
|
/*
* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG 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.
*
* CasparCG 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 CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Nicklas P Andersson
*/
#pragma once
#include "CIICommand.h"
namespace caspar { namespace protocol { namespace cii {
class CIIProtocolStrategy;
class MediaCommand : public ICIICommand
{
public:
MediaCommand(CIIProtocolStrategy* pPS)
: pCIIStrategy_(pPS)
{
}
virtual int GetMinimumParameters() { return 1; }
virtual void Setup(const std::vector<std::wstring>& parameters);
virtual void Execute();
private:
std::wstring graphicProfile_;
CIIProtocolStrategy* pCIIStrategy_;
};
class WriteCommand : public ICIICommand
{
public:
WriteCommand(CIIProtocolStrategy* pPS)
: pCIIStrategy_(pPS)
{
}
virtual int GetMinimumParameters() { return 2; }
virtual void Setup(const std::vector<std::wstring>& parameters);
virtual void Execute();
private:
std::wstring targetName_;
std::wstring templateName_;
std::wstring xmlData_;
CIIProtocolStrategy* pCIIStrategy_;
};
class MiscellaneousCommand : public ICIICommand
{
public:
MiscellaneousCommand(CIIProtocolStrategy* pPS)
: pCIIStrategy_(pPS)
, state_(-1)
, layer_(0)
{
}
virtual int GetMinimumParameters() { return 5; }
virtual void Setup(const std::vector<std::wstring>& parameters);
virtual void Execute();
private:
std::wstring filename_;
std::wstring xmlData_;
int state_;
int layer_;
CIIProtocolStrategy* pCIIStrategy_;
};
class ImagestoreCommand : public ICIICommand
{
public:
ImagestoreCommand(CIIProtocolStrategy* pPS)
: pCIIStrategy_(pPS)
{
}
virtual int GetMinimumParameters() { return 1; }
virtual void Setup(const std::vector<std::wstring>& parameters);
virtual void Execute();
private:
std::wstring titleName_;
CIIProtocolStrategy* pCIIStrategy_;
};
class KeydataCommand : public ICIICommand
{
public:
KeydataCommand(CIIProtocolStrategy* pPS)
: pCIIStrategy_(pPS)
, state_(-1)
, layer_(0)
, casparLayer_(0)
{
}
virtual int GetMinimumParameters() { return 1; }
virtual void Setup(const std::vector<std::wstring>& parameters);
virtual void Execute();
private:
std::wstring titleName_;
int state_;
int layer_;
int casparLayer_;
CIIProtocolStrategy* pCIIStrategy_;
};
}}} // namespace caspar::protocol::cii
|
/******************************************************************************
* Copyright © 2012-2014 Institut für Nachrichtentechnik, Universität Rostock *
* Copyright © 2006-2012 Quality & Usability Lab, *
* Telekom Innovation Laboratories, TU Berlin *
* *
* This file is part of the SoundScape Renderer (SSR). *
* *
* The SSR 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. *
* *
* The SSR 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/>. *
* *
* The SSR is a tool for real-time spatial audio reproduction providing a *
* variety of rendering algorithms. *
* *
* http://spatialaudio.net/ssr ssr@spatialaudio.net *
******************************************************************************/
/// @file
/// Helper functions for filename and path manipulation.
#ifndef SSR_PATHTOOLS_H
#define SSR_PATHTOOLS_H
#include <filesystem>
namespace fs = std::filesystem;
/** helper functions for filename and path manipulation.
**/
namespace pathtools
{
/** Remove common directory part and prepend "../" if necessary.
* If @p path is in the directory of @p filename or below, remove directory
* from @p path. For each further sub-directories of @p filename, prepend
* "../" to @p path. If they have no common directories, prepend an
* appropriate number of parent directories and "../"s.
* @param path A path given relative to the current directory.
* If @p path is absolute or empty, it is not changed. If @p path is
* relative, the result is also relative.
* @param filename This can also be a directory, but then it has to end with a
* trailing slash.
* If @p filename doesn't have a directory part, @p path is not changed.
**/
inline fs::path make_path_relative_to_file(const std::string& path
, const std::string& filename)
{
auto p = fs::path{path};
if (p.is_absolute() || p == "")
{
return p;
}
p = fs::absolute(p);
return fs::relative(p, fs::absolute(filename).parent_path());
}
/** Prepend directory part of one path to another path.
* @param path A path given relative to @p filename.
* If @p path is absolute or empty, it is not changed.
* If @p path is relative, the result is also relative.
* @param filename The directory part of @p filename is prepended to @p path.
* @return @p path prepended with the directory name of @p filename,
* relative to the current directory.
**/
inline fs::path make_path_relative_to_current_dir(const std::string& path
, const std::string& filename)
{
auto p = fs::path{path};
if (p.is_absolute() || p == "")
{
return p;
}
return fs::relative(fs::absolute(filename).parent_path() / p);
}
/** Insert escape characters (\) before whitespace characters.
* @param filename the file name
* @return the file name with escaped whitespace characters
**/
inline std::string get_escaped_filename(const std::string& filename)
{
std::string escaped_filename;
for (const auto ch: filename)
{
if (isspace(ch))
{
escaped_filename.append(1, '\\');
}
escaped_filename.append(1, ch);
}
return escaped_filename;
}
} // namespace pathtools
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2004 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
// WARNING: this file is machine generated. Edits will be over written
#ifndef INCLUDED_GR_DIVIDE_CC_H
#define INCLUDED_GR_DIVIDE_CC_H
#include <gr_sync_block.h>
class gr_divide_cc;
typedef boost::shared_ptr<gr_divide_cc> gr_divide_cc_sptr;
gr_divide_cc_sptr gr_make_divide_cc ();
/*!
* \brief output = input_0 / input_1 / input_x ...)
* \ingroup math
*
* Divide across all input streams.
*/
class gr_divide_cc : public gr_sync_block
{
friend gr_divide_cc_sptr gr_make_divide_cc ();
gr_divide_cc ();
public:
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif
|
//
// TableController.h
// AXRecord
//
// Created by Sylvain Malacria on 15/02/16.
// Copyright © 2016 Sylvain Malacria. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "WindowTracker.h"
@interface TableController : NSObject <NSTableViewDataSource,NSTableViewDelegate,WindowTrackerDelegate>
@property (nonatomic,strong) NSArray* snapshots;
@property (weak) IBOutlet NSTableView *tableView;
@property (weak) IBOutlet NSWindow *theWindow;
@end
|
#ifndef SMCEMODEL_H
#define SMCEMODEL_H
#include <QObject>
#include "node.h"
#include "workflow/analysismodel.h"
class SMCEModel : public AnalysisModel
{
Q_OBJECT
public:
SMCEModel();
SMCEModel(Ilwis::AnalysisPattern *p);
static AnalysisModel *create(Ilwis::AnalysisPattern *pattern);
Q_INVOKABLE QVariantMap execute(const QVariantMap parameters);
Q_INVOKABLE Node* tree() const;
private:
NEW_ANALYSISMODEL
};
#endif // SMCEMODEL_H
|
#ifndef DICTIONARYBUILDER_H
#define DICTIONARYBUILDER_H
class DictionaryBuilder
{
public:
DictionaryBuilder();
};
#endif // DICTIONARYBUILDER_H |
/*
===========================================================================
Shadow of Dust GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Shadow of Dust GPL Source Code ("Shadow of Dust Source Code").
Shadow of Dust Source Code 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.
Shadow of Dust Source 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 for more details.
You should have received a copy of the GNU General Public License
along with Shadow of Dust Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Shadow of Dust Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Shadow of Dust Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef __MATH_RANDOM_H__
#define __MATH_RANDOM_H__
#include "idlib/math/Math.h"
/*
===============================================================================
Random number generator
===============================================================================
*/
class idRandom {
public:
idRandom( int seed = 0 );
void SetSeed( int seed );
int GetSeed( void ) const;
int RandomInt( void ); // random integer in the range [0, MAX_RAND]
int RandomInt( int max ); // random integer in the range [0, max[
float RandomFloat( void ); // random number in the range [0.0f, 1.0f]
float CRandomFloat( void ); // random number in the range [-1.0f, 1.0f]
static const int MAX_RAND = 0x7fff;
private:
int seed;
};
ID_INLINE idRandom::idRandom( int seed ) {
this->seed = seed;
}
ID_INLINE void idRandom::SetSeed( int seed ) {
this->seed = seed;
}
ID_INLINE int idRandom::GetSeed( void ) const {
return seed;
}
ID_INLINE int idRandom::RandomInt( void ) {
seed = 69069 * seed + 1;
return ( seed & idRandom::MAX_RAND );
}
ID_INLINE int idRandom::RandomInt( int max ) {
if ( max == 0 ) {
return 0; // avoid divide by zero error
}
return RandomInt() % max;
}
ID_INLINE float idRandom::RandomFloat( void ) {
return ( RandomInt() / ( float )( idRandom::MAX_RAND + 1 ) );
}
ID_INLINE float idRandom::CRandomFloat( void ) {
return ( 2.0f * ( RandomFloat() - 0.5f ) );
}
/*
===============================================================================
Random number generator
===============================================================================
*/
class idRandom2 {
public:
idRandom2( unsigned long seed = 0 );
void SetSeed( unsigned long seed );
unsigned long GetSeed( void ) const;
int RandomInt( void ); // random integer in the range [0, MAX_RAND]
int RandomInt( int max ); // random integer in the range [0, max]
float RandomFloat( void ); // random number in the range [0.0f, 1.0f]
float CRandomFloat( void ); // random number in the range [-1.0f, 1.0f]
static const int MAX_RAND = 0x7fff;
private:
unsigned long seed;
static const unsigned long IEEE_ONE = 0x3f800000;
static const unsigned long IEEE_MASK = 0x007fffff;
};
ID_INLINE idRandom2::idRandom2( unsigned long seed ) {
this->seed = seed;
}
ID_INLINE void idRandom2::SetSeed( unsigned long seed ) {
this->seed = seed;
}
ID_INLINE unsigned long idRandom2::GetSeed( void ) const {
return seed;
}
ID_INLINE int idRandom2::RandomInt( void ) {
seed = 1664525L * seed + 1013904223L;
return ( (int) seed & idRandom2::MAX_RAND );
}
ID_INLINE int idRandom2::RandomInt( int max ) {
if ( max == 0 ) {
return 0; // avoid divide by zero error
}
return ( RandomInt() >> ( 16 - idMath::BitsForInteger( max ) ) ) % max;
}
ID_INLINE float idRandom2::RandomFloat( void ) {
unsigned long i;
seed = 1664525L * seed + 1013904223L;
i = idRandom2::IEEE_ONE | ( seed & idRandom2::IEEE_MASK );
return ( ( *(float *)&i ) - 1.0f );
}
ID_INLINE float idRandom2::CRandomFloat( void ) {
unsigned long i;
seed = 1664525L * seed + 1013904223L;
i = idRandom2::IEEE_ONE | ( seed & idRandom2::IEEE_MASK );
return ( 2.0f * ( *(float *)&i ) - 3.0f );
}
#endif /* !__MATH_RANDOM_H__ */
|
#ifndef MYMRTEQUILIBRIUM_H
#define MYMRTEQUILIBRIUM_H
#include <latticeInfo.h>
/**
* @file myMRTEquilibrium.h
* @author Ezequiel O. Fogliatto
* @date 23 Apr 2018
*
* Equilibrium distribution in population space
*
* @param lattice Lattice info structure
* @param T Macroscopic temperature at node
* @param U Macroscopic velocity at node
* @param alpha_1 Model constant
* @param alpha_2 Model constant
* @param f Distribution in population space. Must be allocated
*/
void myMRTEquilibrium( latticeInfo* lattice, scalar T, scalar U[3], scalar alpha_1, scalar alpha_2, scalar* f );
#endif // MYMRTEQUILIBRIUM_H
|
/**
* Copyright (c) 2006-2013 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_IMAGE_WRAP_COMRESSED_DATA_H
#define LOVE_IMAGE_WRAP_COMRESSED_DATA_H
// LOVE
#include "common/runtime.h"
#include "CompressedData.h"
namespace love
{
namespace image
{
CompressedData *luax_checkcompresseddata(lua_State *L, int idx);
int w_CompressedData_getString(lua_State *L);
int w_CompressedData_getSize(lua_State *L);
int w_CompressedData_getWidth(lua_State *L);
int w_CompressedData_getHeight(lua_State *L);
int w_CompressedData_getDimensions(lua_State *L);
int w_CompressedData_getMipmapCount(lua_State *L);
int w_CompressedData_getType(lua_State *L);
extern "C" int luaopen_compresseddata(lua_State *L);
} // image
} // love
#endif // LOVE_IMAGE_WRAP_COMRESSED_DATA_H
|
#pragma once
#include <stdint.h>
#include <BufferedSampler.h>
/*! \brief Buffered voltage divider based voltage sampler
*
* Sampler a voltage using a voltage divider, buffering values.
*/
class BufferedVDivSampler : public BufferedSampler {
public:
/*! Constructor
* \param pin the analog input pin to read samples from
* \param periodMs the number of milliseconds between samples. If update() is called
* before periodMs has passed since the last update(), no sample will be taken.
* \param samples the number of samples to keep in the ring buffer used to calculate
* average(), minimum() and maximum().
*
* Note: this class dynamically allocated memory for the ring buffer.
*/
BufferedVDivSampler(const uint8_t pin,
const uint16_t r1KOhm,
const uint16_t r2KOhm,
const float vRef=5.0,
const uint16_t periodMs=10,
const uint8_t samples=10);
//! Get the mean value in the sample set
virtual float averageVolts();
//! Get the most recent voltage value
virtual float lastVolts();
protected:
uint16_t _r1KOhm;
uint16_t _r2KOhm;
float _vRef;
};
|
#ifndef SOFTRF_DEMO1_H
#define SOFTRF_DEMO1_H
#include <nRF905.h>
#define RF_FREQ NRF905_FREQ
#define PKT_SIZE NRF905_PAYLOAD_SIZE
#define RXADDR {0x31, 0xfa , 0xb6} // Address of this device (4 bytes)
#define TXADDR {0x31, 0xfa , 0xb6} // Address of device to send to (4 bytes)
#define TIMEOUT 1000 // 1 second ping timeout
#define RRB_SIZE 10
#define LATITUDE 43.21
#define LONGTITUDE 5.43
#define ALTITUDE 12
#define MY_ACCESSPOINT_SSID ""
#define MY_ACCESSPOINT_PSK ""
#define ARGUS_HOSTNAME "192.168.157.129"
#define ARGUS_PORT 7777
#define XCSOAR_HOSTNAME "192.168.157.129" // "192.168.157.248"
#define XCSOAR_PORT 10110
#define CLOUD_HOSTNAME "192.168.157.129" // glidern1.glidernet.org
#define CLOUD_PORT 7 /* echo TCP/IP service to test response */ // 14580
#define CLOUD_MODE 0
#define STATION_ID "EGHL"
typedef struct UFO {
String raw;
time_t timestamp;
uint32_t addr;
float latitude;
float longtitude;
int32_t altitude;
unsigned int type;
int32_t vs;
float distance;
bool stealth;
bool no_track;
int8_t ns[4];
int8_t ew[4];
} ufo_t;
enum tx_state {
TX_CLEAR,
TX_DATA_READY,
TX_SENT
};
#endif /* SOFTRF_DEMO1_H */
|
#ifndef __COCO3_H__
#define __COCO3_H__
/*
Copyright 2015 by Joseph Forgione
This file is part of VCC (Virtual Color Computer).
VCC (Virtual Color Computer) 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.
VCC (Virtual Color Computer) 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 VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
*/
//unsigned short RenderFrame (unsigned char);
void SetClockSpeed(unsigned short Cycles);
void SetLinesperScreen(unsigned char Lines);
void SetHorzInteruptState(unsigned char);
void SetVertInteruptState(unsigned char);
unsigned char SetSndOutMode(unsigned char);
float RenderFrame (SystemState *);
void SetTimerInteruptState(unsigned char);
void SetTimerClockRate (unsigned char);
void SetInteruptTimer(unsigned short);
void MiscReset(void);
void PasteBASICWithNew();
void PasteBASIC();
void PasteText();
void CopyText();
void FlipArtifacts();
unsigned short SetAudioRate (unsigned short);
#endif
|
// Copyright (c) 2005 - 2017 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Return To The Roots is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef CTRLTAB_H_INCLUDED
#define CTRLTAB_H_INCLUDED
#pragma once
#include "Window.h"
#include <boost/array.hpp>
class ctrlGroup;
class MouseCoords;
class glArchivItem_Bitmap;
class ctrlTab : public Window
{
public:
ctrlTab(Window* parent, unsigned id, const DrawPoint& pos, unsigned short width);
/// fügt eine Tab hinzu.
ctrlGroup* AddTab(glArchivItem_Bitmap* image, const std::string& tooltip, const unsigned id);
/// löscht alle Tabs.
void DeleteAllTabs();
/// aktiviert eine bestimmte Tabseite.
void SetSelection(unsigned short nr, bool notify = false);
/// Gibt ID des aktuell gewählten Tabs zurück
unsigned GetCurrentTab() const { return tabs[tab_selection]; }
/// Gibt Tab-Group zurück, über die die Steuerelemente der Tab angesprochen werden können
ctrlGroup* GetGroup(const unsigned tab_id);
/// Gibt aktuell ausgewählte Tab-Gruppe zürck
ctrlGroup* GetCurrentGroup() { return GetGroup(GetCurrentTab()); }
void Msg_Group_ButtonClick(const unsigned group_id, const unsigned ctrl_id) override;
void Msg_Group_EditEnter(const unsigned group_id, const unsigned ctrl_id) override;
void Msg_Group_EditChange(const unsigned group_id, const unsigned ctrl_id) override;
void Msg_Group_TabChange(const unsigned group_id, const unsigned ctrl_id, const unsigned short tab_id) override;
void Msg_Group_ListSelectItem(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_Group_ComboSelectItem(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_Group_CheckboxChange(const unsigned group_id, const unsigned ctrl_id, const bool checked) override;
void Msg_Group_ProgressChange(const unsigned group_id, const unsigned ctrl_id, const unsigned short position) override;
void Msg_Group_ScrollShow(const unsigned group_id, const unsigned ctrl_id, const bool visible) override;
void Msg_Group_OptionGroupChange(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_Group_Timer(const unsigned group_id, const unsigned ctrl_id) override;
void Msg_Group_TableSelectItem(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_Group_TableRightButton(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_Group_TableLeftButton(const unsigned group_id, const unsigned ctrl_id, const int selection) override;
void Msg_ButtonClick(const unsigned ctrl_id) override;
bool Msg_LeftDown(const MouseCoords& mc) override;
bool Msg_LeftUp(const MouseCoords& mc) override;
bool Msg_WheelUp(const MouseCoords& mc) override;
bool Msg_WheelDown(const MouseCoords& mc) override;
bool Msg_MouseMove(const MouseCoords& mc) override;
protected:
void Draw_() override;
private:
unsigned short tab_count;
unsigned short tab_selection;
boost::array<unsigned, 20> tabs;
};
#endif // !CTRLTAB_H_INCLUDED
|
#include <stdio.h>
#define MAX 1000
int pos[MAX];
int main (void) {
int numero, posicoes, pastas;
int i, max, salto, ok;
/*Lendo o numero de posicoes e de pastas*/
scanf (" %d %d", &posicoes, &pastas);
/*Limpando o vetor de posicoes*/
for (i = 0; i < posicoes; i++)
pos[i] = 0;
/*Lendo as etiquetas das pastas*/
for (i = 0; i < pastas; i++) {
scanf("%d", &numero);
pos[numero - 1] ++;
}
/*Verificando se o padrao se aplica*/
max=pos[0];
salto=0;
ok = 1;
for (i = 1; i < posicoes && ok; i++)
if (pos[i] != max)
if (pos[i] == max - 1 && !salto) {
max = max - 1; salto = 1;
} else
ok = 0;
if (ok) printf ("S\n");
else printf ("N\n");
}
|
// biggsa.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
// CBigGsaApp:
// See biggsa.cpp for the implementation of this class
//
class CBigGsaApp : public CWinApp
{
public:
CBigGsaApp();
// Overrides
public:
virtual BOOL InitInstance();
// Implementation
DECLARE_MESSAGE_MAP()
};
extern CBigGsaApp theApp; |
//<FLAGS>
//#define __GPU
//#define __NOPROTO
//<\FLAGS>
//<INCLUDES>
#include "fargo3d.h"
//<\INCLUDES>
//#define BLOCK_X 8
//#define BLOCK_Y 8
//#define BLOCK_Z 1
// Fills forces arrays of the force experienced by the planet
void _ComputeForce_cpu(real x, real y, real z, real rsmoothing, real mass) {
//<USER_DEFINED>
INPUT(Density);
OUTPUT(Mmx);
OUTPUT(Mpx);
OUTPUT(Mmy);
OUTPUT(Mpy);
OUTPUT(Vx_temp);
OUTPUT(Vy_temp);
//<\USER_DEFINED>
//<EXTERNAL>
real* dens = Density->field_cpu;
real* fxi = Mmx->field_cpu;
real* fyi = Mpx->field_cpu;
real* fzi = Mmy->field_cpu;
real* fxhi = Mpy->field_cpu;
real* fyhi = Vx_temp->field_cpu;
real* fzhi = Vy_temp->field_cpu;
int pitch = Pitch_cpu;
int stride = Stride_cpu;
int size_x = Nx+NGHX;
int size_y = Ny+NGHY;
int size_z = Nz+NGHZ;
real rh = pow(mass/3./MSTAR, 1./3.)*sqrt(x*x+y*y+z*z);
//<\EXTERNAL>
//<INTERNAL>
int i;
int j;
int k;
int ll;
real cellmass;
real distance;
real dist2;
real dx;
real dy;
real dz;
real InvDist3;
real hill_cut;
real planet_distance;
//<\INTERNAL>
//<CONSTANT>
// real Sxj(Ny+2*NGHY);
// real Syj(Ny+2*NGHY);
// real Szj(Ny+2*NGHY);
// real Sxk(Nz+2*NGHZ);
// real Syk(Nz+2*NGHZ);
// real Szk(Nz+2*NGHZ);
// real InvVj(Ny+2*NGHY);
// real xmin(Nx+2*NGHX+1);
// real ymin(Ny+2*NGHY+1);
// real zmin(Nz+2*NGHZ+1);
//<\CONSTANT>
//<MAIN_LOOP>
i = j = k = 0;
#ifdef Z
for (k=NGHZ; k<size_z; k++) {
#endif
#ifdef Y
for (j = NGHY; j<size_y; j++) {
#endif
#ifdef X
for (i = NGHX; i<size_x; i++) {
#endif
//<#>
/* Warning: Vol(j,k) must be also used
for 2D simulations (ie: surface area). */
ll = l;
cellmass = Vol(j,k)*dens[ll];
#ifdef CARTESIAN
dx = xmed(i)-x;
dy = ymed(j)-y;
dz = zmed(k)-z;
#endif
#ifdef CYLINDRICAL
dx = ymed(j)*cos(xmed(i))-x;
dy = ymed(j)*sin(xmed(i))-y;
dz = zmed(k)-z;
#endif
#ifdef SPHERICAL
dx = ymed(j)*cos(xmed(i))*sin(zmed(k))-x;
dy = ymed(j)*sin(xmed(i))*sin(zmed(k))-y;
dz = ymed(j)*cos(zmed(k))-z;
#endif
dist2 = dx*dx+dy*dy+dz*dz;
/* New default exclusion function */
#ifdef HILLCUT
planet_distance=sqrt(dist2);
if (planet_distance/rh < 0.5)
hill_cut = 0.0;
else {
if (planet_distance > rh)
hill_cut = 1.0;
else
hill_cut = pow(sin((planet_distance/rh-.5)*M_PI),2.);
}
#endif
dist2 += rsmoothing*rsmoothing;
distance = sqrt(dist2);
InvDist3 = 1.0/(dist2*distance);
InvDist3 *= G*cellmass;
fxi[ll] = dx*InvDist3;
fyi[ll] = dy*InvDist3;
fzi[ll] = dz*InvDist3;
#ifdef HILLCUT
fxhi[ll] = dx*InvDist3*hill_cut;
fyhi[ll] = dy*InvDist3*hill_cut;
fzhi[ll] = dz*InvDist3*hill_cut;
#else
fxhi[ll] = 0.0;
fyhi[ll] = 0.0;
fzhi[ll] = 0.0;
#endif
#ifdef HALFDISK
fzi[ll] = 0.0;
fzhi[ll] = 0.0;
#endif
//<\#>
#ifdef X
}
#endif
#ifdef Y
}
#endif
#ifdef Z
}
#endif
//<\MAIN_LOOP>
//<LAST_BLOCK>
int index;
real aa = sqrt(x*x+y*y+z*z);
/*This part can be improved for 3D*/
index = (int)(((aa-Ymin(NGHY))/(Ymin(Ny+NGHY+1)-Ymin(NGHY)))*(real)Ny) + NGHY;
if (index >= NGHY) {
if(index < Ny+NGHY) {
/*Inner Force*/
localforce[0] = reduction_full_SUM(Mmx, NGHY, index, NGHZ, Nz+NGHZ);
localforce[1] = reduction_full_SUM(Mpx, NGHY, index, NGHZ, Nz+NGHZ);
localforce[2] = reduction_full_SUM(Mmy, NGHY, index, NGHZ, Nz+NGHZ);
localforce[3] = reduction_full_SUM(Mpy, NGHY, index, NGHZ, Nz+NGHZ);
localforce[4] = reduction_full_SUM(Vx_temp, NGHY, index, NGHZ, Nz+NGHZ);
localforce[5] = reduction_full_SUM(Vy_temp, NGHY, index, NGHZ, Nz+NGHZ);
/*Outer Force*/
localforce[6] = reduction_full_SUM(Mmx, index, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[7] = reduction_full_SUM(Mpx, index, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[8] = reduction_full_SUM(Mmy, index, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[9] = reduction_full_SUM(Mpy, index, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[10] = reduction_full_SUM(Vx_temp, index, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[11] = reduction_full_SUM(Vy_temp, index, Ny+NGHY, NGHZ, Nz+NGHZ);
}
/*All is Inner Force*/
else{
localforce[0] = reduction_full_SUM(Mmx, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[1] = reduction_full_SUM(Mpx, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[2] = reduction_full_SUM(Mmy, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[3] = reduction_full_SUM(Mpy, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[4] = reduction_full_SUM(Vx_temp, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[5] = reduction_full_SUM(Vy_temp, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[6] = 0.0;
localforce[7] = 0.0;
localforce[8] = 0.0;
localforce[9] = 0.0;
localforce[10] = 0.0;
localforce[11] = 0.0;
}
}
/*All is Outer Force*/
else{
localforce[0] = 0.0;
localforce[1] = 0.0;
localforce[2] = 0.0;
localforce[3] = 0.0;
localforce[4] = 0.0;
localforce[5] = 0.0;
localforce[6] = reduction_full_SUM(Mmx, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[7] = reduction_full_SUM(Mpx, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[8] = reduction_full_SUM(Mmy, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[9] = reduction_full_SUM(Mpy, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[10] = reduction_full_SUM(Vx_temp, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
localforce[11] = reduction_full_SUM(Vy_temp, NGHY, Ny+NGHY, NGHZ, Nz+NGHZ);
}
//<\LAST_BLOCK>
}
|
// $Id: def_func_node.h,v 1.2 2015/04/07 22:10:05 ist175814 Exp $ -*- c++ -*-
#ifndef __PWN_DEFFUNCNODE_H__
#define __PWN_DEFFUNCNODE_H__
#include <cdk/ast/expression_node.h>
#include <cdk/basic_type.h>
#include <cdk/ast/basic_node.h>
namespace pwn {
/**
* Class for describing noob nodes.
*/
class def_func_node: public cdk::basic_node {
pwn::decl_func_node * _func_decl ;
cdk::basic_node * _block;
public:
inline def_func_node(int lineno,pwn::decl_func_node * func_decl,cdk::basic_node * block) :
cdk::basic_node(lineno), _func_decl(func_decl), _block(block){ }
public:
inline pwn::decl_func_node * func_decl(){
return _func_decl;
}
inline cdk::basic_node * block(){
return _block;
}
void accept(basic_ast_visitor *sp, int level) {
sp->do_def_func_node(this, level);
}
};
} // pwn
#endif
|
#ifndef NODE_H
#define NODE_H
#include "Def.h"
/**
* @brief The Node class implements a node in the route.
*/
class Node {
public:
/**
* @brief The NodeTypes enum is used to choose the type of node. A TransparentNode has no regenerators, and a TranslucentNode has.
* The NodeType_Null is compliance and mustn't be used.
*/
enum NodeTypes {
NodeType_Null, TransparentNode, TranslucentNode
};
/**
* @param who is a unique identifier to the node. Should not be altered nor be repeated.
*/
Node(int);
/**
* @brief get_whoami returns the Node's unique identifier
* @return the Node's unique identifier
*/
int get_whoami();
/**
* @brief whoami is the node unique identifier
*/
int whoami;
/**
* @return the (linear) loss in the SSS element
*/
long double get_Loss();
/**
* @return the (linear) loss in the SSS element, if SS Arch, or the loss in the splitter, if BS Arch.
*/
long double get_LossSSSorDiv();
/**
* @param Config is the set of parameters over which the gain is evaluated.
* @return the (linear) gain of the Booster Amplifier.
*/
long double get_PotAmplGain(Def *Config);
/**
* @param Config is the set of parameters over which the noise is evaluated.
* @return the noise (in watts) generated by the Booster Amplifier.
*/
long double get_PotAmplNoise(Def *Config);
/**
* @brief Node::set_TransmPower configurates the power of the transmitting device in the node.
* @param power the power, in dBm, of the transmitting device.
*/
void set_TransmPower(long double);
/**
* @brief Node::set_NodeType configurates the type of node.
* @param type is either TransparentNode or TranslucentNode.
*/
void set_NodeType(NodeTypes type);
/**
* @return the type of the node
*/
NodeTypes get_NodeType();
/**
* @brief Node::set_NumberRegenerators, in translucent nodes, configurates the number of optical regenerators installed in the node.
* @param NR the number of optical regenerators installed in the node.
*/
void set_NumberRegenerators(long double);
/**
* @return the number of installed regenerators in the node.
*/
long double get_NumberRegenerators();
/**
* @return the number of regenerators in the node that aren't being used.
*/
long double get_NumberAvailableRegenerators();
/**
* @return the number of regenerators in the node that are being used.
*/
long double get_NumberUsedRegenerators();
/**
* @param BitRate is the the bit rate of the connection, in bits per second, as defined in Def::Possible_BitRates.
* @return the number greater than zero of succesfully reserved regenerators, or zero if the regenerators couldn't be reserved.
*/
long double request_Regenerators(long double BitRate); //BitRate in Gbps
/**
* @brief Node::release_Regenerators releases the regenerators that are no longer being used.
* @param NumReg is the number of regenerators to be released.
*/
void release_Regenerators(long double NumReg);
private:
long double Loss_SSS;
long double Loss_SSSorDiv;
long double PotAmplGain;
long double PotAmplNoise;
long double TransmPower;
long double NumRegenerators;
long double NumAvailableRegenerators;
long double NumUsedRegenerators;
/**
* @brief caches the value of the (linear) gain of the Booster Amplifier.
* @param Config is the set of parameters over which the gain is evaluated.
*/
void eval_PotAmplGain(Def *Config);
/**
* @brief Node::eval_PotAmplNoise caches the value of the noise power (in watts) generated by the Booster Amplifier.
*/
void eval_PotAmplNoise();
NodeTypes NodeType;
};
#endif //NODE_H
|
// <osiris_sps_source_header>
// This file is part of Osiris Serverless Portal System.
// Copyright (C)2005-2012 Osiris Team (info@osiris-sps.org) / http://www.osiris-sps.org )
//
// Osiris Serverless Portal System 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.
//
// Osiris Serverless Portal System 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 Osiris Serverless Portal System. If not, see <http://www.gnu.org/licenses/>.
// </osiris_sps_source_header>
#ifndef _OS_PYTHON_PYTHONINTERPRETER_H
#define _OS_PYTHON_PYTHONINTERPRETER_H
#include "base/object.h"
#include "boost/function.hpp"
//////////////////////////////////////////////////////////////////////
#define OS_PYTHON_FILE_EXTENSION "py"
//////////////////////////////////////////////////////////////////////
OS_NAMESPACE_BEGIN()
//////////////////////////////////////////////////////////////////////
class PythonInterpreter : public Object
{
// Construction
public:
PythonInterpreter(PyThreadState *state);
virtual ~PythonInterpreter();
// Attributes
public:
inline PyThreadState * getThreadState() const;
// Operations
public:
bool execute(const String &source, bool fileSource, const boost::function<void(const boost::python::object &)> &defaultCallback = boost::function<void(const boost::python::object &)>(), const boost::function<void(const boost::python::object &)> &errorCallback = boost::function<void(const boost::python::object &)>());
bool invoke(const boost::function<void(const boost::python::object &)> &callback, const boost::function<void(const boost::python::object &)> &errorCallback = boost::function<void(const boost::python::object &)>());
private:
PyThreadState *m_state;
scoped_ptr<boost::python::object, os_delete_t> m_module;
scoped_ptr<boost::python::object, os_delete_t> m_dictionary;
};
//////////////////////////////////////////////////////////////////////
inline PyThreadState * PythonInterpreter::getThreadState() const { return m_state; }
//////////////////////////////////////////////////////////////////////
OS_NAMESPACE_END()
//////////////////////////////////////////////////////////////////////
#endif // _OS_PYTHON_PYTHONINTERPRETER_H
|
//
// Created by youhei on 17/05/11.
//
#ifndef TERMINALRPG_CHARA_H
#define TERMINALRPG_CHARA_H
#include <string>
class Chara {
public:
Chara (std::string name,int lv, int exp, int hp, int mp, int str, int dex, int vit, int intelligent, int agi, int mnd, int luk);
std::string name ()const;
int dex ();
int agi ();
bool attack( Chara* target );
int defencePower ();
int hp ()const;
int max_hp ()const;
int mp ()const;
int max_mp ()const;
int lv()const;
int exp()const;
bool is_alive();
private:
std::string name_;
int lv_;
int exp_;
int hp_;
int max_hp_;
int mp_;
int max_mp_;
int str_;
int dex_;
int vit_;
int intelligent_;
int agi_;
int mnd_;
int luk_;
int power ();
void damaged (int power);
};
#endif //TERMINALRPG_CHARA_H
|
/*
* switch.h
*
* Minimal debouncing switch handler
*
*/
#ifndef __SWITCH_H__
#define __SWITCH_H__
#ifdef __TINY_PROC__
typedef unsigned char MUInt;
typedef signed char MInt;
#else
typedef unsigned int MUInt;
typedef signed int MInt;
#endif
typedef struct
{
unsigned char state;
MUInt (*rawsw)(void);
MUInt debsw;
}SWITCH_ST;
enum
{
SW_RELEASED,
SW_PRESSED
};
enum
{
SW1_SWITCH,
SW2_SWITCH,
SWITCHS_NUM
};
void switch_tick( void );
MUInt get_switch_state( MUInt who );
#endif
|
#ifndef _GOD_H
#define _GOD_H
#include "package.h"
#include "card.h"
#include "skill.h"
class GodPackage : public Package
{
Q_OBJECT
public:
GodPackage();
};
class GongxinCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE GongxinCard();
bool targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const;
void onEffect(const CardEffectStruct &effect) const;
};
class YeyanCard : public SkillCard
{
Q_OBJECT
public:
void damage(ServerPlayer *shenzhouyu, ServerPlayer *target, int point) const;
};
class GreatYeyanCard : public YeyanCard
{
Q_OBJECT
public:
Q_INVOKABLE GreatYeyanCard();
bool targetFilter(const QList<const Player *> &targets,const Player *to_select, const Player *Self) const;
bool targetFilter(const QList<const Player *> &targets, const Player *to_select,const Player *Self, int &maxVotes) const;
bool targetsFeasible(const QList<const Player *> &targets, const Player *Self) const;
void use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const;
};
class SmallYeyanCard : public YeyanCard
{
Q_OBJECT
public:
Q_INVOKABLE SmallYeyanCard();
bool targetsFeasible(const QList<const Player *> &targets, const Player *Self) const;
bool targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const;
void use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const;
void onEffect(const CardEffectStruct &effect) const;
};
class ShenfenCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE ShenfenCard();
void use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const;
};
class WuqianCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE WuqianCard();
bool targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const;
void onEffect(const CardEffectStruct &effect) const;
};
class QixingCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE QixingCard();
void onUse(Room *room, const CardUseStruct &card_use) const;
};
class KuangfengCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE KuangfengCard();
bool targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const;
void onEffect(const CardEffectStruct &effect) const;
};
class DawuCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE DawuCard();
bool targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const;
bool targetsFeasible(const QList<const Player *> &targets, const Player *Self) const;
void use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const;
};
class JilveCard : public SkillCard
{
Q_OBJECT
public:
Q_INVOKABLE JilveCard();
void onUse(Room *room, const CardUseStruct &card_use) const;
};
class Longhun : public ViewAsSkill
{
public:
Longhun();
bool isEnabledAtResponse(const Player *player, const QString &pattern) const;
bool isEnabledAtPlay(const Player *player) const;
bool viewFilter(const QList<const Card *> &selected, const Card *card) const;
const Card *viewAs(const QList<const Card *> &cards) const;
int getEffectIndex(const ServerPlayer *player, const Card *card) const;
bool isEnabledAtNullification(const ServerPlayer *player) const;
protected:
virtual int getEffHp(const Player *zhaoyun) const;
};
#endif
|
#ifndef QMAPWIDGET_H
#define QMAPWIDGET_H
#include "mapcontrol.h"
#include "gpx_wrapper.h"
#include <QLabel>
#include <QUndoStack>
using namespace qmapcontrol;
/**
* @addtogroup Widgets Widgets
* @brief Widgets related functions
* @{
*/
/**
* @class QMapWidget
*
* @brief MapControl subclass
*
* Extends the MapControl class.
*
* @see MapControl
*/
class QMapWidget : public MapControl
{
Q_OBJECT
public:
/**
* @brief Constructor
* @param parent Parent
* @param windowFlags Window flags
*/
explicit QMapWidget(QWidget *parent = nullptr, Qt::WindowFlags windowFlags = Qt::WindowFlags());
/**
* @brief Initializes the widget
* @note Call this function prior to any other function call
* @param gpxmw GPX_model wrapper
* @param undoStack Undo stack
* @param doPersistentCaching Enable / disable persistent caching
* @param cachePath Path to the cache directory
* @param tilesURL Tiles URL
*/
void init(GPX_wrapper *gpxmw, QUndoStack *undoStack, bool doPersistentCaching, QString &cachePath, QString &tilesURL);
/**
* @brief Generates the map according to the GPX_Model
* @param zoomIn If true zooms in
*/
void build(bool zoomIn);
/**
* @brief Clears the map
*/
void clear();
/**
* @brief Selects a track
* @param trackNumber Track number
*/
void selectTrack(int trackNumber);
/**
* @brief Sets the visibility of the selected point
* @param visible If true shows the selected point
* @param lat Latitude
* @param lon Longitude
*/
void selectedPointSetVisible(bool visible, double lat = 0.0, double lon = 0.0);
/**
* @brief Sets the view and zoom in
* @param bounds Bound rectangle
*/
void setViewAndZoomIn(const GPX_boundsType &bounds);
/**
* @brief Sets the view to the selected point
*/
void setViewAndZoomInSelectedPoint();
/**
* @brief Sets option to follow selection
* @param follow Option
*/
void setFollowSelection(bool follow);
/**
* @brief Sets option to show only selected track
* @param only Option
*/
void setShowOnlySelectedTrack(bool only);
/**
* @brief Inserts a track
* @param trackNumber Track Number
* @param track Track
*/
void insertTrack(int trackNumber, const GPX_trkType &track);
/**
* @brief Deletes a track
* @param trackNumber Track number
*/
void deleteTrack(int trackNumber);
/**
* @brief Moves a track up
* @param trackNumber Track number
*/
void moveTrackUp(int trackNumber);
/**
* @brief Moves a track down
* @param trackNumber Track number
*/
void moveTrackDown(int trackNumber);
signals:
/**
* @brief Signal when the selection changed
* @param trackNumber New selected track number
* @param trackSegmentNumber New selected track segment number
* @param lat Latitude of the selected point
* @param lon Longitude of the selected point
*/
void selectionChanged(int trackNumber, int trackSegmentNumber, double lat, double lon);
/**
* @brief Signal when the point selection changed
* @param pointNumber New point number
*/
void selectionChanged(int pointNumber);
private slots:
/**
* @brief Called when a geometry was clicked
* @param geometry Geometry clicked
* @param point Mouse coordinates
*/
void geometryClicked(Geometry* geometry, QPoint point);
/**
* @brief Called on mouse move events
* @param geometry Geometry on the mouse coordinates, nullptr if none
* @param point Mouse coordinates
*/
void geometryOver(Geometry* geometry, QPoint point);
/**
* @brief Called on a mouse button event
* @param evnt Mouse event
* @param coordinate World coordinates
*/
void mouseEventCoordinate(const QMouseEvent* evnt, const QPointF coordinate);
/**
* @brief Slot when settings are loaded or saved
*/
void settingsChanged(bool loaded);
private:
/**
* @brief Sets the visibility of the over point
* @param visible If true shows the over point
* @param trackNumber Track number
* @param trackSegmentNumber Track segment number
* @param pointNumber Point number
*/
void overPointSetVisible(bool visible, const GPX_wptType *trkpt = nullptr);
void keyPressEvent(QKeyEvent *event);
void leaveEvent(QEvent *event);
void setTilesURL(const QString &tilesURL);
private:
GPX_wrapper *gpxmw;
QUndoStack *undoStack;
QPen* pointPenSelected;
Layer* trackLayer;
Point* selectedPoint;
Point* overPoint;
QLabel* overPointWidget;
int selectedTrack;
bool followSelection;
bool showOnlySelectedTrack;
};
/** @} Widgets */
#endif // QMAPWIDGET_H
|
/*
-----------------------------------------------------------------------
Copyright: 2010-2014, iMinds-Vision Lab, University of Antwerp
2014, CWI, Amsterdam
Contact: astra@uantwerpen.be
Website: http://sf.net/projects/astra-toolbox
This file is part of the ASTRA Toolbox.
The ASTRA Toolbox 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.
The ASTRA Toolbox 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 the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------
$Id$
*/
#ifndef _INC_ASTRA_FANFLATVECPROJECTIONGEOMETRY2D
#define _INC_ASTRA_FANFLATVECPROJECTIONGEOMETRY2D
#include "ProjectionGeometry2D.h"
#include "../cuda/2d/dims.h"
#include <cmath>
// FIXME: Avoid using
using astraCUDA::SFanProjection;
namespace astra
{
/**
* This class defines a 2D fan beam geometry.
*
* \par XML Configuration
* \astra_xml_item{DetectorCount, int, Number of detectors for each projection.}
* \astra_xml_item{Vectors, matrix defining the 2D position of source and detector.}
*
* \par MATLAB example
* \astra_code{
* proj_geom = astra_struct('fanflat_vec');\n
* proj_geom.DetectorCount = 512;\n
* proj_geom.Vectors = V;\n
* }
*/
class _AstraExport CFanFlatVecProjectionGeometry2D : public CProjectionGeometry2D
{
protected:
SFanProjection *m_pProjectionAngles;
public:
/** Default constructor. Sets all variables to zero. Note that this constructor leaves the object in an unusable state and must
* be followed by a call to init().
*/
CFanFlatVecProjectionGeometry2D();
/** Constructor.
*
* @param _iProjectionAngleCount Number of projection angles.
* @param _iDetectorCount Number of detectors, i.e., the number of detector measurements for each projection angle.
* @param _pfProjectionAngles Pointer to an array of projection angles. The angles will be copied from this array.
*/
CFanFlatVecProjectionGeometry2D(int _iProjectionAngleCount,
int _iDetectorCount,
const SFanProjection* _pfProjectionAngles);
/** Copy constructor.
*/
CFanFlatVecProjectionGeometry2D(const CFanFlatVecProjectionGeometry2D& _projGeom);
/** Assignment operator.
*/
CFanFlatVecProjectionGeometry2D& operator=(const CFanFlatVecProjectionGeometry2D& _other);
/** Destructor.
*/
virtual ~CFanFlatVecProjectionGeometry2D();
/** Initialize the geometry with a config object.
*
* @param _cfg Configuration Object
* @return initialization successful?
*/
virtual bool initialize(const Config& _cfg);
/** Initialization. This function MUST be called after using the default constructor and MAY be called to
* reset a previously initialized object.
*
* @param _iProjectionAngleCount Number of projection angles.
* @param _iDetectorCount Number of detectors, i.e., the number of detector measurements for each projection angle.
* @param _pfProjectionAngles Pointer to an array of projection angles. The angles will be copied from this array.
*/
bool initialize(int _iProjectionAngleCount,
int _iDetectorCount,
const SFanProjection* _pfProjectionAngles);
virtual bool _check();
/** Create a hard copy.
*/
virtual CProjectionGeometry2D* clone();
/** Returns true if the type of geometry defined in this class is the one specified in _sType.
*
* @param _sType geometry type to compare to.
* @return true if _sType == "fanflat_vec".
*/
virtual bool isOfType(const std::string& _sType);
/** Return true if this geometry instance is the same as the one specified.
*
* @return true if this geometry instance is the same as the one specified.
*/
virtual bool isEqual(CProjectionGeometry2D*) const;
/** Get the value for t and theta, based upon the row and column index.
*
* @param _iRow row index
* @param _iColumn column index
* @param _fT output: value of t
* @param _fTheta output: value of theta, always lies within the [0,pi[ interval.
*/
virtual void getRayParams(int _iRow, int _iColumn, float32& _fT, float32& _fTheta) const;
/**
* Returns a vector describing the direction of a ray belonging to a certain detector
*
* @param _iProjectionIndex index of projection
* @param _iProjectionIndex index of detector
*
* @return a unit vector describing the direction
*/
virtual CVector3D getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex);
const SFanProjection* getProjectionVectors() const { return m_pProjectionAngles; }
};
} // namespace astra
#endif /* _INC_ASTRA_FANFLATVECPROJECTIONGEOMETRY2D */
|
/**
* @file DateTime.h
* @ingroup LoggerCpp
* @brief Current time precise to the millisecond.
*
* Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
*
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
* or copy at http://opensource.org/licenses/MIT)
*/
#pragma once
namespace LMB {
namespace Log {
/**
* @brief Current time precise to the millisecond.
* @ingroup LoggerCpp
*
* Using a struct to enable easy direct access to public members.
*
* Under Windows, the time is given to the millisecond.
* Under Linux, the time is given to the microsecond.
*/
struct DateTime {
/**
* @brief Constructor
*/
DateTime(void);
/**
* @brief Set to current time
*/
void make(void);
int year; ///< year [0,30827]
int month; ///< month [1,12]
int day; ///< day [1,31]
int hour; ///< hour [0,23]
int minute; ///< minute [0,59]
int second; ///< second [0,59]
int ms; ///< millisecond
int us; ///< microsecond (not under Windows)
};
}
} // namespace Log
|
/***************************************************************************
Copyright (c) 2007 Sergey Prokhorchuk.
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 author nor the names of contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
***************************************************************************/
#ifndef __P3DIMAGETGA_H__
#define __P3DIMAGETGA_H__
#include <ngpcore/p3dtypes.h>
#include <ngput/p3dimage.h>
class P3DImageFmtHandlerTGA : public P3DImageFmtHandler
{
public :
virtual
unsigned int FormatCount () const;
virtual
const char *FormatExt (unsigned int FormatIndex) const;
virtual
bool LoadImageData (P3DImageData *ImageData,
const char *FileName,
const char *FileExt) const;
static bool SaveAsTGA (const char *FileName,
P3DImageData *ImageData);
};
#endif
|
/*
* RTMP Diffie-Hellmann utilities
* Copyright (c) 2012 Samuel Pitoiset
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFORMAT_RTMPDH_H
#define AVFORMAT_RTMPDH_H
//#include "avformat.h"
#include "avconfig.h"
#if CONFIG_GMP || CONFIG_GCRYPT
#if CONFIG_GMP
#include <gmp.h>
typedef mpz_ptr FFBigNum;
#elif CONFIG_GCRYPT
#include <gcrypt.h>
typedef gcry_mpi_t FFBigNum;
#endif
typedef struct FF_DH {
FFBigNum p;
FFBigNum g;
FFBigNum pub_key;
FFBigNum priv_key;
long length;
} FF_DH;
#elif CONFIG_OPENSSL
#include <openssl/bn.h>
#include <openssl/dh.h>
typedef BIGNUM *FFBigNum;
typedef DH FF_DH;
#endif
/**
* Initialize a Diffie-Hellmann context.
*
* @param key_len length of the key
* @return a new Diffie-Hellmann context on success, NULL otherwise
*/
FF_DH *ff_dh_init(int key_len);
/**
* Free a Diffie-Hellmann context.
*
* @param dh a Diffie-Hellmann context to free
*/
void ff_dh_free(FF_DH *dh);
/**
* Generate a public key.
*
* @param dh a Diffie-Hellmann context
* @return zero on success, negative value otherwise
*/
int ff_dh_generate_public_key(FF_DH *dh);
/**
* Write the public key into the given buffer.
*
* @param dh a Diffie-Hellmann context, containing the public key to write
* @param pub_key the buffer where the public key is written
* @param pub_key_len the length of the buffer
* @return zero on success, negative value otherwise
*/
int ff_dh_write_public_key(FF_DH *dh, uint8_t *pub_key, int pub_key_len);
/**
* Compute the shared secret key from the private FF_DH value and the
* other party's public value.
*
* @param dh a Diffie-Hellmann context, containing the private key
* @param pub_key the buffer containing the public key
* @param pub_key_len the length of the public key buffer
* @param secret_key the buffer where the secret key is written
* @param secret_key_len the length of the secret key buffer
* @return length of the shared secret key on success, negative value otherwise
*/
int ff_dh_compute_shared_secret_key(FF_DH *dh, const uint8_t *pub_key,
int pub_key_len, uint8_t *secret_key,
int secret_key_len);
#endif /* AVFORMAT_RTMPDH_H */
|
/*
* data.h
*
* Description: Arrays containing the maps to use with A*.
*
* Author: Manuel Mager <fongog@gmail.com> (C) 2013
* Copyright: GPL v3 or later
*
*/
#ifndef DATA_H
#define DATA_H
#include <stdio.h>
#include <string.h>
#include "qdbmp.h"
#include "base.h"
int read_map(char *);
//int store_map(apath *, char *);
int data_store(aobj *);
int store_map(apath , aobj *, char*);
#endif
|
#include <stdio.h>
#include <time.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <notify.h>
#include "countdown.h"
gboolean
run_alarm (gpointer user_data)
{
time_t now;
struct tm *ts;
char buf[80];
Countdown *c;
NotifyNotification *notify;
c = (Countdown*) user_data;
notify_init ("countdown");
notify = notify_notification_new ("Times Up!",
NULL,
NULL);
notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
notify_notification_set_urgency (notify, NOTIFY_URGENCY_CRITICAL);
notify_notification_show (notify, NULL);
g_print ("Here we are!\n");
now = time (NULL);
ts = localtime (&now);
strftime (buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
puts (buf);
gtk_widget_destroy (GTK_WIDGET (c->countdown));
return FALSE;
}
void
set_timer (GtkButton* button,
gpointer user_data)
{
Countdown *c;
gchar *cunits;
GString *units;
gint mult, x;
time_t now;
struct tm *ts;
char buf[80];
c = (Countdown*) user_data;
cunits = gtk_combo_box_text_get_active_text (c->unit_box);
units = g_string_new (cunits);
if (g_string_equal (units, g_string_new("hours")))
{
mult = 3600;
}
else if (g_string_equal (units, g_string_new("minutes")))
{
mult = 60;
}
else if (g_string_equal (units, g_string_new("seconds")))
{
mult = 1;
}
else
{
mult = 1;
}
x = gtk_spin_button_get_value_as_int (c->time_entry);
g_timeout_add_seconds (x*mult, run_alarm, (gpointer)c);
g_print ("Wait %d seconds.\n", x*mult);
now = time (NULL);
ts = localtime (&now);
strftime (buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
puts (buf);
gtk_widget_hide (GTK_WIDGET (c->countdown));
// g_free(cunits);
// g_free(units);
}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "zorg.h"
void
add_line(char *line)
{
unsigned int llen = strlen(line);
if (line[0] == '#') {
/* We don't store this line, as we don't yet have anywhere to
store it; it contains the information needed to set the lines
storage up. */
parse_line(line);
} else {
// printf("adding line: %s to data filling point at %p\n", line, data_filling_point);
strcpy(data_filling_point, line);
lines[n_lines++] = data_filling_point;
parse_line(data_filling_point);
data_filling_point += (llen + 1);
}
}
void
load_remote_stream(char *stream_name)
{
/* todo:
request stream_name from the phone
get a number of lines
read all the lines, and parse them
*/
}
void
unload_remote_stream()
{
}
|
#ifndef RTC_H_
#define RTC_H_
#include "chrono.h"
#include "clock.h"
void RTC_init(bool cold_boot);
void add_minute_expired_listener(void (*)(void));
uint32_t rtc_get(void);
#endif /* RTC_H_ */ |
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* found in "../support/ngap-r16.1.0/38413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _NGAP_TAC_H_
#define _NGAP_TAC_H_
#include <asn_application.h>
/* Including external dependencies */
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
/* NGAP_TAC */
typedef OCTET_STRING_t NGAP_TAC_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_NGAP_TAC_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_NGAP_TAC;
asn_struct_free_f NGAP_TAC_free;
asn_struct_print_f NGAP_TAC_print;
asn_constr_check_f NGAP_TAC_constraint;
ber_type_decoder_f NGAP_TAC_decode_ber;
der_type_encoder_f NGAP_TAC_encode_der;
xer_type_decoder_f NGAP_TAC_decode_xer;
xer_type_encoder_f NGAP_TAC_encode_xer;
oer_type_decoder_f NGAP_TAC_decode_oer;
oer_type_encoder_f NGAP_TAC_encode_oer;
per_type_decoder_f NGAP_TAC_decode_uper;
per_type_encoder_f NGAP_TAC_encode_uper;
per_type_decoder_f NGAP_TAC_decode_aper;
per_type_encoder_f NGAP_TAC_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _NGAP_TAC_H_ */
#include <asn_internal.h>
|
#ifndef _sparse
#define _sparse
#include"stype.h"
extern obj_t *parse_exp(char *s,char **endptr);
extern obj_t *parse_source(char *s);
#endif
|
#ifndef HYBRIDIMPLEMENTATION_H
#define HYBRIDIMPLEMENTATION_H
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
#include "eventsystem.h"
/**
* \var struct HybridImplementation
* \brief Struktur fuer die Beschreibung einer Implementation ind C++ und/oder Lua
*/
struct HybridImplementation
{
/**
* \var std::string m_cpp_impl
* \brief Kennstrings anhand denen ein oder mehrere Stuecke Quellcode selektiert werden
*/
std::list<std::string> m_cpp_impl;
/**
* \var int m_lua_impl
* \brief Handle fuer Lua-Code
*/
int m_lua_impl;
HybridImplementation()
{
m_lua_impl = LUA_NOREF;
}
/**
* \brief Destructor
*/
~HybridImplementation()
{
EventSystem::clearCodeReference(m_lua_impl);
}
};
#endif
|
/*
* errors.h
*
* this file is part of GLADD
*
* Copyright (c) 2017 Brett Sheffield <brett@gladserv.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING in the distribution).
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GLADD_ERRORS_H__
#define __GLADD_ERRORS_H__ 1
#include <errno.h>
#define ERROR_CODES(X) \
X(0, ERROR_SUCCESS, "Success") \
X(1, ERROR_FAILURE, "Failure") \
X(2, ERROR_NOT_IMPLEMENTED, "Not implemented") \
X(3, ERROR_MALLOC, "Unable to allocate memory") \
X(4, ERROR_WEBSOCKET_RSVBITSET, "(websocket) Reserved bit set") \
X(5, ERROR_WEBSOCKET_BAD_OPCODE, "(websocket) Bad opcode") \
X(6, ERROR_WEBSOCKET_UNMASKED_DATA, "(websocket) Unmasked client data") \
X(7, ERROR_WEBSOCKET_CLOSE_CONNECTION, "(websocket) Connection close requested") \
X(8, ERROR_WEBSOCKET_FRAGMENTED_CONTROL, "(websocket) Fragmented control frame") \
X(9, ERROR_WEBSOCKET_UNEXPECTED_CONTINUE, "(websocket) Unexpected continuation frame") \
X(10, ERROR_WEBSOCKET_UNEXPECTED_PONG, "(websocket) Unexpected pong frame") \
X(11, ERROR_LIBRECAST_CONTEXT_NULL, "(librecast) Operation on null context") \
X(12, ERROR_LIBRECAST_CHANNEL_NOT_EXIST, "(librecast) No such channel") \
X(13, ERROR_LIBRECAST_CHANNEL_NOT_SELECTED, "(librecast) No channel selected") \
X(14, ERROR_LIBRECAST_CHANNEL_NOT_CREATED, "(librecast) Unable to create channel") \
X(15, ERROR_LIBRECAST_CHANNEL_NOT_JOINED, "(librecast) Unable to join channel") \
X(16, ERROR_LIBRECAST_LISTEN_FAIL, "(librecast) Listen failed on socket") \
X(17, ERROR_LIBRECAST_NO_SOCKET, "(librecast) No socket") \
X(18, ERROR_LIBRECAST_OPCODE_INVALID, "(librecast) Invalid opcode") \
X(19, ERROR_LIBRECAST_SOCKET_NOT_CREATED, "(librecast) Unable to create socket") \
X(20, ERROR_LIBRECAST_INVALID_SOCKET_ID, "(librecast) Invalid socket id") \
X(21, ERROR_LIBRECAST_INVALID_PARAMS, "(librecast) Invalid parameters to function")
#undef X
#define ERROR_MSG(code, name, msg) case code: return msg;
#define ERROR_ENUM(code, name, msg) name = code,
enum {
ERROR_CODES(ERROR_ENUM)
};
/* log message and return code */
int error_log(int level, int e);
/* return human readable error message for e */
char *error_msg(int e);
/* print human readable error, using errsv (errno) or progam defined (e) code */
void print_error(int e, int errsv, char *errstr);
#endif /* __GLADD_ERRORS_H__ */
|
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop 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.
It 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.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "abstractbox.h"
class UsernameBox : public AbstractBox, public RPCSender {
Q_OBJECT
public:
UsernameBox();
public slots:
void onSave();
void onCheck();
void onChanged();
void onLinkClick();
protected:
void paintEvent(QPaintEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
void showAll() override;
void doSetInnerFocus() override;
private:
void onUpdateDone(const MTPUser &result);
bool onUpdateFail(const RPCError &error);
void onCheckDone(const MTPBool &result);
bool onCheckFail(const RPCError &error);
QString getName() const;
void updateLinkText();
BoxButton _save, _cancel;
UsernameInput _username;
LinkButton _link;
mtpRequestId _saveRequestId, _checkRequestId;
QString _sentUsername, _checkUsername, _errorText, _goodText, _copiedTextLink;
Text _about;
QTimer _checkTimer;
};
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifdef __CLING__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class o2::grp::LHCIFfileReader + ;
#endif
|
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2013 James Haley et al.
//
// 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/
//
// Additional terms and conditions compatible with the GPLv3 apply. See the
// file COPYING-EE for details.
//
//-----------------------------------------------------------------------------
//
// DESCRIPTION:
// Buffered file output.
//
//-----------------------------------------------------------------------------
#ifndef M_BUFFER_H__
#define M_BUFFER_H__
// Required for: byte
#include "doomtype.h"
//
// An exception class for buffered IO errors
//
class BufferedIOException
{
protected:
const char *message;
public:
BufferedIOException(const char *pMsg) : message(pMsg) {}
const char *GetMessage() { return message; }
};
//
// BufferedFileBase
//
// Base class for buffers. Eventually I hpe to add an extra layer of indirection
// so that this can function on more than just raw physical files (for example a
// compressed data source).
//
class BufferedFileBase
{
protected:
FILE *f; // destination or source file
byte *buffer; // buffer
size_t len; // total buffer length
size_t idx; // current index
int endian; // endianness indicator
bool throwing; // throws exceptions on IO errors
bool ownFile; // buffer owns the file
void InitBuffer(size_t pLen, int pEndian);
public:
BufferedFileBase()
: f(NULL), buffer(NULL), len(0), idx(0), endian(0), throwing(false),
ownFile(false)
{
}
virtual ~BufferedFileBase()
{
if(ownFile && f)
fclose(f);
if(buffer)
{
efree(buffer);
buffer = NULL;
}
}
long Tell();
virtual void Close();
void SwapLong (int32_t &x);
void SwapShort (int16_t &x);
void SwapULong (uint32_t &x);
void SwapUShort(uint16_t &x);
void setThrowing(bool val) { throwing = val; }
bool getThrowing() const { return throwing; }
// endianness values
enum
{
NENDIAN, // doesn't swap shorts or ints
LENDIAN, // swaps shorts/ints to little endian
BENDIAN // swaps shorts/ints to big endian
};
};
//
// OutBuffer
//
// Buffered binary file output.
//
class OutBuffer : public BufferedFileBase
{
public:
bool CreateFile(const char *filename, size_t pLen, int pEndian);
bool Flush();
void Close();
bool Write(const void *data, size_t size);
bool WriteSint32(int32_t num);
bool WriteUint32(uint32_t num);
bool WriteSint16(int16_t num);
bool WriteUint16(uint16_t num);
bool WriteSint8 (int8_t num);
bool WriteUint8 (uint8_t num);
};
//
// InBuffer
//
// Buffered binary file input.
//
class InBuffer : public BufferedFileBase
{
public:
InBuffer() : BufferedFileBase()
{
}
bool openFile(const char *filename, int pEndian);
bool openExisting(FILE *f, int pEndian);
int seek(long offset, int origin);
size_t read(void *dest, size_t size);
int skip(size_t skipAmt);
bool readSint32(int32_t &num);
bool readUint32(uint32_t &num);
bool readSint16(int16_t &num);
bool readUint16(uint16_t &num);
bool readSint8 (int8_t &num);
bool readUint8 (uint8_t &num);
};
#endif
// EOF
|
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: tti_synch_cv.h
* Description: Implements tti_sync interface with condition variables.
* Reference:
*****************************************************************************/
#ifndef SRSLTE_TTI_SYNC_CV_H
#define SRSLTE_TTI_SYNC_CV_H
#include <pthread.h>
#include "srslte/common/tti_sync.h"
namespace srslte {
class tti_sync_cv : public tti_sync
{
public:
tti_sync_cv(uint32_t modulus = 10240);
~tti_sync_cv();
void increase();
void increase(uint32_t cnt);
uint32_t wait();
void resync();
void set_producer_cntr(uint32_t producer_cntr);
private:
pthread_cond_t cond;
pthread_mutex_t mutex;
};
} // namespace srslte
#endif // SRSLTE_TTI_SYNC_CV_H
|
/*
Fast Forum Backend
Copyright (C) 2016-present Daniel Jurcau
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 "ConstCollectionAdapter.h"
#include "EntityCommonTypes.h"
#include "StringHelpers.h"
#include <boost/noncopyable.hpp>
#include <boost/container/flat_set.hpp>
#include <atomic>
namespace Forum::Entities
{
class User;
class DiscussionThreadMessage;
class Attachment final : boost::noncopyable
{
public:
const auto& id() const { return id_; }
auto created() const { return created_; }
const auto& creationDetails() const { return creationDetails_; }
const auto& createdBy() const { return createdBy_; }
const auto& name() const { return name_; }
auto size() const { return size_; }
auto approved() const { return approved_; }
auto approvedAndCreated() const { return approved_ ? int64_t(-created_) : int64_t(created_); }
auto messages() const { return Helpers::toConst(messages_); }
typedef Helpers::JsonReadyStringWithSortKey<32> NameType;
enum ChangeType : uint32_t
{
None = 0,
Name,
Approval
};
struct ChangeNotification final
{
std::function<void(Attachment&)> onPrepareUpdateName;
std::function<void(Attachment&)> onUpdateName;
std::function<void(Attachment&)> onPrepareUpdateApproval;
std::function<void(Attachment&)> onUpdateApproval;
};
static auto& changeNotifications() { return changeNotifications_; }
Attachment(const IdType id, const Timestamp created, const VisitDetails creationDetails,
User& createdBy, NameType&& name, const uint64_t size, const bool approved)
: id_(id), created_(created), creationDetails_(creationDetails), createdBy_(createdBy),
name_(std::move(name)), size_(size), approved_(approved)
{}
auto& createdBy() { return createdBy_; }
void updateName(NameType&& name)
{
changeNotifications_.onPrepareUpdateName(*this);
name_ = std::move(name);
changeNotifications_.onUpdateName(*this);
}
void updateApproval(const bool approved)
{
changeNotifications_.onPrepareUpdateApproval(*this);
approved_ = approved;
changeNotifications_.onUpdateApproval(*this);
}
auto& messages() { return messages_; }
auto& nrOfGetRequests() const { return nrOfGetRequests_; }
bool addMessage(DiscussionThreadMessage* const messagePtr)
{
return messages_.insert(messagePtr).second;
}
bool removeMessage(DiscussionThreadMessage* const messagePtr)
{
return messages_.erase(messagePtr) > 0;
}
private:
static ChangeNotification changeNotifications_;
IdType id_;
Timestamp created_;
VisitDetails creationDetails_;
User& createdBy_;
NameType name_;
uint64_t size_;
bool approved_;
mutable std::atomic<uint32_t> nrOfGetRequests_{ 0 };
boost::container::flat_set<DiscussionThreadMessage*> messages_;
};
typedef Attachment* AttachmentPtr;
typedef const Attachment* AttachmentConstPtr;
}
|
#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED
#include <map>
#include <string>
#include <iostream>
template <class T> class ResourceManager
{
private:
typedef std::map <std::string,T*> ResourceMap;
ResourceMap resources;
T* get( std::string const & filename )
{
typename ResourceMap::iterator it = resources.find( filename );
if ( it != resources.end( ) )
return it->second;
return NULL;
}
public:
T* load(std::string const &filename)
{
T *res = get(filename);
if (res)
return res;
res = new T(filename);
if(!res)
{
std::cout << "Load failed: " << filename << std::endl;
return NULL;
}
resources.insert( std::make_pair( filename, res) );
return res;
}
void reload(std::string const &filename)
{
T* res = get(filename);
if (res) res->reload();
}
void reloadAll()
{
typename ResourceMap::iterator it;
for ( it = resources.begin( ); it != resources.end( ); ++it )
it->second->reload();
}
void release(std::string const &filename)
{
typename ResourceMap::iterator it = resources.find( filename );
if ( it != resources.end( ) )
{
delete it->second;
resources.erase( it );
}
}
~ResourceManager( )
{
typename ResourceMap::iterator it;
for ( it = resources.begin( ); it != resources.end( ); ++it )
delete it->second;
}
};
#endif // RESOURCE_H_INCLUDED
|
/*
* FILENAME: ifmap.h
*
* Copyright 2001 - 2002 By InterNiche Technologies Inc. All rights reserved
*
* "Database" of iface to iface mappings. These are designed as an
* administrate and configuration tool - application code can
* set up the mappings, and the lower-level driver code will use
* it to build IP tunnels, PPPoE links, and other constructions
* that involve more than one interface. A lower
* iface can be paired with more than one upper (eg PPPoE) and
* Visa-versa.
*
* ROUTINES: ifmap_bind(), ifmap_nextupper(), ifmap_nextlower(), ifmap_del(),
*
* MODULE: PPP
*
*/
#ifndef _IFMAP__H_
#define _IFMAP__H_ 1
#ifndef MAX_IFPAIRS
#define MAX_IFPAIRS MAXNETS
#endif /* MAX_IFPAIRS */
struct iface_pair
{
NET upper;
NET lower;
};
extern struct iface_pair ifpairs[MAX_IFPAIRS];
NET ifmap_nextupper(NET upper, NET lower);
NET ifmap_nextlower(NET upper, NET lower);
int ifmap_bind(NET upper, NET lower);
void ifmap_del(NET upper, NET lower);
#endif /* _IFMAP__H_ */
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: sdk/game/CStreaming.h
* PURPOSE: Game streaming interface
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CStreaming_H
#define __CStreaming_H
class CStreaming
{
public:
virtual void RequestModel ( DWORD dwModelID, DWORD dwFlags ) = 0;
virtual void LoadAllRequestedModels ( BOOL bOnlyPriorityModels = 0 ) = 0;
virtual BOOL HasModelLoaded ( DWORD dwModelID ) = 0;
virtual void RequestAnimations ( int iAnimationLibraryBlock, DWORD dwFlags ) = 0;
virtual BOOL HaveAnimationsLoaded ( int iAnimationLibraryBlock ) = 0;
virtual bool HasVehicleUpgradeLoaded ( int model ) = 0;
};
#endif
|
/*
* meal.h - Data object for a meal
*
* This file is part of Nutrition Tracker.
*
* Nutrition Tracker 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.
*
* Nutrition Tracker 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 Nutrition Tracker. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright © 2010 Tyler McHenry <tyler@nerdland.net>
*/
#ifndef MEAL_IMPL_H_
#define MEAL_IMPL_H_
#include "food_collection_impl.h"
#include "libnutrition/data/meal.h"
#include <QDate>
#include <QMap>
/* A meal is a a collection of foods associated with a unique triplet of
* (meal ID, user, date). A meal ID refers to a particular named meal, e.g.
* "Breakfast", "Lunch", "Dinner", or other user-defined identifiers. There may
* be up to one meal of each type per user per day stored in the database.
*
* A Meal object may be either database-backed or temporary. A temporary meal
* may not be saved to the database; it must instead be merged into a database-
* backed meal, if it needs to be saved. The purpose of a temporary meal is
* for "staging" creation of or additions to meals, so the user can experiment
* with different foods in a meal without operating on the live database.
*
* It may be slightly confusing that a Meal object has a userId and a
* creatorUserId. The former describes the user who ate the specific meal
* described by the object, while the latter describes the user who created the
* meal. The creatorUserId will be 0 if the meal is a standard pre-set meal
* like Breakfast, Lunch, or Dinner, and will usually match the userId if it is
* a custom meal, but this distinction allows for future expansion.
*/
class MealImpl : public FoodCollectionImpl, virtual public Meal
{
public:
MealImpl(int id, int creatorId, const QString& name, int ownerId,
const QDate& date, const QList<FoodComponent>& components,
int temporaryId = -1);
MealImpl(int id, int creatorId, const QString& name, int ownerId,
const QDate& date, int temporaryId = -1);
virtual ~MealImpl();
virtual inline bool isTemporary() const { return (temporaryId >= 0); }
virtual inline int getMealId() const { return id; }
virtual inline int getCreatorId() const { return creatorId; }
virtual inline QSharedPointer<const User> getCreator() const
{ return User::getUser(creatorId); }
virtual inline QDate getDate() const { return date; }
virtual QSharedPointer<Meal> getTemporaryClone() const;
virtual void saveToDatabase();
virtual void deleteFromDatabase();
virtual FoodData& serialize(FoodData& fdata) const;
virtual MealData serialize() const;
protected:
virtual inline int getTemporaryId() const { return temporaryId; }
private:
int id;
int creatorId;
QDate date;
int temporaryId; // If >= 0, then temporary and not backed by database
};
#endif /* MEAL_IMPL_H_ */
|
/*
* FreeRTOS Kernel V10.1.1
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/**
* This version of flash .c is for use on systems that have limited stack space
* and no display facilities. The complete version can be found in the
* Demo/Common/Full directory.
*
* Three tasks are created, each of which flash an LED at a different rate. The first
* LED flashes every 200ms, the second every 400ms, the third every 600ms.
*
* The LED flash tasks provide instant visual feedback. They show that the scheduler
* is still operational.
*
*/
#include <stdlib.h>
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo program include files. */
#include "partest.h"
#include "flash.h"
#define ledSTACK_SIZE configMINIMAL_STACK_SIZE
#define ledNUMBER_OF_LEDS ( 3 )
#define ledFLASH_RATE_BASE ( ( TickType_t ) 333 )
/* Variable used by the created tasks to calculate the LED number to use, and
the rate at which they should flash the LED. */
static volatile UBaseType_t uxFlashTaskNumber = 0;
/* The task that is created three times. */
static portTASK_FUNCTION_PROTO( vLEDFlashTask, pvParameters );
/*-----------------------------------------------------------*/
void vStartLEDFlashTasks( UBaseType_t uxPriority )
{
BaseType_t xLEDTask;
/* Create the three tasks. */
for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
{
/* Spawn the task. */
xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
}
}
/*-----------------------------------------------------------*/
static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
{
TickType_t xFlashRate, xLastFlashTime;
UBaseType_t uxLED;
/* The parameters are not used. */
( void ) pvParameters;
/* Calculate the LED and flash rate. */
portENTER_CRITICAL();
{
/* See which of the eight LED's we should use. */
uxLED = uxFlashTaskNumber;
/* Update so the next task uses the next LED. */
uxFlashTaskNumber++;
}
portEXIT_CRITICAL();
xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( TickType_t ) uxLED );
xFlashRate /= portTICK_PERIOD_MS;
/* We will turn the LED on and off again in the delay period, so each
delay is only half the total period. */
xFlashRate /= ( TickType_t ) 2;
/* We need to initialise xLastFlashTime prior to the first call to
vTaskDelayUntil(). */
xLastFlashTime = xTaskGetTickCount();
for(;;)
{
/* Delay for half the flash period then turn the LED on. */
vTaskDelayUntil( &xLastFlashTime, xFlashRate );
vParTestToggleLED( uxLED );
/* Delay for half the flash period then turn the LED off. */
vTaskDelayUntil( &xLastFlashTime, xFlashRate );
vParTestToggleLED( uxLED );
}
} /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <string>
#include "FlipperConnection.h"
namespace facebook {
namespace flipper {
class FlipperPlugin {
public:
virtual ~FlipperPlugin() {}
/**
The plugin's identifier. This should map to a javascript plugin
with the same identifier to ensure messages are sent correctly.
*/
virtual std::string identifier() const = 0;
/**
Called when a connection has been established between this plugin
and the corresponding plugin on the Flipper desktop app. The provided
connection can be used to register method receivers as well as send
messages back to the desktop app.
*/
virtual void didConnect(std::shared_ptr<FlipperConnection> conn) = 0;
/**
Called when a plugin has been disconnected and the FlipperConnection
provided in didConnect is no longer valid to use.
*/
virtual void didDisconnect() = 0;
/**
Returns true if the plugin is meant to be run in background too, otherwise it
returns false.
*/
virtual bool runInBackground() {
return false;
}
};
} // namespace flipper
} // namespace facebook
|
//
// Copyright (c) 2015 Yunzhu Li.
//
// You can redistribute it and/or modify it under the terms
// of the GNU General Public License version 3 as published
// by the Free Software Foundation.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this file.
// If not, see http://www.gnu.org/licenses/.
//
#ifndef IMOPENSSL_H
#define IMOPENSSL_H
#include <QObject>
// Unified return type
struct IMOpenSSLResultSet
{
int statusCode;
QString message;
};
class IMOpenSSL : public QObject
{
Q_OBJECT
public:
explicit IMOpenSSL(QObject *parent = 0);
~IMOpenSSL();
// Get OpenSSL version information
static QString getVersionString();
// Set OpenSSL binary path
static bool setBinaryPath(QString path);
// Get OpenSSL binary path
static QString getBinaryPath();
// Get symmetric cipher types
static QStringList scCipherTypes();
// Perform symmetric cipher operation
static IMOpenSSLResultSet scOperation(QString ciphername, QString in, QString out, QString pass, bool decrypt, bool base64, bool nosalt);
// Get message digest types
static QStringList digestTypes();
// Perform message digest operation
static IMOpenSSLResultSet digestOperation(QString digestName, QString inFile, QString inString);
// Get RSA key sizes
static QStringList rsaKeySizes();
// Gene RSA key-pair
static IMOpenSSLResultSet rsaGenerateKey(QString out, QString encryption, QString pass, QString keyLength);
private:
static QString mBinaryPath;
};
#endif // IMOPENSSL_H
|
// Events.h
#pragma once
namespace WPD {
ref class PortableDevice;
class EventSink : public IPortableDeviceEventCallback
{
ULONG refs;
gcroot<PortableDevice^> dev;
public:
EventSink(PortableDevice ^dev)
{
this->dev = dev;
refs = 1;
}
HRESULT __stdcall QueryInterface(REFIID riid, void **ppv)
{
if (!ppv)
return E_INVALIDARG;
if (riid == IID_IUnknown || riid == IID_IPortableDeviceEventCallback)
{
AddRef();
*ppv = this;
return S_OK;
}
return E_NOINTERFACE;
}
ULONG __stdcall AddRef()
{
InterlockedIncrement((long*)&refs);
return refs;
}
ULONG __stdcall Release()
{
ULONG newRefs = refs - 1;
if (InterlockedDecrement((long*)&refs) == 0)
{
delete this;
return 0;
}
return newRefs;
}
HRESULT __stdcall OnEvent(IPortableDeviceValues *params);
};
} |
// Copyright (c) 2003,2004,2005,2006 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
#ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_SAME_POINTS_C2_H
#define CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_SAME_POINTS_C2_H
#include <CGAL/license/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_2/basic.h>
namespace CGAL {
namespace SegmentDelaunayGraph_2 {
template<class K>
class Are_same_points_C2
{
private:
typedef typename K::Point_2 Point_2;
typedef typename K::Segment_2 Segment_2;
typedef typename K::Site_2 Site_2;
typedef typename K::Compare_x_2 Compare_x_2;
typedef typename K::Compare_y_2 Compare_y_2;
typedef typename K::Boolean Boolean;
typedef typename K::Intersections_tag ITag;
Compare_x_2 compare_x_2;
Compare_y_2 compare_y_2;
Boolean are_same(const Point_2& p, const Point_2& q) const
{
return
compare_x_2(p, q) == EQUAL && compare_y_2(p, q) == EQUAL;
}
Boolean are_same(const Site_2& s, const Site_2& t) const
{
return
( are_same(s.source(), t.source()) &&
are_same(s.target(), t.target()) ) ||
( are_same(s.source(), t.target()) &&
are_same(s.target(), t.source()) );
}
Boolean predicate(const Site_2& p, const Site_2& q, const Tag_false&) const
{
return are_same(p.point(), q.point());
}
Boolean predicate(const Site_2& p, const Site_2& q, const Tag_true&) const
{
if ( !p.is_input() && !q.is_input() ) {
Site_2 s[2] = { p.supporting_site(0), p.supporting_site(1) };
Site_2 t[2] = { q.supporting_site(0), q.supporting_site(1) };
if ( ( are_same(s[0], t[0]) && are_same(s[1], t[1]) ) ||
( are_same(s[0], t[1]) && are_same(s[1], t[0]) ) ) {
return true;
}
}
return predicate(p, q, Tag_false());
}
public:
typedef Boolean result_type;
typedef Site_2 argument_type;
Boolean operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_point() && q.is_point() );
return predicate(p, q, ITag());
}
};
} //namespace SegmentDelaunayGraph_2
} //namespace CGAL
#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARE_SAME_POINTS_C2_H
|
#ifndef ABSTRACTFILE_H
#define ABSTRACTFILE_H
#include <xpwn-hfs-1.0/common.h>
#include <stdint.h>
typedef struct AbstractFile AbstractFile;
typedef struct AbstractFile2 AbstractFile2;
typedef size_t (*WriteFunc)(AbstractFile* file, const void* data, size_t len);
typedef size_t (*ReadFunc)(AbstractFile* file, void* data, size_t len);
typedef int (*SeekFunc)(AbstractFile* file, off_t offset);
typedef off_t (*TellFunc)(AbstractFile* file);
typedef void (*CloseFunc)(AbstractFile* file);
typedef off_t (*GetLengthFunc)(AbstractFile* file);
typedef void (*SetKeyFunc)(AbstractFile2* file, const unsigned int* key, const unsigned int* iv);
typedef enum AbstractFileType {
AbstractFileTypeFile,
AbstractFileType8900,
AbstractFileTypeImg2,
AbstractFileTypeImg3,
AbstractFileTypeLZSS,
AbstractFileTypeIBootIM,
AbstractFileTypeMem,
AbstractFileTypeMemFile,
AbstractFileTypeDummy
} AbstractFileType;
struct AbstractFile {
void* data;
WriteFunc write;
ReadFunc read;
SeekFunc seek;
TellFunc tell;
GetLengthFunc getLength;
CloseFunc close;
AbstractFileType type;
};
struct AbstractFile2 {
AbstractFile super;
SetKeyFunc setKey;
};
typedef struct {
size_t offset;
void** buffer;
size_t bufferSize;
} MemWrapperInfo;
typedef struct {
size_t offset;
void** buffer;
size_t* bufferSize;
size_t actualBufferSize;
} MemFileWrapperInfo;
#ifdef __cplusplus
extern "C" {
#endif
AbstractFile* createAbstractFileFromFile(FILE* file);
AbstractFile* createAbstractFileFromDummy();
AbstractFile* createAbstractFileFromMemory(void** buffer, size_t size);
AbstractFile* createAbstractFileFromMemoryFile(void** buffer, size_t* size);
AbstractFile* createAbstractFileFromMemoryFileBuffer(void** buffer, size_t* size, size_t actualBufferSize);
void abstractFilePrint(AbstractFile* file, const char* format, ...);
io_func* IOFuncFromAbstractFile(AbstractFile* file);
#ifdef __cplusplus
}
#endif
#endif
|
/** \file
* \brief Declaration of planarization with grid layout.
*
* \author Carsten Gutwenger
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.md in the OGDF root directory for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, see
* http://www.gnu.org/copyleft/gpl.html
*/
#pragma once
#include <ogdf/module/GridLayoutModule.h>
#include <memory>
#include <ogdf/module/CrossingMinimizationModule.h>
#include <ogdf/module/CCLayoutPackModule.h>
namespace ogdf {
/**
* \brief The planarization grid layout algorithm.
*
* @ingroup gd-planlayout
*
* The class PlanarizationGridLayout represents a customizable implementation
* of the planarization approach for drawing graphs. The class uses a
* planar grid layout algorithm as a subroutine and allows to generate
* a usual layout or a grid layout.
*
* If the planarization layout algorithm shall be used for simultaneous drawing,
* you need to define the different subgraphs by setting the <i>subgraphs</i>
* option.
*
* The implementation used in PlanarizationGridLayout is based on the following
* publication:
*
* C. Gutwenger, P. Mutzel: <i>An Experimental Study of Crossing
* Minimization Heuristics</i>. 11th International Symposium on %Graph
* Drawing 2003, Perugia (GD '03), LNCS 2912, pp. 13-24, 2004.
*
* <H3>Optional parameters</H3>
*
* <table>
* <tr>
* <th><i>Option</i><th><i>Type</i><th><i>Default</i><th><i>Description</i>
* </tr><tr>
* <td><i>pageRatio</i><td>double<td>1.0
* <td>Specifies the desired ration of width / height of the computed
* layout. It is currently only used when packing connected components.
* </tr>
* </table>
*
* <H3>%Module options</H3>
* The various phases of the algorithm can be exchanged by setting
* module options allowing flexible customization. The algorithm provides
* the following module options:
*
* <table>
* <tr>
* <th><i>Option</i><th><i>Type</i><th><i>Default</i><th><i>Description</i>
* </tr><tr>
* <td><i>crossMin</i><td>CrossingMinimizationModule<td>SubgraphPlanarizer
* <td>The module used for the crossing minimization step.
* </tr><tr>
* <td><i>planarLayouter</i><td>GridLayoutPlanRepModule<td>MixedModelLayout
* <td>The planar layout algorithm used to compute a planar layout
* of the planarized representation resulting from the crossing minimization step.
* </tr><tr>
* <td><i>packer</i><td>CCLayoutPackModule<td>TileToRowsCCPacker
* <td>The packer module used for arranging connected components.
* </tr>
* </table>
*/
class OGDF_EXPORT PlanarizationGridLayout : public GridLayoutModule
{
public:
//! Creates an instance of planarization layout and sets options to default values.
PlanarizationGridLayout();
~PlanarizationGridLayout() { }
/**
* @name Optional parameters
* @{
*/
/**
* \brief Returns the current setting of option pageRatio.
*
* This option specifies the desired ration width / height of the computed
* layout. It is currently only used for packing connected components.
*/
double pageRatio() const {
return m_pageRatio;
}
//! Sets the option pageRatio to \p ratio.
void pageRatio(double ratio) {
m_pageRatio = ratio;
}
/** @}
* @name Module options
* @{
*/
//! Sets the module option for crossing minimization.
void setCrossMin(CrossingMinimizationModule *pCrossMin) {
m_crossMin.reset(pCrossMin);
}
/**
* \brief Sets the module option for the planar grid layout algorithm.
*
* The planar layout algorithm is used to compute a planar layout
* of the planarized representation resulting from the crossing
* minimization step. Planarized representation means that edge crossings
* are replaced by dummy nodes of degree four, so the actual layout
* algorithm obtains a planar graph as input. By default, the planar
* layout algorithm produces an orthogonal drawing.
*/
void setPlanarLayouter(GridLayoutPlanRepModule *pPlanarLayouter) {
m_planarLayouter.reset(pPlanarLayouter);
}
/**
* \brief Sets the module option for the arrangement of connected components.
*
* The planarization layout algorithm draws each connected component of
* the input graph seperately, and then arranges the resulting drawings
* using a packing algorithm.
*/
void setPacker(CCLayoutPackModule *pPacker) {
m_packer.reset(pPacker);
}
/** @}
* @name Further information
* @{
*/
//! Returns the number of crossings in computed layout.
int numberOfCrossings() const {
return m_nCrossings;
}
//! @}
protected:
virtual void doCall(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox) override;
private:
//! The module for computing a planar subgraph.
std::unique_ptr<CrossingMinimizationModule> m_crossMin;
//! The module for computing a planar grid layout.
std::unique_ptr<GridLayoutPlanRepModule> m_planarLayouter;
//! The module for arranging connected components.
std::unique_ptr<CCLayoutPackModule> m_packer;
double m_pageRatio; //!< The desired page ratio.
int m_nCrossings; //!< The number of crossings in the computed layout.
};
} // end namespace ogdf
|
#ifndef TYPE_CONTAINER_ARRAY_ITERATOR_DEFINITION_H_
#define TYPE_CONTAINER_ARRAY_ITERATOR_DEFINITION_H_
#include <cstddef>
#include <array>
#include "type/container/array/iterator/definition/ConstIterator.h"
#include "type/container/array/iterator/definition/Iterator.h"
#include "type/iterator/derived/definition/Base.h"
namespace BrainMuscles
{
namespace type
{
namespace container
{
namespace array
{
namespace iterator
{
template<typename TYPE, std::size_t SIZE, typename HANDLE_TYPE>
struct Definition :
public BrainMuscles::type::iterator::derived::definition::Base
{
typedef void Type;
typedef void ReferenceType;
typedef void PointerType;
typedef void ConstReferenceType;
typedef void ConstPointerType;
};
template<typename TYPE, std::size_t SIZE>
struct Definition<TYPE, SIZE, typename std::array<TYPE, SIZE>::const_iterator> :
public BrainMuscles::type::container::array::iterator::definition::ConstIterator<TYPE, SIZE>
{
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::Type Type;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ReferenceType ReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::PointerType PointerType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ConstReferenceType ConstReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ConstPointerType ConstPointerType;
};
template<typename TYPE, std::size_t SIZE>
struct Definition<TYPE, SIZE, typename std::array<TYPE, SIZE>::const_reverse_iterator> :
public BrainMuscles::type::container::array::iterator::definition::ConstIterator<TYPE, SIZE>
{
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::Type Type;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ReferenceType ReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::PointerType PointerType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ConstReferenceType ConstReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::ConstIterator<TYPE, SIZE>::ConstPointerType ConstPointerType;
};
template<typename TYPE, std::size_t SIZE>
struct Definition<TYPE, SIZE, typename std::array<TYPE, SIZE>::iterator> :
public BrainMuscles::type::container::array::iterator::definition::Iterator<TYPE, SIZE>
{
typedef typename BrainMuscles::type::container::array::iterator
::definition::Iterator<TYPE, SIZE>::Type Type;
typedef typename BrainMuscles::type::container::array::iterator
::definition::Iterator<TYPE, SIZE>::ReferenceType ReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::Iterator<TYPE, SIZE>::PointerType PointerType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::Iterator<TYPE, SIZE>::ConstReferenceType ConstReferenceType;
typedef typename BrainMuscles::type::container::array::iterator
::definition::Iterator<TYPE, SIZE>::ConstPointerType ConstPointerType;
};
template<typename TYPE, std::size_t SIZE>
struct Definition<TYPE, SIZE, typename std::array<TYPE, SIZE>::reverse_iterator> :
public BrainMuscles::type::container::array::iterator::definition::Iterator<TYPE, SIZE>
{
typedef typename BrainMuscles::type::container::array
::iterator::definition::Iterator<TYPE, SIZE>::Type Type;
typedef typename BrainMuscles::type::container::array
::iterator::definition::Iterator<TYPE, SIZE>::ReferenceType ReferenceType;
typedef typename BrainMuscles::type::container::array
::iterator::definition::Iterator<TYPE, SIZE>::PointerType PointerType;
typedef typename BrainMuscles::type::container::array
::iterator::definition::Iterator<TYPE, SIZE>::ConstReferenceType ConstReferenceType;
typedef typename BrainMuscles::type::container::array
::iterator::definition::Iterator<TYPE, SIZE>::ConstPointerType ConstPointerType;
};
}
}
}
}
}
#endif //!TYPE_CONTAINER_ARRAY_ITERATOR_DEFINITION_H_ |
#ifndef __DIAGONALIZER_COMPLEX_H
#define __DIAGONALIZER_COMPLEX_H
#include <Eigen/Core>
class DiagonalizerComplex
{
public:
virtual void diagonalize(const Eigen::MatrixXcd& m, Eigen::MatrixXcd& eigenvectors, Eigen::VectorXcd& eigenvalues) = 0;
virtual ~DiagonalizerComplex(){};
};
#endif // __DIAGONALIZER_COMPLEX_H
|
/******************************************************************************
* Copyright (c) 2011-2014 Artur Molchanov <artur.molchanov@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************/
#ifndef STATINFOW_H
#define STATINFOW_H
#include "Compressor/compressor.h"
#include <QDialog>
class QTableWidget;
class QLabel;
class StatInfoW : public QDialog {
Q_OBJECT
public:
struct StatInfo {
QList<Compressor::CoderTypes> compressSequence;
unsigned int blockSize;
off_t inputSize;
off_t outputSize;
float speed;
};
StatInfoW(QWidget* parent = NULL);
virtual ~StatInfoW();
public slots:
void showInfo(StatInfo info);
private:
QLabel* blockSizeLabel;
QLabel* inputDataSizeLabel;
QLabel* outputDataSizeLabel;
QLabel* ratioLabel;
QLabel* speedLabel;
QLabel* encodingSequenceLabel;
QLabel* encodingSequenceColumnLabel;
};
#endif /* STATINFOW_H */
|
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file NoiseMap.h
/// \brief Definition of the ITSMFT NoiseMap
#ifndef ALICEO2_ITSMFT_NOISEMAP_H
#define ALICEO2_ITSMFT_NOISEMAP_H
#include "Rtypes.h" // for Double_t, ULong_t, etc
#include <iostream>
#include <climits>
#include <vector>
#include <map>
#include "gsl/span"
namespace o2
{
namespace itsmft
{
class CompClusterExt;
/// \class NoiseMap
/// \brief NoiseMap class for the ITS and MFT
///
class NoiseMap
{
public:
/// Constructor, initializing values for position, charge and readout frame
NoiseMap(std::vector<std::map<int, int>>& noise) { mNoisyPixels.swap(noise); }
/// Constructor
NoiseMap() = default;
/// Constructor
NoiseMap(int nchips)
{
mNoisyPixels.assign(nchips, std::map<int, int>());
}
/// Destructor
~NoiseMap() = default;
/// Get the noise level for this pixels
float getNoiseLevel(int chip, int row, int col) const
{
if (chip > (int)mNoisyPixels.size()) {
return 0;
}
const auto keyIt = mNoisyPixels[chip].find(getKey(row, col));
if (keyIt != mNoisyPixels[chip].end()) {
return keyIt->second;
}
return 0;
}
void increaseNoiseCount(int chip, int row, int col)
{
if (chip > (int)mNoisyPixels.size()) {
return;
}
mNoisyPixels[chip][getKey(row, col)]++;
}
int dumpAboveThreshold(int t = 3) const
{
int n = 0;
auto chipID = mNoisyPixels.size();
while (chipID--) {
const auto& map = mNoisyPixels[chipID];
for (const auto& pair : map) {
if (pair.second <= t) {
continue;
}
n++;
auto key = pair.first;
auto row = key2Row(key);
auto col = key2Col(key);
std::cout << "chip, row, col, noise: " << chipID << ' ' << row << ' ' << col << ' ' << pair.second << '\n';
}
}
return n;
}
int dumpAboveProbThreshold(float p = 1e-7) const
{
return dumpAboveThreshold(p * mNumOfStrobes);
}
void applyProbThreshold(float t, long int n)
{
// Remove from the maps all pixels with the firing probability below the threshold
mProbThreshold = t;
mNumOfStrobes = n;
for (auto& map : mNoisyPixels) {
for (auto it = map.begin(); it != map.end();) {
float prob = float(it->second) / mNumOfStrobes;
if (prob < mProbThreshold) {
it = map.erase(it);
} else {
++it;
}
}
}
}
float getProbThreshold() const { return mProbThreshold; }
long int getNumOfStrobes() const { return mNumOfStrobes; }
bool isNoisy(int chip, int row, int col) const
{
return chip < (int)mNoisyPixels.size() && (mNoisyPixels[chip].find(getKey(row, col)) != mNoisyPixels[chip].end());
}
bool isNoisy(int chip) const { return chip < (int)mNoisyPixels.size() && !mNoisyPixels[chip].empty(); }
// Methods required by the calibration framework
void print();
void fill(const gsl::span<const CompClusterExt> data);
void merge(const NoiseMap* prev) {}
const std::map<int, int>* getChipMap(int chip) const { return chip < (int)mNoisyPixels.size() ? &mNoisyPixels[chip] : nullptr; }
private:
static constexpr int SHIFT = 10, MASK = (0x1 << SHIFT) - 1;
int getKey(int row, int col) const { return (row << SHIFT) + col; }
int key2Row(int key) const { return key >> SHIFT; }
int key2Col(int key) const { return key & MASK; }
std::vector<std::map<int, int>> mNoisyPixels; ///< Internal noise map representation
long int mNumOfStrobes = 0; ///< Accumulated number of ALPIDE strobes
float mProbThreshold = 0; ///< Probability threshold for noisy pixels
ClassDefNV(NoiseMap, 2);
};
} // namespace itsmft
} // namespace o2
#endif /* ALICEO2_ITSMFT_NOISEMAP_H */
|
#include "../../../../../src/render/framegraph/qmemorybarrier_p.h"
|
#include "modload.h"
/*
#include "../cw/mod.h"
#include "cipwap/mod_cipwap.h"
#include "capwap/mod_capwap.h"
#include "cisco/mod_cisco.h"
#include "capwap80211/mod_capwap80211.h"
#define MODS_AC { mod_capwap_ac,mod_cipwap_ac, mod_cisco_ac, mod_capwap80211_ac, NULL }
*/
struct mod_ac *(*mods_ac[])() = MODS_AC;
struct mod_ac * modload_ac(const char *name)
{
int i;
for (i=0; mods_ac[i];i++){
struct mod_ac * m = mods_ac[i]();
if (strcmp(m->name,name)==0)
return m;
}
return NULL;
}
|
/* -*- c++ -*- */
/*
* Copyright 2005 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_CHAR_TO_FLOAT_H
#define INCLUDED_GR_CHAR_TO_FLOAT_H
#include <gr_core_api.h>
#include <gr_sync_block.h>
class gr_char_to_float;
typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr;
GR_CORE_API gr_char_to_float_sptr
gr_make_char_to_float (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of chars to a stream of float
* \ingroup converter_blk
*
* \param vlen vector length of data streams.
* \param scale a scalar divider to change the output signal scale.
*/
class GR_CORE_API gr_char_to_float : public gr_sync_block
{
private:
friend GR_CORE_API gr_char_to_float_sptr
gr_make_char_to_float (size_t vlen, float scale);
gr_char_to_float (size_t vlen, float scale);
size_t d_vlen;
float d_scale;
public:
/*!
* Get the scalar divider value.
*/
float scale() const;
/*!
* Set the scalar divider value.
*/
void set_scale(float scale);
virtual int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /* INCLUDED_GR_CHAR_TO_FLOAT_H */
|
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
// W A R N I N G
// -------------
//
// This file is not part of the Qt Chart API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef CHARTCOLORAXISX_H
#define CHARTCOLORAXISX_H
#include <private/horizontalaxis_p.h>
#include <QtCharts/private/qchartglobal_p.h>
QT_BEGIN_NAMESPACE
class QColorAxis;
class Q_CHARTS_PRIVATE_EXPORT ChartColorAxisX : public HorizontalAxis
{
Q_OBJECT
public:
ChartColorAxisX(QColorAxis *axis, QGraphicsItem* item = 0);
~ChartColorAxisX();
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const override;
protected:
QList<qreal> calculateLayout() const override;
void updateGeometry() override;
private:
QColorAxis *m_axis;
};
QT_END_NAMESPACE
#endif // CHARTCOLORAXISX_H
|
/* Internals of a lightweight menubar widget.
Copyright (C) 2002-2011 Free Software Foundation, Inc.
Copyright (C) 1992 Lucid, Inc.
This file is part of the Lucid Widget Library.
The Lucid Widget Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
The Lucid Widget Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef _XlwMenuP_h
#define _XlwMenuP_h
#include "xlwmenu.h"
#include <X11/CoreP.h>
#ifdef HAVE_XFT
#include <X11/Xft/Xft.h>
#endif
/* Elements in the stack arrays. */
typedef struct _window_state
{
Widget w;
Window window;
Pixmap pixmap;
Position x;
Position y;
Dimension width;
Dimension height;
Dimension label_width;
int max_rest_width;
/* Width of toggle buttons or radio buttons. */
Dimension button_width;
#ifdef HAVE_XFT
XftDraw* xft_draw;
#endif
} window_state;
/* New fields for the XlwMenu widget instance record */
typedef struct _XlwMenu_part
{
/* slots set by the resources */
#ifdef HAVE_X_I18N
XFontSet fontSet;
XFontSetExtents *font_extents;
#endif
#ifdef HAVE_XFT
int default_face;
XftFont* xft_font;
XftColor xft_fg, xft_bg, xft_disabled_fg;
#endif
String fontName;
XFontStruct* font;
Pixel foreground;
Pixel disabled_foreground;
Pixel button_foreground;
Dimension margin;
Dimension horizontal_spacing;
Dimension vertical_spacing;
Dimension arrow_spacing;
Dimension shadow_thickness;
Pixel top_shadow_color;
Pixel bottom_shadow_color;
Pixmap top_shadow_pixmap;
Pixmap bottom_shadow_pixmap;
Cursor cursor_shape;
XtCallbackList open;
XtCallbackList select, highlight;
XtCallbackList enter, leave;
widget_value* contents;
int horizontal;
/* True means top_shadow_color and/or bottom_shadow_color must be freed. */
unsigned free_top_shadow_color_p : 1;
unsigned free_bottom_shadow_color_p : 1;
/* State of the XlwMenu */
int top_depth;
int old_depth;
widget_value** old_stack;
int old_stack_length;
widget_value* inside_entry;
/* New state after the user moved */
int new_depth;
widget_value** new_stack;
int new_stack_length;
/* Window resources */
window_state* windows;
int windows_length;
/* Internal part, set by the XlwMenu */
GC foreground_gc;
GC button_gc;
GC background_gc;
GC disabled_gc;
GC inactive_button_gc;
GC shadow_top_gc;
GC shadow_bottom_gc;
Cursor cursor;
Boolean popped_up;
Pixmap gray_pixmap;
} XlwMenuPart;
/* Full instance record declaration */
typedef struct _XlwMenuRec
{
CorePart core;
XlwMenuPart menu;
} XlwMenuRec;
/* New fields for the XlwMenu widget class record */
typedef struct
{
int dummy;
} XlwMenuClassPart;
/* Full class record declaration. */
typedef struct _XlwMenuClassRec
{
CoreClassPart core_class;
XlwMenuClassPart menu_class;
} XlwMenuClassRec;
/* Class pointer. */
extern XlwMenuClassRec xlwMenuClassRec;
#endif /* _XlwMenuP_h */
|
#pragma once
class Viteza
{
public:
Viteza();
double kmh_To_mph(double value, bool invereConversion);
double kmh_To_fts(double value, bool invereConversion);
double kmh_To_kmh(double value, bool invereConversion);
double kmh_To_kms(double value, bool invereConversion);
double kmh_To_ms(double value, bool invereConversion);
double kmh_To_kn(double value, bool invereConversion);
double convertMetric(double value, CString unit, bool inverseConversion);
};
|
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 University of Houston. All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/group/group.h"
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Group_difference = PMPI_Group_difference
#endif
#define MPI_Group_difference PMPI_Group_difference
#endif
static const char FUNC_NAME[] = "MPI_Group_difference";
int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
MPI_Group *new_group) {
int err;
/* error checking */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
(NULL == group1) || (NULL == group2) ||
(NULL == new_group) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
FUNC_NAME);
}
}
err = ompi_group_difference ( group1, group2, new_group );
OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME );
}
|
#ifndef FUNC_MATRYCA_H_INCLUDED
#define FUNC_MATRYCA_H_INCLUDED
#include "../src/ws2812b_disp.cpp" // matryca 16x16 LED#include "include/interaction.h" // Logo ZST, zegar
#include "litery.h" // Logo ZST, zegar
inline void ZST( int fd, uint32_t *xRGB, int LEDcolor );
void animationRectangle( int fd, uint32_t *xRGB, int LEDcolor );
void animationZST( int fd, uint32_t *xRGB, int LEDcolor );
inline void Numbers( uint32_t *xRGB, int number, int x, int y, int LEDcolor);
inline void Sec( uint32_t *xRGB, int sec, int LEDcolor);
inline void clearNumber( uint32_t *xRGB, int x, int y);
void zegar( int fd, uint32_t *xRGB );
void Menu( int fd, uint32_t *xRGB );
void show_color( int fd, uint32_t *xRGB, uint32_t color );
void police( int fd, uint32_t *xRGB, int licznik, int refresh );
void rainbow( int fd, uint32_t *xRGB );
#endif // FUNC_MATRYCA_H_INCLUDED
|
/*
* Copyright 2011 Emanuel Ey <emanuel.ey@gmail.com>
*
* This file is part of matOut.
*
* MatOut 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.
*
* MatOut 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 matOut. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdio.h>
#include <stdint.h>
#include "matOut.h"
#include "dataElementSize.c"
uint32_t calcArraySize(mxArray* inArray);
uint32_t calcArraySize(mxArray* inArray){
/*
* Calculates the total size in Bytes which is required to
* contain a struct array and its children.
* NOTE: this function is recursive, as it will call itself to
* determine the size required by the struct's children.
* NOTE: an mxArray's name is not known before the call to
* matPutVariable which writes it to a file, so the
* number of bytes needed to write an mxArray's name
* is not calculated in this function.
* This is actually not very important, as array names
* are only written for mxArrays which aren't members
* in a structure.
*/
uintptr_t nBytes = 0;
uintptr_t maxLengthFieldname = 0;
if (inArray == NULL){
//printf("calcArraySize(): received null pointer: ");
/*
* Size required by an empty mxArray:
* NOTE: empty arrays are written to the matfile by writeEmptyArray()
*/
nBytes += 8; //header: "miMatrix"[4B]; "size"[4B]
nBytes += 16; //Array flags: "miUINT32"[4B]; "8"[4B]; "flags+mxCLASS"[4B]; "undefined"[4B]
nBytes += 16; //2D dimensions (1x1)
nBytes += 8; //empty array name "miINT8"[4B]; "0"[4B]
nBytes += 8; //empty "double" data element "miDouble"[4B9; "0"[4B]
return nBytes;
}
// Array Flags[16B] + Dimensions Array [16B]
nBytes += 4*8;
/*
* NOTE: The array names of member structures aren't
* written, only a single byte defining the length
* of the array name as being zero.
* So: for parent arrays, the size required to write the
* name to the file is calculated at the moment it is
* written to disk, everytjing else (including the 8B
* which define the arrayname as being of length 0) is
* calculated here.
*/
if (inArray->isChild){
nBytes += 8;
}
/*
* Handle mxArrays which are structs:
*/
if (inArray->isStruct){
//printf("calculating size of mxStruct:\n");
/*
* Determine size required for the fieldnames:
*/
// Add size required for "field name length"(8B) + header
// header for the field names (another 8B)
nBytes += 8 + 8;
//printf("headers: %lu\n", nBytes);
//get length of longest fieldname
for (uintptr_t i=0; i<inArray->nFields; i++){
maxLengthFieldname = max(maxLengthFieldname, strlen(inArray->fieldNames[i]));
}
//need to add 1B for the string's NULL terminator
maxLengthFieldname += 1;
nBytes += maxLengthFieldname * inArray->nFields;
// determine padding required for the fieldnames
if (nBytes % 8 > 0){
//add padding to size
//printf("padded: %lu\n", (8 - nBytes % 8));
nBytes += 8 - nBytes % 8;
}
//printf("size required for fieldnames: %lu\n", maxLengthFieldname * inArray->nFields);
//printf("toal size required icluding fieldnames: %lu\n", nBytes);
/*
* Determine size required for the structure's children
*/
for (uintptr_t j=0; j<inArray->dims[0]*inArray->dims[1]; j++){
for (uintptr_t i=0; i<inArray->nFields; i++){
nBytes += calcArraySize(inArray[j].field[i]);
//printf("size required including child[%lu]: %lu\n", i, nBytes);
}
}
/*
* Handle mxArrays which aren't structures:
*/
}else{
// determine size required for the actual data:
if (inArray->mxCLASS == mxCHAR_CLASS){
/*
* NOTE: mxCHAR_CLASS is strange: although datatype
* is 'char' (which should be 1B) 2B are
* written per character
*/
nBytes += dataElementSize(2*sizeof(char), inArray->dims[0]*inArray->dims[1]);
}else{
/*
* All other data types [seem to] behave as expected
*/
nBytes += dataElementSize(inArray->dataElementSize, inArray->dims[0]*inArray->dims[1]);
//printf("dataElementSize(): %u\n", dataElementSize(inArray->dataElementSize, inArray->dims[0]*inArray->dims[1]));
//if data is complex, get size of imaginary part
if (inArray->numericType == mxCOMPLEX){
nBytes += dataElementSize(inArray->dataElementSize, inArray->dims[0]*inArray->dims[1]);
}
}
}
//save the size of the mxArray's contents
inArray->nBytes = nBytes;
/*
* NOTE: the size given in an mxArray's header does not
* include the 8 bytes of the header itself, thus
* an additional 8B are actually required to write the
* mxArray's header. However, in case of nested
* structures, the 8B for the header are needed.
* Because of this, those 8B are added to the return
* value.
* TODO: this sounds confusing...
*/
//printf("nBytes+8: %lu\n", nBytes+8);
return nBytes +8;
}
|
/*
* This file is part of LP-blink
*
* Copyright (C) 2013 Mirco Gysin <miagox@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UARTH_H__
#define __UARTH_H__
#define COM_UART_RX_BUFFER_SIZE 30
#include <message.h>
#include <msp430.h>
#define MSG_ID_UART_WELCOME 0
#define MSG_ID_UART_ERROR 1
#define MSG_ID_PRINT_ARG 2
#define MSG_ID_PRINT_NL_ARG 3
#define ENTER_CHAR 13
#define BS_CHAR 8
#define SPACE_CHAR 32
void initComUart();
void comUartHandler( message *msg );
void comUartPutC( unsigned char byte );
void comUartPutS( const char *str );
#endif
|
/*---------------------------------------------------------------------------
* Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 - Emanuele Bovisio
*
* This file is part of Mulk.
*
* Mulk 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.
*
* Mulk 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 Mulk. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU Lesser General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*---------------------------------------------------------------------------*/
#include "m_malloc.h"
#ifdef MULKDEBUG
#define HASH_TABLE_SIZE 131072 /* 2^17, use always power of 2 */
#define HASH_CHUNK_SIZE 2048
#define INC_INDEX(i) i = ((i == HASH_TABLE_SIZE-1) ? 0 : i+1)
static struct {
const void *ptr;
const char *filename;
int line;
size_t size;
} hash_table[HASH_TABLE_SIZE];
static int add_count = 0, remove_count = 0;
/* Robert Jenkins' hash function */
/* it works quite well considering at least the 17 lowest bits */
static uint32_t hash_integer(uint32_t a)
{
a = a ^ (a>>4);
a = (a^0xdeadbeef) + (a<<5);
a = a ^ (a>>11);
return a;
}
/* it takes the lowest 17 bits, if you modify this number of bits, HASH_TABLE_SIZE
* has to be chosen accordingly */
static int hash_value(const void *ptr)
{
uint32_t key = hash_integer((uint32_t) ptr);
return (int) (key&0x0001FFFF);
}
static int find_pointer(const void *ptr)
{
int i, pos = hash_value(ptr);
/* at least one NULL element */
for (i = pos; hash_table[i].ptr != NULL && hash_table[i].ptr != ptr; INC_INDEX(i));
return i;
}
static int is_pointer_swap(int hash_ptr, int null_pos, int pos)
{
if (pos >= hash_ptr)
return (null_pos >= hash_ptr && pos > null_pos);
else
return (null_pos >= hash_ptr || pos > null_pos);
}
void m_debug_init(void)
{
int i;
for (i = 0; i < HASH_TABLE_SIZE; ++i)
hash_table[i].ptr = NULL;
}
static mulk_type_return_t add_pointer(const void *ptr, const char *filename, int line, size_t tot_size)
{
int pos;
if (add_count - remove_count >= HASH_TABLE_SIZE-1) {
fprintf(stderr, _("ERROR: increase HASH_TABLE_SIZE to a larger value and recompile\n"));
exit(EXIT_FAILURE);
}
pos = find_pointer(ptr);
if (hash_table[pos].ptr != NULL)
return MULK_RET_ERR;
hash_table[pos].ptr = ptr;
hash_table[pos].filename = filename;
hash_table[pos].line = line;
hash_table[pos].size = tot_size;
add_count++;
return MULK_RET_OK;
}
static mulk_type_return_t remove_pointer(const void *ptr)
{
int i, pos = find_pointer(ptr);
if (hash_table[pos].ptr == NULL)
return MULK_RET_ERR;
hash_table[pos].ptr = NULL;
remove_count++;
for (i = pos, INC_INDEX(i); hash_table[i].ptr != NULL; INC_INDEX(i))
{
int hash_ptr = hash_value(hash_table[i].ptr);
if (is_pointer_swap(hash_ptr, pos, i)) {
hash_table[pos] = hash_table[i];
hash_table[i].ptr = NULL;
pos = i;
}
}
return MULK_RET_OK;
}
void m_print_allocated_pointers(void)
{
int i;
printf(_("\nCAlloc: %d\n"), add_count);
printf(_("Free: %d\n"), remove_count);
printf(_("Memory Leaks: %d\n\n"), add_count - remove_count);
for (i = 0; i < HASH_TABLE_SIZE; ++i)
if (hash_table[i].ptr != NULL)
printf(_("ptr=0x%lx, %s:%d, %ld bytes\n"), (unsigned long) hash_table[i].ptr,
hash_table[i].filename, hash_table[i].line, (long int) hash_table[i].size);
}
void m_print_pointers_distribution(void)
{
int i, count = 0;
for (i = 0; i < HASH_TABLE_SIZE; ++i) {
if (((i + 1) % HASH_CHUNK_SIZE) == 0) {
printf(_("chunck %%%d, number %d\n"), (i + 1) / HASH_CHUNK_SIZE, count);
count = 0;
}
if (hash_table[i].ptr != NULL)
count++;
}
}
void *debug_calloc(size_t nmemb, size_t size, const char *source_filename, int source_line)
{
void *ptr = default_calloc(nmemb, size);
if (add_pointer(ptr, source_filename, source_line, nmemb * size) != MULK_RET_OK) {
fprintf(stderr, _("ERROR: pointer to add already present at %s:%d\n"), source_filename, source_line);
exit(EXIT_FAILURE);
}
return ptr;
}
void debug_free(void *ptr, const char *source_filename, int source_line)
{
if (!ptr) {
fprintf(stderr, _("ERROR: free NULL pointer at %s:%d\n"), source_filename, source_line);
exit(EXIT_FAILURE);
}
if (remove_pointer(ptr) != MULK_RET_OK) {
fprintf(stderr, _("ERROR: bad free (0x%lx) at %s:%d\n"), (unsigned long) ptr, source_filename, source_line);
exit(EXIT_FAILURE);
}
default_free(ptr);
}
#endif /* MULKDEBUG */
void *default_calloc(size_t nmemb, size_t size)
{
void *ptr = calloc(nmemb, size);
if (!ptr) {
fprintf(stderr, _("ERROR: %s,%d: memory allocation failed (%ld bytes)\n"), __FILE__, __LINE__, (long int) size);
exit(EXIT_FAILURE);
}
return ptr;
}
|
// libk/string/strlen.c
#include <stddef.h>
#include <string.h>
size_t strlen (const char *str) {
size_t len = 0;
while (str[len])
len++;
return len;
}
size_t strnlen (const char *str, size_t n) {
const void *memchr_result;
size_t len;
memchr_result = memchr (str, '\0', n);
if (!memchr_result)
len = n;
else
len = memchr_result - (void *)str;
return len;
}
// vim: set ts=4 sw=4 noet syn=c:
|
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5PropList_H
#define _H5PropList_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP PropList : public IdComponent {
public:
// Default property list
static const PropList DEFAULT;
// Creates a property list of a given type or creates a copy of an
// existing property list giving the property list id.
PropList(const hid_t plist_id);
// Make a copy of the given property list using assignment statement
PropList& operator=( const PropList& rhs );
// Compares this property list or class against the given list or class.
bool operator==(const PropList& rhs) const;
// Close this property list.
virtual void close();
// Close a property list class.
void closeClass() const;
// Makes a copy of the given property list.
void copy( const PropList& like_plist );
// Copies a property from this property list or class to another
void copyProp( PropList& dest, const char* name) const;
void copyProp( PropList& dest, const H5std_string& name) const;
// Copies a property from one property list or property class to another
void copyProp( PropList& dest, PropList& src, const char* name) const;
void copyProp( PropList& dest, PropList& src, const H5std_string& name) const;
// Gets the class of this property list, i.e. H5P_FILE_CREATE,
// H5P_FILE_ACCESS, ...
hid_t getClass() const;
// Return the name of a generic property list class.
H5std_string getClassName() const;
// Returns the parent class of a generic property class.
PropList getClassParent() const;
// Returns the number of properties in this property list or class.
size_t getNumProps() const;
// Query the value of a property in a property list.
void getProperty(const char* name, void* value) const;
void getProperty(const H5std_string& name, void* value) const;
H5std_string getProperty(const char* name) const;
H5std_string getProperty(const H5std_string& name) const;
// Set a property's value in a property list.
void setProperty(const char* name, void* value) const;
void setProperty(const char* name, const char* charptr) const;
void setProperty(const char* name, H5std_string& strg) const;
void setProperty(const H5std_string& name, void* value) const;
void setProperty(const H5std_string& name, H5std_string& strg) const;
// Query the size of a property in a property list or class.
size_t getPropSize(const char *name) const;
size_t getPropSize(const H5std_string& name) const;
// Determines whether a property list is a certain class.
bool isAClass(const PropList& prop_class) const;
/// Query the existance of a property in a property object.
bool propExist(const char* name) const;
bool propExist(const H5std_string& name) const;
// Removes a property from a property list.
void removeProp(const char *name) const;
void removeProp(const H5std_string& name) const;
// Returns this class name
virtual H5std_string fromClass () const { return("PropList"); }
// Default constructor: creates a stub PropList object.
PropList();
// Copy constructor: creates a copy of a PropList object.
PropList(const PropList& original);
// Gets the property list id.
virtual hid_t getId() const;
// Destructor: properly terminates access to this property list.
virtual ~PropList();
protected:
hid_t id; // HDF5 property list id
// Sets the property list id.
virtual void p_setId(const hid_t new_id);
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif // _H5PropList_H
|
// This file is part of SmallBASIC
//
// Copyright(C) 2001-2014 Chris Warren-Smith.
//
// This program is distributed under the terms of the GPL v2.0 or later
// Download the GNU Public License (GPL) from www.gnu.org
//
#ifndef RUNTIME_H
#define RUNTIME_H
#include "config.h"
#include <SDL.h>
#include "lib/maapi.h"
#include "ui/ansiwidget.h"
#include "ui/system.h"
#include "platform/sdl/display.h"
struct Runtime : public System {
Runtime(SDL_Window *window);
virtual ~Runtime();
void addShortcut(const char *) {}
void alert(const char *title, const char *message);
int ask(const char *title, const char *prompt, bool cancel);
void browseFile(const char *url);
void construct(const char *font, const char *boldFont);
bool debugActive();
bool debugOpen(const char *file);
void debugStart(TextEditInput *edit, const char *file);
void debugStep(TextEditInput *edit, TextEditHelpWidget *help, bool cont);
void debugStop();
void enableCursor(bool enabled);
void exportRun(const char *path);
void redraw() { _graphics->redraw(); }
bool toggleFullscreen();
void handleKeyEvent(MAEvent &event);
bool hasEvent() { return _eventQueue && _eventQueue->size() > 0; }
void pause(int timeout);
void pollEvents(bool blocking);
MAEvent *popEvent();
MAEvent processEvents(int waitFlag);
void processEvent(MAEvent &event);
void pushEvent(MAEvent *event);
void setWindowSize(int width, int height);
void setWindowTitle(const char *title);
void share(const char *path) {}
void showCursor(CursorType cursorType);
int runShell(const char *startupBas, bool once, int fontScale, int debugPort);
char *loadResource(const char *fileName);
void logStack(int line, bool subOrFunc);
void optionsBox(StringList *items);
void onResize(int w, int h);
void setClipboardText(const char *text);
char *getClipboardText();
void setWindowRect(SDL_Rect &rect);
SDL_Rect getWindowRect();
private:
int _menuX, _menuY;
bool _fullscreen;
SDL_Rect _windowRect;
Graphics *_graphics;
Stack<MAEvent *> *_eventQueue;
SDL_Window *_window;
SDL_Cursor *_cursorHand;
SDL_Cursor *_cursorArrow;
SDL_Cursor *_cursorIBeam;
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.