text stringlengths 4 6.14k |
|---|
/* NeoStats - IRC Statistical Services
** Copyright (c) 1999-2008 Adam Rutter, Justin Hammond, Mark Hetherington
** http://www.neostats.net/
**
** Portions Copyright (c) 2000 - 2001 ^Enigma^
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id: MiniMessageGateway.h 3294 2008-02-24 02:45:41Z Fish $
*/
#ifndef MiniMessageGateway_h
#define MiniMessageGateway_h
#include "MiniMessage.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Definition of our opaque handle to a MMessageGateway object. Your
* code doesn't know what a (MMessageGateway *) points to, and it doesn't care,
* because all operations on it should happen via calls to the functions
* that are defined below.
*/
struct _MMessageGateway;
typedef struct _MMessageGateway MMessageGateway;
/** Typedef for a callback function that knows how to read data from a buffer and send it
* out to (a file, the network, a serial line, wherever).
* @param buf The buffer to read bytes from.
* @param numBytes The number of bytes available for reading at (buf)
* @param arg This is a user-specified value; it will be the same as the value passed in to MMDoOutput().
* @returns The number of bytes actually read from (buf), or a negative value if there was a critical error (e.g. disconnected socket).
*/
typedef int32 (*MGSendFunc)(const uint8 * buf, uint32 numBytes, void * arg);
/** Typedef for a callback function that knows how to read data from
* (a file, the network, a serial line, wherever) and write it into a supplied buffer.
* @param buf The buffer to write bytes to.
* @param numBytes The number of bytes available for writing at (buf)
* @param arg This is a user-specified value; it will be the same as the value passed in to MMDoInput().
* @returns The number of bytes actually written into (buf), or a negative value if there was a critical error (e.g. disconnected socket).
*/
typedef int32 (*MGReceiveFunc)(uint8 * buf, uint32 numBytes, void * arg);
/** Allocates and initializes a new MMessageGateway.
* @returns a newly allocated MMessageGateway, or NULL on failure. If non-NULL, it becomes the
* the responsibility of the calling code to call MMFreeMessageGateway() on the
* MMessageGateway when it is done using it.
*/
MMessageGateway * MGAllocMessageGateway();
/** Frees a previously created MMessageGateway and all the data that it holds.
* @param msg The MMessageGateway to free. If NULL, no action will be taken.
*/
void MGFreeMessageGateway(MMessageGateway * gw);
/** Flattens the given MMessage into bytes and adds the result to our queue of outgoing data.
* @param gw The Gateway to add the message data to.
* @param msg The MMessage object to flatten. Note that the gateway DOES NOT assume ownership of this MMessage!
* You are still responsible for freeing it, and may do so immediately on return of this function, if you wish.
* @returns B_NO_ERROR on success, or B_ERROR on error (out of memory?)
*/
status_t MGAddOutgoingMessage(MMessageGateway * gw, const MMessage * msg);
/** Returns MTrue iff the given gateway has any output bytes queued up, that it wants to send.
* @param gw The Gateway to query.
* @returns MTrue if there are bytes queued up to send, or MFalse otherwise.
*/
MBool MGHasBytesToOutput(const MMessageGateway * gw);
/** Writes out as many queued bytes as possible (up to maxBytes).
* @param gw The Gateway that should do the outputting.
* @param maxBytes The maximum number of bytes that should be sent by this function call. Pass in ~0 to write without limit.
* @param sendFunc The function that the gateway way will call to actually do the write operation.
* @param arg The argument to pass to the write function.
* @returns The number of bytes written, or a negative number if there was an error.
*/
int32 MGDoOutput(MMessageGateway * gw, uint32 maxBytes, MGSendFunc sendFunc, void * arg);
/** Reads in as many queued bytes as possible (up to maxBytes, or until a full MMessage is read).
* @param gw The Gateway that should do the inputting.
* @param maxBytes The maximum number of bytes that should be read by this function call. Pass in ~0 to read without limit.
* @param recvFunc The function that the gateway way will call to actually do the read operation.
* @param arg The argument to pass to the read function.
* @param optRetMsg If non-NULL, the pointer this argument points to will be set to a returned MMessage object
* if there is one ready, or NULL otherwise. NOTE: If the pointer is set non-NULL, it becomes
* the calling code's responsibility to call MMFreeMessage() on the pointer when you are done with it!
* Failure to do so will result in a memory leak.
* @returns The number of bytes read, or a negative number if there was an error.
*/
int32 MGDoInput(MMessageGateway * gw, uint32 maxBytes, MGReceiveFunc recvFunc, void * arg, MMessage ** optRetMsg);
#ifdef __cplusplus
};
#endif
#endif
|
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_PETAI_H
#define MANGOS_PETAI_H
#include "CreatureAI.h"
#include "Timer.h"
class Creature;
class Spell;
class MANGOS_DLL_DECL PetAI : public CreatureAI
{
public:
PetAI(Creature &c);
void MoveInLineOfSight(Unit *);
void AttackStart(Unit *);
void EnterEvadeMode();
void DamageTaken(Unit *done_by, uint32& /*damage*/) { AttackedBy(done_by); }
void AttackedBy(Unit*);
bool IsVisible(Unit *) const;
void JustDied(Unit* who) { _stopAttack(); }
void UpdateAI(const uint32);
static int Permissible(const Creature *);
private:
bool _isVisible(Unit *) const;
bool _needToStop(void) const;
void _stopAttack(void);
void UpdateAllies();
Creature &i_pet;
bool inCombat;
TimeTracker i_tracker;
std::set<uint64> m_AllySet;
uint32 m_updateAlliesTimer;
typedef std::pair<Unit*, Spell*> TargetSpellPair;
std::vector<TargetSpellPair> m_targetSpellStore;
};
#endif
|
/*
* Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Native method support for java.util.zip.Adler32
*/
#include "JNIHelp.h"
#include "jni.h"
#include "jni_util.h"
#include <zlib.h>
#define NATIVE_METHOD(className, functionName, signature) \
{ #functionName, signature, (void*)(Java_java_util_zip_ ## className ## _ ## functionName) }
JNIEXPORT jint JNICALL
Java_java_util_zip_Adler32_update(JNIEnv *env, jclass cls, jint adler, jint b)
{
Bytef buf[1];
buf[0] = (Bytef)b;
return adler32(adler, buf, 1);
}
JNIEXPORT jint JNICALL
Java_java_util_zip_Adler32_updateBytes(JNIEnv *env, jclass cls, jint adler,
jarray b, jint off, jint len)
{
Bytef *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
if (buf) {
adler = adler32(adler, buf + off, len);
(*env)->ReleasePrimitiveArrayCritical(env, b, buf, 0);
}
return adler;
}
JNIEXPORT jint JNICALL
Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
jlong address, jint off, jint len)
{
Bytef *buf = (Bytef *)jlong_to_ptr(address);
if (buf) {
adler = adler32(adler, buf + off, len);
}
return adler;
}
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, update, "(II)I"),
NATIVE_METHOD(Adler32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(Adler32, updateByteBuffer, "(IJII)I"),
};
void register_java_util_zip_Adler32(JNIEnv* env) {
jniRegisterNativeMethods(env, "java/util/zip/Adler32", gMethods, NELEM(gMethods));
}
|
/*
* TLS module
*
* Copyright (C) 2006 enum.at
*
* This file is part of SIP-router, a free SIP server.
*
* SIP-router 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
*
* SIP-router 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
*
* Exception: permission to copy, modify, propagate, and distribute a work
* formed by combining OpenSSL toolkit software and the code in this file,
* such as linking with software components and libraries released under
* OpenSSL project license.
*/
/** log the verification failure reason.
* @file tls_dump_vf.h
* @ingroup: tls
* Module: @ref tls
*/
/*
* History:
* --------
* 2010-05-20 split from tls_server.c
*/
#ifndef __tls_dump_vf_h
#define __tls_dump_vf_h
void tls_dump_verification_failure(long verification_result);
#endif /*__tls_dump_vf_h*/
/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
|
/* totem-session.h
Copyright (C) 2004 Bastien Nocera <hadess@hadess.net>
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.
Author: Bastien Nocera <hadess@hadess.net>
*/
#ifndef TOTEM_SESSION_H
#define TOTEM_SESSION_H
#include "totem.h"
G_BEGIN_DECLS
void totem_session_add_options (GOptionContext *context);
void totem_session_setup (Totem *totem, char **argv);
void totem_session_restore (Totem *totem, char **filenames);
G_END_DECLS
#endif /* TOTEM_SESSION_H */
|
/*
* $Id$
*/
#ifndef SQUID_SNMP_UTIL_H
#define SQUID_SNMP_UTIL_H
/* call a function at regular intervals (in seconds): */
extern void snmp_alarm(int ival, void (*handler) (void));
/* service for filedescriptors: */
extern void fd_add(int fd, void (*func) (int fd));
extern void fd_service(void);
/* ---------------------------------------------------------------------- */
/*
* SNMP Agent extension for Spacer-Controler Management
*
* Copyright (c) 1997 FT/CNET/DES/GRL Olivier Montanuy
*/
/* Function to safely copy a string, and ensure the last
* character is always '\0'. */
void strcpy_safe(char *str, int str_len, char *val);
/* Function to get IP address of this agent
* WARNING: this scans all interfaces (slow) */
u_long Util_local_ip_address(void);
/* Function to get the current time in seconds */
long Util_time_now(void);
/* Function to determine how long the agent has been running
* (WARNING: this seems rather slow) */
long Util_time_running();
/* Read data from file */
int Util_file_read(char *file, int offset, char *data, int dataSz);
/* Write data into file */
int Util_file_write(char *file, int offset, char *data, int dataSz);
/* ---------------------------------------------------------------------- */
#endif /* SQUID_SNMP_UTIL_H */
|
/*
* This file is part of the UCB release of Plan 9. It is subject to the license
* terms in the LICENSE file found in the top-level directory of this
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
* part of the UCB release of Plan 9, including this file, may be copied,
* modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
#include "lib.h"
#include <string.h>
#include "sys9.h"
#include "dir.h"
#define CHAR(x) *p++ = f->x
#define SHORT(x) p[0] = f->x; p[1] = f->x>>8; p += 2
#define LONG(x) p[0] = f->x; p[1] = f->x>>8; p[2] = f->x>>16; p[3] = f->x>>24; p += 4
#define VLONG(x) p[0] = f->x; p[1] = f->x>>8; p[2] = f->x>>16; p[3] = f->x>>24;\
p[4] = 0; p[5] = 0; p[6] = 0; p[7] = 0; p += 8
#define STRING(x,n) memcpy(p, f->x, n); p += n
int
convD2M(Dir *f, char *ap)
{
unsigned char *p;
p = (unsigned char*)ap;
STRING(name, sizeof(f->name));
STRING(uid, sizeof(f->uid));
STRING(gid, sizeof(f->gid));
LONG(qid.path);
LONG(qid.vers);
LONG(mode);
LONG(atime);
LONG(mtime);
VLONG(length);
SHORT(type);
SHORT(dev);
return p - (unsigned char*)ap;
}
#undef CHAR
#undef SHORT
#undef LONG
#undef VLONG
#undef STRING
#define CHAR(x) f->x = *p++
#define SHORT(x) f->x = (p[0] | (p[1]<<8)); p += 2
#define LONG(x) f->x = (p[0] | (p[1]<<8) |\
(p[2]<<16) | (p[3]<<24)); p += 4
#define VLONG(x) f->x = (p[0] | (p[1]<<8) |\
(p[2]<<16) | (p[3]<<24)); p += 8
#define STRING(x,n) memcpy(f->x, p, n); p += n
int
convM2D(char *ap, Dir *f)
{
unsigned char *p;
p = (unsigned char*)ap;
STRING(name, sizeof(f->name));
STRING(uid, sizeof(f->uid));
STRING(gid, sizeof(f->gid));
LONG(qid.path);
LONG(qid.vers);
LONG(mode);
LONG(atime);
LONG(mtime);
VLONG(length);
SHORT(type);
SHORT(dev);
return p - (unsigned char*)ap;
}
|
#include <pch.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_mixer.h>
#define SHAPE_SIZE 16
using namespace concurrency;
int Sound_Play(const char *file_name);
int Sound_Init();
void fake_main(void * sdata)
{
SDL_Window* Main_Window;
SDL_Renderer* Main_Renderer;
SDL_Surface* Loading_Surf;
SDL_Texture* Background_Tx;
/* Rectangles for drawing which will specify source (inside the texture)
and target (on the screen) for rendering our textures. */
SDL_Rect SrcR;
SDL_Rect DestR;
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO ,sdata);
SrcR.x = 0;
SrcR.y = 0;
SrcR.w = SHAPE_SIZE;
SrcR.h = SHAPE_SIZE;
DestR.x = 640 / 2 - SHAPE_SIZE / 2;
DestR.y = 580 / 2 - SHAPE_SIZE / 2;
DestR.w = SHAPE_SIZE;
DestR.h = SHAPE_SIZE;
/* Before we can render anything, we need a window and a renderer */
Main_Window = SDL_CreateWindow("SDL_RenderCopy Example",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 580, 0);
// Main_Renderer = SDL_CreateRenderer(Main_Window, -1, SDL_RENDERER_ACCELERATED);
string s(GAMEPATH);
string dst="Background.png";
string dst2="sample2.wav";
string dst3="sample.ogg";
//Loading_Surf = SDL_LoadBMP((s+dst).data());
Loading_Surf=IMG_LoadPNG_RW(SDL_RWFromFile((s+dst).data(),"rb"));
//Main_Renderer=SDL_CreateSoftwareRenderer(Loading_Surf);
Main_Renderer=SDL_CreateRenderer(Main_Window,-1,SDL_RENDERER_SOFTWARE);
if(!Loading_Surf)
{
throw;
}
Background_Tx = SDL_CreateTextureFromSurface(Main_Renderer, Loading_Surf);
SDL_Rect r;
r.h=480;
r.w=800;
int * pitch;
/* render background, whereas NULL for source and destination
rectangles just means "use the default" */
SDL_RenderCopy(Main_Renderer, Background_Tx, NULL, NULL);
SDL_RenderPresent(Main_Renderer);
//SDL_RenderClear(Main_Renderer);
//SDL_RenderPresent(Main_Renderer);
//Sound_Init();
////auto task=create_async([s,dst2](){
////Sound_Play((s+dst2).data());
////});
//Sound_Play((s+dst3).data());
SDL_Delay(0xFFFFFFFF);
/* The renderer works pretty much like a big canvas:
when you RenderCopy you are adding paint, each time adding it
on top.
You can change how it blends with the stuff that
the new data goes over.
When your 'picture' is complete, you show it
by using SDL_RenderPresent. */
/* SDL 1.2 hint: If you're stuck on the whole renderer idea coming
from 1.2 surfaces and blitting, think of the renderer as your
main surface, and SDL_RenderCopy as the blit function to that main
surface, with SDL_RenderPresent as the old SDL_Flip function.*/
SDL_DestroyTexture(Background_Tx);
SDL_DestroyRenderer(Main_Renderer);
SDL_DestroyWindow(Main_Window);
SDL_Quit();
}
int Sound_Init()
{
const int TMP_FREQ = MIX_DEFAULT_FREQUENCY;
const Uint16 TMP_FORMAT = MIX_DEFAULT_FORMAT;
const int TMP_CHAN = 2;
const int TMP_CHUNK_SIZE = 512;
return Mix_OpenAudio(TMP_FREQ,TMP_FORMAT,TMP_CHAN,TMP_CHUNK_SIZE);
}
int Sound_Play(const char *file_name)
{
Mix_Music *mix_music;
if((mix_music = Mix_LoadMUS(file_name)) == NULL)
{
string s=Mix_GetError();
printf("call Mix_LoadMUS failed:%s/n",Mix_GetError());
return -1;
}
if(Mix_PlayMusic(mix_music,-1) == -1)
{
printf("call Mix_PlayMusic failed/n");
return -1;
}
printf("after call Mix_PlayMusic/n");
return 0;
} |
/***************************************************************************
qgssearchwidgetwrapper.h
--------------------------------------
Date : 31.5.2015
Copyright : (C) 2015 Karolina Alexiou (carolinux)
Email : carolinegr at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSSEARCHWIDGETWRAPPER_H
#define QGSSEARCHWIDGETWRAPPER_H
#include <QObject>
#include <QMap>
#include <QVariant>
class QgsVectorLayer;
class QgsField;
#include "qgseditorwidgetconfig.h"
#include "qgsattributeeditorcontext.h"
#include "qgswidgetwrapper.h"
/**
* Manages an editor widget
* Widget and wrapper share the same parent
*
* A wrapper controls one attribute editor widget and is able to create a default
* widget or use a pre-existent widget. It is able to set the widget to the value implied
* by a field of a vector layer, or return the value it currently holds. Every time it is changed
* it has to emit a valueChanged signal. If it fails to do so, there is no guarantee that the
* changed status of the widget will be saved.
*
*/
class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper
{
Q_OBJECT
public:
/**
* Create a new widget wrapper
*
* @param vl The layer on which the field is
* @param fieldIdx The field which will be controlled
* @param parent A parent widget for this widget wrapper and the created widget.
*/
explicit QgsSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 );
/**
* Will be used to access the widget's value. Read the value from the widget and
* return it properly formatted to be saved in the attribute.
*
* If an invalid variant is returned this will be interpreted as no change.
* Be sure to return a NULL QVariant if it should be set to NULL.
*
* @return The current value the widget represents
*/
virtual QString expression() = 0;
/**
* If this is true, then this search widget should take effect directly
* when its expression changes
*/
virtual bool applyDirectly() = 0;
signals:
/**
* Emitted whenever the expression changes
* @param exp The new search expression
*/
void expressionChanged( QString exp );
protected slots:
virtual void setExpression( QString value ) = 0;
void setFeature( const QgsFeature& feature ) override;
protected:
QString mExpression;
int mFieldIdx;
};
// We'll use this class inside a QVariant in the widgets properties
Q_DECLARE_METATYPE( QgsSearchWidgetWrapper* )
#endif // QGSSEARCHWIDGETWRAPPER_H
|
/*
* Copyright (c) 2010 Reimar Döffinger
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include "libavutil/intreadwrite.h"
static int ivf_write_header(AVFormatContext *s)
{
AVCodecContext *ctx;
AVIOContext *pb = s->pb;
if (s->nb_streams != 1) {
av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n");
return AVERROR(EINVAL);
}
ctx = s->streams[0]->codec;
if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != AV_CODEC_ID_VP8) {
av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n");
return AVERROR(EINVAL);
}
avio_write(pb, "DKIF", 4);
avio_wl16(pb, 0); // version
avio_wl16(pb, 32); // header length
avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80"));
avio_wl16(pb, ctx->width);
avio_wl16(pb, ctx->height);
avio_wl32(pb, s->streams[0]->time_base.den);
avio_wl32(pb, s->streams[0]->time_base.num);
avio_wl64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!?
return 0;
}
static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
avio_wl32(pb, pkt->size);
avio_wl64(pb, pkt->pts);
avio_write(pb, pkt->data, pkt->size);
return 0;
}
AVOutputFormat ff_ivf_muxer = {
.name = "ivf",
.long_name = NULL_IF_CONFIG_SMALL("On2 IVF"),
.extensions = "ivf",
.audio_codec = AV_CODEC_ID_NONE,
.video_codec = AV_CODEC_ID_VP8,
.write_header = ivf_write_header,
.write_packet = ivf_write_packet,
};
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* NAME
* semget02.c
*
* DESCRIPTION
* semget02 - test for EACCES and EEXIST errors
*
* ALGORITHM
* create a semaphore set without read or alter permissions
* loop if that option was specified
* call semget() using two different invalid cases
* check the errno value
* issue a PASS message if we get EACCES or EEXIST
* otherwise, the tests fails
* issue a FAIL message
* call cleanup
*
* USAGE: <for command-line>
* semget02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -e : Turn on errno logging.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* HISTORY
* 03/2001 - Written by Wayne Boyer
*
* RESTRICTIONS
* none
*/
#include <pwd.h>
#include "../lib/ipcsem.h"
char *TCID = "semget02";
int TST_TOTAL = 2;
int exp_enos[] = { EACCES, EEXIST, 0 };
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
int sem_id_1 = -1;
struct test_case_t {
int flags;
int error;
} TC[] = {
/* EACCES - the semaphore has no read or alter permissions */
{
SEM_RA, EACCES},
/* EEXIST - the semaphore id exists and semget() was called with */
/* IPC_CREAT and IPC_EXCL */
{
IPC_CREAT | IPC_EXCL, EEXIST}
};
int main(int ac, char **av)
{
int lc;
const char *msg;
int i;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset tst_count in case we are looping */
tst_count = 0;
for (i = 0; i < TST_TOTAL; i++) {
/* use the TEST macro to make the call */
TEST(semget(semkey, PSEMS, TC[i].flags));
if (TEST_RETURN != -1) {
sem_id_1 = TEST_RETURN;
tst_resm(TFAIL, "call succeeded");
continue;
}
TEST_ERROR_LOG(TEST_ERRNO);
if (TEST_ERRNO == TC[i].error) {
tst_resm(TPASS, "expected failure - errno "
"= %d : %s", TEST_ERRNO,
strerror(TEST_ERRNO));
} else {
tst_resm(TFAIL, "unexpected error - %d : %s",
TEST_ERRNO, strerror(TEST_ERRNO));
}
}
}
cleanup();
tst_exit();
}
/*
* setup() - performs all the ONE TIME setup for this test.
*/
void setup(void)
{
tst_require_root(NULL);
/* Switch to nobody user for correct error code collection */
ltpuser = getpwnam(nobody_uid);
if (seteuid(ltpuser->pw_uid) == -1) {
tst_resm(TINFO, "setreuid failed to "
"to set the effective uid to %d", ltpuser->pw_uid);
perror("setreuid");
}
tst_sig(NOFORK, DEF_HANDLER, cleanup);
/* Set up the expected error numbers for -e option */
TEST_EXP_ENOS(exp_enos);
TEST_PAUSE;
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
* See ../lib/libipc.c for more information.
*/
tst_tmpdir();
/* get an IPC resource key */
semkey = getipckey();
/* create a semaphore set without read or alter permissions */
if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
}
}
/*
* cleanup() - performs all the ONE TIME cleanup for this test at completion
* or premature exit.
*/
void cleanup(void)
{
/* if it exists, remove the semaphore resource */
rm_sema(sem_id_1);
tst_rmdir();
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
}
|
/* museeq - a Qt client to museekd
*
* Copyright (C) 2003-2004 Hyriand <hyriand@thegraveyard.org>
* Copyright 2008 little blue poney <lbponey@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WISHLIST_H
#define WISHLIST_H
#include "museeqtypes.h"
#include <QWidget>
class QLineEdit;
class WishListView;
class QShowEvent;
class QPushButton;
class WishList : public QWidget {
Q_OBJECT
public:
WishList(QWidget* = 0, const char* = 0);
protected:
void showEvent(QShowEvent*);
protected slots:
void slotAddWish();
public slots:
void added(const QString&, uint);
void removed(const QString&);
private:
QLineEdit *mEntry;
WishListView *mWishList;
QPushButton * mAdd;
};
#endif // WISHLIST_H
|
/*
* #%L
* Bio-Formats plugin for the Insight Toolkit.
* %%
* Copyright (C) 2009 - 2012 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
* - Glencoe Software, Inc.
* - University of Dundee
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of any organization.
*
* ----------------------------------------------------------------
* Adapted from the Slicer3 project: http://www.slicer.org/
* http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/
*
* See slicer-license.txt for Slicer3's licensing information.
*
* For more information about the ITK Plugin IO mechanism, see:
* http://www.itk.org/Wiki/Plugin_IO_mechanisms
* #L%
*/
#ifndef H_ITK_IMAGE_IO_H
#define H_ITK_IMAGE_IO_H
// for Bio-Formats C++ bindings
#include "loci-common.h"
using jace::JNIException;
using jace::proxy::java::lang::Exception;
using jace::proxy::loci::common::DebugTools;
#include "bio-formats.h"
using jace::proxy::loci::formats::ChannelFiller;
using jace::proxy::loci::formats::ChannelMerger;
using jace::proxy::loci::formats::ChannelSeparator;
using jace::proxy::loci::formats::FormatTools;
using jace::proxy::loci::formats::IFormatHandler;
using jace::proxy::loci::formats::IFormatReader;
using jace::proxy::loci::formats::ImageReader;
using jace::proxy::loci::formats::ImageWriter;
using jace::proxy::loci::formats::MetadataTools;
using jace::proxy::loci::formats::meta::MetadataRetrieve;
using jace::proxy::loci::formats::meta::IMetadata;
#include "ome-xml.h"
using jace::proxy::ome::xml::model::enums::DimensionOrder;
using jace::proxy::ome::xml::model::enums::PixelType;
using jace::proxy::ome::xml::model::primitives::PositiveInteger;
using jace::proxy::ome::xml::model::primitives::PositiveFloat;
using jace::proxy::types::JInt;
using jace::proxy::java::lang::Boolean;
using jace::proxy::java::lang::Integer;
using jace::proxy::java::lang::Double;
using jace::proxy::java::lang::String;
#undef Byte
// STL includes
// ITK includes
#include "itkImageIOBase.h"
#include "itkMatrix.h"
#include "itkIndent.h"
#include <itk_zlib.h>
#include "itkBioFormatsIOWin32Header.h"
namespace itk
{
class BioFormatsImageIO : public ImageIOBase
{
public:
typedef BioFormatsImageIO Self;
typedef ImageIOBase Superclass;
typedef SmartPointer<Self> Pointer;
/** Method for creation through the object factory **/
itkNewMacro(Self);
/** RTTI (and related methods) **/
itkTypeMacro(BioFormatsImageIO, Superclass);
/**--------------- Read the data----------------- **/
virtual bool CanReadFile(const char* FileNameToRead);
/* Set the spacing and dimension information for the set file name */
virtual void ReadImageInformation();
/* Read the data from the disk into provided memory buffer */
virtual void Read(void* buffer);
/**---------------Write the data------------------**/
virtual bool CanWriteFile(const char* FileNameToWrite);
/* Set the spacing and dimension information for the set file name */
virtual void WriteImageInformation();
/* Write the data to the disk from the provided memory buffer */
virtual void Write(const void* buffer);
protected:
BioFormatsImageIO();
~BioFormatsImageIO();
private:
IFormatReader* reader;
ImageReader* imageReader;
ChannelFiller* channelFiller;
ChannelSeparator* channelSeparator;
ChannelMerger* channelMerger;
ImageWriter* writer;
virtual double decode(PositiveFloat pf);
virtual double decode(Double h);
};
}
#endif // H_ITK_IMAGE_IO_H
|
#ifndef __IFX_PPA_API_PWM_H__20091216_1952__
#define __IFX_PPA_API_PWM_H__20091216_1952__
/*******************************************************************************
**
** FILE NAME : ifx_ppa_api_pwm.h
** PROJECT : PPA
** MODULES : PPA API ( Power Management APIs)
**
** DATE : 16 DEC 2009
** AUTHOR : Shao Guohua
** DESCRIPTION : PPA Protocol Stack Hook API Power Management
** File
** COPYRIGHT : Copyright (c) 2009
** Lantiq Deutschland GmbH
** Am Campeon 3; 85579 Neubiberg, Germany
**
** For licensing information, see the file 'LICENSE' in the root folder of
** this software module.
**
** HISTORY
** $Date $Author $Comment
** 16 Dec 2009 Shao Guohua Initiate Version
*******************************************************************************/
/*! \file ifx_ppa_api_pwm.h
\brief This file contains es.
provide PPA power management API.
*/
/** \addtogroup PPA_PWM_API */
/*@{*/
/*
* ####################################
* Definition
* ####################################
*/
/*
* ####################################
* Data Type
* ####################################
*/
/*
* ####################################
* Declaration
* ####################################
*/
#if defined(CONFIG_IFX_PMCU) || defined(CONFIG_IFX_PMCU_MODULE)
/*!
\brief Request D0 power state when any session is added into table.
\return none
\ingroup IFX_PPA_API_PWM
*/
extern void ifx_ppa_pwm_activate_module(void);
/*!
\brief Request D3 power state when any session is removed from table.
\return none
\ingroup IFX_PPA_API_PWM
*/
extern void ifx_ppa_pwm_deactivate_module(void);
/*!
\brief Initialize ppa pwm
\return
*/
extern void ifx_ppa_pwm_init(void);
/*!
\brief exit ppa pwm
\return
*/
extern void ifx_ppa_pwm_exit(void);
#else
static inline void ifx_ppa_pwm_activate_module(void) {}
static inline void ifx_ppa_pwm_deactivate_module(void) {}
static inline void ifx_ppa_pwm_init(void) {}
static inline void ifx_ppa_pwm_exit(void) {}
#endif
/* @} */
#endif // __IFX_PPA_API_PWM_H__20091216_1952__
|
/***************************************************************************
zippath.h
File/directory/path operations that work with ZIP files
***************************************************************************/
#pragma once
#ifndef __ZIPPATH_H__
#define __ZIPPATH_H__
#include "corefile.h"
#include "astring.h"
#include "unzip.h"
#include "astring.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
typedef struct _zippath_directory zippath_directory;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* ----- path operations ----- */
/* retrieves the parent directory */
astring *zippath_parent(astring *dst, const char *path);
/* retrieves the parent directory basename */
astring *zippath_parent_basename(astring *dst, const char *path);
/* combines two paths */
astring *zippath_combine(astring *dst, const char *path1, const char *path2);
/* ----- file operations ----- */
/* opens a zip path file */
file_error zippath_fopen(const char *filename, UINT32 openflags, core_file **file, astring *revised_path);
/* ----- directory operations ----- */
/* opens a directory */
file_error zippath_opendir(const char *path, zippath_directory **directory);
/* closes a directory */
void zippath_closedir(zippath_directory *directory);
/* reads a directory entry */
const osd_directory_entry *zippath_readdir(zippath_directory *directory);
/* returns TRUE if this path is a ZIP path or FALSE if not */
int zippath_is_zip(zippath_directory *directory);
#endif /* __ZIPPATH_H__ */
|
/*
* YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
*
* Copyright (C) 2002-2011 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
*
* 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 "yaffs_nand.h"
#include "yaffs_tagscompat.h"
#include "yaffs_getblockinfo.h"
#include "yaffs_summary.h"
int yaffs_rd_chunk_tags_nand(struct yaffs_dev *dev, int nand_chunk,
u8 *buffer, struct yaffs_ext_tags *tags, int replacement)
{
int result;
struct yaffs_ext_tags local_tags;
int flash_chunk = nand_chunk - dev->chunk_offset;
dev->n_page_reads++;
/* If there are no tags provided use local tags. */
if (!tags)
tags = &local_tags;
if (dev->param.read_chunk_tags_fn)
result =
dev->param.read_chunk_tags_fn(dev, flash_chunk, buffer,
tags);
else
result = yaffs_tags_compat_rd(dev,
flash_chunk, buffer, tags);
if (replacement && tags->ecc_result == YAFFS_ECC_RESULT_REPLACED) {
yaffs_handle_chunk_replacement(dev, buffer, tags);
}
if (tags && tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR) {
struct yaffs_block_info *bi;
bi = yaffs_get_block_info(dev,
nand_chunk /
dev->param.chunks_per_block);
yaffs_handle_chunk_error(dev, bi);
}
return result;
}
int yaffs_wr_chunk_tags_nand(struct yaffs_dev *dev,
int nand_chunk,
const u8 *buffer, struct yaffs_ext_tags *tags)
{
int result;
int flash_chunk = nand_chunk - dev->chunk_offset;
dev->n_page_writes++;
if (tags) {
tags->seq_number = dev->seq_number;
tags->chunk_used = 1;
yaffs_trace(YAFFS_TRACE_WRITE,
"Writing chunk %d tags %d %d",
nand_chunk, tags->obj_id, tags->chunk_id);
} else {
yaffs_trace(YAFFS_TRACE_ERROR, "Writing with no tags");
BUG();
return YAFFS_FAIL;
}
if (dev->param.write_chunk_tags_fn)
result = dev->param.write_chunk_tags_fn(dev, flash_chunk,
buffer, tags);
else
result = yaffs_tags_compat_wr(dev, flash_chunk, buffer, tags);
yaffs_summary_add(dev, tags, nand_chunk);
return result;
}
int yaffs_mark_bad(struct yaffs_dev *dev, int block_no)
{
block_no -= dev->block_offset;
if (dev->param.bad_block_fn)
return dev->param.bad_block_fn(dev, block_no);
return yaffs_tags_compat_mark_bad(dev, block_no);
}
int yaffs_query_init_block_state(struct yaffs_dev *dev,
int block_no,
enum yaffs_block_state *state,
u32 *seq_number)
{
block_no -= dev->block_offset;
if (dev->param.query_block_fn)
return dev->param.query_block_fn(dev, block_no, state,
seq_number);
return yaffs_tags_compat_query_block(dev, block_no, state, seq_number);
}
int yaffs_erase_block(struct yaffs_dev *dev, int flash_block)
{
int result;
flash_block -= dev->block_offset;
dev->n_erasures++;
result = dev->param.erase_fn(dev, flash_block);
return result;
}
int yaffs_init_nand(struct yaffs_dev *dev)
{
if (dev->param.initialise_flash_fn)
return dev->param.initialise_flash_fn(dev);
return YAFFS_OK;
}
|
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <stdio.h>
#include <fcntl.h>
#ifdef WIN32
# include <io.h>
#else
# ifdef __VMS
typedef int intptr_t;
# endif
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _MSC_VER
# ifdef _WIN64
typedef __int64 intptr_t;
# else
typedef int intptr_t;
# endif
#endif
#include <curl/curl.h>
#include "printf_macro.h"
#if LIBCURL_VERSION_NUM < 0x070c03
#error "upgrade your libcurl to no less than 7.12.3"
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* This example shows a HTTP PUT operation with authentiction using "any"
* type. It PUTs a file given as a command line argument to the URL also given
* on the command line.
*
* Since libcurl 7.12.3, using "any" auth and POST/PUT requires a set ioctl
* function.
*
* This example also uses its own read callback.
*/
/* ioctl callback function */
static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp)
{
intptr_t fd = (intptr_t)userp;
(void)handle; /* not used in here */
switch(cmd) {
case CURLIOCMD_RESTARTREAD:
/* mr libcurl kindly asks as to rewind the read data stream to start */
if(-1 == lseek(fd, 0, SEEK_SET))
/* couldn't rewind */
return CURLIOE_FAILRESTART;
break;
default: /* ignore unknown commands */
return CURLIOE_UNKNOWNCMD;
}
return CURLIOE_OK; /* success! */
}
/* read callback function, fread() look alike */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
size_t retcode;
intptr_t fd = (intptr_t)stream;
retcode = read(fd, ptr, size * nmemb);
fprintf(stderr, "*** We read %" _FMT_SIZE_T " bytes from file\n", retcode);
return retcode;
}
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
intptr_t hd ;
struct stat file_info;
char *file;
char *url;
if(argc < 3)
return 1;
file= argv[1];
url = argv[2];
/* get the file size of the local file */
hd = open(file, O_RDONLY) ;
fstat(hd, &file_info);
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, (void*)hd);
/* set the ioctl function */
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl);
/* pass the file descriptor to the ioctl callback as well */
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, (void*)hd);
/* enable "uploading" (which means PUT when doing HTTP) */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L) ;
/* specify target URL, and note that this URL should also include a file
name, not only a directory (as you can do with GTP uploads) */
curl_easy_setopt(curl,CURLOPT_URL, url);
/* and give the size of the upload, this supports large file sizes
on systems that have general support for it */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)file_info.st_size);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
/* set user name and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
close(hd); /* close the local file */
curl_global_cleanup();
return 0;
}
|
/*
* In The Name Of God
* ========================================
* [] File Name : combination.h
*
* [] Creation Date : 18-02-2015
*
* [] Last Modified : Wed 18 Feb 2015 10:05:03 PM IRST
*
* [] Created By : Parham Alvani (parham.alvani@gmail.com)
* =======================================
*/
#ifndef COMBINATION_H
#define COMBINATION_H
int combination(int n, int k);
#endif
|
/*
* IBM eServer eHCA Infiniband device driver for Linux on POWER
*
* MR/MW declarations and inline functions
*
* Authors: Dietmar Decker <ddecker@de.ibm.com>
* Christoph Raisch <raisch@de.ibm.com>
*
* Copyright (c) 2005 IBM Corporation
*
* All rights reserved.
*
* This source code is distributed under a dual license of GPL v2.0 and OpenIB
* BSD.
*
* OpenIB BSD License
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _EHCA_MRMW_H_
#define _EHCA_MRMW_H_
enum ehca_reg_type {
EHCA_REG_MR,
EHCA_REG_BUSMAP_MR
};
int ehca_reg_mr(struct ehca_shca *shca,
struct ehca_mr *e_mr,
u64 *iova_start,
u64 size,
int acl,
struct ehca_pd *e_pd,
struct ehca_mr_pginfo *pginfo,
u32 *lkey,
u32 *rkey,
enum ehca_reg_type reg_type);
int ehca_reg_mr_rpages(struct ehca_shca *shca,
struct ehca_mr *e_mr,
struct ehca_mr_pginfo *pginfo);
int ehca_rereg_mr(struct ehca_shca *shca,
struct ehca_mr *e_mr,
u64 *iova_start,
u64 size,
int mr_access_flags,
struct ehca_pd *e_pd,
struct ehca_mr_pginfo *pginfo,
u32 *lkey,
u32 *rkey);
int ehca_unmap_one_fmr(struct ehca_shca *shca,
struct ehca_mr *e_fmr);
int ehca_reg_smr(struct ehca_shca *shca,
struct ehca_mr *e_origmr,
struct ehca_mr *e_newmr,
u64 *iova_start,
int acl,
struct ehca_pd *e_pd,
u32 *lkey,
u32 *rkey);
int ehca_reg_internal_maxmr(struct ehca_shca *shca,
struct ehca_pd *e_pd,
struct ehca_mr **maxmr);
int ehca_reg_maxmr(struct ehca_shca *shca,
struct ehca_mr *e_newmr,
u64 *iova_start,
int acl,
struct ehca_pd *e_pd,
u32 *lkey,
u32 *rkey);
int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
int ehca_mr_chk_buf_and_calc_size(struct ib_phys_buf *phys_buf_array,
int num_phys_buf,
u64 *iova_start,
u64 *size);
int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
u64 *page_list,
int list_len);
int ehca_set_pagebuf(struct ehca_mr_pginfo *pginfo,
u32 number,
u64 *kpage);
int ehca_mr_is_maxmr(u64 size,
u64 *iova_start);
void ehca_mrmw_map_acl(int ib_acl,
u32 *hipz_acl);
void ehca_mrmw_set_pgsize_hipz_acl(u32 pgsize, u32 *hipz_acl);
void ehca_mrmw_reverse_map_acl(const u32 *hipz_acl,
int *ib_acl);
void ehca_mr_deletenew(struct ehca_mr *mr);
int ehca_create_busmap(void);
void ehca_destroy_busmap(void);
extern struct ib_dma_mapping_ops ehca_dma_mapping_ops;
#endif /*_EHCA_MRMW_H_*/
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2013 Red Hat, Inc.
*/
/**
* SECTION:nmt-page-ethernet
* @short_description: The editor page for Ethernet connections
*/
#include "nm-default.h"
#include "nmt-page-ethernet.h"
#include "nmt-mac-entry.h"
#include "nmt-mtu-entry.h"
G_DEFINE_TYPE (NmtPageEthernet, nmt_page_ethernet, NMT_TYPE_EDITOR_PAGE_DEVICE)
NmtEditorPage *
nmt_page_ethernet_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_ETHERNET,
"connection", conn,
"device-entry", deventry,
NULL);
}
static void
nmt_page_ethernet_init (NmtPageEthernet *ethernet)
{
}
static void
nmt_page_ethernet_constructed (GObject *object)
{
NmtPageEthernet *ethernet = NMT_PAGE_ETHERNET (object);
NmtDeviceEntry *deventry;
NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingWired *s_wired;
NmtNewtWidget *widget;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ethernet));
s_wired = nm_connection_get_setting_wired (conn);
if (!s_wired) {
nm_connection_add_setting (conn, nm_setting_wired_new ());
s_wired = nm_connection_get_setting_wired (conn);
}
deventry = nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (object));
g_object_bind_property (s_wired, NM_SETTING_WIRED_MAC_ADDRESS,
deventry, "mac-address",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
section = nmt_editor_section_new (_("ETHERNET"), NULL, FALSE);
grid = nmt_editor_section_get_body (section);
widget = nmt_mac_entry_new (40, ETH_ALEN);
g_object_bind_property (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
widget, "mac-address",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_grid_append (grid, _("Cloned MAC address"), widget, NULL);
widget = nmt_mtu_entry_new ();
g_object_bind_property (s_wired, NM_SETTING_WIRED_MTU,
widget, "mtu",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
nmt_editor_page_add_section (NMT_EDITOR_PAGE (ethernet), section);
G_OBJECT_CLASS (nmt_page_ethernet_parent_class)->constructed (object);
}
static void
nmt_page_ethernet_class_init (NmtPageEthernetClass *ethernet_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (ethernet_class);
object_class->constructed = nmt_page_ethernet_constructed;
}
|
int a,b,c;
float a;
int main()
{
float a,b;
a = 7.5;
c = a;
if (c > 7.1)
{
int a,b;
a = c+3*(10/9);
b = a/2/2;
printf("%d",b);
}
printf("%g",a);
printf("%d",c);
}
|
#pragma once
// Process Local Object Type
enum : u32
{
SYS_MEM_OBJECT = 0x08,
SYS_MUTEX_OBJECT = 0x85,
SYS_COND_OBJECT = 0x86,
SYS_RWLOCK_OBJECT = 0x88,
SYS_INTR_TAG_OBJECT = 0x0A,
SYS_INTR_SERVICE_HANDLE_OBJECT = 0x0B,
SYS_EVENT_QUEUE_OBJECT = 0x8D,
SYS_EVENT_PORT_OBJECT = 0x0E,
SYS_TRACE_OBJECT = 0x21,
SYS_SPUIMAGE_OBJECT = 0x22,
SYS_PRX_OBJECT = 0x23,
SYS_SPUPORT_OBJECT = 0x24,
SYS_OVERLAY_OBJECT = 0x25,
SYS_LWMUTEX_OBJECT = 0x95,
SYS_TIMER_OBJECT = 0x11,
SYS_SEMAPHORE_OBJECT = 0x96,
SYS_FS_FD_OBJECT = 0x73,
SYS_LWCOND_OBJECT = 0x97,
SYS_EVENT_FLAG_OBJECT = 0x98,
};
struct sys_exit2_param
{
be_t<u64> x0; // 0x85
be_t<u64> this_size; // 0x30
be_t<u64> next_size;
be_t<s64> prio;
be_t<u64> flags;
vm::bpptr<char, u64, u64> args;
};
// Auxiliary functions
s32 process_getpid();
s32 process_get_sdk_version(u32 pid, s32& ver);
s32 process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
// SysCalls
s32 sys_process_getpid();
s32 sys_process_getppid();
s32 sys_process_get_number_of_object(u32 object, vm::ptr<u32> nump);
s32 sys_process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::ptr<u32> set_size);
s32 _sys_process_get_paramsfo(vm::ptr<char> buffer);
s32 sys_process_get_sdk_version(u32 pid, vm::ptr<s32> version);
s32 sys_process_get_status(u64 unk);
s32 sys_process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
s32 sys_process_kill(u32 pid);
s32 sys_process_wait_for_child(u32 pid, vm::ptr<u32> status, u64 unk);
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6);
s32 sys_process_detach_child(u64 unk);
void _sys_process_exit(ppu_thread& ppu, s32 status, u32 arg2, u32 arg3);
void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> arg, u32 arg_size, u32 arg4);
|
/*
* Copyright c Realtek Semiconductor Corporation, 2002
* All rights reserved.
*
* Program : Header File for Layer3/4 Model Code
* Abstract :
* Author : Louis Yung-Chieh Lo (yjlou@realtek.com.tw)
* $Id: l34Model.h,v 1.1 2012/08/07 02:58:33 krammer Exp $
*/
#ifndef _L34_MODEL_
#define _L34_MODEL_
enum MODEL_RETURN_VALUE modelLayer34Switching( hsb_param_t* hsb, hsa_param_t* hsa, ale_data_t *ale );
enum MODEL_ACTION_VALUE modelLayer4Switching( hsb_param_t* hsb, hsa_param_t* hsa ,uint8, ale_data_t *ale);
enum MODEL_ACTION_VALUE
{
/* 0*/ MACT_FORWARD = 0,
/* 1*/ MACT_L3ROUTING,
/* 2*/ MACT_TOCPU,
/* 3*/ MACT_DROP,
};
enum SERVERP_PROTO_VALUE
{
SERVERP_INVALID=0,
SERVERP_PROTTCP,
SERVERP_PROTUDP,
SERVERP_BOTH,
};
enum HSA_PPPOE_INFO
{
HSA_PPPOE_INTACT,
HSA_PPPOE_TAGGING,
HSA_PPPOE_REMOVE_TAG,
HSA_PPPOE_MODIFY,
};
enum NEXTHOPALGO
{
ALGO_RR_BASE,
ALGO_SESSION_BASE,
ALGO_SOURCE_BASE,
};
enum MODEL_ACTION_VALUE modelMatchInternalServerPort( hsb_param_t* hsb, hsa_param_t* hsa, ale_data_t *ale);
enum MODEL_ACTION_VALUE modelMatchExternalServerPort( hsb_param_t* hsb, hsa_param_t* hsa, ale_data_t *ale);
enum MODEL_RETURN_VALUE modelAlgCheck( hsb_param_t* hsb, hsa_param_t* hsa,int, ale_data_t *ale );
enum MODEL_BOOLEAN_VALUE modelIgnoreEgressCheck(void );
enum MODEL_RETURN_VALUE modelHandleNexthop( hsb_param_t* hsb, hsa_param_t* hsa, ale_data_t *ale );
enum MODEL_RETURN_VALUE modelHandleRedirect( hsb_param_t* hsb, hsa_param_t* hsa, ale_data_t *ale ,int idx);
int32 modelLayer3TTL(hsb_param_t*,hsa_param_t*);
#endif
|
INTEGER :: ids2,ide2, jds2,jde2, kds2,kde2
REAL, DIMENSION( CHUNK , kte ) :: t_,q_,p_,delz_,den_
REAL, DIMENSION( CHUNK , kte, 2 ) :: qci_, qrs_
REAL, DIMENSION( CHUNK ) :: rain_,rainncv_,sr_,snow_,snowncv_
INTEGER :: i,j,k
INTEGER :: ii,ic,ip
INTEGER :: iii
INTEGER :: ntds
INTEGER, EXTERNAL :: omp_get_max_threads
|
/*
* "High Precision Event Timer" based timekeeping.
*
* Copyright (c) 1991,1992,1995 Linus Torvalds
* Copyright (c) 1994 Alan Modra
* Copyright (c) 1995 Markus Kuhn
* Copyright (c) 1996 Ingo Molnar
* Copyright (c) 1998 Andrea Arcangeli
* Copyright (c) 2002,2006 Vojtech Pavlik
* Copyright (c) 2003 Andi Kleen
* RTC support code taken from arch/i386/kernel/timers/time_hpet.c
*/
#include <linux/clockchips.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/mca.h>
#include <linux/nmi.h>
#include <asm/i8253.h>
#include <asm/hpet.h>
#include <asm/vgtod.h>
#include <asm/time.h>
#include <asm/timer.h>
volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
unsigned long profile_pc(struct pt_regs *regs)
{
unsigned long pc = instruction_pointer(regs);
/* Assume the lock function has either no stack frame or a copy
of flags from PUSHF
Eflags always has bits 22 and up cleared unlike kernel addresses. */
if (!user_mode_vm(regs) && in_lock_functions(pc)) {
#ifdef CONFIG_FRAME_POINTER
return *(unsigned long *)(regs->bp + sizeof(long));
#else
unsigned long *sp = (unsigned long *)regs->sp;
if (sp[0] >> 22)
return sp[0];
if (sp[1] >> 22)
return sp[1];
#endif
}
return pc;
}
EXPORT_SYMBOL(profile_pc);
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
inc_irq_stat(irq0_irqs);
global_clock_event->event_handler(global_clock_event);
#ifdef CONFIG_MCA
if (MCA_bus) {
u8 irq_v = inb_p(0x61); /* read the current state */
outb_p(irq_v|0x80, 0x61); /* reset the IRQ */
}
#endif
return IRQ_HANDLED;
}
/* calibrate_cpu is used on systems with fixed rate TSCs to determine
* processor frequency */
#define TICK_COUNT 100000000
unsigned long __init calibrate_cpu(void)
{
int tsc_start, tsc_now;
int i, no_ctr_free;
unsigned long evntsel3 = 0, pmc3 = 0, pmc_now = 0;
unsigned long flags;
for (i = 0; i < 4; i++)
if (avail_to_resrv_perfctr_nmi_bit(i))
break;
no_ctr_free = (i == 4);
if (no_ctr_free) {
WARN(1, KERN_WARNING "Warning: AMD perfctrs busy ... "
"cpu_khz value may be incorrect.\n");
i = 3;
rdmsrl(MSR_K7_EVNTSEL3, evntsel3);
wrmsrl(MSR_K7_EVNTSEL3, 0);
rdmsrl(MSR_K7_PERFCTR3, pmc3);
} else {
reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i);
reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
}
local_irq_save(flags);
/* start measuring cycles, incrementing from 0 */
wrmsrl(MSR_K7_PERFCTR0 + i, 0);
wrmsrl(MSR_K7_EVNTSEL0 + i, 1 << 22 | 3 << 16 | 0x76);
rdtscl(tsc_start);
do {
rdmsrl(MSR_K7_PERFCTR0 + i, pmc_now);
tsc_now = get_cycles();
} while ((tsc_now - tsc_start) < TICK_COUNT);
local_irq_restore(flags);
if (no_ctr_free) {
wrmsrl(MSR_K7_EVNTSEL3, 0);
wrmsrl(MSR_K7_PERFCTR3, pmc3);
wrmsrl(MSR_K7_EVNTSEL3, evntsel3);
} else {
release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
}
return pmc_now * tsc_khz / (tsc_now - tsc_start);
}
static struct irqaction irq0 = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING,
.mask = CPU_MASK_NONE,
.name = "timer"
};
void __init hpet_time_init(void)
{
if (!hpet_enable())
setup_pit_timer();
irq0.mask = cpumask_of_cpu(0);
setup_irq(0, &irq0);
}
void __init time_init(void)
{
tsc_init();
late_time_init = choose_time_init();
}
|
/**
******************************************************************************
* @file bsp_usart1.c
* @author fire
* @version V1.0
* @date 2013-xx-xx
* @brief usartÓ¦ÓÃbsp(DMA ·¢ËÍ)
******************************************************************************
* @attention
*
* ʵÑéÆ½Ì¨:Ò°»ð iSO STM32 ¿ª·¢°å
* ÂÛ̳ :http://www.chuxue123.com
* ÌÔ±¦ :http://firestm32.taobao.com
*
******************************************************************************
*/
#include "bsp_usart1.h"
uint8_t SendBuff[SENDBUFF_SIZE];
/**
* @brief USART1 GPIO ÅäÖÃ,¹¤×÷ģʽÅäÖá£115200 8-N-1
* @param ÎÞ
* @retval ÎÞ
*/
void USART1_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
/* config USART1 clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE);
/* USART1 GPIO config */
/* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* USART1 mode config */
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
USART_Cmd(USART1, ENABLE);
}
/**
* @brief USART1 TX DMA ÅäÖã¬ÄÚ´æµ½ÍâÉè(USART1->DR)
* @param ÎÞ
* @retval ÎÞ
*/
void USART1_DMA_Config(void)
{
DMA_InitTypeDef DMA_InitStructure;
/*¿ªÆôDMAʱÖÓ*/
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
/*ÉèÖÃDMAÔ´£º´®¿ÚÊý¾Ý¼Ä´æÆ÷µØÖ·*/
DMA_InitStructure.DMA_PeripheralBaseAddr = USART1_DR_Base;
/*ÄÚ´æµØÖ·(Òª´«ÊäµÄ±äÁ¿µÄÖ¸Õë)*/
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)SendBuff;
/*·½Ïò£º´ÓÄÚ´æµ½ÍâÉè*/
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
/*´«Êä´óСDMA_BufferSize=SENDBUFF_SIZE*/
DMA_InitStructure.DMA_BufferSize = SENDBUFF_SIZE;
/*ÍâÉèµØÖ·²»Ôö*/
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
/*ÄÚ´æµØÖ·×ÔÔö*/
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
/*ÍâÉèÊý¾Ýµ¥Î»*/
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
/*ÄÚ´æÊý¾Ýµ¥Î» 8bit*/
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
/*DMAģʽ£º²»¶ÏÑ»·*/
//DMA_InitStructure.DMA_Mode = DMA_Mode_Normal ;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
/*ÓÅÏȼ¶£ºÖÐ*/
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;
/*½ûÖ¹ÄÚ´æµ½ÄÚ´æµÄ´«Êä */
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
/*ÅäÖÃDMA1µÄ4ͨµÀ*/
DMA_Init(DMA1_Channel4, &DMA_InitStructure);
/*ʹÄÜDMA*/
DMA_Cmd (DMA1_Channel4,ENABLE);
//DMA_ITConfig(DMA1_Channel4,DMA_IT_TC,ENABLE); //ÅäÖÃDMA·¢ËÍÍê³Éºó²úÉúÖжÏ
}
/// ÖØ¶¨Ïòc¿âº¯Êýprintfµ½USART1
int fputc(int ch, FILE *f)
{
/* ·¢ËÍÒ»¸ö×Ö½ÚÊý¾Ýµ½USART1 */
USART_SendData(USART1, (uint8_t) ch);
/* µÈ´ý·¢ËÍÍê±Ï */
while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
return (ch);
}
/// ÖØ¶¨Ïòc¿âº¯Êýscanfµ½USART1
int fgetc(FILE *f)
{
/* µÈ´ý´®¿Ú1ÊäÈëÊý¾Ý */
while (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET);
return (int)USART_ReceiveData(USART1);
}
/*********************************************END OF FILE**********************/
|
/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef INCLUDED_SELF
# define INCLUDED_SELF
# include <pthread_cond_signal.c>
#else
# include <pthread.h>
# include <pthreadP.h>
# include <internaltypes.h>
# include <shlib-compat.h>
int
__pthread_cond_signal (pthread_cond_t *cond)
{
cond_compat_check_and_clear (cond);
return __pthread_cond_signal_internal (cond);
}
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2);
# undef versioned_symbol
# define versioned_symbol(lib, local, symbol, version)
# undef __pthread_cond_signal
# define __pthread_cond_signal __pthread_cond_signal_internal
# include_next <pthread_cond_signal.c>
#endif
|
// cart_tip.h
//
// Custom ToolTip for RDLibrary's Cart List
//
// (C) Copyright 2009,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef CART_TIP_H
#define CART_TIP_H
#include <qtooltip.h>
class CartTip : public QToolTip
{
public:
CartTip(QWidget *widget,QToolTipGroup *group=0);
void setCartNumber(const QRect &item_rect,unsigned cartnum);
protected:
void maybeTip(const QPoint &pt);
private:
unsigned tip_cart_number;
QRect tip_item_rect;
QString tip_notes;
};
#endif // CART_TIP_H
|
/*
* Copyright (C) 1998 Janne Löf <jlof@mail.student.oulu.fi>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef LW_H
#define LW_H
#include <glib.h>
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#include <GL/gl.h>
#define LW_MAX_POINTS 200
#define LW_MAX_NAME_LEN 500
typedef struct {
char name[LW_MAX_NAME_LEN];
GLfloat r,g,b;
} lwMaterial;
typedef struct {
int material; /* material of this face */
int index_cnt; /* number of vertices */
int *index; /* index to vertex */
float *texcoord; /* u,v texture coordinates */
} lwFace;
typedef struct {
int face_cnt;
lwFace *face;
int material_cnt;
lwMaterial *material;
int vertex_cnt;
GLfloat *vertex;
} lwObject;
gint lw_is_lwobject(const char *lw_file);
lwObject *lw_object_read(const char *lw_file);
void lw_object_free( lwObject *lw_object);
void lw_object_show(const lwObject *lw_object);
GLfloat lw_object_radius(const lwObject *lw_object);
void lw_object_scale (lwObject *lw_object, GLfloat scale);
#endif /* LW_H */
|
#ifndef __EVENT_ANNOTATION_GET_DRAWN_IN_WINDOW_H__
#define __EVENT_ANNOTATION_GET_DRAWN_IN_WINDOW_H__
/*LICENSE_START*/
/*
* Copyright (C) 2016 Washington University School of Medicine
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*LICENSE_END*/
#include "Event.h"
namespace caret {
class Annotation;
class EventAnnotationGetDrawnInWindow : public Event {
public:
EventAnnotationGetDrawnInWindow(const int32_t windowIndex);
virtual ~EventAnnotationGetDrawnInWindow();
int32_t getWindowIndex() const;
void addAnnotations(const std::vector<Annotation*>& annotations);
void getAnnotations(std::vector<Annotation*>& annotationsOut) const;
// ADD_NEW_METHODS_HERE
private:
EventAnnotationGetDrawnInWindow(const EventAnnotationGetDrawnInWindow&);
EventAnnotationGetDrawnInWindow& operator=(const EventAnnotationGetDrawnInWindow&);
const int32_t m_windowIndex;
std::vector<Annotation*> m_annotations;
// ADD_NEW_MEMBERS_HERE
};
#ifdef __EVENT_ANNOTATION_GET_DRAWN_IN_WINDOW_DECLARE__
// <PLACE DECLARATIONS OF STATIC MEMBERS HERE>
#endif // __EVENT_ANNOTATION_GET_DRAWN_IN_WINDOW_DECLARE__
} // namespace
#endif //__EVENT_ANNOTATION_GET_DRAWN_IN_WINDOW_H__
|
/*
* compiler/back-ends/c-gen/type-info.h - fills in c type information
*
* Copyright (C) 1991, 1992 Michael Sample
* and the University of British Columbia
*
* 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.
*
* $Header: /usr/app/odstb/CVS/snacc/compiler/back-ends/c-gen/type-info.h,v 1.3 1995/07/25 18:47:46 rj Exp $
* $Log: type-info.h,v $
* Revision 1.3 1995/07/25 18:47:46 rj
* changed `_' to `-' in file names.
*
* Revision 1.2 1994/10/08 03:48:20 rj
* since i was still irritated by cpp standing for c++ and not the C preprocessor, i renamed them to cxx (which is one known suffix for C++ source files). since the standard #define is __cplusplus, cplusplus would have been the more obvious choice, but it is a little too long.
*
* Revision 1.1 1994/08/28 09:48:43 rj
* first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
*
*/
/*
typedef struct CNamedElmt
{
struct CNamedElmt *next;
int value;
char *name;
} CNamedElmt;
typedef struct CTypeInfo
{
CTypeId cTypeId;
char *cFieldName;
char *cTypeName;
int isPtr;
int isEndCType;
CNamedElmt *cNamedElmts;
int choiceIdValue;
char *choiceIdSymbol;
char *choiceIdEnumName;
char *choiceIdEnumFieldName;
char *printRoutineName;
char *encodeRoutineName;
char *decodeRoutineName;
} CTypeInfo;
*/
/*
* allows upto 9999 unamed fields of the same type in a single structure
* or 9999 values (diff asn1 scopes -> global c scope) with same name
*/
/*
#define MAX_C_FIELD_NAME_DIGITS 4
#define MAX_C_VALUE_NAME_DIGITS 4
#define MAX_C_TYPE_NAME_DIGITS 4
#define MAX_C_ROUTINE_NAME_DIGITS 4
*/
void PrintCTypeInfo PROTO ((FILE *f, Type *t));
void FillCTypeInfo PROTO ((CRules *r, ModuleList *m));
|
/************************************************************************
This software is part of React, a control engine
Copyright (C) 2005,2006 Donald Wayne Carr
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
#include <sys/time.h>
class timeaccum_t
{
private:
struct timeval tv_start;
struct timeval tv_total;
int count;
public:
static void enable(bool v);
static bool is_enabled(void);
timeaccum_t(void);
void start(void);
void stop(void);
double get_total(void);
long get_count(void) {return count;};
double get_average(void);
void print(int i);
};
class timejitter_t
{
private:
static bool enabled;
bool first_time;
struct timeval last;
double *times;
int *n_occur;
int n_times;
int n_intervals;
void add_occur(double d);
void stdinit(double t[], int n);
public:
static void enable(bool v);
static bool is_enabled(void);
void print_results(void);
timejitter_t(double ti, double pct);
timejitter_t(double t[], int n);
void start_of_interval(void);
};
|
/*
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Default SOCKEV client implementation
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/netlink.h>
#include <linux/sockev.h>
#include <net/sock.h>
static int registration_status;
static struct sock *socknlmsgsk;
static void sockev_skmsg_recv(struct sk_buff *skb)
{
pr_debug("%s(): Got unsolicited request\n", __func__);
}
static struct netlink_kernel_cfg nlcfg = {
.input = sockev_skmsg_recv
};
static void _sockev_event(unsigned long event, __u8 *evstr, int buflen)
{
switch (event) {
case SOCKEV_SOCKET:
strlcpy(evstr, "SOCKEV_SOCKET", buflen);
break;
case SOCKEV_BIND:
strlcpy(evstr, "SOCKEV_BIND", buflen);
break;
case SOCKEV_LISTEN:
strlcpy(evstr, "SOCKEV_LISTEN", buflen);
break;
case SOCKEV_ACCEPT:
strlcpy(evstr, "SOCKEV_ACCEPT", buflen);
break;
case SOCKEV_CONNECT:
strlcpy(evstr, "SOCKEV_CONNECT", buflen);
break;
case SOCKEV_SHUTDOWN:
strlcpy(evstr, "SOCKEV_SHUTDOWN", buflen);
break;
default:
strlcpy(evstr, "UNKOWN", buflen);
}
}
static int sockev_client_cb(struct notifier_block *nb,
unsigned long event, void *data)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct sknlsockevmsg *smsg;
struct socket *sock;
sock = (struct socket *)data;
if (socknlmsgsk == 0)
goto done;
if ((socknlmsgsk == NULL) || (sock == NULL) || (sock->sk == NULL))
goto done;
if (sock->sk->sk_family != AF_INET || sock->sk->sk_family != AF_INET6)
goto done;
skb = nlmsg_new(sizeof(struct sknlsockevmsg), GFP_KERNEL);
if (skb == NULL)
goto done;
nlh = nlmsg_put(skb, 0, 0, event, sizeof(struct sknlsockevmsg), 0);
if (nlh == NULL) {
kfree_skb(skb);
goto done;
}
NETLINK_CB(skb).dst_group = SKNLGRP_SOCKEV;
smsg = nlmsg_data(nlh);
smsg->pid = current->pid;
_sockev_event(event, smsg->event, sizeof(smsg->event));
smsg->skfamily = sock->sk->sk_family;
smsg->skstate = sock->sk->sk_state;
smsg->skprotocol = sock->sk->sk_protocol;
smsg->sktype = sock->sk->sk_type;
smsg->skflags = sock->sk->sk_flags;
nlmsg_notify(socknlmsgsk, skb, 0, SKNLGRP_SOCKEV, 0, GFP_KERNEL);
done:
return 0;
}
static struct notifier_block sockev_notifier_client = {
.notifier_call = sockev_client_cb,
.next = 0,
.priority = 0
};
/* ***************** Startup/Shutdown *************************************** */
static int __init sockev_client_init(void)
{
int rc;
registration_status = 1;
rc = sockev_register_notify(&sockev_notifier_client);
if (rc != 0) {
registration_status = 0;
pr_err("%s(): Failed to register cb (%d)\n", __func__, rc);
}
socknlmsgsk = netlink_kernel_create(&init_net, NETLINK_SOCKEV, &nlcfg);
if (!socknlmsgsk) {
pr_err("%s(): Failed to initialize netlink socket\n", __func__);
if (registration_status)
sockev_unregister_notify(&sockev_notifier_client);
registration_status = 0;
}
return rc;
}
static void __exit sockev_client_exit(void)
{
if (registration_status)
sockev_unregister_notify(&sockev_notifier_client);
}
module_init(sockev_client_init)
module_exit(sockev_client_exit)
MODULE_LICENSE("GPL v2");
|
/* Formatted output to strings.
Copyright (C) 1999, 2002, 2005-2007, 2009-2010 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "unistdio.h"
#include <stdarg.h>
#define SNPRINTF u32_u32_snprintf
#define VSNPRINTF u32_u32_vsnprintf
#define FCHAR_T uint32_t
#define DCHAR_T uint32_t
#include "u-snprintf.h"
|
/*
* IEC958 conversion code
* Copyright (C) 2007 Andreas Öman
*
* 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/>.
*/
#define _XOPEN_SOURCE
#include <unistd.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "audio_iec958.h"
/*
* AC3 IEC958 encapsulation
*/
int
iec958_build_ac3frame(const uint8_t *src, size_t framesize, uint8_t *dst)
{
dst[0] = 0x72; dst[1] = 0xf8; dst[2] = 0x1f; dst[3] = 0x4e;
dst[4] = IEC958_PAYLOAD_AC3;
if(src == NULL) {
memset(dst + 5, 0, IEC958_AC3_FRAME_SIZE - 5);
} else {
dst[5] = src[5] & 7;
swab(src, dst + 8, framesize);
memset(dst + 8 + framesize, 0, IEC958_AC3_FRAME_SIZE - framesize - 8);
framesize *= 8;
dst[6] = framesize;
dst[7] = framesize >> 8;
}
return IEC958_AC3_FRAME_SIZE / 4; /* 2 channels, 16 bit / ch */
}
/*
* DTS IEC958 encapsulation
*/
static int
dts_decode_header(const uint8_t *src, int *rate, int *nblks)
{
int ftype, fsize;
uint32_t sync;
sync = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];
if(sync != 0x7ffe8001)
return -1;
ftype = src[4] >> 7;
*nblks = ((src[4] & 0x01) << 6 | (src[5] >> 2)) + 1;
fsize = ((src[5] & 0x03) << 12 | (src[6] << 4) | (src[7] >> 4)) + 1;
*rate = ( src[8] & 0x03) << 3 | ((src[9] >> 5) & 0x07);
if(ftype != 1 || fsize > 8192 || fsize < 96)
return -1;
if(*nblks != 8 && *nblks != 16 && *nblks != 32 && *nblks != 64 &&
*nblks != 128 && ftype == 1)
return -1;
return fsize;
}
int
iec958_build_dtsframe(const uint8_t *src, size_t srclen, uint8_t *dst)
{
int nblks, fsize, rate, burst_len, nr_samples;
uint8_t *dst0 = dst;
while(srclen > 0) {
if((fsize = dts_decode_header(src, &rate, &nblks)) < 0)
return 0;
burst_len = fsize * 8;
nr_samples = nblks * 32;
*dst++ = 0x72; *dst++ = 0xf8; *dst++ = 0x1f; *dst++ = 0x4e;
switch(nr_samples) {
case 512:
*dst++ = IEC958_PAYLOAD_DTS_1;
break;
case 1024:
*dst++ = IEC958_PAYLOAD_DTS_2;
break;
case 2048:
*dst++ = IEC958_PAYLOAD_DTS_3;
break;
default:
return 0;
}
*dst++ = 0;
*dst++ = burst_len;
*dst++ = burst_len >> 8;
swab(src, dst, fsize);
if(fsize & 1)
dst[fsize] = src[fsize];
memset(dst + fsize, 0, nr_samples * 4 - fsize);
dst += nr_samples * 4 - 8;
srclen -= fsize;
src += fsize;
}
return (dst - dst0) / 4;
}
|
/* Copyright (C) 2007-2014 Avencall
*
* XiVO Client 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, with a Section 7 Additional
* Permission as follows:
* This notice constitutes a grant of such permission as is necessary
* to combine or link this software, or a modified version of it, with
* the OpenSSL project's "OpenSSL" library, or a derivative work of it,
* and to copy, modify, and distribute the resulting work. This is an
* extension of the special permission given by Trolltech to link the
* Qt code with the OpenSSL library (see
* <http://doc.trolltech.com/4.4/gpl.html>). The OpenSSL library is
* licensed under a dual license: the OpenSSL License and the original
* SSLeay license.
*
* XiVO Client 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 XiVO Client. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AGENTSPANEL_H__
#define __AGENTSPANEL_H__
#include <xletlib/xletinterface.h>
#include <xletlib/xlet.h>
class QVBoxLayout;
class AgentsView;
class AgentsModel;
class XletAgents : public XLet
{
Q_OBJECT
public:
XletAgents(QWidget *parent);
private:
AgentsView * m_view;
AgentsModel * m_model;
};
class XLetAgentsPlugin : public QObject, XLetInterface
{
Q_OBJECT
Q_INTERFACES(XLetInterface)
Q_PLUGIN_METADATA(IID "com.avencall.Plugin.XLetInterface/1.2" FILE "xletagents.json")
public:
XLet *newXLetInstance(QWidget *parent=0);
};
#endif /* __AGENTSPANEL_H__ */
|
/*******************************************************************************
* File Name: SerDrv_RA.c
* Version 1.90
*
* Description:
* This file contains API to enable firmware control of a Pins component.
*
* Note:
*
********************************************************************************
* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#include "cytypes.h"
#include "SerDrv_RA.h"
/* APIs are not generated for P15[7:6] on PSoC 5 */
#if !(CY_PSOC5A &&\
SerDrv_RA__PORT == 15 && ((SerDrv_RA__MASK & 0xC0) != 0))
/*******************************************************************************
* Function Name: SerDrv_RA_Write
********************************************************************************
*
* Summary:
* Assign a new value to the digital port's data output register.
*
* Parameters:
* prtValue: The value to be assigned to the Digital Port.
*
* Return:
* None
*
*******************************************************************************/
void SerDrv_RA_Write(uint8 value)
{
uint8 staticBits = (SerDrv_RA_DR & (uint8)(~SerDrv_RA_MASK));
SerDrv_RA_DR = staticBits | ((uint8)(value << SerDrv_RA_SHIFT) & SerDrv_RA_MASK);
}
/*******************************************************************************
* Function Name: SerDrv_RA_SetDriveMode
********************************************************************************
*
* Summary:
* Change the drive mode on the pins of the port.
*
* Parameters:
* mode: Change the pins to this drive mode.
*
* Return:
* None
*
*******************************************************************************/
void SerDrv_RA_SetDriveMode(uint8 mode)
{
CyPins_SetPinDriveMode(SerDrv_RA_0, mode);
}
/*******************************************************************************
* Function Name: SerDrv_RA_Read
********************************************************************************
*
* Summary:
* Read the current value on the pins of the Digital Port in right justified
* form.
*
* Parameters:
* None
*
* Return:
* Returns the current value of the Digital Port as a right justified number
*
* Note:
* Macro SerDrv_RA_ReadPS calls this function.
*
*******************************************************************************/
uint8 SerDrv_RA_Read(void)
{
return (SerDrv_RA_PS & SerDrv_RA_MASK) >> SerDrv_RA_SHIFT;
}
/*******************************************************************************
* Function Name: SerDrv_RA_ReadDataReg
********************************************************************************
*
* Summary:
* Read the current value assigned to a Digital Port's data output register
*
* Parameters:
* None
*
* Return:
* Returns the current value assigned to the Digital Port's data output register
*
*******************************************************************************/
uint8 SerDrv_RA_ReadDataReg(void)
{
return (SerDrv_RA_DR & SerDrv_RA_MASK) >> SerDrv_RA_SHIFT;
}
/* If Interrupts Are Enabled for this Pins component */
#if defined(SerDrv_RA_INTSTAT)
/*******************************************************************************
* Function Name: SerDrv_RA_ClearInterrupt
********************************************************************************
* Summary:
* Clears any active interrupts attached to port and returns the value of the
* interrupt status register.
*
* Parameters:
* None
*
* Return:
* Returns the value of the interrupt status register
*
*******************************************************************************/
uint8 SerDrv_RA_ClearInterrupt(void)
{
return (SerDrv_RA_INTSTAT & SerDrv_RA_MASK) >> SerDrv_RA_SHIFT;
}
#endif /* If Interrupts Are Enabled for this Pins component */
#endif /* CY_PSOC5A... */
/* [] END OF FILE */
|
/********************************************************************************
* Project : FIRST Motor Controller
* File Name : AxisCamera.h
* Contributors : ELF
* Creation Date : August 12, 2008
* Revision History : Source code & revision history maintained at sourceforge.WPI.edu
* File Description : Globally defined values for the FRC Camera API
*
* API: Because nivision.h uses C++ style comments, any file including this
* must be a .cpp instead of .c.
*
*/
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#ifndef __AXISCAMERA_H__
#define __AXISCAMERA_H__
#include "nivision.h"
/** port for communicating with camera */
#define CAMERA_PORT 80
/** how old an image is before it's discarded */
#define CAMERA_IMAGE_STALE_TIME_SEC 2.0
/** time to wait for a new image in blocking call */
#define MAX_BLOCKING_TIME_SEC 0.5
/* Enumerated Types */
/** @brief Counters for camera metrics */
enum FrcvCameraMetric {CAM_STARTS, CAM_STOPS,
CAM_NUM_IMAGE, CAM_BUFFERS_WRITTEN, CAM_BLOCKING_COUNT,
CAM_SOCKET_OPEN, CAM_SOCKET_INIT_ATTEMPTS, CAM_BLOCKING_TIMEOUT,
CAM_GETIMAGE_SUCCESS, CAM_GETIMAGE_FAILURE,
CAM_STALE_IMAGE, CAM_GETIMAGE_BEFORE_INIT, CAM_GETIMAGE_BEFORE_AVAILABLE,
CAM_READ_JPEG_FAILURE, CAM_PID_SIGNAL_ERR,
CAM_BAD_IMAGE_SIZE, CAM_HEADER_ERROR};
#define CAM_NUM_METRICS 17
/** Private NI function needed to write to the VxWorks target */
IMAQ_FUNC int Priv_SetWriteFileAllowed(uint32_t enable);
/**
@brief Possible image sizes that you can set on the camera.
*/
enum ImageResolution { k640x480, k320x240, k160x120 };
/**
@brief Possible rotation values that you can set on the camera.
*/
enum ImageRotation { ROT_0 = 0, ROT_180 = 180 };
int StartCameraTask();
extern "C" {
/* Image Acquisition functions */
/* obtains an image from the camera server */
int GetImage(Image* cameraImage, double *timestamp);
int GetImageBlocking(Image* cameraImage, double *timestamp, double lastImageTimestamp);
/* obtains raw image string to send to PC */
int GetImageData(char** imageData, int* numBytes, double* currentImageTimestamp);
int GetImageDataBlocking(char** imageData, int* numBytes, double* timestamp, double lastImageTimestamp);
/* start the camera server */
void StartImageAcquisition();
void StopImageAcquisition();
void StartImageSignal(int taskId);
/* status & metrics */
int frcCameraInitialized();
int GetCameraMetric(FrcvCameraMetric metric);
/* camera configuration */
int ConfigureCamera(char *configString);
int GetCameraSetting(char *configString, char *cameraResponse);
int GetImageSetting(char *configString, char *cameraResponse);
/* camera task control */
int StartCameraTask(int frames, int compression, ImageResolution resolution, ImageRotation rotation);
int StopCameraTask();
}
#endif
|
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (2013) Alexander Stukowski
//
// This file is part of OVITO (Open Visualization Tool).
//
// OVITO 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.
//
// OVITO 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 __OVITO_OBJECT_REFERENCE_H
#define __OVITO_OBJECT_REFERENCE_H
#include <core/Core.h>
namespace Ovito { OVITO_BEGIN_INLINE_NAMESPACE(ObjectSystem)
/**
* \brief A smart pointer holding a reference to an OvitoObject.
*
* This smart pointer class takes care of incrementing and decrementing
* the reference counter of the object it is pointing to. As soon as no
* OORef pointer to an object instance is left, the object is automatically
* deleted.
*/
template<class T>
class OORef
{
private:
typedef OORef this_type;
public:
typedef T element_type;
/// Default constructor.
OORef() Q_DECL_NOTHROW : px(nullptr) {}
/// Initialization constructor.
OORef(T* p) : px(p) {
if(px) px->incrementReferenceCount();
}
/// Copy constructor.
OORef(const OORef& rhs) : px(rhs.get()) {
if(px) px->incrementReferenceCount();
}
/// Copy and conversion constructor.
template<class U>
OORef(const OORef<U>& rhs) : px(rhs.get()) {
if(px) px->incrementReferenceCount();
}
/// Move constructor.
OORef(OORef&& rhs) Q_DECL_NOTHROW : px(rhs.px) {
rhs.px = nullptr;
}
/// Destructor.
~OORef() {
if(px) px->decrementReferenceCount();
}
template<class U>
OORef& operator=(const OORef<U>& rhs) {
this_type(rhs).swap(*this);
return *this;
}
OORef& operator=(const OORef& rhs) {
this_type(rhs).swap(*this);
return *this;
}
OORef& operator=(OORef&& rhs) Q_DECL_NOTHROW {
this_type(static_cast<OORef&&>(rhs)).swap(*this);
return *this;
}
OORef& operator=(T* rhs) {
this_type(rhs).swap(*this);
return *this;
}
void reset() Q_DECL_NOTHROW {
this_type().swap(*this);
}
void reset(T* rhs) {
this_type(rhs).swap(*this);
}
inline T* get() const Q_DECL_NOTHROW {
return px;
}
inline operator T*() const Q_DECL_NOTHROW {
return px;
}
inline T& operator*() const {
OVITO_ASSERT(px != nullptr);
return *px;
}
inline T* operator->() const {
OVITO_ASSERT(px != nullptr);
return px;
}
inline void swap(OORef& rhs) Q_DECL_NOTHROW {
std::swap(px,rhs.px);
}
private:
T* px;
};
template<class T, class U> inline bool operator==(const OORef<T>& a, const OORef<U>& b)
{
return a.get() == b.get();
}
template<class T, class U> inline bool operator!=(const OORef<T>& a, const OORef<U>& b)
{
return a.get() != b.get();
}
template<class T, class U> inline bool operator==(const OORef<T>& a, U* b)
{
return a.get() == b;
}
template<class T, class U> inline bool operator!=(const OORef<T>& a, U* b)
{
return a.get() != b;
}
template<class T, class U> inline bool operator==(T* a, const OORef<U>& b)
{
return a == b.get();
}
template<class T, class U> inline bool operator!=(T* a, const OORef<U>& b)
{
return a != b.get();
}
template<class T> inline bool operator==(const OORef<T>& p, std::nullptr_t) Q_DECL_NOTHROW
{
return p.get() == nullptr;
}
template<class T> inline bool operator==(std::nullptr_t, const OORef<T>& p) Q_DECL_NOTHROW
{
return p.get() == nullptr;
}
template<class T> inline bool operator!=(const OORef<T>& p, std::nullptr_t) Q_DECL_NOTHROW
{
return p.get() != nullptr;
}
template<class T> inline bool operator!=(std::nullptr_t, const OORef<T>& p) Q_DECL_NOTHROW
{
return p.get() != nullptr;
}
template<class T> inline bool operator<(const OORef<T>& a, const OORef<T>& b)
{
return std::less<T*>()(a.get(), b.get());
}
template<class T> void swap(OORef<T>& lhs, OORef<T>& rhs) Q_DECL_NOTHROW
{
lhs.swap(rhs);
}
template<class T> T* get_pointer(const OORef<T>& p)
{
return p.get();
}
template<class T, class U> OORef<T> static_pointer_cast(const OORef<U>& p)
{
return static_cast<T*>(p.get());
}
template<class T, class U> OORef<T> const_pointer_cast(const OORef<U>& p)
{
return const_cast<T*>(p.get());
}
template<class T, class U> OORef<T> dynamic_pointer_cast(const OORef<U>& p)
{
return qobject_cast<T*>(p.get());
}
template<class T> QDebug operator<<(QDebug debug, const OORef<T>& p)
{
return debug << p.get();
}
OVITO_END_INLINE_NAMESPACE
} // End of namespace
#endif // __OVITO_OBJECT_REFERENCE_H
|
/*
Copyright (C) 2010 Srivats P.
This file is part of "Ostinato"
This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 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 _LLDP_TLV_H
#define _LLDP_TLV_H
#include "lldp_tlv.pb.h"
#include "ui_lldp_tlv.h"
#include "abstractprotocol.h"
/*
Lldp_tlv Protocol Frame Format -
+----------+---------+
| User | Zero |
| Lldp_tlv | Padding |
+----------+---------+
*/
class Lldp_tlvConfigForm : public QWidget, public Ui::Lldp_tlv
{
Q_OBJECT
public:
Lldp_tlvConfigForm(QWidget *parent = 0);
private slots:
void on_hexEdit_overwriteModeChanged(bool isOverwriteMode);
};
class Lldp_tlvProtocol : public AbstractProtocol
{
public:
Lldp_tlvProtocol(StreamBase *stream, AbstractProtocol *parent = 0);
virtual ~Lldp_tlvProtocol();
static AbstractProtocol* createInstance(StreamBase *stream,
AbstractProtocol *parent = 0);
virtual quint32 protocolNumber() const;
virtual void protoDataCopyInto(OstProto::Protocol &protocol) const;
virtual void protoDataCopyFrom(const OstProto::Protocol &protocol);
virtual QString name() const;
virtual QString shortName() const;
virtual ProtocolIdType protocolIdType() const;
virtual quint32 protocolId(ProtocolIdType type) const;
virtual int fieldCount() const;
virtual AbstractProtocol::FieldFlags fieldFlags(int index) const;
virtual QVariant fieldData(int index, FieldAttrib attrib,
int streamIndex = 0) const;
virtual bool setFieldData(int index, const QVariant &value,
FieldAttrib attrib = FieldValue);
virtual int protocolFrameSize(int streamIndex = 0) const;
virtual QWidget* configWidget();
virtual void loadConfigWidget();
virtual void storeConfigWidget();
private:
OstProto::Lldp_tlv data;
Lldp_tlvConfigForm *configForm;
enum lldp_tlvfield
{
// Frame Fields
lldp_tlv_id =0,
lldp_tlv_len,
lldp_tlv_content,
// Meta Fields
lldp_tlv_fieldCount
};
};
#endif
|
/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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/>. */
#define USE_LONG_DOUBLE
#include "printf-frexp.c"
|
#if defined(STM32F0)
# include "../stm32/f0/vector_nvic.c"
#elif defined(STM32F1)
# include "../stm32/f1/vector_nvic.c"
#elif defined(STM32F2)
# include "../stm32/f2/vector_nvic.c"
#elif defined(STM32F3)
# include "../stm32/f3/vector_nvic.c"
#elif defined(STM32F4)
# include "../stm32/f4/vector_nvic.c"
#elif defined(STM32F7)
# include "../stm32/f7/vector_nvic.c"
#elif defined(STM32L0)
# include "../stm32/l0/vector_nvic.c"
#elif defined(STM32L1)
# include "../stm32/l1/vector_nvic.c"
#elif defined(STM32L4)
# include "../stm32/l4/vector_nvic.c"
#elif defined(EFM32TG)
# include "../efm32/tg/vector_nvic.c"
#elif defined(EFM32G)
# include "../efm32/g/vector_nvic.c"
#elif defined(EFM32LG)
# include "../efm32/lg/vector_nvic.c"
#elif defined(EFM32GG)
# include "../efm32/gg/vector_nvic.c"
#elif defined(LPC13XX)
# include "../lpc13xx/vector_nvic.c"
#elif defined(LPC17XX)
# include "../lpc17xx/vector_nvic.c"
#elif defined(LPC43XX_M4)
# include "../lpc43xx/m4/vector_nvic.c"
#elif defined(LPC43XX_M0)
# include "../lpc43xx/m0/vector_nvic.c"
#elif defined(SAM3A)
# include "../sam/3a/vector_nvic.c"
#elif defined(SAM3N)
# include "../sam/3n/vector_nvic.c"
#elif defined(SAM3S)
# include "../sam/3s/vector_nvic.c"
#elif defined(SAM3U)
# include "../sam/3u/vector_nvic.c"
#elif defined(SAM3X)
# include "../sam/3x/vector_nvic.c"
#elif defined(VF6XX)
# include "../vf6xx/vector_nvic.c"
#elif defined(LM3S) || defined(LM4F)
/* Yes, we use the same interrupt table for both LM3S and LM4F */
# include "../lm3s/vector_nvic.c"
#else
# warning "no interrupts defined for chipset;"\
"not allocating space in the vector table"
#define IRQ_HANDLERS
#endif
|
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <dispatch/dispatch.h>
#include <libkern/OSThermalNotification.h>
#include <notify.h>
#include <TargetConditionals.h>
#define OSThermalPressureLevelName "com.apple.system.thermalpressurelevel"
const char * const kOSThermalNotificationPressureLevelName = OSThermalPressureLevelName;
#if TARGET_OS_IPHONE
#define OSThermalAlert "com.apple.system.thermalalert"
#define OSThermalDecision "com.apple.system.thermaldecision"
#define OSThermalStatusName "com.apple.system.thermalstatus"
const char * const kOSThermalNotificationAlert = OSThermalAlert;
const char * const kOSThermalNotificationDecision = OSThermalDecision;
const char * const kOSThermalNotificationName = OSThermalStatusName;
static const char * const kOSThermalMitigationNames[kOSThermalMitigationCount] = {
OSThermalStatusName,
"com.apple.system.thermalmitigation.70percenttorch",
"com.apple.system.thermalmitigation.70percentbacklight",
"com.apple.system.thermalmitigation.50percenttorch",
"com.apple.system.thermalmitigation.50percentbacklight",
"com.apple.system.thermalmitigation.disabletorch",
"com.apple.system.thermalmitigation.25percentbacklight",
"com.apple.system.thermalmitigation.disablemapshalo",
"com.apple.system.thermalmitigation.appterminate",
"com.apple.system.thermalmitigation.devicerestart",
"com.apple.system.thermalmitigation.thermaltableready"
};
static int tokens[kOSThermalMitigationCount];
static dispatch_once_t predicates[kOSThermalMitigationCount];
static bool thermalLevelsReady = false;
OSThermalNotificationLevel _OSThermalNotificationLevelForBehavior(int behavior)
{
uint64_t val = OSThermalNotificationLevelAny;
if (behavior >= 0 && behavior < kOSThermalMitigationCount) {
dispatch_once(&predicates[behavior], ^{
(void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
});
(void)notify_get_state(tokens[behavior], &val);
}
return (OSThermalNotificationLevel)val;
}
void _OSThermalNotificationSetLevelForBehavior(int level, int behavior)
{
uint64_t val = (uint64_t)level;
if (behavior >= 0 && behavior < kOSThermalMitigationCount) {
dispatch_once(&predicates[behavior], ^{
(void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
});
(void)notify_set_state(tokens[behavior], val);
// Note:
// - We are ready when we program in the appterminate value.
// - Assumes that user programs kOSThermalMitigationNone level less than
// kOSThermalMitigationAppTerminate & kOSThermalMitigationDeviceRestart
if (behavior == kOSThermalMitigationAppTerminate) {
dispatch_once(&predicates[kOSThermalMitigationThermalTableReady], ^{
(void)notify_register_check(kOSThermalMitigationNames[kOSThermalMitigationThermalTableReady], &tokens[kOSThermalMitigationThermalTableReady]);
});
(void)notify_set_state(tokens[kOSThermalMitigationThermalTableReady], kOSThermalMitigationCount);
}
}
}
OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void)
{
if (thermalLevelsReady) {
return _OSThermalNotificationLevelForBehavior(kOSThermalMitigationNone);
}
uint64_t tableReady = 0;
dispatch_once(&predicates[kOSThermalMitigationThermalTableReady], ^{
(void)notify_register_check(kOSThermalMitigationNames[kOSThermalMitigationThermalTableReady], &tokens[kOSThermalMitigationThermalTableReady]);
});
(void)notify_get_state(tokens[kOSThermalMitigationThermalTableReady], &tableReady);
// If we are ready then optimize this so we don't call dispatch everytime.
if (tableReady == kOSThermalMitigationCount) {
thermalLevelsReady = true;
return _OSThermalNotificationLevelForBehavior(kOSThermalMitigationNone);
}
else {
// Allow reset so we can dynamically change the table without thermal trap screen appearing.
thermalLevelsReady = false;
}
// Not ready returns -1, which should not be equal or greater than any other thermal state.
return OSThermalNotificationLevelAny;
}
#endif // TARGET_OS_IPHONE
|
/* Test file for mpfr_log2.
Copyright 2001-2002, 2004, 2006-2015 Free Software Foundation, Inc.
Contributed by the AriC and Caramel projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR 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.
The GNU MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_log2
#define TEST_RANDOM_POS 8
#include "tgeneric.c"
static void
special (void)
{
mpfr_t x;
int inex;
mpfr_init (x);
mpfr_set_nan (x);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, -1);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_inf (x, 1);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
mpfr_set_ui (x, 0, MPFR_RNDN);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
mpfr_set_ui (x, 0, MPFR_RNDN);
mpfr_neg (x, x, MPFR_RNDN);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
mpfr_set_si (x, -1, MPFR_RNDN);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
mpfr_set_si (x, 1, MPFR_RNDN);
inex = mpfr_log2 (x, x, MPFR_RNDN);
MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x) && inex == 0);
mpfr_clear (x);
}
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
special ();
test_generic (2, 100, 30);
data_check ("data/log2", mpfr_log2, "mpfr_log2");
tests_end_mpfr ();
return 0;
}
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk 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.
*
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_CONTROL_H
#define DATABASE_CONTROL_H
#include "dynamic/DynamicControl.h"
#include <QTimer>
namespace Tomahawk
{
class DatabaseControl : public DynamicControl
{
Q_OBJECT
public:
virtual QWidget* inputField();
virtual QWidget* matchSelector();
virtual QString input() const;
virtual QString match() const;
virtual QString matchString() const;
virtual QString summary() const;
virtual void setInput(const QString& input);
virtual void setMatch(const QString& match);
/// DO NOT USE IF YOU ARE NOT A DBCMD
DatabaseControl( const QString& type, const QStringList& typeSelectors, QObject* parent = 0 );
DatabaseControl( const QString& sql, const QString& summary, const QStringList& typeSelectors, QObject* parent = 0 );
QString sql() const;
public slots:
virtual void setSelectedType ( const QString& type );
private slots:
void updateData();
void editingFinished();
void editTimerFired();
private:
void updateWidgets();
void updateWidgetsFromData();
// utility
void calculateSummary();
QWeakPointer< QWidget > m_input;
QWeakPointer< QWidget > m_match;
QString m_matchData;
QString m_matchString;
QString m_summary;
QTimer m_editingTimer;
QTimer m_delayedEditTimer;
// SQL control
QString m_sql;
QString m_sqlSummary;
};
};
#endif
|
/*
* Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/>
* Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2011-2012 Darkpeninsula Project <http://www.darkpeninsula.eu/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DATABASEENV_H
#define DATABASEENV_H
#include "Common.h"
#include "Errors.h"
#include "Log.h"
#include "Field.h"
#include "QueryResult.h"
#include "MySQLThreading.h"
#include "Transaction.h"
#define _LIKE_ "LIKE"
#define _TABLE_SIM_ "`"
#define _CONCAT3_(A, B, C) "CONCAT( " A " , " B " , " C " )"
#define _OFFSET_ "LIMIT %d, 1"
#include "Implementation/LoginDatabase.h"
#include "Implementation/CharacterDatabase.h"
#include "Implementation/WorldDatabase.h"
#include "Implementation/ExtraDatabase.h"
extern WorldDatabaseWorkerPool WorldDatabase;
extern CharacterDatabaseWorkerPool CharacterDatabase;
extern LoginDatabaseWorkerPool LoginDatabase;
extern ExtraDatabaseWorkerPool ExtraDatabase;
#endif |
// Napisać makrodefinicję PETLA, której wywołanie
// PETLA(komenda1, warunek, komenda2)
// działa tak, jak na schemacie obok (pętla while ,,zrośnięta'' z pętlą do...while).
// Na przykład wywołanie:
// a=0; b=0; i=0;
// PETLA(a++, i<5, b++; i++);
// powinno przypisywać zmiennej a wartość 6, a zmiennej b wartość 5.
#include <stdio.h>
#define PETLA(komenda1, warunek, komenda2) komenda1; while(warunek){komenda2; komenda1;}
int main()
{
int a=0, b=0, i=0;
PETLA(a++, i<5, b++; i++);
printf("%i\n", a);
printf("%i\n", b);
return 0;
}
|
#ifndef _LINUX_VT_H
#define _LINUX_VT_H
/*
* These constants are also useful for user-level apps (e.g., VC
* resizing).
*/
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
/* Note: the ioctl VT_GETSTATE does not work for
consoles 16 and higher (since it returns a short) */
/* 0x56 is 'V', to avoid collision with termios and kd */
#define VT_OPENQRY 0x5600 /* find available vt */
struct vt_mode {
char mode; /* vt mode */
char waitv; /* if set, hang on writes if not active */
short relsig; /* signal to raise on release req */
short acqsig; /* signal to raise on acquisition */
short frsig; /* unused (set to 0) */
};
#define VT_GETMODE 0x5601 /* get mode of active vt */
#define VT_SETMODE 0x5602 /* set mode of active vt */
#define VT_AUTO 0x00 /* auto vt switching */
#define VT_PROCESS 0x01 /* process controls switching */
#define VT_ACKACQ 0x02 /* acknowledge switch */
struct vt_stat {
unsigned short v_active; /* active vt */
unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bitmask */
};
#define VT_GETSTATE 0x5603 /* get global vt state info */
#define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */
#define VT_RELDISP 0x5605 /* release display */
#define VT_ACTIVATE 0x5606 /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */
#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
struct vt_sizes {
unsigned short v_rows; /* number of rows */
unsigned short v_cols; /* number of columns */
unsigned short v_scrollsize; /* number of lines of scrollback */
};
#define VT_RESIZE 0x5609 /* set kernel's idea of screensize */
struct vt_consize {
unsigned short v_rows; /* number of rows */
unsigned short v_cols; /* number of columns */
unsigned short v_vlin; /* number of pixel rows on screen */
unsigned short v_clin; /* number of pixel rows per character */
unsigned short v_vcol; /* number of pixel columns on screen */
unsigned short v_ccol; /* number of pixel columns per character */
};
#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
#define VT_LOCKSWITCH 0x560B /* disallow vt switching */
#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
struct vt_event {
unsigned int event;
#define VT_EVENT_SWITCH 0x0001 /* Console switch */
#define VT_EVENT_BLANK 0x0002 /* Screen blank */
#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
#define VT_EVENT_RESIZE 0x0008 /* Resize display */
#define VT_MAX_EVENT 0x000F
unsigned int oldev; /* Old console */
unsigned int newev; /* New console (if changing) */
unsigned int pad[4]; /* Padding for expansion */
};
#define VT_WAITEVENT 0x560E /* Wait for an event */
struct vt_setactivate {
unsigned int console;
struct vt_mode mode;
};
#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
#endif /* _LINUX_VT_H */
|
/*--------------------------------------------------------------------------
* LuaSec 1.0.2
*
* Copyright (C) 2006-2021 Bruno Silvestre
*
*--------------------------------------------------------------------------*/
#ifndef LSEC_COMPAT_H
#define LSEC_COMPAT_H
#include <openssl/ssl.h>
//------------------------------------------------------------------------------
#if defined(_WIN32)
#define LSEC_API __declspec(dllexport)
#else
#define LSEC_API extern
#endif
//------------------------------------------------------------------------------
#if (LUA_VERSION_NUM == 501)
#define luaL_testudata(L, ud, tname) lsec_testudata(L, ud, tname)
#define setfuncs(L, R) luaL_register(L, NULL, R)
#define lua_rawlen(L, i) lua_objlen(L, i)
#ifndef luaL_newlib
#define luaL_newlib(L, R) do { lua_newtable(L); luaL_register(L, NULL, R); } while(0)
#endif
#else
#define setfuncs(L, R) luaL_setfuncs(L, R, 0)
#endif
//------------------------------------------------------------------------------
#if (!defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x1010000fL))
#define LSEC_ENABLE_DANE
#endif
//------------------------------------------------------------------------------
#if !((defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2070000fL)) || (OPENSSL_VERSION_NUMBER < 0x1010000fL))
#define LSEC_API_OPENSSL_1_1_0
#endif
//------------------------------------------------------------------------------
#if !defined(LIBRESSL_VERSION_NUMBER) && ((OPENSSL_VERSION_NUMBER & 0xFFFFF000L) == 0x10101000L)
#define LSEC_OPENSSL_1_1_1
#endif
//------------------------------------------------------------------------------
#endif
|
// tu_timer.h -- by Thatcher Ulrich <tu@tulrich.com>
// This source code has been donated to the Public Domain. Do
// whatever you want with it.
// Utility/profiling timer.
#ifndef TU_TIMER_H
#define TU_TIMER_H
#include <time.h>
#include "base/tu_types.h"
namespace tu_timer
{
// General-purpose wall-clock timer. May not be hi-res enough
// for profiling.
exported_module void init_timer();
// milliseconds since we started playing.
exported_module Uint32 get_ticks();
// Sleep the current thread for the given number of
// milliseconds. Don't rely on the sleep period being very
// accurate.
exported_module void sleep(int milliseconds);
// Hi-res timer for CPU profiling.
// Return a hi-res timer value. Time 0 is arbitrary, so
// generally you want to call this at the start and end of an
// operation, and pass the difference to
// profile_ticks_to_seconds() to find out how long the
// operation took.
exported_module uint64 get_profile_ticks();
// Convert a hi-res ticks value into seconds.
exported_module double profile_ticks_to_seconds(uint64 profile_ticks);
exported_module double profile_ticks_to_milliseconds(uint64 ticks);
// Return the time as seconds elapsed since midnight, January 1, 1970.
Uint64 get_systime();
};
struct tu_datetime
{
enum part
{
YEAR, // year - 1900
FULLYEAR, // a four-digit number, such as 2000
MON,
MDAY, // day of a month
WDAY, // day of a week
HOUR,
MIN,
SEC
};
exported_module tu_datetime();
exported_module double get_time() const;
exported_module void set_time(double t);
exported_module int get(part part);
exported_module void set(part part, int val);
private:
time_t m_time;
};
#endif // TU_TIMER_H
// Local Variables:
// mode: C++
// c-basic-offset: 8
// tab-width: 8
// indent-tabs-mode: t
// End:
|
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_
#define CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
class IFX_SeekableReadStream;
class CPDF_Dictionary;
// Use the accessors below instead of directly accessing PDF_CharType.
extern const char PDF_CharType[256];
inline bool PDFCharIsWhitespace(uint8_t c) {
return PDF_CharType[c] == 'W';
}
inline bool PDFCharIsNumeric(uint8_t c) {
return PDF_CharType[c] == 'N';
}
inline bool PDFCharIsDelimiter(uint8_t c) {
return PDF_CharType[c] == 'D';
}
inline bool PDFCharIsOther(uint8_t c) {
return PDF_CharType[c] == 'R';
}
inline bool PDFCharIsLineEnding(uint8_t c) {
return c == '\r' || c == '\n';
}
int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile);
int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_
|
/*
HydraIRC
Copyright (C) 2002-2006 Dominic Clifton aka Hydra
HydraIRC limited-use source license
1) You can:
1.1) Use the source to create improvements and bug-fixes to send to the
author to be incorporated in the main program.
1.2) Use it for review/educational purposes.
2) You can NOT:
2.1) Use the source to create derivative works. (That is, you can't release
your own version of HydraIRC with your changes in it)
2.2) Compile your own version and sell it.
2.3) Distribute unmodified, modified source or compiled versions of HydraIRC
without first obtaining permission from the author. (I want one place
for people to come to get HydraIRC from)
2.4) Use any of the code or other part of HydraIRC in anything other than
HydraIRC.
3) All code submitted to the project:
3.1) Must not be covered by any license that conflicts with this license
(e.g. GPL code)
3.2) Will become the property of the author.
*/
// Prefs_LoggingPage.h : interface of the CLoggingPage class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
class CLoggingPage :
public CDialogImpl<CLoggingPage>,
public CDialogResize<CLoggingPage>,
public CPrefsPage
{
private:
CEdit m_LogRootFolderCtrl;
CEdit m_ServerLogFormatCtrl;
CEdit m_ChannelLogFormatCtrl;
CEdit m_QueryLogFormatCtrl;
CEdit m_DCCChatLogFormatCtrl;
CEdit m_LogFileViewerCtrl;
CButton m_EnableCtrl;
CButton m_CreateNetworkFolderCtrl;
CButton m_LogServerCtrl;
CButton m_LogChannelCtrl;
CButton m_LogQueryCtrl;
CButton m_LogDCCChatCtrl;
CButton m_ServerStripCodesCtrl;
CButton m_ChannelStripCodesCtrl;
CButton m_QueryStripCodesCtrl;
CButton m_DCCChatStripCodesCtrl;
public:
enum { IDD = IDD_PREFS_LOGGING };
BEGIN_MSG_MAP(CLoggingPage)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_HANDLER(IDC_LOGGING_LOGVIEWERBROWSE, BN_CLICKED, OnBnClickedLoggingLogviewerbrowse)
CHAIN_MSG_MAP(CDialogResize<CLoggingPage>)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CLoggingPage)
DLGRESIZE_CONTROL(IDC_LOGGING_LOGROOTFOLDER ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_SERVERLOGFORMAT ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_CHANNELLOGFORMAT ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_QUERYLOGFORMAT ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_DCCCHATLOGFORMAT ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_LOGVIEWER ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_LOGGING_LOGVIEWERBROWSE ,DLSZ_MOVE_X)
END_DLGRESIZE_MAP()
// page common stuff
void OnPageDisplay ( void );
void OnPageDone ( void );
BOOL OnPageValidate ( void );
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnBnClickedLoggingLogviewerbrowse(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
|
/*
---------------------------------------------------------------------------------------
This source file is part of SWG:ANH (Star Wars Galaxies - A New Hope - Server Emulator)
For more information, visit http://www.swganh.com
Copyright (c) 2006 - 2014 The SWG:ANH Team
---------------------------------------------------------------------------------------
Use of this source code is governed by the GPL v3 license that can be found
in the COPYING file or at http://www.gnu.org/licenses/gpl-3.0.html
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
---------------------------------------------------------------------------------------
*/
#pragma once
#ifndef ANH_BUFFDBITEM_H
#define ANH_BUFFDBITEM_H
#include "Utils/bstring.h"
#include "Utils/typedefs.h"
class BuffDBItem
{
public:
BuffDBItem(void);
~BuffDBItem(void);
uint64 mBuffId;
uint64 mTargetId;
uint64 mInstigatorId;
uint64 mMaxTicks;
uint64 mTickLength;
uint64 mCurrentTick;
uint32 mIconCRC;
uint64 mPausedGlobalTick;
uint64 mStartGlobalTick;
BString mName;
};
class BuffAttributeDBItem
{
public:
BuffAttributeDBItem(void) {
;
}
~BuffAttributeDBItem(void) {
;
}
int32 mType, mInitialValue, mTickValue, mFinalValue;
};
#endif // ANH_BUFFDBITEM_H
|
#ifndef MRULE_H
#define MRULE_H
/**
* \file mrule.h
* \author Martin Peres (martin dot peres at ensi-bourges dot fr)
* \date 2010-06-07
*/
#include <QMap>
#include <QString>
#include "domain.h"
#include "program.h"
/// A block of conditions. It is the object representation of the <mrule> tag in transitions.xml
class MRule
{
QMap<QString, QString> _conditions;
Program _prog;
QString _action;
QString _display_name;
public:
MRule(Program prog=Program(), QString action=QString(), QString display_name=QString());
/*!
* \brief Add a condition to the mrule.
* \param name The name of the variable
* \param value A regular expression that should be matched by the variable "name".
* \return true if the value has been added correctly, false otherwise.
*/
bool addCondition(QString name, QString value);
/*!
* \brief Does this matching rule matches this set of variable.
* \param values The set of variable (QMap<name, value>).
* \param value A regular expression that should be matched by the variable "name".
* \return true if this mrule matches, false otherwise.
*/
bool matches(QMap<QString, QString> values) const;
/*!
* \brief Sets the action name of the variables of the matching rule
* \param action_name The name for the action
*/
void setActionName(QString action_name);
/*!
* \brief Sets the display name of the matching rule
* \param name The display name
*/
void setDisplayName(QString name);
QMap<QString, QString> conditions() const;
QString actionName() const;
QString displayName() const;
/*bool operator==(const MRule& b) const;
bool operator!=(const MRule& b) const;*/
};
#endif // TRANSITION_H
|
/* -*- c++ -*-
* Copyright (C) 2007-2013 Hypertable, Inc.
*
* This file is part of Hypertable.
*
* Hypertable is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 3 of the
* License, or any later version.
*
* Hypertable is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef HYPERTABLE_OPERATIONCREATETABLE_H
#define HYPERTABLE_OPERATIONCREATETABLE_H
#include "Operation.h"
namespace Hypertable {
class OperationCreateTable : public Operation {
public:
OperationCreateTable(ContextPtr &context, const String &name, const String &schema);
OperationCreateTable(ContextPtr &context, const MetaLog::EntityHeader &header_);
OperationCreateTable(ContextPtr &context, EventPtr &event);
virtual ~OperationCreateTable() { }
virtual void execute();
virtual const String name();
virtual const String label();
virtual void display_state(std::ostream &os);
virtual uint16_t encoding_version() const;
virtual size_t encoded_state_length() const;
virtual void encode_state(uint8_t **bufp) const;
virtual void decode_state(const uint8_t **bufp, size_t *remainp);
virtual void decode_request(const uint8_t **bufp, size_t *remainp);
private:
void initialize_dependencies();
void requires_indices(bool &needs_index, bool &needs_qualifier_index);
String m_name;
String m_schema;
TableIdentifierManaged m_table;
String m_location;
String m_range_name;
};
} // namespace Hypertable
#endif // HYPERTABLE_OPERATIONCREATETABLE_H
|
#ifndef __BRANCH_SCHEDULER_H_
#define __BRANCH_SCHEDULER_H_
#include <omnetpp.h>
#include "icancloud_Base.h"
#include "SMS_Branch.h"
#include "icancloud_BlockList_Message.h"
/**
* @class BranchScheduler BranchScheduler.h "BranchScheduler.h"
*
* This module schedules I/O requests.
* Derived classes must specify the schedulling policies.
*
* @author Alberto Núñez Covarrubias
* @date 2009-03-12
*
* @author Gabriel González Castañé
* @date 2015-01-26
*/
class BranchScheduler: public icancloud_Base{
protected:
/** Output gate to Input gate. */
cGate* toInputGate;
/** Input gate from Input gate. */
cGate* fromInputGate;
/** Output gate. */
cGate* toOutputGate;
/** Input gate. */
cGate* fromOutputGate;
/** SplittingMessageSystem Object*/
SMS_Branch *SMS_branch;
/**
* Destructor
*/
~BranchScheduler();
/**
* Module initialization.
*/
void initialize();
/**
* Module ending.
*/
void finish();
private:
/**
* Get the outGate to the module that sent <b>msg</b>
* @param msg Arrived message.
* @return. Gate Id (out) to module that sent <b>msg</b> or NOT_FOUND if gate not found.
*/
cGate* getOutGate (cMessage *msg);
/**
* Process a self message.
* @param msg Self message.
*/
void processSelfMessage (cMessage *msg);
/**
* Process a request message.
* @param sm Request message.
*/
void processRequestMessage (icancloud_Message *sm);
/**
* Process a response message.
* @param sm Request message.
*/
void processResponseMessage (icancloud_Message *sm);
/**
* Process all pending branches
*/
void processBranches ();
/**
* Send a request message to its destination!
* @param sm Request message.
* @param gate Gate used to send the message.
*/
void sendRequestMessage (icancloud_Message *sm, cGate* gate);
};
#endif
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef STATISTICS_H
#define STATISTICS_H
#include "ui_statistics.h"
#include <QVariant>
QT_BEGIN_NAMESPACE
class Statistics : public QDialog, public Ui::Statistics
{
Q_OBJECT
public:
Statistics(QWidget *parent = 0, Qt::WindowFlags fl = 0);
~Statistics() {}
public slots:
virtual void updateStats(int w1, int c1, int cs1, int w2, int c2, int cs2);
protected slots:
virtual void languageChange();
};
QT_END_NAMESPACE
#endif // STATISTICS_H
|
/*
Authors:
Jan Cholasta <jcholast@redhat.com>
Copyright (C) 2012 Red Hat
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 _SYSDB_SSH_H_
#define _SYSDB_SSH_H_
#include "db/sysdb.h"
#define SSH_HOSTS_SUBDIR "ssh_hosts"
errno_t
sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
const char *name,
const char *alias,
struct sysdb_attrs *attrs);
errno_t
sysdb_delete_ssh_host(struct sysdb_ctx *sysdb,
const char *name);
errno_t
sysdb_search_ssh_hosts(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
const char *name,
const char **attrs,
struct ldb_message ***hosts,
size_t *host_count);
#endif /* _SYSDB_SSH_H_ */
|
#ifndef src_core_matrix3_h_
#define src_core_matrix3_h_
#include <cstdint>
#include "vector2.h"
class Matrix3
{
private:
float m_[9];
public:
Matrix3();
Matrix3(const float* ptr);
Matrix3 operator*(const Matrix3& rhs) const;
Vector2 operator*(const Vector2& rhs) const;
Matrix3 Transpose() const;
void ToTranspose();
float Determinate() const;
float Trace() const;
float& operator[](const uint32_t& idx);
const float& operator[](const uint32_t& idx) const;
float& operator()(const uint32_t& x, const uint32_t& y);
const float& operator()(const uint32_t& x, const uint32_t& y) const;
static Matrix3 Translate(const Vector2& pos);
static Matrix3 Scale(const Vector2& scale);
static Matrix3 Rotate(const float& degrees);
static Matrix3 Identity();
};
#endif
|
#ifndef _PHASERET_BASICMACROS_H
#define _PHASERET_BASICMACROS_H
#ifndef PHASERET_API
#if defined(_WIN32) || defined(__WIN32__)
# if defined(LTFAT_BUILD_SHARED)
# define PHASERET_API __declspec(dllexport)
# elif !defined(LTFAT_BUILD_STATIC)
# define PHASERET_API __declspec(dllimport)
# else
# define PHASERET_API
# endif
#else
// # if __GNUC__ >= 4
// # define PHASERET_API __attribute__((visibility("default")))
// # else
# define PHASERET_API
// # endif
#endif
#endif
#define PHASERET_NAME_DOUBLE(name) LTFAT_MAKENAME(phaseret,name,_d)
#define PHASERET_NAME_SINGLE(name) LTFAT_MAKENAME(phaseret,name,_s)
#define PHASERET_NAME_COMPLEXDOUBLE(name) LTFAT_MAKENAME(phaseret,name,_dc)
#define PHASERET_NAME_COMPLEXSINGLE(name) LTFAT_MAKENAME(phaseret,name,_sc)
#endif
|
/*
This file is part of libNativeDVBIO by Varga Bence.
libNativeDVBIO 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.
libNativeDVBIO 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 libNativeDVBIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dvb_resource.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define RESCOLL_MAX 100
int rescoll_num = 0;
void* rescoll_data[RESCOLL_MAX];
int rescoll_create() {
if (rescoll_num >= RESCOLL_MAX)
return -1;
rescoll_data[rescoll_num] = malloc(sizeof(struct dvb_resource));
dvbres_init(rescoll_data[rescoll_num]);
return rescoll_num++;
}
struct dvb_resource* rescoll_get(int index) {
if (index < 0 || index >= rescoll_num)
return NULL;
return rescoll_data[index];
}
int rescoll_delete(int index) {
if (index < 0 || index >= rescoll_num)
return -1;
struct dvb_resource* res = rescoll_data[index];
memmove(&rescoll_data[index], &rescoll_data[index + 1], (rescoll_num - index - 1) * sizeof(void*));
rescoll_num--;
dvbres_release(res);
free(res);
return 0;
}
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CResourceConfigItem.h
* PURPOSE: Header for resource config item class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef CRESOURCECONFIGITEM_H
#define CRESOURCECONFIGITEM_H
#include "CResource.h"
#include "CDownloadableResource.h"
#include <list>
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
class CResourceConfigItem : public CDownloadableResource
{
public:
CResourceConfigItem(class CResource* resource, const char* szShortName, const char* szResourceFileName, uint uiDownloadSize, CChecksum serverChecksum);
~CResourceConfigItem(void);
bool Start(void);
bool Stop(void);
class CXMLFile* GetFile(void) { return m_pXMLFile; }
class CXMLNode* GetRoot(void) { return m_pXMLRootNode; }
private:
class CXMLFile* m_pXMLFile;
CXMLNode* m_pXMLRootNode;
};
#endif |
// LDKEvaluation.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
// CLDKEvaluationApp:
// See LDKEvaluation.cpp for the implementation of this class
//
class CLDKEvaluationApp : public CWinApp
{
public:
CLDKEvaluationApp();
// Overrides
public:
virtual BOOL InitInstance();
// Implementation
DECLARE_MESSAGE_MAP()
};
extern CLDKEvaluationApp theApp; |
/*
* main.h
*
* Created on: 2017Äê4ÔÂ16ÈÕ
* Author: admin
*/
#ifndef USER_INC_MAIN_H_
#define USER_INC_MAIN_H_
#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include "data.h"
#include "delay.h"
#include "stdint.h"
#include "Flash2833x_API_Library.h"
//--------------------------------
#include "flash.h"
#endif /* USER_INC_MAIN_H_ */
|
/*
* @(#) FakeSocket.h 1.0 Aug 11, 2015
*
* Guillaume Leclerc (guillaume.leclerc@epfl.ch)
*
* The ROBOGEN Framework
* Copyright © 2012-2013 Andrea Maesani
*
* Laboratory of Intelligent Systems, EPFL
*
* This file is part of the ROBOGEN Framework.
*
* The ROBOGEN Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPL)
* as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @(#) $Id$
*/
#ifndef FAKEJSSOCKET_H_
#define FAKEJSSOCKET_H_
#include <utils/network/Socket.h>
namespace robogen {
class FakeJSSocket: public Socket {
public:
FakeJSSocket();
virtual ~FakeJSSocket();
virtual bool create(int port);
virtual bool accept();
virtual bool open(const std::string& ip, int port);
virtual bool read(std::vector<unsigned char>& buffer, size_t bytesToRead);
virtual bool write(std::vector<unsigned char>& buffer);
virtual bool close();
virtual void interrupt();
std::vector<unsigned char> getContent();
private :
std::vector<unsigned char> innerBuffer;
};
} /* namespace robogen */
#endif /* FAKEJSSOCKET_H_ */
|
//------------------------------------------------------------
// DOOM port and BSP visualization by Daniel Fetter (2013-14)
//------------------------------------------------------------
#pragma once
DECL_PIMPL(LibConstBuffer)
ubyte* LockConstBuffer();
void UnlockConstBuffer();
void BindToVs(uint index);
void BindToPs(uint index);
};
class ConstBuffer
{
public:
ConstBuffer(uint bufferSize, const vector<ConstBufferMemberInfo>& infos)
:size(bufferSize)
{
members.resize(infos.size());
for (uint i = 0; i < infos.size(); i++)
{
const ConstBufferMemberInfo& info = infos[i];
members[i] = make_shared<ConstBufferMember>(info);
}
libConstBuffer = RenderGlobal::Get().GetLib().MakeConstBuffer(bufferSize);
}
void BindConstantBuffer(const ConstBufferShaderIndex& index)
{
assert(libConstBuffer);
/*for (uint i = 0; i < autoVars.Size(); ++i)
{
ShaderVarAuto& var = autoVars.At(i);
var.UpdateVar();
var.BindVar();
}*/
ubyte* data = libConstBuffer->LockConstBuffer();
assert(data);
for (shared_ptr<ConstBufferMember>& member : members)
{
assert(member);
member->CopyToBuffer(data, size);
}
libConstBuffer->UnlockConstBuffer();
if (index.vsIndex != ConstBufferShaderIndex::NULL_INDEX)
{
libConstBuffer->BindToVs(index.vsIndex);
}
if (index.psIndex != ConstBufferShaderIndex::NULL_INDEX)
{
libConstBuffer->BindToPs(index.psIndex);
}
}
const vector<shared_ptr<ConstBufferMember>>& GetMembers()
{
return members;
}
private:
vector<shared_ptr<ConstBufferMember>> members;
unique_ptr<LibConstBuffer> libConstBuffer;
uint size;
};
|
/* ide-xml-stack.c
*
* Copyright © 2017 Sebastien Lafargue <slafargue@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ide-xml-stack.h"
#include <ide.h>
typedef struct _StackItem
{
gchar *name;
IdeXmlSymbolNode *node;
IdeXmlSymbolNode *parent;
gint depth;
} StackItem;
struct _IdeXmlStack
{
GObject parent_instance;
GArray *array;
};
G_DEFINE_TYPE (IdeXmlStack, ide_xml_stack, G_TYPE_OBJECT)
IdeXmlStack *
ide_xml_stack_new (void)
{
return g_object_new (IDE_TYPE_XML_STACK, NULL);
}
void
ide_xml_stack_push (IdeXmlStack *self,
const gchar *name,
IdeXmlSymbolNode *node,
IdeXmlSymbolNode *parent,
gint depth)
{
StackItem item;
g_return_if_fail (IDE_IS_XML_STACK (self));
g_return_if_fail (!dzl_str_empty0 (name));
g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (node) || node == NULL);
g_return_if_fail (IDE_IS_XML_SYMBOL_NODE (parent) || parent == NULL);
item.name = g_strdup (name);
item.node = node;
item.parent = parent;
item.depth = depth;
g_array_append_val (self->array, item);
}
IdeXmlSymbolNode *
ide_xml_stack_pop (IdeXmlStack *self,
gchar **name,
IdeXmlSymbolNode **parent,
gint *depth)
{
StackItem *item;
IdeXmlSymbolNode *node;
gsize last;
g_return_val_if_fail (IDE_IS_XML_STACK (self), NULL);
if (self->array->len == 0)
return NULL;
last = self->array->len - 1;
item = &g_array_index (self->array, StackItem, last);
node = item->node;
if (depth != NULL)
*depth = item->depth;
if (name != NULL)
*name = (item->name != NULL) ? g_steal_pointer (&item->name) : NULL;
if (parent != NULL)
*parent = item->parent;
self->array = g_array_remove_index (self->array, last);
return node;
}
IdeXmlSymbolNode *
ide_xml_stack_peek (IdeXmlStack *self,
const gchar **name,
IdeXmlSymbolNode **parent,
gint *depth)
{
StackItem *item;
IdeXmlSymbolNode *node;
gsize last;
g_return_val_if_fail (IDE_IS_XML_STACK (self), NULL);
if (self->array->len == 0)
return NULL;
last = self->array->len - 1;
item = &g_array_index (self->array, StackItem, last);
node = item->node;
if (depth != NULL)
*depth = item->depth;
if (name != NULL)
*name = item->name;
if (parent != NULL)
*parent = item->parent;
return node;
}
gsize
ide_xml_stack_get_size (IdeXmlStack *self)
{
g_return_val_if_fail (IDE_IS_XML_STACK (self), 0);
return self->array->len;
}
gboolean
ide_xml_stack_is_empty (IdeXmlStack *self)
{
g_return_val_if_fail (IDE_IS_XML_STACK (self), TRUE);
return (self->array->len == 0);
}
static void
clear_array (gpointer data)
{
StackItem *item = (StackItem *)data;
g_free (item->name);
}
static void
ide_xml_stack_finalize (GObject *object)
{
IdeXmlStack *self = (IdeXmlStack *)object;
g_clear_pointer (&self->array, g_array_unref);
G_OBJECT_CLASS (ide_xml_stack_parent_class)->finalize (object);
}
static void
ide_xml_stack_class_init (IdeXmlStackClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ide_xml_stack_finalize;
}
static void
ide_xml_stack_init (IdeXmlStack *self)
{
self->array = g_array_new (FALSE, TRUE, sizeof (StackItem));
g_array_set_clear_func (self->array, (GDestroyNotify)clear_array);
}
|
#ifndef _ABSTRACT_INT_H
# define _ABSTRACT_INT_H
#include <gnutls/abstract.h>
int _gnutls_privkey_get_public_mpis (gnutls_privkey_t key,
gnutls_pk_params_st*);
int pubkey_to_bits(gnutls_pk_algorithm_t pk, gnutls_pk_params_st* params);
int _gnutls_pubkey_compatible_with_sig(gnutls_pubkey_t pubkey, gnutls_protocol_t ver,
gnutls_sign_algorithm_t sign);
int _gnutls_pubkey_is_over_rsa_512(gnutls_pubkey_t pubkey);
int
_gnutls_pubkey_get_mpis (gnutls_pubkey_t key,
gnutls_pk_params_st * params);
int pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature,
gnutls_pk_params_st * issuer_params);
int pubkey_verify_data (gnutls_pk_algorithm_t pk,
gnutls_digest_algorithm_t algo,
const gnutls_datum_t * data,
const gnutls_datum_t * signature,
gnutls_pk_params_st * issuer_params);
gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo,
const gnutls_pk_params_st* params, int* hash_len);
#endif
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSCREEN_P_H
#define QSCREEN_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/qscreen.h>
#include <qpa/qplatformscreen.h>
#include "qhighdpiscaling_p.h"
#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
class QScreenPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QScreen)
public:
QScreenPrivate()
: platformScreen(0)
, orientationUpdateMask(0)
{
}
void setPlatformScreen(QPlatformScreen *screen);
void updateHighDpi()
{
geometry = platformScreen->deviceIndependentGeometry();
availableGeometry = QHighDpi::fromNative(platformScreen->availableGeometry(), QHighDpiScaling::factor(platformScreen), geometry.topLeft());
}
void updatePrimaryOrientation();
QPlatformScreen *platformScreen;
Qt::ScreenOrientations orientationUpdateMask;
Qt::ScreenOrientation orientation;
Qt::ScreenOrientation filteredOrientation;
Qt::ScreenOrientation primaryOrientation;
QRect geometry;
QRect availableGeometry;
QDpi logicalDpi;
qreal refreshRate;
};
QT_END_NAMESPACE
#endif // QSCREEN_P_H
|
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-kcvi.h"
#include "../common/t1fuv_3.c"
|
//
// Generated file, do not edit! Created by opp_msgc 4.3 from linklayer/radio/IdealAirFrame.msg.
//
#ifndef _IDEALAIRFRAME_M_H_
#define _IDEALAIRFRAME_M_H_
#include <omnetpp.h>
// opp_msgc version check
#define MSGC_VERSION 0x0403
#if (MSGC_VERSION!=OMNETPP_VERSION)
# error Version mismatch! Probably this file was generated by an earlier version of opp_msgc: 'make clean' should help.
#endif
// dll export symbol
#ifndef INET_API
# if defined(INET_EXPORT)
# define INET_API OPP_DLLEXPORT
# elif defined(INET_IMPORT)
# define INET_API OPP_DLLIMPORT
# else
# define INET_API
# endif
#endif
// cplusplus {{
#include "INETDefs.h"
#include "Coord.h"
// }}
/**
* Class generated from <tt>linklayer/radio/IdealAirFrame.msg</tt> by opp_msgc.
* <pre>
* packet IdealAirFrame
* {
* simtime_t transmissionDuration;
* Coord transmissionStartPosition;
* double transmissionRange;
* }
* </pre>
*/
class INET_API IdealAirFrame : public ::cPacket
{
protected:
simtime_t transmissionDuration_var;
Coord transmissionStartPosition_var;
double transmissionRange_var;
private:
void copy(const IdealAirFrame& other);
protected:
// protected and unimplemented operator==(), to prevent accidental usage
bool operator==(const IdealAirFrame&);
public:
IdealAirFrame(const char *name=NULL, int kind=0);
IdealAirFrame(const IdealAirFrame& other);
virtual ~IdealAirFrame();
IdealAirFrame& operator=(const IdealAirFrame& other);
virtual IdealAirFrame *dup() const {return new IdealAirFrame(*this);}
virtual void parsimPack(cCommBuffer *b);
virtual void parsimUnpack(cCommBuffer *b);
// field getter/setter methods
virtual simtime_t getTransmissionDuration() const;
virtual void setTransmissionDuration(simtime_t transmissionDuration);
virtual Coord& getTransmissionStartPosition();
virtual const Coord& getTransmissionStartPosition() const {return const_cast<IdealAirFrame*>(this)->getTransmissionStartPosition();}
virtual void setTransmissionStartPosition(const Coord& transmissionStartPosition);
virtual double getTransmissionRange() const;
virtual void setTransmissionRange(double transmissionRange);
};
inline void doPacking(cCommBuffer *b, IdealAirFrame& obj) {obj.parsimPack(b);}
inline void doUnpacking(cCommBuffer *b, IdealAirFrame& obj) {obj.parsimUnpack(b);}
#endif // _IDEALAIRFRAME_M_H_
|
//========================== Open Steamworks ================================
//
// This file is part of the Open Steamworks project. All individuals associated
// with this project do not claim ownership of the contents
//
// The code, comments, and all related files, projects, resources,
// redistributables included with this project are Copyright Valve Corporation.
// Additionally, Valve, the Valve logo, Half-Life, the Half-Life logo, the
// Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo,
// Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the
// Counter-Strike logo, Source, the Source logo, and Counter-Strike Condition
// Zero are trademarks and or registered trademarks of Valve Corporation.
// All other trademarks are property of their respective owners.
//
//=============================================================================
#ifndef EAUTHSESSIONRESPONSE_H
#define EAUTHSESSIONRESPONSE_H
#ifdef _WIN32
#pragma once
#endif
#include "EnumString.h"
// Callback values for callback ValidateAuthTicketResponse_t which is a response to BeginAuthSession
typedef enum
{
k_EAuthSessionResponseOK = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused.
k_EAuthSessionResponseUserNotConnectedToSteam = 1, // The user in question is not connected to steam
k_EAuthSessionResponseNoLicenseOrExpired = 2, // The license has expired.
k_EAuthSessionResponseVACBanned = 3, // The user is VAC banned for this game.
k_EAuthSessionResponseLoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected.
k_EAuthSessionResponseVACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user
k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer
k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
} EAuthSessionResponse;
Begin_Enum_String(EAuthSessionResponse)
{
Enum_String( k_EAuthSessionResponseOK ); // Steam has verified the user is online, the ticket is valid and ticket has not been reused.
Enum_String( k_EAuthSessionResponseUserNotConnectedToSteam ); // The user in question is not connected to steam
Enum_String( k_EAuthSessionResponseNoLicenseOrExpired ); // The license has expired.
Enum_String( k_EAuthSessionResponseVACBanned ); // The user is VAC banned for this game.
Enum_String( k_EAuthSessionResponseLoggedInElseWhere ); // The user account has logged in elsewhere and the session containing the game instance has been disconnected.
Enum_String( k_EAuthSessionResponseVACCheckTimedOut ); // VAC has been unable to perform anti-cheat checks on this user
Enum_String( k_EAuthSessionResponseAuthTicketCanceled ); // The ticket has been canceled by the issuer
Enum_String( k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed ); // This ticket has already been used, it is not valid.
Enum_String( k_EAuthSessionResponseAuthTicketInvalid ); // This ticket is not from a user instance currently connected to steam.
}
End_Enum_String;
#endif // EAUTHSESSIONRESPONSE_H
|
/*
* This source file forms part of libsxbp, a library which generates
* experimental 2D spiral-like shapes based on input binary data.
*
* Copyright (C) 2016, 2017, Joshua Saxby joshua.a.saxby+TNOPLuc8vM==@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "saxbospiral.h"
#include "initialise.h"
#ifdef __cplusplus
extern "C"{
#endif
sxbp_direction_t sxbp_change_direction(
sxbp_direction_t current, sxbp_rotation_t turn
) {
return (current + turn) % 4U;
}
sxbp_spiral_t sxbp_blank_spiral(void) {
return (sxbp_spiral_t){0, NULL, {{NULL, 0}, 0}, false, 0, 0, 0, 0, 0, 0, };
}
sxbp_status_t sxbp_init_spiral(sxbp_buffer_t buffer, sxbp_spiral_t* spiral) {
// preconditional assertions
assert(spiral->lines == NULL);
assert(spiral->co_ord_cache.co_ords.items == NULL);
// result status object
sxbp_status_t result;
// number of lines is number of bits of the data, + 1 for the first UP line
size_t line_count = (buffer.size * 8) + 1;
// TODO: Check here for overflow condition
// populate spiral struct
spiral->size = line_count;
spiral->collides = -1;
// allocate enough memory for a line_t struct for each bit
spiral->lines = calloc(sizeof(sxbp_line_t), line_count);
// check for memory allocation failure
if(spiral->lines == NULL) {
result = SXBP_MALLOC_REFUSED;
return result;
}
// First line is always an UP line - this is for orientation purposes
sxbp_direction_t current = SXBP_UP;
spiral->lines[0].direction = current;
spiral->lines[0].length = 0;
/*
* now, iterate over all the bits in the data and convert to directions that
* make the spiral pattern, storing these directions in the result lines
*/
for(size_t s = 0; s < buffer.size; s++) {
// byte-level loop
for(uint8_t b = 0; b < 8; b++) {
// bit level loop
uint8_t e = 7 - b; // which power of two to use with bit mask
uint8_t bit = (buffer.bytes[s] & (1 << e)) >> e; // the current bit
size_t index = (s * 8) + (size_t)b + 1; // line index
sxbp_rotation_t rotation; // the rotation we're going to make
// set rotation direction based on the current bit
rotation = (bit == 0) ? SXBP_CLOCKWISE : SXBP_ANTI_CLOCKWISE;
// calculate the change of direction
current = sxbp_change_direction(current, rotation);
// store direction in result struct
spiral->lines[index].direction = current;
// set length to 0 initially
spiral->lines[index].length = 0;
}
}
// all ok
result = SXBP_OPERATION_OK;
return result;
}
#ifdef __cplusplus
} // extern "C"
#endif
|
#include "op_expand_all.h"
#include "../../hexastore/hexastore.h"
OpBase* NewExpandAllOp(RedisModuleCtx *ctx, Graph *g, const char *graph_name,
Node **src_node, Edge **relation, Node **dest_node) {
return (OpBase*)NewExpandAll(ctx, g, graph_name, src_node, relation, dest_node);
}
ExpandAll* NewExpandAll(RedisModuleCtx *ctx, Graph *g, const char *graph_name,
Node **src_node, Edge **relation, Node **dest_node) {
ExpandAll *expand_all = calloc(1, sizeof(ExpandAll));
expand_all->ctx = ctx;
expand_all->src_node = src_node;
expand_all->_src_node = *src_node;
expand_all->dest_node = dest_node;
expand_all->_dest_node = *dest_node;
expand_all->relation = relation;
expand_all->_relation = *relation;
expand_all->hexastore = GetHexaStore(ctx, graph_name);
expand_all->triplet = NewTriplet(NULL, NULL, NULL);
expand_all->str_triplet = sdsempty();
expand_all->state = ExpandAllUninitialized;
HexaStore_Search(expand_all->hexastore, "", &expand_all->iter);
// Set our Op operations
expand_all->op.name = "Expand All";
expand_all->op.type = OPType_EXPAND_ALL;
expand_all->op.consume = ExpandAllConsume;
expand_all->op.reset = ExpandAllReset;
expand_all->op.free = ExpandAllFree;
expand_all->op.modifies = NewVector(char*, 3);
char *modified;
/* Not completely true, but at this stage we don't know which entity
* is given to us by previous ops, at the moment there's no harm
* in assuming we're modifiying all three entities, this can only effect
* filter operations, which is already aware of previously modified entities. */
modified = Graph_GetNodeAlias(g, *src_node);
Vector_Push(expand_all->op.modifies, modified);
modified = Graph_GetEdgeAlias(g, *relation);
Vector_Push(expand_all->op.modifies, modified);
modified = Graph_GetNodeAlias(g, *dest_node);
Vector_Push(expand_all->op.modifies, modified);
return expand_all;
}
/* ExpandAllConsume next operation
* each call will update the graph
* returns OP_DEPLETED when no additional updates are available */
OpResult ExpandAllConsume(OpBase *opBase, Graph* graph) {
ExpandAll *op = (ExpandAll*)opBase;
if(op->state == ExpandAllUninitialized) {
return OP_REFRESH;
}
/* State resetted. */
if(op->state == ExpandAllResetted) {
op->triplet->subject = *(op->src_node);
op->triplet->predicate = *(op->relation);
op->triplet->object = *(op->dest_node);
if(op->triplet->kind == UNKNOW) op->triplet->kind = TripletGetKind(op->triplet);
if(op->modifies.kind == UNKNOW) {
int s = (op->triplet->subject->id == INVALID_ENTITY_ID);
int o = (op->triplet->object->id == INVALID_ENTITY_ID);
int p = (op->triplet->predicate->id == INVALID_ENTITY_ID);
op->modifies.kind = (s > 0) << 2 | (o > 0) << 1 | (p > 0);
}
/* Overrides current value with triplet string representation,
* if string buffer is large enough, there will be no allocation. */
TripletToString(op->triplet, &op->str_triplet);
/* Search hexastore, reuse iterator. */
HexaStore_Search_Iterator(op->hexastore, op->str_triplet, &op->iter);
op->state = ExpandAllConsuming;
}
Triplet *triplet = NULL;
if(!TripletIterator_Next(&op->iter, &triplet)) {
return OP_REFRESH;
}
/* TODO: Make sure retrieved id are indeed
* labeled under nodes / edge lables. */
/* Update graph. */
if(op->modifies.kind & S) {
*op->src_node = triplet->subject;
}
if(op->modifies.kind & P) {
*op->relation = triplet->predicate;
}
if(op->modifies.kind & O) {
*op->dest_node = triplet->object;
}
return OP_OK;
}
OpResult ExpandAllReset(OpBase *ctx) {
ExpandAll *op = (ExpandAll*)ctx;
/* Reset triplet string representation. */
op->str_triplet[0] = '\0';
sdsupdatelen(op->str_triplet);
if(op->modifies.kind & S) {
*op->src_node = op->_src_node;
}
if(op->modifies.kind & O) {
*op->dest_node = op->_dest_node;
}
if(op->modifies.kind & P) {
*op->relation = op->_relation;
}
op->state = ExpandAllResetted; /* Mark reset. */
return OP_OK;
}
/* Frees ExpandAll */
void ExpandAllFree(OpBase *ctx) {
ExpandAll *op = (ExpandAll*)ctx;
sdsfree(op->str_triplet);
free(op);
}
|
/**
******************************************************************************
* @file USB_Device/DFU_Standalone/Inc/usbd_dfu_flash.h
* @author MCD Application Team
* @version V1.0.1
* @date 29-January-2016
* @brief Header for usbd_dfu_flash.c file.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_DFU_FLASH_H_
#define __USBD_DFU_FLASH_H_
/* Includes ------------------------------------------------------------------*/
#include "usbd_dfu.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Base address of the Flash sectors */
/* Bank 1 */
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */
#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */
/* Bank 2 */
#define ADDR_FLASH_SECTOR_12 ((uint32_t)0x08100000) /* Base @ of Sector 12, 16 Kbytes */
#define ADDR_FLASH_SECTOR_13 ((uint32_t)0x08104000) /* Base @ of Sector 13, 16 Kbytes */
#define ADDR_FLASH_SECTOR_14 ((uint32_t)0x08108000) /* Base @ of Sector 14, 16 Kbytes */
#define ADDR_FLASH_SECTOR_15 ((uint32_t)0x0810C000) /* Base @ of Sector 15, 16 Kbytes */
#define ADDR_FLASH_SECTOR_16 ((uint32_t)0x08110000) /* Base @ of Sector 16, 64 Kbytes */
#define ADDR_FLASH_SECTOR_17 ((uint32_t)0x08120000) /* Base @ of Sector 17, 128 Kbytes */
#define ADDR_FLASH_SECTOR_18 ((uint32_t)0x08140000) /* Base @ of Sector 18, 128 Kbytes */
#define ADDR_FLASH_SECTOR_19 ((uint32_t)0x08160000) /* Base @ of Sector 19, 128 Kbytes */
#define ADDR_FLASH_SECTOR_20 ((uint32_t)0x08180000) /* Base @ of Sector 20, 128 Kbytes */
#define ADDR_FLASH_SECTOR_21 ((uint32_t)0x081A0000) /* Base @ of Sector 21, 128 Kbytes */
#define ADDR_FLASH_SECTOR_22 ((uint32_t)0x081C0000) /* Base @ of Sector 22, 128 Kbytes */
#define ADDR_FLASH_SECTOR_23 ((uint32_t)0x081E0000) /* Base @ of Sector 23, 128 Kbytes */
/* Exported macro ------------------------------------------------------------*/
extern USBD_DFU_MediaTypeDef USBD_DFU_Flash_fops;
/* Exported functions ------------------------------------------------------- */
#endif /* __USBD_DFU_FLASH_H_ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2012 Dennis Nienhüser <earthwings@gentoo.org>
//
#ifndef MARBLE_OSMMAPQUESTRUNNER_H
#define MARBLE_OSMMAPQUESTRUNNER_H
#include "RoutingRunner.h"
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
namespace Marble
{
class MapQuestRunner : public RoutingRunner
{
Q_OBJECT
public:
explicit MapQuestRunner(QObject *parent = 0);
~MapQuestRunner();
// Overriding MarbleAbstractRunner
virtual void retrieveRoute( const RouteRequest *request );
private Q_SLOTS:
void get();
/** Route data was retrieved via http */
void retrieveData( QNetworkReply *reply );
/** A network error occurred */
void handleError( QNetworkReply::NetworkError );
private:
void append( QString* input, const QString &key, const QString &value );
int maneuverType( int mapQuestId ) const;
GeoDataDocument* parse( const QByteArray &input ) const;
QNetworkAccessManager m_networkAccessManager;
QNetworkRequest m_request;
};
}
#endif
|
/*****************************************************************************
* dr_45.h
* Copyright (C) 2004-2010 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* 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
*
*****************************************************************************/
/*!
* \file <dr_45.h>
* \author Jean-Paul Saman <jpsaman@videolan.org>
* \brief VBI data descriptor parsing.
*
* DVB VBI data descriptor parsing, according to ETSI EN 300 468
* version 1.7.1 section 6.2.46
*
* NOTE: this descriptor is known by tag value 0x45
*/
#ifndef _DVBPSI_DR_45_H_
#define _DVBPSI_DR_45_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_vbidata_line_t
*****************************************************************************/
/*!
* \struct dvbpsi_vbidata_line_s
* \brief one VBI Data line structure.
*
* This structure is used since vbidata_t structure will contain several
* of these structures
*/
/*!
* \typedef struct dvbpsi_vbidata_line_s dvbpsi_vbidata_line_t
* \brief dvbpsi_vbidata_line_t type definition.
*/
typedef struct dvbpsi_vbidata_line_s
{
uint8_t i_parity; /*!< parity bit (1 bits) */
uint8_t i_line_offset; /*!< line offset (5 bits) */
} dvbpsi_vbidata_line_t;
/*!
* \def DVBPSI_VBIDATA_LINE_DR_MAX
* \brief Maximum number of dvbpsi_vbidata_line_t entries present in
* @see dvbpsi_vbidata_t
* @deprecated will be removed in next major version
*/
#define DVBPSI_VBIDATA_LINE_DR_MAX 255
/*****************************************************************************
* dvbpsi_vbidata_t
*****************************************************************************/
/*!
* \struct dvbpsi_vbidata_s
* \brief one VBI data structure.
*
* This structure is used since vbi_descriptor will contain several
* of these structures
*/
/*!
* \typedef struct dvbpsi_vbidata_s dvbpsi_vbidata_t
* \brief dvbpsi_vbidata_t type definition.
*/
typedef struct dvbpsi_vbidata_s
{
uint8_t i_data_service_id; /*!< data service id (8 bits) */
uint8_t i_lines; /*!< number of lines */
dvbpsi_vbidata_line_t p_lines[255]; /*!< VBI lines data */
} dvbpsi_vbidata_t;
/*!
* \def DVBPSI_VBI_DR_MAX
* \brief Maximum number of dvbpsi_vbidata_t entries present in
* @see dvbpsi_dvb_vbi_dr_t
*/
#define DVBPSI_VBI_DR_MAX 85
/*****************************************************************************
* dvbpsi_dvb_vbi_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_dvb_vbi_dr_s
* \brief "teletext" descriptor structure.
*
* This structure is used to store a decoded "VBI data"
* descriptor. (ETSI EN 300 468 version 1.7.1 section 6.2.46).
*/
/*!
* \typedef struct dvbpsi_dvb_vbi_dr_s dvbpsi_dvb_vbi_dr_t
* \brief dvbpsi_dvb_vbi_dr_t type definition.
*/
typedef struct dvbpsi_dvb_vbi_dr_s
{
uint8_t i_services_number; /*!< service number */
dvbpsi_vbidata_t p_services[DVBPSI_VBI_DR_MAX]; /*!< services table */
} dvbpsi_dvb_vbi_dr_t;
/*****************************************************************************
* dvbpsi_decode_dvb_vbi_dr
*****************************************************************************/
/*!
* \fn dvbpsi_dvb_vbi_dr_t * dvbpsi_decode_dvb_vbi_dr(
dvbpsi_descriptor_t * p_descriptor)
* \brief "VBI data" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "VBI data" descriptor structure
* which contains the decoded data.
*/
dvbpsi_dvb_vbi_dr_t* dvbpsi_decode_dvb_vbi_dr(
dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_gen_dvb_vbi_dr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_gen_dvb_vbi_dr(
dvbpsi_dvb_vbi_dr_t * p_decoded, bool b_duplicate)
* \brief "VBI data" descriptor generator.
* \param p_decoded pointer to a decoded "VBI data" descriptor
* structure
* \param b_duplicate if true then duplicate the p_decoded structure into
* the descriptor
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_gen_dvb_vbi_dr(
dvbpsi_dvb_vbi_dr_t * p_decoded,
bool b_duplicate);
#ifdef DVBPSI_USE_DEPRECATED_DR_API
typedef dvbpsi_dvb_vbi_dr_t dvbpsi_vbi_dr_t ;
__attribute__((deprecated,unused)) static dvbpsi_vbi_dr_t* dvbpsi_DecodeVBIDataDr (dvbpsi_descriptor_t *dr) {
return dvbpsi_decode_dvb_vbi_dr (dr);
}
__attribute__((deprecated,unused)) static dvbpsi_descriptor_t* dvbpsi_GenVBIDataDr (dvbpsi_vbi_dr_t* dr, bool dup) {
return dvbpsi_gen_dvb_vbi_dr (dr, dup);
}
#endif
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of dr_45.h"
#endif
|
/*
Copyright (C) 2013 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "arb_poly.h"
int main()
{
slong iter;
flint_rand_t state;
flint_printf("pow_arb_series....");
fflush(stdout);
flint_randinit(state);
/* compare with exp/log */
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
{
slong prec, trunc;
arb_poly_t f, g, h1, h2;
arb_t c;
prec = 2 + n_randint(state, 200);
trunc = n_randint(state, 20);
arb_poly_init(f);
arb_poly_init(g);
arb_poly_init(h1);
arb_poly_init(h2);
arb_init(c);
/* generate binomials */
if (n_randint(state, 20) == 0)
{
arb_randtest(c, state, prec, 10);
arb_poly_set_coeff_arb(f, 0, c);
arb_randtest(c, state, prec, 10);
arb_poly_set_coeff_arb(f, 1 + n_randint(state, 20), c);
}
else
{
arb_poly_randtest(f, state, 1 + n_randint(state, 20), prec, 10);
}
arb_poly_randtest(h1, state, 1 + n_randint(state, 20), prec, 10);
arb_randtest(c, state, prec, 10);
arb_poly_set_arb(g, c);
/* f^c */
arb_poly_pow_arb_series(h1, f, c, trunc, prec);
/* f^c = exp(c*log(f)) */
arb_poly_log_series(h2, f, trunc, prec);
arb_poly_mullow(h2, h2, g, trunc, prec);
arb_poly_exp_series(h2, h2, trunc, prec);
if (!arb_poly_overlaps(h1, h2))
{
flint_printf("FAIL\n\n");
flint_printf("prec = %wd\n", prec);
flint_printf("trunc = %wd\n", trunc);
flint_printf("f = "); arb_poly_printd(f, 15); flint_printf("\n\n");
flint_printf("c = "); arb_printd(c, 15); flint_printf("\n\n");
flint_printf("h1 = "); arb_poly_printd(h1, 15); flint_printf("\n\n");
flint_printf("h2 = "); arb_poly_printd(h2, 15); flint_printf("\n\n");
flint_abort();
}
arb_poly_pow_arb_series(f, f, c, trunc, prec);
if (!arb_poly_overlaps(f, h1))
{
flint_printf("FAIL (aliasing)\n\n");
flint_abort();
}
arb_poly_clear(f);
arb_poly_clear(g);
arb_poly_clear(h1);
arb_poly_clear(h2);
arb_clear(c);
}
flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
|
/*
* ggit-cred-plaintext.h
* This file is part of libgit2-glib
*
* Copyright (C) 2013 - Ignacio Casal Quinteiro
*
* libgit2-glib 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.
*
* libgit2-glib 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 libgit2-glib. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GGIT_CRED_PLAINTEXT_H__
#define __GGIT_CRED_PLAINTEXT_H__
#include <glib-object.h>
#include <libgit2-glib/ggit-cred.h>
G_BEGIN_DECLS
#define GGIT_TYPE_CRED_PLAINTEXT (ggit_cred_plaintext_get_type ())
#define GGIT_CRED_PLAINTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGIT_TYPE_CRED_PLAINTEXT, GgitCredPlaintext))
#define GGIT_CRED_PLAINTEXT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGIT_TYPE_CRED_PLAINTEXT, GgitCredPlaintext const))
#define GGIT_CRED_PLAINTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGIT_TYPE_CRED_PLAINTEXT, GgitCredPlaintextClass))
#define GGIT_IS_CRED_PLAINTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGIT_TYPE_CRED_PLAINTEXT))
#define GGIT_IS_CRED_PLAINTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGIT_TYPE_CRED_PLAINTEXT))
#define GGIT_CRED_PLAINTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GGIT_TYPE_CRED_PLAINTEXT, GgitCredPlaintextClass))
typedef struct _GgitCredPlaintextClass GgitCredPlaintextClass;
typedef struct _GgitCredPlaintextPrivate GgitCredPlaintextPrivate;
struct _GgitCredPlaintext
{
/*< private >*/
GgitCred parent;
GgitCredPlaintextPrivate *priv;
};
struct _GgitCredPlaintextClass
{
/*< private >*/
GgitCredClass parent_class;
};
GType ggit_cred_plaintext_get_type (void) G_GNUC_CONST;
GgitCredPlaintext *ggit_cred_plaintext_new (const gchar *username,
const gchar *password,
GError **error);
const gchar *ggit_cred_plaintext_get_username (GgitCredPlaintext *cred);
const gchar *ggit_cred_plaintext_get_password (GgitCredPlaintext *cred);
G_END_DECLS
#endif /* __GGIT_CRED_PLAINTEXT_H__ */
/* ex:set ts=8 noet: */
|
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (C) 2007-2014 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC 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.
*
* RELIC 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 RELIC. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
*
* Benchmarks for random number generation.
*
* @version $Id: bench_dv.c 1718 2014-01-07 12:58:03Z dfaranha $
* @ingroup rand
*/
#include <stdio.h>
#include "relic.h"
#include "relic_bench.h"
#if RAND == CALL
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
static void test_bytes(uint8_t *buf, int size, void *args) {
int c, l, fd = *(int *)args;
if (fd == -1) {
THROW(ERR_NO_FILE);
}
l = 0;
do {
c = read(fd, buf + l, size - l);
l += c;
if (c == -1) {
THROW(ERR_NO_READ);
}
} while (l < size);
}
static void rng(void) {
uint8_t buffer[64];
int fd = open("/dev/urandom", O_RDONLY);
BENCH_BEGIN("rand_seed") {
rand_bytes(buffer, k);
BENCH_ADD(rand_seed(&test_bytes, (void *)&fd));
} BENCH_END;
for (int k = 1; k <= sizeof(buffer); k *= 2) {
BENCH_BEGIN("rand_bytes (from 1 to 256)") {
BENCH_ADD(rand_bytes(buffer, k));
} BENCH_END;
}
close(fd);
}
#else
static void rng(void) {
uint8_t buffer[256];
BENCH_BEGIN("rand_seed (20)") {
rand_bytes(buffer, 20);
BENCH_ADD(rand_seed(buffer, 20));
} BENCH_END;
for (int k = 1; k <= sizeof(buffer); k *= 2) {
BENCH_BEGIN("rand_bytes (from 1 to 256)") {
BENCH_ADD(rand_bytes(buffer, k));
} BENCH_END;
}
}
#endif
int main(void) {
if (core_init() != STS_OK) {
core_clean();
return 1;
}
conf_print();
util_banner("Benchmarks for the RAND module:", 0);
util_banner("Utilities:\n", 0);
rng();
core_clean();
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../solaris-cc/qplatformdefs.h"
|
/****************************************************************************
**
** Copyright (C) 2010 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:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef XBELREADER_H
#define XBELREADER_H
#include <QIcon>
#include <QXmlStreamReader>
QT_BEGIN_NAMESPACE
class QTreeWidget;
class QTreeWidgetItem;
QT_END_NAMESPACE
//! [0]
class XbelReader
{
public:
//! [1]
XbelReader(QTreeWidget *treeWidget);
//! [1]
bool read(QIODevice *device);
QString errorString() const;
private:
//! [2]
void readXBEL();
void readTitle(QTreeWidgetItem *item);
void readSeparator(QTreeWidgetItem *item);
void readFolder(QTreeWidgetItem *item);
void readBookmark(QTreeWidgetItem *item);
QTreeWidgetItem *createChildItem(QTreeWidgetItem *item);
QXmlStreamReader xml;
QTreeWidget *treeWidget;
//! [2]
QIcon folderIcon;
QIcon bookmarkIcon;
};
//! [0]
#endif
|
/**
* Copyright (C) 2010 Ubixum, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
**/
#include <autovector.h>
void ep4isoerr_isr() __interrupt EP4ISOERR_ISR {}
|
//
// Copyright (C) 2007-2011 SIPez LLC. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007-2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
// Author: Alexander Chemeris <Alexander DOT Chemeris AT SIPez DOT com>
#ifndef _MprRtpDispatcherIpAffinity_h_
#define _MprRtpDispatcherIpAffinity_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <mp/MprRtpDispatcher.h>
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class MpRtpStream;
class MprDejitter;
/**
* @brief Class for RTP stream dispatcher abstraction.
*/
class MprRtpDispatcherIpAffinity : public MprRtpDispatcher
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor
MprRtpDispatcherIpAffinity(const UtlString& rName, int connectionId);
/**<
* @param name - name of this RTP dispatcher.
* @param connectionId - connection ID to be used in notifications.
* @param pMsgQ - notification dispatcher to send notifications to.
*/
/// Destructor
virtual
~MprRtpDispatcherIpAffinity();
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// @copydoc MprRtpDispatcher::pushPacket()
OsStatus pushPacket(MpRtpBufPtr &pRtp);
/// @copydoc MprRtpDispatcher::checkRtpStreams()
void checkRtpStreamsActivity();
/// @copydoc MprRtpDispatcher::connectOutput()
UtlBoolean connectOutput(int outputIdx, MpResource* pushRtpToResource);
/// @copydoc MprRtpDispatcher::disconnectOutput()
UtlBoolean disconnectOutput(int outputIdx);
/// Inform this object of its sibling ToNet's destination.
void setPreferredIp(unsigned long address, int port);
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
MpRtpStream mRtpStream; ///< Our RTP stream instance (single for this
///< dispatcher)
MprDejitter *mpDejitter; ///< Dejitter for our single decoder.
UtlBoolean mPrefSsrcValid; ///< Is mPrefSsrc valid?
unsigned long mRtpDestIp; ///< Where this connection is sending TO
int mRtpDestPort; ///< Port " "
int mNumPushed; ///< Total RTP pkts received
int mNumDropped; ///< RTP pkts dropped due to SSRC mismatch
int mTotalWarnings; ///< Total RTP pkts from non-pref'd
int mNumWarnings; ///< Current consecutive " "
int mNumNonPrefPackets; ///< Consecutive pkts from non-pref'd
int mRtpDestMatchIpOnlySsrc; ///< Last SSRC from same IP as pref'd
UtlBoolean mRtpDestMatchIpOnlySsrcValid;
int mRtpOtherSsrc; ///< Last SSRC from diff IP as pref'd
UtlBoolean mRtpOtherSsrcValid;
static const int SSRC_SWITCH_MISMATCH_COUNT;
/// Set SSRC we want to receive.
int setPrefSsrc(unsigned int newSsrc);
/// Get SSRC we want to receive.
RtpSRC getPrefSsrc(void);
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Copy constructor (not implemented for this class)
MprRtpDispatcherIpAffinity(const MprRtpDispatcherIpAffinity& rMprRtpDispatcherIpAffinity);
/// Assignment operator (not implemented for this class)
MprRtpDispatcherIpAffinity& operator=(const MprRtpDispatcherIpAffinity& rhs);
};
/* ============================ INLINE METHODS ============================ */
#endif // _MprRtpDispatcherIpAffinity_h_
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QDEBUGMESSAGECLIENT_H
#define QDEBUGMESSAGECLIENT_H
#include "qmldebugclient.h"
#include "qmldebug_global.h"
namespace QmlDebug {
class QDebugMessageClientPrivate;
struct QDebugContextInfo
{
int line;
QString file;
QString function;
};
class QMLDEBUG_EXPORT QDebugMessageClient : public QmlDebugClient
{
Q_OBJECT
public:
explicit QDebugMessageClient(QmlDebugConnection *client);
~QDebugMessageClient();
protected:
virtual void stateChanged(State state);
virtual void messageReceived(const QByteArray &);
signals:
void newState(QmlDebug::QmlDebugClient::State);
void message(QtMsgType, const QString &,
const QmlDebug::QDebugContextInfo &);
private:
class QDebugMessageClientPrivate *d;
Q_DISABLE_COPY(QDebugMessageClient)
};
} // namespace QmlDebug
#endif // QDEBUGMESSAGECLIENT_H
|
/*
Copyright (C) 2012 Sebastian Pancratz
Copyright (C) 2013 Mike Hansen
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#ifdef T
#include "templates.h"
void
_TEMPLATE(T, poly_compose) (TEMPLATE(T, struct) * rop,
const TEMPLATE(T, struct) * op1, slong len1,
const TEMPLATE(T, struct) * op2, slong len2,
const TEMPLATE(T, ctx_t) ctx)
{
if (len1 == 1)
TEMPLATE(T, set) (rop + 0, op1 + 0, ctx);
else if (len2 == 1)
_TEMPLATE(T, TEMPLATE(poly_evaluate, T)) (rop + 0, op1, len1, op2 + 0,
ctx);
else if (len1 <= 4)
_TEMPLATE(T, poly_compose_horner) (rop, op1, len1, op2, len2, ctx);
else
_TEMPLATE(T, poly_compose_divconquer) (rop, op1, len1, op2, len2, ctx);
}
void
TEMPLATE(T, poly_compose) (TEMPLATE(T, poly_t) rop,
const TEMPLATE(T, poly_t) op1,
const TEMPLATE(T, poly_t) op2,
const TEMPLATE(T, ctx_t) ctx)
{
const slong len1 = op1->length;
const slong len2 = op2->length;
const slong lenr = (len1 - 1) * (len2 - 1) + 1;
if (len1 == 0)
{
TEMPLATE(T, poly_zero) (rop, ctx);
}
else if (len1 == 1 || len2 == 0)
{
TEMPLATE(T, TEMPLATE(poly_set, T)) (rop, op1->coeffs + 0, ctx);
}
else if (rop != op1 && rop != op2)
{
TEMPLATE(T, poly_fit_length) (rop, lenr, ctx);
_TEMPLATE(T, poly_compose) (rop->coeffs, op1->coeffs, len1,
op2->coeffs, len2, ctx);
_TEMPLATE(T, poly_set_length) (rop, lenr, ctx);
_TEMPLATE(T, poly_normalise) (rop, ctx);
}
else
{
TEMPLATE(T, poly_t) t;
TEMPLATE(T, poly_init2) (t, lenr, ctx);
_TEMPLATE(T, poly_compose) (t->coeffs, op1->coeffs, len1, op2->coeffs,
len2, ctx);
_TEMPLATE(T, poly_set_length) (t, lenr, ctx);
_TEMPLATE(T, poly_normalise) (t, ctx);
TEMPLATE(T, poly_swap) (rop, t, ctx);
TEMPLATE(T, poly_clear) (t, ctx);
}
}
#endif
|
#ifndef AL_ATOMIC_H
#define AL_ATOMIC_H
typedef void *volatile XchgPtr;
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__)
typedef unsigned int RefCount;
inline RefCount IncrementRef(volatile RefCount *ptr)
{ return __sync_add_and_fetch(ptr, 1); }
inline RefCount DecrementRef(volatile RefCount *ptr)
{ return __sync_sub_and_fetch(ptr, 1); }
inline int ExchangeInt(volatile int *ptr, int newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
inline unsigned int xaddl(volatile unsigned int *dest, int incr)
{
unsigned int ret;
__asm__ __volatile__("lock; xaddl %0,(%1)"
: "=r" (ret)
: "r" (dest), "0" (incr)
: "memory");
return ret;
}
typedef unsigned int RefCount;
inline RefCount IncrementRef(volatile RefCount *ptr)
{ return xaddl(ptr, 1)+1; }
inline RefCount DecrementRef(volatile RefCount *ptr)
{ return xaddl(ptr, -1)-1; }
inline int ExchangeInt(volatile int *dest, int newval)
{
int ret;
__asm__ __volatile__("lock; xchgl %0,(%1)"
: "=r" (ret)
: "r" (dest), "0" (newval)
: "memory");
return ret;
}
inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval)
{
int ret;
__asm__ __volatile__("lock; cmpxchgl %2,(%1)"
: "=a" (ret)
: "r" (dest), "r" (newval), "0" (oldval)
: "memory");
return ret == oldval;
}
inline void *ExchangePtr(XchgPtr *dest, void *newval)
{
void *ret;
__asm__ __volatile__(
#ifdef __i386__
"lock; xchgl %0,(%1)"
#else
"lock; xchgq %0,(%1)"
#endif
: "=r" (ret)
: "r" (dest), "0" (newval)
: "memory"
);
return ret;
}
inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
{
void *ret;
__asm__ __volatile__(
#ifdef __i386__
"lock; cmpxchgl %2,(%1)"
#else
"lock; cmpxchgq %2,(%1)"
#endif
: "=a" (ret)
: "r" (dest), "r" (newval), "0" (oldval)
: "memory"
);
return ret == oldval;
}
#elif defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef LONG RefCount;
inline RefCount IncrementRef(volatile RefCount *ptr)
{ return InterlockedIncrement(ptr); }
inline RefCount DecrementRef(volatile RefCount *ptr)
{ return InterlockedDecrement(ptr); }
extern ALbyte LONG_size_does_not_match_int[(sizeof(LONG)==sizeof(int))?1:-1];
inline int ExchangeInt(volatile int *ptr, int newval)
{
union {
volatile int *i;
volatile LONG *l;
} u = { ptr };
return InterlockedExchange(u.l, newval);
}
inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return InterlockedExchangePointer(ptr, newval);
}
inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
union {
volatile int *i;
volatile LONG *l;
} u = { ptr };
return InterlockedCompareExchange(u.l, newval, oldval) == oldval;
}
inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return InterlockedCompareExchangePointer(ptr, newval, oldval) == oldval;
}
#elif defined(__APPLE__)
#include <libkern/OSAtomic.h>
typedef int32_t RefCount;
inline RefCount IncrementRef(volatile RefCount *ptr)
{ return OSAtomicIncrement32Barrier(ptr); }
inline RefCount DecrementRef(volatile RefCount *ptr)
{ return OSAtomicDecrement32Barrier(ptr); }
inline int ExchangeInt(volatile int *ptr, int newval)
{
/* Really? No regular old atomic swap? */
int oldval;
do {
oldval = *ptr;
} while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr));
return oldval;
}
inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
void *oldval;
do {
oldval = *ptr;
} while(!OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr));
return oldval;
}
inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
}
inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr);
}
#else
#error "No atomic functions available on this platform!"
typedef ALuint RefCount;
#endif
#endif /* AL_ATOMIC_H */
|
/*
Copyright (C) 2017 Daniel Schultz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "mpoly.h"
/* !!! this file DOES need to change with new orderings */
/*
compute number of bits required to store user_exp in packed format
the returned number of bits includes space for a zero'd signed bit
*/
flint_bitcnt_t mpoly_exp_bits_required_ui(const ulong * user_exp,
const mpoly_ctx_t mctx)
{
slong i, nfields = mctx->nfields;
ulong max = 0;
if (mctx->deg)
{
for (i = 0; i < nfields - 1; i++)
{
max += user_exp[i];
if (max < user_exp[i])
return 2*FLINT_BITS;
}
}
else
{
for (i = 0; i < nfields; i++)
{
max |= user_exp[i];
}
}
return 1 + FLINT_BIT_COUNT(max);
}
/*
compute number of bits required to store user_exp in packed format
the returned number of bits includes space for a zero'd signed bit
*/
flint_bitcnt_t mpoly_exp_bits_required_ffmpz(const fmpz * user_exp,
const mpoly_ctx_t mctx)
{
slong i, nvars = mctx->nvars;
flint_bitcnt_t exp_bits;
if (mctx->deg)
{
fmpz_t deg;
fmpz_init(deg);
for (i = 0; i < nvars; i++)
{
fmpz_add(deg, deg, user_exp + i);
}
exp_bits = 1 + fmpz_bits(deg);
fmpz_clear(deg);
}
else
{
exp_bits = 0;
for (i = 0; i < nvars; i++)
{
flint_bitcnt_t this_bits = fmpz_bits(user_exp + i);
exp_bits = FLINT_MAX(exp_bits, this_bits);
}
exp_bits += 1;
}
return exp_bits;
}
/*
compute number of bits required to store user_exp in packed format
the returned number of bits includes space for a zero'd signed bit
*/
flint_bitcnt_t mpoly_exp_bits_required_pfmpz(fmpz * const * user_exp,
const mpoly_ctx_t mctx)
{
slong i, nvars = mctx->nvars;
flint_bitcnt_t exp_bits;
if (mctx->deg)
{
fmpz_t deg;
fmpz_init(deg);
for (i = 0; i < nvars; i++)
{
fmpz_add(deg, deg, user_exp[i]);
}
exp_bits = 1 + fmpz_bits(deg);
fmpz_clear(deg);
}
else
{
exp_bits = 0;
for (i = 0; i < nvars; i++)
{
flint_bitcnt_t this_bits = fmpz_bits(user_exp[i]);
exp_bits = FLINT_MAX(exp_bits, this_bits);
}
exp_bits += 1;
}
return exp_bits;
}
|
/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MPANNABLEVIEWPORTMODEL_H
#define MPANNABLEVIEWPORTMODEL_H
#include <mpannablewidgetmodel.h>
class M_CORE_EXPORT MPannableViewportModel : public MPannableWidgetModel
{
Q_OBJECT
M_MODEL_INTERNAL(MPannableViewportModel)
M_MODEL_PROPERTY(bool, autoRange, AutoRange, true, true)
M_MODEL_PROPERTY(bool, clipWidget, ClipWidget, true, true)
};
#endif
|
/*
Copyright (C) 2013 Mike Hansen
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "fq_nmod.h"
void
fq_nmod_gcdinv(fq_nmod_t rop, fq_nmod_t inv, const fq_nmod_t op,
const fq_nmod_ctx_t ctx)
{
nmod_poly_gcdinv(rop, inv, op, ctx->modulus);
}
|
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 SharedMemory_h
#define SharedMemory_h
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/Optional.h>
#include <wtf/RefCounted.h>
#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
#include "Attachment.h"
#include <wtf/text/WTFString.h>
#endif
namespace IPC {
class ArgumentDecoder;
class ArgumentEncoder;
}
#if OS(DARWIN)
namespace WebCore {
class MachSendRight;
}
#endif
namespace WebKit {
class SharedMemory : public RefCounted<SharedMemory> {
public:
enum class Protection {
ReadOnly,
ReadWrite
};
class Handle {
WTF_MAKE_NONCOPYABLE(Handle);
public:
Handle();
~Handle();
bool isNull() const;
void clear();
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, Handle&);
#if USE(UNIX_DOMAIN_SOCKETS)
IPC::Attachment releaseAttachment() const;
void adoptAttachment(IPC::Attachment&&);
#endif
private:
friend class SharedMemory;
#if USE(UNIX_DOMAIN_SOCKETS)
mutable IPC::Attachment m_attachment;
#elif OS(DARWIN)
mutable mach_port_t m_port;
size_t m_size;
#elif OS(WINDOWS)
mutable HANDLE m_handle;
size_t m_size;
#endif
};
static RefPtr<SharedMemory> allocate(size_t);
static RefPtr<SharedMemory> create(void*, size_t, Protection);
static RefPtr<SharedMemory> map(const Handle&, Protection);
#if USE(UNIX_DOMAIN_SOCKETS)
static RefPtr<SharedMemory> wrapMap(void*, size_t, int fileDescriptor);
#endif
#if OS(WINDOWS)
static RefPtr<SharedMemory> adopt(HANDLE, size_t, Protection);
#endif
~SharedMemory();
bool createHandle(Handle&, Protection);
size_t size() const { return m_size; }
void* data() const
{
ASSERT(m_data);
return m_data;
}
#if OS(WINDOWS)
HANDLE handle() const { return m_handle; }
#endif
// Return the system page size in bytes.
static unsigned systemPageSize();
private:
#if OS(DARWIN)
WebCore::MachSendRight createSendRight(Protection) const;
#endif
size_t m_size;
void* m_data;
Protection m_protection;
#if USE(UNIX_DOMAIN_SOCKETS)
Optional<int> m_fileDescriptor;
bool m_isWrappingMap { false };
#elif OS(DARWIN)
mach_port_t m_port;
#elif OS(WINDOWS)
HANDLE m_handle;
#endif
};
};
#endif // SharedMemory_h
|
/***************************************************************************
begin : Thu Jul 02 2009
copyright : (C) 2009 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "typemaker2.h"
#include "tm_typemanager.h"
#include "tm_builder_c.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/pathmanager.h>
int doBuildDefs(GWEN_DB_NODE *dbArgs, const char *fname) {
TYPEMAKER2_TYPEMANAGER *tym;
TYPEMAKER2_BUILDER *tb=NULL;
TYPEMAKER2_TYPE *ty;
GWEN_STRINGLIST *sl;
TYPEMAKER2_TYPE_LIST2 *tlist;
TYPEMAKER2_TYPE_LIST2_ITERATOR *it;
const char *s;
int i;
int rv;
tym=Typemaker2_TypeManager_new();
s=GWEN_DB_GetCharValue(dbArgs, "api", 0, NULL);
if (s && *s)
Typemaker2_TypeManager_SetApiDeclaration(tym, s);
s=GWEN_DB_GetCharValue(dbArgs, "language", 0, "c");
if (s && *s) {
Typemaker2_TypeManager_SetLanguage(tym, s);
if (strcasecmp(s, "c")==0) {
tb=Typemaker2_Builder_C_new();
Typemaker2_Builder_SetTypeManager(tb, tym);
}
else {
DBG_ERROR(GWEN_LOGDOMAIN, "Unsupported language [%s]", s);
return 1;
}
}
else {
DBG_ERROR(GWEN_LOGDOMAIN, "Missing language specification");
return 1;
}
Typemaker2_Builder_SetSourceFileName(tb, fname);
for (i=0; i<99; i++) {
s=GWEN_DB_GetCharValue(dbArgs, "include", i, NULL);
if (s && *s)
Typemaker2_TypeManager_AddFolder(tym, s);
else
break;
}
sl=GWEN_PathManager_GetPaths(GWEN_PM_LIBNAME, GWEN_PM_DATADIR);
if (sl) {
GWEN_STRINGLISTENTRY *se;
se=GWEN_StringList_FirstEntry(sl);
while(se) {
s=GWEN_StringListEntry_Data(se);
if (s) {
GWEN_BUFFER *xbuf;
xbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendString(xbuf, s);
GWEN_Buffer_AppendString(xbuf, "/typemaker2/");
s=Typemaker2_TypeManager_GetLanguage(tym);
if (s && *s)
GWEN_Buffer_AppendString(xbuf, s);
Typemaker2_TypeManager_AddFolder(tym, GWEN_Buffer_GetStart(xbuf));
GWEN_Buffer_free(xbuf);
}
se=GWEN_StringListEntry_Next(se);
}
GWEN_StringList_free(sl);
}
tlist=Typemaker2_Type_List2_new();
rv=Typemaker2_TypeManager_LoadTypeFileNoLookup(tym, fname, tlist);
if (rv<0) {
DBG_ERROR(GWEN_LOGDOMAIN, "Unable to load file [%s] (%d)", fname, rv);
return 2;
}
it=Typemaker2_Type_List2_First(tlist);
if(it) {
ty=Typemaker2_Type_List2Iterator_Data(it);
while(ty) {
/* DEBUG */
#if 0
Typemaker2_TypeManager_Dump(tym, stderr, 2);
#endif
/* only write typedef files */
rv=Typemaker2_Builder_WriteFiles(tb, ty, 1);
if (rv<0) {
DBG_ERROR(GWEN_LOGDOMAIN, "here (%d)", rv);
return 2;
}
/* handle next type */
ty=Typemaker2_Type_List2Iterator_Next(it);
}
Typemaker2_Type_List2Iterator_free(it);
}
Typemaker2_Type_List2_free(tlist);
return 0;
}
int buildDefs(GWEN_DB_NODE *dbArgs) {
int i;
for (i=0; i<99; i++) {
const char *fileName;
fileName=GWEN_DB_GetCharValue(dbArgs, "params", i, NULL);
if (fileName) {
int rv=doBuildDefs(dbArgs, fileName);
if (rv != 0) {
DBG_ERROR(GWEN_LOGDOMAIN, "Error building type from [%s]", fileName);
return 2;
}
}
else {
if (i==0) {
DBG_ERROR(GWEN_LOGDOMAIN, "No input");
return 1;
}
}
}
return 0;
}
|
/*
* Copyright (C) 2014 absurdworlds
*
* License LGPLv3 or later:
* GNU Lesser GPL version 3 <http://gnu.org/licenses/lgpl-3.0.html>
* This is free software: you are free to change and redistribute it.
* There is NO WARRANTY, to the extent permitted by law.
*/
#ifndef _aw_SettingsLoader_
#define _aw_SettingsLoader_
#include <string>
#include <aw/common/types.h>
#include <aw/core/core.h>
#include <aw/core/SettingsManager.h>
namespace aw {
namespace core {
class SettingsManager;
/*!
* Helper class to load settings from a known file format
*/
class SettingsLoader {
public:
//! Virtual destructor
virtual ~SettingsLoader()
{
}
/*!
* Load settings and transfer them to \a manager
* \param manager Settings manager which will store settings.
*/
virtual void loadSettings() = 0;
};
} // namespace core
} // namespace aw
#endif//_aw_SettingsLoader_
|
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3DRENDER_RENDER_TRANSFORM_H
#define QT3DRENDER_RENDER_TRANSFORM_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <Qt3DRender/private/backendnode_p.h>
#include <QtGui/qquaternion.h>
#include <QtGui/qvector3d.h>
#include <Qt3DCore/private/matrix4x4_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
class Renderer;
class TransformManager;
class Q_3DRENDERSHARED_PRIVATE_EXPORT Transform : public BackendNode
{
public:
Transform();
void cleanup();
Matrix4x4 transformMatrix() const;
QVector3D scale() const;
QQuaternion rotation() const;
QVector3D translation() const;
void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) final;
private:
void updateMatrix();
Matrix4x4 m_transformMatrix;
QQuaternion m_rotation;
QVector3D m_scale;
QVector3D m_translation;
};
} // namespace Render
} // namespace Qt3DRender
QT_END_NAMESPACE
#endif // QT3DRENDER_RENDER_TRANSFORM_H
|
/**
* Copyright 2013 Felix Schmitt
*
* This file is part of libSplash.
*
* libSplash is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* 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.
*
* libSplash 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 and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with libSplash.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PARALLEL_DOMAINSTEST_H
#define PARALLEL_DOMAINSTEST_H
#include <cppunit/extensions/HelperMacros.h>
#include "splash/splash.h"
using namespace splash;
class Parallel_DomainsTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(Parallel_DomainsTest);
CPPUNIT_TEST(testGridDomains);
CPPUNIT_TEST(testPolyDomains);
CPPUNIT_TEST(testAppendDomains);
CPPUNIT_TEST_SUITE_END();
public:
Parallel_DomainsTest();
virtual ~Parallel_DomainsTest();
private:
void testGridDomains();
void testPolyDomains();
void testAppendDomains();
void subTestGridDomains(int32_t iteration,
int currentMpiRank,
const Dimensions mpiSize, const Dimensions mpiPos,
const Dimensions gridSize, uint32_t dimensions, MPI_Comm mpiComm);
void subTestPolyDomains(int32_t iteration,
int currentMpiRank,
const Dimensions mpiSize, const Dimensions mpiPos,
const uint32_t numElements, uint32_t dimensions, MPI_Comm mpiComm);
int totalMpiSize;
int myMpiRank;
ColTypeInt ctInt;
ColTypeFloat ctFloat;
ParallelDomainCollector *parallelDomainCollector;
};
#endif /* PARALLEL_DOMAINSTEST_H */
|
/*
* $Revision: 3556 $
*
* last checkin:
* $Author: beyer $
* $Date: 2013-06-07 19:36:11 +0200 (Fri, 07 Jun 2013) $
***************************************************************/
/** \file
* \brief Declaration of class PlanarLeafKey.
*
* \author Sebastian Leipert
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.txt in the root directory of the OGDF installation for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* \see http://www.gnu.org/copyleft/gpl.html
***************************************************************/
#ifdef _MSC_VER
#pragma once
#endif
#ifndef OGDF_PLANAR_LEAFKEY_H
#define OGDF_PLANAR_LEAFKEY_H
#include <ogdf/basic/Graph.h>
#include <ogdf/internal/planarity/PQLeafKey.h>
namespace ogdf {
template<class X>
class PlanarLeafKey : public PQLeafKey<edge,X,bool>
{
public:
PlanarLeafKey(edge e) : PQLeafKey<edge,X,bool>(e) { }
virtual ~PlanarLeafKey() { }
ostream &print(ostream &os)
{
int sId = this->m_userStructKey->source()->index();
int tId = this->m_userStructKey->target()->index();
os << " (" << sId << "," << tId << ")";
return os;
}
};
}
#endif
|
// 2015-02-04T15:54+08:00
#ifndef GET_COMMAND_H_
#define GET_COMMAND_H_
#include "container_command.h"
#define GET_COMMAND_STR U("get")
class GetCommand : public ContainerCommand {
public:
GetCommand();
virtual bool parse(const std::vector<utility::string_t> &vargs);
virtual bool run(AzureCloudStorageService *storage_service);
virtual void help() const;
private:
utility::string_t blob_name_;
utility::string_t target_local_file_name_;
utility::size64_t size_;
};
#endif // GET_COMMAND_H_ |
#ifndef LARUL_H
#define LARUL_H
// General include file for LARUL
#include "LARULTuning.h"
#include "Util/Delegate.h"
#include "Util/MethodClosure.h"
#include "Util/DefaultParameterClosure.h"
#include "Util/LError.h"
#include "Util/Vector.h"
#include "Util/Unused.h"
#include "Timing/Clock.h"
#include "Timing/IntervalTimer.h"
#include "Timing/TimedIncrementer.h"
#include "Threading/Mutex.h"
#include "Threading/Thread.h"
#include "Threading/Condition.h"
#include "Threading/MessageQueue.h"
#include "Threading/ObjectLock.h"
#include "Sensing/IAngularInput.h"
#include "Sensing/IBooleanInput.h"
#include "Sensing/IScalarInput.h"
#include "Sensing/IXInput.h"
#include "Sensing/IXYInput.h"
#include "Sensing/IMotionLimit.h"
#include "Sensing/Nav6/Nav6.h"
#include "Sensing/Nav6/Nav6YawAngularInput.h"
#ifndef NO_WPILIB
#include "Sensing/CANTalon/CANTalonSwitchMotionLimit.h"
#include "Sensing/DIO/DIOSwitchLimit.h"
#endif
#include "Networking/TCP.h"
#include "Networking/TCPSocket.h"
#include "Networking/TCPServer.h"
#include "Networking/TCPServerSocket.h"
#include "Networking/UDP.h"
#include "Networking/UDPSocket.h"
#include "Motion/IActuatorDrive.h"
#include "Motion/IMotionSource.h"
#include "Motion/IOffsetDrive.h"
#include "Motion/IOffsetSource.h"
#include "Motion/IPositionDrive.h"
#include "Motion/IPositionSource.h"
#include "Motion/IRateDrive.h"
#include "Motion/IRateSource.h"
#include "Memory/AlignOf.h"
#include "Memory/CachingAllocator.h"
#include "Memory/IAllocSpec.h"
#include "Memory/SingleAllocSpec.h"
#include "Math/Matrix33.h"
#include "Math/Quaternion.h"
#include "Math/Vector3.h"
#include "Logging/Logger.h"
#include "Hardware/HWSystem.h"
#include "Hardware/Power/PowerUsageSpec.h"
#include "Hardware/Drive/IDriveBase.h"
#include "Hardware/Drive/IDriveTrain.h"
#include "Hardware/Drive/IQuadRectangularDriveBase.h"
#include "Hardware/Drive/LinearSlide.h"
#include "Hardware/Drive/MecanumDriveTrain.h"
#include "Hardware/Drive/Filters/RotationFilter.h"
#include "Hardware/Drive/Filters/MecanumXYSlewFilter.h"
#include "Hardware/Drive/Filters/MecanumVelocityProfile.h"
#include "Hardware/Drive/Filters/MecanumMagDirOrientationOffset.h"
#ifndef NO_WPILIB
#include "Hardware/Power/IPowerProfiled.h"
#include "Hardware/Power/IPowerScalable.h"
#include "Hardware/Power/Power.h"
#include "Hardware/Power/PowerManager.h"
#include "Hardware/Power/PowerProfile.h"
#include "Hardware/Motors/CANJaguarConfiguration.h"
#include "Hardware/Motors/CANTalonConfiguration.h"
#include "Hardware/Drive/CANTalonPositionServo.h"
#include "Hardware/Drive/CANTalonQuadDriveBase.h"
#include "hardware/Drive/TalonQuadDriveBase.h"
#endif
#include "Events/IEvent.h"
#include "Events/EventController.h"
#include "DSP/DSPFilter.h"
#include "DSP/LookbackLowpassFilter.h"
#ifndef NO_WPILIB
#include "DriverStation/JoystickButtonInput.h"
#include "DriverStation/JoystickXYInput.h"
#include "DriverStation/NumericStepper.h"
#endif
//#include "Debug/LARULDebug.h"
//#include "Debug/LDebugServer.h"
#include "Config/ConfigFile.h"
#include "Config/ConfigSection.h"
#include "COM/ISerialInterface.h"
#ifndef NO_WPILIB
#include "COM/WPICom.h"
#endif
#include "Behaviors/IBehavior.h"
#include "Behaviors/BehaviorController.h"
#endif
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2014. *
* *
* This program is free software. You may use, modify, and redistribute 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 without any warranty. See *
* the file COPYING.gpl-v3 for details. *
\*************************************************************************/
/* Listing 46-2 */
/* svmsg_send.c
Usage: svmsg_send [-n] msqid msg-type [msg-text]
Experiment with the msgsnd() system call to send messages to a
System V message queue.
See also svmsg_receive.c.
*/
#include <sys/types.h>
#include <sys/msg.h>
#include "tlpi_hdr.h"
#define MAX_MTEXT 1024
struct mbuf {
long mtype; /* Message type */
char mtext[MAX_MTEXT]; /* Message body */
};
static void /* Print (optional) message, then usage description */
usageError(const char *progName, const char *msg)
{
if (msg != NULL)
fprintf(stderr, "%s", msg);
fprintf(stderr, "Usage: %s [-n] msqid msg-type [msg-text]\n", progName);
fprintf(stderr, " -n Use IPC_NOWAIT flag\n");
exit(EXIT_FAILURE);
}
int
main(int argc, char *argv[])
{
int msqid, flags, msgLen;
struct mbuf msg; /* Message buffer for msgsnd() */
int opt; /* Option character from getopt() */
/* Parse command-line options and arguments */
flags = 0;
while ((opt = getopt(argc, argv, "n")) != -1) {
if (opt == 'n')
flags |= IPC_NOWAIT;
else
usageError(argv[0], NULL);
}
if (argc < optind + 2 || argc > optind + 3)
usageError(argv[0], "Wrong number of arguments\n");
msqid = getInt(argv[optind], 0, "msqid");
msg.mtype = getInt(argv[optind + 1], 0, "msg-type");
if (argc > optind + 2) { /* 'msg-text' was supplied */
msgLen = strlen(argv[optind + 2]) + 1;
if (msgLen > MAX_MTEXT)
cmdLineErr("msg-text too long (max: %d characters)\n", MAX_MTEXT);
memcpy(msg.mtext, argv[optind + 2], msgLen);
} else { /* No 'msg-text' ==> zero-length msg */
msgLen = 0;
}
/* Send message */
if (msgsnd(msqid, &msg, msgLen, flags) == -1)
errExit("msgsnd");
exit(EXIT_SUCCESS);
}
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_GETOPT_H
#define PHP_GETOPT_H
#include "php.h"
#ifdef NETWARE
/*
As NetWare LibC has optind and optarg macros defined in unistd.h our local variables were getting mistakenly preprocessed so undeffing optind and optarg
*/
#undef optarg
#undef optind
#endif
/* Define structure for one recognized option (both single char and long name).
* If short_open is '-' this is the last option. */
typedef struct _opt_struct {
char opt_char;
int need_param;
char * opt_name;
} opt_struct;
BEGIN_EXTERN_C()
/* holds the index of the latest fetched element from the opts array */
extern PHPAPI int php_optidx;
PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char **optarg, int *optind, int show_err, int arg_start);
END_EXTERN_C()
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.