text stringlengths 4 6.14k |
|---|
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FULLSCREENWINDOW_H
#define FULLSCREENWINDOW_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QWebEngineView;
QT_END_NAMESPACE
class FullScreenNotification;
class FullScreenWindow : public QWidget
{
Q_OBJECT
public:
explicit FullScreenWindow(QWebEngineView *oldView, QWidget *parent = nullptr);
~FullScreenWindow();
protected:
void resizeEvent(QResizeEvent *event) override;
private:
QWebEngineView *m_view;
FullScreenNotification *m_notification;
QWebEngineView *m_oldView;
QRect m_oldGeometry;
};
#endif // FULLSCREENWINDOW_H
|
#undef _SPE
#undef _MSTR
#undef _DORD
#undef _CPOL
#undef _CPHA
#undef _SPIE
#undef _SPR
#undef _SPI2X
/* Register Composition */
#define _SPE (1 << SPE)
// Bound checks are done later below
#define _MSTR (SPIx_MASTER << MSTR)
#define _DORD (SPIx_ORDER << DORD)
#define _CPOL (SPIx_POLARITY << CPOL)
#define _CPHA (SPIx_PHASE << CPHA)
#define _SPIE (0 << SPIE)
#if SPIx_DIVIDER == 2
#define _SPR ((0 << SPR1) | (0 << SPR0))
#define _SPI2X (1 << SPI2X)
#if _MSTR == 0
#warning "SPI Speed unstably high for slave mode, consider using SPIx_DIVIDER >= 4."
#endif
#elif SPIx_DIVIDER == 4
#define _SPR ((0 << SPR1) | (0 << SPR0))
#define _SPI2X (0 << SPI2X)
#elif SPIx_DIVIDER == 8
#define _SPR ((0 << SPR1) | (1 << SPR0))
#define _SPI2X (1 << SPI2X)
#elif SPIx_DIVIDER == 16
#define _SPR ((0 << SPR1) | (1 << SPR0))
#define _SPI2X (0 << SPI2X)
#elif SPIx_DIVIDER == 32
#define _SPR ((1 << SPR1) | (0 << SPR0))
#define _SPI2X (1 << SPI2X)
#elif SPIx_DIVIDER == 64
#define _SPR ((1 << SPR1) | (0 << SPR0))
#define _SPI2X (0 << SPI2X)
#elif SPIx_DIVIDER == 128
#define _SPR ((1 << SPR1) | (1 << SPR0))
#define _SPI2X (0 << SPI2X)
#endif
/* Configuration Check */
#if !(SPIx_MASTER == 0 || SPIx_MASTER == 1)
#error "SPIx_MASTER out of bounds"
#endif
#if !(SPIx_ORDER == 0 || SPIx_ORDER == 1)
#error "SPIx_ORDER out of bounds"
#endif
#if !(SPIx_POLARITY == 0 || SPIx_POLARITY == 1)
#error "SPIx_POLARITY out of bounds"
#endif
#if !(SPIx_PHASE == 0 || SPIx_PHASE == 1)
#error "SPIx_PHASE out of bounds"
#endif
#ifndef _SPR
#error "SPIx_DIVIDER out of bounds"
#endif
#ifndef _SPI2X
#error "SPIx_DIVIDER out of bounds"
#endif
|
#pragma once
#include <stdint.h>
#include <stdio.h>
#include <exception>
#include <string>
#include <sstream>
/*!
* @brief Generic AGM exception.
*
* @ingroup CPPAPI
*
*
*/
class AGMModelException : public std::exception
{
public:
/// Constructor
AGMModelException(std::string file__, int32_t line__, std::string text__="") throw()
{
file_ = file__;
line_ = line__;
text_ = text__;
}
/// Destructor
~AGMModelException() throw()
{
}
/// <strong>This is the method you should call when capturing an AGMModelException object</strong>.
const char* what() const throw()
{
std::ostringstream ss;
ss << file_ << "(" << line_ << "): " << ": Exeception";
if (text_.size() > 0)
{
ss << ": " + text_;
}
return ss.str().c_str();
}
private:
std::string file_;
uint32_t line_;
std::string text_;
std::string file() { return file_; }
uint32_t line() { return line_; }
std::string text() { return text_; }
};
#define AGMMODELEXCEPTION(X) { throw AGMModelException(__FILE__, __LINE__, X); }
|
#ifndef PROCESSDATA_H
#define PROCESSDATA_H
//*****************************************************************************
//$Workfile: processdata.h
// Authors: Peter Nagy <peter.nagy@perit.hu>
// Reviewer: -
// Project: Bypass control correction of a Helios ventilation system
// Date: 24.08.2017
//*****************************************************************************
// Description:
// ...
//*****************************************************************************
// COPYRIGHT (C) 2017, Peter Nagy
//
// This file is part of a home automation project "Helios bypass control".
//
// Helios bypass control 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.
// Helios bypass control is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with the project. If not, see <http://www.gnu.org/licenses/>.
//*****************************************************************************
//*** INCLUDES ****************************************************************
//*** DEFINES AND CONSTANTS ***************************************************
//*** TYPES AND CLASSES *******************************************************
class ProcessData
{
//------- Enums, Typedefs -------
//------- Attribute -------------
protected:
double myValue = 0.0;
double myHysteresis = 0.0;
//------- Services --------------
public:
// Constructor
explicit ProcessData( double value = 0.0 )
{
myValue = value;
};
explicit ProcessData( const ProcessData& other )
{
*this = other;
};
virtual void SetHysteresis( double value )
{
myHysteresis = value;
}
virtual ProcessData& operator=( const ProcessData& other )
{
if ( this != &other )
{
myValue = other.myValue;
myHysteresis = other.myHysteresis;
}
return *this;
}
virtual ProcessData& operator=( const double value )
{
myValue = value;
return *this;
}
virtual bool operator>( const double value )
{
return ( myValue > value + myHysteresis );
}
virtual bool operator>( const ProcessData& other )
{
return *this > other.myValue;
}
virtual bool operator<( const double value )
{
return ( myValue < value - myHysteresis );
}
virtual bool operator<( const ProcessData& other )
{
return *this < other.myValue;
}
virtual double Value()
{
return myValue;
}
};
#endif // PROCESSDATA_H
|
// -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
// Copyright (C) 2013 Henner Zeller <h.zeller@acm.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 version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU 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://gnu.org/licenses/gpl-2.0.txt>
#ifndef RPI_RGBMATRIX_FRAMEBUFFER_INTERNAL_H
#define RPI_RGBMATRIX_FRAMEBUFFER_INTERNAL_H
#include <stdint.h>
#include <stdlib.h>
#include "hardware-mapping.h"
namespace rgb_matrix {
class GPIO;
class PinPulser;
namespace internal {
// An opaque type used within the framebuffer that can be used
// to copy between PixelMappers.
struct PixelDesignator {
PixelDesignator() : gpio_word(-1), r_bit(0), g_bit(0), b_bit(0), mask(~0){}
int gpio_word;
uint32_t r_bit;
uint32_t g_bit;
uint32_t b_bit;
uint32_t mask;
};
class PixelMapper {
public:
PixelMapper(int width, int height);
~PixelMapper();
// Get a writable version of the PixelDesignator. Outside Framebuffer used
// by the RGBMatrix to re-assign mappings to new PixelMappers.
PixelDesignator *get(int x, int y);
inline int width() const { return width_; }
inline int height() const { return height_; }
private:
const int width_;
const int height_;
PixelDesignator *const buffer_;
};
// Internal representation of the frame-buffer that as well can
// write itself to GPIO.
// Our internal memory layout mimicks as much as possible what needs to be
// written out.
class Framebuffer {
public:
Framebuffer(int rows, int columns, int parallel,
int scan_mode,
const char* led_sequence, bool inverse_color,
PixelMapper **mapper);
~Framebuffer();
// Initialize GPIO bits for output. Only call once.
static void InitHardwareMapping(const char *named_hardware);
static void InitGPIO(GPIO *io, int rows, int parallel,
bool allow_hardware_pulsing,
int pwm_lsb_nanoseconds);
// Set PWM bits used for output. Default is 11, but if you only deal with
// simple comic-colors, 1 might be sufficient. Lower require less CPU.
// Returns boolean to signify if value was within range.
bool SetPWMBits(uint8_t value);
uint8_t pwmbits() { return pwm_bits_; }
// Map brightness of output linearly to input with CIE1931 profile.
void set_luminance_correct(bool on) { do_luminance_correct_ = on; }
bool luminance_correct() const { return do_luminance_correct_; }
// Set brightness in percent; range=1..100
// This will only affect newly set pixels.
void SetBrightness(uint8_t b) {
brightness_ = (b <= 100 ? (b != 0 ? b : 1) : 100);
}
uint8_t brightness() { return brightness_; }
void DumpToMatrix(GPIO *io);
void Serialize(const char **data, size_t *len) const;
bool Deserialize(const char *data, size_t len);
// Canvas-inspired methods, but we're not implementing this interface to not
// have an unnecessary vtable.
int width() const;
int height() const;
void SetPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue);
void Clear();
void Fill(uint8_t red, uint8_t green, uint8_t blue);
private:
static const struct HardwareMapping *hardware_mapping_;
// This returns the gpio-bit for given color (one of 'R', 'G', 'B'). This is
// returning the right value in case led_sequence_ is _not_ "RGB"
gpio_bits_t GetGpioFromLedSequence(char col,
gpio_bits_t default_r,
gpio_bits_t default_g,
gpio_bits_t default_b);
void InitDefaultDesignator(int x, int y, PixelDesignator *designator);
inline void MapColors(uint8_t r, uint8_t g, uint8_t b,
uint16_t *red, uint16_t *green, uint16_t *blue);
const int rows_; // Number of rows. 16 or 32.
const int parallel_; // Parallel rows of chains. 1 or 2.
const int height_; // rows * parallel
const int columns_; // Number of columns. Number of chained boards * 32.
const int scan_mode_;
const char *const led_sequence_; // Some LEDs are mapped differently.
const bool inverse_color_;
uint8_t pwm_bits_; // PWM bits to display.
bool do_luminance_correct_;
uint8_t brightness_;
const int double_rows_;
const uint8_t row_mask_;
const size_t buffer_size_;
// The frame-buffer is organized in bitplanes.
// Highest level (slowest to cycle through) are double rows.
// For each double-row, we store pwm-bits columns of a bitplane.
// Each bitplane-column is pre-filled IoBits, of which the colors are set.
// Of course, that means that we store unrelated bits in the frame-buffer,
// but it allows easy access in the critical section.
gpio_bits_t *bitplane_buffer_;
inline gpio_bits_t *ValueAt(int double_row, int column, int bit);
PixelMapper **shared_mapper_; // Storage in RGBMatrix.
};
} // namespace internal
} // namespace rgb_matrix
#endif // RPI_RGBMATRIX_FRAMEBUFFER_INTERNAL_H
|
#ifndef _ASMPARISC_SIGCONTEXT_H
#define _ASMPARISC_SIGCONTEXT_H
#define PARISC_SC_FLAG_ONSTACK 1<<0
#define PARISC_SC_FLAG_IN_SYSCALL 1<<1
/* We will add more stuff here as it becomes necessary, until we know
it works. */
struct sigcontext
{
unsigned long sc_flags;
unsigned long sc_gr[32]; /* PSW in sc_gr[0] */
unsigned long long sc_fr[32]; /* FIXME, do we need other state info? */
unsigned long sc_iasq[2];
unsigned long sc_iaoq[2];
unsigned long sc_sar; /* cr11 */
};
#endif
|
/*
* Christian Gaser
* $Id: MrfPrior.c 404 2011-04-11 10:03:40Z gaser $
*
*/
/* This code is a substantially modified version of MrfPrior.C
* from Jagath C. Rajapakse
*
* Original author : Jagath C. Rajapakse
*
* See:
* Statistical approach to single-channel MR brain scans
* J. C. Rajapakse, J. N. Giedd, and J. L. Rapoport
* IEEE Transactions on Medical Imaging, Vol 16, No 2, 1997
*
* Comments to raja@cns.mpg.de, 15.10.96
*/
#include <stdio.h>
#include <math.h>
#include "Amap.h"
void MrfPrior(unsigned char *label, int n_classes, double *alpha, double *beta, int init, int *dims)
{
int i, j, k, x, y, z;
int fi, fj;
long color[MAX_NC][7][7][7][7];
long area;
int f[MAX_NC-1], plab, zero, iBG;
int n, z_area, y_dims;
double XX, YY, L;
area = dims[0]*dims[1];
/* initialize configuration counts */
for (i = 0; i < n_classes; i++)
for (f[0] = 0; f[0] < 7; f[0]++)
for (f[1] = 0; f[1] < 7; f[1]++)
for (f[2] = 0; f[2] < 7; f[2]++)
for (f[3] = 0; f[3] < 7; f[3]++)
color[i][f[0]][f[1]][f[2]][f[3]]=0;
/* calculate configuration counts */
n = 0;
for (i = 0; i < n_classes; i++) alpha[i] = 0.0;
for (z = 1; z < dims[2]-1; z++) {
z_area=z*area;
for (y = 1; y < dims[1]-1; y++) {
y_dims = y*dims[0];
for (x = 1; x < dims[0]-1; x++) {
plab = (int)label[z_area + y_dims + x];
zero = plab;
if (zero < 1) continue;
n++;
alpha[zero - 1] += 1.0;
for (i = 1; i < n_classes; i++) {
f[i-1] = 0;
iBG = i+1;
if ((int)label[z_area + y_dims + x-1] == iBG) f[i-1]++;
if ((int)label[z_area + y_dims + x+1] == iBG) f[i-1]++;
if ((int)label[z_area + ((y-1)*dims[0]) + x] == iBG) f[i-1]++;
if ((int)label[z_area + ((y+1)*dims[0]) + x] == iBG) f[i-1]++;
if ((int)label[((z-1)*area) + y_dims + x] == iBG) f[i-1]++;
if ((int)label[((z+1)*area) + y_dims + x] == iBG) f[i-1]++;
}
color[zero-1][f[0]][f[1]][f[2]][f[3]]++;
}
}
}
/* evaluate alphas */
printf("MRF priors: alpha ");
for (i = 0; i < n_classes; i++) {
if (init == 0) alpha[i] /= n; else alpha[i] = 1.0;
printf("%3.3f ", alpha[i]);
}
/* compute beta */
n = 0;
XX=0.0, YY=0.0;
for (f[0] = 0; f[0] < 7; f[0]++)
for (f[1] = 0; f[1] < 7; f[1]++)
for (f[2] = 0; f[2] < 7; f[2]++)
for (f[3] = 0; f[3] < 7; f[3]++)
for (i = 0; i < n_classes; i++)
for (j = 0; j < i; j++) {
n++;
if (color[i][f[0]][f[1]][f[2]][f[3]] < TH_COLOR ||
color[j][f[0]][f[1]][f[2]][f[3]] < TH_COLOR) continue;
L = log(((double) color[i][f[0]][f[1]][f[2]][f[3]])/
(double) color[j][f[0]][f[1]][f[2]][f[3]]);
if (i == 0)
fi = 6 - f[0] - f[1] - f[2] - f[3];
else fi = f[i-1];
if (j == 0)
fj = 6 - f[0] - f[1] - f[2] - f[3];
else fj = f[j-1];
XX += (fi-fj)*(fi-fj);
YY += L*(fi-fj);
}
/* weighting of beta was empirically estimated using brainweb data with different noise levels
because old beta estimation was not working */
beta[0] = XX/YY;
printf("\t beta %3.3f\n", beta[0]);
fflush(stdout);
}
|
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@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 DRIVERTRACKER_H
#define DRIVERTRACKER_H
#include <QPixmap>
#include "driverradar.h"
class DriverTracker : public DriverRadar
{
Q_OBJECT
public:
DriverTracker(QWidget *parent = 0);
virtual void loadDriversList();
virtual void setupDrivers(int speed);
void paintClassification(QPainter &p);
void setDrawDriverClassification(bool val)
{
drawClassification = val;
setMinimumSize();
resizeEvent(0);
repaint();
}
bool drawDriverClassification()
{
return drawClassification;
}
void setMinimumSize();
signals:
void driverSelected(int);
protected:
virtual void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void mousePressEvent(QMouseEvent *);
void mouseDoubleClickEvent(QMouseEvent *);
bool isExcluded(int id);
QPixmap label;
QPixmap selectedLabel;
QPixmap trackMap;
QList<int> excludedDrivers;
bool drawClassification;
};
#endif // DRIVERTRACKER_H
|
/*
* Copyright (c) 2015 kiwixz
*
* This file is part of spectrum.
*
* spectrum 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.
*
* spectrum 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 spectrum. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <gst/gst.h>
#include "config.h"
#include "shaders.h"
#include "shared.h"
#include "player.h"
#include "window.h"
int main(int argc, char *argv[])
{
GMainLoop *loop;
gtk_init(&argc, &argv);
gtk_gl_init(&argc, &argv);
gst_init(&argc, &argv);
config_init();
loop = g_main_loop_new(NULL, FALSE);
if (config_read() < 0 || window_new(loop))
return EXIT_FAILURE;
if (argc > 2)
WARNING("Too much arguments");
else if (argc == 2)
if(player_play_file(argv[1]))
return EXIT_FAILURE;
g_main_loop_run(loop);
// debug
GLERROR();
if (config_write())
return EXIT_FAILURE;
g_main_loop_unref(loop);
return EXIT_SUCCESS;
}
|
/*--------------------------------------------------------------------
(C) Copyright 2006-2012 Barcelona Supercomputing Center
Centro Nacional de Supercomputacion
This file is part of Mercurium C/C++ source-to-source compiler.
See AUTHORS file in the top level directory for information
regarding developers and contributors.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
Mercurium C/C++ source-to-source compiler 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 Mercurium C/C++ source-to-source compiler; if
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
--------------------------------------------------------------------*/
/*
<testinfo>
test_generator=config/mercurium-ompss
</testinfo>
*/
#include <stdlib.h>
#include <stdio.h>
int a;
int b;
int main(int argc, char *argv[])
{
int i;
a = -3;
b = -4;
#pragma omp parallel for firstprivate(a, b) lastprivate(a, b)
for (i = 0; i < 100; i++)
{
if (a < 0) if (a != -3) abort();
if (b < 0) if (b != -4) abort();
a = i;
b = i;
}
if (a != 99)
abort();
if (b != 99)
abort();
return 0;
}
|
/* Formatted output to strings.
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Specification. */
#include "vasprintf.h"
#include <stdarg.h>
int
asprintf (char **resultp, const char *format, ...)
{
va_list args;
int result;
va_start (args, format);
result = vasprintf (resultp, format, args);
va_end (args);
return result;
}
|
#include <stdlib.h>
#include <inttypes.h>
#include <assert.h>
#include "carp_registers.h"
char carp_reverse_reg[][5] = {
"r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"r8",
"r9",
"ax",
"bx",
"cx",
"dx",
"rx",
"ip",
"sp",
"fp",
"gbg",
"run",
"ext",
"undef",
};
/*
Returns a pointer to a register.
*/
carp_value *carp_reg_get (carp_value regs[], carp_reg reg) {
assert(regs != NULL);
if (reg >= CARP_NUM_REGS)
return NULL;
return ®s[reg];
}
/*
Set the value in a given register. Fails if register is outside bounds.
*/
carp_bool carp_reg_set (carp_value regs[], carp_reg reg, carp_value value) {
assert(regs != NULL);
carp_value *res = carp_reg_get(regs, reg);
if (res == NULL)
return 1;
*res = value;
return 0;
}
/*
Adds a value to a register.
*/
carp_bool carp_reg_add (carp_value regs[], carp_reg reg, carp_value value) {
assert(regs != NULL);
carp_value *res = carp_reg_get(regs, reg);
if (res == NULL)
return 1;
*res += value;
return 0;
}
/*
Subtracts a value from a register.
*/
carp_bool carp_reg_sub (carp_value regs[], carp_reg reg, carp_value value) {
assert(regs != NULL);
carp_value *res = carp_reg_get(regs, reg);
if (res == NULL)
return 1;
*res -= value;
return 0;
}
/*
Increments a register.
*/
carp_bool carp_reg_inc (carp_value regs[], carp_reg reg) {
assert(regs != NULL);
assert(regs != NULL);
carp_value *res = carp_reg_get(regs, reg);
if (res == NULL)
return 1;
carp_reg_add(regs, reg, 1);
return 0;
}
/*
Decrements a register.
*/
carp_bool carp_reg_dec (carp_value regs[], carp_reg reg) {
assert(regs != NULL);
assert(regs != NULL);
carp_value *res = carp_reg_get(regs, reg);
if (res == NULL)
return 1;
carp_reg_sub(regs, reg, 1);
return 0;
}
void carp_reg_print (carp_value regs[], FILE *fp) {
assert(regs != NULL);
if (fp == NULL)
fp = stdout;
fprintf(fp, "{\n");
for (int i = 0; i < CARP_NUM_REGS; i++)
fprintf(fp, "%s: %" PRId64 ",\n", carp_reverse_reg[i], regs[i]);
fprintf(fp, "}\n");
}
/*
Initialize all the registers to value 0.
*/
void carp_reg_init (carp_value regs[]) {
assert(regs != NULL);
for (int i = 0; i < CARP_NUM_REGS; i++)
carp_reg_set(regs, i, 0);
}
|
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: Shield used by the mortar synth
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#ifndef BEAMCHASER_H
#define BEAMCHASER_H
#define MAX_SHIELDBEAM_NODES 10
class CBeam;
//#################################################################################
// >> CShieldBeamNode
//#################################################################################
class CShieldBeamNode : public CBaseEntity
{
public:
DECLARE_CLASS( CShieldBeamNode, CBaseEntity );
void Spawn( void );
CShieldBeamNode* m_pNextNode;
DECLARE_DATADESC();
};
//#################################################################################
// >> CShieldBeam
//#################################################################################
class CShieldBeam : public CLogicalEntity
{
public:
DECLARE_CLASS( CShieldBeam, CLogicalEntity );
static CShieldBeam* ShieldBeamCreate(CBaseEntity* pHeadEntity, int nAttachment);
void ShieldBeamStart(CBaseEntity* pHeadEntity, CBaseEntity* pTailEntity, const Vector &vInitialVelocity, float speed );
void ShieldBeamStop( void );
void SetNoise( float fNoise );
bool IsShieldBeamOn( void );
bool ReachedTail( void );
void ShieldBeamThink( void );
EHANDLE m_hHead;
int m_nHeadAttachment;
EHANDLE m_hTail;
Vector m_vTailOffset;
float m_fSpeed;
DECLARE_DATADESC();
private:
CBeam* m_pBeam; // The spline beam
CShieldBeamNode* m_pBeamNode; // Nodes that form the spline beam
float m_fNextNodeTime;
bool m_bKillBeam;
bool m_bReachedTail;
float m_fBrightness;
float m_fNoise;
Vector m_vInitialVelocity;
int CountNodes(void);
void UpdateBeam( void ); // Update the spline beam
float ThinkInterval( void );
CShieldBeamNode* GetNewNode( void );
bool UpdateShieldNode( CShieldBeamNode* pNode, Vector &vTargetPos, float fInterval );
};
#endif //BEAMCHASER_H
|
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Unix others */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef __FreeBSD__
# include <utmp.h>
#else
# include <utmpx.h>
#endif
#if !defined(_PATH_UTMPX) && !defined(UT_NAMESIZE) && !defined(EMPTY)
# include <sys/time.h>
# include <string.h>
/* types */
# ifndef utmpx
# define utmpx utmpx
struct utmpx
{
char ut_name[UT_NAMESIZE];
char ut_line[UT_LINESIZE];
char ut_host[UT_HOSTSIZE];
int ut_type;
pid_t ut_pid;
struct timeval ut_tv;
};
# define ut_user ut_name
# endif /* !utmpx */
/* constants */
# define EMPTY 0
# define USER_PROCESS 1
/* macros */
# ifndef min
# define min(a, b) ((a) < (b) ? (a) : (b))
# endif
/* functions */
/* getutxent */
# ifndef getutxent
# define getutxent getutxent
struct utmpx * getutxent(void)
/* FIXME implement */
{
static FILE * fp = NULL;
static struct utmpx utx;
struct utmp ut;
if(fp == NULL && (fp = fopen(_PATH_UTMP, "r")) == NULL)
return NULL; /* FIXME report error */
if(fread(&ut, sizeof(ut), 1, fp) != 1)
return NULL;
memcpy(utx.ut_name, ut.ut_name, min(sizeof(utx.ut_name),
sizeof(ut.ut_name)));
memcpy(utx.ut_line, ut.ut_line, min(sizeof(utx.ut_line),
sizeof(ut.ut_line)));
memcpy(utx.ut_host, ut.ut_host, min(sizeof(utx.ut_host),
sizeof(ut.ut_host)));
utx.ut_type = (ut.ut_name[0] == '\0') ? EMPTY : USER_PROCESS;
utx.ut_pid = -1;
utx.ut_tv.tv_sec = ut.ut_time;
utx.ut_tv.tv_usec = 0;
return &utx;
}
# endif /* !getutxent */
#endif
|
/*
* obldc_can.c
*
* Created on: 27.04.2015
* Author: joerg
*/
#include "obldc_can.h"
#include "ch.h"
#include "hal.h"
// Threads
// Variable definitions
CANRxFrame rxmsg; //static uint8_t can_rx_buffer[256];
static uint8_t can_rx_buffer_last_id;
/*
* Internal loopback mode, 500KBaud, automatic wakeup, automatic recover
* from abort mode.
* See section 22.7.7 on the STM32 reference manual.
*/
static const CANConfig cancfg = {
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, // , automatic wakeup,
CAN_BTR_LBKM | // Loop back mode - for testing
CAN_BTR_SJW(3) | // Synchronization jump width; must be smaller or equal 4 and smaller than TS1 & TS2
CAN_BTR_TS2(7) | // Time Segment 2;
CAN_BTR_TS1(8) | // Time Segment 1;
CAN_BTR_BRP(1) //CAN_BTR_BRP(1) // BaudRatePrescaler is 2 --> half frequency of APB1(here 28MHz) see Fig 395 "Bit timing"
};
// 24.7.4 seite 655 Each filter bank x consists of two 32-bit registers, CAN_FxR0 and CAN_FxR1.
/*
* Receiver thread.
*/
static THD_WORKING_AREA(waCanComThread, 2048);
static THD_FUNCTION(tCanComThread, arg) {
(void)arg;
chRegSetThreadName("CanComThread");
event_listener_t el;
CANRxFrame rxmsg;
int32_t ind = 0;
int32_t rxbuf_len;
uint8_t crc_low;
uint8_t crc_high;
bool commands_send;
chEvtRegister(&CAND1.rxfull_event, &el, 0);
while(!chThdShouldTerminateX()) {
if (chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(100)) == 0)
continue;
while (canReceive(&CAND1, CAN_ANY_MAILBOX, &rxmsg, TIME_IMMEDIATE) == MSG_OK) {
/* Process message.*/
//palTogglePad(IOPORT3, GPIOC_LED);
//palTogglePad(GPIOB, GPIOB_LEDR);
palTogglePad(GPIOE, GPIOE_LED10_RED);
}
}
chEvtUnregister(&CAND1.rxfull_event, &el);
}
/*
* Transmitter thread.
*/
static THD_WORKING_AREA(can_tx_wa, 256);
static THD_FUNCTION(can_tx, p) {
CANTxFrame txmsg;
(void)p;
chRegSetThreadName("transmitter");
txmsg.IDE = CAN_IDE_EXT;
txmsg.EID = 0x01234567;
txmsg.RTR = CAN_RTR_DATA;
txmsg.DLC = 8;
txmsg.data32[0] = 0x55AA55AA;
txmsg.data32[1] = 0x00FF00FF;
while (!chThdShouldTerminateX()) {
canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(10));
chThdSleepMilliseconds(50);
}
}
void obldc_can_init(void) {
canStart(&CAND1, &cancfg);
chThdCreateStatic(waCanComThread, sizeof(waCanComThread), NORMALPRIO + 7, tCanComThread, NULL);
// Empfangsthread hängt manchmal wenn was empfangen wird
chThdCreateStatic(can_tx_wa, sizeof(can_tx_wa), NORMALPRIO + 7, can_tx, NULL);
}
|
#ifdef MDBAS_PARA_MPI
#include <mpi.h>
#define BUFSIZ 8192
int init_para(int *argc, char ***argv,PARAM *param)
{
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
err=MPI_init(argc,argv);
if(err!=MPI_SUCCES)
call mpi_error(err,__FILE__,__LINE__);
param->nProc=num_proc();
param->nAtProc=(param->nAtoms+param->nProc-1)/param->nProc;
}
int myproc()
{
int idProc,err;
err=MPI_Comm_rank(MPI_COMM_WORLD,&idProc);
if(err!=MPI_SUCCES)
call mpi_error(err,__FILE__,__LINE__);
return (idProc);
}
int num_proc()
{
int numProc,err;
err=MPI_Comm_size(MPI_COMM_WORLD, &numProc));
if(err!=MPI_SUCCES)
call mpi_error(err,__FILE__,__LINE__);
return(numProc);
}
void mpi_error(int err, char file[],int line)
{
char errString[BUFSIZ];
int idProc,lenErrString, errClass;
idProc=myproc();
MPI_Error_class(err, &errClass);
MPI_Error_string(errClass, errString, &lenErrString);
fprintf(outFile, "%3d: %s\n", idProc, errString);
MPI_Error_string(err, errString, &lenErrString);
fprintf(outFile, "%3d: %s\n", idProc, errString);
MPI_Abort(MPI_COMM_WORLD, err);
my_error(MPI_ERROR,file,line,0);
}
#endif //MDBAS_PARA_MPI |
/*
* Copyright 2016 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis 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.
*
* Arx Libertatis 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 Arx Libertatis. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ARX_TESTS_IO_RESOURCE_RESOURCEPATHTEST_H
#define ARX_TESTS_IO_RESOURCE_RESOURCEPATHTEST_H
#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>
class ResourcePathTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(ResourcePathTest);
CPPUNIT_TEST(loadTest);
CPPUNIT_TEST(resolveTest);
CPPUNIT_TEST(parentTest);
CPPUNIT_TEST_SUITE_END();
public:
ResourcePathTest()
: CppUnit::TestFixture()
{}
void testLoad(const char * input, const char * expected);
void testResolve(const char * left, const char * right, const char * expected);
void testParent(const char * input, const char * expected);
void loadTest();
void resolveTest();
void parentTest();
};
#endif // ARX_TESTS_IO_RESOURCE_RESOURCEPATHTEST_H
|
#ifndef _C2_se84_
#define _C2_se84_
#ifdef __cplusplus
extern "C" {
#endif
extern EIF_INTEGER_32 F71_1446(EIF_REFERENCE);
extern void EIF_Minit84(void);
#ifdef __cplusplus
}
#endif
#endif
|
#include <stdint.h>
#include "errors.h"
YYSTYPE evalExpr(char* expr, errcode_t* err, char* errStr);
void evalDie();
|
/*
* Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
* Copyright (C) 2007-2009 PetaLogix
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>
#include <linux/debug_locks.h>
#include <asm/exceptions.h>
#include <asm/unwind.h>
void trap_init(void)
{
__enable_hw_exceptions();
}
static unsigned long kstack_depth_to_print; /* 0 == entire stack */
static int __init kstack_setup(char *s)
{
return !kstrtoul(s, 0, &kstack_depth_to_print);
}
__setup("kstack=", kstack_setup);
void show_stack(struct task_struct *task, unsigned long *sp)
{
unsigned long words_to_show;
u32 fp = (u32) sp;
if (fp == 0)
{
if (task)
{
fp = ((struct thread_info *)
(task->stack))->cpu_context.r1;
}
else
{
/* Pick up caller of dump_stack() */
fp = (u32)&sp - 8;
}
}
words_to_show = (THREAD_SIZE - (fp & (THREAD_SIZE - 1))) >> 2;
if (kstack_depth_to_print && (words_to_show > kstack_depth_to_print))
{
words_to_show = kstack_depth_to_print;
}
pr_info("Kernel Stack:\n");
/*
* Make the first line an 'odd' size if necessary to get
* remaining lines to start at an address multiple of 0x10
*/
if (fp & 0xF)
{
unsigned long line1_words = (0x10 - (fp & 0xF)) >> 2;
if (line1_words < words_to_show)
{
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 32,
4, (void *)fp, line1_words << 2, 0);
fp += line1_words << 2;
words_to_show -= line1_words;
}
}
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 32, 4, (void *)fp,
words_to_show << 2, 0);
pr_info("\n\nCall Trace:\n");
microblaze_unwind(task, NULL);
pr_info("\n");
if (!task)
{
task = current;
}
debug_show_held_locks(task);
}
|
#include "machdep.h"
#include "form.h"
int main() {
fform(stdout, "'this is a test'\n"); // 'this is a test'
fform(stdout, "'()'\n", 100); // '100'
fform(stdout, "'()'\n",-100); // '-100'
fform(stdout, "'(ub16)'\n",-1); // '-1'
fform(stdout, "'()(p40)()()'\n",1,2,3,4); // '1 234'
fform(stdout, "'()(p40)()(p30)'\n",1,2,3,4); // '1 4 23'
fform(stdout, "'(r10)'\n", 100); // ' 100'
fform(stdout, "'(z10)'\n", 100); // '0000000100'
fform(stdout, "'(l10)'\n", 100); // '100 '
fform(stdout, "'(b16)'\n", 100); // '64'
fform(stdout, "'(c10l20)'\n", "This is a test"); // 'This is a '
fform(stdout, "'(c10r20)'\n", "This is a test"); // ' This is a '
fform(stdout, "'(cr20)'\n", "This is a test"); // ' This is a test'
fform(stdout, "'(cl20)'\n", "This is a test"); // 'This is a test '
fform(stdout, "'(Cl20)'\n", " This is a test"); // 'This is a test '
fform(stdout, "'(Cr20)'\n", " This is a test "); // ' This is a test'
fform(stdout, "'(C)'\n", "This is a test"); // 'This is a test'
fform(stdout, "'(f)'\n", 0.123); // '0.123'
fform(stdout, "'(f)'\n", 123.456); // '123.456'
fform(stdout, "'(f)'\n", .00000000001); // '0.0000000001'
fform(stdout, "'(f)'\n", .0000000001); // '0.0000000001'
fform(stdout, "'(f)'\n", .000000001); // '0.000000001'
fform(stdout, "'(f)'\n", 123.000000001); // '123.000000001'
fform(stdout, "'(f)'\n", 1234567890.); // '1234567890.0'
fform(stdout, "'(f)'\n", 1.); // '1.0'
fform(stdout, "'(f.2)'\n", 0.123); // '0.12'
fform(stdout, "'(fz5.2)'\n", 0.123); // '00.12'
fform(stdout, "'(fr3.2)'\n", 0.123); // '.12'
fform(stdout, "'(fr5.2)'\n", 0.123); // ' 0.12'
getch();
} |
/* Functions to manipulate menus.
Copyright (C) 2008-2019 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs 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.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifndef MENU_H
#define MENU_H
#include "../lwlib/lwlib-widget.h"
/* Bit fields used by terminal-specific menu_show_hook. */
enum {
MENU_KEYMAPS = 0x1,
MENU_FOR_CLICK = 0x2,
MENU_KBD_NAVIGATION = 0x4
};
extern void init_menu_items (void);
extern void finish_menu_items (void);
extern void discard_menu_items (void);
extern void save_menu_items (void);
extern bool parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
extern void list_of_panes (Lisp_Object);
#ifdef HAVE_EXT_MENU_BAR
extern void free_menubar_widget_value_tree (widget_value *);
extern void update_submenu_strings (widget_value *);
extern void find_and_call_menu_selection (struct frame *, int,
Lisp_Object, void *);
extern widget_value *make_widget_value (const char *, char *, bool, Lisp_Object);
extern widget_value *digest_single_submenu (int, int, bool);
#endif
#if defined (HAVE_X_WINDOWS) || defined (MSDOS)
extern Lisp_Object x_menu_show (struct frame *, int, int, int,
Lisp_Object, const char **);
extern void x_activate_menubar (struct frame *);
#endif
#ifdef HAVE_NTGUI
extern Lisp_Object w32_menu_show (struct frame *, int, int, int,
Lisp_Object, const char **);
extern void w32_activate_menubar (struct frame *);
#endif
#ifdef HAVE_NS
extern Lisp_Object ns_menu_show (struct frame *, int, int, int,
Lisp_Object, const char **);
extern void ns_activate_menubar (struct frame *);
#endif
extern Lisp_Object tty_menu_show (struct frame *, int, int, int,
Lisp_Object, const char **);
extern ptrdiff_t menu_item_width (const unsigned char *);
extern Lisp_Object x_popup_menu_1 (Lisp_Object position, Lisp_Object menu);
#endif /* MENU_H */
|
/* This file is part of the 'neper' program. */
/* Copyright (C) 2003-2012, Romain Quey. */
/* See the COPYING file in the top-level directory. */
#ifndef NEUT_ELT0_H
#define NEUT_ELT0_H
extern void neut_elt_name_prop (char *, char *, char *, int *, int *);
extern int neut_elt_nodeqty (char *, int, int);
extern int neut_elt_dim_gtype_order (int, int);
extern int neut_elt_order (char *, int, int);
extern int neut_elt_gtype_prop (int, char*, int*, int*);
#endif /* NEUT_ELT0_H */
|
#ifndef _ETRT-QUATERNIONFILTERS_H_
#define _ETRT-QUATERNIONFILTERS_H_
#include <Arduino.h>
void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy,
float gz, float mx, float my, float mz,
float deltat);
void MahonyQuaternionUpdate(float ax, float ay, float az, float gx, float gy,
float gz, float mx, float my, float mz,
float deltat);
const float * getQ();
#endif // _QUATERNIONFILTERS_H_
|
/********************************************************************************
* *
* S t a t u s L i n e W i d g e t *
* *
*********************************************************************************
* Copyright (C) 1999,2020 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/> *
********************************************************************************/
#ifndef FXSTATUSLINE_H
#define FXSTATUSLINE_H
#ifndef FXFRAME_H
#include "FXFrame.h"
#endif
namespace FX {
/**
* The status line normally shows its permanent message.
* A semi-permanent message can override this permanent message, for example to
* indicate the application is busy or in a particular operating mode.
* The status line obtains the semi-permanent message by sending its target (if any)
* SEL_UPDATE message.
* A ID_SETSTRINGVALUE can be used to change the status message.
* When the user moves the cursor over a widget which has status-line help, the
* status line can flash a very temporarily message with help about the widget.
* For example, the status line may flash the "Quit Application" message when
* the user moves the cursor over the Quit button.
* The status line obtains the help message from the control by sending it a
* ID_QUERY_HELP message with type SEL_UPDATE.
* Unless the value is overridden, the status line will display the normal text,
* i.e. the string set via setNormalText().
* If the message contains a newline (\n), then the part before the newline
* will be displayed in the highlight color, while the part after the newline
* is shown using the normal text color.
*/
class FXAPI FXStatusLine : public FXFrame {
FXDECLARE(FXStatusLine)
protected:
FXString status; // Current status message
FXString normal; // Normally displayed message
FXFont *font; // Font
FXColor textColor; // Status text color
FXColor textHighlightColor; // Status text highlight color
protected:
FXStatusLine();
private:
FXStatusLine(const FXStatusLine&);
FXStatusLine& operator=(const FXStatusLine&);
public:
long onPaint(FXObject*,FXSelector,void*);
long onUpdate(FXObject*,FXSelector,void*);
long onCmdGetStringValue(FXObject*,FXSelector,void*);
long onCmdSetStringValue(FXObject*,FXSelector,void*);
public:
/// Constructor
FXStatusLine(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0);
/// Create server-side resources
virtual void create();
/// Detach server-side resources
virtual void detach();
/// Return default width
virtual FXint getDefaultWidth();
/// Return default height
virtual FXint getDefaultHeight();
/// Change the temporary status message
void setText(const FXString& text);
/// Return the temporary status message
FXString getText() const { return status; }
/// Change the permanent status message
void setNormalText(const FXString& text);
/// Return the permanent status message
FXString getNormalText() const { return normal; }
/// Change the font
void setFont(FXFont* fnt);
/// Return the current font
FXFont* getFont() const { return font; }
/// Return the text color
FXColor getTextColor() const { return textColor; }
/// Change the text color
void setTextColor(FXColor clr);
/// Return the highlight text color
FXColor getTextHighlightColor() const { return textHighlightColor; }
/// Change the highlight text color
void setTextHighlightColor(FXColor clr);
/// Save status line to stream
virtual void save(FXStream& store) const;
/// Load status line from stream
virtual void load(FXStream& store);
/// Destroy
virtual ~FXStatusLine();
};
}
#endif
|
/**
* This Source Code Form is part of UOP Package library by Nolok and subject to the terms of the
* GNU General Public License version 3. More info in the file "uoppackage.h", which is part of this source code package.
*/
#ifndef UOPERROR_H
#define UOPERROR_H
#include <string>
#include <deque>
namespace uopp
{
class UOPError
{
friend class UOPFile;
friend class UOPHeader;
friend class UOPBlock;
friend class UOPPackage;
using errorQueue_t = std::deque<std::string>;
public:
//UOPError():
//UOPError(const UOPError&);
//void operator=(const UOPError&);
private:
errorQueue_t m_errorQueue;
static void append(const std::string& str, UOPError* errorQueue);
public:
const errorQueue_t &getErrorQueue() const;
bool errorOccurred() const;
void clear(); // users have to manually clear the error queue between operations
std::string operator[](unsigned int index) const;
std::string buildErrorsString(bool emptyQueue = true, bool newLineFirst = false);
};
}
#endif // UOPERROR_H
|
//
// DPSetupWindowView.h
// DPSetupWindow
//
// Created by Dan Palmer on 05/10/2012.
// Copyright (c) 2012 Dan Palmer. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class DPSetupWindow;
@protocol DPSetupWindowStageViewController <NSObject>
@optional
/*
Stage view controllers must implement these as they will be observed by the setup window to determine whether the interface buttons should be enabled.
*/
@property (readonly) BOOL canContinue;
@property (readonly) BOOL canGoBack;
/*
Each view controller will be given a reference to the setup window through this method so that it may add extra stages for a dynamic setup process.
*/
- (void)setSetupWindow:(DPSetupWindow *)setupWindow;
/*
These methods allow each stage to define their own titles for the interface buttons. For example, one may wish to have "Next, Next and Finish" as the continue button titles for three stages.
*Note: a custom title will not get carried over to the next stage, each stage must specify it's own.*
*/
- (NSString *)continueButtonTitle;
- (NSString *)backButtonTitle;
- (NSString *)cancelButtonTitle;
/*
These methods are used to notify the view controllers in the setup flow of any changes they may be interested in.
To illustrate the times each method will be called, the italicised stage is the one that will receive the method call.
*current* -> next
*/
- (void)willProgressToNextStage;
- (void)didProgressToNextStage;
/*
current -> *next*
*/
- (void)willProgressToStage;
- (void)didProgressToStage;
/*
previous <- *current*
*/
- (void)willRevertToPreviousStage;
- (void)didRevertToPreviousStage;
/*
*previous* <- current
*/
- (void)willRevertToStage;
- (void)didRevertToStage;
@end
@interface DPSetupWindow : NSWindow {
NSImage *_backgroundImage;
NSInteger currentStage;
}
@property (strong) NSImage *backgroundImage;
@property (assign) BOOL animates;
@property (strong) NSArray *viewControllers;
@property (assign) BOOL funnelsRepresentedObjects;
- (id)initWithViewControllers:(NSArray *)viewControllers completionHandler:(void (^)(BOOL completed))completionHandler;
- (void)addNextViewController:(NSViewController<DPSetupWindowStageViewController> *)viewController;
- (void)removeViewController:(NSViewController<DPSetupWindowStageViewController> *)viewController;
- (void)addFinalViewController:(NSViewController<DPSetupWindowStageViewController> *)viewController;
- (void)progressToNextStage;
- (void)revertToPreviousStage;
@end
|
/*
* image.h
* Author: Rushy Panchal
* Description: A simple module to manipulate PNG images.
* Provides the Image_T ADT for writing and saving PNG images.
* Note: assumes using RGB coloring.
*/
#ifndef IMAGE_INCLUDED
#define IMAGE_INCLUDED
#include <stdbool.h>
#include <stdint.h>
typedef struct Image *Image_T;
/*
* Create a new image of the given width and height.
* Parameters
* const size_t width - width of the image
* const size_t height - height of the image
* Returns
* (Image_T) pointer to the Image object (or NULL on memory exhaustion)
*/
Image_T Image_new(const size_t width, const size_t height);
/*
* Create an image from a file.
* Parameters
* const char *path - path of the file
* Returns
* (Image_T) pointer to image object (or NULL on memory exhaustion)
*/
Image_T Image_fromFile(const char *path);
/*
* Free the image.
* Parameters
* Image_T image - image to free
*/
void Image_free(Image_T image);
/*
* Get the width of an image.
* Parameters
* const Image_T image - image to get width of
* Returns
* (size_t) width of the image
*/
size_t Image_getWidth(const Image_T image);
/*
* Get the height of an image.
* Parameters
* const Image_T image - image to get height of
* Returns
* (size_t) height of the image
*/
size_t Image_getHeight(const Image_T image);
/*
* Get the size of an image.
* Parameters
* const Image_T image - image to get size of
* Returns
* (size_t) size of the image
*/
size_t Image_getSize(const Image_T image);
/*
* Set the RGB color of the pixel in the image.
* Parameters
* const Image_T image - image to set the pixel of
* const size_t row - row of the pixel
* const size_t col - column of the pixel
* const uint8_t red - red value of the color
* const uint8_t green - green value of the color
* const uint8_t blue - blue value of the color
*/
void Image_setPixel(const Image_T image, const size_t row, const size_t col,
const uint8_t red, const uint8_t green, const uint8_t blue);
/*
* Calculate the difference of the two images. The returned value is
* the number of differences detected.
* Parameters
* const Image_T image - primary image
* const Image_T other - secondary image
* Returns
* (size_t) difference count
*/
size_t Image_diff(const Image_T image, const Image_T other);
/*
* Save the image to a file.
* Parameters
* const Image_t image - image to save
* const char *path - path of the file to save the image to
* Returns
* (bool) true on success, false on failure
*/
bool Image_save(const Image_T image, const char *path);
#endif
|
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include "utf8_test.h"
#include <utf8.h>
#include <stdlib.h>
#include <errno.h>
struct character {
uint32_t codepoint;
struct character *next;
};
struct output {
struct character *head;
struct character *tail;
};
void test_utf8_callback(uint32_t character, void *data)
{
struct output *output = data;
struct character *c = malloc(sizeof(struct character));
c->codepoint = character;
c->next = NULL;
if (output->head == NULL) {
output->head = c;
output->tail = c;
} else {
output->tail->next = c;
output->tail = c;
}
}
int test_utf8_compare(const struct character *cs, uint32_t *codepoints, int length)
{
uint32_t *end = codepoints + length;
while (cs != NULL && codepoints < end) {
if (cs->codepoint != *codepoints)
return cs->codepoint - *codepoints;
cs = cs->next;
codepoints++;
}
if (cs)
return 1;
else if (codepoints < end)
return -1;
else
return 0;
}
void test_utf8_single_byte()
{
int ret;
uint32_t codepoints[] = { '\x00', 'F', 'a', 'b', 'i', 'a', 'n', '\x7F' };
struct output output = {
.head = NULL,
.tail = NULL
};
fab_utf8_t utf8 = fab_utf8_create(test_utf8_callback, &output);
ck_assert(utf8 != NULL);
ret = 0;
ret |= fab_utf8_process(utf8, '\x00');
ret |= fab_utf8_process(utf8, 'F');
ret |= fab_utf8_process(utf8, 'a');
ret |= fab_utf8_process(utf8, 'b');
ret |= fab_utf8_process(utf8, 'i');
ret |= fab_utf8_process(utf8, 'a');
ret |= fab_utf8_process(utf8, 'n');
ret |= fab_utf8_process(utf8, '\x7F');
ck_assert(!ret);
fab_utf8_destroy(utf8);
ck_assert_int_eq(0, test_utf8_compare(output.head, codepoints, 8));
while (output.head != NULL) {
struct character *next = output.head->next;
free(output.head);
output.head = next;
}
}
void test_utf8_invalid_byte()
{
int ret;
struct output output = {
.head = NULL,
.tail = NULL
};
fab_utf8_t utf8 = fab_utf8_create(test_utf8_callback, &output);
ck_assert(utf8 != NULL);
ret = fab_utf8_process(utf8, '\xFF');
ck_assert(ret);
ck_assert_int_eq(EINVAL, errno);
fab_utf8_destroy(utf8);
ck_assert_ptr_eq(NULL, output.head);
while (output.head != NULL) {
struct character *next = output.head->next;
free(output.head);
output.head = next;
}
}
Suite *utf8_test_suite()
{
Suite *s;
TCase *tc_single_byte, *tc_invalid;;
s = suite_create("utf8");
/* single byte test case */
tc_single_byte = tcase_create("single_byte");
tcase_add_test(tc_single_byte, test_utf8_single_byte);
suite_add_tcase(s, tc_single_byte);
/* invalid input */
tc_invalid = tcase_create("invalid");
tcase_add_test(tc_invalid, test_utf8_invalid_byte);
suite_add_tcase(s, tc_invalid);
return s;
}
|
/*====================================================================
* Project: Board Support Package (BSP)
* Developed using:
* Function: TriBoard-TC1920 platform specific setup values
*
* Copyright HighTec EDV-Systeme GmbH 1982-2008
*====================================================================*/
#ifndef __TRIBOARD_SETUP_H__
#define __TRIBOARD_SETUP_H__
#include "tc1920/scu/addr.h"
#include "tc1920/ebu/addr.h"
#include "tc1920/pmu/addr.h"
/* initialization value for PLLCLC : set clock to 96 MHz */
#define VAL_PLLCLC 0x010F0144
/* initialization values for External Bus */
#define VAL_EBU_CON 0x00F9FF68
#define VAL_EBU_BFCON 0x00000053
#define VAL_EBU_ADDRSEL0 0xA4000051
#define VAL_EBU_BUSCON0 0x00860000
#define VAL_EBU_BUSAP0 0x23FF0100
#define VAL_EBU_ADDRSEL1 0xA0000031
#define VAL_EBU_BUSCON1 0x30B20000
#define VAL_EBU_BUSAP1 0x00000000
#define VAL_EBU_ADDRSEL2 0xA2000021
#define VAL_EBU_BUSCON2 0x30B20000
#define VAL_EBU_BUSAP2 0x00000000
#define VAL_EBU_SDRMCON0 0x01161075
#define VAL_EBU_SDRMMOD0 0x00000023
#define VAL_EBU_SDRMREF0 0x000000CB
#define VAL_EBU_SDRMCON1 0x01162075
#define VAL_EBU_SDRMMOD1 0x00000023
#define VAL_EBU_SDRMREF1 0x000000CB
#define VAL_EBU_ADDRSEL3 0x00000001
#define VAL_EBU_BUSCON3 0x80415FFF
#define VAL_EBU_BUSAP3 0x22070000
#ifdef ENABLE_ICACHE
/* enable instruction cache */
#define VAL_PMU_CON0 0x00000000
#else
/* disable instruction cache */
#define VAL_PMU_CON0 0x00000002
#endif /* ENABLE_ICACHE */
#endif /* __TRIBOARD_SETUP_H__ */
|
/**
* KQOAuth - An OAuth authentication library for Qt.
*
* Author: Johan Paul (johan.paul@d-pointer.com)
* http://www.d-pointer.com
*
* KQOAuth 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.
*
* KQOAuth 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 KQOAuth. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KQOAUTHMANAGER_P_H
#define KQOAUTHMANAGER_P_H
#include "kqoauthauthreplyserver.h"
#include "kqoauthrequest.h"
class KQOAUTH_EXPORT KQOAuthManagerPrivate {
public:
KQOAuthManagerPrivate(KQOAuthManager *parent);
~KQOAuthManagerPrivate();
QList< QPair<QString, QString> > createQueryParams(const KQOAuthParameters &requestParams);
QMultiMap<QString, QString> createTokensFromResponse(QByteArray reply);
bool setSuccessfulRequestToken(const QMultiMap<QString, QString> &request);
bool setSuccessfulAuthorized(const QMultiMap<QString, QString> &request);
void emitTokens();
bool setupCallbackServer();
KQOAuthManager::KQOAuthError error;
KQOAuthRequest *r; // This request is used to cache the user sent request.
KQOAuthRequest *opaqueRequest; // This request is used to creating opaque convenience requests for the user.
KQOAuthManager * const q_ptr;
/**
* The items below are needed in order to store the state of the manager and
* by that be able to do convenience operations for the user.
*/
KQOAuthRequest::RequestType currentRequestType;
// Variables we store here for opaque request handling.
// NOTE: The variables are labeled the same for both access token request
// and protected resource access.
QString requestToken;
QString requestTokenSecret;
QString consumerKey;
QString consumerKeySecret;
QString requestVerifier;
KQOAuthAuthReplyServer *callbackServer;
bool hasTemporaryToken;
bool isVerified;
bool isAuthorized;
bool autoAuth;
QNetworkAccessManager *networkManager;
bool managerUserSet;
QMap<QNetworkReply*, int> requestIds;
Q_DECLARE_PUBLIC(KQOAuthManager);
};
#endif // KQOAUTHMANAGER_P_H
|
#ifndef APP_HELP_H_
#define APP_HELP_H_
void papp_help_set_header(const char* string);
void papp_help_set_footer(const char* string);
void papp_help_show();
#endif
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5TA.h"
#include <stdlib.h>
/*-------------------------------------------------------------------------
* Table API example
*
* H5TBget_table_info
*
*-------------------------------------------------------------------------
*/
#define NFIELDS (hsize_t) 5
#define NRECORDS (hsize_t) 8
#define TABLE_NAME "table"
int main( void )
{
typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
double temperature;
} Particle;
/* Calculate the size and the offsets of our struct members in memory */
size_t dst_size = sizeof( Particle );
size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
HOFFSET( Particle, lati ),
HOFFSET( Particle, longi ),
HOFFSET( Particle, pressure ),
HOFFSET( Particle, temperature )};
/* Define field information */
const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
Particle fill_data[1] =
{ {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
int compress = 0;
hsize_t nfields_out;
hsize_t nrecords_out;
herr_t status;
/* Initialize field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
field_type[0] = string_type;
field_type[1] = H5T_NATIVE_INT;
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_06.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* Make a table */
status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size,
field_names, dst_offset, field_type,
chunk_size, fill_data, compress, NULL);
/* Get table info */
status=H5TBget_table_info (file_id,TABLE_NAME, &nfields_out, &nrecords_out );
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
/* close type */
H5Tclose( string_type );
/* close the file */
H5Fclose( file_id );
return 0;
}
|
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player 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.
*
* EasyRPG Player 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 EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SCENE_BATTLE_RPG2K3_H_
#define _SCENE_BATTLE_RPG2K3_H_
// Headers
#include "scene_battle.h"
#include "async_handler.h"
/**
* Scene_Battle class.
* Manages the battles.
*/
class Scene_Battle_Rpg2k3 : public Scene_Battle {
public:
Scene_Battle_Rpg2k3();
~Scene_Battle_Rpg2k3() override;
void Update() override;
protected:
void OnSystem2Ready(FileRequestResult* result);
void CreateUi() override;
void CreateBattleTargetWindow();
void CreateBattleCommandWindow();
void UpdateCursors();
void DrawFloatText(int x, int y, int color, const std::string& text);
void RefreshCommandWindow();
void SetState(Scene_Battle::State new_state) override;
bool CheckWin();
bool CheckLose();
bool CheckResultConditions();
void ProcessActions() override;
bool ProcessBattleAction(Game_BattleAlgorithm::AlgorithmBase* action);
void ProcessInput() override;
void OptionSelected();
void CommandSelected();
void AttackSelected() override;
void SubskillSelected();
void SpecialSelected();
void Escape();
void SelectNextActor();
void ActionSelectedCallback(Game_Battler* for_battler) override;
void ShowNotification(const std::string& text);
std::unique_ptr<Sprite> ally_cursor, enemy_cursor;
struct FloatText {
std::shared_ptr<Sprite> sprite;
int remaining_time = 30;
};
std::vector<FloatText> floating_texts;
int battle_action_wait;
int battle_action_state;
bool battle_action_need_event_refresh = true;
int combo_repeat = 1;
bool play_reflected_anim = false;
std::unique_ptr<Window_BattleStatus> enemy_status_window;
std::vector<Game_Battler*> targets;
int select_target_flash_count = 0;
FileRequestBinding request_id;
};
#endif
|
/**
Project: HT3Gateway
File: main.c
Summary: Implements the main class
Copyright (c) 2016 DeepCore Systems
Date Developer Change
2016-12-23 Philippe Devaux Created
**/
#include <asf.h>
int main (void)
{
system_init();
/* Insert application code here, after the board has been initialized. */
}
|
/*
Copyright (C) 2013 Erik Ogenvik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TERRAINPAGEDELETIONTASK_H_
#define TERRAINPAGEDELETIONTASK_H_
#include "framework/tasks/TemplateNamedTask.h"
#include <memory>
namespace Ember {
namespace OgreView {
namespace Terrain {
class TerrainPage;
/**
* @brief Deletes a page on the main thread.
*
* This task only deletes a page. The reason for having it as a task is that we want to make sure no other tasks
* are using the page when it's deleted.
*/
class TerrainPageDeletionTask : public Tasks::TemplateNamedTask<TerrainPageDeletionTask> {
public:
explicit TerrainPageDeletionTask(std::unique_ptr<TerrainPage> page);
~TerrainPageDeletionTask() override;
void executeTaskInBackgroundThread(Tasks::TaskExecutionContext& context) override;
bool executeTaskInMainThread() override;
private:
std::unique_ptr<TerrainPage> mPage;
};
}
}
}
#endif /* TERRAINPAGEDELETIONTASK_H_ */
|
/* html/utility/piece_grep.c */
/* ------------------------- */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "timlib.h"
#include "piece.h"
int main( int argc, char **argv )
{
int piece_offset;
int delimiter;
char *pattern_to_search;
char input_buffer[ 65536 ];
boolean grep_exclude = 0;
if ( argc < 4 )
{
fprintf(
stderr,
"Usage: %s delimiter offset search_1[,search_n] [-v]\n",
argv[ 0 ] );
exit( 1 );
}
delimiter = *argv[ 1 ];
piece_offset = atoi( argv[ 2 ] );
pattern_to_search = argv[ 3 ];
if ( argc == 5 && strcmp( argv[ 4 ], "-v" ) == 0 )
{
grep_exclude = 1;
}
while( get_line( input_buffer, stdin ) )
{
if ( piece_grep( input_buffer,
delimiter,
pattern_to_search,
piece_offset,
grep_exclude ) )
{
printf( "%s\n", input_buffer );
}
}
return 0;
} /* main() */
#ifdef NOT_DEFINED
piece_grep( delimiter, piece_offset, pattern_to_search, output_if_non_exists )
int delimiter;
int piece_offset;
char *pattern_to_search;
int output_if_non_exists;
{
char buffer[ 1024 ];
char p_buffer[ 128 ];
while( get_line( buffer, stdin ) )
{
if ( ! piece( p_buffer, delimiter, buffer, piece_offset ) )
{
fprintf( stderr,
"piece_grep.e: cannot get piece: %d\n(%s)\n",
piece_offset,
buffer );
continue;
}
if ( output_if_non_exists )
{
if ( !pattern_exists( pattern_to_search,
p_buffer ) )
{
printf( "%s\n", buffer );
}
}
else
{
if ( pattern_exists( pattern_to_search,
p_buffer ) )
{
printf( "%s\n", buffer );
}
}
}
} /* piece_grep() */
pattern_exists( pattern_to_search, search_this )
char *pattern_to_search, *search_this;
{
char piece_buffer[ 128 ];
int i;
for( i = 0; piece( piece_buffer, ',', pattern_to_search, i ); i++ )
{
if ( strcmp( piece_buffer, search_this ) == 0 )
return 1;
}
return 0;
} /* pattern_exists() */
#endif
|
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (label_sanitization.c).
* ---------------------------------------------------------------------------------------
*
* 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 <playlists/label_sanitization.h>
#include <compat/strl.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include <string.h>
#define DISC_STRINGS_LENGTH 3
#define REGION_STRINGS_LENGTH 20
const char *disc_strings[DISC_STRINGS_LENGTH] = {
"(CD",
"(Disc",
"(Disk"
};
/*
* We'll use the standard No-Intro regions for now.
*/
const char *region_strings[REGION_STRINGS_LENGTH] = {
"(Australia)", /* Don’t use with Europe */
"(Brazil)",
"(Canada)", /* Don’t use with USA */
"(China)",
"(France)",
"(Germany)",
"(Hong Kong)",
"(Italy)",
"(Japan)",
"(Korea)",
"(Netherlands)",
"(Spain)",
"(Sweden)",
"(USA)", /* Includes Canada */
"(World)",
"(Europe)", /* Includes Australia */
"(Asia)",
"(Japan, USA)",
"(Japan, Europe)",
"(USA, Europe)"
};
/*
* Does not work with nested blocks.
*/
void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
{
bool copy = true;
int rindex = 0;
int lindex = 0;
char new_label[PATH_MAX_LENGTH];
for (; lindex < PATH_MAX_LENGTH && label[lindex] != '\0'; lindex++)
{
if (copy)
{
/* check for the start of the range */
if ((*left)(&label[lindex]))
copy = false;
if (copy)
new_label[rindex++] = label[lindex];
}
else if ((*right)(&label[lindex]))
copy = true;
}
new_label[rindex] = '\0';
strlcpy(label, new_label, PATH_MAX_LENGTH);
}
static bool left_parens(char *left)
{
return left[0] == '(';
}
static bool right_parens(char *right)
{
return right[0] == ')';
}
static bool left_brackets(char *left)
{
return left[0] == '[';
}
static bool right_brackets(char *right)
{
return right[0] == ']';
}
static bool left_parens_or_brackets(char *left)
{
return left[0] == '(' || left[0] == '[';
}
static bool right_parens_or_brackets(char *right)
{
return right[0] == ')' || right[0] == ']';
}
static bool left_exclusion(char *left,
const char **strings, const size_t strings_count)
{
unsigned i;
char exclusion_string[32];
char comparison_string[32];
strlcpy(exclusion_string, left, sizeof(exclusion_string));
string_to_upper(exclusion_string);
for (i = 0; i < (unsigned)strings_count; i++)
{
strlcpy(comparison_string, strings[i], sizeof(comparison_string));
string_to_upper(comparison_string);
if (string_is_equal(exclusion_string,
comparison_string))
return true;
}
return false;
}
static bool left_parens_or_brackets_excluding_region(char *left)
{
return left_parens_or_brackets(left)
&& !left_exclusion(left, region_strings, REGION_STRINGS_LENGTH);
}
static bool left_parens_or_brackets_excluding_disc(char *left)
{
return left_parens_or_brackets(left)
&& !left_exclusion(left, disc_strings, DISC_STRINGS_LENGTH);
}
static bool left_parens_or_brackets_excluding_region_or_disc(char *left)
{
return left_parens_or_brackets(left)
&& !left_exclusion(left, region_strings, REGION_STRINGS_LENGTH)
&& !left_exclusion(left, disc_strings, DISC_STRINGS_LENGTH);
}
void label_remove_parens(char *label)
{
label_sanitize(label, left_parens, right_parens);
}
void label_remove_brackets(char *label)
{
label_sanitize(label, left_brackets, right_brackets);
}
void label_remove_parens_and_brackets(char *label)
{
label_sanitize(label, left_parens_or_brackets,
right_parens_or_brackets);
}
void label_keep_region(char *label)
{
label_sanitize(label, left_parens_or_brackets_excluding_region,
right_parens_or_brackets);
}
void label_keep_disc(char *label)
{
label_sanitize(label, left_parens_or_brackets_excluding_disc,
right_parens_or_brackets);
}
void label_keep_region_and_disc(char *label)
{
label_sanitize(label, left_parens_or_brackets_excluding_region_or_disc,
right_parens_or_brackets);
}
|
/*
* Copyright 2011-2015 Formal Methods and Tools, University of Twente
*
* 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.
*/
/**
* Sylvan: parallel BDD/ListDD package.
*
* This is a multi-core implementation of BDDs with complement edges.
*
* This package requires parallel the work-stealing framework Lace.
* Lace must be initialized before initializing Sylvan
*
* This package uses explicit referencing.
* Use sylvan_ref and sylvan_deref to manage external references.
*
* Garbage collection requires all workers to cooperate. Garbage collection is either initiated
* by the user (calling sylvan_gc) or when the nodes table is full. All Sylvan operations
* check whether they need to cooperate on garbage collection. Garbage collection cannot occur
* otherwise. This means that it is perfectly fine to do this:
* BDD a = sylvan_ref(sylvan_and(b, c));
* since it is not possible that garbage collection occurs between the two calls.
*
* To temporarily disable garbage collection, use sylvan_gc_disable() and sylvan_gc_enable().
*/
#include <sylvan_config.h>
#include <stdint.h>
#include <stdio.h> // for FILE
#include <lace.h> // for definitions
#include <cache.h>
#include <llmsset.h>
#include <stats.h>
#ifndef SYLVAN_H
#define SYLVAN_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef SYLVAN_SIZE_FIBONACCI
#define SYLVAN_SIZE_FIBONACCI 0
#endif
// For now, only support 64-bit systems
typedef char __sylvan_check_size_t_is_8_bytes[(sizeof(uint64_t) == sizeof(size_t))?1:-1];
/**
* Initialize the Sylvan parallel decision diagrams package.
*
* After initialization, call sylvan_init_bdd and/or sylvan_init_ldd if you want to use
* the BDD and/or LDD functionality.
*
* BDDs and LDDs share a common node table and operations cache.
*
* The node table is resizable.
* The table is resized automatically when >50% of the table is filled during garbage collection.
* This behavior can be customized by overriding the gc hook.
*
* Memory usage:
* Every node requires 24 bytes memory. (16 bytes data + 8 bytes overhead)
* Every operation cache entry requires 36 bytes memory. (32 bytes data + 4 bytes overhead)
*
* Reasonable defaults: datasize of 1L<<26 (2048 MB), cachesize of 1L<<25 (1152 MB)
*/
void sylvan_init_package(size_t initial_tablesize, size_t max_tablesize, size_t initial_cachesize, size_t max_cachesize);
/**
* Frees all Sylvan data (also calls the quit() functions of BDD/MDD parts)
*/
void sylvan_quit();
/**
* Return number of occupied buckets in nodes table and total number of buckets.
*/
VOID_TASK_DECL_2(sylvan_table_usage, size_t*, size_t*);
#define sylvan_table_usage(filled, total) (CALL(sylvan_table_usage, filled, total))
/**
* Perform garbage collection.
*
* Garbage collection is performed in a new Lace frame, interrupting all ongoing work
* until garbage collection is completed.
*
* Garbage collection procedure:
* 1) The operation cache is cleared and the hash table is reset.
* 2) All live nodes are marked (to be rehashed). This is done by the "mark" callbacks.
* 3) The "hook" callback is called.
* By default, this doubles the hash table size when it is >50% full.
* 4) All live nodes are rehashed into the hash table.
*
* The behavior of garbage collection can be customized by adding "mark" callbacks and
* replacing the "hook" callback.
*/
VOID_TASK_DECL_0(sylvan_gc);
#define sylvan_gc() (CALL(sylvan_gc))
/**
* Enable or disable garbage collection.
*
* This affects both automatic and manual garbage collection, i.e.,
* calling sylvan_gc() while garbage collection is disabled does not have any effect.
*/
void sylvan_gc_enable();
void sylvan_gc_disable();
/**
* Add a "mark" callback to the list of callbacks.
*
* These are called during garbage collection to recursively mark nodes.
*
* Default "mark" functions that mark external references (via sylvan_ref) and internal
* references (inside operations) are added by sylvan_init_bdd/sylvan_init_bdd.
*
* Functions are called in order.
* level 10: marking functions of Sylvan (external/internal references)
* level 20: call the hook function (for resizing)
* level 30: rehashing
*/
LACE_TYPEDEF_CB(void, gc_mark_cb);
void sylvan_gc_add_mark(int order, gc_mark_cb callback);
/**
* Set "hook" callback. There can be only one.
*
* The hook is called after the "mark" phase and before the "rehash" phase.
* This allows users to perform certain actions, such as resizing the nodes table
* and the operation cache. Also, dynamic resizing could be performed then.
*/
LACE_TYPEDEF_CB(void, gc_hook_cb);
void sylvan_gc_set_hook(gc_hook_cb new_hook);
/**
* One of the hooks for resizing behavior.
* Default if SYLVAN_AGGRESSIVE_RESIZE is set.
* Always double size on gc() until maximum reached.
*/
VOID_TASK_DECL_0(sylvan_gc_aggressive_resize);
/**
* One of the hooks for resizing behavior.
* Default if SYLVAN_AGGRESSIVE_RESIZE is not set.
* Double size on gc() whenever >50% is used.
*/
VOID_TASK_DECL_0(sylvan_gc_default_hook);
/**
* Set "notify on dead" callback for the nodes table.
* See also documentation in llmsset.h
*/
#define sylvan_set_ondead(cb, ctx) llmsset_set_ondead(nodes, cb, ctx)
/**
* Global variables (number of workers, nodes table)
*/
extern llmsset_t nodes;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <sylvan_bdd.h>
#include <sylvan_ldd.h>
#include <sylvan_mtbdd.h>
#endif
|
/*
* Copyright (c) 2000, 2001, 2003-2005, 2008-2011, 2013, 2015-2017, 2019 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Modification History
*
* June 1, 2001 Allan Nathanson <ajn@apple.com>
* - public API conversion
*
* April 5, 2000 Allan Nathanson <ajn@apple.com>
* - initial revision
*/
#include "SCDynamicStoreInternal.h"
#include "config.h" /* MiG generated file */
#include <paths.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
Boolean
SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef store,
int32_t identifier,
int *fd)
{
int fildes[2] = { -1, -1 };
fileport_t fileport = MACH_PORT_NULL;
int ret;
int sc_status;
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
kern_return_t status;
if (store == NULL) {
/* sorry, you must provide a session */
_SCErrorSet(kSCStatusNoStoreSession);
return FALSE;
}
if (storePrivate->server == MACH_PORT_NULL) {
/* sorry, you must have an open session to play */
_SCErrorSet(kSCStatusNoStoreServer);
return FALSE;
}
if (storePrivate->notifyStatus != NotifierNotRegistered) {
/* sorry, you can only have one notification registered at once */
_SCErrorSet(kSCStatusNotifierActive);
return FALSE;
}
ret = pipe(fildes);
if (ret == -1) {
_SCErrorSet(errno);
SC_log(LOG_ERR, "pipe() failed: %s", strerror(errno));
goto fail;
}
/*
* send fildes[1], the sender's fd, to configd using a fileport and
* return fildes[0] to the caller.
*/
fileport = MACH_PORT_NULL;
ret = fileport_makeport(fildes[1], &fileport);
if (ret < 0) {
_SCErrorSet(errno);
SC_log(LOG_ERR, "fileport_makeport() failed: %s", strerror(errno));
goto fail;
}
retry :
status = notifyviafd(storePrivate->server,
fileport,
identifier,
(int *)&sc_status);
if (__SCDynamicStoreCheckRetryAndHandleError(store,
status,
&sc_status,
"SCDynamicStoreNotifyFileDescriptor notifyviafd()")) {
goto retry;
}
if (status != KERN_SUCCESS) {
_SCErrorSet(status);
goto fail;
}
if (sc_status != kSCStatusOK) {
_SCErrorSet(sc_status);
goto fail;
}
/* the SCDynamicStore server now has a copy of the write side, close our reference */
(void) close(fildes[1]);
/* and keep the read side */
*fd = fildes[0];
/* set notifier active */
storePrivate->notifyStatus = Using_NotifierInformViaFD;
return TRUE;
fail :
if (fildes[0] != -1) close(fildes[0]);
if (fildes[1] != -1) close(fildes[1]);
return FALSE;
}
|
//
// MFStockholmImporter.h
// Seqotron
//
// Created by Mathieu on 3/12/2014.
// Copyright (c) 2014 Mathieu Fourment. All rights reserved.
//
// This file is part of Seqotron.
//
// Seqotron 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.
//
// Seqotron is distributed in the hope that it will be useful,
// but Seqotron 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 Seqotron. If not, see <http://www.gnu.org/licenses/>.
//
#import <Foundation/Foundation.h>
#import "MFSequenceImporter.h"
@interface MFStockholmImporter : NSObject <MFSequenceImporter>{
}
@end |
/****************************************************************************
**
** Copyright (C) 2014 Kurt Pattyn <pattyn.kurt@gmail.com>.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWebSockets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSSLSERVER_P_H
#define QSSLSERVER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QSslError>
#include <QtNetwork/QSslConfiguration>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QSslServer : public QTcpServer
{
Q_OBJECT
Q_DISABLE_COPY(QSslServer)
public:
explicit QSslServer(QObject *parent = Q_NULLPTR);
virtual ~QSslServer();
void setSslConfiguration(const QSslConfiguration &sslConfiguration);
QSslConfiguration sslConfiguration() const;
Q_SIGNALS:
void sslErrors(const QList<QSslError> &errors);
void peerVerifyError(const QSslError &error);
void newEncryptedConnection();
protected:
virtual void incomingConnection(qintptr socket);
private:
QSslConfiguration m_sslConfiguration;
};
QT_END_NAMESPACE
#endif // QSSLSERVER_P_H
|
/*
* Sensore.h
*
* Created on: 26 apr 2016
* Author: peppe
*/
#ifndef SENSORE_H_
#define SENSORE_H_
#include "Arduino.h"
enum znZone {znTotale, znPerimetrale, znInterno};
enum statoSensore {sensNonAttivo, sensAttivo, sensDisabilitato, sensTempDisabilitato, sensTrigged, sensMalfunzionamento};
enum tipoSensore {tpReed, tpPIR, tpSirena, tpTamper};
class Sensore{
protected:
uint8_t pin;
tipoSensore tipo;
statoSensore stato;
byte logica;
String messaggio;
uint8_t conta;
boolean ritardato;
znZone zona;
public:
Sensore(int p, tipoSensore tipo, byte logica, const String msg, znZone zona, boolean rit);
virtual ~Sensore();
uint8_t getPin(){return this->pin;};
void setPin(uint8_t p){this->pin=p;};
tipoSensore getTipo(){return this->tipo;};
void setTipo(tipoSensore tipo){this->tipo=tipo;};
statoSensore getStato(){return this->stato;};
void setStato(statoSensore a){this->stato=a;};
byte getLogica(){return this->logica;};
void setLogica(byte logica){this->logica=logica;};
String getMessaggio(){return this->messaggio;};
void setMessaggio(String m){this->messaggio=m;};
uint8_t getConta(){return this->conta;};
void setConta(uint8_t conta){this->conta=conta;};
boolean getRitardato(){return this->ritardato;};
void setRitardato(boolean m){this->ritardato=m;};
znZone getZona(){return this->zona;};
void setZona(znZone z){this->zona=z;};
};
#endif /* SENSORE_H_ */
|
/*
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 <Foundation/Foundation.h>
@interface MKTransitDepartureServiceGapFormatterResult : NSObject
@end
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <AK/OwnPtr.h>
#include <AK/SinglyLinkedList.h>
#include <AK/Vector.h>
namespace AK {
template<typename T, int segment_size = 1000>
class Queue {
public:
Queue() { }
~Queue() { }
size_t size() const { return m_size; }
bool is_empty() const { return m_size == 0; }
void enqueue(T&& value)
{
if (m_segments.is_empty() || m_segments.last()->size() >= segment_size)
m_segments.append(make<Vector<T, segment_size>>());
m_segments.last()->append(move(value));
++m_size;
}
void enqueue(const T& value)
{
enqueue(T(value));
}
T dequeue()
{
ASSERT(!is_empty());
auto value = move((*m_segments.first())[m_index_into_first++]);
if (m_index_into_first == segment_size) {
m_segments.take_first();
m_index_into_first = 0;
}
--m_size;
return value;
}
const T& head() const
{
ASSERT(!is_empty());
return (*m_segments.first())[m_index_into_first];
}
void clear()
{
m_segments.clear();
m_index_into_first = 0;
m_size = 0;
}
private:
SinglyLinkedList<OwnPtr<Vector<T, segment_size>>> m_segments;
size_t m_index_into_first { 0 };
size_t m_size { 0 };
};
}
using AK::Queue;
|
/*
===========================================================================
ARX FATALIS GPL Source Code
Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code. If not, see
<http://www.gnu.org/licenses/>.
In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include <ARX_Common.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PAK_VERSION ((1<<16)|0)
#define MAX_FILES 1024
#define EMPTY_CLUSTER "___EMPTY___"
class CCluster{
public:
int iTaille;
int iNext;
CCluster *pNext;
public:
CCluster(int _iTaille=0);
~CCluster();
};
class CInfoFile{
public:
char *pcFileName;
int iTaille;
int iNbCluster;
CCluster FirstCluster;
CCluster* pLastCluster;
public:
void Set(char *_pcFileName,int _iTaille);
void KillAll();
};
class CHachageString;
class CSaveBlock{
private:
FILE *hFile;
int iTailleBlock;
int iNbFiles;
bool bReWrite;
CInfoFile * sInfoFile;
bool bFirst;
int iVersion;
bool ExpandNbFiles();
CHachageString* pHachage;
public:
char *pcBlockName;
CSaveBlock(char *_pcBlockName=NULL);
~CSaveBlock();
bool Defrag();
bool BeginSave(bool _bCont,bool _bReWrite);
bool EndSave(void);
bool Save(char *_pcFileName,void *_pDatas,int _iSize);
bool BeginRead(void);
void EndRead(void);
bool Read(char *_pcFileName,char *_pPtr);
int GetSize(char *_pcFileName);
bool ExistFile(char *_pcFileName);
void ResetFAT(void);
};
|
/**
* \file
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SAM4CP_0_
#define _SAM4CP_0_
#if defined __SAM4CP16B_0__
#include "sam4cp16b_0.h"
#else
#error Library does not support the specified device.
#endif
#endif /* _SAM4CP_0_ */
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gdbm.h>
/* application includes */
#include "storage.h"
static const char * db_name = ".footin.db";
#define datum_set(um, buf) { um.dptr = buf; um.dsize = strlen(buf); }
char * get_db_path()
{
int MAX_PATH = 256;
char path[MAX_PATH];
snprintf(path, MAX_PATH, "%s/%s", getenv("HOME"), db_name);
return strdup(path);
}
int db_count()
{
GDBM_FILE dbf;
dbf = gdbm_open(get_db_path(), 0, GDBM_READER, 0, NULL);
if (!dbf) {
//printf("%s\n", gdbm_strerror(gdbm_errno));
return 0;
}
datum key, next;
int n = 0;
key = gdbm_firstkey(dbf);
while (key.dptr) {
n++;
next = gdbm_nextkey(dbf, key);
free(key.dptr);
key = next;
}
gdbm_close(dbf);
return n;
}
char ** db_all_keys(int count)
{
GDBM_FILE dbf;
dbf = gdbm_open(get_db_path(), 0, GDBM_READER, 0, NULL);
if (!dbf) {
//printf("%s\n", gdbm_strerror(gdbm_errno));
return NULL;
}
// resize keys container according to the number of records
char ** keys = (char **)malloc(count * sizeof(char*));
// allocate space for each string
for (int i = 0; i < count; i++) {
keys[i] = (char*)malloc(2 * sizeof(char) + 1);
}
// get all keys
datum key, next;
int n = 0;
key = gdbm_firstkey(dbf);
while (key.dptr) {
strcpy(keys[n], key.dptr); // assign value
next = gdbm_nextkey(dbf, key);
free(key.dptr);
key = next;
n++;
}
gdbm_close(dbf);
return keys;
}
int db_ls()
{
GDBM_FILE dbf;
dbf = gdbm_open(get_db_path(), 0, GDBM_READER, 0, NULL);
if (!dbf) {
printf("%s\n", gdbm_strerror(gdbm_errno));
return 1;
}
datum key, next, data;
int n = 1;
key = gdbm_firstkey(dbf);
while (key.dptr) {
data = gdbm_fetch(dbf, key);
printf("(%d) %s:\t%s\n", n++, key.dptr, data.dptr);
next = gdbm_nextkey(dbf, key);
free(key.dptr);
key = next;
}
gdbm_close(dbf);
return 0;
}
int db_rm(char keyb[2])
{
GDBM_FILE dbf;
datum key;
dbf = gdbm_open(get_db_path(), 0, GDBM_WRITER, 0, NULL);
if (!dbf) {
//printf("%s\n", gdbm_strerror(gdbm_errno));
return 1;
}
key.dptr = keyb; key.dsize = strlen(keyb);
if (gdbm_delete(dbf, key)) {
//printf("%s\n", gdbm_strerror(gdbm_errno));
gdbm_close(dbf);
return 1;
}
gdbm_close(dbf);
return 0;
}
int db_add(char * keyb)
{
GDBM_FILE dbf;
datum key, data;
if (!(dbf = gdbm_open(get_db_path(), 0, GDBM_WRCREAT, 0644, NULL))) {
//printf("%s\n", gdbm_strerror(gdbm_errno));
return 1;
}
datum_set(key, keyb);
datum_set(data, keyb);
if (gdbm_store(dbf, key, data, GDBM_INSERT)) {
//printf("%s\nRecord may be exist.\n", gdbm_strerror(gdbm_errno));
gdbm_close(dbf);
return 1;
}
gdbm_close(dbf);
return 0;
}
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtrim_char.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jpirsch <jpirsch@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/11 04:29:57 by jpirsch #+# #+# */
/* Updated: 2015/01/10 04:36:02 by jpirsch ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
static char *ft_strcleaner(const char *s, size_t startblanks, size_t endblanks)
{
char *str;
size_t size;
size_t i;
i = 0;
if (!startblanks && !endblanks)
return ((char*)s);
else
size = ft_strlen((char *)s) - startblanks - endblanks + 1;
if (!(str = ft_strnew(size + 1)))
return (NULL);
while (*s == ' ' || *s == '\n' || *s == '\t')
s++;
while (*s && i < size - 1)
{
str[i] = *s;
s++;
i++;
}
str[i] = '\0';
return (str);
}
static char *ft_countblanks(const char *s, size_t loops, size_t slen, char c)
{
size_t startblanks;
size_t endblanks;
startblanks = 0;
endblanks = 0;
while (*s)
{
while (loops == 0 && *s == c)
{
s++;
startblanks++;
}
if (*s != c)
{
loops = 1;
endblanks = 0;
s++;
}
while (*s == c)
{
endblanks++;
s++;
}
}
return (ft_strcleaner(s - slen, startblanks, endblanks));
}
char *ft_strtrim_char(const char *s, char c)
{
char *str;
if (!s)
return (NULL);
if (!(str = ft_countblanks(s, 0, ft_strlen((char*)s), c)))
return (NULL);
return (str);
}
|
!#define TIMER_CPU_TIME
#define TIMER_F90_EPTIME
!// if not using openmp, can't use the openmp timer
#if !defined(_OPENMP) && defined(TIMER_OMP_GET_WTIME)
# undef TIMER_OMP_GET_WTIME
!#define TIMER_CPU_TIME
# define TIMER_F90_EPTIME
#endif
#if defined(TIMER_F90_EPTIME)
# define TSTART(x) x=epelapsedtime()
# define TSTOP(x) x=epelapsedtime()
# define TSTAMP(x) x=epelapsedtime()
#elif defined(TIMER_CPU_TIME)
# define TSTART(x) call CPU_TIME(x)
# define TSTOP(x) call CPU_TIME(x)
# define TSTAMP(x) call CPU_TIME(x)
#elif defined(TIMER_OMP_GET_WTIME)
# define TSTART(x) x=OMP_get_wtime()
# define TSTOP(x) x=OMP_get_wtime()
# define TSTAMP(x) x=OMP_get_wtime()
#else
NEED_TO_SPECIFY_TIMER
#endif
!#define EXPAND_POW4
#ifdef EXPAND_POW4
#define POW4(a) (a)*(a)*(a)*(a)
#else
#define POW4(a) (a)**4
#endif
#define PRINT_TIME0(a, t) write(*,'(a80,f16.4)') a, t
#define PRINT_TIME1(a, t) write(*,'(a70,f16.4)') a, t
#define PRINT_TIME2(a, t) write(*,'(a60,f10.4)') a, t
#define PRINT_TIME2i(a, d, t) write(*,'(a56,i4,f10.4)') a,d,t
#define PRINT_TIME3(a, t) write(*,'(a50,f10.4)') a, t
#define PRINT_TIME3i(a, d, t) write(*,'(a46,i4,f10.4)') a,d,t
#define PRINT_TIME4(a, t) write(*,'(a40,f10.4)') a, t
#define PRINT_TIMEX(a, t) write(*,'(a100,f16.6)') a, t
#define PRINTES(a, t) write(*,'(a80,es22.15)') a, t
#define PRINT_TIME_AF(a, t) write(*,'(a55,10x,f16.4)') a, t
#define PRINT_TIME_AIF(a, i, t) write(*,'(a55,i10,f16.4)') a, i, t
#define PRINT_TIME_AIIF(a, i1, i2, t) write(*,'(a55,i10,i10,f16.4)') a, i1, i2, t
#define PRINT_TIME_AIIIF(a, i1, i2, i3, t) write(*,'(a55,i10,i10,i10,f16.55)') a, i1, i2, i3, t
!// integer :: OMP_GET_THREAD_NUM, OMP_GET_NUM_THREADS, OMP_GET_MAX_THREADS
#ifdef _OPENMP
#define THREADID(a) OMP_GET_THREAD_NUM()
#define NUMTHREADS(a) OMP_GET_NUM_THREADS()
#define MAXTHREADS(a) OMP_GET_MAX_THREADS()
#else
#define THREADID(a) 1
#define NUMTHREADS(a) 1
#define MAXTHREADS(a) 1
#endif
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SKSL_GLSLCODEGENERATOR
#define SKSL_GLSLCODEGENERATOR
#include <stack>
#include <tuple>
#include <unordered_map>
#include "SkSLCodeGenerator.h"
#include "ir/SkSLBinaryExpression.h"
#include "ir/SkSLBoolLiteral.h"
#include "ir/SkSLConstructor.h"
#include "ir/SkSLDoStatement.h"
#include "ir/SkSLExtension.h"
#include "ir/SkSLFloatLiteral.h"
#include "ir/SkSLIfStatement.h"
#include "ir/SkSLIndexExpression.h"
#include "ir/SkSLInterfaceBlock.h"
#include "ir/SkSLIntLiteral.h"
#include "ir/SkSLFieldAccess.h"
#include "ir/SkSLForStatement.h"
#include "ir/SkSLFunctionCall.h"
#include "ir/SkSLFunctionDeclaration.h"
#include "ir/SkSLFunctionDefinition.h"
#include "ir/SkSLPrefixExpression.h"
#include "ir/SkSLPostfixExpression.h"
#include "ir/SkSLProgramElement.h"
#include "ir/SkSLReturnStatement.h"
#include "ir/SkSLStatement.h"
#include "ir/SkSLSwizzle.h"
#include "ir/SkSLTernaryExpression.h"
#include "ir/SkSLVarDeclaration.h"
#include "ir/SkSLVarDeclarationStatement.h"
#include "ir/SkSLVariableReference.h"
#include "ir/SkSLWhileStatement.h"
namespace SkSL {
#define kLast_Capability SpvCapabilityMultiViewport
struct GLCaps {
int fVersion;
enum {
kGL_Standard,
kGLES_Standard
} fStandard;
};
/**
* Converts a Program into GLSL code.
*/
class GLSLCodeGenerator : public CodeGenerator {
public:
enum Precedence {
kParentheses_Precedence = 1,
kPostfix_Precedence = 2,
kPrefix_Precedence = 3,
kMultiplicative_Precedence = 4,
kAdditive_Precedence = 5,
kShift_Precedence = 6,
kRelational_Precedence = 7,
kEquality_Precedence = 8,
kBitwiseAnd_Precedence = 9,
kBitwiseXor_Precedence = 10,
kBitwiseOr_Precedence = 11,
kLogicalAnd_Precedence = 12,
kLogicalXor_Precedence = 13,
kLogicalOr_Precedence = 14,
kTernary_Precedence = 15,
kAssignment_Precedence = 16,
kSequence_Precedence = 17,
kTopLevel_Precedence = 18
};
GLSLCodeGenerator(const Context* context, GLCaps caps)
: fContext(*context)
, fCaps(caps)
, fIndentation(0)
, fAtLineStart(true) {}
void generateCode(const Program& program, std::ostream& out) override;
private:
void write(const char* s);
void writeLine();
void writeLine(const char* s);
void write(const std::string& s);
void writeLine(const std::string& s);
void writeType(const Type& type);
void writeExtension(const Extension& ext);
void writeInterfaceBlock(const InterfaceBlock& intf);
void writeFunctionStart(const FunctionDeclaration& f);
void writeFunctionDeclaration(const FunctionDeclaration& f);
void writeFunction(const FunctionDefinition& f);
void writeLayout(const Layout& layout);
void writeModifiers(const Modifiers& modifiers);
void writeGlobalVars(const VarDeclaration& vs);
void writeVarDeclarations(const VarDeclarations& decl);
void writeVariableReference(const VariableReference& ref);
void writeExpression(const Expression& expr, Precedence parentPrecedence);
void writeIntrinsicCall(const FunctionCall& c);
void writeFunctionCall(const FunctionCall& c);
void writeConstructor(const Constructor& c);
void writeFieldAccess(const FieldAccess& f);
void writeSwizzle(const Swizzle& swizzle);
void writeBinaryExpression(const BinaryExpression& b, Precedence parentPrecedence);
void writeTernaryExpression(const TernaryExpression& t, Precedence parentPrecedence);
void writeIndexExpression(const IndexExpression& expr);
void writePrefixExpression(const PrefixExpression& p, Precedence parentPrecedence);
void writePostfixExpression(const PostfixExpression& p, Precedence parentPrecedence);
void writeBoolLiteral(const BoolLiteral& b);
void writeIntLiteral(const IntLiteral& i);
void writeFloatLiteral(const FloatLiteral& f);
void writeStatement(const Statement& s);
void writeBlock(const Block& b);
void writeIfStatement(const IfStatement& stmt);
void writeForStatement(const ForStatement& f);
void writeWhileStatement(const WhileStatement& w);
void writeDoStatement(const DoStatement& d);
void writeReturnStatement(const ReturnStatement& r);
const Context& fContext;
const GLCaps fCaps;
std::ostream* fOut;
int fIndentation;
bool fAtLineStart;
// Keeps track of which struct types we have written. Given that we are unlikely to ever write
// more than one or two structs per shader, a simple linear search will be faster than anything
// fancier.
std::vector<const Type*> fWrittenStructs;
};
}
#endif
|
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Copyright 2015, Schmidt
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "sumstats.h"
#include "../omp.h"
// It ain't pretty, but function pointers are too expensive
#define SWEEP_ROWS_SPECIAL(ASSIGNMENT) \
for (j=0; j<n; j++){ \
for (i=0; i<m; i++){ \
x[i + m*j] ASSIGNMENT vec[i]; }}
#define SWEEP_COLS_SPECIAL(ASSIGNMENT) \
_Pragma("omp parallel for default(shared) private(i,j,tmp) if(m*n > OMP_MIN_SIZE)") \
for (j=0; j<n; j++){ \
tmp = vec[j]; \
SAFE_SIMD \
for (i=0; i<m; i++){ \
x[i + m*j] ASSIGNMENT tmp; }}
#define SWEEP_ROWS(ASSIGNMENT) \
pos = 1; \
for (j=0; j<n; j++){ \
for (i=0; i<m; i++){ \
x[i + m*j] += vec[pos]; \
pos = (pos+1) % lvec; }}
#define SWEEP_COLS(ASSIGNMENT) \
_Pragma("omp parallel for default(shared) private(i,j,tmp) if(m*n > OMP_MIN_SIZE)") \
for (j=0; j<n; j++){ \
pos = j%lvec; \
SAFE_SIMD \
for (i=0; i<m; i++){ \
x[i + m*j] += vec[pos]; \
pos = (pos+n) % lvec; }}
// sweep array out of matrix in-place
int pcapack_sweep(const int m, const int n, double *restrict x, double *restrict vec, const int lvec, const int margin, const int fun)
{
int i, j;
int pos;
double tmp;
if (m == 0 || n == 0) return 0;
if (margin != ROWS && margin != COLS) return -6;
if (fun != PLUS && fun != MINUS && fun != TIMES && fun != DIVIDE) return -7;
// Special cases --- avoids index checking
if (margin == ROWS && lvec == m)
{
if (fun == PLUS)
{
SWEEP_ROWS_SPECIAL(+=);
}
else if (fun == MINUS)
{
SWEEP_ROWS_SPECIAL(-=);
}
else if (fun == TIMES)
{
SWEEP_ROWS_SPECIAL(*=);
}
else if (fun == DIVIDE)
{
SWEEP_ROWS_SPECIAL(/=);
}
}
else if (margin == COLS && lvec == n)
{
if (fun == PLUS)
{
SWEEP_COLS_SPECIAL(+=);
}
else if (fun == MINUS)
{
SWEEP_COLS_SPECIAL(-=);
}
else if (fun == TIMES)
{
SWEEP_COLS_SPECIAL(*=);
}
if (fun == DIVIDE)
{
SWEEP_COLS_SPECIAL(/=);
}
}
// General case
else
{
if (fun == PLUS)
{
if (margin == ROWS)
{
SWEEP_ROWS(+=);
}
else if (margin == COLS)
{
SWEEP_COLS(+=);
}
}
else if (fun == MINUS)
{
if (margin == ROWS)
{
SWEEP_ROWS(-=);
}
else if (margin == COLS)
{
SWEEP_COLS(-=);
}
}
else if (fun == TIMES)
{
if (margin == ROWS)
{
SWEEP_ROWS(*=);
}
else if (margin == COLS)
{
SWEEP_COLS(*=);
}
}
else if (fun == DIVIDE)
{
if (margin == ROWS)
{
SWEEP_ROWS(/=);
}
else if (margin == COLS)
{
SWEEP_COLS(/=);
}
}
}
return 0;
}
|
//
// ZomSignUpViewController.h
// Zom
//
// Created by RAHUL'S MAC MINI on 01/03/17.
//
//
#import <UIKit/UIKit.h>
#import <ACFloatingTextfield_Objc/ACFloatingTextField.h>
#import <TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.h>
@interface ZomSignUpViewController : UIViewController<UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet ACFloatingTextField *txt_fullName;
@property (strong, nonatomic) IBOutlet ACFloatingTextField *txt_Email;
@property (strong, nonatomic) IBOutlet ACFloatingTextField *txt_Password;
@property (strong, nonatomic) IBOutlet ACFloatingTextField *txt_confirmPassword;
@property (weak, nonatomic) IBOutlet ACFloatingTextField *textFieldMobileNumber;
@property (weak, nonatomic) IBOutlet ACFloatingTextField *textFieldCountryCode;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintViewMobileHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintViewMobileBottom;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintViewHeight;
@property (weak, nonatomic) IBOutlet UIButton *buttonRegisterByMobile;
@property (weak, nonatomic) IBOutlet UIView *viewMobileNumber;
@property (weak, nonatomic) IBOutlet TPKeyboardAvoidingScrollView *scrollView;
- (IBAction)createAccount:(UIButton *)sender;
- (IBAction)buttonActionChangeType:(UIButton *)sender;
@end
|
//--------------------------------------------------------------------------------------------------
/**
* @file pa_mdmCfg_default.c
*
* Default implementation of @ref pa_mdmCfg interface
*
* Copyright (C) Sierra Wireless Inc.
*/
//--------------------------------------------------------------------------------------------------
#include "legato.h"
#include "interfaces.h"
#include "pa_mdmCfg.h"
//--------------------------------------------------------------------------------------------------
/**
* Store the modem current configuration.
*
* @return
* - LE_OK The function succeeded.
* - LE_FAULT The function failed.
* - LE_UNSUPPORTED The function does not supported on this platform.
*/
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdmCfg_StoreCurrentConfiguration
(
void
)
{
LE_ERROR("Unsupported function called");
return LE_UNSUPPORTED;
}
//--------------------------------------------------------------------------------------------------
/**
* Restore previously saved the modem configuration.
*
* @return
* - LE_OK The function succeeded.
* - LE_FAULT The function failed.
* - LE_UNSUPPORTED The function does not supported on this platform.
*/
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdmCfg_RestoreSavedConfiguration
(
void
)
{
LE_ERROR("Unsupported function called");
return LE_UNSUPPORTED;
}
//--------------------------------------------------------------------------------------------------
/**
* This function must be called to initialize the PA modem configuration module.
*
* @return
* - LE_FAULT The function failed to initialize the PA modem configuration module.
* - LE_OK The function succeeded.
*/
//--------------------------------------------------------------------------------------------------
le_result_t pa_mdmCfg_Init
(
void
)
{
return LE_OK;
}
|
#ifndef COMBINEDMODELTESTS_H
#define COMBINEDMODELTESTS_H
#include <QObject>
#include <QtTest> // IWYU pragma: keep
// IWYU pragma: no_include <QString>
class CombinedModelTests : public QObject {
Q_OBJECT
public:
CombinedModelTests(QObject *parent = nullptr);
private slots:
void trivialCombineNoItemsTest();
void trivialCombineOneItemTest();
void combineSeveralSameItemsTest();
void combineSeveralWithEmptyFirstTest();
void combineSeveralWithEmptyManyTest();
void combineSeveralWithEmptyTest();
void combineSeveralEmptyTest();
void combineAllDifferentItemsTest();
void combineAllManyDifferentItemsTest();
void combineAllManyLastDifferentItemsTest();
void combineCommonInKeywordsTest();
void combineCommonInManyKeywordsTest();
void combineCommonInTitleTest();
void combineCommonInDescriptionTest();
void editSeveralWithSameKeywordsTest();
void recombineAfterRemoveDifferentTest();
void recombineAfterRemoveAllButOneTest();
void recombineAfterChangesTest();
void isNotModifiedAfterTitleDescEditTest();
void isModifiedAfterKeywordsAppendTest();
void isModifiedAfterKeywordRemovalTest();
void isModifiedAfterKeywordEditTest();
void isModifiedAfterKeywordsClearTest();
void isNotModifiedAfterEmptyKeywordsClearTest();
void isModifiedStatusNotResetWithOtherTest();
void initArtworksEmitsRowsInsertTest();
void initEmptyArtworksDoesNotEmitTest();
void initOneArtworkEnablesAllFields();
void initManyArtworksDoesNotEnableAllFields();
void resetModelClearsEverythingTest();
void appendNewKeywordEmitsCountChangedTest();
void appendExistingKeywordDoesNotEmitTest();
void pasteNewKeywordsEmitsCountChangedTest();
void pasteExistingKeywordsDoesNotEmitTest();
void editKeywordDoesNotEmitCountChangedTest();
void notSavedAfterAllDisabledTest();
void notSavedAfterNothingModifiedTest();
void notSavedAfterModifiedDisabledTest();
void savedAfterModifiedDescriptionTest();
void savedAfterModifiedTitleTest();
void savedAfterKeywordsModifiedTest();
void savedIfMoreThanOneButNotModifiedTest();
void caseIsPreservedForOneItemTest();
void caseIsPreservedForSeveralItemsTest();
void clearKeywordsFiresKeywordsCountTest();
};
#endif // COMBINEDMODELTESTS_H
|
#include <config.h>
/* world bank, finance handler */
private object *coins; /* coin handles, too intensive? */
static void create(varargs int clone)
{
coins = ({ });
}
void create_coin(object coin, varargs string creator)
{
coins += ({ coin });
}
void coin_change(object coin, string to, int amount)
{
} |
/*===================================================================
APM_PLANNER Open Source Ground Control Station
(c) 2017 APM_PLANNER PROJECT <http://www.ardupilot.com>
This file is part of the APM_PLANNER project
APM_PLANNER 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.
APM_PLANNER 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 APM_PLANNER. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file LogExporter.h
* @author Arne Wischmann <wischmann-a@gmx.de>
* @date 28 Jan 2017
* @brief File providing header for the log exporter classes
*/
#ifndef LOGEXPORTER_H
#define LOGEXPORTER_H
#include <QString>
#include "LogdataStorage.h"
#include "src/output/kmlcreator.h"
#include "common/common.h"
/**
* @brief The LogExporterBase class - for different log exporters. It handles
* the exporting workflow for every line oriented export.
* It provides a progress dialog with a cancel button.
*/
class LogExporterBase
{
public:
/**
* @brief Shared pointer for LogExporterBase objects
*/
typedef QSharedPointer<LogExporterBase> Ptr;
/**
* @brief LogExporterBase - CTOR
* @param parent - Parent widget needed for progress and info windows.
*/
explicit LogExporterBase(QWidget *parent);
/**
* @brief ~LogExporterBase - DTOR
*/
virtual ~LogExporterBase();
/**
* @brief exportToFile - exports the content of the LogdataStorage pointed by
* dataStoragePtr to a file with name fileName.
* @param fileName - filename for the export
* @param dataStoragePtr - shared pointer to a filled LogdataStorage
* @return true on success, false otherwise
*/
bool exportToFile(const QString &fileName, LogdataStorage::Ptr dataStoragePtr);
private:
QWidget *mp_parent; /// pointer to parent widget - do not delete
/**
* @brief startExport - must be implemented by derived classes. It has to setup
* all preconditions needed to call writeline afterwards.
* @param fileName - filename for the export
* @return true on success, false otherwise
*/
virtual bool startExport(const QString &fileName) = 0;
/**
* @brief writeLine - must be implemented by derived classes. Will be called by the
* export function for every logline stored in datamodel.
* @param line - All data as a string
*/
virtual void writeLine(QString &line) = 0;
/**
* @brief endExport - must be implemented by derived classes. Will be called by the
* export function at the end of the export process. It should close all used
* resources.
*/
virtual void endExport() = 0;
};
//***********************************************************************
/**
* @brief The AsciiLogExporter class is used to export a *.log file.
*/
class AsciiLogExporter : public LogExporterBase
{
public:
/**
* @brief Shared pointer for AsciiLogExporter objects
*/
typedef QSharedPointer<AsciiLogExporter> Ptr;
/**
* @brief AsciiLogExporter - CTOR
* @param parent - Parent widget needed for progress and info windows.
*/
AsciiLogExporter(QWidget *parent);
/**
* @brief ~AsciiLogExporter - DTOR
*/
virtual ~AsciiLogExporter();
private:
QFile m_outputFile; /// file object for exporting
/**
* @brief startExport - Creates and opens the output file
* @param fileName - file name
* @return - true on success, false otherwise
*/
virtual bool startExport(const QString &fileName);
/**
* @brief writeLine - writes the line directly into the output file.
* @param line - string to be written to the file
*/
virtual void writeLine(QString &line);
/**
* @brief endExport - closes the output file
*/
virtual void endExport();
};
//***********************************************************************
/**
* @brief The KmlLogExporter class is used to export kml files which can be used
* with google earth.
*/
class KmlLogExporter : public LogExporterBase
{
public:
/**
* @brief Shared pointer for KmlLogExporter objects
*/
typedef QSharedPointer<KmlLogExporter> Ptr;
/**
* @brief KmlLogExporter - CTOR
* @param parent - Parent widget needed for progress and info windows.
*/
KmlLogExporter(QWidget *parent, MAV_TYPE mav_type, double iconInterval);
/**
* @brief ~KmlLogExporter - DTOR
*/
virtual ~KmlLogExporter();
private:
kml::KMLCreator m_kmlExporter; /// KML export object
/**
* @brief startExport - sets up the kmlExporter.
* @param fileName - file name to be used by the kmlExporter
* @return
*/
virtual bool startExport(const QString &fileName);
/**
* @brief writeLine - gives the line to kmlExporter which extracts the
* neede data.
* @param line - data to be analyzed
*/
virtual void writeLine(QString &line);
/**
* @brief endExport - exports the data collected by the kmlExporter to
* the file.
*/
virtual void endExport();
};
#endif // LOGEXPORTER_H
|
/*
* sensor_measurement.h
*
*
*/
#ifndef _OpenAPI_sensor_measurement_H_
#define _OpenAPI_sensor_measurement_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum { OpenAPI_sensor_measurement_NULL = 0, OpenAPI_sensor_measurement_BAROMETRIC_PRESSURE, OpenAPI_sensor_measurement_UE_SPEED, OpenAPI_sensor_measurement_UE_ORIENTATION } OpenAPI_sensor_measurement_e;
char* OpenAPI_sensor_measurement_ToString(OpenAPI_sensor_measurement_e sensor_measurement);
OpenAPI_sensor_measurement_e OpenAPI_sensor_measurement_FromString(char* sensor_measurement);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_sensor_measurement_H_ */
|
/**
* Schulich Delta Host Telemetry
* Copyright (C) 2015 University of Calgary Solar Car Team
*
* This file is part of the Schulich Delta Host Telemetry
*
* The Schulich Delta Host Telemetry is free software:
* you can redistribute it and/or modify it under the terms
* of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* The Schulich Delta Host Telemetry is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General
* Public License along with the Schulich Delta Host Telemetry.
* If not, see <http://www.gnu.org/licenses/>.
*
* For further contact, email <software@calgarysolarcar.ca>
*/
#pragma once
#include <QScopedPointer>
class BatteryPresenter;
class BusinessContainer;
class CommunicationContainer;
class CommunicationPresenter;
class DataContainer;
class DisplayPresenter;
class FaultsPresenter;
class MpptPresenter;
class PowerPresenter;
class VehiclePresenter;
class PresenterContainer
{
public:
PresenterContainer(DataContainer& dataContainer,
CommunicationContainer& communicationContainer,
BusinessContainer& businessContainer);
~PresenterContainer();
BatteryPresenter& batteryPresenter();
CommunicationPresenter& communicationPresenter();
VehiclePresenter& vehiclePresenter();
MpptPresenter& mpptPresenter();
PowerPresenter& powerPresenter();
FaultsPresenter& faultsPresenter();
private:
QScopedPointer<BatteryPresenter> batteryPresenter_;
QScopedPointer<CommunicationPresenter> communicationPresenter_;
QScopedPointer<VehiclePresenter> vehiclePresenter_;
QScopedPointer<MpptPresenter> mpptPresenter_;
QScopedPointer<PowerPresenter> powerPresenter_;
QScopedPointer<FaultsPresenter> faultsPresenter_;
};
|
/*
* point_altitude_uncertainty_all_of.h
*
*
*/
#ifndef _OpenAPI_point_altitude_uncertainty_all_of_H_
#define _OpenAPI_point_altitude_uncertainty_all_of_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "geographical_coordinates.h"
#include "uncertainty_ellipse.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_point_altitude_uncertainty_all_of_s OpenAPI_point_altitude_uncertainty_all_of_t;
typedef struct OpenAPI_point_altitude_uncertainty_all_of_s {
struct OpenAPI_geographical_coordinates_s *point;
double altitude;
struct OpenAPI_uncertainty_ellipse_s *uncertainty_ellipse;
float uncertainty_altitude;
int confidence;
} OpenAPI_point_altitude_uncertainty_all_of_t;
OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_create(
OpenAPI_geographical_coordinates_t *point,
double altitude,
OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse,
float uncertainty_altitude,
int confidence
);
void OpenAPI_point_altitude_uncertainty_all_of_free(OpenAPI_point_altitude_uncertainty_all_of_t *point_altitude_uncertainty_all_of);
OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_parseFromJSON(cJSON *point_altitude_uncertainty_all_ofJSON);
cJSON *OpenAPI_point_altitude_uncertainty_all_of_convertToJSON(OpenAPI_point_altitude_uncertainty_all_of_t *point_altitude_uncertainty_all_of);
OpenAPI_point_altitude_uncertainty_all_of_t *OpenAPI_point_altitude_uncertainty_all_of_copy(OpenAPI_point_altitude_uncertainty_all_of_t *dst, OpenAPI_point_altitude_uncertainty_all_of_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_point_altitude_uncertainty_all_of_H_ */
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2016. *
* *
* This program is free software. You may use, modify, and redistribute 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 program is distributed without any warranty. See *
* the file COPYING.gpl-v3 for details. *
\*************************************************************************/
/* Listing 57-6 */
/* ud_ucase_sv.c
A server that uses a UNIX domain datagram socket to receive datagrams,
convert their contents to uppercase, and then return them to the senders.
See also ud_ucase_cl.c.
*/
#include "ud_ucase.h"
int
main(int argc, char *argv[])
{
struct sockaddr_un svaddr, claddr;
int sfd, j;
ssize_t numBytes;
socklen_t len;
char buf[BUF_SIZE];
sfd = socket(AF_UNIX, SOCK_DGRAM, 0); /* Create server socket */
if (sfd == -1)
errExit("socket");
/* Construct well-known address and bind server socket to it */
if (remove(SV_SOCK_PATH) == -1 && errno != ENOENT)
errExit("remove-%s", SV_SOCK_PATH);
memset(&svaddr, 0, sizeof(struct sockaddr_un));
svaddr.sun_family = AF_UNIX;
strncpy(svaddr.sun_path, SV_SOCK_PATH, sizeof(svaddr.sun_path) - 1);
if (bind(sfd, (struct sockaddr *) &svaddr, sizeof(struct sockaddr_un)) == -1)
errExit("bind");
/* Receive messages, convert to uppercase, and return to client */
for (;;) {
len = sizeof(struct sockaddr_un);
numBytes = recvfrom(sfd, buf, BUF_SIZE, 0,
(struct sockaddr *) &claddr, &len);
if (numBytes == -1)
errExit("recvfrom");
printf("Server received %ld bytes from %s\n", (long) numBytes,
claddr.sun_path);
for (j = 0; j < numBytes; j++)
buf[j] = toupper((unsigned char) buf[j]);
if (sendto(sfd, buf, numBytes, 0, (struct sockaddr *) &claddr, len) !=
numBytes)
fatal("sendto");
}
}
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-PDU-Contents"
* found in "../support/ngap-r16.4.0/38413-g40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps -no-gen-BER -no-gen-XER -no-gen-OER -no-gen-UPER`
*/
#include "NGAP_InitialContextSetupResponse.h"
asn_TYPE_member_t asn_MBR_NGAP_InitialContextSetupResponse_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct NGAP_InitialContextSetupResponse, protocolIEs),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_NGAP_ProtocolIE_Container_9520P10,
0,
{
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
0
},
0, 0, /* No default value */
"protocolIEs"
},
};
static const ber_tlv_tag_t asn_DEF_NGAP_InitialContextSetupResponse_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_NGAP_InitialContextSetupResponse_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */
};
asn_SEQUENCE_specifics_t asn_SPC_NGAP_InitialContextSetupResponse_specs_1 = {
sizeof(struct NGAP_InitialContextSetupResponse),
offsetof(struct NGAP_InitialContextSetupResponse, _asn_ctx),
asn_MAP_NGAP_InitialContextSetupResponse_tag2el_1,
1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
1, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_NGAP_InitialContextSetupResponse = {
"InitialContextSetupResponse",
"InitialContextSetupResponse",
&asn_OP_SEQUENCE,
asn_DEF_NGAP_InitialContextSetupResponse_tags_1,
sizeof(asn_DEF_NGAP_InitialContextSetupResponse_tags_1)
/sizeof(asn_DEF_NGAP_InitialContextSetupResponse_tags_1[0]), /* 1 */
asn_DEF_NGAP_InitialContextSetupResponse_tags_1, /* Same as above */
sizeof(asn_DEF_NGAP_InitialContextSetupResponse_tags_1)
/sizeof(asn_DEF_NGAP_InitialContextSetupResponse_tags_1[0]), /* 1 */
{
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
SEQUENCE_constraint
},
asn_MBR_NGAP_InitialContextSetupResponse_1,
1, /* Elements count */
&asn_SPC_NGAP_InitialContextSetupResponse_specs_1 /* Additional specs */
};
|
/**
******************************************************************************
* @file UART/UART_TwoBoards_ComPolling/Inc/main.h
* @author MCD Application Team
* @version V1.0.1
* @date 29-January-2016
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
#include "stm32f411e_discovery.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* User can use this section to tailor USARTx/UARTx instance used and associated
resources */
/* Definition for USARTx clock resources */
#define USARTx USART2
#define USARTx_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE();
#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define USARTx_FORCE_RESET() __HAL_RCC_USART2_FORCE_RESET()
#define USARTx_RELEASE_RESET() __HAL_RCC_USART2_RELEASE_RESET()
/* Definition for USARTx Pins */
#define USARTx_TX_PIN GPIO_PIN_2
#define USARTx_TX_GPIO_PORT GPIOA
#define USARTx_TX_AF GPIO_AF7_USART2
#define USARTx_RX_PIN GPIO_PIN_3
#define USARTx_RX_GPIO_PORT GPIOA
#define USARTx_RX_AF GPIO_AF7_USART2
/* Size of Transmission buffer */
#define TXBUFFERSIZE (COUNTOF(aTxBuffer) - 1)
/* Size of Reception buffer */
#define RXBUFFERSIZE TXBUFFERSIZE
/* Exported macro ------------------------------------------------------------*/
#define COUNTOF(__BUFFER__) (sizeof(__BUFFER__) / sizeof(*(__BUFFER__)))
/* Exported functions ------------------------------------------------------- */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
* From ASN.1 module "EUTRA-RRC-Definitions"
* found in "36331-ac0.asn"
* `asn1c -S /home/nyee/srsLTE/srslte/examples/src/asn1c/skeletons -fcompound-names -fskeletons-copy -gen-PER -pdu=auto`
*/
#ifndef _IRAT_ParametersUTRA_FDD_H_
#define _IRAT_ParametersUTRA_FDD_H_
#include <asn_application.h>
/* Including external dependencies */
#include "SupportedBandListUTRA-FDD.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* IRAT-ParametersUTRA-FDD */
typedef struct IRAT_ParametersUTRA_FDD {
SupportedBandListUTRA_FDD_t supportedBandListUTRA_FDD;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} IRAT_ParametersUTRA_FDD_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_IRAT_ParametersUTRA_FDD;
#ifdef __cplusplus
}
#endif
#endif /* _IRAT_ParametersUTRA_FDD_H_ */
#include <asn_internal.h>
|
/*
* Copyright (C) 2006-2018 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Essentia
*
* Essentia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), 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 Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
#ifndef ESSENTIA_VITERBI_H
#define ESSENTIA_VITERBI_H
#include "algorithmfactory.h"
namespace essentia {
namespace standard {
class Viterbi : public Algorithm {
protected:
Input<std::vector<std::vector<Real> > > _observationProbabilities;
Input<std::vector<Real> > _initialization;
Input<std::vector<size_t> > _fromIndex;
Input<std::vector<size_t> > _toIndex;
Input<std::vector<Real> > _transitionProbabilities;
Output<std::vector<int> > _path;
std::vector<int> _tempPath;
public:
Viterbi() {
declareInput(_observationProbabilities, "observationProbabilities", "the observation probabilities");
declareInput(_initialization, "initialization", "the initialization");
declareInput(_fromIndex, "fromIndex", "the transition matrix from index");
declareInput(_toIndex, "toIndex", "the transition matrix to index");
declareInput(_transitionProbabilities, "transitionProbabilities", "the transition probabilities matrix");
declareOutput(_path, "path", "the decoded path");
}
~Viterbi() {
}
void declareParameters() {}
void compute();
static const char* name;
static const char* category;
static const char* description;
};
} // namespace standard
} // namespace essentia
#include "streamingalgorithmwrapper.h"
namespace essentia {
namespace streaming {
class Viterbi : public StreamingAlgorithmWrapper {
protected:
Sink<std::vector<std::vector<Real> > > _observationProbabilities;
Sink<std::vector<Real> > _initialization;
Sink<std::vector<size_t> > _fromIndex;
Sink<std::vector<size_t> > _toIndex;
Sink<std::vector<Real> > _transitionProbabilities;
Source<std::vector<int> > _path;
public:
Viterbi() {
declareAlgorithm("Viterbi");
declareInput(_observationProbabilities, TOKEN, "observationProbabilities");
declareInput(_initialization, TOKEN, "initialization");
declareInput(_fromIndex , TOKEN, "fromIndex");
declareInput(_toIndex, TOKEN, "toIndex");
declareInput(_transitionProbabilities, TOKEN, "transitionProbabilities");
declareOutput(_path, TOKEN, "path");
}
};
} // namespace streaming
} // namespace essentia
#endif // ESSENTIA_FLATNESS_H
|
#ifndef PARAMEDITOR_H
#define PARAMEDITOR_H
#include <thread>
#include <QPlainTextEdit>
#include <QWidget>
#include "ptextedit.h"
#include "../file/sysfilein.h"
#include "../file/sysfileout.h"
#include "../globals/log.h"
#include "../memrep/parsermgr.h"
namespace Ui {
class ParamEditor;
}
class ParamEditor : public QWidget
{
Q_OBJECT
public:
explicit ParamEditor(QWidget *parent = 0);
~ParamEditor();
void UpdateParameters();
void SetFileName(const std::string& file_name) { _fileName = file_name; }
public slots:
void on_btnSave_clicked();
void on_btnSave_Close_clicked();
void on_tbwParameters_currentChanged(int);
protected slots:
virtual void closeEvent(QCloseEvent* event) override;
virtual void showEvent(QShowEvent* event) override;
signals:
void CloseEditor();
void ModelChanged(void*);
private slots:
void TabTextChanged();
private:
void TrimNewlines(std::string& text);
void UpdateBuffer(int idx);
void UpdateEditors();
void WriteBuffer();
static const int NUM_EDITORS;
Ui::ParamEditor *ui;
void LoadModel();
std::pair<int, std::string> _buffer;
std::vector<PTextEdit*> _editors;
std::string _fileName;
Log* const _log;
VecStr _models;
std::thread::id _tid;
};
#endif // PARAMEDITOR_H
|
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "OperandPtg.h"
namespace XLS
{
class CFRecord;
class PtgSxName: public OperandPtg
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(PtgSxName)
public:
BiffStructurePtr clone();
virtual void loadFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref = false);
_UINT32 sxIndex;
private:
GlobalWorkbookInfoPtr global_info;
};
} // namespace XLS
|
/*
Class that auto configures link-local xmpp account
Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SALUT_ENABLER_H
#define SALUT_ENABLER_H
#include <QtCore/QObject>
#include <TelepathyQt/Types>
#include <KMessageWidget>
class QFrame;
class QWidget;
namespace Tp {
class PendingOperation;
}
class SalutEnabler : public QObject
{
Q_OBJECT
public:
explicit SalutEnabler(const Tp::AccountManagerPtr accountManager, QObject *parent = 0);
virtual ~SalutEnabler();
QFrame *frameWidget(QWidget *parent);
Q_SIGNALS:
void userInfoReady();
void done();
void cancelled();
void feedbackMessage(const QString &text, const QString &comment, KMessageWidget::MessageType);
public Q_SLOTS:
void onUserAccepted();
void onUserWantingChanges();
void onUserCancelled();
void onDialogAccepted(const QString &displayName, const QVariantMap &values);
private Q_SLOTS:
void onAccountCreated(Tp::PendingOperation *op);
void onConnectionManagerReady(Tp::PendingOperation *op);
void onProfileManagerReady(Tp::PendingOperation *op);
private:
class Private;
Private * const d;
};
#endif // SALUT_ENABLER_H
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2008 Texas Instruments - http://www.ti.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <goo-ti-h263dec.h>
#include <goo-utils.h>
G_DEFINE_TYPE (GooTiH263Dec, goo_ti_h263dec, GOO_TYPE_TI_VIDEO_DECODER)
static void
goo_ti_h263dec_validate_ports_definitions (GooComponent* component)
{
g_assert (GOO_IS_TI_H263DEC (component));
GooTiH263Dec* self = GOO_TI_H263DEC (component);
g_assert (component->cur_state == OMX_StateLoaded);
OMX_PARAM_PORTDEFINITIONTYPE *param;
GOO_OBJECT_DEBUG (self, "Entering");
/* input */
{
GooIterator* iter =
goo_component_iterate_input_ports (component);
goo_iterator_nth (iter, 0);
GooPort* port = GOO_PORT (goo_iterator_get_current (iter));
g_assert (port != NULL);
param = GOO_PORT_GET_DEFINITION (port);
param->format.video.cMIMEType = "H263";
param->format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
param->format.video.bFlagErrorConcealment = OMX_FALSE;
/* ever? */
switch (param->format.video.eColorFormat)
{
case OMX_COLOR_FormatCbYCrY:
case OMX_COLOR_FormatYCbYCr:
param->nBufferSize =
param->format.video.nFrameWidth *
param->format.video.nFrameHeight ;
break;
case OMX_COLOR_FormatYUV420PackedPlanar:
param->nBufferSize =
(param->format.video.nFrameWidth *
param->format.video.nFrameHeight ) ;
break;
default:
GOO_OBJECT_ERROR (self, "Not valid color format");
g_assert (FALSE);
}
g_object_unref (iter);
g_object_unref (port);
}
/* output */
{
GooIterator* iter =
goo_component_iterate_output_ports (component);
goo_iterator_nth (iter, 0);
GooPort* port = GOO_PORT (goo_iterator_get_current (iter));
g_assert (port != NULL);
param = GOO_PORT_GET_DEFINITION (port);
switch (param->format.video.eColorFormat)
{
case OMX_COLOR_FormatCbYCrY:
case OMX_COLOR_FormatYCbYCr:
param->nBufferSize =
param->format.video.nFrameWidth *
param->format.video.nFrameHeight * 2;
break;
case OMX_COLOR_FormatYUV420PackedPlanar:
param->nBufferSize =
param->format.video.nFrameWidth *
param->format.video.nFrameHeight * 1.5;
break;
default:
GOO_OBJECT_ERROR (self, "Not valid color format");
g_assert (FALSE);
}
param->format.video.cMIMEType = "YUV";
param->format.video.pNativeRender = NULL;
param->format.video.bFlagErrorConcealment = OMX_FALSE;
param->format.video.eCompressionFormat =
OMX_VIDEO_CodingUnused;
/** @todo validate frame size, bitrate and framerate */
g_object_unref (iter);
g_object_unref (port);
}
GOO_OBJECT_DEBUG (self, "Exit");
return;
}
static void
goo_ti_h263dec_init (GooTiH263Dec* self)
{
return;
}
static void
goo_ti_h263dec_class_init (GooTiH263DecClass* klass)
{
GooComponentClass* o_klass = GOO_COMPONENT_CLASS (klass);
o_klass->validate_ports_definition_func =
goo_ti_h263dec_validate_ports_definitions;
return;
}
|
/*
*
* SDLP SDK
* Cross Platform Application Communication Stack for In-Vehicle Applications
*
* Copyright (C) 2013, Luxoft Professional Corp., member of IBS group
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*/
/*
* File: ZmqClient.h
*
* Author: Vyacheslav Plachkov
*/
#ifndef ZMQCLIENT_H
#define ZMQCLIENT_H
#include "Logger.hpp"
#include "ZmqSocket/SenderZmqSocket.h"
#include "ZmqSocket/ReceiverZmqSocket.h"
/**
*\namespace NsUtils
*\brief Namespace for utils
*/
namespace NsUtils
{
class IClientListener
{
public:
virtual ~IClientListener() {}
/**
* Invoked when the socket receives a correct message.
* A response is sent automatically.
* Data payload is deallocated after this callback,
* so it should be copied if you intend to keep it for later use.
*/
virtual void onMessageReceived(char const * const data, unsigned int dataSize) = 0;
/**
* Established connection with server
*/
virtual void onConnectionEstablished() = 0;
};
class ZmqClient : public IReceiverSocketListener
{
public:
/**
* @param clientName is unique text-digit string, client-name
*/
ZmqClient(const std::string &clientName, const std::string& serverName,
IClientListener * listener);
~ZmqClient();
void pushMessageToQueue(const unsigned int dataSize, const char * data);
private:
virtual void handleMessage(tSizedMessage message);
void pushHelloRequest();
std::string mClientName;
std::string mServerName;
std::string mClientAddress;
std::string mServerAddress;
volatile int mClientId;
void *mZmqContext;
SenderZmqSocket * mSenderSocket;
ReceiverZmqSocket * mReceiverSocket;
IClientListener * mListener;
static Logger mLogger;
};
} //NsUtils
#endif //ZMQCLIENT_H
|
/*
* i6engine
* Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
*
* This file is part of i6engine; i6engine is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __I6ENGINE_SAMPLES_COMMONAPPLICATION_H__
#define __I6ENGINE_SAMPLES_COMMONAPPLICATION_H__
#include "i6engine/api/Application.h"
#include "i6engine/api/configs/ObjectConfig.h"
#include "i6engine/api/objects/GameObject.h"
namespace sample {
class CommonApplication : virtual public i6e::api::Application {
public:
CommonApplication(bool move, bool shootBall);
virtual ~CommonApplication();
virtual void Initialize();
virtual void AfterInitialize();
virtual void Tick();
virtual bool ShutdownRequest();
virtual void Finalize();
virtual void ShutDown();
protected:
bool _showFPS;
i6e::api::WeakGOPtr _camera;
/**
* \brief In this map all registered buttons and their respective actions are stored.
* The boolean indicates if the button is still pressed.
*/
std::map<std::string, std::pair<boost::function<void(void)>, bool>> _eventMap;
bool _move;
bool _shootBall;
/**
* \brief processes input messages
*/
void InputMailbox(const i6e::api::GameMessage::Ptr & msg);
void Forward();
void Backward();
void Left();
void Right();
void Down();
void Up();
void RotateLeft();
void RotateRight();
void RotateUp();
void RotateDown();
void LeanLeft();
void LeanRight();
};
} /* namespace sample */
#endif /* __I6ENGINE_SAMPLES_COMMONAPPLICATION_H__ */
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* 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.
*
* ArduinoRGBDevice.h
* The Arduino RGB Mixer device.
* Copyright (C) 2010 Simon Newton
*/
#ifndef PLUGINS_USBPRO_ARDUINORGBDEVICE_H_
#define PLUGINS_USBPRO_ARDUINORGBDEVICE_H_
#include <string>
#include "ola/DmxBuffer.h"
#include "olad/TokenBucket.h"
#include "plugins/usbpro/ArduinoWidget.h"
#include "plugins/usbpro/UsbSerialDevice.h"
namespace ola {
namespace plugin {
namespace usbpro {
/*
* An Arduino RGB Mixer Device
*/
class ArduinoRGBDevice: public UsbSerialDevice {
public:
ArduinoRGBDevice(ola::network::SelectServerInterface *ss,
ola::AbstractPlugin *owner,
const string &name,
ArduinoWidget *widget,
uint16_t esta_id,
uint16_t device_id,
uint32_t serial);
string DeviceId() const { return m_device_id; }
private:
string m_device_id;
};
/*
* A single Output port per device
*/
class ArduinoRGBOutputPort: public BasicOutputPort {
public:
ArduinoRGBOutputPort(ArduinoRGBDevice *parent,
ArduinoWidget *widget,
uint32_t serial,
const TimeStamp *wake_time,
unsigned int initial_count,
unsigned int rate);
string Description() const { return m_description; }
bool WriteDMX(const DmxBuffer &buffer, uint8_t) {
if (m_bucket.GetToken(*m_wake_time))
return m_widget->SendDMX(buffer);
else
OLA_INFO << "Port rated limited, dropping frame";
return true;
}
void SendRDMRequest(const ola::rdm::RDMRequest *request,
ola::rdm::RDMCallback *callback) {
return m_widget->SendRDMRequest(request, callback);
}
void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback) {
m_widget->RunFullDiscovery(callback);
}
void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback) {
m_widget->RunIncrementalDiscovery(callback);
}
private:
ArduinoWidget *m_widget;
TokenBucket m_bucket;
const TimeStamp *m_wake_time;
string m_description;
};
} // usbpro
} // plugin
} // ola
#endif // PLUGINS_USBPRO_ARDUINORGBDEVICE_H_
|
/*
* WebKit2 EFL
*
* Copyright (c) 2012 Samsung Electronics Co., Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/**
* @file utc_webkit2_ewk_policy_decision_suspend_func.c
* @author Jongseok Yang <js45.yang@samsung.com>
* @date 2012-06-12
* @brief Tests EWK function ewk_policy_decision_suspend()
*/
/* Define those macros _before_ you include the utc_webkit2_ewk.h header file. */
#define TESTED_FUN_NAME ewk_policy_decision_suspend
#define POSITIVE_TEST_FUN_NUM 1
#define NEGATIVE_TEST_FUN_NUM 1
#include "utc_webkit2_ewk.h"
static Eina_Bool g_result = EINA_FALSE;
static void load_finished(void* data, Evas_Object* webview, void* event_info)
{
utc_message("[load_finished] :: \n");
g_result = EINA_TRUE;
utc_webkit2_main_loop_quit();
}
static void load_error(void* data, Evas_Object* webview, void* event_info)
{
utc_message("[load_error] :: \n");
g_result = EINA_FALSE;
utc_webkit2_main_loop_quit();
}
static void policy_navigation_decide(void* data, Evas_Object* webview, void* event_info)
{
utc_message("[policy_navigation_decide] :: \n");
Ewk_Policy_Decision* policy_decision = (Ewk_Policy_Decision*)event_info;
if (ewk_policy_decision_suspend(policy_decision))
g_result = EINA_TRUE;
else
g_result = EINA_FALSE;
utc_webkit2_main_loop_quit();
}
/* Startup and cleanup functions */
static void startup(void)
{
utc_webkit2_ewk_test_init();
evas_object_smart_callback_add(test_view.webview, "load,finished", load_finished, NULL);
evas_object_smart_callback_add(test_view.webview, "load,error", load_error, NULL);
evas_object_smart_callback_add(test_view.webview, "policy,navigation,decide", policy_navigation_decide, NULL);
}
static void cleanup(void)
{
evas_object_smart_callback_del(test_view.webview, "load,finished", load_finished);
evas_object_smart_callback_del(test_view.webview, "load,error", load_error);
evas_object_smart_callback_del(test_view.webview, "policy,navigation,decide", policy_navigation_decide);
utc_webkit2_ewk_test_end();
}
/**
* @brief Tests if suspend operation for policy decision is set properly
*/
POS_TEST_FUN(1)
{
if (!ewk_view_url_set(test_view.webview, "http://www.google.com")) {
utc_message("[ewk_view_url_set error] :: \n");
utc_fail();
}
utc_webkit2_main_loop_begin();
utc_check_eq(g_result, EINA_TRUE);
}
/**
* @brief Tests if function works properly in case of NULL of a webview
*/
NEG_TEST_FUN(1)
{
utc_check_ne(ewk_policy_decision_suspend(0), EINA_TRUE);
}
|
// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef __raw_accessor_h__
#define __raw_accessor_h__
// Local includes
#include "libmesh_common.h"
#include "tensor_value.h"
#include "vector_value.h"
#include "type_n_tensor.h"
namespace libMesh
{
/**
* What underlying data type would we need to access in each field?
*/
template <typename FieldType>
struct RawFieldType {};
template <>
struct RawFieldType<Number>
{
typedef Number type;
};
template <>
struct RawFieldType<Gradient>
{
typedef Number type;
};
template <>
struct RawFieldType<Tensor>
{
typedef Number type;
};
template<>
struct RawFieldType<TypeNTensor<3, Number> >
{
typedef Number type;
};
#ifdef LIBMESH_USE_COMPLEX_NUMBERS
template <>
struct RawFieldType<Real>
{
typedef Real type;
};
template <>
struct RawFieldType<RealGradient>
{
typedef Real type;
};
template <>
struct RawFieldType<RealTensor>
{
typedef Real type;
};
template<>
struct RawFieldType<TypeNTensor<3, Real> >
{
typedef Real type;
};
#endif
/**
* This class provides single index access to FieldType (i.e. Number, Gradient, Tensor, etc.).
*/
template <typename FieldType>
class RawAccessor
{
public:
RawAccessor( FieldType& data, const unsigned int dim )
: _data(data),
_dim(dim)
{}
~RawAccessor(){};
typename RawFieldType<FieldType>::type& operator()( unsigned int i );
const typename RawFieldType<FieldType>::type& operator()( unsigned int i ) const;
private:
RawAccessor();
FieldType& _data;
const unsigned int _dim;
};
// Specialize for specific cases
template<>
inline
Number& RawAccessor<Number>::operator()( unsigned int i )
{
libmesh_assert(i == 0);
return this->_data;
}
template<>
inline
Number& RawAccessor<Gradient>::operator()( unsigned int i )
{
libmesh_assert(i < this->_dim);
return this->_data(i);
}
template<>
inline
Number& RawAccessor<Tensor>::operator()( unsigned int k )
{
libmesh_assert(k < this->_dim*this->_dim);
// For tensors, each row is filled first, i.e. for 2-D
// [ 0 1; 2 3]
// Thus, k(i,j) = j + i*dim
unsigned int ii = k/_dim;
unsigned int jj = k - ii*_dim;
return this->_data(ii,jj);
}
/**
* Stub implementations for stub TypeNTensor object
*/
template <unsigned int N, typename ScalarType>
class RawAccessor<TypeNTensor<N, ScalarType> >
{
public:
typedef TypeNTensor<N, ScalarType> FieldType;
RawAccessor( FieldType& data, const unsigned int dim )
: _data(data),
_dim(dim)
{}
~RawAccessor(){};
typename RawFieldType<FieldType>::type& operator()( unsigned int /*i*/ )
{ return dummy; }
const typename RawFieldType<FieldType>::type& operator()( unsigned int /*i*/ ) const
{ return dummy; }
private:
RawAccessor();
ScalarType dummy;
FieldType& _data;
const unsigned int _dim;
};
#ifdef LIBMESH_USE_COMPLEX_NUMBERS
template<>
inline
Real& RawAccessor<Real>::operator()( unsigned int i )
{
libmesh_assert(i == 0);
return this->_data;
}
template<>
inline
Real& RawAccessor<RealGradient>::operator()( unsigned int i )
{
libmesh_assert(i < this->_dim);
return this->_data(i);
}
template<>
inline
Real& RawAccessor<RealTensor>::operator()( unsigned int k )
{
libmesh_assert(k < this->_dim*this->_dim);
// For tensors, each row is filled first, i.e. for 2-D
// [ 0 1; 2 3]
// Thus, k(i,j) = i + j*dim
unsigned int jj = k/_dim;
unsigned int ii = k - jj*_dim;
return this->_data(ii,jj);
}
#endif
}
#endif //__raw_accessor_h__
|
/*
* waysome - wayland based window manager
*
* Copyright in alphabetical order:
*
* Copyright (C) 2014-2015 Julian Ganz
* Copyright (C) 2014-2015 Manuel Messner
* Copyright (C) 2014-2015 Marcel Müller
* Copyright (C) 2014-2015 Matthias Beyer
* Copyright (C) 2014-2015 Nadja Sommerfeld
*
* This file is part of waysome.
*
* waysome is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your option)
* any later version.
*
* waysome 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 waysome. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @addtogroup input "Input"
*
* @{
*
* @copydoc doc_input
*/
#ifndef __WS_INPUT_MODULE_H__
#define __WS_INPUT_MODULE_H__
/**
* Initialize the input module
*
* @return zero on success, else error code from errno.h
*/
int
ws_input_init(void);
#endif // __INPUT_INPUT_MODULE_H__
/**
* @}
*/
|
/*
* Copyright (C) 2021 Peter Marheine <pmarheine@chromium.org>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <fwupdplugin.h>
#define FU_TYPE_REALTEK_MST_DEVICE (fu_realtek_mst_device_get_type())
G_DECLARE_FINAL_TYPE(FuRealtekMstDevice, fu_realtek_mst_device, FU, REALTEK_MST_DEVICE, FuI2cDevice)
|
/******************************************************************************
* Copyright (c)2012 Jan Rheinlaender <jrheinlaender@users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
******************************************************************************/
#ifndef GUI_TASKVIEW_TaskScaledParameters_H
#define GUI_TASKVIEW_TaskScaledParameters_H
#include <Gui/TaskView/TaskView.h>
#include <Gui/Selection.h>
#include <Gui/TaskView/TaskDialog.h>
#include "TaskTransformedParameters.h"
#include "ViewProviderScaled.h"
class Ui_TaskScaledParameters;
namespace App {
class Property;
}
namespace Gui {
class ViewProvider;
}
namespace PartDesignGui {
class TaskMultiTransformParameters;
class TaskScaledParameters : public TaskTransformedParameters
{
Q_OBJECT
public:
/// Constructor for task with ViewProvider
TaskScaledParameters(ViewProviderTransformed *TransformedView, QWidget *parent = 0);
/// Constructor for task with parent task (MultiTransform mode)
TaskScaledParameters(TaskMultiTransformParameters *parentTask, QLayout *layout);
virtual ~TaskScaledParameters();
const double getFactor(void) const;
const unsigned getOccurrences(void) const;
private Q_SLOTS:
void onFactor(const double f);
void onOccurrences(const int n);
virtual void onUpdateView(bool);
virtual void onFeatureDeleted(void);
protected:
virtual void changeEvent(QEvent *e);
virtual void onSelectionChanged(const Gui::SelectionChanges& msg);
virtual void clearButtons();
private:
void setupUI();
void updateUI();
private:
Ui_TaskScaledParameters* ui;
};
/// simulation dialog for the TaskView
class TaskDlgScaledParameters : public TaskDlgTransformedParameters
{
Q_OBJECT
public:
TaskDlgScaledParameters(ViewProviderScaled *ScaledView);
virtual ~TaskDlgScaledParameters() {}
public:
/// is called by the framework if the dialog is accepted (Ok)
virtual bool accept();
};
} //namespace PartDesignGui
#endif // GUI_TASKVIEW_TASKAPPERANCE_H
|
/* Oscar, a hardware abstraction framework for the LeanXcam and IndXcam.
Copyright (C) 2008 Supercomputing Systems AG
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef OSCAR_INCLUDE_SRD_H_
#define OSCAR_INCLUDE_SRD_H_
/*! @file
* @brief API definition for stimuli reader module
*
* Srd allows to read signal values from a stimuli file.
* One reader instance is required per stimuli file while a reader
* may contain multiple signal instances.
*
* The stimuli file must fullfill following syntax rules. A example
* is give first:
*
* ! Time ExampleA ExampleB
*
* @ 0 1 0
*
* @ 20 1 1
*
* ! tab Time tab {SignalNameA} tab {SignalNameB} (descriptor line)
*
* @ tab {time} tab {val} tab {val} (instruction line)
*
* The order of signal names has to match with the order of signal
* registration to the reader.
*/
extern struct OscModule OscModule_srd;
/*! Module-specific error codes.
* These are enumerated with the offset
* assigned to each module, so a distinction over
* all modules can be made */
enum EnOscSrdErrors
{
ESRD_PARSING_FAILURE = OSC_SRD_ERROR_OFFSET
};
/*====================== API functions =================================*/
/*********************************************************************//*!
* @brief Create Stimuli Reader (host only)
*
* @param strFile I: output file name
* @param pUpdateCallback I: callback fxn to notify a value change
* @param ppReader O: handle to reader instance
* @return SUCCESS or an appropriate error code otherwise
*//*********************************************************************/
OSC_ERR OscSrdCreateReader( char* strFile,
void (*pUpdateCallback)(void),
void** ppReader);
/*********************************************************************//*!
* @brief Register a signal to reader (host only)
*
* @param pReader I: handle to reader
* @param strSignal I: signal name
* @param ppSignal O: handle to signal instance
* @return SUCCESS or an appropriate error code otherwise
*//*********************************************************************/
OSC_ERR OscSrdRegisterSignal( void* pReader, char* strSignal, void** ppSignal);
/*********************************************************************//*!
* @brief GetUpdateSignal (host only)
*
* @param pSignal I: handle to signal
* @param pbValue O: return active signal value
* @return SUCCESS or an appropriate error code otherwise
*//*********************************************************************/
OSC_ERR OscSrdGetUpdateSignal( void* pSignal, bool* pbValue);
#endif // #ifndef OSCAR_INCLUDE_SRD_H_
|
/*
* Copyright 2006 Serge van den Boom <svdb@stack.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _NETPORT_H
#define _NETPORT_H
#include "port.h"
#ifdef USE_WINSOCK
int winsockErrorToErrno(int winsockError);
int getWinsockErrno(void);
# define EAI_SYSTEM 0x02000001
// Any value will do that doesn't conflict with an existing value.
#ifdef __MINGW32__
// MinGW does not have a working gai_strerror() yet.
static inline const char *
gai_strerror(int err) {
(void) err;
return "[gai_strerror() is not available on MinGW]";
}
#endif /* defined(__MINGW32__) */
#endif
#endif /* _NETPORT_H */
|
/*
* src/nl-class-add.c Add/Update/Replace Traffic Class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#include <netlink/cli/utils.h>
#include <netlink/cli/tc.h>
#include <netlink/cli/qdisc.h>
#include <netlink/cli/class.h>
#include <netlink/cli/link.h>
#include <netlink-private/route/tc-api.h>
static int quiet = 0;
static void print_usage(void)
{
printf(
"Usage: nl-class-add [OPTIONS]... class [CONFIGURATION]...\n"
"\n"
"OPTIONS\n"
" -q, --quiet Do not print informal notifications.\n"
" -h, --help Show this help text.\n"
" -v, --version Show versioning information.\n"
" --update Update class if it exists.\n"
" --update-only Only update class, never create it.\n"
" -d, --dev=DEV Network device the class should be attached to.\n"
" -i, --id=ID ID of new class (default: auto-generated)\n"
" -p, --parent=ID ID of parent { root | ingress | class-ID }\n"
" --mtu=SIZE Overwrite MTU (default: MTU of network device)\n"
" --mpu=SIZE Minimum packet size on the link (default: 0).\n"
" --overhead=SIZE Overhead in bytes per packet (default: 0).\n"
" --linktype=TYPE Overwrite linktype (default: type of network device)\n"
"\n"
"CONFIGURATION\n"
" -h, --help Show help text of class specific options.\n"
"\n"
"EXAMPLE\n"
" $ nl-class-add --dev=eth1 --parent=root htb --rate=100mbit\n"
"\n"
);
exit(0);
}
int main(int argc, char *argv[])
{
struct nl_sock *sock;
struct rtnl_class *class;
struct rtnl_tc *tc;
struct nl_cache *link_cache;
struct nl_dump_params dp = {
.dp_type = NL_DUMP_DETAILS,
.dp_fd = stdout,
};
struct nl_cli_tc_module *tm;
struct rtnl_tc_ops *ops;
int err, flags = NLM_F_CREATE | NLM_F_EXCL;
char *kind, *id = NULL;
sock = nl_cli_alloc_socket();
nl_cli_connect(sock, NETLINK_ROUTE);
link_cache = nl_cli_link_alloc_cache(sock);
class = nl_cli_class_alloc();
tc = (struct rtnl_tc *) class;
for (;;) {
int c, optidx = 0;
enum {
ARG_UPDATE = 257,
ARG_UPDATE_ONLY = 258,
ARG_MTU,
ARG_MPU,
ARG_OVERHEAD,
ARG_LINKTYPE,
};
static struct option long_opts[] = {
{ "quiet", 0, 0, 'q' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
{ "dev", 1, 0, 'd' },
{ "parent", 1, 0, 'p' },
{ "id", 1, 0, 'i' },
{ "update", 0, 0, ARG_UPDATE },
{ "update-only", 0, 0, ARG_UPDATE_ONLY },
{ "mtu", 1, 0, ARG_MTU },
{ "mpu", 1, 0, ARG_MPU },
{ "overhead", 1, 0, ARG_OVERHEAD },
{ "linktype", 1, 0, ARG_LINKTYPE },
{ 0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "+qhvd:p:i:",
long_opts, &optidx);
if (c == -1)
break;
switch (c) {
case 'q': quiet = 1; break;
case 'h': print_usage(); break;
case 'v': nl_cli_print_version(); break;
case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
case 'i': id = strdup(optarg); break;
case ARG_UPDATE: flags = NLM_F_CREATE; break;
case ARG_UPDATE_ONLY: flags = 0; break;
case ARG_MTU: nl_cli_tc_parse_mtu(tc, optarg); break;
case ARG_MPU: nl_cli_tc_parse_mpu(tc, optarg); break;
case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break;
case ARG_LINKTYPE: nl_cli_tc_parse_linktype(tc, optarg); break;
}
}
if (optind >= argc)
print_usage();
if (!rtnl_tc_get_ifindex(tc))
nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
if (!rtnl_tc_get_parent(tc))
nl_cli_fatal(EINVAL, "You must specify a parent (--parent=XXX)");
if (id) {
nl_cli_tc_parse_handle(tc, id, 1);
free(id);
}
kind = argv[optind++];
rtnl_tc_set_kind(tc, kind);
if (!(ops = rtnl_tc_get_ops(tc)))
nl_cli_fatal(ENOENT, "Unknown class \"%s\"", kind);
if (!(tm = nl_cli_tc_lookup(ops)))
nl_cli_fatal(ENOTSUP, "class type \"%s\" not supported.", kind);
tm->tm_parse_argv(tc, argc, argv);
if (!quiet) {
printf("Adding ");
nl_object_dump(OBJ_CAST(class), &dp);
}
if ((err = rtnl_class_add(sock, class, flags)) < 0)
nl_cli_fatal(EINVAL, "Unable to add class: %s", nl_geterror(err));
return 0;
}
|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef PT_MINIMALMAPPLICATION_H
#define PT_MINIMALMAPPLICATION_H
#include <QObject>
class MLocale;
class MApplicationWindow;
class MApplicationPage;
/**
Benchmark runtime of a simple M application.
All elements are benchmarked individually and the whole application is benchmarked at once.
*/
class Pt_minimalmapplication : public QObject
{
Q_OBJECT
public:
Pt_minimalmapplication();
/**
* Execute a whole simple M application by calling the slots from below.
*/
int executeAll();
QString appearType;
private slots:
void overallRuntime();
void overallRuntimeAppearNow();
void createMLocale();
void createMApplicationWindow();
void windowShow();
void createMApplicationPage();
void pageAppear();
private:
void executeSelf(const QString ¶m);
bool noBenchmark;
MLocale *locale;
MApplicationWindow *window;
MApplicationPage *page;
};
#endif // PT_MINIMALMAPPLICATION_H
|
/*
Copyright (C) 1995-2001 Activision, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "eclock.h"
int n = 0;
int nrcvd = 0;
clock_t t_first;
clock_t t_last;
void printStats(int sig)
{
float duration;
if (sig != SIGALRM) {
printf("got signal %d != SIGALRM\n", sig);
exit(1);
}
duration = (float)((long)(t_last-t_first))/ECLOCKS_PER_SEC;
if (duration < (float)1.0/ECLOCKS_PER_SEC)
duration = (float)1.0/ECLOCKS_PER_SEC;
printf("received %d/%d packets in %.2fs, %.2f pkts/sec %.2f%% loss\n",
nrcvd, n, duration, (float)nrcvd/duration, (float)((n-nrcvd)*100.0)/n);
exit(0);
}
void main(int argc, char *argv[])
{
int sockfd;
int port = 2000;
struct protoent *pe;
struct sockaddr_in my_addr;
if (argc > 1) {
printf("Usage: %s\n", argv[0]);
printf(" Listens for UDP packets from udpspew on port %d\n", port);
printf(" and prints statistics.\n");
exit(1);
}
pe = getprotobyname("udp");
if (!pe) {
printf("unknown protocol - udp\n");
exit(1);
}
memset((caddr_t)&my_addr, 0, sizeof(struct sockaddr_in));
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(port);
my_addr.sin_addr.s_addr = htons(INADDR_ANY);
if ((sockfd = socket(AF_INET, SOCK_DGRAM, pe->p_proto)) < 0) {
printf("socket error:%d\n", errno);
exit(1);
}
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(my_addr)) < 0) {
printf("bind error:%d\n", errno);
exit(1);
}
if (SIG_ERR == signal(SIGALRM, printStats)) {
printf("can't set SIGALRM handler\n");
exit(1);
}
printf("listening for udpspew packets on UDP port %d\n", port);
while(1) {
unsigned char msg[1500];
int len;
struct sockaddr_in from_addr;
int fromlen = sizeof(struct sockaddr_in);
int i;
if ((len = recvfrom(sockfd, msg, 256, 0, &from_addr, &fromlen)) == -1) {
printf("recvfrom error:%d\n", errno);
exit(1);
} else if (len < 4) {
printf("received odd sized packet len:%d\n", len);
exit(1);
}
if (!n) {
t_first = eclock();
alarm(3); /* set 3s alarm after first packet */
n = ((msg[3] << 8) + msg[2]);
if (n < 1) {
printf("received odd n:%d\n", n);
exit(1);
}
}
i = ((msg[1] << 8) + msg[0]);
if ((i < 1) || (i > n)) {
printf("received odd i:%d\n", i);
exit(1);
}
t_last = eclock();
nrcvd++;
}
}
|
/***************************************************************************
* Copyright (C) 2005-2013 by the FIFE team *
* http://www.fifengine.net *
* This file is part of FIFE. *
* *
* FIFE is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef FIFE_INSTANCETREE_H
#define FIFE_INSTANCETREE_H
// Standard C++ library includes
#include <list>
// 3rd party library includes
// FIFE includes
// These includes are split up in two parts, separated by one empty line
// First block: files included from the FIFE root src
#include "util/base/fifeclass.h"
#include "util/structures/quadtree.h"
#include "model/metamodel/modelcoords.h"
namespace FIFE {
class Instance;
class InstanceTree: public FifeClass {
public:
static const int32_t MIN_TREE_SIZE = 2;
typedef std::list<Instance*> InstanceList;
typedef QuadTree< InstanceList, MIN_TREE_SIZE > InstanceQuadTree;
typedef InstanceQuadTree::Node InstanceTreeNode;
/** Constructor
*
*/
InstanceTree();
/** Destructor
*
*/
virtual ~InstanceTree();
/** Adds an instance to the quad tree.
*
* Adds an instance to the quad tree based upon it's location on the layer and it's
* area.
*
* @param instance A pointer to the instance to add.
* @note In case you added the instance before this will throw.
*/
void addInstance(Instance* instance);
/** Removes an instance from the quad tree.
*
* Locates an instance in the quad tree then removes it.
*
* @param instance A pointer to the instance to find and remove.
* @note In case you did @b not add the instance before this will throw.
*/
void removeInstance(Instance* instance);
/** Find all instances in a given area.
*
* Takes a box as an area then returns a vector filled with all instances that intersect
* with that box.
*
* @param point A ModelCoordinate representing the upper left part of the search area.
* @param w The width of the search area in Model Units.
* @param h The height of the search area in Model Units.
* @param list vector reference that will be filled with all instances within that space.
*/
void findInstances(const ModelCoordinate& point, int32_t w, int32_t h, InstanceList& list);
/** See QuadNode::apply_visitor
*/
template<typename Visitor> void applyVisitor(Visitor& visitor) {
m_tree.apply_visitor(visitor);
}
private:
InstanceQuadTree m_tree;
std::map<Instance*,InstanceTreeNode*> m_reverse;
};
}
#endif
|
////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005 Affymetrix, Inc.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License
// (version 2.1) as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
// for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////
#ifndef _GenericDataHeaderWriter_HEADER_
#define _GenericDataHeaderWriter_HEADER_
#include "calvin_files/data/src/GenericDataHeader.h"
//
#include <fstream>
//
#ifdef _MSC_VER
#pragma warning(disable: 4290) // don't show warnings about throw keyword on function declarations.
#endif
namespace affymetrix_calvin_io
{
class GenericDataHeaderWriter
{
public:
GenericDataHeaderWriter() {}
~GenericDataHeaderWriter() {}
void Write(std::ofstream &os, GenericDataHeader &g);
private:
void WriteFileTypeId(std::ofstream &os, const GenericDataHeader &g) const;
void WriteFileId(std::ofstream &os, const GenericDataHeader &g) const;
void WriteFileCreationTime(std::ofstream &os, const GenericDataHeader &g) const;
void WriteLocale(std::ofstream &os, const GenericDataHeader &g) const;
void WriteNameValParamCnt(std::ofstream &os, const GenericDataHeader &dc) const;
void WriteNameValParams(std::ofstream &os, GenericDataHeader &g);
void WriteParentHdrCnt(std::ofstream &os, const GenericDataHeader &dc) const;
void WriteParentHdrs(std::ofstream &os, GenericDataHeader &g);
};
}
#endif // _GenericDataHeaderWriter_HEADER_
|
/*
* Copyright (C) 2016 Mewiteor <mewiteor@hotmail.com>
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
/*
* Given two binary strings, return their sum (also a binary string).
*
* For example,
* a = "11"
* b = "1"
* Return "100".
*/
char* addBinary(char* a, char* b) {
int la=strlen(a),lb=strlen(b);
int lr=(la>lb?la:lb)+1;
char *rstr=(char*)malloc((lr+1)*sizeof(char));
int cur=0;
char *tmp=rstr,*tmp2=rstr,t,c=0;
while(la&&lb) {
*tmp=a[--la]-'0'+b[--lb]+c;
if(*tmp>'1'){*tmp-=2;c=1;}
else c=0;
++tmp;
}
while(la) {
*tmp=a[--la]+c;
if(*tmp>'1'){*tmp-=2;c=1;}
else c=0;
++tmp;
}
while(lb) {
*tmp=b[--lb]+c;
if(*tmp>'1'){*tmp-=2;c=1;}
else c=0;
++tmp;
}
if(c)*tmp++='1';
*tmp=0;
while(tmp2<--tmp) {
t=*tmp2;
*tmp2++=*tmp;
*tmp=t;
}
return rstr;
}
|
/*******************************************************************************
* File Name: lcd.h
*******************************************************************************/
#ifndef __LCD_H
#define __LCD_H
// display orientation
typedef enum {HORZ = 0, VERT = 1} orient;
#define FONT_WIDTH 8
#define FONT_HEIGHT 14
// define display field widths in pixels
// define display field widths in pixels
#define CHAR_WIDTH 8
#define CHAR_HEIGHT 16
#define FONT_WIDTH 8
#define FONT_HEIGHT 14
#define U8_DIGITS 3
#define U8_WIDTH (U8_DIGITS * CHAR_WIDTH)
#define S8_DIGITS 4
#define S8_WIDTH (S8_DIGITS * CHAR_WIDTH)
#define U16_DIGITS 5
#define U16_WIDTH (U16_DIGITS * CHAR_WIDTH)
#define S16_DIGITS 6
#define S16_WIDTH (S16_DIGITS * CHAR_WIDTH)
#define U32_DIGITS 12
#define U32_WIDTH (U32_DIGITS * CHAR_WIDTH)
#define S32_DIGITS 13
#define S32_WIDTH (S32_DIGITS * CHAR_WIDTH)
#define FIXED_DIGITS 10
#define FIXED_WIDTH (FIXED_DIGITS * CHAR_WIDTH)
#define BOOL_CHARS 5
#define BOOL_WIDTH (BOOL_CHARS * CHAR_WIDTH)
#define SPACE_WIDTH CHAR_WIDTH
#define HEX_DIGITS 8
#define HEX_WIDTH (HEX_DIGITS * CHAR_WIDTH)
#define VERT_WIDTH 240
#define VERT_HEIGHT 320
#define HORZ_WIDTH 320
#define HORZ_HEIGHT 239
#define CHAR_HEIGHT 16
#define SHORT_DIGITS 7
#define SHORT_WIDTH (SHORT_DIGITS * CHAR_WIDTH)
#define INT_DIGITS 14
#define INT_WIDTH (INT_DIGITS * CHAR_WIDTH)
//============================== Color definitions =============================
#define RGB(_R,_G,_B) (((_R & 0x3E) >> 1) | ((_G & 0x3f) << 5) | ((_B & 0x3e) << 10))
#define WHITE RGB(63,63,63)
#define YEL RGB(63,63,0)
#define DRK_YEL RGB(32,32,0)
#define RED RGB(63,0,0)
#define DRK_RED RGB(32,0,0)
#define GRN RGB(0,63,0)
#define DRK_GRN RGB(0,32,0)
#define BLUE RGB(0,0,63)
#define DRK_BLUE RGB(0,0,32)
#define BLACK RGB(0,0,0)
#define GRAY RGB(24,24,24)
#define FRM_COLOR GRAY
#define BKGND_COLOR BLACK
#define CURSOR_COLOR RED
#define TXT_COLOR WHITE
#define EMER_TXT_COLOR RED
#define SPECT_COLOR BLUE
#define PEAK_COLOR GRN
//========================== Forward function delclaratons =====================
void Lcd_Wrt_Reg(u16 Reg, u16 Data);
void LCD_Initial(void);
void Point_SCR(u16 x0, u16 y0);
void Clear_Screen(u16 bg);
u16 Get_Font_8x14(u8 chr, u8 row);
//u8 Get_Ref_Wave(u16 idx);
void Display_Str(u16 x0, u16 y0, u16 fg, u16 bg, const char *s);
//void Display_Info(u16 x0, u16 y0, char *Pre, long Num);
//void Display_Logo(const u8 *Pict, u16 fg, u16 x, u16 y, u16 dx, u16 dy);
#endif
/********************************* END OF FILE ********************************/
|
/* -*-c++-*- IfcPlusPlus - www.ifcplusplus.com - Copyright (C) 2011 Fabian Gerold
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* 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
* OpenSceneGraph Public License for more details.
*/
#pragma once
#include <vector>
#include <map>
#include <sstream>
#include <string>
#include "ifcpp/model/shared_ptr.h"
#include "ifcpp/model/IfcPPObject.h"
#include "ifcpp/model/IfcPPGlobal.h"
// TYPE IfcOpeningElementTypeEnum = ENUMERATION OF (OPENING ,RECESS ,USERDEFINED ,NOTDEFINED);
class IFCPP_EXPORT IfcOpeningElementTypeEnum : virtual public IfcPPObject
{
public:
enum IfcOpeningElementTypeEnumEnum
{
ENUM_OPENING,
ENUM_RECESS,
ENUM_USERDEFINED,
ENUM_NOTDEFINED
};
IfcOpeningElementTypeEnum();
IfcOpeningElementTypeEnum( IfcOpeningElementTypeEnumEnum e ) { m_enum = e; }
~IfcOpeningElementTypeEnum();
virtual const char* className() const { return "IfcOpeningElementTypeEnum"; }
virtual shared_ptr<IfcPPObject> getDeepCopy( IfcPPCopyOptions& options );
virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const;
static shared_ptr<IfcOpeningElementTypeEnum> createObjectFromSTEP( const std::wstring& arg );
IfcOpeningElementTypeEnumEnum m_enum;
};
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
//! [0]
#include <QSharedData>
#include <QString>
class EmployeeData : public QSharedData
{
public:
EmployeeData() : id(-1) { }
EmployeeData(const EmployeeData &other)
: QSharedData(other), id(other.id), name(other.name) { }
~EmployeeData() { }
int id;
QString name;
};
class Employee
{
public:
//! [1]
Employee() { d = new EmployeeData; }
//! [1] //! [2]
Employee(int id, QString name) {
d = new EmployeeData;
setId(id);
setName(name);
}
//! [2] //! [7]
Employee(const Employee &other)
: d (other.d)
{
}
//! [7]
//! [3]
void setId(int id) { d->id = id; }
//! [3] //! [4]
void setName(QString name) { d->name = name; }
//! [4]
//! [5]
int id() const { return d->id; }
//! [5] //! [6]
QString name() const { return d->name; }
//! [6]
private:
QSharedDataPointer<EmployeeData> d;
};
//! [0]
#endif
|
/*****************************************************************************
* __________________ _________ _____ _____ .__ ._.
* \______ \______ \ / _____/ / \ / _ \ |__| ____ | |
* | | _/| | \ \_____ \ / \ / \ / /_\ \| _/ __ \ | |
* | | \| ` \/ / Y \ / | | \ ___/ \|
* |______ /_______ /_______ \____|__ / /\ \____|__ |__|\___ | __
* \/ \/ \/ \/ )/ \/ \/ \/
*
* This file is part of liBDSM. Copyright © 2014-2015 VideoLabs SAS
*
* Author: Julien 'Lta' BALLET <contact@lta.io>
*
* liBDSM is released under LGPLv2.1 (or later) and is also available
* under a commercial license.
*****************************************************************************
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __BDSM_SMB_SESSION_H_
#define __BDSM_SMB_SESSION_H_
#include "smb_defs.h"
#include "smb_types.h"
/**
* @file smb_session.h
* @brief Functions to connect and authenticate to an SMB server
*/
/**
* @brief Allocates a new Session object
* @details To be able to perform actions on shares and file, you'll need to
* call smb_session_connect, then authenticate with smb_authenticate.
* @return A new Session object.
*/
smb_session *smb_session_new();
/**
* @brief Close a session and deallocate its ressources
* @details After destroying a session, all the smb_tid, smb_fid and smb_fd
* associated with this session becomes invalid.
*
* @param s The session to destroy
*/
void smb_session_destroy(smb_session *s);
/**
* @brief Set the credentials for this session.
* @details Any of the params except s can be NULL.
*
* @param s The session object.
* @param domain Domain to authenticate on. Often it's the same as netbios host.
* @param login The user to login as.
* @param password the user's password.
*/
void smb_session_set_creds(smb_session *s, const char *domain,
const char *login, const char *password);
#define SMB_CREDS_MAXLEN 128
/**
* @brief Establish a connection and negotiate a session protocol with a remote
* host
* @details You have to provide both the ip and the name. This is a constraint
* of Netbios, which requires you to know its name before he accepts to speak
* with you.
*
* @param s A session object.
* @param hostname The ASCII netbios name, the name type will be coerced to <20>
* since libdsm is about reading files
* @param ip The ip of the machine to connect to (in network byte order)
* @param transport The type of transport used, it could be SMB_TRANSPORT_TCP
* or SMB_TRANSPORT_NBT (Netbios over TCP, ie legacy)
* @return 0 on success or a DSM error code in case of error
*/
int smb_session_connect(smb_session *s, const char *hostname,
uint32_t ip, int transport);
/**
* @brief Authenticate on the remote host with the provided credentials
* @details Can be called if session state is SMB_STATE_DIALECT_OK.
* If successfull, session state transition to SMB_STATE_SESSION_OK
* Provides the credentials with smb_session_set_creds.
*
* @param s The session object.
*
* @return 0 on success or a DSM error code in case of error. Success doesn't
* mean you are logged in with the user you requested. If guest are activated
* on the remote host, when login fails, you are logged in as 'Guest'. Failure
* might also indicate you didn't supplied all the credentials
*/
int smb_session_login(smb_session *s);
int smb_session_logoff(smb_session *s);
/**
* @brief Am i logged in as Guest ?
*
* @param s The session object
* @return 1 -> Logged in as guest
* 0 -> Logged in as regular user
* -1 -> Error (not logged in, invalid session, etc.)
*/
int smb_session_is_guest(smb_session *s);
/**
* @brief Returns the server name with the <XX> type
*
* @param s The session object
* @return The server name or NULL. The memory is owned by the session object.
*/
const char *smb_session_server_name(smb_session *s);
/**
* @brief Check if a feature is supported/has been negociated with the server
*
* @param s The session object
* @param what Which features to check ? @see smb_session_supports_what
*
* @return 0 if the feature is not supported, something else otherwise
*/
int smb_session_supports(smb_session *s, int what);
/**
* @brief Get the last NT_STATUS
* @details Valid only if a smb_ function returned the DSM_ERROR_NT error.
*
* @param s The session object
*/
uint32_t smb_session_get_nt_status(smb_session *s);
#endif
|
/*
* Copyright (C) 2008-2012 The QXmpp developers
*
* Author:
* Olivier Goffart <ogoffart@woboq.com>
*
* Source:
* http://code.google.com/p/qxmpp
*
* This file is a part of QXmpp library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
#ifndef QXMPPRESULTSET_H
#define QXMPPRESULTSET_H
#include "QXmppElement.h"
#include <QDateTime>
class QXmlStreamWriter;
class QDomElement;
/// \brief The QXmppResultSetQuery class represents a set element in a query
/// as defined by XEP-0059: Result Set Management.
class QXMPP_EXPORT QXmppResultSetQuery
{
public:
QXmppResultSetQuery();
int max() const;
void setMax(int max);
int index() const;
void setIndex(int index);
QString before() const;
void setBefore(const QString &before );
QString after() const;
void setAfter(const QString &after );
bool isNull() const;
/// \cond
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
/// \endcond
private:
int m_index;
int m_max;
QString m_after;
QString m_before;
};
/// \brief The QXmppResultSetReply class represents a set element in a reply
/// as defined by XEP-0059: Result Set Management.
class QXMPP_EXPORT QXmppResultSetReply
{
public:
QXmppResultSetReply();
QString first() const;
void setFirst(const QString &first );
QString last() const;
void setLast(const QString &last );
int count() const;
void setCount(int count);
int index() const;
void setIndex(int index);
bool isNull() const;
/// \cond
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
/// \endcond
private:
int m_count;
int m_index;
QString m_first;
QString m_last;
};
#endif // QXMPPRESULTSET_H
|
#ifndef LAPIDUSVISCOSITYCOEFFICIENT_H
#define LAPIDUSVISCOSITYCOEFFICIENT_H
#include "Material.h"
#include "EquationOfState.h"
class LapidusViscosityCoefficient;
template<>
InputParameters validParams<LapidusViscosityCoefficient>();
/**
* Computes dissipative fluxes for entropy viscosity method
*/
class LapidusViscosityCoefficient : public Material
{
public:
LapidusViscosityCoefficient(const std::string & name, InputParameters parameters);
virtual ~LapidusViscosityCoefficient();
protected:
virtual void initQpStatefulProperties();
virtual void computeQpProperties();
// Coupled variables
VariableValue & _h;
VariableValue & _hu;
// Coupled gradient
VariableGradient & _vel_grad;
// Lapidus parameter
Real _Ce;
// Equation of state
const EquationOfState & _eos;
// material to compute
MaterialProperty<Real> & _kappa_old;
MaterialProperty<Real> & _kappa;
MaterialProperty<Real> & _kappa_max;
};
#endif /* LAPIDUSVISCOSITYCOEFFICIENT_H */
|
//
// libavg - Media Playback Engine.
// Copyright (C) 2003-2011 Ulrich von Zadow
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Current versions can be found at www.libavg.de
//
#ifndef _FXNode_H_
#define _FXNode_H_
#include "../api.h"
#include "../graphics/GPUFilter.h"
#include <boost/shared_ptr.hpp>
namespace avg {
class AVG_API FXNode {
public:
FXNode();
virtual ~FXNode();
virtual void connect();
virtual void disconnect();
virtual void setSize(const IntPoint& newSize);
virtual void apply(GLTexturePtr pSrcTex);
GLTexturePtr getTex();
BitmapPtr getImage();
FRect getRelDestRect() const;
bool isDirty() const;
void resetDirty();
protected:
FBOPtr getFBO();
void setDirty();
void errorIfGLES() const;
private:
virtual GPUFilterPtr createFilter(const IntPoint& size) = 0;
IntPoint m_Size;
GPUFilterPtr m_pFilter;
bool m_bDirty;
};
typedef boost::shared_ptr<FXNode> FXNodePtr;
}
#endif
|
/***
Copyright (C) 2012 Lennart Poettering
Copyright (C) 2013 Kay Sievers
Copyright (C) 2015 Johannes Löthberg
yadu is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
yadu 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 yadu; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <time.h>
#include <limits.h>
#include <bsd/string.h>
#include <unistd.h>
#include <errno.h>
#include "util.h"
#include "time-dst.h"
#define FORMAT_TIMESTAMP_MAX ((4*4+1)+11+9+4+1) /* weekdays can be unicode */
static const char *jump_str(int delta_minutes, char *s, size_t size) {
if (delta_minutes == 60) {
return "one hour forward";
} else if (delta_minutes == -60) {
return "one hour backwards";
} else if (delta_minutes < 0) {
snprintf(s, size, "%i minutes backwards", -delta_minutes);
return s;
} else if (delta_minutes > 0) {
snprintf(s, size, "%i minutes forward", delta_minutes);
return s;
} else {
return "";
}
}
int main(int argc, char ** argv) {
if (argc != 2) {
fprintf(stderr, "Usage: %s TIMEZONE\n", argv[0]);
exit(2);
}
if (getenv("TZ")) {
fprintf(stderr, "Warning: Ignoring the TZ variable.\n");
setenv("TZ", argv[1], 1);
}
// make path variable
char path[PATH_MAX] = "/usr/share/zoneinfo/";
strlcat(path, argv[1], PATH_MAX);
if(access(path, F_OK|R_OK) == -1) {
fprintf(stderr, "TZ file `%s' does not exist or is not readable\n", path);
exit(2);
}
// get current time
struct timespec tms;
if (clock_gettime(CLOCK_REALTIME, &tms)) {
return -1;
}
time_t time_cur,
time_next;
_cleanup_free_ char * zone_cur = NULL,
* zone_next = NULL;
int delta_next = 0;
bool is_dstc = false,
is_dstn = false;
int r = time_get_dst(tms.tv_sec, path,
&time_cur, &zone_cur, &is_dstc,
&time_next, &delta_next, &zone_next, &is_dstn);
if (r < 0) {
printf(" DST active: %s\n", "n/a");
} else {
printf(" DST active: %s\n", yes_no(is_dstc));
char a[FORMAT_TIMESTAMP_MAX];
char b[FORMAT_TIMESTAMP_MAX];
time_t time;
time = time_cur - 1;
struct tm tm;
strftime(a, ELEMENTSOF(a), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&time, &tm));
strftime(b, ELEMENTSOF(b), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&time_cur, &tm));
printf(" Last DST change: DST %s at\n"
" %.*s\n"
" %.*s\n",
is_dstc ? "began" : "ended",
(int)sizeof(a), a,
(int)sizeof(b), b);
char s[32];
time = time_next - 1;
strftime(a, ELEMENTSOF(a), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&time, &tm));
strftime(b, ELEMENTSOF(b), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&time_next, &tm));
printf(" Next DST change: DST %s (the clock jumps %s) at\n"
" %.*s\n"
" %.*s\n",
is_dstn ? "begins" : "ends",
jump_str(delta_next, s, sizeof(s)),
(int) sizeof(a), a,
(int) sizeof(b), b);
}
return 0;
}
|
/* $Id: mgd_style.h 6491 2001-04-01 00:23:49Z emile $
Copyright (C) 1999 Jukka Zitting <jukka.zitting@iki.fi>
Copyright (C) 2000 The Midgard Project ry
Copyright (C) 2000 Emile Heyns, Aurora SA <emile@iris-advies.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 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 MGD_STYLE_H
#define MGD_STYLE_H
extern MGD_FUNCTION(ret_type, walk_style_tree, (type param));
extern MGD_FUNCTION(ret_type, is_style_owner, (type param));
extern MGD_FUNCTION(ret_type, list_styles, (type param));
extern MGD_FUNCTION(ret_type, get_style, (type param));
extern MGD_FUNCTION(ret_type, get_style_by_name, (type param));
extern MGD_FUNCTION(ret_type, create_style, (type param));
extern MGD_FUNCTION(ret_type, update_style, (type param));
extern MGD_FUNCTION(ret_type, delete_style, (type param));
extern MGD_FUNCTION(ret_type, copy_style, (type param));
extern MGD_FUNCTION(ret_type, move_style, (type param));
extern MGD_FUNCTION(ret_type, delete_style_tree, (type param));
#endif
|
#ifndef IVE_LOD
#define IVE_LOD 1
#include <osg/LOD>
#include "ReadWrite.h"
namespace ive
{
class LOD : public osg::LOD, public ReadWrite
{
public:
void write(DataOutputStream *out);
void read(DataInputStream *in);
};
}
#endif |
/* Copyright (C) 1997-2005 Luke Howard.
This file is part of the nss_ldap library.
Contributed by Luke Howard, <lukeh@padl.com>, 1997.
The nss_ldap 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.
The nss_ldap 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 the nss_ldap library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_IRS_H
#include <errno.h>
#include "irs-nss.h"
/* $Id$ */
#ifdef HAVE_USERSEC_H
void *pr_pvtinit (void);
#endif
IRS_EXPORT void pr_close (struct irs_pr *);
IRS_EXPORT struct protoent *pr_byname (struct irs_pr *, const char *);
IRS_EXPORT struct protoent *pr_bynumber (struct irs_pr *, int);
IRS_EXPORT struct protoent *pr_next (struct irs_pr *);
IRS_EXPORT void pr_rewind (struct irs_pr *);
IRS_EXPORT void pr_minimize (struct irs_pr *);
struct pvt
{
struct protoent result;
char buffer[NSS_BUFLEN_PROTOCOLS];
ent_context_t *state;
};
IRS_EXPORT struct protoent *
pr_byname (struct irs_pr *this, const char *name)
{
LOOKUP_NAME (name, this, _nss_ldap_filt_getprotobyname, LM_PROTOCOLS,
_nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT);
}
IRS_EXPORT struct protoent *
pr_bynumber (struct irs_pr *this, int num)
{
LOOKUP_NUMBER (num, this, _nss_ldap_filt_getprotobynumber, LM_PROTOCOLS,
_nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT);
}
IRS_EXPORT void
pr_close (struct irs_pr *this)
{
LOOKUP_ENDENT (this);
#ifdef HAVE_USERSEC_H
free (this->private);
free (this);
#endif
}
IRS_EXPORT struct protoent *
pr_next (struct irs_pr *this)
{
LOOKUP_GETENT (this, _nss_ldap_filt_getprotoent, LM_PROTOCOLS,
_nss_ldap_parse_proto, LDAP_NSS_BUFLEN_DEFAULT);
}
IRS_EXPORT void
pr_rewind (struct irs_pr *this)
{
LOOKUP_SETENT (this);
}
IRS_EXPORT void
pr_minimize (struct irs_pr *this)
{
}
#ifdef HAVE_USERSEC_H
void *
pr_pvtinit (void)
#else
struct irs_pr *
irs_ldap_pr (struct irs_acc *this)
#endif
{
struct irs_pr *pr;
struct pvt *pvt;
pr = calloc (1, sizeof (*pr));
if (pr == NULL)
return NULL;
pvt = calloc (1, sizeof (*pvt));
if (pvt == NULL)
{
free (pr);
return NULL;
}
pvt->state = NULL;
pr->private = pvt;
pr->close = pr_close;
pr->next = pr_next;
pr->byname = pr_byname;
pr->bynumber = pr_bynumber;
pr->rewind = pr_rewind;
pr->minimize = pr_minimize;
return pr;
}
#endif /*HAVE_IRS_H */
|
/*
*
* SOCLIB_LGPL_HEADER_BEGIN
*
* This file is part of SoCLib, GNU LGPLv2.1.
*
* SoCLib is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 of the License.
*
* SoCLib 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 SoCLib; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* SOCLIB_LGPL_HEADER_END
*
* Copyright (c) CITI/INSA, 2009
*
* Authors:
* Ludovic L'Hours <ludovic.lhours@insa-lyon.fr>
* Antoine Fraboulet <antoine.fraboulet@insa-lyon.fr>
* Tanguy Risset <tanguy.risset@insa-lyon.fr>
*
*/
#ifndef LOADWORD_H
#define LOADWORD_H
#include <iostream>
#include <systemc.h>
#include <base_module.h>
#include <fifo_ports.h>
namespace soclib { namespace caba {
template <unsigned int INPUT_BITWIDTH,
unsigned int OUTPUT_BITWIDTH ,
bool SWAP_IN = false, bool SWAP_OUT = false >
class LoadWord : BaseModule {
public:
sc_in < bool > p_clk;
sc_in < bool > p_resetn;
FifoInput< sc_uint< INPUT_BITWIDTH > > p_input;
FifoOutput< sc_uint< OUTPUT_BITWIDTH > > p_output;
private:
void transition ();
void genMoore ();
void genMealy();
struct State {
unsigned int num;
bool outputValid;
bool outputValidKnown;
bool doLoad;
bool isLast;
unsigned int loadPosition;
State *next;
State(int n) : num(n), outputValid(false), doLoad(false),
isLast(false), next(NULL) { }
void setDoLoad(unsigned int position) {
doLoad = true;
loadPosition = position;
}
void setOutputValid(bool valid) {
outputValid = valid;
outputValidKnown = true;
}
friend std::ostream& operator<<(std::ostream& stream, const State& state) {
stream << state.num << " " << (state.outputValidKnown ?
(state.outputValid ? "Valid " : "NotValid ") : "Unknown ")
<< (state.doLoad ? (signed int)state.loadPosition : -1) << " "
<< (state.next ? state.next->num : 0);
return stream;
}
};
State *start, *current;
unsigned int shiftRegSize;
unsigned long long data;
void build();
protected:
SC_HAS_PROCESS (LoadWord);
public:
LoadWord (sc_module_name insname);
~LoadWord () {
// delete states from start
}
};
}} // end of soclib::caba
#endif
|
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSensors module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QHOLSTERSENSOR_H
#define QHOLSTERSENSOR_H
#include <QtSensors/qsensor.h>
QT_BEGIN_NAMESPACE
class QHolsterReadingPrivate;
class Q_SENSORS_EXPORT QHolsterReading : public QSensorReading
{
Q_OBJECT
Q_PROPERTY(bool holstered READ holstered)
DECLARE_READING(QHolsterReading)
public:
bool holstered() const;
void setHolstered(bool holstered);
};
class Q_SENSORS_EXPORT QHolsterFilter : public QSensorFilter
{
public:
virtual bool filter(QHolsterReading *reading) = 0;
private:
bool filter(QSensorReading *reading) Q_DECL_OVERRIDE;
};
class Q_SENSORS_EXPORT QHolsterSensor : public QSensor
{
Q_OBJECT
public:
explicit QHolsterSensor(QObject *parent = 0);
~QHolsterSensor();
QHolsterReading *reading() const;
static char const * const type;
private:
Q_DISABLE_COPY(QHolsterSensor)
};
QT_END_NAMESPACE
#endif
|
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture, development version *
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#ifndef SOFA_HELPER_UTILS_H
#define SOFA_HELPER_UTILS_H
#include <sofa/helper/helper.h>
#include <string>
#include <map>
namespace sofa
{
namespace helper
{
/// @brief Contains possibly useful functions, that don't fit anywhere else.
class SOFA_HELPER_API Utils
{
public:
/// @brief Convert a string to a wstring.
///
/// @return The converted string on success, or a empty string on failure.
static std::wstring widenString(const std::string& s);
/// @brief Convert a wstring to a string.
///
/// @return The converted string on success, or a empty string on failure.
static std::string narrowString(const std::wstring& ws);
/// @brief Convert a string to lower case.
static std::string downcaseString(const std::string& s);
/// @brief Convert a string to upper case.
static std::string upcaseString(const std::string& s);
#if defined WIN32 || defined _XBOX
/// @brief Simple wrapper around the Windows function GetLastError().
///
/// This function calls ::GetLastError along with the boilerplate code for
/// formatting, and converts the result to a non-wide string with narrowString().
static std::string GetLastError();
#endif
/// @brief Get the path of the executable that is currently running.
///
/// Note that this function uses various non-portable tricks to achieve its
/// goal, and it might not be the most reliable thing ever written.
static const std::string& getExecutablePath();
/// @brief Get the path to the directory of the executable that is currently running.
static const std::string& getExecutableDirectory();
/// @brief Get the path where plugins are located
/// @deprecated Use sofa::helper::system::PluginRepository.getFirstPath() instead.
static const std::string& getPluginDirectory();
/// @brief Get the path to the "root" path of Sofa (i.e. the build directory or
/// the installation prefix).
///
/// @warning This function is meant to be used only by the applications that are
/// distributed with SOFA: it deduces the "root" path from the path of the
/// executable that is currently running. (It returns the path to the parent of
/// the "bin" directory.)
static const std::string& getSofaPathPrefix();
/// @brief Read a file written in a very basic ini-like format.
///
/// For each line that contains a '=' character, (e.g. "key=value"), the returned
/// map will contains a pair <"key", "value">. Other lines will be ignored.
static std::map<std::string, std::string> readBasicIniFile(const std::string& path);
};
} // namespace helper
} // namespace sofa
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <stdlib.h>
#include <libebook/e-book.h>
#include "ebook-test-utils.h"
gint
main (gint argc,
gchar **argv)
{
EBook *book;
const gchar *caps;
g_type_init ();
/*
* Setup
*/
book = ebook_test_utils_book_new_temp (NULL);
ebook_test_utils_book_open (book, FALSE);
/*
* Sync version
*/
caps = ebook_test_utils_book_get_static_capabilities (book);
test_print ("successfully retrieved static capabilities: '%s'\n", caps);
ebook_test_utils_book_remove (book);
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.