text stringlengths 4 6.14k |
|---|
/* environ.c -- library for manipulating environments for GNU.
Copyright (C) 1986-2017 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
#include "environ.h"
#include <algorithm>
#include <utility>
/* See common/environ.h. */
gdb_environ &
gdb_environ::operator= (gdb_environ &&e)
{
/* Are we self-moving? */
if (&e == this)
return *this;
m_environ_vector = std::move (e.m_environ_vector);
e.m_environ_vector.clear ();
e.m_environ_vector.push_back (NULL);
return *this;
}
/* See common/environ.h. */
gdb_environ gdb_environ::from_host_environ ()
{
extern char **environ;
gdb_environ e;
if (environ == NULL)
return e;
for (int i = 0; environ[i] != NULL; ++i)
{
/* Make sure we add the element before the last (NULL). */
e.m_environ_vector.insert (e.m_environ_vector.end () - 1,
xstrdup (environ[i]));
}
return e;
}
/* See common/environ.h. */
void
gdb_environ::clear ()
{
for (char *v : m_environ_vector)
xfree (v);
m_environ_vector.clear ();
/* Always add the NULL element. */
m_environ_vector.push_back (NULL);
}
/* Helper function to check if STRING contains an environment variable
assignment of VAR, i.e., if STRING starts with 'VAR='. Return true
if it contains, false otherwise. */
static bool
match_var_in_string (char *string, const char *var, size_t var_len)
{
if (strncmp (string, var, var_len) == 0 && string[var_len] == '=')
return true;
return false;
}
/* See common/environ.h. */
const char *
gdb_environ::get (const char *var) const
{
size_t len = strlen (var);
for (char *el : m_environ_vector)
if (el != NULL && match_var_in_string (el, var, len))
return &el[len + 1];
return NULL;
}
/* See common/environ.h. */
void
gdb_environ::set (const char *var, const char *value)
{
/* We have to unset the variable in the vector if it exists. */
unset (var);
/* Insert the element before the last one, which is always NULL. */
m_environ_vector.insert (m_environ_vector.end () - 1,
concat (var, "=", value, NULL));
}
/* See common/environ.h. */
void
gdb_environ::unset (const char *var)
{
size_t len = strlen (var);
/* We iterate until '.end () - 1' because the last element is
always NULL. */
for (std::vector<char *>::iterator el = m_environ_vector.begin ();
el != m_environ_vector.end () - 1;
++el)
if (match_var_in_string (*el, var, len))
{
xfree (*el);
m_environ_vector.erase (el);
break;
}
}
/* See common/environ.h. */
char **
gdb_environ::envp () const
{
return const_cast<char **> (&m_environ_vector[0]);
}
|
/*
This file is part of GNUnet
(C) 2004, 2005, 2006, 2007 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file include/gnunet_datastore_service.h
* @brief API that can be used manage the
* datastore for files stored on a GNUnet node;
* note that the datastore is NOT responsible for
* on-demand encoding, that is achieved using
* a special kind of entry.
* @author Christian Grothoff
*/
#ifndef GNUNET_DATASTORE_SERVICE_H
#define GNUNET_DATASTORE_SERVICE_H
#include "gnunet_core.h"
#ifdef __cplusplus
extern "C"
{
#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
/**
* A value in the datastore.
*/
typedef struct
{
/**
* The total size of the Value, including this header, in network
* byte order.
*/
unsigned int size;
/**
* Type of the item. The datastore does not care about this value;
* in network byte order. 0 is reserved and should not be used
* by applications for anything other than 'any type'. In network
* byte order.
*/
unsigned int type;
/**
* How important is it to keep this item? Items with the lowest
* priority are discarded if the datastore is full. In network
* byte order.
*/
unsigned int priority;
/**
* What are the anonymity requirements for this content?
* Use 0 if anonymity is not required (enables direct
* sharing / DHT routing). In network byte order.
*/
unsigned int anonymity_level;
/**
* Expiration time for this item, in NBO (use GNUNET_htonll to read!). Use
* "-1" for items that never expire.
*/
GNUNET_CronTime expiration_time;
} GNUNET_DatastoreValue;
/**
* An iterator over a set of Datastore items.
*
* @param datum called with the next item
* @param closure user-defined extra argument
* @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available
*
* @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue,
* GNUNET_NO to delete the item and continue (if supported)
*/
typedef int (*GNUNET_DatastoreValueIterator) (const GNUNET_HashCode * key,
const GNUNET_DatastoreValue *
value, void *closure,
unsigned long long uid);
/**
* @brief Definition of the datastore API.
*
* Note that a datastore implementation is supposed to do much more
* than just trivially implement this API. A good datastore discards
* old entries and low-priority entries in the background as the
* database fills up to its limit. It uses a bloomfilter to avoid
* disk-IO. A datastore should pre-fetch some set of random entries
* to quickly respond to getRandom().
*
* Finally, the datastore should try to detect corruption and if
* so automatically attempt to repair itself (i.e. by keeping
* a flag in the state-DB to indicate if the last shutdown was
* clean, and if not, trigger a repair on startup).
*
* Once GNUnet has IO load management the DS should integrate with
* that and refuse IO if the load is too high.
*/
typedef struct
{
/**
* Get the current on-disk size of the datastore.
*/
unsigned long long (*getSize) (void);
/**
* Store an item in the datastore. If the item is already present,
* the priorities are summed up and the higher expiration time and
* lower anonymity level is used.
*
* @return GNUNET_YES on success, GNUNET_NO if the datastore is
* full and the priority of the item is not high enough
* to justify removing something else, GNUNET_SYSERR on
* other serious error (i.e. IO permission denied)
*/
int (*putUpdate) (const GNUNET_HashCode * key,
const GNUNET_DatastoreValue * value);
/**
* Iterate over the results for a particular key
* in the datastore.
*
* @param key maybe NULL (to match all entries)
* @param type entries of which type are relevant?
* Use 0 for any type.
* @param iter maybe NULL (to just count)
* @return the number of results, GNUNET_SYSERR if the
* iter is non-NULL and aborted the iteration,
* 0 if no matches were found. May NOT return
* GNUNET_SYSERR unless the iterator aborted!
*/
int (*get) (const GNUNET_HashCode * key,
unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure);
/**
* Do a quick test if we MAY have the content.
*/
int (*fast_get) (const GNUNET_HashCode * key);
/**
* Get a random value from the datastore.
*
* @param key set to the key of the match
* @param value set to an approximate match
* @return GNUNET_OK if a value was found, GNUNET_SYSERR if not
*/
int (*getRandom) (GNUNET_HashCode * key, GNUNET_DatastoreValue ** value);
/**
* Explicitly remove some content from the database.
*/
int (*del) (const GNUNET_HashCode * query,
const GNUNET_DatastoreValue * value);
} GNUNET_Datastore_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
/* end of gnunet_datastore_service.h */
#endif
|
/* This file is part of the nesC compiler.
This file is derived from the RC Compiler. It is thus
Copyright (C) 2000-2001 The Regents of the University of California.
Changes for nesC are
Copyright (C) 2002 Intel Corporation
The attached "nesC" software is provided to you under the terms and
conditions of the GNU General Public License Version 2 as published by the
Free Software Foundation.
nesC 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 nesC; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301 USA. */
#ifndef C_PARSE_H
#define C_PARSE_H
#include "AST.h"
struct yystype {
union {
void *ptr;
asm_operand asm_operand;
asm_stmt asm_stmt;
attribute attribute;
gcc_attribute gcc_attribute;
nesc_attribute nesc_attribute;
lexical_cst constant;
declaration decl;
declarator declarator;
nested_declarator nested;
expression expr;
id_label id_label;
label label;
node node;
statement stmt;
conditional_stmt cstmt;
for_stmt for_stmt;
string string;
type_element telement;
asttype type;
word word;
designator designator;
interface_ref iref;
component_ref cref;
connection conn;
endpoint ep;
parameterised_identifier pid;
implementation impl;
environment env;
dd_list fields;
char *docstring;
tag_declaration tdecl;
struct {
location location;
int i;
} itoken;
struct {
expression expr;
int i;
} iexpr;
struct {
statement stmt;
int i;
} istmt;
} u;
struct {
location location;
cstring id;
data_declaration decl;
} idtoken;
bool abstract;
};
#define YYSTYPE struct yystype
/* Region in which to allocate parse structures. Idea: the AST user can set
this to different regions at appropriate junctures depending on what's
being done with the AST */
extern region parse_region;
/* TRUE if currently parsing an expression that will not be evaluated (argument
to alignof, sizeof. Currently not typeof though that could be considered
a bug) */
bool unevaluated_expression(void);
node parse(void) deletes;
/* Effects: parses the file set up via set_input/start_lex
Returns: the file's parse tree (may be NULL in some error cases)
*/
declaration make_error_decl(void);
declarator make_identifier_declarator(location l, cstring id);
#endif
|
/***************************************************************************
NWNXFuncs.cpp - Implementation of the CNWNXFuncs class.
Copyright (C) 2007 Doug Swarin (zac@intertex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
#include "NWNXFuncs.h"
void Func_ReplaceKnownSpell (CGameObject *ob, char *value) {
int i, j, k, sp_class, sp_id, sp_new;
CNWSCreature *cre;
if (ob == NULL ||
(cre = ob->vtable->AsNWSCreature(ob)) == NULL ||
cre->cre_stats == NULL ||
sscanf(value, "%d %d %d", &sp_class, &sp_id, &sp_new) != 3) {
snprintf(value, strlen(value), "-1");
return;
}
/* Iterate their class list, matching the requested class, then iterate the spells
* known list for that class. If the spell is found, remove it. */
for (i = 0; i < cre->cre_stats->cs_classes_len; i++) {
if (cre->cre_stats->cs_classes[i].cl_class != sp_class)
continue;
for (j = 0; j < 10; j++) {
k = CExoArrayList_uint32_contains(&(cre->cre_stats->cs_classes[i].cl_spells_known[j]), sp_id);
if (k > 0) {
cre->cre_stats->cs_classes[i].cl_spells_known[j].data[k - 1] = sp_new;
snprintf(value, strlen(value), "%d", j);
return;
}
}
}
snprintf(value, strlen(value), "-1");
}
/* vim: set sw=4: */
|
* vars.h
* variable declarations
* generated by FormCalc 27 May 2010 16:51
#include "decl.h"
double precision S, T, T14, U, T24, S34
common /ud_u1d1_REykinvars/ S, T, T14, U, T24, S34
integer Hel(5)
common /ud_u1d1_REykinvars/ Hel
double complex F6, F2, F16, F15, F1, F12, F13, F5, F9, F10
double complex F17, F19, F18, F20, F14, F7, F3, F4, F11, F8
double complex Pair1, Pair2, Pair3, Abb11, Abb15, Abb18, Abb21
double complex Abb24, Abb1, Abb3, Abb6, Abb12, Abb16, Abb19
double complex Abb22, Abb25, Abb2, Abb4, Abb7, Abb8, Abb13
double complex Abb14, Abb17, Abb20, Abb23, Abb26, Abb27, Abb10
double complex Abb28, Abb5, Abb9, AbbSum7, AbbSum4, AbbSum13
double complex AbbSum14, AbbSum9, AbbSum10, AbbSum11, AbbSum12
double complex AbbSum17, AbbSum6, AbbSum1, AbbSum2, AbbSum8
double complex AbbSum16, AbbSum5, AbbSum15, AbbSum18, AbbSum3
double complex Sub2, Sub5, Sub3, Sub6, Sub8, Sub10, Sub4, Sub1
double complex Sub7, Sub9
common /ud_u1d1_REyabbrev/ F6, F2, F16, F15, F1, F12, F13, F5
common /ud_u1d1_REyabbrev/ F9, F10, F17, F19, F18, F20, F14
common /ud_u1d1_REyabbrev/ F7, F3, F4, F11, F8, Pair1, Pair2
common /ud_u1d1_REyabbrev/ Pair3, Abb11, Abb15, Abb18, Abb21
common /ud_u1d1_REyabbrev/ Abb24, Abb1, Abb3, Abb6, Abb12
common /ud_u1d1_REyabbrev/ Abb16, Abb19, Abb22, Abb25, Abb2
common /ud_u1d1_REyabbrev/ Abb4, Abb7, Abb8, Abb13, Abb14
common /ud_u1d1_REyabbrev/ Abb17, Abb20, Abb23, Abb26, Abb27
common /ud_u1d1_REyabbrev/ Abb10, Abb28, Abb5, Abb9, AbbSum7
common /ud_u1d1_REyabbrev/ AbbSum4, AbbSum13, AbbSum14
common /ud_u1d1_REyabbrev/ AbbSum9, AbbSum10, AbbSum11
common /ud_u1d1_REyabbrev/ AbbSum12, AbbSum17, AbbSum6
common /ud_u1d1_REyabbrev/ AbbSum1, AbbSum2, AbbSum8, AbbSum16
common /ud_u1d1_REyabbrev/ AbbSum5, AbbSum15, AbbSum18
common /ud_u1d1_REyabbrev/ AbbSum3, Sub2, Sub5, Sub3, Sub6
common /ud_u1d1_REyabbrev/ Sub8, Sub10, Sub4, Sub1, Sub7, Sub9
integer ij
common /ud_u1d1_REyindices/ ij
double complex MatSUN(2,2), Ctree(2)
common /ud_u1d1_REyformfactors/ MatSUN, Ctree
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
/* LU matrix decomposition from Burden, Faires, p359,
implementation for non-singular matrices only.
Real indexing is from 0->n-1, but code is from 1->n.
Must have a(1,1) != 0.
L has diagonal elements 1.
*/
#define a(i,j) a[i-1][j-1]
#define l(i,j) lum[i-1][j-1]
#define u(i,j) lum[i-1][j-1]
double **lu(double **a, int n, double **lum) {
int i,j,k;
if(a(1,1)==0.0) {
printf("\n\tCan't do LU\n");
exit(1);
}
u(1,1)=a(1,1);
for(j=2;j<=n;j++) {
u(1,j)=a(1,j);
l(j,1)=a(j,1)/u(1,1);
}
for(i=2;i<=n-1;i++) {
u(i,i)=a(i,i);
for(k=1;k<=i-1;k++) u(i,i) -= l(i,k)*u(k,i);
if(u(i,i)==0.0) {
printf("\n\tCan't do LU\n");
exit(1);
}
for(j=i+1;j<=n;j++) {
u(i,j)=a(i,j);l(j,i)=a(j,i);
for(k=1;k<=i-1;k++) {
u(i,j) -= l(i,k)*u(k,j);
l(j,i) -= l(j,k)*u(k,i);
}
l(j,i) /= u(i,i);
}
}
u(n,n) = a(n,n);
for(k=1;k<=n-1;k++) u(n,n) -= l(n,k)*u(k,n);
return lum;
}
#define vx(i) vx[i-1]
#define va(i) va[i-1]
#define vb(i) vb[i-1]
/* Solve LU vx[]=vb [] */
double *lu_solve(double **lum, int n, double *vb, double *vx) {
int i,j,k;
double x;
vx(1)=vb(1);
for(i=2;i<=n;i++) {
vx(i)=vb(i);
for(j=1;j<i;j++) vx(i) -= l(i,j)*vx(j);
}
vx(n) /= u(n,n);
for(i=n-1;i>=1;i--) {
x=vx(i);
for(j=i+1;j<=n;j++) x -= u(i,j)*vx(j);
x /= u(i,i);
vx(i)=x;
}
return vx;
}
#ifdef TESTLU
main() {
int i,j,k;
double **a,**b,*va,*vb;
a=(double**)malloc(5*sizeof(double*));
b=(double**)malloc(5*sizeof(double*));
va=(double*)malloc(5*sizeof(double));
vb=(double*)malloc(5*sizeof(double));
for(i=0;i<5;i++) {
a[i]=(double*)malloc(5*sizeof(double));
b[i]=(double*)malloc(5*sizeof(double));
}
for(i=0;i<5;i++) for(j=0;j<5;j++) {
if(i==j) a[i][j]=5.0;
if(i!=j) a[i][j]=2.0;
}
lu(a,5,b);
for(i=0;i<5;i++) {
printf("\n\t");
for(j=0;j<5;j++) printf("%10.3lf ",b[i][j]);
}
for(i=0;i<5;i++) for(j=0;j<5;j++) {
a[i][j]=0.0;
for(k=0;!(k>i||k>j);k++) {
if(i!=k) a[i][j] += b[i][k]*b[k][j];
else a[i][j] += b[i][j];
}
}
printf("\n\n");
for(i=0;i<5;i++) {
printf("\n\t");
for(j=0;j<5;j++) printf("%10.3lf ",a[i][j]);
}
vb[0]=0.0;vb[1]=1.0;vb[2]=2.0;vb[3]=3.0;vb[4]=4.0;
lu_solve(b,5,vb,va);
printf("\n\n\t");
for(j=0;j<5;j++) printf("%10.3lf ",va[j]);
}
#endif
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc ,char *argv[])
{
FILE *infile, *outfile;
char infname[1024];
char outfname[1024];
char *rt28xxdir;
char *chipset;
int i=0;//,n=0;
unsigned char c;
memset(infname,0,1024);
memset(outfname,0,1024);
rt28xxdir = (char *)getenv("RT28xx_DIR");
chipset = (char *)getenv("CHIPSET");
if(!rt28xxdir)
{
printf("Environment value \"RT28xx_DIR\" not export \n");
return -1;
}
if(!chipset)
{
printf("Environment value \"CHIPSET\" not export \n");
return -1;
}
if (strlen(rt28xxdir) > (sizeof(infname)-100))
{
printf("Environment value \"RT28xx_DIR\" is too long!\n");
return -1;
}
strcat(infname,rt28xxdir);
if(strncmp(chipset, "2860",4)==0)
strcat(infname,"/common/rt2860.bin");
else if(strncmp(chipset, "2870",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "3090",4)==0)
strcat(infname,"/common/rt2860.bin");
else if(strncmp(chipset, "2070",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "3070",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "3572",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "3370",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "5370",4)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "USB",3)==0)
strcat(infname,"/common/rt2870.bin");
else if(strncmp(chipset, "PCI",3)==0)
strcat(infname,"/common/rt2860.bin");
else
strcat(infname,"/common/rt2860.bin");
strcat(outfname,rt28xxdir);
strcat(outfname,"/include/firmware.h");
infile = fopen(infname,"r");
if (infile == (FILE *) NULL)
{
printf("Can't read file %s \n",infname);
return -1;
}
outfile = fopen(outfname,"w");
if (outfile == (FILE *) NULL)
{
printf("Can't open write file %s \n",outfname);
return -1;
}
fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n",outfile);
fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n",outfile);
fputs("\n",outfile);
fputs("\n",outfile);
fputs("UCHAR FirmwareImage [] = { \n",outfile);
while(1)
{
char cc[3];
c = getc(infile);
if (feof(infile))
break;
memset(cc,0,2);
if (i>=16)
{
fputs("\n", outfile);
i = 0;
}
fputs("0x", outfile);
sprintf(cc,"%02x",c);
fputs(cc, outfile);
fputs(", ", outfile);
i++;
}
fputs("} ;\n", outfile);
fclose(infile);
fclose(outfile);
exit(0);
}
|
/* 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/PalmOS/Src/prefixes/compile.h $
* $Id: compile.h 45898 2009-11-14 13:11:06Z fingolfin $
*
*/
#ifndef __COMPILE_H__
#define __COMPILE_H__
#undef ENABLE_SCUMM
#undef ENABLE_SCUMM_7_8
#undef ENABLE_HE
#undef ENABLE_AGOS
#undef ENABLE_SKY
#undef ENABLE_SWORD1
#undef ENABLE_SWORD2
#undef ENABLE_QUEEN
#undef ENABLE_SAGA
#undef ENABLE_KYRA
#undef ENABLE_AWE
#undef ENABLE_GOB
#undef ENABLE_LURE
#undef ENABLE_CINE
#undef ENABLE_AGI
#undef ENABLE_TOUCHE
#undef ENABLE_PARALLACTION
#undef ENABLE_CRUISE
#undef ENABLE_DRASCULA
// ScummVM
#define DISABLE_HQ_SCALERS
#define DISABLE_FANCY_THEMES
//#define CT_NO_TRANSPARENCY
//#define REDUCE_MEMORY_USAGE
#include "compile_base.h"
//#define DISABLE_ADLIB
//#define DISABLE_LIGHTSPEED
#ifdef COMPILE_ZODIAC
# undef DISABLE_FANCY_THEMES
# define USE_ZLIB
// set an external ZLIB since save/load implementation
// doesn't support built-in zodiac version which is 1.1.4
// (seen inflateInit2 which err on "MAX_WBITS + 32")
# define USE_ZLIB_EXTERNAL
# define DISABLE_SONY
#endif
#ifdef COMPILE_OS5
# define DISABLE_TAPWAVE
# define USE_ZLIB
#endif
#endif
|
#pragma once
#include "../GameConstants.h"
/*
* ObjectTemplate.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CBinaryReader;
class CLegacyConfigParser;
class JsonNode;
class int3;
class DLL_LINKAGE ObjectTemplate
{
enum EBlockMapBits
{
VISIBLE = 1,
VISITABLE = 2,
BLOCKED = 4
};
/// tiles that are covered by this object, uses EBlockMapBits enum as flags
std::vector<std::vector<ui8>> usedTiles;
/// directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
ui8 visitDir;
/// list of terrains on which this object can be placed
std::set<ETerrainType> allowedTerrains;
public:
/// H3 ID/subID of this object
Obj id;
si32 subid;
/// print priority, objects with higher priority will be print first, below everything else
si32 printPriority;
/// animation file that should be used to display object
std::string animationFile;
/// string ID, equals to def base name for h3m files (lower case, no extension) or specified in mod data
std::string stringID;
ui32 getWidth() const;
ui32 getHeight() const;
void setSize(ui32 width, ui32 height);
bool isVisitable() const;
// Checks object used tiles
// Position is relative to bottom-right corner of the object, can not be negative
bool isWithin(si32 X, si32 Y) const;
bool isVisitableAt(si32 X, si32 Y) const;
bool isVisibleAt(si32 X, si32 Y) const;
bool isBlockedAt(si32 X, si32 Y) const;
std::set<int3> getBlockedOffsets() const;
int3 getBlockMapOffset() const; //bottom-right corner when firts blocked tile is
// Checks if object is visitable from certain direction. X and Y must be between -1..+1
bool isVisitableFrom(si8 X, si8 Y) const;
int3 getVisitableOffset() const;
bool isVisitableFromTop() const;
// Checks if object can be placed on specific terrain
bool canBePlacedAt(ETerrainType terrain) const;
ObjectTemplate();
//custom copy constructor is required
ObjectTemplate(const ObjectTemplate & other);
ObjectTemplate& operator=(const ObjectTemplate & rhs);
void readTxt(CLegacyConfigParser & parser);
void readMsk();
void readMap(CBinaryReader & reader);
void readJson(const JsonNode & node, const bool withTerrain = true);
void writeJson(JsonNode & node, const bool withTerrain = true) const;
bool operator==(const ObjectTemplate& ot) const { return (id == ot.id && subid == ot.subid); }
template <typename Handler> void serialize(Handler &h, const int version)
{
h & usedTiles & allowedTerrains & animationFile & stringID;
h & id & subid & printPriority & visitDir;
}
};
|
/*********
*
* In the name of the Father, and of the Son, and of the Holy Spirit.
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef BTFONTSETTINGS_H
#define BTFONTSETTINGS_H
#include "frontend/bookshelfmanager/btconfigdialog.h"
#include <QMap>
#include <QWidget>
#include "backend/config/btconfig.h"
class BtFontChooserWidget;
class CConfigurationDialog;
class QCheckBox;
class QComboBox;
class QGroupBox;
class QLabel;
class BtFontSettingsPage: public BtConfigDialog::Page {
Q_OBJECT
private: /* Types: */
typedef QMap<QString, BtConfig::FontSettingsPair> FontMap;
public: /* Methods: */
BtFontSettingsPage(CConfigurationDialog *parent = 0);
void save() const;
protected slots:
// This slot is called when the "Use own font for language" button was clicked.
void useOwnFontClicked(bool);
// Called when a new font in the fonts page was selected.
void newDisplayWindowFontSelected(const QFont &);
// Called when the combobox contents is changed
void newDisplayWindowFontAreaSelected(const QString&);
private: /* Methods: */
void retranslateUi();
private: /* Fields: */
QGroupBox *m_fontsGroupBox;
QLabel *m_languageLabel;
QComboBox *m_languageComboBox;
QCheckBox *m_languageCheckBox;
BtFontChooserWidget* m_fontChooser;
FontMap m_fontMap;
};
#endif
|
#pragma once
#include "Emu/Memory/vm_ptr.h"
#include "Emu/Cell/ErrorCodes.h"
class ppu_thread;
enum : s32
{
SYS_PPU_THREAD_ONCE_INIT = 0,
SYS_PPU_THREAD_DONE_INIT = 1,
};
// PPU Thread Flags
enum : u64
{
SYS_PPU_THREAD_CREATE_JOINABLE = 0x1,
SYS_PPU_THREAD_CREATE_INTERRUPT = 0x2,
};
struct sys_ppu_thread_stack_t
{
be_t<u32> pst_addr;
be_t<u32> pst_size;
};
struct ppu_thread_param_t
{
vm::bptr<void(u64)> entry;
be_t<u32> tls; // vm::bptr<void>
};
struct sys_ppu_thread_icontext_t
{
be_t<u64> gpr[32];
be_t<u32> cr;
be_t<u32> rsv1;
be_t<u64> xer;
be_t<u64> lr;
be_t<u64> ctr;
be_t<u64> pc;
};
enum : u32
{
PPU_THREAD_STATUS_IDLE,
PPU_THREAD_STATUS_RUNNABLE,
PPU_THREAD_STATUS_ONPROC,
PPU_THREAD_STATUS_SLEEP,
PPU_THREAD_STATUS_STOP,
PPU_THREAD_STATUS_ZOMBIE,
PPU_THREAD_STATUS_DELETED,
PPU_THREAD_STATUS_UNKNOWN,
};
// Syscalls
void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode);
s32 sys_ppu_thread_yield(ppu_thread& ppu); // Return value is ignored by the library
error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr<u64> vptr);
error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_get_join_state(ppu_thread& ppu, vm::ptr<s32> isjoinable); // Error code is ignored by the library
error_code sys_ppu_thread_set_priority(ppu_thread& ppu, u32 thread_id, s32 prio);
error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptr<s32> priop);
error_code sys_ppu_thread_get_stack_information(ppu_thread& ppu, vm::ptr<sys_ppu_thread_stack_t> sp);
error_code sys_ppu_thread_stop(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_restart(ppu_thread& ppu);
error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr<u64> thread_id, vm::ptr<ppu_thread_param_t> param, u64 arg, u64 arg4, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname);
error_code sys_ppu_thread_start(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_rename(ppu_thread& ppu, u32 thread_id, vm::cptr<char> name);
error_code sys_ppu_thread_recover_page_fault(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_get_page_fault_context(ppu_thread& ppu, u32 thread_id, vm::ptr<sys_ppu_thread_icontext_t> ctxt);
|
/*
(c) Copyright 2001-2008 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__DIRECT_H__
#define __DIRECT__DIRECT_H__
#include <direct/types.h>
DirectResult direct_initialize( void );
DirectResult direct_shutdown( void );
typedef void (*DirectCleanupHandlerFunc)( void *ctx );
DirectResult direct_cleanup_handler_add( DirectCleanupHandlerFunc func,
void *ctx,
DirectCleanupHandler **ret_handler );
DirectResult direct_cleanup_handler_remove( DirectCleanupHandler *handler );
#endif
|
/*
***************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 2002, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attemp
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
***************************************************************************
Module Name:
client_wds_cmm.h
Abstract:
*/
#ifndef __CLIENT_WDS_CMM_H__
#define __CLIENT_WDS_CMM_H__
#include "rtmp_def.h"
#ifdef CLIENT_WDS
#ifdef MBSS_AS_WDS_AP_SUPPORT
#define CLI_WDS_ENTRY_AGEOUT 300000 /* 300 seconds */
#else
#define CLI_WDS_ENTRY_AGEOUT 5000 /* seconds */
#endif
#define CLIWDS_POOL_SIZE 128
#define CLIWDS_HASH_TAB_SIZE 64 /* the legth of hash table must be power of 2. */
typedef struct _CLIWDS_PROXY_ENTRY {
struct _CLIWDS_PROXY_ENTRY *pNext;
ULONG LastRefTime;
SHORT Aid;
UCHAR Addr[MAC_ADDR_LEN];
} CLIWDS_PROXY_ENTRY, *PCLIWDS_PROXY_ENTRY;
#endif /* CLIENT_WDS */
#endif /* __CLIENT_WDS_CMM_H__ */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Cherokee
*
* Authors:
* Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Copyright (C) 2001-2010 Alvaro Lopez Ortega
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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 CHEROKEE_HANDLER_POST_REPORT_H
#define CHEROKEE_HANDLER_POST_REPORT_H
#include "common-internal.h"
#include "buffer.h"
#include "handler.h"
#include "dwriter.h"
#include "plugin_loader.h"
#include "connection.h"
/* Data types
*/
typedef struct {
cherokee_handler_props_t base;
cherokee_dwriter_lang_t lang;
} cherokee_handler_post_report_props_t;
typedef struct {
cherokee_handler_t handler;
cherokee_buffer_t buffer;
cherokee_dwriter_t writer;
} cherokee_handler_post_report_t;
#define HDL_POST_REPORT(x) ((cherokee_handler_post_report_t *)(x))
#define PROP_POST_REPORT(x) ((cherokee_handler_post_report_props_t *)(x))
#define HDL_POST_REPORT_PROPS(x) (PROP_POST_REPORT(MODULE(x)->props))
/* Library init function
*/
void PLUGIN_INIT_NAME(post_report) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_post_report_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
/* virtual methods implementation
*/
ret_t cherokee_handler_post_report_init (cherokee_handler_post_report_t *hdl);
ret_t cherokee_handler_post_report_free (cherokee_handler_post_report_t *hdl);
ret_t cherokee_handler_post_report_step (cherokee_handler_post_report_t *hdl, cherokee_buffer_t *buffer);
ret_t cherokee_handler_post_report_add_headers (cherokee_handler_post_report_t *hdl, cherokee_buffer_t *buffer);
#endif /* CHEROKEE_HANDLER_POST_REPORT_H */
|
/*
* Copyright 2011 Freescale Semiconductor, 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
*/
#include <common.h>
#include <asm/io.h>
#include <asm/fsl_serdes.h>
#include "fm.h"
struct fm_eth_info fm_info[] = {
#if (CONFIG_SYS_NUM_FM1_DTSEC >= 1)
FM_DTSEC_INFO_INITIALIZER(1, 1),
#endif
#if (CONFIG_SYS_NUM_FM1_DTSEC >= 2)
FM_DTSEC_INFO_INITIALIZER(1, 2),
#endif
#if (CONFIG_SYS_NUM_FM1_DTSEC >= 3)
FM_DTSEC_INFO_INITIALIZER(1, 3),
#endif
#if (CONFIG_SYS_NUM_FM1_DTSEC >= 4)
FM_DTSEC_INFO_INITIALIZER(1, 4),
#endif
#if (CONFIG_SYS_NUM_FM1_DTSEC >= 5)
FM_DTSEC_INFO_INITIALIZER(1, 5),
#endif
#if (CONFIG_SYS_NUM_FM2_DTSEC >= 1)
FM_DTSEC_INFO_INITIALIZER(2, 1),
#endif
#if (CONFIG_SYS_NUM_FM2_DTSEC >= 2)
FM_DTSEC_INFO_INITIALIZER(2, 2),
#endif
#if (CONFIG_SYS_NUM_FM2_DTSEC >= 3)
FM_DTSEC_INFO_INITIALIZER(2, 3),
#endif
#if (CONFIG_SYS_NUM_FM2_DTSEC >= 4)
FM_DTSEC_INFO_INITIALIZER(2, 4),
#endif
#if (CONFIG_SYS_NUM_FM2_DTSEC >= 5)
FM_DTSEC_INFO_INITIALIZER(2, 5),
#endif
#if (CONFIG_SYS_NUM_FM1_10GEC >= 1)
FM_TGEC_INFO_INITIALIZER(1, 1),
#endif
#if (CONFIG_SYS_NUM_FM2_10GEC >= 1)
FM_TGEC_INFO_INITIALIZER(2, 1),
#endif
};
int fm_standard_init(bd_t *bis)
{
int i;
struct ccsr_fman *reg;
reg = (void *)CONFIG_SYS_FSL_FM1_ADDR;
if (fm_init_common(0, reg))
return 0;
for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
if ((fm_info[i].enabled) && (fm_info[i].index == 1))
fm_eth_initialize(reg, &fm_info[i]);
}
#if (CONFIG_SYS_NUM_FMAN == 2)
reg = (void *)CONFIG_SYS_FSL_FM2_ADDR;
if (fm_init_common(1, reg))
return 0;
for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
if ((fm_info[i].enabled) && (fm_info[i].index == 2))
fm_eth_initialize(reg, &fm_info[i]);
}
#endif
return 1;
}
/* simple linear search to map from port to array index */
static int fm_port_to_index(enum fm_port port)
{
int i;
for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
if (fm_info[i].port == port)
return i;
}
return -1;
}
/*
* Determine if an interface is actually active based on HW config
* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if
* the interface is not active based on HW cfg of the SoC
*/
void fman_enet_init(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
phy_interface_t enet_if;
enet_if = fman_port_enet_if(fm_info[i].port);
if (enet_if != PHY_INTERFACE_MODE_NONE) {
fm_info[i].enabled = 1;
fm_info[i].enet_if = enet_if;
} else {
fm_info[i].enabled = 0;
}
}
return ;
}
void fm_disable_port(enum fm_port port)
{
int i = fm_port_to_index(port);
fm_info[i].enabled = 0;
fman_disable_port(port);
}
void fm_info_set_mdio(enum fm_port port, struct mii_dev *bus)
{
int i = fm_port_to_index(port);
if (i == -1)
return;
fm_info[i].bus = bus;
}
void fm_info_set_phy_address(enum fm_port port, int address)
{
int i = fm_port_to_index(port);
if (i == -1)
return;
fm_info[i].phy_addr = address;
}
/*
* Returns the PHY address for a given Fman port
*
* The port must be set via a prior call to fm_info_set_phy_address().
* A negative error code is returned if the port is invalid.
*/
int fm_info_get_phy_address(enum fm_port port)
{
int i = fm_port_to_index(port);
if (i == -1)
return -1;
return fm_info[i].phy_addr;
}
/*
* Returns the type of the data interface between the given MAC and its PHY.
* This is typically determined by the RCW.
*/
phy_interface_t fm_info_get_enet_if(enum fm_port port)
{
int i = fm_port_to_index(port);
if (i == -1)
return PHY_INTERFACE_MODE_NONE;
if (fm_info[i].enabled)
return fm_info[i].enet_if;
return PHY_INTERFACE_MODE_NONE;
}
static void
__def_board_ft_fman_fixup_port(void *blob, char * prop, phys_addr_t pa,
enum fm_port port, int offset)
{
return ;
}
void board_ft_fman_fixup_port(void *blob, char * prop, phys_addr_t pa,
enum fm_port port, int offset)
__attribute__((weak, alias("__def_board_ft_fman_fixup_port")));
static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
{
int off, ph;
phys_addr_t paddr = CONFIG_SYS_CCSRBAR_PHYS + info->compat_offset;
u64 dtsec1_addr = (u64)CONFIG_SYS_CCSRBAR_PHYS +
CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET;
off = fdt_node_offset_by_compat_reg(blob, prop, paddr);
if (info->enabled) {
fdt_fixup_phy_connection(blob, off, info->enet_if);
board_ft_fman_fixup_port(blob, prop, paddr, info->port, off);
return ;
}
/* board code might have caused offset to change */
off = fdt_node_offset_by_compat_reg(blob, prop, paddr);
/* Don't disable FM1-DTSEC1 MAC as its used for MDIO */
if (paddr != dtsec1_addr) {
/* disable the mac node */
fdt_setprop_string(blob, off, "status", "disabled");
}
/* disable the node point to the mac */
ph = fdt_get_phandle(blob, off);
do_fixup_by_prop(blob, "fsl,fman-mac", &ph, sizeof(ph),
"status", "disabled", strlen("disabled") + 1, 1);
}
void fdt_fixup_fman_ethernet(void *blob)
{
int i;
for (i = 0; i < ARRAY_SIZE(fm_info); i++) {
if (fm_info[i].type == FM_ETH_1G_E)
ft_fixup_port(blob, &fm_info[i], "fsl,fman-1g-mac");
else
ft_fixup_port(blob, &fm_info[i], "fsl,fman-10g-mac");
}
}
|
/*
* Copyright (C) 1996-2016 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#ifndef __WIN32_AIO_H__
#define __WIN32_AIO_H__
#if USE_DISKIO_AIO
#ifndef off64_t
typedef int64_t off64_t;
#endif
#if _SQUID_WINDOWS_
union sigval {
int sival_int; /* integer value */
void *sival_ptr; /* pointer value */
};
struct sigevent {
int sigev_notify; /* notification mode */
int sigev_signo; /* signal number */
union sigval sigev_value; /* signal value */
};
// #endif
struct aiocb64 {
int aio_fildes; /* file descriptor */
void *aio_buf; /* buffer location */
size_t aio_nbytes; /* length of transfer */
off64_t aio_offset; /* file offset */
int aio_reqprio; /* request priority offset */
struct sigevent aio_sigevent; /* signal number and offset */
int aio_lio_opcode; /* listio operation */
};
struct aiocb {
int aio_fildes; /* file descriptor */
void *aio_buf; /* buffer location */
size_t aio_nbytes; /* length of transfer */
#if (_FILE_OFFSET_BITS == 64)
off64_t aio_offset; /* file offset */
#else
off_t aio_offset; /* file offset */
#endif
int aio_reqprio; /* request priority offset */
struct sigevent aio_sigevent; /* signal number and offset */
int aio_lio_opcode; /* listio operation */
};
int aio_read(struct aiocb *);
int aio_write(struct aiocb *);
ssize_t aio_return(struct aiocb *);
int aio_error(const struct aiocb *);
int aio_read64(struct aiocb64 *);
int aio_write64(struct aiocb64 *);
ssize_t aio_return64(struct aiocb64 *);
int aio_error64(const struct aiocb64 *);
int aio_open(const char *, int);
void aio_close(int);
#endif /* _SQUID_WINDOWS_ */
#endif /* USE_DISKIO_AIO */
#endif /* __WIN32_AIO_H__ */
|
#ifndef lint
static char svnid[] = "Id: nifti_stats_mex.c 253 2005-10-13 15:31:34Z guillaume ";
#endif
/*
* This is a Matlab mex interface for Bob Cox's extensive nifti_stats.c
* functionality. See nifti_stats.m for documentation.
*/
/*
* niftilib $Id: nifti_stats_mex.c,v 1.1 2012/03/22 18:36:33 fissell Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mex.h"
#include "nifti1.h"
extern int nifti_intent_code( char *name );
extern double nifti_stat2cdf( double val, int code, double p1,double p2,double p3 );
extern double nifti_stat2rcdf( double val, int code, double p1,double p2,double p3 );
extern double nifti_stat2cdf( double val, int code, double p1,double p2,double p3 );
extern double nifti_cdf2stat( double val, int code, double p1,double p2,double p3 );
extern double nifti_stat2zscore( double val, int code, double p1,double p2,double p3 );
extern double nifti_stat2hzscore( double val, int code, double p1,double p2,double p3 );
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double *val, *p, p1=0.0,p2=0.0,p3=0.0 ;
int code=5, dop=1, doq=0, dod=0, doi=0, doz=0, doh=0 ;
int ndim, i, n;
const int *dim;
if (nlhs>1) mexErrMsgTxt("Too many output arguments.");
if (nrhs<1) mexErrMsgTxt("Not enough input arguments.");
if (nrhs>4) mexErrMsgTxt("Too many input arguments.");
/* VAL */
if (!mxIsNumeric(prhs[0]) || !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]))
mexErrMsgTxt("Wrong datatype for 1st argument.");
ndim = mxGetNumberOfDimensions(prhs[0]);
dim = mxGetDimensions(prhs[0]);
n = 1;
for(i=0,n=1; i<ndim; i++)
n = n*dim[i];
val = mxGetPr(prhs[0]);
/* CODE */
if (nrhs>=2)
{
if (mxIsChar(prhs[1]))
{
int buflen;
char *buf;
buflen = mxGetN(prhs[1])*mxGetM(prhs[1])+1;
buf = (char *)mxCalloc(buflen,sizeof(char));
mxGetString(prhs[1],buf,buflen);
code = nifti_intent_code(buf);
mxFree(buf);
}
else if (mxIsNumeric(prhs[1]) && mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]))
{
if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 1)
mexErrMsgTxt("Wrong sized 2nd argument.");
code = (int)mxGetPr(prhs[1])[0];
}
else mexErrMsgTxt("Wrong datatype for 2nd argument.");
if (code<NIFTI_FIRST_STATCODE || code>NIFTI_LAST_STATCODE)
mexErrMsgTxt("Illegal Stat-Code.");
}
/* OPT */
if (nrhs>=3)
{
int buflen;
char *buf;
dop = 0;
if (!mxIsChar(prhs[2]))
mexErrMsgTxt("Wrong datatype for3rd argument.");
buflen = mxGetN(prhs[2])*mxGetM(prhs[2])+1;
buf = (char *)mxCalloc(buflen,sizeof(char));
mxGetString(prhs[2],buf,buflen);
if ( strcmp(buf,"-p") == 0 ) dop = 1;
else if ( strcmp(buf,"-q") == 0 ) doq = 1;
else if ( strcmp(buf,"-d") == 0 ) dod = 1;
else if ( strcmp(buf,"-1") == 0 ) doi = 1;
else if ( strcmp(buf,"-z") == 0 ) doz = 1;
else if ( strcmp(buf,"-h") == 0 ) doh = 1;
else { mxFree(buf); mexErrMsgTxt("Unrecognised option."); }
mxFree(buf);
}
/* PARAM */
if (nrhs>=4)
{
int np;
if (!mxIsNumeric(prhs[3]) || !mxIsDouble(prhs[3]) || mxIsComplex(prhs[3]))
mexErrMsgTxt("Wrong datatype for 4th argument.");
np = mxGetM(prhs[3])*mxGetN(prhs[3]);
if (np>3) mexErrMsgTxt("Wrong sized 4th argument.");
if (np>=1) p1 = mxGetPr(prhs[3])[0];
if (np>=2) p2 = mxGetPr(prhs[3])[1];
if (np>=3) p3 = mxGetPr(prhs[3])[2];
}
/* P */
plhs[0] = mxCreateNumericArray(ndim,dim,mxDOUBLE_CLASS,mxREAL);
p = mxGetData(plhs[0]);
/* Call Bob's code */
for(i=0; i<n; i++)
{
if ( dop )
p[i] = nifti_stat2cdf(val[i], code,p1,p2,p3 ) ;
else if ( doq )
p[i] = nifti_stat2rcdf(val[i], code,p1,p2,p3 ) ;
else if ( dod )
p[i] = 1000.0*( nifti_stat2cdf(val[i]+.001,code,p1,p2,p3)
-nifti_stat2cdf(val[i] ,code,p1,p2,p3)) ;
else if ( doi )
p[i] = nifti_cdf2stat(val[i], code,p1,p2,p3 ) ;
else if ( doz )
p[i] = nifti_stat2zscore(val[i], code,p1,p2,p3 ) ;
else if ( doh )
p[i] = nifti_stat2hzscore(val[i], code,p1,p2,p3 ) ;
}
}
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.Text.RegularExpressions.Group[]
struct GroupU5BU5D_t491;
#include "mscorlib_System_Object.h"
// System.Text.RegularExpressions.GroupCollection
struct GroupCollection_t490 : public Object_t
{
// System.Text.RegularExpressions.Group[] System.Text.RegularExpressions.GroupCollection::list
GroupU5BU5D_t491* ___list_0;
// System.Int32 System.Text.RegularExpressions.GroupCollection::gap
int32_t ___gap_1;
};
|
#ifndef _SCHED_SYSCTL_H
#define _SCHED_SYSCTL_H
#ifdef CONFIG_DETECT_HUNG_TASK
extern unsigned int sysctl_hung_task_panic;
extern unsigned long sysctl_hung_task_check_count;
extern unsigned long sysctl_hung_task_timeout_secs;
extern unsigned long sysctl_hung_task_warnings;
extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos);
#else
/* Avoid need for ifdefs elsewhere in the code */
enum { sysctl_hung_task_timeout_secs = 0 };
#endif
/*
* Default maximum number of active map areas, this limits the number of vmas
* per mm struct. Users can overwrite this number by sysctl but there is a
* problem.
*
* When a program's coredump is generated as ELF format, a section is created
* per a vma. In ELF, the number of sections is represented in unsigned short.
* This means the number of sections should be smaller than 65535 at coredump.
* Because the kernel adds some informative sections to a image of program at
* generating coredump, we need some margin. The number of extra sections is
* 1-3 now and depends on arch. We use "5" as safe margin, here.
*/
#define MAPCOUNT_ELF_CORE_MARGIN (5)
#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
extern int sysctl_max_map_count;
extern unsigned int sysctl_sched_latency;
extern unsigned int sysctl_sched_min_granularity;
extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_child_runs_first;
extern unsigned int sysctl_sched_wake_to_idle;
#ifdef CONFIG_SCHED_DEBUG
extern __read_mostly unsigned int sysctl_sched_yield_sleep_duration;
extern __read_mostly int sysctl_sched_yield_sleep_threshold;
#else
extern const unsigned int sysctl_sched_yield_sleep_duration;
extern const int sysctl_sched_yield_sleep_threshold;
#endif
enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,
SCHED_TUNABLESCALING_LOG,
SCHED_TUNABLESCALING_LINEAR,
SCHED_TUNABLESCALING_END,
};
extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
#ifdef CONFIG_SCHED_DEBUG
extern unsigned int sysctl_sched_migration_cost;
extern unsigned int sysctl_sched_nr_migrate;
extern unsigned int sysctl_sched_time_avg;
extern unsigned int sysctl_timer_migration;
extern unsigned int sysctl_sched_shares_window;
int sched_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos);
#endif
#ifdef CONFIG_SCHED_DEBUG
static inline unsigned int get_sysctl_timer_migration(void)
{
return sysctl_timer_migration;
}
#else
static inline unsigned int get_sysctl_timer_migration(void)
{
return 1;
}
#endif
/*
* control realtime throttling:
*
* /proc/sys/kernel/sched_rt_period_us
* /proc/sys/kernel/sched_rt_runtime_us
*/
extern unsigned int sysctl_sched_rt_period;
extern int sysctl_sched_rt_runtime;
#ifdef CONFIG_CFS_BANDWIDTH
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
#endif
#ifdef CONFIG_SCHED_AUTOGROUP
extern unsigned int sysctl_sched_autogroup_enabled;
#endif
/*
* default timeslice is 100 msecs (used only for SCHED_RR tasks).
* Timeslices get refilled after they expire.
*/
#define RR_TIMESLICE (100 * HZ / 1000)
extern int sched_rr_timeslice;
extern int sched_rr_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
extern int sched_rt_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
#endif /* _SCHED_SYSCTL_H */
|
/*
* Author: MontaVista Software, Inc. <source@mvista.com>
*
* 2005 (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(63);
}
module_init(regpatch);
|
/* packet-ethercat-frame.c
* Routines for ethercat packet disassembly
*
* Copyright (c) 2007 by Beckhoff Automation GmbH
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*/
/* Include files */
#include "config.h"
#include <epan/packet.h>
#include <epan/etypes.h>
#include "packet-ethercat-frame.h"
void proto_register_ethercat_frame(void);
void proto_reg_handoff_ethercat_frame(void);
/* Define the Ethercat frame proto */
static int proto_ethercat_frame = -1;
static dissector_table_t ethercat_frame_dissector_table;
static dissector_handle_t ethercat_frame_data_handle;
/* Define the tree for the EtherCAT frame */
static int ett_ethercat_frame = -1;
static int hf_ethercat_frame_length = -1;
static int hf_ethercat_frame_reserved = -1;
static int hf_ethercat_frame_type = -1;
static const value_string EthercatFrameTypes[] =
{
{ 1, "EtherCAT command", },
{ 2, "ADS", },
{ 3, "RAW-IO", },
{ 4, "NV", },
{ 0, NULL }
};
static const value_string ethercat_frame_reserved_vals[] =
{
{ 0, "Valid"},
{ 1, "Invalid (must be zero for conformance with the protocol specification)"},
{ 0, NULL}
};
/* Ethercat Frame */
static int dissect_ethercat_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
tvbuff_t *next_tvb;
proto_item *ti;
proto_tree *ethercat_frame_tree;
gint offset = 0;
EtherCATFrameParserHDR hdr;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECATF");
col_clear(pinfo->cinfo, COL_INFO);
if (tree)
{
ti = proto_tree_add_item(tree, proto_ethercat_frame, tvb, offset, EtherCATFrameParserHDR_Len, ENC_NA);
ethercat_frame_tree = proto_item_add_subtree(ti, ett_ethercat_frame);
proto_tree_add_item(ethercat_frame_tree, hf_ethercat_frame_length, tvb, offset, EtherCATFrameParserHDR_Len, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ethercat_frame_tree, hf_ethercat_frame_reserved, tvb, offset, EtherCATFrameParserHDR_Len, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ethercat_frame_tree, hf_ethercat_frame_type, tvb, offset, EtherCATFrameParserHDR_Len, ENC_LITTLE_ENDIAN);
}
hdr.hdr = tvb_get_letohs(tvb, offset);
offset = EtherCATFrameParserHDR_Len;
/* The EtherCAT frame header has now been processed, allow sub dissectors to
handle the rest of the PDU. */
next_tvb = tvb_new_subset_remaining (tvb, offset);
if (!dissector_try_uint(ethercat_frame_dissector_table, hdr.v.protocol,
next_tvb, pinfo, tree))
{
col_add_fstr (pinfo->cinfo, COL_PROTOCOL, "0x%04x", hdr.v.protocol);
/* No sub dissector wanted to handle this payload, decode it as general
data instead. */
call_dissector (ethercat_frame_data_handle, next_tvb, pinfo, tree);
}
return tvb_captured_length(tvb);
}
void proto_register_ethercat_frame(void)
{
static hf_register_info hf[] =
{
{ &hf_ethercat_frame_length,
{ "Length", "ecatf.length",
FT_UINT16, BASE_HEX, NULL, 0x07FF,
NULL, HFILL }
},
{ &hf_ethercat_frame_reserved,
{ "Reserved", "ecatf.reserved",
FT_UINT16, BASE_HEX, VALS(ethercat_frame_reserved_vals), 0x0800,
NULL, HFILL}
},
{ &hf_ethercat_frame_type,
{ "Type", "ecatf.type",
FT_UINT16, BASE_HEX, VALS(EthercatFrameTypes), 0xF000,
"E88A4 Types", HFILL }
}
};
static gint *ett[] =
{
&ett_ethercat_frame
};
proto_ethercat_frame = proto_register_protocol("EtherCAT frame header",
"ETHERCAT","ethercat");
proto_register_field_array(proto_ethercat_frame,hf,array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("ecatf", dissect_ethercat_frame, proto_ethercat_frame);
/* Define a handle (ecatf.type) for sub dissectors that want to dissect
the Ethercat frame ether type (E88A4) payload. */
ethercat_frame_dissector_table = register_dissector_table("ecatf.type",
"EtherCAT frame type", FT_UINT8, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
}
void proto_reg_handoff_ethercat_frame(void)
{
dissector_handle_t ethercat_frame_handle;
ethercat_frame_handle = find_dissector("ecatf");
dissector_add_uint("ethertype", ETHERTYPE_ECATF, ethercat_frame_handle);
dissector_add_uint("udp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
dissector_add_uint("tcp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
ethercat_frame_data_handle = find_dissector("data");
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 3
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=3 tabstop=8 expandtab:
* :indentSize=3:tabSize=8:noTabs=true:
*/
|
/*=================================================================
File created by Yohann NICOLAS.
Uber Quest Management.
=================================================================*/
#pragma once
#include "common.h"
extern bool active_UberQuest;
void Install_UberQuest();
void resetQuestState();
/*================================= END OF FILE =================================*/ |
/*
* This file is part of TBO, a gnome comic editor
* Copyright (C) 2010 Daniel Garcia Moreno <dani@danigm.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 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 __UI_MENU__
#define __UI_MENU__
#include <gtk/gtk.h>
#include "tbo-window.h"
GtkWidget *generate_menu (TboWindow *window);
void update_menubar (TboWindow *tbo);
void tbo_menu_disable_accel_keys (TboWindow *tbo);
void tbo_menu_enable_accel_keys (TboWindow *tbo);
#endif
|
/* gdbmexists.c - Check to see if a key exists */
/* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
Copyright (C) 1993 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GDBM 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 GDBM; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
You may contact the original author by:
e-mail: phil@cs.wwu.edu
us-mail: Philip A. Nelson
Computer Science Department
Western Washington University
Bellingham, WA 98226
The author of this file is:
e-mail: downsj@downsj.com
*************************************************************************/
/* include system configuration before all else. */
#include <gdbm/autoconf.h>
#include <gdbm/gdbmdefs.h>
#include <gdbm/gdbmerrno.h>
/* this is nothing more than a wrapper around _gdbm_findkey(). the
point? it doesn't alloate any memory. */
int
gdbm_exists (dbf, key)
gdbm_file_info *dbf;
datum key;
{
char *find_data; /* dummy */
int hash_val; /* dummy */
return (_gdbm_findkey (dbf, key, &find_data, &hash_val) >= 0);
}
|
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2016 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#ifndef _ROLLING_MATRIX_H
#define _ROLLING_MATRIX_H
// Temporary, just to get going.
typedef vector< double > SparseVector;
class RollingMatrix
{
public:
// Specify empty matrix.
RollingMatrix();
~RollingMatrix();
RollingMatrix& operator=( const RollingMatrix& other );
// Specify size of matrix. Allocations may happen later.
void resize( unsigned int numRows, unsigned int numColumns );
// Return specified entry.
double get( unsigned int row, unsigned int column ) const;
// Sum contents of input into entry at specfied row, column.
// Row index is relative to current zero.
void sumIntoEntry( double input, unsigned int row, unsigned int column );
// Sum contents of input into vector at specfied row.
// Row index is relative to current zero.
void sumIntoRow( const vector< double >& input, unsigned int row );
// Return dot product of input with internal vector at specified
// row, starting at specified column.
double dotProduct( const vector< double >& input, unsigned int row,
unsigned int startColumn ) const;
// Return correlation found by summing dotProduct across all columns
void correl( vector< double >& ret, const vector< double >& input,
unsigned int row ) const;
// Zero out contents of row.
void zeroOutRow( unsigned int row );
// Roll the matrix by one row. What was row 0 becomes row 1, etc.
// Last row vanishes.
void rollToNextRow(); //
private:
unsigned int nrows_;
unsigned int ncolumns_;
unsigned int currentStartRow_;
vector< SparseVector > rows_;
};
#endif // _ROLLING_MATRIX
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2001,2007 Oracle. All rights reserved.
*
* $Id: db_truncate.c,v 12.22 2007/05/17 15:14:57 bostic Exp $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/hash.h"
#include "dbinc/qam.h"
#include "dbinc/lock.h"
#include "dbinc/log.h"
#include "dbinc/txn.h"
static int __db_cursor_check __P((DB *));
/*
* __db_truncate_pp
* DB->truncate pre/post processing.
*
* PUBLIC: int __db_truncate_pp __P((DB *, DB_TXN *, u_int32_t *, u_int32_t));
*/
int
__db_truncate_pp(dbp, txn, countp, flags)
DB *dbp;
DB_TXN *txn;
u_int32_t *countp, flags;
{
DB_ENV *dbenv;
DB_THREAD_INFO *ip;
int handle_check, ret, t_ret, txn_local;
dbenv = dbp->dbenv;
txn_local = 0;
handle_check = 0;
PANIC_CHECK(dbenv);
STRIP_AUTO_COMMIT(flags);
/* Check for invalid flags. */
if (F_ISSET(dbp, DB_AM_SECONDARY)) {
__db_errx(dbenv,
"DB->truncate forbidden on secondary indices");
return (EINVAL);
}
if ((ret = __db_fchk(dbenv, "DB->truncate", flags, 0)) != 0)
return (ret);
ENV_ENTER(dbenv, ip);
/*
* Make sure there are no active cursors on this db. Since we drop
* pages we cannot really adjust cursors.
*/
if (__db_cursor_check(dbp) != 0) {
__db_errx(dbenv,
"DB->truncate not permitted with active cursors");
goto err;
}
#ifdef CONFIG_TEST
if (IS_REP_MASTER(dbenv))
DB_TEST_WAIT(dbenv, dbenv->test_check);
#endif
/* Check for replication block. */
handle_check = IS_ENV_REPLICATED(dbenv);
if (handle_check &&
(ret = __db_rep_enter(dbp, 1, 0, txn != NULL)) != 0) {
handle_check = 0;
goto err;
}
/*
* Check for changes to a read-only database.
* This must be after the replication block so that we
* cannot race master/client state changes.
*/
if (DB_IS_READONLY(dbp)) {
ret = __db_rdonly(dbenv, "DB->truncate");
goto err;
}
/*
* Create local transaction as necessary, check for consistent
* transaction usage.
*/
if (IS_DB_AUTO_COMMIT(dbp, txn)) {
if ((ret = __txn_begin(dbenv, NULL, &txn, 0)) != 0)
goto err;
txn_local = 1;
}
/* Check for consistent transaction usage. */
if ((ret = __db_check_txn(dbp, txn, DB_LOCK_INVALIDID, 0)) != 0)
goto err;
ret = __db_truncate(dbp, txn, countp);
err: if (txn_local &&
(t_ret = __db_txn_auto_resolve(dbenv, txn, 0, ret)) && ret == 0)
ret = t_ret;
/* Release replication block. */
if (handle_check && (t_ret = __env_db_rep_exit(dbenv)) != 0 && ret == 0)
ret = t_ret;
ENV_LEAVE(dbenv, ip);
return (ret);
}
/*
* __db_truncate
* DB->truncate.
*
* PUBLIC: int __db_truncate __P((DB *, DB_TXN *, u_int32_t *));
*/
int
__db_truncate(dbp, txn, countp)
DB *dbp;
DB_TXN *txn;
u_int32_t *countp;
{
DB *sdbp;
DBC *dbc;
DB_ENV *dbenv;
u_int32_t scount;
int ret, t_ret;
dbenv = dbp->dbenv;
dbc = NULL;
ret = 0;
/*
* Run through all secondaries and truncate them first. The count
* returned is the count of the primary only. QUEUE uses normal
* processing to truncate so it will update the secondaries normally.
*/
if (dbp->type != DB_QUEUE && LIST_FIRST(&dbp->s_secondaries) != NULL) {
if ((ret = __db_s_first(dbp, &sdbp)) != 0)
return (ret);
for (; sdbp != NULL && ret == 0; ret = __db_s_next(&sdbp, txn))
if ((ret = __db_truncate(sdbp, txn, &scount)) != 0)
break;
if (sdbp != NULL)
(void)__db_s_done(sdbp, txn);
if (ret != 0)
return (ret);
}
DB_TEST_RECOVERY(dbp, DB_TEST_PREDESTROY, ret, NULL);
/* Acquire a cursor. */
if ((ret = __db_cursor(dbp, txn, &dbc, 0)) != 0)
return (ret);
DEBUG_LWRITE(dbc, txn, "DB->truncate", NULL, NULL, 0);
switch (dbp->type) {
case DB_BTREE:
case DB_RECNO:
ret = __bam_truncate(dbc, countp);
break;
case DB_HASH:
ret = __ham_truncate(dbc, countp);
break;
case DB_QUEUE:
ret = __qam_truncate(dbc, countp);
break;
case DB_UNKNOWN:
default:
ret = __db_unknown_type(dbenv, "DB->truncate", dbp->type);
break;
}
/* Discard the cursor. */
if (dbc != NULL && (t_ret = __dbc_close(dbc)) != 0 && ret == 0)
ret = t_ret;
DB_TEST_RECOVERY(dbp, DB_TEST_POSTDESTROY, ret, NULL);
DB_TEST_RECOVERY_LABEL
return (ret);
}
/*
* __db_cursor_check --
* See if there are any active cursors on this db.
*/
static int
__db_cursor_check(dbp)
DB *dbp;
{
DB *ldbp;
DBC *dbc;
DB_ENV *dbenv;
int found;
dbenv = dbp->dbenv;
MUTEX_LOCK(dbenv, dbenv->mtx_dblist);
FIND_FIRST_DB_MATCH(dbenv, dbp, ldbp);
for (found = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(dbenv, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links)
if (IS_INITIALIZED(dbc)) {
found = 1;
break;
}
MUTEX_UNLOCK(dbenv, dbp->mutex);
if (found == 1)
break;
}
MUTEX_UNLOCK(dbenv, dbenv->mtx_dblist);
return (found);
}
|
/**
* Gamma Combination
* Author: Till Moritz Karbach, moritz.karbach@cern.ch
* Date: August 2012
*
**/
#ifndef OneMinusClPlot_h
#define OneMinusClPlot_h
#include "OneMinusClPlotAbs.h"
#include "TGraphTools.h"
#include "Utils.h"
#include "Rounder.h"
using namespace Utils;
using namespace RooFit;
using namespace std;
class OneMinusClPlot : public OneMinusClPlotAbs
{
public:
OneMinusClPlot(OptParser *arg, TString name="c1", TString title="c1");
void drawSolutions();
void drawCLguideLines();
TGraph* getGraph(MethodAbsScan* s, bool first=true, bool last=false, bool filled=true){return scan1dPlot(s,first,last,filled);};
inline TString getName(){return name;};
inline void setPluginMarkers(bool yesNo=true){plotPluginMarkers = yesNo;};
void Draw();
private:
void drawCLguideLine(float pvalue);
void drawVerticalLine(float x, int color, int style);
TGraph* scan1dPlot(MethodAbsScan* s, bool first, bool last, bool filled);
void scan1dPlotSimple(MethodAbsScan* s, bool first);
bool plotPluginMarkers;
};
#endif
|
int main(void)
{
volatile int stack1 = 0;
return 0;
}
|
#include <stdio.h>
#include <stdlib.h>
#include "header1.h"
/* Main function which reads values into two double arrays and calls
calc_diff to calculate the difference and outputs the values to file.
*/
void main() {
double *x, *y, *z;
int vecsize;
int check = read_vecs(&vecsize, &x, &y);
if (check == -1) {
printf("Input format error\n");
} else {
int i;
/*for (i = 0; i < vecsize; i++) {
printf("%f\n", (*x + i));
printf("%f\n", (*y + i));
}*/
z = (double *) malloc(sizeof(double) * vecsize);
calc_diff(vecsize, x, y, z);
FILE *fp;
fp = fopen("vector_out.dat", "w");
for (i = 0; i < vecsize; i++) {
fprintf(fp, "%f\n", z[i]);
}
fclose(fp);
}
}
|
/*
* Copyright 2011-2013 Blender Foundation
*
* 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.
*/
CCL_NAMESPACE_BEGIN
/* Attribute Node */
ccl_device AttributeDescriptor svm_node_attr_init(KernelGlobals *kg, ShaderData *sd,
uint4 node, NodeAttributeType *type,
uint *out_offset)
{
*out_offset = node.z;
*type = (NodeAttributeType)node.w;
AttributeDescriptor desc;
if(ccl_fetch(sd, object) != OBJECT_NONE) {
desc = find_attribute(kg, sd, node.y);
if(desc.offset == ATTR_STD_NOT_FOUND) {
desc = attribute_not_found();
desc.offset = 0;
desc.type = (NodeAttributeType)node.w;
}
}
else {
/* background */
desc = attribute_not_found();
desc.offset = 0;
desc.type = (NodeAttributeType)node.w;
}
return desc;
}
ccl_device void svm_node_attr(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
{
NodeAttributeType type;
uint out_offset;
AttributeDescriptor desc = svm_node_attr_init(kg, sd, node, &type, &out_offset);
/* fetch and store attribute */
if(type == NODE_ATTR_FLOAT) {
if(desc.type == NODE_ATTR_FLOAT) {
float f = primitive_attribute_float(kg, sd, desc, NULL, NULL);
stack_store_float(stack, out_offset, f);
}
else {
float3 f = primitive_attribute_float3(kg, sd, desc, NULL, NULL);
stack_store_float(stack, out_offset, average(f));
}
}
else {
if(desc.type == NODE_ATTR_FLOAT3) {
float3 f = primitive_attribute_float3(kg, sd, desc, NULL, NULL);
stack_store_float3(stack, out_offset, f);
}
else {
float f = primitive_attribute_float(kg, sd, desc, NULL, NULL);
stack_store_float3(stack, out_offset, make_float3(f, f, f));
}
}
}
#ifndef __KERNEL_CUDA__
ccl_device
#else
ccl_device_noinline
#endif
void svm_node_attr_bump_dx(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
{
NodeAttributeType type;
uint out_offset;
AttributeDescriptor desc = svm_node_attr_init(kg, sd, node, &type, &out_offset);
/* fetch and store attribute */
if(type == NODE_ATTR_FLOAT) {
if(desc.type == NODE_ATTR_FLOAT) {
float dx;
float f = primitive_attribute_float(kg, sd, desc, &dx, NULL);
stack_store_float(stack, out_offset, f+dx);
}
else {
float3 dx;
float3 f = primitive_attribute_float3(kg, sd, desc, &dx, NULL);
stack_store_float(stack, out_offset, average(f+dx));
}
}
else {
if(desc.type == NODE_ATTR_FLOAT3) {
float3 dx;
float3 f = primitive_attribute_float3(kg, sd, desc, &dx, NULL);
stack_store_float3(stack, out_offset, f+dx);
}
else {
float dx;
float f = primitive_attribute_float(kg, sd, desc, &dx, NULL);
stack_store_float3(stack, out_offset, make_float3(f+dx, f+dx, f+dx));
}
}
}
#ifndef __KERNEL_CUDA__
ccl_device
#else
ccl_device_noinline
#endif
void svm_node_attr_bump_dy(KernelGlobals *kg,
ShaderData *sd,
float *stack,
uint4 node)
{
NodeAttributeType type;
uint out_offset;
AttributeDescriptor desc = svm_node_attr_init(kg, sd, node, &type, &out_offset);
/* fetch and store attribute */
if(type == NODE_ATTR_FLOAT) {
if(desc.type == NODE_ATTR_FLOAT) {
float dy;
float f = primitive_attribute_float(kg, sd, desc, NULL, &dy);
stack_store_float(stack, out_offset, f+dy);
}
else {
float3 dy;
float3 f = primitive_attribute_float3(kg, sd, desc, NULL, &dy);
stack_store_float(stack, out_offset, average(f+dy));
}
}
else {
if(desc.type == NODE_ATTR_FLOAT3) {
float3 dy;
float3 f = primitive_attribute_float3(kg, sd, desc, NULL, &dy);
stack_store_float3(stack, out_offset, f+dy);
}
else {
float dy;
float f = primitive_attribute_float(kg, sd, desc, NULL, &dy);
stack_store_float3(stack, out_offset, make_float3(f+dy, f+dy, f+dy));
}
}
}
CCL_NAMESPACE_END
|
/* Tests of readlinkat.
Copyright (C) 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake <ebb9@byu.net>, 2009. */
#include <config.h>
#include <unistd.h>
#include "signature.h"
SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t));
#include <fcntl.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "ignore-value.h"
#include "macros.h"
#ifndef HAVE_SYMLINK
# define HAVE_SYMLINK 0
#endif
#define BASE "test-readlinkat.t"
#include "test-readlink.h"
static int dfd = AT_FDCWD;
static ssize_t
do_readlink (char const *name, char *buf, size_t len)
{
return readlinkat (dfd, name, buf, len);
}
int
main (void)
{
char buf[80];
int result;
/* Remove any leftovers from a previous partial run. */
ignore_value (system ("rm -rf " BASE "*"));
/* Test behaviour for invalid file descriptors. */
{
errno = 0;
ASSERT (readlinkat (-1, "foo", buf, sizeof buf) == -1);
ASSERT (errno == EBADF);
}
{
close (99);
errno = 0;
ASSERT (readlinkat (99, "foo", buf, sizeof buf) == -1);
ASSERT (errno == EBADF);
}
/* Perform same checks as counterpart functions. */
result = test_readlink (do_readlink, false);
dfd = openat (AT_FDCWD, ".", O_RDONLY);
ASSERT (0 <= dfd);
ASSERT (test_readlink (do_readlink, false) == result);
/* Now perform some cross-directory checks. Skip everything else on
mingw. */
if (HAVE_SYMLINK)
{
const char *contents = "don't matter!";
ssize_t exp = strlen (contents);
/* Create link while cwd is '.', then read it in '..'. */
ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == 0);
errno = 0;
ASSERT (symlinkat (contents, dfd, BASE "link") == -1);
ASSERT (errno == EEXIST);
ASSERT (chdir ("..") == 0);
errno = 0;
ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == -1);
ASSERT (errno == ENOENT);
ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
ASSERT (strncmp (contents, buf, exp) == 0);
ASSERT (unlinkat (dfd, BASE "link", 0) == 0);
/* Create link while cwd is '..', then read it in '.'. */
ASSERT (symlinkat (contents, dfd, BASE "link") == 0);
ASSERT (fchdir (dfd) == 0);
errno = 0;
ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == -1);
ASSERT (errno == EEXIST);
buf[0] = '\0';
ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == exp);
ASSERT (strncmp (contents, buf, exp) == 0);
buf[0] = '\0';
ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
ASSERT (strncmp (contents, buf, exp) == 0);
ASSERT (unlink (BASE "link") == 0);
}
ASSERT (close (dfd) == 0);
if (result == 77)
fputs ("skipping test: symlinks not supported on this file system\n",
stderr);
return result;
}
|
//
// HotWKWebViewViewController.h
// iBeeboPro
//
// Created by 迪远 王 on 2018/9/19.
// Copyright © 2018年 andforce. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HotWKWebViewViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
|
/*
This file is part of Darling.
Copyright (C) 2017 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface CNPostalAddress : NSObject
@end
|
/***********************************************************************
* pc_util.c
*
* Handy functions used by the library.
*
* PgSQL Pointcloud is free and open source software provided
* by the Government of Canada
* Copyright (c) 2013 Natural Resources Canada
*
***********************************************************************/
#include "pc_api_internal.h"
#include <float.h>
/**********************************************************************************
* WKB AND ENDIANESS UTILITIES
*/
/* Our static character->number map. Anything > 15 is invalid */
static uint8_t hex2char[256] =
{
/* not Hex characters */
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
/* 0-9 */
0,1,2,3,4,5,6,7,8,9,20,20,20,20,20,20,
/* A-F */
20,10,11,12,13,14,15,20,20,20,20,20,20,20,20,20,
/* not Hex characters */
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
/* a-f */
20,10,11,12,13,14,15,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
/* not Hex characters (upper 128 characters) */
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
};
uint8_t*
bytes_from_hexbytes(const char *hexbuf, size_t hexsize)
{
uint8_t *buf = NULL;
register uint8_t h1, h2;
int i;
if( hexsize % 2 )
pcerror("Invalid hex string, length (%d) has to be a multiple of two!", hexsize);
buf = pcalloc(hexsize/2);
if( ! buf )
pcerror("Unable to allocate memory buffer.");
for( i = 0; i < hexsize/2; i++ )
{
h1 = hex2char[(int)hexbuf[2*i]];
h2 = hex2char[(int)hexbuf[2*i+1]];
if( h1 > 15 )
pcerror("Invalid hex character (%c) encountered", hexbuf[2*i]);
if( h2 > 15 )
pcerror("Invalid hex character (%c) encountered", hexbuf[2*i+1]);
/* First character is high bits, second is low bits */
buf[i] = ((h1 & 0x0F) << 4) | (h2 & 0x0F);
}
return buf;
}
char*
hexbytes_from_bytes(const uint8_t *bytebuf, size_t bytesize)
{
char *buf = pcalloc(2*bytesize + 1); /* 2 chars per byte + null terminator */
int i;
char *ptr = buf;
for ( i = 0; i < bytesize; i++ )
{
int incr = snprintf(ptr, 3, "%02X", bytebuf[i]);
if ( incr < 0 )
{
pcerror("write failure in hexbytes_from_bytes");
return NULL;
}
ptr += incr;
}
return buf;
}
char
machine_endian(void)
{
static int check_int = 1; /* dont modify this!!! */
return *((char *) &check_int); /* 0 = big endian | xdr,
* 1 = little endian | ndr
*/
}
int32_t
int32_flip_endian(int32_t val)
{
int i;
uint8_t tmp;
uint8_t b[4];
memcpy(b, &val, 4);
for ( i = 0; i < 2; i++ )
{
tmp = b[i];
b[i] = b[3-i];
b[3-i] = tmp;
}
memcpy(&val, b, 4);
return val;
}
int16_t
int16_flip_endian(int16_t val)
{
uint8_t tmp;
uint8_t b[2];
memcpy(b, &val, 2);
tmp = b[0];
b[0] = b[1];
b[1] = tmp;
memcpy(&val, b, 2);
return val;
}
int32_t
wkb_get_int32(const uint8_t *wkb, int flip_endian)
{
int32_t i;
memcpy(&i, wkb, 4);
if ( flip_endian )
return int32_flip_endian(i);
else
return i;
}
int16_t
wkb_get_int16(const uint8_t *wkb, int flip_endian)
{
int16_t i;
memcpy(&i, wkb, 2);
if ( flip_endian )
return int16_flip_endian(i);
else
return i;
}
uint32_t
wkb_get_pcid(const uint8_t *wkb)
{
/* We expect the bytes to be in WKB format for PCPOINT/PCPATCH */
/* byte 0: endian */
/* byte 1-4: pcid */
/* ...data... */
uint32_t pcid;
memcpy(&pcid, wkb + 1, 4);
if ( wkb[0] != machine_endian() )
{
pcid = int32_flip_endian(pcid);
}
return pcid;
}
uint32_t
wkb_get_compression(const uint8_t *wkb)
{
/* We expect the bytes to be in WKB format for PCPATCH */
/* byte 0: endian */
/* byte 1-4: pcid */
/* byte 5-8: compression */
/* ...data... */
uint32_t compression;
memcpy(&compression, wkb+1+4, 4);
if ( wkb[0] != machine_endian() )
{
compression = int32_flip_endian(compression);
}
return compression;
}
uint32_t
wkb_get_npoints(const uint8_t *wkb)
{
/* We expect the bytes to be in WKB format for PCPATCH */
/* byte 0: endian */
/* byte 1-4: pcid */
/* byte 5-8: compression */
/* byte 9-12: npoints */
/* ...data... */
uint32_t npoints;
memcpy(&npoints, wkb+1+4+4, 4);
if ( wkb[0] != machine_endian() )
{
npoints = int32_flip_endian(npoints);
}
return npoints;
}
uint8_t*
uncompressed_bytes_flip_endian(const uint8_t *bytebuf, const PCSCHEMA *schema, uint32_t npoints)
{
int i, j, k;
size_t bufsize = schema->size * npoints;
uint8_t *buf = pcalloc(bufsize);
memcpy(buf, bytebuf, bufsize);
for ( i = 0; i < npoints ; i++ )
{
for ( j = 0; j < schema->ndims; j++ )
{
PCDIMENSION *dimension = schema->dims[j];
uint8_t *ptr = buf + i * schema->size + dimension->byteoffset;
for ( k = 0; k < ((dimension->size)/2); k++ )
{
int l = dimension->size - k - 1;
uint8_t tmp = ptr[k];
ptr[k] = ptr[l];
ptr[l] = tmp;
}
}
}
return buf;
}
int
pc_bounds_intersects(const PCBOUNDS *b1, const PCBOUNDS *b2)
{
if ( b1->xmin > b2->xmax ||
b1->xmax < b2->xmin ||
b1->ymin > b2->ymax ||
b1->ymax < b2->ymin )
{
return PC_FALSE;
}
return PC_TRUE;
}
void
pc_bounds_init(PCBOUNDS *b)
{
b->xmin = b->ymin = DBL_MAX;
b->xmax = b->ymax = -1*DBL_MAX;
}
void pc_bounds_merge(PCBOUNDS *b1, const PCBOUNDS *b2)
{
if ( b2->xmin < b1->xmin ) b1->xmin = b2->xmin;
if ( b2->ymin < b1->ymin ) b1->ymin = b2->ymin;
if ( b2->xmax > b1->xmax ) b1->xmax = b2->xmax;
if ( b2->ymax > b1->ymax ) b1->ymax = b2->ymax;
}
|
/*
Copyright (C) 2008-2013 Jaroslav Hajek
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_DET_h)
#define octave_DET_h 1
#include <cmath>
#include "oct-cmplx.h"
#include "lo-mappers.h"
template <class T>
class
base_det
{
public:
base_det (T c = 1, int e = 0)
: c2 (), e2 ()
{
c2 = xlog2 (c, e2);
e2 += e;
}
base_det (T c, double e, double b)
: c2 (), e2 ()
{
e *= xlog2 (b);
e2 = e;
c *= xexp2 (e - e2);
int f;
c2 = xlog2 (c, f);
e2 += f;
}
base_det (const base_det& a) : c2 (a.c2), e2 (a.e2) { }
base_det& operator = (const base_det& a)
{
c2 = a.c2;
e2 = a.e2;
return *this;
}
T coef (void) const { return c2; }
int exp (void) const { return e2; }
T value () const { return c2 * static_cast<T> (std::ldexp (1.0, e2)); }
operator T () const { return value (); }
base_det square () const { return base_det (c2*c2, e2+e2); }
void operator *= (T t)
{
int e;
c2 *= xlog2 (t, e);
e2 += e;
}
private:
T c2;
int e2;
};
// Provide the old types by typedefs.
typedef base_det<double> DET;
typedef base_det<float> FloatDET;
typedef base_det<Complex> ComplexDET;
typedef base_det<FloatComplex> FloatComplexDET;
#endif
|
/*
SCRplus - (c) Edward Cree 2010-12
Licensed under the GNU GPL v3+
*/
#include "colourspace.h"
#include <stdlib.h>
void rgbtoyuv(const rgb_t rgb, yuv_t yuv)
{
yuv[0]=(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16.0;
yuv[1]=-(0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]) + 128.0;
yuv[2]=(0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]) + 128.0;
}
void yuvtorgb(const yuv_t yuv, rgb_t rgb)
{
rgb[2]=min(max(1.164*(yuv[0]-16.0)+2.018*(yuv[1]-128.0), 0), 255);
rgb[1]=min(max(1.164*(yuv[0]-16.0)-0.813*(yuv[2]-128.0)-0.391*(yuv[1]-128.0), 0), 255);
rgb[0]=min(max(1.164*(yuv[0]-16.0)+1.596*(yuv[2]-128.0), 0), 255);
}
double yuvdist(const yuv_t pal, const yuv_t dat)
{
return(fabs(pal[0]-dat[0])+fabs(pal[1]-dat[1])+fabs(pal[2]-dat[2]));
}
void rgbtohsv(const rgb_t rgb, hsv_t hsv)
{
// based on https://en.wikipedia.org/wiki/HSL_and_HSV
unsigned char M=0, m=255;
for(unsigned int i=0;i<3;i++)
{
M=max(M, rgb[i]);
m=min(m, rgb[i]);
}
double hp; // H'
unsigned char C=M-m; // Chroma
if(!C)
hp=0; // really undefined
else if(M==rgb[0])
hp=fmod((rgb[1]-rgb[2])/(double)C, 6);
else if(M==rgb[1])
hp=(rgb[2]-rgb[0])/(double)C+2;
else
hp=(rgb[0]-rgb[1])/(double)C+4;
hsv[2]=floor(hp*255/6.0); // Hue
hsv[0]=M; // Value
if(M)
hsv[1]=(C*255)/M; // Saturation
else
hsv[1]=0;
}
unsigned char clamp(int i)
{
if(i<0) return(0);
if(i>255) return(255);
return(i);
}
void hsvtorgb(const hsv_t hsv, rgb_t rgb)
{
double hp=hsv[2]*6/255.0; // H'
double C=hsv[1]*hsv[0]/255;
double x=C*(1-fabs(fmod(hp, 2)-1));
int m=hsv[0]-C;
int fh=floor(hp);
switch(fh%6)
{
case 0:
rgb[0]=clamp(C+m);
rgb[1]=clamp(x+m);
rgb[2]=clamp(m);
break;
case 1:
rgb[0]=clamp(x+m);
rgb[1]=clamp(C+m);
rgb[2]=clamp(m);
break;
case 2:
rgb[0]=clamp(m);
rgb[1]=clamp(C+m);
rgb[2]=clamp(x+m);
break;
case 3:
rgb[0]=clamp(m);
rgb[1]=clamp(x+m);
rgb[2]=clamp(C+m);
break;
case 4:
rgb[0]=clamp(x+m);
rgb[1]=clamp(m);
rgb[2]=clamp(C+m);
break;
case 5:
rgb[0]=clamp(C+m);
rgb[1]=clamp(m);
rgb[2]=clamp(x+m);
break;
}
}
|
/**
* This file is part of a demo that shows how to use RT2D, a 2D OpenGL framework.
*
* - Copyright 2015 Rik Teerling <rik@onandoffables.com>
* - Initial commit
* - Copyright 2015 Your Name <you@yourhost.com>
* - What you did
*/
#ifndef SCENE08_H
#define SCENE08_H
#include <vector>
#include <rt2d/timer.h>
#include "superscene.h"
#include "basicentity.h"
struct Cell
{
BasicEntity* entity; // visual representation
Point_t<int> position; // x/y in grid
//RGBAColor color;
//int state;
//...
};
class Scene08: public SuperScene
{
public:
Scene08();
virtual ~Scene08();
virtual void update(float deltaTime);
private:
BasicEntity* grid;
std::vector<Cell*> cells;
int gridwidth;
int gridheight;
int cellwidth;
int cellheight;
int border;
};
#endif /* SCENE08_H */
|
//
// AIMRendezvousHandler.h
// LibOrange
//
// Created by Alex Nichol on 6/14/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AIMSession.h"
#import "AIMReceivingFileTransfer.h"
#import "AIMIMRendezvous.h"
#import "AIMICBMMessageToServer.h"
#import "AIMSendingFileTransfer.h"
#import "AIMICBMClientErr.h"
@class AIMRendezvousHandler;
@protocol AIMRendezvousHandlerDelegate <NSObject>
@optional
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferRequested:(AIMReceivingFileTransfer *)ft;
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferCancelled:(AIMFileTransfer *)ft reason:(UInt16)reason;
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferStarted:(AIMFileTransfer *)ft;
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferFailed:(AIMFileTransfer *)ft;
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferDone:(AIMFileTransfer *)ft;
- (void)aimRendezvousHandler:(AIMRendezvousHandler *)rvHandler fileTransferProgressChanged:(AIMFileTransfer *)ft;
@end
@interface AIMRendezvousHandler : NSObject <AIMSessionHandler, AIMReceivingFileTransferDelegate, AIMSendingFileTransferDelegate> {
NSMutableArray * fileTransfers;
AIMSession * session;
id<AIMRendezvousHandlerDelegate> delegate;
}
@property (nonatomic, assign) id<AIMRendezvousHandlerDelegate> delegate;
- (id)initWithSession:(AIMSession *)theSession;
- (AIMFileTransfer *)fileTransferWithCookie:(AIMICBMCookie *)cookie;
- (void)acceptFileTransfer:(AIMReceivingFileTransfer *)ft saveToPath:(NSString *)path;
- (void)cancelFileTransfer:(AIMFileTransfer *)ft;
- (AIMSendingFileTransfer *)sendFile:(NSString *)path toUser:(AIMBlistBuddy *)buddy;
@end
|
/* configdir.c
*
*
* Copyright (C) 2014 Toxic All Rights Reserved.
*
* This file is part of Toxic.
*
* Toxic 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.
*
* Toxic 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 Toxic. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <pwd.h>
#include "configdir.h"
/**
* @brief Get the users config directory.
*
* This is without a trailing slash.
*
* @return The users config dir or NULL on error.
*/
char *get_user_config_dir(void)
{
char *user_config_dir;
#ifndef NSS_BUFLEN_PASSWD
#define NSS_BUFLEN_PASSWD 4096
#endif /* NSS_BUFLEN_PASSWD */
struct passwd pwd;
struct passwd *pwdbuf;
const char *home;
char buf[NSS_BUFLEN_PASSWD];
size_t len;
int rc;
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
if (rc == 0) {
home = pwd.pw_dir;
} else {
home = getenv("HOME");
if (home == NULL) {
return NULL;
}
/* env variables can be tainted */
snprintf(buf, sizeof(buf), "%s", home);
home = buf;
}
# if defined(__APPLE__)
len = strlen(home) + strlen("/Library/Application Support") + 1;
user_config_dir = malloc(len);
if (user_config_dir == NULL) {
return NULL;
}
snprintf(user_config_dir, len, "%s/Library/Application Support", home);
# else /* __APPLE__ */
const char *tmp;
if (!(tmp = getenv("XDG_CONFIG_HOME"))) {
len = strlen(home) + strlen("/.config") + 1;
user_config_dir = malloc(len);
if (user_config_dir == NULL) {
return NULL;
}
snprintf(user_config_dir, len, "%s/.config", home);
} else {
user_config_dir = strdup(tmp);
}
# endif /* __APPLE__ */
return user_config_dir;
#undef NSS_BUFLEN_PASSWD
}
/*
* Creates the config directory.
*/
int create_user_config_dir(char *path)
{
int mkdir_err;
mkdir_err = mkdir(path, 0700);
struct stat buf;
if (mkdir_err && (errno != EEXIST || stat(path, &buf) || !S_ISDIR(buf.st_mode))) {
return -1;
}
char *fullpath = malloc(strlen(path) + strlen(CONFIGDIR) + 1);
strcpy(fullpath, path);
strcat(fullpath, CONFIGDIR);
mkdir_err = mkdir(fullpath, 0700);
if (mkdir_err && (errno != EEXIST || stat(fullpath, &buf) || !S_ISDIR(buf.st_mode))) {
free(fullpath);
return -1;
}
free(fullpath);
return 0;
}
|
//
// usbgamepadps4.h
//
// Circle - A C++ bare metal environment for Raspberry Pi
// Copyright (C) 2014-2018 R. Stange <rsta2@o2online.de>
//
// This driver was developed by:
// Jose Luis Sanchez, http://jspeccy.speccy.org/
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _circle_usb_usbgamepadps4_h
#define _circle_usb_usbgamepadps4_h
#include <circle/usb/usbgamepad.h>
#include <circle/input/mouse.h>
#include <circle/types.h>
struct PS4Output {
u8 rumbleState, bigRumble, smallRumble; // Rumble
u8 red, green, blue; // RGB
u8 flashOn, flashOff; // Time to flash bright/dark (255 = 2.5 seconds)
};
class CUSBGamePadPS4Device : public CUSBGamePadDevice
{
public:
CUSBGamePadPS4Device (CUSBFunction *pFunction);
~CUSBGamePadPS4Device (void);
boolean Configure (void);
unsigned GetProperties (void)
{
return GamePadPropertyIsKnown
| GamePadPropertyHasLED
| GamePadPropertyHasRGBLED
| GamePadPropertyHasRumble
| GamePadPropertyHasGyroscope
| GamePadPropertyHasTouchpad;
}
boolean SetLEDMode (TGamePadLEDMode Mode);
boolean SetLEDMode (u32 nRGB, u8 uchTimeOn, u8 uchTimeOff);
boolean SetRumbleMode (TGamePadRumbleMode Mode);
static void DisableTouchpad (void);
private:
void ReportHandler (const u8 *pReport, unsigned nReportSize);
void DecodeReport (const u8 *pReportBuffer);
void HandleTouchpad (const u8 *pReportBuffer);
boolean SendLedRumbleCommand(void);
private:
boolean m_bInterfaceOK;
PS4Output ps4Output;
u8 *outBuffer;
CMouseDevice *m_pMouseDevice;
struct
{
boolean bButtonPressed;
boolean bTouched;
u16 usPosX;
u16 usPosY;
}
m_Touchpad; // previous state from touchpad
static boolean s_bTouchpadEnabled;
};
#endif
|
/* This file is part of GlkJNI.
* Copyright (c) 2009 Edward McCardell
*
* 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 WINDOW_H_
#define WINDOW_H_
#define KB_CHAR_REQ (0x01)
#define KB_LINE_REQ (0x02)
#define KB_UNI_REQ (0x04)
typedef struct glk_window_struct window_t;
typedef struct textwin_data_struct textwin_data_t;
struct glk_window_struct {
glui32 rock;
glui32 id;
glui32 type;
window_t *parent;
strid_t str;
strid_t echostr;
gidispatch_rock_t disprock;
window_t *next, *prev;
jobject jwin;
/* For pair windows: */
glui32 split_method;
window_t *key;
jint constraint;
/* For all visible windows: */
int mouse_request;
/* For text windows: */
textwin_data_t *text;
/* A scratch variable used by gli_window_close(). */
int deletemark;
};
struct textwin_data_struct {
glui32 curr_style;
glui32 curr_linkval;
int kb_request;
int link_request;
void *inbuf;
int inbuf_unicode;
int inbuf_len;
jchar *outbuf;
int outbuf_count;
gidispatch_rock_t inbuf_rock;
};
void gli_textwin_init(window_t *win);
void gli_unregister_win_input(window_t *win);
void gli_echo_line_input(window_t *win, glui32 len);
void gli_window_print(window_t *win);
void gli_window_clear_outbuf(textwin_data_t *text);
int gli_text_wintype(glui32 wintype);
#endif /* WINDOW_H_ */
|
/**
* \file fasta.c Module to handle FASTA sequences
* \author Lukas Habegger (lukas.habegger@yale.edu)
*/
#include "log.h"
#include "format.h"
#include "linestream.h"
#include "stringUtil.h"
#include "common.h"
#include "fasta.h"
#define NUM_CHARACTRS_PER_LINE 60
static LineStream lsFasta = NULL;
/**
* Initialize the FASTA module using a file name.
* @note Use "-" to denote stdin.
* @post fasta_nextSequence(), fasta_readAllSequences() can be called.
*/
void fasta_initFromFile (char* fileName)
{
lsFasta = ls_createFromFile (fileName);
ls_bufferSet (lsFasta,1);
}
/**
* Deinitialize the FASTA module. Frees module internal memory.
*/
void fasta_deInit (void)
{
ls_destroy (lsFasta);
}
/**
* Initialize the FASTA module using a pipe.
* @post fasta_nextSequence(), fasta_readAllSequences() can be called.
*/
void fasta_initFromPipe (char* command)
{
lsFasta = ls_createFromPipe (command);
ls_bufferSet (lsFasta,1);
}
static void fasta_freeSeq (Seq* currSeq)
{
if (currSeq == NULL) {
return;
}
hlr_free (currSeq->name);
hlr_free (currSeq->sequence);
freeMem (currSeq);
currSeq = NULL;
}
static Seq* fasta_processNextSequence (int freeMemory, int truncateName)
{
char *line;
static Stringa buffer = NULL;
static Seq* currSeq = NULL;
int count;
if (ls_isEof (lsFasta)) {
if (freeMemory) {
fasta_freeSeq (currSeq);
}
return NULL;
}
count = 0;
stringCreateClear (buffer,1000);
while (line = ls_nextLine (lsFasta)) {
if (line[0] == '\0') {
continue;
}
if (line[0] == '>') {
count++;
if (count == 1) {
if (freeMemory) {
fasta_freeSeq (currSeq);
}
AllocVar (currSeq);
currSeq->name = hlr_strdup (line + 1);
if (truncateName) {
currSeq->name = firstWordInLine (skipLeadingSpaces (currSeq->name));
}
continue;
}
else if (count == 2) {
currSeq->sequence = hlr_strdup (string (buffer));
currSeq->size = stringLen (buffer);
ls_back (lsFasta,1);
return currSeq;
}
}
stringCat (buffer,line);
}
currSeq->sequence = hlr_strdup (string (buffer));
currSeq->size = stringLen (buffer);
return currSeq;
}
/**
* Returns a pointer to the next FASTA sequence.
* @param[in] truncateName If truncateName > 0, leading spaces of the name are skipped. Furthermore, the name is truncated after the first white space. If truncateName == 0, the name is stored as is.
* @note The memory belongs to this routine.
*/
Seq* fasta_nextSequence (int truncateName)
{
return fasta_processNextSequence (1,truncateName);
}
/**
* Returns an Array of FASTA sequences.
* @param[in] truncateName If truncateName > 0, leading spaces of the name are skipped. Furthermore, the name is truncated after the first white space. If truncateName == 0, the name is stored as is.
* @note The memory belongs to this routine.
*/
Array fasta_readAllSequences (int truncateName)
{
Array seqs;
Seq *currSeq;
seqs = arrayCreate (100000,Seq);
while (currSeq = fasta_processNextSequence (0,truncateName)) {
array (seqs,arrayMax (seqs),Seq) = *currSeq;
freeMem (currSeq);
}
return seqs;
}
/**
* Prints currSeq to stdout.
*/
void fasta_printOneSequence (Seq* currSeq)
{
char *seq;
seq = insertWordEveryNthPosition (currSeq->sequence,"\n",NUM_CHARACTRS_PER_LINE);
printf(">%s\n%s\n",currSeq->name,seq);
}
/**
* Prints seqs to stdout.
*/
void fasta_printSequences (Array seqs)
{
int i;
Seq *currSeq;
for (i = 0; i < arrayMax (seqs); i++) {
currSeq = arrp (seqs,i,Seq);
fasta_printOneSequence (currSeq);
}
}
|
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed (int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofSoundPlayer beats;
ofSoundPlayer synth;
ofSoundPlayer vocals;
ofTrueTypeFont font;
float synthPosition;
};
|
/* mpn/generic/gcd.c forced to use the binary algorithm. */
/*
Copyright 2000 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 3 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. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
#undef GCD_ACCEL_THRESHOLD
#define GCD_ACCEL_THRESHOLD MP_SIZE_T_MAX
#undef GCD_SCHOENHAGE_THRESHOLD
#define GCD_SCHOENHAGE_THRESHOLD MP_SIZE_T_MAX
#define __gmpn_gcd mpn_gcd_binary
#include "../mpn/generic/gcd.c"
|
//***************************************************************************
//
// Copyright (c) 2001 - 2006 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//***************************************************************************
/**
@file IFXModifierBaseDecoder.h
Declaration of the IFXModifierBaseDecoder.
The IFXModifierBaseDecoder contains common modifier decoding
functionality that is used by the individual specific modifier
(and generator) decoders (e.g. CIFXGlyphGeneratorDecoder).
@note This class is intended to be used as an abstract base class
for various types of modifier decoders. As such, both the
constructor and destructor are declared as protected members.
This does, in itself, suffice in keeping a stand-alone instance
of this class from being created. Note that the destructor is
also declared as pure virtual to further enforce the abstract
nature of this class - but the destructor does still have an
implementation.
*/
#ifndef IFXModifierBaseDecoder_H
#define IFXModifierBaseDecoder_H
#include "IFXCoreServices.h"
#include "IFXDataBlockQueueX.h"
#include "IFXAutoRelease.h"
#include "IFXSceneGraph.h"
#include "IFXDecoderX.h"
class IFXModifierBaseDecoder
{
protected:
// Member functions.
IFXModifierBaseDecoder();
virtual ~IFXModifierBaseDecoder() = 0;
void InitializeX(const IFXLoadConfig &rLoadConfig);
void CreateObjectX(IFXDataBlockX &rDataBlockX, IFXREFCID cid);
void ProcessChainX( IFXDataBlockX &rDataBlockX );
// Member data.
U32 m_uRefCount;
U32 m_uLoadId;
U32 m_uChainPosition;
IFXSceneGraph::EIFXPalette m_ePalette;
BOOL m_bExternal;
IFXString m_stringObjectName;
IFXDECLAREMEMBER(IFXCoreServices,m_pCoreServices);
IFXDECLAREMEMBER(IFXDataBlockQueueX,m_pDataBlockQueueX);
IFXDECLAREMEMBER(IFXUnknown,m_pObject);
};
#endif
|
/*
* Vortex OpenSplice
*
* This software and documentation are Copyright 2006 to TO_YEAR ADLINK
* Technology Limited, its affiliated companies and licensors. 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.
* 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 V__READER_H
#define V__READER_H
#include "v_reader.h"
#include "v_entity.h"
#include "v__subscriberQos.h"
#define v__readerIsGroupCoherent(reader_) v_subscriberQosIsGroupCoherent((reader_)->subQos)
#define v__readerIsGroupOrderedNonCoherent(reader_) \
((reader_->subQos->presentation.v.access_scope == V_PRESENTATION_GROUP) && \
(reader_->subQos->presentation.v.coherent_access == FALSE) && \
(reader_->subQos->presentation.v.ordered_access == TRUE))
#define v_readerAccessScope(_this) \
v_reader(_this)->subQos->presentation.v.access_scope
void
v_readerInit(
_Inout_ v_reader _this,
_In_z_ const c_char *name,
_In_ v_subscriber s,
_In_ v_readerQos qos);
void
v_readerDeinit(
v_reader _this);
void
v_readerFree(
v_reader _this);
void
v_readerAddEntry(
_Inout_ v_reader _this,
_In_ v_entry e);
void
v_readerAddTransactionAdmin(
_Inout_ v_reader r,
_In_opt_ v_transactionGroupAdmin a);
void
v__readerNotifyStateChange_nl(
v_reader _this,
c_bool complete);
v_topic
v_readerGetTopic(
v_reader _this);
v_topic
v_readerGetTopic_nl(
v_reader _this);
void
v_readerPublishBuiltinInfo(
v_reader _this);
v_subscriber
v_readerGetSubscriber(
v_reader _this);
#endif
|
#include "../Utils/utils.h"
#include "../Methnum/methnum.h"
#include "../Var/var.h"
#include "../T0/t0.h"
#include "upot.h"
Uparam * Uparam_alloc ( U_type upot_t , double Lambda_cutoff )
{
Uparam * P = 0 ;
P = (Uparam *) malloc ( sizeof(Uparam));
if ( P == 0 ) ERROR ( stdout , "U param struct allocation failed" );
if ( upot_t == U_POW ) Uparam_set_pow_std ( P );
else if ( upot_t == U_LOG ) Uparam_set_log_std ( P );
else if ( upot_t == U_FUK ) Uparam_set_fuk_std ( P , Lambda_cutoff );
else if ( upot_t == U_DEX ) Uparam_set_dex_std ( P );
else
{
free ( P );
P = 0 ;
}
return P ;
}
void Uparam_free ( Uparam * P )
{
RETURN_IF_NULL ( P ) ;
free ( P );
P = 0;
}
void Uparam_set_pow_std ( Uparam * P )
{
P->a0 = 6.75 ;
P->a1 = -1.95 ;
P->a2 = 2.625;
P->a3 = -7.44 ;
P->b3 = 0.75 ;
P->b4 = 7.5 ;
}
void Uparam_set_log_std ( Uparam * P )
{
P->a0 = 3.51 ;
P->a1 = - 2.47 ;
P->a2 = 15.22 ;
P->b4 = - 1.75 ;
}
void Uparam_set_fuk_std ( Uparam * P , double Lambda_cutoff )
{
P->a = 0.664 ; // [GeV]
P->b = 0.007 * Lambda_cutoff * Lambda_cutoff * Lambda_cutoff;
}
void Uparam_set_dex_std ( Uparam * P )
{
P->a0 = -1.85 ;
P->a1 = -1.44 * 0.001 ;
P->a2 = -0.08 ;
P->a3 = -0.4 ;
}
void Uparam_set_pow ( Uparam * P, double a0, double a1, double a2, double a3, double b3, double b4 )
{
P->a0 = a0 ;
P->a1 = a1 ;
P->a2 = a2 ;
P->a3 = a3 ;
P->b3 = b3 ;
P->b4 = b4 ;
}
void Uparam_set_log ( Uparam * P, double a0, double a1, double a2, double b4 )
{
P->a0 = a0 ;
P->a1 = a1 ;
P->a2 = a2 ;
P->b4 = b4 ;
}
void Uparam_set_fuk ( Uparam * P, double a , double b )
{
P->a = a ;
P->b = b ;
}
void Uparam_set_dex ( Uparam * P, double a0, double a1, double a2, double a3 )
{
P->a0 = a0 ;
P->a1 = a1 ;
P->a2 = a2 ;
P->a3 = a3 ;
}
|
/**
* @file charconv_libjcode.c
*
* <JA>
* @brief ʸ»ú¥³¡¼¥ÉÊÑ´¹ (libjcode »ÈÍÑ)
*
* ÆüËܸì¤Îʸ»ú¥³¡¼¥É(JIS,EUC,SJIS)¤ÎÁê¸ßÊÑ´¹¤Î¤ß²Äǽ¤Ç¤¢¤ë.
*
* </JA>
*
* <EN>
* @brief Character set conversion using libjcode
*
* Only conversion between Japanese character set (jis, euc-jp, shift-jis)
* is supported.
*
* </EN>
*
* @author Akinobu LEE
* @date Thu Feb 17 16:02:41 2005
*
* $Revision: 1.5 $
*
*/
/*
* Copyright (c) 1991-2013 Kawahara Lab., Kyoto University
* Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
* Copyright (c) 2005-2013 Julius project team, Nagoya Institute of Technology
* All rights reserved
*/
#include "app.h"
#ifdef CHARACTER_CONVERSION
#ifdef USE_LIBJCODE
#include "libjcode/jlib.h"
static int convert_to = SJIS; ///< Conversion target
/**
* Setup charset conversion for libjcode.
*
* @param fromcode [in] input charset name (ignored, will be auto-detected)
* @param tocode [in] output charset name, or NULL when disable conversion
* @param enable_conv [out] return whether conversion should be enabled or not
*
* @return TRUE on success, FALSE on failure (unknown name).
*/
boolean
charconv_libjcode_setup(char *fromcode, char *tocode, boolean *enable_conv)
{
if (tocode == NULL) {
/* disable conversion */
*enable_conv = FALSE;
} else {
if (strmatch(tocode, "sjis")
|| strmatch(tocode, "sjis-win")
|| strmatch(tocode, "shift-jis")
|| strmatch(tocode, "shift_jis")) {
convert_to = SJIS;
} else if (strmatch(tocode, "euc-jp")
|| strmatch(tocode, "euc")
|| strmatch(tocode, "eucjp")) {
convert_to = EUC;
} else if (strmatch(tocode, "jis")) {
convert_to = JIS;
} else {
jlog("Error: charconv_libjcode: character set \"%s\" not supported\n", tocode);
jlog("Error: charconv_libjcode: only \"sjis\", \"euc-jp\" and \"jis\" can be used with libjcode.\n");
*enable_conv = FALSE;
return FALSE;
}
*enable_conv = TRUE;
}
return TRUE;
}
/**
* Apply charset conversion to a string using libjcode.
*
* @param instr [in] source string
* @param outstr [out] destination buffer
* @param maxoutlen [in] allocated length of outstr in byte.
*
* @return either of instr or outstr, that holds the result string.
*
*/
char *
charconv_libjcode(char *instr, char *outstr, int maxoutlen)
{
switch(convert_to) {
case SJIS:
toStringSJIS(instr, outstr, maxoutlen);
break;
case EUC:
toStringEUC(instr, outstr, maxoutlen);
break;
case JIS:
toStringJIS(instr, outstr, maxoutlen);
break;
}
return(outstr);
}
#endif /* USE_LIBJCODE */
#endif /* CHARACTER_CONVERSION */
|
/*
* Copyright 2018 <copyright holder> <email>
*
* 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 OMNIROBOTSERVER_H
#define OMNIROBOTSERVER_H
#include "omnirobotI.h"
#include "differentialrobotI.h"
#include "genericbaseI.h"
class OmniRobotServer
{
public:
OmniRobotServer(){};
OmniRobotServer(Ice::CommunicatorPtr communicator, std::shared_ptr<SpecificWorker> worker, uint32_t _port);
void add(InnerModelOmniRobot *omnirobot);
uint32_t port;
Ice::ObjectAdapterPtr adapter;
OmniRobotI *interface;
DifferentialRobotI *interfaceDFR;
GenericBaseI *interfaceGB;
std::vector<InnerModelOmniRobot *> omnirobots;
std::string name = "OmniRobotServer";
};
#endif // OMNIROBOTSERVER_H
|
/*
* Copyright 2008 Evenflow, Inc.
*
* dropbox-client.c
* Implements connection handling and C interface for interfacing with the Dropbox daemon.
*
* This file is part of caja-dropbox.
*
* caja-dropbox 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.
*
* caja-dropbox 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 caja-dropbox. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <glib.h>
#include "g-util.h"
#include "dropbox-command-client.h"
#include "caja-dropbox-hooks.h"
#include "dropbox-client.h"
static void
hook_on_connect(DropboxClient *dc) {
dc->hook_connect_called = TRUE;
if (dc->command_connect_called) {
debug("client connection");
g_hook_list_invoke(&(dc->onconnect_hooklist), FALSE);
/* reset flags */
dc->hook_connect_called = dc->command_connect_called = FALSE;
}
}
static void
command_on_connect(DropboxClient *dc) {
dc->command_connect_called = TRUE;
if (dc->hook_connect_called) {
debug("client connection");
g_hook_list_invoke(&(dc->onconnect_hooklist), FALSE);
/* reset flags */
dc->hook_connect_called = dc->command_connect_called = FALSE;
}
}
static void
command_on_disconnect(DropboxClient *dc) {
dc->command_disconnect_called = TRUE;
if (dc->hook_disconnect_called) {
debug("client disconnect");
g_hook_list_invoke(&(dc->ondisconnect_hooklist), FALSE);
/* reset flags */
dc->hook_disconnect_called = dc->command_disconnect_called = FALSE;
}
else {
caja_dropbox_hooks_force_reconnect(&(dc->hookserv));
}
}
static void
hook_on_disconnect(DropboxClient *dc) {
dc->hook_disconnect_called = TRUE;
if (dc->command_disconnect_called) {
debug("client disconnect");
g_hook_list_invoke(&(dc->ondisconnect_hooklist), FALSE);
/* reset flags */
dc->hook_disconnect_called = dc->command_disconnect_called = FALSE;
}
else {
dropbox_command_client_force_reconnect(&(dc->dcc));
}
}
gboolean
dropbox_client_is_connected(DropboxClient *dc) {
return (dropbox_command_client_is_connected(&(dc->dcc)) &&
caja_dropbox_hooks_is_connected(&(dc->hookserv)));
}
void
dropbox_client_force_reconnect(DropboxClient *dc) {
if (dropbox_client_is_connected(dc) == TRUE) {
debug("forcing client to reconnect");
dropbox_command_client_force_reconnect(&(dc->dcc));
caja_dropbox_hooks_force_reconnect(&(dc->hookserv));
}
}
/* should only be called once on initialization */
void
dropbox_client_setup(DropboxClient *dc) {
caja_dropbox_hooks_setup(&(dc->hookserv));
dropbox_command_client_setup(&(dc->dcc));
g_hook_list_init(&(dc->ondisconnect_hooklist), sizeof(GHook));
g_hook_list_init(&(dc->onconnect_hooklist), sizeof(GHook));
dc->hook_disconnect_called = dc->command_disconnect_called = FALSE;
dc->hook_connect_called = dc->command_connect_called = FALSE;
caja_dropbox_hooks_add_on_connect_hook(&(dc->hookserv),
(DropboxHookClientConnectHook)
hook_on_connect, dc);
dropbox_command_client_add_on_connect_hook(&(dc->dcc),
(DropboxCommandClientConnectHook)
command_on_connect, dc);
caja_dropbox_hooks_add_on_disconnect_hook(&(dc->hookserv),
(DropboxHookClientConnectHook)
hook_on_disconnect, dc);
dropbox_command_client_add_on_disconnect_hook(&(dc->dcc),
(DropboxCommandClientConnectHook)
command_on_disconnect, dc);
}
/* not thread safe */
void
dropbox_client_add_on_disconnect_hook(DropboxClient *dc,
DropboxClientConnectHook dhcch,
gpointer ud) {
GHook *newhook;
newhook = g_hook_alloc(&(dc->ondisconnect_hooklist));
newhook->func = dhcch;
newhook->data = ud;
g_hook_append(&(dc->ondisconnect_hooklist), newhook);
}
/* not thread safe */
void
dropbox_client_add_on_connect_hook(DropboxClient *dc,
DropboxClientConnectHook dhcch,
gpointer ud) {
GHook *newhook;
newhook = g_hook_alloc(&(dc->onconnect_hooklist));
newhook->func = dhcch;
newhook->data = ud;
g_hook_append(&(dc->onconnect_hooklist), newhook);
}
/* not thread safe */
void
dropbox_client_add_connection_attempt_hook(DropboxClient *dc,
DropboxClientConnectionAttemptHook dhcch,
gpointer ud) {
debug("shouldn't be here...");
dropbox_command_client_add_connection_attempt_hook(&(dc->dcc),
dhcch, ud);
}
/* should only be called once on initialization */
void
dropbox_client_start(DropboxClient *dc) {
debug("starting connections");
caja_dropbox_hooks_start(&(dc->hookserv));
dropbox_command_client_start(&(dc->dcc));
}
|
/* EQ Everquest Server Emulator
Copyright (C) 2001-2002 EQ:: Development Team (http://EQ::.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
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 CLIENT_H
#define CLIENT_H
#include <string>
#include "../common/linked_list.h"
#include "../common/timer.h"
#include "../common/inventory_profile.h"
//#include "zoneserver.h"
#include "../common/eq_packet_structs.h"
#include "cliententry.h"
#define CLIENT_TIMEOUT 30000
class EQApplicationPacket;
class EQStreamInterface;
class Client {
public:
Client(EQStreamInterface* ieqs);
~Client();
bool Process();
void ReceiveData(uchar* buf, int len);
void SendCharInfo();
void SendMaxCharCreate();
void SendMembership();
void SendMembershipSettings();
void EnterWorld(bool TryBootup = true);
void TellClientZoneUnavailable();
void QueuePacket(const EQApplicationPacket* app, bool ack_req = true);
void Clearance(int8 response);
void SendGuildList();
void SendEnterWorld(std::string name);
void SendExpansionInfo();
void SendLogServer();
void SendApproveWorld();
void SendPostEnterWorld();
bool GenPassKey(char* key);
inline uint32 GetIP() { return ip; }
inline uint16 GetPort() { return port; }
inline uint32 GetZoneID() { return zone_id; }
inline uint32 GetInstanceID() { return instance_id; }
inline uint32 WaitingForBootup() { return zone_waiting_for_bootup; }
inline const char * GetAccountName() { if (cle) { return cle->AccountName(); } return "NOCLE"; }
inline int16 GetAdmin() { if (cle) { return cle->Admin(); } return 0; }
inline uint32 GetAccountID() { if (cle) { return cle->AccountID(); } return 0; }
inline uint32 GetWID() { if (cle) { return cle->GetID(); } return 0; }
inline uint32 GetLSID() { if (cle) { return cle->LSID(); } return 0; }
inline const char* GetLSKey() { if (cle) { return cle->GetLSKey(); } return "NOKEY"; }
inline uint32 GetCharID() { return charid; }
inline const char* GetCharName() { return char_name; }
inline EQ::versions::ClientVersion GetClientVersion() { return m_ClientVersion; }
inline ClientListEntry* GetCLE() { return cle; }
inline void SetCLE(ClientListEntry* iCLE) { cle = iCLE; }
bool StoreCharacter(
uint32 account_id,
PlayerProfile_Struct *p_player_profile_struct,
EQ::InventoryProfile *p_inventory_profile
);
private:
uint32 ip;
uint16 port;
uint32 charid;
char char_name[64];
uint32 zone_id;
uint32 instance_id;
bool is_player_zoning;
Timer autobootup_timeout;
uint32 zone_waiting_for_bootup;
bool enter_world_triggered;
bool StartInTutorial;
EQ::versions::ClientVersion m_ClientVersion;
uint32 m_ClientVersionBit;
bool OPCharCreate(char *name, CharCreate_Struct *cc);
void SetClassStartingSkills( PlayerProfile_Struct *pp );
void SetRaceStartingSkills( PlayerProfile_Struct *pp );
void SetRacialLanguages( PlayerProfile_Struct *pp );
void SetClassLanguages(PlayerProfile_Struct *pp);
ClientListEntry* cle;
Timer connect;
bool firstlogin;
bool seen_character_select;
bool realfirstlogin;
bool HandlePacket(const EQApplicationPacket *app);
bool HandleNameApprovalPacket(const EQApplicationPacket *app);
bool HandleSendLoginInfoPacket(const EQApplicationPacket *app);
bool HandleGenerateRandomNamePacket(const EQApplicationPacket *app);
bool HandleCharacterCreateRequestPacket(const EQApplicationPacket *app);
bool HandleCharacterCreatePacket(const EQApplicationPacket *app);
bool HandleEnterWorldPacket(const EQApplicationPacket *app);
bool HandleDeleteCharacterPacket(const EQApplicationPacket *app);
bool HandleZoneChangePacket(const EQApplicationPacket *app);
bool HandleChecksumPacket(const EQApplicationPacket *app);
bool ChecksumVerificationCRCEQGame(uint64 checksum);
bool ChecksumVerificationCRCSkillCaps(uint64 checksum);
bool ChecksumVerificationCRCBaseData(uint64 checksum);
EQStreamInterface* eqs;
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc);
#endif
|
/****************************************************************\
* *
* Coding <-> Genome comparison model *
* *
* Guy St.C. Slater.. mailto:guy@ebi.ac.uk *
* Copyright (C) 2000-2008. All Rights Reserved. *
* *
* This source code is distributed under the terms of the *
* GNU General Public License, version 3. See the file COPYING *
* or http://www.gnu.org/licenses/gpl.txt for details *
* *
* If you use this code, please keep this notice intact. *
* *
\****************************************************************/
#include "coding2genome.h"
void Coding2Genome_Data_init(Coding2Genome_Data *c2gd,
Sequence *query, Sequence *target){
g_assert(query->alphabet->type == Alphabet_Type_DNA);
g_assert(target->alphabet->type == Alphabet_Type_DNA);
Coding2Coding_Data_init(&c2gd->c2cd, query, target);
if(!Coding2Genome_Data_get_Intron_Data(c2gd))
Coding2Genome_Data_get_Intron_Data(c2gd) = Intron_Data_create();
return;
}
Coding2Genome_Data *Coding2Genome_Data_create(
Sequence *query, Sequence *target){
register Coding2Genome_Data *c2gd = g_new0(Coding2Genome_Data, 1);
Coding2Genome_Data_init(c2gd, query, target);
return c2gd;
}
void Coding2Genome_Data_clear(Coding2Genome_Data *c2gd){
Coding2Coding_Data_clear(&c2gd->c2cd);
return;
}
void Coding2Genome_Data_destroy(Coding2Genome_Data *c2gd){
Coding2Genome_Data_clear(c2gd);
if(Coding2Genome_Data_get_Intron_Data(c2gd)){
Intron_Data_destroy(Coding2Genome_Data_get_Intron_Data(c2gd));
Coding2Genome_Data_get_Intron_Data(c2gd) = NULL;
}
g_free(c2gd);
return;
}
/**/
C4_Model *Coding2Genome_create(void){
register C4_Model *model = Coding2Coding_create();
register C4_Model *phase_model;
register C4_Transition *match_transition;
register Match *match;
g_assert(model);
C4_Model_rename(model, "coding2genome");
C4_Model_open(model);
/**/
match_transition = C4_Model_select_single_transition(model,
C4_Label_MATCH);
g_assert(match_transition);
/* Target Introns */
match = match_transition->label_data;
phase_model = Phase_create("target intron", match, FALSE, TRUE);
C4_Model_insert(model, phase_model, match_transition->input,
match_transition->input);
C4_Model_destroy(phase_model);
/**/
C4_Model_close(model);
return model;
}
|
/*****************************************************************************
*
* EUVCroi.c -- region of interest management for EUVC cameras
*
* Copyright 2015 James Fidell (james@openastroproject.org)
*
* License:
*
* This file is part of the Open Astro Project.
*
* The Open Astro Project 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 Open Astro Project 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 Open Astro Project. If not, see
* <http://www.gnu.org/licenses/>.
*
*****************************************************************************/
#include <oa_common.h>
#include <openastro/camera.h>
#include <openastro/errno.h>
#include <openastro/util.h>
#include "oacamprivate.h"
#include "EUVC.h"
#include "EUVCstate.h"
#include "EUVCoacam.h"
int
oaEUVCCameraTestROISize ( oaCamera* camera, unsigned int tryX,
unsigned int tryY, unsigned int* suggX, unsigned int* suggY )
{
EUVC_STATE* cameraInfo = camera->_private;
FRAMESIZE* currentSize;
currentSize = &( cameraInfo->frameSizes[ cameraInfo->binMode ].sizes[
cameraInfo->sizeIndex ]);
if ( tryX % 8 == 0 && tryY % 4 == 0 ) {
if ( tryX <= currentSize->x && tryY <= currentSize->y ) {
return OA_ERR_NONE;
}
}
*suggX = ( tryX & ~0x7 ) + 8;
if ( *suggX > currentSize->x ) {
*suggX = currentSize->x;
}
*suggY = ( tryY & ~0x3 ) + 4;
if ( *suggX > currentSize->y ) {
*suggX = currentSize->y;
}
return -OA_ERR_INVALID_SIZE;
}
|
/******************************************************************************
Copyright (C) 2015-2017 Einar J.M. Baumann <einar.baumann@gmail.com>
This file is part of the FieldOpt project.
FieldOpt 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.
FieldOpt 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 FieldOpt. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef FIELDOPT_RESERVOIRBOUNDARY_H
#define FIELDOPT_RESERVOIRBOUNDARY_H
#include "constraint.h"
#include "well_spline_constraint.h"
#include "Reservoir/grid/grid.h"
namespace Optimization {
namespace Constraints {
/*!
* \brief The ReservoirBoundary class deals with
* imposing and checking reservoir boundary constraints
*
* The class takes a boundary as input in the form of
* i,j and k min,max, i.e. a 'box' in the grid i,j,k
* coordinates. It can check wether or not a single
* well is inside the given box domain and, if needed,
* project the well onto the domain.
*
* \todo Figure out a more effective way to enforce
* the box constraints (TASK A), then figure out way
* boundary constraints for non-box (parallelogram)
* shapes (TASK B); finally, define this constraint
* (out of ReservoirBoundary) as a standalone
* constraint (call it Box) (TASK C)
*
* Steps for (A):
* 1. find the edge cells of the box [x] + unit test [],
*
* 2. get the corner points for each of the cells [] + unit test [],
*
* 3. find the corner points of the entire box (assuming the box is a
* parallelogram, which may not be true for the top and bottom planes
* -> figure out how to deal with this later) [] + unit test [],
*
* 4. print the box data to log for external visualization
*
* 5. figure out if the current point is inside or outside
* the box, e.g., create a BoxEnvelopsPoint function
*
* 6. if outside, project point onto nearest point on plane
*
* Steps for (B):
*/
class ReservoirBoundary : public Constraint, WellSplineConstraint
{
public:
ReservoirBoundary(const Settings::Optimizer::Constraint &settings,
Model::Properties::VariablePropertyContainer *variables,
Reservoir::Grid::Grid *grid);
string name() override { return "ReservoirBoundary"; }
// Constraint interface
public:
bool CaseSatisfiesConstraint(Case *c);
void SnapCaseToConstraints(Case *c);
bool IsBoundConstraint() const override { return true; }
/*!
* @brief Initialize the normalizer parameters.
*
* For now just sets the parameters to the default value.
*
* \todo Properly implement this.
*
* @param cases Cases to be used when calculating the parameters.
*/
void InitializeNormalizer(QList<Case *> cases) override;
/*!
* @brief Get the penalty for a case.
*
* For now, this returns INFINITY if the constraint is violated; otherwise
* it returns 0.0. This corresponds to death penalty.
*
* \todo Propery implement this.
* @param c The case to calculate the penalty for.
* @return INFINITY if the constraint is violated; otherwise false.
*/
double Penalty(Case *c) override;
/*!
* @brief Get the normalized penalty for a case.
*
* For now, this returns 1.0 if the constraint is violated; otherwise it returns
* 0.0. This corresponds to death penalty.
* \todo Properly implement this.
* @param c The case to calculate the penalty for.
* @return 1.0 if the constraint is violated; otherwise false.
*/
long double PenaltyNormalized(Case *c) override;
/*!
* @brief Get the lower bounds. This will return the x, y and
* z values for the _center_ of the cells in the corners of the
* defined box.
*/
Eigen::VectorXd GetLowerBounds(QList<QUuid> id_vector) const override;
Eigen::VectorXd GetUpperBounds(QList<QUuid> id_vector) const override;
/* \brief Function getListOfBoxEdgeCellIndices uses the limits
* defining the box constraint to find the cells that constitute
* the edges of the box
*/
QList<int> returnListOfBoxEdgeCellIndices() const { return index_list_edge_; }
void findCornerCells();
// QList<int> index_corner_cells_;
private:
int imin_, imax_, jmin_, jmax_, kmin_, kmax_;
QList<int> index_list_;
Reservoir::Grid::Grid *grid_;
Well affected_well_;
QList<int> getListOfCellIndices();
QList<int> getIndicesOfEdgeCells();
QList<int> index_list_edge_;
void printCornerXYZ(std::string str_out, Eigen::Vector3d vector_xyz);
};
}
}
#endif //FIELDOPT_RESERVOIRBOUNDARY_H
|
/* Rename a file relative to open directories.
Copyright 2017-2019 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include "renameatu.h"
int
renameat (int fd1, char const *src, int fd2, char const *dst)
{
return renameatu (fd1, src, fd2, dst, 0);
}
|
/* -*- c++ -*-
* Copyright (C) 2007-2016 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; 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.
*/
/// @file
/// Declarations for MergeScannerRange.
/// This file contains type declarations for MergeScannerRange, a class used for
/// performing a scan over a range.
#ifndef Hypertable_RangeServer_MergeScannerRange_h
#define Hypertable_RangeServer_MergeScannerRange_h
#include <Hypertable/RangeServer/MergeScannerAccessGroup.h>
#include <Hypertable/RangeServer/IndexUpdater.h>
#include <Common/ByteString.h>
#include <Common/DynamicBuffer.h>
#include <memory>
#include <queue>
#include <set>
#include <string>
#include <vector>
namespace Hypertable {
/// @addtogroup RangeServer
/// @{
/// Performs a scan over a range.
class MergeScannerRange {
public:
MergeScannerRange(const std::string &table_id, ScanContextPtr &scan_ctx);
/// Destructor.
/// Destroys all scanners in #m_scanners.
virtual ~MergeScannerRange();
void add_scanner(MergeScannerAccessGroup *scanner) {
m_scanners.push_back(scanner);
}
void forward();
bool get(Key &key, ByteString &value);
int32_t get_skipped_cells() { return m_cell_skipped; }
int32_t get_skipped_rows() { return m_row_skipped; }
/// Returns number of cells input.
/// Calls MergeScannerAccessGroup::get_input_cells() on each scanner in
/// #m_scanners and returns the aggregated result.
/// @return number of cells input.
int64_t get_input_cells();
/// Returns number of cells output.
/// Returns number of cells returned via calls to get().
/// @return Number of cells output.
int64_t get_output_cells() { return m_cells_output; }
/// Returns number of bytes input.
/// Calls MergeScannerAccessGroup::get_input_bytes() on each scanner in
/// #m_scanners and returns the aggregated result.
/// @return number of bytes input.
int64_t get_input_bytes();
/// Returns number of bytes output.
/// Returns number of bytes returned via calls to get().
/// @return Number of cells output.
int64_t get_output_bytes() { return m_bytes_output; }
int64_t get_disk_read();
ScanContext *scan_context() { return m_scan_context.get(); }
private:
void initialize();
struct ScannerState {
MergeScannerAccessGroup *scanner;
Key key;
ByteString value;
};
struct LtScannerState {
bool operator()(const ScannerState &ss1, const ScannerState &ss2) const {
return ss1.key.serial > ss2.key.serial;
}
};
std::vector<MergeScannerAccessGroup *> m_scanners;
std::priority_queue<ScannerState, std::vector<ScannerState>,
LtScannerState> m_queue;
/// Scan context
ScanContextPtr m_scan_context;
/// Index updater for <i>rebuild indices</i> scan
IndexUpdaterPtr m_index_updater;
/// Flag indicating scan is finished
bool m_done {};
/// Flag indicating if scan has been initialized
bool m_initialized {};
bool m_skip_this_row {};
int32_t m_cell_offset {};
int32_t m_cell_skipped {};
int32_t m_cell_count {};
int32_t m_cell_limit {};
int32_t m_row_offset {};
int32_t m_row_skipped {};
int32_t m_row_count {};
int32_t m_row_limit {};
int32_t m_cell_count_per_family {};
int32_t m_cell_limit_per_family {};
int32_t m_prev_cf {-1};
int64_t m_prev_timestamp {TIMESTAMP_NULL};
int64_t m_bytes_output {};
int64_t m_cells_output {};
DynamicBuffer m_prev_key;
};
/// Smart pointer to MergeScannerRange
typedef std::shared_ptr<MergeScannerRange> MergeScannerRangePtr;
/// @}
} // namespace Hypertable
#endif // Hypertable_RangeServer_MergeScannerRange_h
|
#ifndef ERROR_H
#define ERROR_H
/*
* Create a squashfs filesystem. This is a highly compressed read only
* filesystem.
*
* Copyright (c) 2012, 2013, 2014
* Phillip Lougher <phillip@squashfs.org.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,
* 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* error.h
*/
extern int exit_on_error;
extern void prep_exit();
#ifdef SQUASHFS_TRACE
#define TRACE(s, args...) \
do { \
} while(0)
#else
#define TRACE(s, args...)
#endif
#define INFO(s, args...) \
do { } while(0)
#define ERROR(s, args...) \
do { \
fprintf(stderr, s, ## args); \
} while(0)
#define ERROR_START(s, args...) \
do { \
fprintf(stderr, s, ## args); \
} while(0)
#define ERROR_EXIT(s, args...) \
do {\
if (exit_on_error) { \
fprintf(stderr, "\n"); \
EXIT_MKSQUASHFS(); \
} else { \
fprintf(stderr, s, ## args); \
} \
} while(0)
#define EXIT_MKSQUASHFS() \
do {\
prep_exit();\
exit(1);\
} while(0)
#define BAD_ERROR(s, args...) \
do {\
EXIT_MKSQUASHFS();\
} while(0)
#define EXIT_UNSQUASH(s, args...) BAD_ERROR(s, ##args)
#define MEM_ERROR() \
do {\
EXIT_MKSQUASHFS();\
} while(0)
#endif
|
#pragma once
#include "stdint.h"
typedef intmax_t bitarrayWord;
/**
* A packed array of bits aka bitmap, bitset, bitfield etc
*/
typedef struct bitarray {
bitarrayWord* array;
int bitno;
} bitarray;
bitarray* bitarrayInit (bitarray* bits, int bitno);
void bitarrayFree (bitarray* bits);
bool bitarrayModify (bitarray* bits, int index, bool set);
bool bitarraySet (bitarray* bits, int index);
bool bitarrayUnset (bitarray* bits, int index);
/**
* Return non-zero if the bit was set
*/
bitarrayWord bitarrayTest (const bitarray* bits, int index);
|
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* GnuTLS 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.
*
* GnuTLS 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 GnuTLS; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Parts copied from GnuTLS example programs. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "utils.h"
/* We test whether implicit global initialization can be overriden */
GNUTLS_SKIP_GLOBAL_INIT
void doit(void)
{
#ifdef _WIN32
/* weak symbols don't seem to work in windows */
exit(77);
#else
int ret;
gnutls_x509_crt_t crt;
ret = gnutls_x509_crt_init(&crt);
if (ret >= 0) {
fail("Library is already initialized\n");
}
gnutls_global_init();
ret = gnutls_x509_crt_init(&crt);
if (ret < 0) {
fail("Could not init certificate!\n");
}
gnutls_x509_crt_deinit(crt);
gnutls_global_deinit();
#endif
}
|
/* -*- Mode: C++ -*- */
/**
* @file icalparameter_cxx.h
* @author fnguyen (12/10/01)
* @brief Definition of C++ Wrapper for icalparameter.c
*
* (C) COPYRIGHT 2001, Critical Path
*/
#ifndef ICALPARAMETER_CXX_H
#define ICALPARAMETER_CXX_H
extern "C" {
#include "ical.h"
};
#include "icptrholder.h"
typedef char* string; // Will use the string library from STL
class ICalParameter {
public:
ICalParameter() throw(icalerrorenum);
ICalParameter(const ICalParameter&) throw(icalerrorenum);
ICalParameter& operator=(const ICalParameter&) throw(icalerrorenum);
~ICalParameter();
ICalParameter(icalparameter* v) throw(icalerrorenum);
// Create from string of form "PARAMNAME=VALUE"
ICalParameter(string str) throw(icalerrorenum);
// Create from just the value, the part after the "="
ICalParameter(icalparameter_kind kind, string str) throw(icalerrorenum);
ICalParameter(icalparameter_kind kind) throw(icalerrorenum);
operator icalparameter*() { return imp; }
void detach() {
imp = NULL;
}
public:
string as_ical_string() throw(icalerrorenum);
bool is_valid();
icalparameter_kind isa( );
int isa_parameter(void* param);
public:
/* Acess the name of an X parameer */
static void set_xname (ICalParameter ¶m, string v);
static string get_xname(ICalParameter ¶m);
static void set_xvalue (ICalParameter ¶m, string v);
static string get_xvalue(ICalParameter ¶m);
/* Convert enumerations */
static string kind_to_string(icalparameter_kind kind);
static icalparameter_kind string_to_kind(string str);
public:
/* DELEGATED-FROM */
string get_delegatedfrom();
void set_delegatedfrom(string v);
/* RELATED */
icalparameter_related get_related();
void set_related(icalparameter_related v);
/* SENT-BY */
string get_sentby();
void set_sentby(string v);
/* LANGUAGE */
string get_language();
void set_language(string v);
/* RELTYPE */
icalparameter_reltype get_reltype();
void set_reltype(icalparameter_reltype v);
/* ENCODING */
icalparameter_encoding get_encoding();
void set_encoding(icalparameter_encoding v);
/* ALTREP */
string get_altrep();
void set_altrep(string v);
/* FMTTYPE */
string get_fmttype();
void set_fmttype(string v);
/* FBTYPE */
icalparameter_fbtype get_fbtype();
void set_fbtype(icalparameter_fbtype v);
/* RSVP */
icalparameter_rsvp get_rsvp();
void set_rsvp(icalparameter_rsvp v);
/* RANGE */
icalparameter_range get_range();
void set_range(icalparameter_range v);
/* DELEGATED-TO */
string get_delegatedto();
void set_delegatedto(string v);
/* CN */
string get_cn();
void set_cn(string v);
/* ROLE */
icalparameter_role get_role();
void set_role(icalparameter_role v);
/* X-LIC-COMPARETYPE */
icalparameter_xliccomparetype get_xliccomparetype();
void set_xliccomparetype(icalparameter_xliccomparetype v);
/* PARTSTAT */
icalparameter_partstat get_partstat();
void set_partstat(icalparameter_partstat v);
/* X-LIC-ERRORTYPE */
icalparameter_xlicerrortype get_xlicerrortype();
void set_xlicerrortype(icalparameter_xlicerrortype v);
/* MEMBER */
string get_member();
void set_member(string v);
/* X */
string get_x();
void set_x(string v);
/* CUTYPE */
icalparameter_cutype get_cutype();
void set_cutype(icalparameter_cutype v);
/* TZID */
string get_tzid();
void set_tzid(string v);
/* VALUE */
icalparameter_value get_value();
void set_value(icalparameter_value v);
/* DIR */
string get_dir();
void set_dir(string v);
private:
icalparameter* imp;
};
#endif
|
/*!
\file lib/db/dbmi_base/zero.c
\brief DBMI Library (base) - zero
(C) 1999-2009, 2011 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
\author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
\author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
*/
#include <grass/dbmi.h>
/*!
\brief Zero allocated space
\param s pointer to memory
\param n number of bytes
*/
void db_zero(void *s, int n)
{
char *c = (char *)s;
while (n-- > 0)
*c++ = 0;
}
|
/*
* Copyright (C) 2011-2012 DarkCore <http://www.darkpeninsula.eu/>
* Copyright (C) 2011-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CALLBACK_H
#define _CALLBACK_H
#include <ace/Future.h>
#include <ace/Future_Set.h>
#include "QueryResult.h"
typedef ACE_Future<QueryResult> QueryResultFuture;
typedef ACE_Future<PreparedQueryResult> PreparedQueryResultFuture;
/*! A simple template using ACE_Future to manage callbacks from the thread and object that
issued the request. <ParamType> is variable type of parameter that is used as parameter
for the callback function.
*/
#define CALLBACK_STAGE_INVALID uint8(-1)
template <typename Result, typename ParamType, bool chain = false>
class QueryCallback
{
public:
QueryCallback() : _stage(chain ? 0 : CALLBACK_STAGE_INVALID) {}
//! The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery
void SetFutureResult(ACE_Future<Result> value)
{
_result = value;
}
ACE_Future<Result> GetFutureResult()
{
return _result;
}
int IsReady()
{
return _result.ready();
}
void GetResult(Result& res)
{
_result.get(res);
}
void FreeResult()
{
_result.cancel();
}
void SetParam(ParamType value)
{
_param = value;
}
ParamType GetParam()
{
return _param;
}
//! Resets the stage of the callback chain
void ResetStage()
{
if (!chain)
return;
_stage = 0;
}
//! Advances the callback chain to the next stage, so upper level code can act on its results accordingly
void NextStage()
{
if (!chain)
return;
++_stage;
}
//! Returns the callback stage (or CALLBACK_STAGE_INVALID if invalid)
uint8 GetStage()
{
return _stage;
}
//! Resets all underlying variables (param, result and stage)
void Reset()
{
SetParam(NULL);
FreeResult();
ResetStage();
}
private:
ACE_Future<Result> _result;
ParamType _param;
uint8 _stage;
};
template <typename Result, typename ParamType1, typename ParamType2, bool chain = false>
class QueryCallback_2
{
public:
QueryCallback_2() : _stage(chain ? 0 : CALLBACK_STAGE_INVALID) {}
//! The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery
void SetFutureResult(ACE_Future<Result> value)
{
_result = value;
}
ACE_Future<Result> GetFutureResult()
{
return _result;
}
int IsReady()
{
return _result.ready();
}
void GetResult(Result& res)
{
_result.get(res);
}
void FreeResult()
{
_result.cancel();
}
void SetFirstParam(ParamType1 value)
{
_param_1 = value;
}
void SetSecondParam(ParamType2 value)
{
_param_2 = value;
}
ParamType1 GetFirstParam()
{
return _param_1;
}
ParamType2 GetSecondParam()
{
return _param_2;
}
//! Resets the stage of the callback chain
void ResetStage()
{
if (!chain)
return;
_stage = 0;
}
//! Advances the callback chain to the next stage, so upper level code can act on its results accordingly
void NextStage()
{
if (!chain)
return;
++_stage;
}
//! Returns the callback stage (or CALLBACK_STAGE_INVALID if invalid)
uint8 GetStage()
{
return _stage;
}
//! Resets all underlying variables (param, result and stage)
void Reset()
{
SetFirstParam(NULL);
SetSecondParam(NULL);
FreeResult();
ResetStage();
}
private:
ACE_Future<Result> _result;
ParamType1 _param_1;
ParamType2 _param_2;
uint8 _stage;
};
#endif
|
/**
* Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
*
* This file is part of iotagent project.
*
* iotagent 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.
*
* iotagent 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 iotagent. If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by the GNU Affero General Public License
* please contact with iot_support at tid dot es
*/
#ifndef SRC_UTIL_HTTP_CLIENT_H_
#define SRC_UTIL_HTTP_CLIENT_H_
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/thread/mutex.hpp>
#include <pion/tcp/connection.hpp>
#include <pion/error.hpp>
#include <pion/http/response_reader.hpp>
namespace iota {
class HttpClient:
public boost::enable_shared_from_this<HttpClient> {
public:
typedef boost::function3 < void, boost::shared_ptr<HttpClient>,
pion::http::response_ptr,
const boost::system::error_code& > application_callback_t;
HttpClient(std::string server,
unsigned int port,
std::string id = std::string());
HttpClient(boost::asio::io_service& io,
std::string server,
unsigned int port,
std::string id = std::string());
virtual ~HttpClient();
pion::http::response_ptr send(pion::http::request_ptr request,
unsigned int timeout,
std::string proxy,
application_callback_t callback = application_callback_t());
void async_send(pion::http::request_ptr request,
unsigned int timeout,
std::string proxy,
application_callback_t callback);
pion::http::request_ptr get_request();
std::string get_identifier();
pion::http::response_ptr get_response();
boost::system::error_code get_error();
std::string getRemoteEndpoint();
void stop();
protected:
private:
boost::shared_ptr<boost::asio::io_service> _local_io;
// Remote endpoint (may be different to connection data, if proxy is used)
std::string _remote_ip;
unsigned int _remote_port;
// Connection
bool _proxy;
boost::asio::ip::address _ip;
unsigned int _port;
std::string _id;
pion::tcp::connection_ptr _connection;
boost::shared_ptr<boost::asio::deadline_timer> _timer;
boost::shared_ptr<boost::asio::io_service::strand> _strand;
boost::system::error_code _ec;
boost::mutex _m;
pion::http::response_ptr _response;
pion::http::request_ptr _request;
application_callback_t _callback;
void generate_identifier();
void connect();
void write();
void read();
void connectHandle(const boost::system::error_code& ec);
void readResponse(const boost::system::error_code& ec);
//std::size_t bytes_written);
void checkResponse(const pion::http::response_ptr& http_response_ptr,
const pion::tcp::connection_ptr& conn_ptr,
const boost::system::error_code& ec);
void endWriteProxy(const boost::system::error_code& ec,
std::size_t bytes_writen);
void endConnectProxy(const boost::system::error_code& ec,
std::size_t bytes_read);
void timeout_connection(const boost::system::error_code& ec);
void set_error(boost::system::error_code ec);
bool check_connection();
void resolve(std::string address, std::string port);
void set_proxy(std::string proxy);
};
};
#endif
|
/*
* Copyright 2010-2012 Fabric Engine Inc. All rights reserved.
*/
#ifndef _FABRIC_IO_DIR_H
#define _FABRIC_IO_DIR_H
#include <Fabric/Base/RC/Object.h>
#include <Fabric/Base/RC/ConstHandle.h>
#include <vector>
#include <string>
namespace Fabric
{
namespace IO
{
class Dir : public RC::Object
{
public:
REPORT_RC_LEAKS
static RC::ConstHandle<Dir> Root();
static RC::ConstHandle<Dir> User();
static RC::ConstHandle<Dir> Private();
static RC::ConstHandle<Dir> Create( RC::ConstHandle<Dir> const &parentDir, std::string path, bool createIfMissing = true )
{
return new Dir( parentDir, path, createIfMissing );
}
static RC::ConstHandle<Dir> Create( std::string path, bool createIfMissing = true )
{
return Create( RC::ConstHandle<Dir>(), path, createIfMissing );
}
RC::ConstHandle<Dir> getParentDir() const
{
return m_parentDir;
}
std::string const &getEntry() const
{
return m_entry;
}
bool exists() const;
std::string getFullPath() const;
std::string getFullFilePath( std::string const &entry ) const;
std::vector< std::string > getFiles() const;
std::vector< RC::ConstHandle<Dir> > getSubDirs( bool followLinks = true ) const;
std::string getFileContents( std::string const &entry ) const;
void putFileContents( std::string const &entry, std::string const &contents ) const;
void recursiveDeleteFilesOlderThan( time_t time ) const;
protected:
Dir( RC::ConstHandle<Dir> const &parentDir, std::string const &entry, bool createIfMissing );
private:
RC::ConstHandle<Dir> m_parentDir;
std::string m_entry;
};
};
};
#endif //_FABRIC_IO_DIR_H
|
/*
*
* Original program and various modifications:
* Lubos Mitas
*
* GRASS4.1 version of the program and GRASS4.2 modifications:
* H. Mitasova,
* I. Kosinovsky, D. Gerdes
* D. McCauley
*
* Copyright 1993, 1995:
* L. Mitas ,
* H. Mitasova ,
* I. Kosinovsky,
* D.Gerdes
* D. McCauley
*
* modified by McCauley in August 1995
* modified by Mitasova in August 1995, Nov. 1996
*
*/
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/interpf.h>
#include <grass/gmath.h>
int IL_matrix_create(struct interp_params *params, struct triple *points, /* points for interpolation */
int n_points, /* number of points */
double **matrix, /* matrix */
int *indx)
/*
Creates system of linear equations represented by matrix using given points
and interpolating function interp()
*/
{
double xx, yy;
double rfsta2, r;
double d;
int n1, k1, k2, k, i1, l, m, i, j;
double fstar2 = params->fi * params->fi / 4.;
static double *A = NULL;
double RO, amaxa;
double rsin = 0, rcos = 0, teta, scale = 0; /*anisotropy parameters - added by JH 2002 */
double xxr, yyr;
if (params->theta) {
teta = params->theta / 57.295779; /* deg to rad */
rsin = sin(teta);
rcos = cos(teta);
}
if (params->scalex)
scale = params->scalex;
n1 = n_points + 1;
if (!A) {
if (!
(A =
G_alloc_vector((params->KMAX2 + 2) * (params->KMAX2 + 2) + 1))) {
fprintf(stderr, "Cannot allocate memory for A\n");
return -1;
}
}
/*
C
C GENERATION OF MATRIX
C
C FIRST COLUMN
C
*/
A[1] = 0.;
for (k = 1; k <= n_points; k++) {
i1 = k + 1;
A[i1] = 1.;
}
/*
C
C OTHER COLUMNS
C
*/
RO = -params->rsm;
/* fprintf (stderr,"sm[%d]=%f,ro=%f\n",1,points[1].smooth,RO); */
for (k = 1; k <= n_points; k++) {
k1 = k * n1 + 1;
k2 = k + 1;
i1 = k1 + k;
if (params->rsm < 0.) { /*indicates variable smoothing */
A[i1] = -points[k - 1].sm; /* added by Mitasova nov. 96 */
/* fprintf (stderr,"sm[%d]=%f,a=%f\n",k,points[k-1].sm,A[i1]); */
}
else {
A[i1] = RO; /* constant smoothing */
}
/* if (i1 == 100) fprintf (stderr,"A[%d]=%f\n",i1,A[i1]); */
/* A[i1] = RO; */
for (l = k2; l <= n_points; l++) {
xx = points[k - 1].x - points[l - 1].x;
yy = points[k - 1].y - points[l - 1].y;
if ((params->theta) && (params->scalex)) {
/* re run anisotropy */
xxr = xx * rcos + yy * rsin;
yyr = yy * rcos - xx * rsin;
xx = xxr;
yy = yyr;
r = scale * xx * xx + yy * yy;
rfsta2 = fstar2 * (scale * xx * xx + yy * yy);
}
else {
r = xx * xx + yy * yy;
rfsta2 = fstar2 * (xx * xx + yy * yy);
}
if (rfsta2 == 0.) {
fprintf(stderr, "ident. points in segm. \n");
fprintf(stderr, "x[%d]=%f,x[%d]=%f,y[%d]=%f,y[%d]=%f\n",
k - 1, points[k - 1].x, l - 1, points[l - 1].x, k - 1,
points[k - 1].y, l - 1, points[l - 1].y);
return -1;
}
i1 = k1 + l;
A[i1] = params->interp(r, params->fi);
}
}
/*
C
C SYMMETRISATION
C
*/
amaxa = 1.;
for (k = 1; k <= n1; k++) {
k1 = (k - 1) * n1;
k2 = k + 1;
for (l = k2; l <= n1; l++) {
m = (l - 1) * n1 + k;
A[m] = A[k1 + l];
amaxa = amax1(A[m], amaxa);
}
}
m = 0;
for (i = 0; i <= n_points; i++) {
for (j = 0; j <= n_points; j++) {
m++;
matrix[i][j] = A[m];
}
}
if (G_ludcmp(matrix, n_points + 1, indx, &d) <= 0) { /* find the inverse of the mat
rix */
fprintf(stderr, "G_ludcmp() failed! n=%d\n", n_points);
return -1;
}
/*
G_free_vector(A);
*/
return 1;
}
|
/**
* \file
*
* \brief SERCOM SPI master with vectored I/O driver configuration
*
* Copyright (C) 2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_SPI_MASTER_VEC_H
#define CONF_SPI_MASTER_VEC_H
#ifdef __FREERTOS__
# include <FreeRTOS.h>
# include <semphr.h>
# define CONF_SPI_MASTER_VEC_OS_SUPPORT
# define CONF_SPI_MASTER_VEC_SEMAPHORE_TYPE xSemaphoreHandle
# define CONF_SPI_MASTER_VEC_CREATE_SEMAPHORE(semaphore) \
vSemaphoreCreateBinary(semaphore)
# define CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE(semaphore) \
xSemaphoreTake((semaphore), portMAX_DELAY)
# define CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE(semaphore) \
xSemaphoreGive((semaphore))
# define CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR(semaphore) \
xSemaphoreGiveFromISR((semaphore), NULL)
#endif
#endif // CONF_SPI_MASTER_VEC_H |
#include "op_node_by_label_scan.h"
OpBase *NewNodeByLabelScanOp(RedisModuleCtx *ctx, Graph *g, Node **node,
const char *graph_name, char *label) {
return (OpBase*)NewNodeByLabelScan(ctx, g, node, graph_name, label);
}
NodeByLabelScan* NewNodeByLabelScan(RedisModuleCtx *ctx, Graph *g, Node **node,
const char *graph_name, char *label) {
// Get graph store
LabelStore *store = LabelStore_Get(ctx, STORE_NODE, graph_name, label);
if(store == NULL) {
return NULL;
}
NodeByLabelScan *nodeByLabelScan = malloc(sizeof(NodeByLabelScan));
nodeByLabelScan->ctx = ctx;
nodeByLabelScan->node = node;
nodeByLabelScan->_node = *node;
nodeByLabelScan->graph = graph_name;
nodeByLabelScan->store = store;
LabelStore_Scan(store, &nodeByLabelScan->iter);
// Set our Op operations
nodeByLabelScan->op.name = "Node By Label Scan";
nodeByLabelScan->op.type = OPType_NODE_BY_LABEL_SCAN;
nodeByLabelScan->op.consume = NodeByLabelScanConsume;
nodeByLabelScan->op.reset = NodeByLabelScanReset;
nodeByLabelScan->op.free = NodeByLabelScanFree;
nodeByLabelScan->op.modifies = NewVector(char*, 1);
Vector_Push(nodeByLabelScan->op.modifies, Graph_GetNodeAlias(g, *node));
return nodeByLabelScan;
}
OpResult NodeByLabelScanConsume(OpBase *opBase, Graph* graph) {
NodeByLabelScan *op = (NodeByLabelScan*)opBase;
if(raxEOF(&op->iter)) return OP_DEPLETED;
char *id;
uint16_t idLen;
/* Update node */
Node **n = op->node;
int res = LabelStoreIterator_Next(&op->iter, &id, &idLen, (void**)op->node);
if(res == 0) {
return OP_DEPLETED;
}
return OP_OK;
}
OpResult NodeByLabelScanReset(OpBase *ctx) {
NodeByLabelScan *nodeByLabelScan = (NodeByLabelScan*)ctx;
/* Restore original node. */
*nodeByLabelScan->node = nodeByLabelScan->_node;
LabelStoreIterator_Free(&nodeByLabelScan->iter);
LabelStore_Scan(nodeByLabelScan->store, &nodeByLabelScan->iter);
return OP_OK;
}
void NodeByLabelScanFree(OpBase *op) {
NodeByLabelScan *nodeByLabelScan = (NodeByLabelScan*)op;
LabelStoreIterator_Free(&nodeByLabelScan->iter);
free(nodeByLabelScan);
} |
#include <grass/gis.h>
#include <grass/raster.h>
#include "his.h"
/****************************************************************************
* HIS_to_RGB() returns the R/G/B values for the proper HIS color associated
* with the following values:
* HUE:
* R: red percent. value 0 - 255
* G: grn percent. value 0 - 255
* B: blu percent. value 0 - 255
* INTENSITY:
* I intensity value: 0 (black) to 255 (full color)
* SATURATION:
* S saturation val: 0 (gray) to 255 (full color)
*
* make_gray_scale() generates a gray-scale color lookup table
****************************************************************************/
void HIS_to_RGB(int R, /* red percent. for hue: value 0 - 255 */
int G, /* grn percent. for hue: value 0 - 255 */
int B, /* blu percent. for hue: value 0 - 255 */
int I, /* intensity value: 0 (black) to 255 (white) */
int S, /* saturation val: 0 (gray) to 255 (full color) */
CELL * red, /* resulting red value */
CELL * grn, /* resulting green value */
CELL * blu /* resulting blue value */
)
{
/* modify according to intensity */
if (I != 255) {
R = R * I / 255;
G = G * I / 255;
B = B * I / 255;
}
/* modify according to saturation (actually "haze factor") */
if (S != 255) {
R = 127 + (R - 127) * S / 255;
G = 127 + (G - 127) * S / 255;
B = 127 + (B - 127) * S / 255;
}
/* make sure final values are within range */
if (R < 0)
R = 0;
if (G < 0)
G = 0;
if (B < 0)
B = 0;
if (R > 255)
R = 255;
if (G > 255)
G = 255;
if (B > 255)
B = 255;
*red = R;
*grn = G;
*blu = B;
}
int make_gray_scale(struct Colors *gray)
{
int i;
Rast_init_colors(gray);
for (i = 0; i < 256; i++)
Rast_set_c_color((CELL) i, i, i, i, gray);
return 0;
}
|
#ifndef UAPI_COMPEL_ASM_TYPES_H__
#define UAPI_COMPEL_ASM_TYPES_H__
#include <stdint.h>
#include <stdbool.h>
#include <signal.h>
#include "common/page.h"
#include "syscall-types.h"
#define SIGMAX 64
#define SIGMAX_OLD 31
typedef struct {
unsigned long r15;
unsigned long r14;
unsigned long r13;
unsigned long r12;
unsigned long bp;
unsigned long bx;
unsigned long r11;
unsigned long r10;
unsigned long r9;
unsigned long r8;
unsigned long ax;
unsigned long cx;
unsigned long dx;
unsigned long si;
unsigned long di;
unsigned long orig_ax;
unsigned long ip;
unsigned long cs;
unsigned long flags;
unsigned long sp;
unsigned long ss;
unsigned long fs_base;
unsigned long gs_base;
unsigned long ds;
unsigned long es;
unsigned long fs;
unsigned long gs;
} user_regs_struct_t;
#if 0
typedef struct {
unsigned short cwd;
unsigned short swd;
unsigned short twd; /* Note this is not the same as
the 32bit/x87/FSAVE twd */
unsigned short fop;
u64 rip;
u64 rdp;
u32 mxcsr;
u32 mxcsr_mask;
u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
u32 padding[24];
} user_fpregs_struct_t;
#endif
typedef struct xsave_struct user_fpregs_struct_t;
#ifdef CONFIG_X86_64
# define TASK_SIZE ((1UL << 47) - PAGE_SIZE)
#else
/*
* Task size may be limited to 3G but we need a
* higher limit, because it's backward compatible.
*/
# define TASK_SIZE (0xffffe000)
#endif
static inline unsigned long task_size(void) { return TASK_SIZE; }
typedef uint64_t auxv_t;
typedef uint32_t tls_t;
#define REG_RES(regs) ((regs).ax)
#define REG_IP(regs) ((regs).ip)
#define REG_SYSCALL_NR(regs) ((regs).orig_ax)
#define AT_VECTOR_SIZE 44
#endif /* UAPI_COMPEL_ASM_TYPES_H__ */
|
/*
* virnetclientprogram.h: generic network RPC client program
*
* Copyright (C) 2006-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#ifndef __VIR_NET_CLIENT_PROGRAM_H__
# define __VIR_NET_CLIENT_PROGRAM_H__
# include <rpc/types.h>
# include <rpc/xdr.h>
# include "virnetmessage.h"
typedef struct _virNetClient virNetClient;
typedef virNetClient *virNetClientPtr;
typedef struct _virNetClientProgram virNetClientProgram;
typedef virNetClientProgram *virNetClientProgramPtr;
typedef struct _virNetClientProgramEvent virNetClientProgramEvent;
typedef virNetClientProgramEvent *virNetClientProgramEventPtr;
typedef struct _virNetClientProgramErrorHandler virNetClientProgramErrorHander;
typedef virNetClientProgramErrorHander *virNetClientProgramErrorHanderPtr;
typedef void (*virNetClientProgramDispatchFunc)(virNetClientProgramPtr prog,
virNetClientPtr client,
void *msg,
void *opaque);
struct _virNetClientProgramEvent {
int proc;
virNetClientProgramDispatchFunc func;
size_t msg_len;
xdrproc_t msg_filter;
};
virNetClientProgramPtr virNetClientProgramNew(unsigned program,
unsigned version,
virNetClientProgramEventPtr events,
size_t nevents,
void *eventOpaque);
unsigned virNetClientProgramGetProgram(virNetClientProgramPtr prog);
unsigned virNetClientProgramGetVersion(virNetClientProgramPtr prog);
void virNetClientProgramRef(virNetClientProgramPtr prog);
void virNetClientProgramFree(virNetClientProgramPtr prog);
int virNetClientProgramMatches(virNetClientProgramPtr prog,
virNetMessagePtr msg);
int virNetClientProgramDispatch(virNetClientProgramPtr prog,
virNetClientPtr client,
virNetMessagePtr msg);
int virNetClientProgramCall(virNetClientProgramPtr prog,
virNetClientPtr client,
unsigned serial,
int proc,
xdrproc_t args_filter, void *args,
xdrproc_t ret_filter, void *ret);
#endif /* __VIR_NET_CLIENT_PROGRAM_H__ */
|
#include <cgreen/cgreen.h>
#include <string.h>
Ensure(strlen_of_hello_is_five) {
assert_that(strlen("Hiya"), is_equal_to(5));
}
TestSuite *our_tests() {
TestSuite *suite = create_test_suite();
add_test(suite, strlen_of_hello_is_five);
return suite;
}
int main(int argc, char **argv) {
return run_test_suite(our_tests(), create_text_reporter());
}
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ICONSIZESPINBOX_H
#define ICONSIZESPINBOX_H
#include <QSpinBox>
//! [0]
class IconSizeSpinBox : public QSpinBox
{
Q_OBJECT
public:
IconSizeSpinBox(QWidget *parent = 0);
int valueFromText(const QString &text) const;
QString textFromValue(int value) const;
};
//! [0]
#endif
|
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libsoc_debug.h"
#include "libsoc_conffile.h"
static char *
trim(char *buf)
{
size_t len = strlen(buf);
while (isspace(buf[--len]))
buf[len] = '\0';
while (isspace(*buf))
buf++;
return buf;
}
static keyval*
_create_keyval(const char *path, char *line)
{
keyval *kv;
char *key, *val, *save;
key = strtok_r(line, "=", &save);
val = strtok_r(NULL, "\n", &save);
if (!val)
{
libsoc_warn("Invalid key = value in %s:\n%s\n", path, line);
return NULL;
}
key = trim(key);
val = trim(val);
kv = calloc(1, sizeof(keyval));
kv->key = strdup(key);
kv->val = strdup(val);
return kv;
}
conffile *
conffile_load(const char *path)
{
int rc;
FILE *fp;
char line[256];
conffile *conf = calloc(1, sizeof(conffile));
section *stmp = NULL;
keyval *ktmp = NULL;
fp = fopen (path, "r");
if (fp)
{
while(fgets(line, sizeof(line), fp))
{
if (*line == '#' || *line == '\0' || *line == '\n')
continue;
if (line[0] == '[')
{
// new section
stmp = calloc(1, sizeof(section));
stmp->next = conf->sections;
conf->sections = stmp;
rc = strlen(line);
if (line[rc-2] != ']' || (rc-2) > sizeof(stmp->name))
{
libsoc_warn("Invalid section line in %s:\n%s\n", path, line);
goto cleanup;
}
line[rc-2] = '\0';
strcpy(stmp->name, trim(&line[1]));
}
else
{
if (!conf->sections)
{
libsoc_warn("Section must be declared in %s before line: %s\n",
path, line);
}
ktmp = _create_keyval(path, line);
if (ktmp)
{
ktmp->next = conf->sections->settings;
conf->sections->settings = ktmp;
}
else
{
goto cleanup;
}
}
}
fclose(fp);
}
else
{
libsoc_warn("Unable to open board config: %s\n", path);
}
return conf;
cleanup:
if (fp)
fclose(fp);
conffile_free(conf);
return NULL;
}
void conffile_free(conffile *conf)
{
section *sptr, *stmp;
keyval *kptr, *ktmp;
if (!conf)
return;
sptr = conf->sections;
while (sptr)
{
kptr = sptr->settings;
while (kptr)
{
ktmp = kptr->next;
free(kptr->key);
free(kptr->val);
free(kptr);
kptr = ktmp;
}
stmp = sptr->next;
free(sptr);
sptr = stmp;
}
}
const char*
conffile_get(conffile *conf, const char *sectname, const char *key, const char *defval)
{
section *s = conf->sections;
while(s)
{
if (!strcmp(s->name, sectname))
{
keyval *kv = s->settings;
while(kv)
{
if (!strcmp(kv->key, key))
return kv->val;
kv = kv->next;
}
return defval;
}
s = s->next;
}
return defval;
}
int
conffile_get_int(conffile *conf, const char *sectname, const char *key, int defval)
{
long val = defval;
const char *strval = conffile_get(conf, sectname, key, NULL);
if (strval)
{
char *endptr;
val = strtol(strval, &endptr, 10);
if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
|| (errno != 0 && val == 0) || endptr == strval || *endptr != '\0'
|| val > INT_MAX)
{
libsoc_warn("Invalid number: %s\n", strval);
val = defval;
}
}
return val;
}
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 Ruby-GNOME2 Project Team
* Copyright (C) 2004 Ruby-GNOME2 Project Team
* Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "rbgtksourcemain.h"
/* Class: Gtk::SourceStyleSchemeManager
* A class to manage source style scheme.
*/
#define RG_TARGET_NAMESPACE cSourceStyleSchemeManager
#define _SELF(self) (GTK_SOURCE_STYLE_SCHEME_MANAGER(RVAL2GOBJ(self)))
/* Class method: new
* Returns: a newly created Gtk::SourceStyleSchemeManager object.
*/
static VALUE
rg_initialize(VALUE self)
{
G_INITIALIZE (self, gtk_source_style_scheme_manager_new ());
return Qnil;
}
/* Class method: default
*
* Gets the default style scheme manager.
*
* Returns: a Gtk::SourceStyleSchemeManager
*/
static VALUE
rg_s_default(VALUE self)
{
GtkSourceStyleSchemeManager* sssm = gtk_source_style_scheme_manager_get_default();
GType gtype = G_TYPE_FROM_INSTANCE(sssm);
gchar *gtypename = (gchar *) g_type_name (gtype);
if (strncmp (gtypename, "Gtk", 3) == 0)
gtypename += 3;
if (!rb_const_defined_at (mGtk, rb_intern (gtypename)))
G_DEF_CLASS (gtype, gtypename, mGtk);
return GOBJ2RVAL(sssm);
}
/* Method: append_search_path(path)
* path: additional style scheme file directory path (string)
*
* Appends the style scheme files directory for the given style scheme manager.
*
* Returns: self.
*/
static VALUE
rg_append_search_path(VALUE self, VALUE path)
{
gtk_source_style_scheme_manager_append_search_path (_SELF (self), RVAL2CSTR(path));
return self;
}
/* Method: prepend_search_path(path)
* path: additional style scheme file directory path (string)
*
* Prepend the style scheme files directory for the given style scheme manager.
*
* Returns: self.
*/
static VALUE
rg_prepend_search_path(VALUE self, VALUE path)
{
gtk_source_style_scheme_manager_prepend_search_path (_SELF (self), RVAL2CSTR(path));
return self;
}
/*
* Method: scheme(scheme_id)
* scheme_id: a style scheme id (as a string).
*
* Gets the Gtk::SourceStyleScheme which is associated with the given id
* in the style scheme manager.
*
* Returns: a Gtk::SourceStyleScheme, or nil if there is no style scheme
* associated with the given id.
*/
static VALUE
rg_get_scheme(VALUE self, VALUE scheme_id)
{
return
GOBJ2RVAL (gtk_source_style_scheme_manager_get_scheme
(_SELF (self), RVAL2CSTR (scheme_id)));
}
/*
* Method: force_rescan
*
* Forces all style schemes to be reloaded the next time the
* Gtk::SourceStyleSchemeManager is accessed.
*
* Returns: self.
*/
static VALUE
rg_force_rescan(VALUE self)
{
gtk_source_style_scheme_manager_force_rescan(_SELF (self));
return self;
}
void
Init_gtk_sourcestyleschememanager (VALUE mGtk)
{
VALUE RG_TARGET_NAMESPACE =
G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE_SCHEME_MANAGER,
"SourceStyleSchemeManager", mGtk);
RG_DEF_METHOD(initialize, 0);
RG_DEF_METHOD(append_search_path, 1);
RG_DEF_METHOD(prepend_search_path, 1);
RG_DEF_METHOD(get_scheme, 1);
RG_DEF_METHOD(force_rescan, 0);
RG_DEF_SMETHOD(default, 0);
G_DEF_SETTERS (RG_TARGET_NAMESPACE);
}
|
/*
* Copyright (C) 2011 Nokia Corporation.
* Author: Lauri T. Aarnio
*
* Licensed under LGPL version 2.1, see top level LICENSE file for details.
*/
/* lbrdbdctl, A tool for sending commands to lbrdbd.
*/
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <assert.h>
#include "lb.h"
#include "rule_tree.h"
#include "rule_tree_rpc.h"
#include "mapping.h"
#include "liblb.h"
#include "exported.h"
#include "ldbox_version.h"
#include "liblbcallers.h"
void *liblb_handle = NULL;
/* create call_lb__ruletree_rpc__init2__() */
LIBLB_CALLER(char *, lb__ruletree_rpc__init2__,
(void), (),
NULL)
/* create call_lb__ruletree_rpc__ping__() */
LIBLB_VOID_CALLER(lb__ruletree_rpc__ping__,
(void), ())
static const char *progname = NULL;
char *ldbox_session_dir = NULL;
int ruletree_get_min_client_socket_fd(void)
{
return(10);
}
int main(int argc, char *argv[])
{
int opt;
const char *cmd;
const char *loglevel = "warning";
int dlopen_liblb = 1;
progname = argv[0];
while ((opt = getopt(argc, argv, "l:s:n")) != -1) {
switch (opt) {
case 'l':
loglevel = optarg;
break;
case 's':
ldbox_session_dir = strdup(optarg);
break;
case 'n':
dlopen_liblb = 0;
break;
default:
fprintf(stderr, "Illegal option\n");
exit(1);
}
}
/* init logging.
* if debug_level and/or debug_file is NULL, logger
* will read the values from env.vars. */
lblog_init_level_logfile_format(loglevel, "-", NULL);
if (dlopen_liblb) {
/* disable mapping; dlopen must run without mapping
* if running inside an lb session */
setenv("LDBOX_DISABLE_MAPPING", "1", 1/*overwrite*/);
liblb_handle = dlopen(LIBLB_SONAME, RTLD_NOW);
unsetenv("LDBOX_DISABLE_MAPPING"); /* enable mapping */
}
if (!ldbox_session_dir) {
ldbox_session_dir = getenv("LDBOX_SESSION_DIR");
}
if (!ldbox_session_dir) {
fprintf(stderr, "ERROR: no session "
"(LDBOX_SESSION_DIR is not set) - use option -s or "
"run this program inside a Scratchbox 2 session\n");
exit(1);
}
cmd = argv[optind];
if (!cmd) {
fprintf(stderr, "Usage:\n\t%s command\n", argv[0]);
fprintf(stderr, "commands\n"
" ping Send a 'ping' to lbrdbd\n"
" init2 Send a 'init2' to lbrdbd, wait and print the reply\n");
exit(1);
}
if (!strcmp(cmd, "ping")) {
if (liblb_handle) {
call_lb__ruletree_rpc__ping__();
} else {
ruletree_rpc__ping();
}
} else if (!strcmp(cmd, "init2")) {
char *msg;
if (liblb_handle) {
msg = call_lb__ruletree_rpc__init2__();
} else {
msg = ruletree_rpc__init2();
}
if (msg) {
printf("%s\n", msg);
free(msg);
} else {
exit(1);
}
} else {
fprintf(stderr, "Unknown command %s\n", cmd);
exit(1);
}
return(0);
}
/* This program is directly linked to the RPC routines
* (because they are hidden in liblb, and could not be used otherwise).
* The RPC routines want some wrappers for *_nomap_nolog functions,
* these will use the ordinary functions... a side-effect is that the
* network addresses are subject to mapping operations here.
* Fortunately that won't happen in the usual case when the RPC
* functions are used inside liblb.
*/
int unlink_nomap_nolog(const char *pathname)
{
return(unlink(pathname));
}
ssize_t sendto_nomap_nolog(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
{
return(sendto(s, buf, len, flags, to, tolen));
}
ssize_t recvfrom_nomap_nolog(int s, void *buf, size_t len, int flags, __SOCKADDR_ARG from, socklen_t *fromlen)
{
return(recvfrom(s, buf, len, flags, from, fromlen));
}
int bind_nomap_nolog(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen)
{
return(bind(sockfd, my_addr, addrlen));
}
int chmod_nomap_nolog(const char *path, mode_t mode)
{
return(chmod(path, mode));
}
|
/* **********************************************************
* Copyright (c) 2015 Google, 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:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Google, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, 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.
*/
/* shared options for the frontend, the client, and the documentation */
#ifndef _OPTIONS_H_
#define _OPTIONS_H_ 1
#define REPLACE_POLICY_NON_SPECIFIED ""
#define REPLACE_POLICY_LRU "LRU"
#define REPLACE_POLICY_LFU "LFU"
#define REPLACE_POLICY_FIFO "FIFO"
#define CPU_CACHE "cache"
#define TLB "TLB"
#include <string>
#include "droption.h"
extern droption_t<std::string> op_ipc_name;
extern droption_t<unsigned int> op_num_cores;
extern droption_t<unsigned int> op_line_size;
extern droption_t<bytesize_t> op_L1I_size;
extern droption_t<bytesize_t> op_L1D_size;
extern droption_t<unsigned int> op_L1I_assoc;
extern droption_t<unsigned int> op_L1D_assoc;
extern droption_t<bytesize_t> op_LL_size;
extern droption_t<unsigned int> op_LL_assoc;
extern droption_t<bool> op_use_physical;
extern droption_t<unsigned int> op_virt2phys_freq;
extern droption_t<std::string> op_replace_policy;
extern droption_t<bytesize_t> op_page_size;
extern droption_t<unsigned int> op_TLB_L1I_entries;
extern droption_t<unsigned int> op_TLB_L1D_entries;
extern droption_t<unsigned int> op_TLB_L1I_assoc;
extern droption_t<unsigned int> op_TLB_L1D_assoc;
extern droption_t<unsigned int> op_TLB_L2_entries;
extern droption_t<unsigned int> op_TLB_L2_assoc;
extern droption_t<std::string> op_TLB_replace_policy;
extern droption_t<std::string> op_simulator_type;
extern droption_t<unsigned int> op_verbose;
extern droption_t<std::string> op_dr_root;
extern droption_t<bool> op_dr_debug;
extern droption_t<std::string> op_dr_ops;
extern droption_t<std::string> op_tracer;
extern droption_t<std::string> op_tracer_ops;
extern droption_t<bytesize_t> op_skip_refs;
extern droption_t<bytesize_t> op_warmup_refs;
extern droption_t<bytesize_t> op_sim_refs;
#endif /* _OPTIONS_H_ */
|
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef BODYFORCE_H
#define BODYFORCE_H
#include "Kernel.h"
//Forward Declarations
class BodyForce;
class Function;
template<>
InputParameters validParams<BodyForce>();
class BodyForce : public Kernel
{
public:
BodyForce(const std::string & name, InputParameters parameters);
protected:
virtual Real computeQpResidual();
Real _value;
const bool _has_function;
Function * const _function;
};
#endif
|
/*
Copyright (C) 2010 William Hart
Copyright (C) 2010 Fredrik Johansson
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 "fmpz_mat.h"
void
fmpz_mat_init_set(fmpz_mat_t mat, const fmpz_mat_t src)
{
fmpz_mat_init(mat, src->r, src->c);
fmpz_mat_set(mat, src);
}
|
/* This file is part of the KDE project
Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef Phonon_XINE_AUDIOOUTPUT_H
#define Phonon_XINE_AUDIOOUTPUT_H
#include "abstractaudiooutput.h"
#include <QFile>
#include "xineengine.h"
#include <xine.h>
#include "xinestream.h"
#include <phonon/audiooutputinterface.h>
#include "connectnotificationinterface.h"
namespace Phonon
{
namespace Xine
{
class AudioOutputXT : public SinkNodeXT
{
friend class AudioOutput;
public:
AudioOutputXT() : SinkNodeXT("AudioOutput"), m_audioPort(0) {}
~AudioOutputXT();
void rewireTo(SourceNodeXT *);
xine_audio_port_t *audioPort() const;
private:
xine_audio_port_t *m_audioPort;
};
class AudioOutput : public AbstractAudioOutput, public AudioOutputInterface, public ConnectNotificationInterface
{
Q_OBJECT
Q_INTERFACES(Phonon::AudioOutputInterface Phonon::Xine::ConnectNotificationInterface)
public:
AudioOutput(QObject *parent);
~AudioOutput();
// Attributes Getters:
qreal volume() const;
int outputDevice() const;
// Attributes Setters:
void setVolume(qreal newVolume);
bool setOutputDevice(int newDevice);
bool setOutputDevice(const AudioOutputDevice &newDevice);
void downstreamEvent(Event *);
virtual void graphChanged();
protected:
bool event(QEvent *);
void xineEngineChanged();
void aboutToChangeXineEngine();
Q_SIGNALS:
// for the Frontend
void volumeChanged(qreal newVolume);
void audioDeviceFailed();
private:
xine_audio_port_t *createPort(const AudioOutputDevice &device);
qreal m_volume;
AudioOutputDevice m_device;
};
}} //namespace Phonon::Xine
// vim: sw=4 ts=4 tw=80
#endif // Phonon_XINE_AUDIOOUTPUT_H
|
/*
(c) Copyright 2008 Denis Oliver Kropp
All rights reserved.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <direct/messages.h>
#include <directfb.h>
#include <directfb_strings.h>
#include <directfb_util.h>
static const DirectFBPixelFormatNames( format_names );
/**********************************************************************************************************************/
static int
print_usage( const char *prg )
{
int i = 0;
fprintf (stderr, "\n");
fprintf (stderr, "== DirectFB Font Test (version %s) ==\n", DIRECTFB_VERSION);
fprintf (stderr, "\n");
fprintf (stderr, "Known pixel formats:\n");
while (format_names[i].format != DSPF_UNKNOWN) {
DFBSurfacePixelFormat format = format_names[i].format;
fprintf (stderr, " %-10s %2d bits, %d bytes",
format_names[i].name, DFB_BITS_PER_PIXEL(format),
DFB_BYTES_PER_PIXEL(format));
if (DFB_PIXELFORMAT_HAS_ALPHA(format))
fprintf (stderr, " ALPHA");
if (DFB_PIXELFORMAT_IS_INDEXED(format))
fprintf (stderr, " INDEXED");
if (DFB_PLANAR_PIXELFORMAT(format)) {
int planes = DFB_PLANE_MULTIPLY(format, 1000);
fprintf (stderr, " PLANAR (x%d.%03d)",
planes / 1000, planes % 1000);
}
fprintf (stderr, "\n");
++i;
}
fprintf (stderr, "\n");
fprintf (stderr, "\n");
fprintf (stderr, "Usage: %s [options] <file>\n", prg);
fprintf (stderr, "\n");
fprintf (stderr, "Options:\n");
fprintf (stderr, " -h, --help Show this help message\n");
fprintf (stderr, " -v, --version Print version information\n");
return -1;
}
/**********************************************************************************************************************/
static IDirectFBFont *
CreateFont( IDirectFB *dfb, const char *url, int size )
{
DFBResult ret;
DFBFontDescription fdesc;
IDirectFBFont *font;
/* Create the font. */
fdesc.flags = DFDESC_HEIGHT;
fdesc.height = size;
ret = dfb->CreateFont( dfb, url, &fdesc, &font );
if (ret) {
D_DERROR( ret, "DFBTest/Font: IDirectFB::CreateFont( '%s' ) failed!\n", url );
return NULL;
}
return font;
}
int
main( int argc, char *argv[] )
{
int i;
DFBResult ret;
DFBSurfaceDescription desc;
IDirectFB *dfb;
IDirectFBSurface *dest = NULL;
const char *url = NULL;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Font: DirectFBInit() failed!\n" );
return ret;
}
/* Parse arguments. */
for (i=1; i<argc; i++) {
const char *arg = argv[i];
if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
return print_usage( argv[0] );
else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION);
return false;
}
else if (!url)
url = arg;
else
return print_usage( argv[0] );
}
/* Check if we got an URL. */
if (!url)
return print_usage( argv[0] );
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Font: DirectFBCreate() failed!\n" );
return ret;
}
/* Fill description for a primary surface. */
desc.flags = DSDESC_CAPS;
desc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
/* Create a primary surface. */
ret = dfb->CreateSurface( dfb, &desc, &dest );
if (ret) {
D_DERROR( ret, "DFBTest/Font: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
dest->GetSize( dest, &desc.width, &desc.height );
dest->GetPixelFormat( dest, &desc.pixelformat );
D_INFO( "DFBTest/Font: Destination is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
dest->SetColor( dest, 0xff, 0xff, 0xff, 0xff );
for (i=10; i<50; i++) {
IDirectFBFont *font;
font = CreateFont( dfb, url, i );
dest->Clear( dest, 0, 0, 0, 0 );
dest->SetFont( dest, font );
dest->DrawString( dest, "Test String", -1, 100, 100, DSTF_TOPLEFT );
dest->Flip( dest, NULL, DSFLIP_NONE );
font->Release( font );
sleep( 1 );
}
out:
if (dest)
dest->Release( dest );
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
|
/*
* Copyright © 2008 Chris Wilson
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Chris Wilson not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Chris Wilson makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Wilson <chris@chris-wilson.co.uk>
*/
/* This test case exercises a "Potential division by zero in cairo_arc"
* reported by Luiz Americo Pereira Camara <luizmed@oi.com.br>,
* http://lists.cairographics.org/archives/cairo/2008-May/014054.html.
*/
#include "cairo-test.h"
static cairo_test_draw_function_t draw;
static const cairo_test_t test = {
"degenerate-arc",
"Tests the behaviour of degenerate arcs",
40, 40,
draw
};
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int n;
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_width (cr, 5);
cairo_set_source_rgb (cr, 0, 1, 0);
for (n = 0; n < 8; n++) {
double theta = n * 2 * M_PI / 8;
cairo_new_sub_path (cr);
cairo_arc (cr, 20, 20, 15, theta, theta);
cairo_close_path (cr);
}
cairo_stroke (cr);
cairo_set_line_width (cr, 2);
cairo_set_source_rgb (cr, 0, 0, 1);
for (n = 0; n < 8; n++) {
double theta = n * 2 * M_PI / 8;
cairo_move_to (cr, 20, 20);
cairo_arc (cr, 20, 20, 15, theta, theta);
}
cairo_stroke (cr);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_arc (cr, 20, 20, 2, 0, 2*M_PI);
cairo_fill (cr);
return CAIRO_TEST_SUCCESS;
}
int
main (void)
{
return cairo_test (&test);
}
|
/*
Copyright (C) 2011 Fredrik Johansson
Copyright (C) 2012 Lina Kulakova
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 <https://www.gnu.org/licenses/>.
*/
#ifdef T
#include "templates.h"
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "fmpz_vec.h"
#include "ulong_extras.h"
int
main(void)
{
int iter;
FLINT_TEST_INIT(state);
flint_printf("is_irreducible_ben_or....");
fflush(stdout);
for (iter = 0; iter < 5 * flint_test_multiplier(); iter++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) poly1, poly2;
slong length;
int i, num;
TEMPLATE(T, ctx_randtest) (ctx, state);
TEMPLATE(T, poly_init) (poly1, ctx);
TEMPLATE(T, poly_init) (poly2, ctx);
length = n_randint(state, 7) + 2;
do
{
TEMPLATE(T, poly_randtest) (poly1, state, length, ctx);
if (!TEMPLATE(T, poly_is_zero) (poly1, ctx))
TEMPLATE(T, poly_make_monic) (poly1, poly1, ctx);
}
while ((!TEMPLATE(T, poly_is_irreducible_ben_or) (poly1, ctx))
|| (poly1->length < 2));
num = n_randint(state, 5) + 1;
for (i = 0; i < num; i++)
{
do
{
TEMPLATE(T, poly_randtest) (poly2, state, length, ctx);
if (!TEMPLATE(T, poly_is_zero) (poly2, ctx))
TEMPLATE(T, poly_make_monic) (poly2, poly2, ctx);
}
while ((!TEMPLATE(T, poly_is_irreducible_ben_or) (poly2, ctx))
|| (poly2->length < 2));
TEMPLATE(T, poly_mul) (poly1, poly1, poly2, ctx);
}
if (TEMPLATE(T, poly_is_irreducible_ben_or) (poly1, ctx))
{
flint_printf
("Error: reducible polynomial declared irreducible!\n");
flint_printf("poly:\n");
TEMPLATE(T, poly_print) (poly1, ctx);
flint_printf("\n");
fflush(stdout);
flint_abort();
}
TEMPLATE(T, poly_clear) (poly1, ctx);
TEMPLATE(T, poly_clear) (poly2, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
#endif
|
#ifndef __AF_H_
#define __AF_H_
#include "libavutil/mem.h"
#define AF_DETACH 2
#define AF_OK 1
#define AF_TRUE 1
#define AF_FALSE 0
#define AF_UNKNOWN -1
#define AF_ERROR -2
#define AF_FATAL -3
#define AF_NCH 6
// Audio data chunk
typedef struct af_data_s
{
void* audio; // data buffer
int len; // buffer length
int rate; // sample rate
int nch; // number of channels
int format; // format
int bps; // bytes per sample
} af_data_t;
void * af_init(int rate, int nch, int format, int bps, float dB);
void af_volume(void* priv, float dB);
void af_volume_level(void* priv, int level);
double af_buffer_time(void *priv);
af_data_t* af_play(void *priv, af_data_t *af_data);
af_data_t* af_data_mixer(af_data_t *data, unsigned int offset, unsigned int len, af_data_t *newdata);
af_data_t* af_copy(af_data_t *indata);
af_data_t* af_ncopy(af_data_t *indata, int len);
af_data_t* af_empty(int rate, int nch, int format, int bps, int len);
af_data_t* af_emptyfromdata(af_data_t *indata, int len);
void af_drop_data(af_data_t *indata, int len);
double af_data2time(af_data_t *indata);
double af_len2time(af_data_t *indata, int len);
int af_time2len(af_data_t *indata, double ts);
int af_round_len(af_data_t *indata, int len);
int af_fix_len(af_data_t *indata);
af_data_t* af_data_free(af_data_t* af_data);
void af_uninit(void *priv);
#endif
|
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* SPDX-License-Identifier: LGPL-2.0+
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#pragma once
#include "ostree-types.h"
G_BEGIN_DECLS
gboolean _ostree_impl_system_generator (const char *ostree_cmdline, const char *normal_dir, const char *early_dir, const char *late_dir, GError **error);
typedef struct {
gboolean (* ostree_system_generator) (const char *ostree_cmdline, const char *normal_dir, const char *early_dir, const char *late_dir, GError **error);
gboolean (* ostree_generate_grub2_config) (OstreeSysroot *sysroot, int bootversion, int target_fd, GCancellable *cancellable, GError **error);
gboolean (* ostree_static_delta_dump) (OstreeRepo *repo, const char *delta_id, GCancellable *cancellable, GError **error);
gboolean (* ostree_static_delta_query_exists) (OstreeRepo *repo, const char *delta_id, gboolean *out_exists, GCancellable *cancellable, GError **error);
gboolean (* ostree_static_delta_delete) (OstreeRepo *repo, const char *delta_id, GCancellable *cancellable, GError **error);
gboolean (* ostree_repo_verify_bindings) (const char *collection_id, const char *ref_name, GVariant *commit, GError **error);
gboolean (* ostree_finalize_staged) (OstreeSysroot *sysroot, GCancellable *cancellable, GError **error);
} OstreeCmdPrivateVTable;
/* Note this not really "public", we just export the symbol, but not the header */
_OSTREE_PUBLIC const OstreeCmdPrivateVTable *
ostree_cmd__private__ (void);
G_END_DECLS
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************
rbgtkthreads.c -
$Author: sakai $
$Date: 2007/07/08 03:00:50 $
Copyright (C) 2003-2005 Masao Mutoh
************************************************/
#include "global.h"
#ifdef G_THREADS_ENABLED
static VALUE
rbgdk_threads_init(self)
VALUE self;
{
#ifndef GDK_WINDOWING_WIN32
if (!g_thread_supported()){
g_thread_init(NULL);
}
gdk_threads_init();
#endif
return self;
}
static VALUE
rbgdk_threads_enter(self)
VALUE self;
{
gdk_threads_enter();
return self;
}
static VALUE
rbgdk_threads_leave(self)
VALUE self;
{
gdk_threads_leave();
return self;
}
static VALUE
rbgdk_threads_synchronize(self)
VALUE self;
{
VALUE func = rb_block_proc();
gdk_threads_enter();
func = rb_block_proc();
rb_funcall(func, id_call, 0);
gdk_threads_leave();
return Qnil;
}
#endif
void
Init_gtk_gdk_threads()
{
#ifdef G_THREADS_ENABLED
VALUE mGdkThreads = rb_define_module_under(mGdk, "Threads");
rb_define_module_function(mGdkThreads, "init", rbgdk_threads_init, 0);
rb_define_module_function(mGdkThreads, "enter", rbgdk_threads_enter, 0);
rb_define_module_function(mGdkThreads, "leave", rbgdk_threads_leave, 0);
rb_define_module_function(mGdkThreads, "synchronize", rbgdk_threads_synchronize, 0);
#endif
}
|
/**
@file orientationsensor_a.h
@brief D-Bus Adaptor for OrientationSensor
<p>
Copyright (C) 2009-2010 Nokia Corporation
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Antti Virtanen <antti.i.virtanen@nokia.com>
This file is part of Sensord.
Sensord is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License
version 2.1 as published by the Free Software Foundation.
Sensord 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 Sensord. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#ifndef ORIENTATION_SENSOR_H
#define ORIENTATION_SENSOR_H
#include <QtDBus/QtDBus>
#include "datatypes/orientation.h"
#include "datatypes/unsigned.h"
#include "abstractsensor_a.h"
class OrientationSensorChannelAdaptor : public AbstractSensorChannelAdaptor
{
Q_OBJECT
Q_DISABLE_COPY(OrientationSensorChannelAdaptor)
Q_CLASSINFO("D-Bus Interface", "local.OrientationSensor")
Q_PROPERTY(Unsigned orientation READ orientation)
Q_PROPERTY(int threshold READ threshold WRITE setThreshold)
public:
OrientationSensorChannelAdaptor(QObject* parent);
public Q_SLOTS:
Unsigned orientation() const;
int threshold() const;
void setThreshold(int value);
Q_SIGNALS:
void orientationChanged(const Unsigned& orientation);
};
#endif
|
/*
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 <https://www.gnu.org/licenses/>.
*/
#include "fq_zech_mat.h"
#ifdef T
#undef T
#endif
#define T fq_zech
#define CAP_T FQ_ZECH
#include "fq_mat_templates/solve_tril.c"
#undef CAP_T
#undef T
|
/*
* This file is part of libFirm.
* Copyright (C) 2012 University of Karlsruhe.
*/
/**
* @file
* @brief Loop data structure and access functions -- private stuff.
* @author Goetz Lindenmaier
* @date 7.2002
*/
#include "irloop_t.h"
#include "irprog_t.h"
#include <stdlib.h>
void add_loop_son(ir_loop *loop, ir_loop *son)
{
assert(loop->kind == k_ir_loop);
assert(get_kind(son) == k_ir_loop);
loop_element lson;
lson.son = son;
ARR_APP1(loop_element, loop->children, lson);
}
void add_loop_node(ir_loop *loop, ir_node *n)
{
assert(loop->kind == k_ir_loop);
loop_element ln;
ln.node = n;
ARR_APP1(loop_element, loop->children, ln);
}
void add_loop_irg(ir_loop *loop, ir_graph *irg)
{
assert(loop->kind == k_ir_loop);
loop_element ln;
ln.irg = irg;
ARR_APP1(loop_element, loop->children, ln);
}
void mature_loops(ir_loop *loop, struct obstack *obst)
{
loop_element *new_children = DUP_ARR_D(loop_element, obst, loop->children);
DEL_ARR_F(loop->children);
loop->children = new_children;
/* mature child loops */
for (size_t i = ARR_LEN(new_children); i-- > 0;) {
loop_element child = new_children[i];
if (*child.kind == k_ir_loop) {
mature_loops(child.son, obst);
}
}
}
ir_loop *(get_loop_outer_loop)(const ir_loop *loop)
{
return _get_loop_outer_loop(loop);
}
unsigned (get_loop_depth)(const ir_loop *loop)
{
return _get_loop_depth(loop);
}
size_t get_loop_n_elements(const ir_loop *loop)
{
assert(loop->kind == k_ir_loop);
return ARR_LEN(loop->children);
}
loop_element get_loop_element(const ir_loop *loop, size_t pos)
{
assert(loop->kind == k_ir_loop && pos < ARR_LEN(loop->children));
return loop->children[pos];
}
void set_irn_loop(ir_node *n, ir_loop *loop)
{
n->loop = loop;
}
ir_loop *(get_irn_loop)(const ir_node *n)
{
return _get_irn_loop(n);
}
long get_loop_loop_nr(const ir_loop *loop)
{
assert(loop->kind == k_ir_loop);
#ifdef DEBUG_libfirm
return loop->loop_nr;
#else
return (long)loop;
#endif
}
void set_loop_link(ir_loop *loop, void *link)
{
assert(loop->kind == k_ir_loop);
loop->link = link;
}
void *get_loop_link(const ir_loop *loop)
{
assert(loop->kind == k_ir_loop);
return loop->link;
}
void (set_irg_loop)(ir_graph *irg, ir_loop *loop)
{
_set_irg_loop(irg, loop);
}
ir_loop *(get_irg_loop)(const ir_graph *irg)
{
return _get_irg_loop(irg);
}
ir_loop *alloc_loop(ir_loop *father, struct obstack *obst)
{
ir_loop *son = OALLOCZ(obst, ir_loop);
son->kind = k_ir_loop;
son->children = NEW_ARR_F(loop_element, 0);
son->link = NULL;
if (father) {
son->outer_loop = father;
add_loop_son(father, son);
son->depth = father->depth + 1;
} else { /* The root loop */
son->outer_loop = son;
son->depth = 0;
}
#ifdef DEBUG_libfirm
son->loop_nr = get_irp_new_node_nr();
#endif
return son;
}
static bool is_loop_variant(ir_loop *l, ir_loop *b)
{
if (l == b)
return true;
for (size_t i = 0, n_elems = get_loop_n_elements(l); i < n_elems; ++i) {
loop_element e = get_loop_element(l, i);
if (is_ir_loop(e.kind) && is_loop_variant(e.son, b))
return true;
}
return false;
}
int is_loop_invariant(const ir_node *n, const ir_node *block)
{
ir_loop *const l = get_irn_loop(block);
ir_node const *const b = get_block_const(n);
return !is_loop_variant(l, get_irn_loop(b));
}
|
/*****************************************************************************
* *
* PrimeSense Sensor 5.0 Alpha *
* Copyright (C) 2010 PrimeSense Ltd. *
* *
* This file is part of PrimeSense Common. *
* *
* PrimeSense Sensor 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. *
* *
* PrimeSense Sensor 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 PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#ifndef __XN_ACTUAL_PROPERTIES_HASH_H__
#define __XN_ACTUAL_PROPERTIES_HASH_H__
#include "XnProperty.h"
#include "XnActualIntProperty.h"
#include "XnActualRealProperty.h"
#include "XnActualStringProperty.h"
#include "XnActualGeneralProperty.h"
/**
* A hash table of actual properties. The user can safely assume that every property in this
* hash is actual.
*/
class XN_DDK_CPP_API XnActualPropertiesHash
{
public:
XnActualPropertiesHash(const XnChar* strName);
~XnActualPropertiesHash();
typedef XnPropertiesHash::Iterator Iterator;
typedef XnPropertiesHash::ConstIterator ConstIterator;
XnStatus Add(const XnChar* strName, XnUInt64 nValue);
XnStatus Add(const XnChar* strName, XnDouble dValue);
XnStatus Add(const XnChar* strName, const XnChar* strValue);
XnStatus Add(const XnChar* strName, const XnGeneralBuffer& gbValue);
XnStatus Remove(const XnChar* strName);
XnStatus Remove(ConstIterator where);
inline XnBool IsEmpty() const { return m_Hash.IsEmpty(); }
XnStatus Clear();
inline XnStatus Find(const XnChar* strName, Iterator& iter) { return m_Hash.Find(strName, iter); }
inline XnStatus Find(const XnChar* strName, ConstIterator& iter) const { return m_Hash.Find(strName, iter); }
inline XnStatus Get(const XnChar* strName, XnProperty*& pProp) const { return m_Hash.Get(strName, pProp); }
inline Iterator begin() { return m_Hash.begin(); }
inline ConstIterator begin() const { return m_Hash.begin(); }
inline Iterator end() { return m_Hash.end(); }
inline ConstIterator end() const { return m_Hash.end(); }
XnStatus CopyFrom(const XnActualPropertiesHash& other);
protected:
XnPropertiesHash m_Hash;
XnChar m_strName[XN_DEVICE_MAX_STRING_LENGTH];
};
#endif //__XN_ACTUAL_PROPERTIES_HASH_H__
|
/*
* Copyright (C) 2011, 2012 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 INC. 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 INC. 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 SlotVisitor_h
#define SlotVisitor_h
#include "HandleTypes.h"
#include "MarkStackInlines.h"
#include <wtf/text/StringHash.h>
namespace JSC {
class ConservativeRoots;
class GCThreadSharedData;
class Heap;
template<typename T> class Weak;
template<typename T> class WriteBarrierBase;
template<typename T> class JITWriteBarrier;
class SlotVisitor {
WTF_MAKE_NONCOPYABLE(SlotVisitor);
friend class HeapRootVisitor; // Allowed to mark a JSValue* or JSCell** directly.
public:
SlotVisitor(GCThreadSharedData&);
~SlotVisitor();
void append(ConservativeRoots&);
template<typename T> void append(JITWriteBarrier<T>*);
template<typename T> void append(WriteBarrierBase<T>*);
void appendValues(WriteBarrierBase<Unknown>*, size_t count);
template<typename T>
void appendUnbarrieredPointer(T**);
void appendUnbarrieredValue(JSValue*);
template<typename T>
void appendUnbarrieredWeak(Weak<T>*);
void addOpaqueRoot(void*);
bool containsOpaqueRoot(void*);
int opaqueRootCount();
GCThreadSharedData& sharedData() { return m_shared; }
bool isEmpty() { return m_stack.isEmpty(); }
void setup();
void reset();
size_t visitCount() const { return m_visitCount; }
void donate();
void drain();
void donateAndDrain();
enum SharedDrainMode { SlaveDrain, MasterDrain };
void drainFromShared(SharedDrainMode);
void harvestWeakReferences();
void finalizeUnconditionalFinalizers();
void copyLater(JSCell*, void*, size_t);
#if ENABLE(SIMPLE_HEAP_PROFILING)
VTableSpectrum m_visitedTypeCounts;
#endif
void addWeakReferenceHarvester(WeakReferenceHarvester*);
void addUnconditionalFinalizer(UnconditionalFinalizer*);
#if ENABLE(OBJECT_MARK_LOGGING)
inline void resetChildCount() { m_logChildCount = 0; }
inline unsigned childCount() { return m_logChildCount; }
inline void incrementChildCount() { m_logChildCount++; }
#endif
private:
friend class ParallelModeEnabler;
JS_EXPORT_PRIVATE static void validate(JSCell*);
void append(JSValue*);
void append(JSValue*, size_t count);
void append(JSCell**);
void internalAppend(JSCell*);
void internalAppend(JSValue);
void internalAppend(JSValue*);
JS_EXPORT_PRIVATE void mergeOpaqueRoots();
void mergeOpaqueRootsIfNecessary();
void mergeOpaqueRootsIfProfitable();
void donateKnownParallel();
MarkStackArray m_stack;
HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector.
size_t m_visitCount;
bool m_isInParallelMode;
GCThreadSharedData& m_shared;
bool m_shouldHashConst; // Local per-thread copy of shared flag for performance reasons
typedef HashMap<StringImpl*, JSValue> UniqueStringMap;
UniqueStringMap m_uniqueStrings;
#if ENABLE(OBJECT_MARK_LOGGING)
unsigned m_logChildCount;
#endif
public:
#if !ASSERT_DISABLED
bool m_isCheckingForDefaultMarkViolation;
bool m_isDraining;
#endif
};
class ParallelModeEnabler {
public:
ParallelModeEnabler(SlotVisitor& stack)
: m_stack(stack)
{
ASSERT(!m_stack.m_isInParallelMode);
m_stack.m_isInParallelMode = true;
}
~ParallelModeEnabler()
{
ASSERT(m_stack.m_isInParallelMode);
m_stack.m_isInParallelMode = false;
}
private:
SlotVisitor& m_stack;
};
} // namespace JSC
#endif // SlotVisitor_h
|
/* Copyright 2005-08 Mahadevan R
*
* 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.
*/
#pragma once
class CFlatButtonBase : public CButton
{
DECLARE_DYNAMIC(CFlatButtonBase)
bool m_bMouseInHouse;
bool m_bChecked;
protected:
DECLARE_MESSAGE_MAP()
public:
CFlatButtonBase();
virtual ~CFlatButtonBase();
void SetChecked(bool checked = true);
bool IsChecked() const { return m_bChecked; }
bool IsMouseInHouse() const { return m_bMouseInHouse; }
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
};
// CFlatButton
class CFlatButton : public CFlatButtonBase
{
DECLARE_DYNAMIC(CFlatButton)
protected:
DECLARE_MESSAGE_MAP()
public:
CFlatButton();
virtual ~CFlatButton();
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
};
// CColorButton
class CColorButton : public CFlatButtonBase
{
DECLARE_DYNAMIC(CColorButton)
COLORREF m_Color;
protected:
DECLARE_MESSAGE_MAP()
public:
CColorButton();
virtual ~CColorButton();
void SetColor(COLORREF c);
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
};
|
/*
Q Light Controller - Fixture Definition Editor
editcapability.h
Copyright (C) Heikki Junnila
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.txt
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 EDITCAPABILITY_H
#define EDITCAPABILITY_H
#include <QWidget>
#include "ui_editcapability.h"
#include "qlcchannel.h"
class QWidget;
class QLCCapability;
/** @addtogroup fixtureeditor Fixture Editor
* @{
*/
class EditCapability : public QDialog, public Ui_EditCapability
{
Q_OBJECT
public:
EditCapability(QWidget* parent, const QLCCapability* capability = NULL,
QLCChannel::Group group = QLCChannel::NoGroup, uchar min = 0);
~EditCapability();
/*********************************************************************
* Capability
*********************************************************************/
public:
QLCCapability* capability() const {
return m_capability;
}
protected:
QLCCapability* m_capability;
/*********************************************************************
* UI slots
*********************************************************************/
public slots:
void slotMinSpinChanged(int value);
void slotMaxSpinChanged(int value);
void slotDescriptionEdited(const QString& text);
void slotPictureButtonPressed();
void slotColor1ButtonPressed();
void slotColor2ButtonPressed();
};
/** @} */
#endif
|
/**
* Appcelerator Kroll - licensed under the Apache Public License 2
* see LICENSE in the root folder for details on the license.
* Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
*/
#ifndef _KR_OSX_UTILS_H_
#define _KR_OSX_UTILS_H_
#include <string>
#include <CoreFoundation/CoreFoundation.h>
// Most of the code was adapted from code in Chromium's src/base/...
namespace UTILS_NS
{
KROLL_API std::string CFStringToUTF8(CFStringRef cfstring);
KROLL_API CFStringRef UTF8ToCFString(const std::string& input);
KROLL_API std::string CFErrorToString(CFErrorRef cferror);
// CFRef<> is patterned after scoped_ptr<>, but maintains ownership
// of a CoreFoundation object: any object that can be represented as a
// CFTypeRef. Style deviations here are solely for compatibility with
// scoped_ptr<>'s interface, with which everyone is already familiar.
//
// When CFRef<> takes ownership of an object (in the constructor or
// in reset()), it takes over the caller's existing ownership claim. The
// caller must own the object it gives to CFRef<>, and relinquishes
// an ownership claim to that object. CFRef<> does not call
// CFRetain().
template<typename CFT>
class CFRef {
public:
typedef CFT element_type;
explicit CFRef(CFT object = NULL) :
object_(object) { }
~CFRef()
{
if (object_)
CFRelease(object_);
}
void reset(CFT object = NULL)
{
if (object_)
CFRelease(object_);
object_ = object;
}
bool operator==(CFT that) const
{
return object_ == that;
}
bool operator!=(CFT that) const
{
return object_ != that;
}
operator CFT() const
{
return object_;
}
CFT get() const
{
return object_;
}
void swap(CFRef& that)
{
CFT temp = that.object_;
that.object_ = object_;
object_ = temp;
}
// CFRef<>::release() is like scoped_ptr<>::release. It is NOT
// a wrapper for CFRelease(). To force a CFRef<> object to call
// CFRelease(), use CFRef<>::reset().
CFT release()
{
CFT temp = object_;
object_ = NULL;
return temp;
}
private:
CFT object_;
};
}
#endif
|
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef vnsw_agent_dhcpv6_proto_hpp
#define vnsw_agent_dhcpv6_proto_hpp
#include "pkt/proto.h"
#include "services/dhcpv6_handler.h"
#define DHCPV6_TRACE(obj, arg) \
do { \
std::ostringstream _str; \
_str << arg; \
Dhcpv6##obj::TraceMsg(Dhcpv6TraceBuf, __FILE__, __LINE__, _str.str()); \
} while (false) \
// DHCPv6 DUID types
#define DHCPV6_DUID_TYPE_LLT 1
#define DHCPV6_DUID_TYPE_EN 2
#define DHCPV6_DUID_TYPE_LL 3
class Dhcpv6Proto : public Proto {
public:
static const uint32_t kDhcpMaxPacketSize = 1024;
struct Duid {
uint16_t type;
uint16_t hw_type;
uint8_t mac[ETH_ALEN];
};
struct DhcpStats {
DhcpStats() { Reset(); }
void Reset() {
solicit = advertise = request = confirm = renew =
rebind = reply = release = decline = reconfigure =
information_request = error = 0;
}
uint32_t solicit;
uint32_t advertise;
uint32_t request;
uint32_t confirm;
uint32_t renew;
uint32_t rebind;
uint32_t reply;
uint32_t release;
uint32_t decline;
uint32_t reconfigure;
uint32_t information_request;
uint32_t error;
};
Dhcpv6Proto(Agent *agent, boost::asio::io_service &io,
bool run_with_vrouter);
virtual ~Dhcpv6Proto();
ProtoHandler *AllocProtoHandler(boost::shared_ptr<PktInfo> info,
boost::asio::io_service &io);
void Shutdown();
const Duid *server_duid() const { return &server_duid_; }
void IncrStatsSolicit() { stats_.solicit++; }
void IncrStatsAdvertise() { stats_.advertise++; }
void IncrStatsRequest() { stats_.request++; }
void IncrStatsConfirm() { stats_.confirm++; }
void IncrStatsRenew() { stats_.renew++; }
void IncrStatsRebind() { stats_.rebind++; }
void IncrStatsReply() { stats_.reply++; }
void IncrStatsRelease() { stats_.release++; }
void IncrStatsDecline() { stats_.decline++; }
void IncrStatsReconfigure() { stats_.reconfigure++; }
void IncrStatsInformationRequest() { stats_.information_request++; }
void IncrStatsError() { stats_.error++; }
const DhcpStats &GetStats() const { return stats_; }
void ClearStats() { stats_.Reset(); }
private:
bool run_with_vrouter_;
DhcpStats stats_;
Duid server_duid_;
DISALLOW_COPY_AND_ASSIGN(Dhcpv6Proto);
};
#endif // vnsw_agent_dhcpv6_proto_hpp
|
//
// GZWebViewController.h
// Beggar
//
// Created by Madao on 15/8/10.
// Copyright (c) 2015年 GanZhen. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GZWebViewController : UIViewController
@property (copy, nonatomic) NSString *urlStr;
@end
|
/*******************************************************************************
* Copyright 2013-2015 Aerospike, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#include <Python.h>
#include <stdbool.h>
#include <aerospike/aerospike_key.h>
#include <aerospike/as_key.h>
#include <aerospike/as_error.h>
#include <aerospike/as_record.h>
#include "client.h"
#include "conversions.h"
#include "key.h"
PyObject * AerospikeKey_Get(AerospikeKey * key, PyObject * args, PyObject * kwds)
{
// Python Function Arguments
PyObject * py_key = key->key;
PyObject * py_policy = NULL;
// Python Function Keyword Arguments
static char * kwlist[] = {"policy", NULL};
// Python Function Argument Parsing
if ( PyArg_ParseTupleAndKeywords(args, kwds, "|O:get", kwlist, &py_policy) == false ) {
return NULL;
}
// Invoke Operation
return AerospikeClient_Get_Invoke(key->client, py_key, py_policy);
}
|
/*
* Copyright 2010-2017 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.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <aws/ec2/model/DhcpOptions.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
/**
* <p>Contains the output of DescribeDhcpOptions.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeDhcpOptionsResult">AWS
* API Reference</a></p>
*/
class AWS_EC2_API DescribeDhcpOptionsResponse
{
public:
DescribeDhcpOptionsResponse();
DescribeDhcpOptionsResponse(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
DescribeDhcpOptionsResponse& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline const Aws::Vector<DhcpOptions>& GetDhcpOptions() const{ return m_dhcpOptions; }
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline void SetDhcpOptions(const Aws::Vector<DhcpOptions>& value) { m_dhcpOptions = value; }
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline void SetDhcpOptions(Aws::Vector<DhcpOptions>&& value) { m_dhcpOptions = std::move(value); }
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline DescribeDhcpOptionsResponse& WithDhcpOptions(const Aws::Vector<DhcpOptions>& value) { SetDhcpOptions(value); return *this;}
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline DescribeDhcpOptionsResponse& WithDhcpOptions(Aws::Vector<DhcpOptions>&& value) { SetDhcpOptions(std::move(value)); return *this;}
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline DescribeDhcpOptionsResponse& AddDhcpOptions(const DhcpOptions& value) { m_dhcpOptions.push_back(value); return *this; }
/**
* <p>Information about one or more DHCP options sets.</p>
*/
inline DescribeDhcpOptionsResponse& AddDhcpOptions(DhcpOptions&& value) { m_dhcpOptions.push_back(std::move(value)); return *this; }
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline DescribeDhcpOptionsResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline DescribeDhcpOptionsResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
Aws::Vector<DhcpOptions> m_dhcpOptions;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace EC2
} // namespace Aws |
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by StartupLoading, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_FACEBOOK
#import "TiViewProxy.h"
#import "FacebookModule.h"
#import "TiFacebookLoginButton.h"
@interface TiFacebookLoginButtonProxy : TiViewProxy {
FacebookModule *module;
}
-(id)_initWithPageContext:(id<TiEvaluator>)context_ args:(id)args module:(FacebookModule*)module_;
@property(nonatomic,readonly) FacebookModule *_module;
-(void)internalSetWidth:(id)width;
-(void)internalSetHeight:(id)height;
@end
#endif |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef dom_plugins_PluginBackgroundDestroyer
#define dom_plugins_PluginBackgroundDestroyer
#include "mozilla/plugins/PPluginBackgroundDestroyerChild.h"
#include "mozilla/plugins/PPluginBackgroundDestroyerParent.h"
#include "gfxASurface.h"
#include "gfxSharedImageSurface.h"
namespace mozilla {
namespace plugins {
/**
* When instances of this class are destroyed, the old background goes
* along with them, completing the destruction process (whether or not
* the plugin stayed alive long enough to ack).
*/
class PluginBackgroundDestroyerParent : public PPluginBackgroundDestroyerParent {
public:
PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground)
: mDyingBackground(aDyingBackground)
{ }
virtual ~PluginBackgroundDestroyerParent() { }
private:
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{
switch(why) {
case Deletion:
case AncestorDeletion:
if (gfxSharedImageSurface::IsSharedImage(mDyingBackground)) {
gfxSharedImageSurface* s =
static_cast<gfxSharedImageSurface*>(mDyingBackground.get());
DeallocShmem(s->GetShmem());
}
break;
default:
// We're shutting down or crashed, let automatic cleanup
// take care of our shmem, if we have one.
break;
}
}
nsRefPtr<gfxASurface> mDyingBackground;
};
/**
* This class exists solely to instruct its instance to release its
* current background, a new one may be coming.
*/
class PluginBackgroundDestroyerChild : public PPluginBackgroundDestroyerChild {
public:
PluginBackgroundDestroyerChild() { }
virtual ~PluginBackgroundDestroyerChild() { }
private:
// Implementing this for good hygiene.
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{ }
};
} // namespace plugins
} // namespace mozilla
#endif // dom_plugins_PluginBackgroundDestroyer
|
// Created by Jesse MacFadyen on 10-05-29.
// Copyright 2010 Nitobi. All rights reserved.
// Copyright 2012, Randy McMillan
#import <Cordova/CDVPlugin.h>
#import "ChildBrowserViewController.h"
@interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate> {
ChildBrowserViewController* childBrowser;
}
@property (nonatomic, retain) ChildBrowserViewController *childBrowser;
- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
-(void) onChildLocationChange:(NSString*)newLoc;
@end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.