text
stringlengths 4
6.14k
|
|---|
/*
Copyright (C) 2006-2013 Werner Dittmann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 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/>.
*/
/*
* Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
*/
#ifndef _ZRTPPACKETCOMMIT_H_
#define _ZRTPPACKETCOMMIT_H_
/**
* @file ZrtpPacketCommit.h
* @brief The ZRTP Commit message
*
* @ingroup GNU_ZRTP
* @{
*/
#include <VialerPJSIP/libzrtpcpp/ZrtpPacketBase.h>
// PRSH here only for completeness. We don't support PRSH in the other ZRTP parts.
#define COMMIT_DH_EX 29
#define COMMIT_MULTI 25
#define COMMIT_PRSH 27
/**
* Implement the Commit packet.
*
* The ZRTP message Commit. The ZRTP implementation sends or receives
* this message to commit the crypto parameters offered during a Hello
* message.
*
*
* @author Werner Dittmann <Werner.Dittmann@t-online.de>
*/
class __EXPORT ZrtpPacketCommit : public ZrtpPacketBase {
protected:
Commit_t* commitHeader; ///< Points to Commit message part
public:
typedef enum _commitType {
DhExchange = 1,
MultiStream = 2
} commitType;
/// Creates a Commit packet with default data
ZrtpPacketCommit();
/// Creates a Commit packet from received data
ZrtpPacketCommit(uint8_t* data);
/// Normal destructor
virtual ~ZrtpPacketCommit();
/// Get pointer to hash algorithm type field, a fixed length character array
uint8_t* getHashType() { return commitHeader->hash; };
/// Get pointer to cipher algorithm type field, a fixed length character array
uint8_t* getCipherType() { return commitHeader->cipher; };
/// Get pointer to SRTP authentication algorithm type field, a fixed length character array
uint8_t* getAuthLen() { return commitHeader->authlengths; };
/// Get pointer to key agreement algorithm type field, a fixed length character array
uint8_t* getPubKeysType() { return commitHeader->pubkey; };
/// Get pointer to SAS algorithm type field, a fixed length character array
uint8_t* getSasType() { return commitHeader->sas; };
/// Get pointer to ZID field, a fixed length byte array
uint8_t* getZid() { return commitHeader->zid; };
/// Get pointer to HVI field, a fixed length byte array
uint8_t* getHvi() { return commitHeader->hvi; };
/// Get pointer to NONCE field, a fixed length byte array, overlaps HVI field
uint8_t* getNonce() { return commitHeader->hvi; };
/// Get pointer to hashH2 field, a fixed length byte array
uint8_t* getH2() { return commitHeader->hashH2; };
/// Get pointer to MAC field, a fixed length byte array
uint8_t* getHMAC() { return commitHeader->hmac; };
/// Get pointer to MAC field during multi-stream mode, a fixed length byte array
uint8_t* getHMACMulti() { return commitHeader->hmac-4*ZRTP_WORD_SIZE; };
/// Check if packet length makes sense.
bool isLengthOk(commitType type) {int32_t len = getLength();
return ((type == DhExchange) ? len == COMMIT_DH_EX : len == COMMIT_MULTI);}
/// Set hash algorithm type field, fixed length character field
void setHashType(uint8_t* text) { memcpy(commitHeader->hash, text, ZRTP_WORD_SIZE); };
/// Set cipher algorithm type field, fixed length character field
void setCipherType(uint8_t* text) { memcpy(commitHeader->cipher, text, ZRTP_WORD_SIZE); };
/// Set SRTP authentication algorithm algorithm type field, fixed length character field
void setAuthLen(uint8_t* text) { memcpy(commitHeader->authlengths, text, ZRTP_WORD_SIZE); };
/// Set key agreement algorithm type field, fixed length character field
void setPubKeyType(uint8_t* text) { memcpy(commitHeader->pubkey, text, ZRTP_WORD_SIZE); };
/// Set SAS algorithm type field, fixed length character field
void setSasType(uint8_t* text) { memcpy(commitHeader->sas, text, ZRTP_WORD_SIZE); };
/// Set ZID field, a fixed length byte array
void setZid(uint8_t* text) { memcpy(commitHeader->zid, text, sizeof(commitHeader->zid)); };
/// Set HVI field, a fixed length byte array
void setHvi(uint8_t* text) { memcpy(commitHeader->hvi, text, sizeof(commitHeader->hvi)); };
/// Set conce field, a fixed length byte array, overlapping HVI field
void setNonce(uint8_t* text);
/// Set hashH2 field, a fixed length byte array
void setH2(uint8_t* hash) { memcpy(commitHeader->hashH2, hash, sizeof(commitHeader->hashH2)); };
/// Set MAC field, a fixed length byte array
void setHMAC(uint8_t* hash) { memcpy(commitHeader->hmac, hash, sizeof(commitHeader->hmac)); };
/// Set MAC field during multi-stream mode, a fixed length byte array
void setHMACMulti(uint8_t* hash) { memcpy(commitHeader->hmac-4*ZRTP_WORD_SIZE, hash, sizeof(commitHeader->hmac)); };
private:
CommitPacket_t data;
};
/**
* @}
*/
#endif // ZRTPPACKETCOMMIT
|
/*
Copyright (C) 2020, Kevin Andre <hyperquantum@gmail.com>
This file is part of PMP (Party Music Player).
PMP 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.
PMP 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 PMP. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PMP_COLLECTIONWATCHER_H
#define PMP_COLLECTIONWATCHER_H
#include "collectiontrackinfo.h"
#include <QHash>
#include <QObject>
namespace PMP {
class CollectionWatcher : public QObject {
Q_OBJECT
public:
virtual ~CollectionWatcher() {}
virtual QHash<FileHash, CollectionTrackInfo> getCollection() = 0;
virtual CollectionTrackInfo getTrack(FileHash const& hash) = 0;
Q_SIGNALS:
void newTrackReceived(CollectionTrackInfo track);
void trackAvailabilityChanged(FileHash hash, bool isAvailable);
void trackDataChanged(CollectionTrackInfo track);
protected:
explicit CollectionWatcher(QObject* parent) : QObject(parent) {}
};
}
#endif
|
/*{{{
Copyright 2012-2016, Bernhard Bliem
WWW: <http://dbai.tuwien.ac.at/research/project/dflat/>.
This file is part of D-FLAT.
D-FLAT 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.
D-FLAT 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 D-FLAT. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//}}}
#include <vector>
#include "SingleValueOption.h"
namespace options {
class Choice : public SingleValueOption
{
public:
Choice(const std::string& name, const std::string& placeholder, const std::string& description);
//! This should only be called before setValue() has been called
void addChoice(const std::string& choiceName, const std::string& description, bool newDefault = false);
virtual void setValue(const std::string& v) override;
virtual void checkConditions() const override;
virtual void printHelp(std::ostream& out) const override;
private:
struct Possibility
{
Possibility(const std::string& name, const std::string& description) : name(name), description(description) {}
std::string name;
std::string description;
};
typedef std::vector<Possibility> Possibilities;
static const int POSSIBILITY_NAME_WIDTH = 18;
Possibilities possibilities;
std::string defaultValue;
};
} // namespace options
|
/* AGS - Advanced GTK Sequencer
* Copyright (C) 2005-2011 Joël Krähemann
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __AGS_RECALL_CHANNEL_RUN_H__
#define __AGS_RECALL_CHANNEL_RUN_H__
#include <glib.h>
#include <glib-object.h>
#include <ags/audio/ags_recall.h>
#include <ags/audio/ags_channel.h>
#include <ags/audio/ags_recall_audio_run.h>
#include <ags/audio/ags_recall_channel.h>
#define AGS_TYPE_RECALL_CHANNEL_RUN (ags_recall_channel_run_get_type())
#define AGS_RECALL_CHANNEL_RUN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_RECALL_CHANNEL_RUN, AgsRecallChannelRun))
#define AGS_RECALL_CHANNEL_RUN_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_RECALL_CHANNEL_RUN, AgsRecallChannelRunClass))
#define AGS_IS_RECALL_CHANNEL_RUN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_RECALL_CHANNEL_RUN))
#define AGS_IS_RECALL_CHANNEL_RUN_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_RECALL_CHANNEL_RUN))
#define AGS_RECALL_CHANNEL_RUN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_RECALL_CHANNEL_RUN, AgsRecallChannelRunClass))
typedef struct _AgsRecallChannelRun AgsRecallChannelRun;
typedef struct _AgsRecallChannelRunClass AgsRecallChannelRunClass;
struct _AgsRecallChannelRun
{
AgsRecall recall;
guint audio_channel;
AgsRecallChannel *recall_channel;
AgsRecallAudioRun *recall_audio_run;
AgsChannel *destination;
gulong destination_recycling_changed_handler;
gulong changed_output_handler;
AgsChannel *source;
gulong source_recycling_changed_handler;
guint run_order;
};
struct _AgsRecallChannelRunClass
{
AgsRecallClass recall;
void (*run_order_changed)(AgsRecallChannelRun *recall_channel_run, guint nth_run);
};
GType ags_recall_channel_run_get_type();
void ags_recall_channel_run_run_order_changed(AgsRecallChannelRun *recall_channel_run,
guint run_order);
guint ags_recall_channel_run_get_run_order(AgsRecallChannelRun *recall_channel_run);
AgsRecallChannelRun* ags_recall_channel_run_new();
#endif /*__AGS_RECALL_CHANNEL_RUN_H__*/
|
#pragma once
#include <cJSON.h>
namespace XNM {
namespace PropertyPoint {
class Handler;
class BaseProperty;
class BaseOutput {
protected:
friend Handler;
friend BaseProperty;
Handler &handler;
/* Send a update command to this output
*
* This will forward the given cJSON update structure to this output,
* which is intended to tell listeners on this output about the changed
* state of this item.
*
* This is intended to be sent to all outputs except the truthholder output,
* as it will already know about the updated value!
*
* Will *not* delete the cJSON item when done.
*/
virtual void send_upd_json(const cJSON * item, BaseProperty &prop);
/* Send a set command to this output.
*
* This will forward the given cJSON Item for the property 'key' to this
* output.
* This is supposed to be used only to forward the packet towards the
* truthholder, i.e. the source that controls the current value.
*
* Will *not* delete the cJSON item when done.
*/
virtual void send_set_json(const cJSON * item, BaseProperty &prop);
public:
BaseOutput(Handler &handler);
};
}
}
|
#pragma once
#include "entropy/geom/Stripes.h"
#include "entropy/render/Layout.h"
#include "entropy/scene/Base.h"
namespace entropy
{
namespace scene
{
class Interlude
: public Base
{
public:
string getName() const override
{
return "entropy::scene::Interlude";
}
Interlude();
~Interlude();
void init() override;
void clear() override;
void setup() override;
void exit() override;
void resizeBack(ofResizeEventArgs & args) override;
void resizeFront(ofResizeEventArgs & args) override;
void update(double dt) override;
void drawBackWorld() override;
void drawFrontWorld() override;
void gui(ofxImGui::Settings & settings) override;
void serialize(nlohmann::json & json) override;
void deserialize(const nlohmann::json & json) override;
static const int MAX_NUM_STRIPES = 8;
protected:
std::shared_ptr<geom::Stripes> addStripes(render::Layout layout);
void removeStripes(render::Layout layout);
std::map<render::Layout, std::vector<std::shared_ptr<geom::Stripes>>> stripes;
std::map<render::Layout, bool[MAX_NUM_STRIPES]> openGuis; // Don't use vector<bool> because they're weird: http://en.cppreference.com/w/cpp/container/vector_bool
virtual ofParameterGroup & getParameters() override
{
return this->parameters;
}
struct : ofParameterGroup
{
struct : ofParameterGroup
{
ofParameter<float> backAlpha{ "Back Alpha", 1.0f, 0.0f, 1.0f };
ofParameter<float> frontAlpha{ "Front Alpha", 1.0f, 0.0f, 1.0f };
PARAM_DECLARE("Stripes", backAlpha, frontAlpha);
} stripes;
PARAM_DECLARE("Interlude",
stripes);
} parameters;
};
}
}
|
#ifndef EXCEPTIONRANGEDIALOG_H
#define EXCEPTIONRANGEDIALOG_H
#include <QDialog>
namespace Ui
{
class ExceptionRangeDialog;
}
class ExceptionRangeDialog : public QDialog
{
Q_OBJECT
public:
explicit ExceptionRangeDialog(QWidget* parent = 0);
~ExceptionRangeDialog();
unsigned long rangeStart;
unsigned long rangeEnd;
private slots:
void on_editStart_textChanged(const QString & arg1);
void on_editEnd_textChanged(const QString & arg1);
void on_btnOk_clicked();
private:
Ui::ExceptionRangeDialog* ui;
};
#endif // EXCEPTIONRANGEDIALOG_H
|
/************************************************************************
progressdialog.h
Utilities for Domesday Duplicator
DomesdayDuplicator - LaserDisc RF sampler
Copyright (C) 2019 Simon Inns
This file is part of Domesday Duplicator.
Domesday Duplicator 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/>.
Email: simon.inns@gmail.com
************************************************************************/
#ifndef PROGRESSDIALOG_H
#define PROGRESSDIALOG_H
#include <QDialog>
#include <QtDebug>
#include <QCloseEvent>
namespace Ui {
class ProgressDialog;
}
class ProgressDialog : public QDialog
{
Q_OBJECT
public:
explicit ProgressDialog(QWidget *parent = nullptr);
~ProgressDialog();
void closeEvent(QCloseEvent *event);
void setPercentage(qint32 percentage);
void setText(QString message);
signals:
void cancelled(void);
private:
Ui::ProgressDialog *ui;
};
#endif // PROGRESSDIALOG_H
|
/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
/* A very basic TLS client, with PSK authentication.
*/
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int tcp_connect (void);
extern void tcp_close (int sd);
int
main (void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
const char *err;
gnutls_psk_client_credentials_t pskcred;
const gnutls_datum_t key = { (void *) "DEADBEEF", 8 };
gnutls_global_init ();
gnutls_psk_allocate_client_credentials (&pskcred);
gnutls_psk_set_client_credentials (pskcred, "test", &key,
GNUTLS_PSK_KEY_HEX);
/* Initialize TLS session
*/
gnutls_init (&session, GNUTLS_CLIENT);
/* Use default priorities */
ret = gnutls_priority_set_direct (session, "PERFORMANCE:+ECDHE-PSK:+DHE-PSK:+PSK", &err);
if (ret < 0)
{
if (ret == GNUTLS_E_INVALID_REQUEST)
{
fprintf (stderr, "Syntax error at: %s\n", err);
}
exit (1);
}
/* put the x509 credentials to the current session
*/
gnutls_credentials_set (session, GNUTLS_CRD_PSK, pskcred);
/* connect to the peer
*/
sd = tcp_connect ();
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
gnutls_handshake_set_timeout (session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do
{
ret = gnutls_handshake (session);
}
while (ret < 0 && gnutls_error_is_fatal (ret) == 0);
if (ret < 0)
{
fprintf (stderr, "*** Handshake failed\n");
gnutls_perror (ret);
goto end;
}
else
{
printf ("- Handshake was completed\n");
}
gnutls_record_send (session, MSG, strlen (MSG));
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
printf ("- Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
{
fprintf (stderr, "*** Error: %s\n", gnutls_strerror (ret));
goto end;
}
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
{
fputc (buffer[ii], stdout);
}
fputs ("\n", stdout);
gnutls_bye (session, GNUTLS_SHUT_RDWR);
end:
tcp_close (sd);
gnutls_deinit (session);
gnutls_psk_free_client_credentials (pskcred);
gnutls_global_deinit ();
return 0;
}
|
#ifndef _CLIENT_CONFIGURATION_H_
#define _CLIENT_CONFIGURATION_H_
#include <string>
class ConfigReader;
/**
* Configuration manager responsible for loading the settings from config file
*/
class ClientConfiguration
{
public:
/**
* Constructor. Searches the "well-known" locations for the settings of the client
* The order is:
* - the directory where the application started
* - the user's home directory
*/
ClientConfiguration();
/**
* Destructor
*/
~ClientConfiguration();
/**
* Constructor. Provided is the configuration file
*/
ClientConfiguration ( const std::string& directory );
/**
* Tells us if this was initialized or not
*/
bool initialized() const
{
return initSuccess;
}
public:
/**
* Returns the IP address of the daemon
*/
std::string getDaemonIP();
/**
* Returns the TCP port of the daemon
*/
int getDaemonTCPPort();
/**
* Returns the dispatcher port on which this client wants to communicate
*/
int preferredDispatcherPort();
private:
// the configuration reader
ConfigReader* cfg;
// if this was succesfully initialized or not
bool initSuccess;
};
#endif
|
/*
ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file oslib_test_sequence_007.h
* @brief Test Sequence 007 header.
*/
#ifndef OSLIB_TEST_SEQUENCE_007_H
#define OSLIB_TEST_SEQUENCE_007_H
extern const testsequence_t oslib_test_sequence_007;
#endif /* OSLIB_TEST_SEQUENCE_007_H */
|
/**
******************************************************************************
* @file DMA2D/DMA2D_MemToMemWithBlending/Inc/main.h
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32469i_eval.h"
#include "stm32469i_eval_io.h"
#include "stm32469i_eval_lcd.h"
#include "stm32469i_eval_sdram.h"
#define LAYER_SIZE_X 240
#define LAYER_SIZE_Y 130
#define LAYER_BYTE_PER_PIXEL 2
#define LCD_FRAME_BUFFER 0xC0000000
#define WVGA_RES_X 800
#define WVGA_RES_Y 480
#define ARGB8888_BYTE_PER_PIXEL 4
#define RGB565_BYTE_PER_PIXEL 2
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
//
// tracer.h
//
// Circle - A C++ bare metal environment for Raspberry Pi
// Copyright (C) 2014 R. Stange <rsta2@o2online.de>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 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 _circle_tracer_h
#define _circle_tracer_h
#include "../../../pi-OS/include/circle/types.h"
struct TTraceEntry
{
unsigned nClockTicks;
unsigned nEventID;
#define TRACER_EVENT_STOP 0
unsigned nParam[4];
};
class CTracer
{
public:
CTracer (unsigned nDepth, boolean bStopIfFull);
~CTracer (void);
void Start (void);
void Stop (void);
// not reentrant, use spin lock if required
void Event (unsigned nID, unsigned nParam1 = 0, unsigned nParam2 = 0, unsigned nParam3 = 0, unsigned nParam4 = 0);
void Dump (void);
static CTracer *Get (void);
private:
unsigned m_nDepth; // size of ring buffer
boolean m_bStopIfFull;
boolean m_bActive;
unsigned m_nStartTicks;
TTraceEntry *m_pEntry; // array used as ring buffer
unsigned m_nEntries; // valid entries in ring buffer
unsigned m_nCurrent; // write index into ring buffer
static CTracer *s_pThis;
};
#endif
|
#ifndef B43legacy_SYSFS_H_
#define B43legacy_SYSFS_H_
struct b43legacy_wldev;
int b43legacy_sysfs_register(struct b43legacy_wldev *dev);
void b43legacy_sysfs_unregister(struct b43legacy_wldev *dev);
#endif /* B43legacy_SYSFS_H_ */
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[6];
atomic_int atom_1_r1_1;
atomic_int atom_2_r1_1;
atomic_int atom_2_r3_0;
atomic_int atom_4_r1_1;
atomic_int atom_5_r3_0;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v23 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v23, memory_order_seq_cst);
return NULL;
}
void *t2(void *arg){
label_3:;
int v4_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v6_r3 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v24 = (v4_r1 == 1);
atomic_store_explicit(&atom_2_r1_1, v24, memory_order_seq_cst);
int v25 = (v6_r3 == 0);
atomic_store_explicit(&atom_2_r3_0, v25, memory_order_seq_cst);
return NULL;
}
void *t3(void *arg){
label_4:;
atomic_store_explicit(&vars[3], 1, memory_order_seq_cst);
atomic_store_explicit(&vars[4], 1, memory_order_seq_cst);
return NULL;
}
void *t4(void *arg){
label_5:;
int v8_r1 = atomic_load_explicit(&vars[4], memory_order_seq_cst);
atomic_store_explicit(&vars[5], 1, memory_order_seq_cst);
int v26 = (v8_r1 == 1);
atomic_store_explicit(&atom_4_r1_1, v26, memory_order_seq_cst);
return NULL;
}
void *t5(void *arg){
label_6:;
atomic_store_explicit(&vars[5], 2, memory_order_seq_cst);
int v10_r3 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v27 = (v10_r3 == 0);
atomic_store_explicit(&atom_5_r3_0, v27, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
pthread_t thr2;
pthread_t thr3;
pthread_t thr4;
pthread_t thr5;
atomic_init(&vars[4], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[5], 0);
atomic_init(&vars[3], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[0], 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_2_r1_1, 0);
atomic_init(&atom_2_r3_0, 0);
atomic_init(&atom_4_r1_1, 0);
atomic_init(&atom_5_r3_0, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_create(&thr2, NULL, t2, NULL);
pthread_create(&thr3, NULL, t3, NULL);
pthread_create(&thr4, NULL, t4, NULL);
pthread_create(&thr5, NULL, t5, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
pthread_join(thr2, NULL);
pthread_join(thr3, NULL);
pthread_join(thr4, NULL);
pthread_join(thr5, NULL);
int v11 = atomic_load_explicit(&vars[5], memory_order_seq_cst);
int v12 = (v11 == 2);
int v13 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v14 = atomic_load_explicit(&atom_2_r1_1, memory_order_seq_cst);
int v15 = atomic_load_explicit(&atom_2_r3_0, memory_order_seq_cst);
int v16 = atomic_load_explicit(&atom_4_r1_1, memory_order_seq_cst);
int v17 = atomic_load_explicit(&atom_5_r3_0, memory_order_seq_cst);
int v18_conj = v16 & v17;
int v19_conj = v15 & v18_conj;
int v20_conj = v14 & v19_conj;
int v21_conj = v13 & v20_conj;
int v22_conj = v12 & v21_conj;
if (v22_conj == 1) assert(0);
return 0;
}
|
/* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 16. October 2013
* $Revision: V1.4.2
*
* Project: CMSIS DSP Library
* Title: arm_sin_f32.c
*
* Description: Fast sine calculation for floating-point values.
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* 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 ARM LIMITED 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.
* -------------------------------------------------------------------- */
#include "arm_math.h"
#include "arm_common_tables.h"
/**
* @ingroup groupFastMath
*/
/**
* @defgroup sin Sine
*
* Computes the trigonometric sine function using a combination of table lookup
* and cubic interpolation. There are separate functions for
* Q15, Q31, and floating-point data types.
* The input to the floating-point version is in radians while the
* fixed-point Q15 and Q31 have a scaled input with the range
* [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a
* value of 2*pi wraps around to 0.
*
* The implementation is based on table lookup using 256 values together with cubic interpolation.
* The steps used are:
* -# Calculation of the nearest integer table index
* -# Fetch the four table values a, b, c, and d
* -# Compute the fractional portion (fract) of the table index.
* -# Calculation of wa, wb, wc, wd
* -# The final result equals <code>a*wa + b*wb + c*wc + d*wd</code>
*
* where
* <pre>
* a=Table[index-1];
* b=Table[index+0];
* c=Table[index+1];
* d=Table[index+2];
* </pre>
* and
* <pre>
* wa=-(1/6)*fract.^3 + (1/2)*fract.^2 - (1/3)*fract;
* wb=(1/2)*fract.^3 - fract.^2 - (1/2)*fract + 1;
* wc=-(1/2)*fract.^3+(1/2)*fract.^2+fract;
* wd=(1/6)*fract.^3 - (1/6)*fract;
* </pre>
*/
/**
* @addtogroup sin
* @{
*/
/**
* @brief Fast approximation to the trigonometric sine function for floating-point data.
* @param[in] x input value in radians.
* @return sin(x).
*/
float32_t arm_sin_f32(
float32_t x)
{
float32_t sinVal, fract, in; /* Temporary variables for input, output */
uint16_t index; /* Index variable */
float32_t a, b; /* Two nearest output values */
int32_t n;
float32_t findex;
/* input x is in radians */
/* Scale the input to [0 1] range from [0 2*PI] , divide input by 2*pi */
in = x * 0.159154943092f;
/* Calculation of floor value of input */
n = (int32_t) in;
/* Make negative values towards -infinity */
if(x < 0.0f)
{
n--;
}
/* Map input value to [0 1] */
in = in - (float32_t) n;
/* Calculation of index of the table */
findex = (float32_t) FAST_MATH_TABLE_SIZE * in;
index = ((uint16_t)findex) & 0x1ff;
/* fractional value calculation */
fract = findex - (float32_t) index;
/* Read two nearest values of input value from the sin table */
a = sinTable_f32[index];
b = sinTable_f32[index+1];
/* Linear interpolation process */
sinVal = (1.0f-fract)*a + fract*b;
/* Return the output value */
return (sinVal);
}
/**
* @} end of sin group
*/
|
/*==============================================================================
Главный заголовочный файл
==============================================================================*/
#ifndef _js_spidermonkey_h
#define _js_spidermonkey_h
#include <stdio.h>
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
#include <jsapi.h>
static JSClass webgear_js_dom_collections_htmlcollection;
static JSClass webgear_js_dom_collections_nodelist;
static JSClass webgear_js_dom_core_attribute;
static JSClass webgear_js_dom_core_cdatasection;
static JSClass webgear_js_dom_core_characterdata;
static JSClass webgear_js_dom_core_comment;
static JSClass webgear_js_dom_core_document;
static JSClass webgear_js_dom_core_documenttype;
static JSClass webgear_js_dom_core_domimplementation;
static JSClass webgear_js_dom_core_element;
static JSClass webgear_js_dom_core_node;
static JSClass webgear_js_dom_core_text;
static JSClass webgear_js_dom_events_event;
static JSClass webgear_js_dom_events_eventtarget;
static JSClass webgear_js_dom_exeption;
static JSBool webgear_js_dom_core_comment_constructor();
static JSBool webgear_js_dom_core_element_getElementsByTagName();
static JSBool webgear_js_dom_core_text_constructor();
#include "console.h"
#include "global.h"
#include "dom/dom.h"
#include "dom/exeption.h"
#include "dom/window.h"
#include "dom/core/dom-core-attribute.h"
#include "dom/core/dom-core-cdatasection.h"
#include "dom/core/dom-core-characterdata.h"
#include "dom/core/dom-core-comment.h"
#include "dom/core/dom-core-document.h"
#include "dom/core/dom-core-documenttype.h"
#include "dom/core/dom-core-domimplementation.h"
#include "dom/core/dom-core-element.h"
#include "dom/core/dom-core-node.h"
#include "dom/core/dom-core-text.h"
#include "dom/collections/dom-collections-htmlcollection.h"
#include "dom/collections/dom-collections-nodelist.h"
#include "dom/events/dom-events-event.h"
#include "dom/events/dom-events-eventtarget.h"
#endif
|
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef COMPILEOPTIONSBASE_H
#define COMPILEOPTIONSBASE_H
#include "globals.h"
#include <wx/hashmap.h>
WX_DECLARE_STRING_HASH_MAP(wxString, StringHash);
/**
* This is a base class for all classes needing compilation parameters. It
* offers functions to get/set the following:\n
* \li Compiler options
* \li Linker options
* \li Compiler include dirs
* \li Resource compiler include dirs
* \li Linker include dirs
* \li Custom commands to be executed before/after build
* \li The settings modification status
* \n\n
* These settings are used by the compiler plugins to construct the necessary
* compilation commands.
*/
class DLLIMPORT CompileOptionsBase
{
public:
CompileOptionsBase();
virtual ~CompileOptionsBase();
virtual void AddPlatform(int platform);
virtual void RemovePlatform(int platform);
virtual void SetPlatforms(int platforms);
virtual int GetPlatforms() const;
virtual bool SupportsCurrentPlatform() const;
virtual void SetLinkerOptions(const wxArrayString& linkerOpts);
virtual const wxArrayString& GetLinkerOptions() const;
virtual void AddLinkerOption(const wxString& option);
virtual void RemoveLinkerOption(const wxString& option);
virtual void SetLinkLibs(const wxArrayString& linkLibs);
virtual const wxArrayString& GetLinkLibs() const;
virtual void AddLinkLib(const wxString& lib);
virtual void RemoveLinkLib(const wxString& lib);
virtual void SetCompilerOptions(const wxArrayString& compilerOpts);
virtual const wxArrayString& GetCompilerOptions() const;
virtual void AddCompilerOption(const wxString& option);
virtual void RemoveCompilerOption(const wxString& option);
virtual void SetIncludeDirs(const wxArrayString& includeDirs);
virtual const wxArrayString& GetIncludeDirs() const;
virtual void AddIncludeDir(const wxString& option);
virtual void RemoveIncludeDir(const wxString& option);
virtual void SetResourceIncludeDirs(const wxArrayString& resIncludeDirs);
virtual const wxArrayString& GetResourceIncludeDirs() const;
virtual void AddResourceIncludeDir(const wxString& option);
virtual void RemoveResourceIncludeDir(const wxString& option);
virtual void SetLibDirs(const wxArrayString& libDirs);
virtual const wxArrayString& GetLibDirs() const;
virtual void AddLibDir(const wxString& option);
virtual void RemoveLibDir(const wxString& option);
virtual void SetCommandsBeforeBuild(const wxArrayString& commands);
virtual const wxArrayString& GetCommandsBeforeBuild() const;
virtual void AddCommandsBeforeBuild(const wxString& command);
virtual void RemoveCommandsBeforeBuild(const wxString& command);
virtual void SetCommandsAfterBuild(const wxArrayString& commands);
virtual const wxArrayString& GetCommandsAfterBuild() const;
virtual void AddCommandsAfterBuild(const wxString& command);
virtual void RemoveCommandsAfterBuild(const wxString& command);
virtual void SetBuildScripts(const wxArrayString& scripts);
virtual const wxArrayString& GetBuildScripts() const;
virtual void AddBuildScript(const wxString& script);
virtual void RemoveBuildScript(const wxString& script);
virtual bool GetModified() const;
virtual void SetModified(bool modified);
virtual bool GetAlwaysRunPostBuildSteps() const;
virtual void SetAlwaysRunPostBuildSteps(bool always);
virtual bool SetVar(const wxString& key, const wxString& value, bool onlyIfExists = false);
virtual bool UnsetVar(const wxString& key);
virtual void UnsetAllVars();
virtual bool HasVar(const wxString& key) const;
virtual const wxString& GetVar(const wxString& key) const;
virtual const StringHash& GetAllVars() const;
protected:
int m_Platform;
wxArrayString m_LinkerOptions;
wxArrayString m_LinkLibs;
wxArrayString m_CompilerOptions;
wxArrayString m_IncludeDirs;
wxArrayString m_ResIncludeDirs;
wxArrayString m_LibDirs;
wxArrayString m_CmdsBefore;
wxArrayString m_CmdsAfter;
wxArrayString m_Scripts;
bool m_Modified;
bool m_AlwaysRunPostCmds;
StringHash m_Vars;
private:
};
#endif // COMPILEOPTIONSBASE_H
|
/*=========================================================================*\
Copyright (c) Microsoft Corporation. All rights reserved.
\*=========================================================================*/
#pragma once
/*#include <winapifamily.h>*/
/*#pragma region Desktop Family*/
/*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)*/
/*=========================================================================*\
D2D Status Codes
\*=========================================================================*/
#define FACILITY_D2D 0x899
#define MAKE_D2DHR( sev, code )\
MAKE_HRESULT( sev, FACILITY_D2D, (code) )
#define MAKE_D2DHR_ERR( code )\
MAKE_D2DHR( 1, code )
//+----------------------------------------------------------------------------
//
// D2D error codes
//
//------------------------------------------------------------------------------
//
// Error codes shared with WINCODECS
//
//
// The pixel format is not supported.
//
#define D2DERR_UNSUPPORTED_PIXEL_FORMAT WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT
//
// Error codes that were already returned in prior versions and were part of the
// MIL facility.
//
// Error codes mapped from WIN32 where there isn't already another HRESULT based
// define
//
//
// The supplied buffer was too small to accommodate the data.
//
#define D2DERR_INSUFFICIENT_BUFFER HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
//
// The file specified was not found.
//
#define D2DERR_FILE_NOT_FOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
#ifndef D2DERR_WRONG_STATE
//
// D2D specific codes
//
//
// The object was not in the correct state to process the method.
//
#define D2DERR_WRONG_STATE MAKE_D2DHR_ERR(0x001)
//
// The object has not yet been initialized.
//
#define D2DERR_NOT_INITIALIZED MAKE_D2DHR_ERR(0x002)
//
// The requested opertion is not supported.
//
#define D2DERR_UNSUPPORTED_OPERATION MAKE_D2DHR_ERR(0x003)
//
// The geomery scanner failed to process the data.
//
#define D2DERR_SCANNER_FAILED MAKE_D2DHR_ERR(0x004)
//
// D2D could not access the screen.
//
#define D2DERR_SCREEN_ACCESS_DENIED MAKE_D2DHR_ERR(0x005)
//
// A valid display state could not be determined.
//
#define D2DERR_DISPLAY_STATE_INVALID MAKE_D2DHR_ERR(0x006)
//
// The supplied vector is vero.
//
#define D2DERR_ZERO_VECTOR MAKE_D2DHR_ERR(0x007)
//
// An internal error (D2D bug) occurred. On checked builds, we would assert.
//
// The application should close this instance of D2D and should consider
// restarting its process.
//
#define D2DERR_INTERNAL_ERROR MAKE_D2DHR_ERR(0x008)
//
// The display format we need to render is not supported by the
// hardware device.
//
#define D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED MAKE_D2DHR_ERR(0x009)
//
// A call to this method is invalid.
//
#define D2DERR_INVALID_CALL MAKE_D2DHR_ERR(0x00A)
//
// No HW rendering device is available for this operation.
//
#define D2DERR_NO_HARDWARE_DEVICE MAKE_D2DHR_ERR(0x00B)
//
// There has been a presentation error that may be recoverable. The caller
// needs to recreate, rerender the entire frame, and reattempt present.
//
#define D2DERR_RECREATE_TARGET MAKE_D2DHR_ERR(0x00C)
//
// Shader construction failed because it was too complex.
//
#define D2DERR_TOO_MANY_SHADER_ELEMENTS MAKE_D2DHR_ERR(0x00D)
//
// Shader compilation failed.
//
#define D2DERR_SHADER_COMPILE_FAILED MAKE_D2DHR_ERR(0x00E)
//
// Requested DX surface size exceeded maximum texture size.
//
#define D2DERR_MAX_TEXTURE_SIZE_EXCEEDED MAKE_D2DHR_ERR(0x00F)
//
// The requested D2D version is not supported.
//
#define D2DERR_UNSUPPORTED_VERSION MAKE_D2DHR_ERR(0x010)
//
// Invalid number.
//
#define D2DERR_BAD_NUMBER MAKE_D2DHR_ERR(0x0011)
//
// Objects used together must be created from the same factory instance.
//
#define D2DERR_WRONG_FACTORY MAKE_D2DHR_ERR(0x012)
//
// A layer resource can only be in use once at any point in time.
//
#define D2DERR_LAYER_ALREADY_IN_USE MAKE_D2DHR_ERR(0x013)
//
// The pop call did not match the corresponding push call
//
#define D2DERR_POP_CALL_DID_NOT_MATCH_PUSH MAKE_D2DHR_ERR(0x014)
//
// The resource was realized on the wrong render target
//
#define D2DERR_WRONG_RESOURCE_DOMAIN MAKE_D2DHR_ERR(0x015)
//
// The push and pop calls were unbalanced
//
#define D2DERR_PUSH_POP_UNBALANCED MAKE_D2DHR_ERR(0x016)
//
// Attempt to copy from a render target while a layer or clip rect is applied
//
#define D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT MAKE_D2DHR_ERR(0x017)
//
// The brush types are incompatible for the call.
//
#define D2DERR_INCOMPATIBLE_BRUSH_TYPES MAKE_D2DHR_ERR(0x018)
//
// An unknown win32 failure occurred.
//
#define D2DERR_WIN32_ERROR MAKE_D2DHR_ERR(0x019)
//
// The render target is not compatible with GDI
//
#define D2DERR_TARGET_NOT_GDI_COMPATIBLE MAKE_D2DHR_ERR(0x01A)
//
// A text client drawing effect object is of the wrong type
//
#define D2DERR_TEXT_EFFECT_IS_WRONG_TYPE MAKE_D2DHR_ERR(0x01B)
//
// The application is holding a reference to the IDWriteTextRenderer interface
// after the corresponding DrawText or DrawTextLayout call has returned. The
// IDWriteTextRenderer instance will be zombied.
//
#define D2DERR_TEXT_RENDERER_NOT_RELEASED MAKE_D2DHR_ERR(0x01C)
//
// The requested size is larger than the guaranteed supported texture size.
//
#define D2DERR_EXCEEDS_MAX_BITMAP_SIZE MAKE_D2DHR_ERR(0x01D)
#else /*D2DERR_WRONG_STATE*/
//
// D2D specific codes now live in winerror.h
//
#endif /*D2DERR_WRONG_STATE*/
/*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
/*#pragma endregion*/
|
/**
* naken_asm assembler.
* Author: Michael Kohn
* Email: mike@mikekohn.net
* Web: http://www.mikekohn.net/
* License: GPLv3
*
* Copyright 2010-2019 by Michael Kohn
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "table/super_fx.h"
struct _table_super_fx table_super_fx[] =
{
{ "stop", 0x00, 0, 0xff, OP_NONE, 0 },
{ "nop", 0x01, 0, 0xff, OP_NONE, 0 },
{ "cache", 0x02, 0, 0xff, OP_NONE, 0 },
{ "lsr", 0x03, 0, 0xff, OP_NONE, 0 },
{ "rol", 0x04, 0, 0xff, OP_NONE, 0 },
{ "bra", 0x05, 0, 0xff, OP_OFFSET, 0 },
{ "blt", 0x06, 0, 0xff, OP_OFFSET, 0 },
{ "bge", 0x07, 0, 0xff, OP_OFFSET, 0 },
{ "bne", 0x08, 0, 0xff, OP_OFFSET, 0 },
{ "beq", 0x09, 0, 0xff, OP_OFFSET, 0 },
{ "bpl", 0x0a, 0, 0xff, OP_OFFSET, 0 },
{ "bmi", 0x0b, 0, 0xff, OP_OFFSET, 0 },
{ "bcc", 0x0c, 0, 0xff, OP_OFFSET, 0 },
{ "bcs", 0x0d, 0, 0xff, OP_OFFSET, 0 },
{ "bvc", 0x0e, 0, 0xff, OP_OFFSET, 0 },
{ "bvs", 0x0f, 0, 0xff, OP_OFFSET, 0 },
{ "to", 0x10, 0, 0xf0, OP_REG, 0xffff },
{ "with", 0x20, 0, 0xf0, OP_REG, 0xffff },
{ "stw", 0x30, 0, 0xf0, OP_ATREG, 0x0fff },
{ "loop", 0x3c, 0, 0xff, OP_NONE, 0 },
{ "alt1", 0x3d, 0, 0xff, OP_NONE, 0 },
{ "alt2", 0x3e, 0, 0xff, OP_NONE, 0 },
{ "alt3", 0x3f, 0, 0xff, OP_NONE, 0 },
{ "ldw", 0x40, 0, 0xf0, OP_ATREG, 0x0fff },
{ "plot", 0x4c, 0, 0xff, OP_NONE, 0 },
{ "swap", 0x4d, 0, 0xff, OP_NONE, 0 },
{ "color", 0x4e, 0, 0xff, OP_NONE, 0 },
{ "not", 0x4f, 0, 0xff, OP_NONE, 0 },
{ "add", 0x50, 0, 0xf0, OP_REG, 0xffff },
{ "sub", 0x60, 0, 0xf0, OP_REG, 0xffff },
{ "merge", 0x70, 0, 0xff, OP_NONE, 0 },
{ "and", 0x70, 0, 0xf0, OP_REG, 0xfffe },
{ "mult", 0x80, 0, 0xf0, OP_REG, 0xffff },
{ "sbk", 0x90, 0, 0xff, OP_NONE, 0 },
{ "link", 0x90, 0, 0xf0, OP_N, 0x0104 },
{ "sex", 0x95, 0, 0xff, OP_NONE, 0 },
{ "asr", 0x96, 0, 0xff, OP_NONE, 0 },
{ "ror", 0x97, 0, 0xff, OP_NONE, 0 },
//{ "jmp", 0x90, 0, 0xf0, OP_REG, 0x3f1c },
{ "jmp", 0x90, 0, 0xf0, OP_REG, 0x3f00 }, // <-- docs say r8-r13
{ "lob", 0x9e, 0, 0xff, OP_NONE, 0 },
{ "fmult", 0x9f, 0, 0xff, OP_NONE, 0 },
{ "ibt", 0xa0, 0, 0xf0, OP_REG_PP, 0xffff },
{ "from", 0xb0, 0, 0xf0, OP_REG, 0xffff },
{ "hib", 0xc0, 0, 0xff, OP_NONE, 0 },
{ "or", 0xc0, 0, 0xf0, OP_REG, 0xfffe },
{ "inc", 0xd0, 0, 0xf0, OP_REG, 0x7fff },
{ "getc", 0xdf, 0, 0xff, OP_NONE, 0 },
{ "dec", 0xe0, 0, 0xf0, OP_REG, 0x7fff },
{ "getb", 0xef, 0, 0xff, OP_NONE, 0 },
{ "iwt", 0xf0, 0, 0xf0, OP_REG_XX, 0xffff },
{ "stb", 0x30, 1, 0xf0, OP_ATREG, 0x0fff },
//{ "ldb", 0x40, 1, 0xf0, OP_ATREG, 0xafff },
{ "ldb", 0x40, 1, 0xf0, OP_ATREG, 0x0fff }, // <-- docs say r0-r11
{ "rpix", 0x4c, 1, 0xff, OP_NONE, 0 },
{ "cmode", 0x4e, 1, 0xff, OP_NONE, 0 },
{ "adc", 0x50, 1, 0xf0, OP_REG, 0xffff },
{ "sbc", 0x60, 1, 0xf0, OP_REG, 0xffff },
{ "bic", 0x70, 1, 0xf0, OP_REG, 0xfffe },
{ "umult", 0x80, 1, 0xf0, OP_REG, 0xffff },
{ "div2", 0x96, 1, 0xff, OP_NONE, 0 },
{ "ljmp", 0x90, 1, 0xff, OP_REG, 0x3f00 },
{ "lmult", 0x9f, 1, 0xff, OP_NONE, 0 },
{ "lms", 0xa0, 1, 0xf0, OP_REG_ATYY,0xffff },
{ "xor", 0xc0, 1, 0xf0, OP_REG, 0xffff },
{ "getbh", 0xef, 1, 0xff, OP_NONE, 0 },
{ "lm", 0xf0, 1, 0xf0, OP_REG_ATXX,0xffff },
{ "add", 0x50, 2, 0xf0, OP_N, 0 },
{ "sub", 0x60, 2, 0xf0, OP_N, 0 },
{ "and", 0x70, 2, 0xf0, OP_N, 0x010f },
{ "mult", 0x80, 2, 0xf0, OP_N, 0 },
{ "sms", 0xa0, 2, 0xf0, OP_ATYY_REG,0xffff },
{ "or", 0xc0, 2, 0xf0, OP_N, 0x010f },
{ "ramb", 0xdf, 2, 0xff, OP_NONE, 0 },
{ "getbl", 0xef, 2, 0xff, OP_NONE, 0 },
{ "sm", 0xf0, 2, 0xf0, OP_ATXX_REG,0xffff },
{ "adc", 0x50, 3, 0xf0, OP_N, 0 },
{ "cmp", 0x60, 3, 0xf0, OP_REG, 0xffff },
{ "bic", 0x70, 3, 0xf0, OP_N, 0x010f },
{ "umult", 0x80, 3, 0xf0, OP_N, 0 },
{ "xor", 0xc0, 3, 0xf0, OP_N, 0 },
{ "romb", 0xdf, 3, 0xff, OP_NONE, 0 },
{ "getbs", 0xef, 3, 0xff, OP_NONE, 0 },
};
|
/****************************************************************************/
/* */
/* This file is part of QSopt_ex. */
/* */
/* (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash, */
/* and Daniel Espinoza */
/* */
/* This code may be used under the terms of the GNU General Public License */
/* (Version 2.1 or later) as published by the Free Software Foundation. */
/* */
/* Alternatively, use is granted for research purposes only. */
/* */
/* It is your choice of which of these two licenses you are operating */
/* under. */
/* */
/* We make no guarantees about the correctness or usefulness of this code. */
/* */
/****************************************************************************/
#ifndef mpf___PRIORITY_H__
#define mpf___PRIORITY_H__
#include "mpf_dheaps_i.h"
/****************************************************************************/
/* */
/* mpf_priority.c */
/* */
/****************************************************************************/
typedef struct mpf_ILLpriority
{
mpf_ILLdheap mpf_heap;
union mpf_ILLpri_data
{
void *data;
int next;
}
*pri_info;
int space;
int freelist;
}
mpf_ILLpriority;
void mpf_ILLutil_priority_free (mpf_ILLpriority * pri),
mpf_ILLutil_priority_delete (mpf_ILLpriority * pri,
int handle),
mpf_ILLutil_priority_changekey (mpf_ILLpriority * pri,
int handle,
mpf_t * newkey),
mpf_ILLutil_priority_findmin (mpf_ILLpriority * pri,
mpf_t * keyval,
void **en),
mpf_ILLutil_priority_deletemin (mpf_ILLpriority * pri,
mpf_t * keyval,
void **en);
int mpf_ILLutil_priority_init (mpf_ILLpriority * pri,
int k),
mpf_ILLutil_priority_insert (mpf_ILLpriority * pri,
void *data,
mpf_t * keyval,
int *handle);
#endif
|
/*****************************************************************************
*
* This file is part of GwMove hydrogeological software developed by
* Dr. M. A. Sbai
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
*
*****************************************************************************/
#ifndef HAPP_CSR
#define HAPP_CSR
namespace happ
{
/**
* Compressed sparse row square matrix class.
*/
class CsrMatrix
{
private:
/// matrix dimension
unsigned int dimension;
/// number of elements
unsigned int ne;
/// finite elements connectivity
unsigned int *connectivity;
/// initialize main class members.
void Init();
/// builds diagonal and column pointers of sparse matrix
bool BuildPointers();
void PrintVector(unsigned int N, double *vec);
public:
/// periodic size of FE connectivity (e.g. 8 for hexahedral elements-nodes connectivity)
unsigned int size;
/// diagonal elements
double *diagonal;
/// diagonal pointers
unsigned int *pd;
/// column pointers
unsigned int *pc;
/// compressed sparse matrix (non-zero entries)
double *matrix;
/// default constructor
CsrMatrix(unsigned int dim);
/// second constructor (from FEM connectivity list)
CsrMatrix(unsigned int dim, unsigned int *connect, unsigned int nelem);
/// default destructor
virtual ~CsrMatrix();
/// initialize the matrix elements
void InitMatrix();
/// return matrix dimension
unsigned int GetDim() {
return dimension;
}
/// sets matrix dimension
void SetDim(unsigned int dim) {
dimension = dim;
}
/// adjusts positive definitness of the sparse matrix
void AdjustPositiveDefiniteness();
/**
* Incomplete factorisation of a symmetric and positive definite sparse matrix.
* The decomposition is done such that L is the strictely lower part, P^-1 is
* a diagonal matrix so that the resultant matrix LDLt, having the same nonzero
* structure as the original matrix, and the same diagonal entries.
*/
bool IncompleteFactorization();
/**
* Matrix vector multiplication operation. We multiply a symmetric matrix
* given in the lower triangular compact form by vector x. The resultant
* is vector y.
*/
void Multiply(const unsigned int N, double *x, double *y);
/**
* Solves algebraic equations by back-substitution of lower triangular
* matrix in LDL'y=x, where x is known and y unknown.
*/
void BackSubSolve(const unsigned int N, double *x, double *y);
};
/// Dot-product function of two vectors.
inline
double dot_product(const unsigned int N, double *a, double *b)
{
unsigned int i;
double sum = 0.;
for (i = 0; i < N; i++) {
sum += a[i] * b[i];
}
return sum;
}
}
#endif // HAPP_CSR
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v3_cmpeq = (v2_r1 == v2_r1);
if (v3_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v5_r5 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v7_r6 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
atomic_store_explicit(&vars[2], 2, memory_order_seq_cst);
int v9_r8 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v10_r9 = v9_r8 ^ v9_r8;
int v11_r9 = v10_r9 + 1;
atomic_store_explicit(&vars[0], v11_r9, memory_order_seq_cst);
int v19 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v19, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[1], 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v12 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v13 = (v12 == 2);
int v14 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v15 = (v14 == 2);
int v16 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v17_conj = v15 & v16;
int v18_conj = v13 & v17_conj;
if (v18_conj == 1) assert(0);
return 0;
}
|
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "Fibonacci.h"
// print a HugeInteger (without a newline character)
void hugePrint(HugeInteger *p)
{
int i;
if (p == NULL || p->digits == NULL)
{
printf("(null pointer)");
return;
}
for (i = p->length - 1; i >= 0; i--)
printf("%d", p->digits[i]);
}
int main(void)
{
int i;
HugeInteger *p, *q, *r;
// calculate INT_MAX + 1
p = parseInt(INT_MAX);
q = parseInt(1);
r = hugeAdd(p, q);
// demonstrate overflow
printf("Overflow style:\n%d + %d = %d\n\n", INT_MAX, 1, INT_MAX + 1);
// print result of INT_MAX + 1 with HugeIntegers
printf("HugeInteger style:\n");
hugePrint(p);
printf(" + ");
hugePrint(q);
printf(" = ");
hugePrint(r);
printf("\n\n");
// free memory
hugeDestroyer(p);
hugeDestroyer(q);
hugeDestroyer(r);
// now calculate UINT_MAX + 1
p = parseInt(UINT_MAX);
q = parseInt(1);
r = hugeAdd(p, q);
// demonstrate overflow
printf("Overflow style:\n%u + %u = %u\n\n", UINT_MAX, 1, UINT_MAX + 1);
// print result of UINT_MAX + 1 with HugeIntegers
printf("HugeInteger style:\n");
hugePrint(p);
printf(" + ");
hugePrint(q);
printf(" = ");
hugePrint(r);
printf("\n");
// free memory
hugeDestroyer(p);
hugeDestroyer(q);
hugeDestroyer(r);
return 0;
}
|
/**
* D-LAN - A decentralized LAN file sharing software.
* Copyright (C) 2010-2012 Greg Burri <greg.burri@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/>.
*/
#pragma once
#include <QtGlobal>
#include <QByteArray>
#include <Protos/core_protocol.pb.h>
#include <Common/Hash.h>
#include <Common/Network/MessageSocket.h>
namespace PM
{
class ISocket
{
public:
virtual ~ISocket() {}
virtual void setReadBufferSize(qint64 size) = 0;
virtual qint64 bytesAvailable() const = 0;
virtual qint64 read(char* data, qint64 maxSize) = 0;
virtual QByteArray readAll() = 0;
virtual bool waitForReadyRead(int msecs) = 0;
virtual qint64 bytesToWrite() const = 0;
virtual qint64 write(const char* data, qint64 maxSize) = 0;
virtual qint64 write(const QByteArray& byteArray) = 0;
virtual bool waitForBytesWritten(int msecs) = 0;
virtual void moveToThread(QThread* targetThread) = 0;
virtual QString errorString() const = 0;
/**
* Returns the ID of the remote peer on which the socket is connected.
*/
virtual Common::Hash getRemotePeerID() const = 0;
/**
* Used by uploader to tell when an upload is finished.
* @param closeTheSocket If true force the socket to be closed.
*/
virtual void finished(bool closeTheSocket = false) = 0;
};
}
|
/* Copyright 2013 Juan Rada-Vilela
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* File: Exporter.h
* Author: jcrada
*
* Created on 25 December 2012, 11:40 PM
*/
#ifndef FL_EXPORTER_H
#define FL_EXPORTER_H
#include "fl/fuzzylite.h"
#include <string>
namespace fl {
class Engine;
class FL_EXPORT Exporter{
public:
Exporter(){}
virtual ~Exporter(){}
virtual std::string name() const = 0;
virtual std::string toString(const Engine* engine) const = 0;
};
}
#endif /* FL_EXPORTER_H */
|
// Copyright (c) 2005 - 2015 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 LIBUTIL_H_INCLUDED
#define LIBUTIL_H_INCLUDED
#pragma once
#include "files.h"
#include "error.h"
#include "colors.h"
#include "Serializer.h"
#include "SerializableArray.h"
#include "Singleton.h"
#include "MyTime.h"
#include "Log.h"
#include "Socket.h"
#include "SocketSet.h"
#endif // !LIBUTIL_H_INCLUDED
|
/**
* @file TopicModel.h
* @author William Martin <will.st4@gmail.com>
* @since 0.1
*
* @section LICENSE
*
* This file is part of tact.
*
* tact 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.
* tact 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 tact. If not, see <http://www.gnu.org/licenses/>.
*
* @section DESCRIPTION
*
* Represents an abstract Topic Model.
* <br> Call estimate() to run the model on the given corpus.
*
*/
#ifndef TOPICMODEL_H
#define TOPICMODEL_H
#define ALPHA_NUMERATOR_DEFAULT 50
#define BETA_DEFAULT 0.1
#define NO_ITERATIONS_DEFAULT 2000
#define NO_TOPICS_DEFAULT 100
#define SAVE_INTERVAL_DEFAULT 100
#include "tact/input/corpus/feature/FeatureCorpus.h"
#include "tact/input/exceptions/IncompatibleCorpusException.h"
#include "tact/model/ProbabilityMatrix.h"
#include "tact/util/exceptions/OutOfBoundsException.h"
#include <memory>
#include <vector>
using std::auto_ptr;
using std::vector;
class TopicModel {
public:
/**
* Default constructor.
*
* @param alpha the dirichlet parameter for each topic.
* Dirichlet(alpha,alpha,...) is the distribution over topics.
* @param beta the prior on the per-topic multinomial distribution
* over words.
* @param corpus the Corpus that this model will run on.
* @param noTopics the number of topics that this TopicModel should have.
* @throw IncompatibleCorpusException if the given Corpus was not of
* a compatible type. The default required type is FeatureCorpus.
*
*/
TopicModel(double const alpha, double const beta,
auto_ptr< Corpus > corpus, int const noTopics)
throw (IncompatibleCorpusException);
/**
* Default destructor.
*
*/
virtual ~TopicModel();
/**
* Estimates this TopicModel, saving the results every <interval>
* iterations.
*
* @param noIterations the number of iterations to estimate over.
* @param outputDirectory the directory to save results to.
* @param saveInterval saves the results every <interval> iterations.
*
*/
virtual void estimate(int const & noIterations,
string const & outputDirectory, int const & saveInterval) = 0;
/**
* Gets the array of alpha values.
*
* @return the array of alpha values.
*
*/
double const getAlpha() const;
/**
* Gets the beta value.
*
* @return the beta value.
*
*/
double const getBeta() const;
/**
* Gets the Corpus that this TopicModel runs on.
*
* @return the Corpus that this TopicModel runs on.
*
*/
FeatureCorpus const * const getCorpus() const;
/**
* Gets the number of documents in this Topic Model.
*
* @return the number of documents in this Topic Model.
*
*/
int const getNoDocuments() const;
/**
* Gets the number of iterations that have been completed.
*
* @return the number of iterations that have been completed.
*
*/
int const getNoIterationsCompleted() const;
/**
* Gets the number of Topics.
*
* @return the number of Topics.
*
*/
int const getNoTopics() const;
/**
* Gets the term-topic probability matrix, indexed by [topic][term].
*
* @return the term-topic probability matrix.
*
*/
ProbabilityMatrix const * const getTermTopicMatrix() const;
/**
* Gets the topic-document probability matrix, indexed by
* [document][topic].
*
* @return the topic-document probability matrix.
*
*/
ProbabilityMatrix const * const getTopicDocumentMatrix() const;
protected:
/**
* Dirichlet(alpha,alpha,...) is the distribution over topics.
*
*/
double alpha;
/**
* Prior on per-topic multinomial distribution over words.
*
*/
double beta;
/**
* The corpus that this model runs on.
*
*/
FeatureCorpus * corpus;
/**
* The number of iterations that have been completed.
*
*/
int noIterationsCompleted;
/**
* The number of Topics to train over.
*
*/
int noTopics;
/**
* Term-Topic probability matrix.
* Indexed by [topic][term].
*
*/
ProbabilityMatrix * termTopicMatrix;
/**
* Topic-Document probability matrix.
* Indexed by [document][topic].
*
*/
ProbabilityMatrix * topicDocumentMatrix;
};
#endif /* TOPICMODEL_H */
|
#ifndef SUPPORT_H
#define SUPPORT_h
#include <string>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_.H>
#include "qso_db.h"
#include "adif_io.h"
#include "lgbook.h"
#ifdef __WOE32__
# define ADIF_SUFFIX "adi"
#else
# define ADIF_SUFFIX "adif"
#endif
enum savetype {ADIF, CSV, TEXT, LO};
extern cQsoDb qsodb;
extern cAdifIO adifFile;
extern std::string logbook_filename;
extern std::string sDate_on;
extern std::string sDate_off;
extern void loadBrowser(bool keep_pos = false);
extern void Export_log();
extern void cb_SortByCall();
extern void cb_SortByDate();
extern void cb_SortByMode();
extern void cb_SortByFreq();
extern void cb_browser(Fl_Widget *, void *);
extern void cb_mnuNewLogbook(Fl_Menu_* m, void* d);
extern void cb_mnuOpenLogbook(Fl_Menu_* m, void* d);
extern void cb_mnuSaveLogbook(Fl_Menu_*m, void* d);
extern void cb_mnuMergeADIF_log(Fl_Menu_* m, void* d);
extern void cb_mnuExportADIF_log(Fl_Menu_* m, void* d);
extern void cb_mnuExportCSV_log(Fl_Menu_* m, void* d);
extern void cb_mnuExportTEXT_log(Fl_Menu_* m, void* d);
extern void cb_Export_Cabrillo(Fl_Menu_* m, void* d);
extern void cb_export_date_select();
extern void saveLogbook();
extern void cb_mnuShowLogbook(Fl_Menu_ *m, void* d);
extern void activateButtons();
extern void saveRecord ();
extern void clearRecord ();
extern void updateRecord ();
extern void deleteRecord ();
extern void AddRecord ();
extern void DisplayRecord (int idxRec);
extern void SearchLastQSO (const char *);
extern cQsoRec* SearchLog(const char *callsign);
extern void DupCheck();
extern void cb_search(Fl_Widget* w, void*);
extern int log_search_handler(int);
extern void reload_browser();
extern void cb_doExport();
extern void WriteCabrillo();
extern void dxcc_entity_cache_enable(bool v);
extern bool qsodb_dxcc_entity_find(const char* country);
extern void adif_read_OK();
#endif
|
//
// JAListViewItem.h
// AppMon
//
// Created by Chong Francis on 11年6月3日.
// Copyright 2011年 Ignition Soft Limited. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JAListViewItem.h"
@interface CountryListItem : JAListViewItem {
@private
NSGradient *gradient;
NSButton* btnCheckbox;
NSImageView* imgFlag;
NSTextField* lblCountry;
}
@property (nonatomic, retain) NSGradient* gradient;
@property (nonatomic, retain) IBOutlet NSButton* btnCheckbox;
@property (nonatomic, retain) IBOutlet NSImageView* imgFlag;
@property (nonatomic, retain) IBOutlet NSTextField* lblCountry;
+ (CountryListItem*) item;
-(void) setCountryName:(NSString*)countryName;
-(void) setFlagName:(NSString*)flagName;
@end
|
/*********************************************************************
CombLayer : MCNP(X) Input builder
* File: constructInc/VacuumBox.h
*
* Copyright (c) 2004-2021 by Stuart Ansell
*
* 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 constructSystem_VacuumBox_h
#define constructSystem_VacuumBox_h
class Simulation;
namespace constructSystem
{
/*!
\class VacuumBox
\version 1.0
\author S. Ansell
\date July 2015
\brief VacuumBox unit
*/
class VacuumBox :
public attachSystem::FixedOffset,
public attachSystem::ContainedComp,
public attachSystem::CellMap,
public attachSystem::FrontBackCut
{
private:
const bool centreOrigin; ///< Construct on the first port
double voidHeight; ///< void height [top only]
double voidWidth; ///< void width [total]
double voidDepth; ///< void depth [low only]
double voidLength; ///< void length [total]
double feHeight; ///< fe height [top only]
double feDepth; ///< fe depth [low only]
double feWidth; ///< fe width [total]
double feFront; ///< fe front
double feBack; ///< fe back
double portAXStep; ///< XStep of port
double portAZStep; ///< ZStep of port
double portAWallThick; ///< Flange wall thickness
double portATubeLength; ///< Port tube
double portATubeRadius; ///< Port tube length
double portBXStep; ///< XStep of port
double portBZStep; ///< ZStep of port
double portBXAngle; ///< XAngle of port
double portBZAngle; ///< ZAngle of port
double portBWallThick; ///< Flange wall thickness
double portBTubeLength; ///< Port tube
double portBTubeRadius; ///< Port tube length
double flangeARadius; ///< Joining Flange radius
double flangeALength; ///< Joining Flange length
double flangeBRadius; ///< Joining Flange radius
double flangeBLength; ///< Joining Flange length
int voidMat; ///< void material
int feMat; ///< Fe material layer
void populate(const FuncDataBase&);
void createUnitVector(const attachSystem::FixedComp&,const long int);
void createSurfaces();
void createObjects(Simulation&);
void createLinks();
public:
VacuumBox(const std::string&,const bool =0);
VacuumBox(const VacuumBox&);
VacuumBox& operator=(const VacuumBox&);
virtual ~VacuumBox();
using FixedComp::createAll;
void createAll(Simulation&,const attachSystem::FixedComp&,
const long int);
};
}
#endif
|
#include "prstack.h"
#include "stdlib.h"
#include "string.h"
int pr_stack_create(struct stack ** self, _pr_list_compare_data compare)
{
(*self) = (struct stack *) malloc(sizeof(struct stack));
(*self)->size = 0;
(*self)->head = NULL;
(*self)->compare = compare;
return 0;
}
int pr_stack_push(struct stack * self, void * data, unsigned int length)
{
int ret_val = pr_list_insert_compare(&(self->head), data, length, self->compare);
if (0 == ret_val)
{
self->size++;
}
return ret_val;
}
int pr_stack_top(struct stack * self, void * ret_data)
{
if (self->head == NULL)
{
return -1;
}
memcpy(ret_data, self->head->data, self->head->length);
return 0;
}
int pr_stack_pop(struct stack * self, void * ret_data)
{
int ret_val = pr_stack_top(self, ret_data);
if (-1 == ret_val)
{
return -1;
}
struct list * iter = self->head;
self->head = self->head->next;
free(iter->data);
free(iter);
self->size--;
return 0;
}
int pr_stack_free(struct stack ** self)
{
if (*self == NULL)
{
return -1;
}
int ret_val = pr_list_free(&((*self)->head));
if (-1 == ret_val)
{
return -1;
}
free(*self);
(*self) = NULL;
return ret_val;
}
|
// Pekka Pirila's sports timekeeping program (Finnish: tulospalveluohjelma)
// Copyright (C) 2015 Pekka Pirila
// 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 UnitKilpailijaEmitH
#define UnitKilpailijaEmitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Grids.hpp>
#include "HkDef.h"
#include <Vcl.Buttons.hpp>
#include <Vcl.Menus.hpp>;
//---------------------------------------------------------------------------
class TFormKilpailijaEmit : public TForm
{
__published: // IDE-managed Components
TEdit *EdtKilpno;
TLabel *Label1;
TEdit *Nimi;
TEdit *Maa;
TLabel *Label3;
TEdit *TLahto;
TEdit *TMaali;
TLabel *Label4;
TEdit *Tulos;
TLabel *Label5;
TEdit *Sija;
TLabel *Label6;
TStringGrid *EmitGrid;
TButton *SrjKarki;
TButton *SeurBtn;
TButton *EdBtn;
TLabel *Label10;
TEdit *EdtSeura;
TStringGrid *VaGrid;
TComboBox *SrjVal;
TBitBtn *BitBtn1;
TMainMenu *MainMenu1;
TMenuItem *iedosto1;
TMenuItem *Sulje1;
void __fastcall EdtKilpnoChanged(TObject *Sender);
void __fastcall naytaTiedot(void);
void __fastcall SrjKarkiBtn(TObject *Sender);
void __fastcall SeurBtnClick(TObject *Sender);
void __fastcall EdBtnClick(TObject *Sender);
void __fastcall EdtKilpnoKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall FormResize(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall SrjValChange(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall BitBtn1Click(TObject *Sender);
void __fastcall EmitGridMouseWheelDown(TObject *Sender, TShiftState Shift, TPoint &MousePos,
bool &Handled);
void __fastcall EmitGridMouseWheelUp(TObject *Sender, TShiftState Shift, TPoint &MousePos,
bool &Handled);
void __fastcall Sulje1Click(TObject *Sender);
private: // User declarations
int Sarja;
int dKilp;
kilptietue *Kilp;
public: // User declarations
void __fastcall naytaKilpailija(int d);
__fastcall TFormKilpailijaEmit(TComponent* Owner);
wchar_t Kohde[30];
};
//---------------------------------------------------------------------------
extern TFormKilpailijaEmit *FormKilpailijaEmit;
//---------------------------------------------------------------------------
#endif
|
//
// JVCryptoTests.h
// JVSecurity
//
// Created by Jake Vizzoni on 11/8/12.
// Copyright (c) 2012 JV Assets, LLC. All rights reserved.
//
// This file is part of JVSecurity.
//
// JVSecurity 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.
//
// JVSecurity 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 JVSecurity. If not, see <http://www.gnu.org/licenses/>.
#import <SenTestingKit/SenTestingKit.h>
@interface JVCryptoTests : SenTestCase
@end
|
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <LaunchServices/LaunchServices.h>
#include <LaunchServices/LaunchServicesPriv.h>
#include <stdio.h>
#include <stdlib.h>
#include <launch_priv.h>
static void get_main_executable_info(CFURLRef appURL, CFStringRef *exec, CFStringRef *bundleName);
static int verbose = 0;
__attribute__((constructor)) static void initme(void) {
verbose = getenv("STUB_VERBOSE") != NULL;
}
OSStatus LSRegisterURL(CFURLRef inURL, Boolean inUpdate)
{
if (verbose)
printf("STUB: LSRegisterURL\n");
return 0;
}
OSStatus LSOpenFromURLSpec(const LSLaunchURLSpec *inLaunchSpec, CFURLRef *outLaunchedURL)
{
CFStringRef scheme, extension;
CFIndex count, i;
CFURLRef url;
CFRange range;
OSStatus ret = 0, temp;
/* Inspect scheme of URL */
count = CFArrayGetCount(inLaunchSpec->itemURLs);
for (i = 0; i < count; i++)
{
url = CFArrayGetValueAtIndex(inLaunchSpec->itemURLs, i);
scheme = CFURLCopyScheme(url);
range = CFRangeMake(0, CFStringGetLength(scheme));
if (CFStringCompareWithOptions(scheme, CFSTR("file"), range, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
{
/* First check if it's a "mac thing", if not forward to xdg-open */
/* Check for .app suffix */
extension = CFURLCopyPathExtension(url);
if (extension != NULL)
range = CFRangeMake(0, CFStringGetLength(extension));
if (extension != NULL && (CFStringCompareWithOptions(extension, CFSTR("app"), range, kCFCompareCaseInsensitive) == kCFCompareEqualTo))
{
temp = _LSLaunchApplication(url);
if (temp)
ret = temp;
}
else
{
printf("TODO: forward to xdg-open\n");
ret = 1;
}
if (extension != NULL)
CFRelease(extension);
}
else
{
printf("We can't handle this scheme yet\n");
ret = kLSApplicationNotFoundErr;
}
CFRelease(scheme);
}
return ret;
}
OSStatus _LSLaunchApplication(CFURLRef appPath)
{
CFStringRef executable, bundleName;
CFIndex nameSize, execSize;
CFURLRef pre, url_plus_exec;
pid_t pid;
char *name, *exec, *argv[2];
/* Read info.plist, find path to main executable */
get_main_executable_info(appPath, &executable, &bundleName);
if (executable == NULL)
{
return 1;
}
else
{
url_plus_exec = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, appPath, CFSTR("Contents"), TRUE);
pre = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, url_plus_exec, CFSTR("MacOS"), TRUE);
CFRelease(url_plus_exec);
url_plus_exec = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, pre, executable, FALSE);
CFRelease(pre);
/* Launch the executable */
executable = CFURLGetString(url_plus_exec);
/* Try to use CFBundleName first */
if (bundleName == NULL)
bundleName = CFStringCreateCopy(kCFAllocatorDefault, executable);
nameSize = CFStringGetMaximumSizeOfFileSystemRepresentation(bundleName);
name = malloc(nameSize);
CFStringGetFileSystemRepresentation(bundleName, name, nameSize);
execSize = CFStringGetMaximumSizeOfFileSystemRepresentation(executable);
exec = malloc(execSize);
CFStringGetFileSystemRepresentation(executable, exec, execSize);
argv[0] = exec;
argv[1] = NULL;
pid = spawn_via_launchd(name, (const char *const *)argv, NULL);
if (pid < 0)
{
printf("%s: Failed to spawn via launchd\n", exec);
return 1;
}
free(name);
free(exec);
CFRelease(url_plus_exec);
CFRelease(executable);
}
if (bundleName != NULL)
CFRelease(bundleName);
return 0;
}
static void get_main_executable_info(CFURLRef appURL, CFStringRef *exec, CFStringRef *bundleName)
{
CFURLRef pre = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, appURL, CFSTR("Contents"), TRUE);
CFURLRef info_plist_url = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, pre, CFSTR("Info.plist"), FALSE);
CFReadStreamRef rs = CFReadStreamCreateWithFile(kCFAllocatorDefault, info_plist_url);
CFDictionaryRef info_plist;
CFStringRef ret = NULL;
/* TODO: Simplify by using CFBundleGetInfoDictionary */
*exec = NULL;
*bundleName = NULL;
CFRelease(pre);
if (!CFReadStreamOpen(rs))
{
printf("Failed to read Info.plist\n");
goto err_pre_info;
}
info_plist = CFPropertyListCreateWithStream(kCFAllocatorDefault, rs, 0, 0, NULL, NULL);
if (CFGetTypeID(info_plist) != CFDictionaryGetTypeID())
{
printf("Root object of Info.plist not CFDictionaryRef!\n");
goto err;
}
ret = CFDictionaryGetValue(info_plist, CFSTR("CFBundleExecutable"));
if (ret != NULL)
ret = CFStringCreateCopy(kCFAllocatorDefault, ret);
*exec = ret;
ret = CFDictionaryGetValue(info_plist, CFSTR("CFBundleName"));
if (ret != NULL)
*bundleName = CFStringCreateCopy(kCFAllocatorDefault, ret);
err:
CFRelease(info_plist);
err_pre_info:
CFRelease(rs);
CFRelease(info_plist_url);
}
|
/**************************************************************************//**
* @file
* @brief efm32zg_calibrate Register and Bit Field definitions
* @author Energy Micro AS
* @version 3.20.2
******************************************************************************
* @section License
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
******************************************************************************
*
* 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.
* 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.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
* obligation to support this Software. Energy Micro AS is providing the
* Software "AS IS", with no express or implied warranties of any kind,
* including, but not limited to, any implied warranties of merchantability
* or fitness for any particular purpose or warranties against infringement
* of any proprietary rights of a third party.
*
* Energy Micro AS will not be liable for any consequential, incidental, or
* special damages, or any other relief, or for any claim by any third party,
* arising from your use of this Software.
*
*****************************************************************************/
/**************************************************************************//**
* @defgroup EFM32ZG_CALIBRATE
* @{
*****************************************************************************/
#define CALIBRATE_MAX_REGISTERS 50 /**< Max number of address/value pairs for calibration */
typedef struct
{
__I uint32_t ADDRESS; /**< Address of calibration register */
__I uint32_t VALUE; /**< Default value for calibration register */
} CALIBRATE_TypeDef; /** @} */
|
/*
*
* This file is a part of my arduino development.
* If you make any modifications or improvements to the code, I would
* appreciate that you share the code with me so that I might include
* it in the next release. I can be contacted through paul.torruella@gmail.com
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU GENERAL PUBLIC LICENSE 3.0 license.
* Please see the included documents for further information.
* Commercial use of this file and/or every others file from this library requires
* you to buy a license that will allow commercial use. This includes using the code,
* modified or not, as a tool to sell products.
* The license applies to this file and its documentation.
*
* Created on: 23 févr. 2016
* Author: Paul TORRUELLA
*/
#ifndef integer_h
#define integer_h
#include "Arduino.h"
namespace Wrapper{
template<class T> class Integer{
private:
const T* const _value;
const char* _unit;
const byte _exp;
mutable T valueDisplayed;
protected:
public:
Integer(const T* const value, const char* unit = 0, byte exp = 0):_value(value), _unit(unit), _exp(exp), valueDisplayed(0){
}
boolean hasBeenModified()const{
return valueDisplayed != *_value;
}
T getValue()const{
long pow = 1;
for(int i = 0; i < _exp; i++){
pow *= 10;
}
valueDisplayed = *_value;
return (pow / 2 + *_value) / pow;
}
operator String()const{
String retour(getValue());
if(_unit != 0){
retour += _unit;
}
return retour;
}
};
}
#endif
|
/*
Extracted from dmenu drw.h
MIT/X Consortium License
© 2006-2014 Anselm R Garbe <anselm@garbe.us>
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
© 2009 Gottox <gottox@s01.de>
© 2009 Markus Schnalke <meillo@marmaro.de>
© 2009 Evan Gates <evan.gates@gmail.com>
© 2006-2008 Sander van Dijk <a dot h dot vandijk at gmail dot com>
© 2006-2007 Michał Janeczek <janeczek at gmail dot com>
© 2014-2015 Hiltjo Posthuma <hiltjo@codemadness.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef _DRW_H
#define _DRW_H
#include <stddef.h>
#define UTF_SIZ 4
size_t
utf8decode(const char *, long *, size_t);
#endif
|
//
// gyro.h
// robot
//
// Created by Simone Rossi on 23/11/16.
// Copyright © 2016 Simone Rossi. All rights reserved.
//
#ifndef gyro_h
#define gyro_h
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/time.h>
#include "ev3.h"
#include "ev3_port.h"
#include "ev3_tacho.h"
#include "ev3_sensor.h"
#include "utilities.h"
#ifndef PTR
#define PTR
typedef uint8_t sensor_ptr;
#endif
pthread_mutex_t gyro_mutex;
typedef struct {
sensor_ptr address;
/** Angle in deg (-32768 to 32767) */
int angle;
/** Rotational Speed in deg/s(-440 to 440) */
int rot_speed;
}gyro_sensor;
int read_gyro_angle(gyro_sensor* gyro);
int read_gyro_speed(gyro_sensor* gyro);
void read_gyro_status(gyro_sensor* gyro);
void* __gyro_status_reader(void* gyro);
#endif /* gyro_h */
|
#ifndef __multibouncergame__
#define __multibouncergame__
#include "../PulsarEngine/PulsarEngine.h"
#include <boost/filesystem.hpp>
#include "bouncers/SmallFastTestBouncer.h"
#include <wiiuse.h>
class MultiBouncerGame
{
public:
MultiBouncerGame();
~MultiBouncerGame();
int run();
private:
void init();
void initGUI();
irr::EKEY_CODE ***loadControls( pulsar::ConfigStorage *input,
pulsar::ScriptToolKit *scriptTK );
wiimote **connectWiimotes( int &connected );
//Menu gui items
irr::gui::IGUIWindow *m_MainMenu;
irr::gui::IGUIListBox *m_MapList;
irr::gui::IGUIButton *m_OkButton, *mReconnectButton;
irr::gui::IGUISpinBox *m_PlayerCounter;
//Ingame gui items
irr::gui::IGUIWindow *mScoreWindow;
irr::gui::IGUIStaticText *mScoreCounter;
std::vector<boost::filesystem::path> m_MapFiles;
std::vector<pulsar::ConfigStorage*> m_MapData;
pulsar::PulsarEngine *m_Engine;
int mWinWidth, mWindHeight;
};
#endif // __multibouncergame__
|
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2011 <copyright holder> <email>
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 UTILITY_H
#define UTILITY_H
#include <cstring>
namespace util
{
//------------------------------------------------------------------------------
/// Struct providing a cstring compare function.
//
struct cstr_comp
{
bool operator()(char const *a, char const *b)
{
return std::strcmp(a, b) < 0;
}
};
}
#endif //UTILITY_H
|
#pragma once
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class Math {
public:
static float to_radians(float degrees) {
return degrees * M_PI / 180.0f;
}
};
|
//Created by KVClassFactory on Thu Sep 27 17:23:23 2012
//Author: John Frankland,,,
#ifndef __KVElementDensity_H
#define __KVElementDensity_H
#include "KVNuclData.h"
/**
\class KVElementDensity
\brief Atomic element with name, symbol and density
\ingroup NucProp
*/
class KVElementDensity : public KVNuclData {
Int_t fZ;
Bool_t fIsGas;
TString fSymbol;
TString fElementName;
public:
KVElementDensity();
KVElementDensity(const Char_t* name);
KVElementDensity(const KVElementDensity&) ;
ROOT_COPY_ASSIGN_OP(KVElementDensity)
virtual ~KVElementDensity();
void Copy(TObject&) const;
void SetZ(Int_t z)
{
fZ = z;
};
Int_t GetZ() const
{
return fZ;
};
void SetIsGas(Bool_t g = kTRUE)
{
fIsGas = g;
};
Bool_t IsGas() const
{
return fIsGas;
};
void SetElementSymbol(const Char_t* s)
{
fSymbol = s;
};
const Char_t* GetElementSymbol() const
{
return fSymbol;
};
void SetElementName(const Char_t* en)
{
fElementName = en;
};
const Char_t* GetElementName() const
{
return fElementName;
};
void Print(Option_t* o = "") const;
ClassDef(KVElementDensity, 1) //Atomic element with name, symbol and density
};
#endif
|
/*
Copyright 2011 rhn <gihu.rhn@porcupinefactory.org>
This file is part of Jazda.
Jazda 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.
Jazda 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 Jazda. If not, see <http://www.gnu.org/licenses/>.
*/
#include "speed.h"
#include "../sensors/wheel.h"
#include "../lib/timer.h"
#include "../lib/calculations.h"
#include "../display/drawing.h"
#include "../display/pcd8544.h" // decimal point hack
#include "distance.h"
/* ---------- CONSTANTS --------------- */
// numbers
/* Speed calculations:
X - rotation distance in internal units
N - rotation count
T - rotations time in internal units
L - internal time units making one second
Y - speed in internal units
a - decimal point in distance
b - decimal point in speed
General:
\frac{NX}{10^{a}}\cdot\frac{km}{Ts\frac{1}{L}}=\frac{Y}{10^{b}}\cdot\frac{km}{h}
Solution:
Y=\frac{NL}{T}36\cdot10^{b-a+2}X
*/
// TODO: power 10 ** (SPEED_DIGITS - DIST_DIGITS + 2)
#ifdef LONG_CALCULATIONS
#define SPEED_FACTOR_t uint32_t
#define get_speed_factor(pdist) ((SPEED_FACTOR_t)pdist * ONE_SECOND * 36 * 10) // T and N excluded as variable
#else
#ifdef HIGH_PRECISION_CALCULATIONS
#define SPEED_FACTOR_t uint32_t
#define get_speed_factor(pdist) ((SPEED_FACTOR_t)pdist * ONE_SECOND * 36 * 10) // T and N excluded as variable
#else
#define SPEED_FACTOR_t uint16_t
#define SPEED_TRUNCATION_BITS 1
#define get_speed_factor(pdist) (((SPEED_FACTOR_t)pdist * 36 * 10) >> (FRAC_BITS - TIMER_BITS + SPEED_TRUNCATION_BITS)) // T and N excluded as variable
#endif
#endif
#define INITIAL_SPEED_FACTOR (get_speed_factor(INITIAL_PULSE_DIST))
// reading from either wheel pulse or wheel stop event
volatile uint16_t speed_newest_reading;
// flag for notifying about pulse_table and oldest_pulse_index changes
volatile uint8_t speed_pulse_occured = true;
volatile int8_t speed_timer_handle = -1;
#ifdef CONSTANT_PULSE_DISTANCE
const SPEED_FACTOR_t speed_factor = INITIAL_SPEED_FACTOR;
#else
volatile SPEED_FACTOR_t speed_factor = INITIAL_SPEED_FACTOR;
void speed_update_factor(void) {
speed_factor = get_speed_factor(pulse_dist);
}
#endif
#ifdef LONG_CALCULATIONS
uint16_t get_average_speed_long(uint32_t time_amount, const uint16_t pulse_count) {
return get_rot_speed_long(speed_factor, time_amount, pulse_count);
}
#endif
uint16_t get_average_speed(const uint16_t time_amount, const uint8_t pulse_count) {
return get_rot_speed(speed_factor, time_amount, pulse_count);
}
void speed_on_timeout(void) {
uint16_t now = get_time();
// gradual speed decrease before stopping
speed_newest_reading = now;
speed_pulse_occured = true;
speed_timer_handle = timer_set_callback(now + wheel_pulse_table[0] - wheel_pulse_table[1], &speed_on_timeout);
}
void speed_on_wheel_stop(void) {
speed_pulse_occured = true;
// no need to set "now" value: during redraw after a stop, speed will be 0 anyway
timer_clear_callback(speed_timer_handle);
speed_timer_handle = -1;
}
void speed_on_wheel_pulse(uint16_t now) {
speed_newest_reading = now;
speed_pulse_occured = true;
timer_clear_callback(speed_timer_handle);
if (wheel_pulse_count > 1) {
// set timer for smooth slowdown. only set if
uint16_t predicted = now - wheel_pulse_table[1];
uint16_t ahead = predicted + (predicted / 4);
// NOTE: remove ahead / 4 to save 10 bytes
speed_timer_handle = timer_set_callback(now + ahead, &speed_on_timeout);
}
}
// OBFUSCATION WARNING
void speed_redraw(void) {
if (speed_pulse_occured) {
speed_pulse_occured = false;
uint16_t speed;
upoint_t position = {50, 0};
upoint_t glyph_size = {10, 16};
if (wheel_pulse_count > 1) {
// speed going down when no pulses present
uint8_t pulse_index;
uint16_t newest_pulse;
uint16_t next_pulse;
uint16_t oldest_pulse;
do {
speed_pulse_occured = false;
newest_pulse = speed_newest_reading;
next_pulse = wheel_pulse_table[0];
pulse_index = wheel_pulse_count - 1;
if (newest_pulse != next_pulse) { // if newest pulse is artificial
oldest_pulse = wheel_pulse_table[pulse_index - 1];
} else {
oldest_pulse = wheel_pulse_table[pulse_index];
}
} while (speed_pulse_occured);
uint8_t interval_count = pulse_index;
uint16_t intervals_duration = newest_pulse - oldest_pulse;
speed = get_average_speed(intervals_duration, interval_count);
} else {
speed = 0;
}
print_number(speed, position, glyph_size, 2, SPEED_DIGITS);
// ugly hack to print decimal point
set_column(position.x - 2 + SPEED_SIGNIFICANT_DIGITS * (glyph_size.x + 2));
set_row(position.y + 1);
send_raw_byte(0b11000000, true);
send_raw_byte(0b01000000, true);
}
}
|
#define BENCHMARK "OSU MPI%s Gather Latency Test"
/*
* Copyright (C) 2002-2013 the Network-Based Computing Laboratory
* (NBCL), The Ohio State University.
*
* Contact: Dr. D. K. Panda (panda@cse.ohio-state.edu)
*
* For detailed copyright and licensing information, please refer to the
* copyright file COPYRIGHT in the top level OMB directory.
*/
#include "osu_coll.h"
int
main (int argc, char *argv[])
{
int i, numprocs, rank, size;
int skip;
double latency = 0.0, t_start = 0.0, t_stop = 0.0;
double timer=0.0;
double avg_time = 0.0, max_time = 0.0, min_time = 0.0;
char * sendbuf = NULL, * recvbuf = NULL;
int po_ret;
size_t bufsize;
set_header(HEADER);
set_benchmark_name("osu_gather");
enable_accel_support();
po_ret = process_options(argc, argv);
if (po_okay == po_ret && cuda == options.accel) {
if (init_cuda_context()) {
fprintf(stderr, "Error initializing cuda context\n");
exit(EXIT_FAILURE);
}
}
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
switch (po_ret) {
case po_bad_usage:
print_bad_usage_message(rank);
MPI_Finalize();
exit(EXIT_FAILURE);
case po_help_message:
print_help_message(rank);
MPI_Finalize();
exit(EXIT_SUCCESS);
case po_version_message:
print_version_message(rank);
MPI_Finalize();
exit(EXIT_SUCCESS);
case po_okay:
break;
}
if(numprocs < 2) {
if (rank == 0) {
fprintf(stderr, "This test requires at least two processes\n");
}
MPI_Finalize();
exit(EXIT_FAILURE);
}
if ((options.max_message_size * numprocs) > options.max_mem_limit) {
options.max_message_size = options.max_mem_limit / numprocs;
}
bufsize = options.max_message_size * numprocs;
if (0 == rank) {
if (allocate_buffer((void**)&recvbuf, bufsize, options.accel)) {
fprintf(stderr, "Could Not Allocate Memory [rank %d]\n", rank);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
set_buffer(recvbuf, options.accel, 1, bufsize);
}
if (allocate_buffer((void**)&sendbuf, options.max_message_size * numprocs,
options.accel)) {
fprintf(stderr, "Could Not Allocate Memory [rank %d]\n", rank);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
set_buffer(sendbuf, options.accel, 0, bufsize);
print_preamble(rank);
for (size=1; size <= options.max_message_size; size *= 2) {
if (size > LARGE_MESSAGE_SIZE) {
skip = SKIP_LARGE;
options.iterations = options.iterations_large;
} else {
skip = SKIP;
}
MPI_Barrier(MPI_COMM_WORLD);
timer=0.0;
for (i=0; i < options.iterations + skip ; i++) {
t_start = MPI_Wtime();
MPI_Gather(sendbuf, size, MPI_CHAR, recvbuf, size, MPI_CHAR, 0,
MPI_COMM_WORLD);
t_stop = MPI_Wtime();
if (i >= skip) {
timer+=t_stop-t_start;
}
MPI_Barrier(MPI_COMM_WORLD);
}
latency = (double)(timer * 1e6) / options.iterations;
MPI_Reduce(&latency, &min_time, 1, MPI_DOUBLE, MPI_MIN, 0,
MPI_COMM_WORLD);
MPI_Reduce(&latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0,
MPI_COMM_WORLD);
MPI_Reduce(&latency, &avg_time, 1, MPI_DOUBLE, MPI_SUM, 0,
MPI_COMM_WORLD);
avg_time = avg_time/numprocs;
print_stats(rank, size, avg_time, min_time, max_time);
MPI_Barrier(MPI_COMM_WORLD);
}
if (0 == rank) {
free_buffer(recvbuf, options.accel);
}
free_buffer(sendbuf, options.accel);
MPI_Finalize();
if (cuda == options.accel) {
if (destroy_cuda_context()) {
fprintf(stderr, "Error destroying cuda context\n");
exit(EXIT_FAILURE);
}
}
return EXIT_SUCCESS;
}
/* vi: set sw=4 sts=4 tw=80: */
|
/******************************************************/
/* */
/* maction.h - button actions for showing numbers */
/* */
/******************************************************/
/* Copyright 2017 Pierre Abbat.
* This file is part of Mirasol.
*
* Mirasol 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.
*
* Mirasol 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 Mirasol. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACTION_H
#define MACTION_H
#include <QtWidgets>
class MirasolAction: public QAction
{
Q_OBJECT
public:
MirasolAction(QObject *parent=nullptr,int kind=0);
void activate(ActionEvent event);
public slots:
void setKind(int kind); // sets checked if kind matches myKind
void setNumber(int num); // sets enabled if num is my kind of number
signals:
void kindChanged(int kind); // emitted on activate(triggered)
protected:
bool event(QEvent *e);
private:
int myKind;
};
#endif
|
/**
* Copyright (C) 2015 NIPE-SYSTEMS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <curl/curl.h>
#include <mrss.h>
#include "unused.h"
#include "json-c/json.h"
#include "rss_to_json.h"
char *rss_to_json(char *data, size_t length)
{
mrss_t *mrss_data = NULL;
mrss_error_t mrss_error;
mrss_item_t *mrss_item = NULL;
json_object *root_object = NULL;
json_object *item_array = NULL;
json_object *item_object = NULL;
char *return_string = NULL;
mrss_error = mrss_parse_buffer(data, length, &mrss_data);
if(mrss_error != MRSS_OK)
{
fprintf(stderr, "Failed to parse RSS: %s\n", mrss_strerror(mrss_error));
return NULL;
}
root_object = json_object_new_object();
json_object_object_add(root_object, "title", json_object_new_string(SAFE_STRING(mrss_data->title)));
json_object_object_add(root_object, "description", json_object_new_string(SAFE_STRING(mrss_data->description)));
json_object_object_add(root_object, "link", json_object_new_string(SAFE_STRING(mrss_data->link)));
json_object_object_add(root_object, "language", json_object_new_string(SAFE_STRING(mrss_data->language)));
json_object_object_add(root_object, "rating", json_object_new_string(SAFE_STRING(mrss_data->rating)));
json_object_object_add(root_object, "copyright", json_object_new_string(SAFE_STRING(mrss_data->copyright)));
json_object_object_add(root_object, "pub_date", json_object_new_string(SAFE_STRING(mrss_data->pubDate)));
json_object_object_add(root_object, "last_build_date", json_object_new_string(SAFE_STRING(mrss_data->lastBuildDate)));
json_object_object_add(root_object, "docs", json_object_new_string(SAFE_STRING(mrss_data->docs)));
json_object_object_add(root_object, "managingeditor", json_object_new_string(SAFE_STRING(mrss_data->managingeditor)));
json_object_object_add(root_object, "webmaster", json_object_new_string(SAFE_STRING(mrss_data->webMaster)));
json_object_object_add(root_object, "generator", json_object_new_string(SAFE_STRING(mrss_data->generator)));
json_object_object_add(root_object, "ttl", json_object_new_int(mrss_data->ttl));
json_object_object_add(root_object, "about", json_object_new_string(SAFE_STRING(mrss_data->about)));
item_array = json_object_new_array();
mrss_item = mrss_data->item;
while(mrss_item)
{
item_object = json_object_new_object();
json_object_object_add(item_object, "title", json_object_new_string(SAFE_STRING(mrss_item->title)));
json_object_object_add(item_object, "description", json_object_new_string(SAFE_STRING(mrss_item->description)));
json_object_object_add(item_object, "link", json_object_new_string(SAFE_STRING(mrss_item->link)));
json_object_object_add(item_object, "author", json_object_new_string(SAFE_STRING(mrss_item->author)));
json_object_object_add(item_object, "comments", json_object_new_string(SAFE_STRING(mrss_item->comments)));
json_object_object_add(item_object, "pub_date", json_object_new_string(SAFE_STRING(mrss_item->pubDate)));
json_object_object_add(item_object, "guid", json_object_new_string(SAFE_STRING(mrss_item->guid)));
json_object_object_add(item_object, "guid_is_permalink", json_object_new_int(mrss_item->guid_isPermaLink));
json_object_array_add(item_array, item_object);
mrss_item = mrss_item->next;
}
json_object_object_add(root_object, "items", item_array);
return_string = strdup(json_object_to_json_string_ext(root_object, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED));
json_object_put(root_object);
mrss_free(mrss_data);
return return_string;
}
|
/*
* This file is part of Vertigo.
*
* Vertigo - a cross-platform arcade game powered by Ogre3D.
* Copyright (C) 2011 Ahmad Amireh <ahmad@amireh.net>
*
* Vertigo 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.
*
* Vertigo 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 Vertigo. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef H_Utility_H
#define H_Utility_H
#include <exception>
#include <stdexcept>
#include <typeinfo>
#include "Pixy.h"
namespace Pixy {
class BadConversion : public std::runtime_error {
public:
inline BadConversion(const std::string& s)
: std::runtime_error(s)
{ }
};
class BadStream : public std::runtime_error {
public:
inline BadStream(const std::string& s)
: std::runtime_error(s)
{ }
};
class UnknownEvent : public std::runtime_error {
public:
inline UnknownEvent(const std::string& s)
: std::runtime_error(s)
{ }
};
class UnknownEventSender : public std::runtime_error {
public:
inline UnknownEventSender(const std::string& s)
: std::runtime_error(s)
{ }
};
class BadEvent : public std::runtime_error {
public:
inline BadEvent(const std::string& s)
: std::runtime_error(s)
{ }
};
class UnassignedProfile : public std::runtime_error {
public:
inline UnassignedProfile(const std::string& s)
: std::runtime_error(s)
{ }
};
class UnknownSpell : public std::runtime_error {
public:
inline UnknownSpell(const std::string& s)
: std::runtime_error(s)
{ }
};
template<typename T>
inline std::string stringify(const T& x)
{
std::ostringstream o;
if (!(o << x))
throw BadConversion(std::string("stringify(")
+ typeid(x).name() + ")");
return o.str();
}
// helper; converts an integer-based type to a string
template<typename T>
inline void convert(const std::string& inString, T& inValue,
bool failIfLeftoverChars = true)
{
std::istringstream _buffer(inString);
char c;
if (!(_buffer >> inValue) || (failIfLeftoverChars && _buffer.get(c)))
throw BadConversion(inString);
}
template<typename T>
inline T convertTo(const std::string& inString,
bool failIfLeftoverChars = true)
{
T _value;
convert(inString, _value, failIfLeftoverChars);
return _value;
}
class Utility {
public:
static inline log4cpp::Category& getLogger() {
return log4cpp::Category::getInstance(CLIENT_LOG_CATEGORY);
}
};
}
#endif
|
// $Id$ -*- C++ -*-
// Assoc<int, VarArray<int> > and Assoc<string, VarArray<int> >.
// Copyright (C) 1996 Technische Universitaet Braunschweig, Germany.
// Written by Andreas Zeller <zeller@gnu.org>.
//
// This file is part of DDD.
//
// DDD 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.
//
// DDD 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 DDD -- see the file COPYING.
// If not, see <http://www.gnu.org/licenses/>.
//
// DDD is the data display debugger.
// For details, see the DDD World-Wide-Web page,
// `http://www.gnu.org/software/ddd/',
// or send a mail to the DDD developers <ddd@gnu.org>.
#ifndef _DDD_IntIntArrayAssoc_h
#define _DDD_IntIntArrayAssoc_h
#include "Assoc.h"
#include "IntArray.h"
#include "strclass.h"
typedef Assoc<int, VarIntArray> IntIntArrayAssoc;
typedef AssocIter<int, VarIntArray> IntIntArrayAssocIter;
typedef Assoc<string, VarIntArray> StringIntArrayAssoc;
typedef AssocIter<string, VarIntArray> StringIntArrayAssocIter;
typedef VarArray<IntArray> IntArrayArray;
typedef Assoc<string, IntArrayArray> StringIntArrayArrayAssoc;
typedef AssocIter<string, IntArrayArray> StringIntArrayArrayAssocIter;
#endif // _DDD_IntIntArrayAssoc_h
// DON'T ADD ANYTHING BEHIND THIS #endif
|
/******************************************************
*
* propertybang - implementation file
*
* copyleft (c) IOhannes m zmölnig
*
* 2007:forum::für::umläute:2010
*
* institute of electronic music and acoustics (iem)
*
******************************************************
*
* license: GNU General Public License v.2
*
******************************************************/
/*
* this object provides a way to make an abstraction "property" aware
* usage:
* + put this object into an abstraction
* + put the abstraction in a patch
* + you can now right-click on the abstraction and select the "properties" menu
* + selecting the "properties" menu, will send a bang to the outlet of this object
*
* nice, eh?
*/
#include "iemguts-objlist.h"
#include "g_canvas.h"
/* ------------------------- propertybang ---------------------------- */
static t_class *propertybang_class;
typedef struct _propertybang
{
t_object x_obj;
} t_propertybang;
t_propertiesfn s_orgfun=NULL;
static void propertybang_free(t_propertybang *x)
{
removeObjectFromCanvases((t_pd*)x);
}
static void propertybang_bang(t_propertybang *x) {
outlet_bang(x->x_obj.ob_outlet);
}
static void propertybang_properties(t_gobj*z, t_glist*owner) {
t_iemguts_objlist*objs=objectsInCanvas((t_pd*)z);
if(NULL==objs) {
s_orgfun(z, owner);
}
while(objs) {
t_propertybang*x=(t_propertybang*)objs->obj;
propertybang_bang(x);
objs=objs->next;
}
}
static void *propertybang_new(void)
{
t_propertybang *x = (t_propertybang *)pd_new(propertybang_class);
t_glist *glist=(t_glist *)canvas_getcurrent();
t_canvas *canvas=(t_canvas*)glist_getcanvas(glist);
t_class *class = ((t_gobj*)canvas)->g_pd;
t_propertiesfn orgfun=NULL;
outlet_new(&x->x_obj, &s_bang);
orgfun=class_getpropertiesfn(class);
if(orgfun!=propertybang_properties)
s_orgfun=orgfun;
class_setpropertiesfn(class, propertybang_properties);
addObjectToCanvas((t_pd*)canvas, (t_pd*)x);
return (x);
}
void propertybang_setup(void)
{
propertybang_class = class_new(gensym("propertybang"), (t_newmethod)propertybang_new,
(t_method)propertybang_free, sizeof(t_propertybang), CLASS_NOINLET, 0);
class_addbang(propertybang_class, propertybang_bang);
s_orgfun=NULL;
}
|
/*
* CAMXServer.h
*
* Created on: 2017年5月15日
* Author: root
*/
#pragma once
#include <map>
#include "CATcpServer.h"
class CAMXServer: public CATcpServer
{
public:
explicit CAMXServer();
virtual ~CAMXServer();
int request(const int nSocketFD, const char *szData);
int response(const int nSocketFD, const char *szData);
protected:
void onTimer(int nId);
int onTcpReceive(unsigned long int nSocketFD);
virtual void onClientConnect(unsigned long int nSocketFD);
virtual void onClientDisconnect(unsigned long int nSocketFD);
virtual int onAmxStatus(unsigned long int nSocketFD, const char *szStatus) = 0;
private:
void bind(const int nSocketFD);
void unbind(const int nSocketFD);
int sendPacket(const int nSocketFD, const char *szData);
private:
std::map<int, int> mapClient;
};
|
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>,
* Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
* Copyright (C) 2011 Stephen Caudle <scaudle@doceme.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/>.
*/
#include <libopencm3/stm32/f4/rcc.h>
#include <libopencm3/stm32/f4/gpio.h>
u16 exti_line_state;
/* Set STM32 to 168 MHz. */
void clock_setup(void)
{
rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_168MHZ]);
}
void gpio_setup(void)
{
/* Enable GPIOD clock. */
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPDEN);
/* Set GPIO12 (in GPIO port D) to 'output push-pull'. */
gpio_mode_setup(GPIOD, GPIO_MODE_OUTPUT,
GPIO_PUPD_NONE, GPIO12 | GPIO13 | GPIO14 | GPIO15);
}
void button_setup(void)
{
/* Enable GPIOA clock. */
rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
/* Set GPIO0 (in GPIO port A) to 'input open-drain'. */
gpio_mode_setup(GPIOA, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO0);
}
int main(void)
{
int i;
clock_setup();
button_setup();
gpio_setup();
/* Blink the LED (PD12) on the board. */
while (1) {
gpio_toggle(GPIOD, GPIO12);
/* Upon button press, blink more slowly. */
exti_line_state = GPIOA_IDR;
if ((exti_line_state & (1 << 0)) != 0) {
for (i = 0; i < 3000000; i++) /* Wait a bit. */
__asm__("nop");
}
for (i = 0; i < 3000000; i++) /* Wait a bit. */
__asm__("nop");
}
return 0;
}
|
#import "headers/_UIVisualEffectVibrantLayerConfig.h"
#import "headers/_UIVisualEffectTintLayerConfig.h"
#include <CoreGraphics/CoreGraphics.h>
#import "headers/CAFilter.h"
@class UIVibrancyEffect;
@class CAFilter;
@interface WNVibrantStyling : NSObject {
CGFloat _alpha;
NSString * _blendMode;
UIColor * _burnColor;
UIColor * _color;
CAFilter * _composedFilter;
UIColor * _darkenColor;
BOOL _inputReversed;
long long _style;
}
@property (nonatomic, readonly) CGFloat alpha;
@property (nonatomic, readonly, copy) NSString *blendMode;
@property (getter=_burnColor, nonatomic, readonly, copy) UIColor *burnColor;
@property (nonatomic, readonly) UIColor *color;
@property (nonatomic, readonly, copy) CAFilter *composedFilter;
@property (getter=_darkenColor, nonatomic, readonly, copy) UIColor *darkenColor;
@property (getter=_inputReversed, nonatomic, readonly) BOOL inputReversed;
@property (nonatomic, readonly) long long style;
- (UIColor *)_burnColor;
- (UIColor *)_darkenColor;
- (BOOL)_inputReversed;
- (_UIVisualEffectLayerConfig *)_layerConfig;
- (CGFloat)alpha;
- (NSString *)blendMode;
- (UIColor *)color;
- (CAFilter *)composedFilter;
- (long long)style;
@end
@interface WNVibrantLightStyling : WNVibrantStyling
- (_UIVisualEffectLayerConfig *)_layerConfig;
- (NSString *)blendMode;
- (CAFilter *)composedFilter;
@end
@interface WNPlusDStyling : WNVibrantStyling
- (NSString *)blendMode;
@end
@interface WNVibrantSecondaryStyling : WNVibrantLightStyling
- (UIColor *)_burnColor;
- (UIColor *)_darkenColor;
- (BOOL)_inputReversed;
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantHighContrastStyling : WNVibrantStyling
- (CGFloat)alpha;
- (NSString *)blendMode;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantPrimaryStyling : WNVibrantStyling
- (CGFloat)alpha;
- (NSString *)blendMode;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantRuleStyling : WNVibrantLightStyling
- (UIColor *)_burnColor;
- (UIColor *)_darkenColor;
- (BOOL)_inputReversed;
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantSecondaryAlternateStyling : WNVibrantLightStyling
- (UIColor *)_burnColor;
- (UIColor *)_darkenColor;
- (BOOL)_inputReversed;
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetPrimaryHighlightStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetPrimaryStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetQuaternaryStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetSecondaryHighlightStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetSecondaryStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
@interface WNVibrantWidgetTertiaryStyling : WNPlusDStyling
- (CGFloat)alpha;
- (UIColor *)color;
- (long long)style;
@end
|
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef QTPROJECTPARAMETERS_H
#define QTPROJECTPARAMETERS_H
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QTextStream;
QT_END_NAMESPACE
namespace Qt4ProjectManager {
namespace Internal {
// Create a macro name by taking a file name, upper casing it and
// appending a suffix.
QString createMacro(const QString &name, const QString &suffix);
// Base parameters for application project generation with functionality to
// write a .pro-file section.
struct QtProjectParameters {
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, Qt4Plugin };
QtProjectParameters();
// Return project path as "path/name"
QString projectPath() const;
void writeProFile(QTextStream &) const;
static void writeProFileHeader(QTextStream &);
// Shared library: Name of export macro (XXX_EXPORT)
static QString exportMacro(const QString &projectName);
// Shared library: name of #define indicating compilation within library
static QString libraryMacro(const QString &projectName);
Type type;
QString name;
QString path;
QString selectedModules;
QString deselectedModules;
QString targetDirectory;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // QTPROJECTPARAMETERS_H
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __APPLE_IOS_LOGGER_H
#define __APPLE_IOS_LOGGER_H
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
#include <stdio.h>
#else
#include <asl.h>
#endif
#include <stdarg.h>
static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
{
#if TARGET_IPHONE_SIMULATOR
vprintf(fmt, ap);
#else
aslmsg msg = asl_new(ASL_TYPE_MSG);
asl_set(msg, ASL_KEY_READ_UID, "-1");
if (tag)
asl_log(NULL, msg, ASL_LEVEL_NOTICE, "%s", tag);
asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap);
asl_free(msg);
#endif
}
static inline void RARCH_LOG(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
RARCH_LOG_V(NULL, fmt, ap);
va_end(ap);
}
static inline void RARCH_LOG_OUTPUT_V(const char *tag,
const char *fmt, va_list ap)
{
RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_LOG_OUTPUT(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
RARCH_LOG_OUTPUT_V(NULL, fmt, ap);
va_end(ap);
}
static inline void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap)
{
RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_WARN(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
RARCH_WARN_V(NULL, fmt, ap);
va_end(ap);
}
static inline void RARCH_ERR_V(const char *tag, const char *fmt, va_list ap)
{
RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_ERR(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
RARCH_ERR_V(NULL, fmt, ap);
va_end(ap);
}
#endif
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: ../pdfreporter-core/src/org/oss/pdfreporter/engine/util/AbstractTextMeasurerFactory.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory")
#ifdef RESTRICT_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory
#define INCLUDE_ALL_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory 0
#else
#define INCLUDE_ALL_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory 1
#endif
#undef RESTRICT_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory
#if !defined (OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory_) && (INCLUDE_ALL_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory || defined(INCLUDE_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory))
#define OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory_
#define RESTRICT_OrgOssPdfreporterEngineUtilJRTextMeasurerFactory 1
#define INCLUDE_OrgOssPdfreporterEngineUtilJRTextMeasurerFactory 1
#include "org/oss/pdfreporter/engine/util/JRTextMeasurerFactory.h"
@protocol OrgOssPdfreporterEngineFillJRTextMeasurer;
@protocol OrgOssPdfreporterEngineJRCommonText;
@interface OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory : NSObject < OrgOssPdfreporterEngineUtilJRTextMeasurerFactory >
#pragma mark Public
- (instancetype)init;
- (id<OrgOssPdfreporterEngineFillJRTextMeasurer>)createMeasurerWithOrgOssPdfreporterEngineJRCommonText:(id<OrgOssPdfreporterEngineJRCommonText>)text;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory)
FOUNDATION_EXPORT void OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory_init(OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory *self);
J2OBJC_TYPE_LITERAL_HEADER(OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory)
#endif
#pragma pop_macro("INCLUDE_ALL_OrgOssPdfreporterEngineUtilAbstractTextMeasurerFactory")
|
/**
* D-LAN - A decentralized LAN file sharing software.
* Copyright (C) 2010-2012 Greg Burri <greg.burri@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 LOGMANAGER_IENTRY_H
#define LOGMANAGER_IENTRY_H
#include <QString>
#include <QDateTime>
namespace LM
{
enum Severity
{
SV_FATAL_ERROR = 0x01,
SV_ERROR = 0x02,
SV_WARNING = 0x04,
SV_DEBUG = 0x08,
SV_END_USER = 0x10,
SV_UNKNOWN = 0x20
};
class IEntry
{
public:
virtual ~IEntry() {}
virtual QDateTime getDate() const = 0;
virtual QString getDateStr(bool withMs = true) const = 0;
virtual Severity getSeverity() const = 0;
virtual QString getSeverityStr() const = 0;
virtual const QString& getName() const = 0;
virtual const QString& getThread() const = 0;
virtual const QString& getSource() const = 0;
virtual const QString& getMessage() const = 0;
virtual QString getMessageWithLF() const = 0;
};
}
#endif
|
#include <string.h>
#include "ui.h"
/*
Handles the delete event if it
occurs in the main window.
*/
static gboolean
handle_delete_event (GtkWidget *, GdkEvent *, gpointer);
/*
Releases all resources.
*/
static void
handle_destroy (GtkWidget *, gpointer data);
/*
Handle the vi keybindings.
Maybe this should be done using a
GtkIMContext. But this time I'm too lazy
to implement one :-).
*/
static void
handle_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
int
main(int argc, char *argv[])
{
ui_t *ui;
gtk_init (&argc, &argv);
ui = create_user_interface ();
/*
Connect signals.
*/
g_signal_connect (ui->main_window, "delete-event",
G_CALLBACK (handle_delete_event), NULL);
g_signal_connect (ui->main_window, "destroy",
G_CALLBACK (handle_destroy), ui);
g_signal_connect (ui->main_window, "key-press-event",
G_CALLBACK (handle_key_press_event), ui);
gtk_widget_show_all (ui->main_window);
/*
Enter main loop.
*/
gtk_main ();
return 0;
}
gboolean
handle_delete_event (GtkWidget *widget,
GdkEvent *event, gpointer data)
{
/* Nothing fancy this time. */
return FALSE;
}
void
handle_destroy (GtkWidget *widget, gpointer data)
{
/* Release the user interface object. */
g_free (data);
gtk_main_quit ();
}
static void
handle_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
g_printf ("Huhu\n");
}
|
/******************************************************************************
* This file is part of Zee.
*
* Zee 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.
*
* Zee 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 Zee. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef ZTIMER_H
#define ZTIMER_H
#define ZEE_TIMER "zee:timer"
#define ZTIMER_TRACKING_INTV 125
#include <QTimer>
#include <zutil.h>
#include <zui/zuiutils.h>
#include <zconfigurable.h>
#include <zeventmanager.h>
class ZTimer : public QObject, public ZConfigurable
{
Q_OBJECT
Q_PROPERTY(quint64 iterations READ iterations)
public:
ZTimer(const ZConfig &el, QObject *parent=0);
~ZTimer();
void parse(const ZConfig &el);
void setInterval(qint64);
bool isActive();
quint64 iterations();
public slots:
void start();
void stop();
void reset();
signals:
void timeout();
void started();
void stopped();
void elapsed(qint64);
void remaining(qint64);
void tick();
private slots:
void incrementIterations();
void startEmit();
void trackStart(int intv=ZTIMER_TRACKING_INTV);
void trackTick();
void trackFinish();
private:
bool _emitOnStart;
qint64 _interval;
qint64 _elapsed;
QTimer *_timer;
QTimer *_tracker;
QTimer *_prestart;
quint64 _iterations;
};
#endif // ZTIMER_H
|
/*
* Generated by asn1c-0.9.22 (http://lionet.info/asn1c)
* From ASN.1 module "RRLP-Components"
* found in "../rrlp-components.asn"
*/
#ifndef _AlertFlag_H_
#define _AlertFlag_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeInteger.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* AlertFlag */
typedef long AlertFlag_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_AlertFlag;
asn_struct_free_f AlertFlag_free;
asn_struct_print_f AlertFlag_print;
asn_constr_check_f AlertFlag_constraint;
ber_type_decoder_f AlertFlag_decode_ber;
der_type_encoder_f AlertFlag_encode_der;
xer_type_decoder_f AlertFlag_decode_xer;
xer_type_encoder_f AlertFlag_encode_xer;
per_type_decoder_f AlertFlag_decode_uper;
per_type_encoder_f AlertFlag_encode_uper;
#ifdef __cplusplus
}
#endif
#endif /* _AlertFlag_H_ */
#include <asn_internal.h>
|
/*--------------------------------------------------------------------*\
| This file is part of jmines
|
| <+Description+>
|
| Copyright 2012, Jeremy Brubaker <jbru362@gmail.com>
|---------------------------------------------------------------------*\
| jmines 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. |
| |
| jmines 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 jmines. If not, see <http://www.gnu.org/licenses/>. |
\*--------------------------------------------------------------------*/
#ifndef CLI_H
#define CLI_H
#include "game.h"
int game_loop (game_data *);
#endif /* !defined (CLI_H) */
|
/* -*- c++ -*- */
/*
* Copyright 2016 Bastille Networks.
*
* This 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.
*
* This software 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_NORDIC_NORDIC_TX_IMPL_H
#define INCLUDED_NORDIC_NORDIC_TX_IMPL_H
#include <nordic/nordic_tx.h>
#include <queue>
namespace gr {
namespace nordic {
class nordic_tx_impl : public nordic_tx
{
private:
// TX nordictap queue
std::queue<pmt::pmt_t> m_tx_queue;
// Lookup table to unpack bytes to bits (NRZ)
char m_unpack_table[256][8];
// Number of output channels
uint8_t m_channel_count;
// Incoming message handler
void nordictap_message_handler(pmt::pmt_t msg);
// Process a crc byte (or partial byte)
uint16_t crc_update (uint16_t crc, uint8_t data, uint8_t bits=8);
public:
nordic_tx_impl(uint8_t channel_count);
~nordic_tx_impl();
// Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace nordic
} // namespace gr
#endif /* INCLUDED_NORDIC_NORDIC_TX_IMPL_H */
|
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <stdio.h>
#include "addresses.h"
#include "rct2.h"
#include "strings.h"
/**
* Writes a formatted string to a buffer.
* rct2: 0x006C2555
* dest (edi)
* format (ax)
* args (ecx)
*/
void format_string(char *dest, rct_string_id format, void *args)
{
RCT2_CALLPROC_X(0x006C2555, format, 0, (int)args, 0, 0, (int)dest, 0);
}
void generate_string_file()
{
FILE* f;
uint8** str;
uint8* c;
int i;
f = fopen("english.txt", "w");
for (i = 0; i < 4442; i++) {
str = ((uint8**)(0x009BF2D4 + (i * 4)));
if (*str == (uint8*)0xFFFFFFFF)
continue;
c = *str;
fprintf(f, "STR_%04d :", i);
while (*c != '\0') {
switch (*c) {
case 7: fputs("{TINYFONT}", f); break;
case 8: fputs("{BIGFONT}", f); break;
case 9: fputs("{MEDIUMFONT}", f); break;
case 10: fputs("{SMALLFONT}", f); break;
case 11: fputs("{OUTLINE}", f); break;
case 34: fputs("{ENDQUOTES}", f); break;
case 123: fputs("{COMMA32}", f); break;
case 125: fputs("{COMMA2DP32}", f); break;
case 126: fputs("{COMMA16}", f); break;
case 128: fputs("{CURRENCY2DP}", f); break;
case 129: fputs("{CURRENCY}", f); break;
case 130: fputs("{STRING}", f); break;
case 133: fputs("{MONTHYEAR}", f); break;
case 135: fputs("{VELOCITY}", f); break;
case 140: fputs("{LENGTH}", f); break;
case 141: fputs("{SPRITE}", f); break;
case 142: fputs("{BLACK}", f); break;
case 143: fputs("{GREY}", f); break;
case 144: fputs("{WHITE}", f); break;
case 145: fputs("{RED}", f); break;
case 146: fputs("{GREEN}", f); break;
case 147: fputs("{YELLOW}", f); break;
case 148: fputs("{TOPAZ}", f); break;
case 149: fputs("{CELADON}", f); break;
case 150: fputs("{BABYBLUE}", f); break;
case 151: fputs("{PALELAVENDER}", f); break;
case 152: fputs("{PALEGOLD}", f); break;
case 153: fputs("{LIGHTPINK}", f); break;
case 154: fputs("{PEARLAQUA}", f); break;
case 155: fputs("{PALESILVER}", f); break;
case 159: fputs("{AMINUSCULE}", f); break;
case 160: fputs("{UP}", f); break;
case 163: fputs("{POUND}", f); break;
case 165: fputs("{YEN}", f); break;
case 169: fputs("{COPYRIGHT}", f); break;
case 170: fputs("{DOWN}", f); break;
case 171: fputs("{LEFTGUILLEMET}", f); break;
case 172: fputs("{TICK}", f); break;
case 173: fputs("{CROSS}", f); break;
case 175: fputs("{RIGHT}", f); break;
case 176: fputs("{DEGREE}", f); break;
case 178: fputs("{SQUARED}", f); break;
case 180: fputs("{OPENQUOTES}", f); break;
case 181: fputs("{EURO}", f); break;
case 184: fputs("{APPROX}", f); break;
case 185: fputs("{POWERNEGATIVEONE}", f); break;
case 186: fputs("{BULLET}", f); break;
case 187: fputs("{RIGHTGUILLEMET}", f); break;
case 188: fputs("{SMALLUP}", f); break;
case 189: fputs("{SMALLDOWN}", f); break;
case 190: fputs("{LEFT}", f); break;
case 191: fputs("{INVERTEDQUESTION}", f); break;
default:
if (*c < 32 || *c > 127)
fprintf(f, "{%d}", *c);
else
fputc(*c, f);
break;
}
c++;
}
fputc('\n', f);
}
fclose(f);
}
/**
*
* rct2: 0x006C4209
*/
void reset_saved_strings() {
for (int i = 0; i < 1024; i++) {
RCT2_ADDRESS(0x135A8F4, uint8)[i * 32] = 0;
}
}
|
/*
* This file is part of Torus.
* Torus 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.
* Torus 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 Torus. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TORUS_GAME_ACCOUNT_H
#define __TORUS_GAME_ACCOUNT_H
#include <string>
#include <vector>
#include <library/system_headers.h>
#include <library/types.h>
class Char;
class Socket;
class Uid;
enum PRIVLVL
{
PRIV_GUEST,
PRIV_PLAYER,
PRIV_COUNSELOR,
PRIV_SEER,
PRIV_GM,
PRIV_DEV,
PRIV_ADMIN,
PRIV_QTY
};
// Expansion Flags
#define EXP_LBR 0x001 ///< Default game.
#define EXP_T2A 0x002 ///< The Second Age.
#define EXP_AOS 0x004 ///< Age Of Shadows.
#define EXP_SE 0x008 ///< Samurai Empire.
#define EXP_ML 0x010 ///< Mondain's Legacy.
#define EXP_SA 0x020 ///< Stygian Abyss.
#define EXP_HS 0x040 ///< High Seas.
class Client;
class Account {
private:
std::string _name; ///< Account name, used mostly for login.
std::string _password; ///< Account password.
std::vector<Uid> _charlist; ///< Character's list.
Char *_character;
udword_t _flags; ///< Account flags.
uword_t _expansion; ///< Expansion level this account has access.
std::string _lastip; ///< Last IP connected to this account.
Socket *_socket; ///< Pointer to the socket currently connected to this account.
PRIVLVL _privlevel;
Client *_client;
public:
Account();
~Account();
Account(std::string accname, std::string accpw, PRIVLVL accpriv);
/**
* @brief get the total count of characters this account has.
*
* @return the count of characters.
*/
t_byte get_char_count();
/**
* @brief get the max amount of characters this account can have.
*
* @return the max amount.
*/
t_byte get_max_chars();
/**
* @brief Checks if this account can have more characters.
*
* @return false if not.
*/
bool can_add_char();
/**
* @brief adds a character to this account.
*
* @param chr the character to add.
*/
bool add_char(Char *chr);
/**
* @brief Get the character at the given slot.
*
* @param slot The character slot.
* @return The Char, if exists.
*/
Char* get_char(const udword_t &slot);
/**
* @brief remove a character from this account.
*
* @param chr the character to remove.
*/
bool remove_char(Char *chr);
/**
* @brief Receiving a connection for this account.
*
* @param socket the socket connecting to the account.
*/
bool connect(Socket *socket);
/**
* @brief Gets the account's privilege level
*
* @return the PRIVLVL.
*/
PRIVLVL get_privlevel();
/**
* @brief Asign a PRIVLVL for this account.
*
* @param lvl the new PRIVLVL.
*/
void set_privlevel(PRIVLVL lvl);
/**
* @brief Remove this account.
*
* Remove this account and all the characters containing.
*/
void remove();
/**
* @brief Get the Client attached to this account, if any.
*
* @return the Client or nullptr.
*/
Client *get_client();
/**
* @brief Check if the account's password match the given one.
*
* @param pw The password to check.
* @return True if both passwords match, false otherwise.
*/
bool password_match(const std::string &pw);
};
#endif // __TORUS_GAME_ACCOUNT_H
|
#ifndef DISPLAY_H
# define DISPLAY_H
# include <iostream>
# include <GL/glew.h>
# include <GLFW/glfw3.h>
// # define NK_INCLUDE_FIXED_TYPES
// # define NK_INCLUDE_STANDARD_IO
// # define NK_INCLUDE_STANDARD_VARARGS
// # define NK_INCLUDE_DEFAULT_ALLOCATOR
// # define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
// # define NK_INCLUDE_FONT_BAKING
// # define NK_INCLUDE_DEFAULT_FONT
// # define NK_IMPLEMENTATION
// # define NK_GLFW_GL3_IMPLEMENTATION
// # include <NK/nuklear.h>
// # include <NK/nuklear_init.h>
namespace lz
{
class Display
{
private:
GLFWwindow *m_window;
// struct nk_context *m_nkCtx;
// struct nk_font_atlas *m_nkAtlas;
std::string m_title;
int m_width;
int m_height;
int m_last_width;
int m_last_height;
bool m_resized;
bool m_closed;
void create(const char *title, int width, int height);
public:
Display(const char *title, int width, int height);
~Display();
void update();
void setTitle(const char* title);
const char *getTitle();
inline GLFWwindow *getWindow() { return m_window; };
inline int getWidth() { return m_width; };
inline int getHeight() { return m_height; };
inline bool wasResized() { return m_resized; };
inline bool isClosed() { return m_closed; };
// inline struct nk_context *getNkContext() { return m_nkCtx; }
// inline struct nk_font_atlas *getNkAtlas() { return m_nkAtlas; }
};
}
#endif
|
#ifndef _COM_H_
#define _COM_H_
class Com
{
public:
virtual ~Com();
int openCom(char* port);
int setCom(int baud, int flow, int dataBit, int stopBit, int parity);
int writeCom(char* buf, int len);
int readCom(char* buf, int len);
void closeCom();
private:
int fd;
char* serialport;
int baud;
int flow;
int dataBit;
char parity;
int stopBit;
char* writeBuf;
char* readBuf;
};
#endif
|
/*
This file is part of GNUnet.
Copyright (C) 2011 - 2014 GNUnet e.V.
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.
*/
/**
* @file dht/gnunet-service-xdht_routing.h
* @brief GNUnet DHT tracking of requests for routing replies
* @author Christian Grothoff
*/
#ifndef GNUNET_SERVICE_XDHT_ROUTING_H
#define GNUNET_SERVICE_XDHT_ROUTING_H
#include "gnunet_util_lib.h"
#include "gnunet_block_lib.h"
#include "gnunet_dht_service.h"
/**
* To understand the direction in which trial should be read.
*/
enum GDS_ROUTING_trail_direction
{
GDS_ROUTING_SRC_TO_DEST,
GDS_ROUTING_DEST_TO_SRC
};
/**
* Update the prev. hop of the trail. Call made by trail teardown where
* if you are the first friend now in the trail then you need to update
* your prev. hop.
* @param trail_id
* @return #GNUNET_OK success
* #GNUNET_SYSERR in case no matching entry found in routing table.
*/
int
GDS_ROUTING_update_trail_prev_hop (struct GNUNET_HashCode trail_id,
struct GNUNET_PeerIdentity prev_hop);
/**
* Update the next hop of the trail. Call made by trail compression where
* if you are source of the trail and now you have a new first friend, then
* you should update the trail.
* @param trail_id
* @return #GNUNET_OK success
* #GNUNET_SYSERR in case no matching entry found in routing table.
*/
int
GDS_ROUTING_update_trail_next_hop (const struct GNUNET_HashCode trail_id,
struct GNUNET_PeerIdentity next_hop);
/**
* Get the next hop for trail corresponding to trail_id
* @param trail_id Trail id to be searched.
* @return Next_hop if found
* NULL If next hop not found.
*/
struct GNUNET_PeerIdentity *
GDS_ROUTING_get_next_hop (struct GNUNET_HashCode trail_id,
enum GDS_ROUTING_trail_direction trail_direction);
/**
* Remove every trail where peer is either next_hop or prev_hop
* @param peer Peer to be searched.
*/
int
GDS_ROUTING_remove_trail_by_peer (const struct GNUNET_PeerIdentity *peer);
/**
* Remove trail with trail_id
* @param trail_id Trail id to be removed
* @return #GNUNET_YES success
* #GNUNET_NO if entry not found.
*/
int
GDS_ROUTING_remove_trail (struct GNUNET_HashCode remove_trail_id);
/**
* Add a new entry in routing table
* @param new_trail_id
* @param prev_hop
* @param next_hop
* @return #GNUNET_OK success
* #GNUNET_SYSERR in case new_trail_id already exists in the network
* but with different prev_hop/next_hop
*/
int
GDS_ROUTING_add (struct GNUNET_HashCode new_trail_id,
struct GNUNET_PeerIdentity prev_hop,
struct GNUNET_PeerIdentity next_hop);
/**
* Check if the size of routing table has crossed threshold.
* @return #GNUNET_YES, if threshold crossed
* #GNUNET_NO, if size is within threshold
*/
int
GDS_ROUTING_threshold_reached (void);
#if 0
/**
* Test function. Remove afterwards.
*/
void
GDS_ROUTING_test_print (void);
#endif
/**
* Initialize routing subsystem.
*/
void
GDS_ROUTING_init (void);
/**
* Shutdown routing subsystem.
*/
void
GDS_ROUTING_done (void);
#endif
|
//
// ApplicationDelegate.h
// Copyright 2010 Mark Buer
//
// This file is part of RateThatSong.
//
// RateThatSong 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.
//
// RateThatSong 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 RateThatSong. If not, see <http://www.gnu.org/licenses/>.
//
#import <Cocoa/Cocoa.h>
#import <Growl/Growl.h>
#import "PollingSongChangeNotifier.h"
#import "SongChangedDelegate.h"
@interface ApplicationDelegate : NSObject <NSApplicationDelegate, SongChangedDelegate, NSTableViewDataSource, GrowlApplicationBridgeDelegate> {
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSTableView *tableView;
@end
|
#ifndef GNC_COMMON_H_
#define GNC_COMMON_H_ 1
#include <math.h>
#include <stdint.h>
/*
Conventions:
+x: Forward
+y: Right
+z: Down
Roll to the RIGHT, Pitch UP (Nose up) and Turning rightware induce a positive change in Roll, Pitch and Yaw respectively
*/
typedef struct {
float roll;
float pitch;
float yaw;
float roll_rate;
float pitch_rate;
float yaw_rate;
float x;
float y;
float z;
float v_x;
float v_y;
float v_z;
float a_x;
float a_y;
float a_z;
} state_estimate;
typedef struct {
double gps_lat;
double gps_long;
float gps_speed;
float gps_course;
float optical_flow_v_x;
float optical_flow_v_y;
float sonar_height;
float lidar_height;
float pressure_pa;
} observation;
#define degrees_to_radians(deg) (deg * M_PI / 180.0f)
#define radians_to_degrees(rad) (rad * 180.0 / M_PI)
#endif
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CSpatialDatabase.h
* PURPOSE:
*
*****************************************************************************/
class CElement;
#pragma once
// Bounding sphere z position for 2d objects
#define SPATIAL_2D_Z 0
// Result of a Query
class CElementResult : public std::vector<CElement*>
{
public:
};
//
// CSpatialDatabase
//
class CSpatialDatabase
{
public:
virtual ~CSpatialDatabase() {}
virtual void UpdateEntity(CElement* pEntity) = 0;
virtual void RemoveEntity(CElement* pEntity) = 0;
virtual bool IsEntityPresent(CElement* pEntity) = 0;
virtual void SphereQuery(CElementResult& outResult, const CSphere& sphere) = 0;
virtual void AllQuery(CElementResult& outResult) = 0;
};
CSpatialDatabase* GetSpatialDatabase();
|
/*
* DiscoCheck, an UCI chess engine. Copyright (C) 2010-2014 Lucas Braesch.
*
* DiscoCheck is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DiscoCheck is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zobrist.h"
static key_t Zobrist[NB_COLOR][NB_PIECE][NB_SQUARE];
static key_t ZobristCrights[NB_CRIGHTS];
static key_t ZobristEp[NB_SQUARE];
static key_t ZobristTurn;
struct PRNGState {
uint64_t a, b, c, d;
};
static uint64_t rotate(uint64_t x, uint64_t k);
static uint64_t prng_rand(struct PRNGState *ps);
static void prng_init(struct PRNGState *ps, uint64_t seed);
void init_zobrist()
{
struct PRNGState ps;
prng_init(&ps, 0);
for (int color = 0; color < NB_COLOR; color++)
for (int piece = 0; piece < NB_PIECE; piece++)
for (int sq = 0; sq < NB_SQUARE; sq++)
Zobrist[color][piece][sq] = prng_rand(&ps);
for (int crights = 0; crights < NB_CRIGHTS; crights++)
ZobristCrights[crights] = prng_rand(&ps);
for (int sq = 0; sq < NB_SQUARE; sq++)
ZobristEp[sq] = prng_rand(&ps);
ZobristTurn = prng_rand(&ps);
}
key_t zobrist(int color, int piece, int sq)
{
assert(color_ok(color) && piece_ok(piece) && square_ok(sq));
return Zobrist[color][piece][sq];
}
key_t zobrist_crights(int crights)
{
assert(crights_ok(crights));
return ZobristCrights[crights];
}
key_t zobrist_ep(int sq)
{
assert(square_ok(sq));
return ZobristEp[sq];
}
key_t zobrist_turn()
{
return ZobristTurn;
}
static uint64_t rotate(uint64_t x, uint64_t k)
{
return (x << k) | (x >> (64 - k));
}
static uint64_t prng_rand(struct PRNGState *ps)
{
const uint64_t e = ps->a - rotate(ps->b, 7);
ps->a = ps->b ^ rotate(ps->c, 13);
ps->b = ps->c + rotate(ps->d, 37);
ps->c = ps->d + e;
return ps->d = e + ps->a;
}
static void prng_init(struct PRNGState *ps, uint64_t seed)
{
ps->a = 0xf1ea5eed;
ps->b = ps->c = ps->d = seed;
for (int i = 0; i < 20; ++i)
prng_rand(ps);
}
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_0_r3_1;
atomic_int atom_0_r5_0;
atomic_int atom_1_r3_1;
atomic_int atom_1_r5_0;
atomic_int atom_2_r3_1;
atomic_int atom_2_r5_0;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v2_r3 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r4 = v2_r3 ^ v2_r3;
int v6_r5 = atomic_load_explicit(&vars[1+v3_r4], memory_order_seq_cst);
int v30 = (v2_r3 == 1);
atomic_store_explicit(&atom_0_r3_1, v30, memory_order_seq_cst);
int v31 = (v6_r5 == 0);
atomic_store_explicit(&atom_0_r5_0, v31, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
int v8_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v9_r4 = v8_r3 ^ v8_r3;
int v12_r5 = atomic_load_explicit(&vars[2+v9_r4], memory_order_seq_cst);
int v32 = (v8_r3 == 1);
atomic_store_explicit(&atom_1_r3_1, v32, memory_order_seq_cst);
int v33 = (v12_r5 == 0);
atomic_store_explicit(&atom_1_r5_0, v33, memory_order_seq_cst);
return NULL;
}
void *t2(void *arg){
label_3:;
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v14_r3 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v15_r4 = v14_r3 ^ v14_r3;
int v18_r5 = atomic_load_explicit(&vars[0+v15_r4], memory_order_seq_cst);
int v34 = (v14_r3 == 1);
atomic_store_explicit(&atom_2_r3_1, v34, memory_order_seq_cst);
int v35 = (v18_r5 == 0);
atomic_store_explicit(&atom_2_r5_0, v35, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
pthread_t thr2;
atomic_init(&vars[1], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[0], 0);
atomic_init(&atom_0_r3_1, 0);
atomic_init(&atom_0_r5_0, 0);
atomic_init(&atom_1_r3_1, 0);
atomic_init(&atom_1_r5_0, 0);
atomic_init(&atom_2_r3_1, 0);
atomic_init(&atom_2_r5_0, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_create(&thr2, NULL, t2, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
pthread_join(thr2, NULL);
int v19 = atomic_load_explicit(&atom_0_r3_1, memory_order_seq_cst);
int v20 = atomic_load_explicit(&atom_0_r5_0, memory_order_seq_cst);
int v21 = atomic_load_explicit(&atom_1_r3_1, memory_order_seq_cst);
int v22 = atomic_load_explicit(&atom_1_r5_0, memory_order_seq_cst);
int v23 = atomic_load_explicit(&atom_2_r3_1, memory_order_seq_cst);
int v24 = atomic_load_explicit(&atom_2_r5_0, memory_order_seq_cst);
int v25_conj = v23 & v24;
int v26_conj = v22 & v25_conj;
int v27_conj = v21 & v26_conj;
int v28_conj = v20 & v27_conj;
int v29_conj = v19 & v28_conj;
if (v29_conj == 1) assert(0);
return 0;
}
|
/*
* OpenSplice DDS
*
* This software and documentation are Copyright 2006 to 2013 PrismTech
* Limited and its licensees. All rights reserved. See file:
*
* $OSPL_HOME/LICENSE
*
* for full copyright notice and license terms.
*
*/
#ifndef IDL_GENSAJTYPE_H
#define IDL_GENSAJTYPE_H
#include "idl_program.h"
idl_program idl_genSajTypeProgram (void);
#endif /* IDL_GENSAJTYPE_H */
|
/****************************************************************************************
* 401
*
* RADDS
****************************************************************************************/
#define KNOWN_BOARD
#define BOARD_NAME "RADDS"
#ifndef ARDUINO_ARCH_SAM
#error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu.
#endif
#define RADDS
#define ORIG_X_STEP_PIN 24
#define ORIG_X_DIR_PIN 23
#define ORIG_X_ENABLE_PIN 26
#define ORIG_Y_STEP_PIN 17
#define ORIG_Y_DIR_PIN 16
#define ORIG_Y_ENABLE_PIN 22
#define ORIG_Z_STEP_PIN 2
#define ORIG_Z_DIR_PIN 3
#define ORIG_Z_ENABLE_PIN 15
// Note that on the Due pin A0 on the board is channel 2 on the ARM chip
#define ORIG_X_MIN_PIN 28
#define ORIG_X_MAX_PIN 34
#define ORIG_Y_MIN_PIN 30
#define ORIG_Y_MAX_PIN 36
#define ORIG_Z_MIN_PIN 32
#define ORIG_Z_MAX_PIN 38
#define ORIG_E0_STEP_PIN 61
#define ORIG_E0_DIR_PIN 60
#define ORIG_E0_ENABLE_PIN 62
#define ORIG_E1_STEP_PIN 64
#define ORIG_E1_DIR_PIN 63
#define ORIG_E1_ENABLE_PIN 65
#define ORIG_E2_STEP_PIN 51
#define ORIG_E2_DIR_PIN 53
#define ORIG_E2_ENABLE_PIN 49
#define ORIG_E3_STEP_PIN 35
#define ORIG_E3_DIR_PIN 33
#define ORIG_E3_ENABLE_PIN 37
#define ORIG_E4_STEP_PIN 29
#define ORIG_E4_DIR_PIN 27
#define ORIG_E4_ENABLE_PIN 31
#define SDPOWER -1
#define SDSS 4
#define LED_PIN -1
#define ORIG_BEEPER_PIN 41
#define ORIG_FAN_PIN 9
#define ORIG_FAN2_PIN 8
#define ORIG_PS_ON_PIN 40
#define KILL_PIN -1
#define ORIG_HEATER_BED_PIN 7 // BED
#define ORIG_HEATER_0_PIN 13
#define ORIG_HEATER_1_PIN 12
#define ORIG_HEATER_2_PIN 11
#define ORIG_TEMP_BED_PIN 4 // ANALOG NUMBERING #57
#define ORIG_TEMP_0_PIN 0 // ANALOG NUMBERING #54
#define ORIG_TEMP_1_PIN 1 // ANALOG NUMBERING #58
#define ORIG_TEMP_2_PIN 2 // ANALOG NUMBERING #55
#define ORIG_TEMP_3_PIN 3 // ANALOG NUMBERING #56
// #define THERMOCOUPLE_0_PIN 2 // Dua analog pin #59 = A5 -> AD 2
// http://doku.radds.org/wp-content/uploads/2015/02/RADDS_Wiring.png
#if NUM_SERVOS > 0
#define SERVO0_PIN 5
#if NUM_SERVOS > 1
#define SERVO1_PIN 6
#if NUM_SERVOS > 2
#define SERVO2_PIN 39
#if NUM_SERVOS > 3
#define SERVO3_PIN 40
#endif
#endif
#endif
#endif
#if ENABLED(ULTRA_LCD)
// RADDS LCD panel
#if ENABLED(RADDS_DISPLAY)
#define LCD_PINS_RS 42
#define LCD_PINS_ENABLE 43
#define LCD_PINS_D4 44
#define LCD_PINS_D5 45
#define LCD_PINS_D6 46
#define LCD_PINS_D7 47
#define BEEPER 41
#define BTN_EN1 50
#define BTN_EN2 52
#define BTN_ENC 48
#define BTN_BACK 71
#undef SDSS
#define SDSS 10 // 4,10,52 if using HW SPI.
#define SD_DETECT_PIN 14
#elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define LCD_PINS_RS 46
#define LCD_PINS_ENABLE 47
#define LCD_PINS_D4 44
#define ORIG_BEEPER_PIN 41
#define BTN_EN1 50
#define BTN_EN2 52
#define BTN_ENC 48
#elif ENABLED(SSD1306_OLED_I2C_CONTROLLER)
#define BTN_EN1 50
#define BTN_EN2 52
#define BTN_ENC 48
#define BEEPER 41
#define LCD_SDSS 10
#define SD_DETECT_PIN 14
#define KILL_PIN -1
#elif ENABLED(SPARK_FULL_GRAPHICS)
#define LCD_PINS_D4 29
#define LCD_PINS_ENABLE 27
#define LCD_PINS_RS 25
#define BTN_EN1 35
#define BTN_EN2 33
#define BTN_ENC 37
#define KILL_PIN -1
#undef BEEPER
#define BEEPER -1
#endif // SPARK_FULL_GRAPHICS
#endif // ULTRA_LCD
|
class Video : public Capture {
public:
Video(std::string filename, std::string api);
bool open(std::string filename, std::string api);
void readFrame(int frameId, Image& target);
int nframes(), frame();
double fps();
std::string codec();
private:
int _nf;
};
Video::Video(std::string filename, std::string api) : Capture() {
Rcpp::Environment base = Rcpp::Environment::base_env();
Rcpp::Function pathExpand = base["path.expand"];
if (!this->cap.open(Rcpp::as<std::string>(pathExpand(filename)), getAPIId(api))) {
Rcpp::stop("Could not open the video.");
} else {
this->_nf = -1;
}
}
bool Video::open(std::string filename, std::string api) {
Rcpp::Environment base = Rcpp::Environment::base_env();
Rcpp::Function pathExpand = base["path.expand"];
if (!this->cap.open(Rcpp::as<std::string>(pathExpand(filename)), getAPIId(api))) {
Rcpp::stop("Could not open the video."); }
else {
this->_nf = -1;
}
return true;
}
int Video::nframes() {
cv::Mat tmpFrame;
int tmp;
if (this->_nf == -1) {
tmp = this->cap.get(cv::CAP_PROP_FRAME_COUNT);
if (tmp > 0) {
this->_nf = tmp;
this->cap.set(cv::CAP_PROP_POS_FRAMES, this->_nf);
this->cap >> tmpFrame;
while(tmpFrame.empty()) {
this->_nf = this->_nf - 10;
this->cap.set(cv::CAP_PROP_POS_FRAMES, this->_nf);
this->cap >> tmpFrame;
}
while(!tmpFrame.empty()) {
this->_nf += 1;
this->cap >> tmpFrame;
}
} else {
this->_nf = 0;
this->cap.set(cv::CAP_PROP_POS_FRAMES, 0);
this->cap >> tmpFrame;
while(!tmpFrame.empty()) {
this->_nf += 1;
this->cap >> tmpFrame;
}
}
this->cap.set(cv::CAP_PROP_POS_FRAMES, 0);
}
return this->_nf;
}
int Video::frame() {
return this->cap.get(cv::CAP_PROP_POS_FRAMES);
}
double Video::fps() {
return this->cap.get(cv::CAP_PROP_FPS);
}
std::string Video::codec() {
union {
char c[5];
int i;
} fourcc;
fourcc.i = this->cap.get(cv::CAP_PROP_FOURCC);
fourcc.c[4] = '\0';
return fourcc.c;
}
void Video::readFrame(int frameId, Image& target) {
this->cap.set(cv::CAP_PROP_POS_FRAMES, frameId - 1);
if (target.GPU) {
if (!this->cap.read(target.uimage))
Rcpp::stop("No more frames available.");
return;
}
if (!this->cap.read(target.image))
Rcpp::stop("No more frames available.");
}
|
/*
* sysutils.h
*
* Created on: 2016-2-21
* Author: dan
*/
#ifndef SYSUTILS_H_
#define SYSUTILS_H_
#include "jansson.h"
#include <stdarg.h>
#include "debug.h"
typedef enum {
RPC_METHOD_INVALID = -1,
RPC_METHOD_ACK = 0,
RPC_METHOD_BOOT = 1,
RPC_METHOD_HEARTBEAT ,
RPC_METHOD_DISCONNECT ,
RPC_METHOD_POST ,
RPC_METHOD_INSTALL ,
RPC_METHOD_INSTALL_QUERY ,
RPC_METHOD_INSTALL_CANCEL ,
RPC_METHOD_UNINSTALL ,
RPC_METHOD_STOP ,
RPC_METHOD_RUN ,
RPC_METHOD_FACTORY_PLUGIN ,
RPC_METHOD_LIST_PLUGIN ,
RPC_METHOD_SET_PLUGIN_PARA ,
RPC_METHOD_MESSAGE_PUSH ,
RPC_METHOD_TOKEN_UPDATE ,
RPC_METHOD_BOOT_FIRST ,
RPC_METHOD_REGISTER_FIRST ,
}RPC_METHOD_ENUM;
//SUCCESS RET
#define RPC_RET_SUCCESS 0
#define RPC_RET_NEW_DEVRND 1
#define RPC_RET_IDENTIFY_OK 2
#define RPC_RET_GW_SET_DEFAULT 3
//FAILED RET
#define RPC_RET_NORNAL_FAILED -1
#define RPC_RET_INVALID_SSN_LOID -2
#define RPC_RET_DOWNLOAD_URL_INVALID -3
#define RPC_RET_SPACE_LACK -4
#define RPC_RET_BUSY -5
#define RPC_RET_VERSION_ERROR -6
#define RPC_RET_OS_NOT MATCH -7
#define RPC_RET_SIGN_ERROR -8
#define RPC_RET_DOWNLOAD_FAILED -9
#define RPC_RET_PLUGIN_BOOT_FAILED -10
#define RPC_RET_INSTALL_FINISHED -11
#define RPC_RET_PLUGIN_NOT_EXIST -12
#define RPC_RET_PLUGIN_RUNNING -13
#define RPC_RET_PLUGIN_CAN_NOT_DISABLED -14
#define RPC_RET_PLUGIN_CAN_NOT_UNINSTALL -15
#define RPC_RET_PLUGIN_NOT_RUNING -16
#define RPC_RET_PLUGIN_INSTALL_FAILED -17
#define RPC_RET_DEV_IDENTIFY_FAILED -18
#define RPC_RET_NEED_REGISTE -19
#define RPC_RET_PLUGIN_CONNECT_TIMEOUT -20
#define RPC_RET_RESERVED -100
#define RPC_RET_MAC_INVALID -1000
#define RPC_RET_DEV_NOT_IN_DATABASE -1002
#define RPC_RET_DEV_TOKEN_INVALID -1003
#define SOCKET_CMD_TYPE_ACK 0
#define SOCKET_CMD_TYPE_ACK 0
int sysutils_get_json_rpc_boot(char *buf);
int sysutils_get_json_rpc_heartbeat(char *buf);
int sysutils_get_json_rpc_token_update(char *buf);
int sysutils_get_json_rpc_register_first(char *buf);
int sysutils_parse_json_type(char *buf,int cmdType);
int sysutils_get_json_rpc_boot_first(char *buf );
int sysutils_parse_distri_server_ack_step_1(char *buf,int *result,char *challenge_code,int *interval,char * server_ip);
int sysutils_parse_distri_server_ack_step_2(char *buf,
int *result,
char *server_addr,
unsigned int *server_port,
int *interval,
char *server_ip,
char *token,
char *exp_date,
char *ca_download_url);
int sysutils_parse_distri_server_ack_step_2_old(char *buf,
int *result ,
int *interval
);
int sysutils_parse_operate_login_ack(char *buf,int *result);
int sysutils_parse_json_cmd_type(char *buf, RPC_METHOD_ENUM *type , int ID);
int sysutils_parse_json_is_result(char *buf,int *result ,int *id) ;
int sysutils_try_handler_ack_result_message(char *buf);
int sysutils_try_handler_server_push_message(char *buf);
RPC_METHOD_ENUM sysutils_get_rpc_type(char *buf) ;
int sysutils_get_json_plugin_ack_message(char *buf ,int key_num,... );
int sysutils_get_json_value_from(json_t *obj,char *key ,json_type type ,void *buf) ;
int sysutils_download_plugin_to_plugin_dir(char *buf,char *local_file);
int sysutils_encode_json_from_value(char *buf ,int key_num,... );
int sysutils_downlink_rpc_handler_disconnect(json_t *obj );
int sysutils_downlink_rpc_handler_install(json_t *obj );
int sysutils_downlink_rpc_handler_install_query(json_t *obj );
int sysutils_downlink_rpc_handler_install_cancel(json_t *obj );
int sysutils_downlink_rpc_handler_uninstall(json_t *obj );
int sysutils_downlink_rpc_handler_stop(json_t *obj );
int sysutils_downlink_rpc_handler_run(json_t *obj );
int sysutils_downlink_rpc_handler_list_plugin(json_t *obj );
int sysutils_downlink_rpc_handler_set_plugin_para(json_t *obj );
int sysutils_downlink_rpc_handler_factory_plugin(json_t *ojb);
#endif /* SYSUTILS_H_ */
|
/* Copyright 2012,2014,2018 IPB, Universite de Bordeaux, INRIA & CNRS
**
** This file is part of the Scotch software package for static mapping,
** graph partitioning and sparse matrix ordering.
**
** This software is governed by the CeCILL-C license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-C license and that you accept its terms.
*/
/************************************************************/
/** **/
/** NAME : kgraph_map_cp.c **/
/** **/
/** AUTHOR : Sebastien FOURESTIER (v6.0) **/
/** **/
/** FUNCTION : This method copies a given old mapping **/
/** as a mapping result. **/
/** **/
/** DATES : # Version 6.0 : from : 16 jan 2012 **/
/** to : 31 may 2018 **/
/** **/
/************************************************************/
/*
** The defines and includes.
*/
#define KGRAPH_MAP_CP
#include "module.h"
#include "common.h"
#include "graph.h"
#include "arch.h"
#include "mapping.h"
#include "parser.h"
#include "kgraph.h"
#include "kgraph_map_cp.h"
#include "kgraph_map_st.h"
/*****************************/
/* */
/* This is the main routine. */
/* */
/*****************************/
/* This routine performs the k-way partitioning.
** It returns:
** - 0 : if k-partition could be computed.
** - 1 : on error.
*/
/* TODO handle the case when the old and the new architectures are different. */
int
kgraphMapCp (
Kgraph * restrict const grafptr) /*+ Graph +*/
{
const Anum * restrict const pfixtax = grafptr->pfixtax;
if (grafptr->r.m.parttax == NULL) { /* If we do not have an old partition */
errorPrint ("kgraphMapCp: inconsistent old mapping data");
return (1);
}
if (mapCopy (&grafptr->m, &grafptr->r.m) != 0) {
errorPrint ("kgraphMapCp: cannot copy old mapping");
return (1);
}
if (pfixtax != NULL) { /* If we have fixed vertices */
if (mapMerge (&grafptr->m, pfixtax) != 0) {
errorPrint ("kgraphMapCp: cannot merge with fixed vertices");
return (1);
}
}
kgraphFron (grafptr);
kgraphCost (grafptr);
#ifdef SCOTCH_DEBUG_KGRAPH2
if (kgraphCheck (grafptr) != 0) {
errorPrint ("kgraphMapCp: inconsistent graph data");
return (1);
}
#endif /* SCOTCH_DEBUG_KGRAPH2 */
return (0);
}
|
/*
* OpenSplice DDS
*
* This software and documentation are Copyright 2006 to 2013 PrismTech
* Limited and its licensees. All rights reserved. See file:
*
* $OSPL_HOME/LICENSE
*
* for full copyright notice and license terms.
*
*/
#include "saj_WaitSet.h"
#include "saj_utilities.h"
#define SAJ_FUNCTION(name) Java_DDS_WaitSet_##name
/**
* Class: DDS_WaitSet
* Method: jniWaitSetAlloc
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL
SAJ_FUNCTION(jniWaitSetAlloc)(
JNIEnv *env,
jobject jwaitSet)
{
gapi_waitSet waitSet;
jboolean jresult;
jresult = JNI_FALSE;
waitSet = gapi_waitSet__alloc();
if(waitSet != NULL){
saj_register_weak_java_object(env, (PA_ADDRCAST)waitSet, jwaitSet);
jresult = JNI_TRUE;
}
return jresult;
}
/**
* Class: DDS_WaitSet
* Method: jniWaitSetFree
* Signature: ()V
*/
JNIEXPORT void JNICALL
SAJ_FUNCTION(jniWaitSetFree)(
JNIEnv *env,
jobject jwaitSet)
{
gapi_waitSet waitSet;
saj_userData ud;
waitSet = (gapi_waitSet) saj_read_gapi_address(env, jwaitSet);
ud = gapi_object_get_user_data(waitSet);
if(ud != NULL){
saj_destroy_weak_user_data(env, ud);
gapi_free(waitSet);
}
return;
}
/**
* Class: DDS_WaitSet
* Method: jniWait
* Signature: (LDDS/ConditionSeqHolder;LDDS/Duration_t;)I
*/
JNIEXPORT jint JNICALL
SAJ_FUNCTION(jniWait)(
JNIEnv *env,
jobject jwaitSet,
jobject jseqHolder,
jobject jduration)
{
gapi_waitSet waitSet;
gapi_conditionSeq *conditionSeq;
gapi_duration_t duration;
jobjectArray jConditionSeq;
saj_returnCode rc;
gapi_returnCode_t result;
if(jseqHolder != NULL){
jConditionSeq = NULL;
waitSet = (gapi_waitSet) saj_read_gapi_address(env, jwaitSet);
rc = saj_durationCopyIn(env, jduration, &duration);
if(rc == SAJ_RETCODE_OK){
conditionSeq = gapi_conditionSeq__alloc();
if(conditionSeq){
conditionSeq->_maximum = 0;
conditionSeq->_length = 0;
conditionSeq->_release = 0;
conditionSeq->_buffer = NULL;
result = gapi_waitSet_wait(waitSet, conditionSeq, &duration);
if((result == GAPI_RETCODE_OK) || (result == GAPI_RETCODE_TIMEOUT)){
rc = saj_LookupExistingConditionSeq(env, conditionSeq, &jConditionSeq);
if ( rc == SAJ_RETCODE_OK){
(*env)->SetObjectField(
env,
jseqHolder,
GET_CACHED(conditionSeqHolder_value_fid),
jConditionSeq);
} else {
result = GAPI_RETCODE_ERROR;
}
}
gapi_free(conditionSeq);
} else {
result = GAPI_RETCODE_OUT_OF_RESOURCES;
}
} else {
result = GAPI_RETCODE_ERROR;
}
} else {
result = GAPI_RETCODE_BAD_PARAMETER;
}
return (jint)result;
}
/**
* Class: DDS_WaitSet
* Method: jniAttachCondition
* Signature: (LDDS/Condition;)I
*/
JNIEXPORT jint JNICALL
SAJ_FUNCTION(jniAttachCondition)(
JNIEnv *env,
jobject jwaitSet,
jobject jcondition)
{
gapi_waitSet waitSet;
gapi_condition condition;
waitSet = (gapi_waitSet) saj_read_gapi_address(env, jwaitSet);
condition = (gapi_condition) saj_read_gapi_address(env, jcondition);
return (jint)gapi_waitSet_attach_condition(waitSet, condition);
}
/**
* Class: DDS_WaitSet
* Method: jniDetachCondition
* Signature: (LDDS/Condition;)I
*/
JNIEXPORT jint JNICALL
SAJ_FUNCTION(jniDetachCondition)(
JNIEnv *env,
jobject jwaitSet,
jobject jcondition)
{
gapi_waitSet waitSet;
gapi_condition condition;
waitSet = (gapi_waitSet) saj_read_gapi_address(env, jwaitSet);
condition = (gapi_condition) saj_read_gapi_address(env, jcondition);
return (jint)gapi_waitSet_detach_condition(waitSet, condition);
}
/**
* Class: DDS_WaitSet
* Method: jniGetConditions
* Signature: (LDDS/ConditionSeqHolder;)I
*/
JNIEXPORT jint JNICALL
SAJ_FUNCTION(jniGetConditions)(
JNIEnv *env,
jobject jwaitSet,
jobject jseqHolder)
{
gapi_waitSet waitSet;
gapi_conditionSeq *seq;
jobjectArray jSeq;
saj_returnCode rc;
gapi_returnCode_t result;
if(jseqHolder != NULL){
waitSet = (gapi_waitSet) saj_read_gapi_address(env, jwaitSet);
seq = gapi_conditionSeq__alloc();
if(seq){
seq->_maximum = 0;
seq->_length = 0;
seq->_release = 0;
seq->_buffer = NULL;
result = gapi_waitSet_get_conditions(waitSet, seq);
if (result == GAPI_RETCODE_OK){
rc = saj_LookupExistingConditionSeq(env, seq, &jSeq);
if (rc == SAJ_RETCODE_OK){
(*env)->SetObjectField(
env,
jseqHolder,
GET_CACHED(conditionSeqHolder_value_fid),
jSeq
);
} else {
result = GAPI_RETCODE_ERROR;
}
}
gapi_free(seq);
} else {
result = GAPI_RETCODE_OUT_OF_RESOURCES;
}
} else {
result = GAPI_RETCODE_BAD_PARAMETER;
}
return (jint)result;
}
#undef SAJ_FUNCTION
|
/* This file is part of the 'neper' program. */
/* Copyright (C) 2003-2012, Romain Quey. */
/* See the COPYING file in the top-level directory. */
#ifndef NEPER_MM
#define NEPER_MM
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"ut.h"
#include"neut.h"
#include"structIn_mm.h"
#include"InputData_mm/InputData_mm0.h"
#include"RMeshing/RMeshing0.h"
#include"../neper_fm/ReadMesh/ReadMesh0.h"
#include"../neper_fm/ReconMesh/ReconMesh0.h"
#include"Res_mm/Res_mm0.h"
#include"neper_mm0.h"
#endif /* NEPER_MM */
|
/*
* TCTools.h
*
* Copyright 2018 Avérous Julien-Pierre
*
* This file is part of TorChat.
*
* TorChat 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.
*
* TorChat 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 TorChat. If not, see <http://www.gnu.org/licenses/>.
*
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// == Network ==
BOOL doAsyncSocket(int sock);
// == Hash ==
NSString * hashMD5(NSData *data);
NS_ASSUME_NONNULL_END
|
/*
* Created on: Dec 2, 2013
* Author: Mirko Myllykoski (mirko.myllykoski@gmail.com)
*/
#ifndef PSCRCL_BOUNDARIES
#define PSCRCL_BOUNDARIES
#include "CArray.h"
namespace pscrCL {
// A class for storing information on how the system is divided into partial
// solution during each recursion step.
class Boundaries {
public:
explicit Boundaries(int n);
// Returns the system size
int getN() const;
int getK() const;
// Returns a array containing information on how the system is divided
// into partial solutions during i'th recursion step.
const int* getArrayForStep(int i) const;
int getArrayForStepSize(int i) const;
// Returns the whole array.
const int* getArray() const;
int getArraySize() const;
private:
int n;
CArray<int> bounds;
};
}
#endif
|
#ifndef TRACE_H
#define TRACE_H
#include "../../unp.h"
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#define IPV6
#define BUFSIZE 1500
char recvbuf[BUFSIZE];
char sendbuf[BUFSIZE];
struct rec { // format of outgoing UDP data.
u_short rec_seq; // sequence number.
u_short rec_ttl; // TTL packet left with.
struct timeval rec_tv; // time packet left.
};
int datalen = sizeof(struct rec); // # bytes of data following ICMP hearder.
char* host = NULL;
u_short sport, dport = 32768 + 666;
int nsent;
pid_t pid;
int probe, nprobes = 3;
int sendfd, recvfd; // send on UDP sock, read on raw ICMP sock.
int ttl, max_ttl = 30;
int verbose = 0;
const char* icmpcode_v4(int);
const char* icmpcode_v6(int);
int recv_v4(int, struct timeval *);
int recv_v6(int, struct timeval *);
void sig_alrm(int);
void traceloop(void);
void tv_sub(struct timeval *, struct timeval *);
struct proto {
const char* (*icmpcode)(int);
int (*recv)(int, struct timeval *);
struct sockaddr* sasend;
struct sockaddr* sarecv;
struct sockaddr* salast;
struct sockaddr* sabind;
socklen_t salen;
int icmpproto;
int ttllevel;
int ttloptname;
} *pr;
#endif
|
//////////////////////////////////////////////////////////////////
//
// EUSTAGGER LITE
//
// Copyright (C) 1996-2013 IXA Taldea
// EHU-UPV
//
// This file is part of EUSTAGGER LITE.
//
// EUSTAGGER LITE 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.
//
// EUSTAGGER LITE 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
//
// Contact: Ixa Taldea (ixa@ehu.es)
// 649 Posta kutxa
// 20080 Donostia (Basque Country)
//
//////////////////////////////////////////////////////////////////
#ifndef ALD_OROK_H
#define ALD_OROK_H
const char* SEG_FITX = "HAT_seguruak.dat";
const char* PHAT = ".morf";
#endif
|
/*
* Harry - A Tool for Measuring String Similarity
* Copyright (C) 2013-2015 Konrad Rieck (konrad@mlsec.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 without any
* warranty. See the GNU General Public License for more details.
*/
#include "config.h"
#include "common.h"
#include "harry.h"
#include "util.h"
#include "vcache.h"
#include "norm.h"
#include "kern_subsequence.h"
/**
* @addtogroup measures
* <hr>
* <em>kern_subsequence</em>: Subsequence kernel
*
* Lodhi, Saunders, Shawe-Taylor, Cristianini, and Watkins. Text
* classification using string kernels. Journal of Machine Learning
* Research, 2:419-444, 2002.
* @{
*/
/* External variables */
extern config_t cfg;
/* Normalizations */
static knorm_t n = KN_NONE;
/* Local variables */
static cfg_int length = 3; /**< Maximum length */
static double lambda = 0.1; /**< Weight for gaps */
/**
* Initializes the similarity measure
*/
void kern_subsequence_config()
{
const char *str;
config_lookup_int(&cfg, "measures.kern_subsequence.length", &length);
config_lookup_float(&cfg, "measures.kern_subsequence.lambda", &lambda);
/* Normalization */
config_lookup_string(&cfg, "measures.kern_subsequence.norm", &str);
n = knorm_get(str);
}
/* Ugly macros to access arrays */
#define DP(i,j) dp[(i) * (y.len + 1) + (j)]
#define DPS(i,j) dps[(i) * y.len + (j)]
/**
* Internal computation of subsequence kernel
* @param x first string
* @param y second string
* @return subsequence kernel
*/
static float kernel(hstring_t x, hstring_t y)
{
float *dps, *dp;
float kern[length];
int i, j, l;
/* Case a: both sequences empty */
if (x.len == 0 && y.len == 0)
return 1.0;
/* Case b: one sequence empty */
if (x.len == 0 || y.len == 0)
return 0.0;
/* Allocate temporary memory */
dp = malloc(sizeof(float) * (x.len + 1) * (y.len + 1));
dps = malloc(sizeof(float) * x.len * y.len);
if (!dp || !dps) {
error("Could not allocate memory for subsequence kernel");
return 0;
}
/* Initalize dps */
for (i = 0; i < x.len; i++)
for (j = 0; j < y.len; j++) {
if (!hstring_compare(x, i, y, j))
DPS(i,j) = lambda * lambda;
else
DPS(i,j) = 0;
}
/* Initialize dp */
for (i = 0; i < x.len + 1; i++)
DP(i, 0) = 0;
for (j = 0; j < y.len + 1; j++)
DP(0, j) = 0;
for (l = 0; l < length; l++) {
kern[l] = 0;
for (i = 0; i < x.len; i++) {
for (j = 0; j < y.len; j++) {
DP(i + 1, j + 1) = DPS(i,j) + lambda * DP(i, j + 1) +
lambda * DP(i + 1, j) - lambda * lambda * DP(i, j);
if (!hstring_compare(x, i, y, j)) {
kern[l] = kern[l] + DPS(i,j);
DPS(i,j) = lambda * lambda * DP(i, j);
}
}
}
}
free(dps);
free(dp);
return kern[length - 1];
}
/**
* Compute the subsequence kernel by Lodhi et al. (2002). The implementation
* has been taken from the book by Cristianini & Shawe-Taylor.
* @param x first string
* @param y second string
* @return subsequence kernel
*/
float kern_subsequence_compare(hstring_t x, hstring_t y)
{
float k = kernel(x, y);
return knorm(n, k, x, y, kernel);
}
/** @} */
|
#ifndef GRAPHS_GRAPHSDATATYPES_H
#define GRAPHS_GRAPHSDATATYPES_H
#include<utilities/Debug.h>
#include<utilities/Printer.h>
#include<vector>
#include<iostream>
#include<iterator>
#include<algorithm>
#include<cassert>
namespace graphs {
typedef int IDType;
static IDType Counter = 0;
/**
* @class Vertex
* The Vertex data structure keeps track of edges only by
* their IDs. There should be a mechanism to retrieve the
* Edges from their respective IDs. It also means that IDs
* for each edge should be unique.
* @todo: Include a mechanism to annotate edges
* w.r.t. direction i.e., incomong/outgoing.
*/
template<typename EdgeType, typename WeightType>
class Vertex {
public:
typedef typename std::vector<IDType> EdgesType;
// Construct a single node.
Vertex(WeightType w)
: Weight(w), Id(Counter++)
{
DEBUG3(dbgs() << "\nConstructing Vertex:" << GetId());
}
/*~Vertex()
{
DEBUG(dbgs() << "\nDeleting Vertex:" << GetId());
}*/
// Construct a vertex when it has edges.
//Vertex(EdgesType e, WeightType w)
// : Edges(e), Weight(w), Id(Counter++)
//{ }
void AddEdge(EdgeType* e)
{
DEBUG3(dbgs() << "\nAdding edge: " << e->GetId()
<< "to neuron: " << GetId());
auto it = std::find(Edges.begin(), Edges.end(), e->GetId());
if(it == Edges.end())
Edges.push_back(e->GetId());
else
DEBUG3(dbgs() << "\nEdge: " << *it
<< "already in Neuron:" << GetId());
}
void RemoveEdge(EdgeType* e)
{
DEBUG3(dbgs() << "Removing Edge: " << e->GetId()
<< "From Vertex: " << GetId());
auto it = std::find(Edges.begin(), Edges.end(), e->GetId());
assert(it != Edges.end() &&
"No Such Edge connected to this vertex");
Edges.erase(it);
}
bool HasEdge(EdgeType* e)
{
return std::find(Edges.begin(), Edges.end(), e->GetId())
!= Edges.end();
}
void SetWeight(const WeightType& w)
{
Weight = w;
}
const EdgesType& GetEdges() const
{
return Edges;
}
const WeightType& GetWeight() const
{
return Weight;
}
IDType GetId() const
{
return Id;
}
void print(std::ostream& os,
const Vertex<EdgeType, WeightType>& v)
{
os << v;
}
void dump() const
{
print(dbgs(), *this);
}
friend
std::ostream& operator<<(std::ostream& os, const EdgesType& e)
{
os << "(";
for (auto i = e.begin(); i != e.end(); ++i)
os << *i << ", ";
os << ")";
return os;
}
friend
std::ostream& operator<<(std::ostream& os,
const Vertex<EdgeType, WeightType>& t)
{
if (printer::YAML) {
os << "\n- ID: " << t.Id
<< "\n\t- Weight: " << t.Weight
<< "\n\t- Edges: ";
for (auto it = t.Edges.begin(); it != t.Edges.end(); ++it) {
os << " " << *it;
}
} else {
os << "(W:" << t.Weight << ", E:" << t.Edges() << ")";
}
return os;
}
private:
EdgesType Edges;
WeightType Weight;
IDType Id;
};
/**
* @class Edge
* Each edge has a unique ID in the graph.
* The nodes attached to an edge are denoted by
* InNode and OutNode. In case of directed graph, this
* might not make much sense though.
*/
template<typename NodeType, typename WeightType>
class Edge {
public:
Edge(NodeType& In, NodeType& Out, WeightType w)
: InNode(&In), OutNode(&Out), Weight(w), Id(Counter++)
{
DEBUG3(dbgs() << "\nConstructing Edge:" << GetId());
}
/*~Edge()
{
DEBUG(dbgs() << "\nDeleting Edge:" << GetId());
}*/
void SetWeight(const WeightType& w)
{
Weight = w;
}
const WeightType& GetWeight() const
{
return Weight;
}
IDType GetId() const
{
return Id;
}
NodeType* GetInNode()
{
return InNode;
}
NodeType* GetOutNode()
{
return OutNode;
}
void print(std::ostream& os,
const Edge<NodeType, WeightType>& e)
{
os << e;
}
void dump() const
{
print(dbgs(), *this);
}
friend std::ostream& operator<<(std::ostream& os,
const Edge<NodeType, WeightType>& e)
{
if (printer::YAML) {
os << "- ID: " << e.GetId()
<< "\n\t- In: " << e.InNode->GetId()
<< "\n\t- Out: " << e.OutNode->GetId()
<< "\n\t- Weight: " << e.Weight;
} else {
os << "(W:" << e.Weight << ", E:" << e.GetId() << ")";
}
return os;
}
protected:
NodeType* InNode;
NodeType* OutNode;
private:
WeightType Weight;
IDType Id;
};
} // namespace graphs
#endif // GRAPHS_GRAPHSDATATYPES_H
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 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.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#ifndef _CHAT_H_
#define _CHAT_H_
#include "../common.h"
#include "../drawing/Drawing.h"
#define CHAT_HISTORY_SIZE 10
#define CHAT_INPUT_SIZE 1024
#define CHAT_MAX_MESSAGE_LENGTH 200
#define CHAT_MAX_WINDOW_WIDTH 600
enum CHAT_INPUT
{
CHAT_INPUT_NONE,
CHAT_INPUT_SEND,
CHAT_INPUT_CLOSE,
};
extern bool gChatOpen;
void chat_open();
void chat_close();
void chat_toggle();
void chat_init();
void chat_update();
void chat_draw(rct_drawpixelinfo * dpi);
void chat_history_add(const char *src);
void chat_input(CHAT_INPUT input);
sint32 chat_string_wrapped_get_height(void *args, sint32 width);
sint32 chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width);
#endif
|
/*
* Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <deque>
#include "forward.h"
#include "MerkleTree.h"
#include "CriticalSection.h"
#include "NonCopyable.h"
#include "Segment.h"
#include "GetSet.h"
namespace dcpp {
using std::deque;
class Transfer : private NonCopyable {
public:
enum Type {
TYPE_FILE,
TYPE_FULL_LIST,
TYPE_PARTIAL_LIST,
TYPE_TREE,
TYPE_LAST
};
static const string names[TYPE_LAST];
static const string USER_LIST_NAME;
static const string USER_LIST_NAME_BZ;
Transfer(UserConnection& conn, const string& path, const TTHValue& tth);
virtual ~Transfer() { };
int64_t getPos() const { return pos; }
int64_t getStartPos() const { return getSegment().getStart(); }
void resetPos() { pos = 0; }
void addPos(int64_t aBytes, int64_t aActual) { pos += aBytes; actual+= aActual; }
enum { MIN_SAMPLES = 15, MIN_SECS = 15 };
/** Record a sample for average calculation */
void tick();
int64_t getActual() const { return actual; }
int64_t getSize() const { return getSegment().getSize(); }
void setSize(int64_t size) { segment.setSize(size); }
double getAverageSpeed() const;
int64_t getSecondsLeft() const {
double avg = getAverageSpeed();
return (avg > 0) ? (getBytesLeft() / avg) : 0;
}
int64_t getBytesLeft() const {
return getSize() - getPos();
}
virtual void getParams(const UserConnection& aSource, StringMap& params);
UserPtr getUser();
const UserPtr getUser() const;
HintedUser getHintedUser() const;
const string& getPath() const { return path; }
const TTHValue& getTTH() const { return tth; }
UserConnection& getUserConnection() { return userConnection; }
const UserConnection& getUserConnection() const { return userConnection; }
bool getOverlapped() const { return getSegment().getOverlapped(); }
void setOverlapped(bool overlap) { segment.setOverlapped(overlap); }
GETSET(Segment, segment, Segment);
GETSET(Type, type, Type);
GETSET(uint64_t, start, Start);
private:
typedef std::pair<uint64_t, int64_t> Sample;
typedef deque<Sample> SampleList;
SampleList samples;
mutable CriticalSection cs;
/** The file being transferred */
string path;
/** TTH of the file being transferred */
TTHValue tth;
/** Bytes transferred over socket */
int64_t actual;
/** Bytes transferred to/from file */
int64_t pos;
UserConnection& userConnection;
};
} // namespace dcpp
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "select.h"
#define ALGORITHM_SELECT_RP 0
#define ALGORITHM_SELECT_DP_MMS 1
// memory limits
#define DATA_BUF_LIMIT_BYTES (100 * 1024 * 1024) // 100MiB
#define MAX_LOAD_LINES (DATA_BUF_LIMIT_BYTES / sizeof(int))
#define REALLOCATE_UNIT (MAX_LOAD_LINES / 100)
static inline STATUS loadLineTextAsInt(FILE *stream, int *buffer)
{
// check params
if (stream == NULL || buffer == NULL)
{
return S_NULL;
}
// read the first line
STATUS ret = S_OK;
char *line = NULL;
size_t length = 0;
if (getline(&line, &length, stream) == -1)
{
// failed or EOF
ret = feof(stream) == 0 ? S_FAILED : S_EOF;
}
else if (line[0] == '\n' || line[0] == '\0')
{
// empty line
ret = S_EOF;
}
// parse as int
if (ret == S_OK)
{
if (sscanf(line, "%d", buffer) != 1)
{
ret = S_FAILED;
}
}
// release buffer
if (line != NULL)
{
free(line);
}
return ret;
}
// read from stream, convert txt to integer value for each line
static inline STATUS stream2IntArray(FILE *stream, int **data, size_t *loadedCount, size_t maxReadLines)
{
// check params
if (stream == NULL || data == NULL || loadedCount == NULL)
{
return S_NULL;
}
// initialize buffer status
size_t allocatedLength = 0;
if (maxReadLines == 0)
{
// read all, up to MAX_LOAD_LINES
maxReadLines = MAX_LOAD_LINES;
*data = NULL;
}
else
{
// read up to maxLines
*data = malloc(sizeof(int) * maxReadLines);
if (*data == NULL)
{
return S_FAILED;
}
allocatedLength = maxReadLines;
}
// read for each line
STATUS ret = S_OK;
while (*loadedCount < maxReadLines)
{
// buffer is full
if (allocatedLength <= *loadedCount)
{
// reallocate buffer
void *buf = realloc(*data, allocatedLength + REALLOCATE_UNIT * sizeof(int));
if (buf == NULL)
{
// when failed, release previous allocated buffer
if (*data != NULL)
{
free(*data);
}
return S_FAILED;
}
*data = buf;
allocatedLength += REALLOCATE_UNIT;
}
// load
ret = loadLineTextAsInt(stream, &(*data)[*loadedCount]);
if (ret == S_EOF)
{
break;
}
if (ret != S_OK)
{
return ret;
}
(*loadedCount)++;
}
// empty
if (*loadedCount == 0)
{
if (*data != NULL)
{
free(*data);
*data = NULL;
}
return S_EMPTY;
}
// reached to EOF
if (*loadedCount > 0 && ret == S_EOF)
{
ret = S_OK;
}
return ret;
}
#define __ERROR(...) fprintf(stderr, __VA_ARGS__);
int main(int argc, char **argv)
{
// parse args
// ./a <file.input> <length.maxLines> <index.target>
if (argc != 4)
{
__ERROR("too many or few arguments\n");
return S_INVALID;
}
size_t maxLines = 0;
if (sscanf(argv[2], "%zu", &maxLines) != 1)
{
__ERROR("failed to parse value of <length.maxLines>: '%s'\n", argv[2]);
return S_FAILED;
}
size_t target = 0;
if (sscanf(argv[3], "%zu", &target) != 1)
{
__ERROR("failed to parse value of <index.target>: '%s'\n", argv[3]);
return S_FAILED;
}
// check params
if (maxLines == 0 || target > maxLines)
{
__ERROR("Invalid parameters\n");
return S_INVALID;
}
// open file
FILE *inputStream = stdin;
if (strcmp(argv[1], "-") != 0)
{
inputStream = fopen(argv[1], "r");
if (inputStream == NULL)
{
__ERROR("Failed to open <file.input>: '%s'\n", argv[1]);
return S_FAILED;
}
}
// read data from stream
int *data = NULL;
size_t loaded = 0;
STATUS ret = stream2IntArray(inputStream, &data, &loaded, maxLines);
if (ret != S_OK)
{
__ERROR("failed to read data from stream\n");
fclose(inputStream);
return ret;
}
// invoke task
#if CLI_WRAPPER_ALGORITHM == ALGORITHM_SELECT_RP
int result;
select_rc(data, loaded, target, &result);
printf("%d\n", result);
#elif CLI_WRAPPER_ALGORITHM == ALGORITHM_SELECT_DP_MMS
size_t resultIndex;
ret = select_dp_mms(data, loaded, target, &resultIndex);
if (ret != S_OK)
{
printf("error: ret = %d\n", ret);
}
else
{
printf("%d\n", data[resultIndex]);
}
#else
#error Unkown alogrithm identifier specified
#endif
// clean-up
free(data);
fclose(inputStream);
return ret;
}
|
/*
* This software is developed for study and improve coding skill ...
*
* Project: Enjoyable Coding< EC >
* Copyright (C) 2014-2016 Gao Peng
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* ---------------------------------------------------------------------
* ECPrefDef.h
* This file for Whole Software pre compilng define.
*
* Eamil: epengao@126.com
* Author: Peter Gao
* Version: Intial first version.
* --------------------------------------------------------------------
*/
#define EC_OS_Win32 1
|
/**********************************************************
* Version $Id$
*********************************************************/
///////////////////////////////////////////////////////////
// //
// SAGA //
// //
// System for Automated Geoscientific Analyses //
// //
// Module Library: //
// Grid_Gridding //
// //
//-------------------------------------------------------//
// //
// Interpolation_Shepard.h //
// //
// Copyright (C) 2003 by //
// Andre Ringeler //
// //
//-------------------------------------------------------//
// //
// This file is part of 'SAGA - System for Automated //
// Geoscientific Analyses'. SAGA is free software; you //
// can redistribute it and/or modify it under the terms //
// of the GNU General Public License as published by the //
// Free Software Foundation; version 2 of the License. //
// //
// SAGA is distributed in the hope that it will be //
// useful, but WITHOUT ANY WARRANTY; without even the //
// implied warranty of MERCHANTABILITY or FITNESS FOR A //
// PARTICULAR PURPOSE. See the GNU General Public //
// License for more details. //
// //
// You should have received a copy of the GNU General //
// Public License along with this program; if not, //
// write to the Free Software Foundation, Inc., //
// 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, //
// USA. //
// //
//-------------------------------------------------------//
// //
// e-mail: aringel@gwdg.de //
// //
// contact: Andre Ringeler //
// Institute of Geography //
// University of Goettingen //
// Goldschmidtstr. 5 //
// 37077 Goettingen //
// Germany //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
// Interpolation_Shepard.h //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#ifndef HEADER_INCLUDED__Interpolation_Shepard_H
#define HEADER_INCLUDED__Interpolation_Shepard_H
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#include "Interpolation.h"
#include "Shepard.h"
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
typedef struct
{
double x ;
double y ;
double val;
}
Data_Point;
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
class grid_gridding_EXPORT CInterpolation_Shepard : public CInterpolation
{
public:
CInterpolation_Shepard(void);
virtual ~CInterpolation_Shepard(void);
protected:
virtual bool On_Initialize (void);
virtual bool On_Finalize (void);
virtual bool Get_Value (double x, double y, double &z);
private:
int m_MaxPoints, m_Quadratic_Neighbors, m_Weighting_Neighbors;
double *x_vals, *y_vals, *f_vals;
CShepard2d Interpolator;
void Remove_Duplicate (void);
};
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#endif // #ifndef HEADER_INCLUDED__Interpolation_Shepard_H
|
/*
Copyright 2008 Brain Research Institute, Melbourne, Australia
Written by J-Donald Tournier, 27/06/08.
This file is part of MRtrix.
MRtrix 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.
MRtrix 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 MRtrix. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __gui_dialog_file_h__
#define __gui_dialog_file_h__
#include "file/path.h"
#include "gui/opengl/gl.h"
namespace MR
{
namespace GUI
{
namespace Dialog
{
namespace File
{
extern const std::string image_filter_string;
void check_overwrite_files_func (const std::string& name);
std::string get_folder (QWidget* parent, const std::string& caption, const std::string& folder = std::string());
std::string get_file (QWidget* parent, const std::string& caption, const std::string& filter = std::string(), const std::string& folder = std::string());
std::vector<std::string> get_files (QWidget* parent, const std::string& caption, const std::string& filter = std::string(), const std::string& folder = std::string());
std::string get_save_name (QWidget* parent, const std::string& caption, const std::string& suggested_name = std::string(), const std::string& filter = std::string(), const std::string& folder = std::string());
inline std::string get_image (QWidget* parent, const std::string& caption, const std::string& folder = std::string()) {
return get_file (parent, caption, image_filter_string, folder);
}
inline std::vector<std::string> get_images (QWidget* parent, const std::string& caption, const std::string& folder = std::string()) {
return get_files (parent, caption, image_filter_string, folder);
}
inline std::string get_save_image_name (QWidget* parent, const std::string& caption, const std::string& suggested_name = std::string(), const std::string& folder = std::string()) {
return get_save_name (parent, caption, suggested_name, image_filter_string, folder);
}
}
}
}
}
#endif
|
#ifndef VVPANELSMANAGER_H
#define VVPANELSMANAGER_H
/**************************************************************
Copyright(c) 2015 Angelo Coppi
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.
********************************************************************/
#include "vviface.h"
namespace vkey {
class vvPanelsManager: public IPanelsManager {
listPanels panels;
public:
vvPanelsManager();
virtual ~vvPanelsManager();
bool readConfiguration(IXmlNode * node);
keyboard & getKeyboard(int offset);
inline listPanels & getPanels(void) {
return panels;
}
private:
bool readConfMatrix(keyboard & keybd, IXmlNode * node);
bool readConfBackground(keyboard & keybd, IXmlNode * node);
bool readConfButton(commandItem & btn, IXmlNode * node);
};
}
#endif /* VVPANELSMANAGER_H */
|
#include <verifier-builtins.h>
#include <stdlib.h>
struct hlist_head {
struct hlist_node *first;
};
struct hlist_node {
struct hlist_node *next, **pprev;
};
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
static inline void INIT_HLIST_NODE(struct hlist_node *h)
{
h->next = NULL;
h->pprev = NULL;
}
static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
{
struct hlist_node *first = h->first;
n->next = first;
if (first)
first->pprev = &n->next;
h->first = n;
n->pprev = &h->first;
}
struct my_node {
void (*data)(void);
struct hlist_node head;
};
static void append(struct hlist_head *list)
{
struct my_node *node = malloc(sizeof *node);
if (!node)
abort();
hlist_add_head(&node->head, list);
}
int main()
{
HLIST_HEAD(head);
append(&head);
append(&head);
___sl_plot(NULL, &head);
return 0;
}
|
/* PSPPIRE - a graphical user interface for PSPP.
Copyright (C) 2015 Free Software Foundation
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 <glib-object.h>
#include <glib.h>
#include "psppire-dialog-action.h"
#ifndef __PSPPIRE_DIALOG_ACTION_WEIGHT_H__
#define __PSPPIRE_DIALOG_ACTION_WEIGHT_H__
G_BEGIN_DECLS
#define PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT (psppire_dialog_action_weight_get_type ())
#define PSPPIRE_DIALOG_ACTION_WEIGHT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT, PsppireDialogActionWeight))
#define PSPPIRE_DIALOG_ACTION_WEIGHT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT, \
PsppireDialogActionWeightClass))
#define PSPPIRE_IS_DIALOG_ACTION_WEIGHT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT))
#define PSPPIRE_IS_DIALOG_ACTION_WEIGHT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT))
#define PSPPIRE_DIALOG_ACTION_WEIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT, \
PsppireDialogActionWeightClass))
typedef struct _PsppireDialogActionWeight PsppireDialogActionWeight;
typedef struct _PsppireDialogActionWeightClass PsppireDialogActionWeightClass;
struct _PsppireDialogActionWeight
{
PsppireDialogAction parent;
/*< private >*/
GtkWidget *entry;
GtkWidget *variables;
GtkWidget *status;
GtkWidget *off;
GtkWidget *on;
};
struct _PsppireDialogActionWeightClass
{
PsppireDialogActionClass parent_class;
};
GType psppire_dialog_action_weight_get_type (void) ;
G_END_DECLS
#endif /* __PSPPIRE_DIALOG_ACTION_WEIGHT_H__ */
|
/*
* Copyright (C) 2009 Niek Linnenbank
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LIBPOSIX_RUNTIME_H
#define __LIBPOSIX_RUNTIME_H
#include <Macros.h>
#include <Types.h>
#include <Vector.h>
#include <String.h>
#include <ChannelClient.h>
#include "FileSystemMount.h"
#include "FileDescriptor.h"
/**
* @defgroup libposix libposix (POSIX.1-2008)
* @{
*/
/**
* C(++) program entry point.
* @param argc Argument count.
* @param argv Argument values.
* @return Exit status.
*/
int main(int argc, char **argv);
/**
* Retrieve the ProcessID of the FileSystemMount for the given path.
* @param path Path to lookup.
* @return ProcessID of the FileSystemMount on success and ZERO otherwise.
*/
ProcessID findMount(const char *path);
/**
* Lookup the ProcessID of a FileSystemMount by a filedescriptor number.
* @param fildes FileDescriptor number.
* @return ProcessID of the FileSystemMount on success and ZERO otherwise.
*/
ProcessID findMount(int fildes);
void refreshMounts(const char *path);
/**
* Get FileDescriptors table.
*/
Vector<FileDescriptor> * getFiles();
/**
* Get mounts table.
*/
FileSystemMount * getMounts();
/**
* Get current directory String.
*/
String * getCurrentDirectory();
/**
* @}
*/
#endif /* __LIBPOSIX_RUNTIME_H */
|
/******************************************************************************
*
* $Id: message.h,v 1.8 2001/03/19 19:27:41 root Exp $
*
* Copyright (C) 1997-2011 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef MESSAGE_H
#define MESSAGE_H
#include <stdio.h>
extern void msg(const char *fmt, ...);
extern void warn(const char *file,int line,const char *fmt, ...);
extern void warn_simple(const char *file,int line,const char *text);
extern void warn_undoc(const char *file,int line,const char *fmt, ...);
extern void warn_doc_error(const char *file,int line,const char *fmt, ...);
extern void err(const char *fmt, ...);
void initWarningFormat();
#endif
|
#ifndef SAG_EVENT_MANAGER_H
#define SAG_EVENT_MANAGER_H
#include <string>
#include <memory>
#include <cassert>
#include <functional>
#include <iostream>
namespace sag
{
class Event;
template <typename EventType, typename ListenerStrategy, typename DispatchStrategy>
class EventManager
{
public:
EventManager()
{
static_assert(std::is_base_of<Event, EventType>::value, "EventManager template typename must be of type Event!");
}
void update()
{
dispatchStrategy.update(listenerStrategy);
}
void dispatchEvent(std::unique_ptr<EventType>&& event)
{
dispatchStrategy.dispatchEvent(std::move(event));
}
void addEventCallback(std::function<void(EventType&)> callback)
{
listenerStrategy.addCallback(std::move(callback));
}
private:
DispatchStrategy dispatchStrategy;
ListenerStrategy listenerStrategy;
};
} // namespace sag
#endif // SAG_EVENT_MANAGER_H
|
#pragma once
#include "Buddy.h"
class Player : public Buddy
{
public:
Player(Stock& st) : Buddy(st) {};
virtual void Act();
};
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Code/Dev/appNativa/source/rareobjc/../rare/apple/com/appnativa/rare/ui/UIClipboard.java
//
// Created by decoteaud on 3/11/16.
//
#ifndef _RAREUIClipboard_H_
#define _RAREUIClipboard_H_
@class RAREUIImage;
@protocol JavaUtilList;
@protocol JavaUtilMap;
#import "JreEmulation.h"
@interface RAREUIClipboard : NSObject {
}
- (id)init;
+ (void)clear;
+ (BOOL)setContentWithJavaUtilMap:(id<JavaUtilMap>)map;
+ (BOOL)hasUrl;
+ (BOOL)hasString;
+ (BOOL)hasRtf;
+ (BOOL)hasImage;
+ (BOOL)hasHtml;
+ (BOOL)hasFiles;
+ (NSString *)getUrl;
+ (NSString *)getString;
+ (NSString *)getRtf;
+ (RAREUIImage *)getImage;
+ (NSString *)getHtml;
+ (id<JavaUtilList>)getFiles;
+ (id<JavaUtilList>)getAvailableFlavors;
@end
typedef RAREUIClipboard ComAppnativaRareUiUIClipboard;
#endif // _RAREUIClipboard_H_
|
#include "resource.h"
#define UWM_PIPEBROKEN (WM_APP+1) /* this could have been registered */
typedef void (CWnd::*WND_RECV_PMSG)(LPCTSTR pszText);
//#include "consolePipe.h"
class CMyConsolePipe : public CConsolePipe
{
public:
CMyConsolePipe(BOOL bWinNT, CEdit* wOutput, CWnd* pParent, WND_RECV_PMSG wOnRecvMsg, DWORD flags) :
CConsolePipe(bWinNT, wOutput, flags)
{
WndOnReceivedOutput = wOnRecvMsg;
m_pParent = pParent;
}
virtual void OnReceivedOutput(LPCTSTR pszText)
{
if(!pszText) { // child has terminated
//CWindow dlg(m_wndOutput->GetParent());
//CWnd* pParent = m_wndOutput->GetParent();
//ATLASSERT(dlg.IsWindow());
// notify the main dialog that the process has ended
m_pParent->SendMessage(UWM_PIPEBROKEN, (WPARAM)this);
// note that this is called from the background thread context
// soon this class will self-destruct
}
CConsolePipe::OnReceivedOutput(pszText); // normal screen echo
(*m_pParent.*WndOnReceivedOutput)(pszText);
}
private:
WND_RECV_PMSG WndOnReceivedOutput = NULL;
CWnd* m_pParent = NULL;
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.