text stringlengths 4 6.14k |
|---|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2010 Marc Jones <marcj303@gmail.com>
* Copyright (C) 2008 Corey Osgood <corey.osgood@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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <arch/io.h>
#include <device/device.h>
#include <device/pnp.h>
#include <console/console.h>
#include <stdlib.h>
#include <uart8250.h>
#include "chip.h"
#include "f71859.h"
static void pnp_enter_conf_state(device_t dev)
{
outb(0x87, dev->path.pnp.port);
}
static void pnp_exit_conf_state(device_t dev)
{
outb(0xaa, dev->path.pnp.port);
}
static void f71859_init(device_t dev)
{
struct superio_fintek_f71859_config *conf = dev->chip_info;
struct resource *res0;
if (!dev->enabled)
return;
switch(dev->path.pnp.device) {
/* TODO: Might potentially need code for HWM or FDC etc. */
case F71859_SP1:
res0 = find_resource(dev, PNP_IDX_IO0);
init_uart8250(res0->base, &conf->com1);
break;
}
}
static void f71859_pnp_set_resources(device_t dev)
{
pnp_enter_conf_state(dev);
pnp_set_resources(dev);
pnp_exit_conf_state(dev);
}
static void f71859_pnp_enable_resources(device_t dev)
{
pnp_enter_conf_state(dev);
pnp_enable_resources(dev);
pnp_exit_conf_state(dev);
}
static void f71859_pnp_enable(device_t dev)
{
pnp_enter_conf_state(dev);
pnp_set_logical_device(dev);
(dev->enabled) ? pnp_set_enable(dev, 1) : pnp_set_enable(dev, 0);
pnp_exit_conf_state(dev);
}
static struct device_operations ops = {
.read_resources = pnp_read_resources,
.set_resources = f71859_pnp_set_resources,
.enable_resources = f71859_pnp_enable_resources,
.enable = f71859_pnp_enable,
.init = f71859_init,
};
static struct pnp_info pnp_dev_info[] = {
/* TODO: Some of the 0x7f8 etc. values may not be correct. */
{ &ops, F71859_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
};
static void enable_dev(device_t dev)
{
pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
struct chip_operations superio_fintek_f71859_ops = {
CHIP_NAME("Fintek F71859 Super I/O")
.enable_dev = enable_dev
};
|
void *p;
int main(int argc, char **argv) {
int i;
for (i=0; i<10; i++) {
char c;
}
}
|
#ifndef CBM_ANA_JPSI_UTILS_H
#define CBM_ANA_JPSI_UTILS_H
#include "CbmAnaJpsiCandidate.h"
#include "CbmStsTrack.h"
#include "CbmKFVertex.h"
#include "CbmL1PFFitter.h"
#include "L1Field.h"
#include <vector>
#include "TDatabasePDG.h"
using namespace std;
class CbmAnaJpsiUtils{
public:
/*
* Calculates and set track parameters to CbmAnaJpsiCandidate.
* The following parameters are set: fChi2sts, fChi2Prim, fPosition, fMomentum, fMass, fCharge, fEnergy, fRapidity
*/
static void CalculateAndSetTrackParamsToCandidate(
CbmAnaJpsiCandidate* cand,
CbmStsTrack* stsTrack,
CbmKFVertex& kfVertex)
{
CbmL1PFFitter fPFFitter;
vector<CbmStsTrack> stsTracks;
stsTracks.resize(1);
stsTracks[0] = *stsTrack;
vector<L1FieldRegion> vField;
vector<float> chiPrim;
fPFFitter.GetChiToVertex(stsTracks, vField, chiPrim, kfVertex, 3e6);
cand->fChi2sts = stsTracks[0].GetChiSq() / stsTracks[0].GetNDF();
cand->fChi2Prim = chiPrim[0];
const FairTrackParam* vtxTrack = stsTracks[0].GetParamFirst();
vtxTrack->Position(cand->fPosition);
vtxTrack->Momentum(cand->fMomentum);
cand->fMass = TDatabasePDG::Instance()->GetParticle(11)->Mass();
cand->fCharge = (vtxTrack->GetQp() > 0) ?1 :-1;
cand->fEnergy = sqrt(cand->fMomentum.Mag2() + cand->fMass * cand->fMass);
cand->fRapidity = 0.5*TMath::Log((cand->fEnergy + cand->fMomentum.Z()) / (cand->fEnergy - cand->fMomentum.Z()));
}
};
#endif
|
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CONFIGWIDGET_H
#define CONFIGWIDGET_H
#include <QGraphicsProxyWidget>
#include <QWidget>
class KCModuleProxy;
class KComboBox;
class KConfigDialogManager;
#ifdef Q_OS_WINCE
class KCMLdap;
#endif
class ConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit ConfigWidget( QWidget *parent = 0 );
public Q_SLOTS:
void load();
void save();
private:
KConfigDialogManager *mManager;
KComboBox *mMapServiceBox;
#ifndef _WIN32_WCE
KCModuleProxy *mLdapConfigWidget;
#else
KCMLdap *mLdapConfigWidget;
#endif
};
class DeclarativeConfigWidget : public QGraphicsProxyWidget
{
Q_OBJECT
public:
explicit DeclarativeConfigWidget( QGraphicsItem *parent = 0 );
~DeclarativeConfigWidget();
public Q_SLOTS:
void load();
void save();
private:
ConfigWidget *mConfigWidget;
};
#endif
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "adio.h"
/* The following function selects the name of the file to be used to
store the shared file pointer. The shared-file-pointer file is a
hidden file in the same directory as the real file being accessed.
If the real file is /tmp/thakur/testfile, the shared-file-pointer
file will be /tmp/thakur/.testfile.shfp.xxxx, where xxxx is
a random number. This file is created only if the shared
file pointer functions are used and is deleted when the real
file is closed. */
void ADIOI_Shfp_fname(ADIO_File fd, int rank)
{
double tm;
int i, len;
char *slash, *ptr, tmp[128];
fd->shared_fp_fname = (char *) ADIOI_Malloc(256);
if (!rank) {
tm = MPI_Wtime();
while (tm > 1000000000.0) tm -= 1000000000.0;
i = (int) tm;
tm = tm - (double) i;
tm *= 1000000.0;
i = (int) tm;
ADIOI_Strncpy(fd->shared_fp_fname, fd->filename, 256);
#ifdef ROMIO_NTFS
slash = strrchr(fd->filename, '\\');
#else
slash = strrchr(fd->filename, '/');
#endif
if (!slash) {
ADIOI_Strncpy(fd->shared_fp_fname, ".", 2);
ADIOI_Strncpy(fd->shared_fp_fname + 1, fd->filename, 255);
}
else {
ptr = slash;
#ifdef ROMIO_NTFS
slash = strrchr(fd->shared_fp_fname, '\\');
#else
slash = strrchr(fd->shared_fp_fname, '/');
#endif
ADIOI_Strncpy(slash + 1, ".", 2);
len = 256 - (slash+2 - fd->shared_fp_fname);
ADIOI_Strncpy(slash + 2, ptr + 1, len);
}
ADIOI_Snprintf(tmp, 128, ".shfp.%d", i);
ADIOI_Strnapp(fd->shared_fp_fname, tmp, 256);
len = (int)strlen(fd->shared_fp_fname);
MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm);
MPI_Bcast(fd->shared_fp_fname, len+1, MPI_CHAR, 0, fd->comm);
}
else {
MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm);
MPI_Bcast(fd->shared_fp_fname, len+1, MPI_CHAR, 0, fd->comm);
}
}
|
// talk to FC with mkpackage
#ifndef _CTRL_BUMP_H_
#define _CTRL_BUMP_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#ifdef HAVE_MAVLINK_H
#include <mavlink.h>
#ifdef HAVE_MKLINK_H
#include <mklink.h>
#include "debug_channels.h"
#include "core/logger.h"
// #include "thread.h"
#include "protocol/protocollayer.h"
#include "qk_helper.h"
namespace mavhub {
/// Controller: system bumping (gas)
class Ctrl_Bump : public AppLayer<mavlink_message_t>, public AppLayer<mk_message_t> {
public:
/// Constructor
Ctrl_Bump(const std::map<std::string, std::string> args);
virtual ~Ctrl_Bump();
/// mavhub protocolstack input handler
virtual void handle_input(const mavlink_message_t &msg);
virtual void handle_input(const mk_message_t &msg);
protected:
/// this thread's main method
virtual void run();
private:
/// component id
uint16_t component_id;
/// MK external control
extern_control_t extctrl;
// config variables
int gdt_enable;
uint64_t gdt_t0;
int gdt_delay;
double gdt_gas;
// output
int output_enable;
/// controller bias (hovergas)
/* int ctl_bias; */
/* double ctl_Kc; */
/* double ctl_Ti; */
/* double ctl_Td; */
/* int ctl_sp; */
/* int ctl_bref; */
/* int ctl_sticksp; */
// parameters
int param_count;
virtual void read_conf(const std::map<std::string, std::string> args);
virtual void param_list();
virtual double gdt_eval(uint64_t dt);
};
}
#endif // HAVE_MKLINK_H
#endif // HAVE_MAVLINK_H
#endif
|
/*
*
* (C) 2013-17 - ntop.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, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_PF_RING
#ifndef _PF_RING_NETWORK_INTERFACE_H_
#define _PF_RING_NETWORK_INTERFACE_H_
#include "ntop_includes.h"
class PF_RINGInterface : public NetworkInterface {
private:
pfring *pfring_handle;
pfring_stat last_pfring_stat;
u_int32_t getNumDroppedPackets();
public:
PF_RINGInterface(const char *name);
~PF_RINGInterface();
inline const char* get_type() { return(CONST_INTERFACE_TYPE_PF_RING); };
inline pfring* get_pfring_handle() { return(pfring_handle); };
void startPacketPolling();
void shutdown();
bool set_packet_filter(char *filter);
};
#endif /* _PF_RING_NETWORK_INTERFACE_H_ */
#endif /* HAVE_PF_RING */
|
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BHO_PREDEF_PLAT_MINGW32_H
#define BHO_PREDEF_PLAT_MINGW32_H
#include <bho/predef/version_number.h>
#include <bho/predef/make.h>
/* tag::reference[]
= `BHO_PLAT_MINGW32`
http://www.mingw.org/[MinGW] platform.
Version number available as major, minor, and patch.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__MINGW32__+` | {predef_detection}
| `+__MINGW32_VERSION_MAJOR+`, `+__MINGW32_VERSION_MINOR+` | V.R.0
|===
*/ // end::reference[]
#define BHO_PLAT_MINGW32 BHO_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__MINGW32__)
# include <_mingw.h>
# if !defined(BHO_PLAT_MINGW32_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR))
# define BHO_PLAT_MINGW32_DETECTION \
BHO_VERSION_NUMBER(__MINGW32_VERSION_MAJOR,__MINGW32_VERSION_MINOR,0)
# endif
# if !defined(BHO_PLAT_MINGW32_DETECTION)
# define BHO_PLAT_MINGW32_DETECTION BHO_VERSION_NUMBER_AVAILABLE
# endif
#endif
#ifdef BHO_PLAT_MINGW32_DETECTION
# define BHO_PLAT_MINGW32_AVAILABLE
# if defined(BHO_PREDEF_DETAIL_PLAT_DETECTED)
# define BHO_PLAT_MINGW32_EMULATED BHO_PLAT_MINGW32_DETECTION
# else
# undef BHO_PLAT_MINGW32
# define BHO_PLAT_MINGW32 BHO_PLAT_MINGW32_DETECTION
# endif
# include <bho/predef/detail/platform_detected.h>
#endif
#define BHO_PLAT_MINGW32_NAME "MinGW"
#endif
#include <bho/predef/detail/test.h>
BHO_PREDEF_DECLARE_TEST(BHO_PLAT_MINGW32,BHO_PLAT_MINGW32_NAME)
#ifdef BHO_PLAT_MINGW32_EMULATED
#include <bho/predef/detail/test.h>
BHO_PREDEF_DECLARE_TEST(BHO_PLAT_MINGW32_EMULATED,BHO_PLAT_MINGW32_NAME)
#endif
|
//UDP SERVER
#include<sys/socket.h>
#include<sys/types.h>
#include<stdio.h>
#include<errno.h>
#include<strings.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#define LEN 1024
#define MAX_CLIENTS 5
int main(int argc,char *argv[])
{
int sock;
int new,datalen;
int ret,sock_len,len;
socklen_t val;
struct sockaddr_in sock_client;
ssize_t size;
char msg[LEN];
//create socket
sock=socket(AF_INET,SOCK_DGRAM,0);
if(sock==-1)
{
perror("\error in creating socket");
exit(-1);
}
sock_client.sin_family=AF_INET;
//sock_server.sin_port=htons(5000);
sock_client.sin_port=htons(atoi(argv[1]));
sock_client.sin_addr.s_addr=INADDR_ANY;
bzero(&sock_client.sin_zero,8);
sock_len=sizeof(struct sockaddr_in);
//bind socket to interface
ret=bind(sock,(struct sockaddr*)&sock_client,sizeof(sock_client));
if(ret==-1)
{
perror("\nerror in binding socket to the interface");
exit(-1);
}
//communication
while(1)
{
datalen=sizeof(sock_client);
len=recvfrom(sock,msg,LEN,0,(struct sockaddr*)&sock_client,&datalen);
printf("\n%s ",msg);
len=sendto(sock,msg,LEN,0,(struct sockaddr*)&sock_client,datalen);
if(strncmp(msg,"quit",3)==0)
{
printf("\nquiting server\n");
break;
}
}
close(sock);
return 0;
}
|
/*
FXiTe - The Free eXtensIble Text Editor
Copyright (c) 2009-2014 Jeffrey Pohlmeyer <yetanothergeek@gmail.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FXITE_PREFDLG_SNTX_H
#define FXITE_PREFDLG_SNTX_H
class LangGUI:public FXVerticalFrame {
private:
FXDECLARE(LangGUI)
LangGUI(){}
Settings* prefs;
FXListBox *wordlist;
FXListBox *langlist;
FXListBox* tabopts;
FXHorizontalFrame*style_hdr;
FXScrollWindow*scroll;
FXMatrix* style_pan;
FXButton *wildcardbtn;
FXButton *shabangbtn;
FXGroupBox*kwordsgrp;
FXButton*wordbtn;
FXLabel *taboptlab;
FXSpinner* tabwidthspin;
FXLabel* tabwidthlab;
FXTabBook *syntabs;
FXTabItem *opts_tab;
FXFont*scifont;
void MakeOptsTab();
void MakeStyleTab();
public:
long onLangSwitch(FXObject*o,FXSelector sel,void*p);
long onKeywordEdit(FXObject*o,FXSelector sel,void*p);
long onTabOptsSwitch(FXObject*o,FXSelector sel,void*p);
long onSyntaxFiletypeEdit(FXObject*o,FXSelector sel,void*p);
LangGUI(FXComposite*o, Settings* aprefs, FXObject*trg, FXSelector sel);
~LangGUI();
enum {
ID_LANG_SWITCH=FXVerticalFrame::ID_LAST,
ID_EDIT_FILETYPES,
ID_EDIT_SHABANGS,
ID_KWORD_EDIT,
ID_TABOPTS_SWITCH
};
};
#endif
|
#include <stdio.h>
#include <stdlib.h>
int ops=0;
void countingSort(int *a,int start,int end)
{
const int RANGE=1000;
int count[1000]={0};
int i;
int *b=(int*)malloc((end-start)*sizeof(int));
for(i=start; i<end; i++,ops++)
{
count[a[i]]++;
}
for(i=1; i<RANGE; i++,ops++)
{
count[i]+=count[i-1];
}
for(i=end-1;i>=start;i--)
{
b[count[a[i]]-1]=a[i];
count[a[i]]--;
}
for(i=start;i<end;i++)
{
a[i]=b[i];
}
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n;
scanf("%d",&n);
int *a=(int*)malloc(n*sizeof(int)),i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
countingSort(a,0,n);
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\n");
return 0;
}
|
#ifndef _IMAGE_CLASS_H_
#define _IMAGE_CLASS_H_
#include <d3d11.h>
#include <d3dx10math.h>
#include "textureclass.h"
class ImageClass
{
private:
struct VertexType
{
D3DXVECTOR3 position;
D3DXVECTOR2 texture;
};
public:
ImageClass();
ImageClass(const ImageClass&);
~ImageClass();
bool setup(ID3D11Device*, int, int, const std::string&, int, int);
bool update(ID3D11DeviceContext*, int, int);
bool draw(ID3D11DeviceContext*, int, int);
void destroy();
int getIndexCount();
ID3D11ShaderResourceView* getTexture();
private:
bool setupBuffers(ID3D11Device*);
bool updateBuffers(ID3D11DeviceContext*, int, int);
void drawBuffers(ID3D11DeviceContext*);
void destroyBuffers();
bool loadTexture(ID3D11Device*, const std::string&);
void releaseTexture();
private:
ID3D11Buffer *vertexBuffer_, *indexBuffer_;
int vertexCount_, indexCount_;
TextureClass* texture_;
int screenWidth_, screenHeight_;
int bitmapWidth_, bitmapHeight_;
int previousPosX_, previousPosY_;
};
#endif |
/*
Copyright (c)2009 by Nick Borko. All Rights Reserved.
This file is part of OSLua.
OSLua 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.
OSLua 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 OSLua. If not, see <http://www.gnu.org/licenses/>.
*/
#include "oslua.h"
LUA_USERDATA(oslua_alphafx);
LUA_USERDATA(oslua_audiomeformat);
LUA_USERDATA(oslua_color);
LUA_USERDATA(oslua_dialogbutton);
LUA_USERDATA(oslua_dialogresult);
LUA_USERDATA(oslua_dialogstatus);
LUA_USERDATA(oslua_dialogtype);
LUA_USERDATA(oslua_fonttype);
LUA_USERDATA(oslua_intrafontoption);
LUA_USERDATA(oslua_key);
LUA_USERDATA(oslua_location);
LUA_USERDATA(oslua_mbaction);
LUA_USERDATA(oslua_pftype);
LUA_USERDATA(oslua_streamformat);
int oslua_register_font(lua_State *L);
int oslua_register_image(lua_State *L);
int oslua_register_sound(lua_State *L);
/* generic meta function for testing equality */
static int oslua_generic_meta_eq(lua_State *L) {
lua_pushboolean(L, *(unsigned long int *)lua_touserdata(L, 1) == *(unsigned long int *)lua_touserdata(L, 2));
return 1;
}
static int oslua_add_generic_meta(lua_State *L) {
lua_pushcfunction(L, oslua_generic_meta_eq);
lua_setfield(L, -2, "__eq");
return 1;
}
/*** oalua_alphafx ***/
static int oslua_alphafx_meta_add(lua_State *L) {
pushoslua_alphafx(L, checkoslua_alphafx(L, 1) | checkoslua_alphafx(L, 2));
return 1;
}
static const luaL_reg oslua_alphafx_meta[] = {
{ "__add", oslua_alphafx_meta_add },
{ NULL, NULL }
};
/*** oslua_intrafontoption ***/
static int oslua_intrafontoption_meta_add(lua_State *L) {
unsigned long int add;
if(lua_isnumber(L, 2)) {
add = luaL_checkint(L, 2);
if(add >= 0 && add <= 255) {
pushoslua_intrafontoption(L, checkoslua_intrafontoption(L, 1) + add);
} else {
luaL_error(L, "custom width must be from 0 to 255");
}
} else {
pushoslua_intrafontoption(L, checkoslua_intrafontoption(L, 1) | checkoslua_intrafontoption(L, 2));
}
return 1;
}
static const luaL_reg oslua_intrafontoption_meta[] = {
{ "__add", oslua_intrafontoption_meta_add },
{ NULL, NULL }
};
/*** oslua_location ***/
static int oslua_location_meta_add(lua_State *L) {
pushoslua_location(L, checkoslua_location(L, 1) + checkoslua_location(L, 2));
return 1;
}
static const luaL_reg oslua_location_meta[] = {
{ "__add", oslua_location_meta_add },
{ NULL, NULL }
};
int oslua_register_types(lua_State *L) {
registeroslua_alphafx(L);
oslua_add_generic_meta(L);
luaL_register(L, 0, oslua_alphafx_meta);
registeroslua_audiomeformat(L);
oslua_add_generic_meta(L);
registeroslua_color(L);
oslua_add_generic_meta(L);
registeroslua_dialogbutton(L);
oslua_add_generic_meta(L);
registeroslua_dialogresult(L);
oslua_add_generic_meta(L);
registeroslua_dialogstatus(L);
oslua_add_generic_meta(L);
registeroslua_dialogtype(L);
oslua_add_generic_meta(L);
registeroslua_fonttype(L);
oslua_add_generic_meta(L);
registeroslua_intrafontoption(L);
oslua_add_generic_meta(L);
luaL_register(L, 0, oslua_intrafontoption_meta);
registeroslua_key(L);
oslua_add_generic_meta(L);
registeroslua_location(L);
oslua_add_generic_meta(L);
luaL_register(L, 0, oslua_location_meta);
registeroslua_mbaction(L);
oslua_add_generic_meta(L);
registeroslua_pftype(L);
oslua_add_generic_meta(L);
registeroslua_streamformat(L);
oslua_add_generic_meta(L);
/* not enums, but register all other types here */
oslua_register_font(L);
oslua_register_image(L);
oslua_register_sound(L);
return 1;
}
|
/*
* Copyright 2010-2020 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom 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.
*
* OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENXCOM_SACKSOLDIERSTATE_H
#define OPENXCOM_SACKSOLDIERSTATE_H
#include "../Engine/State.h"
namespace OpenXcom
{
class Base;
class Text;
class TextButton;
class Window;
/**
* Window shown when the player wants to sack a Soldier.
*/
class SackSoldierState
:
public State
{
private:
size_t _solId;
Base* _base;
Text
* _txtSoldier,
* _txtTitle;
TextButton
* _btnCancel,
* _btnOk;
Window* _window;
public:
/// Creates a SackSoldier state.
SackSoldierState(
Base* const base,
size_t solId);
/// Cleans up the SackSoldier state.
~SackSoldierState();
/// Handler for clicking the Ok button.
void btnOkClick(Action* action);
/// Handler for clicking the Cancel button.
void btnCancelClick(Action* action);
};
}
#endif
|
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "../qdpll.h"
int main (int argc, char** argv)
{
/* The header file 'qdpll.h' has some comments regarding the usage of the
API. */
/* Please see also the file 'basic-manual-selectors.c'. */
/* Create solver instance. */
QDPLL *depqbf = qdpll_create ();
/* Use the linear ordering of the quantifier prefix. */
qdpll_configure (depqbf, "--dep-man=simple");
/* Enable incremental solving. */
qdpll_configure (depqbf, "--incremental-use");
/* Add and open a new leftmost universal block at nesting level 1. */
qdpll_new_scope_at_nesting (depqbf, QDPLL_QTYPE_FORALL, 1);
/* Add a fresh variable with 'id == 1' to the open block. */
qdpll_add (depqbf, 1);
qdpll_add (depqbf, 99);
/* Close open scope. */
qdpll_add (depqbf, 0);
assert(qdpll_is_var_declared (depqbf, 1));
assert(qdpll_is_var_declared (depqbf, 99));
assert(!qdpll_is_var_declared (depqbf, 50));
assert(!qdpll_is_var_declared (depqbf, 51));
assert(!qdpll_is_var_declared (depqbf, 52));
/* Add a new existential block at nesting level 2. */
qdpll_new_scope_at_nesting (depqbf, QDPLL_QTYPE_EXISTS, 2);
/* Add a fresh variable with 'id == 2' to the existential block. */
qdpll_add (depqbf, 2);
/* Close open scope. */
qdpll_add (depqbf, 0);
/* Add clause: 1 -2 0 */
qdpll_add (depqbf, 1);
qdpll_add (depqbf, -2);
qdpll_add (depqbf, 0);
/* Add clause: -1 2 0 */
qdpll_add (depqbf, -1);
qdpll_add (depqbf, 2);
qdpll_add (depqbf, 0);
/* At this point, the formula looks as follows:
p cnf 2 3
a 1 0
e 2 0
1 -2 0
-1 2 0 */
/* Print formula. */
qdpll_print (depqbf, stdout);
QDPLLResult res = qdpll_sat (depqbf);
/* Expecting that the formula is satisfiable. */
assert (res == QDPLL_RESULT_SAT);
/* res == 10 means satisfiable, res == 20 means unsatisfiable. */
printf ("result is: %d\n", res);
/* Must reset the solver before adding further clauses or variables. */
qdpll_reset (depqbf);
/* Var 99 still is declared although no clauses were added containing literals of 99 before. */
assert(qdpll_is_var_declared (depqbf, 1));
assert(qdpll_is_var_declared (depqbf, 99));
assert(!qdpll_is_var_declared (depqbf, 50));
assert(!qdpll_is_var_declared (depqbf, 51));
assert(!qdpll_is_var_declared (depqbf, 52));
/* Open a new frame of clauses. Clauses added after the 'push' can be
removed later by calling 'pop'. */
qdpll_push (depqbf);
/* Add clause: 1 2 0 */
qdpll_add (depqbf, 1);
qdpll_add (depqbf, 2);
qdpll_add (depqbf, 0);
printf ("added clause '1 2 0' to a new stack frame.\n");
/* At this point, the formula looks as follows:
p cnf 2 3
a 1 0
e 2 0
1 -2 0
-1 2 0
1 2 0 */
qdpll_print (depqbf, stdout);
res = qdpll_sat (depqbf);
/* Expecting that the formula is unsatisfiable due to the most recently
added clause. */
assert (res == QDPLL_RESULT_UNSAT);
printf ("result is: %d\n", res);
/* Print partial countermodel as a value of the leftmost universal variable. */
QDPLLAssignment a = qdpll_get_value (depqbf, 1);
printf ("partial countermodel - value of 1: %s\n", a == QDPLL_ASSIGNMENT_UNDEF ? "undef" :
(a == QDPLL_ASSIGNMENT_FALSE ? "false" : "true"));
qdpll_reset (depqbf);
/* Discard the clause '1 2 0' by popping off the topmost frame. */
qdpll_pop (depqbf);
printf ("discarding clause '1 2 0' by a 'pop'.\n");
/* At this point, the formula looks as follows:
p cnf 2 3
a 1 0
e 2 0
1 -2 0
-1 2 0 */
res = qdpll_sat (depqbf);
/* The formula is satisfiable again because we discarded the clause '1 2 0'
by a 'pop'. */
assert (res == QDPLL_RESULT_SAT);
printf ("result after pop is: %d\n", res);
/* Delete solver instance. */
qdpll_delete (depqbf);
}
|
#ifndef BUILTIN_H
#define BUILTIN_H
int builtin_command (char** command, char** parameters);
int cd (char** parameters);
int cp (char** parameters);
int cmp (char** parameters);
int wc (char** parameters);
int quit (void);
int philosophy (void);
#endif
|
/*
atmega328p_dummy_blinky.c
Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
This file is part of simavr.
simavr 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.
simavr 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 simavr. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifdef F_CPU
#undef F_CPU
#endif
#define F_CPU 16000000
#include <avr/io.h>
#include <stdio.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/sleep.h>
/*
* This demonstrate how to use the avr_mcu_section.h file
* The macro adds a section to the ELF file with useful information for the simulator
*/
#include "avr_mcu_section.h"
AVR_MCU(F_CPU, "atmega328p");
static int uart_putchar(char c, FILE *stream) {
if (c == '\n')
uart_putchar('\r', stream);
loop_until_bit_is_set(UCSR0A, UDRE0);
UDR0 = c;
return 0;
}
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
int main()
{
stdout = &mystdout;
printf("Bootloader properly programmed, and ran me! Huzzah!\n");
// this quits the simulator, since interrupts are off
// this is a "feature" that allows running tests cases and exit
sleep_cpu();
}
|
//
// land_player.hpp
// ServerPlugIn
// 斗地主 房间用户数据
// Created by MikeRiy on 16/8/15.
// Copyright © 2016年 MikeRiy. All rights reserved.
//
#ifndef land_player_h
#define land_player_h
#include "../../com/global.h"
class LandPlayer
{
private:
TOKEN_T tokenid;
USER_T user_id;
SEAT_T seat_id;
public:
LandPlayer(USER_T uid, TOKEN_T tokenid);
virtual~ LandPlayer();
bool isSit()const;
void Stand();
bool SitDown(SEAT_T value);
bool isSeatId(SEAT_T value);
public://gets
SEAT_T getSeatId()const;
USER_T getUserId()const;
TOKEN_T getTokenId()const;
};
#endif /* land_player_hpp */
|
/************************************************************************
File Description :Client Utility
Project :Remote Directory Monitoring System
Purpose :Project Deliverable Submitted By Ayokunle Ade-Aina to
Reference :xxx
************************************************************************/
#ifndef CLIENT_H_
#define CLIENT_H_
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <iostream>
#define DEFAULT_BUFLEN 512
#define DEFAULT_PORT "27015"
///////////////////////////////////////////////////////////////
// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
///////////////////////////////////////////////////////////////
#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib")
#pragma comment (lib, "AdvApi32.lib")
//////////////////////////////
//Global Variables
/////////////////////////////
WSADATA wsaData;
SOCKET ConnectSocket = INVALID_SOCKET;
struct addrinfo *result = NULL, *ptr = NULL, hints;
char *sendbuf = "C:";
char recvbuf[DEFAULT_BUFLEN];
int iResult;
int recvbuflen = DEFAULT_BUFLEN;
bool proceedStatus = true;
////////////////////////////////////
// function prototypes
////////////////////////////////////
bool validateParameters(int argc, char **argv);
bool initializeSocket();
void setup();
bool resolveAddress(char **argv);
bool establishConnection();
bool sendMessage();
bool receiveMessage();
bool shutDownSocket();
void tearDown();
#endif
|
/* A game
Copyright (C) 2017 Ricardas Navickas
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/>. */
#pragma once
#include "graphics/SDL_Manager.h"
#include "graphics/Sprite.h"
#include "Player.h"
#include "Level.h"
#include <string>
class Game {
public:
Game(std::string passedWindowName,
int passedWindowWidth, int passedWindowHeight);
~Game();
void setLevel(std::string levelName);
void start();
void mainLoop();
void inputTick();
private:
//window parameters
std::string windowName; //name
int windowWidth, windowHeight; //dimensions
//input checks
bool wPressed, qPressed, ePressed, escPressed;
SDL_Manager* sdlmgr;
Player* player;
Level* level;
};
|
// -*- C++ -*-
//
// Rank3TensorSpinInfo.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 2003-2019 Peter Richardson, Leif Lonnblad
//
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef THEPEG_Rank3TensorSpinInfo_H
#define THEPEG_Rank3TensorSpinInfo_H
// This is the declaration of the Rank3TensorSpinInfo class.
#include "ThePEG/EventRecord/SpinInfo.h"
#include "ThePEG/Helicity/LorentzRank3Tensor.h"
#include "Rank3TensorSpinInfo.fh"
// #include "Rank3TensorSpinInfo.xh"
#include <array>
namespace ThePEG {
namespace Helicity {
/**
* The Rank3TensorSpinInfo class is the implementation of the spin
* information for tensor particles. It inherits from the SpinInfo
* class and implements the storage of the basis tensors.
*
* These basis states should be set by either matrix elements or
* decayers which are capable of generating spin correlation
* information.
*
* The basis states in the rest frame of the particles can then be
* accessed by decayers to produce the correct correlation.
*
* N.B. in our convention
* 0 is the \f$-3\f$ helicity state,
* 1 is the \f$-2\f$ helicity state,
* 2 is the \f$-1\f$ helicity state,
* 3 is the \f$0\f$ helicity state,
* 4 is the \f$+1\f$ helicity state,
* 5 is the \f$+2\f$ helicity state and
* 6 is the \f$+3\f$ helicity state.
*
* @author Peter Richardson
*
*/
class Rank3TensorSpinInfo: public SpinInfo {
public:
/** @name Standard constructors and destructors. */
//@{
/**
* Default constructor.
*/
Rank3TensorSpinInfo() : SpinInfo(PDT::Spin3), _decaycalc(false) {}
/**
* Standard Constructor.
* @param p the production momentum.
* @param time true if the particle is time-like.
*/
Rank3TensorSpinInfo(const Lorentz5Momentum & p, bool time)
: SpinInfo(PDT::Spin3, p, time), _decaycalc(false) {}
//@}
public:
/** @name Access the basis states. */
//@{
/**
* Set the basis state, this is production state.
* @param hel the helicity (0,1,2,3,4 as described above.)
* @param in the LorentzRank3Tensor for the given helicity.
*/
void setBasisState(unsigned int hel, LorentzRank3Tensor<double> in) const {
assert(hel<7);
_productionstates[hel]=in;
_currentstates [hel]=in;
}
/**
* Set the basis state for the decay.
* @param hel the helicity (0,1,2,3,4 as described above.)
* @param in the LorentzRank3Tensor for the given helicity.
*/
void setDecayState(unsigned int hel, LorentzRank3Tensor<double> in) const {
assert(hel<7);
_decaycalc = true;
_decaystates[hel] = in;
}
/**
* Get the basis state for the production for the given helicity, \a
* hel (0,1,2,3,4 as described above.)
*/
const LorentzRank3Tensor<double> & getProductionBasisState(unsigned int hel) const {
assert(hel<7);
return _productionstates[hel];
}
/**
* Get the basis state for the current for the given helicity, \a
* hel (0,1,2,3,4 as described above.)
*/
const LorentzRank3Tensor<double> & getCurrentBasisState(unsigned int hel) const {
assert(hel<7);
return _currentstates[hel];
}
/**
* Get the basis state for the decay for the given helicity, \a hel
* (0,1,2,3,4,5,6 as described above.)
*/
const LorentzRank3Tensor<double> & getDecayBasisState(unsigned int hel) const {
assert(hel<7);
if(!_decaycalc) {
for(unsigned int ix=0;ix<7;++ix)
_decaystates[ix]=_currentstates[ix].conjugate();
_decaycalc=true;
}
return _decaystates[hel];
}
//@}
/**
* Perform a lorentz rotation of the spin information
*/
virtual void transform(const LorentzMomentum &,const LorentzRotation &);
/**
* Undecay
*/
virtual void undecay() const {
_decaycalc=false;
SpinInfo::undecay();
}
/**
* Reset
*/
virtual void reset() {
undecay();
_currentstates = _productionstates;
SpinInfo::reset();
}
public:
/**
* Standard Init function.
*/
static void Init();
/**
* Standard clone method.
*/
virtual EIPtr clone() const;
private:
/**
* Private and non-existent assignment operator.
*/
Rank3TensorSpinInfo & operator=(const Rank3TensorSpinInfo &) = delete;
private:
/**
* Basis states in the frame in which the particle was produced.
*/
mutable std::array<LorentzRank3Tensor<double>,7> _productionstates;
/**
* Basis states in the frame in which the particle decays.
*/
mutable std::array<LorentzRank3Tensor<double>,7> _decaystates;
/**
* Basis states in the current frame of the particle
*/
mutable std::array<LorentzRank3Tensor<double>,7> _currentstates;
/**
* True if the decay state has been set.
*/
mutable bool _decaycalc;
};
}
}
namespace ThePEG {
}
#endif /* THEPEG_Rank3TensorSpinInfo_H */
|
// Copyright 2021 Google LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef SCOPED_FILE_H
#define SCOPED_FILE_H
#include <utility>
#include <sys/types.h>
// A scoped file descriptor.
class ScopedFile {
public:
// Closes the file descriptor if it is valid.
~ScopedFile();
explicit ScopedFile(int fd) noexcept : fd_(fd) {}
ScopedFile(ScopedFile&& other) noexcept : fd_(std::exchange(other.fd_, -1)) {}
ScopedFile& operator=(ScopedFile other) noexcept {
std::swap(fd_, other.fd_);
return *this;
}
bool IsValid() const { return fd_ >= 0; }
int GetDescriptor() const { return fd_; }
private:
// File descriptor.
int fd_;
};
// A file mapping to memory.
class FileMapping {
public:
// Removes the memory mapping.
~FileMapping();
// Maps a file to memory in read-only mode.
// Throws a system_error in case of error.
explicit FileMapping(const char* path);
// No copy.
FileMapping(const FileMapping&) = delete;
FileMapping& operator=(const FileMapping&) = delete;
// Start of the memory mapping.
const void* data() const { return data_; }
private:
void* data_;
size_t size_;
};
#endif // SCOPED_FILE_H
|
//---------------------------------------------------------------------------
// GameOverState.h
//---------------------------------------------------------------------------
/**
@file GameOverState.h
Contiene la declaración del estado de game over.
@see Application::CApplicationState
@see Application::CGameOverState
@author David Llansó
@date Agosto, 2010
*/
#ifndef __Application_GameOverState_H
#define __Application_GameOverState_H
#include "ApplicationState.h"
// Predeclaración de clases para ahorrar tiempo de compilación
namespace Application
{
class CBaseApplication;
}
namespace Application
{
/**
Como su nombre indica, esta clase es la clase de game over
principal del juego. Es muy sencilla y lo único que hace es cargar
un layout de Hikari al inicio y activarlo y desactivarlo cuando
se activa o desactiva el estado (haciéndo visible/invisible también
el puntero del ratón). También asocia los eventos de los botones
del menú a las funciones C++ que se deben invocar cuando los botones
son pulsados.
<p>
Este estado es Hikari dependiente, lo cual no es deseable, la aplicación
debería ser independiente de las tecnologías usadas.
@ingroup applicationGroup
@author David Llansó
@date Agosto, 2010
*/
class CGameOverState : public CApplicationState
{
public:
/**
Constructor de la clase
*/
CGameOverState(CBaseApplication *app) : CApplicationState(app)
{}
/**
Destructor
*/
virtual ~CGameOverState();
/**
Función llamada cuando se crea el estado (se "engancha" en la
aplicación, para que inicialice sus elementos.
@return true si todo fue bien.
*/
virtual bool init();
/**
Función llamada cuando se elimina ("desengancha") el
estado de la aplicación.
*/
virtual void release();
/**
Función llamada por la aplicación cuando se activa
el estado.
*/
virtual void activate();
/**
Función llamada por la aplicación cuando se desactiva
el estado.
*/
virtual void deactivate();
/**
Función llamada por la aplicación para que se ejecute
la funcionalidad del estado.
@param msecs Número de milisegundos transcurridos desde
la última llamada (o desde la áctivación del estado, en caso
de ser la primera vez...).
*/
virtual void tick(unsigned int msecs);
// Métodos de CKeyboardListener
/**
Método que será invocado siempre que se pulse una tecla.
Será la aplicación quién llame a este método cuando el
estado esté activo. Esta clase NO se registra en el
InputManager sino que es la aplicación quien lo hace y
delega en los estados.
@param key Código de la tecla pulsada.
@return true si el evento ha sido procesado. En este caso
el gestor no llamará a otros listeners.
*/
virtual bool keyPressed(Input::TKey key);
/**
Método que será invocado siempre que se termine la pulsación
de una tecla. Será la aplicación quién llame a este método
cuando el estado esté activo. Esta clase NO se registra en
el InputManager sino que es la aplicación quien lo hace y
delega en los estados.
@param key Código de la tecla pulsada.
@return true si el evento ha sido procesado. En este caso
el gestor no llamará a otros listeners.
*/
virtual bool keyReleased(Input::TKey key);
// Métodos de CMouseListener
/**
Método que será invocado siempre que se mueva el ratón. La
aplicación avisa de este evento al estado actual.
@param mouseState Estado del ratón cuando se lanza el evento.
@return true si el evento ha sido procesado. En este caso
el gestor no llamará a otros listeners.
*/
virtual bool mouseMoved(const Input::CMouseState &mouseState);
/**
Método que será invocado siempre que se pulse un botón. La
aplicación avisa de este evento al estado actual.
@param mouseState Estado del ratón cuando se lanza el evento.
@return true si el evento ha sido procesado. En este caso
el gestor no llamará a otros listeners.
*/
virtual bool mousePressed(const Input::CMouseState &mouseState);
/**
Método que será invocado siempre que se termine la pulsación
de un botón. La aplicación avisa de este evento al estado
actual.
@param mouseState Estado del ratón cuando se lanza el evento.
@return true si el evento ha sido procesado. En este caso
el gestor no llamará a otros listeners.
*/
virtual bool mouseReleased(const Input::CMouseState &mouseState);
private:
}; // CGameOverState
} // namespace Application
#endif // __Application_GameOverState_H
|
#ifndef menu
#define menu
#include "menus.cc"
int menu_principal();
void menu_compactar();
#endif |
/* $Id: scanf.c,v 1.1.1.1 2006/09/14 01:59:06 root Exp $ */
/*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Opsycon AB.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <pmon.h>
/*
* ** fscanf --\ sscanf --\
* ** | |
* ** scanf --+-- vfscanf ----- vsscanf
* **
* ** This not been very well tested.. it probably has bugs
*/
static int vfscanf __P((FILE *, const char *, va_list));
static int vsscanf __P((const char *, const char *, va_list));
#define ISSPACE " \t\n\r\f\v"
/*
* scanf(fmt,va_alist)
*/
int
scanf (const char *fmt, ...)
{
int count;
va_list ap;
va_start (ap, fmt);
count = vfscanf (stdin, fmt, ap);
va_end (ap);
return (count);
}
/*
* fscanf(fp,fmt,va_alist)
*/
int
fscanf (FILE *fp, const char *fmt, ...)
{
int count;
va_list ap;
va_start (ap, fmt);
count = vfscanf (fp, fmt, ap);
va_end (ap);
return (count);
}
/*
* sscanf(buf,fmt,va_alist)
*/
int
sscanf (const char *buf, const char *fmt, ...)
{
int count;
va_list ap;
va_start (ap, fmt);
count = vsscanf (buf, fmt, ap);
va_end (ap);
return (count);
}
/*
* vfscanf(fp,fmt,ap)
*/
static int
vfscanf (FILE *fp, const char *fmt, va_list ap)
{
int count;
char buf[MAXLN + 1];
if (fgets (buf, MAXLN, fp) == 0)
return (-1);
count = vsscanf (buf, fmt, ap);
return (count);
}
/*
* vsscanf(buf,fmt,ap)
*/
static int
vsscanf (const char *buf, const char *s, va_list ap)
{
int count, noassign, width, base, lflag;
const char *tc;
char *t, tmp[MAXLN];
count = noassign = width = lflag = 0;
while (*s && *buf) {
while (isspace (*s))
s++;
if (*s == '%') {
s++;
for (; *s; s++) {
if (strchr ("dibouxcsefg%", *s))
break;
if (*s == '*')
noassign = 1;
else if (*s == 'l' || *s == 'L')
lflag = 1;
else if (*s >= '1' && *s <= '9') {
for (tc = s; isdigit (*s); s++);
strncpy (tmp, tc, s - tc);
tmp[s - tc] = '\0';
atob (&width, tmp, 10);
s--;
}
}
if (*s == 's') {
while (isspace (*buf))
buf++;
if (!width)
width = strcspn (buf, ISSPACE);
if (!noassign) {
strncpy (t = va_arg (ap, char *), buf, width);
t[width] = '\0';
}
buf += width;
} else if (*s == 'c') {
if (!width)
width = 1;
if (!noassign) {
strncpy (t = va_arg (ap, char *), buf, width);
t[width] = '\0';
}
buf += width;
} else if (strchr ("dobxu", *s)) {
while (isspace (*buf))
buf++;
if (*s == 'd' || *s == 'u')
base = 10;
else if (*s == 'x')
base = 16;
else if (*s == 'o')
base = 8;
else if (*s == 'b')
base = 2;
if (!width) {
if (isspace (*(s + 1)) || *(s + 1) == 0)
width = strcspn (buf, ISSPACE);
else
width = strchr (buf, *(s + 1)) - buf;
}
strncpy (tmp, buf, width);
tmp[width] = '\0';
buf += width;
if (!noassign)
atob (va_arg (ap, u_int32_t *), tmp, base);
}
if (!noassign)
count++;
width = noassign = lflag = 0;
s++;
} else {
while (isspace (*buf))
buf++;
if (*s != *buf)
break;
else
s++, buf++;
}
}
return (count);
}
|
/*
*
* (C) 2013-15 - ntop.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, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _NTOP_H_
#define _NTOP_H_
#include "config.h"
#ifdef __FreeBSD
#define _XOPEN_SOURCE
#endif
#include <stdio.h>
#include <stdarg.h>
#ifdef WIN32
#include "ntop_win32.h"
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <pthread.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <poll.h>
#if defined(__OpenBSD__)
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
#else
#include <net/ethernet.h>
#endif
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <syslog.h>
#include <netdb.h>
#include <dirent.h>
#include <pwd.h>
#endif
#ifdef linux
#define __FAVOR_BSD
#endif
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <ctype.h>
#include <fcntl.h>
#include <getopt.h>
#include <string.h>
#include <math.h>
#include <sys/stat.h>
#include <zmq.h>
#ifdef __APPLE__
#include <uuid/uuid.h>
#endif
extern "C" {
#include "pcap.h"
#include "ndpi_main.h"
#include "luajit.h"
#include "lauxlib.h"
#include "lualib.h"
#ifdef HAVE_PF_RING
#include "pfring.h"
#include "pfring_zc.h"
#endif
#ifdef HAVE_NETFILTER
#include <linux/types.h>
#include <linux/netfilter.h> /* for NF_ACCEPT */
#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_queue/libnetfilter_queue.h>
#endif
#include "json.h"
#include <sqlite3.h>
#include "hiredis.h"
};
#include <fstream>
#include "mongoose.h"
#include "ntop_defines.h"
#include "ntop_typedefs.h"
#include "patricia.h"
#include "Trace.h"
#include "NtopGlobals.h"
#include "Prefs.h"
#include "Mutex.h"
#include "IpAddress.h"
#include "Utils.h"
#include "ActivityStats.h"
#include "NdpiStats.h"
#include "DnsStats.h"
#include "EppStats.h"
#include "TrafficStats.h"
#include "PacketStats.h"
#include "ProtoStats.h"
#include "EthStats.h"
#include "LocalTrafficStats.h"
#include "PacketDumperGeneric.h"
#include "PacketDumper.h"
#include "PacketDumperTuntap.h"
#include "GenericHashEntry.h"
#include "AlertCounter.h"
#include "HostContacts.h"
#include "GenericHost.h"
#include "GenericHash.h"
#include "VirtualHost.h"
#include "VirtualHostHash.h"
#include "HTTPStats.h"
#include "Redis.h"
#include "SimpleStringHost.h"
#include "StringHost.h"
#include "StringHash.h"
#include "StatsManager.h"
#include "FlowsManager.h"
#include "NetworkInterfaceView.h"
#include "NetworkInterface.h"
#include "PcapInterface.h"
#ifdef HAVE_PF_RING
#include "PF_RINGInterface.h"
#endif
#ifdef HAVE_NETFILTER
#ifdef NTOPNG_PRO
#include "NetfilterHandler.h"
#endif
#include "NetfilterInterface.h"
#endif
#ifdef NTOPNG_PRO
#include "NtopPro.h"
#include "PacketBridge.h"
#include "TrafficShaper.h"
#include "L7Policer.h"
#include "LuaHandler.h"
#include "NagiosManager.h"
#include "FlowChecker.h"
#include "RedisPro.h"
#endif
#include "ParserInterface.h"
#include "CollectorInterface.h"
#include "HistoricalInterface.h"
#include "ExportInterface.h"
#include "Geolocation.h"
#include "GenericHost.h"
#include "Host.h"
#include "Flow.h"
#include "DB.h"
#include "FlowHash.h"
#include "HostHash.h"
#include "PeriodicActivities.h"
#include "Lua.h"
#include "AddressResolution.h"
#include "CommunitiesManager.h"
#include "Categorization.h"
#include "HTTPBL.h"
#include "HTTPserver.h"
#include "RuntimePrefs.h"
#include "Ntop.h"
#ifdef WIN32
extern "C" {
const char *strcasestr(const char *haystack, const char *needle);
int strncasecmp(const char *s1, const char *s2, unsigned int n);
};
#endif
#endif /* _NTOP_H_ */
|
#ifndef WRITEMEMORYSETTING_H
#define WRITEMEMORYSETTING_H
#include "ISetting.h"
#include "../XMLParser/XMLNode.h"
#include "../BootRom/flashtool_api.h"
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdio.h>
namespace APCore
{
class WriteMemorySetting :public ISetting
{
public:
typedef void (__stdcall * void_callback)();
WriteMemorySetting();
virtual void LoadXML(const XML::Node &node);
virtual void SaveXML(XML::Node &node) const;
virtual QSharedPointer<APCore::ICommand> CreateCommand(APKey key);
//setters
void set_cb_write_memory_progress(const CALLBACK_WRITE_FLASH_PROGRESS cb)
{
cb_write_flash_progress = cb;
}
void set_cb_write_memory_init(void_callback cb)
{
cb_write_flash_init = cb;
}
void set_flash_type(const HW_StorageType_E storage_type)
{
this->storage_type_ = storage_type;
}
void set_addressing_mode(const AddressingMode addr_mode)
{
this->addr_mode_ = addr_mode;
}
void set_address(const U64 addr)
{
this->addr_ = addr;
}
void set_container_length(unsigned int container_len)
{
this->container_len_ = container_len;
}
void set_input_mode(const InputMode input_mode)
{
this->input_mode_ = input_mode;
}
void set_program_mode(const ProgramMode prog_mode)
{
this->prog_mode_ = prog_mode;
}
void set_input(const std::string &file_name)
{
this->input_file_ = file_name.c_str();
}
void set_input_length(U64 input_len)
{
this->input_len_ = input_len;
}
void set_part_id(U32 id)
{
this->part_id_ = id;
}
private:
CALLBACK_WRITE_FLASH_PROGRESS cb_write_flash_progress;
void_callback cb_write_flash_init;
U64 input_len_;
unsigned int container_len_;
U64 addr_;
InputMode input_mode_;
ProgramMode prog_mode_;
AddressingMode addr_mode_;
std::string input_file_;
U32 part_id_;
};
}
#endif // WRITEMEMORYSETTING_H
|
/* -*- buffer-read-only: t -*- vi: set ro: */
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* base64.h -- Encode binary data using printable characters.
Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc.
Written by Simon Josefsson.
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, 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 BASE64_H
# define BASE64_H
/* Get size_t. */
# include <stddef.h>
/* Get bool. */
# include <stdbool.h>
/* This uses that the expression (n+(k-1))/k means the smallest
integer >= n/k, i.e., the ceiling of n/k. */
# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
struct base64_decode_context
{
unsigned int i;
char buf[4];
};
extern bool isbase64 (char ch);
extern void base64_encode (const char *in, size_t inlen,
char *out, size_t outlen);
extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
extern bool base64_decode_ctx (struct base64_decode_context *ctx,
const char *in, size_t inlen,
char *out, size_t *outlen);
extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
const char *in, size_t inlen,
char **out, size_t *outlen);
#define base64_decode(in, inlen, out, outlen) \
base64_decode_ctx (NULL, in, inlen, out, outlen)
#define base64_decode_alloc(in, inlen, out, outlen) \
base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
#endif /* BASE64_H */
|
/*
Il seguente programma calcola l'indice di massa corporea secondo la formula
BMI = PesoInKg/(Altezza^2)
*/
#include <stdlib.h>
#include <stdio.h>
int main(void)
{//Inizio Funzione Main
float altezza = 0;
float peso = 0;
printf("Per cortesia inserire il proprio peso in kilogrammi: ");
scanf("%f", &peso);
printf("\nPer cortesia inserire la propria altezza in metri: ");
scanf("%f", &altezza);
printf("\nIl proprio BMI è pari a: %f\n\n", (peso / (altezza * altezza)));
puts("VALORI del BMI");
puts("Sottopeso:\tmeno di 18.5");
puts("Normale:\ttra 18.5 e 24.9");
puts("Sovrappeso:\ttra 25 e 29.9");
puts("Obeso:\t\t30 o oltre");
return 0;//La Funzione main restituisce 0 in caso di esito positivo
}//Fine Funzione Main
|
/*
Copyright (C) 2012 Andrew Darqui
This file is part of darqbot.
darqbot 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.
darqbot 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 darqbot. If not, see <http://www.gnu.org/licenses/>.
Contact: [website: http://www.adarq.org]
email: andrew.darqui@g m a i l . c o m
*/
/* darqbot 1.0 (2012)
multi purpose chat & knowledge bot
-- adarqui ::: adarq.org
*/
#ifndef MOD_SIG_H
#define MOD_SIG_H
#include "bot.h"
module_t mod_sig_info;
bot_t *sig_init(dlist_t *, bot_t *);
bot_t *sig_fini(dlist_t *, bot_t *);
bot_t *sig_help(dlist_t *, bot_t *);
bot_t *sig_run(dlist_t *, bot_t *);
char *sig_change_string(char *, int);
void __sig_init__(void) __attribute__ ((constructor));
#endif
|
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//
// Purpose: interface to valve controller
//
//=============================================================================
#ifndef ISTEAMCONTROLLER_H
#define ISTEAMCONTROLLER_H
#ifdef _WIN32
#pragma once
#endif
#include "isteamclient.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing stats, achievements, and leaderboard information
//-----------------------------------------------------------------------------
class ISteamController
{
public:
};
#define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
/*
struct ControllerCallback_t
{
enum { k_iCallback = k_iSteamControllerCallbacks + 1 };
};
*/
#pragma pack( pop )
#endif // ISTEAMCONTROLLER_H
|
//
// AppDelegate.h
// Selfie
//
// Created by Daniel Suo on 6/12/14.
// Copyright (c) 2014 The Leather Apron Club. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import <Crashlytics/Crashlytics.h>
#import "Utilities.h"
#import "State.h"
#import "Queue.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
|
/*
* RedBoot firmware support
*
* Author: Scott Wood <scottwood@freescale.com>
*
* Copyright (c) 2007 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include "ops.h"
#include "stdio.h"
#include "redboot.h"
#include "fsl-soc.h"
#include "io.h"
static bd_t bd;
BSS_STACK(4096);
#define MHZ(x) ((x + 500000) / 1000000)
static void platform_fixups(void)
{
void *node;
dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
dt_fixup_mac_addresses(bd.bi_enetaddr);
dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 16, bd.bi_busfreq);
node = finddevice("/soc/cpm/brg");
if (node)
{
printf("BRG clock-frequency <- 0x%x (%dMHz)\r\n",
bd.bi_busfreq, MHZ(bd.bi_busfreq));
setprop(node, "clock-frequency", &bd.bi_busfreq, 4);
}
}
void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7)
{
memcpy(&bd, (char *)r3, sizeof(bd));
if (bd.bi_tag != 0x42444944)
{
return;
}
simple_alloc_init(_end,
bd.bi_memstart + bd.bi_memsize - (unsigned long)_end,
32, 64);
fdt_init(_dtb_start);
serial_console_init();
platform_ops.fixups = platform_fixups;
loader_info.cmdline = (char *)bd.bi_cmdline;
loader_info.cmdline_len = strlen((char *)bd.bi_cmdline);
}
|
/**********************************************************************
mumpot - Copyright (C) 2008 - Andreas Kemnade
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, 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 K_PRINTDLG_H
#define K_PRINTDLG_H
struct print_job {
char *tmpname;
int fd;
int start_page;
int end_page;
int page;
GList *page_data;
void *data;
};
struct printdlg_t;
int get_paper_width();
int get_paper_height();
char *get_paper_name();
/* open a pagesize dialog */
void select_pagesize();
struct printdlg_t *create_printdlg(int numpages, void (*cancel_cb)(void *),
void (*ok_cb)(void *,struct print_job *), void *data);
void delete_print_job(struct print_job *pj);
#endif
|
/*************************************************************************
* Copyright 2009/2010/2011 Ralph Spitzner (rasp@spitzner.org)
*
* This file is part of v2Yahdr.
*
* v2Yahdr 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.
*
* Yahdr 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 v2Yahdr. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
/***
recording thread always has precedence when tuning
***/
#include "ydefs.h"
static sqlite3_stmt *rec_stmt;
static int rec_rc;
bool recorder_tune(char *name)
{
/**
Shaft, can you dig it? - Isaac hayes
**/
}
/***
four entrys per recording in db
start time,duration, channel, name of broadcast...
***/
/***
'what' looks like:
kabel eins@SEP@Quincy@SEP@1304576820@SEP@3600
talk is backchannel to http
*/
char *sched_rec(FILE *talk,char *what)
{
char *station,*bcast,*p,*p2;
uint64_t start;
uint16_t dur;
char sql[1024];
station = what;
/***
Got to keep 'em seperated - Green Day
***/
p = strstr(what,"@SEP@");
*p = '\0';
p += 5;
bcast = p;
p = strstr(p,"@SEP@");
*p = '\0';
p += 5;
p2 = strstr(p,"@SEP@");
*p2 = '\0';
start = atol(p);
p2 += 5;
dur = atoi(p2);
sprintf(sql,"insert into recordings values ('%s','%s','%lld','%d')",
station,bcast,start,dur);
sqlite3_prepare_v2(rec_db, sql, -1, &rec_stmt, 0);
sqlite3_step(rec_stmt);
sqlite3_finalize(rec_stmt);
}
/**
check rec_db every 4 minutes,
start recordings if somethings pending
**/
void *rec_runner(void *laber)
{
char sql[1024];
time_t now;
const unsigned char station,bcast;
time_t start;
uint16_t dur;
while(1)
{
sleep(240);
}
}
|
/// \file
/// \brief All the packet identifiers used by RakNet. Packet identifiers comprise the first byte of any message.
///
/// This file is part of RakNet Copyright 2003 Kevin Jenkins.
///
/// Usage of RakNet is subject to the appropriate license agreement.
/// Creative Commons Licensees are subject to the
/// license found at
/// http://creativecommons.org/licenses/by-nc/2.5/
/// Single application licensees are subject to the license found at
/// http://www.rakkarsoft.com/SingleApplicationLicense.html
/// Custom license users are subject to the terms therein.
/// GPL license users are subject to 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 __PACKET_ENUMERATIONS_H
#define __PACKET_ENUMERATIONS_H
/// You should not edit the file PacketEnumerations.h as it is a part of RakNet static library
/// To define your own message id, define an enum following the code example that follows.
///
/// \code
/// enum {
/// ID_MYPROJECT_MSG_1 = ID_USER_PACKET_ENUM
/// ID_MYPROJECT_MSG_2,
/// ...
/// };
/// \endcode
///
/// \note All these enumerations should be casted to (unsigned char) before writing them to RakNet::BitStream
enum PacketEnumeration
{
ID_INTERNAL_PING = 6,
ID_PING,
ID_PING_OPEN_CONNECTIONS,
ID_CONNECTED_PONG,
ID_REQUEST_STATIC_DATA,
ID_CONNECTION_REQUEST,
ID_AUTH_KEY,
ID_BROADCAST_PINGS = 14,
ID_SECURED_CONNECTION_RESPONSE,
ID_SECURED_CONNECTION_CONFIRMATION,
ID_RPC_MAPPING,
ID_SET_RANDOM_NUMBER_SEED = 19,
ID_RPC,
ID_RPC_REPLY,
ID_DETECT_LOST_CONNECTIONS = 23,
ID_OPEN_CONNECTION_REQUEST,
ID_OPEN_CONNECTION_REPLY,
ID_OPEN_CONNECTION_COOKIE,
ID_RSA_PUBLIC_KEY_MISMATCH = 28,
ID_CONNECTION_ATTEMPT_FAILED,
ID_NEW_INCOMING_CONNECTION = 30,
ID_NO_FREE_INCOMING_CONNECTIONS = 31,
ID_DISCONNECTION_NOTIFICATION,
ID_CONNECTION_LOST,
ID_CONNECTION_REQUEST_ACCEPTED,
ID_CONNECTION_BANNED = 36,
ID_INVALID_PASSWORD,
ID_MODIFIED_PACKET,
ID_PONG,
ID_TIMESTAMP,
ID_RECEIVED_STATIC_DATA,
ID_REMOTE_DISCONNECTION_NOTIFICATION,
ID_REMOTE_CONNECTION_LOST,
ID_REMOTE_NEW_INCOMING_CONNECTION,
ID_REMOTE_EXISTING_CONNECTION,
ID_REMOTE_STATIC_DATA,
ID_ADVERTISE_SYSTEM = 55,
ID_PLAYER_SYNC = 207,
ID_MARKERS_SYNC = 208,
ID_UNOCCUPIED_SYNC = 209,
ID_TRAILER_SYNC = 210,
ID_PASSENGER_SYNC = 211,
ID_SPECTATOR_SYNC = 212,
ID_AIM_SYNC = 203,
ID_VEHICLE_SYNC = 200,
ID_RCON_COMMAND = 201,
ID_RCON_RESPONCE = 202,
ID_WEAPONS_UPDATE = 204,
ID_STATS_UPDATE = 205,
ID_BULLET_SYNC = 206,
};
#endif
|
// Copyright 2014 Loïc Cerf (lcerf@dcc.ufmg.br)
// This file is part of multidupehack.
// multidupehack is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation
// multidupehack 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 multidupehack; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef ABSTRACT_TUPLE_POINT_DATA_H
#define ABSTRACT_TUPLE_POINT_DATA_H
#include <vector>
#include <limits>
#include "SlopeSums.h"
using namespace std;
class AbstractTuplePointData
{
public:
virtual ~AbstractTuplePointData();
virtual AbstractTuplePointData* clone() const = 0;
virtual const bool setTuplePoints(const vector<vector<unsigned int>>::const_iterator dimensionIt, const pair<double, double>& point, const unsigned int sizeThreshold, const unsigned int lastDimensionCardinality) = 0;
virtual void minCoordinates(double& minX, double& minY) const = 0;
virtual void translate(const double deltaX, const double deltaY) = 0;
void translateToPositiveQuadrant();
virtual void setSlopeSums(SlopeSums& slopeSums) const = 0;
virtual void increaseSlopeSums(const vector<vector<unsigned int>>& present, const vector<unsigned int>::const_iterator dimensionIdIt, SlopeSums& slopeSums) const = 0;
virtual void decreaseSlopeSums(const vector<vector<unsigned int>>& present, const vector<vector<unsigned int>>& potential, const vector<unsigned int>::const_iterator dimensionIdIt, SlopeSums& slopeSums) const = 0;
virtual void increaseSlopeSums(const vector<vector<unsigned int>>& present, const vector<unsigned int>& elementsSetPresent, const vector<unsigned int>::const_iterator dimensionIdIt, const vector<unsigned int>::const_iterator presentDimensionIdIt, SlopeSums& slopeSums) const = 0;
virtual void decreaseSlopeSums(const vector<vector<unsigned int>>& present, const vector<vector<unsigned int>>& potential, const vector<unsigned int>& elementsSetAbsent, const vector<unsigned int>::const_iterator dimensionIdIt, const vector<unsigned int>::const_iterator absentDimensionIdIt, SlopeSums& slopeSums) const = 0;
};
#endif /*ABSTRACT_TUPLE_POINT_DATA_H*/
|
#ifndef _PROTOCOL_KISS
#define _PROTOCOL_KISS 0x02
#include "../hardware/AFSK.h"
#include "../hardware/Serial.h"
#include "../util/time.h"
#include "AX25.h"
#define FEND 0xC0
#define FESC 0xDB
#define TFEND 0xDC
#define TFESC 0xDD
#define CMD_UNKNOWN 0xFE
#define CMD_DATA 0x00
#define CMD_TXDELAY 0x01
#define CMD_P 0x02
#define CMD_SLOTTIME 0x03
#define CMD_TXTAIL 0x04
#define CMD_FULLDUPLEX 0x05
#define CMD_SETHARDWARE 0x06
#define CMD_READY 0x0F
#define CMD_RETURN 0xFF
void kiss_init(AX25Ctx *ax25, Afsk *afsk, Serial *ser);
void kiss_csma(AX25Ctx *ctx, uint8_t *buf, size_t len);
void kiss_messageCallback(AX25Ctx *ctx);
void kiss_serialCallback(uint8_t sbyte);
#endif |
/*
* Copyright (C) 2003-2022 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat 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.
*
* WeeChat 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 WeeChat. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_PLUGIN_LOGGER_COMMAND_H
#define WEECHAT_PLUGIN_LOGGER_COMMAND_H
extern void logger_command_init ();
#endif /* WEECHAT_PLUGIN_LOGGER_COMMAND_H */
|
/* radare - LGPL - Copyright 2009-2014 pancake */
#include <r_debug.h>
#include "../config.h"
static RDebugPlugin *debug_static_plugins[] =
{ R_DEBUG_STATIC_PLUGINS };
R_API void r_debug_plugin_init(RDebug *dbg) {
RDebugPlugin *static_plugin;
int i;
INIT_LIST_HEAD (&dbg->plugins);
for (i=0; debug_static_plugins[i]; i++) {
static_plugin = R_NEW (RDebugPlugin);
memcpy (static_plugin, debug_static_plugins[i], sizeof (RDebugPlugin));
r_debug_plugin_add (dbg, static_plugin);
}
}
R_API bool r_debug_use(RDebug *dbg, const char *str) {
struct list_head *pos;
if (str) {
list_for_each_prev (pos, &dbg->plugins) {
RDebugPlugin *h = list_entry (pos, RDebugPlugin, list);
if (h->name && !strcmp (str, h->name)) {
dbg->h = h;
if (dbg->anal && dbg->anal->cur)
r_debug_set_arch (dbg, dbg->anal->cur->arch, dbg->bits);
dbg->bp->breakpoint = dbg->h->breakpoint;
dbg->bp->user = dbg;
}
}
}
if (dbg->h && dbg->h->reg_profile) {
char *p = dbg->h->reg_profile (dbg);
if (p) {
r_reg_set_profile_string (dbg->reg, p);
if (dbg->anal) {
//r_reg_free (dbg->anal->reg);
dbg->anal->reg = dbg->reg;
}
if (dbg->h->init)
dbg->h->init (dbg);
r_reg_set_profile_string (dbg->reg, p);
free (p);
} else {
eprintf ("Cannot retrieve reg profile from debug plugin (%s)\n", dbg->h->name);
}
}
return (dbg->h != NULL);
}
R_API int r_debug_plugin_list(RDebug *dbg, int mode) {
char spaces[16];
int count = 0;
struct list_head *pos;
memset (spaces, ' ', 15);
spaces[15] = 0;
list_for_each_prev (pos, &dbg->plugins) {
RDebugPlugin *h = list_entry(pos, RDebugPlugin, list);
int sp = 8-strlen (h->name);
spaces[sp] = 0;
if (mode == 'q') {
dbg->cb_printf ("%s\n", h->name);
} else {
dbg->cb_printf ("%d %s %s %s%s\n",
count, (h == dbg->h)? "dbg": "---",
h->name, spaces, h->license);
}
spaces[sp] = ' ';
count++;
}
return false;
}
R_API bool r_debug_plugin_add(RDebug *dbg, RDebugPlugin *foo) {
if (!dbg || !foo || !foo->name) return false;
list_add_tail (&(foo->list), &(dbg->plugins));
return true;
}
|
/*
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "rml_oob.h"
int
orte_rml_oob_ping(const char* uri,
const struct timeval* tv)
{
return ORTE_ERR_NOT_SUPPORTED;
}
|
/*
* @brief Estimation of amplitude using DESA-2 algorithm.
*
* Contributor(s):
*
* Eric des Courtis <eric.des.courtis@benbria.com>
* Piotr Gregor <piotrgregor@rsyncme.org>
*/
#ifndef __AVMD_AMPLITUDE_H__
#define __AVMD_AMPLITUDE_H__
#include "avmd_buffer.h"
#ifdef WIN32
#define __attribute__(x)
#endif
double avmd_amplitude(circ_buffer_t *, size_t i, double f) __attribute__ ((nonnull(1)));
#endif /* __AVMD_AMPLITUDE_H__ */
|
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <string>
#include <Swiften/Parser/GenericElementParser.h>
#include <Swiften/Elements/StreamFeatures.h>
namespace Swift {
class StreamFeaturesParser : public GenericElementParser<StreamFeatures> {
public:
StreamFeaturesParser();
private:
void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
void handleEndElement(const std::string& element, const std::string& ns);
void handleCharacterData(const std::string& data);
private:
int currentDepth_;
std::string currentText_;
bool inMechanisms_;
bool inMechanism_;
bool inCompression_;
bool inCompressionMethod_;
};
}
|
#ifndef TI_H_
#define TI_H_
#include "Video.h"
#include "TemporalMap.h"
class TI {
public:
void computeTI(Video, Video, TemporalMap,int, int );
double getTI();
private:
double TI_Avg;
};
#endif /* TI_H_ */
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_0_r1_1;
atomic_int atom_1_r1_1;
atomic_int atom_1_r3_0;
atomic_int atom_1_r5_1;
void *t0(void *arg){
label_1:;
int v2_r1 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v3_r3 = v2_r1 ^ v2_r1;
int v4_r3 = v3_r3 + 1;
atomic_store_explicit(&vars[1], v4_r3, memory_order_seq_cst);
int v20 = (v2_r1 == 1);
atomic_store_explicit(&atom_0_r1_1, v20, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v6_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v8_r3 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v10_r5 = atomic_load_explicit(&vars[2], memory_order_seq_cst);
int v11_r6 = v10_r5 ^ v10_r5;
int v12_r6 = v11_r6 + 1;
atomic_store_explicit(&vars[0], v12_r6, memory_order_seq_cst);
int v21 = (v6_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v21, memory_order_seq_cst);
int v22 = (v8_r3 == 0);
atomic_store_explicit(&atom_1_r3_0, v22, memory_order_seq_cst);
int v23 = (v10_r5 == 1);
atomic_store_explicit(&atom_1_r5_1, v23, memory_order_seq_cst);
return NULL;
}
void *t2(void *arg){
label_3:;
atomic_store_explicit(&vars[2], 1, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
pthread_t thr2;
atomic_init(&vars[0], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[2], 0);
atomic_init(&atom_0_r1_1, 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_1_r3_0, 0);
atomic_init(&atom_1_r5_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_create(&thr2, NULL, t2, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
pthread_join(thr2, NULL);
int v13 = atomic_load_explicit(&atom_0_r1_1, memory_order_seq_cst);
int v14 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v15 = atomic_load_explicit(&atom_1_r3_0, memory_order_seq_cst);
int v16 = atomic_load_explicit(&atom_1_r5_1, memory_order_seq_cst);
int v17_conj = v15 & v16;
int v18_conj = v14 & v17_conj;
int v19_conj = v13 & v18_conj;
if (v19_conj == 1) assert(0);
return 0;
}
|
/* mail-enhanced-store.c
*
* Copyright (C) 2010 Christian Hergert <chris@dronelabs.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib/gi18n.h>
#include "mail-enhanced-store.h"
/**
* mail_enhanced_store_new:
* @session: (in): A #MailSession.
*
* Creates a #GtkTreeStore containing information for the enhanced mail view.
*
* XXX: This is currently demo code while we prototype.
*
* Returns: A #GtkListStore.
* Side effects: None.
*/
GtkTreeStore*
mail_enhanced_store_new (MailSession *session)
{
GtkTreeStore *store;
GtkTreeIter iter;
store = gtk_tree_store_new(3,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_INT);
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
MAIL_ENHANCED_STORE_COLUMN_ICON_NAME, "applications-debugging",
MAIL_ENHANCED_STORE_COLUMN_TITLE, _("Bugzilla"),
MAIL_ENHANCED_STORE_COLUMN_COUNT, 5,
-1);
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
MAIL_ENHANCED_STORE_COLUMN_ICON_NAME, GTK_STOCK_FIND,
MAIL_ENHANCED_STORE_COLUMN_TITLE, _("Review Board"),
MAIL_ENHANCED_STORE_COLUMN_COUNT, 3,
-1);
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
MAIL_ENHANCED_STORE_COLUMN_ICON_NAME, "news-feed",
MAIL_ENHANCED_STORE_COLUMN_TITLE, _("Mailing Lists"),
MAIL_ENHANCED_STORE_COLUMN_COUNT, 1,
-1);
return store;
}
|
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file cond_gp.h
* @author Richard Preen <rpreen@gmail.com>
* @copyright The Authors.
* @date 2016--2021.
* @brief Tree GP condition functions.
*/
#pragma once
#include "condition.h"
#include "gp.h"
#include "xcsf.h"
/**
* @brief Tree GP condition data structure.
*/
struct CondGP {
struct GPTree gp; //!< GP tree
};
void
cond_gp_param_defaults(struct XCSF *xcsf);
char *
cond_gp_param_json_export(const struct XCSF *xcsf);
void
cond_gp_param_json_import(struct XCSF *xcsf, cJSON *json);
bool
cond_gp_crossover(const struct XCSF *xcsf, const struct Cl *c1,
const struct Cl *c2);
bool
cond_gp_general(const struct XCSF *xcsf, const struct Cl *c1,
const struct Cl *c2);
bool
cond_gp_match(const struct XCSF *xcsf, const struct Cl *c, const double *x);
bool
cond_gp_mutate(const struct XCSF *xcsf, const struct Cl *c);
void
cond_gp_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src);
void
cond_gp_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x);
void
cond_gp_free(const struct XCSF *xcsf, const struct Cl *c);
void
cond_gp_init(const struct XCSF *xcsf, struct Cl *c);
void
cond_gp_print(const struct XCSF *xcsf, const struct Cl *c);
void
cond_gp_update(const struct XCSF *xcsf, const struct Cl *c, const double *x,
const double *y);
double
cond_gp_size(const struct XCSF *xcsf, const struct Cl *c);
size_t
cond_gp_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
size_t
cond_gp_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
char *
cond_gp_json_export(const struct XCSF *xcsf, const struct Cl *c);
void
cond_gp_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json);
/**
* @brief Tree GP condition implemented functions.
*/
static struct CondVtbl const cond_gp_vtbl = {
&cond_gp_crossover, &cond_gp_general, &cond_gp_match,
&cond_gp_mutate, &cond_gp_copy, &cond_gp_cover,
&cond_gp_free, &cond_gp_init, &cond_gp_print,
&cond_gp_update, &cond_gp_size, &cond_gp_save,
&cond_gp_load, &cond_gp_json_export, &cond_gp_json_import
};
|
#ifndef CAPITALISM_BUILDINGTYPEMANAGER_H
#define CAPITALISM_BUILDINGTYPEMANAGER_H
#include <string>
#include <unordered_map>
#include "Base/Manager.h"
#include "Model/Map/Building/TypeBuilding.h"
class BuildingTypeManager
{
public:
static BuildingTypeManager* getInstance();
const std::unordered_map<std::string, TypeBuilding*> &getTypesBuilding() const;
TypeBuilding* getTypeBuilding(std::string &type);
void addTypeBuilding(TypeBuilding* typeBuilding);
private:
BuildingTypeManager();
static BuildingTypeManager* buildingTypeManager;
std::unordered_map<std::string, TypeBuilding*> typesBuilding;
};
#endif //CAPITALISM_BUILDINGTYPEMANAGER_H
|
/*
Copyright (©) 2003-2022 Teus Benschop.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config/libraries.h>
void sources_morphgnt_parse ();
|
/*
* Copyright 2016 Clément Vuchener
*
* 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 INPUT_DEVICE_H
#define INPUT_DEVICE_H
#include <cstdint>
#include <functional>
#include "jstpl/jstpl.h"
/**
* \defgroup InputDevices Input devices
*/
/**
* This is the base class for every input device class used by drivers.
*
* \ingroup InputDevices
*/
class InputDevice
{
public:
/**
* Event contains the data for an input event.
*
* It must have a "type" entry. Other entries may vary depending on
* the driver and type.
*
* A event whose type is a valid EV_* type from linux input events
* must have "code" and "value" entries.
*/
typedef std::map<std::string, int> Event;
virtual ~InputDevice ();
/**
* Start reading events
*/
virtual void start () = 0;
/**
* Stop reading events
*/
virtual void stop () = 0;
/**
* Signal sent when a fatal error happens.
*
* No more events are read, but stop must still be called.
*/
sigc::signal<void ()> error;
/**
* Get the current value/state for the given event
*
* For example, for a standard linux input event, the "value" entry
* will be filled with current value for the given type and code.
*/
virtual Event getEvent (Event) = 0;
/**
* Get the current value/state for the given event by type and code.
*/
virtual int32_t getSimpleEvent (uint16_t type, uint16_t code) = 0;
/**
* Get the current state of the key \p code.
*
* \param code A valid code for an event with type EV_KEY.
*
* \returns if the key is pressed.
*/
bool keyPressed (uint16_t code);
/**
* Get the current state of the absolute axis \p code.
*
* \param code A valid code for an event with type EV_ABS.
*
* \returns the current value of the axis.
*/
int32_t getAxisValue (uint16_t code);
/**
* Get the name of the driver used by this device.
*/
virtual std::string driver () const = 0;
/**
* Get the name of the device.
*/
virtual std::string name () const = 0;
/**
* Get the serial of the device.
*/
virtual std::string serial () const = 0;
/**
* Signals for input events.
*/
sigc::signal<void (Event)> event;
sigc::signal<void (uint16_t, uint16_t, int32_t)> simpleEvent;
static const JSClass js_class;
static const JSFunctionSpec js_fs[];
static const jstpl::SignalMap js_signals;
typedef jstpl::AbstractClass<InputDevice> JsClass;
/**
* Create a JS object from this device.
*
* \param cx JS context
* \param obj Global object where the class is created.
*/
virtual JSObject *makeJsObject (const jstpl::Thread *) = 0;
protected:
void eventRead (const Event &);
void simpleEventRead (uint16_t type, uint16_t code, int32_t value);
private:
static bool _registered;
};
#endif
|
/***************************************************************************
* *
* Copyright (C) 2017 Seamly, LLC *
* *
* https://github.com/fashionfreedom/seamly2d *
* *
***************************************************************************
**
** Seamly2D 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.
**
** Seamly2D 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 Seamly2D. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************
************************************************************************
**
** @file dialogcutspline.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 12, 2013
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Seamly2D project
** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
**
** Seamly2D 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.
**
** Seamly2D 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 Seamly2D. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGCUTSPLINE_H
#define DIALOGCUTSPLINE_H
#include <qcompilerdetection.h>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "dialogtool.h"
namespace Ui
{
class DialogCutSpline;
}
/**
* @brief The DialogCutSpline class dialog for ToolCutSpline.
*/
class DialogCutSpline : public DialogTool
{
Q_OBJECT
public:
DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogCutSpline() Q_DECL_OVERRIDE;
void SetPointName(const QString &value);
QString GetFormula() const;
void SetFormula(const QString &value);
quint32 getSplineId() const;
void setSplineId(const quint32 &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployFormulaTextEdit();
void FXLength();
protected:
virtual void ShowVisualization() Q_DECL_OVERRIDE;
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogCutSpline)
/** @brief ui keeps information about user interface */
Ui::DialogCutSpline *ui;
/** @brief formula string with formula */
QString formula;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
};
#endif // DIALOGCUTSPLINE_H
|
/**
* test/test.c
*
* (C) Copyright 2013 Michael Sippel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <unistd.h>
int main(void) {
char name[100];
char s_alter[3];
char y_n;
unsigned int alter;
printf("\nWie heisst du?\n\t");
gets(name);
printf("Angenehm!\nWie alt bist du?\n\t");
gets(s_alter);
alter = atoi(s_alter);
printf("Hattest du dieses Jahr schon Geburtstag? [j/n]\n\t");
y_n = getch();
if(y_n == 'j' || y_n == 'J') {
y_n = 0;
printf("ja\n");
} else {
y_n = 1;
printf("nein\n");
}
time_t t = time();
tm_t tm = gmtime(t);
printf("\nDu heisst %s und bist %u Jahre alt!\n", name, alter);
printf("Es ist das Jahr %d. Du bist also %d geboren!\n\n", tm.year, tm.year-alter-y_n);
char text[] = "Hallo! Das ist jetzt ein Text,\n"
"der mal so Buchstabe fuer Buchstabe angezeigt wird.\n"
"Jetzt kommt gleich die Zeit...\n";
int i;
for(i = 0; i < sizeof(text); i++) {
usleep(100000);
printf("%c", text[i]);
}
char s[] = "\t%d:%d:%d (UTC)";
char new_s[] = "\t%d:%d:%d (UTC)";
int length = sizeof(s)-1;
printf("\n%s", s);
int sec;
for(sec = 0; sec < 10; sec++) {
t = time();
tm = gmtime(t);
for(i=0; i < length; i++) printf("\r");
length = sprintf(new_s, s, tm.hour, tm.min, tm.sec);
puts(new_s);
sleep(1);
}
printf("\n");
return 0;
}
|
Arquivo texto
Um fluxo de texto é composto por uma seqüência de caracteres, que pode ou não ser dividida em linhas terminadas por um caracter de final de linha. Um detalhe que deve ser considerado é que na última linha não é obrigatório o caracter de fim de linha.
Nem sempre a tradução entre a representação do caracter no fluxo de texto e no sistema de arquivos do computador hospedeiro é um para um.
Arquivo binário
Um fluxo binário é composto por uma seqüência de bytes lidos, sem tradução, diretamente do dispositivo externo. Não ocorre nenhuma tradução e existe uma correspondência um para um entre os dados do dispositivo e os que estão no fluxo.
|
///////////////////////////////////////////////////////////////////////////////
// typedefs.h: Definition of basic 8, 16, 32, and 64-bit integer datatypes. //
// This file is part of project QUASIKOM ("Post-Quantum Secure Communication //
// for the Internet of Things"), supported by Netidee <https://netidee.at/>. //
// Project repository on github: <https://www.github.com/grojoh/quasikom/>. //
// Version 1.0.0 (2017-02-20), see project repository for latest version. //
// Author: Dipl.-Ing. Johann Groszschaedl (Secure Things Lab, Austria). //
// License: GPLv3 (see LICENSE file), other licenses available on request. //
// Copyright (C) 2017 Secure Things Lab <https://www.securethingslab.at/>. //
// ------------------------------------------------------------------------- //
// 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 _TYPEDEFS_H
#define _TYPEDEFS_H
// The header file inttypes.h is part of the ANSI C99 standard and contains
// definitions for fixed-width integer types such as int16_t, int32_t, or
// int64_t. However, if inttypes.h is not available (e.g. MS Visual C), we
// have to define these types ourselves. The following code does this.
#ifdef _MSC_VER
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <inttypes.h>
#endif /* _MSC_VER */
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
#endif /* _TYPEDEFS_H */
|
//
// DownloadFileSyncFolder.h
// Owncloud iOs Client
//
// Created by Javier Gonzalez on 07/10/15.
//
//
/*
Copyright (C) 2016, ownCloud GmbH.
This code is covered by the GNU Public License Version 3.
For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
You should have received a copy of this license
along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>.
*/
#import <Foundation/Foundation.h>
@class UserDto;
@interface DownloadFileSyncFolder : NSObject
@property (nonatomic, strong) FileDto *file;
@property (nonatomic, strong) NSString *currentFileEtag;
@property (nonatomic, strong) NSString *tmpUpdatePath;
@property (nonatomic, strong) NSURLSessionDownloadTask *downloadTask;
//user is needed when we cancel all the downloads in a change of user
@property (nonatomic, strong) UserDto *user;
- (void) addFileToDownload:(FileDto *) file;
- (void) cancelDownload;
- (void) failureDownloadProcess;
- (void) updateDataDownloadSuccess;
@end
|
/******************************************************************************
*
* Copyright 2021 Gideon van der Kolf
*
* This file is part of Konfyt.
*
* Konfyt 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.
*
* Konfyt 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 Konfyt. If not, see <http://www.gnu.org/licenses/>.
*
*****************************************************************************/
#ifndef KONFYT_MIDI_FILTER_H
#define KONFYT_MIDI_FILTER_H
#include "konfytDefines.h"
#include "konfytStructs.h"
#include "konfytMidi.h"
#include <QList>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#define XML_MIDIFILTER "midiFilter"
#define XML_MIDIFILTER_ZONE "zone"
#define XML_MIDIFILTER_ZONE_LOWNOTE "lowNote"
#define XML_MIDIFILTER_ZONE_HINOTE "highNote"
#define XML_MIDIFILTER_ZONE_ADD "add"
#define XML_MIDIFILTER_ZONE_LOWVEL "lowVel"
#define XML_MIDIFILTER_ZONE_HIVEL "highVel"
#define XML_MIDIFILTER_ZONE_VEL_LIMIT_MIN "velLimitMin"
#define XML_MIDIFILTER_ZONE_VEL_LIMIT_MAX "velLimitMax"
#define XML_MIDIFILTER_PASSALLCC "passAllCC"
#define XML_MIDIFILTER_PASSPB "passPitchbend"
#define XML_MIDIFILTER_PASSPROG "passProg"
#define XML_MIDIFILTER_IGNORE_GLOBAL_TRANSPOSE "ignoreGlobalTranspose"
#define XML_MIDIFILTER_CC "cc"
#define XML_MIDIFILTER_INCHAN "inChan"
#define XML_MIDIFILTER_OUTCHAN "outChan"
struct KonfytMidiFilterZone {
int lowNote = 0;
int highNote = 127;
int add = 0;
int lowVel = 0;
int highVel = 127;
int velLimitMin = 0;
int velLimitMax = 127;
};
class KonfytMidiFilter
{
public:
void setPassAll();
KonfytMidiFilterZone zone;
void setZone(int lowNote, int highNote, int add, int lowVel, int highVel,
int velLimitMin, int velLimitMax);
void setZone(KonfytMidiFilterZone newZone);
bool passFilter(const KonfytMidiEvent *ev);
KonfytMidiEvent modify(const KonfytMidiEvent* ev);
QList<int> passCC{64};
bool passAllCC = false;
bool passProg = false;
bool passPitchbend = true;
int inChan = -1; // -1 = any
int outChan = -1; // -1 = original
bool ignoreGlobalTranspose = false;
void writeToXMLStream(QXmlStreamWriter* stream);
void readFromXMLStream(QXmlStreamReader *r);
};
#endif // KONFYT_MIDI_FILTER_H
|
#ifndef ELEMENT_CLASS_H__
#define ELEMENT_CLASS_H__
#include "general.h"
#include "etypes.h"
#include "mem_util.h"
#include "exceptions.h"
#include <iostream>
#include <vector>
template <class Type> class SpatialFunctor;
template <class Type>
class Element
{
public:
Element<Type>();
template <class Type2>
Element<Type>(const Element<Type2>& elemToCopy);
virtual ~Element<Type>();
void Init(Int* nodes);
Int GetNodes(Int** nodes);
Int GetNodes(Int* nodes) const;
Int GetNnodes() const;
virtual void GetNormal(std::vector<Type>& normal, Type const * const xyz) const
{ Abort << "Element does not support normal calculation";};
virtual Int GetType() const;
void SetFactag(Int factag);
Int GetFactag() const;
bool IsActive() const;
bool operator==(const Element<Type>& e2) const;
bool operator!=(const Element<Type>& e2) const;
bool operator<(const Element<Type>& e2) const;
template <class Type2>
friend std::ostream& operator<<(std::ostream& os, const Element<Type2>& e);
//simple indicator of likeness without directly comparing nodes
Int GetNodeSum() const;
Int GetMinNode() const;
Int GetMaxNode() const;
virtual void GetGaussWeights(std::vector<Type>& gpoints, std::vector<Type>& gweights, Int degree) const
{ std::cerr << "WARNING: weights not defined for element" << std::endl;};
virtual void EvaluateShapeFunctions(Type* elemXYZ, Type xi, Type eta, Type& det, Type* sfunc) const
{ std::cerr << "WARNING: shape functions not defined for element" << std::endl;};
//pass a function pointer which takes x,y,z and returns a value
virtual Type IntegrateFunction(SpatialFunctor<Type>* f, Type* elemXYZ, Int degree) const
{ std::cerr << "WARNING: integrate function not defined for element" << std::endl; return 0.0;};
protected:
Int* nodes;
Int nnodes;
Bool active;
Bool typeset;
Int factag;
private:
};
template <class Type>
class Triangle : public Element<Type>
{
public:
Triangle();
template <class Type2>
Triangle(const Triangle<Type2>& elemToCopy);
void GetNormal(std::vector<Type>& normal, Type const * const xyz) const;
Int GetType() const;
void GetGaussWeights(std::vector<Type>& gpoints, std::vector<Type>& gweights, Int degree) const;
void EvaluateShapeFunctions(Type* elemXYZ, Type xi, Type eta, Type& det, Type* sfunc) const;
//elem xyz is a list of points for the element
Type IntegrateFunction(SpatialFunctor<Type>* f, Type* elemXYZ, Int degree) const;
protected:
private:
};
template <class Type>
class Quadrilateral : public Element<Type>
{
public:
Quadrilateral();
template <class Type2>
Quadrilateral(const Quadrilateral<Type2>& elemToCopy);
void GetNormal(std::vector<Type>& normal, Type const * const xyz) const;
Int GetType() const;
void GetGaussWeights(std::vector<Type>& gpoints, std::vector<Type>& gweights, Int degree) const;
void EvaluateShapeFunctions(Type* elemXYZ, Type xi, Type eta, Type& det, Type* sfunc) const;
//elem xyz is a list of points for the element
Type IntegrateFunction(SpatialFunctor<Type>* f, Type* elemXYZ, Int degree) const;
protected:
private:
};
template <class Type>
class Tetrahedron : public Element<Type>
{
public:
Tetrahedron();
template <class Type2>
Tetrahedron(const Tetrahedron<Type2>& elemToCopy);
Int GetType() const;
protected:
private:
};
template <class Type>
class Pyramid : public Element<Type>
{
public:
Pyramid();
template <class Type2>
Pyramid(const Pyramid<Type2>& elemToCopy);
Int GetType() const;
protected:
private:
};
template <class Type>
class Prism : public Element<Type>
{
public:
Prism();
template <class Type2>
Prism(const Prism<Type2>& elemToCopy);
Int GetType() const;
protected:
private:
};
template <class Type>
class Hexahedron : public Element<Type>
{
public:
Hexahedron();
template <class Type2>
Hexahedron(const Hexahedron<Type2>& elemToCopy);
Int GetType() const;
protected:
private:
};
//used for set based insertion so compares are deep not at ptr level
template <class Type>
struct ElementPtrComp
{
bool operator()(const Element<Type>* e1, const Element<Type>* e2) const
{
return ((*e1) < (*e2));
}
};
//include implementations
#include "elementClass.tcc"
#endif
|
// -*- C++ -*-
// $Id$
/**
* Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.9
* TAO and the TAO IDL Compiler have been developed by:
* Center for Distributed Object Computing
* Washington University
* St. Louis, MO
* USA
* http://www.cs.wustl.edu/~schmidt/doc-center.html
* and
* Distributed Object Computing Laboratory
* University of California at Irvine
* Irvine, CA
* USA
* and
* Institute for Software Integrated Systems
* Vanderbilt University
* Nashville, TN
* USA
* http://www.isis.vanderbilt.edu/
*
* Information about TAO is available at:
* http://www.cs.wustl.edu/~schmidt/TAO.html
**/
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_codegen.cpp:152
#ifndef _TAO_PIDL_TIMEBASEC_6FBMV8_H_
#define _TAO_PIDL_TIMEBASEC_6FBMV8_H_
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "tao/TAO_Export.h"
#include "tao/Basic_Types.h"
#include "tao/VarOut_T.h"
#include "tao/Arg_Traits_T.h"
#include "tao/Basic_Arguments.h"
#include "tao/Special_Basic_Arguments.h"
#include "tao/Any_Insert_Policy_T.h"
#include "tao/Fixed_Size_Argument_T.h"
#include "tao/Var_Size_Argument_T.h"
#include /**/ "tao/Version.h"
#include /**/ "tao/Versioned_Namespace.h"
#if TAO_MAJOR_VERSION != 2 || TAO_MINOR_VERSION != 1 || TAO_BETA_VERSION != 9
#error This file should be regenerated with TAO_IDL
#endif
#if defined (TAO_EXPORT_MACRO)
#undef TAO_EXPORT_MACRO
#endif
#define TAO_EXPORT_MACRO TAO_Export
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_module\module_ch.cpp:38
namespace TimeBase
{
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_typedef\typedef_ch.cpp:373
typedef ::CORBA::ULongLong TimeT;
typedef ::CORBA::ULongLong_out TimeT_out;
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_typedef\typedef_ch.cpp:373
typedef TimeT InaccuracyT;
typedef TimeT_out InaccuracyT_out;
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_typedef\typedef_ch.cpp:373
typedef ::CORBA::Short TdfT;
typedef ::CORBA::Short_out TdfT_out;
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_type.cpp:261
struct UtcT;
typedef
::TAO_Fixed_Var_T<
UtcT
>
UtcT_var;
typedef
UtcT &
UtcT_out;
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_structure\structure_ch.cpp:51
struct TAO_Export UtcT
{
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_type.cpp:307
typedef UtcT_var _var_type;
typedef UtcT_out _out_type;
static void _tao_any_destructor (void *);
TimeBase::TimeT time;
::CORBA::ULong inacclo;
::CORBA::UShort inacchi;
TimeBase::TdfT tdf;
};
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_type.cpp:261
struct IntervalT;
typedef
::TAO_Fixed_Var_T<
IntervalT
>
IntervalT_var;
typedef
IntervalT &
IntervalT_out;
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_structure\structure_ch.cpp:51
struct TAO_Export IntervalT
{
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_type.cpp:307
typedef IntervalT_var _var_type;
typedef IntervalT_out _out_type;
static void _tao_any_destructor (void *);
TimeBase::TimeT lower_bound;
TimeBase::TimeT upper_bound;
};
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_module\module_ch.cpp:67
} // module TimeBase
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_arg_traits.cpp:68
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// Arg traits specializations.
namespace TAO
{
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_arg_traits.cpp:947
template<>
class Arg_Traits< ::TimeBase::UtcT>
: public
Fixed_Size_Arg_Traits_T<
::TimeBase::UtcT,
TAO::Any_Insert_Policy_Stream
>
{
};
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_arg_traits.cpp:947
template<>
class Arg_Traits< ::TimeBase::IntervalT>
: public
Fixed_Size_Arg_Traits_T<
::TimeBase::IntervalT,
TAO::Any_Insert_Policy_Stream
>
{
};
}
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_traits.cpp:62
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// Traits specializations.
namespace TAO
{
}
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_structure\cdr_op_ch.cpp:46
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Export ::CORBA::Boolean operator<< (TAO_OutputCDR &, const TimeBase::UtcT &);
TAO_Export ::CORBA::Boolean operator>> (TAO_InputCDR &, TimeBase::UtcT &);
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_visitor_structure\cdr_op_ch.cpp:46
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Export ::CORBA::Boolean operator<< (TAO_OutputCDR &, const TimeBase::IntervalT &);
TAO_Export ::CORBA::Boolean operator>> (TAO_InputCDR &, TimeBase::IntervalT &);
TAO_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
// TAO_IDL - Generated from
// c:\gamez\ace_wrappers\tao\tao_idl\be\be_codegen.cpp:1703
TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* ifndef */
|
/*
* Copyright (C) 2006-2010 by RoboLab - University of Extremadura
*
* This file is part of RoboComp
*
* RoboComp 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.
*
* RoboComp 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 RoboComp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WORKER_H
#define WORKER_H
// #include <ipp.h>
#include <QtCore>
#include <stdint.h>
#include <DifferentialRobot.h>
#include <CommonBehavior.h>
#include "handler.h"
#include "gazebohandler.h"
#include "playerhandler.h"
#include <qlog/qlog.h>
/**
\brief
@author authorname
*/
class Worker : public QThread
{
Q_OBJECT
public:
Worker();
~Worker();
QMutex *mutex; //Shared mutex with servant
void run();
//DifferentialRobot
bool setSpeedBase(float adv ,float rot );
bool stopBase();
RoboCompDifferentialRobot::TBaseState getBaseState();
RoboCompDifferentialRobot::TMechParams getMechParams();
bool resetOdometer();
bool setOdometer(RoboCompDifferentialRobot::TBaseState bState);
void correctOdometer(float x, float z, float alpha);
//CommonBehavior
void setPeriod(int period);
int getPeriod();
void setParams(RoboCompCommonBehavior::ParameterList _params);
private:
Handler *handler;
QTimer timer;
int period;
public:
bool active;
RoboCompDifferentialRobot::TMechParams params;
signals:
void kill();
};
#endif
|
#pragma once
#include<String>
#include<vector>
#ifdef CONWAYSEQUENCE_EXPORTS
#define CONWAYSEQUENCE_API __declspec(dllexport)
#else
#define CONWAYSEQUENCE_API __declspec(dllimport)
#endif
class ConwaySequence
{
public:
CONWAYSEQUENCE_API ConwaySequence(std::string fileName);
CONWAYSEQUENCE_API void Execute();
private:
struct Test
{
int R;
int L;
};
std::vector<Test*> tests;
std::string ToString(std::vector<int> input);
bool is_number(const std::string& string);
bool inputError = false;
}; |
#include "../circuit_desc.h"
#include "../circuit.h"
/*
* 7405-based paddle timer circuit
*
* 7405 + Capacitor + BJT current source + paddle potentiometer
*
* When input is high, capacitor will discharge rapidly through 7405.
* When input is low, capacitor will charge through BJT constant current source.
* Rate of charging is determined by paddle potentiometer.
*
* Pin 1: Trigger input
* Pin 2: Capacitor output
*/
typedef Mono555Desc CleanSweepPaddleDesc;
static CUSTOM_LOGIC( paddle_control )
{
CleanSweepPaddleDesc* desc = (CleanSweepPaddleDesc*)chip->custom_data;
// Update tp_hl in standard portion based on rc value
if(chip->output_links.size())
{
// Current through 270 ohm resistor (Approximate)
double i = 5.0 / desc->r;
// Time to charge capacitor to 2V. dt = C * 2 / i
double dt = desc->c * 2.0 / i;
chip->output_links[0].chip->delay[0] = uint64_t(dt / Circuit::timescale);
// Generate event to standard portion of chip
chip->pending_event = chip->circuit->queue_push(chip, 0);
}
}
static CHIP_LOGIC( PADDLE_Q )
{
pin[2] = pin[1] ^ 1;
}
static CHIP_DESC( CLEAN_SWEEP_PADDLE ) =
{
CUSTOM_CHIP_START(&paddle_control)
INPUT_PINS( i3 )
OUTPUT_PIN( i1 ),
CHIP_START( PADDLE_Q )
INPUT_PINS( i1, 1 )
OUTPUT_PIN( 2 )
OUTPUT_DELAY_NS( 50.0, 50.0 ), // tp_lh will be overwritten
CHIP_DESC_END
};
|
/*
* Copyright (C) 2012 Red Hat. All rights reserved.
*
* This file is released under the GPL.
*/
#include "dm-cache-policy-internal.h"
#include "dm.h"
#include <linux/module.h>
#include <linux/slab.h>
/*----------------------------------------------------------------*/
#define DM_MSG_PREFIX "cache-policy"
static DEFINE_SPINLOCK(register_lock);
static LIST_HEAD(register_list);
static struct dm_cache_policy_type *__find_policy(const char *name)
{
struct dm_cache_policy_type *t;
list_for_each_entry(t, ®ister_list, list)
if (!strcmp(t->name, name))
{
return t;
}
return NULL;
}
static struct dm_cache_policy_type *__get_policy_once(const char *name)
{
struct dm_cache_policy_type *t = __find_policy(name);
if (t && !try_module_get(t->owner))
{
DMWARN("couldn't get module %s", name);
t = ERR_PTR(-EINVAL);
}
return t;
}
static struct dm_cache_policy_type *get_policy_once(const char *name)
{
struct dm_cache_policy_type *t;
spin_lock(®ister_lock);
t = __get_policy_once(name);
spin_unlock(®ister_lock);
return t;
}
static struct dm_cache_policy_type *get_policy(const char *name)
{
struct dm_cache_policy_type *t;
t = get_policy_once(name);
if (IS_ERR(t))
{
return NULL;
}
if (t)
{
return t;
}
request_module("dm-cache-%s", name);
t = get_policy_once(name);
if (IS_ERR(t))
{
return NULL;
}
return t;
}
static void put_policy(struct dm_cache_policy_type *t)
{
module_put(t->owner);
}
int dm_cache_policy_register(struct dm_cache_policy_type *type)
{
int r;
/* One size fits all for now */
if (type->hint_size != 0 && type->hint_size != 4)
{
DMWARN("hint size must be 0 or 4 but %llu supplied.", (unsigned long long) type->hint_size);
return -EINVAL;
}
spin_lock(®ister_lock);
if (__find_policy(type->name))
{
DMWARN("attempt to register policy under duplicate name %s", type->name);
r = -EINVAL;
}
else
{
list_add(&type->list, ®ister_list);
r = 0;
}
spin_unlock(®ister_lock);
return r;
}
EXPORT_SYMBOL_GPL(dm_cache_policy_register);
void dm_cache_policy_unregister(struct dm_cache_policy_type *type)
{
spin_lock(®ister_lock);
list_del_init(&type->list);
spin_unlock(®ister_lock);
}
EXPORT_SYMBOL_GPL(dm_cache_policy_unregister);
struct dm_cache_policy *dm_cache_policy_create(const char *name,
dm_cblock_t cache_size,
sector_t origin_size,
sector_t cache_block_size)
{
struct dm_cache_policy *p = NULL;
struct dm_cache_policy_type *type;
type = get_policy(name);
if (!type)
{
DMWARN("unknown policy type");
return ERR_PTR(-EINVAL);
}
p = type->create(cache_size, origin_size, cache_block_size);
if (!p)
{
put_policy(type);
return ERR_PTR(-ENOMEM);
}
p->private = type;
return p;
}
EXPORT_SYMBOL_GPL(dm_cache_policy_create);
void dm_cache_policy_destroy(struct dm_cache_policy *p)
{
struct dm_cache_policy_type *t = p->private;
p->destroy(p);
put_policy(t);
}
EXPORT_SYMBOL_GPL(dm_cache_policy_destroy);
const char *dm_cache_policy_get_name(struct dm_cache_policy *p)
{
struct dm_cache_policy_type *t = p->private;
/* if t->real is set then an alias was used (e.g. "default") */
if (t->real)
{
return t->real->name;
}
return t->name;
}
EXPORT_SYMBOL_GPL(dm_cache_policy_get_name);
const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p)
{
struct dm_cache_policy_type *t = p->private;
return t->version;
}
EXPORT_SYMBOL_GPL(dm_cache_policy_get_version);
size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p)
{
struct dm_cache_policy_type *t = p->private;
return t->hint_size;
}
EXPORT_SYMBOL_GPL(dm_cache_policy_get_hint_size);
/*----------------------------------------------------------------*/
|
#pragma once
#ifndef LINKED_LIST_H
#define LINKED_LIST_H
template <class T>
class LinkedList
{
public:
LinkedList()
{
this->first = nullptr;
this->last = nullptr;
this->length = 0;
}
~LinkedList()
{
}
//Adds the element to the kth position
void add(T val, int pos)
{
node *newNode = new node;
newNode->val = val;
if (this->length == 0)
{
if (pos == 0)
{
this->first = new node;
this->first->val = val;
this->last = this->first;
}
}
else if (pos == this->length)
{
newNode->prev = this->last;
this->last->next = newNode;
this->last = newNode;
}
else if (pos == 0)
{
newNode->next = this->first;
this->first->prev = newNode;
this->first = newNode;
}
else
{
node* iterNode = this->first;
int k = 0;
while (iterNode && k < pos)
{
iterNode = iterNode->next;
k++;
}
if (iterNode->prev)
{
iterNode->prev->next = newNode;
}
newNode->prev = iterNode->prev;
iterNode->prev = newNode;
newNode->next = iterNode;
}
this->length++;
newNode = nullptr;
}
void push_back(T val)
{
this->add(val, this->size());
}
//Removes the kth element from the list
T remove(int k)
{
T returnValue;
if (k == 0)
{
returnValue = this->first->val;
node *nextLink = this->first->next;
delete this->first;
if (this->length == 1)
{
this->first = nullptr;
this->last = nullptr;
this->iter = nullptr;
}
else
{
nextLink->prev = nullptr;
this->first = nextLink;
}
nextLink = nullptr;
}
else if (k == this->length - 1)
{
returnValue = this->last->val;
node *prevLink = this->last->prev;
delete this->last;
if (this->length == 1)
{
this->first = nullptr;
this->last = nullptr;
this->iter = nullptr;
}
else
{
prevLink->next = nullptr;
this->last = prevLink;
}
prevLink = nullptr;
}
else
{
node* iterator = this->first;
int currentPosition = 0;
while (iterator && currentPosition < k)
{
iterator = iterator->next;
currentPosition++;
}
returnValue = iterator->val;
iterator->prev->next = iterator->next;
delete iterator;
iterator = nullptr;
}
this->length--;
return returnValue;
}
//Returns the nth element of the list
T get(int n)
{
int k = 0;
node *it = this->first;
while (it && k < n)
{
it = it->next;
k++;
}
return it->val;
}
void clear()
{
while (!empty())
{
this->remove(0);
}
}
int size()
{
return this->length;
}
bool empty()
{
return (this->length == 0);
}
void iterator()
{
this->iter = this->first;
}
bool isNull()
{
return (this->iter == nullptr);
}
void next()
{
if (this->iter)
{
this->iter = this->iter->next;
}
}
void prev()
{
if (this->iter)
{
this->iter = this->iter->prev;
}
}
T curr()
{
return this->iter->val;
}
void destroy()
{
while (!this->empty())
{
this->remove(0);
}
this->first = nullptr;
this->last = nullptr;
this->iter = nullptr;
}
protected:
struct node {
T val;
node *next = nullptr;
node *prev = nullptr;
};
node *first;
node *last;
node *iter;
int length;
};
#endif /* LINKED_LIST_H */ |
/*
* CodeQuery
* Copyright (C) 2013 ruben2020 https://github.com/ruben2020/
*
* 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/>.
*
*/
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "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 Nokia Corporation and its Subsidiary(-ies) 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."
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CUSTOMWIDGETPLUGIN_H
#define CUSTOMWIDGETPLUGIN_H
#include <QDesignerCustomWidgetInterface>
class CodeEditorWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
CodeEditorWidgetPlugin(QObject *parent = 0);
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
#endif
|
/*
$port: osd_setup.h,v 1.1 2010/08/28 22:47:09 tuxbox-cvs Exp $
osd_setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
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 __osd_setup__
#define __osd_setup__
#include <gui/components/cc.h>
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <system/setting_helpers.h>
#include <system/settings.h>
#include <string>
class COsdSetup : public CMenuTarget, public CChangeObserver
{
private:
CFrameBuffer *frameBuffer;
CColorSetupNotifier *colorSetupNotifier;
CFontSizeNotifier *fontsizenotifier;
CMenuWidget *osd_menu;
CMenuWidget *submenu_menus;
CMenuForwarder *mfFontFile, *mfTtxFontFile, *mfSubFontFile, *mfWindowSize;
char window_size_value[10];
std::string osdFontFile, osdTtxFontFile, osdSubFontFile;
CComponentsShapeSquare *win_demo;
COnOffNotifier* colorInfoclockNotifier;
int width;
bool is_wizard;
int show_menu_hints;
int show_tuner_icon;
int screenshot_res;
CMenuOptionChooser *screenshot_res_chooser;
int showOsdSetup();
void showOsdMenueColorSetup(CMenuWidget *menu_colors);
void showOsdFontSizeSetup(CMenuWidget *menu_fonts);
void showOsdTimeoutSetup(CMenuWidget *menu_timeout);
void showOsdMenusSetup(CMenuWidget *menu_menus);
void showOsdInfobarSetup(CMenuWidget *menu_infobar);
void showOsdChanlistSetup(CMenuWidget *menu_chanlist);
void showOsdEventlistSetup(CMenuWidget *menu_eventlist);
void showOsdVolumeSetup(CMenuWidget *menu_volume);
void showOsdInfoclockSetup(CMenuWidget *menu_infoclock);
void showOsdScreenShotSetup(CMenuWidget *menu_screenshot);
void paintWindowSize(int w, int h);
void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry);
public:
enum INFOBAR_CHANNEL_LOGO_POS_OPTIONS
{
INFOBAR_NO_LOGO,
INFOBAR_LOGO_AS_CHANNELLUM,
INFOBAR_LOGO_AS_CHANNELNAME,
INFOBAR_LOGO_BESIDE_CHANNELNAME
};
enum INFOBAR_CHANNEL_LOGO_BACKROUND_OPTIONS
{
INFOBAR_NO_BACKGROUND,
INFOBAR_LOGO_FRAMED,
INFOBAR_LOGO_SHADED
};
enum OSD_SETUP_MODE
{
OSD_SETUP_MODE_WIZARD_NO = 0,
OSD_SETUP_MODE_WIZARD = 1
};
COsdSetup(bool wizard_mode = OSD_SETUP_MODE_WIZARD_NO);
~COsdSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
bool changeNotify(const neutrino_locale_t OptionName, void * /*data*/);
int showContextChanlistMenu(CMenuWidget *menu_chanlist);
};
#endif
|
#ifndef _SINGLETON_H_
#define _SINGLETON_H_
/*! \class Singleton
* \brief Implements a simple Singleton Pattern
*/
template<typename T>
class Singleton
{
public:
/*! \return Reference to singleton object */
static T& ref() {
static T instance;
return instance;
}
static T *ptr() {
return &ref();
}
protected:
Singleton() {}
Singleton(const Singleton&) {}
~Singleton() {}
};
#endif
|
/* File: BitMapReader.cpp
* Author: David Warne (david.warne@qut.edu.au)
* Date Created: 18/04/2010
*
* Summary: Implementations of BitMap Reader Functions.
*
* NOTE: at this point on uncompressed BITMAPS Supported
*/
#include "BitMapReader.h"
ERROR BMP_ReadHeaders(BMPFILE* bmp_fp)
{
bmp_fp->bmpFileHeader = (BMPFILEHEADER*)malloc(sizeof(BMPFILEHEADER));
bmp_fp->bmpInfoHeader = (BMPINFOHEADER*)malloc(sizeof(BMPINFOHEADER));
if(!(fread((void*)(bmp_fp->bmpFileHeader->type),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpFileHeader->fileSize),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpFileHeader->reserved1),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpFileHeader->reserved2),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpFileHeader->offset),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
fseek(bmp_fp->bmpfile_fp,0x000E,SEEK_SET);
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->size),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->width),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->height),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->planes),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->colorDepth),2,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->compression),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->imageSize),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->hRes),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->wRes),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->paletteSize),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
if(!(fread((void*)&(bmp_fp->bmpInfoHeader->numImportantColours),4,1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
return NO_ERRORS;
}
ERROR BMP_ReadColourPalette(BMPFILE* bmp_fp)
{
return NO_ERRORS;
}
ERROR BMP_ReadImageData(BMPFILE* bmp_fp)
{
bmp_fp->imageData = (uint8_t*)malloc(sizeof(uint8_t)*(bmp_fp->bmpInfoHeader->imageSize));
fseek(bmp_fp->bmpfile_fp,bmp_fp->bmpFileHeader->offset,SEEK_SET);
if (!(fread((void*)(bmp_fp->imageData),sizeof(uint8_t)*(bmp_fp->bmpInfoHeader->imageSize),1,bmp_fp->bmpfile_fp)==1))
{
return FILE_READ_ERROR;
}
return NO_ERRORS;
}
BMPImage ReadBMP(char* fileName)
{
BMPImage bmpImage;
unsigned long int i,j,row,col;
unsigned long int width, height,size;
unsigned char r,g,b;
BMPFILE* bmpfile = CreateBMPFILE(fileName);
BMP_OpenBitMap(bmpfile,"rb");
BMP_ReadHeaders(bmpfile);
BMP_ReadImageData(bmpfile);
bmpImage.RGB = (unsigned char**)malloc((bmpfile->bmpInfoHeader->height)*sizeof(unsigned char*));
for (i=0;i<bmpfile->bmpInfoHeader->height;i++)
{
bmpImage.RGB[i] = (unsigned char*)malloc((bmpfile->bmpInfoHeader->width)*sizeof(unsigned char)*3);
}
width = (unsigned long int)(bmpfile->bmpInfoHeader->width);
height = (unsigned long int)(bmpfile->bmpInfoHeader->height);
size = (unsigned long int)(bmpfile->bmpInfoHeader->imageSize);
bmpImage.width = width;
bmpImage.height = height;
/*copy data*/
for (row=0;row<height;row++)
{
i = row*width*3;
for (col=0;col<width*3;col+=3)
{
j = col;
b = (unsigned char)(bmpfile->imageData[i+j]);
g = (unsigned char)(bmpfile->imageData[i+j+1]);
r = (unsigned char)(bmpfile->imageData[i+j+2]);
bmpImage.RGB[row][col] = r;
bmpImage.RGB[row][col+1] = g;
bmpImage.RGB[row][col+2] = b;
}
}
BMP_CloseBitMap(bmpfile);
DestroyBMPFILE(bmpfile);
return bmpImage;
};
|
#ifndef RUNPYTHON_H
#define RUNPYTHON_H
namespace Ilwis{
namespace PythonScript{
class RunPython : public OperationImplementation
{
public:
RunPython();
RunPython(quint64 metaid, const Ilwis::OperationExpression &expr);
~RunPython();
bool execute(ExecutionContext *ctx, SymbolTable& symTable);
static OperationImplementation * create(quint64 metaid,const Ilwis::OperationExpression& expr);
static quint64 createMetadata();
OperationImplementation::State prepare(ExecutionContext *, const SymbolTable &);
protected:
QString _statements;
};
}
}
#endif // RUNPYTHON_H
|
/**
******************************************************************************
* @file BSP/Inc/audio_play.h
* @author MCD Application Team
* @version V1.0.4
* @date 17-February-2017
* @brief Header for audio_play.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __AUDIO_PLAY_H
#define __AUDIO_PLAY_H
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void AudioPlay_Test(void);
#endif /* __AUDIO_PLAY_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 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.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#pragma once
#include "common.h"
#ifdef __cplusplus
#include <string>
#include "scenario/ScenarioRepository.h"
interface IStream;
/**
* Interface to import scenarios and saved games.
*/
interface IParkImporter
{
public:
virtual ~IParkImporter() = default;
virtual void Load(const utf8 * path) abstract;
virtual void LoadSavedGame(const utf8 * path) abstract;
virtual void LoadScenario(const utf8 * path) abstract;
virtual void LoadFromStream(IStream * stream, bool isScenario) abstract;
virtual void Import() abstract;
virtual bool GetDetails(scenario_index_entry * dst) abstract;
};
namespace ParkImporter
{
IParkImporter * Create(const std::string &hintPath);
IParkImporter * CreateS4();
IParkImporter * CreateS6();
bool ExtensionIsRCT1(const std::string &extension);
bool ExtensionIsScenario(const std::string &extension);
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void park_importer_load_from_stream(void * stream, const utf8 * hintPath);
bool park_importer_extension_is_scenario(const utf8 * extension);
#ifdef __cplusplus
}
#endif
|
/*
Copyright 2013 Paweł Czaplejewicz
This file is part of Jazda.
Jazda 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.
Jazda 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 Jazda. If not, see <http://www.gnu.org/licenses/>.
*/
/* Backlight state management
Requires:
BACKLIGHT{DIR|PORT|PIN} defines
*/
#include "../common.h"
#include "backlight.h"
volatile uint8_t backlight_state;
void backlight_init(void) {
HIGH(BACKLIGHTDIR, BACKLIGHTPIN);
backlight_off();
}
void backlight_switch(void) {
if (backlight_state == 0) {
backlight_on();
} else {
backlight_off();
}
}
// TODO: see if can read output state
void backlight_off(void) {
LOW(BACKLIGHTPORT, BACKLIGHTPIN);
backlight_state = 0;
}
void backlight_on(void) {
HIGH(BACKLIGHTPORT, BACKLIGHTPIN);
backlight_state = 1;
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/********************************************************************************************
********************************************************************************************
**
** Nome: Igor Luciano de Paula | Turma: LABCOMP1 SELE.1 - G1
** Prof.: Geraldo Pereira de Souza | 1/2016 | CEFET-MG
**
** Mod08_string - Roteiro: Exercício N. 1:
** Faça um programa em C que solicite o nome do usuário. O programa deve então imprimir:
** a) O nome do usuário; b) O nome do usuário invertido; c) O número de caracteres contidos
** no nome do usuário; d) O número de vogais do nome do usuário; e) O número de consoantes
** do nome do usuário;
**
*******************************************************************************************
*******************************************************************************************/
int main (){
char nome [61], vogais [11] = "aeiouAEIOU";
int i, j, count, count2, consoantes;
count = count2 = 0;
printf("\nDigite o seu nome: ");
gets(nome);
printf("\n\nSeu nome é: %s\n", nome);
printf("\nSeu nome invertido é: ");
for ( i = (strlen (nome) - 1); i >= 0; i-- )
printf("%c", nome[i]);
printf("\n\nO número de caracteres contidos no seu nome é: %d\n", strlen(nome));
for ( i = 0; i < strlen(nome); i++ ){
if ( nome [i] != ' ' )
count2 ++; //Contador de caracteres diferentes de espaços
for ( j = 0; j < strlen(vogais); j++ ){
if ( nome[i] == vogais[j] )
count ++; //Contador de vogais
}
}
consoantes = (count2 - count);
printf("\nO número de vogais no seu nome é: %d\n", count );
printf("\nO número de consoantes no seu nome é: %d\n\n", consoantes );
system ("pause");
return (0);
}
|
/*
This file is part of Darling.
Copyright (C) 2021 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface AKAppleIDAuthenticationMacOSExtenstionContext : NSObject
@end
|
// BOINC Sentinels.
// https://projects.romwnet.org/boincsentinels
// Copyright (C) 2009-2014 Rom Walton
//
// BOINC Sentinels is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC Sentinels is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC Sentinels. If not, see <http://www.gnu.org/licenses/>.
//
///
/// \defgroup BSLCommon BOINC Sentinels Common Library Interface
/// \{
#ifndef _BSLERRORS_H_
#define _BSLERRORS_H_
/// \brief Return codes for various BOINC Sentinels Library functions.
enum BSLERRCODE
{
/// \brief the requested operation completed successfully.
BSLERR_SUCCESS = 0,
/// \brief the requested operation failed.
BSLERR_FAILURE = 1,
/// \brief the requested operation has been denied.
BSLERR_ACCESS_DENIED = 2,
/// \brief one of the provided parameters is invalid.
BSLERR_INVALID_PARAMETER = 3,
/// \brief the specified object could not be found.
BSLERR_OBJECT_NOT_FOUND = 4,
/// \brief the specified object has already been created.
BSLERR_OBJECT_ALREADY_CREATED = 5,
/// \brief the operation is in progress.
BSLERR_OPERATION_IN_PROGRESS = 6,
/// \brief the specified application could not be found.
BSLERR_APP_NOT_FOUND = 7,
/// \brief the specified application version could not be found.
BSLERR_APPVERSION_NOT_FOUND = 8,
/// \brief the specified host could not be found.
BSLERR_HOST_NOT_FOUND = 9,
/// \brief the specified host status could not be found.
BSLERR_HOSTSTATUS_NOT_FOUND = 10,
/// \brief the specified message could not be found.
BSLERR_MESSAGE_NOT_FOUND = 11,
/// \brief the specified notification could not be found.
BSLERR_NOTIFICATION_NOT_FOUND = 12,
/// \brief the specified project could not be found.
BSLERR_PROJECT_NOT_FOUND = 13,
/// \brief the specified project list item could not be found.
BSLERR_PROJECTLISTITEM_NOT_FOUND = 14,
/// \brief the specified project statistic could not be found.
BSLERR_PROJECTSTATISTIC_NOT_FOUND = 15,
/// \brief the specified task could not be found.
BSLERR_TASK_NOT_FOUND = 16,
/// \brief the specified task instance could not be found.
BSLERR_TASKINSTANCE_NOT_FOUND = 17,
/// \brief the specified transfer could not be found.
BSLERR_TRANSFER_NOT_FOUND = 18,
/// \brief the attempt to connect with the BOINC core client failed.
BSLERR_CONNECT_ERROR = 19,
/// \brief the specified host is not connected to a BOINC core client.
BSLERR_CONNECT_NOT_CONNECTED = 20,
/// \brief the specified host could not be found, connection to the BOINC core client failed.
BSLERR_CONNECT_HOST_NOT_FOUND = 21,
/// \brief the specified port could not be found, connection to the BOINC core client failed.
BSLERR_CONNECT_PORT_NOT_FOUND = 22,
/// \brief the connection to the BOINC core client timed out.
BSLERR_CONNECT_TIME_OUT = 23,
/// \brief could not read/write to the requested socket.
BSLERR_CONNECT_IO_ERROR = 24,
/// \brief the specified password failed to authenticate with the BOINC core client.
BSLERR_CONNECT_AUTHENTICATION_ERROR = 25,
/// \brief the required RPC Protocol version is not supported by the BOINC core client.
BSLERR_CONNECT_VERSIONINCOMPATIBILITY_ERROR = 26,
/// \brief the URL is missing
BSLERR_MISSING_URL = 27,
/// \brief the authenticator is missing
BSLERR_MISSING_AUTHENTICATOR = 28,
/// \brief the specified identity is invalid or banned.
BSLERR_MALFORMED_IDENTITY = 29,
/// \brief the specified identity and password combination is invalid.
BSLERR_BAD_IDENTITY_OR_PASSWORD = 30,
/// \brief the specified project is already attached
BSLERR_ALREADY_ATTACHED = 31,
/// \brief account creation has been disabled for the project.
BSLERR_ACCOUNT_CREATION_DISABLED = 32,
/// \brief an invite code is required to create an account for this project.
BSLERR_INVITE_CODE_REQUIRED = 33
};
#endif
///
/// \}
|
/*
* ICoolerOffMessageHandler.h
*
* Created on: 15 Feb. 2018
* Author: tom
*/
#ifndef SRC_INTERFACES_MONITORS_UNITS_ICOOLEROFFMESSAGEHANDLER_H_
#define SRC_INTERFACES_MONITORS_UNITS_ICOOLEROFFMESSAGEHANDLER_H_
#include <memory>
#include "IOnOffMessageHandler.h"
using namespace std;
namespace Sauerteig {
namespace Interfaces {
namespace Monitors {
namespace Units {
class ICoolerOffMessageHandler : public IOnOffMessageHandler {
public:
virtual ~ICoolerOffMessageHandler() = default;
};
}
}
}
}
typedef shared_ptr<Sauerteig::Interfaces::Monitors::Units::ICoolerOffMessageHandler> ICoolerOffMessageHandler_SPtr;
#endif /* SRC_INTERFACES_MONITORS_UNITS_ICOOLEROFFMESSAGEHANDLER_H_ */
|
/*==========================================================================
SeqAn - The Library for Sequence Analysis
http://www.seqan.de
============================================================================
Copyright (C) 2007
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
============================================================================
$Id: basic_pointer.h 954 2007-07-27 11:48:23Z doering@PCPOOL.MI.FU-BERLIN.DE $
==========================================================================*/
#ifndef SEQAN_HEADER_BASIC_POINTER_H
#define SEQAN_HEADER_BASIC_POINTER_H
namespace SEQAN_NAMESPACE_MAIN
{
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///.Metafunction.Value.param.T.type:Adaption.char array
template <typename TValue>
struct Value< TValue * >
{
typedef TValue Type;
};
template <typename TValue>
struct Value< TValue * const>
{
typedef TValue Type;
};
//The next two metafunctions dont work in VC++ due to a compiler bug.
//(the default implementation in common_type.h is called instead)
//work-around: convert arrays to pointers.
template <typename TValue, size_t SIZE>
struct Value< TValue [SIZE] >
{
typedef TValue Type;
};
template <typename TValue, size_t SIZE>
struct Value< TValue const [SIZE] >
{
typedef TValue const Type;
};
//////////////////////////////////////////////////////////////////////////////
///.Metafunction.Iterator.param.T.type:Adaption.char array
template <typename TValue>
struct Iterator< TValue *, Standard>
{
typedef TValue * Type;
};
template <typename TValue>
struct Iterator< TValue * const, Standard>
{
typedef TValue * Type;
};
//____________________________________________________________________________
template <typename TValue, size_t SIZE>
struct Iterator< TValue [SIZE], Standard>:
Iterator<TValue *, Standard>
{
};
template <typename TValue, size_t SIZE>
struct Iterator< TValue const [SIZE], Standard>:
Iterator<TValue const *, Standard>
{
};
template <typename TValue, size_t SIZE>
struct Iterator< TValue [SIZE], Rooted>:
Iterator<TValue *, Rooted>
{
};
template <typename TValue, size_t SIZE>
struct Iterator< TValue const [SIZE], Rooted>:
Iterator<TValue const *, Rooted>
{
};
//////////////////////////////////////////////////////////////////////////////
}// namespace SEQAN_NAMESPACE_MAIN
#endif //#ifndef SEQAN_HEADER_...
|
#pragma once
enum RigFemResultPosEnum {
NODAL,
ELEMENT_NODAL,
INTEGRATION_POINT
};
|
#pragma once
typedef unsigned char u8;
typedef unsigned u32;
typedef u32 Color;
// allocates memory for framebuffer and initializes it
void psvDebugScreenInit();
// clears screen with a given color
void psvDebugScreenClear(int bg_color);
// printf to the screen
void psvDebugScreenPrintf(const char *format, ...);
// set foreground (text) color
Color psvDebugScreenSetFgColor(Color color);
// set background color
Color psvDebugScreenSetBgColor(Color color);
void *psvDebugScreenGetVram();
int psvDebugScreenGetX();
int psvDebugScreenGetY();
enum {
COLOR_CYAN = 0xFFFFFF00,
COLOR_WHITE = 0xFFFFFFFF,
COLOR_BLACK = 0xFF000000,
COLOR_RED = 0xFF0000FF,
COLOR_YELLOW = 0xFF00FFFF,
COLOR_GREY = 0xFF808080,
COLOR_GREEN = 0xFF00FF00,
};
#define printf psvDebugScreenPrintf
|
/******************************************************************************
** File Name: nvme_iosq.h
** Author:
** Creation Time: Thu Jan 11 07:50:47 2018
*/
#ifndef _NVME_IOSQ_H
#define _NVME_IOSQ_H
#include "nvme_queue.h"
#define NVME_SQ_IS_EMPTY(sq) NVME_QUEUE_IS_EMPTY(&(sq)->q)
#define NVME_SQ_IS_FULL(sq) NVME_QUEUE_IS_FULL(&(sq)->q)
#define NVME_SQID_ADMIN 0
typedef struct {
NVME_QUEUE q;
UINT16 cqid;
UINT16 valid : 1;
UINT16 prio : 2;
UINT16 rsvd : 13;
} NVME_SQ;
#endif /* _NVME_IOSQ_H */
|
#pragma once
#include "CPlayerUIBase.h"
class CPlayerUI3 : public CPlayerUIBase
{
public:
CPlayerUI3(UIData& ui_data, CWnd* pMainWnd);
~CPlayerUI3();
private:
virtual void _DrawInfo(CRect draw_rect, bool reset = false) override; //绘制信息
virtual int GetClassId() override;
};
|
/* Copyright (c) 2001-2017, Institut für Bauklimatik, TU Dresden, Germany
Written by Andreas Nicolai
All rights reserved.
This file is part of the OpenHAM software.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MaterialH
#define MaterialH
#include <IBK_LinearSpline.h>
#include <IBK_Parameter.h>
#include <IBK_Path.h>
/*! Implements material functions.
For each material layer, an instance of this class is initialized.
For built-in materials, the material object is initialized by a call to init().
For material data to be read from file, the material object is initialized
with readFromFile().
*/
class Material {
public:
/*! Default constructor initializes an invalid material, id = -1. */
Material();
/*! Initializes material data for built-in materials. */
void init(int index);
/*! Initializes material data from material files. */
void readFromFile(const IBK::Path & m6FilePath);
/*! MRC: Returns moisture content [m3/m3] for capillary pressure [Pa]. */
double Ol_pc(double pc) const;
/*! Returns thermal conductivity [J/msK] for moisture content [m3/m3]. */
double lambda_Ol(double Ol) const;
/*! Returns liquid conductivity [log10(s)] for moisture content [m3/m3]. */
double Kl_Ol(double Ol) const;
/*! Returns vapor permeability [s] for moisture content [m3/m3]. */
double Kv_Ol(double T, double Ol) const;
/*! Returns true, if material does not have an MRC function and thus does not compute moisture balances.
Only useful when running thermal-only calculations.
*/
bool moistureTight() const;
/*! Creates some plots for the material functions in this material, useful for generating reports. */
void createPlots(const IBK::Path & plotDir, const std::string & matref) const;
int m_i; ///< Material index number
IBK::Path m_filepath; ///< The file path that the material was read from (set in readFromFile()).
std::string m_name; ///< Some descriptive name.
std::string m_flags; ///< Parametrization flags;
bool m_isAir; ///< Set to true for air materials (different sorption isotherm)
double m_rho; ///< Bulk density [kg/m3]
double m_cT; ///< Heat capacity [J/kgK]
double m_lambda; ///< Thermal conductivity [J/msK]
IBK::Parameter m_mew; ///< Mu-dry-value [---], if given.
double m_Oeff; ///< Effective saturation moisture content in [m3/m3]; w_sat = Oeff*1000 kg/m3
/*! Moisture storage function: \f$\theta_\ell\left(p_C\right)\f$ */
IBK::LinearSpline m_Ol_pC_Spline;
/*! Liquid transport function: \f$lgK_\ell\left(\theta_\ell\right)\f$
\note Stores log10-values of liquid conductivity, and interpolates in logspace.
*/
IBK::LinearSpline m_lgKl_Ol_Spline;
/*! Vapour permeability function: \f$lgK_v\left(\theta_\ell\right)\f$
\note Stores log10-values of vapor permeability, and interpolates in logspace.
*/
IBK::LinearSpline m_lgKv_Ol_Spline;
/*! Thermal conductivity spline: \f$\lambda\left(\theta_\ell\right)\f$
If empty, default thermal conductivity spline is being used.
*/
IBK::LinearSpline m_lambda_Ol_Spline;
};
#endif // MaterialH
|
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
* Belgium
*
* 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.
*
* In addition, as a special exception, the copyright holders of this
* program give permission to link the code of its release with the
* OpenSSL project's "OpenSSL" library (or with modified versions of it
* that use the same license as the "OpenSSL" library), and distribute
* the linked executables. You must obey the GNU General Public License
* in all respects for all of the code used other than "OpenSSL". If you
* modify file(s) with this exception, you may extend this exception to
* your version of the file(s), but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source files
* in the program, then also delete it here.
*
* 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 "../ICommand.h"
#include "SharedMessageQueue.h"
namespace Orthanc
{
class ThreadedCommandProcessor
{
public:
class IListener
{
public:
virtual ~IListener()
{
}
virtual void SignalProgress(unsigned int current,
unsigned int total) = 0;
virtual void SignalSuccess(unsigned int total) = 0;
virtual void SignalFailure() = 0;
virtual void SignalCancel() = 0;
};
private:
SharedMessageQueue queue_;
bool done_;
bool cancel_;
std::vector<boost::thread*> threads_;
IListener* listener_;
boost::mutex mutex_;
bool success_;
unsigned int remainingCommands_, totalCommands_;
boost::condition_variable processedCommand_;
static void Processor(ThreadedCommandProcessor* that);
public:
ThreadedCommandProcessor(unsigned int numThreads);
~ThreadedCommandProcessor();
// This takes the ownership of the command
void Post(ICommand* command);
bool Join();
void Cancel();
void SetListener(IListener& listener);
IListener& GetListener() const
{
return *listener_;
}
};
}
|
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(gr, blocks, __VA_ARGS__)
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
static const char* __doc_gr_blocks_log2_const_0 = R"doc()doc";
|
/*
===========================================================================
MDB Modular Database System
Copyright (C) 2013 Alex Reimann Cunha Lima, Aline Menin.
This file is part of the MDB Modular Database System.
MDB Modular Database System 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.
MDB Modular Database System 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 MDB Modular Database System. If not, see
<http://www.gnu.org/licenses/>.
===========================================================================
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <mdb.h>
#include <idb.h>
/* external */
/*
=============================
Show table TABLE
=============================
*/
RC mdb_DebugShowTABLE(db_t *db)
{
table_t *table;
table_t *tabTable;
recTABLE_t rec;
int i;
int count;
assert(db != NULL);
tabTable = idb_TabidOpen(db, TABID_TABLE);
ITERATE_TABREC(tabTable, i, &rec) {
ITERATE_TABREC_SKIP(&rec);
printf("name='%s', tabid=%d, reclen=%d\n", rec.name, rec.tabid, rec.reclen);
}
idb_TabClose(tabTable);
ITERATE_TAB(db, i, count, table) {
ITERATE_TAB_SKIP(table);
printf("found %s on\n", table->rec.name);
}
return RC_OK;
}
/*
=============================
Show table SCHEMA
=============================
*/
RC mdb_DebugShowSCHEMA(db_t *db)
{
table_t *tabSchema;
recSCHEMA_t rec;
int i;
assert(db != NULL);
tabSchema = idb_TabidOpen(db, TABID_SCHEMA);
ITERATE_TABREC(tabSchema, i, &rec) {
ITERATE_TABREC_SKIP(&rec);
printf("name='%32s', tabid=%2d, type=%d"
" pk=%d, notnull=%d, offset=%4d"
" len=%3d, fktabid=%2d, fkoffset=%4d\n",
rec.name, rec.tabid, rec.type,
rec.pk, rec.notnull, rec.offset,
rec.len, rec.fktabid, rec.fkoffset);
}
idb_TabClose(tabSchema);
return RC_OK;
}
/*
==============================
Lista os bancos de dados abertos
==============================
*/
RC mdb_DBShowList(void)
{
db_t *db;
for (db = idb_GetFirstDB(); db != NULL; db = db->nextDB) {
printf("%s\n", db->name);
}
return RC_OK;
}
|
/*! \file adc.h */
//*****************************************************************************
// Author : Christian Illy
// Created : 20.04.2009
// Revised : 06.06.2009
// Version : 0.1
// Target MCU : Fujitsu MB96300 series
//
// 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/>.
//
/// \defgroup adc ADC (adc.h)
/// \code #include "adc.h" \endcode
/// \par Overview
/// Routines to initialize the Analog-Digital-Converter and do single channel
/// conversions.
///
//*****************************************************************************
//@{
#ifndef ADC_H_
#define ADC_H_
#include "inttypes.h"
/**
* Initializes the A/D converter
*/
extern void adc_init(void);
/**
* Gets the value of an A/D conversion for an analog input pin
*
* @param pin Input pin AN*
* @return Result of A/D conversion (8 bit) or -1 if an error occured
*/
extern int16_t adc_getValue(uint8_t pin);
#endif /* ADC_H_ */
//@}
|
/* error.c: Error handling
Copyright 2005 Bjoern Butscher, Hendrik Weimer
This file is part of libquantum
libquantum 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.
libquantum 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 libquantum; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
*/
#include <stdlib.h>
#include <stdio.h>
#include "error.h"
void *
quantum_error_handler(void *f(int))
{
static void *errfunc = 0;
if(f)
errfunc = f;
return errfunc;
}
const char *
quantum_strerr(int errno)
{
switch(errno)
{
case QUANTUM_SUCCESS:
return "success";
case QUANTUM_FAILURE:
return "failure";
case QUANTUM_ENOMEM:
return "malloc failed";
case QUANTUM_EMLARGE:
return "matrix too large";
case QUANTUM_EMSIZE:
return "wrong matrix size";
case QUANTUM_EHASHFULL:
return "hash table full";
case QUANTUM_EHERMITIAN:
return "matrix not Hermitian";
case QUANTUM_ENOCONVERGE:
return "method failed to converge";
case QUANTUM_ENOLAPACK:
return "LAPACK support not compiled in";
case QUANTUM_ELAPACKARG:
return "wrong arguments supplied to LAPACK";
case QUANTUM_ELAPACKCONV:
return "LAPACK failed to converge";
case QUANTUM_EMCMATRIX:
return "single-column matrix expected";
case QUANTUM_EOPCODE:
return "unknown opcode";
default:
return "unknown error code";
}
}
void
quantum_error(int errno)
{
void (*p)(int);
p = quantum_error_handler(0);
if(p)
p(errno);
else
{
fflush(stdout);
fprintf(stderr, "ERROR: %s\n", quantum_strerr(errno));
fflush(stderr);
abort();
}
}
|
extern "C" {
#include "mos2defs.h"
}
#define info MOS2info
#define INSTANCE MOS2instance
#define MODEL MOS2model
#define SPICE_LETTER "M"
#define DEVICE_TYPE "ngspice_mos2"
#define MIN_NET_NODES 4
#define MAX_NET_NODES 4
#define INTERNAL_NODES 2
#define MODEL_TYPE "nmos2|pmos2"
static std::string port_names[] = {"d", "g", "s", "b"};
static std::string state_names[] = {};
|
// eCos memory layout - Thu May 31 15:00:18 2001
// This is a generated file - do not edit
#ifndef __ASSEMBLER__
#include <cyg/infra/cyg_type.h>
#include <stddef.h>
#endif
#define CYGMEM_REGION_ram (0x8c020000)
#define CYGMEM_REGION_ram_SIZE (0x1fe0000)
#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__heap1) [];
#endif
#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
#define CYGMEM_SECTION_heap1_SIZE (0x8e000000 - (size_t) CYG_LABEL_NAME (__heap1))
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__pci_window) [];
#endif
|
/*
* Moondust, a free game engine for platform game making
* Copyright (c) 2014-2021 Vitaly Novichkov <admin@wohlnet.ru>
*
* This software is licensed under a dual license system (MIT or GPL version 3 or later).
* This means you are free to choose with which of both licenses (MIT or GPL version 3 or later)
* you want to use this software.
*
* 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.
*
* You can see text of MIT license in the LICENSE.mit file you can see in Engine folder,
* or see https://mit-license.org/.
*
* You can see text of GPLv3 license in the LICENSE.gpl3 file you can see in Engine folder,
* or see <http://www.gnu.org/licenses/>.
*/
#ifndef CONTROL_KEYS_H
#define CONTROL_KEYS_H
/*!
* \brief Control key map structure. Contains a "is pressed" states of all available control keys
*/
struct controller_keys
{
//! Start key
bool start = false;
//! Start key (One-shot on press)
bool start_pressed = false;
//! Left arrow
bool left = false;
//! Left arrow (One-shot on press)
bool left_pressed = false;
//! Right arrow
bool right = false;
//! Right arrow (One-shot on press)
bool right_pressed = false;
//! Up arrow
bool up = false;
//! Up arrow (One-shot on press)
bool up_pressed = false;
//! Down arrow
bool down = false;
//! Down arrow (One-shot on press)
bool down_pressed = false;
//! Run/shoot/whip/beat/attack
bool run = false;
//! Run/shoot/whip/beat/attack (One-shot on press)
bool run_pressed = false;
//! Jump/Swim up
bool jump = false;
//! Jump/Swim up (One-shot on press)
bool jump_pressed = false;
//! Alt-jump/Spin-jump/Unmount-vehicle
bool alt_run = false;
//! Alt-jump/Spin-jump/Unmount-vehicle (One-shot on press)
bool alt_run_pressed = false;
//! Alt-jump/Shoot/Whip/Attack
bool alt_jump = false;
//! Alt-jump/Shoot/Whip/Attack (One-shot on press)
bool alt_jump_pressed = false;
//! Drop a holden item from a reserve box or Choice & Use item in the stock (Weapon, Potion, Armor, Shield, Bomb, etc.)
bool drop = false;
//! Drop (One-shot on press)
bool drop_pressed = false;
//! If any key pressed
bool any_key_pressed = false;
};
/*!
* \brief Initializes a control key states map with unpressed key states
* \return the initialized control key map structure with unpressed key states
*/
controller_keys ResetControlKeys();
#endif
|
/*
* opsys - A small, experimental operating system
* Copyright (C) 2010 Thomas Zimmermann
* Copyright (C) 2016 Thomas Zimmermann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "idtentry.h"
void
idt_entry_init(struct idt_entry *idte, unsigned long func,
unsigned short tss, unsigned char ring, unsigned char flags)
{
idte->base_low = func & 0xffff;
idte->tss = tss;
idte->reserved = 0;
idte->flags = flags | ((ring & 0x03) << 7);
idte->base_high = (func >> 16) & 0xffff;
}
|
///////////////////////////////////////////////////////////////////////////////
//
// Conditional.h
//
// $Id$
//
// Copyright (C) Simon Collis 2000-2012
//
//-----------------------------------------------------------------------------
//
// This file is part of a6.
//
// a6 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.
//
// a6 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 a6. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _CONDITIONAL_H
#define _CONDITIONAL_H
// Stack structure
struct condstack
{
int IsOn;
int ParentIsOn;
struct condstack* Parent;
};
// Conditional class
class Conditional
{
private:
static Conditional* instance;
static Conditional* Inst(void);
struct condstack* StackTop;
protected:
Conditional();
public:
~Conditional();
// Properties
static int IsOn (void);
// Methods
static void Clear (void);
static void Else (void);
static void Enter (int);
static void Exit (void);
static int OpenItems (void);
};
#endif
|
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_MENU_ITEM_PRIVATE_H__
#define __GTK_MENU_ITEM_PRIVATE_H__
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkaction.h>
G_BEGIN_DECLS
struct _GtkMenuItemPrivate
{
GtkWidget *submenu;
GdkWindow *event_window;
guint16 toggle_size;
guint16 accelerator_width;
guint timer;
gchar *accel_path;
GtkAction *action;
guint show_submenu_indicator : 1;
guint submenu_placement : 1;
guint submenu_direction : 1;
guint right_justify : 1;
guint timer_from_keypress : 1;
guint from_menubar : 1;
guint use_action_appearance : 1;
guint reserve_indicator : 1;
};
void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
const gchar *prefix,
GtkAccelGroup *accel_group,
gboolean group_changed);
gboolean _gtk_menu_item_is_selectable (GtkWidget *menu_item);
void _gtk_menu_item_popup_submenu (GtkWidget *menu_item,
gboolean with_delay);
void _gtk_menu_item_popdown_submenu (GtkWidget *menu_item);
void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
const gchar *prefix,
GtkAccelGroup *accel_group,
gboolean group_changed);
gboolean _gtk_menu_item_is_selectable (GtkWidget *menu_item);
void _gtk_menu_item_popup_submenu (GtkWidget *menu_item,
gboolean with_delay);
void _gtk_menu_item_popdown_submenu (GtkWidget *menu_item);
G_END_DECLS
#endif /* __GTK_MENU_ITEM_PRIVATE_H__ */
|
/*
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
* Free Software Foundation, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA
*
*/
int _gnutls_parse_extensions (gnutls_session_t session,
gnutls_ext_parse_type_t parse_type,
const opaque * data, int data_size);
int _gnutls_gen_extensions (gnutls_session_t session, opaque * data,
size_t data_size, gnutls_ext_parse_type_t);
int _gnutls_ext_init (void);
void _gnutls_ext_deinit (void);
void _gnutls_extension_list_add (gnutls_session_t session, uint16_t type);
|
//
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
//
// Copyright: See COPYING file that comes with this distribution
//
//
void sendArctechSelflearning();
|
#include "../lib/apue.h"
static void my_exit1(void);
static void my_exit2(void);
int
main(void){
if( atexit(my_exit2) != 0 )
err_sys("can't register my_exit2");
if( atexit(my_exit1) != 0 )
err_sys("can't register my_exit1");
if( atexit(my_exit1) != 0 )
err_sys("can't register my_exit1");
printf("main is done\n");
return 0;
}
static void
my_exit1(void){
printf("first exit handler\n");
}
static void
my_exit2(void){
printf("second exit handler\n");
}
|
// Copyright (c) the JPEG XL Project 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 LIB_PROFILER_TSC_TIMER_H_
#define LIB_PROFILER_TSC_TIMER_H_
// High-resolution (~10 ns) timestamps, using fences to prevent reordering and
// ensure exactly the desired regions are measured.
#include <stdint.h>
#include <ctime>
#include <hwy/base.h>
#include <hwy/cache_control.h> // LoadFence
#if HWY_COMPILER_MSVC
#include <chrono>
#endif // HWY_COMPILER_MSVC
namespace profiler {
// TicksBefore/After return absolute timestamps and must be placed immediately
// before and after the region to measure. The functions are distinct because
// they use different fences.
//
// Background: RDTSC is not 'serializing'; earlier instructions may complete
// after it, and/or later instructions may complete before it. 'Fences' ensure
// regions' elapsed times are independent of such reordering. The only
// documented unprivileged serializing instruction is CPUID, which acts as a
// full fence (no reordering across it in either direction). Unfortunately
// the latency of CPUID varies wildly (perhaps made worse by not initializing
// its EAX input). Because it cannot reliably be deducted from the region's
// elapsed time, it must not be included in the region to measure (i.e.
// between the two RDTSC).
//
// The newer RDTSCP is sometimes described as serializing, but it actually
// only serves as a half-fence with release semantics. Although all
// instructions in the region will complete before the final timestamp is
// captured, subsequent instructions may leak into the region and increase the
// elapsed time. Inserting another fence after the final RDTSCP would prevent
// such reordering without affecting the measured region.
//
// Fortunately, such a fence exists. The LFENCE instruction is only documented
// to delay later loads until earlier loads are visible. However, Intel's
// reference manual says it acts as a full fence (waiting until all earlier
// instructions have completed, and delaying later instructions until it
// completes). AMD assigns the same behavior to MFENCE.
//
// We need a fence before the initial RDTSC to prevent earlier instructions
// from leaking into the region, and arguably another after RDTSC to avoid
// region instructions from completing before the timestamp is recorded.
// When surrounded by fences, the additional RDTSCP half-fence provides no
// benefit, so the initial timestamp can be recorded via RDTSC, which has
// lower overhead than RDTSCP because it does not read TSC_AUX. In summary,
// we define Before = LFENCE/RDTSC/LFENCE; After = RDTSCP/LFENCE.
//
// Using Before+Before leads to higher variance and overhead than After+After.
// However, After+After includes an LFENCE in the region measurements, which
// adds a delay dependent on earlier loads. The combination of Before+After
// is faster than Before+Before and more consistent than Stop+Stop because
// the first LFENCE already delayed subsequent loads before the measured
// region. This combination seems not to have been considered in prior work:
// http://akaros.cs.berkeley.edu/lxr/akaros/kern/arch/x86/rdtsc_test.c
//
// Note: performance counters can measure 'exact' instructions-retired or
// (unhalted) cycle counts. The RDPMC instruction is not serializing and also
// requires fences. Unfortunately, it is not accessible on all OSes and we
// prefer to avoid kernel-mode drivers. Performance counters are also affected
// by several under/over-count errata, so we use the TSC instead.
// Returns a 64-bit timestamp in unit of 'ticks'; to convert to seconds,
// divide by InvariantTicksPerSecond. Although 32-bit ticks are faster to read,
// they overflow too quickly to measure long regions.
static HWY_INLINE HWY_MAYBE_UNUSED uint64_t TicksBefore() {
uint64_t t;
#if HWY_ARCH_PPC
asm volatile("mfspr %0, %1" : "=r"(t) : "i"(268));
#elif HWY_ARCH_X86_64 && HWY_COMPILER_MSVC
hwy::LoadFence();
HWY_FENCE;
t = __rdtsc();
hwy::LoadFence();
HWY_FENCE;
#elif HWY_ARCH_X86_64 && (HWY_COMPILER_CLANG || HWY_COMPILER_GCC)
asm volatile(
"lfence\n\t"
"rdtsc\n\t"
"shl $32, %%rdx\n\t"
"or %%rdx, %0\n\t"
"lfence"
: "=a"(t)
:
// "memory" avoids reordering. rdx = TSC >> 32.
// "cc" = flags modified by SHL.
: "rdx", "memory", "cc");
#elif HWY_COMPILER_MSVC
// Use std::chrono in MSVC 32-bit.
t = std::chrono::time_point_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now())
.time_since_epoch()
.count();
#else
// Fall back to OS - unsure how to reliably query cntvct_el0 frequency.
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
t = ts.tv_sec * 1000000000LL + ts.tv_nsec;
#endif
return t;
}
static HWY_INLINE HWY_MAYBE_UNUSED uint64_t TicksAfter() {
uint64_t t;
#if HWY_ARCH_X86_64 && HWY_COMPILER_MSVC
HWY_FENCE;
unsigned aux;
t = __rdtscp(&aux);
hwy::LoadFence();
HWY_FENCE;
#elif HWY_ARCH_X86_64 && (HWY_COMPILER_CLANG || HWY_COMPILER_GCC)
// Use inline asm because __rdtscp generates code to store TSC_AUX (ecx).
asm volatile(
"rdtscp\n\t"
"shl $32, %%rdx\n\t"
"or %%rdx, %0\n\t"
"lfence"
: "=a"(t)
:
// "memory" avoids reordering. rcx = TSC_AUX. rdx = TSC >> 32.
// "cc" = flags modified by SHL.
: "rcx", "rdx", "memory", "cc");
#else
t = TicksBefore(); // no difference on other platforms.
#endif
return t;
}
} // namespace profiler
#endif // LIB_PROFILER_TSC_TIMER_H_
|
#ifndef GILIGHTGRABBER_H
#define GILIGHTGRABBER_H
//#include <QtGui>
#include <QGLViewer/mouseGrabber.h>
#include "gilightobject.h"
class GiLightGrabber : public QObject, public qglviewer::MouseGrabber, public GiLightObject
{
Q_OBJECT
public :
GiLightGrabber();
~GiLightGrabber();
enum MoveAxis
{
MoveX,
MoveY,
MoveZ,
MoveAll
};
int moveAxis();
void setMoveAxis(int);
int pointPressed();
void mousePosition(int&, int&);
void checkIfGrabsMouse(int, int, const qglviewer::Camera* const);
void mousePressEvent(QMouseEvent* const, qglviewer::Camera* const);
void mouseMoveEvent(QMouseEvent* const, qglviewer::Camera* const);
void mouseReleaseEvent(QMouseEvent* const, qglviewer::Camera* const);
signals :
void selectForEditing(int, int);
void deselectForEditing();
private :
int m_lastX, m_lastY;
int m_pointPressed;
int m_moveAxis;
bool m_pressed;
QPoint m_prevPos;
bool m_moved;
};
#endif
|
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
#define AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
#include <tuple>
#include "config/av1_rtcd.h"
#include "test/acm_random.h"
#include "test/util.h"
#include "test/register_state_check.h"
#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
#include "aom_ports/aom_timer.h"
#include "av1/common/convolve.h"
#include "av1/common/mv.h"
namespace libaom_test {
namespace AV1HiprecConvolve {
typedef void (*hiprec_convolve_func)(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h,
const ConvolveParams *conv_params);
typedef std::tuple<int, int, int, hiprec_convolve_func> HiprecConvolveParam;
::testing::internal::ParamGenerator<HiprecConvolveParam> BuildParams(
hiprec_convolve_func filter);
class AV1HiprecConvolveTest
: public ::testing::TestWithParam<HiprecConvolveParam> {
public:
virtual ~AV1HiprecConvolveTest();
virtual void SetUp();
virtual void TearDown();
protected:
void RunCheckOutput(hiprec_convolve_func test_impl);
void RunSpeedTest(hiprec_convolve_func test_impl);
libaom_test::ACMRandom rnd_;
};
} // namespace AV1HiprecConvolve
#if CONFIG_AV1_HIGHBITDEPTH
namespace AV1HighbdHiprecConvolve {
typedef void (*highbd_hiprec_convolve_func)(
const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4, int w, int h,
const ConvolveParams *conv_params, int bps);
typedef std::tuple<int, int, int, int, highbd_hiprec_convolve_func>
HighbdHiprecConvolveParam;
::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams(
highbd_hiprec_convolve_func filter);
class AV1HighbdHiprecConvolveTest
: public ::testing::TestWithParam<HighbdHiprecConvolveParam> {
public:
virtual ~AV1HighbdHiprecConvolveTest();
virtual void SetUp();
virtual void TearDown();
protected:
void RunCheckOutput(highbd_hiprec_convolve_func test_impl);
void RunSpeedTest(highbd_hiprec_convolve_func test_impl);
libaom_test::ACMRandom rnd_;
};
} // namespace AV1HighbdHiprecConvolve
#endif // CONFIG_AV1_HIGHBITDEPTH
} // namespace libaom_test
#endif // AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <semaphore.h>
int main(int argc, char **argv)
{
sem_t *sem;
int value;
if (argc != 2) {
printf("usage: %s <name>\n", argv[0]);
exit(EXIT_FAILURE);
}
if ((sem = sem_open(argv[1], 0)) == SEM_FAILED) {
printf("sem_open error: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
if (sem_post(sem) == -1) {
printf("sem_post error: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
if (sem_getvalue(sem, &value) == -1) {
printf("sem_getvalue error: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
printf("value = %d\n", value);
exit(EXIT_SUCCESS);
}
|
/* Copyright 2011-2018 Tyler Gilbert;
* This file is part of Stratify OS.
*
* Stratify OS 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.
*
* Stratify OS 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 Stratify OS. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/*! \addtogroup unistd
* @{
*/
/*! \file */
#include "unistd_fs.h"
/*! \details This function is equivalent to \ref stat() except
* path refers to a symbolic link.
*
* \return Zero on success or -1 on error with errno (see \ref errno) set to:
* - ENAMETOOLONG: \a path exceeds PATH_MAX or a component of \a path exceeds NAME_MAX
* - ENOENT: \a path does not exist
* - EACCES: search permission is denied for a component of \a path
*
*/
int lstat(const char * path /*! The path the to symbolic link */,
struct stat *buf /*! The destination buffer */){
const sysfs_t * fs;
if ( sysfs_ispathinvalid(path) == true ){
return -1;
}
fs = sysfs_find(path, true);
if ( fs != NULL ){
int ret = fs->lstat(fs->config, sysfs_stripmountpath(fs, path), buf);
SYSFS_PROCESS_RETURN(ret);
return ret;
}
errno = ENOENT;
return -1;
}
/*! @} */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.