text stringlengths 4 6.14k |
|---|
/* ====================================
coded by Mikolaj Feliks aka Majuma
mail: majuma@wp.pl
web: http://www.majuma.xt.pl
all rights reserved
==================================== */
void interrupt (*OldKbdInt)(void);
BYTE KeyTable[256];
//------------------------------------------------------------
void interrupt KbdInt(void) {
BYTE c;
c = inportb(0x60);
outportb(0x20, 0x20);
if (c & 0x80)
KeyTable[c - 0x80] = 0;
else
KeyTable[c] = 1;
}
void SetKeyboard(void) {
int i;
for (i = 0; i < 256; i++) {
KeyTable[i] = 0;
}
OldKbdInt = getvect(0x09);
setvect(0x09, KbdInt);
}
void RestoreKeyboard(void) {
setvect(0x09, OldKbdInt);
}
|
/* 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[4];
atomic_int atom_1_r1_1;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v4_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v5_r4 = v4_r3 ^ v4_r3;
int v6_r4 = v5_r4 + 1;
atomic_store_explicit(&vars[2], v6_r4, memory_order_seq_cst);
int v8_r6 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v10_r7 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v11_r8 = v10_r7 ^ v10_r7;
int v14_r9 = atomic_load_explicit(&vars[3+v11_r8], memory_order_seq_cst);
int v15_cmpeq = (v14_r9 == v14_r9);
if (v15_cmpeq) goto lbl_LC00; else goto lbl_LC00;
lbl_LC00:;
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
int v20 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v20, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[2], 0);
atomic_init(&vars[3], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[0], 0);
atomic_init(&atom_1_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v16 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v17 = (v16 == 2);
int v18 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v19_conj = v17 & v18;
if (v19_conj == 1) assert(0);
return 0;
}
|
// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \
// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS
// LINK_WITH_RTEMS: Inputs{{.*}}crti.o
// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o
// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../..{{/|\\\\}}../sparc-myriad-elf/lib"
// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2"
// LINK_WITH_RTEMS: "--start-group" "-lc" "-lrtemscpu" "-lrtemsbsp" "--end-group" "-lgcc"
// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o
// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o
// RUN: %clang -c -no-canonical-prefixes -### -target sparc-myriad-rtems-elf -x c++ %s \
// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=COMPILE_CXX
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2"
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2/sparc-myriad-elf"
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2/backward"
// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s 2>&1 \
// RUN: | FileCheck %s -check-prefix=SLASH_INCLUDE
// SLASH_INCLUDE: "-isysroot" "/yow" "-internal-isystem" "/yow/include"
// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s -nostdinc 2>&1 \
// RUN: | FileCheck %s -check-prefix=NO_SLASH_INCLUDE
// NO_SLASH_INCLUDE: "-isysroot" "/yow"
// NO_SLASH_INCLUDE-NOT: "-internal-isystem" "/yow/include"
// RUN: %clang -### -target what-myriad %s 2>&1 | FileCheck %s -check-prefix=BAD_ARCH
// BAD_ARCH: the target architecture 'what' is not supported by the target 'myriad'
// Ensure that '-target shave' picks a different compiler.
// Also check that '-I' is turned into '-i:' for the assembler.
// Note that since we don't know where movi tools are installed,
// the driver may or may not find a full path to them.
// That is, the 0th argument will be "/path/to/my/moviCompile"
// or just "moviCompile" depending on whether moviCompile is found.
// As such, we test only for a trailing quote in its rendering.
// The same goes for "moviAsm".
// RUN: %clang -target shave-myriad -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \
// RUN: | FileCheck %s -check-prefix=MOVICOMPILE
// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-isystem" "somewhere" "-I" "common"
// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a"
// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf"
// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
// RUN: | FileCheck %s -check-prefix=DEFINES
// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME"
// RUN: %clang -target shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \
// RUN: | FileCheck %s -check-prefix=INCLUDES
// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath"
// RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \
// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d \
// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=PASSTHRU_OPTIONS
// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once"
// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections"
// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \
// RUN: | FileCheck %s -check-prefix=MDMF
// MDMF: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-MD" "-MF" "dep.d" "-MT" "foo.o"
// RUN: %clang -target shave-myriad -std=gnu++11 -S %s -o foo.o -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=STDEQ
// STDEQ: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-std=gnu++11"
// RUN: %clang -target shave-myriad -E -Ifoo %s -o foo.i -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=PREPROCESS
// PREPROCESS: "-E" "-mcpu=myriad2" "-DMYRIAD2" "-I" "foo"
// RUN: %clang -target sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck %s --check-prefix=STDLIBCXX
// STDLIBCXX: "-lstdc++" "-lc" "-lgcc"
// RUN: %clang -target sparc-myriad -### -nostdlib %s 2>&1 | FileCheck %s --check-prefix=NOSTDLIB
// NOSTDLIB-NOT: crtbegin.o
// NOSTDLIB-NOT: "-lc"
// RUN: %clang -### -c -g %s -target sparc-myriad 2>&1 | FileCheck -check-prefix=G_SPARC %s
// G_SPARC: "-debug-info-kind=limited" "-dwarf-version=2"
|
/*
* PasswordDialog.h
*
* This file is part of INVERITA.
*
* INVERITA Personal Backup Software
* Copyright (C) 2012-2014 Marc Weidler <marc.weidler@web.de>,
* Ulrichstr. 12/1, 71672 Marbach, Germany.
* All rights reserved.
*
* INVERITA 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.
*
* INVERITA 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 HEADER_PASSWORDDIALOG_INC
#define HEADER_PASSWORDDIALOG_INC
#include <QDialog>
#include <QCheckBox>
#include <QLineEdit>
/*! Password edit dialog for encrypted backups
*/
class PasswordDialog : public QDialog
{
Q_OBJECT
public:
PasswordDialog(QWidget *parent);
~PasswordDialog();
QString password() const;
void setPassword(const QString &password);
bool rememberPassword() const;
void setRememberPassword(bool checked);
public slots:
void adjustEchoMode();
private:
QLineEdit *m_passwordEdit;
QCheckBox *m_showPassword;
QCheckBox *m_rememberPassword;
};
#endif
|
/*
* BLDCHandler.h
*
* Created on: 9 Aug 2019
* Author: xasin
*/
#ifndef ESP32_ONESHOT125_BLDCHANDLER_H_
#define ESP32_ONESHOT125_BLDCHANDLER_H_
#include <stdint.h>
namespace Xasin {
namespace Drone {
class BLDCHandler {
public:
const uint8_t num_channels;
const uint8_t gpio_start;
BLDCHandler(uint8_t channel_count, uint8_t gpio_start);
virtual ~BLDCHandler();
virtual void set_motor_power(uint8_t id, float val);
virtual float get_motor_power(uint8_t id);
};
}
} /* namespace Xasin */
#endif /* ESP32_ONESHOT125_BLDCHANDLER_H_ */
|
/****************************************************************************
* This file is part of s3c2440adc, a project for S3C2440A ADC.
* Copyright (C) 2013 Tseesing
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Contact: chen-qx@live.cn
*
****************************************************************************/
#ifndef ADC_NETWORK_H__
#define ADC_NETWORK_H__
#include <stdint.h> // Declaration of uint32_t, And why not <sys/types.h> ?
#include <s3cadc.h>
int adc_server_conn(char *serv, struct s3cadc *adcdev[], uint32_t nadcs);
#endif // ADC_NETWORK_H__
|
/**
******************************************************************************
* @file usbd_conf.h
* @author MCD Application Team
* @version V1.4.5
* @date 17-February-2017
* @brief General low level driver configuration
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_CONF_H
#define __USBD_CONF_H
#include "stm32f4xx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Includes ------------------------------------------------------------------*/
/** @addtogroup USBD_OTG_DRIVER
* @{
*/
/** @defgroup USBD_CONF
* @brief usb otg low level driver configuration file
* @{
*/
/** @defgroup USBD_CONF_Exported_Defines
* @{
*/
/* Common Config */
#define USBD_MAX_NUM_INTERFACES 1
#define USBD_MAX_NUM_CONFIGURATION 1
#define USBD_MAX_STR_DESC_SIZ 0x100
#define USBD_SUPPORT_USER_STRING 0
#define USBD_SELF_POWERED 1
#define USBD_DEBUG_LEVEL 0
/* MSC Class Config */
#define MSC_MEDIA_PACKET 8192
/** @defgroup USBD_Exported_Macros
* @{
*/
/* Memory management macros */
#define USBD_malloc malloc
#define USBD_free free
#define USBD_memset memset
#define USBD_memcpy memcpy
/* DEBUG macros */
#if (USBD_DEBUG_LEVEL > 0)
#define USBD_UsrLog(...) printf(__VA_ARGS__);\
printf("\n");
#else
#define USBD_UsrLog(...)
#endif
#if (USBD_DEBUG_LEVEL > 1)
#define USBD_ErrLog(...) printf("ERROR: ") ;\
printf(__VA_ARGS__);\
printf("\n");
#else
#define USBD_ErrLog(...)
#endif
#if (USBD_DEBUG_LEVEL > 2)
#define USBD_DbgLog(...) printf("DEBUG : ") ;\
printf(__VA_ARGS__);\
printf("\n");
#else
#define USBD_DbgLog(...)
#endif
/**
* @}
*/
/**
* @}
*/
/** @defgroup USBD_CONF_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup USBD_CONF_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup USBD_CONF_Exported_Variables
* @{
*/
/**
* @}
*/
/** @defgroup USBD_CONF_Exported_FunctionsPrototype
* @{
*/
/**
* @}
*/
#endif /* __USBD_CONF_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
* This file is part of the "FnordMetric" project
* Copyright (c) 2011-2014 Paul Asmuth, Google Inc.
*
* FnordMetric is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License v3.0. 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 _FNORDMETRIC_QUERY_TOKEN_H
#define _FNORDMETRIC_QUERY_TOKEN_H
#include <stdlib.h>
#include <string>
#include <vector>
namespace csql {
class Token {
public:
enum kTokenType {
T_SELECT,
T_FROM,
T_WHERE,
T_GROUP,
T_ORDER,
T_BY,
T_HAVING,
T_LIMIT,
T_OFFSET,
T_ASC,
T_DESC,
T_COMMA,
T_DOT,
T_IDENTIFIER,
T_STRING,
T_NUMERIC,
T_NULL,
T_SEMICOLON,
T_LPAREN,
T_RPAREN,
T_AND,
T_OR,
T_EQUAL,
T_NEQUAL,
T_PLUS,
T_MINUS,
T_ASTERISK,
T_SLASH,
T_AS,
T_NOT,
T_TRUE,
T_FALSE,
T_BANG,
T_CIRCUMFLEX,
T_TILDE,
T_PERCENT,
T_DIV,
T_MOD,
T_AMPERSAND,
T_PIPE,
T_LSHIFT,
T_RSHIFT,
T_LT,
T_LTE,
T_GT,
T_GTE,
T_LIKE,
T_REGEX,
T_BEGIN,
T_CREATE,
T_WITH,
T_IMPORT,
T_TABLE,
T_TABLES,
T_EOF,
T_SHOW,
T_DESCRIBE,
T_EXPLAIN,
T_JOIN,
T_CROSS,
T_NATURAL,
T_LEFT,
T_RIGHT,
T_INNER,
T_OUTER,
T_USING,
T_ON,
T_WITHIN,
T_RECORD,
T_OFF,
T_DRAW,
T_LINECHART,
T_AREACHART,
T_BARCHART,
T_POINTCHART,
T_HEATMAP,
T_HISTOGRAM,
T_AXIS,
T_TOP,
T_BOTTOM,
T_ORIENTATION,
T_HORIZONTAL,
T_VERTICAL,
T_STACKED,
T_XDOMAIN,
T_YDOMAIN,
T_ZDOMAIN,
T_XGRID,
T_YGRID,
T_LOGARITHMIC,
T_INVERT,
T_TITLE,
T_SUBTITLE,
T_GRID,
T_LABELS,
T_TICKS,
T_INSIDE,
T_OUTSIDE,
T_ROTATE,
T_LEGEND,
T_OVER,
T_TIMEWINDOW
};
Token(kTokenType token_type);
Token(kTokenType token_type, const char* data, size_t size);
Token(kTokenType token_type, const std::string& str);
Token(const Token& copy);
Token& operator=(const Token& copy) = delete;
bool operator==(const Token& other) const;
bool operator==(const std::string& string) const;
bool operator==(kTokenType type) const;
kTokenType getType() const;
static const char* getTypeName(kTokenType type);
const std::string getString() const;
int64_t getInteger() const; // FIXPAUL removeme
void debugPrint() const;
protected:
const kTokenType type_;
std::string str_;
};
}
#endif
|
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* 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
* BRIAN PAUL 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.
*/
/*
* 3DNow! optimizations contributed by
* Holger Waechtler <holger@akaflieg.extern.tu-berlin.de>
*/
#ifndef __3DNOW_H__
#define __3DNOW_H__
#include "math/m_xform.h"
void _mesa_init_3dnow_transform_asm( void );
#endif
|
/************************************************************************
* A simple program to show the size of the 4 basic data types in C as
* they are on the architecture where the program is run and compiled.
* by Foo74, March 22, 2016
************************************************************************/
/* Include the Standard IO library for printing to the screen. */
#include <stdio.h>
/* Our main function. */
int main()
{
/**********************************************************************
* There are only 4 basic data types in C. These are:
* char - a single byte to hold one character.
* int - an integer reflecting the natural size on this architecture.
* float - single-precision floating point.
* double - double-precision floating point.
**********************************************************************/
printf("\n\n********************************************************************\n");
printf("There are only 4 basic data types in C. These are:\n");
printf("char - a single byte to hold on character.\n");
printf("int - an integer reflecting the natural size on this architecture.\n");
printf("float - single-precision floating point.\n");
printf("double - double-precision floating point.\n");
printf("*********************************************************************\n\n");
char a;
int b;
float c;
double d;
printf("On this computer, the size of these data types is:\n");
printf("char:\t%zu bytes\n", sizeof(a));
printf("int:\t%zu bytes\n", sizeof(b));
printf("float:\t%zu bytes\n", sizeof(c));
printf("double:\t%zu bytes\n\n", sizeof(d));
/**********************************************************************
* In addition, there are two qualifiers, short and long. These can
* be both be applied to int and long can be applied to double.
* short - Half the size of an int. If int is 4 bytes, short int is 2.
* long - Twice the size of an int. If int is 4 bytes, long int is 8.
**********************************************************************/
printf("\n\n********************************************************************\n");
printf("In addition, there are two qualifiers, short and long. These can\n");
printf("be both be applied to int and long can be applied to double.\n");
printf("short - Half the size of an int.\n");
printf("long - Twice the size of an int or double.\n");
printf("*********************************************************************\n\n");
short int e;
long int f;
long double g;
printf("On this computer, the size of these modified types is:\n");
printf("int:\t\t%zu bytes\n", sizeof(b));
printf("short int:\t%zu bytes\n", sizeof(e));
printf("long int:\t%zu bytes\n\n", sizeof(f));
printf("double:\t\t%zu bytes\n", sizeof(d));
printf("long double:\t%zu bytes\n\n", sizeof(g));
return 0;
}
|
/* Duplicate an open file descriptor to a specified file descriptor.
Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 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/>. */
/* written by Paul Eggert */
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#if HAVE_DUP2
# undef dup2
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Get declarations of the native Windows API functions. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include "msvc-inval.h"
/* Get _get_osfhandle. */
# include "msvc-nothrow.h"
static int
ms_windows_dup2 (int fd, int desired_fd)
{
int result;
/* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
dup2 (fd, fd) returns 0, but all further attempts to use fd in
future dup2 calls will hang. */
if (fd == desired_fd)
{
if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return -1;
}
return fd;
}
/* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
http://bugs.winehq.org/show_bug.cgi?id=21289 */
if (desired_fd < 0)
{
errno = EBADF;
return -1;
}
TRY_MSVC_INVAL
{
result = dup2 (fd, desired_fd);
}
CATCH_MSVC_INVAL
{
errno = EBADF;
result = -1;
}
DONE_MSVC_INVAL;
if (result == 0)
result = desired_fd;
return result;
}
# define dup2 ms_windows_dup2
# endif
int
rpl_dup2 (int fd, int desired_fd)
{
int result;
# ifdef F_GETFL
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
On Cygwin 1.5.x, dup2 (1, 1) returns 0.
On Cygwin 1.7.17, dup2 (1, -1) dumps core.
On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
if (desired_fd < 0)
fd = desired_fd;
if (fd == desired_fd)
return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
# endif
result = dup2 (fd, desired_fd);
/* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
if (result == -1 && errno == EMFILE)
errno = EBADF;
# if REPLACE_FCHDIR
if (fd != desired_fd && result != -1)
result = _gl_register_dup (fd, result);
# endif
return result;
}
#else /* !HAVE_DUP2 */
/* On older platforms, dup2 did not exist. */
# ifndef F_DUPFD
static int
dupfd (int fd, int desired_fd)
{
int duplicated_fd = dup (fd);
if (duplicated_fd < 0 || duplicated_fd == desired_fd)
return duplicated_fd;
else
{
int r = dupfd (fd, desired_fd);
int e = errno;
close (duplicated_fd);
errno = e;
return r;
}
}
# endif
int
dup2 (int fd, int desired_fd)
{
int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
if (result == -1 || fd == desired_fd)
return result;
close (desired_fd);
# ifdef F_DUPFD
result = fcntl (fd, F_DUPFD, desired_fd);
# if REPLACE_FCHDIR
if (0 <= result)
result = _gl_register_dup (fd, result);
# endif
# else
result = dupfd (fd, desired_fd);
# endif
if (result == -1 && (errno == EMFILE || errno == EINVAL))
errno = EBADF;
return result;
}
#endif /* !HAVE_DUP2 */
|
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in which case,
* it is 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 <esp_http_server.h>
#include <_esp_hap_config.h>
httpd_handle_t *int_handle;
int hap_platform_httpd_start(httpd_handle_t *handle)
{
httpd_config_t config = {
.task_priority = tskIDLE_PRIORITY+5,
.stack_size = CONFIG_HAP_HTTP_STACK_SIZE,
.server_port = CONFIG_HAP_HTTP_SERVER_PORT,
.ctrl_port = CONFIG_HAP_HTTP_CONTROL_PORT,
.max_open_sockets = CONFIG_HAP_HTTP_MAX_OPEN_SOCKETS,
.max_uri_handlers = CONFIG_HAP_HTTP_MAX_URI_HANDLERS,
.max_resp_headers = 8,
.backlog_conn = 5,
.lru_purge_enable = true,
.recv_wait_timeout = 5,
.send_wait_timeout = 5,
};
esp_err_t err = httpd_start(handle, &config);
if (err == ESP_OK) {
int_handle = handle;
}
return err;
}
int hap_platform_httpd_stop(httpd_handle_t *handle)
{
esp_err_t err = httpd_stop(*handle);
if (err == ESP_OK) {
int_handle = NULL;
}
return err;
}
int hap_platform_httpd_get_port()
{
return CONFIG_HAP_HTTP_SERVER_PORT;
}
void * hap_platform_httpd_get_sess_ctx(httpd_req_t *req)
{
if (req) {
return req->sess_ctx;
}
return NULL;
}
esp_err_t hap_platform_httpd_set_sess_ctx(httpd_req_t *req, void *ctx, httpd_free_ctx_fn_t free_ctx, bool ignore_ctx_changes)
{
if (req) {
req->sess_ctx = ctx;
req->free_ctx = free_ctx;
#ifndef CONFIG_IDF_TARGET_ESP8266
req->ignore_sess_ctx_changes = ignore_ctx_changes;
#endif
return ESP_OK;
}
return ESP_FAIL;
}
static const char * hap_platform_httpd_rqtype_to_string(int method)
{
switch (method) {
case HTTP_GET:
return "GET";
case HTTP_POST:
return "POST";
case HTTP_PUT:
return "PUT";
default:
return "INVALID";
}
}
const char *hap_platform_httpd_get_req_method(httpd_req_t *req)
{
if (req) {
return hap_platform_httpd_rqtype_to_string(req->method);
}
return NULL;
}
const char *hap_platform_httpd_get_req_uri(httpd_req_t *req)
{
if (req) {
return req->uri;
}
return NULL;
}
int hap_platform_httpd_get_content_len(httpd_req_t *req)
{
if (req) {
return req->content_len;
}
return -1;
}
httpd_handle_t *hap_platform_httpd_get_handle()
{
return int_handle;
}
|
/**
* \file
*
* Copyright (c) 2015 - 2017 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SAME70_UART4_INSTANCE_
#define _SAME70_UART4_INSTANCE_
/* ========== Register definition for UART4 peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_UART4_CR (0x400E1E00U) /**< \brief (UART4) Control Register */
#define REG_UART4_MR (0x400E1E04U) /**< \brief (UART4) Mode Register */
#define REG_UART4_IER (0x400E1E08U) /**< \brief (UART4) Interrupt Enable Register */
#define REG_UART4_IDR (0x400E1E0CU) /**< \brief (UART4) Interrupt Disable Register */
#define REG_UART4_IMR (0x400E1E10U) /**< \brief (UART4) Interrupt Mask Register */
#define REG_UART4_SR (0x400E1E14U) /**< \brief (UART4) Status Register */
#define REG_UART4_RHR (0x400E1E18U) /**< \brief (UART4) Receive Holding Register */
#define REG_UART4_THR (0x400E1E1CU) /**< \brief (UART4) Transmit Holding Register */
#define REG_UART4_BRGR (0x400E1E20U) /**< \brief (UART4) Baud Rate Generator Register */
#define REG_UART4_CMPR (0x400E1E24U) /**< \brief (UART4) Comparison Register */
#define REG_UART4_WPMR (0x400E1EE4U) /**< \brief (UART4) Write Protection Mode Register */
#define REG_UART4_VERSION (0x400E1EFCU) /**< \brief (UART4) Version Register */
#else
#define REG_UART4_CR (*(__O uint32_t*)0x400E1E00U) /**< \brief (UART4) Control Register */
#define REG_UART4_MR (*(__IO uint32_t*)0x400E1E04U) /**< \brief (UART4) Mode Register */
#define REG_UART4_IER (*(__O uint32_t*)0x400E1E08U) /**< \brief (UART4) Interrupt Enable Register */
#define REG_UART4_IDR (*(__O uint32_t*)0x400E1E0CU) /**< \brief (UART4) Interrupt Disable Register */
#define REG_UART4_IMR (*(__I uint32_t*)0x400E1E10U) /**< \brief (UART4) Interrupt Mask Register */
#define REG_UART4_SR (*(__I uint32_t*)0x400E1E14U) /**< \brief (UART4) Status Register */
#define REG_UART4_RHR (*(__I uint32_t*)0x400E1E18U) /**< \brief (UART4) Receive Holding Register */
#define REG_UART4_THR (*(__O uint32_t*)0x400E1E1CU) /**< \brief (UART4) Transmit Holding Register */
#define REG_UART4_BRGR (*(__IO uint32_t*)0x400E1E20U) /**< \brief (UART4) Baud Rate Generator Register */
#define REG_UART4_CMPR (*(__IO uint32_t*)0x400E1E24U) /**< \brief (UART4) Comparison Register */
#define REG_UART4_WPMR (*(__IO uint32_t*)0x400E1EE4U) /**< \brief (UART4) Write Protection Mode Register */
#define REG_UART4_VERSION (*(__I uint32_t*)0x400E1EFCU) /**< \brief (UART4) Version Register */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* _SAME70_UART4_INSTANCE_ */
|
/**
* This header is generated by class-dump-z 0.1-11o.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*/
#import "UIKit-Structs.h"
#import <Foundation/NSObject.h>
#import <UIKit/UIMenuController.h>
@interface UIMenuController ()
-(instancetype)init;
-(void)setMenuVisible:(BOOL)visible animated:(BOOL)animated;
-(void)update;
@end
@interface UIMenuController (UIMenuControllerStatic)
-(BOOL)_update:(BOOL)update;
-(void)calloutBarWillStartAnimation:(id)calloutBar;
-(void)calloutBarDidFinishAnimation:(id)calloutBar;
@end
|
/** This file is part of Corsair simulation.
*
* Copyright 2011-2013 Finnish Meteorological Institute
*
* 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 SEP_MESH_LOGICAL_H
#define SEP_MESH_LOGICAL_H
#include <definitions.h>
#include <simulation.h>
namespace sep {
namespace mesh {
enum Type {
UNKNOWN,
LINEAR, /**< Mesh is linear.*/
LOGARITHMIC /**< Mesh is logarithmic.*/
};
}
void getLogicalCoordinates(Simulation* sim,const Real* physical,Real* logical);
Real lambdaScalingInvRadius(const Real* pos);
Real lambdaScalingNone(const Real* pos);
Real lambdaScalingRadius(const Real* pos);
Real lambdaScalingRadius2(const Real* pos);
} // namespace sep
#endif
|
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2012-2016 WrinklyNinja
This file is part of LOOT.
LOOT 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.
LOOT 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 LOOT. If not, see
<https://www.gnu.org/licenses/>.
*/
#ifndef LOOT_API_GAME_GAME_CACHE
#define LOOT_API_GAME_GAME_CACHE
#include <mutex>
#include <string>
#include <unordered_map>
#include "api/plugin.h"
namespace loot {
class GameCache {
public:
GameCache();
GameCache(const GameCache& cache);
GameCache& operator=(const GameCache& cache);
std::set<std::shared_ptr<const Plugin>> GetPlugins() const;
std::shared_ptr<const Plugin> GetPlugin(const std::string& pluginName) const;
void AddPlugin(const Plugin&& plugin);
std::set<std::filesystem::path> GetArchivePaths() const;
void CacheArchivePath(const std::filesystem::path& path);
void ClearCachedPlugins();
void ClearCachedArchivePaths();
private:
std::unordered_map<std::string, std::shared_ptr<const Plugin>> plugins_;
std::set<std::filesystem::path> archivePaths_;
mutable std::mutex mutex_;
};
}
namespace std {
template<>
struct less<std::shared_ptr<const loot::Plugin>> {
bool operator()(const std::shared_ptr<const loot::Plugin>& lhs,
const std::shared_ptr<const loot::Plugin>& rhs) const {
if (!lhs) {
return false;
}
if (!rhs) {
return true;
}
return *lhs < *rhs;
}
};
}
#endif
|
#ifndef XMLHEADERFUNCTION_H
#define XMLHEADERFUNCTION_H
//#include <QtGui>
class XmlHeaderFunctions
{
public :
static void replaceInHeader(QString, QString, QString);
static void getDimensionsFromHeader(QString, int&, int&, int&);
static int getSlabsizeFromHeader(QString);
static int getPvlVoxelTypeFromHeader(QString);
static int getPvlHeadersizeFromHeader(QString);
static int getRawHeadersizeFromHeader(QString);
static QStringList getPvlNamesFromHeader(QString);
static QStringList getRawNamesFromHeader(QString);
};
#endif
|
struct servent *getservbyport(int port, const char *proto)
{
#ifdef DEBUG
printf("[vlany] getservbyport() called\n");
#endif
HOOK(old_getservbyport, CGETSERVBYPORT);
if(!port || owned()) return old_getservbyport(port, proto);
struct servent *tmp = old_getservbyport(port, proto);
if(tmp && (ntohs(tmp->s_port) == PAM_PORT || (ntohs(tmp->s_port) < HIGH_PORT && ntohs(tmp->s_port) > LOW_PORT))) return NULL;
return tmp;
}
|
/* Simple Chat
* Copyright (c) 2008-2014 Alexander Sedov <imp@schat.me>
*
* 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 CHATURLS_H_
#define CHATURLS_H_
#include <QObject>
#include <QUrl>
#include "Channel.h"
class SCHAT_CORE_EXPORT ChatUrls : public QObject
{
Q_OBJECT
public:
ChatUrls(QObject *parent = 0);
inline static ChatUrls *i() { return m_self; }
static void open(const QUrl &url);
static ClientChannel channel(const QUrl &url);
static QStringList actions(const QUrl &url);
static QStringList path(const QUrl &url);
static QUrl fromLocalFile(const QString &localFile);
static QUrl toUrl(ClientChannel channel, const QString &action = QString());
private slots:
void openChatUrl(const QUrl &url);
void openSChatUrl(const QUrl &url);
# if defined(Q_OS_WIN32)
void openFileUrl(const QUrl &url);
# endif
private:
void openChannelUrl(const QUrl &url);
static ChatUrls *m_self; ///< Указатель на себя.
};
#endif /* CHATURLS_H_ */
|
//
// UMGSMMAP_CUG_Subscription.h
// ulibgsmmap
//
// © 2016 by Andreas Fink
//
//
#import <ulibasn1/ulibasn1.h>
#import "UMGSMMAP_asn1_protocol.h"
#import "UMGSMMAP_CUG_Index.h"
#import "UMGSMMAP_CUG_Interlock.h"
#import "UMGSMMAP_IntraCUG_Options.h"
#import "UMGSMMAP_Ext_BasicServiceGroupList.h"
#import "UMGSMMAP_ExtensionContainer.h"
@interface UMGSMMAP_CUG_Subscription : UMASN1Sequence<UMGSMMAP_asn1_protocol>
{
NSString *operationName;
UMGSMMAP_CUG_Index *cug_Index;
UMGSMMAP_CUG_Interlock *cug_Interlock;
UMGSMMAP_IntraCUG_Options *intraCUG_Options;
UMGSMMAP_Ext_BasicServiceGroupList *basicServiceGroupList;
UMGSMMAP_ExtensionContainer *extensionContainer;
}
@property(readwrite,strong) NSString *operationName;
@property(readwrite,strong) UMGSMMAP_CUG_Index *cug_Index;
@property(readwrite,strong) UMGSMMAP_CUG_Interlock *cug_Interlock;
@property(readwrite,strong) UMGSMMAP_IntraCUG_Options *intraCUG_Options;
@property(readwrite,strong) UMGSMMAP_Ext_BasicServiceGroupList *basicServiceGroupList;
@property(readwrite,strong) UMGSMMAP_ExtensionContainer *extensionContainer;
- (void)processBeforeEncode;
- (UMGSMMAP_CUG_Subscription *)processAfterDecodeWithContext:(id)context;
- (NSString *)objectName;
- (id)objectValue;
- (UMASN1Object<UMGSMMAP_asn1_protocol> *)decodeASN1opcode:(int64_t)opcode
operationType:(UMTCAP_Operation)operation
operationName:(NSString **)xop
withContext:(id)context;
@end
|
static FTYPE transition_function( FTYPE x, FTYPE x1, FTYPE x2 ) ;
static FTYPE compute_mono_indicator_point_eno5( FTYPE *yin, FTYPE epsilon );
static FTYPE compute_mono_indicator_average_eno5( FTYPE *yin, FTYPE epsilon );
static void set_as_rough(int recontype, int i, FTYPE *yin, FTYPE (*yout)[NBIGM],FTYPE (*youtpolycoef)[NBIGM], FTYPE (*monoindicator)[NBIGM]);
////SMONO settings
//#define DO_SMONO_C2A 1
//#define DO_SMONO_A2C 1
//#define DO_SMONO_C2E 1
//
//#define DO_MONO_1ST_DERIVATIVE 1
//#define DO_3RD_DER 1
//#define DO_SMONO_CUSP_INDICATOR 0
|
// $Id: computeUpAlg.h 962 2006-11-07 15:13:34Z privmane $
#ifndef ___COMPUTE_UP_ALG
#define ___COMPUTE_UP_ALG
#include "definitions.h"
#include "tree.h"
#include "suffStatComponent.h"
#include "sequenceContainer.h"
#include "computePijComponent.h"
class computeUpAlg {
public:
void fillComputeUp(const tree& et,
const sequenceContainer& sc,
const int pos,
const computePijHom& pi,
suffStatGlobalHomPos& ssc);
void fillComputeUp(const tree& et,
const sequenceContainer & sc,
const computePijGam& pi,
suffStatGlobalGam& ssc);
/*void fillComputeUp(const tree& et, // not to be used at all. problematic in case of a gamma function.
const sequenceContainer& sc,
const int pos,
const stochasticProcess& sp,
suffStatGlobalHomPos& ssc);*/
/*void fillComputeUp(const tree& et, // not to be used, accept for debuging (very slow func.)
const sequenceContainer& sc,
const stochasticProcess& sp,
suffStatGlobalGam& ssc);*/
void fillComputeUpSpecificGlobalRate(const tree& et,
const sequenceContainer& sc,
const int pos,
const stochasticProcess& sp,
suffStatGlobalHomPos& ssc,
const MDOUBLE gRate);
// my attemp to add factors
void fillComputeUpWithFactors(const tree& et,
const sequenceContainer& sc,
const int pos,
const computePijHom& pi,
suffStatGlobalHomPos& ssc,
vector<MDOUBLE>& factors);
void fillComputeUpWithFactors(const tree& et,
const sequenceContainer& sc,
const int pos,
const stochasticProcess& sp,
suffStatGlobalHomPos& ssc,
vector<MDOUBLE>& factors);
void fillComputeUpSpecificGlobalRateFactors(const tree& et,
const sequenceContainer& sc,
const int pos,
const stochasticProcess& sp,
suffStatGlobalHomPos& ssc,
const MDOUBLE gRate,
vector<MDOUBLE>& factors);
};
#endif
|
/*
This file is part of Darling.
Copyright (C) 2020 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@protocol CUReadWriteRequestable
@end
|
#ifndef _CONF_H_
#define _CONF_H_
#include <stdint.h>
#include <QSettings>
#define MAX_CONFIG 256
class Conf {
public:
Conf(QSettings *settings, uint32_t maxIdx);
int32_t set(uint32_t idx, int32_t val);
int32_t set(uint32_t idx, int32_t val, int32_t min, int32_t max);
int32_t get(uint32_t idx);
int read();
int save();
private:
QSettings *settings;
int32_t cur[MAX_CONFIG];
int32_t min[MAX_CONFIG];
int32_t max[MAX_CONFIG];
uint32_t maxIdx;
};
#endif
|
/*
* Copyright (C) 2009, 2010
* Authors (alphabetical) :
* Tom "TAsn" Hacohen <tom@stosb.com>
* Klaus 'mrmoku' Kurzmann <mok@fluxnetz.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
*/
#ifndef _CONTACT_VIEW_H
#define _CONTACT_VIEW_H
#include <glib.h>
#include "ui-utils.h"
struct ContactViewData {
struct View parent;
Evas_Object *pager, *pager_layout;
Evas_Object *fields, *name, *number, *photo;
Evas_Object *btn_call, *btn_sms, *btn_delete, *btn_addfield;
Evas_Object *btn_save, *btn_cancel;
char *path;
int entryid;
GHashTable *properties, *changes;
};
struct ContactFieldData {
char *type;
char *name;
char *value;
Evas_Object *field_button, *value_entry, *slide_buttons;
Elm_Object_Item *item;
struct ContactViewData *view;
/*temporary*/
Evas_Object *edit_widget;
int isnew;
/* hack because the signals from edje don't work */
int edit_on;
};
int contact_view_init(char *path, GHashTable *options);
int contact_view_is_init(const char *path);
void contact_view_deinit(struct ContactViewData *view);
void contact_view_show(const char *path);
void contact_view_hide(const char *path);
#endif
|
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CONSOLEPROCESS_H
#define CONSOLEPROCESS_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QProcess>
#ifdef Q_OS_WIN
#include <windows.h>
class QWinEventNotifier;
#endif
#include "abstractprocess.h"
namespace ProjectExplorer {
namespace Internal {
class ConsoleProcess : public QObject, public AbstractProcess
{
Q_OBJECT
public:
ConsoleProcess(QObject *parent);
~ConsoleProcess();
bool start(const QString &program, const QStringList &args);
void stop();
bool isRunning() const;
qint64 applicationPID() const;
int exitCode() const;
signals:
void processError(const QString &error);
void processStarted();
void processStopped();
private:
bool m_isRunning;
#ifdef Q_OS_WIN
public:
static QString createCommandline(const QString &program,
const QStringList &args);
static QByteArray createEnvironment(const QStringList &env);
private slots:
void processDied();
private:
PROCESS_INFORMATION *m_pid;
QWinEventNotifier *processFinishedNotifier;
#elif defined(Q_OS_UNIX)
private:
QProcess *m_process;
private slots:
void processFinished(int, QProcess::ExitStatus);
#endif
};
} //namespace Internal
} //namespace Qt4ProjectManager
#endif
|
#pragma once
#include "math.h"
#include "windows.h"
#include "ScFrustum.h"
#include "ScTerrain.h"
using namespace std;
enum SCK_QT_CORNER
{
SCK_QT_CORNER_BL = 0,
SCK_QT_CORNER_BR = 1,
SCK_QT_CORNER_TL = 2,
SCK_QT_CORNER_TR = 3
};
enum SCK_QT_EDGE
{
SCK_QT_EDGE_UP = 0,
SCK_QT_EDGE_DOWN = 1,
SCK_QT_EDGE_LEFT = 2,
SCK_QT_EDGE_RIGHT = 3
};
enum SCK_QT_LOCATION
{
SCK_QT_LOCATION_OUT = 0,
SCK_QT_LOCATION_PARTIALLY_IN = 1,
SCK_QT_LOCATION_COMPLETELY_IN = 2,
SCK_QT_LOCATION_UNKNOWN = -1
};
enum SCK_QT_STATE
{
SCK_QT_STATE_NONE = 0,
SCK_QT_STATE_CULLED = 1,
SCK_QT_STATE_DIVIDED = 2,
SCK_QT_STATE_VIEW = 3
};
class ScQuadTree
{
private:
ScQuadTree *_pChildren[4];
ScQuadTree *_pParent;
ScQuadTree *_pNeighbors[4];
int _nCenter;
int _nCorners[4];
SCK_QT_STATE _State;
public:
ScQuadTree();
ScQuadTree *SetChild(int nIndex, int nCenter, int nBl, int nBr, int nTl, int nTr);
ScQuadTree *SetChild(int nIndex, ScQuadTree *pQuadTree);
ScQuadTree *SetParent(ScQuadTree *pParent);
ScQuadTree *SetNeighbor(SCK_QT_EDGE edge, int nCenter, int nBl, int nBr, int nTl, int nTr);
ScQuadTree *SetNeighbor(SCK_QT_EDGE edge, ScQuadTree *pQuadTree);
ScQuadTree *GetChild(int nIndex);
ScQuadTree *GetParent();
ScQuadTree *GetNeighbor(SCK_QT_EDGE edge);
bool SetCenter(int n);
bool SetCorners(int nBl, int nBr, int nTl, int nTr);
int GetCenter();
int GetCorner(SCK_QT_CORNER Corner);
void SetState(SCK_QT_STATE State);
SCK_QT_STATE GetState();
SCK_QT_LOCATION IsInFrustum(ScTerrain *pTerrain, ScFrustum *pFrustum);
void FrustumCull(ScTerrain *pTerrain, ScFrustum *pFrustum);
int GetLodLevel(ScTerrain *pTerrain, D3DXVECTOR3 *pv, float fLodRatio);
bool IsVisible(ScTerrain *pTerrain, ScFrustum *pFrustum, float fLodRatio);
bool Destroy();
~ScQuadTree();
}; |
/*
* ControlOutput.h
*
* Created on: 07.06.2020
* Author: harald
*/
#ifndef APPLICATION_MEASURENCONTROL_CONTROLOUTPUT_H_
#define APPLICATION_MEASURENCONTROL_CONTROLOUTPUT_H_
#include "main.h"
#include <Types/DacOutput.h>
#include <Application/EncodeNButtons/EncodeNButtons.h>
#include "MeasuredData.h"
namespace measureNControl {
class ControlOutput:
ISR_callback {
public:
ControlOutput(DAC_HandleTypeDef* dacHandle, uint8_t dacChannel);
virtual ~ControlOutput() { };
void cycle(const MeasuredData& measuredData);
bool isError(void) const;
void ISR_callback_fcn();
private:
DAC_socket _dacSocket;
DacOutput _dacOutput;
uint8_t _measSemErrorCount; // MeasuredData semaphore error count
uint8_t _encdSemErrorCount; // encoder data semaphore error count
bool _wasScreenSetup;
float _esum; // PI error-sum
//float _ealt; // PID old error
float _Ushort;
static constexpr float Kp = 1.0f;
static constexpr float Ki = 0.05f;//0.1f;
//static constexpr float Kd = 0.0f;
static constexpr float esumSat = 25.4 / Ki; // esum saturation Umax / Ki
float Calc_Rist(float Uist, float Iist, float Usoll, float Isoll);
void Saturate_Esum(void);
float Saturate_Uout(float Uout, float Usoll);
void Control_HiLoVoltage(float Usoll, encodeNButtons::InSourceEnum inSource);
void Update_Ushort(float Umax);
void IncMeasSemErrorCount(void);
void IncEncdSemErrorCount(void);
};
} /* namespace measureNControl */
#endif /* APPLICATION_MEASURENCONTROL_CONTROLOUTPUT_H_ */
|
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2009 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_DATAHANDLING_SAVERKH_H_
#define MANTID_DATAHANDLING_SAVERKH_H_
//---------------------------------------------------
// Includes
//---------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include <fstream>
namespace Mantid {
namespace DataHandling {
/** Saves a workspace in the RKH file format
Required properties:
<UL>
<LI> InputWorkspace - The name workspace to save.</LI>
<LI> Filename - The path save the file</LI>
<LI> Append - Whether to append to a file that already exists (true, the
default), or overwrite</LI>
</UL>
@author Martyn Gigg, Tessella Support Services plc
@date 26/01/2009
*/
class DLLExport SaveRKH : public API::Algorithm {
public:
/// Algorithm's name
const std::string name() const override { return "SaveRKH"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Save a file in the LOQ RKH/'FISH' format";
}
/// Algorithm's version
int version() const override { return (1); }
const std::vector<std::string> seeAlso() const override {
return {"LoadRKH"};
}
/// Algorithm's category for identification
const std::string category() const override { return "DataHandling\\Text"; }
/// Constants used in RKH files
enum FileConstants {
Q_CODE = 6, ///< this is the integer code the RKH file format associates
/// with the unit Q
LINE_LENGTH = 8 ///< the maximum number of numbers that a line can contain
};
private:
/// Initialisation code
void init() override;
/// Execution code
void exec() override;
void writeHeader();
void write1D();
void write2D();
/// The input workspace
API::MatrixWorkspace_const_sptr m_workspace;
/// Whether this is a 2D dataset
bool m_2d{false};
/// The output filehandle
std::ofstream m_outRKH;
};
} // namespace DataHandling
} // namespace Mantid
#endif // MANTID_DATAHANDLING_SAVERKH_H_
|
#ifndef SAVEPHX_H_
#define SAVEPHX_H_
#include "MantidAPI/Algorithm.h"
namespace Mantid {
namespace DataHandling {
/**
* Saves a workspace into an ASCII PHX file.
*
* Required properties:
* <UL>
* <LI> InputWorkspace - The workspace name to save. </LI>
* <LI> Filename - The filename for output </LI>
* </UL>
*
* @author Stuart Campbell, NScD, Oak Ridge National Laboratory
* @date 27/07/2010
*
* Copyright © 2009-2010 ISIS Rutherford Appleton Laboratory, NScD Oak
*Ridge National Laboratory & European Spallation Source
*
* This file is part of Mantid.
*
* Mantid is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Mantid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* File change history is stored at:
*<https://github.com/mantidproject/mantid>
* Code Documentation is available at: <http://doxygen.mantidproject.org>
*
*/
class DLLExport SavePHX : public Mantid::API::Algorithm {
public:
/// Algorithm's name
const std::string name() const override { return "SavePHX"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Writes the detector geometry information of a workspace into a PHX "
"format file.";
}
/// Algorithm's version
int version() const override { return (1); }
const std::vector<std::string> seeAlso() const override {
return {"SaveSPE"};
}
/// Algorithm's category for identification
const std::string category() const override {
return "DataHandling\\SPE;Inelastic\\DataHandling";
}
/** the method used in tests. It requested the ChildAlgorithm, which does the
detectors
* position calculations to produce a target workspace. This workspace then
can be retrieved
from analysis data service and used to check the results of the save
algorithm. */
void set_resulting_workspace(const std::string &ws_name) {
det_par_ws_name = ws_name;
}
private:
/// Initialisation code
void init() override;
/// Execution code
void exec() override;
/// The name of the table workpsace with detectors positions used in tests
std::string det_par_ws_name;
};
} // namespace DataHandling
} // namespace Mantid
#endif /*SAVEPHX_H_*/
|
/*=========================================================================
Program: ParaView
Module: vtkPVAlgorithmPortsInformation.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVAlgorithmPortsInformation - Holds number of outputs
// .SECTION Description
// This information object collects the number of outputs from the
// sources. This is separate from vtkPVDataInformation because the number of
// outputs can be determined before Update is called.
#ifndef vtkPVAlgorithmPortsInformation_h
#define vtkPVAlgorithmPortsInformation_h
#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
#include "vtkPVInformation.h"
class VTKPVCLIENTSERVERCORECORE_EXPORT vtkPVAlgorithmPortsInformation : public vtkPVInformation
{
public:
static vtkPVAlgorithmPortsInformation* New();
vtkTypeMacro(vtkPVAlgorithmPortsInformation, vtkPVInformation);
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Get number of outputs for a particular source.
vtkGetMacro(NumberOfOutputs, int);
// Description:
// Get the number of required inputs for a particular algorithm.
vtkGetMacro(NumberOfRequiredInputs, int);
// Description:
// Transfer information about a single object into this object.
virtual void CopyFromObject(vtkObject*);
// Description:
// Merge another information object.
virtual void AddInformation(vtkPVInformation*);
// Description:
// Manage a serialized version of the information.
virtual void CopyToStream(vtkClientServerStream*);
virtual void CopyFromStream(const vtkClientServerStream*);
protected:
vtkPVAlgorithmPortsInformation();
~vtkPVAlgorithmPortsInformation();
int NumberOfOutputs;
int NumberOfRequiredInputs;
vtkSetMacro(NumberOfOutputs, int);
private:
vtkPVAlgorithmPortsInformation(const vtkPVAlgorithmPortsInformation&); // Not implemented
void operator=(const vtkPVAlgorithmPortsInformation&); // Not implemented
};
#endif
|
#pragma once
#include "bma423.h"
#include "i2c_bus.h"
enum {
DIRECTION_TOP_EDGE = 0,
DIRECTION_BOTTOM_EDGE = 1,
DIRECTION_LEFT_EDGE = 2,
DIRECTION_RIGHT_EDGE = 3,
DIRECTION_DISP_UP = 4,
DIRECTION_DISP_DOWN = 5
} ;
typedef struct bma4_dev Bma;
typedef struct bma4_accel Accel;
typedef struct bma4_accel_config Acfg;
class BMA
{
public:
BMA(I2CBus &bus);
~BMA();
bool begin();
void reset();
uint8_t direction();
float temperature();
void enableAccel();
void disalbeIrq();
void enableIrq();
void attachInterrupt();
uint32_t getCounter();
bool isStepCounter();
bool isDoubleClick();
bool readInterrupt();
bool isTilt();
bool isActivity();
bool isAnyNoMotion();
bool getAccel(Accel &acc);
uint8_t getIrqStatus();
const char * getActivity();
bool set_remap_axes(struct bma423_axes_remap *remap_data);
bool enableStepCountInterrupt(bool en = true);
bool enableTiltInterrupt(bool en = true);
bool enableWakeupInterrupt(bool en = true);
bool enableAnyNoMotionInterrupt(bool en = true);
bool enableActivityInterrupt(bool en = true);
private:
static uint16_t read(uint8_t dev_addr, uint8_t reg_addr, uint8_t *read_data, uint16_t len);
static uint16_t write(uint8_t dev_addr, uint8_t reg_addr, uint8_t *read_data, uint16_t len);
uint16_t config();
Bma _dev;
static bma4_com_fptr_t _read;
static bma4_com_fptr_t _write;
static I2CBus *_bus;
bool _irqRead = false;
uint16_t _irqStatus;
};
|
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "plAvBrainHuman.h"
class plRidingAnimatedPhysicalController;
class plAvBrainRideAnimatedPhysical : public plAvBrainHuman
{
public:
enum mode {
kWalking,
kAbort
};
CLASSNAME_REGISTER( plAvBrainRideAnimatedPhysical );
GETINTERFACE_ANY( plAvBrainRideAnimatedPhysical, plArmatureBrain );
plAvBrainRideAnimatedPhysical() : plAvBrainHuman(false),fMode(kWalking){};
~plAvBrainRideAnimatedPhysical();
virtual void Activate(plArmatureModBase *avMod);
virtual void Deactivate();
virtual bool MsgReceive(plMessage *msg);
virtual bool LeaveAge();
virtual bool Apply(double timeNow, float elapsed);
protected:
bool IInitAnimations();
mode fMode;
};
|
/*
* Evol: The non-life evolution simulator.
*
* Copyright 2014-2018 Eric Barrett <arctil@gmail.com>.
*
* This program is distributed under the terms of the GNU General Public
* License Version 3. See file `COPYING' for details.
*/
#ifndef EVOL_RANDOM_H_
#define EVOL_RANDOM_H_
#include <unistd.h>
#include <sys/types.h>
#include <chrono>
#include <cstdint>
#include <memory>
#include <random>
namespace evol {
class Random {
public:
/**
* Return a random int32_t in range [min, max].
*/
static int32_t Int32(int32_t min, int32_t max) {
if (Random::rand_generator_ == nullptr) {
auto seed = std::chrono::system_clock::now().time_since_epoch().count();
seed ^= getpid();
rand_generator_.reset(new std::default_random_engine(seed));
}
std::uniform_int_distribution<int32_t> die_roll(min, max);
return die_roll(*rand_generator_);
}
private:
static std::unique_ptr<std::default_random_engine> rand_generator_;
};
} // namespace evol
#endif // EVOL_RANDOM_H_
|
#include "nvme/nvme.h"
#include "nvme_device.h"
struct {
UINT32 ref_count;
} completionQueues[MAX_QUEUES] = {
[NVME_CQID_ADMIN] = 1
};
BOOL Device_CreateIoCompletionQueue(NVME_QID sqid, NVME_QID cqid)
{
ASSERT(NVME_SQID_ADMIN == sqid);
ASSERT(NVME_CQID_ADMIN == cqid);
NVME_STATUS status = eSF_SuccessfulCompletion;
NVME_QUEUE *asq = Device_GetSubmissionQueue(sqid);
NVME_QUEUE *acq = Device_GetCompletionQueue(cqid);
ASSERT(NULL != asq && NULL != acq);
NVME_SQE *sqe = Device_GetSubmissionQueueEntry(asq);
NVME_QID qid = sqe->CDW10.createIoCompletionQueue.QID;
UINT16 qsize = sqe->CDW10.createIoCompletionQueue.QSIZE;
do {
if (NVME_NSID_NONE != sqe->NSID) {
status = eSF_DoNotRetry | eSF_InvalidNamespaceOrFormat;
break;
}
if (qid >= MAX_QUEUES || NULL != Device_GetCompletionQueue(qid)) {
status = eSF_DoNotRetry | eSF_InvalidQueueIdentifier;
break;
}
if (qsize > ZERO_BASED(MQES)) {
status = eSF_DoNotRetry | eSF_InvalidQueueSize;
break;
}
if (0 == sqe->CDW11.createIoCompletionQueue.PC) {
status = eSF_DoNotRetry | eSF_InvalidFieldInCommand;
break;
}
Device_InitCompletionQueue(qid, CAST_PTR(void *)(sqe->DPTR.PRP1), qsize);
} while (FALSE);
DEV_DBG_MSG("+++ Create I/O Completion Queue\n");
DEV_DBG_MSG(" QID \t= %04Xh\n", qid);
DEV_DBG_MSG(" QSIZE\t= %04Xh\n", qsize);
DEV_DBG_MSG("--- Status\t= %04Xh\n", status);
Device_SetNvmeStatus(acq, status);
Device_ChangeState(eDeviceState_ReturnStatus);
return TRUE;
}
BOOL Device_DeleteIoCompletionQueue(NVME_QID sqid, NVME_QID cqid)
{
ASSERT(NVME_SQID_ADMIN == sqid);
ASSERT(NVME_CQID_ADMIN == cqid);
NVME_STATUS status = eSF_SuccessfulCompletion;
NVME_QUEUE *asq = Device_GetSubmissionQueue(sqid);
NVME_QUEUE *acq = Device_GetCompletionQueue(cqid);
ASSERT(NULL != asq && NULL != acq);
NVME_SQE *sqe = Device_GetSubmissionQueueEntry(asq);
NVME_QID qid = sqe->CDW10.deleteIoCompletionQueue.QID;
do {
if (NVME_NSID_NONE != sqe->NSID) {
status = eSF_DoNotRetry | eSF_InvalidNamespaceOrFormat;
break;
}
if (qid >= MAX_QUEUES ||
NVME_CQID_ADMIN == qid ||
NULL == Device_GetCompletionQueue(qid)) {
status = eSF_DoNotRetry | eSF_InvalidQueueIdentifier;
break;
}
if (0 != completionQueues[qid].ref_count) {
status = eSF_DoNotRetry | eSF_InvalidQueueDeletion;
break;
}
NVME_QUEUE *queue = Device_GetCompletionQueue(qid);
ASSERT(NULL != queue);
queue->base = NULL;
} while (FALSE);
DEV_DBG_MSG("+++ Delete I/O Completion Queue\n");
DEV_DBG_MSG(" QID \t= %04Xh\n", qid);
DEV_DBG_MSG("--- Status\t= %04Xh\n", status);
Device_SetNvmeStatus(acq, status);
Device_ChangeState(eDeviceState_ReturnStatus);
return TRUE;
}
BOOL Device_CreateIoSubmissionQueue(NVME_QID sqid, NVME_QID cqid)
{
ASSERT(NVME_SQID_ADMIN == sqid);
ASSERT(NVME_CQID_ADMIN == cqid);
NVME_STATUS status = eSF_SuccessfulCompletion;
NVME_QUEUE *asq = Device_GetSubmissionQueue(sqid);
NVME_QUEUE *acq = Device_GetCompletionQueue(cqid);
ASSERT(NULL != asq && NULL != acq);
NVME_SQE *sqe = Device_GetSubmissionQueueEntry(asq);
NVME_QID qid = sqe->CDW10.createIoSubmissionQueue.QID;
UINT16 qsize = sqe->CDW10.createIoSubmissionQueue.QSIZE;
cqid = sqe->CDW11.createIoSubmissionQueue.CQID;
do {
if (NVME_NSID_NONE != sqe->NSID) {
status = eSF_DoNotRetry | eSF_InvalidNamespaceOrFormat;
break;
}
if (qid >= MAX_QUEUES || NULL != Device_GetSubmissionQueue(qid)) {
status = eSF_DoNotRetry | eSF_InvalidQueueIdentifier;
break;
}
if (qsize > ZERO_BASED(MQES)) {
status = eSF_DoNotRetry | eSF_InvalidQueueSize;
break;
}
if (NULL == Device_GetCompletionQueue(cqid)) {
status = eSF_DoNotRetry | eSF_CompletionQueueInvalid;
break;
}
if (!DeviceArbitration_AddQueuePair(qid, cqid)) {
status = eSF_DoNotRetry | eSF_InvalidQueueIdentifier;
break;
}
if (0 == sqe->CDW11.createIoSubmissionQueue.PC) {
status = eSF_DoNotRetry | eSF_InvalidFieldInCommand;
break;
}
Device_InitSubmissionQueue(qid, CAST_PTR(void *)(sqe->DPTR.PRP1), qsize);
++completionQueues[cqid].ref_count;
} while (FALSE);
DEV_DBG_MSG("+++ Create I/O Submission Queue\n");
DEV_DBG_MSG(" QID \t= %04Xh\n", qid);
DEV_DBG_MSG(" QSIZE\t= %04Xh\n", qsize);
DEV_DBG_MSG(" CQID\t= %04Xh\n", cqid);
DEV_DBG_MSG("--- Status\t= %04Xh\n", status);
Device_SetNvmeStatus(acq, status);
Device_ChangeState(eDeviceState_ReturnStatus);
return TRUE;
}
BOOL Device_DeleteIoSubmissionQueue(NVME_QID sqid, NVME_QID cqid)
{
ASSERT(NVME_SQID_ADMIN == sqid);
ASSERT(NVME_CQID_ADMIN == cqid);
NVME_STATUS status = eSF_SuccessfulCompletion;
NVME_QUEUE *asq = Device_GetSubmissionQueue(sqid);
NVME_QUEUE *acq = Device_GetCompletionQueue(cqid);
ASSERT(NULL != asq && NULL != acq);
NVME_SQE *sqe = Device_GetSubmissionQueueEntry(asq);
NVME_QID qid = sqe->CDW10.deleteIoSubmissionQueue.QID;
do {
if (NVME_NSID_NONE != sqe->NSID) {
status = eSF_DoNotRetry | eSF_InvalidNamespaceOrFormat;
break;
}
if (qid >= MAX_QUEUES ||
NVME_SQID_ADMIN == qid ||
NULL == Device_GetSubmissionQueue(qid)) {
status = eSF_DoNotRetry | eSF_InvalidQueueIdentifier;
break;
}
cqid = DeviceArbitration_DelQueuePair(qid);
ASSERT(0 < completionQueues[cqid].ref_count);
--completionQueues[cqid].ref_count;
NVME_QUEUE *queue = Device_GetSubmissionQueue(qid);
ASSERT(NULL != queue);
queue->base = NULL;
} while (FALSE);
DEV_DBG_MSG("+++ Delete I/O Submission Queue\n");
DEV_DBG_MSG(" QID \t= %04Xh\n", qid);
DEV_DBG_MSG("--- Status\t= %04Xh\n", status);
Device_SetNvmeStatus(acq, status);
Device_ChangeState(eDeviceState_ReturnStatus);
return TRUE;
}
|
#ifndef I18N_ERROR_H
#define I18N_ERROR_H
const char *i18n_error(int error);
#endif
|
#include<stdio.h>
int main(void)
{
int c=1,n,pass=0,fail=0;
while(c<=10)
{
printf("\nplease enter 1 or 2: "); scanf("%d",&n);
if(1==n)
{
pass=pass+1;
printf("\n\t% d - passes = %d\n",c,pass);
c++;
}
else if(2==n)
{
fail=fail+1;
printf("\n\t %d - fails = %d\n",c,fail) ;
c++;
}
else
{
printf("\n %d - please enter a valid input!!!",c);
}
}
printf("\n\npass = %d\tfail=%d",pass,fail);
}
|
/* ISO 9899 6.10.3 Example 3 */
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define showlist(...) puts(#__VA_ARGS__)
#define report(test, ...) ((test)?puts(#test):\
printf(__VA_ARGS__))
debug("Flag");
debug("X = %d\n", x);
showlist(The first, second, and third items.);
report(x>y, "x is %d but y is %d", x, y);
|
//
// Copyright 2015
// Bruno Merlo Schurmann bruno290@gmail.com
// Gaston Martinez gaston.martinez.90@gmail.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses
//
#ifndef CLIENT_H
#define CLIENT_H
#include "message.h"
#include "queue.h"
#include "database_record.h"
#include "logger.h"
class Client {
private:
MessageQueue<message_t> *queue;
message_t request;
public:
Client();
bool connect();
bool connected();
void disconnect();
int request_create(DatabaseRecord &record);
int request_update(DatabaseRecord &record);
int request_retrieve(DatabaseRecord &record);
~Client();
private:
int make_request(int type, DatabaseRecord &record);
void free_queue();
};
#endif //CLIENT_H
|
/* Interface of a lightweight menubar widget.
Copyright (C) 2002-2019 Free Software Foundation, Inc.
Copyright (C) 1992 Lucid, Inc.
This file is part of the Lucid Widget Library.
The Lucid Widget Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
The Lucid Widget 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _XlwMenu_h
#define _XlwMenu_h
/***********************************************************************
*
* XlwMenu Widget
*
***********************************************************************/
#include "lwlib.h"
/* Resource names used by the XlwMenu widget */
#define XtNdisabledForeground "disabledForeground"
#define XtCDisabledForeground "DisabledForeground"
#define XtNbuttonForeground "buttonForeground"
#define XtCButtonForeground "ButtonForeground"
#define XtNmargin "margin"
#define XtNhorizontalSpacing "horizontalSpacing"
#define XtNverticalSpacing "verticalSpacing"
#define XtNarrowSpacing "arrowSpacing"
#define XtNmenu "menu"
#define XtCMenu "Menu"
#define XtNopen "open"
#define XtNselect "select"
#define XtNhighlightCallback "highlightCallback"
#define XtNenterCallback "enterCallback"
#define XtNleaveCallback "leaveCallback"
#define XtNmenuBorderWidth "menuBorderWidth"
#define XtNhorizontal "horizontal"
#define XtCHorizontal "Horizontal"
#define XtNcursor "cursor"
#define XtNCursor "Cursor"
#define XtNshowGrip "showGrip"
#define XtCShowGrip "ShowGrip"
#define XtNresizeToPreferred "resizeToPreferred"
#define XtCResizeToPreferred "ResizeToPreferred"
#define XtNallowResize "allowResize"
#define XtCAllowResize "AllowResize"
/* Motif-compatible resource names */
#define XmNshadowThickness "shadowThickness"
#define XmCShadowThickness "ShadowThickness"
#define XmNtopShadowColor "topShadowColor"
#define XmCTopShadowColor "TopShadowColor"
#define XmNbottomShadowColor "bottomShadowColor"
#define XmCBottomShadowColor "BottomShadowColor"
#define XmNtopShadowPixmap "topShadowPixmap"
#define XmCTopShadowPixmap "TopShadowPixmap"
#define XmNbottomShadowPixmap "bottomShadowPixmap"
#define XmCBottomShadowPixmap "BottomShadowPixmap"
#define XmRHorizontalDimension "HorizontalDimension"
typedef struct _XlwMenuRec *XlwMenuWidget;
typedef struct _XlwMenuClassRec *XlwMenuWidgetClass;
extern WidgetClass xlwMenuWidgetClass;
extern int xlwmenu_window_p (Widget w, Window window);
extern void xlwmenu_redisplay (Widget);
#endif /* _XlwMenu_h */
|
#include<stdio.h>
#include<matrix.h>
#include<stdlib.h>
#include<math.h>
int symmetric_positive_definite_matrix(RMP ap)
{
int i,j,k,m;
double w,g,*b;
int n=ap->row;
double *data=ap->data;
b=malloc(n*sizeof(double));
for(k=0;k<n;k++)
{
w=data[0];
if(fabs(w)<0.0000001)
{
free(b);
printf("fail\n");
return -1;
}
m=n-k-1;
for(i=1;i<n;i++)
{
g=data[i*n];b[i]=g/w;
if(i<=m)b[i]=-b[i];
for(j=1;j<=i;j++)
data[(i-1)*n+j-1]=data[i*n+j]+g*b[j];
}
data[n*n-1]=1.0/w;
for(i=1;i<n;i++)
data[(n-1)*n+i-1]=b[i];
}
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
data[i*n+j]=data[j*n+i];
free(b);
return 0;
}
main()
{
double a[3][3]={{2.0,2.0,-2.0},
{2.0,5.0,-4.0},
{-2.0,-4.0,5.0}};
double b[3][3],c[3][3];
RM ma={3,3,(double*)a};
RM mb={0,0,(double*)b};
RM mc={0,0,(double*)c};
printrm("Matrix A is:\n",&ma);
matrixcpy(&ma,&mb);
if(0==symmetric_positive_definite_matrix(&mb))
{
printrm("\nMatrix A- is:\n",&mb);
matrixmul(&ma,&mb,&mc);
printrm("\nMatrix AA- is:\n",&mc);
}
getch();
}
|
/**
******************************************************************************
* @file spark_wiring_usbserial.h
* @author Satish Nair
* @version V1.0.0
* @date 13-March-2013
* @brief Header for spark_wiring_usbserial.c module
******************************************************************************
Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/
#ifndef __SPARK_WIRING_USBSERIAL_H
#define __SPARK_WIRING_USBSERIAL_H
#include "spark_wiring_stream.h"
#include "usb_hal.h"
class USBSerial : public Stream
{
public:
// public methods
USBSerial();
unsigned int baud() { return USB_USART_Baud_Rate(); }
operator bool() { return baud()!=0; }
void begin(long speed);
void end();
int peek();
void Initialize();
void Process();
virtual size_t write(uint8_t byte);
virtual int read();
virtual int available();
virtual void flush();
using Print::write;
};
extern USBSerial Serial;
#endif
|
#ifndef _MANAGED_MEM_H
#define _MANAGED_MEM_H
#include <cuda_runtime.h>
#include <algorithm>
template<typename T>
class ManagedIterator : public std::iterator<std::bidirectional_iterator_tag, T> {
public:
ManagedIterator(T *ptr = NULL) : mptr(ptr) {
}
bool operator==(ManagedIterator const& rhs) const {
return (mptr==rhs.mptr);
}
bool operator!=(ManagedIterator const& rhs) const {
return !(*this==rhs);
}
ManagedIterator& operator++() {
++mptr;
return *this;
}
ManagedIterator operator++(int) {
ManagedIterator tmp (*this);
++(*this);
return tmp;
}
ManagedIterator& operator--() {
--mptr;
return *this;
}
ManagedIterator operator--(int) {
ManagedIterator tmp (*this);
--(*this);
return tmp;
}
T *operator* () const {
return mptr;
}
private:
T *mptr;
};
template<typename T>
struct ManagedPtr {
typedef T type;
typedef ManagedIterator<T> iterator;
ManagedPtr(): msize(0), mptr(NULL) {
}
ManagedPtr(std::size_t n_elements): msize(n_elements * sizeof(T)) {
if(n_elements)
cudaMallocHost((void **)&mptr, msize);
}
~ManagedPtr() {
if(mptr)
cudaFreeHost(mptr);
}
void reset(std::size_t n_elements) {
if(n_elements * sizeof(T) == msize)
return; //We dont neen to change anything;
if(mptr) {
cudaFreeHost(mptr);
mptr = NULL;
}
if(n_elements) {
msize = n_elements * sizeof(T);
cudaMallocHost((void **)&mptr, msize);
}
}
inline
void clear() const {
if(mptr && msize) {
cudaMemset(mptr, 0x0, msize);
}
}
inline
T *operator()() {
return (T*)mptr;
}
inline
const T *operator()() const {
return (T*)mptr;
}
inline
T &operator[](std::size_t idx) {
return ((T*)mptr)[idx];
}
inline
const T &operator[](std::size_t idx) const {
return ((T*)mptr)[idx];
}
inline
std::size_t size() const {
return msize/sizeof(T);
}
inline
std::size_t bytes() const {
return msize;
}
ManagedIterator<T> begin() const {
return ManagedIterator<T>((T*)mptr);
}
ManagedIterator<T> end() const {
return ManagedIterator<T>((T*)( reinterpret_cast<std::size_t>(mptr)+msize));
}
private:
void operator=(ManagedPtr<T> &p);
private:
std::size_t msize;
void *mptr;
};
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2017 <+YOU OR YOUR COMPANY+>.
*
* This 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, or (at your option)
* any later version.
*
* This software 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_TUTORIAL_QPSK_DEMOD_CPP_CB_IMPL_H
#define INCLUDED_TUTORIAL_QPSK_DEMOD_CPP_CB_IMPL_H
#include <tutorial/qpsk_demod_cpp_cb.h>
namespace gr {
namespace tutorial {
class qpsk_demod_cpp_cb_impl : public qpsk_demod_cpp_cb
{
private:
bool d_gray_code;
public:
qpsk_demod_cpp_cb_impl(bool gray_code);
~qpsk_demod_cpp_cb_impl();
// Where all the action really happens
void forecast
(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
unsigned char get_minimum_distances(const gr_complex &sample);
};
} // namespace tutorial
} // namespace gr
#endif /* INCLUDED_TUTORIAL_QPSK_DEMOD_CPP_CB_IMPL_H */
|
/*
* SPDX-License-Identifier: LGPL-2.0-only
* License-Filename: LICENSES/LGPLv2-KDAB
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef KDTOOLSCORE_PIMPL_PTR_H
#define KDTOOLSCORE_PIMPL_PTR_H
#include "kdtoolsglobal.h"
#ifndef DOXYGEN_RUN
namespace kdtools {
#endif
template <typename T>
class pimpl_ptr {
KDAB_DISABLE_COPY( pimpl_ptr );
T * d;
public:
pimpl_ptr() : d( new T ) {}
explicit pimpl_ptr( T * t ) : d( t ) {}
~pimpl_ptr() { delete d; d = nullptr; }
T * get() { return d; }
const T * get() const { return d; }
T * operator->() { return get(); }
const T * operator->() const { return get(); }
T & operator*() { return *get(); }
const T & operator*() const { return *get(); }
KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() )
};
// these are not implemented, so's we can catch their use at
// link-time. Leaving them undeclared would open up a comparison
// via operator unspecified-bool-type().
template <typename T, typename S>
void operator==( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
template <typename T, typename S>
void operator!=( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
#ifndef DOXYGEN_RUN
} // namespace kdtools
#endif
#endif /* KDTOOLSCORE_PIMPL_PTR_H */
|
/* Copyright (C) 1998-2000 Matthes Bender RedWolf Design */
/* Fixed point math extracted from ALLEGRO by Shawn Hargreaves */
/* The Source Of Evil Engine uses fixed point math for exact object positions.
This is rather silly. Nowadays we should simply use floats. However,
I never dared changing the whole thing. */
typedef long fixed;
#define FIXED fixed
inline fixed itofix(int x)
{
return x << 16;
}
inline int fixtoi(fixed x)
{
return (x >> 16) + ((x & 0x8000) >> 15);
}
inline fixed ftofix(double x)
{
if (x > 32767) return (long) 0x7FFFFFFF; // Error
if (x < -32768) return - (long) 0x80000000; // Error
return (long)(x * 65536 + (x < 0 ? -0.5 : 0.5));
}
inline double fixtof(fixed x)
{
return (double)x / 65536;
}
inline fixed fmul(fixed x, fixed y) // This is the slow one...
{
return ftofix(fixtof(x)*fixtof(y));
}
inline fixed fdiv(fixed x, fixed y) // This is the slow one...
{
return ftofix(fixtof(x)/fixtof(y));
}
|
/*
* Copyright (c) 1985, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)math.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _MATH_H_
#define _MATH_H_
#if defined(vax) || defined(tahoe) /* DBL_MAX from float.h */
#define HUGE_VAL 1.701411834604692294E+38
#else
#define HUGE_VAL 1e500 /* IEEE: positive infinity */
#endif
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
#if defined(vax) || defined(tahoe)
/*
* HUGE for the VAX and Tahoe converts to the largest possible F-float value.
* This implies an understanding of the conversion behavior of atof(3). It
* was defined to be the largest float so that overflow didn't occur when it
* was assigned to a single precision number. HUGE_VAL is strongly preferred.
*/
#define HUGE 1.701411733192644270E+38
#else
#define HUGE HUGE_VAL
#endif
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
#include <sys/cdefs.h>
__BEGIN_DECLS
__pure double acos __P((double));
__pure double asin __P((double));
__pure double atan __P((double));
__pure double atan2 __P((double, double));
__pure double ceil __P((double));
__pure double cos __P((double));
__pure double cosh __P((double));
__pure double exp __P((double));
__pure double fabs __P((double));
__pure double floor __P((double));
__pure double fmod __P((double, double));
double frexp __P((double, int *));
__pure double ldexp __P((double, int));
__pure double log __P((double));
__pure double log10 __P((double));
double modf __P((double, double *));
__pure double pow __P((double, double));
__pure double sin __P((double));
__pure double sinh __P((double));
__pure double sqrt __P((double));
__pure double tan __P((double));
__pure double tanh __P((double));
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
__pure double acosh __P((double));
__pure double asinh __P((double));
__pure double atanh __P((double));
double cabs(); /* we can't describe cabs()'s argument properly */
__pure double cbrt __P((double));
__pure double copysign __P((double, double));
__pure double drem __P((double, double));
__pure double erf __P((double));
__pure double erfc __P((double));
__pure double expm1 __P((double));
__pure int finite __P((double));
__pure double hypot __P((double, double));
#if defined(vax) || defined(tahoe)
__pure double infnan __P((int));
#endif
__pure int isinf __P((double));
__pure int isnan __P((double));
__pure double j0 __P((double));
__pure double j1 __P((double));
__pure double jn __P((int, double));
__pure double lgamma __P((double));
__pure double log1p __P((double));
__pure double logb __P((double));
__pure double rint __P((double));
__pure double scalb __P((double, int));
__pure double y0 __P((double));
__pure double y1 __P((double));
__pure double yn __P((int, double));
#endif
__END_DECLS
#endif /* _MATH_H_ */
|
#include "aroop/aroop_core.h"
#include "aroop/core/xtring.h"
#include "nginz_config.h"
#include "log.h"
#include <signal.h>
#include "plugin_manager.h"
#include "fiber.h"
#include "fiber_internal.h"
#include "fork.h"
#include "db.h"
#include "event_loop.h"
#include "binary_coder_internal.h"
#include "binary_coder_internal.h"
#include "parallel/pipeline.h"
#include "shake.h"
#include "shake/quitall.h"
#include "shake/shake_internal.h"
#include "lazy_call_internal.h"
#include "base_subsystem.h"
C_CAPSULE_START
static int rehash() {
aroop_txt_t input = {};
aroop_txt_t output = {};
aroop_txt_t plugin_space = {};
aroop_txt_embeded_set_static_string(&plugin_space, "shake/rehash");
pm_call(&plugin_space, &input, &output);
aroop_txt_destroy(&input);
aroop_txt_destroy(&output);
return 0;
}
static int master_init() {
aroop_txt_t input = {};
aroop_txt_t output = {};
aroop_txt_t plugin_space = {};
aroop_txt_embeded_set_static_string(&plugin_space, "master/init");
pm_call(&plugin_space, &input, &output);
aroop_txt_destroy(&input);
aroop_txt_destroy(&output);
return 0;
}
static void signal_callback(int sigval) {
fiber_quit();
}
int nginz_parallel_init() {
rehash();
signal(SIGPIPE, SIG_IGN); // avoid crash on sigpipe
signal(SIGINT, signal_callback);
fork_processors(NGINZ_NUMBER_OF_PROCESSORS);
/**
* Setup for master
*/
shake_module_init(); // we start the control fd after fork
master_init();
return 0;
}
static int initiated = 0;
int nginz_core_init() {
if(initiated) /* already initiated */
return 0;
pm_init();
pp_module_init();
shake_quitall_module_init();
binary_coder_module_init();
fiber_module_init();
lazy_call_module_init();
event_loop_module_init();
enumerate_module_init();
initiated = 1;
return 0;
}
int nginz_core_deinit() {
enumerate_module_deinit();
event_loop_module_deinit();
shake_module_deinit();
lazy_call_module_deinit();
fiber_module_deinit();
binary_coder_module_deinit();
shake_quitall_module_deinit();
pp_module_deinit();
pm_deinit();
return 0;
}
C_CAPSULE_END
|
#include "rtx_inc.h"
VOID str_copy(BYTE * from, BYTE * to) {
int i;
for(i = 0; from[i] != '\0'; i++) {
to[i] = from[i];
}
}
SINT32 ascii_to_int(CHAR * string)
{
SINT32 value = 0;
// an empty string is an invalid string
if (string[0] == NULL) {
return -1;
}
int i;
for (i = 0; string[i] != NULL; i++) {
if (string[i] < 0x30 || string[i] > 0x39) {
return -1;
}
value *= 10;
value += (string[i] - 0x30);
}
return value;
}
|
/*
* $Revision: 2299 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $
***************************************************************/
/** \file
* \brief Declaration of class FeasibleUpwardPlanarSubgraph which
* computes an feasible upward planar subgraph and a feasible upward embedding.
*
* \author Hoi-Ming Wong
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
* Copyright (C) 2005-2008
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* \see http://www.gnu.org/copyleft/gpl.html
***************************************************************/
#ifdef _MSC_VER
#pragma once
#endif
#ifndef OGDF_FIXED_UPWARD_EMBEDDING_INSERTER_H
#define OGDF_FIXED_UPWARD_EMBEDDING_INSERTER_H
#include <ogdf/basic/Module.h>
#include <ogdf/upward/UpwardPlanarModule.h>
#include <ogdf/basic/GraphCopy.h>
#include <ogdf/upward/UpwardPlanRep.h>
namespace ogdf {
class OGDF_EXPORT FixedUpwardEmbeddingInserter : public Module
{
public:
// construction
FixedUpwardEmbeddingInserter();
// destruction
~FixedUpwardEmbeddingInserter(){ }
// Insert all edges in UPR
Module::ReturnType call(UpwardPlanRep &UPR, List<edge> origEdges, EdgeArray<int> &cost);
bool isUpwardPlanar(Graph &G)
{
UpwardPlanarModule upMod;
return upMod.upwardPlanarityTest(G);
}
private:
const int infty;
//! compute a list of static locked edges, i.e. eges which a priory cannot included in a feasible insertion path.
void staticLock(UpwardPlanRep &UPR, EdgeArray<bool> &locked, const List<edge> &origEdges, edge e_orig);
//! compute a list of dynamic locked edges
void dynamicLock(UpwardPlanRep &UPR, EdgeArray<bool> &locked, face f, adjEntry e_cur);
void nextFeasibleEdges(UpwardPlanRep &UPR, List<adjEntry> &nextEdges, face f, adjEntry e_cur, EdgeArray<bool> &locked);
//! compute the minimal feasible insertion path
void minFIP(UpwardPlanRep &UPR,
List<edge> &origEdges,
EdgeArray<int> &cost,
edge e_orig,
SList<adjEntry> &path) { getPath(UPR, origEdges, cost, e_orig, path, false); }
//! compute a constraint feasible insertion path usig heuristic.
void constraintFIP(UpwardPlanRep &UPR,
List<edge> &origEdges,
EdgeArray<int> &cost,
edge e_orig,
SList<adjEntry> &path) { getPath(UPR, origEdges, cost, e_orig, path, true); }
//! compute an insertion path
void getPath(UpwardPlanRep &UPR,
List<edge> &origEdges,
EdgeArray<int> &cost,
edge e_orig,
SList<adjEntry> &path,
bool heuristic);
//! mark the edges which are dominates by node v
void markUp(const Graph &G, node v, EdgeArray<bool> &markedEdges);
//! mark the edges which dominate node v
void markDown(const Graph &G, node v, EdgeArray<bool> &markedEdges);
//! compute the feasible edges of the face f with respect to e
void feasibleEdges(UpwardPlanRep &UPR,
face f, // current face
adjEntry adj, // current adjEntry, right face muss be f
EdgeArray<bool> &locked, // we compute the dyn. locked edges on the fly with respect to e
List<adjEntry> feasible // the list of feasible edges in f with respect to e
);
//! return true if current insertion path is contraint feasible
bool isConstraintFeasible(UpwardPlanRep &UPR,
const List<edge> &orig_edges,
edge e_orig,
adjEntry adj, // the last adjEntry of the insertion path
EdgeArray<adjEntry> &predAdj //Array to reconstruction the insertion path
);
//! return true if current insertion path is contraint feasible
bool isConstraintFeasible(UpwardPlanRep &UPR,
List<edge> &origEdges,
edge e_orig,
SList<adjEntry> &path);
};
} // end namespace ogdf
#endif
|
/*
* AppOS Boot Management System (ABMS)
* Copyright (c) 2002-2008 Spliced Networks LLC.
* All Rights Reserved.
*
* Author: John Buswell <buswellj@splicednetworks.com>
* Release: 4.0.0
*
* LICENSE: GPL v3
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* To contact Spliced Networks LLC:
*
* Spliced Networks LLC
* 4820 Fisher Road
* Athens, OH 45701
* USA
*
* Tel: (408) 416-3832
* email: support@splicednetworks.com
*
* http://www.splicednetworks.com
*
*
* What is ABMS?
* --------------
*
* ABMS provides a management layer in early user space. It replaces the init
* process and handles the image based system used in AppOS. It is designed to
* provide a mechanism of being always "managable" regardless of how messed up
* the system becomes.
*
*
* ABMS Quickstart
* -----------------
*
* +--------------------+
* | BIOS |
* +--------------------+
* | Boot Loader | <--- Grub, Lilo, etc.
* +--------------------+
* | Linux Kernel | <--- Kernel
* +--------------------+
* | ABMS | <--- We setup the initramfs, network etc.
* +--------------------+
* | init | <--- we act as an init replacement
* +--------------------+
* | AppStacks | <--- we load, configure and launch appliance stacks
* +--------------------+
*
*/
#include <stdio.h>
#include <unistd.h>
#include "abms.h"
#include "abms-map.h"
abms_loop_t abms_loop_table;
abms_sdt_t abms_app_table;
abms_dmt_t abms_storage_table;
abms_netdev_t abms_netdev_table;
abms_prodip_t abms_prodip_table;
abms_mgmt_t abms_mnet_table;
int main(int argc, char **argv, char **envp)
{
u8 rc = 0;
abms_cfg.debug = 0;
abms_cfg.sshport = ABMS_SSHPORT;
/* open console */
abms_disp_init();
/* pre-init */
abms_preinit();
/* parse cmdline */
abms_cmdline();
/* init */
abms_init();
if (abms_deployed)
abms_flash_auth();
/* setup network */
rc = abms_net();
if (rc == RC_FAIL) {
/* network setup failed, need to determine why and recover */
}
abms_net_sshd();
if (abms_deployed) {
abms_stack_init(); /* initialize stacks */
abms_net_prod(); /* bring up production interfaces */
// abms_aaf_init(); /* initialize firewall */
// abms_data_init(); /* initialize storage */
}
/* watchdog mode */
abms_init_loop();
/* we never reach this point */
return 0;
}
void abms_init_loop(void)
{
char lcmd[255];
sprintf(lcmd,"%s%s /dev/tty%d c 4 %d",ABMS_BINPATH,ACMD_MKNOD,ABMS_SECTTYV,ABMS_SECTTYV);
abms_system(lcmd);
sprintf(lcmd,"%s%s og-r /dev/%s",ABMS_BINPATH,ACMD_CHMOD,ABMS_SECTTY);
abms_system(lcmd);
abms_loop_getty();
printf("\n\n");
printf("Spliced Networks (R) Appliance Operating System Software\n");
printf("AppOS (R) Boot Management System, Version %s\n", ABMS_VERSION);
printf("%s\n\n",SN_COPYRIGHT);
printf("\nAppliance active, please use management console.\n\n");
if (abms_cfg.debug) {
printf("mode = %u\n", abms_cfg.mode);
printf("ip = %lu.%lu.%lu.%lu\t %llx\n",(u16) ((abms_cfg.ip >> 24) & 0xff), (u16) ((abms_cfg.ip >> 16) & 0xff), (u16) ((abms_cfg.ip >> 8) & 0xff), (u16) ((abms_cfg.ip) & 0xff), abms_cfg.ip);
printf("slash = %lu\n",abms_cfg.slash);
printf("gw = %lu.%lu.%lu.%lu\t %llx\n",(u16) ((abms_cfg.gw >> 24) & 0xff), (u16) ((abms_cfg.gw >> 16) & 0xff), (u16) ((abms_cfg.gw >> 8) & 0xff), (u16) ((abms_cfg.gw) & 0xff), abms_cfg.gw);
printf("dns = %lu.%lu.%lu.%lu\t %llx\n",(u16) ((abms_cfg.dns >> 24) & 0xff), (u16) ((abms_cfg.dns >> 16) & 0xff), (u16) ((abms_cfg.dns >> 8) & 0xff), (u16) ((abms_cfg.dns) & 0xff), abms_cfg.dns);
printf("ipab = %lu.%lu.%lu.%lu\t %llx\n",(u16) ((abms_cfg.ipab >> 24) & 0xff), (u16) ((abms_cfg.ipab >> 16) & 0xff), (u16) ((abms_cfg.ipab >> 8) & 0xff), (u16) ((abms_cfg.ipab) & 0xff), abms_cfg.ipab);
printf("mac = %02x:%02x:%02x:%02x:%02x:%02x\n",abms_cfg.mac[0],abms_cfg.mac[1],abms_cfg.mac[2],abms_cfg.mac[3],abms_cfg.mac[4],abms_cfg.mac[5]);
printf("flash = /dev/%s\n",abms_cfg.flashdev);
printf("slot = %u\n",abms_cfg.slot);
printf("sshport = %lu\n",abms_cfg.sshport);
printf("debug = %u\n\n",abms_cfg.debug);
printf("Real time debug mode enabled \n\n");
sprintf(lcmd,"exec %s%s",ABMS_BINPATH,ACMD_SH);
abms_system(lcmd);
}
while (1) {
sleep(10);
}
abms_init_loop(); /* evil recursion */
}
|
/*
Copyright (c) 1993-2008, Cognitive Technologies
All rights reserved.
Разрешается повторное распространение и использование как в виде исходного кода,
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
* При повторном распространении исходного кода должны оставаться указанное
выше уведомление об авторском праве, этот список условий и последующий
отказ от гарантий.
* При повторном распространении двоичного кода в документации и/или в
других материалах, поставляемых при распространении, должны сохраняться
указанная выше информация об авторском праве, этот список условий и
последующий отказ от гарантий.
* Ни название Cognitive Technologies, ни имена ее сотрудников не могут
быть использованы в качестве средства поддержки и/или продвижения
продуктов, основанных на этом ПО, без предварительного письменного
разрешения.
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
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 Cognitive Technologies 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.
*/
#ifndef __MEMFUNC_H
#define __MEMFUNC_H
#ifndef __GLOBUS_H
#include "globus.h"
#endif
typedef void *(*FTAllocPtr)( uint32_t );
typedef void (*FTFreePtr)( void *, uint32_t );
typedef struct tagMemFunc {
FTAllocPtr alloc;
FTFreePtr free;
} MemFunc;
#endif
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
// W A R N I N G
// -------------
//
// This file is not part of the Qt Chart API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef CHARTTHEMEBLUECERULEAN_P_H
#define CHARTTHEMEBLUECERULEAN_P_H
#include <private/charttheme_p.h>
#include <QtCharts/private/qchartglobal_p.h>
QT_BEGIN_NAMESPACE
class Q_CHARTS_PRIVATE_EXPORT ChartThemeBlueCerulean: public ChartTheme
{
public:
ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) {
// Series colors
m_seriesColors << QRgb(0xc7e85b);
m_seriesColors << QRgb(0x1cb54f);
m_seriesColors << QRgb(0x5cbf9b);
m_seriesColors << QRgb(0x009fbf);
m_seriesColors << QRgb(0xee7392);
m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
// Background
QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
backgroundGradient.setColorAt(0.0, QRgb(0x056189));
backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
m_chartBackgroundGradient = backgroundGradient;
// Axes and other
m_labelBrush = QBrush(QRgb(0xffffff));
m_axisLinePen = QPen(QRgb(0xd6d6d6));
m_axisLinePen.setWidth(2);
m_gridLinePen = QPen(QRgb(0x84a2b0));
m_gridLinePen.setWidth(1);
m_minorGridLinePen = QPen(QRgb(0x84a2b0));
m_minorGridLinePen.setWidth(1);
m_minorGridLinePen.setStyle(Qt::DashLine);
m_backgroundShades = BackgroundShadesNone;
m_outlinePen = QPen(QRgb(0xebebeb));
m_outlinePen.setWidthF(2.0);
}
};
QT_END_NAMESPACE
#endif
|
#include <vector>
using namespace std;
union handy{
unsigned char Chars[8];
short samples[4];
long long ID;
void print(){
cout<<"sampleZero "<<samples[0]<<endl
<<"sampleOne "<<samples[1]<<endl
<<"sampleTwo "<<samples[2]<<endl
<<"sampleThree "<<samples[3]<<endl
<<"marID "<<ID<<endl
<<"marChars ";
for(int i = 0; i < 8;i++){
cout<<(int)Chars[i]<<" ";
}
cout<<endl;
}
};
class bobEdge{
public:
bobEdge(){
to = 0;
weight = 0;
};
bobEdge(signed short L, int W){
to = L;
weight = W;
};
bobEdge(const bobEdge& copy){
to = copy.to;
weight = copy.weight;
};
bool operator==(const bobEdge& right){
if(to == right.to)return true;
else return false;
};
signed short to;
int weight;
};
template <class T>
class vertex{
public:
vertex(){
ID = 0;
vertexUnion.ID = 0;
};
vertex(const vertex& copy){
ID = copy.ID;
edges.clear();
edges = copy.edges;
vertexUnion.ID = copy.vertexUnion.ID;
};
vertex(const handy mu){
ID = mu.ID;
vertexUnion.ID = mu.ID;
};
void operator=(const vertex& right){
ID = right.ID;
edges.clear();
edges = right.edges;
vertexUnion.ID = right.vertexUnion.ID;
};
void setID(long int xID){
ID = xID;
vertexUnion.ID = xID;
}
void addEdge(signed short L ){
bobEdge newEdge(L, 1);
// vector<bobEdge>::iterator it = find(edges.begin(), edges.end(), newEdge);
// if(it == edges.end()){
edges.push_back(newEdge);
// }
// else{
// it->weight++;
// }
};
handy vertexUnion;
long int ID;
vector<bobEdge> edges;
};
|
/**
* CallProcessingEngine: call another processing engine module template. Module
* needs to implement PrepareResource and FinishResource methods and call ReadWrite() as appropriate
*/
#ifndef _LIB_PROCESSING_ENGINE_CALL_PROCESSING_ENGINE_H_
#define _LIB_PROCESSING_ENGINE_CALL_PROCESSING_ENGINE_H_
#include <config.h>
#include <tr1/unordered_set>
#include <log4cxx/logger.h>
#include "common.h"
#include "Module.h"
#include "ObjectProperties.h"
#include "ProcessingEngine.h"
class CallProcessingEngine {
public:
// maxRequests: number of concurrent requests
CallProcessingEngine(int maxRequests, bool ordered);
virtual ~CallProcessingEngine();
void SetProcessingEngine(ProcessingEngine *engine);
int Process(std::queue<Resource*> *inputResources, std::queue<Resource*> *outputResources, int *expectingResources, int timeTick);
void Pass(std::queue<Resource*> *inputResources, int timeTick);
// may be called instead of ProcessMulti()
bool ReadWrite(std::queue<Resource*> *inputResources, std::queue<Resource*> *outputResources, struct timeval *tv);
protected:
// returns NULL in case src resource cannot be processed (e.g. is incompatible)
virtual Resource *PrepareResource(Resource *src) = 0;
virtual Resource *FinishResource(Resource *tmp) = 0;
int maxRequests;
ProcessingEngine *engine;
Resource *tmpInputResource;
bool ordered; // whether we should keep resource order or not
int running; // number or resources currently being processed
std::tr1::unordered_set<int> runningSet;
std::vector<int> runningVector;
static log4cxx::LoggerPtr logger;
};
inline void CallProcessingEngine::SetProcessingEngine(ProcessingEngine *engine) {
this->engine = engine;
}
#endif
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Users/tball/tmp/j2objc/guava/sources/com/google/common/util/concurrent/Uninterruptibles.java
//
// Created by tball on 11/23/13.
//
#import "JreEmulation.h"
#if !ComGoogleCommonUtilConcurrentUninterruptibles_RESTRICT
#define ComGoogleCommonUtilConcurrentUninterruptibles_INCLUDE_ALL 1
#endif
#undef ComGoogleCommonUtilConcurrentUninterruptibles_RESTRICT
#if !defined (_ComGoogleCommonUtilConcurrentUninterruptibles_) && (ComGoogleCommonUtilConcurrentUninterruptibles_INCLUDE_ALL || ComGoogleCommonUtilConcurrentUninterruptibles_INCLUDE)
#define _ComGoogleCommonUtilConcurrentUninterruptibles_
@class JavaLangThread;
@class JavaUtilConcurrentCountDownLatch;
@class JavaUtilConcurrentTimeUnitEnum;
@protocol JavaUtilConcurrentBlockingQueue;
@protocol JavaUtilConcurrentFuture;
@interface ComGoogleCommonUtilConcurrentUninterruptibles : NSObject {
}
+ (void)awaitUninterruptiblyWithJavaUtilConcurrentCountDownLatch:(JavaUtilConcurrentCountDownLatch *)latch;
+ (BOOL)awaitUninterruptiblyWithJavaUtilConcurrentCountDownLatch:(JavaUtilConcurrentCountDownLatch *)latch
withLong:(long long int)timeout
withJavaUtilConcurrentTimeUnitEnum:(JavaUtilConcurrentTimeUnitEnum *)unit;
+ (void)joinUninterruptiblyWithJavaLangThread:(JavaLangThread *)toJoin;
+ (id)getUninterruptiblyWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future;
+ (id)getUninterruptiblyWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future
withLong:(long long int)timeout
withJavaUtilConcurrentTimeUnitEnum:(JavaUtilConcurrentTimeUnitEnum *)unit;
+ (void)joinUninterruptiblyWithJavaLangThread:(JavaLangThread *)toJoin
withLong:(long long int)timeout
withJavaUtilConcurrentTimeUnitEnum:(JavaUtilConcurrentTimeUnitEnum *)unit;
+ (id)takeUninterruptiblyWithJavaUtilConcurrentBlockingQueue:(id<JavaUtilConcurrentBlockingQueue>)queue;
+ (void)putUninterruptiblyWithJavaUtilConcurrentBlockingQueue:(id<JavaUtilConcurrentBlockingQueue>)queue
withId:(id)element;
+ (void)sleepUninterruptiblyWithLong:(long long int)sleepFor
withJavaUtilConcurrentTimeUnitEnum:(JavaUtilConcurrentTimeUnitEnum *)unit;
- (id)init;
@end
#endif
|
//
//
// This source code is part of
//
// TD-ALCOVE
//
// Temporal Difference - ALCOVE
//
// VERSION 1.0.0
// Written by Joshua L. Phillips.
// Copyright (c) 2004-2016, Joshua L. Phillips.
// Check out http://www.cs.mtsu.edu/~jphillips/software.html for more
// information.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// If you want to redistribute modifications, please consider that
// derived work must not be called official TDALCOVE. Details are found
// in the README & LICENSE files - if they are missing, get the
// official version at github.com/jlphillipsphd/tdalcove/.
//
// To help us fund TDALCOVE development, we humbly ask that you cite the
// papers on the package - you can find them in the top README file.
//
// For more info, check our website at
// http://www.cs.mtsu.edu/~jphillips/software.html
//
//
#ifndef CMACS_TD_COARSE_CODE_LAYER_SET_H
#define CMACS_TD_COARSE_CODE_LAYER_SET_H
// BE CAREFULL!!! when using sets.
// All layers can be used freely, but altering anything other
// than values (like position or input dimensionality) can lead
// to misbehavior. Also, DO NOT delete the individual layers.
// They will be tended to when the set class is deleted.
#include "td_cubic_coarse_code_layer.h"
#include "cubic_activation_function.h"
#include "activation_function.h"
#include "nnet_math.h"
#include <stddef.h>
#include <math.h>
#include <iostream>
using namespace std;
class CMACS_TD_CoarseCodeLayerSet : public Object {
public:
CMACS_TD_CoarseCodeLayerSet();
~CMACS_TD_CoarseCodeLayerSet();
CMACS_TD_CoarseCodeLayerSet(int dimensionality,
int number_of_tilings,
int number_of_units_per_tile_dimension,
ActivationFunction* af,
double discount_rate);
CMACS_TD_CoarseCodeLayerSet(int dimensionality,
int number_of_tilings,
int number_of_units_per_tile_dimension,
double minimum_per_dimension,
double maximum_per_dimension,
ActivationFunction* af,
double discount_rate);
CMACS_TD_CoarseCodeLayerSet(int dimensionality,
int number_of_tilings,
int* number_of_units_per_tile_dimension,
double* minimums_per_dimension,
double* maximums_per_dimension,
ActivationFunction* af,
double discount_rate);
bool getCoarseActs(double* pos);
bool setCoarseActs(double* pos);
int getNumberOfTilings();
TDCubicCoarseCodeLayer* getTiling(int val);
bool getWinningUnitIndexes(int* the_ones);
protected:
TDCubicCoarseCodeLayer** layers;
CubicActivationFunction* caf;
int cmac_dim;
int tiles;
int* side_units;
double* code_domain;
double* code_step;
double** a_pos;
double** a_pos2;
int* candidate;
double* as;
double* real_pos;
int the_tile;
int* the_one;
double some_dist;
int bound_corner, new_corner;
double* layer_work_vec;
int power_size;
double* temp;
};
#endif
|
/*******************************************************************
Part of the Fritzing project - http://fritzing.org
Copyright (c) 2007-2010 Fachhochschule Potsdam - http://fh-potsdam.de
Fritzing 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.
Fritzing 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 Fritzing. If not, see <http://www.gnu.org/licenses/>.
********************************************************************
$Revision: 4183 $:
$Author: cohen@irascible.com $:
$Date: 2010-05-06 13:30:19 -0700 (Thu, 06 May 2010) $
********************************************************************/
#ifndef PARTSEDITORCONNECTORITEM_H_
#define PARTSEDITORCONNECTORITEM_H_
#include <QGraphicsView>
#include "../itemselection/terminalpointitem.h"
#include "../connectors/connectoritem.h"
class PartsEditorConnectorItem: public ConnectorItem {
public:
PartsEditorConnectorItem(Connector * conn, ItemBase* attachedTo);
~PartsEditorConnectorItem();
void removeFromModel();
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
};
#endif /* PARTSEDITORCONNECTORITEM_H_ */
|
#pragma once
#include <rwe/geometry/Ray3f.h>
#include <rwe/math/Matrix4f.h>
#include <rwe/math/Vector2f.h>
namespace rwe
{
Ray3f screenToWorldRayUtil(const Matrix4f& inverseViewProjectionMatrix, const Vector2f& point);
}
|
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright (c) 2016 AmLogic, Inc.
* Author: Michael Turquette <mturquette@baylibre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called COPYING
*
* BSD LICENSE
*
* Copyright (c) 2016 AmLogic, Inc.
* Author: Michael Turquette <mturquette@baylibre.com>
*
* 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.
*/
/*
* MultiPhase Locked Loops are outputs from a PLL with additional frequency
* scaling capabilities. MPLL rates are calculated as:
*
* f(N2_integer, SDM_IN ) = 2.0G/(N2_integer + SDM_IN/16384)
*/
#include <linux/clk-provider.h>
#include "clkc.h"
#define SDM_MAX 16384
#define to_meson_clk_mpll(_hw) container_of(_hw, struct meson_clk_mpll, hw)
static unsigned long mpll_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct meson_clk_mpll *mpll = to_meson_clk_mpll(hw);
struct parm *p;
unsigned long rate = 0;
unsigned long reg, sdm, n2;
p = &mpll->sdm;
reg = readl(mpll->base + p->reg_off);
sdm = PARM_GET(p->width, p->shift, reg);
p = &mpll->n2;
reg = readl(mpll->base + p->reg_off);
n2 = PARM_GET(p->width, p->shift, reg);
rate = (parent_rate * SDM_MAX) / ((SDM_MAX * n2) + sdm);
return rate;
}
const struct clk_ops meson_clk_mpll_ro_ops =
{
.recalc_rate = mpll_recalc_rate,
};
|
/******************************************************************************
*
* $Id: configoptions.h,v 1.39 2001/03/19 19:27:40 root Exp $
*
*
* Copyright (C) 1997-2011 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef CONFIGOPTIONS
#define CONFIGOPTIONS
class Config;
void addConfigOptions(Config *cfg);
#endif
|
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2005-2007, 2010-2012 Free Software Foundation, Inc.
GNU Mailutils 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, or (at your option)
any later version.
GNU Mailutils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <mailutils/mailutils.h>
/* Replace all octal escapes in BUF with the corresponding characters. */
static void
decode_octal (char *buf)
{
char *p;
unsigned i, n;
for (p = buf; *p;)
{
if (*buf == '\\')
{
buf++;
switch (*buf)
{
case 'a':
*p++ = '\a';
buf++;
break;
case 'b':
*p++ = '\b';
buf++;
break;
case 'f':
*p++ = '\f';
buf++;
break;
case 'n':
*p++ = '\n';
buf++;
break;
case 'r':
*p++ = '\r';
buf++;
break;
case 't':
*p++ = '\t';
buf++;
break;
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
n = 0;
for (i = 0; i < 3; i++, buf++)
{
unsigned x = *(unsigned char*)buf - '0';
if (x > 7)
break;
n <<= 3;
n += x;
}
if (i != 3)
{
buf -= i;
*p++ = '\\';
}
else
*p++ = n;
break;
default:
*p++ = '\\';
*p++ = *buf++;
break;
}
}
else
*p++ = *buf++;
}
*p = 0;
}
int
main (int argc, char *argv[])
{
int c;
char buf[256];
char vbuf[256];
char *charset = strdup ("iso-8859-1");
char *encoding = strdup ("quoted-printable");
int octal = 0;
while ((c = getopt (argc, argv, "c:e:hot")) != EOF)
switch (c)
{
case 'c':
free (charset);
charset = strdup (optarg);
break;
case 'e':
free (encoding);
encoding = strdup (optarg);
break;
case 'o':
octal = 1;
break;
case 't':
octal = 0;
break;
case 'h':
printf ("usage: %s [-c charset] [-e encoding] [-ot]\n", argv[0]);
exit (0);
default:
exit (1);
}
while (fgets (buf, sizeof (buf), stdin))
{
int len;
char *p = NULL;
char *cmd;
int rc;
len = strlen (buf);
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = 0;
strncpy(vbuf, buf, sizeof vbuf);
cmd = vbuf;
if (cmd[0] == '\\')
{
if (cmd[1] == 0)
{
fprintf (stderr, "Unfinished command\n");
continue;
}
for (p = cmd + 2; *p && *p == ' '; p++)
;
switch (cmd[1])
{
case 'c':
free (charset);
charset = strdup (p);
continue;
case 'e':
free (encoding);
encoding = strdup (p);
continue;
case 'o':
octal = 1;
continue;
case 't':
octal = 0;
continue;
case '\\':
cmd++;
break;
default:
fprintf (stderr, "Unknown command\n");
continue;
}
}
if (octal)
decode_octal (cmd);
rc = mu_rfc2047_encode (charset, encoding, cmd, &p);
if (rc)
fprintf (stderr, "%s", mu_strerror (rc));
else if (p)
printf ("%s\n", p);
free (p);
}
return 0;
}
|
/*
File: jagpackagerenderer.h
Project: jaguar
Author: Douwe Vos
Date: Nov 23, 2013
e-mail: dmvos2000(at)yahoo.com
Copyright (C) 2013 Douwe Vos.
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 JAGPACKAGERENDERER_H_
#define JAGPACKAGERENDERER_H_
#include <caterpillar.h>
G_BEGIN_DECLS
#define JAG_TYPE_PACKAGE_RENDERER (jag_package_renderer_get_type())
#define JAG_PACKAGE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), jag_package_renderer_get_type(), JagPackageRenderer))
#define JAG_PACKAGE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAG_TYPE_PACKAGE_RENDERER, JagPackageRendererClass))
#define JAG_IS_PACKAGE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAG_TYPE_PACKAGE_RENDERER))
#define JAG_IS_PACKAGE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAG_TYPE_PACKAGE_RENDERER))
#define JAG_PACKAGE_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAG_TYPE_PACKAGE_RENDERER, JagPackageRendererClass))
typedef struct _JagPackageRenderer JagPackageRenderer;
typedef struct _JagPackageRendererClass JagPackageRendererClass;
struct _JagPackageRenderer {
GObject parent;
};
struct _JagPackageRendererClass {
GObjectClass parent_class;
};
GType jag_package_renderer_get_type();
JagPackageRenderer *jag_package_renderer_new();
G_END_DECLS
#endif /* JAGPACKAGERENDERER_H_ */
|
/*
* LibrePCB - Professional EDA for everyone!
* Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
* https://librepcb.org/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBREPCB_PROJECT_EDITOR_BOARDPLANEPROPERTIESDIALOG_H
#define LIBREPCB_PROJECT_EDITOR_BOARDPLANEPROPERTIESDIALOG_H
/*******************************************************************************
* Includes
******************************************************************************/
#include <librepcb/common/geometry/vertex.h>
#include <QtCore>
#include <QtWidgets>
/*******************************************************************************
* Namespace / Forward Declarations
******************************************************************************/
namespace librepcb {
class UndoStack;
class UndoCommand;
namespace project {
class Project;
class BI_Plane;
namespace editor {
namespace Ui {
class BoardPlanePropertiesDialog;
}
/*******************************************************************************
* Class BoardPlanePropertiesDialog
******************************************************************************/
/**
* @brief The BoardPlanePropertiesDialog class
*/
class BoardPlanePropertiesDialog final : public QDialog {
Q_OBJECT
public:
// Constructors / Destructor
BoardPlanePropertiesDialog() = delete;
BoardPlanePropertiesDialog(const BoardPlanePropertiesDialog& other) = delete;
BoardPlanePropertiesDialog(Project& project, BI_Plane& plane,
UndoStack& undoStack, QWidget* parent) noexcept;
~BoardPlanePropertiesDialog() noexcept;
private: // GUI Events
void buttonBoxClicked(QAbstractButton* button) noexcept;
private: // Methods
bool applyChanges() noexcept;
// General
Project& mProject;
BI_Plane& mPlane;
QScopedPointer<Ui::BoardPlanePropertiesDialog> mUi;
UndoStack& mUndoStack;
};
/*******************************************************************************
* End of File
******************************************************************************/
} // namespace editor
} // namespace project
} // namespace librepcb
#endif // LIBREPCB_PROJECT_EDITOR_BOARDPLANEPROPERTIESDIALOG_H
|
///////////////////////////////////////////////////////////////////////////////
// Name: dialog/wxm_search_replace_dialog.h
// Description: Search/Replace Dialog
// Copyright: 2013-2019 JiaYanwei <wxmedit@gmail.com>
// 2005-2010 Alston Chen <madedit@gmail.com>
// License: GPLv3
///////////////////////////////////////////////////////////////////////////////
#ifndef WXM_REPLACE_DIALOG_H
#define WXM_REPLACE_DIALOG_H
#include "../xm/cxx11.h"
#include "../wxm/recent_list.h"
#include "../wxm/utils.h"
#ifdef _MSC_VER
# pragma warning( push )
# pragma warning( disable : 4996 )
#endif
// disable 4996 {
//(*Headers(WXMSearchReplaceDialog)
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
#include <wx/menu.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
//*)
// disable 4996 }
#ifdef _MSC_VER
# pragma warning( pop )
#endif
#include <wx/fileconf.h>
#include <wx/bmpbuttn.h>
#include <map>
class MadEdit;
class WXMSearchReplaceDialog: public wxDialog
{
public:
WXMSearchReplaceDialog(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
virtual ~WXMSearchReplaceDialog();
//(*Declarations(WXMSearchReplaceDialog)
wxButton* WxButtonClose;
wxButton* WxButtonCount;
wxButton* WxButtonFindNext;
wxButton* WxButtonFindPrev;
wxButton* WxButtonReplace;
wxButton* WxButtonReplaceAll;
wxButton* WxButtonReplaceExpand;
wxCheckBox* WxCheckBoxCaseSensitive;
wxCheckBox* WxCheckBoxFindHex;
wxCheckBox* WxCheckBoxMoveFocus;
wxCheckBox* WxCheckBoxRegex;
wxCheckBox* WxCheckBoxSearchInSelection;
wxCheckBox* WxCheckBoxWholeWord;
wxCheckBox* WxCheckBoxWrapAround;
wxMenu WxPopupMenuRecentFindText;
wxMenu WxPopupMenuRecentReplaceText;
wxStaticLine* StaticLine1;
wxStaticText* StaticTextStatus;
wxStaticText* WxStaticTextFrom;
wxStaticText* WxStaticTextTo;
wxTextCtrl* WxEditFrom;
wxTextCtrl* WxEditTo;
//*)
protected:
//(*Identifiers(WXMSearchReplaceDialog)
static const long ID_WXCHECKBOXMOVEFOCUS;
static const long ID_WXCHECKBOXWRAPAROUND;
static const long ID_WXCHECKBOXCASESENSITIVE;
static const long ID_WXCHECKBOXWHOLEWORD;
static const long ID_WXCHECKBOXREGEX;
static const long ID_WXCHECKBOXFINDHEX;
static const long ID_WXCHECKBOXSEARCHINSELECTION;
static const long ID_WXSTATICTEXTFROM;
static const long ID_WXEDITFROM;
static const long ID_WXSTATICTEXTTO;
static const long ID_WXEDITTO;
static const long ID_WXBUTTONFINDNEXT;
static const long ID_WXBUTTONFINDPREV;
static const long ID_WXBUTTONCOUNT;
static const long ID_WXBUTTONREPLACE;
static const long ID_WXBUTTONREPLACEALL;
static const long ID_WXBUTTONREPLACEEXPAND;
static const long ID_WXBUTTONCLOSE;
static const long ID_STATICLINE1;
static const long ID_STATICTEXTSTATUS;
//*)
static const long ID_MADEDIT1;
static const long ID_MADEDIT2;
static const long ID_WXBITMAPBUTTONRECENTFINDTEXT;
static const long ID_WXBITMAPBUTTONRECENTREPLACETEXT;
public:
MadEdit *m_FindText, *m_ReplaceText;
wxBitmapButton *WxBitmapButtonRecentFindText, *WxBitmapButtonRecentReplaceText;
wxm::wxRecentList *m_RecentFindText;
wxm::wxRecentList *m_RecentReplaceText;
void ReadWriteSettings(bool bRead);
void UpdateCheckBoxByCBHex(bool check);
void UpdateCheckBoxByCBHex() { UpdateCheckBoxByCBHex(WxCheckBoxFindHex->GetValue()); }
void UpdateSearchInSelection(bool check);
void ShowOnlyFindFunc();
void ShowWithReplaceFunc();
virtual bool Show(bool show) override
{
if (!show)
ResetMessage();
return wxDialog::Show(show);
}
private:
enum SearchMsgType
{
SMT_INFORMATION,
SMT_NOTICE,
SMT_WARNING,
};
std::map<int, wxColor> m_msgtypecolor_map;
wxColor GetMessageColor(SearchMsgType type);
void ResetMessage();
void ShowMessage(const wxString& msg, SearchMsgType type=SMT_INFORMATION);
//private:
public:
//(*Handlers(WXMSearchReplaceDialog)
void WXMSearchReplaceDialogClose(wxCloseEvent& event);
void WXMSearchReplaceDialogKeyDown(wxKeyEvent& event);
void WxCheckBoxFindHexClick(wxCommandEvent& event);
void WxCheckBoxSearchInSelectionClick(wxCommandEvent& event);
void WxButtonFindNextClick(wxCommandEvent& event);
void WxButtonReplaceClick(wxCommandEvent& event);
void WxButtonReplaceAllClick(wxCommandEvent& event);
void WxButtonFindPrevClick(wxCommandEvent& event);
void WxButtonCountClick(wxCommandEvent& event);
void WxButtonCloseClick(wxCommandEvent& event);
void WxButtonReplaceExpandClick(wxCommandEvent& event);
//*)
void WXMSearchReplaceDialogActivate(wxActivateEvent& event);
void WxBitmapButtonRecentFindTextClick(wxCommandEvent& event);
void WxBitmapButtonRecentReplaceTextClick(wxCommandEvent& event);
void OnRecentFindText(wxCommandEvent& event);
void OnRecentReplaceText(wxCommandEvent& event);
void PurgeRecentFindTexts();
void PurgeRecentReplaceTexts();
DECLARE_EVENT_TABLE()
};
extern WXMSearchReplaceDialog *g_SearchReplaceDialog;
WXMSearchReplaceDialog& GetSearchReplaceDialog(wxWindow* paren);
#endif
|
/*
Copyright (c) 2009 Sebastian Steiger, Integrated Systems Laboratory, ETH Zurich.
Comments, suggestions, criticism or bug reports are welcome: steiger@purdue.edu.
This file is part of ANGEL, a simulator for LEDs based on the NEGF formalism.
The software is distributed under the Lesser GNU General Public License (LGPL).
ANGEL is free software: you can redistribute it and/or modify it under the terms
of the Lesser GNU General Public License v3 or later. ANGEL is distributed
without any warranty; without even the implied warranty of merchantability or
fitness for a particular purpose. See also <http://www.gnu.org/licenses/>.
*/
#ifndef LINEARSOLVERPARDISO_H_NEGF
#define LINEARSOLVERPARDISO_H_NEGF
#include "all.h"
#include "CSRMatrix.h"
#include "LinearSolver.h"
// external fortran function
extern "C" {
int pardiso_(void* pt[64], /* pardiso internal memory pointer's */
int* maxfct , /* max. number of factorized matrices having the SAME structure that should be kept in mem*/
int* mnum, /* number of actual matrix for the solution phase (there could be several) */
int* mtype, /* matrix type */
int* phase, /* control of the solver (fill in reduction, factorization, fwd/backwrd subst, term) */
int* n, /* size of A */
void* A, /* the matrix ... in sparse format */
int* prow, /* sparse pointer to rows */
int* icol, /* colum indices of sparse entries in A */
int* perm, /* user fill in reducing permutation ... */
int* nrhs, /* number of right hand sides that need to be solved for */
int iparam[64], /* pardiso control array */
int* msglvl, /* message level information */
void* b, /* b(n,nrhs) rhs vector/matrix */
void* x, /* x(n,nrhs) */
int* error); /* error */
int pardisoinit_(
void* pt[64],
int* mtype,
int iparam[64]
);
}
using namespace std;
namespace negf {
/** Interface to the direct linear solver PARDISO, www.pardiso-project.org */
class LinearSolverPardiso: public LinearSolver {
public:
// swig has a problem with default arguments, therefore we better have 2 constructors
LinearSolverPardiso(CSRMatrix<double>* matrix_, double * rhs_, double * solution_);
~LinearSolverPardiso();
void solve();
protected:
void * pardiso_handle[64]; //!< different problem instances?
int pardiso_mtype; //!< what kind of matrix
int pardiso_iparam[64]; //!< configuration options
int * pardiso_perm; //!< permutation array
int * pardiso_prow; //!< 1-based CSR array
int * pardiso_icol; //!< 1-based CSR array
};
} // end namespace
#endif /*LINEARSOLVERPARDISO_H_*/
|
/*
* This file is part of Cleanflight.
*
* Cleanflight 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.
*
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <platform.h>
#include "drivers/io.h"
#include "drivers/pwm_mapping.h"
#include "drivers/timer.h"
const uint16_t multiPPM[] = {
PWM11 | (MAP_TO_PPM_INPUT << 8), // PPM input
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM15
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM15
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM1
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM2
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM17
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM3
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // TIM2
0xFFFF
};
const uint16_t multiPWM[] = {
PWM1 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM2 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM3 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM4 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM6 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8),
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
0xFFFF
};
const uint16_t airPPM[] = {
// TODO
0xFFFF
};
const uint16_t airPWM[] = {
// TODO
0xFFFF
};
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
// 6 x 3 pin headers
{ TIM15, IO_TAG(PB15), TIM_Channel_2, TIM1_BRK_TIM15_IRQn, 1, IOCFG_AF_PP, GPIO_AF_1 }, // PWM1 - PB15 - TIM1_CH3N, TIM15_CH1N, *TIM15_CH2
{ TIM15, IO_TAG(PB14), TIM_Channel_1, TIM1_BRK_TIM15_IRQn, 1, IOCFG_AF_PP, GPIO_AF_1 }, // PWM2 - PB14 - TIM1_CH2N, *TIM15_CH1
{ TIM1, IO_TAG(PA8), TIM_Channel_1, TIM1_CC_IRQn, 1, IOCFG_AF_PP, GPIO_AF_6 }, // PWM3 - PA8 - *TIM1_CH1, TIM4_ETR
{ TIM3, IO_TAG(PB0), TIM_Channel_3, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM4 - PB0 - *TIM3_CH3, TIM1_CH2N, TIM8_CH2N
{ TIM3, IO_TAG(PA6), TIM_Channel_1, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM5 - PA6 - *TIM3_CH1, TIM8_BKIN, TIM1_BKIN, TIM16_CH1
{ TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 0, IOCFG_AF_PP, GPIO_AF_1 }, // PWM6 - PA2 - *TIM2_CH3, !TIM15_CH1
// 6 pin header
// PWM7-10
{ TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM7 - PB1 - *TIM3_CH4, TIM1_CH3N, TIM8_CH3N
{ TIM17, IO_TAG(PA7), TIM_Channel_1, TIM1_TRG_COM_TIM17_IRQn, 1, IOCFG_AF_PP, GPIO_AF_1 }, // PWM8 - PA7 - !TIM3_CH2, *TIM17_CH1, TIM1_CH1N, TIM8_CH1
{ TIM3, IO_TAG(PA4), TIM_Channel_2, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_AF_2 }, // PWM9 - PA4 - *TIM3_CH2
{ TIM2, IO_TAG(PA1), TIM_Channel_2, TIM2_IRQn, 0, IOCFG_AF_PP, GPIO_AF_1 }, // PWM10 - PA1 - *TIM2_CH2, TIM15_CH1N
// PPM PORT - Also USART2 RX (AF5)
{ TIM2, IO_TAG(PA3), TIM_Channel_4, TIM2_IRQn, 0, IOCFG_IPD, GPIO_AF_1 } // PPM - PA3 - TIM2_CH4, TIM15_CH2 - PWM13
//{ TIM15, GPIOA, Pin_3, TIM_Channel_2, TIM1_BRK_TIM15_IRQn, 0, IOCFG_IPD, GPIO_PinSource3, GPIO_AF_9 } // PPM - PA3 - TIM2_CH4, TIM15_CH2 - PWM13
// USART3 RX/TX
// RX conflicts with PPM port
//{ TIM2, GPIOB, Pin_11, TIM_Channel_4, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_PinSource11, GPIO_AF_1 } // RX - PB11 - *TIM2_CH4, USART3_RX (AF7) - PWM11
//{ TIM2, GPIOB, Pin_10, TIM_Channel_3, TIM3_IRQn, 0, IOCFG_AF_PP, GPIO_PinSource10, GPIO_AF_1 } // TX - PB10 - *TIM2_CH3, USART3_TX (AF7) - PWM12
};
|
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_CURVEFITTING_TABULATEDFUNCTION_H_
#define MANTID_CURVEFITTING_TABULATEDFUNCTION_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/IFunction1D.h"
#include "MantidAPI/ParamFunction.h"
#include "MantidKernel/System.h"
#include <cmath>
namespace Mantid {
//----------------------------------------------------------------------
// Forward declaration
//----------------------------------------------------------------------
namespace API {
class MatrixWorkspace;
}
namespace CurveFitting {
namespace Functions {
/**
A function which takes its values from a file or a workspace. The values atr
tabulated as
x,y pairs. Liear interpolation is used for points between the tabulated values.
The function
returns zero for points outside the tabulated values.
The function has two attributes: FileName and Workspace. They define a data set
to take the values from.
Setting one of the attributes clears the other.
The files can be either ascii text files or nexus files. The ascii files must
contain two column
of real numbers separated by spaces. The first column are the x-values and the
second one is for y.
If a nexus file is used its first spectrum provides the data for the function.
The same is true for
a workspace which must be a MatrixWorkspace.
The function has two parameters - a scaling factor "Scaling" and a shift factor
along the abscissas 'Shift'
@author Roman Tolchenov, Tessella plc
@date 4/09/2012
*/
class DLLExport TabulatedFunction : public API::ParamFunction,
public API::IFunction1D {
public:
/// Constructor
TabulatedFunction();
/// overwrite IFunction base class methods
std::string name() const override { return "TabulatedFunction"; }
const std::string category() const override { return "General"; }
void function1D(double *out, const double *xValues,
const size_t nData) const override;
/// function derivatives
void functionDeriv1D(API::Jacobian *out, const double *xValues,
const size_t nData) override;
/// Returns the number of attributes associated with the function
size_t nAttributes() const override;
/// Returns a list of attribute names
std::vector<std::string> getAttributeNames() const override;
/// Return a value of attribute attName
Attribute getAttribute(const std::string &attName) const override;
/// Set a value to attribute attName
void setAttribute(const std::string &attName,
const IFunction::Attribute &value) override;
/// Check if attribute attName exists
bool hasAttribute(const std::string &attName) const override;
private:
/// Call the appropriate load function
void load(const std::string &fname);
/// Load the points from a MatrixWorkspace
void loadWorkspace(const std::string &wsName) const;
/// Load the points from a MatrixWorkspace
void loadWorkspace(boost::shared_ptr<API::MatrixWorkspace> ws) const;
/// Size of the data
size_t size() const { return m_yData.size(); }
/// Clear all data
void clear() const;
/// Evaluate the function for a list of arguments and given scaling factor
void eval(double scaling, double xshift, double xscale, double *out,
const double *xValues, const size_t nData) const;
/// Fill in the x and y value containers (m_xData and m_yData)
void setupData() const;
/// The default value for the workspace index
static const int defaultIndexValue;
/// Temporary workspace holder
mutable boost::shared_ptr<API::MatrixWorkspace> m_workspace;
/// Stores x-values
mutable std::vector<double> m_xData;
/// Stores y-values
mutable std::vector<double> m_yData;
/// Flag of completing data setup
mutable bool m_setupFinished;
/// Flag of explicit x-y data setup
mutable bool m_explicitXY;
};
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid
#endif /*MANTID_CURVEFITTING_TABULATEDFUNCTION_H_*/
|
/**
* C 语言: AVL树
*
* @author skywang
* @date 2013/11/07
*/
#include <stdio.h>
#include "avltree.h"
static int arr[]= {3,2,1,4,5,6,7,16,15,14,13,12,11,10,8,9};
#define TBL_SIZE(a) ( (sizeof(a)) / (sizeof(a[0])) )
void main()
{
int i,ilen;
AVLTree root=NULL;
printf("== 依次添加: ");
ilen = TBL_SIZE(arr);
for(i=0; i<ilen; i++)
{
printf("%d ", arr[i]);
root = avltree_insert(root, arr[i]);
printf("\n== 插入:%d \n", arr[i]);
print_avltree(root, root->key, 0);
printf("\n");
}
printf("\n== 前序遍历: ");
preorder_avltree(root);
printf("\n== 中序遍历: ");
inorder_avltree(root);
printf("\n== 后序遍历: ");
postorder_avltree(root);
printf("\n");
printf("== 高度: %d\n", avltree_height(root));
printf("== 最小值: %d\n", avltree_minimum(root)->key);
printf("== 最大值: %d\n", avltree_maximum(root)->key);
printf("== 树的详细信息: \n");
print_avltree(root, root->key, 0);
i = 8;
printf("\n== 删除根节点: %d", i);
root = avltree_delete(root, i);
printf("\n== 高度: %d", avltree_height(root));
printf("\n== 中序遍历: ");
inorder_avltree(root);
printf("\n== 树的详细信息: \n");
print_avltree(root, root->key, 0);
// 销毁二叉树
destroy_avltree(root);
}
|
/**
* \file
*/
#include "utils/mono-poll.h"
static mono_pollfd *poll_fds;
static guint poll_fds_capacity;
static guint poll_fds_size;
static inline void
POLL_INIT_FD (mono_pollfd *poll_fd, gint fd, gint events)
{
poll_fd->fd = fd;
poll_fd->events = events;
poll_fd->revents = 0;
}
static gboolean
poll_init (gint wakeup_pipe_fd)
{
g_assert (wakeup_pipe_fd >= 0);
poll_fds_size = 1;
poll_fds_capacity = 64;
poll_fds = g_new0 (mono_pollfd, poll_fds_capacity);
POLL_INIT_FD (&poll_fds [0], wakeup_pipe_fd, MONO_POLLIN);
return TRUE;
}
static void
poll_register_fd (gint fd, gint events, gboolean is_new)
{
gint i;
gint poll_event;
g_assert (fd >= 0);
g_assert (poll_fds_size <= poll_fds_capacity);
g_assert ((events & ~(EVENT_IN | EVENT_OUT)) == 0);
poll_event = 0;
if (events & EVENT_IN)
poll_event |= MONO_POLLIN;
if (events & EVENT_OUT)
poll_event |= MONO_POLLOUT;
for (i = 0; i < poll_fds_size; ++i) {
if (poll_fds [i].fd == fd) {
g_assert (!is_new);
POLL_INIT_FD (&poll_fds [i], fd, poll_event);
return;
}
}
g_assert (is_new);
for (i = 0; i < poll_fds_size; ++i) {
if (poll_fds [i].fd == -1) {
POLL_INIT_FD (&poll_fds [i], fd, poll_event);
return;
}
}
poll_fds_size += 1;
if (poll_fds_size > poll_fds_capacity) {
poll_fds_capacity *= 2;
g_assert (poll_fds_size <= poll_fds_capacity);
poll_fds = (mono_pollfd *)g_renew (mono_pollfd, poll_fds, poll_fds_capacity);
}
POLL_INIT_FD (&poll_fds [poll_fds_size - 1], fd, poll_event);
}
static void
poll_remove_fd (gint fd)
{
gint i;
g_assert (fd >= 0);
for (i = 0; i < poll_fds_size; ++i) {
if (poll_fds [i].fd == fd) {
POLL_INIT_FD (&poll_fds [i], -1, 0);
break;
}
}
/* if we don't find the fd in poll_fds,
* it means we try to delete it twice */
g_assert (i < poll_fds_size);
/* if we find it again, it means we added
* it twice */
for (; i < poll_fds_size; ++i)
g_assert (poll_fds [i].fd != fd);
/* reduce the value of poll_fds_size so we
* do not keep it too big */
while (poll_fds_size > 1 && poll_fds [poll_fds_size - 1].fd == -1)
poll_fds_size -= 1;
}
static inline gint
poll_mark_bad_fds (mono_pollfd *poll_fds, gint poll_fds_size)
{
gint i, ready = 0;
for (i = 0; i < poll_fds_size; i++) {
if (poll_fds [i].fd == -1)
continue;
switch (mono_poll (&poll_fds [i], 1, 0)) {
case 1:
ready++;
break;
case -1:
if (errno == EBADF)
{
poll_fds [i].revents |= MONO_POLLNVAL;
ready++;
}
break;
}
}
return ready;
}
static gint
poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gpointer user_data)
{
gint i, ready;
for (i = 0; i < poll_fds_size; ++i)
poll_fds [i].revents = 0;
mono_gc_set_skip_thread (TRUE);
MONO_ENTER_GC_SAFE;
ready = mono_poll (poll_fds, poll_fds_size, -1);
MONO_EXIT_GC_SAFE;
mono_gc_set_skip_thread (FALSE);
if (ready == -1) {
/*
* Apart from EINTR, we only check EBADF, for the rest:
* EINVAL: mono_poll() 'protects' us from descriptor
* numbers above the limit if using select() by marking
* then as POLLERR. If a system poll() is being
* used, the number of descriptor we're passing will not
* be over sysconf(_SC_OPEN_MAX), as the error would have
* happened when opening.
*
* EFAULT: we own the memory pointed by pfds.
* ENOMEM: we're doomed anyway
*
*/
switch (errno)
{
case EINTR:
{
ready = 0;
break;
}
case EBADF:
{
ready = poll_mark_bad_fds (poll_fds, poll_fds_size);
break;
}
default:
g_error ("poll_event_wait: mono_poll () failed, error (%d) %s", errno, g_strerror (errno));
break;
}
}
if (ready == -1)
return -1;
if (ready == 0)
return 0;
g_assert (ready > 0);
for (i = 0; i < poll_fds_size; ++i) {
gint fd, events = 0;
if (poll_fds [i].fd == -1)
continue;
if (poll_fds [i].revents == 0)
continue;
fd = poll_fds [i].fd;
if (poll_fds [i].revents & (MONO_POLLIN | MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL))
events |= EVENT_IN;
if (poll_fds [i].revents & (MONO_POLLOUT | MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL))
events |= EVENT_OUT;
if (poll_fds [i].revents & (MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL))
events |= EVENT_ERR;
callback (fd, events, user_data);
if (--ready == 0)
break;
}
return 0;
}
static ThreadPoolIOBackend backend_poll = {
.init = poll_init,
.register_fd = poll_register_fd,
.remove_fd = poll_remove_fd,
.event_wait = poll_event_wait,
};
|
/*
Copyright (C) 2016 Thomas Mijieux
This file is part of libtomtix.
libtomtix 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.
libtomtix 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include <stdlib.h>
#include "tomtix/partition.h"
typedef struct t_partition_ {
unsigned size;
int *parent;
int *weight;
} t_partition;
t_partition *
t_partition_new(unsigned n)
{
t_partition *p = g_malloc0(sizeof(*p));
p->size = n;
p->parent = g_malloc(sizeof p->parent * n);
p->weight = g_malloc0(sizeof p->weight * n);
for (unsigned i = 0; i < n; i++)
p->parent[i] = i;
return p;
}
void t_partition_delete(t_partition *p)
{
g_free(p->parent);
g_free(p->weight);
g_free(p);
}
int t_partition_rep(t_partition *p, int x)
{
int y = x;
while (p->parent[y] != y) {
y = p->parent[y];
}
int z = x;
do {
z = p->parent[x];
p->parent[x] = y;
x = z;
// ON ÉCRASE LES ARBRES! BORDEL!
} while (x != y);
return y;
}
int t_partition_equal(t_partition *p, int x, int y)
{
return (t_partition_rep(p, x) == t_partition_rep(p, y));
}
void t_partition_union(t_partition *p, int x, int y)
{
int a = t_partition_rep(p, x);
int b = t_partition_rep(p, y);
if (p->weight[a] > p->weight[b]) {
p->parent[b] = a;
} else if (p->weight[a] < p->weight[b]) {
p->parent[a] = b;
} else {
p->parent[a] = b;
p->weight[b] ++;
}
}
|
// term_torsion.h --- CHARMM36/EEF1-SB torsion angle energy term
// Copyright (C) 2014 Anders S. Christensen
//
// This file is part of Phaistos
//
// Phaistos 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.
//
// Phaistos 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 Phaistos. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef TERM_CHARMM_TORSION_H
#define TERM_CHARMM_TORSION_H
#include "math.h"
#include <boost/type_traits/is_base_of.hpp>
#include "energy/energy_term.h"
#include "parsers/topology_parser.h"
#include "parameters/torsion_itp.h"
namespace phaistos {
//! Torsion energy term
class TermCharmmTorsion: public EnergyTermCommon<TermCharmmTorsion, ChainFB> {
private:
//! For convenience, define local EnergyTermCommon
typedef phaistos::EnergyTermCommon<TermCharmmTorsion, ChainFB> EnergyTermCommon;
std::vector<topology::TorsionInteraction> torsion_interactions;
public:
//! Use same settings as base class
typedef EnergyTerm<ChainFB>::SettingsClassicEnergy Settings;
//! Constructor.
//! \param chain Molecule chain
//! \param settings Local Settings object
//! \param random_number_engine Object from which random number generators can be created.
TermCharmmTorsion(ChainFB *chain,
const Settings &settings=Settings(),
RandomNumberEngine *random_number_engine = &random_global)
: EnergyTermCommon(chain, "charmm-torsion", settings, random_number_engine) {
std::vector<topology::TorsionParameter> torsion_parameters
= topology::read_torsion_parameters(charmm_constants::torsion_itp);
this->torsion_interactions
= topology::generate_torsion_interactions(this->chain, torsion_parameters);
}
//! Copy constructor.
//! \param other Source object from which copy is made
//! \param random_number_engine Object from which random number generators can be created.
//! \param thread_index Index indicating in which thread|rank the copy exists
//! \param chain Molecule chain
TermCharmmTorsion(const TermCharmmTorsion &other,
RandomNumberEngine *random_number_engine,
int thread_index, ChainFB *chain)
: EnergyTermCommon(other, random_number_engine, thread_index, chain) {
std::vector<topology::TorsionParameter> torsion_parameters
= topology::read_torsion_parameters(charmm_constants::torsion_itp);
this->torsion_interactions
= topology::generate_torsion_interactions(this->chain, torsion_parameters);
}
//! Evaluate chain energy
//! \param move_info object containing information about last move
//! \return torsional potential energy of the chain in the object
double evaluate(MoveInfo *move_info=NULL) {
double energy_torsion = 0.0;
for (unsigned int i = 0; i < this->torsion_interactions.size(); i++) {
topology::TorsionInteraction interaction = this->torsion_interactions[i];
double phi = calc_dihedral((interaction.atom1)->position,
(interaction.atom2)->position,
(interaction.atom3)->position,
(interaction.atom4)->position);
const double energy_torsion_temp = interaction.cp +
interaction.cp * std::cos(interaction.mult * phi - interaction.phi0 * charmm_constants::DEG_TO_RAD);
energy_torsion += energy_torsion_temp;
if (this->settings.debug > 1) {
std::cout << "# CHARMM torsion:"
<< " a1: " << interaction.atom1
<< " a2: " << interaction.atom2
<< " a3: " << interaction.atom3
<< " a4: " << interaction.atom4
<< " angle: " << phi * charmm_constants::RAD_TO_DEG
<< " e_torsion: " << energy_torsion_temp
<< std::endl;
}
}
if (this->settings.debug > 0) {
printf(" torsion E = %15.6f kJ/mol\n", energy_torsion);
printf(" torsion E = %15.6f kcal/mol\n", energy_torsion * charmm_constants::KJ_TO_KCAL);
}
return energy_torsion * charmm_constants::KJ_TO_KCAL;
}
};
}
#endif
|
/*
Este arquivo faz parte do BCM Revox Engine;
BCM Revox Engine é Software Livre; você pode redistribui-lo e/ou
modificá-lo dentro dos termos da Licença Pública Geral GNU como
publicada pela Fundação do Software Livre (FSF); na versão 3 da Licença.
Este programa é distribuído na esperança que possa ser util,
mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a
qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral
GNU para maiores detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com
este programa, se não, escreva para a Fundação do Software Livre(FSF) Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
BCM Revox Engine v0.2
BCM Revox Engine -> Ano: 2014|Tipo: WebEngine
*/
#ifndef _PLAIN_H_
#define _PLAIN_H_
#include "typeparser.h"
/**
* Inicializa a analise de arquivo texto.
*
* @param content char[] - conteudo do arquivo a ser verificado.
* @param url char[] - endereço do arquivo a ser verificado.
* @return typec - conteúdo do arquivo analisado.
**/
typec InitPlain(char content[], char url[]);
#endif // _PLAIN_H_
|
//
// SSTV-Beacon 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, or (at your option)
// any later version.
//
// SSTV-Beacon is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GNU Radio; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street,
// Boston, MA 02110-1301, USA.
//
#ifndef SSTVI_VIS_CODE_STATE_MACHINE_H_
#define SSTVI_VIS_CODE_STATE_MACHINE_H_
#include "sstvi_state_machine.h"
#include "sstvi_sstv_vis_code.h"
#include "sstvi_timing_error.h"
#include <boost/shared_ptr.hpp>
#include <vector>
class vis_code_state_machine : public sstvi_state_machine
{
typedef enum
{
VIS_LEADER0,
VIS_BREAK,
VIS_LEADER1,
VIS_START,
VIS_BITS,
VIS_STOP,
VIS_EXIT
} states_t;
states_t d_state;
sstv_vis_code_info d_vis;
int d_vis_ptr;
typedef unsigned int uint_t;
typedef enum
{
TIMING_VIS
} timing_id;
time_duration d_ticbuf[1];
void tic( time_duration const & start, timing_id ind )
{
d_ticbuf[ind] = start;
}
time_duration toc( time_duration const stop, timing_id ind )
{
return stop - d_ticbuf[ind];
}
public:
// Martin M1: 44 (decimal)
vis_code_state_machine( int vis_code );
virtual void init();
virtual symbol_t next_symbol( time_duration const & );
virtual bool ready() { return true; }
virtual bool set_data( std::vector< unsigned char > data ) { return true; };
virtual time_duration get_expected_duration();
};
#endif /* SSTVI_VIS_CODE_STATE_MACHINE_H_ */
|
#ifndef STATISTICSPLUGINPCA_H
#define STATISTICSPLUGINPCA_H
#include "interfaces/IStatisticsPlugin.h"
#include <QtilitiesCategory>
#include <QObject>
namespace Praaline {
namespace Plugins {
namespace StatisticsPluginPCA {
/*!
\struct StatisticsPluginPCAData
\brief The StatisticsPluginPCAData struct stores private data used by the StatisticsPluginPCA class.
*/
struct StatisticsPluginPCAData;
/*!
\class StatisticsPluginPCA
\brief Statistical analysis plugin: Principal Component Analysis
This class is the entry point into the plugin and is an implementation of the Qtilities::ExtensionSystem::Interfaces::IPlugin interface.
*/
class StatisticsPluginPCA : public QObject, public IStatisticsPlugin
{
Q_OBJECT
Q_INTERFACES(Qtilities::ExtensionSystem::Interfaces::IPlugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// Q_PLUGIN_METADATA(IID "org.praaline.StatisticsPluginPCA")
#endif
public:
StatisticsPluginPCA(QObject *parent = nullptr);
virtual ~StatisticsPluginPCA();
// IObjectBase implementation
QObject* objectBase() override { return this; }
const QObject* objectBase() const override { return this; }
// IPlugin implementation
bool initialize(const QStringList &arguments, QStringList *error_strings) override;
bool initializeDependencies(QStringList *error_strings) override;
void finalize() override;
QString pluginName() const override;
QtilitiesCategory pluginCategory() const override;
VersionInformation pluginVersionInformation() const override;
QString pluginPublisher() const override;
QString pluginPublisherWebsite() const override;
QString pluginPublisherContact() const override;
QString pluginDescription() const override;
QString pluginCopyright() const override;
QString pluginLicense() const override;
// IStatisticsPlugin implementation
QStringList analyserIDs() override;
QString analyserName(const QString &analyserID) override;
QWidget *analyser(const QString &analyserName, CorpusRepository *repository, QWidget *parent = nullptr) override;
private:
StatisticsPluginPCAData* d;
};
}
}
}
#endif // STATISTICSPLUGINPCA_H
|
/*
*******************************************************************************
\file oid_test.c
\brief Tests for object identifiers
\project bee2/test
\author Sergey Agievich [agievich@{bsu.by|gmail.com}]
\created 2013.04.01
\version 2021.04.16
\license This program is released under the GNU General Public License
version 3. See Copyright Notices in bee2/info.h.
*******************************************************************************
*/
#include <bee2/core/mem.h>
#include <bee2/core/hex.h>
#include <bee2/core/oid.h>
#include <bee2/core/str.h>
/*
*******************************************************************************
Тестирование
-# used http://www.viathinksoft.de/~daniel-marschall/asn.1/oid_facts.html
*******************************************************************************
*/
bool_t oidTest()
{
octet buf[1024];
char str[2048];
char str1[2048];
size_t count;
// length octet 0x00
hexTo(buf, "060000");
if (oidFromDER(0, buf, 3) != SIZE_MAX)
return FALSE;
// length octet 0x80
hexTo(buf, "068000");
if (oidFromDER(0, buf, 3) != SIZE_MAX)
return FALSE;
// length octet 0xFF
hexTo(buf, "06FF00");
if (oidFromDER(0, buf, 3) != SIZE_MAX)
return FALSE;
// invalid type
hexTo(buf, "080100");
if (oidFromDER(0, buf, 3) != SIZE_MAX)
return FALSE;
// illegal padding
hexTo(buf, "06070180808080807F");
if (oidFromDER(0, buf, 9) != SIZE_MAX)
return FALSE;
hexTo(buf, "06028001");
if (oidFromDER(0, buf, 4) != SIZE_MAX)
return FALSE;
hexTo(buf, "0602807F");
if (oidFromDER(0, buf, 4) != SIZE_MAX)
return FALSE;
// MacOS errors
hexTo(buf, "06028100");
if (oidFromDER(str, buf, 4) == SIZE_MAX || !strEq(str, "2.48"))
return FALSE;
hexTo(buf, "06028101");
if (oidFromDER(str, buf, 4) == SIZE_MAX || !strEq(str, "2.49"))
return FALSE;
hexTo(buf, "06028837");
if (oidFromDER(str, buf, 4) == SIZE_MAX || !strEq(str, "2.999"))
return FALSE;
// OpenSSL errors
count = oidToDER(buf, "2.65500");
if (count == SIZE_MAX || oidFromDER(str, buf, count) == SIZE_MAX ||
!strEq(str, "2.65500"))
return FALSE;
// overflow
hexTo(buf, "060981B1D1AF85ECA8804F");
if (oidFromDER(0, buf, 11) != SIZE_MAX)
return FALSE;
if (oidIsValid("2.5.4.4294967299"))
return FALSE;
// belt-hash
count = oidToDER(buf, "1.2.112.0.2.0.34.101.31.81");
if (count != 11 || !hexEq(buf, "06092A7000020022651F51"))
return FALSE;
if (oidFromDER(str, buf, count - 1) != SIZE_MAX)
return FALSE;
if (oidFromDER(0, buf, count + 1) != SIZE_MAX)
return FALSE;
// длинная длина
strCopy(str1, "1.2.3456.78910.11121314.15161718.19202122.23242526."
"27282930.31323334.35363738.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18."
"19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42."
"43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66."
"19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42."
"43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66."
"19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42."
"43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66");
count = oidToDER(buf, str1);
if (count == SIZE_MAX ||
oidFromDER(str, buf, count) != strLen(str1) + 1 ||
!strEq(str, str1))
return FALSE;
str1[strLen(str1)] = '.';
strCopy(str1 + strLen(str) + 1, str);
count = oidToDER(buf, str1);
if (count == SIZE_MAX ||
oidFromDER(str, buf, count) != strLen(str1) + 1 ||
!strEq(str, str1))
return FALSE;
// все нормально
return TRUE;
}
|
/*
* This file is part of cg3lib: https://github.com/cg3hci/cg3lib
* This Source Code Form is subject to the terms of the GNU GPL 3.0
*
* @author Stefano Nuvoli (stefano.nuvoli@gmail.com)
*/
#ifndef CG3_TREEGENERICITERATOR_H
#define CG3_TREEGENERICITERATOR_H
namespace cg3 {
/**
* @brief The generic iterator for the binary search tree
*/
template <class B, class N>
class TreeGenericIterator {
template <class T1, class T2, class T3>
friend class TreeIterator;
template <class T1, class T2, class T3>
friend class TreeReverseIterator;
template <class T1, class T2, class T3>
friend class BSTInner;
template <class T1, class T2, class T3>
friend class BSTLeaf;
template <class T1, class T2, class T3>
friend class AVLInner;
template <class T1, class T2, class T3>
friend class AVLLeaf;
template <class T1, class T2, class T3>
friend class RangeTree;
template <int T1, class T2, class T3, class T4>
friend class AABBTree;
protected:
/* Constructors */
inline TreeGenericIterator(B* bst, N* node) :
bst(bst), node(node) {}
/* Fields */
B* bst;
N* node;
};
}
#endif // CG3_TREEGENERICITERATOR_H
|
/*
* Nombre: Bureaucrat.h
*
* Creado en: 02/12/2013
* Versión: v0.003
* Autores: Tinguaro Cubas Saiz
* Juan Henández Hernández
* Miguel Pérez Bello
* Guillermo Rodríguez Pardo
*
* Descripción: Clase encargada de las gestiones y cargas de librerías y los recursos
* necesarios del sistema operativo.
*
*/
#ifndef BUREAUCRAT_H_
#define BUREAUCRAT_H_
class Interface;
class Bureaucrat {
public:
Bureaucrat(const Interface&);
virtual ~Bureaucrat();
void initSDL ();
void initOGL ();
void loadShader ();
private:
const Interface* refInterface_;
void logAction(int);
};
#endif /* BUREAUCRAT_H_ */
|
/*
Copyright (c) 2007-2008 Michael Specht
This file is part of Proteomatic.
Proteomatic 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.
Proteomatic 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 Proteomatic. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QtCore>
#include <QtGui>
class k_UnclickableLabel: public QLabel
{
Q_OBJECT
public:
k_UnclickableLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
k_UnclickableLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);
~k_UnclickableLabel();
protected:
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
virtual void enterEvent(QMouseEvent* event);
virtual void leaveEvent(QMouseEvent* event);
virtual void focusInEvent(QFocusEvent* event);
virtual void focusOutEvent(QFocusEvent* event);
};
|
// Copyright 2014 Timothy Castiglia
// This file is part of Tabloid.
// Tabloid 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.
// Tabloid 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 Tabloid. If not, see <http://www.gnu.org/licenses/>.
//Standard tunings of E, Eb, D, C#, C, B and Bb are supported
//These tunings are named by the first string's tuning
//7, 8 and 9 string guitars supported (?)
#ifndef GUITAR_TAB_CONVERTER_H
#define GUITAR_TAB_CONVERTER_H
#include "converter.h"
#include "sheet_music.h"
#include <fstream>
#include <string>
#include <vector>
class GuitarTabConverter : public Converter
{
public:
GuitarTabConverter();
GuitarTabConverter(std::vector<std::pair<std::string,std::string> >& input);
bool convert(const std::string &name, const SheetMusic &sheet);
private:
void getNote(int pitch, std::string &letter, std::string &alter,
std::string &stringNum, std::string& fret);
void addNote(int pitch, float start, float duration, float beat_duration, int divisions=1);
void addMeasure(int divisions=1, int key=0, int beats=4, int beat_type=4, bool treble=true);
std::vector<std::pair<std::string,std::string> > strings;
std::string tuning;
};
#endif // GUITAR_TAB_CONVERTER_H
|
// Adapted from Qt example 'Elastic nodes'
// http://qt-project.org/doc/qt-4.8/graphicsview-elasticnodes.html
#ifndef GRAPHWIDGET_H
#define GRAPHWIDGET_H
#include <QGraphicsView>
class Node;
class GraphWidget : public QGraphicsView
{
Q_OBJECT
public:
GraphWidget(QWidget *parent = 0);
GraphWidget(const GraphWidget&) = delete;
GraphWidget& operator=(const GraphWidget&) = delete;
void itemMoved();
public slots:
void shuffle();
void zoomIn();
void zoomOut();
protected:
void keyPressEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *event);
void wheelEvent(QWheelEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect);
void scaleView(qreal scaleFactor);
private:
int m_timer_id;
Node * const m_centerNode;
};
#endif
|
#ifndef FRACTIONS_H
#define FRACTIONS_H
#include <boost/scoped_array.hpp>
#include <exception>
#include <ostream>
/**
* @brief A generic class to handle the fractions of types
*/
class Fractions
{
private:
boost::scoped_array<double> _data;
protected:
size_t _typeCount;
public:
/**
* @brief Constructor
*
* @param typeCount The amount of types
*/
Fractions (size_t typeCount);
/**
* @brief Copy constructor
*
* @param Fractions Reference to the object to be copied
*/
Fractions (const Fractions&);
/**
* @brief
*/
void check () const;
/**
* @brief
*
* @param index
*
* @return
*/
const double& operator[] (size_t index) const;
/**
* @brief
*
* @param index
* @param value
*/
void set (size_t index, double value);
/**
* @brief
*
* @param index
* @param value
*/
void add (size_t index, double value);
/**
* @brief
*
* @return
*/
double missing () const;
/**
* @brief
*
* @param out
* @param fractions
*
* @return
*/
friend std::ostream& operator<< (std::ostream& out, const Fractions& fractions);
};
class FractionInconsistent : public std::exception {};
class FractionOutOfRange : public std::exception {};
#endif
|
// -----------------------------------------------
// This file is script-generated...
// -----------------------------------------------
#ifndef WS_GR_FOG_STATUS_H
#define WS_GR_FOG_STATUS_H
namespace vdis
{
typedef enum
{
WS_GR_FOG_STATUS_WSGF_FOG_STATUS_OFF = 0,
WS_GR_FOG_STATUS_WSGF_FOG_STATUS_ON = 1,
WS_GR_FOG_STATUS_END
} ws_gr_fog_status_e;
}
#endif
|
#ifndef TYPE_ITERATOR_MEMBER_M_DECREMENT_H_
#define TYPE_ITERATOR_MEMBER_M_DECREMENT_H_
#include "type/iterator/Base.h"
#include "type/iterator/handle/info/IsType.h"
#include "type/iterator/derived/info/IsType.h"
namespace BrainMuscles
{
namespace type
{
namespace iterator
{
namespace member
{
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
class M_Decrement :
public virtual BrainMuscles::type::iterator::Base<HANDLE, DERIVED_INFO>
{
static_assert(BrainMuscles::type::iterator::derived::info::IsType<DERIVED_INFO>::Value, "[DERIVED_INFO Requires class derived::Info<Definition>");
static_assert(BrainMuscles::type::iterator::handle::info::IsType<HANDLE_INFO>::Value, "Requires class Info<Definition>");
public:
typedef typename DERIVED_INFO::DerivedType DerivedType;
typedef HANDLE HandleType;
typedef BrainMuscles::type::iterator::Base<HANDLE, DERIVED_INFO> BaseType;
typedef M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO> DecrementType;
protected:
M_Decrement();
M_Decrement(const DerivedType& derived);
M_Decrement(const HandleType& handle);
template<typename... ARGS>
M_Decrement(ARGS... args);
public:
virtual ~M_Decrement();
protected:
virtual DerivedType* ThisDerived() = 0;
virtual void OnRequestDecrement(HandleType& handle) = 0;
public:
DerivedType& operator--();
DerivedType operator--(int);
};
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::M_Decrement() :
BaseType()
{}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::M_Decrement(const DerivedType& derived) :
BaseType(derived)
{}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::M_Decrement(const HandleType& handle) :
BaseType(handle)
{}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
template<typename... ARGS>
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::M_Decrement(ARGS... args) :
BaseType(args...)
{}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::~M_Decrement()
{}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
typename M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::DerivedType&
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::operator--()
{
OnRequestDecrement(GetHandle());
return *ThisDerived();
}
template<typename HANDLE, typename DERIVED_INFO, typename HANDLE_INFO>
typename M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::DerivedType
M_Decrement<HANDLE, DERIVED_INFO, HANDLE_INFO>::operator--(int)
{
DerivedType copy = DerivedType(*ThisDerived());
OnRequestDecrement(GetHandle());
return copy;
}
}
}
}
}
#endif //!TYPE_ITERATOR_MEMBER_M_DECREMENT_H_ |
/*
* UCW Library -- Binomial Heaps
*
* (c) 2003 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
*/
/*
* This is a generic implementation of Binomial Heaps. Each time you include
* this file with parameters set in the corresponding preprocessor macros
* as described below, it generates functions for manipulating the particular
* version of the binomial heap.
*/
/***
* [[generator]]
* Interface to the generator
* --------------------------
*
* To use the binomial heaps, you need to specify:
*
* - `BH_PREFIX(x)` -- macro to add a name prefix (used on all global names
* defined by the generator). All further names mentioned
* here except for macro names will be implicitly prefixed.
*
* Then you continue by including `ucw/binheap-node.h` which defines <<struct_bh_node,struct bh_node>>
* and <<struct_bh_heap,struct bh_heap>> (both without prefix). The heap elements are always allocated by
* you and they must include `struct bh_node` which serves as a handle used for all
* the heap functions and it contains all information needed for heap-keeping.
* The heap itself is also allocated by you and it's represented by `struct bh_heap`.
*
* When you have the declaration of heap nodes, you continue with defining:
*
* - `less(p,q)` -- returns `1` if the key corresponding to `bh_node *p`
* is less than the one corresponding to `*q`.
*
* Then specify what operations you request:
*
* - `init(heap\*)` -- initialize the heap (always defined).
* - `insert(heap\*, node\*)` -- insert the node to the heap (`BH_WANT_INSERT`).
* - `node\* findmin(heap\*)` -- find node with minimum key (`BH_WANT_FINDMIN`).
* - `node\* deletemin(heap\*)` -- findmin and delete the node (`BH_WANT_DELETEMIN`).
*
* Then include `ucw/binheap.h` and voila, you have a binomial heap
* suiting all your needs (at least those which you've revealed :) ).
*
* You also get a iterator macro at no extra charge:
*
* BH_FOR_ALL(bh_prefix, heap*, variable)
* {
* // node* variable gets declared automatically
* do_something_with_node(variable);
* // use BH_BREAK and BH_CONTINUE instead of break and continue
* // you must not alter contents of the binomial heap here
* }
* BH_END_FOR;
*
* After including this file, all parameter macros are automatically undef'd.
***/
#define BH_NODE struct bh_node
#define BH_HEAP struct bh_heap
static void
BH_PREFIX(merge)(BH_NODE *a, BH_NODE *b)
{
BH_NODE **pp = &a->first_son;
BH_NODE *q = b->first_son;
BH_NODE *p, *r, *s;
while ((p = *pp) && q)
{
/* p,q are the next nodes of a,b; pp points to where p is linked */
if (p->order < q->order) /* p is smaller => skip it */
pp = &p->next_sibling;
else if (p->order > q->order) /* q is smaller => insert it before p */
{
r = q;
q = q->next_sibling;
r->next_sibling = p;
*pp = r;
pp = &r->next_sibling;
}
else /* p and q are of the same order => need to merge them */
{
if (BH_PREFIX(less)(p, q)) /* we'll hang r below s */
{
r = q;
s = p;
}
else
{
r = p;
s = q;
}
*pp = p->next_sibling; /* unlink p,q from their lists */
q = q->next_sibling;
if (s->last_son) /* merge r to s, increasing order */
s->last_son->next_sibling = r;
else
s->first_son = r;
s->last_son = r;
s->order++;
r->next_sibling = NULL;
if (!q || q->order > s->order) /* put the result into the b's list if possible */
{
s->next_sibling = q;
q = s;
}
else /* otherwise put the result to the a's list */
{
p = s->next_sibling = *pp;
*pp = s;
if (p && p->order == s->order) /* 3-collision */
pp = &s->next_sibling;
}
}
}
if (!p)
*pp = q;
}
#ifdef BH_WANT_INSERT
static void
BH_PREFIX(insert)(BH_HEAP *heap, BH_NODE *a)
{
BH_NODE sh;
sh.first_son = a;
a->first_son = a->last_son = a->next_sibling = NULL;
BH_PREFIX(merge)(&heap->root, &sh);
}
#endif
#ifdef BH_WANT_FINDMIN
static BH_NODE *
BH_PREFIX(findmin)(BH_HEAP *heap)
{
BH_NODE *p, *best;
best = NULL;
for (p=heap->root.first_son; p; p=p->next_sibling)
if (!best || BH_PREFIX(less)(p, best))
best = p;
return best;
}
#endif
#ifdef BH_WANT_DELETEMIN
static BH_NODE *
BH_PREFIX(deletemin)(BH_HEAP *heap)
{
BH_NODE *p, **pp, **bestp;
bestp = NULL;
for (pp=&heap->root.first_son; p=*pp; pp=&p->next_sibling)
if (!bestp || BH_PREFIX(less)(p, *bestp))
bestp = pp;
if (!bestp)
return NULL;
p = *bestp;
*bestp = p->next_sibling;
BH_PREFIX(merge)(&heap->root, p);
return p;
}
#endif
static inline void
BH_PREFIX(init)(BH_HEAP *heap)
{
bzero(heap, sizeof(*heap));
}
#ifndef BH_FOR_ALL
#define BH_FOR_ALL(bh_px, bh_heap, bh_var) \
do { \
struct bh_node *bh_stack[32]; \
uns bh_sp = 0; \
if (bh_stack[0] = (bh_heap)->root.first_son) \
bh_sp++; \
while (bh_sp) { \
struct bh_node *bh_var = bh_stack[--bh_sp]; \
if (bh_var->next_sibling) \
bh_stack[bh_sp++] = bh_var->next_sibling; \
if (bh_var->first_son) \
bh_stack[bh_sp++] = bh_var->first_son;
#define BH_END_FOR \
} \
} while (0)
#define BH_BREAK { bh_sp=0; break; }
#define BH_CONTINUE continue
#endif
#undef BH_PREFIX
#undef BH_NODE
#undef BH_HEAP
#undef BH_WANT_INSERT
#undef BH_WANT_FINDMIN
#undef BH_WANT_DELETEMIN
|
#ifndef CHOLESKY_H_
#define CHOLESKY_H_
#include "matrix.h"
#define BLOCKSIZE 32
#define CODE -1
#ifdef __cplusplus
extern "C" {
#endif
int cholu(double *A, int N);
int bcholu(double *A, int N);
int chol(double *A, int N);
void chold(double *A, int N);
#ifdef __cplusplus
}
#endif
#endif /* CHOLESKY_H_ */
|
/**
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip 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.
*
* Tulip 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.
*
*/
#ifndef COLORSCALECONFIGDIALOG_H_
#define COLORSCALECONFIGDIALOG_H_
#include "tulip/ColorScaleConfigDialogData.h"
#include <tulip/ColorScale.h>
#include <QtGui/QDialog>
#include <QtCore/QString>
namespace tlp {
class TLP_QT_SCOPE ColorScaleConfigDialog : public QDialog, public Ui::ColorScaleDialog {
Q_OBJECT
public :
ColorScaleConfigDialog(ColorScale *colorScale, QWidget *parent = NULL);
void setColorScale(ColorScale *colorScale);
protected :
void resizeEvent(QResizeEvent * event);
void showEvent(QShowEvent * event);
private slots :
void accept();
void pressButtonBrowse();
void nbColorsValueChanged(int value);
void colorTableItemDoubleClicked(QTableWidgetItem *item);
void displaySavedGradientPreview();
void displayUserGradientPreview();
void saveCurrentColorScale();
void deleteSavedColorScale();
void reeditSaveColorScale(QListWidgetItem *savedColorScaleItem);
void importColorScaleFromImageFile();
void invertEditedColorScale();
private :
void setColorScaleFromImage(const QString &imageFilePath);
void loadUserSavedColorScales();
void displayGradientPreview(const QList<QColor> &colorsVector, bool gradient, QLabel *displayLabel);
ColorScale *colorScale;
std::string gradientsImageDirectory;
static std::map<QString, std::vector<Color> > tulipImageColorScales;
static void loadTulipImageColorScales();
static std::vector<Color> getColorScaleFromImage(const QString &imageFilePath);
};
}
#endif /* COLORSCALECONFIGDIALOG_H_ */
|
/*
* DA_Petition.h
* Damsel
*
* Created by Trevor Powell on 11/01/08.
* Copyright 2008 PanicKitten Softworks. All rights reserved.
*
*/
#ifndef DA_PETITION_H
#define DA_PETITION_H
#include "VS_Sprite.h"
class daModeInGame;
class sndSample;
class daPetition : public vsSprite
{
enum State
{
Pickup, // inert pickup; waiting for player to grab me
Inventory, // player has picked me up; don't currently exist on the game board
Held, // being held above player's head right now; actively attracting people!
Dropping, // been dropped by player; passively attracting people
Dropped, // been dropped by player; passively attracting people
Dead // Been used, not yet been respawned as a pickup.
};
daModeInGame * m_mode;
vsSprite * m_player;
sndSample * m_beep;
sndSample * m_explodeBeep;
vsVector2D *m_verts;
int m_signatures;
int m_maxSignatures;
int m_beepedAt;
float m_timer;
bool m_exploding;
float m_explodeTimer;
float m_pulseTimer;
vsVector2D m_dropDestination;
State m_state;
virtual void _Draw( vsDisplayList *list );
public:
daPetition(daModeInGame *mode, int maxSignatures);
virtual ~daPetition();
virtual void Update( float timeStep );
vsVector2D GetPositionInLevel();
bool AttractsPedestrians() { return (m_state == Held || m_state == Dropped); }
bool ActiveAttractsPedestrians() { return (m_state == Held); }
bool AvailableForSpawn() { return (m_state == Dead); }
bool AvailableForPickup() { return (m_state == Pickup); }
bool InInventory() { return (m_state == Inventory); }
void Sign();
void PickedUp();
void HeldUp( vsSprite *player );
void DroppedAt( vsVector2D pos );
void Thrown( vsVector2D source, vsVector2D destination );
void Spawn(const vsVector2D &where);
void Despawn();
};
#endif // DA_PETITION_H
|
/**
Simple network benchmark tool.
Copyright (C) 2017 Valdemar Lindberg
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 _SNT_POOL_H_
#define _SNT_POOL_H_ 1
#include <stdio.h>
#include <stdlib.h>
/**
* Pool node element.
*/
typedef struct snt_pool_node_t{
struct snt_pool_node_t* next; /* Next item in the pool frame. */
void* data[]; /* Base pointer for the element. */
}SNTPoolNode;
/**
* Pool allocator container.
*/
typedef struct snt_pool_allocator_t{
unsigned int num; /* Number of allocated elements in pool. */
unsigned int itemsize; /* Size of each element in pool. */
SNTPoolNode* pool; /* Pool frame. */
}SNTPool;
/**
* Create Poll allocator.
* [next|data]
*
* @Return non null pointer if successfully.
*/
extern SNTPool* sntPoolCreate(unsigned int num,
unsigned int itemsize);
/**
* Lock pool frame from being swapped to
* swap storage.
*/
extern int sntPoolLockMem(SNTPool* poolallocator);
/**
* Obtain the next element from pool frame.
*
* If the returned value is null,
* then the allocator is full.
*
* \allocator
*
* Remark: The item may not be memset to 0.
*
* @Return Non null pointer if pool is not full.
*/
extern void* sntPoolObtain(SNTPool* allocator);
/**
* Return item to pool. Item will be memset
* to zero.
*
* \allocator
*
* @Return current next element in allocator.
*/
extern void* sntPoolReturn(SNTPool* allocator,
void* data);
/**
* Resize the current pool frame size without removing
* current data in the pool frame iff the num is greater
* than the current number of elements.
*/
extern void* sntPoolResize(SNTPool* allocator, unsigned int num, unsigned int itemsize);
/**
* @Return number of nodes.
*/
extern unsigned int sntPoolNumNodes(const SNTPool* pool);
/**
* @Return item size in bytes.
*/
extern unsigned int sntPoolItemSize(const SNTPool* pool);
/**
* Get the node index of a valid node.
*/
extern int sntPoolGetIndex(const SNTPool* pool, const void* data);
/**
* Free pool.
*
* \allocator
*
* Remark: this function will call 'free' on allocator
* and pool frame pointer. The allocator pointer will be
* invalid afterward.
*/
extern void sntPoolFree(SNTPool* pool);
/**
* Memset each pool node.
*/
extern void sntPoolZeroFrame(SNTPool* pool);
#endif
|
../../../linux-headers-3.0.0-12/include/linux/ramfs.h |
/* 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[4];
atomic_int atom_0_r1_1;
atomic_int atom_2_r1_1;
void *t0(void *arg){
label_1:;
int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, 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:;
atomic_store_explicit(&vars[1], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
return NULL;
}
void *t2(void *arg){
label_3:;
int v4_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
atomic_store_explicit(&vars[3], 1, memory_order_seq_cst);
int v15 = (v4_r1 == 1);
atomic_store_explicit(&atom_2_r1_1, v15, memory_order_seq_cst);
return NULL;
}
void *t3(void *arg){
label_4:;
atomic_store_explicit(&vars[3], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[0], 1, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
pthread_t thr2;
pthread_t thr3;
atomic_init(&vars[1], 0);
atomic_init(&vars[2], 0);
atomic_init(&vars[0], 0);
atomic_init(&vars[3], 0);
atomic_init(&atom_0_r1_1, 0);
atomic_init(&atom_2_r1_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_create(&thr2, NULL, t2, NULL);
pthread_create(&thr3, NULL, t3, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
pthread_join(thr2, NULL);
pthread_join(thr3, NULL);
int v5 = atomic_load_explicit(&vars[3], memory_order_seq_cst);
int v6 = (v5 == 2);
int v7 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v8 = (v7 == 2);
int v9 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst);
int v10 = atomic_load_explicit(&atom_2_r1_1, memory_order_seq_cst);
int v11_conj = v9 & v10;
int v12_conj = v8 & v11_conj;
int v13_conj = v6 & v12_conj;
if (v13_conj == 1) assert(0);
return 0;
}
|
#pragma once
#include <string>
#include <list>
#include <utility>
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
class UDPSender
{
public:
UDPSender();
~UDPSender();
void addTarget(std::string adresse, int port);
void send(char * data, int size);
private:
std::list<SOCKADDR_IN> targets;
SOCKET sock;
};
|
// -*- C++ -*-
//=============================================================================
/**
* @file Intrusive_Ref_Count_Object_T.h
*
* $Id: Intrusive_Ref_Count_Object_T.h 91741 2010-09-13 18:13:11Z johnnyw $
*
* @authors Yan Dai <dai_y@ociweb.com>
*/
//=============================================================================
#ifndef TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H
#define TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H
#include /**/ "ace/pre.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "tao/Versioned_Namespace.h"
#include /**/ "tao/Intrusive_Ref_Count_Base_T.h"
#include "ace/Atomic_Op.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class TAO_Intrusive_Ref_Count_Object<ACE_LOCK>
*
* @brief Template class as wrapper of a non reference counted data type but provide
* intrusive reference-counting feature by inherited from TAO_Intrusive_Ref_Count_Base.
* This makes the parameterized type data be smart pointer by using a
* TAO_Intrusive_Ref_Count_Handle<X> to an this wrapper object.
*/
template <class OBJ, class ACE_LOCK>
class TAO_Intrusive_Ref_Count_Object : public TAO_Intrusive_Ref_Count_Base <ACE_LOCK>
{
public:
/// take ownership of obj.
TAO_Intrusive_Ref_Count_Object (OBJ* obj);
virtual ~TAO_Intrusive_Ref_Count_Object (void);
OBJ* get () const;
private:
// Prevent default constructor used.
TAO_Intrusive_Ref_Count_Object (void);
// Prevent copying/assignment.
TAO_Intrusive_Ref_Count_Object (const TAO_Intrusive_Ref_Count_Object&);
TAO_Intrusive_Ref_Count_Object& operator= (const TAO_Intrusive_Ref_Count_Object&);
OBJ* obj_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "tao/Intrusive_Ref_Count_Object_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "tao/Intrusive_Ref_Count_Object_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Intrusive_Ref_Count_Object_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H */
|
/*
* Copyright (C) 2018, 2019 Marios Tsolekas <marios.tsolekas@gmail.com>
*
* This file is part of Corgan.
*
* Corgan 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.
*
* Corgan 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 Corgan. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Marios Tsolekas
*/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "util.h"
#include "paths.h"
#include "contacts.h"
int main()
{
unsetenv("XDG_DATA_HOME");
setenv("HOME", "test_home", 1);
assert(!init_paths());
assert(!init_contacts());
free(contacts[0]->name);
contacts[0]->name = xstrdup("aaa");
assert(!new_contact());
assert(!write_contacts_file());
assert(!free_contacts());
assert(!read_contacts_file());
assert(search_contacts("aaa") == 0);
assert(search_contacts("NEW CONTACT") == 1);
assert(!export_contacts_vcard());
assert(contacts_size == 2);
assert(!del_contact(1));
assert(contacts_size == 1);
assert(!del_contact(0));
assert(contacts_size == 0);
assert(!new_contact());
assert(search_contacts("NEW CONTACT") == 0);
assert(!free_paths());
assert(!free_contacts());
return EXIT_SUCCESS;
}
|
/*
* Copyright (C) 2017-2018 Olzhas Rakhimov
*
* 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
/// The main tree representation of the Model.
#pragma once
#include <QAbstractItemModel>
#include <boost/container/flat_set.hpp>
#include "src/element.h"
#include "src/fault_tree.h"
#include "model.h"
namespace scram::gui {
/// The tree representation for the Model constructs.
class ModelTree : public QAbstractItemModel
{
Q_OBJECT
public:
/// The top row containers of the tree.
enum class Row { FaultTrees, Gates, BasicEvents, HouseEvents };
/// Constructs with the proxy Model as the data.
explicit ModelTree(model::Model *model, QObject *parent = nullptr);
/// Required standard member functions of QAbstractItemModel interface.
/// @{
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
QModelIndex index(int row, int column,
const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &index) const override;
/// @}
/// Provides the data for the tree items.
///
/// @param[in] index The index in this model.
/// @param[in] role The role of the data.
///
/// @returns The index data for the given role.
///
/// @note The Qt::UserRole provides the pointer
/// to the original model element if applicable.
QVariant data(const QModelIndex &index, int role) const override;
private:
/// The comparator to sort elements by their names.
struct NameComparator
{
/// Compares element names lexicographically.
bool operator()(const mef::Element *lhs, const mef::Element *rhs) const
{
return lhs->name() < rhs->name();
}
};
/// Sets up count tracking connections for model element table changes.
///
/// @tparam T The element type in Model::added and Model::removed signals.
/// @tparam Row The corresponding top row for the count data.
template <class T, Row R>
void setupElementCountConnections();
model::Model *m_model; ///< The proxy Model managing the data.
/// The set of fault trees.
boost::container::flat_set<mef::FaultTree *, NameComparator> m_faultTrees;
};
} // namespace scram::gui
|
/* applets/clock-applet.c
* Copyright (C) 2015 Trevor Kulhanek <trevor@nocodenolife.com>
*
* This file is part of NyanBar.
*
* NyanBar 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.
*
* NyanBar 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 NyanBar. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clock-applet.h"
#include "nyanbar-settings.h"
#include <stdlib.h>
#include <string.h>
G_DEFINE_TYPE(ClockApplet, clock_applet, BAR_APPLET_TYPE)
static void clock_applet_init(ClockApplet *self);
static void clock_applet_class_init(ClockAppletClass *klass);
static void clock_applet_dispose(GObject *object);
static gboolean clock_applet_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data);
static gboolean on_update(GtkWidget *widget);
static void clock_applet_init(ClockApplet *self)
{
self->da = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(self), self->da);
g_signal_connect(G_OBJECT(self->da), "draw", G_CALLBACK(clock_applet_draw), self);
g_timeout_add(1000, (GSourceFunc) on_update, (gpointer) self);
}
static void clock_applet_class_init(ClockAppletClass *klass)
{
GObjectClass *g_object_class;
g_object_class = G_OBJECT_CLASS(klass);
g_object_class->dispose = &clock_applet_dispose;
}
static void clock_applet_dispose(GObject *object)
{
G_OBJECT_CLASS(clock_applet_parent_class)->dispose(object);
}
GtkWidget *clock_applet_new(void)
{
ClockApplet *self;
self = g_object_new(CLOCK_APPLET_TYPE, NULL);
return GTK_WIDGET(self);
}
static gboolean on_update(GtkWidget *widget)
{
gtk_widget_queue_draw(widget);
return TRUE;
}
static gboolean clock_applet_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
static PangoLayout *plo;
PangoFontDescription *pfd;
cairo_font_extents_t extents;
GdkRGBA c;
time_t current;
time(¤t);
gchar buf[13];
gint w;
plo = pango_cairo_create_layout(cr);
pfd = pango_font_description_from_string(CLOCK_APPLET(user_data)->font);
pango_font_description_set_weight(pfd, 450);
pango_layout_set_font_description(plo, pfd);
pango_font_description_free(pfd);
pango_cairo_context_set_resolution(pango_layout_get_context(plo), DPI);
cairo_font_extents(cr, &extents);
strftime(buf, 13, clock_format, localtime(¤t));
pango_layout_set_text(plo, buf, -1);
gdk_rgba_parse(&c, CLOCK_APPLET(user_data)->color);
cairo_set_source_rgba(cr, c.red, c.green, c.blue, c.alpha);
cairo_move_to(cr, 0, 0.5 - extents.descent + extents.height / 2);
pango_cairo_show_layout(cr, plo);
pango_layout_get_pixel_size(plo, &w, NULL);
gtk_widget_set_size_request(CLOCK_APPLET(user_data)->da, w, BARH);
}
|
/** Copyright 2012 Lucas Walter */
#ifndef VIMJAY_SIGNALS_H
#define VIMJAY_SIGNALS_H
#include <iostream>
#include <stdio.h>
#include <boost/thread.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
// #include <random>
#include <deque>
#include <map>
#include <string>
#include "vimjay/nodes.h"
namespace bm
{
class MiscSignal : public Signal
{
cv::RNG rng;
int state;
public:
explicit MiscSignal(const std::string name);
virtual void init();
virtual bool update();
virtual bool handleKey(int key);
};
/////////////////////////////////
class SigBuffer : public ImageNode
{
protected:
std::deque<float> sigs;
bool setOut();
boost::mutex sigs_mutex;
bool last_get_was_fr;
public:
explicit SigBuffer(const std::string name);
virtual void init();
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
float getFr(const float fr);
float getInd(int& ind);
// bool writeSignals();
};
class SigBufferXY : public SigBuffer
{
public:
explicit SigBufferXY(const std::string name);
virtual void init();
virtual bool update();
};
class Trig : public Node
{
public:
explicit Trig(const std::string name);
virtual void init();
virtual bool update();
// virtual bool handleKey(int key);
};
// Arbitrary inputs, TBD use multiple inheritance
class SigAdd : public Node
{
public:
explicit SigAdd(const std::string name); // : Signal()
virtual void init();
virtual bool update();
virtual bool handleKey(int key);
};
class SigGreater : public Signal
{
public:
explicit SigGreater(const std::string name);
virtual void init();
virtual bool update();
};
class Mean : public Signal
{
public:
explicit Mean(const std::string name);
virtual void init();
virtual bool update();
};
class SigADSR : public ImageNode
{
public:
explicit SigADSR(const std::string name);
virtual void init();
virtual bool update();
};
// TBD could be image node, light up
// blocks to show which signal inputs
// are active
class SigToInd : public Signal
{
public:
explicit SigToInd(const std::string name);
virtual void init();
virtual bool update();
};
#ifdef NOT_YET_IMPLEMENTED
/////////////////////////////////
class SigFile : public SigBuffer
{
public:
explicit SigFile(const std::string name) {}
virtual void init();
std::string file;
bool loadBuffer();
virtual bool load(cv::FileNodeIterator nd);
virtual bool save(cv::FileStorage& fs);
};
///////////////////////////////////////////////////////////
class SigTap : public Signal
{
public:
explicit SigTap(const std::string name); // : Signal()
virtual void init();
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
};
class SigTapInd : public Tap
{
public:
explicit SigTapInd(const std::string name) {} // : Signal()
virtual void init();
virtual bool update();
virtual bool draw(cv::Point2f ui_offset);
};
class SigMultiply : public Signal
{
public:
explicit Multiply(const std::string name);
virtual void init();
virtual bool update();
};
// Double inputs
class SigAbsDiff : public Signal
{
public:
explicit SigAbsDiff(const std::string name);
virtual void init();
virtual bool update();
};
class SigFlip : public Signal
{
public:
explicit SigFlip(const std::string name);
virtual void init();
virtual bool update();
};
#endif
} // namespace bm
#endif // VIMJAY_SIGNALS_H
|
/*
* Copyright (C) 2010- Peer internet solutions
*
* This file is part of mixare.
*
* 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/>
*/
//
// DataSource.h
// Mixare
//
// Created by Aswin Ly on 24-09-12.
//
#import <Foundation/Foundation.h>
#import "Position.h"
#import "LoadingView.h"
@interface DataSource : NSObject {
LoadingView *loadingView;
NSString *title;
NSString *jsonUrl;
BOOL activated;
BOOL locked;
NSMutableArray *positions;
UIImage *logo;
}
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *jsonUrl;
@property (nonatomic, assign) BOOL activated;
@property (nonatomic, assign) BOOL locked;
@property (nonatomic, strong) NSMutableArray *positions;
@property (nonatomic, readonly) UIImage *logo;
- (id)initTitle:(NSString*)tit jsonUrl:(NSString*)url locked:(BOOL)lock;
- (void)refreshPositions:(NSMutableArray*)results;
- (void)refreshPositionsEventi:(NSMutableArray*)results;
- (void)setListLogo:(NSString*)marker;
- (void)refreshPositionsFB:(CLLocation*)loc currentRadius:(float)rad;
- (void)refreshPositionsTW:(CLLocation*)loc currentRadius:(float)rad;
@end
|
#ifndef MONITORWIDGET_H
#define MONITORWIDGET_H
#include <QTabWidget>
#include <QItemSelection>
#include <QTimer>
#include "SummaryTab.h"
#include "FinishedTaskTab.h"
#include "HistorySummaryTab.h"
#include "IOModuleTab.h"
#include "OngoingTaskTab.h"
#include "SupportedOptTab.h"
QT_BEGIN_NAMESPACE
class QSortFilterProxyModel;
class QItemSelectionModel;
QT_END_NAMESPACE
//! [0]
class MonitorWidget : public QTabWidget
{
Q_OBJECT
public:
MonitorWidget(QWidget *parent=0);
public slots:
void onTimerOut();
void hideNow();
void ShowSum();
void ShowHistory();
void ShowOngoing();
void showSupport();
void showFinished();
void Add10LittleFuzai();
void Add1LargeFuzai();
signals:
public:
SummaryTab *summaryTab;
FinshedTaskTab *finshedTab;
HistorySummaryTab *HistoryTab;
IOModuleTab *IOTab;
OngoingTaskTab *OnGoingTab;
SupportedOptTab* supportTab;
QTimer* m_timer;
};
//! [0]
#endif // MONITORWIDGET_H
|
#include <pcl/point_cloud.h>
#include <pcl/impl/point_types.hpp>
#include <pcl/filters/extract_indices.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/features/normal_3d.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/segmentation/extract_clusters.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/filters/passthrough.h>
#include <pcl/segmentation/region_growing_rgb.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/segmentation/progressive_morphological_filter.h>
class EuclidianClusters {
public :
EuclidianClusters();
void compute(pcl::PointCloud<pcl::PointXYZ>::Ptr pointcloud,std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr>& vec_clusters);
private:
float threshold_ground_;
}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.