text stringlengths 4 6.14k |
|---|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <OfficeImport/OADGraphic.h>
@class OADMovie, OADOle, OADShapeGeometry;
// Not exported
@interface OADImage : OADGraphic
{
OADShapeGeometry *mGeometry;
OADOle *mOle;
OADMovie *mMovie;
}
- (void)createPictureFramePresetGeometry;
- (id)createImageFill;
- (void)setParentTextListStyle:(id)arg1;
- (void)setMovie:(id)arg1;
- (id)movie;
- (void)setOle:(id)arg1;
- (id)ole;
- (void)setGeometry:(id)arg1;
- (id)geometry;
- (id)imageProperties;
- (id)initWithBlipRef:(id)arg1;
- (void)dealloc;
- (id)init;
@end
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.13.2\Source\Uno\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#ifndef __APP_UNO_ACTION__UNO_TIME_TEXT_LOCAL_DATE_PATTERN_LOCAL_DATE_BUCKET__CHAR_H__
#define __APP_UNO_ACTION__UNO_TIME_TEXT_LOCAL_DATE_PATTERN_LOCAL_DATE_BUCKET__CHAR_H__
#include <app/Uno.Delegate.h>
#include <Uno.h>
namespace app {
namespace Uno {
::uDelegateType* Action__Uno_Time_Text_LocalDatePattern_LocalDateBucket__char__typeof();
}}
#endif
|
//
// Artnet.h:
//
#ifndef _ARTNET_H_
#define _ARTNET_H_
#include "Util/Misc.h"
#include "Util/TypeConversion.h"
struct ArtnetPacketHeader;
struct ArtPollPacket;
struct ArtPollReplyPacket;
struct ArtnetDmxPacket;
struct ArtnetDevice;
#include "ArtnetConstants.h"
#include "ArtnetPacketHeader.h"
#include "ArtnetPollPacket.h"
#include "ArtnetPollReplyPacket.h"
#include "ArtnetDmxPacket.h"
#include "ArtnetDevice.h"
#endif
|
//
// RKProjectTests.h
// RequirementsKit
//
// Created by Max Woolf on 04/08/2013.
// Copyright (c) 2013 GatherRequirements. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface RKProjectTests : SenTestCase
@end
|
// Copyright 2016 Shin'ichi Ichikawa. Released under the MIT license.
#include <UDK.h>
#include <Base.h>
#include <Guid/Acpi.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/Bmp.h>
#include <Protocol/GraphicsOutput.h>
#include "tp_draw_logo.h"
#include "tp_uefi_memory.h"
static EFI_ACPI_5_1_ROOT_SYSTEM_DESCRIPTION_POINTER* acpi_rsdp = NULL;
// Boot Graphics Resource Table(BGRT)
static EFI_ACPI_5_1_BOOT_GRAPHICS_RESOURCE_TABLE* acpi_bgrt = NULL;
static void tp_get_bgrt(UINT8* table);
static void tp_draw_logo2(EFI_GRAPHICS_OUTPUT_PROTOCOL* gop);
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL* conv_bitmap(UINTN* bitmap_width, UINTN* bitmap_height);
void tp_draw_logo(EFI_GRAPHICS_OUTPUT_PROTOCOL* gop)
{
if (NULL == gop){
return;
}
acpi_bgrt = NULL;
for (UINTN i = 0; gST->NumberOfTableEntries > i; ++i){
EFI_GUID* guid = &(gST->ConfigurationTable[i].VendorGuid);
UINT8* table = (UINT8*)(gST->ConfigurationTable[i].VendorTable);
if (0 == CompareMem(guid, &gEfiAcpiTableGuid, sizeof(EFI_GUID))){
tp_get_bgrt(table);
if (NULL == acpi_bgrt){
return;
}
tp_draw_logo2(gop);
break;
}
}
}
static void tp_get_bgrt(UINT8* table)
{
if (NULL == table){
return;
}
acpi_rsdp = (EFI_ACPI_5_1_ROOT_SYSTEM_DESCRIPTION_POINTER*)table;
EFI_ACPI_DESCRIPTION_HEADER* acpi_header = (EFI_ACPI_DESCRIPTION_HEADER*)(acpi_rsdp->XsdtAddress);
if (acpi_header){
UINTN size = (acpi_header->Length - sizeof(*acpi_header)) / sizeof(void*);
++acpi_header;
EFI_ACPI_DESCRIPTION_HEADER** header = (EFI_ACPI_DESCRIPTION_HEADER**)acpi_header;
for (UINTN j = 0; size > j; ++j){
if (EFI_ACPI_5_1_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE == header[j]->Signature){
acpi_bgrt = (EFI_ACPI_5_1_BOOT_GRAPHICS_RESOURCE_TABLE*)header[j];
if (EFI_ACPI_5_1_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION != acpi_bgrt->Header.Revision){
acpi_bgrt = NULL;
break;
}
if (EFI_ACPI_5_1_BGRT_VERSION != acpi_bgrt->Version){
acpi_bgrt = NULL;
break;
}
if (EFI_ACPI_5_1_BGRT_IMAGE_TYPE_BMP != acpi_bgrt->ImageType){
acpi_bgrt = NULL;
break;
}
break;
}
}
}
}
void tp_draw_logo2(EFI_GRAPHICS_OUTPUT_PROTOCOL* gop)
{
if ((NULL == gop) || (NULL == acpi_bgrt)){
return;
}
UINTN bitmap_width = 0;
UINTN bitmap_height = 0;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* p = conv_bitmap(&bitmap_width, &bitmap_height);
if (NULL == p){
return;
}
EFI_STATUS status = gop->Blt(
gop, p,
EfiBltBufferToVideo,
0, 0,
acpi_bgrt->ImageOffsetX, acpi_bgrt->ImageOffsetY,
bitmap_width, bitmap_height,
bitmap_width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
);
FreePool(p);
p = NULL;
if (EFI_ERROR(status)){
return;
}
}
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL* conv_bitmap(UINTN* bitmap_width, UINTN* bitmap_height)
{
if ((NULL == acpi_bgrt) || (NULL == bitmap_width) || (NULL == bitmap_height)){
return NULL;
}
BMP_IMAGE_HEADER* bmp = (BMP_IMAGE_HEADER*)acpi_bgrt->ImageAddress;
if (NULL == bmp){
return NULL;
}
if (('B' != bmp->CharB) || ('M' != bmp->CharM)){
return NULL;
}
if (bmp->HeaderSize != (sizeof(BMP_IMAGE_HEADER) - OFFSET_OF(BMP_IMAGE_HEADER, HeaderSize))){
return NULL;
}
if (bmp->Size < bmp->ImageOffset){
return NULL;
}
if (1 != bmp->Planes){
return NULL;
}
if (24 != bmp->BitPerPixel){
return NULL;
}
if (0 != bmp->CompressionType){
return NULL;
}
UINT8* image_header = (UINT8*)acpi_bgrt->ImageAddress;
UINT8* image = image_header + bmp->ImageOffset;
UINTN width = bmp->PixelWidth;
UINTN height = bmp->PixelHeight;
*bitmap_width = width;
*bitmap_height = height;
UINTN num = width * height;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* p = AllocateZeroPool(num * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
if (NULL == p){
return NULL;
}
for (UINTN i = 0; i < height; ++i){
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* q = &p[(height - i - 1) * width];
for (UINTN j = 0; j < width; ++j){
q->Green = *image;
++image;
q->Red = *image;
++image;
q->Blue = *image;
++image;
// q->Reserved;
++q;
}
UINTN image_index = (UINTN)(image - image_header);
if (image_index % 4){
image = image + (4 - (image_index % 4));
}
}
return p;
}
|
#ifndef _ROSEX_LOOPDEPGRAPH_P_H
#define _ROSEX_LOOPDEPGRAPH_P_H
// loopdepgraph_p.h
// 4/16/2014 jichi
#include "rosex/depgraph_p.h"
//#include <LoopTreeDepComp.h>
#include <TransDepGraph.h>
#include <TransDepGraphImpl.h>
class LoopDepGraphPrivate
{
public:
typedef TransDepGraphCreate<DepGraphNode> Graph;
Graph *graph;
LoopDepGraphPrivate() : graph(nullptr) {}
~LoopDepGraphPrivate() { clear(); }
void clear() { if (graph) { delete graph; graph = nullptr; } }
};
#endif // _ROSEX_LOOPDEPGRAPH_P_H
|
/*
* File : time.c
* This file is part of POSIX-RTOS
* COPYRIGHT (C) 2015 - 2016, DongHeng
*
* Change Logs:
* DATA Author Note
* 2015-12-11 DongHeng create
*/
#include "time.h"
#include "stdlib.h"
#include "string.h"
#include "list.h"
#include "semaphore.h"
#include "debug.h"
#include "pthread.h"
#include "sched.h"
#define TIMER_THREAD_STACK_SIZE 512U
#define TIME_DEBUG_LEVEL 10
#if TIME_DEBUG_LEVEL && TIME_DEBUG_LEVEL < 10
#define TIME_DEBUG(level, x) \
{ \
if (level >= TIME_DEBUG_LEVEL) \
printk x; \
}
static volatile int time_trace;
#else
#define TIME_DEBUG(level, x)
#endif
#define ITIMERSPECT_COPY(form, to) \
(form)->it_interval.tv_nsec = (to)->it_interval.tv_nsec; \
(form)->it_interval.tv_sec = (to)->it_interval.tv_sec; \
(form)->it_value.tv_nsec = (to)->it_value.tv_nsec; \
(form)->it_value.tv_sec = (to)->it_value.tv_sec; \
struct __timer
{
/* timer's node list */
list_t list;
/* timer's source clock */
clockid_t clockid;
/* timer's time plan */
struct itimerspect itimerspect;
/* timer's signal trigger */
struct sigevent igevent;
};
static list_t timer_list;
static sem_t timer_sem;
static os_u64 local_time;
INLINE timer_t __timer_create(clockid_t clockid,
struct sigevent *RESTRICT evp)
{
struct __timer *timer;
phys_reg_t temp;
if (!(timer = malloc(sizeof(struct __timer))))
return 0;
memcpy(&timer->igevent, evp, sizeof(struct sigevent));
timer->clockid = clockid;
list_init(&timer->list);
/* suspend the hardware interrupt for the preparing for context switching */
temp = hw_interrupt_suspend();
list_insert_tail(&timer_list, &timer->list);
hw_interrupt_recover(temp);
return (timer_t)timer;
}
int timer_create (clockid_t clockid, struct sigevent *RESTRICT evp, timer_t *RESTRICT timerid)
{
*timerid = 0;
if (CLOCK_REALTIME != clockid)
return -EINVAL;
if (!evp)
return -EINVAL;
switch (evp->sigev_notify)
{
case SIGEV_THREAD:
*timerid = __timer_create(clockid, evp);
break;
default:
break;
}
return 0;
}
int timer_settime (timer_t timerid,
int flags,
const struct itimerspect *value,
struct itimerspect *ovalue)
{
struct __timer *timer = (struct __timer *)timerid;
phys_reg_t temp;
if (!timerid || !value)
return -EINVAL;
/* suspend the hardware interrupt for the preparing for context switching */
temp = hw_interrupt_suspend();
if (ovalue)
ITIMERSPECT_COPY(ovalue, &timer->itimerspect);
ITIMERSPECT_COPY(&timer->itimerspect, value);
hw_interrupt_recover(temp);
return 0;
}
int clock_settime (clockid_t, const struct timespec *);
int timer_gettime (timer_t timerid, struct itimerspect *value)
{
return 0;
}
int timer_delete (timer_t timerid)
{
return 0;
}
/******************************************************************************/
static void* timer_thread_entry(void *p)
{
struct __timer *timer;
while (1)
{
sem_wait(&timer_sem);
LIST_FOR_EACH_ENTRY(timer,
&timer_list,
struct __timer,
list)
{
if (timer->itimerspect.it_value.tv_nsec > 0)
{
timer->itimerspect.it_value.tv_nsec -= RTOS_SYS_TICK_PERIOD;
if (!timer->itimerspect.it_value.tv_nsec)
{
timer->igevent.sigev_notify_function(timer->igevent.sigev_value);
if (timer->itimerspect.it_interval.tv_nsec)
timer->itimerspect.it_value.tv_nsec = timer->itimerspect.it_interval.tv_nsec;
}
}
}
}
}
int timer_init(void)
{
int err;
int tid;
pthread_attr_t attr;
sched_param_t timer_sched_param =
SCHED_PARAM_INIT(PTHREAD_TYPE_KERNEL,
PTHREAD_TICKS_MIN,
PTHREAD_PRIORITY_MAX);
pthread_attr_setschedparam(&attr, &timer_sched_param);
pthread_attr_setstacksize(&attr, TIMER_THREAD_STACK_SIZE);
err = pthread_create(&tid,
&attr,
timer_thread_entry,
NULL);
ASSERT_KERNEL(!err);
pthread_setname_np(tid, "timer");
list_init(&timer_list);
sem_init(&timer_sem, 0, 1);
return 0;
}
void os_timetick(void)
{
extern void sched_proc(void);
sched_proc();
sem_post(&timer_sem);
local_time += RTOS_SYS_TICK_PERIOD;
}
struct tm *localtime_r(const time_t *time, struct tm *RESTRICT result)
{
os_u64 temp;
result->tm_ms = local_time % 1000;
temp = local_time / 1000;
result->tm_sec = temp % 60;
temp = temp / 60;
result->tm_min = temp % 60;
temp = temp / 60;
result->tm_hour = temp % 24;
temp = temp / 24;
result->tm_wday = temp % 365;
return result;
}
|
/**
* The MIT License (MIT)
*
* Copyright (c) 2014 Kyle Hollins Wray, University of Massachusetts
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SAS_REWARDS_ARRAY_H
#define SAS_REWARDS_ARRAY_H
#include "sas_rewards.h"
#include "../states/state.h"
#include "../actions/action.h"
/**
* A class for state-action-state rewards in an MDP-like object, internally storing the
* rewards as an array.
*/
class SASRewardsArray : virtual public SASRewards {
public:
/**
* The default constructor for the SASRewardsArray class. This requires the number of states,
* actions, and observations.
* @param numStates The number of states.
* @param numActions The number of actions.
*/
SASRewardsArray(unsigned int numStates, unsigned int numActions);
/**
* The default deconstructor for the SASRewardsArray class.
*/
virtual ~SASRewardsArray();
/**
* Set a state transition from a particular state-action-state triple to a probability.
* @param state The current state of the system.
* @param action The action taken in the current state.
* @param nextState The next state with which we assign the reward.
* @param reward The reward from the provided state-action-state triple.
*/
virtual void set(State *state, Action *action, State *nextState, double reward);
/**
* Set a state transition from a particular state-action-state-observation quadruple to a probability.
* @param state The current state of the system.
* @param action The action taken in the current state.
* @param nextState The next state with which we assign the reward.
* @param observation The observation made at the next state.
* @param reward The reward from the provided state-action-state-observation quadruple.
*/
virtual void set(State *state, Action *action, State *nextState,
Observation *observation, double reward);
/**
* The probability of a transition following the state-action-state triple provided.
* @param state The current state of the system.
* @param action The action taken at the current state.
* @param nextState The next state with which we assign the reward.
* @return The reward from taking the given action in the given state.
*/
virtual double get(State *state, Action *action, State *nextState);
/**
* The probability of a transition following the state-action-state-observation quadruple provided.
* @param state The current state of the system.
* @param action The action taken in the current state.
* @param nextState The next state with which we assign the reward.
* @param observation The observation made at the next state.
* @return The reward from taking the given action in the given state.
*/
virtual double get(State *state, Action *action, State *nextState,
Observation *observation);
/**
* Set the entire 3-dimensional array with the one provided. This only performs a copy.
* @param R A pointer to the new 3-d array of raw rewards data. This must be
* an array of size n x m x n.
*/
virtual void set_rewards(const float *R);
/**
* Get the memory location of the 3-dimensional array.
* @return A pointer to the raw rewards data.
*/
virtual float *get_rewards();
/**
* Get the number of states used for the rewards array.
* @return The number of states.
*/
virtual unsigned int get_num_states() const;
/**
* Get the number of actions used for the rewards array.
* @return The number of actions.
*/
virtual unsigned int get_num_actions() const;
/**
* Get the minimal R-value.
* @return The minimal R-value.
*/
virtual double get_min() const;
/**
* Get the maximal R-value.
* @return The maximal R-value.
*/
virtual double get_max() const;
/**
* Reset the rewards, clearing the internal mapping.
*/
virtual void reset();
private:
/**
* The 3-dimensional array mapping state-action-state to floats. Floats were
* used to improve speed.
*/
float *rewards;
/**
* The number of states, which is the first and third dimension of the rewards array.
*/
unsigned int states;
/**
* The number of actions, which is the second dimension of the rewards array.
*/
unsigned int actions;
/**
* The minimum R-value.
*/
double Rmin;
/**
* The maximum R-value.
*/
double Rmax;
};
#endif // SAS_REWARDS_ARRAY_H
|
#include <stdio.h>
int main() {
printf("hello, world!\n");
return 0;
}
|
//
// ViewController.h
// YSAccountStore
//
// Created by Yu Sugawara on 2014/01/20.
// Copyright (c) 2014年 Yu Sugawara. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UITableViewController
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@class NSString;
@interface XCRefactoringExtractParameter : NSObject
{
struct _NSRange _keywordRange;
NSString *_keyword;
struct _NSRange _typeStringRange;
struct _NSRange _typeStringRange2;
NSString *_typeCastString;
struct _NSRange _nameRange;
NSString *_name;
struct _NSRange _signatureRange;
unsigned long long _originalParameterIndex;
}
@property unsigned long long originalParameterIndex; // @synthesize originalParameterIndex=_originalParameterIndex;
@property(readonly) struct _NSRange signatureRange; // @synthesize signatureRange=_signatureRange;
@property(readonly) NSString *name; // @synthesize name=_name;
@property(readonly) struct _NSRange nameRange; // @synthesize nameRange=_nameRange;
@property(readonly) NSString *typeCastString; // @synthesize typeCastString=_typeCastString;
@property(readonly) struct _NSRange typeStringRange2; // @synthesize typeStringRange2=_typeStringRange2;
@property(readonly) struct _NSRange typeStringRange; // @synthesize typeStringRange=_typeStringRange;
@property(readonly) NSString *keyword; // @synthesize keyword=_keyword;
@property(readonly) struct _NSRange keywordRange; // @synthesize keywordRange=_keywordRange;
- (void)dealloc;
- (id)initWithModifiedText:(id)arg1 keywordRange:(struct _NSRange)arg2 typeStringRange:(struct _NSRange)arg3 nameRange:(struct _NSRange)arg4 typeStringRange2:(struct _NSRange)arg5;
@end
|
//
// KIODefaultNSURLSessionFactory.h
// KeenClient
//
// Created by Brian Baumhover on 5/30/17.
// Copyright © 2017 Keen Labs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KIONSURLSessionFactory.h"
@interface KIODefaultNSURLSessionFactory : NSObject <KIONSURLSessionFactory>
@end
|
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_SimpleSync_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_SimpleSync_TestsVersionString[];
|
//
// TCCardSwipeNC.h
// FlipFlash
//
// Created by Jon Kent on 3/25/15.
// Copyright (c) 2015 Jon Kent. All rights reserved.
//
#import <UIKit/UIKit.h>
@class TCDeck;
@interface TCCardSwipeNC : UINavigationController
@property (nonatomic, strong) TCDeck *deck;
@property (nonatomic, assign) BOOL preview;
@end
|
//
// CoreDataQueryInterface.h
// CoreDataQueryInterface
//
// Created by Gregory Higley on 4/11/15.
// Copyright (c) 2015 Prosumma LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for CoreDataQueryInterface.
FOUNDATION_EXPORT double CoreDataQueryInterfaceVersionNumber;
//! Project version string for CoreDataQueryInterface.
FOUNDATION_EXPORT const unsigned char CoreDataQueryInterfaceVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CoreDataQueryInterface/PublicHeader.h>
|
#ifndef UITEXT_H
#define UITEXT_H
#include "uicomponent.h"
#include "../material.h"
#include "../assets/mesh.h"
#include "../components/renderer.h"
#include <string>
class UIText : public UIComponent
{
public:
void Awake();
void SetTextSize(int size);
void SetText(std::string text);
void SetColor(const glm::vec4& color);
protected:
UIRenderer * renderer;
Material * material;
Texture * texture;
glm::vec4 color;
std::string text;
int textSize;
Mesh * RebuildMesh();
void Rebuild();
};
#endif // UITEXT_H
|
/*
* bwio.c - busy-wait I/O routines for diagnosis
*
* Specific to the TS-7200 ARM evaluation board
*
*/
#include <config/ts7200.h>
#include <lib/bwio.h>
/*
* The UARTs are initialized by RedBoot to the following state
* 115,200 bps
* 8 bits
* no parity
* fifos enabled
*/
int bwsetfifo( int channel, int state ) {
int *line, *mdmctl;
int buf;
switch( channel ) {
case COM1:
line = (int *)( UART1_BASE + UART_LCRH_OFFSET );
mdmctl = (int *)( UART1_BASE + UART_MDMCTL_OFFSET);
break;
case COM2:
line = (int *)( UART2_BASE + UART_LCRH_OFFSET );
break;
default:
return -1;
break;
}
buf = *line;
buf = state ? (buf | FEN_MASK) : (buf & ~FEN_MASK);
if(channel == COM1) {
buf = buf | STP2_MASK;
}
*line = buf;
if(channel == COM1) {
*mdmctl = (*mdmctl | 1);
}
return 0;
}
int bwsetspeed( int channel, int speed ) {
int *high, *low;
switch( channel ) {
case COM1:
high = (int *)( UART1_BASE + UART_LCRM_OFFSET );
low = (int *)( UART1_BASE + UART_LCRL_OFFSET );
break;
case COM2:
high = (int *)( UART2_BASE + UART_LCRM_OFFSET );
low = (int *)( UART2_BASE + UART_LCRL_OFFSET );
break;
default:
return -1;
break;
}
switch( speed ) {
case 115200:
*high = 0x0;
*low = 0x3;
return 0;
case 2400:
*high = 0x0;
*low = 191;
return 0;
default:
return -1;
}
}
int bwputc( int channel, char c ) {
int *flags, *data, *stuff;
switch( channel ) {
case COM1:
flags = (int *)( UART1_BASE + UART_FLAG_OFFSET );
data = (int *)( UART1_BASE + UART_DATA_OFFSET );
stuff = (int *)( UART1_BASE + UART_MDMCTL_OFFSET);
break;
case COM2:
flags = (int *)( UART2_BASE + UART_FLAG_OFFSET );
data = (int *)( UART2_BASE + UART_DATA_OFFSET );
break;
default:
return -1;
break;
}
if(channel == COM1) {
int * mdmctl = (int *)( UART1_BASE + UART_MDMCTL_OFFSET);
*mdmctl = *mdmctl | 3;
while( ( *flags & TXFF_MASK ) || !(*flags & CTS_MASK) ) ;
} else {
while( ( *flags & TXFF_MASK ) ) ;
}
*data = c;
return 0;
}
char c2x( char ch ) {
if ( (ch <= 9) ) return '0' + ch;
return 'a' + ch - 10;
}
int bwputx( int channel, char c ) {
char chh, chl;
chh = c2x( c / 16 );
chl = c2x( c % 16 );
bwputc( channel, chh );
return bwputc( channel, chl );
}
int bwputr( int channel, unsigned int reg ) {
int byte;
char *ch = (char *) ®
for( byte = 3; byte >= 0; byte-- ) bwputx( channel, ch[byte] );
return bwputc( channel, ' ' );
}
void bwputr2(unsigned int regno, unsigned int val) {
switch(regno) {
case 12:
bwputstr(COM2, "r12 (fp): ");
break;
case 13:
bwputstr(COM2, "r13 (sp): ");
break;
case 14:
bwputstr(COM2, "r14 (lr): ");
break;
case 15:
bwputstr(COM2, "r15 (pc): ");
break;
case 16:
bwputstr(COM2, "cpsr : ");
break;
default:
bwprintf(COM2, "r%d : ", regno);
break;
}
bwputr(COM2, val);
bwputstr(COM2, "\r\n");
}
int bwputstr( int channel, char *str ) {
while( *str ) {
if( bwputc( channel, *str ) < 0 ) return -1;
str++;
}
return 0;
}
void bwputw( int channel, int n, char fc, char *bf ) {
char ch;
char *p = bf;
while( *p++ && n > 0 ) n--;
while( n-- > 0 ) bwputc( channel, fc );
while( ( ch = *bf++ ) ) bwputc( channel, ch );
}
int bwgetc( int channel) {
int *flags, *data, *error, *stuff;
unsigned char c;
switch( channel ) {
case COM1:
flags = (int *)( UART1_BASE + UART_FLAG_OFFSET );
data = (int *)( UART1_BASE + UART_DATA_OFFSET );
error = (int *)( UART1_BASE + UART_RSR_OFFSET);
stuff = (int *)( UART1_BASE + UART_MDMCTL_OFFSET);
break;
case COM2:
flags = (int *)( UART2_BASE + UART_FLAG_OFFSET );
data = (int *)( UART2_BASE + UART_DATA_OFFSET );
error = (int *)( UART2_BASE + UART_RSR_OFFSET);
break;
default:
return -1;
break;
}
if(channel == COM1) {
int * mdmctl = (int *)( UART1_BASE + UART_MDMCTL_OFFSET);
*mdmctl = *mdmctl & ~2;
*mdmctl = *mdmctl | 1;
while ( !( *flags & RXFF_MASK ) ) ;
} else {
while ( !( *flags & RXFF_MASK ) ) ;
}
c = *data;
return c;
}
int bwa2d( char ch ) {
if( ch >= '0' && ch <= '9' ) return ch - '0';
if( ch >= 'a' && ch <= 'f' ) return ch - 'a' + 10;
if( ch >= 'A' && ch <= 'F' ) return ch - 'A' + 10;
return -1;
}
char bwa2i( char ch, char **src, int base, int *nump ) {
int num, digit;
char *p;
p = *src; num = 0;
while( ( digit = bwa2d( ch ) ) >= 0 ) {
if ( digit > base ) break;
num = num*base + digit;
ch = *p++;
}
*src = p; *nump = num;
return ch;
}
void bwui2a( unsigned int num, unsigned int base, char *bf ) {
int n = 0;
int dgt;
unsigned int d = 1;
while( (num / d) >= base ) d *= base;
while( d != 0 ) {
dgt = num / d;
num %= d;
d /= base;
if( n || dgt > 0 || d == 0 ) {
*bf++ = dgt + ( dgt < 10 ? '0' : 'a' - 10 );
++n;
}
}
*bf = 0;
}
void bwi2a( int num, char *bf ) {
if( num < 0 ) {
num = -num;
*bf++ = '-';
}
bwui2a( num, 10, bf );
}
void bwformat ( int channel, char *fmt, va_list va ) {
char bf[12];
char ch, lz;
int w;
while ( ( ch = *(fmt++) ) ) {
if ( ch != '%' )
bwputc( channel, ch );
else {
lz = 0; w = 0;
ch = *(fmt++);
switch ( ch ) {
case '0':
lz = 1; ch = *(fmt++);
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
ch = bwa2i( ch, &fmt, 10, &w );
break;
}
switch( ch ) {
case 0: return;
case 'c':
bwputc( channel, va_arg( va, char ) );
break;
case 's':
bwputw( channel, w, 0, va_arg( va, char* ) );
break;
case 'u':
bwui2a( va_arg( va, unsigned int ), 10, bf );
bwputw( channel, w, lz, bf );
break;
case 'd':
bwi2a( va_arg( va, int ), bf );
bwputw( channel, w, lz, bf );
break;
case 'x':
bwui2a( va_arg( va, unsigned int ), 16, bf );
bwputw( channel, w, lz, bf );
break;
case '%':
bwputc( channel, ch );
break;
}
}
}
}
void bwprintf( int channel, char *fmt, ... ) {
va_list va;
va_start(va,fmt);
bwformat( channel, fmt, va );
va_end(va);
}
|
/* SunOS fails to define EXIT_FAILURE and EXIT_SUCCESS */
/*
* config.d.in is a template file used by configure to produce config.d.
* config.d is then transformed (by configure) into the header file config.h.
*/
/* SunOS 4.1.* does not have the standard regcomp() library, so use
re_comp().
*/
#define USE_RE_COMP 1
#define SUNOS_AOUT 1
#define MISSING_EXTERN_CRYPT
#define MISSING_EXTERN_STRTOUL
#define MISSING_STRTOUL
#define MISSING_EXTERN_REALPATH
#define MISSING_EXTERN_GETIMEOFDAY
#define MISSING_EXTERN_SETSOCKOPT
#define MISSING_EXTERN_STRERROR
#define MISSING_STRERROR
#define MISSING_EXTERN_MPROTECT
#define MinorOSStr "sunos4.1.3"
#define HAVE_MACHINE_PARAM_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SGTTY_H 1
#define HAVE_DLFCN_H 1
#define HAVE_RESTARTABLE_SYSCALLS 1
#define HAVE_LIBDL 1
#define HAVE_LIBNSL 1
#define HAVE_DEV_ZERO 1
#define HAVE_BSD_SETPGRP 1
#define HAVE_AINT 1
#define HAVE_BCOPY 1
#define HAVE_DLOPEN 1
#define HAVE_EXP10 1
#define HAVE_GAMMA 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETWD 1
#define HAVE_POLL 1
#define HAVE_RE_COMP 1
#define HAVE_RINT 1
#define HAVE_SIGACTION 1
#define HAVE_SIGSTACK 1
#if 0
#define HAVE_SIGVEC 1
#endif
#define HAVE_SRANDOM 1
#define HAVE_WAIT3 1
#define MISSING_EXTERN__FILBUF 1
#define MISSING_EXTERN__FLSBUF 1
#define MISSING_EXTERN_ACCEPT 1
#define MISSING_EXTERN_BCOPY 1
#define MISSING_EXTERN_BIND 1
#define MISSING_EXTERN_BRK 1
#define MISSING_EXTERN_BZERO 1
#define MISSING_EXTERN_CONNECT 1
#define MISSING_EXTERN_FCLOSE 1
#define MISSING_EXTERN_FFLUSH 1
#define MISSING_EXTERN_FPRINTF 1
#define MISSING_EXTERN_SSCANF 1
#define MISSING_EXTERN_FPUTC 1
#define MISSING_EXTERN_FGETC 1
#define MISSING_EXTERN_FREAD 1
#define MISSING_EXTERN_FSEEK 1
#define MISSING_EXTERN_FWRITE 1
#define MISSING_EXTERN_GETHOSTNAME 1
#define MISSING_EXTERN_GETPAGESIZE 1
#define MISSING_EXTERN_GETSOCKNAME 1
#define MISSING_EXTERN_GETWD 1
#define MISSING_EXTERN_LDOPEN 1
#define MISSING_EXTERN_LISTEN 1
#define MISSING_EXTERN_MEMMOVE 1
#define MISSING_EXTERN_MEMSET 1
#define MISSING_EXTERN_PERROR 1
#define MISSING_EXTERN_PRINTF 1
#define MISSING_EXTERN_READLINK 1
#define MISSING_EXTERN_RECVFROM 1
#define MISSING_EXTERN_RE_COMP 1
#define MISSING_EXTERN_RE_EXEC 1
#define MISSING_EXTERN_REWIND 1
#define MISSING_EXTERN_REXEC 1
#define MISSING_EXTERN_SBRK 1
#define MISSING_EXTERN_SELECT 1
#define MISSING_EXTERN_SENDTO 1
#define MISSING_EXTERN_SETITIMER 1
#define MISSING_EXTERN_SETPGRP 1
#define MISSING_EXTERN_SETVBUF 1
#define MISSING_EXTERN_SHUTDOWN 1
#define MISSING_EXTERN_SIGSTACK 1
#define MISSING_EXTERN_SIGVEC 1
#define MISSING_EXTERN_SOCKET 1
#define MISSING_EXTERN_SYMLINK 1
#define MISSING_EXTERN_SYSTEM 1
#define MISSING_EXTERN_TIME 1
#define MISSING_EXTERN_VFPRINTF 1
#define MISSING_EXTERN_VSPRINTF 1
#define MISSING_EXTERN_LSTAT 1
#define MISSING_EXTERN_MUNMAP 1
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE134_Uncontrolled_Format_String__wchar_t_connect_socket_snprintf_51b.c
Label Definition File: CWE134_Uncontrolled_Format_String.label.xml
Template File: sources-sinks-51b.tmpl.c
*/
/*
* @description
* CWE: 134 Uncontrolled Format String
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Copy a fixed string into data
* Sinks: snprintf
* GoodSink: snwprintf with "%s" as the third argument and data as the fourth
* BadSink : snwprintf with data as the third argument
* Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#ifdef _WIN32
#define SNPRINTF _snwprintf
#else
#define SNPRINTF snprintf
#endif
#ifndef OMITBAD
void CWE134_Uncontrolled_Format_String__wchar_t_connect_socket_snprintf_51b_badSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
SNPRINTF(dest, 100-1, data);
printWLine(dest);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE134_Uncontrolled_Format_String__wchar_t_connect_socket_snprintf_51b_goodG2BSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */
SNPRINTF(dest, 100-1, data);
printWLine(dest);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE134_Uncontrolled_Format_String__wchar_t_connect_socket_snprintf_51b_goodB2GSink(wchar_t * data)
{
{
wchar_t dest[100] = L"";
/* FIX: Specify the format disallowing a format string vulnerability */
SNPRINTF(dest, 100-1, L"%s", data);
printWLine(dest);
}
}
#endif /* OMITGOOD */
|
//
// UIColor+TLGradient.h
// TLKit
//
// Created by 李伯坤 on 2017/8/28.
// Copyright © 2017年 libokun. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (TLGradient)
/**
* 渐变颜色
*
* @param fromColor 开始颜色
* @param toColor 结束颜色
* @param height 渐变高度
*
* @return 渐变颜色
*/
+ (UIColor*)gradientColorFromColor:(UIColor*)fromColor toColor:(UIColor*)toColor withHeight:(int)height;
@end
|
//Programa hecho por master Kalun
// /---\ /---------\
// |^_^| --/Somos |
// \---/ | Micro |
// | Y | 2019-1|
// /---/ \---------/
// | |
// |
// ^
// / \
// - -
#pragma config FOSC = XT_XT // Oscillator Selection bits (XT oscillator (XT))
#pragma config PWRT = ON // Power-up Timer Enable bit (PWRT enabled)
#pragma config BOR = OFF // Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
#pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
#pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
#pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
/*Definimos la velocidad del oscilador principal*/
#define _XTAL_FREQ 4000000UL
/*Llamado a la librería XC*/
#include <xc.h>
void main(void) {
/*Declaramos primero el puerto de salida D0*/
//Este es otro comentario
TRISDbits.RD0 = 0;
while(1){
LATDbits.LD0 = 1;
__delay_ms(200);
LATDbits.LD0 = 0;
__delay_ms(200);
}
}
|
#ifndef BIGINT_H
#define BIGINT_H
/* rlen has to be at least max(xlen,ylen), carry is returned */
unsigned char bigint_add(unsigned char *r,
const unsigned char *x, unsigned long xlen,
const unsigned char *y, unsigned long ylen);
/* rlen has to be at least max(xlen,ylen), borrow is returned */
unsigned char bigint_sub(unsigned char *r,
const unsigned char *x, unsigned long xlen,
const unsigned char *y, unsigned long ylen);
/* rlen has to be at least xlen+ylen */
void bigint_mul(unsigned char *r,
const unsigned char *x, unsigned long xlen,
const unsigned char *y, unsigned long ylen);
/* rlen has to be at least mlen */
void bigint_invmod(unsigned char *r,
const unsigned char *x, unsigned long xlen,
const unsigned char *m, unsigned long mlen);
void bigint_print(const unsigned char *x, unsigned long xlen);
#endif
|
#ifndef _CRC8_H_
#define _CRC8_H_
/*********************************************************************************************/
/**
* \brief 8 bit CRC helper/utility class - CPP Header file.
* \file CRC8.H
* \author J. F. Fitter <jfitter@eagleairaust.com.au>
* \version 1.0
* \date 2014-2015
* \copyright Copyright (c) 2015 John Fitter. All right reserved.
*
* \par License
* GNU Public License. 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:
* \par
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* \par
* 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.
*
*********************************************************************************************/
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define CRC8_DEFAULTPOLY 7 /**< Default CRC polynomial = X8+X2+X1+1 */
class CRC8 {
public:
CRC8(uint8_t polynomial = CRC8_DEFAULTPOLY);
uint8_t crc8(void);
uint8_t crc8(uint8_t data);
void crc8Start(uint8_t poly);
private:
uint8_t _crc;
uint8_t _poly;
};
#endif /* _CRC8_H_ */
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class hu_qgears_opengl_glut_Glut */
#ifndef _Included_hu_qgears_opengl_glut_Glut
#define _Included_hu_qgears_opengl_glut_Glut
#ifdef __cplusplus
extern "C" {
#endif
#undef hu_qgears_opengl_glut_Glut_messageSize
#define hu_qgears_opengl_glut_Glut_messageSize 24L
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_init
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: nativeInit
* Signature: (ZII)V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_nativeInit
(JNIEnv *, jobject, jboolean, jint, jint);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: setupVSync2
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_setupVSync2
(JNIEnv *, jobject, jint);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: nativeTest
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_nativeTest
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: testDrawBasicScene
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_testDrawBasicScene
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: mainLoopEvent
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_mainLoopEvent
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: swapBuffers
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_swapBuffers
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: setFullScreen
* Signature: (ZII)V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_setFullScreen
(JNIEnv *, jobject, jboolean, jint, jint);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getScreenWidth
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getScreenWidth
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getScreenHeight
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getScreenHeight
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getWindowWidth
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getWindowWidth
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getWindowHeight
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getWindowHeight
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: setWindowTitle
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_hu_qgears_opengl_glut_Glut_setWindowTitle
(JNIEnv *, jobject, jstring);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getMessagesBuffer
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_hu_qgears_opengl_glut_Glut_getMessagesBuffer
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getAndResetMessagesReadIndex
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getAndResetMessagesReadIndex
(JNIEnv *, jobject);
/*
* Class: hu_qgears_opengl_glut_Glut
* Method: getMessagesWriteIndex
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_hu_qgears_opengl_glut_Glut_getMessagesWriteIndex
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
|
#ifndef _COMUM_H
#define _COMUM_H
typedef enum {SUCESSO,INVALIDO,BAD_ALLOCATION, POSICAO_INVALIDA,
ESTADO_INVALIDO,OVERFLOW,UNDERFLOW, DUPLICADO, VALOR_INVALIDO} codigo_erro;
typedef enum {SEQUENCIAL, CIRCULAR} tipo_lista;
typedef enum {SEM_ORDEM,
CRESCENTE, DECRESCENTE}classificacao_lista;
const char* codigo_erro_cstr(codigo_erro erro_n);
#endif
|
/* Copyright (C) 2002 Jean-Marc Valin
File: wav_io.c
Routines to handle wav (RIFF) headers
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 the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include "misc.h"
int read_wav_header(FILE *file, int *rate, int *channels, int *format, int *size)
{
char ch[5];
int itmp;
short stmp;
int bpersec;
short balign;
int skip_bytes;
int i;
ch[4]=0;
#if 0
fread(ch, 1, 4, file);
if (strcmp(ch, "RIFF")!=0)
{
fseek(file, 0, SEEK_SET);
return 0;
}
fread(&itmp, 4, 1, file);
*size = le_int(itmp-36);
fread(ch, 1, 4, file);
if (strcmp(ch, "WAVE")!=0)
{
fprintf (stderr, "RIFF file is not a WAVE file\n");
return -1;
}
#endif
fread(ch, 1, 4, file);
while (strcmp(ch, "fmt ")!=0)
{
fread(&itmp, 4, 1, file);
itmp = le_int(itmp);
/*fprintf (stderr, "skip=%d\n", itmp);*/
/*strange way of seeking, but it works even for pipes*/
for (i=0;i<itmp;i++)
fgetc(file);
/*fseek(file, itmp, SEEK_CUR);*/
fread(ch, 1, 4, file);
if (feof(file))
{
fprintf (stderr, "Corrupted WAVE file: no \"fmt \"\n");
return -1;
}
}
/*if (strcmp(ch, "fmt ")!=0)
{
fprintf (stderr, "Corrupted WAVE file: no \"fmt \"\n");
return -1;
}*/
fread(&itmp, 4, 1, file);
itmp = le_int(itmp);
skip_bytes=itmp-16;
/*fprintf (stderr, "skip=%d\n", skip_bytes);*/
fread(&stmp, 2, 1, file);
stmp = le_short(stmp);
if (stmp!=1)
{
fprintf (stderr, "Only PCM encoding is supported\n");
return -1;
}
fread(&stmp, 2, 1, file);
stmp = le_short(stmp);
*channels = stmp;
if (stmp>2)
{
fprintf (stderr, "Only mono and (intensity) stereo supported\n");
return -1;
}
fread(&itmp, 4, 1, file);
itmp = le_int(itmp);
*rate = itmp;
if (*rate != 8000 && *rate != 16000 && *rate != 11025 && *rate != 22050 && *rate != 32000 && *rate != 44100 && *rate != 48000)
{
fprintf (stderr, "Only 8 kHz (narrowband) and 16 kHz (wideband) supported (plus 11.025 kHz and 22.05 kHz, but your mileage may vary)\n");
return -1;
}
fread(&itmp, 4, 1, file);
bpersec = le_int(itmp);
fread(&stmp, 2, 1, file);
balign = le_short(stmp);
fread(&stmp, 2, 1, file);
stmp = le_short(stmp);
if (stmp!=16 && stmp!=8)
{
fprintf (stderr, "Only 8/16-bit linear supported\n");
return -1;
}
*format=stmp;
if (bpersec!=*rate**channels*stmp/8)
{
fprintf (stderr, "Corrupted header: ByteRate mismatch\n");
return -1;
}
if (balign!=*channels*stmp/8)
{
fprintf (stderr, "Corrupted header: BlockAlign mismatch\n");
return -1;
}
/*strange way of seeking, but it works even for pipes*/
if (skip_bytes>0)
for (i=0;i<skip_bytes;i++)
fgetc(file);
/*fseek(file, skip_bytes, SEEK_CUR);*/
fread(ch, 1, 4, file);
while (strcmp(ch, "data")!=0)
{
fread(&itmp, 4, 1, file);
itmp = le_int(itmp);
/*strange way of seeking, but it works even for pipes*/
for (i=0;i<itmp;i++)
fgetc(file);
/*fseek(file, itmp, SEEK_CUR);*/
fread(ch, 1, 4, file);
if (feof(file))
{
fprintf (stderr, "Corrupted WAVE file: no \"data\"\n");
return -1;
}
}
/*Ignore this for now*/
fread(&itmp, 4, 1, file);
itmp = le_int(itmp);
*size=itmp;
return 1;
}
void write_wav_header(FILE *file, int rate, int channels, int format, int size)
{
char ch[5];
int itmp;
short stmp;
ch[4]=0;
fprintf (file, "RIFF");
itmp = 0x7fffffff;
fwrite(&itmp, 4, 1, file);
fprintf (file, "WAVEfmt ");
itmp = le_int(16);
fwrite(&itmp, 4, 1, file);
stmp = le_short(1);
fwrite(&stmp, 2, 1, file);
stmp = le_short(channels);
fwrite(&stmp, 2, 1, file);
itmp = le_int(rate);
fwrite(&itmp, 4, 1, file);
itmp = le_int(rate*channels*2);
fwrite(&itmp, 4, 1, file);
stmp = le_short(2*channels);
fwrite(&stmp, 2, 1, file);
stmp = le_short(16);
fwrite(&stmp, 2, 1, file);
fprintf (file, "data");
itmp = le_int(0x7fffffff);
fwrite(&itmp, 4, 1, file);
}
|
#ifndef _SOC_H_
#define _SOC_H_
#include <types.h>
#define SRAM_ID_SUN4I 0x1623
#define COMPATIBLE_A10 "allwinner,sun4i-a10"
#define SRAM_ID_SUN5I 0x1625
#define COMPATIBLE_A10S "allwinner,sun5i-a10s"
#define COMPATIBLE_A13 "allwinner,sun5i-a13"
#define SRAM_ID_SUN6I 0x1633
#define COMPATIBLE_A31 "allwinner,sun6i-a31"
#define SRAM_ID_SUN7I 0x1651
#define COMPATIBLE_A20 "allwinner,sun7i-a20"
struct soc {
char *compatible;
void *fdt;
};
struct soc *match_soc();
#endif
|
// Aseprite
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef FILTERS_REPLACE_COLOR_FILTER_H_INCLUDED
#define FILTERS_REPLACE_COLOR_FILTER_H_INCLUDED
#pragma once
#include "filters/filter.h"
namespace filters {
class ReplaceColorFilter : public Filter {
public:
ReplaceColorFilter();
void setFrom(int from);
void setTo(int to);
void setTolerance(int tolerance);
int getFrom() const { return m_from; }
int getTo() const { return m_to; }
int getTolerance() const { return m_tolerance; }
// Filter implementation
const char* getName();
void applyToRgba(FilterManager* filterMgr);
void applyToGrayscale(FilterManager* filterMgr);
void applyToIndexed(FilterManager* filterMgr);
private:
int m_from;
int m_to;
int m_tolerance;
};
} // namespace filters
#endif
|
#pragma once
#ifndef NODEENTRY_H
#define NODEENTRY_H
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
#include "ns3/extension-headers.h"
#include <functional>
#include "Statistics.h"
#include "ns3/drop-reason.h"
#include "ns3/tcp-socket.h"
using namespace ns3;
class NodeEntry {
private:
Ptr<Node> node;
Ptr<NetDevice> device;
std::function<void()> associatedCallback;
std::function<void()> deAssociatedCallback;
std::map<uint64_t, Time> txMap;
std::map<uint64_t, Time> rxMap;
//std::vector<bool> seqNrReceivedAtAP;
//std::vector<bool> seqNrReceived;
uint16_t lastBeaconAIDStart = 0;
uint16_t lastBeaconAIDEnd = 0;
bool rawTIMGroupFlaggedAsDataAvailableInDTIM = false;
Time lastBeaconReceivedOn = Time();
Statistics* stats;
void OnEndOfReceive(Ptr<const Packet> packet);
bool tcpConnectedAtSTA = true;
bool tcpConnectedAtAP = true;
Time timeStreamStarted;
public:
int id;
uint32_t aId = 8192; // unassociated is 8192
uint8_t rawGroupNumber = 0;
uint8_t rawSlotIndex = 0;
double x = 0;
double y = 0;
bool isAssociated = false;
uint32_t queueLength = 0;
NodeEntry(int id, Statistics* stats,Ptr<Node> node, Ptr<NetDevice> device);
virtual ~NodeEntry();
void SetAssociation(std::string context, Mac48Address address);
void UnsetAssociation(std::string context, Mac48Address address);
void OnS1gBeaconMissed(std::string context,bool nextBeaconIsDTIM);
void OnNrOfTransmissionsDuringRAWSlotChanged(std::string context, uint16_t oldValue, uint16_t newValue);
void OnPhyTxBegin(std::string context, Ptr<const Packet> packet);
void OnPhyTxEnd(std::string context,Ptr<const Packet> packet);
void OnPhyTxDrop(std::string context,Ptr<const Packet> packet, DropReason reason);
void OnPhyRxBegin(std::string context,Ptr<const Packet> packet);
void OnPhyRxEnd(std::string context,Ptr<const Packet> packet);
void OnPhyRxDrop(std::string context,Ptr<const Packet> packet, DropReason reason);
void OnMacPacketDropped(std::string context, Ptr<const Packet> packet, DropReason reason);
void OnMacTxRtsFailed(std::string context,Mac48Address address);
void OnMacTxDataFailed(std::string context,Mac48Address address);
void OnMacTxFinalRtsFailed(std::string context,Mac48Address address);
void OnMacTxFinalDataFailed(std::string context,Mac48Address address);
void OnCollision(std::string context, uint32_t nrOfBackoffSlots);
void OnTransmissionWillCrossRAWBoundary(std::string context, Time txDuration, Time remainingTimeInRawSlot);
void OnPhyStateChange(std::string context, const Time start, const Time duration, const WifiPhy::State state);
void OnTcpPacketSent(Ptr<const Packet> packet);
void OnTcpPacketDropped(Ptr<Packet> packet, DropReason reason);
void OnTcpFirmwareUpdated(Time totalFirmwareTransferTime);
void OnTcpIPCameraStreamStateChanged(bool newStateIsStreaming);
void OnTcpIPCameraDataSent(uint16_t nrOfBytes);
void OnTcpIPCameraDataReceivedAtAP(uint16_t nrOfBytes);
void OnTcpEchoPacketReceived(Ptr<const Packet> packet, Address from);
void OnTcpPacketReceivedAtAP(Ptr<const Packet> packet);
void OnTcpCongestionWindowChanged(uint32_t oldval, uint32_t newval);
void OnTcpRTOChanged(Time oldval, Time newval);
void OnTcpRTTChanged(Time oldval, Time newval);
void OnTcpStateChanged(TcpSocket::TcpStates_t oldval, TcpSocket::TcpStates_t newval);
void OnTcpStateChangedAtAP(TcpSocket::TcpStates_t oldval, TcpSocket::TcpStates_t newval);
void OnTcpRetransmission(Address to);
void OnTcpRetransmissionAtAP();
void OnTcpSlowStartThresholdChanged(uint32_t oldVal,uint32_t newVal);
void OnTcpEstimatedBWChanged(double oldVal, double newVal);
void OnUdpPacketSent(Ptr<const Packet> packet);
void OnUdpEchoPacketReceived(Ptr<const Packet> packet, Address from);
void OnUdpPacketReceivedAtAP(Ptr<const Packet> packet);
void UpdateQueueLength();
void SetAssociatedCallback(std::function<void()> assocCallback);
void SetDeassociatedCallback(std::function<void()> assocCallback);
};
#endif /* NODEENTRY_H */
|
// switch_text.c
// Generated by decompiling switch
// using Reko decompiler version 0.10.2.0.
#include "switch.h"
// 00008334: void _start(Stack int32 dwArg00, Stack (ptr32 Eq_n) ptrArg08, Stack (ptr32 Eq_n) ptrArg0C, Stack (ptr32 void) ptrArg10)
void _start(int32 dwArg00, void (* ptrArg08)(), void (* ptrArg0C)(), void * ptrArg10)
{
__libc_start_main(g_ptr8364, dwArg00, fp + 4, g_ptr8368, ptrArg08, ptrArg0C, ptrArg10);
abort();
}
int32 (* g_ptr8364)(int32 r0, char ** r1, char ** r2) = main; // 00008364
void (* g_ptr8368)() = __libc_csu_init; // 00008368
// 0000836C: Register word32 call_gmon_start()
// Called from:
// _init
word32 call_gmon_start()
{
ptr32 r10_n = 0x8380 + g_dw8394;
<anonymous> * r3_n = r10_n + g_dw8398;
if (r3_n == null)
return r10;
word32 r10_n;
word32 pc_n;
r3_n();
return r10_n;
}
int32 g_dw8394 = 0x000084C8; // 00008394
int32 g_dw8398 = 20; // 00008398
// 0000839C: void __do_global_dtors_aux()
// Called from:
// _fini
void __do_global_dtors_aux()
{
byte * r5_n = g_ptr83F4;
if ((word32) *r5_n != 0x00)
return;
<anonymous> *** r4_n = g_ptr83F8;
<anonymous> * r2_n = **r4_n;
if (r2_n == null)
*r5_n = 0x01;
else
{
<anonymous> ** r3_n = *r4_n;
*r4_n = (<anonymous> ***) ((char *) r3_n + 4);
word32 pc_n;
word32 r2_n;
r2_n();
}
}
byte * g_ptr83F4 = &g_b10870; // 000083F4
<anonymous> *** g_ptr83F8 = &g_ptr10764; // 000083F8
// 000083FC: void call___do_global_dtors_aux()
void call___do_global_dtors_aux()
{
}
// 00008404: void frame_dummy()
// Called from:
// _init
void frame_dummy()
{
if (*g_ptr8424 == 0x00)
return;
if (g_dw8428 == 0x00)
return;
word32 pc_n;
fn00000000();
}
word32 * g_ptr8424 = &g_dw10844; // 00008424
word32 g_dw8428 = 0x00; // 00008428
// 0000842C: void call_frame_dummy()
void call_frame_dummy()
{
}
// 00008434: Register Eq_n frobulate(Register Eq_n r0, Stack Eq_n dwArg00)
// Called from:
// bazulate
// switcheroo
Eq_n frobulate(Eq_n r0, Eq_n dwArg00)
{
__divsi3(r0 * r0, 1337);
return dwArg00;
}
// 00008470: Register word32 bazulate(Register Eq_n r0, Register Eq_n r1)
// Called from:
// switcheroo
word32 bazulate(Eq_n r0, Eq_n r1)
{
struct Eq_n * fp_n = frobulate(r0, r1);
word32 r0_n = __divsi3(r0 + r1, r0);
union Eq_n * sp_n = (union Eq_n *) <invalid>;
Eq_n r0_n = fp_n->tFFFFFFE8;
struct Eq_n * fp_n = frobulate(r0_n, *sp_n);
__divsi3(r0_n, r0_n);
return fp_n->dw0000;
}
// 000084D4: Register word32 switcheroo(Register Eq_n r0)
// Called from:
// main
word32 switcheroo(Eq_n r0)
{
struct Eq_n * fp_n;
if (r0 <= 0x06)
{
switch (r0)
{
case 0x00:
case 0x01:
case 0x02:
fp_n = frobulate(r0, r0);
break;
case 0x03:
case 0x05:
goto l00008540;
case 0x04:
fp_n = frobulate(r0 - 0x03, r0);
break;
case 0x06:
bazulate(r0, r0);
goto l00008540;
}
}
else
{
l00008540:
fp_n = bazulate(0x00, 0x00);
}
return fp_n->dw0004;
}
// 0000855C: void main(Register Eq_n r0)
void main(Eq_n r0)
{
switcheroo(r0);
}
// 00008588: Register Eq_n __divsi3(Register Eq_n r0, Register Eq_n r1)
// Called from:
// frobulate
// bazulate
Eq_n __divsi3(Eq_n r0, Eq_n r1)
{
Eq_n r1_n;
int32 ip_n = r0 ^ r1;
Eq_n r3_n = 0x01;
Eq_n r2_n = 0x00;
r1_n = r1;
if (r1 < 0x00)
r1_n = 0x00 - r1;
if (r1 == 0x00)
{
__div0(r0);
return 0x00;
}
else
{
if (r0 < 0x00)
r0 = 0x00 - r0;
if (r0 >= r1_n)
{
do
{
bool v19_n = r1_n < 0x10000000;
bool v16_n = r1_n >= 0x10000000;
if (r1_n < 0x10000000)
{
v19_n = r1_n < r0;
v16_n = r1_n >= r0;
}
if (!v16_n)
{
r1_n <<= 4;
r3_n <<= 4;
}
} while (v19_n);
do
{
bool v25_n = r1_n < 0x80000000;
bool v22_n = r1_n >= 0x80000000;
if (r1_n < 0x80000000)
{
v25_n = r1_n < r0;
v22_n = r1_n >= r0;
}
if (!v22_n)
{
r1_n <<= 1;
r3_n <<= 1;
}
} while (v25_n);
do
{
if (r0 >= r1_n)
{
r0 -= r1_n;
r2_n |= r3_n;
}
if (r0 >= r1_n >> 1)
{
r0 -= r1_n >> 1;
r2_n |= r3_n >> 1;
}
if (r0 >= r1_n >> 2)
{
r0 -= r1_n >> 2;
r2_n |= r3_n >> 2;
}
if (r0 >= r1_n >> 3)
{
r0 -= r1_n >> 3;
r2_n |= r3_n >> 3;
}
bool v31_n = r0 != 0x00;
bool v28_n = r0 == 0x00;
if (r0 != 0x00)
{
r3_n >>= 4;
v31_n = r3_n != 0x00;
v28_n = r3_n == 0x00;
}
if (!v28_n)
r1_n >>= 4;
} while (v31_n);
}
Eq_n r0_n = r2_n;
if (ip_n < 0x00)
r0_n = 0x00 - r2_n;
return r0_n;
}
}
// 00008638: void __div0(Register Eq_n r0)
// Called from:
// __divsi3
void __div0(Eq_n r0)
{
__syscall(0x00900014);
if (r0 >= 1000)
return;
__syscall(0x00900025);
}
// 00008654: void __libc_csu_init()
void __libc_csu_init()
{
ptr32 r10_n;
Eq_n r4_n = _init(out r10_n);
<anonymous> * r1_n[] = r10_n + g_dw86A8;
int32 r3_n = r10_n + g_dw86AC - r1_n;
if (r4_n >= r3_n >> 2)
return;
r1_n[r4_n]();
}
int32 g_dw86A8 = 24; // 000086A8
int32 g_dw86AC = 28; // 000086AC
// 000086B0: void __libc_csu_fini()
void __libc_csu_fini()
{
ptr32 r10_n = 0x86C8 + g_dw8700;
<anonymous> * r1_n[] = r10_n + g_dw8704;
int32 r3_n = r10_n + g_dw8708 - r1_n;
int32 r4_n = (r3_n >> 2) - 0x01;
if (r3_n >> 2 == 0x00)
_fini();
else
r1_n[r4_n]();
}
int32 g_dw8700 = 0x00008180; // 00008700
int32 g_dw8704 = 32; // 00008704
int32 g_dw8708 = 36; // 00008708
// 0000870C: Register word32 __do_global_ctors_aux()
// Called from:
// _init
word32 __do_global_ctors_aux()
{
struct Eq_n * r3_n = g_ptr8740;
<anonymous> * r2_n = r3_n->ptrFFFFFFFC;
if (r2_n == (<anonymous> *) 0x01)
return r4;
word32 r4_n;
word32 r3_n;
word32 pc_n;
r2_n();
return r4_n;
}
struct Eq_n * g_ptr8740 = &g_t10838; // 00008740
// 00008744: void call___do_global_ctors_aux()
void call___do_global_ctors_aux()
{
}
|
/*
* %kadu copyright begin%
* Copyright 2016 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "exports.h"
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <injeqt/injeqt.h>
#include <memory>
class Buddy;
class InjectedFactory;
class StoragePoint;
class KADUAPI BuddyStorage : public QObject
{
Q_OBJECT
public:
Q_INVOKABLE explicit BuddyStorage(QObject *parent = nullptr);
virtual ~BuddyStorage();
Buddy create();
Buddy loadStubFromStorage(const std::shared_ptr<StoragePoint> &storagePoint);
Buddy loadFromStorage(const std::shared_ptr<StoragePoint> &storagePoint);
private:
QPointer<InjectedFactory> m_injectedFactory;
private slots:
INJEQT_SET void setInjectedFactory(InjectedFactory *injectedFactory);
};
|
/* -*- C++ -*- */
//=============================================================================
/*
* @file SOCK_Acceptor.h
*
* $Id: SOCK_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_SOCK_ACCEPTOR_H
#define ACE_SOCK_ACCEPTOR_H
#include /**/ "ace/pre.h"
#include "ace/SOCK_Stream.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Time_Value;
class ACE_Accept_QoS_Params;
/*
* @class ACE_SOCK_Acceptor
*
* @brief Defines a factory that creates new ACE_Streams passively.
*
* The ACE_SOCK_Acceptor has its own "passive-mode" socket.
* This serves as a factory to create so-called "data-mode"
* sockets, which are what the ACE_SOCK_Stream encapsulates.
* Therefore, by inheriting from ACE_SOCK, ACE_SOCK_Acceptor
* gets its very own socket.
*/
class ACE_Export ACE_SOCK_Acceptor : public ACE_SOCK
{
public:
// = Initialization and termination methods.
/// Default constructor.
ACE_SOCK_Acceptor (void);
/*
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
* connections on. If @a reuse_addr is 1 then we'll use the
* @c SO_REUSEADDR to reuse this address.
*/
ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
/*
* Initialize a passive-mode BSD-style acceptor socket (no QoS).
* @a local_sap is the address that we're going to listen for
* connections on. If @a reuse_addr is 1 then we'll use the
* @c SO_REUSEADDR to reuse this address. Returns 0 on success and
* -1 on failure.
*/
int open (const ACE_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
/// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
/// on success and -1 on failure.
int open (const ACE_Addr &local_sap,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags,
int reuse_addr,
int protocol_family = PF_UNSPEC,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
/// Close the socket. Returns 0 on success and -1 on failure.
int close (void);
/// Default dtor.
~ACE_SOCK_Acceptor (void);
// = Passive connection <accept> methods.
/*
* Accept a new ACE_SOCK_Stream connection. A @a timeout of 0
* means block forever, a @a timeout of {0, 0} means poll. @a restart
* == true means "restart if interrupted," i.e., if errno == EINTR.
* Note that @a new_stream inherits the "blocking mode" of @c this
* ACE_SOCK_Acceptor, i.e., if @c this acceptor factory is in
* non-blocking mode, the @a new_stream will be in non-blocking mode
* and vice versa.
*/
int accept (ACE_SOCK_Stream &new_stream,
ACE_Addr *remote_addr = 0,
ACE_Time_Value *timeout = 0,
bool restart = true,
bool reset_new_handle = false) const;
#if !defined (ACE_HAS_WINCE)
/*
* Accept a new ACE_SOCK_Stream connection using the QoS
* information in @a qos_params. A @a timeout of 0 means block
* forever, a @a timeout of {0, 0} means poll. @a restart == true means
* "restart if interrupted," i.e., if errno == EINTR. Note that
* @a new_stream inherits the "blocking mode" of @c this
* ACE_SOCK_Acceptor, i.e., if @c this acceptor factory is in
* non-blocking mode, the @a new_stream will be in non-blocking mode
* and vice versa.
*/
int accept (ACE_SOCK_Stream &new_stream,
ACE_Accept_QoS_Params qos_params,
ACE_Addr *remote_addr = 0,
ACE_Time_Value *timeout = 0,
bool restart = true,
bool reset_new_handle = false) const;
#endif // ACE_HAS_WINCE
// = Meta-type info
typedef ACE_INET_Addr PEER_ADDR;
typedef ACE_SOCK_Stream PEER_STREAM;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/// Perform operations that must occur before <ACE_OS::accept> is
/// called.
int shared_accept_start (ACE_Time_Value *timeout,
bool restart,
int &in_blocking_mode) const;
/// Perform operations that must occur after <ACE_OS::accept> is
/// called.
int shared_accept_finish (ACE_SOCK_Stream new_stream,
int in_blocking_mode,
bool reset_new_handle) const;
/*
* This method factors out the common <open> code and is called by
* both the QoS-enabled <open> method and the BSD-style <open>
* method.
*/
int shared_open (const ACE_Addr &local_sap,
int protocol_family,
int backlog);
private:
/// Do not allow this function to percolate up to this interface...
int get_remote_addr (ACE_Addr &) const;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/SOCK_Acceptor.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_ACCEPTOR_H */
|
/*
* Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
* 1-Cell Li-Ion Charger connected via GPIOs.
*
* Copyright (c) 2008 Philipp Zabel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/regulator/bq24022.h>
#include <linux/regulator/driver.h>
static int bq24022_set_current_limit(struct regulator_dev *rdev,
int min_uA, int max_uA)
{
struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n",
max_uA >= 500000 ? "500" : "100");
/* REVISIT: maybe return error if min_uA != 0 ? */
gpio_set_value(pdata->gpio_iset2, max_uA >= 500000);
return 0;
}
static int bq24022_get_current_limit(struct regulator_dev *rdev)
{
struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000;
}
static int bq24022_enable(struct regulator_dev *rdev)
{
struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
dev_dbg(rdev_get_dev(rdev), "enabling charger\n");
gpio_set_value(pdata->gpio_nce, 0);
return 0;
}
static int bq24022_disable(struct regulator_dev *rdev)
{
struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
dev_dbg(rdev_get_dev(rdev), "disabling charger\n");
gpio_set_value(pdata->gpio_nce, 1);
return 0;
}
static int bq24022_is_enabled(struct regulator_dev *rdev)
{
struct platform_device *pdev = rdev_get_drvdata(rdev);
struct bq24022_mach_info *pdata = pdev->dev.platform_data;
return !gpio_get_value(pdata->gpio_nce);
}
static struct regulator_ops bq24022_ops = {
.set_current_limit = bq24022_set_current_limit,
.get_current_limit = bq24022_get_current_limit,
.enable = bq24022_enable,
.disable = bq24022_disable,
.is_enabled = bq24022_is_enabled,
};
static struct regulator_desc bq24022_desc = {
.name = "bq24022",
.ops = &bq24022_ops,
.type = REGULATOR_CURRENT,
};
static int __init bq24022_probe(struct platform_device *pdev)
{
struct bq24022_mach_info *pdata = pdev->dev.platform_data;
struct regulator_dev *bq24022;
int ret;
if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2)
return -EINVAL;
ret = gpio_request(pdata->gpio_nce, "ncharge_en");
if (ret) {
dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n",
pdata->gpio_nce);
goto err_ce;
}
ret = gpio_request(pdata->gpio_iset2, "charge_mode");
if (ret) {
dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n",
pdata->gpio_iset2);
goto err_iset2;
}
ret = gpio_direction_output(pdata->gpio_iset2, 0);
ret = gpio_direction_output(pdata->gpio_nce, 1);
bq24022 = regulator_register(&bq24022_desc, &pdev->dev,
pdata->init_data, pdata);
if (IS_ERR(bq24022)) {
dev_dbg(&pdev->dev, "couldn't register regulator\n");
ret = PTR_ERR(bq24022);
goto err_reg;
}
platform_set_drvdata(pdev, bq24022);
dev_dbg(&pdev->dev, "registered regulator\n");
return 0;
err_reg:
gpio_free(pdata->gpio_iset2);
err_iset2:
gpio_free(pdata->gpio_nce);
err_ce:
return ret;
}
static int __devexit bq24022_remove(struct platform_device *pdev)
{
struct bq24022_mach_info *pdata = pdev->dev.platform_data;
struct regulator_dev *bq24022 = platform_get_drvdata(pdev);
regulator_unregister(bq24022);
gpio_free(pdata->gpio_iset2);
gpio_free(pdata->gpio_nce);
return 0;
}
static struct platform_driver bq24022_driver = {
.driver = {
.name = "bq24022",
},
.remove = __devexit_p(bq24022_remove),
};
static int __init bq24022_init(void)
{
return platform_driver_probe(&bq24022_driver, bq24022_probe);
}
static void __exit bq24022_exit(void)
{
platform_driver_unregister(&bq24022_driver);
}
module_init(bq24022_init);
module_exit(bq24022_exit);
MODULE_AUTHOR("Philipp Zabel");
MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver");
MODULE_LICENSE("GPL");
|
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __NPCHANDLER_H
#define __NPCHANDLER_H
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack(1)
#else
#pragma pack(push,1)
#endif
struct PageText
{
uint32 Page_ID;
char* Text;
uint32 Next_Page;
};
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack()
#else
#pragma pack(pop)
#endif
struct PageTextLocale
{
std::vector<std::string> Text;
};
struct NpcTextLocale
{
NpcTextLocale() { Text_0.resize(8); Text_1.resize(8); }
std::vector<std::vector<std::string> > Text_0;
std::vector<std::vector<std::string> > Text_1;
};
struct QEmote
{
uint32 _Emote;
uint32 _Delay;
};
struct GossipTextOption
{
std::string Text_0;
std::string Text_1;
uint32 Language;
float Probability;
QEmote Emotes[3];
};
#define MAX_GOSSIP_TEXT_OPTIONS 8
struct GossipText
{
GossipTextOption Options[MAX_GOSSIP_TEXT_OPTIONS];
};
#endif
|
#ifndef _PPC_KERNEL_CPM2_H
#define _PPC_KERNEL_CPM2_H
extern unsigned int cpm2_get_irq(struct pt_regs *regs);
extern void cpm2_pic_init(struct device_node*);
#endif /* _PPC_KERNEL_CPM2_H */
|
/*
* (C) 2007-2012 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <videoacc.h>
#include "../BaseVideoFilter/BaseVideoFilter.h"
class CMPCDXVAVideoDecFilter;
class CVideoDecDXVAAllocator;
class CVideoDecOutputPin : public CBaseVideoOutputPin
, public IAMVideoAcceleratorNotify
{
public:
CVideoDecOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
~CVideoDecOutputPin();
HRESULT InitAllocator(IMemAllocator** ppAlloc);
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IAMVideoAcceleratorNotify
STDMETHODIMP GetUncompSurfacesInfo(const GUID* pGuid, LPAMVAUncompBufferInfo pUncompBufferInfo);
STDMETHODIMP SetUncompSurfacesInfo(DWORD dwActualUncompSurfacesAllocated);
STDMETHODIMP GetCreateVideoAcceleratorData(const GUID* pGuid, LPDWORD pdwSizeMiscData, LPVOID* ppMiscData);
private:
CMPCDXVAVideoDecFilter* m_pVideoDecFilter;
CVideoDecDXVAAllocator* m_pDXVA2Allocator;
DWORD m_dwDXVA1SurfaceCount;
GUID m_GuidDecoderDXVA1;
DDPIXELFORMAT m_ddUncompPixelFormat;
};
|
#ifndef __ASYNCHELPER_H
#define __ASYNCHELPER_H
/* poll until POLLOUT, then call CIOCASYNCCRYPT */
inline int do_async_crypt(int cfd, struct crypt_op *cryp)
{
struct pollfd pfd;
pfd.fd = cfd;
pfd.events = POLLOUT;
if (poll(&pfd, 1, -1) < 1) {
perror("poll()");
return 1;
}
if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) {
perror("ioctl(CIOCCRYPT)");
return 1;
}
return 0;
}
/* poll until POLLIN, then call CIOCASYNCFETCH */
inline int do_async_fetch(int cfd, struct crypt_op *cryp)
{
struct pollfd pfd;
pfd.fd = cfd;
pfd.events = POLLIN;
if (poll(&pfd, 1, -1) < 1) {
perror("poll()");
return 1;
}
if (ioctl(cfd, CIOCASYNCFETCH, cryp)) {
perror("ioctl(CIOCCRYPT)");
return 1;
}
return 0;
}
/* Check return value of stmt for identity with goodval. If they
* don't match, call return with the value of stmt. */
#define DO_OR_DIE(stmt, goodval) { \
int __rc_val; \
if ((__rc_val = stmt) != goodval) { \
perror("DO_OR_DIE(" #stmt "," #goodval ")"); \
return __rc_val; \
} \
}
#endif /* __ASYNCHELPER_H */
|
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
zippath.h
File/directory/path operations that work with ZIP files
***************************************************************************/
#pragma once
#ifndef __ZIPPATH_H__
#define __ZIPPATH_H__
#include "corefile.h"
#include <string>
#include "unzip.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
class zippath_directory;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* ----- path operations ----- */
/* retrieves the parent directory */
std::string &zippath_parent(std::string &dst, const char *path);
/* retrieves the parent directory basename */
std::string &zippath_parent_basename(std::string &dst, const char *path);
/* combines two paths */
std::string &zippath_combine(std::string &dst, const char *path1, const char *path2);
/* ----- file operations ----- */
/* opens a zip path file */
file_error zippath_fopen(const char *filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path);
/* ----- directory operations ----- */
/* opens a directory */
file_error zippath_opendir(const char *path, zippath_directory **directory);
/* closes a directory */
void zippath_closedir(zippath_directory *directory);
/* reads a directory entry */
const osd_directory_entry *zippath_readdir(zippath_directory *directory);
/* returns TRUE if this path is a ZIP path or FALSE if not */
int zippath_is_zip(zippath_directory *directory);
#endif /* __ZIPPATH_H__ */
|
/*
* IRenderSystem.h - Regan Russell
*
* Rendering subsystem, handles rendering. What else would it do?
*/
#ifndef _IRENDERSYSTEM_H_
#define _IRENDERSYSTEM_H_
class IRenderSystem
{
public:
IRenderSystem();
~IRenderSystem();
void Draw();
void LoadShaders();
CShader* GetShader(std::string path);
void SetShader(CShader* shader);
CShader* GetCurShader();
void SetCamera(CCameraNode* cam);
CCameraNode* GetCamera();
void SetAmbientLight(glm::vec3 color);
glm::vec3 GetAmbientLight();
glm::mat4 GetProjectionMatrix();
glm::mat4 GetViewMatrix();
glm::mat3 GetViewRotMatrix();
void SetCurLight(CLight* light);
CLight* GetCurLight();
void SetCurMesh(CMesh* mesh);
CMesh* GetCurMesh();
void SetCurMaterial(CMaterial* mat);
CMaterial* GetCurMaterial();
GBuffer* GetGBuffer();
GLuint GetScreenQuad();
GLuint GetScreenUVs();
void RenderPostEffects();
void RenderSkybox();
CFrameBuffer* GetFrameBuffer(unsigned int id);
void SetReadBuffer(CFrameBuffer* buffer);
CFrameBuffer* GetReadBuffer();
void SetWriteBuffer(CFrameBuffer* buffer);
CFrameBuffer* GetWriteBuffer();
private:
glm::mat4 m_ProjectionMatrix;
glm::mat4 m_ViewMatrix;
glm::mat3 m_ViewRotMatrix;
CCameraNode* m_Camera;
std::map<std::string, CShader*> m_Shaders;
CLightEnvironment m_LightEnv;
CShader* m_CurShader;
GBuffer m_GBuffer;
GLuint m_ScreenQuad;
GLuint m_ScreenUVs;
CLight* m_CurLight;
CMesh* m_CurMesh;
CMaterial* m_CurMaterial;
CPostProcessChain m_PPChain;
CFrameBuffer m_FBO[2];
CFrameBuffer* m_ReadBuffer;
CFrameBuffer* m_WriteBuffer;
GLuint m_SkyboxVerts;
};
#endif |
/**
* @file rtp.h
* @brief RTP demux module shared declarations
*/
/*****************************************************************************
* Copyright © 2008 Rémi Denis-Courmont
*
* This library 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
typedef struct rtp_pt_t rtp_pt_t;
typedef struct rtp_session_t rtp_session_t;
/** @section RTP payload format */
struct rtp_pt_t
{
void *(*init) (demux_t *);
void (*destroy) (demux_t *, void *);
void (*decode) (demux_t *, void *, block_t *);
uint32_t frequency; /* RTP clock rate (Hz) */
uint8_t number;
};
int rtp_autodetect (demux_t *, rtp_session_t *, const block_t *);
static inline uint8_t rtp_ptype (const block_t *block)
{
return block->p_buffer[1] & 0x7F;
}
void *codec_init (demux_t *demux, es_format_t *fmt);
void codec_destroy (demux_t *demux, void *data);
void codec_decode (demux_t *demux, void *data, block_t *block);
void *theora_init (demux_t *demux);
void xiph_destroy (demux_t *demux, void *data);
void xiph_decode (demux_t *demux, void *data, block_t *block);
/** @section RTP session */
rtp_session_t *rtp_session_create (demux_t *);
void rtp_session_destroy (demux_t *, rtp_session_t *);
void rtp_queue (demux_t *, rtp_session_t *, block_t *);
bool rtp_dequeue (demux_t *, const rtp_session_t *, mtime_t *);
void rtp_dequeue_force (demux_t *, const rtp_session_t *);
int rtp_add_type (demux_t *demux, rtp_session_t *ses, const rtp_pt_t *pt);
void *rtp_dgram_thread (void *data);
void *rtp_stream_thread (void *data);
/* Global data */
struct demux_sys_t
{
rtp_session_t *session;
#ifdef HAVE_SRTP
struct srtp_session_t *srtp;
#endif
int fd;
int rtcp_fd;
vlc_thread_t thread;
mtime_t timeout;
unsigned caching;
uint16_t max_dropout; /**< Max packet forward misordering */
uint16_t max_misorder; /**< Max packet backward misordering */
uint8_t max_src; /**< Max simultaneous RTP sources */
bool thread_ready;
bool autodetect; /**< Payload type autodetection pending */
};
|
//
// Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences.
// All rights reserved.
// This file is part of FirteX (www.firtex.org)
//
// Use of the FirteX is subject to the terms of the software license set forth in
// the LICENSE file included with this software, and also available at
// http://www.firtex.org/license.html
//
// Author : ¹ùÈð½Ü(GuoRuijie)
// Email : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com
// Created : 2005/11/20
//
#ifndef __SIMPLEPARSER_H
#define __SIMPLEPARSER_H
#include "Parser.h"
#include "../document/Document.h"
#include "../utility/FileReader.h"
using namespace firtex::document;
using namespace firtex::utility;
namespace firtex
{
namespace parser
{
class CPlainParser : public CParser
{
public:
class Creator : public CParser::Creator
{
protected:
Creator()
{
m_identifier += _T(".plain");
m_docType = _T("txt");
}
public:
~Creator(){}
public:
/**
* create a collection object
* @return create a parser
*/
CParser* create(){return new CPlainParser();};
public:
static Creator* getInstance()
{
static CPlainParser::Creator INSTANCE;
return &INSTANCE;
}
};
public:
CPlainParser();
CPlainParser(const tchar* field);
virtual~CPlainParser();
protected:
/**
* parse document and extract content,sub class MUST implement it
* @param pDocInput source input of document
* @param pResultDoc parsed document
* @return true if success, otherwise false
*/
bool parseInternal(document::CDocumentInput* pDocInput,document::CDocument* pResultDoc);
/**
* define the schema of document, MUST implement by sub-class
* @param pSchema document schema
* @return schema id of main text
*/
schemaid_t defineSchema(CDocumentSchema* pSchema);
protected:
CFileReader* m_pReader;
schemaid_t m_nTextId;
};
}
}
#endif
|
#ifndef __ASM_ARCH_SYSTEM_H
#define __ASM_ARCH_SYSTEM_H __FILE__
#include <plat/watchdog-reset.h>
static void arch_idle(void)
{
/* nothing here yet */
}
static void arch_reset(char mode, const char *cmd)
{
if (mode != 's')
arch_wdt_reset();
/* if all else fails, or mode was for soft, jump to 0 */
cpu_reset(0);
}
#endif /* __ASM_ARCH_IRQ_H */
|
// ライセンス: GPL2
#ifndef _FONTCOLORPREF_H
#define _FONTCOLORPREF_H
#include "skeleton/prefdiag.h"
#include "skeleton/spinbutton.h"
#include "skeleton/label_entry.h"
#include <vector>
namespace CORE
{
class ColorTreeColumn : public Gtk::TreeModel::ColumnRecord
{
public:
Gtk::TreeModelColumn< Glib::ustring > m_col_name;
Gtk::TreeModelColumn< std::string > m_col_color;
Gtk::TreeModelColumn< int > m_col_colorid;
Gtk::TreeModelColumn< std::string > m_col_default;
ColorTreeColumn()
{
add( m_col_name );
add( m_col_color );
add( m_col_colorid );
add( m_col_default );
}
};
////////////////////////////////
class FontColorPref : public SKELETON::PrefDiag
{
Gtk::Notebook m_notebook;
// ツールチップ
Gtk::Tooltips m_tooltips;
// フォントの設定
std::vector< int > m_font_tbl;
std::vector< std::string > m_tooltips_font;
Gtk::HBox m_hbox_font;
Gtk::VBox m_vbox_font;
Gtk::EventBox m_event_font;
Gtk::ComboBoxText m_combo_font;
Gtk::FontButton m_fontbutton;
Gtk::HBox m_hbox_checkbutton;
Gtk::CheckButton m_checkbutton_font;
Gtk::HBox m_hbox_space;
Gtk::HBox m_hbox_ubar;
Gtk::Label m_label_space;
SKELETON::SpinButtonDouble m_spin_space;
Gtk::Label m_label_ubar;
SKELETON::SpinButtonDouble m_spin_ubar;
SKELETON::LabelEntry m_label_aafont;
Gtk::Button m_bt_reset_font;
// 色の設定
Gtk::Label m_label_warning_color;
Gtk::VBox m_vbox_color;
Gtk::CheckButton m_chk_use_gtkrc_tree;
Gtk::CheckButton m_chk_use_gtkrc_selection;
Gtk::TreeView m_treeview_color;
Glib::RefPtr< Gtk::ListStore > m_liststore_color;
CORE::ColorTreeColumn m_columns_color;
Gtk::ScrolledWindow m_scrollwin_color;
Gtk::HBox m_hbox_change_color;
Gtk::Button m_bt_change_color;
Gtk::Button m_bt_reset_color;
Gtk::Button m_bt_reset_all_colors;
public:
FontColorPref( Gtk::Window* parent, const std::string& url );
~FontColorPref();
private:
// ウィジェットを追加
void pack_widget();
// フォントの設定
void set_font_settings( const std::string& name, const int fontid, const std::string& tooltip );
void slot_combo_font_changed();
void slot_fontbutton_on_set();
void slot_checkbutton_font_toggled();
void slot_chk_use_gtkrc_toggled();
void slot_reset_font();
// 色の設定
void set_color_settings( const int colorid, const std::string& name, const std::string& defaultval );
void slot_row_activated( const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column );
void slot_cell_data_name( Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& it );
void slot_cell_data_color( Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& it );
void slot_change_color();
void slot_reset_color();
void slot_reset_all_colors();
// OK,cancel,apply が押された
virtual void slot_ok_clicked();
virtual void slot_apply_clicked();
virtual void slot_cancel_clicked();
};
}
#endif
|
/**
* vNote backup handling.
*/
/* Copyright (c) 2009 Michal Cihar <michal@cihar.com> */
/* Licensend under GNU GPL 2 */
#include <string.h>
#include <ctype.h>
#include <gammu-config.h>
#include "../../misc/coding/coding.h"
#include "../../debug.h"
#include "../gsmlogo.h"
#include "../gsmmisc.h"
#include "backics.h"
#include "backvcs.h"
#ifdef GSM_ENABLE_BACKUP
/**
* Helper define to check error code from fwrite.
*/
#define chk_fwrite(data, size, count, file) \
if (fwrite(data, size, count, file) != count) goto fail;
GSM_Error SaveVNT(char *FileName, GSM_Backup *backup)
{
int i;
size_t Length = 0;
unsigned char Buffer[1000];
FILE *file;
GSM_Error error;
file = fopen(FileName, "wb");
if (file == NULL) return ERR_CANTOPENFILE;
i=0;
while (backup->Note[i]!=NULL) {
Length = 0;
error = GSM_EncodeVNTFile(Buffer, sizeof(Buffer), &Length, backup->Note[i]);
if (error != ERR_NONE) {
fclose(file);
return error;
}
chk_fwrite(Buffer,1,Length,file);
i++;
sprintf(Buffer, "%c%c",13,10);
chk_fwrite(Buffer,1,2,file);
}
fclose(file);
return ERR_NONE;
fail:
fclose(file);
return ERR_WRITING_FILE;
}
GSM_Error LoadVNT(char *FileName, GSM_Backup *backup)
{
GSM_File File;
GSM_Error error;
GSM_NoteEntry Note;
int num = 0;
size_t Pos = 0;
File.Buffer = NULL;
error = GSM_ReadFile(FileName, &File);
if (error != ERR_NONE) return error;
while (1) {
error = GSM_DecodeVNOTE(File.Buffer, &Pos, &Note);
if (error == ERR_EMPTY) {
error = ERR_NONE;
break;
}
if (error != ERR_NONE) break;
if (num < GSM_BACKUP_MAX_NOTE) {
backup->Note[num] = (GSM_NoteEntry *)malloc(sizeof(GSM_NoteEntry));
if (backup->Note[num] == NULL) {
error = ERR_MOREMEMORY;
break;
}
backup->Note[num + 1] = NULL;
} else {
dbgprintf(NULL, "Increase GSM_BACKUP_MAX_NOTE\n");
error = ERR_MOREMEMORY;
break;
}
memcpy(backup->Note[num], &Note, sizeof(GSM_NoteEntry));
backup->Note[num]->Location = num + 1;
num++;
}
free(File.Buffer);
File.Buffer=NULL;
return error;
}
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
|
/* -*- c-basic-offset: 8; -*- */
/* proto_xaudiocast.c: Implementation of protocol xaudiocast.
*
* Copyright (C) 2002-2004 the Icecast team <team@icecast.org>,
* Copyright (C) 2012-2015 Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <shoutidjc/shout.h>
#include "shout_private.h"
int shout_create_xaudiocast_request(shout_t *self)
{
const char *bitrate;
const char *val;
int ret;
bitrate = shout_get_audio_info(self, SHOUT_AI_BITRATE);
if (!bitrate)
bitrate = "0";
ret = SHOUTERR_MALLOC;
do {
if (shout_queue_printf(self, "SOURCE %s %s\n", self->password, self->mount))
break;
if (shout_queue_printf(self, "x-audiocast-name: %s\n", shout_get_meta(self, "name")))
break;
val = shout_get_meta(self, "url");
if (shout_queue_printf(self, "x-audiocast-url: %s\n", val ? val : "http://www.icecast.org/"))
break;
val = shout_get_meta(self, "genre");
if (shout_queue_printf(self, "x-audiocast-genre: %s\n", val ? val : "icecast"))
break;
if (shout_queue_printf(self, "x-audiocast-bitrate: %s\n", bitrate))
break;
if (shout_queue_printf(self, "x-audiocast-public: %i\n", self->public))
break;
val = shout_get_meta(self, "description");
if (shout_queue_printf(self, "x-audiocast-description: %s\n", val ? val : "Broadcasting with the icecast streaming media server!"))
break;
if (self->dumpfile && shout_queue_printf(self, "x-audiocast-dumpfile: %s\n", self->dumpfile))
break;
if (shout_queue_str(self, "\n"))
break;
ret = SHOUTERR_SUCCESS;
} while (0);
return ret;
}
int shout_parse_xaudiocast_response(shout_t *self)
{
char *response;
if (shout_queue_collect(self->rqueue.head, &response) <= 0)
return SHOUTERR_MALLOC;
shout_queue_free(&self->rqueue);
if (!strstr(response, "OK")) {
free(response);
return SHOUTERR_NOLOGIN;
}
free(response);
return SHOUTERR_SUCCESS;
}
|
//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
/////////////////////////////////////////////////////////////////////////////////
// Name: src/devices/PEven.h
// Purpose: Events processed by Event Loop.
// Author: Shane T. Mueller, Ph.D.
// Copyright: (c) 2004-2014 Shane T. Mueller <smueller@obereed.net>
// License: GPL 2
//
//
//
// This file is part of the PEBL project.
//
// PEBL 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.
//
// PEBL 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 PEBL; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
#ifndef __PEVENTQUEUE_H__
#define __PEVENTQUEUE_H__
#include "PEvent.h"
#include <queue>
#include <iostream>
using std::queue;
using std::cerr;
//entirely on the platform-specific event-handling routines.
class PEventQueue: virtual public PDevice
{
public:
PEventQueue();
virtual ~PEventQueue();
//This gets the type of the first event,
virtual PEBL_DEVICE_TYPE GetFirstEventType();
//This 'pops' the event at the front of the queue off, destroying it.
virtual void PopEvent();
virtual void PushEvent(PEvent & evt);
//This 'peeks' at the event at the front of the queue
virtual PEvent GetFirstEvent();
//This 'primes' the event-queue pump, getting any
//waiting events from the system, tagging them with a timestamp,
// and putting them into the PEBL queue
virtual void Prime(){std::cout << "Standard prime\n";};
virtual bool IsEmpty(){return mEventQueue.empty();};
virtual int GetState(int interface) const;
virtual PEBL_DEVICE_TYPE GetDeviceType(){return PDT_EVENT_QUEUE;};
private:
protected:
queue<PEvent> mEventQueue;
};
#endif
|
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <mach/gpiomux.h>
#include "msm_sensor.h"
#include "msm_cci.h"
#include "msm_camera_io_util.h"
#include "msm_camera_i2c_mux.h"
#define OV8858_SENSOR_NAME "ov8858"
DEFINE_MSM_MUTEX(ov8858_mut);
#undef CDBG
#ifdef CONFIG_MSMB_CAMERA_DEBUG
#define CDBG(fmt, args...) pr_err(fmt, ##args)
#else
#define CDBG(fmt, args...) do { } while (0)
#endif
static struct msm_sensor_ctrl_t ov8858_s_ctrl;
static struct msm_sensor_power_setting ov8858_power_setting[] = {
{
.seq_type = SENSOR_VREG,
.seq_val = CAM_VIO,
.config_val = 0,
.delay = 0,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_VANA,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_VANA,
.config_val = GPIO_OUT_HIGH,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_VDIG,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_VDIG,
.config_val = GPIO_OUT_HIGH,
.delay = 5,
},
{
.seq_type = SENSOR_VREG,
.seq_val = CAM_VANA,
.config_val = 0,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_STANDBY,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_STANDBY,
.config_val = GPIO_OUT_HIGH,
.delay = 10,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_RESET,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_RESET,
.config_val = GPIO_OUT_HIGH,
.delay = 10,
},
{
.seq_type = SENSOR_CLK,
.seq_val = SENSOR_CAM_MCLK,
.config_val = 24000000,
.delay = 10,
},
};
static struct v4l2_subdev_info ov8858_subdev_info[] = {
{
.code = V4L2_MBUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_JPEG,
.fmt = 1,
.order = 0,
},
};
static const struct i2c_device_id ov8858_i2c_id[] = {
{OV8858_SENSOR_NAME,
(kernel_ulong_t)&ov8858_s_ctrl},
{ }
};
extern void camera_af_software_powerdown(struct i2c_client *client); ///@Hxin add
static int32_t msm_ov8858_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
return msm_sensor_i2c_probe(client, id, &ov8858_s_ctrl);
}
static struct i2c_driver ov8858_i2c_driver = {
.id_table = ov8858_i2c_id,
.probe = msm_ov8858_i2c_probe,
.driver = {
.name = OV8858_SENSOR_NAME,
},
};
static struct msm_camera_i2c_client ov8858_sensor_i2c_client = {
.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
};
///@Hxin add for avoid current leak start
int32_t ov8858_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
int32_t rc = 0;
rc = msm_sensor_power_up(s_ctrl);
return rc;
}
int32_t ov8858_power_down(struct msm_sensor_ctrl_t *s_ctrl)
{
int32_t rc = 0;
camera_af_software_powerdown(s_ctrl->sensor_i2c_client->client);
rc = msm_sensor_power_down(s_ctrl);
return rc;
}
int32_t ov8858_match_id(struct msm_sensor_ctrl_t *s_ctrl)
{
int32_t rc = 0;
rc = msm_sensor_match_id(s_ctrl);
return rc;
}
int32_t ov8858_config(struct msm_sensor_ctrl_t *s_ctrl,
void __user *argp)
{
int32_t rc = 0;
rc = msm_sensor_config(s_ctrl, argp);
return rc;
}
static struct msm_sensor_fn_t ov8858_sensor_fn_t = {
.sensor_power_up = ov8858_power_up,
.sensor_power_down = ov8858_power_down,
.sensor_match_id = ov8858_match_id,
.sensor_config = ov8858_config,
};
///@Hxin add for avoid current leak end
static struct msm_sensor_ctrl_t ov8858_s_ctrl = {
.sensor_i2c_client = &ov8858_sensor_i2c_client,
.power_setting_array.power_setting = ov8858_power_setting,
.power_setting_array.size =
ARRAY_SIZE(ov8858_power_setting),
.msm_sensor_mutex = &ov8858_mut,
.sensor_v4l2_subdev_info = ov8858_subdev_info,
.sensor_v4l2_subdev_info_size =
ARRAY_SIZE(ov8858_subdev_info),
.func_tbl = &ov8858_sensor_fn_t, ///@Hxin add
};
static const struct of_device_id ov8858_dt_match[] = {
{
.compatible = "ovti,ov8858",
.data = &ov8858_s_ctrl
},
{}
};
MODULE_DEVICE_TABLE(of, ov8858_dt_match);
static struct platform_driver ov8858_platform_driver = {
.driver = {
.name = "ovti,ov8858",
.owner = THIS_MODULE,
.of_match_table = ov8858_dt_match,
},
};
static int32_t ov8858_platform_probe(struct platform_device *pdev)
{
int32_t rc = 0;
const struct of_device_id *match;
match = of_match_device(ov8858_dt_match, &pdev->dev);
rc = msm_sensor_platform_probe(pdev, match->data);
return rc;
}
static int __init ov8858_init_module(void)
{
int32_t rc = 0;
rc = platform_driver_probe(&ov8858_platform_driver,
ov8858_platform_probe);
if (!rc)
return rc;
return i2c_add_driver(&ov8858_i2c_driver);
}
static void __exit ov8858_exit_module(void)
{
if (ov8858_s_ctrl.pdev) {
msm_sensor_free_sensor_data(&ov8858_s_ctrl);
platform_driver_unregister(&ov8858_platform_driver);
} else
i2c_del_driver(&ov8858_i2c_driver);
return;
}
module_init(ov8858_init_module);
module_exit(ov8858_exit_module);
MODULE_DESCRIPTION("ov8858");
MODULE_LICENSE("GPL v2");
|
/* $Id$
*
* See 'daemon.c' for a detailed description.
*
* Copyright (C) 2002 Robert James Kaes (rjkaes@flarenet.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, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef TINYPROXY_DAEMON_H
#define TINYPROXY_DAEMON_H
typedef void signal_func(int);
/*
* Pass a singal integer and a function to handle the signal.
*/
extern signal_func *set_signal_handler(int signo, signal_func * func);
/*
* Make a program a daemon process
*/
extern void makedaemon(void);
#endif
|
/*
sshgenutils.h
Author: Vesa Suontama <vsuontam@ssh.fi>
Copyright:
Copyright (c) 2002, 2003 SFNT Finland Oy.
All rights reserved.
General small utilities which are yet too long to be written again every
time.
*/
#ifndef SSHGENUTILSH
#define SSHGENUTILSH
/* String handling stuff **************************************************/
/* Extracts a substring from a string. Substrings are limited with delimiter
char. Function returns substring specified in occurance parameter. The
offset of the first substring. Function allocates enough memory for the
return string. User gives a pointer to uninitialized string pointer as
a parameter.
*/
char *ssh_str_extract(const char *source,
char **target,
char delimiter,
int occurence);
/* non classified ********************************************************/
/* Waits the given time in microseconds. Uses ssh_time_measure.
This function waits in busy loop, in order to prevent event loop
from continuing while waiting. USE THIS FUNCTION CAREFULLY!!!*/
void ssh_busy_wait_usec(const SshUInt64 time_us);
/* Generate a `name string' from the binary buffer. The returned
string consisits of user provided string and an arbitrary
hash value calculated from the binary buffer and encoded as
a hex string. The hash value IS NOT cryptorgaphically safe
and it DOES leak information about the buffer. Neither is
it collision free. */
char *ssh_generate_name_from_buffer(const char *name,
const unsigned char *blob,
size_t bloblen);
#endif /* SSHGENUTILSH */
|
/* $Id: segment.c,v 1.1.1.1 2010/03/11 21:06:33 kris Exp $
* segment.c: Prom routine to map segments in other contexts before
* a standalone is completely mapped. This is for sun4 and
* sun4c architectures only.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
extern void restore_current(void);
/* Set physical segment 'segment' at virtual address 'vaddr' in
* context 'ctx'.
*/
void
prom_putsegment(int ctx, unsigned long vaddr, int segment)
{
unsigned long flags;
spin_lock_irqsave(&prom_lock, flags);
(*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment);
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
return;
}
|
/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* Tests that excess tokens in skipped conditional blocks don't warn. */
/* Source: Neil Booth, 25 Jul 2001. */
/* APPLE LOCAL -Wextra-tokens */
/* { dg-options "-Wextra-tokens" } */
#if 0
#if foo
#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
#endif foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
#endif bar /* { dg-warning "extra tokens" "tokens after #endif" } */
|
#ifndef VDR_LIVE_TNTCONFIG_H
#define VDR_LIVE_TNTCONFIG_H
#include "tntfeatures.h"
#include <tnt/tntnet.h>
namespace vdrlive {
class TntConfig
{
public:
static TntConfig const& Get();
void Configure(tnt::Tntnet& app) const;
private:
TntConfig();
TntConfig( TntConfig const& );
};
} // namespace vdrlive
#endif // VDR_LIVE_TNTCONFIG_H
|
/* Header file for Special Initializers for certain USB Mass Storage devices
*
* $Id: initializers.h,v 1.1.1.1 2010/03/11 21:07:27 kris Exp $
*
* Current development and maintenance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
*
* This driver is based on the 'USB Mass Storage Class' document. This
* describes in detail the protocol used to communicate with such
* devices. Clearly, the designers had SCSI and ATAPI commands in
* mind when they created this document. The commands are all very
* similar to commands in the SCSI-II and ATAPI specifications.
*
* It is important to note that in a number of cases this class
* exhibits class-specific exemptions from the USB specification.
* Notably the usage of NAK, STALL and ACK differs from the norm, in
* that they are used to communicate wait, failed and OK on commands.
*
* Also, for certain devices, the interrupt endpoint is used to convey
* status of a command.
*
* Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more
* information about this driver.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "usb.h"
#include "transport.h"
/* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target
* mode */
int usb_stor_euscsi_init(struct us_data *us);
/* This function is required to activate all four slots on the UCR-61S2B
* flash reader */
int usb_stor_ucr61s2b_init(struct us_data *us);
/* This places the HUAWEI E220 devices in multi-port mode */
int usb_stor_huawei_e220_init(struct us_data *us);
|
/*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels, Amos Jeffries
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
#ifndef _INCLUDE_ICMP_H
#define _INCLUDE_ICMP_H
#include "config.h"
#include "ip/IpAddress.h"
#define PINGER_PAYLOAD_SZ 8192
#define MAX_PAYLOAD 256 // WAS: SQUIDHOSTNAMELEN
#define MAX_PKT4_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmphdr) + 1)
#define MAX_PKT6_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmp6_hdr) + 1)
#if USE_ICMP
/* This is a line-data format struct. DO NOT alter. */
struct pingerEchoData {
IpAddress to;
unsigned char opcode;
int psize;
char payload[PINGER_PAYLOAD_SZ];
};
/* This is a line-data format struct. DO NOT alter. */
struct pingerReplyData {
IpAddress from;
unsigned char opcode;
int rtt;
int hops;
int psize;
char payload[PINGER_PAYLOAD_SZ];
};
struct icmpEchoData {
struct timeval tv;
unsigned char opcode;
char payload[MAX_PAYLOAD];
};
SQUIDCEXTERN int icmp_pkts_sent;
#endif /* USE_ICMP */
/**
* Implements the squid interface to access ICMP operations
*
\par
* Child implementations define specific parts of these operations
* using these methods as a naming and parameter template.
*
* IcmpSquid - implements the squid side of squid-pinger interface
* IcmpPinger - implements the pinger side of the squid-pinger interface
* Icmpv4 - implements pinger helper for Icmpv4
* Icmpv6 - implements pinger helper for Icmpv6
*/
class Icmp
{
public:
Icmp();
virtual ~Icmp() {};
/// Start pinger helper and initiate control channel
virtual int Open() =0;
/// Shutdown pinger helper and control channel
virtual void Close();
#if USE_ICMP
/**
* Construct and Send an ECHO request
*
\param to Destination address being 'pinged'
\param opcode Specific code for ECHO request, see RFC ????.
\param payload A payload MAY be sent in the ICMP message.
* Content longer than MAX_PAYLOAD will be truncated.
\param len Length of the payload in bytes if any is to be sent or 0.
*/
virtual void SendEcho(IpAddress &to, int opcode, const char *payload=NULL, int len=0) =0;
/// Handle ICMP responses.
virtual void Recv(void) =0;
protected:
/* shared internal methods */
/// Calculate a packet checksum
int CheckSum(unsigned short *ptr, int size);
/**
* Translate TTL to a hop distance
*
\param ttl negative : n > 33
\param ttl n(0...32) : 32 >= n >= 1
\param ttl n(33...62) : 32 >= n >= 1
\param ttl n(63...64) : 2 >= n >= 1
\param ttl n(65...128) : 64 >= n >= 1
\param ttl n(129...192) : 64 >= n >= 1
\param ttl n(193...) : n < 255
*
\bug BUG? ttl<0 can produce high hop values
\bug BUG? ttl>255 can produce zero or negative hop values
*/
int ipHops(int ttl);
/// Log the packet.
void Log(const IpAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops);
/* no use wasting memory */
int icmp_sock;
int icmp_ident;
#endif /* USE_ICMP */
};
#endif
|
/*
* $Id$
*
* AUTHOR: Duane Wessels
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
#ifndef SQUID_CONFIG_H
#include "config.h"
#endif
#ifndef SQUID_ASSERT_H
#define SQUID_ASSERT_H
#if defined(NODEBUG)
#define assert(EX) ((void)0)
#elif STDC_HEADERS
#define assert(EX) ((EX)?((void)0):xassert( # EX , __FILE__, __LINE__))
#else
#define assert(EX) ((EX)?((void)0):xassert("EX", __FILE__, __LINE__))
#endif
#ifdef __cplusplus
extern "C" void
#else
extern void
#endif
xassert(const char *, const char *, int);
#endif /* SQUID_ASSERT_H */
|
#include <stdio.h> //for printf
#include <stdlib.h> //for exit
#include <unistd.h> //for sleep
#include <signal.h> //for sigaction
volatile int exit_requested = 0;
void user_exit(int sig, siginfo_t *info, void *ucontext)
{
printf("signal is %d\n", sig);
exit_requested = 1;
}
int main(int argc, char *argv[])
{
struct sigaction sig = {
.sa_sigaction = user_exit,
.sa_flags = SA_RESTART || SA_SIGINFO
};
struct sigaction sigterm_old;
struct sigaction sigint_old;
sigemptyset(&sig.sa_mask);
if (sigaction(SIGTERM, &sig, &sigterm_old) == -1)
exit(EXIT_FAILURE);
if (sigaction(SIGINT, &sig, &sigint_old) == -1)
exit(EXIT_FAILURE);
while(!exit_requested) {
printf("waiting for user exit\n");
sleep(1);
}
printf("exit!");
return 0;
}
|
/**
* @author Pavel Lobyrin
* @email pavel@lobyrin.ru
* @website http://lobyrin.de
* @link https://github.com/Comrada/SmartCar
* @version v1.0
* @ide CooCox
* @license GNU GPL v3
* @brief Main module of SmartCar
*
@verbatim
----------------------------------------------------------------------
Copyright (C) Pavel Lobyrin, 2015
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
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/>.
----------------------------------------------------------------------
@endverbatim
*/
#ifndef MAIN_H
#define MAIN_H
#include "stm32f4xx.h"
#define USART_BAUDRATE 115200
static int RCMode = 1;
static const int USARTLog = 1;
static float Vbat = 0.00f;
static float CoreTemp = 0.00f;
static uint16_t DevSign = 0x0000;
static uint16_t DevRev = 0x0000;
static uint32_t DevID[3] = {0x0, 0x0, 0x0};
static int FlashSize = 0;
#endif
|
/*
* The ManaPlus Client
* Copyright (C) 2015 The ManaPlus Developers
*
* 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 ENUMS_SIMPLETYPES_NPCNAMES_H
#define ENUMS_SIMPLETYPES_NPCNAMES_H
#include "enums/simpletypes/booldefines.h"
defBoolEnum(NpcNames);
#endif // ENUMS_SIMPLETYPES_NPCNAMES_H
|
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** TQt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
void KBetterThanKDialogBase::clicked()
{
if (sender() == _allowOnce) {
done(3);
} else if (sender() == _allowAlways) {
done(1);
} else if (sender() == _deny) {
done(4);
} else if (sender() == _denyForever) {
done(2);
}
}
void KBetterThanKDialogBase::setLabel( const TQString & label )
{
_label->setText(label);
}
void KBetterThanKDialogBase::init()
{
_allowOnce->setFocus();
}
void KBetterThanKDialogBase::accept()
{
setResult(3);
}
void KBetterThanKDialogBase::reject()
{
TQDialog::reject();
setResult(4);
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_
#define CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_CONTAINER_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
class CannedBrowsingDataAppCacheHelper;
class CannedBrowsingDataCookieHelper;
class CannedBrowsingDataDatabaseHelper;
class CannedBrowsingDataFileSystemHelper;
class CannedBrowsingDataIndexedDBHelper;
class CannedBrowsingDataLocalStorageHelper;
class CannedBrowsingDataServerBoundCertHelper;
class CookiesTreeModel;
class GURL;
class Profile;
class LocalSharedObjectsContainer {
public:
explicit LocalSharedObjectsContainer(Profile* profile);
~LocalSharedObjectsContainer();
void Reset();
size_t GetObjectCount() const;
size_t GetObjectCountForDomain(const GURL& url) const;
scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel() const;
CannedBrowsingDataAppCacheHelper* appcaches() const {
return appcaches_.get();
}
CannedBrowsingDataCookieHelper* cookies() const { return cookies_.get(); }
CannedBrowsingDataDatabaseHelper* databases() const {
return databases_.get();
}
CannedBrowsingDataFileSystemHelper* file_systems() const {
return file_systems_.get();
}
CannedBrowsingDataIndexedDBHelper* indexed_dbs() const {
return indexed_dbs_.get();
}
CannedBrowsingDataLocalStorageHelper* local_storages() const {
return local_storages_.get();
}
CannedBrowsingDataServerBoundCertHelper* server_bound_certs() const {
return server_bound_certs_.get();
}
CannedBrowsingDataLocalStorageHelper* session_storages() const {
return session_storages_.get();
}
private:
scoped_refptr<CannedBrowsingDataAppCacheHelper> appcaches_;
scoped_refptr<CannedBrowsingDataCookieHelper> cookies_;
scoped_refptr<CannedBrowsingDataDatabaseHelper> databases_;
scoped_refptr<CannedBrowsingDataFileSystemHelper> file_systems_;
scoped_refptr<CannedBrowsingDataIndexedDBHelper> indexed_dbs_;
scoped_refptr<CannedBrowsingDataLocalStorageHelper> local_storages_;
scoped_refptr<CannedBrowsingDataServerBoundCertHelper> server_bound_certs_;
scoped_refptr<CannedBrowsingDataLocalStorageHelper> session_storages_;
DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsContainer);
};
#endif
|
#ifndef _AHA1740_H
/* $Id: //depot/sw/releases/Aquila_9.2.0_U10/linux/kernels/mips-linux-2.6.31/drivers/scsi/aha1740.h#1 $
*
* Header file for the adaptec 1740 driver for Linux
*
* With minor revisions 3/31/93
* Written and (C) 1992,1993 Brad McLean. See aha1740.c
* for more info
*
*/
#include <linux/types.h>
#define SLOTSIZE 0x5c
/* EISA configuration registers & values */
#define HID0(base) (base + 0x0)
#define HID1(base) (base + 0x1)
#define HID2(base) (base + 0x2)
#define HID3(base) (base + 0x3)
#define EBCNTRL(base) (base + 0x4)
#define PORTADR(base) (base + 0x40)
#define BIOSADR(base) (base + 0x41)
#define INTDEF(base) (base + 0x42)
#define SCSIDEF(base) (base + 0x43)
#define BUSDEF(base) (base + 0x44)
#define RESV0(base) (base + 0x45)
#define RESV1(base) (base + 0x46)
#define RESV2(base) (base + 0x47)
#define HID_MFG "ADP"
#define HID_PRD 0
#define HID_REV 2
#define EBCNTRL_VALUE 1
#define PORTADDR_ENH 0x80
/* READ */
#define G2INTST(base) (base + 0x56)
#define G2STAT(base) (base + 0x57)
#define MBOXIN0(base) (base + 0x58)
#define MBOXIN1(base) (base + 0x59)
#define MBOXIN2(base) (base + 0x5a)
#define MBOXIN3(base) (base + 0x5b)
#define G2STAT2(base) (base + 0x5c)
#define G2INTST_MASK 0xf0 /* isolate the status */
#define G2INTST_CCBGOOD 0x10 /* CCB Completed */
#define G2INTST_CCBRETRY 0x50 /* CCB Completed with a retry */
#define G2INTST_HARDFAIL 0x70 /* Adapter Hardware Failure */
#define G2INTST_CMDGOOD 0xa0 /* Immediate command success */
#define G2INTST_CCBERROR 0xc0 /* CCB Completed with error */
#define G2INTST_ASNEVENT 0xd0 /* Asynchronous Event Notification */
#define G2INTST_CMDERROR 0xe0 /* Immediate command error */
#define G2STAT_MBXOUT 4 /* Mailbox Out Empty Bit */
#define G2STAT_INTPEND 2 /* Interrupt Pending Bit */
#define G2STAT_BUSY 1 /* Busy Bit (attention pending) */
#define G2STAT2_READY 0 /* Host Ready Bit */
/* WRITE (and ReadBack) */
#define MBOXOUT0(base) (base + 0x50)
#define MBOXOUT1(base) (base + 0x51)
#define MBOXOUT2(base) (base + 0x52)
#define MBOXOUT3(base) (base + 0x53)
#define ATTN(base) (base + 0x54)
#define G2CNTRL(base) (base + 0x55)
#define ATTN_IMMED 0x10 /* Immediate Command */
#define ATTN_START 0x40 /* Start CCB */
#define ATTN_ABORT 0x50 /* Abort CCB */
#define G2CNTRL_HRST 0x80 /* Hard Reset */
#define G2CNTRL_IRST 0x40 /* Clear EISA Interrupt */
#define G2CNTRL_HRDY 0x20 /* Sets HOST ready */
/* This is used with scatter-gather */
struct aha1740_chain {
u32 dataptr; /* Location of data */
u32 datalen; /* Size of this part of chain */
};
/* These belong in scsi.h */
#define any2scsi(up, p) \
(up)[0] = (((unsigned long)(p)) >> 16) ; \
(up)[1] = (((unsigned long)(p)) >> 8); \
(up)[2] = ((unsigned long)(p));
#define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
#define xany2scsi(up, p) \
(up)[0] = ((long)(p)) >> 24; \
(up)[1] = ((long)(p)) >> 16; \
(up)[2] = ((long)(p)) >> 8; \
(up)[3] = ((long)(p));
#define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
+ (((long)(up)[2]) << 8) + ((long)(up)[3]) )
#define MAX_CDB 12
#define MAX_SENSE 14
#define MAX_STATUS 32
struct ecb { /* Enhanced Control Block 6.1 */
u16 cmdw; /* Command Word */
/* Flag Word 1 */
u16 cne:1, /* Control Block Chaining */
:6, di:1, /* Disable Interrupt */
:2, ses:1, /* Suppress Underrun error */
:1, sg:1, /* Scatter/Gather */
:1, dsb:1, /* Disable Status Block */
ars:1; /* Automatic Request Sense */
/* Flag Word 2 */
u16 lun:3, /* Logical Unit */
tag:1, /* Tagged Queuing */
tt:2, /* Tag Type */
nd:1, /* No Disconnect */
:1, dat:1, /* Data transfer - check direction */
dir:1, /* Direction of transfer 1 = datain */
st:1, /* Suppress Transfer */
chk:1, /* Calculate Checksum */
:2, rec:1,:1; /* Error Recovery */
u16 nil0; /* nothing */
u32 dataptr; /* Data or Scatter List ptr */
u32 datalen; /* Data or Scatter List len */
u32 statusptr; /* Status Block ptr */
u32 linkptr; /* Chain Address */
u32 nil1; /* nothing */
u32 senseptr; /* Sense Info Pointer */
u8 senselen; /* Sense Length */
u8 cdblen; /* CDB Length */
u16 datacheck; /* Data checksum */
u8 cdb[MAX_CDB]; /* CDB area */
/* Hardware defined portion ends here, rest is driver defined */
u8 sense[MAX_SENSE]; /* Sense area */
u8 status[MAX_STATUS]; /* Status area */
Scsi_Cmnd *SCpnt; /* Link to the SCSI Command Block */
void (*done) (Scsi_Cmnd *); /* Completion Function */
};
#define AHA1740CMD_NOP 0x00 /* No OP */
#define AHA1740CMD_INIT 0x01 /* Initiator SCSI Command */
#define AHA1740CMD_DIAG 0x05 /* Run Diagnostic Command */
#define AHA1740CMD_SCSI 0x06 /* Initialize SCSI */
#define AHA1740CMD_SENSE 0x08 /* Read Sense Information */
#define AHA1740CMD_DOWN 0x09 /* Download Firmware (yeah, I bet!) */
#define AHA1740CMD_RINQ 0x0a /* Read Host Adapter Inquiry Data */
#define AHA1740CMD_TARG 0x10 /* Target SCSI Command */
#define AHA1740_ECBS 32
#define AHA1740_SCATTER 16
#define AHA1740_CMDLUN 1
#endif
|
#ifndef MUDLET_TTOOLBAR_H
#define MUDLET_TTOOLBAR_H
/***************************************************************************
* Copyright (C) 2008-2009 by Heiko Koehn - KoehnHeiko@googlemail.com *
* Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "pre_guard.h"
#include <QDockWidget>
#include "post_guard.h"
class TAction;
class TFlipButton;
class QGridLayout;
class TToolBar : public QDockWidget
{
Q_OBJECT
public:
TToolBar( TAction *, const QString&, QWidget * pW = 0 );
void addButton( TFlipButton * pW );
void moveEvent( QMoveEvent * e ) override;
void setVerticalOrientation(){ mVerticalOrientation = true; }
void setHorizontalOrientation(){ mVerticalOrientation = false; }
void clear();
void finalize();
TAction * mpTAction;
void recordMove(){ mRecordMove = true; }
//private:
bool mVerticalOrientation;
QWidget * mpWidget;
QString mName;
bool mRecordMove;
QGridLayout * mpLayout;
int mItemCount;
signals:
public slots:
void slot_pressed();
};
#endif // MUDLET_TTOOLBAR_H
|
/**
* @file interface.h
* @brief .interface units management functions.
*/
/***************************************************************************
* Copyright 2016 by Davide Bettio <davide@uninstall.it> *
* *
* 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 _INTERFACE_H_
#define _INTERFACE_H_
#include "unitmanager.h"
/**
* @brief instantiate a new Interface unit.
*
* @description read a .interface unit and instantiate a new Interface object.
*
*/
Unit *interface_new(const char *interface_new);
/**
* @brief start the interface.
*
* @description start the interface pointed by u.
*
* @param u the interface that should be started.
*/
int interface_start(Unit *u);
#endif
|
#ifndef __INC_STDLIB
#define __INC_STDLIB
#if !defined(__INC_DEFS)
#include <defs.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int _CType doserrno;
extern int _CType errno;
extern int _CType sys_nerr;
extern char * _CType sys_errlist[];
extern char * _CType dos_errlist[];
void _CType exit(int);
long _CType atol(char *);
int _CType atoi(char *);
long _CType xtol(char *);
long _CType strtol(char *);
char * _CType qwtostr(DWORD __high, DWORD __low);
char * _CType qwtobstr(DWORD __high, DWORD __low);
long _CType mkbstring(char *__buf, DWORD __high, DWORD __low);
char * _CType getenvp(char *);
char * _CType getenval(char *__buf, char *);
char * _CType expenviron(char *__string/*128*/);
char * _CType searchp(char *__program);
char * _CType searchpath(char *__file);
#ifdef __cplusplus
}
#endif
#endif
|
//------------------------------------------------------------------------------
// <copyright file="ar6000_diag.h" company="Atheros">
// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
//
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
//
//------------------------------------------------------------------------------
//==============================================================================
// Author(s): ="Atheros"
//==============================================================================
#ifndef AR6000_DIAG_H_
#define AR6000_DIAG_H_
int
ar6000_ReadRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
int
ar6000_WriteRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
int
ar6000_ReadDataDiag(struct hif_device *hifDevice, u32 address,
u8 *data, u32 length);
int
ar6000_WriteDataDiag(struct hif_device *hifDevice, u32 address,
u8 *data, u32 length);
int
ar6k_ReadTargetRegister(struct hif_device *hifDevice, int regsel, u32 *regval);
void
ar6k_FetchTargetRegs(struct hif_device *hifDevice, u32 *targregs);
#endif /*AR6000_DIAG_H_*/
|
/*
* linux/arch/sh/boards/se/7722/setup.c
*
* Copyright (C) 2007 Nobuhiro Iwamatsu
*
* Hitachi UL SolutionEngine 7722 Support.
*
* 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/init.h>
#include <linux/platform_device.h>
#include <linux/pata_platform.h>
#include <asm/machvec.h>
#include <asm/se7722.h>
#include <asm/io.h>
/* Heartbeat */
static struct resource heartbeat_resources[] = {
[0] = {
.start = PA_LED,
.end = PA_LED,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device heartbeat_device = {
.name = "heartbeat",
.id = -1,
.num_resources = ARRAY_SIZE(heartbeat_resources),
.resource = heartbeat_resources,
};
/* SMC91x */
static struct resource smc91x_eth_resources[] = {
[0] = {
.name = "smc91x-regs" ,
.start = PA_LAN + 0x300,
.end = PA_LAN + 0x300 + 0x10 ,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = SMC_IRQ,
.end = SMC_IRQ,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device smc91x_eth_device = {
.name = "smc91x",
.id = 0,
.dev = {
.dma_mask = NULL, /* don't use dma */
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(smc91x_eth_resources),
.resource = smc91x_eth_resources,
};
static struct resource cf_ide_resources[] = {
[0] = {
.start = PA_MRSHPC_IO + 0x1f0,
.end = PA_MRSHPC_IO + 0x1f0 + 8 ,
.flags = IORESOURCE_IO,
},
[1] = {
.start = PA_MRSHPC_IO + 0x1f0 + 0x206,
.end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
.flags = IORESOURCE_IO,
},
[2] = {
.start = MRSHPC_IRQ0,
.end = MRSHPC_IRQ0,
.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 struct platform_device *se7722_devices[] __initdata = {
&heartbeat_device,
&smc91x_eth_device,
&cf_ide_device,
};
static int __init se7722_devices_setup(void)
{
return platform_add_devices(se7722_devices,
ARRAY_SIZE(se7722_devices));
}
device_initcall(se7722_devices_setup);
static void __init se7722_setup(char **cmdline_p)
{
ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
ctrl_outl(0x00051001, MSTPCR0);
ctrl_outl(0x00000000, MSTPCR1);
/* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */
ctrl_outl(0xffffbfC0, MSTPCR2);
ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
/* LCDC I/O */
ctrl_outw(0x0020, PORT_PSELD);
/* SIOF1*/
ctrl_outw(0x0003, PORT_PSELB);
ctrl_outw(0xe000, PORT_PSELC);
ctrl_outw(0x0000, PORT_PKCR);
/* LCDC */
ctrl_outw(0x4020, PORT_PHCR);
ctrl_outw(0x0000, PORT_PLCR);
ctrl_outw(0x0000, PORT_PMCR);
ctrl_outw(0x0002, PORT_PRCR);
ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
/* KEYSC */
ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
ctrl_outw(0x0000, PORT_PYCR);
ctrl_outw(0x0000, PORT_PZCR);
}
/*
* The Machine Vector
*/
static struct sh_machine_vector mv_se7722 __initmv = {
.mv_name = "Solution Engine 7722" ,
.mv_setup = se7722_setup ,
.mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
.mv_init_irq = init_se7722_IRQ,
};
|
#ifndef POWERMANAGER_H
#define POWERMANAGER_H
#include <QObject>
#include "powerbackendiface.h"
class PowerManager : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal battery READ getBattery NOTIFY batteryValueChanged)
public:
explicit PowerManager(QObject *parent = 0);
~PowerManager();
void init();
qreal getBattery() const { return m_batteryValue; }
Q_INVOKABLE bool isOnBattery() const { return qobject_cast<PowerBackendIface*>( m_backend )->isOnBattery(); }
signals:
// used in QML
void batteryValueChanged();
void batteryLow();
void batteryCritical();
void batteryBackToLow();
void batteryBackToNormal();
void powerSupplyPlugedIn();
void powerSupplyPlugedOut();
private slots:
void onBatteryValueChanged( double value );
void onPowerSourceChanged( bool isOnBatt );
private:
QObject *m_backend;
double m_batteryValue;
};
#endif // POWERMANAGER_H
|
/*
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2018 The ManaPlus Developers
*
* 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 GUI_WINDOWS_CONNECTIONDIALOG_H
#define GUI_WINDOWS_CONNECTIONDIALOG_H
#include "enums/state.h"
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
/**
* The connection dialog.
*
* \ingroup Interface
*/
class ConnectionDialog final : public Window,
private ActionListener
{
public:
/**
* Constructor.
*
* @param text The text to display
* @param cancelState The state to enter when Cancel is pressed
*
* @see Window::Window
*/
ConnectionDialog(const std::string &text, const StateT cancelState);
A_DELETE_COPY(ConnectionDialog)
void postInit() override final;
/**
* Called when the user presses Cancel. Restores the global state to
* the previous one.
*/
void action(const ActionEvent &event) override final;
void draw(Graphics *const graphics) override final A_NONNULL(2);
void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
private:
StateT mCancelState;
};
#endif // GUI_WINDOWS_CONNECTIONDIALOG_H
|
#ifndef _ASM_IA64_BITOPS_H
#define _ASM_IA64_BITOPS_H
#ifndef _LINUX_BITOPS_H
#error only <linux/bitops.h> can be included directly
#endif
#include <linux/compiler.h>
#include <linux/types.h>
#include <asm/intrinsics.h>
static __inline__ void
set_bit (int nr, volatile void *addr)
{
__u32 bit, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
bit = 1 << (nr & 31);
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old | bit;
} while (cmpxchg_acq(m, old, new) != old);
}
static __inline__ void
__set_bit (int nr, volatile void *addr)
{
*((__u32 *) addr + (nr >> 5)) |= (1 << (nr & 31));
}
#define smp_mb__before_clear_bit() smp_mb()
#define smp_mb__after_clear_bit() do { /* skip */; } while (0)
static __inline__ void
clear_bit (int nr, volatile void *addr)
{
__u32 mask, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
mask = ~(1 << (nr & 31));
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old & mask;
} while (cmpxchg_acq(m, old, new) != old);
}
static __inline__ void
clear_bit_unlock (int nr, volatile void *addr)
{
__u32 mask, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
mask = ~(1 << (nr & 31));
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old & mask;
} while (cmpxchg_rel(m, old, new) != old);
}
static __inline__ void
__clear_bit_unlock(int nr, void *addr)
{
__u32 * const m = (__u32 *) addr + (nr >> 5);
__u32 const new = *m & ~(1 << (nr & 31));
ia64_st4_rel_nta(m, new);
}
static __inline__ void
__clear_bit (int nr, volatile void *addr)
{
*((__u32 *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
}
static __inline__ void
change_bit (int nr, volatile void *addr)
{
__u32 bit, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
bit = (1 << (nr & 31));
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old ^ bit;
} while (cmpxchg_acq(m, old, new) != old);
}
static __inline__ void
__change_bit (int nr, volatile void *addr)
{
*((__u32 *) addr + (nr >> 5)) ^= (1 << (nr & 31));
}
static __inline__ int
test_and_set_bit (int nr, volatile void *addr)
{
__u32 bit, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
bit = 1 << (nr & 31);
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old | bit;
} while (cmpxchg_acq(m, old, new) != old);
return (old & bit) != 0;
}
#define test_and_set_bit_lock test_and_set_bit
static __inline__ int
__test_and_set_bit (int nr, volatile void *addr)
{
__u32 *p = (__u32 *) addr + (nr >> 5);
__u32 m = 1 << (nr & 31);
int oldbitset = (*p & m) != 0;
*p |= m;
return oldbitset;
}
static __inline__ int
test_and_clear_bit (int nr, volatile void *addr)
{
__u32 mask, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
mask = ~(1 << (nr & 31));
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old & mask;
} while (cmpxchg_acq(m, old, new) != old);
return (old & ~mask) != 0;
}
static __inline__ int
__test_and_clear_bit(int nr, volatile void * addr)
{
__u32 *p = (__u32 *) addr + (nr >> 5);
__u32 m = 1 << (nr & 31);
int oldbitset = (*p & m) != 0;
*p &= ~m;
return oldbitset;
}
static __inline__ int
test_and_change_bit (int nr, volatile void *addr)
{
__u32 bit, old, new;
volatile __u32 *m;
CMPXCHG_BUGCHECK_DECL
m = (volatile __u32 *) addr + (nr >> 5);
bit = (1 << (nr & 31));
do {
CMPXCHG_BUGCHECK(m);
old = *m;
new = old ^ bit;
} while (cmpxchg_acq(m, old, new) != old);
return (old & bit) != 0;
}
static __inline__ int
__test_and_change_bit (int nr, void *addr)
{
__u32 old, bit = (1 << (nr & 31));
__u32 *m = (__u32 *) addr + (nr >> 5);
old = *m;
*m = old ^ bit;
return (old & bit) != 0;
}
static __inline__ int
test_bit (int nr, const volatile void *addr)
{
return 1 & (((const volatile __u32 *) addr)[nr >> 5] >> (nr & 31));
}
static inline unsigned long
ffz (unsigned long x)
{
unsigned long result;
result = ia64_popcnt(x & (~x - 1));
return result;
}
static __inline__ unsigned long
__ffs (unsigned long x)
{
unsigned long result;
result = ia64_popcnt((x-1) & ~x);
return result;
}
#ifdef __KERNEL__
static inline unsigned long
ia64_fls (unsigned long x)
{
long double d = x;
long exp;
exp = ia64_getf_exp(d);
return exp - 0xffff;
}
static inline int
fls (int t)
{
unsigned long x = t & 0xffffffffu;
if (!x)
return 0;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
return ia64_popcnt(x);
}
static inline unsigned long
__fls (unsigned long x)
{
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x |= x >> 32;
return ia64_popcnt(x) - 1;
}
#include <asm-generic/bitops/fls64.h>
#define ffs(x) __builtin_ffs(x)
static __inline__ unsigned long __arch_hweight64(unsigned long x)
{
unsigned long result;
result = ia64_popcnt(x);
return result;
}
#define __arch_hweight32(x) ((unsigned int) __arch_hweight64((x) & 0xfffffffful))
#define __arch_hweight16(x) ((unsigned int) __arch_hweight64((x) & 0xfffful))
#define __arch_hweight8(x) ((unsigned int) __arch_hweight64((x) & 0xfful))
#include <asm-generic/bitops/const_hweight.h>
#endif /* __KERNEL__ */
#include <asm-generic/bitops/find.h>
#ifdef __KERNEL__
#include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
#include <asm-generic/bitops/minix.h>
#include <asm-generic/bitops/sched.h>
#endif /* __KERNEL__ */
#endif /* _ASM_IA64_BITOPS_H */
|
/* ///////////////////////////////////////////////////////////////////////// */
/* This file is a part of the BSTools package */
/* written by Przemyslaw Kiciak */
/* ///////////////////////////////////////////////////////////////////////// */
/* (C) Copyright by Przemyslaw Kiciak, 2005, 2015 */
/* this package is distributed under the terms of the */
/* Lesser GNU Public License, see the file COPYING.LIB */
/* ///////////////////////////////////////////////////////////////////////// */
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pkvaria.h"
#include "pknum.h"
#include "pkgeom.h"
#include "multibs.h"
boolean _mbs_BezC1CoonsFindCornersf ( int spdimen,
int degc00, const float *c00,
int degc01, const float *c01,
int degc10, const float *c10,
int degc11, const float *c11,
float *pcorners,
float *workspace )
{
if ( !_mbs_multiBCHornerDerf ( degc00, 1, spdimen, 0, c00, 0.0,
&pcorners[0], &pcorners[spdimen*8], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc00, 1, spdimen, 0, c00, 1.0,
&pcorners[spdimen*4], &pcorners[spdimen*12], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc10, 1, spdimen, 0, c10, 0.0,
&pcorners[spdimen*1], &pcorners[spdimen*9], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc10, 1, spdimen, 0, c10, 1.0,
&pcorners[spdimen*5], &pcorners[spdimen*13], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc01, 1, spdimen, 0, c01, 0.0,
&pcorners[spdimen*2], &pcorners[spdimen*10], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc01, 1, spdimen, 0, c01, 1.0,
&pcorners[spdimen*6], &pcorners[spdimen*14], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc11, 1, spdimen, 0, c11, 0.0,
&pcorners[spdimen*3], &pcorners[spdimen*11], workspace ) )
return false;
if ( !_mbs_multiBCHornerDerf ( degc11, 1, spdimen, 0, c11, 1.0,
&pcorners[spdimen*7], &pcorners[spdimen*15], workspace ) )
return false;
return true;
} /*_mbs_BezC1CoonsFindCornersf*/
|
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include "amd8111.h"
void amd8111_enable(struct device *dev)
{
struct device *lpc_dev;
struct device *bus_dev;
unsigned index;
unsigned reg_old, reg;
/* See if we are on the bus behind the amd8111 pci bridge */
bus_dev = dev->bus->dev;
if ((bus_dev->vendor == PCI_VENDOR_ID_AMD) &&
(bus_dev->device == PCI_DEVICE_ID_AMD_8111_PCI))
{
unsigned devfn;
devfn = bus_dev->path.pci.devfn + (1 << 3);
lpc_dev = dev_find_slot(bus_dev->bus->secondary, devfn);
index = ((dev->path.pci.devfn & ~7) >> 3) + 8;
if (dev->path.pci.devfn == 2) { /* EHCI */
index = 16;
}
} else {
unsigned devfn;
devfn = (dev->path.pci.devfn) & ~7;
lpc_dev = dev_find_slot(dev->bus->secondary, devfn);
index = dev->path.pci.devfn & 7;
}
if ((!lpc_dev) || (index >= 17)) {
return;
}
if ((lpc_dev->vendor != PCI_VENDOR_ID_AMD) ||
(lpc_dev->device != PCI_DEVICE_ID_AMD_8111_ISA))
{
uint32_t id;
id = pci_read_config32(lpc_dev, PCI_VENDOR_ID);
if (id != (PCI_VENDOR_ID_AMD | (PCI_DEVICE_ID_AMD_8111_ISA << 16))) {
return;
}
}
if (index < 16) {
reg = reg_old = pci_read_config16(lpc_dev, 0x48);
reg &= ~(1 << index);
if (dev->enabled) {
reg |= (1 << index);
}
if (reg != reg_old) {
pci_write_config16(lpc_dev, 0x48, reg);
}
}
else if (index == 16) {
reg = reg_old = pci_read_config8(lpc_dev, 0x47);
reg &= ~(1 << 7);
if (!dev->enabled) {
reg |= (1 << 7);
}
if (reg != reg_old) {
pci_write_config8(lpc_dev, 0x47, reg);
}
}
}
struct chip_operations southbridge_amd_amd8111_ops = {
CHIP_NAME("AMD-8111 Southbridge")
/* This only called when this device is listed in the
* static device tree.
*/
.enable_dev = amd8111_enable,
};
|
#ifndef WINDOW_H
#define WINDOW_H
#include <QMainWindow>
//------------------------------------------------------------------------------
class GLWidget;
#define ICON_FILE "/usr/share/games/vextris/vextris.png"
//------------------------------------------------------------------------------
// Main Window
//------------------------------------------------------------------------------
class Window : public QMainWindow{
Q_OBJECT
public:
Window();
private slots:
void aboutVexTris();
private:
void createActions();
void createMenus();
void createStatusBar();
//
QSize* wndSize;
GLWidget* glWidget;
QMenu* pFileMenu;
QAction* pNewGame;
QAction* pPauseGame;
QAction* pQuitGame;
QMenu* pHelpMenu;
QAction* pAboutGame;
QIcon icon;
};
#endif
|
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2000-2012 Julian Seward
jseward@acm.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.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_SIGNALS_H
#define __PUB_CORE_SIGNALS_H
#include "pub_tool_signals.h"
extern Int VG_(max_signal);
extern const Char *VG_(signame)(Int sigNo);
#define VG_SIGVGKILL (VG_(max_signal)-0)
#define VG_SIGVGRTUSERMAX (VG_(max_signal)-1)
extern void VG_(sigstartup_actions) ( void );
extern void VG_(poll_signals) ( ThreadId );
extern SysRes VG_(do_sys_sigaltstack) ( ThreadId tid, vki_stack_t* ss,
vki_stack_t* oss );
extern SysRes VG_(do_sys_sigaction) ( Int signo,
const vki_sigaction_toK_t* new_act,
vki_sigaction_fromK_t* old_act );
extern SysRes VG_(do_sys_sigprocmask) ( ThreadId tid, Int how,
vki_sigset_t* set,
vki_sigset_t* oldset );
extern void VG_(clear_out_queued_signals)
( ThreadId tid, vki_sigset_t* saved_mask );
extern void VG_(kill_self)(Int sigNo);
extern void VG_(synth_fault) (ThreadId tid);
extern void VG_(synth_fault_mapping)(ThreadId tid, Addr addr);
extern void VG_(synth_fault_perms) (ThreadId tid, Addr addr);
extern void VG_(synth_sigill) (ThreadId tid, Addr addr);
extern void VG_(synth_sigtrap) (ThreadId tid);
extern void VG_(synth_sigbus) (ThreadId tid);
extern Bool VG_(extend_stack)(Addr addr, UInt maxsize);
extern void VG_(set_default_handler)(Int sig);
#endif
|
// timer.c -- Initialises the PIT, and handles clock updates.
// Written for JamesM's kernel development tutorials.
#include "timer.h"
#include "isr.h"
#include "monitor.h"
u32int tick = 0;
static void timer_callback(registers_t regs)
{
tick++;
monitor_write("Tick: ");
monitor_write_dec(tick);
monitor_write("\n");
}
void init_timer(u32int frequency)
{
// Firstly, register our timer callback.
register_interrupt_handler(IRQ0, &timer_callback);
// The value we send to the PIT is the value to divide it's input clock
// (1193180 Hz) by, to get our required frequency. Important to note is
// that the divisor must be small enough to fit into 16-bits.
u32int divisor = 1193180 / frequency;
// Send the command byte.
outb(0x43, 0x36);
// Divisor has to be sent byte-wise, so split here into upper/lower bytes.
u8int l = (u8int)(divisor & 0xFF);
u8int h = (u8int)( (divisor>>8) & 0xFF );
// Send the frequency divisor.
outb(0x40, l);
outb(0x40, h);
}
|
/******************************************************************************
*
*
*
* Copyright (C) 1997-2013 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef DEFINE_H
#define DEFINE_H
#include <qdict.h>
#include <qlist.h>
class FileDef;
/** A class representing a macro definition. */
class Define
{
public:
Define();
Define(const Define &d);
~Define();
bool hasDocumentation();
QCString name;
QCString definition;
QCString fileName;
QCString doc;
QCString brief;
QCString args;
QCString anchor;
FileDef *fileDef;
int lineNr;
int nargs;
bool undef;
bool varArgs;
bool isPredefined;
bool nonRecursive;
};
/** A list of Define objects. */
class DefineList : public QList<Define>
{
public:
DefineList() : QList<Define>() {}
~DefineList() {}
int compareItems(QCollection::Item i1,QCollection::Item i2)
{
return qstricmp(((Define *)i1)->name,((Define *)i2)->name);
}
};
/** A list of Define objects associated with a specific name. */
class DefineName : public QList<Define>
{
public:
DefineName(const char *n) : QList<Define>() { name=n; }
~DefineName() {}
const char *nameString() const { return name; }
int compareItems(QCollection::Item i1,QCollection::Item i2)
{
return qstricmp(((Define *)i1)->name,((Define *)i2)->name);
}
private:
QCString name;
};
/** A list of DefineName objects. */
class DefineNameList : public QList<DefineName>
{
public:
DefineNameList() : QList<DefineName>() {}
~DefineNameList() {}
int compareItems(QCollection::Item i1,QCollection::Item i2)
{
return qstricmp(((DefineName *)i1)->nameString(),
((DefineName *)i2)->nameString());
}
};
/** An unsorted dictionary of Define objects. */
typedef QDict<Define> DefineDict;
/** A sorted dictionary of DefineName object. */
typedef QDict<DefineName> DefineNameDict;
#endif
|
/* rpctypes.h
* -*- coding: utf-8 -*-
*
* Author: Andreas Büsching <crunchy@bitkipper.net>
*
* Copyright (C) 2004, 2005, 2006, 2007
* Andreas Büsching <crunchy@bitkipper.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, 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 RPC_TYPES_HH
#define RPC_TYPES_HH
#include "gmbus/maddress.h"
#include "gmbus/mcommand.h"
#include "gmbus/mtypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
\addtogroup rpctypes RPC Types
\{
*/
/**
Defining all possible states an RPC return may have.
*/
typedef enum { RPC_OK, RPC_FAILED, RPC_UNKNOWN } RPCStatus;
/**
Defining all possible types of an RPC command.
*/
typedef enum { RPC_UNICAST, RPC_ANYCAST } RPCType;
/**
\brief Represents on Mbus RPC command.
*/
typedef struct {
/** The source of the RPC command */
MAddress * source;
/** The command name */
gchar * command;
/** The unique RPC id */
MObject * id;
/** The RPC type of this command */
RPCType type;
/** The arguments of this command */
MObject * arguments;
} RPCCommand;
/**
\brief Describes an RPC return command.
*/
typedef struct {
/** The name of the RPC command is return is for. */
gchar * command;
/** The unique of the RPC command is RPC return belongs to */
MObject * id;
/** The RPC status */
RPCStatus status;
/** The application return status */
RPCStatus app_status;
/** A symbol describing the return status */
gchar * app_result;
/** A short description of the return status */
gchar * app_description;
/** The optional return arguments */
MObject * arguments;
} RPCReturn;
/**
\brief This type of function is used for RPC command callback functions
*/
typedef RPCReturn * ( *RPCCommandFunc )( const RPCCommand * cmd,
gpointer data );
/**
\brief This type of function is used for RPC return callback functions
*/
typedef void ( *RPCReturnFunc )( const RPCReturn * ret, gpointer data );
/**
Encapsulate a callback function for RPC commands and an optional argument
passed to this function as a second argument
*/
typedef struct {
RPCCommandFunc function;
gpointer data;
} RPCCommandCallback;
/**
Encapsulate a callback function for RPC return commands and an optional
argument passed to this function as a second argument
*/
typedef struct {
RPCReturnFunc function;
gpointer data;
} RPCReturnCallback;
RPCCommand * rpc_command_new( const gchar * name );
RPCCommand * rpc_command_new_from_command( MCommand * command );
void rpc_command_free( RPCCommand * self );
RPCReturn * rpc_return_new_from_command( MCommand * command );
RPCReturn * rpc_return_new( const RPCCommand * cmd, RPCStatus status );
void rpc_return_free( RPCReturn * self );
void rpc_return_set_arguments( RPCReturn * self, MObject * args );
/**
\}
*/
#ifdef __cplusplus
}
#endif
#endif
/* end of rpctypes.h */
|
/*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland <swetland@google.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.
*
*
* The MSM peripherals are spread all over across 768MB of physical
* space, which makes just having a simple IO_ADDRESS macro to slide
* them into the right virtual location rough. Instead, we will
* provide a master phys->virt mapping for peripherals here.
*
*/
#ifndef __ASM_ARCH_MSM_IOMAP_8960_H
#define __ASM_ARCH_MSM_IOMAP_8960_H
/* Physical base address and size of peripherals.
* Ordered by the virtual base addresses they will be mapped at.
*
* If you add or remove entries here, you'll want to edit the
* msm_io_desc array in arch/arm/mach-msm/io.c to reflect your
* changes.
*
*/
#define MSM8960_QGIC_DIST_PHYS 0x02000000
#define MSM8960_QGIC_DIST_SIZE SZ_4K
#define MSM8960_QGIC_CPU_PHYS 0x02002000
#define MSM8960_QGIC_CPU_SIZE SZ_4K
#define MSM8960_TMR_PHYS 0x0200A000
#define MSM8960_TMR_SIZE SZ_4K
#define MSM8960_TMR0_PHYS 0x0208A000
#define MSM8960_TMR0_SIZE SZ_4K
#ifdef CONFIG_DEBUG_MSM8960_UART
#define MSM_DEBUG_UART_BASE 0xE1040000
#define MSM_DEBUG_UART_PHYS 0x16440000
#endif
#ifndef __ASSEMBLY__
extern void msm_map_msm8960_io(void);
#endif
#endif
|
/*
* Copyright (C) 2015 Ted Meyer
*
* see LICENSING for details
*
*/
#ifndef _LWXT_H_
#define _LWXT_H_
int lwxt_setup(void);
char* expand_escapes(const char *src);
int get_active_window(xcb_window_t *win);
void get_window_title(xcb_window_t win, char *title, size_t len);
void get_title(char * buffer, size_t buf_len);
#define MAXLEN 256
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
|
/*
* Copyright (C) 2010 - 2014 Eluna Lua Engine <http://emudevs.com/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef BATTLEGROUNDMETHODS_H
#define BATTLEGROUNDMETHODS_H
namespace LuaBattleGround
{
/**
* Returns the name of the [Battleground]
*
* @return string name
*/
int GetName(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetName());
return 1;
}
/**
* Returns the amount of alive players in the [Battleground] by the team ID.
*
* @param uint32 team : team ID
* @return uint32 count
*/
int GetAlivePlayersCountByTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
return 1;
}
/**
* Returns the [Map] of the [Battleground].
*
* @return [Map] map
*/
int GetMap(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBgMap());
return 1;
}
/**
* Returns the bonus honor given by amount of kills in the specific [Battleground].
*
* @param uint32 kills : amount of kills
* @return uint32 bonusHonor
*/
int GetBonusHonorFromKillCount(lua_State* L, BattleGround* bg)
{
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetBonusHonorFromKill(kills));
return 1;
}
/**
* Returns the bracket ID of the specific [Battleground].
*
* @return BattleGroundBracketId bracketId
*/
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
}
/**
* Returns the end time of the [Battleground].
*
* @return uint32 endTime
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime());
#endif
return 1;
}
/**
* Returns the amount of free slots for the selected team in the specific [Battleground].
*
* @param uint32 team : team ID
* @return uint32 freeSlots
*/
int GetFreeSlotsForTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
return 1;
}
/**
* Returns the instance ID of the [Battleground].
*
* @return uint32 instanceId
*/
int GetInstanceId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetInstanceID());
return 1;
}
/**
* Returns the map ID of the [Battleground].
*
* @return uint32 mapId
*/
int GetMapId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMapId());
return 1;
}
/**
* Returns the type ID of the [Battleground].
*
* @return BattleGroundTypeId typeId
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetTypeID());
return 1;
}
/**
* Returns the max allowed [Player] level of the specific [Battleground].
*
* @return uint32 maxLevel
*/
int GetMaxLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxLevel());
return 1;
}
/**
* Returns the minimum allowed [Player] level of the specific [Battleground].
*
* @return uint32 minLevel
*/
int GetMinLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinLevel());
return 1;
}
/**
* Returns the maximum allowed [Player] count of the specific [Battleground].
*
* @return uint32 maxPlayerCount
*/
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayers());
return 1;
}
/**
* Returns the minimum allowed [Player] count of the specific [Battleground].
*
* @return uint32 minPlayerCount
*/
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayers());
return 1;
}
/**
* Returns the maximum allowed [Player] count per team of the specific [Battleground].
*
* @return uint32 maxTeamPlayerCount
*/
int GetMaxPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayersPerTeam());
return 1;
}
/**
* Returns the minimum allowed [Player] count per team of the specific [Battleground].
*
* @return uint32 minTeamPlayerCount
*/
int GetMinPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayersPerTeam());
return 1;
}
/**
* Returns the winning team of the specific [Battleground].
*
* @return Team team
*/
int GetWinner(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetWinner());
return 1;
}
/**
* Returns the status of the specific [Battleground].
*
* @return BattleGroundStatus status
*/
int GetStatus(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetStatus());
return 1;
}
};
#endif |
#ifndef CSIZE_H
#define CSIZE_H
/*
* CSize.h, part of MAG
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace mag
{
class CSize
{
public:
CSize();
CSize(int width, int height);
int getWidth() const;
void setWidth(int value);
int getHeight() const;
void setHeight(int value);
void setSize(CSize size);
void setSize(int width, int height);
protected:
int width;
int height;
};
}
#endif // CSIZE_H
|
/*
* sst_match_apci.c - SST (LPE) match for ACPI enumeration.
*
* Copyright (c) 2013-15, Intel Corporation.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include "sst-acpi.h"
static acpi_status sst_acpi_find_name(acpi_handle handle, u32 level,
void *context, void **ret)
{
struct acpi_device *adev;
const char *name = NULL;
if (acpi_bus_get_device(handle, &adev))
return AE_OK;
if (adev->status.present && adev->status.functional) {
name = acpi_dev_name(adev);
*(const char **)ret = name;
return AE_CTRL_TERMINATE;
}
return AE_OK;
}
const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
{
const char *name = NULL;
acpi_status status;
status = acpi_get_devices(hid, sst_acpi_find_name, NULL,
(void **)&name);
if (ACPI_FAILURE(status) || name[0] == '\0')
return NULL;
return name;
}
EXPORT_SYMBOL_GPL(sst_acpi_find_name_from_hid);
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
unsigned long long sta;
acpi_status status;
*(bool *)context = true;
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
*(bool *)context = false;
return AE_OK;
}
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
{
struct sst_acpi_mach *mach;
bool found = false;
for (mach = machines; mach->id[0]; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->id,
sst_acpi_mach_match,
&found, NULL)) && found)
return mach;
return NULL;
}
EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
static acpi_status sst_acpi_find_package(acpi_handle handle, u32 level,
void *context, void **ret)
{
struct acpi_device *adev;
acpi_status status = AE_OK;
struct sst_acpi_package_context *pkg_ctx = context;
pkg_ctx->data_valid = false;
if (acpi_bus_get_device(handle, &adev))
return AE_OK;
if (adev->status.present && adev->status.functional) {
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *myobj = NULL;
status = acpi_evaluate_object_typed(handle, pkg_ctx->name,
NULL, &buffer,
ACPI_TYPE_PACKAGE);
if (ACPI_FAILURE(status))
return AE_OK;
myobj = buffer.pointer;
if (!myobj || myobj->package.count != pkg_ctx->length) {
kfree(buffer.pointer);
return AE_OK;
}
status = acpi_extract_package(myobj,
pkg_ctx->format, pkg_ctx->state);
if (ACPI_FAILURE(status)) {
kfree(buffer.pointer);
return AE_OK;
}
kfree(buffer.pointer);
pkg_ctx->data_valid = true;
return AE_CTRL_TERMINATE;
}
return AE_OK;
}
bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
struct sst_acpi_package_context *ctx)
{
acpi_status status;
status = acpi_get_devices(hid, sst_acpi_find_package, ctx, NULL);
if (ACPI_FAILURE(status) || !ctx->data_valid)
return false;
return true;
}
EXPORT_SYMBOL_GPL(sst_acpi_find_package_from_hid);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Intel Common ACPI Match module");
|
/* This file is part of the KDE project
Copyright (C) 2002 Lubos Lunak <l.lunak@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KONQUEROR_PRELOADER_H
#define _KONQUEROR_PRELOADER_H
#include <kdedmodule.h>
#include <qtimer.h>
class KonqyPreloader : public KDEDModule {
Q_OBJECT
K_DCOP
public:
KonqyPreloader(const QCString &obj);
virtual ~KonqyPreloader();
k_dcop : bool registerPreloadedKonqy(QCString id, int screen);
QCString getPreloadedKonqy(int screen);
ASYNC unregisterPreloadedKonqy(QCString id);
void reconfigure();
void unloadAllPreloaded();
private slots:
void appRemoved(const QCString &id);
void checkAlwaysPreloaded();
private:
void updateCount();
struct KonqyData
{
KonqyData(){}; // for QValueList
KonqyData(const QCString &id_P, int screen_P) : id(id_P), screen(screen_P)
{
}
QCString id;
int screen;
};
typedef QValueList< KonqyData > InstancesList;
InstancesList instances;
QTimer check_always_preloaded_timer;
};
#endif
|
#ifndef _PERROR_EXIT_H_
# define _PERROR_EXIT_H_
#ifdef DEBUG
# define MALLOCATE(var,type,size) {fprintf(stderr,"allocating %d bytes\n",size); if(!(var=(type)malloc(size))) perror_exit("%s:%d ",__FILE__,__LINE__);}
# define REMALLOCATE(var,type,size) if(!(var=(type)realloc(var,size))) perror_exit("%s:%d ",__FILE__,__LINE__);
#
# define DMESG(fmt,...) fprintf(stderr,"debug: "); fprintf(stderr,fmt,##__VA_ARGS__);
#
#else
#
# define MALLOCATE(var,type,size) if(!(var=(type)malloc(size))) perror_exit("%s:%d ",__FILE__,__LINE__);
# define REMALLOCATE(var,type,size) if(!(var=(type)realloc(var,size))) perror_exit("%s:%d ",__FILE__,__LINE__);
#
# define DMESG(fmt,...)
#
#endif
#define perror_exit(fmt,...) { perror(cat(fmt,##__VA_ARGS__)); exit(EXIT_FAILURE); }
#define perror_noexit(fmt,...) { perror(cat(fmt,##__VA_ARGS__)); }
#define error_exit(fmt,...) { fprintf(stderr,fmt,##__VA_ARGS__); exit(EXIT_FAILURE); }
#define error_noexit(fmt,...) { fprintf(stderr,fmt,##__VA_ARGS__); }
char *
cat(const char *fmt, ...);
/*
char *
concatenate(char *str1, const char *str2);
*/
#endif
|
/*
* Qtstalker stock charter
*
* Copyright (C) 2001-2010 Stefan S. Stratigakos
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#ifndef SETUP_HPP
#define SETUP_HPP
#include <QString>
#include <QObject>
class Setup
{
public:
Setup ();
void setup (QObject *, QString session);
void setupDirectories ();
void setupDefaults ();
void setupDefaultIndicators ();
void setupDefaultScripts ();
void setupExchanges ();
};
#endif
|
// Fish.h: interface for the Fish class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FISH_H__80D3FEE3_0EA9_4A73_898A_F9315D8AD05B__INCLUDED_)
#define AFX_FISH_H__80D3FEE3_0EA9_4A73_898A_F9315D8AD05B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <hgesprite.h>
#include <hgevector.h>
#include <hgeparticle.h>
#include <list>
#include "constants.h"
#include "Bait.h"
#include "ScoreAnimation.h"
//#include "RunningComponent.h"
using namespace std;
class RunningComponent;
class BaitCollection;
class Fish
{
friend class BaitCollection;
public:
ChangeVelocity(float);
Fish(int, hgeSprite *sprite, int, float, float, hgeVector);
KilldedByBomb();
float GetSqrtDistanceFromPoint(float x, float y);
ScoreAnimation* GetScoreAnimation();
SetScoreAnimation(ScoreAnimation*);
int GetScore();
hgeVector& GetSpeed();
bool GetDyingState();
bool InsideBoundaryRect(float x, float y);
hgeRect GetBoundaryRect();
bool OutOfScreen();
float getHeight();
float getWidth();
MoveTo(float x, float y);
Draw();
Update(float);
SetComponent(RunningComponent* lpComponent);
hgeVector GetCenter();
SetDying();
float GetTimeLeftToDie();
~Fish();
private:
int kindId;
hgeSprite *sprite;
int score;
float positionX;
float positionY;
HTEXTURE texture;
hgeVector speed;
float width;
float height;
bool hungry;
hgeParticleSystem* particleSystem;
RunningComponent* lpComponent;
bool dying;
float timeLeftToDie;
hgeSprite* particleSprite;
ScoreAnimation *scoreAnimation;
};
#endif // !defined(AFX_FISH_H__80D3FEE3_0EA9_4A73_898A_F9315D8AD05B__INCLUDED_)
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#ifndef USE_VCHIQ_ARM
#define USE_VCHIQ_ARM
#endif
#ifndef __VIDEOCORE4__
#define __VIDEOCORE4__
#endif
#ifndef HAVE_VMCS_CONFIG
#define HAVE_VMCS_CONFIG
#endif
#if defined(HAVE_CONFIG_H) && !defined(TARGET_WINDOWS)
#include "config.h"
#define DECLARE_UNUSED(a,b) a __attribute__((unused)) b;
#endif
#if defined(TARGET_RASPBERRY_PI)
#include "DllBCM.h"
#include "OMXCore.h"
class CRBP
{
public:
CRBP();
~CRBP();
bool Initialize();
void LogFirmwareVerison();
void Deinitialize();
int GetArmMem() { return m_arm_mem; }
int GetGpuMem() { return m_gpu_mem; }
private:
DllBcmHost *m_DllBcmHost;
bool m_initialized;
bool m_omx_initialized;
int m_arm_mem;
int m_gpu_mem;
COMXCore *m_OMX;
};
extern CRBP g_RBP;
#endif
|
/**
******************************************************************************
* @file EXTI_Example/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.0.0
* @date 11-September-2013
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
#include "stm32f401_discovery.h"
/** @addtogroup STM32F401_Discovery_Peripheral_Examples
* @{
*/
/** @addtogroup EXTI_Example
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f401xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @brief This function handles External line 0 interrupt request.
* @param None
* @retval None
*/
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0) != RESET)
{
/* Toggle LED4 */
STM_EVAL_LEDToggle(LED4);
/* Clear the EXTI line 0 pending bit */
EXTI_ClearITPendingBit(EXTI_Line0);
}
}
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*****************************************************************************
1 Include Head file
*****************************************************************************/
#include <linux/delay.h>
#include "oal_ext_if.h"
#include "hw_bfg_ps.h"
#include "plat_debug.h"
#include "plat_pm.h"
#include "bfgx_exception_rst.h"
/*****************************************************************************
2 Define global variable
*****************************************************************************/
/*****************************************************************************
3 Function implement
*****************************************************************************/
void host_allow_bfg_sleep(struct ps_core_s *ps_core_d)
{
struct pm_drv_data *pm_data = pm_get_drvdata();
if (NULL == pm_data)
{
PS_PRINT_ERR("pm_data is NULL!\n");
return;
}
PS_PRINT_INFO("%s\n", __func__);
if (false == ps_core_d->tty_have_open)
{
PS_PRINT_INFO("tty has closed, not send msg to dev\n");
return;
}
spin_lock(&pm_data->node_timer_spinlock);
/* if someone is visiting the dev_node */
if (atomic_read(&ps_core_d->node_visit_flag) > 0 )
{
PS_PRINT_INFO("someone visit node, not send allow sleep msg\n");
spin_unlock(&pm_data->node_timer_spinlock);
/* gnss write do NOT mod timer */
mod_timer(&pm_data->bfg_timer, jiffies + BT_SLEEP_TIME * HZ);
return;
}
/* ÉèÖÃdevice״̬Ϊ˯Ãß̬£¬ÔÚhost»½ÐÑdevÍê³É֮ǰ(»òdev»½ÐÑhostǰ)uart²»¿ÉÓà */
ps_core_d->ps_pm->bfgx_uart_state_set(UART_NOT_READY);
ps_core_d->ps_pm->bfgx_dev_state_set(BFGX_SLEEP);
spin_unlock(&pm_data->node_timer_spinlock);
mod_timer(&pm_data->dev_ack_timer, jiffies + (WAIT_DEVACK_MSEC * HZ / 1000));
/* we need reinit completion cnt as 0, to prevent such case:
* 1)host allow dev sleep, dev ack with OK, cnt=1,
* 2)device wkup host,
* 3)host allow dev sleep,
* 4)host wkup dev, it will wait dev_ack succ immediately since cnt==1,
* 5)dev ack with ok, cnt=2,
* this case will cause host wait dev_ack invalid.
*/
INIT_COMPLETION(pm_data->dev_ack_comp);
ps_tx_sys_cmd(ps_core_d, SYS_MSG, SYS_CFG_ALLOWDEV_SLP);
}
/**
* Prototype : bfgx_wakeup_device
* Description : check bfg device state for transfer data
* input : ps_core_d
* output : no
* Calls :
* Called By :
*
* History :
* 1.Date : 2013/05/09
* Author : wx145522
* Modification : Created function
*
*/
/**
* Prototype : bfg_timer_expire
* Description : bfg timer expired function
* input : uint64
* output : no
* Calls :
* Called By :
*
* History :
* 1.Date : 2013/05/09
* Author : wx145522
* Modification : Created function
*
*/
void bfg_timer_expire(uint64 data)
{
struct ps_core_s *ps_core_d = NULL;
struct pm_drv_data *pm_data = (struct pm_drv_data*)data;
if (unlikely(NULL == pm_data))
{
PS_PRINT_ERR("pm_data is null\n");
return;
}
ps_core_d = pm_data->ps_pm_interface->ps_core_data;
PS_PRINT_INFO("%s\n", __func__);
if (BFGX_PM_DISABLE == pm_data->bfgx_lowpower_enable)
{
PS_PRINT_DBG("lowpower function disabled\n");
return;
}
if (BFGX_SLEEP == pm_data->ps_pm_interface->bfgx_dev_state_get())
{
PS_PRINT_DBG("dev has been sleep\n");
return;
}
if (GNSS_AGREE_SLEEP == atomic_read(&pm_data->gnss_sleep_flag))
{
host_allow_bfg_sleep(ps_core_d);
}
else
{
mod_timer(&pm_data->bfg_timer, jiffies + BT_SLEEP_TIME * HZ);
}
}
|
#include "innbbsconf.h"
#include "bbslib.h"
extern char *optarg;
extern int opterr, optind;
usage(name)
char *name;
{
fprintf(stderr, "Usage: %s [-p path] commands\n",name);
fprintf(stderr, " where available commands:\n");
fprintf(stderr," ctlinnbbsd reload : reload datafiles for innbbsd\n");
fprintf(stderr," ctlinnbbsd shutdown : shutdown innbbsd gracefully\n");
fprintf(stderr," ctlinnbbsd mode : examine mode of innbbsd\n");
fprintf(stderr," ctlinnbbsd addhist <mid> path: add history\n");
fprintf(stderr," ctlinnbbsd grephist <mid>: query history\n");
fprintf(stderr," ctlinnbbsd verboselog on|off : verboselog on/off\n");
fprintf(stderr," ctlinnbbsd hismaint : maintain history\n");
fprintf(stderr," ctlinnbbsd listnodelist : list nodelist.bbs\n");
fprintf(stderr," ctlinnbbsd listnewsfeeds : list newsfeeds.bbs\n");
#ifdef GETRUSAGE
fprintf(stderr," ctlinnbbsd getrusage: get resource usage\n");
#endif
#ifdef MALLOCMAP
fprintf(stderr," ctlinnbbsd mallocmap: get malloc map\n");
#endif
}
char *DefaultPath = LOCALDAEMON;
char INNBBSbuffer[4096];
FILE *innbbsin, *innbbsout;
int innbbsfd;
ctlinnbbsd(argc, argv)
int argc;
char **argv;
{
fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin);
printf("%s",INNBBSbuffer);
if (strcasecmp(argv[0], "shutdown")==0 ||
strcasecmp(argv[0], "reload")==0 ||
strcasecmp(argv[0], "hismaint")==0 ||
#ifdef GETRUSAGE
strcasecmp(argv[0], "getrusage")==0 ||
#endif
#ifdef MALLOCMAP
strcasecmp(argv[0], "mallocmap")==0 ||
#endif
strcasecmp(argv[0], "mode")==0 ||
strcasecmp(argv[0], "listnodelist")==0 ||
strcasecmp(argv[0], "listnewsfeeds")==0
) {
fprintf( innbbsout, "%s\r\n", argv[0]);
fflush( innbbsout);
fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin);
printf("%s",INNBBSbuffer);
if (strcasecmp(argv[0], "mode") ==0
#ifdef GETRUSAGE
||
strcasecmp(argv[0], "getrusage") ==0
||
strcasecmp(argv[0], "mallocmap") ==0
#endif
||
strcasecmp(argv[0], "listnodelist")==0
||
strcasecmp(argv[0], "listnewsfeeds")==0
) {
while (fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin) != NULL) {
if (strcmp(INNBBSbuffer,".\r\n")==0) {
break;
}
printf("%s",INNBBSbuffer);
}
}
} else if (strcasecmp(argv[0], "grephist")==0 ||
strcasecmp(argv[0], "verboselog")==0 ) {
if (argc < 2) {
usage("ctlinnbbsd");
} else {
fprintf( innbbsout, "%s %s\r\n", argv[0], argv[1]);
fflush( innbbsout);
fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin);
printf("%s\n",INNBBSbuffer);
}
} else if (strcasecmp(argv[0], "addhist")==0) {
if (argc < 3) {
usage("ctlinnbbsd");
} else {
fprintf( innbbsout, "%s %s %s\r\n", argv[0], argv[1], argv[2]);
fflush( innbbsout);
fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin);
printf("%s",INNBBSbuffer);
}
} else {
fprintf(stderr, "invalid command %s\n", argv[0]);
}
if (strcasecmp(argv[0],"shutdown") != 0) {
fprintf( innbbsout, "QUIT\r\n");
fflush(innbbsout);
fgets(INNBBSbuffer, sizeof INNBBSbuffer, innbbsin);
}
}
initsocket()
{
innbbsfd = unixclient(DefaultPath,"tcp");
if (innbbsfd < 0) {
fprintf(stderr, "Connect to %s error. You may not run innbbsd\n", DefaultPath);
exit(2);
}
if ( (innbbsin= fdopen(innbbsfd,"r")) == NULL ||
(innbbsout= fdopen(innbbsfd,"w"))== NULL ) {
fprintf( stderr, "fdopen error\n");
exit(3);
}
}
closesocket()
{
if (innbbsin != NULL)
fclose(innbbsin);
if (innbbsout != NULL)
fclose(innbbsout);
if (innbbsfd >= 0)
close(innbbsfd);
}
main(argc, argv)
int argc;
char **argv;
{
int c, errflag=0;
while ((c = getopt(argc,argv,"p:h?"))!= -1)
switch (c) {
case 'p':
DefaultPath = optarg;
break;
case 'h':
case '?':
default:
errflag ++;
break;
}
if (errflag > 0) {
usage(argv[0]);
return(1);
}
if (argc - optind < 1) {
usage(argv[0]);
exit(1);
}
initial_bbs(NULL);
initsocket();
ctlinnbbsd(argc-optind, argv+optind);
closesocket();
}
|
#ifndef WEBSOCKET_CONNECTION_CONFIG_H
#define WEBSOCKET_CONNECTION_CONFIG_H
#include <memory>
#include <Arduino.h>
#include <ArduinoJson.h>
#include "../../configuration/default/configuration.h"
#include "../../configuration/default/default_pins.h"
#include "../../configuration/base/configbase.h"
class Websocket_connection_config : public Configbase{
public:
Websocket_connection_config(byte id) : Configbase(id, Configurations::WEBSOCKET_CONNECTION_CONFIG) {
}
void getModuleConfiguration(JsonObject &root)
{
root["port"] = port;
root["clientMax"] = clientMax;
}
void setModuleConfiguration(JsonObject &root)
{
port = int(root["port"]);
clientMax = byte(root["clientMax"]);
}
int port = WEBSOCKET_PORT;
byte clientMax = 2;
};
#endif
|
/***************************************************************************
* Copyright (c) 1999-2009, Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Module Description:
* DO NOT EDIT THIS FILE DIRECTLY
*
* This module was generated magically with RDB from a source description
* file. You must edit the source file for changes to be made to this file.
*
*
* Date: Generated on Tue Nov 17 17:16:58 2009
* MD5 Checksum 7635c8e6fce632fc8dd4fb82126b3847
*
* Compiled with: RDB Utility combo_header.pl
* RDB Parser 3.0
* unknown unknown
* Perl Interpreter 5.008008
* Operating System linux
*
* Revision History:
*
* $brcm_Log: /magnum/basemodules/chp/7342/rdb/b0/bchp_wktmr.h $
*
* Hydra_Software_Devel/1 11/17/09 9:13p albertl
* SW7342-78: Initial revision.
*
***************************************************************************/
#ifndef BCHP_WKTMR_H__
#define BCHP_WKTMR_H__
/***************************************************************************
*WKTMR - Wakeup timer
***************************************************************************/
#define BCHP_WKTMR_EVENT 0x00406c80 /* Wakeup Timer Register */
#define BCHP_WKTMR_COUNTER 0x00406c84 /* Wakeup Counter */
#define BCHP_WKTMR_ALARM 0x00406c88 /* Wakeup Timer Alarm */
#define BCHP_WKTMR_PRESCALER 0x00406c8c /* Wakeup Timer Prescaler */
#define BCHP_WKTMR_PRESCALER_VAL 0x00406c90 /* Wakeup Timer Prescaler Value */
/***************************************************************************
*EVENT - Wakeup Timer Register
***************************************************************************/
/* WKTMR :: EVENT :: reserved0 [31:01] */
#define BCHP_WKTMR_EVENT_reserved0_MASK 0xfffffffe
#define BCHP_WKTMR_EVENT_reserved0_SHIFT 1
/* WKTMR :: EVENT :: wktmr_alarm_event [00:00] */
#define BCHP_WKTMR_EVENT_wktmr_alarm_event_MASK 0x00000001
#define BCHP_WKTMR_EVENT_wktmr_alarm_event_SHIFT 0
/***************************************************************************
*COUNTER - Wakeup Counter
***************************************************************************/
/* WKTMR :: COUNTER :: wktmr_counter [31:00] */
#define BCHP_WKTMR_COUNTER_wktmr_counter_MASK 0xffffffff
#define BCHP_WKTMR_COUNTER_wktmr_counter_SHIFT 0
/***************************************************************************
*ALARM - Wakeup Timer Alarm
***************************************************************************/
/* WKTMR :: ALARM :: wktmr_alarm [31:00] */
#define BCHP_WKTMR_ALARM_wktmr_alarm_MASK 0xffffffff
#define BCHP_WKTMR_ALARM_wktmr_alarm_SHIFT 0
/***************************************************************************
*PRESCALER - Wakeup Timer Prescaler
***************************************************************************/
/* WKTMR :: PRESCALER :: reserved0 [31:25] */
#define BCHP_WKTMR_PRESCALER_reserved0_MASK 0xfe000000
#define BCHP_WKTMR_PRESCALER_reserved0_SHIFT 25
/* WKTMR :: PRESCALER :: wktmr_prescaler [24:00] */
#define BCHP_WKTMR_PRESCALER_wktmr_prescaler_MASK 0x01ffffff
#define BCHP_WKTMR_PRESCALER_wktmr_prescaler_SHIFT 0
/***************************************************************************
*PRESCALER_VAL - Wakeup Timer Prescaler Value
***************************************************************************/
/* WKTMR :: PRESCALER_VAL :: reserved0 [31:25] */
#define BCHP_WKTMR_PRESCALER_VAL_reserved0_MASK 0xfe000000
#define BCHP_WKTMR_PRESCALER_VAL_reserved0_SHIFT 25
/* WKTMR :: PRESCALER_VAL :: wktmr_prescaler_val [24:00] */
#define BCHP_WKTMR_PRESCALER_VAL_wktmr_prescaler_val_MASK 0x01ffffff
#define BCHP_WKTMR_PRESCALER_VAL_wktmr_prescaler_val_SHIFT 0
#endif /* #ifndef BCHP_WKTMR_H__ */
/* End of File */
|
#ifndef _PARISC_REAL_H
#define _PARISC_REAL_H
#endif
|
#ifndef _HLS_H_
#define _HLS_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HLS_DEBUG
#ifdef HLS_DEBUG
#define HLS_PRINTF printf
#else
#define HLS_PRINTF(...) do{}while(0)
#endif
#define UINT32 unsigned int
#define UINT8 unsigned char
#define HLS_MAX_URL_LEN 1024
#define HLS_MAX_LIST_NODE_COUNT 5
#define HLS_MAX_TS_NODE_COUNT 4
#define HLS_URL_BUFFER_SIZE (200*256)
typedef struct hls_list_node_s
{
UINT32 bandwidth;
UINT32 program_id;
UINT32 video_width;
UINT32 video_height;
char *url;
}hls_list_node_t;
typedef struct hls_ts_node_s
{
char* url;
UINT32 section_duration;
UINT32 uNextNodeIndex;
UINT8 bIsUsed;
}hls_ts_node_t;
struct MemoryStruct {
char *memory;
size_t size;
};
typedef struct _memory_stream_info {
char *begin;
UINT32 size;
UINT32 offset;
}memory_stream_info;
#define HLS_STREAMINFO "#EXT-X-STREAM-INF"
#define HLS_STREAMINFO_BANDWIDTH "BANDWIDTH"
#define HLS_STREAMINFO_PROGRAMID "PROGRAM-ID"
#define HLS_EXTINF "#EXTINF"
#define HLS_TARGETDURATION "#EXT-X-TARGETDURATION"
#define HLS_MEDIA_SEQUENCE "#EXT-X-MEDIA-SEQUENCE"
#define HLS_KEY "#EXT-X-KEY"
#define HLS_ENDLIST "#EXT-X-ENDLIST"
#define HLS_HTTP_URL_FLAG "http://"
extern char *url_buffer_addr;
extern UINT8 m3u8_num;
extern UINT8 ts_num;
#define MEMSET memset
#define MALLOC malloc
#define STRCPY strcpy
#define MEMCMP memcmp
void sky_hls_test_main(void);
#endif
|
#pragma once
#include <iostream>
template <class T>
struct Node {
T data;
Node<T>* next;
Node<T>* prev;
};
template <class T>
class LinkedList {
int size;
int count;
int grow;
Node<T>* head;
Node<T>* tail;
void AddBack() {
Node<T>* tmp = new Node<T>;
tmp->data = T();
tmp->next = nullptr;
tmp->prev = nullptr;
if (!head)
head = tail = tmp;
else {
tmp->prev = tail;
tail->next = tmp;
tail = tmp;
}
++size;
}
void DelBack() {
if (size) {
if (head == tail) {
delete head;
head = nullptr;
tail = nullptr;
}
else {
tail = tail->prev;
delete tail->next;
tail->next = nullptr;
}
--size;
if (count > size)
count = size;
}
}
Node<T>* GetPtrAtIndex(int index) const {
if (index == 0)
return head;
if (index == size - 1)
return tail;
Node<T>* tmp;
if (index < size / 2) {
tmp = head;
for (int i = 0; i < index; ++i)
tmp = tmp->next;
}
else {
tmp = tail;
for (int i = 1; i < size - index; ++i)
tmp = tmp->prev;
}
return tmp;
}
public:
LinkedList() : size(0), count(0), grow(1), head(nullptr), tail(nullptr) {}
LinkedList(const LinkedList& other)
: size(0), count(0), grow(0), head(nullptr), tail(nullptr) {
SetSize(other.size, other.grow);
Append(other);
}
int GetSize() const {
return size;
}
void SetSize(int size, int grow = 1) {
while (this->size > size) {
DelBack();
}
while (this->size < size) {
AddBack();
}
this->grow = grow;
}
int GetUpperBound() const {
return count - 1;
}
bool IsEmpty() const {
return count == 0;
}
void FreeExtra() {
SetSize(count, grow);
}
void RemoveAll() {
SetSize(0, grow);
}
T GetAt(int index) const {
return operator[](index);
}
void SetAt(int index, T data) {
operator[](index) = data;
}
T& operator[](int index) const {
if (index >= 0 && index < count)
return GetPtrAtIndex(index)->data;
else
throw std::out_of_range("Index out of bounds");
}
void Add(T data) {
if (count == size) {
SetSize(size + grow, grow);
}
GetPtrAtIndex(count)->data = data;
++count;
}
void Append(const LinkedList<T>& other) {
for (int i = 0; i < other.count; ++i)
Add(other.GetAt(i));
}
LinkedList& operator=(const LinkedList& other) {
if (this == &other)
return *this;
RemoveAll();
SetSize(other.size, other.grow);
Append(other);
return *this;
}
T* GetData() {
T* tmp = new T[count];
for (int i = 0; i < count; ++i)
tmp[i] = GetAt(i);
return tmp;
}
void InsertAt(int index, T data) {
if (index >= 0 && index < count) {
Node<T>* tmp = GetPtrAtIndex(index);
Node<T>* newNode = new Node<T>;
newNode->data = data;
newNode->prev = tmp->prev;
newNode->next = tmp;
tmp->prev->next = newNode;
tmp->prev = newNode;
++size;
++count;
}
else
throw std::out_of_range("Index out of bounds");
}
void RemoveAt(int index) {
if (index >= 0 && index < count) {
Node<T>* tmp = GetPtrAtIndex(index);
tmp->prev->next = tmp->next;
tmp->next->prev = tmp->prev;
delete tmp;
--size;
--count;
}
else
throw std::out_of_range("Index out of bounds");
}
void Show() const {
//std::cout << "Size: " << size << ", Grow: " << grow << std::endl;
if (count) {
//std::cout << "Data:\n";
Node<T>* tmp = head;
for (int i = 0; i < count; ++i) {
std::cout << tmp->data;
tmp = tmp->next;
}
}
else
std::cout << "Array is empty.";
}
~LinkedList() {
RemoveAll();
}
};
|
/*
* cyttsp5_i2c.c
* Cypress TrueTouch(TM) Standard Product V5 I2C Module.
* For use with Cypress Txx5xx parts.
* Supported parts include:
* TMA5XX
*
* Copyright (C) 2012-2014 Cypress Semiconductor
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2, and only version 2, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
*
*/
#include "cyttsp5_regs.h"
#include <linux/i2c.h>
#include <linux/version.h>
#define CY_I2C_DATA_SIZE (2 * 256)
static int cyttsp5_i2c_read_default(struct device *dev, void *buf, int size)
{
struct i2c_client *client = to_i2c_client(dev);
int rc;
if (!buf || !size || size > CY_I2C_DATA_SIZE)
return -EINVAL;
rc = i2c_master_recv(client, buf, size);
return (rc < 0) ? rc : rc != size ? -EIO : 0;
}
static int cyttsp5_i2c_read_default_nosize(struct device *dev, u8 *buf, u32 max)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_msg msgs[2];
u8 msg_count = 1;
int rc;
u32 size;
if (!buf)
return -EINVAL;
msgs[0].addr = client->addr;
msgs[0].flags = (client->flags & I2C_M_TEN) | I2C_M_RD;
msgs[0].len = 2;
msgs[0].buf = buf;
rc = i2c_transfer(client->adapter, msgs, msg_count);
if (rc < 0 || rc != msg_count)
return (rc < 0) ? rc : -EIO;
size = get_unaligned_le16(&buf[0]);
if (!size || size == 2)
return 0;
if (size > max)
return -EINVAL;
rc = i2c_master_recv(client, buf, size);
return (rc < 0) ? rc : rc != (int)size ? -EIO : 0;
}
static int cyttsp5_i2c_write_read_specific(struct device *dev, u8 write_len,
u8 *write_buf, u8 *read_buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_msg msgs[2];
u8 msg_count = 1;
int rc;
if (!write_buf || !write_len)
return -EINVAL;
msgs[0].addr = client->addr;
msgs[0].flags = client->flags & I2C_M_TEN;
msgs[0].len = write_len;
msgs[0].buf = write_buf;
rc = i2c_transfer(client->adapter, msgs, msg_count);
if (rc < 0 || rc != msg_count)
return (rc < 0) ? rc : -EIO;
rc = 0;
if (read_buf)
rc = cyttsp5_i2c_read_default_nosize(dev, read_buf,
CY_I2C_DATA_SIZE);
return rc;
}
static struct cyttsp5_bus_ops cyttsp5_i2c_bus_ops = {
.bustype = BUS_I2C,
.read_default = cyttsp5_i2c_read_default,
.read_default_nosize = cyttsp5_i2c_read_default_nosize,
.write_read_specific = cyttsp5_i2c_write_read_specific,
};
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
static struct of_device_id cyttsp5_i2c_of_match[] = {
{ .compatible = "cy,cyttsp5_i2c_adapter", },
{ }
};
MODULE_DEVICE_TABLE(of, cyttsp5_i2c_of_match);
#endif
static int cyttsp5_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id)
{
struct device *dev = &client->dev;
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
const struct of_device_id *match;
#endif
int rc;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(dev, "I2C functionality not Supported\n");
return -EIO;
}
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
match = of_match_device(of_match_ptr(cyttsp5_i2c_of_match), dev);
if (match) {
rc = cyttsp5_devtree_create_and_get_pdata(dev);
if (rc < 0)
return rc;
}
#endif
rc = cyttsp5_probe(&cyttsp5_i2c_bus_ops, &client->dev, client->irq,
CY_I2C_DATA_SIZE);
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
if (rc && match)
cyttsp5_devtree_clean_pdata(dev);
#endif
return rc;
}
static int cyttsp5_i2c_remove(struct i2c_client *client)
{
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
struct device *dev = &client->dev;
const struct of_device_id *match;
#endif
struct cyttsp5_core_data *cd = i2c_get_clientdata(client);
cyttsp5_release(cd);
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
match = of_match_device(of_match_ptr(cyttsp5_i2c_of_match), dev);
if (match)
cyttsp5_devtree_clean_pdata(dev);
#endif
return 0;
}
static const struct i2c_device_id cyttsp5_i2c_id[] = {
{ CYTTSP5_I2C_NAME, 0, },
{ }
};
MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id);
static struct i2c_driver cyttsp5_i2c_driver = {
.driver = {
.name = CYTTSP5_I2C_NAME,
.owner = THIS_MODULE,
.pm = &cyttsp5_pm_ops,
#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT
.of_match_table = cyttsp5_i2c_of_match,
#endif
},
.probe = cyttsp5_i2c_probe,
.remove = cyttsp5_i2c_remove,
.id_table = cyttsp5_i2c_id,
};
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
module_i2c_driver(cyttsp5_i2c_driver);
#else
static int __init cyttsp5_i2c_init(void)
{
int rc = i2c_add_driver(&cyttsp5_i2c_driver);
pr_info("%s: Cypress TTSP v5 I2C Driver (Built %s) rc=%d\n",
__func__, CY_DRIVER_DATE, rc);
return rc;
}
module_init(cyttsp5_i2c_init);
static void __exit cyttsp5_i2c_exit(void)
{
i2c_del_driver(&cyttsp5_i2c_driver);
}
module_exit(cyttsp5_i2c_exit);
#endif
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product I2C driver");
MODULE_AUTHOR("Cypress Semiconductor <ttdrivers@cypress.com>");
|
/*
* c64dtv-resources.c
*
* Written by
* Andreas Boose <viceteam@t-online.de>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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 "vice.h"
#include <stdio.h>
#include <string.h>
#include "c64dtv-resources.h"
#include "c64cart.h"
#include "c64rom.h"
#include "cartridge.h"
#include "hummeradc.h"
#include "ps2mouse.h"
#include "kbd.h"
#include "keyboard.h"
#include "lib.h"
#include "machine.h"
#include "resources.h"
#include "sid-resources.h"
#include "util.h"
#include "vicii-resources.h"
#include "vicii.h"
/* What sync factor between the CPU and the drive? If equal to
`MACHINE_SYNC_PAL', the same as PAL machines. If equal to
`MACHINE_SYNC_NTSC', the same as NTSC machines. The sync factor is
calculated as 65536 * drive_clk / clk_[main machine] */
static int sync_factor;
/* Name of the character ROM. */
static char *chargen_rom_name = NULL;
/* Name of the BASIC ROM. */
static char *basic_rom_name = NULL;
/* Name of the Kernal ROM. */
static char *kernal_rom_name = NULL;
static int set_chargen_rom_name(const char *val, void *param)
{
if (util_string_set(&chargen_rom_name, val)) {
return 0;
}
return c64rom_load_chargen(chargen_rom_name);
}
static int set_kernal_rom_name(const char *val, void *param)
{
if (util_string_set(&kernal_rom_name, val)) {
return 0;
}
return c64rom_load_kernal(kernal_rom_name, NULL);
}
static int set_basic_rom_name(const char *val, void *param)
{
if (util_string_set(&basic_rom_name, val)) {
return 0;
}
return c64rom_load_basic(basic_rom_name);
}
static int set_sync_factor(int val, void *param)
{
int change_timing = 0;
int border_mode = VICII_BORDER_MODE(vicii_resources.border_mode);
if (sync_factor != val) {
change_timing = 1;
}
switch (val) {
case MACHINE_SYNC_PAL:
sync_factor = val;
if (change_timing) {
machine_change_timing(MACHINE_SYNC_PAL ^ border_mode);
}
break;
case MACHINE_SYNC_NTSC:
sync_factor = val;
if (change_timing) {
machine_change_timing(MACHINE_SYNC_NTSC ^ border_mode);
}
break;
default:
return -1;
}
return 0;
}
int c64dtv_hummer_adc_enabled = 0;
static int c64dtv_hummer_adc_set(int val, void *param)
{
c64dtv_hummer_adc_enabled = val ? 1 : 0;
return 0;
}
static const resource_string_t resources_string[] = {
{ "ChargenName", "chargen", RES_EVENT_NO, NULL,
/* FIXME: should be same but names may differ */
&chargen_rom_name, set_chargen_rom_name, NULL },
{ "KernalName", "kernal", RES_EVENT_NO, NULL,
/* FIXME: should be same but names may differ */
&kernal_rom_name, set_kernal_rom_name, NULL },
{ "BasicName", "basic", RES_EVENT_NO, NULL,
/* FIXME: should be same but names may differ */
&basic_rom_name, set_basic_rom_name, NULL },
{ NULL }
};
static const resource_int_t resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, set_sync_factor, NULL },
{ "HummerADC", 0, RES_EVENT_SAME, NULL,
(int *)&c64dtv_hummer_adc_enabled, c64dtv_hummer_adc_set, NULL },
{ NULL }
};
int c64dtv_resources_init(void)
{
if (resources_register_string(resources_string) < 0) {
return -1;
}
return resources_register_int(resources_int);
}
void c64dtv_resources_shutdown(void)
{
lib_free(chargen_rom_name);
lib_free(basic_rom_name);
lib_free(kernal_rom_name);
}
|
#ifndef UI_H
#define UI_H
#include <stdlib.h>
#include <stdbool.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include "SDL/SDL_ttf.h"
#include "floor.h"
#include "item.h"
#include "mob.h"
#include "player.h"
#include "timer.h"
#include "ui_init.h"
#include "graphics.h"
#define TILEW 64
#define TILEH 64
#define BOARD_OFFSET_X 0
#define BOARD_OFFSET_Y 32
#define TICK_FREQ 200
#define MAX_LEVEL 8
int check_level_complete(Floor_t * floor, Player_t * player);
void mob_turn(Floor_t * floor, Player_t * player);
void mob_ai(Floor_t * floor, Player_t * player, Point_t point, Mob_t * mob);
int logic(Timer_t * tick_timer, Asset_t * assets, Floor_t * floor, Player_t * player);
int get_input(SDL_Event event, Asset_t * assets, Floor_t * floor, Player_t * player);
int play_loop(Asset_t * assets, Floor_t * floor, Player_t * player);
#endif
|
/*
* Global definition of all the bootwrapper operations.
*
* Author: Mark A. Greer <mgreer@mvista.com>
*
* 2006 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifndef _PPC_BOOT_OPS_H_
#define _PPC_BOOT_OPS_H_
#include "types.h"
#define COMMAND_LINE_SIZE 512
#define MAX_PATH_LEN 256
#define MAX_PROP_LEN 256 /* What should this be? */
/* Platform specific operations */
struct platform_ops {
void (*fixups)(void);
void (*image_hdr)(const void *);
void * (*malloc)(u32 size);
void (*free)(void *ptr, u32 size);
void (*exit)(void);
};
extern struct platform_ops platform_ops;
/* Device Tree operations */
struct dt_ops {
void * (*finddevice)(const char *name);
int (*getprop)(const void *node, const char *name, void *buf,
const int buflen);
int (*setprop)(const void *node, const char *name,
const void *buf, const int buflen);
u64 (*translate_addr)(const char *path, const u32 *in_addr,
const u32 addr_len);
unsigned long (*ft_addr)(void);
};
extern struct dt_ops dt_ops;
/* Console operations */
struct console_ops {
int (*open)(void);
void (*write)(char *buf, int len);
void (*edit_cmdline)(char *buf, int len);
void (*close)(void);
void *data;
};
extern struct console_ops console_ops;
/* Serial console operations */
struct serial_console_data {
int (*open)(void);
void (*putc)(unsigned char c);
unsigned char (*getc)(void);
u8 (*tstc)(void);
void (*close)(void);
};
extern int platform_init(void *promptr);
extern void simple_alloc_init(void);
extern void ft_init(void *dt_blob);
extern int serial_console_init(void);
static inline void *finddevice(const char *name)
{
return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
}
static inline int getprop(void *devp, const char *name, void *buf, int buflen)
{
return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
}
static inline int setprop(void *devp, const char *name, void *buf, int buflen)
{
return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
}
static inline void *malloc(u32 size)
{
return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
}
static inline void free(void *ptr, u32 size)
{
if (platform_ops.free)
platform_ops.free(ptr, size);
}
static inline void exit(void)
{
if (platform_ops.exit)
platform_ops.exit();
for(;;);
}
#endif /* _PPC_BOOT_OPS_H_ */
|
/*
The MIT License(MIT)
Copyright(c) 2015 Bu Xingyuan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef MASTERCONTROLCAPTUREDATA_MESSENGER_H_
#define MASTERCONTROLCAPTUREDATA_MEDDENGER_H_
#include <WinSock2.h>
#include <vector>
#include "computercomponent.h"
class Messenger
{
public:
Messenger();
~Messenger();
//for Computer, connect to ComputerMonitor
static int ClientConnectServer(char * serverIP, SOCKET & socket_client);
//for ComputerMonitor, accept Computer connection and creat thread for it
//save Computer information in vector include the socket of accept
static int ServerAcceptClient(std::vector<ComputerInfo> &computers_vector, int numof_connection);
//for Computer
//send a given message to server which is indicated by socket_server
static int SendMessagetoServer(SOCKET socket_server, char * sendbuf);
/////////////////////////////////////////////////////////////////////////
/////////////nonsense code just for mastercotrol/////////////////////////
/////////////////////////////////////////////////////////////////////////
static int SendMessagetoClient(char * sendbuf);
static int ReceiveMessageFromServer(SOCKET socket_server, char * recvbuf);
};
#endif |
/*
* Alessandro Rubini for CERN, 2011 -- public domain
*/
/*
* This is the main loop for the wr-switch architecture. It's amost
* the same as the unix main loop, but we must serve RPC calls too
*/
#include <stdlib.h>
#include <errno.h>
#include <sys/select.h>
#include <linux/if_ether.h>
#include <ppsi/ppsi.h>
#include <ppsi-wrs.h>
/* Call pp_state_machine for each instance. To be called periodically,
* when no packets are incoming */
static int run_all_state_machines(struct pp_globals *ppg)
{
int j;
int delay_ms = 0, delay_ms_j;
for (j = 0; j < ppg->nlinks; j++) {
struct pp_instance *ppi = &ppg->pp_instances[j];
delay_ms_j = pp_state_machine(ppi, NULL, 0);
/* delay_ms is the least delay_ms among all instances */
if (j == 0)
delay_ms = delay_ms_j;
if (delay_ms_j < delay_ms)
delay_ms = delay_ms_j;
}
return delay_ms;
}
void wrs_main_loop(struct pp_globals *ppg)
{
struct pp_instance *ppi;
int delay_ms;
int j;
/* Initialize each link's state machine */
for (j = 0; j < ppg->nlinks; j++) {
ppi = &ppg->pp_instances[j];
/*
* If we are sending or receiving raw ethernet frames,
* the ptp payload is one-eth-header bytes into the frame
*/
if (ppi->ethernet_mode)
NP(ppi)->ptp_offset = ETH_HLEN;
/*
* The main loop here is based on select. While we are not
* doing anything else but the protocol, this allows extra stuff
* to fit.
*/
ppi->is_new_state = 1;
}
delay_ms = run_all_state_machines(ppg);
while (1) {
int i;
minipc_server_action(ppsi_ch, 10 /* ms */);
/*
* If Ebest was changed in previous loop, run best
* master clock before checking for new packets, which
* would affect port state again
*/
if (ppg->ebest_updated) {
for (j = 0; j < ppg->nlinks; j++) {
int new_state;
struct pp_instance *ppi = &ppg->pp_instances[j];
new_state = bmc(ppi);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->is_new_state = 1;
}
}
ppg->ebest_updated = 0;
}
i = unix_net_check_pkt(ppg, delay_ms);
if (i < 0)
continue;
if (i == 0) {
delay_ms = run_all_state_machines(ppg);
continue;
}
/* If delay_ms is -1, the above unix_net_check_pkt will continue
* consuming the previous timeout (see its implementation).
* This ensures that every state machine is called at least once
* every delay_ms */
delay_ms = -1;
for (j = 0; j < ppg->nlinks; j++) {
int tmp_d;
ppi = &ppg->pp_instances[j];
if ((NP(ppi)->ch[PP_NP_GEN].pkt_present) ||
(NP(ppi)->ch[PP_NP_EVT].pkt_present)) {
i = ppi->n_ops->recv(ppi, ppi->rx_frame,
PP_MAX_FRAME_LENGTH - 4,
&ppi->last_rcv_time);
ppi->last_rcv_time.seconds
+= DSPRO(ppi)->currentUtcOffset;
if (i < PP_MINIMUM_LENGTH) {
pp_diag(ppi, frames, 1,
"Error or short frame: "
"%d < %d\n", i,
PP_MINIMUM_LENGTH
);
continue;
}
tmp_d = pp_state_machine(ppi, ppi->rx_ptp,
i - NP(ppi)->ptp_offset);
if ((delay_ms == -1) || (tmp_d < delay_ms))
delay_ms = tmp_d;
}
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.