text
stringlengths 4
6.14k
|
|---|
/* Copyright (c) 2008-2011, Hisilicon Tech. Co., Ltd. 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 Code Aurora Forum, Inc. 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 "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef K3_FB_DEF_H
#define K3_FB_DEF_H
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <asm/bug.h>
#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
/* align */
#ifndef ALIGN_DOWN
#define ALIGN_DOWN(val, al) ((val) & ~((al)-1))
#endif
#ifndef ALIGN_UP
#define ALIGN_UP(val, al) (((val) + ((al)-1)) & ~((al)-1))
#endif
#ifndef BIT
#define BIT(x) (1<<(x))
#endif
/*--------------------------------------------------------------------------*/
#define NDEBUG 0
#if NDEBUG
#define k3fb_logd(fmt, ...)
#else
#define k3fb_logd(fmt, ...) \
pr_debug("[k3fb]%s: "fmt, __func__, ##__VA_ARGS__)
#endif
#define k3fb_logi(fmt, ...) \
pr_info("[k3fb]%s: "fmt, __func__, ##__VA_ARGS__)
#define k3fb_logw(fmt, ...) \
pr_warn("[k3fb]%s:"fmt, __func__, ##__VA_ARGS__)
#define k3fb_loge(fmt, ...) \
pr_err("[k3fb]%s: "fmt, __func__, ##__VA_ARGS__)
/*--------------------------------------------------------------------------*/
#ifdef PC_UT_TEST_ON
#define STATIC
extern volatile unsigned int g_pc_ut_reg_data[0x2000];
#define outp32(addr, val) ( g_pc_ut_reg_data[addr] = val )
#define outp16(addr, val)
#define outp8(addr, val)
#define outp(addr, val) outp32(addr, val)
#define inp32(addr) ( g_pc_ut_reg_data[addr] )
#define inp16(addr)
#define inp8(addr)
#define inp(addr)
#define inpw(port)
#define outpw(port, val)
#define inpdw(port)
#define outpdw(port, val)
#else
#define STATIC static
#define outp32(addr, val) writel(val, addr)
#define outp16(addr, val) writew(val, addr)
#define outp8(addr, val) writeb(val, addr)
#define outp(addr, val) outp32(addr, val)
#define inp32(addr) readl(addr)
#define inp16(addr) readw(addr)
#define inp8(addr) readb(addr)
#define inp(addr) inp32(addr)
#define inpw(port) readw(port)
#define outpw(port, val) writew(val, port)
#define inpdw(port) readl(port)
#define outpdw(port, val) writel(val, port)
#endif
#ifdef CONFIG_DEBUG_FS
void k3fb_logi_vsync_debugfs (const char* fmt, ...);
void k3fb_logi_display_debugfs(const char* fmt, ...);
void k3fb_logi_backlight_debugfs(const char* fmt, ...);
#else
#define k3fb_logi_vsync_debugfs(fmt, ...)
#define k3fb_logi_display_debugfs(fmt, ...)
#define k3fb_logi_backlight_debugfs(fmt, ...)
#endif
#endif /* K3_FB_DEF_H */
|
/* $Id: exception.c 2878 2009-08-14 10:41:00Z bennylp $ */
/*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "test.h"
/**
* \page page_pjlib_exception_test Test: Exception Handling
*
* This file provides implementation of \b exception_test(). It tests the
* functionality of the exception handling API.
*
* @note This test use static ID not acquired through proper registration.
* This is not recommended, since it may create ID collissions.
*
* \section exception_test_sec Scope of the Test
*
* Some scenarios tested:
* - no exception situation
* - basic TRY/CATCH
* - multiple exception handlers
* - default handlers
*
*
* This file is <b>pjlib-test/exception.c</b>
*
* \include pjlib-test/exception.c
*/
#if INCLUDE_EXCEPTION_TEST
#include <pjlib.h>
#define ID_1 1
#define ID_2 2
static int throw_id_1(void)
{
PJ_THROW( ID_1 );
PJ_UNREACHED(return -1;)
}
static int throw_id_2(void)
{
PJ_THROW( ID_2 );
PJ_UNREACHED(return -1;)
}
static int try_catch_test(void)
{
PJ_USE_EXCEPTION;
int rc = -200;
PJ_TRY {
PJ_THROW(ID_1);
}
PJ_CATCH_ANY {
rc = 0;
}
PJ_END;
return rc;
}
static int throw_in_handler(void)
{
PJ_USE_EXCEPTION;
int rc = 0;
PJ_TRY {
PJ_THROW(ID_1);
}
PJ_CATCH_ANY {
if (PJ_GET_EXCEPTION() != ID_1)
rc = -300;
else
PJ_THROW(ID_2);
}
PJ_END;
return rc;
}
static int return_in_handler(void)
{
PJ_USE_EXCEPTION;
PJ_TRY {
PJ_THROW(ID_1);
}
PJ_CATCH_ANY {
return 0;
}
PJ_END;
return -400;
}
static int test(void)
{
int rc = 0;
PJ_USE_EXCEPTION;
/*
* No exception situation.
*/
PJ_TRY {
rc = rc;
}
PJ_CATCH_ANY {
rc = -3;
}
PJ_END;
if (rc != 0)
return rc;
/*
* Basic TRY/CATCH
*/
PJ_TRY {
rc = throw_id_1();
// should not reach here.
rc = -10;
}
PJ_CATCH_ANY {
int id = PJ_GET_EXCEPTION();
if (id != ID_1) {
PJ_LOG(3,("", "...error: got unexpected exception %d (%s)",
id, pj_exception_id_name(id)));
if (!rc) rc = -20;
}
}
PJ_END;
if (rc != 0)
return rc;
/*
* Multiple exceptions handlers
*/
PJ_TRY {
rc = throw_id_2();
// should not reach here.
rc = -25;
}
PJ_CATCH_ANY {
switch (PJ_GET_EXCEPTION()) {
case ID_1:
if (!rc) rc = -30; break;
case ID_2:
if (!rc) rc = 0; break;
default:
if (!rc) rc = -40;
break;
}
}
PJ_END;
if (rc != 0)
return rc;
/*
* Test default handler.
*/
PJ_TRY {
rc = throw_id_1();
// should not reach here
rc = -50;
}
PJ_CATCH_ANY {
switch (PJ_GET_EXCEPTION()) {
case ID_1:
if (!rc) rc = 0;
break;
default:
if (!rc) rc = -60;
break;
}
}
PJ_END;
if (rc != 0)
return rc;
/*
* Nested handlers
*/
PJ_TRY {
rc = try_catch_test();
}
PJ_CATCH_ANY {
rc = -70;
}
PJ_END;
if (rc != 0)
return rc;
/*
* Throwing exception inside handler
*/
rc = -80;
PJ_TRY {
int rc2;
rc2 = throw_in_handler();
if (rc2)
rc = rc2;
}
PJ_CATCH_ANY {
if (PJ_GET_EXCEPTION() == ID_2) {
rc = 0;
} else {
rc = -90;
}
}
PJ_END;
if (rc != 0)
return rc;
/*
* Return from handler. Returning from the function inside a handler
* should be okay (though returning from the function inside the
* PJ_TRY block IS NOT OKAY!!). We want to test to see if handler
* is cleaned up properly, but not sure how to do this.
*/
PJ_TRY {
int rc2;
rc2 = return_in_handler();
if (rc2)
rc = rc2;
}
PJ_CATCH_ANY {
rc = -100;
}
PJ_END;
return 0;
}
int exception_test(void)
{
int i, rc;
enum { LOOP = 10 };
for (i=0; i<LOOP; ++i) {
if ((rc=test()) != 0) {
PJ_LOG(3,("", "...failed at i=%d (rc=%d)", i, rc));
return rc;
}
}
return 0;
}
#else
/* To prevent warning about "translation unit is empty"
* when this test is disabled.
*/
int dummy_exception_test;
#endif /* INCLUDE_EXCEPTION_TEST */
|
// qt-redmine client
// Copyright (C) 2015, Danila Demidow
// Author: dandemidow@gmail.com (Danila Demidow)
#ifndef INCLUDING
#define INCLUDING
#include <QString>
#include <QUrl>
#include "parameter.h"
template <class Self>
class Includeble {
QString _include;
public:
explicit Includeble() {}
Self &operator <<(const Include &i) {
this->_include = i.getInclude();
return *(static_cast<Self*>(this));
}
Self &operator <<(const Filter &f) {
this->_include = f.getFilter();
return *(static_cast<Self*>(this));
}
QString query() const {
return _include;
}
void setQuery(QUrl &url) const {
url.setQuery(_include);
}
};
#endif // INCLUDING
|
#ifndef __SUBJECT_H__
#define __SUBJECT_H__
#include "Observer.h"
namespace weather
{
class Subject
{
public:
virtual void registerObserver(Observer *ob) = 0;
virtual void removeObserver(Observer *ob) = 0;
virtual void notifyObservers() = 0;
};
}
#endif
|
#include <stdio.h>
#define MAXLINE 1000 /* maximum line size */
#define PRINTLONGER 80 /* size of longer lines to print */
int getline(char line[],int maxline);
void copy(char to[], char from[]);
/* print longest line */
main()
{
int len;
char line[MAXLINE];
while( (len = getline(line,MAXLINE)) > 0)
if( len > PRINTLONGER)
printf("%s", line);
return 0;
}
int getline( char s[], int lim)
{
int c, i;
for(i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; i++)
s[i] = c;
if( c == '\n') {
s[i]=c;
i++;
}
s[i]='\0';
return i;
}
|
#ifndef __XFS_ARCH_H__
#define __XFS_ARCH_H__
#ifndef XFS_BIG_INUMS
# error XFS_BIG_INUMS must be defined true or false
#endif
#ifdef __KERNEL__
#include <asm/byteorder.h>
#ifdef __BIG_ENDIAN
#define XFS_NATIVE_HOST 1
#else
#undef XFS_NATIVE_HOST
#endif
#else /* __KERNEL__ */
#if __BYTE_ORDER == __BIG_ENDIAN
#define XFS_NATIVE_HOST 1
#else
#undef XFS_NATIVE_HOST
#endif
#ifdef XFS_NATIVE_HOST
#define cpu_to_be16(val) ((__force __be16)(__u16)(val))
#define cpu_to_be32(val) ((__force __be32)(__u32)(val))
#define cpu_to_be64(val) ((__force __be64)(__u64)(val))
#define be16_to_cpu(val) ((__force __u16)(__be16)(val))
#define be32_to_cpu(val) ((__force __u32)(__be32)(val))
#define be64_to_cpu(val) ((__force __u64)(__be64)(val))
#else
#define cpu_to_be16(val) ((__force __be16)__swab16((__u16)(val)))
#define cpu_to_be32(val) ((__force __be32)__swab32((__u32)(val)))
#define cpu_to_be64(val) ((__force __be64)__swab64((__u64)(val)))
#define be16_to_cpu(val) (__swab16((__force __u16)(__be16)(val)))
#define be32_to_cpu(val) (__swab32((__force __u32)(__be32)(val)))
#define be64_to_cpu(val) (__swab64((__force __u64)(__be64)(val)))
#endif
static inline void be16_add_cpu(__be16 *a, __s16 b)
{
*a = cpu_to_be16(be16_to_cpu(*a) + b);
}
static inline void be32_add_cpu(__be32 *a, __s32 b)
{
*a = cpu_to_be32(be32_to_cpu(*a) + b);
}
static inline void be64_add_cpu(__be64 *a, __s64 b)
{
*a = cpu_to_be64(be64_to_cpu(*a) + b);
}
#endif /* __KERNEL__ */
#define INT_GET_UNALIGNED_16_BE(pointer) \
((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1])))
#define INT_SET_UNALIGNED_16_BE(pointer,value) \
{ \
((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \
((__u8*)(pointer))[1] = (((value) ) & 0xff); \
}
#define XFS_GET_DIR_INO4(di) \
(((__u32)(di).i[0] << 24) | ((di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3]))
#define XFS_PUT_DIR_INO4(from, di) \
do { \
(di).i[0] = (((from) & 0xff000000ULL) >> 24); \
(di).i[1] = (((from) & 0x00ff0000ULL) >> 16); \
(di).i[2] = (((from) & 0x0000ff00ULL) >> 8); \
(di).i[3] = ((from) & 0x000000ffULL); \
} while (0)
#define XFS_DI_HI(di) \
(((__u32)(di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3]))
#define XFS_DI_LO(di) \
(((__u32)(di).i[4] << 24) | ((di).i[5] << 16) | ((di).i[6] << 8) | ((di).i[7]))
#define XFS_GET_DIR_INO8(di) \
(((xfs_ino_t)XFS_DI_LO(di) & 0xffffffffULL) | \
((xfs_ino_t)XFS_DI_HI(di) << 32))
#define XFS_PUT_DIR_INO8(from, di) \
do { \
(di).i[0] = 0; \
(di).i[1] = (((from) & 0x00ff000000000000ULL) >> 48); \
(di).i[2] = (((from) & 0x0000ff0000000000ULL) >> 40); \
(di).i[3] = (((from) & 0x000000ff00000000ULL) >> 32); \
(di).i[4] = (((from) & 0x00000000ff000000ULL) >> 24); \
(di).i[5] = (((from) & 0x0000000000ff0000ULL) >> 16); \
(di).i[6] = (((from) & 0x000000000000ff00ULL) >> 8); \
(di).i[7] = ((from) & 0x00000000000000ffULL); \
} while (0)
#endif /* __XFS_ARCH_H__ */
|
// -*- mode:objc -*-
// $Id: Tree.h,v 1.4 2008-09-18 18:03:05 yfabian Exp $
//
/*
** Tree.h
**
** Copyright (c) 2002-2004
**
** Author: Ujwal S. Setlur
**
** Project: iTerm
**
** Description: Headertree structure for bookmarks.
** Adapted from Apple's example code.
**
** 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.
*/
#import <Foundation/Foundation.h>
@interface NSArray (MyExtensions)
- (BOOL)containsObjectIdenticalTo: (id)object;
@end
@interface NSMutableArray (MyExtensions)
- (void) insertObjectsFromArray:(NSArray *)array atIndex:(int)index;
@end
@interface TreeNode : NSObject
{
TreeNode *nodeParent;
BOOL isLeaf;
NSMutableArray *nodeChildren;
NSMutableDictionary *nodeData;
}
+ (id) treeFromDictionary:(NSDictionary*)dict;
- (id) initWithData:(NSDictionary *)data parent:(TreeNode*)parent children:(NSArray*)children;
- (id) initFromDictionary:(NSDictionary*)dict;
- (NSDictionary *) dictionary;
- (void)setNodeData:(NSDictionary *)data;
- (NSDictionary *) nodeData;
- (void)setNodeParent:(TreeNode*)parent;
- (TreeNode*)nodeParent;
- (BOOL) isLeaf;
- (void) setIsLeaf: (BOOL) flag;
- (BOOL)isGroup;
- (void)insertChild:(TreeNode*)child atIndex:(int)index;
- (void)insertChildren:(NSArray*)children atIndex:(int)index;
- (void)removeChild:(TreeNode*)child;
- (void)removeFromParent;
- (int)indexOfChild:(TreeNode*)child;
- (int)indexOfChildIdenticalTo:(TreeNode*)child;
- (int)numberOfChildren;
- (NSArray*)children;
- (TreeNode*)firstChild;
- (TreeNode*)lastChild;
- (TreeNode*)childAtIndex:(int)index;
- (BOOL)isDescendantOfNode:(TreeNode*)node;
// returns YES if 'node' is an ancestor.
- (BOOL)isDescendantOfNodeInArray:(NSArray*)nodes;
// returns YES if any 'node' in the array 'nodes' is an ancestor of ours.
- (void)recursiveSortChildren;
// sort children using the compare: method in TreeNodeData
- (NSComparisonResult) compare: (id) comparator;
- (int) indexForNode: (id) node;
- (id) nodeForIndex: (int) index;
// Returns the minimum nodes from 'allNodes' required to cover the nodes in 'allNodes'.
// This methods returns an array containing nodes from 'allNodes' such that no node in
// the returned array has an ancestor in the returned array.
+ (NSArray *)minimumNodeCoverFromNodesInArray: (NSArray *)allNodes;
@end
|
/**
*****************************************************************************
@example receive.c
@brief receive data packets and write content of packet on SD card
and send via uart with RSSI
Note that VAR_LENGTH must have the same value in transmit.c and receive.c
@version V1.0 initialization
@author Peter Soltys
@date July 2015
@par Revision History:
- V1.0, July 2015 : initial version.
All files for ADuCRF101 provided by ADI, including this file, are
provided as is without warranty of any kind, either expressed or implied.
The user assumes any and all risk from the use of this code.
It is the responsibility of the person integrating this code into an application
to ensure that the resulting application performs as required and is safe.
**/
#include "include.h"
#include "SD_SPI/ff.h"
#define VAR_LENGTH 1
unsigned char Buffer[255];
RIE_U8 PktLen;
RIE_S8 RSSI;
RIE_Responses RIE_Response = RIE_Success;
FATFS FatFs;
FIL fil; /* File object */
FRESULT fr; /* FatFs return code */
int i,j;
void Delay(void)
{
volatile int iDelay = 0x1FFFF;
while (iDelay--);
}
/*
*inicializovanie uart portu
* rychlost 19200 baud
* 8 bitov
* jeden stop bit
* vystup port P1.0\P1.1
*/
void uart_init(void){
UrtLinCfg(0,19200,COMLCR_WLS_8BITS,COMLCR_STOP_DIS);
DioCfg(pADI_GP1,0x9); // UART functionality on P1.0\P1.1
}
/*
* inicializovanie portu na ktorom je pripojena user specified led
*/
void led_init(void){
// P4.2 as output
DioCfg(pADI_GP4,0x10);
DioOen(pADI_GP4, BIT2);
}
/*
* function for initialise the Radio
*/
void Radio_init(void){
// Initialise the Radio
if (RIE_Response == RIE_Success)
RIE_Response = RadioInit(DR_38_4kbps_Dev20kHz);
// Set the Frequency to operate at 915 MHz
if (RIE_Response == RIE_Success)
RIE_Response = RadioSetFrequency(915000000);
}
/*
* function receive one packet from radio
*/
void Radio_recieve(void){//pocka na prijatie jedneho paketu
if (RIE_Response == RIE_Success)
{
if (VAR_LENGTH)
RIE_Response = RadioRxPacketVariableLen();
else
RIE_Response = RadioRxPacketFixedLen(12);
//printf("waiting for a packet\n");
}
if (RIE_Response == RIE_Success)
{
while (!RadioRxPacketAvailable());
}
if (RIE_Response == RIE_Success)
RIE_Response = RadioRxPacketRead(sizeof(Buffer),
&PktLen,
Buffer,
&RSSI);
}
/*
* parameter str [out] return name of text file
* example "signal.txt"
*/
void get_txt_name(char * str){
int len=3;
while(1){
Radio_recieve();//cakanie na prijatie nazvu suboru
if (RIE_Response == RIE_Success)
{
if(Buffer[0]=='#'){
if(Buffer[1]=='@'){
if(Buffer[2]=='#'){
while(Buffer[len]!='\0'){
str[len-3]=Buffer[len];
len++;
}
break;
}
}
}
}
}
}
/*
* inicializovanie karty vytvorenie textoveho suboru signal.txt
* s nalogovanymi hodnotamy urovni signalu meranych pri prime
*/
void SD_init(void){
char str[30];
fr=f_mount(&FatFs, "", 0);//inicializacia SD karty
printf("inicializujem kartu");
if(fr)printf("chyba pri inicializacii karty (alebo SPI) %d \n",fr);
//vytvorenie textoveho suboru
get_txt_name(str);//pocka na prijatie paketu s nazvom suboru
fr = f_open(&fil, str , FA_WRITE|FA_CREATE_ALWAYS);
printf("vytvaram subor %s",str);
if(fr)printf("chyba pri vytvarani suboru %d \n",fr);
Radio_recieve();//cakanie na prijatie hlavicky suboru
fr = f_printf(&fil,"%s",Buffer);//hlavicka v txt subore
}
int main(void)
{
WdtGo(T3CON_ENABLE_DIS);//stop watch-dog
uart_init();
led_init();
Radio_init();//inicializuje radio prenos
SD_init();//nacita kartu a vytvori subor prijaty cez radio prenos
for(i=0;i<29;i++){
Radio_recieve();//pocka na prijatie jedneho paketu
if (RIE_Response == RIE_Success)
{
printf("\n\r-> %s \n@ RSSI %d ",Buffer,(int)RSSI);
fr = f_printf(&fil,"\n\r-> %s \n@ RSSI %d \n",Buffer,(int)RSSI);
}
else
{
printf("\n\r-> ERROR");
fr = f_printf(&fil,"\n\r-> ERROR");
}
}
RIE_Response = RadioTerminateRadioOp();
fr=f_close(&fil);//koiec zapisu na kartu
printf("\nzatvaram\n");
if(fr)printf("chyba pri zatvarani suboru %d\n",fr);
while (1)//ukonceny zapis
{
DioTgl(pADI_GP4,BIT2);
Delay();
}
}
|
/*
* include/asm-s390/fcntl.h
*
* S390 version
*
* Derived from "include/asm-i386/fcntl.h"
*/
#ifndef _S390_FCNTL_H
#define _S390_FCNTL_H
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
#define O_ACCMODE 0003
#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR 02
#define O_CREAT 0100 /* not fcntl */
#define O_EXCL 0200 /* not fcntl */
#define O_NOCTTY 0400 /* not fcntl */
#define O_TRUNC 01000 /* not fcntl */
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_NDELAY O_NONBLOCK
#define O_SYNC 010000
#define FASYNC 020000 /* fcntl, for BSD compatibility */
#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
#define O_LARGEFILE 0100000
#define O_DIRECTORY 0200000 /* must be a directory */
#define O_NOFOLLOW 0400000 /* don't follow links */
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get f_flags */
#define F_SETFD 2 /* set f_flags */
#define F_GETFL 3 /* more flags (cloexec) */
#define F_SETFL 4
#define F_GETLK 5
#define F_SETLK 6
#define F_SETLKW 7
#define F_SETOWN 8 /* for sockets. */
#define F_GETOWN 9 /* for sockets. */
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* for posix fcntl() and lockf() */
#define F_RDLCK 0
#define F_WRLCK 1
#define F_UNLCK 2
/* for old implementation of bsd flock () */
#define F_EXLCK 4 /* or 3 */
#define F_SHLCK 8 /* or 4 */
/* operations for bsd flock(), also used by the kernel implementation */
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* or'd with one of the above to prevent
blocking */
#define LOCK_UN 8 /* remove lock */
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
#endif
|
//
// BRWallet.h
// BreadWallet
//
// Created by Aaron Voisine on 5/12/13.
// Copyright (c) 2013 Aaron Voisine <voisine@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.
#import <Foundation/Foundation.h>
#import "BRKeySequence.h"
#define BRWalletBalanceChangedNotification @"BRWalletBalanceChangedNotification"
@class BRTransaction;
@interface BRWallet : NSObject
@property (nonatomic, readonly) uint64_t balance;
@property (nonatomic, readonly) NSString *receiveAddress; // returns the first unused external address
@property (nonatomic, readonly) NSString *changeAddress; // returns the first unused internal address
@property (nonatomic, readonly) NSSet *addresses; // all previously generated internal and external addresses
@property (nonatomic, readonly) NSArray *unspentOutputs; // NSData objects containing serialized UTXOs
@property (nonatomic, readonly) NSArray *recentTransactions; // BRTransaction objects sorted by date, most recent first
- (instancetype)initWithContext:(NSManagedObjectContext *)context sequence:(id<BRKeySequence>)sequence
seed:(NSData *(^)())seed;
// true if the address is known to belong to the wallet
- (BOOL)containsAddress:(NSString *)address;
// Wallets are composed of chains of addresses. Each chain is traversed until a gap of a certain number of addresses is
// found that haven't been used in any transactions. This method returns an array of <gapLimit> unused addresses
// following the last used address in the chain. The internal chain is used for change addresses and the external chain
// for receive addresses.
- (NSArray *)addressesWithGapLimit:(NSUInteger)gapLimit internal:(BOOL)internal;
// returns an unsigned transaction that sends the specified amount from the wallet to the given address
- (BRTransaction *)transactionFor:(uint64_t)amount to:(NSString *)address withFee:(BOOL)fee;
// returns an unsigned transaction that sends the specified amounts from the wallet to the specified output scripts
- (BRTransaction *)transactionForAmounts:(NSArray *)amounts toOutputScripts:(NSArray *)scripts withFee:(BOOL)fee;
// sign any inputs in the given transaction that can be signed using private keys from the wallet
- (BOOL)signTransaction:(BRTransaction *)transaction;
// true if the given transaction is associated with the wallet (even if it hasn't been registered), false otherwise
- (BOOL)containsTransaction:(BRTransaction *)transaction;
// adds a transaction to the wallet, or returns false if it isn't associated with the wallet
- (BOOL)registerTransaction:(BRTransaction *)transaction;
// removes a transaction from the wallet along with any transactions that depend on its outputs
- (void)removeTransaction:(NSData *)txHash;
// true if the given transaction has been added to the wallet
- (BOOL)transactionIsRegistered:(NSData *)txHash;
// true if no previous wallet transaction spends any of the given transaction's inputs, and no input tx is invalid
- (BOOL)transactionIsValid:(BRTransaction *)transaction;
// returns true if transaction won't be valid by blockHeight + 1 or within the next 10 minutes
- (BOOL)transactionIsPending:(BRTransaction *)transaction atBlockHeight:(uint32_t)blockHeight;
// set the block heights for the given transactions
- (void)setBlockHeight:(int32_t)height forTxHashes:(NSArray *)txHashes;
// returns the amount received to the wallet by the transaction (total outputs to change and/or recieve addresses)
- (uint64_t)amountReceivedFromTransaction:(BRTransaction *)transaction;
// retuns the amount sent from the wallet by the trasaction (total wallet outputs consumed, change and fee included)
- (uint64_t)amountSentByTransaction:(BRTransaction *)transaction;
// returns the fee for the given transaction if all its inputs are from wallet transactions, UINT64_MAX otherwise
- (uint64_t)feeForTransaction:(BRTransaction *)transaction;
// returns the first non-change output address for sends, first input address for receives, or nil if unkown
- (NSString *)addressForTransaction:(BRTransaction *)transaction;
// historical wallet balance after the given transaction, or current balance if transaction is not registered in wallet
- (uint64_t)balanceAfterTransaction:(BRTransaction *)transaction;
// returns the block height after which the transaction is likely to be processed without including a fee
- (uint32_t)blockHeightUntilFree:(BRTransaction *)transaction;
@end
|
/*****************************************************************************
*
* DOWNTIME.H - Header file for scheduled downtime functions
*
* Copyright (c) 2001-2009 Ethan Galstad (egalstad@nagios.org)
* Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
* Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef _DOWNTIME_H
#define _DOWNTIME_H
#include "config.h"
#include "common.h"
#include "objects.h"
#ifdef __cplusplus
extern "C" {
#endif
/* SCHEDULED_DOWNTIME_ENTRY structure */
typedef struct scheduled_downtime_struct{
int type;
char *host_name;
char *service_description;
time_t entry_time;
time_t start_time;
time_t end_time;
int fixed;
unsigned long triggered_by;
unsigned long duration;
unsigned long downtime_id;
char *author;
char *comment;
int is_in_effect;
#ifdef NSCORE
unsigned long comment_id;
int start_flex_downtime;
int incremented_pending_downtime;
#endif
struct scheduled_downtime_struct *next;
}scheduled_downtime;
#ifdef NSCORE
int initialize_downtime_data(char *); /* initializes scheduled downtime data */
int cleanup_downtime_data(char *); /* cleans up scheduled downtime data */
int add_new_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
int add_new_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
int add_new_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *,int);
int delete_host_downtime(unsigned long);
int delete_service_downtime(unsigned long);
int delete_downtime(int,unsigned long);
int schedule_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
int unschedule_downtime(int,unsigned long);
int register_downtime(int,unsigned long);
int handle_scheduled_downtime(scheduled_downtime *);
int handle_scheduled_downtime_by_id(unsigned long);
int check_pending_flex_host_downtime(host *);
int check_pending_flex_service_downtime(service *);
int check_for_expired_downtime(void);
#endif
int add_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
int add_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
/* If you are going to be adding a lot of downtime in sequence, set
defer_downtime_sorting to 1 before you start and then call
sort_downtime afterwards. Things will go MUCH faster. */
extern int defer_downtime_sorting;
int add_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,int);
int sort_downtime(void);
scheduled_downtime *find_downtime(int,unsigned long);
scheduled_downtime *find_host_downtime(unsigned long);
scheduled_downtime *find_service_downtime(unsigned long);
scheduled_downtime *find_downtime_by_similar_content(int,char *,char *,char *,char *,time_t,time_t,int,unsigned long);
void free_downtime_data(void); /* frees memory allocated to scheduled downtime list */
int delete_downtime_by_hostname_service_description_start_time_comment(char *,char *,time_t,char *);
#ifdef __cplusplus
}
#endif
#endif
|
/* $Id: ipac.h,v 1.1.1.1 2010/03/11 21:07:42 kris Exp $
*
* IPAC specific defines
*
* Author Karsten Keil
* Copyright by Karsten Keil <keil@isdn4linux.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
/* All Registers original Siemens Spec */
#define IPAC_CONF 0xC0
#define IPAC_MASK 0xC1
#define IPAC_ISTA 0xC1
#define IPAC_ID 0xC2
#define IPAC_ACFG 0xC3
#define IPAC_AOE 0xC4
#define IPAC_ARX 0xC5
#define IPAC_ATX 0xC5
#define IPAC_PITA1 0xC6
#define IPAC_PITA2 0xC7
#define IPAC_POTA1 0xC8
#define IPAC_POTA2 0xC9
#define IPAC_PCFG 0xCA
#define IPAC_SCFG 0xCB
#define IPAC_TIMR2 0xCC
|
//
// CGSTransitions.h
// Skid
//
// Created by Brad Allred on 12/17/11.
// Copyright (c) 2011 For Every Body. All rights reserved.
//
#ifndef Skid_CGSTransitions_h
#define Skid_CGSTransitions_h
#endif
|
/* include/linux/wlan_plat.h
*
* Copyright (C) 2010 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LINUX_WLAN_PLAT_H_
#define _LINUX_WLAN_PLAT_H_
struct wifi_platform_data {
int (*set_power)(int val);
int (*set_reset)(int val);
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
int dot11n_enable;
int cscan_enable;
};
#endif
|
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_interface.h"
#include "softuart.h"
#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
os_event_t user_procTaskQueue[user_procTaskQueueLen];
//create global softuart instances
Softuart softuart;
Softuart softuart2;
// loop function will be execute by "os" periodically
static void ICACHE_FLASH_ATTR loop(os_event_t *events)
{
char buffer_char;
//print something on uart_0 to see progress
os_printf(".");
if(Softuart_Available(&softuart)) {
os_printf("Softuart 1: %c\r\n", Softuart_Read(&softuart));
}
//write example output to softuart 1
Softuart_Puts(&softuart,"one");
//check if character is available at second uart
if(Softuart_Available(&softuart2)) {
buffer_char = Softuart_Read(&softuart2);
//character is available and will be sent to first software uart
os_printf("Sent to Softuart 1: %c\r\n", buffer_char);
Softuart_Putchar(&softuart,buffer_char);
}
//write example output to softuart 2
Softuart_Puts(&softuart2,"2");
//some delay until we run this task again
os_delay_us(100000);
// run (schedule) this loop task again
system_os_post(user_procTaskPrio, 0, 0 );
}
void ICACHE_FLASH_ATTR user_init()
{
// Initialize UART0 to use as debug
uart_div_modify(0, UART_CLK_FREQ / 9600);
//init software uart
Softuart_SetPinRx(&softuart,14);
Softuart_SetPinTx(&softuart,12);
//startup
Softuart_Init(&softuart,9600);
//second uart
//init software uart
Softuart_SetPinRx(&softuart2,4);
Softuart_SetPinTx(&softuart2,5);
//startup
Softuart_Init(&softuart2,9600);
//Start our loop task
system_os_task(loop, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
system_os_post(user_procTaskPrio, 0, 0 );
}
|
#ifndef GUI_DRAW_H
#define GUI_DRAW_H
//-------------------------------------------------------------------
#if CAM_BITMAP_PALETTE==1
#define COLOR_TRANSPARENT 0x00
#define COLOR_WHITE 0x11
#define COLOR_RED 0x22
#define COLOR_GREY 0x3F
#define COLOR_GREEN 0x55
#define COLOR_BLUE_LT 0xDD
#define COLOR_BLUE 0xDF
#define COLOR_YELLOW 0xEE
#define COLOR_BLACK 0xFF
//#define COLOR_BG 0x0F
#define COLOR_BG 0x44
#define COLOR_FG COLOR_WHITE
#define COLOR_SELECTED_BG COLOR_RED
#define COLOR_SELECTED_FG COLOR_WHITE
#define COLOR_ALT_BG 0xD4
#define COLOR_SPLASH_RED 0x2E
#define COLOR_SPLASH_PINK 0x21
#define COLOR_SPLASH_GREY 0x1F
#elif CAM_BITMAP_PALETTE==2
#define COLOR_TRANSPARENT 0x00
#define COLOR_WHITE 0xD3
#define COLOR_RED 0x64
#define COLOR_GREY 0x12
#define COLOR_GREEN 0xC4
#define COLOR_BLUE_LT 0x6A
#define COLOR_BLUE 0x87
#define COLOR_YELLOW 0x44
#define COLOR_BLACK 0xFF
//#define COLOR_BG 0x0F
#define COLOR_BG 0x22
#define COLOR_FG COLOR_WHITE
#define COLOR_SELECTED_BG COLOR_RED
#define COLOR_SELECTED_FG COLOR_WHITE
#define COLOR_ALT_BG 0x22
#define COLOR_SPLASH_RED 0x58
#define COLOR_SPLASH_PINK 0x4C
#define COLOR_SPLASH_GREY 0x16
#else
#error CAM_BITMAP_PALETTE not defined
#endif
#define FONT_WIDTH 8
#define FONT_HEIGHT 16
//-------------------------------------------------------------------
extern unsigned int screen_width, screen_height, screen_size;
extern unsigned int screen_buffer_width, screen_buffer_height, screen_buffer_size;
//-------------------------------------------------------------------
void draw_init();
void draw_set_draw_proc(void (*pixel_proc)(unsigned int offset, color cl));
extern color draw_get_pixel(coord x, coord y);
extern void draw_line(coord x1, coord y1, coord x2, coord y2, color cl);
// draw frame
extern void draw_rect(coord x1, coord y1, coord x2, coord y2, color cl);
extern void draw_round_rect(coord x1, coord y1, coord x2, coord y2, color cl);
// color: hi_byte - BG; lo_byte - FG
extern void draw_filled_rect(coord x1, coord y1, coord x2, coord y2, color cl);
extern void draw_filled_round_rect(coord x1, coord y1, coord x2, coord y2, color cl);
extern void draw_char(coord x, coord y, const char ch, color cl);
extern void draw_string(coord x, coord y, const char *s, color cl);
extern void draw_txt_rect(coord col, coord row, unsigned int length, unsigned int height, color cl);
extern void draw_txt_rect_exp(coord col, coord row, unsigned int length, unsigned int height, unsigned int exp, color cl);
extern void draw_txt_filled_rect(coord col, coord row, unsigned int length, unsigned int height, color cl);
extern void draw_txt_filled_rect_exp(coord col, coord row, unsigned int length, unsigned int height, unsigned int exp, color cl);
extern void draw_txt_string(coord col, coord row, const char *str, color cl);
extern void draw_txt_char(coord col, coord row, const char ch, color cl);
extern void draw_clear();
extern void draw_restore();
extern void draw_fill(coord x, coord y, color cl_fill, color cl_bound);
extern void draw_circle(coord x, coord y, const unsigned int r, color cl);
extern void draw_ellipse(coord xc, coord yc, unsigned int a, unsigned int b, color cl);
extern void draw_filled_ellipse(coord xc, coord yc, unsigned int a, unsigned int b, color cl);
//-------------------------------------------------------------------
#endif
|
/*
* libosinfo:
*
* Copyright (C) 2009-2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Authors:
* Arjun Roy <arroy@redhat.com>
* Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#include <osinfo/osinfo.h>
#include <glib/gi18n-lib.h>
G_DEFINE_TYPE (OsinfoOsList, osinfo_oslist, OSINFO_TYPE_PRODUCTLIST);
#define OSINFO_OSLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OSINFO_TYPE_OSLIST, OsinfoOsListPrivate))
/**
* SECTION:osinfo_oslist
* @short_description: A list of os platforms
* @see_also: #OsinfoList, #OsinfoOs
*
* #OsinfoOsList is a list specialization that stores
* only #OsinfoOs objects.
*/
struct _OsinfoOsListPrivate
{
gboolean unused;
};
static void
osinfo_oslist_finalize (GObject *object)
{
/* Chain up to the parent class */
G_OBJECT_CLASS (osinfo_oslist_parent_class)->finalize (object);
}
/* Init functions */
static void
osinfo_oslist_class_init (OsinfoOsListClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS (klass);
g_klass->finalize = osinfo_oslist_finalize;
g_type_class_add_private (klass, sizeof (OsinfoOsListPrivate));
}
static void
osinfo_oslist_init (OsinfoOsList *list)
{
list->priv = OSINFO_OSLIST_GET_PRIVATE(list);
}
/**
* osinfo_oslist_new:
*
* Construct a new os list that is initially empty.
*
* Returns: (transfer full): an empty os list
*/
OsinfoOsList *osinfo_oslist_new(void)
{
return g_object_new(OSINFO_TYPE_OSLIST,
"element-type", OSINFO_TYPE_OS,
NULL);
}
/**
* osinfo_oslist_new_copy:
* @source: the os list to copy
*
* Construct a new os list that is filled with oss
* from @source
*
* Returns: (transfer full): a copy of the os list
* Deprecated: 0.2.2: Use osinfo_list_new_copy() instead.
*/
OsinfoOsList *osinfo_oslist_new_copy(OsinfoOsList *source)
{
OsinfoOsList *newList = osinfo_oslist_new();
osinfo_list_add_all(OSINFO_LIST(newList),
OSINFO_LIST(source));
return newList;
}
/**
* osinfo_oslist_new_filtered:
* @source: the os list to copy
* @filter: the filter to apply
*
* Construct a new os list that is filled with oss
* from @source that match @filter
*
* Returns: (transfer full): a filtered copy of the os list
* Deprecated: 0.2.2: Use osinfo_list_new_filtered() instead.
*/
OsinfoOsList *osinfo_oslist_new_filtered(OsinfoOsList *source, OsinfoFilter *filter)
{
OsinfoOsList *newList = osinfo_oslist_new();
osinfo_list_add_filtered(OSINFO_LIST(newList),
OSINFO_LIST(source),
filter);
return newList;
}
/**
* osinfo_oslist_new_intersection:
* @sourceOne: the first os list to copy
* @sourceTwo: the second os list to copy
*
* Construct a new os list that is filled with only the
* oss that are present in both @sourceOne and @sourceTwo.
*
* Returns: (transfer full): an intersection of the two os lists
* Deprecated: 0.2.2: Use osinfo_list_new_intersection() instead.
*/
OsinfoOsList *osinfo_oslist_new_intersection(OsinfoOsList *sourceOne, OsinfoOsList *sourceTwo)
{
OsinfoOsList *newList = osinfo_oslist_new();
osinfo_list_add_intersection(OSINFO_LIST(newList),
OSINFO_LIST(sourceOne),
OSINFO_LIST(sourceTwo));
return newList;
}
/**
* osinfo_oslist_new_union:
* @sourceOne: the first os list to copy
* @sourceTwo: the second os list to copy
*
* Construct a new os list that is filled with all the
* oss that are present in either @sourceOne and @sourceTwo.
*
* Returns: (transfer full): a union of the two os lists
* Deprecated: 0.2.2: Use osinfo_list_new_union() instead.
*/
OsinfoOsList *osinfo_oslist_new_union(OsinfoOsList *sourceOne, OsinfoOsList *sourceTwo)
{
OsinfoOsList *newList = osinfo_oslist_new();
osinfo_list_add_union(OSINFO_LIST(newList),
OSINFO_LIST(sourceOne),
OSINFO_LIST(sourceTwo));
return newList;
}
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* End:
*/
|
#ifndef _LINUX_AUXVEC_H
#define _LINUX_AUXVEC_H
#include <asm/auxvec.h>
#define AT_NULL 0 /* end of vector */
#define AT_IGNORE 1 /* entry should be ignored */
#define AT_EXECFD 2 /* file descriptor of program */
#define AT_PHDR 3 /* program headers for program */
#define AT_PHENT 4 /* size of program header entry */
#define AT_PHNUM 5 /* number of program headers */
#define AT_PAGESZ 6 /* system page size */
#define AT_BASE 7 /* base address of interpreter */
#define AT_FLAGS 8 /* flags */
#define AT_ENTRY 9 /* entry point of program */
#define AT_NOTELF 10 /* program is not ELF */
#define AT_UID 11 /* real uid */
#define AT_EUID 12 /* effective uid */
#define AT_GID 13 /* real gid */
#define AT_EGID 14 /* effective gid */
#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
#define AT_CLKTCK 17 /* frequency at which times() increments */
/* AT_* values 18 through 22 are reserved */
#define AT_SECURE 23 /* secure mode boolean */
#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
* differ from AT_PLATFORM. */
#define AT_RANDOM 25 /* address of 16 random bytes */
#define AT_EXECFN 31 /* filename of program */
#ifdef __KERNEL__
#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
/* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
#endif
#endif /* _LINUX_AUXVEC_H */
|
/*
* zero_srcsnk.c
* fill the source and sink variables with 0.0 at the start of the simulation
*
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
* Biome-BGC version 4.2 (final release)
* See copyright.txt for Copyright information
* *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*/
#include "bgc.h"
/* zero the source and sink state variables */
void zero_srcsnk (cstate_struct * cs, nstate_struct * ns, wstate_struct * ws, summary_struct * summary)
{
/* zero the water sources and sinks */
ws->prcp_src = 0.0;
ws->outflow_snk = 0.0;
ws->soilevap_snk = 0.0;
ws->snowsubl_snk = 0.0;
ws->canopyevap_snk = 0.0;
ws->trans_snk = 0.0;
/* zero the carbon sources and sinks */
cs->psnsun_src = 0.0;
cs->psnshade_src = 0.0;
cs->leaf_mr_snk = 0.0;
cs->leaf_gr_snk = 0.0;
cs->froot_mr_snk = 0.0;
cs->froot_gr_snk = 0.0;
cs->livestem_mr_snk = 0.0;
cs->livestem_gr_snk = 0.0;
cs->deadstem_gr_snk = 0.0;
cs->livecroot_mr_snk = 0.0;
cs->livecroot_gr_snk = 0.0;
cs->deadcroot_gr_snk = 0.0;
cs->litr1_hr_snk = 0.0;
cs->litr2_hr_snk = 0.0;
cs->litr4_hr_snk = 0.0;
cs->soil1_hr_snk = 0.0;
cs->soil2_hr_snk = 0.0;
cs->soil3_hr_snk = 0.0;
cs->soil4_hr_snk = 0.0;
cs->fire_snk = 0.0;
/* zero the nitrogen sources and sinks */
ns->nfix_src = 0.0;
ns->ndep_src = 0.0;
ns->nleached_snk = 0.0;
ns->nvol_snk = 0.0;
ns->fire_snk = 0.0;
/* zero the summary variables */
summary->cum_npp = 0.0;
summary->cum_nep = 0.0;
summary->cum_nee = 0.0;
summary->cum_gpp = 0.0;
summary->cum_mr = 0.0;
summary->cum_gr = 0.0;
summary->cum_hr = 0.0;
summary->cum_fire = 0.0;
}
|
/*
Copyright (C) 2001 Tensilica, Inc. All Rights Reserved.
Revised to support Tensilica processors and to improve overall performance
*/
/*
Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser 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 Lesser 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.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#pragma ident "@(#) libu/ffio/ccaweod.c 92.1 06/29/99 13:16:47"
#include <stdio.h>
#include <errno.h>
#include <ffio.h>
#include "ccaio.h"
/*
* Write an EOD to a cache file.
*
* Truncate this layer at the current position.
*/
int
_cca_weod(
struct fdinfo *fio,
struct ffsw *stat
)
{
int nbu, i;
off_t fsize;
int bs;
struct cca_buf *cbufs;
struct cca_f *cca_info;
struct fdinfo *llfio;
off_t filead;
int ret;
off_t well_formed_fsize;
cca_info = (struct cca_f *)fio->lyr_info;
llfio = fio->fioptr;
if ( CCA_SOFT_BYPASS )
return ( XRCALL(llfio,weodrtn) llfio, stat) );
if ( cca_info->optflags.no_write )
ERETURN(stat, EBADF, 0);
if (cca_info->is_blkspec)
ERETURN(stat, FDC_ERR_NOSUP, 0);
cca_info->fsize = cca_info->cpos;
fio->rwflag = WRITIN;
fio->ateof = 0;
fio->ateod = 1;
fio->recbits = 0;
/*
* Fix up any cache page buffers for file pages which lie past the new EOD.
*/
nbu = cca_info->nbufs;
bs = cca_info->bsize;
cbufs = cca_info->bufs;
fsize = cca_info->fsize;
for (i=0; i<nbu; i++) {
if ( cbufs[i].file_page.parts.file_number !=
cca_info->file_number )
continue;
filead = (cbufs[i].file_page.parts.page_number) *
(cca_info->byte_per_pg)*8;
if (filead >= 0) {
/* If page is past EOD then mark it free */
if (filead >= fsize)
{
ret = _cca_clear_page(cca_info, &cbufs[i],
stat);
if ( ret == ERR ) return( ERR );
}
/* If page straddles EOD then zero out part of it */
else if (filead < fsize && filead + bs > fsize) {
int valid_bytes = BITS2BYTES(fsize - filead);
#ifdef SDS_SUPPORTED
if (cca_info->optflags.sds) {
int sds_offset;
int res;
sds_offset = BPTR2CP(cbufs[i].buf) -
(char *)NULL;
res = _sdsset_any(
sds_offset + valid_bytes,
0,
BITS2BYTES(bs) - valid_bytes);
if (res == -1) {
ERETURN(stat, errno, 0);
}
}
else
#endif
{
(void)memset(
BPTR2CP(cbufs[i].buf) + valid_bytes,
0,
BITS2BYTES(bs) - valid_bytes);
}
}
}
}
/*
* Truncate the underlying layer at the same location. For most layers,
* this ensures that data past this EOD becomes zero if the underlying file
* is later extended such that a hole is left between the this EOD
* and the data written later.
*/
well_formed_fsize = (fsize+cca_info->bits_per_sect-1) &
(~(cca_info->bits_per_sect-1));
if (well_formed_fsize < cca_info->feof) {
if (XRCALL(llfio,seekrtn) llfio, BITS2BYTES(well_formed_fsize),
SEEK_SET, stat) == ERR)
return(ERR);
if (XRCALL(llfio,weodrtn) llfio, stat) == ERR)
return(ERR);
cca_info->feof = well_formed_fsize;
}
SETSTAT(stat, FFEOD, 0);
return(0);
}
|
#if !defined(AFX_RMREPORTPAGE_H__68DEA34F_CB16_40BC_821E_8D57F58A50CA__INCLUDED_)
#define AFX_RMREPORTPAGE_H__68DEA34F_CB16_40BC_821E_8D57F58A50CA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CRMView;
class CRMBand;
/////////////////////////////////////////////////////////////////////////////
// CRMReportPage wrapper class
class CRMReportPage : public COleDispatchDriver
{
public:
CRMReportPage() {} // Calls COleDispatchDriver default constructor
CRMReportPage(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CRMReportPage(const CRMReportPage& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
long GetCount();
CRMView AddReportObject(long aObjectType);
CRMBand AddBand(long aBandType);
BOOL GetVisible();
void SetVisible(BOOL bNewValue);
long GetLeftMargin();
void SetLeftMargin(long nNewValue);
long GetTopMargin();
void SetTopMargin(long nNewValue);
long GetRightMargin();
void SetRightMargin(long nNewValue);
long GetBottomMargin();
void SetBottomMargin(long nNewValue);
long GetPageWidth();
long GetPageHegith();
long GetPageBin();
long GetPageOrientation();
void ChangePaper(long aPaperSize, long aWidth, long aHeight, long aBin, long aPageOrientation);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RMREPORTPAGE_H__68DEA34F_CB16_40BC_821E_8D57F58A50CA__INCLUDED_)
|
#ifndef AMBIENTLIGHT_H
#define AMBIENTLIGHT_H
#include "light.h"
class AmbientLight: public Light
{
public:
AmbientLight();
void setLight(Vec4 amb);
void drawLight();
void drawReferenceLight();
Vec4 calculateColor(Vec4 pit,Vec4 n,Vec4 viewer, Material *m,Vec4 pos=Vec4(0,0,0),Vec4 texColor=Vec4(),int mode_texture=-1);
void drawLightOpenGL(int flag_light = -1);
QString getName();
void setName(QString name);
bool isEnabled();
void setEnabled(bool);
bool isVisible();
void setVisible(bool);
void setAmbientColor(QColor);
QColor getAmbientColor();
void setSpecularColor(QColor);
QColor getSpecularColor();
void setDiffuseColor(QColor);
QColor getDiffuseColor();
int getTypeLight();
void setSelected(bool);
bool isSelected();
void setPosition(Vec4);
Vec4 getPosition();
void setDirection(Vec4);
Vec4 getDirection();
void setAttenuation(Vec4);
Vec4 getAttenuation();
int getAngle();
void setAngle(int angle);
void setExponent(int exp);
int getExponent();
QString saveLight();
Vec4 randLight();
int getAngleInner();
void setAngleInner(int angle);
void setVecA(Vec4);
Vec4 getVecA();
void setVecB(Vec4);
Vec4 getVecB();
QString getTypeLightS();
std::vector<Photon*> emitPhotons(int,int,Object*){};
void setPower(int pow){};
int getPower(){};
private:
Vec4* ambient_light;
QString name;
bool visible;
bool selected;
};
#endif // AMBIENTLIGHT_H
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pq_htable.h"
#include "pq_genetics.h"
#include "pq_generics.h"
#include "pq_args.h"
// values = [nvcodons, nsyn, nnon, ds, dn, ps, pn]
// outs = [nsam, nvcodons, nsyn, nnon, ds, dn, ps, pn]
void pq_swupdate_pnds(struct StatObject *stats, char **array)
{
int k;
int diff_syn;
int diff_nsyn;
void *aptr;
void *ref_aa;
void *ref_sptr;
double syn_muts;
double nsyn_muts;
unsigned int bad_codons;
bad_codons = 0;
for (k = 0; k < NKARGS; k++) {
bad_codons += 1 - pq_alldna(array[KCOLS[k]]);
}
if (bad_codons == 0) {
pq_dna_upper(array[KCOLS[0]]);
ref_aa = pq_lookup_hash(&CODON_TO_AMINO, array[KCOLS[0]]);
ref_sptr = pq_lookup_hash(&CODON_TO_NSYN, array[KCOLS[0]]);
syn_muts = *(double *)ref_sptr;
nsyn_muts = 9.0 - syn_muts;
*(long long int *)stats->values[0] += 1;
*(double *)stats->values[1] += syn_muts / 3.0;
*(double *)stats->values[2] += nsyn_muts / 3.0;
diff_syn = 0;
diff_nsyn = 0;
for (k = 1; k < NKARGS; k++) {
pq_dna_upper(array[KCOLS[k]]);
aptr = pq_lookup_hash(&CODON_TO_AMINO, array[KCOLS[k]]);
if (strcmp(array[KCOLS[0]], array[KCOLS[k]]) == 0) {
} else {
if (strcmp(aptr, ref_aa) != 0) {
diff_nsyn++;
} else {
diff_syn++;
}
}
}
if (stats->nsam == diff_syn) {
*(long long int *)stats->values[3] += 1;
} else if (diff_syn > 0) {
*(long long int *)stats->values[5] += 1;
}
if (stats->nsam == diff_nsyn) {
*(long long int *)stats->values[4] += 1;
} else if (diff_nsyn > 0) {
*(long long int *)stats->values[6] += 1;
}
}
}
void pq_swwrite_pnds(struct StatObject *stats)
{
sprintf(stats->outs[0], "%d", stats->nsam);
sprintf(stats->outs[1], "%lli", *(long long int *)stats->values[0]);
sprintf(stats->outs[2], "%f", *(double *)stats->values[1]);
sprintf(stats->outs[3], "%f", *(double *)stats->values[2]);
sprintf(stats->outs[4], "%lli", *(long long int *)stats->values[3]);
sprintf(stats->outs[5], "%lli", *(long long int *)stats->values[4]);
sprintf(stats->outs[6], "%lli", *(long long int *)stats->values[5]);
sprintf(stats->outs[7], "%lli", *(long long int *)stats->values[6]);
}
void pq_swclear_pnds(struct StatObject *stats)
{
int i;
for (i = 0; i < stats->nvalues; i++) {
*(long long int *)stats->values[i] = 0;
}
}
void PQ_PNDS_INIT(struct StatObject *stats, int nsam)
{
int i;
stats->nsam = nsam - 1;
stats->nvalues = 7;
stats->nouts = 8;
stats->outs = calloc(stats->nouts, sizeof(char *));
stats->values = calloc(stats->nvalues, sizeof(void *));
for (i = 0; i < stats->nouts; i++) {
stats->outs[i] = calloc(128, sizeof(char));
}
stats->values[0] = malloc(sizeof(long long int));
*(long long int *)stats->values[0] = 0;
stats->values[1] = malloc(sizeof(double));
*(double *)stats->values[1] = 0.0;
stats->values[2] = malloc(sizeof(double));
*(double *)stats->values[2] = 0.0;
for (i = 3; i < stats->nvalues; i++) {
stats->values[i] = malloc(sizeof(long long int));
*(long long int *)stats->values[i] = 0;
}
stats->update = pq_swupdate_pnds;
stats->write = pq_swwrite_pnds;
stats->clear = pq_swclear_pnds;
}
|
/*
* Copyright(c) 2000 UltraMaster Group
*
* License to use UltraMaster Juno-6 is provided free of charge subject to the
* following restrictions:
*
* 1.) This license is for your personal use only.
*
* 2.) No portion of this software may be redistributed by you to any other
* person in any form.
*
* 3.) You may not sell UltraMaster Juno-6 to any person.
*
* 4.) UltraMaster Juno-6 is provided without any express or implied warranty.
* In no event shall UltraMaster Group be held liable for any damages
* arising from the use of UltraMaster Juno-6.
*/
#ifndef _JUNO_WRAPPERS_H
#define _JUNO_WRAPPERS_H
#include <moog/moog.h>
#include <gmoog/juno_widgets.h>
/***********************/
class JunoKeyboard : public MoogObject
{
friend void JunoKeyboard_midiGateChanged(MoogObject *, double, long);
friend void JunoKeyboard_gtkKeyPressed(GtkWidget *, guint, guint,gpointer);
friend void JunoKeyboard_gtkKeyReleased(GtkWidget *, guint, gpointer);
friend void JunoKeyboard_octaveTransposeChanged(MoogObject *, double,long);
friend void JunoKeyboard_keyTransposeChanged(MoogObject *, double, long);
friend void JunoKeyboard_masterTuneChanged(MoogObject *, double, long);
friend void JunoKeyboard_holdChanged(MoogObject *, double, long);
int octaveTranspose;
int keyTransposePressed;
int keyTranspose;
int holdPressed;
int numVoices;
double masterTune;
int *savedGateInfo;
Output **pitchOutputs;
Output **gateOutputs;
void midiGateChanged(int, double);
void gtkKeyPressed(unsigned int, unsigned int);
void gtkKeyReleased(unsigned int);
void octaveTransposeChanged(double);
void keyTransposeChanged(double);
void masterTuneChanged(double);
void holdChanged(double);
void transposeVoices(double);
public:
GtkWidget* widget;
JunoKeyboard(int);
~JunoKeyboard();
int getKeyTranspose() { return keyTranspose; }
const char* getClassName(){ return( "JunoKeyboard" ); }
};
/***********************/
class JunoSlider : public MoogObject
{
friend void JunoSlider_midiValueChanged(MoogObject *, double, long);
Output* output;
void midiValueChanged(double );
public:
void setValue(double );
double getValue();
GtkWidget* widget;
GtkAdjustment* adj;
JunoSlider( const char* name );
void updateOutput();
const char* getClassName(){ return( "JunoSlider" ); }
};
/***********************/
class JunoButton : public MoogObject
{
friend void JunoButton_midiValueChanged(MoogObject *, double, long);
int state;
Output* output;
void midiValueChanged(double);
public:
GtkWidget* widget;
GtkWidget* led;
JunoButton( GtkJunoButtonType type, const char* name, bool useLed = true );
void buttonPressed();
void set( int _state );
void setLed(int);
void setValue( double);
double getValue();
const char* getClassName(){ return( "JunoButton" ); }
};
/***********************/
class JunoSwitch : public MoogObject
{
friend void JunoSwitch_midiValueChanged(MoogObject *, double, long);
Output *output;
void midiValueChanged(double);
public:
GtkWidget* widget;
void setValue( double);
double getValue();
JunoSwitch(GtkJunoSwitchType type, const char* name );
void updateOutput();
const char* getClassName(){ return( "JunoSwitch" ); }
};
/***********************/
class JunoKnob : public MoogObject
{
friend void JunoKnob_midiValueChanged(MoogObject *, double, long);
Output *output;
public:
void midiValueChanged(double);
GtkWidget *widget;
void setValue( double);
double getValue();
JunoKnob(const char *name);
void updateOutput();
const char *getClassName() { return "JunoKnob"; }
};
/***********************/
class JunoAlphaLed : public MoogObject
{
friend void JunoAlphaLed_midiValueChanged(MoogObject *, double, long);
Output *output;
void midiValueChanged(double);
public:
GtkWidget *widget;
void setValue( double);
JunoAlphaLed( const char*);
void updateOutput();
const char *getClassName() { return "JunoAlphaLed"; }
int getValue();
};
/***********************/
class JunoBender : public MoogObject
{
friend void JunoBender_midiValueChanged(MoogObject *, double, long);
Output *output;
void midiValueChanged(double);
public:
GtkWidget *widget;
JunoBender(const char *name);
void updateOutput();
const char *getClassName() { return "JunoBender"; }
};
/***********************/
class JunoLfoTrigger : public MoogObject
{
friend void JunoLfoTrigger_midiValueChanged(MoogObject *, double, long);
Output *output;
void midiValueChanged(double);
public:
GtkWidget *widget;
JunoLfoTrigger(const char *name);
void updateOutput();
const char *getClassName() { return "JunoLfoTrigger"; }
};
#endif /* _JUNO_WRAPPERS_H */
|
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "cab202_graphics.h"
#define I_TO_S_LENGTH ((CHAR_BIT * sizeof(int) - 1) / 3) + 2
void draw_score(int x, int y, int score) {
char i_to_s[I_TO_S_LENGTH];
char str[I_TO_S_LENGTH + 8];
snprintf(i_to_s, I_TO_S_LENGTH, "%d", score);
stpcpy(str, "Score: ");
strcat(str, i_to_s);
draw_string(x, y, str);
}
void draw_menu(int width, int height) {
draw_string(0, height - 1, "Menu: 8 = N; 2 = S; 6 = E; 4 = W; 9 = NE; 3 = SE; 7 = NW; 1 = SW; q = Quit.");
}
void running_zombie() {
int width;
int height;
get_screen_size(width, height);
int x = width * 4 / 5;
int y = height * 4 / 5;
int score = 0;
int turn = 0;
draw_score(30, 0, score);
draw_menu(width, height);
draw_char(x, y, 'Z');
show_screen();
int key = wait_char();
turn++;
while ((key != 'q') && (key >= 0)) {
switch (key) {
case '4':
x--;
break;
case '6':
x++;
break;
case '8':
y--;
break;
case '2':
y++;
break;
case '7':
x--;
y--;
break;
case '3':
x++;
y++;
break;
case '9':
x++;
y--;
break;
case '1':
x--;
y++;
break;
}
if ((turn % 5) == 0) {
score++;
turn = 0;
}
clear_screen();
draw_score(30, 0, score);
draw_menu(width, height);
draw_char(x, y, 'Z');
show_screen();
key = wait_char();
turn++;
}
}
int main() {
setup_screen();
running_zombie();
cleanup_screen();
return 0;
}
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if !ENABLE_EFI
# include <errno.h>
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "sd-id128.h"
#include "efi/loader-features.h"
#include "time-util.h"
#define EFI_VENDOR_LOADER SD_ID128_MAKE(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f)
#define EFI_VENDOR_GLOBAL SD_ID128_MAKE(8b,e4,df,61,93,ca,11,d2,aa,0d,00,e0,98,03,2b,8c)
#define EFI_VENDOR_SYSTEMD SD_ID128_MAKE(8c,f2,64,4b,4b,0b,42,8f,93,87,6d,87,60,50,dc,67)
#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
#if ENABLE_EFI
char* efi_variable_path(sd_id128_t vendor, const char *name);
int efi_get_variable(sd_id128_t vendor, const char *name, uint32_t *attribute, void **value, size_t *size);
int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p);
int efi_set_variable(sd_id128_t vendor, const char *name, const void *value, size_t size);
int efi_set_variable_string(sd_id128_t vendor, const char *name, const char *p);
bool is_efi_boot(void);
bool is_efi_secure_boot(void);
bool is_efi_secure_boot_setup_mode(void);
int cache_efi_options_variable(void);
int systemd_efi_options_variable(char **line);
#else
static inline char* efi_variable_path(sd_id128_t vendor, const char *name) {
return NULL;
}
static inline int efi_get_variable(sd_id128_t vendor, const char *name, uint32_t *attribute, void **value, size_t *size) {
return -EOPNOTSUPP;
}
static inline int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) {
return -EOPNOTSUPP;
}
static inline int efi_set_variable(sd_id128_t vendor, const char *name, const void *value, size_t size) {
return -EOPNOTSUPP;
}
static inline int efi_set_variable_string(sd_id128_t vendor, const char *name, const char *p) {
return -EOPNOTSUPP;
}
static inline bool is_efi_boot(void) {
return false;
}
static inline bool is_efi_secure_boot(void) {
return false;
}
static inline bool is_efi_secure_boot_setup_mode(void) {
return false;
}
static inline int cache_efi_options_variable(void) {
return -EOPNOTSUPP;
}
static inline int systemd_efi_options_variable(char **line) {
return -ENODATA;
}
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "../include/message.h"
int main(int argc, char *argv[]) {
char *buffer = (char *)malloc(sizeof(char) * 8);
char *buffert = (char *)malloc(sizeof(char) * 8);
size_t data_size = sizeof(char) * 8;
int op = 1; int who = 2;
strncpy(buffer, "MENSAGEM", data_size);
// strncpy(buffert, "AAAAAAAA", data_size);
//
printf("%d SIZE PREPROC %d SIZE POSTPROC\n", strlen(USER_NICKNAME),
strlen("\\nick"));
MESSAGE *msg;
msg = MESSAGE_new(op, who, data_size, buffer);
printf("NEW: %d %d %u\n", msg->op, msg->who, msg->data_size);
puts(msg->data);
unsigned char uc;
char c;
char_serialize(&uc, 'c');
char_deserialize(&uc, &c);
printf("%u\n", c);
printf("%u\n", uc);
unsigned char *iuc = (unsigned char *)malloc(sizeof(unsigned char) *
sizeof(int));
int_serialize(iuc, 182);
int *n = (int *) malloc(sizeof(int));;
int_deserialize(iuc, n);
printf("N: %d\n", *n);
/*
unsigned char *ser_msg = MESSAGE_serialize(msg);
puts(ser_msg);
MESSAGE *rebuilt_msg = MESSAGE_deserialize(ser_msg);
printf("REBUILT: %d %d %u\n", rebuilt_msg->op, rebuilt_msg->who,
rebuilt_msg->data_size);
puts(rebuilt_msg->data);
*/
return 0;
}
|
/** arch/arm/mach-msm/smd_rpcrouter.h
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2007-2008 QUALCOMM Incorporated.
* Author: San Mehat <san@android.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _ARCH_ARM_MACH_MSM_SMD_RPCROUTER_H
#define _ARCH_ARM_MACH_MSM_SMD_RPCROUTER_H
#include <linux/types.h>
#include <linux/list.h>
#include <linux/cdev.h>
#include <linux/platform_device.h>
#include <linux/wakelock.h>
#include <mach/msm_smd.h>
#include <mach/msm_rpcrouter.h>
/* definitions for the R2R wire protcol */
#define RPCROUTER_VERSION 1
#define RPCROUTER_PROCESSORS_MAX 4
#if defined(CONFIG_RPC_SIZE_1024)
#define RPCROUTER_MSGSIZE_MAX 1024
#else
#define RPCROUTER_MSGSIZE_MAX 512
#endif
#if defined(CONFIG_ARCH_MSM7X30)
#define RPCROUTER_PEND_REPLIES_MAX 32
#endif
#define RPCROUTER_CLIENT_BCAST_ID 0xffffffff
#define RPCROUTER_ROUTER_ADDRESS 0xfffffffe
#define RPCROUTER_PID_LOCAL 1
#define RPCROUTER_PID_REMOTE 0
#define RPCROUTER_CTRL_CMD_DATA 1
#define RPCROUTER_CTRL_CMD_HELLO 2
#define RPCROUTER_CTRL_CMD_BYE 3
#define RPCROUTER_CTRL_CMD_NEW_SERVER 4
#define RPCROUTER_CTRL_CMD_REMOVE_SERVER 5
#define RPCROUTER_CTRL_CMD_REMOVE_CLIENT 6
#define RPCROUTER_CTRL_CMD_RESUME_TX 7
#define RPCROUTER_CTRL_CMD_EXIT 8
#define RPCROUTER_DEFAULT_RX_QUOTA 5
union rr_control_msg {
uint32_t cmd;
struct {
uint32_t cmd;
uint32_t prog;
uint32_t vers;
uint32_t pid;
uint32_t cid;
} srv;
struct {
uint32_t cmd;
uint32_t pid;
uint32_t cid;
} cli;
};
struct rr_header {
uint32_t version;
uint32_t type;
uint32_t src_pid;
uint32_t src_cid;
uint32_t confirm_rx;
uint32_t size;
uint32_t dst_pid;
uint32_t dst_cid;
};
/* internals */
#define RPCROUTER_MAX_REMOTE_SERVERS 100
struct rr_fragment {
unsigned char data[RPCROUTER_MSGSIZE_MAX];
uint32_t length;
struct rr_fragment *next;
};
struct rr_packet {
struct list_head list;
struct rr_fragment *first;
struct rr_fragment *last;
struct rr_header hdr;
uint32_t mid;
uint32_t length;
};
#define PACMARK_LAST(n) ((n) & 0x80000000)
#define PACMARK_MID(n) (((n) >> 16) & 0xFF)
#define PACMARK_LEN(n) ((n) & 0xFFFF)
static inline uint32_t PACMARK(uint32_t len, uint32_t mid, uint32_t first,
uint32_t last)
{
return (len & 0xFFFF) |
((mid & 0xFF) << 16) |
((!!first) << 30) |
((!!last) << 31);
}
struct rr_server {
struct list_head list;
uint32_t pid;
uint32_t cid;
uint32_t prog;
uint32_t vers;
dev_t device_number;
struct cdev cdev;
struct device *device;
struct rpcsvr_platform_device p_device;
char pdev_name[32];
};
struct rr_remote_endpoint {
uint32_t pid;
uint32_t cid;
int tx_quota_cntr;
#if defined(CONFIG_ARCH_MSM7X30)
int quota_restart_state;
#endif
spinlock_t quota_lock;
wait_queue_head_t quota_wait;
struct list_head list;
};
#if defined(CONFIG_ARCH_MSM7X30)
struct msm_rpc_reply {
struct list_head list;
uint32_t pid;
uint32_t cid;
uint32_t prog; /* be32 */
uint32_t vers; /* be32 */
uint32_t xid; /* be32 */
};
#endif
struct msm_rpc_endpoint {
struct list_head list;
/* incomplete packets waiting for assembly */
struct list_head incomplete;
/* complete packets waiting to be read */
struct list_head read_q;
spinlock_t read_q_lock;
struct wake_lock read_q_wake_lock;
wait_queue_head_t wait_q;
unsigned flags;
#if defined(CONFIG_ARCH_MSM7X30)
/* restart handling */
int restart_state;
spinlock_t restart_lock;
wait_queue_head_t restart_wait;
#endif
/* endpoint address */
uint32_t pid;
uint32_t cid;
/* bound remote address
* if not connected (dst_pid == 0xffffffff) RPC_CALL writes fail
* RPC_CALLs must be to the prog/vers below or they will fail
*/
uint32_t dst_pid;
uint32_t dst_cid;
uint32_t dst_prog; /* be32 */
uint32_t dst_vers; /* be32 */
/* reply remote address
* if reply_pid == 0xffffffff, none available
* RPC_REPLY writes may only go to the pid/cid/xid of the
* last RPC_CALL we received.
*/
uint32_t reply_pid;
uint32_t reply_cid;
uint32_t reply_xid; /* be32 */
uint32_t next_pm; /* Pacmark sequence */
#if defined(CONFIG_ARCH_MSM7X30)
/* reply queue for inbound messages */
struct list_head reply_pend_q;
struct list_head reply_avail_q;
spinlock_t reply_q_lock;
uint32_t reply_cnt;
struct wake_lock reply_q_wake_lock;
#endif
/* device node if this endpoint is accessed via userspace */
dev_t dev;
};
struct msm_rpc_reply_buff {
uint32_t pid;
uint32_t cid;
uint32_t xid;
};
/* shared between smd_rpcrouter*.c */
int __msm_rpc_read(struct msm_rpc_endpoint *ept,
struct rr_fragment **frag,
unsigned len, long timeout);
int msm_rpcrouter_close(void);
struct msm_rpc_endpoint *msm_rpcrouter_create_local_endpoint(dev_t dev);
int msm_rpcrouter_destroy_local_endpoint(struct msm_rpc_endpoint *ept);
int msm_rpcrouter_create_server_cdev(struct rr_server *server);
int msm_rpcrouter_create_server_pdev(struct rr_server *server);
int msm_rpcrouter_init_devices(void);
void msm_rpcrouter_exit_devices(void);
#if defined(CONFIG_ARCH_MSM7X30)
void get_requesting_client(struct msm_rpc_endpoint *ept, uint32_t xid,
struct msm_rpc_client_info *clnt_info);
#endif
extern dev_t msm_rpcrouter_devno;
extern struct class *msm_rpcrouter_class;
void xdr_init(struct msm_rpc_xdr *xdr);
void xdr_init_input(struct msm_rpc_xdr *xdr, void *buf, uint32_t size);
void xdr_init_output(struct msm_rpc_xdr *xdr, void *buf, uint32_t size);
void xdr_clean_input(struct msm_rpc_xdr *xdr);
void xdr_clean_output(struct msm_rpc_xdr *xdr);
uint32_t xdr_read_avail(struct msm_rpc_xdr *xdr);
#endif
|
/*
* arch/sh/kernel/vsyscall.c
*
* Copyright (C) 2006 Paul Mundt
*
* vDSO randomization
* Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/elf.h>
/*
* Should the kernel map a VDSO page into processes and pass its
* address down to glibc upon exec()?
*/
unsigned int __read_mostly vdso_enabled = 1;
EXPORT_SYMBOL_GPL(vdso_enabled);
static int __init vdso_setup(char *s)
{
vdso_enabled = simple_strtoul(s, NULL, 0);
return 1;
}
__setup("vdso=", vdso_setup);
/*
* These symbols are defined by vsyscall.o to mark the bounds
* of the ELF DSO images included therein.
*/
extern const char vsyscall_trapa_start, vsyscall_trapa_end;
static void *syscall_page;
int __init vsyscall_init(void)
{
syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
/*
* XXX: Map this page to a fixmap entry if we get around
* to adding the page to ELF core dumps
*/
memcpy(syscall_page,
&vsyscall_trapa_start,
&vsyscall_trapa_end - &vsyscall_trapa_start);
return 0;
}
static struct page *syscall_vma_nopage(struct vm_area_struct *vma,
unsigned long address, int *type)
{
unsigned long offset = address - vma->vm_start;
struct page *page;
if (address < vma->vm_start || address > vma->vm_end)
return NOPAGE_SIGBUS;
page = virt_to_page(syscall_page + offset);
get_page(page);
return page;
}
/* Prevent VMA merging */
static void syscall_vma_close(struct vm_area_struct *vma)
{
}
static struct vm_operations_struct syscall_vm_ops = {
.nopage = syscall_vma_nopage,
.close = syscall_vma_close,
};
/* Setup a VMA at program startup for the vsyscall page */
int arch_setup_additional_pages(struct linux_binprm *bprm,
int executable_stack)
{
struct vm_area_struct *vma;
struct mm_struct *mm = current->mm;
unsigned long addr;
int ret;
down_write(&mm->mmap_sem);
addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
if (IS_ERR_VALUE(addr)) {
ret = addr;
goto up_fail;
}
vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
if (!vma) {
ret = -ENOMEM;
goto up_fail;
}
vma->vm_start = addr;
vma->vm_end = addr + PAGE_SIZE;
/* MAYWRITE to allow gdb to COW and set breakpoints */
vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
vma->vm_flags |= mm->def_flags;
vma->vm_page_prot = protection_map[vma->vm_flags & 7];
vma->vm_ops = &syscall_vm_ops;
vma->vm_mm = mm;
ret = insert_vm_struct(mm, vma);
if (unlikely(ret)) {
kmem_cache_free(vm_area_cachep, vma);
goto up_fail;
}
current->mm->context.vdso = (void *)addr;
mm->total_vm++;
up_fail:
up_write(&mm->mmap_sem);
return ret;
}
const char *arch_vma_name(struct vm_area_struct *vma)
{
if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
return "[vdso]";
return NULL;
}
struct vm_area_struct *get_gate_vma(struct task_struct *task)
{
return NULL;
}
int in_gate_area(struct task_struct *task, unsigned long address)
{
return 0;
}
int in_gate_area_no_task(unsigned long address)
{
return 0;
}
|
/**
* @file clocks.c
* @author Pavel Komarov <pkomarov@gatech.edu> 941-545-7573
* @brief A library that provides easy ways to set system clocks
* @ingroup Digital
* @version 1
*
* http://solarracing.gatech.edu/wiki/Main_Page
*/
#include "F2806x_Device.h"
#include "clocks.h"
/*
* divsel and div make setting these with an FCLKS as trivial as single operations
*
* see Table 1-24 in the Technical reference manual for why these values are as they are.
*/
Uint16 divsel[36] = {1, 2, 1, 3, 1, 2,//2.5-15
1, 3, 1, 2, 1, 3,//17.5-30
1, 2, 1, 3, 1, 2,//32.5-45
3, 2, 3, 2, 3, 2,//50-75
3, 2, 3, 3, 3, 3,//80-120
3, 3, 3, 3, 3, 3};//130-180
Uint16 div[36] = {1, 1, 3, 1, 5, 3,//2.5-15
7, 2, 9, 5, 11,3,//17.5-30
13,7, 15,4, 17,9,//32.5-45
5, 11,6, 13,7, 15,//50-75
8, 17,9, 10,11,12,//80-120
13,14,15,16,17,18};//130-180
//possible clock frequencies in MHz
float32 xfclks[36]= {2.5, 5, 7.5, 10, 12.5, 15,
17.5, 20, 22.5, 25, 27.5, 30,
32.5, 35, 37.5, 40, 42.5, 45,
50, 55, 60, 65, 70, 75,
80, 85, 90, 100, 110, 120,
130, 140, 150, 160, 170, 180};
float32 xfclk;//for saving the the current clock frequency (in MHz)
float32 xftmr;//for saving current timer frequency (in kHz)
/*
* SysClkInit sets the system clock in MHz. The system clock can only take
* on a few values, multiples of fosc (the frequency of the oscillator used).
* So, an enum called FCLKS has been defined to aid the user in choosing a
* frequency. Note the default oscillator has a frequency of 10MHz; if a
* different oscillator is used, then this function will set fclk to
* (new fosc)/10MHz*(number of MHz specified with FLCKS enum).
*
* @param fclk An enum of type FCLKS describing the desired clock frequency in MHz
*/
void SysClkInit(FCLKS fclk) {
xfclk = xfclks[fclk];
//following lines are from page 82,83,84,85 of Tech ref man
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 0) {//1. if not in normal operation mode, exit
return;
}
SysCtrlRegs.PLLSTS.bit.DIVSEL = 0;//2. set DIVSEL to 0
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1;//3. turn off failed osc detection
SysCtrlRegs.PLLCR.bit.DIV = div[fclk];//4. set DIV to be some new value
while (SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1){//5. wait for PLLLOCKS to be 1
continue;
}
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0;//6. reenable failed osc detection
SysCtrlRegs.PLLSTS.bit.DIVSEL = divsel[fclk];//7. set DIVSEL
}
/**
* TimerInit sets the system timer, which controls the rate of SPI among
* other systems. Note this function relies upon knowing the clock frequency,
* which is only stored when fclk is set by the user. So, this function
* should be called after SysClkInit(FCLKS fclk).
*
* @param ftmr A float describing the desired timer frequency in kHz
*/
void TimerInit(float32 ftmr) {
xftmr = ftmr;
//use current fclk to calculate proper divisor so ftmr is as desired
Uint32 prd = xfclk*1000/ftmr -1;//multiply by 1000 to put xfclk in kHz
CpuTimer0Regs.TCR.bit.TSS = 1;//stop the timer
CpuTimer0Regs.TCR.bit.TIE = 1;//enable timer-triggered interrupts
CpuTimer0Regs.PRD.all = prd;//should set to appropriate value
CpuTimer0Regs.TPR.all = 0;//the other divisor
CpuTimer0Regs.TCR.bit.TSS = 0;//start the timer
}
/**
* @return The current system clock frequency in MHz.
*/
float32 getfclk() {
return xfclk;
}
/**
* Services the watchdog
*/
void serviceWatchog(){
EALLOW;
SysCtrlRegs.WDKEY = 0x55;
SysCtrlRegs.WDKEY = 0xAA;
EDIS;
}
|
/*
* Copyright (C) 2005-2016 by Rafael Santiago
*
* This is a free software. You can redistribute it and/or modify under
* the terms of the GNU General Public License version 2.
*
*/
#include <dsl/compiler/verifiers/vibrato.h>
#include <dsl/compiler/verifiers/sepexpander.h>
#include <dsl/compiler/compiler.h>
#include <dsl/utils.h>
int vibrato_sep_verifier(const char *buf, char *error_message, tulip_single_note_ctx **song, const char **next) {
if (buf == NULL || song == NULL || next == NULL) {
return 0;
}
if (get_cmd_code_from_cmd_tag(buf) != kTlpVibrato) {
tlperr_s(error_message, "The vibrato separator was expected.");
return 0;
}
add_sep_to_tulip_single_note_ctx(kTlpVibrato, song);
(*next) = buf + 1;
return 1;
}
|
// **********************************************************************
//
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef TEST_I_H
#define TEST_I_H
#include <Test.h>
class ThrowerI : public Test::Thrower
{
public:
ThrowerI();
virtual void shutdown(const Ice::Current&);
virtual bool supportsUndeclaredExceptions(const Ice::Current&);
virtual bool supportsAssertException(const Ice::Current&);
virtual void throwAasA(Ice::Int, const Ice::Current&);
virtual void throwAorDasAorD(Ice::Int, const Ice::Current&);
virtual void throwBasA(Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasA(Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwBasB(Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasB(Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasC(Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwModA(Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwUndeclaredA(Ice::Int, const Ice::Current&);
virtual void throwUndeclaredB(Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwUndeclaredC(Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwLocalException(const Ice::Current&);
virtual void throwNonIceException(const Ice::Current&);
virtual void throwAssertException(const Ice::Current&);
virtual void throwAfterResponse(const Ice::Current&);
virtual void throwAfterException(const Ice::Current&);
};
#endif
|
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_mat_scale_q31.c
* Description: Multiplies a Q31 matrix by a scalar
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupMatrix
*/
/**
@addtogroup MatrixScale
@{
*/
/**
@brief Q31 matrix scaling.
@param[in] pSrc points to input matrix
@param[in] scaleFract fractional portion of the scale factor
@param[in] shift number of bits to shift the result by
@param[out] pDst points to output matrix structure
@return execution status
- \ref ARM_MATH_SUCCESS : Operation successful
- \ref ARM_MATH_SIZE_MISMATCH : Matrix size check failed
@par Scaling and Overflow Behavior
The input data <code>*pSrc</code> and <code>scaleFract</code> are in 1.31 format.
These are multiplied to yield a 2.62 intermediate result which is shifted with saturation to 1.31 format.
*/
arm_status arm_mat_scale_q31(
const arm_matrix_instance_q31 * pSrc,
q31_t scaleFract,
int32_t shift,
arm_matrix_instance_q31 * pDst)
{
q31_t *pIn = pSrc->pData; /* Input data matrix pointer */
q31_t *pOut = pDst->pData; /* Output data matrix pointer */
uint32_t numSamples; /* Total number of elements in the matrix */
uint32_t blkCnt; /* Loop counter */
arm_status status; /* Status of matrix scaling */
int32_t kShift = shift + 1; /* Shift to apply after scaling */
q31_t in, out; /* Temporary variabels */
#ifdef ARM_MATH_MATRIX_CHECK
/* Check for matrix mismatch condition */
if ((pSrc->numRows != pDst->numRows) ||
(pSrc->numCols != pDst->numCols) )
{
/* Set status as ARM_MATH_SIZE_MISMATCH */
status = ARM_MATH_SIZE_MISMATCH;
}
else
#endif /* #ifdef ARM_MATH_MATRIX_CHECK */
{
/* Total number of samples in input matrix */
numSamples = (uint32_t) pSrc->numRows * pSrc->numCols;
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
/* C(m,n) = A(m,n) * k */
/* Scale, saturate and store result in destination buffer. */
in = *pIn++; /* read four inputs from source */
in = ((q63_t) in * scaleFract) >> 32; /* multiply input with scaler value */
out = in << kShift; /* apply shifting */
if (in != (out >> kShift)) /* saturate the results. */
out = 0x7FFFFFFF ^ (in >> 31);
*pOut++ = out; /* Store result destination */
in = *pIn++;
in = ((q63_t) in * scaleFract) >> 32;
out = in << kShift;
if (in != (out >> kShift))
out = 0x7FFFFFFF ^ (in >> 31);
*pOut++ = out;
in = *pIn++;
in = ((q63_t) in * scaleFract) >> 32;
out = in << kShift;
if (in != (out >> kShift))
out = 0x7FFFFFFF ^ (in >> 31);
*pOut++ = out;
in = *pIn++;
in = ((q63_t) in * scaleFract) >> 32;
out = in << kShift;
if (in != (out >> kShift))
out = 0x7FFFFFFF ^ (in >> 31);
*pOut++ = out;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* C(m,n) = A(m,n) * k */
/* Scale, saturate and store result in destination buffer. */
in = *pIn++;
in = ((q63_t) in * scaleFract) >> 32;
out = in << kShift;
if (in != (out >> kShift))
out = 0x7FFFFFFF ^ (in >> 31);
*pOut++ = out;
/* Decrement loop counter */
blkCnt--;
}
/* Set status as ARM_MATH_SUCCESS */
status = ARM_MATH_SUCCESS;
}
/* Return to application */
return (status);
}
/**
@} end of MatrixScale group
*/
|
/*
* AG-HPX500 board header
*/
#ifndef _DEFS_XXXX_H
#define _DEFS_XXXX_H
#define SPD_P2PF_ARCH "K250"
enum SPD_GENERIC_ENUM {
/* for Power Mode */
SPD_PM_HIGH = 0x4d, /* R:600mA, W:600mA */
SPD_PM_LOW = 0x34, /* R:400mA, W:400mA */
SPD_PM_NORMAL = 0x00, /* R:400mA, W:600mA */
};
enum SPD_K250_ENUM {
SPD_N_DEV = 4,
SPD_N_CACHE = 2,
SPD_PM_LEVEL = SPD_PM_NORMAL,
SPD_CACHE_N_BUFFER = 8, /* 4MB */
};
#endif /* _DEFS_XXXX_H */
|
/***************************************************************************
SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
/**
* @file string_lists.h
*/
#ifndef SM__STRING_LISTS_H
#define SM__STRING_LISTS_H
#ifndef SM__LISTS_H
#include "lists.h"
#endif
#include <string.h>
struct string_node
{
struct node node; /* embedded node struct */
char *string;
};
static inline int string_node_len(struct string_node *s)
{
return strlen(s->string);
}
struct string_list
{
struct list l;
};
/**
* Initialize the string list.
*
* @param list to be initialized
*/
void string_list_init(struct string_list *list);
/**
* Return the first string node of the given string list.
*
* @param list of which the first element should be returned
* @return the first element or NULL if the list is empty
*/
struct string_node *string_list_first(const struct string_list *list);
/**
* Return the last string node of the given string list.
*
* @param list of which the first element should be returned
* @return the first element or NULL if the list is empty
*/
struct string_node *string_list_last(const struct string_list *list);
/**
* @return the node following the given node.
*/
struct string_node *string_node_next(const struct string_node *node);
/**
* Insert the given string node at the tail of the given list.
*
* @param list the list at which the node should be inserted
* @param node the node to be inserted
*/
void string_list_insert_tail_node(struct string_list *list, struct string_node *node);
/**
* Insert the given node after the other given node.
*/
void string_list_insert_after(struct string_list *list, struct string_node *newnode, struct string_node *prednode);
/**
* Inserts a string into the end of a string list. The string will
* be duplicated. Nothing will be inserted if the string's length was 0.
*
* @param list the list to which to add the string.
* @param string the string to be added. The string will be duplicated.
* @return the newly created node that has just been inserted or NULL on memory
* failure or if length of string was 0.
*/
struct string_node *string_list_insert_tail(struct string_list *list, const char *string);
/**
* Inserts a string into the end of a string list. The string will
* be duplicated.
*
* @param list the list to which to add the string.
* @param string the string to be added. The string will be duplicated.
* @return the newly created node that has just been inserted or NULL on memory
* failure.
*/
struct string_node *string_list_insert_tail_always(struct string_list *list, const char *string);
/**
* Inserts a string into the end of a string list. The string will
* be duplicated but not more than len bytes.
*
* @param list the list to which to add the string.
* @param string the string to be added. The string will be duplicated.
* @param len the number of bytes to be copied.
* @return the newly created node that has just been inserted or NULL on memory
* failure or if length of string was 0.
*/
struct string_node *string_list_insert_tail_always_len(struct string_list *list, const char *string, int len);
/**
* Remove the head from the given string list.
*
* @param list the list from which the node should be removed.
* @return the head that has just been removed or NULL if the list was empty.
*/
struct string_node *string_list_remove_head(struct string_list *list);
/**
* Remove the tail of the given string list.
*
* @param list the list from which the node should be removed.
* @return the tail that has just been removed or NULL if the list was empty.
*/
struct string_node *string_list_remove_tail(struct string_list *list);
/**
* Clears the complete list by freeing all memory (including strings) but does
* not free the memory of the list itself.
*
* @param list the list whose element should be freed.
*/
void string_list_clear(struct string_list *list);
/**
* Exchange the contents of the two given string lists.
*
* @param a the first string list
* @param b the second string list
*/
void string_list_exchange(struct string_list *a, struct string_list *b);
/**
* Shortcut for calling string_list_clear() and free().
*
* @param list the list that should be cleared and freed.
*/
void string_list_free(struct string_list *list);
/**
* Looks for a given string node in the list and returns it.
* Search is case insensitive
*
* @param list
* @param str
* @return
*/
struct string_node *string_list_find(struct string_list *list, const char *str);
/**
* Locate the string_node of the given index.
*
* @return the string_node or NULL if it the list is not large enough.
*/
struct string_node *string_list_find_by_index(struct string_list *list, int index);
/**
* Determine the length of the given string list.
*
* @param l the list of which to determine the length.
* @return the length (number of nodes).
*/
int string_list_length(const struct string_list *l);
#endif
|
#include "read_string.h"
char *read_string(pid_t child, unsigned long addr)
{
char *val = malloc(4096);
int allocated = 4096;
int read = 0;
unsigned long tmp;
while (1)
{
if (read + sizeof tmp > allocated)
{
allocated *= 2;
val = realloc(val, allocated);
}
tmp = ptrace(PTRACE_PEEKDATA, child, addr + read);
if(errno != 0)
{
val[read] = 0;
break;
}
memcpy(val + read, &tmp, sizeof tmp);
if (memchr(&tmp, 0, sizeof tmp) != NULL)
break;
read += sizeof tmp;
}
return val;
}
|
#include <ctype.h>
static const char base64digits[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define BAD -1
static const char base64val[] = {
BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD,
BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD,
BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD,
BAD, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,BAD, BAD,BAD,BAD,BAD,
BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD
};
#define DECODE64(c) (isascii(c) ? base64val[c] : BAD)
void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
{
for (; inlen >= 3; inlen -= 3) {
*out++ = base64digits[in[0] >> 2];
*out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
*out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
*out++ = base64digits[in[2] & 0x3f];
in += 3;
}
if (inlen > 0) {
unsigned char fragment;
*out++ = base64digits[in[0] >> 2];
fragment = (in[0] << 4) & 0x30;
if (inlen > 1)
fragment |= in[1] >> 4;
*out++ = base64digits[fragment];
*out++ = (inlen < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c];
*out++ = '=';
}
*out = '\0';
}
int from64tobits(char *out, const char *in)
/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
{
int len = 0;
register unsigned char digit1, digit2, digit3, digit4;
if (in[0] == '+' && in[1] == ' ')
in += 2;
if (*in == '\r')
return(0);
do {
digit1 = in[0];
if (DECODE64(digit1) == BAD)
return(-1);
digit2 = in[1];
if (DECODE64(digit2) == BAD)
return(-1);
digit3 = in[2];
if (digit3 != '=' && DECODE64(digit3) == BAD)
return(-1);
digit4 = in[3];
if (digit4 != '=' && DECODE64(digit4) == BAD)
return(-1);
in += 4;
*out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4);
++len;
if (digit3 != '=') {
*out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
++len;
if (digit4 != '=') {
*out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);
++len;
}
}
} while
(*in && *in != '\r' && digit4 != '=');
return (len);
}
/* base64.c ends here */
|
#ifndef SMBASE_EVENTQUEUE_H
#define SMBASE_EVENTQUEUE_H
#include <queue>
#include <QMutex>
#include <QWaitCondition>
#include "Event.h"
namespace __smbase{
class EventQueue{
private:
std::queue<Event *> myQueue;
const unsigned int MAX_EVENTS;
QMutex *mutex;
QWaitCondition *full;
QWaitCondition *empty;
public:
EventQueue();
~EventQueue();
void put(Event *);
Event* get();
};
}
#endif
|
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005 by Mike Sharov <msharov@users.sourceforge.net>
// This file is free software, distributed under the MIT License.
#pragma once
#include "uvector.h"
#include "uctralgo.h"
namespace ustl {
/// \class list ulist.h ustl.h
/// \ingroup Sequences
///
/// \brief Linked list, defined as an alias to vector.
///
template <typename T>
class list : public vector<T> {
public:
typedef typename vector<T>::size_type size_type;
typedef typename vector<T>::iterator iterator;
typedef typename vector<T>::const_iterator const_iterator;
typedef typename vector<T>::reference reference;
typedef typename vector<T>::const_reference const_reference;
public:
inline list (void) : vector<T> () {}
inline explicit list (size_type n) : vector<T> (n) {}
inline list (size_type n, const T& v) : vector<T> (n, v) {}
inline list (const list<T>& v) : vector<T> (v) {}
inline list (const_iterator i1, const_iterator i2) : vector<T> (i1, i2) {}
inline size_type size (void) const { return vector<T>::size(); }
inline iterator begin (void) { return vector<T>::begin(); }
inline const_iterator begin (void) const { return vector<T>::begin(); }
inline iterator end (void) { return vector<T>::end(); }
inline const_iterator end (void) const { return vector<T>::end(); }
inline void push_front (const T& v) { this->insert (begin(), v); }
inline void pop_front (void) { this->erase (begin()); }
inline const_reference front (void) const { return *begin(); }
inline reference front (void) { return *begin(); }
inline void remove (const T& v) { ::ustl::remove (*this, v); }
template <typename Predicate>
inline void remove_if (Predicate p) { ::ustl::remove_if (*this, p); }
inline void reverse (void) { ::ustl::reverse (*this); }
inline void unique (void) { ::ustl::unique (*this); }
inline void sort (void) { ::ustl::sort (*this); }
void merge (list<T>& l);
void splice (iterator ip, list<T>& l, iterator first = nullptr, iterator last = nullptr);
#if HAVE_CPP11
inline list (list&& v) : vector<T> (move(v)) {}
inline list (std::initializer_list<T> v) : vector<T>(v) {}
inline list& operator= (list&& v) { vector<T>::operator= (move(v)); return *this; }
template <typename... Args>
inline void emplace_front (Args&&... args) { vector<T>::emplace (begin(), forward<Args>(args)...); }
inline void push_front (T&& v) { emplace_front (move(v)); }
#endif
};
/// Merges the contents with \p l. Assumes both lists are sorted.
template <typename T>
void list<T>::merge (list& l)
{
insert_space (begin(), l.size());
::ustl::merge (iat(l.size()), end(), l.begin(), l.end(), begin());
}
/// Moves the range [first, last) from \p l to this list at \p ip.
template <typename T>
void list<T>::splice (iterator ip, list<T>& l, iterator first, iterator last)
{
if (!first)
first = l.begin();
if (!last)
last = l.end();
insert (ip, first, last);
l.erase (first, last);
}
#define deque list ///< list has all the functionality provided by deque
} // namespace ustl
|
/*
* \brief Connection to Terminal service
* \author Norman Feske
* \date 2011-08-12
*/
/*
* 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 _INCLUDE__TERMINAL_SESSION__CONNECTION_H_
#define _INCLUDE__TERMINAL_SESSION__CONNECTION_H_
#include <terminal_session/client.h>
#include <base/connection.h>
namespace Terminal {
struct Connection : Genode::Connection<Session>, Session_client
{
/**
* Wait for connection-established signal
*/
static void wait_for_connection(Genode::Capability<Session> cap)
{
using namespace Genode;
/* create signal receiver, just for the single signal */
Signal_context sig_ctx;
Signal_receiver sig_rec;
Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx);
/* register signal handler */
cap.call<Rpc_connected_sigh>(sig_cap);
/* wati for signal */
sig_rec.wait_for_signal();
sig_rec.dissolve(&sig_ctx);
}
Connection()
:
Genode::Connection<Session>(session("ram_quota=%zd", 2*4096)),
Session_client(cap())
{
wait_for_connection(cap());
}
};
}
#endif /* _INCLUDE__TERMINAL_SESSION__CONNECTION_H_ */
|
/*
* Copyright (C) 2008-2022 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef WL_LOGIC_MAP_OBJECTS_TRIBES_REQUIREMENTS_H
#define WL_LOGIC_MAP_OBJECTS_TRIBES_REQUIREMENTS_H
#include <climits>
#include <map>
#include <memory>
#include <vector>
#include "logic/map_objects/tribes/training_attribute.h"
class FileRead;
class FileWrite;
namespace Widelands {
class MapObject;
class EditorGameBase;
class MapObjectLoader;
struct MapObjectSaver;
struct RequirementsStorage;
/**
* Requirements can be attached to Requests.
*
* Requirements are matched to a \ref MapObject 's \ref TrainingAttribute as
* returned by \ref MapObject::get_training_attribute .
*/
struct Requirements {
private:
struct BaseCapsule {
virtual ~BaseCapsule() {
}
virtual bool check(const MapObject&) const = 0;
virtual void write(FileWrite&, EditorGameBase&, MapObjectSaver&) const = 0;
virtual const RequirementsStorage& storage() const = 0;
};
template <typename T> struct Capsule : public BaseCapsule {
explicit Capsule(const T& init_m) : m(init_m) {
}
bool check(const MapObject& obj) const override {
return m.check(obj);
}
void write(FileWrite& fw, EditorGameBase& egbase, MapObjectSaver& mos) const override {
m.write(fw, egbase, mos);
}
const RequirementsStorage& storage() const override {
return T::storage;
}
T m;
};
public:
Requirements() {
}
template <typename T> Requirements(const T& req) : m(new Capsule<T>(req)) {
}
/**
* \return \c true if the object satisfies the requirements.
*/
bool check(const MapObject&) const;
// For Save/Load Games
void read(FileRead&, EditorGameBase&, MapObjectLoader&);
void write(FileWrite&, EditorGameBase&, MapObjectSaver&) const;
private:
std::shared_ptr<BaseCapsule> m;
};
/**
* On-disk IDs for certain requirements.
*
* Only add enums at the end, and make their value explicit.
*/
enum {
requirementIdOr = 1,
requirementIdAnd = 2,
requirementIdAttribute = 3,
};
/**
* Factory-like system for requirement loading from files.
*/
struct RequirementsStorage {
using Reader = Requirements (*)(FileRead&, EditorGameBase&, MapObjectLoader&);
RequirementsStorage(uint32_t id, Reader reader);
uint32_t id() const;
static Requirements read(FileRead&, EditorGameBase&, MapObjectLoader&);
private:
using StorageMap = std::map<uint32_t, RequirementsStorage*>;
uint32_t id_;
Reader reader_;
static StorageMap& storageMap();
};
/**
* Require that at least one of the sub-requirements added with \ref add()
* is met. Defaults to \c false if no sub-requirement is added.
*/
struct RequireOr {
void add(const Requirements&);
bool check(const MapObject&) const;
void write(FileWrite&, EditorGameBase& egbase, MapObjectSaver&) const;
static const RequirementsStorage storage;
private:
std::vector<Requirements> m;
};
/**
* Require that all sub-requirements added \ref add() are met.
* Defaults to \c true if no sub-requirement is added.
*/
struct RequireAnd {
void add(const Requirements&);
bool check(const MapObject&) const;
void write(FileWrite&, EditorGameBase& egbase, MapObjectSaver&) const;
static const RequirementsStorage storage;
private:
std::vector<Requirements> m;
};
/**
* Require that a \ref TrainingAttribute lies in the given, inclusive, range.
*/
struct RequireAttribute {
RequireAttribute(TrainingAttribute const init_at, int32_t const init_min, int32_t const init_max)
: at(init_at), min(init_min), max(init_max) {
}
RequireAttribute() : at(TrainingAttribute::kTotal), min(SHRT_MIN), max(SHRT_MAX) {
}
bool check(const MapObject&) const;
void write(FileWrite&, EditorGameBase& egbase, MapObjectSaver&) const;
static const RequirementsStorage storage;
int32_t get_min() const {
return min;
}
int32_t get_max() const {
return max;
}
private:
TrainingAttribute at;
int32_t min;
int32_t max;
};
} // namespace Widelands
#endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_REQUIREMENTS_H
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: (null)
*/
@protocol AFSyncBeginInfo
- (void)resetWithValidity:(id)validity;
@end
|
/*
* $Id$
*
* Copyright (C) 2006 - 2007 Stephen F. Booth <me@sbooth.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#import "AudioStreamCollectionNode.h"
// ========================================
// A node representing the top _count most frequently-played streams
// ========================================
@interface MostPopularNode : AudioStreamCollectionNode
{
unsigned _count;
}
@end
|
#ifndef _BAT_ID_H_
#define _BAT_ID_H_
#define GPIO_BATTERY_DATA_PIN GPIO20
#define GPIO_BATTERY_DATA_PIN_M_GPIO GPIO_MODE_00
#define CHK_BATTERY_ID
#define BATTERY_PACK_ERROR 0
#define BATTERY_PACK_BL_44JH 1 //1700mAh
#define BATTERY_PACK_BL_44JN 2 //1540mAh
extern kal_uint8 battery_pack_id;
extern void bat_id_init_pin(void);
extern void bat_id_deinit_pin(void);
#endif //ifndef _BAT_ID_H_
|
/*
remar2d - a 2D graphics engine using SDL
Copyright (C) 2007 Andreas Remar, andreas.remar@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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TILE_H
#define TILE_H
#include "SpriteInstance.h"
#include <list>
using namespace std;
class Tile
{
public:
Tile();
Tile(const char *tileSet, int x, int y);
/** Add sprite instance to tile to indicate that this sprite should
be redrawn if this tile is redrawn. */
void addSpriteInstance(SpriteInstance *spriteInstance);
/** Remove sprite instance from tile to indicate that this sprite
has left the tile so redraw isn't needed when tile is redrawn. */
void removeSpriteInstance(SpriteInstance *spriteInstance);
list<SpriteInstance *> *getListOfSprites();
void setListOfSprites(list<SpriteInstance *> *oldSpriteList);
void markSpritesDirty();
const char *tileSet;
/* Tile position in the tileset */
int x, y;
bool redraw;
list<SpriteInstance *> sprites;
/* If empty, this tile contains no graphic, just overdraw with
background color when necessary */
bool empty;
};
#endif
|
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/slab.h>
static struct kmem_cache *cache_ex;
static struct example {
char a[20];
short b[20];
unsigned int c[10];
unsigned long d[20];
};
struct example ex, *p;
static int slab_in(void)
{
printk("size of structure: %d",sizeof(struct example));
cache_ex = kmem_cache_create("lnt_cache",sizeof(struct example),__alignof__(struct example),NULL,NULL);
if(!cache_ex)
printk("Error while creating cache \n");
/* p=kmem_cache_alloc(cache_ex,GFP_KERNEL);
if(!p)
printk("Error while allocating cache \n");*/
return 0;
}
static void slab_ex(void)
{
printk("destroying the cache \n");
/* kmem_cache_free(cache_ex,p);*/
kmem_cache_destroy(cache_ex);
return;
}
module_init(slab_in);
module_exit(slab_ex);
|
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2019 The ManaPlus Developers
* Copyright (C) 2019-2022 Andrei Karas
*
* This file is part of The ManaPlus Client.
*
* 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
* 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 RESOURCES_AMBIENTLAYER_H
#define RESOURCES_AMBIENTLAYER_H
#include "resources/memorycounter.h"
#include "localconsts.h"
class Graphics;
class Image;
class Map;
class AmbientLayer final : public MemoryCounter
{
public:
friend class Map;
/**
* Constructor.
*
* @param img the image this overlay displays
* @param parallax scroll factor based on camera position
* @param speedX scrolling speed in x-direction
* @param speedY scrolling speed in y-direction
* @param keepRatio rescale the image to keep
* the same ratio than in 800x600 resolution mode.
*/
AmbientLayer(const std::string &name,
Image *const img,
const float parallax,
const float parallaxY,
const float posX,
const float posY,
const float speedX,
const float speedY,
const bool keepRatio,
const int mask);
A_DELETE_COPY(AmbientLayer)
~AmbientLayer() override final;
void update(const int timePassed,
const float dx,
const float dy);
void draw(Graphics *const graphics,
const int x,
const int y) const A_NONNULL(2);
int calcMemoryLocal() const override;
std::string getCounterName() const override final
{ return mName; }
private:
const std::string mName;
Image *mImage;
float mParallaxX;
float mParallaxY;
float mPosX; /**< Current layer X position. */
float mPosY; /**< Current layer Y position. */
float mSpeedX; /**< Scrolling speed in X direction. */
float mSpeedY; /**< Scrolling speed in Y direction. */
int mMask;
bool mKeepRatio; /**< Keep overlay ratio on every resolution */
};
#endif // RESOURCES_AMBIENTLAYER_H
|
/**
* @file
*/
/*
All original material Copyright (C) 2002-2015 UFO: Alien Invasion.
Original file from Quake 2 v3.21: quake2-2.31/client/cl_input.c
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
typedef struct camera_s {
vec3_t origin; /**< the reference origin used for rotating around and to look at */
vec3_t camorg; /**< origin of the camera (look from) */
vec3_t speed; /**< speed of camera movement */
vec3_t angles; /**< current camera angle */
vec3_t omega; /**< speed of rotation */
vec3_t axis[3]; /**< set when refdef.angles is set */
float lerplevel; /**< linear interpolation between frames while changing the world level */
float zoom; /**< the current zoom level (see MIN_ZOOM and MAX_ZOOM) */
} camera_t;
#define FOV 75.0
#define CAMERA_START_DIST 600
#define CAMERA_START_HEIGHT UNIT_HEIGHT * 1.5
#define CAMERA_LEVEL_HEIGHT UNIT_HEIGHT
extern cvar_t* cl_centerview;
extern cvar_t* cl_camzoommax;
extern cvar_t* cl_camzoommin;
extern cvar_t* cl_camzoomquant;
extern const float MIN_ZOOM, MAX_ZOOM;
void CL_CameraInit(void);
void CL_CameraMove(void);
void CL_CameraRoute(const pos3_t from, const pos3_t target);
void CL_CheckCameraRoute(const pos3_t from, const pos3_t target);
void CL_CameraZoomIn(void);
void CL_CameraZoomOut(void);
|
// @(#)root/mathcore:$Id: MinimizerOptions.h 26508 2008-11-28 14:22:29Z moneta $
// Author: L. Moneta Fri Aug 15 2008
/**********************************************************************
* *
* Copyright (c) 2008 LCG ROOT Math Team, CERN/PH-SFT *
* *
* *
**********************************************************************/
#ifndef ROOT_Math_MinimizerOptions
#define ROOT_Math_MinimizerOptions
#include <string>
namespace ROOT {
namespace Math {
//_______________________________________________________________________________
/**
Minimizer options
@ingroup MultiMin
*/
class MinimizerOptions {
public:
// static methods for setting and retrieving the default options
static void SetDefaultMinimizer(const char * type, const char * algo = 0);
static void SetDefaultErrorDef( double up);
static void SetDefaultTolerance(double tol);
static void SetDefaultMaxFunctionCalls(int maxcall);
static void SetDefaultMaxIterations(int maxiter);
static void SetDefaultStrategy(int strat);
static void SetDefaultPrintLevel(int level);
static const std::string & DefaultMinimizerType();
static const std::string & DefaultMinimizerAlgo();
static double DefaultErrorDef();
static double DefaultTolerance();
static int DefaultMaxFunctionCalls();
static int DefaultMaxIterations();
static int DefaultStrategy();
static int DefaultPrintLevel();
// default options
MinimizerOptions() :
fLevel( MinimizerOptions::DefaultPrintLevel()),
fMaxCalls( MinimizerOptions::DefaultMaxFunctionCalls() ),
fMaxIter( MinimizerOptions::DefaultMaxIterations() ),
fStrategy( MinimizerOptions::DefaultStrategy() ),
fErrorDef( MinimizerOptions::DefaultErrorDef() ),
fTolerance( MinimizerOptions::DefaultTolerance() ),
fMinimType( MinimizerOptions::DefaultMinimizerType() ),
fAlgoType( MinimizerOptions::DefaultMinimizerAlgo() )
{}
/** non-static methods for retrivieng options */
/// set print level
int PrintLevel() const { return fLevel; }
/// max number of function calls
unsigned int MaxFunctionCalls() const { return fMaxCalls; }
/// max iterations
unsigned int MaxIterations() const { return fMaxIter; }
/// strategy
int Strategy() const { return fStrategy; }
/// absolute tolerance
double Tolerance() const { return fTolerance; }
/// error definition
double ErrorDef() const { return fErrorDef; }
/// type of minimizer
const std::string & MinimizerType() const { return fMinimType; }
/// type of algorithm
const std::string & MinimizerAlgorithm() const { return fAlgoType; }
/** non-static methods for setting options */
/// set print level
void SetPrintLevel(int level) { fLevel = level; }
///set maximum of function calls
void SetMaxFunctionCalls(unsigned int maxfcn) { fMaxCalls = maxfcn; }
/// set maximum iterations (one iteration can have many function calls)
void SetMaxIterations(unsigned int maxiter) { fMaxIter = maxiter; }
/// set the tolerance
void SetTolerance(double tol) { fTolerance = tol; }
/// set the strategy
void SetStrategy(int stra) { fStrategy = stra; }
/// set error def
void SetErrorDef(double err) { fErrorDef = err; }
/// set minimizer type
void SetMinimizerType(const std::string & type) { fMinimType = type; }
/// set minimizer algorithm
void SetMinimizerAlgorithm(const std::string & type) { fAlgoType = type; }
private:
int fLevel; // debug print level
int fMaxCalls; // maximum number of function calls
int fMaxIter; // maximum number of iterations
int fStrategy; // minimizer strategy (used by Minuit)
double fErrorDef; // error definition (=1. for getting 1 sigma error for chi2 fits)
double fTolerance; // minimize tolerance to reach solution
std::string fMinimType; // Minimizer type (Minuit, Minuit2, etc..
std::string fAlgoType; // Minimizer algorithmic specification (Migrad, Minimize, ...)
};
} // end namespace Math
} // end namespace ROOT
#endif
|
//
// bisearchtree.h
// BiSearchTree
//
// Created by nonstriater on 14-2-22.
//
//
/**
*
二叉查找树(Binary search tree),也叫有序二叉树(Ordered binary tree),排序二叉树(Sorted binary tree)。是指一个空树或者具有下列性质的二叉树:
1. 若任意节点的左子树不为空,则左子树上所有的节点值小于它的根节点值
2. 若任意节点的右子树不为空,则右子树上所有节点的值均大于它的根节点的值
3. 任意节点左右子树也为二叉查找树
4. 没有键值相等的节点
*/
#ifndef BiSearchTree_bisearchtree_h
#define BiSearchTree_bisearchtree_h
typedef int ElemType;
typedef struct BiSearchTree{
ElemType key;
struct BiSearchTree *lChild;
struct BiSearchTree *rChild;
}BiSearchTree;
/**
* 创建二叉查找树
*
* @return 指向一颗空树的指针
*/
BiSearchTree *bisearch_tree_new();
/**
* 插入节点
*
* @param tree tree
* @param node 节点值
*/
BiSearchTree *bisearch_tree_insert(BiSearchTree *tree,ElemType node);
/**
* 查找节点
*
* @param tree tree
* @param node 节点值
* @return -1失败 0 成功
*/
int bisearch_tree_search(BiSearchTree *tree,ElemType node);
//删除节点
int bisearch_tree_delete(BiSearchTree **tree,ElemType node);
// 遍历节点
void bisearch_tree_inorder_traversal(BiSearchTree *tree);
#endif
|
/*
******************************************************************************
*
* File: cmd_opts.h
*
* Purpose: Header file for fwknop command line options.
*
* Fwknop is developed primarily by the people listed in the file 'AUTHORS'.
* Copyright (C) 2009-2014 fwknop developers and contributors. For a full
* list of contributors, see the file 'CREDITS'.
*
* License (GNU General Public License):
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* 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 CMD_OPTS_H
#define CMD_OPTS_H
/* Long options values (for those without a short option).
*/
enum {
FKO_DIGEST_NAME = 0x100,
ENCRYPTION_MODE,
NAT_LOCAL,
NAT_PORT,
NAT_RAND_PORT,
TIME_OFFSET_MINUS,
TIME_OFFSET_PLUS,
SAVE_RC_STANZA,
FORCE_SAVE_RC_STANZA,
STANZA_LIST,
NO_SAVE_ARGS,
SHOW_LAST_ARGS,
RC_FILE_PATH,
RESOLVE_HTTP_ONLY,
RESOLVE_URL,
USE_HMAC,
USE_WGET_USER_AGENT,
SPA_ICMP_TYPE,
SPA_ICMP_CODE,
KEY_LEN,
HMAC_DIGEST_TYPE,
HMAC_KEY_LEN,
GET_HMAC_KEY,
KEY_RIJNDAEL,
KEY_RIJNDAEL_BASE64,
KEY_HMAC_BASE64,
KEY_HMAC,
FD_SET_STDIN,
FD_SET_ALT,
FAULT_INJECTION_TAG,
/* Put GPG-related items below the following line */
GPG_ENCRYPTION = 0x200,
GPG_RECIP_KEY,
GPG_SIGNER_KEY,
GPG_HOME_DIR,
GPG_EXE_PATH,
GPG_AGENT,
GPG_ALLOW_NO_SIGNING_PW,
NOOP /* Just to be a marker for the end */
};
/* Our getopt_long options string.
*/
#define GETOPTS_OPTION_STRING "a:A:bB:C:D:E:f:gG:hH:kK:lm:M:n:N:p:P:Q:rRsS:Tu:U:vVw:"
/* Our program command-line options...
*/
static struct option cmd_opts[] =
{
{"allow-ip", 1, NULL, 'a'},
{"access", 1, NULL, 'A'},
{"save-packet-append", 0, NULL, 'b'},
{"save-packet", 1, NULL, 'B'},
{"save-rc-stanza", 0, NULL, SAVE_RC_STANZA},
{"force-stanza", 0, NULL, FORCE_SAVE_RC_STANZA},
{"stanza-list", 0, NULL, STANZA_LIST},
{"no-save-args", 0, NULL, NO_SAVE_ARGS},
{"server-cmd", 1, NULL, 'C'},
{"digest-type", 1, NULL, FKO_DIGEST_NAME},
{"destination", 1, NULL, 'D'},
{"save-args-file", 1, NULL, 'E'},
{"encryption-mode", 1, NULL, ENCRYPTION_MODE},
{"fd", 1, NULL, FD_SET_ALT},
{"fw-timeout", 1, NULL, 'f'},
{"fault-injection-tag", 1, NULL, FAULT_INJECTION_TAG },
{"gpg-encryption", 0, NULL, 'g'},
{"gpg-recipient-key", 1, NULL, GPG_RECIP_KEY },
{"gpg-signer-key", 1, NULL, GPG_SIGNER_KEY },
{"gpg-home-dir", 1, NULL, GPG_HOME_DIR },
{"gpg-exe", 1, NULL, GPG_EXE_PATH },
{"gpg-agent", 0, NULL, GPG_AGENT },
{"gpg-no-signing-pw", 0, NULL, GPG_ALLOW_NO_SIGNING_PW },
{"get-key", 1, NULL, 'G'},
{"get-hmac-key", 1, NULL, GET_HMAC_KEY },
{"help", 0, NULL, 'h'},
{"http-proxy", 1, NULL, 'H'},
{"key-gen", 0, NULL, 'k'},
{"key-gen-file", 1, NULL, 'K'},
{"key-rijndael", 1, NULL, KEY_RIJNDAEL },
{"key-base64-rijndael", 1, NULL, KEY_RIJNDAEL_BASE64 },
{"key-base64-hmac", 1, NULL, KEY_HMAC_BASE64 },
{"key-hmac", 1, NULL, KEY_HMAC },
{"key-len", 1, NULL, KEY_LEN},
{"hmac-key-len", 1, NULL, HMAC_KEY_LEN},
{"hmac-digest-type", 1, NULL, HMAC_DIGEST_TYPE},
{"icmp-type", 1, NULL, SPA_ICMP_TYPE },
{"icmp-code", 1, NULL, SPA_ICMP_CODE },
{"last-cmd", 0, NULL, 'l'},
{"nat-access", 1, NULL, 'N'},
{"named-config", 1, NULL, 'n'},
{"nat-local", 0, NULL, NAT_LOCAL},
{"nat-port", 1, NULL, NAT_PORT},
{"nat-rand-port", 0, NULL, NAT_RAND_PORT},
{"server-port", 1, NULL, 'p'},
{"server-proto", 1, NULL, 'P'},
{"spoof-source", 1, NULL, 'Q'},
{"spoof-src", 1, NULL, 'Q'}, /* synonym */
{"rc-file", 1, NULL, RC_FILE_PATH},
{"rand-port", 0, NULL, 'r'},
{"resolve-ip-http", 0, NULL, 'R'},
{"resolve-ip-https", 0, NULL, 'R'}, /* synonym, default is HTTPS */
{"resolve-http-only", 0, NULL, RESOLVE_HTTP_ONLY},
{"resolve-url", 1, NULL, RESOLVE_URL},
{"show-last", 0, NULL, SHOW_LAST_ARGS},
{"source-ip", 0, NULL, 's'},
{"source-port", 1, NULL, 'S'},
{"stdin", 0, NULL, FD_SET_STDIN},
{"test", 0, NULL, 'T'},
{"time-offset-plus", 1, NULL, TIME_OFFSET_PLUS},
{"time-offset-minus", 1, NULL, TIME_OFFSET_MINUS},
{"user-agent", 1, NULL, 'u'},
{"use-hmac", 0, NULL, USE_HMAC},
{"use-wget-user-agent", 0, NULL, USE_WGET_USER_AGENT},
{"spoof-user", 1, NULL, 'U'},
{"verbose", 0, NULL, 'v'},
{"version", 0, NULL, 'V'},
{"wget-cmd", 1, NULL, 'w'},
{0, 0, 0, 0}
};
#endif /* CMD_OPTS_H */
/***EOF***/
|
#ifndef TAGEDITOR_NETWORKACCESSMANAGER_H
#define TAGEDITOR_NETWORKACCESSMANAGER_H
#include <QtGlobal>
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
namespace Utility {
QNetworkAccessManager &networkAccessManager();
}
#endif // TAGEDITOR_NETWORKACCESSMANAGER_H
|
// ライセンス: GPL2
//
// ポップアップ系ビュー
//
#ifndef _ARTICLEVIEWPOPUP_H
#define _ARTICLEVIEWPOPUP_H
#include "articleviewbase.h"
namespace ARTICLE
{
// ポップアップビューのベース
class ArticleViewPopup : public ArticleViewBase
{
bool m_show_abone;
public:
ArticleViewPopup( const std::string& url, bool show_abone );
virtual ~ArticleViewPopup();
virtual void stop(){}
protected:
void show_instruct_popup();
const bool show_abone() const { return m_show_abone; }
private:
virtual DrawAreaBase* create_drawarea();
};
/////////////////////////////////////////////////////////////////////////
// HTMLコメントポップアップ
class ArticleViewPopupHTML : public ArticleViewPopup
{
std::string m_html;
public:
ArticleViewPopupHTML( const std::string& url, const std::string& html ): ArticleViewPopup( url, false ), m_html( html ){}
virtual ~ArticleViewPopupHTML(){}
virtual void show_view(){ append_html( m_html ); }
};
/////////////////////////////////////////////////////////////////////////
// レス抽出ポップアップ
class ArticleViewPopupRes : public ArticleViewPopup
{
std::string m_str_num;
bool m_show_title;
public:
ArticleViewPopupRes( const std::string& url, const std::string& num, bool show_title, bool show_abone )
: ArticleViewPopup( url, show_abone ), m_str_num( num ), m_show_title( show_title ){}
virtual ~ArticleViewPopupRes(){}
virtual void show_view(){
show_instruct_popup();
show_res( m_str_num, m_show_title );
}
};
/////////////////////////////////////////////////////////////////////////
// 名前抽出ポップアップ
class ArticleViewPopupName : public ArticleViewPopup
{
std::string m_str_name;
public:
ArticleViewPopupName( const std::string& url, const std::string& name ): ArticleViewPopup( url, false ), m_str_name( name ){}
virtual ~ArticleViewPopupName(){}
virtual void show_view(){
show_instruct_popup();
show_name( m_str_name, false );
}
};
/////////////////////////////////////////////////////////////////////////
// ID 抽出ポップアップ
class ArticleViewPopupID : public ArticleViewPopup
{
std::string m_str_id;
public:
ArticleViewPopupID( const std::string& url, const std::string& id ): ArticleViewPopup( url, false ), m_str_id( id ) {}
virtual ~ArticleViewPopupID(){}
virtual void show_view(){
show_instruct_popup();
show_id( m_str_id, false );
}
};
/////////////////////////////////////////////////////////////////////////
// 参照抽出ポップアップ
class ArticleViewPopupRefer : public ArticleViewPopup
{
std::string m_str_num;
public:
ArticleViewPopupRefer( const std::string& url, const std::string& num ): ArticleViewPopup( url, false ), m_str_num( num ){}
virtual ~ArticleViewPopupRefer(){}
virtual void show_view(){
show_instruct_popup();
show_refer( atol( m_str_num.c_str() ) );
}
};
/////////////////////////////////////////////////////////////////////////
// キーワード抽出ビュー
class ArticleViewPopupDrawout : public ArticleViewPopup
{
std::string m_query;
bool m_mode_or;
public:
ArticleViewPopupDrawout( const std::string& url, const std::string& query, bool mode_or )
: ArticleViewPopup( url, false ), m_query( query ), m_mode_or( mode_or ){}
virtual ~ArticleViewPopupDrawout(){}
virtual void show_view(){
show_instruct_popup();
drawout_keywords( m_query, m_mode_or, false );
}
};
/////////////////////////////////////////////////////////////////////////
// しおり抽出ポップアップ
class ArticleViewPopupBM : public ArticleViewPopup
{
public:
ArticleViewPopupBM( const std::string& url ) : ArticleViewPopup( url, false ){}
virtual ~ArticleViewPopupBM(){}
virtual void show_view(){
show_instruct_popup();
show_bm();
}
};
}
#endif
|
//
// NSDate+Util.h
// iosapp
//
// Created by AeternChan on 10/15/15.
// Copyright © 2015 oschina. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <DateTools.h>
@interface NSDate (Util)
+ (instancetype)dateFromString:(NSString *)string;
- (NSString *)weekdayString;
@end
|
/*
* linux/arch/sh/boards/se/770x/setup.c
*
* Copyright (C) 2000 Kazumoto Kojima
*
* Hitachi SolutionEngine Support.
*
*/
#include <linux/init.h>
#include <linux/platform_device.h>
#include <mach-se/mach/se.h>
#include <mach-se/mach/mrshpc.h>
#include <asm/machvec.h>
#include <asm/io.h>
#include <asm/smc37c93x.h>
#include <asm/heartbeat.h>
/*
* Configure the Super I/O chip
*/
static void __init smsc_config(int index, int data)
{
outb_p(index, INDEX_PORT);
outb_p(data, DATA_PORT);
}
/* XXX: Another candidate for a more generic cchip machine vector */
static void __init smsc_setup(char **cmdline_p)
{
outb_p(CONFIG_ENTER, CONFIG_PORT);
outb_p(CONFIG_ENTER, CONFIG_PORT);
/* FDC */
smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
/* AUXIO (GPIO): to use IDE1 */
smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
/* COM1 */
smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IO_BASE_HI_INDEX, 0x03);
smsc_config(IO_BASE_LO_INDEX, 0xf8);
smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
/* COM2 */
smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IO_BASE_HI_INDEX, 0x02);
smsc_config(IO_BASE_LO_INDEX, 0xf8);
smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
/* RTC */
smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
smsc_config(ACTIVATE_INDEX, 0x01);
smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
/* XXX: PARPORT, KBD, and MOUSE will come here... */
outb_p(CONFIG_EXIT, CONFIG_PORT);
}
static struct resource cf_ide_resources[] = {
[0] = {
.start = PA_MRSHPC_IO + 0x1f0,
.end = PA_MRSHPC_IO + 0x1f0 + 8,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = PA_MRSHPC_IO + 0x1f0 + 0x206,
.end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_CFCARD,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device cf_ide_device = {
.name = "pata_platform",
.id = -1,
.num_resources = ARRAY_SIZE(cf_ide_resources),
.resource = cf_ide_resources,
};
static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
static struct heartbeat_data heartbeat_data = {
.bit_pos = heartbeat_bit_pos,
.nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
};
static struct resource heartbeat_resource = {
.start = PA_LED,
.end = PA_LED,
.flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
};
static struct platform_device heartbeat_device = {
.name = "heartbeat",
.id = -1,
.dev = {
.platform_data = &heartbeat_data,
},
.num_resources = 1,
.resource = &heartbeat_resource,
};
#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
defined(CONFIG_CPU_SUBTYPE_SH7712)
/* SH771X Ethernet driver */
static struct resource sh_eth0_resources[] = {
[0] = {
.start = SH_ETH0_BASE,
.end = SH_ETH0_BASE + 0x1B8,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = SH_ETH0_IRQ,
.end = SH_ETH0_IRQ,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device sh_eth0_device = {
.name = "sh-eth",
.id = 0,
.dev = {
.platform_data = PHY_ID,
},
.num_resources = ARRAY_SIZE(sh_eth0_resources),
.resource = sh_eth0_resources,
};
static struct resource sh_eth1_resources[] = {
[0] = {
.start = SH_ETH1_BASE,
.end = SH_ETH1_BASE + 0x1B8,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = SH_ETH1_IRQ,
.end = SH_ETH1_IRQ,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device sh_eth1_device = {
.name = "sh-eth",
.id = 1,
.dev = {
.platform_data = PHY_ID,
},
.num_resources = ARRAY_SIZE(sh_eth1_resources),
.resource = sh_eth1_resources,
};
#endif
static struct platform_device *se_devices[] __initdata = {
&heartbeat_device,
&cf_ide_device,
#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
defined(CONFIG_CPU_SUBTYPE_SH7712)
&sh_eth0_device,
&sh_eth1_device,
#endif
};
static int __init se_devices_setup(void)
{
mrshpc_setup_windows();
return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
}
device_initcall(se_devices_setup);
/*
* The Machine Vector
*/
static struct sh_machine_vector mv_se __initmv = {
.mv_name = "SolutionEngine",
.mv_setup = smsc_setup,
#if defined(CONFIG_CPU_SH4)
.mv_nr_irqs = 48,
#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
.mv_nr_irqs = 32,
#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
.mv_nr_irqs = 61,
#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
.mv_nr_irqs = 86,
#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
.mv_nr_irqs = 104,
#endif
<<<<<<< HEAD
=======
.mv_inb = se_inb,
.mv_inw = se_inw,
.mv_inl = se_inl,
.mv_outb = se_outb,
.mv_outw = se_outw,
.mv_outl = se_outl,
.mv_inb_p = se_inb_p,
.mv_inw_p = se_inw,
.mv_inl_p = se_inl,
.mv_outb_p = se_outb_p,
.mv_outw_p = se_outw,
.mv_outl_p = se_outl,
.mv_insb = se_insb,
.mv_insw = se_insw,
.mv_insl = se_insl,
.mv_outsb = se_outsb,
.mv_outsw = se_outsw,
.mv_outsl = se_outsl,
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
.mv_init_irq = init_se_IRQ,
};
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id: php_hash_haval.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef PHP_HASH_HAVAL_H
#define PHP_HASH_HAVAL_H
#include "ext/standard/basic_functions.h"
/* HAVAL context. */
typedef struct {
php_hash_uint32 state[8];
php_hash_uint32 count[2];
unsigned char buffer[128];
char passes;
short output;
void (*Transform)(php_hash_uint32 state[8], const unsigned char block[128]);
} PHP_HAVAL_CTX;
#define PHP_HASH_HAVAL_INIT_DECL(p,b) PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *); \
PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, unsigned int);
PHP_HASH_HAVAL_INIT_DECL(3,128)
PHP_HASH_HAVAL_INIT_DECL(3,160)
PHP_HASH_HAVAL_INIT_DECL(3,192)
PHP_HASH_HAVAL_INIT_DECL(3,224)
PHP_HASH_HAVAL_INIT_DECL(3,256)
PHP_HASH_HAVAL_INIT_DECL(4,128)
PHP_HASH_HAVAL_INIT_DECL(4,160)
PHP_HASH_HAVAL_INIT_DECL(4,192)
PHP_HASH_HAVAL_INIT_DECL(4,224)
PHP_HASH_HAVAL_INIT_DECL(4,256)
PHP_HASH_HAVAL_INIT_DECL(5,128)
PHP_HASH_HAVAL_INIT_DECL(5,160)
PHP_HASH_HAVAL_INIT_DECL(5,192)
PHP_HASH_HAVAL_INIT_DECL(5,224)
PHP_HASH_HAVAL_INIT_DECL(5,256)
#endif
|
#include "../frisbee.c"
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Test Case 2
* Turn on LED, or Blink LED
*/
int main(void)
{
struct sched_t sched[NUM_LEDS];
init_microcontroller();
clearbit(PORTA, LED_RED);
//scheduler_fill(sched, 0, 0, 1);
for (;;)
{
//scheduler_run(sched);
/*
setbit(PORTA, PA0);
_delay_ms(1000);
clearbit(PORTA, PA0);
_delay_ms(1000);
*/
}
return 0;
}
|
/* RNG.h
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
*
* 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.
*/
/* definitions of symbols inferred to exist in the RNG.h header file for
* which the brainslug symbol information is available which are specific to
* the game `New Super Mario Bros. Wii'. */
#ifndef _SMN_RNG_H_
#define _SMN_RNG_H_
typedef long rng_t;
/*
// Default non-rentrant RNG
void RNG_DefaultSeed(long seed);
// Returns a random float between 0 and 1
float RNG_DefaultRandFloat(void);
unsigned short RNG_DefaultRand(void);
float RNG_DefaultRandFloatRange(float max);
*/
// Rentrant RNG
unsigned int RNG_Rand(rng_t *rng, unsigned int max);
// Returns a random float between 0 and 1
float RNG_RandFloat(rng_t *rng);
// Returns a random float between -0.5 and 0.5
float RNG_RandFloatZeroed(rng_t *rng);
#endif /* _SMN_RNG_H_ */
|
/*
* XBMC Media Center
* Copyright (c) 2002 d7o3g4q and RUNTiME
* Portions Copyright (c) by the authors of ffmpeg and xvid
*
* 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.
*/
// AsyncAudioRenderer.h: interface for the CAsyncDirectSound class.
//
//////////////////////////////////////////////////////////////////////
#ifndef __ALSA_DIRECT_SOUND_H__
#define __ALSA_DIRECT_SOUND_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "IAudioRenderer.h"
#include "cores/IAudioCallback.h"
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "../../utils/PCMAmplifier.h"
extern void RegisterAudioCallback(IAudioCallback* pCallback);
extern void UnRegisterAudioCallback();
class CALSADirectSound : public IAudioRenderer
{
public:
virtual void UnRegisterAudioCallback();
virtual void RegisterAudioCallback(IAudioCallback* pCallback);
virtual unsigned int GetChunkLen();
virtual float GetDelay();
virtual float GetCacheTime();
virtual float GetCacheTotal();
CALSADirectSound();
virtual bool Initialize(IAudioCallback* pCallback, const CStdString& device, int iChannels, enum PCMChannels *channelMap, unsigned int uiSamplesPerSec, unsigned int uiBitsPerSample, bool bResample, bool bIsMusic=false, bool bPassthrough = false);
virtual ~CALSADirectSound();
virtual unsigned int AddPackets(const void* data, unsigned int len);
virtual unsigned int GetSpace();
virtual bool Deinitialize();
virtual bool Pause();
virtual bool Stop();
virtual bool Resume();
virtual long GetCurrentVolume() const;
virtual void Mute(bool bMute);
virtual bool SetCurrentVolume(long nVolume);
virtual void SetDynamicRangeCompression(long drc) { m_drc = drc; }
virtual int SetPlaySpeed(int iSpeed);
virtual void WaitCompletion();
virtual void SwitchChannels(int iAudioStream, bool bAudioOnAllSpeakers);
virtual void Flush();
static void EnumerateAudioSinks(AudioSinkList& vAudioSinks, bool passthrough);
private:
unsigned int GetSpaceFrames();
static bool SoundDeviceExists(const CStdString& device);
static void GenSoundLabel(AudioSinkList& vAudioSinks, CStdString sink, CStdString card, CStdString readableCard);
snd_pcm_t *m_pPlayHandle;
IAudioCallback* m_pCallback;
CPCMAmplifier m_amp;
long m_nCurrentVolume;
long m_drc;
snd_pcm_uframes_t m_dwFrameCount;
snd_pcm_uframes_t m_uiBufferSize;
unsigned int m_dwNumPackets;
bool m_bPause;
bool m_bIsAllocated;
bool m_bCanPause;
unsigned int m_uiSamplesPerSec;
unsigned int m_uiBitsPerSample;
unsigned int m_uiDataChannels;
unsigned int m_uiChannels;
bool m_bPassthrough;
};
#endif
|
/***************************************************************************
file : CarControl.h
copyright : (C) 2007 Daniele Loiacono
***************************************************************************/
/***************************************************************************
* *
* 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 CARCONTROL_H_
#define CARCONTROL_H_
#include <string>
class CarControl {
public:
CarControl(std::string sensors);
CarControl(float accel, float brake, int gear, float steer, float clutch, int focus = 0, int meta = 0);
std::string toString();
float getAccel();
void setAccel (float accel);
float getBrake();
void setBrake (float brake);
int getGear();
void setGear(int gear);
float getSteer();
void setSteer(float steer);
int getMeta();
void setMeta(int gear);
float getClutch();
void setClutch(float clutch);
int getFocus();
void setFocus(int focus);
const static int META_RESTART = 1;
private:
float accel;
float brake;
int gear;
float steer;
float clutch;
int meta;
int focus;
};
#endif
|
#ifndef __LOG_H
#define __LOG_H
class Log {
public:
Log() {
Serial.begin(57600);
Serial3.begin(57600);
}
void waitSerial() {
Serial.println("Enter key to start");
Serial3.println("Enter key to start");
while (!Serial.available() && !Serial3.available());
while ((Serial.available() && Serial.read()) || (Serial3.available() && Serial3.read()));
// delay(10000);
}
void print(const char* s) {
Serial.print(s);
Serial3.print(s);
}
void print(double s) {
Serial.print(s);
Serial3.print(s);
}
void print(float s) {
Serial.print(s);
Serial3.print(s);
}
void print(int s) {
Serial.print(s);
Serial3.print(s);
}
void print(long s) {
Serial.print(s);
Serial3.print(s);
}
void print(unsigned int s) {
Serial.print(s);
Serial3.print(s);
}
void print(unsigned long s) {
Serial.print(s);
Serial3.print(s);
}
void println(const char* s) {
Serial.println(s);
Serial3.println(s);
}
void println(double s) {
Serial.println(s);
Serial3.println(s);
}
};
#endif
|
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/power_supply.h>
#include <linux/workqueue.h>
#include <linux/reboot.h>
#include <asm/unaligned.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#include <mach/board.h>
#include <asm/uaccess.h>
#include <linux/power_supply.h>
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
#define DBG(x...)
#endif
//#define RK29_PLAY_ON_PIN RK29_PIN6_PA7
//#define MAX_PRE_CNT 2
//#define DET_CNT 5
#define PWR_ON_THRESHD 5 //power on threshd of capacity
//unsigned int pre_cnt = 0; //for long press counter
//int charge_disp_mode = 0;
static int pwr_on_thrsd = 5; //power on capcity threshold
int charger_in_logo = 0;
//extern int boot_mode_init(char * s);
static int __init pwr_on_thrsd_setup(char *str)
{
pwr_on_thrsd = simple_strtol(str,NULL,10);
printk(KERN_INFO "power on threshold:%d",pwr_on_thrsd);
return 0;
}
__setup("pwr_on_thrsd=", pwr_on_thrsd_setup);
static int usb_status;
static int ac_status;
static int __rk_get_system_battery_status(struct device *dev, void *data)
{
union power_supply_propval val_status = {POWER_SUPPLY_STATUS_DISCHARGING};
struct power_supply *psy = dev_get_drvdata(dev);
psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val_status);
if (val_status.intval != 0) {
if (psy->type == POWER_SUPPLY_TYPE_USB)
usb_status = POWER_SUPPLY_TYPE_USB;
if (psy->type == POWER_SUPPLY_TYPE_MAINS)
ac_status = POWER_SUPPLY_TYPE_MAINS;
}
return 0;
}
// POWER_SUPPLY_TYPE_BATTERY --- discharge
// POWER_SUPPLY_TYPE_USB --- usb_charging
// POWER_SUPPLY_TYPE_MAINS --- AC_charging
int rk_get_system_battery_status(void)
{
class_for_each_device(power_supply_class, NULL, NULL, __rk_get_system_battery_status);
if (ac_status == POWER_SUPPLY_TYPE_MAINS) {
return POWER_SUPPLY_TYPE_MAINS;
} else if (usb_status == POWER_SUPPLY_TYPE_USB) {
return POWER_SUPPLY_TYPE_USB;
}
return POWER_SUPPLY_TYPE_BATTERY;
}
EXPORT_SYMBOL(rk_get_system_battery_status);
static union power_supply_propval battery_capacity = { 100 };
static int __rk_get_system_battery_capacity(struct device *dev, void *data)
{
struct power_supply *psy = dev_get_drvdata(dev);
psy->get_property(psy, POWER_SUPPLY_PROP_CAPACITY, &battery_capacity);
return 0;
}
int rk_get_system_battery_capacity(void)
{
class_for_each_device(power_supply_class, NULL, NULL, __rk_get_system_battery_capacity);
return battery_capacity.intval;
}
EXPORT_SYMBOL(rk_get_system_battery_capacity);
#ifdef CONFIG_POWER_ON_CHARGER_DISPLAY
//int charger_mode=0; //1:charge,0:not charge
static void add_bootmode_charger_to_cmdline(void)
{
char *pmode=" androidboot.mode=charger";
//int off = strlen(saved_command_line);
char *new_command_line = kzalloc(strlen(saved_command_line) + strlen(pmode) + 1, GFP_KERNEL);
sprintf(new_command_line, "%s%s", saved_command_line, pmode);
saved_command_line = new_command_line;
//strcpy(saved_command_line+off,pmode);
//int off = strlen(boot_command_line);
//strcpy(boot_command_line+off,pmode);
printk("Kernel command line: %s\n", saved_command_line);
}
//display charger logo in kernel CAPACITY
static int __init start_charge_logo_display(void)
{
union power_supply_propval val_status = {POWER_SUPPLY_STATUS_DISCHARGING};
union power_supply_propval val_capacity ={ 100} ;
printk("start_charge_logo_display\n");
charger_in_logo = 0;
if(board_boot_mode() == BOOT_MODE_RECOVERY) //recovery mode
{
printk("recovery mode \n");
return 0;
}
if (rk_get_system_battery_status() != POWER_SUPPLY_TYPE_BATTERY)
val_status.intval = POWER_SUPPLY_STATUS_CHARGING;
val_capacity.intval = rk_get_system_battery_capacity();
// low power and discharging
#if 1
if((val_capacity.intval < pwr_on_thrsd )&&(val_status.intval != POWER_SUPPLY_STATUS_CHARGING))
{
printk("low power\n");
add_bootmode_charger_to_cmdline();
charger_in_logo = 1;
//kernel_power_off();
//while(1);
return 0;
}
#endif
//low power and charging
#if 0
if((val_capacity.intval < pwr_on_thrsd )&&(val_status.intval == POWER_SUPPLY_STATUS_CHARGING))
{
while((val_capacity.intval < pwr_on_thrsd ))
{
list_for_each_entry(psy, &rk_psy_head, rk_psy_node)
{
psy->get_property(psy,POWER_SUPPLY_PROP_CAPACITY,&val_capacity);
}
//printk("charging ... \n");
}
}
#endif
if(val_status.intval == POWER_SUPPLY_STATUS_CHARGING)
{
if ((board_boot_mode() == BOOT_MODE_NORMAL) ||(board_boot_mode() == BOOT_MODE_CHARGE)/* || (val_capacity.intval <= pwr_on_thrsd)*/) //do not enter power on charge mode when soft reset
{
add_bootmode_charger_to_cmdline();
//boot_mode_init("charge");
printk("power in charge mode\n");
charger_in_logo = 1;
}
}
return 0;
}
subsys_initcall_sync(start_charge_logo_display);
//module_init(start_charge_logo_display);
#endif
|
/* Copyright (C) 2003-2010 Jesper K. Pedersen <blackie@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef IMAGEDB_H
#define IMAGEDB_H
#include "DB/ImageInfoPtr.h"
#include "DB/ImageInfoList.h"
#include "DB/MediaCount.h"
#include <DB/FileNameList.h>
class QProgressBar;
namespace DB
{
class CategoryCollection;
class Category;
class MD5Map;
class MemberMap;
class ImageDateCollection;
class IdList;
class Id;
class ImageSearchInfo;
class FileName;
class ImageDB :public QObject {
Q_OBJECT
public:
static ImageDB* instance();
static void setupXMLDB( const QString& configFile );
static void deleteInstance();
DB::FileNameSet imagesWithMD5Changed();
public slots:
void setDateRange( const ImageDate&, bool includeFuzzyCounts );
void clearDateRange();
virtual void slotRescan();
void slotRecalcCheckSums(const DB::FileNameList& selection);
virtual MediaCount count( const ImageSearchInfo& info );
virtual void slotReread( const DB::FileNameList& list, DB::ExifMode mode);
protected:
ImageDate _selectionRange;
bool _includeFuzzyCounts;
ImageInfoList _clipboard;
private:
static void connectSlots();
static ImageDB* _instance;
protected:
ImageDB();
public:
static QString NONE();
DB::FileNameList currentScope(bool requireOnDisk) const;
virtual DB::FileName findFirstItemInRange(
const FileNameList& images,
const ImageDate& range,
bool includeRanges) const;
public: // Methods that must be overridden
virtual uint totalCount() const = 0;
virtual DB::FileNameList search(const ImageSearchInfo&, bool requireOnDisk=false) const = 0;
virtual void renameCategory( const QString& oldName, const QString newName ) = 0;
virtual QMap<QString,uint> classify( const ImageSearchInfo& info, const QString & category, MediaType typemask ) = 0;
virtual FileNameList images() = 0;
virtual void addImages( const ImageInfoList& images ) = 0;
/** @short Update file name stored in the DB */
virtual void renameImage( const ImageInfoPtr info, const DB::FileName& newName ) = 0;
virtual void addToBlockList(const DB::FileNameList& list) = 0;
virtual bool isBlocking( const DB::FileName& fileName ) = 0;
virtual void deleteList(const DB::FileNameList& list) = 0;
virtual ImageInfoPtr info( const DB::FileName& fileName ) const = 0;
virtual MemberMap& memberMap() = 0;
virtual void save( const QString& fileName, bool isAutoSave ) = 0;
virtual MD5Map* md5Map() = 0;
virtual void sortAndMergeBackIn(const DB::FileNameList& list) = 0;
virtual CategoryCollection* categoryCollection() = 0;
virtual KSharedPtr<ImageDateCollection> rangeCollection() = 0;
/**
* Reorder the items in the database by placing all the items given in
* cutList directly before or after the given item.
* If the parameter "after" determines where to place it.
*/
virtual void reorder(const DB::FileName& item, const DB::FileNameList& cutList, bool after) = 0;
/** @short Create a stack of images/videos/whatever
*
* If the specified images already belong to different stacks, then no
* change happens and the function returns false.
*
* If some of them are in one stack and others aren't stacked at all, then
* the unstacked will be added to the existing stack and we return true.
*
* If none of them are stacked, then a new stack is created and we return
* true.
*
* All images which previously weren't in the stack are added in order they
* are present in the provided list and after all items that are already in
* the stack. The order of images which were already in the stack is not
* changed.
* */
virtual bool stack(const DB::FileNameList& items) = 0;
/** @short Remove all images from whichever stacks they might be in
*
* We might destroy some stacks in the process if they become empty or just
* containing one image.
*
* This function doesn't touch the order of images at all.
* */
virtual void unstack(const DB::FileNameList& images) = 0;
/** @short Return a list of images which are in the same stack as the one specified.
*
* Returns an empty list when the image is not stacked.
*
* They are returned sorted according to their stackOrder.
* */
virtual DB::FileNameList getStackFor(const DB::FileName& referenceId) const = 0;
virtual void copyData( const DB::FileName& from, const DB::FileName& to) = 0;
protected slots:
virtual void lockDB( bool lock, bool exclude ) = 0;
void markDirty();
signals:
void totalChanged( uint );
void dirty();
void imagesDeleted( const DB::FileNameList& );
};
}
#endif /* IMAGEDB_H */
// vi:expandtab:tabstop=4 shiftwidth=4:
|
#include <stdio.h>
int main(void)
{
char oldname[80];
char newname[80];
// prompt for file to rename and new name
printf("File to rename: ");
gets(oldname);
printf("New name: ");
gets(newname);
// Rename the file
if (0 == rename(oldname, newname))
{
printf("Renamed %s to %s.\n", oldname, newname);
}
else
{
perror("rename");
}
return 0;
}
|
/*
* pure C program showing how you can use popen() to perform
* a NEMO task without the need to link NEMO code.
* Not very efficient, but it works.
*/
#include <stdio.h>
#define N 1000
void main() {
float x[N], y[N], z[N], pot[N];
int i, n;
FILE *fp;
/*
before you run this program, create p100.tab as follows
mkplummer - 100 | snapprint - x,y,z > p100.tab
*/
n = 100;
fp = fopen("p100.tab","r");
for (i=0; i<n; i++) fscanf(fp,"%g %g %g\n",&x[i],&y[i],&z[i]);
fclose(fp);
/* silly, but write them out again */
fp = fopen("tmpxyz.tab","w");
for (i=0; i<n; i++) fprintf(fp,"%g %g %g\n",x[i],y[i],z[i]);
fclose(fp);
/* use popen(2) to read the returned potentials */
fp = popen("xyz2pot tmpxyz.tab","r");
for (i=0; i<n; i++) {
fscanf(fp,"%g\n",&pot[i]);
printf("%d : %f %f %f %f\n",i+1,x[i],y[i],z[i],pot[i]);
}
pclose(fp);
}
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:40 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/jffs2/summary.h */
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* viking -- GPS Data and Topo Analyzer, Explorer, and Manager
*
* Copyright (C) 2011, Rob Norris <rw_norris@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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _VIKING_TRWLAYER_GEOTAG_H
#define _VIKING_TRWLAYER_GEOTAG_H
#include <glib.h>
#include <gtk/gtk.h>
#include "viktrwlayer.h"
G_BEGIN_DECLS
// To be only called from within viktrwlayer
void trw_layer_geotag_dialog ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack *track, const gchar *track_name );
G_END_DECLS
#endif
|
// IXUS120-SD940 fw 1.00e
#include "platform.h"
long vid_get_bitmap_screen_width()
{
return 360 ; // SD940 103c ? 360 103b: seems to use same number.
}
long vid_get_bitmap_screen_height()
{
return 240; // SD940 103c 103b: seems to use same number.
}
int vid_get_viewport_width()
{
return 360 ; // SD940 103c ?
}
long vid_get_viewport_height()
{
return 240; // SD940 103c 103b: seems to use same number.
}
long vid_get_bitmap_buffer_width()
{
return 960; // SD940 103c 103b: seems to use same number.
}
long vid_get_bitmap_buffer_height()
{
return 270; // SD940 103c 103b: seems to use same number.
}
char *camera_jpeg_count_str()
{
return (char*) 0x700B0; // SD940 103C search on "9999" 103b: seems to use same number.
}
char *hook_raw_image_addr()
{
return (char*)0x4219D120; // SD940 103c FFAD6FF8 from matching subroutine in S90 101a FFB0254C 103b: seems to use same number.
// ... search for aCrawBuffP DCB "CRAW BUFF %p",0
}
long hook_raw_size()
{
return 0x11CA240; // SD940 103c Search for "aCrawBuffSizeP" 103b: seems to use same number.
}
void *vid_get_bitmap_fb()
{
return (void*)0x403F1000; // SD940 103c @ FF8532DC after DispCon_ShowBlackChart 103b: seems to use same number.
}
void *vid_get_viewport_live_fb() //103b: seems to use same routine.
{ // Matched IXUS100-SD780 100c code at 0xFF8B02F4 with IXUS120-SD940 at address 0xFF8D9014
// Matched IXUS200-SD980 101c code at 0xFF8E0788 with IXUS120-SD940 at address 0xFF8D9014
// return (void*) 0; // __LiveImage.c__ ok
void **fb=(void **)0x4B34; // SD940 102C @ 0xFF8D9280
unsigned char buff = *((unsigned char*)0x497C); // SD940 103C @ 0xFF8D9018
if (buff == 0) {
buff = 2;
}
else {
buff--;
}
return fb[buff];
}
void *vid_get_viewport_fb()
{
return (void*)0x4088B700; // SD940 103c from matching subroutine in S90 101a 103b: seems to use same number.
// search on VRAM Address sub @ 9FFAD4910)
}
void *vid_get_viewport_fb_d()
{
return (void*)(*(int*)(0x2790+0x58)); // @FF869DEC @FF869E24
}
|
/*
* Linux cfg80211 driver - Android related functions
*
* Copyright (C) 1999-2012, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: wl_android.h 363350 2012-10-17 08:29:23Z $
*/
#include <linux/module.h>
#include <linux/netdevice.h>
#include <wldev_common.h>
/* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
* automatically
*/
#ifdef WL_GENL
#include <net/genetlink.h>
#endif
/**
* Android platform dependent functions, feel free to add Android specific functions here
* (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd
* or cfg, define them as static in wl_android.c
*/
/**
* wl_android_init will be called from module init function (dhd_module_init now), similarly
* wl_android_exit will be called from module exit function (dhd_module_cleanup now)
*/
int wl_android_init(void);
int wl_android_exit(void);
void wl_android_post_init(void);
int wl_android_wifi_on(struct net_device *dev);
int wl_android_wifi_off(struct net_device *dev);
int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd);
#if defined(CONFIG_WIFI_CONTROL_FUNC)
int wl_android_wifictrl_func_add(void);
void wl_android_wifictrl_func_del(void);
void* wl_android_prealloc(int section, unsigned long size);
int wifi_get_irq_number(unsigned long *irq_flags_ptr);
int wifi_set_power(int on, unsigned long msec);
int wifi_get_mac_addr(unsigned char *buf);
void *wifi_get_country_code(char *ccode);
#endif /* CONFIG_WIFI_CONTROL_FUNC */
#ifdef WL_GENL
/* attributes (variables): the index in this enum is used as a reference for the type,
* userspace application has to indicate the corresponding type
* the policy is used for security considerations
*/
enum {
BCM_GENL_ATTR_UNSPEC,
BCM_GENL_ATTR_STRING,
BCM_GENL_ATTR_MSG,
__BCM_GENL_ATTR_MAX
};
#define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1)
/* commands: enumeration of all commands (functions),
* used by userspace application to identify command to be ececuted
*/
enum {
BCM_GENL_CMD_UNSPEC,
BCM_GENL_CMD_MSG,
__BCM_GENL_CMD_MAX
};
#define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1)
s32 wl_genl_send_msg(struct net_device *ndev, int pid, u8 *string, u8 len, int mcast);
#endif /* WL_GENL */
|
#ifndef __GPIO_H__
#define __GPIO_H__
#define GPIO0
#define GPIO1
#define GPIO2
#define GPIO3
#define GPIO4
#define GPIO5
#define GPIO6
#define GPIO7
#endif /* __GPIO_H__ */
|
#ifndef _OBJ_OPS_H_
#define _OBJ_OPS_H_
#include <stdint.h>
#include "internal.h"
struct nlattr;
struct nlmsghdr;
struct nftnl_obj;
struct nftnl_obj {
struct list_head head;
struct obj_ops *ops;
const char *table;
const char *name;
uint32_t family;
uint32_t use;
uint32_t flags;
union {
struct nftnl_obj_counter {
uint64_t pkts;
uint64_t bytes;
} counter;
struct nftnl_obj_quota {
uint64_t bytes;
uint64_t consumed;
uint32_t flags;
} quota;
struct nftnl_obj_ct_helper {
uint16_t l3proto;
uint8_t l4proto;
char name[16];
} ct_helper;
} data;
};
struct obj_ops {
const char *name;
uint32_t type;
size_t alloc_len;
int max_attr;
int (*set)(struct nftnl_obj *e, uint16_t type, const void *data, uint32_t data_len);
const void *(*get)(const struct nftnl_obj *e, uint16_t type, uint32_t *data_len);
int (*parse)(struct nftnl_obj *e, struct nlattr *attr);
void (*build)(struct nlmsghdr *nlh, const struct nftnl_obj *e);
int (*snprintf)(char *buf, size_t len, uint32_t type, uint32_t flags, const struct nftnl_obj *e);
int (*json_parse)(struct nftnl_obj *e, json_t *data,
struct nftnl_parse_err *err);
};
extern struct obj_ops obj_ops_counter;
extern struct obj_ops obj_ops_quota;
extern struct obj_ops obj_ops_ct_helper;
#define nftnl_obj_data(obj) (void *)&obj->data
#endif
|
/*
* cstring.c
*
* Created on: Dec 30, 2014
* Author: muneer
*/
#include "cstring.h"
#include <string.h>
#include <stdlib.h>
t_cstring *cstring_create()
{
t_cstring *str;
str = (t_cstring *) malloc(sizeof(t_cstring));
str->size = 1;
str->value = (char *) malloc(1);
str->value[0] = '\0';
return str;
}
int cstring_delete(t_cstring *string) {
if (string != NULL) {
if (string->value != NULL)
free(string->value);
free (string);
}
return 0;
}
int cstring_add(t_cstring *string, char *s)
{
int new_size = string->size + strlen(s);
string->value = (char *) realloc(string->value, new_size);
if (string->value == NULL)
return -1;
strcat(string->value, s);
string->value[new_size-1] = '\0';
string->size = new_size;
return 0;
}
|
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "devices.h"
static int c_show(struct seq_file *m, void *v)
{
seq_printf(m, "%d\n", engineer_id);
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < 1 ? (void *)1 : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
static void c_stop(struct seq_file *m, void *v)
{
}
const struct seq_operations engineerid_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_show
};
extern const struct seq_operations engineerid_op;
static int engineerid_open(struct inode *inode, struct file *file)
{
return seq_open(file, &engineerid_op);
}
static const struct file_operations proc_engineerid_operations = {
.open = engineerid_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init proc_engineerid_init(void)
{
proc_create("engineerid", 0, NULL, &proc_engineerid_operations);
return 0;
}
module_init(proc_engineerid_init);
|
/* Copyright 2000 Kjetil S. Matheussen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "nsmtracker.h"
#include "disk.h"
#include "disk_song_proc.h"
#include "sequencer_timing_proc.h"
#include "disk_root_proc.h"
extern struct Root *root;
void SaveRoot(struct Root *theroot){
DC_start("ROOT");
// DC_SSN("def_instrument",theroot->def_instrument->l.num);
DC_SSN("curr_block",0); //ATOMIC_GET(theroot->curr_blocknum));
DC_SSI("tempo",theroot->tempo);
DC_SSI("lpb",theroot->lpb);
DC_SSL("signature_numerator",theroot->signature.numerator);
DC_SSL("signature_denominator",theroot->signature.denominator);
DC_SSL("quantitize_numerator",theroot->quantitize_options.quant.numerator);
DC_SSL("quantitize_denominator",theroot->quantitize_options.quant.denominator);
DC_SSF("quantitize",(double)theroot->quantitize_options.quant.numerator / (double)theroot->quantitize_options.quant.denominator);
DC_SSL("grid_numerator",theroot->grid_numerator);
DC_SSL("grid_denominator",theroot->grid_denominator);
DC_SSI("keyoct",theroot->keyoct); // not used anymore. Still saved though so that new songs can be opened in older radiums.
DC_SSI("min_standardvel",theroot->min_standardvel);
DC_SSI("standardvel",theroot->standardvel);
SaveSong(theroot->song);
DC_end();
}
/*********** Start Load song *************************/
struct Root *LoadRoot(void){
const char *objs[1]={
"SONG"
};
const char *vars[14]={
"def_instrument",
"curr_block",
"tempo",
"lpb",
"signature_numerator",
"signature_denominator",
"quantitize",
"quantitize_numerator",
"quantitize_denominator",
"grid_numerator",
"grid_denominator",
"keyoct",
"min_standardvel",
"standardvel"
};
struct Root *ret=DC_alloc(sizeof(struct Root));
ret->keyoct = root->keyoct;
ret->quantitize_options = root->quantitize_options;
ret->min_standardvel=MAX_VELOCITY*40/100;
ATOMIC_SET(ret->editonoff, true);
ret->grid_numerator=1;
ret->grid_denominator=1;
ret->signature.numerator=4;
ret->signature.denominator=4;
ret->tempo = 128;
SEQUENCER_TIMING_init(ret->tempo, ret->signature);
ATOMIC_SET(ret->play_cursor_onoff, ATOMIC_GET(root->play_cursor_onoff));
ATOMIC_SET(ret->editor_follows_play_cursor_onoff, ATOMIC_GET(root->editor_follows_play_cursor_onoff));
bool has_nominator=false;
bool has_denominator=false;
GENERAL_LOAD(1,14);
obj0:
ret->song=LoadSong();
goto start;
var0:
goto start; // Don't bother with instruments yet.
var1:
DC_LoadN(); // not used anymore
//ATOMIC_SET(ret->curr_blocknum, DC_LoadN());
goto start;
var2:
ret->tempo=DC_LoadI();
SEQUENCER_TIMING_init(ret->tempo, ret->signature);
goto start;
var3:
ret->lpb=DC_LoadI();
goto start;
var4:
ret->signature.numerator=DC_LoadI();
goto start;
var5:
ret->signature.denominator=DC_LoadI();
goto start;
var6:
DC_LoadF();
goto start;
var7:
ret->quantitize_options.quant.numerator = DC_LoadI();
goto start;
var8:
ret->quantitize_options.quant.denominator = DC_LoadI();
goto start;
var9:
ret->grid_numerator=DC_LoadI();
has_nominator=true;
if(has_denominator)
SEQUENCER_TIMING_init(ret->tempo, ret->signature);
goto start;
var10:
ret->grid_denominator=DC_LoadI();
has_denominator=true;
if(has_nominator)
SEQUENCER_TIMING_init(ret->tempo, ret->signature);
goto start;
var11:
DC_LoadI();
//ret->keyoct=DC_LoadI();
goto start;
var12:
ret->min_standardvel=DC_LoadI();
goto start;
var13:
ret->standardvel=DC_LoadI();
goto start;
var14:
var15:
var16:
var17:
var18:
var19:
var20:
var21:
obj1:
obj2:
obj3:
obj4:
obj5:
obj6:
debug("loadroot, very wrong\n");
error:
debug("loadroot, goto error\n");
end:
return ret;
}
extern struct Root *root;
void DLoadRoot(struct Root *theroot){
DLoadSong(theroot,theroot->song);
}
/*********************** End Load Song **************************/
|
/* tpg.h
* Definitions of helper functions for TPG
*
* (c) 2005, Luis E. Garcia Ontanon <luis@ontanon.org>
*
* $Id: tpg.h 43536 2012-06-28 22:56:06Z darkjames $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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 _TPG_H_
#define _TPG_H_
#include <glib.h>
#include <epan/packet.h>
#include <epan/proto.h>
#include <epan/tvbuff.h>
#include <epan/tvbparse.h>
#include <epan/emem.h>
typedef struct _tpg_parser_data_t {
ep_stack_t stack;
tvbparse_t* tt;
void* private_data;
} tpg_parser_data_t;
extern tpg_parser_data_t* tpg_start(proto_tree* root_tree,
tvbuff_t* tvb,
int offset,
int len,
tvbparse_wanted_t* ignore,
void* private_data);
#define TPG_START(tree,tvb,offset,len,data) tpg_start((tree),(tvb),(offset),(len),(data))
#define TPG_GET(tpg, wanted) tvbparse_get((tpg)->tt,(wanted))
#define TPG_FIND(tpg, wanted) tvbparse_find((tpg)->tt,(wanted))
#define TPG_TREE(vp) (((tpg_parser_data_t*)(vp))->tree)
#define TPG_DATA(vp,type) (((type*)(((tpg_parser_data_t*)(vp))->private_data)))
#define TPG_STRING(i) tvb_get_ephemeral_string((i)->tvb,(i)->offset,(i)->len)
#define TPG_INT(i) strtol(tvb_get_ephemeral_string((i)->tvb,(i)->offset,(i)->len),NULL,10)
#define TPG_UINT(i) strtoul(tvb_get_ephemeral_string((i)->tvb,(i)->offset,(i)->len),NULL,10)
#define TPG_UINT_HEX(i) strtoul(tvb_get_ephemeral_string((i)->tvb,(i)->offset,(i)->len),NULL,16)
#define TPG_TVB(i) tvb_new_subset((i)->tvb,(i)->offset,(i)->len,(i)->len)
extern guint32 tpg_ipv4(tvbparse_elem_t*);
#define TPG_IPV4(i) tpg_ipv4((i))
extern guint8* tpg_ipv6(tvbparse_elem_t*);
#define TPG_IPV6(i) tpg_ipv6((i))
#define TPG_PUSH(tpg,pi,ett) ep_stack_push(((tpg_parser_data_t*)(tpg))->stack,proto_item_add_subtree((pi),(ett)))
#define TPG_POP(tpg) ep_stack_pop(((tpg_parser_data_t*)(tpg))->stack) ;
#define TPG_ADD_STRING(tpg, hfid, elem) proto_tree_add_item(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, FALSE)
#define TPG_ADD_BOOLEAN(tpg, hfid, elem) proto_tree_add_boolean(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, TRUE)
#define TPG_ADD_INT(tpg, hfid, elem, value) proto_tree_add_int(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, value)
#define TPG_ADD_UINT(tpg, hfid, elem, value) proto_tree_add_uint(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, value)
#define TPG_ADD_IPV4(tpg, hfid, elem, value) proto_tree_add_ipv4(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, value)
#define TPG_ADD_IPV6(tpg, hfid, elem, value) proto_tree_add_ipv6(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), hfid, (elem)->tvb, (elem)->offset, (elem)->len, value)
#define TPG_ADD_TEXT(tpg, elem) proto_tree_add_text(ep_stack_peek(((tpg_parser_data_t*)tpg)->stack), (elem)->tvb, (elem)->offset, (elem)->len, \
"%s",tvb_format_text((elem)->tvb, (elem)->offset, (elem)->len))
#define TPG_SET_TEXT(pi, elem) proto_item_set_text((pi), "%s",tvb_format_text((elem)->tvb, (elem)->offset, (elem)->len))
#endif /* _TPG_H_ */
|
/*
*
* Copyright (C) 2010 Google, Inc.
*
* Author:
* Colin Cross <ccross@google.com>
*
* Copyright (C) 2010-2011 NVIDIA Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _TEGRA_DVFS_H_
#define _TEGRA_DVFS_H_
#define MAX_DVFS_FREQS 18
#define DVFS_RAIL_STATS_TOP_BIN 40
struct clk;
struct dvfs_rail;
/*
* dvfs_relationship between to rails, "from" and "to"
* when the rail changes, it will call dvfs_rail_update on the rails
* in the relationship_to list.
* when determining the voltage to set a rail to, it will consider each
* rail in the relationship_from list.
*/
struct dvfs_relationship {
struct dvfs_rail *to;
struct dvfs_rail *from;
int (*solve)(struct dvfs_rail *, struct dvfs_rail *);
struct list_head to_node; /* node in relationship_to list */
struct list_head from_node; /* node in relationship_from list */
bool solved_at_nominal;
};
struct rail_stats {
ktime_t time_at_mv[DVFS_RAIL_STATS_TOP_BIN + 1];
ktime_t last_update;
int last_index;
bool off;
};
struct dvfs_rail {
const char *reg_id;
int min_millivolts;
int max_millivolts;
int nominal_millivolts;
int step;
bool jmp_to_zero;
bool disabled;
bool updating;
bool resolving_to;
struct list_head node; /* node in dvfs_rail_list */
struct list_head dvfs; /* list head of attached dvfs clocks */
struct list_head relationships_to;
struct list_head relationships_from;
struct regulator *reg;
int millivolts;
int new_millivolts;
bool suspended;
struct rail_stats stats;
};
struct dvfs {
/* Used only by tegra2_clock.c */
const char *clk_name;
int speedo_id;
int process_id;
/* Must be initialized before tegra_dvfs_init */
int freqs_mult;
unsigned long freqs[MAX_DVFS_FREQS];
unsigned long *alt_freqs;
const int *millivolts;
struct dvfs_rail *dvfs_rail;
bool auto_dvfs;
/* Filled in by tegra_dvfs_init */
int max_millivolts;
int num_freqs;
int cur_millivolts;
unsigned long cur_rate;
struct list_head node;
struct list_head debug_node;
struct list_head reg_node;
};
extern struct dvfs_rail *tegra_cpu_rail;
#ifdef CONFIG_TEGRA_SILICON_PLATFORM
void tegra_soc_init_dvfs(void);
int tegra_enable_dvfs_on_clk(struct clk *c, struct dvfs *d);
int dvfs_debugfs_init(struct dentry *clk_debugfs_root);
int tegra_dvfs_late_init(void);
int tegra_dvfs_init_rails(struct dvfs_rail *dvfs_rails[], int n);
void tegra_dvfs_add_relationships(struct dvfs_relationship *rels, int n);
void tegra_dvfs_rail_enable(struct dvfs_rail *rail);
void tegra_dvfs_rail_disable(struct dvfs_rail *rail);
bool tegra_dvfs_rail_updating(struct clk *clk);
void tegra_dvfs_rail_off(struct dvfs_rail *rail, ktime_t now);
void tegra_dvfs_rail_on(struct dvfs_rail *rail, ktime_t now);
void tegra_dvfs_rail_pause(struct dvfs_rail *rail, ktime_t delta, bool on);
struct dvfs_rail *tegra_dvfs_get_rail_by_name(const char *reg_id);
int tegra_dvfs_predict_millivolts(struct clk *c, unsigned long rate);
void tegra_dvfs_core_cap_enable(bool enable);
void tegra_dvfs_core_cap_level_set(int level);
int tegra_dvfs_alt_freqs_set(struct dvfs *d, unsigned long *alt_freqs);
void tegra_cpu_dvfs_alter(
int edp_thermal_index, const cpumask_t *cpus, bool before_clk_update);
#else
static inline void tegra_soc_init_dvfs(void)
{}
static inline int tegra_enable_dvfs_on_clk(struct clk *c, struct dvfs *d)
{ return 0; }
static inline int dvfs_debugfs_init(struct dentry *clk_debugfs_root)
{ return 0; }
static inline int tegra_dvfs_late_init(void)
{ return 0; }
static inline int tegra_dvfs_init_rails(struct dvfs_rail *dvfs_rails[], int n)
{ return 0; }
static inline void tegra_dvfs_add_relationships(struct dvfs_relationship *rels, int n)
{}
static inline void tegra_dvfs_rail_enable(struct dvfs_rail *rail)
{}
static inline void tegra_dvfs_rail_disable(struct dvfs_rail *rail)
{}
static inline bool tegra_dvfs_rail_updating(struct clk *clk)
{ return false; }
static inline void tegra_dvfs_rail_off(struct dvfs_rail *rail, ktime_t now)
{}
static inline void tegra_dvfs_rail_on(struct dvfs_rail *rail, ktime_t now)
{}
static inline void tegra_dvfs_rail_pause(
struct dvfs_rail *rail, ktime_t delta, bool on)
{}
static inline struct dvfs_rail *tegra_dvfs_get_rail_by_name(const char *reg_id)
{ return NULL; }
static inline int tegra_dvfs_predict_millivolts(struct clk *c, unsigned long rate)
{ return 0; }
static inline void tegra_dvfs_core_cap_enable(bool enable)
{}
static inline void tegra_dvfs_core_cap_level_set(int level)
{}
static inline int tegra_dvfs_alt_freqs_set(struct dvfs *d,
unsigned long *alt_freqs)
{ return 0; }
static inline void tegra_cpu_dvfs_alter(
int edp_thermal_index, const cpumask_t *cpus, bool before_clk_update)
{}
#endif
#ifndef CONFIG_ARCH_TEGRA_2x_SOC
int tegra_dvfs_rail_disable_prepare(struct dvfs_rail *rail);
int tegra_dvfs_rail_post_enable(struct dvfs_rail *rail);
#else
static inline int tegra_dvfs_rail_disable_prepare(struct dvfs_rail *rail)
{ return 0; }
static inline int tegra_dvfs_rail_post_enable(struct dvfs_rail *rail)
{ return 0; }
#endif
#endif
|
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <asm/mach/map.h>
#include <mach/hardware.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/iomux.h>
#include <mach/board-mx27lite.h>
#include "devices.h"
static unsigned int mx27lite_pins[] = {
PE12_PF_UART1_TXD,
PE13_PF_UART1_RXD,
PE14_PF_UART1_CTS,
PE15_PF_UART1_RTS,
PD0_AIN_FEC_TXD0,
PD1_AIN_FEC_TXD1,
PD2_AIN_FEC_TXD2,
PD3_AIN_FEC_TXD3,
PD4_AOUT_FEC_RX_ER,
PD5_AOUT_FEC_RXD1,
PD6_AOUT_FEC_RXD2,
PD7_AOUT_FEC_RXD3,
PD8_AF_FEC_MDIO,
PD9_AIN_FEC_MDC,
PD10_AOUT_FEC_CRS,
PD11_AOUT_FEC_TX_CLK,
PD12_AOUT_FEC_RXD0,
PD13_AOUT_FEC_RX_DV,
PD14_AOUT_FEC_RX_CLK,
PD15_AOUT_FEC_COL,
PD16_AIN_FEC_TX_ER,
PF23_AIN_FEC_TX_EN,
};
static struct imxuart_platform_data uart_pdata = {
.flags = IMXUART_HAVE_RTSCTS,
};
static struct platform_device *platform_devices[] __initdata = {
&mxc_fec_device,
};
static void __init mx27lite_init(void)
{
mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
"imx27lite");
mxc_register_device(&mxc_uart_device0, &uart_pdata);
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
}
static void __init mx27lite_timer_init(void)
{
mx27_clocks_init(26000000);
}
static struct sys_timer mx27lite_timer = {
.init = mx27lite_timer_init,
};
MACHINE_START(IMX27LITE, "LogicPD i.MX27LITE")
.phys_io = AIPI_BASE_ADDR,
.io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x100,
.map_io = mx27_map_io,
.init_irq = mx27_init_irq,
.init_machine = mx27lite_init,
.timer = &mx27lite_timer,
MACHINE_END
|
/*
* This source file is part of the ZipArc project source distribution and
* is Copyrighted 2000 - 2006 by Tadeusz Dracz (http://www.artpol-software.com/)
*
* This code may be used in compiled form in any way you desire PROVIDING
* it is not sold for profit as a stand-alone application.
*
* This file may be redistributed unmodified by any means providing it is
* not sold for profit without the authors written consent, and
* providing that this notice and the authors name and all copyright
* notices remains intact.
*
* This file is provided 'as is' with no expressed or implied warranty.
* The author accepts no liability if it causes any damage to your computer.
*
*****************************************************/
#if !defined(AFX_DLGOPTAPPEAR_H__0ABD7885_3449_4D2B_B848_EB0B80D8FBA3__INCLUDED_)
#define AFX_DLGOPTAPPEAR_H__0ABD7885_3449_4D2B_B848_EB0B80D8FBA3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SAPrefsSubDlg.h"
class CDlgOptAppear : public CSAPrefsSubDlg
{
// Construction
public:
COptions* m_pOptions;
CDlgOptAppear(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDlgOptAppear)
enum { IDD = IDD_OPTAPPEAR };
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgOptAppear)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgOptAppear)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGOPTAPPEAR_H__0ABD7885_3449_4D2B_B848_EB0B80D8FBA3__INCLUDED_)
|
/*
* MATLAB Compiler: 3.0
* Date: Thu May 3 10:27:14 2007
* Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
* "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
* "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "./src/wavelet.m" "-d"
* "./build" "-I" "/usr/local/matlab6p5/toolbox/wavelet/wavelet/" "-I"
* "/usr/local/matlab6p5/toolbox/matlab/general/" "-W" "main" "-T" "link:exe"
* "-v"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __wconv_h
#define __wconv_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_wconv(void);
extern void TerminateModule_wconv(void);
extern _mexLocalFunctionTable _local_function_table_wconv;
extern mxArray * mlfNWconv(int nargout,
mxArray * type,
mxArray * x,
mxArray * f);
extern mxArray * mlfWconv(mxArray * type, mxArray * x, mxArray * f);
extern void mlfVWconv(mxArray * type, mxArray * x, mxArray * f);
extern void mlxWconv(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif
|
// SysIconUtils.h
#ifndef __SYS_ICON_UTILS_H
#define __SYS_ICON_UTILS_H
#include "Common/MyString.h"
struct CExtIconPair
{
UString Ext;
int IconIndex;
UString TypeName;
};
struct CAttribIconPair
{
DWORD Attrib;
int IconIndex;
UString TypeName;
};
inline bool operator==(const CExtIconPair &a1, const CExtIconPair &a2) { return a1.Ext == a2.Ext; }
inline bool operator< (const CExtIconPair &a1, const CExtIconPair &a2) { return a1.Ext < a2.Ext; }
inline bool operator==(const CAttribIconPair &a1, const CAttribIconPair &a2) { return a1.Attrib == a2.Attrib; }
inline bool operator< (const CAttribIconPair &a1, const CAttribIconPair &a2) { return a1.Attrib < a2.Attrib; }
class CExtToIconMap
{
CObjectVector<CExtIconPair> _extMap;
CObjectVector<CAttribIconPair> _attribMap;
public:
void Clear()
{
_extMap.Clear();
_attribMap.Clear();
}
int GetIconIndex(DWORD attrib, const UString &fileName, UString &typeName);
int GetIconIndex(DWORD attrib, const UString &fileName);
};
DWORD_PTR GetRealIconIndex(LPCTSTR path, DWORD attrib, int &iconIndex);
#ifndef _UNICODE
DWORD_PTR GetRealIconIndex(LPCWSTR path, DWORD attrib, int &iconIndex);
#endif
int GetIconIndexForCSIDL(int csidl);
inline HIMAGELIST GetSysImageList(bool smallIcons)
{
SHFILEINFO shellInfo;
return (HIMAGELIST)SHGetFileInfo(TEXT(""),
FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY,
&shellInfo, sizeof(shellInfo),
SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
}
#endif
|
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// trace.c
#include "light.h"
typedef struct tnode_s
{
int type;
vec3_t normal;
float dist;
int children[2];
int pad;
} tnode_t;
tnode_t *tnodes, *tnode_p;
/*
==============
MakeTnode
Converts the disk node structure into the efficient tracing structure
==============
*/
void MakeTnode (int nodenum)
{
tnode_t *t;
dplane_t *plane;
int i;
dnode_t *node;
t = tnode_p++;
node = dnodes + nodenum;
plane = dplanes + node->planenum;
t->type = plane->type;
VectorCopy (plane->normal, t->normal);
t->dist = plane->dist;
for (i=0 ; i<2 ; i++)
{
if (node->children[i] < 0)
t->children[i] = dleafs[-node->children[i] - 1].contents;
else
{
t->children[i] = tnode_p - tnodes;
MakeTnode (node->children[i]);
}
}
}
/*
=============
MakeTnodes
Loads the node structure out of a .bsp file to be used for light occlusion
=============
*/
void MakeTnodes (dmodel_t *bm)
{
if (!numnodes)
Error ("Map has no nodes\n");
tnode_p = tnodes = malloc(numnodes * sizeof(tnode_t));
MakeTnode (0);
}
/*
==============================================================================
LINE TRACING
The major lighting operation is a point to point visibility test, performed
by recursive subdivision of the line by the BSP tree.
==============================================================================
*/
typedef struct
{
vec3_t backpt;
int side;
int node;
} tracestack_t;
/*
==============
TestLine
==============
*/
qboolean TestLine (vec3_t start, vec3_t stop)
{
int node;
float front, back;
tracestack_t *tstack_p;
int side;
float frontx,fronty, frontz, backx, backy, backz;
tracestack_t tracestack[64];
tnode_t *tnode;
frontx = start[0];
fronty = start[1];
frontz = start[2];
backx = stop[0];
backy = stop[1];
backz = stop[2];
tstack_p = tracestack;
node = 0;
while (1)
{
while (node < 0 && node != CONTENTS_SOLID)
{
// pop up the stack for a back side
tstack_p--;
if (tstack_p < tracestack)
return true;
node = tstack_p->node;
// set the hit point for this plane
frontx = backx;
fronty = backy;
frontz = backz;
// go down the back side
backx = tstack_p->backpt[0];
backy = tstack_p->backpt[1];
backz = tstack_p->backpt[2];
node = tnodes[tstack_p->node].children[!tstack_p->side];
}
if (node == CONTENTS_SOLID)
return false; // DONE!
tnode = &tnodes[node];
switch (tnode->type)
{
case PLANE_X:
front = frontx - tnode->dist;
back = backx - tnode->dist;
break;
case PLANE_Y:
front = fronty - tnode->dist;
back = backy - tnode->dist;
break;
case PLANE_Z:
front = frontz - tnode->dist;
back = backz - tnode->dist;
break;
default:
front = (frontx*tnode->normal[0] + fronty*tnode->normal[1] + frontz*tnode->normal[2]) - tnode->dist;
back = (backx*tnode->normal[0] + backy*tnode->normal[1] + backz*tnode->normal[2]) - tnode->dist;
break;
}
if (front > -ON_EPSILON && back > -ON_EPSILON)
// if (front > 0 && back > 0)
{
node = tnode->children[0];
continue;
}
if (front < ON_EPSILON && back < ON_EPSILON)
// if (front <= 0 && back <= 0)
{
node = tnode->children[1];
continue;
}
side = front < 0;
front = front / (front-back);
tstack_p->node = node;
tstack_p->side = side;
tstack_p->backpt[0] = backx;
tstack_p->backpt[1] = backy;
tstack_p->backpt[2] = backz;
tstack_p++;
backx = frontx + front*(backx-frontx);
backy = fronty + front*(backy-fronty);
backz = frontz + front*(backz-frontz);
node = tnode->children[side];
}
}
|
/*
* This file is part of the KDE libraries
* Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMWINFOBASE_H
#define KMWINFOBASE_H
#include "kmwizardpage.h"
#include <qptrlist.h>
class QLabel;
class QLineEdit;
class KDEPRINT_EXPORT KMWInfoBase : public KMWizardPage {
public:
KMWInfoBase(int n = 1, QWidget *parent = 0, const char *name = 0);
void setInfo(const QString &);
void setLabel(int, const QString &);
void setText(int, const QString &);
void setCurrent(int);
QString text(int);
protected:
QLineEdit *lineEdit(int);
private:
QPtrList< QLabel > m_labels;
QPtrList< QLineEdit > m_edits;
QLabel *m_info;
int m_nlines;
};
#endif
|
/* Characters Map/2
* Copyright (C) 2001-2005 Dmitry A.Steklenev
*
* 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 _PM_ERROR_H
#define _PM_ERROR_H
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include "pm_noncopyable.h"
/**@#+*/
/**
* Base error class.
*
* The PMError class is the base class from which all
* exception objects thrown in the library are derived.
* These classes retrieve error information and text that
* you can subsequently use to create an exception object.
* <p>
* None of the functions in this class throws exceptions because
* an exception probably has been thrown already or is about to be
* thrown.
*
* @author Dmitry A Steklenev
*/
class PMError
{
public:
/** Constructs error from current GUI error. */
PMError( const char* file, const char* func, int line );
/** Constructs error from specified error id and information. */
PMError( int code, const char* info,
const char* file, const char* func, int line );
/** Constructs error object from another error. */
PMError( const PMError& );
/** Assigns the value of one error object to another. */
PMError& operator=( const PMError& );
/** Destructs the error object */
~PMError();
/** Returns source file name. */
const char* file() const { return err_file; }
/** Returns the name of the function. */
const char* func() const { return err_func; }
/** Returns the line number. */
int line() const { return err_line; }
/** Returns the error message. */
const char* info() const { return err_info; }
/** Returns the error id. */
int code() const { return err_code; }
/** Display error information. */
PMError& display( FILE* out = 0 );
private:
char* err_file;
char* err_func;
int err_line;
char* err_info;
int err_code;
};
/**@#-*/
#define PM_ERROR_LOCATION __FILE__, __FUNCTION__, __LINE__
#define PM_THROW_ERROR( id, info ) \
throw( PMError( id, info, PM_ERROR_LOCATION ).display( stdout ))
#define PM_THROW_GUIERROR() throw( PMError( PM_ERROR_LOCATION ).display( stdout ))
#define PM_THROW_CLBERROR() PM_THROW_ERROR( errno , strerror( errno ))
#define PM_THROW_OS2ERROR(rc) PM_THROW_ERROR( rc , NULL )
#endif
|
/* linux/drivers/mtd/onenand/samsung_captivate.h
*
* Partition Layout for Samsung Captivate
*
*/
struct mtd_partition s3c_partition_info[] = {
/*This is partition layout from the oneNAND it SHOULD match the pitfile on the second page of the NAND.
It will work if it doesn't but beware to write below the adress 0x01200000 there are the bootloaders.
Currently we won't map them, but we should keep that in mind for later things like flashing bootloader
from Linux. There is a partition 'efs' starting @ 0x00080000 40 256K pages long, it contains data for
the modem like IMSI we don't touch it for now, but we need the data from it, we create a partition
for that and copy the data from it. For this you need a image from it and mount it as vfat or copy
it on a kernel with rfs support on the phone.
Partitions on the lower NAND adresses:
0x00000000 - 0x0003FFFF = first stage bootloader
0x00040000 - 0x0007FFFF = PIT for second stage bootloader
0x00080000 - 0x00A7FFFF = EFS: IMSI and NVRAM for the modem
0x00A80000 - 0x00BBFFFF = second stage bootloader
0x00BC0000 - 0x00CFFFFF = backup of the second stage bootloader (should be loaded if the other fails, unconfirmed!)
0x00D00000 - 0x011FFFFF = PARAM.lfs config the bootloader
#########################################################################################
#########################################################################################
###### NEVER TOUCH THE FIRST 2 256k PAGES! THEY CONTAIN THE FIRST STAGE BOOTLOADER ######
#########################################################################################
#########################################################################################*/
{
.name = "boot",
.offset = (72*SZ_256K),
.size = (30*SZ_256K), //101
},
{
.name = "recovery",
.offset = (102*SZ_256K),
.size = (30*SZ_256K), //131
},
{
.name = "system",
.offset = (132*SZ_256K),
.size = (1000*SZ_256K), //1131
},
{
.name = "cache",
.offset = (1132*SZ_256K),
.size = (277*SZ_256K), //1201
},
{ /* we should consider moving this before the modem at the end
that would allow us to change the partitions before without
loosing ths sensible data*/
.name = "efs",
.offset = (1890*SZ_256K),
.size = (50*SZ_256K), //1939
},
{ /* the modem firmware has to be mtd5 as the userspace samsung ril uses
this device hardcoded, but I placed it at the end of the NAND to be
able to change the other partition layout without moving it */
.name = "radio",
.offset = (1940*SZ_256K),
.size = (64*SZ_256K), //2003
},
{
.name = "datadata",
.offset = (1409*SZ_256K),
.size = (461*SZ_256K), //1889
},
{ /* The reservoir area is used by Samsung's Block Management Layer (BML)
to map good blocks from this reservoir to bad blocks in user
partitions. A special tool (bml_over_mtd) is needed to write
partition images using bad block mapping.
Currently, this is required for flashing the "boot" partition,
as Samsung's stock bootloader expects BML partitions.*/
.name = "reservoir",
.offset = (2004*SZ_256K),
.size = (44*SZ_256K), //2047
},
};
|
/*
* Copyright (C) 2015 TinyCore <http://www.tinycore.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WORLDDATABASE_H
#define _WORLDDATABASE_H
#include "DatabaseWorkerPool.h"
#include "MySQLConnection.h"
class WorldDatabaseConnection : public MySQLConnection
{
public:
//- Constructors for sync and async connections
WorldDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo) { }
WorldDatabaseConnection(ProducerConsumerQueue<SQLOperation*>* q, MySQLConnectionInfo& connInfo) : MySQLConnection(q, connInfo) { }
//- Loads database type specific prepared statements
void DoPrepareStatements() override;
};
typedef DatabaseWorkerPool<WorldDatabaseConnection> WorldDatabaseWorkerPool;
enum WorldDatabaseStatements
{
/* Naming standard for defines:
{DB}_{SEL/INS/UPD/DEL/REP}_{Summary of data changed}
When updating more than one field, consider looking at the calling function
name for a suiting suffix.
*/
WORLD_SEL_QUEST_POOLS,
WORLD_DEL_CRELINKED_RESPAWN,
WORLD_REP_CREATURE_LINKED_RESPAWN,
WORLD_SEL_CREATURE_TEXT,
WORLD_SEL_SMART_SCRIPTS,
WORLD_SEL_SMARTAI_WP,
WORLD_DEL_GAMEOBJECT,
WORLD_DEL_EVENT_GAMEOBJECT,
WORLD_INS_GRAVEYARD_ZONE,
WORLD_DEL_GRAVEYARD_ZONE,
WORLD_INS_GAME_TELE,
WORLD_DEL_GAME_TELE,
WORLD_INS_NPC_VENDOR,
WORLD_DEL_NPC_VENDOR,
WORLD_SEL_NPC_VENDOR_REF,
WORLD_UPD_CREATURE_MOVEMENT_TYPE,
WORLD_UPD_CREATURE_FACTION,
WORLD_UPD_CREATURE_NPCFLAG,
WORLD_UPD_CREATURE_POSITION,
WORLD_UPD_CREATURE_SPAWN_DISTANCE,
WORLD_UPD_CREATURE_SPAWN_TIME_SECS,
WORLD_INS_CREATURE_FORMATION,
WORLD_INS_WAYPOINT_DATA,
WORLD_DEL_WAYPOINT_DATA,
WORLD_UPD_WAYPOINT_DATA_POINT,
WORLD_UPD_WAYPOINT_DATA_POSITION,
WORLD_UPD_WAYPOINT_DATA_WPGUID,
WORLD_UPD_WAYPOINT_DATA_ALL_WPGUID,
WORLD_SEL_WAYPOINT_DATA_MAX_ID,
WORLD_SEL_WAYPOINT_DATA_BY_ID,
WORLD_SEL_WAYPOINT_DATA_POS_BY_ID,
WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID,
WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID,
WORLD_SEL_WAYPOINT_DATA_BY_WPGUID,
WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID,
WORLD_SEL_WAYPOINT_DATA_MAX_POINT,
WORLD_SEL_WAYPOINT_DATA_BY_POS,
WORLD_SEL_WAYPOINT_DATA_WPGUID_BY_ID,
WORLD_SEL_WAYPOINT_DATA_ACTION,
WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID,
WORLD_UPD_CREATURE_ADDON_PATH,
WORLD_INS_CREATURE_ADDON,
WORLD_DEL_CREATURE_ADDON,
WORLD_SEL_CREATURE_ADDON_BY_GUID,
WORLD_INS_WAYPOINT_SCRIPT,
WORLD_DEL_WAYPOINT_SCRIPT,
WORLD_UPD_WAYPOINT_SCRIPT_ID,
WORLD_UPD_WAYPOINT_SCRIPT_X,
WORLD_UPD_WAYPOINT_SCRIPT_Y,
WORLD_UPD_WAYPOINT_SCRIPT_Z,
WORLD_UPD_WAYPOINT_SCRIPT_O,
WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID,
WORLD_DEL_CREATURE,
WORLD_SEL_COMMANDS,
WORLD_SEL_CREATURE_TEMPLATE,
WORLD_SEL_WAYPOINT_SCRIPT_BY_ID,
WORLD_SEL_ITEM_TEMPLATE_BY_NAME,
WORLD_SEL_CREATURE_BY_ID,
WORLD_SEL_GAMEOBJECT_NEAREST,
WORLD_SEL_CREATURE_NEAREST,
WORLD_SEL_GAMEOBJECT_TARGET,
WORLD_INS_CREATURE,
WORLD_DEL_GAME_EVENT_CREATURE,
WORLD_DEL_GAME_EVENT_MODEL_EQUIP,
WORLD_INS_GAMEOBJECT,
WORLD_SEL_DISABLES,
WORLD_INS_DISABLES,
WORLD_DEL_DISABLES,
WORLD_UPD_CREATURE_ZONE_AREA_DATA,
WORLD_UPD_GAMEOBJECT_ZONE_AREA_DATA,
MAX_WORLDDATABASE_STATEMENTS
};
#endif
|
/*
* Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/// \addtogroup mangosd
/// @{
/// \file
#ifndef __CLIRUNNABLE_H
#define __CLIRUNNABLE_H
/// Command Line Interface handling thread
class CliRunnable : public ZThread::Runnable
{
public:
void run();
};
#endif
/// @}
|
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: symbian_string.h,v 1.2 2006/08/23 00:41:11 gashish Exp $
*
* Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the RealNetworks Public
* Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (the "RCSL") available at
* http://www.helixcommunity.org/content/rcsl, in which case the RCSL
* will apply. You may also obtain the license terms directly from
* RealNetworks. You may not use this file except in compliance with
* the RPSL or, if you have a valid RCSL with RealNetworks applicable
* to this file, the RCSL. Please see the applicable RPSL or RCSL for
* the rights, obligations and limitations governing use of the
* contents of the file.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL") in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your version of
* this file only under the terms of the GPL, and not to allow others
* to use your version of this file under the terms of either the RPSL
* or RCSL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient may
* use your version of this file under the terms of any one of the
* RPSL, the RCSL or the GPL.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the
* portions it created.
*
* This file, and the files included with this file, is distributed
* and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
* ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _SYMBIAN_STRINGS_H_
#define _SYMBIAN_STRINGS_H_
#include <e32std.h>
#include <e32base.h>
#include <charconv.h>
#include <utf.h>
#include "hxassert.h"
#include "hxstring.h"
#include "hxbuffer.h"
namespace CHXSymbianString
{
void StringToDes(const CHXString& in, TDes& out);
void DesToString(const TDesC& in, CHXString& out);
CHXString DescToString(const TDesC& in);
CHXString DescToString(const TDesC& desc);
HBufC* StringToHBuf(const CHXString& s);
HBufC* AllocTextL(const CHXString& str);
}
#endif //_SYMBIAN_STRINGS_H_
|
/*
* JFFS2 -- Journalling Flash File System, Version 2.
*
* Copyright (C) 2001, 2002 Red Hat, Inc.
*
* Created by David Woodhouse <dwmw2@cambridge.redhat.com>
*
* For licensing information, see the file 'LICENCE' in the
* jffs2 directory.
*
* $Id: jffs2.h,v 1.25 2002/08/20 21:37:27 dwmw2 Exp $
*
*/
#ifndef __LINUX_JFFS2_H__
#define __LINUX_JFFS2_H__
#define JFFS2_SUPER_MAGIC 0x72b6
/* Values we may expect to find in the 'magic' field */
#define JFFS2_OLD_MAGIC_BITMASK 0x1984
#define JFFS2_MAGIC_BITMASK 0x1985
#define KSAMTIB_CIGAM_2SFFJ 0x5981 /* For detecting wrong-endian fs */
#define JFFS2_EMPTY_BITMASK 0xffff
#define JFFS2_DIRTY_BITMASK 0x0000
/* We only allow a single char for length, and 0xFF is empty flash so
we don't want it confused with a real length. Hence max 254.
*/
#define JFFS2_MAX_NAME_LEN 254
/* How small can we sensibly write nodes? */
#define JFFS2_MIN_DATA_LEN 128
#define JFFS2_COMPR_NONE 0x00
#define JFFS2_COMPR_ZERO 0x01
#define JFFS2_COMPR_RTIME 0x02
#define JFFS2_COMPR_RUBINMIPS 0x03
#define JFFS2_COMPR_COPY 0x04
#define JFFS2_COMPR_DYNRUBIN 0x05
#define JFFS2_COMPR_ZLIB 0x06
/* Compatibility flags. */
#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */
#define JFFS2_NODE_ACCURATE 0x2000
/* INCOMPAT: Fail to mount the filesystem */
#define JFFS2_FEATURE_INCOMPAT 0xc000
/* ROCOMPAT: Mount read-only */
#define JFFS2_FEATURE_ROCOMPAT 0x8000
/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */
#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000
/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */
#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000
#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1)
#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2)
#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4)
// Maybe later...
//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4)
#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at
mount time, don't wait for it to
happen later */
#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific
compression type */
/* These can go once we've made sure we've caught all uses without
byteswapping */
typedef struct {
uint32_t v32;
} __attribute__((packed)) jint32_t;
typedef struct {
uint16_t v16;
} __attribute__((packed)) jint16_t;
#define JFFS2_NATIVE_ENDIAN
#if defined(JFFS2_NATIVE_ENDIAN)
#define cpu_to_je16(x) ((jint16_t){x})
#define cpu_to_je32(x) ((jint32_t){x})
#define je16_to_cpu(x) ((x).v16)
#define je32_to_cpu(x) ((x).v32)
#elif defined(JFFS2_BIG_ENDIAN)
#define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)})
#define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)})
#define je16_to_cpu(x) (be16_to_cpu(x.v16))
#define je32_to_cpu(x) (be32_to_cpu(x.v32))
#elif defined(JFFS2_LITTLE_ENDIAN)
#define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)})
#define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
#define je16_to_cpu(x) (le16_to_cpu(x.v16))
#define je32_to_cpu(x) (le32_to_cpu(x.v32))
#else
#error wibble
#endif
struct jffs2_unknown_node
{
/* All start like this */
jint16_t magic;
jint16_t nodetype;
jint32_t totlen; /* So we can skip over nodes we don't grok */
jint32_t hdr_crc;
} __attribute__((packed));
struct jffs2_raw_dirent
{
jint16_t magic;
jint16_t nodetype; /* == JFFS_NODETYPE_DIRENT */
jint32_t totlen;
jint32_t hdr_crc;
jint32_t pino;
jint32_t version;
jint32_t ino; /* == zero for unlink */
jint32_t mctime;
uint8_t nsize;
uint8_t type;
uint8_t unused[2];
jint32_t node_crc;
jint32_t name_crc;
uint8_t name[0];
} __attribute__((packed));
/* The JFFS2 raw inode structure: Used for storage on physical media. */
/* The uid, gid, atime, mtime and ctime members could be longer, but
are left like this for space efficiency. If and when people decide
they really need them extended, it's simple enough to add support for
a new type of raw node.
*/
struct jffs2_raw_inode
{
jint16_t magic; /* A constant magic number. */
jint16_t nodetype; /* == JFFS_NODETYPE_INODE */
jint32_t totlen; /* Total length of this node (inc data, etc.) */
jint32_t hdr_crc;
jint32_t ino; /* Inode number. */
jint32_t version; /* Version number. */
jint32_t mode; /* The file's type or mode. */
jint16_t uid; /* The file's owner. */
jint16_t gid; /* The file's group. */
jint32_t isize; /* Total resultant size of this inode (used for truncations) */
jint32_t atime; /* Last access time. */
jint32_t mtime; /* Last modification time. */
jint32_t ctime; /* Change time. */
jint32_t offset; /* Where to begin to write. */
jint32_t csize; /* (Compressed) data size */
jint32_t dsize; /* Size of the node's data. (after decompression) */
uint8_t compr; /* Compression algorithm used */
uint8_t usercompr; /* Compression algorithm requested by the user */
jint16_t flags; /* See JFFS2_INO_FLAG_* */
jint32_t data_crc; /* CRC for the (compressed) data. */
jint32_t node_crc; /* CRC for the raw inode (excluding data) */
// uint8_t data[dsize];
} __attribute__((packed));
union jffs2_node_union {
struct jffs2_raw_inode i;
struct jffs2_raw_dirent d;
struct jffs2_unknown_node u;
};
#endif /* __LINUX_JFFS2_H__ */
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2012 by Dominik Riebeling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef TTSSAPI4_H
#define TTSSAPI4_H
#include "ttsbase.h"
#include "ttssapi.h"
class TTSSapi4: public TTSSapi
{
Q_OBJECT
public:
TTSSapi4(QObject* parent=NULL) : TTSSapi(parent)
{
m_TTSTemplate = "cscript //nologo \"%exe\" "
"/language:%lang /voice:\"%voice\" "
"/speed:%speed \"%options\" /sapi4";
m_TTSVoiceTemplate = "cscript //nologo \"%exe\" "
"/language:%lang /listvoices /sapi4";
m_TTSType = "sapi4";
}
};
#endif
|
#ifndef _OS_SELECT_H_
#define _OS_SELECT_H_ 1
/*
* Overlay the system select call to handle many more FD's than
* an fd_set can hold.
* David McCullough <david_mccullough@securecomputing.com>
*/
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
/*
* allow build system to override the limit easily
*/
#ifndef OS_FD_SETSIZE
#define OS_FD_SETSIZE 8192
#endif
#define OS_NFDBITS (8 * sizeof (long int))
#define OS_FDELT(d) ((d) / OS_NFDBITS)
#define OS_FDMASK(d) ((long int) 1 << ((d) % OS_NFDBITS))
#define OS_FD_SETCOUNT ((OS_FD_SETSIZE + OS_NFDBITS - 1) / OS_NFDBITS)
typedef struct {
long int __osfds_bits[OS_FD_SETCOUNT];
} os_fd_set;
#define OS_FDS_BITS(set) ((set)->__osfds_bits)
#define OS_FD_ZERO(set) \
do { \
unsigned int __i; \
os_fd_set *__arr = (set); \
for (__i = 0; __i < OS_FD_SETCOUNT; __i++) \
OS_FDS_BITS (__arr)[__i] = 0; \
} while(0)
#define OS_FD_SET(d, s) (OS_FDS_BITS (s)[OS_FDELT(d)] |= OS_FDMASK(d))
#define OS_FD_CLR(d, s) (OS_FDS_BITS (s)[OS_FDELT(d)] &= ~OS_FDMASK(d))
#define OS_FD_ISSET(d, s) ((OS_FDS_BITS (s)[OS_FDELT(d)] & OS_FDMASK(d)) != 0)
#define os_select(max, r, f, e, t) \
select(max, (fd_set *)(r), (fd_set *)(f), (fd_set *)(e), t)
#endif /* _OS_SELECT_H_ */
|
/*
Copyright (C) 2002 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_dialog_h__
#define __ardour_dialog_h__
#include <gtkmm/window.h>
#include <gtkmm/dialog.h>
#include "ardour/session_handle.h"
namespace WM {
class ProxyTemporary;
}
/*
* This virtual parent class is so that each dialog box uses the
* same mechanism to declare its closing. It shares a common
* method of connecting and disconnecting from a Session with
* all other objects that have a handle on a Session.
*/
class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
{
public:
ArdourDialog (std::string title, bool modal = false, bool use_separator = false);
ArdourDialog (Gtk::Window& parent, std::string title, bool modal = false, bool use_separator = false);
~ArdourDialog();
bool on_focus_in_event (GdkEventFocus*);
bool on_focus_out_event (GdkEventFocus*);
bool on_delete_event (GdkEventAny*);
void on_unmap ();
void on_show ();
virtual void on_response (int);
protected:
void pop_splash ();
void close_self ();
private:
WM::ProxyTemporary* proxy;
bool _splash_pushed;
void init ();
static sigc::signal<void> CloseAllDialogs;
};
#endif // __ardour_dialog_h__
|
/**
eMail is a command line SMTP client.
Copyright (C) 2001 - 2008 email by Dean Jones
Software supplied and written by http://deanproxy.com/
This file is part of eMail.
eMail 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.
eMail 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 eMail; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/
#ifndef PROGRESS_H
#define PROGRESS_H 1
struct prbar {
short error;
short bar_size;
short percent;
int progress;
int truncated_file_size;
int actual_file_size;
int curr_size;
char *subject;
char *size_type;
char *buf;
};
struct prbar *prbarInit(size_t bytes);
void prbarPrint(size_t bytes, struct prbar *bar);
void prbarDestroy(struct prbar *bar);
#endif /* PROGRESS_H */
|
// rddb.h
//
// Database driver with automatic reconnect
//
// (C) Copyright 2007 Dan Mills <dmills@exponent.myzen.co.uk>
//
// $Id: rddb.h,v 1.4 2008/03/28 20:00:05 fredg Exp $
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDDB_INC
#define RDDB_INC
#include <sys/types.h>
#include <qobject.h>
#include <qsqldatabase.h>
#include <qstring.h>
#include <rdconfig.h>
class RDSqlDatabaseStatus : public QObject
{
Q_OBJECT
signals:
void logText(RDConfig::LogPriority prio,const QString &msg);
void reconnected();
void connectionFailed ();
private:
RDSqlDatabaseStatus ();
bool discon;
friend RDSqlDatabaseStatus * RDDbStatus();
public:
void sendRecon();
void sendDiscon(QString query);
};
class RDSqlQuery : public QSqlQuery
{
public:
RDSqlQuery ( const QString & query = QString::null, QSqlDatabase * db = 0 );
};
// Setup the default database, returns true on success.
// if error is non NULL, an error string will be appended to it
// if there is a problem.
QSqlDatabase * RDInitDb (QString *error=NULL);
// Return a handle to the database status object.
RDSqlDatabaseStatus * RDDbStatus();
#endif
|
#ifndef POLARSSL_DH_H
#define POLARSSL_DH_H
/* for size_t */
#include <stdlib.h>
typedef enum {
POLARSSL_DH_NONE=0,
POLARSSL_DH_DHM,
POLARSSL_DH_EC, /* Need to specify which curve to use */
NACL_DH_CV25519,
POLARSSL_DH_LWE,
} dh_type_t;
typedef struct {
dh_type_t type;
const char *name;
void *(*ctx_alloc)( void );
void (*ctx_free)( void *ctx );
int (*gen_public)( void *ctx, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
int (*compute_shared)( void *ctx, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
int (*set_params)( void *ctx, const void *params );
int (*read_ske_params)( void *ctx, int *rlen, const unsigned char *buf, size_t blen );
int (*read_public)( void *ctx, const unsigned char *buf, size_t blen );
/* A "pk_ctx" represents an interface with a certificate
* which is initialized in pk_parse_subpubkey() in library/pkparse.c */
int (*read_from_self_pk_ctx)( void *ctx, const void *pk_ctx );
int (*read_from_peer_pk_ctx)( void *ctx, const void *pk_ctx );
size_t (*getsize_ske_params)( const void *ctx );
int (*write_ske_params)( size_t *olen, unsigned char *buf, size_t blen, const void *ctx );
size_t (*getsize_public)( const void *ctx );
int (*write_public)( size_t *olen, unsigned char *buf, size_t blen, const void *ctx );
size_t (*getsize_premaster)( const void *ctx );
int (*write_premaster)( size_t *olen, unsigned char *buf, size_t blen, const void *ctx );
} dh_info2_t;
typedef struct {
const dh_info2_t *dh_info;
void *dh_ctx;
} dh_context2_t;
const dh_info2_t * dh_get_info( dh_type_t type );
/* have to move to ssl layer later */
#include "polarssl/ssl_ciphersuites.h"
#endif
|
/*
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
* ircd_signal.h: A header for ircd signals.
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
*
* 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
*
* $Id: ircd_signal.h,v 1.1.1.1 2002/12/31 04:07:25 demond Exp $
*/
#ifndef INCLUDED_ircd_signal_h
#define INCLUDED_ircd_signal_h
extern void setup_signals(void);
#endif /* INCLUDED_ircd_signal_h */
|
#pragma once
#include "stdafx.h"
class CSymbol;
typedef enum {
SYM_INVALID = -1,
SYM_CODE,
SYM_DATA,
SYM_U8,
SYM_U16,
SYM_U32,
SYM_U64,
SYM_S8,
SYM_S16,
SYM_S32,
SYM_S64,
SYM_FLOAT,
SYM_DOUBLE,
SYM_VECTOR2,
SYM_VECTOR3,
SYM_VECTOR4,
NUM_SYM_TYPES
} symbol_type_id_t;
typedef struct
{
symbol_type_id_t id;
const char* name;
int size;
} symbol_type_info_t;
typedef enum {
ERR_SUCCESS,
ERR_INVALID_TYPE,
ERR_INVALID_ADDR,
ERR_INVALID_NAME,
ERR_MISSING_FIELDS,
} symbol_parse_error_t;
class CSymbolTable
{
public:
CSymbolTable(CDebuggerUI* debugger);
~CSymbolTable();
private:
CSymbolTable();
CDebuggerUI* m_Debugger;
CriticalSection m_CS;
std::vector<CSymbol> m_Symbols;
int m_NextSymbolId;
CFile m_SymFileHandle;
char* m_SymFileBuffer;
size_t m_SymFileSize;
char* m_ParserToken;
size_t m_ParserTokenLength;
char* m_TokPos;
char m_ParserDelimeter;
char* m_SymFileParseBuffer;
bool m_bHaveFirstToken;
void ParserFetchToken(const char* delim);
public:
static symbol_type_info_t m_SymbolTypes[];
static const char* GetTypeName(int typeId);
static int GetTypeSize(int typeId);
static symbol_type_id_t GetTypeId(char* typeName);
static bool CmpSymbolAddresses(CSymbol& a, CSymbol& b);
void GetValueString(char* dst, CSymbol* symbol);
CPath GetSymFilePath();
void Load();
void Save();
void ParseErrorAlert(char* message, int lineNumber);
void AddSymbol(int type, uint32_t address, const char* name, const char* description = NULL);
void Reset();
int GetCount();
bool GetSymbolById(int id, CSymbol* symbol);
bool GetSymbolByIndex(size_t index, CSymbol* symbol);
bool GetSymbolByAddress(uint32_t address, CSymbol* symbol);
bool GetSymbolByOverlappedAddress(uint32_t address, CSymbol* symbol);
bool RemoveSymbolById(int id);
};
class CSymbol {
public:
int m_Id;
int m_Type;
uint32_t m_Address;
char* m_Name;
char* m_Description;
CSymbol() :
m_Id(0),
m_Type(SYM_INVALID),
m_Address(0),
m_Name(NULL),
m_Description(NULL)
{
}
CSymbol(int id, int type, uint32_t address, const char* name, const char* description) :
m_Id(id),
m_Type(type),
m_Address(address),
m_Name(NULL),
m_Description(NULL)
{
if (name != NULL)
{
m_Name = _strdup(name);
}
if (description != NULL)
{
m_Description = _strdup(description);
}
}
CSymbol(const CSymbol& symbol):
m_Id(symbol.m_Id),
m_Type(symbol.m_Type),
m_Address(symbol.m_Address),
m_Name(NULL),
m_Description(NULL)
{
m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : NULL;
m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : NULL;
}
CSymbol& operator= (const CSymbol& symbol)
{
if (m_Name != NULL)
{
free(m_Name);
}
if (m_Description != NULL)
{
free(m_Description);
}
m_Id = symbol.m_Id;
m_Type = symbol.m_Type;
m_Address = symbol.m_Address;
m_Name = symbol.m_Name ? _strdup(symbol.m_Name) : NULL;
m_Description = symbol.m_Description ? _strdup(symbol.m_Description) : NULL;
return *this;
}
~CSymbol()
{
if (m_Name != NULL)
{
free(m_Name);
}
if (m_Description != NULL)
{
free(m_Description);
}
}
const char* TypeName()
{
return CSymbolTable::GetTypeName(m_Type);
}
int TypeSize()
{
return CSymbolTable::GetTypeSize(m_Type);
}
};
|
#ifndef __AQUA__INT_IDT_H
#define __AQUA__INT_IDT_H
#include "../types.h"
#include "../common/print.h"
#include "../common/system.h"
#include "../memory/memset.h"
struct idt_entry_t {
uint16_t offset_low;
uint16_t selector;
uint8_t zero;
uint8_t attrs;
uint16_t offset_high;
} __attribute__((packed));
struct idt_pointer_t {
uint16_t size;
uint32_t offset;
} __attribute__((packed));
extern void idt_load(void);
void set_idt_gate(uint8_t num, uint32_t loc);
void register_idt(void);
void set_idt_flags(uint8_t _flags);
struct idt_entry_t get_entry(int num);
#endif
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-network.h"
bool network_is_online(void);
|
//
// gmrf.h
// physher
//
// Created by Mathieu Fourment on 18/03/2019.
// Copyright © 2019 Mathieu Fourment. All rights reserved.
//
#ifndef gmrf_h
#define gmrf_h
#include <stdio.h>
#include "hashtable.h"
#include "mjson.h"
#include "parameters.h"
Model* new_GMRFModel_from_json(json_node* node, Hashtable* hash);
#endif /* gmrf_h */
|
/*
* For small machines it's cheaper to simply allocate banks in the size
* needed for the largest swapout of the application as that'll be under
* 64K. For split I/D we can allocate pairs of swap banks.
*
* It's possible to be a lot smarter about this and for 32bit systems
* it becomes a necessity not to use this simple swap logic.
*/
#include <kernel.h>
#include <kdata.h>
#include <printf.h>
#undef DEBUG
#ifdef SWAPDEV
uint16_t swappage; /* Target page */
/* Table of available maps */
static uint8_t swapmap[MAX_SWAPS];
static uint8_t swapptr = 0;
static char maxswap[] = PANIC_MAXSWAP;
void swapmap_add(uint8_t swap)
{
if (swapptr == MAX_SWAPS)
panic(maxswap);
swapmap[swapptr++] = swap;
sysinfo.swapusedk -= SWAP_SIZE / 2;
}
int swapmap_alloc(void)
{
if (swapptr) {
sysinfo.swapusedk += SWAP_SIZE / 2;
return swapmap[--swapptr];
}
else
return 0;
}
void swapmap_init(uint8_t swap)
{
if (swapptr == MAX_SWAPS)
panic(maxswap);
swapmap[swapptr++] = swap;
sysinfo.swapk += SWAP_SIZE / 2;
}
/* We can re-use udata.u_block and friends as we can never be swapped while
we are in the middle of an I/O (at least for now). If we rework the kernel
for sleepable I/O this will change */
int swapread(uint16_t dev, blkno_t blkno, usize_t nbytes,
uaddr_t buf, uint16_t page)
{
udata.u_dptr = swap_map(buf);
udata.u_block = blkno;
if (nbytes & BLKMASK)
panic("swprd");
udata.u_nblock = nbytes >> BLKSHIFT;
swappage = page;
return ((*dev_tab[major(dev)].dev_read) (minor(dev), 2, 0));
}
int swapwrite(uint16_t dev, blkno_t blkno, usize_t nbytes,
uaddr_t buf, uint16_t page)
{
/* FIXME: duplication here */
udata.u_dptr = swap_map(buf);
udata.u_block = blkno;
if (nbytes & BLKMASK)
panic("swpwr");
udata.u_nblock = nbytes >> BLKSHIFT;
swappage = page;
return ((*dev_tab[major(dev)].dev_write) (minor(dev), 2, 0));
}
/*
* Swap out process. As we have them all the same size we ignore
* p for now. For a single memory image system most of this can go!
*/
static ptptr swapvictim(ptptr p, int notself)
{
#ifdef CONFIG_MULTI
ptptr c;
ptptr r = NULL;
ptptr f = NULL;
uint16_t sc = 0;
uint16_t s;
extern ptptr getproc_nextp; /* Eww.. */
c = getproc_nextp;
do {
if (c->p_page) { /* No point swapping someone in swap! */
/* Find the last entry before us */
if (c->p_status == P_READY)
r = c;
if (c->p_status > P_READY
&& c->p_status <= P_FORKING) {
/* relative position in order of waits, bigger is longer, can wrap but
shouldn't really matter to us much if it does */
s = (waitno - c->p_waitno);
if (s >= sc) {
sc = s;
f = c;
}
}
}
c++;
if (c == ptab_end)
c = ptab;
}
while (c != getproc_nextp);
/* Oldest waiter gets the boot */
if (f) {
#ifdef DEBUG
kprintf("swapvictim %x (page %d, state %d\n)", f,
f->p_page, f->p_status);
#endif
return f;
}
/* No waiters.. the scheduler cycles so we will be the last to run
again, failing that the one before us that was ready */
if (notself == 0)
return udata.u_ptab;
return r;
#else
used(p);
if (notself)
panic(PANIC_NOTSELF);
return udata.u_ptab;
#endif
}
ptptr swapneeded(ptptr p, int notself)
{
ptptr n = swapvictim(p, notself);
if (n)
if (swapout(n))
n = NULL;
return n;
}
void swapper2(ptptr p, uint16_t map)
{
#ifdef DEBUG
kprintf("Swapping in %p (page %d), utab.ptab %p\n", p, p->p_page,
udata.u_ptab);
#endif
swapin(p, map);
swapmap_add(map);
#ifdef DEBUG
kprintf("Swapped in %p (page %d), udata.ptab %p\n",
p, p->p_page, udata.u_ptab);
#endif
}
/*
* Called from switchin when we discover that we want to run
* a swapped process. We let pagemap_alloc cause any needed swap
* out of idle processes.
*/
void swapper(ptptr p)
{
uint16_t map = p->p_page2;
pagemap_alloc(p); /* May cause a swapout. May also destroy
the old value of p->page2 */
swapper2(p, map);
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.