text
stringlengths 4
6.14k
|
|---|
/*
* Copyright (c) 2012 Mellanox Technologies. All rights reserved
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* openfabric.org BSD license below:
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _LINUX_ETH_IB_IPOIB_H
#define _LINUX_ETH_IB_IPOIB_H
#include <net/sch_generic.h>
struct eipoib_cb_data {
/*
* extra care taken not to collide with the usage done
* by the qdisc layer in struct skb cb data.
*/
struct qdisc_skb_cb qdisc_cb;
struct { /* must be <= 20 bytes */
u32 sqpn;
struct napi_struct *napi;
u16 slid;
u8 data[6];
} __packed rx;
};
#define IPOIB_HANDLER_CB(skb) ((struct eipoib_cb_data *)(skb)->cb)
#endif /* _LINUX_ETH_IB_IPOIB_H */
|
/**
* LinkedLists Data Structure
**/
/*future feature to include
* Passing a function as an argument.
* Passing a function which takes input templates
* */
#ifndef __LINKEDLISTS__
#define __LINKEDLISTS__
#include<iostream>
struct Nodel
{
Nodel(int keyv):key(keyv){Nodel();}
Nodel():next(NULL),key(-1){}
int key;
Nodel* next;
};
class LinkedLists
{
public:
LinkedLists(){
head = NULL;
}
void addNode(int x);
void orderlist();
int printlist();
int size();
private:
Nodel* head;
};
#endif
|
/*
CVSNT Generic API
Copyright (C) 2004 Tony Hoyle and March-Hare Software Ltd
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.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FILEACCESS__H
#define FILEACCESS__H
#include <sys/types.h>
#ifdef _WIN32
#include <windows.h>
#ifndef loff_t
#define loff_t __int64
#endif
#endif
#include "cvs_string.h"
#ifdef _WIN32
#include <windows.h>
#define ISDIRSEP(c) (c=='/' || c=='\\')
#else
#ifndef ISDIRSEP
#define ISDIRSEP(c) ((c) == '/')
#endif
#endif
class CFileAccess
{
public:
enum SeekEnum
{
seekBegin,
seekCurrent,
seekEnd
};
enum TypeEnum
{
typeNone,
typeFile,
typeDirectory,
typeDevice,
typeSymlink,
typeOther
};
CVSAPI_EXPORT CFileAccess();
CVSAPI_EXPORT virtual ~CFileAccess();
CVSAPI_EXPORT bool open(const char *filename, const char *mode);
CVSAPI_EXPORT bool open(FILE *file);
CVSAPI_EXPORT bool close();
CVSAPI_EXPORT bool isopen();
CVSAPI_EXPORT bool getline(cvs::string& line);
CVSAPI_EXPORT bool getline(char *line, size_t length);
CVSAPI_EXPORT bool putline(const char *line);
CVSAPI_EXPORT size_t read(void *buf, size_t length);
CVSAPI_EXPORT size_t write(const void *buf, size_t length);
CVSAPI_EXPORT loff_t length();
static CVSAPI_EXPORT void make_directories (const char *name);
#ifdef _WIN32
CVSAPI_EXPORT bool copyfile(const char *ExistingFileName, const char *NewFileName, bool FailIfExists);
#endif
CVSAPI_EXPORT loff_t pos();
CVSAPI_EXPORT bool eof();
CVSAPI_EXPORT bool seek(loff_t pos, SeekEnum whence);
static CVSAPI_EXPORT cvs::string tempdir();
static CVSAPI_EXPORT cvs::string tempfilename(const char *prefix);
static CVSAPI_EXPORT bool remove(const char *file, bool recursive = false);
static CVSAPI_EXPORT bool rename(const char *from, const char *to);
static CVSAPI_EXPORT bool exists(const char *file);
static CVSAPI_EXPORT TypeEnum type(const char *file);
static CVSAPI_EXPORT bool absolute(const char *file);
static CVSAPI_EXPORT int uplevel(const char *file);
static CVSAPI_EXPORT cvs::string mimetype(const char *filename);
#ifdef _WIN32
static CVSAPI_EXPORT void Win32SetUtf8Mode(bool bUtf8Mode);
struct CVSAPI_EXPORT Win32Wide
{
Win32Wide(const char *fn);
~Win32Wide();
operator const wchar_t *() { return pbuf; }
private:
wchar_t *pbuf, buf[32];
};
struct CVSAPI_EXPORT Win32Narrow
{
Win32Narrow(const wchar_t *fn);
~Win32Narrow();
operator const char *() { return pbuf; };
private:
char *pbuf, buf[32];
};
#endif
protected:
FILE *m_file;
#ifdef _WIN32
static void _tmake_directories(const char *name, const TCHAR *fn);
static void _dosmaperr(DWORD dwErr);
static cvs::wstring wtempdir();
static bool _remove(cvs::wstring& path);
static bool m_bUtf8Mode;
#endif
};
#endif
|
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
*
* PrimeBase Media Stream for MySQL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Original author: Paul McCullagh (H&G2JCtL)
* Continued development: Barry Leslie
*
* 2007-05-24
*
* CORE SYSTEM:
* Basic file I/O.
*
*/
#pragma once
#ifndef __CSSOCKET_H__
#define __CSSOCKET_H__
#include <stdio.h>
#include "CSDefs.h"
#include "CSPath.h"
#include "CSException.h"
#include "CSMemory.h"
#include "CSMutex.h"
class CSOutputStream;
class CSInputStream;
#define CS_SOCKET_ADDRESS_SIZE 300
/* This is only required if you do
* not use an output buffer stream!
*/
//#define CS_USE_OUTPUT_BUFFER
#ifdef CS_USE_OUTPUT_BUFFER
#ifdef DEBUG
#define CS_OUTPUT_BUFFER_SIZE 80
#define CS_MIN_WRITE_SIZE 40
#else
#define CS_OUTPUT_BUFFER_SIZE (4*1024)
#define CS_MIN_WRITE_SIZE (1500)
#endif
#endif
class CSSocket : public CSRefObject {
public:
CSSocket(): iHandle(-1), iHost(NULL), iService(NULL), iIdentity(NULL), iPort(0), iTimeout(0) {
#ifdef CS_USE_OUTPUT_BUFFER
iDataLen = 0;
#endif
}
virtual ~CSSocket() {
close();
}
void setTimeout(uint32_t milli_sec);
CSOutputStream *getOutputStream();
CSInputStream *getInputStream();
virtual void formatAddress(size_t size, char *address);
/*
* Publish a listener:
*/
virtual void publish(char *service, int default_port);
/*
* Accept a connection from a listening socket:
*/
virtual void open(CSSocket *listener);
/*
* Connect to a listening socket.
*/
virtual void open(char *address, int default_port);
/*
* Close the socket.
*/
virtual void close();
/*
* Read at least one byte from the socket.
* This function returns 0 on EOF.
* If the function returns at least
* one byte, then you must call the function
* again, there may be more data available.
*
* Note: Errors on the socket do not cause
* an exception!
*/
virtual size_t read(void *data, size_t size);
/*
* Returns -1 on EOF!
* Otherwize it returns a character value >= 0
* Just like read, error on the socket do
* not throw an exception.
*/
virtual int read();
/*
* Look at the next character in the file without
* taking from the input.
*/
virtual int peek();
/*
* Write the given number of bytes.
* Throws IOException if an error occurs.
*/
virtual void write(const void *data, size_t size);
/*
* Write a character to the file.
*/
virtual void write(char ch);
/*
* Flush the data written.
*/
virtual void flush();
virtual const char *identify();
static void initSockets();
static CSSocket *newSocket();
private:
void throwError(const char *func, const char *file, int line, char *address, int err);
void throwError(const char *func, const char *file, int line, int err);
void setNoDelay();
void setNonBlocking();
void setBlocking();
void openInternal();
void writeBlock(const void *data, size_t len);
int timeoutRead(CSThread *self, void *buffer, size_t length);
int iHandle;
char *iHost;
char *iService;
char *iIdentity;
int iPort;
uint32_t iTimeout;
#ifdef CS_USE_OUTPUT_BUFFER
char iOutputBuffer[CS_OUTPUT_BUFFER_SIZE];
size_t iDataLen;
#endif
};
#endif
|
//-----------------------------------------------------------------------------
// File: DesignInstantiationEditor.h
//-----------------------------------------------------------------------------
// Project: Kactus2
// Author: Esko Pekkarinen
// Date: 26.01.2016
//
// Description:
// Editor for design configuration instantiation.
//-----------------------------------------------------------------------------
#ifndef DESIGNINSTANTIATIONEDITOR_H
#define DESIGNINSTANTIATIONEDITOR_H
#include <editors/ComponentEditor/itemeditor.h>
#include <common/widgets/vlnvEditor/vlnveditor.h>
class NameGroupEditor;
class ParameterFinder;
class ExpressionParser;
class DesignInstantiation;
class ListParameterFinder;
class ExpressionFormatter;
class DesignCompletionModel;
class InstantiationConfigurableElementEditor;
//-----------------------------------------------------------------------------
//! Editor for design configuration instantiation.
//-----------------------------------------------------------------------------
class DesignInstantiationEditor : public ItemEditor
{
Q_OBJECT
public:
/*!
* Constructor.
*
* @param [in] component The component being edited.
* @param [in] instantiation The instantiation being edited.
* @param [in] libHandler The available IP-XACT library.
* @param [in] componentParameterFinder Finds the parameters contained within the component.
* @param [in] parent The parent widget.
*/
DesignInstantiationEditor(QSharedPointer<Component> component,
QSharedPointer<DesignInstantiation> instantiation, LibraryInterface* libHandler,
QSharedPointer<ParameterFinder> componentParameterFinder, QWidget* parent);
//! Destructor.
virtual ~DesignInstantiationEditor();
//! Reload the information from the model to the editor.
virtual void refresh();
protected:
//! Handler for widget's show event.
virtual void showEvent(QShowEvent* event);
private slots:
//! Handler for changes in design configuration reference.
void onHierRefChange();
private:
// Disable copying.
DesignInstantiationEditor(DesignInstantiationEditor const& rhs);
DesignInstantiationEditor& operator=(DesignInstantiationEditor const& rhs);
//! Setup the layout.
void setupLayout();
/*!
* Setup the parameters as configurable element values.
*/
void setupParametersAsConfigurableElements();
//-----------------------------------------------------------------------------
// Data.
//-----------------------------------------------------------------------------
//! The design instantiation being edited.
QSharedPointer<DesignInstantiation> instantiation_;
//! Editor to set the name, display name and description of the view.
NameGroupEditor* nameGroupEditor_;
//! VLNV editor for the hierarchy reference.
VLNVEditor* designEditor_;
//! The configurable element value editor.
InstantiationConfigurableElementEditor* elementEditor_;
//! Finder for design parameters.
QSharedPointer<ListParameterFinder> designParameterFinder_;
};
//-----------------------------------------------------------------------------
#endif // DESIGNINSTANTIATIONEDITOR_H
|
/*
* variables.h:
* Gtkdialog - A small utility for fast and easy GUI building.
* Copyright (C) 2003-2007 László Pere <pipas@linux.pte.hu>
* Copyright (C) 2011-2012 Thunor <thunorsif@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef VARIABLES_H
#define VARIABLES_H
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gtkdialog.h"
#include "attributes.h"
#include "automaton.h"
#define NAMELEN 512
typedef struct _variable {
char Name[ NAMELEN+1 ]; /* The name of the variable */
GtkWidget *Widget; /* The pointer to the widget */
int window_id; /* The id of the owning window */
int Type; /* The type of the widget */
AttributeSet *Attributes; /* Attributes for Widget */
int row, column; /* Selected items position. */
int ncolumns; /* How many columns is in it. */
struct _variable *left; /* The pointer used in to or- */
struct _variable *right; /* ganise the Btree */
tag_attr *widget_tag_attr; /* Tag attributes of the widget. */
int autonamed; /* have a default name? */
} variable;
/* Function prototypes */
variable *variables_new_with_widget(AttributeSet *Attr,
tag_attr *widget_tag_attr, GtkWidget *widget, int type);
variable *variables_set_attributes(const char *name, AttributeSet *a);
variable *variables_set_row_column(const char *name, int row, int column);
variable *variables_set_value(const char *name, const char *value);
variable *variables_save(const char *name);
variable *variables_refresh(const char *name);
variable *variables_enable(const char *name);
variable *variables_disable(const char *name);
variable *variables_show(const char *name);
variable *variables_hide(const char *name);
variable *variables_activate(const char *name);
variable *variables_grabfocus(const char *name);
variable *variables_presentwindow(const char *name);
variable *variables_get_by_name(const char *name);
gint variables_count_widgets(void);
void variables_drop_by_window_id(variable *actual, gint window_id);
variable *find_variable_by_widget(GtkWidget *widget);
void variables_initialize_all(void);
void variables_export_all(void);
void print_variables(variable *actual);
int append_fromto_variable(const char *from, const char *to);
variable *variables_clear(const char *name);
int remove_selected_variable(const char *name);
#endif
|
#ifndef __rozofs_rcmd_status_e2String_h__
#define __rozofs_rcmd_status_e2String_h__
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/*___________________________________________________________________
Generated by enum2String.py
Date : Thursday 2017 July 27, 15:05:56
Command line :
../../tools/enum2String.py -f rozofs_rcmd.h -n rozofs_rcmd_status_e -c 19
____________________________________________________________________
*/
/*_________________________________________________________________
* Builds a string from an integer value supposed to be within
* the enumerated list rozofs_rcmd_status_e
*
* @param x : value from rozofs_rcmd_status_e to translate into a string
*
* The input value is translated into a string deduced from the enum
* definition. When the input value do not fit any of the predefined
* values, "??" is returned
*
* @return A char pointer to the constant string or "??"
*_________________________________________________________________*/
static inline char * rozofs_rcmd_status_e2String (rozofs_rcmd_status_e x) {
switch(x) {
case rozofs_rcmd_status_cmd : return("cmd");
case rozofs_rcmd_status_success : return("success");
case rozofs_rcmd_status_failed : return("failed");
case rozofs_rcmd_status_unexpected_command : return("unexpected command");
case rozofs_rcmd_status_no_connection : return("no connection");
case rozofs_rcmd_status_remote_disconnection : return("remote disconnection");
case rozofs_rcmd_status_protocol_error : return("protocol error");
case rozofs_rcmd_status_missing_param : return("missing param");
case rozofs_rcmd_status_message_too_big : return("message too big");
case rozofs_rcmd_status_out_of_memory : return("out of memory");
case rozofs_rcmd_status_server_error : return("server error");
case rozofs_rcmd_status_local_error : return("local error");
case rozofs_rcmd_status_no_such_file : return("no such file");
case rozofs_rcmd_status_open_failure : return("open failure");
case rozofs_rcmd_status_read_failure : return("read failure");
case rozofs_rcmd_status_max : return("max");
/* Unexpected value */
default: return "??";
}
}
#ifdef __cplusplus
}
#endif
#endif
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source 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 for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//
/*
=======================================================================
CREDITS
=======================================================================
*/
#include "ui_local.h"
typedef struct {
menuframework_s menu;
} creditsmenu_t;
static creditsmenu_t s_credits;
/*
=================
UI_CreditMenu_Key
=================
*/
static sfxHandle_t UI_CreditMenu_Key( int key ) {
if( key & K_CHAR_FLAG ) {
return 0;
}
trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );
return 0;
}
/*
===============
UI_CreditMenu_Draw
===============
*/
static void UI_CreditMenu_Draw( void ) {
int y;
y = 12;
y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "Thank you for playing", UI_CENTER|UI_SMALLFONT, color_white );
y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE;
UI_DrawProportionalString( 320, y, "OpenArena", UI_CENTER|UI_SMALLFONT, color_white );
y += SMALLCHAR_HEIGHT;
UI_DrawString( 320, y, "Click or press any key to quit", UI_CENTER|UI_SMALLFONT, color_red );
}
/*
===============
UI_CreditMenu
===============
*/
void UI_CreditMenu( void ) {
memset( &s_credits, 0 ,sizeof(s_credits) );
s_credits.menu.draw = UI_CreditMenu_Draw;
s_credits.menu.key = UI_CreditMenu_Key;
s_credits.menu.fullscreen = qtrue;
UI_PushMenu ( &s_credits.menu );
}
|
/* Bongo Project licensing applies to this file, see COPYING
* (C) 2007 Alex Hudson
*/
/** \file
* Implementation of XPL hash API: access to gcrypt's MD5 and SHA1 algorithms
*/
#include <config.h>
#include <libintl.h>
#include <xplhash.h>
#include <memmgr.h>
#include <gcrypt.h>
#include <libintl.h>
#include <locale.h>
GCRY_THREAD_OPTION_PTHREAD_IMPL;
/**
* Initialise the XPL library. Should be called once in each program that
* uses XPL.
*/
void
XplInit(void)
{
XplHashInit();
// initialize gettext
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
}
/**
* Initialise the hashing subsystem for a program. This is usually part of
* the XplInit() process - this is sort-of private.
*/
void
XplHashInit(void)
{
//const char *gcry_version;
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
//gcry_version = gcry_check_version(NULL);
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, XPL_DEFAULT_RANDSEED_PATH);
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
}
/**
* Create a new context to start a hash digest.
* \param ctx xpl_hash_context to use
* \param type Hashing algorithm to use
* \return A new hash context for further use
*/
void
XplHashNew(xpl_hash_context *ctx, xpl_hash_type type)
{
ctx->type = type;
switch(type) {
case XPLHASH_MD5:
ctx->buffer_size = XPLHASH_MD5BYTES_LENGTH;
break;
case XPLHASH_SHA1:
ctx->buffer_size = XPLHASH_SHA1BYTES_LENGTH;
break;
default:
// unknown hash type - FIXME: ERROR
ctx->buffer_size = 0;
}
gcry_md_open(&ctx->gcrypt_context, type, 0);
}
/**
* Write data into the context to be hashed.
* \param context Hash context to be used
* \param buffer Pointer to the data to be written
* \param length Amount of data from buffer to be written
*/
void
XplHashWrite(xpl_hash_context *context, const void *buffer, size_t length)
{
gcry_md_write(context->gcrypt_context, buffer, length);
}
/**
* Finalise the hash, and return the hash in raw format
* See XplHashFinal()
* \param context Hash context to be used
* \param buffer Buffer into which the hash will be written
* \param length Amount of data to write
*/
void
XplHashFinalBytes(xpl_hash_context *context, unsigned char *buffer, size_t length)
{
memcpy(buffer, gcry_md_read(context->gcrypt_context, 0), min(context->buffer_size, length));
gcry_md_close(context->gcrypt_context);
}
/**
* Finalise the hash, and return the hash encoded in string format
* See XplHashFinalBytes()
* \param context Hash context to be used
* \param strcase Whether or not the string should use upper case
* \param buffer Buffer into which the hash will be written
* \param length Amount of data from buffer to be written
*/
void
XplHashFinal(xpl_hash_context *context, xpl_hash_stringcase strcase, char *buffer, size_t length)
{
char format[5];
unsigned char *digest;
char *p;
unsigned int i;
memcpy(format, "%02X\0", 5);
if (strcase == XPLHASH_LOWERCASE)
format[3] = 'x';
digest = MemMalloc(context->buffer_size);
memcpy(digest, gcry_md_read(context->gcrypt_context, 0), context->buffer_size);
gcry_md_close(context->gcrypt_context);
for (i = 0, p = buffer; i < context->buffer_size && p < buffer+length-1; i++, p += 2) {
sprintf((char *)p, format, digest[i]);
}
buffer[length-1] = 0;
MemFree(digest);
}
/**
* Write some random data into a memory area
* \param buffer Place to write the random data to
* \param length Number of bytes to write
*/
void
XplRandomData(void *buffer, size_t length)
{
gcry_randomize(buffer, length, GCRY_STRONG_RANDOM);
}
/**
* Save the current random seed to disk. This should only be done by 'management' processes, and
* should not usually be called by agents.
*/
void
XplSaveRandomSeed(void)
{
gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE);
}
|
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
/*
* TODO
* Exception management
* Correggere single channel
* Add dithering
* Custom Filter Tool
*/
class ImageProcessor
{
public:
static int minRGB(const int &r, const int &g, const int &b);
static int maxRGB(const int &r, const int &g, const int &b);
static void grayscaleAverage(cv::Mat& img, const int &range);
static void grayscaleMin(cv::Mat& img);
static void grayscaleMax(cv::Mat& img);
static void grayscaleLuma(cv::Mat& img);
static void grayscaleDesaturation(cv::Mat& img);
static void grayscaleSingleChannel(cv::Mat& img, const int &channel);
static void contrastBrightness(cv::Mat& img, const double &contrast=1.0, const int& brightness=0);
static void negative(cv::Mat& img);
static void meanFilter(cv::Mat& img, const int& kernelRadius);
static void medianFilter(cv::Mat& img, const int& kernelRadius);
static void gaussianFilter(cv::Mat& img, const int& kernelRadius);
static void cannyFilter(cv::Mat& imgGray, const double &lower, const double &upper);
static void cannyAutoFilter(cv::Mat &img, const double &sigma=0.33);
static int medianValue(cv::Mat &img);
static cv::Scalar medianValues(cv::Mat &img);
static void dilate(cv::Mat &img, const int &radiusSize, const int &shape, const int &iterations);
static void erode(cv::Mat &img, const int &radiusSize, const int &shape, const int &iterations);
static void close(cv::Mat &img, const int &radiusSize, const int &shape);
static void open(cv::Mat &img, const int &radiusSize, const int &shape);
static void threshold(cv::Mat &imgGray, const int &threshold, const int &threshType);
static void adaptiveThreshold(cv::Mat &imgGray, const int &thresholdValue, const int &threshType, const int &inverted, const int &blockSize, const int &C);
};
#endif // CONTROLLER_H
|
#ifndef __POSITION_H__
#define __POSITION_H__
/* Compute distance between two points. */
double distance (double lat1, double lon1, double lat2, double lon2);
/* Build the phone number based on the ICAO code and airport frequency. */
void icao2number (char *icao, float frequency, char *buf);
/* Search for the closest airport on selected frequency. */
const char *
icaobypos (struct airport *airports, double frequency, double plane_lat,
double plane_lon, double range);
#endif
|
/*
* Qtstalker stock charter
*
* Copyright (C) 2001-2010 Stefan S. Stratigakos
*
* 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 COMMAND_GROUP_PANEL_HPP
#define COMMAND_GROUP_PANEL_HPP
#include "Command.h"
class CommandGroupPanel : public Command
{
public:
CommandGroupPanel ();
QString run (CommandParse &, void *);
int select (void *);
int refresh (void *);
private:
QStringList _method;
};
#endif
|
/*************************************************************************
SampleFIFO.h - simple FIFO, tuned for sample_t
-------------------
begin : Sun Apr 11 2004
copyright : (C) 2004 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SAMPLE_FIFO_H
#define SAMPLE_FIFO_H
#include "config.h"
#include <QtGlobal>
#include <QList>
#include <QQueue>
#include <QRecursiveMutex>
#include "libkwave/SampleArray.h"
namespace Kwave
{
class Q_DECL_EXPORT SampleFIFO
{
public:
/** Constructor */
SampleFIFO();
/** copy constructor */
SampleFIFO(const SampleFIFO &other);
/** Destructor */
virtual ~SampleFIFO();
/**
* Reset the FIFO. This destroys the content and sets
* all pointers to their initial value.
*/
virtual void flush();
/**
* puts samples into the FIFO
*
* @param source reference to an array of samples to feed in
*/
virtual void put(const Kwave::SampleArray &source);
/**
* gets and removes samples from the FIFO
*
* @param buffer reference to an array of samples to be filled
* @return number of received samples
*/
virtual unsigned int get(Kwave::SampleArray &buffer);
/**
* gets and removes all samples from the FIFO
*
* @return a list of sample arrays
*/
virtual QList<Kwave::SampleArray> getAll();
/**
* Returns the number of samples that can be read out.
* @see m_written
*/
virtual unsigned int length();
/**
* sets the maximum size of the content
*/
virtual void setSize(unsigned int size);
/**
* discards all superfluous content until the size
* condition is met.
*/
virtual void crop();
private:
/** internal version of length(), without locking */
unsigned int unlockedLength();
private:
/** list of buffers with sample data */
QQueue<Kwave::SampleArray> m_buffer;
/** maximum number of samples of the content */
sample_index_t m_size;
/**
* number of samples that have already been read out
* from the first buffer (head, first one to read out)
*/
sample_index_t m_read_offset;
/** mutex for access to the FIFO (recursive) */
QRecursiveMutex m_lock;
};
}
#endif /* SAMPLE_FIFO_H */
//***************************************************************************
//***************************************************************************
|
/**
* @file
*
* rq_config.h contains defines for platform-specific stuff.
*/
/*
** rq_config.h
**
** Written by Brett Hutley - brett@hutley.net
**
** Copyright (C) 2001-2008 Brett Hutley
**
** This file is part of the Risk Quantify Library
**
** Risk Quantify 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.
**
** Risk Quantify 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 Risk Quantify; if not, write to the Free
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef rq_config_h
#define rq_config_h
/* -- general stuff ----------------------------------------------- */
/** Make sure VERSION is defined.
'configure' will define this for most platforms. It's not
necessarily defined for MSVC builds.
*/
#ifndef VERSION
# define VERSION "0.8.1"
#endif
/** The number of objects in each object pool */
#define RQ_OBJECT_MGR_OBJECT_POOL_SIZE 1024
/** The maximum number of messages we can store */
#define RQ_PRICING_RESULTS_MAX_MESSAGES 50
/* -- platform defines -------------------------------------------- */
/* borland likes to use different pre-defined macros */
#ifdef __WIN32__
# ifndef WIN32
# define WIN32
# endif
#endif
#ifdef WIN32
# define snprintf _snprintf
# define isnan _isnan
# ifdef RQSO_EXPORTS
# define RQ_EXPORT __declspec(dllexport)
# else
# define RQ_EXPORT
# endif
# define NO_EXPM1
#else
/* Non-Win32 stuff */
# define RQ_EXPORT
#endif
#ifdef HAVE_STRCASECMP
# define stricmp strcasecmp
#endif
/* -- memory allocation ------------------------------------------- */
/* Define this in order to try and find memory leaks. */
#undef DEBUG_MEMORY
#ifdef DEBUG_MEMORY
# define RQ_MALLOC(x) malloc_dbg(__FILE__, __LINE__, x)
# define RQ_CALLOC(n, s) calloc_dbg(__FILE__, __LINE__, n, s)
# define RQ_REALLOC(p, s) realloc_dbg(__FILE__, __LINE__, p, s)
# define RQ_STRDUP(s) strdup_dbg(__FILE__, __LINE__, s)
# define RQ_FREE(p) free_dbg(__FILE__, __LINE__, p)
# include "rq_memdbg.h"
#else
# define RQ_MALLOC malloc
# define RQ_CALLOC calloc
# define RQ_REALLOC realloc
#ifdef MSVC
# define RQ_STRDUP _strdup
#else
# define RQ_STRDUP strdup
#endif
# define RQ_FREE free
# endif
#ifdef MSVC
#pragma warning (disable: 4996)
#endif
#endif
|
/***************************************************************************
UndoModifyAction.h - UndoAction for modifications on samples
-------------------
begin : May 25 2001
copyright : (C) 2001 by Thomas Eschenbacher
email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef UNDO_MODIFY_ACTION_H
#define UNDO_MODIFY_ACTION_H
#include "config.h"
#include <QString>
#include "libkwave/Sample.h"
#include "libkwave/Stripe.h"
#include "libkwave/undo/UndoAction.h"
namespace Kwave
{
class UndoModifyAction: public UndoAction
{
public:
/**
* Constructor.
* @param track index of the track
* @param offset index of the first modified sample
* @param length number of samples
*/
UndoModifyAction(unsigned int track, sample_index_t offset,
sample_index_t length);
/** Destructor */
virtual ~UndoModifyAction() Q_DECL_OVERRIDE;
/** @see UndoAction::description() */
virtual QString description() Q_DECL_OVERRIDE;
/** @see UndoAction::undoSize() */
virtual qint64 undoSize() Q_DECL_OVERRIDE;
/** @see UndoAction::redoSize() */
virtual qint64 redoSize() Q_DECL_OVERRIDE { return undoSize(); }
/**
* @see UndoAction::store()
*/
virtual bool store(Kwave::SignalManager &manager) Q_DECL_OVERRIDE;
/**
* Exchange samples from the current signal and the internal undo
* buffer. So this instance will be re-used for redo and so does not
* require any extra memory for redo.
* @see UndoAction::undo()
*/
virtual UndoAction *undo(Kwave::SignalManager &manager, bool with_redo)
Q_DECL_OVERRIDE;
protected:
/** index of the modified track */
unsigned int m_track;
/** first sample */
sample_index_t m_offset;
/** number of samples */
sample_index_t m_length;
/** storage for all deleted stripes */
QList<Kwave::Stripe::List> m_stripes;
};
}
#endif /* UNDO_MODIFY_ACTION_H */
//***************************************************************************
//***************************************************************************
|
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "threads/CriticalSection.h"
#include "threads/Thread.h"
typedef struct cmyth_ringbuf *cmyth_ringbuf_t;
typedef struct cmyth_conn *cmyth_conn_t;
typedef struct cmyth_recorder *cmyth_recorder_t;
typedef struct cmyth_proginfo *cmyth_proginfo_t;
typedef struct cmyth_proglist *cmyth_proglist_t;
typedef struct cmyth_file *cmyth_file_t;
typedef struct cmyth_database *cmyth_database_t;
typedef struct cmyth_timestamp *cmyth_timestamp_t;
class DllLibCMyth;
class CDateTime;
class CFileItem;
class CURL;
namespace XFILE
{
class CMythSession
: private CThread
{
public:
static CMythSession* AquireSession(const CURL& url);
static void ReleaseSession(CMythSession*);
static void CheckIdle();
static void LogCMyth(int level, char *msg);
class IEventListener
{
public:
virtual ~IEventListener() {};
virtual void OnEvent(int event, const std::string& data)=0;
};
bool SetListener(IEventListener *listener);
cmyth_conn_t GetControl();
cmyth_database_t GetDatabase();
DllLibCMyth* GetLibrary();
cmyth_proglist_t GetAllRecordedPrograms(bool force = false);
void SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program);
CDateTime GetValue(cmyth_timestamp_t t);
CStdString GetValue(char* str);
private:
CMythSession(const CURL& url);
~CMythSession();
virtual void Process();
bool CanSupport(const CURL& url);
void Disconnect();
void SetSeasonAndEpisode(const cmyth_proginfo_t &program, int *season, int *epsiode);
IEventListener* m_listener;
cmyth_conn_t m_control;
cmyth_conn_t m_event;
cmyth_database_t m_database;
CStdString m_hostname;
CStdString m_username;
CStdString m_password;
int m_port;
DllLibCMyth* m_dll;
CCriticalSection m_section;
unsigned int m_timestamp;
cmyth_proglist_t m_all_recorded; // Cache of all_recorded programs.
static CCriticalSection m_section_session;
static std::vector<CMythSession*> m_sessions;
};
}
|
/*
* \brief UART LOG component
* \author Christian Helmuth
* \date 2011-05-30
*/
/*
* Copyright (C) 2011-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _UART_COMPONENT_H_
#define _UART_COMPONENT_H_
/* Genode includes */
#include <base/rpc_server.h>
#include <util/arg_string.h>
#include <os/session_policy.h>
#include <os/attached_ram_dataspace.h>
#include <root/component.h>
#include <uart_session/uart_session.h>
/* local includes */
#include "uart_driver.h"
namespace Uart {
using namespace Genode;
class Session_component : public Rpc_object<Uart::Session,
Session_component>
{
private:
/*
* XXX Do not use hard-coded value, better make it dependent
* on the RAM quota donated by the client.
*/
enum { IO_BUFFER_SIZE = 4096 };
Genode::Attached_ram_dataspace _io_buffer;
/**
* Functor informing the client about new data to read
*/
struct Char_avail_callback : Uart::Char_avail_callback
{
Genode::Signal_context_capability sigh;
void operator ()()
{
if (sigh.valid())
Genode::Signal_transmitter(sigh).submit();
}
} _char_avail_callback;
Uart::Driver_factory &_driver_factory;
Uart::Driver &_driver;
Size _size;
unsigned char _poll_char()
{
while (!_driver.char_avail());
return _driver.get_char();
}
void _put_string(char const *s)
{
for (; *s; s++)
_driver.put_char(*s);
}
/**
* Read ASCII number from UART
*
* \return character that terminates the sequence of digits
*/
unsigned char _read_number(unsigned &result)
{
result = 0;
for (;;) {
unsigned char c = _poll_char();
if (!is_digit(c))
return c;
result = result*10 + digit(c);
}
}
/**
* Try to detect the size of the terminal
*/
Size _detect_size()
{
/*
* Set cursor position to (hopefully) exceed the terminal
* dimensions.
*/
_put_string("\033[1;199r\033[199;255H");
/* flush incoming characters */
for (; _driver.char_avail(); _driver.get_char());
/* request cursor coordinates */
_put_string("\033[6n");
unsigned width = 0, height = 0;
if (_poll_char() == 27
&& _poll_char() == '['
&& _read_number(height) == ';'
&& _read_number(width) == 'R') {
PINF("detected terminal size %dx%d", width, height);
return Size(width, height);
}
return Size(0, 0);
}
public:
/**
* Constructor
*/
Session_component(Uart::Driver_factory &driver_factory,
unsigned index, unsigned baudrate, bool detect_size)
:
_io_buffer(Genode::env()->ram_session(), IO_BUFFER_SIZE),
_driver_factory(driver_factory),
_driver(*_driver_factory.create(index, baudrate, _char_avail_callback)),
_size(detect_size ? _detect_size() : Size(0, 0))
{ }
/****************************
** Uart session interface **
****************************/
void baud_rate(Genode::size_t bits_per_second)
{
_driver.baud_rate(bits_per_second);
}
/********************************
** Terminal session interface **
********************************/
Size size() { return _size; }
bool avail() { return _driver.char_avail(); }
Genode::size_t _read(Genode::size_t dst_len)
{
char *io_buf = _io_buffer.local_addr<char>();
Genode::size_t sz = Genode::min(dst_len, _io_buffer.size());
Genode::size_t n = 0;
while ((n < sz) && _driver.char_avail())
io_buf[n++] = _driver.get_char();
return n;
}
void _write(Genode::size_t num_bytes)
{
/* constain argument to I/O buffer size */
num_bytes = Genode::min(num_bytes, _io_buffer.size());
char const *io_buf = _io_buffer.local_addr<char>();
for (Genode::size_t i = 0; i < num_bytes; i++)
_driver.put_char(io_buf[i]);
}
Genode::Dataspace_capability _dataspace()
{
return _io_buffer.cap();
}
void connected_sigh(Genode::Signal_context_capability sigh)
{
/*
* Immediately reflect connection-established signal to the
* client because the session is ready to use immediately after
* creation.
*/
Genode::Signal_transmitter(sigh).submit();
}
void read_avail_sigh(Genode::Signal_context_capability sigh)
{
_char_avail_callback.sigh = sigh;
if (_driver.char_avail())
_char_avail_callback();
}
Genode::size_t read(void *, Genode::size_t) { return 0; }
Genode::size_t write(void const *, Genode::size_t) { return 0; }
};
typedef Root_component<Session_component, Multiple_clients> Root_component;
class Root : public Root_component
{
private:
Driver_factory &_driver_factory;
protected:
Session_component *_create_session(const char *args)
{
try {
Session_policy policy(args);
unsigned index = 0;
policy.attribute("uart").value(&index);
unsigned baudrate = 0;
try {
policy.attribute("baudrate").value(&baudrate);
} catch (Xml_node::Nonexistent_attribute) { }
bool detect_size = false;
try {
detect_size = policy.attribute("detect_size").has_value("yes");
} catch (Xml_node::Nonexistent_attribute) { }
return new (md_alloc())
Session_component(_driver_factory, index, baudrate, detect_size);
} catch (Xml_node::Nonexistent_attribute) {
PERR("Missing \"uart\" attribute in policy definition");
throw Root::Unavailable();
} catch (Session_policy::No_policy_defined) {
PERR("Invalid session request, no matching policy");
throw Root::Unavailable();
}
}
public:
/**
* Constructor
*/
Root(Rpc_entrypoint *ep, Allocator *md_alloc, Driver_factory &driver_factory)
:
Root_component(ep, md_alloc), _driver_factory(driver_factory)
{ }
};
}
#endif /* _UART_COMPONENT_H_ */
|
/*
* Copyright (c) Bull S.A. 2007 All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* History:
* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
*
*/
#include <stdio.h>
#include <tirpc/netconfig.h>
#include <sys/socket.h>
#include <tirpc/rpc/rpc.h>
#include <tirpc/rpc/types.h>
#include <tirpc/rpc/xdr.h>
#include <tirpc/rpc/svc.h>
#include <errno.h>
#include <netinet/in.h>
//Standard define
#define VERSNUM 1
//Define limits test proc
#define PROCSIMPLEPING 1
//Define DataInt procs
#define INTPROCNUM 10
#define DBLPROCNUM 20
#define LNGPROCNUM 30
#define STRPROCNUM 40
static void exm_proc();
union u_argument {
int varInt;
double dbl;
long lng;
char *str;
} argument;
//****************************************//
//*** Main Function ***//
//****************************************//
int main(int argn, char *argc[])
{
//Server parameter is : argc[1] : Server Program Number
// others arguments depend on server program
int run_mode = 0;
int progNum = atoi(argc[1]);
bool_t rslt;
SVCXPRT *transp = NULL;
struct netconfig *nconf;
struct netbuf svcaddr;
//Initialization
svc_unreg(progNum, VERSNUM);
if ((nconf = getnetconfigent("udp")) == NULL)
{
fprintf(stderr, "Cannot get netconfig entry for UDP\n");
exit(1);
}
transp = svc_tp_create(exm_proc, progNum, VERSNUM,
nconf);
if (transp == NULL)
{
fprintf(stderr, "Cannot create service.\n");
exit(1);
}
if (!svc_reg(transp, progNum, VERSNUM, exm_proc, nconf))
{
fprintf(stderr, "svc_reg failed!!\n");
exit(1);
}
svc_run();
fprintf(stderr, "svc_run() returned. ERROR has occurred.\n");
svc_unreg(progNum, VERSNUM);
return 1;
}
//****************************************//
//*** Remotes Procedures ***//
//****************************************//
char *simplePing(union u_argument *in)
{
//printf("*** in Ping Func.\n");
//Simple function, returns what received
static int result;
result = in->varInt;
return (char *)&result;
}
char *intTestProc(union u_argument *in)
{
//printf("*** in intTestProc.\n");
//returns what received
static int result;
result = in->varInt;
//printf("%d\n", result);
return (char *)&result;
}
char *lngTestProc(union u_argument *in)
{
//printf("*** in lngTestProc.\n");
//returns what received
static long result;
result = in->lng;
//printf("%ld\n", result);
return (char *)&result;
}
char *dblTestProc(union u_argument *in)
{
//printf("*** in dblTestProc.\n");
//returns what received
static double result;
result = in->dbl;
//printf("%lf\n", result);
return (char *)&result;
}
char *strTestProc(union u_argument *in)
{
//printf("*** in strTestProc.\n");
//returns what received
static char *result;
result = in->str;
//printf("%s\n", result);
return (char *)&result;
}
//****************************************//
//*** Dispatch Function ***//
//****************************************//
static void exm_proc(struct svc_req *rqstp, SVCXPRT *transp)
{
char *result;
xdrproc_t xdr_argument;
xdrproc_t xdr_result;
char *(*proc)(union u_argument *);
switch (rqstp->rq_proc)
{
case PROCSIMPLEPING:
{
xdr_argument = (xdrproc_t)xdr_int;
xdr_result = (xdrproc_t)xdr_int;
proc = (char *(*)(union u_argument *))simplePing;
break;
}
case INTPROCNUM:
{
xdr_argument = (xdrproc_t)xdr_int;
xdr_result = (xdrproc_t)xdr_int;
proc = (char *(*)(union u_argument *))intTestProc;
break;
}
case DBLPROCNUM:
{
xdr_argument = (xdrproc_t)xdr_double;
xdr_result = (xdrproc_t)xdr_double;
proc = (char *(*)(union u_argument *))dblTestProc;
break;
}
case LNGPROCNUM:
{
xdr_argument = (xdrproc_t)xdr_long;
xdr_result = (xdrproc_t)xdr_long;
proc = (char *(*)(union u_argument *))lngTestProc;
break;
}
case STRPROCNUM:
{
xdr_argument = (xdrproc_t)xdr_wrapstring;
xdr_result = (xdrproc_t)xdr_wrapstring;
proc = (char *(*)(union u_argument *))strTestProc;
break;
}
default:
{
//Proc is unavaible
svcerr_noproc(transp);
return;
}
}
memset((char *)&argument, (int)0, sizeof(argument));
if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE)
{
svcerr_decode(transp);
return;
}
result = (char *)(*proc)((union u_argument *)&argument);
if ((result != NULL) && (svc_sendreply(transp, xdr_result, (char *)result) == FALSE))
{
svcerr_systemerr(transp);
}
if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE) {
(void)fprintf(stderr, "unable to free arguments\n");
exit(1);
}
}
|
/* -*- mode: c; tab-width: 4; indent-tabs-mode: n; c-basic-offset: 4 -*-
*
* $Id: nb_kernel301_ia32_sse.h,v 1.1 2004/12/26 19:28:54 lindahl Exp $
*
* This file is part of Gromacs Copyright (c) 1991-2004
* David van der Spoel, Erik Lindahl, University of Groningen.
*
* 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.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org
*
* And Hey:
* Gnomes, ROck Monsters And Chili Sauce
*/
#ifndef _NB_KERNEL301_IA32_SSE_H_
#define _NB_KERNEL301_IA32_SSE_H_
/*! \file nb_kernel301_ia32_sse.h
* \brief ia32 SSE-optimized versions of nonbonded kernel 301
*
* \internal
*/
/*! \brief Nonbonded kernel 301 with forces, optimized for ia32 sse.
*
* \internal
*
* <b>Coulomb interaction:</b> Tabulated <br>
* <b>VdW interaction:</b> No <br>
* <b>Water optimization:</b> SPC/TIP3P interacting with non-water atoms <br>
* <b>Forces calculated:</b> Yes <br>
*
* \note All level1 and level2 nonbonded kernels use the same
* call sequence. Parameters are documented in nb_kernel.h
*/
void
nb_kernel301_ia32_sse (int * nri, int iinr[], int jindex[],
int jjnr[], int shift[], float shiftvec[],
float fshift[], int gid[], float pos[],
float faction[], float charge[], float * facel,
float * krf, float * crf, float Vc[],
int type[], int * ntype, float vdwparam[],
float Vvdw[], float * tabscale, float VFtab[],
float invsqrta[], float dvda[], float * gbtabscale,
float GBtab[], int * nthreads, int * count,
void * mtx, int * outeriter,int * inneriter,
float * work);
/*! \brief Nonbonded kernel 301 without forces, optimized for ia32 sse.
*
* \internal
*
* <b>Coulomb interaction:</b> Tabulated <br>
* <b>VdW interaction:</b> No <br>
* <b>Water optimization:</b> SPC/TIP3P interacting with non-water atoms <br>
* <b>Forces calculated:</b> No <br>
*
* \note All level1 and level2 nonbonded kernels use the same
* call sequence. Parameters are documented in nb_kernel.h
*/
void
nb_kernel301nf_ia32_sse(int * nri, int iinr[], int jindex[],
int jjnr[], int shift[], float shiftvec[],
float fshift[], int gid[], float pos[],
float faction[], float charge[], float * facel,
float * krf, float * crf, float Vc[],
int type[], int * ntype, float vdwparam[],
float Vvdw[], float * tabscale, float VFtab[],
float invsqrta[], float dvda[], float * gbtabscale,
float GBtab[], int * nthreads, int * count,
void * mtx, int * outeriter,int * inneriter,
float * work);
#endif /* _NB_KERNEL301_IA32_SSE_H_ */
|
// checksum 0xc67a version 0x90017
/*
This file was generated by the Qt Quick Application wizard of Qt Creator.
QmlApplicationViewer is a convenience class containing mobile device specific
code such as screen orientation handling. Also QML paths and debugging are
handled here.
It is recommended not to modify this file, since newer versions of Qt Creator
may offer an updated version of it.
*/
#ifndef QMLAPPLICATIONVIEWER_H
#define QMLAPPLICATIONVIEWER_H
#include <QDeclarativeView>
class QmlApplicationViewer : public QDeclarativeView
{
Q_OBJECT
public:
enum ScreenOrientation {
ScreenOrientationLockPortrait,
ScreenOrientationLockLandscape,
ScreenOrientationAuto
};
explicit QmlApplicationViewer(QWidget *parent = 0);
virtual ~QmlApplicationViewer();
static QmlApplicationViewer *create();
void setMainQmlFile(const QString &file);
void addImportPath(const QString &path);
// Note that this will only have an effect on Fremantle.
void setOrientation(ScreenOrientation orientation);
void showExpanded();
private:
class QmlApplicationViewerPrivate *d;
};
QApplication *createApplication(int &argc, char **argv);
#endif // QMLAPPLICATIONVIEWER_H
|
/*
* Extended AGI test application
*
* This code is released into the public domain
* with no warranty of any kind
*/
#include "asterisk.h"
#define AUDIO_FILENO (STDERR_FILENO + 1)
/*! \file
* Extended AGI test application
*
* This code is released into the public domain
* with no warranty of any kind
*
* \ingroup agi
*/
static int read_environment(void)
{
char buf[256];
char *val;
/* Read environment */
for(;;) {
if (!fgets(buf, sizeof(buf), stdin)) {
return -1;
}
if (feof(stdin))
return -1;
buf[strlen(buf) - 1] = '\0';
/* Check for end of environment */
if (!strlen(buf))
return 0;
val = strchr(buf, ':');
if (!val) {
fprintf(stderr, "Invalid environment: '%s'\n", buf);
return -1;
}
*val = '\0';
val++;
val++;
/* Skip space */
fprintf(stderr, "Environment: '%s' is '%s'\n", buf, val);
/* Load into normal environment */
setenv(buf, val, 1);
}
/* Never reached */
return 0;
}
static char *wait_result(void)
{
fd_set fds;
int res;
int bytes = 0;
static char astresp[256];
char audiobuf[4096];
for (;;) {
FD_ZERO(&fds);
FD_SET(STDIN_FILENO, &fds);
FD_SET(AUDIO_FILENO, &fds);
/* Wait for *some* sort of I/O */
res = select(AUDIO_FILENO + 1, &fds, NULL, NULL, NULL);
if (res < 0) {
fprintf(stderr, "Error in select: %s\n", strerror(errno));
return NULL;
}
if (FD_ISSET(STDIN_FILENO, &fds)) {
if (!fgets(astresp, sizeof(astresp), stdin)) {
return NULL;
}
if (feof(stdin)) {
fprintf(stderr, "Got hungup on apparently\n");
return NULL;
}
astresp[strlen(astresp) - 1] = '\0';
fprintf(stderr, "Ooh, got a response from Asterisk: '%s'\n", astresp);
return astresp;
}
if (FD_ISSET(AUDIO_FILENO, &fds)) {
res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf));
if (res > 0) {
/* XXX Process the audio with sphinx here XXX */
#if 0
fprintf(stderr, "Got %d/%d bytes of audio\n", res, bytes);
#endif
bytes += res;
/* Prentend we detected some audio after 3 seconds */
if (bytes > 16000 * 3) {
return "Sample Message";
bytes = 0;
}
}
}
}
}
static char *run_command(char *command)
{
fprintf(stdout, "%s\n", command);
return wait_result();
}
static int run_script(void)
{
char *res;
res = run_command("STREAM FILE demo-enterkeywords 0123456789*#");
if (!res) {
fprintf(stderr, "Failed to execute command\n");
return -1;
}
fprintf(stderr, "1. Result is '%s'\n", res);
res = run_command("STREAM FILE demo-nomatch 0123456789*#");
if (!res) {
fprintf(stderr, "Failed to execute command\n");
return -1;
}
fprintf(stderr, "2. Result is '%s'\n", res);
res = run_command("SAY NUMBER 23452345 0123456789*#");
if (!res) {
fprintf(stderr, "Failed to execute command\n");
return -1;
}
fprintf(stderr, "3. Result is '%s'\n", res);
res = run_command("GET DATA demo-enterkeywords");
if (!res) {
fprintf(stderr, "Failed to execute command\n");
return -1;
}
fprintf(stderr, "4. Result is '%s'\n", res);
res = run_command("STREAM FILE auth-thankyou \"\"");
if (!res) {
fprintf(stderr, "Failed to execute command\n");
return -1;
}
fprintf(stderr, "5. Result is '%s'\n", res);
return 0;
}
int main(int argc, char *argv[])
{
char *tmp;
int ver = 0;
int subver = 0;
/* Setup stdin/stdout for line buffering */
setlinebuf(stdin);
setlinebuf(stdout);
if (read_environment()) {
fprintf(stderr, "Failed to read environment: %s\n", strerror(errno));
exit(1);
}
tmp = getenv("agi_enhanced");
if (tmp) {
if (sscanf(tmp, "%30d.%30d", &ver, &subver) != 2)
ver = 0;
}
if (ver < 1) {
fprintf(stderr, "No enhanced AGI services available. Use EAGI, not AGI\n");
exit(1);
}
if (run_script())
return -1;
exit(0);
}
|
/*
* Copyright 2012 Cisco Systems, Inc. All rights reserved.
*
* This program is free software; you may redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* [Insert appropriate license here when releasing outside of Cisco]
* $Id: fnic_fip.h 79980 2011-06-17 00:43:59Z vbhamidi $
*/
#ifndef _FNIC_FIP_H_
#define _FNIC_FIP_H_
#define FCOE_CTLR_START_DELAY 2000 /* ms after first adv. to choose FCF */
#define FCOE_CTLR_FIPVLAN_TOV 2000 /* ms after FIP VLAN disc */
#define FCOE_CTLR_MAX_SOL 8
#define FINC_MAX_FLOGI_REJECTS 8
/*
* FIP_DT_VLAN descriptor.
*/
struct fip_vlan_desc {
struct fip_desc fd_desc;
__be16 fd_vlan;
} __attribute__((packed));
struct vlan {
__be16 vid;
__be16 type;
};
/*
* VLAN entry.
*/
struct fcoe_vlan {
struct list_head list;
u16 vid; /* vlan ID */
u16 sol_count; /* no. of sols sent */
u16 state; /* state */
};
enum fip_vlan_state {
FIP_VLAN_AVAIL = 0, /* don't do anything */
FIP_VLAN_SENT = 1, /* sent */
FIP_VLAN_USED = 2, /* succeed */
FIP_VLAN_FAILED = 3, /* failed to response */
};
struct fip_vlan {
struct ethhdr eth;
struct fip_header fip;
struct {
struct fip_mac_desc mac;
struct fip_wwn_desc wwnn;
} desc;
};
#endif /* __FINC_FIP_H_ */
|
/*
* Copyright 2010 JiJie Shi
*
* This file is part of PEMaster.
*
* PEMaster 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.
*
* PEMaster 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 PEMaster. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __FUNCS_H__
#define __FUNCS_H__
int sum( int num1, int num2 );
#endif //__FUNCS_H__
|
//////////////////////////////////////////////////////////////////////
// Copyright 2009, Daniel R. Mitchell
// License: Creative Commons/GNU-GPL
// (http://creativecommons.org/licenses/GPL/2.0/)
// (http://www.gnu.org/licenses/gpl.html)
//////////////////////////////////////////////////////////////////////
#ifndef _ENVWIDGET_H_
#define _ENVWIDGET_H_
/// Widget to display an envelope graph.
/// The number of segments and range of each segment
/// are set at runtime. If the susOn flag is set,
/// the envelope is extended to fill the entire display
/// area with the last segment treated as the release.
/// Otherwise, the envelope graphi is drawn without
/// a sustain portion and ends at the total time
/// for the segments. When setting the time range, the
/// value should be longer than the total time of the
/// segments. Likewise, the amplitude range should be
/// set to the maximum amplitude value of the envelope
/// or greater.
class EnvelopeWidget : public SynthWidget
{
private:
int numSegs;
SegVals *vals;
float start;
int susOn;
int border;
float tmRange;
float ampRange;
wdgColor frClr;
public:
EnvelopeWidget();
~EnvelopeWidget();
/// Set the time range.
/// @param t total time to display (in seconds)
void SetTime(float t)
{
tmRange = t;
}
/// Set the amplitude level range.
/// @param a maximum amplitude
void SetLevel(float a)
{
ampRange = a;
}
/// Set the start value.
/// @param st starting level
void SetStart(float st)
{
start = st;
}
/// Set the sustain flag.
/// @param on sustain on when non-zero
void SetSus(int on)
{
susOn = on;
}
/// Set the number of segments
/// @param n number of segments
void SetSegs(int n);
/// Set values for one segment.
/// @param n segment number (zero-based)
/// @param rt rate in seconds
/// @param lvl amplitude level at end of segment
void SetVal(int n, float rt, float lvl);
virtual int Load(XmlSynthElem *elem);
/// Redraw the widget.
virtual void Paint(DrawContext dc);
};
#endif
|
// padthv1_ramp.h
//
/****************************************************************************
Copyright (C) 2012-2021, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
#ifndef __padthv1_ramp_h
#define __padthv1_ramp_h
#include <cstdint>
#include <cmath>
//-------------------------------------------------------------------------
// padthv1_ramp - ramp/smooth parameter changes
class padthv1_ramp
{
public:
padthv1_ramp(uint16_t nvalues = 1)
{
m_nvalues = nvalues;
m_value0 = new float [m_nvalues];
m_value1 = new float [m_nvalues];
m_delta = new float [m_nvalues];
for (uint16_t i = 0; i < m_nvalues; ++i)
m_value0[i] = m_value1[i] = m_delta[i] = 0.0f;
m_frames = 0;
}
virtual ~padthv1_ramp()
{
delete [] m_delta;
delete [] m_value1;
delete [] m_value0;
}
void reset()
{
for (uint16_t i = 0; i < m_nvalues; ++i) {
m_value0[i] = m_value1[i];
m_value1[i] = evaluate(i);
}
m_frames = 0;
}
void process(uint32_t nframes)
{
if (m_frames > 0) {
if (nframes > m_frames)
nframes = m_frames;
for (uint16_t i = 0; i < m_nvalues; ++i)
m_value0[i] += float(nframes) * m_delta[i];
m_frames -= nframes;
}
else
if (probe()) {
reset();
m_frames = nframes;
const uint32_t MIN_FRAMES = 32;
if (m_frames < MIN_FRAMES)
m_frames = MIN_FRAMES;
for (uint16_t i = 0; i < m_nvalues; ++i)
m_delta[i] = (m_value1[i] - m_value0[i]) / float(m_frames);
}
}
float value(uint32_t n, uint16_t i = 0) const
{
return (n < m_frames ? (m_value0[i] + float(n) * m_delta[i]) : m_value1[i]);
}
protected:
virtual bool probe() const = 0;
virtual float evaluate(uint16_t i) = 0;
private:
uint16_t m_nvalues;
float *m_value1;
float *m_value0;
float *m_delta;
uint32_t m_frames;
};
//-------------------------------------------------------------------------
// padthv1_ramp1 (1 port tracking)
class padthv1_ramp1 : public padthv1_ramp
{
public:
padthv1_ramp1(uint16_t nvalues = 1)
: padthv1_ramp(nvalues), m_param1(nullptr), m_param1_v(0.0f) {}
void reset(float *param1)
{
m_param1 = param1;
m_param1_v = 0.0f;
padthv1_ramp::reset();
}
protected:
virtual bool probe() const
{
return m_param1 && ::fabsf(*m_param1 - m_param1_v) > 0.001f;
}
virtual float evaluate(uint16_t)
{
update();
return m_param1_v;
}
void update()
{
if (m_param1)
m_param1_v = *m_param1;
}
float *m_param1;
float m_param1_v;
};
//-------------------------------------------------------------------------
// padthv1_ramp2 (2 port tracking)
class padthv1_ramp2 : public padthv1_ramp1
{
public:
padthv1_ramp2(uint16_t nvalues = 1)
: padthv1_ramp1(nvalues), m_param2(nullptr), m_param2_v(0.0f) {}
void reset(float *param1, float *param2)
{
m_param2 = param2;
m_param2_v = 0.0f;
padthv1_ramp1::reset(param1);
}
protected:
virtual bool probe() const
{
return padthv1_ramp1::probe()
|| (m_param2 && ::fabsf(*m_param2 - m_param2_v) > 0.001f);
}
virtual float evaluate(uint16_t i)
{
update();
return padthv1_ramp1::evaluate(i) * m_param2_v;
}
void update()
{
padthv1_ramp1::update();
if (m_param2)
m_param2_v = *m_param2;
}
float *m_param2;
float m_param2_v;
};
//-------------------------------------------------------------------------
// padthv1_ramp3 (3 port tracking)
class padthv1_ramp3 : public padthv1_ramp2
{
public:
padthv1_ramp3(uint16_t nvalues = 1)
: padthv1_ramp2(nvalues), m_param3(nullptr), m_param3_v(0.0f) {}
void reset(float *param1, float *param2, float *param3)
{
m_param3 = param3;
m_param3_v = 0.0f;
padthv1_ramp2::reset(param1, param2);
}
protected:
virtual bool probe() const
{
return padthv1_ramp2::probe()
|| (m_param3 && ::fabsf(*m_param3 - m_param3_v) > 0.001f);
}
virtual float evaluate(uint16_t i)
{
update();
return padthv1_ramp2::evaluate(i) * m_param3_v;
}
void update()
{
padthv1_ramp2::update();
if (m_param3)
m_param3_v = *m_param3;
}
float *m_param3;
float m_param3_v;
};
//-------------------------------------------------------------------------
// padthv1_ramp4 (4 port tracking)
class padthv1_ramp4 : public padthv1_ramp3
{
public:
padthv1_ramp4(uint16_t nvalues = 1)
: padthv1_ramp3(nvalues), m_param4(nullptr), m_param4_v(0.0f) {}
void reset(float *param1, float *param2, float *param3, float *param4)
{
m_param4 = param4;
m_param4_v = 0.0f;
padthv1_ramp3::reset(param1, param2, param3);
}
protected:
virtual bool probe() const
{
return padthv1_ramp3::probe()
|| (m_param4 && ::fabsf(*m_param4 - m_param4_v) > 0.001f);
}
virtual float evaluate(uint16_t i)
{
update();
return padthv1_ramp3::evaluate(i) * m_param4_v;
}
void update()
{
padthv1_ramp3::update();
if (m_param4)
m_param4_v = *m_param4;
}
float *m_param4;
float m_param4_v;
};
#endif // __padthv1_ramp_h
// end of padthv1_ramp.h
|
/*
* ipod_atom.h
*
* Duane Maxwell
* (c) 2005 by Linspire 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 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
* MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __IPOD_ATOM_H__
#define __IPOD_ATOM_H__
#include <ipod/ipod_io.h>
#ifdef PLIST
#include "plist.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ipod_atom_struct_t *ipod_atom;
//
// bottleneck functions
//
typedef void (*ipod_atom_init_func)(uint32_t version,void *data);
typedef void (*ipod_atom_free_func)(void *data);
typedef void (*ipod_atom_read_func)(ipod_io io,uint32_t version,void *data);
typedef void (*ipod_atom_prepare_to_write_func)(ipod_atom root, uint32_t version,void *data);
typedef void (*ipod_atom_write_func)(ipod_io io, uint32_t version,void *data);
typedef void *(*ipod_atom_copy_func)(void *data);
#ifdef PLIST
typedef plist_item *(*ipod_atom_get_plist_func)(void *data);
typedef void (*ipod_atom_set_plist_func)(plist_item *plist,void *data);
#endif
typedef struct ipod_atom_struct_t {
uint32_t tag;
ipod_atom_init_func init;
ipod_atom_free_func free;
ipod_atom_read_func read;
ipod_atom_prepare_to_write_func prepare_to_write;
ipod_atom_write_func write;
ipod_atom_copy_func copy;
#ifdef PLIST
ipod_atom_get_plist_func get_plist;
ipod_atom_set_plist_func set_plist;
#endif
void *data; // atom type-specific data
} ipod_atom_struct;
//
// standard routines
//
extern ipod_atom ipod_atom_new(void);
extern ipod_atom ipod_atom_new_for_tag(uint32_t tag,uint32_t version);
extern void ipod_atom_init(ipod_atom atom,uint32_t version);
extern void ipod_atom_free(ipod_atom atom);
extern void ipod_atom_read(ipod_atom atom,ipod_io io, uint32_t version);
extern ipod_atom ipod_atom_read_next(ipod_io io, uint32_t version);
extern void ipod_atom_prepare_to_write(ipod_atom atom, ipod_atom root, uint32_t version);
extern void ipod_atom_write(ipod_atom atom,ipod_io io, uint32_t version);
extern ipod_atom ipod_atom_copy(ipod_atom atom);
#ifdef PLIST
extern plist_item *ipod_atom_get_plist(ipod_atom atom);
extern void ipod_atom_set_plist(ipod_atom atom,plist_item *plist);
extern ipod_atom ipod_atom_from_plist(plist_item *plist,uint32_t version);
#endif
//
// stub bottlenecks
//
extern void ipod_atom_init_null(uint32_t version,void *data);
extern void ipod_atom_free_null(void *data);
extern void ipod_atom_read_null(ipod_io io,uint32_t version,void *data);
extern void ipod_atom_prepare_to_write_null(ipod_atom root,uint32_t version,void *data);
extern void ipod_atom_write_null(ipod_io io, uint32_t version,void *data);
extern void *ipod_atom_copy_null(void *data);
#ifdef PLIST
extern plist_item *ipod_atom_get_plist_null(void *data);
extern void ipod_atom_set_plist_null(plist_item *plist,void *data);
#endif
//
// lists of atoms
//
typedef struct {
ipod_atom *atoms;
size_t count;
} ipod_atom_list_struct, *ipod_atom_list;
extern ipod_atom_list ipod_atom_list_new(void);
extern void ipod_atom_list_free(ipod_atom_list list);
extern ipod_atom_list ipod_atom_list_shallow_copy(ipod_atom_list list);
extern ipod_atom ipod_atom_list_get(ipod_atom_list list,int index);
extern void ipod_atom_list_put(ipod_atom_list list,int index,ipod_atom atom);
extern size_t ipod_atom_list_length(ipod_atom_list list);
extern void ipod_atom_list_remove(ipod_atom_list list,ipod_atom atom);
extern void ipod_atom_list_remove_index(ipod_atom_list list,int index);
extern void ipod_atom_list_remove_and_free_all(ipod_atom_list list);
extern long ipod_atom_list_index(ipod_atom_list list,ipod_atom atom);
extern void ipod_atom_list_append(ipod_atom_list list,ipod_atom atom);
extern void ipod_atom_list_read(ipod_atom_list list,size_t count,ipod_io io,uint32_t version);
extern void ipod_atom_list_prepare_to_write(ipod_atom_list list,ipod_atom root, uint32_t version);
extern void ipod_atom_list_write(ipod_atom_list list,ipod_io io,uint32_t version);
extern ipod_atom_list ipod_atom_list_copy(ipod_atom_list list);
#ifdef PLIST
extern plist_item *ipod_atom_list_get_plist(ipod_atom_list list);
extern void ipod_atom_list_set_plist(ipod_atom_list list,plist_item *item);
#endif
extern void ipod_atom_list_shuffle(ipod_atom_list list);
//
// misc stuff
//
extern char *ipod_tag_str(uint32_t tag); // NOTE: uses shared static string buffer
extern uint32_t ipod_tag_from_str(char *t);
extern void ipod_atom_report(void);
#ifdef __cplusplus
};
#endif
#endif
|
/* THIS FILE IS GENERATED, DO NOT EDIT! */
ver_sig_t ver_sigs[]={
{(const char *)0xff81b27d, "GM1.00G"},
{(const char *)0xff81b27d, "GM1.00F"},
};
pid_sig_t pid_sigs[]={
};
|
/*
* This file is part of the Advance project.
*
* Copyright (C) 1999, 2000, 2001, 2002, 2003 Andrea Mazzoleni
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* In addition, as a special exception, Andrea Mazzoleni
* gives permission to link the code of this program with
* the MAME library (or with modified versions of MAME that use the
* same license as MAME), and distribute linked combinations including
* the two. You must obey the GNU General Public License in all
* respects for all of the code used other than MAME. If you modify
* this file, you may extend this exception to your version of the
* file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*/
/** \file
* Keyboard driver "none".
*/
#ifndef __KNONE_H
#define __KNONE_H
#include "keydrv.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \addtogroup Keyboard */
/*@{*/
/**
* Keyboard driver "none".
* This driver implement a null keyboard. No event is generated.
*/
extern keyb_driver keyb_none_driver;
/*@}*/
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Copyright (c) 1988, 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
* in_cksum.c,v 1.2 1994/08/02 07:48:16 davidg Exp
*/
#include "slirp.h"
/*
* Checksum routine for Internet Protocol family headers (Portable Version).
*
* This routine is very heavily used in the network
* code and should be modified for each CPU to be as fast as possible.
*
* XXX Since we will never span more than 1 SLIRPmbuf, we can optimise this
*/
#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
int cksum(struct SLIRPmbuf *m, int len)
{
register u_int16_t *w;
register int sum = 0;
register int mlen = 0;
int byte_swapped = 0;
union {
u_int8_t c[2];
u_int16_t s;
} s_util;
union {
u_int16_t s[2];
u_int32_t l;
} l_util;
if (m->m_len == 0)
goto cont;
w = mtod(m, u_int16_t *);
mlen = m->m_len;
if (len < mlen)
mlen = len;
len -= mlen;
/*
* Force to even boundary.
*/
if ((1 & (long) w) && (mlen > 0)) {
REDUCE;
sum <<= 8;
s_util.c[0] = *(u_int8_t *)w;
w = (u_int16_t *)((int8_t *)w + 1);
mlen--;
byte_swapped = 1;
}
/*
* Unroll the loop to make overhead from
* branches &c small.
*/
while ((mlen -= 32) >= 0) {
sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3];
sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7];
sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11];
sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15];
w += 16;
}
mlen += 32;
while ((mlen -= 8) >= 0) {
sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3];
w += 4;
}
mlen += 8;
if (mlen == 0 && byte_swapped == 0)
goto cont;
REDUCE;
while ((mlen -= 2) >= 0) {
sum += *w++;
}
if (byte_swapped) {
REDUCE;
sum <<= 8;
byte_swapped = 0;
if (mlen == -1) {
s_util.c[1] = *(u_int8_t *)w;
sum += s_util.s;
mlen = 0;
} else
mlen = -1;
} else if (mlen == -1)
s_util.c[0] = *(u_int8_t *)w;
cont:
#ifdef SLIRP_DEBUG
if (len) {
DEBUG_ERROR((dfd, "cksum: out of data\n"));
DEBUG_ERROR((dfd, " len = %d\n", len));
}
#endif
if (mlen == -1) {
/* The last SLIRPmbuf has odd # of bytes. Follow the
standard (the odd byte may be shifted left by 8 bits
or not as determined by endian-ness of the machine) */
s_util.c[1] = 0;
sum += s_util.s;
}
REDUCE;
return (~sum & 0xffff);
}
|
/*____________________________________________________________________________
FreeAmp - The Free MP3 Player
Portions copyright (C) 1998-1999 EMusic.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., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: esoundpmo.h,v 1.7 2000/05/04 10:54:56 robert Exp $
____________________________________________________________________________*/
#ifndef INCLUDED_ESOUNDDPMO_H_
#define INCLUDED_ESOUNDDPMO_H_
/* system headers */
#include <stdlib.h>
/* project headers */
#include <config.h>
#include "thread.h"
#include "mutex.h"
#include "pmo.h"
#include "pmoevent.h"
#include "eventbuffer.h"
enum
{
pmoError_MinimumError = 4000,
pmoError_DeviceOpenFailed,
pmoError_MaximumError
};
class FAContext;
class EsounDPMO:public PhysicalMediaOutput
{
public:
EsounDPMO(FAContext *context);
virtual ~EsounDPMO();
virtual Error Init(OutputInfo * info);
static void StartWorkerThread(void *);
void GetVolume(int32 &left, int32 &right);
void SetVolume(int32 left, int32 right);
private:
void WorkerThread(void);
virtual Error Reset(bool user_stop);
void HandleTimeInfoEvent(PMOTimeInfoEvent *pEvent);
bool m_properlyInitialized;
int audio_fd, mixer_fd, stream_id;
char stream_name[ESD_NAME_MAX];
char *m_espeaker;
OutputInfo *myInfo;
Thread *m_pBufferThread;
int m_iBytesPerSample;
long long m_iTotalBytesWritten;
int m_iLastFrame;
unsigned int m_iDataSize;
int m_iVolume;
};
#endif /* _ESOUNDPMO_H_ */
|
/*
Copyright (c) 2002 XFree86 Inc
*/
#ifndef _XRESPROTO_H
#define _XRESPROTO_H
#define XRES_MAJOR_VERSION 1
#define XRES_MINOR_VERSION 2
#define XRES_NAME "X-Resource"
/* v1.0 */
#define X_XResQueryVersion 0
#define X_XResQueryClients 1
#define X_XResQueryClientResources 2
#define X_XResQueryClientPixmapBytes 3
/* Version 1.1 has been accidentally released from the version */
/* control and while it doesn't have differences to version 1.0, the */
/* next version is labeled 1.2 in order to remove the risk of confusion. */
/* v1.2 */
#define X_XResQueryClientIds 4
#define X_XResQueryResourceBytes 5
typedef struct {
CARD32 resource_base;
CARD32 resource_mask;
} xXResClient;
#define sz_xXResClient 8
typedef struct {
CARD32 resource_type;
CARD32 count;
} xXResType;
#define sz_xXResType 8
/* XResQueryVersion */
typedef struct _XResQueryVersion {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD8 client_major;
CARD8 client_minor;
CARD16 unused;
} xXResQueryVersionReq;
#define sz_xXResQueryVersionReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 server_major;
CARD16 server_minor;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryVersionReply;
#define sz_xXResQueryVersionReply 32
/* XResQueryClients */
typedef struct _XResQueryClients {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
} xXResQueryClientsReq;
#define sz_xXResQueryClientsReq 4
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_clients;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryClientsReply;
#define sz_xXResQueryClientsReply 32
/* XResQueryClientResources */
typedef struct _XResQueryClientResources {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 xid;
} xXResQueryClientResourcesReq;
#define sz_xXResQueryClientResourcesReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 num_types;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} xXResQueryClientResourcesReply;
#define sz_xXResQueryClientResourcesReply 32
/* XResQueryClientPixmapBytes */
typedef struct _XResQueryClientPixmapBytes {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 xid;
} xXResQueryClientPixmapBytesReq;
#define sz_xXResQueryClientPixmapBytesReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 bytes;
CARD32 bytes_overflow;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
} xXResQueryClientPixmapBytesReply;
#define sz_xXResQueryClientPixmapBytesReply 32
/* v1.2 XResQueryClientIds */
#define X_XResClientXIDMask 0x01
#define X_XResLocalClientPIDMask 0x02
typedef struct _XResClientIdSpec {
CARD32 client;
CARD32 mask;
} xXResClientIdSpec;
#define sz_xXResClientIdSpec 8
typedef struct _XResClientIdValue {
xXResClientIdSpec spec;
CARD32 length;
// followed by length CARD32s
} xXResClientIdValue;
#define sz_xResClientIdValue (sz_xXResClientIdSpec + 4)
typedef struct _XResQueryClientIds {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 numSpecs;
// followed by numSpecs times XResClientIdSpec
} xXResQueryClientIdsReq;
#define sz_xXResQueryClientIdsReq 8
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numIds;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
// followed by numIds times XResClientIdValue
} xXResQueryClientIdsReply;
#define sz_xXResQueryClientIdsReply 32
/* v1.2 XResQueryResourceBytes */
typedef struct _XResResourceIdSpec {
CARD32 resource;
CARD32 type;
} xXResResourceIdSpec;
#define sz_xXResResourceIdSpec 8
typedef struct _XResQueryResourceBytes {
CARD8 reqType;
CARD8 XResReqType;
CARD16 length;
CARD32 client;
CARD32 numSpecs;
// followed by numSpecs times XResResourceIdSpec
} xXResQueryResourceBytesReq;
#define sz_xXResQueryResourceBytesReq 12
typedef struct _XResResourceSizeSpec {
xXResResourceIdSpec spec;
CARD32 bytes;
CARD32 refCount;
CARD32 useCount;
} xXResResourceSizeSpec;
#define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12)
typedef struct _XResResourceSizeValue {
xXResResourceSizeSpec size;
CARD32 numCrossReferences;
// followed by numCrossReferences times XResResourceSizeSpec
} xXResResourceSizeValue;
#define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4)
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 numSizes;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
// followed by numSizes times XResResourceSizeValue
} xXResQueryResourceBytesReply;
#define sz_xXResQueryResourceBytesReply 32
#endif /* _XRESPROTO_H */
|
/*
*
* MCAP for BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
*
* Authors:
* Santiago Carot-Nemesio <sancane at gmail.com>
* Jose Antonio Santos-Cadenas <santoscadenas at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __MCAP_H
#define __MCAP_H
#ifdef __cplusplus
extern "C" {
#endif
#define MCAP_VERSION 0x0100 /* current version 01.00 */
/* bytes to get MCAP Supported Procedures */
#define MCAP_SUP_PROC 0x06
/* maximum transmission unit for channels */
#define MCAP_CC_MTU 48
#define MCAP_DC_MTU L2CAP_DEFAULT_MTU
/* MCAP Standard Op Codes */
#define MCAP_ERROR_RSP 0x00
#define MCAP_MD_CREATE_MDL_REQ 0x01
#define MCAP_MD_CREATE_MDL_RSP 0x02
#define MCAP_MD_RECONNECT_MDL_REQ 0x03
#define MCAP_MD_RECONNECT_MDL_RSP 0x04
#define MCAP_MD_ABORT_MDL_REQ 0x05
#define MCAP_MD_ABORT_MDL_RSP 0x06
#define MCAP_MD_DELETE_MDL_REQ 0x07
#define MCAP_MD_DELETE_MDL_RSP 0x08
/* MCAP Clock Sync Op Codes */
#define MCAP_MD_SYNC_CAP_REQ 0x11
#define MCAP_MD_SYNC_CAP_RSP 0x12
#define MCAP_MD_SYNC_SET_REQ 0x13
#define MCAP_MD_SYNC_SET_RSP 0x14
#define MCAP_MD_SYNC_INFO_IND 0x15
/* MCAP Response codes */
#define MCAP_SUCCESS 0x00
#define MCAP_INVALID_OP_CODE 0x01
#define MCAP_INVALID_PARAM_VALUE 0x02
#define MCAP_INVALID_MDEP 0x03
#define MCAP_MDEP_BUSY 0x04
#define MCAP_INVALID_MDL 0x05
#define MCAP_MDL_BUSY 0x06
#define MCAP_INVALID_OPERATION 0x07
#define MCAP_RESOURCE_UNAVAILABLE 0x08
#define MCAP_UNSPECIFIED_ERROR 0x09
#define MCAP_REQUEST_NOT_SUPPORTED 0x0A
#define MCAP_CONFIGURATION_REJECTED 0x0B
/* MDL IDs */
#define MCAP_MDLID_RESERVED 0x0000
#define MCAP_MDLID_INITIAL 0x0001
#define MCAP_MDLID_FINAL 0xFEFF
#define MCAP_ALL_MDLIDS 0xFFFF
/* MDEP IDs */
#define MCAP_MDEPID_INITIAL 0x00
#define MCAP_MDEPID_FINAL 0x7F
/*
* MCAP Request Packet Format
*/
typedef struct {
uint8_t op;
uint16_t mdl;
uint8_t mdep;
uint8_t conf;
} __attribute__ ((packed)) mcap_md_create_mdl_req;
typedef struct {
uint8_t op;
uint16_t mdl;
} __attribute__ ((packed)) mcap_md_req;
/*
* MCAP Response Packet Format
*/
typedef struct {
uint8_t op;
uint8_t rc;
uint16_t mdl;
} __attribute__ ((packed)) mcap_rsp;
/*
* MCAP Clock Synchronization Protocol
*/
typedef struct {
uint8_t op;
uint16_t timest;
} __attribute__ ((packed)) mcap_md_sync_cap_req;
typedef struct {
uint8_t op;
uint8_t rc;
uint8_t btclock;
uint16_t sltime;
uint16_t timestnr;
uint16_t timestna;
} __attribute__ ((packed)) mcap_md_sync_cap_rsp;
typedef struct {
uint8_t op;
uint8_t timestui;
uint32_t btclock;
uint64_t timestst;
} __attribute__ ((packed)) mcap_md_sync_set_req;
typedef struct {
int8_t op;
uint8_t rc;
uint32_t btclock;
uint64_t timestst;
uint16_t timestsa;
} __attribute__ ((packed)) mcap_md_sync_set_rsp;
typedef struct {
uint8_t op;
uint32_t btclock;
uint64_t timestst;
uint16_t timestsa;
} __attribute__ ((packed)) mcap_md_sync_info_ind;
#ifdef __cplusplus
}
#endif
#endif /* __MCAP_H */
|
#pragma once
/* DEFINES *******************************************************************/
/* formerly located in kdbg/kdb_symbols.c */
#define TAG_KDBS 'SBDK'
#define TAG_KDBG 'GBDK'
/* TYPES *********************************************************************/
/* from kdb.c */
typedef struct _KDB_KTRAP_FRAME
{
KTRAP_FRAME Tf;
ULONG Cr0;
ULONG Cr1; /* reserved/unused */
ULONG Cr2;
ULONG Cr3;
ULONG Cr4;
} KDB_KTRAP_FRAME, *PKDB_KTRAP_FRAME;
typedef enum _KDB_BREAKPOINT_TYPE
{
KdbBreakPointNone = 0,
KdbBreakPointSoftware,
KdbBreakPointHardware,
KdbBreakPointTemporary
} KDB_BREAKPOINT_TYPE;
typedef enum _KDB_ACCESS_TYPE
{
KdbAccessRead,
KdbAccessWrite,
KdbAccessReadWrite,
KdbAccessExec
} KDB_ACCESS_TYPE;
typedef struct _KDB_BREAKPOINT
{
KDB_BREAKPOINT_TYPE Type; /* Type of breakpoint */
BOOLEAN Enabled; /* Whether the bp is enabled */
ULONG_PTR Address; /* Address of the breakpoint */
BOOLEAN Global; /* Whether the breakpoint is global or local to a process */
PEPROCESS Process; /* Owning process */
PCHAR ConditionExpression;
PVOID Condition;
union {
/* KdbBreakPointSoftware */
UCHAR SavedInstruction;
/* KdbBreakPointHardware */
struct {
UCHAR DebugReg : 2;
UCHAR Size : 3;
KDB_ACCESS_TYPE AccessType;
} Hw;
} Data;
} KDB_BREAKPOINT, *PKDB_BREAKPOINT;
typedef enum _KDB_ENTER_CONDITION
{
KdbDoNotEnter,
KdbEnterAlways,
KdbEnterFromKmode,
KdbEnterFromUmode
} KDB_ENTER_CONDITION;
/* These values MUST be nonzero. They're used as bit masks. */
typedef enum _KDB_OUTPUT_SETTINGS
{
KD_DEBUG_KDSERIAL = 1,
KD_DEBUG_KDNOECHO = 2
} KDB_OUTPUT_SETTINGS;
/* FUNCTIONS *****************************************************************/
/* from i386/i386-dis.c */
LONG
KdbpDisassemble(
IN ULONG Address,
IN ULONG IntelSyntax);
LONG
KdbpGetInstLength(
IN ULONG Address);
/* from i386/kdb_help.S */
VOID NTAPI
KdbpStackSwitchAndCall(
IN PVOID NewStack,
IN VOID (*Function)(VOID));
/* from kdb_cli.c */
extern PCHAR KdbInitFileBuffer;
VOID
KdbpCliInit(VOID);
VOID
KdbpCliMainLoop(
IN BOOLEAN EnteredOnSingleStep);
VOID
KdbpCliModuleLoaded(
IN PUNICODE_STRING Name);
VOID
KdbpCliInterpretInitFile(VOID);
VOID
KdbpPrint(
IN PCHAR Format,
IN ... OPTIONAL);
BOOLEAN
NTAPI
KdbpGetHexNumber(
IN PCHAR pszNum,
OUT ULONG_PTR *pulValue);
/* from kdb_expr.c */
BOOLEAN
KdbpRpnEvaluateExpression(
IN PCHAR Expression,
IN PKDB_KTRAP_FRAME TrapFrame,
OUT PULONGLONG Result,
OUT PLONG ErrOffset OPTIONAL,
OUT PCHAR ErrMsg OPTIONAL);
PVOID
KdbpRpnParseExpression(
IN PCHAR Expression,
OUT PLONG ErrOffset OPTIONAL,
OUT PCHAR ErrMsg OPTIONAL);
BOOLEAN
KdbpRpnEvaluateParsedExpression(
IN PVOID Expression,
IN PKDB_KTRAP_FRAME TrapFrame,
OUT PULONGLONG Result,
OUT PLONG ErrOffset OPTIONAL,
OUT PCHAR ErrMsg OPTIONAL);
/* from kdb_symbols.c */
BOOLEAN
KdbpSymFindModule(
IN PVOID Address OPTIONAL,
IN LPCWSTR Name OPTIONAL,
IN INT Index OPTIONAL,
OUT PLDR_DATA_TABLE_ENTRY* pLdrEntry);
/* from kdb.c */
extern PEPROCESS KdbCurrentProcess;
extern PETHREAD KdbCurrentThread;
extern LONG KdbLastBreakPointNr;
extern ULONG KdbNumSingleSteps;
extern BOOLEAN KdbSingleStepOver;
extern PKDB_KTRAP_FRAME KdbCurrentTrapFrame;
extern ULONG KdbDebugState;
LONG
KdbpGetNextBreakPointNr(
IN ULONG Start OPTIONAL);
BOOLEAN
KdbpGetBreakPointInfo(
IN ULONG BreakPointNr,
OUT ULONG_PTR *Address OPTIONAL,
OUT KDB_BREAKPOINT_TYPE *Type OPTIONAL,
OUT UCHAR *Size OPTIONAL,
OUT KDB_ACCESS_TYPE *AccessType OPTIONAL,
OUT UCHAR *DebugReg OPTIONAL,
OUT BOOLEAN *Enabled OPTIONAL,
OUT BOOLEAN *Global OPTIONAL,
OUT PEPROCESS *Process OPTIONAL,
OUT PCHAR *ConditionExpression OPTIONAL);
NTSTATUS
KdbpInsertBreakPoint(
IN ULONG_PTR Address,
IN KDB_BREAKPOINT_TYPE Type,
IN UCHAR Size OPTIONAL,
IN KDB_ACCESS_TYPE AccessType OPTIONAL,
IN PCHAR ConditionExpression OPTIONAL,
IN BOOLEAN Global,
OUT PLONG BreakPointNr OPTIONAL);
BOOLEAN
KdbpDeleteBreakPoint(
IN LONG BreakPointNr OPTIONAL,
IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
BOOLEAN
KdbpEnableBreakPoint(
IN LONG BreakPointNr OPTIONAL,
IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
BOOLEAN
KdbpDisableBreakPoint(
IN LONG BreakPointNr OPTIONAL,
IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
BOOLEAN
KdbpGetEnterCondition(
IN LONG ExceptionNr,
IN BOOLEAN FirstChance,
OUT KDB_ENTER_CONDITION *Condition);
BOOLEAN
KdbpSetEnterCondition(
IN LONG ExceptionNr,
IN BOOLEAN FirstChance,
IN KDB_ENTER_CONDITION Condition);
BOOLEAN
KdbpAttachToThread(
PVOID ThreadId);
BOOLEAN
KdbpAttachToProcess(
PVOID ProcessId);
VOID
NTAPI
KdbpGetCommandLineSettings(PCHAR p1);
KD_CONTINUE_TYPE
KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
KPROCESSOR_MODE PreviousMode,
PCONTEXT Context,
PKTRAP_FRAME TrapFrame,
BOOLEAN FirstChance);
/* other functions */
NTSTATUS
KdbpSafeReadMemory(OUT PVOID Dest,
IN PVOID Src,
IN ULONG Bytes);
NTSTATUS
KdbpSafeWriteMemory(OUT PVOID Dest,
IN PVOID Src,
IN ULONG Bytes);
#define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
CHAR
KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry);
#define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
CHAR
KdbpTryGetCharSerial(ULONG Retry);
VOID
KdbEnter(VOID);
VOID
DbgRDebugInit(VOID);
VOID
DbgShowFiles(VOID);
VOID
DbgEnableFile(PCH Filename);
VOID
DbgDisableFile(PCH Filename);
VOID
KbdDisableMouse(VOID);
VOID
KbdEnableMouse(VOID);
|
#pragma once
#include"agk.h"
#include "GF.h"
#include "World.h"
#include "Input.h"
#include "Item.h"
#include "Weapon.h"
#include "LUA/lua.hpp"
//#include "Script.h"
class Player
{
public:
Player(void);
~Player(void);
void begin(World* world);
void load(uString name);
void setupLuaFunctions();
void spawn(uString point);
void setPosition(float x, float y);
void update();
void updateWeapon(ProjectileGroup* projGroup);
void activation();
bool canTravel();
void setJustLoaded(bool justLoaded);
void setVisible(int visible);
void addItem(Item item);
void setCurrentWeaponByName(uString name);
float getX();
float getY();
int getInvAmount();
Item getItemFromSlot(int slot);
private:
int img;
int SID;
int activateText;
int activateSprite;
float x;
float y;
float weapOffsetX;
float weapOffsetY;
float cameraX;
float cameraY;
int health;
float lastJump;
float speed;
float jumpHeight;
World* world;
float spriteScale;
bool checkOnGround();
bool justLoaded;
float lastTravel;
std::vector< Item >* inventory;
Weapon cWeapon;
struct Animation
{
int SID;
int imgID;
bool animated;
int FPS;
int start;
int end;
};
Animation anim[2];
//Arm arm;
};
|
#define FSA9685_OPEN 0
#define FSA9685_USB1 1
#define FSA9685_USB2 2
#define FSA9685_MHL 4
#define FSA9685_USB1_ID_TO_IDBYPASS 1
struct switch_usb_info {
struct atomic_notifier_head charger_type_notifier_head;
spinlock_t reg_flag_lock;
};
extern int fsa9685_manual_sw(int input_select);
extern int fsa9685_manual_detach(void);
|
/* X86 Gadgets Table - ROPgadget generator */
#include "ropgadget.h"
t_asm tab_x8664[] =
{
{0, 0, NULL, NULL, NULL, 0}
};
|
#ifndef PCB_H
#define PCB_H
/*******************************************************************
OS Eercises - Homework 5 - HOST dispatcher
pcb - process control block functions for HOST dispatcher
PcbPtr startPcb(PcbPtr process) - start (or restart) a process
PcbPtr suspendPcb(PcbPtr process) - suspend a process
PcbPtr terminatePcb(PcbPtr process) - terminate a process
PcbPtr printPcb(PcbPtr process, FILE * iostream)
void printPcbHdr(FILE *) - print header for printPcb
PcbPtr createnullPcb(void) - create inactive Pcb.
PcbPtr enqPcb (PcbPtr headofQ, PcbPtr process)
PcbPtr deqPcb (PcbPtr * headofQ);
see pcb.c for fuller description of function arguments and returns
********************************************************************
history:
v1.0: Original for exercises FCFS, RR, & Feedback
v1.1: Add reference to memory block structure for exercise MA
v1.2: Add resource allocation
*******************************************************************/
#include "mab.h"
#include "rsrc.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* process management definitions *****************************/
#define MAXARGS 3
#define DEFAULT_PROCESS "./process"
#define N_QUEUES 4 /* number of queues (including RT) */
#define RT_PRIORITY 0
#define HIGH_PRIORITY 1
#define LOW_PRIORITY (N_QUEUES - 1)
#define N_FB_QUEUES (LOW_PRIORITY - HIGH_PRIORITY + 1)
#define PCB_UNINITIALIZED 0
#define PCB_INITIALIZED 1
#define PCB_READY 2
#define PCB_RUNNING 3
#define PCB_SUSPENDED 4
#define PCB_TERMINATED 5
struct pcb {
pid_t pid;
char * args[MAXARGS];
int arrivaltime;
int priority;
int remainingcputime;
int mbytes;
MabPtr memoryblock;
Rsrc req;
int status;
struct pcb * next;
};
typedef struct pcb Pcb;
typedef Pcb * PcbPtr;
/* process management prototypes *****************************/
PcbPtr startPcb(PcbPtr);
PcbPtr suspendPcb(PcbPtr);
PcbPtr terminatePcb(PcbPtr);
PcbPtr printPcb(PcbPtr, FILE *);
void printPcbHdr(FILE *);
PcbPtr createnullPcb();
PcbPtr enqPcb(PcbPtr, PcbPtr);
PcbPtr deqPcb(PcbPtr*);
#endif
|
/* YTP King - Easy to use sentence mixer
* Copyright (C) 2013 Alex "rainChu" Haddad et al.
*
* 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 __YTPKING_LNB_EventId_h
#define __YTPKING_LNB_EventId_h
#include <wx/event.h>
namespace ytpking
{
// TODO put it BACK into MainWindow.
enum GlobalEventId
{
SamplesButtonAddSample = wxID_HIGHEST+1,
SamplesButtonDeleteSample,
MainMenuAbout,
MainMenuImport,
MainMenuQuit,
SamplesTreeCtrl
};
}
#endif
|
/* Copyright (c) 2012-2015 Todd Freed <todd.freed@gmail.com>
This file is part of fab.
fab 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.
fab 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 fab. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _XSTRING_H
#define _XSTRING_H
#include "types.h"
#include "xapi.h"
/// xstrncat
//
// reallocates *s1, appends s2 onto *s1
//
xapi ixstrncat(char ** s1, const char * s2, int s2len);
/// xstrcat
//
// reallocates *s1, appends s2 onto *s1
//
xapi ixstrcat(char ** s1, const char * s2);
/// xstrcatf
//
// calculates size required to vprintf, reallocates *s and appends the new string onto *s
//
xapi ixstrcatf(char ** s, char * fmt, ...);
/// xstrdup
//
// copies s2 to *s1, reallocating *s1 if necessary, deallocating it if it was already allocated
//
xapi ixstrdup(char ** s1, const char * s2);
/// xstrndup
//
// copies s2 to *s1, reallocating *s1 if necessary, deallocating it if it was already allocated
//
xapi ixstrndup(char ** s1, const char * s2, const size_t l);
/// ixsprintf
//
// - wfree(*s)
// - allocate(*s)
// - sprintf(fmt, ...) -> *s
//
xapi ixsprintf(char ** s, char * fmt, ...);
#endif
|
#ifndef APPSTATMODEL_H
#define APPSTATMODEL_H
#include <util/model/stringlistmodel.h>
class AppInfoCache;
class StatManager;
class AppStatModel : public StringListModel
{
Q_OBJECT
public:
explicit AppStatModel(QObject *parent = nullptr);
StatManager *statManager() const;
AppInfoCache *appInfoCache() const;
void initialize();
qint64 appIdByRow(int row) const;
QString appPathByRow(int row) const;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
public slots:
void clear() override;
void remove(int row = -1) override;
private slots:
void onStatAppRemoved(qint64 appId);
void handleCreatedApp(qint64 appId, const QString &appPath);
private:
void updateList();
QVariant dataDisplay(const QModelIndex &index) const;
QVariant dataDecoration(const QModelIndex &index) const;
private:
QVector<qint64> m_appIds;
};
#endif // APPSTATMODEL_H
|
//
// nixieclock-firmware - Nixie Clock Main Firmware Program
// Copyright (C) 2015 Joe Ciccone
//
// 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 <types.h>
char *strncat(char *d, const char *s, size_t n) {
// Working Pointer
char *p = d;
// Iterate to the end of the Destination String
while (*p++ != '\0');
// Append the Source String to the Destination String
// Copying at most n Characters
while ((n-- > 0)&&(*s != '\0')) {
*p++ = *s++;
}
// Null Terminate the Destination
*p = '\0';
return d;
}
|
typedef int block;
struct { int i, x; } ps;
struct { block t; } s;
struct { struct { block t;}ss;} s2;
union { block t;} u;
int f(block);
int (*pf)(block);
void echo(const char *s, ...)
{
block x;
int a = 42;
a += 1;
while (3)
{
block t;
int z = (int) 7;
}
}
int main()
{
block x;
while (43)
{
if (1)
{
echo("mumuf\n");
}
else
{
echo("momof\n");
}
int i;
for (i = 0; i < 42; ++i)
{
echo("glouglou\n");
}
do
{
echo("huhu");
}
while (42);
int truc = 12;
switch (truc)
{
case 1:
case 2:
default:
echo("");
}
typedef double prout;
prout f = 4.5;
double d = 2.3;
f *= (prout) d - (prout) 4.1;
}
typedef int prout;
int f2( int (*tutu)(prout, block));
}
|
/* homefrog
* Copyright (C) 2016 Ognyan Tonchev <otonchev at gmail.com >
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gmodule.h>
#include "shp-complextype-factory.h"
static GHashTable *complextypes;
static GMutex mutex;
/**
* shp_complextype_factory_create:
* @name: name of the #ShpComplextype
*
* Creates new #ShpComplextype of type @name.
*
* Returns: A new #ShpComplextype instance of type @name. Free with
* g_object_unref() when no longer needed.
*/
ShpComplextype*
shp_complextype_factory_create (gchar * name)
{
ShpComplextype *complextype = NULL;
gpointer tmp;
GType object_type;
g_return_val_if_fail (name != NULL, FALSE);
g_mutex_lock (&mutex);
tmp = g_hash_table_lookup (complextypes, name);
g_mutex_unlock (&mutex);
if (tmp == NULL) {
g_warning ("type '%s' has not been registered", name);
return NULL;
}
object_type = GPOINTER_TO_UINT (tmp);
complextype = g_object_new (object_type, NULL);
return complextype;
}
/**
* shp_complextype_factory_register:
* @object_type: a #GType
*
* Registers new #ShpComplextype type, type is represented by @object_type.
*
* Returns: %TRUE on success and %FALSE otherwise
*/
gboolean
shp_complextype_factory_register (gchar * name, GType object_type)
{
g_return_val_if_fail (name != NULL, FALSE);
if (!g_type_is_a (object_type, SHP_COMPLEXTYPE_TYPE)) {
g_error ("the '%s' type is not a descendant of ShpComplextype.", name);
return FALSE;
}
g_mutex_lock (&mutex);
if (g_hash_table_lookup (complextypes, name)) {
g_error ("type '%s' has already been registered.", name);
return FALSE;
}
g_hash_table_insert (complextypes, g_strdup (name),
GUINT_TO_POINTER (object_type));
g_mutex_unlock (&mutex);
return TRUE;
}
/**
* shp_complextype_factory_get_complextype_list:
*
* Returns a %NULL terminated string array with all available complextypes.
*
* Returns: A newly allocated string array with all available complextypes, free whit
* g_strfreev() when nolonger needed.
*/
gchar**
shp_complextype_factory_get_complextype_list ()
{
GHashTableIter iter;
gpointer key, value;
guint num_complextypes;
gchar **result;
guint index;
g_return_if_fail (complextypes != NULL);
g_mutex_lock (&mutex);
num_complextypes = g_hash_table_size (complextypes);
if (num_complextypes == 0) {
g_mutex_unlock (&mutex);
return NULL;
}
result = (gchar **)g_malloc0 ((num_complextypes + 1) * sizeof (gchar*));
index = 0;
g_hash_table_iter_init (&iter, complextypes);
while (g_hash_table_iter_next (&iter, &key, &value)) {
result[index++] = g_strdup ((gchar *)key);
}
g_mutex_unlock (&mutex);
result[index] = NULL;
g_assert (index == num_complextypes);
return result;
}
/**
* shp_complextype_factory_setup:
* @complextype_dir: directory where complextype files are located
*
* Sets up the complextype factory.
*
* Returns: %TRUE on success and %FALSE otherwise
*/
gboolean
shp_complextype_factory_setup ()
{
complextypes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
g_mutex_init (&mutex);
return TRUE;
}
/**
* shp_complextype_factory_cleanup:
*
* Cleans up the complextype factory and frees all resources previously allocated
* with shp_complextype_factory_setup().
*/
void
shp_complextype_factory_cleanup ()
{
/* FIXME: unload complextypes */
g_hash_table_unref (complextypes);
complextypes = NULL;
g_mutex_clear (&mutex);
}
|
/** \file pluginLoader.h
\brief Define the plugin loader
\author alpha_one_x86
\licence GPL3, see the file COPYING */
#ifndef PLUGIN_LOADER_TEST_H
#define PLUGIN_LOADER_TEST_H
#include <QObject>
#include <QMessageBox>
#include <QString>
#include <QStringList>
#include <QProcess>
#include <QSet>
#ifdef Q_OS_WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#include <tlhelp32.h>
#endif
#include "../../../interface/PluginInterface_PluginLoader.h"
#include "Environment.h"
#include "OptionsWidget.h"
/// \brief \brief Define the plugin loader
class WindowsExplorerLoader : public PluginInterface_PluginLoader
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "first-world.info.ultracopier.PluginInterface.PluginLoader/1.0.0.0" FILE "plugin.json")
Q_INTERFACES(PluginInterface_PluginLoader)
public:
WindowsExplorerLoader();
~WindowsExplorerLoader();
/// \brief try enable/disable the catching
void setEnabled(const bool &needBeRegistred);
/// \brief to set resources, writePath can be empty if read only mode
void setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion);
/// \brief to get the options widget, NULL if not have
QWidget * options();
public slots:
/// \brief to reload the translation, because the new language have been loaded
void newLanguageLoaded();
private:
QString pluginPath;
QStringList importantDll,secondDll;
QSet<QString> correctlyLoaded;
bool RegisterShellExtDll(const QString &dllPath, const bool &bRegister,const bool &quiet);
bool checkExistsDll();
bool dllChecked;
bool needBeRegistred;
OptionInterface * optionsEngine;
OptionsWidget optionsWidget;
bool allDllIsImportant,Debug;
bool changeOfArchDetected,is64Bits;
private slots:
void setAllDllIsImportant(bool allDllIsImportant);
void setDebug(bool Debug);
};
#endif // PLUGIN_LOADER_TEST_H
|
/*========================================================
* TypeParsing.h
* @author Sergey Mikhtonyuk
* @date 17 August 2009
=========================================================*/
#ifndef _TYPEPARSING_H__
#define _TYPEPARSING_H__
#include "../../Engine.Graphics/Interfaces/EffectTypes.h"
#include "../../Engine.Graphics/Interfaces/MeshTypes.h"
#include "../../Engine.Graphics/Interfaces/SSurfaceDesc.h"
#include <iosfwd>
namespace Engine
{
namespace Graphics
{
//////////////////////////////////////////////////////////////////////////
const char* EElemUsage_ToString(EElemUsage val);
EElemUsage EElemUsage_FromString(const char* s);
std::ostream& operator << (std::ostream& os, const EElemUsage& fmt);
std::istream& operator >> (std::istream& is, EElemUsage& fmt);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
const char* EElemType_ToString(EElemType val);
EElemType EElemType_FromString(const char* s);
std::ostream& operator << (std::ostream& os, const EElemType& fmt);
std::istream& operator >> (std::istream& is, EElemType& fmt);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
const char* EEffectParam_ToString(EEffectParam val);
EEffectParam EEffectParam_FromString(const char* s);
std::ostream& operator << (std::ostream& os, const EEffectParam& fmt);
std::istream& operator >> (std::istream& is, EEffectParam& fmt);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
const char* EEffectCap_ToString(EEffectCap val);
EEffectCap EEffectCap_FromString(const char* s);
std::ostream& operator << (std::ostream& os, const EEffectCap& fmt);
std::istream& operator >> (std::istream& is, EEffectCap& fmt);
//////////////////////////////////////////////////////////////////////////
} // namespace
} // namespace
#endif // _TYPEPARSING_H__
|
/*
* -- High Performance Computing Linpack Benchmark (HPL-GPU)
* HPL-GPU - 2.0 - 2015
*
* David Rohr
* Matthias Kretz
* Matthias Bach
* Goethe Universität, Frankfurt am Main
* Frankfurt Institute for Advanced Studies
* (C) Copyright 2010 All Rights Reserved
*
* Antoine P. Petitet
* University of Tennessee, Knoxville
* Innovative Computing Laboratory
* (C) Copyright 2000-2008 All Rights Reserved
*
* -- Copyright notice and Licensing terms:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgements:
* This product includes software developed at the University of
* Tennessee, Knoxville, Innovative Computing Laboratory.
* This product includes software developed at the Frankfurt Institute
* for Advanced Studies.
*
* 4. The name of the University, the name of the Laboratory, or the
* names of its contributors may not be used to endorse or promote
* products derived from this software without specific written
* permission.
*
* -- Disclaimer:
*
* 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 UNIVERSITY
* 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.
* ======================================================================
*/
/*
* Include files
*/
#include "hpl.h"
#include "util_timer.h"
#include "util_trace.h"
#ifndef HPL_dswap
void HPL_dswap
(
const int N,
double * X,
const int INCX,
double * Y,
const int INCY
)
{
/*
* Purpose
* =======
*
* HPL_dswap swaps the vectors x and y.
*
*
* Arguments
* =========
*
* N (local input) const int
* On entry, N specifies the length of the vectors x and y. N
* must be at least zero.
*
* X (local input/output) double *
* On entry, X is an incremented array of dimension at least
* ( 1 + ( n - 1 ) * abs( INCX ) ) that contains the vector x.
* On exit, the entries of the incremented array X are updated
* with the entries of the incremented array Y.
*
* INCX (local input) const int
* On entry, INCX specifies the increment for the elements of X.
* INCX must not be zero.
*
* Y (local input/output) double *
* On entry, Y is an incremented array of dimension at least
* ( 1 + ( n - 1 ) * abs( INCY ) ) that contains the vector y.
* On exit, the entries of the incremented array Y are updated
* with the entries of the incremented array X.
*
* INCY (local input) const int
* On entry, INCY specifies the increment for the elements of Y.
* INCY must not be zero.
*
* ---------------------------------------------------------------------
*/
START_TRACE( DSWAP )
cblas_dswap( N, X, INCX, Y, INCY );
END_TRACE
/*
* End of HPL_dswap
*/
}
#endif
|
/*
Free Download Manager Copyright (c) 2003-2016 FreeDownloadManager.ORG
*/
#if !defined(AFX_STDAFX_H__5399CBE1_2DED_432E_B43D_6706FCF64D9D__INCLUDED_)
#define AFX_STDAFX_H__5399CBE1_2DED_432E_B43D_6706FCF64D9D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//{{AFX_INSERT_LOCATION}}
#endif
|
#ifndef __blast_partassign_h
#define __blast_partassign_h
#include <string>
#include <iostream>
#include <vector>
#include <map>
namespace papara {
template<typename pvec_t, typename seq_tag>
class references;
template<typename seq_tag>
class queries;
}
namespace partassign {
struct blast_hit {
std::string qs_name;
std::string ref_name;
int qs_start;
int qs_end;
int ref_start;
int ref_end;
float bit_score;
// std::string bit_score;
// double evalue;
};
class partition {
public:
partition() : start(-1), end(-1) {}
int start;
int end;
std::string gene_name;
};
// static bool not_space( char x ) {
// return !isspace(x); // doing the same with pre-c++11 functional is ridiculus
// }
blast_hit next_hit( std::istream &is );
partition next_partition( std::istream &is );
class part_assignment {
public:
part_assignment( std::istream &blast_out, std::istream &part_file ) ;
// const partassign::partition &partition( const std::string &name ) const ;
const blast_hit &get_blast_hit( const std::string &qs_name ) const;
const std::vector<partassign::partition> &partitions() const {
return partitions_;
}
private:
std::vector<partassign::partition> partitions_;
//std::map<std::string,int> assignments_;
std::map<std::string,partassign::blast_hit> hits_;
};
template<typename pvec_t, typename seq_tag>
std::vector<std::pair<size_t,size_t> > resolve_qs_bounds( papara::references<pvec_t,seq_tag> &refs, papara::queries<seq_tag> &qs, const partassign::part_assignment &part_assign );
std::pair<size_t,size_t> partition_bounds( std::istream &is, const std::string &name );
}
#endif
|
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSerialBus module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 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.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 later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMODBUSCLIENT_H
#define QMODBUSCLIENT_H
#include <QtCore/qobject.h>
#include <QtSerialBus/qmodbusdataunit.h>
#include <QtSerialBus/qmodbusdevice.h>
#include <QtSerialBus/qmodbuspdu.h>
#include <QtSerialBus/qmodbusreply.h>
QT_BEGIN_NAMESPACE
class QModbusClientPrivate;
class Q_SERIALBUS_EXPORT QModbusClient : public QModbusDevice
{
Q_OBJECT
Q_DECLARE_PRIVATE(QModbusClient)
Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
public:
explicit QModbusClient(QObject *parent = nullptr);
~QModbusClient();
QModbusReply *sendReadRequest(const QModbusDataUnit &read, int serverAddress);
QModbusReply *sendWriteRequest(const QModbusDataUnit &write, int serverAddress);
QModbusReply *sendReadWriteRequest(const QModbusDataUnit &read, const QModbusDataUnit &write,
int serverAddress);
QModbusReply *sendRawRequest(const QModbusRequest &request, int serverAddress);
int timeout() const;
void setTimeout(int newTimeout);
int numberOfRetries() const;
void setNumberOfRetries(int number);
Q_SIGNALS:
void timeoutChanged(int newTimeout);
protected:
QModbusClient(QModbusClientPrivate &dd, QObject *parent = nullptr);
virtual bool processResponse(const QModbusResponse &response, QModbusDataUnit *data);
virtual bool processPrivateResponse(const QModbusResponse &response, QModbusDataUnit *data);
};
QT_END_NAMESPACE
#endif // QMODBUSCLIENT_H
|
/*
* Copyright (C) 2015 Cybernetica
*
* Research/Commercial License Usage
* Licensees holding a valid Research License or Commercial License
* for the Software may use this file according to the written
* agreement between you and Cybernetica.
*
* GNU General Public License Usage
* Alternatively, this file may be used under the terms of the GNU
* General Public License version 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the
* packaging of this file. Please review the following information to
* ensure the GNU General Public License version 3.0 requirements will be
* met: http://www.gnu.org/copyleft/gpl-3.0.html.
*
* For further information, please contact us at sharemind@cyber.ee.
*/
#ifndef SHAREMIND_LIBMODAPI_PDPI_H
#define SHAREMIND_LIBMODAPI_PDPI_H
#ifndef SHAREMIND_INTERNAL_
#error including an internal header!
#endif
#include <sharemind/comma.h>
#include <sharemind/extern_c.h>
#include <sharemind/recursive_locks.h>
#include <sharemind/refs.h>
#include <sharemind/tag.h>
#include <stdbool.h>
#include "facilitymap.h"
#include "lasterror.h"
#include "libmodapi.h"
SHAREMIND_EXTERN_C_BEGIN
struct SharemindPdpi_ {
SHAREMIND_RECURSIVE_LOCK_DECLARE_FIELDS;
SHAREMIND_LIBMODAPI_LASTERROR_FIELDS;
SHAREMIND_TAG_DECLARE_FIELDS;
/** A handle for protection domain runtime data. */
void * pdProcessHandle;
/** Pointer to the protection domain kind. */
SharemindPd * pd;
bool isStarted;
/** Pointer to the PDPI facility context. */
void * facilityContext;
/** PDPI facility name to pointer mapping: */
SharemindFacilityMap facilityMap;
SHAREMIND_REFS_DECLARE_FIELDS
};
SHAREMIND_RECURSIVE_LOCK_FUNCTIONS_DECLARE_DEFINE(
SharemindPdpi,
inline,
SHAREMIND_COMMA visibility("internal"))
SHAREMIND_LIBMODAPI_LASTERROR_PRIVATE_FUNCTIONS_DECLARE(SharemindPdpi)
SHAREMIND_REFS_DECLARE_FUNCTIONS(SharemindPdpi)
SHAREMIND_EXTERN_C_END
#endif /* SHAREMIND_LIBMODAPI_PDPI_H */
|
// stdafx.h : WÌVXe CN[h t@CÌCN[h t@CAܽÍ
// QÆñª½A©Â ÜèÏX³êÈ¢AvWFNgêpÌCN[h t@C
// ðLqµÜ·B
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Windows wb_[©çgp³êĢȢªðOµÜ·B
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // êÌ CString RXgN^[;¦IÅ·B
// êÊIųµÄàÀSÈ MFC ÌxbZ[WÌêÌñ\¦ððµÜ·B
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC ÌRA¨æÑWR|[lg
#include <afxext.h> // MFC Ìg£ª
#include <afxdisp.h> // MFC I[g[V NX
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC Ì Internet Explorer 4 R Rg[ T|[g
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC Ì Windows R Rg[ T|[g
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // MFC ɨ¯é{ÆRg[ o[ÌT|[g
#include <afxsock.h> // MFC Ì\Pbgg£@\
#include "Debug.h"
#include "Utility.h"
#include "CMd5.h"
#include "CTcpServerCmd.h"
#include "plugin.h"
#include "CI-V.h"
#include "CListCtrlEx.h"
#include "CRepeater.h"
#include "g711.h"
extern UINT WM_SET_CALLSIGN;
extern UINT WM_COMMON_VIEW;
extern UINT WM_ANALOG_FREQ_VIEW;
extern UINT WM_DIGITAL_FREQ_VIEW;
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
|
/**
* The µkleos scheduler implementation
*
* Copyright (C) 2010 Freie Universität Berlin
*
* This file subject to the terms and conditions of the GNU General Public
* License. See the file LICENSE in the top level directory for more details.
*
* @ingroup kernel
* @{
* @file
* @author Kaspar Schleiser <kaspar.schleiser@fu-berlin.de>
* @}
*/
#include <stdint.h>
#include <sched.h>
#include <kernel.h>
#include <kernel_intern.h>
#include <clist.h>
#include <bitarithm.h>
//#define ENABLE_DEBUG
#include <debug.h>
volatile int num_tasks = 0;
volatile unsigned int sched_context_switch_request;
volatile tcb_t *sched_threads[MAXTHREADS];
volatile tcb_t *active_thread;
volatile int thread_pid;
volatile int last_pid = -1;
clist_node_t *runqueues[SCHED_PRIO_LEVELS];
static uint32_t runqueue_bitcache = 0;
void sched_register_cb(void (*callback)(uint32_t, uint32_t));
#if SCHEDSTATISTICS
static void (*sched_cb)(uint32_t timestamp, uint32_t value) = NULL;
schedstat pidlist[MAXTHREADS];
#endif
void sched_init() {
printf("Scheduler...");
int i;
for (i=0; i<MAXTHREADS; i++) {
sched_threads[i] = NULL;
#if SCHEDSTATISTICS
pidlist[i].laststart = 0;
pidlist[i].runtime = 0;
pidlist[i].schedules = 0;
#endif
}
active_thread = NULL;
thread_pid = -1;
for (i = 0; i < SCHED_PRIO_LEVELS; i++) {
runqueues[i] = NULL;
}
printf("[OK]\n");
}
void sched_run() {
sched_context_switch_request = 0;
tcb_t *my_active_thread = (tcb_t*)active_thread;
if (my_active_thread) {
if( my_active_thread->status == STATUS_RUNNING) {
my_active_thread->status = STATUS_PENDING;
}
#ifdef SCHED_TEST_STACK
if (*((unsigned int*)my_active_thread->stack_start) != (unsigned int) my_active_thread->stack_start) {
printf("scheduler(): stack overflow detected, task=%s pid=%u\n", my_active_thread->name, my_active_thread->pid);
}
#endif
}
#if SCHEDSTATISTICS
extern unsigned long hwtimer_now(void);
unsigned int time = hwtimer_now();
if (my_active_thread && (pidlist[my_active_thread->pid].laststart)) {
pidlist[my_active_thread->pid].runtime += time - pidlist[my_active_thread->pid].laststart;
}
#endif
DEBUG("\nscheduler: previous task: %s\n", ( my_active_thread == NULL) ? "none" : my_active_thread->name );
if (num_tasks == 0) {
DEBUG("scheduler: no tasks left.\n");
while(! num_tasks);
DEBUG("scheduler: new task created.\n");
}
my_active_thread = NULL;
while(! my_active_thread) {
// for (int i = 0; i < SCHED_PRIO_LEVELS; i++) { /* TODO: introduce bitfield cache */
// if (runqueues[i]) {
int nextrq = number_of_lowest_bit(runqueue_bitcache);
clist_node_t next = *(runqueues[nextrq]);
DEBUG("scheduler: first in queue: %s\n", ((tcb_t*)next.data)->name);
clist_advance(&(runqueues[nextrq]));
my_active_thread = (tcb_t*)next.data;
thread_pid = (volatile int) my_active_thread->pid;
#if SCHEDSTATISTICS
pidlist[my_active_thread->pid].laststart = time;
pidlist[my_active_thread->pid].schedules ++;
#endif
// break;
// }
// }
if (active_thread->pid != last_pid) {
last_pid = active_thread->pid;
}
}
DEBUG("scheduler: next task: %s\n", my_active_thread->name);
if (my_active_thread != active_thread) {
if (active_thread != NULL) { //TODO: necessary?
if (active_thread->status == STATUS_RUNNING) {
active_thread->status = STATUS_PENDING ;
}
}
sched_set_status((tcb_t*)my_active_thread, STATUS_RUNNING);
}
active_thread = (volatile tcb_t*) my_active_thread;
DEBUG("scheduler: done.\n");
}
#if SCHEDSTATISTICS
void sched_register_cb(void (*callback)(uint32_t, uint32_t)) {
sched_cb = callback;
}
#endif
void sched_set_status(tcb_t *process, unsigned int status) {
if (status & STATUS_ON_RUNQUEUE) {
if (! (process->status & STATUS_ON_RUNQUEUE)) {
DEBUG("adding process %s to runqueue %u.\n", process->name, process->priority);
clist_add(&runqueues[process->priority], &(process->rq_entry));
runqueue_bitcache |= 1 << process->priority;
}
} else {
if (process->status & STATUS_ON_RUNQUEUE) {
DEBUG("removing process %s from runqueue %u.\n", process->name, process->priority);
clist_remove(&runqueues[process->priority], &(process->rq_entry));
if (! runqueues[process->priority] ) {
runqueue_bitcache &= ~(1 << process->priority);
}
}
}
process->status = status;
}
void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr) {
DEBUG("%s: %i %i %i\n", active_thread->name, (int)current_prio, (int)other_prio, in_isr);
if (current_prio <= other_prio) {
if (in_isr) {
sched_context_switch_request = 1;
} else {
thread_yield();
}
}
}
extern void cpu_switch_context_exit(void);
void sched_task_exit(void) {
DEBUG("sched_task_exit(): ending task %s...\n", active_thread->name);
dINT();
sched_threads[active_thread->pid] = NULL;
num_tasks--;
sched_set_status((tcb_t*)active_thread, STATUS_STOPPED);
active_thread = NULL;
cpu_switch_context_exit();
}
|
/***************************************************************************/
/*
* m5407.c -- platform support for ColdFire 5407 based boards
*
* Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
* Copyright (C) 2000, Lineo (www.lineo.com)
*/
/***************************************************************************/
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/io.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfclk.h>
/***************************************************************************/
DEFINE_CLK(pll, "pll.0", MCF_CLK);
DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
DEFINE_CLK(mcftmr0, "mcftmr.0", MCF_BUSCLK);
DEFINE_CLK(mcftmr1, "mcftmr.1", MCF_BUSCLK);
DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK);
DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK);
struct clk *mcf_clks[] =
{
&clk_pll,
&clk_sys,
&clk_mcftmr0,
&clk_mcftmr1,
&clk_mcfuart0,
&clk_mcfuart1,
NULL
};
/***************************************************************************/
void __init config_BSP(char *commandp, int size)
{
mach_sched_init = hw_timer_init;
/* Only support the external interrupts on their primary level */
mcf_mapirq2imr(25, MCFINTC_EINT1);
mcf_mapirq2imr(27, MCFINTC_EINT3);
mcf_mapirq2imr(29, MCFINTC_EINT5);
mcf_mapirq2imr(31, MCFINTC_EINT7);
}
/***************************************************************************/
|
//
// This file is part of Luola2.
// Copyright (C) 2012 Calle Laakkonen
//
// Luola2 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.
//
// Luola2 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 Luola2. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef THREADPOOL_H
#define THREADPOOL_H
#include <queue>
#include <boost/any.hpp>
#include <boost/thread.hpp>
typedef std::function<boost::any()> TaskFunction;
typedef boost::packaged_task<boost::any> Task;
typedef boost::unique_future<boost::any> TaskFuture;
/**
* A thread pool.
*
* You will typically use this through the singleton instance, by using
* the static ThreadPool::run() function.
*
*/
class ThreadPool {
public:
/**
* Construct a new thread pool with the given number of threads.
*
* \param threads number of threads. Must be greater than zero.
*/
ThreadPool(int threads);
/**
* Destruct the pool and stop all threads.
*
* All running threads are joined.
*/
~ThreadPool();
/**
* Enqueue a task to be executed in a thread.
*
* \param fn the functor to execute
* \return a future of the functors return value
*/
TaskFuture enqueue(TaskFunction &&fn);
/**
* Initialize the singleton pool.
* The pool will contain at least two threads, or more
* if more processors are available.
*
* @param threads number of threads. If zero or below, the number is determined automatically.
*/
static void initSingleton(int threads=0);
/**
* Enqueue a task to be executed on the Singleton pool.
*
* initSingleton() must have been called before.
*/
static TaskFuture run(TaskFunction &&fn);
/**
* Shut down the singleton thread pool.
*/
static void shutdownSingleton();
private:
boost::thread_group m_threads;
std::queue<Task> m_tasks;
boost::mutex m_taskmutex;
boost::condition_variable m_taskcond;
bool m_runflag;
void workerFunc();
};
#endif
|
/*
* Copyright (C) 2011 Dmitry Skiba
*
* 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 <CoreGraphics/CGAffineTransform.h>
#include <math.h>
#include <string.h>
#include <dropins/countof.h>
///////////////////////////////////////////////////////////////////// CGAffineTransform
const CGAffineTransform CGAffineTransformIdentity={1,0,0,1,0,0};
CGAffineTransform CGAffineTransformMakeTranslation(CGFloat tx,CGFloat ty) {
CGAffineTransform result={1,0,0,1,tx,ty};
return result;
}
CGAffineTransform CGAffineTransformMakeScale(CGFloat sx,CGFloat sy) {
CGAffineTransform result={sx,0,0,sy,0,0};
return result;
}
CGAffineTransform CGAffineTransformMakeRotation(CGFloat radians) {
CGFloat sinus=sinf(radians);
CGFloat cosinus=cosf(radians);
CGAffineTransform result={cosinus,sinus,-sinus,cosinus,0,0};
return result;
}
bool CGAffineTransformIsIdentity(CGAffineTransform T) {
return !memcmp(&T,&CGAffineTransformIdentity,sizeof(T));
}
CGAffineTransform CGAffineTransformTranslate(CGAffineTransform T,CGFloat tx,CGFloat ty) {
return CGAffineTransformConcat(T,CGAffineTransformMakeTranslation(tx,ty));
}
CGAffineTransform CGAffineTransformScale(CGAffineTransform T,CGFloat sx,CGFloat sy) {
return CGAffineTransformConcat(T,CGAffineTransformMakeScale(sx,sy));
}
CGAffineTransform CGAffineTransformRotate(CGAffineTransform T,CGFloat angle) {
return CGAffineTransformConcat(T,CGAffineTransformMakeRotation(angle));
}
CGAffineTransform CGAffineTransformInvert(CGAffineTransform T) {
CGFloat determinant=(T.a*T.d-T.c*T.b);
if (determinant==0) {
return T;
} else {
CGAffineTransform result={
T.d/determinant,
-T.b/determinant,
-T.c/determinant,
T.a/determinant,
(-T.d*T.tx+T.c*T.ty)/determinant,
(T.b*T.tx-T.a*T.ty)/determinant
};
return result;
}
}
/*
CGAffineTransform OptimizedInvert(CGAffineTransform T) {
double determinant=(double)T.a*T.d-(double)T.c*T.b;
if (determinant!=0) {
double a=T.d/determinant;
double b=-T.b/determinant;
double c=-T.c/determinant;
double d=T.a/determinant;
double tx=a*T.tx+c*T.ty;
double ty=b*T.tx+d*T.ty;
T.a=a;
T.b=b;
T.c=c;
T.d=d;
T.tx=-tx;
T.ty=-ty;
}
return T;
}*/
CGAffineTransform CGAffineTransformConcat(CGAffineTransform T1,CGAffineTransform T2) {
CGAffineTransform result={
T1.a*T2.a+T1.b*T2.c,
T1.a*T2.b+T1.b*T2.d,
T1.c*T2.a+T1.d*T2.c,
T1.c*T2.b+T1.d*T2.d,
T1.tx*T2.a+T1.ty*T2.c+T2.tx,
T1.tx*T2.b+T1.ty*T2.d+T2.ty
};
return result;
}
CGPoint CGPointApplyAffineTransform(CGPoint point,CGAffineTransform T) {
CGPoint result={
T.a*point.x+T.c*point.y+T.tx,
T.b*point.x+T.d*point.y+T.ty
};
return result;
}
CGSize CGSizeApplyAffineTransform(CGSize size,CGAffineTransform T) {
CGSize result={
T.a*size.width+T.c*size.height+T.tx,
T.b*size.width+T.d*size.height+T.ty
};
return result;
}
CGRect CGRectApplyAffineTransform(CGRect rect,CGAffineTransform transform) {
if (fabs(rect.origin.x)==CGFLOAT_MAX ||
fabs(rect.origin.y)==CGFLOAT_MAX)
{
return rect;
}
CGPoint points[4];
points[0]=rect.origin;
points[1]=CGPointMake(rect.origin.x,rect.origin.y+rect.size.height);
points[2]=CGPointMake(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height);
points[3]=CGPointMake(rect.origin.x+rect.size.width,rect.origin.y);
for (size_t i=0;i!=countof(points);++i) {
points[i]=CGPointApplyAffineTransform(points[i],transform);
}
CGPoint topLeft=points[0];
CGPoint rightBottom=points[0];
for (size_t i=0;i!=countof(points);++i) {
if (topLeft.x>points[i].x) {
topLeft.x=points[i].x;
}
if (rightBottom.x<points[i].x) {
rightBottom.x=points[i].x;
}
if (topLeft.y>points[i].y) {
topLeft.y=points[i].y;
}
if (rightBottom.y<points[i].y) {
rightBottom.y=points[i].y;
}
}
rect.origin=topLeft;
rect.size.width=rightBottom.x-topLeft.x;
rect.size.height=rightBottom.y-topLeft.y;
return rect;
}
|
/*
* xia_common.h
*
* Copyright (c) 2004, X-ray Instrumentation Associates
* 2005 - 2009, XIA LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
* * Neither the name of X-ray Instrumentation Associates
* nor the names of its contributors may be used to endorse
* or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* $Id: xia_common.h 1197 2005-02-23 00:45:53Z SYSTEM $
*
* All of the useful typedefs and macros
* go in here. Two conditions must be met
* in order to qualify as an "xia_common"
* typedef or macro:
* 1) Must not be defined anywhere else and
* 2) Must be able to be used in any library/module.
*
*/
#ifndef XIA_COMMON_H
#define XIA_COMMON_H
#include <string.h>
#include <math.h>
/** Constants **/
/** Typedefs **/
typedef unsigned char byte_t;
typedef unsigned char boolean_t;
typedef unsigned short parameter_t;
typedef unsigned short flag_t;
/** MACROS **/
#define TRUE_ (1 == 1)
#define FALSE_ (1 == 0)
#define UNUSED(x) ((x) = (x))
#define STREQ(x, y) (strcmp((x), (y)) == 0)
#define STRNEQ(x, y) (strncmp((x), (y), strlen(y)) == 0)
#define ROUND(x) ((x) < 0.0 ? ceil((x) - 0.5) : floor((x) + 0.5))
#define PRINT_NON_NULL(x) ((x) == NULL ? "NULL" : (x))
#define BYTE_TO_WORD(lo, hi) (unsigned short)(((unsigned short)(hi) << 8) | (lo))
#define LO_BYTE(word) ((word) & 0xFF)
#define HI_BYTE(word) (((word) >> 8) & 0xFF)
#define MAKE_LOWER_CASE(s, i) for ((i) = 0; (i) < strlen((s)); (i)++) \
(s)[i] = (char)tolower((s)[i])
#define N_ELEMS(x) (sizeof(x) / sizeof((x)[0]))
/* These macros already exist on Linux, so they need to be protected */
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif /* MIN */
#ifndef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif /* MAX */
#endif /* Endif for XIA_COMMON_H */
|
/*****************************************************************************
The Dark Mod GPL Source Code
This file is part of the The Dark Mod Source Code, originally based
on the Doom 3 GPL Source Code as published in 2011.
The Dark Mod Source Code 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. For details, see LICENSE.TXT.
Project: The Dark Mod (http://www.thedarkmod.com/)
$Revision: 5122 $ (Revision of last commit)
$Date: 2011-12-11 19:47:31 +0000 (Sun, 11 Dec 2011) $ (Date of last commit)
$Author: greebo $ (Author of last commit)
******************************************************************************/
#ifndef __COMPRESSOR_H__
#define __COMPRESSOR_H__
/*
===============================================================================
idCompressor is a layer ontop of idFile which provides lossless data
compression. The compressor can be used as a regular file and multiple
compressors can be stacked ontop of each other.
===============================================================================
*/
class idCompressor : public idFile {
public:
// compressor allocation
static idCompressor * AllocNoCompression( void );
static idCompressor * AllocBitStream( void );
static idCompressor * AllocRunLength( void );
static idCompressor * AllocRunLength_ZeroBased( void );
static idCompressor * AllocHuffman( void );
static idCompressor * AllocArithmetic( void );
static idCompressor * AllocLZSS( void );
static idCompressor * AllocLZSS_WordAligned( void );
static idCompressor * AllocLZW( void );
// initialization
virtual void Init( idFile *f, bool compress, int wordLength ) = 0;
virtual void FinishCompress( void ) = 0;
virtual float GetCompressionRatio( void ) const = 0;
// common idFile interface
virtual const char * GetName( void ) = 0;
virtual const char * GetFullPath( void ) = 0;
virtual int Read( void *outData, int outLength ) = 0;
virtual int Write( const void *inData, int inLength ) = 0;
virtual int Length( void ) = 0;
virtual ID_TIME_T Timestamp( void ) = 0;
virtual int Tell( void ) = 0;
virtual void ForceFlush( void ) = 0;
virtual void Flush( void ) = 0;
virtual int Seek( long offset, fsOrigin_t origin ) = 0;
};
#endif /* !__COMPRESSOR_H__ */
|
/*
* This file is part of GLShaderDev.
*
* GLShaderDev 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.
*
* GLShaderDev 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 GLShaderDev. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef FLOATINPUTITEM_H
#define FLOATINPUTITEM_H
#include "AShaderInputItem.h"
class FloatInputItem : public AShaderInputItem
{
public:
FloatInputItem(const std::string& name);
~FloatInputItem();
public:
GLfloat getValue() const;
void setValue(GLfloat value);
public:
virtual void load();
virtual void reload();
virtual void unload();
virtual void bind(ShaderProgram* prgm);
private:
GLfloat _value;
};
#endif // FLOATINPUTITEM_H
|
/*
* -----------------------------------------------------------------
* Programmer(s): Daniel Reynolds @ SMU
* Based on code sundials_spfgmr.h by: Daniel R. Reynolds and
* Hilari C. Tiedeman @ SMU
* -----------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2020, Lawrence Livermore National Security
* and Southern Methodist University.
* All rights reserved.
*
* See the top-level LICENSE and NOTICE files for details.
*
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------
* This is the header file for the SPFGMR implementation of the
* SUNLINSOL module, SUNLINSOL_SPFGMR. The SPFGMR algorithm is based
* on the Scaled Preconditioned FGMRES (Flexible Generalized Minimal
* Residual) method [Y. Saad, SIAM J. Sci. Comput., 1993].
*
* Note:
* - The definition of the generic SUNLinearSolver structure can
* be found in the header file sundials_linearsolver.h.
* -----------------------------------------------------------------
*/
#ifndef _SUNLINSOL_SPFGMR_H
#define _SUNLINSOL_SPFGMR_H
#include <sundials/sundials_linearsolver.h>
#include <sundials/sundials_matrix.h>
#include <sundials/sundials_nvector.h>
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
/* Default SPFGMR solver parameters */
#define SUNSPFGMR_MAXL_DEFAULT 5
#define SUNSPFGMR_MAXRS_DEFAULT 0
#define SUNSPFGMR_GSTYPE_DEFAULT MODIFIED_GS
/* -----------------------------------------
* SPFGMR Implementation of SUNLinearSolver
* ----------------------------------------- */
struct _SUNLinearSolverContent_SPFGMR {
int maxl;
int pretype;
int gstype;
int max_restarts;
int numiters;
realtype resnorm;
int last_flag;
ATimesFn ATimes;
void* ATData;
PSetupFn Psetup;
PSolveFn Psolve;
void* PData;
N_Vector s1;
N_Vector s2;
N_Vector *V;
N_Vector *Z;
realtype **Hes;
realtype *givens;
N_Vector xcor;
realtype *yg;
N_Vector vtemp;
realtype *cv;
N_Vector *Xv;
int print_level;
FILE* info_file;
};
typedef struct _SUNLinearSolverContent_SPFGMR *SUNLinearSolverContent_SPFGMR;
/* ----------------------------------------
* Exported Functions for SUNLINSOL_SPFGMR
* ---------------------------------------- */
SUNDIALS_EXPORT SUNLinearSolver SUNLinSol_SPFGMR(N_Vector y,
int pretype,
int maxl);
SUNDIALS_EXPORT int SUNLinSol_SPFGMRSetPrecType(SUNLinearSolver S,
int pretype);
SUNDIALS_EXPORT int SUNLinSol_SPFGMRSetGSType(SUNLinearSolver S,
int gstype);
SUNDIALS_EXPORT int SUNLinSol_SPFGMRSetMaxRestarts(SUNLinearSolver S,
int maxrs);
SUNDIALS_DEPRECATED_EXPORT SUNLinearSolver SUNSPFGMR(N_Vector y, int pretype, int maxl);
SUNDIALS_DEPRECATED_EXPORT int SUNSPFGMRSetPrecType(SUNLinearSolver S, int pretype);
SUNDIALS_DEPRECATED_EXPORT int SUNSPFGMRSetGSType(SUNLinearSolver S, int gstype);
SUNDIALS_DEPRECATED_EXPORT int SUNSPFGMRSetMaxRestarts(SUNLinearSolver S, int maxrs);
SUNDIALS_EXPORT SUNLinearSolver_Type SUNLinSolGetType_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT SUNLinearSolver_ID SUNLinSolGetID_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT int SUNLinSolInitialize_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT int SUNLinSolSetATimes_SPFGMR(SUNLinearSolver S, void* A_data,
ATimesFn ATimes);
SUNDIALS_EXPORT int SUNLinSolSetPreconditioner_SPFGMR(SUNLinearSolver S,
void* P_data,
PSetupFn Pset,
PSolveFn Psol);
SUNDIALS_EXPORT int SUNLinSolSetScalingVectors_SPFGMR(SUNLinearSolver S,
N_Vector s1,
N_Vector s2);
SUNDIALS_EXPORT int SUNLinSolSetup_SPFGMR(SUNLinearSolver S, SUNMatrix A);
SUNDIALS_EXPORT int SUNLinSolSolve_SPFGMR(SUNLinearSolver S, SUNMatrix A,
N_Vector x, N_Vector b, realtype tol);
SUNDIALS_EXPORT int SUNLinSolNumIters_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT realtype SUNLinSolResNorm_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT N_Vector SUNLinSolResid_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT sunindextype SUNLinSolLastFlag_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT int SUNLinSolSpace_SPFGMR(SUNLinearSolver S,
long int *lenrwLS,
long int *leniwLS);
SUNDIALS_EXPORT int SUNLinSolFree_SPFGMR(SUNLinearSolver S);
SUNDIALS_EXPORT int SUNLinSolSetInfoFile_SPFGMR(SUNLinearSolver LS,
FILE* info_file);
SUNDIALS_EXPORT int SUNLinSolSetPrintLevel_SPFGMR(SUNLinearSolver LS,
int print_level);
#ifdef __cplusplus
}
#endif
#endif
|
//-----------------------------------------------------------------------------
//
// Copyright 1993-1996 id Software
// Copyright 1999-2016 Randy Heit
// Copyright 2016 Magnus Norddahl
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//-----------------------------------------------------------------------------
//
#pragma once
#include "swrenderer/viewport/r_walldrawer.h"
#include "r_line.h"
class FTexture;
struct FLightNode;
struct seg_t;
struct FLightNode;
struct FDynamicColormap;
namespace swrenderer
{
class RenderThread;
struct DrawSegment;
struct FWallCoords;
class ProjectedWallLine;
class ProjectedWallTexcoords;
struct WallSampler;
class RenderWallPart
{
public:
RenderWallPart(RenderThread *thread);
void Render(
sector_t *frontsector,
seg_t *curline,
const FWallCoords &WallC,
FSoftwareTexture *rw_pic,
int x1,
int x2,
const short *walltop,
const short *wallbottom,
double texturemid,
float *swall,
fixed_t *lwall,
double yscale,
double top,
double bottom,
bool mask,
bool additive,
fixed_t alpha,
fixed_t xoffset,
const ProjectedWallLight &light,
FLightNode *light_list);
RenderThread *Thread = nullptr;
private:
void ProcessWallNP2(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal, double top, double bot);
void ProcessWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessStripedWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessNormalWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void SetLights(WallDrawerArgs &drawerargs, int x, int y1);
int x1 = 0;
int x2 = 0;
FSoftwareTexture *rw_pic = nullptr;
sector_t *frontsector = nullptr;
seg_t *curline = nullptr;
FWallCoords WallC;
ProjectedWallLight mLight;
double yrepeat = 0.0;
fixed_t xoffset = 0;
FLightNode *light_list = nullptr;
bool mask = false;
bool additive = false;
fixed_t alpha = 0;
};
}
|
#ifndef PLAYLIST_QUEUE_HH
#define PLAYLIST_QUEUE_HH
#include <vector>
#include <gtkmm.h>
#include <GUI/playlist.h>
#include <GUI/fidel-popover.h>
#include <Utilities/util.h>
class FidelPopover;
class FidelOptions;
class PlaylistQueue : public Playlist{
public:
PlaylistQueue();
PlaylistQueue(Gtk::Button *queue_overview_button);
~PlaylistQueue();
void set_overview_button(Gtk::Button *queue_overview_button);
void overview_notify();
private:
enum PrevOverviewState {
OVERVIEW_HIDDEN,
FIRST_SONG_SHOWN,
FULL_OVERVIEW_SHOWN
};
int max_popover_entries = 5;
int default_image_size = 40;
bool show_more_less_click_inconsistency = false;
bool overview_show_prev_state = false;
bool show_more_less_clicked_once = false;
PrevOverviewState prev_overview_state;
std::vector<Gtk::Button*> queue_entries;
std::vector<Gtk::Widget*> child_widgets;
std::vector<Gtk::Image*> option_icons;
Gtk::Image *queue_overview_notify_icon;
Gtk::Image *queue_overview_icon;
Gtk::Button *queue_overview_button;
Gtk::Button *overview_show_more_less_button;
FidelPopover *queue_overview_popover;
void initialize();
void init_connections();
std::vector<std::string> get_up_next();
std::vector<std::vector<std::string>> get_all_up_next();
void overview_notify_reset();
void overview_show();
void show_first_song();
void show_all_songs();
// signal handlers
void on_overview_button_enter();
void on_overview_button_clicked();
void on_overview_show_more_less_clicked();
};
#endif
|
/**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/***********************************************************************/
/* This file is designed for use with ISim build 0xcb73ee62 */
#define XSI_HIDE_SYMBOL_SPEC true
#include "xsi.h"
#include <memory.h>
#ifdef __GNUC__
#include <stdlib.h>
#else
#include <malloc.h>
#define alloca _alloca
#endif
static const char *ng0 = "D:/single_CPU/ALU_CTR.v";
static unsigned int ng1[] = {0U, 0U};
static unsigned int ng2[] = {2U, 0U};
static unsigned int ng3[] = {1U, 0U};
static unsigned int ng4[] = {6U, 0U};
static unsigned int ng5[] = {4U, 0U};
static unsigned int ng6[] = {5U, 0U};
static unsigned int ng7[] = {10U, 0U};
static unsigned int ng8[] = {7U, 0U};
static void Always_25_0(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
char *t5;
int t6;
char *t7;
char *t8;
LAB0: t1 = (t0 + 1444U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(25, ng0);
t2 = (t0 + 1640);
*((int *)t2) = 1;
t3 = (t0 + 1472);
*((char **)t3) = t2;
*((char **)t1) = &&LAB4;
LAB1: return;
LAB4: xsi_set_current_line(25, ng0);
LAB5: xsi_set_current_line(26, ng0);
t4 = (t0 + 600U);
t5 = *((char **)t4);
LAB6: t4 = ((char*)((ng1)));
t6 = xsi_vlog_unsigned_case_compare(t5, 2, t4, 2);
if (t6 == 1)
goto LAB7;
LAB8: t2 = ((char*)((ng3)));
t6 = xsi_vlog_unsigned_case_compare(t5, 2, t2, 2);
if (t6 == 1)
goto LAB9;
LAB10:
LAB12:
LAB11: xsi_set_current_line(29, ng0);
LAB16: xsi_set_current_line(30, ng0);
t2 = (t0 + 692U);
t3 = *((char **)t2);
LAB17: t2 = ((char*)((ng2)));
t6 = xsi_vlog_unsigned_case_compare(t3, 4, t2, 4);
if (t6 == 1)
goto LAB18;
LAB19: t2 = ((char*)((ng5)));
t6 = xsi_vlog_unsigned_case_compare(t3, 4, t2, 4);
if (t6 == 1)
goto LAB20;
LAB21: t2 = ((char*)((ng6)));
t6 = xsi_vlog_unsigned_case_compare(t3, 4, t2, 4);
if (t6 == 1)
goto LAB22;
LAB23: t2 = ((char*)((ng7)));
t6 = xsi_vlog_unsigned_case_compare(t3, 4, t2, 4);
if (t6 == 1)
goto LAB24;
LAB25:
LAB27:
LAB26: xsi_set_current_line(35, ng0);
LAB33: xsi_set_current_line(35, ng0);
t2 = ((char*)((ng2)));
t4 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t4, t2, 0, 0, 3, 0LL);
LAB28:
LAB13: goto LAB2;
LAB7: xsi_set_current_line(27, ng0);
LAB14: xsi_set_current_line(27, ng0);
t7 = ((char*)((ng2)));
t8 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t8, t7, 0, 0, 3, 0LL);
goto LAB13;
LAB9: xsi_set_current_line(28, ng0);
LAB15: xsi_set_current_line(28, ng0);
t3 = ((char*)((ng4)));
t4 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t4, t3, 0, 0, 3, 0LL);
goto LAB13;
LAB18: xsi_set_current_line(31, ng0);
LAB29: xsi_set_current_line(31, ng0);
t4 = ((char*)((ng4)));
t7 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t7, t4, 0, 0, 3, 0LL);
goto LAB28;
LAB20: xsi_set_current_line(32, ng0);
LAB30: xsi_set_current_line(32, ng0);
t4 = ((char*)((ng1)));
t7 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t7, t4, 0, 0, 3, 0LL);
goto LAB28;
LAB22: xsi_set_current_line(33, ng0);
LAB31: xsi_set_current_line(33, ng0);
t4 = ((char*)((ng3)));
t7 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t7, t4, 0, 0, 3, 0LL);
goto LAB28;
LAB24: xsi_set_current_line(34, ng0);
LAB32: xsi_set_current_line(34, ng0);
t4 = ((char*)((ng8)));
t7 = (t0 + 920);
xsi_vlogvar_wait_assign_value(t7, t4, 0, 0, 3, 0LL);
goto LAB28;
}
extern void work_m_00000000002262663564_3418785828_init()
{
static char *pe[] = {(void *)Always_25_0};
xsi_register_didat("work_m_00000000002262663564_3418785828", "isim/test_isim_beh.exe.sim/work/m_00000000002262663564_3418785828.didat");
xsi_register_executes(pe);
}
|
/* cr-ellipse.h
* Copyright (C) 2006 Robert Gibbs <bgibbs@users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _CR_ELLIPSE_H_
#define _CR_ELLIPSE_H_
#include "cr-path.h"
G_BEGIN_DECLS
#define CR_TYPE_ELLIPSE (cr_ellipse_get_type())
#define CR_ELLIPSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CR_TYPE_ELLIPSE, CrEllipse))
#define CR_ELLIPSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CR_TYPE_ELLIPSE, CrEllipseClass))
#define CR_IS_ELLIPSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CR_TYPE_ELLIPSE))
#define CR_IS_ELLIPSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), CR_TYPE_ELLIPSE))
#define CR_ELLIPSE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CR_TYPE_ELLIPSE, CrEllipseClass))
typedef struct _CrEllipse CrEllipse;
typedef struct _CrEllipseClass CrEllipseClass;
struct _CrEllipse
{
CrPath parent;
gint32 flags;
double width, height, orientation;
};
struct _CrEllipseClass
{
CrPathClass parent_class;
};
enum {
CR_ELLIPSE_WIDTH = 1 << 0,
CR_ELLIPSE_HEIGHT = 1 << 1,
CR_ELLIPSE_ORIENTATION = 1 << 2,
};
GType cr_ellipse_get_type(void);
CrItem *cr_ellipse_new(CrItem *parent, double x, double y,
double width, double height, double orientation,
const gchar *first_arg_name, ...);
G_END_DECLS
#endif /* _CR_ELLIPSE_H_ */
|
/* This file is produced by the C++/CLI AutoWrapper utility.
Copyright (c) 2006 by Argiris Kirtzidis */
#pragma once
#pragma managed(push, off)
#include "OgrePageContentCollection.h"
#pragma managed(pop)
#include "MogrePlatform.h"
#include "MogrePrerequisites.h"
namespace Mogre
{
//################################################################
//PageContentCollection
//################################################################
public ref class PageContentCollection : public Wrapper
{
//Nested Types
//Private Declarations
private protected:
//Internal Declarations
public protected:
PageContentCollection( CLRObject* obj ) : Wrapper(obj)
{
}
//Public Declarations
public:
static property Mogre::uint32 CHUNK_ID
{
public:
Mogre::uint32 get();
}
static property Mogre::uint16 CHUNK_VERSION
{
public:
Mogre::uint16 get();
}
property Mogre::PageManager^ Manager
{
public:
Mogre::PageManager^ get();
}
property Mogre::Page^ ParentPage
{
public:
Mogre::Page^ get();
}
property Mogre::SceneManager^ SceneManager
{
public:
Mogre::SceneManager^ get();
}
property String^ Type
{
public:
String^ get();
}
void _notifyAttached( Mogre::Page^ parent );
void Save( Mogre::StreamSerialiser^ stream );
void FrameStart( Mogre::Real timeSinceLastFrame );
void FrameEnd( Mogre::Real timeElapsed );
void NotifyCamera( Mogre::Camera^ cam );
bool Prepare( Mogre::StreamSerialiser^ ser );
void Load( );
void Unload( );
void Unprepare( );
DEFINE_MANAGED_NATIVE_CONVERSIONS( PageContentCollection )
//Protected Declarations
protected public:
};
}
|
/* Generated by GOB (v2.0.15) (do not edit directly) */
#include <glib.h>
#include <glib-object.h>
#include <libgnomevfs/gnome-vfs.h>
#include "mn-reentrant-mailbox.h"
#ifndef __MN_VFS_MAILBOX_H__
#define __MN_VFS_MAILBOX_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define MN_VFS_MAILBOX_MAX_BACKEND_TYPES 5
extern GType mn_vfs_mailbox_backend_types[MN_VFS_MAILBOX_MAX_BACKEND_TYPES + 1];
/*
* Type checking and casting macros
*/
#define MN_TYPE_VFS_MAILBOX (mn_vfs_mailbox_get_type())
#define MN_VFS_MAILBOX(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), mn_vfs_mailbox_get_type(), MNVFSMailbox)
#define MN_VFS_MAILBOX_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), mn_vfs_mailbox_get_type(), MNVFSMailbox const)
#define MN_VFS_MAILBOX_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), mn_vfs_mailbox_get_type(), MNVFSMailboxClass)
#define MN_IS_VFS_MAILBOX(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), mn_vfs_mailbox_get_type ())
#define MN_VFS_MAILBOX_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), mn_vfs_mailbox_get_type(), MNVFSMailboxClass)
/* Private structure type */
typedef struct _MNVFSMailboxPrivate MNVFSMailboxPrivate;
/*
* Main object structure
*/
#ifndef __TYPEDEF_MN_VFS_MAILBOX__
#define __TYPEDEF_MN_VFS_MAILBOX__
typedef struct _MNVFSMailbox MNVFSMailbox;
#endif
struct _MNVFSMailbox {
MNReentrantMailbox __parent__;
/*< public >*/
char * uri;
GnomeVFSURI * vfs_uri;
/*< private >*/
MNVFSMailboxPrivate *_priv;
};
/*
* Class definition
*/
typedef struct _MNVFSMailboxClass MNVFSMailboxClass;
struct _MNVFSMailboxClass {
MNReentrantMailboxClass __parent__;
};
/*
* Public methods
*/
GType mn_vfs_mailbox_get_type (void) G_GNUC_CONST;
#line 86 "src/mn-vfs-mailbox.gob"
void mn_vfs_mailbox_init_types (void);
#line 69 "mn-vfs-mailbox.h"
#line 476 "src/mn-vfs-mailbox.gob"
void mn_vfs_mailbox_lock (MNVFSMailbox * self);
#line 72 "mn-vfs-mailbox.h"
#line 482 "src/mn-vfs-mailbox.gob"
void mn_vfs_mailbox_unlock (MNVFSMailbox * self);
#line 75 "mn-vfs-mailbox.h"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|
//Testcase for the padding at the end of a struct and for the correct behavaior of the input alignment option.
struct Test
{
int a;
int b;
int c;
struct in{
int ab;
double bc;
} inner;
int d;
};
struct AlignTest
{
char a;
char b[5];
char c;
int d;
char e;
};
//----------------------------------
//Memory alignment option = 8 bytes:
//Size 48
//Padding 20
// struct Test
// {
// int a;//4
// //4
// int b;//4
// //4
// int c;//4
// //4
// struct in{
// int ab;//4
// //4
// double bc;//8
// } inner;
// int d;//4
// //4
// };
//
//
//Size 40
//Padding 28
// struct AlignTest
// {
// char a;//1
// //7
// char b[5];//5
// //3
// char c;//1
// //7
// int d;//4
// //4
// char e;//1
// //7
// };
//----------------------------------
//----------------------------------
//Memory alignment option = 4 bytes:
//Size 40
//Padding 12
// struct Test
// {
// int a;//4
// int b;//4
// int c;//4
// //4
// struct in{
// int ab;//4
// //4
// double bc;//8
// } inner;
// int d;//4
// //4
// };
//
//
//Size 24
//Padding 12
// struct AlignTest
// {
// char a;//1
// //3
// char b[5];//5
// //3
// char c;//1
// //3
// int d;//4
// char e;//1
// //3
// };
//----------------------------------
//----------------------------------
//Memory alignment option = 2 bytes:
//Size 40
//Padding 12
// struct Test
// {
// int a;//4
// int b;//4
// int c;//4
// //4
// struct in{
// int ab;//4
// //4
// double bc;//8
// } inner;
// int d;//4
// //4
// };
//
//
//Size 20
//Padding 8
// struct AlignTest
// {
// char a;//1
// //1
// char b[5];//5
// //1
// char c;//1
// //3
// int d;//4
// char e;//1
// //3
// };
//----------------------------------
|
/*
cmapbash - a simple Minecraft map renderer written in C.
© 2014 saltire sable, x@saltiresable.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IMAGE_H
#define IMAGE_H
#include <stdint.h>
#define CHANNELS 4
#define ALPHA (CHANNELS - 1)
typedef struct image {
uint32_t width, height; // pixel dimensions of the image
uint8_t* data; // pointer to an RGBA pixel buffer for the image
} image;
/* create an image struct
* width, height: pixel dimensions of the image
*/
image *create_image(const uint32_t width, const uint32_t height);
/* load an image struct from a PNG file
* imgpath: path to the image file
*/
image *load_image(const char *imgpath);
/* save an image struct to a PNG file
* img: pointer to the image struct
* imgpath: path to the output file
*/
void save_image(const image *img, const char *imgpath);
/* free the memory used for an image struct
* img: pointer to the image struct
*/
void free_image(image *img);
/* create an image struct with a copy of the given image scaled to 50% of its dimensions
* img: pointer to the source image struct
*/
image *scale_image_half(const image *img);
/* slice an image into square tiles of a certain size and save them to individual files
* img: pointer to the source image struct
* tilesize: length and width of each tile
* tilepath: path of the directory to save tile images to
*/
void slice_image(const image *img, const uint32_t tilesize, const char *tiledir);
#endif
|
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#include <platform.h>
#ifdef INVERTER // TODO - check INVERTER_IO is not NONE
#include "drivers/io.h"
#include "drivers/io_impl.h"
#include "inverter.h"
static const IO_t pin = DEFIO_IO(INVERTER_IO);
void initInverter(void)
{
IOInit(pin, OWNER_SYSTEM, RESOURCE_OUTPUT);
IOConfigGPIO(pin, IOCFG_OUT_PP);
}
void inverterSet(bool on)
{
IOWrite(pin, on);
}
#endif
|
/*
* Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
* retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Sandia Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*****************************************************************************
*
* expcns - ex_put_concat_node_sets
*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int* node_set_ids array of node set ids
* int* num_nodes_per_set array of number of nodes per set
* int* num_dist_per_set array of number of dist fact per set
* ----------pass in NULL for remaining args if just want to set params -------------
* int* node_sets_node_index array of set indices into node list
* int* node_sets_df_index array of set indices into dist fact list
* int* node_set_node_list array of node list #'s for node set
* void* node_set_dist_fact array of dist factors for node set
*
* exit conditions -
*
* revision history -
*
* $Id: expcns.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
/*!
* writes the node set ID's, node set count array, node set pointers array,
* and node set node list for all of the node sets
*/
int ex_put_concat_node_sets (int exoid,
int *node_set_ids,
int *num_nodes_per_set,
int *num_dist_per_set,
int *node_sets_node_index,
int *node_sets_df_index,
int *node_sets_node_list,
void *node_sets_dist_fact)
{
struct ex_set_specs set_specs;
set_specs.sets_ids = node_set_ids;
set_specs.num_entries_per_set = num_nodes_per_set;
set_specs.num_dist_per_set = num_dist_per_set;
set_specs.sets_entry_index = node_sets_node_index;
set_specs.sets_dist_index = node_sets_df_index;
set_specs.sets_entry_list = node_sets_node_list;
set_specs.sets_extra_list = NULL;
set_specs.sets_dist_fact = node_sets_dist_fact;
return ex_put_concat_sets(exoid, EX_NODE_SET, &set_specs);
}
|
/* $OpenBSD: signal.h,v 1.3 1997/02/18 15:54:27 rahnds Exp $ */
/* $NetBSD: signal.h,v 1.1 1996/09/30 16:34:34 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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 _MACHINE_SIGNAL_H_
#define _MACHINE_SIGNAL_H_
typedef int sig_atomic_t;
#include <machine/types.h>
#include <machine/cpu.h>
struct sigcontext {
int sc_onstack; /* saved onstack flag */
int sc_mask; /* saved signal mask */
struct trapframe sc_frame; /* saved registers */
};
#endif /* _MACHINE_SIGNAL_H_ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.4 2001/07/23 13:15:48 dawes Exp $ */
/*
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of David Wexelblat not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. David Wexelblat makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XConsortium: ioperm_noop.c /main/3 1996/02/21 17:53:39 kaleb $ */
/*
* Some platforms don't bother with I/O permissions,
* or the permissions are implicit with opening/enabling the console.
*/
#include "X.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
void
xf86EnableIO()
{
return;
}
void
xf86DisableIO()
{
return;
}
|
/*
* Copyright (c) 2013 Peter Szucs <peter.szucs.dev@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef LODDEFINITIONMANAGER_H
#define LODDEFINITIONMANAGER_H
#include "LodDefinition.h"
#include "XMLLodDefinitionSerializer.h"
#include "components/ogre/EmberOgrePrerequisites.h"
#include "framework/Singleton.h"
#include <OgreResourceManager.h>
#include <string>
#include <boost/filesystem/path.hpp>
namespace Ember
{
namespace OgreView
{
namespace Lod
{
/**
* @brief LodDefinitionManager is managing all *.loddef resource files.
*/
class LodDefinitionManager :
public Ember::Singleton<LodDefinitionManager>,
public Ogre::ResourceManager
{
public:
/**
* @brief Ctor.
* @param exportDirectory Specifies the directory, where the changed *.loddef files will be saved.
*/
LodDefinitionManager(const boost::filesystem::path& exportDirectory);
/**
* @brief Dtor.
*/
~LodDefinitionManager() override;
/// Create a new LodDefinition
/// @see ResourceManager::createResource
LodDefinitionPtr create (const Ogre::String& name, const Ogre::String& group,
bool isManual = false, Ogre::ManualResourceLoader* loader = 0,
const Ogre::NameValuePairList* createParams = 0);
/**
* @brief Instantiates the LodDefinition. Parameters are passed directly to LodDefinition ctor.
*
* This is called from Ogre::ResourceManager. You should not call this!
*/
Ogre::Resource* createImpl(const Ogre::String& name, Ogre::ResourceHandle handle,
const Ogre::String& group, bool isManual, Ogre::ManualResourceLoader* loader,
const Ogre::NameValuePairList* createParams);
/// Get a LodDefinition by name
/// @see ResourceManager::getResourceByName
LodDefinitionPtr getByName(const Ogre::String& name, const Ogre::String& groupName = Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
void parseScript(Ogre::DataStreamPtr& stream, const Ogre::String& groupName);
/**
* @brief Exports a LodDefinition to a file.
*
* The definition will be serialized and saved to a file by the same name of the definition.
*
* @param definition The definition to export.
* @return The path to the exported script. If the export failed, the string will be empty.
*/
void exportScript(std::string meshName, LodDefinitionPtr definition);
/**
* @brief Returns an instance of the default Serializer.
*/
const XMLLodDefinitionSerializer& getSerializer() const;
private:
const XMLLodDefinitionSerializer mLodDefinitionSerializer;
};
inline const XMLLodDefinitionSerializer& LodDefinitionManager::getSerializer() const
{
return mLodDefinitionSerializer;
}
}
}
}
#endif // ifndef LODDEFINITIONMANAGER_H
|
/*
* A catalog is used to map names to objects.
*/
#ifndef catalog_h
#define catalog_h
#include <InterViews/stub.h>
class Catalog {
public:
Catalog(int size);
~Catalog();
void Register(const char*, ObjectStub*);
void UnRegister(const char*);
boolean Find(ObjectStub*&, const char*);
private:
struct CatalogEntry {
char* name;
int len;
ObjectStub* obj;
CatalogEntry* chain;
};
int nelements;
CatalogEntry** first;
CatalogEntry** last;
unsigned Hash(const char*, int&);
};
#endif
|
/*
* Copyright (c) 2015 Evan Kale
* Email: EvanKale91@gmail.com
* Website: www.ISeeDeadPixel.com
* www.evankale.blogspot.ca
*
* This file is part of Breakout.
*
* Breakout 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 BALL_H
#define BALL_H
#include "engine/RenderObject.h"
class Bitmap;
class Ball: public RenderObject
{
public:
float x, y;
float w, h;
float vx, vy;
float radius;
virtual void render();
virtual void update(unsigned int timeSinceLastFrame);
Ball();
virtual ~Ball();
void flipXDirection();
void flipYDirection();
void flipXYDirection();
Bitmap * bitmap;
bool directionDetermined;
RenderObject * lastHitObject;
};
#endif
|
/*
* This file is part of vallumd.
*
* Copyright (C) 2017 Stijn Tintel <stijn@linux-ipv6.be>
*
* 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 <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "mosquitto.h"
static void print_usage()
{
printf("Usage: -h host [-p port] [-u username] [-P password] -t topic1 [-t topicN]\n");
printf(" -h: MQTT host to connect to\n");
printf(" -p: MQTT port to connect to (1883)\n");
printf(" -u: MQTT username\n");
printf(" -P: MQTT password\n");
printf(" -t: MQTT topic and IPset name\n");
printf(" -V: print version number and exit\n");
}
int main(int argc, char **argv)
{
char *host = NULL;
char *username = NULL;
char *password = NULL;
int opt = 0;
unsigned int port = 1883;
unsigned int t = 0;
while ((opt = getopt(argc, argv, "h:p:P:t:u:V")) != -1) {
if (opt == 't') {
ntopics++;
}
}
mqtt_topics = malloc(ntopics * sizeof(*mqtt_topics));
optind = 0;
while ((opt = getopt(argc, argv, "h:p:P:t:u:V")) != -1) {
switch (opt) {
case 'h':
host = optarg;
break;
case 'p':
port = atoi(optarg);
break;
case 'P':
password = optarg;
break;
case 't':
mqtt_topics[t] = malloc((strlen(optarg) + 1) * sizeof(char));
strcpy(mqtt_topics[t], optarg);
t++;
break;
case 'u':
username = optarg;
break;
case 'V':
fprintf(stdout, "vallumd-%s\n", VERSION);
return 0;
default:
print_usage();
return 1;
}
}
if (host == NULL || ntopics == 0) {
print_usage();
return 1;
}
mqtt_host = host;
mqtt_port = port;
mqtt_username = username;
mqtt_password = password;
init_mqtt();
return 0;
}
|
//
// ccallsign.h
// xlxd
//
// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
//
// ----------------------------------------------------------------------------
// This file is part of xlxd.
//
// xlxd 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.
//
// xlxd is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef ccallsign_h
#define ccallsign_h
////////////////////////////////////////////////////////////////////////////////////////
// define
#define CALLSIGN_LEN 8
#define CALLSUFFIX_LEN 4
////////////////////////////////////////////////////////////////////////////////////////
// class
class CCallsign
{
public:
// contructors
CCallsign();
CCallsign(const char *, uint32 = 0);
CCallsign(const CCallsign &);
// destructor
virtual ~CCallsign() {};
// status
bool IsValid(void) const;
bool HasSuffix(void) const;
bool HasModule(void) const { return m_Module != ' '; }
// set
void SetCallsign(const char *, bool = true);
void SetCallsign(const uint8 *, int, bool = true);
void SetYsfCallsign(const char *);
void SetDmrid(uint32, bool = true);
void SetDmrid(const uint8 *, bool = true);
void SetModule(char);
void SetSuffix(const char *);
void SetSuffix(const uint8 *, int);
// modify
void PatchCallsign(int, const uint8 *, int);
// get
void GetCallsign(uint8 *) const;
void GetCallsignString(char *) const;
uint32 GetDmrid(void) const { return m_uiDmrid; }
void GetSuffix(uint8 *) const;
char GetModule(void) const { return m_Module; }
// compare
bool HasSameCallsign(const CCallsign &) const;
bool HasSameCallsignWithWildcard(const CCallsign &) const;
bool HasLowerCallsign(const CCallsign &) const;
bool HasSameModule(const CCallsign &) const;
// operators
bool operator ==(const CCallsign &) const;
operator const char *() const;
protected:
// helper
bool IsNumber(char) const;
bool IsLetter(char) const;
bool IsSpace(char) const;
protected:
// data
char m_Callsign[CALLSIGN_LEN];
char m_Suffix[CALLSUFFIX_LEN];
char m_Module;
char m_sz[CALLSIGN_LEN+CALLSUFFIX_LEN+5];
uint32 m_uiDmrid;
};
////////////////////////////////////////////////////////////////////////////////////////
#endif /* ccallsign_h */
|
/* va_list error handler for noninteractive utilities
Copyright (C) 2006-2007, 2009-2018 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 <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
#include <config.h>
#include "verror.h"
#include "xvasprintf.h"
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#if ENABLE_NLS
# include "gettext.h"
# define _(msgid) gettext (msgid)
#endif
#ifndef _
# define _(String) String
#endif
/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
Use the globals error_print_progname and error_message_count similarly
to error(). */
void
verror (int status, int errnum, const char *format, va_list args)
{
verror_at_line (status, errnum, NULL, 0, format, args);
}
/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
If FNAME is not NULL, prepend the message with "FNAME:LINENO:".
Use the globals error_print_progname, error_message_count, and
error_one_per_line similarly to error_at_line(). */
void
verror_at_line (int status, int errnum, const char *file,
unsigned int line_number, const char *format, va_list args)
{
char *message = xvasprintf (format, args);
if (message)
{
/* Until https://sourceware.org/bugzilla/show_bug.cgi?id=2997 is fixed,
glibc violates GNU Coding Standards when the file argument to
error_at_line is NULL. */
if (file)
error_at_line (status, errnum, file, line_number, "%s", message);
else
error (status, errnum, "%s", message);
}
else
{
/* EOVERFLOW, EINVAL, and EILSEQ from xvasprintf are signs of
serious programmer errors. */
error (0, errno, _("unable to display error message"));
abort ();
}
free (message);
}
|
/*-
* Copyright 2014 sgminer developers.
* 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 THE AUTHOR 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 AUTHOR 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.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#include "config.h"
#include "miner.h"
#include "pool.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* get_pool_name(struct pool *pool) {
if (opt_incognito)
return "<pool>";
if (strcmp(pool->name, "") == 0)
return pool->sockaddr_url;
return pool->name;
}
char* get_pool_user(struct pool *pool) {
if (opt_incognito)
return "<user>";
return pool->rpc_user;
}
|
/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, 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/>.
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
*/
#ifndef INDICATOR_DATETIME_PLANNER_SNOOZE_H
#define INDICATOR_DATETIME_PLANNER_SNOOZE_H
#include <datetime/clock.h>
#include <datetime/planner.h>
#include <datetime/settings.h>
#include <memory>
namespace unity {
namespace indicator {
namespace datetime {
/**
* A planner to hold 'Snooze' copies of other appointments
*/
class SnoozePlanner: public Planner
{
public:
SnoozePlanner(const std::shared_ptr<Settings>&,
const std::shared_ptr<Clock>&);
~SnoozePlanner();
core::Property<std::vector<Appointment>>& appointments() override;
void add(const Appointment&, const Alarm&);
protected:
class Impl;
friend class Impl;
std::unique_ptr<Impl> impl;
};
} // namespace datetime
} // namespace indicator
} // namespace unity
#endif // INDICATOR_DATETIME_PLANNER_H
|
////////////////////////////////////////////////////////////////////////////
// Created : 04.03.2010
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef N_ARY_TREE_WEIGHT_NODE_H_INCLUDED
#define N_ARY_TREE_WEIGHT_NODE_H_INCLUDED
#include "mixing_n_ary_tree_base_node.h"
#include "base_interpolator.h"
namespace xray {
namespace animation {
namespace mixing {
class n_ary_tree_weight_node : public n_ary_tree_base_node {
public:
inline n_ary_tree_weight_node ( base_interpolator const& interpolator, float const weight );
inline n_ary_tree_weight_node ( n_ary_tree_weight_node const& other );
inline base_interpolator const& interpolator ( ) const;
inline float weight ( ) const;
inline bool operator == ( n_ary_tree_weight_node const& other ) const;
inline bool operator != ( n_ary_tree_weight_node const& other ) const;
private:
n_ary_tree_weight_node& operator= ( n_ary_tree_weight_node const& other);
virtual void accept ( n_ary_tree_visitor& visitor );
virtual void accept ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_base_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_animation_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_weight_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_addition_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_subtraction_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_multiplication_node& node );
virtual void visit ( n_ary_tree_double_dispatcher& dispatcher, n_ary_tree_transition_node& node );
private:
base_interpolator const& m_interpolator;
float const m_weight;
}; // class n_ary_tree_weight_node
inline bool operator < (
n_ary_tree_weight_node const& left,
n_ary_tree_weight_node const& right
);
} // namespace mixing
} // namespace animation
} // namespace xray
#include "mixing_n_ary_tree_weight_node_inline.h"
#endif // #ifndef N_ARY_TREE_WEIGHT_NODE_H_INCLUDED
|
/*
* fsarchiver: Filesystem Archiver
*
* Copyright (C) 2008-2017 Francois Dupoux. 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 v2 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.
*
* Homepage: http://www.fsarchiver.org
*/
#ifndef __DICO_H__
#define __DICO_H__
#include "types.h"
enum {DICO_ESUCCESS=0, DICO_ENOENT, DICO_EINVAL, DICO_EBADSIZE, DICO_EFULL, DICO_EMEM, DICO_EDUPLICATE, DICO_EINVALCHAR};
enum {DICTYPE_NULL=0, DICTYPE_U8, DICTYPE_U16, DICTYPE_U32, DICTYPE_U64, DICTYPE_DATA, DICTYPE_STRING};
struct s_dico;
struct s_dicoitem;
typedef struct s_dico cdico;
typedef struct s_dicoitem cdicoitem;
struct s_dico
{
struct s_dicoitem *head;
};
struct s_dicoitem
{ u8 type;
u8 section;
u16 key;
u16 size;
char *data;
cdicoitem *next;
};
cdico *dico_alloc();
int dico_destroy(cdico *d);
int dico_show(cdico *d, u8 section, char *debugtxt);
int dico_count_all_sections(cdico *d);
int dico_count_one_section(cdico *d, u8 section);
int dico_add_data(cdico *d, u8 section, u16 key, const void *data, u16 size);
int dico_add_generic(cdico *d, u8 section, u16 key, const void *data, u16 size, u8 type);
int dico_get_generic(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size);
int dico_get_data(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size);
int dico_add_u16(cdico *d, u8 section, u16 key, u16 data);
int dico_add_u32(cdico *d, u8 section, u16 key, u32 data);
int dico_add_u64(cdico *d, u8 section, u16 key, u64 data);
int dico_get_u16(cdico *d, u8 section, u16 key, u16 *data);
int dico_get_u32(cdico *d, u8 section, u16 key, u32 *data);
int dico_get_u64(cdico *d, u8 section, u16 key, u64 *data);
int dico_add_string(cdico *d, u8 section, u16 key, const char *szstring);
int dico_get_string(cdico *d, u8 section, u16 key, char *buffer, u16 bufsize);
#endif // __DICO_H__
|
#include "mk20dx128.h"
#include "core_pins.h"
#include "HardwareSerial.h"
// UART0 and UART1 are clocked by F_CPU, UART2 is clocked by F_BUS
// UART0 has 8 byte fifo, UART1 and UART2 have 1 byte buffer
#define TX_BUFFER_SIZE 40
static volatile uint8_t tx_buffer[TX_BUFFER_SIZE];
static volatile uint8_t tx_buffer_head = 0;
static volatile uint8_t tx_buffer_tail = 0;
static volatile uint8_t transmitting = 0;
#define RX_BUFFER_SIZE 64
static volatile uint8_t rx_buffer[RX_BUFFER_SIZE];
static volatile uint8_t rx_buffer_head = 0;
static volatile uint8_t rx_buffer_tail = 0;
#define C2_ENABLE UART_C2_TE | UART_C2_RE | UART_C2_RIE
#define C2_TX_ACTIVE C2_ENABLE | UART_C2_TIE
#define C2_TX_COMPLETING C2_ENABLE | UART_C2_TCIE
#define C2_TX_INACTIVE C2_ENABLE
void serial3_begin(uint32_t divisor)
{
SIM_SCGC4 |= SIM_SCGC4_UART2; // turn on clock, TODO: use bitband
rx_buffer_head = 0;
rx_buffer_tail = 0;
tx_buffer_head = 0;
tx_buffer_tail = 0;
transmitting = 0;
CORE_PIN7_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3);
CORE_PIN8_CONFIG = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3);
UART2_BDH = (divisor >> 13) & 0x1F;
UART2_BDL = (divisor >> 5) & 0xFF;
UART2_C4 = divisor & 0x1F;
UART2_C1 = 0;
UART2_PFIFO = 0;
UART2_C2 = C2_TX_INACTIVE;
NVIC_ENABLE_IRQ(IRQ_UART2_STATUS);
}
void serial3_end(void)
{
if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return;
while (transmitting) yield(); // wait for buffered data to send
NVIC_DISABLE_IRQ(IRQ_UART2_STATUS);
UART2_C2 = 0;
CORE_PIN7_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_MUX(1);
CORE_PIN8_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_MUX(1);
rx_buffer_head = 0;
rx_buffer_tail = 0;
}
void serial3_putchar(uint8_t c)
{
uint32_t head;
if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return;
head = tx_buffer_head;
if (++head >= TX_BUFFER_SIZE) head = 0;
while (tx_buffer_tail == head) {
yield(); // wait
}
tx_buffer[head] = c;
transmitting = 1;
tx_buffer_head = head;
UART2_C2 = C2_TX_ACTIVE;
}
void serial3_flush(void)
{
while (transmitting) yield(); // wait
}
int serial3_available(void)
{
uint8_t head, tail;
head = rx_buffer_head;
tail = rx_buffer_tail;
if (head >= tail) return head - tail;
return RX_BUFFER_SIZE + head - tail;
}
int serial3_getchar(void)
{
uint8_t head, tail;
int c;
head = rx_buffer_head;
tail = rx_buffer_tail;
if (head == tail) return -1;
if (++tail >= RX_BUFFER_SIZE) tail = 0;
c = rx_buffer[tail];
rx_buffer_tail = tail;
return c;
}
int serial3_peek(void)
{
uint8_t head, tail;
head = rx_buffer_head;
tail = rx_buffer_tail;
if (head == tail) return -1;
return rx_buffer[tail];
}
void serial3_clear(void)
{
rx_buffer_head = rx_buffer_tail;
}
// status interrupt combines
// Transmit data below watermark UART_S1_TDRE
// Transmit complete UART_S1_TC
// Idle line UART_S1_IDLE
// Receive data above watermark UART_S1_RDRF
// LIN break detect UART_S2_LBKDIF
// RxD pin active edge UART_S2_RXEDGIF
void uart2_status_isr(void)
{
uint8_t head, tail, c;
//digitalWriteFast(4, HIGH);
if (UART2_S1 & UART_S1_RDRF) {
//digitalWriteFast(5, HIGH);
c = UART2_D;
head = rx_buffer_head + 1;
if (head >= RX_BUFFER_SIZE) head = 0;
if (head != rx_buffer_tail) {
rx_buffer[head] = c;
rx_buffer_head = head;
}
//digitalWriteFast(5, LOW);
}
c = UART2_C2;
if ((c & UART_C2_TIE) && (UART2_S1 & UART_S1_TDRE)) {
//digitalWriteFast(5, HIGH);
head = tx_buffer_head;
tail = tx_buffer_tail;
if (head == tail) {
UART2_C2 = C2_TX_COMPLETING;
} else {
if (++tail >= TX_BUFFER_SIZE) tail = 0;
UART2_D = tx_buffer[tail];
tx_buffer_tail = tail;
}
//digitalWriteFast(5, LOW);
}
if ((c & UART_C2_TCIE) && (UART2_S1 & UART_S1_TC)) {
transmitting = 0;
UART2_C2 = C2_TX_INACTIVE;
}
//digitalWriteFast(4, LOW);
}
|
/*
Copyright (c) 2015-2018 Idiap Research Institute, http://www.idiap.ch/
Written by James Newling <james.newling@gmail.com>
All rights reserved.
eakmeans is a library for exact and approximate k-means written in C++ and
Python. This file is part of eakmeans. See file COPYING for more details.
This file is part of eakmeans.
eakmeans is free software: you can redistribute it and/or modify
it under the terms of the 3-Clause BSD Licence. See
https://opensource.org/licenses/BSD-3-Clause for more details.
eakmeans 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 file
COPYING for more details.
*/
#ifndef PLL_EXACTSIMPLEBATCHKMEANS_H
#define PLL_EXACTSIMPLEBATCHKMEANS_H
#include "basesimpleexact.h"
namespace kmeans{
template <typename TInt, typename TFloat>
class SimpleExactBatchKmeans : public kmeans::BaseSimpleExactKmeans<TInt, TFloat>{
private:
TInt nperbatch;
public:
TInt get_nperbatch(){
return this->nperbatch;
}
template<typename... Args>
SimpleExactBatchKmeans(Args&&... args): kmeans::BaseSimpleExactKmeans<TInt, TFloat> (std::forward<Args>(args)...) {
this->setalgname("Exact Simple Batch K-Means");
//set so that the batch step does not cause memory in assigment to exceed half memory of data itself
nperbatch = std::max(
static_cast<TInt> (1), static_cast<TInt> ((this->getndata() * this->getdimension())/(2 * this->getncentroids() * this->nthreads))
);
}
virtual ~SimpleExactBatchKmeans(){};
protected:
virtual void set_X_tasks(){
this->X_tasks = {
arrutilv2::update_L_S_H_batch_ati(this->getnthreads(), this->getndata(), this->nperbatch, this->getdimension(), this->getdata(), this->getncentroids(), this->get_C(), this->get_data_l22s(), this->get_C_l22s(), this->get_L(), this->get_dsums(), this->get_dcounts(), this->get_sums(), this->get_counts(), this->nchanges, this->work_mutex, this->ndcalcs_X)
};
//update_L_S_H_batch_ati(TInt nthreads, TInt ndata, TInt nperbatch, TInt dimension, const TFloat * const data, TInt ncentroids, const TFloat * const C, const TFloat * const data_l22s, const TFloat * const C_l22s, TInt * const L, TFloat * const dsums, TInt * const dcounts, TFloat * const sums, TInt * const counts, TInt & nchanges, std::mutex & work_mutex, std::atomic<TInt> & ndcalcs){
}
};
}
#endif
//extern template class kmeans::SimpleExactBatchKmeans<size_t, double>;
//extern template class kmeans::SimpleExactBatchKmeans<size_t, float>;
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.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 TOMAHAWKARTISTPLAYLISTINTERFACE_H
#define TOMAHAWKARTISTPLAYLISTINTERFACE_H
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include "Artist.h"
#include "Typedefs.h"
#include "PlaylistInterface.h"
#include "DllMacro.h"
namespace Tomahawk
{
class DLLEXPORT ArtistPlaylistInterface : public Tomahawk::PlaylistInterface
{
Q_OBJECT
public:
ArtistPlaylistInterface( Tomahawk::Artist* artist, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
virtual ~ArtistPlaylistInterface();
virtual QList<Tomahawk::query_ptr> tracks() const;
virtual int trackCount() const { return m_queries.count(); }
virtual void setCurrentIndex( qint64 index );
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const;
virtual Tomahawk::result_ptr resultAt( qint64 index ) const;
virtual Tomahawk::query_ptr queryAt( qint64 index ) const;
virtual qint64 indexOfResult( const Tomahawk::result_ptr& result ) const;
virtual qint64 indexOfQuery( const Tomahawk::query_ptr& query ) const;
virtual Tomahawk::result_ptr currentItem() const;
virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; }
virtual bool shuffled() const { return false; }
virtual void setRepeatMode( PlaylistModes::RepeatMode ) {}
virtual void setShuffled( bool ) {}
signals:
void tracksLoaded( Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection );
private slots:
void onTracksLoaded( const QList< Tomahawk::query_ptr >& tracks );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( const QString& infoId );
private:
Q_DISABLE_COPY( ArtistPlaylistInterface )
QList< Tomahawk::query_ptr > m_queries;
mutable result_ptr m_currentItem;
bool m_infoSystemLoaded;
bool m_databaseLoaded;
Tomahawk::ModelMode m_mode;
Tomahawk::collection_ptr m_collection;
QPointer< Tomahawk::Artist > m_artist;
};
}; // ns
#endif
|
//===-- Shakti.h - Top-level interface for Shakti representation -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the entry points for global functions defined in the LLVM
// Shakti back-end.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_SHAKTI_SHAKTI_H
#define LLVM_LIB_TARGET_SHAKTI_SHAKTI_H
#include "llvm/Support/CodeGen.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
class FunctionPass;
class ShaktiTargetMachine;
FunctionPass *createShaktiISelDag(ShaktiTargetMachine &TM);
} // namespace llvm
#endif
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("HTTP/1.1 200 OK\n") ;
printf("Content-type: text/plain\n") ;
printf("\r\n") ;
printf("CGI work !\n") ;
return EXIT_SUCCESS ;
}
|
/* md5.c - interface for checking and setting program environment.
This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
MD5 Message-Digest Algorithm (RFC 1321).
<http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5>
Copyright (c) 2001 Alexander Peslyak <solar at openwall.com> and it is hereby released to the
general public under the following terms:
Redistribution and use in source and binary forms, with or without
modification, are permitted.
There's ABSOLUTELY NO WARRANTY, express or implied.
See md5.c for more information. */
#ifdef HAVE_OPENSSL
#include <openssl/md5.h>
#elif !defined(_MD5_H)
#define _MD5_H
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus;
typedef struct {
MD5_u32plus lo, hi;
MD5_u32plus a, b, c, d;
unsigned char buffer[64];
MD5_u32plus block[16];
} MD5_CTX;
extern void MD5_Init(MD5_CTX *ctx);
extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
#endif
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char ch, filename[50];
int c = 0, n = 0;
printf("Please enter the name of the file you wish to open.\n");
fgets(filename, 50, stdin);
fp = fopen("Hello.txt", "r"); // Opens file in read mode
if(fp == NULL)
{
perror("Error opening file.\n");
exit(EXIT_FAILURE); // Displays error in case the program fails to open the file
}
printf("The contents of the file are:\n");
while((ch = fgetc(fp)) != EOF)
{
if(ch == '\n') // Counts the number of lines
{
n++;
}
printf("%c", ch);
c++; // Counts the number of characters
}
fclose(fp);
printf("\n");
printf("The number of characters in the file is %d and the number of lines is %d .\n", c, n);
return 0;
}
|
/*
* Copyright (c) 2013 Qualcomm Atheros, Inc..
* All Rights Reserved.
* Qualcomm Atheros Confidential and Proprietary.
*/
#include "qcom_common.h"
#include "threadx/tx_api.h"
#include "qcom_cli.h"
#include "threadxdmn_api.h"
#include <aj_target.h>
#include "aj_status.h"
#include "aj_wifi_ctrl.h"
TX_THREAD host_thread;
#ifdef REV74_TEST_ENV4
#define BYTE_POOL_SIZE (2*1024 + 128 )
#define PSEUDO_HOST_STACK_SIZE (2 * 1024 ) /* small stack for pseudo-Host thread */
#else
#define BYTE_POOL_SIZE (3*1024 + 256 )
#define PSEUDO_HOST_STACK_SIZE (3 * 1024 ) /* small stack for pseudo-Host thread */
#endif
TX_BYTE_POOL pool;
extern void AllJoyn_Start(unsigned long arg);
void user_main(void)
{
extern void task_execute_cli_cmd();
tx_byte_pool_create(&pool, "AllJoyn pool", TX_POOL_CREATE_DYNAMIC, BYTE_POOL_SIZE);
{
CHAR *pointer;
tx_byte_allocate(&pool, (VOID **) & pointer, PSEUDO_HOST_STACK_SIZE, TX_NO_WAIT);
tx_thread_create(&host_thread, "AllJoyn thread", AllJoyn_Start,
0, pointer, PSEUDO_HOST_STACK_SIZE, 16, 16, 4, TX_AUTO_START);
}
cdr_threadx_thread_init();
}
/**
* Wifi Configuration
* This section of code enables an application developer to choose at build
* time which WiFi configuration method to use. The choices are
* - connect to a known access point via SSID, passphrase, and security type
* - create an access point with a specific SSID and passphrase
* - or do all of the configuration work in the application code (OnBoarding does this)
*
* The options that are _not_ chosen are given empty implementations which override
* the default implementations in the target-specific library
*/
#ifndef AJ_CONFIGURE_WIFI_UPON_START
/* supply a stubbed implementations when WiFi should not be automatically configured. */
AJ_Status ConfigureWirelessNetwork(void)
{
return AJ_OK;
}
#endif
#ifdef WIFI_SSID
const char* AJ_ssid = WIFI_SSID;
/* supply a stubbed implementation of this function when connecting to a predefined access point. */
AJ_Status ConfigureSoftAP()
{
return AJ_ERR_INVALID;
}
#ifdef WIFI_PASSPHRASE
const char* AJ_passphrase = WIFI_PASSPHRASE;
#else
const char* AJ_passphrase = NULL;
#endif
#ifdef WIFI_SECURITY_TYPE
const AJ_WiFiSecurityType AJ_secType = WIFI_SECURITY_TYPE;
const AJ_WiFiCipherType AJ_cipherType = WIFI_CIPHER_TYPE;
#else
const AJ_WiFiSecurityType AJ_secType = AJ_WIFI_SECURITY_WPA2;
const AJ_WiFiCipherType AJ_cipherType = AJ_WIFI_CIPHER_CCMP;
#endif
#endif /* ifdef WIFI_SSID */
#ifdef SOFTAP_SSID
const char* AJ_ssid = SOFTAP_SSID;
/* supply a stubbed implementation of this function when creating an access point. */
AJ_Status ConfigureWifi()
{
return AJ_OK;
}
#ifdef SOFTAP_PASSPHRASE
const char* AJ_passphrase = SOFTAP_PASSPHRASE;
#else
const char* AJ_passphrase = NULL;
#endif
#ifdef SOFTAP_SECURITY_TYPE
const AJ_WiFiSecurityType AJ_secType = SOFTAP_SECURITY_TYPE;
const AJ_WiFiCipherType AJ_cipherType = SOFTAP_CIPHER_TYPE;
#else
const AJ_WiFiSecurityType AJ_secType = AJ_WIFI_SECURITY_WPA2;
const AJ_WiFiCipherType AJ_cipherType = AJ_WIFI_CIPHER_CCMP;
#endif
#endif /* ifdef SOFTAP_SSID */
/**
* End of wifi configuration section
*/
|
/*
* MMSE_SENIA_IU.h
* This routine performs MMSE detection with SENIA and IU
* Created on: Mar 16, 2016
* Author: tianpei.chen@mail.mcgill.ca
*/
#ifndef MMSE_SENIA_IU_H_
#define MMSE_SENIA_IU_H_
#include "SENIA.h"
#include "IU.h"
void MMSE_SENIA_IU(gsl_vector_complex *preceived, gsl_matrix_complex *pH,
double snr, double pav, int M, int k, int L, gsl_vector_complex *psymOut);
void MMSE_SENIA_IU(gsl_vector_complex *preceived, gsl_matrix_complex *pH,
double snr, double pav, int M, int k, int L, gsl_vector_complex *psymOut){
gsl_complex alpha, beta1,beta2;
GSL_SET_COMPLEX(&alpha, 1,0);
GSL_SET_COMPLEX(&beta1, 1 / snr, 0);
GSL_SET_COMPLEX(&beta2, 0, 0);
int Nr = pH->size1;
int Nt = pH->size2;
int count;
gsl_matrix_complex *G_pre, *G_preInv, *G_nonofuse, *G_preInvIU, *G;
gsl_matrix_complex *pH_sub1, *pH_sub2;
gsl_vector_complex *pH_col_tmp;
gsl_permutation *p = gsl_permutation_calloc(Nt);
int *signum = (int*)calloc(1, sizeof(int));
*signum = 1;
G_pre = gsl_matrix_complex_calloc(L, L); //H1'H1
G_preInv = gsl_matrix_complex_calloc(L, L);// (H1'H1+rho^(-1)I)^(-1)
G_nonofuse = gsl_matrix_complex_calloc(L, L);
G_preInvIU = gsl_matrix_complex_calloc(Nt, Nt);
G = gsl_matrix_complex_calloc(Nt,Nr);
pH_sub1 = gsl_matrix_complex_calloc(Nr, L);
pH_sub2 = gsl_matrix_complex_calloc(Nr, Nt-L);
pH_col_tmp = gsl_vector_complex_calloc(Nr);
for (count = 0; count < L; count++){
gsl_matrix_complex_get_col(pH_col_tmp, pH, count);
gsl_matrix_complex_set_col(pH_sub1, count, pH_col_tmp);
}
for (count = 0; count < (Nt-L); count++){
gsl_matrix_complex_get_col(pH_col_tmp, pH, count+L);
gsl_matrix_complex_set_col(pH_sub2, count, pH_col_tmp);
}
gsl_matrix_complex_set_identity(G_pre);
gsl_blas_zgemm(CblasConjTrans, CblasNoTrans, alpha, pH_sub1, pH_sub1, beta1, G_pre);
SENIA(G_pre, k, G_preInv, G_nonofuse); //SENIA
IU(G_preInv, pH_sub1, pH_sub2, snr, G_preInvIU); //inflate update
gsl_blas_zgemm(CblasNoTrans, CblasConjTrans, alpha, G_preInvIU, pH, beta2, G);
gsl_blas_zgemv(CblasNoTrans, alpha, G, preceived, beta2, psymOut);
RectangularQAMSlicer(psymOut, pav, M);
gsl_matrix_complex_free(G_pre);
gsl_matrix_complex_free(G_preInv);
gsl_matrix_complex_free(G_nonofuse);
gsl_matrix_complex_free(G_preInvIU);
gsl_matrix_complex_free(G);
gsl_matrix_complex_free(pH_sub1);
gsl_matrix_complex_free(pH_sub2);
gsl_vector_complex_free(pH_col_tmp);
gsl_permutation_free(p);
free(signum);
}
#endif /* MMSE_SENIA_IU_H_ */
|
////////////////////////////////////////////////////////////////////////////
// Created : 04.03.2010
// Author : Armen Abroyan
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef TERRAIN_MANAGER_H_INCLUDED
#define TERRAIN_MANAGER_H_INCLUDED
#include <xray/render/base/common_types.h>
#include <xray/render/base/visual.h>
#include "terrain_texture_pool.h"
#include <xray/resources_cook_classes.h>
namespace xray {
namespace render {
// forward declarations
class blender_terrain_NEW;
class terrain_visual;
struct terrain_cell
{
visual_ptr visual;
bool operator == (visual_ptr const& v)
{
return visual == v;
}
};
class terrain : public quasi_singleton<terrain>
{
public:
typedef render::vector<terrain_cell> cells;
public:
terrain ( );
~terrain ( );
//bool has_cell ( pcstr cell_id) const;
//visual_ptr get_cell ( pcstr cell_id);
void add_cell ( visual_ptr const v, bool beditor );
void remove_cell ( visual_ptr const v, bool beditor );
// Editor specific functions
void update_cell_buffer ( visual_ptr const v, xray::vectora<buffer_fragment_NEW> const& fragments, float4x4 const& transform);
void add_cell_texture ( visual_ptr const v, texture_string const & texture, u32 tex_user_id);
void remove_cell_texture ( visual_ptr const v, u32 tex_user_id);
void exchange_texture ( texture_string const & old_texture, texture_string const & new_texture);
cells const& get_editor_cells () const { return m_editor_cells; }
cells const& get_game_cells () const { return m_game_cells; }
private:
public:
cells m_editor_cells;
cells m_game_cells;
terrain_texture_pool m_texture_pool;
blender_terrain_NEW* m_blender;
}; // class terrain
struct terrain_cell_cook : public resources::unmanaged_cook
{
typedef resources::unmanaged_cook super;
terrain_cell_cook ( );
virtual mutable_buffer allocate_resource (resources::query_result_for_cook & in_query,
const_buffer raw_file_data,
bool file_exist)
{
XRAY_UNREFERENCED_PARAMETERS (& in_query, & raw_file_data, file_exist);
return mutable_buffer::zero();
}
virtual void deallocate_resource (pvoid) { }
virtual void destroy_resource (resources::unmanaged_resource * resource);
virtual void create_resource (resources::query_result_for_cook & in_out_query,
const_buffer raw_file_data,
mutable_buffer in_out_unmanaged_resource_buffer);
virtual create_resource_if_no_file_delegate_type get_create_resource_if_no_file_delegate ()
{
return create_resource_if_no_file_delegate_type(this, & terrain_cell_cook::create_resource_if_no_file);
}
void create_resource_if_no_file (resources::query_result_for_cook & in_out_query,
mutable_buffer in_out_unmanaged_resource_buffer);
};
} // namespace render
} // namespace xray
#endif // #ifndef TERRAIN_MANAGER_H_INCLUDED
|
/*
* utils.h
*
* Created on: 01/nov/2011
* Author: lorenzo
*/
#ifndef UTILS_H_
#define UTILS_H_
#define COS120 -0.5
#define SIN120 0.8660254037844386
#define SQR(x) ((x) * (x))
#define SCALAR(x, y) ((x)[0]*(y)[0] + (x)[1]*(y)[1] + (x)[2]*(y)[2])
#define MATRIX_VECTOR_MULTIPLICATION(m, v, result) {\
(result)[0] = (m)[0][0]*(v)[0] + (m)[0][1]*(v)[1] + (m)[0][2]*(v)[2];\
(result)[1] = (m)[1][0]*(v)[0] + (m)[1][1]*(v)[1] + (m)[1][2]*(v)[2];\
(result)[2] = (m)[2][0]*(v)[0] + (m)[2][1]*(v)[1] + (m)[2][2]*(v)[2];\
}
#include "defs.h"
void set_patches(System *syst, PatchyParticle *p);
void set_vector(vector v, double x, double y, double z);
void set_base_orientation(matrix orient);
void cross(vector v1, vector v2, vector res);
void normalize(vector v);
void matrix_matrix_multiplication(matrix m, matrix n, matrix res);
//void matrix_vector_multiplication(matrix m, vector v, vector result);
void random_vector_on_sphere(vector res);
void random_orientation(System *syst, matrix orient);
void get_rotation_matrix(vector axis, double t, matrix rotation_matrix);
void place_inside_vbonding(System *syst, PatchyParticle *rec, vector r, matrix orient, int rec_patch);
void utils_rotate_matrix(matrix orient_old, matrix orient_new, vector axis, double t);
void get_rotated_vector(vector v, vector axis, double t, vector res);
void rotate_vector(vector v, vector axis, double t);
void set_orientation_around_vector(vector v, matrix orient, double t);
void gram_schmidt(vector v1, vector v2, vector v3);
void utils_reset_acceptance_counters(System *syst);
#endif /* UTILS_H_ */
|
#ifndef __TIMER_H__
#define __TIMER_H__
void timer_init(void);
extern uint16_t cnt_control,cnt_imu,cnt_report;
extern uint8_t led_fleg;
#endif
|
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2017 Free Software Foundation, Inc.
*
* GRUB 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/term.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{0, 'n', 0, N_("grub_getkey_noblock"), 0, 0},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t
grub_cmd_getkey (grub_extcmd_context_t ctxt, int argc, char **args)
{
struct grub_arg_list *state = ctxt->state;
int key;
char keyenv[20];
if (state[0].set)
key = grub_getkey_noblock ();
else
key = grub_getkey ();
grub_printf ("0x%08x\n", key);
if (argc == 1)
{
grub_snprintf (keyenv, 20, "%d", key);
grub_env_set (args[0], keyenv);
}
return GRUB_ERR_NONE;
}
static grub_extcmd_t cmd;
GRUB_MOD_INIT(getkey)
{
cmd = grub_register_extcmd ("getkey", grub_cmd_getkey,
GRUB_COMMAND_ACCEPT_DASH
| GRUB_COMMAND_OPTIONS_AT_START,
N_("[-n] [VARNAME]"),
N_("Return the value of the pressed key. "),
options);
}
GRUB_MOD_FINI(getkey)
{
grub_unregister_extcmd (cmd);
}
|
/*
* lastfm-ws.h -- Last.fm Web Services v2.0
*
* Copyright (C) 2009, 2011, 2013 Igalia, S.L.
* Authors: Alberto Garcia <berto@igalia.com>
*
* This file is part of Vagalume and is published under the GNU GPLv3
* See the README file for more details.
*/
#ifndef LASTFM_WS_H
#define LASTFM_WS_H
#include "playlist.h"
#include "protocol.h"
#include "vgl-server.h"
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
LASTFM_OK,
LASTFM_NOT_FOUND = 25,
LASTFM_GEO_RESTRICTED = 28
} LastfmErrorCode;
/* Opaque type that represents a Last.fm Web Services session */
typedef struct _LastfmWsSession LastfmWsSession;
LastfmSession *
lastfm_ws_session_get_v1_session (LastfmWsSession *session);
char *
lastfm_ws_get_auth_token (const VglServer *srv,
char **auth_url);
LastfmWsSession *
lastfm_ws_get_session_from_token (VglServer *srv,
const char *token);
LastfmWsSession *
lastfm_ws_get_session (VglServer *srv,
const char *user,
const char *pass,
LastfmErr *err);
LastfmErrorCode
lastfm_ws_radio_tune (LastfmWsSession *session,
const char *radio_url,
const char *lang);
LastfmPls *
lastfm_ws_radio_get_playlist (const LastfmWsSession *session,
gboolean discovery,
gboolean low_bitrate,
gboolean scrobbling);
gboolean
lastfm_ws_get_friends (const VglServer *srv,
const char *user,
GList **friendlist);
gboolean
lastfm_ws_get_user_tags (const VglServer *srv,
const char *username,
GList **taglist);
gboolean
lastfm_ws_get_user_track_tags (const LastfmWsSession *session,
const LastfmTrack *track,
LastfmTrackComponent type,
GList **taglist);
gboolean
lastfm_ws_get_track_tags (const LastfmWsSession *session,
const LastfmTrack *track,
LastfmTrackComponent type,
GList **taglist);
gboolean
lastfm_ws_add_tags (const LastfmWsSession *session,
const LastfmTrack *track,
LastfmTrackComponent type,
const char *tags);
gboolean
lastfm_ws_remove_tag (const LastfmWsSession *session,
const LastfmTrack *track,
LastfmTrackComponent type,
const char *tag);
gboolean
lastfm_ws_share_track (const LastfmWsSession *session,
const LastfmTrack *track,
const char *text,
LastfmTrackComponent type,
const char *rcpt);
gboolean
lastfm_ws_love_track (const LastfmWsSession *session,
const LastfmTrack *track);
gboolean
lastfm_ws_ban_track (const LastfmWsSession *session,
const LastfmTrack *track);
gboolean
lastfm_ws_tag_track (const LastfmWsSession *session,
const LastfmTrack *track,
LastfmTrackComponent type,
GSList *tags);
gboolean
lastfm_ws_add_to_playlist (const LastfmWsSession *session,
const LastfmTrack *track);
G_END_DECLS
#endif /* LASTFM_WS_H */
|
void talk(void)
{
say("`%'Please be careful when using this machine.' - the ancient ones.", ¤t_sprite);
}
|
/*********************************************************************
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.32 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with a license and should not be re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GUIDEMO_Intro.c
Purpose : Introduction for emWin generic demo
(This is also a good file to demo and explain basic
emWin features by setting breakpoints)
----------------------------------------------------------------------
*/
#include <string.h>
#include "GUIDEMO.h"
/*********************************************************************
*
* Defines
*/
#define SCREEN_DIV 6 // 2^6 = 64
#define FACTOR_EMWIN 4
#define FACTOR_DESC 11
#define FACTOR_ANY_COMP 22
#define FACTOR_VERSION 31
#define FACTOR_LOGO 38
#define FACTOR_WWW 56
#define DIST_ANY_COMP 18
/*********************************************************************
*
* GUIDEMO_Intro
*
**********************************************************************
*/
void GUIDEMO_Intro(void) {
unsigned xCenter;
unsigned xSize;
unsigned ySize;
char acVersion[30] = "Version of emWin: ";
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
xCenter = xSize / 2;
GUIDEMO_DrawBk();
GUI_SetTextMode(GUI_TM_TRANS);
//
// emWin
//
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_FontRounded22);
GUI_DispStringHCenterAt("emWin", xCenter, (FACTOR_EMWIN * ySize) >> SCREEN_DIV);
//
// emWin description
//
GUI_SetFont(&GUI_FontSouvenir18);
GUI_DispStringHCenterAt("Universal graphic software\nfor embedded applications", xCenter, (FACTOR_DESC * ySize) >> SCREEN_DIV);
//
// Any text
//
GUI_SetColor(GUI_MAKE_COLOR(0x2288ff));
GUI_DispStringHCenterAt("Any CPU - Any Display - Any Application", xCenter, (FACTOR_ANY_COMP * ySize) >> SCREEN_DIV);
//
// Compiled
//
GUI_SetFont(&GUI_Font10S_ASCII);
GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, ((FACTOR_ANY_COMP * ySize) >> SCREEN_DIV) + DIST_ANY_COMP);
//
// Version
//
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_FontSouvenir18);
strcat(acVersion, GUI_GetVersionString());
GUI_DispStringHCenterAt(acVersion, xCenter, (FACTOR_VERSION * ySize) >> SCREEN_DIV);
//
// Logo
//
GUI_DrawBitmap(&bmSeggerLogo, (xSize - bmSeggerLogo.XSize) >> 1, (FACTOR_LOGO * ySize) >> SCREEN_DIV);
//
// www.segger.com
//
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_FontRounded22);
GUI_DispStringHCenterAt("www.segger.com", xCenter, (FACTOR_WWW * ySize) >> SCREEN_DIV);
GUIDEMO_Delay(5000);
}
/*************************** End of file ****************************/
|
/*
* Progress.h
*
* Created on: 25.03.2012
* Author: michi
*/
#ifndef PROGRESS_H_
#define PROGRESS_H_
#include "../../lib/base/pointer.h"
#include "../../Stuff/Observable.h"
namespace hui {
class Window;
class Timer;
}
class Progress : public Observable<VirtualBase> {
public:
Progress(const string &str, hui::Window *parent);
~Progress() override {};
void _cdecl __init__(const string &str, hui::Window *parent);
void _cdecl __delete__() override;
void set(float progress);
void set(const string &str, float progress);
void _cdecl set_kaba(const string &str, float progress);
static const string MESSAGE_CANCEL;
void _cdecl cancel();
bool _cdecl is_cancelled();
protected:
Progress();
owned<hui::Window> dlg;
owned<hui::Timer> timer;
float allow_next;
bool cancelled;
};
class ProgressCancelable : public Progress {
public:
ProgressCancelable(const string &str, hui::Window *parent);
ProgressCancelable();
~ProgressCancelable() override {};
void _cdecl __init__(const string &str, hui::Window *parent);
void _cdecl __delete__() override;
};
#endif /* PROGRESS_H_ */
|
/**
* This file is part of Tales of Symphonia "Fix".
*
* Tales of Symphonia "Fix" 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.
*
* Tales of Symphonia "Fix" 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 Tales of Symphonia "Fix".
*
* If not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef __TSFIX__PARAMETER_H__
#define __TSFIX__PARAMETER_H__
#include "ini.h"
#include <Windows.h>
#include <vector>
namespace tsf
{
class iParameter
{
public:
iParameter (void) {
ini = nullptr;
}
virtual std::wstring get_value_str (void) = 0;
virtual void set_value_str (std::wstring str) = 0;
// Read value from INI
bool load (void)
{
if (ini != nullptr) {
iSK_INISection& section = ini->get_section (ini_section.c_str ());
if (section.contains_key (ini_key.c_str ())) {
set_value_str (section.get_value (ini_key.c_str ()));
return true;
}
}
return false;
}
// Store value in INI and/or XML
bool store (void)
{
bool ret = false;
if (ini != nullptr) {
iSK_INISection& section = ini->get_section (ini_section.c_str ());
// If this operation actually creates a section, we need to make sure
// that section has a name!
section.set_name (ini_section.c_str ());
if (section.contains_key (ini_key.c_str ())) {
section.get_value (ini_key.c_str ()) = get_value_str ().c_str ();
ret = true;
}
// Add this key/value if it doesn't already exist.
else {
section.add_key_value (ini_key.c_str (), get_value_str ().c_str ());
ret = true;// +1;
}
}
return ret;
}
void register_to_ini (iSK_INI* file, std::wstring section, std::wstring key)
{
ini = file;
ini_section = section;
ini_key = key;
}
protected:
private:
iSK_INI* ini;
std::wstring ini_section;
std::wstring ini_key;
};
template <typename _T>
class Parameter : public iParameter {
public:
virtual std::wstring get_value_str (void) = 0;
virtual _T get_value (void) = 0;
virtual void set_value (_T val) = 0;
virtual void set_value_str (std::wstring str) = 0;
virtual void store (_T val) = 0;
virtual void store_str (std::wstring str) = 0;
virtual bool load (_T& ref) = 0;
protected:
_T value;
};
class ParameterInt : public Parameter <int>
{
public:
std::wstring get_value_str (void);
int get_value (void);
void set_value (int val);
void set_value_str (std::wstring str);
void store (int val);
void store_str (std::wstring str);
bool load (int& ref);
protected:
int value;
};
class ParameterInt64 : public Parameter <int64_t>
{
public:
std::wstring get_value_str (void);
int64_t get_value (void);
void set_value (int64_t val);
void set_value_str (std::wstring str);
void store (int64_t val);
void store_str (std::wstring str);
bool load (int64_t& ref);
protected:
int64_t value;
};
class ParameterBool : public Parameter <bool>
{
public:
std::wstring get_value_str (void);
bool get_value (void);
void set_value (bool val);
void set_value_str (std::wstring str);
void store (bool val);
void store_str (std::wstring str);
bool load (bool& ref);
protected:
bool value;
};
class ParameterFloat : public Parameter <float>
{
public:
std::wstring get_value_str (void);
float get_value (void);
void set_value (float val);
void set_value_str (std::wstring str);
void store (float val);
void store_str (std::wstring str);
bool load (float& ref);
protected:
float value;
};
class ParameterStringW : public Parameter <std::wstring>
{
public:
std::wstring get_value_str (void);
std::wstring get_value (void);
void set_value (std::wstring str);
void set_value_str (std::wstring str);
void store (std::wstring val);
void store_str (std::wstring str);
bool load (std::wstring& ref);
protected:
std::wstring value;
};
class ParameterFactory {
public:
template <typename _T> iParameter* create_parameter (const wchar_t* name);
protected:
private:
std::vector <iParameter *> params;
};
}
#endif /* __AD__PARAMETER_H__ */
|
/*
* Copyright (C) 2009 Christopho, Solarus - http://www.solarus-engine.org
*
* Solarus 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.
*
* Solarus 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 SOLARUS_PLAYER_MOVEMENT_H
#define SOLARUS_PLAYER_MOVEMENT_H
#include "Common.h"
#include "movements/SmoothMovement.h"
/**
* @brief Movement of an entity controlled by the player.
*
* This movement is an 8-direction movement typically used by the hero.
* This class basically converts the combination of directional keys pressed
* (from the class GameControls) into a movement.
*/
class PlayerMovement: public SmoothMovement {
protected:
int moving_speed; /**< speed of the entity when it is moving */
int direction8; /**< current direction of the movement (0 to 7), as defined by the directional keys
* currently pressed by the player (when the movement allows them) or -1 */
void set_wanted_direction();
public:
// creation and destruction
PlayerMovement(int speed);
~PlayerMovement();
void update();
int get_moving_speed();
void set_moving_speed(int moving_speed);
int get_wanted_direction8();
void compute_movement();
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.