text
stringlengths 4
6.14k
|
|---|
#ifndef _T3F_SDL_BOUTON
#define _T3F_SDL_BOUTON
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include <string>
#include <iostream>
#include "widget.h"
#include "focuscontainer.h"
class Bouton: public Widget
{
public:
Bouton(SDL_Rect position, std::string cap, void (*cb)(void));
virtual ~Bouton();
void setFont(std::string fontname, short int fontsize) { font = TTF_OpenFont(fontname.c_str(), fontsize); if(!font) std::cerr << "Error : Loading " << fontname << " : " << TTF_GetError() << std::endl; };
void setColors(SDL_Color setbg, SDL_Color setfg, SDL_Color setborder) { bg = setbg; fg = setfg; border = setborder; };
void setFocusColors(SDL_Color setbg, SDL_Color setfg, SDL_Color setborder) { focusbg = setbg; focusfg = setfg; focusborder = setborder; };
void setUnactiveColors(SDL_Color setbg, SDL_Color setfg, SDL_Color setborder) { unactivebg = setbg; unactivefg = setfg; unactiveborder = setborder; };
void setBorderSize(unsigned short int size) { borderSize = size; };
bool isFocusable() { return !unactive; }
void setCaption(std::string cap) { *caption = cap; };
void setActive(bool active) { unactive = !active; };
bool getActive() { return !unactive; };
bool *getUnactivePtr() { return &unactive; };
virtual void onFocus(bool foc, bool nextIfUnactive = true);
virtual void afficher(SDL_Surface *Screen);
virtual int filtre(const SDL_Event *event);
private:
// Style
TTF_Font *font;
SDL_Color border, bg, fg;
SDL_Color focusborder, focusbg, focusfg;
SDL_Color unactiveborder, unactivebg, unactivefg;
bool unactive;
unsigned short int borderSize;
// Propriétés
void (*callback)(void);
SDL_Rect pos;
std::string* caption;
};
#endif
|
/* vi: ts=8 sts=4 sw=4
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
*/
#ifndef __Lexer_h_included__
#define __Lexer_h_included__
#include <QByteArray>
/**
* This is a lexer for the kdesud protocol.
*/
class Lexer {
public:
Lexer(const QByteArray &input);
~Lexer();
/** Read next token. */
int lex();
/** Return the token's value. */
QByteArray &lval();
enum Tokens {
Tok_none, Tok_exec=256, Tok_pass, Tok_delCmd,
Tok_ping, Tok_str, Tok_num , Tok_stop,
Tok_set, Tok_get, Tok_delVar, Tok_delGroup,
Tok_host, Tok_prio, Tok_sched, Tok_getKeys,
Tok_chkGroup, Tok_delSpecialKey, Tok_exit
};
private:
QByteArray m_Input;
QByteArray m_Output;
int in;
};
#endif
|
#include "common.h"
PS_OPEN_FUNC(uwsgi) {
PS_SET_MOD_DATA((char *)save_path);
return SUCCESS;
}
PS_CLOSE_FUNC(uwsgi) {
return SUCCESS;
}
PS_READ_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
uint64_t valsize = 0;
#ifdef UWSGI_PHP7
char *value = uwsgi_cache_magic_get(key->val, key->len , &valsize, NULL, cache);
#else
char *value = uwsgi_cache_magic_get((char *)key, strlen((char *)key), &valsize, NULL, cache);
#endif
if (!value) {
*val = STR_EMPTY_ALLOC();
return SUCCESS;
}
#ifdef UWSGI_PHP7
*val = zend_string_init(value, valsize, 0);
#else
char *new_val = emalloc(valsize);
memcpy(new_val, value, valsize);
free(value);
*val = new_val;
*vallen = valsize;
#endif
return SUCCESS;
}
PS_WRITE_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
#ifdef UWSGI_PHP7
if (val->len == 0) return SUCCESS;
if (!uwsgi_cache_magic_set(key->val, key->len, val->val, val->len, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
#else
if (vallen == 0) return SUCCESS;
if (!uwsgi_cache_magic_set((char *)key, strlen(key), (char *)val, vallen, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
#endif
return SUCCESS;
}
return FAILURE;
}
PS_DESTROY_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
#ifdef UWSGI_PHP7
if (!uwsgi_cache_magic_exists(key->val, key->len, cache))
return SUCCESS;
if (!uwsgi_cache_magic_del(key->val, key->len, cache)) {
#else
if (!uwsgi_cache_magic_del((char *)key, strlen(key), cache)) {
#endif
return SUCCESS;
}
return FAILURE;
}
PS_GC_FUNC(uwsgi) {
return SUCCESS;
}
ps_module ps_mod_uwsgi = {
PS_MOD(uwsgi)
};
|
/* Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
The GNU C 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.
The GNU C 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 the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SYS_MSG_H
# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
#endif
#include <bits/types.h>
#include <bits/wordsize.h>
/* Define options for message queue functions. */
#define MSG_NOERROR 010000 /* no error if message is too big */
#ifdef __USE_GNU
# define MSG_EXCEPT 020000 /* recv any msg except of specified type */
#endif
/* Types used in the structure definition. */
typedef __syscall_ulong_t msgqnum_t;
typedef __syscall_ulong_t msglen_t;
#if !defined(__TIME_T_64_BITS) && __WORDSIZE == 64
#define __TIME_T_64_BITS
#endif
/* Structure of record for one message inside the kernel.
The type `struct msg' is opaque. */
struct msqid_ds
{
struct ipc_perm msg_perm; /* structure describing operation permission */
__time_t msg_stime; /* time of last msgsnd command */
#ifndef __TIME_T_64_BITS
unsigned long int __unused1;
#endif
__time_t msg_rtime; /* time of last msgrcv command */
#ifndef __TIME_T_64_BITS
unsigned long int __unused2;
#endif
__time_t msg_ctime; /* time of last change */
#ifndef __TIME_T_64_BITS
unsigned long int __unused3;
#endif
__syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */
msgqnum_t msg_qnum; /* number of messages currently on queue */
msglen_t msg_qbytes; /* max number of bytes allowed on queue */
__pid_t msg_lspid; /* pid of last msgsnd() */
__pid_t msg_lrpid; /* pid of last msgrcv() */
__syscall_ulong_t __unused4;
__syscall_ulong_t __unused5;
};
#ifdef __USE_MISC
# define msg_cbytes __msg_cbytes
/* ipcs ctl commands */
# define MSG_STAT 11
# define MSG_INFO 12
/* buffer for msgctl calls IPC_INFO, MSG_INFO */
struct msginfo
{
int msgpool;
int msgmap;
int msgmax;
int msgmnb;
int msgmni;
int msgssz;
int msgtql;
unsigned short int msgseg;
};
#endif /* __USE_MISC */
|
//=============================================================================
// AL
// Audio Utility Library
// $Id: al.h,v 1.1.2.2 2009/12/06 01:39:33 terminator356 Exp $
//
// Copyright (C) 2002-2006 by Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef __AL_H__
#define __AL_H__
namespace AL
{
extern bool debugMsg;
//extern int sampleRate;
//extern int mtcType;
//extern int division;
}
#endif
|
/*
*********************************************************************************************************
* uC/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
* µC/GUI 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 redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : GUIValF.C
Purpose : Displaying floating point values
---------------------------END-OF-HEADER------------------------------
*/
#include "GUI_Protected.h"
#include "math.h"
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _DispFloatFix
*/
static void _DispFloatFix(float f, char Len, char Decs, int DrawPlusSign) {
f *= GUI_Pow10[(unsigned)Decs];
f += 0.5;
f = (float) floor (f);
if (DrawPlusSign) {
GUI_DispSDecShift((long)f, Len, Decs);
} else {
GUI_DispDecShift((long)f, Len, Decs);
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUI_DispFloatFix
*/
void GUI_DispFloatFix(float f, char Len, char Decs) {
_DispFloatFix(f, Len, Decs, 0);
}
/*********************************************************************
*
* GUI_DispFloatMin
*/
void GUI_DispFloatMin(float f, char Fract) {
char Len;
Len = GUI_Long2Len((long)f);
if ((f < 0) && (f > -1)) { /* If value < 0 and > -1 (e.g. -0.123) increment length by 1 */
Len++;
}
_DispFloatFix(f, (char)(Len + Fract + (Fract ? 1 : 0)), (char)Fract, 0);
}
/*********************************************************************
*
* GUI_DispFloat
*/
void GUI_DispFloat(float f, char Len) {
int Decs;
Decs = Len - GUI_Long2Len((long)f)-1;
if ((f < 0) && (f > -1)) { /* If value < 0 and > -1 (e.g. -0.123) decrement Decs */
Decs--;
}
if (Decs<0)
Decs =0;
_DispFloatFix(f, Len, (char)Decs, 0);
}
/*********************************************************************
*
* GUI_DispSFloatFix
*/
void GUI_DispSFloatFix(float f, char Len, char Fract) {
_DispFloatFix (f, Len, Fract, 1);
}
/*********************************************************************
*
* GUI_DispSFloatMin
*/
void GUI_DispSFloatMin(float f, char Fract) {
char Len;
Len = GUI_Long2Len((long)f);
if ((f < 0) && (f > -1)) { /* If value < 0 and > -1 (e.g. -0.123) increment length by 1 */
Len++;
}
if (f>0) {
Len++;
}
_DispFloatFix(f, (char)(Len + Fract + (Fract ? 1 : 0)), (char)Fract, 1);
}
/*************************** End of file ****************************/
|
/**
* Copyright (C) 2013 Raúl Moreno Galdón
*
* 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 "aux_vector.h"
/**
* Initializes vector with initial values.
*/
ERROR_CODE
initialize_vector(uint32_t *vector, const size_t size, const uint32_t value)
{
int i;
if(size == 0)
return INVALID_INPUT_SIZE_0;
for(i = 0; i < size; i++)
{
vector[i] = value;
}
return NO_ERROR;
}
/**
* Return vector of integers with initial values.
*/
ERROR_CODE
new_vector_uint32(const size_t size, const uint32_t value, uint32_t **out_vector)
{
int i;
uint32_t *vector;
if(size == 0)
{
*out_vector = NULL;
return INVALID_INPUT_SIZE_0;
}
vector = (uint32_t *)malloc(size * sizeof(uint32_t));
for(i = 0; i < size; i++)
vector[i] = value;
//printf("Created new vector uint32 with %d positions, total size %lu bytes\n", (int)size, size * sizeof(uint32_t));
*out_vector = vector;
return NO_ERROR;
}
/**
* Return vector of double with initial values.
*/
ERROR_CODE
new_vector_double(const size_t size, const double value, double **out_vector)
{
int i;
double *vector;
if(size == 0)
{
*out_vector = NULL;
return INVALID_INPUT_SIZE_0;
}
vector = (double *)malloc(size * sizeof(double));
for(i = 0; i < size; i++)
vector[i] = value;
//printf("Created new vector double with %d positions, total size %lu bytes\n", (int)size, size * sizeof(double));
*out_vector = vector;
return NO_ERROR;
}
/**
* Return vector of double with initial values.
*/
ERROR_CODE
max_value(double *vector, size_t size, double *max)
{
double maximum = -DBL_MAX;
double aux;
int i;
for(i = size-1; i >= 0; i--)
{
aux = vector[i];
if(aux > maximum)
maximum = aux;
}
*max = maximum;
return NO_ERROR;
}
/**
* Get component index of vector max value.
*/
ERROR_CODE
max_index(double *vector, size_t size, uint16_t *max_i)
{
double max = -DBL_MAX;
int index = -1;
double aux;
int i;
for(i = size-1; i >= 0; i--)
{
aux = vector[i];
if(aux > max)
{
max = aux;
index = i;
}
}
*max_i = index;
return NO_ERROR;
}
|
#pragma once
/*
* Copyright (C) 2005-2015 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "interfaces/IActionListener.h"
namespace PVR
{
class CPVRActionListener : public IActionListener
{
public:
static CPVRActionListener &GetInstance();
bool OnAction(const CAction &action);
private:
CPVRActionListener();
CPVRActionListener(const CPVRActionListener&);
CPVRActionListener& operator=(const CPVRActionListener&);
~CPVRActionListener() {};
};
} // namespace PVR
|
#include <resolv.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/nameser.h>
#include "dietfeatures.h"
static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
/*
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ID |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|QR| Opcode |AA|TC|RD|RA| Z | RCODE |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| QDCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ANCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| NSCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ARCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*/
extern void __dns_make_fd(void);
extern int __dns_fd;
extern int __dns_servers;
extern struct sockaddr __dns_server_ips[];
extern void __dns_readstartfiles(void);
int res_mkquery(int op, const char *dname, int class, int type, char* data,
int datalen, const unsigned char* newrr, char* buf, int buflen) {
unsigned char packet[512];
unsigned long len;
(void)newrr;
(void)data;
(void)datalen;
memcpy(packet,dnspacket,12);
len=rand();
packet[0]=len;
packet[1]=len>>8;
len=0;
if ((_res.options&RES_RECURSE)==0) packet[2]=0;
packet[2] |= (op&7)<<3;
{
unsigned char* x;
const char* y,* tmp;
x=packet+12; y=dname;
while (*y) {
while (*y=='.') ++y;
for (tmp=y; *tmp && *tmp!='.'; ++tmp) ;
if (tmp-y > 63) return -1;
*x=tmp-y;
if (!(tmp-y)) break;
if ((len+=*x+1) > 254) return -1;
++x;
// if (x>=packet+510-(tmp-y)) { return -1; }
memmove(x,y,tmp-y);
x+=tmp-y;
if (!*tmp) {
*x=0;
break;
}
y=tmp;
}
*++x= 0; *++x= type; /* A */
*++x= 0; *++x= class; /* IN */
++x;
if (x-packet>buflen) return -1;
memmove(buf,packet,x-packet);
return x-packet;
}
}
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _Throwable_H
#define _Throwable_H
#include <Python.h>
#include "java/lang/Object.h"
#include "java/lang/Class.h"
#include "JArray.h"
namespace java {
namespace io {
class PrintWriter;
}
namespace lang {
class String;
class Throwable : public Object {
public:
static Class *class$;
static jmethodID *_mids;
static jclass initializeClass();
explicit Throwable(jobject obj) : Object(obj) {
initializeClass();
}
void printStackTrace() const;
void printStackTrace(java::io::PrintWriter) const;
String getMessage() const;
};
extern PyTypeObject Throwable$$Type;
class t_Throwable {
public:
PyObject_HEAD
Throwable object;
static PyObject *wrap_Object(const Throwable& object);
static PyObject *wrap_jobject(const jobject& object);
};
}
}
#endif /* _Throwable_H */
|
/**
* @file
*/
/*
Copyright (C) 2002-2020 UFO: Alien Invasion.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
#include "ientity.h"
#include "../brush/Brush.h"
class LevelFilter
{
private:
void filter_level (int level);
void filter_level1 ();
void filter_level2 ();
void filter_level3 ();
void filter_level4 ();
void filter_level5 ();
void filter_level6 ();
void filter_level7 ();
void filter_level8 ();
private:
typedef std::vector<std::string> EntityClassNameList;
typedef std::list<Brush*> BrushList;
typedef std::list<Entity*> EntityList;
class EntityFindByName: public scene::Graph::Walker
{
const std::string& m_name;
EntityList& m_entitylist;
/* this starts at 1 << level */
int m_flag;
int m_hide;
public:
EntityFindByName (const std::string& name, EntityList& entitylist, int flag, bool hide);
bool pre (const scene::Path& path, scene::Instance& instance) const;
};
class ForEachFace: public BrushVisitor
{
public:
mutable int m_contentFlagsVis;
mutable int m_surfaceFlagsVis;
ForEachFace (Brush& brush);
void visit (Face& face) const;
};
class BrushGetLevel: public scene::Graph::Walker
{
BrushList& m_brushlist;
int m_flag;
mutable bool m_hide;
public:
BrushGetLevel (BrushList& brushlist, int flag, bool hide);
bool pre (const scene::Path& path, scene::Instance& instance) const;
};
private:
int currentActiveLevel;
EntityClassNameList _classNameList;
public:
LevelFilter ();
void registerCommands (void);
int getCurrentLevel (void);
};
inline LevelFilter& GlobalLevelFilter ()
{
static LevelFilter _levelFilter;
return _levelFilter;
}
|
/*
ver_check.c
Version number comparisons
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2000 Jeff Teunissen <deek@dusknet.dhs.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <ctype.h>
#include <stdlib.h>
#include "QF/qtypes.h"
#include "QF/ver_check.h"
/*
ver_compare
Compare two ASCII version strings. If the first is greater than the second,
return a positive number. If the second is greater, return a negative. If
they are equal, return zero.
*/
VISIBLE int
ver_compare (const char *value, const char *reference)
{
const char *valptr, *refptr;
int vc, rc;
long vl, rl;
if (!value)
value = "";
if (!reference)
reference = "";
for (;;) {
valptr = value;
// Scan past any non-digits
while (*valptr && !isdigit ((byte) *valptr))
valptr++;
refptr = reference;
// get past non-digits
while (*refptr && !isdigit ((byte) *refptr))
refptr++;
for (;;) {
vc = (value == valptr) ? 0 : *value++;
rc = (reference == refptr) ? 0 : *reference++;
if ((!vc) && (!rc))
break;
if (vc && !isalpha (vc))
vc += 256; // ASCII charset
if (rc && !isalpha (rc))
rc += 256;
if (vc != rc)
return (vc - rc);
}
value = valptr;
reference = refptr;
vl = rl = 0;
if (isdigit ((byte) *valptr))
vl = strtol (value, (char **) &value, 10);
if (isdigit ((byte) *refptr))
rl = strtol (reference, (char **) &reference, 10);
if (vl != rl)
return (vl - rl);
if ((!*value) && (!*reference))
return 0;
if (!*value)
return -1;
if (!*reference)
return 1;
}
}
|
/* IA64-specific clocksource additions */
#ifndef _ASM_IA64_CLOCKSOURCE_H
#define _ASM_IA64_CLOCKSOURCE_H
struct arch_clocksource_data {
void *fsys_mmio; /* used by fsyscall asm code */
};
#endif /* _ASM_IA64_CLOCKSOURCE_H */
|
/*
* pydatum.h
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST 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.
*
* NEST 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 NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef PYTHONDATUM_H
#define PYTHONDATUM_H
extern "C" {
#include<Python.h>
}
#include "token.h"
#include "datum.h"
/**
* Python class for encapsulating generic Datums which can not be converted
* to a native python type.
*/
struct PyDatum
{
PyObject_HEAD
Token token;
};
extern PyTypeObject PyDatumType;
/**
* Create a new PyDatum object initialized with the given Datum.
* @returns new reference.
*/
extern PyObject* PyDatum_FromDatum(Datum &d);
/**
* Get the pointer to the Datum contained in this PyDatum.
*/
inline
Datum* PyDatum_GetDatum(PyDatum *pyd)
{
return pyd->token.datum();
}
/**
* Check if the object is a PyDatum.
* @returns true if the object is a PyDatum.
*/
inline
bool PyDatum_Check(PyObject *pObj)
{
return PyObject_IsInstance(pObj,reinterpret_cast<PyObject*>(&PyDatumType));
}
#endif
|
/*
mkvpropedit -- utility for editing properties of existing Matroska files
Distributed under the GPL v2
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
Written by Moritz Bunkus <moritz@bunkus.org>.
*/
#ifndef MTX_PROPEDIT_ATTACHMENT_TARGET_H
#define MTX_PROPEDIT_ATTACHMENT_TARGET_H
#include "common/common_pch.h"
#include <boost/optional.hpp>
#include <matroska/KaxAttached.h>
#include "propedit/target.h"
#include "propedit/target_id_manager.h"
using namespace libebml;
using namespace libmatroska;
using attachment_id_manager_c = target_id_manager_c<KaxAttached>;
using attachment_id_manager_cptr = std::shared_ptr<attachment_id_manager_c>;
class attachment_target_c: public target_c {
public:
struct options_t {
boost::optional<std::string> m_name, m_description, m_mime_type;
options_t &
name(std::string const &p_name) {
m_name.reset(p_name);
return *this;
}
options_t &
description(std::string const &p_description) {
m_description.reset(p_description);
return *this;
}
options_t &
mime_type(std::string const &p_mime_type) {
m_mime_type.reset(p_mime_type);
return *this;
}
};
enum command_e {
ac_add,
ac_delete,
ac_replace,
};
enum selector_type_e {
st_id,
st_uid,
st_name,
st_mime_type,
};
protected:
std::string m_spec;
command_e m_command;
options_t m_options;
selector_type_e m_selector_type;
uint64_t m_selector_num_arg;
std::string m_selector_string_arg;
memory_cptr m_file_content;
attachment_id_manager_cptr m_id_manager;
public:
attachment_target_c();
virtual ~attachment_target_c();
virtual void set_id_manager(attachment_id_manager_cptr const &id_manager);
virtual void validate();
virtual bool operator ==(target_c const &cmp) const;
virtual void parse_spec(command_e command, const std::string &spec, options_t const &options);
virtual void dump_info() const;
virtual bool has_changes() const;
virtual void execute();
protected:
virtual void execute_add();
virtual void execute_delete();
virtual void execute_replace();
virtual bool delete_by_id();
virtual bool delete_by_uid_name_mime_type();
virtual bool replace_by_id();
virtual bool replace_by_uid_name_mime_type();
virtual void replace_attachment_values(KaxAttached &att);
virtual bool matches_by_uid_name_or_mime_type(KaxAttached &att);
};
inline bool
operator ==(attachment_target_c::options_t const &a,
attachment_target_c::options_t const &b) {
return (a.m_name == b.m_name)
&& (a.m_description == b.m_description)
&& (a.m_mime_type == b.m_mime_type);
}
inline std::ostream &
operator <<(std::ostream &out,
attachment_target_c::options_t const &opt) {
auto format = [](std::string const &name, boost::optional<std::string> const &value) -> std::string {
return value ? name + ":yes(" + *value + ")" : name + ":no";
};
out << "{" << format("name", opt.m_name) << " " << format("description", opt.m_description) << " " << format("MIME type", opt.m_mime_type) << "}";
return out;
}
#endif // MTX_PROPEDIT_ATTACHMENT_TARGET_H
|
/******************************************************************************
*
* This file is part of openDarkEngine project
* Copyright (C) 2005-2006 openDarkEngine team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* $Id$
*
*****************************************************************************/
#ifndef __MODELSCALEPROPERTY_H
#define __MODELSCALEPROPERTY_H
#include "RenderedProperty.h"
namespace Opde {
/** a ModelScale property implementation using rendered property handler.
* Controls the scale of the object
* Uses Vector3. Defaults to 1.0,1.0,1.0 - No scale. Inherits always.
*/
class ModelScaleProperty : public RenderedProperty {
public:
/// constructor
ModelScaleProperty(RenderService* rs, PropertyService* owner);
/// destructor
virtual ~ModelScaleProperty(void);
protected:
/// @see ActiveProperty::addProperty
void addProperty(int oid);
/// @see ActiveProperty::removeProperty
void removeProperty(int oid);
/// @see ActiveProperty::setPropertySource
void setPropertySource(int oid, int effid);
/// @see ActiveProperty::valueChanged
void valueChanged(int oid, const std::string& field, const DVariant& value);
/// core setter method. Called from other methods to set the scale value
void setScale(int oid, const Vector3& scale);
Ogre::SceneManager* mSceneMgr;
};
};
#endif
|
/*
* Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
* Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
Test case for assertion #1 of the sigaction system call that shows
sigaction (when used with a non-null act pointer) changes the action
for a signal.
Steps:
1. Initialize a global variable to indicate the signal
handler has not been called. (A signal handler of the
prototype "void func(int signo);" will set the global
variable to indicate otherwise.
2. Use sigaction to setup a signal handler for SIGSYS
3. Raise SIGSYS.
4. Verify the global indicates the signal was called.
*/
#include <signal.h>
#include <stdio.h>
#include "posixtest.h"
static volatile int handler_called;
void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
int main(void)
{
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGSYS, &act, 0) == -1) {
perror("Unexpected error while attempting to setup test "
"pre-conditions");
return PTS_UNRESOLVED;
}
if (raise(SIGSYS) == -1) {
perror("Unexpected error while attempting to setup test "
"pre-conditions");
return PTS_UNRESOLVED;
}
if (handler_called) {
printf("Test PASSED\n");
return PTS_PASS;
}
printf("Test FAILED\n");
return PTS_FAIL;
}
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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.
*
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-1-1/backends/platform/n64/portdefs.h $
* $Id: portdefs.h 48153 2010-02-28 13:09:09Z Hkz $
*
*/
#ifndef __N64_PORTDEFS__
#define __N64_PORTDEFS__
#include <n64utils.h>
#include <sys/types.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#undef assert
#define assert(x) ((x) ? 0 : (print_error("ASSERT TRIGGERED:\n\n("#x")\n%s\nline: %d", __FILE__, __LINE__)))
#endif
|
#define SMI_DEV_MAJOR_NUMBER 250
#define SMIMONITORMAGICNO 'p'
typedef struct {
unsigned long u4Master; //SMI master 0~3
unsigned long u4PortNo;
unsigned long bBusType : 1;//0 for GMC, 1 for AXI
unsigned long bDestType : 2;//0 for EMI+internal mem, 1 for EMI, 3 for internal mem
unsigned long bRWType : 2;//0 for R+W, 1 for read, 2 for write
}SMIBMCfg;
typedef struct {
unsigned long bIdleSelection : 1; // 0 : idle count increase when no request, and outstanding request is less than , 1 : idle count increase when there is no request and read/write data transfer.
unsigned long uIdleOutStandingThresh : 3;
unsigned long bDPSelection : 1; // 0 : data phase incresae 1 when any outstanding transaction waits for data transfer. 1 : data phase increase N when N out standing transaction are waiting.
unsigned long bMaxPhaseSelection : 1;// 0 : Command pahse , 1 : Data phase.
unsigned long bStarvationEn : 1; // 0 : disable , 1 : Enable
unsigned long uStarvationTime : 8;
unsigned long u2Reserved : 12; //Reserved
}SMIBMCfg_Ext;
typedef struct {
unsigned long u4EndTimeSec;
unsigned long u4EndTimeMicroSec;
unsigned long u4ActiveCnt;
unsigned long u4RequestCnt;
unsigned long u4IdleCnt;
unsigned long u4ByteCnt;
unsigned long u4BeatCnt;
unsigned long u4CommPhaseAccum;
unsigned long u4DataPhaseAccum;
unsigned long u4MaxCommOrDataPhase;
unsigned long u4MaxOutTransaction;
SMIBMCfg cfg; // For recording Port information
SMIBMCfg_Ext cfg_ex;
}SMIBMResult;
#define MT6575_SMI_ALLPORT_NUM 71
#define MT6575_SMI1_PORT_NUM 27
#define MT6575_SMI2_PORT_NUM 31
#define MT6575_SMI3_PORT_NUM 9
#define MT6575_SMI4_PORT_NUM 4
char* MT6575_SMI1_PORT_NAME[256] =
{
"DEFECT",
"JPG_ENC",
"ROT_DMA0_OUT0",
"ROT_DMA1_OUT0",
"TV_ROT_OUT0",
"CAM",
"FD0",
"FD2",
"JPG_DEC0",
"R_DMA0_OUT0",
"R_DMA0_OUT1",
"R_DMA0_OUT2",
"FD1",
"PCA",
"JPGDMA_R",
"JPGDMA_W",
"ROT_DMA0_OUT1",
"ROT_DMA0_OUT2",
"ROT_DMA1_OUT1",
"ROT_DMA1_OUT2",
"TV_ROT_OUT1",
"TV_ROT_OUT2",
"R_DMA0_OUT3",
"JPG_DEC1",
"TV_ROT_OUT3",
"ROT_DMA0_OUT3",
"ROT_DMA1_OUT3"
};
char* MT6575_SMI2_PORT_NAME[256] =
{
"OVL_MSK",
"OVL_DCP",
"DPI",
"ROT_DMA2_OUT0",
"ROT_DMA3_OUT0",
"ROT_DMA4_OUT0",
"TVC",
"LCD_R",
"LCD_W",
"R_DMA1_OUT0",
"R_DMA1_OUT1",
"R_DMA1_OUT2",
"SPI",
"DUMMY",
"DPI_HWC",
"VRZ",
"ROT_DMA2_OUT1",
"ROT_DMA2_OUT2",
"ROT_DMA3_OUT1",
"ROT_DMA3_OUT2",
"ROT_DMA4_OUT1",
"ROT_DMA4_OUT2",
"GREQ_BLKW",
"GREQ_BLKR",
"TVC_PFH",
"TVC_RESZ",
"R_DMA1_OUT3",
"EIS",
"ROT_DMA2_OUT3",
"ROT_DMA3_OUT3",
"ROT_DAM4_OUT3"
};
char* MT6575_SMI3_PORT_NAME[256] =
{
"VENC_MC",
"VENC_BSDMA",
"VENC_MVQP",
"VDEC_DMA",
"VDEC_REC",
"VDEC_POST0",
"VDEC_POST1",
"VDEC_ACP",
"VENC_MC_ACP"
};
char* MT6575_SMI4_PORT_NAME[256] =
{
"G2D_W",
"G2D_R",
"AUDIO_0",
"AUDIO_1"
};
typedef struct{
SMIBMCfg cfg;
SMIBMCfg_Ext cfg_ext;
}stManualTriggerInitCfg;
typedef struct{
SMIBMCfg cfg;
SMIBMCfg_Ext cfg_ext;
SMIBMResult result;
}stManualTriggerResultCfg;
typedef struct{
SMIBMCfg cfg;
SMIBMCfg_Ext cfg_ext;
unsigned long smi_time_count;
unsigned long smi_time_interval;
}stAutoTriggerInitCfg;
typedef struct{
unsigned long total_ports;
unsigned long smi_time_interval;
}stAutoTriggerSelectTime;
//User space interface
//IOCTL commnad
//Measure SMI all ports in different timing
#define SMI_MANUAL_TRIGGER_INIT _IOWR(SMIMONITORMAGICNO, 0, stManualTriggerInitCfg)
#define SMI_MANUAL_TRIGGER_INIT_EXT _IOWR(SMIMONITORMAGICNO, 1, stManualTriggerInitCfg)
#define SMI_MANUAL_TRIGGER_RESULT _IOWR(SMIMONITORMAGICNO, 2, stManualTriggerResultCfg)
#define SMI_AUTO_TRIGGER_INIT _IOWR(SMIMONITORMAGICNO, 3, stAutoTriggerInitCfg)
#define SMI_AUTO_TRIGGER_INIT_EXT _IOWR(SMIMONITORMAGICNO, 4, stAutoTriggerInitCfg)
#define SMI_AUTO_TRIGGER_RESULT _IOWR(SMIMONITORMAGICNO, 5, SMIBMResult)
#define SMI_AUTO_TRIGGER_SELECT_TIME _IOWR(SMIMONITORMAGICNO, 6, stAutoTriggerSelectTime)
#define SMI_AUTO_TRIGGER_SELECT _IOWR(SMIMONITORMAGICNO, 7, SMIBMCfg)
#define SMI_AUTO_TRIGGER_SELECT_EXT _IOWR(SMIMONITORMAGICNO, 8, SMIBMCfg_Ext)
#define SMI_AUTO_TRIGGER_SELECT_RESULT _IOWR(SMIMONITORMAGICNO, 9, SMIBMResult)
#define SMI_MANU_TRIGGER_SELECT_TIME _IOWR(SMIMONITORMAGICNO, 10, unsigned long)
#define SMI_MANU_TRIGGER_SELECT _IOWR(SMIMONITORMAGICNO, 11, SMIBMCfg)
#define SMI_MANU_TRIGGER_SELECT_EXT _IOWR(SMIMONITORMAGICNO, 12, SMIBMCfg_Ext)
#define SMI_MANU_TRIGGER_SELECT_TRIG _IOWR(SMIMONITORMAGICNO, 13, unsigned long)
#define SMI_MANU_TRIGGER_SELECT_RESULT _IOWR(SMIMONITORMAGICNO, 14, SMIBMResult)
|
#ifndef __BTASKS_XML_PARSER_H__
#define __BTASKS_XML_PARSER_H__
/* Battle Tanks Game
* Copyright (C) 2006-2009 Battle Tanks team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Additional rights can be granted beyond the GNU General Public License
* on the terms provided in the Exception. If you modify this file,
* you may extend this exception to your version of the file,
* but you are not obligated to do so. If you do not wish to provide this
* exception without modification, you must delete this exception statement
* from your version and license this file solely under the GPL without exception.
*/
#include "mrt/xml.h"
#include "export_btanks.h"
class BTANKSAPI XMLParser : public mrt::XMLParser {
public:
virtual void parse_file(const std::string &file);
};
#endif
|
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
* ClusterMeltSegmenter.h
*
* Created by Mark Levy on 23/03/2006.
* Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
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. See the file
COPYING included with this distribution for more information.
*/
#include <vector>
#include "segment.h"
#include "Segmenter.h"
#include "hmm/hmm.h"
#include "base/Window.h"
using std::vector;
class Decimator;
class ConstantQ;
class MFCC;
class FFTReal;
class ClusterMeltSegmenterParams
// defaults are sensible for 11025Hz with 0.2 second hopsize
{
public:
ClusterMeltSegmenterParams() :
featureType(FEATURE_TYPE_CONSTQ),
hopSize(0.2),
windowSize(0.6),
fmin(62),
fmax(16000),
nbins(8),
ncomponents(20),
nHMMStates(40),
nclusters(10),
histogramLength(15),
neighbourhoodLimit(20) { }
feature_types featureType;
double hopSize; // in secs
double windowSize; // in secs
int fmin;
int fmax;
int nbins;
int ncomponents;
int nHMMStates;
int nclusters;
int histogramLength;
int neighbourhoodLimit;
};
class ClusterMeltSegmenter : public Segmenter
{
public:
ClusterMeltSegmenter(ClusterMeltSegmenterParams params);
virtual ~ClusterMeltSegmenter();
virtual void initialise(int samplerate);
virtual int getWindowsize();
virtual int getHopsize();
virtual void extractFeatures(const double* samples, int nsamples);
void setFeatures(const vector<vector<double> >& f); // provide the features yourself
virtual void segment(); // segment into default number of segment-types
void segment(int m); // segment into m segment-types
int getNSegmentTypes() { return nclusters; }
protected:
void makeSegmentation(int* q, int len);
void extractFeaturesConstQ(const double *, int);
void extractFeaturesMFCC(const double *, int);
Window<double> *window;
FFTReal *fft;
ConstantQ* constq;
MFCC* mfcc;
model_t* model; // the HMM
int* q; // the decoded HMM state sequence
vector<vector<double> > histograms;
feature_types featureType;
double hopSize; // in seconds
double windowSize; // in seconds
// constant-Q parameters
int fmin;
int fmax;
int nbins;
int ncoeff;
// PCA parameters
int ncomponents;
// HMM parameters
int nHMMStates;
// clustering parameters
int nclusters;
int histogramLength;
int neighbourhoodLimit;
Decimator *decimator;
};
|
/*
* Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 NavigationAction_h
#define NavigationAction_h
#include "Event.h"
#include "FrameLoaderTypes.h"
#include "URL.h"
#include "ResourceRequest.h"
#include <wtf/Forward.h>
namespace WebCore {
class NavigationAction {
public:
WEBCORE_EXPORT NavigationAction();
WEBCORE_EXPORT explicit NavigationAction(const ResourceRequest&);
WEBCORE_EXPORT NavigationAction(const ResourceRequest&, NavigationType);
WEBCORE_EXPORT NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission);
NavigationAction(const ResourceRequest&, ShouldOpenExternalURLsPolicy);
NavigationAction(const ResourceRequest&, NavigationType, Event*);
NavigationAction(const ResourceRequest&, NavigationType, Event*, ShouldOpenExternalURLsPolicy);
NavigationAction(const ResourceRequest&, NavigationType, ShouldOpenExternalURLsPolicy);
NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, Event*);
NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, Event*, ShouldOpenExternalURLsPolicy);
NavigationAction copyWithShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy) const;
bool isEmpty() const { return m_resourceRequest.url().isEmpty(); }
URL url() const { return m_resourceRequest.url(); }
const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
NavigationType type() const { return m_type; }
const Event* event() const { return m_event.get(); }
bool processingUserGesture() const { return m_processingUserGesture; }
ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const { return m_shouldOpenExternalURLsPolicy; }
private:
ResourceRequest m_resourceRequest;
NavigationType m_type;
RefPtr<Event> m_event;
bool m_processingUserGesture;
ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy;
};
}
#endif
|
#include <stdlib.h>
#include <linux/atmdev.h>
#include <linux/atm.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <stdlib.h>
#include "net.h"
#include "utils.h" // ARRAY_SIZE
#include "compat.h"
void atmpvc_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)
{
struct sockaddr_atmpvc *atmpvc;
atmpvc = zmalloc(sizeof(struct sockaddr_atmpvc));
atmpvc->sap_family = PF_ATMPVC;
atmpvc->sap_addr.itf = rand();
atmpvc->sap_addr.vpi = rand();
atmpvc->sap_addr.vci = rand();
*addr = (struct sockaddr *) atmpvc;
*addrlen = sizeof(struct sockaddr_atmpvc);
}
void atmsvc_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)
{
struct sockaddr_atmsvc *atmsvc;
unsigned int i;
atmsvc = zmalloc(sizeof(struct sockaddr_atmsvc));
atmsvc->sas_family = PF_ATMSVC;
for (i = 0; i < ATM_ESA_LEN; i++)
atmsvc->sas_addr.prv[i] = rand();
for (i = 0; i < ATM_E164_LEN; i++)
atmsvc->sas_addr.pub[i] = rand();
atmsvc->sas_addr.lij_type = rand();
atmsvc->sas_addr.lij_id = rand();
*addr = (struct sockaddr *) atmsvc;
*addrlen = sizeof(struct sockaddr_atmsvc);
}
#define NR_SOL_ATM_OPTS ARRAY_SIZE(atm_opts)
static const unsigned int atm_opts[] = {
SO_SETCLP, SO_CIRANGE, SO_ATMQOS, SO_ATMSAP, SO_ATMPVC, SO_MULTIPOINT };
void atm_setsockopt(struct sockopt *so)
{
unsigned char val;
so->level = SOL_ATM;
val = rand() % NR_SOL_ATM_OPTS;
so->optname = atm_opts[val];
}
|
/***************************************************************************
* Copyright (C) 2006 by Krasimir Marinov *
* krasimir.vanev@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 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef DBG_H
#define DBG_H
#include <ostream>
/**
* Logging utilities intarface. Be carefull, the logger is not thread-safe, i.e. when using in not-threadsafe
* critical sections it is not guarantied what the result will be.
*
* Examples of logging interface usage you can find in the unit tests <code>test_dbg.cpp</code>
* In common:
* dbg::setLogLevel(dbg::DEBUG); //set the logging level
* dbg::enableLevelPrefix(true); //enable printing the level for the given message in the form "level:message"
* dbg::setLogStream(&std::cerr); //set the stream you to log into
*
* and now the real login
*
* dbg::error() << "Error message" << std::endl; //which is equivalent to
* dbg::out(dbg::ERROR) << "Error message" << std::endl;
*
* You can use the macro LOG_POSITION to specify the file and line of the logging message, for example:
* dbg::warning() << "Here: " << LOG_POSITION << "happens something" << std::endl;
*
* If defined NDEBUG during build all the log routines should compile to nothing, i.e. they would be optimized by the compiler.
*/
namespace dbg
{
enum ELevel
{
NONE,
FATAL,
ERROR,
WARNING,
INFO,
DEBUG,
TRACE,
ALL
};
struct SPosition
{
const char* pchFile;
const unsigned int iLine;
SPosition()
: pchFile(NULL),
iLine(0)
{}
SPosition(const char* file, const unsigned int line)
: pchFile(file),
iLine(line)
{}
};
#ifdef NDEBUG
#define LOG_POSITION ((void*)0)
#else
#define LOG_POSITION (aim_log::SPosition(__FILE__, __LINE__))
#endif
std::ostream& operator<<(std::ostream&, const SPosition&);
void setLogLevel(ELevel);
void enableLevelPrefix(bool);
void setLogStream(std::ostream*);
#ifdef NDEBUG
/// a "donothing" fake stream
//The idea behind using CNullStream is the code to be stripped by the compiler, i.e.
// in non-debug versions the additional debug code to be stripped by the compiler
// CNullstream is only for internal use!!!
class CNullStream
{
public:
template<class T>
CNullStream& operator<<(T& t)
{ return *this; }
template<class T>
CNullStream& operator<<(const T& t)
{ return *this; }
CNullStream& operator<<(std::ios& (*pfn)(std::ios&))
{return *this;}
CNullStream& operator<<(std::ostream& (*pfn)(std::ostream&))
{return *this;}
};
CNullStream& out(ELevel);
inline CNullStream& info() {return out(INFO);}
inline CNullStream& warning() {return out(WARNING);}
inline CNullStream& error() {return out(ERROR);}
inline CNullStream& fatal() {return out(FATAL);}
inline CNullStream& trace() {return out(TRACE);}
inline CNullStream& debug() {return out(DEBUG);}
inline CNullStream& none() {return out(NONE);}
inline CNullStream& all() {return out(ALL);}
#else
std::ostream& out(ELevel);
inline std::ostream& info() {return out(INFO);}
inline std::ostream& warning() {return out(WARNING);}
inline std::ostream& error() {return out(ERROR);}
inline std::ostream& fatal() {return out(FATAL);}
inline std::ostream& trace() {return out(TRACE);}
inline std::ostream& debug() {return out(DEBUG);}
inline std::ostream& none() {return out(NONE);}
inline std::ostream& all() {return out(ALL);}
#endif
} /*namespace dbg*/
#endif /*DBG_H*/
|
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard.
*/
#import "SBAlert.h"
@interface SBSIMLockEntryAlert : SBAlert
{
int _status; // 48 = 0x30
}
- (id)alertDisplayViewWithSize:(struct CGSize)fp8; // IMP=0x0006aa18
- (BOOL)deactivate; // IMP=0x0006ac10
- (int)status; // IMP=0x0006abc4
@end
|
/**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2017 UniPro <ugene@unipro.ru>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _U2_SHIFT_SEQUENCE_START_TASK_H_
#define _U2_SHIFT_SEQUENCE_START_TASK_H_
#include <U2Core/Task.h>
#include <U2Core/DocumentModel.h>
#include <U2Core/U1AnnotationUtils.h>
namespace U2 {
class U2SequenceObject;
class ShiftSequenceStartTask : public Task {
Q_OBJECT
public:
ShiftSequenceStartTask( U2SequenceObject *_seqObj, int newSeqStart);
virtual Task::ReportResult report();
private:
void fixAnnotations(int shiftSize);
static U2Location shiftLocation(const U2Location& location, int seqStart, int seqLength);
U2SequenceObject* seqObj;
QList<Document*> docs;
int seqStart;
};
}//ns
#endif
|
#ifndef _MACH_REGS_TIMROT
#define _MACH_REGS_TIMROT
#define REGS_TIMROT_BASE (STMP3XXX_REGS_BASE + 0x68000)
#define HW_TIMROT_ROTCTRL 0x0
#define BM_TIMROT_ROTCTRL_CLKGATE 0x40000000
#define BM_TIMROT_ROTCTRL_SFTRST 0x80000000
#define HW_TIMROT_TIMCTRL0 (0x20 + 0 * 0x20)
#define HW_TIMROT_TIMCTRL1 (0x20 + 1 * 0x20)
#define HW_TIMROT_TIMCTRL2 (0x20 + 2 * 0x20)
#define HW_TIMROT_TIMCTRLn 0x20
#define BM_TIMROT_TIMCTRLn_SELECT 0x0000000F
#define BP_TIMROT_TIMCTRLn_SELECT 0
#define BM_TIMROT_TIMCTRLn_PRESCALE 0x00000030
#define BP_TIMROT_TIMCTRLn_PRESCALE 4
#define BM_TIMROT_TIMCTRLn_RELOAD 0x00000040
#define BM_TIMROT_TIMCTRLn_UPDATE 0x00000080
#define BM_TIMROT_TIMCTRLn_IRQ_EN 0x00004000
#define BM_TIMROT_TIMCTRLn_IRQ 0x00008000
#define HW_TIMROT_TIMCOUNT0 (0x30 + 0 * 0x20)
#define HW_TIMROT_TIMCOUNT1 (0x30 + 1 * 0x20)
#define HW_TIMROT_TIMCOUNT2 (0x30 + 2 * 0x20)
#define HW_TIMROT_TIMCOUNTn 0x30
#endif
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/**
* \page makesdna makesdna
* \ingroup DNA
*
* \section aboutdna About the DNA module
*
* The DNA module holds all type definitions that are serialized in a
* blender file. There is an executable that scans all files, looking
* for struct-s to serialize (hence sdna: Struct \ref DNA). From this
* information, it builds a file with numbers that encode the format,
* the names of variables, and the plce to look for them.
*
* \section dnaissues Known issues with DNA
*
* - Function pointers:
*
* Because of historical reasons, some function pointers were
* untyped. The parser/dna generator has been modified to explicitly
* handle these special cases. Most pointers have been given proper
* proto's by now. DNA_space_types.h::Spacefile::returnfunc may still
* be badly defined. The reason for this is that it is called with
* different types of arguments. It takes a char* at this moment...
*
* - Ignoring structs:
*
* Sometimes we need to define structs in DNA which aren't written
* to disk, and can be excluded from blend file DNA string.
* in this case, add two '#' chars directly before the struct. eg.
*
* \code{.c}
* #
* #
* typedef struct MyStruct {
* int value;
* } MyStruct;
* \endcode
*
* Ignored structs can only be referred to from non-ignored structs
* when referred to as a pointer (where they're usually allocated
* and cleared in ``readfile.c``).
*
* - %Path to the header files
*
* Also because of historical reasons, there is a path prefix to the
* headers that need to be scanned. This is the BASE_HEADER
* define. If you change the file-layout for DNA, you will probably
* have to change this (Not very flexible, but it is hardly ever
* changed. Sorry.).
*
* \section dnadependencies Dependencies
*
* DNA has no external dependencies (except for a few system
* includes).
*
* \section dnanote NOTE
*
* PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN
*
* intern/dna_genfile.c
* (ton)
*
*/
/* This file has intentionally no definitions or implementation. */
|
// Organic Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
// model for organic solar cells.
// Copyright (C) 2012 Roderick C. I. MacKenzie
//
// roderick.mackenzie@nottingham.ac.uk
// www.roderickmackenzie.eu
// Room B86 Coates, University Park, Nottingham, NG7 2RD, UK
//
// 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 exp_h
#define exp_h
void exp_cal_emission(char *extra, struct device *in);
double get_avg_field(struct device *in);
double get_np_tot(struct device *in);
void reset_npequlib(struct device *in);
void get_avg_np_pos(struct device *in, double *nx, double *px);
double get_background_charge(struct device *in);
void reset_npinit(struct device *in);
double get_n_trapped_charge(struct device *in);
double get_p_trapped_charge(struct device *in);
double get_avg_recom(struct device *in);
double get_avg_recom_n(struct device *in);
double get_avg_recom_p(struct device *in);
double get_J_recom_n(struct device *in);
double get_J_recom_p(struct device *in);
double get_avg_k(struct device *in);
double get_avg_mue(struct device *in);
double get_avg_muh(struct device *in);
double get_free_n_charge(struct device *in);
double get_free_p_charge(struct device *in);
double get_free_n_charge_delta(struct device *in);
double get_free_p_charge_delta(struct device *in);
double get_total_n_trapped_charge(struct device *in);
double get_total_p_trapped_charge(struct device *in);
double get_n_trapped_charge_delta(struct device *in);
double get_p_trapped_charge_delta(struct device *in);
double get_avg_relax_n(struct device *in);
double get_avg_relax_p(struct device *in);
double get_avg_J(struct device *in);
double get_free_np_avg(struct device *in);
double get_extracted_np(struct device *in);
double get_extracted_k(struct device *in);
double get_charge_delta(struct device *in);
double get_I_recomb(struct device *in);
double get_J_left(struct device *in);
double get_J_right(struct device *in);
double get_J_recom(struct device *in);
double get_I_ce(struct device *in);
double get_equiv_I(struct device *in);
double carrier_count_get_rn(struct device *in);
double carrier_count_get_rp(struct device *in);
double carrier_count_get_n(struct device *in);
double carrier_count_get_p(struct device *in);
void carrier_count_reset(struct device *in);
void carrier_count_add(struct device *in);
double get_extracted_n(struct device *in);
double get_extracted_p(struct device *in);
double get_equiv_V(struct device *in);
double get_equiv_J(struct device *in);
double get_I(struct device *in);
double get_J(struct device *in);
double get_charge(struct device *in);
double get_avg_gen(struct device *in);
void set_orig_charge_den(struct device *in);
double get_total_np(struct device *in);
#endif
|
#define _UTIL_C_
#include "bbs.h"
/* Remove an user from any BM of existing boards */
int check(void *data, int bid, boardheader_t *bh)
{
char changed = 0;
char has_quote = 0;
char *p;
const char *userid = (const char *) data;
char bmsrc[IDLEN * 3 + 3], bmout[IDLEN * 3 + 3] = "";
if (!bh->brdname[0] || !bh->BM[0])
return 0;
if (!strcasestr(bh->BM, userid))
return 0;
strlcpy(bmsrc, bh->BM, sizeof(bmsrc));
p = bmsrc;
if (*p == '[') {
p++;
has_quote = 1;
}
p = strtok(p,"/ ]");
while (p) {
const char *bmid = p;
p = strtok(NULL, "/ ]");
if (!*bmid)
continue;
if (strcasecmp(bmid, userid) == 0) {
// found match, to remove it
changed = 1;
continue;
}
if (bmout[0])
strlcat(bmout, "/", sizeof(bmout));
strlcat(bmout, bmid, sizeof(bmout));
}
if (!changed)
return 0;
now = time(0);
log_filef(BBSHOME "/log/removebm.log", LOG_CREAT,
"%s [%s] %s: %s->%s\n",
Cdatelite(&now), userid,
bh->brdname, bh->BM, bmout);
if (has_quote)
snprintf(bh->BM, sizeof(bh->BM), "[%s]", bmout);
else
strlcpy(bh->BM, bmout, sizeof(bh->BM));
substitute_record(BBSHOME "/" FN_BOARD, bh, sizeof(boardheader_t), bid);
reset_board(bid);
return 0;
}
int main(int argc, char **argv)
{
int i = 0;
now = time(NULL);
chdir(BBSHOME);
attach_SHM();
if (argc != 2) {
printf("syntax: %s userid\n", argv[0]);
return -1;
}
for (i = 0; i < MAX_BOARD; i++) {
check(argv[1], i+1, &SHM->bcache[i]);
}
return 0;
}
|
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int findNodeOutside(float x, float y);
bool checkIfnode0(double x, double y);
bool checkIfnode1(double x, double y);
bool checkIfnode2(double x, double y);
bool checkIfnode3(double x, double y);
bool checkIfnode4(double x, double y);
bool checkIfnode5(double x, double y);
bool checkIfnode6(double x, double y);
bool checkIfnode7(double x, double y);
bool checkIfnode8(double x, double y);
bool checkIfnode9(double x, double y);
bool checkIfnode10(double x, double y);
bool checkIfnode11(double x, double y);
bool checkIfnode12(double x, double y);
bool checkIfnode13(double x, double y);
bool checkIfnode14(double x, double y);
bool checkIfnode15(double x, double y);
bool checkIfnode16(double x, double y);
bool checkIfnode17(double x, double y);
bool checkIfnode18(double x, double y);
bool checkIfnode19(double x, double y);
|
soc imx6
loadaddr 0x10000000
dcdofs 0x400
wm 32 0x020e0774 0x000C0000
wm 32 0x020e0754 0x00000000
wm 32 0x020e04ac 0x00000030
wm 32 0x020e04b0 0x00000030
wm 32 0x020e0464 0x00000030
wm 32 0x020e0490 0x00000030
wm 32 0x020e074c 0x00000030
wm 32 0x020e0494 0x00000030
wm 32 0x020e04a0 0x00000000
wm 32 0x020e04b4 0x00000030
wm 32 0x020e04b8 0x00000030
wm 32 0x020e04a4 0x00003000
wm 32 0x020e04a8 0x00003000
wm 32 0x020e076c 0x00000030
wm 32 0x020e0750 0x00020000
wm 32 0x020e04bc 0x00000028
wm 32 0x020e04c0 0x00000028
wm 32 0x020e04c4 0x00000028
wm 32 0x020e04c8 0x00000028
wm 32 0x020e04cc 0x00000028
wm 32 0x020e04d0 0x00000028
wm 32 0x020e04d4 0x00000028
wm 32 0x020e04d8 0x00000028
wm 32 0x020e0760 0x00020000
wm 32 0x020e0764 0x00000028
wm 32 0x020e0770 0x00000028
wm 32 0x020e0778 0x00000028
wm 32 0x020e077c 0x00000028
wm 32 0x020e0780 0x00000028
wm 32 0x020e0784 0x00000028
wm 32 0x020e078c 0x00000028
wm 32 0x020e0748 0x00000028
wm 32 0x020e0470 0x00000028
wm 32 0x020e0474 0x00000028
wm 32 0x020e0478 0x00000028
wm 32 0x020e047c 0x00000028
wm 32 0x020e0480 0x00000028
wm 32 0x020e0484 0x00000028
wm 32 0x020e0488 0x00000028
wm 32 0x020e048c 0x00000028
wm 32 0x021b0800 0xa1390003
wm 32 0x021b4800 0xa1380003
wm 32 0x021b080c 0x0032003A
wm 32 0x021b0810 0x00350037
wm 32 0x021b480c 0x00260038
wm 32 0x021b4810 0x002C0038
wm 32 0x021b083c 0x42630244
wm 32 0x021b0840 0x02300238
wm 32 0x021b483c 0x02540258
wm 32 0x021b4840 0x0236021e
wm 32 0x021b0848 0x46484446
wm 32 0x021b4848 0x302d2c35
wm 32 0x021b0850 0x36342630
wm 32 0x021b4850 0x3423372d
wm 32 0x021b081c 0x33333333
wm 32 0x021b0820 0x33333333
wm 32 0x021b0824 0x33333333
wm 32 0x021b0828 0x33333333
wm 32 0x021b481c 0x33333333
wm 32 0x021b4820 0x33333333
wm 32 0x021b4824 0x33333333
wm 32 0x021b4828 0x33333333
wm 32 0x021b08b8 0x00000800
wm 32 0x021b48b8 0x00000800
wm 32 0x021b0004 0x00025576
wm 32 0x021b0008 0x09444040
SETUP_MDCFG0
wm 32 0x021b0010 0xff538f64
wm 32 0x021b0014 0x01ff0124
wm 32 0x021b0018 0x00091740
wm 32 0x021b001c 0x00008000
wm 32 0x021b002c 0x000026d2
wm 32 0x021b0030 0x003F1023
SETUP_MDASP_MDCTL
wm 32 0x021b001c 0x04088032
wm 32 0x021b001c 0x0408803a
wm 32 0x021b001c 0x00008033
wm 32 0x021b001c 0x0000803b
wm 32 0x021b001c 0x00428031
wm 32 0x021b001c 0x00428039
wm 32 0x021b001c 0x09408030
wm 32 0x021b001c 0x09408038
wm 32 0x021b001c 0x04008040
wm 32 0x021b001c 0x04008048
wm 32 0x021b0020 0x00007800
wm 32 0x021b0818 0x00011117
wm 32 0x021b4818 0x00011117
wm 32 0x021b0004 0x00025576
wm 32 0x021b0404 0x00011006
wm 32 0x021b001c 0x00000000
|
#if !defined(__SWL_GRAPHICS__APPEARANCE__H_)
#define __SWL_GRAPHICS__APPEARANCE__H_ 1
#include "swl/graphics/ExportGraphics.h"
#include "swl/graphics/Color.h"
namespace swl {
//#if defined(_MSC_VER)
//#pragma warning(disable:4231)
//SWL_GRAPHICS_TEMPLATE_EXTERN template struct SWL_GRAPHICS_API Color4<float>;
//#endif
//-----------------------------------------------------------------------------------------
//
namespace attrib {
enum PolygonFace { POLYGON_FACE_NONE, POLYGON_FACE_FRONT, POLYGON_FACE_BACK, POLYGON_FACE_FRONT_AND_BACK };
enum PolygonMode { POLYGON_POINT, POLYGON_LINE, POLYGON_FILL };
//enum ShadingMode { FLAT_SHADING, SMOOTH_SHADING };
} // namespace attrib
//-----------------------------------------------------------------------------------------
// class Appearance
class SWL_GRAPHICS_API Appearance
{
public:
//typedef Appearance base_type;
public:
Appearance(const bool isVisible = true, const bool isTransparent = false, const attrib::PolygonMode polygonMode = attrib::POLYGON_FILL, const attrib::PolygonFace drawingFace = attrib::POLYGON_FACE_FRONT);
Appearance(const Appearance &rhs);
virtual ~Appearance();
Appearance & operator=(const Appearance &rhs);
public:
void setColor(const float r, const float g, const float b, const float a = 1.0f)
{ color_.r = r; color_.g = g; color_.b = b; color_.a = a; }
void getColor(float &r, float &g, float &b)
{ r = color_.r; g = color_.g; b = color_.b; }
void getColor(float &r, float &g, float &b, float &a)
{ r = color_.r; g = color_.g; b = color_.b; a = color_.a; }
float & red() { return color_.r; }
float red() const { return color_.r; }
float & green() { return color_.g; }
float green() const { return color_.g; }
float & blue() { return color_.b; }
float blue() const { return color_.b; }
float & alpha() { return color_.a; }
float alpha() const { return color_.a; }
void setVisible(const bool isVisible) { isVisible_ = isVisible; }
bool isVisible() const { return isVisible_; }
void setTransparent(const bool isTransparent) { isTransparent_ = isTransparent; }
bool isTransparent() const { return isTransparent_; }
void setPolygonMode(const attrib::PolygonMode polygonMode) { polygonMode_ = polygonMode; }
attrib::PolygonMode getPolygonMode() const { return polygonMode_; }
void setDrawingFace(const attrib::PolygonFace drawingFace) { drawingFace_ = drawingFace; }
attrib::PolygonFace getDrawingFace() const { return drawingFace_; }
private:
Color4<float> color_;
bool isVisible_;
bool isTransparent_;
attrib::PolygonMode polygonMode_;
attrib::PolygonFace drawingFace_;
};
} // namespace swl
#endif // __SWL_GRAPHICS__APPEARANCE__H_
|
/*
* Copyright 2014-2015 James Geboski <jgeboski@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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file **/
#ifndef _FACEBOOK_UTIL_H
#define _FACEBOOK_UTIL_H
#include <glib.h>
/**
* Prints a debugging line to stdout.
*
* @param f The format string literal.
* @param ... The arguments for the format string.
**/
#ifdef DEBUG_FACEBOOK
#define FB_UTIL_DEBUGLN(f, ...) \
G_STMT_START { \
if (fb_util_debugging()) { \
g_print("[" PACKAGE_NAME "] " f "\n", ##__VA_ARGS__); \
} \
} G_STMT_END
#else /* DEBUG_FACEBOOK */
#define FB_UTIL_DEBUGLN(f, ...)
#endif /* DEBUG_FACEBOOK */
#ifdef DEBUG_FACEBOOK
gboolean fb_util_debugging(void);
#endif /* DEBUG_FACEBOOK */
#ifdef DEBUG_FACEBOOK
void fb_util_hexdump(const GByteArray *bytes, guint indent,
const gchar *fmt, ...)
G_GNUC_PRINTF(3, 4);
#else /* DEBUG_FACEBOOK */
#define fb_util_hexdump(bs, i, f, ...)
#endif /* DEBUG_FACEBOOK */
gboolean fb_util_str_iequal(const gchar *s1, const gchar *s2);
gboolean fb_util_zcompressed(const GByteArray *bytes);
GByteArray *fb_util_zcompress(const GByteArray *bytes);
GByteArray *fb_util_zuncompress(const GByteArray *bytes);
#endif /* _FACEBOOK_UTIL_H */
|
#include "sorted-list.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INT_SIZE 10
#define FLOAT_SIZE 10
/****************************************************/
// FUNCTION PROTOTYPES
void printList(SortedListPtr, void (*)(void* ));
void testInt();
int compareInt(void * ,void * );
void destructInt( void * );
void printInt(void* );
void testFloat();
int compareFloat(void*, void*);
void destructFloat(void *);
void printFloat(void*);
void testRemoveAndIteratorConsitency();
/****************************************************/
int main(int argc, char** argv){
printf("Test Integer List:\n");
testInt();
printf("\n\nTest Float List:\n");
testFloat();
printf("\n\nTest Remove and Iterator Consitency:\n");
testRemoveAndIteratorConsitency();
printf("\n");
return 0;
}
void printList(SortedListPtr intList, void (*printType)(void* i)){
SortedListIteratorPtr sli = SLCreateIterator(intList);
// Print all element
void* temp = SLGetItem(sli);
while( temp!=NULL){
printType(temp);
temp= SLNextItem(sli);
}
SLDestroyIterator(sli);
}
//=======================================================================
void testInt(){
// Create an integer list
SortedListPtr intList = SLCreate(compareInt,destructInt);
int intArr[INT_SIZE] = { 0, 1 , 2 , 3 , 4 , 5, 6, 7, 8, 9};
int* intPtr[INT_SIZE];
int i;
// Allocate memory for integer pointer elements
for(i = 0 ; i < INT_SIZE; i++){
intPtr[i] = (int*) malloc(sizeof(int));
if(intPtr[i]==NULL){
printf("Error: Cannot allocate memory\n");
exit(-1);
}else{
*intPtr[i] = intArr[i];
if(i==0){
printf("Insert order: \n%d",intArr[i]);
}else{
printf("\t%d",intArr[i]);
}
SLInsert(intList,intPtr[i]);
}
}
printf("\nThe sorted integer list is:\n");
printList(intList, printInt);
SortedListIteratorPtr sli = SLCreateIterator(intList);
SLNextItem(sli);
// Destroy iterator and list
SLDestroy(intList);
SLDestroyIterator(sli);
}
int compareInt(void * int1, void * int2){
int a = *((int*) int1);
int b = *((int*) int2);
if( a > b ){
return 1;
}else if(a<b){
return -1;
}else return 0;
}
void destructInt(void* i){
free( (int* ) i);
}
void printInt(void* i){
if(i==NULL){
printf("null\t");
}else
printf("%d\t",*((int*)i) );
}
//=======================================================================
void testFloat(){
// Create an floating number list
SortedListPtr floatList = SLCreate(compareFloat,destructFloat);
float floatArr[FLOAT_SIZE] = { 0.23, 11 , 2.3 , 0.3 , -14.23 , 5.1, 26.00, -7, 8.14, 9.21};
float* floatPtr[FLOAT_SIZE];
int i;
// Allocate memory for float number pointer elements
for(i = 0 ; i < INT_SIZE; i++){
floatPtr[i] = (float*) malloc(sizeof(float));
if(floatPtr[i]==NULL){
printf("Error: Cannot allocate memory\n");
exit(-1);
}else{
*floatPtr[i] = floatArr[i];
if(i==0){
printf("Insert order: \n%.2f",floatArr[i]);
}else{
printf("\t%.2f",floatArr[i]);
}
SLInsert(floatList,floatPtr[i]);
}
}
printf("\nThe sorted float list is:\n");
printList(floatList,printFloat);
SLDestroy(floatList);
}
int compareFloat(void * f1, void* f2){
float a = *((float*) f1);
float b = *((float*) f2);
if(a>b){
return 1;
}else if(a<b){
return -1;
}else return 0;
}
void destructFloat(void* f){
free((float*) f);
}
void printFloat(void* i){
if(i==NULL)
printf("null\t");
else printf("%.02f\t",*((float*)i));
}
//=======================================================================
void testRemoveAndIteratorConsitency(){
// Create an integer list
SortedListPtr intList = SLCreate(compareInt,destructInt);
int intArr[INT_SIZE] = { 0, 1 , 2 , 3 , 4 , 5, 6, 7, 8, 9};
int* intPtr[INT_SIZE];
int i;
// Allocate memory for integer pointer elements
for(i = 0 ; i < INT_SIZE; i++){
intPtr[i] = (int*) malloc(sizeof(int));
if(intPtr[i]==NULL){
printf("Error: Cannot allocate memory");
exit(-1);
}else{
*intPtr[i] = intArr[i];
SLInsert(intList,intPtr[i]);
}
}
// Create an iterator
SortedListIteratorPtr sli = SLCreateIterator(intList);
// Print all elements
printf("Elements of the sorted list:\n");
printList(intList, printInt);
SLDestroyIterator(sli);
sli = SLCreateIterator(intList);
printf("\nNow, a new iterator created is pointing to: %d" , *(int*) SLGetItem(sli));
// Remove elements
for( i = 9 ; i>=6;i--){
printf("\nRemove: "); printInt((void*)intPtr[i]);SLRemove(intList,intPtr[i]);
}
printf("\nElements of the sorted list:\n");
printList(intList,printInt);
printf("\nThe iterator is \"still\" pointing to: %d",*(int*) SLGetItem(sli));
printf("\nAdvance the iterator using SLNextItem(). Now it's pointing to: %d",*(int*) SLNextItem(sli));
// Destroy iterator and list
printf("\n\nNow, we destroy the list.");
SLDestroy(intList);
printf("\nThe iterator can return %d using SLGetItem().",*(int*) SLGetItem(sli));
printf("\nThe next element is : ");
printInt( SLNextItem(sli) );
printf("\nDestroy the iterator");
SLDestroyIterator(sli);
}
//=======================================================================
|
/**
* @file
* @brief Trigger functions
*/
/*
All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
Original file from Quake 2 v3.21: quake2-2.31/game/g_spawn.c
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
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.
*/
#pragma once
#include "g_local.h"
bool G_TriggerIsInList(Edict* self, Edict* activator);
void G_TriggerAddToList(Edict* self, Edict* activator);
bool G_TriggerRemoveFromList(Edict* self, Edict* activator);
Edict* G_TriggerSpawn(Edict* owner);
void Think_NextMapTrigger(Edict* self);
void SP_trigger_nextmap(Edict* ent);
bool Touch_HurtTrigger(Edict* self, Edict* activator);
void SP_trigger_hurt(Edict* ent);
void SP_trigger_touch(Edict* ent);
void SP_trigger_rescue(Edict* ent);
|
/*
* vsid-snapshot.c - VSID snapshot handling.
*
* Written by
* Marco van den Heuvel <blackystardust68@yahoo.com>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
/* It remains to be decided if snapshot support for vsid is needed */
#include "vice.h"
#include <stdio.h>
#include "c64-snapshot.h"
#include "c64.h"
#include "c64gluelogic.h"
#include "c64memsnapshot.h"
#include "cia.h"
#include "drive-snapshot.h"
#include "drive.h"
#include "ioutil.h"
#include "joystick.h"
#include "keyboard.h"
#include "log.h"
#include "machine.h"
#include "maincpu.h"
#include "sid-snapshot.h"
#include "snapshot.h"
#include "sound.h"
#include "tape-snapshot.h"
#include "types.h"
#include "vice-event.h"
#include "vicii.h"
#define SNAP_MAJOR 1
#define SNAP_MINOR 1
int c64_snapshot_write(const char *name, int save_roms, int save_disks, int event_mode)
{
snapshot_t *s;
s = snapshot_create(name, ((BYTE)(SNAP_MAJOR)), ((BYTE)(SNAP_MINOR)), machine_get_name());
if (s == NULL) {
return -1;
}
sound_snapshot_prepare();
/* Execute drive CPUs to get in sync with the main CPU. */
drive_cpu_execute_all(maincpu_clk);
if (maincpu_snapshot_write_module(s) < 0
|| c64_snapshot_write_module(s, save_roms) < 0
|| ciacore_snapshot_write_module(machine_context.cia1, s) < 0
|| ciacore_snapshot_write_module(machine_context.cia2, s) < 0
|| sid_snapshot_write_module(s) < 0
|| vicii_snapshot_write_module(s) < 0
|| c64_glue_snapshot_write_module(s) < 0
|| event_snapshot_write_module(s, event_mode) < 0
|| keyboard_snapshot_write_module(s)) {
snapshot_close(s);
ioutil_remove(name);
return -1;
}
snapshot_close(s);
return 0;
}
int c64_snapshot_read(const char *name, int event_mode)
{
snapshot_t *s;
BYTE minor, major;
s = snapshot_open(name, &major, &minor, machine_get_name());
if (s == NULL) {
return -1;
}
if (major != SNAP_MAJOR || minor != SNAP_MINOR) {
log_error(LOG_DEFAULT, "Snapshot version (%d.%d) not valid: expecting %d.%d.", major, minor, SNAP_MAJOR, SNAP_MINOR);
goto fail;
}
vicii_snapshot_prepare();
if (maincpu_snapshot_read_module(s) < 0
|| c64_snapshot_read_module(s) < 0
|| ciacore_snapshot_read_module(machine_context.cia1, s) < 0
|| ciacore_snapshot_read_module(machine_context.cia2, s) < 0
|| sid_snapshot_read_module(s) < 0
|| vicii_snapshot_read_module(s) < 0
|| c64_glue_snapshot_read_module(s) < 0
|| event_snapshot_read_module(s, event_mode) < 0
|| keyboard_snapshot_read_module(s) < 0) {
goto fail;
}
snapshot_close(s);
sound_snapshot_finish();
return 0;
fail:
if (s != NULL) {
snapshot_close(s);
}
machine_trigger_reset(MACHINE_RESET_MODE_SOFT);
return -1;
}
|
/**
* @file autosar_tp_s2/protection_instance1.c
*
* @section desc File description
*
* @section copyright Copyright
*
* Trampoline Test Suite
*
* Trampoline Test Suite is copyright (c) IRCCyN 2005-2007
* Trampoline Test Suite is protected by the French intellectual property law.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @section infos File informations
*
* $Date$
* $Rev$
* $Author$
* $URL$
*/
/*Instance 1 of protection hook */
#include "Os.h"
extern StatusType Fatalerrorstatus;
/*test case:test the reaction of the system called with
an activation of a task*/
static void test_protection_instance1(void)
{
SCHEDULING_CHECK_INIT(8);
SCHEDULING_CHECK_AND_EQUAL_INT(8, E_OS_PROTECTION_TIME, Fatalerrorstatus);
}
/*create the test suite with all the test cases*/
TestRef AutosarTPTest_seq2_protection_instance1(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
new_TestFixture("test_protection_instance1",test_protection_instance1)
};
EMB_UNIT_TESTCALLER(AutosarTPTest,"AutosarTPTest_sequence2",NULL,NULL,fixtures);
return (TestRef)&AutosarTPTest;
}
/* End of file autosar_tp_s2/protection_instance1.c */
|
/*Emulation of the SVGA chip in the IBM PS/1 Model 2121, or at least the
20 MHz version.
I am not entirely sure what this chip actually is, possibly a CF62011? I can
not find any documentation on the chip so have implemented enough to pass
self-test in the PS/1 BIOS. It has 512kb video memory but I have not found any
native drivers for any operating system and there is no VBE implementation, so
it's just a VGA for now.
*/
#include <stdlib.h>
#include "ibm.h"
#include "device.h"
#include "io.h"
#include "mem.h"
#include "rom.h"
#include "video.h"
#include "vid_svga.h"
#include "vid_vga.h"
typedef struct ps1_m2121_svga_t
{
svga_t svga;
rom_t bios_rom;
uint8_t banking;
uint8_t reg_2100;
uint8_t reg_210a;
} ps1_m2121_svga_t;
void ps1_m2121_svga_out(uint16_t addr, uint8_t val, void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
svga_t *svga = &ps1->svga;
uint8_t old;
// pclog("svga_out : %04X %02X %04X:%04X %02X %i\n", addr, val, CS,cpu_state.pc, ram[0x489], ins);
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
addr ^= 0x60;
switch (addr)
{
case 0x3D4:
svga->crtcreg = val & 0x1f;
return;
case 0x3D5:
if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80))
return;
if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80))
val = (svga->crtc[7] & ~0x10) | (val & 0x10);
old = svga->crtc[svga->crtcreg];
svga->crtc[svga->crtcreg] = val;
if (old != val)
{
if (svga->crtcreg < 0xe || svga->crtcreg > 0x10)
{
svga->fullchange = changeframecount;
svga_recalctimings(svga);
}
}
break;
case 0x2100:
ps1->reg_2100 = val;
if ((val & 7) < 4)
svga->read_bank = svga->write_bank = 0;
else
svga->read_bank = svga->write_bank = (ps1->banking & 0x7) * 0x10000;
break;
case 0x2108:
if ((ps1->reg_2100 & 7) >= 4)
svga->read_bank = svga->write_bank = (val & 0x7) * 0x10000;
ps1->banking = val;
break;
case 0x210a:
ps1->reg_210a = val;
break;
}
svga_out(addr, val, svga);
}
uint8_t ps1_m2121_svga_in(uint16_t addr, void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
svga_t *svga = &ps1->svga;
uint8_t temp;
// if (addr != 0x3da) pclog("svga_in : %04X ", addr);
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
addr ^= 0x60;
switch (addr)
{
case 0x100:
temp = 0xfe;
break;
case 0x101:
temp = 0xe8;
break;
case 0x3D4:
temp = svga->crtcreg;
break;
case 0x3D5:
temp = svga->crtc[svga->crtcreg];
break;
case 0x2108:
temp = ps1->banking;
break;
case 0x210a:
temp = ps1->reg_210a;
break;
default:
temp = svga_in(addr, svga);
break;
}
// if (addr != 0x3da) pclog("%02X %04X:%04X\n", temp, CS,pc);
return temp;
}
void *ps1_m2121_svga_init()
{
ps1_m2121_svga_t *ps1 = malloc(sizeof(ps1_m2121_svga_t));
memset(ps1, 0, sizeof(ps1_m2121_svga_t));
svga_init(&ps1->svga, ps1, 1 << 19, /*512kb*/
NULL,
ps1_m2121_svga_in, ps1_m2121_svga_out,
NULL,
NULL);
io_sethandler(0x0100, 0x0002, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1);
io_sethandler(0x03c0, 0x0020, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1);
io_sethandler(0x2100, 0x0010, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1);
// io_sethandler(0x210a, 0x0001, ps1_m2121_svga_in, NULL, NULL, ps1_m2121_svga_out, NULL, NULL, ps1);
ps1->svga.bpp = 8;
ps1->svga.miscout = 1;
return ps1;
}
void ps1_m2121_svga_close(void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
svga_close(&ps1->svga);
free(ps1);
}
void ps1_m2121_svga_speed_changed(void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
svga_recalctimings(&ps1->svga);
}
void ps1_m2121_svga_force_redraw(void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
ps1->svga.fullchange = changeframecount;
}
void ps1_m2121_svga_add_status_info(char *s, int max_len, void *p)
{
ps1_m2121_svga_t *ps1 = (ps1_m2121_svga_t *)p;
svga_add_status_info(s, max_len, &ps1->svga);
}
device_t ps1_m2121_svga_device =
{
"PS/1 Model 2121 SVGA",
0,
ps1_m2121_svga_init,
ps1_m2121_svga_close,
NULL,
ps1_m2121_svga_speed_changed,
ps1_m2121_svga_force_redraw,
ps1_m2121_svga_add_status_info
};
|
/*
* tinfgzip - tiny gzip decompressor
*
* Copyright (c) 2003 by Joergen Ibsen / Jibz
* All Rights Reserved
*
* http://www.ibsensoftware.com/
*
* This software is provided 'as-is', without any express
* or implied warranty. In no event will the authors be
* held liable for any damages arising from the use of
* this software.
*
* Permission is granted to anyone to use this software
* for any purpose, including commercial applications,
* and to alter it and redistribute it freely, subject to
* the following restrictions:
*
* 1. The origin of this software must not be
* misrepresented; you must not claim that you
* wrote the original software. If you use this
* software in a product, an acknowledgment in
* the product documentation would be appreciated
* but is not required.
*
* 2. Altered source versions must be plainly marked
* as such, and must not be misrepresented as
* being the original software.
*
* 3. This notice may not be removed or altered from
* any source distribution.
*/
#include "tinf.h"
#define FTEXT 1
#define FHCRC 2
#define FEXTRA 4
#define FNAME 8
#define FCOMMENT 16
int tinf_gzip_uncompress(void *dest, unsigned int *destLen,
const void *source, unsigned int sourceLen)
{
unsigned char *src = (unsigned char *)source;
unsigned char *dst = (unsigned char *)dest;
unsigned char *start;
unsigned int dlen, crc32;
int res;
unsigned char flg;
/* -- check format -- */
/* check id bytes */
if (src[0] != 0x1f || src[1] != 0x8b) return TINF_DATA_ERROR;
/* check method is deflate */
if (src[2] != 8) return TINF_DATA_ERROR;
/* get flag byte */
flg = src[3];
/* check that reserved bits are zero */
if (flg & 0xe0) return TINF_DATA_ERROR;
/* -- find start of compressed data -- */
/* skip base header of 10 bytes */
start = src + 10;
/* skip extra data if present */
if (flg & FEXTRA)
{
unsigned int xlen = start[1];
xlen = 256*xlen + start[0];
start += xlen + 2;
}
/* skip file name if present */
if (flg & FNAME) { while (*start) ++start; ++start; }
/* skip file comment if present */
if (flg & FCOMMENT) { while (*start) ++start; ++start; }
/* check header crc if present */
if (flg & FHCRC)
{
unsigned int hcrc = start[1];
hcrc = 256*hcrc + start[0];
if (hcrc != (tinf_crc32(src, start - src) & 0x0000ffff))
return TINF_DATA_ERROR;
start += 2;
}
/* -- get decompressed length -- */
dlen = src[sourceLen - 1];
dlen = 256*dlen + src[sourceLen - 2];
dlen = 256*dlen + src[sourceLen - 3];
dlen = 256*dlen + src[sourceLen - 4];
/* -- get crc32 of decompressed data -- */
crc32 = src[sourceLen - 5];
crc32 = 256*crc32 + src[sourceLen - 6];
crc32 = 256*crc32 + src[sourceLen - 7];
crc32 = 256*crc32 + src[sourceLen - 8];
/* -- decompress data -- */
res = tinf_uncompress(dst, destLen, start, src + sourceLen - start - 8);
if (res != TINF_OK) return TINF_DATA_ERROR;
if (*destLen != dlen) return TINF_DATA_ERROR;
/* -- check CRC32 checksum -- */
if (crc32 != tinf_crc32(dst, dlen)) return TINF_DATA_ERROR;
return TINF_OK;
}
|
/*
* helper functions for physically contiguous capture buffers
*
* The functions support hardware lacking scatter gather support
* (i.e. the buffers must be linear in physical memory)
*
* Copyright (c) 2008 Magnus Damm
*
* 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
*/
#ifndef _VIDEOBUF_DMA_CONTIG_H
#define _VIDEOBUF_DMA_CONTIG_H
#include <linux/dma-mapping.h>
#include <media/videobuf-core.h>
void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
const struct videobuf_queue_ops *ops,
struct device *dev,
spinlock_t *irqlock,
enum v4l2_buf_type type,
enum v4l2_field field,
unsigned int msize,
void *priv,
struct mutex *ext_lock);
dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
void videobuf_dma_contig_free(struct videobuf_queue *q,
struct videobuf_buffer *buf);
#endif /* _VIDEOBUF_DMA_CONTIG_H */
|
/*
* Copyright 2008-2014 Freescale Semiconductor, Inc.
*
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/mmu.h>
struct fsl_e_tlb_entry tlb_table[] = {
/* TLB 0 - for temp stack in cache */
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR,
CONFIG_SYS_INIT_RAM_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 0, BOOKE_PAGESZ_4K, 0),
/* TLB 1 */
/* *I*** - Covers boot page */
#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L3_ADDR)
/*
* *I*G - L3SRAM. When L3 is used as 1M SRAM, the address of the
* SRAM is at 0xfff00000, it covered the 0xfffff000.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L3_ADDR, CONFIG_SYS_INIT_L3_ADDR,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 0, BOOKE_PAGESZ_1M, 1),
#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
/*
* SRIO_PCIE_BOOT-SLAVE. When slave boot, the address of the
* space is at 0xfff00000, it covered the 0xfffff000.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR,
CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_W|MAS2_G,
0, 0, BOOKE_PAGESZ_1M, 1),
#else
SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 0, BOOKE_PAGESZ_4K, 1),
#endif
/* *I*G* - CCSRBAR */
SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 1, BOOKE_PAGESZ_16M, 1),
/* *I*G* - Flash, localbus */
/* This will be changed to *I*G* after relocation to RAM. */
SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
0, 2, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 1, 0x80000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 3, BOOKE_PAGESZ_512M, 1),
/* *I*G* - PCIe 2, 0xa0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE2_MEM_VIRT, CONFIG_SYS_PCIE2_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 4, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 3, 0xb0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 5, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCIe 4, 0xc0000000 */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE4_MEM_VIRT, CONFIG_SYS_PCIE4_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 6, BOOKE_PAGESZ_256M, 1),
/* *I*G* - PCI I/O */
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 7, BOOKE_PAGESZ_256K, 1),
/* Bman/Qman */
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE, CONFIG_SYS_BMAN_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 9, BOOKE_PAGESZ_16M, 1),
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE + 0x01000000,
CONFIG_SYS_BMAN_MEM_PHYS + 0x01000000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 10, BOOKE_PAGESZ_16M, 1),
#endif
#ifdef CONFIG_SYS_QMAN_MEM_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE, CONFIG_SYS_QMAN_MEM_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 11, BOOKE_PAGESZ_16M, 1),
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE + 0x01000000,
CONFIG_SYS_QMAN_MEM_PHYS + 0x01000000,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 12, BOOKE_PAGESZ_16M, 1),
#endif
#ifdef CONFIG_SYS_DCSRBAR_PHYS
SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 13, BOOKE_PAGESZ_32M, 1),
#endif
#ifdef CONFIG_SYS_NAND_BASE
/*
* *I*G - NAND
* entry 14 and 15 has been used hard coded, they will be disabled
* in cpu_init_f, so we use entry 16 for nand.
*/
SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 16, BOOKE_PAGESZ_64K, 1),
#endif
#ifdef CONFIG_SYS_CPLD_BASE
SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 17, BOOKE_PAGESZ_4K, 1),
#endif
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
/*
* SRIO_PCIE_BOOT-SLAVE. 1M space from 0xffe00000 for
* fetching ucode and ENV from master
*/
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR,
CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
0, 18, BOOKE_PAGESZ_1M, 1),
#endif
#if defined(CONFIG_SYS_RAMBOOT)
SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 19, BOOKE_PAGESZ_2G, 1)
#endif
};
int num_tlb_entries = ARRAY_SIZE(tlb_table);
|
/**************************************************************************************
* Hisilicon MP3 decoder
* layer12.h -
**************************************************************************************/
#ifndef __LAYER12_H__
#define __LAYER12_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "statname.h"
/* --- Default --- */
#define FPM_DEFAULT /* FPM selected */
#define OPT_SPEED /* by (L40186) */
/*
* This version is the most portable but it loses significant accuracy.
* Furthermore, accuracy is biased against the second argument, so care
* should be taken when ordering operands.
*
* The scale factors are constant as this is not used with SSO.
*
* Pre-rounding is required to stay within the limits of compliance.
*/
#ifdef OPT_SPEED
#define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
#else
#define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \
(((y) + (1L << 15)) >> 16))
#endif
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#if SIZEOF_INT >= 4
typedef signed int mad_fixed_t;
typedef signed int mad_fixed64hi_t;
typedef unsigned int mad_fixed64lo_t;
#else
typedef signed long mad_fixed_t;
typedef signed long mad_fixed64hi_t;
typedef unsigned long mad_fixed64lo_t;
#endif
# define MAD_F_FRACBITS 28
# if MAD_F_FRACBITS == 28
# define MAD_F(x) ((mad_fixed_t) (x##L))
# else
# if MAD_F_FRACBITS < 28
# warning "MAD_F_FRACBITS < 28"
# define MAD_F(x) ((mad_fixed_t) \
(((x##L) + \
(1L << (28 - MAD_F_FRACBITS - 1))) >> \
(28 - MAD_F_FRACBITS)))
# elif MAD_F_FRACBITS > 28
# error "MAD_F_FRACBITS > 28 not currently supported"
# define MAD_F(x) ((mad_fixed_t) \
((x##L) << (MAD_F_FRACBITS - 28)))
# endif
# endif
#define MAD_F_ONE MAD_F(0x10000000)
struct mad_frame {
/*struct mad_header header;*/ /* MPEG audio header */
int options; /* decoding options (from stream) */
unsigned long framenumber; /* Added by (L40186) */
mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
};
/* possible quantization per subband table */
typedef struct _SBQuantTable {
unsigned int sblimit;
unsigned char const offsets[30];
} SBQuantTable;
/* bit allocation table */
typedef struct _BitAllocTable {
unsigned short nbal;
unsigned short offset;
} BitAllocTable;
typedef struct _QuantClass {
unsigned short nlevels;
unsigned char group;
unsigned char bits;
mad_fixed_t C;
mad_fixed_t D;
} QuantClass;
extern SBQuantTable const sbquant_table[5];
extern BitAllocTable const bitalloc_table[8];
extern QuantClass const qc_table[17];
extern unsigned char const offset_table[6][15];
extern mad_fixed_t const sf_table[64];
extern unsigned short g_u16MP3DECFrmSize[9][15][3];
extern mad_fixed_t I_sample(BitStreamInfo *bsi, unsigned int nb);
extern void II_samples(BitStreamInfo *bsi,
QuantClass const *quantclass,
mad_fixed_t output[3]);
#ifdef __cplusplus
}
#endif
#endif /* __LAYER12_H__ */
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
*/
#ifndef __ASM_MIPS_MACH_IP28_WAR_H
#define __ASM_MIPS_MACH_IP28_WAR_H
#define R4600_V1_INDEX_ICACHEOP_WAR 0
#define R4600_V1_HIT_CACHEOP_WAR 0
#define R4600_V2_HIT_CACHEOP_WAR 0
#define R5432_CP0_INTERRUPT_WAR 0
#define BCM1250_M3_WAR 0
#define SIBYTE_1956_WAR 0
#define MIPS4K_ICACHE_REFILL_WAR 0
#define MIPS_CACHE_SYNC_WAR 0
#define TX49XX_ICACHE_INDEX_INV_WAR 0
#define RM9000_CDEX_SMP_WAR 0
#define ICACHE_REFILLS_WORKAROUND_WAR 0
#define R10000_LLSC_WAR 1
#define MIPS34K_MISSED_ITLB_WAR 0
#endif /* __ASM_MIPS_MACH_IP28_WAR_H */
|
/*
* Copyright (C) 2013 Allwinnertech, kevin.z.m <kevin@allwinnertech.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "../include/mbr.h"
#include "../include/nand_type.h"
#include "../include/nand_drv_cfg.h"
#include "../include/nand_logic.h"
#include "../include/nand_format.h"
#include "../include/nand_scan.h"
#include "../include/nand_physic.h"
#include "../include/nfc.h"
ND_MBR *mbr=NULL;
int part_secur[NAND_MAX_PART_CNT]={0};
extern struct nand_disk nand_disk_array[NAND_MAX_PART_CNT];
extern __u32 nand_part_cnt;
typedef struct tag_CRC32_DATA
{
__u32 CRC; //intµÄ´óСÊÇ32λ
__u32 CRC_32_Tbl[256]; //ÓÃÀ´±£´æÂë±í
}CRC32_DATA_t;
__u32 calc_crc32(void * buffer, __u32 length)
{
__u32 i, j;
CRC32_DATA_t crc32; //
__u32 CRC32 = 0xffffffff; //ÉèÖóõʼֵ
crc32.CRC = 0;
for( i = 0; i < 256; ++i)//ÓÃ++iÒÔÌá¸ßЧÂÊ
{
crc32.CRC = i;
for( j = 0; j < 8 ; ++j)
{
//Õâ¸öÑ»·Êµ¼ÊÉϾÍÊÇÓÃ"¼ÆËã·¨"À´ÇóÈ¡CRCµÄУÑéÂë
if(crc32.CRC & 1)
crc32.CRC = (crc32.CRC >> 1) ^ 0xEDB88320;
else //0xEDB88320¾ÍÊÇCRC-32¶àÏî±í´ïʽµÄÖµ
crc32.CRC >>= 1;
}
crc32.CRC_32_Tbl[i] = crc32.CRC;
}
CRC32 = 0xffffffff; //ÉèÖóõʼֵ
for( i = 0; i < length; ++i)
{
CRC32 = crc32.CRC_32_Tbl[(CRC32^((unsigned char*)buffer)[i]) & 0xff] ^ (CRC32>>8);
}
//return CRC32;
return CRC32^0xffffffff;
}
__s32 _get_mbr(void)
{
__u32 i;
__s32 mbr_get_sucess = 0;
/*request mbr space*/
mbr = MALLOC(sizeof(ND_MBR));
if(mbr == NULL)
{
PRINT("%s : request memory fail\n",__FUNCTION__);
return -1;
}
/*get mbr from nand device*/
for(i = 0; i < ND_MBR_COPY_NUM; i++)
{
if(LML_Read((ND_MBR_START_ADDRESS + ND_MBR_SIZE*i)/512,ND_MBR_SIZE/512,mbr) == 0)
{
/*checksum*/
if(*(__u32 *)mbr == calc_crc32((__u32 *)mbr + 1,ND_MBR_SIZE - 4))
{
mbr_get_sucess = 1;
break;
}
}
}
if(mbr_get_sucess)
return 0;
else
return -1;
}
__s32 _free_mbr(void)
{
if(mbr)
{
FREE(mbr,sizeof(ND_MBR));
mbr = 0;
}
return 0;
}
int mbr2disks(struct nand_disk* disk_array)
{
int part_cnt = 0;
//²éÕÒ³öËùÓеÄLINUXÅÌ·û
for(part_cnt = 0; part_cnt < nand_part_cnt && part_cnt < NAND_MAX_PART_CNT; part_cnt++)
{
disk_array[part_cnt].offset =nand_disk_array[part_cnt].offset;
disk_array[part_cnt].size = nand_disk_array[part_cnt].size;
DBUG_MSG("part %d: offset = %x, size = %x\n", part_cnt, disk_array[part_cnt].offset, disk_array[part_cnt].size);
}
return nand_part_cnt;
}
int NAND_PartInit(void)
{
int part_cnt = 0;
int part_index;
struct __NandPartTable_t NandPartTable;
MEMSET(&NandPartTable,0X0,sizeof(struct __NandPartTable_t));
//if(_get_mbr())
if(1)
{
PRINT("can't get mbr,use default mbr\n" );
part_index = 1;
nand_disk_array[0].offset =0;
nand_disk_array[0].size = DiskSize;
part_secur[0] = 0;
nand_part_cnt = part_index;
NandPartTable.magic = NAND_PART_TABLE_MAGIC;
NandPartTable.part_cnt = part_index;
for(part_cnt = 0; part_cnt<NandPartTable.part_cnt; part_cnt++)
{
NandPartTable.start_sec[part_cnt] = nand_disk_array[part_cnt].offset;
NandPartTable.sec_cnt[part_cnt] = nand_disk_array[part_cnt].size;
NandPartTable.part_type[part_cnt] = part_secur[part_cnt];
}
NAND_SetPartInfo(&NandPartTable);
return nand_part_cnt;
}
else
{
part_index = 0;
for(part_cnt = 0; part_cnt<NAND_MAX_PART_CNT; part_cnt++)
part_secur[part_index] = 0;
//²éÕÒ³öËùÓеÄLINUXÅÌ·û
for(part_cnt = 0; part_cnt < mbr->PartCount && part_cnt < NAND_MAX_PART_CNT; part_cnt++)
{
//if((mbr->array[part_cnt].user_type == 2) || (mbr->array[part_cnt].user_type == 0))
{
MBR_DBG("The %d disk name = %s, class name = %s, disk size = %x\n", part_index, mbr->array[part_cnt].name,
mbr->array[part_cnt].classname, mbr->array[part_cnt].lenlo);
nand_disk_array[part_index].offset = mbr->array[part_cnt].addrlo;
nand_disk_array[part_index].size = mbr->array[part_cnt].lenlo;
part_secur[part_index] = mbr->array[part_cnt].user_type;
part_index ++;
MBR_DBG("The %d disk offset = %x\n", part_index - 1, nand_disk_array[part_index - 1].offset);
MBR_DBG("The %d disk size = %x\n", part_index - 1, nand_disk_array[part_index - 1].size);
}
}
nand_disk_array[part_index - 1].size = DiskSize - mbr->array[mbr->PartCount - 1].addrlo;
_free_mbr();
MBR_DBG("The %d disk size = %x\n", part_index - 1, nand_disk_array[part_index - 1].size);
MBR_DBG("part total count = %d\n", part_index);
nand_part_cnt = part_index;
NandPartTable.magic = NAND_PART_TABLE_MAGIC;
NandPartTable.part_cnt = part_index;
for(part_cnt = 0; part_cnt<NandPartTable.part_cnt; part_cnt++)
{
NandPartTable.start_sec[part_cnt] = nand_disk_array[part_cnt].offset;
NandPartTable.sec_cnt[part_cnt] = nand_disk_array[part_cnt].size;
NandPartTable.part_type[part_cnt] = part_secur[part_cnt];
}
NAND_SetPartInfo(&NandPartTable);
return part_index;
}
}
|
/* Copyright (C) 2014 InfiniDB, 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; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/******************************************************************************
* $Id$
*
*****************************************************************************/
/** @file
* class RWLock_local interface
*/
#ifndef RWLock_local_LOCAL_H_
#define RWLock_local_LOCAL_H_
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#if defined(_MSC_VER) && defined(xxxRWLOCK_LOCAL_DLLEXPORT)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
namespace rwlock {
/** @brief Implements RW locks for use across threads & processes
*
* Implements RW locks for use across threads & processes. Every
* instance that shares a lock must be instantiated using the same
* key. There is 'no limit' on the number of RW locks that can
* exist on the system at any one time.
*
* Summary of operation:
* - readers can work concurrently
* - writers get exclusive access
* - writers have priority
* - all state persists across all invocations sharing a given key
*
* Note: because state has to persist, it will have to be cleaned
* up somewhere else. Crashes while holding a read or write lock will
* eventually deadlock the set of processes that share the same key obviously.
*/
class RWLock_local {
public:
class not_excl : public std::exception
{
public:
virtual const char* what() const throw() {
return "not_excl";
}
};
class wouldblock : public std::exception
{
public:
virtual const char* what() const throw() {
return "wouldblock";
}
};
/** @brief Keyed constructor.
*
* Instantiate an RWLock_local with the given key. All instances that
* share a key share the same lock.
*
* @param key The key
* @param excl If true and this is the first instance with the
* supplied key, it will return holding the write lock. If true and
* this is not the first instance, it will throw not_excl. The intent
* is similar to the IPC_EXCL flag in the sem/shm implementations.
*/
EXPORT RWLock_local();
EXPORT ~RWLock_local();
/** @brief Grab a read lock
*
* Grab a read lock. This will block iff writers are waiting or
* a writer is active.
*
* @param block (For testing only) If false, will throw
* wouldblock instead of blocking
*/
EXPORT void read_lock();
/** @brief Release a read lock.
*
* Release a read lock.
*/
EXPORT void read_unlock();
/** @brief Grab a write lock
*
* Grab a write lock. This will block while another writer or reader is
* active and will have exclusive access on waking.
*
* @param block (For testing only) If false, will throw
* wouldblock instead of blocking
*/
EXPORT void write_lock();
/** @brief Release a write lock.
*
* Release a write lock.
*/
EXPORT void write_unlock();
/** @brief Upgrade a read lock to a write lock
*
* Upgrade a read lock to a write lock. It may have to block
* if there are other readers currently reading. No guarantees of atomicity.
*/
EXPORT void upgrade_to_write();
/** @brief Downgrade a write lock to a read lock
*
* Downgrade a write lock to a read lock. The conversion happens
* atomically.
*/
EXPORT void downgrade_to_read();
/* These are for white box testing only */
EXPORT void lock();
EXPORT void unlock();
EXPORT int getWriting();
EXPORT int getReading();
EXPORT int getWritersWaiting();
EXPORT int getReadersWaiting();
private:
// Not copyable
RWLock_local(const RWLock_local& rwl);
RWLock_local& operator=(const RWLock_local& rwl);
/// the layout of the shmseg
struct State {
int writerswaiting, writing, readerswaiting, reading;
} state;
boost::mutex mutex;
boost::condition okToRead;
boost::condition okToWrite;
};
enum rwlock_mode {
R,
W
};
class ScopedRWLock_local {
public:
ScopedRWLock_local(RWLock_local *, rwlock_mode);
~ScopedRWLock_local();
void lock();
void unlock();
private:
explicit ScopedRWLock_local() {}
explicit ScopedRWLock_local(const ScopedRWLock_local &) {}
ScopedRWLock_local& operator=(const ScopedRWLock_local &) { return *this; }
RWLock_local *thelock;
rwlock_mode mode;
bool locked;
};
#undef EXPORT
}
#endif
|
#ifndef __PARISC_IRQFLAGS_H
#define __PARISC_IRQFLAGS_H
#include <linux/types.h>
#include <asm/psw.h>
static inline unsigned long arch_local_save_flags(void)
{
unsigned long flags;
asm volatile("ssm 0, %0" : "=r" (flags) : : "memory");
return flags;
}
static inline void arch_local_irq_disable(void)
{
asm volatile("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory");
}
static inline void arch_local_irq_enable(void)
{
asm volatile("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory");
}
static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags;
asm volatile("rsm %1,%0" : "=r" (flags) : "i" (PSW_I) : "memory");
return flags;
}
static inline void arch_local_irq_restore(unsigned long flags)
{
asm volatile("mtsm %0" : : "r" (flags) : "memory");
}
static inline bool arch_irqs_disabled_flags(unsigned long flags)
{
return (flags & PSW_I) == 0;
}
static inline bool arch_irqs_disabled(void)
{
return arch_irqs_disabled_flags(arch_local_save_flags());
}
#endif /* __PARISC_IRQFLAGS_H */
|
/*
* Copyright (C) 2012-2013 ProFUSION embedded systems
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <stdbool.h>
#include <stdarg.h>
#include "macro.h"
struct test;
typedef int (*testfunc)(const struct test *t);
enum test_config {
/*
* Where's the roots dir for this test. It will LD_PRELOAD path.so in
* order to trap calls to functions using paths.
*/
TC_ROOTFS = 0,
/*
* What's the desired string to be returned by `uname -r`. It will
* trap calls to uname(3P) by LD_PRELOAD'ing uname.so and then filling
* in the information in u.release.
*/
TC_UNAME_R,
/*
* Fake calls to init_module(2), returning return-code and setting
* errno to err-code. Set this variable with the following format:
*
* modname:return-code:err-code
*
* When this variable is used, all calls to init_module() are trapped
* and by default the return code is 0. In other words, they fake
* "success" for all modules, except the ones in the list above, for
* which the return codes are used.
*/
TC_INIT_MODULE_RETCODES,
/*
* Fake calls to delete_module(2), returning return-code and setting
* errno to err-code. Set this variable with the following format:
*
* modname:return-code:err-code
*
* When this variable is used, all calls to init_module() are trapped
* and by default the return code is 0. In other words, they fake
* "success" for all modules, except the ones in the list above, for
* which the return codes are used.
*/
TC_DELETE_MODULE_RETCODES,
_TC_LAST,
};
#define S_TC_ROOTFS "TESTSUITE_ROOTFS"
#define S_TC_UNAME_R "TESTSUITE_UNAME_R"
#define S_TC_INIT_MODULE_RETCODES "TESTSUITE_INIT_MODULE_RETCODES"
#define S_TC_DELETE_MODULE_RETCODES "TESTSUITE_DELETE_MODULE_RETCODES"
struct keyval {
const char *key;
const char *val;
};
struct test {
const char *name;
const char *description;
struct {
/* File with correct stdout */
const char *out;
/* File with correct stderr */
const char *err;
/*
* Vector with pair of files
* key = correct file
* val = file to check
*/
const struct keyval *files;
} output;
/* comma-separated list of loaded modules at the end of the test */
const char *modules_loaded;
testfunc func;
const char *config[_TC_LAST];
const char *path;
const struct keyval *env_vars;
bool need_spawn;
bool expected_fail;
};
const struct test *test_find(const struct test *tests[], const char *name);
int test_init(int argc, char *const argv[], const struct test *tests[]);
int test_spawn_prog(const char *prog, const char *const args[]);
int test_run(const struct test *t);
#define TS_EXPORT __attribute__ ((visibility("default")))
#define _LOG(prefix, fmt, ...) printf("TESTSUITE: " prefix fmt, ## __VA_ARGS__)
#define LOG(fmt, ...) _LOG("", fmt, ## __VA_ARGS__)
#define WARN(fmt, ...) _LOG("WARN: ", fmt, ## __VA_ARGS__)
#define ERR(fmt, ...) _LOG("ERR: ", fmt, ## __VA_ARGS__)
/* Test definitions */
#define DEFINE_TEST(_name, ...) \
const struct test s##_name = { \
.name = #_name, \
.func = _name, \
## __VA_ARGS__ \
}
#define TESTSUITE_MAIN(_tests) \
int main(int argc, char *argv[]) \
{ \
const struct test *t; \
int arg; \
size_t i; \
\
arg = test_init(argc, argv, tests); \
if (arg == 0) \
return 0; \
\
if (arg < argc) { \
t = test_find(tests, argv[arg]); \
if (t == NULL) { \
fprintf(stderr, "could not find test %s\n", argv[arg]);\
exit(EXIT_FAILURE); \
} \
\
return test_run(t); \
} \
\
for (i = 0; tests[i] != NULL; i++) { \
if (test_run(tests[i]) != 0) \
exit(EXIT_FAILURE); \
} \
\
exit(EXIT_SUCCESS); \
} \
#ifdef noreturn
# define __noreturn noreturn
#elif __STDC_VERSION__ >= 201112L
# define __noreturn _Noreturn
#else
# define __noreturn __attribute__((noreturn))
#endif
|
/* bcal_present.h */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file bcal_present.h
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2009-01-09
* \license GPLv3 or later
*
*/
#include <avr/pgmspace.h>
#include "blockcipher_descriptor.h"
#include "present128.h"
#include "keysize_descriptor.h"
extern const bcdesc_t present128_desc;
|
#ifndef _FSMC_DRIVER_
#define _FSMC_DRIVER_
#include <stdint.h>
#include "NonCopyable.h"
/*
---------------------------Default GPIOs Configuration -------------------------
Address Bus Data Bus Control Bus
PF0 <-> FSMC_A0 PD14 <-> FSMC_D0 PE0 <-> FSMC_NBL0
PF1 <-> FSMC_A1 PD15 <-> FSMC_D1 PE1 <-> FSMC_NBL1
PF2 <-> FSMC_A2 PD0 <-> FSMC_D2 PD4 <-> FSMC_NOE
PF3 <-> FSMC_A3 PD1 <-> FSMC_D3 PD5 <-> FSMC_NWE
PF4 <-> FSMC_A4 PE7 <-> FSMC_D4 PD7 <-> FSMC_NE1
PF5 <-> FSMC_A5 PE8 <-> FSMC_D5 PG9 <-> FSMC_NE2
PF12 <-> FSMC_A6 PE9 <-> FSMC_D6
PF13 <-> FSMC_A7 PE10 <-> FSMC_D7
PF14 <-> FSMC_A8 PE11 <-> FSMC_D8
PF15 <-> FSMC_A9 PE12 <-> FSMC_D9
PG0 <-> FSMC_A10 PE13 <-> FSMC_D10
PG1 <-> FSMC_A11 PE14 <-> FSMC_D11
PG2 <-> FSMC_A12 PE15 <-> FSMC_D12
PG3 <-> FSMC_A13 PD8 <-> FSMC_D13
PG4 <-> FSMC_A14 PD9 <-> FSMC_D14
PG5 <-> FSMC_A15 PD10 <-> FSMC_D15
PD11 <-> FSMC_A16
PD12 <-> FSMC_A17
PD13 <-> FSMC_A18
PE3 <-> FSMC_A19
PE4 <-> FSMC_A20
PE5 <-> FSMC_A21
PE6 <-> FSMC_A22
PE2 <-> FSMC_A23
--------------------------------------------------------------------------------
*/
class Fsmc : NonCopyable
{
public:
// TODO: C++11 enum MemoryDataWidth : uint32_t
enum MemoryDataWidth
{
MemoryDataWidth_8bit = (uint32_t)0x00000000,
MemoryDataWidth_16bit = (uint32_t)0x00000010,
};
public:
Fsmc();
~Fsmc();
void setMemoryDataWidth(MemoryDataWidth dataWith);
void sramControllerInit();
uint8_t* pointerBank1();
uint32_t addressBank2();
uint32_t addressBank3();
uint32_t addressBank4();
private:
void gpioAddressBusInit();
void gpioDataBusInit();
void gpioControlBusInit();
void fsmcInit();
private:
MemoryDataWidth m_DataWidth;
};
#endif // _FSMC_DRIVER_
|
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 WebGLTexture_h
#define WebGLTexture_h
#include "WebGLSharedObject.h"
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
class WebGLTexture : public WebGLSharedObject {
public:
enum TextureExtensionFlag {
TextureExtensionsDisabled = 0,
TextureExtensionFloatLinearEnabled = 1 << 0,
TextureExtensionHalfFloatLinearEnabled = 2 << 0
};
virtual ~WebGLTexture();
static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*);
void setTarget(GC3Denum target, GC3Dint maxLevel);
void setParameteri(GC3Denum pname, GC3Dint param);
void setParameterf(GC3Denum pname, GC3Dfloat param);
GC3Denum getTarget() const { return m_target; }
int getMinFilter() const { return m_minFilter; }
void setLevelInfo(GC3Denum target, GC3Dint level, GC3Denum internalFormat, GC3Dsizei width, GC3Dsizei height, GC3Denum type);
bool canGenerateMipmaps();
// Generate all level information.
void generateMipmapLevelInfo();
GC3Denum getInternalFormat(GC3Denum target, GC3Dint level) const;
GC3Denum getType(GC3Denum target, GC3Dint level) const;
GC3Dsizei getWidth(GC3Denum target, GC3Dint level) const;
GC3Dsizei getHeight(GC3Denum target, GC3Dint level) const;
bool isValid(GC3Denum target, GC3Dint level) const;
// Whether width/height is NotPowerOfTwo.
static bool isNPOT(GC3Dsizei, GC3Dsizei);
bool isNPOT() const;
// Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL ES 2.0 Sec 3.8.2).
bool needToUseBlackTexture(TextureExtensionFlag) const;
bool isCompressed() const;
void setCompressed();
bool hasEverBeenBound() const { return object() && m_target; }
static GC3Dint computeLevelCount(GC3Dsizei width, GC3Dsizei height);
protected:
WebGLTexture(WebGLRenderingContext*);
virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) override;
private:
class LevelInfo {
public:
LevelInfo()
: valid(false)
, internalFormat(0)
, width(0)
, height(0)
, type(0)
{
}
void setInfo(GC3Denum internalFmt, GC3Dsizei w, GC3Dsizei h, GC3Denum tp)
{
valid = true;
internalFormat = internalFmt;
width = w;
height = h;
type = tp;
}
bool valid;
GC3Denum internalFormat;
GC3Dsizei width;
GC3Dsizei height;
GC3Denum type;
};
virtual bool isTexture() const override { return true; }
void update();
int mapTargetToIndex(GC3Denum) const;
const LevelInfo* getLevelInfo(GC3Denum target, GC3Dint level) const;
GC3Denum m_target;
GC3Denum m_minFilter;
GC3Denum m_magFilter;
GC3Denum m_wrapS;
GC3Denum m_wrapT;
Vector<Vector<LevelInfo>> m_info;
bool m_isNPOT;
bool m_isComplete;
bool m_needToUseBlackTexture;
bool m_isCompressed;
bool m_isFloatType;
bool m_isHalfFloatType;
};
} // namespace WebCore
#endif // WebGLTexture_h
|
/*
* Author: MontaVista Software, Inc. <source@mvista.com>
*
* 2007 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/init.h>
#include <linux/mvl_patch.h>
static __init int regpatch(void)
{
return mvl_register_patch(1419);
}
module_init(regpatch);
|
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they 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 these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: TermVersion.c /main/2 1996/08/30 15:24:52 drk $
*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include <include/hpversion.h>
#ifndef lint
version_tag("dtterm1.0: $XConsortium: TermVersion.c /main/2 1996/08/30 15:24:52 drk $")
#endif /* lint */
char _DtTermPullInTermWhatString[] = "";
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2013 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*/
#include <boot_device.h>
#include <cbfs.h>
#include <string.h>
#include <symbols.h>
#include <console/console.h>
/* Maps directly to qemu memory mapped space of 0x10000 up to rom size. */
static const struct mem_region_device gboot_dev =
MEM_REGION_DEV_INIT((void *)0x10000, CONFIG_ROM_SIZE);
const struct region_device *boot_device_ro(void)
{
return &gboot_dev.rdev;
}
static int emu_rom_open(struct cbfs_media *media)
{
return 0;
}
static void *emu_rom_map(struct cbfs_media *media, size_t offset, size_t count)
{
const struct region_device *boot_dev;
void *ptr;
boot_dev = media->context;
ptr = rdev_mmap(boot_dev, offset, count);
if (ptr == NULL)
return (void *)-1;
return ptr;
}
static void *emu_rom_unmap(struct cbfs_media *media, const void *address)
{
const struct region_device *boot_dev;
boot_dev = media->context;
rdev_munmap(boot_dev, (void *)address);
return NULL;
}
static size_t emu_rom_read(struct cbfs_media *media, void *dest, size_t offset,
size_t count)
{
const struct region_device *boot_dev;
boot_dev = media->context;
if (rdev_readat(boot_dev, dest, offset, count) < 0)
return 0;
return count;
}
static int emu_rom_close(struct cbfs_media *media)
{
return 0;
}
static int init_emu_rom_cbfs_media(struct cbfs_media *media)
{
boot_device_init();
media->context = (void *)boot_device_ro();
media->open = emu_rom_open;
media->close = emu_rom_close;
media->map = emu_rom_map;
media->unmap = emu_rom_unmap;
media->read = emu_rom_read;
return 0;
}
int init_default_cbfs_media(struct cbfs_media *media)
{
return init_emu_rom_cbfs_media(media);
}
|
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they 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 these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
/*%% $XConsortium: isclose.c /main/3 1995/10/23 11:36:50 rswiston $ */
#ifndef lint
static char sccsid[] = "@(#)isclose.c 1.8 89/07/17 Copyr 1988 Sun Micro";
#endif
/*
* Copyright (c) 1988 by Sun Microsystems, Inc.
*/
/*
* isclose.c
*
* Description:
* Close an ISAM file
*/
#include "isam_impl.h"
#include <sys/time.h>
/*
* isclose(isfd)
*
* Isclose() closes the ISAM file associated with the file descriptor isfd.
* There may be other ISAM file descriptors in use which are associated
* with the same ISAM file; are not effected by isclose().
*
* Isclose() returns -1 if an errors was detected, or 0 if the file was closed
* successfully.
*
* Errors:
* ENOTOPEN isfd is not ISAM file descriptor of an open ISAM file.
*/
int
isclose(isfd)
int isfd;
{
Fab *fab;
Fcb *fcb;
if ((fab = _isfd_find(isfd)) == NULL) {
_setiserrno2(ENOTOPEN, '9', '0');
return (ISERROR);
}
_isam_entryhook();
/*
* Get FCB corresponding to the isfhandle handle.
*/
if ((fcb = _openfcb(&fab->isfhandle, &fab->errcode)) == NULL) {
_isam_exithook();
return (ISERROR);
}
/*
* Delete FCB and remove it from FCB cache. Close UNIX fds.
*
* This is desirable when ISAM files are removed from other processes,
* or simply by 'rm file.*'.
*/
(void) _watchfd_decr(_isfcb_nfds(fcb));
_isfcb_close(fcb);
_mngfcb_delete(&fab->isfhandle);
_isam_exithook();
_fab_destroy(fab); /* Deallocate Fab object */
_isfd_delete(isfd);
return (ISOK);
}
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file KX_PythonInit.h
* \ingroup ketsji
*/
#ifndef __KX_PYTHONINIT_H__
#define __KX_PYTHONINIT_H__
#include "EXP_Python.h"
#include "STR_String.h"
#include "MT_Vector3.h"
class KX_KetsjiEngine;
class KX_Scene;
typedef enum {
psl_Lowest = 0,
psl_Highest,
} TPythonSecurityLevel;
extern bool gUseVisibilityTemp;
#ifdef WITH_PYTHON
PyMODINIT_FUNC initBGE(void);
PyMODINIT_FUNC initApplicationPythonBinding(void);
PyMODINIT_FUNC initGameLogicPythonBinding(void);
PyMODINIT_FUNC initGameKeysPythonBinding(void);
PyMODINIT_FUNC initRasterizerPythonBinding(void);
PyMODINIT_FUNC initVideoTexturePythonBinding(void);
PyObject *initGamePlayerPythonScripting(struct Main *maggie, int argc, char **argv);
PyObject *initGamePythonScripting(struct Main *maggie);
void exitGamePlayerPythonScripting();
void exitGamePythonScripting();
void setupGamePython(KX_KetsjiEngine *ketsjiengine, KX_Scene *startscene, Main *blenderdata,
PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char **argv);
void setGamePythonPath(const char *path);
void resetGamePythonPath();
void pathGamePythonConfig(char *path);
int saveGamePythonConfig(char **marshal_buffer);
int loadGamePythonConfig(char *marshal_buffer, int marshal_length);
#endif
void addImportMain(struct Main *maggie);
void removeImportMain(struct Main *maggie);
class KX_KetsjiEngine;
class KX_Scene;
void KX_SetActiveScene(KX_Scene *scene);
KX_Scene *KX_GetActiveScene();
KX_KetsjiEngine *KX_GetActiveEngine();
typedef int (*PyNextFrameFunc)(void *);
struct PyNextFrameState {
/** can be either a GPG_NextFrameState or a BL_KetsjiNextFrameState */
void *state;
/** can be either GPG_PyNextFrame or BL_KetsjiPyNextFrame */
PyNextFrameFunc func;
};
extern struct PyNextFrameState pynextframestate;
void KX_RasterizerDrawDebugLine(const MT_Vector3 &from,const MT_Vector3 &to,const MT_Vector3 &color);
void KX_RasterizerDrawDebugCircle(const MT_Vector3 ¢er, const MT_Scalar radius, const MT_Vector3 &color,
const MT_Vector3 &normal, int nsector);
#endif /* __KX_PYTHONINIT_H__ */
|
/*
* Author: MontaVista Software, Inc. <source@mvista.com>
*
* 2007 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/init.h>
#include <linux/mvl_patch.h>
static __init int regpatch(void)
{
return mvl_register_patch(1161);
}
module_init(regpatch);
|
//
// Person.h
// BuchVerleih-Tutorial
//
// Created by Benjamin Herzog on 04.07.14.
// Copyright (c) 2014 Benjamin Herzog. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Buch;
@interface Person : NSManagedObject
@property (nonatomic, retain) NSString * nachname;
@property (nonatomic, retain) NSString * vorname;
@property (nonatomic, retain) NSSet *buecher;
@end
@interface Person (CoreDataGeneratedAccessors)
- (void)addBuecherObject:(Buch *)value;
- (void)removeBuecherObject:(Buch *)value;
- (void)addBuecher:(NSSet *)values;
- (void)removeBuecher:(NSSet *)values;
@end
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CScriptKeyBinds.h
* PURPOSE: Header for script key binds class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#pragma once
#include "lua/CLuaMain.h"
#include <list>
enum eScriptKeyBindType
{
SCRIPT_KEY_BIND_FUNCTION = 0,
SCRIPT_KEY_BIND_CONTROL_FUNCTION,
SCRIPT_KEY_BIND_UNDEFINED,
};
struct SScriptBindableKey
{
const char* szKey;
};
struct SScriptBindableGTAControl
{
const char* szControl;
};
class CScriptKeyBind
{
public:
CScriptKeyBind(void) : boundKey(NULL), luaMain(NULL), beingDeleted(false) {}
virtual ~CScriptKeyBind(void) {}
bool IsBeingDeleted(void) { return beingDeleted; }
const SScriptBindableKey* boundKey;
CLuaMain* luaMain;
bool beingDeleted;
virtual eScriptKeyBindType GetType(void) = 0;
};
class CScriptKeyBindWithState : public CScriptKeyBind
{
public:
CScriptKeyBindWithState(void) { bHitState = true; }
bool bHitState;
};
class CScriptFunctionBind
{
public:
CLuaFunctionRef m_iLuaFunction;
CLuaArguments m_Arguments;
};
class CScriptKeyFunctionBind : public CScriptKeyBindWithState, public CScriptFunctionBind
{
public:
eScriptKeyBindType GetType(void) { return SCRIPT_KEY_BIND_FUNCTION; }
};
class CScriptControlFunctionBind : public CScriptKeyBindWithState, public CScriptFunctionBind
{
public:
eScriptKeyBindType GetType(void) { return SCRIPT_KEY_BIND_CONTROL_FUNCTION; }
const SScriptBindableGTAControl* boundControl;
};
class CScriptKeyBinds
{
public:
CScriptKeyBinds(void) : m_bProcessingKey(false) {}
~CScriptKeyBinds(void);
static const SScriptBindableKey* GetBindableFromKey(const char* szKey);
static const SScriptBindableGTAControl* GetBindableFromControl(const char* szControl);
// Basic funcs
void Add(CScriptKeyBind* pKeyBind);
void Clear(eScriptKeyBindType bindType = SCRIPT_KEY_BIND_UNDEFINED);
void Call(CScriptKeyBind* pKeyBind);
bool ProcessKey(const char* szKey, bool bHitState, eScriptKeyBindType bindTypeconst);
std::list<CScriptKeyBind*>::iterator IterBegin(void) { return m_List.begin(); }
std::list<CScriptKeyBind*>::iterator IterEnd(void) { return m_List.end(); }
// Key-function bind funcs
bool AddKeyFunction(const char* szKey, bool bHitState, CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction, CLuaArguments& Arguments);
bool AddKeyFunction(const SScriptBindableKey* pKey, bool bHitState, CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction, CLuaArguments& Arguments);
bool RemoveKeyFunction(const char* szKey, CLuaMain* pLuaMain, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool RemoveKeyFunction(const SScriptBindableKey* pKey, CLuaMain* pLuaMain, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool KeyFunctionExists(const char* szKey, CLuaMain* pLuaMain = NULL, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool KeyFunctionExists(const SScriptBindableKey* pKey, CLuaMain* pLuaMain = NULL, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
// Control-function bind funcs
bool AddControlFunction(const char* szControl, bool bHitState, CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction, CLuaArguments& Arguments);
bool AddControlFunction(const SScriptBindableGTAControl* pControl, bool bHitState, CLuaMain* pLuaMain, const CLuaFunctionRef& iLuaFunction,
CLuaArguments& Arguments);
bool RemoveControlFunction(const char* szControl, CLuaMain* pLuaMain, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool RemoveControlFunction(const SScriptBindableGTAControl* pControl, CLuaMain* pLuaMain, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool ControlFunctionExists(const char* szControl, CLuaMain* pLuaMain = NULL, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
bool ControlFunctionExists(const SScriptBindableGTAControl* pControl, CLuaMain* pLuaMain = NULL, bool bCheckHitState = false, bool bHitState = true,
const CLuaFunctionRef& iLuaFunction = CLuaFunctionRef());
void RemoveAllKeys(CLuaMain* pLuaMain);
static bool IsMouse(const SScriptBindableKey* pKey);
void RemoveDeletedBinds(void);
protected:
std::list<CScriptKeyBind*> m_List;
bool m_bProcessingKey;
};
|
/*
* snapshape.c: read a snapshot file and calculate shape and rms radius.
*/
#include "stdinc.h"
#include "mathfns.h"
#include "getparam.h"
#include "filestruct.h"
#include "vectmath.h"
#include "phatbody.h"
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>
string defv[] = { ";Estimate ellipticity & r.m.s. radius",
"in=???", ";Input snapshots, centered and sorted",
"nbin=8", ";Number of radial bins to list",
"listvec=false", ";If true, list eigen-vectors also",
"VERSION=1.3", ";Josh Barnes 19 June 2015",
NULL,
};
void eigensolve(vector, vector, vector, real *, matrix);
int main(int argc, string argv[])
{
stream istr;
string bodytags[] = { PosTag, NULL }, intags[MaxBodyFields];
bodyptr btab = NULL, bp;
int nbody, nshell, n;
real tnow, vals[3];
matrix tmpm, qmat;
vector v1, v2, v3;
initparam(argv, defv);
istr = stropen(getparam("in"), "r");
get_history(istr);
layout_body(bodytags, Precision, NDIM);
printf("#%11s %3s %11s %11s %11s\n",
"time", "n", "r_rms", "c/a", "b/a");
while (get_snap(istr, &btab, &nbody, &tnow, intags, FALSE, NULL)) {
if (! set_member(intags, PosTag))
error("%s: %s data missing\n", getargv0(), PosTag);
if (nbody % getiparam("nbin") != 0)
error("%s: nbin does not divide number of bodies\n", getargv0());
nshell = nbody / getiparam("nbin");
for (n = 0; n < nbody; n += nshell) {
CLRM(qmat);
for (bp = NthBody(btab, n); bp < NthBody(btab, n + nshell);
bp = NextBody(bp)) {
OUTVP(tmpm, Pos(bp), Pos(bp));
ADDM(qmat, qmat, tmpm);
}
eigensolve(v1, v2, v3, vals, qmat);
printf(" %11.6f %3d %11.6f %11.6f %11.6f\n",
tnow, n / nshell, rsqrt(tracem(qmat) / nshell),
rsqrt(vals[2] / vals[0]), rsqrt(vals[1] / vals[0]));
if (getbparam("listvec")) {
printf("#\t\t\t\t\t\t\t%8.5f %8.5f %8.5f\n", v1[0], v1[1], v1[2]);
printf("#\t\t\t\t\t\t\t%8.5f %8.5f %8.5f\n", v2[0], v2[1], v2[2]);
printf("#\t\t\t\t\t\t\t%8.5f %8.5f %8.5f\n", v3[0], v3[1], v3[2]);
}
}
}
return (0);
}
void eigensolve(vector vec1, vector vec2, vector vec3,
real *vals, matrix symmat)
{
int i, j;
double data[9];
gsl_matrix_view mat;
gsl_vector_view vec;
gsl_vector *eigval = gsl_vector_alloc(3);
gsl_matrix *eigvec = gsl_matrix_alloc(3, 3);
gsl_eigen_symmv_workspace *work = gsl_eigen_symmv_alloc(3);
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
data[3*i + j] = symmat[i][j];
mat = gsl_matrix_view_array(data, 3, 3);
gsl_eigen_symmv(&mat.matrix, eigval, eigvec, work);
gsl_eigen_symmv_free(work);
gsl_eigen_symmv_sort(eigval, eigvec, GSL_EIGEN_SORT_VAL_DESC);
for (i = 0; i < 3; i++)
vals[i] = gsl_vector_get(eigval, i);
vec = gsl_matrix_column(eigvec, 0);
for (i = 0; i < 3; i++)
vec1[i] = gsl_vector_get(&vec.vector, i);
vec = gsl_matrix_column(eigvec, 1);
for (i = 0; i < 3; i++)
vec2[i] = gsl_vector_get(&vec.vector, i);
vec = gsl_matrix_column(eigvec, 2);
for (i = 0; i < 3; i++)
vec3[i] = gsl_vector_get(&vec.vector, i);
gsl_vector_free(eigval);
gsl_matrix_free(eigvec);
}
|
#ifndef MRST_API_H_INCLUDED
#define MRST_API_H_INCLUDED
/* We preserve the old typedef here, since it is gone from grid.h.
* This header is not standalone, grid.h (and more) must be included
* before mrst_api.h
*/
typedef struct UnstructuredGrid grid_t;
#ifdef __cplusplus
extern "C" {
#endif
/*
* "API" to MRST grid : implements access to raw C vectors.
*/
int getNumberOfDimensions (const mxArray *G);
void getLocal2GlobalCellMap(const mxArray *G);
/* Node coordinates */
int getNumberOfNodes (const mxArray *G);
double *getNodeCoordinates(const mxArray *G); /* copy */
/* Face topology */
int getNumberOfFaces (const mxArray *G);
int getNumberOfFaceNodes (const mxArray *G);
int *getFaceNodePos (const mxArray *G); /* copy */
int *getFaceNodes (const mxArray *G); /* copy */
int *getFaceCellNeighbors (const mxArray *G); /* copy */
/* Face geometry */
double *getFaceAreas (const mxArray *G);
double *getFaceNormals (const mxArray *G); /* copy */
double *getFaceCentroids (const mxArray *G); /* copy */
/* Cell topology */
int getNumberOfCells (const mxArray *G);
int getNumberOfCellFaces (const mxArray *G);
int *getCellFacePos (const mxArray *G); /* copy */
int *getCellFaces (const mxArray *G); /* copy */
/* Cell geometry */
double *getCellVolumes (const mxArray *G);
double *getCellCentroids (const mxArray *G); /* copy */
/* Rock properties */
double *
getPermeability(const mxArray *perm, int d); /* copy */
/* Grid stuff */
grid_t *mrst_grid(const mxArray *G);
grid_t *mrst_grid_topology(const mxArray *G);
void free_mrst_grid(grid_t *g);
int verify_mrst_grid(const mxArray *G);
#ifdef __cplusplus
}
#endif
#endif /* MRST_API_H_INCLUDED */
|
/*
Copyright 2013 Barobo, Inc.
This file is part of BaroboLink.
BaroboLink 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.
BaroboLink 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 BaroboLink. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <mobot.h>
enum motionType_e
{
MOTION_POS,
MOTION_SLEEP,
};
struct motion_s
{
enum motionType_e motionType;
union data_u {
double sleepDuration;
double pos[4];
} data;
char* name;
};
#if 0
class CRecordMobot :
public CMobot
{
public:
CRecordMobot(char* name);
~CRecordMobot(void);
/* Override the default connection function to save the address */
int connectWithAddress(const char address[], int channel);
const char* getAddress();
int record();
int addDelay(double seconds);
int play(int index);
int getMotionType(int index);
int getMotionString(int index, char* buf);
const char* getMotionName(int index);
int setMotionName(int index, const char* name);
int removeMotion(int index, bool releaseData = true);
int clearAllMotions();
/* moveMotion:
Copy motion 'fromindex', insert to 'toindex', delete 'fromindex' */
int moveMotion(int fromindex, int toindex);
int numMotions();
private:
int _numMotions;
struct motion_s **_motions;
int _numMotionsAllocated;
char _name[80];
char _address[80];
};
#endif
typedef enum recordMobotConnectStatus_e
{
RMOBOT_NOT_CONNECTED,
RMOBOT_CONNECTING,
RMOBOT_CONNECTED
} recordMobotConnectStatus_t;
typedef struct recordMobot_s
{
mobot_t mobot;
int numMotions;
struct motion_s **motions;
int numMotionsAllocated;
char name[80];
char address[80];
bool bound; /* Is the mobot bound via external TCP socket? */
int firmwareVersion;
recordMobotConnectStatus_t connectStatus;
int dirty;
int rgb[3];
} recordMobot_t;
#ifdef __cplusplus
extern "C" {
#endif
recordMobot_t* RecordMobot_new();
void RecordMobot_init(recordMobot_t* mobot, const char *name);
void RecordMobot_destroy(recordMobot_t* mobot);
int RecordMobot_connectWithAddress(recordMobot_t* mobot, const char address[], int channel);
const char* RecordMobot_getAddress(recordMobot_t* mobot);
int RecordMobot_record(recordMobot_t* mobot);
int RecordMobot_addDelay(recordMobot_t* mobot, double seconds);
int RecordMobot_isMoving(recordMobot_t* rmobot);
int RecordMobot_play(recordMobot_t* mobot, int index);
int RecordMobot_getMotionType(recordMobot_t* mobot, int index);
int RecordMobot_getChMotionString(recordMobot_t* mobot, int index, char* buf);
int RecordMobot_getChMotionStringB(recordMobot_t* mobot, int index, char* buf);
int RecordMobot_getPythonMotionString(recordMobot_t* mobot, int index, char* buf);
int RecordMobot_getPythonMotionStringB(recordMobot_t* mobot, int index, char* buf);
const char* RecordMobot_getMotionName(recordMobot_t* mobot, int index);
int RecordMobot_setMotionName(recordMobot_t* mobot, int index, const char* name);
int RecordMobot_removeMotion(recordMobot_t* mobot, int index, bool releaseData);
int RecordMobot_clearAllMotions(recordMobot_t* mobot);
int RecordMobot_moveMotion(recordMobot_t* mobot, int fromindex, int toindex);
int RecordMobot_swapMotion(recordMobot_t* mobot, int index1, int index2);
void RecordMobot_setName(recordMobot_t* mobot, const char* name);
recordMobotConnectStatus_t RecordMobot_connectStatus(recordMobot_t* mobot);
#ifdef __cplusplus
}
#endif
|
/*!
* \file volk_gnsssdr_8i_x2_add_8i.h
* \brief VOLK_GNSSSDR kernel: adds pairs of 8 bits (char) scalars.
* \authors <ul>
* <li> Andres Cecilia, 2014. a.cecilia.luque(at)gmail.com
* </ul>
*
* VOLK_GNSSSDR kernel that adds pairs of 8 bits (char) scalars
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
/*!
* \page volk_gnsssdr_8i_x2_add_8i
*
* \b Overview
*
* Adds the two input vectors and store the results in the third vector.
*
* <b>Dispatcher Prototype</b>
* \code
* void volk_gnsssdr_8i_x2_add_8i(char* cVector, const char* aVector, const char* bVector, unsigned int num_points);
* \endcode
*
* \b Inputs
* \li aVector: One of the vectors of to be added.
* \li bVector: The other vector to be added.
* \li num_points: Number of values in \p aVector and \p bVector to be added together and stored into \p cVector
*
* \b Outputs
* \li cVector: The vector where the result will be stored.
*
*/
#ifndef INCLUDED_volk_gnsssdr_8i_x2_add_8i_H
#define INCLUDED_volk_gnsssdr_8i_x2_add_8i_H
#ifdef LV_HAVE_SSE2
#include <emmintrin.h>
static inline void volk_gnsssdr_8i_x2_add_8i_u_sse2(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
const unsigned int sse_iters = num_points / 16;
unsigned int number;
unsigned int i;
char* cPtr = cVector;
const char* aPtr = aVector;
const char* bPtr = bVector;
__m128i aVal, bVal, cVal;
for (number = 0; number < sse_iters; number++)
{
aVal = _mm_loadu_si128((__m128i*)aPtr);
bVal = _mm_loadu_si128((__m128i*)bPtr);
cVal = _mm_add_epi8(aVal, bVal);
_mm_storeu_si128((__m128i*)cPtr, cVal); // Store the results back into the C container
aPtr += 16;
bPtr += 16;
cPtr += 16;
}
for (i = sse_iters * 16; i < num_points; ++i)
{
*cPtr++ = (*aPtr++) + (*bPtr++);
}
}
#endif /* LV_HAVE_SSE2 */
#ifdef LV_HAVE_AVX2
#include <immintrin.h>
static inline void volk_gnsssdr_8i_x2_add_8i_u_avx2(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
const unsigned int avx_iters = num_points / 32;
unsigned int number;
unsigned int i;
char* cPtr = cVector;
const char* aPtr = aVector;
const char* bPtr = bVector;
__m256i aVal, bVal, cVal;
for (number = 0; number < avx_iters; number++)
{
aVal = _mm256_loadu_si256((__m256i*)aPtr);
bVal = _mm256_loadu_si256((__m256i*)bPtr);
cVal = _mm256_add_epi8(aVal, bVal);
_mm256_storeu_si256((__m256i*)cPtr, cVal); // Store the results back into the C container
aPtr += 32;
bPtr += 32;
cPtr += 32;
}
for (i = avx_iters * 32; i < num_points; ++i)
{
*cPtr++ = (*aPtr++) + (*bPtr++);
}
}
#endif /* LV_HAVE_SSE2 */
#ifdef LV_HAVE_GENERIC
static inline void volk_gnsssdr_8i_x2_add_8i_generic(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
char* cPtr = cVector;
const char* aPtr = aVector;
const char* bPtr = bVector;
unsigned int number;
for (number = 0; number < num_points; number++)
{
*cPtr++ = (*aPtr++) + (*bPtr++);
}
}
#endif /* LV_HAVE_GENERIC */
#ifdef LV_HAVE_SSE2
#include <emmintrin.h>
static inline void volk_gnsssdr_8i_x2_add_8i_a_sse2(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
const unsigned int sse_iters = num_points / 16;
unsigned int number;
unsigned int i;
char* cPtr = cVector;
const char* aPtr = aVector;
const char* bPtr = bVector;
__m128i aVal, bVal, cVal;
for (number = 0; number < sse_iters; number++)
{
aVal = _mm_load_si128((__m128i*)aPtr);
bVal = _mm_load_si128((__m128i*)bPtr);
cVal = _mm_add_epi8(aVal, bVal);
_mm_store_si128((__m128i*)cPtr, cVal); // Store the results back into the C container
aPtr += 16;
bPtr += 16;
cPtr += 16;
}
for (i = sse_iters * 16; i < num_points; ++i)
{
*cPtr++ = (*aPtr++) + (*bPtr++);
}
}
#endif /* LV_HAVE_SSE2 */
#ifdef LV_HAVE_AVX2
#include <immintrin.h>
static inline void volk_gnsssdr_8i_x2_add_8i_a_avx2(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
const unsigned int avx_iters = num_points / 32;
unsigned int number;
unsigned int i;
char* cPtr = cVector;
const char* aPtr = aVector;
const char* bPtr = bVector;
__m256i aVal, bVal, cVal;
for (number = 0; number < avx_iters; number++)
{
aVal = _mm256_load_si256((__m256i*)aPtr);
bVal = _mm256_load_si256((__m256i*)bPtr);
cVal = _mm256_add_epi8(aVal, bVal);
_mm256_store_si256((__m256i*)cPtr, cVal); // Store the results back into the C container
aPtr += 32;
bPtr += 32;
cPtr += 32;
}
for (i = avx_iters * 32; i < num_points; ++i)
{
*cPtr++ = (*aPtr++) + (*bPtr++);
}
}
#endif /* LV_HAVE_SSE2 */
#ifdef LV_HAVE_ORC
extern void volk_gnsssdr_8i_x2_add_8i_a_orc_impl(char* cVector, const char* aVector, const char* bVector, unsigned int num_points);
static inline void volk_gnsssdr_8i_x2_add_8i_u_orc(char* cVector, const char* aVector, const char* bVector, unsigned int num_points)
{
volk_gnsssdr_8i_x2_add_8i_a_orc_impl(cVector, aVector, bVector, num_points);
}
#endif /* LV_HAVE_ORC */
#endif /* INCLUDED_volk_gnsssdr_8i_x2_add_8i_H */
|
/*
* This file is part of the #KAT Social Network Simulator.
*
* The #KAT Social Network Simulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The #KAT Social Network Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the #KAT Social Network Simulator. If not, see <http://www.gnu.org/licenses/>.
*
* Addendum:
*
* Under this license, derivations of the #KAT Social Network Simulator typically must be provided in source
* form. The #KAT Social Network Simulator and derivations thereof may be relicensed by decision of
* the original authors (Kevin Ryczko & Adam Domurad, Isaac Tamblyn), as well, in the case of a derivation,
* subsequent authors.
*/
#ifndef FOLLOWING_SET_H_
#define FOLLOWING_SET_H_
#include "events.h"
#include "config_static.h"
#include "util/HashedEdgeSet.h"
// Forward declare, to prevent circular header inclusion:
struct AnalysisState;
struct FollowingSet {
typedef HashedEdgeSet<int> Followings;
void print(AnalysisState& S);
std::vector<int> as_vector() {
return implementation.as_vector();
}
bool add(AnalysisState& S, int id) {
return implementation.insert(id);
}
bool remove(AnalysisState& S, int id) {
return implementation.erase(id);
}
bool contains(int id) {
return implementation.contains(id);
}
// No such thing as pick_random_weighted for FollowingSet
bool pick_random_uniform(MTwist& rng, int& id) {
return implementation.pick_random_uniform(rng, id);
}
size_t size() const {
return implementation.size();
}
template <typename Archive>
void save(Archive& ar) const {
ar( cereal::make_size_tag( size() ) );
for (int edge : ((FollowingSet*)this)->implementation.as_vector()) {
ar(edge);
}
}
template <typename Archive>
void load(Archive& ar) {
size_t size;
ar( cereal::make_size_tag( size ) );
for (size_t i = 0; i < size ; i++) {
int edge;
ar(edge);
implementation.insert(edge);
}
}
void post_load(AnalysisState& state) {
}
private:
Followings implementation;
};
#endif
|
/* Copyright (C) 2009 Klystofer Ortega, Victor Villela Serta
This file is part of Kvnix.
Kvnix is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Kvnix 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 Kvnix. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
*
* Support functions to handle disk.
*
* These funtions are used mainly to load programs (data) from disk to memory.
*/
#ifndef _DISK_H
#define _DISK_H
/**
* LBA Address Packet
*/
typedef struct
{
unsigned char packet_len;
unsigned char reserved1;
unsigned short nsects;
unsigned int buffer;
unsigned long long lba;
} lba_command_packet;
/**
* Read a disk region for a given position.
*
* @param memory position to write.
* @param offset indicates the beginning on disk (must be a beginning of a sector)
* @param nrsectors number of sectors to read
*/
void read_disk_data(void * memory, unsigned long long offset, unsigned short nrsectors);
/**
* Reads a sector from disk to memory.
*
* @param memory position to write.
* @param lba linear base address.
*/
void read_disk_sector(void * memory, unsigned long long lba);
#endif
|
// Template array classes with like-type math ops
/*
Copyright (C) 1996-2013 John W. Eaton
This file is part of Octave.
Octave 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.
Octave 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 Octave; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
#if !defined (octave_MArrayN_h)
#define octave_MArrayN_h 1
#include "MArray.h"
#define MArrayN MArray
// If we're with GNU C++, issue a warning.
#ifdef __GNUC__
#warning Using MArrayN<T> is deprecated. Use MArray<T>.
#endif
#endif
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - cart_rom.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* 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 M64P_PI_CART_ROM_H
#define M64P_PI_CART_ROM_H
#include <stddef.h>
#include <stdint.h>
struct cart_rom
{
uint8_t* rom;
size_t rom_size;
uint32_t last_write;
};
static uint32_t rom_address(uint32_t address)
{
return (address & 0x03fffffc);
}
void connect_cart_rom(struct cart_rom* cart_rom,
uint8_t* rom, size_t rom_size);
void init_cart_rom(struct cart_rom* cart_rom);
int read_cart_rom(void* opaque, uint32_t address, uint32_t* value);
int write_cart_rom(void* opaque, uint32_t address, uint32_t value, uint32_t mask);
#endif
|
// This is a generated source file for Chilkat version 9.5.0.56
#if defined(WIN32) || defined(WINCE)
#ifndef _C_CkCsp_H
#define _C_CkCsp_H
#include "chilkatDefs.h"
#include "Chilkat_C.h"
CK_VISIBLE_PUBLIC HCkCsp CkCsp_Create(void);
CK_VISIBLE_PUBLIC void CkCsp_Dispose(HCkCsp handle);
CK_VISIBLE_PUBLIC void CkCsp_getDebugLogFilePath(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC void CkCsp_putDebugLogFilePath(HCkCsp cHandle, const char *newVal);
CK_VISIBLE_PUBLIC const char *CkCsp_debugLogFilePath(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getEncryptAlgorithm(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_encryptAlgorithm(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getEncryptAlgorithmID(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getEncryptNumBits(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getHashAlgorithm(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_hashAlgorithm(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getHashAlgorithmID(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getHashNumBits(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getKeyContainerName(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC void CkCsp_putKeyContainerName(HCkCsp cHandle, const char *newVal);
CK_VISIBLE_PUBLIC const char *CkCsp_keyContainerName(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getLastErrorHtml(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_lastErrorHtml(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getLastErrorText(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_lastErrorText(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getLastErrorXml(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_lastErrorXml(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_getLastMethodSuccess(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_putLastMethodSuccess(HCkCsp cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC BOOL CkCsp_getMachineKeyset(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_putMachineKeyset(HCkCsp cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC int CkCsp_getNumEncryptAlgorithms(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getNumHashAlgorithms(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getNumKeyContainers(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getNumKeyExchangeAlgorithms(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getNumSignatureAlgorithms(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_getProviderName(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC void CkCsp_putProviderName(HCkCsp cHandle, const char *newVal);
CK_VISIBLE_PUBLIC const char *CkCsp_providerName(HCkCsp cHandle);
CK_VISIBLE_PUBLIC int CkCsp_getProviderType(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_getUtf8(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_putUtf8(HCkCsp cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC BOOL CkCsp_getVerboseLogging(HCkCsp cHandle);
CK_VISIBLE_PUBLIC void CkCsp_putVerboseLogging(HCkCsp cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC void CkCsp_getVersion(HCkCsp cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *CkCsp_version(HCkCsp cHandle);
CK_VISIBLE_PUBLIC HCkStringArray CkCsp_GetKeyContainerNames(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_HasEncryptAlgorithm(HCkCsp cHandle, const char *name, int numBits);
CK_VISIBLE_PUBLIC BOOL CkCsp_HasHashAlgorithm(HCkCsp cHandle, const char *name, int numBits);
CK_VISIBLE_PUBLIC BOOL CkCsp_Initialize(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_NthEncryptionAlgorithm(HCkCsp cHandle, int index, HCkString outName);
CK_VISIBLE_PUBLIC const char *CkCsp_nthEncryptionAlgorithm(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC int CkCsp_NthEncryptionNumBits(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC BOOL CkCsp_NthHashAlgorithmName(HCkCsp cHandle, int index, HCkString outName);
CK_VISIBLE_PUBLIC const char *CkCsp_nthHashAlgorithmName(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC int CkCsp_NthHashNumBits(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC BOOL CkCsp_NthKeyContainerName(HCkCsp cHandle, int index, HCkString outName);
CK_VISIBLE_PUBLIC const char *CkCsp_nthKeyContainerName(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC BOOL CkCsp_NthKeyExchangeAlgorithm(HCkCsp cHandle, int index, HCkString outName);
CK_VISIBLE_PUBLIC const char *CkCsp_nthKeyExchangeAlgorithm(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC int CkCsp_NthKeyExchangeNumBits(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC BOOL CkCsp_NthSignatureAlgorithm(HCkCsp cHandle, int index, HCkString outName);
CK_VISIBLE_PUBLIC const char *CkCsp_nthSignatureAlgorithm(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC int CkCsp_NthSignatureNumBits(HCkCsp cHandle, int index);
CK_VISIBLE_PUBLIC BOOL CkCsp_SaveLastError(HCkCsp cHandle, const char *path);
CK_VISIBLE_PUBLIC int CkCsp_SetEncryptAlgorithm(HCkCsp cHandle, const char *name);
CK_VISIBLE_PUBLIC int CkCsp_SetHashAlgorithm(HCkCsp cHandle, const char *name);
CK_VISIBLE_PUBLIC BOOL CkCsp_SetProviderMicrosoftBase(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_SetProviderMicrosoftEnhanced(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_SetProviderMicrosoftRsaAes(HCkCsp cHandle);
CK_VISIBLE_PUBLIC BOOL CkCsp_SetProviderMicrosoftStrong(HCkCsp cHandle);
#endif
#endif // WIN32 (entire file)
|
/**
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_AUDIO_NULL_AUDIO_H
#define LOVE_AUDIO_NULL_AUDIO_H
// LOVE
#include "audio/Audio.h"
#include "Source.h"
namespace love
{
namespace audio
{
namespace null
{
class Audio : public love::audio::Audio
{
public:
Audio();
virtual ~Audio();
// Implements Module.
const char *getName() const;
// Implements Audio.
love::audio::Source *newSource(love::sound::Decoder *decoder);
love::audio::Source *newSource(love::sound::SoundData *soundData);
int getSourceCount() const;
int getMaxSources() const;
bool play(love::audio::Source *source);
void stop(love::audio::Source *source);
void stop();
void pause(love::audio::Source *source);
void pause();
void resume(love::audio::Source *source);
void resume();
void rewind(love::audio::Source *source);
void rewind();
void setVolume(float volume);
float getVolume() const;
void getPosition(float *v) const;
void setPosition(float *v);
void getOrientation(float *v) const;
void setOrientation(float *v);
void getVelocity(float *v) const;
void setVelocity(float *v);
void record();
love::sound::SoundData *getRecordedData();
love::sound::SoundData *stopRecording(bool returnData);
bool canRecord();
DistanceModel getDistanceModel() const;
void setDistanceModel(DistanceModel distanceModel);
private:
float volume;
DistanceModel distanceModel;
}; // Audio
} // null
} // audio
} // love
#endif // LOVE_AUDIO_NULL_AUDIO_H
|
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* overriding mpicc to link C programs (only for IBM) */
/* #undef CC */
/* arguments passed to configure script */
#define CONFIGURE_ARGS " '--enable-gnu' '--enable-fftw' '--enable-stride1' '--with-fftw=/opt/fftw/3.3.3/gnu/mvapich2/ib' 'FC=mpif90' 'CC=mpicc'"
/* Define if you want to compile P3DFFT using CRAY compiler */
/* #undef CRAY */
/* Define if you want to enable C convention for processor dimensions */
/* #undef DIMS_C */
/* Define if you want to use the ESSL library instead of FFTW */
/* #undef ESSL */
/* Define whether you want to enable estimation */
/* #undef ESTIMATE */
/* Define if you want to use the FFTW library */
#define FFTW 1
/* Define if you want to compile P3DFFT using GNU compiler */
#define GNU 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you want to compile P3DFFT using IBM compiler */
/* #undef IBM */
/* Define if you want to compile P3DFFT using Intel compiler */
/* #undef INTEL */
/* Define if you want to enable the measure algorithm */
#define MEASURE 1
/* Define if you want to override the default value of NBL_X */
/* #undef NBL_X */
/* Define if you want to override the default value of NBL_Y1 */
/* #undef NBL_Y1 */
/* Define if you want to override the default value of NBL_Y2 */
/* #undef NBL_Y2 */
/* Define if you want to override the default value of NBL_Z */
/* #undef NBL_Z */
/* Define if you want 1D decomposition */
/* #undef ONED */
/* Name of package */
#define PACKAGE "p3dfft"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "dmitry@sdsc.edu"
/* Define to the full name of this package. */
#define PACKAGE_NAME "P3DFFT"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "P3DFFT 2.6"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "p3dfft"
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.6"
/* Define if you want to enable the patient algorithm */
/* #undef PATIENT */
/* Define if you want to compile P3DFFT using PGI compiler */
/* #undef PGI */
/* Define if you want to compile P3DFFT in single precision */
/* #undef SINGLE_PREC */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you want to enable stride-1 data structures */
#define STRIDE1 1
/* Define if you want to MPI_Alltoall instead of MPI_Alltotallv */
/* #undef USE_EVEN */
/* Version number of package */
#define VERSION "2.6"
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
|
/*
* UFTP - UDP based FTP with multicast
*
* Copyright (C) 2001-2013 Dennis A. Bush, Jr. bush@tcnj.edu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional permission under GNU GPL version 3 section 7
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, the copyright holder
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef _PROXY_CONFIG_H
#define _PROXY_CONFIG_H
#define DEF_HB_INT 20
#define DEF_PORT "1044"
#define DEF_PUB_MULTI "230.4.4.1"
#define DEF_RCVBUF 262144
#define DEF_BSD_RCVBUF 233016
#define DEF_TTL 1
#define DEF_DSCP 0
#ifdef WINDOWS
#define DEF_LOGFILE "C:\\uftpproxyd_log.txt"
#elif defined VMS
#define DEF_LOGFILE "SYS$SCRATCH:uftpproxyd_log.txt"
#else
#define DEF_LOGFILE "/tmp/uftpproxyd.log"
#endif
#define USAGE \
"uftpproxyd { -s { dest | fp=fingerprint } | -c | -r } [ -d ] [ -p port ]\n\
[ -t ttl ] [ -Q dscp ] [ -N priority ] [ -O out_multi_interface ]\n\
[ -U UID ] [ -q dest_port ] [ -m ] [ -x log_level ]\n\
[ -H hb_server[:port][,hb_server[:port]...] ] [ -h hb_interval ]\n\
[ -g max_log_size ] [ -n max_log_count ]\n\
[ -B udp_buf_size ] [ -L logfile ] [ -P pidfile ] [ -C clientlist_file ]\n\
[ -S serverlist_file ] [ -e ecdh_curve ] [ -k keyfile[,keyfile...] ]\n\
[ -K rsa:key_length | ec:curve[,rsa:key_length | ec:curve...]]\n\
[ -I interface[,interface...] ] [ -M pub_mcast_addr[,pub_mcast_addr...] ]\n"
void process_args(int argc, char *argv[]);
#endif // _PROXY_CONFIG_H
|
/*
* pgeNet.h: Header for net/wifi
*
* This file is part of "Phoenix Game Engine".
*
* Copyright (C) 2008 Phoenix Game Engine
* Copyright (C) 2008 InsertWittyName <tias_dp@hotmail.com>
* Copyright (C) 2008 MK2k <pge@mk2k.net>
*
* Phoenix Game Engine 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.
* Phoenix Game Engine 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 Phoenix Game Engine. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __PGENET_H__
#define __PGENET_H__
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup pgeNet Net/Wifi Library
* @{
*/
#include <psptypes.h>
#include <psputility.h>
#include <netinet/in.h>
#ifdef __PSP__
#include <sys/fd_set.h>
#endif
#define PGE_SOCKET_TCP SOCK_STREAM /**< Stream socket */
#define PGE_SOCKET_UDP SOCK_DGRAM /**< Datagram socket */
#define PGE_LOCAL_IP 0 /**< Local IP ie. 192.168.x.x */
#define PGE_REAL_IP 1 /**< 'Real' IP */
#define PGE_MAX_CLIENTS 256 /**< Maximum clients that can connect to a server */
typedef int pgeSocket;
typedef fd_set pgeSocketSet;
/**
* Initialise the wifi
*
* @returns 1 on success else an error code.
*/
int pgeNetInit(void);
/**
* Shutdown the wifi
*
* @returns 1 on success else an error code.
*/
int pgeNetShutdown(void);
/**
* Download a file
*
* @param url - The URL of the file
*
* @param filepath - The path to save the downloaded file
*
* @returns 1 on success else an error code.
*/
int pgeNetGetFile(const char *url, const char *filepath);
/**
* Post a form
*
* @param url - The URL to post to
*
* @param data - The data to post
*
* @param response - The buffer where the response from the server will be stored
*
* @param responsesize - Size of the response buffer
*
* @returns 1 on success else an error code.
*/
int pgeNetPostForm(const char *url, char *data, char *response, unsigned int responsesize);
/**
* Get the status of the wlan switch
*
* @returns 1 if switch is up
*/
int pgeNetSwitchStatus(void);
/**
* Disconnect from an access point
*/
void pgeNetDisconnect(void);
/**
* Check if connected to an access point
*
* @returns 1 on valid connection
*/
int pgeNetIsConnected(void);
/**
* Get Local IP address
*
* @param buffer - Pointer to a buffer which will store the IP address
*
* @returns 1 on success else an error code.
*/
int pgeNetGetLocalIp(char *buffer);
/**
* Resolve a hostname
*
* @param hostname - The hostname to resolve
*
* @param resolved - Pointer to a buffer that will store the resolved hostname
*
* @returns 1 on success else an error code.
*/
int pgeNetResolveHost(char *hostname, char *resolved);
/**
* Create a socket
*
* @returns A ::pgeSocket.
*/
pgeSocket pgeNetSocketCreate(void);
/**
* Accept a connection
*
* @param socket - The socket.
*
* @returns A ::pgeSocket for the incoming connection.
*/
pgeSocket pgeNetSocketAccept(pgeSocket socket);
/**
* Bind a socket to a port
*
* @param socket - The socket.
*
* @param port - The port to bind to.
*
* @returns 1 on success, 0 on error.
*/
int pgeNetSocketBind(pgeSocket socket, unsigned short port);
/**
* Listen for connections
*
* @param socket - The socket.
*
* @param maxconn - The maximum amount of connections to listen for.
*
* @returns 1 on success, 0 on error.
*/
int pgeNetSocketListen(pgeSocket socket, unsigned int maxconn);
/**
* Connect to an IP and port
*
* @param socket - The socket.
*
* @param ip - The IP to connect to.
*
* @param port - The port to connect to.
*
* @returns 1 on success, 0 on error.
*/
int pgeNetSocketConnect(pgeSocket socket, char *ip, unsigned short port);
/**
* Send data
*
* @param socket - The socket.
*
* @param data - The data to send.
*
* @param length - The size of the data (in bytes).
*
* @returns Number of bytes sent, -1 on error.
*/
int pgeNetSocketSend(pgeSocket socket, const void *data, int length);
/**
* Receive data
*
* @param socket - The socket.
*
* @param data - Pointer to a buffer where the received data will be stored.
*
* @param length - The size of the buffer (in bytes).
*
* @returns Number of bytes received, -1 on error.
*/
int pgeNetSocketReceive(pgeSocket socket, void *data, int length);
/**
* Close a socket
*
* @param socket - The socket.
*/
void pgeNetSocketClose(pgeSocket socket);
/**
* Clear a socket set
*
* @param set - The socket set to clear.
*/
void pgeNetSocketSetClear(pgeSocketSet *set);
/**
* Add a socket to a socket set
*
* @param socket - The socket to add.
*
* @param set - The socket set to add the socket to.
*/
void pgeNetSocketSetAdd(pgeSocket socket, pgeSocketSet *set);
/**
* Remove a socket from a socket set
*
* @param socket - The socket to remove.
*
* @param set - The socket set to remove the socket from.
*/
void pgeNetSocketSetRemove(pgeSocket socket, pgeSocketSet *set);
/**
* Check if a socket is a member of a socket set
*
* @param socket - The socket to check.
*
* @param set - The socket set to check the socket is a member of.
*
* @returns 1 if the socket is a member of the set, otherwise 0.
*/
int pgeNetSocketSetIsMember(pgeSocket socket, pgeSocketSet *set);
/**
* Check if a socket is ready for reading
*
* @param maxsockets - Maximum number of sockets to check.
*
* @param set - The socket set to check.
*
* @returns Number of sockets, -1 on error.
*/
int pgeNetSocketSetSelect(unsigned int maxsockets, pgeSocketSet *set);
/** @} */
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __PGENET_H__
|
/* mpz_si_kronecker -- long+mpz Kronecker/Jacobi symbol.
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP 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.
The GNU MP 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 the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "mpir.h"
#include "gmp-impl.h"
#include "longlong.h"
int
mpz_si_kronecker (long a, mpz_srcptr b)
{
mp_srcptr b_ptr;
mp_limb_t b_low;
mp_size_t b_size;
mp_size_t b_abs_size;
mp_limb_t a_limb, b_rem;
unsigned twos;
int result_bit1;
#if GMP_NUMB_BITS < BITS_PER_ULONG
if (a > GMP_NUMB_MAX || a < -GMP_NUMB_MAX)
{
mp_limb_t alimbs[2];
mpz_t az;
ALLOC(az) = numberof (alimbs);
PTR(az) = alimbs;
mpz_set_si (az, a);
return mpz_kronecker (az, b);
}
#endif
b_size = SIZ (b);
if (b_size == 0)
return JACOBI_S0 (a); /* (a/0) */
/* account for the effect of the sign of b, then ignore it */
result_bit1 = JACOBI_BSGN_SS_BIT1 (a, b_size);
b_ptr = PTR(b);
b_low = b_ptr[0];
b_abs_size = ABS (b_size);
if ((b_low & 1) != 0)
{
/* b odd */
result_bit1 ^= JACOBI_ASGN_SU_BIT1 (a, b_low);
a_limb = (unsigned long) ABS(a);
if ((a_limb & 1) == 0)
{
/* (0/b)=1 for b=+/-1, 0 otherwise */
if (a_limb == 0)
return (b_abs_size == 1 && b_low == 1);
/* a even, b odd */
count_trailing_zeros (twos, a_limb);
a_limb >>= twos;
/* (a*2^n/b) = (a/b) * twos(n,a) */
result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, b_low);
}
}
else
{
/* (even/even)=0, and (0/b)=0 for b!=+/-1 */
if ((a & 1) == 0)
return 0;
/* a odd, b even
Establish shifted b_low with valid bit1 for ASGN and RECIP below.
Zero limbs stripped are acounted for, but zero bits on b_low are
not because they remain in {b_ptr,b_abs_size} for the
JACOBI_MOD_OR_MODEXACT_1_ODD. */
JACOBI_STRIP_LOW_ZEROS (result_bit1, a, b_ptr, b_abs_size, b_low);
if ((b_low & 1) == 0)
{
if (UNLIKELY (b_low == GMP_NUMB_HIGHBIT))
{
/* need b_ptr[1] to get bit1 in b_low */
if (b_abs_size == 1)
{
/* (a/0x80000000) = (a/2)^(BPML-1) */
if ((GMP_NUMB_BITS % 2) == 0)
result_bit1 ^= JACOBI_TWO_U_BIT1 (a);
return JACOBI_BIT1_TO_PN (result_bit1);
}
/* b_abs_size > 1 */
b_low = b_ptr[1] << 1;
}
else
{
count_trailing_zeros (twos, b_low);
b_low >>= twos;
}
}
result_bit1 ^= JACOBI_ASGN_SU_BIT1 (a, b_low);
a_limb = (unsigned long) ABS(a);
}
if (a_limb == 1)
return JACOBI_BIT1_TO_PN (result_bit1); /* (1/b)=1 */
/* (a/b*2^n) = (b*2^n mod a / a) * recip(a,b) */
JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, b_rem, b_ptr, b_abs_size, a_limb);
result_bit1 ^= JACOBI_RECIP_UU_BIT1 (a_limb, b_low);
return mpn_jacobi_base (b_rem, a_limb, result_bit1);
}
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#pragma once
#ifdef __cplusplus
#include <vector>
#endif
#include "../common.h"
#include "../object.h"
#ifdef __cplusplus
interface IObjectRepository;
class Object;
struct ObjectRepositoryItem;
interface IObjectManager
{
virtual ~IObjectManager() { }
virtual Object * GetLoadedObject(size_t index) abstract;
virtual Object * GetLoadedObject(const rct_object_entry * entry) abstract;
virtual uint8 GetLoadedObjectEntryIndex(const Object * object) abstract;
virtual std::vector<rct_object_entry> GetInvalidObjects(const rct_object_entry * entries) abstract;
virtual Object * LoadObject(const rct_object_entry * entry) abstract;
virtual bool LoadObjects(const rct_object_entry * entries, size_t count) abstract;
virtual void UnloadObjects(const rct_object_entry * entries, size_t count) abstract;
virtual void UnloadAll() abstract;
virtual void ResetObjects() abstract;
virtual std::vector<const ObjectRepositoryItem *> GetPackableObjects() abstract;
};
IObjectManager * CreateObjectManager(IObjectRepository * objectRepository);
IObjectManager * GetObjectManager();
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void * object_manager_get_loaded_object_by_index(size_t index);
void * object_manager_get_loaded_object(const rct_object_entry * entry);
uint8 object_manager_get_loaded_object_entry_index(const void * loadedObject);
void * object_manager_load_object(const rct_object_entry * entry);
void object_manager_unload_objects(const rct_object_entry * entries, size_t count);
void object_manager_unload_all_objects();
rct_string_id object_manager_get_source_game_string(const rct_object_entry * entry);
#ifdef __cplusplus
}
#endif
|
//
// MediaViewerController.h
// PiChat
//
// Created by pi on 16/2/15.
// Copyright © 2016年 pi. All rights reserved.
//
#import <UIKit/UIKit.h>
@class CLLocation;
/**
* 媒体浏览,图片,视频,位置等.
*/
@interface MediaViewerController : NSObject
+(void)showIn:(UIViewController*)controller withImage:(UIImage*)img ;
+(void)showIn:(UIViewController *)controller withImageUrl:(NSURL*)imgUrl;
+(void)showIn:(UIViewController*)controller withVideoUrl:(NSURL*)url;
+(void)showIn:(UIViewController *)controller withLocation:(CLLocation *)location;
@end
|
#ifndef R2_REG_H
#define R2_REG_H
#include <r_types.h>
#include <r_util.h>
#include <list.h>
R_LIB_VERSION_HEADER(r_reg);
enum {
R_REG_TYPE_GPR,
R_REG_TYPE_DRX,
R_REG_TYPE_FPU,
R_REG_TYPE_MMX,
R_REG_TYPE_XMM,
R_REG_TYPE_FLG,
R_REG_TYPE_SEG,
R_REG_TYPE_LAST,
R_REG_TYPE_ALL = -1,
};
enum {
R_REG_NAME_PC, // program counter
R_REG_NAME_SP, // stack pointer
R_REG_NAME_SR, // status register
R_REG_NAME_BP, // base pointer
/* args */
R_REG_NAME_A0, // arguments
R_REG_NAME_A1,
R_REG_NAME_A2,
R_REG_NAME_A3,
/* flags */
R_REG_NAME_ZF,
R_REG_NAME_SF,
R_REG_NAME_CF,
R_REG_NAME_OF,
/* syscall number (orig_eax,rax,r0,x0) */
R_REG_NAME_SN,
R_REG_NAME_LAST,
};
// TODO: use enum here?
#define R_REG_COND_EQ 0
#define R_REG_COND_NE 1
#define R_REG_COND_CF 2
#define R_REG_COND_CARRY 2
#define R_REG_COND_NEG 3
#define R_REG_COND_NEGATIVE 3
#define R_REG_COND_OF 4
#define R_REG_COND_OVERFLOW 4
// unsigned
#define R_REG_COND_HI 5
#define R_REG_COND_HE 6
#define R_REG_COND_LO 7
#define R_REG_COND_LOE 8
// signed
#define R_REG_COND_GE 9
#define R_REG_COND_GT 10
#define R_REG_COND_LT 11
#define R_REG_COND_LE 12
#define R_REG_COND_LAST 13
typedef struct r_reg_item_t {
char *name;
int type;
int size; /* 8,16,32,64 ... 128/256 ??? */
int offset; // offset in data structure
int packed_size; /* 0 means no packed register, 1byte pack, 2b pack... */
char *flags;
} RRegItem;
typedef struct r_reg_arena_t {
ut8 *bytes;
int size;
} RRegArena;
typedef struct r_reg_set_t {
RRegArena *arena;
RList *pool; /* RRegArena */
RList *regs; /* RRegItem */
} RRegSet;
typedef struct r_reg_t {
char *profile;
char *reg_profile_str;
char *name[R_REG_NAME_LAST];
RRegSet regset[R_REG_TYPE_LAST];
int iters;
int bits;
int size;
int big_endian;
} RReg;
typedef struct r_reg_flags_t {
int s; // sign, negative number (msb)
int z; // zero
int a; // half-carry adjust (if carry happens at nibble level)
int c; // carry
int o; // overflow
int p; // parity (lsb)
} RRegFlags;
#ifdef R_API
R_API void r_reg_free(RReg *reg);
R_API RReg *r_reg_new(void);
R_API int r_reg_set_name(RReg *reg, int role, const char *name);
R_API int r_reg_set_profile_string(RReg *reg, const char *profile);
R_API int r_reg_set_profile(RReg *reg, const char *profile);
R_API RRegSet *r_reg_regset_get(RReg *r, int type);
R_API ut64 r_reg_getv(RReg *reg, const char *name);
R_API ut64 r_reg_setv(RReg *reg, const char *name, ut64 val);
R_API const char *r_reg_get_type(int idx);
R_API const char *r_reg_get_name(RReg *reg, int kind);
R_API RRegItem *r_reg_get(RReg *reg, const char *name, int type);
R_API RList *r_reg_get_list(RReg *reg, int type);
R_API RRegItem *r_reg_get_at (RReg *reg, int type, int regsize, int delta);
R_API RRegItem *r_reg_next_diff(RReg *reg, int type, const ut8* buf, int buflen, RRegItem *prev_ri, int regsize);
/* XXX: dupped ?? */
R_API int r_reg_type_by_name(const char *str);
R_API int r_reg_get_name_idx(const char *type);
R_API RRegItem* r_reg_cond_get (RReg *reg, const char *name);
R_API int r_reg_cond_get_value (RReg *r, const char *name);
R_API int r_reg_cond_bits (RReg *r, int type, RRegFlags *f);
R_API RRegFlags *r_reg_cond_retrieve (RReg *r, RRegFlags *);
R_API int r_reg_cond (RReg *r, int type);
/* value */
R_API ut64 r_reg_get_value(RReg *reg, RRegItem *item);
R_API int r_reg_set_value(RReg *reg, RRegItem *item, ut64 value);
R_API float r_reg_get_fvalue(RReg *reg, RRegItem *item);
R_API int r_reg_set_fvalue(RReg *reg, RRegItem *item, float value);
R_API ut64 r_reg_get_pvalue(RReg *reg, RRegItem *item, int packidx);
R_API char *r_reg_get_bvalue(RReg *reg, RRegItem *item);
R_API ut64 r_reg_set_bvalue(RReg *reg, RRegItem *item, const char *str);
R_API int r_reg_set_pvalue(RReg *reg, RRegItem *item, ut64 value, int packidx);
/* byte arena */
R_API ut8* r_reg_get_bytes(RReg *reg, int type, int *size);
R_API int r_reg_set_bytes(RReg *reg, int type, const ut8* buf, const int len);
R_API RRegArena *r_reg_arena_new (int size);
R_API void r_reg_arena_free(RRegArena* ra);
R_API int r_reg_fit_arena(RReg *reg);
R_API int r_reg_arena_set(RReg *reg, int n, int copy);
R_API void r_reg_arena_swap(RReg *reg, int copy);
R_API int r_reg_arena_push(RReg *reg);
R_API void r_reg_arena_pop(RReg *reg);
R_API void r_reg_arena_zero(RReg *reg);
R_API ut64 r_reg_cmp(RReg *reg, RRegItem *item);
R_API const char *r_reg_cond_to_string (int n);
R_API int r_reg_cond_from_string(const char *str);
#endif
#endif
|
// ---------------------------------------------------------------------
// pkt.h -- 1200/300/2400 baud AX.25
//
//
// This file is a proposed part of fldigi. Adapted very liberally from
// rtty.h, with many thanks to John Hansen, W2FS, who wrote
// 'dcc.doc' and 'dcc2.doc', GNU Octave, GNU Radio Companion, and finally
// Bartek Kania (bk.gnarf.org) whose 'aprs.c' expository coding style helped
// shape this implementation.
//
// Copyright (C) 2010
// Dave Freese, W1HKJ
// Chris Sylvain, KB3CS
//
// fldigi 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.
//
// fldigi 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 fldigi; if not, write to the Free Software
// Foundation, Inc.
// 59 Temple Place
// Suite 330
// Boston, MA 02111-1307 USA
// ---------------------------------------------------------------------
#ifndef PKT_H
#define PKT_H
#include "complex.h"
#include "modem.h"
#include "globals.h"
#include "debug.h"
//#include "filters.h"
//#include "fftfilt.h"
#include "digiscope.h"
#include "waterfall.h"
#include "trx.h"
#include "nco.h"
#define PKT_SampleRate 12000
#define PKT_MinBaudRate 300
#define PKT_MaxSymbolLen (PKT_SampleRate / PKT_MinBaudRate)
#define PKT_DetectLen 16
#define PKT_SyncDispLen 24
#define PKT_IdleLen 120
#define PKT_MinSignalPwr 0.1
// is adjval too small? maybe 0.25 ? too large?
#define PKT_PLLAdjVal 0.1
// special and unique start+end of AX.25 frame symbol
#define PKT_Flag 0x7e
// number of mark bits prior to start of frame at 1200 baud
#define PKT_MarkBits 320
// number of flags used indicate start or end of frame at 1200 baud
#define PKT_StartFlags 24
#define PKT_EndFlags 12
// 70 bytes addr + 256 payload + 2 FCS + 1 Control + 1 Protocol ID
#define MAXOCTETS 340
// 136 bits minimum (including start and end flags) - AX.25 v2.2 section 3.9
// == 15 octets. we count only one of the two flags, though.
#define MINOCTETS 14
enum PKT_RX_STATE {
PKT_RX_STATE_IDLE = 0,
PKT_RX_STATE_DROP,
PKT_RX_STATE_START,
PKT_RX_STATE_DATA,
PKT_RX_STATE_STOP
};
enum PKT_MicE_field {
Null = 0x00,
Space = 0x20,
Zero = 0x30,
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
P0 = 0x40,
P100,
North = 0x50,
East,
South,
West,
Invalid = 0xFF
};
struct PKT_PHG_table {
const char *s;
unsigned char l;
};
class pkt : public modem {
public:
static const double CENTER[];
static const double SHIFT[];
static const int BAUD[];
static const int BITS[];
private:
int symbollen;
int pkt_stoplen, pkt_detectlen;
int pkt_syncdisplen, pkt_idlelen;
int pkt_startlen;
double pkt_shift;
int pkt_baud;
int pkt_nbits;
double pkt_ctrfreq;
double pkt_squelch;
double pkt_BW;
bool pkt_reverse;
int scounter; // audio sample counter
double lo_signal_gain, hi_signal_gain;
NCO *nco_lo, *nco_hi, *nco_mid;
PKT_RX_STATE rxstate;
double idle_signal_pwr, *idle_signal_buf;
int idle_signal_buf_ptr;
void idle_signal_power(double sample);
cmplx lo_signal_energy, *lo_signal_buf;
cmplx hi_signal_energy, *hi_signal_buf;
cmplx mid_signal_energy, *mid_signal_buf;
double lo_signal_corr, hi_signal_corr, mid_signal_corr;
int correlate_buf_ptr;
double signal_gain, signal_pwr, *signal_buf;
int signal_buf_ptr;
double *pipe, *dsppipe; // SyncScope
int pipeptr;
// SCBLOCKSIZE * 2 = 1024 ( == MAX_ZLEN )
cmplx QI[MAX_ZLEN]; // PhaseScope
int QIptr;
double yt_avg;
bool clear_zdata;
double signal_power, noise_power, power_ratio, snr_avg;
double corr_power(cmplx v);
void correlate(double sample);
int detect_drop;
void detect_signal();
double lo_sync, hi_sync, mid_symbol;
int lo_sync_ptr, hi_sync_ptr;
bool prev_symbol, pll_symbol;
void do_sync();
int seq_ones; // number of sequential ones in data
int select_val;
void set_pkt_modem_params(int i);
void rx_data();
void rx(bool bit);
void Metric();
unsigned char bitreverse(unsigned char in, int n);
unsigned char rxbuf[MAXOCTETS+4], *cbuf;
unsigned int computeFCS(unsigned char *h, unsigned char *t);
bool checkFCS(unsigned char *cp);
void do_put_rx_char(unsigned char *cp);
void clear_syncscope();
void update_syncscope();
// inline cmplx mixer(cmplx in);
// MicE encodings:
// 3 char groups,
// max 12 char values per group,
// 5 encodings per char value
static PKT_MicE_field MicE_table[][12][5];
void expand_MicE(unsigned char *I, unsigned char *E);
static PKT_PHG_table PHG_table[];
void expand_PHG(unsigned char *I);
void expand_Cmp(unsigned char *I);
// transmit
int preamble, pretone, postamble;
double lo_txgain, hi_txgain;
NCO *lo_tone, *hi_tone;
void send_symbol(bool bit);
int tx_char_count, nr_ones;
bool currbit, nostuff, did_pkt_head;
void send_char(unsigned char c);
unsigned char txbuf[MAXOCTETS+4], *tx_cbuf;
void send_msg(unsigned char c);
public:
pkt(trx_mode mode);
~pkt();
void init();
void rx_init();
void tx_init(SoundBase *sc);
void restart();
int rx_process(const double *buf, int len);
int tx_process();
void set_freq(double);
};
#endif
|
#ifndef _TOWERENGINE_VRDEMO_VRPLAYER_H
#define _TOWERENGINE_VRDEMO_VRPLAYER_H
#include <towerengine.h>
class VRPlayer
{
private:
tVector origin;
tVector base_position;
tVector direction;
float height;
bool teleport;
tVector teleport_dst;
public:
VRPlayer(tVector origin);
~VRPlayer();
tVector GetOrigin() const { return origin; }
tVector GetBasePosition() const { return base_position; }
void UpdatePosition(tVector headet_position, tVector headset_dir);
void Teleport(tVector target_pos);
void Update();
};
#endif
|
// Copyright (c) 2005 - 2017 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Return To The Roots is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef iwENDGAME_H_INCLUDED
#define iwENDGAME_H_INCLUDED
#pragma once
#include "IngameWindow.h"
class iwEndgame : public IngameWindow
{
public:
iwEndgame();
private:
void Msg_ButtonClick(unsigned ctrl_id) override;
};
#endif // !iwENDGAME_H_INCLUDED
|
#ifndef SFACTOR3HEDPX_H_
#define SFACTOR3HEDPX_H_
#include <function/ArrayFunction.h>
namespace jags {
namespace nuclear {
/**
* @short Astrophysical S Factors; assumes B_c = Sc(E0), i.e., the
* level shift is zero at the energy eigenvalue E0;
*
* sfactor3Hedpx returns the astrophysical S-factor as a function of energy.
* <pre>
* obsy1 = sfactor3Hedpx(obsx1, e0, ga, gb, ra, rb, ue)
* </pre>
*/
class sfactor3Hedpx : public ArrayFunction {
public:
sfactor3Hedpx();
void evaluate(double *x, std::vector<double const *> const &args,
std::vector<std::vector<unsigned int> > const &dims) const;
void coul(int, double, double, double&, double&) const;
void PenFactor(const double E, const double L, const double R,
const double mue, const double qQ, double& P, double& S) const;
bool checkParameterDim(std::vector<std::vector<unsigned int> > const &dims)
const;
std::vector<unsigned int> dim(std::vector<std::vector<unsigned int> >
const &dims,
std::vector<double const *> const &values) const;
bool checkParameterValue(std::vector<double const *> const &args,
std::vector<std::vector<unsigned int> > const &dims) const;
};
}}//end namespaces
#endif /* SFACTOR3HEDPX_H_ */
|
/* code for the "obj4" pd class. This adds a creation argument, of
type "float". */
#include "m_pd.h"
typedef struct obj4
{
t_object x_ob;
t_outlet *x_outlet;
float x_value;
} t_obj4;
void obj4_float(t_obj4 *x, t_floatarg f)
{
outlet_float(x->x_outlet, x->x_value + f);
}
void obj4_ft1(t_obj4 *x, t_floatarg g)
{
x->x_value = g;
}
t_class *obj4_class;
/* as requested by the new invocation of "class_new" below, the new
routine will be called with a "float" argument. */
void *obj4_new(t_floatarg f)
{
t_obj4 *x = (t_obj4 *)pd_new(obj4_class);
inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("float"), gensym("ft1"));
x->x_outlet = outlet_new(&x->x_ob, gensym("float"));
/* just stick the argument in the object structure for later. */
x->x_value = f;
return (void *)x;
}
void obj4_setup(void)
{
/* here we add "A_DEFFLOAT" to the (zero-terminated) list of arg
types we declare for a new object. The value will be filled
in as 0 if not given in the object box. */
obj4_class = class_new(gensym("obj4"), (t_newmethod)obj4_new,
0, sizeof(t_obj4), 0, A_DEFFLOAT, 0);
class_addmethod(obj4_class, (t_method)obj4_ft1, gensym("ft1"), A_FLOAT, 0);
class_addfloat(obj4_class, obj4_float);
}
|
#ifndef _ENGINES_H_
#define _ENGINES_H_
#include <gtk/gtk.h>
#include <glib.h>
//typedef void (*ActionInvokedCb)(GtkWindow *nw, const char *key);
typedef void (*UrlClickedCb)(GtkWindow *nw, const char *url);
GtkWindow *create_notification(UrlClickedCb url_clicked_cb);
void destroy_notification(GtkWindow *nw);
void show_notification(GtkWindow *nw);
void hide_notification(GtkWindow *nw);
void set_notification_hints(GtkWindow *nw, GHashTable *hints);
void set_notification_timeout(GtkWindow *nw, glong timeout);
void notification_tick(GtkWindow *nw, glong remaining);
void set_notification_text(GtkWindow *nw, const char *summary,
const char *body);
void set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf);
void set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y);
void add_notification_action(GtkWindow *nw, const char *label,
const char *key, GCallback cb);
void clear_notification_actions(GtkWindow *nw);
void move_notification(GtkWidget *nw, int x, int y);
#endif /* _ENGINES_H_ */
|
/**
* Copyright (C) 2007-2012 Hypertable, Inc.
*
* This file is part of Hypertable.
*
* Hypertable 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.
*
* Hypertable 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 HYPERTABLE_LOAD_GENERATOR_CLIENT
#define HYPERTABLE_LOAD_GENERATOR_CLIENT
#include "Common/Compat.h"
#include "Common/ReferenceCount.h"
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
extern "C" {
#include <poll.h>
#include <stdio.h>
#include <time.h>
}
#include <boost/algorithm/string.hpp>
#include <boost/shared_array.hpp>
#include "Common/String.h"
#include "Hypertable/Lib/Client.h"
#include "Hypertable/Lib/Config.h"
#ifdef HT_WITH_THRIFT
#include "ThriftBroker/Client.h"
#include "ThriftBroker/Config.h"
#include "ThriftBroker/ThriftHelper.h"
#endif
using namespace Hypertable;
using namespace Hypertable::Config;
using namespace std;
using namespace boost;
class LoadClient : public ReferenceCount {
public:
LoadClient(const String &config_file, bool thrift=false);
LoadClient(bool thrift=false);
~LoadClient();
void create_mutator(const String &tablename, int mutator_flags,
::uint64_t shared_mutator_flush_interval);
/**
* Create a scanner.
* For thrift scanners, just use the 1st column and 1st row_interval specified in the
* ScanSpec.
*/
void create_scanner(const String &tablename, const ScanSpec& scan_spec);
void set_cells(const Cells &cells);
void set_delete(const KeySpec &key);
void flush();
void close_scanner();
/**
* Get all cells that match the spec in the current scanner
* return the total number of bytes scanned
*/
uint64_t get_all_cells();
private:
bool m_thrift;
ClientPtr m_native_client;
NamespacePtr m_ns;
TablePtr m_native_table;
bool m_native_table_open;
TableMutatorPtr m_native_mutator;
TableScannerPtr m_native_scanner;
#ifdef HT_WITH_THRIFT
boost::shared_ptr<Thrift::Client> m_thrift_client;
ThriftGen::Namespace m_thrift_namespace;
ThriftGen::Mutator m_thrift_mutator;
ThriftGen::Scanner m_thrift_scanner;
#endif
};
typedef intrusive_ptr<LoadClient> LoadClientPtr;
#endif // LoadClient
|
/* Articulation_enums.h
*
* Copyright (C) 1992-2009,2015 Paul Boersma
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
enums_begin (kArt_muscle, 0)
enums_add (kArt_muscle, 0, _, U"_")
enums_add (kArt_muscle, 1, LUNGS, U"Lungs")
enums_add (kArt_muscle, 2, INTERARYTENOID, U"Interarytenoid") // constriction of larynx; 0 = breathing, 1 = constricted glottis
enums_add (kArt_muscle, 3, CRICOTHYROID, U"Cricothyroid") // vocal-cord tension
enums_add (kArt_muscle, 4, VOCALIS, U"Vocalis") // vocal-cord tension
enums_add (kArt_muscle, 5, THYROARYTENOID, U"Thyroarytenoid")
enums_add (kArt_muscle, 6, POSTERIOR_CRICOARYTENOID, U"PosteriorCricoarytenoid") // opening of glottis
enums_add (kArt_muscle, 7, LATERAL_CRICOARYTENOID, U"LateralCricoarytenoid") // opening of glottis
enums_add (kArt_muscle, 8, STYLOHYOID, U"Stylohyoid") // up movement of hyoid bone
enums_add (kArt_muscle, 9, STERNOHYOID, U"Sternohyoid") // down movement of hyoid bone
enums_add (kArt_muscle, 10, THYROPHARYNGEUS, U"Thyropharyngeus") // constriction of ventricular folds
enums_add (kArt_muscle, 11, LOWER_CONSTRICTOR, U"LowerConstrictor")
enums_add (kArt_muscle, 12, MIDDLE_CONSTRICTOR, U"MiddleConstrictor")
enums_add (kArt_muscle, 13, UPPER_CONSTRICTOR, U"UpperConstrictor")
enums_add (kArt_muscle, 14, SPHINCTER, U"Sphincter") // constriction of pharynx
enums_add (kArt_muscle, 15, HYOGLOSSUS, U"Hyoglossus") // down movement of tongue body
enums_add (kArt_muscle, 16, STYLOGLOSSUS, U"Styloglossus") // up movement of tongue body
enums_add (kArt_muscle, 17, GENIOGLOSSUS, U"Genioglossus") // forward movement of tongue body
enums_add (kArt_muscle, 18, UPPER_TONGUE, U"UpperTongue") // up curling of the tongue tip
enums_add (kArt_muscle, 19, LOWER_TONGUE, U"LowerTongue") // down curling of the tongue
enums_add (kArt_muscle, 20, TRANSVERSE_TONGUE, U"TransverseTongue") // thickening of tongue
enums_add (kArt_muscle, 21, VERTICAL_TONGUE, U"VerticalTongue") // thinning of tongue
enums_add (kArt_muscle, 22, RISORIUS, U"Risorius") // spreading of lips
enums_add (kArt_muscle, 23, ORBICULARIS_ORIS, U"OrbicularisOris") // rounding of lips
enums_add (kArt_muscle, 24, LEVATOR_PALATINI, U"LevatorPalatini") // closing of velo-pharyngeal port; 0 = open ("nasal"), 1 = closed ("oral")
enums_add (kArt_muscle, 25, TENSOR_PALATINI, U"TensorPalatini")
enums_add (kArt_muscle, 26, MASSETER, U"Masseter") // closing of jaw; 0 = open, 1 = closed
enums_add (kArt_muscle, 27, MYLOHYOID, U"Mylohyoid") // opening of jaw
enums_add (kArt_muscle, 28, LATERAL_PTERYGOID, U"LateralPterygoid") // horizontal jaw position
enums_add (kArt_muscle, 29, BUCCINATOR, U"Buccinator") // oral wall tension
enums_end (kArt_muscle, 29, LUNGS)
/* End of file Articulation.enums */
|
/*********************************************************************
CombLayer : MCNP(X) Input builder
* File: processInc/surfDIter.h
*
* Copyright (c) 2004-2015 by Stuart Ansell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************/
#ifndef surfDIter_h
#define surfDIter_h
class FuncDataBase;
namespace ModelSupport
{
void populateDivideLen(const FuncDataBase&,const size_t,
const std::string&,const double,
std::vector<double>&);
void populateDivide(const FuncDataBase&,const size_t,
const std::string&,std::vector<double>&);
void populateDivide(const FuncDataBase&,const size_t,
const std::string&,const double,std::vector<double>&);
void populateDivide(const FuncDataBase&,const size_t,
const std::string&,const int,std::vector<int>&);
void populateRange(const FuncDataBase&,const size_t,
const std::string&,const double,
const double,std::vector<double>&);
}
#endif
|
/****************************************************************************
**
** Copyright (C) 2017 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 "simulatorcontrol.h"
#include <utils/futuresynchronizer.h>
#include <QAbstractListModel>
namespace Ios {
namespace Internal {
using SimulatorInfoList = QList<SimulatorInfo>;
class SimulatorInfoModel : public QAbstractItemModel
{
Q_OBJECT
public:
SimulatorInfoModel(QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &) const override;
private:
void requestSimulatorInfo();
void populateSimulators(const SimulatorInfoList &simulatorList);
private:
Utils::FutureSynchronizer m_fetchFuture;
SimulatorInfoList m_simList;
};
} // namespace Internal
} // namespace Ios
|
#define CKPT (5)
#define RECOVER (6)
#define CKPT_RECOVER (7)
int RTI_init();
void RTI_stub (int action, double lvt);
int RTI_prune(double lvt);
void RTI_print_data();
|
#include "mpfr_mul_d.h"
static mpfr_t y;
static int initialized = 0;
int mpfr_mul_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_mul(z, x, y, r);
}
int mpfr_div_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_div(z, x, y, r);
}
int mpfr_d_div(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_div(z, y, x, r);
}
int mpfr_add_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_add(z, x, y, r);
}
int mpfr_sub_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_sub(z, x, y, r);
}
int mpfr_d_sub(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
{
if (!initialized) {
mpfr_init2(y, 53);
initialized = 1;
}
mpfr_set_d(y, a, GMP_RNDN);
return mpfr_sub(z, y, x, r);
}
void mpfr_mul_d_clear()
{
if (initialized) {
initialized = 0;
mpfr_clear(y);
}
}
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#ifndef _PAINT_TILE_ELEMENT_H
#define _PAINT_TILE_ELEMENT_H
#include "../../common.h"
#include "../../world/Map.h"
struct paint_session;
enum edge_t
{
EDGE_NE = (1 << 0),
EDGE_SE = (1 << 1),
EDGE_SW = (1 << 2),
EDGE_NW = (1 << 3),
EDGE_BOTTOMLEFT = EDGE_SW,
EDGE_BOTTOMRIGHT = EDGE_SE,
EDGE_TOPLEFT = EDGE_NW,
EDGE_TOPRIGHT = EDGE_NE
};
enum
{
SEGMENT_B4 = (1 << 0), // 0
SEGMENT_CC = (1 << 1), // 6
SEGMENT_BC = (1 << 2), // 2
SEGMENT_D4 = (1 << 3), // 8
SEGMENT_C0 = (1 << 4), // 3
SEGMENT_D0 = (1 << 5), // 7
SEGMENT_B8 = (1 << 6), // 1
SEGMENT_C8 = (1 << 7), // 5
SEGMENT_C4 = (1 << 8), // 4
};
enum
{
TUNNEL_0 = 0,
TUNNEL_1 = 1,
TUNNEL_2 = 2,
TUNNEL_3 = 3,
TUNNEL_4 = 4,
TUNNEL_5 = 5,
TUNNEL_6 = 6,
TUNNEL_7 = 7,
TUNNEL_8 = 8,
TUNNEL_9 = 9,
TUNNEL_10 = 0x0A,
TUNNEL_11 = 0x0B,
TUNNEL_12 = 0x0C,
TUNNEL_13 = 0x0D,
TUNNEL_14 = 0x0E,
TUNNEL_15 = 0x0F,
};
enum
{
G141E9DB_FLAG_1 = 1,
G141E9DB_FLAG_2 = 2,
};
#ifdef __TESTPAINT__
extern uint16 testPaintVerticalTunnelHeight;
#endif
extern const sint32 SEGMENTS_ALL;
extern const uint16 segment_offsets[9];
extern bool gShowSupportSegmentHeights;
extern const LocationXY16 BannerBoundBoxes[][2];
extern const uint8 byte_98D800[4];
void paint_util_push_tunnel_left(paint_session * session, uint16 height, uint8 type);
void paint_util_push_tunnel_right(paint_session * session, uint16 height, uint8 type);
void paint_util_set_vertical_tunnel(paint_session * session, uint16 height);
void paint_util_set_general_support_height(paint_session * session, sint16 height, uint8 slope);
void paint_util_force_set_general_support_height(paint_session * session, sint16 height, uint8 slope);
void paint_util_set_segment_support_height(paint_session * session, sint32 segments, uint16 height, uint8 slope);
uint16 paint_util_rotate_segments(uint16 segments, uint8 rotation);
void tile_element_paint_setup(paint_session * session, sint32 x, sint32 y);
void entrance_paint(paint_session * session, uint8 direction, sint32 height, const rct_tile_element * tile_element);
void banner_paint(paint_session * session, uint8 direction, sint32 height, const rct_tile_element * tile_element);
void surface_paint(paint_session * session, uint8 direction, uint16 height, const rct_tile_element * tileElement);
void path_paint(paint_session * session, uint8 direction, uint16 height, const rct_tile_element * tileElement);
void scenery_paint(paint_session * session, uint8 direction, sint32 height, const rct_tile_element * tileElement);
void fence_paint(paint_session * session, uint8 direction, sint32 height, const rct_tile_element * tileElement);
void large_scenery_paint(paint_session * session, uint8 direction, uint16 height, const rct_tile_element * tileElement);
void track_paint(paint_session * session, uint8 direction, sint32 height, const rct_tile_element * tileElement);
#endif
|
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __ENUM_H__
#define __ENUM_H__
/**
* Axis indices as enumerated constants
*
* Special axis:
* - A_AXIS and B_AXIS are used by COREXY printers
* - X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship
* between X_AXIS and X Head movement, like CoreXY bots
*/
enum AxisEnum {
NO_AXIS = -1,
X_AXIS = 0,
A_AXIS = 0,
Y_AXIS = 1,
B_AXIS = 1,
Z_AXIS = 2,
C_AXIS = 2,
E_AXIS = 3,
X_HEAD = 4,
Y_HEAD = 5,
Z_HEAD = 6,
ALL_AXES = 100
};
#define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=S; VAR<=N; VAR++)
#define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=S; VAR<N; VAR++)
#define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N)
#define LOOP_L_N(VAR, N) LOOP_S_L_N(VAR, 0, N)
#define LOOP_NA(VAR) LOOP_L_N(VAR, NUM_AXIS)
#define LOOP_XYZ(VAR) LOOP_S_LE_N(VAR, X_AXIS, Z_AXIS)
#define LOOP_XYZE(VAR) LOOP_S_LE_N(VAR, X_AXIS, E_AXIS)
#define LOOP_XYZE_N(VAR) LOOP_S_L_N(VAR, X_AXIS, XYZE_N)
typedef enum {
LINEARUNIT_MM,
LINEARUNIT_INCH
} LinearUnit;
typedef enum {
TEMPUNIT_C,
TEMPUNIT_K,
TEMPUNIT_F
} TempUnit;
/**
* SD Card
*/
enum LsAction { LS_SerialPrint, LS_Count, LS_GetFilename };
/**
* Ultra LCD
*/
enum LCDViewAction {
LCDVIEW_NONE,
LCDVIEW_REDRAW_NOW,
LCDVIEW_CALL_REDRAW_NEXT,
LCDVIEW_CLEAR_CALL_REDRAW,
LCDVIEW_CALL_NO_REDRAW
};
#endif // __ENUM_H__
|
#include "common.c"
void
output_process(dwg_object *obj);
void
output_object(dwg_object* obj){
if (!obj)
{
printf("object is NULL\n");
return;
}
if (dwg_get_type(obj)== DWG_TYPE_MINSERT)
{
output_process(obj);
}
}
void
low_level_process(dwg_object *obj)
{
// casts dwg onject to minsert
dwg_ent_minsert *minsert = dwg_object_to_MINSERT(obj);
// prints inserion points
printf("minsert points : x = %f, y = %f, z = %f\t\n",
minsert->ins_pt.x, minsert->ins_pt.y, minsert->ins_pt.z);
// prints scale flag
printf("scale flag for minsert : %d\t\n", minsert->scale_flag);
// prints scale points
printf("scale points : x = %f, y = %f, z = %f\t\n",
minsert->scale.x, minsert->scale.y, minsert->scale.z);
// prints rotation angle
printf("angle for minsert : %f\t\n", minsert->rotation_ang);
// prints extrusion point
printf("extrusion points : x = %f, y = %f, z = %f\t\n",
minsert->extrusion.x, minsert->extrusion.y, minsert->extrusion.z);
// prints has_attributes
printf("attribs for minsert : %d\t\n", minsert->has_attribs);
// prints owned object counts
printf("object count for minsert : %ld\t\n", minsert->owned_obj_count);
// prints num rows
printf("number of rows for minsert : %ld\t\n", minsert->numrows);
// prints num cols
printf("number of columns for minsert : %ld\t\n", minsert->numcols);
// prints col space
printf("col space for minsert : %f\t\n", minsert->row_spacing);
// prints rows space
printf("row space for minsert : %f\t\n", minsert->col_spacing);
}
void
api_process(dwg_object *obj)
{
int ins_pt_error, ext_error, scale_error, ang_error, flag_error, attr_error,
count_error, num_col_error, num_row_error, colspace_error, rowspace_error;
dwg_point_3d ins_pt, ext, scale;
double rot_angle;
char scale_flag, attribs;
float col_space, row_space;
long obj_count, num_rows, num_cols;
dwg_ent_minsert *minsert = dwg_object_to_MINSERT(obj);
// returns insertion point
dwg_ent_minsert_get_ins_pt(minsert, &ins_pt, &ins_pt_error);
if(ins_pt_error == 0 ) // error check
{
printf("minsert points : x = %f, y = %f, z = %f\t\n",
ins_pt.x, ins_pt.y, ins_pt.z);
}
else
{
printf("error in reading minsertion point\n");
}
// returns scale flag
scale_flag = dwg_ent_minsert_get_scale_flag(minsert, &flag_error);
if(flag_error == 0) // error check
{
printf("scale flag for minsert : %d\t\n", scale_flag);
}
else
{
printf("error in reading scale flag\n");
}
// returns scale
dwg_ent_minsert_get_scale(minsert, &scale, &scale_error);
if(scale_error == 0) // error check
{
printf("scale points : x = %f, y = %f, z = %f\t\n",
scale.x, scale.y, scale.z);
}
else
{
printf("error in reading scale \n");
}
// returns rotation angle
rot_angle = dwg_ent_minsert_get_rotation_angle(minsert, &ang_error);
if(ang_error == 0) // error check
{
printf("angle for minsert : %f\t\n", rot_angle);
}
else
{
printf("error in reading rotation angle\n");
}
// returns extrusion
dwg_ent_minsert_get_extrusion(minsert, &ext, &ext_error);
if(ext_error == 0) // error check
{
printf("extrusion points : x = %f, y = %f, z = %f\t\n",
ext.x, ext.y, ext.z);
}
else
{
printf("error in reading extrusion \n");
}
// returns attribute
attribs = dwg_ent_minsert_get_has_attribs(minsert, &attr_error);
if(attr_error == 0) // error check
{
printf("attribs for minsert : %d\t\n", attribs);
}
else
{
printf("error in reading attribs\n");
}
// returns owned object counts
obj_count = dwg_ent_minsert_get_owned_obj_count(minsert, &count_error);
if(count_error == 0) // error check
{
printf("object count for minsert : %ld\t\n", obj_count);
}
else
{
printf("error in reading object counts\n");
}
// returns num rows
num_rows = dwg_ent_minsert_get_numrows(minsert, &num_row_error);
if(num_row_error == 0) // error checks
{
printf("number of rows for minsert : %ld\t\n", num_rows);
}
else
{
printf("error in reading number of rows\n");
}
// returns number of columns
num_cols = dwg_ent_minsert_get_numcols(minsert, &num_col_error);
if(num_col_error == 0) // error checking
{
printf("number of columns for minsert : %ld\t\n", num_cols);
}
else
{
printf("error in reading number of columns\n");
}
// returns row space
row_space= dwg_ent_minsert_get_row_spacing(minsert, &rowspace_error);
if(rowspace_error == 0) // error check
{
printf("row space for minsert : %f\t\n", row_space);
}
else
{
printf("error in reading numspace\n");
}
// returns col space
col_space = dwg_ent_minsert_get_col_spacing(minsert, &colspace_error);
if(colspace_error == 0) // error checking
{
printf("col space for minsert : %f\t\n", col_space);
}
else
{
printf("error in reading col_space\n");
}
}
|
//////////////////////////////////////////////////////////////////
//
// EUSTAGGER LITE
//
// Copyright (C) 1996-2013 IXA Taldea
// EHU-UPV
//
// This file is part of EUSTAGGER LITE.
//
// EUSTAGGER LITE is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// EUSTAGGER LITE is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with EUSTAGGER LITE. If not, see <http://www.gnu.org/licenses/>.
//
// Contact: Ixa Taldea (ixa@ehu.es)
// 649 Posta kutxa
// 20080 Donostia (Basque Country)
//
//////////////////////////////////////////////////////////////////
#include <string>
#include <vector>
#include "anabihurtzailea.h"
#ifdef _USE_FOMA_
#include "fomamorf.h"
#endif
#define ESTANDAR_AN 0
#define TAULAN 1
#define ESTANDAR_PIPE 2
using namespace std;
using namespace pcrepp;
class analizatzailea {
/* aukerak: -L srrera berezia
-2 bigarren aukera estandar eta aldaera batzuetan
-E <erab_hizt> erabiltzailearen hiztegia
formatua: tuntunA[KAT_IZE][AZP_ARR]
konbinatu datezke: anali_xerox_erab -2E lex_erab.lex */
/*extern int ireki_maiztasun_handikoak();
extern int badago_hitza_maiztasun_handikoak(char *gakoa);*/
// int ken_majusk(char *st);
void lortu_hitza(char *hitza,vector<string> *sarrera,vector<string> *irteera,int *indizea);
int analizatu_aukerak_hitza(int bigarren_aukera, int non, char *hitzasar, char anal[][LUZMAXAN],char motak[],int distantziak[]);
//#ifndef _USE_FOMA_
int analizatuErabLex(char *hitza,int m, char anal[][LUZMAXAN], int *beste_analisia, char *lema_ident, vector<string> *emaitza);
//#endif
void lortu_lema_ident(char *hitza,char *lema_ident);
void lortu_lema_zen_dek(char *lema_ident);
void inprimatu_ident_analisia(char *analisia, int *ident_analisia, char* lema_ident, vector<string>* emaitza);
void inprimatu_lexgabeko_analisia(char *analisia, int *i, char* lema_ident, vector<string>* emaitza);
void inprimatu_aldaera_analisia(char *analisia, int *i, int dist, char* lema_ident, vector<string>* emaitza);
void inprimatu_estandar_analisia(char *analisia, int *i, char* lema_ident, vector<string>* emaitza);
void inprimatu_goiburukoa(char *hitza, char mota, vector<string>* emaitza);
void lortu_aurrizki_kar_ber(char *hitza,char *lema_ident);
#ifdef _USE_FOMA_
fomaMorf transFoma;
#endif
#ifndef __BRIDGE_VARIANTS__
void sortu_banaketak(int mm,char anal_bana[][LUZMAXAN],map<string,string> &an_ban_map);
void eman_banaketa(char an_lag[], map<string,string> &an_ban_map,char banaketa[]);
int desanb_aldaerak_cstr(int m, char anal[][LUZMAXAN],char motak[],int distantziak[]); //kentzeko
int lortu_distantzia(char an_lag[],char hitza[],char banaketa[],char aldaera[]);
int distantz(char *forma, char *lema, char *aldaera);
#endif //__BRIDGE_VARIANTS
int desanb_eratorpena_cstr(int m, char anal[][LUZMAXAN],char motak[],int distantziak[]); //kentzeko
anaBihurtzailea bihur;
// int aurrekoa_puntua;
int den_mai;
int den_mai_dek;
int zen_dek;
int edbl_bertsioa;
/* int aurrekoa_den_mai; */
/* int aurrekoa_has_mai; */
int has_mai;
int kar_ber;
int maiztasun_handikoak;
int ez_estandarrak;
int Sarrera_berezia; /*** 99/9/2 -L aukerarako */
int lexiko_uzei;
int bigarren_aukera; /*** 2000/11/20 -2 aukerarako */
int lex_ald; /*** 2000/12/20 erabiltzailearen lexikorako -L eta -2 ez dira onartzen*/
int irteera_parentizatua;
int irteera_nola;
char forma_ident[LUZMAXAN];
int ident_da;
int zen_da;
int zen_dek_da;
int errom_da;
int distantzia_minimoa;
int deslok; /*** desanbiguazio lokala aplikatu ala ez. Defektuz bai */
public:
analizatzailea() {
/* aurrekoa_puntua = 1; */
den_mai = 0;
den_mai_dek = 0;
zen_dek = 0;
/* aurrekoa_den_mai = 0; */
/* aurrekoa_has_mai = 0; */
has_mai = 0;
kar_ber = 0;
maiztasun_handikoak = 0;
ez_estandarrak = 0;
irteera_parentizatua = 0;
ident_da = 0;
zen_da = 0;
zen_dek_da = 0;
errom_da = 0;
forma_ident[0] = '\0';
deslok = 1;
edbl_bertsioa = 4;
Sarrera_berezia = 0 ; /*** 99/9/2 -L aukerarako */
lexiko_uzei = 0;
bigarren_aukera = 0; /*** 2000/11/20 -2 aukerarako */
lex_ald=0; /*** 2000/12/20 erabiltzailearen lexikorako -L eta -2 ez dira onartzen*/
irteera_nola = ESTANDAR_AN;
distantzia_minimoa = 1; /*** parametro bat definitu beharko litzateke */
}
void hasieraketak(int sar_lem, int lex_uzei, int bigarren, int ez_est, int erab_lex, string &lexiko_izena, int parentizatua, int deslokala);
void amaierakoak();
vector<string> analizatu(int modua,vector<string> *sarrerako_taula);
// void analizatu();
void analizatu_hitza_trans(char hitza[], int modua, vector<string> *sarrerako_taula,vector<string> *emaitza,int *indizea);
};
|
#pragma once
#include <util/system/defaults.h>
#define NN 312
#define MM 156
#define MATRIX_A ULL(0xB5026F5AA96619E9)
#define UM ULL(0xFFFFFFFF80000000)
#define LM ULL(0x7FFFFFFF)
namespace NPrivate {
inline static double ToRes53(ui64 v) throw () {
return double(v * (1.0 / 18446744073709551616.0L));
}
class TMersenne64 {
public:
inline TMersenne64(ui64 s = ULL(19650218))
: mti(NN + 1)
{
InitGenRand(s);
}
inline TMersenne64(const ui64 keys[], size_t len) throw ()
: mti(NN + 1)
{
InitByArray(keys, len);
}
inline ui64 GenRand() throw () {
int i;
ui64 x;
ui64 mag01[2] = {
ULL(0),
MATRIX_A
};
if (mti >= NN) {
if (mti == NN + 1) {
InitGenRand(ULL(5489));
}
for (i = 0; i < NN - MM; ++i) {
x = (mt[i] & UM) | (mt[i + 1] & LM);
mt[i] = mt[i + MM] ^ (x >> 1) ^ mag01[(int)(x & ULL(1))];
}
for (; i < NN - 1; ++i) {
x = (mt[i] & UM) | (mt[i + 1] & LM);
mt[i] = mt[i + (MM - NN) ] ^ (x >> 1) ^ mag01[(int)(x & ULL(1))];
}
x = (mt[NN - 1] & UM) | (mt[0] & LM);
mt[NN - 1] = mt[MM - 1] ^ (x >> 1) ^ mag01[(int)(x & ULL(1))];
mti = 0;
}
x = mt[mti++];
x ^= (x >> 29) & ULL(0x5555555555555555);
x ^= (x << 17) & ULL(0x71D67FFFEDA60000);
x ^= (x << 37) & ULL(0xFFF7EEE000000000);
x ^= (x >> 43);
return x;
}
inline i64 GenRandSigned() throw () {
return (i64)(GenRand() >> 1);
}
inline double GenRandReal1() throw () {
return (GenRand() >> 11) * (1.0 / 9007199254740991.0);
}
inline double GenRandReal2() throw () {
return (GenRand() >> 11) * (1.0 / 9007199254740992.0);
}
inline double GenRandReal3() throw () {
return ((GenRand() >> 12) + 0.5) * (1.0 / 4503599627370496.0);
}
inline double GenRandReal4() throw () {
return ToRes53(GenRand());
}
private:
inline void InitGenRand(ui64 seed) throw () {
mt[0] = seed;
for (mti = 1; mti < NN; ++mti) {
mt[mti] = (ULL(6364136223846793005) * (mt[mti - 1] ^ (mt[mti - 1] >> 62)) + mti);
}
}
inline void InitByArray(const ui64 init_key[], size_t key_length) throw () {
ui64 i = 1;
ui64 j = 0;
ui64 k;
InitGenRand(ULL(19650218));
k = NN > key_length ? NN : key_length;
for (; k; --k) {
mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >> 62)) * ULL(3935559000370003845))) + init_key[j] + j;
++i;
++j;
if (i >= NN) {
mt[0] = mt[NN - 1];
i = 1;
}
if (j >= key_length) {
j = 0;
}
}
for (k = NN - 1; k; --k) {
mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >> 62)) * ULL(2862933555777941757))) - i;
++i;
if (i >= NN) {
mt[0] = mt[NN - 1];
i = 1;
}
}
mt[0] = ULL(1) << 63;
}
private:
ui64 mt[NN];
int mti;
};
}
#undef NN
#undef MM
#undef MATRIX_A
#undef UM
#undef LM
|
#pragma once
#include <contrib/libs/protobuf/descriptor.h>
#include <contrib/libs/protobuf/message.h>
#include <util/generic/stroka.h>
#include <util/generic/ptr.h>
// A simple text config in form of single gazetteer article.
// Allows describing configs of arbitrary level and complexity.
// A description of config object (TCfgProto) is done using standard ProtoBuf syntax.
// See arcadia_tests_data/wizard/img_translate/imgtranslate2.cfg or unittest for example.
namespace NProtoConf {
bool LoadFromFile(const Stroka& fileName, const NProtoBuf::Descriptor* descr, NProtoBuf::Message& res);
template <typename TCfgProto>
inline bool LoadFromFile(const Stroka& fileName, TCfgProto& res) {
return LoadFromFile(fileName, TCfgProto::descriptor(), res);
}
template <typename TCfgProto>
inline TAutoPtr<TCfgProto> LoadFromFile(const Stroka& fileName) {
TAutoPtr<TCfgProto> ret(new TCfgProto);
return LoadFromFile(fileName, *ret) ? ret : NULL;
}
} // namespace NProtoConf
|
#pragma once
#include <util/system/yassert.h>
#include <string.h>
struct IBinaryStream
{
virtual ~IBinaryStream() {};
virtual int Write(const void *userBuffer, int size) = 0;
virtual int Read(void *userBuffer, int size) = 0;
virtual bool IsValid() const = 0;
virtual bool IsFailed() const = 0;
};
template <int N_SIZE = 16384>
class TBufferedStream
{
char Buf[N_SIZE];
int Pos, BufSize;
IBinaryStream &Stream;
bool bIsReading, bIsEof, bFailed;
void ReadComplex(void *userBuffer, int size) {
if (bIsEof) {
memset(userBuffer, 0, size);
return;
}
char *dst = (char*)userBuffer;
int leftBytes = BufSize - Pos;
memcpy(dst, Buf + Pos, leftBytes);
dst += leftBytes;
size -= leftBytes;
Pos = BufSize = 0;
if (size > N_SIZE) {
int n = Stream.Read(dst, size);
bFailed = Stream.IsFailed();
if (n != size) {
bIsEof = true;
memset(dst + n, 0, size - n);
}
} else {
BufSize = Stream.Read(Buf, N_SIZE);
bFailed = Stream.IsFailed();
if (BufSize == 0)
bIsEof = true;
Read(dst, size);
}
}
void WriteComplex(const void *userBuffer, int size) {
Flush();
if (size >= N_SIZE) {
Stream.Write(userBuffer, size);
bFailed = Stream.IsFailed();
}
else
Write(userBuffer, size);
}
void operator=(const TBufferedStream&) {}
public:
TBufferedStream(bool bRead, IBinaryStream &stream)
: Pos(0), BufSize(0), Stream(stream), bIsReading(bRead), bIsEof(false), bFailed(false) {}
~TBufferedStream() {
if (!bIsReading)
Flush();
}
void Flush() {
YASSERT(!bIsReading);
if (bIsReading)
return;
Stream.Write(Buf, Pos);
bFailed = Stream.IsFailed();
Pos = 0;
}
bool IsEof() const { return bIsEof; }
inline void Read(void *userBuffer, int size) {
YASSERT(bIsReading);
if (!bIsEof && size + Pos <= BufSize) {
memcpy(userBuffer, Buf + Pos, size);
Pos += size;
return;
}
ReadComplex(userBuffer, size);
}
inline void Write(const void *userBuffer, int size) {
YASSERT(!bIsReading);
if (Pos + size < N_SIZE) {
memcpy(Buf + Pos, userBuffer, size);
Pos += size;
return;
}
WriteComplex(userBuffer, size);
}
bool IsValid() const { return Stream.IsValid(); }
bool IsFailed() const { return bFailed; }
};
|
#ifndef KEYSPACE_CLIENT_WRAP_H
#define KEYSPACE_CLIENT_WRAP_H
// SWIG compatible wrapper interface for generating client wrappers
#include <string>
#include "System/Platform.h"
typedef void * ClientObj;
typedef void * ResultObj;
// helper class for converting node array to Init argument
struct Keyspace_NodeParams
{
Keyspace_NodeParams(int nodec_);
~Keyspace_NodeParams();
void Close();
void AddNode(const std::string& node);
int nodec;
char** nodes;
int num;
};
void Keyspace_ResultBegin(ResultObj result);
void Keyspace_ResultNext(ResultObj result);
bool Keyspace_ResultIsEnd(ResultObj result);
void Keyspace_ResultClose(ResultObj result);
std::string Keyspace_ResultKey(ResultObj result);
std::string Keyspace_ResultValue(ResultObj result);
int Keyspace_ResultTransportStatus(ResultObj result);
int Keyspace_ResultConnectivityStatus(ResultObj result);
int Keyspace_ResultTimeoutStatus(ResultObj result);
int Keyspace_ResultCommandStatus(ResultObj result);
ClientObj Keyspace_Create();
int Keyspace_Init(ClientObj client, const Keyspace_NodeParams ¶ms);
void Keyspace_Destroy(ClientObj client);
ResultObj Keyspace_GetResult(ClientObj);
void Keyspace_SetGlobalTimeout(ClientObj client, uint64_t timeout);
void Keyspace_SetMasterTimeout(ClientObj client, uint64_t timeout);
uint64_t Keyspace_GetGlobalTimeout(ClientObj client);
uint64_t Keyspace_GetMasterTimeout(ClientObj client);
// connection state related commands
int Keyspace_GetMaster(ClientObj client);
void Keyspace_DistributeDirty(ClientObj client, bool dd);
int Keyspace_Get(ClientObj client, const std::string& key);
int Keyspace_DirtyGet(ClientObj client, const std::string& key);
int Keyspace_Count(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_CountStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_DirtyCount(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_DirtyCountStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_ListKeys(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_ListKeysStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_DirtyListKeys(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_DirtyListKeysStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_ListKeyValues(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_ListKeyValuesStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_DirtyListKeyValues(ClientObj client,
const std::string& prefix,
const std::string& startKey,
uint64_t count,
bool next,
bool forward);
int Keyspace_DirtyListKeyValuesStr(ClientObj client,
const std::string& prefix,
const std::string& startKey,
const std::string& count,
bool next,
bool forward);
int Keyspace_Set(ClientObj client, const std::string& key, const std::string& value);
int Keyspace_TestAndSet(ClientObj client,
const std::string& key,
const std::string& test,
const std::string& value);
int Keyspace_Add(ClientObj client, const std::string& key, int64_t num);
int Keyspace_AddStr(ClientObj client, const std::string& key, const std::string& num);
int Keyspace_Delete(ClientObj client, const std::string& key);
int Keyspace_Remove(ClientObj client, const std::string& key);
int Keyspace_Rename(ClientObj client, const std::string& from, const std::string& to);
int Keyspace_Prune(ClientObj client, const std::string& prefix);
int Keyspace_SetExpiry(ClientObj client, const std::string& key, int exptime);
int Keyspace_RemoveExpiry(ClientObj client, const std::string& key);
int Keyspace_ClearExpiries(ClientObj client);
// grouping write commands
int Keyspace_Begin(ClientObj client);
int Keyspace_Submit(ClientObj client);
int Keyspace_Cancel(ClientObj client);
bool Keyspace_IsBatched(ClientObj client);
// debugging command
void Keyspace_SetTrace(bool trace);
#endif
|
#pragma once
#ifndef id_1AB80237_6F9E_4EB1_9CDA_F0B79A1745C1
#define id_1AB80237_6F9E_4EB1_9CDA_F0B79A1745C1
#include <string>
#include <algorithm>
#include <windows.h>
template<class T>
std::wstring list2cmdline(T start, T end) {
std::wstring result, bs_buf;
while (start != end) {
LPWSTR elem = *start;
if (!result.empty())
result.push_back(' ');
size_t length = lstrlen(elem);
bool needquote = !length || std::any_of(elem, elem + length, [](wchar_t ch) {
return ch == ' ' || ch == '\t';
});
if (needquote)
result.push_back('"');
LPCWSTR c = elem;
while (*c) {
switch (*c) {
case L'\\':
bs_buf.push_back(L'\\');
break;
case L'"':
result += bs_buf + bs_buf;
bs_buf.clear();
result += L"\\\"";
break;
default:
if (!bs_buf.empty()) {
result += bs_buf;
bs_buf.clear();
}
result.push_back(*c);
}
++c;
}
if (!bs_buf.empty())
result += bs_buf;
if (needquote) {
result += bs_buf;
result.push_back('"');
}
bs_buf.clear();
++start;
}
return result;
}
#endif
|
/*
* Copyright (C) 1994-2016 Altair Engineering, Inc.
* For more information, contact Altair at www.altair.com.
*
* This file is part of the PBS Professional ("PBS Pro") software.
*
* Open Source License Information:
*
* PBS Pro is free software. You can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Commercial License Information:
*
* The PBS Pro software is licensed under the terms of the GNU Affero General
* Public License agreement ("AGPL"), except where a separate commercial license
* agreement for PBS Pro version 14 or later has been executed in writing with Altair.
*
* Altair’s dual-license business model allows companies, individuals, and
* organizations to create proprietary derivative works of PBS Pro and distribute
* them - whether embedded or bundled with other software - under a commercial
* license agreement.
*
* Use of Altair’s trademarks, including but not limited to "PBS™",
* "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
* trademark licensing policies.
*
*/
/**
* @file disrfst.c
*
* @par Synopsis:
* int disrfst(int stream, size_t achars, char *value)
*
* Gets a Data-is-Strings character string from <stream> and converts it
* into an ASCII NUL-terminated string, and puts the string into <value>,
* a pre-allocated string, <achars> long. The character string in <stream>
* consists of an unsigned integer, followed by a number of characters
* determined by the unsigned integer.
*
* Disrfst returns DIS_SUCCESS if everything works well. It returns an
* error code otherwise. In case of an error, the <stream> character
* pointer is reset, making it possible to retry with some other conversion
* strategy, and the first character of <value> is set to ASCII NUL.
*/
#include <pbs_config.h> /* the master config generated by configure */
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef NDEBUG
#include <string.h>
#endif
#include "dis.h"
#include "dis_.h"
/**
* @brief
* -Gets a Data-is-Strings character string from <stream> and converts it
* into an ASCII NUL-terminated string, and puts the string into <value>,
* a pre-allocated string, <achars> long. The character string in <stream>
* consists of an unsigned integer, followed by a number of characters
* determined by the unsigned integer.
*
* @param[in] stream - socket descriptor
* @param[out] achars - long value
* @param[out] value - string value
*
* @return int
* @retval DIS_success/error status
*
*/
int
disrfst(int stream, size_t achars, char *value)
{
int locret;
int negate;
unsigned count;
assert(value != NULL);
assert(dis_gets != NULL);
assert(disr_commit != NULL);
locret = disrsi_(stream, &negate, &count, 1, 0);
if (locret == DIS_SUCCESS) {
if (negate)
locret = DIS_BADSIGN;
else if (count > achars)
locret = DIS_OVERFLOW;
else if ((*dis_gets)(stream, value, (size_t)count) !=
(size_t)count)
locret = DIS_PROTO;
#ifndef NDEBUG
else if (memchr(value, 0, (size_t)count))
locret = DIS_NULLSTR;
#endif
else
value[count] = '\0';
}
locret = (*disr_commit)(stream, locret == DIS_SUCCESS) ?
DIS_NOCOMMIT : locret;
if (locret != DIS_SUCCESS)
*value = '\0';
return (locret);
}
|
/*
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/common/device_random.h>
#include <aws/common/byte_buf.h>
#include <aws/common/thread.h>
#include <fcntl.h>
#include <unistd.h>
static int s_rand_fd = -1;
static aws_thread_once s_rand_init = AWS_THREAD_ONCE_STATIC_INIT;
#ifdef O_CLOEXEC
# define OPEN_FLAGS (O_RDONLY | O_CLOEXEC)
#else
# define OPEN_FLAGS (O_RDONLY)
#endif
static void s_init_rand(void *user_data) {
(void)user_data;
s_rand_fd = open("/dev/urandom", OPEN_FLAGS);
if (s_rand_fd == -1) {
s_rand_fd = open("/dev/urandom", O_RDONLY);
if (s_rand_fd == -1) {
abort();
}
}
if (-1 == fcntl(s_rand_fd, F_SETFD, FD_CLOEXEC)) {
abort();
}
}
static int s_fallback_device_random_buffer(struct aws_byte_buf *output) {
aws_thread_call_once(&s_rand_init, s_init_rand, NULL);
size_t diff = output->capacity - output->len;
ssize_t amount_read = read(s_rand_fd, output->buffer + output->len, diff);
if (amount_read != diff) {
return aws_raise_error(AWS_ERROR_RANDOM_GEN_FAILED);
}
output->len += diff;
return AWS_OP_SUCCESS;
}
int aws_device_random_buffer(struct aws_byte_buf *output) {
return s_fallback_device_random_buffer(output);
}
|
/*
Copyright (C) 2013 Mike Hansen
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "fq_zech_poly.h"
#ifdef T
#undef T
#endif
#define T fq_zech
#define CAP_T FQ_ZECH
#include "fq_poly_templates/test/t-equal_trunc.c"
#undef CAP_T
#undef T
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.