text
stringlengths 4
6.14k
|
|---|
//
// AppDelegate.h
// instagram-viewer
//
// Created by chen zhejun on 11/7/15.
// Copyright © 2015 superdami. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// RaPasscodeViewController.h
// Pods
//
// Created by Pang on 2017. 10. 24..
//
#import <UIKit/UIKit.h>
@interface RaPasscodeViewController : UIViewController
{
}
@property (nonatomic, strong) NSString *passcode;
@property (weak, nonatomic) IBOutlet UIImageView *bg;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIButton *btnCancel;
@property (weak, nonatomic) IBOutlet UIButton *btnDel;
- (IBAction)onClickBtnNum:(UIButton *)sender;
- (IBAction)onClickBtnDel:(UIButton *)sender;
- (IBAction)onClickBtnCancel:(UIButton *)sender;
@end
|
//
// MRMultilineCell.h
// MRTableBuilder
//
// Created by Martin Rybak on 3/19/15.
// Copyright (c) 2015 ServiceTask. All rights reserved.
//
@interface MRMultilineCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel* keyLabel;
@property (weak, nonatomic) IBOutlet UILabel* valueLabel;
@end
|
#include<stdio.h>
int binarySearch(int p[],int low,int high,int key)
{
int mid;
mid = low+(high-low)/2;
if(low>high)
{
return -1;
}
if(key<p[mid])
{
binarySearch(p,low,mid-1,key);
}
else if(p[mid]<key)
{
binarySearch(p,mid+1,high,key);
}
else
{
return mid;
}
}
int main()
{
int p[]={1,3,5,6,9};
int target = 9;
int low = 0;
int high = 4;
printf("%d\n",binarySearch(p,low,high,target));
return 0;
}
|
//!!!!!!!!!!!!!!!!!this code has been updated by mark limbrick 2015!!!!!!!!!!!!
//*****************************************************************************
//
// COPYRIGHT (c) ATMEL Norway, 1996-2001
//
// The copyright to the document(s) herein is the property of
// ATMEL Norway, Norway.
//
// The document(s) may be used and/or copied only with the written
// permission from ATMEL Norway or in accordance with the terms and
// conditions stipulated in the agreement/contract under which the
// document(s) have been supplied.
//
//*****************************************************************************
//
// File........: DATAFLASH.H
//
// Author(s)...: ATMEL Norway
//
// Target(s)...: Independent
//
// Description.: Defines and prototypes for AT45Dxxx
//
// Revisions...:
//
// YYYYMMDD - VER. - COMMENT - SIGN.
//
// 20010117 - 0.10 - Generated file - RM
// 20031009 port to avr-gcc/avr-libc - M.Thomas
//
//*****************************************************************************
///#ifndef __DATAFLASH_INCLUDED
//#define __DATAFLASH_INCLUDED
// mt #endif
// #define MTEXTRAS
//General macro definitions
//changed to *DF for avr-libc compatiblity
//#define sbiDF(port,bit) (port |= (1<<bit))
//#define cbiDF(port,bit) (port &= ~(1<<bit))
//mtE
#define SetBit(x,y) (x |= (y))
#define ClrBit(x,y) (x &=~(y))
#define ChkBit(x,y) (x & (y))
//Dataflash opcodes
#define FlashPageRead 0x52 // Main memory page read
#define FlashToBuf1Transfer 0x53 // Main memory page to buffer 1 transfer
#define Buf1Read 0x54 // Buffer 1 read
#define FlashToBuf2Transfer 0x55 // Main memory page to buffer 2 transfer
#define Buf2Read 0x56 // Buffer 2 read
#define StatusReg 0x57 // Status register
#define AutoPageReWrBuf1 0x58 // Auto page rewrite through buffer 1
#define AutoPageReWrBuf2 0x59 // Auto page rewrite through buffer 2
#define FlashToBuf1Compare 0x60 // Main memory page to buffer 1 compare
#define FlashToBuf2Compare 0x61 // Main memory page to buffer 2 compare
#define ContArrayRead 0x68 // Continuous Array Read (Note : Only A/B-parts supported)
#define FlashProgBuf1 0x82 // Main memory page program through buffer 1
#define Buf1ToFlashWE 0x83 // Buffer 1 to main memory page program with built-in erase
#define Buf1Write 0x84 // Buffer 1 write
#define FlashProgBuf2 0x85 // Main memory page program through buffer 2
#define Buf2ToFlashWE 0x86 // Buffer 2 to main memory page program with built-in erase
#define Buf2Write 0x87 // Buffer 2 write
#define Buf1ToFlash 0x88 // Buffer 1 to main memory page program without built-in erase
#define Buf2ToFlash 0x89 // Buffer 2 to main memory page program without built-in erase
#define PageErase 0x81 // Page erase, added by Martin Thomas
#include <inttypes.h>
#include "Arduino.h"
#include <avr/pgmspace.h>
const uint8_t DF_pagebits[] PROGMEM ={9, 9, 9, 9, 9, 10, 10, 11};
const uint16_t DF_pagesize[] PROGMEM ={264,264, 264, 264, 264, 528, 528,1056};
class Dataflash {
public:
Dataflash(void);
void init(void);
void Page_To_Buffer (unsigned int PageAdr, unsigned char BufferNo);
unsigned char Buffer_Read_Byte (unsigned char BufferNo, unsigned int IntPageAdr);
void Buffer_Read_Str (unsigned char BufferNo, unsigned int IntPageAdr, unsigned int No_of_bytes, unsigned char *BufferPtr);
void Buffer_Write_Enable (unsigned char BufferNo, unsigned int IntPageAdr);
void Buffer_Write_Byte (unsigned char BufferNo, unsigned int IntPageAdr, unsigned char Data);
void Buffer_Write_Str (unsigned char BufferNo, unsigned int IntPageAdr, unsigned int No_of_bytes, unsigned char *BufferPtr);
void Buffer_To_Page (unsigned char BufferNo, unsigned int PageAdr);
void Cont_Flash_Read_Enable (unsigned int PageAdr, unsigned int IntPageAdr);
//#ifdef MTEXTRAS
void Page_Erase (unsigned int PageAdr); // added by mthomas
unsigned char Page_Buffer_Compare(unsigned char BufferNo, unsigned int PageAdr); // added by mthomas
void Buffer_To_PageNE (unsigned char BufferNo, unsigned int PageAdr);
private:
unsigned char DF_SPI_RW (unsigned char output);
void DF_SPI_init (void);
unsigned char Read_DF_status (void);
void DF_CS_inactive(void);
void DF_CS_active(void);
};
// *****************************[ End Of DATAFLASH.H ]*****************************
|
#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_p_ExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_p_ExampleVersionString[];
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_memcpy_12.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.string.label.xml
Template File: sources-sink-12.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate using malloc() and set data pointer to a small buffer
* GoodSource: Allocate using malloc() and set data pointer to a large buffer
* Sink: memcpy
* BadSink : Copy string to data using memcpy
* Flow Variant: 12 Control flow: if(globalReturnsTrueOrFalse())
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_memcpy_12_bad()
{
wchar_t * data;
data = NULL;
if(globalReturnsTrueOrFalse())
{
/* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */
data = (wchar_t *)malloc(50*sizeof(wchar_t));
data[0] = L'\0'; /* null terminate */
}
else
{
/* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */
data = (wchar_t *)malloc(100*sizeof(wchar_t));
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if source is larger than data */
memcpy(data, source, 100*sizeof(wchar_t));
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
free(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() - use goodsource and badsink by changing the "if" so that
* both branches use the GoodSource */
static void goodG2B()
{
wchar_t * data;
data = NULL;
if(globalReturnsTrueOrFalse())
{
/* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */
data = (wchar_t *)malloc(100*sizeof(wchar_t));
data[0] = L'\0'; /* null terminate */
}
else
{
/* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */
data = (wchar_t *)malloc(100*sizeof(wchar_t));
data[0] = L'\0'; /* null terminate */
}
{
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if source is larger than data */
memcpy(data, source, 100*sizeof(wchar_t));
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
free(data);
}
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_memcpy_12_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_memcpy_12_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_memcpy_12_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// SPDemoScratchPad.h
// SPKeyValueDemo
//
// Created by Brian Gerstle on 4/9/13.
// Copyright (c) 2013 Spotify. All rights reserved.
//
#import <Foundation/Foundation.h>
/*! Ignore this file! It's used as a scratchpad for presentation stuff
*/
@interface SPDemoScratchPad : NSObject
@end
@interface NSObject (JSONFactory)
+ (instancetype)fromJSON:(NSDictionary*)json;
@end
//...
@class Occupation;
@interface Person : NSObject
@property (nonatomic, strong) NSString* name;
@property (nonatomic, strong) Occupation* occupation;
@end
@class Company;
@interface Occupation : NSObject
@property (nonatomic, strong) NSString* title;
@property (nonatomic, strong) Company* company;
@property (nonatomic, strong) NSNumber* salary;
@end
@interface Company : NSObject
@property (nonatomic, strong) NSString* name;
@property (nonatomic, strong) NSSet* employees;
@end
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_options.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anowak <anowak@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/25 05:16:25 by anowak #+# #+# */
/* Updated: 2015/03/14 20:35:29 by anowak ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void sharp_hexa(t_conv *c, int len, char *s)
{
if (c->type == 'p' && c->precision > len + 2)
len += 2;
if (c->precision != -1 && ((!c->minus && c->zero) || c->width <= len + 2))
{
if (c->type == 'x' || c->type == 'p')
write(1, "0x", 2);
if (c->type == 'X')
write(1, "0X", 2);
if (c->precision > 0 && c->type != 'p')
c->precision += 2;
}
else
{
ft_strncpy(s, "0x", 2);
ft_strncpy(s + 2, *c->str, ft_strlen(*c->str) + 1);
free(*c->str);
*c->str = ft_strdup(s);
}
}
void sharp_octal(t_conv *c, char *s)
{
if ((!c->minus && c->zero) || c->precision == -1)
write(1, "0", 1);
else
{
ft_strncpy(s, "0", 1);
ft_strncpy(s + 1, *c->str, ft_strlen(*c->str) + 1);
free(*c->str);
*c->str = ft_strdup(s);
}
}
int sharp(t_conv *c, int len)
{
char s[ft_strlen(*c->str) + 2];
c->sharp = 0;
if (c->type == 'x' || c->type == 'X' || c->type == 'p')
{
if ((*(long long*)c->arg != 0) || c->type == 'p')
{
sharp_hexa(c, len, s);
return (2);
}
}
else if (c->type == 'o')
if (*(long long*)c->arg != 0 || c->precision)
{
sharp_octal(c, s);
return (1);
}
return (0);
}
int space_plus(t_conv *c)
{
if ((c->plus || c->space) && ft_strchr("aAdeEfFgGi", c->type))
{
if (c->plus)
write(1, "+", 1);
else if (c->space)
write(1, " ", 1);
c->plus = 0;
c->space = 0;
return (1);
}
return (0);
}
int convert_precision(t_conv *c, int len)
{
int x;
int y;
x = 0;
y = 0;
if (c->precision > 0)
{
while (*(((wchar_t*)c->arg) + y) && x < c->precision)
{
if (x + ft_wcharlen(((wchar_t*)c->arg) + y) <= c->precision)
x += ft_wcharlen((wchar_t*)c->arg + y);
y++;
}
return (x);
}
return (len);
}
|
#ifndef OBSERVATION_H
#define OBSERVATION_H
#include "TransitionModel.h"
#include <GClasses/GMatrix.h>
#include <GClasses/GDom.h>
#include <GClasses/GRand.h>
#include <GClasses/GNeuralNet.h>
#include "Mentor.h"
using namespace GClasses;
/// A bidirectional model that maps between beliefs and observations.
/// Mapping from observations to beliefs is done by the encoder.
/// Mapping from beliefs to observations is done by the decoder.
/// These two components are trained together in an unsupervised manner as an autoencoder.
class ObservationModel
{
public:
GRand& rand;
GNeuralNet decoder;
GNeuralNet encoder;
GNeuralNet decoderExperimental;
GNeuralNet encoderExperimental;
GMatrix train;
GMatrix validation;
Tutor* tutor;
TransitionModel& transitionModel;
size_t trainPos;
size_t trainSize;
size_t validationPos;
size_t validationSize;
size_t trainIters;
size_t trainProgress;
size_t calibrationIters;
/// General-purpose constructor
ObservationModel(TransitionModel& transition, size_t observation_dims, size_t belief_dims, size_t decoder_layers,
size_t encoder_layers, size_t queue_size, size_t trainItersPerPattern, size_t calibrationIterations, GRand& r);
/// Unmarshaling constructor
ObservationModel(TransitionModel& transition, GDomNode* pNode, GRand& r);
/// Marshals this model to a JSON DOM.
GDomNode* marshal(GDom* pDoc);
/// Sets the tutor
void setTutor(Tutor* t) { tutor = t; }
/// Performs one pattern-presentation of stochastic gradient descent and dynamically tunes the learning rate
void doSomeTraining();
/// Refines the encoder and decoder based on the new observation.
void trainIncremental(const GVec& observation);
/// Refines the beliefs to correspond with actual observations
void calibrateBeliefs(GVec& beliefs, const GVec& observations);
/// Decodes beliefs to predict observations
void beliefsToObservations(const GVec& beliefs, GVec& observations);
/// Encodes observations to predict beliefs
void observationsToBeliefs(const GVec& observations, GVec& beliefs);
};
#endif
|
// PROGRAMMERS: Deniss Jacenko and Michael O'Reggio
// CLASS: COP4655 Tue/Thur 5pm - 6:15pm
// INSTRUCTOR: Steve Luis
// ASSIGNMENT: Shopping Experience Concept (Group 3)
// DUE: Thursday 12/11/14
//
// Created by Deniss Jacenko and Michael O'Reggio
// Creative Commons Attribution International 4.0 Licence
//
// People.h
// HypeGirlsApp
#import <Foundation/Foundation.h>
#import "Person.h"
@interface People : NSObject
// The array that will hold Person objects
@property (nonatomic, strong) NSMutableArray *people;
+ (Person *) lookup: (NSString *) userName;
+ (void) addPerson: (Person *) p;
+ (void) savePerson: (Person *) p;
-(BOOL)checkPassword: (NSString *)password forUser: (Person *)user;
@end
|
/*
calib_data.h
Copyright (c) 2011 AIST All Rights Reserved.
Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html)
Written by Satoshi KAWABATA <kawabata.aist@gmail.com>
$Date:: $
*/
#ifndef CALIB_DATA_H
#define CALIB_DATA_H
#include <stdio.h>
#define CDATA_SUCCESS 0
#define CDATA_ERROR -1
struct tag_cdata_observed_points;
typedef struct tag_cdata
{
double interval;
double rotation_deg;
int num_observations;
int num_cameras;
struct tag_cdata_observed_points *data; /* data(t, cam) = data[t*num_cameras + cam] */
double *weights;
} cdata_t;
typedef double cdata_point_t[2];
typedef struct tag_cdata_observed_points
{
int num_points;
cdata_point_t *ref, *cam;
double *weights;
} cdata_observed_points_t;
#ifdef __cplusplus
extern "C" {
#endif
int cdata_create (cdata_t **cdata);
int cdata_init (cdata_t *cdata);
int cdata_alloc (cdata_t *cdata, const double interval, const double deg, const int nobserv, const int ncamera);
int cdata_free (cdata_t *cdata);
int cdata_final (cdata_t *cdata);
int cdata_destroy (cdata_t **cdata);
int cdata_read (cdata_t *cdata, FILE *fp);
int cdata_write (const cdata_t *cdata, FILE *fp);
int cdata_observed_points_init (cdata_observed_points_t *op);
int cdata_observed_points_alloc (cdata_observed_points_t *op, const int npoint);
int cdata_observed_points_free (cdata_observed_points_t *op);
int cdata_observed_points_final (cdata_observed_points_t *op);
#ifdef __cplusplus
}
#endif
#endif /* CALIB_DATA_H */
|
/*++
/* NAME
/* upass_trigger 3
/* SUMMARY
/* wakeup UNIX-domain file descriptor listener
/* SYNOPSIS
/* #include <trigger.h>
/*
/* int upass_trigger(service, buf, len, timeout)
/* const char *service;
/* const char *buf;
/* ssize_t len;
/* int timeout;
/* DESCRIPTION
/* upass_trigger() wakes up the named UNIX-domain server by sending
/* a brief connection to it and writing the named buffer.
/*
/* The connection is closed by a background thread. Some kernels
/* cannot handle client-side disconnect before the server has
/* received the message.
/*
/* Arguments:
/* .IP service
/* Name of the communication endpoint.
/* .IP buf
/* Address of data to be written.
/* .IP len
/* Amount of data to be written.
/* .IP timeout
/* Deadline in seconds. Specify a value <= 0 to disable
/* the time limit.
/* DIAGNOSTICS
/* The result is zero in case of success, -1 in case of problems.
/* SEE ALSO
/* upass_connect(3), UNIX-domain client
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
/* System library. */
#include <sys_defs.h>
#include <sys/socket.h>
#include <unistd.h>
#include <string.h>
/* Utility library. */
#include <msg.h>
#include <connect.h>
#include <iostuff.h>
#include <mymalloc.h>
#include <events.h>
#include <trigger.h>
struct upass_trigger {
int fd;
char *service;
};
/* upass_trigger_event - disconnect from peer */
static void upass_trigger_event(int event, char *context)
{
struct upass_trigger *up = (struct upass_trigger *) context;
static const char *myname = "upass_trigger_event";
/*
* Disconnect.
*/
if (event == EVENT_TIME)
msg_warn("%s: read timeout for service %s", myname, up->service);
event_disable_readwrite(up->fd);
event_cancel_timer(upass_trigger_event, context);
if (close(up->fd) < 0)
msg_warn("%s: close %s: %m", myname, up->service);
myfree(up->service);
myfree((char *) up);
}
/* upass_trigger - wakeup UNIX-domain server */
int upass_trigger(const char *service, const char *buf, ssize_t len, int timeout)
{
const char *myname = "upass_trigger";
struct upass_trigger *up;
int fd;
if (msg_verbose > 1)
msg_info("%s: service %s", myname, service);
/*
* Connect...
*/
if ((fd = upass_connect(service, BLOCKING, timeout)) < 0) {
if (msg_verbose)
msg_warn("%s: connect to %s: %m", myname, service);
return (-1);
}
close_on_exec(fd, CLOSE_ON_EXEC);
/*
* Stash away context.
*/
up = (struct upass_trigger *) mymalloc(sizeof(*up));
up->fd = fd;
up->service = mystrdup(service);
/*
* Write the request...
*/
if (write_buf(fd, buf, len, timeout) < 0
|| write_buf(fd, "", 1, timeout) < 0)
if (msg_verbose)
msg_warn("%s: write to %s: %m", myname, service);
/*
* Wakeup when the peer disconnects, or when we lose patience.
*/
if (timeout > 0)
event_request_timer(upass_trigger_event, (char *) up, timeout + 100);
event_enable_read(fd, upass_trigger_event, (char *) up);
return (0);
}
|
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
#ifdef AWS_MULTI_FRAMEWORK
#import <AWSRuntime/AmazonServiceResponse.h>
#else
#import "../AmazonServiceResponse.h"
#endif
/**
*
*/
@interface SQSResponse:AmazonServiceResponse {
}
@end
|
/*
* HaxDocumentMultiFrame.h
*
* Created on: 26 Sep 2015
* Author: john
*/
#ifndef HAXEDITOR_HAXDOCUMENTMULTIFRAME_H_
#define HAXEDITOR_HAXDOCUMENTMULTIFRAME_H_
#include "haxeditor.h"
#include "HaxFrame.h"
#include <memory>
/*!
* A generalised "view" into a document, which maintains state such as the
* view start offset, the cursor offset, etc
*/
class HaxDocumentView
{
protected:
HaxDocumentView():
m_cursorOffset(0)
{}
virtual ~HaxDocumentView()
{}
/*!
* Gets the size of the view (number of bytes shown)
*/
virtual offset_t getViewSize() const = 0;
//private:
// the offset of the cursor (or the start of the cursor if it is longer
// than one byte
offset_t m_cursorOffset;
};
/*
* The HaxDocumentMultiFrame is the core of the editor - if shows a set of
* HaxFrames, which each contain a view of the data. These frames scroll
* together - a line in one means a line in the others
*/
class HaxDocumentMultiFrame: public HaxDocumentView
{
public:
HaxDocumentMultiFrame(HaxDocument& doc);
virtual ~HaxDocumentMultiFrame();
void scrollTo(offset_t newOffset, bool extendSelection, bool moveCaret);
void scrollToStart();
void scrollToEnd();
void scrollLines(int linesToScrollDown, bool extendSelection, bool moveCaret);
void scrollPages(int pagesDown, bool extendSelection);
void scrollRight(int unitsRight, bool extendSelection);
void scrollPageStart(int linesToMovePage);
void SetOffset(uint64_t newOffset)
{
m_rowOffset = newOffset;
}
uint64_t GetRowOffset() const
{
return m_rowOffset;
}
unsigned GetNumVisibleRows() const
{
return m_rows;
}
/*!
* @return the offset at the start of the page
*/
offset_t GetPageOffset() const;
protected:
offset_t getViewSize() const override
{
return m_rows * getRowLength();
}
void setNumVisibleRows(unsigned rowsToShow);
/*!
* Get the total length of the document, in rows, as rendered at the current
* width.
* @return
*/
uint64_t getTotalNumRows() const;
/*!
* Get the row index of the maximum row you can scroll too (so that you
* don't scroll into a mostly black page at the end
*/
offset_t getMaximumOffsetRow() const;
void setRowLength(unsigned rowLength);
offset_t getRowLength() const;
HaxDocument& m_doc;
// todo encapsulate
std::vector<HaxFrame*> m_frames;
private:
virtual void performDeltaOffset(uint64_t offset, bool down,
bool extendSelection);
/*!
* Handle an offset change
* Called by the offset provider - probably the HaxDocument
* @param newOffset new offset - guaranteed to be in the document
*/
void onOffsetChanged(offset_t newOffset);
/*!
* Implement this to do internal reactions to an offset change after
* this class has worked out paging, etc
* @param newOffset
*/
virtual void onOffsetChangeInt() = 0;
/*!
* Handle a new selection
* Called by the selection provider - probably the HaxDocument
* @param selection - the new selection
*/
void onSelectionChanged(const HaxDocument::Selection& selection);
/*!
* Implement this to do internal reactions to a selection change, once
* the base class has processed the basic aspects
* @param newOffset
*/
virtual void onSelectionChangedInt() = 0;
/*!
* Called when the paged view page start changes
*/
virtual void onPageStartChanged(const class PagedView& changedView);
/*!
* Implement this to respond to page start (not necessarily document offset)
* changes
*/
virtual void onPageStartChangedInt() = 0;
uint64_t m_rowOffset = 0;
unsigned m_rows = 0;
// logic for paging
std::unique_ptr<class PagedView> m_pagedView;
// selection wrapper/driver
std::unique_ptr<class SelectionDriver> m_selectionDriver;
// are we moving the caret?
bool m_movingCaret = false;
};
#endif /* HAXEDITOR_HAXDOCUMENTMULTIFRAME_H_ */
|
/*
Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef DCPOMATIC_AUDIO_STREAM_H
#define DCPOMATIC_AUDIO_STREAM_H
#include "audio_mapping.h"
#include <boost/thread/mutex.hpp>
class AudioStream
{
public:
AudioStream (int frame_rate, int channels);
AudioStream (int frame_rate, AudioMapping mapping);
void set_mapping (AudioMapping mapping);
void set_frame_rate (int frame_rate);
void set_channels (int channels);
int frame_rate () const {
boost::mutex::scoped_lock lm (_mutex);
return _frame_rate;
}
AudioMapping mapping () const {
boost::mutex::scoped_lock lm (_mutex);
return _mapping;
}
int channels () const;
protected:
mutable boost::mutex _mutex;
private:
int _frame_rate;
AudioMapping _mapping;
};
typedef boost::shared_ptr<AudioStream> AudioStreamPtr;
#endif
|
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/ctrlsub.h
// Purpose: common functionality of wxItemContainer-derived controls
// Author: Vadim Zeitlin
// Created: 2007-07-25
// RCS-ID: $Id: ctrlsub.h 58757 2009-02-08 11:45:59Z VZ $
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CTRLSUB_H_
#define _WX_MSW_CTRLSUB_H_
// ----------------------------------------------------------------------------
// wxControlWithItems
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
{
public:
wxControlWithItems() { }
protected:
// preallocate memory for inserting the given new items into the control
// using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE)
void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm);
// insert or append a string to the controls using the given message
// (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending)
int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm);
// normally the control containing the items is this window itself but if
// the derived control is composed of several windows, this method can be
// overridden to return the real list/combobox control
virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); }
private:
DECLARE_ABSTRACT_CLASS(wxControlWithItems)
wxDECLARE_NO_COPY_CLASS(wxControlWithItems);
};
#endif // _WX_MSW_CTRLSUB_H_
|
/***************************************************************
*
* (C) 2011-14 Nicola Bonelli <nicola@pfq.io>
*
* 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 full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
****************************************************************/
#ifndef PF_Q_SOCK_H
#define PF_Q_SOCK_H
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/pf_q.h>
#include <net/sock.h>
#include <pf_q-macro.h>
#include <pf_q-stats.h>
#include <pf_q-shmem.h>
extern atomic_long_t pfq_sock_vector[Q_MAX_ID];
typedef struct
{
int value;
} pfq_id_t;
struct pfq_rx_opt
{
atomic_long_t queue_hdr;
void *base_addr;
int tstamp;
size_t caplen;
size_t queue_size;
size_t slot_size;
wait_queue_head_t waitqueue;
struct pfq_socket_rx_stats stats;
} ____cacheline_aligned_in_smp;
static inline
struct pfq_rx_queue *
pfq_get_rx_queue(struct pfq_rx_opt *that)
{
return (struct pfq_rx_queue *)atomic_long_read(&that->queue_hdr);
}
static inline
void pfq_rx_opt_init(struct pfq_rx_opt *that, size_t caplen)
{
/* the queue is allocate later, when the socket is enabled */
atomic_long_set(&that->queue_hdr, 0);
that->base_addr = NULL;
/* disable tiemstamping by default */
that->tstamp = false;
/* set q_slots and q_caplen default values */
that->caplen = caplen;
that->queue_size = 0;
that->slot_size = 0;
/* initialize waitqueue */
init_waitqueue_head(&that->waitqueue);
/* reset stats */
sparse_set(&that->stats.recv, 0);
sparse_set(&that->stats.lost, 0);
sparse_set(&that->stats.drop, 0);
}
struct pfq_tx_queue_info
{
atomic_long_t queue_hdr;
void *base_addr;
int if_index;
int hw_queue;
int cpu;
struct task_struct *task;
};
struct pfq_tx_opt
{
uint64_t counter;
size_t queue_size;
size_t slot_size;
size_t num_queues;
struct pfq_tx_queue_info queue[Q_MAX_TX_QUEUES];
struct pfq_socket_tx_stats stats;
} ____cacheline_aligned_in_smp;
static inline
struct pfq_tx_queue *
pfq_get_tx_queue(struct pfq_tx_opt *that, int index)
{
return (struct pfq_tx_queue *)atomic_long_read(&that->queue[index].queue_hdr);
}
static inline
void pfq_tx_opt_init(struct pfq_tx_opt *that, size_t maxlen)
{
/* the queue is allocate later, when the socket is enabled */
int n;
that->counter = 0;
that->queue_size = 0;
that->slot_size = Q_SPSC_QUEUE_SLOT_SIZE(maxlen);
that->num_queues = 0;
for(n = 0; n < Q_MAX_TX_QUEUES; ++n)
{
atomic_long_set(&that->queue[n].queue_hdr, 0);
that->queue[n].base_addr = NULL;
that->queue[n].if_index = -1;
that->queue[n].hw_queue = -1;
that->queue[n].cpu = -1;
that->queue[n].task = NULL;
}
sparse_set(&that->stats.sent, 0);
sparse_set(&that->stats.disc, 0);
}
struct pfq_sock
{
struct sock sk;
pfq_id_t id;
int egress_type;
int egress_index;
int egress_queue;
struct pfq_shmem_descr shmem;
struct pfq_rx_opt rx_opt;
struct pfq_tx_opt tx_opt;
} ____cacheline_aligned_in_smp;
static inline
struct pfq_shared_queue *
pfq_get_shared_queue(struct pfq_sock *p)
{
return (struct pfq_shared_queue *) p->shmem.addr;
}
static inline struct pfq_sock *
pfq_sk(struct sock *sk)
{
return (struct pfq_sock *)(sk);
}
int pfq_get_sock_count(void);
pfq_id_t pfq_get_free_id(struct pfq_sock * so);
struct pfq_sock * pfq_get_sock_by_id(pfq_id_t id);
void pfq_release_sock_id(pfq_id_t id);
#endif /* PF_COMMON_H */
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUTDOOR_PVP_MGR_H_
#define OUTDOOR_PVP_MGR_H_
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
#include "OutdoorPvP.h"
#include <unordered_map>
class Player;
class GameObject;
class Creature;
class ZoneScript;
struct GossipMenuItems;
enum LocaleConstant : uint8;
// class to handle player enter / leave / areatrigger / GO use events
class TC_GAME_API OutdoorPvPMgr
{
private:
OutdoorPvPMgr();
~OutdoorPvPMgr() { };
public:
static OutdoorPvPMgr* instance();
// create outdoor pvp events
void InitOutdoorPvP();
// cleanup
void Die();
// called when a player enters an outdoor pvp area
void HandlePlayerEnterZone(Player* player, Area* zone);
// called when player leaves an outdoor pvp area
void HandlePlayerLeaveZone(Player* player, Area* zone);
// called when player resurrects
void HandlePlayerResurrects(Player* player, Area* zone);
// return assigned outdoor pvp
OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid);
// handle custom (non-exist in dbc) spell if registered
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
// handle custom go if registered
bool HandleOpenGo(Player* player, GameObject* go);
ZoneScript* GetZoneScript(uint32 zoneId);
void AddZone(uint32 zoneid, OutdoorPvP* handle);
void Update(uint32 diff);
void HandleGossipOption(Player* player, Creature* creature, uint32 gossipid);
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
void HandleDropFlag(Player* player, uint32 spellId);
std::string GetDefenseMessage(uint32 zoneId, uint32 id, LocaleConstant locale) const;
private:
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
typedef std::unordered_map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap;
typedef std::array<uint32, MAX_OUTDOORPVP_TYPES> OutdoorPvPScriptIds;
// contains all initiated outdoor pvp events
// used when initing / cleaning up
OutdoorPvPSet m_OutdoorPvPSet;
// maps the zone ids to an outdoor pvp event
// used in player event handling
OutdoorPvPMap m_OutdoorPvPMap;
// Holds the outdoor PvP templates
OutdoorPvPScriptIds m_OutdoorPvPDatas;
// update interval
uint32 m_UpdateTimer;
};
#define sOutdoorPvPMgr OutdoorPvPMgr::instance()
#endif /*OUTDOOR_PVP_MGR_H_*/
|
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
* Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "JSObject.h"
#include "Symbol.h"
namespace JSC {
// In the ES6 spec, Symbol.prototype object is an ordinary JS object, not one of the symbol wrapper object instance.
class SymbolPrototype : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
static SymbolPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
SymbolPrototype* prototype = new (NotNull, allocateCell<SymbolPrototype>(vm.heap)) SymbolPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
DECLARE_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
protected:
SymbolPrototype(VM&, Structure*);
void finishCreation(VM&, JSGlobalObject*);
};
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(SymbolPrototype);
} // namespace JSC
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_config.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dlancar <dlancar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/12/26 17:56:57 by dlancar #+# #+# */
/* Updated: 2014/05/09 13:02:50 by dlancar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *get_env(const char *name)
{
extern char **environ;
int i;
size_t size;
i = 0;
size = ft_strlen(name);
while (environ[i])
{
if (ft_strcmp(environ[i], name) == 61)
return (environ[i] + size + 1);
i++;
}
return (NULL);
}
char *get_path(int index)
{
static t_array *path = NULL;
if (!path)
path = ft_strsplit(get_env("PATH"), ':');
if (index < 0)
{
array_free(&path);
return (NULL);
}
if ((unsigned int)index >= path->size)
return (NULL);
return (*(char **)array_get(path, index));
}
|
UInt16 hqAudioTestBuf[] = {
0xc41f,
0xe373,
0xc741,
0xe7d7
};
|
/*
* GStreamer
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
* Copyright (C) 2005,2006,2007 David A. Schleef <ds@schleef.org>
* Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GLIMAGESINK_H_
#define _GLIMAGESINK_H_
#include <gst/gst.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include <gst/gl/gl.h>
G_BEGIN_DECLS
GST_DEBUG_CATEGORY_EXTERN (gst_debug_glimage_sink);
#define GST_TYPE_GLIMAGE_SINK \
(gst_glimage_sink_get_type())
#define GST_GLIMAGE_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GLIMAGE_SINK,GstGLImageSink))
#define GST_GLIMAGE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GLIMAGE_SINK,GstGLImageSinkClass))
#define GST_IS_GLIMAGE_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GLIMAGE_SINK))
#define GST_IS_GLIMAGE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GLIMAGE_SINK))
typedef struct _GstGLImageSink GstGLImageSink;
typedef struct _GstGLImageSinkClass GstGLImageSinkClass;
struct _GstGLImageSink
{
GstVideoSink video_sink;
guintptr window_id;
guintptr new_window_id;
gulong mouse_sig_id;
gulong key_sig_id;
//caps
GstVideoInfo info;
GstCaps *caps;
GstGLDisplay *display;
GstGLContext *context;
GstGLContext *other_context;
gboolean handle_events;
gboolean ignore_alpha;
guint next_tex;
GstBuffer *next_buffer;
volatile gint to_quit;
gboolean keep_aspect_ratio;
gint par_n, par_d;
GstBufferPool *pool;
/* avoid replacing the stored_buffer while drawing */
GMutex drawing_lock;
GstBuffer *stored_buffer;
GLuint redisplay_texture;
gboolean caps_change;
guint window_width;
guint window_height;
GstGLShader *redisplay_shader;
GLuint vao;
GLuint vbo_indices;
GLuint vertex_buffer;
GLint attr_position;
GLint attr_texture;
};
struct _GstGLImageSinkClass
{
GstVideoSinkClass video_sink_class;
};
GType gst_glimage_sink_get_type(void);
GType gst_gl_image_sink_bin_get_type(void);
G_END_DECLS
#endif
|
/**********************************************************************
Copyright (C) 2017 Tyler Cromwell <tjc6185@gmail.com>
This file is part of Handwriter.
Handwriter is free software: you can redistribute it and/or modify
it under Version 2 of the terms of the GNU General Public License
as published by the Free Software Foundation.
Handwriter is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY of 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 Ritchie.
If not, see <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
**********************************************************************/
#ifndef TRIG_H
#define TRIG_H
// Starting angles (Degrees)
#define THETA_INIT1 103 // Servo 1
#define THETA_INIT2 130 // Servo 2
#define THETA_INIT3 55 // Servo 3
#define THETA_INIT4 104 // Servo 4
// Side lengths (Centimeters)
#define A 9.90 // Length between Servo 3 and 4
#define C 10.45 // Length between Servo 2 and 3
#define D 13.50 // Length between Servo 4 and tip
#define E 7.50 // Height of Servo 2 from the writing surface
#define L 18.45 // Length between Servo 2 and tip at rest (18.45 minimum)
// Convert Radians to Degrees
#define DEGREES(rad) ((rad) * (180.0 / M_PI))
/**
* Calculates the length of the trapezoid base given an extension amount.
*/
extern double _sideB(double l);
/**
* Calculates the extension length given the length of the trapezoid base.
*/
extern double _length(double b);
/**
* Calculates the trapezoid height from the given extension length.
*/
extern double _height(double l);
/**
* Calculate the angle for rotating Servo 1.
* ONLY USE WITH SERVO 1!
*
* Parameters:
* double f: The side extension length (centimeters).
* double b: The forward extension length (centimeters).
*/
extern double _theta1(double f, double b);
/**
* Calculate the angle for rotating Servo 2.
* ONLY USE WITH SERVO 2!
*
* Parameters:
* double l: The extension length (centimeters).
*/
extern double _theta2(double l);
/**
*
*/
extern double _theta2e(double l);
/**
* Calulate the angle for rotating Servo 3.
* ONLY USE WITH SERVO 3!
*
* Parameters:
* double l: The extension length (centimeters).
*/
extern double _theta3(double l);
/**
* Calulate the angle for rotating Servo 4.
* ONLY USE WITH SERVO 4!
*
* Parameters:
* double l: The extension length (centimeters).
*/
extern double _theta4(double l);
#endif
|
/*
* InfoToken.h
*
*
* Created on: Nov 19, 2012
* Author: Martin Uhrin
*/
#ifndef INFO_TOKEN_H
#define INFO_TOKEN_H
// INCLUDES /////////////////////////////////////////////
#include <string>
#include <utility/TypedDataTable.h>
// FORWARD DECLARES ////////////////////////////////
namespace sstbx {
namespace common {
class Structure;
}
}
namespace stools {
namespace utility {
class InfoToken
{
public:
typedef const ::sstbx::common::Structure * TableKey;
typedef ::sstbx::utility::TypedDataTable<TableKey> StructureInfoTable;
typedef ::sstbx::utility::Column<TableKey> Column;
typedef StructureInfoTable::SortedKeys SortedKeys;
InfoToken(const ::std::string & symbol, const ::std::string & defaultFormatString = "");
virtual ~InfoToken() {}
virtual ::std::string getName() const = 0;
virtual bool insert(
StructureInfoTable & table,
const ::sstbx::common::Structure & structure) = 0;
virtual bool remove(StructureInfoTable & table) = 0;
virtual void sort(SortedKeys & keys, const StructureInfoTable & table) const = 0;
virtual const Column & getColumn() const = 0;
const ::std::string & getSymbol() const;
const ::std::string & getDefaultFormatString() const;
private:
const ::std::string mySymbol;
const ::std::string myDefaultFormatString;
};
template <typename T>
class TypedToken : public InfoToken
{
public:
typedef InfoToken::StructureInfoTable StructureInfoTable;
typedef InfoToken::SortedKeys SortedKeys;
typedef InfoToken::TableKey TableKey;
typedef ::sstbx::utility::Column<TableKey> Column;
TypedToken(
const ::std::string & name,
const ::std::string & symbol,
const ::std::string & defaultFormatString = "");
virtual ::std::string getName() const;
virtual bool insert(
StructureInfoTable & table,
const ::sstbx::common::Structure & structure);
virtual bool remove(StructureInfoTable & table);
virtual void sort(SortedKeys & keys, const StructureInfoTable & table) const;
virtual const Column & getColumn() const;
protected:
typedef ::boost::optional<T> StructureValue;
virtual StructureValue doGetValue(const ::sstbx::common::Structure & structure) const = 0;
private:
typedef ::sstbx::utility::TypedColumn<T, TableKey> TypedColumn;
TypedColumn myColumn;
};
template <typename T>
class StructurePropertyToken : public TypedToken<T>
{
public:
typedef ::sstbx::utility::Key<T> PropertyKey;
StructurePropertyToken(
const ::std::string & name,
const ::std::string & symbol,
PropertyKey & propertyKey,
const ::std::string & defaultFormatString);
protected:
typedef typename TypedToken<T>::StructureValue StructureValue;
virtual StructureValue doGetValue(const ::sstbx::common::Structure & structure) const;
private:
PropertyKey myKey;
};
template <typename T>
class RelativeValueToken : public StructurePropertyToken<T>
{
public:
typedef ::sstbx::utility::Key<T> PropertyKey;
RelativeValueToken(
const ::std::string & name,
const ::std::string & symbol,
PropertyKey & propertyKey,
const ::std::string & defaultFormatString = "",
const bool usePerAtom = false
);
RelativeValueToken(
const ::std::string & name,
const ::std::string & symbol,
PropertyKey & propertyKey,
const T relativeValue,
const ::std::string & defaultFormatString = "",
const bool usePerAtom = false
);
void setRelativeTo(const T relativeValue);
protected:
typedef typename TypedToken<T>::StructureValue StructureValue;
virtual StructureValue doGetValue(const ::sstbx::common::Structure & structure) const;
private:
T myRelativeTo; // The value that all values will be relative to
const bool myUsePerAtom; // Divide the quantity by the number of atoms
};
template <typename T, typename Getter>
class FunctionToken : public TypedToken<T>
{
public:
FunctionToken(
const ::std::string & name,
const ::std::string & symbol,
Getter getter,
const ::std::string & formatString = "");
protected:
typedef typename TypedToken<T>::StructureValue StructureValue;
virtual StructureValue doGetValue(const ::sstbx::common::Structure & structure) const;
private:
Getter myGetter;
};
template <typename T>
::std::auto_ptr<InfoToken>
makeStructurePropertyToken(
const ::std::string & name,
const ::std::string & symbol,
::sstbx::utility::Key<T> & propertyKey,
const ::std::string & defaultFormatString = ""
);
template <typename T, typename Getter>
::std::auto_ptr<InfoToken>
makeFunctionToken(
const ::std::string & name,
const ::std::string & symbol,
Getter getter,
const ::std::string & defaultFormatString = ""
);
}
}
#include "utility/detail/InfoToken.h"
#endif /* INFO_TOKEN_H */
|
/******************************************************************************
Copyright (C) 2015 by Sean Nelson <audiohacked@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#include <stdio.h>
#include <util/dstr.h>
#include <util/darray.h>
#include <util/platform.h>
#include <util/threading.h>
#include <obs-module.h>
#include <core/Buffer.h>
#include <core/Surface.h>
#include <core/Context.h>
#include <components/Component.h>
#include <components/VideoEncoderVCE.h>
#include <string>
#include <atlbase.h>
#include <d3d11.h>
#define do_log(level, format, ...) \
blog(level, "[vce_amf encoder: '%s'] " format, \
obs_encoder_get_name(obs_vce->encoder), ##__VA_ARGS__)
#define error(format, ...) do_log(LOG_ERROR, "ERROR: " format, ##__VA_ARGS__)
#define warn(format, ...) do_log(LOG_WARNING, "WARN: " format, ##__VA_ARGS__)
#define info(format, ...) do_log(LOG_INFO, "INFO: " format, ##__VA_ARGS__)
#define debug(format, ...) do_log(LOG_DEBUG, "DEBUG: " format, ##__VA_ARGS__)
/* ------------------------------------------------------------------------- */
/* prototypes */
const char *obs_vce_amf_getname(void);
void *obs_vce_amf_create(obs_data_t *settings, obs_encoder_t *encoder);
bool obs_vce_amf_encode(void *data, struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet);
void obs_vce_amf_destroy(void *data);
bool obs_vce_update(void *data, obs_data_t *settings);
obs_properties_t *obs_vce_get_properties(void *data);
void obs_vce_get_defaults(obs_data_t *settings);
bool obs_vce_get_extra_data(void *data, uint8_t **extra_data, size_t *size);
bool obs_vce_get_sei(void *data, uint8_t **sei, size_t *size);
bool obs_vce_get_video_info(void *data, struct video_scale_info *info);
void obs_amf_result(struct obs_amd *obs_vce, AMF_RESULT amf_res);
AMF_RESULT obs_vce_amf_d3d11_terminate(struct obs_amd *obs_vce);
AMF_RESULT obs_vce_amf_d3d11_init(struct obs_amd *obs_vce, struct obs_vce_amf *ova, amf_uint32 adapterID);
void parse_packet(struct obs_amd *obs_vce, struct encoder_packet *packet, amf::AMFBufferPtr pic_out);
void init_pic_data(struct obs_amd *obs_vce, struct encoder_frame *frame);
/* ------------------------------------------------------------------------- */
/* OBS to AMF translators */
/* ------------------------------------------------------------------------- */
/* Data Structures */
struct obs_amd {
obs_encoder_t *encoder;
// amf::AMFPropertyStorage vce_param;
amf::AMFContextPtr context;
amf::AMFComponentPtr vce_encoder;
amf::AMFSurfacePtr vce_input;
amf::AMFBufferPtr vce_output;
amf::AMF_SURFACE_FORMAT vce_format;
DARRAY(uint8_t) packet_data;
uint8_t *extra_data;
uint8_t *sei;
size_t extra_data_size;
size_t sei_size;
os_performance_token_t *performance_token;
ATL::CComPtr<ID3D11Device> dx11_device;
const struct video_output_info *vid_out_info;
os_event_t *mStopEvent;
};
struct obs_vce_amf {
obs_vce_amf() {
m_adaptersCount = 0;
memset(m_adaptersIndexes, 0, sizeof(m_adaptersIndexes));
}
//~obs_vce_amf() { obs_vce_amf_d3d11_terminate(); }
//ATL::CComPtr<ID3D11Device> GetDevice() { return m_pD3DDevice; }
//std::wstring GetDisplayDeviceName() { return m_displayDeviceName; }
//void Enumerate(void);
ATL::CComPtr<ID3D11Device> m_pD3DDevice;
static const amf_uint32 MAXADAPTERS = 128;
amf_uint32 m_adaptersCount;
amf_uint32 m_adaptersIndexes[MAXADAPTERS];
std::wstring m_displayDeviceName;
};
|
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <mhi_sys.h>
#include <mhi.h>
extern mhi_pcie_devices mhi_devices;
int mhi_ssr_notify_cb(struct notifier_block *nb,
unsigned long action, void *data);
static struct notifier_block mhi_ssr_nb = {
.notifier_call = mhi_ssr_notify_cb,
};
static void esoc_parse_link_type(mhi_device_ctxt* mhi_dev_ctxt)
{
int ret_val;
ret_val = strncmp(mhi_dev_ctxt->esoc_handle->link,
"HSIC+PCIe",
sizeof("HSIC+PCIe"));
mhi_log(MHI_MSG_VERBOSE, "Link type is %s as indicated by ESOC\n",
mhi_dev_ctxt->esoc_handle->link);
if (ret_val)
mhi_dev_ctxt->base_state = STATE_TRANSITION_BHI;
else
mhi_dev_ctxt->base_state = STATE_TRANSITION_RESET;
}
int mhi_esoc_register(mhi_device_ctxt* mhi_dev_ctxt)
{
int ret_val = 0;
struct device_node *np;
struct pci_driver *mhi_driver;
struct device *dev = &mhi_dev_ctxt->dev_info->pcie_device->dev;
mhi_driver = mhi_dev_ctxt->dev_info->mhi_pcie_driver;
np = dev->of_node;
mhi_dev_ctxt->esoc_handle = devm_register_esoc_client(dev, "mdm");
mhi_log(MHI_MSG_VERBOSE,
"Of table of pcie device property is dev->of_node %p \n",
np);
if (IS_ERR_OR_NULL(mhi_dev_ctxt->esoc_handle)) {
mhi_log(MHI_MSG_CRITICAL,
"Failed to register for SSR, ret %lx\n",
(uintptr_t)mhi_dev_ctxt->esoc_handle);
return -EIO;
}
esoc_parse_link_type(mhi_dev_ctxt);
mhi_dev_ctxt->esoc_ssr_handle = subsys_notif_register_notifier(
mhi_dev_ctxt->esoc_handle->name,
&mhi_ssr_nb);
if (IS_ERR_OR_NULL(mhi_dev_ctxt->esoc_ssr_handle)) {
ret_val = PTR_RET(mhi_dev_ctxt->esoc_ssr_handle);
mhi_log(MHI_MSG_CRITICAL,
"Can't find esoc desc ret 0x%lx\n",
(uintptr_t)mhi_dev_ctxt->esoc_ssr_handle);
}
return ret_val;
}
void mhi_notify_clients(mhi_device_ctxt *mhi_dev_ctxt, MHI_CB_REASON reason)
{
u32 i;
mhi_client_handle *client_handle = NULL;
mhi_cb_info cb_info = {0};
mhi_result result = {0};
for (i = 0; i < MHI_MAX_CHANNELS; ++i) {
if (VALID_CHAN_NR(i)) {
client_handle =
mhi_dev_ctxt->client_handle_list[i];
cb_info.result = NULL;
cb_info.cb_reason = reason;
if (NULL != client_handle &&
NULL != client_handle->client_info.mhi_client_cb) {
result.user_data = client_handle->user_data;
cb_info.result = &result;
client_handle->client_info.mhi_client_cb(&cb_info);
}
}
}
}
void mhi_link_state_cb(struct msm_pcie_notify *notify)
{
MHI_STATUS ret_val = MHI_STATUS_SUCCESS;
mhi_pcie_dev_info *mhi_pcie_dev = notify->data;
mhi_device_ctxt *mhi_dev_ctxt = NULL;
if (NULL == notify || NULL == notify->data) {
mhi_log(MHI_MSG_CRITICAL,
"Incomplete handle received\n");
return;
}
mhi_dev_ctxt = mhi_pcie_dev->mhi_ctxt;
switch (notify->event){
case MSM_PCIE_EVENT_LINKDOWN:
mhi_log(MHI_MSG_CRITICAL, "Received MSM_PCIE_EVENT_LINKDOWN\n");
break;
case MSM_PCIE_EVENT_LINKUP:
mhi_log(MHI_MSG_CRITICAL,
"Received MSM_PCIE_EVENT_LINKUP\n");
if (0 == mhi_pcie_dev->link_up_cntr) {
mhi_log(MHI_MSG_INFO,
"Initializing MHI for the first time\n");
mhi_startup_thread(mhi_pcie_dev);
mhi_dev_ctxt = mhi_pcie_dev->mhi_ctxt;
pci_set_master(mhi_pcie_dev->pcie_device);
init_mhi_base_state(mhi_dev_ctxt);
} else {
mhi_log(MHI_MSG_INFO,
"Received Link Up Callback\n");
}
mhi_pcie_dev->link_up_cntr++;
break;
case MSM_PCIE_EVENT_WAKEUP:
mhi_log(MHI_MSG_CRITICAL,
"Received MSM_PCIE_EVENT_WAKE\n");
mhi_wake(mhi_dev_ctxt);
mhi_wake_relax(mhi_dev_ctxt);
if (atomic_read(&mhi_dev_ctxt->flags.pending_resume)) {
mhi_log(MHI_MSG_INFO,
"There is a pending resume, doing nothing \n");
return;
}
ret_val = mhi_init_state_transition(mhi_dev_ctxt,
STATE_TRANSITION_WAKE);
if (MHI_STATUS_SUCCESS != ret_val) {
mhi_log(MHI_MSG_CRITICAL,
"Failed to init state transition, to %d\n",
STATE_TRANSITION_WAKE);
}
break;
default:
mhi_log(MHI_MSG_INFO,
"Received bad link event\n");
return;
break;
}
}
int mhi_ssr_notify_cb(struct notifier_block *nb,
unsigned long action, void *data)
{
int ret_val = 0;
mhi_device_ctxt *mhi_dev_ctxt = mhi_devices.device_list[0].mhi_ctxt;
if (NULL != mhi_dev_ctxt)
mhi_dev_ctxt->esoc_notif = action;
switch (action) {
case SUBSYS_BEFORE_SHUTDOWN:
mhi_log(MHI_MSG_INFO, "Received Subsystem event BEFORE_SHUTDOWN\n");
ret_val = mhi_init_state_transition(mhi_dev_ctxt,
STATE_TRANSITION_LINK_DOWN);
if (MHI_STATUS_SUCCESS != ret_val) {
mhi_log(MHI_MSG_CRITICAL,
"Failed to init state transition, to %d\n",
STATE_TRANSITION_LINK_DOWN);
}
break;
}
return NOTIFY_OK;
}
MHI_STATUS init_mhi_base_state(mhi_device_ctxt* mhi_dev_ctxt)
{
int r = 0;
MHI_STATUS ret_val = MHI_STATUS_SUCCESS;
mhi_assert_device_wake(mhi_dev_ctxt);
mhi_dev_ctxt->flags.link_up = 1;
r = mhi_set_bus_request(mhi_dev_ctxt, 1);
if (r)
mhi_log(MHI_MSG_INFO,
"Failed to scale bus request to active set.\n");
ret_val = mhi_init_state_transition(mhi_dev_ctxt,
mhi_dev_ctxt->base_state);
if (MHI_STATUS_SUCCESS != ret_val) {
mhi_log(MHI_MSG_CRITICAL,
"Failed to start state change event, to %d\n",
mhi_dev_ctxt->base_state);
}
return ret_val;
}
|
/**
@file memory.h
@brief ENet memory management
*/
#ifndef __ENET_MEMORY_H__
#define __ENET_MEMORY_H__
#include <stdlib.h>
/** @defgroup memory ENet internal memory management
@{
@ingroup private
*/
extern void * enet_malloc (size_t);
extern void * enet_realloc (void *, size_t);
extern void * enet_calloc (size_t, size_t);
extern void enet_free (void *);
/** @} */
#endif /* __ENET_MEMORY_H__ */
|
/**
* @file
* @brief Misc stuff.
**/
#ifndef EFFECTS_H
#define EFFECTS_H
struct bolt;
class monster;
struct item_def;
void banished(dungeon_feature_type gate_type, const std::string &who = "");
bool forget_spell(void);
int mushroom_prob(item_def & corpse);
bool mushroom_spawn_message(int seen_targets, int seen_corpses);
int spawn_corpse_mushrooms(item_def &corpse,
int target_count,
int & seen_targets,
beh_type toadstool_behavior = BEH_HOSTILE,
bool distance_as_time = false);
struct mgen_data;
int place_ring(std::vector<coord_def>& ring_points,
const coord_def& origin,
mgen_data prototype,
int n_arcs,
int arc_occupancy,
int& seen_count);
class los_base;
// Collect lists of points that are within LOS (under the given losgrid),
// unoccupied, and not solid (walls/statues).
void collect_radius_points(std::vector<std::vector<coord_def> > &radius_points,
const coord_def &origin, const los_base* los);
void random_uselessness(int scroll_slot = -1);
int recharge_wand(const int item_slot = -1, bool known = true,
std::string *pre_msg = NULL);
void direct_effect(monster* src, spell_type spl, bolt &pbolt, actor *defender);
void yell(bool force = false);
int holy_word(int pow, int caster, const coord_def& where, bool silent = false,
actor *attacker = NULL);
int holy_word_player(int pow, int caster, actor *attacker = NULL);
int holy_word_monsters(coord_def where, int pow, int caster,
actor *attacker = NULL);
int torment(int caster, const coord_def& where);
int torment_player(int pow, int caster);
int torment_monsters(coord_def where, int pow, int caster,
actor *attacker = NULL);
void immolation(int pow, int caster, coord_def where, bool known = false,
actor *attacker = NULL);
void conduct_electricity(coord_def where, actor *attacker);
void cleansing_flame(int pow, int caster, coord_def where,
actor *attacker = NULL);
void change_labyrinth(bool msg = false);
bool vitrify_area(int radius);
void update_corpses(int elapsedTime);
void update_level(int elapsedTime);
void handle_time();
void recharge_rods(int aut, bool floor_only);
void slime_wall_damage(actor* act, int delay);
#endif
|
/*
* linux/arch/arm/mach-sun7i/platsmp.c
*
* Copyright (C) 2012-2016 Allwinner Ltd.
* 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 as
* published by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/smp.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/jiffies.h>
#include <linux/smp.h>
#include <mach/includes.h>
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
#include <asm/smp_scu.h>
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
#include "core.h"
extern void sun7i_secondary_startup(void);
static DEFINE_SPINLOCK(boot_lock);
/*
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*
* Note: for arch/arm/kernel/setup.csetup_arch(..)
*/
static void __iomem *scu_base_addr(void)
{
pr_debug("[%s] enter\n", __FUNCTION__);
return __io_address(SW_PA_SCU_IO_BASE);
}
void __cpuinit enable_aw_cpu(int cpu)
{
long paddr;
u32 pwr_reg;
paddr = virt_to_phys(sun7i_secondary_startup);
writel(paddr, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_P_REG0);
/* step1: Assert nCOREPORESET LOW and hold L1RSTDISABLE LOW.
Ensure DBGPWRDUP is held LOW to prevent any external
debug access to the processor.
*/
/* assert cpu core reset */
writel(0, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + CPUX_RESET_CTL(cpu));
/* L1RSTDISABLE hold low */
pwr_reg = readl(IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_GENCTL);
pwr_reg &= ~(1<<cpu);
writel(pwr_reg, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_GENCTL);
/* DBGPWRDUP hold low */
pwr_reg = readl(IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_DBGCTL1);
pwr_reg &= ~(1<<cpu);
writel(pwr_reg, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_DBGCTL1);
/* step2: release power clamp */
writel(0xff, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x7f, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x3f, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x1f, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x0f, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x07, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x03, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x01, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
writel(0x00, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWR_CLAMP);
mdelay(10);
/* step3: clear power-off gating */
pwr_reg = readl(IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWROFF_REG);
pwr_reg &= ~(1);
writel(pwr_reg, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPU1_PWROFF_REG);
mdelay(1);
/* step4: de-assert core reset */
writel(3, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + CPUX_RESET_CTL(cpu));
/* step5: assert DBGPWRDUP signal */
pwr_reg = readl(IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_DBGCTL1);
pwr_reg |= (1<<cpu);
writel(pwr_reg, IO_ADDRESS(SW_PA_CPUCFG_IO_BASE) + AW_CPUCFG_DBGCTL1);
}
void __init smp_init_cpus(void)
{
unsigned int i, ncores;
ncores = scu_get_core_count(NULL);
pr_debug("[%s] ncores=%d\n", __FUNCTION__, ncores);
for (i = 0; i < ncores; i++) {
set_cpu_possible(i, true);
}
set_smp_cross_call(gic_raise_softirq);
}
/*
* for arch/arm/kernel/smp.c:smp_prepare_cpus(unsigned int max_cpus)
*/
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
{
void __iomem *scu_base;
pr_debug("[%s] enter\n", __FUNCTION__);
scu_base = scu_base_addr();
scu_enable(scu_base);
}
/*
* for linux/arch/arm/kernel/smp.c:secondary_start_kernel(void)
*/
void __cpuinit platform_secondary_init(unsigned int cpu)
{
pr_debug("[%s] enter, cpu:%d\n", __FUNCTION__, cpu);
gic_secondary_init(0);
}
/*
* for linux/arch/arm/kernel/smp.c:__cpu_up(..)
*/
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
{
pr_debug("[%s] enter\n", __FUNCTION__);
spin_lock(&boot_lock);
enable_aw_cpu(cpu);
spin_unlock(&boot_lock);
return 0;
}
|
#ifndef TimeServiceFactory_h__
#define TimeServiceFactory_h__
#include <iostream>
#include "ITimeService.h"
#include "../service/IServiceFactory.h"
class TimeServiceFactory: public IServiceFactory
{
public:
TimeServiceFactory();
~TimeServiceFactory();
IService *create();
};
#endif // #ifndef TimeServiceFactory_h__
|
#ifndef IMAGE_H
#define IMAGE_H
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "ppm.hpp"
#include "pixel.h"
using namespace std;
class Image
{
public:
Image(PPMBitmap img, int l, int h,bool isSprite=false);
int getMinimumWidth();
int getMinimumHeight();
int getWidth();
int getHeight();
int getXFirst();
//vecteur de pixels de l'image
vector<Pixel> getPixels();
//vecteur de pixels du sprite réduit
vector<Pixel> getMinimum();
private:
//permet de réduire le sprite pour enlever les bords blancs inutiles
void createMinimum();
//une fois le sprite réduit, permet d'avoir la coordonnée du premier pixel non blanc
void firstXCoord();
PPMBitmap _img;
int _width;
int _height;
int _minimumWidth;
int _minimumHeight;
vector <Pixel> _pixels;
vector <Pixel> _minimumPicture;
bool _isSprite;
int x_center;
int y_center;
int x_first;
};
#endif // IMAGE_H
|
/*
* Copyright (C) 2008-2011 WCloudCore <http://www.wcloudcore.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QUERYHOLDER_H
#define _QUERYHOLDER_H
#include <ace/Future.h>
class SQLQueryHolder
{
friend class SQLQueryHolderTask;
private:
typedef std::pair<SQLElementData, SQLResultSetUnion> SQLResultPair;
std::vector<SQLResultPair> m_queries;
public:
SQLQueryHolder() {}
~SQLQueryHolder();
bool SetQuery(size_t index, const char *sql);
bool SetPQuery(size_t index, const char *format, ...) ATTR_PRINTF(3, 4);
bool SetPreparedQuery(size_t index, PreparedStatement* stmt);
void SetSize(size_t size);
QueryResult GetResult(size_t index);
PreparedQueryResult GetPreparedResult(size_t index);
void SetResult(size_t index, ResultSet* result);
void SetPreparedResult(size_t index, PreparedResultSet* result);
};
typedef ACE_Future<SQLQueryHolder*> QueryResultHolderFuture;
class SQLQueryHolderTask : public SQLOperation
{
private:
SQLQueryHolder * m_holder;
QueryResultHolderFuture m_result;
public:
SQLQueryHolderTask(SQLQueryHolder *holder, QueryResultHolderFuture res)
: m_holder(holder), m_result(res){};
bool Execute();
};
#endif
|
/*
GPL
(c) 2014-2016, thorsten.johannvorderbrueggen@t-online.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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 _LIBLCD_PRIV_H_
#define _LIBLCD_PRIV_H_
#include <libhelper.h>
#include "liblcd.h"
#include <avr/io.h>
#include <stdlib.h>
#define __DELAY_BACKWARD_COMPATIBLE__
#include <util/delay.h>
#include <avr_defines_display.h>
/*
* lcd errno stuff
*
* Note: of course not reentrant
* LCD_ERROR is the general switch
* LCD_ERRNO for lcd_errno which holds lcd_error_t values
*/
#ifdef LCD_ERROR
#ifndef LCD_ERRNO
#define LCD_ERRNO
unsigned char lcd_errno = MY_OK;
#endif
#else
# warning "No special lcd error indication!"
#endif
/*
* error string
*/
unsigned char *lcd_error_string = (unsigned char *) "LCD_ERROR";
/*
* LCD timing
*/
#define LCD_BOOTUP_TIME 100
#define LCD_ENABLE_PAUSE 100
#define LCD_ENABLE_PAUSE_DOUBLE 2*LCD_ENABLE_PAUSE
#define LCD_INIT_LONG 5
/*
* LCD commands
*/
#define LCD_CMD_CLEAR_LCD 0x01
#define LCD_CMD_CURSOR_HOME 0x02
#define LCD_CMD_DISPLAY_OFF 0x08
#define LCD_CMD_DISPLAY_ON 0x0F
#define LCD_CMD_CURSOR_OFF 0x0C
#define LCD_CMD_DDRAM_ADDR 0x80
/*
* -> macros for setting ....
*/
#define LCD_PUSH_EN_BUTTON() { \
LCD_CTRL_PORT |= (1 << LCD_EN_PIN); \
_delay_us(LCD_ENABLE_PAUSE); \
LCD_CTRL_PORT &= ~(1 << LCD_EN_PIN); \
_delay_us(LCD_ENABLE_PAUSE); \
}
#define LCD_SET_RS_TO_COMMAND() { \
LCD_CTRL_PORT &= ~(1 << LCD_RS_PIN); \
}
#define LCD_SET_RS_TO_CHARACTER() { \
LCD_CTRL_PORT |= (1 << LCD_RS_PIN); \
}
#define LCD_SET_EN_ZERO() { \
LCD_CTRL_PORT &= ~(1 << LCD_EN_PIN); \
}
#define LCD_SET_EN_ONE() { \
LCD_CTRL_PORT |= (1 << LCD_EN_PIN); \
}
/*
* ----------- functions for init/setup of the LCD -----------
*/
/*
* -> reset lcd
*/
void
lcd_reset_lcd(void);
#endif
|
/*
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITYCORE_TEMPSUMMON_H
#define TRINITYCORE_TEMPSUMMON_H
#include "Creature.h"
enum PetEntry : uint32
{
// Death Knight pets
PET_GHOUL = 26125,
PET_RISEN_ALLY = 30230,
// Shaman pet
PET_SPIRIT_WOLF = 29264
};
struct SummonPropertiesEntry;
class TC_GAME_API TempSummon : public Creature
{
public:
explicit TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
virtual ~TempSummon() { }
void Update(uint32 time) override;
virtual void InitStats(uint32 lifetime);
virtual void InitSummon();
void UpdateObjectVisibilityOnCreate() override;
virtual void UnSummon(uint32 msTime = 0);
void RemoveFromWorld() override;
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override { }
Unit* GetSummoner() const;
Creature* GetSummonerCreatureBase() const;
ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType GetSummonType() const { return m_type; }
uint32 GetTimer() const { return m_timer; }
SummonPropertiesEntry const* const m_Properties;
std::string GetDebugInfo() const override;
private:
TempSummonType m_type;
uint32 m_timer;
uint32 m_lifetime;
ObjectGuid m_summonerGUID;
};
class TC_GAME_API Minion : public TempSummon
{
public:
Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
void InitStats(uint32 duration) override;
void RemoveFromWorld() override;
void setDeathState(DeathState s) override;
Unit* GetOwner() const { return m_owner; }
float GetFollowAngle() const override { return m_followAngle; }
void SetFollowAngle(float angle) { m_followAngle = angle; }
// Death Knight pets
bool IsPetGhoul() const { return GetEntry() == PET_GHOUL; } // Ghoul may be guardian or pet
bool IsRisenAlly() const { return GetEntry() == PET_RISEN_ALLY; }
// Shaman pet
bool IsSpiritWolf() const { return GetEntry() == PET_SPIRIT_WOLF; } // Spirit wolf from feral spirits
bool IsGuardianPet() const;
std::string GetDebugInfo() const override;
protected:
Unit* const m_owner;
float m_followAngle;
};
class TC_GAME_API Guardian : public Minion
{
public:
Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject);
void InitStats(uint32 duration) override;
bool InitStatsForLevel(uint8 level);
void InitSummon() override;
bool UpdateStats(Stats stat) override;
bool UpdateAllStats() override;
void UpdateResistances(uint32 school) override;
void UpdateArmor() override;
void UpdateMaxHealth() override;
void UpdateMaxPower(Powers power) override;
void UpdateAttackPowerAndDamage(bool ranged = false) override;
void UpdateDamagePhysical(WeaponAttackType attType) override;
int32 GetBonusDamage() const { return m_bonusSpellDamage; }
float GetBonusStatFromOwner(Stats stat) const { return m_statFromOwner[stat]; }
void SetBonusDamage(int32 damage);
std::string GetDebugInfo() const override;
protected:
int32 m_bonusSpellDamage;
float m_statFromOwner[MAX_STATS];
};
class TC_GAME_API Puppet : public Minion
{
public:
Puppet(SummonPropertiesEntry const* properties, Unit* owner);
void InitStats(uint32 duration) override;
void InitSummon() override;
void Update(uint32 time) override;
void RemoveFromWorld() override;
};
class TC_GAME_API ForcedUnsummonDelayEvent : public BasicEvent
{
public:
ForcedUnsummonDelayEvent(TempSummon& owner) : BasicEvent(), m_owner(owner) { }
bool Execute(uint64 e_time, uint32 p_time) override;
private:
TempSummon& m_owner;
};
#endif
|
//
// serial.h
// iECDIS
//
// Created by Aun Johnsen on 2/10/16.
// Copyright © 2016 Aun Johnsen. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface serial : NSObject
@end
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/DataAccess.framework/DataAccess
*/
#import <DataAccess/ASDynamicAccountClassLoader.h>
#import <DataAccess/XXUnknownSuperclass.h>
@class NSMutableDictionary;
@interface DAAccountLoader : XXUnknownSuperclass <ASDynamicAccountClassLoader> {
NSMutableDictionary *_accountTypeToAccountFrameworkSubpath; // 4 = 0x4
NSMutableDictionary *_accountTypeToAccountDaemonBundleSubpath; // 8 = 0x8
NSMutableDictionary *_accountTypeToClassNames; // 12 = 0xc
}
+ (BOOL)loadBundleForAccountWithProperties:(id)properties; // 0x78a1
+ (id)sharedInstance; // 0x6b0d
- (BOOL)loadBundleForAccountWithProperties:(id)properties; // 0x7859
- (Class)daemonAppropriateAccountClassForAccountType:(id)accountType; // 0x7825
- (Class)agentClassForAccountType:(id)accountType; // 0x7745
- (Class)daemonAccountClassForAccountType:(id)accountType; // 0x7625
- (Class)clientAccountClassForAccountType:(id)accountType; // 0x7525
- (Class)accountClassForAccountType:(id)accountType; // 0x7445
- (void)loadDaemonBundleForAccountType:(id)accountType; // 0x7409
- (void)loadFrameworkForAccountType:(id)accountType; // 0x7349
- (BOOL)_loadFrameworkAtSubpath:(id)subpath; // 0x72e1
- (id)init; // 0x6e0d
- (void)_addAccountInfo:(id)info forFrameworkNamed:(id)frameworkNamed; // 0x6c0d
@end
|
//
// RootPanelController.h
// UE4ClassBuilder
//
// Created by Tim Koepsel on 01.11.14.
// Copyright (c) 2014 xzessmedia. All rights reserved.
//
#import "JASidePanelController.h"
@interface RootPanelController : JASidePanelController
@end
|
/*
* =====================================================================================
*
* Filename: segfault1.c
*
* Description: segmentation fault example.
*
* Version: 1.0
* Created: 06/30/13 16:05:16
* Revision: none
* Compiler: gcc
*
* Author: Li Xiang (gk), lixiang-best@163.com
* Company: Li Xiang in Xiamen China.
*
* =====================================================================================
*/
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
void handle(int signo){
printf("catch SIGSEGV\n");
exit(0);
}
int main(){
int *ptr = NULL;
signal(SIGSEGV, handle);
*ptr = 0;
return 0;
}
|
/* mail.c */
#ifndef __MAIL_H
#define __MAIL_H
#define MAX_MAIL_HOLD (100)
#define MAX_SYSOPMAIL_HOLD (300)
int update_mailsize_up(struct fileheader *, char *userid);
int update_mailsize_down(struct fileheader *, char *userid);
int max_mailsize(struct userec *lookupuser);
int DIR_do_editmail(struct fileheader *fileinfo, struct fileheader *newfileinfo, char *userid);
int get_mailsize(struct userec *lookupuser);
int mail_buf(char *buf, int size, char *userid, char *title, char *sender); //this api check mailsize
int mail_file(char *filename, char *userid, char *title, char *sender); //this api check mailsize
int system_mail_buf(char *buf, int size, char *userid, char *title, char *sender); //this api don't check mailsize
int system_mail_file(char *filename, char *userid, char *title, char *sender); //this api don't check mailsize
int system_mail_link(char *filename, char *userid, char *title, char *sender); //don't check mailsize. symbolic link
int calc_mailsize(struct userec *user, int needlock);
char * check_mailperm(struct userec *lookupuser);
#ifdef INTERNET_EMAIL
int bbs_sendmail(const char *fname, const char *title, const char *receiver, const char *sender, int filter_ansi);
int bbs_sendmail_noansi(char *fname, char *title, char *receiver, char *sender);
#endif
int invalidaddr(const char *addr);
#endif
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
*/
#import <ProtocolBuffer/PBCodable.h>
@class NSMutableArray, GEOAddress, GEOPlace, NSString;
@interface GEOPlaceResult : PBCodable {
GEOPlace *_place; // 4 = 0x4
BOOL _hasConfidence; // 8 = 0x8
double _confidence; // 12 = 0xc
NSMutableArray *_additionalPlaces; // 20 = 0x14
GEOAddress *_tokenEntity; // 24 = 0x18
NSString *_quad; // 28 = 0x1c
}
@property(retain, nonatomic) NSString *quad; // G=0x16df9; S=0x16e09; @synthesize=_quad
@property(readonly, assign, nonatomic) BOOL hasQuad; // G=0x16499;
@property(retain, nonatomic) GEOAddress *tokenEntity; // G=0x16dc5; S=0x16dd5; @synthesize=_tokenEntity
@property(readonly, assign, nonatomic) BOOL hasTokenEntity; // G=0x16481;
@property(retain, nonatomic) NSMutableArray *additionalPlaces; // G=0x16d91; S=0x16da1; @synthesize=_additionalPlaces
@property(assign, nonatomic) double confidence; // G=0x16d79; S=0x163b1; @synthesize=_confidence
@property(assign, nonatomic) BOOL hasConfidence; // G=0x16d59; S=0x16d69; @synthesize=_hasConfidence
@property(retain, nonatomic) GEOPlace *place; // G=0x16d25; S=0x16d35; @synthesize=_place
// declared property setter: - (void)setQuad:(id)quad; // 0x16e09
// declared property getter: - (id)quad; // 0x16df9
// declared property setter: - (void)setTokenEntity:(id)entity; // 0x16dd5
// declared property getter: - (id)tokenEntity; // 0x16dc5
// declared property setter: - (void)setAdditionalPlaces:(id)places; // 0x16da1
// declared property getter: - (id)additionalPlaces; // 0x16d91
// declared property getter: - (double)confidence; // 0x16d79
// declared property setter: - (void)setHasConfidence:(BOOL)confidence; // 0x16d69
// declared property getter: - (BOOL)hasConfidence; // 0x16d59
// declared property setter: - (void)setPlace:(id)place; // 0x16d35
// declared property getter: - (id)place; // 0x16d25
- (void)writeTo:(id)to; // 0x16a99
- (BOOL)readFrom:(id)from; // 0x16799
- (id)dictionaryRepresentation; // 0x16521
- (id)description; // 0x164b1
// declared property getter: - (BOOL)hasQuad; // 0x16499
// declared property getter: - (BOOL)hasTokenEntity; // 0x16481
- (id)additionalPlaceAtIndex:(unsigned)index; // 0x16461
- (unsigned)additionalPlacesCount; // 0x16441
- (void)addAdditionalPlace:(id)place; // 0x163dd
// declared property setter: - (void)setConfidence:(double)confidence; // 0x163b1
- (void)dealloc; // 0x16331
@end
|
/*
* slimbus is a kernel driver which is used to manager SLIMbus devices
* Copyright (C) 2014 Hisilicon
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <hisi/hilog.h>
static struct snd_soc_dai_link hi3650_hi6403_dai_link[] = {
{
/* dai link name*/
.name = "hi3650_hi6403_pb_normal",
/* stream name same as name */
.stream_name = "hi3650_hi6403_pb_normal",
/* codec(hi6403) device name ,see in hi6403.c */
.codec_name = "hi6403-codec",
/* cpu(k3v3:asp) dai name(device name), see in hi3650-pcm.c */
.cpu_dai_name = "slimbus-dai",
/* codec dai name, see in struct snd_soc_dai_driver in hi6403.c */
.codec_dai_name = "hi6403-audio-dai",
/* platform(k3v3:asp) device name, see in hi3650-pcm.c */
.platform_name = "hi6210-hifi",
},
{
/* dai link name*/
.name = "hi3650_voice",
/* stream name same as name */
.stream_name = "hi3650_voice",
/* codec(hi6403) device name ,see in hi6403.c */
.codec_name = "hi6403-codec",
/* cpu(k3v3:asp) dai name(device name), see in hi3650-pcm.c */
.cpu_dai_name = "slimbus-dai",
/* codec dai name, see in struct snd_soc_dai_driver in hi6403.c */
.codec_dai_name = "hi6403-voice-dai",
/* platform(k3v3:asp) device name, see in hi3650-pcm.c */
.platform_name = "snd-soc-dummy",
},
{
/* dai link name*/
.name = "hi3650_fm1",
/* stream name same as name */
.stream_name = "hi3650_fm1",
/* codec(hi6403) device name ,see in hi6403.c */
.codec_name = "hi6403-codec",
/* cpu(k3v3:asp) dai name(device name), see in hi3650-pcm.c */
.cpu_dai_name = "slimbus-dai",
/* codec dai name, see in struct snd_soc_dai_driver in hi6403.c */
.codec_dai_name = "hi6403-fm-dai",
/* platform(k3v3:asp) device name, see in hi3650-pcm.c */
.platform_name = "snd-soc-dummy",
},
{
/* dai link name*/
.name = "hi3650_fm2",
/* stream name same as name */
.stream_name = "hi3650_fm2",
/* codec(hi6401) device name ,see in hi6403.c */
.codec_name = "hi6403-codec",
/* cpu(k3v3:asp) dai name(device name), see in hi3650-pcm.c */
.cpu_dai_name = "slimbus-dai",
/* codec dai name, see in struct snd_soc_dai_driver in hi6403.c */
.codec_dai_name = "hi6403-fm-dai",
/* platform(k3v3:asp) device name, see in hi3650-pcm.c */
.platform_name = "snd-soc-dummy",
},
{
/* dai link name*/
.name = "hi3650_hi6403_pb_dsp",
/* stream name same as name */
.stream_name = "hi3650_hi6403_pb_dsp",
/* codec(hi6403) device name ,see in hi6403.c */
.codec_name = "hi6403-codec",
/* cpu(k3v3:asp) dai name(device name), see in hi3650-pcm.c */
.cpu_dai_name = "slimbus-dai",
/* codec dai name, see in struct snd_soc_dai_driver in hi6403.c */
.codec_dai_name = "hi6403-audio-dai",
/* platform(k3v3:asp) device name, see in hi3650-pcm.c */
.platform_name = "hi6210-hifi",
},
};
/* Audio machine driver */
static struct snd_soc_card hi3650_hi6403_card = {
/* sound card name, can see all sound cards in /proc/asound/cards */
.name = "hi3650_HI6403_CARD",
.owner = THIS_MODULE,
.dai_link = hi3650_hi6403_dai_link,
.num_links = ARRAY_SIZE(hi3650_hi6403_dai_link),
};
static int hi3650_hi6403_probe(struct platform_device *pdev)
{
int ret = 0;
struct snd_soc_card *card = &hi3650_hi6403_card;
pr_info("Audio : hi3650_hi6403_probe \n");
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
pr_err("%s : register failed %d\n", __FUNCTION__, ret);
HiLOGE("audio", "Hi3650_hi6403", "%s : register failed %d\n", __FUNCTION__, ret);
}
return ret;
}
static int hi3650_hi6403_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
if (NULL != card)
snd_soc_unregister_card(card);
return 0;
}
static const struct of_device_id hi3650_hi6403_of_match[] = {
{.compatible = "hisilicon,hi3xxx-hi6403", },
{ },
};
MODULE_DEVICE_TABLE(of, hi3650_hi6403_of_match);
static struct platform_driver hi3650_hi6403_driver = {
.driver = {
.name = "hi3650_hi6403",
.owner = THIS_MODULE,
.of_match_table = hi3650_hi6403_of_match,
},
.probe = hi3650_hi6403_probe,
.remove = hi3650_hi6403_remove,
};
//module_platform_driver(hi3650_hi6403_driver);
static int __init hi3650_init(void)
{
pr_info("Audio : hi3xxx-hi6403 init \n");
return platform_driver_register(&hi3650_hi6403_driver);
}
late_initcall(hi3650_init);
static void __exit hi3650_exit(void)
{
//remove_proc_entry("status", audio_pcm_dir);
platform_driver_unregister(&hi3650_hi6403_driver);
}
module_exit(hi3650_exit);
/* Module information */
MODULE_AUTHOR("liuyang <liuyang66@hisilicon.com>");
MODULE_DESCRIPTION("ALSA SoC for Hisilicon hi3650 with hi6403 codec");
MODULE_LICENSE("GPL");
MODULE_ALIAS("machine driver:hi3650-hi6403");
|
/***************************************************************************
See avisynth unblend
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef UNBLEND_PARAM_H
#define UNBLEND_PARAM_H
typedef struct PARAM_UNBLEND
{
uint32_t show;
uint32_t threshold;
float dthresh;
}PARAM_UNBLEND;
#endif
|
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "utils.h"
static __inline__ u_int16_t dn_ntohs(u_int16_t addr)
{
union {
u_int8_t byte[2];
u_int16_t word;
} u;
u.word = addr;
return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8);
}
static __inline__ int do_digit(char *str, u_int16_t *addr, u_int16_t scale, size_t *pos, size_t len, int *started)
{
u_int16_t tmp = *addr / scale;
if (*pos == len)
return 1;
if (((tmp) > 0) || *started || (scale == 1)) {
*str = tmp + '0';
*started = 1;
(*pos)++;
*addr -= (tmp * scale);
}
return 0;
}
static const char *dnet_ntop1(const struct dn_naddr *dna, char *str, size_t len)
{
u_int16_t addr = dn_ntohs(*(u_int16_t *)dna->a_addr);
u_int16_t area = addr >> 10;
size_t pos = 0;
int started = 0;
if (dna->a_len != 2)
return NULL;
addr &= 0x03ff;
if (len == 0)
return str;
if (do_digit(str + pos, &area, 10, &pos, len, &started))
return str;
if (do_digit(str + pos, &area, 1, &pos, len, &started))
return str;
if (pos == len)
return str;
*(str + pos) = '.';
pos++;
started = 0;
if (do_digit(str + pos, &addr, 1000, &pos, len, &started))
return str;
if (do_digit(str + pos, &addr, 100, &pos, len, &started))
return str;
if (do_digit(str + pos, &addr, 10, &pos, len, &started))
return str;
if (do_digit(str + pos, &addr, 1, &pos, len, &started))
return str;
if (pos == len)
return str;
*(str + pos) = 0;
return str;
}
const char *dnet_ntop(int af, const void *addr, char *str, size_t len)
{
switch(af) {
case AF_DECnet:
errno = 0;
return dnet_ntop1((struct dn_naddr *)addr, str, len);
default:
errno = EAFNOSUPPORT;
}
return NULL;
}
|
// Current version of the single player game
#define Q3_VERSION "JK2: v1.02"
// end
|
/*
The last number of the IMEI is a check digit. The Check Digit is calculated according to Luhn formula.
The Check Digit is a function of all other digits in the IMEI. The purpose of the Check Digit is to help guard against the possibility of incorrect entries to the CEIR and EIR equipment.
The check digit is validated in three steps:
Starting from the right, double a digit every two digits (e.g., 5 → 10).
Sum the digits (e.g., 10 → 1+0).
Check if the sum is divisible by 10.
Conversely, one can calculate the IMEI by choosing the check digit that would give a sum divisible by 10.
For example:
IMEI: 35145120840121
(5x2, 4x2, 1x2, 0x2, 4x2, 1x2, 1x2) = (10, 8, 2, 0, 8, 2, 2)
(1+0+8+2+0+8+2+2) + (3+1+5+2+8+0+2 ) = 44
Luhn Digit : 6
IMEI: 351451-20-840121-6
*/
#include <stdio.h>
int computerIMEIChecksum(char *digit)
{
int i;
int sum1=0,sum2=0,total=0;
int temp=0;
int checksum = 0;
for( i=0; i<14; i++ )
{
if((i%2)==0)
{
sum1 = sum1 + digit[i] - '0';
}
else
{
temp = (digit[i]-'0')*2;
if( temp < 10 )
{
sum2 = sum2 + temp;
}
else
{
sum2 = sum2 + 1 + temp - 10;
}
}
}
total = sum1 + sum2;
if( (total%10) == 0 )
{
checksum = 0;
}
else
{
checksum =((total/10) * 10) + 10 - total;
}
return checksum;
}
int isValidIMEI(char *digit)
{
if(computerIMEIChecksum(digit) == (digit[14] - '0'))
return 1;
else
return 0;
}
int main(int argc, char *argv[])
{
char testIMEI[15]={'3','5','1','4','5','1','2','0','8','4','0','1','2','1','6'};
if(isValidIMEI(testIMEI) )
{
printf("Valid IMEI\n");
}
else
{
printf("Invalid IMEI\n");
}
return 0;
}
|
/*
* include/linux/irqflags.h
*
* IRQ flags tracing: follow the state of the hardirq and softirq flags and
* provide callbacks for transitions between ON and OFF states.
*
* This file gets included from lowlevel asm headers too, to provide
* wrapped versions of the local_irq_*() APIs, based on the
* raw_local_irq_*() macros from the lowlevel headers.
*/
#ifndef _LINUX_TRACE_IRQFLAGS_H
#define _LINUX_TRACE_IRQFLAGS_H
#include <linux/typecheck.h>
#include <asm/irqflags.h>
#ifdef CONFIG_TRACE_IRQFLAGS // ARM10C N
extern void trace_softirqs_on(unsigned long ip);
extern void trace_softirqs_off(unsigned long ip);
extern void trace_hardirqs_on(void);
extern void trace_hardirqs_off(void);
# define trace_hardirq_context(p) ((p)->hardirq_context)
# define trace_softirq_context(p) ((p)->softirq_context)
# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
# define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
# define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
# define lockdep_softirq_enter() do { current->softirq_context++; } while (0)
# define lockdep_softirq_exit() do { current->softirq_context--; } while (0)
# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
#else
# define trace_hardirqs_on() do { } while (0) // ARM10C this
// ARM10C 20140412
# define trace_hardirqs_off() do { } while (0) // ARM10C this
# define trace_softirqs_on(ip) do { } while (0)
# define trace_softirqs_off(ip) do { } while (0)
# define trace_hardirq_context(p) 0
# define trace_softirq_context(p) 0
# define trace_hardirqs_enabled(p) 0
# define trace_softirqs_enabled(p) 0
# define trace_hardirq_enter() do { } while (0)
# define trace_hardirq_exit() do { } while (0)
# define lockdep_softirq_enter() do { } while (0)
# define lockdep_softirq_exit() do { } while (0)
# define INIT_TRACE_IRQFLAGS
#endif
#if defined(CONFIG_IRQSOFF_TRACER) || \
defined(CONFIG_PREEMPT_TRACER)
extern void stop_critical_timings(void);
extern void start_critical_timings(void);
#else
# define stop_critical_timings() do { } while (0)
# define start_critical_timings() do { } while (0)
#endif
/*
* Wrap the arch provided IRQ routines to provide appropriate checks.
*/
#define raw_local_irq_disable() arch_local_irq_disable()
#define raw_local_irq_enable() arch_local_irq_enable()
#define raw_local_irq_save(flags) \
do { \
typecheck(unsigned long, flags); \
flags = arch_local_irq_save();/*ARM10C 현재 cpsr을 flag로가져옴*/ \
} while (0)
// ARM10C 20130907
// ARM10C 20140412
#define raw_local_irq_restore(flags) \
do { \
typecheck(unsigned long, flags); \
arch_local_irq_restore(flags); \
} while (0)
// ARM10C 20130831
#define raw_local_save_flags(flags) \
do { \
typecheck(unsigned long, flags); \
flags = arch_local_save_flags(); \
} while (0)
// ARM10C 20140412
#define raw_irqs_disabled_flags(flags) \
({ \
typecheck(unsigned long, flags); \
arch_irqs_disabled_flags(flags); \
})
#define raw_irqs_disabled() (arch_irqs_disabled())
#define raw_safe_halt() arch_safe_halt()
/*
* The local_irq_*() APIs are equal to the raw_local_irq*()
* if !TRACE_IRQFLAGS.
*/
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT // ARM10C Y
#define local_irq_enable() \
do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
#define local_irq_disable() \
do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
// ARM10C 20140315
// flags에 CPSR값을 저장함
// ARM10C 20140405
#define local_irq_save(flags) /*ARM10C this*/ \
do { \
raw_local_irq_save(flags); \
trace_hardirqs_off(); \
} while (0)
// ARM10C 20130907
// ARM10C 20130322
// ARM10C 20140412
#define local_irq_restore(flags) \
do { \
if (raw_irqs_disabled_flags(flags)) {/*irq가 disabled 인가?*/ \
raw_local_irq_restore(flags); \
trace_hardirqs_off(); \
} else { \
trace_hardirqs_on(); \
raw_local_irq_restore(flags); \
} \
} while (0)
#define local_save_flags(flags) \
do { \
raw_local_save_flags(flags); \
} while (0)
#define irqs_disabled_flags(flags) \
({ \
raw_irqs_disabled_flags(flags); \
})
// ARM10C 20130831
// ARM10C 20131019
#define irqs_disabled() \
({ \
unsigned long _flags; \
raw_local_save_flags(_flags); \
raw_irqs_disabled_flags(_flags); \
})
#define safe_halt() \
do { \
trace_hardirqs_on(); \
raw_safe_halt(); \
} while (0)
#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
#define local_irq_enable() do { raw_local_irq_enable(); } while (0)
#define local_irq_disable() do { raw_local_irq_disable(); } while (0)
#define local_irq_save(flags) \
do { \
raw_local_irq_save(flags); \
} while (0)
#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
#define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0)
#define irqs_disabled() (raw_irqs_disabled())
#define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags))
#define safe_halt() do { raw_safe_halt(); } while (0)
#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
#endif
|
#ifndef __PYOPS_FOR_EMBED
#define __PYOPS_FOR_EMBED
#include "pyops_base.h"
template<typename T>
const T& pycall_t::call(const string& mod_name_, const string& func_name_, pycall_arg_t& pyarg_, pytype_tool_impl_t<T>& pyret)
{
PyObject *pName = NULL, *pModule = NULL;
string err_msg;
pName = PyString_FromString(mod_name_.c_str());
pModule = PyImport_Import(pName);
Py_DECREF(pName);
if (NULL == pModule)
{
pyops_t::traceback(err_msg);
throw runtime_error(err_msg.c_str());
return pyret.get_value();
}
call_func(pModule, mod_name_, func_name_, pyarg_, pyret, err_msg);
Py_DECREF(pModule);
if (!err_msg.empty())
{
throw runtime_error(err_msg.c_str());
}
return pyret.get_value();
}
template<typename T>
const T& pycall_t::call_obj_method(PyObject *pObj, const string& func_name_, pycall_arg_t& pyarg_, pytype_tool_impl_t<T>& pyret)
{
string err_msg;
if (NULL == pObj)
{
pyops_t::traceback(err_msg);
throw runtime_error(err_msg.c_str());
return pyret.get_value();
}
static string mod_name_ = "NaN";
call_func(pObj, mod_name_, func_name_, pyarg_, pyret, err_msg);
if (!err_msg.empty())
{
throw runtime_error(err_msg.c_str());
}
return pyret.get_value();
}
template<typename T>
const T& pycall_t::call_lambda(PyObject *pFunc, pycall_arg_t& pyarg_, pytype_tool_impl_t<T>& pyret)
{
string err_msg;
if (NULL == pFunc)
{
err_msg = "can not call null PyObject";
throw runtime_error(err_msg.c_str());
return pyret.get_value();
}
call_func_obj(pFunc, pyarg_, pyret, err_msg);
if (!err_msg.empty())
{
throw runtime_error(err_msg.c_str());
}
return pyret.get_value();
}
#endif
|
#ifndef _RDS_TCP_H
#define _RDS_TCP_H
#define RDS_TCP_PORT 16385
struct rds_tcp_incoming {
struct rds_incoming ti_inc;
struct sk_buff_head ti_skb_list;
};
struct rds_tcp_connection {
struct list_head t_tcp_node;
struct rds_connection *conn;
struct socket *t_sock;
void *t_orig_write_space;
void *t_orig_data_ready;
void *t_orig_state_change;
struct rds_tcp_incoming *t_tinc;
size_t t_tinc_hdr_rem;
size_t t_tinc_data_rem;
struct work_struct t_conn_w;
struct work_struct t_send_w;
struct work_struct t_down_w;
struct work_struct t_recv_w;
struct list_head t_list_item;
u32 t_last_sent_nxt;
u32 t_last_expected_una;
u32 t_last_seen_una;
};
struct rds_tcp_statistics {
uint64_t s_tcp_data_ready_calls;
uint64_t s_tcp_write_space_calls;
uint64_t s_tcp_sndbuf_full;
uint64_t s_tcp_connect_raced;
uint64_t s_tcp_listen_closed_stale;
};
int __init rds_tcp_init(void);
void rds_tcp_exit(void);
void rds_tcp_tune(struct socket *sock);
void rds_tcp_nonagle(struct socket *sock);
void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn);
void rds_tcp_restore_callbacks(struct socket *sock,
struct rds_tcp_connection *tc);
u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
u32 rds_tcp_snd_una(struct rds_tcp_connection *tc);
u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq);
extern struct rds_transport rds_tcp_transport;
int rds_tcp_conn_connect(struct rds_connection *conn);
void rds_tcp_conn_shutdown(struct rds_connection *conn);
void rds_tcp_state_change(struct sock *sk);
int __init rds_tcp_listen_init(void);
void rds_tcp_listen_stop(void);
void rds_tcp_listen_data_ready(struct sock *sk, int bytes);
int __init rds_tcp_recv_init(void);
void rds_tcp_recv_exit(void);
void rds_tcp_data_ready(struct sock *sk, int bytes);
int rds_tcp_recv(struct rds_connection *conn);
void rds_tcp_inc_purge(struct rds_incoming *inc);
void rds_tcp_inc_free(struct rds_incoming *inc);
int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov,
size_t size);
void rds_tcp_xmit_prepare(struct rds_connection *conn);
void rds_tcp_xmit_complete(struct rds_connection *conn);
int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
unsigned int hdr_off, unsigned int sg, unsigned int off);
void rds_tcp_write_space(struct sock *sk);
int rds_tcp_xmit_cong_map(struct rds_connection *conn,
struct rds_cong_map *map, unsigned long offset);
DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
#define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member)
unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
unsigned int avail);
#endif
|
/*
Copyright (C) 2006 Adam Charrett
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
stt.h
Decode PSIP System Time Table.
*/
#ifndef _ATSC_STT_H
#define _ATSC_STT_H
#define dvbpsi_atsc_unix_epoch_offset (315964800)
/*****************************************************************************
* dvbpsi_atsc_stt_t
*****************************************************************************/
/*!
* \struct dvbpsi_atsc_stt_s
* \brief STT structure.
*
* This structure is used to store a decoded STT.
*/
/*!
* \typedef struct dvbpsi_atsc_stt_s dvbpsi_atsc_stt_t
* \brief dvbpsi_atsc_stt_t type definition.
*/
typedef struct dvbpsi_atsc_stt_s
{
uint8_t i_protocol; /*!< PSIP Protocol version */
uint32_t i_system_time; /*!< GPS seconds since 1 January 1980 00:00:00 UTC. */
uint8_t i_gps_utc_offset; /*!< Seconds offset between GPS and UTC time. */
uint16_t i_daylight_savings; /*!< Daylight savings control bytes. */
dvbpsi_descriptor_t *p_first_descriptor; /*!< First descriptor. */
} dvbpsi_atsc_stt_t;
/*****************************************************************************
* dvbpsi_atsc_stt_callback
*****************************************************************************/
/*!
* \typedef void (* dvbpsi_atsc_stt_callback)(void* p_cb_data,
dvbpsi_atsc_stt_t* p_new_stt)
* \brief Callback type definition.
*/
typedef void (* dvbpsi_atsc_stt_callback)(void* p_cb_data, dvbpsi_atsc_stt_t* p_new_stt);
/*****************************************************************************
* dvbpsi_atsc_AttachSTT
*****************************************************************************/
/*!
* \fn void dvbpsi_atsc_AttachSTT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
dvbpsi_atsc_stt_callback pf_callback, void* p_cb_data)
*
* \brief Creation and initialization of a STT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0xCD.
* \param pf_callback function to call back on new STT.
* \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok.
*/
int dvbpsi_atsc_AttachSTT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
dvbpsi_atsc_stt_callback pf_callback, void* p_cb_data);
/*****************************************************************************
* dvbpsi_atsc_DetachSTT
*****************************************************************************/
/*!
* \fn void dvbpsi_atsc_DetachSTT(dvbpsi_demux_t * p_demux, uint8_t i_table_id)
*
* \brief Destroy a STT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0xCD.
* \param i_extension Table extension, ignored as this should always be 0.
* (Required to match prototype for demux)
* \return nothing.
*/
void dvbpsi_atsc_DetachSTT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, uint16_t i_externsion);
/*****************************************************************************
* dvbpsi_atsc_InitSTT/dvbpsi_atsc_NewSTT
*****************************************************************************/
/*!
* \fn void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t* p_stt, uint8_t i_version,
int b_current_next, uint8_t i_protocol)
* \brief Initialize a user-allocated dvbpsi_atsc_stt_t structure.
* \param p_stt pointer to the STT structure
* \param i_protocol PSIP Protocol version.
* \return nothing.
*/
void dvbpsi_atsc_InitSTT(dvbpsi_atsc_stt_t *p_stt,uint8_t i_protocol);
/*!
* \def dvbpsi_NewSTT(p_stt, i_network_id, i_version, b_current_next)
* \brief Allocate and initialize a new dvbpsi_atsc_stt_t structure. Use ObjectRefDec to delete it.
* \param p_stt pointer to the STT structure
* \param i_protocol PSIP Protocol version.
* \return nothing.
*/
#define dvbpsi_atsc_NewSTT(p_stt, i_protocol) \
do { \
ObjectRegisterTypeDestructor(dvbpsi_atsc_stt_t, (ObjectDestructor_t)dvbpsi_atsc_EmptySTT); \
p_stt = (dvbpsi_atsc_stt_t*)ObjectCreateType(dvbpsi_atsc_stt_t); \
if(p_stt != NULL) \
dvbpsi_atsc_InitSTT(p_stt, i_protocol); \
} while(0);
/*****************************************************************************
* dvbpsi_atsc_EmptySTT
*****************************************************************************/
/*!
* \fn void dvbpsi_atsc_EmptySTT(dvbpsi_atsc_stt_t* p_stt)
* \brief Clean a dvbpsi_atsc_stt_t structure.
* \param p_stt pointer to the STT structure
* \return nothing.
*/
void dvbpsi_atsc_EmptySTT(dvbpsi_atsc_stt_t *p_stt);
#endif
|
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; 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.
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. */
/***********************************************************************
* $Id: createindexprocessor.h 9210 2013-01-21 14:10:42Z rdempsey $
*
*
***********************************************************************/
/** @file */
#pragma once
#include "ddlpackageprocessor.h"
#include "ddlpkg.h"
const int BULK_LOAD = 1;
namespace ddlpackageprocessor
{
/** @brief specialization of a DDLPackageProcessor
* for interacting with the Write Engine to process
* create index ddl statements
*/
class CreateIndexProcessor : public DDLPackageProcessor
{
public:
/** @brief process a create index statement
*
* @param createIndexStmt the create index statement
*/
DDLResult processPackage(ddlpackage::CreateIndexStatement& createIndexStmt);
protected:
DDLResult rollBackCreateIndex(const std::string& error, BRM::TxnID& txnID, int sessionId);
void rollBackIndex(BRM::TxnID& txnID);
std::string errorString(const std::string& msg, int error);
private:
};
} // namespace ddlpackageprocessor
|
/* tosmarking.c
* Dynamic TOS management.
*
* Ziproxy - the HTTP acceleration proxy
* This code is under the following conditions:
*
* ---------------------------------------------------------------------
* Copyright (c)2009-2012 Daniel Mealha Cabrita
*
* 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
* ---------------------------------------------------------------------
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "globaldefs.h"
#include "urltables.h"
#include "cttables.h"
#include "log.h"
/* private, local. those are not the same as the vars with the same name */
int tosmarking_enabled;
SOCKET sock_child_out;
int TOSFlagsDefault;
int TOSFlagsDiff;
const t_ut_urltable *tos_markasdiff_url;
const t_ct_cttable *tos_maskasdiff_ct;
ZP_DATASIZE_TYPE TOSMarkAsDiffSizeBT;
int current_tos;
ZP_DATASIZE_TYPE tos_bytecount; /* counter used by TOSMarkAsDiffSizeBT */
void tosmarking_change_tos (int new_tos);
void tosmarking_change_tos (int new_tos)
{
setsockopt (sock_child_out, IPPROTO_IP, IP_TOS, (const void *) &new_tos, sizeof (new_tos));
}
/* this is the first function to be invoked before calling any TOS-related other */
/* returns: 0 - nothing done, != 0 changed TOS (because default TOS is specified) */
int tosmarking_init (const int in_tosmarking_enabled, const SOCKET in_sock_child_out, const int in_TOSFlagsDefault, const int in_TOSFlagsDiff, const t_ut_urltable *in_tos_markasdiff_url, const t_ct_cttable *in_tos_maskasdiff_ct, const int in_TOSMarkAsDiffSizeBT)
{
tos_bytecount = 0;
current_tos = -1; /* OS default, unknown */
tosmarking_enabled = in_tosmarking_enabled;
if (tosmarking_enabled) {
sock_child_out = in_sock_child_out;
TOSFlagsDefault = in_TOSFlagsDefault;
TOSFlagsDiff = in_TOSFlagsDiff;
tos_markasdiff_url = in_tos_markasdiff_url;
tos_maskasdiff_ct = in_tos_maskasdiff_ct;
TOSMarkAsDiffSizeBT = in_TOSMarkAsDiffSizeBT;
if (TOSFlagsDefault >= 0) {
tosmarking_change_tos (TOSFlagsDefault);
current_tos = TOSFlagsDefault;
return (1);
}
}
return (0);
}
/* sets byte counter to 0 */
void tosmarking_reset_bytecount ()
{
tos_bytecount = 0;
}
/* check if matches and marks accordingly */
/* to be invoked each time bytes are transferred to client when total file fize is unknown,
or called just once when total file size is already known. */
/* returns: 0 - nothing done, != 0 changed TOS */
int tosmarking_add_check_bytecount (const ZP_DATASIZE_TYPE in_bytes)
{
tos_bytecount += in_bytes;
if ((tosmarking_enabled) && \
(current_tos != TOSFlagsDiff) && \
(TOSMarkAsDiffSizeBT >= 0) && \
(tos_bytecount > TOSMarkAsDiffSizeBT)) {
tosmarking_change_tos (TOSFlagsDiff);
current_tos = TOSFlagsDiff;
debug_log_printf ("TOS: Bytecount reached at %"ZP_DATASIZE_STR" bytes. Changing TOS to 0x%x.\n", tos_bytecount, TOSFlagsDiff);
access_log_set_flags (LOG_AC_FLAG_TOS_CHANGED);
return (1);
}
return (0);
}
/* check if matches and marks accordingly */
/* to be called just once */
/* returns: 0 - nothing done, != 0 changed TOS */
int tosmarking_check_content_type (const char *in_content_type)
{
if ((tosmarking_enabled) && \
(TOSFlagsDiff >= 0) && \
(current_tos != TOSFlagsDiff) && \
(tos_maskasdiff_ct != NULL)) {
if (ct_check_if_matches (tos_maskasdiff_ct, in_content_type)) {
tosmarking_change_tos (TOSFlagsDiff);
current_tos = TOSFlagsDiff;
debug_log_printf ("TOS: Content-Type matches. Changing TOS to 0x%x.\n", TOSFlagsDiff);
access_log_set_flags (LOG_AC_FLAG_TOS_CHANGED);
return (1);
}
}
return (0);
}
/* check if matches and marks accordingly */
/* to be called just once */
/* returns: 0 - nothing done, != 0 changed TOS */
int tosmarking_check_url (const char *in_host, const char *in_path)
{
if ((tosmarking_enabled) && \
(TOSFlagsDiff >= 0) && \
(current_tos != TOSFlagsDiff) && \
(tos_markasdiff_url != NULL)) {
if (ut_check_if_matches (tos_markasdiff_url, in_host, in_path)) {
tosmarking_change_tos (TOSFlagsDiff);
current_tos = TOSFlagsDiff;
debug_log_printf ("TOS: URL matches. Changing TOS to 0x%x.\n", TOSFlagsDiff);
access_log_set_flags (LOG_AC_FLAG_TOS_CHANGED);
return (1);
}
}
return (0);
}
|
#include <stdio.h>
#include "include/compiler.h"
#include "include/virtualmachine.h"
#include "include/tools/stack.h"
int main( int argc,char** argv ){
Compiler* _comp = new_compiler( );
compiler_compile( _comp,"tests/file.txt" );
compiler_save_bytecode( _comp,"tests/bytecode.bin" );
compiler_delete( _comp );
VM* _vm = new_vm( );
vm_load_bytecode( _vm,"tests/bytecode.bin" );
vm_init( _vm );
vm_run( _vm );
vm_delete( _vm );
}
/*
IVector* objectivector = ivector_new( );
ivector_show_info( objectivector );
unsigned int i=0;
while( i<10 ){
ivector_push( objectivector,i );
ivector_show_info( objectivector );
i++;
}
ivector_dump( objectivector );
ivector_erase( objectivector,4 );
ivector_dump( objectivector );
ivector_delete( objectivector );
BVector* bvec = bvector_new( );
i=35;
while( i<127 ){
bvector_push( bvec,(byte)i );
i++;
}
bvector_dump( bvec );
bvector_delete( bvec );
File* bfile = file_new( "tests/file.bin" );
if( bfile == NULL )
printf( "Error on load file" );
else
printf( "Content file: %s",file_get_buffer( bfile ) );
file_delete( bfile );
String loco;
string_init( &loco,"Esto es una prueba" );
string_debug( &loco );
String* nombre = new_string( "Esto es una prueba de otro string" );
string_copy( &loco,nombre );
string_debug( &loco );
string_delete( nombre );
string_reference_delete( &loco );
SVector* tsv = new_svector( );
String* nstr = new_string( "Hola como estas todo bien?" );
String* nstr2 = new_string( "B" );
svector_push( tsv,nstr );
svector_push_text( tsv,"lkansmdlkasldkaslkd" );
svector_push_text( tsv,"2" );
//svector_push( tsv,nstr2 );
svector_push_text( tsv,"3" );
svector_push_text( tsv,"4" );
svector_push_text( tsv,"5" );
svector_erase( tsv,0 );
svector_dump( tsv );
printf( "DATA: %s\n",svector_at( tsv,3 )->buffer_mem_block_ );
string_delete( nstr );
string_delete( nstr2 );
svector_delete( tsv );
*/
|
/*
mtr -- a network diagnostic tool
Copyright (C) 1997,1998 Matt Kimball
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef DISPLAY_H
#define DISPLAY_H
#include <netinet/in.h>
#include "config.h"
#define UNKN_ITEM "???"
/* Don't put a trailing comma in enumeration lists. Some compilers
(notably the one on Irix 5.2) do not like that. */
enum { ActionNone, ActionQuit, ActionReset, ActionDisplay,
ActionClear, ActionPauseResume, ActionMPLS, ActionDNS, ActionTCP,
#ifdef IPINFO
ActionAS, ActionII, ActionII_Map,
#endif
ActionScrollDown, ActionScrollUp };
enum { DisplayReport, DisplayCurses,
#ifdef OUTPUT_FORMAT_CSV
DisplayCSV,
#endif
#ifdef OUTPUT_FORMAT_RAW
DisplayRaw,
#endif
#ifdef OUTPUT_FORMAT_TXT
DisplayTXT,
#endif
#ifdef OUTPUT_FORMAT_XML
DisplayXML,
#endif
#ifdef GRAPHCAIRO
DisplayGraphCairo,
#endif
DisplaySplit
};
/* Prototypes for display.c */
void display_detect(int *argc, char ***argv);
void display_open(void);
void display_close(time_t now);
void display_redraw(void);
int display_keyaction(void);
void display_loop(void);
void display_clear(void);
#endif
|
/*
* Copyright (C) 2015-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* 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.
*/
#pragma once
#if ENABLE(B3_JIT)
#include "AirArg.h"
namespace JSC { namespace B3 { namespace Air {
class Code;
class TmpWidth {
public:
TmpWidth();
TmpWidth(Code&);
~TmpWidth();
void recompute(Code&);
// The width of a Tmp is the number of bits that you need to be able to track without some trivial
// recovery. A Tmp may have a "subwidth" (say, Width32 on a 64-bit system) if either of the following
// is true:
//
// - The high bits are never read.
// - The high bits are always zero.
//
// This doesn't tell you which of those properties holds, but you can query that using the other
// methods.
Width width(Tmp tmp) const
{
auto iter = m_width.find(tmp);
if (iter == m_width.end())
return minimumWidth(Arg(tmp).bank());
return std::min(iter->value.use, iter->value.def);
}
// Return the minimum required width for all defs/uses of this Tmp.
Width requiredWidth(Tmp tmp)
{
auto iter = m_width.find(tmp);
if (iter == m_width.end())
return minimumWidth(Arg(tmp).bank());
return std::max(iter->value.use, iter->value.def);
}
// This indirectly tells you how much of the tmp's high bits are guaranteed to be zero. The number of
// high bits that are zero are:
//
// TotalBits - defWidth(tmp)
//
// Where TotalBits are the total number of bits in the register, so 64 on a 64-bit system.
Width defWidth(Tmp tmp) const
{
auto iter = m_width.find(tmp);
if (iter == m_width.end())
return minimumWidth(Arg(tmp).bank());
return iter->value.def;
}
// This tells you how much of Tmp is going to be read.
Width useWidth(Tmp tmp) const
{
auto iter = m_width.find(tmp);
if (iter == m_width.end())
return minimumWidth(Arg(tmp).bank());
return iter->value.use;
}
private:
struct Widths {
Widths() { }
Widths(Bank bank)
{
use = minimumWidth(bank);
def = minimumWidth(bank);
}
void dump(PrintStream& out) const;
Width use;
Width def;
};
HashMap<Tmp, Widths> m_width;
};
} } } // namespace JSC::B3::Air
#endif // ENABLE(B3_JIT)
|
/*
* Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* wrapper sinh(x)
*/
#include "fdlibm.h"
#ifdef __STDC__
double sinh(double x) /* wrapper sinh */
#else
double sinh(x) /* wrapper sinh */
double x;
#endif
{
#ifdef _IEEE_LIBM
return __ieee754_sinh(x);
#else
double z;
z = __ieee754_sinh(x);
if(_LIB_VERSION == _IEEE_) return z;
if(!finite(z)&&finite(x)) {
return __kernel_standard(x,x,25); /* sinh overflow */
} else
return z;
#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.
*/
#ifndef _ECM_IPA_H_
#define _ECM_IPA_H_
#include <mach/ipa.h>
/*
*/
typedef void (*ecm_ipa_callback)(void *priv,
enum ipa_dp_evt_type evt,
unsigned long data);
/*
*/
struct ecm_ipa_params {
ecm_ipa_callback ecm_ipa_rx_dp_notify;
ecm_ipa_callback ecm_ipa_tx_dp_notify;
u8 host_ethaddr[ETH_ALEN];
u8 device_ethaddr[ETH_ALEN];
void *private;
};
#ifdef CONFIG_ECM_IPA
int ecm_ipa_init(struct ecm_ipa_params *params);
int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
void *priv);
int ecm_ipa_disconnect(void *priv);
void ecm_ipa_cleanup(void *priv);
#else /* */
int ecm_ipa_init(struct ecm_ipa_params *params)
{
return 0;
}
static inline int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
void *priv)
{
return 0;
}
static inline int ecm_ipa_disconnect(void *priv)
{
return 0;
}
static inline void ecm_ipa_cleanup(void *priv)
{
}
#endif /* */
#endif /* */
|
//
// MXMovieDocument.h
// Lines
//
// Created by Paolo Bosetti on 29/09/14.
// Copyright (c) 2014 University of Trento. All rights reserved.
//
#import "MXDocument.h"
@interface MXMovieDocument : MXDocument
@end
|
// @(#)root/minuit2:$Id: MnFumiliMinimize.h 21530 2007-12-20 11:14:35Z moneta $
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
/**********************************************************************
* *
* Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
* *
**********************************************************************/
#ifndef ROOT_Minuit2_MnFumiliMinimize
#define ROOT_Minuit2_MnFumiliMinimize
#include "Minuit2/MnApplication.h"
#include "Minuit2/FumiliMinimizer.h"
#include "Minuit2/FumiliFCNBase.h"
namespace ROOT {
namespace Minuit2 {
// class FumiliFCNBase;
// class FCNBase;
//___________________________________________________________________________
/**
API class for minimization using Fumili technology;
allows for user interaction: set/change parameters, do minimization,
change parameters, re-do minimization etc.;
also used by MnMinos and MnContours;
*/
class MnFumiliMinimize : public MnApplication {
public:
/// construct from FumiliFCNBase + std::vector for parameters and errors
MnFumiliMinimize(const FumiliFCNBase& fcn, const std::vector<double>& par, const std::vector<double>& err, unsigned int stra = 1) : MnApplication(fcn, MnUserParameterState(par,err), MnStrategy(stra)), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
/// construct from FumiliFCNBase + std::vector for parameters and covariance
MnFumiliMinimize(const FumiliFCNBase& fcn, const std::vector<double>& par, unsigned int nrow, const std::vector<double>& cov, unsigned int stra = 1) : MnApplication(fcn, MnUserParameterState(par, cov, nrow), MnStrategy(stra)), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
/// construct from FumiliFCNBase + std::vector for parameters and MnUserCovariance
MnFumiliMinimize(const FumiliFCNBase& fcn, const std::vector<double>& par, const MnUserCovariance& cov, unsigned int stra = 1) : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
/// construct from FumiliFCNBase + MnUserParameters
MnFumiliMinimize(const FumiliFCNBase& fcn, const MnUserParameters& par, unsigned int stra = 1) : MnApplication(fcn, MnUserParameterState(par), MnStrategy(stra)), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
/// construct from FumiliFCNBase + MnUserParameters + MnUserCovariance
MnFumiliMinimize(const FumiliFCNBase& fcn, const MnUserParameters& par, const MnUserCovariance& cov, unsigned int stra = 1) : MnApplication(fcn, MnUserParameterState(par, cov), MnStrategy(stra)), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
/// construct from FumiliFCNBase + MnUserParameterState + MnStrategy
MnFumiliMinimize(const FumiliFCNBase& fcn, const MnUserParameterState& par, const MnStrategy& str) : MnApplication(fcn, MnUserParameterState(par), str), fMinimizer(FumiliMinimizer()), fFCN(fcn) {}
MnFumiliMinimize(const MnFumiliMinimize& migr) : MnApplication(migr.Fcnbase(), migr.State(), migr.Strategy(), migr.NumOfCalls()), fMinimizer(migr.fMinimizer), fFCN(migr.Fcnbase()) {}
virtual ~MnFumiliMinimize() { }
const FumiliMinimizer& Minimizer() const {return fMinimizer;}
const FumiliFCNBase & Fcnbase() const { return fFCN; }
/// overwrite Minimize to use FumiliFCNBase
virtual FunctionMinimum operator()(unsigned int = 0, double = 0.1);
private:
FumiliMinimizer fMinimizer;
const FumiliFCNBase & fFCN;
private:
//forbidden assignment of migrad (const FumiliFCNBase& = )
MnFumiliMinimize& operator=(const MnFumiliMinimize&) {return *this;}
};
} // namespace Minuit2
} // namespace ROOT
#endif // ROOT_Minuit2_MnFumiliMinimize
|
/******************************************************************************************************************************************
* ÎļþÃû³Æ: SWM320_wdt.c
* ¹¦ÄÜ˵Ã÷: SWM320µ¥Æ¬»úµÄWDT¿´ÃŹ·¹¦ÄÜÇý¶¯¿â
* ¼¼ÊõÖ§³Ö: http://www.synwit.com.cn/e/tool/gbook/?bid=1
* ×¢ÒâÊÂÏî:
* °æ±¾ÈÕÆÚ: V1.1.0 2017Äê10ÔÂ25ÈÕ
* Éý¼¶¼Ç¼:
*
*
*******************************************************************************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION
* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE
* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
* OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN-
* -ECTION WITH THEIR PRODUCTS.
*
* COPYRIGHT 2012 Synwit Technology
*******************************************************************************************************************************************/
#include "SWM320.h"
#include "SWM320_wdt.h"
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_Init()
* ¹¦ÄÜ˵Ã÷: WDT¿´ÃŹ·³õʼ»¯
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* uint32_t peroid ȡֵ0--4294967295£¬µ¥Î»Îªµ¥Æ¬»úϵͳʱÖÓÖÜÆÚ
* uint32_t mode WDT_MODE_RESET ³¬Ê±²úÉú¸´Î» WDT_MODE_INTERRUPT ³¬Ê±²úÉúÖжÏ
* Êä ³ö: ÎÞ
* ×¢ÒâÊÂÏî: ¸´Î»Ê¹ÄÜʱÖжϲ»Æð×÷Óã¬ÒòΪ¼ÆÊýÖÜÆÚ½áÊøÊ±Ð¾Æ¬Ö±½Ó¸´Î»ÁË£¬ÎÞ·¨ÏìÓ¦ÖжÏ
******************************************************************************************************************************************/
void WDT_Init(WDT_TypeDef * WDTx, uint32_t peroid, uint32_t mode)
{
SYS->CLKEN |= (0x01 << SYS_CLKEN_WDT_Pos);
WDT_Stop(WDTx); //ÉèÖÃǰÏȹرÕ
WDTx->LOAD = peroid;
if(mode == WDT_MODE_RESET)
{
NVIC_DisableIRQ(WDT_IRQn);
WDTx->CR |= (1 << WDT_CR_RSTEN_Pos);
}
else //mode == WDT_MODE_INTERRUPT
{
NVIC_EnableIRQ(WDT_IRQn);
WDTx->CR &= ~(1 << WDT_CR_RSTEN_Pos);
}
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_Start()
* ¹¦ÄÜ˵Ã÷: Æô¶¯Ö¸¶¨WDT£¬¿ªÊ¼µ¹¼ÆÊ±
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: ÎÞ
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
void WDT_Start(WDT_TypeDef * WDTx)
{
WDTx->CR |= (0x01 << WDT_CR_EN_Pos);
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_Stop()
* ¹¦ÄÜ˵Ã÷: ¹Ø±ÕÖ¸¶¨WDT£¬Í£Ö¹µ¹¼ÆÊ±
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: ÎÞ
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
void WDT_Stop(WDT_TypeDef * WDTx)
{
WDTx->CR &= ~(0x01 << WDT_CR_EN_Pos);
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_Feed()
* ¹¦ÄÜ˵Ã÷: ι¹·£¬ÖØÐ´Ó×°ÔØÖµ¿ªÊ¼µ¹¼ÆÊ±
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: ÎÞ
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
void WDT_Feed(WDT_TypeDef * WDTx)
{
WDTx->FEED = 0x55;
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_GetValue()
* ¹¦ÄÜ˵Ã÷: »ñȡָ¶¨¿´ÃŹ·¶¨Ê±Æ÷µÄµ±Ç°µ¹¼ÆÊ±Öµ
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: int32_t ¿´ÃŹ·µ±Ç°¼ÆÊýÖµ
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
int32_t WDT_GetValue(WDT_TypeDef * WDTx)
{
return WDTx->VALUE;
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_INTClr()
* ¹¦ÄÜ˵Ã÷: ÖжϱêÖ¾Çå³ý
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: ÎÞ
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
void WDT_INTClr(WDT_TypeDef * WDTx)
{
WDTx->IF = 1;
}
/******************************************************************************************************************************************
* º¯ÊýÃû³Æ: WDT_INTStat()
* ¹¦ÄÜ˵Ã÷: ÖжÏ״̬²éѯ
* Êä Èë: WDT_TypeDef * WDTx Ö¸¶¨Òª±»ÉèÖõĿ´ÃŹ·£¬ÓÐЧֵ°üÀ¨WDT
* Êä ³ö: int32_t 1 ·¢ÉúÖжÏÒç³ö 0 δ·¢ÉúÖжÏÒç³ö
* ×¢ÒâÊÂÏî: ÎÞ
******************************************************************************************************************************************/
uint32_t WDT_INTStat(WDT_TypeDef * WDTx)
{
return WDTx->IF;
}
|
/* THIS FILE IS GENERATED, DO NOT EDIT! */
ver_sig_t ver_sigs[]={
{(const char *)0xff8941d5, "GM1.00A"},
};
pid_sig_t pid_sigs[]={
{(short *)0xfffe0040, PLATFORMID},
};
|
//----------------------------------------------------------------
// Class: SysTrayMenu
// Description:
// A simple class to manage the system tray menu, it inherits
// from QMenu.
//----------------------------------------------------------------
#ifndef SYSTRAYMENU_H__
#define SYSTRAYMENU_H__
#include <QMenu.h>
class ProcessList;
class QAction;
class SysTrayMenu : public QMenu
{
Q_OBJECT
public:
SysTrayMenu(ProcessList* pl, QWidget* parent = 0);
QAction* get_config_action() {return config_action_;}
public slots:
void refresh();
protected:
ProcessList* proc_list_;
QList<QAction*> tunnel_actions_;
QAction* config_action_;
QAction* connect_action_;
QAction* reconnect_action_;
QAction* disconnect_action_;
QAction* quit_action_;
QAction* sep_;
};
#endif // SYSTRAYMENU_H__
|
/* $Id: textedit.h 355 2005-01-11 22:48:55Z andreradke $ */
/******************************************************************************
UserLand Frontier(tm) -- High performance Web content management,
object database, system-level and Internet scripting environment,
including source code editing and debugging.
Copyright (C) 1992-2004 UserLand Software, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#define texteditinclude /*so other includes can tell if we've been loaded*/
extern void edittextbox (bigstring, Rect, short, short, short);
extern boolean edittwostringbox (bigstring, bigstring, Rect, short, short);
|
#ifndef __H4D_EVENT_H__
#define __H4D_EVENT_H__
/*
* ****************************************
*
* Harmony4D - Praktische Aspekte der Informatik WS1314
*
* (c) 2013 by Alexander Knueppel
*
* ****************************************
*/
#include "../h4dConfiguration.h"
#include <cassert>
#include <memory>
#include <mutex>
#include <vector>
namespace h4d {
template <typename T>
struct EventHandler {
virtual void operator()(const T& value) = 0;
};
class H4D_API EventChannel {
private:
template <typename tEvent, typename tHandler>
struct Bridge : public EventHandler<tEvent> {
tHandler* mHandler;
Bridge(tHandler* handler): mHandler(handler) {}
void operator()(const tEvent& value) { (*mHandler)(value); }
bool operator == (const tHandler* handler) const { return mHandler == handler; }
};
template <typename tEvent>
struct EventHandlerQueue {
typedef EventHandler<tEvent> EventHandlerType;
typedef std::unique_ptr<EventHandlerType> EventHandlerPtr;
typedef std::vector<EventHandlerPtr> HandlerList;
typedef std::mutex Mutex;
typedef std::lock_guard<Mutex> ScopedLock;
Mutex mHandlerMutex;
bool mBroadcasting;
HandlerList mHandlers;
HandlerList mSyncList;
EventHandlerQueue() : mBroadcasting(false) {}
static EventHandlerQueue& instance() {
static EventHandlerQueue evQueue;
return evQueue;
}
template <typename tHandler>
void add(tHandler* handler) {
assert(handler != nullptr);
ScopedLock lock(mHandlerMutex);
if (mBroadcasting)
mSyncList.emplace_back(std::unique_ptr<Bridge<tEvent, tHandler> >(new Bridge<tEvent, tHandler>(handler)));
else
mHandlers.emplace_back(std::unique_ptr<Bridge<tEvent, tHandler> >(new Bridge<tEvent, tHandler>(handler)));
}
template <typename tHandler>
void remove(tHandler* handler) {
ScopedLock lock(mHandlerMutex);
for (auto& it = mHandlers.cbegin(); it != mHandlers.cend(); ++it) {
auto ptr = dynamic_cast<Bridge<tEvent, tHandler>*>(it->get());
if (ptr) {
if (*ptr == handler) {
mHandlers.erase(it);
break;
}
}
}
for (auto& it = mSyncList.cbegin(); it != mSyncList.cend(); ++it) {
auto ptr = dynamic_cast<Bridge<tEvent, tHandler>*>(it->get());
if (ptr) {
if (*ptr == handler) {
mSyncList.erase(it);
break;
}
}
}
}
void broadcast(const tEvent& evt) {
//thread-safe, starting block
{
ScopedLock lock(mHandlerMutex);
mBroadcasting = true;
}
//handle events
for (auto& handler: mHandlers)
(*handler)(evt);
//thread-safe, closing block
{
ScopedLock lock(mHandlerMutex);
mBroadcasting = false;
std::move(mSyncList.begin(), mSyncList.end(), std::back_inserter(mHandlers));
mSyncList.clear();
}
}
};
public:
template <typename tEvent, class tHandler>
void add(tHandler* handler) {
EventHandlerQueue<tEvent>::instance().add(handler);
}
template <typename tEvent, class tHandler>
void remove(tHandler* handler) {
EventHandlerQueue<tEvent>::instance().remove(handler);
}
template <typename tEvent>
void broadcast(const tEvent& evt) {
EventHandlerQueue<tEvent>::instance().broadcast(evt);
}
};
}
#endif
|
#pragma once
#include "cnc/field_load_info.h"
#include "cnc/content_installer.h"
namespace cnc {
struct CNC_API ModMetadata {
static const std::map<std::string, std::string>& CandidateModPaths();
static const std::map<std::string, ModMetadata>& AllMods();
std::vector<FieldLoadInfo> GetLoadInfo() const;
std::string id;
std::string title;
std::string description;
std::string version;
std::string author;
bool hidden = false;
ContentInstaller content;
};
}
|
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef ARRAY_INSTANCE_H
#define ARRAY_INSTANCE_H
#include "object.h"
namespace KJS {
struct ArrayStorage;
class KJS_EXPORT ArrayInstance : public JSObject {
public:
ArrayInstance(JSObject* prototype, unsigned initialLength);
ArrayInstance(JSObject* prototype, const List& initialValues);
~ArrayInstance();
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue*, int attributes = None);
virtual void put(ExecState*, unsigned propertyName, JSValue*, int attributes = None);
virtual bool deleteProperty(ExecState *, const Identifier& propertyName);
virtual bool deleteProperty(ExecState *, unsigned propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, PropertyMap::PropertyMode mode);
virtual void mark();
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
unsigned getLength() const { return m_length; }
JSValue* getItem(unsigned) const;
void sort(ExecState*);
void sort(ExecState*, JSObject* compareFunction);
private:
static JSValue* lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
bool inlineGetOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
void setLength(unsigned);
void increaseVectorLength(unsigned newLength);
unsigned compactForSorting();
unsigned m_length;
unsigned m_vectorLength;
ArrayStorage* m_storage;
};
} // namespace KJS
#endif
|
int foo2();
#inc test1
#incfile test2.c
|
/**********************************************************************
*
* PGPTools - PM shell for PGP v5.0 for OS/2
*
* Module : FILEDLG.H
* Info : File dialog routines (Header)
* Author : Bernd Giesen
* Compiler : Watcom C/C++ v10.6
*
* Copyright (c) 1999-2003 Bernd Giesen. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*
**********************************************************************
*
* History:
*
* 070499 - Created
* 110499 - Prototypes modified
* 150499 - Prototypes added
* 140699 - IsDetachedSignature declared as external
*
**********************************************************************/
#if !defined _FILEDLG_H
#define _FILEDLG_H
extern CHAR TempFile[];
extern CHAR TempOutFile[];
extern CHAR TempLogFile[];
extern CHAR TempKeyLog[];
extern BOOL IsDetachedSignature;
void BuildTempFileNames(void);
BOOL FileSettingsSelection(HWND hwnd, PSZ pDefaultFile, PSZ pTitle, PSZ pFilter);
tFSelType SourceFileSelection(HWND hwnd, PSZ pSourceFile, PSZ pTitle);
ULONG QueryTargetFile(HWND hwnd, PSZ pSourceFile, PSZ pTitle, BOOL ForVerify);
ULONG CopyClipBoardData2TempFile(void);
ULONG CopyTempFileData2ClipBoard(void);
void CreateKeyLogFile(HWND hwnd);
BOOL IsSignature(PSZ SrcFile);
#endif /* _FILEDLG_H */
|
/************************************************************************
* This technique was borrowed in part from the source code to
* ircd-hybrid-5.3 to implement case-insensitive string matches which
* are fully compliant with Section 2.2 of RFC 1459, the copyright
* of that code being (C) 1990 Jarkko Oikarinen and under the GPL.
*
* A special thanks goes to Mr. Okarinen for being the one person who
* seems to have ever noticed this section in the original RFC and
* written code for it. Shame on all the rest of you (myself included).
*
* --+ Dagmar d'Surreal
*/
#ifndef XCHAT_UTIL_H
#define XCHAT_UTIL_H
// used with StripColor
#define STRIP_COLOR 1
#define STRIP_ATTRIB 2
#define STRIP_HIDDEN 4
#define STRIP_ESCMARKUP 8
#define STRIP_ALL 7
#define rfc_tolower(c) (rfc_tolowertab[(unsigned char)(c)])
extern const unsigned char rfc_tolowertab[];
int my_poptParseArgvString(const char* s, int* argcPtr, char*** argvPtr);
char *expand_homedir(char *file);
void path_part(char *file, char *path, int pathlen);
int match(const char *mask, const char *string);
char *file_part(char *file);
void for_files(char *dirname, char *mask, void callback (char *file));
int rfc_casecmp(const char*, const char*);
int rfc_ncasecmp(char*, char*, int);
int buf_get_line(char*, char**, int*, int len);
char *nocasestrstr(const char *text, const char *tofind);
char *country(char *);
void country_search(char *pattern, void *ud, void (*print)(void*, char*, ...));
char *get_cpu_str();
int util_exec(const char *cmd);
int util_execv(char* const argv[]);
char *strip_color(const char *text, int len, int flags);
int strip_color2(const char *src, int len, char *dst, int flags);
int strip_hidden_attribute(char *src, char *dst);
char *errorstring(int err);
int waitline(int sok, char *buf, int bufsize, int);
#ifdef WIN32
int waitline2(GIOChannel *source, char *buf, int bufsize);
#else
#define waitline2(source,buf,size) waitline(serv->childread,buf,size,0)
#endif
unsigned long make_ping_time();
void move_file_utf8(char *src_dir, char *dst_dir, char *fname, int dccpermissions);
int mkdir_utf8(char *dir);
int token_foreach(char *str, char sep, int (*callback)(char *str, void *ud), void *ud);
unsigned int str_hash(const char *key);
unsigned int str_ihash(const unsigned char *key);
void safe_strcpy(char *dest, const char *src, int bytes_left);
#endif
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CONNECTION_H
#define CONNECTION_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
static bool loadScript(const char *name, bool line_by_line = false);
/*
This file defines a helper function to open a connection to an
in-memory SQLITE database and to create a test table.
If you want to use another database, simply modify the code
below. All the examples in this directory use this function to
connect to a database.
*/
//! [0]
static bool createConnection(QApplication * app)
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
// db.setDatabaseName(":memory:");
db.setDatabaseName("sukaldudb.db");
if (!db.open()) {
QMessageBox::critical(0, QMessageBox::tr("Cannot open database"),
QMessageBox::tr("Unable to establish a database connection.\n"
"Click Cancel to exit."), QMessageBox::Cancel);
return false;
}
QSqlQuery query;
query.prepare("SELECT infovalue FROM sukaldu_db WHERE infokey='dbversion'");
query.exec();
if (query.next())
{
if (query.value("infovalue").toString().compare("v1.0") == 0)
{
return true;
}
else
{
QMessageBox::critical(0, QMessageBox::tr("Cannot open database"),
QMessageBox::tr("The database doesn't correspond to this version of the program.\n"
"The db reports version [%1]\n"
"Click Cancel to exit.").arg(query.value("value").toString()), QMessageBox::Cancel);
return false;
}
}
else
{
QMessageBox::information(0, "Initializing DB",
"This is your first time. I will create a sample database for you.\n"
"Click Ok to continue.");
loadScript("data/database_definition.sql");
loadScript("data/database_sample.sql", true);
}
return true;
}
//! [0]
static bool loadScript(const char * name, bool line_by_line)
{
QSqlQuery query;
std::ifstream inputFile(name);
std::stringstream queryStr;
std::string tmpStr;
if(!inputFile)
//Test file open
{
std::cerr << "Error opening input file: " << name << std::endl;
std::exit(-1);
// return -1; // Shouldn't arrive here
}
while (!inputFile.eof())
{
if (std::getline(inputFile, tmpStr) &&
tmpStr.length() != 0 &&
tmpStr.compare(0, 2, "--") != 0) {
queryStr << tmpStr << std::endl;
}
if ((queryStr.str().length() != 0) &&
(tmpStr.length() == 0 ||
inputFile.eof() ||
line_by_line))
{
query.exec(queryStr.str().c_str());
// std::cout << "EXECUTE QUERY: " << std::endl;
// std::cout << queryStr.str() << std::endl;
// std::cout << "--------" << std::endl;
if (query.lastError().type() != QSqlError::NoError)
{
std::cerr << "ERROR: " << query.lastError().text().toUtf8().constData() << std::endl;
std::cerr << "IN QUERY: " << std::endl;
std::cerr << queryStr.str() << std::endl;
std::cerr << "--------" << std::endl;
std::exit(-1);
}
queryStr.str(std::string());
}
}
return true;
}
#endif
|
#ifndef IRC_H
#define IRC_H
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include "../net.h"
namespace std {
struct module;
typedef void (*module_init)(struct module &);
typedef int (*module_config)(string,string);
// a b
typedef void (*module_connected)();
typedef void (*module_mode)(string,string,string,vector<string>);
// nick host chan modes
typedef void (*module_msg)(string,string,vector<string>);
// nick host cmd
typedef void (*module_cmd)(string,vector<string>);
// nick cmd list
typedef void (*module_timer)();
struct module {
void *lib;
module_init init;
module_config config;
module_connected connected;
module_mode mode;
module_msg msg;
module_cmd cmd;
module_timer timer;
};
typedef map<string,module> modules_t;
extern modules_t modules;
extern int port;
extern string server,nick,password,oname,opassword,config,myhost,username,realname,slave_pass,bindhostname;
typedef vector<string> masters_t;
extern masters_t masters;
extern unsigned int max_modes;
extern int safe_mode,some_time,slave_port;
extern bool oper;
extern struct chanmodes {
string ab; // Always has a parameter. -- YOU MUST WRITE ov(h) HERE!!
string c; // Only has a parameter when set.
} isupport;
typedef map<string,string> param_t;
typedef void (*pend_func_t)(string&,string&,string&,vector<string>&,param_t&);
typedef map<string,pair<pend_func_t,map<string,string> > > pend_t;
extern pend_t pend;
typedef map<string,string> users_t;
extern users_t users; // nick -> hostmask (a@b)
typedef map<string,bool> channel_t; // nick -> ?op
typedef map<string,channel_t> channels_t; // channel -> list of nicks and ?ops
extern channels_t channels;
// 'slave' connection
struct slave_c {
bool authd, dead;
net::TomiTCP *s;
};
typedef vector<slave_c> slavec_t;
// 'slave' (i'm master)
struct slave {
string mask;
bool maskd, dead;
net::TomiTCP *s;
};
typedef vector<slave> slaves_t;
extern slavec_t slavec;
extern slaves_t slaves;
extern void processsome();
extern void S(net::TomiTCP &f, const char* fmt, ...);
extern void loadmodule(string name);
extern void unloadmodule(string name);
extern void login();
extern void splitprefix(string prefix, string &nick, string &host);
extern net::TomiTCP sock;
extern net::TomiTCP &f;
}
#endif /* IRC_H */
|
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.arch = MODULE_ARCH_INIT,
};
MODULE_INFO(intree, "Y");
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0xce969278, "module_layout" },
{ 0x2546a652, "kmalloc_caches" },
{ 0x15692c87, "param_ops_int" },
{ 0x9fca1d63, "i2c_transfer" },
{ 0x27e1a049, "printk" },
{ 0xecdf8ea1, "kmem_cache_alloc_trace" },
{ 0x37a0cba, "kfree" },
{ 0x9d669763, "memcpy" },
{ 0xefd6cf06, "__aeabi_unwind_cpp_pr0" },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "2D975D0884FA86000B00493");
|
// normals table for the .mdl files
{-0.525731, 0.000000, 0.850651},
{-0.442863, 0.238856, 0.864188},
{-0.295242, 0.000000, 0.955423},
{-0.309017, 0.500000, 0.809017},
{-0.162460, 0.262866, 0.951056},
{0.000000, 0.000000, 1.000000},
{0.000000, 0.850651, 0.525731},
{-0.147621, 0.716567, 0.681718},
{0.147621, 0.716567, 0.681718},
{0.000000, 0.525731, 0.850651},
{0.309017, 0.500000, 0.809017},
{0.525731, 0.000000, 0.850651},
{0.295242, 0.000000, 0.955423},
{0.442863, 0.238856, 0.864188},
{0.162460, 0.262866, 0.951056},
{-0.681718, 0.147621, 0.716567},
{-0.809017, 0.309017, 0.500000},
{-0.587785, 0.425325, 0.688191},
{-0.850651, 0.525731, 0.000000},
{-0.864188, 0.442863, 0.238856},
{-0.716567, 0.681718, 0.147621},
{-0.688191, 0.587785, 0.425325},
{-0.500000, 0.809017, 0.309017},
{-0.238856, 0.864188, 0.442863},
{-0.425325, 0.688191, 0.587785},
{-0.716567, 0.681718, -0.147621},
{-0.500000, 0.809017, -0.309017},
{-0.525731, 0.850651, 0.000000},
{0.000000, 0.850651, -0.525731},
{-0.238856, 0.864188, -0.442863},
{0.000000, 0.955423, -0.295242},
{-0.262866, 0.951056, -0.162460},
{0.000000, 1.000000, 0.000000},
{0.000000, 0.955423, 0.295242},
{-0.262866, 0.951056, 0.162460},
{0.238856, 0.864188, 0.442863},
{0.262866, 0.951056, 0.162460},
{0.500000, 0.809017, 0.309017},
{0.238856, 0.864188, -0.442863},
{0.262866, 0.951056, -0.162460},
{0.500000, 0.809017, -0.309017},
{0.850651, 0.525731, 0.000000},
{0.716567, 0.681718, 0.147621},
{0.716567, 0.681718, -0.147621},
{0.525731, 0.850651, 0.000000},
{0.425325, 0.688191, 0.587785},
{0.864188, 0.442863, 0.238856},
{0.688191, 0.587785, 0.425325},
{0.809017, 0.309017, 0.500000},
{0.681718, 0.147621, 0.716567},
{0.587785, 0.425325, 0.688191},
{0.955423, 0.295242, 0.000000},
{1.000000, 0.000000, 0.000000},
{0.951056, 0.162460, 0.262866},
{0.850651, -0.525731, 0.000000},
{0.955423, -0.295242, 0.000000},
{0.864188, -0.442863, 0.238856},
{0.951056, -0.162460, 0.262866},
{0.809017, -0.309017, 0.500000},
{0.681718, -0.147621, 0.716567},
{0.850651, 0.000000, 0.525731},
{0.864188, 0.442863, -0.238856},
{0.809017, 0.309017, -0.500000},
{0.951056, 0.162460, -0.262866},
{0.525731, 0.000000, -0.850651},
{0.681718, 0.147621, -0.716567},
{0.681718, -0.147621, -0.716567},
{0.850651, 0.000000, -0.525731},
{0.809017, -0.309017, -0.500000},
{0.864188, -0.442863, -0.238856},
{0.951056, -0.162460, -0.262866},
{0.147621, 0.716567, -0.681718},
{0.309017, 0.500000, -0.809017},
{0.425325, 0.688191, -0.587785},
{0.442863, 0.238856, -0.864188},
{0.587785, 0.425325, -0.688191},
{0.688191, 0.587785, -0.425325},
{-0.147621, 0.716567, -0.681718},
{-0.309017, 0.500000, -0.809017},
{0.000000, 0.525731, -0.850651},
{-0.525731, 0.000000, -0.850651},
{-0.442863, 0.238856, -0.864188},
{-0.295242, 0.000000, -0.955423},
{-0.162460, 0.262866, -0.951056},
{0.000000, 0.000000, -1.000000},
{0.295242, 0.000000, -0.955423},
{0.162460, 0.262866, -0.951056},
{-0.442863, -0.238856, -0.864188},
{-0.309017, -0.500000, -0.809017},
{-0.162460, -0.262866, -0.951056},
{0.000000, -0.850651, -0.525731},
{-0.147621, -0.716567, -0.681718},
{0.147621, -0.716567, -0.681718},
{0.000000, -0.525731, -0.850651},
{0.309017, -0.500000, -0.809017},
{0.442863, -0.238856, -0.864188},
{0.162460, -0.262866, -0.951056},
{0.238856, -0.864188, -0.442863},
{0.500000, -0.809017, -0.309017},
{0.425325, -0.688191, -0.587785},
{0.716567, -0.681718, -0.147621},
{0.688191, -0.587785, -0.425325},
{0.587785, -0.425325, -0.688191},
{0.000000, -0.955423, -0.295242},
{0.000000, -1.000000, 0.000000},
{0.262866, -0.951056, -0.162460},
{0.000000, -0.850651, 0.525731},
{0.000000, -0.955423, 0.295242},
{0.238856, -0.864188, 0.442863},
{0.262866, -0.951056, 0.162460},
{0.500000, -0.809017, 0.309017},
{0.716567, -0.681718, 0.147621},
{0.525731, -0.850651, 0.000000},
{-0.238856, -0.864188, -0.442863},
{-0.500000, -0.809017, -0.309017},
{-0.262866, -0.951056, -0.162460},
{-0.850651, -0.525731, 0.000000},
{-0.716567, -0.681718, -0.147621},
{-0.716567, -0.681718, 0.147621},
{-0.525731, -0.850651, 0.000000},
{-0.500000, -0.809017, 0.309017},
{-0.238856, -0.864188, 0.442863},
{-0.262866, -0.951056, 0.162460},
{-0.864188, -0.442863, 0.238856},
{-0.809017, -0.309017, 0.500000},
{-0.688191, -0.587785, 0.425325},
{-0.681718, -0.147621, 0.716567},
{-0.442863, -0.238856, 0.864188},
{-0.587785, -0.425325, 0.688191},
{-0.309017, -0.500000, 0.809017},
{-0.147621, -0.716567, 0.681718},
{-0.425325, -0.688191, 0.587785},
{-0.162460, -0.262866, 0.951056},
{0.442863, -0.238856, 0.864188},
{0.162460, -0.262866, 0.951056},
{0.309017, -0.500000, 0.809017},
{0.147621, -0.716567, 0.681718},
{0.000000, -0.525731, 0.850651},
{0.425325, -0.688191, 0.587785},
{0.587785, -0.425325, 0.688191},
{0.688191, -0.587785, 0.425325},
{-0.955423, 0.295242, 0.000000},
{-0.951056, 0.162460, 0.262866},
{-1.000000, 0.000000, 0.000000},
{-0.850651, 0.000000, 0.525731},
{-0.955423, -0.295242, 0.000000},
{-0.951056, -0.162460, 0.262866},
{-0.864188, 0.442863, -0.238856},
{-0.951056, 0.162460, -0.262866},
{-0.809017, 0.309017, -0.500000},
{-0.864188, -0.442863, -0.238856},
{-0.951056, -0.162460, -0.262866},
{-0.809017, -0.309017, -0.500000},
{-0.681718, 0.147621, -0.716567},
{-0.681718, -0.147621, -0.716567},
{-0.850651, 0.000000, -0.525731},
{-0.688191, 0.587785, -0.425325},
{-0.587785, 0.425325, -0.688191},
{-0.425325, 0.688191, -0.587785},
{-0.425325, -0.688191, -0.587785},
{-0.587785, -0.425325, -0.688191},
{-0.688191, -0.587785, -0.425325},
|
/*-
* Copyright (c) 1993 Andrew Moore, Talke Studio
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#) floatingpoint.h 1.0 (Berkeley) 9/23/93
* $FreeBSD: release/8.2.0/sys/amd64/include/floatingpoint.h 144544 2005-04-02 17:31:42Z netchild $
*/
#ifndef _FLOATINGPOINT_H_
#define _FLOATINGPOINT_H_
#include <sys/cdefs.h>
#include <machine/ieeefp.h>
#endif /* !_FLOATINGPOINT_H_ */
|
/*
* CSV Selector
*
* by William R. Fraser, 10/22/2011
*/
#ifndef QUERYEVAL_H
#define QUERYEVAL_H
#include <stdbool.h>
#include "growbuf.h"
#include "queryparse.h"
void val_free(val* val);
void selector_free(selector* s);
val value_evaluate(const val* val, growbuf* fields, size_t rownum);
bool query_evaluate(growbuf* fields, size_t rownum, compound* condition);
#endif //QUERYEVAL_H
|
/*
* This file is a part of OpenNIC Wizard
* Copywrong (c) 2012-2018 Mike Sharkey
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 1776):
* <mike@8bitgeek.net> wrote this file.
* As long as you retain this notice you can do whatever you want with this
* stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return. ~ Mike Sharkey
* ----------------------------------------------------------------------------
*/
#ifndef OPENNICNET_H
#define OPENNICNET_H
#include <QObject>
#include <QTcpSocket>
#include "opennicpacket.h"
class OpenNICNet : public QObject
{
Q_OBJECT
public:
OpenNICNet(QTcpSocket* socket, QObject *parent = 0);
virtual ~OpenNICNet();
QTcpSocket* socket() {return mSocket;}
OpenNICPacket& rxPacket() {return mRXPacket;}
OpenNICPacket& txPacket() {return mTXPacket;}
bool isLive();
public slots:
void clear();
void send(bool clear=false);
signals:
void pollKeyValue(QString& key, QVariant& value, bool& valid);
void dataReady(OpenNICNet* net);
private slots:
void readyRead();
void dataReady();
private:
QTcpSocket* mSocket;
OpenNICPacket mRXPacket;
OpenNICPacket mTXPacket;
};
#endif // OPENNICNET_H
|
/*
* lifi-cell.h
*
* Created on: 2014-4-10
* Author: root
*/
#ifndef LIFI_CELL_H_
#define LIFI_CELL_H_
#include "ns3/core-module.h"
#include "ns3/object.h"
#include "lifi-spectrum-phy.h"
#include <vector>
namespace ns3 {
struct LifiTransmitter : public Object
{
uint8_t m_id;
};
class LifiCell: public Object {
public:
LifiCell();
LifiCell(Ptr<LifiSpectrumPhy> spectrumPhy,uint16_t id);
virtual ~LifiCell();
static TypeId GetTypeId();
void BindSpectrumPhy();
void UnbindSpectrumPhy();
void UpdateCell(std::vector< Ptr<LifiTransmitter> > trxList);
Ptr<LifiSpectrumPhy> GetLifiSpectrumPhy();
void SetCellId (uint8_t id);
uint8_t GetCellId ();
private:
Ptr<LifiSpectrumPhy> m_spectrumPhy;
std::vector< Ptr<LifiTransmitter> > m_lifiTrxList;
uint16_t m_cellId;
uint32_t a;
};
} /* namespace ns3 */
#endif /* LIFI_CELL_H_ */
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/ScreenReaderOutputServer.framework/ScreenReaderOutputServer
*/
#import <ScreenReaderOutputServer/ScreenReaderOutputServer-Structs.h>
#import <ScreenReaderOutputServer/XXUnknownSuperclass.h>
@class NSLock;
@protocol SCROServerDelegate;
@interface SCROServer : XXUnknownSuperclass {
NSLock *_contentLock; // 4 = 0x4
id<SCROServerDelegate> _delegate; // 8 = 0x8
CFRunLoopSourceRef _serverSource; // 12 = 0xc
CFRunLoopSourceRef _deathSource; // 16 = 0x10
CFRunLoopTimerRef _deathTimer; // 20 = 0x14
unsigned _serverPort; // 24 = 0x18
unsigned _deathPort; // 28 = 0x1c
int _clientCount; // 32 = 0x20
BOOL _isRegisteredWithMach; // 36 = 0x24
}
@property(assign) id delegate; // G=0x1b905; S=0x1b8f5; converted property
@property(readonly, assign) CFRunLoopSourceRef serverSource; // G=0x1ba39; converted property
@property(readonly, assign) BOOL isRegisteredWithMach; // G=0x1b915; converted property
+ (id)sharedServer; // 0x1b8cd
+ (void)initialize; // 0x1b969
+ (id)allocWithZone:(NSZone *)zone; // 0x1b925
- (id)init; // 0x1b9c5
- (id)copyWithZone:(NSZone *)zone; // 0x1b8dd
- (id)retain; // 0x1b8e1
- (unsigned)retainCount; // 0x1b8e5
- (void)release; // 0x1b8ed
- (id)autorelease; // 0x1b8f1
- (long)_clientCount; // 0x1bf95
- (long)_incrementClientCount; // 0x1bf45
- (void)_setClientCount:(long)count; // 0x1bef9
- (CFRunLoopTimerRef)_deathTimer; // 0x1be89
- (int)_registerForNotificationOnDeathPort:(unsigned)notificationOnDeathPort; // 0x1be0d
// converted property setter: - (void)setDelegate:(id)delegate; // 0x1b8f5
// converted property getter: - (id)delegate; // 0x1b905
// converted property getter: - (BOOL)isRegisteredWithMach; // 0x1b915
- (BOOL)registerWithMach; // 0x1bbdd
- (void)unregisterWithMach; // 0x1baa9
// converted property getter: - (CFRunLoopSourceRef)serverSource; // 0x1ba39
@end
|
/* File: angband.h */
/* Main "Angband" header file */
#ifndef INCLUDED_ANGBAND_H
#define INCLUDED_ANGBAND_H
/*
* Copyright (c) 1989 James E. Wilson
*
* This software may be copied and distributed for educational, research, and
* not for profit purposes provided that this copyright and statement are
* included in all such copies.
*/
/*
* First, include the low-level includes. Be sure to edit "h-config.h"
* to reflect any hardware, operating system, or compiler nuances.
*/
#include "h-basic.h"
/*
* Then, include the header files for the low-level code
*/
#include "z-util.h"
#include "z-virt.h"
#include "z-form.h"
#include "z-rand.h"
#include "z-term.h"
#include "z-sock.h"
/*
* Include the "Angband" configuration header
*/
#include "config.h"
/*
* Now, include the define's, the type's, and the extern's
*/
#include "defines.h"
#include "types.h"
#include "externs.h"
#include "plots.h"
/***** Some copyright messages follow below *****/
/*
* Note that these copyright messages apply to an ancient version
* of Angband, as in, from pre-2.4.frog-knows days, and thus the
* reference to "5.0" is rather misleading...
*/
/*
* UNIX ANGBAND Version 5.0
*/
/* Original copyright message follows. */
/*
* ANGBAND Version 4.8 COPYRIGHT (c) Robert Alan Koeneke
*
* I lovingly dedicate this game to hackers and adventurers
* everywhere...
*
* Designer and Programmer:
* Robert Alan Koeneke
* University of Oklahoma
*
* Assistant Programmer:
* Jimmey Wayne Todd
* University of Oklahoma
*
* Assistant Programmer:
* Gary D. McAdoo
* University of Oklahoma
*
* UNIX Port:
* James E. Wilson
* UC Berkeley
* wilson@ernie.Berkeley.EDU
* ucbvax!ucbernie!wilson
*/
/*
* ANGBAND may be copied and modified freely as long as the above
* credits are retained. No one who-so-ever may sell or market
* this software in any form without the expressed written consent
* of the author Robert Alan Koeneke.
*/
#endif
|
/*
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef METRIC_H__
#define METRIC_H__
#include "Define.h"
#include "MPSCQueue.h"
#include <chrono>
#include <functional>
#include <iosfwd>
#include <memory>
#include <string>
namespace Trinity
{
namespace Asio
{
class IoContext;
class DeadlineTimer;
}
}
enum MetricDataType
{
METRIC_DATA_VALUE,
METRIC_DATA_EVENT
};
struct MetricData
{
std::string Category;
std::chrono::system_clock::time_point Timestamp;
MetricDataType Type;
// LogValue-specific fields
std::string Value;
// LogEvent-specific fields
std::string Title;
std::string Text;
};
class TC_COMMON_API Metric
{
private:
std::iostream& GetDataStream() { return *_dataStream; }
std::unique_ptr<std::iostream> _dataStream;
MPSCQueue<MetricData> _queuedData;
std::unique_ptr<Trinity::Asio::DeadlineTimer> _batchTimer;
std::unique_ptr<Trinity::Asio::DeadlineTimer> _overallStatusTimer;
int32 _updateInterval = 0;
int32 _overallStatusTimerInterval = 0;
bool _enabled = false;
bool _overallStatusTimerTriggered = false;
std::string _hostname;
std::string _port;
std::string _databaseName;
std::function<void()> _overallStatusLogger;
std::string _realmName;
bool Connect();
void SendBatch();
void ScheduleSend();
void ScheduleOverallStatusLog();
static std::string FormatInfluxDBValue(bool value);
template <class T>
static std::string FormatInfluxDBValue(T value);
static std::string FormatInfluxDBValue(std::string const& value);
static std::string FormatInfluxDBValue(char const* value);
static std::string FormatInfluxDBValue(double value);
static std::string FormatInfluxDBValue(float value);
static std::string FormatInfluxDBTagValue(std::string const& value);
// ToDo: should format TagKey and FieldKey too in the same way as TagValue
public:
Metric();
~Metric();
static Metric* instance();
void Initialize(std::string const& realmName, Trinity::Asio::IoContext& ioContext, std::function<void()> overallStatusLogger);
void LoadFromConfigs();
void Update();
template<class T>
void LogValue(std::string const& category, T value)
{
using namespace std::chrono;
MetricData* data = new MetricData;
data->Category = category;
data->Timestamp = system_clock::now();
data->Type = METRIC_DATA_VALUE;
data->Value = FormatInfluxDBValue(value);
_queuedData.Enqueue(data);
}
void LogEvent(std::string const& category, std::string const& title, std::string const& description);
void Unload();
bool IsEnabled() const { return _enabled; }
};
#define sMetric Metric::instance()
#ifdef PERFORMANCE_PROFILING
#define TC_METRIC_EVENT(category, title, description) ((void)0)
#define TC_METRIC_VALUE(category, value) ((void)0)
#elif TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
#define TC_METRIC_EVENT(category, title, description) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogEvent(category, title, description); \
} while (0)
#define TC_METRIC_VALUE(category, value) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogValue(category, value); \
} while (0)
#else
#define TC_METRIC_EVENT(category, title, description) \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogEvent(category, title, description); \
} while (0) \
__pragma(warning(pop))
#define TC_METRIC_VALUE(category, value) \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogValue(category, value); \
} while (0) \
__pragma(warning(pop))
#endif
#endif // METRIC_H__
|
/*******************************************************
Copyright (C) 2009 VaDiM
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 MM_EX_PATHS_H_
#define MM_EX_PATHS_H_
//----------------------------------------------------------------------------
/*
mmex's files and dirs locations.
All functions return absolute paths.
*/
//----------------------------------------------------------------------------
class wxString;
class wxIcon;
//----------------------------------------------------------------------------
namespace mmex
{
enum EDocFile { F_README = 0, F_CONTRIB, F_LICENSE, F_VERSION, HTML_INDEX, HTML_CUSTOM_SQL, HTML_INVESTMENT, HTML_BUDGET, DOC_FILES_MAX };
wxString getPathDoc(const EDocFile& f);
enum EResFile { PROGRAM_ICON = 0, TRANS_SOUND, HOME_PAGE_TEMPLATE, RES_FILES_MAX };
wxString getPathResource(EResFile f);
// use instead of getPathResource(PROGRAM_ICON)
const wxIcon& getProgramIcon();
enum ESharedFile { LANG_DIR = 0, SHARED_FILES_MAX };
const wxString getPathShared(ESharedFile f);
enum EUserFile { SETTINGS = 0, DIRECTORY, USER_FILES_MAX };
const wxString getPathUser(EUserFile f);
const wxString getPathAttachment(const wxString &AttachmentsFolder);
bool isPortableMode();
const wxString getReportIndex();
const wxString getTempFolder();
const wxString getReportFullFileName(const wxString& name);
} // namespace mmex
//----------------------------------------------------------------------------
#endif // MM_EX_PATHS_H_
//----------------------------------------------------------------------------
|
/**
******************************************************************************
* @file USB_Host/MSC_Standalone/Src/explorer.c
* @author MCD Application Team
* @version V1.0.1
* @date 09-October-2015
* @brief Explore the USB flash disk content
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 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 "main.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
* @brief Displays disk content.
* @param path: Pointer to root path
* @param recu_level: Disk content level
* @retval Operation result
*/
FRESULT Explore_Disk(char *path, uint8_t recu_level)
{
FRESULT res = FR_OK;
FILINFO fno;
DIR dir;
char *fn;
char tmp[14];
uint8_t line_idx = 0;
#if _USE_LFN
static char lfn[_MAX_LFN + 1]; /* Buffer to store the LFN */
fno.lfname = lfn;
fno.lfsize = sizeof lfn;
#endif
res = f_opendir(&dir, path);
if(res == FR_OK)
{
while(USBH_MSC_IsReady(&hUSBHost))
{
res = f_readdir(&dir, &fno);
if(res != FR_OK || fno.fname[0] == 0)
{
break;
}
if(fno.fname[0] == '.')
{
continue;
}
#if _USE_LFN
fn = *fno.lfname ? fno.lfname : fno.fname;
#else
fn = fno.fname;
#endif
strcpy(tmp, fn);
line_idx++;
if(line_idx > 9)
{
line_idx = 0;
LCD_UsrLog("> Press [Key] To Continue.\n");
/* KEY Button in polling */
while(BSP_PB_GetState(BUTTON_KEY) != RESET)
{
/* Wait for User Input */
}
}
if(recu_level == 1)
{
LCD_DbgLog(" |__");
}
else if(recu_level == 2)
{
LCD_DbgLog(" | |__");
}
if((fno.fattrib & AM_MASK) == AM_DIR)
{
strcat(tmp, "\n");
LCD_UsrLog((void *)tmp);
Explore_Disk(fn, 2);
}
else
{
strcat(tmp, "\n");
LCD_DbgLog((void *)tmp);
}
if(((fno.fattrib & AM_MASK) == AM_DIR)&&(recu_level == 2))
{
Explore_Disk(fn, 2);
}
}
f_closedir(&dir);
LCD_UsrLog("> Select an operation to Continue.\n");
}
return res;
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Cashbox is the legal property of its developers, whose names are listed in the copyright file included
* with this source distribution.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Cashbox/CBModelExtensionPlugin.h>
@interface CBCreditPlugin : CBModelExtensionPlugin {
}
@end
|
#ifndef DEVFINO_H
#define DEVFINO_H
/*****************************************************************************
* MODULE DEFINITION
*****************************************************************************/
#define MODULE_NAME "[devinfo]"
#define DEV_NAME "devmap"
#define MAJOR_DEV_NUM 196
/*****************************************************************************
* IOCTL DEFINITION
*****************************************************************************/
#define DEV_IOC_MAGIC 'd'
#define READ_DEV_DATA _IOR(DEV_IOC_MAGIC, 1, unsigned int)
#define DEV_IOC_MAXNR (10)
/*****************************************************************************
* EXPORT DEFINITION
*****************************************************************************/
extern u32 g_devinfo_data_size;
extern u32 get_devinfo_with_index(u32 index);
#endif /* end of DEVFINO_H */
|
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "utils/LabelFormatter.h"
#include "SortFileItem.h"
#include "guilib/GUIBaseContainer.h"
#include "MediaSource.h"
class CViewState; // forward
class CFileItemList;
class CGUIViewState
{
public:
virtual ~CGUIViewState();
static CGUIViewState* GetViewState(int windowId, const CFileItemList& items);
void SetViewAsControl(int viewAsControl);
void SaveViewAsControl(int viewAsControl);
int GetViewAsControl() const;
SORT_METHOD SetNextSortMethod(int direction = 1);
void SetCurrentSortMethod(int method);
SORT_METHOD GetSortMethod() const;
int GetSortMethodLabel() const;
void GetSortMethodLabelMasks(LABEL_MASKS& masks) const;
void GetSortMethods(std::vector< std::pair<int,int> > &sortMethods) const;
SORT_ORDER SetNextSortOrder();
SORT_ORDER GetSortOrder() const { return m_sortOrder; };
SORT_ORDER GetDisplaySortOrder() const;
virtual bool HideExtensions();
virtual bool HideParentDirItems();
virtual bool DisableAddSourceButtons();
virtual int GetPlaylist();
const CStdString& GetPlaylistDirectory();
void SetPlaylistDirectory(const CStdString& strDirectory);
bool IsCurrentPlaylistDirectory(const CStdString& strDirectory);
virtual bool AutoPlayNextItem();
virtual CStdString GetLockType();
virtual CStdString GetExtensions();
virtual VECSOURCES& GetSources();
protected:
CGUIViewState(const CFileItemList& items); // no direct object creation, use GetViewState()
virtual void SaveViewState()=0;
virtual void SaveViewToDb(const CStdString &path, int windowID, CViewState *viewState = NULL);
void LoadViewState(const CStdString &path, int windowID);
/*! \brief Add the addons source for the given content type, if the user has suitable addons
\param content the type of addon content desired
\param label the name of the addons source
\param thumb the skin image to use as the icon
*/
void AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString& thumb);
void AddLiveTVSources();
void AddSortMethod(SORT_METHOD sortMethod, int buttonLabel, LABEL_MASKS labelmasks);
void SetSortMethod(SORT_METHOD sortMethod);
void SetSortOrder(SORT_ORDER sortOrder);
const CFileItemList& m_items;
static VECSOURCES m_sources;
int m_currentViewAsControl;
int m_playlist;
std::vector<SORT_METHOD_DETAILS> m_sortMethods;
int m_currentSortMethod;
SORT_ORDER m_sortOrder;
static CStdString m_strPlaylistDirectory;
};
class CGUIViewStateGeneral : public CGUIViewState
{
public:
CGUIViewStateGeneral(const CFileItemList& items);
protected:
virtual void SaveViewState() {};
};
class CGUIViewStateFromItems : public CGUIViewState
{
public:
CGUIViewStateFromItems(const CFileItemList& items);
protected:
virtual void SaveViewState();
};
class CGUIViewStateLibrary : public CGUIViewState
{
public:
CGUIViewStateLibrary(const CFileItemList& items);
protected:
virtual void SaveViewState();
};
|
// SPDX-License-Identifier: GPL-2.0
#include "taxonomy.h"
#include "gettext.h"
#include <stdlib.h>
char *taxonomy_category_names[TC_NR_CATEGORIES] = {
QT_TRANSLATE_NOOP("gettextFromC", "None"),
QT_TRANSLATE_NOOP("gettextFromC", "Ocean"),
QT_TRANSLATE_NOOP("gettextFromC", "Country"),
QT_TRANSLATE_NOOP("gettextFromC", "State"),
QT_TRANSLATE_NOOP("gettextFromC", "County"),
QT_TRANSLATE_NOOP("gettextFromC", "Town"),
QT_TRANSLATE_NOOP("gettextFromC", "City")
};
// these are the names for geoname.org
char *taxonomy_api_names[TC_NR_CATEGORIES] = {
"none",
"name",
"countryName",
"adminName1",
"adminName2",
"toponymName",
"adminName3"
};
struct taxonomy *alloc_taxonomy()
{
return calloc(TC_NR_CATEGORIES, sizeof(struct taxonomy));
}
void free_taxonomy(struct taxonomy_data *t)
{
if (t) {
for (int i = 0; i < t->nr; i++)
free((void *)t->category[i].value);
free(t->category);
t->category = NULL;
t->nr = 0;
}
}
int taxonomy_index_for_category(struct taxonomy_data *t, enum taxonomy_category cat)
{
for (int i = 0; i < t->nr; i++)
if (t->category[i].category == cat)
return i;
return -1;
}
|
#ifndef TEST_UTILS_HASH_SET_TEST_H
#define TEST_UTILS_HASH_SET_TEST_H
#include <iostream>
#include "test.h"
#include "utils/HashSet.h"
#include "utils/hash/HashEngine.h"
#include "utils/hash/CharHash.h"
#include "utils/HashMapArrayTest.h"
namespace test {
namespace utils_hash_set {
void hashSet_test();
}
}
#endif
|
#ifndef RDESTL_SLIST_H
#define RDESTL_SLIST_H
#include "allocator.h"
#include "iterator.h"
namespace rde
{
namespace internal
{
struct RDESTL_LIB slist_base_node
{
slist_base_node()
{
reset();
}
void reset()
{
next = this;
}
bool in_list() const { return this != next; }
void link_after(slist_base_node* prevNode);
void unlink(slist_base_node* prevNode);
slist_base_node* next;
};
}
//=============================================================================
template<typename T, class TAllocator = rde::allocator>
class slist
{
private:
struct node : public internal::slist_base_node
{
node(): internal::slist_base_node() {}
explicit node(const T& v): internal::slist_base_node(), value(v) {}
T value;
};
static RDE_FORCEINLINE node* upcast(internal::slist_base_node* n)
{
return (node*)n;
}
template<typename TNodePtr, typename TPtr, typename TRef>
class node_iterator
{
public:
typedef forward_iterator_tag iterator_category;
explicit node_iterator(TNodePtr node): m_node(node) {/**/}
template<typename UNodePtr, typename UPtr, typename URef>
node_iterator(const node_iterator<UNodePtr, UPtr, URef>& rhs)
: m_node(rhs.node())
{
/**/
}
TRef operator*() const
{
RDE_ASSERT(m_node != 0);
return m_node->value;
}
TPtr operator->() const
{
return &m_node->value;
}
TNodePtr node() const
{
return m_node;
}
TNodePtr next() const
{
return upcast(m_node->next);
}
node_iterator& operator++()
{
m_node = upcast(m_node->next);
return *this;
}
node_iterator operator++(int)
{
node_iterator copy(*this);
++(*this);
return copy;
}
bool operator==(const node_iterator& rhs) const
{
return rhs.m_node == m_node;
}
bool operator!=(const node_iterator& rhs) const
{
return !(rhs == *this);
}
private:
TNodePtr m_node;
};
public:
typedef T value_type;
typedef TAllocator allocator_type;
typedef ::size_t size_type;
typedef node_iterator<node*, T*, T&> iterator;
typedef node_iterator<const node*, const T*, const T&> const_iterator;
static const ::size_t kNodeSize = sizeof(node);
explicit slist(const allocator_type& allocator = allocator_type())
: m_allocator(allocator)
{
m_root.reset();
}
template<class InputIterator>
slist(InputIterator first, InputIterator last,
const allocator_type& allocator = allocator_type())
: m_allocator(allocator)
{
m_root.reset();
assign(first, last);
}
slist(const slist& rhs, const allocator_type& allocator = allocator_type())
: m_allocator(allocator)
{
m_root.reset();
assign(rhs.begin(), rhs.end());
}
~slist()
{
clear();
}
slist& operator=(const slist& rhs)
{
if (this != &rhs)
{
assign(rhs.begin(), rhs.end());
}
return *this;
}
iterator begin() { return iterator(upcast(m_root.next)); }
const_iterator begin() const { return const_iterator(upcast(m_root.next)); }
iterator end() { return iterator(&m_root); }
const_iterator end() const { return const_iterator(&m_root); }
const T& front() const { RDE_ASSERT(!empty()); return upcast(m_root.next)->value; }
T& front() { RDE_ASSERT(!empty()); return upcast(m_root.next)->value; }
void push_front(const T& value)
{
node* newNode = construct_node(value);
newNode->link_after(&m_root);
}
void pop_front()
{
RDE_ASSERT(!empty());
node* n = upcast(m_root.next);
n->unlink(&m_root);
destruct_node(n);
}
void insert_after(iterator pos, const T& value)
{
node* newNode = construct_node(value);
newNode->link_after(pos.node());
}
template<class InputIterator>
void assign(InputIterator first, InputIterator last)
{
clear();
iterator it(&m_root);
while (first != last)
{
insert_after(it, *first);
++it;
++first;
}
}
void clear()
{
// quicker then erase(begin(), end())
node* it = upcast(m_root.next);
while (it != &m_root)
{
node* nextIt = upcast(it->next);
destruct_node(it);
it = nextIt;
}
m_root.reset();
}
bool empty() const { return !m_root.in_list(); }
// @todo: consider keeping size member, would make this O(1)
// as a policy? via preprocessor macro? TBD
size_type size() const
{
const node* it = upcast(m_root.next);
size_type size(0);
while (it != &m_root)
{
++size;
it = upcast(it->next);
}
return size;
}
// @return iterator prev such that ++prev == nextIt
// @note linear complexity
static iterator previous(iterator nextIt)
{
RDE_ASSERT(nextIt.node()->in_list());
iterator prevIt = nextIt;
while (nextIt.node() != prevIt.next())
++prevIt;
return prevIt;
}
static const_iterator previous(const_iterator nextIt)
{
RDE_ASSERT(nextIt.node()->in_list());
const_iterator prevIt = nextIt;
while (nextIt.node() != prevIt.next())
++prevIt;
return prevIt;
}
private:
node* construct_node(const T& value)
{
void* mem = m_allocator.allocate(sizeof(node));
return new (mem) node(value);
}
void destruct_node(node* n)
{
n->~node();
m_allocator.deallocate(n, sizeof(node));
}
allocator_type m_allocator;
node m_root;
};
} // namespace rde
//-----------------------------------------------------------------------------
#endif // RDESTL_SLIST_H
|
// SPDX-License-Identifier: GPL-2.0-or-later
//
// Copyright (c) 2011-2015, 2019-2020, Antonio Niño Díaz
//
// GiiBiiAdvance - GBA/GB emulator
#ifndef GBA__
#define GBA__
#include "../general_utils.h"
//------------------------------------------------------------------------------
typedef enum
{
CPU_USER = 0,
CPU_FIQ = 1,
CPU_IRQ = 2,
CPU_SUPERVISOR = 3,
CPU_ABORT = 4,
CPU_UNDEFINED = 5,
CPU_SYSTEM = 6,
CPU_MODE_NUMBER = 7
} _cpu_mode_e;
#define M_USER (0x10)
#define M_FIQ (0x11)
#define M_IRQ (0x12)
#define M_SUPERVISOR (0x13)
#define M_ABORT (0x17)
#define M_UNDEFINED (0x1B)
#define M_SYSTEM (0x1F)
typedef enum
{
EXEC_ARM,
EXEC_THUMB
} _exec_mode_e;
#define R_SP (13)
#define R_LR (14)
#define R_PC (15)
//compiler doesn't like to have the same names here than in gb
#ifdef F_CARRY
# undef F_CARRY
#endif
#ifdef F_ZERO
# undef F_ZERO
#endif
#define F_SIGN BIT(31) // (0=Not Signed, 1=Signed)
#define F_N BIT(31)
#define F_ZERO BIT(30) // (0=Not Zero, 1=Zero)
#define F_Z BIT(30)
#define F_CARRY BIT(29) // (0=No Carry, 1=Carry)
#define F_C BIT(29)
#define F_OVERFLOW BIT(28) // (0=No Overflow, 1=Overflow)
#define F_V BIT(28)
#define F_IRQ_DIS BIT(7) // (0=Enable, 1=Disable)
#define F_I BIT(7)
#define F_FIQ_DIS BIT(6) // (0=Enable, 1=Disable)
#define F_F BIT(6)
#define F_STATE BIT(5) // (0=ARM, 1=THUMB) - Do not change manually!
#define F_T BIT(5)
typedef struct
{
u32 R[16]; // 0-15
u32 CPSR;
u32 SPSR;
u32 OldPC;
//-----------------------------------
u32 R_user[7]; // 8-14
u32 R_fiq[7]; // 8-14
u32 SPSR_fiq; // FIQ
u32 R13_svc, R14_svc; // Supervisor
u32 SPSR_svc;
u32 R13_abt, R14_abt; // Abort
u32 SPSR_abt;
u32 R13_irq, R14_irq; // IRQ
u32 SPSR_irq;
u32 R13_und, R14_und; // Undefined
u32 SPSR_und;
_cpu_mode_e MODE;
_exec_mode_e EXECUTION_MODE;
} _cpu_t;
//------------------------------------------------------------------------------
typedef struct {
// General Internal Memory
u8 *rom_bios; // 00000000-00003FFF | BIOS - (ROM) | 16 KB
// 00004000-01FFFFFF | Not used |
ALIGNED(4)
u8 ewram[256 * 1024]; // 02000000-0203FFFF | On-board WRAM | 256 KB (2 Wait)
// 02040000-02FFFFFF | Not used |
ALIGNED(4)
u8 iwram[32 * 1024]; // 03000000-03007FFF | In-chip WRAM | 32 KB
// 03008000-03FFFFFF | Not used |
ALIGNED(4)
u8 io_regs[0x3FF]; // 04000000-040003FE | I/O Registers |
// 04000400-04FFFFFF | Not used |
// Internal Display Memory
ALIGNED(4)
u8 pal_ram[1024]; // 05000000-050003FF | BG/OBJ Palette RAM | 1 KB
// 05000400-05FFFFFF | Not used |
ALIGNED(4)
u8 vram[128 * 1024]; // 06000000-06017FFF | VRAM - Video RAM | 96 KB
// 128K to fix masks // 06018000-06FFFFFF | Not used |a
ALIGNED(4)
u8 oam[1024]; // 07000000-070003FF | OAM - OBJ Attributes | 1 KB
// 07000400-07FFFFFF | Not used |
// External Memory (Game Pak)
u8 *rom_wait0; // 08000000-09FFFFFF | Cart ROM | 32 MB | Wait State 0
u8 *rom_wait1; // 0A000000-0BFFFFFF | Cart ROM | 32 MB | Wait State 1
u8 *rom_wait2; // 0C000000-0DFFFFFF | Cart ROM | 32 MB | Wait State 2
//u8 sram[64 * 1024]; // 0E000000-0E00FFFF | Cart SRAM | 64 KB | 8-bit Bus
// 0E010000-0FFFFFFF | Not used |
// Unused Memory Area
// 10000000-FFFFFFFF | Not used |
} _mem_t;
typedef struct
{
u16 attr0;
u16 attr1;
u16 attr2;
u16 dummy;
} _oam_spr_entry_t;
typedef struct
{
u16 dummy0[3];
s16 pa;
u16 dummy1[3];
s16 pb;
u16 dummy2[3];
s16 pc;
u16 dummy3[3];
s16 pd;
} _oam_matrix_entry_t;
int GBA_GetRomSize(void);
int GBA_InitRom(void *bios_ptr, void *rom_ptr, u32 romsize);
int GBA_EndRom(int save);
void GBA_Reset(void);
_cpu_t *GBA_CPUGet(void); // For the disassembler
void GBA_Screenshot(const char *path);
void GBA_RunForOneFrame(void);
void GBA_RunFor_ExecutionBreak(void);
void GBA_HandleInput(int a, int b, int l, int r, int st, int se,
int dr, int dl, int du, int dd);
void GBA_HandleInputFlags(u16 flags);
u32 GBA_RunFor(s32 totalclocks);
void GBA_DebugStep(void);
#endif // GBA__
|
/*
* VTFLib
* Copyright (C) 2005-2010 Neil Jedrzejewski & Ryan Gregg
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later
* version.
*/
#ifndef PROCWRITER_H
#define PROCWRITER_H
#include "stdafx.h"
#include "Writer.h"
namespace VTFLib
{
namespace IO
{
namespace Writers
{
class CProcWriter : public IWriter
{
private:
vlBool bOpened;
vlVoid *pUserData;
public:
CProcWriter(vlVoid *pUserData);
~CProcWriter();
public:
virtual vlBool Opened() const;
virtual vlBool Open();
virtual vlVoid Close();
virtual vlUInt GetStreamSize() const;
virtual vlUInt GetStreamPointer() const;
virtual vlUInt Seek(vlLong lOffset, vlUInt uiMode);
virtual vlBool Write(vlChar cChar);
virtual vlUInt Write(vlVoid *vData, vlUInt uiBytes);
};
}
}
}
#endif
|
/**
******************************************************************************
* @file LibJPEG/LibJPEG_Decoding/Inc/main.h
* @author MCD Application Team
* @version V1.1.0
* @date 26-June-2014
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/* Jpeg includes component */
#include <stdint.h>
#include <string.h>
#include "jpeglib.h"
/* EVAL includes component */
#include "stm32f429i_discovery.h"
#include "stm32f429i_discovery_lcd.h"
#include "stm32f429i_discovery_sdram.h"
/* FatFs includes component */
#include "ff_gen_drv.h"
#include "usbh_diskio.h"
#include "decode.h"
/* Exported types ------------------------------------------------------------*/
typedef struct RGB
{
uint8_t B;
uint8_t G;
uint8_t R;
}RGB_typedef;
/* Exported constants --------------------------------------------------------*/
#define IMAGE_HEIGHT 320
#define IMAGE_WIDTH 240
#define LCD_BUFFER 0xD0000000
#define USE_DMA2D
#define SWAP_RB
/* #define DONT_USE_DMA2D */
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/****************************************************************************
*
* SciTech SNAP Graphics
*
* ========================================================================
*
* Copyright (C) 1991-2006 SciTech Software, Inc. All rights reserved.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2.0 as published by the Free
* Software Foundation and appearing in the file LICENSE.GPL included
* in the packaging of this file.
*
* Licensees holding a valid Commercial License for this product from
* SciTech Software, Inc. may use this file in accordance with the
* Commercial License Agreement provided with the Software.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE.
*
* See http://www.scitechsoft.com/license/ for information about
* the licensing options available and how to purchase a Commercial
* License Agreement.
*
* Contact license@scitechsoft.com if any conditions of this licensing
* are not clear to you, or you have questions about licensing options.
*
* ========================================================================
*
* Language: ANSI C
* Environment: Any
*
* Description: Header file containing the SciTech copyright message.
* This was done to make changing it a lot easier.
*
****************************************************************************/
#ifndef __SNAP_COPYRIGH_H
#define __SNAP_COPYRIGH_H
#define SCITECH_COPYRIGHT_MSG "Copyright 1993-2006 SciTech Software, Inc. All Rights Reserved."
#define SCITECH_COPYRIGHT_MSG_SHORT "Copyright 1993-2006 SciTech Software, Inc."
#define GRAPHICS_PRODUCT "SciTech SNAP Graphics"
#define GRAPHICS_PRODUCT_SHORT "SNAP"
#endif /* __SNAP_COPYRIGH_H */
|
#ifndef INPUT_H
#define INPUT_H
#include <QObject>
#include <QQuickItem>
#include <QVariantMap>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <QJSEngine>
#include <QJSValue>
#include <QElapsedTimer>
#include <QMap>
#include <QString>
#include <QPoint>
#include "property.h"
class Input : public QQuickItem {
Q_OBJECT
Q_CLASSINFO("Version", "2.1.0")
M_PROPERTY(QVariantMap, key, USER true)
M_PROPERTY(QVariantMap, mouse, USER true)
M_PROPERTY(bool, gestures, USER true)
public:
explicit Input(QQuickItem *parent = 0);
~Input();
public slots:
protected slots:
void attach(QJSValue val);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
QString getMouseAction(const QString &event);
bool fireMouseEvent(const QString &event);
bool fireKeyEvent(const QString &event);
private slots:
private:
QJSEngine *engine;
const int timerThreshold = 200;
const int gestureThreshold = 15;
struct ActiveGesture {
ActiveGesture(const QString &name);
const QString name;
bool enabled;
QString action;
QPoint startPos;
QElapsedTimer timer;
};
typedef QMap<Qt::MouseButton, ActiveGesture*> GestureMap;
GestureMap activeGestures;
};
#endif // INPUT_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 <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h> /* for testing */
#include "pkvaria.h"
#include "pkgeom.h"
#include "multibs.h"
boolean mbs_BCHornerDerC2Rf ( int degree, const point3f *ctlpoints, float t,
point2f *p, vector2f *d )
{
point3f hp, hd;
if ( !mbs_BCHornerDerC3f ( degree, ctlpoints, t, &hp, &hd ) )
return false;
Point3to2f ( &hp, p );
memcpy ( d, &hd, sizeof(vector2f) );
AddVector2Mf ( d, p, -hd.z, d );
MultVector2f ( 1.0/hp.z, d, d );
return true;
} /*mbs_BCHornerDerC2Rf*/
|
/*
Mudder, a cross-platform text gaming client
Copyright (C) 2014 Jason Douglas
jkdoug@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef CONSOLE_H
#define CONSOLE_H
#include "connection.h"
#include "profile.h"
#include <QCloseEvent>
#include <QHostInfo>
#include <QTextBlock>
#include <QWidget>
namespace Ui {
class Console;
}
class ConsoleDocument;
class Engine;
class Console : public QWidget
{
Q_OBJECT
public:
explicit Console(QWidget *parent = 0);
~Console();
void newFile();
bool save();
bool saveAs();
static Console * open(QWidget *parent = 0);
static Console * openFile(const QString &fileName, QWidget *parent = 0);
Profile * profile() { return m_profile; }
void connectToServer();
void disconnectFromServer();
bool isConnected() const { return m_connection->isConnected(); }
bool isConnecting() const { return m_connection->isConnecting(); }
bool isDisconnected() const { return m_connection->isDisconnected(); }
bool isDisconnecting() const { return m_connection->isDisconnecting(); }
QAction * windowAction() const { return m_action; }
const QString & fileName() const { return m_fileName; }
void scrollUp(int lines);
void scrollDown(int lines);
void scrollTo(int line);
void scrollToTop();
void scrollToBottom();
void printInfo(const QString &msg);
void printWarning(const QString &msg);
void printError(const QString &msg);
void tell(const QString &text, const QTextCharFormat &fmt = QTextCharFormat());
void note(const QString &text, const QTextCharFormat &fmt = QTextCharFormat());
bool send(const QString &cmd, bool show = true);
bool sendAlias(const QString &cmd);
bool sendGmcp(const QString &msg, const QString &data = QString());
void deleteLines(int count);
signals:
void connectionStatusChanged(bool connected);
void modified();
protected:
virtual void closeEvent(QCloseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void wheelEvent(QWheelEvent *e);
public slots:
void dataReceived(const QByteArray &data);
void processAccelerators(const QKeySequence &key);
void processAliases(const QString &cmd);
void processEvents(const QString &name, const QVariantList &args);
void processTriggers(QTextBlock block);
void processTimer(Timer *timer);
private slots:
void contentsModified();
void commandEntered(const QString &cmd);
void scriptEntered(const QString &code);
void connectionEstablished();
void connectionLost();
void lookupComplete(const QHostInfo &hostInfo);
void echoToggled(bool on);
void scrollbarMoved(int pos);
void updateScroll();
void copy();
void copyHtml();
private:
bool okToContinue();
bool saveFile(const QString &fileName);
void setCurrentFile(const QString &fileName);
bool readFile(const QString &fileName);
bool writeFile(const QString &fileName);
Ui::Console *ui;
QAction *m_action;
QString m_fileName;
bool m_isUntitled;
ConsoleDocument *m_document;
Engine *m_engine;
Profile *m_profile;
Connection *m_connection;
bool m_echoOn;
QString m_linkHovered;
bool m_mousePressed;
int m_selectionStart;
int m_selectionEnd;
int m_clickPos;
};
#endif // CONSOLE_H
|
/*
Copyright (c) 2008 Gordon Gremme <gremme@zbh.uni-hamburg.de>
Copyright (c) 2008 Center for Bioinformatics, University of Hamburg
Permission to use, copy, modify, and 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.
*/
#include <stdlib.h>
#include "gt_config.h"
#include "core/version_api.h"
const char* gt_version_check(unsigned int required_major,
unsigned int required_minor,
unsigned int required_micro)
{
if (required_major > GT_MAJOR_VERSION)
return "GenomeTools library version too old (major mismatch)";
if (required_major < GT_MAJOR_VERSION)
return "GenomeTools library version too new (major mismatch)";
if (required_minor > GT_MINOR_VERSION)
return "GenomeTools library version too old (minor mismatch)";
if (required_micro > GT_MICRO_VERSION)
return "GenomeTools library version too old (micro mismatch)";
return NULL;
}
|
//
// Created by ranjam on 15-12-28.
//
#ifndef MYGAME_FIGHTSCENE_H
#define MYGAME_FIGHTSCENE_H
#include "cocos2d.h"
#include "Tank.h"
#include "BulletLayer.h"
#include "GameOver.h"
#include "SimpleAudioEngine.h"
USING_NS_CC;
using namespace CocosDenshion;
#define ENEMYMAXCOUNT 5
#define ENEMYBORNHZ 10
class FightScene : public Layer{
public:
bool init(int stage,int player1,int player2);
static FightScene * create(int stage, int player1, int player2);
static Scene *createScene(int stage, int player1, int player2);
public:
void tankControl_p1(EventKeyboard::KeyCode keyCode, Event *event);
void tankControl_p2(EventKeyboard::KeyCode keyCode, Event *event);
void update(float dt) override ;
void onEnter() override ;
void setPlayer();
void controlPlayer();
void enemyTankMove(float dt);
void addEnemy(float dt);
void gameOverCheck();
bool canMove(Tank *tank, DIRECTION move_direction);
void removeTank();
void adjustBullet();
void autoDead();
void winTheScene();
private:
Vector<Tank *> _enemyArray;
Vector<Tank *> _allTankArray;
int _player1;
int _player2;
int _symbol;
int _enemyCount;
int _currentStage;
BulletLayer *_bulletLayer;
TMXTiledMap *_tiledMap;
};
#endif //MYGAME_TESTLAYER01_H
|
#ifndef CONSOLE_APPENDER_H
#define CONSOLE_APPENDER_H
/*INCLUSIONS*/
#include "Appender.h"
#include <string>
enum LogLevel;
/*FIN INCLUSIONS*/
class ConsoleAppender : public Appender
{
public:
/*
@fn ConsoleAppender(const std::string& name,LogLevel level)
@params name reference constante sur une chaine de caractere representant le nom de l'appender console
level le niveau minimum de log
@brief constructeur
@return no return
*/
ConsoleAppender(const std::string& name, LogLevel level);
/*
@fn ConsoleAppender(const ConsoleAppender& coy)
@params copy une reference constante sur un objet ConsoleAppender à copier
@brief constructeur de copie
@return no return
*/
ConsoleAppender(const ConsoleAppender& copy);
/*
@fn ConsoleAppender(ConsoleAppender&& moved)
@params moved une reference de deplacement sur un objet ConsoleAppender à déplacer
@brief constructeur de déplacement
@return no return
*/
ConsoleAppender(ConsoleAppender&& moved) = delete;
/*
@fn virtual void write(LogContent& content)
@params content une reference sur un objet LogContent à traiter
@brief methode permettant de traiter un objet LogContent
@return void
*/
virtual void write(LogContent& content);
private:
};
#endif
|
/*
* Library Slab Allocator (SLIB)
*
* Copyright (c) 2015 INRIA, Hajime Tazaki
*
* Author: Mathieu Lacage <mathieu.lacage@gmail.com>
* Hajime Tazaki <tazaki@sfc.wide.ad.jp>
*/
#include "sim.h"
#include "sim-assert.h"
#include <linux/page-flags.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/slib_def.h>
/* glues */
struct kmem_cache *files_cachep;
void kfree(const void *p)
{
unsigned long start;
if (p == 0)
return;
start = (unsigned long)p;
start -= sizeof(size_t);
lib_free((void *)start);
}
size_t ksize(const void *p)
{
size_t *psize = (size_t *)p;
psize--;
return *psize;
}
void *__kmalloc(size_t size, gfp_t flags)
{
void *p = lib_malloc(size + sizeof(size));
unsigned long start;
if (!p)
return NULL;
if (p != 0 && (flags & __GFP_ZERO)) {
lib_memset(p, 0, size + sizeof(size));
}
lib_memcpy(p, &size, sizeof(size));
start = (unsigned long)p;
return (void *)(start + sizeof(size));
}
void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller)
{
return kmalloc(size, flags);
}
/*
void *krealloc(const void *p, size_t new_size, gfp_t flags)
{
void *ret;
if (!new_size) {
kfree(p);
return ZERO_SIZE_PTR;
}
ret = __kmalloc(new_size, flags);
if (ret && p != ret)
kfree(p);
return ret;
}
*/
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
unsigned long flags, void (*ctor)(void *))
{
struct kmem_cache *cache = kmalloc(sizeof(struct kmem_cache), flags);
if (!cache)
return NULL;
cache->name = name;
cache->size = size;
cache->align = align;
cache->flags = flags;
cache->ctor = ctor;
return cache;
}
void kmem_cache_destroy(struct kmem_cache *cache)
{
kfree(cache);
}
int kmem_cache_shrink(struct kmem_cache *cache)
{
return 1;
}
const char *kmem_cache_name(struct kmem_cache *cache)
{
return cache->name;
}
void *kmem_cache_alloc(struct kmem_cache *cache, gfp_t flags)
{
void *p = kmalloc(cache->size, flags);
if (p == 0)
return NULL;
if (cache->ctor)
(cache->ctor)(p);
return p;
}
void kmem_cache_free(struct kmem_cache *cache, void *p)
{
kfree(p);
}
struct page *
__alloc_pages_nodemask_slib(gfp_t gfp_mask, unsigned int order,
struct zonelist *zonelist, nodemask_t *nodemask)
{
void *p;
struct page *page;
unsigned long pointer;
/* typically, called from networking code by alloc_page or */
/* directly with an order = 0. */
if (order)
return NULL;
p = lib_malloc(sizeof(struct page) + (1 << PAGE_SHIFT));
page = (struct page *)p;
atomic_set(&page->_count, 1);
page->flags = 0;
pointer = (unsigned long)page;
pointer += sizeof(struct page);
page->virtual = (void *)pointer;
return page;
}
void __free_pages_slib(struct page *page, unsigned int order)
{
/* typically, called from networking code by __free_page */
lib_assert(order == 0);
lib_free(page);
}
unsigned long get_zeroed_page_slib(gfp_t gfp_mask)
{
return __get_free_pages(gfp_mask | __GFP_ZERO, 0);
}
void *alloc_pages_exact_slib(size_t size, gfp_t gfp_mask)
{
return alloc_pages(gfp_mask, get_order(size));
}
unsigned long __get_free_pages_slib(gfp_t gfp_mask, unsigned int order)
{
int size = (1 << order) * PAGE_SIZE;
void *p = kmalloc(size, gfp_mask);
return (unsigned long)p;
}
void free_pages_slib(unsigned long addr, unsigned int order)
{
if (addr != 0)
kfree((void *)addr);
}
void put_page(struct page *page)
{
if (atomic_dec_and_test(&page->_count))
lib_free(page);
}
void *vmalloc(unsigned long size)
{
return lib_malloc(size);
}
void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
{
return kmalloc(size, gfp_mask);
}
void vfree(const void *addr)
{
lib_free((void *)addr);
}
void *vmalloc_node(unsigned long size, int node)
{
return lib_malloc(size);
}
void vmalloc_sync_all(void)
{
}
void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp)
{
return kzalloc(size, GFP_KERNEL);
}
void *__alloc_percpu(size_t size, size_t align)
{
return kzalloc(size, GFP_KERNEL);
}
void free_percpu(void __percpu *ptr)
{
kfree(ptr);
}
void *__alloc_bootmem_nopanic_slib(unsigned long size,
unsigned long align,
unsigned long goal)
{
return kzalloc(size, GFP_KERNEL);
}
|
/*
* Copyright (C) 2011-2012 ArkCORE2 <http://www.arkania.net/>
* Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BATTLEGROUNDNA_H
#define __BATTLEGROUNDNA_H
class Battleground;
enum BattlegroundNAObjectTypes
{
BG_NA_OBJECT_DOOR_1 = 0,
BG_NA_OBJECT_DOOR_2 = 1,
BG_NA_OBJECT_DOOR_3 = 2,
BG_NA_OBJECT_DOOR_4 = 3,
BG_NA_OBJECT_BUFF_1 = 4,
BG_NA_OBJECT_BUFF_2 = 5,
BG_NA_OBJECT_MAX = 6
};
enum BattlegroundNAObjects
{
BG_NA_OBJECT_TYPE_DOOR_1 = 183978,
BG_NA_OBJECT_TYPE_DOOR_2 = 183980,
BG_NA_OBJECT_TYPE_DOOR_3 = 183977,
BG_NA_OBJECT_TYPE_DOOR_4 = 183979,
BG_NA_OBJECT_TYPE_BUFF_1 = 184663,
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
};
class BattlegroundNAScore : public BattlegroundScore
{
public:
BattlegroundNAScore() {};
virtual ~BattlegroundNAScore() {};
//TODO fix me
};
class BattlegroundNA : public Battleground
{
public:
BattlegroundNA();
~BattlegroundNA();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* player);
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.