text stringlengths 4 6.14k |
|---|
// VirtualDub - Video processing and capture application
// Internal filter library
// Copyright (C) 1998-2011 Avery Lee
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef f_VD2_VDFILTERS_X86_DSP_SSE2_H
#define f_VD2_VDFILTERS_X86_DSP_SSE2_H
void VDDSPBlend8_LerpConst_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16, uint8 factor);
void VDDSPBlend8_Min_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Max_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Add_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Multiply_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_LinearBurn_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Screen_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_HardLight_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_LinearLight_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_PinLight_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_HardMix_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Overlay_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Difference_SSE2(void *dst0, const void *src0, const void *src1, uint32 n16);
void VDDSPBlend8_Select_SSE2(void *dst0, const void *src0, const void *src1, const void *srcm, uint32 n16);
void VDDSPBlend8_Lerp_SSE2(void *dst0, const void *src0, const void *src1, const void *srcm, uint32 n16);
#endif
|
/*
* EAP server/peer: EAP-PSK shared routines
* Copyright (c) 2004-2006, Jouni Malinen <jkmaline@cc.hut.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#include "includes.h"
#include "common.h"
#include "aes_wrap.h"
#include "eap_defs.h"
#include "eap_psk_common.h"
#define aes_block_size 16
void eap_psk_key_setup(const u8 *psk, u8 *ak, u8 *kdk)
{
os_memset(ak, 0, aes_block_size);
aes_128_encrypt_block(psk, ak, ak);
os_memcpy(kdk, ak, aes_block_size);
ak[aes_block_size - 1] ^= 0x01;
kdk[aes_block_size - 1] ^= 0x02;
aes_128_encrypt_block(psk, ak, ak);
aes_128_encrypt_block(psk, kdk, kdk);
}
void eap_psk_derive_keys(const u8 *kdk, const u8 *rand_p, u8 *tek, u8 *msk,
u8 *emsk)
{
u8 hash[aes_block_size];
u8 counter = 1;
int i;
aes_128_encrypt_block(kdk, rand_p, hash);
hash[aes_block_size - 1] ^= counter;
aes_128_encrypt_block(kdk, hash, tek);
hash[aes_block_size - 1] ^= counter;
counter++;
for (i = 0; i < EAP_MSK_LEN / aes_block_size; i++) {
hash[aes_block_size - 1] ^= counter;
aes_128_encrypt_block(kdk, hash, &msk[i * aes_block_size]);
hash[aes_block_size - 1] ^= counter;
counter++;
}
for (i = 0; i < EAP_EMSK_LEN / aes_block_size; i++) {
hash[aes_block_size - 1] ^= counter;
aes_128_encrypt_block(kdk, hash, &emsk[i * aes_block_size]);
hash[aes_block_size - 1] ^= counter;
counter++;
}
}
|
#include <stic.h>
#include <string.h> /* strdup() */
#include <stdlib.h> /* free() */
#include "../../src/utils/path.h"
/* XXX: get_ext and split_ext share test data. */
#define TEST_EXT(full, expected_ext, expected_root_len) \
int root_len; \
const char *ext; \
char *const name = strdup(full); \
\
split_ext(name, &root_len, &ext); \
\
assert_string_equal(expected_ext, ext); \
assert_int_equal((expected_root_len), root_len); \
\
free(name);
TEST(empty_string)
{
TEST_EXT("", "", 0);
}
TEST(empty_extension)
{
TEST_EXT("file.", "", 4);
}
TEST(empty_root)
{
TEST_EXT(".ext", "", 4);
}
TEST(empty_root_double_extension)
{
TEST_EXT(".ext1.ext2", "ext2", 5);
}
TEST(filename_no_extension)
{
TEST_EXT("withoutext", "", 10);
}
TEST(filename_unary_extension)
{
TEST_EXT("with.ext", "ext", 4);
}
TEST(filename_binary_extensions)
{
TEST_EXT("with.two.ext", "ext", 8);
}
TEST(path_no_extension)
{
TEST_EXT("/home/user.name/file", "", 20);
}
TEST(path_unary_extension)
{
TEST_EXT("/home/user.name/file.ext", "ext", 20);
}
TEST(path_binary_extensions)
{
TEST_EXT("/home/user.name/file.double.ext", "ext", 27);
}
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 : */
|
/* ---------------------------------------------------------------------- *
* blacksmith.h
* This file is part of lincity.
* Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
* (c) Corey Keasling, 2004
* ---------------------------------------------------------------------- */
#ifndef __blacksmith_h__
#define __blacksmith_h__
void do_blacksmith(int x, int y);
void mps_blacksmith(int x, int y);
#endif /* __blacksmith_h__ */
|
/*
* Copyright (c) 2009 NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_NVODM_PMU_MAX8907_I2C_H
#define INCLUDED_NVODM_PMU_MAX8907_I2C_H
#if defined(__cplusplus)
extern "C"
{
#endif
// Constant definition
// #define PMU_MAX8907_DEVADDR TBD
#define PMU_MAX8907_I2C_SPEED_KHZ 400
// Function declaration
NvBool Max8907I2cWrite8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 Data);
NvBool Max8907I2cRead8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 *Data);
//20100526, PMIC I2C [START]
#if defined(CONFIG_MACH_STAR)
NvBool Max8907RtcI2cWrite8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 Data);
NvBool Max8907RtcI2cRead8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 *Data);
#endif
//20100526, PMIC I2C [END]
NvBool Max8907I2cWrite32(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU32 Data);
NvBool Max8907I2cRead32(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU32 *Data);
NvBool Max8907RtcI2cWriteTime(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU32 Data);
NvBool Max8907RtcI2cReadTime(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU32 *Data);
NvBool Max8907AdcI2cWrite8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 Data);
NvBool Max8907AdcI2cRead8(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr,
NvU8 *Data);
NvBool Max8907AdcI2cWriteAddrOnly(
NvOdmPmuDeviceHandle hDevice,
NvU8 Addr);
#if defined(__cplusplus)
}
#endif
/** @} */
#endif // INCLUDED_NVODM_PMU_MAX8907_I2C_H
|
/*
File: file_rw2.c
Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <stdio.h>
#include "types.h"
#include "filegen.h"
#include "file_tiff.h"
static void register_header_check_rw2(file_stat_t *file_stat);
static int header_check_rw2(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
const file_hint_t file_hint_rw2= {
.extension="rw2",
.description="Panasonic/Leica RAW",
.min_header_distance=0x800, /* Avoid jpg fragment */
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1,
.enable_by_default=1,
.register_header_check=®ister_header_check_rw2
};
static const unsigned char rw2_header_panasonic[4]= {'I','I','U','\0'};
static void register_header_check_rw2(file_stat_t *file_stat)
{
register_header_check(0, rw2_header_panasonic, sizeof(rw2_header_panasonic), &header_check_rw2, file_stat);
}
static int header_check_rw2(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
/* Panasonic/Leica */
if(memcmp(buffer, rw2_header_panasonic, sizeof(rw2_header_panasonic))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension="rw2";
file_recovery_new->time=get_date_from_tiff_header((const TIFFHeader *)buffer, buffer_size);
file_recovery_new->file_check=&file_check_tiff;
return 1;
}
return 0;
}
|
/*
* This file is part of mpv.
*
* mpv 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.
*
* mpv 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 mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MP_AUDIO_H
#define MP_AUDIO_H
#include "format.h"
#include "chmap.h"
// Audio data chunk
struct mp_audio {
int samples; // number of samples in data (per channel)
void *planes[MP_NUM_CHANNELS]; // data buffer (one per plane)
int rate; // sample rate
struct mp_chmap channels; // channel layout, use mp_audio_set_*() to set
int format; // format (AF_FORMAT_...), use mp_audio_set_format() to set
// Redundant fields, for convenience
int sstride; // distance between 2 samples in bytes on a plane
// interleaved: bps * nch
// planar: bps
int nch; // number of channels (redundant with chmap)
int spf; // sub-samples per sample on each plane
int num_planes; // number of planes
int bps; // size of sub-samples (af_fmt_to_bytes(format))
double pts; // currently invalid within the filter chain
// --- private
// These do not necessarily map directly to planes[]. They can have
// different order or count. There shouldn't be more buffers than planes.
// If allocated[n] is NULL, allocated[n+1] must also be NULL.
struct AVBufferRef *allocated[MP_NUM_CHANNELS];
};
void mp_audio_set_format(struct mp_audio *mpa, int format);
void mp_audio_set_num_channels(struct mp_audio *mpa, int num_channels);
void mp_audio_set_channels(struct mp_audio *mpa, const struct mp_chmap *chmap);
void mp_audio_copy_config(struct mp_audio *dst, const struct mp_audio *src);
bool mp_audio_config_equals(const struct mp_audio *a, const struct mp_audio *b);
bool mp_audio_config_valid(const struct mp_audio *mpa);
char *mp_audio_config_to_str_buf(char *buf, size_t buf_sz, struct mp_audio *mpa);
#define mp_audio_config_to_str(m) mp_audio_config_to_str_buf((char[64]){0}, 64, (m))
void mp_audio_force_interleaved_format(struct mp_audio *mpa);
int mp_audio_psize(struct mp_audio *mpa);
void mp_audio_set_null_data(struct mp_audio *mpa);
void mp_audio_realloc(struct mp_audio *mpa, int samples);
void mp_audio_realloc_min(struct mp_audio *mpa, int samples);
int mp_audio_get_allocated_size(struct mp_audio *mpa);
void mp_audio_fill_silence(struct mp_audio *mpa, int start, int length);
void mp_audio_copy(struct mp_audio *dst, int dst_offset,
struct mp_audio *src, int src_offset, int length);
void mp_audio_copy_attributes(struct mp_audio *dst, struct mp_audio *src);
void mp_audio_skip_samples(struct mp_audio *data, int samples);
void mp_audio_clip_timestamps(struct mp_audio *f, double start, double end);
double mp_audio_end_pts(struct mp_audio *data);
bool mp_audio_is_writeable(struct mp_audio *data);
int mp_audio_make_writeable(struct mp_audio *data);
struct AVFrame;
struct mp_audio *mp_audio_from_avframe(struct AVFrame *avframe);
struct AVFrame *mp_audio_to_avframe_and_unref(struct mp_audio *frame);
struct mp_audio_pool;
struct mp_audio_pool *mp_audio_pool_create(void *ta_parent);
struct mp_audio *mp_audio_pool_get(struct mp_audio_pool *pool,
const struct mp_audio *fmt, int samples);
struct mp_audio *mp_audio_pool_new_copy(struct mp_audio_pool *pool,
struct mp_audio *frame);
int mp_audio_pool_make_writeable(struct mp_audio_pool *pool,
struct mp_audio *frame);
#endif
|
//
// MKCEventPassingTextField.h
// BaseTen Setup
//
// Copyright (C) 2006-2008 Marko Karppinen & Co. LLC.
//
// Before using this software, please review the available licensing options
// by visiting http://basetenframework.org/licensing/ or by contacting
// us at sales@karppinen.fi. Without an additional license, this software
// may be distributed only in compliance with the GNU General Public License.
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version 2.0,
// 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
//
// $Id$
//
#import <Cocoa/Cocoa.h>
@interface MKCEventPassingTextField : NSTextField
{
}
@end
|
/*
* version.h
*
* Copyright (C) 2000 Holger Waechtler <holger@convergence.de>
* for convergence integrated media GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _DVBVERSION_H_
#define _DVBVERSION_H_
#define DVB_API_VERSION 5
#define DVB_API_VERSION_MINOR 3
#endif /*_DVBVERSION_H_*/
|
//
// AlephOneHelper.h
// AlephOne
//
// Created by Daniel Blezek on 5/31/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#include "SDL.h"
#ifdef __IPAD__
// #define iWidth 1024
// #define iHeight 768
#else
// #define iWidth 480
// #define iHeight 320
#endif
// Do we use CADisplayLoop or SDL events?
// #define USE_SDL_EVENT_LOOP 1
#define USE_CADisplayLoop 1
extern void* getLayerFromSDLWindow(SDL_Window *main_screen);
extern void cleanRenderer(SDL_Renderer *renderer);
extern void setDefaultA1View();
extern char* randomName31(); //Returns a random name up to 31 characters.
extern char *getDataDir();
extern char* getLocalDataDir();
extern char* getLocalPrefsDir(); //DCW
extern char* getLocalTmpDir(); //DCW
extern char* LANIP( char *prefix, char *suffix);
extern void overrideSomeA1Prefs();//DCW
extern void helperBringUpHUD();
extern int helperNewGame();
extern void helperSaveGame();
extern void helperHideHUD();
extern void helperBeginTeleportOut();
extern void helperTeleportInLevel();
extern void helperEpilog();
extern void helperGameFinished();
extern void helperHandleLoadGame();
extern void helperDoPreferences();
extern void printGLError ( const char* message );
extern void pumpEvents();
extern void startProgress ( int t );
extern void progressCallback ( int d );
extern void stopProgress();
extern int getOpenGLESVersion();
extern void helperPlayerKilled();
extern void switchToSDLMenu(); //DCW
extern void getSomeTextFromIOS(char *label, const char *currentText); //DCW
extern bool getLocalPlayer ();
extern float extraFieldOfView ();
extern bool headBelowMedia ();
extern bool playerInTerminal ();
extern void cacheInputPreferences();
extern bool shouldswapJoysticks();
extern void cacheRendererPreferences();
extern void cacheRendererQualityPreferences();
extern bool useClassicVisuals ();
extern bool useShaderRenderer ();
extern bool useShaderPostProcessing ();
extern bool fastStart ();
extern bool usingA1DEBUG ();
extern bool survivalMode ();
extern bool shouldHideHud ();
extern bool shouldAllowDoubleClick ();
extern int helperAlwaysPlayIntro();
extern int helperAutocenter();
extern void setKey(SDL_Keycode key, bool down);
extern void moveMouseRelativeAtInterval(float dx, float dy, double movedInterval); //Move mouse at a NSTimeInterval.
extern void moveMouseRelative(float dx, float dy);
extern void grabMovementDeltasForCurrentFrameAtInterval(double timeStamp); //Cache accumulated deltas for future slurp. Call this immediately at frame start.
extern void slurpMouseDelta(float *dx, float *dy); //Grab accumulated deltas.
extern void helperGetMouseDelta ( int *dx, int *dy );
extern void clearSmartTrigger();
extern bool smartTriggerEngaged();
extern void monsterIsCentered ();
extern void monsterIsOnLeft ();
extern void monsterIsOnRight ();
extern bool isMonsterCentered ();
extern bool isMonsterOnLeft ();
extern bool isMonsterOnRight ();
extern void setSmartFirePrimary(bool fire);
extern bool shouldAutoBot();
extern void doOkInASec();
extern void doOkOnNextDialog( bool ok );
extern bool okOnNextDialog();
// Switch weapons
extern void helperSwitchWeapons(int weapon);
// Excuses, excuses
extern void helperQuit();
extern void helperNetwork();
extern void helperEndReplay();
extern void helperSetPreferences(int notifySoundManager);
// Film helpers
extern void helperHandleSaveFilm();
extern void helperHandleLoadFilm();
// Help track hits!
extern void helperNewProjectile ( short projectile_index, short which_weapon, short which_trigger );
extern void helperProjectileHit ( short projectile_index, int damage );
extern void helperProjectileKill ( short projectile_index );
// Starting level
extern short helperGetEntryLevelNumber();
// Picked something up
extern void helperPickedUp ( short itemType );
// Gamma from settings
extern float helperGamma();
//Acessor for mouse smoothing preference
extern bool smoothMouselookPreference();
// Pause alpho
extern GLfloat helperPauseAlpha();
//DCW
extern Uint8 fake_key_map[SDL_NUM_SCANCODES];
extern void helperCacheScreenDimension();
extern int helperLongScreenDimension(); //DCW
extern int helperShortScreenDimension(); //DCW
extern float helperScreenScale();
// C linkage
#if defined(__cplusplus)
extern "C" {
#endif
int helperRunningOniPad();
int helperRetinaDisplay();
int helperOpenGLWidth();
int helperOpenGLHeight();
#if defined(__cplusplus)
}
#endif
|
/* xsoldier, a shoot 'em up game with "not shooting" bonus
* Copyright (C) 1997 Yuusuke HASHIMOTO <s945750@educ.info.kanagawa-u.ac.jp>
* Copyright (C) 2002 Oohara Yuuma <oohara@libra.interq.or.jp>
*
* This is a copyleft program. See the file LICENSE for details.
*/
/* $Id: game.h,v 1.2 2002/04/12 00:03:31 oohara Exp $ */
#if !defined _GAME_H_
#define _GAME_H_
extern int mainLoop(void);
#endif
|
/* -*- c -*- */
#ifndef INCLUDED_LIB3DS_ATMOSPHERE_H
#define INCLUDED_LIB3DS_ATMOSPHERE_H
/*
* The 3D Studio File Format Library
* Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: atmosphere.h 1651 2004-05-31 08:01:30Z andi75 $
*/
#ifndef INCLUDED_LIB3DS_TYPES_H
#include <lib3ds/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*!
* Fog atmosphere settings
* \ingroup atmosphere
*/
typedef struct _Lib3dsFog {
Lib3dsBool use;
Lib3dsRgb col;
Lib3dsBool fog_background;
Lib3dsFloat near_plane;
Lib3dsFloat near_density;
Lib3dsFloat far_plane;
Lib3dsFloat far_density;
} Lib3dsFog;
/*!
* Layer fog atmosphere flags
* \ingroup atmosphere
*/
typedef enum _Lib3dsLayerFogFlags {
LIB3DS_BOTTOM_FALL_OFF =0x00000001,
LIB3DS_TOP_FALL_OFF =0x00000002,
LIB3DS_FOG_BACKGROUND =0x00100000
} Lib3dsLayerFogFlags;
/*!
* Layer fog atmosphere settings
* \ingroup atmosphere
*/
typedef struct _Lib3dsLayerFog {
Lib3dsBool use;
Lib3dsDword flags;
Lib3dsRgb col;
Lib3dsFloat near_y;
Lib3dsFloat far_y;
Lib3dsFloat density;
} Lib3dsLayerFog;
/*!
* Distance cue atmosphere settings
* \ingroup atmosphere
*/
typedef struct _Lib3dsDistanceCue {
Lib3dsBool use;
Lib3dsBool cue_background;
Lib3dsFloat near_plane;
Lib3dsFloat near_dimming;
Lib3dsFloat far_plane;
Lib3dsFloat far_dimming;
} Lib3dsDistanceCue;
/*!
* Atmosphere settings
* \ingroup atmosphere
*/
struct _Lib3dsAtmosphere {
Lib3dsFog fog;
Lib3dsLayerFog layer_fog;
Lib3dsDistanceCue dist_cue;
};
extern LIB3DSAPI Lib3dsBool lib3ds_atmosphere_read(Lib3dsAtmosphere *atmosphere, Lib3dsIo *io);
extern LIB3DSAPI Lib3dsBool lib3ds_atmosphere_write(Lib3dsAtmosphere *atmosphere, Lib3dsIo *io);
#ifdef __cplusplus
};
#endif
#endif
|
#pragma once
// Standard C++ includes
#include <string>
#include <vector>
// GeNN includes
#include "gennExport.h"
// GeNN code generator includes
#include "backendBase.h"
// Forward declarations
class ModelSpecInternal;
namespace filesystem
{
class path;
}
//--------------------------------------------------------------------------
// CodeGenerator
//--------------------------------------------------------------------------
namespace CodeGenerator
{
GENN_EXPORT std::pair<std::vector<std::string>, MemAlloc> generateAll(const ModelSpecInternal &model, const BackendBase &backend,
const filesystem::path &sharePath, const filesystem::path &outputPath,
bool forceRebuild = false);
GENN_EXPORT void generateNeuronUpdate(const filesystem::path &outputPath, const ModelSpecMerged &modelMerged,
const BackendBase &backend, const std::string &suffix = "");
GENN_EXPORT void generateCustomUpdate(const filesystem::path &outputPath, const ModelSpecMerged &modelMerged,
const BackendBase &backend, const std::string &suffix = "");
GENN_EXPORT void generateSynapseUpdate(const filesystem::path &outputPath, const ModelSpecMerged &modelMerged,
const BackendBase &backend, const std::string &suffix = "");
GENN_EXPORT void generateInit(const filesystem::path &outputPath, const ModelSpecMerged &modelMerged,
const BackendBase &backend, const std::string &suffix = "");
}
|
/*
* caja-python.c - Caja Python extension
*
* Copyright (C) 2004 Johan Dahlin
*
* This 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 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef CAJA_PYTHON_H
#define CAJA_PYTHON_H
#include <glib-object.h>
#include <glib/gprintf.h>
#include <Python.h>
#if defined(NO_IMPORT)
#define CAJA_PYTHON_VAR_DECL extern
#else
#define CAJA_PYTHON_VAR_DECL
#endif
typedef enum {
CAJA_PYTHON_DEBUG_MISC = 1 << 0,
} CajaPythonDebug;
extern CajaPythonDebug caja_python_debug;
#define debug(x) { if (caja_python_debug & CAJA_PYTHON_DEBUG_MISC) \
g_printf( "caja-python:" x "\n"); }
#define debug_enter() { if (caja_python_debug & CAJA_PYTHON_DEBUG_MISC) \
g_printf("%s: entered\n", __FUNCTION__); }
#define debug_enter_args(x, y) { if (caja_python_debug & CAJA_PYTHON_DEBUG_MISC) \
g_printf("%s: entered " x "\n", __FUNCTION__, y); }
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyGtkWidget_Type;
#define PyGtkWidget_Type (*_PyGtkWidget_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaColumn_Type;
#define PyCajaColumn_Type (*_PyCajaColumn_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaColumnProvider_Type;
#define PyCajaColumnProvider_Type (*_PyCajaColumnProvider_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaInfoProvider_Type;
#define PyCajaInfoProvider_Type (*_PyCajaInfoProvider_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaLocationWidgetProvider_Type;
#define PyCajaLocationWidgetProvider_Type (*_PyCajaLocationWidgetProvider_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaMenu_Type;
#define PyCajaMenu_Type (*_PyCajaMenu_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaMenuItem_Type;
#define PyCajaMenuItem_Type (*_PyCajaMenuItem_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaMenuProvider_Type;
#define PyCajaMenuProvider_Type (*_PyCajaMenuProvider_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaPropertyPage_Type;
#define PyCajaPropertyPage_Type (*_PyCajaPropertyPage_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaPropertyPageProvider_Type;
#define PyCajaPropertyPageProvider_Type (*_PyCajaPropertyPageProvider_Type)
CAJA_PYTHON_VAR_DECL PyTypeObject *_PyCajaOperationHandle_Type;
#define PyCajaOperationHandle_Type (*_PyCajaOperationHandle_Type)
#endif /* CAJA_PYTHON_H */
|
#ifndef _H_FEATURES_H_
#define _H_FEATURES_H_
//#define _DEFAULT_SOURCE 1
#if 0
#define _POSIX_CLOCK_SELECTION 1
#define _POSIX_MONOTONIC_CLOCK 1
#define _POSIX_TIMERS 1
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE 200809L
#endif
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif
#endif
#ifndef _POSIX_TIMERS
#define _POSIX_TIMERS 200809L
#endif
#ifndef _POSIX_MONOTONIC_CLOCK
#define _POSIX_MONOTONIC_CLOCK 200809L
#endif
#ifndef _POSIX_CLOCK_SELECTION
#define _POSIX_CLOCK_SELECTION 200809L
#endif
#include_next <sys\features.h>
#endif
|
/*
*
*
* Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, 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 version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
#ifndef _PCSL_NETWORK_MD_H
#define _PCSL_NETWORK_MD_H
/**
* @file
* @ingroup network
*
* Platform-dependent definitions for pcsl network network for socket over
* serial-based implementation
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* The value which valid handle returned by pcsl network functions cannot have
*/
#define INVALID_HANDLE_MD ((void*)-1)
/**
* Maximum length of array of bytes sufficient to hold IP address
*/
#define MAX_ADDR_LENGTH_MD 4
/**
* Maximum host name length
*/
#define MAX_HOST_LENGTH_MD 32
#ifdef __cplusplus
}
#endif
#endif /* _PCSL_NETWORK_MD_H */
|
/*
* Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com
* Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com
*
* The initial version of this code was written by Dragos Vingarzan
* (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the
* Fruanhofer Institute. It was and still is maintained in a separate
* branch of the original SER. We are therefore migrating it to
* Kamailio/SR and look forward to maintaining it from here on out.
* 2011/2012 Smile Communications, Pty. Ltd.
* ported/maintained/improved by
* Jason Penton (jason(dot)penton(at)smilecoms.com and
* Richard Good (richard(dot)good(at)smilecoms.com) as part of an
* effort to add full IMS support to Kamailio/SR using a new and
* improved architecture
*
* NB: Alot of this code was originally part of OpenIMSCore,
* FhG Fokus.
* Copyright (C) 2004-2006 FhG Fokus
* Thanks for great work! This is an effort to
* break apart the various CSCF functions into logically separate
* components. We hope this will drive wider use. We also feel
* that in this way the architecture is more complete and thereby easier
* to manage in the Kamailio/SR environment
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio 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
*
* Kamailio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include "utils.h"
#include "globals.h"
#include "worker.h"
#include "timer.h"
#include "../../cfg/cfg_struct.h"
/* defined in ../diameter_peer.c */
int dp_add_pid(pid_t pid);
void dp_del_pid(pid_t pid);
timer_cb_list_t *timers=0; /**< list of timers */
gen_lock_t *timers_lock=0; /**< lock for the list of timers */
/** how many seconds to sleep on each timer iteration */
#define TIMER_RESOLUTION 1
/**
* Loop that checks every #TIMER_RESOLUTION seconds if some timer expired.
* On expires, the callback is called. The callback should return rapidly
* in order to avoid blocking the timer process. If the timer is "one_time",
* then it is removed from the timers list.
* @returns on shutdown
*/
void timer_loop()
{
time_t now;
timer_cb_t *i;
callback_f cb=0;
void *ptr=0;
int interval=0;
while(1){
if (shutdownx && *shutdownx) break;
now = time(0);
cfg_update();
do {
cb = 0;
lock_get(timers_lock);
i = timers->head;
while(i && i->expires>now) i = i->next;
if (i){
cb = i->cb;
ptr = *(i->ptr);
if (i->one_time){
if (i->prev) i->prev->next = i->next;
else timers->head = i->next;
if (i->next) i->next->prev = i->prev;
else timers->tail = i->next;
shm_free(i);
i=0;
}
}
lock_release(timers_lock);
if (cb) {
interval = cb(now,ptr);
if (i){
lock_get(timers_lock);
i->expires = now + interval;
lock_release(timers_lock);
}
}
} while(cb);
sleep(TIMER_RESOLUTION);
}
}
/**
* Adds a timer to the timer list.
* @param expires_in - time until expiration in seconds
* @param one_time - if after expiration it should be removed or kept in the timers list
* @param cb - callback function to be called on expiration
* @param ptr - generic pointer to pass to the callback on expiration
* @returns 1 on success or 0 on failure
*/
int add_timer(int expires_in,int one_time,callback_f cb,void *ptr)
{
timer_cb_t *n;
if (expires_in==0){
LM_ERR("add_timer(): Minimum expiration time is 1 second!\n");
return 0;
}
n = shm_malloc(sizeof(timer_cb_t));
if (!n){
LOG_NO_MEM("shm",sizeof(timer_cb_t));
return 0;
}
n->ptr = shm_malloc(sizeof(void*));
if (!n){
LOG_NO_MEM("shm",sizeof(void*));
shm_free(n);
return 0;
}
n->expires = expires_in + time(0);
n->one_time = one_time;
//n->interval = expires_in;
n->cb = cb;
*(n->ptr) = ptr;
lock_get(timers_lock);
n->prev = timers->tail;
n->next = 0;
if (!timers->head) timers->head = n;
if (timers->tail) timers->tail->next = n;
timers->tail = n;
lock_release(timers_lock);
return 1;
}
/**
* Init the timer structures
*/
void timer_cdp_init()
{
timers = shm_malloc(sizeof(timer_cb_list_t));
timers->head=0;
timers->tail=0;
timers_lock = lock_alloc();
timers_lock = lock_init(timers_lock);
}
/**
* Destroy the timer structures
*/
void timer_cdp_destroy()
{
timer_cb_t *n,*i;
/* lock_get(timers_lock);*/
i = timers->head;
while(i){
n = i->next;
if (i->ptr) shm_free(i->ptr);
shm_free(i);
i = n;
}
shm_free(timers);
lock_destroy(timers_lock);
lock_dealloc((void*)timers_lock);
}
/**
* Timer Process function.
* It calls timer_loop().
* @param returns - whether on shutdown this function should return or exit
* @returns if returns is set then on shutdown, else never and on shutdown it exits
*/
void timer_process(int returns)
{
LM_INFO("Timer process starting up...\n");
timer_loop();
LM_INFO("... Timer process finished\n");
if (!returns) {
#ifdef CDP_FOR_SER
#else
#ifdef PKG_MALLOC
#ifdef PKG_MALLOC
LM_DBG("Timer Memory status (pkg):\n");
//pkg_status();
#ifdef pkg_sums
pkg_sums();
#endif
#endif
#endif
dp_del_pid(getpid());
#endif
exit(0);
}
}
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010-2012 Lennart Poettering
systemd 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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdarg.h>
#include <ctype.h>
#include <sys/prctl.h>
#include <sys/time.h>
#include <linux/rtc.h>
#include "macro.h"
#include "util.h"
#include "log.h"
#include "strv.h"
#include "hwclock.h"
#include "fileio.h"
int hwclock_get_time(struct tm *tm) {
_cleanup_close_ int fd = -1;
assert(tm);
fd = open("/dev/rtc", O_RDONLY|O_CLOEXEC);
if (fd < 0)
return -errno;
/* This leaves the timezone fields of struct tm
* uninitialized! */
if (ioctl(fd, RTC_RD_TIME, tm) < 0)
return -errno;
/* We don't know daylight saving, so we reset this in order not
* to confuse mktime(). */
tm->tm_isdst = -1;
return 0;
}
int hwclock_set_time(const struct tm *tm) {
_cleanup_close_ int fd = -1;
assert(tm);
fd = open("/dev/rtc", O_RDONLY|O_CLOEXEC);
if (fd < 0)
return -errno;
if (ioctl(fd, RTC_SET_TIME, tm) < 0)
return -errno;
return 0;
}
int hwclock_is_localtime(void) {
_cleanup_fclose_ FILE *f;
/*
* The third line of adjtime is "UTC" or "LOCAL" or nothing.
* # /etc/adjtime
* 0.0 0 0
* 0
* UTC
*/
f = fopen("/etc/adjtime", "re");
if (f) {
char line[LINE_MAX];
bool b;
b = fgets(line, sizeof(line), f) &&
fgets(line, sizeof(line), f) &&
fgets(line, sizeof(line), f);
if (!b)
return -EIO;
truncate_nl(line);
return streq(line, "LOCAL");
} else if (errno != ENOENT)
return -errno;
return 0;
}
int hwclock_set_timezone(int *min) {
const struct timeval *tv_null = NULL;
struct timespec ts;
struct tm *tm;
int minutesdelta;
struct timezone tz;
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
assert_se(tm = localtime(&ts.tv_sec));
minutesdelta = tm->tm_gmtoff / 60;
tz.tz_minuteswest = -minutesdelta;
tz.tz_dsttime = 0; /* DST_NONE*/
/*
* If the hardware clock does not run in UTC, but in local time:
* The very first time we set the kernel's timezone, it will warp
* the clock so that it runs in UTC instead of local time.
*/
if (settimeofday(tv_null, &tz) < 0)
return -errno;
if (min)
*min = minutesdelta;
return 0;
}
int hwclock_reset_timezone(void) {
const struct timeval *tv_null = NULL;
struct timezone tz;
tz.tz_minuteswest = 0;
tz.tz_dsttime = 0; /* DST_NONE*/
/*
* The very first time we set the kernel's timezone, it will warp
* the clock. Do a dummy call here, so the time warping is sealed
* and we set only the timezone with next call.
*/
if (settimeofday(tv_null, &tz) < 0)
return -errno;
return 0;
}
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTAINER_H_
#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTAINER_H_
#import <Cocoa/Cocoa.h>
#include <vector>
#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
@class AutofillArrowView;
namespace autofill {
class DialogNotification;
typedef std::vector<DialogNotification> DialogNotifications;
class AutofillDialogViewDelegate;
}
@interface AutofillNotificationContainer : NSViewController<AutofillLayout> {
@private
base::scoped_nsobject<NSMutableArray> notificationControllers_;
NSView* anchorView_;
autofill::AutofillDialogViewDelegate* delegate_;
}
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
- (NSSize)preferredSizeForWidth:(CGFloat)width;
- (void)setNotifications:(const autofill::DialogNotifications&) notifications;
- (void)setAnchorView:(NSView*)anchorView;
@end
#endif
|
/*
Copyright (C)2003 Barry Dunne (http://www.emule-project.net)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
This work is based on the java implementation of the Kademlia protocol.
Kademlia: Peer-to-peer routing based on the XOR metric
Copyright (C) 2002 Petar Maymounkov [petar@post.harvard.edu]
http://kademlia.scs.cs.nyu.edu
*/
// Note To Mods //
/*
Please do not change anything here and release it..
There is going to be a new forum created just for the Kademlia side of the client..
If you feel there is an error or a way to improve something, please
post it in the forum first and let us look at it.. If it is a real improvement,
it will be added to the offical client.. Changing something without knowing
what all it does can cause great harm to the network if released in mass form..
Any mod that changes anything within the Kademlia side will not be allowed to advertise
there client on the eMule forum..
*/
#pragma once
namespace Kademlia
{
#define SEARCHTOLERANCE 16777216
#define K 10
#define KBASE 4
#define KK 5
#define ALPHA_QUERY 3
#define LOG_BASE_EXPONENT 5
#define HELLO_TIMEOUT 20
#define SEARCH_JUMPSTART 1
#define SEARCH_LIFETIME 45
#define SEARCHFILE_LIFETIME 45
#define SEARCHKEYWORD_LIFETIME 45
#define SEARCHNOTES_LIFETIME 45
#define SEARCHNODE_LIFETIME 45
#define SEARCHNODECOMP_LIFETIME 10
#define SEARCHSTOREFILE_LIFETIME 140
#define SEARCHSTOREKEYWORD_LIFETIME 140
#define SEARCHSTORENOTES_LIFETIME 100
#define SEARCHFINDBUDDY_LIFETIME 100
#define SEARCHFINDSOURCE_LIFETIME 45
#define SEARCHFILE_TOTAL 300
#define SEARCHKEYWORD_TOTAL 300
#define SEARCHNOTES_TOTAL 50
#define SEARCHSTOREFILE_TOTAL 10
#define SEARCHSTOREKEYWORD_TOTAL 10
#define SEARCHSTORENOTES_TOTAL 10
#define SEARCHNODECOMP_TOTAL 10
#define SEARCHFINDBUDDY_TOTAL 10
#define SEARCHFINDSOURCE_TOTAL 20
}
|
/*
*
* sshaudit_winsyslog.c
*
* Author: Markku Rossi <mtr@ssh.fi>
*
* Copyright:
* Copyright (c) 2002, 2003, 2006 SFNT Finland Oy.
* All rights reserved.
*
* Audit callback for storing events into Windows syslog.
*
*/
#include "sshincludes.h"
#include "sshaudit_winsyslog.h"
/************************** Types and definitions ***************************/
#define SSH_DEBUG_MODULE "SshAuditWinSyslog"
/* Context data for the Windows syslog back-end. */
struct SshAuditWinSyslogContextRec
{
HANDLE event_source;
SshAuditFormatType format;
SshBufferStruct buffer;
};
/***************** Creating and destroying syslog back-ends *****************/
SshAuditWinSyslogContext
ssh_audit_winsyslog_create(const char *event_source_name,
SshAuditFormatType format)
{
#ifdef UNICODE
WCHAR *uc_buffer;
size_t uc_buf_size;
#endif /* UNICODE */
SshAuditWinSyslogContext ctx;
ctx = ssh_calloc(1, sizeof(*ctx));
if (ctx == NULL)
goto error;
#ifdef UNICODE
uc_buf_size = (strlen(event_source_name) + 1) * sizeof(WCHAR);
uc_buffer = ssh_calloc(1, uc_buf_size);
if (uc_buffer == NULL)
goto error;
ssh_ascii_to_unicode(uc_buffer, uc_buf_size, event_source_name);
ctx->event_source = RegisterEventSource(NULL, uc_buffer);
ssh_free(uc_buffer);
#else
ctx->event_source = RegisterEventSource(NULL, event_source_name);
#endif /* UNICODE */
if (!ctx->event_source)
{
SSH_DEBUG(SSH_D_ERROR, ("Could not register event source"));
goto error;
}
ctx->format = format;
ssh_buffer_init(&ctx->buffer);
/* All done. */
return ctx;
/* Error handling. */
error:
ssh_audit_winsyslog_destroy(ctx);
return NULL;
}
void
ssh_audit_winsyslog_destroy(SshAuditWinSyslogContext context)
{
if (context == NULL)
return;
ssh_buffer_uninit(&context->buffer);
if (context->event_source)
DeregisterEventSource(context->event_source);
ssh_free(context);
}
/******* The audit callback function for the Windows syslog back-end ********/
void
ssh_audit_winsyslog_cb(SshAuditEvent event, SshUInt32 argc,
SshAuditArgument argv, void *context)
{
SshAuditWinSyslogContext ctx = (SshAuditWinSyslogContext) context;
LPTSTR strings[1];
#ifdef UNICODE
size_t uc_str_size;
#endif /* UNICODE */
ssh_buffer_clear(&ctx->buffer);
if (!ssh_audit_format(&ctx->buffer, ctx->format, event, argc, argv))
{
error:
SSH_DEBUG(SSH_D_ERROR, ("Could not format event into a string"));
return;
}
if (ssh_buffer_append(&ctx->buffer, (unsigned char *) "\0", 1)
!= SSH_BUFFER_OK)
goto error;
#ifdef UNICODE
uc_str_size = (strlen(ssh_buffer_ptr(&ctx->buffer)) + 1) * sizeof(WCHAR);
strings[0] = ssh_calloc(1, uc_str_size);
if (strings[0] == NULL)
goto error;
ssh_ascii_to_unicode(strings[0], uc_str_size, ssh_buffer_ptr(&ctx->buffer));
#else
strings[0] = ssh_buffer_ptr(&ctx->buffer);
#endif /* UNICODE */
ReportEvent(ctx->event_source, /* Handle of event source. */
EVENTLOG_ERROR_TYPE, /* Event type. */
0, /* Event category. */
0, /* Event ID. */
NULL, /* Current user's SID. */
1, /* Number of strings in `strings'. */
0, /* Number of bytes of raw data. */
strings, /* Array of error strings. */
NULL); /* Raw data. */
#ifdef UNICODE
ssh_free(strings[0]);
#endif /* UNICODE */
}
|
#include <stdio.h>
#include <math.h>
#define s(n) ((1+n)*n/2)
int solve(int dis)
{
int u, steps;
int remain;
int i;
if (dis == 0)
return 0;
else if (dis == 1)
return 1;
else if (dis == 2)
return 2;
u = sqrt(dis);
steps = 2 * (u - 1);
remain = dis - u * (u - 1);
for (i = u; remain != 0; --i)
if (remain >= i) {
steps += remain / i;;
remain %= i;
}
return steps;
}
int main()
{
int x, y;
int total_test;
int ans;
scanf("%d", &total_test);
while (total_test-- > 0) {
scanf("%d%d", &x, &y);
ans = solve(y - x);
printf("%d\n", ans);
}
return 0;
}
|
/***************************************************************************
* This file is part of KDevelop *
* Copyright 2009 Niko Sams <niko.sams@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This 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 Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KDEVELOP_IVARIABLECONTROLLER_H
#define KDEVELOP_IVARIABLECONTROLLER_H
#include <QtCore/QObject>
class QString;
#include "../debuggerexport.h"
#include "idebugsession.h"
namespace KTextEditor {
class Document;
class Cursor;
}
namespace KDevelop {
class IDebugSession;
class VariableCollection;
class Variable;
class TreeModel;
class TreeItem;
class KDEVPLATFORMDEBUGGER_EXPORT IVariableController : public QObject
{
Q_OBJECT
public:
IVariableController(IDebugSession* parent);
/* Create a variable for the specified expression in the currentl
thread and frame. */
virtual Variable* createVariable(TreeModel* model, TreeItem* parent,
const QString& expression,
const QString& display = "") = 0;
virtual QString expressionUnderCursor(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor) = 0;
virtual void addWatch(Variable* variable) = 0;
virtual void addWatchpoint(Variable* variable) = 0;
enum UpdateType {
UpdateNone = 0x0,
UpdateLocals = 0x1,
UpdateWatches = 0x2
};
Q_DECLARE_FLAGS(UpdateTypes, UpdateType)
void setAutoUpdate(QFlags<UpdateType> autoUpdate);
QFlags<UpdateType> autoUpdate();
protected:
/**
* Convenience function that returns the VariableCollection
**/
VariableCollection *variableCollection();
/**
* Convenience function that returns the used DebugSession
**/
IDebugSession *session() const;
virtual void update() = 0;
virtual void handleEvent(IDebugSession::event_t event);
friend class IDebugSession;
private Q_SLOTS:
void stateChanged(KDevelop::IDebugSession::DebuggerState);
private:
void updateIfFrameOrThreadChanged();
QFlags<UpdateType> m_autoUpdate;
int m_activeThread;
int m_activeFrame;
};
} // namespace KDevelop
Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::IVariableController::UpdateTypes)
#endif
|
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
struct test {
int a : 3;
int : 0;
int b[3];
int c : 2;
};
int main() {
struct test t = { 1, { 3, 4, 5 }, 1 };
return t.a + t.b[0] + t.b[1] + t.b[2] + t.c;
}
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: backlight-target.h 17847 2008-06-28 18:10:04Z bagder $
*
* Copyright (C) 2006 by Linus Nielsen Feltzing
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
bool _backlight_init(void);
void _backlight_on(void);
void _backlight_off(void);
void _backlight_set_brightness(int val);
void _remote_backlight_on(void);
void _remote_backlight_off(void);
#endif
|
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <asm/io.h>
#include <asm/system.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
#include "hisax_cfg.h"
MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA cards");
MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL");
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version =
"avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)";
#else
#define DEBUG(n, args...)
#endif
static int isdnprot = 2;
module_param(isdnprot, int, 0);
static int avma1cs_config(struct pcmcia_device *link);
static void avma1cs_release(struct pcmcia_device *link);
static void avma1cs_detach(struct pcmcia_device *p_dev);
typedef struct local_info_t {
dev_node_t node;
} local_info_t;
static int avma1cs_probe(struct pcmcia_device *p_dev)
{
local_info_t *local;
DEBUG(0, "avma1cs_attach()\n");
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local)
return -ENOMEM;
p_dev->priv = local;
p_dev->io.NumPorts1 = 16;
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
p_dev->io.NumPorts2 = 16;
p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
p_dev->io.IOAddrLines = 5;
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
p_dev->conf.ConfigIndex = 1;
p_dev->conf.Present = PRESENT_OPTION;
return avma1cs_config(p_dev);
}
static void avma1cs_detach(struct pcmcia_device *link)
{
DEBUG(0, "avma1cs_detach(0x%p)\n", link);
avma1cs_release(link);
kfree(link->priv);
}
static int avma1cs_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
cistpl_cftable_entry_t *dflt,
unsigned int vcc,
void *priv_data)
{
if (cf->io.nwin <= 0)
return -ENODEV;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.NumPorts1 = cf->io.win[0].len;
p_dev->io.NumPorts2 = 0;
printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n",
p_dev->io.BasePort1,
p_dev->io.BasePort1+p_dev->io.NumPorts1-1);
return pcmcia_request_io(p_dev, &p_dev->io);
}
static int avma1cs_config(struct pcmcia_device *link)
{
local_info_t *dev;
int i;
char devname[128];
IsdnCard_t icard;
int busy = 0;
dev = link->priv;
DEBUG(0, "avma1cs_config(0x%p)\n", link);
devname[0] = 0;
if (link->prod_id[1])
strlcpy(devname, link->prod_id[1], sizeof(devname));
if (pcmcia_loop_config(link, avma1cs_configcheck, NULL))
return -ENODEV;
do {
i = pcmcia_request_irq(link, &link->irq);
if (i != 0) {
cs_error(link, RequestIRQ, i);
pcmcia_disable_device(link);
break;
}
i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) {
cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link);
break;
}
} while (0);
strcpy(dev->node.dev_name, "A1");
dev->node.major = 45;
dev->node.minor = 0;
link->dev_node = &dev->node;
if (i != 0) {
avma1cs_release(link);
return -ENODEV;
}
printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
link->io.BasePort1, link->irq.AssignedIRQ);
icard.para[0] = link->irq.AssignedIRQ;
icard.para[1] = link->io.BasePort1;
icard.protocol = isdnprot;
icard.typ = ISDN_CTYPE_A1_PCMCIA;
i = hisax_init_pcmcia(link, &busy, &icard);
if (i < 0) {
printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1);
avma1cs_release(link);
return -ENODEV;
}
dev->node.minor = i;
return 0;
}
static void avma1cs_release(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
DEBUG(0, "avma1cs_release(0x%p)\n", link);
HiSax_closecard(local->node.minor);
pcmcia_disable_device(link);
}
static struct pcmcia_device_id avma1cs_ids[] = {
PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb),
PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b),
PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids);
static struct pcmcia_driver avma1cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avma1_cs",
},
.probe = avma1cs_probe,
.remove = avma1cs_detach,
.id_table = avma1cs_ids,
};
static int __init init_avma1_cs(void)
{
return(pcmcia_register_driver(&avma1cs_driver));
}
static void __exit exit_avma1_cs(void)
{
pcmcia_unregister_driver(&avma1cs_driver);
}
module_init(init_avma1_cs);
module_exit(exit_avma1_cs);
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/bin/newton/tri/omp,
NPairHalfBinNewtonTriOmp,
NP_HALF | NP_BIN | NP_NEWTON | NP_TRI | NP_OMP)
#else
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_TRI_OMP_H
#define LMP_NPAIR_HALF_BIN_NEWTON_TRI_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfBinNewtonTriOmp : public NPair {
public:
NPairHalfBinNewtonTriOmp(class LAMMPS *);
~NPairHalfBinNewtonTriOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/
|
/* @(#)nixread.c 1.12 04/08/08 Copyright 1986, 1996-2003 J. Schilling */
/*
* Non interruptable extended read
*
* Copyright (c) 1986, 1996-2003 J. Schilling
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; see the file COPYING. If not, write to the Free Software
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "schilyio.h"
#include <errno.h>
EXPORT int
_nixread(f, buf, count)
int f;
void *buf;
int count;
{
register char *p = (char *)buf;
register int ret;
register int total = 0;
int oerrno = geterrno();
while (count > 0) {
while ((ret = read(f, p, count)) < 0) {
if (geterrno() == EINTR) {
/*
* Set back old 'errno' so we don't change the
* errno visible to the outside if we did
* not fail.
*/
seterrno(oerrno);
continue;
}
return (ret); /* Any other error */
}
if (ret == 0) /* Something went wrong */
break;
total += ret;
count -= ret;
p += ret;
}
return (total);
}
|
// Use Connection String "DSN=mycsql;MODE=GATEWAY;SERVER=localhost;PORT=5678;" for Connect Data Source
// SQLConnect, again call SQLConnect.
// second SQLConnect should return "connection name in use".
#include<stdio.h>
#include<stdlib.h>
#include<sql.h>
#include<sqlext.h>
#include<string.h>
//*************************************************************************
inline void checkrc(int rc,int line)
{
if(rc)
{
printf("ERROR %d at line %d\n",rc,line);
exit(1);
}
}
//*************************************************************************
int main()
{
SQLHENV env;
SQLHDBC dbc;
SQLHSTMT stmt;
SQLRETURN ret;
SQLCHAR outstr[1024];
SQLSMALLINT outstrlen;
// Aloocate an environment handle
ret=SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&env);
checkrc(ret,__LINE__);
//we need odbc3 support
SQLSetEnvAttr(env,SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3,0);
//ALLOCATE A Connection handle
ret = SQLAllocHandle(SQL_HANDLE_DBC,env,&dbc);
checkrc(ret,__LINE__);
// connect to the Data source
ret = SQLConnect (dbc,
(SQLCHAR *) "DSN=mycsql;MODE=GATEWAY;SERVER=localhost;PORT=5678;", (SQLSMALLINT) strlen ("DSN=mycsql;MODE=GATEWAY;SERVER=localhost;PORT=5678;"),
(SQLCHAR *) "root",
(SQLSMALLINT) strlen ("root"),
(SQLCHAR *) "manager",
(SQLSMALLINT) strlen (""));
if(SQL_SUCCEEDED(ret))
{
printf("\nConnected to the Data Source..\n");
}
else
{
printf("error in connection\n");
ret = SQLFreeHandle(SQL_HANDLE_DBC,dbc);
checkrc(ret,__LINE__);
ret = SQLFreeHandle(SQL_HANDLE_DBC,env);
checkrc(ret,__LINE__);
return 1;
}
//*********************************************************************
//again call to driver connect
ret = SQLConnect (dbc,
(SQLCHAR *) "DSN=mycsql;MODE=GATEWAY;SERVER=localhost;PORT=5678;", (SQLSMALLINT) strlen ("DSN=mycsql;MODE=GATEWAY;SERVER=localhost;PORT=5678;"),
(SQLCHAR *) "root",
(SQLSMALLINT) strlen ("root"),
(SQLCHAR *) "manager",
(SQLSMALLINT) strlen (""));
int rettype = ret;
if(SQL_SUCCEEDED(ret))
{
printf("\nConnected to the Data Source..\n");
}
else
{
printf("Connection name in use\n");
}
//**********************************************************************
ret = SQLDisconnect(dbc);
checkrc(ret,__LINE__);
ret = SQLFreeHandle(SQL_HANDLE_DBC,dbc);
checkrc(ret,__LINE__);
ret = SQLFreeHandle(SQL_HANDLE_ENV,env);
checkrc(ret,__LINE__);
if(rettype ==0)return 1;
return 0;
}
|
/*
* Copyright (c) Stephan Arts 2006-2012 <stephan@xfce.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include "util.h"
#include "wallpaper_manager.h"
G_DEFINE_INTERFACE (RsttoWallpaperManager, rstto_wallpaper_manager, G_TYPE_OBJECT)
gint
rstto_wallpaper_manager_configure_dialog_run (
RsttoWallpaperManager *self,
RsttoFile *file,
GtkWindow *parent)
{
return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->configure_dialog_run (self, file, parent);
}
gboolean
rstto_wallpaper_manager_check_running (RsttoWallpaperManager *self)
{
return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->check_running (self);
}
gboolean
rstto_wallpaper_manager_set (
RsttoWallpaperManager *self,
RsttoFile *file)
{
return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->set (self, file);
}
static void
rstto_wallpaper_manager_default_init (RsttoWallpaperManagerInterface *klass)
{
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GFX_FONT_FALLBACK_WIN_H_
#define UI_GFX_FONT_FALLBACK_WIN_H_
#include <string>
#include <vector>
#include "ui/gfx/font.h"
namespace gfx {
namespace internal {
void GFX_EXPORT ParseFontLinkEntry(const std::string& entry,
std::string* filename,
std::string* font_name);
void GFX_EXPORT ParseFontFamilyString(const std::string& family,
std::vector<std::string>* font_names);
}
class GFX_EXPORT LinkedFontsIterator {
public:
explicit LinkedFontsIterator(Font font);
virtual ~LinkedFontsIterator();
void SetNextFont(Font font);
bool NextFont(Font* font);
protected:
virtual const std::vector<Font>* GetLinkedFonts() const;
private:
Font original_font_;
Font next_font_;
bool next_font_set_;
Font current_font_;
const std::vector<Font>* linked_fonts_;
size_t linked_font_index_;
DISALLOW_COPY_AND_ASSIGN(LinkedFontsIterator);
};
}
#endif
|
/*
* COPYRIGHT (c) 2010.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/seterr.h>
int rtems_filesystem_default_fcntl(
rtems_libio_t *iop,
int cmd
)
{
return 0;
}
|
#ifndef FIT_H
# define FIT_H
#if defined(__cplusplus)
extern "C" {
#endif
int fit_variogram(VARIOGRAM *v);
#if defined(__cplusplus)
}
#endif
#endif
|
#ifndef CAMERA_H
#define CAMERA_H
#define _USE_MATH_DEFINES 1
#include "GL/glew.h"
#include "point.h"
#include "vector.h"
#include "box.h"
// Camera - permet representar una càmera virtual
class CORE_EXPORT Camera
{
public:
void init(const Box&);
void setModelview() const;
void setProjection() const;
Point getObs() const;
void setAspectRatio(float ar);
void updateClippingPlanes(const Box&);
void incrementDistance(float inc);
void incrementAngleX(float inc);
void incrementAngleY(float inc);
void pan(const Vector& offset);
private:
// paràmetres de la camera
Point pvrp; // view reference point
float pdist; // distancia obs-vrp
float pangleX, pangleY, pangleZ;
float pfovy; // fielf of view, vertical
float paspectRatio;
float pzNear, pzFar;
};
#endif
|
/************************************************************************\
*
* (c) 2016 by Serghei Amelian <serghei.amelian@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
\************************************************************************/
#ifndef _QSOCKETNOTIFIER_H_
#define _QSOCKETNOTIFIER_H_
#include <QtCore/QSocketNotifier>
#endif // _QSOCKETNOTIFIER_H_
|
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: resolver_info.h,v 1.2 2003/01/23 23:42:55 damonlan Exp $
*
* Portions Copyright (c) 1995-2003 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the RealNetworks Public
* Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (the "RCSL") available at
* http://www.helixcommunity.org/content/rcsl, in which case the RCSL
* will apply. You may also obtain the license terms directly from
* RealNetworks. You may not use this file except in compliance with
* the RPSL or, if you have a valid RCSL with RealNetworks applicable
* to this file, the RCSL. Please see the applicable RPSL or RCSL for
* the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the
* portions it created.
*
* This file, and the files included with this file, is distributed
* and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
* ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _RESOLVER_INFO_H_
#define _RESOLVER_INFO_H_
#include "debug.h"
#include "proc.h"
#include "server_resource.h"
class ResolverInfo {
public:
ResolverInfo();
int NewResolver(Process* proc);
void RequestStart(Process* proc, int s);
void RequestDone(Process* proc);
int BestResolver();
private:
int num; // Number of Resolvers
int capacity; // Resolver Capacity
int request_count[MAX_THREADS];
int MapNumToProcNum[MAX_THREADS];
};
inline
ResolverInfo::ResolverInfo()
{
//XXX...What should the capacity be???
num = 0;
capacity = RESOLVER_CAPACITY_VALUE;
}
inline int
ResolverInfo::NewResolver(Process* proc)
{
int my_num;
// Not thread-safe
MapNumToProcNum[num] = proc->procnum();
request_count[MapNumToProcNum[num]] = 0;
my_num = num;
num++;
return my_num;
}
inline void
ResolverInfo::RequestStart(Process* proc, int s)
{
request_count[s]++;
}
inline void
ResolverInfo::RequestDone(Process* proc)
{
request_count[proc->procnum()]--;
}
/*
* Returns the resolver number of the least loaded resolver (or -1 if a new
* resolver is needed)
*/
inline int
ResolverInfo::BestResolver()
{
int i;
int best = 100000;
int best_num = -1;
for (i = 0; i < num; i++)
{
if (request_count[MapNumToProcNum[i]] < best)
{
best = request_count[MapNumToProcNum[i]];
best_num = i;
}
}
if (best >= capacity)
return -1;
return MapNumToProcNum[best_num];
}
#endif
|
/******************************************************************************
* Copyright (C) 2016-2017 IMMS GmbH, Thomas Elste <thomas.elste@imms.de>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
******************************************************************************/
#ifndef __CYCLICPING_H__
#define __CYCLICPING_H__
#include <time.h>
#include <stats.h>
#include <opts.h>
#define VERSION "0.1.0"
struct cyclicping_module {
const char *name;
int (*init)(struct cyclicping_cfg *cfg, char **argv, int argc);
int (*run_client)(struct cyclicping_cfg *cfg);
int (*run_server)(struct cyclicping_cfg *cfg);
void (*deinit)(struct cyclicping_cfg *cfg);
void (*usage)(void);
void *modcfg;
};
struct cyclicping_cfg {
struct cyclicping_opts opts;
char *recv_packet;
char *send_packet;
uint64_t cnt;
struct tstats stat[STAT_ALL+1];
struct pdump *dump;
struct timeval test_start;
struct timeval test_end;
struct cyclicping_module *current_mod;
struct cyclicping_module *modules;
};
int client_wait(struct cyclicping_cfg *cfg, struct timespec tfrom);
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPolyDataStreamer.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm 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 vtkPolyDataStreamer - Stream appends input pieces to the output.
// .SECTION Description
// vtkPolyDataStreamer initiates streaming by requesting pieces from its
// single input it appends these pieces it to the requested output.
// Note that since vtkPolyDataStreamer uses an append filter, all the
// polygons generated have to be kept in memory before rendering. If
// these do not fit in the memory, it is possible to make the vtkPolyDataMapper
// stream. Since the mapper will render each piece separately, all the
// polygons do not have to stored in memory.
// .SECTION Note
// The output may be slightly different if the pipeline does not handle
// ghost cells properly (i.e. you might see seames between the pieces).
// .SECTION See Also
// vtkAppendFilter
#ifndef __vtkPolyDataStreamer_h
#define __vtkPolyDataStreamer_h
#include "vtkPolyDataAlgorithm.h"
class VTK_GRAPHICS_EXPORT vtkPolyDataStreamer : public vtkPolyDataAlgorithm
{
public:
static vtkPolyDataStreamer *New();
vtkTypeRevisionMacro(vtkPolyDataStreamer,vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set the number of pieces to divide the problem into.
void SetNumberOfStreamDivisions(int num);
vtkGetMacro(NumberOfStreamDivisions,int);
// Description:
// By default, this option is off. When it is on, cell scalars are generated
// based on which piece they are in.
vtkSetMacro(ColorByPiece, int);
vtkGetMacro(ColorByPiece, int);
vtkBooleanMacro(ColorByPiece, int);
protected:
vtkPolyDataStreamer();
~vtkPolyDataStreamer();
// Append the pieces.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
int NumberOfStreamDivisions;
int ColorByPiece;
private:
vtkPolyDataStreamer(const vtkPolyDataStreamer&); // Not implemented.
void operator=(const vtkPolyDataStreamer&); // Not implemented.
};
#endif
|
/* gEDA - GPL Electronic Design Automation
* gschem - gEDA Schematic Capture
* Copyright (C) 2013, 2016 Peter Brett <peter@peter-b.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*/
/*! \file g_action.c
* \brief Functions relating to working with gschem actions.
*/
#include <config.h>
#include "gschem.h"
SCM_SYMBOL (quote_sym, "quote");
/*! \brief Evaluate a gschem action by name.
* \par Function Description
* Evaluates the action named \a action_name, which should be a UTF-8
* string naming a symbol in the user module. If evaluating the
* action fails, prints a message to the log and returns FALSE;
* otherwise, returns TRUE.
*
* \param w_current Current gschem toplevel structure.
* \param action_name Name of action to evaluate.
*
* \return TRUE on success, FALSE on failure.
*/
gboolean
g_action_eval_by_name (GschemToplevel *w_current, const gchar *action_name)
{
SCM s_eval_action_proc;
SCM s_expr;
SCM s_result;
gboolean result;
g_assert (w_current);
g_assert (action_name);
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
g_dynwind_window (w_current);
/* Get the eval-action procedure */
s_eval_action_proc =
scm_variable_ref (scm_c_public_variable ("gschem action",
"eval-action!"));
/* Build expression to evaluate */
s_expr = scm_list_2 (s_eval_action_proc,
scm_list_2 (quote_sym,
scm_from_utf8_symbol (action_name)));
/* Evaluate and get return value */
s_result = g_scm_eval_protected (s_expr, SCM_UNDEFINED);
result = scm_is_true (s_result);
scm_dynwind_end ();
return result;
}
/*! \brief Get the action position.
* \par Function Description
* Retrieves the current action position and stores it in \a x and \a
* y, optionally snapping it to the grid if \a snap is true. This
* should be interpreted as the position that the user was pointing
* with the mouse pointer when the current action was invoked. If
* there is no valid world position for the current action, returns
* FALSE without modifying the output variables.
*
* This should be used by actions implemented in C to figure out where
* on the schematic the user wants them to apply the action.
*
* See also the (gschem action) Scheme module.
*
* \param snap "Snap" returned coords to the grid.
* \param x Location to store x coordinate.
* \param y Location to store y coordinate.
*
* \return TRUE if current action position is set, FALSE otherwise.
*/
gboolean
g_action_get_position (gboolean snap, int *x, int *y)
{
SCM s_action_position_proc;
SCM s_point;
GschemToplevel *w_current = g_current_window ();
g_assert (w_current);
/* Get the action-position procedure */
s_action_position_proc =
scm_variable_ref (scm_c_public_variable ("gschem action",
"action-position"));
/* Retrieve the action position */
s_point = scm_call_0 (s_action_position_proc);
if (scm_is_false (s_point)) return FALSE;
if (x) {
*x = scm_to_int (scm_car (s_point));
if (snap) {
*x = snap_grid (w_current, *x);
}
}
if (y) {
*y = scm_to_int (scm_cdr (s_point));
if (snap) {
*y = snap_grid (w_current, *y);
}
}
return TRUE;
}
/*!
* \brief Initialise gschem action support.
* \par Function Description
* Registers some Scheme support for action handling. Should only be
* called by main_prog().
*/
void
g_init_action ()
{
#include "g_action.x"
}
|
//
// WebViewController.h
// AlertifyMeSearch
//
// Created by Kalana Jayatilake on 8/29/14.
// Copyright (c) 2014 Kalana Jayatilake. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WebViewController : UIViewController <UIWebViewDelegate> {
IBOutlet UIWebView *web;
int type;
IBOutlet UIActivityIndicatorView *progressB;
}
@property (nonatomic) int type;
@end
|
#ifndef _ASM_POWERPC_DELAY_H
#define _ASM_POWERPC_DELAY_H
#ifdef __KERNEL__
#include <asm/time.h>
extern void __delay(unsigned long loops);
extern void udelay(unsigned long usecs);
#ifdef CONFIG_PPC64
#define mdelay(n) udelay((n) * 1000)
#endif
#define spin_event_timeout(condition, timeout, delay) \
({ \
typeof(condition) __ret; \
unsigned long __loops = tb_ticks_per_usec * timeout; \
unsigned long __start = get_tbl(); \
while (!(__ret = (condition)) && (tb_ticks_since(__start) <= __loops)) \
if (delay) \
udelay(delay); \
else \
cpu_relax(); \
if (!__ret) \
__ret = (condition); \
__ret; \
})
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_DELAY_H */
|
static double COEF_NTSC[NCOEFFS/2]=
{
#include "fir/ntsc.h"
};
static double COEF_NTSC_HI[NCOEFFS/2]=
{
#include "fir/ntsc-hi.h"
};
static double COEF_PAL[NCOEFFS/2]=
{
#include "fir/pal.h"
};
static double COEF_PAL_HI[NCOEFFS/2]=
{
#include "fir/pal-hi.h"
};
|
#ifndef _FETCH_H
#define _FETCH_H
/* This file is (C) copyright 2001 Software Improvements, Pty Ltd */
/* This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Database interface routines for counting. */
#include <common/database.h>
#include "hare_clarke.h"
/* Case-insensitive search for electorate: NULL if not found. */
extern struct electorate *fetch_electorate(PGconn *conn, const char *ename);
/* Given the non-NULL electorate, fill in all the groups, return number. */
extern unsigned int fetch_groups(PGconn *conn,
const struct electorate *elec,
struct group *groups);
/* Given the group information, return the candidate list */
extern struct cand_list *fetch_candidates(PGconn *conn,
const struct electorate *elec,
struct group *groups);
/* Get all the ballots for this electorate */
extern struct ballot_list *fetch_ballots(PGconn *conn,
const struct electorate *elec);
#endif /*_FETCH_H*/
|
/*
* $Id: timer.c,v 1.1.1.1 1999/11/22 03:47:20 christ Exp $
* Copyright (C) 1996 SpellCaster Telecommunications Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* For more information, please contact gpl-info@spellcast.com or write:
*
* SpellCaster Telecommunications Inc.
* 5621 Finch Avenue East, Unit #3
* Scarborough, Ontario Canada
* M1B 2T9
* +1 (416) 297-8565
* +1 (416) 297-6433 Facsimile
*/
#define __NO_VERSION__
#include "includes.h"
#include "hardware.h"
#include "message.h"
#include "card.h"
extern board *adapter[];
extern void flushreadfifo(int);
extern int startproc(int);
extern int indicate_status(int, int, unsigned long, char *);
extern int sendmessage(int, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, unsigned int *);
/*
* Write the proper values into the I/O ports following a reset
*/
void setup_ports(int card)
{
outb((adapter[card]->rambase >> 12), adapter[card]->ioport[EXP_BASE]);
/* And the IRQ */
outb((adapter[card]->interrupt | 0x80),
adapter[card]->ioport[IRQ_SELECT]);
}
/*
* Timed function to check the status of a previous reset
* Must be very fast as this function runs in the context of
* an interrupt handler.
*
* Setup the ioports for the board that were cleared by the reset.
* Then, check to see if the signate has been set. Next, set the
* signature to a known value and issue a startproc if needed.
*/
void check_reset(unsigned long data)
{
unsigned long flags;
unsigned long sig;
int card = (unsigned int) data;
pr_debug("%s: check_timer timer called\n", adapter[card]->devicename);
/* Setup the io ports */
setup_ports(card);
save_flags(flags);
cli();
outb(adapter[card]->ioport[adapter[card]->shmem_pgport],
(adapter[card]->shmem_magic>>14) | 0x80);
sig = (unsigned long) *((unsigned long *)(adapter[card]->rambase + SIG_OFFSET));
/* check the signature */
if(sig == SIGNATURE) {
flushreadfifo(card);
restore_flags(flags);
/* See if we need to do a startproc */
if (adapter[card]->StartOnReset)
startproc(card);
}
else {
pr_debug("%s: No signature yet, waiting another %d jiffies.\n",
adapter[card]->devicename, CHECKRESET_TIME);
del_timer(&adapter[card]->reset_timer);
adapter[card]->reset_timer.expires = jiffies + CHECKRESET_TIME;
add_timer(&adapter[card]->reset_timer);
}
restore_flags(flags);
}
/*
* Timed function to check the status of a previous reset
* Must be very fast as this function runs in the context of
* an interrupt handler.
*
* Send check adapter->phystat to see if the channels are up
* If they are, tell ISDN4Linux that the board is up. If not,
* tell IADN4Linux that it is up. Always reset the timer to
* fire again (endless loop).
*/
void check_phystat(unsigned long data)
{
unsigned long flags;
int card = (unsigned int) data;
pr_debug("%s: Checking status...\n", adapter[card]->devicename);
/*
* check the results of the last PhyStat and change only if
* has changed drastically
*/
if (adapter[card]->nphystat && !adapter[card]->phystat) { /* All is well */
pr_debug("PhyStat transition to RUN\n");
pr_info("%s: Switch contacted, transmitter enabled\n",
adapter[card]->devicename);
indicate_status(card, ISDN_STAT_RUN, 0, NULL);
}
else if (!adapter[card]->nphystat && adapter[card]->phystat) { /* All is not well */
pr_debug("PhyStat transition to STOP\n");
pr_info("%s: Switch connection lost, transmitter disabled\n",
adapter[card]->devicename);
indicate_status(card, ISDN_STAT_STOP, 0, NULL);
}
adapter[card]->phystat = adapter[card]->nphystat;
/* Reinitialize the timer */
save_flags(flags);
cli();
del_timer(&adapter[card]->stat_timer);
adapter[card]->stat_timer.expires = jiffies + CHECKSTAT_TIME;
add_timer(&adapter[card]->stat_timer);
restore_flags(flags);
/* Send a new cePhyStatus message */
sendmessage(card, CEPID,ceReqTypePhy,ceReqClass2,
ceReqPhyStatus,0,0,NULL);
}
/*
* When in trace mode, this callback is used to swap the working shared
* RAM page to the trace page(s) and process all received messages. It
* must be called often enough to get all of the messages out of RAM before
* it loops around.
* Trace messages are \n terminated strings.
* We output the messages in 64 byte chunks through readstat. Each chunk
* is scanned for a \n followed by a time stamp. If the timerstamp is older
* than the current time, scanning stops and the page and offset are recorded
* as the starting point the next time the trace timer is called. The final
* step is to restore the working page and reset the timer.
*/
void trace_timer(unsigned long data)
{
unsigned long flags;
/*
* Disable interrupts and swap the first page
*/
save_flags(flags);
cli();
}
|
/*
* Copyright 2021 KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FONTWATCHER_H
#define FONTWATCHER_H
#include <QObject>
#include <QWidget>
#include <QGSettings>
#include <QList>
struct widgetcontent
{
int n_font_size;
int n_font_point_size;
QWidget* contentwidget;
int limit;
};
class FontWatcher : public QWidget
{
Q_OBJECT
public:
explicit FontWatcher(QWidget *parent = nullptr);
//virtual ~FontWatcher();
public:
void init();
void Set_Special_Font_Size(int size); //设置特殊字体
void Add_Item_Contents_Widget(QWidget *obj);
void SetGsetting(QGSettings *gid);
void Set_Single_Content_Special(widgetcontent *obj , float add_percent , int n_size,QFont ft);
int Get_Init_Font_Size();
widgetcontent* Font_Special(QWidget *obj , int limit);
signals:
void updatefontsize(QWidget *watcher);
private:
QList<widgetcontent*> m_Contents_list; //需要监听的事件列表
QGSettings* m_FontSettings; //监听字体大小
int m_fontsize; //变化字体大小
int m_init_fontsize; //初始字体大小
int m_SpecialFontsize; //特殊字体大小
};
#endif // FONTWATCHER_H
|
/*
* Jailhouse, a Linux-based partitioning hypervisor
*
* Copyright (c) ARM Limited, 2014
*
* Authors:
* Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/
#ifndef _JAILHOUSE_ASM_IO_H
#define _JAILHOUSE_ASM_IO_H
#include <asm/types.h>
/* AMBA's biosfood */
#define AMBA_DEVICE 0xb105f00d
#ifndef __ASSEMBLY__
static inline void writeb_relaxed(u8 val, volatile void *addr)
{
*(volatile u8 *)addr = val;
}
static inline void writew_relaxed(u16 val, volatile void *addr)
{
*(volatile u16 *)addr = val;
}
static inline void writel_relaxed(u32 val, volatile void *addr)
{
*(volatile u32 *)addr = val;
}
static inline void writeq_relaxed(u64 val, volatile void *addr)
{
/* Warning: no guarantee of atomicity */
*(volatile u64 *)addr = val;
}
static inline u8 readb_relaxed(volatile void *addr)
{
return *(volatile u8 *)addr;
}
static inline u16 readw_relaxed(volatile void *addr)
{
return *(volatile u16 *)addr;
}
static inline u32 readl_relaxed(volatile void *addr)
{
return *(volatile u32 *)addr;
}
static inline u64 readq_relaxed(volatile void *addr)
{
/* Warning: no guarantee of atomicity */
return *(volatile u64 *)addr;
}
#endif /* !__ASSEMBLY__ */
#endif /* !_JAILHOUSE_ASM_IO_H */
|
/*
* This file is part of the KDE Libraries
* Copyright (C) 2007 Krzysztof Lichota (lichota@mimuw.edu.pl)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef _KSWITCHLANGUAGEDIALOG_H_
#define _KSWITCHLANGUAGEDIALOG_H_
#include <kdialogbase.h>
class KSwitchLanguageDialogPrivate;
/**
* @short Standard "switch application language" dialog box.
*
* This class provides "switch application language" dialog box that is used
* in KHelpMenu
*
* @author Krzysztof Lichota (lichota@mimuw.edu.pl)
*/
class KDEUI_EXPORT KSwitchLanguageDialog : public KDialogBase {
Q_OBJECT
public:
/**
* Constructor. Creates a fully featured "Switch application language" dialog box.
* Note that this dialog is made modeless in the KHelpMenu class so
* the users may expect a modeless dialog.
*
* @param parent The parent of the dialog box. You should use the
* toplevel window so that the dialog becomes centered.
* @param name Internal name of the widget. This name in not used in the
* caption.
* @param modal If false, this widget will be modeless and must be
* made visible using QWidget::show(). Otherwise it will be
* modal and must be made visible using QWidget::exec()
*/
KSwitchLanguageDialog(QWidget *parent = 0, const char *name = 0, bool modal = true);
virtual ~KSwitchLanguageDialog();
protected slots:
/**
* Activated when the Ok button has been clicked. Overridden from KDialogBase.
*/
virtual void slotOk();
/**
Called when one of language buttons changes state.
*/
virtual void languageOnButtonChanged(const QString &);
/**
Called to add one language button to dialog.
*/
virtual void slotAddLanguageButton();
/**
Called when "Remove" language button is clicked.
*/
virtual void removeButtonClicked();
protected:
KSwitchLanguageDialogPrivate *const d;
friend class KSwitchLanguageDialogPrivate;
};
#endif
|
/*
* widget_chooser.h:
* Gtkdialog - A small utility for fast and easy GUI building.
* Copyright (C) 2003-2007 László Pere <pipas@linux.pte.hu>
* Copyright (C) 2011-2012 Thunor <thunorsif@hotmail.com>
* Copyright (C) 2021-2022 step https://github.com/step-
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WIDGET_CHOOSER_H
#define WIDGET_CHOOSER_H
/* Function prototypes */
void widget_chooser_clear(variable *var);
GtkWidget *widget_chooser_create(
AttributeSet *Attr, tag_attr *attr, gint Type);
gchar *widget_chooser_envvar_all_construct(variable *var);
gchar *widget_chooser_envvar_construct(GtkWidget *widget);
void widget_chooser_fileselect(
variable *var, const char *name, const char *value);
void widget_chooser_refresh(variable *var);
void widget_chooser_removeselected(variable *var);
void widget_chooser_save(variable *var);
#endif
|
/*
* Versatile Express Core Tile Cortex A9x4 Support
*/
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <linux/amba/bus.h>
#include <linux/amba/clcd.h>
#include <linux/clkdev.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/pmu.h>
#include <asm/smp_scu.h>
#include <asm/smp_twd.h>
#include <mach/ct-ca9x4.h>
#include <asm/hardware/timer-sp.h>
#include <asm/mach/map.h>
#include <asm/mach/time.h>
#include "core.h"
#include <mach/motherboard.h>
#include <plat/clcd.h>
static struct map_desc ct_ca9x4_io_desc[] __initdata = {
{
.virtual = V2T_PERIPH,
.pfn = __phys_to_pfn(CT_CA9X4_MPIC),
.length = SZ_8K,
.type = MT_DEVICE,
},
};
static void __init ct_ca9x4_map_io(void)
{
iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
}
#ifdef CONFIG_HAVE_ARM_TWD
static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER);
static void __init ca9x4_twd_init(void)
{
int err = twd_local_timer_register(&twd_local_timer);
if (err)
pr_err("twd_local_timer_register failed %d\n", err);
}
#else
#define ca9x4_twd_init() do {} while(0)
#endif
static void __init ct_ca9x4_init_irq(void)
{
gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K),
ioremap(A9_MPCORE_GIC_CPU, SZ_256));
ca9x4_twd_init();
}
static void ct_ca9x4_clcd_enable(struct clcd_fb *fb)
{
v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0);
v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE_DB1, 2);
}
static int ct_ca9x4_clcd_setup(struct clcd_fb *fb)
{
unsigned long framesize = 1024 * 768 * 2;
fb->panel = versatile_clcd_get_panel("XVGA");
if (!fb->panel)
return -EINVAL;
return versatile_clcd_setup_dma(fb, framesize);
}
static struct clcd_board ct_ca9x4_clcd_data = {
.name = "CT-CA9X4",
.caps = CLCD_CAP_5551 | CLCD_CAP_565,
.check = clcdfb_check,
.decode = clcdfb_decode,
.enable = ct_ca9x4_clcd_enable,
.setup = ct_ca9x4_clcd_setup,
.mmap = versatile_clcd_mmap_dma,
.remove = versatile_clcd_remove_dma,
};
static AMBA_AHB_DEVICE(clcd, "ct:clcd", 0, CT_CA9X4_CLCDC, IRQ_CT_CA9X4_CLCDC, &ct_ca9x4_clcd_data);
static AMBA_APB_DEVICE(dmc, "ct:dmc", 0, CT_CA9X4_DMC, IRQ_CT_CA9X4_DMC, NULL);
static AMBA_APB_DEVICE(smc, "ct:smc", 0, CT_CA9X4_SMC, IRQ_CT_CA9X4_SMC, NULL);
static AMBA_APB_DEVICE(gpio, "ct:gpio", 0, CT_CA9X4_GPIO, IRQ_CT_CA9X4_GPIO, NULL);
static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
&clcd_device,
&dmc_device,
&smc_device,
&gpio_device,
};
static long ct_round(struct clk *clk, unsigned long rate)
{
return rate;
}
static int ct_set(struct clk *clk, unsigned long rate)
{
return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_DB1 | 1, rate);
}
static const struct clk_ops osc1_clk_ops = {
.round = ct_round,
.set = ct_set,
};
static struct clk osc1_clk = {
.ops = &osc1_clk_ops,
.rate = 24000000,
};
static struct clk ct_sp804_clk = {
.rate = 1000000,
};
static struct clk_lookup lookups[] = {
{ /* CLCD */
.dev_id = "ct:clcd",
.clk = &osc1_clk,
}, { /* SP804 timers */
.dev_id = "sp804",
.con_id = "ct-timer0",
.clk = &ct_sp804_clk,
}, { /* SP804 timers */
.dev_id = "sp804",
.con_id = "ct-timer1",
.clk = &ct_sp804_clk,
},
};
static struct resource pmu_resources[] = {
[0] = {
.start = IRQ_CT_CA9X4_PMU_CPU0,
.end = IRQ_CT_CA9X4_PMU_CPU0,
.flags = IORESOURCE_IRQ,
},
[1] = {
.start = IRQ_CT_CA9X4_PMU_CPU1,
.end = IRQ_CT_CA9X4_PMU_CPU1,
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = IRQ_CT_CA9X4_PMU_CPU2,
.end = IRQ_CT_CA9X4_PMU_CPU2,
.flags = IORESOURCE_IRQ,
},
[3] = {
.start = IRQ_CT_CA9X4_PMU_CPU3,
.end = IRQ_CT_CA9X4_PMU_CPU3,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device pmu_device = {
.name = "arm-pmu",
.id = ARM_PMU_DEVICE_CPU,
.num_resources = ARRAY_SIZE(pmu_resources),
.resource = pmu_resources,
};
static void __init ct_ca9x4_init_early(void)
{
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
}
static void __init ct_ca9x4_init(void)
{
int i;
#ifdef CONFIG_CACHE_L2X0
void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K);
/* set RAM latencies to 1 cycle for this core tile. */
writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL);
writel(0, l2x0_base + L2X0_DATA_LATENCY_CTRL);
l2x0_init(l2x0_base, 0x00400000, 0xfe0fffff);
#endif
for (i = 0; i < ARRAY_SIZE(ct_ca9x4_amba_devs); i++)
amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
platform_device_register(&pmu_device);
}
#ifdef CONFIG_SMP
static void *ct_ca9x4_scu_base __initdata;
static void __init ct_ca9x4_init_cpu_map(void)
{
int i, ncores;
ct_ca9x4_scu_base = ioremap(A9_MPCORE_SCU, SZ_128);
if (WARN_ON(!ct_ca9x4_scu_base))
return;
ncores = scu_get_core_count(ct_ca9x4_scu_base);
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}
for (i = 0; i < ncores; ++i)
set_cpu_possible(i, true);
set_smp_cross_call(gic_raise_softirq);
}
static void __init ct_ca9x4_smp_enable(unsigned int max_cpus)
{
scu_enable(ct_ca9x4_scu_base);
}
#endif
struct ct_desc ct_ca9x4_desc __initdata = {
.id = V2M_CT_ID_CA9,
.name = "CA9x4",
.map_io = ct_ca9x4_map_io,
.init_early = ct_ca9x4_init_early,
.init_irq = ct_ca9x4_init_irq,
.init_tile = ct_ca9x4_init,
#ifdef CONFIG_SMP
.init_cpu_map = ct_ca9x4_init_cpu_map,
.smp_enable = ct_ca9x4_smp_enable,
#endif
};
|
//
// AddAppTableViewCell.h
// AppDock
//
// Created by Shabbir Vijapura on 9/21/14.
// Copyright (c) 2014 Shabbir Vijapura. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AddAppTableViewCell : UITableViewCell
@property (nonatomic, strong, readonly) UITextField *textField;
@end
|
#include "common.h"
int puts(char *str)
{
int i = 0;
while (str[i])
{
putc(str[i]);
i++;
}
}
|
// ライセンス: GPL2
//
// タブの切り替えメニュー
//
#include <gtkmm.h>
#include <vector>
namespace SKELETON
{
class DragableNoteBook;
class Admin;
class TabSwitchMenu : public Gtk::Menu
{
Admin* m_parentadmin;
DragableNoteBook* m_parentnote;
bool m_deactivated;
int m_size;
std::vector< Gtk::MenuItem* > m_vec_items;
std::vector< Gtk::Label* > m_vec_labels;
std::vector< Gtk::Image* > m_vec_images;
public:
TabSwitchMenu( DragableNoteBook* notebook, Admin* admin );
virtual ~TabSwitchMenu();
void remove_items();
void append_items();
void update_labels();
void update_icons();
void deactivate();
protected:
virtual void on_deactivate();
};
}
|
#ifndef __SPITZ_H__
#define __SPITZ_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns the worker id. If this method is called in a non-worker entity, it
* returns -1.
*/
int spitz_get_worker_id(void);
/*
* Returns the number of workers in this process.
*/
int spitz_get_num_workers(void);
#ifdef __cplusplus
}
#endif
#endif /* __SPITZ_H__ */
|
#ifndef MODELINVOICE_H
#define MODELINVOICE_H
#include <QSqlRelationalTableModel>
#include <QDate>
#include <QString>
#include <memory>
#include "InvoiceTypeData.h"
#include "InvoiceNumberFormat_t.h"
/**
* @brief
*
*/
class ModelInvoice : public QSqlRelationalTableModel
{
Q_OBJECT
public:
/**
* @brief
*
* @param parent
*/
explicit ModelInvoice(QObject *parent);
/**
* @brief
*
* @param section
* @param orientation
* @param role
* @return QVariant
*/
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
/**
* @brief
*
* @return QString
*/
QString generateInvoiceNumber(const InvoiceNumberFormat_t& invoiceNumFormat, const QString &prevInvNum, const QDate &issuanceDate, const QDate &prevIssuanceDate, const InvoiceTypeData::Type invoiceType) const;
QString getInvoiceNumberFormat(const QString &counterpartyName) const;
struct DBData
{
QDate gotIssuanceDate;
QString invNumStr;
};
std::unique_ptr<DBData> getLastExistingNumberDateFromDB(const bool defaultInvNumFormat, const QString &counterpartyName) const;
void setDataRange(const QDate &from, const QDate &to);
QStringList simulateConsecutiveInvoiceNumbers(const InvoiceNumberFormat_t &invoiceNumFormat, const QDate &firstIssuanceDate, const InvoiceTypeData::Type invoiceType, const int invNumCounts = 1) const;
private:
static long increaseNumber_(const InvoiceNumberFormat_t& invoiceNumFormat, const QString &prevInvNum, const QDate &issuanceDate, const QDate &prevIssuanceDate, const InvoiceNumberFormat_t::Field periodId, const int position);
};
#endif // MODELINVOICE_H
|
#ifndef SPRINGLOBBY_HEADERGUARD_SPRINGOPTIONSTAB_H
#define SPRINGLOBBY_HEADERGUARD_SPRINGOPTIONSTAB_H
#include <wx/scrolwin.h>
class wxStaticBoxSizer;
class wxStaticBox;
class wxStaticText;
class wxRadioButton;
class wxButton;
class wxTextCtrl;
class wxBoxSizer;
class Ui;
class wxCheckBox;
class SpringOptionsTab : public wxScrolledWindow
{
public:
SpringOptionsTab( wxWindow* parent );
~SpringOptionsTab();
void DoRestore();
void OnBrowseExec( wxCommandEvent& event );
void OnBrowseSync( wxCommandEvent& event );
void OnBrowseBundle( wxCommandEvent& event );
void OnApply( wxCommandEvent& event );
void OnRestore( wxCommandEvent& event );
void OnAutoConf( wxCommandEvent& event );
void OnFindExec( wxCommandEvent& event );
void OnFindSync( wxCommandEvent& event );
void OnFindBundle( wxCommandEvent& event );
void OnDataDir( wxCommandEvent& event );
void OnDontSearch( wxCommandEvent& event );
void OnForceBundle( wxCommandEvent& event );
void EnableSpringBox(bool enabled);
void EnableUnitsyncBox(bool enabled);
void EnableBundleBox(bool enabled);
protected:
void SetupUserFolders();
wxStaticText* m_exec_loc_text;
wxStaticText* m_sync_loc_text;
wxStaticText* m_bundle_loc_text;
wxButton* m_exec_browse_btn;
wxButton* m_exec_find_btn;
wxButton* m_sync_browse_btn;
wxButton* m_sync_find_btn;
wxButton* m_bundle_browse_btn;
wxButton* m_bundle_find_btn;
wxButton* m_datadir_btn;
wxButton* m_auto_btn;
wxRadioButton* m_exec_def_radio;
wxRadioButton* m_exec_spec_radio;
wxRadioButton* m_sync_def_radio;
wxRadioButton* m_sync_spec_radio;
wxRadioButton* m_bundle_def_radio;
wxRadioButton* m_bundle_spec_radio;
wxTextCtrl* m_exec_edit;
wxTextCtrl* m_sync_edit;
wxTextCtrl* m_bundle_edit;
wxStaticBox* m_exec_box;
wxStaticBox* m_sync_box;
wxStaticBox* m_bundle_box;
wxStaticBox* m_web_box;
wxStaticBoxSizer* m_exec_box_sizer;
wxStaticBoxSizer* m_sync_box_sizer;
wxStaticBoxSizer* m_bundle_box_sizer;
wxBoxSizer* m_main_sizer;
wxBoxSizer* m_aconf_sizer;
wxBoxSizer* m_exec_loc_sizer;
wxBoxSizer* m_sync_loc_sizer;
wxBoxSizer* m_bundle_loc_sizer;
wxCheckBox* m_dontsearch_chkbox;
wxCheckBox* m_forcebundle_chkbox;
wxCheckBox* m_oldlaunch_chkbox;
enum {
SPRING_EXECBROWSE = wxID_HIGHEST,
SPRING_SYNCBROWSE,
SPRING_BUNDLEBROWSE,
SPRING_WEBBROWSE,
SPRING_DEFEXE,
SPRING_DEFUSYNC,
SPRING_DEFBUNDLE,
SPRING_DEFWEB,
SPRING_AUTOCONF,
SPRING_EXECFIND,
SPRING_SYNCFIND,
SPRING_BUNDLEFIND,
SPRING_DATADIR,
SPRING_DONTSEARCH,
SPRING_FORCEBUNDLE
};
DECLARE_EVENT_TABLE()
};
#endif // SPRINGLOBBY_HEADERGUARD_SPRINGOPTIONSTAB_H
/**
This file is part of SpringLobby,
Copyright (C) 2007-2011
SpringLobby is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published by
the Free Software Foundation.
SpringLobby 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 SpringLobby. If not, see <http://www.gnu.org/licenses/>.
**/
|
/*
* Based on arch/arm/include/asm/processor.h
*
* Copyright (C) 1995-1999 Russell King
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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 __ASM_PROCESSOR_H
#define __ASM_PROCESSOR_H
/*
* Default implementation of macro that returns current
* instruction pointer ("program counter").
*/
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
#ifdef __KERNEL__
#include <linux/string.h>
#include <asm/fpsimd.h>
#include <asm/hw_breakpoint.h>
#include <asm/pgtable-hwdef.h>
#include <asm/ptrace.h>
#include <asm/types.h>
#ifdef __KERNEL__
#define STACK_TOP_MAX TASK_SIZE_64
#ifdef CONFIG_COMPAT
#define AARCH32_VECTORS_BASE 0xffff0000
#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
AARCH32_VECTORS_BASE : STACK_TOP_MAX)
#else
#define STACK_TOP STACK_TOP_MAX
#endif /* CONFIG_COMPAT */
#define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK
#endif /* __KERNEL__ */
struct debug_info {
/* Have we suspended stepping by a debugger? */
int suspended_step;
/* Allow breakpoints and watchpoints to be disabled for this thread. */
int bps_disabled;
int wps_disabled;
/* Hardware breakpoints pinned to this task. */
struct perf_event *hbp_break[ARM_MAX_BRP];
struct perf_event *hbp_watch[ARM_MAX_WRP];
};
struct cpu_context {
unsigned long x19;
unsigned long x20;
unsigned long x21;
unsigned long x22;
unsigned long x23;
unsigned long x24;
unsigned long x25;
unsigned long x26;
unsigned long x27;
unsigned long x28;
unsigned long fp;
unsigned long sp;
unsigned long pc;
};
struct thread_struct {
struct cpu_context cpu_context; /* cpu context */
unsigned long tp_value;
struct fpsimd_state fpsimd_state;
unsigned long fault_address; /* fault info */
unsigned long fault_code; /* ESR_EL1 value */
struct debug_info debug; /* debugging */
};
#define INIT_THREAD { }
static inline void start_thread_common(struct pt_regs *regs, unsigned long pc)
{
memset(regs, 0, sizeof(*regs));
regs->syscallno = ~0UL;
regs->pc = pc;
}
static inline void start_thread(struct pt_regs *regs, unsigned long pc,
unsigned long sp)
{
start_thread_common(regs, pc);
regs->pstate = PSR_MODE_EL0t;
regs->sp = sp;
}
#ifdef CONFIG_COMPAT
static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
unsigned long sp)
{
start_thread_common(regs, pc);
regs->pstate = COMPAT_PSR_MODE_USR;
if (pc & 1)
regs->pstate |= COMPAT_PSR_T_BIT;
#ifdef __AARCH64EB__
regs->pstate |= COMPAT_PSR_E_BIT;
#endif
regs->compat_sp = sp;
}
#endif
/* Forward declaration, a strange C thing */
struct task_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
unsigned long get_wchan(struct task_struct *p);
static inline void cpu_relax(void) {
barrier();
asm volatile("yield");
}
#define cpu_relax_lowlatency() cpu_relax()
/* Thread switching */
extern struct task_struct *cpu_switch_to(struct task_struct *prev,
struct task_struct *next);
#define task_pt_regs(p) \
((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
#define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc)
#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
/*
* Prefetching support
*/
#define ARCH_HAS_PREFETCH
static inline void prefetch(const void *ptr)
{
asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));
}
#define ARCH_HAS_PREFETCHW
static inline void prefetchw(const void *ptr)
{
asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr));
}
#define ARCH_HAS_SPINLOCK_PREFETCH
static inline void spin_lock_prefetch(const void *x)
{
prefetchw(x);
}
#define HAVE_ARCH_PICK_MMAP_LAYOUT
#endif
#endif /* __ASM_PROCESSOR_H */
|
/*
* drives/usb/pd/pd_policy_engine_vcs.c
* Power Delvery Policy Engine for VSC
*
* Copyright (C) 2015 Richtek Technology Corp.
* Author: TH <tsunghan_tasi@richtek.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*/
#include <huawei_platform/usb/pd/richtek/pd_core.h>
#include <huawei_platform/usb/pd/richtek/pd_dpm_core.h>
#include <huawei_platform/usb/pd/richtek/tcpci.h>
#include <huawei_platform/usb/pd/richtek/pd_policy_engine.h>
/*
* [PD2.0] Figure 8-57 VCONN Swap State Diagram
*/
void pe_vcs_send_swap_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_send_ctrl_msg(pd_port, TCPC_TX_SOP, PD_CTRL_VCONN_SWAP);
}
void pe_vcs_evaluate_swap_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_dpm_vcs_evaluate_swap(pd_port);
pd_free_pd_event(pd_port, pd_event);
}
void pe_vcs_accept_swap_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_send_ctrl_msg(pd_port, TCPC_TX_SOP, PD_CTRL_ACCEPT);
}
void pe_vcs_reject_vconn_swap_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
if (pd_event->msg_sec == PD_DPM_NAK_REJECT)
pd_send_ctrl_msg(pd_port, TCPC_TX_SOP, PD_CTRL_REJECT);
else
pd_send_ctrl_msg(pd_port, TCPC_TX_SOP, PD_CTRL_WAIT);
}
void pe_vcs_wait_for_vconn_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_enable_timer(pd_port, PD_TIMER_VCONN_ON);
pd_free_pd_event(pd_port, pd_event);
}
void pe_vcs_wait_for_vconn_exit(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_disable_timer(pd_port, PD_TIMER_VCONN_ON);
}
void pe_vcs_turn_off_vconn_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_dpm_vcs_enable_vconn(pd_port, false);
pd_free_pd_event(pd_port, pd_event);
}
void pe_vcs_turn_on_vconn_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_dpm_vcs_enable_vconn(pd_port, true);
pd_free_pd_event(pd_port, pd_event);
}
void pe_vcs_send_ps_rdy_entry(pd_port_t *pd_port, pd_event_t* pd_event)
{
pd_send_ctrl_msg(pd_port, TCPC_TX_SOP, PD_CTRL_PS_RDY);
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: helix_utils.h,v 1.1.1.1 2007/12/07 08:11:36 zpxu Exp $
*
* REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
* Portions Copyright (c) 1995-2005 RealNetworks, Inc.
* All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the Real Format Source Code
* Porting and Optimization License, available at
* https://helixcommunity.org/2005/license/realformatsource (unless
* RealNetworks otherwise expressly agrees in writing that you are
* subject to a different license). You may also obtain the license
* terms directly from RealNetworks. You may not use this file except
* in compliance with the Real Format Source Code Porting and
* Optimization License. There are no redistribution rights for the
* source code of this file. Please see the Real Format Source Code
* Porting and Optimization License for the rights, obligations and
* limitations governing use of the contents of the file.
*
* RealNetworks is the developer of the Original Code and owns the
* copyrights in the portions it created.
*
* This file, and the files included with this file, is distributed and
* made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL
* SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT
* OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* https://rarvcode-tck.helixcommunity.org
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef HELIX_UTILS_H
#define HELIX_UTILS_H
#include "helix_config.h"
#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */
/*
* General support macros
*
*/
#define HX_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define HX_MIN(a, b) (((a) < (b)) ? (a) : (b))
/*
* Macro: IS_BIG_ENDIAN()
*
* Endianness detection macro.
* Requires local test_int = 0xFF for correct operation.
* Set ARCH_IS_BIG_ENDIAN in helix_config.h for best performance.
*
*/
#if !defined(ARCH_IS_BIG_ENDIAN)
#define IS_BIG_ENDIAN(test_int) ((*((char*)&test_int)) == 0)
#else
#define IS_BIG_ENDIAN(test_int) ARCH_IS_BIG_ENDIAN
#endif
/*
* Macro: HX_GET_MAJOR_VERSION()
*
* Given the encoded product version,
* returns the major version number.
*/
#define HX_GET_MAJOR_VERSION(prodVer) ((prodVer >> 28) & 0xF)
/*
* Macro: HX_GET_MINOR_VERSION()
*
* Given the encoded product version,
* returns the minor version number.
*/
#define HX_GET_MINOR_VERSION(prodVer) ((prodVer >> 20) & 0xFF)
/*
* Macro: HX_ENCODE_PROD_VERSION()
*
* Given the major version, minor version,
* release number, and build number,
* returns the encoded product version.
*/
#define HX_ENCODE_PROD_VERSION(major,minor,release,build) \
((ULONG32)((ULONG32)major << 28) | ((ULONG32)minor << 20) | \
((ULONG32)release << 12) | (ULONG32)build)
#define HX_GET_PRIVATE_FIELD(ulversion)(ulversion & (UINT32)0xFF)
#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */
#endif /* HELIX_UTILS_H */
|
/**
* Copyright (C) 2010 Sanjit Jhala (Hypertable, Inc.)
*
* This file is part of Hypertable.
*
* Hypertable is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* Hypertable is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef HYPERTABLE_DFSBROKER_FILE_DEVICE_H
#define HYPERTABLE_DFSBROKER_FILE_DEVICE_H
#include "Common/Compat.h"
#include "Common/StringExt.h"
#include "Common/StaticBuffer.h"
#include "Common/Error.h"
#include <boost/cstdint.hpp> // intmax_t.
#include <boost/iostreams/categories.hpp> // tags.
#include <boost/iostreams/detail/ios.hpp> // openmode, seekdir, int types.
#include <boost/shared_ptr.hpp>
#include "Client.h"
namespace Hypertable { namespace DfsBroker {
using namespace boost::iostreams;
using namespace std;
/**
* These classes are intended to be Dfs equivalent of boost::iostreams::basic_file,
* boost::iostreams::basic_file_source, boost::iostreams::basic_file_sink
*/
// Forward declarations
class FileSource;
class FileSink;
namespace {
const uint32_t READAHEAD_BUFFER_SIZE = 1024*1024;
const uint32_t OUTSTANDING_READS = 2;
}
class FileDevice {
public:
friend class FileSource;
friend class FileSink;
typedef char char_type;
struct category : public device_tag, public closable_tag
{};
// Ctor
FileDevice(ClientPtr &client, const String &filename,
BOOST_IOS::openmode mode = BOOST_IOS::in);
// Dtor
virtual ~FileDevice() { }
// open
virtual void open(ClientPtr &client, const String &filename,
BOOST_IOS::openmode mode = BOOST_IOS::in);
virtual bool is_open() const;
// read
virtual size_t read(char_type* dst, size_t amount);
virtual size_t bytes_read();
virtual size_t length();
// write
virtual size_t write(const char_type *src, size_t amount);
virtual size_t bytes_written();
// close
virtual void close();
private:
struct impl {
impl(ClientPtr &client, const String &filename,
BOOST_IOS::openmode mode)
: m_client(client), m_filename(filename), m_open(false),
m_bytes_read(0), m_bytes_written(0), m_length(0)
{
// if file is opened for output then create if it doesn't exist
if (mode & BOOST_IOS::in) {
if (!m_client->exists(filename))
HT_THROW(Error::FILE_NOT_FOUND, (String)"dfs://" + filename);
m_length = m_client->length(filename);
m_fd = m_client->open_buffered(filename, Filesystem::OPEN_FLAG_DIRECTIO,
READAHEAD_BUFFER_SIZE, OUTSTANDING_READS);
}
else if (mode & BOOST_IOS::out) {
m_fd = m_client->create(filename, Filesystem::OPEN_FLAG_OVERWRITE, -1 , -1, -1);
}
m_open = true;
}
~impl() {
close();
}
void close() {
if (m_open) {
m_client->close(m_fd);
m_bytes_read = m_bytes_written = 0;
m_open = false;
}
}
size_t read(char_type *dst, size_t amount) {
if (amount + m_bytes_read > m_length)
amount = m_length - m_bytes_read;
if (amount > 0 ) {
size_t bytes_read = m_client->read(m_fd, (void *)dst, amount);
m_bytes_read += bytes_read;
return bytes_read;
}
else {
return -1;
}
}
size_t bytes_read() {
return m_bytes_read;
}
size_t length() {
return m_length;
}
size_t write(const char_type *dst, size_t amount) {
StaticBuffer write_buffer((void *)dst, amount, false);
size_t bytes_written = m_client->append(m_fd, write_buffer);
m_bytes_written += bytes_written;
return bytes_written;
}
size_t bytes_written() {
return m_bytes_written;
}
ClientPtr m_client;
String m_filename;
int m_fd;
bool m_open;
size_t m_bytes_read;
size_t m_bytes_written;
size_t m_length;
};
boost::shared_ptr<impl> pimpl_;
};
class FileSource : private FileDevice {
public:
typedef char char_type;
struct category : source_tag, closable_tag
{};
using FileDevice::is_open;
using FileDevice::close;
using FileDevice::read;
using FileDevice::bytes_read;
using FileDevice::length;
FileSource(ClientPtr &client, const String& filename)
: FileDevice(client, filename, BOOST_IOS::in)
{}
virtual ~FileSource() { }
void open(ClientPtr &client, const String &filename) {
FileDevice::open(client, filename, BOOST_IOS::in);
}
};
class FileSink : private FileDevice {
public:
typedef char char_type;
struct category : sink_tag, closable_tag
{};
using FileDevice::is_open;
using FileDevice::close;
using FileDevice::write;
using FileDevice::bytes_written;
FileSink(ClientPtr &client, const String &filename)
: FileDevice(client, filename, BOOST_IOS::out)
{}
virtual ~FileSink() { }
void open(ClientPtr &client, const String &filename) {
FileDevice::open(client, filename, BOOST_IOS::out);
}
};
}} // namespace Hypertable::DfsBroker
#endif // HYPERTABLE_DFSBROKER_FILE_DEVICE_H
|
/*
LPCUSB, an USB device driver for LPC microcontrollers
Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl)
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 the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
#include "type.h"
#include "fifo.h"
void fifo_init(fifo_t *fifo, U8 *buf)
{
fifo->head = 0;
fifo->tail = 0;
fifo->buf = buf;
}
BOOL fifo_put(fifo_t *fifo, U8 c)
{
int next;
// check if FIFO has room
next = (fifo->head + 1) % VCOM_FIFO_SIZE;
if (next == fifo->tail) {
// full
return FALSE;
}
fifo->buf[fifo->head] = c;
fifo->head = next;
return TRUE;
}
BOOL fifo_get(fifo_t *fifo, U8 *pc)
{
int next;
// check if FIFO has data
if (fifo->head == fifo->tail) {
return FALSE;
}
next = (fifo->tail + 1) % VCOM_FIFO_SIZE;
*pc = fifo->buf[fifo->tail];
fifo->tail = next;
return TRUE;
}
int fifo_avail(fifo_t *fifo)
{
return (VCOM_FIFO_SIZE + fifo->head - fifo->tail) % VCOM_FIFO_SIZE;
}
int fifo_free(fifo_t *fifo)
{
return (VCOM_FIFO_SIZE - 1 - fifo_avail(fifo));
}
|
#include "meter.h"
int common_time[2] = {4, 4};
int cut_time[2] = {2, 2};
int
valid_beat_duration(int duration)
{
int r;
if (duration <= 0)
return 0;
r = duration;
while (r != 1)
{
if (r % 2 == 1)
return 0;
r /= 2;
}
return 1;
}
|
/* ///////////////////////////////////////////////////////////////////////// */
/* This file is a part of the BSTools package */
/* written by Przemyslaw Kiciak */
/* ///////////////////////////////////////////////////////////////////////// */
/* (C) Copyright by Przemyslaw Kiciak, 2010, 2011 */
/* this package is distributed under the terms of the */
/* Lesser GNU Public License, see the file COPYING.LIB */
/* ///////////////////////////////////////////////////////////////////////// */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "pkvaria.h"
#include "pknum.h"
/* /////////////////////////////////////////////////////////////////////////// */
boolean pkn_PCGd ( int n, void *usrdata, double *b, double *x,
boolean (*multAx)( int n, void *usrdata, const double *x, double *Ax ),
boolean (*multQIx)( int n, void *usrdata, const double *x, double *Qix ),
int maxit, double eps, double delta, int *itm )
{
void *sp;
int k;
double *r, *z, *v, c, d, t, rn;
sp = pkv_GetScratchMemTop ();
r = pkv_GetScratchMemd ( n );
z = pkv_GetScratchMemd ( n );
v = pkv_GetScratchMemd ( n );
k = -1;
if ( !r || !z || !v )
goto failure;
/* the conjugate gradient method */
if ( !multAx ( n, usrdata, x, z ) )
goto failure;
pkn_SubtractMatrixd ( 1, n, 0, b, 0, z, 0, r );
rn = pkn_ScalarProductd ( n, r, r );
if ( multQIx ) { /* preconditioning */
if ( !multQIx ( n, usrdata, r, z ) )
goto failure;
c = pkn_ScalarProductd ( n, z, r );
}
else { /* no preconditioning */
memcpy ( z, r, n*sizeof(double) );
c = rn;
}
memcpy ( v, z, n*sizeof(double) );
for ( k = 0; k < maxit; k++ ) {
d = pkn_ScalarProductd ( n, v, v );
if ( d < delta )
goto success;
if ( !multAx ( n, usrdata, v, z ) )
goto failure;
t = c/pkn_ScalarProductd ( n, v, z );
pkn_AddMatrixMd ( 1, n, 0, x, 0, v, t, 0, x );
pkn_AddMatrixMd ( 1, n, 0, r, 0, z, -t, 0, r );
t = pkn_ScalarProductd ( n, r, r );
if ( multQIx ) { /* preconditioning */
if ( !multQIx ( n, usrdata, r, z ) )
goto failure;
d = pkn_ScalarProductd ( n, z, r );
}
else { /* no preconditioning */
memcpy ( z, r, n*sizeof(double) );
d = t;
}
if ( d < eps && t < eps )
goto success;
pkn_AddMatrixMd ( 1, n, 0, z, 0, v, d/c, 0, v );
c = d;
rn = t;
}
success:
if ( itm )
*itm = k;
pkv_SetScratchMemTop ( sp );
return true;
failure:
if ( itm )
*itm = k;
pkv_SetScratchMemTop ( sp );
return false;
} /*pkn_PCGd*/
|
/***************************************************************************
* Copyright 2016 by Davide Bettio <davide@uninstall.it> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "route.h"
#include "bson.h"
#include "utils.h"
#include <fcntl.h>
#include <sys/mount.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <net/if.h>
#include <net/route.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Route
{
Unit parent_instance;
const char *destination;
const char *gateway;
const char *genmask;
const char *interface;
} Route;
Unit *route_new(const char *route_path)
{
Route *new_route = malloc(sizeof(Route));
if (!new_route) {
return NULL;
}
unsigned int size;
int fd;
void *doc = map_file(route_path, O_RDONLY | O_CLOEXEC, &fd, &size);
if (!doc && (fd >= 0)) {
free(new_route);
return NULL;
}
unit_constructor((Unit *) new_route, route_path, doc);
new_route->parent_instance.type = UNIT_TYPE_ROUTE;
uint8_t type;
const void *value = bson_key_lookup("destination", doc, &type);
new_route->destination = strdup(bson_value_to_string(value, NULL));
value = bson_key_lookup("gateway", doc, &type);
new_route->gateway = strdup(bson_value_to_string(value, NULL));
value = bson_key_lookup("genmask", doc, &type);
new_route->genmask = strdup(bson_value_to_string(value, NULL));
value = bson_key_lookup("interface", doc, &type);
new_route->interface = strdup(bson_value_to_string(value, NULL));
munmap(doc, size);
close(fd);
return (Unit *) new_route;
}
int route_start(Unit *u)
{
printf("Configuring network route: %s\n", u->name);
Route *route_unit = (Route *) u;
int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
fprintf(stderr, "init: %s: failed to open socket\n", u->name);
return -1;
}
struct rtentry route;
struct sockaddr_in sai;
memset(&route, 0, sizeof(route));
memset(&sai, 0, sizeof(sai));
if (!inet_pton(0, route_unit->destination, &sai.sin_addr.s_addr)) {
fprintf(stderr, "init: %s invalid destination address\n", u->name);
return -1;
}
memcpy(&route.rt_dst, &sai, sizeof(struct sockaddr));
if (!inet_pton(0, route_unit->gateway, &sai.sin_addr.s_addr)) {
fprintf(stderr, "init: %s invalid gateway address\n", u->name);
return -1;
}
memcpy(&route.rt_gateway, &sai, sizeof(struct sockaddr));
if (!inet_pton(0, route_unit->genmask, &sai.sin_addr.s_addr)) {
fprintf(stderr, "init: %s invalid genmask\n", u->name);
return -1;
}
memcpy(&route.rt_genmask, &sai, sizeof(struct sockaddr));
route.rt_dev = strdup(route_unit->interface);
if (!route.rt_dev) {
fprintf(stderr, "init: failed to allocate string copy");
return -1;
}
int ioctl_ret = ioctl(sockfd, SIOCADDRT, &route);
free(route.rt_dev);
unit_set_status(u, UNIT_STATUS_RUNNING);
return ioctl_ret;
}
|
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_KIS_WIDGET_CHOOSER_H_
#define H_KIS_WIDGET_CHOOSER_H_
#include <krita_export.h>
#include <QList>
#include <QIcon>
#include <QFrame>
class QToolButton;
class QLabel;
class QButtonGroup;
class KRITAUI_EXPORT KisWidgetChooser: public QFrame
{
Q_OBJECT
struct Data
{
Data(const QString& ID):
id(ID), widget(0), label(0), choosen(false) { }
Data(const Data& d):
id(d.id), widget(d.widget), label(d.label), choosen(d.choosen) { }
Data(const QString& ID, QWidget* w, QLabel* l):
id(ID), widget(w), label(l), choosen(false) { }
friend bool operator == (const Data& a, const Data& b) {
return a.id == b.id;
}
QString id;
QWidget* widget;
QLabel* label;
bool choosen;
};
typedef QList<Data>::iterator Iterator;
typedef QList<Data>::const_iterator ConstIterator;
public:
KisWidgetChooser(int id, QWidget* parent=0);
~KisWidgetChooser();
QWidget* chooseWidget(const QString& id);
void addWidget(const QString& id, const QString& label, QWidget* widget);
QWidget* getWidget(const QString& id) const;
template<class TWidget>
TWidget* addWidget(const QString& id, const QString& label = "") {
TWidget* widget = new TWidget();
addWidget(id, label, widget);
return widget;
}
template<class TWidget>
TWidget* getWidget(const QString& id) const {
return dynamic_cast<TWidget*>(getWidget(id));
}
public Q_SLOTS:
void showPopupWidget();
private:
void removeWidget(const QString& id);
QLayout* createPopupLayout();
QLayout* createLayout();
void updateArrowIcon();
protected Q_SLOTS:
void slotButtonPressed();
void slotWidgetChoosen(int index);
// QWidget interface
protected:
virtual void changeEvent(QEvent *e);
private:
int m_chooserid;
QIcon m_acceptIcon;
QToolButton* m_arrowButton;
QButtonGroup* m_buttons;
QFrame* m_popup;
QString m_choosenID;
QList<Data> m_widgets;
};
#endif // H_KIS_WIDGET_CHOOSER_H_
|
/*------------------------------------------------------------------------
-- Copyright (C) 2012-2015 Christopher Brochtrup
--
-- This file is part of eplkup.
--
-- eplkup 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.
--
-- eplkup 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 eplkup. If not, see <http://www.gnu.org/licenses/>.
--
------------------------------------------------------------------------*/
#ifndef EPLKUP_GAIJI_H
#define EPLKUP_GAIJI_H
#define MAX_BYTES_UTF8_REPLACEMENT 9
typedef struct
{
/* Gaiji code. Example: 0xA23D. */
unsigned short code;
/* Number of bytes that make up the UTF-8 replacement */
char num_bytes;
/* The replacement bytes representing one or more UTF-8 characters.
Worst case: 3 UTF-8 characters
Best case: 9 UTF-8 characters */
char replacement[MAX_BYTES_UTF8_REPLACEMENT];
} Gaiji_table_type;
int is_gaiji_width_char(char c);
void get_gaiji_table(const char *dic_name, char width, Gaiji_table_type **gaiji_table, int *max_elem);
int compare_gaiji (const void *key, const void *elem);
Gaiji_table_type * get_gaiji_replacment_elem(const char *dic_name, char width, unsigned short code);
char * get_gaiji_replacement_text(char *dest, const char *dic_name, char width, char c1, char c2, char c3, char c4);
char * replace_gaiji_with_utf8(char *dest, char *src);
/*
Gaiji Tables
*/
/* CHUJITEN (研究社 新英和・和英中辞典) */
#define NUM_NARROW_CHUJITEN_ITEMS 161
#define NUM_WIDE_CHUJITEN_ITEMS 5
extern Gaiji_table_type gaiji_table_narrow_chujiten[NUM_NARROW_CHUJITEN_ITEMS];
extern Gaiji_table_type gaiji_table_wide_chujiten[NUM_WIDE_CHUJITEN_ITEMS];
/* DAIJIRIN (大辞林 第2版) */
#define NUM_NARROW_DAIJIRIN_ITEMS 153
#define NUM_WIDE_DAIJIRIN_ITEMS 1234
extern Gaiji_table_type gaiji_table_narrow_daijirin[NUM_NARROW_DAIJIRIN_ITEMS];
extern Gaiji_table_type gaiji_table_wide_daijirin[NUM_WIDE_DAIJIRIN_ITEMS];
/* DAIJISEN (大辞泉) */
#define NUM_NARROW_DAIJISEN_ITEMS 227
#define NUM_WIDE_DAIJISEN_ITEMS 73
extern Gaiji_table_type gaiji_table_narrow_daijisen[NUM_NARROW_DAIJISEN_ITEMS];
extern Gaiji_table_type gaiji_table_wide_daijisen[NUM_WIDE_DAIJISEN_ITEMS];
/* GENIUS (genius revised edition - ジーニアス英和辞典〈改訂版〉) */
#define NUM_NARROW_GENIUS_ITEMS 101
#define NUM_WIDE_GENIUS_ITEMS 52
extern Gaiji_table_type gaiji_table_narrow_genius[NUM_NARROW_GENIUS_ITEMS];
extern Gaiji_table_type gaiji_table_wide_genius[NUM_WIDE_GENIUS_ITEMS];
/* MEIKYOU - (what is this?) */
#define NUM_NARROW_MEIKYOU_ITEMS 22
#define NUM_WIDE_MEIKYOU_ITEMS 529
extern Gaiji_table_type gaiji_table_narrow_meikyou[NUM_NARROW_MEIKYOU_ITEMS];
extern Gaiji_table_type gaiji_table_wide_meikyou[NUM_WIDE_MEIKYOU_ITEMS];
/* MEIKYOJJ (明鏡国語辞典) */
#define NUM_NARROW_MEIKYOJJ_ITEMS 5
#define NUM_WIDE_MEIKYOJJ_ITEMS 49
extern Gaiji_table_type gaiji_table_narrow_meikyojj[NUM_NARROW_MEIKYOJJ_ITEMS];
extern Gaiji_table_type gaiji_table_wide_meikyojj[NUM_WIDE_MEIKYOJJ_ITEMS];
/* WADAI5 (研究社 新和英大辞典 第5版) */
#define NUM_NARROW_WADAI5_ITEMS 382
#define NUM_WIDE_WADAI5_ITEMS 26
extern Gaiji_table_type gaiji_table_narrow_wadai5[NUM_NARROW_WADAI5_ITEMS];
extern Gaiji_table_type gaiji_table_wide_wadai5[NUM_WIDE_WADAI5_ITEMS];
/* KOJIEN (広辞苑第六版) */
#define NUM_NARROW_KOJIEN_ITEMS 147
#define NUM_WIDE_KOJIEN_ITEMS 1568
extern Gaiji_table_type gaiji_table_narrow_kojien[NUM_NARROW_KOJIEN_ITEMS];
extern Gaiji_table_type gaiji_table_wide_kojien[NUM_WIDE_KOJIEN_ITEMS];
/* SNMKG99 (新明解国語辞典 第五版) */
#define NUM_NARROW_SNMKG99_ITEMS 0
#define NUM_WIDE_SNMKG99_ITEMS 4
//extern Gaiji_table_type gaiji_table_narrow_snmkg99[NUM_NARROW_SNMKG99_ITEMS];
extern Gaiji_table_type gaiji_table_wide_snmkg99[NUM_WIDE_SNMKG99_ITEMS];
#endif /* EPLKUP_GAIJI_H */ |
/* vi: set sw=4 ts=4: */
/*
Copyright 2010, Dylan Simon
Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef BB_ANDROID_H
#define BB_ANDROID_H 1
/* for dirname, basename */
#include <libgen.h>
#if ENABLE_FEATURE_DC_LIBM
# include <math.h>
#endif
/* lutimes doesnt exists in libc */
#if ENABLE_FEATURE_TOUCH_NODEREF
# define lutimes utimes
#endif
#define killpg_busybox(P, S) kill(-(P), S)
#define setmntent fopen
#define endmntent fclose
/* defined in bionic/utmp.c */
void endutent(void);
/* defined in bionic/mktemp.c */
char *mkdtemp(char *);
/* defined in bionic/stubs.c */
char *ttyname(int);
/* SYSCALLS */
int stime(time_t *);
int swapon(const char *, int);
int swapoff(const char *);
int getsid(pid_t);
#ifndef SYS_ioprio_set
#define SYS_ioprio_set __NR_ioprio_set
#define SYS_ioprio_get __NR_ioprio_get
#endif
/* XXX These need to be obtained from kernel headers. See b/9336527 */
#define SWAP_FLAG_PREFER 0x8000
#define SWAP_FLAG_PRIO_MASK 0x7fff
#define SWAP_FLAG_PRIO_SHIFT 0
#define SWAP_FLAG_DISCARD 0x10000
/* local definition in libbb/xfuncs_printf.c */
int fdprintf(int fd, const char *format, ...);
/* local definitions in libbb/android.c */
int ttyname_r(int, char *, size_t);
char *getusershell(void);
void setusershell(void);
void endusershell(void);
struct mntent;
struct __sFILE;
int addmntent(struct __sFILE *, const struct mntent *);
struct mntent *getmntent_r(struct __sFILE *fp, struct mntent *mnt, char *buf, int buflen);
const char *hasmntopt(const struct mntent *, const char *);
#define MNTOPT_NOAUTO "noauto"
/* bionic's vfork is rather broken; for now a terrible bandaid: */
#define vfork fork
#define _SOCKLEN_T_DECLARED
typedef int socklen_t;
#endif
|
/**
* Copyright (C) 2010 syndicode
*
* 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.
**/
#ifndef _INFEKT_POSIX_H
#define _INFEKT_POSIX_H
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wctype.h>
#include <limits.h>
#include <omp.h>
#include <libgen.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include "iconv_string.h"
#define TCHAR char
#define _tstring string
#define _T(STR) STR
#define _tprintf printf
#define _ftprintf fprintf
#define _tstoi atoi
#define _fileno fileno
#define _filelength filelength
/* :TODO: make sure we don't rely on the _s functionality without our own
checks in too many places. */
#define fread_s(b, s, e, c, f) fread(b, e, c, f)
#define memmove_s(d, e, s, c) memmove(d, s, c)
#define strcpy_s(d, e, s) strcpy(d, s)
#define sscanf_s sscanf
#define _tcscpy_s(d, e, s) strcpy(d, s)
#define _tcsncpy_s(d, e, s, n) strncpy(d, s, n)
#define _tcscmp strcmp
#define _tcsicmp strcasecmp
#define _stricmp strcasecmp
#define _snprintf snprintf
#define wcscpy_s(d, e, s) wcscpy(d, s)
#define wcsncpy_s(d, e, s, n) wcsncpy(d, s, n)
#ifdef _DEBUG
#define _ASSERT(EXPR) assert(EXPR)
#else
#define _ASSERT(EXPR)
#endif
#define LF_FACESIZE 128
#define CP_UTF8 8
#define CP_ACP 5
#endif /* !_INFEKT_POSIX_H */
|
#ifndef LIBOPM_H
#define LIBOPM_H
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "config.h"
#include "opm_common.h"
#include "opm.h"
#define CBLEN 5 /* Number of callback functions */
#define READBUFLEN 128 /* Size of conn->readbuf */
#define SENDBUFLEN 512 /* Size of sendbuffer in proxy.c */
#define LIBOPM_TLS_RECORD_SIZE 16384
typedef struct _OPM_SCAN OPM_SCAN_T;
typedef struct _OPM_CONNECTION OPM_CONNECTION_T;
typedef struct _OPM_PROTOCOL_CONFIG OPM_PROTOCOL_CONFIG_T;
typedef struct _OPM_PROTOCOL OPM_PROTOCOL_T;
/*
* Types of hard coded proxy READ/WRITE functions which are
* setup in a table in libopm.c
*/
typedef int OPM_PROXYWRITE_T (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
typedef int OPM_PROXYREAD_T (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
struct _OPM_SCAN
{
struct sockaddr_storage addr; /* Address in byte order of remote client */
size_t addr_len;
OPM_REMOTE_T *remote; /* Pointed to the OPM_REMOTE_T for this scan, passed by client */
OPM_LIST_T connections; /* List of individual connections of this scan (1 for each protocol) */
};
struct _OPM_CONNECTION
{
OPM_PROTOCOL_T *protocol; /* Pointer to specific protocol this connection handles */
unsigned short int port; /* Some protocols have multiple ports, eg. HTTP */
int fd; /* Allocated file descriptor, 0 if not yet allocated */
unsigned short int bytes_read; /* Bytes read so far in this connection */
char readbuf[READBUFLEN + 1]; /* 128 byte read buffer, anything over 128 is probably not of use */
unsigned short int readlen; /* Length of readbuf */
unsigned short int state; /* State of connection */
time_t creation; /* When this connection was established */
void *tls_handle; /* SSL structure created by SSL_new() */
};
struct _OPM_PROTOCOL_CONFIG
{
OPM_PROTOCOL_T *type; /* Protocol type */
unsigned short int port; /* Port to connect on */
};
struct _OPM_PROTOCOL
{
int type; /* Protocol type */
OPM_PROXYWRITE_T *write_function; /* Write function handler for this protocol */
OPM_PROXYREAD_T *read_function; /* Read function handler for this protocol */
int use_tls; /* TLS/SSL-enabled protocol such as HTTPS */
};
#endif /* LIBOPM_H */
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.COPYRIGHT (c) 2011 - 2013 SRON (R.M.van.Hees@sron.nl)
This is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
The 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
.IDENTifer SCIA_IMAP_WR_SQL_META
.AUTHOR R.M. van Hees
.KEYWORDS SCIA IMAP HDO SQL
.LANGUAGE ANSI C
.PURPOSE write meta data of SRON IMAP product to table "meta_imap_hdo"
.INPUT/OUTPUT
call as SCIA_WR_SQL_HDO_META( conn, hdr );
input:
PGconn *conn : PostgreSQL connection handle
struct imap_hdr *hdr : header of Imap product
.RETURNS Nothing, error status passed by global variable ``nadc_stat''
.COMMENTS None
.ENVIRONment None
.VERSION 1.0 28-Apr-2011 initial release by R. M. van Hees
------------------------------------------------------------*/
/*
* Define _ISOC99_SOURCE to indicate
* that this is a ISO C99 program
*/
#define _GNU_SOURCE
/*+++++ System headers +++++*/
#include <stdlib.h>
#include <string.h>
#include <libpq-fe.h>
/*+++++ Local Headers +++++*/
#define __IMAP_HDO_PRODUCT
#include <nadc_imap.h>
/*+++++ Macros +++++*/
#define SQL_STR_SIZE 640
#define META_TBL_NAME "meta_imap_hdo"
#define SQL_INSERT_META \
"INSERT INTO %s (pk_meta,name,fk_name_l1b,filesize,receivedate,creationDate,\
datetimestart,musecstart,datetimestop,musecstop,softversion,absOrbit,\
numDataSets) VALUES ( \
%d,\'%s\',\'%s\',%u,\'%s\',\'%s\',date_trunc('second',TIMESTAMP \'%s\'),\
\'0\',date_trunc('second',TIMESTAMP \'%s\'),\'0\',\'%s\',%u,%u)"
/*+++++ Global Variables +++++*/
/* NONE */
/*+++++ Static Variables +++++*/
/* NONE */
/*+++++++++++++++++++++++++ Static Functions +++++++++++++++++++++++*/
/* NONE */
/*+++++++++++++++++++++++++ Main Program or Function +++++++++++++++*/
void SCIA_WR_SQL_HDO_META( PGconn *conn, const struct imap_hdr *hdr )
{
PGresult *res;
char *pntr, sql_query[SQL_STR_SIZE];
int nrow, numChar, meta_id;
/*
* check if product is already in database
*/
(void) snprintf( sql_query, SQL_STR_SIZE,
"SELECT * FROM %s WHERE name=\'%s\'",
META_TBL_NAME, hdr->product );
res = PQexec( conn, sql_query );
if ( PQresultStatus( res ) != PGRES_TUPLES_OK ) {
NADC_GOTO_ERROR( NADC_ERR_SQL, PQresultErrorMessage(res) );
}
if ( (nrow = PQntuples( res )) != 0 ) {
NADC_GOTO_ERROR( NADC_ERR_SQL_TWICE, hdr->product );
}
PQclear( res );
/*
* obtain next value for serial pk_meta
*/
res = PQexec( conn,
"SELECT nextval(\'meta_imap_hdo_pk_meta_seq\')" );
if ( PQresultStatus( res ) != PGRES_TUPLES_OK )
NADC_GOTO_ERROR( NADC_ERR_SQL, PQresultErrorMessage(res) );
pntr = PQgetvalue( res, 0, 0 );
meta_id = (int) strtol( pntr, (char **) NULL, 10 );
PQclear( res );
/*
* no error and not yet stored, then proceed
*/
numChar = snprintf( sql_query, SQL_STR_SIZE, SQL_INSERT_META,
META_TBL_NAME, meta_id,
hdr->product, hdr->l1b_product, hdr->file_size,
hdr->receive_date, hdr->creation_date,
hdr->validity_start, hdr->validity_stop,
hdr->software_version, hdr->orbit[0],
hdr->numRec );
/* (void) fprintf( stderr, "%s [%-d]\n", sql_query, numChar ); */
if ( numChar >= SQL_STR_SIZE )
NADC_RETURN_ERROR( NADC_ERR_STRLEN, "sql_query" );
/*
* do the actual insert
*/
res = PQexec( conn, sql_query );
if ( PQresultStatus( res ) != PGRES_COMMAND_OK )
NADC_GOTO_ERROR( NADC_ERR_SQL, PQresultErrorMessage(res) );
done:
PQclear( res );
}
|
/*
* This file contains defines for the
* Micro Memory MM5415
* family PCI Memory Module with Battery Backup.
*
* Copyright Micro Memory INC 2001. All rights reserved.
* Release under the terms of the GNU GENERAL PUBLIC LICENSE version 2.
* See the file COPYING.
*/
#ifndef _DRIVERS_BLOCK_MM_H
#define _DRIVERS_BLOCK_MM_H
#define IRQ_TIMEOUT (1 * HZ)
/* CSR register definition */
#define MEMCTRLSTATUS_MAGIC 0x00
#define MM_MAGIC_VALUE (unsigned char)0x59
#define MEMCTRLSTATUS_BATTERY 0x04
#define BATTERY_1_DISABLED 0x01
#define BATTERY_1_FAILURE 0x02
#define BATTERY_2_DISABLED 0x04
#define BATTERY_2_FAILURE 0x08
#define MEMCTRLSTATUS_MEMORY 0x07
#define MEM_128_MB 0xfe
#define MEM_256_MB 0xfc
#define MEM_512_MB 0xf8
#define MEM_1_GB 0xf0
#define MEM_2_GB 0xe0
#define MEMCTRLCMD_LEDCTRL 0x08
#define LED_REMOVE 2
#define LED_FAULT 4
#define LED_POWER 6
#define LED_FLIP 255
#define LED_OFF 0x00
#define LED_ON 0x01
#define LED_FLASH_3_5 0x02
#define LED_FLASH_7_0 0x03
#define LED_POWER_ON 0x00
#define LED_POWER_OFF 0x01
#define USER_BIT1 0x01
#define USER_BIT2 0x02
#define MEMORY_INITIALIZED USER_BIT1
#define MEMCTRLCMD_ERRCTRL 0x0C
#define EDC_NONE_DEFAULT 0x00
#define EDC_NONE 0x01
#define EDC_STORE_READ 0x02
#define EDC_STORE_CORRECT 0x03
#define MEMCTRLCMD_ERRCNT 0x0D
#define MEMCTRLCMD_ERRSTATUS 0x0E
#define ERROR_DATA_LOG 0x20
#define ERROR_ADDR_LOG 0x28
#define ERROR_COUNT 0x3D
#define ERROR_SYNDROME 0x3E
#define ERROR_CHECK 0x3F
#define DMA_PCI_ADDR 0x40
#define DMA_LOCAL_ADDR 0x48
#define DMA_TRANSFER_SIZE 0x50
#define DMA_DESCRIPTOR_ADDR 0x58
#define DMA_SEMAPHORE_ADDR 0x60
#define DMA_STATUS_CTRL 0x68
#define DMASCR_GO 0x00001
#define DMASCR_TRANSFER_READ 0x00002
#define DMASCR_CHAIN_EN 0x00004
#define DMASCR_SEM_EN 0x00010
#define DMASCR_DMA_COMP_EN 0x00020
#define DMASCR_CHAIN_COMP_EN 0x00040
#define DMASCR_ERR_INT_EN 0x00080
#define DMASCR_PARITY_INT_EN 0x00100
#define DMASCR_ANY_ERR 0x00800
#define DMASCR_MBE_ERR 0x01000
#define DMASCR_PARITY_ERR_REP 0x02000
#define DMASCR_PARITY_ERR_DET 0x04000
#define DMASCR_SYSTEM_ERR_SIG 0x08000
#define DMASCR_TARGET_ABT 0x10000
#define DMASCR_MASTER_ABT 0x20000
#define DMASCR_DMA_COMPLETE 0x40000
#define DMASCR_CHAIN_COMPLETE 0x80000
/*
3.SOME PCs HAVE HOST BRIDGES WHICH APPARENTLY DO NOT CORRECTLY HANDLE
READ-LINE (0xE) OR READ-MULTIPLE (0xC) PCI COMMAND CODES DURING DMA
TRANSFERS. IN OTHER SYSTEMS THESE COMMAND CODES WILL CAUSE THE HOST BRIDGE
TO ALLOW LONGER BURSTS DURING DMA READ OPERATIONS. THE UPPER FOUR BITS
(31..28) OF THE DMA CSR HAVE BEEN MADE PROGRAMMABLE, SO THAT EITHER A 0x6,
AN 0xE OR A 0xC CAN BE WRITTEN TO THEM TO SET THE COMMAND CODE USED DURING
DMA READ OPERATIONS.
*/
#define DMASCR_READ 0x60000000
#define DMASCR_READLINE 0xE0000000
#define DMASCR_READMULTI 0xC0000000
#define DMASCR_ERROR_MASK (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR | DMASCR_ANY_ERR)
#define DMASCR_HARD_ERROR (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR)
#define WINDOWMAP_WINNUM 0x7B
#define DMA_READ_FROM_HOST 0
#define DMA_WRITE_TO_HOST 1
struct mm_dma_desc {
__le64 pci_addr;
__le64 local_addr;
__le32 transfer_size;
u32 zero1;
__le64 next_desc_addr;
__le64 sem_addr;
__le32 control_bits;
u32 zero2;
dma_addr_t data_dma_handle;
/* Copy of the bits */
__le64 sem_control_bits;
} __attribute__((aligned(8)));
/* bits for card->flags */
#define UM_FLAG_DMA_IN_REGS 1
#define UM_FLAG_NO_BYTE_STATUS 2
#define UM_FLAG_NO_BATTREG 4
#define UM_FLAG_NO_BATT 8
#endif
|
/*
***************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 2002-2005, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attempt
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
***************************************************************************
Module Name:
wapi.h
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Albert 2008-4-3 Supoort WAPI protocol
*/
#ifndef __WAPI_H__
#define __WAPI_H__
#include "wpa_cmm.h"
// Increase TxIV value for next transmission
// Todo - When overflow occurred, do re-key mechanism
#define INC_TX_IV(_V, NUM) \
{ \
UCHAR cnt = LEN_WAPI_TSC; \
do \
{ \
cnt--; \
_V[cnt] = _V[cnt] + NUM; \
if (cnt == 0) \
{ \
DBGPRINT(RT_DEBUG_TRACE, ("PN overflow!!!!\n")); \
break; \
} \
}while (_V[cnt] == 0); \
}
#define IS_WAPI_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWAICERT) && ((a) <= Ndis802_11AuthModeWAIPSK))
/* The underlying chip supports hardware-based WPI-SMS4 encryption and de-encryption. */
#define IS_HW_WAPI_SUPPORT(a) (IS_RT3883(a) || IS_RT3593(a))
/*
=====================================
function prototype in wapi_crypt.c
=====================================
*/
int wpi_cbc_mac_engine(
unsigned char * maciv_in,
unsigned char * in_data1,
unsigned int in_data1_len,
unsigned char * in_data2,
unsigned int in_data2_len,
unsigned char * pkey,
unsigned char * mac_out);
int wpi_sms4_ofb_engine(
unsigned char * pofbiv_in,
unsigned char * pbw_in,
unsigned int plbw_in,
unsigned char * pkey,
unsigned char * pcw_out);
VOID RTMPInsertWapiIe(
IN UINT AuthMode,
IN UINT WepStatus,
OUT PUCHAR pWIe,
OUT UCHAR *w_len);
BOOLEAN RTMPCheckWAIframe(
IN PUCHAR pData,
IN ULONG DataByteCount);
VOID RTMPConstructWPIIVHdr(
IN UCHAR key_id,
IN UCHAR *tx_iv,
OUT UCHAR *iv_hdr);
#ifdef RTMP_RBUS_SUPPORT
INT RTMPSoftEncryptSMS4(
IN PUCHAR pHeader,
IN PUCHAR pData,
IN UINT32 data_len,
IN UCHAR key_id,
IN PUCHAR pKey,
IN PUCHAR pIv);
INT RTMPSoftDecryptSMS4(
IN PUCHAR pHdr,
IN BOOLEAN bSanityIV,
IN PCIPHER_KEY pKey,
INOUT PUCHAR pData,
INOUT UINT16 *DataByteCnt);
#else
extern INT RTMPSoftEncryptSMS4(
IN PUCHAR pHeader,
IN PUCHAR pData,
IN UINT32 data_len,
IN UCHAR key_id,
IN PUCHAR pKey,
IN PUCHAR pIv);
extern INT RTMPSoftDecryptSMS4(
IN PUCHAR pHdr,
IN BOOLEAN bSanityIV,
IN PCIPHER_KEY pKey,
INOUT PUCHAR pData,
INOUT UINT16 *DataByteCnt);
#endif // RTMP_RBUS_SUPPORT //
VOID RTMPDeriveWapiGTK(
IN PUCHAR nmk,
OUT PUCHAR gtk_ptr);
INT SMS4_TEST(void);
/*
=====================================
function prototype in wapi.c
=====================================
*/
BOOLEAN RTMPIsWapiCipher(
IN PRTMP_ADAPTER pAd,
IN UCHAR apidx);
VOID RTMPIoctlQueryWapiConf(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
void rtmp_read_wapi_parms_from_file(
IN PRTMP_ADAPTER pAd,
char *tmpbuf,
char *buffer);
VOID RTMPWapiUskRekeyPeriodicExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID RTMPWapiMskRekeyPeriodicExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID RTMPInitWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPStartWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPCancelWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPGetWapiTxTscFromAsic(
IN PRTMP_ADAPTER pAd,
IN UINT Wcid,
OUT UCHAR *tx_tsc);
VOID WAPIInstallPairwiseKey(
PRTMP_ADAPTER pAd,
PMAC_TABLE_ENTRY pEntry,
BOOLEAN bAE);
VOID WAPIInstallSharedKey(
PRTMP_ADAPTER pAd,
UINT8 GroupCipher,
UINT8 BssIdx,
UINT8 KeyIdx,
UINT8 Wcid,
PUINT8 pGtk);
BOOLEAN WAPI_InternalCmdAction(
IN PRTMP_ADAPTER pAd,
IN UCHAR AuthMode,
IN UCHAR apidx,
IN PUCHAR pAddr,
IN UCHAR flag);
#endif // __WAPI_H__ //
|
/*******************************************************************************
PANDORAGS project - PS1 GPU driver
------------------------------------------------------------------------
Author : Romain Vinders
License : GPLv2
------------------------------------------------------------------------
Description : rendering engine - graphics API management
*******************************************************************************/
#pragma once
#include "../vendor/opengl.h" // openGL includes
#include "utils/display_window.h"
/// @namespace display
/// Display management
namespace display
{
/// @class Engine
/// @brief Rendering engine - graphics API management
class Engine
{
private:
// engine status
static bool s_isInitialized; ///< Rendering engine initialization status
static GLuint s_programId; ///< Rendering pipeline program identifier
// window management
static utils::DisplayWindow* s_pWindowManager; ///< Main window
static device_handle_t s_windowDeviceContext; ///< Window device context
#ifdef _WINDOWS
static HGLRC s_openGlRenderContext; ///< API rendering context
#else
static GLFWwindow* s_openGlRenderContext; ///< API window context
#endif
public:
/// @brief Create and initialize display window
/// @param[in] window Parent window handle
/// @throws runtime_error Window creation failure
static void createDisplayWindow(window_handle_t window);
/// @brief Close display window and restore menu
static void closeDisplayWindow();
/// @brief Render current frame
static void render();
private:
// -- rendering API management -- --------------------------------------
/// @brief Initialize rendering API
/// @throws runtime_error API init failure
static void initGL();
/// @brief Cleanup and close rendering API
static void closeGL();
/// @brief Load/reload rendering pipeline
static void loadPipeline();
};
}
|
/*
rkrellm - a _R_atpoison and _T_erminal _F_riendly _M_onitoring application
Copyright (C) 2005 Scott M. Koch
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <ncurses.h>
#include <stdlib.h>
#include <rkrellmStats.h>
#include <rkrellmDisplay.h>
void graph_battery(WINDOW *win){
int maxy, maxx;
sg_battery_stats *battery_info;
WINDOW *graph_win;
double battery_percent;
char battery_str[20];
/*no reason to do this twice*/
if(!screen_init){
wclear(win);
//box(win, 0, 0);
wborder(win, 0, 0, 0, 0, 0, 0, 0, 0);
}
wCenterTitleTop(win, "Battery Info");
wattrset(win, COLOR_PAIR(YELLOW_BLACK));
getmaxyx(win, maxy, maxx);
battery_info = get_battery_info();
if(battery_info == NULL){
fprintf(stderr, "Error getting battery info. Exiting...\n");
exit(1);
}
battery_percent =
100 * ((float)battery_info->remaining_capacity/(float)battery_info->capacity);
snprintf(battery_str, sizeof(battery_str), " %5.2f%%", battery_percent);
graph_win = subwin(win, BATTERY_GRAPH_Y_SIZE, BATTERY_GRAPH_X_SIZE, BATTERY_GRAPH_Y_POS, BATTERY_GRAPH_X_POS);
wattrset(graph_win, COLOR_PAIR(BLUE_BLACK));
percent_graph_battery(graph_win, battery_percent, battery_str);
touchwin(graph_win);
wnoutrefresh(graph_win);
touchwin(win);
wnoutrefresh(win);
return;
}
|
//===========================================
// The following is for 8723B 2Ant BT Co-exist definition
//===========================================
#define BT_AUTO_REPORT_ONLY_8723B_2ANT 1
#define BT_INFO_8723B_2ANT_B_FTP BIT7
#define BT_INFO_8723B_2ANT_B_A2DP BIT6
#define BT_INFO_8723B_2ANT_B_HID BIT5
#define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT4
#define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT3
#define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT2
#define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT1
#define BT_INFO_8723B_2ANT_B_CONNECTION BIT0
#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
typedef enum _BT_INFO_SRC_8723B_2ANT{
BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
BT_INFO_SRC_8723B_2ANT_MAX
}BT_INFO_SRC_8723B_2ANT,*PBT_INFO_SRC_8723B_2ANT;
typedef enum _BT_8723B_2ANT_BT_STATUS{
BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
BT_8723B_2ANT_BT_STATUS_MAX
}BT_8723B_2ANT_BT_STATUS,*PBT_8723B_2ANT_BT_STATUS;
typedef enum _BT_8723B_2ANT_COEX_ALGO{
BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
}BT_8723B_2ANT_COEX_ALGO,*PBT_8723B_2ANT_COEX_ALGO;
typedef struct _COEX_DM_8723B_2ANT{
// fw mechanism
BOOLEAN bPreDecBtPwr;
BOOLEAN bCurDecBtPwr;
u1Byte preFwDacSwingLvl;
u1Byte curFwDacSwingLvl;
BOOLEAN bCurIgnoreWlanAct;
BOOLEAN bPreIgnoreWlanAct;
u1Byte prePsTdma;
u1Byte curPsTdma;
u1Byte psTdmaPara[5];
u1Byte psTdmaDuAdjType;
BOOLEAN bResetTdmaAdjust;
BOOLEAN bAutoTdmaAdjust;
BOOLEAN bPrePsTdmaOn;
BOOLEAN bCurPsTdmaOn;
BOOLEAN bPreBtAutoReport;
BOOLEAN bCurBtAutoReport;
// sw mechanism
BOOLEAN bPreRfRxLpfShrink;
BOOLEAN bCurRfRxLpfShrink;
u4Byte btRf0x1eBackup;
BOOLEAN bPreLowPenaltyRa;
BOOLEAN bCurLowPenaltyRa;
BOOLEAN bPreDacSwingOn;
u4Byte preDacSwingLvl;
BOOLEAN bCurDacSwingOn;
u4Byte curDacSwingLvl;
BOOLEAN bPreAdcBackOff;
BOOLEAN bCurAdcBackOff;
BOOLEAN bPreAgcTableEn;
BOOLEAN bCurAgcTableEn;
u4Byte preVal0x6c0;
u4Byte curVal0x6c0;
u4Byte preVal0x6c4;
u4Byte curVal0x6c4;
u4Byte preVal0x6c8;
u4Byte curVal0x6c8;
u1Byte preVal0x6cc;
u1Byte curVal0x6cc;
BOOLEAN bLimitedDig;
// algorithm related
u1Byte preAlgorithm;
u1Byte curAlgorithm;
u1Byte btStatus;
u1Byte wifiChnlInfo[3];
BOOLEAN bNeedRecover0x948;
u2Byte backup0x948;
} COEX_DM_8723B_2ANT, *PCOEX_DM_8723B_2ANT;
typedef struct _COEX_STA_8723B_2ANT{
BOOLEAN bBtLinkExist;
BOOLEAN bScoExist;
BOOLEAN bA2dpExist;
BOOLEAN bHidExist;
BOOLEAN bPanExist;
BOOLEAN bUnderLps;
BOOLEAN bUnderIps;
u4Byte highPriorityTx;
u4Byte highPriorityRx;
u4Byte lowPriorityTx;
u4Byte lowPriorityRx;
u1Byte btRssi;
u1Byte preBtRssiState;
u1Byte preWifiRssiState[4];
BOOLEAN bC2hBtInfoReqSent;
u1Byte btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
u4Byte btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX];
BOOLEAN bC2hBtInquiryPage;
u1Byte btRetryCnt;
u1Byte btInfoExt;
}COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT;
//===========================================
// The following is interface which will notify coex module.
//===========================================
VOID
EXhalbtc8723b2ant_InitHwConfig(
IN PBTC_COEXIST pBtCoexist
);
VOID
EXhalbtc8723b2ant_InitCoexDm(
IN PBTC_COEXIST pBtCoexist
);
VOID
EXhalbtc8723b2ant_IpsNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_LpsNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_ScanNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_ConnectNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_MediaStatusNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_SpecialPacketNotify(
IN PBTC_COEXIST pBtCoexist,
IN u1Byte type
);
VOID
EXhalbtc8723b2ant_BtInfoNotify(
IN PBTC_COEXIST pBtCoexist,
IN pu1Byte tmpBuf,
IN u1Byte length
);
VOID
EXhalbtc8723b2ant_HaltNotify(
IN PBTC_COEXIST pBtCoexist
);
VOID
EXhalbtc8723b2ant_Periodical(
IN PBTC_COEXIST pBtCoexist
);
VOID
EXhalbtc8723b2ant_DisplayCoexInfo(
IN PBTC_COEXIST pBtCoexist
);
|
#ifndef COIN_SOPROFILERTOPKIT
#define COIN_SOPROFILERTOPKIT
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg SIM about acquiring
* a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
#include <Inventor/annex/Profiler/nodekits/SoProfilerOverlayKit.h>
#include <Inventor/fields/SoSFColor.h>
#include <Inventor/fields/SoSFInt32.h>
#include <Inventor/fields/SoSFVec2f.h>
#include <Inventor/fields/SoSFVec3f.h>
#include <Inventor/tools/SbPimplPtr.h>
class SoProfilerTopKitP;
class COIN_DLL_API SoProfilerTopKit : public SoProfilerOverlayKit {
typedef SoProfilerOverlayKit inherited;
SO_KIT_HEADER(SoProfilerTopKit);
SO_KIT_CATALOG_ENTRY_HEADER(textSep);
SO_KIT_CATALOG_ENTRY_HEADER(color);
SO_KIT_CATALOG_ENTRY_HEADER(translation);
SO_KIT_CATALOG_ENTRY_HEADER(text);
SO_KIT_CATALOG_ENTRY_HEADER(graph);
public:
static void initClass(void);
SoProfilerTopKit(void);
SoSFColor txtColor;
SoSFInt32 lines;
SoSFVec2f topKitSize; // output set from internal parts
SoSFVec3f position; // input set from SoProfilerOverlayKit
protected:
virtual ~SoProfilerTopKit(void);
private:
SbPimplPtr<SoProfilerTopKitP> pimpl;
friend class SoProfilerTopKitP;
SoProfilerTopKit(const SoProfilerTopKit & rhs);
SoProfilerTopKit & operator = (const SoProfilerTopKit & rhs);
}; // SoProfilerTopKit
#endif //!COIN_SOPROFILERTOPKIT
|
#ifndef __AC_JSON_80211_WTPRADIOFAILALARM_HEADER__
#define __AC_JSON_80211_WTPRADIOFAILALARM_HEADER__
#include "capwap_element_80211_wtpradiofailalarm.h"
extern struct ac_json_ieee80211_ops ac_json_80211_wtpradiofailalarm_ops;
#endif /* __AC_JSON_80211_WTPRADIOFAILALARM_HEADER__ */
|
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <locale.h>
#include <curses.h>
#include <menu.h>
#include <panel.h>
#include <form.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include "ncurses.h"
#define max(a, b) ({\
typeof(a) _a = a;\
typeof(b) _b = b;\
_a > _b ? _a : _b; })
#define min(a, b) ({\
typeof(a) _a = a;\
typeof(b) _b = b;\
_a < _b ? _a : _b; })
typedef enum {
NORMAL = 1,
MAIN_HEADING,
MAIN_MENU_BOX,
MAIN_MENU_FORE,
MAIN_MENU_BACK,
MAIN_MENU_GREY,
MAIN_MENU_HEADING,
SCROLLWIN_TEXT,
SCROLLWIN_HEADING,
SCROLLWIN_BOX,
DIALOG_TEXT,
DIALOG_MENU_FORE,
DIALOG_MENU_BACK,
DIALOG_BOX,
INPUT_BOX,
INPUT_HEADING,
INPUT_TEXT,
INPUT_FIELD,
FUNCTION_TEXT,
FUNCTION_HIGHLIGHT,
ATTR_MAX
} attributes_t;
extern attributes_t attributes[];
typedef enum {
F_HELP = 1,
F_SYMBOL = 2,
F_INSTS = 3,
F_CONF = 4,
F_BACK = 5,
F_SAVE = 6,
F_LOAD = 7,
F_EXIT = 8
} function_key;
void set_colors(void);
/* this changes the windows attributes !!! */
void print_in_middle(WINDOW *win,
int starty,
int startx,
int width,
const char *string,
chtype color);
int get_line_length(const char *line);
int get_line_no(const char *text);
const char *get_line(const char *text, int line_no);
void fill_window(WINDOW *win, const char *text);
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
int dialog_inputbox(WINDOW *main_window,
const char *title, const char *prompt,
const char *init, char *result, int result_len);
void refresh_all_windows(WINDOW *main_window);
void show_scroll_win(WINDOW *main_window,
const char *title,
const char *text);
|
/*
* Nestle filesystem platform Developed by Flash Software Group.
*
* Copyright 2006-2009 by Memory Division, Samsung Electronics, Inc.,
* San #16, Banwol-Dong, Hwasung-City, Gyeonggi-Do, Korea
*
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Samsung Electronics, Inc. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Samsung.
*/
/**
* @file nsd_base.h
* @brief Base file that all other source files will include.
* @author Kwon Moon Sang
* @date 2008/08/26
* @remark Just base of programming
* @version RFS_3.0.0_b030_RTM
* @note
* 26-AUG-2008 [Moonsang Kwon]: First writing
*/
#ifndef __NSD_BASE_H__
#define __NSD_BASE_H__
#include "nsd_config.h"
#include "nsd_version.h"
#include "nsd_types.h"
#include "nsd_debug.h"
#endif // end of #ifndef __NSD_BASE_H__
|
/*
* blkdiscard.c -- discard the part (or whole) of the block device.
*
* Copyright (C) 2012 Red Hat, Inc. All rights reserved.
* Written by Lukas Czerner <lczerner@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This program uses BLKDISCARD ioctl to discard part or the whole block
* device if the device supports it. You can specify range (start and
* length) to be discarded, or simply discard the whole device.
*/
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <limits.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include "nls.h"
#include "strutils.h"
#include "c.h"
#include "closestream.h"
#ifndef BLKDISCARD
#define BLKDISCARD _IO(0x12,119)
#endif
#ifndef BLKSECDISCARD
#define BLKSECDISCARD _IO(0x12,125)
#endif
static void __attribute__((__noreturn__)) usage(FILE *out)
{
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <device>\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(_(" -o, --offset <num> offset in bytes to discard from\n"
" -l, --length <num> length of bytes to discard from the offset\n"
" -s, --secure perform secure discard\n"
" -v, --verbose print aligned length and offset\n"),
out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("blkdiscard(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
int main(int argc, char **argv)
{
char *path;
int c, fd, verbose = 0, secure = 0, secsize;
uint64_t end, blksize, range[2];
struct stat sb;
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
{ "offset", 1, 0, 'o' },
{ "length", 1, 0, 'l' },
{ "secure", 0, 0, 's' },
{ "verbose", 0, 0, 'v' },
{ NULL, 0, 0, 0 }
};
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
range[0] = 0;
range[1] = ULLONG_MAX;
while ((c = getopt_long(argc, argv, "hVsvo:l:", longopts, NULL)) != -1) {
switch(c) {
case 'h':
usage(stdout);
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'l':
range[1] = strtosize_or_err(optarg,
_("failed to parse length"));
break;
case 'o':
range[0] = strtosize_or_err(optarg,
_("failed to parse offset"));
break;
case 's':
secure = 1;
break;
case 'v':
verbose = 1;
break;
default:
usage(stderr);
break;
}
}
if (optind == argc)
errx(EXIT_FAILURE, _("no device specified"));
path = argv[optind++];
if (optind != argc) {
warnx(_("unexpected number of arguments"));
usage(stderr);
}
fd = open(path, O_WRONLY);
if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), path);
if (fstat(fd, &sb) == -1)
err(EXIT_FAILURE, _("stat failed %s"), path);
if (!S_ISBLK(sb.st_mode))
errx(EXIT_FAILURE, _("%s: not a block device"), path);
if (ioctl(fd, BLKGETSIZE64, &blksize))
err(EXIT_FAILURE, _("%s: BLKGETSIZE64 ioctl failed"), path);
if (ioctl(fd, BLKSSZGET, &secsize))
err(EXIT_FAILURE, _("%s: BLKSSZGET ioctl failed"), path);
/* align range to the sector size */
range[0] = (range[0] + secsize - 1) & ~(secsize - 1);
range[1] &= ~(secsize - 1);
/* is the range end behind the end of the device ?*/
if (range[0] > blksize)
errx(EXIT_FAILURE, _("%s: offset is greater than device size"), path);
end = range[0] + range[1];
if (end < range[0] || end > blksize)
range[1] = blksize - range[0];
if (secure) {
if (ioctl(fd, BLKSECDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKSECDISCARD ioctl failed"), path);
} else {
if (ioctl(fd, BLKDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKDISCARD ioctl failed"), path);
}
if (verbose)
/* TRANSLATORS: The standard value here is a very large number. */
printf(_("%s: Discarded %" PRIu64 " bytes from the "
"offset %" PRIu64"\n"), path,
(uint64_t) range[1], (uint64_t) range[0]);
close(fd);
return EXIT_SUCCESS;
}
|
#ifndef _ERROR_H_
#define _ERROR_H_
typedef enum {NO_ERROR = 0, ARRAY_ERROR = 1, IO_ERROR = 2, PROGRAM_ERROR = 3}
ErrorCode;
void Error(const char* errorMessage, const ErrorCode errorCode);
#endif
|
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant 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.
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (INCLUDED_SPRITE_H)
#define INCLUDED_SPRITE_H
class Image;
class ArchiveFile;
Image* LoadIDSP(ArchiveFile& file);
#endif
|
/*
* resolved-cmd.c -- Subversion resolved subcommand
*
* ====================================================================
* Copyright (c) 2000-2008 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* ====================================================================
*/
/* ==================================================================== */
/*** Includes. ***/
#define APR_WANT_STDIO
#include <apr_want.h>
#include "svn_client.h"
#include "svn_error.h"
#include "svn_pools.h"
#include "cl.h"
/* We shouldn't be including a private header here, but it is
* necessary for fixing issue #3416 */
#include "private/svn_opt_private.h"
#include "svn_private_config.h"
/*** Code. ***/
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__resolved(apr_getopt_t *os,
void *baton,
apr_pool_t *pool)
{
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
svn_error_t *err;
apr_array_header_t *targets;
int i;
apr_pool_t *subpool;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
ctx, pool));
if (! targets->nelts)
return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
subpool = svn_pool_create(pool);
if (! opt_state->quiet)
svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE,
FALSE, FALSE, pool);
if (opt_state->depth == svn_depth_unknown)
opt_state->depth = svn_depth_empty;
SVN_ERR(svn_opt__eat_peg_revisions(&targets, targets, pool));
for (i = 0; i < targets->nelts; i++)
{
const char *target = APR_ARRAY_IDX(targets, i, const char *);
svn_pool_clear(subpool);
SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
err = svn_client_resolve(target,
opt_state->depth,
svn_wc_conflict_choose_merged,
ctx,
subpool);
if (err)
{
svn_handle_warning2(stderr, err, "svn: ");
svn_error_clear(err);
}
}
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
|
/* This file is part of the KDE project
* Copyright (c) 2010 Justin Noel <justin@ics.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISSLIDERSPINBOX_H
#define KISSLIDERSPINBOX_H
#include <QAbstractSpinBox>
#include <QStyleOptionSpinBox>
#include <QStyleOptionProgressBar>
#include <kritaui_export.h>
class KisAbstractSliderSpinBoxPrivate;
class KisSliderSpinBoxPrivate;
class KisDoubleSliderSpinBoxPrivate;
/**
* XXX: when inactive, also show the progress bar part as inactive!
*/
class KRITAUI_EXPORT KisAbstractSliderSpinBox : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(KisAbstractSliderSpinBox)
Q_DECLARE_PRIVATE(KisAbstractSliderSpinBox)
protected:
explicit KisAbstractSliderSpinBox(QWidget* parent, KisAbstractSliderSpinBoxPrivate*);
public:
virtual ~KisAbstractSliderSpinBox();
void showEdit();
void hideEdit();
void setPrefix(const QString& prefix);
void setSuffix(const QString& suffix);
void setExponentRatio(qreal dbl);
/**
* If set to block, it informs inheriting classes that they shouldn't emit signals
* if the update comes from a mouse dragging the slider.
* Set this to true when dragging the slider and updates during the drag are not needed.
*/
void setBlockUpdateSignalOnDrag(bool block);
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
virtual QSize minimumSize() const;
protected:
virtual void paintEvent(QPaintEvent* e);
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
virtual void wheelEvent(QWheelEvent *);
virtual bool eventFilter(QObject* recv, QEvent* e);
QStyleOptionSpinBox spinBoxOptions() const;
QStyleOptionProgressBar progressBarOptions() const;
QRect progressRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect upButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect downButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
int valueForX(int x, Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
virtual QString valueString() const = 0;
/**
* Sets the slider internal value. Inheriting classes should respect blockUpdateSignal
* so that, in specific cases, we have a performance improvement. See setIgnoreMouseMoveEvents.
*/
virtual void setInternalValue(int value, bool blockUpdateSignal) = 0;
protected Q_SLOTS:
void contextMenuEvent(QContextMenuEvent * event);
void editLostFocus();
protected:
KisAbstractSliderSpinBoxPrivate* const d_ptr;
// QWidget interface
protected:
virtual void changeEvent(QEvent *e);
void paint(QPainter& painter);
void paintPlastique(QPainter& painter);
void paintBreeze(QPainter& painter);
private:
void setInternalValue(int value);
};
class KRITAUI_EXPORT KisSliderSpinBox : public KisAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(KisSliderSpinBox)
Q_PROPERTY( int minimum READ minimum WRITE setMinimum )
Q_PROPERTY( int maximum READ maximum WRITE setMaximum )
public:
KisSliderSpinBox(QWidget* parent = 0);
~KisSliderSpinBox();
void setRange(int minimum, int maximum);
int minimum() const;
void setMinimum(int minimum);
int maximum() const;
void setMaximum(int maximum);
int fastSliderStep() const;
void setFastSliderStep(int step);
///Get the value, don't use value()
int value();
void setSingleStep(int value);
void setPageStep(int value);
public Q_SLOTS:
///Set the value, don't use setValue()
void setValue(int value);
protected:
virtual QString valueString() const;
virtual void setInternalValue(int value, bool blockUpdateSignal);
Q_SIGNALS:
void valueChanged(int value);
};
class KRITAUI_EXPORT KisDoubleSliderSpinBox : public KisAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(KisDoubleSliderSpinBox)
public:
KisDoubleSliderSpinBox(QWidget* parent = 0);
~KisDoubleSliderSpinBox();
void setRange(qreal minimum, qreal maximum, int decimals = 0);
qreal minimum() const;
void setMinimum(qreal minimum);
qreal maximum() const;
void setMaximum(qreal maximum);
qreal fastSliderStep() const;
void setFastSliderStep(qreal step);
qreal value();
void setValue(qreal value);
void setSingleStep(qreal value);
protected:
virtual QString valueString() const;
virtual void setInternalValue(int value, bool blockUpdateSignal);
Q_SIGNALS:
void valueChanged(qreal value);
};
#endif //kISSLIDERSPINBOX_H
|
///****************************************************************
/// Copyright © 2008 opGames LLC - All Rights Reserved
///
/// Authors: Kevin Depue & Lucas Ellis
///
/// File: MacroInterfaces.h
/// Date: 10/04/2007
///
/// Description:
///
/// Macro interfaces.
///****************************************************************
///==========================================
/// MacroConcatenations
///==========================================
template <class Parent>
class MacroConcatenations : public Parent {
public:
IMPLEMENTS_INTERFACE(MacroConcatenations)
// Finds ID@ID
void FindConcatenations();
};
///==========================================
/// MacroSingleQuotes
///==========================================
template <class Parent>
class MacroSingleQuotes : public Parent {
public:
IMPLEMENTS_INTERFACE(MacroSingleQuotes)
// Finds `text`
void FindSingleQuotes();
};
///==========================================
/// MacroDoubleQuotes
///==========================================
template <class Parent>
class MacroDoubleQuotes : public Parent {
public:
IMPLEMENTS_INTERFACE(MacroDoubleQuotes)
// Finds ``text``
void FindDoubleQuotes();
};
|
/*
* $Id: g_spol.c,v 1.1 2008/01/02 09:55:40 hess Exp $
*
* This source code is part of
*
* G R O M A C S
*
* GROningen MAchine for Chemical Simulations
*
* VERSION 3.2.0
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team,
* check out http://www.gromacs.org 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
* scientific software is very special. Version control is crucial -
* bugs must be traceable. We will be happy to consider code for
* inclusion in the official distribution, but derived work must not
* be called official GROMACS. Details are found in the README & COPYING
* files - if they are missing, get the official version at www.gromacs.org.
*
* To help us fund GROMACS 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.gromacs.org
*
* And Hey:
* Green Red Orange Magenta Azure Cyan Skyblue
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gmx_ana.h>
/* This is just a wrapper binary.
* The code that used to be in g_sorient.c is now in gmx_sorient.c,
* where the old main function is called gmx_sorient().
*/
int
main(int argc, char *argv[])
{
gmx_spol(argc,argv);
return 0;
}
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request,
int *error_code)
{
long *id_sys;
int len, typesize, err=-1;
ADIO_Offset off;
static char myname[] = "ADIOI_PFS_IREADCONTIG";
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->datatype = datatype;
MPI_Type_size(datatype, &typesize);
len = count * typesize;
id_sys = (long *) ADIOI_Malloc(sizeof(long));
(*request)->handle = (void *) id_sys;
off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : offset;
lseek(fd->fd_sys, off, SEEK_SET);
*id_sys = _iread(fd->fd_sys, buf, len);
if ((*id_sys == -1) && (errno == EQNOMID)) {
/* the man pages say EMREQUEST, but in reality errno is set to EQNOMID! */
/* exceeded the max. no. of outstanding requests. */
/* complete all previous async. requests */
/*ADIOI_Complete_async(error_code); */
if (*error_code != MPI_SUCCESS) return;
/* try again */
*id_sys = _iread(fd->fd_sys, buf, len);
if ((*id_sys == -1) && (errno == EQNOMID)) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
return;
}
}
else if (*id_sys == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
return;
}
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
(*request)->queued = 1;
(*request)->nbytes = len;
ADIOI_Add_req_to_list(request);
fd->async_count++;
fd->fp_sys_posn = -1; /* set it to null. */
if (*id_sys == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
}
|
#ifndef MANTIDQTMANTIDWIDGETS_DATAPROCESSORPROCESSCOMMAND_H
#define MANTIDQTMANTIDWIDGETS_DATAPROCESSORPROCESSCOMMAND_H
#include "MantidQtWidgets/Common/DataProcessorUI/DataProcessorCommandBase.h"
namespace MantidQt {
namespace MantidWidgets {
/** @class DataProcessorProcessCommand
DataProcessorProcessCommand defines the action "Process"
Copyright © 2011-16 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DataProcessorProcessCommand : public DataProcessorCommandBase {
public:
DataProcessorProcessCommand(DataProcessorPresenter *tablePresenter)
: DataProcessorCommandBase(tablePresenter){};
DataProcessorProcessCommand(const QDataProcessorWidget &widget)
: DataProcessorCommandBase(widget){};
virtual ~DataProcessorProcessCommand(){};
void execute() override {
m_presenter->notify(DataProcessorPresenter::ProcessFlag);
};
QString name() override { return QString("Process"); }
QString icon() override { return QString("://stat_rows.png"); }
QString tooltip() override { return QString("Processes selected runs"); }
QString whatsthis() override {
return QString("Processes the selected runs. Selected runs are reduced "
"sequentially and independently. If nothing is "
"selected, the behaviour is as if all "
"runs were selected.");
}
QString shortcut() override { return QString(); }
};
}
}
#endif /*MANTIDQTMANTIDWIDGETS_DATAPROCESSORPROCESSCOMMAND_H*/
|
/************************************* open_iA ************************************ *
* ********** A tool for visual analysis and processing of 3D CT images ********** *
* *********************************************************************************** *
* Copyright (C) 2016-2021 C. Heinzl, M. Reiter, A. Reh, W. Li, M. Arikan, Ar. & Al. *
* Amirkhanov, J. Weissenböck, B. Fröhler, M. Schiwarth, P. Weinberger *
* *********************************************************************************** *
* 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/ *
* *********************************************************************************** *
* Contact: FH OÖ Forschungs & Entwicklungs GmbH, Campus Wels, CT-Gruppe, *
* Stelzhamerstraße 23, 4600 Wels / Austria, Email: c.heinzl@fh-wels.at *
* ************************************************************************************/
#pragma once
#include "iAScalingWidget.h"
#include "DynamicVolumeLinesHelpers.h"
#include "ui_dlg_DynamicVolumeLines.h"
#include "ui_Multi3DView.h"
#include <qthelper/iAQTtoUIConnector.h>
#include <iAProgress.h>
#include <vtkSmartPointer.h>
#include <QDir>
class iANonLinearAxisTicker;
class iAOrientationWidget;
class iASegmentTree;
class iAMdiChild;
class iAQVTKWidget;
class iAVolumeRenderer;
class vtkImageData;
class vtkLookupTable;
class vtkPoints;
class vtkRenderer;
class vtkRenderWindow;
class vtkTextActor;
typedef iAQTtoUIConnector<QDockWidget, Ui_dlg_DynamicVolumeLines> DynamicVolumeLinesConnector;
typedef iAQTtoUIConnector<QDockWidget, Ui_Multi3DRendererView> multi3DRendererView;
class dlg_DynamicVolumeLines : public DynamicVolumeLinesConnector
{
Q_OBJECT
public:
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
dlg_DynamicVolumeLines(QWidget* parent, QDir datasetsDir, Qt::WindowFlags f = 0);
#else
dlg_DynamicVolumeLines(QWidget* parent, QDir datasetsDir, Qt::WindowFlags f = Qt::WindowFlags());
#endif
~dlg_DynamicVolumeLines();
QDir m_datasetsDir;
QList<QPair <QString, QList<icData> >> m_DatasetIntensityMap;
public slots:
void mousePress(QMouseEvent*);
void mouseMove(QMouseEvent*);
void mouseWheel(QWheelEvent*);
void setFBPTransparency(int);
void showFBPGraphs();
void visualize();
void updateDynamicVolumeLines();
void updateFBPView();
void visualizePath();
void selectionChangedByUser();
void legendClick(QCPLegend*, QCPAbstractLegendItem*, QMouseEvent*);
void setSelectionForPlots(vtkPoints* selCellPoints);
void setNoSelectionForPlots();
void showBkgrdThrLine();
void syncLinearXAxis(QCPRange);
void syncNonlinearXAxis(QCPRange);
void syncYAxis(QCPRange);
void changePlotVisibility();
void selectCompLevel();
void setSubHistBinCntFlag();
void updateHistColorMap(vtkSmartPointer<vtkLookupTable> LUT);
void compLevelRangeChanged();
signals:
void compLevelRangeChanged(QVector<double> compRange);
protected:
bool eventFilter(QObject * obj, QEvent * event) override;
private:
iAMdiChild *m_mdiChild;
QCustomPlot *m_nonlinearScaledPlot;
QCustomPlot *m_linearScaledPlot;
QCustomPlot *m_debugPlot;
iAScalingWidget *m_scalingWidget;
iAOrientationWidget * m_orientationWidget;
QCPItemText *m_nonlinearDataPointInfo;
QCPItemText *m_linearDataPointInfo;
QCPItemStraightLine *m_nonlinearIdxLine;
QCPItemStraightLine *m_linearIdxLine;
QList<QCPGraph*> m_selGraphList;
QVector<double> m_nonlinearMappingVec;
QVector<double> m_impFunctVec;
QSharedPointer<QCPGraphDataContainer> m_impFuncPlotData;
QSharedPointer<QCPGraphDataContainer> m_integralImpFuncPlotData;
QSharedPointer<iANonLinearAxisTicker> m_nonlinearTicker;
QList<QCPRange> m_bkgrdThrRangeList;
vtkSmartPointer<vtkLookupTable> m_compLvlLUT;
vtkSmartPointer<vtkLookupTable> m_histLUT;
double m_minEnsembleIntensity, m_maxEnsembleIntensity;
QList<iASegmentTree*> m_segmTreeList;
bool m_subHistBinCntChanged;
bool m_histVisMode;
QVector<double> m_histBinImpFunctAvgVec;
QVector<double> m_linearHistBinBoarderVec;
double m_stepSize;
iAProgress m_iMProgress;
QList<vtkSmartPointer<vtkImageData>> m_imgDataList;
multi3DRendererView *m_MultiRendererView;
iAQVTKWidget* m_wgtContainer;
vtkSmartPointer<vtkRenderer> m_mrvBGRen;
vtkSmartPointer<vtkTextActor> m_mrvTxtAct;
QSharedPointer<iAVolumeRenderer> m_volRen;
void generateHilbertIdx();
void setupFBPGraphs(QCustomPlot* qcp, iAFunctionalBoxplot<double, double>* fbpData);
void setupScaledPlot(QCustomPlot* qcp);
void setupDebugPlot();
void setupGUIConnections();
void setupMultiRendererView();
void showDebugPlot();
void calcNonLinearMapping();
void showBkgrdThrRanges(QCustomPlot* qcp);
void showCompressionLevel();
void setupGUIElements();
void setupScalingWidget();
void setupPlotConnections(QCustomPlot* qcp);
void setSelectionForRenderer(QList<QCPGraph *> visSelGraphList);
void generateSegmentTree();
void checkHistVisMode(int lowerIdx, int upperIdx);
};
|
#ifndef CepGen_Processes_TestProcess_h
#define CepGen_Processes_TestProcess_h
#include "GenericProcess.h"
namespace CepGen
{
namespace Process
{
/// Generic process to test the Vegas instance
class TestProcess : public GenericProcess
{
public:
TestProcess();
~TestProcess() {}
void addEventContent() {}
/// Number of dimensions on which to perform the integration
unsigned int numDimensions( const Kinematics::ProcessMode& ) const { return 3; }
/// Generic formula to compute a weight out of a point in the phase space
double computeWeight();
/// Dummy function to be called on events generation
void fillKinematics( bool ) { return; }
private:
};
}
}
#endif
|
/*
* A. e1.p = 0
* e1.y = 8
* e2.x = 0
* e2.next = 8
*
* B. 8 + 8 = 16 bytes
*
* C. up->e2.x = *(*(up->e2.next).e1.p) - *(up->e2.next).e1.y;
*
* */
|
/**
* +----------------------------------------------------------------------+
* | This file is part of Samplecat. http://ayyi.github.io/samplecat/ |
* | copyright (C) 2007-2019 Tim Orford <tim@orford.org> |
* +----------------------------------------------------------------------+
* | This program is free software; you can redistribute it and/or modify |
* | it under the terms of the GNU General Public License version 3 |
* | as published by the Free Software Foundation. |
* +----------------------------------------------------------------------+
*
*/
#ifndef __samplecat_types_h__
#define __samplecat_types_h__
#include <glib.h>
#include "typedefs.h"
#define PALETTE_SIZE 17
struct _palette {
guint red[8];
guint grn[8];
guint blu[8];
};
struct _ScanResults {
int n_added;
int n_failed;
int n_dupes;
};
#define HOMOGENOUS 1
#define NON_HOMOGENOUS 0
#endif
|
/*
Copyright 2005, 2006 Computer Vision Lab,
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
All rights reserved.
This file is part of BazAR.
BazAR 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.
BazAR 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
BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*! \ingroup starter */
#ifndef LINEAR_ALGEBRA_H
#define LINEAR_ALGEBRA_H
#include <iostream>
using namespace std;
// Vectors:
double gfla_norme(double v1, double v2, double v3);
double gfla_normalize_3(double v[3]);
void gfla_scale_3(const double s, double v[3]);
void gfla_scale_3(const double s, const double v[3], double sv[3]);
void gfla_add_3(const double u[3], const double v[3], double w[3]);
void gfla_sub_3(const double u[3], const double v[3], double w[3]);
void gfla_opp_3(double v[3]);
void gfla_cross_product(const double v1[3], const double v2[3], double v1v2[3]);
double gfla_dot_product(const double v1[3], const double v2[3]);
void gfla_copy_3(const double v[3], double copy[3]);
// Copy matrices:
void gfla_copy_3x3(const double M[3][3], double copy[3][3]);
void gfla_copy_3x4(const double M[3][4], double copy[3][4]);
// Matrices:
double gfla_det(const double M[3][3]);
double gfla_det(const double M11, const double M12,
const double M21, const double M22);
double gfla_det(const double M11, const double M12, const double M13,
const double M21, const double M22, const double M23,
const double M31, const double M32, const double M33);
// Print matrices:
void gfla_print_mat_3x3(ostream & o, double M[3][3]);
void gfla_print_mat_3x4(ostream & o, double M[3][4]);
void gfla_print_mat_4x4(ostream & o, double * M);
// Rotation matrices:
void gfla_get_rotation_from_euler_angles(double R[3][3], const double omega, const double phi, const double kappa);
int gfla_get_euler_angles_from_rotation(const double R[3][3], double * omega, double * phi, double * kappa);
// Multiplication Vectors/Matrices
void gfla_mul_scale_mat_3x3(double s, double M[3][3], double sM[3][3]);
void gfla_mul_mat_vect_3x3(const double M[3][3], const double v[3], double Mv[3]);
void gfla_mul_T_mat_vect_3x3(const double M[3][3], const double v[3], double tMv[3]);
void gfla_mul_mat_vect_3x4(const double M[3][4], const double v[3], double Mv[3]);
void gfla_mul_mat_3x3x4(const double M[3][3], const double N[3][4], double MN[3][4]);
// Inverse
void gfla_inverse_3(double A[3][3], double invA[3][3]);
#endif // LINEAR_ALGEBRA_H
|
#include <string.h>
int memcmp(const void *aptr, const void *bptr, size_t size){
const unsigned char *a = (const unsigned char*)aptr;
const unsigned char *b = (const unsigned char*)bptr;
for(size_t i = 0; i < size; i++){
if(a[i] < b[i]){
return -1;
}
else if(b[i] < a[i]){
return 1;
}
}
return 0;
}
|
/****************************************************************************
**
** Copyright (C) Qxt Foundation. Some rights reserved.
**
** This file is part of the QxtGui module of the Qxt library.
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the Common Public License, version 1.0, as published
** by IBM, and/or under the terms of the GNU Lesser General Public License,
** version 2.1, as published by the Free Software Foundation.
**
** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
** FITNESS FOR A PARTICULAR PURPOSE.
**
** You should have received a copy of the CPL and the LGPL along with this
** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
** included with the source distribution for more information.
** If you did not receive a copy of the licenses, contact the Qxt Foundation.
**
** <http://libqxt.org> <foundation@libqxt.org>
**
****************************************************************************/
#ifndef QXTLANGUAGECOMBOBOX_P_H
#define QXTLANGUAGECOMBOBOX_P_H
#include "qxtlanguagecombobox.h"
#include <QComboBox>
class QxtLanguageComboBoxPrivate : public QObject, public QxtPrivate<QxtLanguageComboBox>
{
Q_OBJECT
public:
QXT_DECLARE_PUBLIC(QxtLanguageComboBox)
public:
explicit QxtLanguageComboBoxPrivate();
void init();
QLocale::Language currentLanguage() const;
QString currentLanguageName() const;
void setDisplayMode(QxtLanguageComboBox::DisplayMode mode);
void setTranslationPath(const QString& path);
QxtLanguageComboBox::DisplayMode displayMode() const
{
return _mDisplayMode;
}
QString translationPath() const
{
return _mTranslationPath;
}
public Q_SLOTS:
void setCurrentLanguage(QLocale::Language language);
void comboBoxCurrentIndexChanged(int index);
private:
void handleLanguageChange();
void reset();
private:
QxtLanguageComboBox::DisplayMode _mDisplayMode;
QString _mTranslationPath;
QAbstractTableModel* _mModel;
};
#endif // QXTLANGUAGECOMBOBOX_P_H
|
/* $BEGIN_LICENSE
This file is part of Musique.
Copyright 2013, Flavio Tordini <flavio.tordini@gmail.com>
Musique 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.
Musique 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 Musique. If not, see <http://www.gnu.org/licenses/>.
$END_LICENSE */
#ifndef COVERUTILS_H
#define COVERUTILS_H
#include <QtWidgets>
// TagLib
#include <id3v2tag.h>
#include <mpegfile.h>
#include <attachedpictureframe.h>
#include <oggfile.h>
#include <vorbisfile.h>
#include <flacfile.h>
#include <oggflacfile.h>
#include <mp4file.h>
class Album;
class CoverUtils {
public:
static bool coverFromFile(const QString& dir, Album *album);
static bool coverFromTags(const QString& filename, Album *album);
private:
CoverUtils() {}
static bool isAcceptableImage(const QImage &image);
static QImage maybeScaleImage(const QImage &image);
static bool saveImage(const QImage &image, Album *album);
static bool coverFromMPEGTags(TagLib::ID3v2::Tag *tag, Album *album);
static bool coverFromXiphComment(TagLib::Ogg::XiphComment *xiphComment, Album *album);
static bool coverFromMP4(const QString& filename, Album *album);
};
#endif // COVERUTILS_H
|
/**
* +----------------------------------------------------------------------+
* | This file is part of Samplecat. http://ayyi.github.io/samplecat/ |
* | copyright (C) 2015-2019 Tim Orford <tim@orford.org> |
* +----------------------------------------------------------------------+
* | This program is free software; you can redistribute it and/or modify |
* | it under the terms of the GNU General Public License version 3 |
* | as published by the Free Software Foundation. |
* +----------------------------------------------------------------------+
*
*/
#ifndef __views_list_h__
#define __views_list_h__
typedef struct {
AGlActor actor;
int selection;
int scroll_offset;
} ListView;
AGlActorClass* list_view_get_class ();
AGlActor* list_view (gpointer);
#endif
|
// -----------------------------------------------------------------
// Subtract complex scalar multiplication on vector
// Note that the order of arguments is the opposite of the usual
// c <-- c - s * b
#include "../include/config.h"
#include "../include/complex.h"
#include "../include/su3.h"
void c_scalar_mult_dif_vec(vector *c, complex *s, vector *b) {
register int i;
for (i = 0; i < 3; i++) {
c->c[i].real -= b->c[i].real * s->real - b->c[i].imag * s->imag;
c->c[i].imag -= b->c[i].imag * s->real + b->c[i].real * s->imag;
}
}
// -----------------------------------------------------------------
|
#include <stdio.h>
#include <stdlib.h>
#include "../m_affich/m_affich.h"
#include "../m_bfs/m_bfs.h"
#include "../m_init/m_init.h"
#include "m_f_exit.h"
typedef void *dont_know_type;
dont_know_type find(tree root, int *ex, int sortie, int i);
int *s_tab(int *ex);
int *find_exit(tree root, graph gr)
{
int sortie, n = gr->size[0]*gr->size[1];
int i=0;
int *ex = (int*)malloc(n*sizeof(int));
for (i = 0; i < n; ++i)
{
ex[i] = -1;
}
sortie = gr->sommet[gr->O[0]][gr->O[1]];
//printf("%d\n",sortie );
ex = find(root, ex, sortie, 0);
ex = s_tab(ex);
return ex;
}
int *s_tab(int *ex)
{
int i, j;
if(ex==0){
printf("Impossible de trouver la sortie, arbre pas connexe!!\n");
exit(0);
}
for (i = 1; i < ex[0]; ++i)
{
if(ex[i] == -1){
for (j = i; j < ex[0]; j++)
{
ex[j] = ex[j+1];
}
ex[0]= ex[0]-1;
}
}
return ex;
}
dont_know_type find(tree root, int *ex, int sortie, int i)
{
ex[0] = i;
tree tmp, tmp1, tmp2, tmp3;
tree sauv=root;
if(root)
{
sauv = root;
if(root->s == sortie){
i = i+1;
ex[0] = i;
ex[i] = root->s;
//printf("%d et i = %d\n",ex[i],i );
return ex;
}
else{
if((tmp = find(root->suc0, ex, sortie, i= i+1))&&tmp){
ex[i] = root->s;
//printf("%d pp 0: %d\n",ex[i],i );
return tmp;
}
else if((!tmp)&&(tmp1 = find(root->suc1, ex, sortie, i= i+1))){
ex[i] = root->s;
//printf("%d pp 1: %d\n",ex[i],i );
return tmp1;
}
else if((!tmp)&&(!tmp1)&&(tmp2= find(root->suc2, ex, sortie, i= i+1))){
ex[i] = root->s;
//printf("%d pp 2: %d\n",ex[i],i );
return tmp2;
}
else if((!tmp)&&(!tmp1)&&(!tmp2)&&(tmp3 = find(root->suc3, ex, sortie, i= i+1))) {
ex[i] = root->s;
//printf("%d pp 3: %d\n",ex[i],i );
return tmp3;
}
}
}
else if((!root)&&(!in_tab(ex,sortie)&&(sauv))){
root = sauv;
return find(root, ex, sortie, i);
}
return 0;
}
|
#ifndef terminal_h
#define terminal_h
#include <stddef.h>
#include <stdint.h>
struct terminalContext {
size_t row;
size_t column;
vgaColor_t bcolor;
vgaColor_t fcolor;
uint8_t color;
uint16_t * buffer;
};
void terminal_flush (struct terminalContext * context);
void terminal_cls (struct terminalContext * context);
vgaColor_t terminal_getBColor (struct terminalContext * context);
vgaColor_t terminal_getFColor (struct terminalContext * context);
void terminal_setBColor (struct terminalContext * context, vgaColor_t color);
void terminal_setFColor (struct terminalContext * context, vgaColor_t color);
#endif
|
#pragma once
#include "../models/ModelBase.h"
#include <vector>
namespace storm {
namespace logic {
class Formula;
}
namespace storage {
struct ModelFormulasPair {
std::shared_ptr<storm::models::ModelBase> model;
std::vector<std::shared_ptr<storm::logic::Formula const>> formulas;
};
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.