text
stringlengths 4
6.14k
|
|---|
/* ----------------------------- MNI Header -----------------------------------
@NAME : ms_roi.h
@DESCRIPTION: constants, typedefs and external vars for
roi list structure
@CREATED : Wed Jul 7 20:50:20 EST 1993 Louis Collins
@MODIFIED :
---------------------------------------------------------------------------- */
#ifndef DEF_MS_ROI
#define DEF_MS_ROI
#define MAX_POINTS 3000 /* Changed by Youpu 13/05/91*/
typedef struct point_list {
int x;
int y;
struct point_list *next_point;
} POINT_LIST, *POINT_LIST_PTR;
typedef struct roi_list {
int roi_id;
int number_of_points;
int maxx, minx, miny, maxy;
struct point_list *next_point;
struct roi_list *next_roi;
} ROI_LIST, *ROI_LIST_PTR;
typedef struct stackroi_list {
int number_of_rois;
struct roi_list *roilist;
} STACKROI_LIST, *STACKROI_LIST_PTR;
#endif
|
/*
* 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.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "devfs.h"
int devFS_node_type(
rtems_filesystem_location_info_t *pathloc
)
{
/*
* There is only one type of node: device
*/
return RTEMS_FILESYSTEM_DEVICE;
}
|
// glassgui.h
//
// glassgui(1) Audio Encoder front end
//
// (C) Copyright 2015-2022 Fred Gleason <fredg@paravelsystems.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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef GLASSGUI_H
#define GLASSGUI_H
#include <QDir>
#include <QLabel>
#include <QLineEdit>
#include <QListView>
#include <QMainWindow>
#include <QProcess>
#include <QPushButton>
#include <QSpinBox>
#include <QStringList>
#include <QTimer>
#include "codecdialog.h"
#include "codeviewer.h"
#include "combobox.h"
#include "guiapplication.h"
#include "hpiinputlistview.h"
#include "messagewidget.h"
#include "serverdialog.h"
#include "sourcedialog.h"
#include "statuswidget.h"
#include "stereometer.h"
#include "streamdialog.h"
#define GLASSGUI_USAGE "[options]\n"
#define GLASSGUI_TERMINATE_TIMEOUT 5000
class MainWidget : public GuiApplication
{
Q_OBJECT;
public:
MainWidget(QWidget *parent=0);
QSize sizeHint() const;
protected:
void closeEvent(QCloseEvent *e);
void resizeEvent(QResizeEvent *e);
private slots:
void startEncodingData();
void stopEncodingData();
void showCodeData();
void metadataData();
void serverTypeChangedData(Connector::ServerType type,bool multirate);
void serverData();
void codecData();
void streamData();
void sourceData();
void codecFinishedData(int exit_code,QProcess::ExitStatus exit_status);
void checkArgs();
void checkArgs(const QString &str);
void deviceFinishedData(int exit_code,QProcess::ExitStatus exit_status);
void processReadyReadStandardOutputData();
void processFinishedData(int exit_code,QProcess::ExitStatus exit_status);
void processErrorData(QProcess::ProcessError err);
void processCollectGarbageData();
void processKillData();
private:
QString instance_name;
void LockControls(bool state);
void ProcessFeedback(const QString &str);
void ProcessError(int exit_code,QProcess::ExitStatus exit_status);
void LoadSettings();
bool SaveSettings();
void ListInstances();
void ExitProgram(int exit_code) const;
StereoMeter *gui_meter;
QPushButton *gui_start_button;
QLabel *gui_metadata_label;
QLineEdit *gui_metadata_edit;
QPushButton *gui_metadata_button;
QPushButton *gui_code_button;
ServerDialog *gui_server_dialog;
QPushButton *gui_server_button;
CodecDialog *gui_codec_dialog;
QPushButton *gui_codec_button;
StreamDialog *gui_stream_dialog;
QPushButton *gui_stream_button;
SourceDialog *gui_source_dialog;
QPushButton *gui_source_button;
CodeViewer *gui_codeviewer_dialog;
QProcess *gui_process;
QTimer *gui_process_cleanup_timer;
QTimer *gui_process_kill_timer;
QString gui_process_accum;
MessageWidget *gui_message_widget;
StatusWidget *gui_status_widget;
QLabel *gui_status_frame_widget;
bool gui_autostart;
QTimer *gui_autostart_timer;
QDir *gui_temp_dir;
};
#endif // GLASSGUI_H
|
/*
* Copyright (C) 2011-2012 Project SkyFire <http://www.projectskyfire.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_THRONE_OF_THE_TIDES
#define DEF_THRONE_OF_THE_TIDES
enum Npcs
{
// Lady Naz'jar
BOSS_LADY_NAZJAR = 40586,
NPC_SUMMONED_WITCH = 40634, // 2 of them
NPC_SUMMONED_GUARD = 40633,
NPC_SUMMONED_WATERSPOUT = 48571,
// Commander Ulthok
BOSS_COMMANDER_ULTHOK = 40765,
NPC_DARK_FISSURE = 40784,
// Erunak Stonespeaker & Mindbender Ghur'sha
BOSS_ERUNAK_STONESPEAKER = 40825,
BOSS_MINDBENDER_GHURSHA = 40788,
NPC_EARTH_SHARD = 45469,
NPC_MIND_FOG = 40861,
// Ozumat
BOSS_OZUMAT = 42172,
BOSS_NEPTULON = 40792,
NPC_DEEP_MURLOC = 44658,
NPC_MINDLASHER = 44715,
NPC_BEHEMOTH = 44648,
NPC_SAPPER = 44752,
NPC_BEAST = 44841,
// GOs
GO_LADY_NAZJAR_DOOR = 204338,
GO_JELLYFISH_ELEVATOR = 207209,
GO_COMMANDER_ULTHOK_DOOR = 204339,
GO_ERUNAK_STONESPEAKER_DOOR = 204340,
GO_OZUMAT_DOOR = 204341,
GO_OZUMAT_CHEST_NORMAL = 205216,
GO_OZUMAT_CHEST_HEROIC = 320000,
};
enum Data
{
DATA_LADY_NAZJAR_EVENT = 0,
DATA_COMMANDER_ULTHOK_EVENT = 1,
DATA_ERUNAK_STONESPEAKER_EVENT = 2,
DATA_OZUMAT_EVENT = 3
};
#define MAX_ENCOUNTER 4
enum Data64
{
DATA_LADY_NAZJAR,
DATA_COMMANDER_ULTHOK,
DATA_ERUNAK_STONESPEAKER,
DATA_OZUMAT,
DATA_NEPTULON,
};
#endif
|
// rippit - A no-nonsense program to rip audio CDs
//
// Copyright (C) 2011 Trever Fischer <tdfischer@fedoraproject.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 <glib.h>
#include <gst/gstinfo.h>
#include "rippitversion.h"
GST_DEBUG_CATEGORY_STATIC(rippit);
#define GST_CAT_DEFAULT rippit
#define RIPPIT_ERROR rippit_error_quark ()
#define RIPPIT_ERROR_PARAMS 1
GQuark rippit_error_quark();
|
#ifndef __ASM_SH_PCI_H
#define __ASM_SH_PCI_H
#ifdef __KERNEL__
#include <linux/dma-mapping.h>
/* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
#define pcibios_assign_all_busses() 1
#define pcibios_scan_all_fns(a, b) 0
/*
* A board can define one or more PCI channels that represent built-in (or
* external) PCI controllers.
*/
struct pci_channel {
struct pci_ops *pci_ops;
struct resource *io_resource;
struct resource *mem_resource;
int first_devfn;
int last_devfn;
};
/*
* Each board initializes this array and terminates it with a NULL entry.
*/
extern struct pci_channel board_pci_channels[];
#define PCIBIOS_MIN_IO board_pci_channels->io_resource->start
#define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start
/*
* I/O routine helpers
*/
#ifndef CONFIG_CPU_SUBTYPE_ST40
#if defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785)
#define PCI_IO_AREA 0xFE400000
#define PCI_IO_SIZE 0x00400000
#else
#define PCI_IO_AREA 0xFE240000
#define PCI_IO_SIZE 0X00040000
#endif
#define PCI_MEM_SIZE 0x01000000
#define SH4_PCIIOBR_MASK 0xFFFC0000
#define pci_ioaddr(addr) (PCI_IO_AREA + (addr & ~SH4_PCIIOBR_MASK))
#endif
#if defined(CONFIG_PCI) && defined(PCI_IO_SIZE)
#define is_pci_ioaddr(port) \
(((port) >= PCIBIOS_MIN_IO) && \
((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE)))
#define is_pci_memaddr(port) \
(((port) >= PCIBIOS_MIN_MEM) && \
((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE)))
#else
#define is_pci_ioaddr(port) (0)
#define is_pci_memaddr(port) (0)
#endif
struct pci_dev;
extern void pcibios_set_master(struct pci_dev *dev);
static inline void pcibios_penalize_isa_irq(int irq, int active)
{
/* We don't do dynamic PCI IRQ allocation */
}
/* Dynamic DMA mapping stuff.
* SuperH has everything mapped statically like x86.
*/
/* The PCI address space does equal the physical memory
* address space. The networking and block device layers use
* this boolean for bounce buffer decisions.
*/
#define PCI_DMA_BUS_IS_PHYS (1)
#include <linux/types.h>
#include <linux/slab.h>
#include <asm/scatterlist.h>
#include <linux/string.h>
#include <asm/io.h>
/* pci_unmap_{single,page} being a nop depends upon the
* configuration.
*/
#ifdef CONFIG_SH_PCIDMA_NONCOHERENT
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
dma_addr_t ADDR_NAME;
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
__u32 LEN_NAME;
#define pci_unmap_addr(PTR, ADDR_NAME) \
((PTR)->ADDR_NAME)
#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
(((PTR)->ADDR_NAME) = (VAL))
#define pci_unmap_len(PTR, LEN_NAME) \
((PTR)->LEN_NAME)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
(((PTR)->LEN_NAME) = (VAL))
#else
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
#define pci_unmap_addr(PTR, ADDR_NAME) (0)
#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
#define pci_unmap_len(PTR, LEN_NAME) (0)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
#endif
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
unsigned long *strategy_parameter)
{
*strat = PCI_DMA_BURST_INFINITY;
*strategy_parameter = ~0UL;
}
#endif
/* Board-specific fixup routines. */
// void pcibios_fixup(void); is this still needed? SIM
int pcibios_init_platform(void);
int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
#ifdef CONFIG_PCI_AUTO
int pciauto_assign_resources(int busno, struct pci_channel *hose);
#endif
#endif /* __KERNEL__ */
/* generic pci stuff */
#include <asm-generic/pci.h>
/* generic DMA-mapping stuff */
#include <asm-generic/pci-dma-compat.h>
#endif /* __ASM_SH_PCI_H */
|
#ifndef MYHEADER_H
#define MYHEADER_H
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
typedef struct {
char* requestRaw;
} HTTPRequest;
//needs to be called before working with the webcore
int initWebcore();
int registerApplication(int (*function)(HTTPRequest) );
#endif
|
/***************************************************************************
* Copyright (C) 2005 by Joris Guisson *
* joris.guisson@gmail.com *
* ivasic@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef ANTIP2P_H
#define ANTIP2P_H
#include <QVector>
#include <util/constants.h>
#include <interfaces/blocklistinterface.h>
namespace kt
{
struct IPBlock
{
bt::Uint32 ip1;
bt::Uint32 ip2;
IPBlock();
IPBlock(const IPBlock& block);
IPBlock(const QString& start, const QString& end);
bool constains(bt::Uint32 ip) const
{
return ip1 <= ip && ip <= ip2;
}
};
/**
* @author Ivan Vasic <ivasic@gmail.com>
* @brief This class is used to manage anti-p2p filter list, so called level1.
*/
class IPBlockList : public bt::BlockListInterface
{
public:
IPBlockList();
virtual ~IPBlockList();
virtual bool blocked(const net::Address& addr) const;
/**
* Overloaded function. Uses Uint32 IP to be checked
**/
bool isBlockedIP(bt::Uint32 ip);
/**
* Loads filter file
* @param path The file to load
* @return true upon success, false otherwise
*/
bool load(const QString & path);
/**
* Add a single block
* @param block
*/
void addBlock(const IPBlock & block);
private:
QVector<IPBlock> blocks;
};
}
#endif
|
/* FluidSynth - A Software Synthesizer
*
* Copyright (C) 2003 Peter Hanappe and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*/
#ifndef _FLUID_RVOICE_MIXER_H
#define _FLUID_RVOICE_MIXER_H
#include "fluidsynth_priv.h"
#include "fluid_rvoice.h"
//#include "fluid_ladspa.h"
typedef struct _fluid_rvoice_mixer_t fluid_rvoice_mixer_t;
#define FLUID_MIXER_MAX_BUFFERS_DEFAULT (8192/FLUID_BUFSIZE)
void fluid_rvoice_mixer_set_finished_voices_callback(
fluid_rvoice_mixer_t* mixer,
void (*func)(void*, fluid_rvoice_t*),
void* userdata);
int fluid_rvoice_mixer_render(fluid_rvoice_mixer_t* mixer, int blockcount);
int fluid_rvoice_mixer_get_bufs(fluid_rvoice_mixer_t* mixer,
fluid_real_t*** left, fluid_real_t*** right);
fluid_rvoice_mixer_t* new_fluid_rvoice_mixer(int buf_count, int fx_buf_count,
fluid_real_t sample_rate);
void delete_fluid_rvoice_mixer(fluid_rvoice_mixer_t*);
void fluid_rvoice_mixer_set_samplerate(fluid_rvoice_mixer_t* mixer, fluid_real_t samplerate);
void fluid_rvoice_mixer_set_reverb_enabled(fluid_rvoice_mixer_t* mixer, int on);
void fluid_rvoice_mixer_set_chorus_enabled(fluid_rvoice_mixer_t* mixer, int on);
void fluid_rvoice_mixer_set_mix_fx(fluid_rvoice_mixer_t* mixer, int on);
int fluid_rvoice_mixer_set_polyphony(fluid_rvoice_mixer_t* handler, int value);
int fluid_rvoice_mixer_add_voice(fluid_rvoice_mixer_t* mixer, fluid_rvoice_t* voice);
void fluid_rvoice_mixer_set_chorus_params(fluid_rvoice_mixer_t* mixer, int set,
int nr, double level, double speed,
double depth_ms, int type);
void fluid_rvoice_mixer_set_reverb_params(fluid_rvoice_mixer_t* mixer, int set,
double roomsize, double damping,
double width, double level);
void fluid_rvoice_mixer_reset_fx(fluid_rvoice_mixer_t* mixer);
void fluid_rvoice_mixer_reset_reverb(fluid_rvoice_mixer_t* mixer);
void fluid_rvoice_mixer_reset_chorus(fluid_rvoice_mixer_t* mixer);
void fluid_rvoice_mixer_set_threads(fluid_rvoice_mixer_t* mixer, int thread_count,
int prio_level);
#ifdef LADSPA
void fluid_rvoice_mixer_set_ladspa(fluid_rvoice_mixer_t* mixer,
fluid_LADSPA_FxUnit_t* ladspa);
#endif
#endif
|
// 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 CHROME_BROWSER_NET_PRECONNECT_H_
#define CHROME_BROWSER_NET_PRECONNECT_H_
#include "chrome/browser/net/url_info.h"
class GURL;
namespace net {
class URLRequestContextGetter;
}
namespace chrome_browser_net {
void PreconnectOnUIThread(const GURL& url,
const GURL& first_party_for_cookies,
UrlInfo::ResolutionMotivation motivation,
int count,
net::URLRequestContextGetter* getter);
void PreconnectOnIOThread(const GURL& url,
const GURL& first_party_for_cookies,
UrlInfo::ResolutionMotivation motivation,
int count,
net::URLRequestContextGetter* getter);
}
#endif
|
/***************************************************************************
* $Id$
*
* Copyright 2004 Gagarine Yaikhom
* gyaikhom@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 Library 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.
*/
/* Adapted from LAM-MPI implementation. */
#include <stdio.h>
#include <math.h>
#include <mpi.h>
/* Number of estimations. */
#define NUM_ITER 1000
int main(int argc, char *argv[])
{
int iter, rank, size, i;
double PI25DT = 3.141592653589793238462643;
double mypi, pi, h, sum, x;
double startwtime = 0.0, endwtime;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
for (iter = 2; iter < NUM_ITER; ++iter) {
h = 1.0 / (double) iter;
sum = 0.0;
startwtime = MPI_Wtime();
for (i = rank + 1; i <= iter; i += size) {
x = h * ((double) i - 0.5);
sum += 4.0 / (1.0 + x * x);
}
mypi = h * sum;
MPI_Reduce(&mypi, &pi, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
if (rank == 0) {
printf("%d points: PI is approximately %.16f, error = %.16f\n",
iter, pi, fabs(pi - PI25DT));
endwtime = MPI_Wtime();
printf("[%d] Wall clock time = %f\n", rank, endwtime - startwtime);
fflush(stdout);
} else {
endwtime = MPI_Wtime();
printf("[%d] Wall clock time = %f\n", rank, endwtime - startwtime);
}
}
MPI_Finalize();
return 0;
}
|
extern mouse_t mouse_serial_msystems;
|
#ifndef __BUSQUEDA__
#define __BUSQUEDA__
#include <stdio.h>
#include "Evalua.h"
int evalua_variante(Tablero tab,Variante var);
int exp_j_cj(Tablero tab,Variantes var,Jugador jug);
int maxima(Variantes variantes);
int movimiento_variantes(Tablero tab,Variantes variantes,Jugador jugador)
/*
En entrada:El tablero y un vector para guardar las variantes posibles en una jugada
En salida: Devuelve vector variantes que dara los movimientos posibles
para el jugador y el numero de variantes*/
/*no modifica el tablero*/
{
int xini,yini,xfin,yfin,numvar;
Movimiento mov_valido;
Pieza pieza;
mov_valido.jugador=jugador;
numvar=0;
/*Buscar todas las posibles jugadas válidas para el jugador descartando
las imposibles por medio de la funcion validar_movimiento*/
for(xini=1;xini<=8;xini++)
for(yini=1;yini<=8;yini++)
{
mov_valido.posini.posx=xini;
mov_valido.posini.posy=yini;
if(tab[xini][yini].pieza.color==jugador)
for(xfin=1;xfin<=8;xfin++)
for(yfin=1;yfin<=8;yfin++)
{
if(tab[xfin][yfin].pieza.color==jugador)
yfin++;
mov_valido.posfin.posx=xfin;
mov_valido.posfin.posy=yfin;
if(validar_movimiento(tab,mov_valido))
{
variantes[numvar].jugador=jugador;
variantes[numvar].posini.posx=xini;
variantes[numvar].posini.posy=yini;
variantes[numvar].posfin.posx=xfin;
variantes[numvar].posfin.posy=yfin;
variantes[numvar].piezini.clase=tab[xini][yini].pieza.clase;
variantes[numvar].piezini.color=tab[xini][yini].pieza.color;
variantes[numvar].piezfin.clase=tab[xfin][yfin].pieza.clase;
variantes[numvar].piezfin.color=tab[xfin][yfin].pieza.color;
numvar++;
}
}
}
variantes[numvar].piezini.clase=vacio; /*indica final del vector variantes*/
return numvar;
}
int asigna_valor_variantes(Tablero tab,Variantes vars)
/*En entrada: Vector variantes actualizado con la funcion
movimiento_variantes
En salida: Vector variantes actualizado su valor por la funcion
evaluar_variante*/
/*Usa la funcion 'evalua_variante'*/
{
int i;
i=0;
while(i<MAX && vars[i].piezini.clase!=vacio)
{
vars[i].valor=evalua_variante(tab,vars[i]);
i++;
}
vars[i].piezini.clase=vacio;
}
int numero_variantes_pieza(Pieza pieza,Variantes variantes)
/*En entrada: Clase de pieza y las posibles variantes
En salida: Variantes de las piezas en concreto y numero de variantes
Devolviendo 0 si la pieza esta bloqueada*/
{
int i,r;
r=i=0;
while(i<MAX && variantes[i].piezini.clase!=vacio)
{
if(variantes[i].piezini.clase==pieza.clase)
r++;
i++;
}
return r;
}
int lugar_variante_maximo(Variantes variantes)
/*En entrada: Variantes
En salida: Devuelve el lugar del maximo*/
{
int i,lug,maximo;
i=0;
maximo=maxima(variantes);
while(i<MAX && variantes[i].piezini.clase!=vacio)
{if(variantes[i].valor==maximo)lug=i;
i++;
}
return lug;
}
int maxima(Variantes variantes)
/*En entrada: Variantes
En salida: Devuelve el valor maximo de la variante del vector*/
{
int i,max;
max=variantes[0].valor;
i=0;
while(i<MAX && variantes[i].piezini.clase!=vacio)
{
if(variantes[i].valor>=max)
max=variantes[i].valor;
i++;
}
return max;
}
int informe_variantes(Variantes variantes)
{
int xini,yini,xfin,yfin,i;
int marcas[MAX];
Pieza pieza;
Movimiento mov;
mov.jugador=variantes[0].jugador;
i=0;
while(variantes[i].piezini.clase!=vacio )
{xini=variantes[i].posini.posx;
yini=variantes[i].posini.posy;
xfin=variantes[i].posfin.posx;
yfin=variantes[i].posfin.posy;
mov.posini.posx=xini;mov.posini.posy=yini;
mov.posfin.posx=xfin;mov.posfin.posy=yfin;
pieza.clase=variantes[i].piezini.clase;
printf("$%d$",i);
printf("(%s)",TipoPiezasBlancas[pieza.clase]);
printf("(%d)",variantes[i].valor);
printf("<%d%d-%d%d>",xini,yini,xfin,yfin);
i++;}
return 0;
}
int exploracion_basica(Tablero tab,Variantes var,Jugador jug)
/*En entrada: El tablero con la variante y el jugador
En salida : Devuelve el numero de variante decidida por el
criterio de la función exp_j_cj*/
{
movimiento_variantes(tab,var,jug);
asigna_valor_variantes(tab,var);
return exp_j_cj(tab,var,jug);
}
int exp_j_cj(Tablero tab,Variantes var,Jugador jug)
/*En entrada: Un tablero, jugador, conjunto de variantes iniciales de jugador
para el tablero ¡YA! calculadas con sus valores iniciales
En salida: Devuelve el nodo_padre mejor siguiendo el criterio
jugada, contrajugada con el puntaje de 'evalua'
no modifica tab ni var.*/
{
int i,j,bonus,maximo,nodo_padre,trayec;
Tablero tab1;
Variantes var1;
Jugador jug_contra;
if(jug==blanco)
jug_contra=negro;
else
jug_contra=blanco;
maximo=-INFINITO;
/*Examinamos todos los nodos padre*/
trayec=0;
printf("\nPensando:");
while(trayec<MAX && var[trayec].piezini.clase!=vacio )
{
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
tab1[i][j]=tab[i][j];/*copia de tab*/
bonus=var[trayec].valor; /*JUGADOR_BONUS0*/
actualizar1(tab1,var[trayec]);
movimiento_variantes(tab1,var1,jug_contra); /*CONTRARIO_VARIANTES1*/
asigna_valor_variantes(tab1,var1);
bonus=bonus-maxima(var1); /*CONTRARIO_BONUS1*/
if(maximo<=bonus)
{
maximo=bonus;
nodo_padre=trayec;
}
trayec++;
printf(".");
}
return nodo_padre;
}
#endif
|
/******************************************************************************
* drivers/xen/tpmback/common.h
*/
#ifndef __TPM__BACKEND__COMMON_H__
#define __TPM__BACKEND__COMMON_H__
#include <linux/version.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <xen/evtchn.h>
#include <xen/driver_util.h>
#include <xen/interface/grant_table.h>
#include <xen/interface/io/tpmif.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#define DPRINTK(_f, _a...) \
pr_debug("(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
struct backend_info;
typedef struct tpmif_st {
struct list_head tpmif_list;
/* Unique identifier for this interface. */
domid_t domid;
unsigned int handle;
/* Physical parameters of the comms window. */
unsigned int irq;
/* The shared rings and indexes. */
tpmif_tx_interface_t *tx;
struct vm_struct *tx_area;
/* Miscellaneous private stuff. */
enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
int active;
struct tpmif_st *hash_next;
struct list_head list; /* scheduling list */
atomic_t refcnt;
struct backend_info *bi;
grant_handle_t shmem_handle;
grant_ref_t shmem_ref;
struct page **mmap_pages;
char devname[20];
} tpmif_t;
void tpmif_disconnect_complete(tpmif_t * tpmif);
tpmif_t *tpmif_find(domid_t domid, struct backend_info *bi);
void tpmif_interface_init(void);
void tpmif_interface_exit(void);
void tpmif_schedule_work(tpmif_t * tpmif);
void tpmif_deschedule_work(tpmif_t * tpmif);
void tpmif_xenbus_init(void);
void tpmif_xenbus_exit(void);
int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
long int tpmback_get_instance(struct backend_info *bi);
int vtpm_release_packets(tpmif_t * tpmif, int send_msgs);
#define tpmif_get(_b) (atomic_inc(&(_b)->refcnt))
#define tpmif_put(_b) \
do { \
if (atomic_dec_and_test(&(_b)->refcnt)) \
tpmif_disconnect_complete(_b); \
} while (0)
extern int num_frontends;
static inline unsigned long idx_to_kaddr(tpmif_t *t, unsigned int idx)
{
return (unsigned long)pfn_to_kaddr(page_to_pfn(t->mmap_pages[idx]));
}
#endif /* __TPMIF__BACKEND__COMMON_H__ */
|
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CXX11_TENSOR_TENSOR_META_H
#define EIGEN_CXX11_TENSOR_TENSOR_META_H
namespace Eigen {
template<bool cond> struct Cond {};
template<typename T1, typename T2> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
const T1& choose(Cond<true>, const T1& first, const T2&) {
return first;
}
template<typename T1, typename T2> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
const T2& choose(Cond<false>, const T1&, const T2& second) {
return second;
}
template <size_t n> struct max_n_1 {
static const size_t size = n;
};
template <> struct max_n_1<0> {
static const size_t size = 1;
};
// Default packet types
template <typename Scalar, typename Device>
struct PacketType {
typedef typename internal::packet_traits<Scalar>::type type;
static const int size = internal::unpacket_traits<type>::size;
};
// For CUDA packet types when using a GpuDevice
#if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
template <>
struct PacketType<float, GpuDevice> {
typedef float4 type;
static const int size = 4;
};
template <>
struct PacketType<double, GpuDevice> {
typedef double2 type;
static const int size = 2;
};
#endif
// Tuple mimics std::pair but works on e.g. nvcc.
template <typename U, typename V> struct Tuple {
public:
U first;
V second;
typedef U first_type;
typedef V second_type;
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Tuple() : first(), second() {}
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Tuple(const U& f, const V& s) : first(f), second(s) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Tuple& operator= (const Tuple& rhs) {
if (&rhs == this) return *this;
first = rhs.first;
second = rhs.second;
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(Tuple& rhs) {
using numext::swap;
swap(first, rhs.first);
swap(second, rhs.second);
}
};
template <typename U, typename V>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator==(const Tuple<U, V>& x, const Tuple<U, V>& y) {
return (x.first == y.first && x.second == y.second);
}
template <typename U, typename V>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator!=(const Tuple<U, V>& x, const Tuple<U, V>& y) {
return !(x == y);
}
#ifdef EIGEN_HAS_SFINAE
namespace internal{
template<typename IndexType, Index... Is>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
array<Index, sizeof...(Is)> customIndices2Array(IndexType& idx, numeric_list<Index, Is...>) {
return { idx[Is]... };
}
/** Make an array (for index/dimensions) out of a custom index */
template<typename Index, int NumIndices, typename IndexType>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
array<Index, NumIndices> customIndices2Array(IndexType& idx) {
return customIndices2Array(idx, typename gen_numeric_list<Index, NumIndices>::type{});
}
template <typename B, typename D>
struct is_base_of
{
typedef char (&yes)[1];
typedef char (&no)[2];
template <typename BB, typename DD>
struct Host
{
operator BB*() const;
operator DD*();
};
template<typename T>
static yes check(D*, T);
static no check(B*, int);
static const bool value = sizeof(check(Host<B,D>(), int())) == sizeof(yes);
};
}
#endif
} // namespace Eigen
#endif // EIGEN_CXX11_TENSOR_TENSOR_META_H
|
#include "kvm/virtio-console.h"
#include "kvm/virtio-pci-dev.h"
#include "kvm/disk-image.h"
#include "kvm/virtio.h"
#include "kvm/ioport.h"
#include "kvm/util.h"
#include "kvm/term.h"
#include "kvm/mutex.h"
#include "kvm/kvm.h"
#include "kvm/pci.h"
#include "kvm/threadpool.h"
#include "kvm/irq.h"
#include "kvm/guest_compat.h"
#include <linux/virtio_console.h>
#include <linux/virtio_ring.h>
#include <linux/virtio_blk.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#define VIRTIO_CONSOLE_QUEUE_SIZE 128
#define VIRTIO_CONSOLE_NUM_QUEUES 2
#define VIRTIO_CONSOLE_RX_QUEUE 0
#define VIRTIO_CONSOLE_TX_QUEUE 1
struct con_dev {
struct mutex mutex;
struct virtio_device vdev;
struct virt_queue vqs[VIRTIO_CONSOLE_NUM_QUEUES];
struct virtio_console_config config;
u32 features;
pthread_cond_t poll_cond;
int vq_ready;
struct thread_pool__job jobs[VIRTIO_CONSOLE_NUM_QUEUES];
};
static struct con_dev cdev = {
.mutex = MUTEX_INITIALIZER,
.vq_ready = 0,
.config = {
.cols = 80,
.rows = 24,
.max_nr_ports = 1,
},
};
static int compat_id = -1;
/*
* Interrupts are injected for hvc0 only.
*/
static void virtio_console__inject_interrupt_callback(struct kvm *kvm, void *param)
{
struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
struct virt_queue *vq;
u16 out, in;
u16 head;
int len;
if (kvm->cfg.active_console != CONSOLE_VIRTIO)
return;
mutex_lock(&cdev.mutex);
vq = param;
if (!cdev.vq_ready)
pthread_cond_wait(&cdev.poll_cond, &cdev.mutex.mutex);
if (term_readable(0) && virt_queue__available(vq)) {
head = virt_queue__get_iov(vq, iov, &out, &in, kvm);
len = term_getc_iov(kvm, iov, in, 0);
virt_queue__set_used_elem(vq, head, len);
cdev.vdev.ops->signal_vq(kvm, &cdev.vdev, vq - cdev.vqs);
}
mutex_unlock(&cdev.mutex);
}
void virtio_console__inject_interrupt(struct kvm *kvm)
{
virtio_console__inject_interrupt_callback(kvm,
&cdev.vqs[VIRTIO_CONSOLE_RX_QUEUE]);
}
static void virtio_console_handle_callback(struct kvm *kvm, void *param)
{
struct iovec iov[VIRTIO_CONSOLE_QUEUE_SIZE];
struct virt_queue *vq;
u16 out, in;
u16 head;
u32 len;
vq = param;
/*
* The current Linux implementation polls for the buffer
* to be used, rather than waiting for an interrupt.
* So there is no need to inject an interrupt for the tx path.
*/
while (virt_queue__available(vq)) {
head = virt_queue__get_iov(vq, iov, &out, &in, kvm);
len = term_putc_iov(iov, out, 0);
virt_queue__set_used_elem(vq, head, len);
}
}
static u8 *get_config(struct kvm *kvm, void *dev)
{
struct con_dev *cdev = dev;
return ((u8 *)(&cdev->config));
}
static u32 get_host_features(struct kvm *kvm, void *dev)
{
return 0;
}
static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
{
/* Unused */
}
static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align,
u32 pfn)
{
struct virt_queue *queue;
void *p;
BUG_ON(vq >= VIRTIO_CONSOLE_NUM_QUEUES);
compat__remove_message(compat_id);
queue = &cdev.vqs[vq];
queue->pfn = pfn;
p = virtio_get_vq(kvm, queue->pfn, page_size);
vring_init(&queue->vring, VIRTIO_CONSOLE_QUEUE_SIZE, p, align);
if (vq == VIRTIO_CONSOLE_TX_QUEUE) {
thread_pool__init_job(&cdev.jobs[vq], kvm, virtio_console_handle_callback, queue);
} else if (vq == VIRTIO_CONSOLE_RX_QUEUE) {
thread_pool__init_job(&cdev.jobs[vq], kvm, virtio_console__inject_interrupt_callback, queue);
/* Tell the waiting poll thread that we're ready to go */
mutex_lock(&cdev.mutex);
cdev.vq_ready = 1;
pthread_cond_signal(&cdev.poll_cond);
mutex_unlock(&cdev.mutex);
}
return 0;
}
static int notify_vq(struct kvm *kvm, void *dev, u32 vq)
{
struct con_dev *cdev = dev;
thread_pool__do_job(&cdev->jobs[vq]);
return 0;
}
static int get_pfn_vq(struct kvm *kvm, void *dev, u32 vq)
{
struct con_dev *cdev = dev;
return cdev->vqs[vq].pfn;
}
static int get_size_vq(struct kvm *kvm, void *dev, u32 vq)
{
return VIRTIO_CONSOLE_QUEUE_SIZE;
}
static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
{
/* FIXME: dynamic */
return size;
}
static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) {
.get_config = get_config,
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
.init_vq = init_vq,
.notify_vq = notify_vq,
.get_pfn_vq = get_pfn_vq,
.get_size_vq = get_size_vq,
.set_size_vq = set_size_vq,
};
int virtio_console__init(struct kvm *kvm)
{
if (kvm->cfg.active_console != CONSOLE_VIRTIO)
return 0;
pthread_cond_init(&cdev.poll_cond, NULL);
virtio_init(kvm, &cdev, &cdev.vdev, &con_dev_virtio_ops,
VIRTIO_DEFAULT_TRANS(kvm), PCI_DEVICE_ID_VIRTIO_CONSOLE,
VIRTIO_ID_CONSOLE, PCI_CLASS_CONSOLE);
if (compat_id == -1)
compat_id = virtio_compat_add_message("virtio-console", "CONFIG_VIRTIO_CONSOLE");
return 0;
}
virtio_dev_init(virtio_console__init);
int virtio_console__exit(struct kvm *kvm)
{
return 0;
}
virtio_dev_exit(virtio_console__exit);
|
/*
* ----------------------------------------------------------------
* Copyright c Realtek Semiconductor Corporation, 2002
* All rights reserved.
*
* $Header: /cvs/sw/linux-2.4.x/drivers/net/re865x/rtl865x/Attic/asicTabs.h,v 1.1.2.1 2007/09/28 14:42:31 davidm Exp $
*
* Abstract: ASIC table field definitions.
*
* $Author: davidm $
*
* $Log: asicTabs.h,v $
* Revision 1.1.2.1 2007/09/28 14:42:31 davidm
* #12420
*
* Pull in all the appropriate networking files for the RTL8650, try to
* clean it up a best as possible so that the files for the build are not
* all over the tree. Still lots of crazy dependencies in there though.
*
* Revision 1.2 2006/07/03 03:05:03 chenyl
* *: convert files from DOS format to UNIX format
*
* Revision 1.1 2004/02/25 14:26:33 chhuang
* *** empty log message ***
*
* Revision 1.1 2004/02/16 01:50:49 chhuang
* *** empty log message ***
*
* Revision 1.2 2004/01/08 07:47:10 cfliu
* update wiith new data structure definition.
*
* Revision 1.1 2003/12/30 14:16:23 cfliu
* initial version
*
* Revision 1.1 2003/12/26 05:26:40 chhuang
* init
*
* Revision 1.13 2003/12/19 01:20:13 danwu
* little endian definitions for acl, next hop, rate limit tables
*
* Revision 1.12 2003/12/18 02:30:56 danwu
* define _LITTLE_ENDIAN for Veri plateform
*
* Revision 1.11 2003/10/27 06:54:38 danwu
* no message
*
* Revision 1.10 2003/10/21 02:53:09 danwu
* update pktOpApp
*
* Revision 1.9 2003/09/23 09:55:17 danwu
* update ACL table structure for 51B
*
* Revision 1.8 2003/09/03 09:22:07 danwu
* modify for 51b
*
* Revision 1.7 2003/08/26 09:56:31 cfliu
* no message
*
* Revision 1.6 2003/08/12 09:57:10 danwu
* no message
*
* Revision 1.5 2003/08/12 06:47:18 danwu
* to ensure backward compatibility, every table structure is extended to eight
* words, and unused bits must be cleared before setting
*
* Revision 1.4 2003/08/11 14:53:20 cfliu
* add col2 bit for Hash2 collision
*
* Revision 1.3 2003/07/16 06:47:43 cfliu
* no message
*
* Revision 1.2 2003/06/17 12:09:53 cfliu
* no message
*
* Revision 1.1 2003/06/16 03:41:01 danwu
* init
*
* ---------------------------------------------------------------
*/
#ifndef _ASICTABS_H
#define _ASICTABS_H
#endif /*_ASICTABS_H*/
|
/*
* Copyright (c) 2006 Franck Bui-Huu
* Copyright (c) 2006 Rene Scharfe
*/
#include "cache.h"
#include "builtin.h"
#include "archive.h"
#include "pkt-line.h"
#include "sideband.h"
static int run_remote_archiver(const char *remote, int argc,
const char **argv)
{
char *url, buf[LARGE_PACKET_MAX];
int fd[2], i, len, rv;
struct child_process *conn;
const char *exec = "git-upload-archive";
int exec_at = 0, exec_value_at = 0;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!prefixcmp(arg, "--exec=")) {
if (exec_at)
die("multiple --exec specified");
exec = arg + 7;
exec_at = i;
} else if (!strcmp(arg, "--exec")) {
if (exec_at)
die("multiple --exec specified");
if (i + 1 >= argc)
die("option --exec requires a value");
exec = argv[i + 1];
exec_at = i;
exec_value_at = ++i;
}
}
url = xstrdup(remote);
conn = git_connect(fd, url, exec, 0);
for (i = 1; i < argc; i++) {
if (i == exec_at || i == exec_value_at)
continue;
packet_write(fd[1], "argument %s\n", argv[i]);
}
packet_flush(fd[1]);
len = packet_read_line(fd[0], buf, sizeof(buf));
if (!len)
die("git-archive: expected ACK/NAK, got EOF");
if (buf[len-1] == '\n')
buf[--len] = 0;
if (strcmp(buf, "ACK")) {
if (len > 5 && !prefixcmp(buf, "NACK "))
die("git-archive: NACK %s", buf + 5);
die("git-archive: protocol error");
}
len = packet_read_line(fd[0], buf, sizeof(buf));
if (len)
die("git-archive: expected a flush");
/* Now, start reading from fd[0] and spit it out to stdout */
rv = recv_sideband("archive", fd[0], 1, 2);
close(fd[0]);
close(fd[1]);
rv |= finish_connect(conn);
return !!rv;
}
static const char *extract_remote_arg(int *ac, const char **av)
{
int ix, iy, cnt = *ac;
int no_more_options = 0;
const char *remote = NULL;
for (ix = iy = 1; ix < cnt; ix++) {
const char *arg = av[ix];
if (!strcmp(arg, "--"))
no_more_options = 1;
if (!no_more_options) {
if (!prefixcmp(arg, "--remote=")) {
if (remote)
die("Multiple --remote specified");
remote = arg + 9;
continue;
} else if (!strcmp(arg, "--remote")) {
if (remote)
die("Multiple --remote specified");
if (++ix >= cnt)
die("option --remote requires a value");
remote = av[ix];
continue;
}
if (arg[0] != '-')
no_more_options = 1;
}
if (ix != iy)
av[iy] = arg;
iy++;
}
if (remote) {
av[--cnt] = NULL;
*ac = cnt;
}
return remote;
}
int cmd_archive(int argc, const char **argv, const char *prefix)
{
const char *remote = NULL;
remote = extract_remote_arg(&argc, argv);
if (remote)
return run_remote_archiver(remote, argc, argv);
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
return write_archive(argc, argv, prefix, 1);
}
|
/*
* Copyright (C) 1996-2015 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#ifndef __ASYNC_IO_H__
#define __ASYNC_IO_H__
#if HAVE_DISKIO_MODULE_AIO
#if _SQUID_WINDOWS_
#include "DiskIO/AIO/aio_win32.h"
#else
#if HAVE_AIO_H
#include <aio.h>
#endif
#endif
#include "mem/forward.h"
#define MAX_ASYNCOP 128
typedef enum {
AQ_STATE_NONE, /* Not active/uninitialised */
AQ_STATE_SETUP /* Initialised */
} async_queue_state_t;
typedef enum {
AQ_ENTRY_FREE,
AQ_ENTRY_USED
} async_queue_entry_state_t;
typedef enum {
AQ_ENTRY_NONE,
AQ_ENTRY_READ,
AQ_ENTRY_WRITE
} async_queue_entry_type_t;
typedef struct _async_queue_entry async_queue_entry_t;
typedef struct _async_queue async_queue_t;
/* An async queue entry */
class AIODiskFile;
struct _async_queue_entry {
async_queue_entry_state_t aq_e_state;
async_queue_entry_type_t aq_e_type;
/* 64-bit environments with non-GCC complain about the type mismatch on Linux */
#if defined(__USE_FILE_OFFSET64) && !defined(__GNUC__)
struct aiocb64 aq_e_aiocb;
#else
struct aiocb aq_e_aiocb;
#endif
AIODiskFile *theFile;
void *aq_e_callback_data;
FREE *aq_e_free;
int aq_e_fd;
void *aq_e_buf;
};
/* An async queue */
struct _async_queue {
async_queue_state_t aq_state;
async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */
int aq_numpending; /* Num of pending ops */
};
#endif /* HAVE_DISKIO_MODULE_AIO */
#endif /* __ASYNC_IO_H_ */
|
/****************************************************************************
* Copyright (C) 2012 by Jens Nissen jens-chessx@gmx.net *
****************************************************************************/
#ifndef HELPBROWSER_H
#define HELPBROWSER_H
#include <QTextBrowser>
class HelpBrowser : public QTextBrowser
{
Q_OBJECT
public:
explicit HelpBrowser(QWidget *parent = 0);
void SetStartPage();
signals:
void linkTargets(const QStringList& texts, const QStringList& links);
public slots:
private slots:
void slotSourceChanged(const QUrl &url);
};
#endif // HELPBROWSER_H
|
/******************************************************************************
CRYSTALPALACE - Episode specific code
*******************************************************************************/
#include "g_local.h"
#include "voice_punk.h"
#include "voice_bitch.h"
void ProcessKingpin (edict_t *self, edict_t *other);
void misc_cp_afraid_think (edict_t *self);
qboolean EP_CrystalPalace_CastSight ( edict_t *self, edict_t *other, cast_memory_t *mem )
{
return false;
}
qboolean EP_CrystalPalace_CastUse (edict_t *self, edict_t *other, edict_t *activator)
{
return false;
}
qboolean EP_CrystalPalace_EventSpeech (edict_t *self, edict_t *other, int saywhat)
{
cast_memory_t *mem;
mem = level.global_cast_memory[ self->character_index ][ other->character_index ];
switch (saywhat)
{
case say_neutral:
if (self->name_index == NAME_KINGPIN && other->client)
{
if (!(other->episode_flags & EP_CP_KINGPIN_FIRSTSIGHT))
{
gi.dprintf ("there he is lets go!\n");
EP_Skidrow_Register_EPFLAG (other, EP_CP_KINGPIN_FIRSTSIGHT);
{
// need to make blunt and kingpin leave through the elevator
ProcessKingpin (self, other);
}
}
return true;
}
return false;
break;
case say_hostile:
if (self->name_index == NAME_KINGPIN)
{
if (!(other->episode_flags & EP_CP_KINGPIN_FIRSTSIGHT))
{
gi.dprintf ("there he is lets go!\n");
EP_Skidrow_Register_EPFLAG (other, EP_CP_KINGPIN_FIRSTSIGHT);
{
// need to make blunt and kingpin leave through the elevator
ProcessKingpin (self, other);
}
}
return true;
}
return false;
break;
}
return false;
}
void EP_CrystalPalace_ItemPickup ( edict_t *self, edict_t *other )
{
}
void EP_CrystalPalace_Script( edict_t *ent, char *scriptname )
{
}
int EP_CrystalPalace_HiredGuysFlags (edict_t *player, edict_t *self)
{
if (self->gender == GENDER_MALE)
Voice_Random (self, player, &hiredguy_ask[10], 4);
else
Voice_Random (self, player, &hiredgal_specific[12], 4);
return (0);
}
void EP_CrystalPalaceFlags (edict_t *self)
{
}
qboolean EP_CrystalPalace_DoKey (edict_t *self, edict_t *other)
{
return false;
}
void EP_CrystalPalace_Check_DoKey (edict_t *self, edict_t *ent)
{
}
void EP_CrystalPalace_ReachedDoKey (edict_t *self)
{
}
void EP_CrystalPalace_EndDoKey (edict_t *self)
{
}
qboolean EP_CrystalPalace_UnlockDoorFlag (edict_t *ent)
{
return false;
}
void EP_CrystalPalace_HiredGuysRegisterFlags (edict_t *ent, edict_t *other)
{
}
void ProcessKingpin (edict_t *self, edict_t *other)
{
edict_t *Blunt;
edict_t *ent = NULL;
Blunt = EP_GetCharacter (NAME_BLUNT);
if (Blunt)
{
ent = G_Find (ent, FOFS(classname), "misc_cp_afraid");
if (ent)
{
self->goal_ent = ent;
ent->cast_info.aiflags |= AI_GOAL_RUN;
ent->think = misc_cp_afraid_think;
ent->nextthink = level.time + 0.1;
self->cast_info.aiflags &= ~AI_TALK;
}
else
gi.dprintf ("Kingpin missing misc_cp_afraid marker\n");
}
// todo
// the doors to the escape elevator need to open
}
/*QUAKED misc_cp_afraid (.5 .5 1) (-16 -16 -24) (16 16 48)
used as the location mo will run to before larry and curly attack him
*/
void misc_cp_afraid_think (edict_t *self)
{
edict_t *Kingpin;
edict_t *Blunt;
vec3_t vec;
float dist;
Kingpin = EP_GetCharacter (NAME_KINGPIN);
Blunt = EP_GetCharacter (NAME_BLUNT);
if (Kingpin)
{
VectorSubtract (Kingpin->s.origin, self->s.origin, vec);
dist = VectorLength (vec);
// gi.dprintf ("dist: %5.3f\n", dist);
if (dist < 128)
{
}
else
self->nextthink = level.time + 0.1;
}
}
void SP_misc_cp_afraid (edict_t *self)
{
if (deathmatch->value)
{
G_FreeEdict(self);
return;
}
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_NOT;
VectorSet (self->mins, -16, -16, -24);
VectorSet (self->maxs, 16, 16, 48);
self->cast_info.aiflags |= AI_RUN_LIKE_HELL;
AI_Ent_droptofloor( self );
gi.linkentity (self);
}
|
/*
* cexcel - A library to read data from Excel spread sheets
*
* Copyright (C) 2007 RIKEN Japan, All rights reserved.
*
* 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
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "cole.h"
#include "libsl4.h"
#include "cexcel.h"
#include "cexcel_internal.h"
typedef struct _cexcel_file_context_t {
cexcel_file_t *file;
CEXCEL_RETTYPE ret;
void *info;
cexcel_file_func_t func;
} cexcel_file_context_t;
static cexcel_file_t *_cexcel_file_new( const char *filename );
static void _cexcel_file_func_wrapper( COLEDIRENT * cde, void *_context );
cexcel_file_t *cexcel_file_open( const char *filename )
{
cexcel_file_t *file;
COLERRNO err;
file = _cexcel_file_new( filename );
if ( file == NULL ) {
return NULL;
}
file->ole.cfs = cole_mount( sl4_file_get_path( file->file ), &err );
if ( file->ole.cfs == NULL ) {
/* not ole file */
file->ftype = CEXCEL_FTYPE_NORMAL;
if ( sl4_file_open( file->file, "rb" ) ) {
/* failed to open file */
cexcel_file_close( file );
return NULL;
}
} else {
/* ole file */
file->ftype = CEXCEL_FTYPE_OLE;
}
return file;
}
int cexcel_file_close( cexcel_file_t * file )
{
COLERRNO err;
if ( file->ole.cfs ) {
cole_umount( file->ole.cfs, &err );
}
sl4_file_delete( file->file );
free( file );
return 0;
}
CEXCEL_RETTYPE cexcel_file_parse( cexcel_file_t * file,
cexcel_file_func_t func, void *info )
{
COLERRNO err;
CEXCEL_RETTYPE ret;
cexcel_file_context_t context; /* for OLE document */
/* call functions */
switch ( file->ftype ) {
case CEXCEL_FTYPE_NORMAL:
ret = func( file, info );
break;
case CEXCEL_FTYPE_OLE:
/* initialize context */
context.file = file;
context.ret = CEXCEL_RETTYPE_SUCCESS;
context.info = info;
context.func = func;
/* try BIFF8 */
if ( cole_locate_filename
( file->ole.cfs, "/Workbook", &context, _cexcel_file_func_wrapper,
&err ) ) {
/* try BIFF5 */
if ( cole_locate_filename
( file->ole.cfs, "/Book", &context, _cexcel_file_func_wrapper,
&err ) ) {
context.ret = CEXCEL_RETTYPE_BADFILE;
}
}
ret = context.ret;
break;
case CEXCEL_FTYPE_UNDEF:
default:
ret = CEXCEL_RETTYPE_UNEXPECTED;
}
return ret;
}
static cexcel_file_t *_cexcel_file_new( const char *filename )
{
cexcel_file_t *file;
sl4_file_t *sl4file;
/* allocate memory : sl4_file_t */
sl4file = sl4_file_new( filename );
if ( sl4file == NULL ) {
return NULL;
}
/* allocate memory : excel_file_t */
file = ( cexcel_file_t * ) malloc( sizeof( cexcel_file_t ) );
if ( file == NULL ) {
sl4_file_delete( sl4file );
return NULL;
}
file->ole.cfs = NULL;
file->ole.cf = NULL;
file->file = sl4file;
file->ftype = CEXCEL_FTYPE_UNDEF;
return file;
}
static void _cexcel_file_func_wrapper( COLEDIRENT * cde, void *_context )
{
COLERRNO err;
cexcel_file_context_t *context;
cexcel_file_func_t func;
cexcel_file_t *file;
void *info;
/* dump info */
context = ( cexcel_file_context_t * ) _context;
func = context->func;
file = context->file;
info = context->info;
/* open stream */
file->ole.cf = cole_fopen_direntry( cde, &err );
if ( file->ole.cf == NULL ) {
context->ret = CEXCEL_RETTYPE_BADFILE;
return;
}
/* call user defined function */
context->ret = func( file, info );
/* close stream */
cole_fclose( file->ole.cf, &err );
}
|
/****************************************************************************
*
* CONFIDENTIAL
*
* Copyright (c) 2009 Yamaha Corporation
*
* Module : D4NP2_Ctrl_def.h
*
* Description : D-4NP2 control define
*
* Version : 1.0.2 2009.01.16
*
****************************************************************************/
/***********************************************************************/
/* Modified by */
/* (C) NEC CASIO Mobile Communications, Ltd. 2013 */
/***********************************************************************/
#if !defined(_D4NP2_CTRL_DEF_H_)
#define _D4NP2_CTRL_DEF_H_
#define PDPC 0x000100
#define PDP 0x000201
#define PD_CHP 0x020100
#define PD_REG 0x020402
#define HIZ_HP 0x020803
#define HIZ_SPR 0x030402
#define HIZ_SPL 0x030803
#define PD_REC 0x031004
#define PD_SNT 0x038007
#define DPLT 0x047004
#define DALC 0x040700
#define DREL 0x050C02
#define DATT 0x050300
#define MNX 0x071F00
#define ZCS_MV 0x078007
#define SVLA 0x081F00
#define LAT_VA 0x082005
#define ZCS_SVA 0x088007
#define SVRA 0x091F00
#define SVLB 0x0A1F00
#define LAT_VB 0x0A2005
#define ZCS_SVB 0x0A8007
#define SVRB 0x0B1F00
#define HPL_BMIX 0x0C0100
#define HPL_AMIX 0x0C0201
#define HPL_MMIX 0x0C0402
#define MONO_HP 0x0C0803
#define HPR_BMIX 0x0C1004
#define HPR_AMIX 0x0C2005
#define HPR_MMIX 0x0C4006
#define SPL_BMIX 0x0D0100
#define SPL_AMIX 0x0D0201
#define SPL_MMIX 0x0D0402
#define MONO_SP 0x0D0803
#define SPR_BMIX 0x0D1004
#define SPR_AMIX 0x0D2005
#define SPR_MMIX 0x0D4006
#define SWAP_SP 0x0D8007
#define MNA 0x0E1F00
#define SVOL_SP 0x0E4006
#define ZCS_SPA 0x0E8007
#define SALA 0x0F1F00
#define LAT_HP 0x0F2005
#define SVOL_HP 0x0F4006
#define ZCS_HPA 0x0F8007
#define SARA 0x101F00
#define OTP_ERR 0x118006
#define OCP_ERR 0x118007
#define D4NP2_SUCCESS 0
#define D4NP2_ERROR -1
#define MAX_WRITE_REGISTER_NUMBER 19
#define MAX_READ_REGISTER_NUMBER 20
#define D4NP2_SOFTVOLUME_STEPTIME 250
#define D4NP2_STATE_POWER_ON 0
#define D4NP2_STATE_POWER_OFF 1
#define SINT32 signed long
#define UINT32 unsigned long
#define SINT8 signed char
#define UINT8 unsigned char
#endif
|
/*
* occampi_fe.h -- interface to occam-pi front-end
* Copyright (C) 2005 Fred Barnes <frmb@kent.ac.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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __OCCAMPI_FE_H
#define __OCCAMPI_FE_H
extern int occampi_register_frontend (void);
extern int occampi_unregister_frontend (void);
#endif /* !__OCCAMPI_FE_H */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 William Jon McCann <jmccann@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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "gdm-a11y-preferences-dialog.h"
int
main (int argc, char *argv[])
{
GtkWidget *dialog;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
setlocale (LC_ALL, "");
gtk_init (&argc, &argv);
dialog = gdm_a11y_preferences_dialog_new ();
/*gtk_widget_set_size_request (dialog, 480, 128);*/
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return 0;
}
|
/*
* InstrumentFunctions.h - models for instrument-functions-tab
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_FUNCTIONS_H
#define _INSTRUMENT_FUNCTIONS_H
#include "JournallingObject.h"
#include "lmms_basics.h"
#include "AutomatableModel.h"
#include "TempoSyncKnobModel.h"
#include "ComboBoxModel.h"
class InstrumentTrack;
class notePlayHandle;
const int MAX_CHORD_POLYPHONY = 10;
class ChordCreator : public Model, public JournallingObject
{
Q_OBJECT
public:
ChordCreator( Model * _parent );
virtual ~ChordCreator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName() const
{
return "chordcreator";
}
static struct Chord
{
const QString name;
Sint8 interval[MAX_CHORD_POLYPHONY];
} s_chordTable[];
static inline int getChordSize( Chord & _c )
{
int idx = 0;
while( _c.interval[idx] != -1 )
{
++idx;
}
return idx;
}
private:
BoolModel m_chordsEnabledModel;
ComboBoxModel m_chordsModel;
FloatModel m_chordRangeModel;
friend class ChordCreatorView;
} ;
class Arpeggiator : public Model, public JournallingObject
{
Q_OBJECT
public:
enum ArpDirections
{
ArpDirUp,
ArpDirDown,
ArpDirUpAndDown,
ArpDirRandom,
NumArpDirections
} ;
Arpeggiator( Model * _parent );
virtual ~Arpeggiator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName() const
{
return "arpeggiator";
}
private:
enum ArpModes
{
FreeMode,
SortMode,
SyncMode
} ;
BoolModel m_arpEnabledModel;
ComboBoxModel m_arpModel;
FloatModel m_arpRangeModel;
TempoSyncKnobModel m_arpTimeModel;
FloatModel m_arpGateModel;
ComboBoxModel m_arpDirectionModel;
ComboBoxModel m_arpModeModel;
friend class FlpImport;
friend class InstrumentTrack;
friend class ArpeggiatorView;
} ;
#endif
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-link.h: .
Copyright (C) 2001 Red Hat, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Jonathan Blandford <jrb@redhat.com>
*/
#ifndef NAUTILUS_LINK_H
#define NAUTILUS_LINK_H
#include <gdk/gdktypes.h>
#include <libgnome/gnome-desktop-item.h>
gboolean nautilus_link_local_create (const char *directory_uri,
const char *base_name,
const char *display_name,
const char *image,
const char *target_uri,
const GdkPoint *point,
int screen,
gboolean unique_filename);
gboolean nautilus_link_local_set_text (const char *uri,
const char *text);
char * nautilus_link_local_get_text (const char *uri);
char * nautilus_link_local_get_additional_text (const char *uri);
char * nautilus_link_local_get_link_uri (const char *uri);
void nautilus_link_get_link_info_given_file_contents (const char *file_contents,
int link_file_size,
char **uri,
char **name,
char **icon,
gboolean *is_launcher);
void nautilus_link_local_create_from_gnome_entry (GnomeDesktopItem *entry,
const char *dest_uri,
const GdkPoint *position,
int screen);
#endif /* NAUTILUS_LINK_H */
|
/*
*
* 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 <math.h>
#include "sysstuff.h"
#include "string.h"
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
#include "vec.h"
#include "xvgr.h"
#include "physics.h"
#include "pbc.h"
#include "copyrite.h"
#include "futil.h"
#include "statutil.h"
#include "index.h"
#include "nrama.h"
static void plot_rama(FILE *out,t_xrama *xr)
{
int i;
real phi,psi;
for(i=0; (i<xr->npp); i++) {
phi=xr->dih[xr->pp[i].iphi].ang*RAD2DEG;
psi=xr->dih[xr->pp[i].ipsi].ang*RAD2DEG;
fprintf(out,"%g %g %s\n",phi,psi,xr->pp[i].label);
}
}
int gmx_rama(int argc,char *argv[])
{
const char *desc[] = {
"g_rama selects the Phi/Psi dihedral combinations from your topology file",
"and computes these as a function of time.",
"Using simple Unix tools such as [IT]grep[it] you can select out",
"specific residues."
};
FILE *out;
t_xrama *xr;
int j;
t_filenm fnm[] = {
{ efTRX, "-f", NULL, ffREAD },
{ efTPX, NULL, NULL, ffREAD },
{ efXVG, NULL, "rama",ffWRITE }
};
#define NFILE asize(fnm)
CopyRight(stderr,argv[0]);
parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
NFILE,fnm,0,NULL,asize(desc),desc,0,NULL);
snew(xr,1);
init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),xr,3);
out=xvgropen(ftp2fn(efXVG,NFILE,fnm),"Ramachandran Plot","Phi","Psi");
xvgr_line_props(out,0,elNone,ecFrank);
xvgr_view(out,0.2,0.2,0.8,0.8);
xvgr_world(out,-180,-180,180,180);
fprintf(out,"@ xaxis tick on\n@ xaxis tick major 60\n@ xaxis tick minor 30\n");
fprintf(out,"@ yaxis tick on\n@ yaxis tick major 60\n@ yaxis tick minor 30\n");
fprintf(out,"@ s0 symbol 2\n@ s0 symbol size 0.4\n@ s0 symbol fill 1\n");
j=0;
do {
plot_rama(out,xr);
j++;
} while (new_data(xr));
fprintf(stderr,"\n");
fclose(out);
do_view(ftp2fn(efXVG,NFILE,fnm),NULL);
thanx(stderr);
return 0;
}
|
/*
* rtm_map.c
*
* 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.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "rt_names.h"
#include "utils.h"
char *rtnl_rtntype_n2a(int id, char *buf, int len)
{
switch (id) {
case RTN_UNSPEC:
return "none";
case RTN_UNICAST:
return "unicast";
case RTN_LOCAL:
return "local";
case RTN_BROADCAST:
return "broadcast";
case RTN_ANYCAST:
return "anycast";
case RTN_MULTICAST:
return "multicast";
case RTN_BLACKHOLE:
return "blackhole";
case RTN_UNREACHABLE:
return "unreachable";
case RTN_PROHIBIT:
return "prohibit";
case RTN_THROW:
return "throw";
case RTN_NAT:
return "nat";
case RTN_XRESOLVE:
return "xresolve";
default:
snprintf(buf, len, "%d", id);
return buf;
}
}
int rtnl_rtntype_a2n(int *id, char *arg)
{
char *end;
unsigned long res;
if (strcmp(arg, "local") == 0)
res = RTN_LOCAL;
else if (strcmp(arg, "nat") == 0)
res = RTN_NAT;
else if (matches(arg, "broadcast") == 0 ||
strcmp(arg, "brd") == 0)
res = RTN_BROADCAST;
else if (matches(arg, "anycast") == 0)
res = RTN_ANYCAST;
else if (matches(arg, "multicast") == 0)
res = RTN_MULTICAST;
else if (matches(arg, "prohibit") == 0)
res = RTN_PROHIBIT;
else if (matches(arg, "unreachable") == 0)
res = RTN_UNREACHABLE;
else if (matches(arg, "blackhole") == 0)
res = RTN_BLACKHOLE;
else if (matches(arg, "xresolve") == 0)
res = RTN_XRESOLVE;
else if (matches(arg, "unicast") == 0)
res = RTN_UNICAST;
else if (strcmp(arg, "throw") == 0)
res = RTN_THROW;
else {
res = strtoul(arg, &end, 0);
if (!end || end == arg || *end || res > 255)
return -1;
}
*id = res;
return 0;
}
int get_rt_realms(__u32 *realms, char *arg)
{
__u32 realm = 0;
char *p = strchr(arg, '/');
*realms = 0;
if (p) {
*p = 0;
if (rtnl_rtrealm_a2n(realms, arg)) {
*p = '/';
return -1;
}
*realms <<= 16;
*p = '/';
arg = p+1;
}
if (*arg && rtnl_rtrealm_a2n(&realm, arg))
return -1;
*realms |= realm;
return 0;
}
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Test that the priority remain unchanged when the sched_ss_max_repl is lower
* than 1.
*
* @pt:SS
*/
#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include "posixtest.h"
#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1)
int main()
{
int old_priority;
struct sched_param param;
if (sched_getparam(0, ¶m) == -1) {
perror("An error occurs when calling sched_getparam()");
return PTS_UNRESOLVED;
}
old_priority = param.sched_priority;
param.sched_ss_max_repl = 0;
param.sched_priority++;
sched_setparam(0, ¶m);
if (sched_getparam(0, ¶m) != 0) {
perror("An error occurs when calling sched_getparam()");
return PTS_UNRESOLVED;
}
if (param.sched_priority == old_priority) {
printf("Test PASSED\n");
return PTS_PASS;
} else {
printf("The priority have changed.\n");
return PTS_FAIL;
}
}
#else
int main()
{
printf("Does not support SS (SPORADIC SERVER)\n");
return PTS_UNSUPPORTED;
}
#endif
|
#define CPARSER_MAJOR "0"
#define CPARSER_MINOR "9"
#define CPARSER_PATCHLEVEL "14"
#define CPARSER_VERSION CPARSER_MAJOR "." CPARSER_MINOR "." CPARSER_PATCHLEVEL
|
/* strerror.c
*
* cml hacked on this function 940627
* so that the error message would be copied into a static buffer,
* and then return a ptr to that buffer.
*
* Previously, a ptr into the sys_errlist array was returned,
* but this caused core dumps. I don't understand the problem
* but it's better now.
*/
#include "strerror.h"
char *strerror(err)
int err;
{
extern int sys_nerr;
extern const char *const sys_errlist[];
static char errmsg[256];
if (err >= 0 && err < sys_nerr)
strcpy(errmsg, sys_errlist[err]);
else
(void) sprintf(errmsg, "Error %d", err);
return errmsg;
}
#if 0
char *
strerror(err)
int err;
{
extern int sys_nerr;
extern const char *const sys_errlist[];
static char errmsg[32];
if (err >= 0 && err < sys_nerr)
return sys_errlist[sys_nerr];
(void) sprintf(errmsg, "Error %d", err);
return errmsg;
}
#endif
#ifdef DRIVER
#include <errno.h>
extern int sys_nerr;
int main(argc, argv)
char **argv;
{
int i;
for (i = 0; i < sys_nerr; ++i)
printf("Errno = %d, msg = %s\n", i, strerror(i));
return 0;
}
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 Street #330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glib.h>
#include "glib-utils.h"
#include "gth-marshal.h"
#include "gth-task.h"
/* Signals */
enum {
COMPLETED,
PROGRESS,
DIALOG,
LAST_SIGNAL
};
struct _GthTaskPrivate
{
gboolean running;
GCancellable *cancellable;
gulong cancellable_cancelled;
};
static GObjectClass *parent_class = NULL;
static guint gth_task_signals[LAST_SIGNAL] = { 0 };
GQuark
gth_task_error_quark (void)
{
return g_quark_from_static_string ("gth-task-error-quark");
}
static void
gth_task_finalize (GObject *object)
{
GthTask *task;
task = GTH_TASK (object);
if (task->priv->cancellable != NULL) {
g_signal_handler_disconnect (task->priv->cancellable, task->priv->cancellable_cancelled);
g_object_unref (task->priv->cancellable);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
base_exec (GthTask *task)
{
/*gth_task_completed (task, NULL);*/
}
static void
base_cancelled (GthTask *task)
{
/*gth_task_completed (task, g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, ""));*/
}
static void
gth_task_class_init (GthTaskClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (GthTaskPrivate));
object_class = (GObjectClass*) class;
object_class->finalize = gth_task_finalize;
class->exec = base_exec;
class->cancelled = base_cancelled;
/* signals */
gth_task_signals[COMPLETED] =
g_signal_new ("completed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GthTaskClass, completed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1,
G_TYPE_POINTER);
gth_task_signals[PROGRESS] =
g_signal_new ("progress",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GthTaskClass, progress),
NULL, NULL,
gth_marshal_VOID__STRING_STRING_BOOLEAN_DOUBLE,
G_TYPE_NONE,
4,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_DOUBLE);
gth_task_signals[DIALOG] =
g_signal_new ("dialog",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GthTaskClass, dialog),
NULL, NULL,
gth_marshal_VOID__BOOLEAN_POINTER,
G_TYPE_NONE,
2,
G_TYPE_BOOLEAN,
G_TYPE_POINTER);
}
static void
gth_task_init (GthTask *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_TASK, GthTaskPrivate);
self->priv->running = FALSE;
self->priv->cancellable = NULL;
self->priv->cancellable_cancelled = 0;
}
GType
gth_task_get_type (void)
{
static GType type = 0;
if (! type) {
GTypeInfo type_info = {
sizeof (GthTaskClass),
NULL,
NULL,
(GClassInitFunc) gth_task_class_init,
NULL,
NULL,
sizeof (GthTask),
0,
(GInstanceInitFunc) gth_task_init
};
type = g_type_register_static (G_TYPE_OBJECT,
"GthTask",
&type_info,
0);
}
return type;
}
static void
cancellable_cancelled_cb (GCancellable *cancellable,
gpointer user_data)
{
GthTask *task = user_data;
GTH_TASK_GET_CLASS (task)->cancelled (task);
}
void
gth_task_exec (GthTask *task,
GCancellable *cancellable)
{
if (task->priv->running)
return;
if (task->priv->cancellable != NULL) {
g_signal_handler_disconnect (task->priv->cancellable, task->priv->cancellable_cancelled);
g_object_unref (task->priv->cancellable);
}
if (cancellable != NULL)
task->priv->cancellable = _g_object_ref (cancellable);
else
task->priv->cancellable = g_cancellable_new ();
task->priv->cancellable_cancelled = g_signal_connect (task->priv->cancellable,
"cancelled",
G_CALLBACK (cancellable_cancelled_cb),
task);
task->priv->running = TRUE;
GTH_TASK_GET_CLASS (task)->exec (task);
}
gboolean
gth_task_is_running (GthTask *task)
{
return task->priv->running;
}
void
gth_task_cancel (GthTask *task)
{
if (task->priv->cancellable != NULL)
g_cancellable_cancel (task->priv->cancellable);
else
cancellable_cancelled_cb (NULL, task);
}
GCancellable *
gth_task_get_cancellable (GthTask *task)
{
return task->priv->cancellable;
}
void
gth_task_completed (GthTask *task,
GError *error)
{
task->priv->running = FALSE;
g_signal_emit (task, gth_task_signals[COMPLETED], 0, error);
}
void
gth_task_dialog (GthTask *task,
gboolean opened,
GtkWidget *dialog)
{
g_signal_emit (task, gth_task_signals[DIALOG], 0, opened, dialog);
}
void
gth_task_progress (GthTask *task,
const char *description,
const char *details,
gboolean pulse,
double fraction)
{
g_signal_emit (task, gth_task_signals[PROGRESS], 0, description, details, pulse, fraction);
}
|
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "driver/VideoDriver.h"
#include <SDL.h>
class VideoDriverLoaderInterface;
struct VideoMode;
class VideoSDL2 final : public VideoDriver
{
void CleanUp();
public:
VideoSDL2(VideoDriverLoaderInterface* CallBack);
~VideoSDL2() override;
/// Get the name of the driver
const char* GetName() const override;
bool Initialize() override;
bool CreateScreen(const std::string& title, const VideoMode& size, bool fullscreen) override;
bool ResizeScreen(const VideoMode& newSize, bool fullscreen) override;
void DestroyScreen() override;
/// Swap the OpenGL buffer
bool SwapBuffers() override;
bool MessageLoop() override;
/// Get a timestamp
unsigned long GetTickCount() const override;
OpenGL_Loader_Proc GetLoaderFunction() const override;
/// Add supported video modes
void ListVideoModes(std::vector<VideoMode>& video_modes) const override;
/// Set mouse position
void SetMousePos(Position pos) override;
/// Get state of the modifier keys
KeyEvent GetModKeyState() const override;
/// Get (device-dependent!) window pointer, HWND in Windows
void* GetMapPointer() const override;
private:
void PrintError(const std::string& msg) const;
void HandlePaste();
void UpdateCurrentSizes();
void MoveWindowToCenter();
SDL_Window* window;
SDL_GLContext context;
};
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _RESETHANDLER_H
#define _RESETHANDLER_H
#include "ResetListener.h"
#include "CommandListener.h"
class CommandListener;
class ResetHandler: public ResetListener {
CommandListener *mCl;
public:
ResetHandler(CommandListener *cl, int listenerSocket);
virtual ~ResetHandler();
int start(void);
int stop(void);
protected:
virtual void onEvent(int evt);
private:
bool isRunningReset;
};
#endif
|
/*
* Copyright (C) 2014-2019 Firejail Authors
*
* This file is part of firejail project
*
* 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 "fbuilder.h"
static FileDB *bin_out = NULL;
static void process_bin(const char *fname) {
assert(fname);
// process trace file
FILE *fp = fopen(fname, "r");
if (!fp) {
fprintf(stderr, "Error: cannot open %s\n", fname);
exit(1);
}
char buf[MAX_BUF];
while (fgets(buf, MAX_BUF, fp)) {
// remove \n
char *ptr = strchr(buf, '\n');
if (ptr)
*ptr = '\0';
// parse line: 4:galculator:access /etc/fonts/conf.d:0
// number followed by :
ptr = buf;
if (!isdigit(*ptr))
continue;
while (isdigit(*ptr))
ptr++;
if (*ptr != ':')
continue;
ptr++;
// next :
ptr = strchr(ptr, ':');
if (!ptr)
continue;
ptr++;
if (strncmp(ptr, "exec ", 5) == 0)
ptr += 5;
else
continue;
if (strncmp(ptr, "/bin/", 5) == 0)
ptr += 5;
else if (strncmp(ptr, "/sbin/", 6) == 0)
ptr += 6;
else if (strncmp(ptr, "/usr/bin/", 9) == 0)
ptr += 9;
else if (strncmp(ptr, "/usr/sbin/", 10) == 0)
ptr += 10;
else if (strncmp(ptr, "/usr/local/bin/", 15) == 0)
ptr += 15;
else if (strncmp(ptr, "/usr/local/sbin/", 16) == 0)
ptr += 16;
else if (strncmp(ptr, "/usr/games/", 11) == 0)
ptr += 12;
else if (strncmp(ptr, "/usr/local/games/", 17) == 0)
ptr += 17;
else
continue;
// end of filename
char *ptr2 = strchr(ptr, ':');
if (!ptr2)
continue;
*ptr2 = '\0';
// skip strace
if (strcmp(ptr, "strace") == 0)
continue;
bin_out = filedb_add(bin_out, ptr);
}
fclose(fp);
}
// process fname, fname.1, fname.2, fname.3, fname.4, fname.5
void build_bin(const char *fname, FILE *fp) {
assert(fname);
// run fname
process_bin(fname);
// run all the rest
struct stat s;
int i;
for (i = 1; i <= 5; i++) {
char *newname;
if (asprintf(&newname, "%s.%d", fname, i) == -1)
errExit("asprintf");
if (stat(newname, &s) == 0)
process_bin(newname);
free(newname);
}
if (bin_out) {
fprintf(fp, "private-bin ");
FileDB *ptr = bin_out;
while (ptr) {
fprintf(fp, "%s,", ptr->fname);
ptr = ptr->next;
}
fprintf(fp, "\n");
fprintf(fp, "# private-lib\n");
}
}
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2010, Digium, Inc.
*
* David Vossel <dvossel@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief FrameHooks Architecture
*
* \author David Vossel <dvossel@digium.com>
*/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/channel.h"
#include "asterisk/linkedlists.h"
#include "asterisk/framehook.h"
#include "asterisk/frame.h"
struct ast_framehook {
struct ast_framehook_interface i;
/*! This pointer to ast_channel the framehook is attached to. */
struct ast_channel *chan;
/*! the id representing this framehook on a channel */
unsigned int id;
/*! when set, this signals the read and write function to detach the hook */
int detach_and_destroy_me;
/*! list entry for ast_framehook_list object */
AST_LIST_ENTRY(ast_framehook) list;
};
struct ast_framehook_list {
unsigned int id_count;
AST_LIST_HEAD_NOLOCK(, ast_framehook) list;
};
static void framehook_detach_and_destroy(struct ast_framehook *framehook)
{
struct ast_frame *frame;
frame = framehook->i.event_cb(framehook->chan, NULL, AST_FRAMEHOOK_EVENT_DETACHED, framehook->i.data);
/* never assume anything about this function. If you can return a frame during
* the detached event, then assume someone will. */
if (frame) {
ast_frfree(frame);
}
framehook->chan = NULL;
if (framehook->i.destroy_cb) {
framehook->i.destroy_cb(framehook->i.data);
}
ast_free(framehook);
}
static struct ast_frame *framehook_list_push_event(struct ast_framehook_list *framehooks, struct ast_frame *frame, enum ast_framehook_event event)
{
struct ast_framehook *framehook;
if (!framehooks) {
return frame;
}
AST_LIST_TRAVERSE_SAFE_BEGIN(&framehooks->list, framehook, list) {
if (framehook->detach_and_destroy_me) {
/* this guy is signaled for destruction */
AST_LIST_REMOVE_CURRENT(list);
framehook_detach_and_destroy(framehook);
} else {
frame = framehook->i.event_cb(framehook->chan, frame, event, framehook->i.data);
}
}
AST_LIST_TRAVERSE_SAFE_END;
return frame;
}
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
{
struct ast_framehook *framehook;
struct ast_framehook_list *fh_list;
struct ast_frame *frame;
if (i->version != AST_FRAMEHOOK_INTERFACE_VERSION) {
ast_log(LOG_ERROR, "Version '%hu' of framehook interface not what we compiled against (%hu)\n",
i->version, AST_FRAMEHOOK_INTERFACE_VERSION);
return -1;
}
if (!i->event_cb || !(framehook = ast_calloc(1, sizeof(*framehook)))) {
return -1;
}
framehook->i = *i;
framehook->chan = chan;
/* create the framehook list if it didn't already exist */
if (!ast_channel_framehooks(chan)) {
if (!(fh_list = ast_calloc(1, sizeof(*ast_channel_framehooks(chan))))) {
ast_free(framehook);
return -1;
}
ast_channel_framehooks_set(chan, fh_list);
}
framehook->id = ++ast_channel_framehooks(chan)->id_count;
AST_LIST_INSERT_TAIL(&ast_channel_framehooks(chan)->list, framehook, list);
/* Tell the event callback we're live and rocking */
frame = framehook->i.event_cb(framehook->chan, NULL, AST_FRAMEHOOK_EVENT_ATTACHED, framehook->i.data);
/* Never assume anything about this function. If you can return a frame during
* the attached event, then assume someone will. */
if (frame) {
ast_frfree(frame);
}
return framehook->id;
}
int ast_framehook_detach(struct ast_channel *chan, int id)
{
struct ast_framehook *framehook;
int res = -1;
if (!ast_channel_framehooks(chan)) {
return res;
}
AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(chan)->list, framehook, list) {
if (framehook->id == id) {
/* we mark for detachment rather than doing explicitly here because
* it needs to be safe for this function to be called within the
* event callback. If we allowed the hook to actually be destroyed
* immediately here, the event callback would crash on exit. */
framehook->detach_and_destroy_me = 1;
res = 0;
break;
}
}
AST_LIST_TRAVERSE_SAFE_END;
return res;
}
int ast_framehook_list_destroy(struct ast_channel *chan)
{
struct ast_framehook *framehook;
if (!ast_channel_framehooks(chan)) {
return 0;
}
AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(chan)->list, framehook, list) {
AST_LIST_REMOVE_CURRENT(list);
framehook_detach_and_destroy(framehook);
}
AST_LIST_TRAVERSE_SAFE_END;
ast_free(ast_channel_framehooks(chan));
ast_channel_framehooks_set(chan, NULL);
return 0;
}
int ast_framehook_list_is_empty(struct ast_framehook_list *framehooks)
{
if (!framehooks) {
return 1;
}
return AST_LIST_EMPTY(&framehooks->list) ? 1 : 0;
}
struct ast_frame *ast_framehook_list_write_event(struct ast_framehook_list *framehooks, struct ast_frame *frame)
{
return framehook_list_push_event(framehooks, frame, AST_FRAMEHOOK_EVENT_WRITE);
}
struct ast_frame *ast_framehook_list_read_event(struct ast_framehook_list *framehooks, struct ast_frame *frame)
{
return framehook_list_push_event(framehooks, frame, AST_FRAMEHOOK_EVENT_READ);
}
|
#pragma once
// Created on 2015/08/18
// Including headers in common
#include "mongoExp/programs/mongoExpProgram.h"
#include "mongoExp/programs/mongoExpSub1.h"
#include "mongoExp/programs/mongoExpSub2.h"
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/minifram.h
// Purpose: wxMiniFrame base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: minifram.h 70345 2012-01-15 01:05:28Z VZ $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MINIFRAM_H_BASE_
#define _WX_MINIFRAM_H_BASE_
#include "wx/defs.h"
#if wxUSE_MINIFRAME
#if defined(__WXMSW__)
#include "wx/msw/minifram.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/minifram.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/minifram.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/minifram.h"
#elif defined(__WXX11__)
#include "wx/x11/minifram.h"
#elif defined(__WXMAC__)
#include "wx/osx/minifram.h"
#elif defined(__WXPM__)
#include "wx/os2/minifram.h"
#else
// TODO: it seems that wxMiniFrame could be just defined here generically
// instead of having all the above port-specific headers
#include "wx/frame.h"
typedef wxFrame wxMiniFrame;
#endif
#endif // wxUSE_MINIFRAME
#endif // _WX_MINIFRAM_H_BASE_
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gdiobj.h
// Purpose: wxGDIObject base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// RCS-ID: $Id: gdiobj.h 70345 2012-01-15 01:05:28Z VZ $
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GDIOBJ_H_BASE_
#define _WX_GDIOBJ_H_BASE_
#include "wx/object.h"
// ----------------------------------------------------------------------------
// wxGDIRefData is the base class for wxXXXData structures which contain the
// real data for the GDI object and are shared among all wxWin objects sharing
// the same native GDI object
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIRefData : public wxObjectRefData
{
public:
// Default ctor which needs to be defined just because we use
// wxDECLARE_NO_COPY_CLASS() below.
wxGDIRefData() { }
// override this in the derived classes to check if this data object is
// really fully initialized
virtual bool IsOk() const { return true; }
private:
wxDECLARE_NO_COPY_CLASS(wxGDIRefData);
};
// ----------------------------------------------------------------------------
// wxGDIObject: base class for bitmaps, pens, brushes, ...
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIObject : public wxObject
{
public:
// checks if the object can be used
virtual bool IsOk() const
{
// the cast here is safe because the derived classes always create
// wxGDIRefData objects
return m_refData && static_cast<wxGDIRefData *>(m_refData)->IsOk();
}
// don't use in the new code, use IsOk() instead
bool IsNull() const { return m_refData == NULL; }
// older version, for backwards compatibility only (but not deprecated
// because it's still widely used)
bool Ok() const { return IsOk(); }
#if defined(__WXMSW__) || defined(__WXPM__)
// Creates the resource
virtual bool RealizeResource() { return false; }
// Frees the resource
virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; }
virtual bool IsFree() const { return false; }
// Returns handle.
virtual WXHANDLE GetResourceHandle() const { return 0; }
#endif // defined(__WXMSW__) || defined(__WXPM__)
protected:
// replace base class functions using wxObjectRefData with our own which
// use wxGDIRefData to ensure that we always work with data objects of the
// correct type (i.e. derived from wxGDIRefData)
virtual wxObjectRefData *CreateRefData() const
{
return CreateGDIRefData();
}
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const
{
return CloneGDIRefData(static_cast<const wxGDIRefData *>(data));
}
virtual wxGDIRefData *CreateGDIRefData() const = 0;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0;
DECLARE_DYNAMIC_CLASS(wxGDIObject)
};
#endif // _WX_GDIOBJ_H_BASE_
|
/**
* \file
*
* \brief Chip-specific system clock manager configuration
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef CONF_CLOCK_H_INCLUDED
#define CONF_CLOCK_H_INCLUDED
//#define CONFIG_SYSCLK_INIT_CPUMASK (1 << SYSCLK_SYSTIMER)
//#define CONFIG_SYSCLK_INIT_PBAMASK (1 << SYSCLK_USART0)
//#define CONFIG_SYSCLK_INIT_PBBMASK (1 << SYSCLK_HMATRIX)
//#define CONFIG_SYSCLK_INIT_HSBMASK (1 << SYSCLK_MDMA_HSB)
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCSYS
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_OSC0
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_OSC1
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL0
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL1
//#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RC8M
/* Fbus = Fsys / (2 ^ BUS_div) */
#define CONFIG_SYSCLK_CPU_DIV 0
#define CONFIG_SYSCLK_PBA_DIV 0
#define CONFIG_SYSCLK_PBB_DIV 0
#define CONFIG_SYSCLK_PBC_DIV 0
//#define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC0
//#define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC1
#define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL0
//#define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1
/* Fusb = Fsys / USB_div */
#define CONFIG_USBCLK_DIV 1
#define CONFIG_PLL0_SOURCE PLL_SRC_OSC0
//#define CONFIG_PLL0_SOURCE PLL_SRC_OSC1
//#define CONFIG_PLL0_SOURCE PLL_SRC_RC8M
/* Fpll0 = (Fclk * PLL_mul) / PLL_div */
#define CONFIG_PLL0_MUL (48000000UL / BOARD_OSC0_HZ)
#define CONFIG_PLL0_DIV 1
//#define CONFIG_PLL1_SOURCE PLL_SRC_OSC0
//#define CONFIG_PLL1_SOURCE PLL_SRC_OSC1
//#define CONFIG_PLL1_SOURCE PLL_SRC_RC8M
/* Fpll1 = (Fclk * PLL_mul) / PLL_div */
#define CONFIG_PLL1_MUL (48000000UL / BOARD_OSC0_HZ)
#define CONFIG_PLL1_DIV 1
#endif /* CONF_CLOCK_H_INCLUDED */
|
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef IS_FBSD
#include "machine/soundcard.h"
#define DSP_DEVICE "/dev/dsp"
#endif
#ifdef IS_OBSD
#include "soundcard.h"
#define DSP_DEVICE "/dev/sound"
#endif
#ifdef IS_LINUX
#include <sys/soundcard.h>
#define DSP_DEVICE "/dev/dsp"
#endif
#include "defs.h"
#include "pcm.h"
#include "rc.h"
/* FIXME - all this code is VERY basic, improve it! */
struct pcm pcm;
static int dsp;
static char *dsp_device;
static int stereo = 1;
static int samplerate = 44100;
static int sound = 1;
rcvar_t pcm_exports[] =
{
RCV_BOOL("sound", &sound),
RCV_INT("stereo", &stereo),
RCV_INT("samplerate", &samplerate),
RCV_INT("oss_device", &dsp_device),
RCV_END
};
void pcm_init()
{
int n;
if (!sound)
{
pcm.hz = 11025;
pcm.len = 4096;
pcm.buf = malloc(pcm.len);
pcm.pos = 0;
dsp = -1;
return;
}
if (!dsp_device) dsp_device = strdup(DSP_DEVICE);
dsp = open(dsp_device, O_WRONLY);
n = 0x80009;
ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &n);
n = AFMT_U8;
ioctl(dsp, SNDCTL_DSP_SETFMT, &n);
n = stereo;
ioctl(dsp, SNDCTL_DSP_STEREO, &n);
pcm.stereo = n;
n = samplerate;
ioctl(dsp, SNDCTL_DSP_SPEED, &n);
pcm.hz = n;
pcm.len = n / 60;
pcm.buf = malloc(pcm.len);
}
void pcm_close()
{
if (pcm.buf) free(pcm.buf);
memset(&pcm, 0, sizeof pcm);
close(dsp);
}
int pcm_submit()
{
if (dsp < 0)
{
pcm.pos = 0;
return 0;
}
if (pcm.buf) write(dsp, pcm.buf, pcm.pos);
pcm.pos = 0;
return 1;
}
|
/*
* 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.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "devfs.h"
int devFS_stat(
const rtems_filesystem_location_info_t *loc,
struct stat *buf
)
{
int rv = 0;
const devFS_node *the_dev = loc->node_access;
if (the_dev != NULL) {
buf->st_rdev = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
buf->st_mode = the_dev->mode;
} else {
rv = rtems_filesystem_default_fstat(loc, buf);
}
return rv;
}
|
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file fileio_func.h Functions for Standard In/Out file operations */
#ifndef FILEIO_FUNC_H
#define FILEIO_FUNC_H
#include "core/enum_type.hpp"
#include "fileio_type.h"
#include <string>
void FioSeekTo(size_t pos, int mode);
void FioSeekToFile(uint8 slot, size_t pos);
size_t FioGetPos();
const char *FioGetFilename(uint8 slot);
byte FioReadByte();
uint16 FioReadWord();
uint32 FioReadDword();
void FioCloseAll();
void FioOpenFile(int slot, const std::string &filename, Subdirectory subdir);
void FioReadBlock(void *ptr, size_t size);
void FioSkipBytes(int n);
/**
* Checks whether the given search path is a valid search path
* @param sp the search path to check
* @return true if the search path is valid
*/
bool IsValidSearchPath(Searchpath sp);
/** Iterator for all the search paths */
#define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp))
void FioFCloseFile(FILE *f);
FILE *FioFOpenFile(const std::string &filename, const char *mode, Subdirectory subdir, size_t *filesize = nullptr);
bool FioCheckFileExists(const std::string &filename, Subdirectory subdir);
std::string FioFindFullPath(Subdirectory subdir, const char *filename);
std::string FioGetDirectory(Searchpath sp, Subdirectory subdir);
std::string FioFindDirectory(Subdirectory subdir);
void FioCreateDirectory(const std::string &name);
const char *FiosGetScreenshotDir();
void SanitizeFilename(char *filename);
void AppendPathSeparator(std::string &buf);
void DeterminePaths(const char *exe);
std::unique_ptr<char> ReadFileToMem(const std::string &filename, size_t &lenp, size_t maxsize);
bool FileExists(const std::string &filename);
bool ExtractTar(const std::string &tar_filename, Subdirectory subdir);
extern std::string _personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.
/** Helper for scanning for files with a given name */
class FileScanner {
protected:
Subdirectory subdir; ///< The current sub directory we are searching through
public:
/** Destruct the proper one... */
virtual ~FileScanner() {}
uint Scan(const char *extension, Subdirectory sd, bool tars = true, bool recursive = true);
uint Scan(const char *extension, const char *directory, bool recursive = true);
/**
* Add a file with the given filename.
* @param filename the full path to the file to read
* @param basepath_length amount of characters to chop of before to get a
* filename relative to the search path.
* @param tar_filename the name of the tar file the file is read from.
* @return true if the file is added.
*/
virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) = 0;
};
/** Helper for scanning for files with tar as extension */
class TarScanner : FileScanner {
uint DoScan(Subdirectory sd);
public:
/** The mode of tar scanning. */
enum Mode {
NONE = 0, ///< Scan nothing.
BASESET = 1 << 0, ///< Scan for base sets.
NEWGRF = 1 << 1, ///< Scan for non-base sets.
AI = 1 << 2, ///< Scan for AIs and its libraries.
SCENARIO = 1 << 3, ///< Scan for scenarios and heightmaps.
GAME = 1 << 4, ///< Scan for game scripts.
ALL = BASESET | NEWGRF | AI | SCENARIO | GAME, ///< Scan for everything.
};
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename = {}) override;
bool AddFile(Subdirectory sd, const std::string &filename);
/** Do the scan for Tars. */
static uint DoScan(TarScanner::Mode mode);
};
DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode)
/* Implementation of opendir/readdir/closedir for Windows */
#if defined(_WIN32)
struct DIR;
struct dirent { // XXX - only d_name implemented
wchar_t *d_name; // name of found file
/* little hack which will point to parent DIR struct which will
* save us a call to GetFileAttributes if we want information
* about the file (for example in function fio_bla) */
DIR *dir;
};
DIR *opendir(const wchar_t *path);
struct dirent *readdir(DIR *d);
int closedir(DIR *d);
#else
/* Use system-supplied opendir/readdir/closedir functions */
# include <sys/types.h>
# include <dirent.h>
#endif /* defined(_WIN32) */
/**
* A wrapper around opendir() which will convert the string from
* OPENTTD encoding to that of the filesystem. For all purposes this
* function behaves the same as the original opendir function
* @param path string to open directory of
* @return DIR pointer
*/
static inline DIR *ttd_opendir(const char *path)
{
return opendir(OTTD2FS(path));
}
/** Auto-close a file upon scope exit. */
class FileCloser {
FILE *f;
public:
FileCloser(FILE *_f) : f(_f) {}
~FileCloser()
{
fclose(f);
}
};
/** Helper to manage a FILE with a \c std::unique_ptr. */
struct FileDeleter {
void operator()(FILE *f)
{
if (f) fclose(f);
}
};
#endif /* FILEIO_FUNC_H */
|
/*
** Job Arranger for ZABBIX
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation Ltd. All Rights Reserved.
**
** 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.
**/
/*
** $Date:: 2014-10-17 16:00:02 +0900 #$
** $Revision: 6528 $
** $Author: nagata@FITECHLABS.CO.JP $
**/
#include "common.h"
#include "log.h"
#include "db.h"
#include "jacommon.h"
#include "javalue.h"
#include "jastatus.h"
#include "jastr.h"
#include "jalog.h"
/******************************************************************************
* *
* Function: *
* *
* Purpose: *
* *
* Parameters: *
* *
* Return value: *
* *
* Comments: *
* *
******************************************************************************/
int jajobnet_ready(const zbx_uint64_t inner_jobnet_id)
{
DB_RESULT result;
DB_ROW row;
zbx_uint64_t icon_start_id;
int count;
char time_str[13];
const char *__function_name = "jajobnet_ready";
zabbix_log(LOG_LEVEL_DEBUG,
"In %s() inner_jobnet_id: " ZBX_FS_UI64, __function_name,
inner_jobnet_id);
// set jobnet before value
result =
DBselect
("select jobnet_id, jobnet_name, user_name, inner_jobnet_id, main_flag, scheduled_time"
" from ja_run_jobnet_table"
" where inner_jobnet_id = " ZBX_FS_UI64, inner_jobnet_id);
if (NULL != (row = DBfetch(result))) {
ja_set_value_jobnet_before(inner_jobnet_id, "JOBNET_ID", row[0]);
ja_set_value_jobnet_before(inner_jobnet_id, "JOBNET_NAME", row[1]);
ja_set_value_jobnet_before(inner_jobnet_id, "USER_NAME", row[2]);
ja_set_value_jobnet_before(inner_jobnet_id, "MANAGEMENT_ID", row[3]);
} else {
ja_log("JAJOBNETREADY200001", inner_jobnet_id, NULL, 0,
__function_name, inner_jobnet_id);
DBfree_result(result);
return ja_set_enderr_jobnet(inner_jobnet_id);
}
if (atoi(row[4]) == JA_JOBNET_MAIN_FLAG_MAIN) {
zbx_snprintf(time_str, sizeof(time_str), "%s", ja_timestamp2str(time(NULL)));
ja_set_value_jobnet_before(inner_jobnet_id, "JOBNET_BOOT_TIME", time_str);
if (atoi(row[5]) == 0) {
ja_set_value_jobnet_before(inner_jobnet_id, "JOBNET_SCHEDULED_TIME", "");
}
else {
ja_set_value_jobnet_before(inner_jobnet_id, "JOBNET_SCHEDULED_TIME", row[5]);
}
}
DBfree_result(result);
// set jobnet status
if (ja_set_run_jobnet(inner_jobnet_id) == FAIL)
return FAIL;
// search start icon
count = 0;
icon_start_id = 0;
result =
DBselect
("select inner_job_id from ja_run_job_table"
" where inner_jobnet_id = " ZBX_FS_UI64 " and job_type = %d ",
inner_jobnet_id, JA_JOB_TYPE_START);
while (NULL != (row = DBfetch(result))) {
count++;
if (count == 1)
ZBX_STR2UINT64(icon_start_id, row[0]);
else
icon_start_id = 0;
}
DBfree_result(result);
if (icon_start_id == 0) {
ja_log("JAJOBNETREADY200002", inner_jobnet_id, NULL, 0,
__function_name, count, inner_jobnet_id);
return ja_set_enderr_jobnet(inner_jobnet_id);
} else {
if (ja_value_before_jobnet_out(inner_jobnet_id, icon_start_id) ==
FAIL)
return FAIL;
if (ja_set_status_job
(icon_start_id, JA_JOB_STATUS_READY, 0, 0) == FAIL)
return FAIL;
}
return SUCCEED;
}
|
#ifndef StGermain_SobolGeneratorSuite_h
#define StGermain_SobolGeneratorSuite_h
void SobolGeneratorSuite( pcu_suite_t* suite );
#endif
|
/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | \\._.// *
* -----------------------------------------------------------| (0...0) *
* SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by Derek Snider | ).:.( *
* -----------------------------------------------------------| {o o} *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, | / ' ' \ *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek, |~'~.VxvxV.~'~*
* Tricops and Fireblade | *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* ------------------------------------------------------------------------ *
* Auction bid parsing routines *
****************************************************************************/
#include <ctype.h>
/*
* The following code was written by Erwin Andreasen for the automated
* auction command.
*
* Completely cleaned up by Thoric
*/
/*
util function, converts an 'advanced' ASCII-number-string into a number.
Used by parsebet() but could also be used by do_give or do_wimpy.
Advanced strings can contain 'k' (or 'K') and 'm' ('M') in them, not just
numbers. The letters multiply whatever is left of them by 1,000 and
1,000,000 respectively. Example:
14k = 14 * 1,000 = 14,000
23m = 23 * 1,000,0000 = 23,000,000
If any digits follow the 'k' or 'm', the are also added, but the number
which they are multiplied is divided by ten, each time we get one left. This
is best illustrated in an example :)
14k42 = 14 * 1000 + 14 * 100 + 2 * 10 = 14420
Of course, it only pays off to use that notation when you can skip many 0's.
There is not much point in writing 66k666 instead of 66666, except maybe
when you want to make sure that you get 66,666.
More than 3 (in case of 'k') or 6 ('m') digits after 'k'/'m' are automatically
disregarded. Example:
14k1234 = 14,123
If the number contains any other characters than digits, 'k' or 'm', the
function returns 0. It also returns 0 if 'k' or 'm' appear more than
once.
*/
int advatoi( char *s )
{
int number = 0; /* number to be returned */
int multiplier = 0; /* multiplier used to get the extra digits right */
/*
* as long as the current character is a digit add to current number
*/
while( isdigit( s[0] ) )
number = ( number * 10 ) + ( *s++ - '0' );
switch ( UPPER( s[0] ) )
{
case 'K':
number *= ( multiplier = 1000 );
++s;
break;
case 'M':
number *= ( multiplier = 1000000 );
++s;
break;
case '\0':
break;
default:
return 0; /* not k nor m nor NULL - return 0! */
}
/*
* if any digits follow k/m, add those too
*/
while( isdigit( s[0] ) && ( multiplier > 1 ) )
{
/*
* the further we get to right, the less the digit 'worth'
*/
multiplier /= 10;
number = number + ( ( *s++ - '0' ) * multiplier );
}
/*
* return 0 if non-digit character was found, other than NULL
*/
if( s[0] != '\0' && !isdigit( s[0] ) )
return 0;
/*
* anything left is likely extra digits (ie: 14k4443 -> 3 is extra)
*/
return number;
}
/*
This function allows the following kinds of bets to be made:
Absolute bet
============
bet 14k, bet 50m66, bet 100k
Relative bet
============
These bets are calculated relative to the current bet. The '+' symbol adds
a certain number of percent to the current bet. The default is 25, so
with a current bet of 1000, bet + gives 1250, bet +50 gives 1500 etc.
Please note that the number must follow exactly after the +, without any
spaces!
The '*' or 'x' bet multiplies the current bet by the number specified,
defaulting to 2. If the current bet is 1000, bet x gives 2000, bet x10
gives 10,000 etc.
*/
int parsebet( const int currentbet, char *s )
{
/*
* check to make sure it's not blank
*/
if( s[0] != '\0' )
{
/*
* if first char is a digit, use advatoi
*/
if( isdigit( s[0] ) )
return ( advatoi( s ) );
if( s[0] == '+' ) /* add percent (default 25%) */
{
if( s[1] == '\0' )
return ( currentbet * 125 ) / 100;
return ( currentbet * ( 100 + atoi( s + 1 ) ) ) / 100;
}
if( s[0] == '*' || s[0] == 'x' ) /* multiply (default is by 2) */
{
if( s[1] == '\0' )
return ( currentbet * 2 );
return ( currentbet * atoi( s + 1 ) );
}
}
return 0;
}
|
#define _USE_MATH_DEFINES
#include <math.h>
void
rszset(float SR, float cf, float bw, float xinit, float *a)
{
double exp(),cos();
int i;
a[0]=exp(-M_PI*bw/SR);
a[1]=1.-a[0];
a[2]=2.*a[0]*cos(2.*M_PI*cf/SR);
a[3] = -a[0]*a[0];
if(!xinit) for(i=4; i<9; i++) a[i]=0.;
}
float resonz(float sig, float *a)
{
float z;
z=a[1]*(sig-a[0]*a[4])+a[2]*a[5]+a[3]*a[6];
a[4]=a[8];
a[8]=sig;
a[6]=a[5];
a[5]=z;
return(z);
}
void bresonz(float *sig, float *a, float *out, int count)
{
float z;
int i;
for(i=0; i<count; i++) {
z=a[1]*(sig[i]-a[0]*a[4])+a[2]*a[5]+a[3]*a[6];
a[4]=a[8];
a[8]=sig[i];
a[6]=a[5];
out[i] = a[5] = z;
}
}
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "framebuffer/fb_draw.h"
#include "image2screen.h"
static int fb0;
static void *fbdata_buf = NULL;
static int fbdata_bufsize = 0;
extern void image2screen_init(char *fb_file)
{
fb_open(fb_file);
fbdata_bufsize = fb_bufsize();
printf("The buffer size of fb is: %d bytes\n", fbdata_bufsize);
#ifdef __DEBUG__
fb_printinfo();
#endif
//fbdata_buf = malloc(fbdata_bufsize);
}
extern void *image2screen_allocbuf(void)
{
return malloc(fbdata_bufsize);
}
extern void image2screen_freebuf(void *buf)
{
return free(buf);
}
extern void image2screen_destroy(void)
{
fb_close();
if (fbdata_buf)
{
free(fbdata_buf);
}
}
extern int image2screen_dispimg(void *buf)
{
//int ret = fb_getfbdata(buf);
int ret = fb_putrawimg(buf, fbdata_bufsize);
//printf("data gotten.\n");
return ret;
}
extern void image2screen_getscreensize(int *width, int *height)
{
*width = xres();
*height = yres();
}
extern int image2screen_getscreenbpp(void)
{
return fb_bpp();
}
struct pixel_rgb16 {
unsigned int blue : 5;
unsigned int green : 6;
unsigned int red : 5;
}__attribute__((packed));
struct pixel_rgb24 {
unsigned int red : 8;
unsigned int green : 8;
unsigned int blue : 8;
}__attribute__((packed));
union rgb16_short {
short data;
struct pixel_rgb16 pixel;
};
union rgb24_int {
int data : 24;
struct pixel_rgb24 pixel;
};
extern int image2screen_pixel16to24pack(void *old_buf, int img_size,
void *new_buf, int buf_size)
{
int index;
int num_pixel;
struct pixel_rgb16 *p16 = old_buf;
struct pixel_rgb24 *p24 = new_buf;
num_pixel = img_size / 3;
if (buf_size < num_pixel * 2)
{
return -1;
}
for (index = 0; index < num_pixel; index++, p16++, p24++)
{
p24->red = p16->red << 3;
p24->green = p16->green << 2;
p24->blue = p16->blue << 3;
}
return 0;
}
extern void image2screen_wriatetofile()
{
if (ret < 0)
{
perror("when write framebuffer data to file:");
return ;
}
}
|
/*******************************************************************************
*
*
* Copyright 2006, Huawei Technologies Co. Ltd.
* ALL RIGHTS RESERVED
*
*-------------------------------------------------------------------------------
*
* mbuf.h
*
* Project Code: VISPV100R005
* Module Name: Mbuf
* Date Created: 2000-3-25
* Author: zhang hong yan(19316)
* Description: ´ËÎļþ¶¨ÒåMbufÏà¹ØµÄºêºÍÊý¾Ý½á¹¹
*
*-------------------------------------------------------------------------------
* Modification History
* DATE NAME DESCRIPTION
* -----------------------------------------------------------------------------
* 2000-3-25 zhang hong yan(19316) Creat the first version.
* 2006-4-27 wang xin(03278) ¸ù¾Ý±à³Ì¹æ·¶£¬¶ÔÎļþ½øÐй淶»¯ÕûÀí
* 2006-05-10 lu yao(60000758) Ϊ֧³ÖARM CPU×Ö½Ú¶ÔÆëÌØÐÔ£¬Ð޸Ľṹ¡£
* 2006-07-06 xiehuaguo ÐÞ¸ÄMBUF State×ֶθ³ÖµµÄ¿ª¹ØÖжϱ£»¤ A82d03169
*******************************************************************************/
#include "tcpip/public/arith_cbb/include/mbuf.h"
|
/**
******************************************************************************
* @file TIM/TIM_InputCapture/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.1.0
* @date 26-June-2014
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx_it.h"
/** @addtogroup STM32F4xx_HAL_Examples
* @{
*/
/** @addtogroup TIM_InputCapture
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
extern TIM_HandleTypeDef TimHandle;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
HAL_IncTick();
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles TIM1 global interrupt request.
* @param None
* @retval None
*/
void TIMx_IRQHandler(void)
{
HAL_TIM_IRQHandler(&TimHandle);
}
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* STMicrolectronics STiG125 SoC audio glue driver
*
* Copyright (c) 2012-2013 STMicroelectronics Limited
*
* Authors: John Boddie <john.boddie@st.com>
* Japneet Chhatwal <Japneet.chhatwal@st.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/stm/sysconf.h>
#include <linux/stm/stig125.h>
#include <linux/stm/platform.h>
#include <linux/stm/soc.h>
#include <sound/core.h>
#include "common.h"
/*
* Audio pad configuration.
*/
static struct stm_pad_config snd_stm_stig125_pad_config = {
.sysconfs_num = 5,
.sysconfs = (struct stm_pad_sysconf []) {
/* Set bi-phase idle value */
STM_PAD_SYSCONF(SYSCONF(918), 8, 8, 0),
/* Select pcm reader input from pads (1 = player #1) */
STM_PAD_SYSCONF(SYSCONF(918), 6, 6, 0),
/* Route player #1 to ext dac (pio) */
STM_PAD_SYSCONF(SYSCONF(918), 3, 5, 1),
/* Set ext dac clock to player #1 */
STM_PAD_SYSCONF(SYSCONF(918), 1, 2, 1),
/* Ensure ext dac clock not inverted */
STM_PAD_SYSCONF(SYSCONF(918), 0, 0, 0),
},
};
/*
* Power management.
*/
#ifdef CONFIG_HIBERNATION
static int snd_stm_stig125_restore(struct device *dev)
{
struct stm_pad_state *pad_state = dev_get_drvdata(dev);
dev_dbg(dev, "%s()", __func__);
stm_pad_setup(pad_state);
return 0;
}
static const struct dev_pm_ops snd_stm_stig125_pm_ops = {
.thaw = snd_stm_stig125_restore,
.restore = snd_stm_stig125_restore,
};
#else
static const struct dev_pm_ops snd_stm_stig125_pm_ops;
#endif
/*
* Driver functions.
*/
static int __devinit snd_stm_stig125_probe(struct platform_device *pdev)
{
int result;
struct stm_pad_state *pad_state;
dev_dbg(&pdev->dev, "%s()", __func__);
if (!stm_soc_is_stig125()) {
dev_err(&pdev->dev, "Unsupported (not STiG125) SOC detected!");
result = -EINVAL;
goto error_soc_type;
}
/* Claim all of the sysconf fields and initialise */
pad_state = stm_pad_claim(&snd_stm_stig125_pad_config,
"ALSA Glue Logic");
if (!pad_state) {
dev_err(&pdev->dev, "Failed to claim ALSA sysconf pads");
return -EBUSY;
goto error_pad_claim;
}
/* Register the sound card */
result = snd_stm_card_register(SND_STM_CARD_TYPE_ALL);
if (result) {
dev_err(&pdev->dev, "Failed to register all ALSA audio cards!");
goto error_card_register;
}
/* Save the pad state as driver data */
dev_set_drvdata(&pdev->dev, pad_state);
return 0;
error_card_register:
stm_pad_release(pad_state);
error_pad_claim:
error_soc_type:
return result;
}
static int __devexit snd_stm_stig125_remove(struct platform_device *pdev)
{
struct stm_pad_state *pad_state = dev_get_drvdata(&pdev->dev);
dev_dbg(&pdev->dev, "%s()", __func__);
stm_pad_release(pad_state);
return 0;
}
static struct platform_driver snd_stm_stig125_driver = {
.driver.name = "snd_stig125",
.driver.pm = &snd_stm_stig125_pm_ops,
.probe = snd_stm_stig125_probe,
.remove = snd_stm_stig125_remove,
};
/*
* Module initialistaion.
*/
static struct platform_device snd_stm_stig125_devices = {
.name = "snd_stig125",
.id = -1,
};
static int __init snd_stm_stig125_init(void)
{
int result;
/* Add the STiG125 audio glue platform device */
result = platform_device_register(&snd_stm_stig125_devices);
BUG_ON(result);
/* Register the platform driver */
result = platform_driver_register(&snd_stm_stig125_driver);
BUG_ON(result);
return 0;
}
static void __exit snd_stm_stig125_exit(void)
{
platform_device_unregister(&snd_stm_stig125_devices);
platform_driver_unregister(&snd_stm_stig125_driver);
}
MODULE_AUTHOR("Japneet Chhatwal <japneet.chhatwal@st.com>");
MODULE_DESCRIPTION("STMicroelectronics STiG125 audio glue driver");
MODULE_LICENSE("GPL");
module_init(snd_stm_stig125_init);
module_exit(snd_stm_stig125_exit);
|
/*
* lib/reed_solomon/encode_rs.c
*
* Overview:
* Generic Reed Solomon encoder / decoder library
*
* Copyright 2002, Phil Karn, KA9Q
* May be used under the terms of the GNU General Public License (GPL)
*
* Adaption to the kernel by Thomas Gleixner (tglx@linutronix.de)
*
* $Id: encode_rs.c 2 2007-04-05 08:51:12Z tt $
*
*/
/* Generic data width independent code which is included by the
* wrappers.
* int encode_rsX (struct rs_control *rs, uintX_t *data, int len, uintY_t *par)
*/
{
int i, j, pad;
int nn = rs->nn;
int nroots = rs->nroots;
uint16_t *alpha_to = rs->alpha_to;
uint16_t *index_of = rs->index_of;
uint16_t *genpoly = rs->genpoly;
uint16_t fb;
uint16_t msk = (uint16_t) rs->nn;
/* Check length parameter for validity */
pad = nn - nroots - len;
if (pad < 0 || pad >= nn)
return -ERANGE;
for (i = 0; i < len; i++) {
fb = index_of[((((uint16_t) data[i])^invmsk) & msk) ^ par[0]];
/* feedback term is non-zero */
if (fb != nn) {
for (j = 1; j < nroots; j++) {
par[j] ^= alpha_to[rs_modnn(rs, fb +
genpoly[nroots - j])];
}
}
/* Shift */
memmove(&par[0], &par[1], sizeof(uint16_t) * (nroots - 1));
if (fb != nn) {
par[nroots - 1] = alpha_to[rs_modnn(rs,
fb + genpoly[0])];
} else {
par[nroots - 1] = 0;
}
}
return 0;
}
|
/***************************************************************************
qgsvectorlayerdiagramprovider.h
--------------------------------------
Date : September 2015
Copyright : (C) 2015 by Martin Dobias
Email : wonder dot sk at gmail dot 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. *
* *
***************************************************************************/
#ifndef QGSVECTORLAYERDIAGRAMPROVIDER_H
#define QGSVECTORLAYERDIAGRAMPROVIDER_H
#include "qgis_core.h"
#include "qgslabelingengine.h"
#include "qgslabelfeature.h"
#include "qgsdiagramrenderer.h"
/** \ingroup core
* Class that adds extra information to QgsLabelFeature for labeling of diagrams
*
* \note this class is not a part of public API yet. See notes in QgsLabelingEngine
* \note not available in Python bindings
*/
class QgsDiagramLabelFeature : public QgsLabelFeature
{
public:
//! Create label feature, takes ownership of the geometry instance
QgsDiagramLabelFeature( QgsFeatureId id, GEOSGeometry *geometry, QSizeF size )
: QgsLabelFeature( id, geometry, size ) {}
//! Store feature's attributes - used for rendering of diagrams
void setAttributes( const QgsAttributes &attrs ) { mAttributes = attrs; }
//! Get feature's attributes - used for rendering of diagrams
const QgsAttributes &attributes() { return mAttributes; }
protected:
//! Stores attribute values for diagram rendering
QgsAttributes mAttributes;
};
class QgsAbstractFeatureSource;
/** \ingroup core
* \brief The QgsVectorLayerDiagramProvider class implements support for diagrams within
* the labeling engine. Parameters for the diagrams are taken from the layer settings.
*
* \since QGIS 2.12
* \note this class is not a part of public API yet. See notes in QgsLabelingEngine
* \note not available in Python bindings
*/
class CORE_EXPORT QgsVectorLayerDiagramProvider : public QgsAbstractLabelProvider
{
public:
//! Convenience constructor to initialize the provider from given vector layer
explicit QgsVectorLayerDiagramProvider( QgsVectorLayer *layer, bool ownFeatureLoop = true );
//! Clean up
~QgsVectorLayerDiagramProvider();
virtual QList<QgsLabelFeature *> labelFeatures( QgsRenderContext &context ) override;
virtual void drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const override;
// new virtual methods
/**
* Prepare for registration of features. Must be called after provider has been added to engine (uses its map settings)
* \param context render context.
* \param attributeNames list of attribute names to which additional required attributes shall be added
* \returns Whether the preparation was successful - if not, the provider shall not be used
*/
virtual bool prepare( const QgsRenderContext &context, QSet<QString> &attributeNames );
/**
* Register a feature for labeling as one or more QgsLabelFeature objects stored into mFeatures
*
* \param feature feature for diagram
* \param context render context. The QgsExpressionContext contained within the render context
* must have already had the feature and fields sets prior to calling this method.
* \param obstacleGeometry optional obstacle geometry, if a different geometry to the feature's geometry
* should be used as an obstacle for labels (e.g., if the feature has been rendered with an offset point
* symbol, the obstacle geometry should represent the bounds of the offset symbol). If not set,
* the feature's original geometry will be used as an obstacle for labels. Ownership of obstacleGeometry
* is transferred.
*/
virtual void registerFeature( QgsFeature &feature, QgsRenderContext &context, QgsGeometry *obstacleGeometry = nullptr );
protected:
//! initialization method - called from constructors
void init();
//! helper method to register one diagram feautre
QgsLabelFeature *registerDiagram( QgsFeature &feat, QgsRenderContext &context, QgsGeometry *obstacleGeometry = nullptr );
protected:
//! Diagram layer settings
QgsDiagramLayerSettings mSettings;
//! Diagram renderer instance (owned by mSettings)
QgsDiagramRenderer *mDiagRenderer = nullptr;
// these are needed only if using own renderer loop
//! Layer's fields
QgsFields mFields;
//! Layer's CRS
QgsCoordinateReferenceSystem mLayerCrs;
//! Layer's feature source
QgsAbstractFeatureSource *mSource = nullptr;
//! Whether layer's feature source is owned
bool mOwnsSource;
//! List of generated label features (owned by the provider)
QList<QgsLabelFeature *> mFeatures;
};
#endif // QGSVECTORLAYERDIAGRAMPROVIDER_H
|
/* __LICENSE_HEADER_BEGIN__ */
/*
* Copyright (C) 2009-2011 Emmanuel Roullit <emmanuel@netsniff-ng.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 St, Fifth Floor, Boston, MA 02110, USA
*
*/
/* __LICENSE_HEADER_END__ */
#include <netcore-ng/init.h>
#include <netcore-ng/dissector/ethernet/dissector.h>
int netcore_init(const enum display_type dtype)
{
return (ethernet_dissector_init(dtype));
}
void netcore_destroy(void)
{
ethernet_dissector_destroy();
}
|
/*
Copyright (C) 2004 Michael Liebscher <wolf3d.redux@gmail.com>
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file com_string.h
* \brief String functions done in a portable manner.
* \author Michael Liebscher
* \date 2004-2012
* \author Todd C. Miller
* \date 2004-2006
* \note Portion of this code was derived from code that was originally written by Todd C. Miller.
*/
#ifndef __COM_STRING_H__
#define __COM_STRING_H__
#include <stdlib.h>
#include "platform.h"
#define ISSPACE( c ) ( ( c ) == ' ' || ( c ) == '\f' || ( c ) == '\n' || ( c ) == '\r' || ( c ) == '\t' || ( c ) == '\v' )
#define ISUPPER( c ) ( ( c ) >= 'A' && ( c ) <= 'Z' )
#define ISLOWER( c ) ( ( c ) >= 'a' && ( c ) <= 'z' )
#define ISALPHA( c ) ( ISUPPER( c ) || ISLOWER( c ) )
#define TOUPPER( c ) ( ISLOWER( c ) ? (c) - 'a' + 'A' : ( c ) )
#define TOLOWER( c ) ( ISUPPER( c ) ? (c) - 'A' + 'a' : ( c ) )
#define ISNUMERIC( c ) ( ( c ) >= '0' && ( c ) <= '9' )
#define ISALPHANUMERIC( c ) ( ISALPHA( c ) || ISNUMERIC( c ) )
size_t com_strlcpy( char *dest, const char *source, size_t nMaxLength );
size_t com_strlcat( char *dest, const char *source, size_t nMaxLength );
int com_stricmp( const char *string1, const char *string2 );
int com_strnicmp( const char *string1, const char *string2, size_t count );
void com_snprintf( char *dest, size_t size, const char *format, ... );
char *com_strcopy( const char *in );
W32 com_strhash( const char *string );
char *com_strupr( char *string );
char *com_strlwr( char *string );
/* String conversion error */
#define SCE_NON_NUMERIC (1 << 0) /* Non-numeric value was encountered */
#define SCE_BUFFER_OVERFLOW (1 << 1) /* Numberic overflowed */
#define SCE_NULL_VALUE (1 << 2) /* NULL string was passed into function */
SW32 StringToInteger( const char *string, W32 *error );
double StringToFloat( const char *string, W32 *error );
char *va( char *format, ... );
char *com_parse( char **data_p );
#endif /* __COM_STRING_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2008-2009 coresystems GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; version 2 of
* the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <device/pci_ops.h>
#include <device/pci_def.h>
#include "pch.h"
/* HCD_INDEX == 2 selects 0:1a.0 (PCH_EHCI2), any other index
* selects 0:1d.0 (PCH_EHCI1) for usbdebug use.
*/
#if CONFIG_USBDEBUG_HCD_INDEX != 2
#define PCH_EHCI1_TEMP_BAR0 CONFIG_EHCI_BAR
#define PCH_EHCI2_TEMP_BAR0 (PCH_EHCI1_TEMP_BAR0 + 0x400)
#else
#define PCH_EHCI2_TEMP_BAR0 CONFIG_EHCI_BAR
#define PCH_EHCI1_TEMP_BAR0 (PCH_EHCI2_TEMP_BAR0 + 0x400)
#endif
/*
* Setup USB controller MMIO BAR to prevent the
* reference code from resetting the controller.
*
* The BAR will be re-assigned during device
* enumeration so these are only temporary.
*/
static void enable_usb_bar_on_device(pci_devfn_t dev, u32 bar)
{
u32 cmd;
pci_write_config32(dev, PCI_BASE_ADDRESS_0, bar);
cmd = pci_read_config32(dev, PCI_COMMAND);
cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
pci_write_config32(dev, PCI_COMMAND, cmd);
}
void enable_usb_bar(void)
{
enable_usb_bar_on_device(PCH_EHCI1_DEV, PCH_EHCI1_TEMP_BAR0);
if (!pch_is_lp())
enable_usb_bar_on_device(PCH_EHCI2_DEV, PCH_EHCI2_TEMP_BAR0);
}
|
/*
High Adventure 3D Game Engine
Copyright (C) 2002 Rodney Degracia
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
rodney_degracia(at)elitefrontier.com
Rodney Degracia
316 Independence Ave. SE
Washington DC 2003
*/
#pragma once
#include "Vector.h"
#include "Geometry.h"
#include "GeometryTrait.h"
#include "ComponentTrait.h"
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//Forward Declarations
template<typename T>
class Vector1x3;
template<typename T>
class Vector3x1;
template <typename T,
typename ComponentTrait,
typename GeometryTrait=StandardEuclidean>
class LinearComponent;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//Distance Calculation Function Template Definitions
template <typename T,
typename TransformationTrait>
T CalcDistance(const HomogeneousCoordinate<T,TransformationTrait>& point1, const HomogeneousCoordinate<T,TransformationTrait>& point2)
{
HomogeneousCoordinate<T,TransformationTrait> P(point1-point2);
return P.Magnitude();
}
template <typename T>
T CalcDistance(const Vector3x1<T>& point1, const Vector3x1<T>& point2)
{
Vector3x1<T> P(point1-point2);
return P.Magnitude();
}
/*
template<typename T>
T CalcDistance(const Point<T,GeometryTrait>& point, const LinearComponent<T,Ray>& linearcomponent)
{
T t0=Dot<float,3,3>(linearcomponent.m_M,(point.m_P-linearcomponent.m_B))/
Dot<float>(linearcomponent.m_M,linearcomponent.m_M);
if(t0<=0.0f) //Behind the Ray startpoint
{
typename GeometryTrait::Vector v(point.m_P-linearcomponent.m_B);
return (v.Magnitude());
}
else //Anywhere in front of the Ray startpoint
{
typename GeometryTrait::Vector v(point.m_P-(linearcomponent.m_B-(t0*linearcomponent.m_M)));
return (v.Magnitude());
}
}
template<typename T,
typename GeometryTrait>
T CalcDistance(const Point<T>& point, const LinearComponent<T,Segment>& linearcomponent)
{
T t0=Dot<float>(linearcomponent.m_M,(point.m_P-linearcomponent.m_B))/
Dot<float>(linearcomponent.m_M,linearcomponent.m_M);
if(t0<=0.0f) //Behind the starting point of the segment
{
typename GeometryTrait::Vector v(point.m_P-linearcomponent.m_B);
return (v.Magnitude());
}
else if (t0>0 && t0<1) //Within the start and endpoints of the segment
{
typename GeometryTrait::Vector v(point.m_P-(linearcomponent.m_B-(t0*linearcomponent.m_M)));
return (v.Magnitude());
}
else //Beyond the endpoint of the segment
{
typename GeometryTrait::Vector v(point.m_P-(linearcomponent.m_B-linearcomponent.m_M)));
return (v.Magnitude());
}
}
template<typename T,
typename class GeometryTrait>
T CalcDistance(const Point<T>& point, const LinearComponent<T,Line>& linearcomponent)
{
T t0=Vector<float,3,1>::Dot(linearcomponent.m_M,(point.m_P-linearcomponent.m_B))/
Vector<float,3,1>::Dot(linearcomponent.m_M,linearcomponent.m_M);
//Since we have a line, we don't care if t0 is positive, negative, or zero
typename GeometryTrait::Vector v(point.m_P-(linearcomponent.m_B-(t0*linearcomponent.m_M)));
return (v.Magnitude());
}
template<typename T,
typename GeometryTrait>
T CalcDistance(const LinearComponent<T,Line>& lc0, const LinearComponent<T,Line>& lc1)
{
T a=Dot<T>(lc0.m_M,lc0.m_M);
T b=-(Dot<T>(lc0.m_M,lc1.m_M));
T c=Dot<T>(lc1.m_M,lc1.m_M);
T d=Dot<T>(lc0.m_M,(lc0.m_B-lc1.m_B));
T e=-(Dot<T>(lc1.m_M,(lc0.m_B-lc1.m_B)));
T f=Dot<T>((lc0.m_B-lc1.m_B),(lc0.m_B-lc1.m_B));
T det=abs(a*c-b*b);
//Always greaterthan or equal to zero
assert((det>0)||(det==0));
//TODO:
//Check accuracy of det
if (det>0) //Lines are not parallel
{
float invdet=1/det;
s=(b*e-c*d)*invdet;
t=(b*d-a*e)*invdet;
return s*(a*s+b*t+2*d)+t*(b*s+c*t+2*e)+f;
}
else //Lines are parallel
{
s=-d/a;
t=0;
return d*s+f;
}
}
*/
|
//
// Copyright (C) 2002-2008 Simon Howard
//
// 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.
//
//
// Callbacks
//
#ifndef IRMO_WORLD_CLASS_CALLBACK_DATA_H
#define IRMO_WORLD_CLASS_CALLBACK_DATA_H
/*!
* Class callback data.
*
* This structure encapsulates the different callback lists used to
* watch events related to all objects of a particular class. This
* is an extension of the @ref ObjectCallbackData structure (it also
* monitors creation of new objects).
*
* Each @ref IrmoWorld has a class callback structure for each class
* in the interface used by the world, plus a "top-level" class
* callback structure for monitoring events related to objects of
* all classes.
*/
typedef struct _ClassCallbackData ClassCallbackData;
#include "interface/class.h"
#include "object-callback-data.h"
struct _ClassCallbackData {
// Class that this applies to.
IrmoClass *klass;
// Parent class callback data structure.
// For the top-level callbacks structure, this is NULL.
ClassCallbackData *parent_data;
// List of callbacks for watching creation of new objects.
IrmoCallbackList new_callbacks;
// Other callback lists in common with those used for
// object callbacks.
ObjectCallbackData object_callbacks;
};
/*!
* Initialise a @ref ClassCallbackData structure.
*
* @param data The structure to initialise.
* @param parent_data Structure for the parent class of this class.
* @param klass The class for this structure.
*/
void irmo_class_callback_init(ClassCallbackData *data,
ClassCallbackData *parent_data,
IrmoClass *klass);
/*!
* Free data used for the specified @ref ClassCallbackData.
*
* @param data The structure.
*/
void irmo_class_callback_free(ClassCallbackData *data);
/*!
* Invoke callback functions in response to a variable of an object belonging
* to a particular class being changed.
*
* @param data The @ref ClassCallbackData for the class.
* @param object The object that was changed.
* @param variable_index The index of the variable that was changed.
*/
void irmo_class_callback_raise(ClassCallbackData *data,
IrmoObject *object,
unsigned int variable_index);
/*!
* Invoke callback functions in response to an object of a particular class
* being destroyed.
*
* @param data The @ref ClassCallbackData for the class.
* @param object The object being destroyed.
*/
void irmo_class_callback_raise_destroy(ClassCallbackData *data,
IrmoObject *object);
/*!
* Invoke callback functions in response to an object of a particular class
* being created.
*
* @param data The @ref ClassCallbackData for the class.
* @param object The new object.
*/
void irmo_class_callback_raise_new(ClassCallbackData *data,
IrmoObject *object);
/*!
* Watch for changes to variables of objects of a particular class.
*
* @param data The @ref ClassCallbackData for the class.
* @param variable_name Name of the variable to watch, or NULL
* to watch for changes to all variables.
* @param func The callback function to invoke.
* @param user_data Extra data to pass to the callback function.
* @return @ref IrmoCallback object to return representing
* the callback.
*/
IrmoCallback *irmo_class_callback_watch(ClassCallbackData *data,
char *variable_name,
IrmoVarCallback func,
void *user_data);
/*!
* Watch for when objects of a particular class are instantiated.
*
* @param data The @ref ClassCallbackData for the class.
* @param func The callback function to invoke.
* @param user_data Extra data to pass to the callback function.
* @return @ref IrmoCallback object to return representing
* the callback.
*/
IrmoCallback *irmo_class_callback_watch_new(ClassCallbackData *data,
IrmoObjCallback func,
void *user_data);
/*!
* Watch for when objects of a particular class are destroyed.
*
* @param data The @ref ClassCallbackData for the class.
* @param func The callback function to invoke.
* @param user_data Extra data to pass to the callback function.
* @return @ref IrmoCallback object to return representing
* the callback.
*/
IrmoCallback *irmo_class_callback_watch_destroy(ClassCallbackData *data,
IrmoObjCallback func,
void *user_data);
#endif /* #ifndef IRMO_WORLD_CLASS_CALLBACK_DATA_H */
|
// Query.h: interface for the CQuery class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_QUERY_H__8A3116E5_E735_4FF9_A61D_5566130C3610__INCLUDED_)
#define AFX_QUERY_H__8A3116E5_E735_4FF9_A61D_5566130C3610__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "../Network/TSynchro.h"
#define MAX_COLUMNS 100
class CQuery
{
public:
CQuery();
virtual ~CQuery();
BOOL Connect(LPTSTR lpszDNS, LPTSTR lpszUser, LPTSTR lpszPassword);
BOOL ExecQuery(LPTSTR lpszStatement, ...);
void Close();
void GetAsString(LPTSTR ColName, LPTSTR pOutBuffer,int size);
void GetAsString(LPTSTR ColName, LPTSTR pOutBuffer);
DWORD GetAsInteger(LPTSTR ColName);
__int64 GetAsInteger64(LPTSTR ColName);
float GetAsFloat(LPTSTR ColName);
void Disconnect();
int GetAsBinary(LPSTR lpszStatement, LPBYTE OUT lpszReturnBuffer);
SQLRETURN Fetch();
int GetResult(int iIndex);
#ifdef _WIN64
void SetAsBinary(LPTSTR lpszStatement, LPBYTE lpBinaryBuffer, SQLLEN BinaryBufferSize);
#else
void SetAsBinary(LPTSTR lpszStatement, LPBYTE lpBinaryBuffer, SQLUINTEGER BinaryBufferSize);
#endif
private:
BOOL ReConnect();
int FindIndex(LPTSTR ColName);
void Diagnosis();
//CRITICAL_SECTION m_criti;
TSynchroCriticalSection Sync;
bool b_criti;
protected:
SQLHANDLE m_hEnviroment;
SQLHANDLE m_hConnection;
SQLHANDLE m_hStmt;
TCHAR m_szDNS[64];
TCHAR m_szUser[64];
TCHAR m_szPassword[64];
SQLSMALLINT m_ColCount;
SQLTCHAR m_SQLColName[MAX_COLUMNS][30];
TCHAR m_SQLData[MAX_COLUMNS][256];
#ifdef _WIN64
SQLLEN m_SQLDataLen[MAX_COLUMNS];
#else
SQLINTEGER m_SQLDataLen[MAX_COLUMNS];
#endif
};
#endif // !defined(AFX_QUERY_H__8A3116E5_E735_4FF9_A61D_5566130C3610__INCLUDED_)
|
/*
Copyright (c) 2009 Michael Leupold <lemma@confuego.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.
*/
#ifndef MAILCOMMON_MDNADVICEDIALOG_H
#define MAILCOMMON_MDNADVICEDIALOG_H
#include "mailcommon_export.h"
#include <messagecomposer/helper/messagefactory.h>
#include <KMime/KMimeMessage>
#include <KDialog>
namespace MailCommon {
class MAILCOMMON_EXPORT MDNAdviceHelper : public QObject
{
Q_OBJECT
public:
static MDNAdviceHelper *instance()
{
if ( !s_instance ) {
s_instance = new MDNAdviceHelper;
}
return s_instance;
}
/**
* Checks the MDN headers to see if the user needs to be asked for any
* confirmations. Will ask the user if action is required.
*
* Returns whether to send an MDN or not, and the sending mode for the MDN
* to be created.
*
* Will also set the MessageCore::MDNStateAttribute on the given item
* to what the user has selected.
*/
QPair<bool, KMime::MDN::SendingMode>checkAndSetMDNInfo(
const Akonadi::Item &item, KMime::MDN::DispositionType d, bool forceSend=false );
MessageCore::MDNStateAttribute::MDNSentState dispositionToSentState(
KMime::MDN::DispositionType d );
private:
explicit MDNAdviceHelper( QObject *parent = 0 )
{
Q_UNUSED( parent );
}
virtual ~MDNAdviceHelper()
{
}
int requestAdviceOnMDN( const char *what );
MessageComposer::MDNAdvice questionIgnoreSend( const QString &text, bool canDeny );
static MDNAdviceHelper *s_instance;
};
class MDNAdviceDialog : public KDialog
{
Q_OBJECT
public:
MDNAdviceDialog( const QString &text, bool canDeny, QWidget *parent = 0 );
~MDNAdviceDialog();
MessageComposer::MDNAdvice result() const;
private:
MessageComposer::MDNAdvice m_result;
protected:
// Reimplemented
void slotButtonClicked( int button );
};
}
#endif
|
/* gEDA - GPL Electronic Design Automation
* libgeda - gEDA's Library
* Copyright (C) 2011 gEDA Contributors (see ChangeLog for details)
*
* 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
*/
G_BEGIN_DECLS
/*! Domain for GErrors originating in libgeda. */
#define EDA_ERROR eda_error_quark ()
/*! Error numbers for errors originating in libgeda. */
typedef enum {
EDA_ERROR_SCHEME, /* A Scheme error occurred */
EDA_ERROR_RC_TWICE, /* Attempted to read a configuration file twice */
EDA_ERROR_NUM_ERRORS,
} EdaError;
GQuark eda_error_quark (void);
G_END_DECLS
|
/*
* =====================================================================================
*
* Filename: hello.c
*
* Description:
*
* Version: 1.0
* Created: 2012年09月04日 11时47分44秒
* Revision: none
* Compiler: gcc
*
* Author: James Lee (Jsl), pighacker@gmail.com
* Company: FH Südwestfalen, Iserlohn
*
* =====================================================================================
*/
#include "jsl_mod.h"
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("James Lee");
#define jsl_1
#define jsl_2
#define jsl_3
#if defined (jsl_1)
int a =1;
#elif defined (jsl_2)
int a =2;
#else
int a =3;
#endif
static char *whom = "James";
static int howmany = 1;
static char *Author = "James";
module_param(howmany, int, S_IRUGO);//S_IRUGO only read S_IRUGO|S_IWUSR allow root to change
module_param(whom, charp, S_IRUGO);
struct file_operations my_fops_tm=
{
.owner = THIS_MODULE,
.read = sleepy_read,
.write = sleepy_write,
// .open = sleepy_open,
// .release = sleepy_release,
};
#if 0
static struct vm_operations_struct simple_remap_vm_ops =
{
.open = ;
.close = ;
}
#endif
//int register_blkdev(unsigned int major, const char *name);
//int unregister_blkdev(unsigned int major, const char *name);
//
//struct block_device_operations
//int (*open)(struct inode *inode, struct file *filp);
//int (*release)(struct inode *inode, struct file *filp);
//int (*ioctl)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
//int (*media_changed) (struct gendisk *gd);
//int (*revalidate_disk) (struct gendisk *gd);
//struct module *owner;
//struct gendisk
//
#if 1
static struct block_device_operations my_blkdev_ops =
//struct file_operations my_blkdev_fops=
{
.owner = THIS_MODULE,
.ioctl = blk_ioctl,
#if 0
.open = blk_open,
.release = blk_open,
#endif
};
#endif
static int Open_Dev_Func(struct cdev *cdev,struct file_operations *fops,
dev_t dev,uint count)
{
int result = 0;
cdev = cdev_alloc();
cdev->ops = fops;
(*cdev).owner = THIS_MODULE;
result = cdev_add(cdev,dev,count);
printk("\033[0;36;1m----James Debug--%s:%d--%s----\033[0m\n",\
__FILE__,__LINE__,__func__);
printk("----alloc cdev.dev:%x--LINE:%d----\n",(*cdev).dev,__LINE__);
return result;
}
static int jsl_mod_init(void)
{
int i0 = 0;
uint m_new_count = 0;
int m_result;
m_new_count = 1;
printk(KERN_INFO "The process is \"%s\" (pid %i)\n", current->comm, current->pid);
m_dev_count = m_new_count;
#if 1
/*********** alloc a dev_t type dev ID *********/
m_dev = Alloc_Dev_Get_Dev_ID(m_dev_count);
printk("----alloced dev:%x----\n",m_dev);
if(m_dev<0)
return -1;
/*********** Alloc Cdev ************/
my_dev.cdev = cdev_alloc();
my_dev.cdev->ops = &my_fops_tm;
(*my_dev.cdev).owner = THIS_MODULE;
m_result = cdev_add(my_dev.cdev,m_dev,m_dev_count);
#endif
#if 1
m_blk_dev_major = register_blkdev(0,"jsl_blk_dev");
printk("----%s:%d--m_blk_dev_major=%d----\n",__FILE__,__LINE__,m_blk_dev_major);
JSL_BLK_DEV m_blk_dev;
// memset(m_blk_dev,0x0,sizeof(struct jsl_blk_dev));
m_blk_dev.size = 12;
m_blk_dev.data = vmalloc(m_blk_dev.size);
spin_lock_init(&m_blk_dev.lock);
m_blk_dev.queue = blk_init_queue(request_func,&m_blk_dev.lock);
#if 1
m_blk_dev.gd = alloc_disk(1);
if(!m_blk_dev.gd)
{
printk(KERN_NOTICE"alloc_disk fail\n");
goto out_vfree;
}
m_blk_dev.gd->major = m_blk_dev_major;
m_blk_dev.gd->first_minor = 1;
m_blk_dev.gd->fops = &my_fops_tm;
m_blk_dev.gd->queue = m_blk_dev.queue;
m_blk_dev.gd->private_data = &m_blk_dev;
JBG;
#if 1
sprintf(m_blk_dev.gd->disk_name,32,"jsldev_%c\n",'a');
#endif
// set_capacity(m_blk_dev.gd,1024*(2048/128));
// add_disk(m_blk_dev.gd);
#endif
#endif
out_vfree:
if(m_result < 0)
{
printk("---ERROR:%d--LINE:%d---\n",m_result,__LINE__);
return -1;
}
while(i0 < howmany)
{
printk(KERN_ALERT "Hello, world By James at param By %s \
in Loop %d\n",whom,i0);
i0++;
}
return 0;
}
static void jsl_mod_exit(void)
{
Close_Dev_Func(my_dev.cdev,m_dev,m_dev_count);
Free_Dev_NOW(m_dev,0,0,m_dev_count);
unregister_blkdev(m_blk_dev_major,"jsl_blk_dev");
printk("----%s:%d--tmp=%d----\n",__FILE__,__LINE__,m_blk_dev_major);
printk(KERN_INFO "The process is \"%s\" (pid %i)\n", current->comm, current->pid);
printk(KERN_ALERT "Goodbye, cruel world By James\n");
}
module_init(jsl_mod_init);
module_exit(jsl_mod_exit);
EXPORT_SYMBOL (Author);
//EXPORT_SYMBOL_GPL (whom);
|
#define square(x) (x*x)
|
#ifndef __TABLE_HEADER_H__
#define __TABLE_HEADER_H__
//accountinfo
enum{
eUSER_NAME,
ePASS_WORD,
};
//account_info
enum{
eACCOUNT_INFO_ID,
eACCOUNT_INFO_USR,
eACCOUNT_INFO_NICKNAME,
eACCOUNT_INFO_PWD,
eACCOUNT_INFO_BIRTHDAY,
};
//player_info
enum{
ePLAYER_INFO_ID,
ePLAYER_INFO_NICKNAME,
ePLAYER_INFO_MONEY,
ePLAYER_INFO_IDLE_TIME,
ePLAYER_INFO_WORK_TIME,
ePLAYER_INFO_SLEEP_TIME,
ePLAYER_INFO_SKILL_INDEX,
};
//player_character
enum{
ePLAYER_CHARACTER_ID,
ePLAYER_CHARACTER_TYPE,
};
//action_list
enum{
eACTION_LIST_AID,
eACTION_LIST_NAME,
eACTION_LIST_ACT_DESC,
};
//schedule_daily
enum{
eSCHEDULE_DAILY_ID,
eSCHEDULE_DAILY_AID,
eSCHEDULE_DAILY_TIME,
};
//player_history
enum{
ePLAYER_HISTORY_ID,
ePLAYER_HISTORY_AID,
ePLAYER_HISTORY_TOTAL_TIME,
ePLAYER_HISTORY_UPDATE_TIME,
};
//domino_tilemap
enum{
eDOMINO_TILEMAP_ID,
eDOMINO_TILEMAP_TILEID,
eDOMINO_TILEMAP_TILEMAP,
};
#endif
|
/*
NEshare is a peer-to-peer file sharing toolkit.
Copyright (C) 2001, 2002 Neill Miller
This file is part of NEshare.
NEshare 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.
NEshare 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 NEshare; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __NESHARECLIENTTHREADS_H
#define __NESHARECLIENTTHREADS_H
#include "neclientheaders.h"
/*
a namespace which stores all of the thread functions for the NEshare client.
These functions are started on client initialization and unless noted are
persistent throughout the life of the running client.
The utility namespace is just for grouping misc. client utilities.
*/
namespace neShareClientThreads
{
namespace neClientUtils
{
nePeer *getNewConnectedPeer(unsigned long peerIpAddr,
unsigned long peerCtrlPort,
unsigned long timeout);
int rejectNewServentPeer(nePeer *peer);
int handlePeerDisconnect(nePeer *peer,
nePeerManager *peerManager,
nePeerUploadManager *peerUploadManager,
nePeerDownloadManager *peerDownloadManager);
int handleFileRequestAck(nePeer *peer,
nePeerDownloadManager *peerDownloadManager);
int handleFileResumeAck(nePeer *peer,
nePeerDownloadManager *peerDownloadManager);
int handleFileDataSend(nePeer *peer,
nePeerDownloadManager *peerDownloadManager);
int handleFileDataSendEnd(nePeer *peer,
nePeerDownloadManager *peerDownloadManager);
int handleFileDataCancel(nePeer *peer,
nePeerUploadManager *peerUploadManager);
int handleFileRequest(nePeer *peer,
nePeerUploadManager *peerUploadManager);
int handleFileResume(nePeer *peer,
nePeerUploadManager *peerUploadManager);
int handlePushRequestAck(nePeer *peer,
nePeerDownloadManager *peerDownloadManager);
int handleReadyPeers(nePeerManager *peerManager,
nePeerDownloadManager *peerDownloadManager,
nePeerUploadManager *peerUploadManager);
int handleConnectedPeerLogin(nePeer *peer, unsigned long timeout);
int sendFileRequest(nePeer *peer,
nePeerDownloadManager *peerDownloadManager,
char *filename);
}
/* a function which is called each time a new peer client tries to connect to
this client. The incoming parameter is an ncSocket pointer.
this function either discards the client if an error occurs, or adds it
to the active client list if all is ok. */
void *processLoginMessage(void *ptr);
/* thread function which binds to a port and listens for incoming connections
from peers who wish to communicate with this client directly */
void *listenForClients(void *ptr);
/* thread functions which listen to all peer sockets and dispatches
based on what activities are ready. start these threads before
listening for connections */
void *processClientPeers(void *ptr);
void *processServentPeers(void *ptr);
/* thread function which handles all file reads and network sends for
any uploaded file from this peer to another. this thread must be
started before any data can be sent, but is not critical for
normal client operation */
void *processUploads(void *ptr);
/* this is the function which starts all of the threads, calling the
above thread functions initially, and initializes necessary objects.
All arguments should be passed in from the neClientConnection object */
void startThreads(neConfig *config,
nePeerManager *peerClientManager,
nePeerManager *peerServentManager,
nePeerDownloadManager *peerDownloadManager,
nePeerUploadManager *peerUploadManager);
/* this stops the neShare server threads and does clean up of objects */
void stopThreads();
}
#endif /* __NESHARECLIENTTHREADS_H */
|
/* ksim - a system monitor for kde
*
* Copyright (C) 2001 Robbie Ward <linuxphreak@gmx.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KSIMPREF_H
#define KSIMPREF_H
#include <kdialogbase.h>
#include <tdelibs_export.h>
class TQFrame;
class KDesktopFile;
namespace KSim
{
class Config;
class Plugin;
class MonitorPrefs;
class GeneralPrefs;
class ClockPrefs;
class UptimePrefs;
class MemoryPrefs;
class SwapPrefs;
class ThemePrefs;
class ChangedPlugin
{
public:
ChangedPlugin() : m_name(0) {}
ChangedPlugin(bool enabled, const TQCString &libname,
const TQString &name, const TQString &file) : m_enabled(enabled),
m_libname(libname), m_name(name), m_file(file) {}
ChangedPlugin(bool enabled, const TQCString &libname,
const TQString &name, const TQString &file, bool oldState)
: m_enabled(enabled), m_libname(libname), m_name(name),
m_file(file), m_oldState(oldState) {}
bool isEnabled() const { return m_enabled; }
bool isDifferent() const { return m_enabled != m_oldState; }
const TQCString &libName() const { return m_libname; }
const TQString &name() const { return m_name; }
const TQString &filename() const { return m_file; }
private:
bool m_enabled;
TQCString m_libname;
TQString m_name;
TQString m_file;
bool m_oldState;
};
class ChangedPluginList : public TQValueList<ChangedPlugin>
{
public:
ChangedPluginList() {}
~ChangedPluginList() {}
};
class KDE_EXPORT ConfigDialog : public KDialogBase
{
Q_OBJECT
public:
ConfigDialog(KSim::Config *config, TQWidget *parent, const char *name = 0);
~ConfigDialog();
public slots:
void removePage(const TQCString &name);
void createPage(const TQCString &name); // overload
void createPage(const KSim::Plugin &plugin);
signals:
void reparse(bool, const KSim::ChangedPluginList &);
private slots:
void reload();
void savePrefs();
void saveConfig(bool);
void readConfig();
void closePrefs();
void loadPluginConfig();
void enableButtons();
void disableButtons();
private:
const KSim::ChangedPlugin &findPlugin(const TQString &name) const;
ChangedPluginList m_currentPlugins;
KSim::MonitorPrefs *m_monPage;
KSim::GeneralPrefs *m_generalPage;
KSim::ClockPrefs *m_clockPage;
KSim::UptimePrefs *m_uptimePage;
KSim::MemoryPrefs *m_memoryPage;
KSim::SwapPrefs *m_swapPage;
KSim::ThemePrefs *m_themePage;
KSim::Config *m_config;
};
}
#endif
|
#include "stdlib.h"
#include "interrupts.h"
#include "tty.h"
typedef struct {
uint16 address_0_15;
uint16 selector;
uint8 reserved;
uint8 type;
uint16 address_16_31;
} __attribute__((packed)) IntDesc;
typedef struct {
uint16 limit;
void *base;
} __attribute__((packed)) IDTR;
IntDesc *idt = (void*)0xFFFFC000;
void timer_int_handler();
void init_interrupts() {
*((size_t*)0xFFFFEFF0) = 0x8000 | 3;
memset(idt, 0, 256 * sizeof(IntDesc));
IDTR idtr = {256 * sizeof(IntDesc), idt};
asm("lidt (,%0,)"::"a"(&idtr));
irq_base = 0x20;
irq_count = 16;
outportb(0x20, 0x11);
outportb(0x21, irq_base);
outportb(0x21, 4);
outportb(0x21, 1);
outportb(0xA0, 0x11);
outportb(0xA1, irq_base + 8);
outportb(0xA1, 2);
outportb(0xA1, 1);
set_int_handler(irq_base, timer_int_handler, 0x8E);
asm("sti");
}
void set_int_handler(uint8 index, void *handler, uint8 type) {
asm("pushf \n cli");
idt[index].selector = 8;
idt[index].address_0_15 = (size_t)handler & 0xFFFF;
idt[index].address_16_31 = (size_t)handler >> 16;
idt[index].type = type;
idt[index].reserved = 0;
asm("popf");
}
IRQ_HANDLER(timer_int_handler) {
//(*((char*)(0xB8000 + 79 * 2)))++;
}
|
/*
* util-common.h
*
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PM_UTIL_COMMON_H
#define PM_UTIL_COMMON_H
#include <stdio.h>
#include <sys/stat.h> /* struct stat */
char *hex_representation(const unsigned char *bytes, size_t size);
const char *mbasename(const char *path);
char *mdirname(const char *path);
int llstat(char *path, struct stat *buf);
char *safe_fgets(char *s, int size, FILE *stream);
void wordsplit_free(char **ws);
char **wordsplit(const char *str);
size_t strtrim(char *str);
#ifndef HAVE_STRNDUP
char *strndup(const char *s, size_t n);
#endif
#define ARRAYSIZE(a) (sizeof (a) / sizeof (a[0]))
#endif /* PM_UTIL_COMMON_H */
|
/*
* Copyright (C) 2014-2019 Firejail Authors
*
* This file is part of firejail project
*
* 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 LIBPOSTEXECSECCOMP_H
#define LIBPOSTEXECSECCOMP_H
#define RUN_SECCOMP_POSTEXEC "/run/firejail/mnt/seccomp.postexec"
#endif
|
/*
* Copyright (C) 2000,2001 Marco Ziech (mmz@gmx.net)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define CONNECTION_INTERNAL_ACCESS
#include "common/setup_before.h"
#ifdef WITH_BITS
#ifdef STDC_HEADERS
# include <stdlib.h>
#else
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# endif
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
#endif
#include <errno.h>
#include "compat/strerror.h"
#include "connection.h"
#include "common/eventlog.h"
#include "bits.h"
#include "bits_rconn.h"
#include "bits_login.h"
#include "account.h"
#include "common/bn_type.h"
#include "common/tag.h"
#include "common/setup_after.h"
extern t_connection * bits_rconn_create(unsigned int latency, unsigned int flags, unsigned int sessionid)
{
t_connection * c;
c = bits_rconn_create_by_sessionid(sessionid);
c->flags = flags;
c->latency = latency;
/* FIXME: need account simulation */
return c;
}
extern t_connection * bits_rconn_create_by_sessionid(unsigned int sessionid)
{
t_bits_loginlist_entry * lle;
t_connection * c;
char ct[5];
char temp[32];
t_account * account;
lle = bits_loginlist_bysessionid(sessionid);
if (!lle) {
eventlog(eventlog_level_error,"bits_rconn_create_by_sessionid","could not find loginlist entry wit sessionid 0x%08x",sessionid);
return NULL;
}
c = malloc(sizeof(t_connection));
if (!c) {
eventlog(eventlog_level_error,"bits_rconn_create","malloc failed: %s",strerror(errno));
return NULL;
}
memset(c,0,sizeof(t_connection));
memcpy(ct,lle->clienttag,4);
ct[4] = '\0';
conn_set_clienttag(c,ct);
c->class = conn_class_remote;
c->sessionid = sessionid;
c->udp_addr = lle->game_addr;
c->tcp_addr = lle->game_addr; /* just a guess ... */
c->udp_port = lle->game_port;
c->flags = 0;
c->latency = 0;
conn_set_botuser(c,lle->chatname);
c->state = conn_state_loggedin;
sprintf(temp,UID_FORMAT,lle->uid);
account = accountlist_find_account(temp);
if (account_is_ready_for_use(account)) {
c->account = account;
} else {
c->account = NULL;
}
/* FIXME: grab account ? */
return c;
}
extern int bits_rconn_set_game(t_connection * c, t_game * g)
{
if (!c) {
eventlog(eventlog_level_error,"bits_rconn_set_game","got NULL connection");
return -1;
}
c->game = g;
return 0;
}
extern int bits_rconn_destroy(t_connection * c)
{
/* FIXME: use conn_destroy instead? */
if (!c) {
eventlog(eventlog_level_error,"bits_rconn_destroy","got NULL connection");
return -1;
}
if (conn_get_class(c)!=conn_class_remote) {
eventlog(eventlog_level_error,"bits_rconn_destroy","wrong connection class");
return -1;
}
if (c->clienttag) free((void *) c->clienttag); /* avoid warning */
if (c->botuser) free((void *) c->botuser); /* avoid warning */
free(c);
return 0;
}
#endif
|
/*
* Copyright (C) 2006 PA Semi, Inc
*
* Authors: Kip Walker, PA Semi
* Olof Johansson, PA Semi
*
* Maintained by: Olof Johansson <olof@lixom.net>
*
* Based on arch/powerpc/platforms/maple/pci.c
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <asm/pci-bridge.h>
#include <asm/machdep.h>
#include <asm/ppc-pci.h>
#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
#define CONFIG_OFFSET_VALID(off) ((off) < 4096)
static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose,
u8 bus, u8 devfn, int offset)
{
return hose->cfg_data + PA_PXP_CFA(bus, devfn, offset);
}
static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 *val)
{
struct pci_controller *hose;
void volatile __iomem *addr;
hose = pci_bus_to_host(bus);
if (!hose)
return PCIBIOS_DEVICE_NOT_FOUND;
if (!CONFIG_OFFSET_VALID(offset))
return PCIBIOS_BAD_REGISTER_NUMBER;
addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
/*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
switch (len) {
case 1:
*val = in_8(addr);
break;
case 2:
*val = in_le16(addr);
break;
default:
*val = in_le32(addr);
break;
}
return PCIBIOS_SUCCESSFUL;
}
static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val)
{
struct pci_controller *hose;
void volatile __iomem *addr;
hose = pci_bus_to_host(bus);
if (!hose)
return PCIBIOS_DEVICE_NOT_FOUND;
if (!CONFIG_OFFSET_VALID(offset))
return PCIBIOS_BAD_REGISTER_NUMBER;
addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
/*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
switch (len) {
case 1:
out_8(addr, val);
(void) in_8(addr);
break;
case 2:
out_le16(addr, val);
(void) in_le16(addr);
break;
default:
out_le32(addr, val);
(void) in_le32(addr);
break;
}
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops pa_pxp_ops = {
pa_pxp_read_config,
pa_pxp_write_config,
};
static void __init setup_pa_pxp(struct pci_controller *hose)
{
hose->ops = &pa_pxp_ops;
hose->cfg_data = ioremap(0xe0000000, 0x10000000);
}
static int __init add_bridge(struct device_node *dev)
{
struct pci_controller *hose;
pr_debug("Adding PCI host bridge %s\n", dev->full_name);
hose = pcibios_alloc_controller(dev);
if (!hose)
return -ENOMEM;
hose->first_busno = 0;
hose->last_busno = 0xff;
setup_pa_pxp(hose);
printk(KERN_INFO "Found PA-PXP PCI host bridge.\n");
/* Interpret the "ranges" property */
/* This also maps the I/O region and sets isa_io/mem_base */
pci_process_bridge_OF_ranges(hose, dev, 1);
pci_setup_phb_io(hose, 1);
return 0;
}
void __init pas_pcibios_fixup(void)
{
struct pci_dev *dev = NULL;
for_each_pci_dev(dev)
pci_read_irq_line(dev);
}
static void __init pas_fixup_phb_resources(void)
{
struct pci_controller *hose, *tmp;
list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
hose->io_resource.start += offset;
hose->io_resource.end += offset;
printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n",
hose->global_number,
hose->io_resource.start, hose->io_resource.end);
}
}
void __init pas_pci_init(void)
{
struct device_node *np, *root;
root = of_find_node_by_path("/");
if (!root) {
printk(KERN_CRIT "pas_pci_init: can't find root "
"of device tree\n");
return;
}
for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np))
of_node_get(np);
of_node_put(root);
pas_fixup_phb_resources();
/* Setup the linkage between OF nodes and PHBs */
pci_devs_phb_init();
/* Use the common resource allocation mechanism */
pci_probe_only = 1;
}
|
/*
* %kadu copyright begin%
* Copyright 2017 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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/>.
*/
#pragma once
#include "plugin/plugin-modules-factory.h"
class FacebookPluginModulesFactory : public PluginModulesFactory
{
Q_OBJECT
Q_INTERFACES(PluginModulesFactory)
Q_PLUGIN_METADATA(IID "im.kadu.PluginModulesFactory")
public:
explicit FacebookPluginModulesFactory(QObject *parent = nullptr);
virtual ~FacebookPluginModulesFactory();
virtual std::vector<std::unique_ptr<injeqt::module>> createPluginModules() const override;
};
|
/* Verify that overloaded built-ins for vec_insert() with short
inputs produce the right codegen. Power8 variant. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
#include <altivec.h>
vector bool short
testbs_var(unsigned short x, vector bool short v, signed int i)
{
return vec_insert(x, v, i);
}
vector signed short
testss_var(signed short x, vector signed short v, signed int i)
{
return vec_insert(x, v, i);
}
vector unsigned short
testus1_var(signed short x, vector unsigned short v, signed int i)
{
return vec_insert(x, v, i);
}
vector unsigned short
testus2_var(unsigned short x, vector unsigned short v, signed int i)
{
return vec_insert(x, v, i);
}
vector bool short
testbs_cst(signed short x, vector bool short v)
{
return vec_insert(x, v, 12);
}
vector signed short
testss_cst(signed short x, vector signed short v)
{
return vec_insert(x, v, 12);
}
vector unsigned short
testus1_cst(signed short x, vector unsigned short v)
{
return vec_insert(x, v, 12);
}
vector unsigned short
testus2_cst(unsigned short x, vector unsigned short v)
{
return vec_insert(x, v, 12);
}
/* { dg-final { scan-assembler-times {\mlhz\M|\mlvx\M|\mlxv\M|\mlxvw4x\M} 8 } } */
/* stores.. 2 each per variable tests, 1 each per cst test. */
/* { dg-final { scan-assembler-times {\msthx\M|\mstvx\M|\msth\M|\mstxvw4x\M} 12 } } */
/* { dg-final { scan-assembler-times {\mlvehx\M} 4 } } */
/* { dg-final { scan-assembler-times {\mvperm\M} 4 } } */
|
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <asm/types.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <mach/irqs.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
#include <linux/device.h>
#include <linux/serial_8250.h>
#include "common.h"
static struct resource h7202ps2_resources[] = {
[0] = {
.start = 0x8002c000,
.end = 0x8002c040,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_PS2,
.end = IRQ_PS2,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device h7202ps2_device = {
.name = "h7202ps2",
.id = -1,
.num_resources = ARRAY_SIZE(h7202ps2_resources),
.resource = h7202ps2_resources,
};
static struct plat_serial8250_port serial_platform_data[] = {
{
.membase = (void*)SERIAL0_VIRT,
.mapbase = SERIAL0_BASE,
.irq = IRQ_UART0,
.uartclk = 2*1843200,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
{
.membase = (void*)SERIAL1_VIRT,
.mapbase = SERIAL1_BASE,
.irq = IRQ_UART1,
.uartclk = 2*1843200,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
#ifdef CONFIG_H7202_SERIAL23
{
.membase = (void*)SERIAL2_VIRT,
.mapbase = SERIAL2_BASE,
.irq = IRQ_UART2,
.uartclk = 2*1843200,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
{
.membase = (void*)SERIAL3_VIRT,
.mapbase = SERIAL3_BASE,
.irq = IRQ_UART3,
.uartclk = 2*1843200,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
#endif
{ },
};
static struct platform_device serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = serial_platform_data,
},
};
static struct platform_device *devices[] __initdata = {
&h7202ps2_device,
&serial_device,
};
static void
h7202_timerx_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
{
unsigned int mask, irq;
mask = CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
if ( mask & TSTAT_T0INT ) {
timer_tick();
if( mask == TSTAT_T0INT )
return;
}
mask >>= 1;
irq = IRQ_TIMER1;
while (mask) {
if (mask & 1)
generic_handle_irq(irq);
irq++;
mask >>= 1;
}
}
static irqreturn_t
h7202_timer_interrupt(int irq, void *dev_id)
{
h7202_timerx_demux_handler(0, NULL);
return IRQ_HANDLED;
}
static void inline mask_timerx_irq (u32 irq)
{
unsigned int bit;
bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1));
CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) &= ~bit;
}
static void inline unmask_timerx_irq (u32 irq)
{
unsigned int bit;
bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1));
CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit;
}
static struct irq_chip h7202_timerx_chip = {
.ack = mask_timerx_irq,
.mask = mask_timerx_irq,
.unmask = unmask_timerx_irq,
};
static struct irqaction h7202_timer_irq = {
.name = "h7202 Timer Tick",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = h7202_timer_interrupt,
};
void __init h7202_init_time(void)
{
CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT;
setup_irq(IRQ_TIMER0, &h7202_timer_irq);
}
struct sys_timer h7202_timer = {
.init = h7202_init_time,
.offset = h720x_gettimeoffset,
};
void __init h7202_init_irq (void)
{
int irq;
CPU_REG (GPIO_E_VIRT, GPIO_MASK) = 0x0;
for (irq = IRQ_TIMER1;
irq < IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS); irq++) {
mask_timerx_irq(irq);
set_irq_chip(irq, &h7202_timerx_chip);
set_irq_handler(irq, handle_edge_irq);
set_irq_flags(irq, IRQF_VALID );
}
set_irq_chained_handler(IRQ_TIMERX, h7202_timerx_demux_handler);
h720x_init_irq();
}
void __init init_hw_h7202(void)
{
CPU_REG (PMU_BASE, PMU_PLL_CTRL) |= PLL_2_EN | PLL_1_EN | PLL_3_MUTE;
CPU_REG (SERIAL0_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
CPU_REG (SERIAL1_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
#ifdef CONFIG_H7202_SERIAL23
CPU_REG (SERIAL2_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
CPU_REG (SERIAL3_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
CPU_IO (GPIO_AMULSEL) = AMULSEL_USIN2 | AMULSEL_USOUT2 |
AMULSEL_USIN3 | AMULSEL_USOUT3;
#endif
(void) platform_add_devices(devices, ARRAY_SIZE(devices));
}
|
/*
* Copyright (C) 2014 OpenSIPS Solutions
*
* This file is part of opensips, a free SIP server.
*
* opensips 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.
*
* opensips 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.
*
*
* history:
* ---------
* 2014-08-23 created (bogdan)
*/
#ifndef _REACTOR_H_
#define _REACTOR_H_
/* This should be included by files where the reactor core (looping,
* triggering) is implemented.
* The header file provides both the reactor definitions, the fd manipulation
* functions, but looping and triggering too.
* IF you need just to use the reactor (in terms of submitting fd's to it), use
* only the reactor_defs.h file !!!
*/
#include "reactor_defs.h"
#define HANDLE_IO_INLINE
#include "io_wait_loop.h"
//#include <fcntl.h> /* must be included after io_wait.h if SIGIO_RT is used */
#ifdef HAVE_SELECT
#define reactor_SELECT_CASE(_timeout,_loop_extra) \
case POLL_SELECT: \
while(1){ \
io_wait_loop_select(&_worker_io, _timeout, 0); \
_loop_extra;\
} \
break;
#else
#define reactor_SELECT_CASE(_timeout,_loop_extra)
#endif
#ifdef HAVE_SIGIO_RT
#define reactor_SIGIORT_CASE(_timeout,_loop_extra) \
case POLL_SIGIO_RT: \
while(1){ \
io_wait_loop_sigio_rt(&_worker_io, _timeout); \
_loop_extra;\
} \
break;
#else
#define reactor_SIGIORT_CASE(_timeout,_loop_extra)
#endif
#ifdef HAVE_EPOLL
#define reactor_EPOLL_CASE(_timeout,_loop_extra) \
case POLL_EPOLL_LT: \
while(1){ \
io_wait_loop_epoll(&_worker_io, _timeout, 0); \
_loop_extra;\
} \
break; \
case POLL_EPOLL_ET: \
while(1){ \
io_wait_loop_epoll(&_worker_io, _timeout, 1); \
_loop_extra;\
} \
break;
#else
#define reactor_EPOLL_CASE(_timeout,_loop_extra)
#endif
#ifdef HAVE_KQUEUE
#define reactor_KQUEUE_CASE(_timeout,_loop_extra) \
case POLL_KQUEUE: \
while(1){ \
io_wait_loop_kqueue(&_worker_io, _timeout, 0); \
_loop_extra;\
} \
break;
#else
#define reactor_KQUEUE_CASE(_timeout,_loop_extra)
#endif
#ifdef HAVE_DEVPOLL
#define reactor_DEVPOLL_CASE(_timeout,_loop_extra) \
case POLL_DEVPOLL: \
while(1){ \
io_wait_loop_devpoll(&_worker_io, _timeout, 0); \
_loop_extra;\
} \
break;
#else
#define reactor_DEVPOLL_CASE(_timeout,_loop_extra)
#endif
#define reactor_main_loop( _timeout, _err, _loop_extra) \
switch(_worker_io.poll_method) { \
case POLL_POLL: \
while(1){ \
io_wait_loop_poll(&_worker_io, _timeout, 0); \
_loop_extra;\
} \
break; \
reactor_SELECT_CASE(_timeout,_loop_extra) \
reactor_SIGIORT_CASE(_timeout,_loop_extra) \
reactor_EPOLL_CASE(_timeout,_loop_extra) \
reactor_KQUEUE_CASE(_timeout,_loop_extra) \
reactor_DEVPOLL_CASE(_timeout,_loop_extra) \
default:\
LM_CRIT("no support for poll method %s (%d)\n", \
poll_method_name(_worker_io.poll_method), \
_worker_io.poll_method);\
goto _err; \
}
#endif
|
//
// PGTSNotificationTests.h
// BaseTen
//
// Copyright (C) 2009 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 <SenTestingKit/SenTestingKit.h>
#import <BaseTen/PGTSConnection.h>
#import <BaseTen/PGTSResultSet.h>
#import "BXTestCase.h"
@class PGTSConnection;
@interface PGTSNotificationTests : BXTestCase <PGTSConnectionDelegate>
{
PGTSConnection* mConnection;
BOOL mGotNotification;
}
@end
|
/*
* $Id$
*
* CentroidFold: A generalized centroid estimator for predicting RNA
* secondary structures
*
* Copyright (C) 2008-2010 Kengo Sato
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __INC_ENGINE_MCCASKILL_H__
#define __INC_ENGINE_MCCASKILL_H__
#include "../folding_engine.h"
#ifdef HAVE_LIBRNA
class McCaskillModel : public FoldingEngine<std::string>
{
public:
McCaskillModel(bool canonical_only, uint max_bp_dist,
const char* param=NULL, uint seed=0, bool run_as_mea=false);
virtual ~McCaskillModel() { }
// interface implementations
virtual void set_constraint(const std::string& str);
virtual void calculate_posterior(const std::string& seq);
virtual void prepare_stochastic_traceback(const std::string& seq);
virtual std::vector<int> stochastic_traceback(const std::string& seq);
virtual void clean_stochastic_traceback(const std::string& seq);
private:
bool canonical_only_;
int bk_st_back_;
std::string str_;
};
#endif
#endif // __INC_ENGINE_MCCASKILL_H__
// Local Variables:
// mode: C++
// End:
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2009-09-27
* Description : gui database error handler
*
* Copyright (C) 2009-2010 by Holger Foerster <Hamsi2k at freenet dot 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, 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 SQLQUERY_H
#define SQLQUERY_H
// Qt includes
#include <QMetaType>
#include <QString>
#include <QSqlQuery>
// Local includes
#include "digikam_export.h"
namespace Digikam
{
class DIGIKAM_EXPORT SqlQuery : public QSqlQuery
{
public:
explicit SqlQuery(const QSqlQuery& other);
explicit SqlQuery(const QSqlDatabase& db);
virtual ~SqlQuery();
virtual SqlQuery& operator=(const SqlQuery& other);
virtual bool prepare(const QString& query);
virtual QString lastQuery() const;
private:
QString m_query;
};
} // namespace Digikam
#endif /* SQLQUERY_H */
|
#ifndef __ROCCAT_SAVE_DIALOG_H__
#define __ROCCAT_SAVE_DIALOG_H__
/*
* This file is part of roccat-tools.
*
* roccat-tools 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.
*
* roccat-tools 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 roccat-tools. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
G_BEGIN_DECLS
/*!
* \brief asks the user if he want's to save data and exit
*
* The dialog is modal.
*
* If cancel is \c TRUE, an additional cancel button is added
*
* \retval response of dialog can be one of
* GTK_RESPONSE_ACCEPT - save data and exit
* GTK_RESPONSE_REJECT - exit without saving
* GTK_RESPONSE_CANCEL - don't save and don't exit
*/
gint roccat_save_dialog(GtkWindow *parent, gchar const *text, gboolean cancel);
/*!
* \brief asks the user if he want's to save data and exit
*
* The dialog is modal.
*
* If cancel is \c TRUE, an additional cancel button is added
*
* \retval response of dialog can be one of
* GTK_RESPONSE_ACCEPT - save data and exit
* GTK_RESPONSE_REJECT - exit without saving
* GTK_RESPONSE_CANCEL - don't save and don't exit
*/
gint roccat_save_unsaved_dialog(GtkWindow *parent, gboolean cancel);
G_END_DECLS
#endif
|
// Copyright (c) 2016 GeometryFactory SARL (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: https://github.com/CGAL/cgal/blob/releases/CGAL-4.14.1/Installation/include/CGAL/license/Hyperbolic_triangulation_2.h $
// $Id: Hyperbolic_triangulation_2.h 15fe22c %aI Mael Rouxel-Labbé
// SPDX-License-Identifier: LGPL-3.0+
//
// Author(s) : Andreas Fabri
//
// Warning: this file is generated, see include/CGAL/licence/README.md
#ifndef CGAL_LICENSE_HYPERBOLIC_TRIANGULATION_2_H
#define CGAL_LICENSE_HYPERBOLIC_TRIANGULATION_2_H
#include <CGAL/config.h>
#include <CGAL/license.h>
#ifdef CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE
# if CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE
# if defined(CGAL_LICENSE_WARNING)
CGAL_pragma_warning("Your commercial license for CGAL does not cover "
"this release of the 2D Hyperbolic Delaunay Triangulations package.")
# endif
# ifdef CGAL_LICENSE_ERROR
# error "Your commercial license for CGAL does not cover this release \
of the 2D Hyperbolic Delaunay Triangulations package. \
You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR
# endif // CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE
#else // no CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE
# if defined(CGAL_LICENSE_WARNING)
CGAL_pragma_warning("\nThe macro CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE is not defined."
"\nYou use the CGAL 2D Hyperbolic Delaunay Triangulations package under "
"the terms of the GPLv3+.")
# endif // CGAL_LICENSE_WARNING
# ifdef CGAL_LICENSE_ERROR
# error "The macro CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE is not defined.\
You use the CGAL 2D Hyperbolic Delaunay Triangulations package under the terms of \
the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR."
# endif // CGAL_LICENSE_ERROR
#endif // no CGAL_HYPERBOLIC_TRIANGULATION_2_COMMERCIAL_LICENSE
#endif // CGAL_LICENSE_HYPERBOLIC_TRIANGULATION_2_H
|
#include "public.h"
#include <pthread.h>
#include <signal.h>
#include <syslog.h>
extern int already_running();
extern void daemonize(const char *cmd);
sigset_t mask;
void reload()
{
/* reload config file */
syslog(LOG_INFO, "RELOAD CONFIG FILE");
}
void *thr_fn(void * arg)
{
int signo;
while(sigwait(&mask, &signo) == 0)
{
switch(signo)
{
case SIGHUP:
reload();
break;
case SIGTERM:
syslog(LOG_INFO, "DAEMONIZE EXIT");
exit(0);
default:
syslog(LOG_INFO, "CAUGHTED A SIGNAL %d", signo);
break;
}
}
return (void *)1;
}
int main(int argc, char *argv[])
{
char *pcmd;
struct sigaction act;
pthread_t tid;
pcmd = strrchr(argv[0], '/');
if (pcmd == NULL)
pcmd = argv[0];
else
pcmd++;
daemonize(pcmd);
act.sa_handler = SIG_DFL;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigfillset(&mask);
if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0)
{
syslog(LOG_ERR, "pthread_sigmask failed.[%m]");
exit(-1);
}
pthread_create(&tid, NULL, thr_fn, NULL);
pthread_join(tid, (void**)0);
return 0;
}
|
/****************************************************************************
** $Id: qt_os2.h 189 2011-06-16 16:08:06Z abwillis $
**
** Includes OS/2 system header files.
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
** Copyright (C) 2004 Norman ASA. Initial OS/2 Port.
** Copyright (C) 2005 netlabs.org. Further OS/2 Development.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QT_OS2_H
#define QT_OS2_H
#include "qwindowdefs.h"
#define INCL_BASE
#define INCL_PM
#include <os2.h>
// wrappers for each Win* and Gpi* call that restore the FPU Control Word
#include <API_FPU_CW_Wrappers.h>
// OS/2 system exception handler callback interface
#if !defined(QT_OS2_NO_SYSEXCEPTIONS)
enum QtOS2SysXcptReq
{
QtOS2SysXcptReq_AppName = 0,
QtOS2SysXcptReq_AppVer = 1,
QtOS2SysXcptReq_ReportTo = 2,
QtOS2SysXcptReq_ReportSubj = 3,
};
typedef void (*QtOS2SysXcptWriter)( const char *str );
typedef int (*QtOS2SysXcptCallback)( QtOS2SysXcptReq req,
QtOS2SysXcptWriter writer,
int reserved );
class Q_EXPORT QtOS2SysXcptMainHandler
{
public:
QtOS2SysXcptMainHandler( QtOS2SysXcptCallback cb = NULL );
~QtOS2SysXcptMainHandler();
class Private;
private:
EXCEPTIONREGISTRATIONRECORD rec;
static bool installed;
static QtOS2SysXcptCallback callback;
static ERR libcHandler;
// @todo (r=dmik) Inntotek GCC/kLIBC v0.6.1 and earlier have a problem with
// __attribute__((__system__)) (see http://svn.netlabs.org/libc/ticket/129)
// so we have to temporarily comment out APIENTRY below, based on the fact
// that the OS/2 _System calling convention corresponds to cdecl in terms
// of argument order and stack cleanup. Once it's fixed, this should be
// guarded by #if __INNOTEK_LIBC__<=0x006...
static ULONG /* APIENTRY */ handler( PEXCEPTIONREPORTRECORD pReportRec,
PEXCEPTIONREGISTRATIONRECORD pRegRec,
PCONTEXTRECORD pContextRec,
PVOID pv );
friend class QtOS2SysXcptMainHandlerInternal;
friend class QThreadInstance;
// these are private to allow stack-based instances only
QtOS2SysXcptMainHandler( QtOS2SysXcptMainHandler &/*that*/ ) {}
QtOS2SysXcptMainHandler &operator =( QtOS2SysXcptMainHandler &/*that*/) {
return *this;
}
static void *operator new( size_t /*size*/ ) throw() { return NULL; }
static void operator delete( void */*memory*/ ) {}
};
#endif // !defined(QT_OS2_NO_SYSEXCEPTIONS)
#endif // QT_OS2_H
|
#ifndef __LINUX_SPINLOCK_UP_H
#define __LINUX_SPINLOCK_UP_H
#ifndef __LINUX_SPINLOCK_H
# error "please don't include this file directly"
#endif
<<<<<<< HEAD
#include <asm/processor.h> /* for cpu_relax() */
=======
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
/*
* include/linux/spinlock_up.h - UP-debug version of spinlocks.
*
* portions Copyright 2005, Red Hat, Inc., Ingo Molnar
* Released under the General Public License (GPL).
*
* In the debug case, 1 means unlocked, 0 means locked. (the values
* are inverted, to catch initialization bugs)
*
* No atomicity anywhere, we are on UP.
*/
#ifdef CONFIG_DEBUG_SPINLOCK
#define arch_spin_is_locked(x) ((x)->slock == 0)
static inline void arch_spin_lock(arch_spinlock_t *lock)
{
lock->slock = 0;
}
static inline void
arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
{
local_irq_save(flags);
lock->slock = 0;
}
static inline int arch_spin_trylock(arch_spinlock_t *lock)
{
char oldval = lock->slock;
lock->slock = 0;
return oldval > 0;
}
static inline void arch_spin_unlock(arch_spinlock_t *lock)
{
lock->slock = 1;
}
/*
* Read-write spinlocks. No debug version.
*/
#define arch_read_lock(lock) do { (void)(lock); } while (0)
#define arch_write_lock(lock) do { (void)(lock); } while (0)
#define arch_read_trylock(lock) ({ (void)(lock); 1; })
#define arch_write_trylock(lock) ({ (void)(lock); 1; })
#define arch_read_unlock(lock) do { (void)(lock); } while (0)
#define arch_write_unlock(lock) do { (void)(lock); } while (0)
#else /* DEBUG_SPINLOCK */
#define arch_spin_is_locked(lock) ((void)(lock), 0)
/* for sched.c and kernel_lock.c: */
# define arch_spin_lock(lock) do { (void)(lock); } while (0)
# define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0)
# define arch_spin_unlock(lock) do { (void)(lock); } while (0)
# define arch_spin_trylock(lock) ({ (void)(lock); 1; })
#endif /* DEBUG_SPINLOCK */
#define arch_spin_is_contended(lock) (((void)(lock), 0))
#define arch_read_can_lock(lock) (((void)(lock), 1))
#define arch_write_can_lock(lock) (((void)(lock), 1))
#define arch_spin_unlock_wait(lock) \
do { cpu_relax(); } while (arch_spin_is_locked(lock))
#endif /* __LINUX_SPINLOCK_UP_H */
|
//
// SPALSound.h
// Sparrow
//
// Created by Daniel Sperl on 28.05.10.
// Copyright 2011 Gamua. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Simplified BSD License.
//
#import <Foundation/Foundation.h>
#import "SPSound.h"
/** ------------------------------------------------------------------------------------------------
The SPALSound class is a concrete implementation of SPSound that uses OpenAL internally.
Don't create instances of this class manually. Use `[SPSound initWithContentsOfFile:]` instead.
------------------------------------------------------------------------------------------------- */
@interface SPALSound : SPSound
/// --------------------
/// @name Initialization
/// --------------------
/// Initializes a sound with its known properties.
- (id)initWithData:(const void *)data size:(int)size channels:(int)channels frequency:(int)frequency
duration:(double)duration;
/// ----------------
/// @name Properties
/// ----------------
/// The OpenAL buffer ID of the sound.
@property (nonatomic, readonly) uint bufferID;
@end
|
#ifndef CONFIG_H
#define CONFIG_H
#define USERMANAGER_UID 1
#endif // CONFIG_H
|
#ifndef __PRIMITIVE_H__
#define __PRIMITIVE_H__
#include "MathGeoLib/include/MathGeoLib.h"
#include "glew-2.0.0/include/GL/glew.h"
class Primitive {
public:
enum Types
{
AXIS,
GRID,
SOLID_CUBE,
SOLID_SPHERE,
UNKNOWN
};
Primitive(Types primitive_type)
: m_type(primitive_type) {}
virtual ~Primitive() {}
virtual void Draw() {}
Primitive* Scale(float3 v) { m_scale = v; return this; }
Primitive* Translate(float3 v) { m_pos = v; return this; }
Primitive* Rotate(float angle, float3 v)
{
m_rotate_angle = angle;
m_rotate_vector = v;
return this;
}
Primitive* ApplyTexture(const GLuint& texture_id)
{
m_texture_id = texture_id;
return this;
}
protected:
Types m_type = UNKNOWN;
float3 m_scale = float3::one;
float3 m_pos = float3::zero;
float m_rotate_angle = 0.0f;
float3 m_rotate_vector = float3::zero;
GLuint m_texture_id = 0;
};
#endif // __PRIMITIVE_H__
|
#include<stdio.h>
#include<stdlib.h>
#define N 4
#define M 3
struct student{
long num;
char str[15];
float score[M];
float avg;
}stu[N],newstu[N];
#define Len sizeof(struct student)
void main(){
char *filename = "../13.8.txt";
char *file = "../13.9.txt";
FILE *fp;
struct student sp,stu_new;
int i,j,k;
float tmp;
if((fp=fopen(filename,"r"))==NULL){
printf("can not open file.");
exit(0);
}
printf("output the ordered student information:\n");
for(i=0;i<N;i++){
fread(&stu[i], Len, 1, fp);
printf("%-4d %-15s %4.2f %4.2f %4.2f %4.2f\n", stu[i].num, stu[i].str, stu[i].score[0], stu[i].score[1], stu[i].score[2], stu[i].avg);
}
//insert order
for(i=0;i<N;i++){
//bubble order
for(j=0;j<M-1;j++){//change times
for(k=j+1;k<M;k++){
if(stu[i].score[j]<stu[i].score[k]){
tmp = stu[i].score[j];
stu[i].score[j] = stu[i].score[k];
stu[i].score[k] = tmp;
}
}
}
}
fclose(fp);
printf("output the ordered score student information:\n");
//write the new orderd value.
if((fp=fopen(file,"w+"))==NULL){
printf("can not open file.");
exit(0);
}
for(i=0;i<N;i++){
printf("%-4d %-15s %4.2f %4.2f %4.2f %4.2f\n", stu[i].num, stu[i].str, stu[i].score[0], stu[i].score[1], stu[i].score[2], stu[i].avg);
printf("Location:%d\n", ftell(fp));
fwrite(&stu[i], Len, 1, fp);
}
rewind(fp);
printf("\noutput the student information from file:\n");
for(i=0;i<N;i++){
printf("Location:%d\n", ftell(fp));
fread(&newstu[i], Len, 1, fp);
printf("%-4d %-15s %4.2f %4.2f %4.2f %4.2f\n", newstu[i].num, newstu[i].str, newstu[i].score[0], newstu[i].score[1], newstu[i].score[2], newstu[i].avg);
}
}
|
/*******************************************************************************
Copyright (C) Marvell International Ltd. and its affiliates
This software file (the "File") is owned and distributed by Marvell
International Ltd. and/or its affiliates ("Marvell") under the following
alternative licensing terms. Once you have made an election to distribute the
File under one of the following license alternatives, please (i) delete this
introductory statement regarding license alternatives, (ii) delete the two
license alternatives that you have not elected to use and (iii) preserve the
Marvell copyright notice above.
********************************************************************************
Marvell Commercial License Option
If you received this File from Marvell and you have entered into a commercial
license agreement (a "Commercial License") with Marvell, the File is licensed
to you under the terms of the applicable Commercial License.
********************************************************************************
Marvell GPL License Option
If you received this File from Marvell, you may opt to use, redistribute and/or
modify this File in accordance with the terms and conditions of the General
Public License Version 2, June 1991 (the "GPL License"), a copy of which is
available along with the File in the license.txt file or by writing to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
DISCLAIMED. The GPL License provides additional details about this warranty
disclaimer.
********************************************************************************
Marvell BSD License Option
If you received this File from Marvell, you may opt to use, redistribute and/or
modify this File under the following licensing terms.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Marvell nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef __INCmvOsAsmh
#define __INCmvOsAsmh
#include "mvCommon.h"
#if defined(MV_MIPS)
#define CPU_FAMILY MIPS
#include "asm.h"
#elif defined (MV_PPC)
#define CPU_FAMILY PPC
#include <config.h>
#include <74xx_7xx.h>
#include <ppc_asm.tmpl>
#include <asm/cache.h>
#include <asm/mmu.h>
#include <ppc_defs.h>
#elif defined (MV_ARM)
#define CPU_FAMILY ARM
#include <config.h>
/* BE/ LE swap for Asm */
#if defined(MV_CPU_LE)
#define htoll(x) x
#define HTOLL(sr,tr)
#elif defined(MV_CPU_BE)
#define htoll(x) ((((x) & 0x00ff) << 24) | \
(((x) & 0xff00) << 8) | \
(((x) >> 8) & 0xff00) | \
(((x) >> 24) & 0x00ff))
#define HTOLL(sr,temp) /*sr = A ,B ,C ,D */\
eor temp, sr, sr, ROR #16 ; /*temp = A^C,B^D,C^A,D^B */\
bic temp, temp, #0xFF0000 ; /*temp = A^C,0 ,C^A,D^B */\
mov sr, sr, ROR #8 ; /*sr = D ,A ,B ,C */\
eor sr, sr, temp, LSR #8 /*sr = D ,C ,B ,A */
#endif
#define MV_REG_READ_ASM(toReg, tmpReg, regAddr) \
ldr tmpReg, =(regAddr) ; \
ldr toReg, [tmpReg] ; \
HTOLL(toReg,tmpReg)
#define MV_REG_WRITE_ASM(fromReg, tmpReg, regAddr) \
HTOLL(fromReg,tmpReg) ; \
ldr tmpReg, =(regAddr) ; \
str fromReg, [tmpReg]
#define MV_DV_REG_READ_ASM(toReg, tmpReg, regOffs) \
ldr tmpReg, =(MV_DFL_REGS + regOffs) ; \
ldr toReg, [tmpReg] ; \
HTOLL(toReg,tmpReg)
#define MV_DV_REG_WRITE_ASM(fromReg, tmpReg, regOffs) \
HTOLL(fromReg,tmpReg) ; \
ldr tmpReg, =(MV_DFL_REGS + regOffs) ; \
str fromReg, [tmpReg]
#define MV_MEM_READ_ASM(toReg, tmpReg, offs) \
ldr tmpReg, =(offs) ; \
ldr toReg, [tmpReg] ; \
HTOLL(toReg,tmpReg)
#define MV_MEM_WRITE_ASM(fromReg, tmpReg, offs) \
HTOLL(fromReg,tmpReg) ; \
ldr tmpReg, =(offs) ; \
str fromReg, [tmpReg]
#else
#error "CPU type not selected"
#endif
#endif /* __INCmvOsAsmh */
|
/*
* $Id: ACLBrowser.h,v 1.2 2003/02/21 22:50:04 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* 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.
*
*
* Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
*/
#ifndef SQUID_ACLBROWSER_H
#define SQUID_ACLBROWSER_H
#include "ACL.h"
#include "ACLData.h"
#include "ACLRequestHeaderStrategy.h"
#include "ACLStrategised.h"
class ACLBrowser
{
private:
static ACL::Prototype RegistryProtoype;
static ACLStrategised<char const *> RegistryEntry_;
};
#endif /* SQUID_ACLBROWSER_H */
|
/**
* @file
* @brief header file UI callbacks for missions.
*/
/*
Copyright (C) 2002-2015 UFO: Alien Invasion.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
struct missionResults_s;
void MIS_InitResultScreen(const struct missionResults_s* results);
void MIS_InitCallbacks(void);
void MIS_ShutdownCallbacks(void);
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Andrea Sacco
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Andrea Sacco <andrea.sacco85@gmail.com>
*/
#ifndef UAN_ENERGY_AUV_H
#define UAN_ENERGY_AUV_H
/**
* This is a comprehensive example where all the project's components are used.
* We setup two nodes, one fixed surface gateway and a moving Seaglider AUV,
* both equipped with an acoustic modem.
*
* Using the waypoint mobility model with an underlying GliderMobilityModel,
* we make the glider descend to -1000 meters and then emerge to the water surface.
*
* The AUV sends a generic 17-bytes packet every 10 seconds during the navigation
* process.
* The gateway receives the packets and stores the total bytes amount.
*
* During the simulation the AUV consumes energy for navigation and packets sending.
* The energy drained is subtracted from the main energy source.
* The surface gateway instead consumes energy only receiving packets.
*
* At the end of the simulation are printed out the energy consumptions of the two
* nodes and the networking stats.
*/
#include "ns3/packet.h"
#include "ns3/uan-helper.h"
using namespace ns3;
class UanEnergyAuv
{
public:
UanEnergyAuv ();
~UanEnergyAuv ();
bool RxPacket (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
void SendOnePacket (Ptr<Node> node);
void PrintStats ();
bool Run (void);
uint32_t m_bytesRx;
uint32_t m_sentPackets;
Ptr<Node> m_auv;
Ptr<Node> m_gateway;
};
#endif /* UAN_ENERGY_AUV_H */
|
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <dcrud/ClassID.h>
typedef struct dcrudClassIDImpl_s {
unsigned magic;
byte package_1;
byte package_2;
byte package_3;
byte clazz;
} dcrudClassIDImpl;
UTIL_DECLARE_SAFE_CAST( dcrudClassID );
#ifdef __cplusplus
}
#endif
|
/* $Id: ps_item_data.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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/>.
*/
#include "../private.h"
#include "ps_item_data.h"
#include "idwsf2_strings.h"
/**
* SECTION:ps_item_data
* @short_description: <ps:ItemData>
*
* <figure><title>Schema fragment for ps:ItemData</title>
* <programlisting><![CDATA[
*
* <xs:complexType name="ItemDataType">
* <xs:sequence>
* <xs:element ref="Object"/>
* </xs:sequence>
* </xs:complexType>
* ]]></programlisting>
* </figure>
*/
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
static struct XmlSnippet schema_snippets[] = {
{ "Object", SNIPPET_NODE,
G_STRUCT_OFFSET(LassoIdWsf2PsItemData, Object), NULL, NULL, NULL},
{NULL, 0, 0, NULL, NULL, NULL}
};
static LassoNodeClass *parent_class = NULL;
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
class_init(LassoIdWsf2PsItemDataClass *klass)
{
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
nclass->node_data = g_new0(LassoNodeClassData, 1);
lasso_node_class_set_nodename(nclass, "ItemData");
lasso_node_class_set_ns(nclass, LASSO_IDWSF2_PS_HREF, LASSO_IDWSF2_PS_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
}
GType
lasso_idwsf2_ps_item_data_get_type()
{
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoIdWsf2PsItemDataClass),
NULL,
NULL,
(GClassInitFunc) class_init,
NULL,
NULL,
sizeof(LassoIdWsf2PsItemData),
0,
NULL,
NULL
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoIdWsf2PsItemData", &this_info, 0);
}
return this_type;
}
/**
* lasso_idwsf2_ps_item_data_new:
*
* Creates a new #LassoIdWsf2PsItemData object.
*
* Return value: a newly created #LassoIdWsf2PsItemData object
**/
LassoIdWsf2PsItemData*
lasso_idwsf2_ps_item_data_new()
{
return g_object_new(LASSO_TYPE_IDWSF2_PS_ITEM_DATA, NULL);
}
|
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id$
//
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 2006-2013 by The Odamex Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Random number LUT.
//
//-----------------------------------------------------------------------------
#ifndef __M_RANDOM__
#define __M_RANDOM__
#include "actor.h"
typedef enum {
pr_misc, // 0
pr_all_in_one, // 1
pr_dmspawn, // 2
pr_checkmissilerange, // 3
pr_trywalk, // 4
pr_newchasedir, // 5
pr_look, // 6
pr_chase, // 7
pr_facetarget, // 8
pr_posattack, // 9
pr_sposattack, // 10
pr_cposattack, // 11
pr_cposrefire, // 12
pr_spidrefire, // 13
pr_troopattack, // 14
pr_sargattack, // 15
pr_headattack, // 16
pr_bruisattack, // 17
pr_tracer, // 18
pr_skelfist, // 19
pr_scream, // 20
pr_brainscream, // 21
pr_brainexplode, // 22
pr_spawnfly, // 23
pr_killmobj, // 24
pr_damagemobj, // 25
pr_checkthing, // 26
pr_changesector, // 27
pr_explodemissile, // 28
pr_mobjthinker, // 29
pr_spawnmobj, // 30
pr_spawnmapthing, // 31
pr_spawnpuff, // 32
pr_spawnblood, // 33
pr_checkmissilespawn, // 34
pr_spawnmissile, // 35
pr_punch, // 36
pr_saw, // 37
pr_fireplasma, // 38
pr_gunshot, // 39
pr_fireshotgun2, // 40
pr_bfgspray, // 41
pr_checksight, // 42
pr_playerinspecialsector, // 43
pr_fireflicker, // 44
pr_lightflash, // 45
pr_spawnlightflash, // 46
pr_spawnstrobeflash, // 47
pr_doplat, // 48
pr_throwgib, // 49
pr_vel4dmg, // 50
pr_gengib, // 51
pr_acs, // 52
pr_animatepictures, // 53
pr_obituary, // 54
pr_quake, // 55
pr_playerscream, // 56
pr_playerpain, // 57
pr_bounce, // 58
pr_opendoor, // 59
pr_botmove, // 60
pr_botdofire, // 61
pr_botspawn, // 62
pr_botrespawn, // 63
pr_bottrywalk, // 64
pr_botnewchasedir, // 65
pr_botspawnmobj, // 66
pr_botopendoor, // 67
pr_botchecksight, // 68
// Start new entries -- add new entries below
// End of new entries
NUMPRCLASS // MUST be last item in list
} pr_class_t;
// The random number generator.
int M_Random();
int P_Random();
// As P_Random, but used by the play simulation, one per actor
int P_Random(AActor *actor);
// Optimization safe random difference functions -- Hyper_Eye 04/11/2010
int P_RandomDiff ();
int P_RandomDiff (AActor *actor);
// Fix randoms for demos.
void M_ClearRandom(void);
#endif
|
/*
Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 Mark Aylett <mark.aylett@gmail.com>
This file is part of Aug written by Mark Aylett.
Aug is released under the GPL with the additional exemption that compiling,
linking, and/or using OpenSSL is allowed.
Aug 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.
Aug 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 AUGCTX_LOCK_H
#define AUGCTX_LOCK_H
/**
* @file augctx/lock.h
*
* Global lock functions.
*/
#include "augctx/config.h"
#include "augtypes.h"
#if defined(AUGCTX_BUILD)
AUG_EXTERNC aug_bool
aug_initlock_(void);
#endif /* AUGCTX_BUILD */
/**
* Obtain global mutex lock.
*
* Calls abort() on failure.
*/
AUGCTX_API void
aug_lock(void);
/**
* Release global mutex lock.
*
* Calls abort() on failure.
*/
AUGCTX_API void
aug_unlock(void);
#endif /* AUGCTX_LOCK_H */
|
/**
* The Forgotten Server - a free and open-source MMORPG server emulator
* Copyright (C) 2016 Mark Samman <mark.samman@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FS_EVENTS_H_BD444CC0EE167E5777E4C90C766B36DC
#define FS_EVENTS_H_BD444CC0EE167E5777E4C90C766B36DC
#include "luascript.h"
class Party;
class ItemType;
class Tile;
class Events
{
public:
Events();
void clear();
bool load();
// Creature
bool eventCreatureOnChangeOutfit(Creature* creature, const Outfit_t& outfit);
ReturnValue eventCreatureOnAreaCombat(Creature* creature, Tile* tile, bool aggressive);
ReturnValue eventCreatureOnTargetCombat(Creature* creature, Creature* target);
// Party
bool eventPartyOnJoin(Party* party, Player* player);
bool eventPartyOnLeave(Party* party, Player* player);
bool eventPartyOnDisband(Party* party);
// Player
void eventPlayerOnLook(Player* player, const Position& position, Thing* thing, uint8_t stackpos, int32_t lookDistance);
void eventPlayerOnLookInBattleList(Player* player, Creature* creature, int32_t lookDistance);
void eventPlayerOnLookInTrade(Player* player, Player* partner, Item* item, int32_t lookDistance);
bool eventPlayerOnMoveItem(Player* player, Item* item, uint16_t count, const Position& fromPosition, const Position& toPosition);
bool eventPlayerOnMoveCreature(Player* player, Creature* creature, const Position& fromPosition, const Position& toPosition);
bool eventPlayerOnTurn(Player* player, Direction direction);
bool eventPlayerOnTradeRequest(Player* player, Player* target, Item* item);
bool eventPlayerOnTradeAccept(Player* player, Player* target, Item* item, Item* targetItem);
void eventPlayerOnGainExperience(Player* player, Creature* source, uint64_t& exp, uint64_t rawExp);
void eventPlayerOnLoseExperience(Player* player, uint64_t& exp);
void eventPlayerOnGainSkillTries(Player* player, skills_t skill, uint64_t& tries);
private:
LuaScriptInterface scriptInterface;
// Creature
int32_t creatureOnChangeOutfit;
int32_t creatureOnAreaCombat;
int32_t creatureOnTargetCombat;
// Party
int32_t partyOnJoin;
int32_t partyOnLeave;
int32_t partyOnDisband;
// Player
int32_t playerOnLook;
int32_t playerOnLookInBattleList;
int32_t playerOnLookInTrade;
int32_t playerOnMoveItem;
int32_t playerOnMoveCreature;
int32_t playerOnTurn;
int32_t playerOnTradeRequest;
int32_t playerOnTradeAccept;
int32_t playerOnGainExperience;
int32_t playerOnLoseExperience;
int32_t playerOnGainSkillTries;
};
#endif
|
/*
* This file is part of the KDE project
*
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* 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 CALLIGRA_COMPONENTS_VIEW_H
#define CALLIGRA_COMPONENTS_VIEW_H
#include <QtQuick/QQuickPaintedItem>
namespace Calligra {
namespace Components {
class Document;
/**
* \brief The view provides a View object for viewing Documents.
*
* The View object provides a view on a document.
*/
class View : public QQuickPaintedItem
{
Q_OBJECT
/**
* \property document
* \brief The document this object provides a view on.
*
* \default null
* \get document() const
* \set setDocument()
* \notify documentChanged()
*/
Q_PROPERTY(Calligra::Components::Document* document READ document WRITE setDocument NOTIFY documentChanged)
/**
* \property zoom
* \brief The zoom level the view renders the document at.
*
* \note For more extensive control, use a ViewController object.
*
* \default -1.0 when #document is null or #document is not loaded. 1.0 otherwise.
* \get zoom() const
* \set setZoom()
* \notify zoomChanged()
*/
Q_PROPERTY(float zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
public:
/**
* Constructor.
*
* \param parent The parent item.
*/
explicit View(QQuickItem* parent = 0);
/**
* Destructor.
*/
virtual ~View();
/**
* Inherited from QQuickPaintedItem.
*/
virtual void paint(QPainter* painter) Q_DECL_OVERRIDE;
/**
* Getter for property #document.
*/
Document* document() const;
/**
* Setter for property #document.
*/
void setDocument(Document* newValue);
/**
* Getter for property #zoom.
*/
float zoom() const;
/**
* Setter for property #zoom.
*/
void setZoom(float newValue);
Q_SIGNALS:
/**
* \brief Emitted when a link in the document is clicked.
*
* \param url The URL of the link that was clicked. For internal links, the protocol
* `document://` will be used.
*/
void linkClicked(const QUrl& url);
/**
* Notify signal for property #document.
*/
void documentChanged();
/**
* Notify signal for property #zoom.
*/
void zoomChanged();
protected:
/**
* Inherited from QQuickPaintedItem.
*/
virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) Q_DECL_OVERRIDE;
private:
class Private;
Private* const d;
};
} // Namespace Components
} // Namespace Calligra
Q_DECLARE_METATYPE(Calligra::Components::View*)
#endif // CALLIGRA_COMPONENTS_VIEW_H
|
#ifndef STRAT_SIMPLE_H
#define STRAT_SIMPLE_H
#include "kernel/stratege_machine/stratege.h"
class stratcomplexedef : public strategy
{
public:
int m_stratcolor;
////////////////////////////////////////////////
/// function : Initialise()
/// descrition : intialise the checkpoint color
/// param : none
/// retrun : -1 if fail or 0 if sucess
////////////////////////////////////////////////
void Initialise(int stratcolor);
////////////////////////////////////////////////
/// function : run()
/// descrition : execute the strategie
/// param : none
/// retrun : -1 if fail or 0 if sucess
////////////////////////////////////////////////
int run();
};
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* 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.
*
* Copyright (C) 2011 Red Hat, Inc.
*/
#ifndef __WIFI_UTILS_PRIVATE_H__
#define __WIFI_UTILS_PRIVATE_H__
#include <glib.h>
#include "nm-dbus-interface.h"
#include "wifi-utils.h"
struct WifiData {
char *iface;
int ifindex;
NMDeviceWifiCapabilities caps;
NM80211Mode (*get_mode) (WifiData *data);
gboolean (*set_mode) (WifiData *data, const NM80211Mode mode);
/* Set power saving mode on an interface */
gboolean (*set_powersave) (WifiData *data, guint32 powersave);
/* Return current frequency in MHz (really associated BSS frequency) */
guint32 (*get_freq) (WifiData *data);
/* Return first supported frequency in the zero-terminated list */
guint32 (*find_freq) (WifiData *data, const guint32 *freqs);
/* Return current bitrate in Kbps */
guint32 (*get_rate) (WifiData *data);
gboolean (*get_bssid) (WifiData *data, guint8 *out_bssid);
/* Return a signal strength percentage 0 - 100% for the current BSSID;
* return -1 on errors or if not associated.
*/
int (*get_qual) (WifiData *data);
void (*deinit) (WifiData *data);
gboolean (*get_wowlan) (WifiData *data);
/* OLPC Mesh-only functions */
guint32 (*get_mesh_channel) (WifiData *data);
/* channel == 0 means "auto channel" */
gboolean (*set_mesh_channel) (WifiData *data, guint32 channel);
/* ssid == NULL means "auto SSID" */
gboolean (*set_mesh_ssid) (WifiData *data, const guint8 *ssid, gsize len);
gboolean (*indicate_addressing_running) (WifiData *data, gboolean running);
};
gpointer wifi_data_new (const char *iface, int ifindex, gsize len);
void wifi_data_free (WifiData *data);
#endif /* __WIFI_UTILS_PRIVATE_H__ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.