text stringlengths 4 6.14k |
|---|
//
// AppDelegate.h
// NewTD
//
// Created by 工业设计中意(湖南) on 14-5-8.
// Copyright (c) 2014年 中意工业设计(湖南)有限责任公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// QNRequestClient.h
// QiniuSDK
//
// Created by yangsen on 2020/4/29.
// Copyright © 2020 Qiniu. All rights reserved.
//
#import "QNUploadRequestMetrics.h"
NS_ASSUME_NONNULL_BEGIN
typedef void (^QNRequestClientCompleteHandler)(NSURLResponse * _Nullable, QNUploadSingleRequestMetrics * _Nullable, NSData * _Nullable, NSError * _Nullable);
@protocol QNRequestClient <NSObject>
// client 标识
@property(nonatomic, copy, readonly)NSString *clientId;
- (void)request:(NSURLRequest *)request
server:(_Nullable id <QNUploadServer>)server
connectionProxy:(NSDictionary * _Nullable)connectionProxy
progress:(void(^ _Nullable)(long long totalBytesWritten, long long totalBytesExpectedToWrite))progress
complete:(_Nullable QNRequestClientCompleteHandler)complete;
- (void)cancel;
@end
NS_ASSUME_NONNULL_END
|
/*
* ProjectEuler/src/c/Problem132.c
*
* Large repunit factors
* =====================
* Published on Friday, 1st December 2006, 06:00 pm
*
* A number consisting entirely of ones is called a repunit. We shall define
* R(k) to be a repunit of length k. For example, R(10) = 1111111111 =
* 11412719091, and the sum of these prime factors is 9414. Find the sum of the
* first forty prime factors of R(109).
*/
#include <stdio.h>
#include "ProjectEuler/ProjectEuler.h"
#include "ProjectEuler/Problem132.h"
int main(int argc, char** argv) {
return 0;
} |
//
// BBDKeyPositionController.h
// BaseBoard
//
// Created by Adam A. Wolf on 11/17/14.
// Copyright (c) 2014 Adam A. Wolf. All rights reserved.
//imn0tt3ll1ng
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BBDKeyController.h"
@protocol BBDKeyPositionDataSource;
@interface BBDKeyPositionController : NSObject
@property (nonatomic, weak) id<BBDKeyPositionDataSource>dataSource;
- (void)reloadKeyPositions;
- (NSDictionary *)keyDictionaryForKeyCode:(NSUInteger)keyCode;
@end
@protocol BBDKeyPositionDataSource <NSObject>
//used to determine total available width
- (CGSize)keyboardSize;
- (NSInteger)numberOfRows;
- (NSInteger)numberOfKeysForRow:(NSInteger)row;
- (NSUInteger)keyCodeForKeyAtIndexPath:(NSIndexPath *)indexPath;
//a fraction between 0 and 1.0, 1.0 representing width remaining after subtracting margins
- (NSNumber *)relativeWidthForKeyAtIndexPath:(NSIndexPath *)indexPath;
//pixels subtracted from total available width
- (NSValue *)marginsForKeyAtIndexPath:(NSIndexPath *)indexPath;
//internal to bounds of each key. as such, doesn't affect a key's calculated frame
- (NSValue *)paddingsForKeyAtIndexPath:(NSIndexPath *)indexPath;
@end
@interface NSIndexPath (KeyPositionControllerAdditions)
+ (NSIndexPath *)indexPathForKeyPosition:(NSInteger)keyPosition inKeyRow:(NSInteger)keyRow;
@property (nonatomic, readonly) NSInteger keyPosition;
@property (nonatomic, readonly) NSInteger keyRow;
@end
|
#include "time.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
uint8_t day_counts[2][12] = {
{ 31, 28,
31, 30,
31, 30,
31, 31,
30, 31,
30, 31 },
{ 31, 29,
31, 30,
31, 30,
31, 31,
30, 31,
30, 31 }
};
char *day_names[7] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
char *month_names[12] = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
int day_of_year (struct time *t) {
int d,m;
bool leap;
d = t->day;
leap = is_leap_year(t->year);
for(m = 0; m < t->month; ++m)
d += day_counts[leap][m];
return d;
}
// ----
void time_init_now (struct time *t) {
time_t s;
s = time(NULL);
time_init_val(t, &s);
}
void time_init_str (struct time *t, char *str, char *fmt) {
strptime(str, fmt, t);
}
inline
void time_init_val (struct time *t, time_t *s) {
struct tm *ot;
ot = localtime(s);
time_convert_in(t, ot);
}
// ----
void time_convert_in (struct time *dest, struct tm *src) {
dest->year = 1900 + src->tm_year;
dest->month = src->tm_mon;
dest->day = src->tm_mday;
dest->hour = src->tm_hour;
dest->min = src->tm_min;
dest->sec = src->tm_sec;
}
void time_convert_out (struct tm *dest, struct time *src) {
dest->tm_yday = day_of_year(src);
dest->tm_wday = day_of_week(src);
dest->tm_year = src->year - 1900;
dest->tm_mon = src->month;
dest->tm_mday = src->day;
dest->tm_hour = src->hour;
dest->tm_min = src->min;
dest->tm_sec = src->sec;
}
// ----
int time_cmp (struct time *t1, struct time *t2, struct time *diff, bool fuzzy) {
int sign,
y;
struct time *tmp;
sign = time_cmp_mag(t2,t1);
if(sign == -1) {
tmp = t2;
t2 = t1;
t1 = tmp;
}
if(fuzzy) {
diff->year = t2->year - t1->year;
diff->month = t2->month - t1->month;
diff->day = t2->day - t1->day;
if(diff->day < 0) {
--diff->month;
diff->day += days_in_month(t1->month, t1->year);
}
if(diff->month < 0) {
--diff->year;
diff->month += 12;
}
}
else {
diff->year = 0;
diff->month = 0;
diff->day = day_of_year(t1) * -1;
for(y = t1->year; y < t2->year; ++y)
diff->day += days_in_year(y);
diff->day += day_of_year(t2);
}
diff->hour = t2->hour - t1->hour;
diff->min = t2->min - t1->min;
diff->sec = t2->sec - t1->sec;
if(diff->sec < 0) {
--diff->min;
diff->sec += 60;
}
if(diff->min < 0) {
--diff->hour;
diff->min += 60;
}
if(diff->hour < 0) {
--diff->day;
diff->hour += 24;
}
return sign;
}
int time_cmp_mag (struct time *t1, struct time *t2) {
if(t1->year < t2->year)
return -1;
else if(t1->year > t2->year)
return +1;
if(t1->month < t2->month)
return -1;
else if(t1->month > t2->month)
return +1;
if(t1->day < t2->day)
return -1;
else if(t1->day > t2->day)
return +1;
if(t1->hour < t2->hour)
return -1;
else if(t1->hour > t2->hour)
return +1;
if(t1->min < t2->min)
return -1;
else if(t1->min > t2->min)
return +1;
if(t1->sec < t2->sec)
return -1;
else if(t1->sec > t2->sec)
return +1;
return 0;
}
// ----
void time_mod (struct time *t, char *str) {
int sign;
long long v;
if(*str == '-') {
++str;
sign = -1;
}
else {
sign = 1;
}
while(*str != '\0') {
v = strtoull(str, &str, 10) * sign;
if(strncmp(str, "Y", 2) == 0) {
t->year += v;
str += 2;
}
else if(strncmp(str, "M", 2) == 0) {
time_mod_month(t, v);
str += 2;
}
else {
if(*str == 'd')
time_mod_day(t,v);
else if(*str == 'h')
time_mod_hour(t,v);
else if(*str == 'm')
time_mod_min(t,v);
else if(*str == 's')
time_mod_sec(t,v);
++str;
}
while(isspace(*str))
++str;
}
}
void time_mod_month (struct time *t, int mo) {
int sign,
dim;
if(mo < 0) {
sign = -1;
mo *= -1;
}
else {
sign = 1;
}
while(mo > 0) {
dim = days_in_month(t->month, t->year);
time_mod_day(t, dim * sign);
--mo;
}
}
void time_mod_day (struct time *t, int d) {
int sign,
dim;
if(d < 0) {
sign = -1;
d *= -1;
}
else {
sign = 1;
}
while(d > 0) {
dim = days_in_month(t->month, t->year);
if(d >= dim) {
t->day += dim * sign;
d -= dim;
}
else {
t->day += d * sign;
d = 0;
}
if(t->day < 1) {
--t->month;
if(t->month == -1) {
--t->year;
t->month = DECEMBER;
}
t->day += days_in_month(t->month, t->year);
}
else if(t->day > dim) {
++t->month;
if(t->month == MONTH_MAX) {
++t->year;
t->month = JANUARY;
}
t->day %= dim;
}
}
}
void time_mod_hour (struct time *t, int h) {
int d;
d = h/24;
if(d != 0) {
time_mod_day(t,d);
h %= 24;
}
t->hour += h;
if(t->hour < 0) {
time_mod_day(t,-1);
t->hour += 24;
}
else if(t->hour > 23) {
time_mod_day(t,1);
t->hour -= 24;
}
}
void time_mod_min (struct time *t, int m) {
int h;
h = m/60;
if(h != 0) {
time_mod_hour(t,h);
m %= 60;
}
t->min += m;
if(t->min < 0) {
time_mod_hour(t, -1);
t->min += 60;
}
else if(t->min > 59) {
time_mod_hour(t, +1);
t->min -= 60;
}
}
void time_mod_sec (struct time *t, int s) {
int m;
m = s/60;
if(m != 0) {
time_mod_min(t,m);
s %= 60;
}
t->sec += s;
if(t->sec < 0) {
time_mod_min(t, -1);
t->sec += 60;
}
else if(t->sec > 59) {
time_mod_min(t, +1);
t->sec -= 60;
}
}
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**************************************************************************************************
*** This file was autogenerated from GrSimpleTextureEffect.fp; do not modify.
**************************************************************************************************/
#ifndef GrSimpleTextureEffect_DEFINED
#define GrSimpleTextureEffect_DEFINED
#include "include/core/SkTypes.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrSimpleTextureEffect : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix) {
return std::unique_ptr<GrFragmentProcessor>(
new GrSimpleTextureEffect(std::move(proxy), matrix,
GrSamplerState(GrSamplerState::WrapMode::kClamp,
GrSamplerState::Filter::kNearest)));
}
/* clamp mode */
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
GrSamplerState::Filter filter) {
return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(
std::move(proxy), matrix,
GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
}
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
const GrSamplerState& p) {
return std::unique_ptr<GrFragmentProcessor>(
new GrSimpleTextureEffect(std::move(proxy), matrix, p));
}
GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "SimpleTextureEffect"; }
GrCoordTransform imageCoordTransform;
TextureSampler image;
SkMatrix44 matrix;
private:
GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix,
GrSamplerState samplerParams)
: INHERITED(kGrSimpleTextureEffect_ClassID,
(OptimizationFlags)ModulateForSamplerOptFlags(
image->config(),
samplerParams.wrapModeX() ==
GrSamplerState::WrapMode::kClampToBorder ||
samplerParams.wrapModeY() ==
GrSamplerState::WrapMode::kClampToBorder))
, imageCoordTransform(matrix, image.get())
, image(std::move(image), samplerParams)
, matrix(matrix) {
this->setTextureSamplerCnt(1);
this->addCoordTransform(&imageCoordTransform);
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
const TextureSampler& onTextureSampler(int) const override;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
typedef GrFragmentProcessor INHERITED;
};
#endif
|
//
// accommon.c
// HSFont
//
// Created by dengyouhua on 17/2/6.
// Copyright © 2017年 cc | ccworld1000@gmail.com. All rights reserved.
//
#include "accommon.h"
float accommon_calc_dimension (float value) {
return value / 2.;
}
|
//******************************************************************************
//*
//* FULLNAME: Single-Chip Microcontroller Real-Time Operating System
//*
//* NICKNAME: scmRTOS
//*
//* PROCESSOR: ADSP-BF533 (Analog Devices)
//*
//* TOOLKIT: VDSP (Analog Devices)
//*
//* PURPOSE: Device Definitions
//*
//* Version: v5.2.0
//*
//*
//* Copyright (c) 2003-2021, scmRTOS Team
//*
//* 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.
//*
//* =================================================================
//* Project sources: https://github.com/scmrtos/scmrtos
//* Documentation: https://github.com/scmrtos/scmrtos/wiki/Documentation
//* Wiki: https://github.com/scmrtos/scmrtos/wiki
//* Sample projects: https://github.com/scmrtos/scmrtos-sample-projects
//* =================================================================
//*
//******************************************************************************
//* Blackfin/CrossCore Embedded Studio port by Evgeny Nesterov, Copyright (c) 2012-2021
#ifndef DEVICE_H
#define DEVICE_H
#include <sys\platform.h>
#ifdef _LANGUAGE_C
#include <sys\exception.h>
#include <sys\pll.h>
#include <ccblkfn.h>
#endif // _LANGUAGE_C
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#endif /* DEVICE_H */
|
//
// DDMemoryCache.h
// DDMemoryCache
//
// Created by 张德荣 on 16/6/11.
// Copyright © 2016年 zdrjson. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface DDMemoryCache : NSObject
@end
|
#ifndef _MODEL_H_
#define _MODEL_H_
#include "..\common\geometry.h"
class CModel
{
public:
CModel() {}
public:
Vector3D m_vTranslation;//Æ«ÒÆÁ¿
Vector3D m_vRotation;//Ðýת
double m_color[3];//ÎïÌåµÄÑÕÉ«
};
#endif |
//*****************************************************************************
//! @file io_pin_int.h
//! @brief I/O pin interrupt handler header file.
//!
//! Revised $Date: 2014-11-04 03:41:20 -0800 (Tue, 04 Nov 2014) $
//! Revision $Revision: 14353 $
//
// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//****************************************************************************/
#ifndef __IO_PIN_INT_H__
#define __IO_PIN_INT_H__
/******************************************************************************
* If building with a C++ compiler, make all of the definitions in this header
* have a C binding.
******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
* INCLUDES
*/
#include "bsp.h"
#include "driverlib/interrupt.h"
#include "driverlib/gpio.h"
/******************************************************************************
* GLOBAL FUNCTIONS
*/
extern void ioPinIntRegister(uint32_t ui32Pins,
void (*pfnIntHandler)(void *pEvent));
extern void ioPinIntUnregister(uint32_t ui32Pins);
/******************************************************************************
* Mark the end of the C bindings section for C++ compilers.
******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* #ifndef __IO_PIN_INT_H__ */
|
//
// UIViewController+Syncing.h
// UIViewController+Syncing
//
// Created by Ken M. Haggerty on 10/9/13.
// Copyright (c) 2013 Eureka Valley Co. All rights reserved.
//
#pragma mark - // NOTES (Public) //
#pragma mark - // IMPORTS (Public) //
#import <UIKit/UIKit.h>
#pragma mark - // PROTOCOLS //
#pragma mark - // DEFINITIONS (Public) //
typedef enum {
AKSyncBlank,
AKSyncComplete,
AKSyncWarning,
AKSyncQuestion,
AKSyncFailed,
AKSyncCancelled
} AKSyncCompletionType;
@protocol SyncViewDelegate <NSObject>
@required
- (void)syncViewDidCancel;
@end
@interface UIViewController (Syncing) <SyncViewDelegate>
@property (nonatomic, readonly) BOOL isSyncing;
// PROPERTIES //
- (void)setViewForSyncView:(UIView *)view;
- (void)setSyncViewBackgroundColor:(UIColor *)backgroundColor;
- (void)setSyncViewTextColor:(UIColor *)textColor;
- (void)setSyncViewStatusText:(NSString *)status;
- (void)setSyncViewCancelText:(NSString *)text;
- (void)showProgressView;
- (void)hideProgressView;
- (void)setSyncViewCancelButtonColor:(UIColor *)buttonColor;
- (void)showCancelButton:(BOOL)animated;
- (void)hideCancelButton:(BOOL)animated;
- (void)setDefaultStatusBarStyle:(UIStatusBarStyle)style;
// ACTIONS //
- (void)startSyncViewWithStatus:(NSString *)status cancelButton:(BOOL)showCancel;
- (void)setSyncViewProgress:(float)progress animated:(BOOL)animated;
- (void)dismissSyncViewWithCompletionBlock:(void (^)(BOOL))completionBlock;
- (void)cancelSyncViewWithStatus:(NSString *)status completionType:(AKSyncCompletionType)completionType actionSheet:(UIActionSheet *)actionSheet delay:(NSTimeInterval)delay completionBlock:(void (^)(BOOL))completionBlock;
@end |
//
// UINavigationController+ZKAdd.h
// ZKCategories(https://github.com/kaiser143/ZKCategories.git)
//
// Created by Kaiser on 2017/6/28.
// Copyright © 2017年 Kaiser. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZKCategoriesMacro.h"
@interface UINavigationController (ZKAdd)
/**
* pop to the first object is kind of aClass and return poped viewControllers
*/
- (NSArray *)popToViewControllerClass:(Class)cls animated:(BOOL)animated;
/*
* pop and then push
*
* http://stackoverflow.com/questions/410471/how-can-i-pop-a-view-from-a-uinavigationcontroller-and-replace-it-with-another-i
*/
- (UIViewController *)popThenPushViewController:(UIViewController *)viewController animated:(BOOL)animated;
@end
@interface UINavigationController (ZKFullscreenPopGesture)
/// The gesture recognizer that actually handles interactive pop.
@property (nonatomic, strong, readonly) UIPanGestureRecognizer *kai_fullscreenPopGestureRecognizer;
/// A view controller is able to control navigation bar's appearance by itself,
/// rather than a global way, checking "kai_prefersNavigationBarHidden" property.
/// Default to YES, disable it if you don't want so.
@property (nonatomic, assign) BOOL kai_viewControllerBasedNavigationBarAppearanceEnabled ZK_API_DEPRECATED(ZKNavigationBarConfigureStyle);
@end
/// Allows any view controller to disable interactive pop gesture, which might
/// be necessary when the view controller itself handles pan gesture in some
/// cases.
@interface UIViewController (ZKFullscreenPopGesture)
/// Whether the interactive pop gesture is disabled when contained in a navigation
/// stack.
@property (nonatomic, assign) BOOL kai_interactivePopDisabled;
/// Indicate this view controller prefers its navigation bar hidden or not,
/// checked when view controller based navigation bar's appearance is enabled.
/// Default to NO, bars are more likely to show.
@property (nonatomic, assign) BOOL kai_prefersNavigationBarHidden ZK_API_DEPRECATED(ZKNavigationBarConfigureStyle);
/// Max allowed initial distance to left edge when you begin the interactive pop
/// gesture. 0 by default, which means it will ignore this limit.
@property (nonatomic, assign) CGFloat kai_interactivePopMaxAllowedInitialDistanceToLeftEdge;
@end
|
/*********************************************//**
* @file CurrencyManager.h
* @brief
*************************************************/
#ifndef PS_CURRENCYMANAGER_H_
#define PS_CURRENCYMANAGER_H_
namespace proxy_shop {
class CCurrencyManager_Test;
class CurrencyManager
{
friend class CCurrencyManager_Test;
public:
void query();
void add();
void remove();
void save();
void setRate();
};
}
#endif//header
|
# define Lock(v) pthread_mutex_lock(&v)
# define LockInit(v) pthread_mutex_init(&v,0)
# define UnLock(v) pthread_mutex_unlock(&v)
# define lock_t pthread_mutex_t
|
#pragma once
#include "logger.h"
#include "dcutils.hpp"
struct profile_t {
const char * file;
const char * funcname;
const int line;
static std::string level_s;
uint64_t start_time;
profile_t(const char * file_, const char * funcname_, int line_) :
file(file_), funcname(funcname_), line(line_){
start_time = dcsutil::time_unixtime_us();
if (!is_on(start_time)){
return;
}
LOGR(LOG_LVL_PROF, "%s%s:%d BEGIN", level_s.c_str(), funcname, line);
level_s.push_back('\t');
}
~profile_t(){
uint64_t now_us = dcsutil::time_unixtime_us();
if (!is_on(now_us)){
return;
}
uint64_t lcost_time = now_us - start_time;
level_s.pop_back();
LOGR(LOG_LVL_PROF, "%s%s:%d END | COST:%lu us", level_s.c_str(), funcname, line, lcost_time);
}
private:
static uint64_t s_prof_time_end;
static inline bool is_on(uint64_t current){
return current < s_prof_time_end;
}
public:
static void on(int time_s){
s_prof_time_end = dcsutil::time_unixtime_us() + time_s * 1000000;
}
};
//#define _LOG_PROFILING_
#define PROFILE_ON(s) profile_t::on((s))
#ifdef _LOG_PROFILING_
#define PROFILE_FUNC() profile_t _func_prof_(__FILE__,__FUNCTION__,__LINE__)
#else
#define PROFILE_FUNC()
#endif |
//
// LMJBaseSettingViewController.h
// NetLottery
//
// Created by apple on 16/6/23.
// Copyright © 2016年 163. All rights reserved.
//
#import "LMJTableViewController.h"
#import "LMJItemSection.h"
#import "LMJWordItem.h"
#import "LMJWordArrowItem.h"
// 继承自这个基类, 设置组模型就行了, 详见Me模块的FinacialVC-Demo
@interface LMJStaticTableViewController : LMJTableViewController
// 需要把组模型添加到数据中
@property (nonatomic, strong) NSMutableArray<LMJItemSection *> *sections;
// 自定义某一行cell的时候调用super, 返回为空
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (LMJStaticTableViewController *(^)(LMJWordItem *item))addItem;
@end
UIKIT_EXTERN const UIEdgeInsets tableViewDefaultSeparatorInset;
UIKIT_EXTERN const UIEdgeInsets tableViewDefaultLayoutMargins;
|
#include "error.h"
#include <stdio.h>
#include <stdlib.h>
//------------------------------------------------------------------------------
// Throws a miscellaneous error, that may have any arbitrary error message
// passed to it.
//------------------------------------------------------------------------------
void throwErr (const char *message, const char *functionname)
{
printf("Error in function %s: %s\n", functionname, message);
exit(EXIT_FAILURE);
}
//------------------------------------------------------------------------------
// Causes a program to exit after displaying an error message, after a failed
// call to malloc (or realloc, etc).
// varname: String that should contain the name of the variable that you were
// trying to allocated memory for. This exists in order to provide more
// helpful error messages.
//------------------------------------------------------------------------------
void throwMemErr (const char *varname, const char *functionname)
{
printf("Memory allocation error: error allocating memory for variable "
"%s in %s.\n", varname, functionname);
exit(EXIT_FAILURE);
}
//------------------------------------------------------------------------------
// Raises a warning without causing program execution to terminate.
//------------------------------------------------------------------------------
void warning (const char *message, const char *functionname)
{
fprintf(stderr, "Warning in function %s: %s\n", functionname, message);
}
|
#ifndef STANDALONEFILEBROWSER_LIBRARY_H
#define STANDALONEFILEBROWSER_LIBRARY_H
#include <stdbool.h>
typedef void (*callbackFunc)(const char *);
void DialogInit();
const char* DialogOpenFilePanel(const char*, const char*, const char*, bool);
const char* DialogOpenFolderPanel(const char*, const char*, bool);
const char* DialogSaveFilePanel(const char*, const char*, const char*, const char*);
void DialogOpenFilePanelAsync(const char*, const char*, const char*, bool, callbackFunc);
void DialogOpenFolderPanelAsync(const char*, const char*, bool, callbackFunc);
void DialogSaveFilePanelAsync(const char*, const char*, const char*, const char*, callbackFunc);
#endif |
//
// WCScreenshotHelper.h
// HelloCaptureUIView
//
// Created by chenliang-xy on 15/3/13.
// Copyright (c) 2015年 chenliang-xy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WCScreenshotHelper : NSObject
+ (UIImage *)snapshotView:(UIView *)capturedView savedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
+ (UIImage *)snapshotWindow:(UIWindow *)capturedWindow savedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
+ (UIImage *)snapshotScrollView:(UIScrollView *)capturedScrollView withFullContent:(BOOL)withFullContent savedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
+ (UIImage *)snapshotScreenSavedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
+ (UIImage *)snapshotScreenAfterAlertShownSavedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
+ (UIImage *)snapshotScreenAfterActionSheetShownSavedToPhotosAlbum:(BOOL)savedToPhotosAlbum;
@end
|
/* stdlib.h
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* definitions of standard symbols in the stdlib.h header file for which the
* brainslug symbol information is available. */
#ifndef _STDLIB_H_
#define _STDLIB_H_
#define MB_CUR_MAX 6
#endif /* _STDLIB_H_ */ |
//
// RBoolean.h
// lang-objective-c
//
// Created by Łukasz Piestrzeniewicz on 09-08-23.
// Copyright 2009 Ragnarson. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "LRuntime.h"
#import "LObject.h"
/**
Adds cells and methods to true instance.
*/
@interface RTrue : NSObject {}
+ (void)addCellsTo:(LObject*)object inRuntime:(LRuntime*)runtime;
@end
@interface RFalse : NSObject {}
+ (void)addCellsTo:(LObject*)object inRuntime:(LRuntime*)runtime;
@end
|
#include<stdio.h>
#include<math.h>
int main() {
int n,s,sq,f,c,i,j;
scanf("%d",&n);
int a[n];
for(i=s=0;i<n;++i) {
scanf("%d",&a[i]);
s+=a[i];
}
for(i=1,sq=floor(sqrt(s));i<=sq;++i) {
if(s%i==0) {
for(j=c=0;(j<n)&&(c<i);++j) {
c+=a[j];
if(c==i)
c=0;
}
if(j<n)
continue;
else if(!c)
printf("%d ",i);
}
}
for(i=ceil(sqrt(s))-1;i>0;--i) {
if(s%i==0) {
f=s/i;
for(j=c=0;(j<n)&&(c<f);++j) {
c+=a[j];
if(c==f)
c=0;
}
if(j<n)
continue;
else if(!c)
printf("%d ",f);
}
}
printf("\n");
return 0;
}
|
/*
I2C Bus interface commands for Arria 10 SoC
by David M. Koltak 05/12/2016
***
Copyright (c) 2016 David M. Koltak
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 "alt_i2c.h"
#include "terminal.h"
#include "boot.h"
#include "simple_stdio.h"
#include <string.h>
#define I2C_DEVICE ALT_I2C_I2C1
#define I2C_SPEED 40000
ALT_I2C_DEV_t i2c_dev;
void i2c_init(int step)
{
ALT_STATUS_CODE status;
ALT_I2C_MASTER_CONFIG_t cfg;
uint32_t speed;
status = alt_i2c_init(I2C_DEVICE, &i2c_dev);
if (status == ALT_E_SUCCESS)
status = alt_i2c_enable(&i2c_dev);
if (status == ALT_E_SUCCESS)
status = alt_i2c_master_config_get(&i2c_dev, &cfg);
if (status == ALT_E_SUCCESS)
status = alt_i2c_master_config_speed_set(&i2c_dev, &cfg, I2C_SPEED);
if (status == ALT_E_SUCCESS)
status = alt_i2c_master_config_speed_get(&i2c_dev, &cfg, &speed);
if(status == ALT_E_SUCCESS)
{
cfg.addr_mode = ALT_I2C_ADDR_MODE_7_BIT;
cfg.restart_enable = ALT_E_TRUE;
cfg.fs_spklen = 2;
status = alt_i2c_master_config_set(&i2c_dev, &cfg);
}
if (status != ALT_E_SUCCESS)
{ puts("ERROR: I2C Init FAILED"); }
return;
}
int i2c_receive(int argc, char** argv)
{
ALT_STATUS_CODE status;
unsigned int chip;
unsigned int addr;
unsigned int cnt;
int x;
char buf[256];
//
// Parse Args
//
if (argc != 3)
{
puts("ERROR: Wrong number of arguments");
return -1;
}
if (sscanf(argv[1], "%u", &chip) != 1)
{
puts("ERROR: First argument must be an unsigned number for chip address");
return -2;
}
if (sscanf(argv[2], "%u", &cnt) != 1)
{
puts("ERROR: Second argument must be an unsigned number for byte count");
return -3;
}
if (cnt > 256)
{
puts("ERROR: Count must be < 256");
return -4;
}
//
// Read into a buffer
//
status = alt_i2c_master_target_set(&i2c_dev, chip);
if (status != ALT_E_SUCCESS)
{
puts("ERROR: Unable to set target address");
return -5;
}
status = alt_i2c_master_receive(&i2c_dev, buf, cnt, ALT_E_FALSE, ALT_E_TRUE);
if (status != ALT_E_SUCCESS)
{
puts("ERROR: Unable to perform master receive operation");
return -5;
}
//
// Display from buffer
//
for (x = 0; x < cnt; x++)
{
if ((x & 0xF) == 0)
printf("\n %02X : ", x);
printf(" %02x", ((int) buf[x]) & 0xFF);
}
printf("\n");
return 0;
}
int i2c_transmit(int argc, char** argv)
{
ALT_STATUS_CODE status;
unsigned int chip;
unsigned int addr;
unsigned int cnt;
int x;
char buf[256];
//
// Parse Args
//
if (argc < 3)
{
puts("ERROR: Wrong number of arguments");
return -1;
}
if (sscanf(argv[1], "%u", &chip) != 1)
{
puts("ERROR: First argument must be an unsigned number");
return -2;
}
for (cnt = 0; cnt < (argc - 2); cnt++)
{
if (cnt > 256)
break;
if (sscanf(argv[cnt+2], "%u", &(buf[cnt])) != 1)
{
puts("ERROR: Byte argument must be an unsigned number");
return -3;
}
}
//
// Write from a buffer
//
status = alt_i2c_master_target_set(&i2c_dev, chip);
if (status != ALT_E_SUCCESS)
{
puts("ERROR: Unable to set target address");
return -5;
}
status = alt_i2c_master_transmit(&i2c_dev, buf, cnt, ALT_E_FALSE, ALT_E_TRUE);
if (status != ALT_E_SUCCESS)
{
puts("ERROR: Unable to perform master transmit operation");
return -5;
}
//
// Display from buffer
//
for (x = 0; x < cnt; x++)
{
if ((x & 0xF) == 0)
printf("\n %02X : ", x);
printf(" %02x", ((int) buf[x]) & 0xFF);
}
printf("\n");
return 0;
}
BOOT_STEP(310, i2c_init, "init i2c bus");
TERMINAL_COMMAND("i2c-rx", i2c_receive, "{chip} {count}");
TERMINAL_COMMAND("i2c-tx", i2c_transmit, "{chip} {byte} ...");
|
/**
\file draw.h
\brief LightEngine 3D: Native OS graphic context
\brief All platforms implementation
\author Frederic Meslin (fred@fredslab.net)
\twitter @marzacdev
\website http://fredslab.net
\copyright Frederic Meslin 2015 - 2018
\version 1.75
The MIT License (MIT)
Copyright (c) 2015-2018 Frédéric Meslin
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 LE_DRAW_H
#define LE_DRAW_H
#include "global.h"
#include "config.h"
#include "bitmap.h"
#include "window.h"
/*****************************************************************************/
/**
\class LeDraw
\brief Create and handle an OS native drawing context
*/
class LeDraw
{
public:
LeDraw(LeDrawingContext context, int width = LE_RESOX_DEFAULT, int heigth = LE_RESOY_DEFAULT);
~LeDraw();
void setContext(LeDrawingContext context);
void setPixels(const void * data);
int width; /**< Width of context (in pixels) */
int height; /**< Height of context (in pixels) */
private:
LeDrawingContext frontContext;
LeHandle bitmap;
};
#endif //LE_DRAW_H
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "UIColor.h"
@interface UIColor (PUDimming)
- (id)pu_darkerColor;
@end
|
//
// LZGestureSettingViewController.h
// LZAccount
//
// Created by Artron_LQQ on 16/6/2.
// Copyright © 2016年 Artup. All rights reserved.
//
#import "LZBaseViewController.h"
typedef void (^PopBackBlock)(void);
@interface LZGestureSettingViewController : LZBaseViewController
/**
返回上一级页面时调用。请使用的人,注意避免 block造成retain-cycle
*/
@property (nonatomic, copy) PopBackBlock popBackBlock;
@property (strong, nonatomic)UIView *contendView;
@end
|
/*
The MIT License (MIT)
Copyright (c) [2019] [BTC.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.
*/
#pragma once
#include <functional>
#include <map>
#include <memory>
#include <string>
namespace prometheus {
class Metric {
public:
enum class Type {
Counter,
Gauge,
};
virtual ~Metric() = default;
virtual const std::string &getName() const = 0;
virtual Type getType() const = 0;
virtual std::string getValue() const = 0;
virtual const std::string &getHelp() const = 0;
virtual const std::map<std::string, std::string> &getLabels() const = 0;
};
} // namespace prometheus
#include "Metric.inl"
|
/*************************************************************************
> File Name: process_.c
> Author: Simba
> Mail: dameng34@163.com
> Created Time: Sat 23 Feb 2013 02:34:02 PM CST
************************************************************************/
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<fcntl.h>
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<signal.h>
#define ERR_EXIT(m) \
do { \
perror(m); \
exit(EXIT_FAILURE); \
} while(0)
int main(int argc, char *argv[])
{
int outfd = open("Makefile2", O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (outfd == -1)
ERR_EXIT("open error");
int infd;
infd = open("tp", O_RDONLY);
if (infd == -1)
ERR_EXIT("open error");
char buf[1024];
int n;
while ((n = read(infd, buf, 1024)) > 0)
write(outfd, buf, n);
close(infd);
close(outfd);
unlink("tp"); // delete a name and possibly the file it refers to
return 0;
}
|
/* $OpenBSD: print-enc.c,v 1.7 2002/02/19 19:39:40 millert Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4 2005/04/06 21:32:39 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tcpdump-stdinc.h"
#include <pcap.h>
#include "interface.h"
#include "addrtoname.h"
#include "enc.h"
#define ENC_PRINT_TYPE(wh, xf, nam) \
if ((wh) & (xf)) { \
printf("%s%s", nam, (wh) == (xf) ? "): " : ","); \
(wh) &= ~(xf); \
}
u_int
enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
{
register u_int length = h->len;
register u_int caplen = h->caplen;
int flags;
const struct enchdr *hdr;
if (caplen < ENC_HDRLEN) {
printf("[|enc]");
goto out;
}
hdr = (struct enchdr *)p;
flags = hdr->flags;
if (flags == 0)
printf("(unprotected): ");
else
printf("(");
ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
ENC_PRINT_TYPE(flags, M_CONF, "confidential");
/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));
length -= ENC_HDRLEN;
/* XXX - use the address family */
ip_print(gndo, p + ENC_HDRLEN, length);
out:
return (ENC_HDRLEN);
}
/*
* Local Variables:
* c-style: whitesmith
* c-basic-offset: 8
* End:
*/
|
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2015-2016 Baldur Karlsson
* Copyright (c) 2014 Crytek
*
* 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.
******************************************************************************/
#pragma once
inline uint32_t RecvPacket(Network::Socket *sock)
{
if(sock == NULL)
return ~0U;
uint32_t t = 0;
if(!sock->RecvDataBlocking(&t, sizeof(t)))
return ~0U;
return t;
}
template <typename PacketTypeEnum>
bool RecvPacket(Network::Socket *sock, PacketTypeEnum &type, vector<byte> &payload)
{
if(sock == NULL)
return false;
uint32_t t = 0;
if(!sock->RecvDataBlocking(&t, sizeof(t)))
return false;
uint32_t payloadLength = 0;
if(!sock->RecvDataBlocking(&payloadLength, sizeof(payloadLength)))
return false;
if(payloadLength > 0)
{
payload.resize(payloadLength);
if(!sock->RecvDataBlocking(&payload[0], payloadLength))
return false;
}
type = (PacketTypeEnum)t;
return true;
}
template <typename PacketTypeEnum>
bool RecvPacket(Network::Socket *sock, PacketTypeEnum &type, Serialiser **ser)
{
if(sock == NULL)
return false;
vector<byte> payload;
bool ret = RecvPacket(sock, type, payload);
if(!ret)
{
*ser = NULL;
return false;
}
*ser = new Serialiser(payload.size(), &payload[0], false);
return true;
}
template <typename PacketTypeEnum>
bool SendPacket(Network::Socket *sock, PacketTypeEnum type)
{
if(sock == NULL)
return false;
uint32_t t = (uint32_t)type;
if(!sock->SendDataBlocking(&t, sizeof(t)))
return false;
return true;
}
template <typename PacketTypeEnum>
bool SendPacket(Network::Socket *sock, PacketTypeEnum type, const Serialiser &ser)
{
if(sock == NULL)
return false;
uint32_t t = (uint32_t)type;
if(!sock->SendDataBlocking(&t, sizeof(t)))
return false;
uint32_t payloadLength = ser.GetOffset() & 0xffffffff;
if(!sock->SendDataBlocking(&payloadLength, sizeof(payloadLength)))
return false;
if(!sock->SendDataBlocking(ser.GetRawPtr(0), payloadLength))
return false;
return true;
}
template <typename PacketTypeEnum>
bool RecvChunkedFile(Network::Socket *sock, PacketTypeEnum packetType, const char *logfile,
Serialiser *&ser, float *progress)
{
if(sock == NULL)
return false;
vector<byte> payload;
PacketTypeEnum type;
if(!RecvPacket(sock, type, payload))
return false;
if(type != packetType)
return false;
ser = new Serialiser(payload.size(), &payload[0], false);
uint64_t fileLength;
uint32_t bufLength;
uint32_t numBuffers;
uint64_t sz = ser->GetSize();
ser->SetOffset(sz - sizeof(uint64_t) - sizeof(uint32_t) * 2);
ser->Serialise("", fileLength);
ser->Serialise("", bufLength);
ser->Serialise("", numBuffers);
ser->SetOffset(0);
FILE *f = FileIO::fopen(logfile, "wb");
if(f == NULL)
{
return false;
}
if(progress)
*progress = 0.0001f;
for(uint32_t i = 0; i < numBuffers; i++)
{
if(!RecvPacket(sock, type, payload))
{
FileIO::fclose(f);
return false;
}
if(type != packetType)
{
FileIO::fclose(f);
return false;
}
FileIO::fwrite(&payload[0], 1, payload.size(), f);
if(progress)
*progress = float(i + 1) / float(numBuffers);
}
FileIO::fclose(f);
return true;
}
template <typename PacketTypeEnum>
bool SendChunkedFile(Network::Socket *sock, PacketTypeEnum type, const char *logfile,
Serialiser &ser, float *progress)
{
if(sock == NULL)
return false;
FILE *f = FileIO::fopen(logfile, "rb");
if(f == NULL)
{
return false;
}
FileIO::fseek64(f, 0, SEEK_END);
uint64_t fileLen = FileIO::ftell64(f);
FileIO::fseek64(f, 0, SEEK_SET);
uint32_t bufLen = (uint32_t)RDCMIN((uint64_t)4 * 1024 * 1024, fileLen);
uint64_t n = fileLen / (uint64_t)bufLen;
uint32_t numBufs = (uint32_t)n;
if(fileLen % (uint64_t)bufLen > 0)
numBufs++; // last remaining buffer
ser.Serialise("", fileLen);
ser.Serialise("", bufLen);
ser.Serialise("", numBufs);
if(!SendPacket(sock, type, ser))
{
FileIO::fclose(f);
return false;
}
byte *buf = new byte[bufLen];
uint32_t t = (uint32_t)type;
if(progress)
*progress = 0.0001f;
for(uint32_t i = 0; i < numBufs; i++)
{
uint32_t payloadLength = RDCMIN(bufLen, (uint32_t)(fileLen & 0xffffffff));
FileIO::fread(buf, 1, payloadLength, f);
if(!sock->SendDataBlocking(&t, sizeof(t)) ||
!sock->SendDataBlocking(&payloadLength, sizeof(payloadLength)) ||
!sock->SendDataBlocking(buf, payloadLength))
{
break;
}
fileLen -= payloadLength;
if(progress)
*progress = float(i + 1) / float(numBufs);
}
delete[] buf;
FileIO::fclose(f);
if(fileLen != 0)
{
return false;
}
return true;
}
|
//
// SZLoginViewController.h
// VKSampleApp
//
// Created by Сергей Галездинов on 25.06.15.
// Copyright (c) 2015 Сергей Галездинов. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol SZLoginViewControllerDelegate <NSObject>
- (void) startLoginProcessWithCompletionHandler:(void(^)(NSError *error))completionHandler;
@end
@interface SZLoginViewController : UIViewController
@property (weak) id<SZLoginViewControllerDelegate> delegate;
@end
|
//
// The MIT License(MIT)
//
// Copyright(c) 2014 Demonsaw LLC
//
// 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 _EJA_KEY_
#define _EJA_KEY_
#include <memory>
#include <string>
#include <cryptopp/secblock.h>
#include "object.h"
#include "security/block_cipher.h"
#include "system/mutex/mutex.h"
#include "system/mutex/mutex_list.h"
#include "system/mutex/mutex_map.h"
#include "system/mutex/mutex_queue.h"
#include "system/mutex/mutex_vector.h"
#include "system/type.h"
namespace eja
{
class cipher : public object
{
private:
using default_cipher = aes;
protected:
block_cipher::ptr m_cipher;
mutex m_mutex;
public:
using ptr = std::shared_ptr<cipher>;
protected:
cipher() : object() { set_cipher<default_cipher>(); }
cipher(const eja::cipher& cipher) : object(cipher), m_cipher(cipher.m_cipher) { }
cipher(const size_t size) : object(size) { set_cipher<default_cipher>(); }
cipher(const std::string& id) : object(id) { set_cipher<default_cipher>(); }
cipher(const char* id) : object(id) { set_cipher<default_cipher>(); }
virtual ~cipher() override { }
public:
// Interface
virtual void clear() override;
// Encrypt
std::string encrypt(const byte* input, const size_t input_size) const { auto_lock_ref(m_mutex); return m_cipher->encrypt(input, input_size); }
std::string encrypt(const CryptoPP::SecByteBlock& input) const { auto_lock_ref(m_mutex); return m_cipher->encrypt(input); }
std::string encrypt(const std::string& input) const { auto_lock_ref(m_mutex); return m_cipher->encrypt(input); }
std::string encrypt(const char* input) const { auto_lock_ref(m_mutex); return m_cipher->encrypt(input); }
// Decrypt
std::string decrypt(const byte* input, const size_t input_size) const { auto_lock_ref(m_mutex); return m_cipher->decrypt(input, input_size); }
std::string decrypt(const CryptoPP::SecByteBlock& input) const { auto_lock_ref(m_mutex); return m_cipher->decrypt(input); }
std::string decrypt(const std::string& input) const { auto_lock_ref(m_mutex); return m_cipher->decrypt(input); }
std::string decrypt(const char* input) const { auto_lock_ref(m_mutex); return m_cipher->decrypt(input); }
// Mutator
void set_key(const byte* key, const size_t key_size) { auto_lock_ref(m_mutex); m_cipher->set_key(key, key_size); }
void set_key(const CryptoPP::SecByteBlock& key) { auto_lock_ref(m_mutex); m_cipher->set_key(key.data(), key.size()); }
void set_key(const std::string& key, const size_t key_size) { auto_lock_ref(m_mutex); m_cipher->set_key(reinterpret_cast<const byte*>(key.c_str()), key_size); }
void set_key(const std::string& key) { auto_lock_ref(m_mutex); m_cipher->set_key(reinterpret_cast<const byte*>(key.c_str()), key.size()); }
void set_key(const char* key, const size_t key_size) { auto_lock_ref(m_mutex); m_cipher->set_key(reinterpret_cast<const byte*>(key), key_size); }
void set_key(const char* key) { auto_lock_ref(m_mutex); m_cipher->set_key(reinterpret_cast<const byte*>(key), strlen(key)); }
// Utility
virtual bool valid() const override { auto_lock_ref(m_mutex); return object::valid() && has_cipher(); }
bool has_cipher() const { auto_lock_ref(m_mutex); return !m_cipher->empty(); }
// Mutator
template <typename T> void set_cipher() { auto_lock_ref(m_mutex); m_cipher = T::create(); }
void set_cipher(const block_cipher::ptr cipher) { auto_lock_ref(m_mutex); m_cipher = cipher; }
void set_cipher() { auto_lock_ref(m_mutex); m_cipher = default_cipher::create(); }
// HACK: Don't allow out-of-mutex updates!
//
// Accessor
//block_cipher::ptr get_cipher() const { return m_cipher; }
std::string get_key() const;
};
// Container
derived_type(cipher_list, mutex_list<cipher>);
derived_type(cipher_map, mutex_map<std::string, cipher>);
derived_type(cipher_queue, mutex_queue<cipher>);
derived_type(cipher_vector, mutex_vector<cipher>);
}
#endif
|
//----------------------------------------------------------------------------//
// //
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
// and distributed under the MIT License (MIT). //
// //
// Copyright (c) 2015 Guillaume Blanc //
// //
// 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 OZZ_OZZ_ANIMATION_OFFLINE_RAW_ANIMATION_UTILS_H_
#define OZZ_OZZ_ANIMATION_OFFLINE_RAW_ANIMATION_UTILS_H_
#include "ozz/animation/offline/raw_animation.h"
#include "ozz/base/maths/transform.h"
namespace ozz {
namespace animation {
namespace offline {
// Translation interpolation method.
math::Float3 LerpTranslation(const math::Float3& _a,
const math::Float3& _b,
float _alpha);
// Rotation interpolation method.
math::Quaternion LerpRotation(const math::Quaternion& _a,
const math::Quaternion& _b,
float _alpha);
// Scale interpolation method.
math::Float3 LerpScale(const math::Float3& _a,
const math::Float3& _b,
float _alpha);
} // offline
} // animation
} // ozz
#endif // OZZ_OZZ_ANIMATION_OFFLINE_RAW_ANIMATION_UTILS_H_
|
// Author: Sanya
// Description: CTypeCheckerVisitor
#pragma once
#include <AST/nodes/NodeNames.h>
#include <AST/visitors/Visitor.h>
#include <AST/nodes/AccessModifier.h>
#include <AST/nodes/Expression.h>
#include <AST/nodes/ExpressionList.h>
#include <AST/nodes/Statement.h>
#include <AST/nodes/StatementList.h>
#include <AST/nodes/TypeModifier.h>
#include <AST/nodes/VarDeclaration.h>
#include <AST/nodes/VarDeclarationList.h>
#include <AST/nodes/MethodArgument.h>
#include <AST/nodes/MethodArgumentList.h>
#include <AST/nodes/MethodDeclaration.h>
#include <AST/nodes/MethodDeclarationList.h>
#include <AST/nodes/MainClass.h>
#include <AST/nodes/ClassDeclaration.h>
#include <AST/nodes/ClassDeclarationList.h>
#include <AST/nodes/Program.h>
#include <SymbolTable.h>
#include <CompilationError.h>
namespace ASTree {
class CTypeCheckerVisitor : public CVisitor {
public:
CTypeCheckerVisitor( const CSymbolTable* _symbolTablePtr, bool _verbose = false ) :
CVisitor( _verbose ),
symbolTablePtr( _symbolTablePtr ),
lastType( { CTypeIdentifier(TTypeIdentifier::NotFound) } ),
errors( new std::vector<CCompilationError>() ) {}
~CTypeCheckerVisitor() {}
const std::vector<CCompilationError>* GetErrors() const;
// Visitors for different node types.
void Visit( const CPublicAccessModifier* modifier ) override;
void Visit( const CPrivateAccessModifier* modifier ) override;
void Visit( const CBinaryExpression* expression ) override;
void Visit( const CBracketExpression* expression ) override;
void Visit( const CNumberExpression* expression ) override;
void Visit( const CLogicExpression* expression ) override;
void Visit( const CIdExpression* expression ) override;
void Visit( const CLengthExpression* expression ) override;
void Visit( const CMethodExpression* expression ) override;
void Visit( const CThisExpression* expression ) override;
void Visit( const CNewArrayExpression* expression ) override;
void Visit( const CNewIdExpression* expression ) override;
void Visit( const CNegateExpression* expression ) override;
void Visit( const CAssignIdStatement* statement ) override;
void Visit( const CAssignIdWithIndexStatement* statement ) override;
void Visit( const CPrintStatement* statement ) override;
void Visit( const CConditionalStatement* statement ) override;
void Visit( const CWhileLoopStatement* statement ) override;
void Visit( const CBracesStatement* statement ) override;
void Visit( const CIntTypeModifier* typeModifier ) override;
void Visit( const CBooleanTypeModifier* typeModifier ) override;
void Visit( const CIntArrayTypeModifier* typeModifier ) override;
void Visit( const CIdTypeModifier* typeModifier ) override;
void Visit( const CVarDeclaration* declaration ) override;
void Visit( const CMethodArgument* argument ) override;
void Visit( const CMethodDeclaration* declaration ) override;
void Visit( const CMainClass* mainClass ) override;
void Visit( const CClassDeclaration* declaration ) override;
void Visit( const CProgram* program ) override;
void Visit( const CExpressionList* list ) override;
void Visit( const CStatementList* list ) override;
void Visit( const CVarDeclarationList* list ) override;
void Visit( const CMethodArgumentList* list ) override;
void Visit( const CMethodDeclarationList* list ) override;
void Visit( const CClassDeclarationList* list ) override;
private:
const CSymbolTable* symbolTablePtr;
std::vector<CTypeIdentifier> lastType;
std::shared_ptr<const CClassDefinition> lastClass;
std::shared_ptr<const CMethodDefinition> lastMethod;
std::string lastId;
std::vector<CCompilationError>* errors;
};
}
|
/*
* The MIT License (MIT)
* Copyright (c) 2015 SK PLANET. All Rights Reserved.
*
* 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.
*/
// TADlg.h : header file
//
#pragma once
#include "afxwin.h"
#include "rui.h"
#include "afxcmn.h"
class CDlgPreview;
extern UINT WM_TA_INIT;
extern UINT WM_TA_STATEUPDATE;
extern UINT WM_TA_LOG;
// CTADlg dialog
class CTADlg : public CDialogEx
{
// Construction
public:
CTADlg(CWnd* pParent = NULL); // standard constructor
~CTADlg();
// Dialog Data
enum { IDD = IDD_TA_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
RA* m_pra;
CDlgPreview* m_preview;
// Implementation
public:
static void OnImcomingTALog(RA* pra, void* pData, BYTE* buffer, int size);
static void OnTAState(RA* pra, void* pData, int state);
//void OnTALog(BYTE* buffer, int size);
LRESULT OnTALog(WPARAM wParam, LPARAM lParam);
void setStatus(UINT idMsg);
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
LRESULT OnRUICMD_RestartEncoder(WPARAM wParam, LPARAM lParam);
LRESULT OnRUICMD_StartStreaming (WPARAM wParam, LPARAM lParam);
LRESULT OnUpdateConnection(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
public:
void ShowFirstRun(bool bShow);
afx_msg void OnBnClickedButtonStart();
CStatic m_status;
CEdit m_talog;
afx_msg void OnBnClickedButtonStop();
CListBox m_devList;
void lock_control(bool bSet);
void lock_control_all(bool bSet);
CEdit m_taName;
afx_msg void OnBnClickedButtonPreview();
afx_msg LRESULT OnPreviewWindowClosed(WPARAM wParam, LPARAM lParam);
afx_msg void OnBnClickedButtonChangeTaserial();
CIPAddressCtrl m_taIP;
CEdit m_taPort;
CStatic m_taInternalIP;
LRESULT RefreshTAState(WPARAM wParam, LPARAM lParam);
LRESULT taInit(WPARAM wParam, LPARAM lParam);
afx_msg void OnBnClickedButtonRescan();
afx_msg void OnBnClickedCheckAutostart();
CButton m_bAutoStart;
CComboBox m_audioList;
CButton m_bForceMonkey;
afx_msg void OnBnClickedCheckForceMonkey();
afx_msg void OnDestroy();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
};
//--- util.cpp
int Message(UINT idMsg, UINT type=MB_OK);
|
//
// NSObject+Reflection.h
// Blockade
//
// Created by Dimo on 2010-07-24.
// Copyright 2010 One Day Beard. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject (Reflection)
@end
|
void sender() {
int ret = -1;
char msg[9];
msg[0] = 'h';
msg[1] = 'e';
msg[2] = 'l';
msg[3] = 'l';
msg[4] = 'o';
msg[5] = '\0';
char reply[9];
bwprintf(COM2, "Sender call send\n");
ret = Send(2, msg, 9, reply, 5);
bwprintf(COM2, "Sender receive reply: %s with origin %d char\n", reply, ret);
Exit();
}
void sr() {
int ret = -1;
int ret2;
int tid;
char rmsg[5];
char replymsg[5];
replymsg[0] = 'm';
replymsg[1] = 'i';
replymsg[2] = 'd';
replymsg[3] = '\0';
char msg[9];
msg[0] = 'm';
msg[1] = 'i';
msg[2] = 'd';
msg[3] = 's';
msg[4] = 'e';
msg[5] = 'n';
msg[6] = 'd';
msg[7] = '\0';
char reply[9];
while (1) {
bwprintf(COM2, "sr call receive\n");
ret = Receive(&tid, rmsg, 5);
if (ret > 0) {
bwprintf(COM2, "sr receive: %s with origin %d char\n", rmsg, ret);
bwprintf(COM2, "sr reply to %d\n", tid);
ret2 = Reply(tid, replymsg, 5);
bwprintf(COM2, "sr ret value: %d\n", ret2);
ret = Send(1, msg, 9, reply, 2);
bwprintf(COM2, "sr receive reply: %s with origin %d char\n", reply, ret);
}
}
}
void receiver() {
int ret = -1;
int ret2;
int tid;
char msg[5];
char replymsg[5];
replymsg[0] = 'c';
replymsg[1] = 'a';
replymsg[2] = 'o';
replymsg[3] = '\0';
while (1) {
bwprintf(COM2, "Receiver call receive\n");
ret = Receive(&tid, msg, 5);
if (ret > 0) {
bwprintf(COM2, "Receive msg: %s with origin %d char\n", msg, ret);
bwprintf(COM2, "Receiver reply to %d\n", tid);
ret2 = Reply(tid, replymsg, 5);
bwprintf(COM2, "Reply ret value: %d\n", ret2);
}
}
}
void user_program() {
int tid = -1;
tid = Create(7, receiver);
bwprintf(COM2, "Created: %d\n", tid);
tid = Create(4, sr);
bwprintf(COM2, "Created: %d\n", tid);
tid = Create(3, sender);
bwprintf(COM2, "First: exiting\n");
Exit();
}
|
#ifndef GAMEPLAY_STATE_H
#define GAMEPLAY_STATE_H
#include "game.h"
#include "render-list.h"
struct gameplay_state {
size_t handle_size;
void (*init)(void *handle, const struct game *game);
void (*fini)(const void *handle);
void (*step)(void *handle, const struct input_state *input,
struct render_list *list);
};
#define GAMEPLAY_STATE_INIT(s, name) {\
s->handle_size = sizeof(struct name##_state);\
s->init = gameplay_##name##_init; \
s->fini = gameplay_##name##_fini; \
s->step = gameplay_##name##_step; \
}
void gameplay_startscreen(struct gameplay_state *s);
void gameplay_level(struct gameplay_state *s);
void gameplay_treasure(struct gameplay_state *s);
void gameplay_test(struct gameplay_state *s);
#endif
|
//
// TestModel.h
// RosettaStoneKit
//
// Created by Chris Stephan on 3/7/15.
// The MIT License (MIT)
// Copyright (c) 2015 Chris Stephan
// 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>
NS_ASSUME_NONNULL_BEGIN
@interface TestModel : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSNumber *ID;
@property (nonatomic, assign) int integerCount;
@property (nonatomic, assign) double doubleCount;
@property (nonatomic, assign) float floatCount;
@property (nonatomic, assign) BOOL active;
@end
NS_ASSUME_NONNULL_END |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
@class NSArray, NSDictionary, NSString;
@protocol DVTObserveXPCServicesProtocol
- (void)debugLaunchDaemonWithSpecifier:(NSString *)arg1 programPath:(NSString *)arg2 args:(NSArray *)arg3 env:(NSDictionary *)arg4 startSuspended:(BOOL)arg5;
- (void)enableExtensionWithIdentifier:(NSString *)arg1;
- (void)stopObservingServicesForPid:(int)arg1;
- (void)observerServiceNamed:(NSString *)arg1 parentPid:(int)arg2 args:(NSArray *)arg3 env:(NSDictionary *)arg4 startSuspended:(BOOL)arg5 interposeBinaryAtPath:(NSString *)arg6;
@end
|
// The MIT License (MIT)
//
// Copyright (c) 2015 Alexander Grebenyuk (github.com/kean).
//
// 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>
#import <FLAnimatedImage/FLAnimatedImage.h>
/*! The DFAnimatedImage subclasses UIImage and represents a poster image for the underlying animated image. It is a regular UIImage that doesn't override any of the native UIImage behaviors it can be used anywhere where a regular `UIImage` can be used.
*/
@interface DFAnimatedImage : UIImage
/* The animated image that the receiver was initialized with. An `FLAnimatedImage`'s job is to deliver frames in a highly performant way and works in conjunction with `FLAnimatedImageView`.
*/
@property (nonatomic, readonly) FLAnimatedImage *animatedImage;
/*! Initializes the DFAnimatedImage with an instance of FLAnimatedImage class.
*/
- (instancetype)initWithAnimatedImage:(FLAnimatedImage *)animatedImage NS_DESIGNATED_INITIALIZER;
/*! Initializes the DFAnimatedImage with an instance of FLAnimatedImage class created from a given data.
*/
- (instancetype)initWithAnimatedGIFData:(NSData *)data;
/*! Returns the DFAnimatedImage object with an instance of FLAnimatedImage class created from a given data.
*/
+ (instancetype)animatedImageWithGIFData:(NSData *)data;
/*! Returns YES if the data represents an animated GIF.
*/
+ (BOOL)isAnimatedGIFData:(NSData *)data;
@end
|
#ifndef __SNEAKY_BUTTON_SKINNED_H__
#define __SNEAKY_BUTTON_SKINNED_H__
#include "SneakyButton.h"
class SneakyButtonSkinnedBase : public cocos2d::CCLayer
{
CC_SYNTHESIZE_READONLY(cocos2d::CCSprite *, defaultSprite, DefaultSprite);
CC_SYNTHESIZE_READONLY(cocos2d::CCSprite *, activatedSprite, ActivatedSprite);
CC_SYNTHESIZE_READONLY(cocos2d::CCSprite *, disabledSprite, DisabledSprite);
CC_SYNTHESIZE_READONLY(cocos2d::CCSprite *, pressSprite, PressSprite);
CC_SYNTHESIZE_READONLY(SneakyButton *, button, Button); //Not sure about this
//Public methods
CREATE_FUNC(SneakyButtonSkinnedBase);
virtual ~SneakyButtonSkinnedBase();
bool init();
void watchSelf(float delta);
void setContentSize(cocos2d::CCSize s);
void setDefaultSprite(cocos2d::CCSprite *aSprite);
void setActivatedSprite(cocos2d::CCSprite *aSprite);
void setDisabledSprite(cocos2d::CCSprite *aSprite);
void setPressSprite(cocos2d::CCSprite *aSprite);
void setButton(SneakyButton *aButton);
};
#endif
|
#include <sys/param.h>
#include <stdio.h>
#include <unistd.h>
#include <openssl/ssl.h>
#include <fsyscall/private/fmhub.h>
static void
get_fork_sock(char *buf, size_t bufsize)
{
snprintf(buf, bufsize, "/tmp/fmhub.%d", getpid());
}
int
fsyscall_run_master_nossl(int shub2mhub, int mhub2shub, int argc,
char *const argv[], char *const envp[])
{
int retval;
char fork_sock[MAXPATHLEN];
get_fork_sock(fork_sock, sizeof(fork_sock));
retval = fmhub_run_nossl(shub2mhub, mhub2shub, argc, argv, envp,
fork_sock);
return (retval);
}
int
fsyscall_run_master_ssl(SSL *ssl, int argc, char *const argv[],
char *const envp[])
{
int retval;
char fork_sock[MAXPATHLEN];
get_fork_sock(fork_sock, sizeof(fork_sock));
retval = fmhub_run_ssl(ssl, argc, argv, envp, fork_sock);
return (retval);
}
|
// -*- C++ -*-
//=============================================================================
/**
* @file os_inttypes.h
*
* fixed size integer types
*
* $Id: os_inttypes.h 14 2007-02-01 15:49:12Z mitza $
*
* @author Don Hinton <dhinton@dresystems.com>
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
#ifndef ACE_OS_INCLUDE_OS_INTTYPES_H
#define ACE_OS_INCLUDE_OS_INTTYPES_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/os_include/os_stdint.h"
#if !defined (ACE_LACKS_INTTYPES_H)
# include /**/ <inttypes.h>
#endif /* !ACE_LACKS_INTTYPES_H */
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
// @todo if needbe, we can define the macros if they aren't available.
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_INTTYPES_H */
|
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2013 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_phalcon.h"
#include "phalcon.h"
#include "kernel/main.h"
/**
* Phalcon\EscaperInterface initializer
*/
PHALCON_INIT_CLASS(Phalcon_EscaperInterface){
PHALCON_REGISTER_INTERFACE(Phalcon, EscaperInterface, escaperinterface, phalcon_escaperinterface_method_entry);
return SUCCESS;
}
/**
* Sets the encoding to be used by the escaper
*
* @param string $encoding
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, setEncoding);
/**
* Returns the internal encoding used by the escaper
*
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, getEncoding);
/**
* Sets the HTML quoting type for htmlspecialchars
*
* @param int $quoteType
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, setHtmlQuoteType);
/**
* Escapes a HTML string
*
* @param string $text
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, escapeHtml);
/**
* Escapes a HTML attribute string
*
* @param string $text
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, escapeHtmlAttr);
/**
* Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal representation
*
* @param string $css
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, escapeCss);
/**
* Escape Javascript strings by replacing non-alphanumeric chars by their hexadecimal representation
*
* @param string $js
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, escapeJs);
/**
* Escapes a URL. Internally uses rawurlencode
*
* @param string $url
* @return string
*/
PHALCON_DOC_METHOD(Phalcon_EscaperInterface, escapeUrl);
|
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
http://www.cocos2d-x.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.
****************************************************************************/
#ifndef __CCCOLLIDERDETECTOR_H__
#define __CCCOLLIDERDETECTOR_H__
#include "editor-support/cocostudio/CCArmatureDefine.h"
#include "editor-support/cocostudio/CCDatas.h"
#include "editor-support/cocostudio/CocosStudioExport.h"
#ifndef PT_RATIO
#define PT_RATIO 32
#endif
#if ENABLE_PHYSICS_CHIPMUNK_DETECT
#include "chipmunk/chipmunk.h"
#elif ENABLE_PHYSICS_BOX2D_DETECT
#include "Box2D/Box2D.h"
#endif
namespace cocostudio {
class Bone;
/**
* @js NA
* @lua NA
*/
class CC_STUDIO_DLL ColliderFilter
{
public:
virtual ~ColliderFilter() { }
#if ENABLE_PHYSICS_BOX2D_DETECT
public:
ColliderFilter(uint16 categoryBits = 0x0001, uint16 maskBits = 0xFFFF, int16 groupIndex = 0);
void updateShape(b2Fixture *fixture);
virtual void setCategoryBits(uint16 categoryBits) { _categoryBits = categoryBits; }
virtual uint16 getCategoryBits() const { return _categoryBits; }
virtual void setMaskBits(uint16 maskBits) { _maskBits = maskBits; }
virtual uint16 getMaskBits() const { return _maskBits; }
virtual void setGroupIndex(int16 groupIndex) { _groupIndex = groupIndex; }
virtual int16 getGroupIndex() const { return _groupIndex; }
protected:
uint16 _categoryBits;
uint16 _maskBits;
int16 _groupIndex;
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
public:
ColliderFilter(cpCollisionType collisionType = 0, cpGroup group = 0);
void updateShape(cpShape *shape);
virtual void setCollisionType(cpCollisionType collisionType) { _collisionType = collisionType; }
virtual cpCollisionType getCollisionType() const { return _collisionType; }
virtual void setGroup(cpGroup group) { _group = group; }
virtual cpGroup getGroup() const { return _group; }
protected:
cpCollisionType _collisionType;
cpGroup _group;
#endif
};
class CC_STUDIO_DLL ColliderBody : public cocos2d::Ref
{
public:
ColliderBody(ContourData *contourData);
~ColliderBody();
inline ContourData *getContourData() { return _contourData; }
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
void setColliderFilter(ColliderFilter *filter);
ColliderFilter *getColliderFilter();
#endif
#if ENABLE_PHYSICS_BOX2D_DETECT
virtual void setB2Fixture(b2Fixture *fixture) { _fixture = fixture; }
virtual b2Fixture *getB2Fixture() const { return _fixture; }
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
virtual void setShape(cpShape *shape) { _shape = shape; }
virtual cpShape *getShape() const { return _shape; }
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
virtual const std::vector<cocos2d::Vec2> &getCalculatedVertexList() const { return _calculatedVertexList; }
#endif
private:
#if ENABLE_PHYSICS_BOX2D_DETECT
b2Fixture *_fixture;
ColliderFilter *_filter;
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
cpShape *_shape;
ColliderFilter *_filter;
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
std::vector<cocos2d::Vec2> _calculatedVertexList;
#endif
ContourData *_contourData;
friend class ColliderDetector;
};
/*
* @brief ContourSprite used to draw the contour of the display
* @js NA
* @lua NA
*/
class CC_STUDIO_DLL ColliderDetector : public cocos2d::Ref
{
public:
static ColliderDetector *create();
static ColliderDetector *create(Bone *bone);
public:
/**
* @js ctor
*/
ColliderDetector();
/**
* @js NA
* @lua NA
*/
~ColliderDetector(void);
virtual bool init();
virtual bool init(Bone *bone);
void addContourData(ContourData *contourData);
void addContourDataList(cocos2d::Vector<ContourData*> &contourDataList);
void removeContourData(ContourData *contourData);
void removeAll();
void updateTransform(cocos2d::Mat4 &t);
void setActive(bool active);
bool getActive();
const cocos2d::Vector<ColliderBody*>& getColliderBodyList();
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
virtual void setColliderFilter(ColliderFilter *filter);
virtual ColliderFilter *getColliderFilter();
#endif
virtual void setBone(Bone *bone) { _bone = bone; }
virtual Bone *getBone() const { return _bone; }
#if ENABLE_PHYSICS_BOX2D_DETECT
virtual void setBody(b2Body *body);
virtual b2Body *getBody() const;
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
virtual void setBody(cpBody *body);
virtual cpBody *getBody() const;
#endif
protected:
cocos2d::Vector<ColliderBody*> _colliderBodyList;
Bone *_bone;
#if ENABLE_PHYSICS_BOX2D_DETECT
b2Body *_body;
ColliderFilter *_filter;
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
cpBody *_body;
ColliderFilter *_filter;
#endif
protected:
bool _active;
};
}
#endif /*__CCCOLLIDERDETECTOR_H__*/
|
//
// UIButtonK.h
// GYBase
//
// Created by doit on 16/4/22.
// Copyright © 2016年 kenshin. All rights reserved.
//
/*
UIControl 完全可以代替 UIButton 并且 UIControl 中还可以添加视图 所以它用起来会比UIButton 更方便 好用.
本类为自己封装的UIControl
功能描述:
1.可以通过代码块的回调 设置触发的事件内容
2.可以直接通过图片名称 设置背景图片 和 高亮背景图片,如果传入的名称有无 将显示默认图片。
3.UI圆角
*/
#import <UIKit/UIKit.h>
@interface FXW_Control : UIControl
//定义一个代码块 类型 叫 clickControl
typedef void (^FXW_ControlBlock)(FXW_Control *control);
/**
点击事件回调
@param block FXW_ControlBlock
*/
- (void)clickControlWithResultBlock:(FXW_ControlBlock)block;
@end
|
//
// InPageSearchViewController.h
// DocReader
//
// Created by pei hao on 13-11-2.
// Copyright (c) 2013年 pei hao. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface TDBarView : NSView
@end
|
//
// UAEC2CopySnapshotResponse.h
// AWS iOS SDK
//
// Copyright © Unsigned Apps 2014. See License file.
// Created by Rob Amos.
//
//
#import "UAEC2Response.h"
@interface UAEC2CopySnapshotResponse : UAEC2Response
@property (nonatomic, copy) NSString *snapshotID;
@end
|
//
// MKMapView+Zooming.h
// myfab5
//
// Created by John Gulbronson on 2/15/13.
// Copyright (c) 2013 myfab5. All rights reserved.
//
#import <MapKit/MapKit.h>
@interface MKMapView (Zooming)
- (void)zoomToFitMapAnnotations;
- (void)zoomToFitMapAnnotationsAnimated:(BOOL)animated;
- (void)zoomToFitMapAnnotationsExpandX:(CGFloat)x expandY:(CGFloat)y;
- (void)zoomToFitMapAnnotationsExpandX:(CGFloat)x expandY:(CGFloat)y animated:(BOOL)animated;
@end
|
//
// CollectionViewController.h
// ZKLocationCodeDemo
//
// Created by 王振坤 on 2017/1/24.
// Copyright © 2017年 伟东云教育. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CollectionViewController : UICollectionViewController
@end
|
/*
* File: Functions.c
* Author: Zac Kilburn
*
* Created on May 31, 2015
*/
#include "xc.h"
#include "pps.h"
#include "PinDef.h"
#include "ADDRESSING.h"
#include <libpic30.h>
#include <stdio.h>
#include <stdbool.h>
#include "Functions.h"
extern void PWM_Init(void);
void Setup(void) {
__C30_UART=2;
PinSetMode();
// setup internal clock for 72MHz/36MIPS
// 12/2=6*24=132/2=72
CLKDIVbits.PLLPRE = 0; // PLLPRE (N2) 0=/2
PLLFBD = 22; // pll multiplier (M) = +2
CLKDIVbits.PLLPOST = 0; // PLLPOST (N1) 0=/2
// Initiate Clock Switch to Primary Oscillator with PLL (NOSC = 0b011)
__builtin_write_OSCCONH(0x03);
__builtin_write_OSCCONL(OSCCON | 0x01);
// Wait for Clock switch to occur
while (OSCCONbits.COSC != 0b011);
while (!OSCCONbits.LOCK); // wait for PLL ready
INTCON1bits.NSTDIS = 1; //No nesting of interrupts
PPSUnLock;
//RX0/TX0 -- RS485-1 (U3) --SAS -DDS
Pin_42_Output = TX1_Output;
RX1_Pin_Map = 43;
//RX1/TX1 -- RS485-2 (U1) --BMM -MCS
Pin_49_Output = TX2_Output;
RX2_Pin_Map = 48;
//RX/TX --SWITCH becomes RX3/TX3 (USB) -> RX4/TX4 (WIRELESS)
Pin_55_Output = TX3_Output;
RX3_Pin_Map = 56;
//RX2/TX2 -- RS485 Full Duplex --Telem Master
Pin_70_Output = TX4_Output;
RX4_Pin_Map = 57;
PPSout(_OC1, _RP37);
PPSLock;
UART_init();
UART1_init();
UART2_init();
UART3_init();
begin(receiveArray, sizeof (receiveArray), ECU_ADDRESS, false, Send_put, Receive_get, Receive_available, Receive_peek);
begin1(receiveArray1, sizeof (receiveArray1), ECU_ADDRESS, false, Send_put1, Receive_get1, Receive_available1, Receive_peek1);
begin2(receiveArray2, sizeof (receiveArray2), ECU_ADDRESS, false, Send_put2, Receive_get2, Receive_available2, Receive_peek2);
begin3(receiveArray3, sizeof (receiveArray3), ECU_ADDRESS, false, Send_put3, Receive_get3, Receive_available3, Receive_peek3);
PWM_Init();
initTimerOne();
}
void Delay(int wait) {
int x;
for (x = 0; x < wait; x++) {
delay_ms(1); //using predef fcn
}
}
void PinSetMode(void) {
TRISBbits.TRISB10=INPUT;
TRISEbits.TRISE13 = OUTPUT; //Set LED as output
TRISBbits.TRISB6 = OUTPUT; //Set Brake Light as OUTPUT
TRISBbits.TRISB5 = OUTPUT; //Set HORN PWM as OUTPUT
SS_state_TRS = OUTPUT; //Set Safty feedback as input
RS485_1_Direction_Tris = OUTPUT;
RS485_2_Direction_Tris = OUTPUT;
RS485_1_Direction = LISTEN;
RS485_2_Direction = LISTEN;
TRISCbits.TRISC10=OUTPUT;
LATCbits.LATC10 = 0;
ANSELCbits.ANSC0 = 0;
//RX0_Tris=OUTPUT;
//TX0_Tris=OUTPUT;
//RX1_Tris=OUTPUT;
//TX1_Tris=OUTPUT;
//RX_Tris=OUTPUT;
//TX_Tris=OUTPUT;
//RX2_Tris=OUTPUT;
//TX2_Tris=OUTPUT;
}
|
#ifndef ZCODERZ_VPX_H
#define ZCODERZ_VPX_H
#define VPX_CODEC_DISABLE_COMPAT 1
#include <stdio.h>
#include <vpx/vpx_decoder.h>
#include <vpx/vp8dx.h>
// #define IVF_FILE_HDR_SZ (32)
// #define IVF_FRAME_HDR_SZ (12)
typedef struct {
VpxVideoStreamReader *reader;
const VpxVideoInfo *info;
const VpxInterface *decoder;
size_t net_packet_size;
size_t net_buf_fill;
size_t net_buf_size;
uint8_t *net_buf;
vpx_codec_iter_t iter;
vpx_codec_ctx_t codec;
vp8_postproc_cfg_t postproc;
vpx_image_t *vpx_img;
} Stream;
void version();
Stream* create_stream(uint8_t *header, size_t net_packet_size, size_t net_buf_size);
size_t stream_width(Stream *stream);
size_t stream_height(Stream *stream);
uint8_t destroy_stream(Stream *stream);
float stream_get_buff_fill(Stream *stream);
uint8_t stream_flush(Stream *stream);
uint8_t stream_seek(Stream *stream, size_t index);
uint8_t stream_write(Stream *stream, const uint8_t *data, const size_t data_size);
uint8_t stream_write_chunk(Stream *stream, const uint8_t *data, const size_t data_size);
uint8_t stream_parse(Stream *stream, uint8_t *gl_rgb_buf, size_t *net_bytes_read);
uint8_t stream_parse_yuv(Stream *stream, uint8_t *gl_luma_buf, uint8_t *gl_chromaB_buf, uint8_t *gl_chromaR_buf, size_t *net_bytes_read);
#endif
|
/*
* Copyright (c) 2016 Boulanger Guillaume, Chathura Namalgamuwa
* The file is distributed under the MIT license
* The license is available in the LICENSE file or at https://github.com/boulangg/phoenix/blob/master/LICENSE
*/
#include <stdio.h>
#include "io.h"
int vsscanf(const char* s, const char* format, va_list arg) {
FILE str;
bufToFile(&str, (char*)s, (size_t)-1);
int res = vfscanf(&str, format, arg);
return res;
}
|
/* -*- C++ -*- */
// $Id: HTTP_URL.h 80826 2008-03-04 14:51:23Z wotte $
// ============================================================================
//
// = LIBRARY
// examples/Web_Crawler
//
// = FILENAME
// HTTP_URL.h
//
// = AUTHOR
// Douglas C. Schmidt <schmidt@cs.wustl.edu>
//
// ============================================================================
#ifndef _HTTP_URL_H
#define _HTTP_URL_H
#include "URL_Status.h"
#include "URL.h"
#include "Options.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
class HTTP_URL : public URL
{
// = TITLE
// An ADT for an HTTP URL.
//
// = DESCRIPTION
// This class plays the "element" role in the Visitor pattern.
public:
HTTP_URL (const ACE_URL_Addr &url_addr,
HTTP_URL *containing_page = 0);
// The <url_addr> is the URL that we're going to be visiting. We
// also keep track of the containing page, if any, which is used to
// print out more meaningful messages.
virtual int accept (URL_Visitor *visitor);
// Accept the visitor, which will then perform a particular
// visitation strategy on the URL. This method is part of the
// Visitor pattern.
virtual ssize_t send_request (void);
// Send a <GET> command to fetch the contents in the URI from the
// server.
virtual const ACE_URL_Addr &url_addr (void) const;
// Returns the URL that we represent.
int destroy (void);
// Commit suicide
private:
ACE_URL_Addr url_addr_;
// Address of the URL we're connected to.
HTTP_URL *containing_page_;
// Page that contained us.
};
#endif /* _HTTP_URL_H */
|
#ifndef ROBOTMAP_H
#define ROBOTMAP_H
#include "WPILib.h"
/**
* The RobotMap is a mapping from the ports sensors and actuators are wired into
* to a variable name. This provides flexibility changing wiring, makes checking
* the wiring easier and significantly reduces the number of magic numbers
* floating around.
*/
// For example to map the left and right motors, you could define the
// following variables to use with your drivetrain subsystem.
//const int LEFTMOTOR = 1;
//const int RIGHTMOTOR = 2;
// If you are using multiple modules, make sure to define both the port
// number and the module. For example you with a rangefinder:
//const int RANGE_FINDER_PORT = 1;
//const int RANGE_FINDER_MODULE = 1;
namespace RobotMap {
const int FRONT_LEFT_MOTOR = 0;
const int BACK_LEFT_MOTOR = 1;
const int FRONT_RIGHT_MOTOR = 2;
const int BACK_RIGHT_MOTOR = 3;
const int RIGHT_SHOOTER_MOTOR = 4;
const int LEFT_SHOOTER_MOTOR = 5;
const int INTAKE_MOTOR = 6;
const int LIFT_MOTOR = 7;
}
#endif
|
/* ------------------------------------------------ dramamovie.h -------------------------------------------------------
Created by Garrett Singletary and Cody Snow on 12/01/2016
CSS343 Assignment #4
Date of Last Modification: 12/14/2016
-----------------------------------------------------------------------------------------------------------------------
This class defines the functionality of a classic movie.
-----------------------------------------------------------------------------------------------------------------------
*/
#ifndef DRAMAMOVIE_H
#define DRAMAMOVIE_H
#include "movie.h"
class DramaMovie: public Movie {
public:
DramaMovie(int, string, string, int);
bool operator<(const DramaMovie&) const;
bool operator>(const DramaMovie&) const;
bool operator==(const DramaMovie&) const;
};
#endif //INC_343A4_DRAMAMOVIE_H
|
#pragma once
#include "MpoSite.h"
#include <h5pp/details/h5ppHid.h>
#include <math/tenx/fwd_decl.h>
class LBit : public MpoSite {
private:
h5tb_lbit h5tb;
// [[nodiscard]] double get_field() const;
// [[nodiscard]] double get_coupling() const;
public:
LBit(ModelType model_type_, size_t position_);
[[nodiscard]] std::unique_ptr<MpoSite> clone() const override;
[[nodiscard]] Eigen::Tensor<cplx, 4> MPO_nbody_view(std::optional<std::vector<size_t>> nbody,
std::optional<std::vector<size_t>> skip = std::nullopt) const override;
[[nodiscard]] Eigen::Tensor<cplx, 4> MPO_reduced_view() const override;
[[nodiscard]] Eigen::Tensor<cplx, 4> MPO_reduced_view(double site_energy) const override;
[[nodiscard]] long get_spin_dimension() const override;
[[nodiscard]] TableMap get_parameters() const override;
[[nodiscard]] bool is_perturbed() const override;
// [[nodiscard]] Eigen::MatrixXcd single_site_hamiltonian(size_t position, size_t sites, std::vector<Eigen::MatrixXcd> &SX, std::vector<Eigen::MatrixXcd>
// &SY,
// std::vector<Eigen::MatrixXcd> &SZ) const override;
//
void print_parameter_names() const override;
void print_parameter_values() const override;
void set_parameters(TableMap ¶meters) override;
void set_perturbation(double coupling_ptb, double field_ptb, PerturbMode ptbMode) override;
void build_mpo() override;
void randomize_hamiltonian() override;
void set_averages(std::vector<TableMap> all_parameters, bool infinite = false, bool reverse = false) override;
void save_hamiltonian(h5pp::File &file, std::string_view table_path) const override;
void load_hamiltonian(const h5pp::File &file, std::string_view model_prefix) override;
};
|
#ifndef SPLATT_STATS_H
#define SPLATT_STATS_H
#include "base.h"
/******************************************************************************
* STRUCTURES
*****************************************************************************/
/**
* @brief The types of tensor statistics available.
*/
typedef enum
{
STATS_BASIC, /** Dimensions, nonzero count, and density. */
STATS_HPARTS, /** Hypergraph partitioning information. Requires MODE */
STATS_ERROR,
} splatt_stats_type;
/******************************************************************************
* INCLUDES
*****************************************************************************/
#include "sptensor.h"
#include "csf.h"
#include "cpd.h"
#include "splatt_mpi.h"
/******************************************************************************
* PUBLIC FUNCTIONS
*****************************************************************************/
#define stats_tt splatt_stats_tt
/**
* @brief Output statistics about a sparse tensor.
*
* @param tt The sparse tensor to inspect.
* @param ifname The filename of the tensor. Can be NULL.
* @param type The type of statistics to output.
* @param mode The mode of tt to operate on, if applicable.
* @param pfile The partitioning file to work with, if applicable.
*/
void stats_tt(
sptensor_t * const tt,
char const * const ifname,
splatt_stats_type const type,
idx_t const mode,
char const * const pfile);
#define stats_csf splatt_stats_csf
/**
* @brief Output statistics about a CSF tensor.
*
* @param ct The CSF tensor to analyze.
*/
void stats_csf(
splatt_csf const * const ct);
#define cpd_stats splatt_cpd_stats
/**
* @brief Output work-related statistics before a CPD factorization. This
* includes rank, #threads, tolerance, etc.
*
* @param csf The CSF tensor we are factoring.
* @param nfactors The number of factors.
* @param opts Other CPD options.
*/
void cpd_stats(
splatt_csf const * const csf,
idx_t const nfactors,
double const * const opts);
/******************************************************************************
* MPI FUNCTIONS
*****************************************************************************/
#ifdef SPLATT_USE_MPI
#define mpi_cpd_stats splatt_mpi_cpd_stats
/**
* @brief Output work-related statistics before a CPD factorization. This
* includes rank, #threads, tolerance, etc.
*
* @param csf The CSF tensor we are factoring.
* @param nfactors The number of factors.
* @param opts Other CPD options.
* @param rinfo MPI rank information.
*/
void mpi_cpd_stats(
splatt_csf const * const csf,
idx_t const nfactors,
double const * const opts,
rank_info * const rinfo);
#define mpi_global_stats splatt_mpi_global_stats
/**
* @brief Copy global information into local tt, print statistics, and
* restore local information.
*
* @param tt The tensor to hold global information.
* @param rinfo Global tensor information.
*/
void mpi_global_stats(
sptensor_t * const tt,
rank_info * const rinfo,
char const * const ifname);
#define mpi_rank_stats splatt_mpi_rank_stats
/**
* @brief Output statistics about MPI rank information.
*
* @param tt The tensor we are operating on.
* @param rinfo MPI rank information.
* @param args Some CPD parameters.
*/
void mpi_rank_stats(
sptensor_t const * const tt,
rank_info const * const rinfo);
#endif /* endif SPLATT_USE_MPI */
#endif
|
//
// BLKSTLSM330GyroDriver.h
// BLEKit
//
// Created by Igor Sales on 2014-11-13.
// Copyright (c) 2014 IgorSales.ca. All rights reserved.
//
#import <BLEKit/BLKI2CDriver.h>
typedef enum {
BLKSTLSM330GyroDriverPowerDown = 0x00,
BLKSTLSM330GyroDriverODR_95Hz_Cutoff_12_5Hz = 0x01,
BLKSTLSM330GyroDriverODR_95Hz_Cutoff_25Hz = 0x03,
BLKSTLSM330GyroDriverODR_95Hz_Cutoff_25Hz_2 = 0x05,
BLKSTLSM330GyroDriverODR_95Hz_Cutoff_25Hz_3 = 0x07,
BLKSTLSM330GyroDriverODR_190Hz_Cutoff_12_5Hz = 0x09,
BLKSTLSM330GyroDriverODR_190Hz_Cutoff_25Hz = 0x0b,
BLKSTLSM330GyroDriverODR_190Hz_Cutoff_50Hz = 0x0d,
BLKSTLSM330GyroDriverODR_190Hz_Cutoff_70Hz = 0x0f,
BLKSTLSM330GyroDriverODR_380Hz_Cutoff_20Hz = 0x11,
BLKSTLSM330GyroDriverODR_380Hz_Cutoff_25Hz = 0x13,
BLKSTLSM330GyroDriverODR_380Hz_Cutoff_50Hz = 0x15,
BLKSTLSM330GyroDriverODR_380Hz_Cutoff_100Hz = 0x17,
BLKSTLSM330GyroDriverODR_760Hz_Cutoff_30Hz = 0x19,
BLKSTLSM330GyroDriverODR_760Hz_Cutoff_35Hz = 0x1b,
BLKSTLSM330GyroDriverODR_760Hz_Cutoff_50Hz = 0x1d,
BLKSTLSM330GyroDriverODR_760Hz_Cutoff_100Hz = 0x1f,
BLKSTLSM330GyroDriverOperatingModeMask = 0x1F
} BLKSTLSM330GyroDriverOperatingMode;
@class BLKSTLSM330GyroDriver;
@protocol BLKSTLSM330GyroDriverDelegate <NSObject>
- (void)driver:(BLKSTLSM330GyroDriver*)driver axisDataX:(int16_t)x Y:(int16_t)y Z:(int16_t)Z;
- (void)driverReadFailed:(BLKSTLSM330GyroDriver *)driver;
- (void)driverWriteFailed:(BLKSTLSM330GyroDriver *)driver;
@end
@interface BLKSTLSM330GyroDriver : BLKI2CDriver
@property (nonatomic, weak) id<BLKSTLSM330GyroDriverDelegate> delegate;
- (void)setOperatingMode:(BLKSTLSM330GyroDriverOperatingMode)mode;
- (void)readAxisData;
@end
|
// set111.h //
int set111lightlow = 55;
int set111blastdelay = 950;
int set111flatdelay = 225;
void set111()
{
/*
digitalWrite(R, LOW);
digitalWrite(G, LOW);
digitalWrite(B, LOW);
delay(set111flatdelay);
*/
digitalWrite(R, HIGH);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
analogWrite(R, set111lightlow);
digitalWrite(G, HIGH);
analogWrite(B, set111lightlow);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
digitalWrite(B, HIGH);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
analogWrite(R, set111lightlow);
digitalWrite(G, HIGH);
analogWrite(B, set111lightlow);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
digitalWrite(B, HIGH);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
analogWrite(R, set111lightlow);
digitalWrite(G, HIGH);
analogWrite(B, set111lightlow);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
digitalWrite(R, HIGH);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
digitalWrite(R, HIGH);
digitalWrite(G, HIGH);
digitalWrite(B, HIGH);
delay(set111blastdelay);
analogWrite(R, set111lightlow);
analogWrite(G, set111lightlow);
analogWrite(B, set111lightlow);
delay(set111flatdelay);
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_environment_execlp_01.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-01.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: environment Read input from an environment variable
* GoodSource: Fixed string
* Sink: execlp
* BadSink : execute command with execlp
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#define ENV_VARIABLE "ADD"
#ifdef _WIN32
#define GETENV getenv
#else
#define GETENV getenv
#endif
#ifdef _WIN32
#include <process.h>
#define EXECLP _execlp
#else /* NOT _WIN32 */
#define EXECLP execlp
#endif
#ifndef OMITBAD
void CWE78_OS_Command_Injection__char_environment_execlp_01_bad()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
/* execlp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
/* execlp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
void CWE78_OS_Command_Injection__char_environment_execlp_01_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__char_environment_execlp_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_environment_execlp_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_file_w32_execvp_53b.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-53b.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: file Read input from a file
* GoodSource: Fixed string
* Sink: w32_execvp
* BadSink : execute command with execvp
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <process.h>
#define EXECVP _execvp
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__char_file_w32_execvp_53c_badSink(char * data);
void CWE78_OS_Command_Injection__char_file_w32_execvp_53b_badSink(char * data)
{
CWE78_OS_Command_Injection__char_file_w32_execvp_53c_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE78_OS_Command_Injection__char_file_w32_execvp_53c_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_file_w32_execvp_53b_goodG2BSink(char * data)
{
CWE78_OS_Command_Injection__char_file_w32_execvp_53c_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
/*
* 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/XCAttributeRunIndirectNode.h>
@interface XCAttributeRun : XCAttributeRunIndirectNode
{
}
+ (BOOL)selfTestWithRunLength:(unsigned long long)arg1 iterations:(unsigned long long)arg2 numAttrs:(unsigned long long)arg3 maxAttributeLength:(unsigned long long)arg4 coalesce:(BOOL)arg5;
+ (void)selfTestFailure:(id)arg1 attributeRun:(id)arg2 iteration:(unsigned long long)arg3;
+ (void)performSelfTest;
+ (void)initialize;
- (void)deleteRange:(struct _NSRange)arg1;
- (void)insertAttributes:(void *)arg1 range:(struct _NSRange)arg2;
- (void)setAttributes:(void *)arg1 range:(struct _NSRange)arg2;
- (void *)attributesAtIndex:(unsigned long long)arg1 effectiveRange:(struct _NSRange *)arg2;
- (id)split;
- (id)initWithObjectAttributes:(BOOL)arg1 coalescesAttributes:(BOOL)arg2;
- (id)init;
@end
|
#import <Foundation/Foundation.h>
#import "XcodeInterfaces.h"
@interface FakeDVTFilePath : NSObject
@property (nonatomic, readonly) NSString *filePath;
@end
@interface FakeXcodeFileReference : NSObject
- (instancetype)initWithFilePath:(NSString *)filePath;
-(FakeDVTFilePath *)resolvedFilePath;
@end
|
#pragma config PLLDIV = 1 // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
#pragma config CPUDIV = OSC1_PLL2// System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
#pragma config FOSC = XTPLL_XT // Oscillator Selection bits (XT oscillator, PLL enabled (XTPLL))
#pragma config PWRT = ON // Power-up Timer Enable bit (PWRT enabled)
#pragma config BOR = OFF // Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
#pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
#pragma config CCP2MX = ON // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
#pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
#pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
#pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
#include <xc.h>
#define _XTAL_FREQ 48000000UL //Frecuencia del oscilador del CPU (48MHz)
void main(void) {
TRISD = 0xFC; /*Puerto D0 y D1 como salidas*/
while(1){
LATD = 0x01;
__delay_ms(200);
LATD = 0x02;
__delay_ms(200);
}
} |
/******************************************************************************/
/* File: common.h */
/* Author: mjb */
/* */
/* Created on April 19, 2015, 11:03 AM */
/******************************************************************************/
#ifndef COMMON_H
#define COMMON_H
#ifndef __XC_H
#include <xc.h>
#endif
#ifndef _SYS_STDINT_H_
#include <stdint.h>
#endif
#ifndef _STDBOOL_H
#include <stdbool.h>
#endif
#ifndef __STDDEF_H
#include <stddef.h>
#endif
#ifndef _STDLIB_H_
#include <stdlib.h>
#endif
#include <FirmwareConfiguration.h>
#include <HardwareConfiguration.h>
#include <color.h>
#include <TM1804.h>
#else
#warning "Redundant include of common.h"
#endif /* COMMON_H */
|
//
// ex7_23.h
// Exercise 7.23
//
// Created by pezy on 11/14/14.
//
#ifndef CP5_ex7_23_h
#define CP5_ex7_23_h
#include <string>
class Screen {
public:
using pos = std::string::size_type;
Screen() = default;
Screen(pos ht, pos wd, char c):height(ht), width(wd), contents(ht*wd, c){}
char get() const { return contents[cursor]; }
char get(pos r, pos c) const { return contents[r*width+c]; }
private:
pos cursor = 0;
pos height = 0, width = 0;
std::string contents;
};
#endif
|
#pragma once
#include "SimpleApp.h"
#include "glm/glm.hpp"
#include <vector>
class DU02: public SimpleApp{
public:
DU02();
protected:
/**
* Init funkce, vola se jednou pri startu aplikace
*/
virtual void init();
/**
* Draw funkc, vola se v kazdem snimku
*/
virtual void draw();
virtual void onMousePress(Uint8 button, int x, int y);
virtual void onKeyPress(SDL_Keycode key, Uint16 mod);
void insertCube(glm::vec3 pos);
/* Kostky */
static const int MAX_CUBES = 1024;
static const size_t cubeSize = sizeof(float) * 3;
int cubeCount=0;
std::vector<glm::vec3> cubes;
Uint32 faceId;
Uint32 cubeId;
bool selected;
/* Opengl objekty */
/* Textura kostky*/
GLuint textureDirt;
/* GBuffer */
GLuint texturePosition;
GLuint textureNormal;
GLuint textureColor;
GLuint textureId;
GLuint renderBufferDepth;
GLuint framebuffer;
/* Buffery */
GLuint vao; // vertex array
GLuint vao1;
GLuint vbo; // vertex buffer
/* Shadery */
GLuint vs, gs, fs, programCubes;
GLuint vs1, gs1, fs1, programView;
/* Atributy */
GLuint positionAttrib;
/* Uniformy */
GLuint mUniform;
GLuint vUniform;
GLuint pUniform;
GLuint selectedFaceUniform;
GLuint selectedCubeUniform;
}; |
// The ROCCC Compiler Infrastructure
// This file is distributed under the University of California Open Source
// License. See ROCCCLICENSE.TXT for details.
#ifndef DIV_BY_CONST_ELIMINATION_DOT_H
#define DIV_BY_CONST_ELIMINATION_DOT_H
#include <suifpasses/suifpasses.h>
#include <suifnodes/suif.h>
class DivByConstEliminationPass2 : public PipelinablePass
{
private:
SuifEnv* theEnv ;
ProcedureDefinition* procDef ;
bool IsIntegerType(Type* t) ;
int PowerOfTwo(IntConstant* i) ;
void ProcessBinaryExpression(BinaryExpression* b) ;
public:
DivByConstEliminationPass2(SuifEnv* pEnv) ;
Module* clone() const { return (Module*) this ; }
void do_procedure_definition(ProcedureDefinition* p) ;
} ;
#endif
|
#include <genfft.h>
#include <time.h>
main () {
int j,i,n,sign, isign;
int N, Nmax=4097, Nitcc, Nlot=513, ld1;
float diff, sumi, sumr, scl;
double t0, t1, t, bias, k;
complex *data, *c_data;
char *machine=getenv("MACHINE");
t = 0.0;
t0 = wallclock_time();
t1 = wallclock_time();
bias = t1-t0;
fprintf(stderr,"bias wallclock_time = %f\n",bias);
data = (complex *) malloc (Nlot*Nmax*sizeof(complex));
c_data = (complex *) malloc (Nlot*Nmax*sizeof(complex));
N = 256;
k = log(N)/log(2)+1;
sign = 1;
isign = -1;
while (N <= Nmax) {
ld1 = N;
/* Initialize the data */
for (j=0;j<250;j++) {
for (i=0;i<N;i++) {
c_data[j*ld1+i].r = (float)-0.1+0.5*(N/2-i);
c_data[j*ld1+i].i = (float)0.3+j*0.01;
}
for (i=N;i<ld1;i++) {
c_data[j*ld1+i].r = (float)0.0;
c_data[j*ld1+i].i = (float)0.0;
}
}
t = 0.0;
/* FFT */
for (i=0; i<10; i++) {
for (j=0;j<ld1*250;j++) data[j] = c_data[j];
t0 = wallclock_time();
ccmfft(data, N, 250, ld1, sign);
ccmfft(data, N, 250, ld1, isign);
t1 = wallclock_time();
t += t1-t0;
}
/* Compare the data */
scl = 1.0/(float)N;
for (i=0; i<ld1*250; i++) {
/*
fprintf(stderr,"%s: i = %d data = %f C-data = %f\n", machine,i, data[i].r*scl, c_data[i].r);
fprintf(stderr,"%s: i = %d data = %f C-data = %f\n", machine, i, data[i].i*scl, c_data[i].i);
*/
if (c_data[i].r != 0.0 && c_data[i].i != 0.0) {
diff = fabs((data[i].r*scl - c_data[i].r) / c_data[i].r);
diff += fabs((data[i].i*scl - c_data[i].i) / c_data[i].i);
}
else diff = 0.0;
if (diff >= 5.0e-3) {
fprintf(stderr,"Bad values at %i, diff=%12.2e.\n",i,diff);
fprintf(stderr,"data[i].r = %12.2e.\n",data[i].r);
fprintf(stderr,"c_data[i].r = %12.2e.\n",c_data[i].r);
exit(1);
}
}
fprintf(stderr,"%s: N = %d*250 wallclock_time = %f\n",machine,N,t-bias);
/* Initialize the data */
for (j=0;j<Nlot;j++) {
for (i=0;i<N;i++) {
c_data[j*ld1+i].r = (float)-0.1+0.5*(N/2-i);
c_data[j*ld1+i].i = (float)0.3+j*0.01;
}
for (i=N;i<ld1;i++) {
c_data[j*ld1+i].r = (float)0.0;
c_data[j*ld1+i].i = (float)0.0;
}
}
t = 0.0;
/* FFT */
for (i=0; i<10; i++) {
for (j=0;j<ld1*Nlot;j++) data[j] = c_data[j];
t0 = wallclock_time();
ccmfft(data, N, Nlot, ld1, sign);
ccmfft(data, N, Nlot, ld1, isign);
t1 = wallclock_time();
t += t1-t0;
}
/* Compare the data */
scl = 1.0/(float)N;
for (i=0; i<ld1*Nlot; i++) {
/*
fprintf(stderr,"%s: i = %d data = %f C-data = %f\n", machine, i, data[i].r*scl, c_data[i].r);
fprintf(stderr,"%s: i = %d data = %f C-data = %f\n", machine, i, data[i].i*scl, c_data[i].i);
*/
if (c_data[i].r != 0.0 && c_data[i].i != 0.0) {
diff = fabs((data[i].r*scl - c_data[i].r) / c_data[i].r);
diff += fabs((data[i].i*scl - c_data[i].i) / c_data[i].i);
}
else diff=0.0;
if (diff >= 5.0e-3) {
fprintf(stderr,"Bad values at %i, diff=%12.2e.\n",i,diff);
fprintf(stderr,"data[i].r = %12.2e.\n",data[i].r);
fprintf(stderr,"c_data[i].r = %12.2e.\n",c_data[i].r);
exit(1);
}
}
fprintf(stderr,"%s: N = %d*%d wallclock_time = %f\n",machine,N,Nlot,t-bias);
/* find next N valid for pfacc */
N += 1;
N = pow(2.0,k);
k += 1.0;
}
}
|
/* $Id: pathplan.h,v 1.6 2011/01/25 16:30:50 ellson Exp $ $Revision: 1.6 $ */
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
#ifndef _PATH_INCLUDE
#define _PATH_INCLUDE
#include "pathgeom.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_BLD_pathplan) && defined(__EXPORT__)
# define extern __EXPORT__
#endif
/* find shortest euclidean path within a simple polygon */
extern int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2],
Ppolyline_t * output_route);
/* fit a spline to an input polyline, without touching barrier segments */
extern int Proutespline(Pedge_t * barriers, int n_barriers,
Ppolyline_t input_route,
Pvector_t endpoint_slopes[2],
Ppolyline_t * output_route);
/* utility function to convert from a set of polygonal obstacles to barriers */
extern int Ppolybarriers(Ppoly_t ** polys, int npolys,
Pedge_t ** barriers, int *n_barriers);
/* function to convert a polyline into a spline representation */
extern void make_polyline(Ppolyline_t line, Ppolyline_t* sline);
#undef extern
#ifdef __cplusplus
}
#endif
#endif
|
typedef enum Event_type Event_type;
enum Event_type {
EVENT_NONE=0,
EVENT_SIGNAL,
EVENT_EXIT,
EVENT_EXIT_SIGNAL,
EVENT_SYSCALL,
EVENT_SYSRET,
EVENT_ARCH_SYSCALL,
EVENT_ARCH_SYSRET,
EVENT_CLONE,
EVENT_VFORK,
EVENT_EXEC,
EVENT_BREAKPOINT,
EVENT_LIBCALL,
EVENT_LIBRET,
EVENT_NEW, /* in this case, proc is NULL */
EVENT_MAX
};
typedef struct Process Process;
typedef struct Event Event;
struct Event {
struct Event * next;
Process * proc;
Event_type type;
union {
int ret_val; /* EVENT_EXIT */
int signum; /* EVENT_SIGNAL, EVENT_EXIT_SIGNAL */
int sysnum; /* EVENT_SYSCALL, EVENT_SYSRET */
void * brk_addr; /* EVENT_BREAKPOINT */
int newpid; /* EVENT_CLONE, EVENT_NEW */
} e_un;
};
typedef void (*callback_func) (Event *);
extern void ltrace_init(int argc, char **argv);
extern void ltrace_add_callback(callback_func f, Event_type type);
extern void ltrace_main(void);
|
#ifndef WGT_IRP6_M_ANGLE_AXIS_H
#define WGT_IRP6_M_ANGLE_AXIS_H
#include <QtGui/QWidget>
#include <QVBoxLayout>
#include <QDockWidget>
#include <QVector>
#include "ui_wgt_absolute_template.h"
#include "../base/WgtAbsoluteBase.h"
#include "robot/irp6ot_m/const_irp6ot_m.h"
#include "robot/irp6p_m/const_irp6p_m.h"
namespace mrrocpp {
namespace ui {
namespace common {
class Interface;
class UiRobot;
}
namespace irp6_m {
class UiRobot;
}
}
}
class wgt_irp6_m_angle_axis : public WgtAbsoluteBase
{
Q_OBJECT
public:
wgt_irp6_m_angle_axis(QString _widget_label, mrrocpp::ui::common::Interface& _interface, mrrocpp::ui::common::UiRobot *_robot, QWidget *parent =
0);
~wgt_irp6_m_angle_axis();
virtual void setup_ui(QGridLayout *layout, int _rows_number);
private:
Ui::wgt_absolute_template ui;
mrrocpp::ui::irp6_m::UiRobot *robot;
void init();
void move_it();
};
#endif // WGT_SPKM_INC_H
|
#pragma once
#include <windows.h>
#ifdef __cplusplus
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavutil/avutil.h"
#include "libavutil/imgutils.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
}
#endif
#include "SDL/SDL.h"
#include "SDL/SDL_thread.h"
//define
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 5
#define AV_DISPOSITION_ATTACHED_PIC 0x0400
/* polls for possible required screen refresh at least this often, should be less than 1/fps */
#define REFRESH_RATE 0.01
typedef struct MyAVPacketList {
AVPacket pkt;
struct MyAVPacketList *next;
int serial;
} MyAVPacketList;
typedef struct PacketQueue {
MyAVPacketList *first_pkt, *last_pkt;
int nb_packets;
int size;
int abort_request;
int serial;
SDL_mutex *mutex;
SDL_cond *cond;
} PacketQueue; |
/*
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
* Copyright (c) 2001-2020 ircd-hybrid development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
/*! \file conf_resv.h
* \brief A header for the RESV functions.
* \version $Id$
*/
#ifndef INCLUDED_conf_resv_h
#define INCLUDED_conf_resv_h
struct ResvItem
{
dlink_node node;
dlink_list *list;
dlink_list exempt_list;
char *mask;
char *reason;
uintmax_t expire;
uintmax_t setat;
bool in_database;
};
struct ResvExemptItem
{
dlink_node node;
char *name;
char *user;
char *host;
struct irc_ssaddr addr;
int bits;
int type;
};
extern const dlink_list *resv_chan_get_list(void);
extern const dlink_list *resv_nick_get_list(void);
extern void resv_delete(struct ResvItem *, bool);
extern struct ResvItem *resv_make(const char *, const char *, const dlink_list *);
extern bool resv_exempt_find(const struct Client *, const struct ResvItem *);
extern struct ResvItem *resv_find(const char *, int (*)(const char *, const char *));
extern void resv_clear(void);
extern void resv_expire(void);
#endif /* INCLUDED_conf_resv_h */
|
#ifndef FEMTOBTS_H
#define FEMTOBTS_H
#include <stdlib.h>
#include <osmocom/core/utils.h>
#include <sysmocom/femtobts/superfemto.h>
#include <sysmocom/femtobts/gsml1const.h>
#ifdef L1_HAS_RTP_MODE
/* This is temporarily disabled, as AMR has some bugs in RTP mode */
//#define USE_L1_RTP_MODE /* Tell L1 to use RTP mode */
#endif
enum l1prim_type {
L1P_T_REQ,
L1P_T_CONF,
L1P_T_IND,
};
const enum l1prim_type femtobts_l1prim_type[GsmL1_PrimId_NUM];
const struct value_string femtobts_l1prim_names[GsmL1_PrimId_NUM+1];
const GsmL1_PrimId_t femtobts_l1prim_req2conf[GsmL1_PrimId_NUM];
const enum l1prim_type femtobts_sysprim_type[SuperFemto_PrimId_NUM];
const struct value_string femtobts_sysprim_names[SuperFemto_PrimId_NUM+1];
const SuperFemto_PrimId_t femtobts_sysprim_req2conf[SuperFemto_PrimId_NUM];
const struct value_string femtobts_l1sapi_names[GsmL1_Sapi_NUM+1];
const struct value_string femtobts_l1status_names[GSML1_STATUS_NUM+1];
const struct value_string femtobts_tracef_names[29];
const struct value_string femtobts_tch_pl_names[15];
const struct value_string femtobts_clksrc_names[8];
const struct value_string femtobts_dir_names[6];
enum pdch_cs {
PDCH_CS_1,
PDCH_CS_2,
PDCH_CS_3,
PDCH_CS_4,
PDCH_MCS_1,
PDCH_MCS_2,
PDCH_MCS_3,
PDCH_MCS_4,
PDCH_MCS_5,
PDCH_MCS_6,
PDCH_MCS_7,
PDCH_MCS_8,
PDCH_MCS_9,
_NUM_PDCH_CS
};
const uint8_t pdch_msu_size[_NUM_PDCH_CS];
#endif /* FEMTOBTS_H */
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX 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) 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 "mymrgdef.h"
/* Read last row with the same key as the previous read. */
int myrg_rlast(MYRG_INFO *info, byte *buf, int inx)
{
MYRG_TABLE *table;
MI_INFO *mi;
int err;
if (_myrg_init_queue(info,inx, HA_READ_KEY_OR_PREV))
return my_errno;
for (table=info->open_tables ; table < info->end_table ; table++)
{
if ((err=mi_rlast(table->table,NULL,inx)))
{
if (err == HA_ERR_END_OF_FILE)
continue;
return err;
}
/* adding to queue */
queue_insert(&(info->by_key),(byte *)table);
}
/* We have done a read in all tables */
info->last_used_table=table;
if (!info->by_key.elements)
return HA_ERR_END_OF_FILE;
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return mi_rrnd(mi,buf,mi->lastpos);
}
|
#ifndef _IF_TUNNEL_H_
#define _IF_TUNNEL_H_
#include <linux/types.h>
#include <asm/byteorder.h>
#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
#define SIOCGET6RD (SIOCDEVPRIVATE + 8)
#define SIOCADD6RD (SIOCDEVPRIVATE + 9)
#define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
#define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
#define GRE_CSUM __cpu_to_be16(0x8000)
#define GRE_ROUTING __cpu_to_be16(0x4000)
#define GRE_KEY __cpu_to_be16(0x2000)
#define GRE_SEQ __cpu_to_be16(0x1000)
#define GRE_STRICT __cpu_to_be16(0x0800)
#define GRE_REC __cpu_to_be16(0x0700)
#define GRE_FLAGS __cpu_to_be16(0x00F8)
#define GRE_VERSION __cpu_to_be16(0x0007)
struct ip_tunnel_parm {
char name[IFNAMSIZ];
int link;
__be16 i_flags;
__be16 o_flags;
__be32 i_key;
__be32 o_key;
struct iphdr iph;
};
enum {
IFLA_IPTUN_UNSPEC,
IFLA_IPTUN_LINK,
IFLA_IPTUN_LOCAL,
IFLA_IPTUN_REMOTE,
IFLA_IPTUN_TTL,
IFLA_IPTUN_TOS,
IFLA_IPTUN_ENCAP_LIMIT,
IFLA_IPTUN_FLOWINFO,
IFLA_IPTUN_FLAGS,
IFLA_IPTUN_PROTO,
IFLA_IPTUN_PMTUDISC,
IFLA_IPTUN_6RD_PREFIX,
IFLA_IPTUN_6RD_RELAY_PREFIX,
IFLA_IPTUN_6RD_PREFIXLEN,
IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
IFLA_IPTUN_ENCAP_TYPE,
IFLA_IPTUN_ENCAP_FLAGS,
IFLA_IPTUN_ENCAP_SPORT,
IFLA_IPTUN_ENCAP_DPORT,
__IFLA_IPTUN_VENDOR_BREAK, /* Ensure new entries do not hit the below. */
IFLA_IPTUN_FAN_UNDERLAY=32,
__IFLA_IPTUN_MAX,
};
#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
enum tunnel_encap_types {
TUNNEL_ENCAP_NONE,
TUNNEL_ENCAP_FOU,
TUNNEL_ENCAP_GUE,
};
#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2)
/* SIT-mode i_flags */
#define SIT_ISATAP 0x0001
struct ip_tunnel_prl {
__be32 addr;
__u16 flags;
__u16 __reserved;
__u32 datalen;
__u32 __reserved2;
/* data follows */
};
/* PRL flags */
#define PRL_DEFAULT 0x0001
struct ip_tunnel_6rd {
struct in6_addr prefix;
__be32 relay_prefix;
__u16 prefixlen;
__u16 relay_prefixlen;
};
enum {
IFLA_GRE_UNSPEC,
IFLA_GRE_LINK,
IFLA_GRE_IFLAGS,
IFLA_GRE_OFLAGS,
IFLA_GRE_IKEY,
IFLA_GRE_OKEY,
IFLA_GRE_LOCAL,
IFLA_GRE_REMOTE,
IFLA_GRE_TTL,
IFLA_GRE_TOS,
IFLA_GRE_PMTUDISC,
IFLA_GRE_ENCAP_LIMIT,
IFLA_GRE_FLOWINFO,
IFLA_GRE_FLAGS,
IFLA_GRE_ENCAP_TYPE,
IFLA_GRE_ENCAP_FLAGS,
IFLA_GRE_ENCAP_SPORT,
IFLA_GRE_ENCAP_DPORT,
__IFLA_GRE_MAX,
};
#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
/* VTI-mode i_flags */
#define VTI_ISVTI ((__be16)0x0001)
enum {
IFLA_VTI_UNSPEC,
IFLA_VTI_LINK,
IFLA_VTI_IKEY,
IFLA_VTI_OKEY,
IFLA_VTI_LOCAL,
IFLA_VTI_REMOTE,
__IFLA_VTI_MAX,
};
#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
#endif /* _IF_TUNNEL_H_ */
|
/*
* e-select-names-renderer.h
*
* Author: Mike Kestner <mkestner@ximian.com>
*
* Copyright (C) 2003 Ximian Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it 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 __E_SELECT_NAMES_RENDERER_H__
#define __E_SELECT_NAMES_RENDERER_H__
#include <gtk/gtkcellrenderertext.h>
G_BEGIN_DECLS
#define E_TYPE_SELECT_NAMES_RENDERER (e_select_names_renderer_get_type ())
#define E_SELECT_NAMES_RENDERER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRenderer))
#define E_SELECT_NAMES_RENDERER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass))
#define E_IS_SELECT_NAMES_RENDERER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SELECT_NAMES_RENDERER))
#define E_IS_SELECT_NAMES_RENDERER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((o), E_TYPE_SELECT_NAMES_RENDERER))
#define E_SELECT_NAMES_RENDERER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass))
typedef struct _ESelectNamesRenderer ESelectNamesRenderer;
typedef struct _ESelectNamesRendererClass ESelectNamesRendererClass;
typedef struct _ESelectNamesRendererPriv ESelectNamesRendererPriv;
struct _ESelectNamesRenderer
{
GtkCellRendererText parent;
ESelectNamesRendererPriv *priv;
};
struct _ESelectNamesRendererClass
{
GtkCellRendererTextClass parent_class;
void (* cell_edited) (ESelectNamesRenderer *renderer,
const gchar *path,
GList *addresses,
GList *names);
};
GType e_select_names_renderer_get_type (void);
GtkCellRenderer *e_select_names_renderer_new (void);
G_END_DECLS
#endif /* __E_SELECT_NAMES_RENDERER_H__ */
|
/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef PLUGINSET_H
#define PLUGINSET_H
#include <stdint.h>
#include "edits.h"
#include "edl.inc"
#include "keyframe.inc"
#include "module.inc"
#include "plugin.inc"
#include "pluginautos.inc"
#include "sharedlocation.inc"
#include "track.inc"
class PluginSet : public Edits
{
public:
PluginSet(EDL *edl, Track *track);
virtual ~PluginSet();
virtual void synchronize_params(PluginSet *plugin_set);
virtual PluginSet& operator=(PluginSet& plugins);
virtual Plugin* create_plugin() { return 0; };
// Returns the point to restart background rendering at.
// -1 means nothing changed.
void clear_keyframes(int64_t start, int64_t end);
// Clear edits only for a handle modification
void clear_recursive(int64_t start, int64_t end);
void shift_keyframes_recursive(int64_t position, int64_t length);
void shift_effects_recursive(int64_t position, int64_t length, int edit_autos);
void clear(int64_t start, int64_t end, int edit_autos);
void copy_from(PluginSet *src);
void copy(int64_t start, int64_t end, FileXML *file);
void copy_keyframes(int64_t start,
int64_t end,
FileXML *file,
int use_default,
int active_only);
void paste_keyframes(int64_t start,
int64_t length,
FileXML *file,
int use_default,
int active_only);
// Return the nearest boundary of any kind in the plugin edits
int64_t plugin_change_duration(int64_t input_position,
int64_t input_length,
int reverse);
void shift_effects(int64_t start, int64_t length, int edit_autos);
Edit* insert_edit_after(Edit *previous_edit);
Edit* create_edit();
// For testing output equivalency when a new pluginset is added.
Plugin* get_first_plugin();
// The plugin set number in the track
int get_number();
void save(FileXML *file);
void load(FileXML *file, uint32_t load_flags);
void dump();
int optimize();
// Insert a new plugin
Plugin* insert_plugin(const char *title,
int64_t unit_position,
int64_t unit_length,
int plugin_type,
SharedLocation *shared_location,
KeyFrame *default_keyframe,
int do_optimize);
PluginAutos *automation;
int record;
};
#endif
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_TYPES_H_
#define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_TYPES_H_
#include <map>
#include <set>
#include <vector>
#include "base/strings/string16.h"
#include "chrome/browser/autocomplete/history_provider_util.h"
#include "chrome/browser/history/history_types.h"
#include "url/gurl.h"
namespace history {
const size_t kMaxSignificantChars = 50;
struct TermMatch {
TermMatch() : term_num(0), offset(0), length(0) {}
TermMatch(int term_num, size_t offset, size_t length)
: term_num(term_num),
offset(offset),
length(length) {}
int term_num;
size_t offset;
size_t length;
};
typedef std::vector<TermMatch> TermMatches;
base::string16 CleanUpUrlForMatching(const GURL& gurl,
const std::string& languages);
base::string16 CleanUpTitleForMatching(const base::string16& title);
TermMatches MatchTermInString(const base::string16& term,
const base::string16& cleaned_string,
int term_num);
TermMatches SortAndDeoverlapMatches(const TermMatches& matches);
std::vector<size_t> OffsetsFromTermMatches(const TermMatches& matches);
TermMatches ReplaceOffsetsInTermMatches(const TermMatches& matches,
const std::vector<size_t>& offsets);
typedef std::vector<base::string16> String16Vector;
typedef std::set<base::string16> String16Set;
typedef std::set<char16> Char16Set;
typedef std::vector<char16> Char16Vector;
typedef std::vector<size_t> WordStarts;
String16Set String16SetFromString16(const base::string16& cleaned_uni_string,
WordStarts* word_starts);
String16Vector String16VectorFromString16(
const base::string16& cleaned_uni_string,
bool break_on_space,
WordStarts* word_starts);
Char16Set Char16SetFromString16(const base::string16& uni_word);
typedef size_t WordID;
typedef std::map<base::string16, WordID> WordMap;
typedef std::set<WordID> WordIDSet;
typedef std::map<char16, WordIDSet> CharWordIDMap;
typedef history::URLID HistoryID;
typedef std::set<HistoryID> HistoryIDSet;
typedef std::vector<HistoryID> HistoryIDVector;
typedef std::map<WordID, HistoryIDSet> WordIDHistoryMap;
typedef std::map<HistoryID, WordIDSet> HistoryIDWordMap;
typedef std::vector<VisitInfo> VisitInfoVector;
struct HistoryInfoMapValue {
HistoryInfoMapValue();
~HistoryInfoMapValue();
URLRow url_row;
VisitInfoVector visits;
};
typedef std::map<HistoryID, HistoryInfoMapValue> HistoryInfoMap;
struct RowWordStarts {
RowWordStarts();
~RowWordStarts();
void Clear();
WordStarts url_word_starts_;
WordStarts title_word_starts_;
};
typedef std::map<HistoryID, RowWordStarts> WordStartsMap;
}
#endif
|
/*------------------------------------------------------------------------
* write values of dynamic field variables at the edges of the
* local grid into buffer arrays and exchanged between
* processes.
* last update 24.07.2016, D. Koehn
*
* ----------------------------------------------------------------------*/
#include "fd.h"
void exchange_v_PSV(float ** vx, float ** vy,
float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top,
MPI_Request * req_send, MPI_Request * req_rec){
extern MPI_Comm SHOT_COMM;
extern int NX, NY, POS[3], NPROCX, NPROCY, BOUNDARY, FDORDER;
extern int INDEX[5];
extern const int TAG1,TAG2,TAG5,TAG6;
MPI_Status status;
int i, j, fdo, fdo3, n, l;
fdo = FDORDER/2 + 1;
fdo3 = 2*fdo;
/* top - bottom */
if (POS[2]!=0) /* no boundary exchange at top of global grid */
for (i=1;i<=NX;i++){
n = 1;
/* storage of top of local volume into buffer */
for (l=1;l<=fdo-1;l++) {
buffertop_to_bot[i][n++] = vy[l][i];
}
for (l=1;l<=fdo;l++) {
buffertop_to_bot[i][n++] = vx[l][i];
}
}
if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */
for (i=1;i<=NX;i++){
/* storage of bottom of local volume into buffer */
n = 1;
for (l=1;l<=fdo;l++) {
bufferbot_to_top[i][n++] = vy[NY-l+1][i];
}
for (l=1;l<=fdo-1;l++) {
bufferbot_to_top[i][n++] = vx[NY-l+1][i];
}
}
/* send and reveive values for points at inner boundaries */
/*
MPI_Bsend(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG5,SHOT_COMM);
MPI_Barrier(SHOT_COMM);
MPI_Recv(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG5,SHOT_COMM,&status);
MPI_Bsend(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG6,SHOT_COMM);
MPI_Barrier(SHOT_COMM);
MPI_Recv(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG6,SHOT_COMM,&status);
*/
/* send and reveive values at edges of the local grid */
/*for (i=2;i<=3;i++){
MPI_Start(&req_send[i]);
MPI_Wait(&req_send[i],&status);
MPI_Start(&req_rec[i]);
MPI_Wait(&req_rec[i],&status);
}*/
/* alternative communication */
/* still blocking communication */
MPI_Sendrecv_replace(&buffertop_to_bot[1][1],NX*fdo3,MPI_FLOAT,INDEX[3],TAG5,INDEX[4],TAG5,SHOT_COMM,&status);
MPI_Sendrecv_replace(&bufferbot_to_top[1][1],NX*fdo3,MPI_FLOAT,INDEX[4],TAG6,INDEX[3],TAG6,SHOT_COMM,&status);
if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */
for (i=1;i<=NX;i++){
n = 1;
for (l=1;l<=fdo-1;l++) {
vy[NY+l][i] = buffertop_to_bot[i][n++];
}
for (l=1;l<=fdo;l++) {
vx[NY+l][i] = buffertop_to_bot[i][n++];
}
}
if (POS[2]!=0) /* no boundary exchange at top of global grid */
for (i=1;i<=NX;i++){
n = 1;
for (l=1;l<=fdo;l++) {
vy[1-l][i] = bufferbot_to_top[i][n++];
}
for (l=1;l<=fdo-1;l++) {
vx[1-l][i] = bufferbot_to_top[i][n++];
}
}
/* left - right */
/* exchange if periodic boundary condition is applied */
if ((BOUNDARY) || (POS[1]!=0))
for (j=1;j<=NY;j++){
/* storage of left edge of local volume into buffer */
n = 1;
for (l=1;l<fdo;l++) {
bufferlef_to_rig[j][n++] = vy[j][l];
}
for (l=1;l<fdo-1;l++) {
bufferlef_to_rig[j][n++] = vx[j][l];
}
}
/* no exchange if periodic boundary condition is applied */
if ((BOUNDARY) || (POS[1]!=NPROCX-1)) /* no boundary exchange at right edge of global grid */
for (j=1;j<=NY;j++){
/* storage of right edge of local volume into buffer */
n = 1;
for (l=1;l<fdo-1;l++) {
bufferrig_to_lef[j][n++] = vy[j][NX-l+1];
}
for (l=1;l<fdo;l++) {
bufferrig_to_lef[j][n++] = vx[j][NX-l+1];
}
}
/* send and reveive values for points at inner boundaries */
/*
MPI_Bsend(&bufferlef_to_rig[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[1],TAG1,SHOT_COMM);
MPI_Barrier(SHOT_COMM);
MPI_Recv(&bufferlef_to_rig[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[2],TAG1,SHOT_COMM,&status);
MPI_Bsend(&bufferrig_to_lef[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[2],TAG2,SHOT_COMM);
MPI_Barrier(SHOT_COMM);
MPI_Recv(&bufferrig_to_lef[1][1],(NY)*fdo3,MPI_FLOAT,INDEX[1],TAG2,SHOT_COMM,&status);
*/
/* send and reveive values at edges of the local grid */
/*for (i=0;i<=1;i++){
MPI_Start(&req_send[i]);
MPI_Wait(&req_send[i],&status);
MPI_Start(&req_rec[i]);
MPI_Wait(&req_rec[i],&status);
}*/
/* alternative communication */
/* still blocking communication */
MPI_Sendrecv_replace(&bufferlef_to_rig[1][1],NY*fdo3,MPI_FLOAT,INDEX[1],TAG1,INDEX[2],TAG1,SHOT_COMM,&status);
MPI_Sendrecv_replace(&bufferrig_to_lef[1][1],NY*fdo3,MPI_FLOAT,INDEX[2],TAG2,INDEX[1],TAG2,SHOT_COMM,&status);
/* no exchange if periodic boundary condition is applied */
if ((BOUNDARY) || (POS[1]!=NPROCX-1)) /* no boundary exchange at right edge of global grid */
for (j=1;j<=NY;j++){
n = 1;
for (l=1;l<fdo;l++) {
vy[j][NX+l] = bufferlef_to_rig[j][n++];
}
for (l=1;l<fdo-1;l++) {
vx[j][NX+l] = bufferlef_to_rig[j][n++];
}
}
/* no exchange if periodic boundary condition is applied */
if ((BOUNDARY) || (POS[1]!=0)) /* no boundary exchange at left edge of global grid */
for (j=1;j<=NY;j++){
n = 1;
for (l=1;l<fdo-1;l++) {
vy[j][1-l] = bufferrig_to_lef[j][n++];
}
for (l=1;l<fdo;l++) {
vx[j][1-l] = bufferrig_to_lef[j][n++];
}
}
}
|
/*
* LadspaBase.h - basic declarations concerning LADSPA
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _LADSPA_BASE_H
#define _LADSPA_BASE_H
#include "ladspa_manager.h"
#include "Plugin.h"
class LadspaControl;
typedef enum BufferRates
{
CHANNEL_IN,
CHANNEL_OUT,
AUDIO_RATE_INPUT,
AUDIO_RATE_OUTPUT,
CONTROL_RATE_INPUT,
CONTROL_RATE_OUTPUT
} buffer_rate_t;
typedef enum BufferData
{
TOGGLED,
INTEGER,
FLOATING,
TIME,
NONE
} buffer_data_t;
//! This struct is used to hold port descriptions internally
//! which where received from the ladspa plugin
typedef struct PortDescription
{
QString name;
ch_cnt_t proc;
uint16_t port_id;
uint16_t control_id;
buffer_rate_t rate;
buffer_data_t data_type;
float scale;
LADSPA_Data max;
LADSPA_Data min;
LADSPA_Data def;
LADSPA_Data value;
//! This is true iff ladspa suggests logscale
//! Note however that the model can still decide to use a linear scale
bool suggests_logscale;
LADSPA_Data * buffer;
LadspaControl * control;
} port_desc_t;
inline Plugin::Descriptor::SubPluginFeatures::Key ladspaKeyToSubPluginKey(
const Plugin::Descriptor * _desc,
const QString & _name,
const ladspa_key_t & _key )
{
Plugin::Descriptor::SubPluginFeatures::Key::AttributeMap m;
QString file = _key.first;
m["file"] = file.remove( QRegExp( "\\.so$" ) ).remove( QRegExp( "\\.dll$" ) );
m["plugin"] = _key.second;
return Plugin::Descriptor::SubPluginFeatures::Key( _desc, _name, m );
}
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <poll.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "rtlbase.h"
#include "rtlimsg.h"
#include "song_over_http_api.h"
#include "admin_cli.h"
#include "srvSongImpl.h"
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define MSTIC 100
#define IM_DEF 1000
#define IM_TIMER_GEN 1001
#define IM_TIMER_GEN_V 10000 // ms
int TraceLevel = 8;
int TraceDebug = 1;
int TraceProto = 0;
int PseudoOng = 0;
int SoftwareSensor = 0;
int WithDia = 1;
void *MainTbPoll = NULL;
void *MainIQ = NULL;
void DoClockMs()
{
#if 0
RTL_TRDBG(1, "DoClockMs()\n");
#endif
sohClockMs();
}
void DoClockSc()
{
static unsigned int nbclock = 0;
time_t now = 0;
RTL_TRDBG(1,"DoClockSc()\n");
nbclock++;
rtl_timemono(&now);
AdmClockSc(now);
}
void DoInternalEvent(t_imsg *imsg)
{
RTL_TRDBG(1, "receive event cl=%d ty=%d\n", imsg->im_class, imsg->im_type);
switch (imsg->im_class)
{
// case <msg class> :
// doSomething();
// break;
default:
break;
}
}
void DoInternalTimer(t_imsg *imsg)
{
RTL_TRDBG(1, "receive timer cl=%d ty=%d vsize=%ld\n",
imsg->im_class, imsg->im_type, rtl_vsize(getpid()));
switch (imsg->im_class)
{
// case <msg class> :
// doSomething();
// break;
//
default:
break;
}
}
void MainLoop()
{
time_t lasttimems = 0;
time_t lasttimesc = 0;
time_t now = 0;
t_imsg *msg;
while (1)
{
// internal events
while ((msg = rtl_imsgGet(MainIQ, IMSG_MSG)) != NULL)
{
DoInternalEvent(msg);
rtl_imsgFree(msg);
}
// external events
rtl_poll(MainTbPoll, MSTIC);
// clocks
now = rtl_tmms();
if (ABS(now - lasttimems) >= 100)
{
DoClockMs();
lasttimems = now;
}
if (ABS(now - lasttimesc) >= 1000)
{
DoClockSc();
lasttimesc = now;
}
// internal timer
while ((msg = rtl_imsgGet(MainIQ, IMSG_TIMER)) != NULL)
{
DoInternalTimer(msg);
rtl_imsgFree(msg);
}
}
}
void usage(char *prg, char *fmt)
{
printf("usage: %s %s\n", prg, fmt);
printf(" where options are:\n");
printf(" -h print this help message\n");
printf(" -t <level> run with trace level <level>\n");
printf(" -d <level> run with debug level <level>\n");
printf("\n");
}
int DoArg(int argc, char *argv[])
{
extern char *optarg;
extern int optind;
int c;
char *fmtgetopt = "ht:d:or";
int i;
for (i = 1 ; i < argc ; i++)
{
if (strcmp(argv[i], "--version") == 0)
{
printf("%s\n", rtl_version());
exit(0);
}
if (strcmp(argv[i], "--help") == 0)
{
usage(argv[0], fmtgetopt);
exit(0);
}
}
while ((c = getopt (argc, argv, fmtgetopt)) != -1)
{
switch (c)
{
case 'h' :
usage(argv[0], fmtgetopt);
exit(0);
break;
case 't' :
TraceLevel = atoi(optarg);
break;
case 'd' :
TraceDebug = atoi(optarg);
break;
default :
break;
}
}
return argc;
}
void SetOption(char *name, char *value)
{
if (strcmp(name, "tracelevel") == 0)
{
TraceLevel = atoi(value);
return;
}
if (strcmp(name, "tracedebug") == 0)
{
TraceDebug = atoi(value);
return;
}
RTL_TRDBG(0, "ERROR parameter/option '%s' not found\n", name);
}
int main(int argc, char *argv[])
{
signal(SIGPIPE, SIG_IGN);
rtl_init();
DoArg(argc, argv);
rtl_tracemutex();
rtl_tracelevel(TraceLevel);
//if (0 == logOnStdOutput)
//{
// rtl_tracerotate("./TRACE.log");
//}
RTL_TRDBG(0, "start %s/main th=%lx pid=%d\n", argv[0], (long)pthread_self(), getpid());
RTL_TRDBG(0, "%s\n", rtl_version());
MainTbPoll = rtl_pollInit();
MainIQ = rtl_imsgInitIq();
//rtl_tracelevel(TraceLevel);
RTL_TRDBG(0, "TraceLevel=%d\n", TraceLevel);
RTL_TRDBG(0, "TraceDebug=%d\n", TraceDebug);
AdmTcpInit();
sohInit(9191, testerSohCreateCb, testerSohRetrieveCb,
testerSohUpdateCb, testerSohDeleteCb);
MainLoop();
sohUninit();
RTL_TRDBG(0, "end !!! %s/main th=%lx\n", argv[0], (long)pthread_self());
exit(1);
}
|
#define WINVER 0x0500
#include <windows.h>
#include "sendkey.h"
JNIEXPORT void JNICALL
Java_com_andreldm_rcontrol_server_SendKey_sendkey(JNIEnv * a, jobject b, jint c)
{
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
// key press
ip.ki.wVk = c;
ip.ki.dwFlags = KEYEVENTF_EXTENDEDKEY | 0;
SendInput(1, &ip, sizeof(INPUT));
// key release
ip.ki.dwFlags = KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
}
|
#include "Configuration/Config.h"
#include "Log.h"
#include "RealmList.h"
#include "RealmSocket.h"
#include "Common.h"
|
#ifndef __DD_HEADER
#define __DD_HEADER
#include <stdint.h>
typedef union {
long double ld;
struct {
double hi;
double lo;
}s;
}DD;
typedef union {
double d;
uint64_t x;
} doublebits;
#define LOWORDER(xy,xHi,xLo,yHi,yLo) \
(((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo))
static inline double __attribute__((always_inline))
fabs(double x)
{
doublebits result = { .d = x };
result.x &= UINT64_C(0x7fffffffffffffff);
return result.d;
}
static inline double __attribute__((always_inline))
high26bits(double x)
{
doublebits result = { .d = x };
result.x &= UINT64_C(0xfffffffff8000000);
return result.d;
}
static inline int __attribute__((always_inline))
different_sign(double x, double y)
{
doublebits xsignbit = { .d = x }, ysignbit = { .d = y };
int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
return result;
}
#endif /* __DD_HEADER */
|
/* This file is part of the KDE project
Copyright (C) 2012 Dag Andersen <danders@get2net.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPlato_WorkPackageProxyModelTester_h
#define KPlato_WorkPackageProxyModelTester_h
#include <QtTest>
#include "kptworkpackagemodel.h"
#include "kptproject.h"
namespace KPlato
{
class Task;
class ScheduleManager;
class WorkPackageProxyModelTester : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testInsert();
void testRemove();
void testMove();
void testMoveChild();
private:
Task *addTask( Node *parent, int after );
void removeTask( Node *task );
void moveTask( Node *task, Node *newParent, int newPos );
private:
WorkPackageProxyModel m_model;
Project project;
ScheduleManager *sm;
};
} //namespace KPlato
#endif
|
/*
* LSCP Shell
*
* Copyright (c) 2014 Christian Schoenebeck
*
* This program is part of LinuxSampler and released under the same terms.
*/
#ifndef TERMINALPRINTER_H
#define TERMINALPRINTER_H
#include <string>
/**
* Simple helper class that remembers the amount of lines advanced on the
* terminal (since this object was constructed) by printing out text to the
* terminal with this class. This way the content been printed on the terminal
* can completely be erased afterwards once necessary.
*/
class TerminalPrinter {
public:
TerminalPrinter();
virtual ~TerminalPrinter();
int linesAdvanced() const;
TerminalPrinter& operator<< (const std::string s);
protected:
void printChar(char c);
private:
int m_lines;
int m_col;
int m_screenWidth; // in characters
};
#endif // TERMINALPRINTER_H
|
/*
* c128controller.h - C128 app controller
*
* Written by
* Christian Vogelgsang <chris@vogelgsang.org>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#import <UIKit/UIKit.h>
#import "c64controller.h"
@interface C128Controller : C64Controller
{
}
@end
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "List.h"
#define MIN(x,y) ((x) <= (y) ? (x) : (y))
#define MAX(x,y) ((x) >= (y) ? (x) : (y))
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define SIGN(a,b) ((b) < 0.0 ? -ABS(a) : ABS(a))
#define freenull(a) {if(a) free(a); a=NULL;}
#ifndef Lhash_h
#define Lhash_h
// hash takes number of nodes (dimension of List Lhash), number of triangles, tri array to use to create hash table, and blank hash table to be passed out full
void Lhash(int nn, int nt, int **tri, List **hash);
#endif
|
//###########################################################################
//
// FILE: F2806x_Gpio.c
//
// TITLE: F2806x General Purpose I/O Initialization & Support Functions.
//
//###########################################################################
// $TI Release: F2806x C/C++ Header Files and Peripheral Examples V136 $
// $Release Date: Apr 15, 2013 $
//###########################################################################
#include "F2806x_Device.h" // F2806x Headerfile Include File
#include "F2806x_Examples.h" // F2806x Examples Include File
//---------------------------------------------------------------------------
// InitGpio:
//---------------------------------------------------------------------------
// This function initializes the Gpio to a known (default) state.
//
// For more details on configuring GPIO's as peripheral functions,
// refer to the individual peripheral examples and/or GPIO setup example.
void InitGpio(void) {
EALLOW;
// Each GPIO pin can be:
// a) a GPIO input/output
// b) peripheral function 1
// c) peripheral function 2
// d) peripheral function 3
// By default, all are GPIO Inputs
GpioCtrlRegs.GPAMUX1.all = 0x0000; // GPIO functionality GPIO0-GPIO15
GpioCtrlRegs.GPAMUX2.all = 0x0000; // GPIO functionality GPIO16-GPIO31
GpioCtrlRegs.GPBMUX1.all = 0x0000; // GPIO functionality GPIO32-GPIO47
GpioCtrlRegs.GPBMUX2.all = 0x0000; // GPIO functionality GPIO48-GPIO63
GpioCtrlRegs.AIOMUX1.all = 0x0000; // Dig.IO funct. applies to AIO2,4,6,10,12,14
GpioCtrlRegs.GPADIR.all = 0x0000; // GPIO0-GPIO31 are GP inputs
GpioCtrlRegs.GPBDIR.all = 0x0000; // GPIO32-GPIO63 are inputs
GpioCtrlRegs.AIODIR.all = 0x0000; // AIO2,4,6,10,12,14 are digital inputs
// Each input can have different qualification
// a) input synchronized to SYSCLKOUT
// b) input qualified by a sampling window
// c) input sent asynchronously (valid for peripheral inputs only)
GpioCtrlRegs.GPAQSEL1.all = 0x0000; // GPIO0-GPIO15 Synch to SYSCLKOUT
GpioCtrlRegs.GPAQSEL2.all = 0x0000; // GPIO16-GPIO31 Synch to SYSCLKOUT
GpioCtrlRegs.GPBQSEL1.all = 0x0000; // GPIO32-GPIO47 Synch to SYSCLKOUT
GpioCtrlRegs.GPBQSEL2.all = 0x0000; // GPIO48-GPIO63 Synch to SYSCLKOUT
// Pull-ups can be enabled or disabled.
GpioCtrlRegs.GPAPUD.all = 0x0000; // Pullup's enabled GPIO0-GPIO31
GpioCtrlRegs.GPBPUD.all = 0x0000; // Pullup's enabled GPIO32-GPIO44
//GpioCtrlRegs.GPAPUD.all = 0xFFFF; // Pullup's disabled GPIO0-GPIO31
//GpioCtrlRegs.GPBPUD.all = 0xFFFF; // Pullup's disabled GPIO32-GPIO44
EDIS;
}
|
/**
* (c) 2015 psce4all project. All rights reserved.
* Released under GPL v2 license. Read LICENSE for more details.
*/
#pragma once
#include <memory> /* std::shared_ptr */
#include <vector>
#include <map>
#include <unordered_map>
#include <cstddef>
#include "Allegrex.h"
#include "capstone.h"
#include "hal.os.Module.h"
namespace capstone
{
static hal::os::Module module("capstone.dll");
static auto Open = (cs_err(*)(cs_arch arch, cs_mode mode, csh * handle))module["cs_open"];
static auto Close = (cs_err(*)(csh * handle))module["cs_close"];
static auto Free = (void(*)(cs_insn * insn, size_t count))module["cs_free"];
static auto Malloc = (cs_insn * (*)(csh ud))module["cs_malloc"];
static auto Disasm = (bool(*)(csh ud, const uint8_t ** code, size_t * size, uint64_t * address, cs_insn * insn))module["cs_disasm_iter"];
static char * Disassemble(char * out, cs_insn & insn, bool use_underscore = false)
{
char address[32];
sprintf(address, "%08zX(%2d):", insn.address, insn.size);
char bytes[64], *p = bytes;
for (size_t i = 0; i < insn.size; ++i)
{
p += sprintf(p, "%02zX", size_t(insn.bytes[insn.size - i - 1]));
}
if (use_underscore)
{
static const char u[] = "................................................................";
sprintf(out, "%s<font color=\"#EEEEEE\">%s</font>%s <i>%s %s</i><font color=\"#EEEEEE\">%s</font>", address, &u[32 + strlen(bytes)], bytes, insn.mnemonic, insn.op_str, &u[1 + strlen(insn.mnemonic) + strlen(insn.op_str)]);
}
else
{
sprintf(out, "%s %32s %-16s %s", address, bytes, insn.mnemonic, insn.op_str);
}
return out;
}
}
class qt_Instruction
{
u32 addr_;
u32 data_;
size_t size_;
const allegrex_instruction mutable *insn_;
size_t addr_x86_64_;
size_t size_x86_64_;
public:
qt_Instruction(u32 addr = 0, u32 data = 0, size_t size = 0, size_t addr_x86_64 = 0, size_t size_x86_64 = 0)
: addr_(addr)
, data_(data)
, size_(size)
, insn_(nullptr)
, addr_x86_64_(addr_x86_64)
, size_x86_64_(size_x86_64)
{
assert(size >= 0);
}
~qt_Instruction()
{
}
u32 addr() const
{
return addr_;
}
size_t addr_x86_64() const
{
return addr_x86_64_;
}
void setAddr(u32 addr)
{
addr_ = addr;
}
void setAddr_x86_64(size_t addr)
{
addr_x86_64_ = addr;
}
u32 data() const
{
return data_;
}
void setData(u32 data)
{
data_ = data;
}
bool checkData() const
{
return data_ == *p32u32(addr_);
}
size_t size() const
{
return size_;
}
size_t size_x86_64() const
{
return size_x86_64_;
}
void setSize(size_t size)
{
assert(size > 0);
size_ = size;
}
void setSize_x86_64(size_t size)
{
assert(size > 0);
size_x86_64_ = size;
}
u32 endAddr() const
{
return addr_ + size_;
}
const allegrex_instruction *insn() const
{
if (insn_)
{
return insn_;
}
return insn_ = allegrex_decode_instruction(data_, 1);
}
QString toString() const
{
if (auto opcd = insn())
{
return allegrex_disassemble_instruction(opcd, data_, addr_, false);
}
return QString();
}
bool operator < (const qt_Instruction &rhs) const
{
return addr() < rhs.addr();
}
};
typedef std::map< u32, qt_Instruction > qt_Instructions;
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Engrampa
*
* Copyright (C) 2001 The Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 FR_COMMAND_CFILE_H
#define FR_COMMAND_CFILE_H
#include <gtk/gtk.h>
#include "fr-command.h"
#include "typedefs.h"
#define FR_TYPE_COMMAND_CFILE (fr_command_cfile_get_type ())
#define FR_COMMAND_CFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFile))
#define FR_COMMAND_CFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass))
#define FR_IS_COMMAND_CFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_CFILE))
#define FR_IS_COMMAND_CFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_CFILE))
#define FR_COMMAND_CFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass))
typedef struct _FrCommandCFile FrCommandCFile;
typedef struct _FrCommandCFileClass FrCommandCFileClass;
struct _FrCommandCFile
{
FrCommand __parent;
/*<private>*/
FrProcError error;
};
struct _FrCommandCFileClass
{
FrCommandClass __parent_class;
};
GType fr_command_cfile_get_type (void);
#endif /* FR_COMMAND_CFILE_H */
|
/* Returns the specified errorlevel
*/
#include <stdio.h>
#include <stdlib.h>
main(int argc, char **argv)
{
if(argc != 2) {
fputs("Usage: ERRLVL number\n"
"Returns the specified number as errorlevel (exit code)\n"
, stderr);
return 127;
}
return atoi(argv[1]);
}
|
#ifndef _I386_STATFS_H
#define _I386_STATFS_H
#ifndef __KERNEL_STRICT_NAMES
#include <linux/types.h>
typedef __kernel_fsid_t fsid_t;
#endif
struct statfs
{
long f_type;
long f_bsize;
long f_blocks;
long f_bfree;
long f_bavail;
long f_files;
long f_ffree;
__kernel_fsid_t f_fsid;
long f_namelen;
long f_spare[6];
};
#endif
|
/*
* fixmap.h: compile-time virtual memory allocation
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1998 Ingo Molnar
*
* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
*/
#ifndef _ASM_FIXMAP_H
#define _ASM_FIXMAP_H
#include <linux/config.h>
#include <linux/kernel.h>
#include <asm/apicdef.h>
#include <asm/page.h>
#include <asm/vsyscall.h>
/*
* Here we define all the compile-time 'special' virtual
* addresses. The point is to have a constant address at
* compile time, but to set the physical address only
* in the boot process.
*
* these 'compile-time allocated' memory buffers are
* fixed-size 4k pages. (or larger if used with an increment
* highger than 1) use fixmap_set(idx,phys) to associate
* physical memory with fixmap indices.
*
* TLB entries of such buffers will not be flushed across
* task switches.
*/
enum fixed_addresses
{
VSYSCALL_LAST_PAGE,
VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
VSYSCALL_HPET,
FIX_HPET_BASE,
#ifdef CONFIG_X86_LOCAL_APIC
FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
#endif
#ifdef CONFIG_X86_IO_APIC
FIX_IO_APIC_BASE_0,
FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
#endif
__end_of_fixed_addresses
};
extern void __set_fixmap (enum fixed_addresses idx,
unsigned long phys, pgprot_t flags);
#define set_fixmap(idx, phys) \
__set_fixmap(idx, phys, PAGE_KERNEL)
/*
* Some hardware wants to get fixmapped without caching.
*/
#define set_fixmap_nocache(idx, phys) \
__set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
#define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE)
#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
extern void __this_fixmap_does_not_exist(void);
/*
* 'index to address' translation. If anyone tries to use the idx
* directly without tranlation, we catch the bug with a NULL-deference
* kernel oops. Illegal ranges of incoming indices are caught too.
*/
extern inline unsigned long fix_to_virt(const unsigned int idx)
{
/*
* this branch gets completely eliminated after inlining,
* except when someone tries to use fixaddr indices in an
* illegal way. (such as mixing up address types or using
* out-of-range indices).
*
* If it doesn't get removed, the linker will complain
* loudly with a reasonably clear error message..
*/
if (idx >= __end_of_fixed_addresses)
__this_fixmap_does_not_exist();
return __fix_to_virt(idx);
}
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager Connection editor -- Connection editor for NetworkManager
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2008 Red Hat, Inc.
*/
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <glade/glade.h>
#include <glib/gi18n.h>
#include <nm-utils.h>
#include "ppp-auth-methods-dialog.h"
static void
validate (GtkWidget *dialog)
{
GladeXML *xml;
GtkWidget *widget;
gboolean allow_eap, allow_pap, allow_chap, allow_mschap, allow_mschapv2;
g_return_if_fail (dialog != NULL);
xml = g_object_get_data (G_OBJECT (dialog), "glade-xml");
g_return_if_fail (xml != NULL);
g_return_if_fail (GLADE_IS_XML (xml));
widget = glade_xml_get_widget (xml, "allow_eap");
allow_eap = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_pap");
allow_pap = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_chap");
allow_chap = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_mschap");
allow_mschap = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_mschapv2");
allow_mschapv2 = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "ok_button");
#if 0
/* Ignore for now until we know whether any PPP servers simply don't request
* authentication at all.
*/
gtk_widget_set_sensitive (widget, (allow_eap || allow_pap || allow_chap || allow_mschap || allow_mschapv2));
#endif
}
GtkWidget *
ppp_auth_methods_dialog_new (gboolean refuse_eap,
gboolean refuse_pap,
gboolean refuse_chap,
gboolean refuse_mschap,
gboolean refuse_mschapv2)
{
GladeXML *xml;
GtkWidget *dialog, *widget;
xml = glade_xml_new (GLADEDIR "/ce-page-ppp.glade", "auth_methods_dialog", NULL);
if (!xml) {
g_warning ("%s: Couldn't load PPP page glade file.", __func__);
return NULL;
}
dialog = glade_xml_get_widget (xml, "auth_methods_dialog");
if (!dialog) {
g_warning ("%s: Couldn't load PPP auth methods dialog from glade file.", __func__);
g_object_unref (xml);
return NULL;
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_object_set_data_full (G_OBJECT (dialog), "glade-xml",
xml, (GDestroyNotify) g_object_unref);
widget = glade_xml_get_widget (xml, "allow_eap");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !refuse_eap);
g_signal_connect_swapped (G_OBJECT (widget), "toggled", G_CALLBACK (validate), dialog);
widget = glade_xml_get_widget (xml, "allow_pap");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !refuse_pap);
g_signal_connect_swapped (G_OBJECT (widget), "toggled", G_CALLBACK (validate), dialog);
widget = glade_xml_get_widget (xml, "allow_chap");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !refuse_chap);
g_signal_connect_swapped (G_OBJECT (widget), "toggled", G_CALLBACK (validate), dialog);
widget = glade_xml_get_widget (xml, "allow_mschap");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !refuse_mschap);
g_signal_connect_swapped (G_OBJECT (widget), "toggled", G_CALLBACK (validate), dialog);
widget = glade_xml_get_widget (xml, "allow_mschapv2");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !refuse_mschapv2);
g_signal_connect_swapped (G_OBJECT (widget), "toggled", G_CALLBACK (validate), dialog);
/* Update initial validity */
validate (dialog);
return dialog;
}
void
ppp_auth_methods_dialog_get_methods (GtkWidget *dialog,
gboolean *refuse_eap,
gboolean *refuse_pap,
gboolean *refuse_chap,
gboolean *refuse_mschap,
gboolean *refuse_mschapv2)
{
GladeXML *xml;
GtkWidget *widget;
g_return_if_fail (dialog != NULL);
g_return_if_fail (refuse_eap != NULL);
g_return_if_fail (refuse_pap != NULL);
g_return_if_fail (refuse_chap != NULL);
g_return_if_fail (refuse_mschap != NULL);
g_return_if_fail (refuse_mschapv2 != NULL);
xml = g_object_get_data (G_OBJECT (dialog), "glade-xml");
g_return_if_fail (xml != NULL);
g_return_if_fail (GLADE_IS_XML (xml));
widget = glade_xml_get_widget (xml, "allow_eap");
*refuse_eap = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_pap");
*refuse_pap = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_chap");
*refuse_chap = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_mschap");
*refuse_mschap = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
widget = glade_xml_get_widget (xml, "allow_mschapv2");
*refuse_mschapv2 = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.