text
stringlengths 4
6.14k
|
|---|
//
// Constants.h
// OGL_Basic
//
// Created by Sid on 22/08/13.
// Copyright (c) 2013 whackylabs. All rights reserved.
//
#ifndef OGL_Basic_Constants_h
#define OGL_Basic_Constants_h
/*******************************************************************************
* MARK: GL Attributes locations
******************************************************************************/
#define kAttribFlag(a_Index) (0x1 << a_Index)
#define kAttrib_Position 0
#define kAttrib_Normal 1
#define kAttrib_Color 2
#define kAttrib_TexCoords 3
#define kAttrib_Total 4
/*******************************************************************************
* MARK: Shader Attributes/Varying/Uniforms strings
******************************************************************************/
static const char *AttribNames [] = {
"a_Position",
"a_Normal",
"a_Color",
"a_TexCoords"
};
#define v_Color "v_Color"
#define u_Mvp "u_Mvp"
#define u_N "u_N"
#define u_Color "u_Color"
#define u_Texture "u_Texture"
/*******************************************************************************
* MARK: Buffer constants
*******************************************************************************/
#define kBuffer256 (0x1 << 8) /* 256 bytes: Usage: filenames */
#define kBuffer512 (0x1 << 9) /* 512 bytes*/
#define kBuffer1K (0x1 << 10) /* 1,024 bytes: Usage: paths */
#define kBuffer2K (0x1 << 11) /* 2,048 bytes*/
#define kBuffer4K (0x1 << 12) /* 4,096 bytes: Usage: shader code */
#define kBuffer8K (0x1 << 13) /* 8,192 bytes*/
#define kBuffer16K (0x1 << 14) /* 16,384 bytes*/
#define kBuffer32K (0x1 << 15) /* 32,768 bytes*/
#define kBuffer64K (0x1 << 16) /* 65,536 bytes */
/*******************************************************************************
* MARK: Test Errors
* Use only when something new is added
*******************************************************************************/
#define TEST_ERR_FRAMEBUFFER /* Test the framebuffer status*/
#define TEST_ERR_SHADER /* Test any shader error */
#define TEST_ERR_ANY /* Test any gl error */
#endif
|
//
// NSString+Core.h
// test
//
// Created by Dao Duy Thuy on 4/14/14.
// Copyright ThuyDao 2014. All rights reserved.
// Provider : Dao Duy Thuy
//
#import <UIKit/UIKit.h>
@interface UIView (TDCore)
#pragma mark - Get UI
- (UILabel *)td_lbWithTag:(NSInteger)tag;
- (UITextField *)td_tfWithTag:(NSInteger )tag;
- (UIImageView *)td_imvWithTag:(NSInteger)tag;
- (UIButton *)td_buttonWithTag:(NSInteger)tag;
- (UISwitch *)td_switchWithTag:(NSInteger)tag;
- (UITextView *)td_tvWithTag:(NSInteger)tag;
- (UITableView *)td_tableViewWithTag:(NSInteger)tag;
- (UIScrollView *)td_scrollViewWithTag:(NSInteger)tag;
- (UIWebView *)td_webViewWithTag:(NSInteger)tag;
#pragma mark - Add Line
// Add line top
- (void)td_addTopLineColor:(UIColor *)color;
- (void)td_addTopLineColor:(UIColor *)color withAlpha:(CGFloat )alpha;
- (void)td_addTopLineColor:(UIColor *)color withAlpha:(CGFloat )alpha withSize:(CGFloat )size;
// Add line botton
- (void)td_addBottomLineColor:(UIColor *)color;
- (void)td_addBottomLineColor:(UIColor *)color withAlpha:(CGFloat )alpha;
- (void)td_addBottomLineColor:(UIColor *)color withAlpha:(CGFloat )alpha withSize:(CGFloat )size;
// Add line left
- (void)td_addLeftLineColor:(UIColor *)color;
- (void)td_addLeftLineColor:(UIColor *)color withAlpha:(CGFloat )alpha;
- (void)td_addLeftLineColor:(UIColor *)color withAlpha:(CGFloat )alpha withSize:(CGFloat )size;
// Add line right
- (void)td_addRightLineColor:(UIColor *)color;
- (void)td_addRightLineColor:(UIColor *)color withAlpha:(CGFloat )alpha;
- (void)td_addRightLineColor:(UIColor *)color withAlpha:(CGFloat )alpha withSize:(CGFloat )size;
#pragma mark - Layer
- (void)td_borderWithBorderWidth:(CGFloat )borderWidth;
- (void)td_borderWithBorderWidth:(CGFloat )borderWidth withBoderColor:(UIColor *)color;
- (void)td_borderWithBorderWidth:(CGFloat )borderWidth withBoderColor:(UIColor *)color withCornerRadius:(CGFloat )cornerRadius;
- (void)td_borderWithBorderWidth:(CGFloat )borderWidth withBoderColor:(UIColor *)color withCornerRadius:(CGFloat )cornerRadius andWithMasksToBounds:(BOOL )isMasksToBounds;
// Corner
- (void)td_cornerTopLeftWithCornerRadius:(CGFloat )cornerRadius;
- (void)td_cornerTopRightWithCornerRadius:(CGFloat )cornerRadius;
- (void)td_cornerBottomLeftWithCornerRadius:(CGFloat )cornerRadius;
- (void)td_cornerBottomRightWithCornerRadius:(CGFloat )cornerRadius;
#pragma mark - Background Color
- (void)td_setBackgroundColorClear;
- (void)td_setBackgroundColorWithImage:(UIImage *)image;
- (void)td_setBackgroundColorWithImageName:(NSString *)imageName;
#pragma mark - Frame
#pragma mark + Set
- (void)setFrameWithX:(CGFloat )x;
- (void)setFrameWithY:(CGFloat )y;
- (void)setFrameWithX:(CGFloat )x withY:(CGFloat )y;
- (void)setFrameWithWidth:(CGFloat )width;
- (void)setFrameWithHeight:(CGFloat )height;
- (void)setFrameWithWidth:(CGFloat )width withHeight:(CGFloat )height;
- (void)setFrameWithX:(CGFloat )x withWidth:(CGFloat )width;
- (void)setFrameWithY:(CGFloat )y withHeight:(CGFloat )height;
- (void)setFrameWithX:(CGFloat )x withY:(CGFloat )y withWidth:(CGFloat )width withHeight:(CGFloat )height;
#pragma mark + Get
- (CGFloat)x;
- (CGFloat)y;
- (CGPoint)origin;
- (CGFloat)width;
- (CGFloat)height;
- (CGSize)size;
#pragma mark - Handle tap
- (void)td_addHandleSingleTapWithTarget:(id )target withAction:(SEL )action;
- (void)td_addHandleDoubleTapWithTarget:(id )target withAction:(SEL )action;
#pragma mark - Add button - Center
- (void)td_addButtonWithTarget:(id )target action:(SEL )action withX:(CGFloat )x withY:(CGFloat )y withWidth:(CGFloat )width withHeight:(CGFloat )height;
- (void)td_addButtonAtCenterWithTarget:(id )target withAction:(SEL )action;
- (void)td_addButtonAtCenterWithTarget:(id )target withAction:(SEL )action withSize:(CGSize )size;
#pragma mark - Add button - Other
- (void)td_addButtonWithTarget:(id )target action:(SEL )action withX:(CGFloat )x withY:(CGFloat )y;
- (void)td_addButtonWithTarget:(id )target action:(SEL )action withX:(CGFloat )x withY:(CGFloat )y withSize:(CGSize )size;
#pragma mark + Left
- (void)td_addButtonAtLeftTopWithTarget:(id )target withAction:(SEL )action;
- (void)addButtonAtLeftTopWithTarget:(id )target withAction:(SEL )action withSize:(CGSize )size;
#pragma mark + Top
- (void)td_addButtonAtTopRightWithTarget:(id )target withAction:(SEL )action;
- (void)td_addButtonAtTopRightWithTarget:(id )target withAction:(SEL )action withSize:(CGSize )size;
#pragma mark + Right
- (void)td_addButtonAtRightBottomWithTarget:(id )target withAction:(SEL )action;
- (void)addButtonAtRightBottomWithTarget:(id )target withAction:(SEL )action withSize:(CGSize )size;
#pragma mark + Botton
- (void)td_addButtonAtBottonLeftWithTarget:(id )target withAction:(SEL )action;
- (void)addButtonAtBottonLeftWithTarget:(id )target withAction:(SEL )action withSize:(CGSize )size;
@end
|
/*
* Copyright (c) 2013 Serho Liu. All rights reserved.
*
* Use of this source code is governed by a MIT-style license that can be
* found in the MIT-LICENSE file.
*
* HashTable,采用开放地址解决 Hash 冲突, Hash 函数
* 和冲突解决方法参考自 Python mapobject 的实现
*
* 初始化大小是 512,当负载因子达到 2/3 时进行 resize 操作,
* 每次增加一倍
*/
#include "hashmap.h"
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
#define HASHMAP_INIT_SIZE (1 << 9)
typedef struct {
const char *key;
void *value;
int isdel;
} map_entry;
struct hashmap {
unsigned long size;
unsigned long use;
compare_key *compare;
map_entry *entrys;
};
static unsigned long _string_hash(const char *str);
static void _hashmap_resize(hashmap *map);
hashmap *hashmap_new(unsigned long size, compare_key *compare)
{
hashmap *map;
map = (hashmap *)malloc(sizeof(hashmap));
if (map == NULL) {
return NULL;
}
if (size <= 0) {
size = HASHMAP_INIT_SIZE;
}
map->size = size;
map->use = 0;
map->compare = compare;
map->entrys = (map_entry *)malloc(map->size * sizeof(map_entry));
if (map->entrys == NULL) {
free(map);
return NULL;
}
memset(map->entrys, 0, map->size * sizeof(map_entry));
return map;
}
void hashmap_free(hashmap *map)
{
if (map == NULL) return;
free(map->entrys); /* free all entry */
free(map); /* free map node */
}
int hashmap_put(hashmap *map, const char *key, void *value)
{
map_entry *entry;
if (map == NULL || key == NULL) {
return 0;
}
/* 当 use/size >= 2/3 时,扩大表 */
if (map->use * 3 >= map->size * 2) {
_hashmap_resize(map);
}
unsigned long hash = _string_hash(key);
unsigned long index = hash;
unsigned long perturb = hash;
while (1) {
index = index & (map->size - 1);
entry = &(map->entrys[index]);
if ((entry->key != NULL) && (!map->compare(entry->key, key))) {
entry->value = value;
if (entry->isdel == TRUE) {
entry->isdel = FALSE;
}
return 1;
}
if (entry->key == NULL) {
entry->key = key;
entry->value = value;
entry->isdel = FALSE;
map->use++;
return 1;
}
perturb >>= 5;
index = (index << 2) + index + perturb + 1;
}
}
void *hashmap_get(const hashmap *map, const char *key)
{
map_entry *entry;
if (map == NULL || key == NULL) {
return NULL;
}
unsigned long hash = _string_hash(key);
unsigned long index = hash;
unsigned long perturb = hash;
while (1) {
index = index & (map->size - 1);
entry = &(map->entrys[index]);
if (entry->key == NULL && entry->isdel != TRUE) {
return NULL;
}
if ((entry->key != NULL) && (!map->compare(entry->key, key))) {
return entry->value;
}
perturb >>= 5;
index = (index << 2) + index + perturb + 1;
}
}
void *hashmap_delete(hashmap *map, const char *key)
{
map_entry *entry;
if (map == NULL || key == NULL) {
return NULL;
}
unsigned long hash = _string_hash(key);
unsigned long index = hash;
unsigned long perturb = hash;
while (1) {
index = index & (map->size - 1);
entry = &(map->entrys[index]);
if (entry->key == NULL && entry->isdel == TRUE) {
return NULL;
}
if ((entry->key != NULL) && (!map->compare(entry->key, key))) {
entry->key = NULL;
entry->isdel = TRUE;
return entry->value;
}
perturb >>= 5;
index = (index << 2) + index + perturb + 1;
}
}
int hashmap_map(const hashmap *map, hashmap_map_func *func, const void *other)
{
unsigned long i, use, size;
map_entry *entry;
if (map == NULL || func == NULL) {
return 0;
}
size = map->size;
use = map->use;
for (i = 0; (use > 0) && (i < size); i++) {
entry = &(map->entrys[i]);
if (entry->key) {
func(entry->key, &(entry->value), other);
use--;
}
}
return 1;
}
static void _hashmap_resize(hashmap *map)
{
unsigned long oldsize, newsize, olduse, i;
map_entry *entry, *temp;
hashmap *newmap;
oldsize = map->size;
olduse = map->use;
/* 这里没有检测 newsize 是否溢出,因为 unsigned long 长度和指针一样 */
newsize = oldsize << 1;
newmap = hashmap_new(newsize, map->compare);
if (newmap == NULL) {
return;
}
for (i = 0; (olduse > 0) && (i < oldsize); i++) {
entry = &(map->entrys[i]);
if (entry->key) {
if (hashmap_put(newmap, entry->key, entry->value)) {
olduse--;
}
}
}
/* 如果 olduse == 0, 则重新散列成功,交换 hashtable */
if (!olduse) {
temp = map->entrys;
map->entrys = newmap->entrys;
map->size = newsize;
newmap->entrys = temp;
newmap->size = oldsize;
}
hashmap_free(newmap);
}
static unsigned long _string_hash(const char *str) {
unsigned long x;
unsigned long len = 0;
x = *str << 7;
while (*str) {
x = (1000003 * x) ^ *str++;
len++;
}
x ^= len;
return x;
}
|
#ifndef GAME_H
#define GAME_H
#include <stdlib.h>
#include <inttypes.h>
#include "scene.h"
typedef struct refc_ptr refc_ptr;
struct refc_ptr {
size_t c;
void* p;
refc_ptr* next;
refc_ptr* prev;
};
typedef struct {
size_t num_scenes;
scene* scenes;
scene* current;
refc_ptr* render_data;
refc_ptr* windows;
} game;
void game_add_scene(game*, scene*);
void game_set_current(game*, size_t);
#endif
|
#include <stdio.h>
extern void moin(void);
void lol()
{
printf("lol\n");
}
void rofl()
{
printf("rofl\n");
lol();
}
void main()
{
printf("main\n");
lol();
rofl();
rofl();
lol();
moin();
}
|
double HML_DerivativeOfBellShapedKernelRectangle(double z);
|
//
// AppDelegate.h
// ASFormatterCacheExample
//
// Created by Philippe Converset on 13/02/2014.
// Copyright (c) 2014 AutreSphere. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef AUTO_H
#define AUTO_H
#include "vehiculo.h"
class Auto : public Vehiculo
{
public:
Auto();
};
#endif // AUTO_H
|
//
// CKAsset.h
// CloudKit
//
// Copyright (c) 2014 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
NS_CLASS_AVAILABLE(10_10, 8_0)
@interface CKAsset : NSObject
- (instancetype)init NS_UNAVAILABLE;
/* Initialize an asset to be saved with the content at the given file URL */
- (instancetype)initWithFileURL:(NSURL *)fileURL;
/* Local file URL where fetched records are cached and saved records originate from. */
@property (nonatomic, readonly, copy) NSURL *fileURL;
@end
NS_ASSUME_NONNULL_END
|
/*
* The MIT License (MIT)
*
* Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "criterion/stats.h"
#include "criterion/options.h"
#include "compat/posix.h"
#include "compat/strtok.h"
#include "compat/time.h"
#include "config.h"
#include "common.h"
static void print_prelude(FILE *f, struct criterion_global_stats *stats) {
fprintf(f, "TAP version 13\n1.."
CR_SIZE_T_FORMAT
"\n", stats->nb_tests);
fprintf(f, "# Criterion v%s\n", VERSION);
}
static void print_pre_suite(FILE *f, struct criterion_suite_stats *stats) {
fprintf(f, "\n# Running "
CR_SIZE_T_FORMAT
" tests from %s\n",
stats->nb_tests,
stats->suite->name);
}
static INLINE bool is_disabled(struct criterion_test *t, struct criterion_suite *s) {
return t->data->disabled || (s->data && s->data->disabled);
}
static void print_test_normal(FILE *f, struct criterion_test_stats *stats) {
const char *format = can_measure_time() ? "%s - %s::%s %s (%3.2fs)\n"
: "%s - %s::%s %s\n";
fprintf(f, format,
stats->failed ? "not ok" : "ok",
stats->test->category,
stats->test->name,
DEF(stats->test->data->description, ""),
stats->elapsed_time);
for (struct criterion_assert_stats *asrt = stats->asserts; asrt; asrt = asrt->next) {
if (!asrt->passed) {
char *dup = strdup(*asrt->message ? asrt->message : "");
char *saveptr = NULL;
char *line = strtok_r(dup, "\n", &saveptr);
bool sf = criterion_options.short_filename;
fprintf(f, " %s:%u: Assertion failed: %s\n",
sf ? basename_compat(asrt->file) : asrt->file,
asrt->line,
line);
while ((line = strtok_r(NULL, "\n", &saveptr)))
fprintf(f, " %s\n", line);
free(dup);
}
}
}
static void print_test_crashed(FILE *f, struct criterion_test_stats *stats) {
bool sf = criterion_options.short_filename;
fprintf(f, "not ok - %s::%s unexpected signal after %s:%u\n",
stats->test->category,
stats->test->name,
sf ? basename_compat(stats->file) : stats->file,
stats->progress);
}
static void print_test_timeout(FILE *f, struct criterion_test_stats *stats) {
fprintf(f, "not ok - %s::%s timed out (%3.2fs)\n",
stats->test->category,
stats->test->name,
stats->elapsed_time);
}
static void print_test(FILE *f,
struct criterion_test_stats *ts,
struct criterion_suite_stats *ss) {
if (is_disabled(ts->test, ss->suite)) {
fprintf(f, "ok - %s::%s %s # SKIP %s is disabled\n",
ts->test->category,
ts->test->name,
DEF(ts->test->data->description, ""),
ts->test->data->disabled ? "test" : "suite");
} else if (ts->crashed) {
print_test_crashed(f, ts);
} else if (ts->timed_out) {
print_test_timeout(f, ts);
} else {
print_test_normal(f, ts);
}
}
void tap_report(FILE *f, struct criterion_global_stats *stats) {
print_prelude(f, stats);
for (struct criterion_suite_stats *ss = stats->suites; ss; ss = ss->next) {
print_pre_suite(f, ss);
for (struct criterion_test_stats *ts = ss->tests; ts; ts = ts->next) {
print_test(f, ts, ss);
}
}
}
|
//
// FLObjC.h
// FishLampiOS-Lib
//
// Created by Mike Fullerton on 2/18/12.
// Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
// WARNING: don't import anything here. This file is imported by FishLamp. This is imported by everything.
#import <Foundation/Foundation.h>
#import <Availability.h>
#import "FishLampVersion.h"
#import "FLCoreFlags.h"
#import "FLCompilerWarnings.h"
#import "FLObjc.h"
#import "FLProperties.h"
#import "FLDebug.h"
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE127_Buffer_Underread__malloc_char_cpy_61b.c
Label Definition File: CWE127_Buffer_Underread__malloc.label.xml
Template File: sources-sink-61b.tmpl.c
*/
/*
* @description
* CWE: 127 Buffer Under-read
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sinks: cpy
* BadSink : Copy data to string using strcpy
* Flow Variant: 61 Data flow: data returned from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
char * CWE127_Buffer_Underread__malloc_char_cpy_61b_badSource(char * data)
{
{
char * dataBuffer = (char *)malloc(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
return data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
char * CWE127_Buffer_Underread__malloc_char_cpy_61b_goodG2BSource(char * data)
{
{
char * dataBuffer = (char *)malloc(100*sizeof(char));
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
return data;
}
#endif /* OMITGOOD */
|
//
// SZNAuthor.h
//
// Copyright (c) 2013-2016 shazino (shazino SAS), http://www.shazino.com/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "TBXML.h"
/**
`SZNAuthor` is a Zotero author.
*/
@interface SZNAuthor : NSObject
/**
The author name.
*/
@property (copy, nonatomic) NSString *name;
/**
The author URI
*/
@property (strong, nonatomic) NSURL *URI;
/**
Parses an author from an API XML element.
@param XMLElement A `TBXMLElement` representation of the API response.
@return A `SZNAuthor` object.
*/
+ (SZNAuthor *)authorFromXMLElement:(TBXMLElement *)XMLElement;
@end
|
/*=============================================================================
Copyright (c) 2012, Ludo Sapiens Inc. and contributors.
See accompanying file LICENSE.txt for details.
=============================================================================*/
#ifndef PLASMA_CONTROLLER_H
#define PLASMA_CONTROLLER_H
#include <Plasma/StdDefs.h>
#include <Plasma/Manipulator/EventDispatcher.h>
#include <Plasma/Manipulator/Manipulator.h>
NAMESPACE_BEGIN
class Entity;
class RigidEntity;
/*==============================================================================
CLASS Controller
==============================================================================*/
class Controller:
public Manipulator
{
public:
/*----- methods -----*/
static void initialize();
static void terminate();
PLASMA_DLL_API Controller();
PLASMA_DLL_API virtual ~Controller();
inline EventDispatcher& dispatcher() { return _dispatcher; }
inline const EventDispatcher& dispatcher() const { return _dispatcher; }
//PLASMA_DLL_API virtual void onCameraChange();
//PLASMA_DLL_API virtual void onViewportChange();
PLASMA_DLL_API virtual bool onPointerPress( const Event& ev );
PLASMA_DLL_API virtual bool onPointerRelease( const Event& ev );
PLASMA_DLL_API virtual bool onPointerMove( const Event& ev );
PLASMA_DLL_API virtual bool onPointerCancel( const Event& ev );
PLASMA_DLL_API virtual bool onPointerScroll( const Event& ev );
PLASMA_DLL_API virtual bool onKeyPress( const Event& ev );
PLASMA_DLL_API virtual bool onKeyRelease( const Event& ev );
PLASMA_DLL_API virtual bool onChar( const Event& ev );
PLASMA_DLL_API virtual bool onAccelerate( const Event& ev );
PLASMA_DLL_API void enableHID();
PLASMA_DLL_API void disableHID();
PLASMA_DLL_API virtual void onHIDEvent( const Event& ev );
// VM.
//PLASMA_DLL_API virtual bool performGet( VMState* vm );
//PLASMA_DLL_API virtual bool performSet( VMState* vm );
protected:
/*----- data members -----*/
EventDispatcher _dispatcher; //!< An event dispatcher.
private:
}; //class Controller
/*==============================================================================
CLASS EntityController
==============================================================================*/
class EntityController:
public Controller
{
public:
/*----- methods -----*/
PLASMA_DLL_API EntityController();
PLASMA_DLL_API virtual ~EntityController();
inline RigidEntity* entity() { return _entity; }
inline const RigidEntity* entity() const { return _entity; }
inline void entity( RigidEntity* e ) { _entity = e; }
// VM.
PLASMA_DLL_API virtual bool performGet( VMState* vm );
PLASMA_DLL_API virtual bool performSet( VMState* vm );
PLASMA_DLL_API void entityPickEvent();
PLASMA_DLL_API void anyEvent() const;
PLASMA_DLL_API virtual void onViewportChange();
protected:
/*----- data members -----*/
RigidEntity* _entity; //!< The entity being controlled.
/*----- methods -----*/
private:
}; //class EntityController
NAMESPACE_END
#endif //PLASMA_CONTROLLER_H
|
/*
* Copyright (c) 2005, Eric Crahen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __ZTQUEUE_H__
#define __ZTQUEUE_H__
#include "zthread/cancelable.h"
#include "zthread/non_copyable.h"
namespace zthread {
/**
* @class Queue
* @author Eric Crahen <http://www.code-foo.com>
* @date <2003-07-16T11:32:42-0400>
* @version 2.3.0
*
* A Queue defines an interface for a value-oriented collection objects (similar
* to
* STL collections).
*/
template <typename T>
class Queue : public Cancelable, private NonCopyable {
public:
//! Destroy a Queue
virtual ~Queue() {}
/**
* Add an object to this Queue.
*
* @param item value to be added to the Queue
*
* @exception Cancellation_Exception thrown if this Queue has been canceled.
*
* @pre The Queue should not have been canceled prior to the invocation of
* this function.
* @post If no exception is thrown, a copy of <i>item</i> will have been added
* to the Queue.
*/
virtual void Add(const T& item) = 0;
/**
* Add an object to this Queue.
*
* @param item value to be added to the Queue
* @param timeout maximum amount of time (milliseconds) this method may block
* the calling thread.
*
* @return
* - <em>true</em> if a copy of <i>item</i> can be added before
* <i>timeout</i>
* milliseconds elapse.
* - <em>false</em> otherwise.
*
* @exception Cancellation_Exception thrown if this Queue has been canceled.
*
* @pre The Queue should not have been canceled prior to the invocation of
* this function.
* @post If this function returns true a copy of <i>item</i> will have been
* added to the Queue.
*/
virtual bool Add(const T& item, unsigned long timeout) = 0;
/**
* Retrieve and remove a value from this Queue.
*
* @return <em>T</em> next available value
*
* @exception Cancellation_Exception thrown if this Queue has been canceled.
*
* @pre The Queue should not have been canceled prior to the invocation of
* this function.
* @post The value returned will have been removed from the Queue.
*/
virtual T Next() = 0;
/**
* Retrieve and remove a value from this Queue.
*
* @param timeout maximum amount of time (milliseconds) this method may block
* the calling thread.
*
* @return <em>T</em> next available value
*
* @exception Cancellation_Exception thrown if this Queue has been canceled.
* @exception Timeout_Exception thrown if the timeout expires before a value
* can be retrieved.
*
* @pre The Queue should not have been canceled prior to the invocation of
* this function.
* @post The value returned will have been removed from the Queue.
*/
virtual T Next(unsigned long timeout) = 0;
/**
* Canceling a Queue disables it, disallowing further additions. Values
* already
* present in the Queue can still be retrieved and are still available through
* the next() methods.
*
* Canceling a Queue more than once has no effect.
*
* @post The next() methods will continue to return objects until
* the Queue has been emptied.
* @post Once emptied, the next() methods will throw a Cancellation_Exception.
* @post The add() methods will throw a Cancellation_Exceptions from this
* point on.
*/
virtual void Cancel() = 0;
/**
* Count the values present in this Queue.
*
* @return <em>size_t</em> number of elements available in the Queue.
*/
virtual size_t Size() = 0;
/**
* Count the values present in this Queue.
*
* @param timeout maximum amount of time (milliseconds) this method may block
* the calling thread.
*
* @return <em>size_t</em> number of elements available in the Queue.
*
* @exception Timeout_Exception thrown if <i>timeout</i> milliseconds
* expire before a value becomes available
*/
virtual size_t Size(unsigned long timeout) = 0;
/**
* Test whether any values are available in this Queue.
*
* @return
* - <em>true</em> if there are no values available.
* - <em>false</em> if there <i>are</i> values available.
*/
virtual bool Empty() {
try {
return Size() == 0;
} catch (CancellationException&) {
}
return true;
}
/**
* Test whether any values are available in this Queue.
*
* @param timeout maximum amount of time (milliseconds) this method may block
* the calling thread.
*
* @return
* - <em>true</em> if there are no values available.
* - <em>false</em> if there <i>are</i> values available.
*
* @exception Timeout_Exception thrown if <i>timeout</i> milliseconds
* expire before a value becomes available
*/
virtual bool Empty(unsigned long timeout) {
try {
return Size(timeout) == 0;
} catch (CancellationException&) {
}
return true;
}
}; /* Queue */
} // namespace ZThread
#endif // __ZTQUEUE_H__
|
//
// RecommendVC.h
// AmosJoyContact
//
// Created by Amos Wu on 15/11/13.
// Copyright © 2015年 Amos Wu. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "EYTagView.h"
#import "RecommendInfo.h"
@interface RecommendVC : UIViewController
@property (nonatomic)BOOL isNew;
@property (nonatomic) int rootPK;
@property (nonatomic, strong) RecommendInfo *recommend;
@end
|
/*
This file is part of WME Lite.
http://dead-code.org/redir.php?target=wmelite
Copyright (c) 2011 Jan Nedoma
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __WmeBResourceFile_H__
#define __WmeBResourceFile_H__
#include "BFile.h"
namespace WinterMute {
class CBResourceFile : public CBFile {
public:
CBResourceFile(CBGame *inGame);
virtual ~CBResourceFile();
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN);
virtual HRESULT Read(void *Buffer, uint32 Size);
virtual HRESULT Close();
virtual HRESULT Open(Common::String Filename);
private:
byte *m_Data;
};
} // end of namespace WinterMute
#endif
|
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdbool.h>
#include <stdint.h>
typedef struct {
PyObject_HEAD
PyObject *read; // cached read() method of fp
PyObject *tag_hook;
PyObject *object_hook;
PyObject *shareables;
PyObject *stringref_namespace;
PyObject *str_errors;
bool immutable;
Py_ssize_t shared_index;
} CBORDecoderObject;
extern PyTypeObject CBORDecoderType;
PyObject * CBORDecoder_new(PyTypeObject *, PyObject *, PyObject *);
int CBORDecoder_init(CBORDecoderObject *, PyObject *, PyObject *);
PyObject * CBORDecoder_decode(CBORDecoderObject *);
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_environment_execl_61a.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-61a.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: environment Read input from an environment variable
* GoodSource: Fixed string
* Sinks: execl
* BadSink : execute command with wexecl
* Flow Variant: 61 Data flow: data returned from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"ls"
#define COMMAND_ARG2 L"-la"
#define COMMAND_ARG3 data
#endif
#define ENV_VARIABLE L"ADD"
#ifdef _WIN32
#define GETENV _wgetenv
#else
#define GETENV getenv
#endif
#ifdef _WIN32
#include <process.h>
#define EXECL _wexecl
#else /* NOT _WIN32 */
#define EXECL execl
#endif
#ifndef OMITBAD
/* bad function declaration */
wchar_t * CWE78_OS_Command_Injection__wchar_t_environment_execl_61b_badSource(wchar_t * data);
void CWE78_OS_Command_Injection__wchar_t_environment_execl_61_bad()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
data = CWE78_OS_Command_Injection__wchar_t_environment_execl_61b_badSource(data);
/* wexecl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
wchar_t * CWE78_OS_Command_Injection__wchar_t_environment_execl_61b_goodG2BSource(wchar_t * data);
static void goodG2B()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
data = CWE78_OS_Command_Injection__wchar_t_environment_execl_61b_goodG2BSource(data);
/* wexecl - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
void CWE78_OS_Command_Injection__wchar_t_environment_execl_61_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()...");
CWE78_OS_Command_Injection__wchar_t_environment_execl_61_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_environment_execl_61_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
Copyright (c) 2006-2010 Jesper Svennevid
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "cdvd.h"
#if defined(_IOP)
#include "../iop/irx_imports.h"
#else
#include <stdio.h>
#endif
IODriver* Cdvd_Create()
{
STREAMER_PRINTF(("Cdvd: Driver not implemented\n"));
return 0;
}
|
//
// NSDictionary+ZCSwizzle.h
// PrivateAccountBook
//
// Created by 唐周成 on 16/1/16.
// Copyright © 2016年 JiaPin. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary(ZCSwizzle)
@end
|
//###################################################################
//###################################################################
// SORT FUNCTION FOR THE MEDIAN FILTER:
void isort(int *a, int n){
// *a is an array pointer, n is the array size
for (int i = 1; i < n; ++i)
{
int j = a[i];
int k;
for (k = i - 1; (k >= 0) && (j < a[k]); k--)
{
a[k + 1] = a[k];
}
a[k + 1] = j;
}
}
//#################################################################
//#################################################################
// DEBOUNCE:
// Debounce function for buttons and keys
boolean debounce(byte pin, boolean last, byte debounceTime){
boolean current = digitalRead(pin);
if(last != current){
delay(debounceTime);
current = digitalRead(pin);
}
return current;
}
//########################################################################
//############### "fscale" FOR CURVE -ENABLED MAPPING ####################
float fscale( float originalMin, float originalMax, float newBegin, float
newEnd, float inputValue, float curve){
float OriginalRange = 0;
float NewRange = 0;
float zeroRefCurVal = 0;
float normalizedCurVal = 0;
float rangedValue = 0;
boolean invFlag = 0;
// condition curve parameter
// limit range
if (curve > 10) curve = 10;
if (curve < -10) curve = -10;
curve = (curve * -.1) ; // - invert and scale - this seems more intuitive - postive numbers give more weight to high end on output
curve = pow(10, curve); // convert linear scale into lograthimic exponent for other pow function
/*
Serial.println(curve * 100, DEC); // multply by 100 to preserve resolution
Serial.println();
*/
// Check for out of range inputValues
if (inputValue < originalMin) {
inputValue = originalMin;
}
if (inputValue > originalMax) {
inputValue = originalMax;
}
// Zero Refference the values
OriginalRange = originalMax - originalMin;
if (newEnd > newBegin){
NewRange = newEnd - newBegin;
}
else
{
NewRange = newBegin - newEnd;
invFlag = 1;
}
zeroRefCurVal = inputValue - originalMin;
normalizedCurVal = zeroRefCurVal / OriginalRange; // normalize to 0 - 1 float
/*
Serial.print(OriginalRange, DEC);
Serial.print(" ");
Serial.print(NewRange, DEC);
Serial.print(" ");
Serial.println(zeroRefCurVal, DEC);
Serial.println();
*/
// Check for originalMin > originalMax - the math for all other cases i.e. negative numbers seems to work out fine
if (originalMin > originalMax ) {
return 0;
}
if (invFlag == 0){
rangedValue = (pow(normalizedCurVal, curve) * NewRange) + newBegin;
}
else // invert the ranges
{
rangedValue = newBegin - (pow(normalizedCurVal, curve) * NewRange);
}
return rangedValue;
}
|
#pragma once
#include <cpp_odbc/statement.h>
#include <cpp_odbc/multi_value_buffer.h>
#include <turbodbc/field.h>
#include <turbodbc/description.h>
namespace turbodbc {
/**
* @brief This interface represents a single parameter of a query
*/
class parameter {
public:
/**
* @brief Create a new parameter, binding an internal buffer to the statement
* @param statement The statement for which to bind a buffer
* @param one_based_index One-based parameter index for bind command
* @param buffered_rows Number of rows for which the buffer should be allocated
* @param desription Description concerning data type of parameter
*/
parameter(cpp_odbc::statement const & statement, std::size_t one_based_index, std::size_t buffered_rows, std::unique_ptr<description const> description);
/**
* @brief Return the parameter's type code
*/
type_code get_type_code() const;
/**
* @brief Determine whether this parameter is suitable to hold a value of
* given type and size
* @param code The type code for the value
* @param value_size The size of the value in bytes
* @return True if the parameter could hold such a value, else false.
*/
bool is_suitable_for(type_code code, std::size_t value_size) const;
/**
* @brief Retrieve a reference to the internal buffer
*/
cpp_odbc::multi_value_buffer & get_buffer();
~parameter();
private:
std::unique_ptr<description const> description_;
cpp_odbc::multi_value_buffer buffer_;
};
/**
* @brief Move the buffer element contained in the given row_index to the first row (with index 0)
* @param param Parameter for which to perform the operation
* @param row_index Index of the row whose value is copied
*/
void move_to_top(parameter & param, std::size_t row_index);
}
|
//
// JHDynamicViewController.h
// jiaxiaohuiDemo
//
// Created by 陈钰全 on 16/6/15.
// Copyright © 2016年 jiaXiaoHui. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JHDynamicViewController : UIViewController
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <DevToolsInterface/XCReferenceBasedFindable.h>
@class NSString, NSTextStorage;
@interface _XCTextFindable : XCReferenceBasedFindable
{
NSString *_textFilePath;
unsigned long long _textFileEncoding;
NSTextStorage *_textFileContents;
BOOL _ignoresRichText;
}
@property(nonatomic) BOOL ignoresRichText; // @synthesize ignoresRichText=_ignoresRichText;
- (void)performBackgroundSearch;
- (void)prepareToSearch;
- (BOOL)canSearchInBackground;
- (void)dealloc;
- (id)initWithFileReference:(id)arg1 batchFinder:(id)arg2;
@end
|
#include "munit.h"
#include "util.h"
#include "darray.h"
/* GLOBAL VARIABLES */
static struct darray *array = NULL;
static int *val1 = NULL;
static int *val2 = NULL;
static int *new_val1 = NULL;
static int *new_val2 = NULL;
/* PROTOTYPES */
int test_darray_new_and_destroy(void);
int test_darray_push_pop(void);
int test_darray_new_element(void);
int test_darray_contains(void);
int test_darray_copy(void);
int test_darray_set_and_get(void);
int test_darray_update(void);
int test_darray_remove(void);
int test_darray_expand_and_contract(void);
void test_suite(void);
static int intcmp_wrapper(const void *val_1, const void *val_2)
{
return intcmp(*(int *) val_1, *(int *) val_2);
}
static void setup(void)
{
array = darray_new(sizeof(int), 100);
}
static void teardown(void)
{
darray_clear_destroy(array);
}
int test_darray_new_and_destroy(void)
{
array = darray_new(sizeof(int), 100);
mu_check(array != NULL);
mu_check(array->contents != NULL);
mu_check(array->end == 0);
mu_check(array->element_size == sizeof(int));
mu_check(array->max == 100);
darray_destroy(array);
return 0;
}
int test_darray_push_pop(void)
{
int i;
int *val;
setup();
/* test push */
for (i = 0; i < 1000; i++) {
val = darray_new_element(array);
*val = i * 333;
darray_push(array, val);
}
mu_check(array->max == 1300);
/* test pop */
for (i = 999; i >= 0; i--) {
val = darray_pop(array);
mu_check(val != NULL);
mu_check(*val == i * 333);
free(val);
}
teardown();
return 0;
}
int test_darray_contains(void)
{
int *val;
int res;
setup();
/* set element in array */
val = darray_new_element(array);
*val = 99;
darray_set(array, 0, val);
/* test contains */
res = darray_contains(array, val, intcmp_wrapper);
mu_check(res == 1);
teardown();
return 0;
}
int test_darray_copy(void)
{
int *val;
int *val_copy;
struct darray *array_copy;
setup();
/* set element in array */
val = darray_new_element(array);
*val = 99;
darray_set(array, 0, val);
/* test copy */
array_copy = darray_copy(array);
val_copy = darray_get(array_copy, 0);
mu_check(val != val_copy);
mu_check(intcmp_wrapper(val, val_copy) == 0);
teardown();
darray_clear_destroy(array_copy);
return 0;
}
int test_darray_new_element(void)
{
setup();
/* test new */
val1 = darray_new_element(array);
val2 = darray_new_element(array);
mu_check(val1 != NULL);
mu_check(val2 != NULL);
free(val1);
free(val2);
teardown();
return 0;
}
int test_darray_set_and_get(void)
{
setup();
/* test set element */
val1 = darray_new_element(array);
val2 = darray_new_element(array);
darray_set(array, 0, val1);
darray_set(array, 1, val2);
/* test get element */
mu_check(darray_get(array, 0) == val1);
mu_check(darray_get(array, 1) == val2);
teardown();
return 0;
}
int test_darray_update(void)
{
setup();
/* set element */
new_val1 = darray_new_element(array);
new_val2 = darray_new_element(array);
*new_val1 = 123;
*new_val2 = 987;
/* update */
darray_update(array, 0, new_val1);
darray_update(array, 1, new_val2);
/* assert */
mu_check(darray_get(array, 0) == new_val1);
mu_check(darray_get(array, 1) == new_val2);
teardown();
return 0;
}
int test_darray_remove(void)
{
int *val_1;
int *val_2;
int *result;
setup();
/* set elements */
val_1 = darray_new_element(array);
val_2 = darray_new_element(array);
*val_1 = 123;
*val_2 = 987;
darray_set(array, 0, val_1);
darray_set(array, 1, val_2);
/* remove element at index = 0 */
result = darray_remove(array, 0);
mu_check(result != NULL);
mu_check(*result == *val_1);
mu_check(darray_get(array, 0) == NULL);
free(result);
/* remove element at index = 1 */
result = darray_remove(array, 1);
mu_check(result != NULL);
mu_check(*result == *val_2);
mu_check(darray_get(array, 1) == NULL);
free(result);
teardown();
return 0;
}
int test_darray_expand_and_contract(void)
{
size_t old_max;
setup();
/* test expand */
old_max = (unsigned int) array->max;
darray_expand(array);
mu_check((unsigned int) array->max == old_max + array->expand_rate);
/* test contract */
darray_contract(array);
mu_check((unsigned int) array->max == array->expand_rate + 1);
teardown();
return 0;
}
void test_suite(void)
{
mu_add_test(test_darray_new_and_destroy);
mu_add_test(test_darray_push_pop);
mu_add_test(test_darray_contains);
mu_add_test(test_darray_copy);
mu_add_test(test_darray_new_element);
mu_add_test(test_darray_set_and_get);
mu_add_test(test_darray_update);
mu_add_test(test_darray_remove);
mu_add_test(test_darray_expand_and_contract);
}
mu_run_tests(test_suite)
|
#ifndef DISPAY_H
#define DISPAY_H
#include <iostream>
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <string>
class dispay
{
public:
dispay(int width,int height,const std::string& title);
virtual ~dispay();
SDL_Window* m_window;
SDL_GLContext m_glContext;
bool isClosed = false;
void update();
void clearScreen(float r,float g,float b,float a);
protected:
private:
};
#endif // DISPAY_H
|
/*
* Created by suemi on 2016/12/8.
*/
#ifndef SLOG_NULL_APPENDER_H
#define SLOG_NULL_APPENDER_H
#include "slog/appender/appender.h"
namespace slog {
/**
* 输出到/dev/null,什么也不做的Appender
* @author suemi
*/
class NullAppender : public Appender {
public:
NullAppender(const std::string& name="null_appender");
NullAppender(const Properties &prop);
virtual ~NullAppender();
virtual bool is_immediate() const override;
protected:
virtual Result DoAppend(const char *data, int len) override;
};
}
#endif
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Linaro Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <alloca.h>
// Include Zephyr's autoconf.h, which should be made first by Zephyr makefiles
#include "autoconf.h"
// Included here to get basic Zephyr environment (macros, etc.)
#include <zephyr.h>
// Usually passed from Makefile
#ifndef MICROPY_HEAP_SIZE
#define MICROPY_HEAP_SIZE (16 * 1024)
#endif
#define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_KBD_EXCEPTION (1)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_ATTRTUPLE (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FILTER (0)
#define MICROPY_PY_BUILTINS_MIN_MAX (0)
#define MICROPY_PY_BUILTINS_PROPERTY (0)
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
#define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
#define MICROPY_MODULE_WEAK_LINKS (1)
#define MICROPY_PY_STRUCT (0)
#ifdef CONFIG_NETWORKING
// If we have networking, we likely want errno comfort
#define MICROPY_PY_UERRNO (1)
#define MICROPY_PY_USOCKET (1)
#endif
#define MICROPY_PY_UTIME (1)
#define MICROPY_PY_UTIME_MP_HAL (1)
#define MICROPY_PY_ZEPHYR (1)
#define MICROPY_PY_SYS_MODULES (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_PY_BUILTINS_COMPLEX (0)
// Saving extra crumbs to make sure binary fits in 128K
#define MICROPY_COMP_CONST_FOLDING (0)
#define MICROPY_COMP_CONST (0)
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0)
#ifdef CONFIG_BOARD
#define MICROPY_HW_BOARD_NAME "zephyr-" CONFIG_BOARD
#else
#define MICROPY_HW_BOARD_NAME "zephyr-generic"
#endif
#ifdef CONFIG_SOC
#define MICROPY_HW_MCU_NAME CONFIG_SOC
#else
#define MICROPY_HW_MCU_NAME "unknown-cpu"
#endif
#define MICROPY_MODULE_FROZEN_STR (1)
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
typedef long mp_off_t;
#define MP_STATE_PORT MP_STATE_VM
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8];
extern const struct _mp_obj_module_t mp_module_machine;
extern const struct _mp_obj_module_t mp_module_time;
extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_zephyr;
#if MICROPY_PY_USOCKET
#define MICROPY_PY_USOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) },
#define MICROPY_PY_USOCKET_WEAK_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_usocket) },
#else
#define MICROPY_PY_USOCKET_DEF
#define MICROPY_PY_USOCKET_WEAK_DEF
#endif
#if MICROPY_PY_UTIME
#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
#else
#define MICROPY_PY_UTIME_DEF
#endif
#if MICROPY_PY_ZEPHYR
#define MICROPY_PY_ZEPHYR_DEF { MP_ROM_QSTR(MP_QSTR_zephyr), MP_ROM_PTR(&mp_module_zephyr) },
#else
#define MICROPY_PY_ZEPHYR_DEF
#endif
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
MICROPY_PY_USOCKET_DEF \
MICROPY_PY_UTIME_DEF \
MICROPY_PY_ZEPHYR_DEF \
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_time) }, \
MICROPY_PY_USOCKET_WEAK_DEF \
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
|
#ifndef ROCNROLL_IPERFORMANCE_H
#define ROCNROLL_IPERFORMANCE_H
#include <config.h>
#include <string>
using namespace std;
class IPerformance {
public:
virtual void printYAML(const string& name, const string& indent) = 0;
virtual void printYAML() = 0;
virtual void compute() = 0;
virtual void makeFinite() = 0;
};
#endif
|
#pragma once
#include <GameEngine/IGameScreen.h>
#include <GameEngine/Window.h>
#include <GameEngine\Camera2D.h>
#include <GameEngine\GLSLProgram.h>
#include <GameEngine\Timing.h>
#include <GameEngine\Random.h>
#include "World.h"
#include "Player.h"
#include "Zombie.h"
#include "PathRequestManager.h"
// Our custom gameplay screen that inherits from IGameScreen
class GameScreen : public GameEngine::IGameScreen
{
public:
GameScreen(GameEngine::Window* _window);
~GameScreen();
/** \brief Returns the next screen index (returns none if there is no next one) */
virtual int GetNextScreenIndex() const override;
/** \brief Returns the previous screen index (returns none if there is no next one) */
virtual int GetPreviousScreenIndex() const override;
/** \brief function called on scene build (when it's first allocated) */
virtual void Build() override;
/** \brief function called on scene destruction (when it's de-allocated) */
virtual void Destroy() override;
/** \brief function called on scene entry */
virtual void OnEntry() override;
/** \brief function called on scene exit */
virtual void OnExit() override;
/** \brief function called on every frame to update the current screen */
virtual void Update() override;
/** \brief function called every frame to draw the current screen */
virtual void Draw() override;
private:
/** \brief Check the user input from the event poll */
void CheckInput();
/** \brief function called every frame to draw the UI
* \param _shader - shader to use */
void DrawUI(GameEngine::GLSLProgram& _shader);
private:
std::shared_ptr<PathRequestManager> m_pathRequestManger; ///< the path request manager for pathfinding
GameEngine::Window* m_window{ nullptr }; ///< Pointer to the window this screen belongs to
GameEngine::Camera2D m_camera; ///< the main game camera
GameEngine::Camera2D m_hudCamera; ///the camera for UI
std::shared_ptr<Player> m_player; ///< the Player
std::vector<std::unique_ptr<Zombie>> m_zombies; ///< The set of zombies
GameEngine::SpriteBatch m_spriteBatch; ///< The spritebatch for batched rendering for agents
GameEngine::SpriteBatch m_hudSpriteBatch; ///< The spritebatch for batched rendering for UI
GameEngine::SpriteFont m_spriteFont; ///< Spritefont for rendering text
std::string m_currentAlgo = "ASTAR"; ///< the name of the current algorithm used
GameEngine::GLSLProgram m_shader; ///< GLSL shader program
GameEngine::HRTimer m_timer; ///< high-resolution timer
std::vector<std::shared_ptr<World>> m_gameWorlds; ///< set of all the game worlds/levels (only 1 currently)
int m_currentLevel{ -1 }; ///< index of the current level
bool m_debugMode{ false }; ///< flag whether to have debug code on or off
GameEngine::Random m_random; ///< random number generator
};
|
#pragma once
#include <atomic>
#include <chrono>
#include <functional>
#include <memory>
#include <set>
#include <string>
#include <thread>
#include <folly/futures/Future.h>
#include <folly/futures/helpers.h>
#include <folly/futures/Promise.h>
#include <folly/io/async/EventBase.h>
#include <folly/ProducerConsumerQueue.h>
#include <folly/Synchronized.h>
#include <glog/logging.h>
namespace relevanced {
namespace util {
template <typename T>
class Debouncer {
folly::Synchronized<std::set<T>> inFlight_;
std::atomic<std::chrono::milliseconds> initialDelay_;
std::atomic<std::chrono::milliseconds> interval_;
std::atomic<std::chrono::milliseconds> requeueDelay_;
std::function<void(T)> onValueCb_;
std::atomic<bool> stopping_{false};
std::atomic<size_t> numInFlight_ {0};
public:
Debouncer(std::chrono::milliseconds initialDelay,
std::chrono::milliseconds interval,
std::function<void(T)> onValue)
: initialDelay_(initialDelay),
interval_(interval),
onValueCb_(onValue) {
std::chrono::milliseconds diff(10);
requeueDelay_ = interval + diff;
}
void stop() {
stopping_ = true;
}
void removeDebounced(T &t) {
SYNCHRONIZED(inFlight_) {
if (inFlight_.find(t) != inFlight_.end()) {
inFlight_.erase(t);
numInFlight_.fetch_sub(1);
}
}
}
bool writeIfNotInFlight(T &t) {
if (stopping_) {
return false;
}
bool shouldWrite = false;
SYNCHRONIZED(inFlight_) {
if (inFlight_.find(t) == inFlight_.end()) {
shouldWrite = true;
inFlight_.insert(t);
numInFlight_.fetch_add(1);
}
}
if (shouldWrite) {
folly::makeFuture(t)
.delayed(initialDelay_)
.then([this](T elem) {
if (!stopping_) {
onValueCb_(elem);
}
});
folly::makeFuture(t)
.delayed(interval_)
.then([this](T elem) {
removeDebounced(elem);
});
}
bool wrote = shouldWrite;
return wrote;
}
void write(T t) {
bool wrote = writeIfNotInFlight(t);
if (!wrote) {
folly::makeFuture(t)
.delayed(requeueDelay_)
.then([this](T toWrite) {
if (stopping_) {
removeDebounced(toWrite);
} else {
writeIfNotInFlight(toWrite);
}
});
}
}
void join() {
for (;;) {
auto inProgress = numInFlight_.load();
if (inProgress == 0) {
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
void debug_setTimeouts(std::chrono::milliseconds initialDelay,
std::chrono::milliseconds interval,
std::chrono::milliseconds requeueDelay) {
initialDelay_ = initialDelay;
interval_ = interval;
requeueDelay_ = requeueDelay;
}
void debug_setShortTimeouts() {
debug_setTimeouts(
std::chrono::milliseconds(10),
std::chrono::milliseconds(10),
std::chrono::milliseconds(1)
);
}
void debug_setVeryShortTimeouts() {
debug_setTimeouts(
std::chrono::milliseconds(0),
std::chrono::milliseconds(0),
std::chrono::milliseconds(0)
);
}
};
} // util
} // relevanced
|
//
// CMFriend.h
// CMSetController
//
// Created by Samuel Ford on 2/17/13.
// Copyright (c) 2013 Samuel Ford. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CMFriend : NSObject
@property (strong) NSString *name;
@property (strong) NSString *favoriteColor;
@property (strong) NSNumber *rating;
+ (CMFriend *)friendWithName:(NSString *)name favoriteColor:(NSString *)color rating:(NSNumber *)rating;
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <DevToolsCore/XCBuildPhaseDGSnapshot.h>
@interface XCHeadersBuildPhaseDGSnapshot : XCBuildPhaseDGSnapshot
{
}
+ (id)defaultName;
- (id)initWithInformationFromBuildPhase:(id)arg1 forTargetSnapshot:(id)arg2;
- (void)computeDependenciesInTargetBuildContext:(id)arg1;
- (void)computeDependenciesForBuildFileReference:(id)arg1 inTargetBuildContext:(id)arg2;
@end
|
#import "BackgroundView.h"
#import "StatusItemView.h"
#import <Firebase/Firebase.h>
@class PanelController;
@protocol PanelControllerDelegate <NSObject>
@optional
- (StatusItemView *)statusItemViewForPanelController:(PanelController *)controller;
@end
#pragma mark -
@interface PanelController : NSWindowController <NSWindowDelegate>
{
BOOL _hasActivePanel;
__unsafe_unretained BackgroundView *_backgroundView;
__unsafe_unretained id<PanelControllerDelegate> _delegate;
__unsafe_unretained NSSearchField *_searchField;
__unsafe_unretained NSTextField *_textField;
}
@property (nonatomic, unsafe_unretained) IBOutlet BackgroundView *backgroundView;
@property (nonatomic, unsafe_unretained) IBOutlet NSSearchField *searchField;
@property (nonatomic, unsafe_unretained) IBOutlet NSTextField *textField;
@property (nonatomic) BOOL hasActivePanel;
@property (nonatomic, unsafe_unretained, readonly) id<PanelControllerDelegate> delegate;
- (id)initWithDelegate:(id<PanelControllerDelegate>)delegate;
- (void)openPanel;
- (void)closePanel;
@end
|
/**
* Part of the RealTimeCapon (RTC) library.
*
* Author: Jon Petter Aasen
* E-mail: jon.p.asen@ntnu.no - jp.aasen@gmail.com
**/
#pragma once
template <typename C>
class ISolver
{
public:
virtual ~ISolver() {};
/**
* Method for solving N sets of linear equations Ax = b -> x = A^{-1}b.
* A must be in row-major order.
**/
virtual int solve(
C* &x, // buffer holding the solutions
C* &A, // buffer holding matrices
C* &b, // buffer holding the right sides
int &N, // size of each linear system
int &batch, // number of linear systems
bool &x_on_gpu, // true if x should remain on the gpu
bool &A_on_gpu, // true if R is already on the gpu
bool &b_on_gpu // true if b is already on the gpu
) = 0;
};
|
//
// Lighting.h
// Chilli Source
// Created by Ian Copland on 07/07/2014.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Tag Games Limited
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef _CHILLISOURCE_RENDERING_LIGHTING_H_
#define _CHILLISOURCE_RENDERING_LIGHTING_H_
#include <ChilliSource/ChilliSource.h>
#include <ChilliSource/Rendering/Lighting/AmbientLightComponent.h>
#include <ChilliSource/Rendering/Lighting/DirectionalLightComponent.h>
#include <ChilliSource/Rendering/Lighting/LightComponent.h>
#include <ChilliSource/Rendering/Lighting/PointLightComponent.h>
#endif
|
/**
* @file WeakSmartPointer.h
* @class WeakSmartPointer
* @author Jichan (development@jc-lab.net / http://ablog.jc-lab.net/category/JsCPPUtils )
* @date 2018/11/14
* @brief WeakSmartPointer. Can be check object is alive.
* @copyright Copyright (C) 2018 jichan.\n
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma once
#endif
#ifndef __JSCPPUTILS_WEAKSMARTPOINTER_H__
#define __JSCPPUTILS_WEAKSMARTPOINTER_H__
#include <stdio.h>
#include <assert.h>
#include <exception>
#include "SmartPointer.h"
namespace JsCPPUtils
{
template <class T>
class WeakSmartPointer : public _JsCPPUtils_private::SmartPointerBase
{
private:
T* ptr;
public:
explicit WeakSmartPointer()
{
_constructor();
}
WeakSmartPointer(int maybeNull)
{
_constructor();
}
WeakSmartPointer(const WeakSmartPointer& _ref)
{
copyFrom(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
template<class U>
WeakSmartPointer(const WeakSmartPointer<U>& _ref)
{
copyFromTU<T, U>(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
template<class U>
void operator=(const WeakSmartPointer<U>& _ref)
{
delWeakRef();
_constructor();
copyFromTU<T, U>(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
void operator=(const WeakSmartPointer<T>& _ref)
{
delWeakRef();
_constructor();
copyFrom(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
template<class U>
WeakSmartPointer(const SmartPointer<U>& _ref)
{
copyFromTU<T, U>(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
template<class U>
void operator=(const SmartPointer<U>& _ref)
{
delWeakRef();
_constructor();
copyFromTU<T, U>(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
void operator=(const SmartPointer<T>& _ref)
{
delWeakRef();
_constructor();
copyFrom(_ref);
this->ptr = (T*)m_ptr;
addWeakRef();
}
#if (__cplusplus >= 201103) || (defined(HAS_MOVE_SEMANTICS) && HAS_MOVE_SEMANTICS == 1)
explicit WeakSmartPointer(WeakSmartPointer&& _ref)
{
m_ptr = _ref->m_ptr;
this->ptr = (T*)m_ptr;
m_rootManager = _ref->m_rootManager;
_ref->m_ptr = NULL;
_ref->m_rootManager = NULL;
}
#endif
~WeakSmartPointer()
{
delWeakRef();
}
T* operator->() const { return (T*)m_ptr; }
T& operator*() const { return *(T*)m_ptr; }
T* getPtr() const { return (T*)m_ptr; }
bool operator==(void *x) const { return m_ptr == x; }
bool operator!=(void *x) const { return m_ptr != x; }
bool operator!() const { return (m_ptr == NULL); }
template<class U>
bool operator==(const SmartPointer<U>& x) const { return m_ptr == x.m_ptr; }
template<class U>
bool operator!=(const SmartPointer<U>& x) const { return m_ptr != x.m_ptr; }
template<class U>
bool operator==(const WeakSmartPointer<U>& x) const { return m_ptr == x.m_ptr; }
template<class U>
bool operator!=(const WeakSmartPointer<U>& x) const { return m_ptr != x.m_ptr; }
bool isAlive()
{
if (!m_refcounter)
return false;
return m_refcounter->alive.get() == 1;
}
SmartPointer<T> getSmartPointer()
{
SmartPointer<T> object;
void *dptr = detach();
if (dptr == NULL)
return object;
object.attach(dptr);
return object;
}
void reset()
{
this->ptr = NULL;
delWeakRef();
_constructor();
}
};
}
#endif /* __JSCPPUTILS_SMARTPOINTER_H__ */
|
#import "MOBProjection.h"
@interface MOBProjectionEPSG6606 : MOBProjection
@end
|
//
// DZLayoutAngle.h
// Pods
//
// Created by baidu on 2017/1/17.
//
//
#ifndef DZLayoutAngle_h
#define DZLayoutAngle_h
//角度转化
/**
将弧度表示转化为角度表示
@param x 弧度
@return 对应的角度
*/
#define DEGREE_TO_ANGLE(x) (x / 180.0f * M_PI)
/**
将角度表示转化为弧度表示
@param x 角度
@return 对应的弧度
*/
#define ANGLE_TO_DEGREE(x) (x * 180.0f / M_PI)
//
#endif /* DZLayoutAngle_h */
|
/**
******************************************************************************
* @file Projects/Multi/Examples/IKS01A1/LSM6DS3_FIFOContinuousMode/Src/stm32l0xx_it.c
* @author CL
* @version V4.0.0
* @date 1-May-2017
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics 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 HOLDER 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_it.h"
#include "main.h"
/** @addtogroup X_NUCLEO_IKS01A1_Examples
* @{
*/
/** @addtogroup FIFO_CONTINUOUS_MODE
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M0+ Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Debug Monitor exception
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
HAL_IncTick();
}
/******************************************************************************/
/* STM32L0xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32l0xx.s). */
/******************************************************************************/
/**
* @brief This function handles External lines 4 to 15 interrupt request
* @param None
* @retval None
*/
void EXTI4_15_IRQHandler(void)
{
HAL_GPIO_EXTI_IRQHandler(M_INT1_PIN);
HAL_GPIO_EXTI_IRQHandler(KEY_BUTTON_PIN);
}
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
// This file is part of Wintermute Engine
// For conditions of distribution and use, see copyright notice in license.txt
// http://dead-code.org/redir.php?target=wme
#if !defined(AFX_ADREGION_H__2802474C_5CE3_4B22_8794_402559E5D05B__INCLUDED_)
#define AFX_ADREGION_H__2802474C_5CE3_4B22_8794_402559E5D05B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CAdRegion : public CBRegion
{
public:
DECLARE_PERSISTENT(CAdRegion, CBRegion);
DWORD m_Alpha;
float m_Zoom;
bool m_Blocked;
bool m_Decoration;
CAdRegion(CBGame* inGame);
virtual ~CAdRegion();
HRESULT LoadFile(char* Filename);
HRESULT LoadBuffer(BYTE* Buffer, bool Complete=true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
// scripting interface
virtual CScValue* ScGetProperty(char* Name);
virtual HRESULT ScSetProperty(char *Name, CScValue *Value);
virtual HRESULT ScCallMethod(CScScript* Script, CScStack *Stack, CScStack *ThisStack, char *Name);
virtual char* ScToString();
};
#endif // !defined(AFX_ADREGION_H__2802474C_5CE3_4B22_8794_402559E5D05B__INCLUDED_)
|
/* Here is an encapsulation of the logic for collecting data over
* a Server at port 1180 from a client out there somewhere.
* Somewhere could be the driver station, where this code was
* tested, an accessory computer at the driver station, or on
* the robot itself. The stated intention is to perform vision
* processing on a computer more powerful than the cRio, and pass
* the results into the main robot code. The drive to make this
* code be the server is to make use of the roborealm builtin
* client code. So I should have read the roborealm document
* earlier. Live and learn.
* TFD February 2012
*/
#ifndef SERVER1180_H
#define SERVER1180_H 1
#include "WPILib.h"
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define BUFLEN 512
#define PORT 1180
typedef void (*PacketHandler)(void *ptr, char *data);
class Server1180
{
public:
Server1180 (PacketHandler handler, void * inst, bool=false); // Constructs listener socket and so on.
~Server1180 (); // if argument is true then cerr calls will spew.
int SendData (char *); // Send null-terminated string preferably < 512 bytes.
int GetData (char *); // Return number of bytes copied into pointer,
// zero for for nothing new.
bool Connected (); // Return connection status in case you're interested.
void ClientConnect(); // Listen for client if we don't have one yet.
// Has to be public so taskSpawn will work.
private:
PacketHandler handler;
void * handlerObj;
bool spewcerr; // Set in constructor to spew info to cerr.
int listener; // Our listening socket.
int connsock; // Our connected client. Just one.
char data[BUFLEN+1]; // Leave space for a null, always.
int numbytes; // Number of bytes to copy in when GetData called.
int tid; // Spawned task id, needed to suspend when writing.
};
#endif
|
//
// UIScreenExtension.h
// UIScreenExtension
//
// Created by Jens Schwarzer on 02/10/2017.
// Copyright © 2017 marchv. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for UIScreenExtension.
FOUNDATION_EXPORT double UIScreenExtensionVersionNumber;
//! Project version string for UIScreenExtension.
FOUNDATION_EXPORT const unsigned char UIScreenExtensionVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UIScreenExtension/PublicHeader.h>
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "dtypes.h"
#ifdef WIN32
#include <malloc.h>
#include <sys/timeb.h>
#include <windows.h>
#undef NO_ERROR
#undef MOD_SHIFT
#undef TRUE
#undef FALSE
#undef VOID
#else
#include <sys/time.h>
#include <sys/poll.h>
#include <unistd.h>
#endif
#include "dirpath.h"
void get_cwd(char *buf, size_t size)
{
#ifndef WIN32
getcwd(buf, size);
#else
GetCurrentDirectory(size, buf);
#endif
}
int set_cwd(char *buf)
{
#ifndef WIN32
if (chdir(buf) == -1)
return 1;
#else
if (SetCurrentDirectory(buf) == 0)
return 1;
#endif
return 0;
}
// destructively convert path to directory part
void path_to_dirname(char *path)
{
char *sep = strrchr(path, PATHSEP);
if (sep != NULL) {
*sep = '\0';
}
else {
path[0] = '\0';
}
}
#ifdef LINUX
char *get_exename(char *buf, size_t size)
{
char linkname[64]; /* /proc/<pid>/exe */
pid_t pid;
ssize_t ret;
/* Get our PID and build the name of the link in /proc */
pid = getpid();
if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", pid) < 0)
return NULL;
/* Now read the symbolic link */
ret = readlink(linkname, buf, size);
/* In case of an error, leave the handling up to the caller */
if (ret == -1)
return NULL;
/* Report insufficient buffer size */
if ((size_t)ret >= size)
return NULL;
/* Ensure proper NUL termination */
buf[ret] = 0;
return buf;
}
#elif defined(OPENBSD)
char *get_exename(char *buf, size_t size)
{
/* OpenBSD currently has no way of determining a processes pathname */
return NULL;
}
#elif defined(FREEBSD)
#include <sys/types.h>
#include <sys/sysctl.h>
char *get_exename(char *buf, size_t size)
{
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
sysctl(mib, 4, buf, &size, NULL, 0);
return buf;
}
#elif defined(WIN32)
char *get_exename(char *buf, size_t size)
{
if (GetModuleFileName(NULL, buf, size) == 0)
return NULL;
return buf;
}
#elif defined(MACOSX)
#include <ApplicationServices/ApplicationServices.h>
char *get_exename(char *buf, size_t size)
{
ProcessSerialNumber PSN;
FSRef ref;
if (GetCurrentProcess(&PSN) < 0 ||
GetProcessBundleLocation(&PSN, &ref) < 0 ||
FSRefMakePath(&ref, buf, size) < 0)
return NULL;
return buf;
}
#endif
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject-Protocol.h"
@protocol GQTableGenerator <NSObject>
+ (int)handleCell:(id)arg1 state:(id)arg2;
+ (int)endCells:(id)arg1 state:(id)arg2;
+ (int)beginCells:(id)arg1 state:(id)arg2;
+ (int)endTable:(id)arg1 state:(id)arg2;
+ (int)beginTable:(id)arg1 state:(id)arg2;
@end
|
/*****************************************************************************
*
* \file
*
* \brief TLV320AIC23B stereo audio CODEC driver configuration file for AVR32.
*
* This file contains the possible external configuration of the TLV320AIC23B.
*
* can be used.
*
*
* Copyright (c) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
******************************************************************************/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
//! Configuration of the TLV320AIC23B stereo audio CODEC driver
#ifndef _CONF_TLV320AIC23B_H_
#define _CONF_TLV320AIC23B_H_
#include "tlv320aic23b.h"
#include <avr32/io.h>
#include "intc.h"
#include "board.h"
//! Mode Selected: \c AIC23B_MODE_DAC, \c AIC23B_MODE_ADC or \c AIC23B_MODE_CODEC.
#define AIC23B_MODE AIC23B_MODE_CODEC
//! Control interface: \c AIC23B_CTRL_INTERFACE_TWI or \c AIC23B_CTRL_INTERFACE_SPI.
#define AIC23B_CTRL_INTERFACE AIC23B_CTRL_INTERFACE_TWI
//! Master clock (in Hz): \c 12000000 or \c 11289600.
#define AIC23B_MCLK_HZ 11289600
// If the selected control interface is TWI...
#if AIC23B_CTRL_INTERFACE == AIC23B_CTRL_INTERFACE_TWI
/*! \name TWI Connections
*/
//! @{
#define AIC23B_TWI TLV320_TWI
#define AIC23B_TWI_ADDRESS 0x1A //!< TWI address: \c 0x1A if /CS state is 0 or \c 0x1B if /CS state is 1.
#define AIC23B_TWI_MASTER_SPEED 400000
#define AIC23B_TWI_SCL_PIN TLV320_TWI_SCL_PIN
#define AIC23B_TWI_SCL_FUNCTION TLV320_TWI_SCL_FUNCTION
#define AIC23B_TWI_SDA_PIN TLV320_TWI_SDA_PIN
#define AIC23B_TWI_SDA_FUNCTION TLV320_TWI_SDA_FUNCTION
//! @}
// If the selected control interface is SPI...
#elif AIC23B_CTRL_INTERFACE == AIC23B_CTRL_INTERFACE_SPI
/*! \name SPI Connections
*/
//! @{
#define AIC23B_SPI SPARE_SPI
#define AIC23B_SPI_NPCS SPARE_SPI_NPCS
#define AIC23B_SPI_MASTER_SPEED 12500000
#define AIC23B_SPI_SCK_PIN SPARE_SPI_SCK_PIN
#define AIC23B_SPI_SCK_FUNCTION SPARE_SPI_SCK_FUNCTION
#define AIC23B_SPI_MISO_PIN SPARE_SPI_MISO_PIN
#define AIC23B_SPI_MISO_FUNCTION SPARE_SPI_MISO_FUNCTION
#define AIC23B_SPI_MOSI_PIN SPARE_SPI_MOSI_PIN
#define AIC23B_SPI_MOSI_FUNCTION SPARE_SPI_MOSI_FUNCTION
#define AIC23B_SPI_NPCS_PIN SPARE_SPI_NPCS_PIN
#define AIC23B_SPI_NPCS_FUNCTION SPARE_SPI_NPCS_FUNCTION
//! @}
#endif
/*! \name SSC Connections
*/
//! @{
#define AIC23B_SSC (&AVR32_SSC)
#define AIC23B_SSC_TX_PDCA_PID AVR32_PDCA_PID_SSC_TX
#define AIC23B_SSC_TX_PDCA_CHANNEL 0
#define AIC23B_SSC_TX_PDCA_IRQ AVR32_PDCA_IRQ_0
#define AIC23B_SSC_TX_PDCA_INT_LEVEL AVR32_INTC_INT3
#define AIC23B_SSC_TX_CLOCK_PIN AVR32_SSC_TX_CLOCK_0_PIN
#define AIC23B_SSC_TX_CLOCK_FUNCTION AVR32_SSC_TX_CLOCK_0_FUNCTION
#define AIC23B_SSC_TX_DATA_PIN AVR32_SSC_TX_DATA_0_PIN
#define AIC23B_SSC_TX_DATA_FUNCTION AVR32_SSC_TX_DATA_0_FUNCTION
#define AIC23B_SSC_TX_FRAME_SYNC_PIN AVR32_SSC_TX_FRAME_SYNC_0_PIN
#define AIC23B_SSC_TX_FRAME_SYNC_FUNCTION AVR32_SSC_TX_FRAME_SYNC_0_FUNCTION
#define AIC23B_SSC_RX_PDCA_PID AVR32_PDCA_PID_SSC_RX
#define AIC23B_SSC_RX_PDCA_CHANNEL 1
#define AIC23B_SSC_RX_PDCA_IRQ AVR32_PDCA_IRQ_1
#define AIC23B_SSC_RX_PDCA_INT_LEVEL AVR32_INTC_INT3
#define AIC23B_SSC_RX_DATA_PIN AVR32_SSC_RX_DATA_0_PIN
#define AIC23B_SSC_RX_DATA_FUNCTION AVR32_SSC_RX_DATA_0_FUNCTION
#define AIC23B_SSC_RX_FRAME_SYNC_PIN AVR32_SSC_RX_FRAME_SYNC_0_PIN
#define AIC23B_SSC_RX_FRAME_SYNC_FUNCTION AVR32_SSC_RX_FRAME_SYNC_0_FUNCTION
//! @}
// choose which input to select for the codec
#define AIC23B_INPUT AIC23B_INPUT_MIC
// #define AIC23B_INPUT AIC23B_INPUT_LINE
#endif // _CONF_TLV320AIC23B_H_
|
//
// RTAppDelegate.h
// RTToastManager
//
// Created by Roman Temchenko on 7/8/13.
// Copyright (c) 2013 Roman Temchenko. All rights reserved.
//
// This code is distributed under the terms and conditions of the MIT license.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@class RTViewController;
@interface RTAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) RTViewController *viewController;
@end
|
#include<stdio.h>
main()
{
long nc;
nc = 0;
while(getchar() != EOF)
++nc;
printf("Total words in given line are : \t %ld \n",nc);
}
|
// Copyright (c) 2011-2015 The Bitcoin Core developers
// Copyright (c) 2018-2020 The Ion Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_UTILITYDIALOG_H
#define BITCOIN_QT_UTILITYDIALOG_H
#include <QDialog>
#include <QObject>
class BitcoinGUI;
namespace Ui {
class HelpMessageDialog;
}
/** "Help message" dialog box */
class HelpMessageDialog : public QDialog
{
Q_OBJECT
public:
enum HelpMode {
about,
cmdline,
pshelp
};
explicit HelpMessageDialog(QWidget *parent, HelpMode helpMode);
~HelpMessageDialog();
void printToConsole();
void showOrPrint();
private:
Ui::HelpMessageDialog *ui;
QString text;
private Q_SLOTS:
void on_okButton_accepted();
};
/** "Shutdown" window */
class ShutdownWindow : public QWidget
{
Q_OBJECT
public:
ShutdownWindow(QWidget *parent=0, Qt::WindowFlags f=0);
static QWidget *showShutdownWindow(BitcoinGUI *window);
protected:
void closeEvent(QCloseEvent *event);
};
#endif // BITCOIN_QT_UTILITYDIALOG_H
|
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2022 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___AVOIDCOLLISIONCURVE___H__
#define __OPENSPACE_CORE___AVOIDCOLLISIONCURVE___H__
#include <openspace/navigation/pathcurve.h>
namespace openspace { class SceneGraphNode; }
namespace openspace::interaction {
class WayPoint;
class AvoidCollisionCurve : public PathCurve {
public:
AvoidCollisionCurve(const Waypoint& start, const Waypoint& end);
private:
void removeCollisions(int step = 0);
std::vector<SceneGraphNode*> _relevantNodes;
};
} // namespace openspace::interaction
#endif // __OPENSPACE_CORE___AVOIDCOLLISIONCURVE___H__
|
#include "ceres.h"
#include "cutcopypaste.h"
#include "cachememhandler.h"
#include "clip.h"
struct Clip *CCP_clip=NULL;
bool CCP_copy(struct FFTSound *fftsound,int area_start,int area_end){
if(CCP_clip!=NULL) CLIP_delete(CCP_clip);
CCP_clip=CLIP_new(fftsound,area_start,area_end,areaf1,areaf2);
if(CCP_clip==NULL) return false;
return true;
}
void CCP_cut(struct FFTSound *fftsound,int area_start,int area_end){
long point;
int i, j, ch;
if(area_end<=area_start) return;
if(CCP_copy(fftsound,area_start,area_end)==false) return;
for (ch=0; ch<fftsound->samps_per_frame; ch++) {
point=area_start*fftsound->numchannels + ch*fftsound->numchannels*fftsound->horiz_num;
for (i=area_start; i<area_end; i++) {
for (j=areaf1; j<areaf2; j++){
MEGAMP_PUT(point+j,0.0f);
MEGFREQ_PUT(point+j,0.0f);
}
point+=fftsound->numchannels;
}
}
}
void CCP_paste(struct FFTSound *fftsound,int area_start,int area_end){
if(CCP_clip==NULL) return;
CLIP_paste(CCP_clip,fftsound,area_start,area_end);
}
|
/*
* ctrl_DP_mss_private.h
*
* Code generation for model "ctrl_DP_mss".
*
* Model version : 1.10
* Simulink Coder version : 8.6 (R2014a) 27-Dec-2013
* C source code generated on : Wed Jan 28 18:35:59 2015
*
* Target selection: NIVeriStand_VxWorks.tlc
* Note: GRT includes extra infrastructure and instrumentation for prototyping
* Embedded hardware selection: 32-bit Generic
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef RTW_HEADER_ctrl_DP_mss_private_h_
#define RTW_HEADER_ctrl_DP_mss_private_h_
#include "rtwtypes.h"
#include "builtin_typeid_types.h"
#include "multiword_types.h"
#ifndef __RTWTYPES_H__
#error This file requires rtwtypes.h to be included
#endif /* __RTWTYPES_H__ */
extern real_T rt_roundd_snf(real_T u);
extern real_T rt_remd_snf(real_T u0, real_T u1);
extern real_T rt_atan2d_snf(real_T u0, real_T u1);
/* private model entry point functions */
extern void ctrl_DP_mss_derivatives(void);
#endif /* RTW_HEADER_ctrl_DP_mss_private_h_ */
|
/**
******************************************************************************
* @file LIS302DL/main.h
* @author MCD Application Team
* @version V1.0.0
* @date 19-September-2011
* @brief Header for main.c module
******************************************************************************
* @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, STMICROELECTRONICS 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 CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stm32f4_discovery.h"
#include "comunication.h"
#include "stm32f4xx_it.h"
#define LEDR LED5
#define LEDG LED4
#define LEDB LED6
#define LEDO LED3
#endif /* __MAIN_H */
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
/**
* Copyright (c) 2021 Darius Rückert
* Licensed under the MIT License.
* See LICENSE file for more information.
*/
#pragma once
#include "saiga/config.h"
#include <cmath>
namespace Saiga
{
template <typename T>
constexpr T epsilon()
{
static_assert(std::is_floating_point<T>::value, "Only allowed for floating point types.");
return std::numeric_limits<T>::epsilon();
}
template <typename T>
constexpr T pi()
{
static_assert(std::is_floating_point<T>::value, "Only allowed for floating point types.");
return T(3.14159265358979323846);
}
template <typename T>
constexpr T two_pi()
{
static_assert(std::is_floating_point<T>::value, "Only allowed for floating point types.");
return pi<T>() * T(2);
}
constexpr float clamp(float v, float mi, float ma)
{
return std::min(ma, std::max(mi, v));
}
#ifndef IS_CUDA
// Already defined in CUDA's device_functions.hpp
SAIGA_HOST constexpr float saturate(float v)
{
return clamp(v, 0, 1);
}
#endif
constexpr float smoothstep(float edge0, float edge1, float x)
{
float t = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
return t * t * (3.0f - 2.0f * t);
}
HD inline float fract(float a)
{
return a - std::floor(a);
}
HD inline double fract(double a)
{
return a - std::floor(a);
}
template <typename Derived>
HD constexpr typename Derived::PlainObject fract(const Eigen::MatrixBase<Derived>& v)
{
return (v.array() - v.array().floor());
}
template <typename T>
constexpr T degrees(T a)
{
static_assert(std::is_floating_point<T>::value, "Only allowed for floating point types.");
return a * T(180.0) / pi<T>();
}
template <typename T>
constexpr T radians(T a)
{
static_assert(std::is_floating_point<T>::value, "Only allowed for floating point types.");
return a / T(180.0) * pi<T>();
}
HD inline float mix(const float& a, const float& b, float alpha)
{
return (1 - alpha) * a + alpha * b;
}
// Maybe use more advanced implementation from boost?
// https://www.boost.org/doc/libs/1_51_0/boost/math/special_functions/sinc.hpp
template <typename T>
inline T sinc(const T x)
{
if (abs(x) >= std::numeric_limits<T>::epsilon())
{
return (sin(x) / x);
}
else
{
return T(1);
}
}
} // namespace Saiga
|
#ifndef Manta_Core_UnknownComponent_h
#define Manta_Core_UnknownComponent_h
#include <Core/Exceptions/Exception.h>
#include <string>
namespace Manta {
using namespace std;
class UnknownComponent : public Exception {
public:
UnknownComponent(const std::string& error, const std::string& spec);
UnknownComponent(const UnknownComponent&);
virtual ~UnknownComponent() throw();
virtual const char* message() const;
virtual const char* type() const;
protected:
private:
std::string message_;
UnknownComponent& operator=(const UnknownComponent&);
};
}
#endif
|
#import <Foundation/Foundation.h>
#import "CP2DRenderer.h"
#include "GameWorld.h"
using namespace CoolPhysics2D;
@interface CP2DGameWorldRenderer : NSObject<CP2DRenderer>
-(id)initWithGameWorld:(GameWorld*)gameWorld;
@end
|
//
// RollbarLog.h
// Rollbar
//
// Created by Andrey Kornich on 2019-11-12.
// Copyright © 2019 Rollbar. All rights reserved.
//
#import <Foundation/Foundation.h>
/// Rollbar equivalent of NSLog(...) that also allows capture of the log messages as part of RollbarTelemetry data.
/// NOTE: When this SDK is used from Objective-C codebase NSLog(...) messages get captured by the SDK.
/// However, when used from Swift codebase, all the NSLog(...) calls in Swift need to be replaced
/// with similar RollbarLog(...) calls to be captured as extra telemetry data.
/// @param format format of the logged message
void RollbarLog(NSString *format, ...);
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,
i,
j,
r = 0,
t = 0;
scanf("%d", &n);
int a[n][n];
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
}
}
for (i = 0; i < n; i++)
r = a[i][i] + r;
for (i = 0; i < n; i++)
t = a[i][n - i - 1] + t;
printf("%d",abs(r - t));
return 0;
}
|
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "noc_control.h"
#include <altera_avalon_pio_regs.h>
#include <system.h>
#include "hw_timer.h"
static void *base_addr;
static buffer the_buffer;
static int total_flits = 0;
void noc_init()
{
printf("initializing network!\n");
int i;
for(i = 0; i < MAX_PACKETS; i++){
the_buffer.the_packets[i].num_flits = 0;
the_buffer.the_packets[i].identifier = 0;
}
WR_PIO(NOC_CTRL_BASE, NOC_RESET);
usleep(100);
WR_PIO(NOC_CTRL_BASE, 0);
}
void send_flit(uint32_t dest, uint32_t word0, uint32_t word1, uint32_t set_tail)
{
//wait for ack to go low
while(RD_PIO(NOC_STS_BASE) & TX_ACK_BIT);
//THIS IS A LEGACY FUNCTION
//only send in mode 2
WR_PIO(TX_0_BASE, word0);
WR_PIO(TX_1_BASE, word1);
//set control values
int ncv = (dest<<16) | (set_tail?TAIL_FLIT_BIT:0) | CPU_TX_REQ | FORMAT_2;
no_data_send(ncv);
}
void no_data_send(uint32_t format_code){
//uint64_t start = read_timer();
while(RD_PIO(NOC_STS_BASE) & TX_ACK_BIT);
WR_PIO(NOC_CTRL_BASE, format_code);
while((RD_PIO(NOC_STS_BASE) & TX_ACK_BIT) == 0);
WR_PIO(NOC_CTRL_BASE, 0);
//add_time(NOC_SEND_COUNTS, read_timer() - start);
}
uint32_t get_buffer_rx_state()
{
uint32_t state = RD_PIO(NOC_STS_BASE);
return state & 0xFF;
}
uint32_t copy_to_buffer(uint32_t id)
{
uint32_t packet_index = id;
uint32_t flit_index = the_buffer.the_packets[packet_index].num_flits;
if(0 && (id < LUMA_MOCOMP_MAX) && (id >= LUMA_MOCOMP_MIN))
{
WR_PIO(NOC_CTRL_BASE, PARSE_8_BIT_UNSIGNED);
//luma motion comp
//special attention should be payed to these packets since they are super common
//we really want to process these as fast as possible
uint8_t *data_stack = &(the_buffer.the_packets[packet_index].data.u_byte[flit_index]);
*(data_stack ) = RD_PIO(RX_0_BASE);
*(data_stack+1) = RD_PIO(RX_1_BASE);
*(data_stack+2) = RD_PIO(RX_2_BASE);
*(data_stack+3) = RD_PIO(RX_3_BASE);
*(data_stack+4) = RD_PIO(RX_4_BASE);
*(data_stack+5) = RD_PIO(RX_5_BASE);
*(data_stack+6) = RD_PIO(RX_6_BASE);
*(data_stack+7) = RD_PIO(RX_7_BASE);
flit_index += 8;
the_buffer.the_packets[packet_index].num_flits = flit_index;
the_buffer.the_packets[packet_index].identifier = id;
the_buffer.the_packets[packet_index].src_addr = 0;
}else{
//default flit parser
WR_PIO(NOC_CTRL_BASE, PARSE_32_BIT_UNSIGNED);
uint32_t flit_top = RD_PIO(RX_0_BASE);
uint32_t flit_bottom = RD_PIO(RX_1_BASE);
uint64_t *flit_stack = &(the_buffer.the_packets[packet_index].data.flit[flit_index++]);
*(uint32_t *)flit_stack = flit_bottom;
*(((uint32_t *)flit_stack)+1) = flit_top;
the_buffer.the_packets[packet_index].num_flits = flit_index;
the_buffer.the_packets[packet_index].identifier = id;
the_buffer.the_packets[packet_index].src_addr = 0;
}
WR_PIO(NOC_CTRL_BASE, 0);
return 1;
}
void set_cpu_read_flag(int value)
{
uint32_t noc_ctrl_value = RD_PIO(NOC_CTRL_BASE);
if( value != 0)
{
noc_ctrl_value |= CPU_RX_CTRL;
}
else
{
noc_ctrl_value &= (~CPU_RX_CTRL);
}
WR_PIO(NOC_CTRL_BASE, noc_ctrl_value);
}
uint32_t get_identifier()
{
return RD_PIO(RX_1_BASE) & 0xFF;
}
uint32_t buffers_loop(uint32_t packet_count)
{
uint32_t id = 0;
uint32_t packets_rxd = 0;
uint32_t packets_rxd_next = 0;
uint32_t infinite_loops = (packet_count==0)?1:0;
uint64_t start;
while(infinite_loops || (packets_rxd < packet_count))
{
int the_state = get_buffer_rx_state();
// if(the_state != BUFFER_IDLE){
// start = read_timer();
// }
switch(the_state){
case BUFFER_IDLE:
packets_rxd = packets_rxd_next;
break;
case BUFFER_ADDR_RST:
set_cpu_read_flag(1);
packets_rxd = packets_rxd_next;
while(get_buffer_rx_state() != BUFFER_START_READ);
break;
case BUFFER_START_READ:
id = get_identifier();
packets_rxd_next += 1;
set_cpu_read_flag(0);
break;
case BUFFER_RXD:
copy_to_buffer(id);
set_cpu_read_flag(1);
break;
case BUFFER_WAIT_CPU:
set_cpu_read_flag(0);
break;
case BUFFER_SEL_VC:
break;
case BUFFER_DEQUEUE:
break;
case BUFFER_WAIT_FLITS:
break;
default:
break;
}
// if(the_state != BUFFER_IDLE){
// add_time(NOC_RECEIVE_COUNTS, read_timer() - start);
// }
}
return 0;
}
void print_rx_buffer(){
for(int i = 0; i < MAX_PACKETS; i++){
printf(" packet[%d]\n", i);
printf(" flits: %d\n",the_buffer.the_packets[i].num_flits);
printf(" identifier: %d\n", the_buffer.the_packets[i].identifier);
//for(int j = 0; j < the_buffer.the_packets[i].num_flits; j++){
// printf(" %016llx\n", the_buffer.the_packets[i].data.flit[j]);
//}
}
}
packet* get_packet_pointer_by_id(uint32_t id){
if(the_buffer.the_packets[id].identifier == id){
return &(the_buffer.the_packets[id]);
}
return (void *)0;
}
packet* rx_packet_by_id_no_block(uint32_t id, uint32_t trys){
if(get_buffer_rx_state() != BUFFER_IDLE){
buffers_loop(trys);
}
return get_packet_pointer_by_id(id);
}
void remove_packet_with_id(int id){
int move_packets = 0;
the_buffer.the_packets[id].num_flits = 0;
the_buffer.the_packets[id].identifier = -1;
return;
}
|
#import <Cocoa/Cocoa.h>
#import "SPGUIController.h"
#import "SPArrayController.h"
@interface SPAppDelegate : NSObject <NSApplicationDelegate, SPGUIControllerDelegate, SPRecordDelegate>
{
}
@property SPGUIController *guiController;
@property NSObjectController *objectController;
@property SPArrayController *arrayController;
- (void)start;
- (void)stop;
- (void)clear;
- (void)toggle;
- (void)save;
- (void)export;
- (NSString *)nameFromStudentID:(NSString *)studentID;
- (NSString *)completeStudentID:(NSString *)brokenIDExp;
- (void)add;
- (void)showTimer;
- (void)unfilter;
- (void)filterPassed;
- (void)filterOne;
- (void)filterTwo;
- (void)filterFour;
- (void)filterUnique;
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@interface _XCMarkerList : NSObject
{
long long _numMarks;
struct CGRect _markRect;
double *_marks;
long long _marksSize;
struct CGRect *_markRects;
long long _numMarkRects;
long long _markRectsSize;
}
- (struct CGRect *)markRectList;
- (long long)numMarkRects;
- (struct CGRect)addMark:(double)arg1;
- (void)clearMarks;
- (struct CGRect)markRect;
- (void)setMarkRect:(struct CGRect)arg1;
- (void)_recomputeMarkRects;
- (void)_mergeMarkRect:(struct CGRect)arg1;
- (struct CGRect)_rectForMark:(double)arg1;
- (void)finalize;
- (void)dealloc;
- (id)initWithSlotRect:(struct CGRect)arg1;
@end
|
#ifndef _TASK_X86_H
#define _TASK_X86_H
#include "task.h"
#include "regs.h"
#include "string.hh"
typedef struct
{
unsigned short link;
unsigned short r_link;
unsigned long esp0;
unsigned short ss0;
unsigned short r_ss0;
unsigned long esp1;
unsigned short ss1;
unsigned short r_ss1;
unsigned long esp2;
unsigned short ss2;
unsigned short r_ss2;
unsigned long cr3;
unsigned long eip;
unsigned long eflags;
unsigned long eax;
unsigned long ecx;
unsigned long edx;
unsigned long ebx;
unsigned long esp;
unsigned long ebp;
unsigned long esi;
unsigned long edi;
unsigned short es;
unsigned short r_es;
unsigned short cs;
unsigned short r_cs;
unsigned short ss;
unsigned short r_ss;
unsigned short ds;
unsigned short r_ds;
unsigned short fs;
unsigned short r_fs;
unsigned short gs;
unsigned short r_gs;
unsigned short ldtr;
unsigned short r_ldtr;
unsigned short r_iopb;
unsigned short iopb;
} task_tss_t;
class TaskX86 : public Task
{
public:
TaskX86();
void init(ptr_val_t addr, ptr_val_t stack, uint32_t flags);
void switchTo(volatile ptr_val_t *lock, ptr_t killer);
int save();
int restore(volatile ptr_val_t *lock);
Task *clone(CloneFlags flags = CLONE_NORMAL);
Task *create(ptr_val_t addr, ptr_val_t stack, uint32_t flags);
void setTss(void *ptr)
{
Mem::copy((void*)&m_tss, ptr, sizeof(task_tss_t));
}
void setEntry(ptr_val_t addr);
task_tss_t m_tss;
class __attribute__((aligned(16))) StateX86 {
public:
union {
uint32_t states[32];
struct {
uint32_t edi;
uint32_t esi;
uint32_t ebx;
uint32_t ebp;
uint32_t esp;
uint32_t eip;
uint32_t fpu_flags;
uint8_t fpu_state[512 + 16] __attribute__((aligned(16)));
} r;
};
} __attribute__((aligned(16)));
StateX86 m_state;
private:
};
#endif
|
// MusicXML Class Library
// Copyright (c) by Matthew James Briggs
// Distributed under the MIT License
#pragma once
#include "mx/core/ForwardDeclare.h"
#include "mx/core/ElementInterface.h"
#include "mx/core/Decimals.h"
#include <iosfwd>
#include <memory>
#include <vector>
namespace mx
{
namespace core
{
MX_FORWARD_DECLARE_ELEMENT( SystemDistance )
inline SystemDistancePtr makeSystemDistance() { return std::make_shared<SystemDistance>(); }
inline SystemDistancePtr makeSystemDistance( const TenthsValue& value ) { return std::make_shared<SystemDistance>( value ); }
inline SystemDistancePtr makeSystemDistance( TenthsValue&& value ) { return std::make_shared<SystemDistance>( std::move( value ) ); }
class SystemDistance : public ElementInterface
{
public:
SystemDistance();
SystemDistance( const TenthsValue& value );
virtual bool hasAttributes() const;
virtual bool hasContents() const;
virtual std::ostream& streamAttributes( std::ostream& os ) const;
virtual std::ostream& streamName( std::ostream& os ) const;
virtual std::ostream& streamContents( std::ostream& os, const int indentLevel, bool& isOneLineOnly ) const;
TenthsValue getValue() const;
void setValue( const TenthsValue& value );
private:
virtual bool fromXElementImpl( std::ostream& message, ::ezxml::XElement& xelement );
private:
TenthsValue myValue;
};
}
}
|
#include <stdio.h>
void output_sum (int sum);
int add_numbers (int a, int b)
{
return a + b;
}
int subtract_numbers (int a, int b)
{
return a - b;
}
int main()
{
int sum;
sum = add_numbers(45, 74);
output_sum(sum);
sum = subtract_numbers(66, 12);
output_sum(sum);
return 0;
}
void output_sum (int sum)
{
printf("%i\n", sum);
}
|
/*
* timer.h
*
* Created on: Dec 7, 2015
* Author: longqi
*/
#ifndef INCL_TIMER_H_
#define INCL_TIMER_H_
#include <DSP2833x_CpuTimers.h>
#include "DSP2833x_Examples.h"
#include "DSP2833x_Device.h"
void configureTimer0();
interrupt void cpu_timer0_isr(void);
extern float32 heartbeat;
#endif /* INCL_TIMER_H_ */
|
/* ###################################################################
** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : CsIO1.h
** Project : FreeRTOS_buttons
** Processor : MKL46Z256VLL4
** Component : ConsoleIO
** Version : Component 01.016, Driver 01.00, CPU db: 3.00.000
** Compiler : GNU C Compiler
** Date/Time : 2014-08-21, 17:17, # CodeGen: 1
** Abstract :
** This component generates low-level methods for redirecting console I/O to the selected UART.
** These methods are typically used by printf()/scanf() methods.
** Settings :
** Component name : CsIO1
** Serial_LDD_Link : ConsoleIO_Serial_LDD
** Contents :
** No public methods
**
** Copyright : 1997 - 2014 Freescale Semiconductor, 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:
**
** o Redistributions of source code must retain the above copyright notice, this list
** of conditions and the following disclaimer.
**
** o 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.
**
** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
** contributors may be used to endorse or promote products derived from this
** software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED 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 HOLDER 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.
**
** http: www.freescale.com
** mail: support@freescale.com
** ###################################################################*/
/*!
** @file CsIO1.h
** @version 01.00
** @brief
** This component generates low-level methods for redirecting console I/O to the selected UART.
** These methods are typically used by printf()/scanf() methods.
*/
/*!
** @addtogroup CsIO1_module CsIO1 module documentation
** @{
*/
#ifndef __CsIO1
#define __CsIO1
#include "stdio.h"
/* END CsIO1. */
#endif
/* ifndef __CsIO1_Types_H */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.4 [05.10]
** for the Freescale Kinetis series of microcontrollers.
**
** ###################################################################
*/
|
// 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.
// The use and distribution terms for this software are covered by the Eclipse
// Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
// can be found in the file epl-v10.html at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by the
// terms of this license. You must not remove this notice, or any other, from
// this software.
// Copyright (c) 2013-2016, Kenneth Leung. All rights reserved.
#pragma once
//////////////////////////////////////////////////////////////////////////////
#include "GEngine.h"
NS_BEGIN(dttower)
//////////////////////////////////////////////////////////////////////////////
//
class CC_DLL Resolve : public ecs::System {
__decl_ptr(ecs::Node, _shared)
void process(float);
public:
__decl_sys_priority( ecs::Resolve)
__decl_sys_tpid("n/Resolve")
__decl_sys_preamble()
__decl_sys_update()
Resolve(ecs::Engine *e)
: System(e)
{}
};
NS_END
|
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cmplx_dot_prod_q15.c
* Description: Processing function for the Q15 Complex Dot product
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arm_math.h"
/**
@ingroup groupCmplxMath
*/
/**
@addtogroup cmplx_dot_prod
@{
*/
/**
@brief Q15 complex dot product.
@param[in] pSrcA points to the first input vector
@param[in] pSrcB points to the second input vector
@param[in] numSamples number of samples in each vector
@param[out] realResult real part of the result returned here
@param[out] imagResult imaginary part of the result returned her
@return none
@par Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator.
The intermediate 1.15 by 1.15 multiplications are performed with full precision and yield a 2.30 result.
These are accumulated in a 64-bit accumulator with 34.30 precision.
As a final step, the accumulators are converted to 8.24 format.
The return results <code>realResult</code> and <code>imagResult</code> are in 8.24 format.
*/
void arm_cmplx_dot_prod_q15(
const q15_t * pSrcA,
const q15_t * pSrcB,
uint32_t numSamples,
q31_t * realResult,
q31_t * imagResult)
{
uint32_t blkCnt; /* Loop counter */
q63_t real_sum = 0, imag_sum = 0; /* Temporary result variables */
q15_t a0,b0,c0,d0;
#if defined (ARM_MATH_LOOPUNROLL)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = numSamples >> 2U;
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = numSamples % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = numSamples;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
a0 = *pSrcA++;
b0 = *pSrcA++;
c0 = *pSrcB++;
d0 = *pSrcB++;
real_sum += (q31_t)a0 * c0;
imag_sum += (q31_t)a0 * d0;
real_sum -= (q31_t)b0 * d0;
imag_sum += (q31_t)b0 * c0;
/* Decrement loop counter */
blkCnt--;
}
/* Store real and imaginary result in 8.24 format */
/* Convert real data in 34.30 to 8.24 by 6 right shifts */
*realResult = (q31_t) (real_sum >> 6);
/* Convert imaginary data in 34.30 to 8.24 by 6 right shifts */
*imagResult = (q31_t) (imag_sum >> 6);
}
/**
@} end of cmplx_dot_prod group
*/
|
/*
* File name: UnionStringSwitchPath
* File type: Body file.
* Date : 14th February 2006
* Author: Toms Aguado Gmez taguado@gsyc.escet.urjc.es>
*/
/*
// (C) Copyright 2009 Telefonica Investigacion y Desarrollo
*
// S.A.Unipersonal (Telefonica I+D)
//
// This file is part of Morfeo CORBA Platform.
//
// Morfeo CORBA Platform is free software: you can redistribute it and/or
// modify it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// Morfeo CORBA Platform 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Morfeo CORBA Platform. If not, see
//
// http://www.gnu.org/licenses
//
// Info about members and contributors of the MORFEO project
// is available at
//
// http://morfeo-project.org
*/
/*
* Revision historial:
* - 04/19/2006, by Alvaro Polo <apoloval@gsyc.escet.urjc.es>:
* * Added 'copy()' as new virtual method for EvaluableNode children.
* - 23/10/2008, by Alvaro Vega Garcia <avega at tid dot es>:
* * Removed unnecessary _var templates in declarations
*/
#ifndef _TIDUTIL_UNION_STRING_SWITCH_PATH_H
#define _TIDUTIL_UNION_STRING_SWITCH_PATH_H
#include <string>
#include <DynamicAny.h>
#include "SequencePath.h"
#include "TypeValuePair.h"
namespace TIDNotif{
namespace util{
namespace parser{
#ifdef HAVE_STD_NAMESPACE
using namespace std;
#endif
/*!
*
* \brief Struct field name sequence path class.
*
* This class represents a sequence path's step for a
* struct field name.
*/
class UnionStringSwitchPath : public SequencePath
{
public:
/*!
* \brief Default constructor.
* \param next_step Next step in sequence path.
*/
UnionStringSwitchPath(SequencePath * next_step, const string switch_val);
/*!
* \brief Extract associated value from a Dynamic Any.
*
* Extract a value for this sequence step from a dynamic any.
*
* \param from Source dynamic any to be value-extracted.
* \param value Value extracted from source.
*/
virtual void extract_from_dynany(const DynamicAny::DynAny_ptr& from,
DynamicAny::DynAny_ptr& value) const
throw (BadTypeException);
/*!
* \brief Set field name.
* \param field_name New field name.
*/
void set_switch_value(const string switch_val);
/*!
* \brief Get field name.
* \param return Field name.
*/
const string get_switch_value() const;
/*!
* \brief Copy this node.
*/
virtual EvaluableNode * copy() const;
private:
/*!
* \brief Field name.
*/
string switch_value;
};
} /* End of namespace util. */
} /* End of namespace parser. */
} /* End of namespace TIDNotif. */
#endif
|
/** \file padding_encoding.h \brief Content padding
*
* $Author: peltotal $ $Date: 2007/02/28 08:58:01 $ $Revision: 1.10 $
*
* MAD-FLUTELIB: Implementation of FLUTE protocol.
* Copyright (c) 2003-2007 TUT - Tampere University of Technology
* main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi
*
* 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
*
* In addition, as a special exception, TUT - Tampere University of Technology
* gives permission to link the code of this program with the OpenSSL library (or
* with modified versions of OpenSSL that use the same license as OpenSSL), and
* distribute linked combinations including the two. You must obey the GNU
* General Public License in all respects for all of the code used other than
* OpenSSL. If you modify this file, you may extend this exception to your version
* of the file, but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version.
*/
#ifndef _PADDING_ENCODING_H_
#define _PADDING_ENCODING_H_
#include "flute_defines.h"
#include "../alclib/defines.h"
/**
* This function calculates the amount of needed padding.
*
* @param f_size the size of the file to be padded
* @param block_len number of encoding symbols per block
* @param es_len encoding symbol length in bytes
*
* @return the amount of needed padding in bytes, 0 when padding is not needed
*
*/
int compute_padding_length(unsigned long long f_size, int block_len, int es_len);
/**
* This function removes padding from the given file and renames file (removes ~pad extension).
*
* @param file_name name of the file to be "unpadded"
* @param content_length length of the file to be "unpadded"
*
* @return 0 in success, -1 otherwise
*
*/
int padding_decoder(char *file_name, unsigned long long content_length);
#endif
|
#if (__cplusplus)
extern "C" {
#endif
void neoscrypt(const unsigned char *input, unsigned char *output,
unsigned int profile);
void neoscrypt_blake2s(const void *input, const unsigned int input_size,
const void *key, const unsigned char key_size,
void *output, const unsigned char output_size);
void neoscrypt_copy(void *dstp, const void *srcp, unsigned int len);
void neoscrypt_erase(void *dstp, unsigned int len);
void neoscrypt_xor(void *dstp, const void *srcp, unsigned int len);
#if (ASM) && (MINER_4WAY)
void neoscrypt_4way(const unsigned char *input, unsigned char *output,
unsigned int profile);
#endif
#if (__cplusplus)
}
#else
#if (WINDOWS) && (__APPLE__)
/* sizeof(unsigned long) = 4 for MinGW64 and Mac GCC */
typedef unsigned long long ulong;
#else
typedef unsigned long ulong;
#endif
typedef unsigned int uint;
typedef unsigned char uchar;
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? a : b)
#endif
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? a : b)
#endif
#define SCRYPT_BLOCK_SIZE 64
#define SCRYPT_HASH_BLOCK_SIZE 64
#define SCRYPT_HASH_DIGEST_SIZE 32
typedef uchar hash_digest[SCRYPT_HASH_DIGEST_SIZE];
#define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b)))
#define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b)))
#define U8TO32_BE(p) \
(((uint)((p)[0]) << 24) | ((uint)((p)[1]) << 16) | \
((uint)((p)[2]) << 8) | ((uint)((p)[3])))
#define U32TO8_BE(p, v) \
(p)[0] = (uchar)((v) >> 24); (p)[1] = (uchar)((v) >> 16); \
(p)[2] = (uchar)((v) >> 8); (p)[3] = (uchar)((v) );
#define U64TO8_BE(p, v) \
U32TO8_BE((p), (uint)((v) >> 32)); \
U32TO8_BE((p) + 4, (uint)((v) ));
#endif
|
/*=========================================================================
Compatibility headers for Z88DK
GFX - a small graphics library
Copyright (C) 2004 Rafael de Oliveira Jannone
Contact the author:
by e-mail : rafael AT jannone DOT org
homepage : http://jannone.org/gfxlib
ICQ UIN : 10115284
$Id: defs.h,v 1.4 2009/04/15 21:00:57 stefano Exp $
=========================================================================*/
/*! \file defs.h
\brief basic definitions and utilities
*/
// DEFS.H : shared defines
#ifndef MSXDEFS_H
#define MSXDEFS_H
#include <math.h>
#include <malloc.h>
// HTC compatibility
#define putch(chr) fputc_cons(chr)
// trivial stuff
#define u_int unsigned int
#define u_char unsigned char
#ifndef bool
#define bool char
#endif
#ifndef true
#define true 1
#endif
#ifndef false
#define false 0
#endif
#ifndef NULL
#define NULL 0
#endif
// malloc helpers
/// allocates space for 1 element of type \a x
#define new(x) ((x*)malloc(sizeof(x)))
/// allocates space for \a c elements of type \a x
#define newa(x, c) ((x*)malloc(sizeof(x) * c))
#endif
|
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: definitions for SDO Abort codes
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdoAc.h,v $
$Author: lance $
$Revision: #1 $ $Date: 2012/09/27 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
2006/06/30 k.t.: first implementation
****************************************************************************/
#ifndef _EPLSDOAC_H_
#define _EPLSDOAC_H_
// =========================================================================
// SDO abort codes
// =========================================================================
#define EPL_SDOAC_TIME_OUT 0x05040000L
#define EPL_SDOAC_UNKNOWN_COMMAND_SPECIFIER 0x05040001L
#define EPL_SDOAC_INVALID_BLOCK_SIZE 0x05040002L
#define EPL_SDOAC_INVALID_SEQUENCE_NUMBER 0x05040003L
#define EPL_SDOAC_OUT_OF_MEMORY 0x05040005L
#define EPL_SDOAC_UNSUPPORTED_ACCESS 0x06010000L
#define EPL_SDOAC_READ_TO_WRITE_ONLY_OBJ 0x06010001L
#define EPL_SDOAC_WRITE_TO_READ_ONLY_OBJ 0x06010002L
#define EPL_SDOAC_OBJECT_NOT_EXIST 0x06020000L
#define EPL_SDOAC_OBJECT_NOT_MAPPABLE 0x06040041L
#define EPL_SDOAC_PDO_LENGTH_EXCEEDED 0x06040042L
#define EPL_SDOAC_GEN_PARAM_INCOMPATIBILITY 0x06040043L
#define EPL_SDOAC_INVALID_HEARTBEAT_DEC 0x06040044L
#define EPL_SDOAC_GEN_INTERNAL_INCOMPATIBILITY 0x06040047L
#define EPL_SDOAC_ACCESS_FAILED_DUE_HW_ERROR 0x06060000L
#define EPL_SDOAC_DATA_TYPE_LENGTH_NOT_MATCH 0x06070010L
#define EPL_SDOAC_DATA_TYPE_LENGTH_TOO_HIGH 0x06070012L
#define EPL_SDOAC_DATA_TYPE_LENGTH_TOO_LOW 0x06070013L
#define EPL_SDOAC_SUB_INDEX_NOT_EXIST 0x06090011L
#define EPL_SDOAC_VALUE_RANGE_EXCEEDED 0x06090030L
#define EPL_SDOAC_VALUE_RANGE_TOO_HIGH 0x06090031L
#define EPL_SDOAC_VALUE_RANGE_TOO_LOW 0x06090032L
#define EPL_SDOAC_MAX_VALUE_LESS_MIN_VALUE 0x06090036L
#define EPL_SDOAC_GENERAL_ERROR 0x08000000L
#define EPL_SDOAC_DATA_NOT_TRANSF_OR_STORED 0x08000020L
#define EPL_SDOAC_DATA_NOT_TRANSF_DUE_LOCAL_CONTROL 0x08000021L
#define EPL_SDOAC_DATA_NOT_TRANSF_DUE_DEVICE_STATE 0x08000022L
#define EPL_SDOAC_OBJECT_DICTIONARY_NOT_EXIST 0x08000023L
#define EPL_SDOAC_CONFIG_DATA_EMPTY 0x08000024L
#endif // _EPLSDOAC_H_
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).
|
/*
* This test file is used to verify that the header files associated with
* invoking this function are correct.
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <pthread.h>
#ifndef _POSIX_THREADS
#error "rtems is supposed to have pthread_attr_destroy"
#endif
int test( void );
int test( void )
{
pthread_attr_t attribute;
int result;
result = pthread_attr_destroy( &attribute );
return result;
}
|
/*
* region.c --- code which manages allocations within a region.
*
* Copyright (C) 2001 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#include "config.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#ifdef TEST_PROGRAM
#undef ENABLE_NLS
#endif
#include "e2fsck.h"
struct region_el {
region_addr_t start;
region_addr_t end;
struct region_el *next;
};
struct region_struct {
region_addr_t min;
region_addr_t max;
struct region_el *allocated;
};
region_t region_create(region_addr_t min, region_addr_t max)
{
region_t region;
region = malloc(sizeof(struct region_struct));
if (!region)
return NULL;
memset(region, 0, sizeof(struct region_struct));
region->min = min;
region->max = max;
return region;
}
void region_free(region_t region)
{
struct region_el *r, *next;
for (r = region->allocated; r; r = next) {
next = r->next;
free(r);
}
memset(region, 0, sizeof(struct region_struct));
free(region);
}
int region_allocate(region_t region, region_addr_t start, int n)
{
struct region_el *r, *new_region, *prev, *next;
region_addr_t end;
end = start+n;
if ((start < region->min) || (end > region->max))
return -1;
if (n == 0)
return 1;
/*
* Search through the linked list. If we find that it
* conflicts witih something that's already allocated, return
* 1; if we can find an existing region which we can grow, do
* so. Otherwise, stop when we find the appropriate place
* insert a new region element into the linked list.
*/
for (r = region->allocated, prev=NULL; r; prev = r, r = r->next) {
if (((start >= r->start) && (start < r->end)) ||
((end > r->start) && (end <= r->end)) ||
((start <= r->start) && (end >= r->end)))
return 1;
if (end == r->start) {
r->start = start;
return 0;
}
if (start == r->end) {
if ((next = r->next)) {
if (end > next->start)
return 1;
if (end == next->start) {
r->end = next->end;
r->next = next->next;
free(next);
return 0;
}
}
r->end = end;
return 0;
}
if (start < r->start)
break;
}
/*
* Insert a new region element structure into the linked list
*/
new_region = malloc(sizeof(struct region_el));
if (!new_region)
return -1;
new_region->start = start;
new_region->end = start + n;
new_region->next = r;
if (prev)
prev->next = new_region;
else
region->allocated = new_region;
return 0;
}
#ifdef TEST_PROGRAM
#include <stdio.h>
#define BCODE_END 0
#define BCODE_CREATE 1
#define BCODE_FREE 2
#define BCODE_ALLOCATE 3
#define BCODE_PRINT 4
int bcode_program[] = {
BCODE_CREATE, 1, 1001,
BCODE_PRINT,
BCODE_ALLOCATE, 10, 10,
BCODE_ALLOCATE, 30, 10,
BCODE_PRINT,
BCODE_ALLOCATE, 1, 15,
BCODE_ALLOCATE, 15, 8,
BCODE_ALLOCATE, 1, 20,
BCODE_ALLOCATE, 1, 8,
BCODE_PRINT,
BCODE_ALLOCATE, 40, 10,
BCODE_PRINT,
BCODE_ALLOCATE, 22, 5,
BCODE_PRINT,
BCODE_ALLOCATE, 27, 3,
BCODE_PRINT,
BCODE_ALLOCATE, 20, 2,
BCODE_PRINT,
BCODE_ALLOCATE, 49, 1,
BCODE_ALLOCATE, 50, 5,
BCODE_ALLOCATE, 9, 2,
BCODE_ALLOCATE, 9, 1,
BCODE_PRINT,
BCODE_FREE,
BCODE_END
};
void region_print(region_t region, FILE *f)
{
struct region_el *r;
int i = 0;
fprintf(f, "Printing region (min=%d. max=%d)\n\t", region->min,
region->max);
for (r = region->allocated; r; r = r->next) {
fprintf(f, "(%d, %d) ", r->start, r->end);
if (++i >= 8)
fprintf(f, "\n\t");
}
fprintf(f, "\n");
}
int main(int argc, char **argv)
{
region_t r;
int pc = 0, ret;
region_addr_t start, end;
while (1) {
switch (bcode_program[pc++]) {
case BCODE_END:
exit(0);
case BCODE_CREATE:
start = bcode_program[pc++];
end = bcode_program[pc++];
printf("Creating region with args(%d, %d)\n",
start, end);
r = region_create(start, end);
if (!r) {
fprintf(stderr, "Couldn't create region.\n");
exit(1);
}
break;
case BCODE_ALLOCATE:
start = bcode_program[pc++];
end = bcode_program[pc++];
ret = region_allocate(r, start, end);
printf("Region_allocate(%d, %d) returns %d\n",
start, end, ret);
break;
case BCODE_PRINT:
region_print(r, stdout);
break;
}
}
}
#endif /* TEST_PROGRAM */
|
/* Copyright 2009,2010 Klarälvdalens Datakonsult AB
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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAILIMPORTER_FILTER_KMAIL_ARCHIVE_HXX
#define MAILIMPORTER_FILTER_KMAIL_ARCHIVE_HXX
#include "filters.h"
class KArchiveFile;
class KArchiveDirectory;
namespace MailImporter {
class MAILIMPORTER_EXPORT FilterKMailArchive : public Filter
{
public:
explicit FilterKMailArchive();
~FilterKMailArchive();
void import();
void importMails( const QString & archiveFile );
private:
bool importDirectory( const KArchiveDirectory *directory, const QString &folderPath );
bool importFolder( const KArchiveDirectory *folder, const QString &folderPath );
bool importMessage( const KArchiveFile *file, const QString &folderPath );
int countFiles( const KArchiveDirectory *directory ) const;
int mTotalFiles;
int mFilesDone;
};
}
#endif
|
/* Copyright 2004-2006, 2012 Theo Berkau
This file is part of EventEditor.
EventEditor 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.
EventEditor 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 EventEditor; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// All sorts of annoying functions that make my life easier
#include <windows.h>
#include <stdio.h>
#include "util.h"
//////////////////////////////////////////////////////////////////////////////
int round(float x)
{
if (x - ((int)x) < 0.5)
{
return((int)x);
}
else
{
return ((int)(x+1));
}
}
//////////////////////////////////////////////////////////////////////////////
unsigned short WordSwap(unsigned short data)
{
return (((data & 0xFF00) >> 8) + ((data & 0x00FF) << 8));
}
//////////////////////////////////////////////////////////////////////////////
void WordSwapPtr(unsigned short *var)
{
var[0] = WordSwap(var[0]);
}
//////////////////////////////////////////////////////////////////////////////
unsigned long DoubleWordSwap(unsigned long data)
{
return (((data & 0xFF000000) >> 24) +
((data & 0x00FF0000) >> 8) +
((data & 0x0000FF00) << 8) +
((data & 0x000000FF) << 24));
}
//////////////////////////////////////////////////////////////////////////////
void DoubleWordSwapPtr(unsigned long *var)
{
var[0] = DoubleWordSwap(var[0]);
}
//////////////////////////////////////////////////////////////////////////////
int ReallocMem(void **data, int data_size, int *max_data, int index)
{
if (index >= max_data[0])
{
void *temp;
int old_max_data=max_data[0];
if (max_data[0] == 0)
{
max_data[0] = 10;
if (index > max_data[0])
max_data[0] = index * 2;
if ((data[0] = malloc(data_size * max_data[0])) == NULL)
return FALSE;
return TRUE;
}
max_data[0] = index * 2;
if ((temp = malloc(data_size * max_data[0])) == NULL)
return FALSE;
if (data[0] != NULL)
{
memcpy(temp, data[0], data_size * old_max_data);
free(data[0]);
}
data[0] = temp;
}
return TRUE;
}
|
/*
* TI's Davinci platform specific USB wrapper functions.
*
* Copyright (c) 2008 Texas Instruments
*
* 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
*
* Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
*/
#include <common.h>
#include <asm/io.h>
#include "davinci.h"
#include <asm/arch/hardware.h>
/* MUSB platform configuration */
struct musb_config musb_cfg = {
.regs = (struct musb_regs *)MENTOR_USB0_BASE,
.timeout = DAVINCI_USB_TIMEOUT,
.musb_speed = 0,
};
/* MUSB module register overlay */
struct davinci_usb_regs *dregs;
/*
* Enable the USB phy
*/
static u8 phy_on(void)
{
u32 timeout;
#ifdef DAVINCI_DM365EVM
u32 val;
#endif
/* Wait until the USB phy is turned on */
#ifdef DAVINCI_DM365EVM
writel(USBPHY_PHY24MHZ | USBPHY_SESNDEN |
USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
#else
writel(USBPHY_SESNDEN | USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
#endif
timeout = musb_cfg.timeout;
#ifdef DAVINCI_DM365EVM
/* Set the ownership of GIO33 to USB */
val = readl(PINMUX4);
val &= ~(PINMUX4_USBDRVBUS_BITCLEAR);
val |= PINMUX4_USBDRVBUS_BITSET;
writel(val, PINMUX4);
#endif
while (timeout--)
if (readl(USBPHY_CTL_PADDR) & USBPHY_PHYCLKGD)
return 1;
/* USB phy was not turned on */
return 0;
}
/*
* Disable the USB phy
*/
static void phy_off(void)
{
/* powerdown the on-chip PHY and its oscillator */
writel(USBPHY_OSCPDWN | USBPHY_PHYPDWN, USBPHY_CTL_PADDR);
}
/*
* This function performs Davinci platform specific initialization for usb0.
*/
int musb_platform_init(void)
{
u32 revision;
/* enable USB VBUS */
#if !defined(DAVINCI_DM365EVM) && !defined(DAVINCI_BASI)
enable_vbus();
#endif
/* start the on-chip USB phy and its pll */
if (!phy_on())
return -1;
/* reset the controller */
dregs = (struct davinci_usb_regs *)DAVINCI_USB0_BASE;
writel(1, &dregs->ctrlr);
udelay(5000);
/* Returns zero if e.g. not clocked */
revision = readl(&dregs->version);
if (!revision)
return -1;
/* Disable all interrupts */
writel(DAVINCI_USB_USBINT_MASK | DAVINCI_USB_RXINT_MASK |
DAVINCI_USB_TXINT_MASK , &dregs->intmsksetr);
return 0;
}
/*
* This function performs Davinci platform specific deinitialization for usb0.
*/
void musb_platform_deinit(void)
{
/* Turn of the phy */
phy_off();
/* flush any interrupts */
writel(DAVINCI_USB_USBINT_MASK | DAVINCI_USB_TXINT_MASK |
DAVINCI_USB_RXINT_MASK , &dregs->intclrr);
}
|
/*
* GrandOrgue - free pipe organ simulator
*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2015 GrandOrgue contributors (see AUTHORS)
*
* 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 GOSOUNDSAMPLERLIST_H
#define GOSOUNDSAMPLERLIST_H
#include "GOSoundSampler.h"
#include "GOLock.h"
class GOSoundSamplerList
{
private:
std::atomic<GO_SAMPLER*> m_GetList;
std::atomic<GO_SAMPLER*> m_PutList;
std::atomic_uint m_PutCount;
public:
GOSoundSamplerList()
{
Clear();
}
void Clear()
{
m_GetList = 0;
m_PutList = 0;
m_PutCount = 0;
}
GO_SAMPLER* Peek()
{
return m_GetList;
}
GO_SAMPLER* Get()
{
do
{
GO_SAMPLER* sampler = m_GetList;
if (!sampler)
return NULL;
GO_SAMPLER* next = sampler->next;
if (m_GetList.compare_exchange_strong(sampler, next))
return sampler;
}
while(true);
}
void Put(GO_SAMPLER* sampler)
{
do
{
GO_SAMPLER* current = m_PutList;
sampler->next = current;
if (m_PutList.compare_exchange_strong(current, sampler))
{
m_PutCount.fetch_add(1);
return;
}
}
while(true);
}
unsigned GetCount()
{
return m_PutCount;
}
void Move()
{
GO_SAMPLER* sampler;
do
{
sampler = m_PutList;
if (m_PutList.compare_exchange_strong(sampler, NULL))
break;
}
while(true);
m_PutCount.exchange(0);
if (!sampler)
return;
do
{
GO_SAMPLER* current = m_GetList;
GO_SAMPLER* next = sampler;
if (current)
{
while(next)
{
if (next->next)
next = next->next;
else
{
next->next = current;
break;
}
}
}
if (m_GetList.compare_exchange_strong(current, sampler))
return;
if (next)
next->next = NULL;
}
while(true);
}
};
#endif
|
#ifndef _TSFileVersionInfo_H_
#define _TSFileVersionInfo_H_
#include "Constants.h"
class TSFileVersionInfo
{
public:
TSFileVersionInfo();
~TSFileVersionInfo();
bool Open(const wchar_t* p_file_path);
wchar_t* GetFileDescription();
wchar_t* GetInternelName();
wchar_t* GetLegalTradeMarks();
wchar_t* GetOriginalFileName();
wchar_t* GetProductName();
wchar_t* GetProductVersion();
wchar_t* QueryValue(const wchar_t* p_value_name);
int GetIconIndex(const wchar_t* p_file_name);
void Close();
private:
byte* m_p_version_data;
};
#endif
|
/*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
* Copyright (c) 2010-2012, Code Aurora Forum. 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/kernel.h>
#include <linux/init.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/hardware/gic.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/mach-types.h>
#include <asm/smp_plat.h>
#include <mach/socinfo.h>
#include <mach/hardware.h>
#include <mach/msm_iomap.h>
#include "pm.h"
#include "scm-boot.h"
#include "spm.h"
#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0
#define SCSS_CPU1CORE_RESET 0xD80
#define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64
extern void msm_secondary_startup(void);
#define CPU0_EXIT_KERNEL_COUNTER_BASE (MSM_KERNEL_FOOTPRINT_BASE + 0x10)
#define CPU1_EXIT_KERNEL_COUNTER_BASE (MSM_KERNEL_FOOTPRINT_BASE + 0x14)
#define CPU2_EXIT_KERNEL_COUNTER_BASE (MSM_KERNEL_FOOTPRINT_BASE + 0x18)
#define CPU3_EXIT_KERNEL_COUNTER_BASE (MSM_KERNEL_FOOTPRINT_BASE + 0x1C)
static void init_cpu_debug_counter_for_cold_boot(void)
{
/* *(unsigned *)CPU0_EXIT_KERNEL_COUNTER_BASE = 0x0;
*(unsigned *)CPU1_EXIT_KERNEL_COUNTER_BASE = 0x0;
*(unsigned *)CPU2_EXIT_KERNEL_COUNTER_BASE = 0x0;
*(unsigned *)CPU3_EXIT_KERNEL_COUNTER_BASE = 0x0;*/
mb();
}
volatile int pen_release = -1;
static DEFINE_SPINLOCK(boot_lock);
void __cpuinit platform_secondary_init(unsigned int cpu)
{
WARN_ON(msm_platform_secondary_init(cpu));
gic_secondary_init(0);
spin_lock(&boot_lock);
spin_unlock(&boot_lock);
}
static int __cpuinit scorpion_release_secondary(void)
{
void *base_ptr = ioremap_nocache(0x00902000, SZ_4K*2);
if (!base_ptr)
return -EINVAL;
writel_relaxed(0, base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
dmb();
writel_relaxed(0, base_ptr + SCSS_CPU1CORE_RESET);
writel_relaxed(3, base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP);
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit krait_release_secondary_sim(unsigned long base, int cpu)
{
void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K);
if (!base_ptr)
return -ENODEV;
if (machine_is_msm8960_sim() || machine_is_msm8960_rumi3()) {
writel_relaxed(0x10, base_ptr+0x04);
writel_relaxed(0x80, base_ptr+0x04);
}
if (machine_is_apq8064_sim())
writel_relaxed(0xf0000, base_ptr+0x04);
if (machine_is_msm8974_sim()) {
writel_relaxed(0x800, base_ptr+0x04);
writel_relaxed(0x3FFF, base_ptr+0x14);
}
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit krait_release_secondary(unsigned long base, int cpu)
{
void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K);
if (!base_ptr)
return -ENODEV;
msm_spm_turn_on_cpu_rail(cpu);
writel_relaxed(0x109, base_ptr+0x04);
writel_relaxed(0x101, base_ptr+0x04);
ndelay(300);
writel_relaxed(0x121, base_ptr+0x04);
udelay(2);
writel_relaxed(0x020, base_ptr+0x04);
udelay(2);
writel_relaxed(0x000, base_ptr+0x04);
udelay(100);
writel_relaxed(0x080, base_ptr+0x04);
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit release_secondary(unsigned int cpu)
{
BUG_ON(cpu >= get_core_count());
if (cpu_is_msm8x60())
return scorpion_release_secondary();
if (machine_is_msm8960_sim() || machine_is_msm8960_rumi3() ||
machine_is_apq8064_sim())
return krait_release_secondary_sim(0x02088000, cpu);
if (machine_is_msm8974_sim())
return krait_release_secondary_sim(0xf9088000, cpu);
if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
cpu_is_apq8064() || cpu_is_msm8627() || cpu_is_apq8064ab())
return krait_release_secondary(0x02088000, cpu);
WARN(1, "unknown CPU case in release_secondary\n");
return -EINVAL;
}
DEFINE_PER_CPU(int, cold_boot_done);
static int cold_boot_flags[] = {
0,
SCM_FLAG_COLDBOOT_CPU1,
SCM_FLAG_COLDBOOT_CPU2,
SCM_FLAG_COLDBOOT_CPU3,
};
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
{
int ret;
int flag = 0;
unsigned long timeout;
pr_debug("Starting secondary CPU %d\n", cpu);
preset_lpj = loops_per_jiffy;
if (cpu > 0 && cpu < ARRAY_SIZE(cold_boot_flags))
flag = cold_boot_flags[cpu];
else
__WARN();
if (per_cpu(cold_boot_done, cpu) == false) {
ret = scm_set_boot_addr((void *)
virt_to_phys(msm_secondary_startup),
flag);
if (ret == 0)
release_secondary(cpu);
else
printk(KERN_DEBUG "Failed to set secondary core boot "
"address\n");
per_cpu(cold_boot_done, cpu) = true;
init_cpu_debug_counter_for_cold_boot();
}
spin_lock(&boot_lock);
pen_release = cpu_logical_map(cpu);
__cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
gic_raise_softirq(cpumask_of(cpu), 1);
timeout = jiffies + (1 * HZ);
while (time_before(jiffies, timeout)) {
smp_rmb();
if (pen_release == -1)
break;
dmac_inv_range((void *)&pen_release,
(void *)(&pen_release+sizeof(pen_release)));
udelay(10);
}
spin_unlock(&boot_lock);
return pen_release != -1 ? -ENOSYS : 0;
}
void __init smp_init_cpus(void)
{
unsigned int i, ncores = get_core_count();
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}
for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);
set_smp_cross_call(gic_raise_softirq);
}
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
{
}
|
/*
* ha1b.analogfunction.h - analog function header
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
*/
#ifndef __ha1b_ANALOGFUNCTION_H__
#define __ha1b_ANALOGFUNCTION_H__
#endif /* __ha1b_ANALOGFUNCTION_H__ */
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#if defined(TARGET_WINDOWS)
#define HAVE_PERIPHERAL_BUS_USB 1
#include "win32/PeripheralBusUSB.h"
#elif defined(TARGET_LINUX) && defined(HAVE_LIBUDEV)
#define HAVE_PERIPHERAL_BUS_USB 1
#include "linux/PeripheralBusUSBLibUdev.h"
#elif defined(TARGET_LINUX) && defined(HAVE_LIBUSB)
#define HAVE_PERIPHERAL_BUS_USB 1
#include "linux/PeripheralBusUSBLibUSB.h"
#elif defined(TARGET_FREEBSD) && defined(HAVE_LIBUSB)
#define HAVE_PERIPHERAL_BUS_USB 1
#include "linux/PeripheralBusUSBLibUSB.h"
#elif defined(TARGET_DARWIN)
#define HAVE_PERIPHERAL_BUS_USB 1
#include "osx/PeripheralBusUSB.h"
#elif defined(TARGET_ANDROID)
#endif
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/StoreServices.framework/StoreServices
*/
#import <StoreServices/SSCoding.h>
#import <StoreServices/XXUnknownSuperclass.h>
@class NSString, NSURL, NSDictionary, NSData;
@interface SSURLConnectionResponse : XXUnknownSuperclass <SSCoding> {
@private
NSDictionary *_allHeaderFields; // 4 = 0x4
NSData *_body; // 8 = 0x8
long long _expectedContentLength; // 12 = 0xc
NSString *_mimeType; // 20 = 0x14
int _statusCode; // 24 = 0x18
NSString *_suggestedFilename; // 28 = 0x1c
NSString *_textEncodingName; // 32 = 0x20
NSURL *_url; // 36 = 0x24
}
@property(readonly, assign, nonatomic) NSURL *URL; // G=0x2d95d; @synthesize=_url
@property(readonly, assign, nonatomic) NSString *textEncodingName; // G=0x2d94d; @synthesize=_textEncodingName
@property(readonly, assign, nonatomic) NSString *suggestedFilename; // G=0x2d93d; @synthesize=_suggestedFilename
@property(readonly, assign, nonatomic) NSString *MIMEType; // G=0x2d92d; @synthesize=_mimeType
@property(readonly, assign, nonatomic) long long expectedContentLength; // G=0x2d915; @synthesize=_expectedContentLength
@property(readonly, assign, nonatomic) NSData *bodyData; // G=0x2d905; @synthesize=_body
@property(readonly, retain) NSDictionary *allHeaderFields; // G=0x2d8bd; converted property
@property(readonly, assign) int statusCode; // G=0x2d8f5; converted property
// declared property getter: - (id)URL; // 0x2d95d
// declared property getter: - (id)textEncodingName; // 0x2d94d
// declared property getter: - (id)suggestedFilename; // 0x2d93d
// declared property getter: - (id)MIMEType; // 0x2d92d
// declared property getter: - (long long)expectedContentLength; // 0x2d915
// declared property getter: - (id)bodyData; // 0x2d905
// converted property getter: - (int)statusCode; // 0x2d8f5
// converted property getter: - (id)allHeaderFields; // 0x2d8bd
- (id)initWithXPCEncoding:(void *)xpcencoding; // 0x2d881
- (id)initWithPropertyListEncoding:(id)propertyListEncoding; // 0x2d6b9
- (void *)copyXPCEncoding; // 0x2d685
- (id)copyPropertyListEncoding; // 0x2d511
- (void)dealloc; // 0x2d461
- (id)initWithURLResponse:(id)urlresponse bodyData:(id)data; // 0x2d2e9
@end
|
/* gnuboy4cute
*
* Copyright (C) 2010 Summeli <summeli@summeli.fi>
*
* 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 CONTROLSETTINGS_H
#define CONTROLSETTINGS_H
#include <QtGui/QWidget>
#include "ui_controlsettings.h"
class controlsettings : public QWidget
{
Q_OBJECT
public:
controlsettings( QWidget *parent = 0);
~controlsettings();
public slots:
void keyConfig();
signals:
void runkeyconfig();
private:
Ui::controlsettingsClass ui;
};
#endif // CONTROLSETTINGS_H
|
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORGBU16COLORSPACE_H_
#define KORGBU16COLORSPACE_H_
#include "KoLcmsColorSpace.h"
#include "KoColorSpaceTraits.h"
#include "KoColorModelStandardIds.h"
class KoRgbU16ColorSpace : public KoLcmsColorSpace<KoRgbU16Traits>
{
public:
KoRgbU16ColorSpace( KoColorProfile *p);
virtual bool willDegrade(ColorSpaceIndependence independence) const;
virtual KoID colorModelId() const { return RGBAColorModelID; }
virtual KoID colorDepthId() const { return Integer16BitsColorDepthID; }
virtual KoColorSpace* clone() const;
virtual void colorToXML( const quint8* pixel, QDomDocument& doc, QDomElement& colorElt) const;
virtual void colorFromXML( quint8* pixel, const QDomElement& elt) const;
/**
* The ID that identifies this colorspace. Pass this as the colorSpaceId parameter
* to the KoColorSpaceRegistry::colorSpace() functions to obtain this colorspace.
* This is the value that the member function id() returns.
*/
static QString colorSpaceId();
};
class KoRgbU16ColorSpaceFactory : public KoLcmsColorSpaceFactory
{
public:
KoRgbU16ColorSpaceFactory() : KoLcmsColorSpaceFactory( TYPE_BGRA_16, icSigRgbData )
{
}
virtual QString id() const { return KoRgbU16ColorSpace::colorSpaceId(); }
virtual QString name() const { return i18n("RGB (16-bit integer/channel)"); }
virtual bool userVisible() const { return true; }
virtual KoID colorModelId() const { return RGBAColorModelID; }
virtual KoID colorDepthId() const { return Integer16BitsColorDepthID; }
virtual int referenceDepth() const { return 16; }
virtual KoColorSpace *createColorSpace( const KoColorProfile *p) const { return new KoRgbU16ColorSpace( p->clone() ); }
virtual QString defaultProfile() const { return "sRGB built-in - (lcms internal)"; }
};
#endif
|
#if defined(__GNUC__) && (__GNUC__ >= 5)
#include "uint64.h"
int imult64( int64 a, int64 b, int64* c) { return !__builtin_mul_overflow(a,b,c); }
#else
#include "safemult.h"
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__alpha__) || defined(__mips64__) || defined(__sparc64__))
int imult64(int64 a,int64 b,int64* c) {
__int128_t x=((__int128_t)a)*b;
if ((*c=(int64)x) != x) return 0;
return 1;
}
#else
int imult64(int64 a,int64 b,int64* c) {
int neg=(a<0);
uint64 d;
if (neg) a=-a;
if (b<0) { neg^=1; b=-b; }
if (!umult64(a,b,&d)) return 0;
if (d > 0x7fffffffffffffffULL + neg) return 0;
*c=(neg?-d:d);
return 1;
}
#endif
#endif
#ifdef UNITTEST
#include <assert.h>
int main() {
int64 c;
assert(imult64(0x4000000000000000ll,2,&c)==0);
assert(imult64(-0x4000000000000000ll,2,&c)==1 && c==(int64)-0x8000000000000000ll);
assert(imult64(0x3fffffffffffffffll,2,&c)==1 && c==0x7ffffffffffffffell);
return 0;
}
#endif
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright 2007 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AM_SWIMP_SERVER_H
#define AM_SWIMP_SERVER_H
#include "ns3/application.h"
#include "ns3/event-id.h"
#include "ns3/ptr.h"
#include "ns3/address.h"
#include "asm-common.h"
namespace ns3 {
class Socket;
class Packet;
/**
* \ingroup applications
* \defgroup SwImp SwImp
*/
/**
* \ingroup SwImp
* \brief A Udp Echo server
*
* Every packet received is sent back.
*/
class SwImpServer : public Application
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
SwImpServer ();
virtual ~SwImpServer ();
protected:
virtual void DoDispose (void);
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
//string stream for ease of output
void LogInfo(std::stringstream& s);
/**
* \brief function to fill the packet with data
*/
void SetFill (std::string fill);
/**
* \brief Handle a packet reception.
*
* This function is called by lower layers.
*
* \param socket the socket the packet was received to.
*/
void HandleRead (Ptr<Socket> socket);
/**
* \brief Handle an incoming connection
* \param socket the incoming connection socket
* \param from the address the connection is from
*/
void HandleAccept (Ptr<Socket> socket, const Address& from);
/**
* \brief Handle an connection close
* \param socket the connected socket
*/
void HandlePeerClose (Ptr<Socket> socket);
/**
* \brief Handle an connection error
* \param socket the connected socket
*/
void HandlePeerError (Ptr<Socket> socket);
uint32_t m_dataSize; //!< packet payload size (must be equal to m_size)
uint8_t *m_data; //!< packet payload data
uint16_t m_port; //!< Port on which we listen for incoming packets.
uint32_t m_size; //!< The size of the packet
Ptr<Socket> m_socket; //!< IPv4 Socket
std::list<Ptr<Socket> > m_socketList; //!< the accepted sockets
Address m_local; //!< local multicast address
Address m_myAddress; //!< ip address
uint32_t m_personalID; //My Personal ID
// SwImp variables
uint32_t m_ts; //!< latest timestamp
uint32_t m_value; //!< value associated with m_ts
uint32_t m_sent; //!< sent messages counter
uint16_t m_verbose; //!< Debug mode
};
} // namespace ns3
#endif /* AM_SWIMP_SERVER_H */
|
#ifndef oxygeninputdemowidget_h
#define oxygeninputdemowidget_h
//////////////////////////////////////////////////////////////////////////////
// oxygeninputdemowidget.h
// oxygen input widgets (e.g. text editors) demo widget
// -------------------
//
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////
#include <QtGui/QWidget>
#include <QtGui/QToolButton>
#include "oxygendemowidget.h"
#include "ui_oxygeninputdemowidget.h"
namespace Oxygen
{
class InputDemoWidget: public DemoWidget
{
Q_OBJECT
public:
//! constructor
InputDemoWidget( QWidget* parent = 0 );
//! destructor
virtual ~InputDemoWidget( void )
{}
public slots:
//! run benchmark
void benchmark( void );
protected slots:
//! flat widgets
void toggleFlatWidgets( bool );
//! wrap mode
void toggleWrapMode( bool );
private:
Ui_InputDemoWidget ui;
};
}
#endif
|
/********************************************
* *
* Eyüp Can KILINÇDEMİR *
* KARADENİZ TEKNİK UNİVERSİTESİ *
* ceksoft.wordpress.com *
* eyupcankilincdemir@gmail.com *
* *
********************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ISIMDIZIBOYUTU 20
#define PAROLADIZIBOYUTU 20
int main()
{
char girilen_isim[ISIMDIZIBOYUTU];
printf("Kullanici adinizi giriniz: ");
gets(girilen_isim);
int girilen_isim_boyutu = strlen(girilen_isim); // Dizi boyutunu karsilastirmak icin uzunluk bulundu.
char girilen_parola[PAROLADIZIBOYUTU];
printf("Parola giriniz: ");
gets(girilen_parola);
int girilen_parola_boyutu = strlen(girilen_parola); //Dizi boyutunu karsilastirmak için uzunluk bulundu.
char kullanici_adi[] = "EyüpCan";
char parola[] = "1234";
int kullanici_adi_uzunlugu = strlen(kullanici_adi);
int parola_uzunlugu = strlen(parola);
if ((ISIMDIZIBOYUTU > girilen_isim_boyutu) && (PAROLADIZIBOYUTU > girilen_parola_boyutu)) //gets fonksiyonuyla aldigimiz metnin
//dizi boyutumuzu gecip gecmedigimizi
{ //kontrol ettik.
int isim_kontrol = 0;
while(isim_kontrol < kullanici_adi_uzunlugu - 1 ) //\0 karakteride uzunluga dahil oldugu icin 1 eksik donduruldu
{
if (kullanici_adi[isim_kontrol] == girilen_isim[isim_kontrol]) //Dizilerin her elemani karsilastirildi
{
isim_kontrol++;
}
else
{
isim_kontrol = -1;
break;
}
}
int parola_kontrol = 0;
while(parola_kontrol < parola_uzunlugu - 1) //\0 karakteride uzunluga dahil oldugu icin 1 eksik donduruldu
{
if(parola[parola_kontrol] == girilen_parola[parola_kontrol])//Dizilerin her elemani karsilastirildi
{
parola_kontrol++;
}
else
{
parola_kontrol = -1;
break;
}
}
if( (isim_kontrol == -1) || (parola_kontrol == -1))
{
printf("Kullanici Adi veya Parola yanliş girdiniz.");
}
else
{
printf("Kullanici Adi ve Parola Dogru");
}
}
else
{
printf("Azami Kullanici Adi veya Parolayi gectiniz!!");
}
return 0;
}
|
/*
* MCMClib: A C Library for doing MCMC
* Copyright (C) 2009,2010 Antonio, Fabio Di Narzo
*
* 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 __MCMCLIB_IWISHART_H__
#define __MCMCLIB_IWISHART_H__
/**\addtogroup distributions
@{*/
/**\addtogroup multivariate
@{*/
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
/**\brief Inverse Wishart distribution */
typedef struct {
gsl_matrix* Psi; /**< location parameter */
unsigned int m; /**< degrees of freedom */
double PsiDet; /**< log-determinant of location parameter x m/2*/
gsl_matrix *PsiX, *X1; /**< workspace data */
} mcmclib_iwishart_lpdf;
/**\brief alloc a Wishart distribution object */
mcmclib_iwishart_lpdf* mcmclib_iwishart_lpdf_alloc(const gsl_matrix* Psi, const unsigned int m);
/**\brief de-alloc a Wishart distribution object */
void mcmclib_iwishart_lpdf_free(mcmclib_iwishart_lpdf* p);
/**\brief compute log-InverseWishart distribution */
double mcmclib_iwishart_lpdf_compute(void* in_p, const gsl_vector* x);
/**@}*/
/**@}*/
#endif
|
/*
* Unified handling of special chars.
*
* Copyright IBM Corp. 2001
* Author(s): Fritz Elfert <felfert@millenux.com> <elfert@de.ibm.com>
*
*/
#include <linux/stddef.h>
#include <asm/errno.h>
#include <linux/sysrq.h>
#include <linux/ctype.h>
#include "ctrlchar.h"
#ifdef CONFIG_MAGIC_SYSRQ
static int ctrlchar_sysrq_key;
static void
ctrlchar_handle_sysrq(struct work_struct *work)
{
handle_sysrq(ctrlchar_sysrq_key);
}
static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq);
#endif
/**
* Check for special chars at start of input.
*
* @param buf Console input buffer.
* @param len Length of valid data in buffer.
* @param tty The tty struct for this console.
* @return CTRLCHAR_NONE, if nothing matched,
* CTRLCHAR_SYSRQ, if sysrq was encountered
* otherwise char to be inserted logically or'ed
* with CTRLCHAR_CTRL
*/
unsigned int
ctrlchar_handle(const unsigned char *buf, int len, struct tty_struct *tty)
{
if ((len < 2) || (len > 3))
return CTRLCHAR_NONE;
/* hat is 0xb1 in codepage 037 (US etc.) and thus */
/* converted to 0x5e in ascii ('^') */
if ((buf[0] != '^') && (buf[0] != '\252'))
return CTRLCHAR_NONE;
#ifdef CONFIG_MAGIC_SYSRQ
/* racy */
if (len == 3 && buf[1] == '-') {
ctrlchar_sysrq_key = buf[2];
schedule_work(&ctrlchar_work);
return CTRLCHAR_SYSRQ;
}
#endif
if (len != 2)
return CTRLCHAR_NONE;
switch (tolower(buf[1])) {
case 'c':
return INTR_CHAR(tty) | CTRLCHAR_CTRL;
case 'd':
return EOF_CHAR(tty) | CTRLCHAR_CTRL;
case 'z':
return SUSP_CHAR(tty) | CTRLCHAR_CTRL;
}
return CTRLCHAR_NONE;
}
|
/*
* Generic cache management functions. Everything is arch-specific,
* but this header exists to make sure the defines/functions can be
* used in a generic way.
*
* 2000-11-13 Arjan van de Ven <arjan@fenrus.demon.nl>
*
*/
#ifndef _LINUX_PREFETCH_H
#define _LINUX_PREFETCH_H
#include <linux/types.h>
#include <asm/processor.h>
#include <asm/cache.h>
/*
prefetch(x) attempts to pre-emptively get the memory pointed to
by address "x" into the CPU L1 cache.
prefetch(x) should not cause any kind of exception, prefetch(0) is
specifically ok.
prefetch() should be defined by the architecture, if not, the
#define below provides a no-op define.
There are 3 prefetch() macros:
prefetch(x) - prefetches the cacheline at "x" for read
prefetchw(x) - prefetches the cacheline at "x" for write
spin_lock_prefetch(x) - prefetches the spinlock *x for taking
there is also PREFETCH_STRIDE which is the architecure-preferred
"lookahead" size for prefetching streamed operations.
*/
#ifndef ARCH_HAS_PREFETCH
#define prefetch(x) __builtin_prefetch(x)
#endif
#ifndef ARCH_HAS_PREFETCHW
#define prefetchw(x) __builtin_prefetch(x,1)
#endif
#ifndef ARCH_HAS_SPINLOCK_PREFETCH
#define spin_lock_prefetch(x) prefetchw(x)
#endif
#ifndef PREFETCH_STRIDE
#ifdef CONFIG_BCM_IPROC_CA9_PREFETCH
#define PREFETCH_STRIDE (32)
#else
#define PREFETCH_STRIDE (4*L1_CACHE_BYTES)
#endif
#endif
static inline void prefetch_range(void *addr, size_t len)
{
#ifdef ARCH_HAS_PREFETCH
char *cp;
char *end = addr + len;
for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
prefetch(cp);
#endif
}
#endif
|
/*
* Copyright (C) 2000 Lennert Buytenhek
*
* 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 _LIBBRIDGE_H
#define _LIBBRIDGE_H
#include <net/if.h>
#include <linux/in6.h>
#include <linux/if_bridge.h>
struct bridge_id
{
unsigned char prio[2];
unsigned char addr[6];
};
struct bridge_info
{
struct bridge_id designated_root;
struct bridge_id bridge_id;
unsigned root_path_cost;
struct timeval max_age;
struct timeval hello_time;
struct timeval forward_delay;
struct timeval bridge_max_age;
struct timeval bridge_hello_time;
struct timeval bridge_forward_delay;
u_int16_t root_port;
unsigned char stp_enabled;
unsigned char topology_change;
unsigned char topology_change_detected;
struct timeval ageing_time;
struct timeval hello_timer_value;
struct timeval tcn_timer_value;
struct timeval topology_change_timer_value;
struct timeval gc_timer_value;
};
struct fdb_entry
{
u_int8_t mac_addr[6];
u_int16_t port_no;
unsigned char is_local;
struct timeval ageing_timer_value;
};
struct port_info
{
unsigned port_no;
struct bridge_id designated_root;
struct bridge_id designated_bridge;
u_int16_t port_id;
u_int16_t designated_port;
u_int8_t priority;
unsigned char top_change_ack;
unsigned char config_pending;
unsigned char state;
unsigned path_cost;
unsigned designated_cost;
struct timeval message_age_timer_value;
struct timeval forward_delay_timer_value;
struct timeval hold_timer_value;
};
extern int br_init(void);
extern int br_refresh(void);
extern void br_shutdown(void);
extern int br_foreach_bridge(int (*iterator)(const char *brname, void *),
void *arg);
extern int br_foreach_port(const char *brname,
int (*iterator)(const char *brname, const char *port,
void *arg ),
void *arg);
extern const char *br_get_state_name(int state);
extern int br_get_bridge_info(const char *br, struct bridge_info *info);
extern int br_get_port_info(const char *brname, const char *port,
struct port_info *info);
extern int br_add_bridge(const char *brname);
extern int br_del_bridge(const char *brname);
extern int br_add_interface(const char *br, const char *dev);
extern int br_del_interface(const char *br, const char *dev);
extern int br_set_bridge_forward_delay(const char *br, struct timeval *tv);
extern int br_set_bridge_hello_time(const char *br, struct timeval *tv);
extern int br_set_bridge_max_age(const char *br, struct timeval *tv);
extern int br_set_ageing_time(const char *br, struct timeval *tv);
extern int br_set_stp_state(const char *br, int stp_state);
extern int br_set_bridge_priority(const char *br, int bridge_priority);
extern int br_set_port_priority(const char *br, const char *p,
int port_priority);
extern int br_set_path_cost(const char *br, const char *p,
int path_cost);
extern int br_read_fdb(const char *br, struct fdb_entry *fdbs,
unsigned long skip, int num);
#endif
|
/*(LGPLv2.1)
----------------------------------------------------------------------
filters.h - Filters for the sprite manager
----------------------------------------------------------------------
* Copyright 2001, 2003, 2009 David Olofson
* Copyright 2015-2016 David Olofson (Kobo Redux)
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef SPRITE_FILTERS_H
#define SPRITE_FILTERS_H
#include "sprite.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Flags (args.flags) that apply to most plugins:
*/
#define SF_CLAMP_EXTEND 0x00000001
#define SF_CLAMP_SFONT 0x00000002
#define SF_WRAP 0x00000004
/*
* Convert bank to RGBA 8:8:8:8 format.
*
* (No arguments.)
*/
int s_filter_rgba8(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Dither R, G and B channels to the specified bit depth.
*
* args.x = 1 activates 16 bit RGBA fix (assume +/-16 dither depth for RGBA)
* args.y = dither type (0 = 2x2 filter, 1 = random)
*
* args.r = red dither depth
* args.g = green dither depth
* args.b = blue dither depth
*
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*
* Note: This plugin does *not* dither the alpha channel!
*/
int s_filter_dither(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Optionally convert bank surfaces into textures.
*
* args.data = SDL renderer
*/
int s_filter_displayformat(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Convert colorkey to alpha channel.
*
* The global colorkey variable is used for base colorkey value.
* args.max = colorkey detection fuzziness factor
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*/
int s_filter_key2alpha(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Adjust alpha level and contrast, and then clean out almost opaque
* and almost transparent pixels.
*
* args.fx = alpha contrast (1.0 = unchanged; 2.0 = double; scales around 128)
* args.x = alpha offset (0 = unchanged; -255 = all transp.; 255 = all opaque)
*
* args.min = min alpha passed (lower ==> 0)
* args.max = max alpha passed (higher ==> 255)
*
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*/
int s_filter_cleanalpha(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Adjust brightness and contrast.
*
* args.fx = brightness (1.0 = unchanged; 0.0 = black; 2.0 = white)
* args.fy = contrast (1.0 = unchanged; 0.5 = 50%; 2.0 = 200%)
*
* args.min = min value (clamping)
* args.max = max value (clamping)
*
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*/
int s_filter_brightness(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Scale images by the specified factor, using the specified method.
*
* args.x = scaling mode;
* SF_SCALE_NEAREST Nearest
* SF_SCALE_BILINEAR Bilinear interpolation
* SF_SCALE_SCALE2X Scale2x (Based on an algo from AdvanceMAME)
* SF_SCALE_DIAMOND Diamond (Weighted diamond shaped core)
*
* args.fx = horizontal scale factor (1.0 ==> 1:1)
* args.fy = vertical scale factor (1.0 ==> 1:1)
*
* args.flags;
* SF_CLAMP_EXTEND Clamp at edges; image edge is extended outwards
* SF_WARP Wrap around edges.
* SF_CLAMP_SFONT SFont mode; first row is treated specially.
*
*/
#define SF_SCALE_NEAREST 0
#define SF_SCALE_BILINEAR 1
#define SF_SCALE_SCALE2X 2
#define SF_SCALE_DIAMOND 3
int s_filter_scale(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
#if 0
/*
TODO:
* Add shaded light to images.
*
* args.fx = Highlight X position ([0,1])
* args.fy = Highlight Y position ([0,1])
* args.fz = Highlight "half intensity" radius
*
* args.x = Gradient type:
* SF_LIGHT_LINEAR Linear gradient
* SF_LIGHT_CIRCULAR Circular spotlight
*
* args.z = Gradient rotation (65536 units/rotation)
*
* args.min = "Ambient light"
* args.max = Max brightness
*
* args.r = Light color, red component
* args.g = Light color, green component
* args.b = Light color, blue component
*
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*/
#define SF_LIGHT_LINEAR 0
#define SF_LIGHT_CIRCULAR 1
int s_filter_light(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
#endif
/*
* Add single colored noise to images.
*
* args.x = Pseudo-RNG seed for first frame
*
* args.min = Min brightness ([0,255])
* args.max = Max brightness ([0,255])
*
* args.r = Noise color, red component ([0,255])
* args.g = Noise color, green component ([0,255])
* args.b = Noise color, blue component ([0,255])
*
* args.flags;
* SF_CLAMP_SFONT SFont mode; first row is ignored.
*/
int s_filter_noise(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
/*
* Mark edges of frames with a 1 pixel outline in the specified color.
*
* args.[rgb] = marker color
*/
int s_filter_markedges(s_bank_t *b, unsigned first, unsigned frames,
s_filter_args_t *args);
#ifdef __cplusplus
}
#endif
#endif /* SPRITE_FILTERS_H */
|
#define BFD_VERSION_DATE 20120120
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
|
#ifndef _BOX_H
#define _BOX_H
#include "basic_types.h"
class Box
{
public:
Box():first_expand_(true){}
~Box(){}
void expand( const PointType& p )
{
diag_dirty_ = true;
if (first_expand_)
{
low_corner_ = p;
high_corner_ = p;
first_expand_ = false;
return;
}
for (int dim=0; dim <3; dim++)
{
if (p(dim) < low_corner_(dim) )
low_corner_(dim) = p(dim);
else if( p(dim) > high_corner_(dim) )
high_corner_(dim) = p(dim);
}
}
void reset(){ first_expand_ = true;diag_dirty_=true; }
const ScalarType diag()
{
if (first_expand_)
{
return 0.;
}
if (!diag_dirty_)
{
return diag_;
}
ScalarType d[3];
for (int dim = 0; dim < 3; dim++ )
{
d[dim] = fabs( low_corner_(dim) - high_corner_(dim) );
}
diag_dirty_ = false;
diag_ = sqrt( d[0]*d[0] + d[1]*d[1] + d[2]*d[2] );
return diag_;
}
const PointType center() const
{
return ( low_corner_ + high_corner_ )/2;
}
const PointType low_corner() const{return low_corner_;}
const PointType high_corner()const{return high_corner_;}
private:
PointType low_corner_;
PointType high_corner_;
//Because sqrt is expensive, we record dirty flag to update diag
bool diag_dirty_;
ScalarType diag_;
bool first_expand_;
};
#endif
|
#ifndef HDS_FACE_H
#define HDS_FACE_H
#include "common.h"
#include <QVector3D>
class HDS_HalfEdge;
class HDS_Vertex;
class HDS_Face
{
private:
static size_t uid;
public:
static void resetIndex() { uid = 0; }
static size_t assignIndex() { return uid++; }
static float faceAngle(const HDS_Face* f0, const HDS_Face* f1);
HDS_Face();
~HDS_Face();
HDS_Face(const HDS_Face &other);
HDS_Face operator=(const HDS_Face &other);
void updateVerts();
set<HDS_Face *> connectedFaces();
set<HDS_Face *> linkedFaces();
QVector3D center() const;
vector<HDS_Vertex*> corners() const;
QVector3D computeNormal();
QVector3D n; // Geometric face normal
HDS_HalfEdge *he;
int vnum; // Number of vertices
vector<HDS_Vertex*> v; // actual vertices
unordered_map<HDS_Vertex*, QVector3D*> snMap;
unordered_map<HDS_Vertex*, QVector2D*> suvMap;
int index;
};
#endif // HDS_FACE_H
|
/*
* (C) Copyright 2007-2013
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
* Jerry Wang <wangflord@allwinnertech.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <malloc.h>
#include <asm/arch/intc.h>
#include <pmu.h>
#include "power_probe.h"
#include <asm/arch/usb.h>
DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_SUNXI_SPINOR_PLATFORM
extern int boot_standby_action;
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
static void power_int_irq(void *p_arg)
{
#ifdef DEBUG
int i;
#endif
unsigned char power_int_status[8];
int dc_exist, bat_exist;
axp_int_query(power_int_status);
#ifdef DEBUG
for(i=0;i<5;i++)
{
tick_printf("int status %d %x\n", i, power_int_status[i]);
}
#endif
if(power_int_status[0] & 0x48) //ÍⲿµçÔ´²åÈë
{
axp_power_get_dcin_battery_exist(&dc_exist, &bat_exist);
if(dc_exist)
{
tick_printf("power insert\n");
boot_standby_action &= ~0x10;
boot_standby_action |= 0x04;
}
}
if(power_int_status[0] & 0x8) //usb ²åÈëÖжϣ¬Æô¶¯usb¼ì²â
{
tick_printf("usb in\n");
boot_standby_action |= 8;
usb_detect_enter();
}
if(power_int_status[0] & 0x4)
{
tick_printf("usb out\n");
boot_standby_action &= ~0x04;
boot_standby_action |= 0x10;
usb_detect_exit();
}
if(power_int_status[2] & 0x2) //¶Ì°´¼ü
{
tick_printf("short key\n");
boot_standby_action |= 2;
}
if(power_int_status[2] & 0x1) //³¤°´¼ü
{
tick_printf("long key\n");
boot_standby_action |= 1;
}
return;
}
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
void power_limit_detect_enter(void)
{
unsigned char power_int_enable[8];
power_int_enable[0] = 0x4C; //dc in/out, usb in/out
power_int_enable[1] = 0;
power_int_enable[2] = 3;
power_int_enable[4] = 0;
power_int_enable[5] = 0;
tick_printf("power limit detect enter\n");
axp_int_enable(power_int_enable);
irq_install_handler(AW_IRQ_NMI, power_int_irq, 0);
irq_enable(AW_IRQ_NMI);
}
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
void power_limit_detect_exit(void)
{
usb_detect_exit();
irq_disable(AW_IRQ_NMI);
axp_int_disable();
tick_printf("power limit detect exit\n");
}
#endif
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
int __usb_probe_vbus_type(void) //Èç¹ûûÓÐÉùÃ÷£¬Ä¬ÈÏΪpcÀàÐ͵çÔ´
{
return 0;
}
int usb_probe_vbus_type(void)
__attribute__((weak, alias("__usb_probe_vbus_type")));
void power_limit_init(void)
{
int battery_exist = 0;
int dcin_exist = 0;
int vbus_type = 0;
int i = 0;
do
{
axp_power_get_dcin_battery_exist(&dcin_exist, &battery_exist);//ÅÐ¶Ïµç³ØÊÇ·ñ´æÔÚ
if(battery_exist >= 0)
{
break;
}
i ++;
__msdelay(500);
}
while(i < 4);
vbus_type = usb_probe_vbus_type();
if(vbus_type == 1) //ÊôÓÚdcÀàÐ͵çÔ´
{
printf("vbus not exist\n");
gd->vbus_status = SUNXI_VBUS_NOT_EXIST;
}
else
{
printf("vbus exist\n");
gd->vbus_status = SUNXI_VBUS_EXIST; //ÊôÓÚvbusÀàÐÍ
}
if(battery_exist != BATTERY_EXIST) //µç³Ø²»´æÔÚ£¬ÔòÖ±½ÓÏÞÁ÷µ½DCģʽ
{
axp_set_vbus_limit_dc();
puts("no battery, limit to dc\n");
return ;
}
if(dcin_exist == AXP_DCIN_EXIST) //Èç¹ûÆÕͨÍⲿµçÔ´´æÔÚ£¬²»ÊÇVBUSÀàÐÍ
{
axp_set_vbus_limit_dc();
puts("normal dc exist, limit to dc\n");
return ;
}
if(dcin_exist == AXP_VBUS_EXIST) //Èç¹ûVBUSµçÔ´´æÔÚ
{
vbus_type = usb_probe_vbus_type();
if(vbus_type == 1) //ÊôÓÚdcÀàÐ͵çÔ´
{
axp_set_vbus_limit_dc(); //dp_dm À¸ß
puts("vbus dc exist, limit to dc\n");
}
else
{
axp_set_vbus_limit_pc(); //dp_dm ÀµÍ
axp_set_charge_current(600);
puts("vbus pc exist, limit to pc\n");
}
return ;
}
axp_set_vbus_limit_dc(); //Ö»ÓÐµç³Ø´æÔÚ
puts("only battery exist, limit to dc\n");
return ;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.