text stringlengths 4 6.14k |
|---|
void disable_sleep_skip();
void init_sleep_skip();
|
#include "headers.h"
#include "stRect.h"
#include "stCircle.h"
#include "stSphere.h"
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_FPS = 60;
const GLfloat PROJECTION_HEIGHT = 100.0f;
const GLfloat PROJECTION_WIDTH = 100.0f;
const GLfloat PROJECTION_DEPTH = 100.0f;
const int MIN_WIDTH = 50;
const int MIN_HEIGHT = 50;
//Ugh...globals. But they'll do for now.
std::vector<Shape*> geometry;
//Rect* rect;
bool generated = false;
GLfloat xVel = 0.0f;
GLfloat yVel = 0.0f;
GLfloat zVel = 0.0f;
GLfloat xRot = 0.0f;
GLfloat yRot = 0.0f;
GLfloat zRot = 0.0f;
bool cwWinding = false;
bool backfaceCull = true;
bool depthTest = false;
bool backfaceLines = false;
void render();
void update();
void resize(GLsizei w, GLsizei h);
void initGL();
void handleKeys(unsigned char key, int x, int y);
void specialKeys(int key, int x, int y);
void specialKeysUp(int key, int x, int y);
void runLoop(int val);
void processMenu(int value);
void setSettings();
//Honestly, these are just convenience functions.
bool shiftDown();
bool controlDown();
|
#ifndef SKYBOX_H
# define SKYBOX_H
# include <LZ/cubemap.h>
# include <LZ/mesh.h>
# include <LZ/shader.h>
# include <LZ/camera.h>
class Skybox
{
private:
lz::Cubemap *m_cubemap;
lz::Mesh *m_cube;
lz::Shader *m_shader;
void generateCubeMesh();
public:
Skybox(lz::Cubemap *cubemap);
~Skybox();
void render(lz::Camera *camera);
};
#endif
|
/*
* This file is protected by Copyright. Please refer to the COPYRIGHT file
* distributed with this source distribution.
*
* This file is part of GNUHAWK.
*
* GNUHAWK is free software: you can redistribute it and/or modify is under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* GNUHAWK is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef or_ss_4i_GH_BLOCK_H
#define or_ss_4i_GH_BLOCK_H
#include <gr_component.h>
#include <gr_or_ss.h>
typedef GHComponent< gr_or_ss > GnuHawkBlock;
#endif
|
/*
Copyright © 2011-2012 Clint Bellanger
Copyright © 2013 Kurt Rinnert
Copyright © 2014 Henrik Andersson
This file is part of FLARE.
FLARE 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.
FLARE 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
FLARE. If not, see http://www.gnu.org/licenses/
*/
/**
* class WidgetButton
*/
#ifndef WIDGET_BUTTON_H
#define WIDGET_BUTTON_H
#include "CommonIncludes.h"
#include "Widget.h"
#include "WidgetLabel.h"
#include "TooltipData.h"
class WidgetTooltip;
const int BUTTON_GFX_NORMAL = 0;
const int BUTTON_GFX_PRESSED = 1;
const int BUTTON_GFX_HOVER = 2;
const int BUTTON_GFX_DISABLED = 3;
class WidgetButton : public Widget {
private:
std::string fileName; // the path to the buttons background image
Sprite *buttons;
WidgetLabel wlabel;
Color color_normal;
Color color_disabled;
TooltipData tip_buf;
TooltipData tip_new;
WidgetTooltip *tip;
TooltipData checkTooltip(Point mouse);
public:
WidgetButton(const std::string& _fileName = "images/menus/buttons/button_default.png");
~WidgetButton();
void activate();
void setPos(int offset_x = 0, int offset_y = 0);
void loadArt();
bool checkClick();
bool checkClick(int x, int y);
void render();
void refresh();
std::string label;
std::string tooltip;
bool enabled;
bool pressed;
bool hover;
};
#endif
|
/**
* @file Filter.h
* @author Thomas Saquet, Florent Poinsaut
* @date
* @brief File containing example of doxygen usage for quick reference.
*
* Alert - Dbo is the database objects library, part of the Alert software
* Copyright (C) 2013-2017
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef FILTER_H
#define FILTER_H
#include "tools/MainIncludeFile.h"
namespace Echoes
{
namespace Dbo
{
class Filter : public Table {
public:
Filter();
Filter(const Filter& orig);
virtual ~Filter();
static std::string TRIGRAM;
int nbValue;
int posKeyValue;
Wt::Dbo::ptr<FilterType> filterType;
Wt::Dbo::ptr<Search> search;
Wt::Dbo::collection<Wt::Dbo::ptr<InformationData>> informationDatas;
template<class Action>
void persist(Action& a)
{
mapClassAttributesInts["NB_VALUE"] = &this->nbValue;
mapClassAttributesInts["POS_KEY_VALUE"] = &this->posKeyValue;
Table::fieldFiller(a, *this);
Wt::Dbo::belongsTo(a, filterType, TRIGRAM_FILTER SEP TRIGRAM_FILTER_TYPE);
Wt::Dbo::belongsTo(a, search, TRIGRAM_FILTER SEP TRIGRAM_SEARCH);
Wt::Dbo::hasMany(a, informationDatas, Wt::Dbo::ManyToOne, TRIGRAM_INFORMATION_DATA SEP TRIGRAM_FILTER);
}
private:
};
}
}
#endif /* FILTER_H */
|
#include <zlib.h>
#include "bwtaln.h"
#include "utils.h"
#include "kseq.h"
KSEQ_INIT(gzFile, gzread)
extern unsigned char nst_nt4_table[256];
struct __bwa_seqio_t {
kseq_t *ks;
};
bwa_seqio_t *bwa_seq_open(const char *fn)
{
gzFile fp;
bwa_seqio_t *bs;
bs = (bwa_seqio_t*)calloc(1, sizeof(bwa_seqio_t)); //bwa_seqio_t is just a wrapper around kseq_t. it has no other members
fp = xzopen(fn, "r");
bs->ks = kseq_init(fp); //returns kseq_t where kseq_t->f is kstream_t enclosing the gz file fp
return bs;
}
void bwa_seq_close(bwa_seqio_t *bs)
{
if (bs == 0) return;
gzclose(bs->ks->f->f);
kseq_destroy(bs->ks);
free(bs);
}
//is_comp == 0 when using colorpsace like we are
void seq_reverse(int len, ubyte_t *seq, int is_comp)
{
int i;
if (is_comp) { //this does not make sense.
// a = 0 0b00000000
// c = 1 0b00000001
// g = 2 0b00000010
// t = 3 0b00000011
// a' = t = 0b00000011
// c' = g = 0b00000010
// g' = c = 0b00000001
// t' = a = 0b00000000
for (i = 0; i < len>>1; ++i) {
char tmp = seq[len-1-i];
if (tmp < 4) tmp = 3 - tmp; //don't totally understsand this
seq[len-1-i] = (seq[i] >= 4)? seq[i] : 3 - seq[i];
seq[i] = tmp;
}
if (len&1) seq[i] = (seq[i] >= 4)? seq[i] : 3 - seq[i]; //swap middle (or not if there is none)
} else { //for color reads, we can freely swap bits because pairs match... assuming the sequence isn't packed.
for (i = 0; i < len>>1; ++i) { //iterate through half
char tmp = seq[len-1-i]; //save last-i char
seq[len-1-i] = seq[i]; seq[i] = tmp; //swap last-i and first+i char. set first to saved.
}
}
}
int bwa_trim_read(int trim_qual, bwa_seq_t *p)
{
int s = 0, l, max = 0, max_l = p->len - 1;
if (trim_qual < 1 || p->qual == 0) return 0;
for (l = p->len - 1; l >= BWA_MIN_RDLEN - 1; --l) {
s += trim_qual - (p->qual[l] - 33);
if (s < 0) break;
if (s > max) {
max = s; max_l = l;
}
}
p->clip_len = p->len = max_l + 1;
return p->full_len - p->len;
}
/**
bwa_seq_t reads fastq seqs out from bs into an array of type bwa_seq_t.
It will try to read up to n_needed, returning the actual number of seqs in the passed reference 'n'.
is_comp defines whether or not the seqs are in colorspace or not. if(is_comp), seq is not in colorspace.
it's necessary to correctly reverse the order of a colorspace'd sequence.
*/
bwa_seq_t *bwa_read_seq(bwa_seqio_t *bs, int n_needed, int *n, int is_comp, int trim_qual)
{
bwa_seq_t *seqs, *p;
kseq_t *seq = bs->ks;
int n_seqs, l, i;
long n_trimmed = 0, n_tot = 0;
n_seqs = 0;
seqs = (bwa_seq_t*)calloc(n_needed, sizeof(bwa_seq_t));
while ((l = kseq_read(seq)) >= 0) {
p = &seqs[n_seqs++];
p->tid = -1; // no assigned to a thread
p->qual = 0;
p->full_len = p->clip_len = p->len = l;
n_tot += p->full_len;
p->seq = (ubyte_t*)calloc(p->len, 1);
for (i = 0; i != p->full_len; ++i)
p->seq[i] = nst_nt4_table[(int)seq->seq.s[i]]; //convert char into [0-5]. don't pack yet
if (seq->qual.l) { // copy quality
p->qual = (ubyte_t*)strdup((char*)seq->qual.s);
if (trim_qual >= 1) n_trimmed += bwa_trim_read(trim_qual, p);
}
p->rseq = (ubyte_t*)calloc(p->full_len, 1);
memcpy(p->rseq, p->seq, p->len); //copy seq into rseq (seq`)
seq_reverse(p->len, p->seq, 0); // *IMPORTANT*: will be reversed back in bwa_refine_gapped()
seq_reverse(p->len, p->rseq, is_comp); //is_comp == false for colorspace
p->name = strdup((const char*)seq->name.s);
{ // trim /[12]$
int t = strlen(p->name);
if (t > 2 && p->name[t-2] == '/' && (p->name[t-1] == '1' || p->name[t-1] == '2')) p->name[t-2] = '\0';
}
if (n_seqs == n_needed) break;
}
*n = n_seqs;
if (n_seqs && trim_qual >= 1)
fprintf(stderr, "[bwa_read_seq] %.1f%% bases are trimmed.\n", 100.0f * n_trimmed/n_tot);
if (n_seqs == 0) {
free(seqs);
return 0;
}
return seqs;
}
void bwa_free_read_seq(int n_seqs, bwa_seq_t *seqs)
{
int i;
for (i = 0; i != n_seqs; ++i) {
bwa_seq_t *p = seqs + i;
free(p->name);
free(p->seq); free(p->rseq); free(p->qual); free(p->aln); free(p->md);
free(p->cigar);
}
free(seqs);
}
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/rpc/CPedRPCs.h
* PURPOSE: Header for ped RPC class
* DEVELOPERS: Jax <>
* Stanislav Bobrov <lil_toady@hotmail.com>
* Alberto Alonso <rydencillo@gmail.com>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CPedRPCs_H
#define __CPedRPCs_H
#include "CRPCFunctions.h"
class CPedRPCs : public CRPCFunctions
{
public:
static void LoadFunctions ( void );
DECLARE_RPC ( SetPedArmor );
DECLARE_RPC ( SetPedRotation );
DECLARE_RPC ( GivePedJetPack );
DECLARE_RPC ( RemovePedJetPack );
DECLARE_RPC ( RemovePedClothes );
DECLARE_RPC ( SetPedGravity );
DECLARE_RPC ( SetPedChoking );
DECLARE_RPC ( SetPedFightingStyle );
DECLARE_RPC ( SetPedMoveAnim );
DECLARE_RPC ( WarpPedIntoVehicle );
DECLARE_RPC ( RemovePedFromVehicle );
DECLARE_RPC ( SetPedDoingGangDriveby );
DECLARE_RPC ( SetPedAnimation );
DECLARE_RPC ( SetPedOnFire );
DECLARE_RPC ( SetPedHeadless );
DECLARE_RPC ( SetPedFrozen );
DECLARE_RPC ( ReloadPedWeapon );
};
#endif |
/*
wiring_serial.c - serial functions.
Part of Arduino - http://www.arduino.cc/
Copyright (c) 2005-2006 David A. Mellis
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
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
*/
#include "wiring_private.h"
// Define constants and variables for buffering incoming serial data. We're
// using a ring buffer (I think), in which rx_buffer_head is the index of the
// location to which to write the next incoming character and rx_buffer_tail
// is the index of the location from which to read.
#define RX_BUFFER_SIZE 128
unsigned char rx_buffer[RX_BUFFER_SIZE];
int rx_buffer_head = 0;
int rx_buffer_tail = 0;
void beginSerial(long baud)
{
#if defined(__AVR_ATmega168__)
UBRR0H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1);
// enable rx and tx
sbi(UCSR0B, RXEN0);
sbi(UCSR0B, TXEN0);
// enable interrupt on complete reception of a byte
sbi(UCSR0B, RXCIE0);
#else
UBRRH = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
UBRRL = ((F_CPU / 16 + baud / 2) / baud - 1);
// enable rx and tx
sbi(UCSRB, RXEN);
sbi(UCSRB, TXEN);
// enable interrupt on complete reception of a byte
sbi(UCSRB, RXCIE);
#endif
// defaults to 8-bit, no parity, 1 stop bit
}
void serialWrite(unsigned char c)
{
#if defined(__AVR_ATmega168__)
while (!(UCSR0A & (1 << UDRE0)))
;
UDR0 = c;
#else
while (!(UCSRA & (1 << UDRE)))
;
UDR = c;
#endif
}
int serialAvailable()
{
return (RX_BUFFER_SIZE + rx_buffer_head - rx_buffer_tail) % RX_BUFFER_SIZE;
}
int serialRead()
{
// if the head isn't ahead of the tail, we don't have any characters
if (rx_buffer_head == rx_buffer_tail) {
return -1;
} else {
unsigned char c = rx_buffer[rx_buffer_tail];
rx_buffer_tail = (rx_buffer_tail + 1) % RX_BUFFER_SIZE;
return c;
}
}
void serialFlush()
{
// don't reverse this or there may be problems if the RX interrupt
// occurs after reading the value of rx_buffer_head but before writing
// the value to rx_buffer_tail; the previous value of rx_buffer_head
// may be written to rx_buffer_tail, making it appear as if the buffer
// were full, not empty.
rx_buffer_head = rx_buffer_tail;
}
#if defined(__AVR_ATmega168__)
SIGNAL(SIG_USART_RECV)
#else
SIGNAL(SIG_UART_RECV)
#endif
{
#if defined(__AVR_ATmega168__)
unsigned char c = UDR0;
#else
unsigned char c = UDR;
#endif
int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE;
// if we should be storing the received character into the location
// just before the tail (meaning that the head would advance to the
// current location of the tail), we're about to overflow the buffer
// and so we don't write the character or advance the head.
if (i != rx_buffer_tail) {
rx_buffer[rx_buffer_head] = c;
rx_buffer_head = i;
}
}
void printMode(int mode)
{
// do nothing, we only support serial printing, not lcd.
}
void printByte(unsigned char c)
{
serialWrite(c);
}
void printNewline()
{
printByte('\n');
}
void printString(const char *s)
{
while (*s)
printByte(*s++);
}
void printIntegerInBase(unsigned long n, unsigned long base)
{
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
unsigned long i = 0;
if (n == 0) {
printByte('0');
return;
}
while (n > 0) {
buf[i++] = n % base;
n /= base;
}
for (; i > 0; i--)
printByte(buf[i - 1] < 10 ?
'0' + buf[i - 1] :
'A' + buf[i - 1] - 10);
}
void printInteger(long n)
{
if (n < 0) {
printByte('-');
n = -n;
}
printIntegerInBase(n, 10);
}
void printHex(unsigned long n)
{
printIntegerInBase(n, 16);
}
void printOctal(unsigned long n)
{
printIntegerInBase(n, 8);
}
void printBinary(unsigned long n)
{
printIntegerInBase(n, 2);
}
/* Including print() adds approximately 1500 bytes to the binary size,
* so we replace it with the smaller and less-confusing printString(),
* printInteger(), etc.
void print(const char *format, ...)
{
char buf[256];
va_list ap;
va_start(ap, format);
vsnprintf(buf, 256, format, ap);
va_end(ap);
printString(buf);
}
*/
|
// -----------------------------------------------
// This file is script-generated...
// -----------------------------------------------
#ifndef DESIG_MOTION_PATTERN_H
#define DESIG_MOTION_PATTERN_H
namespace vdis
{
typedef enum
{
DESIG_MOTION_PATTERN_DES_MOT_PATT_NO_STATEMENT = 0,
DESIG_MOTION_PATTERN_DES_MOT_PATT_ROPING = 1,
DESIG_MOTION_PATTERN_DES_MOT_PATT_SNAKING = 2,
DESIG_MOTION_PATTERN_END
} desig_motion_pattern_e;
}
#endif
|
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
float test1(int cond, float a, float b) {
return cond ? a : b;
}
double test2(int cond, float a, double b) {
return cond ? a : b;
}
void f();
void test3(){
1 ? f() : (void)0;
}
void test4() {
int i; short j;
float* k = 1 ? &i : &j;
}
void test5() {
const int* cip;
void* vp;
cip = 0 ? vp : cip;
}
void test6();
void test7(int);
void* test8() {return 1 ? test6 : test7;}
void _efree(void *ptr);
void _php_stream_free3() {
(1 ? free(0) : _efree(0));
}
void _php_stream_free4() {
1 ? _efree(0) : free(0);
}
// PR5526
struct test9 { int a; };
void* test9spare();
void test9(struct test9 *p) {
p ? p : test9spare();
}
// CHECK: @test10
// CHECK: select i1 {{.*}}, i32 4, i32 5
int test10(int c) {
return c ? 4 : 5;
}
enum { Gronk = 5 };
// rdar://9289603
// CHECK: @test11
// CHECK: select i1 {{.*}}, i32 4, i32 5
int test11(int c) {
return c ? 4 : Gronk;
}
// CHECK: @test12
// CHECK: select i1 {{.*}}, double 4.0{{.*}}, double 2.0
double test12(int c) {
return c ? 4.0 : 2.0;
}
|
/*
* Copyright (c) 1995, Danny Gasparovski
* Parts Copyright (c) 2001 Kelly "STrRedWolf" Price
*
* Please read the file COPYRIGHT for the
* terms and conditions of the copyright.
*/
#ifdef FULL_BOLT
#define WANT_SYS_IOCTL_H
#endif
#include <slirp.h>
void lcp_lowerdown(int unit);
struct ttys *ttys_unit[MAX_INTERFACES];
int slirp_forked;
struct ttys *
tty_attach(unit, device)
int unit;
char *device;
{
char buff[256], *bptr;
struct ttys *ttyp, *ttyp_tmp, *ttyp_last = 0;
struct stat stat;
DEBUG_CALL("tty_attach");
DEBUG_ARG("unit = %d", unit);
DEBUG_ARG("device = %lx", (long)device);
if ((ttyp = (struct ttys *)malloc(sizeof(struct ttys))) == NULL)
return 0;
memset(ttyp, 0, sizeof(struct ttys));
ttyp->next = 0;
ttyp->fd = 0; /* Default changed from -1 -RedWolf */
/* Only open the device if there is one */
if (device) {
if ((ttyp->fd = open(device, O_RDWR )) < 0) {
free(ttyp);
return 0; /* XXXXX */
}
lprint ("Opening device %s...\r\n\r\n", device);
}
/* Link it to the *tail* of the list XXXXX */
if (!ttys) {
ttys = ttyp;
} else {
for (ttyp_tmp = ttys; ttyp_tmp; ttyp_tmp = ttyp_tmp->next)
ttyp_last = ttyp_tmp;
/* XXX More checks? */
ttyp_last->next = ttyp;
}
#ifdef FULL_BOLT
fd_nonblock(ttyp->fd);
#endif
if (ttyp->fd >= 0 && isatty(ttyp->fd) && fstat(ttyp->fd, &stat) == 0) {
/* Save the current permissions */
ttyp->mode = stat.st_mode;
#ifdef HAVE_FCHMOD
fchmod(ttyp->fd, S_IRUSR|S_IWUSR);
#else
chmod(ttyname(ttyp->fd), S_IRUSR|S_IWUSR);
#endif
}
ttyp->unit = unit;
#ifndef FULL_BOLT
ttyp->towrite = towrite_max;
#endif
#ifndef FULL_BOLT
ttyp->baud = DEFAULT_BAUD;
ttyp->bytesps = ttyp->baud/10;
#endif
ttyp->lastime = curtime;
ttyp->sc_xc_state = 0;
ttyp->sc_rc_state = 0;
/* Default is SLIP */
ttyp->proto = PROTO_SLIP;
ttyp->up = 1; /* SLIP is always up */
ttyp->if_input = sl_input;
ttyp->if_encap = sl_encap;
ttys_unit[unit] = ttyp;
/* Rawify the terminal, if applicable */
if (ttyp->fd >= 0)
term_raw(ttyp);
/* Config the new tty */
if ((bptr = (char *)getenv("HOME")))
snprintf(buff, sizeof(buff), "%s/.slirprc-%d", bptr, unit);
else
snprintf(buff, sizeof(buff), ".slirprc-%d", unit);
config(buff, ttyp->unit);
return ttyp;
}
void
tty_detached(ttyp, exiting)
struct ttys *ttyp;
int exiting;
{
struct ttys *ttyp_tmp, *ttyp_last = 0;
DEBUG_CALL("tty_detached");
DEBUG_ARG("ttyp = %lx", (long)ttyp);
DEBUG_ARG("exiting = %d", exiting);
/* First, remove ttyp from the queue */
if (ttyp == ttys) {
ttys = ttys->next;
} else {
for (ttyp_tmp = ttys; ttyp_tmp; ttyp_tmp = ttyp_tmp->next) {
if (ttyp_tmp == ttyp)
break;
ttyp_last = ttyp_tmp;
}
if (!ttyp_last) { /* XXX */
/* Can't find it *shrug* */
return;
}
ttyp_last->next = ttyp->next;
}
term_restore(ttyp);
#ifdef FULL_BOLT
fd_block(ttyp->fd);
#endif
/* Restore device mode */
if (ttyp->mode)
fchmod(ttyp->fd, ttyp->mode);
/* Bring the link down */
#ifdef USE_PPP
/*
* Call lcp_lowerdown if it's ppp
*/
if (ttyp->proto == PROTO_PPP) {
lcp_lowerdown(ttyp->unit);
phase = PHASE_DEAD; /* XXXXX */
}
#endif
/*
* Kill the guardian, if it exists
*/
if (ttyp->pid)
kill(ttyp->pid, SIGQUIT);
/*
* If this was the last tty and we're not restarting, exit
*/
if (!ttys && slirp_socket < 0 && !exiting)
slirp_exit(0);
if(ttyp->fd != 0) /* Dont close stdin, we need it on exit */
close(ttyp->fd);
if (ttyp->m)
m_free(ttyp->m);
/*
* If this was the controlling tty, call ctty_detached
*/
if ((ttyp->flags & TTY_CTTY) && !exiting)
ctty_detached();
#ifdef USE_PPP
/* Deallocate compress data */
ppp_ccp_closed(ttyp);
#endif
ttys_unit[ttyp->unit] = 0;
/*
* If you love it, set it free() ...
* If it comes back, we have a memory leak
*/
free(ttyp);
detach_time = curtime;
}
/*
* Called when controlling tty has detached
*/
void
ctty_detached()
{
int retval;
DEBUG_CALL("ctty_detached");
ctty_closed = 0;
/*
* Song and dance to detach from ctty but not be orphaned. This
* madness is because we don't want to stay attached to the old
* tty (thus potentially blocking it, or getting random signals
* from it), but if we detach from it with setsid(), we end up
* as an "orphaned process group". As such we can't write to
* another terminal, so we fork once and have the child start a
* new process group, which makes the child not an orphan, but
* clutters up the process table with yet a third slirp process.
* Better ways to do this would be most appreciated.
*/
if (slirp_forked) {
/* Shouldn't happen, but don't want to fork() again if it does */
return;
}
/* Really get detached */
if (fork())
exit(0);
(void) setsid(); /* new session */
retval = fork();
if (retval < 0)
return; /*shrug*/
if (retval) /* parent idles *sigh* */
snooze();
slirp_forked = 1;
retval = setpgid(0, 0); /* child in new process group */
/* if (retval < 0)
* return;
*/
/*
* Nuke stdin to get off old, useless tty
* (stdout and stderr were already nuked in main_init())
*/
retval = open("/dev/null", O_RDWR);
dup2(retval, 0);
if (retval > 0)
close(retval);
}
|
#include "../apue.h"
#include <wchar.h>
#include <stdint.h>
int main (int argc, char* argv[])
{
int ret = 0;
char buf[1024] = { 0 };
if (argc < 4)
{
printf ("Usage: fsprintf str int flt\n");
return -1;
}
char const* str = argv[1];
int n = atoi (argv[2]);
float f = atof (argv[3]);
printf ("-: %-5s, %-5d, %-5x, %-5o, %-5f\n", str, n, n, n, f);
printf ("+: %+5s, %+5d, %+5x, %+5o, %+5f\n", str, n, n, n, f);
printf (" : % 5s, % 5d, % 5x, % 5o, % 5f\n", str, n, n, n, f);
printf ("#: %#5s, %#5d, %#5x, %#5o, %#5f\n", str, n, n, n, f);
printf ("0: %05s, %05d, %05x, %05o, %05f\n", str, n, n, n, f);
printf ("*: %*s, %.*s, %*d, %*f, %*.*f\n", n, str, n, str, n, n, n, f, n, n, f);
//printf ("*: %1$*s, %1$*d, %1$*f, %1$*.1$*f\n", n, str, n, f, f);
//printf ("*: %1$*2$s, %1$*3$d, %1$*4$f, %1$*.1$*5$f\n", n, str, n, f, f);
printf ("*: %2$*1$s, %3$*1$d, %4$*1$f, %5$.*1$f\n", n, str, n, f, f);
printf ("': %'d, %'5.5f\n", n, f);
char c = -1; //'c';
printf ("hh: %hhd, %hhu\n", c, c);
short s = -1;
printf ("h: %hd, %hu\n", s, s);
long long ll = -1;
printf ("ll: %lld, %llu\n", ll, ll);
intmax_t imt = -1;
uintmax_t uimt = -1;
printf ("j: %jd, %ju\n", imt, uimt);
size_t st = -1;
printf ("z: %zd, %zu\n", st, st);
ptrdiff_t pdt = -1;
printf ("t: %td, %tu\n", pdt, pdt);
long double pi = 3.1415926539798626;
printf ("L: %.20Lf\n", pi);
int n1= 0, n2 = 0, n3 = 0;
double dbl = 2.1832939029393;
n3 = sprintf (buf, "dbl: %.10f,%n%.10e,%n%a\n", dbl, &n1, dbl, &n2, dbl);
printf ("%s", buf);
printf ("n1 = %d, n2 = %d, n3 = %d\n", n1, n2, n3);
printf ("%.*s\n", n1, buf);
printf ("%.*s\n", n2, buf);
sprintf (buf, "%s some appends\n", buf);
printf ("after append: \n");
printf ("%s", buf);
wchar_t const* ws = L"ni hao ma";
printf ("ls: %s, %ls, %S, %p\n", ws, ws, ws, ws);
return 0;
}
|
//
// Copyright (C) 2018- David Hedbor <neotron@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#pragma once
#include "Event.h"
namespace Journal {
class EventPayLegacyFines : public Event {
public:
EventPayLegacyFines(const QJsonObject &obj, const JFile *file);
private:
};
}
|
////////////////////////////////////////////////////////////////////////////
// Created : 04.02.2008
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////
#ifndef PHYSICS_STEP_COUNTER_H_INCLUDED
#define PHYSICS_STEP_COUNTER_H_INCLUDED
class step_counter_ref;
class step_counter
{
u32 m_count;
friend class step_counter_ref;
public:
step_counter( ):m_count( 0 ) {};
inline void step ( ) { ++m_count; }
inline bool is_equal ( const step_counter &sc ) const { return sc.m_count == m_count; }
inline bool multiple_of ( u32 i ) const { return remainder_of( i ) == 0; }
inline u32 remainder_of( u32 i ) const { return m_count%i ; }
private:
inline step_counter( const step_counter& c ): m_count( c.m_count ) {};
inline const step_counter& operator= ( const step_counter& c ) { m_count = c.m_count; return *this; };
inline void invalidate ( ){ m_count = u32(-1); }
}; // class step_counter
class step_counter_ref
{
step_counter m_step_counter;
public:
inline step_counter_ref( const step_counter& c ): m_step_counter( c ) {}
inline step_counter_ref( ){ m_step_counter.invalidate(); }
public:
inline bool is_equal ( const step_counter_ref &sr ) const { return sr.m_step_counter.is_equal( m_step_counter ); }
inline bool multiple_of ( u32 i ) const { return m_step_counter.multiple_of( i ); }
inline u32 remainder_of ( u32 i ) const { return m_step_counter.remainder_of( i ); }
inline const step_counter_ref& operator= ( const step_counter_ref& c ) { m_step_counter = c.m_step_counter; return *this; };
}; // class step_counter_ref
#endif |
#ifndef LIB_NL2PARK_MODE_H
#define LIB_NL2PARK_MODE_H
#include "../../Stream/Chunk.h"
#include "CustomFriction.h"
namespace NoLimits {
namespace NoLimits2 {
class Mode: public Stream::Chunk {
public:
enum Operation {
ClosedCircuit = 0,
Shuttle = 1,
Scripted = 2
};
enum SplinePosition {
CenterOfRail = 0,
HeartLineCurrentStyle = 1,
Custom = 2
};
enum PhysicsModel {
NoLimits2 = 0,
NoLimits2CustomFriction = 3,
NoLimits22 = 4,
NoLimits16 = 1,
NoLimits1 = 2
};
Mode() {
customFriction = new CustomFriction();
setOperationMode(Operation::ClosedCircuit);
setPhysicsModel(PhysicsModel::NoLimits22);
setSplinePosition(SplinePosition::CenterOfRail);
setSplinePositionOffset(glm::vec2(0.0f));
}
void debug() {
std::cout << "Mode[getOperationMode]: " << getOperationMode() << std::endl;
std::cout << "Mode[getPhysicsModel]: " << getPhysicsModel() << std::endl;
std::cout << "Mode[getSplinePosition]: " << getSplinePosition() << std::endl;
std::cout << "Mode[getSplinePositionOffset]: " << Helper::debug(getSplinePositionOffset()) << std::endl;
getCustomFriction()->debug();
}
Operation getOperationMode() const;
void setOperationMode(const Operation &value);
PhysicsModel getPhysicsModel() const;
void setPhysicsModel(const PhysicsModel &value);
SplinePosition getSplinePosition() const;
void setSplinePosition(const SplinePosition &value);
CustomFriction *getCustomFriction() const;
glm::vec2 getSplinePositionOffset() const;
void setSplinePositionOffset(const glm::vec2 &value);
private:
Operation operationMode;
PhysicsModel physicsModel;
SplinePosition splinePosition;
glm::vec2 splinePositionOffset;
CustomFriction *customFriction;
};
}
}
#endif // LIB_NL2PARK_MODE_H
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QtGlobal>
#include <QtQuick/qquickwindow.h>
#include "nodeinstanceserver.h"
#include <designersupportdelegate.h>
QT_BEGIN_NAMESPACE
class QQuickItem;
class QQmlEngine;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
class QQuickRenderControl;
class QRhi;
class QRhiTexture;
class QRhiRenderBuffer;
class QRhiTextureRenderTarget;
class QRhiRenderPassDescriptor;
#endif
QT_END_NAMESPACE
namespace QmlDesigner {
class Qt5NodeInstanceServer : public NodeInstanceServer
{
Q_OBJECT
public:
Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
~Qt5NodeInstanceServer() override;
QQuickView *quickView() const override;
QQuickWindow *quickWindow() const override;
QQmlView *declarativeView() const override;
QQuickItem *rootItem() const override;
void setRootItem(QQuickItem *item) override;
QQmlEngine *engine() const override;
void refreshBindings() override;
DesignerSupport *designerSupport();
void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override;
QImage grabWindow() override;
QImage grabItem(QQuickItem *item) override;
static QQuickItem *parentEffectItem(QQuickItem *item);
protected:
void initializeView() override;
void resizeCanvasToRootItem() override;
void resetAllItems();
void setupScene(const CreateSceneCommand &command) override;
QList<QQuickItem*> allItems() const;
struct RenderViewData {
QPointer<QQuickWindow> window = nullptr;
QQuickItem *rootItem = nullptr;
QQuickItem *contentItem = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool bufferDirty = true;
QQuickRenderControl *renderControl = nullptr;
QRhi *rhi = nullptr;
QRhiTexture *texture = nullptr;
QRhiRenderBuffer *buffer = nullptr;
QRhiTextureRenderTarget *texTarget = nullptr;
QRhiRenderPassDescriptor *rpDesc = nullptr;
#endif
};
virtual bool initRhi(RenderViewData &viewData);
virtual QImage grabRenderControl(RenderViewData &viewData);
virtual bool renderWindow();
private:
RenderViewData m_viewData;
DesignerSupport m_designerSupport;
QQmlEngine *m_qmlEngine = nullptr;
};
} // QmlDesigner
|
#ifndef STEADYSTATEKALMANFILTERPARAMETERS_H
#define STEADYSTATEKALMANFILTERPARAMETERS_H
#include <boost/checked_delete.hpp>
#include "kalmanfilterparameters.h"
namespace ribi {
namespace kalman {
///Parameters for the standard Kalman filter
struct SteadyStateKalmanFilterParameters : public KalmanFilterParameters
{
explicit SteadyStateKalmanFilterParameters(
const boost::numeric::ublas::matrix<double>& control,
const boost::numeric::ublas::matrix<double>&
est_opt_kalman_gain, //estimated_optimal_kalman_gain
const boost::numeric::ublas::vector<double>&
initial_state_est, //initial_state_estimate
const boost::numeric::ublas::matrix<double>& observation,
const boost::numeric::ublas::matrix<double>& state_transition
);
///Calculate the optimal Kalman gain
static boost::numeric::ublas::matrix<double> CalculateOptimalKalmanGain(
const boost::numeric::ublas::matrix<double>& initial_covariance,
const boost::numeric::ublas::matrix<double>& measurement_noise,
const boost::numeric::ublas::matrix<double>& observation,
const boost::numeric::ublas::matrix<double>& state_transition);
///Obtain the (estimated) optimal Kalman gain ('K')
const boost::numeric::ublas::matrix<double>& GetEstimatedOptimalKalmanGain() const
{ return m_estimated_optimal_kalman_gain; }
///Obtain the Kalman filter type as an enum
KalmanFilterType GetType() const { return KalmanFilterType::steady_state; }
///Check if this parameter set has a certain type of KalmanFilterParameter
static bool HasParameterType(const KalmanFilterParameterType type);
private:
///Can only be deleted by boost::checked_delete
~SteadyStateKalmanFilterParameters() noexcept {}
friend void boost::checked_delete<>(SteadyStateKalmanFilterParameters*);
///K: Estimated optimal Kalman gain
const boost::numeric::ublas::matrix<double> m_estimated_optimal_kalman_gain;
};
///Check if two parameter sets are equal with a fuzzy compare
bool IsAboutEqual(
const SteadyStateKalmanFilterParameters& lhs,
const SteadyStateKalmanFilterParameters& rhs
);
} //~namespace kalman
} //~namespace ribi
#endif // STEADYSTATEKALMANFILTERPARAMETERS_H
|
/*
* Copyright (C) 2011-2013 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2013 MaNGOS <http://getmangos.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 _MAPREFMANAGER
#define _MAPREFMANAGER
#include "RefManager.h"
class MapReference;
class MapRefManager : public RefManager<Map, Player>
{
public:
typedef LinkedListHead::Iterator< MapReference > iterator;
typedef LinkedListHead::Iterator< MapReference const > const_iterator;
MapReference* getFirst() { return (MapReference*)RefManager<Map, Player>::getFirst(); }
MapReference const* getFirst() const { return (MapReference const*)RefManager<Map, Player>::getFirst(); }
MapReference* getLast() { return (MapReference*)RefManager<Map, Player>::getLast(); }
MapReference const* getLast() const { return (MapReference const*)RefManager<Map, Player>::getLast(); }
iterator begin() { return iterator(getFirst()); }
iterator end() { return iterator(NULL); }
iterator rbegin() { return iterator(getLast()); }
iterator rend() { return iterator(NULL); }
const_iterator begin() const { return const_iterator(getFirst()); }
const_iterator end() const { return const_iterator(NULL); }
};
#endif
|
#ifndef _CTPane_
#define _CTPane_
#include "winctrl.h"
#include "TContainer.h"
/**
* Dialog³»¿¡¼ÀÇ ¿µ¿ªº°·Î child controlµéÀ» ±¸ºÐÇϱâ À§ÇÑ Container class
* - Ŭ¶óÀ̾ðÆ®ÀÇ CChatRoomDlg¿¡¼ À§/¾Æ·¡ ¿µ¿ªÀÌ ÀÌ Container class·Î ±¸ºÐµÇ¾î ÀÖ´Ù.
*
* @Author ÃÖÁ¾Áø
* @Data 2005/8/30
*/
class TGAMECTRL_API CTPane : public CWinCtrl
{
public:
CTPane(void);
virtual ~CTPane(void);
virtual void Update( POINT ptMouse );
virtual void Draw();
virtual unsigned Process( unsigned uiMsg, WPARAM wParam, LPARAM lParam );
virtual void MoveWindow( POINT pt );
virtual void Show();
virtual void Hide();
virtual void AddChild( CWinCtrl* pCtrl );
virtual void DelChildAll();
virtual void DelChild( CWinCtrl* pCtrl );
virtual CWinCtrl* FindChild( unsigned iID );
virtual CWinCtrl* Find( const char * szName );
virtual CWinCtrl* Find( int iID );
public:
CJContainer m_Children;
};
#endif |
#pragma once
#include <mordor/fibersynchronization.h>
#include <boost/shared_ptr.hpp>
#include <queue>
#include <string>
#include <utility>
namespace lightning {
class StreamReassembler {
public:
typedef boost::shared_ptr<StreamReassembler> ptr;
StreamReassembler();
void addChunk(uint64_t position,
boost::shared_ptr<std::string> data);
void setEnd(uint64_t endPosition);
boost::shared_ptr<std::string> nextChunk();
private:
typedef std::pair<uint64_t, boost::shared_ptr<std::string> > Chunk;
struct ChunkCompare {
bool operator()(const Chunk& a, const Chunk& b) const {
return a.first > b.first;
}
};
typedef std::priority_queue<Chunk,
std::vector<Chunk>,
ChunkCompare>
ChunkHeap;
ChunkHeap chunks_;
uint64_t readPosition_;
uint64_t endPosition_;
static const uint64_t kUnknownEndPosition = ~0ull;
Mordor::FiberEvent nextChunkAvailable_;
Mordor::FiberMutex mutex_;
};
} // namespace lightning
|
/*! \file project.h
* \brief Описание интерфейса класса, описывающего проект
* \date 20.01.16
* \author Бубенщиков А.И.
*/
#ifndef PROJECT_H
#define PROJECT_H
#include <QtCore>
/*!
* \brief Класс, описывающий проект
*/
class Project
{
private:
/// Id проекта
quint32 _id;
/// Название проекта
QString _name;
public:
Project();
Project(quint32 id, QString name);
bool operator ==(quint32 id) const;
//========== Интерфейсные методы доступа для чтения к закрытым полям класса=================
quint32 getId() const;
QString getName() const;
//========== Интерфейсные методы доступа для записи к закрытым полям класса=================
void setId(quint32 id);
void setName(QString name);
//==========================================================================================
///Метод, проверяющий объект на валидность
bool isValid() const;
/*!
* \brief Метод синхронизирует объект БД
* \param id проекта с которым будет выполнена синхронизация
* \throws NeedFixCode если воркер, передаваемый аргументом не валидный
* \throws SqlQueryExcepiton если произошла ошибка запроса к базе данных
*/
void synhronizeWithDb(quint32 id);
bool isEqual(const Project& other) const;
};
Q_DECLARE_METATYPE(Project)
#endif // PROJECT_H
|
/*
* Entangle: Tethered Camera Control & Capture
*
* Copyright (C) 2009-2015 Daniel P. Berrange
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <config.h>
#include "entangle-debug.h"
#include "entangle-progress.h"
void entangle_progress_start(EntangleProgress *prog, float target, const char *msg)
{
g_return_if_fail(ENTANGLE_IS_PROGRESS(prog));
ENTANGLE_PROGRESS_GET_INTERFACE(prog)->start(prog, target, msg);
}
void entangle_progress_update(EntangleProgress *prog, float current)
{
g_return_if_fail(ENTANGLE_IS_PROGRESS(prog));
ENTANGLE_PROGRESS_GET_INTERFACE(prog)->update(prog, current);
}
void entangle_progress_stop(EntangleProgress *prog)
{
g_return_if_fail(ENTANGLE_IS_PROGRESS(prog));
ENTANGLE_PROGRESS_GET_INTERFACE(prog)->stop(prog);
}
GType
entangle_progress_get_type(void)
{
static GType progress_type = 0;
if (!progress_type) {
progress_type =
g_type_register_static_simple(G_TYPE_INTERFACE, "EntangleProgress",
sizeof(EntangleProgressInterface),
NULL, 0, NULL, 0);
g_type_interface_add_prerequisite(progress_type, G_TYPE_OBJECT);
}
return progress_type;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* tab-width: 8
* End:
*/
|
// Clock.h
#ifndef _CLOCK_h
#define _CLOCK_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
#include <ds3231.h>
class Clock {
private:
ts date;
ts date12h;
unsigned short updateTime = 0;
unsigned long lastUpdate = 0;
public:
Clock();
void setDate(const ts *date);
const ts* getDate();
ts getDate24h();
void update();
void setUpdateTime(unsigned short);
};
#endif
|
#include <string.h>
#include "dino.h"
#include "ccp4.h"
#include "dbm.h"
#include "mat.h"
#include "xtal.h"
#include "Cmalloc.h"
#include "com.h"
#include "io_spider.h"
extern int debug_mode;
static void dump_header(struct SPIDER_MAP_HEADER *h)
{
fprintf(stderr,"[DEBUG]SPIDER HEADER DUMP\n");
fprintf(stderr,"nslice: %f\n",h->fNslice);
fprintf(stderr,"nrow: %f\n",h->fNrow);
fprintf(stderr,"ncol: %f\n",h->fNcol);
fprintf(stderr,"labrec: %f\n",h->fLabrec);
fprintf(stderr,"iform: %f\n",h->fIform);
fprintf(stderr,"xoff: %f\n",h->fXoff);
fprintf(stderr,"yoff: %f\n",h->fYoff);
fprintf(stderr,"zoff: %f\n",h->fZoff);
fprintf(stderr,"scale: %f\n",h->fScale);
}
int spiderRead(FILE *f, dbmScalNode *sn)
{
struct SPIDER_MAP_HEADER header;
int size,ret,hlen;
int u,v,w,pointer,size2;
void *raw_data;
float *raw_data_float;
int *raw_data_byte;
char message[256];
int mode;
// check if swap is required
fread(&header,sizeof(struct SPIDER_MAP_HEADER),1,f);
if(header.fIform<-10.0 || header.fIform>10.0 || (int)header.fIform==0) {
// try swapping
sn->swap_flag=1;
swap_4bs((unsigned char*)&header, sizeof(header)/4.0);
if(header.fIform<-10 || header.fIform>10.0 || (int)header.fIform==0) {
comMessage("spiderRead: failed (even after byte swap)\n");
return -1;
} else {
comMessage("(byte-swapping)\n");
}
}
if(debug_mode) dump_header(&header);
if(header.fIform==3.0) {
mode=1;
} else if(header.fIform==10.0) {
mode=2;
} else {
comMessage("spiderRead: can only read modes 3 (3D float) or 10 (3D int)\n");
return -1;
}
if(header.fScale<=0.0) {
header.fScale=1.0;
comMessage("spiderRead: invalid scale parameter set to 1.0\n");
}
// size to skip forward to
size = (int)(header.fNcol * header.fLabrec * 4); //Size of whole header
size -= sizeof(struct SPIDER_MAP_HEADER); //Decrease the real header
fseek(f,size,SEEK_CUR);
size=(int)header.fNslice*(int)header.fNrow*(int)header.fNcol;
size2=(int)header.fNrow*(int)header.fNcol;
sn->field=Cmalloc(sizeof(struct SCAL_FIELD));
sn->field->size=size;
if(sn->field==NULL) {
comMessage("spiderRead: memory allocation error\n");
return -1;
}
//allocate memory for actual data
sn->field->data=Ccalloc(size,sizeof(float));
// allocate temp memory
if(mode==1) {
raw_data=Ccalloc(size2,sizeof(float));
} else {
raw_data=Ccalloc(size2,sizeof(int));
}
if(sn->field==NULL || raw_data==NULL) {
comMessage("spiderRead: memory allocation error\n");
Cfree(sn->field);
Cfree(raw_data);
return -1;
}
sn->field->u_size=(int)(header.fNcol);
sn->field->v_size=(int)(header.fNrow);
sn->field->w_size=(int)(header.fNslice);
sn->field->u1=0;
sn->field->v1=0;
sn->field->w1=0;
sn->field->u2=sn->field->u1+sn->field->u_size-1;
sn->field->v2=sn->field->v1+sn->field->v_size-1;
sn->field->w2=sn->field->w1+sn->field->w_size-1;
sn->field->wrap=0;
sn->field->offset_x=(double)header.fXoff;
sn->field->offset_y=(double)header.fYoff;
sn->field->offset_z=(double)header.fZoff;
sn->field->sigma=1.0;
sn->field->scale=1.0;
//sn->field->scale=(double)header.fScale;
//if(sn->field->scale<=0.0) sn->field->scale=1.0;
memset(sn->field->data,0,size);
for(w=0;w<(int)header.fNslice;w++) {
// read into raw data slice per slice
if(mode==1) {
ret=fread(raw_data,sizeof(float),size2,f);
raw_data_float=(float *)raw_data;
} else {
ret=fread(raw_data,sizeof(int),size2,f);
raw_data_byte=(int *)raw_data;
}
if(sn->swap_flag) {
swap_4bs(raw_data,size2);
}
for(v=0;v<(int)header.fNrow;v++) {
for(u=0;u<(int)header.fNcol;u++) {
pointer=(int)header.fNcol*v+u;
if(mode==1)
scalWriteField(sn->field,u,v,w,(float)raw_data_float[pointer]);
else
scalWriteField(sn->field,u,v,w,(float)raw_data_byte[pointer]);
}
}
}
Cfree(raw_data);
sprintf(message,
"u_size, v_size, w_size: %d,%d,%d\n\n",
sn->field->u_size,sn->field->v_size, sn->field->w_size);
debmsg(message);
scalCELLtoVECT(sn->field,
1.0,1.0,1.0,
90.0, 90.0, 90.0,
header.fScale, header.fScale, header.fScale);
return 0;
}
|
/*******************************************************************************
* libQtGoogleDrive - Google Drive API implementation based on the Qt Framework.
* Copyright (C) 2012 Vladislav Navrocky
*
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the BSD 2-Clause License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef GOOGLE_DRIVE_COMMAND_GET_H
#define GOOGLE_DRIVE_COMMAND_GET_H
#include "authorized_command.h"
#include "file_info.h"
namespace GoogleDrive
{
class CommandGetPrivate;
/**
* @brief Gets a file's metadata by ID
*/
class CommandGet : public AuthorizedCommand
{
Q_OBJECT
public:
CommandGet(Session* session);
QString fields() const;
void setFields(const QString& v);
const FileInfo& resultFileInfo() const;
public slots:
void exec(const QString& id);
protected:
void reexecuteQuery();
private slots:
void queryFinished();
private:
Q_DECLARE_PRIVATE(CommandGet)
};
}
#endif
|
//
// Sprite.h
// NinjaShooter
//
// Created by Gabi Shaar on 16/1/13.
// Copyright (c) 2013 Gabi Shaar. All rights reserved.
//
#import "GRNode.h"
@interface Sprite : GRNode
- (id)initWithFile:(NSString *)fileName effect:(GLKBaseEffect *)effect;
@end
|
/*********************************************************************
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.32 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with a license and should not be re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GUIConf.c
Purpose : Display controller initialization
---------------------------END-OF-HEADER------------------------------
*/
#include "GUI.h"
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
//
// Define the available number of bytes available for the GUI
//
#define GUI_NUMBYTES 0x280000
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUI_X_Config
*
* Purpose:
* Called during the initialization process in order to set up the
* available memory for the GUI.
*/
void GUI_X_Config(void) {
//
// 32 bit aligned memory area
//
static U32 aMemory[GUI_NUMBYTES / 4];
//
// Assign memory to emWin
//
GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
//
// Make sure enough tasks could be established
//
GUITASK_SetMaxTask(5);
}
/*************************** End of file ****************************/
|
#ifndef _LTFAT_MEX_FILE
#define _LTFAT_MEX_FILE
#define ISNARGINEQ 2
#define TYPEDEPARGS 0
#define SINGLEARGS
#define REALARGS
#define COMPLEXARGS
#define NOCOMPLEXFMTCHANGE
#endif /* _LTFAT_MEX_FILE */
#define MEX_FILE __BASE_FILE__
#include "ltfat_mex_template_helper.h"
#if defined(LTFAT_SINGLE) || defined(LTFAT_DOUBLE)
#include "ltfat_types.h"
#include "config.h"
static LTFAT_FFTW(plan) LTFAT_NAME(p_old) = 0;
static void LTFAT_NAME(dctMexAtExitFnc)()
{
if (LTFAT_NAME(p_old) != 0)
{
LTFAT_FFTW(destroy_plan)(LTFAT_NAME(p_old));
}
}
void
LTFAT_NAME(ltfatMexFnc)( int UNUSED(nlhs), mxArray *plhs[],
int UNUSED(nrhs), const mxArray *prhs[] )
{
// Register exit function only once
static int atExitFncRegistered = 0;
if (!atExitFncRegistered)
{
LTFAT_NAME(ltfatMexAtExit)(LTFAT_NAME(dctMexAtExitFnc));
atExitFncRegistered = 1;
}
LTFAT_REAL *c_r, *c_i = NULL;
const LTFAT_REAL *f_r, *f_i = NULL;
dct_kind kind = DSTI;
mwIndex L = mxGetM(prhs[0]);
mwIndex W = mxGetN(prhs[0]);
mwIndex type = (mwIndex) mxGetScalar(prhs[1]);
// Copy inputs and get pointers
if ( mxIsComplex(prhs[0]))
{
f_i = mxGetImagData(prhs[0]);
plhs[0] = ltfatCreateMatrix(L, W, LTFAT_MX_CLASSID, mxCOMPLEX);
c_i = mxGetImagData(plhs[0]);
}
else
{
plhs[0] = ltfatCreateMatrix(L, W, LTFAT_MX_CLASSID, mxREAL);
}
f_r = mxGetData(prhs[0]);
c_r = mxGetData(plhs[0]);
switch (type)
{
case 1:
kind = DSTI;
break;
case 2:
kind = DSTII;
break;
case 3:
kind = DSTIII;
break;
case 4:
kind = DSTIV;
break;
default:
mexErrMsgTxt("Unknown type.");
}
LTFAT_FFTW(plan) p = LTFAT_NAME(dst_init)( L, W, c_r, kind);
LTFAT_NAME(dctMexAtExitFnc)();
LTFAT_NAME(p_old) = p;
LTFAT_NAME(dst_execute)(p, f_r, L, W, c_r, kind);
if ( mxIsComplex(prhs[0]))
{
LTFAT_NAME(dst_execute)(p, f_i, L, W, c_i, kind);
}
return;
}
#endif
|
/* ------------------------------------------------------------------------------------------- */
/* */
/* This file is part of MAGE / pHTS (the performative HMM-based speech synthesis system) */
/* */
/* MAGE / pHTS is free software: you can redistribute it and/or modify it under the terms */
/* of the GNU General Public License as published by the Free Software Foundation, either */
/* version 3 of the license, or any later version. */
/* */
/* MAGE / pHTS 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 MAGE / pHTS. */
/* If not, see http://www.gnu.org/licenses/ */
/* */
/* */
/* Copyright 2011 University of Mons : */
/* */
/* Numediart Institute for New Media Art Technology (www.numediart.org) */
/* Acapela Group (www.acapela-group.com) */
/* */
/* */
/* Developed by : */
/* */
/* Maria Astrinaki, Geoffrey Wilfart, Alexis Moinet, Nicolas d'Alessandro, Thierry Dutoit */
/* */
/* ------------------------------------------------------------------------------------------- */
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"
// ofxMage
#include "pHTS.h"
#include "MAGE.h"
// ofxMage
//ofxThread
#include "ofxMageThread.h"
//ofxThread
//--------------------------------------------------------
class ofxMageThread;
class testApp : public ofBaseApp
{
public:
void setup();
void update();
void draw();
void exit();
void keyPressed (int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void audioRequested(float * input, int bufferSize, int nChannels);
// ofxMage
int _argc;
char **_argv;
MAGE_Environment *mage;
double duration;
int labelIndex;
char *label;
float buffer[1024];
// ofxMage
//ofxThread
ofxMageThread *MageThread;
//ofxThread
};
#endif
|
/* Glom
*
* Copyright (C) 2001-2004 Murray Cumming
*
* 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 GLOM_MODE_DESIGN_USERS_DIALOG_NEWSCRIPT_H
#define GLOM_MODE_DESIGN_USERS_DIALOG_NEWSCRIPT_H
#include <gtkmm/dialog.h>
#include <gtkmm/builder.h>
#include <gtkmm/entry.h>
namespace Glom
{
class Dialog_NewScript : public Gtk::Dialog
{
public:
static const char* glade_id;
static const bool glade_developer;
Dialog_NewScript(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
Gtk::Entry* m_entry_name;
};
} //namespace Glom
#endif //GLOM_MODE_DESIGN_USERS_DIALOG_NEWSCRIPT_H
|
#include <stdio.h>
#include <thread>
#include "BOS.h"
#include "Clamp.h"
#include "DEM.h"
#ifndef VIEWSHEDSONGPU_H
#define VIEWSHEDSONGPU_H
namespace TVS {
class Viewsheds {
public:
DEM &dem;
BOS &bos;
int sector_angle;
int ring_data_size;
int reserved_rings;
int computed_sectors;
int batches;
std::thread *ring_writer_threads;
Clamp cl;
ClDev *gpu;
ClProgram *program;
ClKernel *kernel;
ClMem *cumulative_surfaces;
ClMem *sector_rings;
ClMem *distances;
ClMem *elevations;
ClMem *band_deltas;
Viewsheds(DEM &, BOS &);
static void ringDataPath(char *, int);
static void threadedWrite(FILE *, int *, int, int);
void removeRingData();
void initialise();
void prepareMemory();
void prepareKernel();
void calculate(int);
void transferSectorData();
void transferToHost();
void writeRingData();
};
}
#endif
|
/************************************************************************
**
** @file vstandardtablecell.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina 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.
**
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VMULTISIZETABLEROW_H
#define VMULTISIZETABLEROW_H
#include <qcompilerdetection.h>
#include <QMap>
#include <QSharedDataPointer>
#include <QString>
#include <QStringList>
#include <QTypeInfo>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "vvariable.h"
class VContainer;
class VMeasurementData;
/**
* @brief The VMeasurement class keep data row of multisize table
*/
class VMeasurement :public VVariable
{
public:
VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base,
const qreal &ksize, const qreal &kheight, const QString &gui_text = QString(),
const QString &description = QString(), const QString &tagName = QString());
VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base, const QString &formula,
bool ok, const QString &gui_text = QString(), const QString &description = QString(),
const QString &tagName = QString());
VMeasurement(const VMeasurement &m);
virtual ~VMeasurement() override;
VMeasurement &operator=(const VMeasurement &m);
#ifdef Q_COMPILER_RVALUE_REFS
VMeasurement(const VMeasurement &&m) Q_DECL_NOTHROW;
VMeasurement &operator=(VMeasurement &&m) Q_DECL_NOTHROW;
#endif
QString GetGuiText() const;
QString TagName() const;
void setTagName(const QString &tagName);
QString GetFormula() const;
bool IsCustom() const;
int Index() const;
bool IsFormulaOk() const;
virtual bool IsNotUsed() const override;
virtual qreal GetValue() const override;
virtual qreal* GetValue() override;
VContainer *GetData();
void SetSize(qreal size);
void SetHeight(qreal height);
void SetUnit(const Unit *unit);
qreal GetBase() const;
void SetBase(const qreal &value);
qreal GetKsize() const;
void SetKsize(const qreal &value);
qreal GetKheight() const;
void SetKheight(const qreal &value);
static QStringList ListHeights(const QMap<GHeights, bool> &heights, Unit patternUnit);
static QStringList ListSizes(const QMap<GSizes, bool> &sizes, Unit patternUnit);
static QStringList WholeListHeights(Unit patternUnit);
static QStringList WholeListSizes(Unit patternUnit);
static bool IsGradationSizeValid(const QString &size);
static bool IsGradationHeightValid(const QString &height);
private:
QSharedDataPointer<VMeasurementData> d;
qreal CalcValue() const;
};
Q_DECLARE_TYPEINFO(VMeasurement, Q_MOVABLE_TYPE);
#endif // VMULTISIZETABLEROW_H
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "UITableViewCell.h"
@class UIImageView, UILabel, WAContactNameLabel;
__attribute__((visibility("hidden")))
@interface PersonTableViewCell : UITableViewCell
{
BOOL _personSelected;
UIImageView *_imageViewCheckMark;
WAContactNameLabel *_nameLabel;
UILabel *_statusLabel;
UILabel *_detailLabel;
}
@property(nonatomic) BOOL personSelected; // @synthesize personSelected=_personSelected;
@property(readonly, nonatomic) UILabel *detailLabel; // @synthesize detailLabel=_detailLabel;
@property(readonly, nonatomic) UILabel *statusLabel; // @synthesize statusLabel=_statusLabel;
@property(readonly, nonatomic) WAContactNameLabel *nameLabel; // @synthesize nameLabel=_nameLabel;
@property(readonly, nonatomic) UIImageView *imageViewCheckMark; // @synthesize imageViewCheckMark=_imageViewCheckMark;
- (id)accessibilityLabel;
- (BOOL)isAccessibilityElement;
- (void)setHighlighted:(BOOL)arg1 animated:(BOOL)arg2;
- (void)setSelected:(BOOL)arg1 animated:(BOOL)arg2;
- (void)updateBackgroundColor;
- (void)layoutSubviews;
- (id)initWithStyle:(int)arg1 reuseIdentifier:(id)arg2;
@end
|
#pragma once
#include "../Utils.h"
#include "../BaseClasses/BaseMonster.h"
class BaseTower : public BaseObject
{
public:
int attack_radius;
int attack_cooldown;
int towerx;
int towery;
int attack_damage;
bool cooling_down;
ElementType element_type;
//void Update(std::vector monster_list)
void Update();
/*
{
if( ! cooling_down )
{
// Needs a loop that can have items taken from it
// but will not loop forever
for(BaseMonster* monster : monster_list)
{
// Radius Check
if((monster.x - towerx)^2 + (monster.y - towery)^2 < attack_radius^2 )
{
if( Attack(monster) )
{
//remove this monster from list
}
else
{
break;
}
}
}
}
// Check if monster is in range
// if so we use an attack and use an animation for this
}
*/
bool Attack(BaseMonster* monster)
{
bool dead = false;
dead = monster->TakeDamage(attack_damage, element_type);
return dead;
}
};
|
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#if !defined(MSGPACK_PREDEF_H) || defined(MSGPACK_PREDEF_INTERNAL_GENERATE_TESTS)
#ifndef MSGPACK_PREDEF_H
#define MSGPACK_PREDEF_H
#endif
#include <rpc/msgpack/predef/language.h>
#include <rpc/msgpack/predef/architecture.h>
#include <rpc/msgpack/predef/compiler.h>
#include <rpc/msgpack/predef/library.h>
#include <rpc/msgpack/predef/os.h>
#include <rpc/msgpack/predef/other.h>
#include <rpc/msgpack/predef/platform.h>
#include <rpc/msgpack/predef/hardware.h>
#include <rpc/msgpack/predef/version.h>
#endif
|
#ifndef __MIMOSA_GENERIC_LD_H
#define __MIMOSA_GENERIC_LD_H
/*
* Copyright (C) 2010-2011
* "Mu Lei" known as "NalaGinrut" <NalaGinrut@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/>.
*/
#include <osconfig.h>
#include <global.h>
/* Align . to 8, it's maximum function alignment */
#define ALIGN_FUNC() . = ALIGN(8)
#define DATA_SECTION \
*(.data)
#define TEXT_SECTION \
ALIGN_FUNC(); \
*(.text) \
*(.stub .text.* .gnu.linkonce.t.*)
#define BSS_SECTION \
PROVIDE(__bss_start = .); \
*(.bss) \
PROVIDE(__bss_end = .);
#define STAB_SECTION \
PROVIDE(__STAB_BEGIN__ = .); \
*(.stab); \
PROVIDE(__STAB_END__ = .); \
#define STABSTR_SECTION \
PROVIDE(__STABSTR_BEGIN__ = .); \
*(.stabstr); \
PROVIDE(__STABSTR_END__ = .);
#define MK_RODATA(align) \
. = ALIGN((align)); \
.rodata : { \
*(.rodata) \
*(.rodata.*) \
*(.gnu.linkonce.r.*) \
}
#define RO_DATA MK_RODATA(PG_SIZE)
#endif
|
// Carlos Rodríguez Hernández.
// decHex1.
// Convierte valores decimales a hexadecimal.
// 06/12/2011
// 06/12/2011
#include <stdio.h>
char tablaConv[] = "0123456789ABCDEF";
void decHex(int num); // Declaración de la función decimalBinario
int main ()
{
int num; // Variable donde guarda el valor introducido
printf("Introduzca un valor decimal:"); // Pide al usuario un valor decimal
scanf("%d", &num);
decHex(num); // Llama a la función que realiza la conversión
printf("\n"); // Mejora la apariencia en el terminal
return 0;
}
void decHex(int num) // Definición de la función que convierte de decimal a hexadecimal
{
int resto; // Resto de las divisiones usadas en la conversión
int cociente; // Cociente de las divisiones usadas en la conversión
cociente = num/16; // Se divide entre base 16 porque es hexadecimal
resto = num%16;
if(cociente>15) // De la última división se coge el cociente primero y luego todos los restos
decHex(cociente); // Recursividad, vuelve a llamar a la función
else
printf("%c", tablaConv[cociente]);
printf("%c", tablaConv[resto]);
}
|
#ifndef ORBITALELEMENTSPLANET_H
#define ORBITALELEMENTSPLANET_H
#include "orbitalelements.h"
// -----------------------------------------------------------------------
class OrbitalElementsPlanet : public OrbitalElements
{
Q_OBJECT
Q_PROPERTY(float semiMajorAxisStart MEMBER m_semi_major_axis_start NOTIFY signalSemiMajorAxisStartChanged)
Q_PROPERTY(float semiMajorAxisPerCentury MEMBER m_semi_major_axis_per_century NOTIFY signalSemiMajorAxisPerCenturyChanged)
Q_PROPERTY(float eccentricityStart MEMBER m_eccentricity_start NOTIFY signalEccentricityStartChanged)
Q_PROPERTY(float eccentricityPerCentury MEMBER m_eccentricity_per_century NOTIFY signalEccentricityPerCenturyChanged)
Q_PROPERTY(float inclinationStart MEMBER m_inclination_start NOTIFY signalInclinationStartChanged)
Q_PROPERTY(float inclinationPerCentury MEMBER m_inclination_per_century NOTIFY signalInclinationPerCenturyChanged)
Q_PROPERTY(float meanLongitudeStart MEMBER m_mean_longitude_start NOTIFY signalMeanLongitudeStartChanged)
Q_PROPERTY(float meanLongitudePerCentury MEMBER m_mean_longitude_per_century NOTIFY signalMeanLongitudePerCenturyChanged)
Q_PROPERTY(float meanAnomalyParameterB MEMBER m_mean_anomaly_parameter_b NOTIFY signalMeanAnomalyParameterBChanged)
Q_PROPERTY(float meanAnomalyParameterC MEMBER m_mean_anomaly_parameter_c NOTIFY signalMeanAnomalyParameterCChanged)
Q_PROPERTY(float meanAnomalyParameterS MEMBER m_mean_anomaly_parameter_s NOTIFY signalMeanAnomalyParameterSChanged)
Q_PROPERTY(float meanAnomalyParameterF MEMBER m_mean_anomaly_parameter_f NOTIFY signalMeanAnomalyParameterFChanged)
Q_PROPERTY(float longitudeOfPeriapsisStart MEMBER m_longitude_of_periapsis_start NOTIFY signalLongitudeOfPeriapsisStartChanged)
Q_PROPERTY(float longitudeOfPeriapsisPerCentury MEMBER m_longitude_of_periapsis_per_century NOTIFY signalLongitudeOfPeriapsisPerCenturyChanged)
Q_PROPERTY(float longitudeOfAscendingNodeStart MEMBER m_longitude_of_ascending_node_start NOTIFY signalLongitudeOfAscendingNodeStartChanged)
Q_PROPERTY(float longitudeOfAscendingNodePerCentury MEMBER m_longitude_of_ascending_node_per_century NOTIFY signalLongitudeOfAscendingNodePerCenturyChanged)
public:
explicit OrbitalElementsPlanet(QObject *parent = 0);
virtual ~OrbitalElementsPlanet();
signals:
void signalSemiMajorAxisStartChanged();
void signalSemiMajorAxisPerCenturyChanged();
void signalEccentricityStartChanged();
void signalEccentricityPerCenturyChanged();
void signalInclinationStartChanged();
void signalInclinationPerCenturyChanged();
void signalMeanLongitudeStartChanged();
void signalMeanLongitudePerCenturyChanged();
void signalMeanAnomalyParameterBChanged();
void signalMeanAnomalyParameterCChanged();
void signalMeanAnomalyParameterSChanged();
void signalMeanAnomalyParameterFChanged();
void signalLongitudeOfPeriapsisStartChanged();
void signalLongitudeOfPeriapsisPerCenturyChanged();
void signalLongitudeOfAscendingNodeStartChanged();
void signalLongitudeOfAscendingNodePerCenturyChanged();
protected:
virtual void updateElements();
virtual void updateCoordinates();
private:
static const int NUM_ITERATIONS;
float m_semi_major_axis_start;
float m_semi_major_axis_per_century;
float m_eccentricity_start;
float m_eccentricity_per_century;
float m_inclination_start;
float m_inclination_per_century;
float m_mean_longitude_start;
float m_mean_longitude_per_century;
float m_mean_anomaly_parameter_b;
float m_mean_anomaly_parameter_c;
float m_mean_anomaly_parameter_s;
float m_mean_anomaly_parameter_f;
float m_longitude_of_periapsis_start;
float m_longitude_of_periapsis_per_century;
float m_longitude_of_ascending_node_start;
float m_longitude_of_ascending_node_per_century;
};
// -----------------------------------------------------------------------
#endif // ORBITALELEMENTSPLANET_H
|
/****************************************************************************
**
** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/private/qscenechange_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
struct QMetaObject;
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QComponent;
class QEntity;
class QT3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate
{
public:
QComponentRemovedChangePrivate(const QEntity *entity, const QComponent *component);
QNodeId m_entityId;
QNodeId m_componentId;
const QMetaObject *m_componentMetaObject;
};
} // namespace Qt3DCore
QT_END_NAMESPACE
#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
|
/**
* This header is generated by class-dump-z 0.1-11o.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*/
#import "ChatKit-Structs.h"
#import "UIModalViewDelegate.h"
#import "CKCachedImageBalloonView.h"
#import "NSString.h"
#import "CKTextMessagePart.h"
#import "CKRecipientListView.h"
#import "CKSMSComposeController.h"
#import "CKBalloonView.h"
#import "CKContentEntryBridge.h"
#import "ABNewPersonViewControllerDelegate.h"
#import "CKSMSService.h"
#import "CKGenericFileBalloonView.h"
#import "CKConversationList.h"
#import "CKImageData.h"
#import "AlwaysHighlightingPlacardButton.h"
#import "CKConversation.h"
#import "CKSMSEntity.h"
#import "CKDeletedMessagePart.h"
#import "CKRichContentView.h"
#import "CKTranscriptBubbleData.h"
#import "CKWebImageBalloonView.h"
#import "CKLoopbackMessage.h"
#import "CKUnknownMessagePart.h"
#import "CKContentOffsetAnimation.h"
#import "CKRecipientSelectionView.h"
#import "CKRecipientGenerator.h"
#import "CKMediaPreviewGenerator.h"
#import "UITableViewDataSource.h"
#import "CKEntity.h"
#import "CKLoopbackService.h"
#import "UITextContentViewDelegate.h"
#import "UITableViewDelegate.h"
#import "CKUnknownMediaObject.h"
#import "CKService.h"
#import "CKVideoMediaObject.h"
#import "CKMailComposeRecipient.h"
#import "CKEntityView.h"
#import "CKVCardMediaObject.h"
#import "CKWebviewBasedContentEntryBridge.h"
#import "CKWBMPImageMediaObject.h"
#import "CKMessageLinkedComposition.h"
#import "MailToolbarButton.h"
#import "CKContentEntryBridgeClient.h"
#import "NSObject.h"
#import "ABPeoplePickerNavigationControllerDelegate.h"
#import "CKTranscriptHeaderView.h"
#import "MailMultiSelectControl.h"
#import "CKImageBalloonView.h"
#import "CKFixedImageMediaObject.h"
#import "CKPhoneComposeRecipient.h"
#import "SMSWebDocumentView.h"
#import "CKSimpleBalloonView.h"
#import "CKMessageCell.h"
#import "CKSMSMessageDelivery.h"
#import "MFMailComposeViewControllerDelegate.h"
#import "CKContentEntryView.h"
#import "CKWebBalloonView.h"
#import "CKABNewPersonViewController.h"
#import "CKOverlayViewProtocol.h"
#import "CKMediaObjectManager.h"
#import "CKTranscriptController.h"
#import "CKVCalMediaObject.h"
#import "CKConversationListController.h"
#import "ABUnknownPersonViewControllerDelegate.h"
#import "CKAnimatedImageMediaObject.h"
#import "CKMessagePart.h"
#import "CKSummaryLabel.h"
#import "ComposeRecipientView.h"
#import "CKDraftManager.h"
#import "ABPersonViewControllerDelegate.h"
#import "UIImage.h"
#import "CKMessagePartURLProtocol.h"
#import "UIScrollViewDelegate.h"
#import "CKSMSBubblizationAnimation.h"
#import "CKImagePickerMediaPreviewGenerator.h"
#import "CKSendingProgressView.h"
#import "CKProperlyTransitioningNavigationItem.h"
#import "CKTimestampView.h"
#import "DOMEventListener.h"
#import "mSMSSendButtonView.h"
#import "CKSMSMessage.h"
#import "CKEntryField.h"
#import "CKAudioMediaObject.h"
#import "CKMessagePartComposeResourcePool.h"
#import "CKSMSDeferredMessage.h"
#import "CKProgressBar.h"
#import "CKTranscriptTableView.h"
#import "NSArray.h"
#import "CKMessageComposition.h"
#import "CKMediaObjectMessagePart.h"
#import "CKConversationListCell.h"
#import "CKMessageStandaloneComposition.h"
#import "CKTextContentView.h"
#import "CKWBMPImageData.h"
#import "CKCompressibleImageMediaObject.h"
#import "UIActionSheetDelegate.h"
#import "CKAtomListView.h"
#import "CKMessage.h"
#import "CKABUnknownPersonViewController.h"
#import "ComposeRecipient.h"
#import "CKLinksController.h"
#import "SMSComposeRecipientView.h"
#import "CKTranscriptStatusController.h"
#import "CKMessageEntryView.h"
#import "CKAVMediaObject.h"
#import "CKSelectedMessageCellView.h"
#import "CKMediaObject.h"
#import "CKMessageMediaEntryView.h"
#import "MailMultiSelectButton.h"
|
#ifndef MANTIDQTMANTIDWIDGETS_GENERICDATAPROCESSORPRESENTERFACTORY_H
#define MANTIDQTMANTIDWIDGETS_GENERICDATAPROCESSORPRESENTERFACTORY_H
#include "MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h"
namespace MantidQt {
namespace MantidWidgets {
/** @class GenericDataProcessorPresenterFactory
GenericDataProcessorPresenterFactory provides a common interface to
concrete factories creating a GenericDataProcessorPresenter.
Copyright © 2011-16 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid 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.
Mantid 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/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class GenericDataProcessorPresenterFactory {
public:
/**
Constructor
*/
GenericDataProcessorPresenterFactory() = default;
virtual ~GenericDataProcessorPresenterFactory() = default;
/**
Creates a GenericDataProcessorPresenter
*/
virtual std::unique_ptr<GenericDataProcessorPresenter> create() = 0;
};
}
}
#endif /*MANTIDQTMANTIDWIDGETS_GENERICDATAPROCESSORPRESENTERFACTORY_H*/ |
/**
******************************************************************************
* @addtogroup TauLabsCore Tau Labs Core components
* @{
* @addtogroup UAVObjects UAVObject set for this firmware
* @{
*
* @file baroairspeed.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author Tau Labs, http://taulabs.org, Copyright (C) 2012-2015
* @brief Implementation of the BaroAirspeed object. This file has been
* automatically generated by the UAVObjectGenerator.
*
* @note Object definition file: baroairspeed.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include "uavobjectmanager.h"
#include "baroairspeed.h"
// Private variables
static UAVObjHandle handle = NULL;
/**
* Initialize object.
* \return 0 Success
* \return -1 Failure to initialize or -2 for already initialized
*/
int32_t BaroAirspeedInitialize(void)
{
// Don't set the handle to null if already registered
if(UAVObjGetByID(BAROAIRSPEED_OBJID) != NULL)
return -2;
// Register object with the object manager
handle = UAVObjRegister(BAROAIRSPEED_OBJID,
BAROAIRSPEED_ISSINGLEINST, BAROAIRSPEED_ISSETTINGS, BAROAIRSPEED_NUMBYTES, &BaroAirspeedSetDefaults);
// Done
if (handle != 0)
{
return 0;
}
else
{
return -1;
}
}
/**
* Initialize object fields and metadata with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
void BaroAirspeedSetDefaults(UAVObjHandle obj, uint16_t instId)
{
BaroAirspeedData data;
// Initialize object fields to their default values
UAVObjGetInstanceData(obj, instId, &data);
memset(&data, 0, sizeof(BaroAirspeedData));
UAVObjSetInstanceData(obj, instId, &data);
// Initialize object metadata to their default values
if (instId == 0) {
UAVObjMetadata metadata;
metadata.flags =
ACCESS_READWRITE << UAVOBJ_ACCESS_SHIFT |
ACCESS_READWRITE << UAVOBJ_GCS_ACCESS_SHIFT |
0 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UPDATEMODE_PERIODIC << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UPDATEMODE_MANUAL << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
metadata.telemetryUpdatePeriod = 1000;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 0;
UAVObjSetMetadata(obj, &metadata);
}
}
/**
* Get object handle
*/
UAVObjHandle BaroAirspeedHandle()
{
return handle;
}
/**
* Get/Set object Functions
*/
void BaroAirspeedCalibratedAirspeedSet( float *NewCalibratedAirspeed )
{
UAVObjSetDataField(BaroAirspeedHandle(), (void*)NewCalibratedAirspeed, offsetof( BaroAirspeedData, CalibratedAirspeed), sizeof(float));
}
void BaroAirspeedCalibratedAirspeedGet( float *NewCalibratedAirspeed )
{
UAVObjGetDataField(BaroAirspeedHandle(), (void*)NewCalibratedAirspeed, offsetof( BaroAirspeedData, CalibratedAirspeed), sizeof(float));
}
void BaroAirspeedGPSAirspeedSet( float *NewGPSAirspeed )
{
UAVObjSetDataField(BaroAirspeedHandle(), (void*)NewGPSAirspeed, offsetof( BaroAirspeedData, GPSAirspeed), sizeof(float));
}
void BaroAirspeedGPSAirspeedGet( float *NewGPSAirspeed )
{
UAVObjGetDataField(BaroAirspeedHandle(), (void*)NewGPSAirspeed, offsetof( BaroAirspeedData, GPSAirspeed), sizeof(float));
}
void BaroAirspeedTrueAirspeedSet( float *NewTrueAirspeed )
{
UAVObjSetDataField(BaroAirspeedHandle(), (void*)NewTrueAirspeed, offsetof( BaroAirspeedData, TrueAirspeed), sizeof(float));
}
void BaroAirspeedTrueAirspeedGet( float *NewTrueAirspeed )
{
UAVObjGetDataField(BaroAirspeedHandle(), (void*)NewTrueAirspeed, offsetof( BaroAirspeedData, TrueAirspeed), sizeof(float));
}
void BaroAirspeedSensorValueSet( uint16_t *NewSensorValue )
{
UAVObjSetDataField(BaroAirspeedHandle(), (void*)NewSensorValue, offsetof( BaroAirspeedData, SensorValue), sizeof(uint16_t));
}
void BaroAirspeedSensorValueGet( uint16_t *NewSensorValue )
{
UAVObjGetDataField(BaroAirspeedHandle(), (void*)NewSensorValue, offsetof( BaroAirspeedData, SensorValue), sizeof(uint16_t));
}
void BaroAirspeedBaroConnectedSet( uint8_t *NewBaroConnected )
{
UAVObjSetDataField(BaroAirspeedHandle(), (void*)NewBaroConnected, offsetof( BaroAirspeedData, BaroConnected), sizeof(uint8_t));
}
void BaroAirspeedBaroConnectedGet( uint8_t *NewBaroConnected )
{
UAVObjGetDataField(BaroAirspeedHandle(), (void*)NewBaroConnected, offsetof( BaroAirspeedData, BaroConnected), sizeof(uint8_t));
}
/**
* @}
* @}
*/
|
#ifndef AMS_MANAGE_H
#define AMS_MANAGE_H
#define MANAGEOPT (6)
#define NUMBERLEN (8)
#define COMMONLEN (32)
#define REMARKLEN (256)
#define COMMENTLEN (256)
#define ATTENDLEN (1024)
#define BODYLEN (1024)
#define EVENTLEN (1048576)
#define EVNDB "evn.info"
#define COMMENT_SEPARATOR '^'
#define ATTEND_SEPARATOR ','
typedef struct ams_event_s {
char flag[8];
int num;
char date[32];
char time[32];
char head[32];
char user[32];
char remark[256];
char attend[1024];
char body[1024];
char comment[8192]; // potentially lead to overflow
struct ams_event_s *next;
} ams_event_t;
AMS_STAT ams_manage(ams_info_t *info);
#endif // AMS_MANAGE_H
|
#ifndef MODULESH
#define MODULESH
/*
* Any new module is exposed in this file through a set of functions...
*/
#include "../base/vars.h"
#include "2d_line.h"
#include "3d_line.h"
#include "surf.h"
#include "mesh.h"
void plt_validate_requirements(const plot_t * plt,const double * x, const double * y, const double * z );
/* the next table is related to the auxiliary data
* and is called on layer creation
*/
/* declare pointer to function of this type
* functions are of the form void * function(int32_t layer_num)
*/
typedef void * (* plt_aux_data_func_ptr_t)(int32_t);
plt_aux_data_func_ptr_t
plt_aux_data_func_ptr[PL_NUM_PLOT_TYPES] = { plt_2d_line_aux,
plt_3d_line_aux,
plt_mesh_aux,
plt_surf_aux
};
/* validate requirements on new layer */
typedef int32_t (* plt_val_req_func_ptr_t)(plot_t *, const double *, const double *, const double *);
plt_val_req_func_ptr_t
plt_val_req_func_ptr[PL_NUM_PLOT_TYPES] = { plt_2d_line_req,
plt_3d_line_req,
plt_mesh_req,
plt_surf_req
};
/* draw functions */
/* layer, x, y, z, layer, num_layers */
typedef int32_t (* plt_draw_func_ptr_t)(void *, const double *, const double *, const double *, int32_t, int32_t);
plt_draw_func_ptr_t
plt_draw_func_ptr[PL_NUM_PLOT_TYPES] = { plt_2d_line_draw,
plt_3d_line_draw,
plt_mesh_draw,
plt_surf_draw
};
/* functions to be called on layer property change */
typedef void (* plt_set_layer_prop_func_ptr_t)(int32_t, int32_t);
plt_set_layer_prop_func_ptr_t
plt_set_layer_prop_func_ptr[PL_NUM_PLOT_TYPES] = {
plt_2d_line_layer,
plt_3d_line_layer,
plt_mesh_layer,
plt_surf_layer,
};
/* free plot layer */
typedef void (*plt_free_aux_data_func_ptr_t)(void *);
plt_free_aux_data_func_ptr_t
plt_free_aux_data_func_ptr[PL_NUM_PLOT_TYPES] = {
plt_2d_line_free_aux,
plt_3d_line_free_aux,
plt_mesh_free_aux,
plt_surf_free_aux
};
#endif
|
// This file is part of XmlPlus package
//
// Copyright (C) 2010-2011 Satya Prakash Tripathi
//
//
// 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 __ATTRIBUTE_H__
#define __ATTRIBUTE_H__
#include "DOM/DOMCommonInc.h"
#include "DOM/Node.h"
namespace DOM
{
class Attribute : public Node
{
protected:
const DOMStringPtr _name;
const bool _specified;
//DOMStringPtr _value;
// Introduced in DOM Level 2:
ElementP _ownerElement;
public:
Attribute(
DOMString* name,
DOMString* value=NULL,
DOMString* nsURI=NULL,
DOMString* nsPrefix=NULL,
Element* ownerElement=NULL,
Document* ownerDocument=NULL,
bool specified=true
);
virtual ~Attribute() {}
virtual bool isSpecified() const {
return _specified;
}
virtual const DOMString* getName() const {
return _name;
}
virtual const DOMString* getValue() const {
return getNodeValue();
}
virtual ElementP getOwnerElement() const {
return _ownerElement;
}
virtual void setOwnerElement(ElementP ownerElement) {
_ownerElement = ownerElement;
}
};
}
#endif
|
/* This file is a part of groinc
*
* Copyright (C) 2006, 2007 Sarzyniec Luc <olbat@xiato.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/>.
*
* see the COPYING file for more informations */
#ifndef _PRINTP_H
#define _PRINTP_H
#define BFLAG_VAL(V,F) (((V)&(F)) != 0)
#define NBFLAG_VAL16(V,F) ((ntohs((V))&(F)) != 0)
#define NBFLAG_VAL32(V,F) (((ntohl(V))&(F)) != 0)
#define FLAG_VAL(V,F,OF) (((V)&(F)) >> OF)
#define NFLAG_VAL16(V,F,OF) (((ntohs(V))&(F)) >> OF)
#define NFLAG_VAL32(V,F,OF) (((ntohl(V))&(F)) >> OF)
void print_proto(int fd, char *format, ...);
#endif
|
// Copyright (c) 2005 - 2015 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Return To The Roots is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef NOSKELETON_H_INCLUDED
#define NOSKELETON_H_INCLUDED
#pragma once
#include "noCoordBase.h"
class SerializedGameData;
class GameEvent;
/// Menschliches Skelett (Zierobjekt, das sich automatisch umwandelt und dann verschwindet)
class noSkeleton : public noCoordBase
{
public:
noSkeleton(const MapPoint pt);
noSkeleton(SerializedGameData& sgd, const unsigned obj_id);
~noSkeleton() override;
void Destroy() override { Destroy_noSkeleton(); }
/// Serialisierungsfunktionen
protected:
void Serialize_noSkeleton(SerializedGameData& sgd) const;
public:
void Serialize(SerializedGameData& sgd) const override { Serialize_noSkeleton(sgd); }
GO_Type GetGOT() const override { return GOT_SKELETON; }
protected:
void Destroy_noSkeleton();
void Draw(DrawPoint drawPt) override;
void HandleEvent(const unsigned id) override;
private:
/// Type des Skeletts (0 = ganz "frisch", 1 - schon etwas verdorrt)
unsigned char type;
/// GameEvent*, damit der dann gelöscht werden kann, falls das Skelett von außerhalb gelöscht wird
GameEvent* current_event;
};
#endif // !NOSKELETON_H_INCLUDED
|
// StdAfx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__E30B2003_188B_4EB4_AB99_3F3734D6CE6C__INCLUDED_)
#define AFX_STDAFX_H__E30B2003_188B_4EB4_AB99_3F3734D6CE6C__INCLUDED_
#pragma once
#ifdef __GNUC__
// Ôõô¶¼Ã»ÕÒµ½min£¬maxµÄÍ·Îļþ-_-
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#endif
#ifndef __FILET__
#define __DUILIB_STR2WSTR(str) L##str
#define _DUILIB_STR2WSTR(str) __DUILIB_STR2WSTR(str)
#ifdef _UNICODE
#define __FILET__ _DUILIB_STR2WSTR(__FILE__)
#define __FUNCTIONT__ _DUILIB_STR2WSTR(__FUNCTION__)
#else
#define __FILET__ __FILE__
#define __FUNCTIONT__ __FUNCTION__
#endif
#endif
#define _CRT_SECURE_NO_DEPRECATE
// Remove pointless warning messages
#ifdef _MSC_VER
#pragma warning (disable : 4511) // copy operator could not be generated
#pragma warning (disable : 4512) // assignment operator could not be generated
#pragma warning (disable : 4702) // unreachable code (bugs in Microsoft's STL)
#pragma warning (disable : 4786) // identifier was truncated
#pragma warning (disable : 4996) // function or variable may be unsafe (deprecated)
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS // eliminate deprecation warnings for VS2005
#endif
#endif // _MSC_VER
#ifdef __BORLANDC__
#pragma option -w-8027 // function not expanded inline
#endif
// Required for VS 2008 (fails on XP and Win2000 without this fix)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WINXP//0x0500
#endif
//#define USE_XIMAGE_EFFECT //ʹÓÃximageµÄgif¿Ø¼þCGifAnimExUI¿ª¹Ø£¬ÌáÉýÐÔÄÜ,ĬÈϲ»Ê¹ÓÃ
#include "callback/callback.h"
#include "base/util/string_util.h"
#include "base/util/string_number_conversions.h"
#include "UIlib.h"
#include <olectl.h>
#define lengthof(x) (sizeof(x)/sizeof(*x))
#define MAX max
#define MIN min
#define CLAMP(x,a,b) (MIN(b,MAX(a,x)))
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__E30B2003_188B_4EB4_AB99_3F3734D6CE6C__INCLUDED_)
|
/* this file is part of Libav and distributed under GPLv3lu0 */
#include <string.h>
#include "kernels.h"
typedef struct RGBUnpContext {
int roff, goff, boff;
int step;
int shift[3], mask[3];
int bpp, be;
} RGBUnpContext;
static void rgbunpack_packed(void *ctx_,
uint8_t *src[AVS_MAX_COMPONENTS],
int sstrides[AVS_MAX_COMPONENTS],
uint8_t *dst[AVS_MAX_COMPONENTS],
int dstrides[AVS_MAX_COMPONENTS],
int w, int h)
{
RGBUnpContext *ctx = ctx_;
uint8_t *rgb[3];
int i, j, c;
rgb[0] = src[0] + ctx->roff;
rgb[1] = src[0] + ctx->goff;
rgb[2] = src[0] + ctx->boff;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
for (c = 0; c < 3; c++) {
dst[c][i] = rgb[c][0];
rgb[c] += ctx->step;
}
}
for (c = 0; c < 3; c++) {
rgb[c] += sstrides[0] - w * ctx->step;
dst[c] += dstrides[c];
}
}
}
static void rgbunpack_fields(void *ctx_,
uint8_t *src[AVS_MAX_COMPONENTS],
int sstrides[AVS_MAX_COMPONENTS],
uint8_t *dst[AVS_MAX_COMPONENTS],
int dstrides[AVS_MAX_COMPONENTS],
int w, int h)
{
RGBUnpContext *ctx = ctx_;
unsigned val, cval;
uint8_t *rgb;
int i, j, c;
rgb = src[0];
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
switch (ctx->step) {
case 1: val = rgb[i]; break;
case 2: val = ctx->be ? AV_RB16(rgb + i * 2) : AV_RL16(rgb + i * 2); break;
case 4: val = ctx->be ? AV_RB32(rgb + i * 4) : AV_RL32(rgb + i * 4); break;
default: val = 0;
}
for (c = 0; c < 3; c++) {
cval = (val >> ctx->shift[c]) & ctx->mask[c];
if (ctx->bpp <= 8)
dst[c][i] = cval;
else
AV_WN16(dst[c] + i * 2, cval);
}
}
rgb += sstrides[0];
for (c = 0; c < 3; c++)
dst[c] += dstrides[c];
}
}
static void rgbunp_free(AVSFilterStage *stage)
{
int i;
for (i = 0; i < 3; i++) {
av_freep(&stage->dst[i]);
stage->dst_stride[i] = 0;
}
av_freep(&stage->do_common_ctx);
}
static int rgbunp_kernel_init(AVSContext *ctx, const AVSKernel *kern, AVSFilterStage *stage)
{
RGBUnpContext *ruc;
int i;
int dstride;
if (ctx->cur_fmt.component_desc[0].next)
stage->do_common = rgbunpack_packed;
else
stage->do_common = rgbunpack_fields;
stage->deinit = rgbunp_free;
stage->do_common_ctx = av_malloc(sizeof(RGBUnpContext));
if (!stage->do_common_ctx)
return AVERROR(ENOMEM);
ruc = stage->do_common_ctx;
ruc->roff = ctx->cur_fmt.component_desc[0].off;
ruc->goff = ctx->cur_fmt.component_desc[1].off;
ruc->boff = ctx->cur_fmt.component_desc[2].off;
ruc->step = ctx->cur_fmt.entry_size;
ruc->bpp = ctx->cur_fmt.component_desc[0].bpp;
ruc->be = ctx->cur_fmt.flags & AVPF_FLAG_BE;
for (i = 0; i < 3; i++) {
ruc->shift[i] = ctx->cur_fmt.component_desc[i].shift;
ruc->mask[i] = (1 << ctx->cur_fmt.component_desc[i].bpp) - 1;
}
dstride = (ctx->cur_w * (ruc->bpp + 7 >> 3) + 31) & ~31;
//todo not allocate temp buffer for planar final output
for (i = 0; i < 3; i++) {
stage->dst[i] = av_mallocz(ctx->cur_h * dstride);
if (!stage->dst[i])
return AVERROR(ENOMEM);
stage->dst_stride[i] = dstride;
}
if (HAVE_BIGENDIAN)
ctx->cur_fmt.flags |= AVPF_FLAG_BE;
else
ctx->cur_fmt.flags &= ~AVPF_FLAG_BE;
return 0;
}
const AVSKernel avs_rgbunp_kernel = {
.name = "rgbunp",
.kernel_init = rgbunp_kernel_init,
};
|
/*
$License:
Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
See included License.txt for License information.
$
*/
/******************************************************************************
*
* $Id$
*
*****************************************************************************/
#ifndef MLDMP_NOGYROFUSION_H__
#define MLDMP_NOGYROFUSION_H__
#include "mltypes.h"
#ifdef __cplusplus
extern "C" {
#endif
inv_error_t inv_enable_no_gyro_fusion (void);
inv_error_t inv_disable_no_gyro_fusion (void);
inv_error_t inv_start_no_gyro_fusion (void);
inv_error_t inv_start_no_gyro_fusion (void);
inv_error_t inv_init_no_gyro_fusion (void);
#ifdef __cplusplus
}
#endif
#endif // MLDMP_NOGYROFUSION_H__
|
/**
******************************************************************************
* @file blinky.c
* @author Xue Liu
* @version V0.1
* @date 08-16-2014
* @brief Provides LED control functions
******************************************************************************
*/
/**
******************************************************************************
* Include Files
******************************************************************************
*/
#include "blinky.h"
/**
******************************************************************************
* Private function declaration
******************************************************************************
*/
/**
*
******************************************************************************
* Private Global Variables
******************************************************************************
*/
GPIO_TypeDef *LED_PORT[LEDn] = {
LED_RED_GPIO_PORT, LED_GREEN_GPIO_PORT,
};
const uint16_t LED_PIN[LEDn] = {LED_RED_PIN, LED_GREEN_PIN};
const uint32_t LED_CLK[LEDn] = {LED_RED_GPIO_CLK, LED_GREEN_GPIO_CLK};
/**
******************************************************************************
* Public functions
******************************************************************************
*/
/* Init a led
@param none
@retval none
*/
void LED_Init(Led_TypeDef LED_NUM) {
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable the GPIO_LED Clock */
RCC_APB2PeriphClockCmd(LED_CLK[LED_NUM], ENABLE);
/* Configure the GPIO_LED pin */
GPIO_InitStructure.GPIO_Pin = LED_PIN[LED_NUM];
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LED_PORT[LED_NUM], &GPIO_InitStructure);
}
/* LED_On
@brief turn the green led on
@param none
@retval none
*/
void LED_On(Led_TypeDef LED_NUM) { GPIOB->BRR = LED_PIN[LED_NUM]; }
/* LED_Off
@brief turn the green off
@param none
@retval none
*/
void LED_Off(Led_TypeDef LED_NUM) { GPIOB->BSRR = LED_PIN[LED_NUM]; }
/* LED_Toggle()
@param none
@retval none
*/
void LED_Toggle(Led_TypeDef LED_NUM) { GPIOB->ODR ^= LED_PIN[LED_NUM]; } |
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef SINKSELECTION_H
#define SINKSELECTION_H
#include <QWidget>
#include <QListWidgetItem>
namespace Ui {
class DeviceSelection;
}
class DeviceSelection : public QWidget
{
Q_OBJECT
public:
enum DeviceType {
Sink,
Source
};
explicit DeviceSelection(DeviceType type, QWidget *parent = nullptr);
~DeviceSelection();
signals:
void rejected();
void accepted(quint32 deviceIndex);
private slots:
void on_backButton_clicked();
void on_deviceList_itemActivated(QListWidgetItem *item);
private:
Ui::DeviceSelection *ui;
};
#endif // SINKSELECTION_H
|
/* scis - SCI assembler
*
* scis is the legal property of its developers, whose names are listed
* in the AUTHORS file.
*
* 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 SYMTAB_H
#define SYMTAB_H
struct symtab_struct;
struct symtab_struct *
new_symtab(int dup);
/* dup: May have duplicate symbols */
void
free_symtab(struct symtab_struct *symtab);
int
add_symbol(struct symtab_struct *symtab, char *symbol, int value, char *file,
int line, int type);
/* Returns 0 on success, or 1 if the symbol was already defined */
int
read_symbol(struct symtab_struct *symtab, char *symbol, int *value, char **file,
int *line, int *type);
/* Returns 0 on success */
int
pop_symbol(struct symtab_struct *symtab, char **symbol, int *value, char **file,
int *line, int *type);
/* Removes the symbol that was last added; '*symbol' is malloc'd! */
#endif /* !SYMTAB_H */
|
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
// 指针数组: 代替大型的判断语句
int main(int argc, char **argv)
{
struct stat statres;
int ret;
const char *pmode[] = {
"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"
// 0 1 10 11 100 101 110 111
};
//-dcblps
char ptype[] = {"\0pc\0d\0b\0-\0l\0s"};
struct passwd * ppas;
struct group *pgr;
printf("%s\n", argv[1]);
ret = stat(argv[1], &statres);//获得文件的属性
if ( ret != 0 ) {
perror("stat()"); //打印错误原因
return -1;
}
ppas = getpwuid(statres.st_uid);
pgr = getgrgid(statres.st_gid);
//rw-r--r-- 0100644
printf("%c%s%s%s %d %s %s %d %d %s\n", ptype[(statres.st_mode&S_IFMT)>>12],
pmode[(statres.st_mode>>6)&7],
pmode[(statres.st_mode>>3)&7],
pmode[statres.st_mode&7], statres.st_nlink,
ppas->pw_name, pgr->gr_name, statres.st_size,
statres.st_mtime, argv[1]);
/*
if ( S_ISREG(statres.st_mode) ) {
printf("普通文件!\n");
}
else if ( S_ISDIR(statres.st_mode) ) {
printf("目录文件!\n");
}
// else if () {
// ..
// }
*/
//if ( statres.st_mode&0400 )
//if ( (statres.st_mode>>8)&1 )
/*
if ( statres.st_mode & (1<<8) ) {
printf("r");
}
else {
printf("-");
}
if ( statres.st_mode & (1<<7) ) {
printf("w");
}
else {
printf("-");
}
if ( statres.st_mode & (1<<6) ) {
printf("x\n");
}
else {
printf("-\n");
}
*/
return 0;
}
|
/*
* Code for class POINTER
*/
#include "eif_eiffel.h"
#include "../E1/estructure.h"
#include "../E1/eoffsets.h"
#include "po214.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* {POINTER}.hash_code */
EIF_INTEGER_32 F736_5995 (EIF_REFERENCE Current)
{
GTCX
return (EIF_INTEGER_32) F704_5969(Current);
}
/* {POINTER}.plus */
EIF_POINTER F736_5997 (EIF_REFERENCE Current, EIF_INTEGER_32 arg1)
{
GTCX
return (EIF_POINTER) F704_5974(Current, arg1);
}
void EIF_Minit214 (void)
{
GTCX
}
#ifdef __cplusplus
}
#endif
|
#ifndef APPEL_FONCTION_H
#define APPEL_FONCTION_H
#include "AbstractExpression.h"
#include "Function.h"
#include "LParametres.h"
#include "Scope.h"
namespace AST
{
class FunctionCall : public AbstractExpression
{
public:
/**
* @brief FunctionCall constructor
* @param id string the identifier of the called function
* @param params a shared_ptr to the LParametres object representing the list of parameters
* @param scope a shared_ptr to the current Scope
*/
FunctionCall(std::string id, std::shared_ptr<LParametres> params, std::shared_ptr<Scope> scope);
/**
* @brief FunctionCall destructor
*/
virtual ~FunctionCall();
/**
* @brief deprecated fucnction for this class
* @return an error-type value = 0;
*/
virtual Value evaluate() const;
/**
* @brief buildIR build the IR from this node, and put the correspondant instructions in the provided basic block
* @param currentBasicBlock, the reference to a shared pointer on the BasicBlock that is currently being completed
* @return a shared pointer on the IR memory index that will contain the node's value once executed
* or nullptr if the node shouldn't be calculated to be a value
*/
virtual IR::sh_Memory buildIR(IR::sh_BasicBlock & currentBasicBlock) const;
/**
* @brief printTree the AST tree corresponding to this node and it's children.
* @param tabulationNumber the number of tabulations corresponding to this node
*/
void printTree(int tabulationNumber) const;
protected:
std::string functionIdentifiant;
std::shared_ptr<LParametres> parameters;
};
} /* namespace AST */
#endif //ID_EXPRESSION_H
|
#ifndef MAP_WRAPPER_BASE
#define MAP_WRAPPER_BASE
#include <vector>
#include <numeric>
#include <iostream>
#include <string>
#include "map.h"
#include "map_data.h"
#include "bitcover.h"
namespace maligner_maps {
//////////////////////////////////////////////////////////////////////////////////////
// The MapWrapper class brings together structures for a single map.
//
// The Map class is meant for parsing maps from a .maps file into a
// fragment vector.
//
// The MapData class maintains meta data about the map (its name, size, is circular,
// is bounded by restriction sites).
//
// The MapWrapper contains these two, plus a structure ix_to_lcos_ for
// converting an index to a bp location
//
// NOTE: If the map is circular (most prokaryotic genomes),
// then we "double" the vector of fragments to allow use to
// align fragments past the origin of replication. We double the fragments in
// map_.frags_.
//
// However, we maintain the number of fragments in the **original** map
// in the map_data_.
////////////////////////////////////////////////////////////////////////////////////
class MapWrapper {
public:
MapWrapper() = default;
MapWrapper(const Map& map, bool is_circular, bool is_bounded) :
map_(map),
map_data_(map_.name_, map_.frags_.size(), map_.size_, is_circular, is_bounded),
frags_reverse_(map_.frags_.rbegin(), map_.frags_.rend()),
bit_cover_(map_.frags_.size())
{
// If the map is circular, double the fragments (for the purposes of alignment)
if(is_circular) {
__circularize();
}
__compute_index();
}
MapWrapper(Map&& map, bool is_circular, bool is_bounded) :
map_(map),
map_data_(map_.name_, map_.frags_.size(), map_.size_, is_circular, is_bounded),
frags_reverse_(map_.frags_.rbegin(), map_.frags_.rend()),
bit_cover_(map_.frags_.size())
{
// If the map is circular, double the fragments (for the purposes of alignment)
if(is_circular) {
__circularize();
}
__compute_index();
}
MapWrapper(const Map& map, const MapData& map_data) :
map_(map),
map_data_(map_data),
frags_reverse_(map_.frags_.rbegin(), map_.frags_.rend()) {
// If the map is circular, double the fragments (for the purposes of alignment)
if(map_data_.is_circular_) {
__circularize();
}
__compute_index();
}
MapWrapper(const MapWrapper& o) = default;
MapWrapper& operator=(const MapWrapper& o) = default;
MapWrapper(MapWrapper&& o) = default;
MapWrapper& operator=(MapWrapper&& o) = default;
/////////////////////////////////////////////////////////////////////////////
// Return the non-negative starting location in bp of the fragment at index.
// -1 signals error
int index_to_loc(size_t index) {
if(index >= ix_to_locs_.size()) {
return -1;
}
return ix_to_locs_[index];
}
const FragVec& get_frags() const {
return map_.frags_;
}
FragVec get_frags_noncircularized() const {
const size_t N = num_frags();
const FragVec& frags = get_frags();
FragVec ret(N);
for(size_t i = 0; i < N; i++) {
ret[i] = frags[i];
}
return ret;
}
const FragVec& get_frags_reverse() const {
return frags_reverse_;
}
// This returns the number of fragments in the original map,
// before doubling for circularization.
size_t num_frags() const {
return map_data_.num_frags_;
}
size_t num_frags_after_circularization() const {
return map_.frags_.size();
}
size_t num_frags_total() const {
return map_.frags_.size();
}
Map& get_map() {
return map_;
}
std::string get_name() const {
return map_.name_;
}
bool is_circular() const {
return map_data_.is_circular_;
}
///////////////////////////////////////
// Members
Map map_;
maligner_maps::MapData map_data_; // Metadata about the map
FragVec frags_reverse_;
IntVec ix_to_locs_;
BitCover bit_cover_;
////////////////////////////////////////
private:
void __circularize() {
// Repeat the fragment vector.
FragVec& frags = map_.frags_;
if(frags.size() == 2*num_frags()) {
// Looks like it's already circularized!
return;
}
frags.reserve(2*frags.size());
frags.insert(frags.end(), frags.begin(), frags.end());
frags_reverse_ = FragVec(frags.rbegin(), frags.rend());
bit_cover_.reset(frags.size());
}
void __compute_index() {
const FragVec& frags = map_.frags_;
// Compute the index to start loc
ix_to_locs_.resize(frags.size() + 1);
int s = 0;
for(size_t i = 0; i < frags.size(); i++) {
ix_to_locs_[i] = s;
s += frags[i];
}
ix_to_locs_[frags.size()] = s;
}
};
typedef std::vector<MapWrapper> MapWrapperVec;
typedef std::vector<MapWrapper*> MapWrapperPVec;
}
#endif |
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2014, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC 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.
*/
/** \file TComMv.h
\brief motion vector class (header)
*/
#ifndef __TCOMMV__
#define __TCOMMV__
#include "CommonDef.h"
#include <cstdlib>
//! \ingroup TLibCommon
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// basic motion vector class
#include "HARP_Defines.h"
#ifdef ACTIVATE_ABMC
#include "next_class_TComMv.h"
#else
class TComMv
{
private:
Short m_iHor; ///< horizontal component of motion vector
Short m_iVer; ///< vertical component of motion vector
public:
// ------------------------------------------------------------------------------------------------------------------
// constructors
// ------------------------------------------------------------------------------------------------------------------
TComMv() :
m_iHor(0),
m_iVer(0)
{
}
TComMv( Short iHor, Short iVer ) :
m_iHor(iHor),
m_iVer(iVer)
{
}
// ------------------------------------------------------------------------------------------------------------------
// set
// ------------------------------------------------------------------------------------------------------------------
Void set ( Short iHor, Short iVer) { m_iHor = iHor; m_iVer = iVer; }
Void setHor ( Short i ) { m_iHor = i; }
Void setVer ( Short i ) { m_iVer = i; }
Void setZero () { m_iHor = m_iVer = 0; }
// ------------------------------------------------------------------------------------------------------------------
// get
// ------------------------------------------------------------------------------------------------------------------
Int getHor () const { return m_iHor; }
Int getVer () const { return m_iVer; }
Int getAbsHor () const { return abs( m_iHor ); }
Int getAbsVer () const { return abs( m_iVer ); }
// ------------------------------------------------------------------------------------------------------------------
// operations
// ------------------------------------------------------------------------------------------------------------------
const TComMv& operator += (const TComMv& rcMv)
{
m_iHor += rcMv.m_iHor;
m_iVer += rcMv.m_iVer;
return *this;
}
const TComMv& operator-= (const TComMv& rcMv)
{
m_iHor -= rcMv.m_iHor;
m_iVer -= rcMv.m_iVer;
return *this;
}
const TComMv& operator>>= (const Int i)
{
m_iHor >>= i;
m_iVer >>= i;
return *this;
}
const TComMv& operator<<= (const Int i)
{
m_iHor <<= i;
m_iVer <<= i;
return *this;
}
const TComMv operator - ( const TComMv& rcMv ) const
{
return TComMv( m_iHor - rcMv.m_iHor, m_iVer - rcMv.m_iVer );
}
const TComMv operator + ( const TComMv& rcMv ) const
{
return TComMv( m_iHor + rcMv.m_iHor, m_iVer + rcMv.m_iVer );
}
Bool operator== ( const TComMv& rcMv ) const
{
return (m_iHor==rcMv.m_iHor && m_iVer==rcMv.m_iVer);
}
Bool operator!= ( const TComMv& rcMv ) const
{
return (m_iHor!=rcMv.m_iHor || m_iVer!=rcMv.m_iVer);
}
const TComMv scaleMv( Int iScale ) const
{
Int mvx = Clip3( -32768, 32767, (iScale * getHor() + 127 + (iScale * getHor() < 0)) >> 8 );
Int mvy = Clip3( -32768, 32767, (iScale * getVer() + 127 + (iScale * getVer() < 0)) >> 8 );
return TComMv( mvx, mvy );
}
};// END CLASS DEFINITION TComMV
//! \}
#endif
#endif // __TCOMMV__
|
// Copyright 2016, Durachenko Aleksey V. <durachenko.aleksey@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 ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
virtual ~AboutDialog();
void setPixmap(const QPixmap &pixmap);
private:
QString fromFile(const QString &resourceName);
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H
|
#include "router.c"
#include "mock_daemon.h"
#include "mock_log.h"
#include "mock_timer.h"
#include "tests_utils.h"
#include "tests_router_utils.h"
void
test_target(const char *target)
{
struct lgtd_lifx_packet_power_state payload = {
.power = LGTD_LIFX_POWER_ON
};
struct lgtd_proto_target_list *targets;
targets = lgtd_tests_build_target_list(target, NULL);
bool ok = lgtd_router_send(targets, LGTD_LIFX_SET_POWER_STATE, &payload);
// XXX: Return proper errors from lgtd_router.
#if 0
if (ok) {
lgtd_errx(
1, "router_send didn't return false for unknown device %s", target
);
}
#else
(void)ok;
#endif
if (lgtd_tests_gw_pkt_queue_size) {
lgtd_errx(1, "no packets should have been sent");
}
}
int
main(void)
{
lgtd_lifx_wire_setup();
struct lgtd_lifx_gateway *gw_1 = lgtd_tests_insert_mock_gateway(1);
lgtd_tests_insert_mock_bulb(gw_1, 1);
struct lgtd_lifx_gateway *gw_2 = lgtd_tests_insert_mock_gateway(2);
lgtd_tests_insert_mock_bulb(gw_2, 2);
test_target("4");
test_target("-1");
test_target("blabla");
test_target("**");
test_target("ffffffffffffffffffffffffff");
test_target("");
return 0;
}
|
/*************
SCASE: extendable prototype of an assistive communication tool for people with Locked-in Syndrome
Copyright (C) 2014 Andrés Aparicio
This file is part of SCASE.
SCASE 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.
SCASE 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 SCASE. If not, see <http://www.gnu.org/licenses/>.
**********/
#ifndef IBROWSERDELEGATE_H
#define IBROWSERDELEGATE_H
#include <QString>
#include "interfaces/IBrowserLevel.h"
class IBrowserDelegate {
public:
virtual void addItemToLevel(IBrowserLevel *level, int pos, QString name, QString moduleName, QString actionName, bool isSpecial) = 0;
virtual void goToLevel(IBrowserLevel *ilevel) = 0;
virtual void actionDidFinish(IBrowserItem *item) = 0;
};
#define IBROWSER_DELEGATE_SID "net.adapar.SCASE1.IBrowserDelegate/1.0"
Q_DECLARE_INTERFACE(IBrowserDelegate, IBROWSER_DELEGATE_SID)
#endif // IBROWSERDELEGATE_H
|
/*
* Utilities for working with hash values.
*
* Portions Copyright (c) 2017, PostgreSQL Global Development Group
*/
#ifndef HASHUTILS_H
#define HASHUTILS_H
/*
* Combine two hash values, resulting in another hash value, with decent bit
* mixing.
*
* Similar to boost's hash_combine().
*/
static inline uint32
hash_combine(uint32 a, uint32 b)
{
a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2);
return a;
}
/*
* Simple inline murmur hash implementation hashing a 32 bit integer, for
* performance.
*/
static inline uint32
murmurhash32(uint32 data)
{
uint32 h = data;
h ^= h >> 16;
h *= 0x85ebca6b;
h ^= h >> 13;
h *= 0xc2b2ae35;
h ^= h >> 16;
return h;
}
#endif /* HASHUTILS_H */
|
#pragma once
struct armorenemies
{
char *equiped;
int protection;
int rangey;
int rangex;
int protections[allarmorenemies];
char *item[allarmorenemies];
int randomarmor;
int nextrandomarmor;
int nextrandomarmor2;
int armorcount;
};
|
#ifndef NETWORKDEVICE_H
#define NETWORKDEVICE_H
#include "networkdevice.h"
#include <QUuid>
#include <QDBusObjectPath>
#include <QJsonObject>
class NetworkDevice
{
public:
enum NetworkState {
Unknow = 0,
Unmanaged = 10,
Unavailable = 20,
Disconnected = 30,
Prepare = 40,
Config = 50,
NeedAuth = 60,
IpConfig = 70,
IpCheck = 80,
Secondaries = 90,
Activated = 100,
Deactivation = 110,
Failed = 120,
};
enum NetworkType {
None = 0,
Generic = 1 << 0,
Wired = 1 << 1,
Wireless = 1 << 2,
Bluetooth = 1 << 3,
Bridge = 1 << 4,
};
Q_DECLARE_FLAGS(NetworkTypes, NetworkType)
public:
static NetworkType deviceType(const QString &type);
explicit NetworkDevice(const NetworkType type, const QJsonObject &info);
bool operator==(const QString &path) const;
bool operator==(const NetworkDevice &device) const;
NetworkState state() const;
NetworkType type() const;
const QString path() const;
const QDBusObjectPath dbusPath() const;
const QString hwAddress() const;
const QString vendor() const;
const QString activeAp() const;
private:
NetworkType m_type;
QString m_devicePath;
QJsonObject m_infoObj;
};
inline uint qHash(const NetworkDevice &device)
{
return qHash(device.path());
}
Q_DECLARE_OPERATORS_FOR_FLAGS(NetworkDevice::NetworkTypes)
#endif // NETWORKDEVICE_H
|
#include <semaphore.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/user.h>
#include <sys/mman.h>
#include "include/log.h"
#include "include/shm.h"
#include "include/util.h"
#define __round_mask(x, y) ((__typeof__(x))((y) - 1))
#define round_up(x, y) ((((x) - 1) | __round_mask(x, y)) + 1)
#define shm_align(x) (round_up(x, sizeof(long)))
static struct shared_memory_pool {
void *data;
size_t alloc_size;
size_t used_size;
sem_t sem;
} *pool;
#define shm_fit(x) (pool->used_size + x <= pool->alloc_size)
int shm_init_pool(void)
{
size_t size = PAGE_SIZE << 4;
pool = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (pool == MAP_FAILED) {
pr_perror("failed to allocate shared memory pool");
return -errno;
}
if (sem_init(&pool->sem, 1, 1)) {
pr_perror("failed to init shared memory semaphore");
munmap(pool, size);
return -errno;
}
pool->data = pool + 1;
pool->alloc_size = size;
pool->used_size = shm_align((unsigned long)pool->data - (unsigned long)pool);
return 0;
}
static int shm_grow_pool(size_t size)
{
size_t grow_size;
grow_size = round_up(size, PAGE_SIZE);
if (mremap(pool, pool->alloc_size, pool->alloc_size + grow_size, 0) == MAP_FAILED) {
pr_perror("failed to grow shared memory pool");
return -errno;
}
pool->alloc_size += grow_size;
return 0;
}
void *shm_alloc(size_t size)
{
size_t alloc_size;
void *ptr = NULL;
alloc_size = round_up(size, sizeof(long));
if (sem_wait(&pool->sem)) {
pr_perror("failed to lock shared memory semaphore");
return NULL;
}
if (!shm_fit(alloc_size)) {
if (shm_grow_pool(alloc_size))
goto unlock;
}
ptr = pool->data + pool->used_size;
pool->used_size += alloc_size;
unlock:
if (sem_post(&pool->sem))
pr_perror("failed to unlock spfs semaphore");
return ptr;
}
void *shm_xsprintf(const char *fmt, ...)
{
void *ptr;
char *string;
va_list args;
va_start(args, fmt);
string = xvstrcat(NULL, fmt, args);
va_end(args);
if (!string) {
pr_err("failed to allocate string\n");
return NULL;
}
ptr = shm_alloc(strlen(string) + 1);
if (ptr)
strcpy(ptr, string);
else
pr_err("failed to allocate shated string\n");
free(string);
return ptr;
}
int init_shared_list(struct shared_list *sl)
{
if (sem_init(&sl->sem, 1, 1)) {
pr_perror("failed to initialize spfs info semaphore");
return -errno;
}
INIT_LIST_HEAD(&sl->list);
return 0;
}
struct shared_list *create_shared_list(void)
{
struct shared_list *sl;
sl = shm_alloc(sizeof(*sl));
if (!sl) {
pr_err("failed to allocate shared list\n");
return NULL;
}
if (init_shared_list(sl))
return NULL;
return sl;
}
int lock_shared_list(struct shared_list *sl)
{
if (sem_wait(&sl->sem)) {
pr_perror("failed to lock shared list semaphore");
return -errno;
}
return 0;
}
int unlock_shared_list(struct shared_list *sl)
{
if (sem_post(&sl->sem)) {
pr_perror("failed to unlock shared list semaphore");
return -errno;
}
return 0;
}
|
#ifndef LINEARTF_H_INCLUDED
#define LINEARTF_H_INCLUDED
#include "TF.h"
/**
@brief Ñòðóêòóðà äëÿ õðàíåíèÿ ëèíåéíûõ ÏÔ
@details õðàíèò ÏÔ0, ÏÔ1 è ÏÔ2 äëÿ äâóõ êîîðäèíàò
*/
struct LinearTF
{
public:
/**
@brief õðàíèò ÏÔ ïî àáñöèññå
*/
TF x;
/**
@brief õðàíèò ÏÔ ïî îðäèíàòå
*/
TF y;
/**
@brief Óáèðàåò ïðèçíàê âû÷èñëåíèÿ
*/
void UnsetCalculated()
{x.UnsetCalculated();
y.UnsetCalculated();};
};
#endif // LINEARTF_H_INCLUDED
|
/***************************************************************************
* Copyright (C) 2007 PCSX-df Team *
* Copyright (C) 2009 Wei Mingzhi *
* *
* 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 CDRISO_H
#define CDRISO_H
#include <stdio.h>
int handleecm(const char *isoname, FILE* cdh, s32* accurate_length);
int aropen(FILE* fparchive, const char* _fn);
void cdrIsoInit(void);
int cdrIsoActive(void);
int handlearchive(const char *isoname, s32* accurate_length);
extern unsigned int cdrIsoMultidiskCount;
extern unsigned int cdrIsoMultidiskSelect;
#endif
|
/*
* --------------------------------------------------------------------------
*
* Framework RKH
* -------------
*
* State-machine framework for reactive embedded systems
*
* Copyright (C) 2010 Leandro Francucci.
* All rights reserved. Protected by international copyright laws.
*
*
* RKH 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.
*
* RKH 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 RKH, see copying.txt file.
*
* Contact information:
* RKH site: http://vortexmakes.com/que-es/
* RKH GitHub: https://github.com/vortexmakes/RKH
* RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/
* e-mail: lf@vortexmakes.com
* ---------------------------------------------------------------------------
*/
/**
* \file rkhsma_prio.h
* \brief Specifies the native priority mechanism for active object
* scheduling
* \ingroup sma
*/
/* -------------------------- Development history -------------------------- */
/*
* 2017.05.15 LeFr v2.4.05 ---
*/
/* -------------------------------- Authors -------------------------------- */
/*
* LeFr Leandro Francucci lf@vortexmakes.com
*/
/* --------------------------------- Notes --------------------------------- */
/* --------------------------------- Module -------------------------------- */
#ifndef __RKHSMA_PRIO_H__
#define __RKHSMA_PRIO_H__
/* ----------------------------- Include files ----------------------------- */
#include "rkhtype.h"
/* ---------------------- External C language linkage ---------------------- */
#ifdef __cplusplus
extern "C" {
#endif
/* --------------------------------- Macros -------------------------------- */
/**
* \brief
* Initializes the native priority mechanism for active object scheduling.
*/
void rkh_smaPrio_init(void);
/**
* \brief
* Evaluates to true if all active objects are not ready to run.
*/
rbool_t rkh_smaPrio_isNotReady(void);
/**
* \brief
* Evaluates to true if any active object is ready to run.
*/
rbool_t rkh_smaPrio_isReady(void);
/**
* \brief
* Making an active object ready-to-run inserting it into the ready list.
*
* The lower 3 bits of the SMA's priority are used to determine the bit
* position in rkhrg.tbl[], while the next three most significant bits are
* used to determine the index into rkhrg.tbl[].
*
* \param[in] prio number of active object's priority.
*/
void rkh_smaPrio_setReady(rui8_t prio);
/**
* \brief
* Removing an active object from the ready list.
*
* Clears the ready bit of the active object in rkhrg.tbl[] and clears the
* bit in rkhrg.grp only if all active objects in a group are not ready to
* run, i.e. all bits in rkhrg.tbl[prio >> 3] are 0.
*
* \param[in] prio number of active object's priority.
*/
void rkh_smaPrio_setUnready(rui8_t prio);
/**
* \brief
* Finding the highest priority active object ready to run.
*
* Another table lookup is performed, rather than scanning through the table
* starting with rkhrg.tbl[0] to find the highest priority task ready to
* run. Eight bits are used to represent when tasks are ready in a group. The
* least significant bit has the highest priority. Using this byte to index
* the table returns the bit position of the highest priority bit set, a
* number between 0 and 7.
*/
rui8_t rkh_smaPrio_findHighest(void);
/* -------------------------------- Constants ------------------------------ */
/* ------------------------------- Data types ------------------------------ */
/* -------------------- External C language linkage end -------------------- */
#ifdef __cplusplus
}
#endif
/* ------------------------------ Module end ------------------------------- */
#endif
/* ------------------------------ End of file ------------------------------ */
|
/*
* Matcher - C++ Matchers.
* Copyright (C) 2016-2019 offa
*
* This file is part of Matcher.
*
* Matcher 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.
*
* Matcher 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 Matcher. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <tuple>
#include "MatcherBase.h"
namespace matcher
{
namespace internal
{
template<class Expected1, class Expected2>
struct Both : protected MatcherBase<Expected1>
{
Both(const Expected1& expected1, const Expected2& expected2, const std::string& description)
: MatcherBase<Expected1>(expected1, description), m_expected2(expected2)
{
}
template<class Actual>
MatchResult operator()(const Actual& actual) const
{
const bool result = ( this->m_expected(actual).getResult()
&& m_expected2(actual).getResult() );
return MatchResult(result, this->m_description);
}
protected:
const Expected2& m_expected2;
};
template<class Expected>
struct Negate : protected MatcherBase<Expected>
{
using MatcherBase<Expected>::MatcherBase;
template<class Actual>
MatchResult operator()(const Actual& actual) const
{
const bool result = !this->m_expected(actual).getResult();
return MatchResult(result, this->m_description);
}
};
}
template<class Expected1, class Expected2>
internal::Both<Expected1, Expected2> both(const Expected1& expected1, const Expected2& expected2)
{
return internal::Both<Expected1, Expected2>(expected1, expected2, "both");
}
template<class Expected>
internal::Negate<Expected> negate(const Expected& expected)
{
return internal::Negate<Expected>(expected, "negate");
}
}
|
/**
* IMCA is a analyzing tool for unbounded reachability probabilities, expected-
* time, and long-run averages for Interactive Markov Chains and Markov Automata.
* Copyright (C) RWTH Aachen, 2012
* UTwente, 2013
* Author: Dennis Guck
*
* 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/>.
*
*
* @file unbounded.cpp
* @brief Compute the unbounded reachability for an MA
* @author Dennis Guck
* @version 1.0
*
*/
#ifndef UNBOUNDED_H
#define UNBOUNDED_H
#include "sparse.h"
#ifdef __SOPLEX__
#include "soplex.h"
#endif
using namespace soplex;
/**
* Computes unbounded reachability for MA.
*
* @param ma file to read MA from
* @param max identifier for min or max prb
* @return probability for unbounded reachability
*/
extern Real compute_unbounded_reachability(SparseMatrix*, bool);
extern Real unbounded_value_iteration(SparseMatrix*, bool);
#endif
|
#ifndef _AK_SANDBOX_DRAFT_
#define _AK_SANDBOX_DRAFT_
// * App cliente-servidor:
// - Incluir tests unitarios
// - cliente servidor con threadpool
// - uso templates?
// - Qt sockets
//
class tcp_connection {
void connect( source, target );
};
class tcp_server {
public:
void listen()
{
// connection received launch connection
}
};
class tcp_client {
public:
void connect_to( server_addr )
{
try {
tcp_socket s;
s.connect( ip );
}
catch {
}
};
|
/*
simple line fitting
Copyright (C) 2009 Bob Mottram
fuzzgun@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 LINEFIT_H_
#define LINEFIT_H_
#include <stdio.h>
#define LINE_SLOPES 20
#define LINE_MAX_IMAGE_WIDTH 640
#define LINE_SAMPLING 1
#define MAX_LINES 10
class linefit {
public:
unsigned int bucket[LINE_SLOPES*2+1][3*LINE_MAX_IMAGE_WIDTH/LINE_SAMPLING];
int line_horizontal[1 + (MAX_LINES*5)];
int line_vertical[1 + (MAX_LINES*5)];
unsigned int best_lines[MAX_LINES*2];
void parallel(
int* lines,
int tollerance);
void vertically_oriented(
int no_of_feats,
short int* feature_x,
unsigned short int* features_per_row,
int vertical_sampling,
int minimum_edges);
void horizontally_oriented(
int no_of_feats,
short int* feature_y,
unsigned short int* features_per_col,
int horizontal_sampling,
int minimum_edges);
};
#endif
|
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BHO_PREDEF_OS_SOLARIS_H
#define BHO_PREDEF_OS_SOLARIS_H
#include <bho/predef/version_number.h>
#include <bho/predef/make.h>
/* tag::reference[]
= `BHO_OS_SOLARIS`
http://en.wikipedia.org/wiki/Solaris_Operating_Environment[Solaris] operating system.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `sun` | {predef_detection}
| `+__sun+` | {predef_detection}
|===
*/ // end::reference[]
#define BHO_OS_SOLARIS BHO_VERSION_NUMBER_NOT_AVAILABLE
#if !defined(BHO_PREDEF_DETAIL_OS_DETECTED) && ( \
defined(sun) || defined(__sun) \
)
# undef BHO_OS_SOLARIS
# define BHO_OS_SOLARIS BHO_VERSION_NUMBER_AVAILABLE
#endif
#if BHO_OS_SOLARIS
# define BHO_OS_SOLARIS_AVAILABLE
# include <bho/predef/detail/os_detected.h>
#endif
#define BHO_OS_SOLARIS_NAME "Solaris"
#endif
#include <bho/predef/detail/test.h>
BHO_PREDEF_DECLARE_TEST(BHO_OS_SOLARIS,BHO_OS_SOLARIS_NAME)
|
//
// ViewController.h
// metro4all-ios
//
// Created by Maxim Smirnov on 02.03.15.
// Copyright (c) 2015 Maxim Smirnov. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MFASelectCityViewModel;
@interface MFASelectCityViewController : UIViewController
@property (nonatomic, strong) MFASelectCityViewModel *viewModel;
@end
|
#ifndef ECAP_ADAPTER_BUFFERSTRING_H
#define ECAP_ADAPTER_BUFFERSTRING_H
class BufferString {
public:
char* start;
char* pos;
char* last;
BufferString(){}
BufferString(char *point):start(point), pos(point), last(point){}
BufferString(char *point, int size):start(point), pos(point), last(point+size){}
};
#endif |
#include<stdio.h>
#include<string.h>
int main ()
{
char a[101];
scanf("%s",a);
int b[124]={0};
int i;
int f= 0, c= 0, fin=0;
f = strlen(a);
int x=0;
for (i = 0 ; i < f ; i++)
{
b[a[i]]+=1;
}
for ( i =97 ; i < 123;i++)
{
if (b[i] != 0)
++x;
}
if(x%2==0)
printf("CHAT WITH HER!\n");
else
printf("IGNORE HIM!\n");
return 0;
}
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
#if JUCE_MAC || JUCE_IOS || DOXYGEN
//==============================================================================
/**
OSX and iOS only - This uses the AudioToolbox framework to read any audio
format that the system has a codec for.
This should be able to understand formats such as mp3, m4a, etc.
@see AudioFormat
@tags{Audio}
*/
class JUCE_API CoreAudioFormat : public AudioFormat
{
public:
//==============================================================================
/** Creates a format object. */
CoreAudioFormat();
/** Destructor. */
~CoreAudioFormat() override;
//==============================================================================
/** Metadata property name used when reading a caf file with a MIDI chunk. */
static const char* const midiDataBase64;
/** Metadata property name used when reading a caf file with tempo information. */
static const char* const tempo;
/** Metadata property name used when reading a caf file time signature information. */
static const char* const timeSig;
/** Metadata property name used when reading a caf file time signature information. */
static const char* const keySig;
//==============================================================================
Array<int> getPossibleSampleRates() override;
Array<int> getPossibleBitDepths() override;
bool canDoStereo() override;
bool canDoMono() override;
//==============================================================================
AudioFormatReader* createReaderFor (InputStream*,
bool deleteStreamIfOpeningFails) override;
AudioFormatWriter* createWriterFor (OutputStream*,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreAudioFormat)
};
#endif
} // namespace juce
|
//
// PhotoBrowser.h
// NewsDetailsDemo
//
// Created by 李响 on 2017/7/11.
// Copyright © 2017年 lee. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PhotoBrowser : NSObject
/**
图片Url数组
*/
@property (nonatomic , strong ) NSArray *imageUrlArray;
/**
当前下标
*/
@property (nonatomic , assign ) NSInteger index;
/**
图片所属视图 (可选)
*/
@property (nonatomic , weak ) UIView *imageView;
/**
加载完成回调
*/
@property (nonatomic , copy ) void (^loadFinishBlock)(PhotoBrowser *, NSInteger index);
/**
长按回调
*/
@property (nonatomic , copy ) void (^longClickBlock)(PhotoBrowser *, NSInteger index);
+ (PhotoBrowser *)browser;
- (void)saveImageWithIndex:(NSInteger)index;
- (void)show;
@end
@interface PhotoBrowserViewController : UIViewController
@property (nonatomic , strong ) PhotoBrowser *browser;
- (void)saveImageWithIndex:(NSInteger)index;
- (void)show;
@end
@interface PhotoBrowserCell : UICollectionViewCell
@property (nonatomic , strong ) NSURL *url;
@property (nonatomic , copy ) void (^longClickBlock)();
@property (nonatomic , copy ) void (^loadFinishBlock)(NSURL *url , UIImage *image);
@property (nonatomic , copy ) void (^hideBlock)();
@end
|
#include "gui.h"
#include "gui_defs.h"
#include "x.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
static void paint(gui *_gui, widget *_w)
{
struct gui *g = _gui;
struct image_widget *w = _w;
LOGD("PAINT image %p\n", w);
x_draw_image(g->x, g->xwin, w->x, w->common.x, w->common.y);
}
static void hints(gui *_gui, widget *_w, int *width, int *height)
{
struct image_widget *w = _w;
LOGD("HINTS image %p\n", w);
*width = w->width;
*height = w->height;
}
struct png_reader {
unsigned char *data;
int size;
int pos;
};
static void png_readfn(png_structp png_ptr, png_bytep data, png_size_t length)
{
struct png_reader *r = png_get_io_ptr(png_ptr);
if (length > r->size - r->pos) png_error(png_ptr, "bad png image");
memcpy(data, r->data + r->pos, length);
r->pos += length;
}
static void load_image(struct gui *g, struct image_widget *w,
unsigned char *data, int length)
{
png_structp png_ptr;
png_infop info_ptr;
png_bytepp image;
int width, height, bit_depth, color_type, channels;
unsigned char *img_data;
struct png_reader r;
int i;
/* unpack PNG data */
r.data = data;
r.size = length;
r.pos = 0;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL) abort();
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) abort();
if (setjmp(png_jmpbuf(png_ptr))) abort();
png_set_read_fn(png_ptr, &r, png_readfn);
png_read_png(png_ptr, info_ptr,
PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_EXPAND | PNG_TRANSFORM_PACKING |
PNG_TRANSFORM_GRAY_TO_RGB | PNG_TRANSFORM_BGR, NULL);
image = png_get_rows(png_ptr, info_ptr);
width = png_get_image_width(png_ptr, info_ptr);
height = png_get_image_height(png_ptr, info_ptr);
bit_depth = png_get_bit_depth(png_ptr, info_ptr);
color_type = png_get_color_type(png_ptr, info_ptr);
channels = png_get_channels(png_ptr, info_ptr);
if (width < 1 || width > 1000 || height < 1 || height > 1000 ||
bit_depth != 8 || color_type != PNG_COLOR_TYPE_RGBA || channels != 4)
{ printf("bad image\n"); abort(); }
img_data = malloc(4 * width * height); if (img_data == NULL) abort();
for (i = 0; i < height; i++)
memcpy(img_data+i*4*width, image[i], width*4);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
/* create the X image */
w->x = x_create_image(g->x, img_data, width, height);
free(img_data);
w->width = width;
w->height = height;
}
widget *new_image(gui *_gui, unsigned char *data, int length)
{
struct gui *g = _gui;
struct image_widget *w;
glock(g);
w = new_widget(g, IMAGE, sizeof(struct image_widget));
load_image(g, w, data, length);
w->common.paint = paint;
w->common.hints = hints;
gunlock(g);
return w;
}
|
/*
* Copyright (C) 2004-2021 Savoir-faire Linux Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <string>
#include <string_view>
#include <vector>
#include <exception>
#include <cstdint>
namespace jami {
namespace base64 {
class base64_exception : public std::exception
{};
std::string encode(std::string_view);
inline std::string encode(const std::vector<uint8_t>& data) {
return encode(std::string_view((const char*)data.data(), data.size()));
}
std::vector<uint8_t> decode(std::string_view);
} // namespace base64
} // namespace jami
|
// SPDX-License-Identifier: GPL-3.0-or-later
/* sysfsparser -- get informations from sysfs
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 _SYSFSPARSER_H
#define _SYSFSPARSER_H
#include <dirent.h>
#include <limits.h>
#include "system.h"
#define PATH_SYS "/sys"
#ifdef __cplusplus
extern "C"
{
#endif
/* generic functions */
void sysfsparser_check_for_sysfs(void);
bool sysfsparser_path_exist (const char *path, ...)
_attribute_format_printf_(1, 2);
void sysfsparser_opendir(DIR **dirp, const char *path, ...)
_attribute_format_printf_(2, 3);
void sysfsparser_closedir(DIR *dirp);
struct dirent *sysfsparser_readfilename(DIR *dirp, unsigned int flags);
char *sysfsparser_getline (const char *filename, ...)
_attribute_format_printf_(1, 2);
unsigned long long sysfsparser_getvalue (const char *filename, ...)
_attribute_format_printf_(1, 2);
/* Lookup a pattern and get the value from line
* Format is:
* "<pattern> <numeric-key>"
*/
int sysfsparser_linelookup_numeric (char *line, char *pattern,
long long *value);
/* cpufreq */
int sysfsparser_cpufreq_get_hardware_limits (unsigned int cpu,
unsigned long *min,
unsigned long *max);
unsigned long sysfsparser_cpufreq_get_freq_kernel (unsigned int cpu);
unsigned long sysfsparser_cpufreq_get_transition_latency (unsigned int cpu);
char *sysfsparser_cpufreq_get_available_freqs (unsigned int cpu);
char *sysfsparser_cpufreq_get_driver (unsigned int cpu);
char *sysfsparser_cpufreq_get_governor (unsigned int cpu);
char *sysfsparser_cpufreq_get_available_governors (unsigned int cpu);
/* thermal sensors */
# define ALL_THERMAL_ZONES UINT_MAX
bool sysfsparser_thermal_kernel_support (void);
const char *sysfsparser_thermal_sysfs_path ();
int sysfsparser_thermal_get_temperature (unsigned int selected_zone,
unsigned int *zone, char **type);
int sysfsparser_thermal_get_critical_temperature (unsigned int thermal_zone);
const char *sysfsparser_thermal_get_device (unsigned int thermal_zone);
void sysfsparser_thermal_listall ();
#ifdef __cplusplus
}
#endif
#endif /* _SYSFSPARSER_H */
|
/*************************************************************************
Program:
File: FreeStringList.c
Version: V1.20R
Date: 18.09.96
Function: General purpose routines
Copyright: (c) SciTech Software 1991-6
Author: Dr. Andrew C. R. Martin
Address: SciTech Software
23, Stag Leys,
Ashtead,
Surrey,
KT21 2TD.
Phone: +44 (0) 1372 275775
EMail: martin@biochem.ucl.ac.uk
**************************************************************************
This program is not in the public domain, but it may be copied
according to the conditions laid out in the accompanying file
COPYING.DOC
The code may not be sold commercially or included as part of a
commercial product except as described in the file COPYING.DOC.
**************************************************************************
Description:
============
These are generally useful C routines, mostly string handling.
**************************************************************************
Usage:
======
**************************************************************************
Revision History:
=================
V1.1 08.02.91 Added KillLine()
V1.2 10.02.91 Added setextn() and index()
V1.3 20.03.91 Added Word()
V1.4 28.05.92 ANSIed
V1.5 22.06.92 Added tab check to Word(). Improved setextn().
Added WordN(). Documented other routines.
V1.6 27.07.93 Corrected fsscanf() for double precision
V1.7 07.10.93 Checks made on case before toupper()/tolower()
for SysV compatibility. Also index() becomes
chindex()
V1.8 18.03.94 getc() -> fgetc()
V1.9 11.05.94 Added GetFilestem(), upstrcmp(), upstrncmp() &
GetWord()
V1.10 24.08.94 Added OpenStdFiles()
V1.11 08.03.95 Corrected OpenFile() for non-UNIX
V1.12 09.03.95 Added check on non-NULL filename in OpenFile()
V1.13 17.07.95 Added countchar()
V1.14 18.10.95 Moved YorN() to WindIO.c
V1.15 06.11.95 Added StoreString(), InStringList() and FreeStringList()
V1.16 22.11.95 Moved ftostr() to generam.c
V1.17 15.12.95 Added QueryStrStr()
V1.18 18.12.95 OpenStdFiles() treats filename of - as stdin/stdout
V1.19 05.02.96 OpenStdFiles() allows NULL pointers instead if filenames
V1.20 18.09.96 Added padchar()
*************************************************************************/
/* Includes
*/
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "MathType.h"
#include "SysDefs.h"
#include "general.h"
#include "macros.h"
/************************************************************************/
/* Defines and macros
*/
/************************************************************************/
/* Globals
*/
/************************************************************************/
/* Prototypes
*/
/************************************************************************/
/*>void FreeStringList(STRINGLIST *StringList)
-------------------------------------------
Input: STRINGLIST *StringList Linked list of strings
Frees memory allocated for a string list.
06.11.95 Original By: ACRM
*/
void FreeStringList(STRINGLIST *StringList)
{
STRINGLIST *p;
for(p=StringList; p!=NULL; NEXT(p))
{
if(p->string != NULL)
free(p->string);
}
FREELIST(StringList, STRINGLIST);
}
|
/*
* Copyright 2014 Giulio Camuffo <giuliocamuffo@gmail.com>
*
* This file is part of TrainsPlanet
*
* TrainsPlanet 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.
*
* TrainsPlanet 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 TrainsPlanet. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HEIGHTMAP_H
#define HEIGHTMAP_H
#include <QVector>
#include "NoisePerlin.h"
#include "NoiseSelect.h"
#include "NoiseConstant.h"
#include "NoiseScalePoint.h"
#include "NoiseRidgedMulti.h"
#include "NoiseScaleBias.h"
#include "NoiseBillow.h"
class HeightMapChunk;
class Generator;
class HeightMap
{
public:
enum class Face {
Top,
Bottom,
Front,
Right,
Left,
Back
};
HeightMap(Generator *generator);
~HeightMap();
HeightMapChunk *chunk(Face face, int x, int y, int size);
inline int size() const { return m_size; }
private:
int m_size;
QVector<float> m_data;
Generator *m_generator;
friend HeightMapChunk;
};
class HeightMapChunk
{
public:
/**
* A padding of one sample will be added all around the chunk, so the data pointer
* MUST be of size (size + 2) * (size + 2)
*/
bool fetchData(int size, float *data);
HeightMapChunk *chunk(int x, int y, int w, int h);
inline int x() const { return m_x; }
inline int y() const { return m_y; }
inline int size() const { return m_size; }
inline HeightMap::Face face() const { return m_face; }
// private:
HeightMap *map;
HeightMap::Face m_face;
int m_x, m_y, m_size;
friend class HeightMap;
};
class Generator
{
public:
Generator() {}
virtual ~Generator() {}
virtual bool fetchData(int destSize, HeightMap::Face face, const QPoint &pos, int size, float *data) = 0;
virtual int size() const = 0;
protected:
HeightMap *map;
friend HeightMap;
};
class RandomGenerator : public Generator
{
public:
RandomGenerator(int size, double heightScale, int seed);
bool fetchData(int destSize, HeightMap::Face face, const QPoint &pos, int size, float *data) override;
int size() const override;
private:
int m_size;
double m_heightScale;
noisepp::PerlinModule m_continents;
noisepp::SelectModule m_continentSelect;
noisepp::ConstantModule m_ocean;
noisepp::PerlinModule m_mountainDefinition;
noisepp::ScalePointModule m_mountainDefinitionScalePoint;
noisepp::SelectModule m_mountainSelect;
noisepp::ScaleBiasModule m_mountainSelectScaleBias;
noisepp::RidgedMultiModule m_mountains;
noisepp::ScaleBiasModule m_mountainsScaleBias;
noisepp::ScalePointModule m_mountainsScalePoint;
noisepp::BillowModule m_lowlands;
noisepp::ScaleBiasModule m_lowlandsScaleBias;
noisepp::ScalePointModule m_lowlandsScalePoint;
noisepp::Pipeline3D *m_pipeline;
noisepp::Cache *m_cache;
noisepp::PipelineElement3D *m_element;
};
#endif
|
#ifndef BGRT_CONFIG_H
/* Example config file */
#define BGRT_CONFIG_H
/**================================================================*/
/** Don't edit this part of the file!!! */
/**================================================================*/
#ifndef __ASSEMBLER__
#define BGRT_SC_TBL(a) const bgrt_scsr_t a
#define BGRT_SC_TBL_READ(a) a
#ifndef NOP
#define NOP() __asm__ __volatile__ ("nop":::)
#endif
typedef unsigned long bgrt_stack_t;
/**================================================================*/
/** Edit this part carefully!!! */
/**================================================================*/
/* Max priority levels are defined by bgrt_map_t,*/
/* you must specify BGRT_BITS_IN_INDEX_T to show*/
/* how many levels you actually are going to use.*/
/* data types*/
typedef unsigned long bgrt_map_t;
#define BGRT_BITS_IN_INDEX_T (32)
#define BGRT_CONFIG_USER_SEARCH(map) (__builtin_ctzl(map))
/* Even if bgrt_map_t is unsigned long long,*/
/* there will be only 64 priority levels available,*/
/* so unsigned char is always enough.*/
typedef unsigned char bgrt_prio_t;
/* unsigned char is enough.*/
typedef unsigned char bgrt_flag_t;
/* unsigned char is enough.*/
typedef unsigned char bgrt_st_t;
#define BGRT_CONFIG_CNT_MAX (0xffffffff)
typedef unsigned long bgrt_cnt_t;
typedef volatile unsigned long bgrt_tmr_t;
/* Unsigned char is enough.*/
/* There is no reason to make it bigger.*/
typedef unsigned char bgrt_bool_t;
/* Unsigned char is enough.*/
/* There is no reason to make it bigger.*/
typedef volatile unsigned char bgrt_syscall_t;
/**===============================================================*/
/** BuguRTOS behavior compilation flags, edit carefully!!! */
/**===============================================================*/
#define BGRT_CONFIG_HARD_RT
/**===============================================================*/
/** Project specific stuff, you are welcome to edit it!!!*/
/**===============================================================*/
#define BGRT_CONFIG_TEST /*This is test project*/.
#define STM32F4
#include <libopencmsis/core_cm3.h>
/*These macros needed to interface cstartup code.*/
#define BGRT_SYSTEM_TIMER_ISR sys_tick_handler
#define BGRT_SYSCALL_ISR pend_sv_handler
#define BGRT_CONFIG_FCPU_HZ (168000000ul)
#define BGRT_CONFIG_FSYSTICK_HZ (1000ul)
#define BGRT_CONFIG_PRIO_BITS 4 /*Used upper priority bits*/
#define BGRT_CONFIG_SYSCALL_PRIO 14 /*SysCall priority*/
#define BGRT_CONFIG_CRITSEC_PRIO 15 /*Critical section priority*/
#define BGRT_CONFIG_SCHED_PRIO 15 /*Scheduler priority*/
#define BGRT_PROC_STACK_SIZE 128
#define LOWEST (BGRT_BITS_IN_INDEX_T - 1)
#define PID0 BGRT_PROC_TO_PID(&proc[0])
#define PID1 BGRT_PROC_TO_PID(&proc[1])
#define PID2 BGRT_PROC_TO_PID(&proc[2])
#define PID3 BGRT_PROC_TO_PID(&proc[3])
#define PID4 BGRT_PROC_TO_PID(&proc[4])
#define PID5 BGRT_PROC_TO_PID(&proc[5])
#define PR0 (&proc[0])
#define PR1 (&proc[1])
#define PR2 (&proc[2])
#define PR3 (&proc[3])
#define PR4 (&proc[4])
#define PR5 (&proc[5])
#define SVH0 (bgrt_code_t)0
#define RSH0 (bgrt_code_t)0
#define SVH1 (bgrt_code_t)0
#define RSH1 (bgrt_code_t)0
#define SVH2 (bgrt_code_t)0
#define RSH2 (bgrt_code_t)0
#define SVH3 (bgrt_code_t)0
#define RSH3 (bgrt_code_t)0
#define SVH4 (bgrt_code_t)0
#define RSH4 (bgrt_code_t)0
#define SVH5 (bgrt_code_t)0
#define RSH5 (bgrt_code_t)0
/**================================================================*/
/** Don't edit this part of the file!!! */
/**================================================================*/
extern void kernel_preemt_hook(void);
#define BGRT_KERNEL_PREEMPT() kernel_preemt_hook()
#endif /*__ASSEMBLER__*/
#endif /*BGRT_CONFIG_H*/
|
#include "../include/system.h"
uint8 inportb (uint16 _port)
{
uint8 rv;
__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
return rv;
}
void outportb (uint16 _port, uint8 _data)
{
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
}
|
/*
This file is part of cpp-ethereum.
cpp-ethereum 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.
cpp-ethereum 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 cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file vm.h
* @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
* @author Gav Wood <i@gavwood.com>
* @date 2014
* vm test functions.
*/
#pragma once
#include <fstream>
#include <cstdint>
#include <boost/test/unit_test.hpp>
#include <json_spirit/json_spirit.h>
#include <libdevcore/Log.h>
#include <libdevcore/CommonIO.h>
#include <libevmcore/Instruction.h>
#include <libevm/ExtVMFace.h>
#include <libevm/VM.h>
#include <liblll/Compiler.h>
#include <libethereum/Transaction.h>
#include <libethereum/ExtVM.h>
#include <libethereum/State.h>
#include <test/TestHelper.h>
namespace dev { namespace test {
struct FakeExtVMFailure : virtual Exception {};
class FakeExtVM: public eth::ExtVMFace
{
public:
FakeExtVM() = default;
FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth = 0);
virtual u256 store(u256 _n) override { return std::get<2>(addresses[myAddress])[_n]; }
virtual void setStore(u256 _n, u256 _v) override { std::get<2>(addresses[myAddress])[_n] = _v; }
virtual bool exists(Address _a) override { return !!addresses.count(_a); }
virtual u256 balance(Address _a) override { return std::get<0>(addresses[_a]); }
virtual void subBalance(u256 _a) override { std::get<0>(addresses[myAddress]) -= _a; }
virtual u256 txCount(Address _a) override { return std::get<1>(addresses[_a]); }
virtual void suicide(Address _a) override { std::get<0>(addresses[_a]) += std::get<0>(addresses[myAddress]); addresses.erase(myAddress); }
virtual bytes const& codeAt(Address _a) override { return std::get<3>(addresses[_a]); }
virtual h160 create(u256 _endowment, u256& io_gas, bytesConstRef _init, eth::OnOpFunc const&) override;
virtual bool call(eth::CallParameters&) override;
void setTransaction(Address _caller, u256 _value, u256 _gasPrice, bytes const& _data);
void setContract(Address _myAddress, u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage, bytes const& _code);
void set(Address _a, u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage, bytes const& _code);
void reset(u256 _myBalance, u256 _myNonce, std::map<u256, u256> const& _storage);
u256 doPosts();
json_spirit::mObject exportEnv();
void importEnv(json_spirit::mObject& _o);
json_spirit::mObject exportState();
void importState(json_spirit::mObject& _object);
json_spirit::mObject exportExec();
void importExec(json_spirit::mObject& _o);
json_spirit::mArray exportCallCreates();
void importCallCreates(json_spirit::mArray& _callcreates);
eth::OnOpFunc simpleTrace();
std::map<Address, std::tuple<u256, u256, std::map<u256, u256>, bytes>> addresses;
eth::Transactions callcreates;
bytes thisTxData;
bytes thisTxCode;
u256 gas;
};
} } // Namespace Close
|
/**
* Copyright 2013-2015 Seagate Technology LLC.
*
* 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
* https://mozilla.org/MP:/2.0/.
*
* This program is distributed in the hope that it will be useful,
* but is provided AS-IS, WITHOUT ANY WARRANTY; including without
* the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or
* FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public
* License for more details.
*
* See www.openkinetic.org for more project information
*/
#include "kinetic_types_internal.h"
#include "kinetic_types.h"
STATIC const char* KineticStatusInvalid = "INVALID_STATUS_CODE";
STATIC const char* KineticStatusDescriptor[] = {
"NOT_ATTEMPTED",
"SUCCESS",
"SESSION_EMPTY",
"SESSION_INVALID",
"HOST_EMPTY",
"HMAC_REQUIRED",
"NO_PDUS_AVAILABLE",
"DEVICE_BUSY",
"CONNECTION_ERROR",
"INVALID_REQUEST",
"OPERATION_INVALID",
"OPERATION_FAILED",
"OPERATION_TIMEDOUT",
"CLUSTER_MISMATCH",
"VERSION_MISMATCH",
"DATA_ERROR",
"NOT_FOUND",
"BUFFER_OVERRUN",
"MEMORY_ERROR",
"SOCKET_TIMEOUT",
"SOCKET_ERROR",
"MISSING_KEY",
"MISSING_VALUE_BUFFER",
"MISSING_PIN",
"SSL_REQUIRED",
"DEVICE_LOCKED",
"ACL_ERROR",
"NOT_AUTHORIZED",
"INVALID_FILE",
"REQUEST_REJECTED",
"DEVICE_NAME_REQUIRED",
"INVALID_LOG_TYPE",
"HMAC_FAILURE",
"SESSION_TERMINATED",
};
#ifdef TEST
STATIC const int KineticStatusDescriptorCount =
sizeof(KineticStatusDescriptor) / sizeof(char*);
#endif
const char* Kinetic_GetStatusDescription(KineticStatus status)
{
if ((int)status < 0 || status >= (int)KINETIC_STATUS_COUNT) {
// see KineticProtoStatusCode_to_KineticStatus
fprintf(stderr,"Kinetic_GetStatusDescription mismatch! (%d)\n", status);
return KineticStatusInvalid;
}
return KineticStatusDescriptor[(int)status];
}
const char* KineticMessageTypeNames[33] =
{
"<UNKNOWN>",
"GET_RESPONSE",
"GET",
"PUT_RESPONSE",
"PUT",
"DELETE_RESPONSE",
"DELETE",
"GETNEXT_RESPONSE",
"GETNEXT",
"GETPREVIOUS_RESPONSE",
"GETPREVIOUS",
"GETKEYRANGE_RESPONSE",
"GETKEYRANGE",
"GETVERSION_RESPONSE",
"GETVERSION",
"SETUP_RESPONSE",
"SETUP",
"GETLOG_RESPONSE",
"GETLOG",
"SECURITY_RESPONSE",
"SECURITY",
"PEER2PEERPUSH_RESPONSE",
"PEER2PEERPUSH",
"NOOP_RESPONSE",
"NOOP",
"FLUSHALLDATA_RESPONSE",
"FLUSHALLDATA",
"PINOP_RESPONSE",
"PINOP",
"MEDIASCAN_RESPONSE",
"MEDIASCAN",
"MEDIAOPTIMIZE_RESPONSE",
"MEDIAOPTIMIZE",
};
const char* KineticMessageType_GetName(KineticMessageType type)
{
switch(type) {
case KINETIC_MESSAGE_TYPE_GET_RESPONSE:
return "GET_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GET:
return "GET";
break;
case KINETIC_MESSAGE_TYPE_PUT_RESPONSE:
return "PUT_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_PUT:
return "PUT";
break;
case KINETIC_MESSAGE_TYPE_DELETE_RESPONSE:
return "DELETE_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_DELETE:
return "DELETE";
break;
case KINETIC_MESSAGE_TYPE_GETNEXT_RESPONSE:
return "GETNEXT_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GETNEXT:
return "GETNEXT";
break;
case KINETIC_MESSAGE_TYPE_GETPREVIOUS_RESPONSE:
return "GETPREVIOUS_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GETPREVIOUS:
return "GETPREVIOUS";
break;
case KINETIC_MESSAGE_TYPE_GETKEYRANGE_RESPONSE:
return "GETKEYRANGE_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GETKEYRANGE:
return "GETKEYRANGE";
break;
case KINETIC_MESSAGE_TYPE_GETVERSION_RESPONSE:
return "GETVERSION_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GETVERSION:
return "GETVERSION";
break;
case KINETIC_MESSAGE_TYPE_SETUP_RESPONSE:
return "SETUP_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_SETUP:
return "SETUP";
break;
case KINETIC_MESSAGE_TYPE_GETLOG_RESPONSE:
return "GETLOG_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_GETLOG:
return "GETLOG";
break;
case KINETIC_MESSAGE_TYPE_SECURITY_RESPONSE:
return "SECURITY_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_SECURITY:
return "SECURITY";
break;
case KINETIC_MESSAGE_TYPE_PEER2PEERPUSH_RESPONSE:
return "PEER2PEERPUSH_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_PEER2PEERPUSH:
return "PEER2PEERPUSH";
break;
case KINETIC_MESSAGE_TYPE_NOOP_RESPONSE:
return "NOOP_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_NOOP:
return "NOOP";
break;
case KINETIC_MESSAGE_TYPE_FLUSHALLDATA_RESPONSE:
return "FLUSHALLDATA_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_FLUSHALLDATA:
return "FLUSHALLDATA";
break;
case KINETIC_MESSAGE_TYPE_PINOP_RESPONSE:
return "PINOP_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_PINOP:
return "PINOP";
break;
case KINETIC_MESSAGE_TYPE_MEDIASCAN_RESPONSE:
return "MEDIASCAN_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_MEDIASCAN:
return "MEDIASCAN";
break;
case KINETIC_MESSAGE_TYPE_MEDIAOPTIMIZE_RESPONSE:
return "MEDIAOPTIMIZE_RESPONSE";
break;
case KINETIC_MESSAGE_TYPE_MEDIAOPTIMIZE:
return "MEDIAOPTIMIZE";
break;
default:
case KINETIC_MESSAGE_TYPE_INVALID:
return KineticMessageTypeNames[0];
};
}
|
/**
* \file
*
* \brief Global interrupt management for 8-bit AVR
*
* Copyright (C) 2010-2014 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 UTILS_INTERRUPT_INTERRUPT_H
#define UTILS_INTERRUPT_INTERRUPT_H
#include <compiler.h>
#include <parts.h>
/**
* \weakgroup interrupt_group
*
* @{
*/
#ifdef ISR_CUSTOM_H
# include ISR_CUSTOM_H
#else
/**
* \def ISR
* \brief Define service routine for specified interrupt vector
*
* Usage:
* \code
ISR(FOO_vect)
{
...
}
\endcode
*
* \param vect Interrupt vector name as found in the device header files.
*/
#if defined(__DOXYGEN__)
# define ISR(vect)
#elif defined(__GNUC__)
# include <avr/interrupt.h>
#elif defined(__ICCAVR__)
# define __ISR(x) _Pragma(#x)
# define ISR(vect) __ISR(vector=vect) __interrupt void handler_##vect(void)
#endif
#endif // ISR_CUSTOM_H
#if XMEGA
/**
* \brief Initialize interrupt vectors
* Enables all interrupt levels, with vectors located in the application section
* and fixed priority scheduling.
*/
#define irq_initialize_vectors() \
PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
#elif MEGA_RF
#define irq_initialize_vectors()
#endif
#ifdef __GNUC__
# define cpu_irq_enable() sei()
# define cpu_irq_disable() cli()
#else
# define cpu_irq_enable() __enable_interrupt()
# define cpu_irq_disable() __disable_interrupt()
#endif
typedef uint8_t irqflags_t;
static inline irqflags_t cpu_irq_save(void)
{
irqflags_t flags = SREG;
cpu_irq_disable();
return flags;
}
static inline void cpu_irq_restore(irqflags_t flags)
{
barrier();
SREG = flags;
}
static inline bool cpu_irq_is_enabled_flags(irqflags_t flags)
{
#if XMEGA
# ifdef __GNUC__
return flags & CPU_I_bm;
# else
return flags & I_bm;
# endif
#elif MEGA || TINY
return flags & (1 << SREG_I);
#endif
}
#define cpu_irq_is_enabled() cpu_irq_is_enabled_flags(SREG)
//! @}
/**
* \weakgroup interrupt_deprecated_group
* @{
*/
// Deprecated definitions.
#define Enable_global_interrupt() cpu_irq_enable()
#define Disable_global_interrupt() cpu_irq_disable()
#define Is_global_interrupt_enabled() cpu_irq_is_enabled()
//! @}
#endif /* UTILS_INTERRUPT_INTERRUPT_H */
|
#ifndef PLASTIQQNETWORKSESSION_H
#define PLASTIQQNETWORKSESSION_H
#include "plastiqobject.h"
class PlastiQQNetworkSession : public PlastiQObject {
PLASTIQ_OBJECT(IsQObject,QNetworkSession,QObject)
PLASTIQ_INHERITS(QObject)
public: ~PlastiQQNetworkSession();
};
#endif // PLASTIQQNETWORKSESSION_H |
/**********************************************************************************************/
/* FBL.h */
/* */
/* Copyright Paradigma, 1998-2017 */
/* All Rights Reserved */
/**********************************************************************************************/
// The TOP HEADER of Valentina engine, which includes into self
// Macros.h > OS.h > Types.h > Constants > Errors.h > CompilerXXX.h > FBL_new.h > Helpers
//
#ifndef _FBL_h
#define _FBL_h
#pragma once
/**********************************************************************************************/
#if defined(_WIN64)
#include <stdio.h>
#endif // _WIN64
/**********************************************************************************************/
#include <VShared/FBL/publ/Headers/FBL_Macros.h>
/**********************************************************************************************/
#if FBL_MAC
#if FBL_MAC_MACHO
#include <VShared/FBL/publ/Headers/FBL_OsMacMacho.h>
#else
#include <VShared/FBL/publ/Headers/FBL_OsMac.h>
#endif
#endif // FBL_MAC
#if FBL_WIN
#include <VShared/FBL/publ/Headers/FBL_OsWin.h>
#endif // FBL_WIN
#if FBL_UNIX
#include <stdio.h>
#include <VShared/FBL/publ/Headers/FBL_OsLinux.h>
#endif // FBL_UNIX
/**********************************************************************************************/
#include <VShared/FBL/publ/Headers/FBL_Types.h>
#include <VShared/FBL/publ/Headers/FBL_Types_Unicode.h>
//
#include <VShared/FBL/publ/Headers/FBL_Constants.h> // constants go after types, to use them.
//
#include <VShared/FBL/publ/Errors/FBL_Errors.h> // just vuint32 constants actually.
/**********************************************************************************************/
// If not static defined and not DLL defined and we build not shared dll, then we set DLL mode.
// This is to simplify setup of projects for VSDK users.
// This section should go before #include <CompillerXXXX.h> section.
//
#if !defined(FBL_STATIC) && !defined(FBL_DLL_IMPORT) && !defined(FBL_SHARED_EXPORT) && !defined(FBL_DLL_EXPORT)
#define FBL_DLL_IMPORT 1
#endif // not static and not dll defined
/**********************************************************************************************/
// Compiler specific macros:
//
#ifdef __GNUC__
#include <VShared/FBL/publ/Headers/FBL_CompGCC.h>
#endif // __GNUC__
#ifdef _MSC_VER
#include <VShared/FBL/publ/Headers/FBL_CompVisual.h>
#endif // _MSC_VER
/**********************************************************************************************/
#include <VShared/FBL/publ/Templates/FBL_StAllocator.h>
/**********************************************************************************************/
// DEBUG Macros and tools for Valentina Tests. Used only in DEBUG builds of course.
//
#include <VShared/FBL/publ/Headers/FBL_Debug_Macros.h>
#include <VShared/FBL/publ/TestTools/FBL_TestSystem_Globals.h>
/**********************************************************************************************/
// We have own implementation of intrusive smart_ptrs inspired by BOOST.
//
#include <VShared/FBL/publ/Templates/FBL_Smart_Ptr.h>
/**********************************************************************************************/
#include <VShared/FBL/publ/Templates/FBL_StValueChanger.h>
/**********************************************************************************************/
// Some useful global functions, classes, templates that can be used in any file.
//
// independent:
//
#include <VShared/FBL/publ/Templates/FBL_MemPtr.h>
#include <VShared/FBL/publ/Headers/FBL_Globals.h>
#include <VShared/FBL/publ/Templates/FBL_Global_T.h>
//
// depends:
//
#include <VShared/FBL/publ/Interfaces/FBL_I_Unknown.h>
#include <VShared/FBL/publ/Templates/FBL_Array.h>
#include <VShared/FBL/publ/Errors/FBL_Exceptions.h>
/**********************************************************************************************/
#endif // _FBL_h
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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/. */
#ifndef GFX_FONTMISSINGGLYPHS_H
#define GFX_FONTMISSINGGLYPHS_H
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace gfx {
class DrawTarget;
class Pattern;
} // namespace gfx
} // namespace mozilla
/**
* This class should not be instantiated. It's just a container
* for some helper functions.
*/
class gfxFontMissingGlyphs final
{
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Pattern Pattern;
typedef mozilla::gfx::Rect Rect;
gfxFontMissingGlyphs() = delete; // prevent instantiation
public:
/**
* Draw hexboxes for a missing glyph.
* @param aChar the UTF16 codepoint for the character
* @param aRect the glyph-box for the glyph that is missing
* @param aDrawTarget the DrawTarget to draw to
* @param aPattern the pattern currently being used to paint
* @param aAppUnitsPerDevPixel the appUnits to devPixel ratio we're using,
* (so we can scale glyphs to a sensible size)
*/
static void DrawMissingGlyph(uint32_t aChar,
const Rect& aRect,
DrawTarget& aDrawTarget,
const Pattern& aPattern,
uint32_t aAppUnitsPerDevPixel);
/**
* @return the desired minimum width for a glyph-box that will allow
* the hexboxes to be drawn reasonably.
*/
static Float GetDesiredMinWidth(uint32_t aChar,
uint32_t aAppUnitsPerDevUnit);
};
#endif
|
/*hdr
**
** Copyright Mox Products, Australia
**
** FILE NAME: UnlockWnd.c
**
** AUTHOR: Mike Zhang
**
** DATE: 28 - Jan - 2011
**
** FILE DESCRIPTION:
**
**
** FUNCTIONS:
**
**
** NOTES:
**
*/
#include <windows.h>
#include <stdio.h>
#include <sys/timeb.h>
#include <string.h>
#include <stdlib.h>
#include <MoxFB.h>
#include <device.h>
/************** USER INCLUDE FILES ***************************************************/
#include "MXMem.h"
#include "MXList.h"
#include "MXMsg.h"
#include "MXMdId.h"
#include "MXTypes.h"
#include "Dispatch.h"
#include "MXCommon.h"
#include "ModuleTalk.h"
#include "BacpNetCtrl.h"
#include "Multimedia.h"
#include "TalkEventWnd.h"
#include "UnlockWnd.h"
#include "MenuParaProc.h"
#include "ASProcWnd.h"
//#include "AsAlarmWnd.h"
//#include "SecurityAlarm.h"
/************** DEFINES **************************************************************/
#define DEBUG_ULKWND
/************** TYPEDEFS *************************************************************/
/************** STRUCTURES ***********************************************************/
/************** EXTERNAL DECLARATIONS ************************************************/
extern HWND g_HwndAsAlarm;
//!!! It is H/H++ file specific, nothing should be defined here
/************** ENTRY POINT DECLARATIONS *********************************************/
/************** LOCAL DECLARATIONS ***************************************************/
HWND g_hWNDUlk = NULL;
/*************************************************************************************/
/*hdr
** Copyright Mox Products, Australia
**
** FUNCTION NAME: UlkWndPaint
** AUTHOR: Mike Zhang
** DATE: 28 - Jan - 2011
**
** DESCRIPTION:
**
**
** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION
** None
** RETURNED VALUE:
** None
** NOTES:
**
*/
static void
UlkWndPaint(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HDC Hdc;
PAINTSTRUCT ps;
RECT Rect;
Hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &Rect);
FastFillRect(Hdc, &Rect, BACKGROUND_COLOR);
Hdc->bkcolor = BACKGROUND_COLOR;
Hdc->textcolor = FONT_COLOR;
if (SET_CHINESE == g_SysConfig.LangSel)
{
MXDrawText_Center(Hdc, STR_GATEUNLOCK_CN, 1);
}
else if (SET_ENGLISH == g_SysConfig.LangSel)
{
MXDrawText_Center(Hdc, STR_GATEUNLOCK_EN, 1);
}
else if (SET_HEBREW == g_SysConfig.LangSel)
{
MXDrawText_Center(Hdc, GetHebrewStr(HS_ID_GATEUNLOCK), 1);
}
EndPaint(hWnd, &ps);
}
static LRESULT CALLBACK
UlkWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CREATE:
break;
case WM_PAINT:
if (GetFocus() == hWnd)
{
UlkWndPaint(hWnd, Msg, wParam, lParam);
}
break;
case WM_CHAR:
if (GetFocus() != hWnd)
{
SendMessage(GetFocus(), WM_CHAR, wParam, 0l);
return;
}
break;
case WM_TIMER:
break;
case WM_REFRESHPARENT_WND:
SetFocus(hWnd);
PostMessage(hWnd, WM_PAINT, 0, 0);
break;
case WM_DESTROY:
ClearKeyBuffer();
g_hWNDUlk = NULL;
// SendMessage(GetFocus(), WM_REFRESHPARENT_WND, 0, 0);
break;
default:
// if (WM_CLOSE == Msg)
// {
// RemoveOneWnd(hWnd);
// }
// return DefWindowProc(hWnd, Msg, wParam, lParam);
DefWindowProc(hWnd, Msg, wParam, lParam);
if (WM_CLOSE == Msg)
{
RemoveOneWnd(hWnd);
}
}
return 0;
}
void
CreateUlkWnd(HWND hwndParent)
{
static char szAppName[] = "Unlock";
HWND hWnd;
WNDCLASS WndClass;
if (NULL != g_HwndAsAlarm)
{
return;
}
WndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = (WNDPROC) UlkWndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = 0;
WndClass.hIcon = 0;
WndClass.hCursor = 0;
WndClass.hbrBackground = (HBRUSH)GetStockObject(BACKGROUND_COLOR);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = szAppName;
RegisterClass(&WndClass);
hWnd = CreateWindowEx(
0L, // Extend style (0)
szAppName, // Class name (NULL)
"UlkWnd", // Window name (Not NULL)
WS_OVERLAPPED | WS_VISIBLE | WS_CHILD, // Style (0)
0, // x (0)
0, // y (0)
SCREEN_WIDTH, // Width
SCREEN_HEIGHT, // Height
g_hMainWnd /*hwndParent*/, // Parent (MwGetFocus())
NULL, // Menu (NULL)
NULL, // Instance (NULL)
NULL); // Parameter (NULL)
AddOneWnd(hWnd,WND_UNLOCK_PRIORITY_4);
if (hWnd == GetFocus())
{
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
}
else
{
ShowWindow(hWnd, SW_HIDE);
}
#ifdef DEBUG_ULKWND
printf("Ulk Wnd create successfully\n");
#endif
g_hWNDUlk = hWnd;
}
void
ShowUlkWnd(void)
{
if (g_hWndAS)
{
//if(ST_MT_MONITOR == g_TalkInfo.monitor.dwMonState)
SendMessage(g_hWndAS, WM_CLOSE, 0, 0);
}
if (g_hWNDUlk)
{
g_TalkInfo.unlock.dwUnLockShowState = ST_UK_DELAY;
g_TalkInfo.Timer.dwUnlockShowTimer = GetTickCount();
SendMessage(g_hWNDUlk, WM_PAINT, 0, 0);
}
else
{
g_TalkInfo.unlock.dwUnLockShowState = ST_UK_DELAY;
g_TalkInfo.Timer.dwUnlockShowTimer = GetTickCount();
CreateUlkWnd(GetFocus());
}
}
void
HideUlkWnd(void)
{
if (g_hWNDUlk)
{
SendMessage(g_hWNDUlk, WM_CLOSE, 0, 0);
}
}
|
#ifndef VIDEOFILEMETADATA_H
#define VIDEOFILEMETADATA_H
#include <string>
#include <cstdint>
namespace libthmbnlr {
struct VideoFileMetadata {
std::string m_CodecName;
double m_Duration;
int64_t m_BitRate;
double m_FrameRate;
};
}
#endif // VIDEOFILEMETADATA_H
|
/* scp.c
* Copyright (c) 2012, Peter Ohler
* All rights reserved.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <unistd.h>
#include "oj.h"
#include "parse.h"
#include "encode.h"
static VALUE
noop_start(ParseInfo pi) {
return Qnil;
}
static void
noop_end(ParseInfo pi) {
}
static void
noop_add_value(ParseInfo pi, VALUE val) {
}
static void
noop_add_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
}
static void
noop_add_num(ParseInfo pi, NumInfo ni) {
}
static VALUE
noop_hash_key(struct _ParseInfo *pi, const char *key, size_t klen) {
return Qundef;
}
static void
noop_hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, const char *orig) {
}
static void
noop_hash_set_num(ParseInfo pi, Val kval, NumInfo ni) {
}
static void
noop_hash_set_value(ParseInfo pi, Val kval, VALUE value) {
}
static void
noop_array_append_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
}
static void
noop_array_append_num(ParseInfo pi, NumInfo ni) {
}
static void
noop_array_append_value(ParseInfo pi, VALUE value) {
}
static void
add_value(ParseInfo pi, VALUE val) {
rb_funcall(pi->handler, oj_add_value_id, 1, val);
}
static void
add_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
volatile VALUE rstr = rb_str_new(str, len);
rstr = oj_encode(rstr);
rb_funcall(pi->handler, oj_add_value_id, 1, rstr);
}
static void
add_num(ParseInfo pi, NumInfo ni) {
rb_funcall(pi->handler, oj_add_value_id, 1, oj_num_as_value(ni));
}
static VALUE
start_hash(ParseInfo pi) {
return rb_funcall(pi->handler, oj_hash_start_id, 0);
}
static void
end_hash(ParseInfo pi) {
rb_funcall(pi->handler, oj_hash_end_id, 0);
}
static VALUE
start_array(ParseInfo pi) {
return rb_funcall(pi->handler, oj_array_start_id, 0);
}
static void
end_array(ParseInfo pi) {
rb_funcall(pi->handler, oj_array_end_id, 0);
}
static VALUE
calc_hash_key(ParseInfo pi, Val kval) {
volatile VALUE rkey = kval->key_val;
if (Qundef == rkey) {
rkey = rb_str_new(kval->key, kval->klen);
rkey = oj_encode(rkey);
if (Yes == pi->options.sym_key) {
rkey = rb_str_intern(rkey);
}
}
return rkey;
}
static VALUE
hash_key(struct _ParseInfo *pi, const char *key, size_t klen) {
return rb_funcall(pi->handler, oj_hash_key_id, 1, rb_str_new(key, klen));
}
static void
hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, const char *orig) {
volatile VALUE rstr = rb_str_new(str, len);
rstr = oj_encode(rstr);
rb_funcall(pi->handler, oj_hash_set_id, 3, stack_peek(&pi->stack)->val, calc_hash_key(pi, kval), rstr);
}
static void
hash_set_num(ParseInfo pi, Val kval, NumInfo ni) {
rb_funcall(pi->handler, oj_hash_set_id, 3, stack_peek(&pi->stack)->val, calc_hash_key(pi, kval), oj_num_as_value(ni));
}
static void
hash_set_value(ParseInfo pi, Val kval, VALUE value) {
rb_funcall(pi->handler, oj_hash_set_id, 3, stack_peek(&pi->stack)->val, calc_hash_key(pi, kval), value);
}
static void
array_append_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
volatile VALUE rstr = rb_str_new(str, len);
rstr = oj_encode(rstr);
rb_funcall(pi->handler, oj_array_append_id, 2, stack_peek(&pi->stack)->val, rstr);
}
static void
array_append_num(ParseInfo pi, NumInfo ni) {
rb_funcall(pi->handler, oj_array_append_id, 2, stack_peek(&pi->stack)->val, oj_num_as_value(ni));
}
static void
array_append_value(ParseInfo pi, VALUE value) {
rb_funcall(pi->handler, oj_array_append_id, 2, stack_peek(&pi->stack)->val, value);
}
VALUE
oj_sc_parse(int argc, VALUE *argv, VALUE self) {
struct _ParseInfo pi;
VALUE input = argv[1];
parse_info_init(&pi);
pi.err_class = Qnil;
pi.max_depth = 0;
pi.options = oj_default_options;
if (3 == argc) {
oj_parse_options(argv[2], &pi.options);
}
if (rb_block_given_p()) {
pi.proc = Qnil;
} else {
pi.proc = Qundef;
}
pi.handler = *argv;
pi.start_hash = rb_respond_to(pi.handler, oj_hash_start_id) ? start_hash : noop_start;
pi.end_hash = rb_respond_to(pi.handler, oj_hash_end_id) ? end_hash : noop_end;
pi.hash_key = rb_respond_to(pi.handler, oj_hash_key_id) ? hash_key : noop_hash_key;
pi.start_array = rb_respond_to(pi.handler, oj_array_start_id) ? start_array : noop_start;
pi.end_array = rb_respond_to(pi.handler, oj_array_end_id) ? end_array : noop_end;
if (rb_respond_to(pi.handler, oj_hash_set_id)) {
pi.hash_set_value = hash_set_value;
pi.hash_set_cstr = hash_set_cstr;
pi.hash_set_num = hash_set_num;
pi.expect_value = 1;
} else {
pi.hash_set_value = noop_hash_set_value;
pi.hash_set_cstr = noop_hash_set_cstr;
pi.hash_set_num = noop_hash_set_num;
pi.expect_value = 0;
}
if (rb_respond_to(pi.handler, oj_array_append_id)) {
pi.array_append_value = array_append_value;
pi.array_append_cstr = array_append_cstr;
pi.array_append_num = array_append_num;
pi.expect_value = 1;
} else {
pi.array_append_value = noop_array_append_value;
pi.array_append_cstr = noop_array_append_cstr;
pi.array_append_num = noop_array_append_num;
pi.expect_value = 0;
}
if (rb_respond_to(pi.handler, oj_add_value_id)) {
pi.add_cstr = add_cstr;
pi.add_num = add_num;
pi.add_value = add_value;
pi.expect_value = 1;
} else {
pi.add_cstr = noop_add_cstr;
pi.add_num = noop_add_num;
pi.add_value = noop_add_value;
pi.expect_value = 0;
}
pi.has_callbacks = true;
if (T_STRING == rb_type(input)) {
return oj_pi_parse(argc - 1, argv + 1, &pi, 0, 0, 1);
} else {
return oj_pi_sparse(argc - 1, argv + 1, &pi, 0);
}
}
|
#pragma once
/* TRXC read/send buffer size */
#define TRXC_MSG_BUF_SIZE 1500
/* TRXD read/send buffer size (max. lo MTU) */
#define TRXD_MSG_BUF_SIZE 65536
struct trx_dl_burst_req;
struct trx_l1h;
struct trx_ctrl_msg {
struct llist_head list;
char cmd[28];
char params[100];
int cmd_len;
int params_len;
int critical;
void *cb;
};
typedef void trx_if_cmd_generic_cb(struct trx_l1h *l1h, int rc);
typedef void trx_if_cmd_poweronoff_cb(struct trx_l1h *l1h, bool poweronoff, int rc);
typedef void trx_if_cmd_setslot_cb(struct trx_l1h *l1h, uint8_t tn, uint8_t type, int rc);
typedef void trx_if_cmd_getnompower_cb(struct trx_l1h *l1h, int nominal_power, int rc);
typedef void trx_if_cmd_setpower_att_cb(struct trx_l1h *l1h, int power_att_db, int rc);
void trx_if_init(struct trx_l1h *l1h);
int trx_if_cmd_poweroff(struct trx_l1h *l1h, trx_if_cmd_poweronoff_cb *cb);
int trx_if_cmd_poweron(struct trx_l1h *l1h, trx_if_cmd_poweronoff_cb *cb);
int trx_if_cmd_settsc(struct trx_l1h *l1h, uint8_t tsc, trx_if_cmd_generic_cb *cb);
int trx_if_cmd_setbsic(struct trx_l1h *l1h, uint8_t bsic, trx_if_cmd_generic_cb *cb);
int trx_if_cmd_setrxgain(struct trx_l1h *l1h, int db);
int trx_if_cmd_getnompower(struct trx_l1h *l1h, trx_if_cmd_getnompower_cb *cb);
int trx_if_cmd_setpower_att(struct trx_l1h *l1h, int power_att_db, trx_if_cmd_setpower_att_cb *cb);
int trx_if_cmd_setmaxdly(struct trx_l1h *l1h, int dly);
int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly);
int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, trx_if_cmd_setslot_cb *cb);
int trx_if_cmd_rxtune(struct trx_l1h *l1h, uint16_t arfcn, trx_if_cmd_generic_cb *cb);
int trx_if_cmd_txtune(struct trx_l1h *l1h, uint16_t arfcn, trx_if_cmd_generic_cb *cb);
int trx_if_cmd_handover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
int trx_if_cmd_nohandover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
int trx_if_cmd_rfmute(struct trx_l1h *l1h, bool mute);
int trx_if_send_burst(struct trx_l1h *l1h, const struct trx_dl_burst_req *br);
int trx_if_powered(struct trx_l1h *l1h);
/* The latest supported TRXD PDU version */
#define TRX_DATA_PDU_VER 2
/* Format negotiation command */
int trx_if_cmd_setformat(struct trx_l1h *l1h, uint8_t ver, trx_if_cmd_generic_cb *cb);
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* 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`
*/
#ifndef _NGAP_ScheduledCommunicationTime_H_
#define _NGAP_ScheduledCommunicationTime_H_
#include <asn_application.h>
/* Including external dependencies */
#include <BIT_STRING.h>
#include <NativeInteger.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct NGAP_ProtocolExtensionContainer;
/* NGAP_ScheduledCommunicationTime */
typedef struct NGAP_ScheduledCommunicationTime {
BIT_STRING_t *dayofWeek; /* OPTIONAL */
long *timeofDayStart; /* OPTIONAL */
long *timeofDayEnd; /* OPTIONAL */
struct NGAP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} NGAP_ScheduledCommunicationTime_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_NGAP_ScheduledCommunicationTime;
extern asn_SEQUENCE_specifics_t asn_SPC_NGAP_ScheduledCommunicationTime_specs_1;
extern asn_TYPE_member_t asn_MBR_NGAP_ScheduledCommunicationTime_1[4];
#ifdef __cplusplus
}
#endif
#endif /* _NGAP_ScheduledCommunicationTime_H_ */
#include <asn_internal.h>
|
//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//[未実装]
bool SampleCamera()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
Camera camera({320,240},1);
Image image("data/pipo-enemy035.png");
Font font(SystemFont::Mincho, 10);
ImagePack frameImage("data/pipo-WindowBase001.png", 9, 3, 3);
BmpFrame bmpFrame(&frameImage);
while (System::Update())
{
Camera::Set(&camera);
Drawing::Rect({ 10, 10, 100, 100 }, Color::White);
Drawing::Circle({ 200, 200, 100 }, Color::Red, 20);
Drawing::Line({ 0, 0 }, { 640, 480 }, Color::Lime);
font.Draw({ 200, 10 }, Color::Blue, "Hello World!");
image.Draw({ 300, 300 });
Camera::Set();//カメラによる位置補正無効化
bmpFrame.Draw({ 0, 0, 640, 40 });
font.Draw({ 10, 10 }, Color::White, { "マウスカーソルでカメラ位置変更、ホイールで拡大縮小\n位置 =", Input::mouse.x, ",",Input::mouse.y," 拡大率 = ",camera.zoom });
//マウスの位置が中心に来る
camera.position = { Input::mouse.x, Input::mouse.y };
//ホイールで拡大縮小
if (Input::mouse.Whell > 0)
{
camera.zoom *= 0.9;
}
if (Input::mouse.Whell < 0)
{
camera.zoom *= 1.1;
}
if (Input::key.Return.on){ break; }//Enterで終了
}
System::End();
return true;
} |
/*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (c) 2014-2019 Appsicle
* Copyright (c) 2019-2022 QuestDB
*
* 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.
*
******************************************************************************/
#include <processthreadsapi.h>
#include <errhandlingapi.h>
#define SECURITY_WIN32
#include <sspi.h>
#include <issper16.h>
#include <rpc.h>
#include <sys/timeb.h>
#include "../share/os.h"
#include "errno.h"
#include "timer.h"
JNIEXPORT jint JNICALL Java_io_questdb_std_Os_getPid
(JNIEnv *e, jclass cl) {
return GetCurrentProcessId();
}
JNIEXPORT jint JNICALL Java_io_questdb_std_Os_errno
(JNIEnv *e, jclass cl) {
return (jint) (intptr_t) TlsGetValue(dwTlsIndexLastError);
}
typedef struct {
SECURITY_STATUS status;
long cbToken;
void *token;
} KRB_TOKEN, *PKRB_TOKEN;
#define SEC_PACKAGE_NAME "Kerberos"
jlong JNICALL Java_io_questdb_std_Os_generateKrbToken
(JNIEnv *e, jclass cl, jlong spn) {
PKRB_TOKEN result = malloc(sizeof(KRB_TOKEN));
result->token = NULL;
result->cbToken = 0;
PSecPkgInfoA pkgInfo;
result->status = QuerySecurityPackageInfoA(SEC_PACKAGE_NAME, &pkgInfo);
if (result->status != SEC_E_OK) {
FreeContextBuffer(pkgInfo);
return (jlong) result;
}
const unsigned long cbMaxToken = pkgInfo->cbMaxToken;
FreeContextBuffer(pkgInfo);
CredHandle clientCred;
result->status = AcquireCredentialsHandleA(
NULL,
SEC_PACKAGE_NAME,
SECPKG_CRED_OUTBOUND,
NULL,
NULL,
NULL,
NULL,
&clientCred,
NULL);
if (result->status != SEC_E_OK) {
return (jlong) result;
}
result->token = malloc(cbMaxToken);
SecBufferDesc outSecBufDesc;
SecBuffer outSecBuf;
outSecBufDesc.ulVersion = SECBUFFER_VERSION;
outSecBufDesc.cBuffers = 1;
outSecBufDesc.pBuffers = &outSecBuf;
outSecBuf.cbBuffer = cbMaxToken;
outSecBuf.BufferType = SECBUFFER_TOKEN;
outSecBuf.pvBuffer = result->token;
DWORD dwClientFlags;
result->status = InitializeSecurityContext(
&clientCred,
NULL,
(char *) spn,
ISC_REQ_CONFIDENTIALITY | ISC_REQ_IDENTIFY | ISC_REQ_SEQUENCE_DETECT |
ISC_REQ_REPLAY_DETECT,
0,
SECURITY_NATIVE_DREP,
NULL,
0,
NULL,
&outSecBufDesc,
&dwClientFlags,
NULL
);
result->cbToken = outSecBuf.cbBuffer;
FreeCredentialsHandle(&clientCred);
return (jlong) result;
}
JNIEXPORT jint JNICALL Java_io_questdb_std_Os_setCurrentThreadAffinity0
(JNIEnv *e, jclass fd, jint cpu) {
DWORD_PTR mask = (DWORD_PTR) (1L << cpu);
if (SetThreadAffinityMask(GetCurrentThread(), mask) == 0) {
SaveLastError();
return -1;
}
return 0;
}
#define exp7 10000000LL //1E+7 //C-file part
#define exp9 1000000000LL //1E+9
#define w2ux 116444736000000000LL //1.jan1601 to 1.jan1970
void unix_time(struct timespec *spec) {
__int64 wintime;
GetSystemTimeAsFileTime((FILETIME *) &wintime);
wintime -= w2ux;
spec->tv_sec = wintime / exp7;
spec->tv_nsec = wintime % exp7 * 100;
}
int clock_gettime(struct timespec *spec) {
static struct timespec startspec;
static double ticks2nano;
static __int64 startticks, tps = 0;
__int64 tmp, curticks;
QueryPerformanceFrequency((LARGE_INTEGER *) &tmp);
if (tps != tmp) {
tps = tmp; //init ~~ONCE
// possibly change freq ?
QueryPerformanceCounter((LARGE_INTEGER *) &startticks);
unix_time(&startspec);
ticks2nano = (double) exp9 / tps;
}
QueryPerformanceCounter((LARGE_INTEGER *) &curticks);
curticks -= startticks;
spec->tv_sec = startspec.tv_sec + (curticks / tps);
spec->tv_nsec = (long) (startspec.tv_nsec + (double) (curticks % tps) * ticks2nano);
if (spec->tv_nsec >= exp9) {
spec->tv_sec++;
spec->tv_nsec -= exp9;
}
return 0;
}
JNIEXPORT jlong JNICALL Java_io_questdb_std_Os_currentTimeNanos
(JNIEnv *e, jclass cl) {
struct timespec spec;
clock_gettime(&spec);
return spec.tv_sec * 1000000000 + spec.tv_nsec;
}
JNIEXPORT void JNICALL Java_io_questdb_std_Os_freeKrbToken
(JNIEnv *e, jclass cl, jlong ptr) {
PKRB_TOKEN ptoken = (PKRB_TOKEN) ptr;
if (ptoken->token) {
free(ptoken->token);
}
free(ptoken);
}
BOOL WINAPI DllMain(
_In_ HINSTANCE hinstDLL,
_In_ DWORD fdwReason,
_In_ LPVOID lpvReserved
) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
dwTlsIndexLastError = TlsAlloc();
setupTimer();
break;
case DLL_PROCESS_DETACH:
TlsFree(dwTlsIndexLastError);
dwTlsIndexLastError = 0;
break;
default:
break;
}
return TRUE;
}
JNIEXPORT void JNICALL Java_io_questdb_std_Os_setupTimer
(JNIEnv *e, jclass cl) {
setupTimer();
}
JNIEXPORT jlong JNICALL Java_io_questdb_std_Os_currentTimeMicros
(JNIEnv *e, jclass cl) {
return now();
}
void SaveLastError() {
TlsSetValue(dwTlsIndexLastError, (LPVOID) (DWORD_PTR) GetLastError());
}; |
/*-------------------------------------------------------------------------
*
* mingwcompat.c
* MinGW compatibility functions
*
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
*
* IDENTIFICATION
* src/backend/port/win32/mingwcompat.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#ifndef WIN32_ONLY_COMPILER
/*
* MingW defines an extern to this struct, but the actual struct isn't present
* in any library. It's trivial enough that we can safely define it
* ourselves.
*/
const struct in6_addr in6addr_any = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};
/*
* This file contains loaders for functions that are missing in the MinGW
* import libraries. It's only for actual Win32 API functions, so they are
* all present in proper Win32 compilers.
*/
static HMODULE kernel32 = NULL;
/*
* Load DLL file just once regardless of how many functions
* we load/call in it.
*/
static void
LoadKernel32()
{
if (kernel32 != NULL)
return;
kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0);
if (kernel32 == NULL)
ereport(FATAL,
(errmsg_internal("could not load kernel32.dll: error code %lu",
GetLastError())));
}
/*
* Replacement for RegisterWaitForSingleObject(), which lives in
* kernel32.dll
*/
typedef
BOOL (WINAPI * __RegisterWaitForSingleObject)
(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL;
BOOL WINAPI
RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
HANDLE hObject,
WAITORTIMERCALLBACK Callback,
PVOID Context,
ULONG dwMilliseconds,
ULONG dwFlags)
{
if (_RegisterWaitForSingleObject == NULL)
{
LoadKernel32();
_RegisterWaitForSingleObject = (__RegisterWaitForSingleObject)
GetProcAddress(kernel32, "RegisterWaitForSingleObject");
if (_RegisterWaitForSingleObject == NULL)
ereport(FATAL,
(errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: error code %lu",
GetLastError())));
}
return (_RegisterWaitForSingleObject)
(phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags);
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.