text stringlengths 4 6.14k |
|---|
#include <math.h>
#include <stdio.h>
void cylinder_volume() {
float h, r, v;
printf("Height of cylinder: ");
scanf("%f",&h);
printf("Radius of cylinder: ");
scanf("%f",&r);
v = M_PI * r * r * h;
printf("Volume is: %f", v);
printf("\n");
}
|
#include <adc.h>
#include <avr/power.h>
/**
* @file adc.c
*
* @brief implementation of ADC API
*
* This file provides an API implementation of the ADC routines
*
*/
void adc_init(e_adc_mode a_mode) {
// enable power to ADC
power_adc_enable();
// default prescaler = 128. The ADC clock = F_CPU/128 = 125 kHz
ADCSRA = (_BV(ADEN) | 0x07);
// configure mode
if (E_SINGLE_SHOT == a_mode) {
ADCSRB = 0x00;
}
else {
// set the appropriate mode
ADCSRB = (a_mode - 1);
// enable auto-trigger mode
ADCSRA |= _BV(ADATE);
}
// set data format, Vcc reference and channel zero by default
ADMUX = 0x00;
ADMUX &= ~_BV(ADLAR);
adc_reference_set(E_ADC_EXTERNAL_AVCC);
}
void adc_temperature_sensor_enable() {
adc_channel_set(0x08);
adc_reference_set(E_ADC_REF_INTERNAL_11);
}
|
/*
* ray.h
*
* Created on: 25.05.2013
* Author: michi
*/
#pragma once
#include "math.h"
#include "vector.h"
class vector;
class plane;
class Ray {
public:
Ray();
Ray(const vector &a, const vector &b);
vector u, v;
float _cdecl dot(const Ray &r) const;
bool _cdecl intersect_plane(const plane &pl, vector &c) const;
};
|
#ifndef ESP__To_IFTTT_h
#define ESP__To_IFTTT_h
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
//IFTTT
#define IFTTT_URL "maker.ifttt.com"
const uint16_t httpsPort = 443;
class ESP_To_IFTTT{
public:
ESP_To_IFTTT(const String auth_key, const String event)
: auth_key(auth_key), event(event){} // constructor
bool connect(); //returns if connection was Successful
bool post(const String, const String, const String); //NOTE: return broken
private:
WiFiClientSecure client;
String auth_key;
String event;
};
#endif
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_0_r1_1;
atomic_int atom_1_r1_1;
atomic_int atom_1_r5_1;
void *t0(void *arg){
label_1:;
int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v4_r3 = v3_r3 + 1;
atomic_store_explicit(&vars[1], v4_r3, memory_order_seq_cst);
int v14 = (v2_r1 == 1);
atomic_store_explicit(&atom_0_r1_1, v14, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v6_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
int v8_r5 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v15 = (v6_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v15, memory_order_seq_cst);
int v16 = (v8_r5 == 1);
atomic_store_explicit(&atom_1_r5_1, v16, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[1], 0);
atomic_init(&vars[0], 0);
atomic_init(&vars[2], 0);
atomic_init(&atom_0_r1_1, 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_1_r5_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v9 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst);
int v10 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v11 = atomic_load_explicit(&atom_1_r5_1, memory_order_seq_cst);
int v12_conj = v10 & v11;
int v13_conj = v9 & v12_conj;
if (v13_conj == 1) assert(0);
return 0;
}
|
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <time.h>
#include <ctype.h>
#include "ai.h"
#define bits 12
int board[4][4];
int boardChanged;
int Score;
void
Board2Brain (struct Brain *A)
{
for (int y = 0; y < 4; y++)
{
for (int x = 0; x < 4; x++)
{
for (int n = 0; n < bits; n++)
{
*(*(A->Neurons) + ((y * 4 + x) * bits + n)) =
! !(board[x][y] & (1 << n));
}
}
}
}
int
Decide (struct Brain *A)
{
for (int out_index = 0; out_index < *(A->SizeLayer + (A->NumLayers - 1));
out_index++)
{
if (*(*(A->Neurons + (A->NumLayers - 1)) + out_index) == true)
return out_index;
}
return 5;
}
void
InitBoard ()
{
for (int y = 0; y < 4; y++)
{
for (int x = 0; x < 4; x++)
{
board[x][y] = 0;
}
}
}
void
AddTile ()
{
int Count = 0;
int new = 0;
while (new == 0)
{
Count = Count + 1;
int x = rand () % 4;
int y = rand () % 4;
if (board[x][y] == 0)
{
board[x][y] = 2;
new = 1;
}
if (Count == 200)
{
boardChanged = 0;
return;
}
}
}
void
PushUp ()
{
for (int x = 0; x < 4; x++)
{
for (int i = 0; i < 4; i++)
{
if (board[x][3] == 0)
{
board[x][3] = board[x][2];
board[x][2] = 0;
if (board[x][3] != 0)
{
boardChanged = 1;
}
}
if (board[x][2] == 0)
{
board[x][2] = board[x][1];
board[x][1] = 0;
if (board[x][2] != 0)
{
boardChanged = 1;
}
}
if (board[x][1] == 0)
{
board[x][1] = board[x][0];
board[x][0] = 0;
if (board[x][1] != 0)
{
boardChanged = 1;
}
}
}
}
}
void
PushDown ()
{
for (int x = 0; x < 4; x++)
{
for (int i = 0; i < 4; i++)
{
if (board[x][0] == 0)
{
board[x][0] = board[x][1];
board[x][1] = 0;
if (board[x][0] != 0)
{
boardChanged = 1;
}
}
if (board[x][1] == 0)
{
board[x][1] = board[x][2];
board[x][2] = 0;
if (board[x][1] != 0)
{
boardChanged = 1;
}
}
if (board[x][2] == 0)
{
board[x][2] = board[x][3];
board[x][3] = 0;
if (board[x][2] != 0)
{
boardChanged = 1;
}
}
}
}
}
void
PushLeft ()
{
for (int y = 0; y < 4; y++)
{
for (int i = 0; i < 4; i++)
{
if (board[0][y] == 0)
{
board[0][y] = board[1][y];
board[1][y] = 0;
if (board[0][y] != 0)
{
boardChanged = 1;
}
}
if (board[1][y] == 0)
{
board[1][y] = board[2][y];
board[2][y] = 0;
if (board[1][y] != 0)
{
boardChanged = 1;
}
}
if (board[2][y] == 0)
{
board[2][y] = board[3][y];
board[3][y] = 0;
if (board[2][y] != 0)
{
boardChanged = 1;
}
}
}
}
}
void
PushRight ()
{
for (int y = 0; y < 4; y++)
{
for (int i = 0; i < 4; i++)
{
if (board[3][y] == 0)
{
board[3][y] = board[2][y];
board[2][y] = 0;
if (board[3][y] != 0)
{
boardChanged = 1;
}
}
if (board[2][y] == 0)
{
board[2][y] = board[1][y];
board[1][y] = 0;
if (board[2][y] != 0)
{
boardChanged = 1;
}
}
if (board[1][y] == 0)
{
board[1][y] = board[0][y];
board[0][y] = 0;
if (board[1][y] != 0)
{
boardChanged = 1;
}
}
}
}
}
void
AddVertical ()
{
for (int x = 0; x < 4; x++)
{
if (board[x][0] == board[x][1])
{
board[x][0] = board[x][0] + board[x][1];
Score = Score + board[x][0];
board[x][1] = 0;
if (board[x][0] != 0)
{
boardChanged = 1;
}
}
if (board[x][1] == board[x][2])
{
board[x][1] = board[x][1] + board[x][2];
Score = Score + board[x][1];
board[x][2] = 0;
if (board[x][1] != 0)
{
boardChanged = 1;
}
}
if (board[x][2] == board[x][3])
{
board[x][2] = board[x][2] + board[x][3];
Score = Score + board[x][2];
board[x][3] = 0;
if (board[x][2] != 0)
{
boardChanged = 1;
}
}
}
}
void
AddHorozontal ()
{
for (int y = 0; y < 4; y++)
{
if (board[0][y] == board[1][y])
{
board[0][y] = board[0][y] + board[1][y];
Score = Score + board[0][y];
board[1][y] = 0;
if (board[0][y] != 0)
{
boardChanged = 1;
}
}
if (board[1][y] == board[2][y])
{
board[1][y] = board[1][y] + board[2][y];
Score = Score + board[1][y];
board[2][y] = 0;
if (board[1][y] != 0)
{
boardChanged = 1;
}
}
if (board[2][y] == board[3][y])
{
board[2][y] = board[2][y] + board[3][y];
Score = Score + board[2][y];
board[3][y] = 0;
if (board[2][y] != 0)
{
boardChanged = 1;
}
}
}
}
void
DoDown ()
{
PushDown ();
AddVertical ();
PushDown ();
if (boardChanged == 1)
{
AddTile ();
}
}
void
DoUp ()
{
PushUp ();
AddVertical ();
PushUp ();
if (boardChanged == 1)
{
AddTile ();
}
}
void
DoLeft ()
{
PushLeft ();
AddHorozontal ();
PushLeft ();
if (boardChanged == 1)
{
AddTile ();
}
}
void
DoRight ()
{
PushRight ();
AddHorozontal ();
PushRight ();
if (boardChanged == 1)
{
AddTile ();
}
}
void
Do_Game_Loop (struct Brain *A)
{
Board2Brain (A);
Think (A);
int move = Decide (A);
boardChanged = 0;
if (move == 0)
DoRight ();
if (move == 1)
DoLeft ();
if (move == 2)
DoUp ();
if (move == 3)
DoDown ();
}
void Play (struct Brain *A)
{
Score=A->Score;
srand (time(NULL));
InitBoard ();
AddTile ();
AddTile ();
boardChanged = 1;
while (boardChanged == 1)
{
Do_Game_Loop (A);
}
A->Score = Score;
}
|
/*
This file is part of the DodoHand project. This project aims to create
an open implementation of the DataHand keyboard, capable of being created
with commercial 3D printing services.
Copyright (C) 2013 Scott Fohey
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 __LED_TEST_H__
#define __LED_TEST_H__
#endif // __LED_TEST_H__
|
/*
* FoREST - Reactive DVFS Control for Multicore Processors
* Copyright (C) 2013 Universite de Versailles
* Copyright (C) 2011-2012 Exascale Research Center
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
@file Profiler.h
@brief The Profiler class header is here.
*/
#ifndef H_PFMPROFILER
#define H_PFMPROFILER
#include <iostream>
#include <pthread.h>
#include "perfmon/pfmlib.h"
#include "glog/logging.h"
#include "Counter.h"
#include "rdtsc.h"
namespace FoREST {
/**
* @class Profiler
* Profiler implementation based on libpfm.
*/
class Profiler
{
public:
/**
* Constructor
*/
Profiler ();
/**
* Destructor
*/
virtual ~Profiler ();
/**
* Reads the counter values
*
* @param counter the counter to read. The counter is assumed as opened.
* This means the open method has to be called before the read method
* @param frequencyId the frequencyId to know where to store the results
*/
bool read (Counter& counter, unsigned int frequencyId = 0);
/**
* Opens the HW counter file descriptors for the given thread id
*
* @param counter the counter to open
* @param threadId the id of the thread to monitor
*/
void open (Counter& counter, unsigned int threadId);
/**
* Closes the HW counter file descriptor
*
* @param counter the counter to close. The counter is assumed
* as opened when this method is called
*/
void close (Counter& counter);
/**
* Reads the timestamp counter value
*
* @time the values to update
*/
static inline void readTsc (CounterValues& time) {
uint64_t val = rdtsc ();
time.current = val - time.old;
time.old = val;
}
private:
/**
* Pfm initialization routine.
*/
static void pfmInit ()
{
int res;
pthread_mutex_lock (&Profiler::pfmInitMtx);
if (Profiler::nbPfmInit == 0)
{
if ((res = pfm_initialize ()) != PFM_SUCCESS)
{
LOG (FATAL) << "Failed to initialize libpfm: " << pfm_strerror (res) << std::endl;
}
}
Profiler::nbPfmInit++;
pthread_mutex_unlock (&Profiler::pfmInitMtx);
}
/**
* Pfm closing routine.
*/
static void pfmTerminate ()
{
pthread_mutex_lock (&Profiler::pfmInitMtx);
if (Profiler::nbPfmInit-- == 0)
{
pfm_terminate ();
}
pthread_mutex_unlock (&Profiler::pfmInitMtx);
}
/**
* Mutex to access the pfm initialization variables.
*/
static pthread_mutex_t pfmInitMtx;
/**
* How many threads have initialized the library ?
*/
static unsigned int nbPfmInit;
};
}
#endif
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: ../pdfreporter-core/src/org/oss/pdfreporter/compilers/jshuntingyard/JSHuntingYardExpressionFactory.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory")
#ifdef RESTRICT_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory
#define INCLUDE_ALL_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory 0
#else
#define INCLUDE_ALL_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory 1
#endif
#undef RESTRICT_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory
#if !defined (OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory_) && (INCLUDE_ALL_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory || defined(INCLUDE_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory))
#define OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory_
@class IOSObjectArray;
@protocol OrgOssPdfreporterCompilersIDataHolder;
@protocol OrgOssPdfreporterCompilersIExpressionElement;
@interface OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory : NSObject
#pragma mark Public
+ (id<OrgOssPdfreporterCompilersIExpressionElement>)buildExpressionWithOrgOssPdfreporterCompilersIDataHolder:(id<OrgOssPdfreporterCompilersIDataHolder>)dataholder
withOrgOssPdfreporterEngineJRExpressionChunkArray:(IOSObjectArray *)chunks
withInt:(jint)expressionId;
@end
J2OBJC_STATIC_INIT(OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory)
FOUNDATION_EXPORT id<OrgOssPdfreporterCompilersIExpressionElement> OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory_buildExpressionWithOrgOssPdfreporterCompilersIDataHolder_withOrgOssPdfreporterEngineJRExpressionChunkArray_withInt_(id<OrgOssPdfreporterCompilersIDataHolder> dataholder, IOSObjectArray *chunks, jint expressionId);
J2OBJC_TYPE_LITERAL_HEADER(OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory)
#endif
#pragma pop_macro("INCLUDE_ALL_OrgOssPdfreporterCompilersJshuntingyardJSHuntingYardExpressionFactory")
|
/* Provide a more complete sys/types.h.
Copyright (C) 2011-2014 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 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, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
# define _GL_INCLUDING_SYS_TYPES_H
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
# undef _GL_INCLUDING_SYS_TYPES_H
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
/* Override off_t if Large File Support is requested on native Windows. */
#if @WINDOWS_64_BIT_OFF_T@
/* Same as int64_t in <stdint.h>. */
# if defined _MSC_VER
# define off_t __int64
# else
# define off_t long long int
# endif
/* Indicator, for gnulib internal purposes. */
# define _GL_WINDOWS_64_BIT_OFF_T 1
#endif
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
&& ! defined __GLIBC__
# include <stddef.h>
#endif
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
|
#include <stdio.h>
#include <time.h>
#include <stdbool.h>
#include <stdlib.h> /* srand, rand */
#pragma GCC diagnostic ignored "-Wunused-result"
int main()
{
srand(time(NULL));
int guess;
int guesses_left;
int random = rand() % 100 + 1;
printf("Guess a number from 1-10.\n");
for (guesses_left = 6; guesses_left > 0; guesses_left--) {
scanf("%d", &guess);
if (guess < random) {
printf("Too low...\n");
}
else if (guess > random) {
printf("Too high...\n");
}
else {
printf("You win!\n");
return 0;
}
}
printf("You're out of guesses!\n");
}
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 nsStringBundleService_h__
#define nsStringBundleService_h__
#include "nsCOMPtr.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIPersistentProperties2.h"
#include "nsIStringBundle.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsIErrorService.h"
#include "nsIStringBundleOverride.h"
#include "mozilla/LinkedList.h"
struct bundleCacheEntry_t;
class nsStringBundleService : public nsIStringBundleService,
public nsIObserver,
public nsSupportsWeakReference
{
public:
nsStringBundleService();
nsresult Init();
NS_DECL_ISUPPORTS
NS_DECL_NSISTRINGBUNDLESERVICE
NS_DECL_NSIOBSERVER
private:
virtual ~nsStringBundleService();
void getStringBundle(const char *aUrl, nsIStringBundle** aResult);
nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
uint32_t argCount, char16_t** argArray,
char16_t* *result);
void flushBundleCache();
bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle,
nsCString &aHashKey);
nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap;
mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;
nsCOMPtr<nsIErrorService> mErrorService;
nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
};
#endif
|
// Copied from "phyclust/src/phyclust_em_step.c".
#include <math.h>
#include <float.h>
/* Gamma[n][k]
= pi_k * L_k(X_n) / sum_i(pi_i * L_i(X_n))
= 1 / sum_i(pi_i * L_i(X_n) / (pi_k * L_k))
= 1 / sum_i(exp(log(pi_i) + log(L_i(X_n)) - log(pi_k) - log(L_k(X_n))))
This function return stable exponential values with a scale exponeitial value and flag.
If flag = 1, scale_exp will be used to adjuste results eveywhere. Otherwise scale_exp = 0.
*total_sum is for logL_observed.
*/
void e_step_with_stable_exp(int *K, double *a_Z_normalized, double *total_sum, double *scale_exp, int *flag_out_range){
int k;
double tmp_exp, max_exp;
*total_sum = 0.0;
//*scale_exp = 0.0;
//*flag_out_range = 0;
max_exp = a_Z_normalized[0];
for(k = 1; k < *K; k++){
if(a_Z_normalized[k] > max_exp){
max_exp = a_Z_normalized[k];
}
}
// Subtract the maximum from everything, to scale everything
// Then normalize exp(a_Z_normalized)
for(k = 0; k < *K; k++){
a_Z_normalized[k] = exp(a_Z_normalized[k] - max_exp);
*total_sum += a_Z_normalized[k];
}
for(k = 0; k < *K; k++){
a_Z_normalized[k] = a_Z_normalized[k] / *total_sum;
}
} /* End of e_step_with_stable_exp(); */
|
/**
@author Contributions from the community; see CONTRIBUTORS.md
@date 2005-2016
@copyright MPL2; see LICENSE.txt
*/
#import <Cocoa/Cocoa.h>
#import "DKPathDecorator.h"
NS_ASSUME_NONNULL_BEGIN
/** @brief This object represents a pattern consisting of a repeated motif spaced out at intervals within a larger shape.
This object represents a pattern consisting of a repeated motif spaced out at intervals within a larger shape.
This subclasses \c DKPathDecorator which carries out the bulk of the work - it stores the image and caches it, this
just sets up the path clipping and calls the rendering method for each location of the repeating pattern.
*/
@interface DKFillPattern : DKPathDecorator <NSCoding, NSCopying> {
@private
CGFloat m_altYOffset;
CGFloat m_altXOffset;
CGFloat m_angle;
CGFloat m_objectAngle;
CGFloat m_motifAngle;
CGFloat mMotifAngleRandomness;
BOOL m_angleRelativeToObject;
BOOL m_motifAngleRelativeToPattern;
BOOL m_noClippedElements;
NSMutableArray* mMotifAngleRandCache;
}
/** return the default pattern, which is based on some image - unlikely to be really useful so might be
better to do something else here???
*/
+ (instancetype)defaultPattern;
+ (instancetype)fillPatternWithImage:(NSImage*)image;
/** @brief the vertical and horizontal offset of odd rows/columns to a proportion of the interval, [0...1]
*/
@property NSSize patternAlternateOffset;
- (void)fillRect:(NSRect)rect;
- (void)drawPatternInPath:(NSBezierPath*)aPath;
@property CGFloat angle;
@property CGFloat angleInDegrees;
@property BOOL angleIsRelativeToObject;
@property CGFloat motifAngle;
@property CGFloat motifAngleInDegrees;
@property (nonatomic) CGFloat motifAngleRandomness;
@property BOOL motifAngleIsRelativeToPattern;
/** @brief setting this causes a test for intersection of the motif's bounds with the object's path. If there is an intersection, the motif is not drawn. This makes patterns
appear tidier for certain applications (such as GIS/mapping) but adds a substantial performance overhead. \c NO by default.
*/
@property BOOL drawingOfClippedElementsSupressed;
@end
// kDKDrawingViewDidChangeScale can now be found in GCZoomView.h
NS_ASSUME_NONNULL_END
|
/*
* NSS utility functions
*
* 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/. */
#include "prtypes.h"
#include "prinit.h"
#include "seccomon.h"
#include "secerr.h"
#include "ssl.h"
#include "sslimpl.h"
#include "sslproto.h"
static int ssl_inited = 0;
SECStatus
ssl_Init(void)
{
if (!ssl_inited) {
if (ssl_InitializePRErrorTable() != SECSuccess) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
return (SECFailure);
}
#ifdef DEBUG
ssl3_CheckCipherSuiteOrderConsistency();
#endif
ssl_inited = 1;
SSL_applyNSSPolicy();
}
return SECSuccess;
}
|
/****************************************************************************
* raster.c
* FreeType monochrome rasterer module component (body only).
*
* Copyright (C) 1996-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
#pragma hdrstop
#include "ftraster.c"
#include "ftrend1.c"
|
/*
**
** Copyright (c) 2014, Eneo Tecnologia
** Author: Eugenio Perez <eupm90@gmail.com>
** All rights reserved.
**
** This program 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.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "util/topic_database.h"
#include "rb_http2k_sensors_database.h"
#include "rb_http2k_organizations_database.h"
#include "util/rb_timer.h"
#include <pthread.h>
#include <jansson.h>
struct rb_database {
/* UUID enrichment read-only database */
pthread_rwlock_t rwlock;
/// sensors UUID database.
sensors_db_t *sensors_db;
/// Organizations database
organizations_db_t organizations_db;
/// Timer to send stats via rb_monitor topic
struct topics_db *topics_db;
void *topics_memory;
};
/** Initialized a rb_database
@param db database to init
@return 0 if success, !0 in other case
*/
int init_rb_database(struct rb_database *db);
void free_valid_rb_database(struct rb_database *db);
/**
Get sensor enrichment and topic of an specific database.
@param db Database to extract sensor and topic handler from
@param topic Topic to search for
@param sensor_uuid Sensor uuid to search for
@param topic_handler Returned topic handler. Need to be freed with
topic_decref
@param sensor_info Returned sensor information. Need to be freed
with sensor_db_entry_decref
@return 0 if OK, !=0 in other case
*/
int rb_http2k_database_get_topic_client(struct rb_database *db,
const char *topic, const char *sensor_uuid,
struct topic_s **topic_handler, sensor_db_entry_t **sensor_info);
int rb_http2k_validate_uuid(struct rb_database *db,const char *uuid);
int rb_http2k_validate_topic(struct rb_database *db,const char *topic);
|
/*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2021 Raymond Jennings
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <kotaka/paths/text.h>
#include <kotaka/paths/verb.h>
#include <type.h>
inherit LIB_EMIT;
inherit LIB_VERB;
inherit "~/lib/ic";
string *query_parse_methods()
{
return ({ "english" });
}
/* ({ role, prepositions, raw }) */
mixed **query_roles()
{
return ({ });
}
string query_help_title()
{
}
string *query_help_contents()
{
}
void main(object actor, mapping roles)
{
mixed dob;
string look;
object *worn;
string *parts;
int i, sz, hlayer;
if (!actor) {
send_out("You must be in character to use this command.\n");
return;
}
dob = roles["dob"];
if (!dob) {
send_out("Wield what?\n");
return;
}
if (typeof(dob) == T_STRING) {
send_out(dob + "\n");
return;
}
if (dob[0]) {
send_out("You cannot use a preposition with a direct object in this verb.\n");
return;
}
dob = dob[1];
if (dob == actor) {
send_out("That doesn't make any sense.\n");
return;
}
if (dob->query_environment() != actor) {
send_out("You don't have it.\n");
return;
}
if (dob->query_property("is_wielded")) {
send_out("You are already wielding it.\n");
return;
}
if (dob->query_property("is_immobile")) {
send_out("It is stuck like glue and cannot be worn.\n");
return;
}
if (!dob->query_property("is_weapon")) {
send_out("Odd, it doesn't appear to be something you can wield.\n");
return;
}
emit_from(actor, actor, " ", ({ "wield", "wields" }), " ", dob, ".");
dob->set_property("is_wielded", 1);
}
|
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_LIMIT_PRST_CLR_VAL_INCLUDE_H_
#define OOX_LIMIT_PRST_CLR_VAL_INCLUDE_H_
#include "setter.h"
#include <string>
namespace OOX
{
namespace Limit
{
class PrstClrVal : public setter::from<std::string>
{
public:
PrstClrVal();
private:
virtual const std::string no_find() const;
};
}
}
#endif // OOX_LIMIT_PRST_CLR_VAL_INCLUDE_H_ |
/**
* Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This program 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.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include "hypoterm.h"
#include "macros.h"
#include <unistd.h>
#include <errno.h>
/**
* Initialise a hypoterminal, this entails making it raw,
* and storing its file descriptors
*
* @param hypoterm Output parameter for information on the hypoterminal
* @param hypoin The input file descriptor of the hypoterminal, this is probably `STDIN_FILENO`
* @param hypoout The output file descriptor of the hypoterminal, this is probably `STDOUT_FILENO`
* @return Zero on success, -1 on error, on error `errno` is set to describe to error
*/
int libepiterm_initialise(libepiterm_hypoterm_t* restrict hypoterm, int hypoin, int hypoout)
{
struct termios termios;
int sttyed = 0;
hypoterm->is_hypo = 1;
hypoterm->in = hypoin;
hypoterm->out = hypoout;
hypoterm->user_data = NULL;
fail_if (TEMP_FAILURE_RETRY(tcgetattr(hypoin, &termios)));
hypoterm->saved_termios = termios;
cfmakeraw(&termios);
fail_if (TEMP_FAILURE_RETRY(tcsetattr(hypoin, TCSANOW, &termios)));
sttyed = 1;
return 0;
fail:
if (sttyed)
TEMP_FAILURE_RETRY(tcsetattr(hypoin, TCSADRAIN, &(hypoterm->saved_termios)));
return -1;
}
/**
* Restore the original settings of the terminal
*
* @param hypoterm Information on the hypoterminal
* @return Zero on success, -1 on error, on error `errno` is set to describe to error
*/
int libepiterm_restore(libepiterm_hypoterm_t* restrict hypoterm)
{
fail_if (TEMP_FAILURE_RETRY(tcsetattr(hypoterm->in, TCSADRAIN, &(hypoterm->saved_termios))));
return 0;
fail:
return -1;
}
|
#pragma once
#include "forward.h"
#include "jabber_id.h"
class Occupant : public QObject {
Q_OBJECT
public:
Occupant();
UserPtr user() const;
void setUser(const UserPtr &user);
private:
UserPtr user_;
};
|
#pragma once
#include "VanillaCommand.h"
class KillCommand : public VanillaCommand
{
public:
KillCommand();
bool execute(SMPlayer *player, std::string &label, std::vector<std::string> &args);
};
|
/*--!>
This file is part of Nebula, a multi-purpose library mainly written in C++.
Copyright 2015-2016 outshined (outshined@riseup.net)
(PGP: 0x8A80C12396A4836F82A93FA79CA3D0F7E8FBCED6)
This program 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.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------<!--*/
#ifndef NIC_14162B4009B6E310_NIC
#define NIC_14162B4009B6E310_NIC
#include "traits.h"
#include "../call_traits.h"
#include "../enable_if.h"
namespace nebula { namespace foundation { namespace io {
/** @ingroup Foundation
* @{
*/
//------------------------------------------------------------------------------
template <class Stream>
struct tellg_impl
{
inline static typename stream_position<Stream>::type apply(Stream &s)
{
return s.tellg();
}
};
//------------------------------------------------------------------------------
template <class Stream>
inline typename stream_position<typename ctraits::value<Stream>::type>::type
tellg(Stream &&s)
{
typedef typename ctraits::value<Stream>::type stream_t;
n_static_assert(n_arg(
has_read<stream_t>::value),
"");
return tellg_impl<stream_t>::apply(s);
}
//------------------------------------------------------------------------------
template <class Stream>
struct tellp_impl
{
inline static typename stream_position<Stream>::type apply(Stream &s)
{
return s.tellp();
}
};
//------------------------------------------------------------------------------
template <class Stream>
inline typename stream_position<typename ctraits::value<Stream>::type>::type
tellp(Stream &&s)
{
typedef typename ctraits::value<Stream>::type stream_t;
n_static_assert(n_arg(
has_write<stream_t>::value),
"");
return tellp_impl<stream_t>::apply(s);
}
/** @} */
}}} // namespaces
#endif // NIC_14162B4009B6E310_NIC |
#pragma once
/************************************************************************
MeOS - Orienteering Software
Copyright (C) 2009-2021 Melin Software HB
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/>.
Melin Software HB - software@melin.nu - www.melin.nu
Eksoppsvägen 16, SE-75646 UPPSALA, Sweden
************************************************************************/
#include <set>
#include <vector>
#include <map>
class oEvent;
class MeOSFeatures
{
public:
enum Feature {
_Head = -1,
Speaker = 0,
Economy,
Clubs,
EditClub,
SeveralStages,
Network,
TimeAdjust,
PointAdjust,
ForkedIndividual,
Patrol,
Relay,
MultipleRaces,
Rogaining,
Vacancy,
InForest,
DrawStartList,
Bib,
RunnerDb,
NoCourses,
};
private:
struct FeatureDescriptor {
Feature feat;
wstring code;
string desc;
set<Feature> dependsOn;
FeatureDescriptor &require(Feature f) {
dependsOn.insert(f);
return *this;
}
FeatureDescriptor(Feature feat, wstring code, string desc);
};
vector<FeatureDescriptor> desc;
map<Feature, int> featureToIx;
map<wstring, int> codeToIx;
FeatureDescriptor &add(Feature feat, const wchar_t *code, const char *desc);
FeatureDescriptor &addHead(const char *desc);
set<Feature> features;
int getIndex(Feature f) const;
void loadDefaults(oEvent &oe);
bool isRequiredInternal(Feature f) const;
public:
MeOSFeatures(void);
~MeOSFeatures(void);
bool hasFeature(Feature f) const;
void useFeature(Feature f, bool use, oEvent &oe);
bool isRequired(Feature f, const oEvent &oe) const;
void useAll(oEvent &oe);
void clear(oEvent &oe);
int getNumFeatures() const;
Feature getFeature(int featureIx) const;
bool isHead(int featureIx) const;
const string &getHead(int featureIx) const;
const string &getDescription(Feature f) const;
const wstring &getCode(Feature f) const;
bool withoutCourses(const oEvent &oe) const { return hasFeature(NoCourses) && oe.getNumCourses() == 0; }
bool withCourses(const oEvent *oe) const { return !withoutCourses(*oe); }
wstring serialize() const;
void deserialize(const wstring &input, oEvent &oe);
};
|
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE 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.
*
* srsLTE 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.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "srslte/utils/bit.h"
#include "srslte/fec/crc.h"
void gen_crc_table(srslte_crc_t *h) {
int i, j, ord = (h->order - 8);
uint64_t bit, crc;
for (i = 0; i < 256; i++) {
crc = ((uint64_t) i) << ord;
for (j = 0; j < 8; j++) {
bit = crc & h->crchighbit;
crc <<= 1;
if (bit)
crc ^= h->polynom;
}
h->table[i] = crc & h->crcmask;
}
}
uint64_t crctable(srslte_crc_t *h, uint8_t byte) {
// Polynom order 8, 16, 24 or 32 only.
int ord = h->order - 8;
uint64_t crc = h->crcinit;
crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte];
h->crcinit = crc;
return (crc & h->crcmask);
}
uint64_t reversecrcbit(uint32_t crc, int nbits, srslte_crc_t *h) {
uint64_t m, rmask = 0x1;
for (m = 0; m < nbits; m++) {
if ((rmask & crc) == 0x01)
crc = (crc ^ h->polynom) >> 1;
else
crc = crc >> 1;
}
return (crc & h->crcmask);
}
int srslte_crc_set_init(srslte_crc_t *crc_par, uint64_t crc_init_value) {
crc_par->crcinit = crc_init_value;
if (crc_par->crcinit != (crc_par->crcinit & crc_par->crcmask)) {
printf("ERROR, invalid crcinit in crc_set_init().\n");
return -1;
}
return 0;
}
int srslte_crc_init(srslte_crc_t *h, uint32_t crc_poly, int crc_order) {
// Set crc working default parameters
h->polynom = crc_poly;
h->order = crc_order;
h->crcinit = 0x00000000;
// Compute bit masks for whole CRC and CRC high bit
h->crcmask = ((((uint64_t) 1 << (h->order - 1)) - 1) << 1) | 1;
h->crchighbit = (uint64_t) 1 << (h->order - 1);
// check parameters
if (h->order % 8 != 0) {
fprintf(stderr, "ERROR, invalid order=%d, it must be 8, 16, 24 or 32.\n",
h->order);
return -1;
}
if (srslte_crc_set_init(h, h->crcinit)) {
fprintf(stderr, "Error setting CRC init word\n");
return -1;
}
// generate lookup table
gen_crc_table(h);
return 0;
}
uint32_t srslte_crc_checksum(srslte_crc_t *h, uint8_t *data, int len) {
int i, k, len8, res8, a = 0;
uint32_t crc = 0;
uint8_t *pter;
srslte_crc_set_init(h, 0);
// Pack bits into bytes
len8 = (len >> 3);
res8 = (len - (len8 << 3));
if (res8 > 0) {
a = 1;
}
// Calculate CRC
for (i = 0; i < len8 + a; i++) {
pter = (uint8_t *) (data + 8 * i);
uint8_t byte;
if (i == len8) {
byte = 0x00;
for (k = 0; k < res8; k++) {
byte |= ((uint8_t) *(pter + k)) << (7 - k);
}
} else {
byte = (uint8_t) (srslte_bit_pack(&pter, 8) & 0xFF);
}
crc = crctable(h, byte);
}
// Reverse CRC res8 positions
if (a == 1) {
crc = reversecrcbit(crc, 8 - res8, h);
}
//Return CRC value
return crc;
}
// len is multiple of 8
uint32_t srslte_crc_checksum_byte(srslte_crc_t *h, uint8_t *data, int len) {
int i;
uint32_t crc = 0;
srslte_crc_set_init(h, 0);
// Calculate CRC
for (i = 0; i < len/8; i++) {
crc = crctable(h, data[i]);
}
return crc;
}
uint32_t srslte_crc_attach_byte(srslte_crc_t *h, uint8_t *data, int len) {
uint32_t checksum = srslte_crc_checksum_byte(h, data, len);
// Add CRC
for (int i=0;i<h->order/8;i++) {
data[len/8+(h->order/8-i-1)] = (checksum&(0xff<<(8*i)))>>(8*i);
}
return checksum;
}
/** Appends crc_order checksum bits to the buffer data.
* The buffer data must be len + crc_order bytes
*/
uint32_t srslte_crc_attach(srslte_crc_t *h, uint8_t *data, int len) {
uint32_t checksum = srslte_crc_checksum(h, data, len);
// Add CRC
uint8_t *ptr = &data[len];
srslte_bit_unpack(checksum, &ptr, h->order);
return checksum;
}
|
/*
Copyright (c) 2016 Tai Chi Minh Ralph Eastwood
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 "ctx.h"
#if !defined DILL_THREADS
struct dill_ctx dill_ctx_ = {0};
static void dill_ctx_atexit(void) {
dill_ctx_fd_term(&dill_ctx_.fd);
dill_ctx_pollset_term(&dill_ctx_.pollset);
dill_ctx_stack_term(&dill_ctx_.stack);
dill_ctx_handle_term(&dill_ctx_.handle);
dill_ctx_cr_term(&dill_ctx_.cr);
dill_ctx_now_term(&dill_ctx_.now);
}
struct dill_ctx *dill_ctx_init(void) {
int rc = dill_ctx_now_init(&dill_ctx_.now);
dill_assert(rc == 0);
rc = dill_ctx_cr_init(&dill_ctx_.cr);
dill_assert(rc == 0);
rc = dill_ctx_handle_init(&dill_ctx_.handle);
dill_assert(rc == 0);
rc = dill_ctx_stack_init(&dill_ctx_.stack);
dill_assert(rc == 0);
rc = dill_ctx_pollset_init(&dill_ctx_.pollset);
dill_assert(rc == 0);
rc = dill_ctx_fd_init(&dill_ctx_.fd);
dill_assert(rc == 0);
rc = atexit(dill_ctx_atexit);
dill_assert(rc == 0);
dill_ctx_.initialized = 1;
return &dill_ctx_;
}
#else
#include <pthread.h>
/* Determine whether current thread is the main thread. */
#if defined __linux__
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
static int dill_ismain() {
return syscall(SYS_gettid) == getpid();
}
#elif defined __OpenBSD__ || defined __FreeBSD__ || \
defined __APPLE__ || defined __DragonFly__
#if defined __FreeBSD__ || defined __OpenBSD__
#include <pthread_np.h>
#endif
static int dill_ismain() {
return pthread_main_np();
}
#elif defined __NetBSD__
#include <sys/lwp.h>
static int dill_ismain() {
return _lwp_self() == 1;
}
#elif defined __sun
static int dill_ismain() {
return pthread_self() == 1;
}
#else
#error "Cannot determine which thread is the main thread."
#endif
#if defined __GNUC__ && !defined DILL_THREAD_FALLBACK
__thread struct dill_ctx dill_ctx_ = {0};
static pthread_key_t dill_key;
static pthread_once_t dill_keyonce = PTHREAD_ONCE_INIT;
static void *dill_main = NULL;
static void dill_ctx_term(void *ptr) {
struct dill_ctx *ctx = ptr;
dill_ctx_fd_term(&ctx->fd);
dill_ctx_pollset_term(&ctx->pollset);
dill_ctx_stack_term(&ctx->stack);
dill_ctx_handle_term(&ctx->handle);
dill_ctx_cr_term(&ctx->cr);
dill_ctx_now_term(&ctx->now);
if(dill_ismain()) dill_main = NULL;
}
static void dill_ctx_atexit(void) {
if(dill_main) dill_ctx_term(dill_main);
}
static void dill_makekey(void) {
int rc = pthread_key_create(&dill_key, dill_ctx_term);
dill_assert(!rc);
}
struct dill_ctx *dill_ctx_init(void) {
int rc = dill_ctx_now_init(&dill_ctx_.now);
dill_assert(rc == 0);
rc = dill_ctx_cr_init(&dill_ctx_.cr);
dill_assert(rc == 0);
rc = dill_ctx_handle_init(&dill_ctx_.handle);
dill_assert(rc == 0);
rc = dill_ctx_stack_init(&dill_ctx_.stack);
dill_assert(rc == 0);
rc = dill_ctx_pollset_init(&dill_ctx_.pollset);
dill_assert(rc == 0);
rc = dill_ctx_fd_init(&dill_ctx_.fd);
dill_assert(rc == 0);
rc = pthread_once(&dill_keyonce, dill_makekey);
dill_assert(rc == 0);
if(dill_ismain()) {
dill_main = &dill_ctx_;
rc = atexit(dill_ctx_atexit);
dill_assert(rc == 0);
}
rc = pthread_setspecific(dill_key, &dill_ctx_);
dill_assert(rc == 0);
dill_ctx_.initialized = 1;
return &dill_ctx_;
}
#else
static pthread_key_t dill_key;
static pthread_once_t dill_keyonce = PTHREAD_ONCE_INIT;
static void *dill_main = NULL;
static void dill_ctx_term(void *ptr) {
struct dill_ctx *ctx = ptr;
dill_ctx_fd_term(&ctx->fd);
dill_ctx_pollset_term(&ctx->pollset);
dill_ctx_stack_term(&ctx->stack);
dill_ctx_handle_term(&ctx->handle);
dill_ctx_cr_term(&ctx->cr);
dill_ctx_now_term(&ctx->now);
free(ctx);
if(dill_ismain()) dill_main = NULL;
}
static void dill_ctx_atexit(void) {
if(dill_main) dill_ctx_term(dill_main);
}
static void dill_makekey(void) {
int rc = pthread_key_create(&dill_key, dill_ctx_term);
dill_assert(!rc);
}
struct dill_ctx *dill_getctx_(void) {
int rc = pthread_once(&dill_keyonce, dill_makekey);
dill_assert(rc == 0);
struct dill_ctx *ctx = pthread_getspecific(dill_key);
if(dill_fast(ctx)) return ctx;
ctx = malloc(sizeof(struct dill_ctx));
dill_assert(ctx);
rc = dill_ctx_now_init(&ctx->now);
dill_assert(rc == 0);
rc = dill_ctx_cr_init(&ctx->cr);
dill_assert(rc == 0);
rc = dill_ctx_handle_init(&ctx->handle);
dill_assert(rc == 0);
rc = dill_ctx_stack_init(&ctx->stack);
dill_assert(rc == 0);
rc = dill_ctx_pollset_init(&ctx->pollset);
dill_assert(rc == 0);
rc = dill_ctx_fd_init(&ctx->fd);
dill_assert(rc == 0);
if(dill_ismain()) {
dill_main = ctx;
rc = atexit(dill_ctx_atexit);
dill_assert(rc == 0);
}
rc = pthread_setspecific(dill_key, ctx);
dill_assert(rc == 0);
return ctx;
}
#endif
#endif
|
#include <glib.h>
#include <stg.h>
int main(void)
{
st_init();
g_print("hello\n");
ST_VASSERT(0, "testing ST_VASSERT(0)\n");
return 0;
}
|
/*
Copyright (c) 2014-2021 AscEmu Team <http://www.ascemu.org>
This file is released under the MIT license. See README-MIT for more information.
*/
#pragma once
#include <cstdint>
#include "ManagedPacket.h"
#include "WorldPacket.h"
namespace AscEmu::Packets
{
class CmsgPetCancelAura : public ManagedPacket
{
public:
WoWGuid guid;
uint32_t spellId;
CmsgPetCancelAura() : CmsgPetCancelAura(0, 0)
{
}
CmsgPetCancelAura(uint64_t guid, uint32_t spellId) :
ManagedPacket(CMSG_PET_CANCEL_AURA, 12),
guid(guid),
spellId(spellId)
{
}
protected:
bool internalSerialise(WorldPacket& /*packet*/) override
{
return false;
}
bool internalDeserialise(WorldPacket& packet) override
{
uint64_t unpacked_guid;
packet >> unpacked_guid >> spellId;
guid.Init(unpacked_guid);
return true;
}
};
}
|
#ifndef SERVER_OBJ_LOW_H_
#define SERVER_OBJ_LOW_H_
/*-------------------------------------------------------------------
New LOW classification rules for ARMOR
See obj_low.cc for description
------------------------------------------------------------------*/
enum Tier
{
// equipment
Tier_Clothing = 0,
Tier_Light,
Tier_Medium,
Tier_Heavy,
Tier_Jewelry,
// weapons
Tier_Common,
Tier_Simple,
Tier_Martial,
Tier_Max
};
enum PointType
{
PointType_All = 0,
PointType_Stats,
PointType_Main,
PointType_Max
};
// constants used to try to approximate armor vs stats
// ac to affect hit rate by 1%
const float low_acPerHitrate = 25.0 / 3.0;
// change to hit rate for 1 stat point
const float low_statValue = 0.25;
// inflation multiplier for stat costs (used for more than combat, etc)
const float low_acModifier = 0.25;
// the base AC you get per item level?
const float low_acPerLevel = 25.0;
// cost in ac for 1 stat point
const float low_exchangeRate = low_acPerHitrate * low_statValue * low_acModifier;
// base class for TObj
class ObjectEvaluator
{
public:
ObjectEvaluator(const TObj *o);
virtual ~ObjectEvaluator(){};
sstring getTierString();
int getPointValue(PointType type = PointType_All);
double getLoadLevel(PointType type = PointType_All);
private:
int m_stat;
const TObj *m_obj;
bool m_gotStats;
int getStatPointsRaw();
//int getStructPointsRaw(); // struct we want to move off of level calc and into weight (so its shown in value)
protected:
virtual int getMainPointsRaw() = 0;
virtual Tier getTier() = 0;
virtual bool IgnoreApply(applyTypeT t) { return false; }
};
// class for TBaseClothing
class ArmorEvaluator : public ObjectEvaluator
{
public:
ArmorEvaluator(const TBaseClothing *o);
virtual ~ArmorEvaluator(){};
private:
const TBaseClothing *m_clothing;
int m_main;
bool m_gotMain;
protected:
virtual int getMainPointsRaw();
virtual Tier getTier();
virtual bool IgnoreApply(applyTypeT t) { return t == APPLY_ARMOR; }
};
// class for TBaseWeapon
class WeaponEvaluator : public ObjectEvaluator
{
public:
WeaponEvaluator(const TBaseWeapon *o);
virtual ~WeaponEvaluator(){};
private:
const TBaseWeapon *m_weap;
int m_main;
protected:
virtual int getMainPointsRaw();
virtual Tier getTier();
};
#endif
|
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#define SAMPLE_PERIOD 8.0
#define MAX_SAMPLES 2000
#define STEP_RESP_SPEED 1.5
#define ALPHA (0.5f)
int main(int argc, char** argv) {
FILE *fp = fopen("open-loop.dat", "r");
if(fp == NULL) {
printf("File error");
exit(-1);
}
float prev = 0;
float output = 0;
float time = 0, left = 0, right = 0;
while (!feof(fp)) {
if (fscanf(fp, "%f %f %f", &time, &left, &right) != 3) {
printf("fail\n");
break;
}
output = ALPHA * left + (1.0f - ALPHA)*prev;
prev = output;
printf("%f %f\n", time, output);
}
fclose(fp);
return 0;
}
|
/**
Copyright (c) 2010-2013 hkrn
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
- Neither the name of the MMDAI project team nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#ifndef VPVL2_EXTENSIONS_AUDIOSOURCE_H_
#define VPVL2_EXTENSIONS_AUDIOSOURCE_H_
#include <vpvl2/Common.h>
#ifdef __APPLE__
#undef __APPLE__ /* workaround for including AL/al.h of OpenAL soft */
#include <OpenAL/alure.h>
#define __APPLE__
#else
#if defined(_WIN32)
#define ALURE_STATIC_LIBRARY
#endif
#include <AL/alure.h>
#endif
/* alway uses OpenAL soft */
#define AL_ALEXT_PROTOTYPES
#if defined(WIN32) || defined(_WIN32)
#include <alext.h>
#else
#include <AL/alext.h>
#endif
#undef AL_ALEXT_PROTOTYPES
namespace vpvl2
{
namespace extensions
{
class AudioSource {
public:
static bool initialize() {
return alureInitDevice(0, 0) == AL_TRUE;
}
static bool terminate() {
return alureShutdownDevice() == AL_TRUE;
}
AudioSource()
: m_source(0),
m_buffer(0)
{
}
~AudioSource() {
deleteSource();
deleteBuffer();
}
bool load(const char *path) {
deleteSource();
alGenSources(1, &m_source);
deleteBuffer();
alGenBuffers(1, &m_buffer);
if (alureBufferDataFromFile(path, m_buffer)) {
alSourcei(m_source, AL_BUFFER, m_buffer);
return true;
}
else {
return false;
}
}
bool play() {
return alurePlaySource(m_source, 0, 0) == AL_TRUE;
}
bool stop() {
return alureStopSource(m_source, AL_FALSE) == AL_TRUE;
}
bool isRunning() const {
ALenum state;
alGetSourcei(m_source, AL_SOURCE_STATE, &state);
return state == AL_PLAYING;
}
void getOffsetLatency(double &offset, double &latency) const {
offset = latency = 0;
if (m_source) {
double values[2] = { 0 };
alGetSourcedvSOFT(m_source, AL_SEC_OFFSET_LATENCY_SOFT, values);
offset = values[0] * 1000.0;
latency = values[1] * 1000.0;
}
}
void update() {
if (m_buffer) {
alureUpdate();
}
}
bool isLoaded() const {
return m_source != 0 && m_buffer != 0;
}
const char *errorString() const {
return alureGetErrorString();
}
private:
void deleteSource() {
if (m_source) {
stop();
alSourcei(m_source, AL_BUFFER, 0);
alDeleteSources(1, &m_source);
m_source = 0;
}
}
void deleteBuffer() {
if (m_buffer) {
alDeleteBuffers(1, &m_buffer);
m_buffer = 0;
}
}
ALuint m_source;
ALuint m_buffer;
};
} /* namespace extensions */
} /* namespace vpvl2 */
#endif
|
/*
* Copyright (c) 2016 Lammert Bies
* Copyright (c) 2013-2016 the Civetweb developers
* Copyright (c) 2004-2013 Sergey Lyubka
*
* 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.
*
* ============
* Release: 2.0
*/
#include "httplib_main.h"
void XX_httplib_dir_scan_callback( struct lh_ctx_t *ctx, struct de *de, void *data ) {
struct dir_scan_data *dsd;
struct de* old_entries;
UNUSED_PARAMETER(ctx);
dsd = data;
if ( dsd->entries == NULL || dsd->num_entries >= dsd->arr_size ) {
dsd->arr_size *= 2;
old_entries = dsd->entries;
dsd->entries = httplib_realloc( old_entries, dsd->arr_size * sizeof(dsd->entries[0]) );
if ( dsd->entries == NULL && old_entries != NULL ) old_entries = httplib_free( old_entries );
}
if ( dsd->entries == NULL ) {
/*
* TODO(lsm, low): propagate an error to the caller
*/
dsd->num_entries = 0;
}
else {
dsd->entries[dsd->num_entries].file_name = httplib_strdup( de->file_name );
dsd->entries[dsd->num_entries].file = de->file;
dsd->entries[dsd->num_entries].conn = de->conn;
dsd->num_entries++;
}
} /* XX_httplib_dir_scan_callback */
|
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <CPOptional.h>
#include <xml/xmlelement.h>
#include <xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
namespace cpdoccore {
namespace odf_reader {
class office_event_listeners : public office_element_impl<office_event_listeners>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
office_element_ptr_array presentation_event_listeners_;
office_element_ptr_array script_event_listeners_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
//-------------------------------------------------------------------------------------
class presentation_event_listener_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
_CP_OPT(std::wstring) presentation_action_;
//presentation:verb
//presentation:start-scale
//presentation:speed
//presentation:direction
//presentation:effect
};
class presentation_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
//office_element_ptr_array content_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_event_listener);
// script:event-listeners_
class script_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeScriptEventListener;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(script_event_listener);
}
} |
// ---------------------------------------------------------------------
//
// Copyright (C) 2004 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__petsc_full_matrix_h
#define dealii__petsc_full_matrix_h
#include <deal.II/base/config.h>
#ifdef DEAL_II_WITH_PETSC
# include <deal.II/lac/exceptions.h>
# include <deal.II/lac/petsc_matrix_base.h>
DEAL_II_NAMESPACE_OPEN
namespace PETScWrappers
{
/*! @addtogroup PETScWrappers
*@{
*/
/**
* Implementation of a sequential dense matrix class based on PETSc. All the
* functionality is actually in the base class, except for the calls to
* generate a sequential dense matrix. This is possible since PETSc only
* works on an abstract matrix type and internally distributes to functions
* that do the actual work depending on the actual matrix type (much like
* using virtual functions). Only the functions creating a matrix of
* specific type differ, and are implemented in this particular class.
*
* @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class FullMatrix : public MatrixBase
{
public:
/**
* Declare type for container size.
*/
typedef types::global_dof_index size_type;
/**
* Default constructor. Create an empty matrix.
*/
FullMatrix ();
/**
* Create a full matrix of dimensions @p m times @p n.
*/
FullMatrix (const size_type m,
const size_type n);
/**
* Throw away the present matrix and generate one that has the same
* properties as if it were created by the constructor of this class with
* the same argument list as the present function.
*/
void reinit (const size_type m,
const size_type n);
/**
* Return a reference to the MPI communicator object in use with this
* matrix. Since this is a sequential matrix, it returns the MPI_COMM_SELF
* communicator.
*/
virtual const MPI_Comm &get_mpi_communicator () const;
private:
/**
* Do the actual work for the respective reinit() function and the
* matching constructor, i.e. create a matrix. Getting rid of the previous
* matrix is left to the caller.
*/
void do_reinit (const size_type m,
const size_type n);
};
/*@}*/
}
DEAL_II_NAMESPACE_CLOSE
#endif // DEAL_II_WITH_PETSC
/*---------------------------- petsc_full_matrix.h ---------------------------*/
#endif
/*---------------------------- petsc_full_matrix.h ---------------------------*/
|
#include <stdio.h>
#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <assert.h>
#include <fcntl.h>
#include <dos.h>
#include <hw/dos/dos.h>
#include <hw/dos/dosbox.h>
#include <hw/8237/8237.h> /* 8237 DMA */
#include <hw/8254/8254.h> /* 8254 timer */
#include <hw/8259/8259.h> /* 8259 PIC interrupts */
#include <hw/sndsb/sndsb.h>
#include <hw/dos/doswin.h>
#include <hw/dos/tgusmega.h>
#include <hw/dos/tgussbos.h>
/* Windows 9x VxD enumeration */
#include <windows/w9xvmm/vxd_enum.h>
/* uncomment this to enable debugging messages */
//#define DBG
#if defined(DBG)
# define DEBUG(x) (x)
#else
# define DEBUG(x)
#endif
static const char *sndsb_ess_chipsets_str[SNDSB_ESS_MAX] = {
"none",
"ESS688",
"ESS1869"
};
const char *sndsb_ess_chipset_str(unsigned int c) {
if (c >= SNDSB_ESS_MAX) return NULL;
return sndsb_ess_chipsets_str[c];
}
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QABSTRACTSTATE_H
#define QABSTRACTSTATE_H
#include <QtCore/qobject.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Core)
#ifndef QT_NO_STATEMACHINE
class QState;
class QStateMachine;
class QAbstractStatePrivate;
class Q_CORE_EXPORT QAbstractState : public QObject
{
Q_OBJECT
public:
~QAbstractState();
QState *parentState() const;
QStateMachine *machine() const;
Q_SIGNALS:
#if !defined(Q_MOC_RUN) && !defined(qdoc)
private: // can only be emitted by QAbstractState
#endif
void entered();
void exited();
protected:
QAbstractState(QState *parent = 0);
virtual void onEntry(QEvent *event) = 0;
virtual void onExit(QEvent *event) = 0;
bool event(QEvent *e);
protected:
QAbstractState(QAbstractStatePrivate &dd, QState *parent);
private:
Q_DISABLE_COPY(QAbstractState)
Q_DECLARE_PRIVATE(QAbstractState)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
QT_END_HEADER
#endif
|
/*
biquad.h:
Copyright (C) 1998, 1999, 2001 by Hans Mikelson,
Matt Gerassimoff, John ffitch,
Steven Yi
This file is part of Csound.
The Csound 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.
Csound 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 Csound; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/
/* biquad.h */
#include "stdopcod.h"
/* Structure for biquadratic filter */
typedef struct {
OPDS h;
MYFLT *out, *in, *b0, *b1, *b2, *a0, *a1, *a2, *reinit;
double xnm1, xnm2, ynm1, ynm2;
} BIQUAD;
/* Structure for moogvcf filter */
typedef struct {
OPDS h;
MYFLT *out, *in, *fco, *res, *max, *iskip;
double xnm1, y1nm1, y2nm1, y3nm1, y1n, y2n, y3n, y4n;
MYFLT maxint;
int16 fcocod, rezcod;
} MOOGVCF;
/* Structure for rezzy filter */
typedef struct {
OPDS h;
MYFLT *out, *in, *fco, *rez, *mode, *iskip;
double xnm1, xnm2, ynm1, ynm2;
int16 fcocod, rezcod;
int16 warn;
} REZZY;
/* Structure for distortion */
typedef struct {
OPDS h;
MYFLT *out, *in, *pregain, *postgain, *shape1, *shape2, *imode;
} DISTORT;
/* Structure for vco, analog modeling opcode */
typedef struct {
OPDS h;
MYFLT *ar,
*xamp, *xcps, *wave, *pw, *sine, *maxd, *leak, *inyq, *iphs, *iskip;
MYFLT ynm1, ynm2, leaky, nyq;
int16 ampcod, cpscod;
int32 lphs;
FUNC *ftp;
/* Insert VDelay here */
AUXCH aux;
/* AUXCH auxd; */
int32 left;
/* End VDelay insert */
} VCO;
typedef struct {
OPDS h;
MYFLT *outx, *outy, *outz, *mass1, *mass2, *sep, *xval, *yval, *zval;
MYFLT *vxval, *vyval, *vzval, *delta, *fric, *iskip;
MYFLT s1z, s2z, friction;
MYFLT x, y, z, vx, vy, vz, ax, ay, az, hstep;
} PLANET;
typedef struct {
OPDS h;
MYFLT *out, *in, *fc, *v, *q, *mode, *iskip;
double xnm1, xnm2, ynm1, ynm2;
MYFLT prv_fc, prv_v, prv_q;
double b0, b1, b2, a1, a2;
int32_t imode;
} PAREQ;
typedef struct {
OPDS h;
MYFLT *out, *in, *mode, *maxdel, *del1, *gain1, *del2, *gain2;
MYFLT *del3, *gain3, *istor;
MYFLT *curp, out1, out2, out3;
MYFLT *beg1p, *beg2p, *beg3p, *end1p, *end2p, *end3p;
MYFLT *del1p, *del2p, *del3p;
int32 npts;
AUXCH auxch;
} NESTEDAP;
typedef struct {
OPDS h;
MYFLT *outx, *outy, *outz,
*s, *r, *b, *hstep, *inx, *iny, *inz, *skip, *iskip;
MYFLT valx, valy, valz;
} LORENZ;
/* And also opcodes of Jens Groh, Munich, Germany. mail: groh@irt.de */
/* Structure for tbvcf filter */
typedef struct {
OPDS h;
MYFLT *out, *in, *fco, *res, *dist, *asym, *iskip;
double y, y1, y2;
int16 fcocod, rezcod;
} TBVCF;
/* Structure for mode opcode */
typedef struct {
OPDS h;
MYFLT *aout, *ain, *kfreq, *kq, *reinit;
double xnm1, ynm1, ynm2, a0, a1, a2, d;
MYFLT lfq,lq;
MYFLT limit;
} MODE;
typedef struct {
OPDS h;
MYFLT *out;
MYFLT *in, *f0, *tau, *reinit;
MYFLT x, y;
} MVMFILT;
|
/* UIxCalListingActions.h - this file is part of SOGo
*
* Copyright (C) 2006-2009 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file 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 file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef UIXCALLISTINGACTIONVIEW_H
#define UIXCALLISTINGACTIONVIEW_H
#import <Common/WODirectAction+SOGo.h>
@class NSCalendarDate;
@class NSMutableDictionary;
@class NSString;
@class NSTimeZone;
@class SOGoDateFormatter;
@class WOResponse;
@class WORequest;
@interface UIxCalListingActions : WODirectAction
{
NSMutableDictionary *componentsData;
NSCalendarDate *startDate;
NSCalendarDate *endDate;
NSString *title;
NSString *userLogin;
BOOL dayBasedView;
WORequest *request;
SOGoDateFormatter *dateFormatter;
NSTimeZone *userTimeZone;
}
- (WOResponse *) alarmsListAction;
- (WOResponse *) eventsListAction;
- (WOResponse *) tasksListAction;
@end
#endif /* UIXCALLISTINGACTION_H */
|
#define IFERRORIL(error) {{if (error) { fprintf(stderr, "%s\n", error_il(error)); exit(1); }}}
/**********************************************************************************/
/* General interface for using compressed representations of posting lists */
/* Any alternative representation must implement all these functions */
/**********************************************************************************/
#ifndef uint
#define uint unsigned int
#endif
#ifndef ulong
#define ulong unsigned long int
#endif
/* Error management */
/* Returns a string describing the error associated with error number
e. The string must not be freed, and it will be overwritten with
subsequent calls. */
char *error_il (int e);
/* Building the inverted list structure */
/* Creates a structure for the management of inverted lists from a
given set of posting lists.
Array source has the following format...
[Nwords=N][maxPostvalue][lenPost1][post11][post12]...[post1k�]
[lenPost2][post21][post22]...[post2k��]
...
[lenPostN][postN1][postN2]...[postNk���]
il is an opaque data type. Any build option must be passed in string
build_options, whose syntax depends on the index. The index must
always work with some default parameters if build_options is NULL.
The returned structure is ready to be queried. */
int build_il (uint *source, ulong length, char *build_options, void **ail);
/* returns a string with the parameters available for building the method.
So that each index tells the user the available parameters. */
char *showParameters_il();
/* Saves index on disk by using single or multiple files, having
proper extensions. */
int save_il (void *ail, char *filebasename);
/* Loads index from one or more file(s) named filename, possibly
adding the proper extensions. */
int load_il (char *filebasename, void **ail);
/* Frees the memory occupied by index. */
int free_il (void *ail);
/* Gives the memory occupied by index in bytes. */
int size_il(void *ail, ulong *size);
/* Gives the memory occupied by the index assuming an uncompressed
representation (uint **)*/
int size_il_uncompressed(void *ail, ulong *size);
/* Gives the length of the longest posting-list*/
int maxSizePosting_il(void *ail, uint *size);
/* Generates estatistics about the len of the compressed posting lists */
int buildBell_il(void *ail, const char matlabfilename[]);
/********************************************************/
/***** Operations (searching) with the posting lists ****/
/********************************************************/
/* Extracts the id-th list, having id \in [0..maxId-1] */
int extractList_il (void *ail, uint id, uint **list, uint *len);
/* Extracts the id-th list, having id \in [0..maxId-1]
Assumes list has enough space previously allocated. */
int extractListNoMalloc_il (void *ail, uint id, uint *list, uint *len);
/* Sets options for searches: such as parameters, funtions to use, etc
Permits to set different algorithms for intersect2, intersectN and
if needed "fsearch-operations needed by svs-type algorithms" */
int setDefaultSearchOptions_il (void *ail, char *search_options);
/* Intersects two lists given by id1 and id2 \in [0..maxId-1].
The defaultIntersect2 function must be initialized previously (svs, merge, ...)
Returns the resulting list of "intersecting positions" */
int intersect_2_il (void *ail, uint id1, uint id2, uint *noccs, uint **occs);
/* Intersects $nids$ lists given by ids in ids[], having ids[i] \in [0..maxId-1].
Returns the resulting list of "intersecting positions" */
int intersect_N_il (void *ail, uint *ids, uint nids, uint *noccs, uint **occs );
/* Returns the len of the id-th posting list */
int lenlist(void *ail, uint id, uint *len);
|
/*
* Copyright (C) 2014 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_cortexm3_common
* @{
*
* @file
* @brief Implementation of the kernels atomic interface
*
* @author Stefan Pfeiffer <stefan.pfeiffer@fu-berlin.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Joakim Gebart <joakim.gebart@eistec.se>
*
* @}
*/
#include <stdint.h>
#include "atomic.h"
#include "irq.h"
#include "cpu.h"
int atomic_cas(atomic_int_t *var, int old, int now)
{
int tmp;
int status;
/* Load exclusive */
tmp = __LDREXW((volatile uint32_t *)(&ATOMIC_VALUE(*var)));
if (tmp != old) {
/* Clear memory exclusivity */
__CLREX();
return 0;
}
/* Try to write the new value */
status = __STREXW(now, (volatile uint32_t *)(&ATOMIC_VALUE(*var)));
return (status == 0);
}
|
/*
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2017 BaishanCloud. All rights reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <openssl/bn.h>
#include <openssl/err.h>
#include "rsa_locl.h"
void rsa_multip_info_free_ex(RSA_PRIME_INFO *pinfo)
{
/* free pp and pinfo only */
BN_clear_free(pinfo->pp);
OPENSSL_free(pinfo);
}
void rsa_multip_info_free(RSA_PRIME_INFO *pinfo)
{
/* free a RSA_PRIME_INFO structure */
BN_clear_free(pinfo->r);
BN_clear_free(pinfo->d);
BN_clear_free(pinfo->t);
rsa_multip_info_free_ex(pinfo);
}
RSA_PRIME_INFO *rsa_multip_info_new(void)
{
RSA_PRIME_INFO *pinfo;
/* create a RSA_PRIME_INFO structure */
if ((pinfo = OPENSSL_zalloc(sizeof(RSA_PRIME_INFO))) == NULL) {
RSAerr(RSA_F_RSA_MULTIP_INFO_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
if ((pinfo->r = BN_secure_new()) == NULL)
goto err;
if ((pinfo->d = BN_secure_new()) == NULL)
goto err;
if ((pinfo->t = BN_secure_new()) == NULL)
goto err;
if ((pinfo->pp = BN_secure_new()) == NULL)
goto err;
return pinfo;
err:
BN_free(pinfo->r);
BN_free(pinfo->d);
BN_free(pinfo->t);
BN_free(pinfo->pp);
OPENSSL_free(pinfo);
return NULL;
}
/* Refill products of primes */
int rsa_multip_calc_product(RSA *rsa)
{
RSA_PRIME_INFO *pinfo;
BIGNUM *p1 = NULL, *p2 = NULL;
BN_CTX *ctx = NULL;
int i, rv = 0, ex_primes;
if ((ex_primes = sk_RSA_PRIME_INFO_num(rsa->prime_infos)) <= 0) {
/* invalid */
goto err;
}
if ((ctx = BN_CTX_new()) == NULL)
goto err;
/* calculate pinfo->pp = p * q for first 'extra' prime */
p1 = rsa->p;
p2 = rsa->q;
for (i = 0; i < ex_primes; i++) {
pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i);
if (pinfo->pp == NULL) {
pinfo->pp = BN_secure_new();
if (pinfo->pp == NULL)
goto err;
}
if (!BN_mul(pinfo->pp, p1, p2, ctx))
goto err;
/* save previous one */
p1 = pinfo->pp;
p2 = pinfo->r;
}
rv = 1;
err:
BN_CTX_free(ctx);
return rv;
}
int rsa_multip_cap(int bits)
{
int cap = 5;
if (bits < 1024)
cap = 2;
else if (bits < 4096)
cap = 3;
else if (bits < 8192)
cap = 4;
if (cap > RSA_MAX_PRIME_NUM)
cap = RSA_MAX_PRIME_NUM;
return cap;
}
|
/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
* This file is part of the GetData project.
*
* GetData 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.
*
* GetData 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 GetData; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Add a dirfile field */
#include "test.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
int main(void)
{
const char *filedir = "dirfile";
const char *format = "dirfile/format";
const char *data = "dirfile/data";
int error, r = 0;
DIRFILE *D;
gd_entry_t E, e;
rmdirfile();
E.field = "data";
E.field_type = GD_RAW_ENTRY;
E.fragment_index = 0;
E.EN(raw,spf) = 2;
E.EN(raw,data_type) = GD_UINT8;
E.scalar[0] = NULL;
D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
gd_add(D, &E);
error = gd_error(D);
/* check */
gd_entry(D, "data", &e);
if (gd_error(D))
r = 1;
else {
CHECKI(e.field_type, GD_RAW_ENTRY);
CHECKI(e.fragment_index, 0);
CHECKI(e.EN(raw,spf), 2);
CHECKI(e.EN(raw,data_type), GD_UINT8);
CHECKP(e.scalar[0]);
gd_free_entry_strings(&e);
}
gd_close(D);
unlink(data);
unlink(format);
rmdir(filedir);
CHECKI(error, GD_E_OK);
return r;
}
|
/* CAOpenGLLayer.h
Copyright (C) 2017 Free Software Foundation, Inc.
Author: Daniel Ferreira <dtf@stanford.edu>
Date: July 2017
This file is part of QuartzCore.
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; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <QuartzCore/CALayer.h>
@interface CAOpenGLLayer : CALayer
@end
|
// Copyright 2008 David Roberts <dvdr18@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
#ifndef MARBLE_MERGEDLAYERDECORATOR_H
#define MARBLE_MERGEDLAYERDECORATOR_H
#include <QtCore/QSharedPointer>
#include <QtCore/QVector>
#include "MarbleGlobal.h"
class QImage;
class QString;
namespace Marble
{
class GeoSceneTiled;
class SunLocator;
class StackedTile;
class TextureTile;
class TileId;
class TileLoader;
class MergedLayerDecorator
{
public:
MergedLayerDecorator( TileLoader * const tileLoader, const SunLocator* sunLocator );
virtual ~MergedLayerDecorator();
StackedTile *loadTile( const TileId &id, const QVector<const GeoSceneTiled *> &textureLayers ) const;
StackedTile *createTile( const StackedTile &stackedTile, const TileId &tileId, const QImage &tileImage ) const;
void downloadStackedTile( const TileId &id, const QVector<GeoSceneTiled const *> &textureLayers, DownloadUsage usage );
void setThemeId( const QString &themeId );
void setLevelZeroLayout( int levelZeroColumns, int levelZeroRows );
void setShowSunShading( bool show );
bool showSunShading() const;
void setShowCityLights( bool show );
bool showCityLights() const;
void setShowTileId(bool show);
protected:
Q_DISABLE_COPY( MergedLayerDecorator )
class Private;
Private *const d;
};
}
#endif
|
/**************************************************************************
**
** Copyright (c) 2014 Hugues Delorme
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and 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.
**
****************************************************************************/
#ifndef BAZAAREDITOR_H
#define BAZAAREDITOR_H
#include <vcsbase/vcsbaseeditor.h>
#include <QRegExp>
namespace Bazaar {
namespace Internal {
class BazaarEditorWidget : public VcsBase::VcsBaseEditorWidget
{
Q_OBJECT
public:
BazaarEditorWidget();
private:
QSet<QString> annotationChanges() const;
QString changeUnderCursor(const QTextCursor &cursor) const;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
mutable QRegExp m_changesetId;
mutable QRegExp m_exactChangesetId;
};
} // namespace Internal
} // namespace Bazaar
#endif // BAZAAREDITOR_H
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTCONCURRENT_GLOBAL_H
#define QTCONCURRENT_GLOBAL_H
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
#ifndef QT_STATIC
# if defined(QT_BUILD_CONCURRENT_LIB)
# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT
# else
# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT
# endif
#else
# define Q_CONCURRENT_EXPORT
#endif
QT_END_NAMESPACE
#endif // include guard
|
/////////////////////////////////////////////////////////////////////////
//
// © University of Southampton IT Innovation Centre, 2012
//
// Copyright in this software belongs to University of Southampton
// IT Innovation Centre of Gamma House, Enterprise Road,
// Chilworth Science Park, Southampton, SO16 7NS, UK.
//
// This software may not be used, sold, licensed, transferred, copied
// or reproduced in whole or in part in any manner or form or in or
// on any media by any person other than in accordance with the terms
// of the Licence Agreement supplied with the software, or otherwise
// without the prior written consent of the copyright owners.
//
// This software is distributed WITHOUT ANY WARRANTY, without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE, except where stated in the Licence Agreement supplied with
// the software.
//
// Created By : Simon Crowle
// Created Date : 15-May-2013
// Created for Project : EXPERIMEDIA
//
/////////////////////////////////////////////////////////////////////////
#pragma once
#include "AbstractAMQPInterface.h"
#include <boost/uuid/uuid.hpp>
namespace ecc_amqpAPI_impl
{
class AMQPHalfInterfaceBase : public AbstractAMQPInterface
{
public:
typedef boost::shared_ptr<AMQPHalfInterfaceBase> ptr_t;
AMQPHalfInterfaceBase( AMQPBasicSubscriptionService::ptr_t sService,
AMQPBasicChannel::ptr_t inChannel,
AMQPBasicChannel::ptr_t outChannel );
virtual ~AMQPHalfInterfaceBase();
bool initialise( const String& iName,
const UUID& targetID,
const bool asProvider );
protected:
virtual void createInterfaceExchangeNames( const String& iName );
virtual void assignBindings();
private:
bool setInitParams( const String& iName, const UUID& targetID, const bool asProvider );
};
} // namespace
|
#include<stdio.h>
main(){
printf("EOF is %d\n", EOF);
}
|
/*
* virprocess.h: interaction with processes
*
* Copyright (C) 2010-2015 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, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <sys/types.h>
#include "internal.h"
#include "virbitmap.h"
#include "virenum.h"
typedef enum {
VIR_PROC_POLICY_NONE = 0,
VIR_PROC_POLICY_BATCH,
VIR_PROC_POLICY_IDLE,
VIR_PROC_POLICY_FIFO,
VIR_PROC_POLICY_RR,
VIR_PROC_POLICY_LAST
} virProcessSchedPolicy;
VIR_ENUM_DECL(virProcessSchedPolicy);
char *
virProcessTranslateStatus(int status);
void
virProcessAbort(pid_t pid);
void virProcessExitWithStatus(int status) G_GNUC_NORETURN;
int
virProcessWait(pid_t pid, int *exitstatus, bool raw)
G_GNUC_WARN_UNUSED_RESULT;
int virProcessKill(pid_t pid, int sig);
int virProcessGroupKill(pid_t pid, int sig);
pid_t virProcessGroupGet(pid_t pid);
int virProcessKillPainfully(pid_t pid, bool force);
int virProcessKillPainfullyDelay(pid_t pid,
bool force,
unsigned int extradelay,
bool group);
int virProcessSetAffinity(pid_t pid, virBitmap *map, bool quiet);
virBitmap *virProcessGetAffinity(pid_t pid);
int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids);
int virProcessGetStartTime(pid_t pid,
unsigned long long *timestamp);
int virProcessGetNamespaces(pid_t pid,
size_t *nfdlist,
int **fdlist);
int virProcessSetNamespaces(size_t nfdlist,
int *fdlist);
int virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes) G_GNUC_NO_INLINE;
int virProcessSetMaxProcesses(pid_t pid, unsigned int procs);
int virProcessSetMaxFiles(pid_t pid, unsigned int files);
int virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes);
int virProcessGetMaxMemLock(pid_t pid, unsigned long long *bytes) G_GNUC_NO_INLINE;
/* Callback to run code within the mount namespace tied to the given
* pid. This function must use only async-signal-safe functions, as
* it gets run after a fork of a multi-threaded process. The return
* value of this function is passed to _exit(), except that a
* negative value is treated as EXIT_CANCELED. */
typedef int (*virProcessNamespaceCallback)(pid_t pid, void *opaque);
int virProcessRunInMountNamespace(pid_t pid,
virProcessNamespaceCallback cb,
void *opaque);
/**
* virProcessForkCallback:
* @ppid: parent's pid
* @opaque: opaque data
*
* Callback to run in fork()-ed process.
*
* Returns: 0 on success,
* -1 on error (treated as EXIT_CANCELED)
*/
typedef int (*virProcessForkCallback)(pid_t ppid,
void *opaque);
int virProcessRunInFork(virProcessForkCallback cb,
void *opaque)
G_GNUC_NO_INLINE;
int virProcessSetupPrivateMountNS(void);
int virProcessSetScheduler(pid_t pid,
virProcessSchedPolicy policy,
int priority);
typedef enum {
VIR_PROCESS_NAMESPACE_MNT = (1 << 1),
VIR_PROCESS_NAMESPACE_IPC = (1 << 2),
VIR_PROCESS_NAMESPACE_NET = (1 << 3),
VIR_PROCESS_NAMESPACE_PID = (1 << 4),
VIR_PROCESS_NAMESPACE_USER = (1 << 5),
VIR_PROCESS_NAMESPACE_UTS = (1 << 6),
} virProcessNamespaceFlags;
int virProcessNamespaceAvailable(unsigned int ns);
|
/**
* @file tree.c
* @brief tree.h implementation
* @author Aleix Conchillo Flaque <aconchillo@gmail.com>
* @date Thu Feb 20, 2003 23:45
*
* @if copyright
*
* Copyright (C) 2003-2009 Aleix Conchillo Flaque
*
* SCEW 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.
*
* SCEW 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.
*
* @endif
*/
#include "tree.h"
#include "xerror.h"
#include "element.h"
#include "str.h"
#include <assert.h>
/* Private */
struct scew_tree
{
XML_Char *version;
XML_Char *encoding;
XML_Char *preamble;
scew_tree_standalone standalone;
scew_element *root;
};
static scew_bool compare_tree_ (scew_tree const *a, scew_tree const *b);
static XML_Char const *DEFAULT_XML_VERSION_ = (XML_Char *) _XT("1.0");
static XML_Char const *DEFAULT_ENCODING_ = (XML_Char *) _XT("UTF-8");
/* Allocation */
scew_tree*
scew_tree_create (void)
{
scew_tree *tree = calloc (1, sizeof (scew_tree));
if (tree != NULL)
{
scew_tree_set_xml_version (tree, DEFAULT_XML_VERSION_);
scew_tree_set_xml_encoding (tree, DEFAULT_ENCODING_);
scew_tree_set_xml_standalone (tree, scew_tree_standalone_unknown);
}
else
{
scew_error_set_last_error_ (scew_error_no_memory);
}
return tree;
}
scew_tree*
scew_tree_copy (scew_tree const *tree)
{
scew_tree *new_tree = NULL;
assert (tree != NULL);
new_tree = calloc (1, sizeof (scew_tree));
if (new_tree != NULL)
{
scew_bool copied = SCEW_FALSE;
new_tree->version = scew_strdup (tree->version);
new_tree->encoding = scew_strdup (tree->encoding);
new_tree->preamble = scew_strdup (tree->preamble);
new_tree->standalone = tree->standalone;
new_tree->root = scew_element_copy (tree->root);
copied =
((tree->version == NULL) || (new_tree->version != NULL))
&& ((tree->encoding == NULL) || (new_tree->encoding != NULL))
&& ((tree->preamble == NULL) || (new_tree->preamble != NULL))
&& ((tree->root == NULL) || (new_tree->root != NULL));
if (!copied)
{
scew_tree_free (new_tree);
new_tree = NULL;
}
}
return new_tree;
}
void
scew_tree_free (scew_tree *tree)
{
if (tree != NULL)
{
free (tree->version);
free (tree->encoding);
free (tree->preamble);
scew_element_free (tree->root);
free (tree);
}
}
/* Comparison */
scew_bool
scew_tree_compare (scew_tree const *a,
scew_tree const *b,
scew_tree_cmp_hook hook)
{
scew_tree_cmp_hook cmp_hook = NULL;
assert (a != NULL);
assert (b != NULL);
cmp_hook = (NULL == hook) ? compare_tree_ : hook;
return cmp_hook (a, b);
}
/* Properties */
XML_Char const*
scew_tree_xml_version (scew_tree const *tree)
{
assert(tree != NULL);
return tree->version;
}
void
scew_tree_set_xml_version (scew_tree *tree, XML_Char const *version)
{
assert (tree != NULL);
assert (version != NULL);
free (tree->version);
tree->version = scew_strdup (version);
}
XML_Char const*
scew_tree_xml_encoding (scew_tree const *tree)
{
assert(tree != NULL);
return tree->encoding;
}
void
scew_tree_set_xml_encoding (scew_tree *tree, XML_Char const *encoding)
{
assert (tree != NULL);
assert (encoding != NULL);
free (tree->encoding);
tree->encoding = scew_strdup (encoding);
}
scew_tree_standalone
scew_tree_xml_standalone (scew_tree const *tree)
{
assert (tree != NULL);
return tree->standalone;
}
void
scew_tree_set_xml_standalone (scew_tree *tree, scew_tree_standalone standalone)
{
assert(tree != NULL);
tree->standalone = standalone;
}
/* Contents */
scew_element*
scew_tree_root (scew_tree const *tree)
{
assert (tree != NULL);
return tree->root;
}
scew_element*
scew_tree_set_root (scew_tree *tree, XML_Char const *name)
{
scew_element *root = NULL;
scew_element *new_root = NULL;
assert (tree != NULL);
assert (name != NULL);
root = scew_element_create (name);
if (root != NULL)
{
new_root = scew_tree_set_root_element (tree, root);
}
else
{
scew_error_set_last_error_ (scew_error_no_memory);
}
return new_root;
}
scew_element*
scew_tree_set_root_element (scew_tree *tree, scew_element *root)
{
assert (tree != NULL);
assert (root != NULL);
tree->root = root;
return root;
}
XML_Char const*
scew_tree_xml_preamble (scew_tree const *tree)
{
assert (tree != NULL);
return tree->preamble;
}
void
scew_tree_set_xml_preamble (scew_tree *tree, XML_Char const *preamble)
{
assert (tree != NULL);
assert (preamble != NULL);
free (tree->preamble);
tree->preamble = scew_strdup (preamble);
}
/* Private*/
scew_bool
compare_tree_ (scew_tree const *a, scew_tree const *b)
{
scew_bool equal = SCEW_FALSE;
assert (a != NULL);
assert (b != NULL);
equal = (scew_strcmp (a->version, b->version) == 0)
&& (scew_strcmp (a->encoding, b->encoding) == 0)
&& (scew_strcmp (a->preamble, b->preamble) == 0)
&& (a->standalone == b->standalone)
&& scew_element_compare (a->root, b->root, NULL);
return equal;
}
|
/*---------------------------------------------------------------------------*\
* OpenSG *
* *
* *
* Copyright (C) 2000-2002 by the OpenSG Forum *
* *
* www.opensg.org *
* *
* contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
* *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
* License *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Library General Public License as published *
* by the Free Software Foundation, version 2. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
* Changes *
* *
* *
* *
* *
* *
* *
\*---------------------------------------------------------------------------*/
/*****************************************************************************\
*****************************************************************************
** **
** This file is automatically generated. **
** **
** Any changes made to this file WILL be lost when it is **
** regenerated, which can become necessary at any time. **
** **
*****************************************************************************
\*****************************************************************************/
#ifndef _OSGSHADERPARAMETERFIELDS_H_
#define _OSGSHADERPARAMETERFIELDS_H_
#ifdef __sgi
#pragma once
#endif
#include <OSGConfig.h>
#include <OSGFieldContainerPtr.h>
#include <OSGNodeCoreFieldDataType.h>
#include <OSGSystemDef.h>
#include <OSGAttachmentContainerFields.h>
OSG_BEGIN_NAMESPACE
class ShaderParameter;
#if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
//! ShaderParameterPtr
typedef FCPtr<AttachmentContainerPtr, ShaderParameter> ShaderParameterPtr;
#endif
#if !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
/*! \ingroup GrpSystemFieldTraits
*/
#if !defined(OSG_DOC_DEV_TRAITS)
/*! \hideinhierarchy */
#endif
template <>
struct FieldDataTraits<ShaderParameterPtr> :
public FieldTraitsRecurseMapper<ShaderParameterPtr, true>
{
static DataType _type;
enum { StringConvertable = 0x00 };
enum { bHasParent = 0x01 };
static DataType &getType (void) { return _type; }
static const char *getSName(void) { return "SFShaderParameterPtr"; }
static const char *getMName(void) { return "MFShaderParameterPtr"; }
};
#if !defined(OSG_DOC_DEV_TRAITS)
/*! \class FieldTraitsRecurseMapper<ShaderParameterPtr, true>
\hideinhierarchy
*/
#endif
#endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
#if !defined(OSG_DO_DOC) || defined(OSG_DOC_FIELD_TYPEDEFS)
/*! \ingroup GrpSystemFieldSingle */
typedef SField<ShaderParameterPtr> SFShaderParameterPtr;
#endif
#ifndef OSG_COMPILESHADERPARAMETERINST
OSG_DLLEXPORT_DECL1(SField, ShaderParameterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING)
#endif
#if !defined(OSG_DO_DOC) || defined(OSG_DOC_FIELD_TYPEDEFS)
/*! \ingroup GrpSystemFieldMulti */
typedef MField<ShaderParameterPtr> MFShaderParameterPtr;
#endif
#ifndef OSG_COMPILESHADERPARAMETERINST
OSG_DLLEXPORT_DECL1(MField, ShaderParameterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING)
#endif
OSG_END_NAMESPACE
#define OSGSHADERPARAMETERFIELDS_HEADER_CVSID "@(#)$Id: OSGShaderParameterFields.h,v 1.11 2008/06/09 12:28:05 vossg Exp $"
#endif /* _OSGSHADERPARAMETERFIELDS_H_ */
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2010, 2011, 2012, 2013, 2015 CNRS
* Copyright (C) 2011, 2012 INRIA
*
* StarPU 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.
*
* StarPU 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 in COPYING.LGPL for more details.
*/
#include <config.h>
#include <starpu.h>
#include "../test_interfaces.h"
#include "../../../helper.h"
/*
* In this test, we use the following matrix:
*
* +----------------+
* | 0 1 0 0 |
* | 2 3 0 0 |
* | 4 5 8 9 |
* | 6 7 10 11 |
* +----------------+
*
* nzval = [0, 1, 2, 3] ++ [4, 5, 6, 7] ++ [8, 9, 10, 11]
* colind = [0, 0, 1]
* rowptr = [0, 1 ]
* r = c = 2
*/
/* Size of the blocks */
#define R 2
#define C 2
#define NNZ_BLOCKS 3 /* out of 4 */
#define NZVAL_SIZE (R*C*NNZ_BLOCKS)
#ifdef STARPU_USE_CPU
void test_bcsr_cpu_func(void *buffers[], void *args);
#endif /* !STARPU_USE_CPU */
#ifdef STARPU_USE_CUDA
extern void test_bcsr_cuda_func(void *buffers[], void *_args);
#endif /* !STARPU_USE_CUDA */
#ifdef STARPU_USE_OPENCL
extern void test_bcsr_opencl_func(void *buffers[], void *args);
#endif /* !STARPU_USE_OPENCL */
static int nzval[NZVAL_SIZE] =
{
0, 1, 2, 3, /* Fisrt block */
4, 5, 6, 7, /* Second block */
8, 9, 10, 11 /* Third block */
};
static int nzval2[NZVAL_SIZE];
static uint32_t colind[NNZ_BLOCKS] = { 0, 0, 2 };
static uint32_t colind2[NNZ_BLOCKS];
static uint32_t rowptr[2] = { 0, 1 };
static uint32_t rowptr2[2];
static starpu_data_handle_t bcsr_handle;
static starpu_data_handle_t bcsr2_handle;
struct test_config bcsr_config =
{
#ifdef STARPU_USE_CPU
.cpu_func = test_bcsr_cpu_func,
#endif /* !STARPU_USE_CPU */
#ifdef STARPU_USE_CUDA
.cuda_func = test_bcsr_cuda_func,
#endif /* !STARPU_USE_CUDA */
#ifdef STARPU_USE_OPENCL
.opencl_func = test_bcsr_opencl_func,
#endif /* !STARPU_USE_OPENCL */
#ifdef STARPU_USE_MIC
.cpu_func_name = "test_bcsr_cpu_func",
#endif
.handle = &bcsr_handle,
.dummy_handle = &bcsr2_handle,
.copy_failed = SUCCESS,
.name = "bcsr_interface"
};
static void
register_data(void)
{
starpu_bcsr_data_register(&bcsr_handle,
STARPU_MAIN_RAM,
NNZ_BLOCKS,
1, /* nrow */
(uintptr_t) nzval,
colind,
rowptr,
0, /* firstentry */
R,
C,
sizeof(nzval[0]));
starpu_bcsr_data_register(&bcsr2_handle,
STARPU_MAIN_RAM,
NNZ_BLOCKS,
1, /* nrow */
(uintptr_t) nzval2,
colind2,
rowptr2,
0, /* firstentry */
R,
C,
sizeof(nzval2[0]));
}
static void
unregister_data(void)
{
starpu_data_unregister(bcsr_handle);
starpu_data_unregister(bcsr2_handle);
}
void
test_bcsr_cpu_func(void *buffers[], void *args)
{
STARPU_SKIP_IF_VALGRIND;
int *val;
int factor;
int i;
uint32_t nnz = STARPU_BCSR_GET_NNZ(buffers[0]);
uint32_t r = ((struct starpu_bcsr_interface *)buffers[0])->r;
uint32_t c = ((struct starpu_bcsr_interface *)buffers[0])->c;
if (r != R || c != C)
{
bcsr_config.copy_failed = FAILURE;
return;
}
nnz *= (r*c);
val = (int *) STARPU_BCSR_GET_NZVAL(buffers[0]);
factor = *(int *) args;
for (i = 0; i < (int)nnz; i++)
{
if (val[i] != i * factor)
{
bcsr_config.copy_failed = FAILURE;
return;
}
val[i] *= -1;
}
#if 0
/* TODO */
/* Check colind */
uint32_t *col = STARPU_BCSR_GET_COLIND(buffers[0]);
for (i = 0; i < NNZ_BLOCKS; i++)
if (col[i] != colind[i])
bcsr_config.copy_failed = FAILURE;
/* Check rowptr */
uint32_t *row = STARPU_BCSR_GET_ROWPTR(buffers[0]);
for (i = 0; i < 1 + WIDTH/R; i++)
if (row[i] != rowptr[i])
bcsr_config.copy_failed = FAILURE;
#endif
}
int
main(int argc, char **argv)
{
data_interface_test_summary *summary;
struct starpu_conf conf;
starpu_conf_init(&conf);
conf.ncuda = 2;
conf.nopencl = 1;
conf.nmic = -1;
if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
return STARPU_TEST_SKIPPED;
register_data();
summary = run_tests(&bcsr_config);
if (!summary)
exit(EXIT_FAILURE);
unregister_data();
starpu_shutdown();
data_interface_test_summary_print(stderr, summary);
return data_interface_test_summary_success(summary);
}
|
/*
* Copyright (C) 2014 Martin Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup pktbuf Packet buffer
* @ingroup net
* @brief A global network packet buffer.
* @{
*
* @file pktbuf.h
* @brief Interface definition for the global network buffer. Network devices
* and layers can allocate space for packets here.
*
* @note **WARNING!!** Do not store data structures that are not packed
* (defined with `__attribute__((packed))`) or enforce alignment in
* in any way in here. On some RISC architectures this *will* lead to
* alignment problems and can potentially result in segmentation/hard
* faults and other unexpected behaviour.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef __PKTBUF_H_
#define __PKTBUF_H_
#include <stdlib.h>
#include "cpu-conf.h"
#ifndef PKTBUF_SIZE
/**
* @brief Maximum size of the packet buffer.
*
* @detail The rational here is to have at least space for 4 full-MTU IPv6
* packages (2 incoming, 2 outgoing; 2 * 2 * 1280 B = 5 KiB) +
* Meta-Data (roughly estimated to 1 KiB; might be smaller)
*/
#define PKTBUF_SIZE (6144)
#endif /* PKTBUF_SIZE */
/**
* @brief Allocates new packet data in the packet buffer. This also marks the
* allocated data as processed.
*
* @see @ref pktbuf_hold()
*
* @param[in] size The length of the packet you want to allocate
*
* @return Pointer to the start of the data in the packet buffer, on success.
* @return NULL, if no space is left in the packet buffer or size was 0.
*/
void *pktbuf_alloc(size_t size);
/**
* @brief Reallocates new space in the packet buffer, without changing the
* content.
*
* @datail If enough memory is available behind it or *size* is smaller than
* the original size the packet will not be moved. Otherwise, it will
* be moved. If no space is available nothing happens.
*
* @param[in] pkt Old position of the packet in the packet buffer
* @param[in] size New amount of data you want to allocate
*
* @return Pointer to the (maybe new) position of the packet in the packet buffer,
* on success.
* @return NULL, if no space is left in the packet buffer or size was 0.
* The packet will remain at *ptr*.
*/
void *pktbuf_realloc(const void *pkt, size_t size);
/**
* @brief Allocates and copies new packet data into the packet buffer.
* This also marks the allocated data as processed for the current
* thread.
*
* @see @ref pktbuf_hold()
*
* @param[in] data Data you want to copy into the new packet.
* @param[in] size The length of the packet you want to allocate
*
* @return Pointer to the start of the data in the packet buffer, on success.
* @return NULL, if no space is left in the packet buffer.
*/
void *pktbuf_insert(const void *data, size_t size);
/**
* @brief Copies packet data into the packet buffer, safely.
*
* @detail Use this instead of memcpy, since it is thread-safe and checks if
* *pkt* is
*
* -# in the buffer at all
* -# its *size* is smaller or equal to the data allocated at *pkt*
*
* If the *pkt* is not in the buffer the data is just copied as
* memcpy would do.
*
* @param[in,out] pkt The packet you want to set the data for.
* @param[in] data The data you want to copy into the packet.
* @param[in] data_len The length of the data you want to copy.
*
* @return *data_len*, on success.
* @return -EFAULT, if *data* is NULL and DEVELHELP is defined.
* @return -EINVAL, if *pkt* is NULL and DEVELHELP is defined.
* @return -ENOBUFS, if *data_len* was greater than the packet size of *pkt*.
*/
int pktbuf_copy(void *pkt, const void *data, size_t data_len);
/**
* @brief Marks the data as being processed.
*
* @detail Internally this increments just a counter on the data.
* @ref pktbuf_release() decrements it. If the counter is <=0 the
* reserved data block in the buffer will be made available again.
*
* @param[in] pkt The packet you want mark as being processed.
*/
void pktbuf_hold(const void *pkt);
/**
* @brief Marks the data as not being processed.
*
* @param[in] pkt The packet you want mark as not being processed anymore.
*
* @detail Internally this decrements just a counter on the data.
* @ref pktbuf_hold() increments and any allocation
* operation initializes it. If the counter is <=0 the reserved data
* block in the buffer will be made available again.
*/
void pktbuf_release(const void *pkt);
/**
* @brief Prints current packet buffer to stdout if DEVELHELP is defined.
*/
#ifdef DEVELHELP
void pktbuf_print(void);
#else
#define pktbuf_print() ;
#endif
/* for testing */
#ifdef TEST_SUITES
/**
* @brief Counts the number of allocated bytes
*
* @return Number of allocated bytes
*/
size_t pktbuf_bytes_allocated(void);
/**
* @brief Counts the number of allocated packets
*
* @return Number of allocated packets
*/
size_t pktbuf_packets_allocated(void);
/**
* @brief Checks if packet buffer is empty
*
* @return 1, if packet buffer is empty
* @return 0, if packet buffer is not empty
*/
int pktbuf_is_empty(void);
/**
* @brief Checks if a given pointer is stored in the packet buffer
*
* @param[in] pkt Pointer to be checked
*
* @return 1, if *pkt* is in packet buffer
* @return 0, otherwise
*/
int pktbuf_contains(const void *pkt);
/**
* @brief Sets the whole packet buffer to 0
*/
void pktbuf_reset(void);
#endif
#endif /* __PKTBUF_H_ */
/** @} */
|
/*******************************************************************************
* Copyright © 2014, Sergey Radionov <rsatom_gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef QMLVLCMMPLAYER_H
#define QMLVLCMMPLAYER_H
#include "QmlVlcPlayerProxy.h"
#include "QmlVlcMmVideoOutput.h"
class QmlVlcMmPlayer
: public QmlVlcPlayerProxy
{
Q_OBJECT
public:
explicit QmlVlcMmPlayer( QObject* parent = 0 );
~QmlVlcMmPlayer();
Q_PROPERTY( QAbstractVideoSurface* videoSurface READ videoSurface WRITE setVideoSurface )
QAbstractVideoSurface* videoSurface() const
{ return m_videoOutput.videoSurface(); }
void setVideoSurface( QAbstractVideoSurface* s )
{ m_videoOutput.setVideoSurface( s ); }
private:
libvlc_instance_t* m_libvlc;
vlc::player m_player;
QmlVlcMmVideoOutput m_videoOutput;
};
#endif // QMLVLCMMPLAYER_H
|
/*************************************************************************
* Copyright (c) <2013, 2014> SAF TEHNIKA JSC (www.saftehnika.com)
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* For any questions or requests please contact: SW_LIC (at) SAFTEHNIKA.COM
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <libfmt.h>
#define A(x) assert((x) >= 0)
__attribute__ ((format (printf, 1, 2)))
void resultf(const char *fmt, ...)
{
static FILE *result_fd;
if (!result_fd)
result_fd = fopen("result", "w+");
assert(result_fd != NULL);
va_list ap;
va_start(ap, fmt);
A( vfprintf(result_fd, fmt, ap) );
va_end(ap);
}
int tok_arr_size[] = {0, 1, 9, 10, 11, /* Some small values */
25, 26, 27, /* Some values around actual count */
100, 1000, /* Some great values */
LIBFMT_TOK_COUNT_MAX};
void parse(int size)
{
resultf("Parser size: %d\n", size);
fmt_t p;
A( fmt_load_file("file.json", &p, 0) );
fmt_tok_t tok_T0, tok_T1, iter;
A( fmt_get_tok(&p, NULL, "T0", &tok_T0) );
A( fmt_get_tok(&p, &tok_T0, "T1", &tok_T1) );
memset(&iter, 0, sizeof(fmt_tok_t));
while(fmt_array_next(&p, &tok_T1, &iter) > 0) {
char *str;
A( fmt_dump_string(&p, &iter, &str) );
resultf("%s\n", str);
free(str);
}
A( fmt_free(&p) );
}
int main()
{
int i;
for (i = 0; i < sizeof(tok_arr_size) / sizeof(int); i++)
parse(tok_arr_size[i]);
return 0;
}
|
/******************************************************************************\
This file is part of the C! library. A.K.A the cbang library.
Copyright (c) 2003-2015, Cauldron Development LLC
Copyright (c) 2003-2015, Stanford University
All rights reserved.
The C! library is free software: you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation, either version 2.1 of
the License, or (at your option) any later version.
The C! library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the C! library. If not, see
<http://www.gnu.org/licenses/>.
In addition, BSD licensing may be granted on a case by case basis
by written permission from at least one of the copyright holders.
You may request written permission by emailing the authors.
For information regarding this software email:
Joseph Coffland
joseph@cauldrondevelopment.com
\******************************************************************************/
#ifndef CB_ASTNODE_H
#define CB_ASTNODE_H
#include "Tokenizer.h"
#include <cbang/SmartPointer.h>
#include <ostream>
#include <vector>
namespace cb {
template <typename ENUM_T>
class ASTNode {
ENUM_T type;
LocationRange location;
public:
ASTNode(ENUM_T type) : type(type) {}
virtual ~ASTNode() {} // Compiler needs this
ENUM_T getType() const {return type;}
void setType(ENUM_T type) {this->type = type;}
LocationRange &getLocation() const {return location;}
LocationRange &getLocation() {return location;}
};
}
#endif // CB_ASTNODE_H
|
//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// QUESO - a library to support the Quantification of Uncertainty
// for Estimation, Simulation and Optimization
//
// Copyright (C) 2008-2015 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301 USA
//
//-----------------------------------------------------------------------el-
#ifndef UQ_GAMMA_VECTOR_RV_H
#define UQ_GAMMA_VECTOR_RV_H
#include <queso/VectorRV.h>
#include <queso/VectorSpace.h>
#include <queso/JointPdf.h>
#include <queso/VectorRealizer.h>
#include <queso/VectorCdf.h>
#include <queso/VectorMdf.h>
#include <queso/SequenceOfVectors.h>
#include <queso/InfoTheory.h>
namespace QUESO {
class GslVector;
class GslMatrix;
//*****************************************************
// Gamma class [RV-06]
//*****************************************************
/*!
* \class GammaVectorRV
* \brief A class representing a vector RV constructed via Gamma distribution.
*
* This class allows the user to compute the value of a Gamma PDF and to generate realizations
* (samples) from it.\n
*
* The gamma probability density function for a given value x and given pair of parameters
* \b a and \b b is:
* \f[ y=f(x|a,b)= \frac{1}{b^{a}\Gamma(a)} x^{a-1} e^{\frac{x}{b}}, \f]
* where \f$ \Gamma(.) \f$ is the Gamma function:
* \f[ B(a,b)=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}=\frac{(a-1)!(b-1)!}{(a+b-1)!}.\f]
* The parameters \b a and \b b must all be positive, and the values \c x must lie on the
* interval \f$ (0, \infty)\f$. */
template <class V = GslVector, class M = GslMatrix>
class GammaVectorRV : public BaseVectorRV<V,M> {
public:
//! @name Constructor/Destructor methods
//@{
//! Default Constructor
/*! Construct a Gamma vector RV with parameters \c a>0 and \c b>0, whose variates live in \c imageSet.
* The constructor will check whether or not the data provided via \c imageSet belongs to
* \f$ (0, \infty)\f$, which is a requirement imposed by the Gamma distribution. If this condition
* is not satisfied, an error message will be displayed and the program will exit. */
GammaVectorRV(const char* prefix,
const VectorSet<V,M>& imageSet,
const V& a,
const V& b);
//! Virtual destructor
virtual ~GammaVectorRV();
//@}
//! @name I/O methods
//@{
//! TODO: Prints the vector RV.
/*! \todo: implement me!*/
void print(std::ostream& os) const;
//@}
private:
using BaseVectorRV<V,M>::m_env;
using BaseVectorRV<V,M>::m_prefix;
using BaseVectorRV<V,M>::m_imageSet;
using BaseVectorRV<V,M>::m_pdf;
using BaseVectorRV<V,M>::m_realizer;
using BaseVectorRV<V,M>::m_subCdf;
using BaseVectorRV<V,M>::m_unifiedCdf;
using BaseVectorRV<V,M>::m_mdf;
};
} // End namespace QUESO
#endif // UQ_GAMMA_VECTOR_RV_H
|
/***************************************************************************
* Copyright (C) 2005-2019 by the FIFE team *
* http://www.fifengine.net *
* This file is part of FIFE. *
* *
* FIFE is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef FIFE_GUI_LIBROCKETINPUTPROCESSOR_H
#define FIFE_GUI_LIBROCKETINPUTPROCESSOR_H
// Standard C++ library includes
#include <map>
// 3rd party library includes
#include <Rocket/Core/Input.h>
#include <Rocket/Core/Types.h>
#include <SDL_events.h>
// FIFE includes
// These includes are split up in two parts, separated by one empty line
// First block: files included from the FIFE root src directory
// Second block: files included from the same folder
#include "util/base/fife_stdint.h"
namespace Rocket {
namespace Core {
class Context;
}
}
namespace FIFE {
class LibRocketInputProcessor {
public:
/** Constructor
*/
LibRocketInputProcessor(Rocket::Core::Context* context);
/** Destructor
*/
~LibRocketInputProcessor();
/** Processes SDL input and converts it to librocket input, then forwards it to
* the librocket context.
*
* NOTE There is no way to get, if an event is consumed by Rocket currently.
* This is for in case it gets implemented in the future.
*
* @param evt The SDL input.
* @return A boolean value indicating if the event was consumed by librocket or not.
*/
bool onSdlEvent(SDL_Event &evt);
/**
* Called each frame to perform update operations.
*/
void turn();
private:
/** Updates the key mod state bitmask.
*/
void updateKeyModState();
/** Process a mouse motion event.
*/
bool processMouseMotion(SDL_Event& event);
/** Process a mouse input event.
*/
bool processMouseInput(SDL_Event& event);
/** Process a mouse wheel motion event.
*/
bool processMouseWheelMotion(SDL_Event& event);
/** Process a key input event.
*/
bool processKeyInput(SDL_Event& event);
/** Process a text input event.
*/
bool processTextInput(SDL_Event& event);
/** Creates the key map.
*/
void populateKeyMap();
/** Reference to librocket's context.
*/
Rocket::Core::Context* m_context;
/** Bitmask that stores key modifiers.
*/
uint32_t m_keyModState;
/** Counts how many times the wheel has been moved. Negative
* value means that the wheel has been moved abs(m_wheelCounter) upwards,
* positive value means that the wheel has been moved m_wheelCounter times downwards.
*/
int32_t m_wheelCounter;
/** Keymap to convert SDL key to Librocket key.
*/
std::map<SDL_Keycode, Rocket::Core::Input::KeyIdentifier> m_keyMap;
};
};
#endif //FIFE_GUI_LIBROCKETINPUTPROCESSOR_H |
#ifndef SVSETWATERHEIGHTINLETBC_H
#define SVSETWATERHEIGHTINLETBC_H
#include "IntegratedBC.h"
#include "Function.h"
// Forward Declarations
class SVSetWaterHeightInletBC;
class HydrostaticPressure;
template<>
InputParameters validParams<SVSetWaterHeightInletBC>();
/**
**/
class SVSetWaterHeightInletBC : public IntegratedBC
{
public:
SVSetWaterHeightInletBC(const InputParameters & parameters);
virtual ~SVSetWaterHeightInletBC(){}
protected:
virtual Real computeQpResidual();
virtual Real computeQpJacobian();
virtual Real computeQpOffDiagJacobian(unsigned jvar);
// Equation type
enum EquationType
{
CONTINUITY = 0,
X_MOMENTUM = 1,
Y_MOMENTUM = 2
};
MooseEnum _equ_type;
// Coupled variables
VariableValue & _q_x;
// Constants and parameters
Real _h_bc;
Real _u_bc;
// Equation of state
const HydrostaticPressure & _eos;
// Integers for jacobian terms
unsigned _q_x_var;
// boolean
bool _is_u_bc_specified;
};
#endif // SVSETWATERHEIGHTINLETBC_H
|
/*
* Copyright (C) 2012, 2013 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. ``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
* 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 GetByIdStatus_h
#define GetByIdStatus_h
#include "IntendedStructureChain.h"
#include "PropertyOffset.h"
#include "StructureSet.h"
#include <wtf/NotFound.h>
namespace JSC {
class CodeBlock;
class GetByIdStatus {
public:
enum State {
NoInformation, // It's uncached so we have no information.
Simple, // It's cached for a simple access to a known object property with
// a possible structure chain and a possible specific value.
TakesSlowPath, // It's known to often take slow path.
MakesCalls // It's known to take paths that make calls.
};
GetByIdStatus()
: m_state(NoInformation)
, m_offset(invalidOffset)
{
}
explicit GetByIdStatus(State state)
: m_state(state)
, m_offset(invalidOffset)
{
ASSERT(state == NoInformation || state == TakesSlowPath || state == MakesCalls);
}
GetByIdStatus(
State state, bool wasSeenInJIT, const StructureSet& structureSet = StructureSet(),
PropertyOffset offset = invalidOffset, JSValue specificValue = JSValue(), PassRefPtr<IntendedStructureChain> chain = 0)
: m_state(state)
, m_structureSet(structureSet)
, m_chain(chain)
, m_specificValue(specificValue)
, m_offset(offset)
, m_wasSeenInJIT(wasSeenInJIT)
{
ASSERT((state == Simple) == (offset != invalidOffset));
}
static GetByIdStatus computeFor(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
static GetByIdStatus computeFor(VM&, Structure*, StringImpl* uid);
State state() const { return m_state; }
bool isSet() const { return m_state != NoInformation; }
bool operator!() const { return !isSet(); }
bool isSimple() const { return m_state == Simple; }
bool takesSlowPath() const { return m_state == TakesSlowPath || m_state == MakesCalls; }
bool makesCalls() const { return m_state == MakesCalls; }
const StructureSet& structureSet() const { return m_structureSet; }
IntendedStructureChain* chain() const { return const_cast<IntendedStructureChain*>(m_chain.get()); } // Returns null if this is a direct access.
JSValue specificValue() const { return m_specificValue; } // Returns JSValue() if there is no specific value.
PropertyOffset offset() const { return m_offset; }
bool wasSeenInJIT() const { return m_wasSeenInJIT; }
private:
static void computeForChain(GetByIdStatus& result, CodeBlock*, StringImpl* uid);
static GetByIdStatus computeFromLLInt(CodeBlock*, unsigned bytecodeIndex, StringImpl* uid);
State m_state;
StructureSet m_structureSet;
RefPtr<IntendedStructureChain> m_chain;
JSValue m_specificValue;
PropertyOffset m_offset;
bool m_wasSeenInJIT;
};
} // namespace JSC
#endif // PropertyAccessStatus_h
|
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
Part of Core Audio AUInstrument Base Classes
*/
#ifndef __SynthNoteList__
#define __SynthNoteList__
#include "SynthNote.h"
#if DEBUG
#ifndef DEBUG_PRINT
#define DEBUG_PRINT 0
#endif
#define USE_SANITY_CHECK 0
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct SynthNoteList
{
SynthNoteList() : mState(kNoteState_Unset), mHead(0), mTail(0) {}
bool NotEmpty() const { return mHead != NULL; }
bool IsEmpty() const { return mHead == NULL; }
void Empty() {
#if USE_SANITY_CHECK
SanityCheck();
#endif
mHead = mTail = NULL;
}
UInt32 Length() const {
#if USE_SANITY_CHECK
SanityCheck();
#endif
UInt32 length = 0;
for (SynthNote* note = mHead; note; note = note->mNext)
length++;
return length;
};
void AddNote(SynthNote *inNote)
{
#if DEBUG_PRINT
printf("AddNote(inNote=%p) to state: %u\n", inNote, mState);
#endif
#if USE_SANITY_CHECK
SanityCheck();
#endif
inNote->SetState(mState);
inNote->mNext = mHead;
inNote->mPrev = NULL;
if (mHead) { mHead->mPrev = inNote; mHead = inNote; }
else mHead = mTail = inNote;
#if USE_SANITY_CHECK
SanityCheck();
#endif
}
void RemoveNote(SynthNote *inNote)
{
#if DEBUG_PRINT
printf("RemoveNote(inNote=%p) from state: %u\n", inNote, mState);
#endif
#if USE_SANITY_CHECK
SanityCheck();
#endif
if (inNote->mPrev) inNote->mPrev->mNext = inNote->mNext;
else mHead = inNote->mNext;
if (inNote->mNext) inNote->mNext->mPrev = inNote->mPrev;
else mTail = inNote->mPrev;
inNote->mPrev = 0;
inNote->mNext = 0;
#if USE_SANITY_CHECK
SanityCheck();
#endif
}
void TransferAllFrom(SynthNoteList *inNoteList, UInt32 inFrame)
{
#if DEBUG_PRINT
printf("TransferAllFrom: from state %u into state %u\n", inNoteList->mState, mState);
#endif
#if USE_SANITY_CHECK
SanityCheck();
inNoteList->SanityCheck();
#endif
if (!inNoteList->mTail) return;
if (mState == kNoteState_Released)
{
for (SynthNote* note = inNoteList->mHead; note; note = note->mNext)
{
#if DEBUG_PRINT
printf("TransferAllFrom: releasing note %p\n", note);
#endif
note->Release(inFrame);
note->SetState(mState);
}
}
else
{
for (SynthNote* note = inNoteList->mHead; note; note = note->mNext)
{
note->SetState(mState);
}
}
inNoteList->mTail->mNext = mHead;
if (mHead) mHead->mPrev = inNoteList->mTail;
else mTail = inNoteList->mTail;
mHead = inNoteList->mHead;
inNoteList->mHead = NULL;
inNoteList->mTail = NULL;
#if USE_SANITY_CHECK
SanityCheck();
inNoteList->SanityCheck();
#endif
}
SynthNote* FindOldestNote()
{
#if DEBUG_PRINT
printf("FindOldestNote\n");
#endif
#if USE_SANITY_CHECK
SanityCheck();
#endif
UInt64 minStartFrame = -1;
SynthNote* oldestNote = NULL;
for (SynthNote* note = mHead; note; note = note->mNext)
{
if (note->mAbsoluteStartFrame < minStartFrame)
{
oldestNote = note;
minStartFrame = note->mAbsoluteStartFrame;
}
}
return oldestNote;
}
SynthNote* FindMostQuietNote()
{
#if DEBUG_PRINT
printf("FindMostQuietNote\n");
#endif
Float32 minAmplitude = 1e9f;
UInt64 minStartFrame = -1;
SynthNote* mostQuietNote = NULL;
for (SynthNote* note = mHead; note; note = note->mNext)
{
Float32 amp = note->Amplitude();
#if DEBUG_PRINT
printf(" amp %g minAmplitude %g\n", amp, minAmplitude);
#endif
if (amp < minAmplitude)
{
mostQuietNote = note;
minAmplitude = amp;
minStartFrame = note->mAbsoluteStartFrame;
}
else if (amp == minAmplitude && note->mAbsoluteStartFrame < minStartFrame)
{
// use earliest start time as a tie breaker
mostQuietNote = note;
minStartFrame = note->mAbsoluteStartFrame;
}
}
#if USE_SANITY_CHECK
SanityCheck();
#endif
return mostQuietNote;
}
void SanityCheck() const;
SynthNoteState mState;
SynthNote * mHead;
SynthNote * mTail;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
|
// -*- C++ -*-
// $Id: spec.h,v 1.1 2004/10/13 16:16:11 linha2 Exp $
// id3lib: a software library for creating and manipulating id3v1/v2 tags
// Copyright 1999, 2000 Scott Thomas Haug
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
// License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with this library; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// The id3lib authors encourage improvements and optimisations to be sent to
// the id3lib coordinator. Please see the README file for details on where to
// send such submissions. See the AUTHORS file for a list of people who have
// contributed to id3lib. See the ChangeLog file for a list of changes to
// id3lib. These files are distributed with id3lib at
// http://download.sourceforge.net/id3lib/
#ifndef _ID3LIB_SPEC_H_
#define _ID3LIB_SPEC_H_
#include "globals.h"
ID3_V2Spec ID3_VerRevToV2Spec(uchar ver, uchar rev);
uchar ID3_V2SpecToVer(ID3_V2Spec spec);
uchar ID3_V2SpecToRev(ID3_V2Spec spec);
#endif /* _ID3LIB_SPEC_H_ */
|
#pragma once
#include <windows.h>
typedef struct {
BYTE bID[4]; // wb_
DWORD dSize; // TCY
} RIFF_HED;
typedef struct {
BYTE bID[4];
BYTE bFMT[4];
DWORD dChunkSize;
WORD wFmt;
WORD wChannels;
DWORD dRate;
DWORD dDataRate;
WORD wBlockSize;
WORD wSample;
} WAVE_CHUNK;
typedef struct {
BYTE bID[4];
DWORD dSize;
BYTE bData[1];
} DATA_CHUNK;
class Adpcm{
private:
RIFF_HED *m_pRiffHed;
WAVE_CHUNK *m_pWaveChunk;
DATA_CHUNK *m_pDataChunk;
public:
Adpcm();
~Adpcm();
BYTE* waveToAdpcm(void *pData, DWORD dSize, DWORD &dAdpcmSize, DWORD dHiRate);
short* resampling(DWORD &dSize, DWORD dHiRate);
int encode(short *pSrc, unsigned char *pDis, DWORD iSampleSize);
};
|
/*
* frw_gpio_sysfs_internal.h
*
* Created on: Oct 6, 2015
* Author: dev
*/
#ifndef LIB_FRW_LINUX_FRW_GPIO_SYSFS_INTERNAL_H_
#define LIB_FRW_LINUX_FRW_GPIO_SYSFS_INTERNAL_H_
typedef struct{
int pinNum;
int handle;
}FRW_GPIO_DEVICE_INTERNAL;
#endif /* LIB_FRW_LINUX_FRW_GPIO_SYSFS_INTERNAL_H_ */
|
/*
* Copyright (C) 2011-2014 Morwenn
*
* POLDER 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.
*
* POLDER is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not,
* see <http://www.gnu.org/licenses/>.
*/
/**
* @file POLDER/geometry/distance.h
* @brief Distance between geometric entities.
*
* The distances can be computed for every norm of
* the module POLDER/math/norm.h which are to be passed
* as tag types to the functions.
*
* By default the euclidean norm is used, or the P norm
* if an additional unsigned parameter is passed to the
* function (and if an overload is provided).
*/
#ifndef _POLDER_GEOMETRY_DISTANCE_H
#define _POLDER_GEOMETRY_DISTANCE_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cmath>
#include <POLDER/geometry/point.h>
#include <POLDER/math/norm.h>
namespace polder
{
namespace geometry
{
////////////////////////////////////////////////////////////
// Distance between
// - Point
// - Point
template<typename Norm=math::norm::euclidean,
std::size_t N, typename T>
auto distance(const Point<N, T>& p1, const Point<N, T>& p2)
-> T;
template<typename Norm=math::norm::p,
std::size_t N, typename T>
auto distance(const Point<N, T>& p1, const Point<N, T>& p2, unsigned p)
-> T;
////////////////////////////////////////////////////////////
// Distance between
// - Point
// - Hypersphere
template<typename Norm=math::norm::euclidean,
std::size_t N, typename T>
auto distance(const Point<N, T>& p, const Hypersphere<N, T>& h)
-> T;
template<typename Norm=math::norm::euclidean,
std::size_t N, typename T>
auto distance(const Hypersphere<N, T>& h, const Point<N, T>& p)
-> T;
#include "details/distance.inl"
}}
#endif // _POLDER_GEOMETRY_DISTANCE_H
|
/****************************************************************************
**
** Copyright (C) 2015 Cabieces Julien
** Contact: https://github.com/troopa81/Qats
**
** This file is part of Qats.
**
** Qats 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.
**
** Qats 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 Qats. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef QATS_CLIENT_H
#define QATS_CLIENT_H
#include <QLocalSocket>
#include "Qats.h"
namespace qats
{
class QATS_EXPORT Client : public QLocalSocket
{
Q_OBJECT
public:
Client( QObject* parent = 0 );
~Client();
protected slots:
void onMessageReceived();
};
}
#endif
|
// Created file "Lib\src\Uuid\X64\i_dxtmsft"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(CLSID_DXTChroma, 0x421516c1, 0x3cf8, 0x11d2, 0x95, 0x2a, 0x00, 0xc0, 0x4f, 0xa3, 0x4f, 0x05);
|
// Created file "Lib\src\ehstorguids\X64\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(PKEY_Contact_HomeAddressStreet, 0x0adef160, 0xdb3f, 0x4308, 0x9a, 0x21, 0x06, 0x23, 0x7b, 0x16, 0xfa, 0x2a);
|
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2009, Willow Garage, 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 the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
/*!
*\author Kevin Watts
*/
#ifndef DIAGNOSTIC_AGGREGATOR_H
#define DIAGNOSTIC_AGGREGATOR_H
#include <ros/ros.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <boost/shared_ptr.hpp>
#include <diagnostic_msgs/DiagnosticArray.h>
#include <diagnostic_msgs/DiagnosticStatus.h>
#include <diagnostic_msgs/KeyValue.h>
#include "XmlRpcValue.h"
#include "diagnostic_aggregator/analyzer.h"
#include "diagnostic_aggregator/analyzer_group.h"
#include "diagnostic_aggregator/status_item.h"
#include "diagnostic_aggregator/other_analyzer.h"
#include <std_msgs/String.h>
namespace diagnostic_aggregator {
/*!
*\brief Aggregator processes /diagnostics, republishes on /diagnostics_agg
*
* Aggregator is a node that subscribes to /diagnostics, processes it
* and republishes aggregated data on /diagnostics_agg. The aggregator
* creates a series of analyzers according to the specifications of its
* private parameters. The aggregated diagnostics data is organized
* in a tree structure. For example:
\verbatim
Input (status names):
tilt_hokuyo_node: Frequency
tilt_hokuyo_node: Connection
Output:
/Robot
/Robot/Sensors
/Robot/Sensors/Tilt Hokuyo/Frequency
/Robot/Sensors/Tilt Hokuyo/Connection
\endverbatim
* The analyzer should always output a DiagnosticStatus with the name of the
* prefix. Any other data output is up to the analyzer developer.
*
* Analyzer's are loaded by specifying the private parameters of the
* aggregator.
\verbatim
base_path: My Robot
pub_rate: 1.0
analyzers:
sensors:
type: GenericAnalyzer
path: Tilt Hokuyo
find_and_remove_prefix: tilt_hokuyo_node
motors:
type: PR2MotorsAnalyzer
joints:
type: PR2JointsAnalyzer
\endverbatim
* Each analyzer is created according to the "type" parameter in its namespace.
* Any other parametes in the namespace can by used to specify the analyzer. If
* any analyzer is not properly specified, or returns false on initialization,
* the aggregator will report the error and publish it in the aggregated output.
*/
class Aggregator
{
public:
/*!
*\brief Constructor initializes with main prefix (ex: '/Robot')
*/
Aggregator();
~Aggregator();
/*!
*\brief Processes, publishes data. Should be called at pub_rate.
*/
void publishData();
/*!
*\brief True if the NodeHandle reports OK
*/
bool ok() const { return n_.ok(); }
/*!
*\brief Publish rate defaults to 1Hz, but can be set with ~pub_rate param
*/
double getPubRate() const { return pub_rate_; }
private:
ros::NodeHandle n_;
ros::Subscriber diag_sub_; /**< DiagnosticArray, /diagnostics */
ros::Publisher agg_pub_; /**< DiagnosticArray, /diagnostics_agg */
ros::Publisher toplevel_state_pub_; /**< DiagnosticStatus, /diagnostics_toplevel_state */
ros::Subscriber deactivate_diag_sub; /**< std_msg String, /diagnostics_deactivate */
double pub_rate_;
/*!
*\brief Callback for incoming "/diagnostics"
*/
void diagCallback(const diagnostic_msgs::DiagnosticArray::ConstPtr& diag_msg);
/*!
* \brief Callback to deactivate diagnosis for a item name
*/
void deactivateCallback(const std_msgs::String::ConstPtr& msg);
AnalyzerGroup* analyzer_group_;
OtherAnalyzer* other_analyzer_;
std::string base_path_; /**< \brief Prepended to all status names of aggregator. */
std::set<std::string> ros_warnings_; /**< \brief Records all ROS warnings. No warnings are repeated. */
/*
*!\brief Checks timestamp of message, and warns if timestamp is 0 (not set)
*/
void checkTimestamp(const diagnostic_msgs::DiagnosticArray::ConstPtr& diag_msg);
};
}
#endif // DIAGNOSTIC_AGGREGATOR_H
|
#ifndef UISCENECONTAINER_H
#define UISCENECONTAINER_H
#include <vector>
#include "Bang/Array.tcc"
#include "Bang/BangDefines.h"
#include "Bang/EventEmitter.tcc"
#include "Bang/EventListener.h"
#include "Bang/GameObject.h"
#include "Bang/IEvents.h"
#include "Bang/IEventsFocus.h"
#include "Bang/IEventsTransform.h"
#include "Bang/IEventsValueChanged.h"
#include "Bang/RenderPass.h"
#include "BangEditor/BangEditor.h"
namespace Bang
{
class Camera;
class IEventsDestroy;
class IEventsTransform;
class IEventsValueChanged;
class Scene;
class Texture2D;
class UIFocusable;
class UIImageRenderer;
template <class>
class EventEmitter;
}
using namespace Bang;
namespace BangEditor
{
class UISceneImage;
class UISceneToolbar;
class UISceneToolbarDown;
class UISceneContainer : public GameObject,
public EventListener<IEventsFocus>,
public EventListener<IEventsValueChanged>,
public EventListener<IEventsTransform>,
public EventListener<IEventsDestroy>
{
public:
UISceneContainer();
virtual ~UISceneContainer() override;
// GameObject
void BeforeChildrenRender(RenderPass rp) override;
void RenderContainedSceneIfNeeded();
void SetScene(Scene *scene);
Scene *GetContainedScene() const;
AARect GetSceneImageAARectNDC() const;
UISceneToolbar *GetSceneToolbar() const;
UISceneImage *GetSceneImage() const;
UIFocusable *GetFocusable() const;
UISceneToolbarDown *GetSceneToolbarDown() const;
protected:
UISceneToolbar *p_sceneToolbar = nullptr;
// IEventsDestroy
void OnDestroyed(EventEmitter<IEventsDestroy> *object) override;
// IEventsFocus
UIEventResult OnUIEvent(UIFocusable *focusable,
const UIEvent &event) override;
private:
UIFocusable *p_focusable = nullptr;
UIImageRenderer *p_border = nullptr;
Scene *p_containedScene = nullptr;
UISceneToolbarDown *p_sceneToolbarDown = nullptr;
UISceneImage *p_sceneImage = nullptr;
GameObject *p_noCameraOverlay = nullptr;
virtual Camera *GetSceneCamera(Scene *scene) = 0;
virtual bool NeedsToRenderContainedScene(Scene *scene) = 0;
virtual void OnRenderContainedSceneBegin();
virtual void OnRenderContainedSceneFinished();
// IEventsTransform
void OnTransformChanged() override;
// IEventsValueChanged
void OnValueChanged(EventEmitter<IEventsValueChanged> *object) override;
};
}
#endif // UISCENECONTAINER_H
|
// Created file "Lib\src\Uuid\X64\i_iebroker"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(IID_IEDropSourceWrapper, 0xc74aff92, 0x5b45, 0x477b, 0x86, 0x30, 0x61, 0xd5, 0xcb, 0xed, 0x41, 0x6a);
|
//GPL2 siraj@kde.org
#ifndef WELLCOME_ITEM_H
#define WELLCOME_ITEM_H
#include <config.h>
#include <plexy.h>
#include <desktopwidget.h>
#include <QtGui>
#include <QtCore>
#include <qimageblitz.h>
class WellcomeItem:public QObject, public QGraphicsRectItem
{
Q_OBJECT
public:
typedef enum { REGULAR,OVER,PRESSED } MouseState;
typedef QHash <MouseState,QString> ThemeNames;
WellcomeItem(const QRectF &rect,QGraphicsItem * parent = 0);
virtual ~WellcomeItem();
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
// void paintExtDockFace( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0){}
bool isEmpty() const {return false;}
QString name() const ;
void setName(const QString& name);
void setOpacity(float op);
void setIcon(const QPixmap &icon);
public slots:
void zoom(int step);
signals:
void clicked();
protected:
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
protected:
QImage reflection(QImage& src);
void paintItem(QPainter * painter,const QRectF );
// void paintItemRef(QPainter * painter,const QRectF);
private:
QString loadSvg(MouseState state);
class Private;
Private * const d ;
};
#endif
|
// Created file "Lib\src\dxguid\X64\dxguid"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(PPM_THERMALCONSTRAINT_GUID, 0xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88);
|
// Created file "Lib\src\WindowsSideShowGuids\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(MACHINE_POLICY_PRESENT_GUID, 0x659fcae6, 0x5bdb, 0x4da9, 0xb1, 0xff, 0xca, 0x2a, 0x17, 0x8d, 0x46, 0xe0);
|
/*
Copyright (C) 2009 - 2011 Gaetan Guidet
This file is part of gmath.
gmath 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.
gmath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
*/
#ifndef __gmath_gmath_
#define __gmath_gmath_
#include <gmath/config.h>
#include <gmath/vector.h>
#include <gmath/matrix.h>
#include <gmath/quat.h>
#include <gmath/euler.h>
#include <gmath/convert.h>
#include <gmath/plane.h>
#include <gmath/ray.h>
#include <gmath/box.h>
#include <gmath/aabox.h>
#include <gmath/obox.h>
#include <gmath/frustum.h>
#include <gmath/sphere.h>
#include <gmath/polynomial.h>
#include <gmath/integration.h>
#include <gmath/linsys.h>
#include <gmath/convexhull2D.h>
#include <gmath/convexhull3D.h>
#include <gmath/nurbs.h>
#include <gmath/complex.h>
#include <gmath/curve.h>
#include <gmath/fft.h>
#include <gmath/color.h>
#include <gmath/params.h>
#endif
|
#ifndef FK_LIST_H
#define FK_LIST_H
#include <stdlib.h>
#include <stdbool.h>
typedef struct list_node {
void *data;
struct list_node *prev;
struct list_node *next;
} list_node;
typedef struct List {
list_node *head;
list_node *cur;
list_node *tail;
size_t size;
} List;
bool list_is_empty(List *self);
int list_size(List *self);
void list_reset(List *self);
bool list_insert(List *self, int index, void *node);
bool list_delete(List *self, int index);
void list_push_back(List *self, void *node);
void list_push_front(List *self, void *node);
void *list_pop_back(List *self);
void *list_pop_front(List *self);
void *list_get_back(List *self);
void *list_get_front(List *self);
bool list_has_cur(List *self);
void *list_get_cur(List *self);
bool list_delete_cur(List *self);
bool list_has_next(List *self);
void *list_get_next(List *self);
void list_move_next(List *self);
bool list_has_prev(List *self);
void *list_get_prev(List *self);
void list_move_prev(List *self);
List *new_list(void);
void delete_list(List *self);
#endif
|
#define _DEBUG
#include <string.h>
#include <stdio.h>
#include <limits.h>
#include <assert.h>
#include <atoi.h>
int StaticValues[23] =
{
1,2,3,4,5,6,7,
8,9,10,21,25,100,
107,189,255,387,521,
1024,135,1112345,
INT_MAX,INT_MIN
};
char *StaticResultsDec[22] =
{
"1","2","3","4","5","6","7",
"8","9","10","21","25","100",
"107","189","255","387","521",
"1024","135","1112345",
"2147483647"
};
char *StaticResultsHex[22] =
{
"1","2","3","4","5","6","7",
"8","9","A","15","19","64",
"6B","BD","FF","183","209",
"400","87","10F919",
"7FFFFFFF"
};
char output[255] = {0};
int main(void)
{
//testing static dec table
for(int i = 0; i < 22; i++)
{
itoa(StaticValues[i], output, 10);
assert(!strcmp(output,StaticResultsDec[i]));
}
//testing static hex table
for(int i = 0; i < 22; i++)
{
itoa(StaticValues[i], output, 16);
assert(!strcmp(output,StaticResultsHex[i]));
}
return 0;
}
|
/****
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
* Created 2015 by Skurydin Alexey
* http://github.com/SmingHub/Sming
* All files of the Sming Core are provided under the LGPL v3 license.
*
*
* @author: 2021 - Slavey Karadzhov <slaff@attachix.com>
*
****/
#pragma once
#include "../HttpResourcePlugin.h"
#include <Data/WebHelpers/base64.h>
class ResourceIpAuth : public HttpPreFilter
{
public:
ResourceIpAuth(IpAddress ip, IpAddress netmask) : ip(ip), netmask(netmask)
{
}
bool urlComplete(HttpServerConnection& connection, HttpRequest& request, HttpResponse& response) override
{
auto remoteIp = connection.getRemoteIp();
if(remoteIp.compare(ip, netmask)) {
// This IP is allowed to proceed
return true;
}
// specify that the resource is protected...
response.code = HTTP_STATUS_UNAUTHORIZED;
return false;
}
private:
IpAddress ip;
IpAddress netmask;
};
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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.
QtAws 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 QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_ADDNOTIFICATIONCHANNELSREQUEST_H
#define QTAWS_ADDNOTIFICATIONCHANNELSREQUEST_H
#include "codeguruprofilerrequest.h"
namespace QtAws {
namespace CodeGuruProfiler {
class AddNotificationChannelsRequestPrivate;
class QTAWSCODEGURUPROFILER_EXPORT AddNotificationChannelsRequest : public CodeGuruProfilerRequest {
public:
AddNotificationChannelsRequest(const AddNotificationChannelsRequest &other);
AddNotificationChannelsRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(AddNotificationChannelsRequest)
};
} // namespace CodeGuruProfiler
} // namespace QtAws
#endif
|
/* GStreamer Instruments
* Copyright (C) 2015 Kyrylo Polezhaiev <kirushyk@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify i t under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "gstelementheadstone.h"
void
gst_element_headstone_add_child (GstElementHeadstone *parent, GstElementHeadstone *child)
{
GList *iterator;
child->parent = parent;
for (iterator = parent->children; iterator != NULL; iterator = iterator->next)
if (iterator->data == child)
return;
parent->children = g_list_prepend (parent->children, child);
}
guint64
gst_element_headstone_get_nested_time (GstElementHeadstone *element)
{
GList *child;
guint64 result = element->total_cpu_time;
for (child = element->children; child != NULL; child = child->next)
result += gst_element_headstone_get_nested_time (child->data);
return result;
}
gfloat
gst_element_headstone_get_nested_load (GstElementHeadstone *element)
{
GList *child;
gfloat result = element->cpu_load;
for (child = element->children; child != NULL; child = child->next)
result += gst_element_headstone_get_nested_load (child->data);
return result;
}
|
/*
Copyright (C) 2007 <SWGEmu>
This File is part of Core3.
This program is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General
Public License along with this program; if not, write to
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linking Engine3 statically or dynamically with other modules
is making a combined work based on Engine3.
Thus, the terms and conditions of the GNU Lesser General Public License
cover the whole combination.
In addition, as a special exception, the copyright holders of Engine3
give you permission to combine Engine3 program with free software
programs or libraries that are released under the GNU LGPL and with
code included in the standard release of Core3 under the GNU LGPL
license (or modified versions of such code, with unchanged license).
You may copy and distribute such a system following the terms of the
GNU LGPL for Engine3 and the licenses of the other code concerned,
provided that you include the source code of that other code when
and as the GNU LGPL requires distribution of source code.
Note that people who make modified versions of Engine3 are not obligated
to grant this special exception for their modified versions;
it is their choice whether to do so. The GNU Lesser General Public License
gives permission to release a modified version without this exception;
this exception also makes it possible to release a modified version
which carries forward this exception.
*/
#ifndef COMBATSPAMCOMMAND_H_
#define COMBATSPAMCOMMAND_H_
#include "server/zone/objects/scene/SceneObject.h"
class CombatSpamCommand : public QueueCommand {
public:
CombatSpamCommand(const String& name, ZoneProcessServer* server)
: QueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) {
if (!checkStateMask(creature))
return INVALIDSTATE;
if (!checkInvalidLocomotions(creature))
return INVALIDLOCOMOTION;
return SUCCESS;
}
};
#endif //COMBATSPAMCOMMAND_H_
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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.
QtAws 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 QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_GETOBJECTRESPONSE_H
#define QTAWS_GETOBJECTRESPONSE_H
#include "mediastoredataresponse.h"
#include "getobjectrequest.h"
namespace QtAws {
namespace MediaStoreData {
class GetObjectResponsePrivate;
class QTAWSMEDIASTOREDATA_EXPORT GetObjectResponse : public MediaStoreDataResponse {
Q_OBJECT
public:
GetObjectResponse(const GetObjectRequest &request, QNetworkReply * const reply, QObject * const parent = 0);
virtual const GetObjectRequest * request() const Q_DECL_OVERRIDE;
protected slots:
virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(GetObjectResponse)
Q_DISABLE_COPY(GetObjectResponse)
};
} // namespace MediaStoreData
} // namespace QtAws
#endif
|
/********************************************************************
* Copyright © 2016 Computational Molecular Biology Group, *
* Freie Universität Berlin (GER) *
* *
* This file is part of ReaDDy. *
* *
* ReaDDy is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General *
* Public License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
********************************************************************/
/**
* << detailed description >>
*
* @file TopologyReactionRecipeBuilder.h
* @brief << brief description >>
* @author clonker
* @date 13.04.17
* @copyright GNU Lesser General Public License v3.0
*/
#pragma once
#include <vector>
#include <readdy/common/macros.h>
#include "Operations.h"
#include "TopologyReactionAction.h"
NAMESPACE_BEGIN(readdy)
NAMESPACE_BEGIN(model)
class Kernel;
NAMESPACE_BEGIN(top)
NAMESPACE_BEGIN(reactions)
class Recipe {
public:
using reaction_operations = std::vector<op::Operation::Ref>;
using topology_graph = actions::TopologyReactionAction::topology_graph;
using vertex_ref = topology_graph::vertex_ref;
using vertex_cref = topology_graph::vertex_cref;
using edge = topology_graph::edge;
using graph_topology = GraphTopology;
explicit Recipe(graph_topology &topology) : _topology(topology) {};
Recipe(Recipe &&) = default;
Recipe &operator=(Recipe &&) = default;
Recipe(const Recipe &) = default;
Recipe &operator=(const Recipe &) = default;
~Recipe() = default;
Recipe &changeParticleType(const vertex_ref &ref, const std::string &to);
Recipe &changeParticleType(const vertex_ref &ref, const particle_type_type &to) {
_steps.push_back(std::make_shared<op::ChangeParticleType>(ref, to));
return *this;
}
Recipe &addEdge(const edge &edge) {
_steps.push_back(std::make_shared<op::AddEdge>(edge));
return *this;
}
Recipe &addEdge(vertex_ref v1, vertex_ref v2) {
return addEdge(std::tie(v1, v2));
}
Recipe &removeEdge(const edge &edge) {
_steps.push_back(std::make_shared<op::RemoveEdge>(edge));
return *this;
}
Recipe &removeEdge(vertex_ref v1, vertex_ref v2) {
return removeEdge(std::tie(v1, v2));
}
Recipe &separateVertex(const vertex_ref &vertex) {
std::for_each(vertex->neighbors().begin(), vertex->neighbors().end(), [this, &vertex](const auto &neighbor) {
this->removeEdge(std::make_tuple(vertex, neighbor));
});
return *this;
}
Recipe &changeTopologyType(const std::string &type) {
_steps.push_back(std::make_shared<op::ChangeTopologyType>(type));
return *this;
}
const reaction_operations &steps() const {
return _steps;
}
graph_topology &topology() {
return _topology;
}
const graph_topology &topology() const {
return _topology;
}
private:
std::reference_wrapper<graph_topology> _topology;
reaction_operations _steps;
};
NAMESPACE_END(reactions)
NAMESPACE_END(top)
NAMESPACE_END(model)
NAMESPACE_END(readdy)
|
/*****************************************************************************
Copyright (c) 2010, Intel Corp.
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 Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************
* Contents: Native high-level C interface to LAPACK function zhseqr
* Author: Intel Corporation
* Generated October, 2010
*****************************************************************************/
#include "lapacke.h"
#include "lapacke_utils.h"
lapack_int LAPACKE_zhseqr( int matrix_order, char job, char compz, lapack_int n,
lapack_int ilo, lapack_int ihi,
lapack_complex_double* h, lapack_int ldh,
lapack_complex_double* w, lapack_complex_double* z,
lapack_int ldz )
{
lapack_int info = 0;
lapack_int lwork = -1;
lapack_complex_double* work = NULL;
lapack_complex_double work_query;
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_zhseqr", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_zge_nancheck( matrix_order, n, n, h, ldh ) ) {
return -7;
}
if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
if( LAPACKE_zge_nancheck( matrix_order, n, n, z, ldz ) ) {
return -10;
}
}
#endif
/* Query optimal working array(s) size */
info = LAPACKE_zhseqr_work( matrix_order, job, compz, n, ilo, ihi, h, ldh,
w, z, ldz, &work_query, lwork );
if( info != 0 ) {
goto exit_level_0;
}
lwork = LAPACK_Z2INT( work_query );
/* Allocate memory for work arrays */
work = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
/* Call middle-level interface */
info = LAPACKE_zhseqr_work( matrix_order, job, compz, n, ilo, ihi, h, ldh,
w, z, ldz, work, lwork );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zhseqr", info );
}
return info;
}
|
//
// libgfx/include/libgfx/init.h: Graphics initialization.
//
// n64chain: A (free) open-source N64 development toolchain.
// Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
//
// This file is subject to the terms and conditions defined in
// 'LICENSE', which is part of this source code package.
//
#ifndef LIBGFX_INCLUDE_LIBGFX_INIT_H
#define LIBGFX_INCLUDE_LIBGFX_INIT_H
#include <rcp/sp.h>
#include <stdint.h>
// Initialize the libgfx components.
void libgfx_init(void);
// Run the microcode and wait for it to complete.
static inline void libgfx_run(void) {
libn64_rsp_set_pc(0x04001000);
libn64_rsp_set_status(RSP_STATUS_CLEAR_HALT | RSP_STATUS_CLEAR_BROKE);
}
#endif
|
/*
* Python object definition of the sequence and iterator object of physical volumes
*
* Copyright (C) 2014-2021, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined( _PYVSLVM_PHYSICAL_VOLUMES_H )
#define _PYVSLVM_PHYSICAL_VOLUMES_H
#include <common.h>
#include <types.h>
#include "pyvslvm_libvslvm.h"
#include "pyvslvm_python.h"
#if defined( __cplusplus )
extern "C" {
#endif
typedef struct pyvslvm_physical_volumes pyvslvm_physical_volumes_t;
struct pyvslvm_physical_volumes
{
/* Python object initialization
*/
PyObject_HEAD
/* The parent object
*/
PyObject *parent_object;
/* The get item by index callback function
*/
PyObject* (*get_item_by_index)(
PyObject *parent_object,
int index );
/* The current index
*/
int current_index;
/* The number of items
*/
int number_of_items;
};
extern PyTypeObject pyvslvm_physical_volumes_type_object;
PyObject *pyvslvm_physical_volumes_new(
PyObject *parent_object,
PyObject* (*get_item_by_index)(
PyObject *parent_object,
int index ),
int number_of_items );
int pyvslvm_physical_volumes_init(
pyvslvm_physical_volumes_t *sequence_object );
void pyvslvm_physical_volumes_free(
pyvslvm_physical_volumes_t *sequence_object );
Py_ssize_t pyvslvm_physical_volumes_len(
pyvslvm_physical_volumes_t *sequence_object );
PyObject *pyvslvm_physical_volumes_getitem(
pyvslvm_physical_volumes_t *sequence_object,
Py_ssize_t item_index );
PyObject *pyvslvm_physical_volumes_iter(
pyvslvm_physical_volumes_t *sequence_object );
PyObject *pyvslvm_physical_volumes_iternext(
pyvslvm_physical_volumes_t *sequence_object );
#if defined( __cplusplus )
}
#endif
#endif /* !defined( _PYVSLVM_PHYSICAL_VOLUMES_H ) */
|
# 1 "asgPlusExpr.c"
int func(void)
{
int n = 3;
int m = 5;
n += m;
return 0;
}
|
// Created file "Lib\src\Uuid\shguids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(IID_IEnumAccounts, 0x50c852b0, 0xc95f, 0x4fee, 0xbe, 0x00, 0x87, 0xdc, 0x18, 0xb2, 0x66, 0x1b);
|
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**/
#pragma once
/**
* @file CImage.h
* @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr )
* Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
* @author Tristan Roussillon (\c tristan.roussillon@liris.cnrs.fr )
* Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
*
* @date 2012/02/08
*
* This file is part of the DGtal library.
*/
#if defined(CImageRECURSES)
#error Recursive header files inclusion detected in CImage.h
#else // defined(CImageRECURSES)
/** Prevents recursive inclusion of headers. */
#define CImageRECURSES
#if !defined CImage_h
/** Prevents repeated inclusion of headers. */
#define CImage_h
#include <boost/concept_check.hpp>
#include <boost/concept/assert.hpp>
#include <boost/concept/requires.hpp>
#include "DGtal/kernel/domains/CDomain.h"
#include "DGtal/images/CConstImage.h"
#include "DGtal/base/CConstBidirectionalRangeFromPoint.h"
#include "DGtal/base/CBidirectionalOutputRangeFromPoint.h"
#include "DGtal/images/CTrivialImage.h"
namespace DGtal
{
/////////////////////////////////////////////////////////////////////////////
// struct CImage
/**
* DescriptionDescription of \b concept '\b CImage' <p>
*
* @ingroup Concepts
* Aim: Defines the concept describing a read/write image,
* having an output iterator.
*
* <p> Refinement of
*
* CTrivialImage and CConstImage
*
* <p> Associated types:
* - the same as CTrivialImage
* - the same as CConstImage
* - \a Range : type of the Range
*
*
* <p> Notation
* - \t X : A type that is a model of CImage
* - \t x : Object of type X
* - \t aPoint : Object of type Point
* - \t aValue : Object of type Value
*
*
* <p> Definitions
*
* <p> Valid expressions and
| Name | Expression | Type requirements | Return type | Precondition | Semantics | Post condition | Complexity |
|-------------------------------------|------------------------------------|----------------------|-----------------------|------------------------------------|-------------------------------------------------------|----------------|------------|
| get range | x.range() | | Range | | Returns a range on the image values | | |
*
* <p> Invariants###
*
* <p> Models###
* ImageContainerBySTLVector, ImageContainerBySTLMap, ImageContainerByITKImage
* <p> Notes###
*
*/
template <typename I>
struct CImage: CConstImage<I>, CTrivialImage<I>
{
public:
typedef typename I::Range Range;
BOOST_CONCEPT_ASSERT((CConstBidirectionalRangeFromPoint<Range>));
BOOST_CONCEPT_ASSERT((CBidirectionalOutputRangeFromPoint<Range, typename
I::Value>));
public:
BOOST_CONCEPT_USAGE(CImage)
{
ConceptUtils::sameType( myI.range(), myR);
}
private:
I myI;
Range myR;
};
} // namespace DGtal
// //
///////////////////////////////////////////////////////////////////////////////
#endif // !defined CImage_h
#undef CImageRECURSES
#endif // else defined(CImageRECURSES)
|
// Created file "Lib\src\Uuid\propkeys"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(PKEY_SAM_PasswordLastSet, 0x705d8364, 0x7547, 0x468c, 0x8c, 0x88, 0x84, 0x86, 0x0b, 0xcb, 0xed, 0x4c);
|
#ifndef WEBSOCKETHANDLER_H
#define WEBSOCKETHANDLER_H
#include <Poco/Net/HTTPRequestHandler.h>
class WebSocketHandler : public Poco::Net::HTTPRequestHandler
{
public:
WebSocketHandler();
~WebSocketHandler();
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override;
};
#endif // WEBSOCKETHANDLER_H
|
/*
* Python object definition of the sequence and iterator object of sections
*
* Copyright (C) 2011-2022, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined( _PYEXE_SECTIONS_H )
#define _PYEXE_SECTIONS_H
#include <common.h>
#include <types.h>
#include "pyexe_libexe.h"
#include "pyexe_python.h"
#if defined( __cplusplus )
extern "C" {
#endif
typedef struct pyexe_sections pyexe_sections_t;
struct pyexe_sections
{
/* Python object initialization
*/
PyObject_HEAD
/* The parent object
*/
PyObject *parent_object;
/* The get item by index callback function
*/
PyObject* (*get_item_by_index)(
PyObject *parent_object,
int index );
/* The current index
*/
int current_index;
/* The number of items
*/
int number_of_items;
};
extern PyTypeObject pyexe_sections_type_object;
PyObject *pyexe_sections_new(
PyObject *parent_object,
PyObject* (*get_item_by_index)(
PyObject *parent_object,
int index ),
int number_of_items );
int pyexe_sections_init(
pyexe_sections_t *sequence_object );
void pyexe_sections_free(
pyexe_sections_t *sequence_object );
Py_ssize_t pyexe_sections_len(
pyexe_sections_t *sequence_object );
PyObject *pyexe_sections_getitem(
pyexe_sections_t *sequence_object,
Py_ssize_t item_index );
PyObject *pyexe_sections_iter(
pyexe_sections_t *sequence_object );
PyObject *pyexe_sections_iternext(
pyexe_sections_t *sequence_object );
#if defined( __cplusplus )
}
#endif
#endif /* !defined( _PYEXE_SECTIONS_H ) */
|
/*
* Copyright (c) 2016 by Lee A. Stripp <leestripp@gmail.com>
*
* This file is part of the vortxGE library.
*
* vortxGE 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.
*
* vortxGE 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 vortxGE. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef vortxGE_lsBulletShape_h
#define vortxGE_lsBulletShape_h
// opengl
#include "../opengl/lsOpenGL.h"
#include "lsData.h"
class btCollisionShape;
/**
Holds the basic Bullet Shape to be attached to a lsBulletObject used by lsObjects
*/
class lsBulletShape : public lsData
{
public:
lsBulletShape( lsOpenGL *opengl );
virtual ~lsBulletShape();
// opengl
lsOpenGL *ogl;
// build shapes
void Make_Plane( float x, float y, float z );
void Make_Box( float x, float y, float z );
void Make_Sphere( float r );
// From vbm file via lsBatch_Buller
void Make_ConvexHull( const string& filename, lsOpenGL *opengl );
void Make_TriMesh( const string& filename, float size = 1.0 );
btCollisionShape *getShape() const
{
return shape;
}
private:
btCollisionShape *shape;
};
#endif
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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.
QtAws 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 QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_LISTORGANIZATIONADMINACCOUNTSREQUEST_P_H
#define QTAWS_LISTORGANIZATIONADMINACCOUNTSREQUEST_P_H
#include "macie2request_p.h"
#include "listorganizationadminaccountsrequest.h"
namespace QtAws {
namespace Macie2 {
class ListOrganizationAdminAccountsRequest;
class ListOrganizationAdminAccountsRequestPrivate : public Macie2RequestPrivate {
public:
ListOrganizationAdminAccountsRequestPrivate(const Macie2Request::Action action,
ListOrganizationAdminAccountsRequest * const q);
ListOrganizationAdminAccountsRequestPrivate(const ListOrganizationAdminAccountsRequestPrivate &other,
ListOrganizationAdminAccountsRequest * const q);
private:
Q_DECLARE_PUBLIC(ListOrganizationAdminAccountsRequest)
};
} // namespace Macie2
} // namespace QtAws
#endif
|
/*!
* @file regDelay.c
* @brief Converter Control Regulation library signal delay functions
*
* <h2>Copyright</h2>
*
* Copyright CERN 2015. This project is released under the GNU Lesser General
* Public License version 3.
*
* <h2>License</h2>
*
* This file is part of libreg.
*
* libreg is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h>
#include "libreg.h"
// Background functions: do not call these from the real-time thread or interrupt
void regDelayInitDelay(struct REG_delay_pars * const pars, cc_float delay_iters)
{
cc_float delay_int;
// Clip delay
if(delay_iters < 0.0)
{
delay_iters = 0.0;
}
else if(delay_iters > (REG_DELAY_BUF_INDEX_MASK - 1.0))
{
delay_iters = REG_DELAY_BUF_INDEX_MASK - 1.0;
}
// Calculate integer and fractional parts of the delay in iterations
pars->delay_frac = modff(delay_iters, &delay_int);
pars->delay_int = (int32_t)delay_int;
}
void regDelayInitVars(struct REG_delay_vars * const vars, const cc_float initial_signal)
{
uint32_t i;
for(i = 0 ; i <= REG_DELAY_BUF_INDEX_MASK ; i++)
{
vars->buf[i] = initial_signal;
}
}
// Real-Time Functions
cc_float regDelaySignalRT(const struct REG_delay_pars * const pars,
struct REG_delay_vars * const vars,
const cc_float signal,
const bool is_under_sampled)
{
vars->buf[++vars->buf_index & REG_DELAY_BUF_INDEX_MASK] = signal;
const cc_float s0 = vars->buf[(vars->buf_index - pars->delay_int ) & REG_DELAY_BUF_INDEX_MASK];
const cc_float s1 = vars->buf[(vars->buf_index - pars->delay_int - 1) & REG_DELAY_BUF_INDEX_MASK];
// When not undersampled, use linear interpolation
if(is_under_sampled == false)
{
return(s0 + pars->delay_frac * (s1 - s0));
}
// When under-sampled, jump to final value at the start of each period
return(s0);
}
// EOF
|
#pragma once
#include "../core/Cpu.h"
#include "TestMemoryMap.h"
class TestCpu : public Cpu
{
public:
explicit TestCpu(TestMemoryMap& memory) : Cpu(memory) {}
~TestCpu() = default;
Registers& Registers() { return _registers; }
bool& InterruptsEnabled() { return _interruptsEnabled; }
unsigned char& EnabledInterrupts() { return _enabledInterrupts; }
unsigned char& WaitingInterrupts() { return _waitingInterrupts; }
};
|
/*
* Copyright (C) 2014 The AppCan Open Source Project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#import <Foundation/Foundation.h>
#include <AudioToolbox/AudioToolbox.h>
#define F_SBWND_FONT_SIZE_PAD 24
#define F_SBWND_FONT_SIZE_PHONE 12
@interface BStatusBarWindow : UIWindow {
UIDeviceOrientation mInitOrientation;
UILabel *mTextView;
SystemSoundID mAlertSoundID;
}
@property UIDeviceOrientation mInitOrientation;
@property (nonatomic,assign)SystemSoundID mAlertSoundID;
- (id)initWithFrame:(CGRect)frame andNotifyText:(NSString*)notifyText;
- (void)setNotifyText:(NSString*)inNotifyText;
@end
|
#ifndef _FINGERCLIENT_H
#define _FINGERCLIENT_H
#include <boost/thread.hpp>
#ifdef WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif
#include <map>
#include <set>
#include <queue>
#include "ip/UdpSocket.h"
#include "ip/PacketListener.h"
#include "osc/OscReceivedElements.h"
#include "FingerListener.h"
class FingerClient : public PacketListener
{
public:
enum MyMessage
{
MYMESS_SET_PORT = 0,
MYMESS_ENABLE_CALIB
};
public:
FingerClient(int port);
~FingerClient();
void registerFingerListener(FingerListener* listener);
void registerUserListener(UserListener* listener);
void setPositionHistorySize(unsigned int size);
void ReceiveThread();
void ProcessPacket(const char* data, int size, const IpEndpointName& remoteEndpoint);
void ProcessBundle(const osc::ReceivedBundle& bundle, const IpEndpointName& remoteEndpoint);
void ProcessMessage(const osc::ReceivedMessage& message, const IpEndpointName& remoteEndpoint);
int getPort() const { return mPort; }
std::queue<std::pair<MyMessage, int>>& getMessages() { return mMessages; }
private:
class ThreadCaller
{
public:
ThreadCaller(FingerClient* fingerclient) : fingerclient(fingerclient) {}
void operator()() { fingerclient->ReceiveThread(); }
private:
FingerClient* fingerclient;
};
osc::int32 getUserIdForFinger(osc::int32 s_id);
void addUserIdToFinger(osc::int32 u_id, osc::int32 s_id);
void removeUserIdFromFinger(osc::int32 s_id);
void ProcessKinectMessage(const osc::ReceivedMessage& message, const IpEndpointName& remoteEndpoint);
boost::thread* thread;
boost::mutex mutex, mutex2;
FingerListener* fingerlistener;
UserListener* userlistener;
unsigned int historysize;
UdpListeningReceiveSocket* socket;
std::map<osc::int32, FingerInfo*> cursor_id_map;
std::map<osc::int32, UserInfo*> uid_map;
std::set<osc::int32> alive_ids, alive_uids;
std::vector<osc::int32> current_fseqs;
std::vector<std::string> address_patterns;
int mPort;
std::queue<std::pair<MyMessage, int>> mMessages;
};
#endif //_FINGERCLIENT_H
|
/***********************************************************************
Copyright (c) 2006-2011, Skype Limited. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, (subject to the limitations in the disclaimer below)
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 Skype Limited, nor the names of specific
contributors, may be used to endorse or promote products derived from
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
/* *
* SKP_Silk_resampler_private_AR2. c *
* *
* Second order AR filter with single delay elements *
* *
* Copyright 2010 (c), Skype Limited *
* */
#include "SKP_Silk_SigProc_FIX.h"
#include "SKP_Silk_resampler_private.h"
#if (!defined(EMBEDDED_MIPS))
/* Second order AR filter with single delay elements */
void SKP_Silk_resampler_private_AR2(
SKP_int32 S[], /* I/O: State vector [ 2 ] */
SKP_int32 out_Q8[], /* O: Output signal */
const SKP_int16 in[], /* I: Input signal */
const SKP_int16 A_Q14[], /* I: AR coefficients, Q14 */
SKP_int32 len /* I: Signal length */
)
{
SKP_int32 k;
SKP_int32 out32;
for( k = 0; k < len; k++ ) {
out32 = SKP_ADD_LSHIFT32( S[ 0 ], (SKP_int32)in[ k ], 8 );
out_Q8[ k ] = out32;
out32 = SKP_LSHIFT( out32, 2 );
S[ 0 ] = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] );
S[ 1 ] = SKP_SMULWB( out32, A_Q14[ 1 ] );
}
}
#endif
|
/* A libfabric provider for the A3CUBE Ronnie network.
*
* (C) Copyright 2015 - University of Torino, Italy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This work is a part of Paolo Inaudi's MSc thesis at Computer Science
* Department of University of Torino, under the supervision of Prof.
* Marco Aldinucci. This is work has been made possible thanks to
* the Memorandum of Understanding (2014) between University of Torino and
* A3CUBE Inc. that established a joint research lab at
* Computer Science Department of University of Torino, Italy.
*
* Author: Paolo Inaudi <p91paul@gmail.com>
*
* Contributors:
*
* Emilio Billi (A3Cube Inc. CSO): hardware and DPAlib support
* Paola Pisano (UniTO-A3Cube CEO): testing environment
* Marco Aldinucci (UniTO-A3Cube CSO): code design supervision"
*/
#include "dpa.h"
#include "dpa_env.h"
#include "dpa_msg.h"
#include "dpa_mr.h"
#include "dpa_info.h"
static int dpa_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context);
static int dpa_fabric_close(fid_t fid);
static void fi_dpa_fini(void);
dpa_nodeid_t localNodeId;
#ifndef ADAPTERNO_DEFAULT
#define ADAPTERNO_DEFAULT 0
#endif
DEFINE_ENV_CONST(dpa_adapterno_t, localAdapterNo, ADAPTERNO_DEFAULT);
struct fi_provider dpa_provider = {
.name="dpa",
.version=FI_VERSION(DPA_MAJOR_VERSION, DPA_MINOR_VERSION),
.fi_version=FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION),
.getinfo=dpa_getinfo,
.fabric=dpa_fabric,
.cleanup=fi_dpa_fini
};
extern fastlock_t msg_lock;
FI_EXT_INI{
//start dpalib
dpa_error_t error;
DPA_DEBUG("Initialize DPALIB\n");
DPAInitialize(NO_FLAGS, &error);
DPALIB_CHECK_ERROR(DPAInitialize, return NULL);
ENV_OVERRIDE_INT(localAdapterNo);
DPA_DEBUG("Getting local node id\n");
DPAGetLocalNodeId(localAdapterNo,
&localNodeId,
NO_FLAGS,
&error);
DPALIB_CHECK_ERROR(DPAGetLocalNodeId, return NULL);
DPA_DEBUG("Local node id = %d\n", localNodeId);
dpa_mr_init();
dpa_msg_init();
dpa_cm_init();
return &dpa_provider;
}
/**
* Finalize dpa provider
*/
static void fi_dpa_fini(void)
{
dpa_mr_fini();
dpa_msg_fini();
dpa_cm_fini();
//finalize dpalib
DPATerminate();
}
static struct fi_ops dpa_fab_fi_ops = {
.size = sizeof(struct fi_ops),
.close = dpa_fabric_close,
.bind = fi_no_bind,
.control = fi_no_control,
.ops_open = fi_no_ops_open
};
static struct fi_ops_fabric dpa_fab_ops = {
.size = sizeof(struct fi_ops_fabric),
.domain = dpa_domain_open,
.passive_ep = dpa_passive_ep_open,
.eq_open = dpa_eq_open,
.wait_open = fi_no_wait_open
};
/**
* Open dpa fabric domain
*/
struct fid_fabric fab = {
.fid = {
.fclass = FI_CLASS_FABRIC,
.ops = &dpa_fab_fi_ops
},
.ops = &dpa_fab_ops,
};
static int dpa_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context) {
if (!attr) return -FI_ENODATA;
if(strcmp(attr->name, DPA_FABRIC_NAME)) return -FI_ENODATA;
fab.fid.context = context;
*fabric = &fab;
return FI_SUCCESS;
}
static int dpa_fabric_close(fid_t fid) {
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.