hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c834378f13ceedcdd3c1e42ba4d47a98902f112c | 3,756 | h | C | mcts-xboard/eleeye/ucci.h | milkpku/BetaElephant | 0db6140d328355ac0a3c7f9f667ca760f5096711 | [
"MIT"
] | 28 | 2016-05-25T11:49:24.000Z | 2021-12-06T15:21:52.000Z | mcts-xboard/eleeye/ucci.h | milkpku/BetaElephant | 0db6140d328355ac0a3c7f9f667ca760f5096711 | [
"MIT"
] | 3 | 2016-09-21T11:55:45.000Z | 2021-11-27T16:20:04.000Z | mcts-xboard/eleeye/ucci.h | milkpku/BetaElephant | 0db6140d328355ac0a3c7f9f667ca760f5096711 | [
"MIT"
] | 16 | 2016-05-03T06:42:37.000Z | 2021-06-26T17:03:15.000Z | /*
ucci.h/ucci.cpp - Source Code for ElephantEye, Part I
ElephantEye - a Chinese Chess Program (UCCI Engine)
Designed by Morning Yellow, Version: 3.2, Last Modified: Sep. 2010
Copyright (C) 2004-2010 www.xqbase.com
This part (ucci.h/ucci.cpp only) of codes is NOT published under LGPL, and
can be used without restriction.
*/
#include "../base/base.h"
#ifndef UCCI_H
#define UCCI_H
const int UCCI_MAX_DEPTH = 32; // UCCI引擎思考的极限深度
// 和UCCI指令中关键字有关的选项
enum UcciOptionEnum {
UCCI_OPTION_UNKNOWN, UCCI_OPTION_BATCH, UCCI_OPTION_DEBUG, UCCI_OPTION_PONDER, UCCI_OPTION_USEHASH, UCCI_OPTION_USEBOOK, UCCI_OPTION_USEEGTB,
UCCI_OPTION_BOOKFILES, UCCI_OPTION_EGTBPATHS, UCCI_OPTION_HASHSIZE, UCCI_OPTION_THREADS, UCCI_OPTION_PROMOTION,
UCCI_OPTION_IDLE, UCCI_OPTION_PRUNING, UCCI_OPTION_KNOWLEDGE, UCCI_OPTION_RANDOMNESS, UCCI_OPTION_STYLE, UCCI_OPTION_NEWGAME
}; // 由"setoption"指定的选项
enum UcciRepetEnum {
UCCI_REPET_ALWAYSDRAW, UCCI_REPET_CHECKBAN, UCCI_REPET_ASIANRULE, UCCI_REPET_CHINESERULE
}; // 选项"repetition"的设定值
enum UcciGradeEnum {
UCCI_GRADE_NONE, UCCI_GRADE_TINY, UCCI_GRADE_SMALL, UCCI_GRADE_MEDIUM, UCCI_GRADE_LARGE, UCCI_GRADE_HUGE
}; // 选项"idle"、"pruning"、"knowledge"、"selectivity"的设定值
enum UcciStyleEnum {
UCCI_STYLE_SOLID, UCCI_STYLE_NORMAL, UCCI_STYLE_RISKY
}; // 选项"style"的设定值
enum UcciGoEnum {
UCCI_GO_DEPTH, UCCI_GO_NODES, UCCI_GO_TIME_MOVESTOGO, UCCI_GO_TIME_INCREMENT
}; // 由"go"指令指定的时间模式,分别是限定深度、限定结点数、时段制和加时制
enum UcciCommEnum {
UCCI_COMM_UNKNOWN, UCCI_COMM_UCCI, UCCI_COMM_ISREADY, UCCI_COMM_PONDERHIT, UCCI_COMM_PONDERHIT_DRAW, UCCI_COMM_STOP,
UCCI_COMM_SETOPTION, UCCI_COMM_POSITION, UCCI_COMM_BANMOVES, UCCI_COMM_GO, UCCI_COMM_PROBE, UCCI_COMM_QUIT, UCCI_COMM_MOVE, UCCI_COMM_NEWGAME
}; // UCCI指令类型
// UCCI指令可以解释成以下这个抽象的结构
union UcciCommStruct {
/* 可得到具体信息的UCCI指令只有以下4种类型
*
* 1. "setoption"指令传递的信息,适合于"UCCI_COMM_SETOPTION"指令类型
* "setoption"指令用来设定选项,因此引擎接受到的信息有“选项类型”和“选项值”
* 例如,"setoption batch on",选项类型就是"UCCI_OPTION_DEBUG",值(Value.bCheck)就是"true"
*/
struct {
UcciOptionEnum Option; // 选项类型
union { // 选项值
int nSpin; // "spin"类型的选项的值
bool bCheck; // "check"类型的选项的值
UcciRepetEnum Repet; // "combo"类型的选项"repetition"的值
UcciGradeEnum Grade; // "combo"类型的选项"pruning"、"knowledge"和"selectivity"的值
UcciStyleEnum Style; // "combo"类型的选项"style"的值
char *szOption; // "string"类型的选项的值
}; // "button"类型的选项没有值
};
/* 2. "position"指令传递的信息,适合于"e_CommPosition"指令类型
* "position"指令用来设置局面,包括初始局面连同后续着法构成的局面
* 例如,position startpos moves h2e2 h9g8,FEN串就是"startpos"代表的FEN串,着法数(MoveNum)就是2
*/
struct {
const char *szFenStr; // FEN串,特殊局面(如"startpos"等)也由解释器最终转换成FEN串
int nMoveNum; // 后续着法数
uint32_t *lpdwMovesCoord; // 后续着法,指向程序"IdleLine()"中的一个静态数组,但可以把"CoordList"本身看成数组
};
/* 3. "banmoves"指令传递的信息,适合于"e_CommBanMoves"指令类型
* "banmoves"指令用来设置禁止着法,数据结构时类似于"position"指令的后续着法,但没有FEN串
*/
struct {
int nBanMoveNum;
uint32_t *lpdwBanMovesCoord;
};
/* 4. "go"指令传递的信息,适合于"UCCI_COMM_GO指令类型
* "go"指令让引擎思考(搜索),同时设定思考模式,即固定深度、时段制还是加时制
*/
struct {
UcciGoEnum Go; // 思考模式
bool bPonder; // 后台思考
bool bDraw; // 提和
union {
int nDepth, nNodes, nTime;
}; // 深度、结点数或时间
union {
int nMovesToGo, nIncrement;
}; // 限定时间内要走多少步棋(加时制)或走完该步后限定时间加多少(时段制)
};
struct {
int move;
};
};
// 下面三个函数用来解释UCCI指令,但适用于不同场合
UcciCommEnum BootLine(void); // UCCI引擎启动的第一条指令,只接收"ucci"
UcciCommEnum IdleLine(UcciCommStruct &UcciComm, bool bDebug); // 引擎空闲时接收指令
UcciCommEnum BusyLine(UcciCommStruct &UcciComm, bool bDebug); // 引擎思考时接收指令,只允许接收"stop"、"ponderhit"和"probe"
#endif | 35.433962 | 143 | 0.722045 |
c8f5d4776485a1ab3f7bb5bfe16db4bb07b7c972 | 383 | h | C | HGInspirationNotes/Myway/FMDB/Manager/HGSqlManager.h | HGMyway/HGInspirationNotes | 0ea68ea514fc735bb50758aba09e6b2535b97ffd | [
"MIT"
] | null | null | null | HGInspirationNotes/Myway/FMDB/Manager/HGSqlManager.h | HGMyway/HGInspirationNotes | 0ea68ea514fc735bb50758aba09e6b2535b97ffd | [
"MIT"
] | null | null | null | HGInspirationNotes/Myway/FMDB/Manager/HGSqlManager.h | HGMyway/HGInspirationNotes | 0ea68ea514fc735bb50758aba09e6b2535b97ffd | [
"MIT"
] | null | null | null | //
// HGSqlManager.h
// HGInspirationNotes
//
// Created by 小雨很美 on 2017/12/25.
// Copyright © 2017年 小雨很美. All rights reserved.
//
#import "HGSqlManagerBase.h"
@interface HGSqlManager : HGSqlManagerBase
+ (HGSqlManager *)sharedManager;
- (BOOL)insertTestData:(NSString *)text;
-(NSArray *)get_TestData;
- (BOOL)insertData:(NSDictionary *)dict dbName:(NSString *)dbName;
@end
| 20.157895 | 66 | 0.720627 |
bdbc5e6e61312c2d8053d802a3d8967b97ada264 | 212 | h | C | RSChat/Sections/RSDiscover/Controllers/RSBuyViewController.h | KeenTeam1990/KTTKWeChat | 691ef1a53361dfdbfeed920ba8ad9b43611419ce | [
"MIT"
] | 2 | 2018-07-05T07:58:30.000Z | 2018-07-08T14:22:18.000Z | RSChat/Sections/RSDiscover/Controllers/RSBuyViewController.h | KeenTeam1990/KTTKWeChat | 691ef1a53361dfdbfeed920ba8ad9b43611419ce | [
"MIT"
] | null | null | null | RSChat/Sections/RSDiscover/Controllers/RSBuyViewController.h | KeenTeam1990/KTTKWeChat | 691ef1a53361dfdbfeed920ba8ad9b43611419ce | [
"MIT"
] | null | null | null | //
// RSBuyViewController.h
// RSChat
//
// Created by hehai on 12/8/15.
// Copyright (c) 2015 hehai. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RSBuyViewController : UIViewController
@end
| 15.142857 | 50 | 0.693396 |
0c13c92bba7749fab38653b6f04d559705e85efd | 2,300 | c | C | tools/clang/test/Sema/private-extern.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 3,102 | 2015-01-04T02:28:35.000Z | 2022-03-30T12:53:41.000Z | tools/clang/test/Sema/private-extern.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | tools/clang/test/Sema/private-extern.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 1,868 | 2015-01-03T04:27:11.000Z | 2022-03-25T13:37:35.000Z | // RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern -fmodules %s
static int g0; // expected-note{{previous definition}}
int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}}
static int g1;
extern int g1;
static int g2;
__private_extern__ int g2;
int g3; // expected-note{{previous definition}}
static int g3; // expected-error{{static declaration of 'g3' follows non-static declaration}}
extern int g4; // expected-note{{previous declaration}}
static int g4; // expected-error{{static declaration of 'g4' follows non-static declaration}}
__private_extern__ int g5; // expected-note{{previous declaration}}
static int g5; // expected-error{{static declaration of 'g5' follows non-static declaration}}
void f0() {
int g6; // expected-note {{previous}}
extern int g6; // expected-error {{extern declaration of 'g6' follows non-extern declaration}}
}
void f1() {
int g7; // expected-note {{previous}}
__private_extern__ int g7; // expected-error {{extern declaration of 'g7' follows non-extern declaration}}
}
void f2() {
extern int g8; // expected-note{{previous declaration}}
int g8; // expected-error {{non-extern declaration of 'g8' follows extern declaration}}
}
void f3() {
__private_extern__ int g9; // expected-note{{previous declaration}}
int g9; // expected-error {{non-extern declaration of 'g9' follows extern declaration}}
}
void f4() {
extern int g10;
extern int g10;
}
void f5() {
__private_extern__ int g11;
__private_extern__ int g11;
}
void f6() {
// FIXME: Diagnose
extern int g12;
__private_extern__ int g12;
}
void f7() {
// FIXME: Diagnose
__private_extern__ int g13;
extern int g13;
}
struct s0;
void f8() {
extern struct s0 g14;
__private_extern__ struct s0 g14;
}
struct s0 { int x; };
void f9() {
extern int g15 = 0; // expected-error{{'extern' variable cannot have an initializer}}
// FIXME: linkage specifier in warning.
__private_extern__ int g16 = 0; // expected-error{{'extern' variable cannot have an initializer}}
}
extern int g17;
int g17 = 0;
extern int g18 = 0; // expected-warning{{'extern' variable has an initializer}}
__private_extern__ int g19;
int g19 = 0;
__private_extern__ int g20 = 0;
| 26.744186 | 108 | 0.713478 |
d84ae3d10fb0047bf135ad53f869a60c87151ace | 444 | h | C | win32/pdcwin.h | Logopher/pdcurses | f0bc924d19374a6c66eba1d4efff80b7ab07b523 | [
"X11",
"FSFAP"
] | 1 | 2021-08-11T04:08:59.000Z | 2021-08-11T04:08:59.000Z | win32/pdcwin.h | Logopher/pdcurses | f0bc924d19374a6c66eba1d4efff80b7ab07b523 | [
"X11",
"FSFAP"
] | null | null | null | win32/pdcwin.h | Logopher/pdcurses | f0bc924d19374a6c66eba1d4efff80b7ab07b523 | [
"X11",
"FSFAP"
] | null | null | null | /* Public Domain Curses */
/* $Id: pdcwin.h,v 1.7 2012/05/19 05:19:44 wmcbrine Exp $ */
#ifdef PDC_WIDE
# define UNICODE
#endif
#include <windows.h>
#undef MOUSE_MOVED
#include <curspriv.h>
#ifdef CHTYPE_LONG
# define PDC_ATTR_SHIFT 19
#else
# define PDC_ATTR_SHIFT 8
#endif
extern unsigned char *pdc_atrtab;
extern HANDLE pdc_con_out, pdc_con_in;
extern DWORD pdc_quick_edit;
extern int PDC_get_buffer_rows(void);
| 18.5 | 61 | 0.718468 |
1e82cd57f849bced4cdb300ee2c3cbcca8ab576b | 506 | h | C | src/settings.h | OneMoreGres/tasklog | da8e9ee9582b6d1a51237e4cfe41081d975e30b8 | [
"MIT"
] | null | null | null | src/settings.h | OneMoreGres/tasklog | da8e9ee9582b6d1a51237e4cfe41081d975e30b8 | [
"MIT"
] | null | null | null | src/settings.h | OneMoreGres/tasklog | da8e9ee9582b6d1a51237e4cfe41081d975e30b8 | [
"MIT"
] | null | null | null | #pragma once
#include <QKeySequence>
class Settings
{
public:
Settings();
void load();
void save();
QString workingFileName() const;
void setWorkingFileName(const QString &workingFileName);
QKeySequence addRecordHotkey() const;
void setAddRecordHotkey(const QKeySequence &addRecordHotkey);
QString keywordPrefixes() const;
void setKeywordPrefixes(const QString &keywordPrefixes);
private:
QString workingFileName_;
QKeySequence addRecordHotkey_;
QString keywordPrefixes_;
};
| 18.740741 | 63 | 0.772727 |
37ee35505475944f20fe22fd5eac434741dd619f | 2,215 | h | C | bootstrap/include/panda$collections$Iterator$LTpanda$core$Int64$GT.h | ethannicholas/panda-old | 75576bcf5c4e5a34e964547d623a5de874e6e47c | [
"MIT"
] | null | null | null | bootstrap/include/panda$collections$Iterator$LTpanda$core$Int64$GT.h | ethannicholas/panda-old | 75576bcf5c4e5a34e964547d623a5de874e6e47c | [
"MIT"
] | null | null | null | bootstrap/include/panda$collections$Iterator$LTpanda$core$Int64$GT.h | ethannicholas/panda-old | 75576bcf5c4e5a34e964547d623a5de874e6e47c | [
"MIT"
] | null | null | null | // This file was automatically generated by the Panda compiler
#ifndef panda$collections$Iterator$LTpanda$core$Int64$GT_H
#define panda$collections$Iterator$LTpanda$core$Int64$GT_H
extern panda$core$Class panda$collections$Iterator$LTpanda$core$Int64$GT_class;
#ifndef CLASS_panda$collections$Iterator$LTpanda$core$Int64$GT
#define CLASS_panda$collections$Iterator$LTpanda$core$Int64$GT
struct panda$collections$Iterator$LTpanda$core$Int64$GT {
panda$core$Class* cl;
};
#define panda$collections$Iterator$LTpanda$core$Int64$GT$get_done_$Rpanda$core$Bit_INDEX 4
typedef Bit(panda$collections$Iterator$LTpanda$core$Int64$GT$get_done_$Rpanda$core$Bit_TYPE)(panda$collections$Iterator$LTpanda$core$Int64$GT* self);
#define panda$collections$Iterator$LTpanda$core$Int64$GT$fold_$LPpanda$core$Int64$Cpanda$core$Int64$RP$EQ$GT$LPpanda$core$Int64$RP_$Rpanda$core$Int64_INDEX 5
typedef Int64(panda$collections$Iterator$LTpanda$core$Int64$GT$fold_$LPpanda$core$Int64$Cpanda$core$Int64$RP$EQ$GT$LPpanda$core$Int64$RP_$Rpanda$core$Int64_TYPE)(panda$collections$Iterator$LTpanda$core$Int64$GT* self, void**);
#define panda$collections$Iterator$LTpanda$core$Int64$GT$fold_$LPpanda$core$Int64$Cpanda$core$Int64$RP$EQ$GT$LPpanda$core$Int64$RP_Int64_$Rpanda$core$Int64_INDEX 6
typedef Int64(panda$collections$Iterator$LTpanda$core$Int64$GT$fold_$LPpanda$core$Int64$Cpanda$core$Int64$RP$EQ$GT$LPpanda$core$Int64$RP_Int64_$Rpanda$core$Int64_TYPE)(panda$collections$Iterator$LTpanda$core$Int64$GT* self, void**, Int64);
#define panda$collections$Iterator$LTpanda$core$Int64$GT$filter_$LPpanda$core$Int64$RP$EQ$GT$LPpanda$core$Bit$RP_$Rpanda$collections$Iterator$LTpanda$core$Int64$GT_INDEX 7
typedef panda$collections$Iterator$LTpanda$core$Int64$GT*(panda$collections$Iterator$LTpanda$core$Int64$GT$filter_$LPpanda$core$Int64$RP$EQ$GT$LPpanda$core$Bit$RP_$Rpanda$collections$Iterator$LTpanda$core$Int64$GT_TYPE)(panda$collections$Iterator$LTpanda$core$Int64$GT* self, void**);
#define panda$collections$Iterator$LTpanda$core$Int64$GT$next_$Rpanda$core$Int64_INDEX 8
typedef Int64(panda$collections$Iterator$LTpanda$core$Int64$GT$next_$Rpanda$core$Int64_TYPE)(panda$collections$Iterator$LTpanda$core$Int64$GT* self);
#endif
#endif
| 96.304348 | 284 | 0.826637 |
1b3d935fe2681cd98a9b8d9c52cad3d5e29b2055 | 483 | h | C | QHCoreLib/Async/QHAsyncTaskRetryWrapper.h | QHLib/QHCoreLib | d7b053b6a9159bb0c0fd19cbcb3d5cca344d538d | [
"MIT"
] | 4 | 2018-01-12T15:49:06.000Z | 2020-07-03T06:57:50.000Z | QHCoreLib/Async/QHAsyncTaskRetryWrapper.h | QHLib/QHCoreLib | d7b053b6a9159bb0c0fd19cbcb3d5cca344d538d | [
"MIT"
] | null | null | null | QHCoreLib/Async/QHAsyncTaskRetryWrapper.h | QHLib/QHCoreLib | d7b053b6a9159bb0c0fd19cbcb3d5cca344d538d | [
"MIT"
] | 3 | 2020-07-03T06:57:55.000Z | 2021-06-25T05:36:20.000Z | //
// QHAsyncTaskRetryWrapper.h
// QHCoreLib
//
// Created by changtang on 2018/9/10.
// Copyright © 2018年 TCTONY. All rights reserved.
//
#import <QHCoreLib/QHAsyncTask.h>
NS_ASSUME_NONNULL_BEGIN
@interface QHAsyncTaskRetryWrapper<ResultType> : QHAsyncTask<ResultType>
- (instancetype)initWithTaskBuilder:(QHAsyncTaskBuilder)builder
maxTryCount:(int)maxTryCount
retryInterval:(double)retryInterval;
@end
NS_ASSUME_NONNULL_END
| 21.954545 | 72 | 0.718427 |
23fe1acf408f1c0c2c6253ff14119d1e4981f755 | 4,499 | h | C | dcmimage/include/dcmtk/dcmimage/diqthitl.h | chrisvana/dcmtk_copy | f929ab8590aca5b7a319c95af4fe2ee31be52f46 | [
"Apache-2.0"
] | 24 | 2015-07-22T05:07:51.000Z | 2019-02-28T04:52:33.000Z | dcmimage/include/dcmtk/dcmimage/diqthitl.h | chrisvana/dcmtk_copy | f929ab8590aca5b7a319c95af4fe2ee31be52f46 | [
"Apache-2.0"
] | 13 | 2015-07-23T05:43:02.000Z | 2021-07-17T17:14:45.000Z | dcmimage/include/dcmtk/dcmimage/diqthitl.h | chrisvana/dcmtk_copy | f929ab8590aca5b7a319c95af4fe2ee31be52f46 | [
"Apache-2.0"
] | 13 | 2015-07-23T01:07:30.000Z | 2021-01-05T09:49:30.000Z | /*
*
* Copyright (C) 2002-2010, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmimage
*
* Author: Marco Eichelberg
*
* Purpose: class DcmQuantHistogramItemList
*
* Last Update: $Author: joergr $
* Update Date: $Date: 2010-10-14 13:16:29 $
* CVS/RCS Revision: $Revision: 1.4 $
* Status: $State: Exp $
*
* CVS/RCS Log at end of file
*
*/
#ifndef DIQTHITL_H
#define DIQTHITL_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/oflist.h" /* for OFList */
#include "dcmtk/dcmimage/diqthitm.h" /* for DcmQuantHistogramItem */
/** this is a helper class used by class DcmQuantColorHashTable.
* It maintains a list of DcmQuantHistogramItem objects.
*/
class DcmQuantHistogramItemList
{
public:
/// constructor
DcmQuantHistogramItemList();
/// destructor. Destroys all objects pointed to by list.
~DcmQuantHistogramItemList();
/** this method moves the contents of this list into the given array.
* The list becomes empty if the array is large enough to contain all list members.
* @param array array of pointers to DcmQuantHistogramItem
* @param counter When called, contains the index of the array element
* into which the first member of the list will be moved. Must be < numcolors.
* Upon return, contains the array index of the last element moved + 1.
* @param numcolors number of elements in array
*/
void moveto(DcmQuantHistogramItemPointer *array, unsigned long& counter, unsigned long numcolors);
/** searches the list for an entry that equals the given pixel value.
* If found, the integer value assigned to that pixel is returned, otherwise returns -1.
* @param colorP pixel to lookup in list
* @return integer value for given color if found, -1 otherwise.
*/
inline int lookup(const DcmQuantPixel& colorP)
{
first = list_.begin();
while (first != last)
{
if ((*first)->equals(colorP)) return (*first)->getValue();
++first;
}
return -1;
}
/** adds the given pixel to the list. If the pixel is already
* contained in the list, it's integer value (counter) is increased
* and 0 is returned. Otherwise, a new entry with a counter of 1
* is created and 1 is returned.
* @param colorP pixel to add to the list
* @return 0 if pixel was already in list, 1 otherwise.
*/
inline unsigned long add(const DcmQuantPixel& colorP)
{
first = list_.begin();
while (first != last)
{
if ((*first)->equals(colorP))
{
(*first)->incValue();
return 0;
}
++first;
}
// not found in list, create new entry
list_.push_front(new DcmQuantHistogramItem(colorP, 1));
return 1;
}
/** inserts a new DcmQuantHistogramItem at the beginning of the list.
* @param colorP pixel value assigned to the new object in the list
* @param value integer value assigned to the new object in the list
*/
inline void push_front(const DcmQuantPixel& colorP, int value)
{
list_.push_front(new DcmQuantHistogramItem(colorP, value));
}
/// returns current number of objects in the list
inline size_t size() const
{
return list_.size();
}
private:
/// list of (pointers to) DcmQuantHistogramItem objects
OFList<DcmQuantHistogramItem *> list_;
/// temporary iterator used in various methods; declared here for efficiency reasons only.
OFListIterator(DcmQuantHistogramItem *) first;
/// constant iterator which always contains list_.end(); declared here for efficiency reasons only.
OFListIterator(DcmQuantHistogramItem *) last;
};
/// typedef for a pointer to a DcmQuantHistogramItemList object
typedef DcmQuantHistogramItemList *DcmQuantHistogramItemListPointer;
#endif
/*
* CVS/RCS Log:
* $Log: diqthitl.h,v $
* Revision 1.4 2010-10-14 13:16:29 joergr
* Updated copyright header. Added reference to COPYRIGHT file.
*
* Revision 1.3 2005/12/08 16:01:49 meichel
* Changed include path schema for all DCMTK header files
*
* Revision 1.2 2003/12/17 16:57:55 joergr
* Renamed parameters/variables "list" to avoid name clash with STL class.
*
* Revision 1.1 2002/01/25 13:32:05 meichel
* Initial release of new color quantization classes and
* the dcmquant tool in module dcmimage.
*
*
*/
| 28.656051 | 101 | 0.686597 |
bbe43a874b7000f1b49ac89c30f225febcc92781 | 1,816 | c | C | src/dpdk/drivers/net/octeontx/octeontx_rxtx.c | vineetbvp/trex-core | 04db80d621acc7852bd2bc351dbb4d966402c93c | [
"Apache-2.0"
] | null | null | null | src/dpdk/drivers/net/octeontx/octeontx_rxtx.c | vineetbvp/trex-core | 04db80d621acc7852bd2bc351dbb4d966402c93c | [
"Apache-2.0"
] | null | null | null | src/dpdk/drivers/net/octeontx/octeontx_rxtx.c | vineetbvp/trex-core | 04db80d621acc7852bd2bc351dbb4d966402c93c | [
"Apache-2.0"
] | null | null | null | /* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2017 Cavium, Inc
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <rte_atomic.h>
#include <rte_common.h>
#include <rte_ethdev_driver.h>
#include <rte_ether.h>
#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_prefetch.h>
#include "octeontx_ethdev.h"
#include "octeontx_rxtx.h"
#include "octeontx_logs.h"
uint16_t __rte_hot
octeontx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
struct octeontx_rxq *rxq;
struct rte_event ev;
size_t count;
uint16_t valid_event;
rxq = rx_queue;
count = 0;
while (count < nb_pkts) {
valid_event = rte_event_dequeue_burst(rxq->evdev,
rxq->ev_ports, &ev,
1, 0);
if (!valid_event)
break;
rx_pkts[count++] = ev.mbuf;
}
return count; /* return number of pkts received */
}
#define T(name, f3, f2, f1, f0, sz, flags) \
static uint16_t __rte_noinline __rte_hot \
octeontx_xmit_pkts_ ##name(void *tx_queue, \
struct rte_mbuf **tx_pkts, uint16_t pkts) \
{ \
uint64_t cmd[(sz)]; \
\
return __octeontx_xmit_pkts(tx_queue, tx_pkts, pkts, cmd, \
flags); \
}
OCCTX_TX_FASTPATH_MODES
#undef T
void __rte_hot
octeontx_set_tx_function(struct rte_eth_dev *dev)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
const eth_tx_burst_t tx_burst_func[2][2][2][2] = {
#define T(name, f3, f2, f1, f0, sz, flags) \
[f3][f2][f1][f0] = octeontx_xmit_pkts_ ##name,
OCCTX_TX_FASTPATH_MODES
#undef T
};
dev->tx_pkt_burst = tx_burst_func
[!!(nic->tx_offload_flags & OCCTX_TX_OFFLOAD_MBUF_NOFF_F)]
[!!(nic->tx_offload_flags & OCCTX_TX_OFFLOAD_OL3_OL4_CSUM_F)]
[!!(nic->tx_offload_flags & OCCTX_TX_OFFLOAD_L3_L4_CSUM_F)]
[!!(nic->tx_offload_flags & OCCTX_TX_MULTI_SEG_F)];
}
| 23.584416 | 79 | 0.702643 |
49c8aba5ec0578ac9ed482c006718cdc6d237823 | 9,090 | c | C | src/sales_detail_form.c | markjolesen/tabitha | 4902013694d1bc30c1f9b17093932e61cca65e79 | [
"ICU",
"CC0-1.0"
] | null | null | null | src/sales_detail_form.c | markjolesen/tabitha | 4902013694d1bc30c1f9b17093932e61cca65e79 | [
"ICU",
"CC0-1.0"
] | null | null | null | src/sales_detail_form.c | markjolesen/tabitha | 4902013694d1bc30c1f9b17093932e61cca65e79 | [
"ICU",
"CC0-1.0"
] | null | null | null | /*
sales_detail_form.c
License CC0 PUBLIC DOMAIN
To the extent possible under law, Mark J. Olesen has waived all copyright
and related or neighboring rights to tabitha. This work is published from:
United States.
*/
#include "sales.h"
#include "edit.h"
#include "error.h"
#include <gmodule.h>
struct property
{
GtkEntry* m_product_id;
GtkEntry* m_description;
GtkSpinButton* m_quantity;
GtkEntry* m_unit_price;
gchar m_current_id[size_product_id];
};
static int
bind(
struct property*const o_property,
GtkBuilder*const io_builder)
{
int l_exit;
memset(o_property, 0, sizeof(*o_property));
l_exit= -1;
do
{
(*o_property).m_product_id=
GTK_ENTRY(gtk_builder_get_object(io_builder, "sales_detail_product_id"));
if (0 == (*o_property).m_product_id)
{
break;
}
(*o_property).m_description=
GTK_ENTRY(gtk_builder_get_object(io_builder, "sales_detail_description"));
if (0 == (*o_property).m_description)
{
break;
}
(*o_property).m_quantity=
GTK_SPIN_BUTTON(gtk_builder_get_object(io_builder, "sales_detail_quantity"));
if (0 == (*o_property).m_quantity)
{
break;
}
(*o_property).m_unit_price=
GTK_ENTRY(gtk_builder_get_object(io_builder, "sales_detail_unit_price"));
if (0 == (*o_property).m_unit_price)
{
break;
}
l_exit= 0;
}while(0);
return l_exit;
}
static void
set(
struct property*const io_property,
struct sales_detail const*const i_object)
{
gtk_entry_set_text((*io_property).m_product_id, (*i_object).m_product_id);
gtk_entry_set_text((*io_property).m_description, (*i_object).m_description);
if ((*i_object).m_quantity[0])
{
gtk_entry_set_text(GTK_ENTRY((*io_property).m_quantity), (*i_object).m_quantity);
}
gtk_entry_set_text((*io_property).m_unit_price, (*i_object).m_unit_price);
return;
}
static void
set_product(
struct property*const io_property,
struct product const*const i_object)
{
gtk_entry_set_text((*io_property).m_product_id, (*i_object).m_product_id);
gtk_entry_set_text((*io_property).m_description, (*i_object).m_description);
gtk_entry_set_text((*io_property).m_unit_price, (*i_object).m_unit_price);
return;
}
static void
copy(
struct sales_detail*const io_object,
struct property const*const i_property)
{
gchar const* l_text;
memset(io_object, 0, sizeof(*io_object));
l_text= gtk_entry_get_text((*i_property).m_product_id);
g_strlcpy((*io_object).m_product_id, l_text, sizeof((*io_object).m_product_id));
l_text= gtk_entry_get_text((*i_property).m_description);
g_strlcpy((*io_object).m_description, l_text, sizeof((*io_object).m_description));
l_text= gtk_entry_get_text(GTK_ENTRY((*i_property).m_quantity));
g_strlcpy((*io_object).m_quantity, l_text, sizeof((*io_object).m_quantity));
l_text= gtk_entry_get_text((*i_property).m_unit_price);
g_strlcpy((*io_object).m_unit_price, l_text, sizeof((*io_object).m_unit_price));
return;
}
G_MODULE_EXPORT gboolean
on_sales_detail_product_id_focus_out_event(
G_GNUC_UNUSED GtkWidget* io_widget,
G_GNUC_UNUSED GdkEvent* io_event,
gpointer io_user_data)
{
GtkDialog* l_dialog;
GError* l_error;
int l_exists;
int l_exit;
struct product* l_product;
struct property* l_property;
int l_rc;
struct session* l_session;
gchar const* l_text;
gboolean l_visible;
l_product= (struct product*)g_malloc0(sizeof(*l_product));
l_error= 0;
l_dialog= GTK_DIALOG(GTK_WIDGET(io_user_data));
do
{
l_visible= gtk_widget_get_visible(GTK_WIDGET(l_dialog));
if (FALSE == l_visible)
{
break;
}
l_session= (struct session*)g_object_get_data(G_OBJECT(l_dialog), "session");
l_property= (struct property*)g_object_get_data(G_OBJECT(l_dialog), "property");
l_text= gtk_entry_get_text((*l_property).m_product_id);
g_strlcpy((*l_product).m_product_id, l_text, sizeof((*l_product).m_product_id));
l_rc= g_strcmp0((*l_product).m_product_id, (*l_property).m_current_id);
if (0 == l_rc)
{
break;
}
l_exit= product_exists(&l_error, &l_exists, l_session, (*l_product).m_product_id);
if (l_exit || FALSE == l_exists)
{
break;
}
l_exit= product_fetch(&l_error, l_product, l_session, (*l_product).m_product_id);
if (l_exit)
{
break;
}
set_product(l_property, l_product);
}while(0);
g_free(l_product);
if (l_error)
{
_error_display(GTK_WINDOW(l_dialog), l_error);
g_clear_error(&l_error);
}
return GDK_EVENT_PROPAGATE;
}
G_MODULE_EXPORT void
on_sales_detail_product_id_index_button_clicked(
G_GNUC_UNUSED GtkButton*const io_button,
gpointer io_user_data)
{
GtkBuilder* l_builder;
GtkDialog* l_dialog;
GError* l_error;
int l_exit;
struct product* l_product;
struct property* l_property;
struct session* l_session;
l_product= (struct product*)g_malloc0(sizeof(*l_product));
l_error= 0;
l_dialog= GTK_DIALOG(io_user_data);
l_session= (struct session*)g_object_get_data(G_OBJECT(l_dialog), "session");
l_property= (struct property*)g_object_get_data(G_OBJECT(l_dialog), "property");
l_builder= GTK_BUILDER(g_object_get_data(G_OBJECT(l_dialog), "builder"));
do
{
l_exit= product_index_form((*l_product).m_product_id, l_session, GTK_WINDOW(l_dialog), l_builder);
if (l_exit)
{
break;
}
l_exit= product_fetch(&l_error, l_product, l_session, (*l_product).m_product_id);
if (l_exit)
{
break;
}
set_product(l_property, l_product);
}while(0);
g_free(l_product);
if (l_error)
{
_error_display(GTK_WINDOW(l_dialog), l_error);
g_clear_error(&l_error);
}
return;
}
extern int
sales_detail_form(
struct sales_detail*const io_object,
struct session*const io_session,
GtkWindow*const io_parent,
GtkBuilder*const io_builder)
{
GtkDialog* l_dialog;
GError* l_error;
int l_exit;
gboolean l_exists;
struct property* l_property;
l_dialog= 0;
l_error= 0;
l_exit= -1;
l_property= (struct property*)g_malloc0(sizeof(*l_property));
do
{
l_dialog= GTK_DIALOG(gtk_builder_get_object(io_builder, "dialog_sales_detail"));
if (0 == l_dialog)
{
l_error= g_error_new(
domain_general,
error_generic,
"Unable to find dialog: '%s'",
"dialog_sales_detail");
break;
}
gtk_window_set_transient_for(GTK_WINDOW(l_dialog), io_parent);
l_exit= bind(l_property, io_builder);
if (l_exit)
{
l_error= g_error_new(
domain_general,
error_generic,
"Unable to load dialog: '%s'",
"dialog_sales_detail");
break;
}
set(l_property, io_object);
g_object_set_data(G_OBJECT(l_dialog), "session", io_session);
g_object_set_data(G_OBJECT(l_dialog), "property", l_property);
g_object_set_data(G_OBJECT(l_dialog), "builder", io_builder);
gtk_widget_show_all(GTK_WIDGET(l_dialog));
gtk_window_set_modal(GTK_WINDOW(l_dialog), 1);
do
{
l_exit= gtk_dialog_run(l_dialog);
if (GTK_RESPONSE_OK != l_exit)
{
break;
}
copy(io_object, l_property);
if (0 == (*io_object).m_product_id[0])
{
l_exit= 0;
break;
}
l_exit= product_exists(&l_error, &l_exists, io_session, (*io_object).m_product_id);
if ((0 == l_exit) && l_exists)
{
break;
}
l_error= g_error_new(
domain_sales_detail,
error_sales_detail_form_product_does_not_exist,
"Product ID '%s' does not exist",
(*io_object).m_product_id);
_error_display(io_parent, l_error);
g_clear_error(&l_error);
}while(1);
}while(0);
g_free(l_property);
if (l_dialog)
{
gtk_widget_hide(GTK_WIDGET(l_dialog));
}
if (l_error)
{
_error_display(io_parent, l_error);
g_clear_error(&l_error);
}
return l_exit;
}
/*
vim:expandtab:softtabstop=2:tabstop=2:shiftwidth=2:nowrap:ruler
*/
| 24.701087 | 102 | 0.609241 |
17e042948eea51e9f304e519514921720fe54e3d | 1,779 | h | C | UnrealEngine-4.11.2-release/Engine/Plugins/Runtime/Analytics/AnalyticsMulticast/Source/AnaltyicsMulticastEditor/Classes/AnalyticsMulticastSettings.h | armroyce/Unreal | ea1cdebe70407d59af4e8366d7111c52ce4606df | [
"MIT"
] | 1 | 2016-10-01T21:35:52.000Z | 2016-10-01T21:35:52.000Z | UnrealEngine-4.11.2-release/Engine/Plugins/Runtime/Analytics/AnalyticsMulticast/Source/AnaltyicsMulticastEditor/Classes/AnalyticsMulticastSettings.h | armroyce/Unreal | ea1cdebe70407d59af4e8366d7111c52ce4606df | [
"MIT"
] | null | null | null | UnrealEngine-4.11.2-release/Engine/Plugins/Runtime/Analytics/AnalyticsMulticast/Source/AnaltyicsMulticastEditor/Classes/AnalyticsMulticastSettings.h | armroyce/Unreal | ea1cdebe70407d59af4e8366d7111c52ce4606df | [
"MIT"
] | 1 | 2021-04-27T08:48:33.000Z | 2021-04-27T08:48:33.000Z | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AnalyticsSettings.h"
#include "AnalyticsMulticastSettings.generated.h"
UCLASS()
class UAnalyticsMulticastSettings
: public UAnalyticsSettingsBase
{
GENERATED_UCLASS_BODY()
/** The list of analytics providers to forward analytics events to */
UPROPERTY(EditAnywhere, DisplayName="Release Providers", Category=Multicast, meta=(ConfigRestartRequired=true))
TArray<FString> ReleaseMulticastProviders;
/** The list of analytics providers to forward analytics events to */
UPROPERTY(EditAnywhere, DisplayName="Debug Providers", Category=Multicast, meta=(ConfigRestartRequired=true))
TArray<FString> DebugMulticastProviders;
/** The list of analytics providers to forward analytics events to */
UPROPERTY(EditAnywhere, DisplayName="Test Providers", Category=Multicast, meta=(ConfigRestartRequired=true))
TArray<FString> TestMulticastProviders;
/** The list of analytics providers to forward analytics events to */
UPROPERTY(EditAnywhere, DisplayName="Development Providers", Category=Multicast, meta=(ConfigRestartRequired=true))
TArray<FString> DevelopmentMulticastProviders;
// UAnalyticsSettingsBase interface
protected:
/**
* Provides a mechanism to read the section based information into this UObject's properties
*/
virtual void ReadConfigSettings();
/**
* Provides a mechanism to save this object's properties to the section based ini values
*/
virtual void WriteConfigSettings();
private:
/** Helper to populate an array with the results of the config read */
void BuildArrayFromString(const FString& List, TArray<FString>& Array);
/** Helper to build the comma delimited string from the array */
FString BuildStringFromArray(TArray<FString>& Array);
};
| 37.851064 | 116 | 0.78977 |
b502d01eb07ead094806e97169ec23eb138eff4a | 1,160 | h | C | snapgear_linux/user/microwin/src/include/ntextfield.h | impedimentToProgress/UCI-BlueChip | 53e5d48b79079eaf60d42f7cb65bb795743d19fc | [
"MIT"
] | null | null | null | snapgear_linux/user/microwin/src/include/ntextfield.h | impedimentToProgress/UCI-BlueChip | 53e5d48b79079eaf60d42f7cb65bb795743d19fc | [
"MIT"
] | null | null | null | snapgear_linux/user/microwin/src/include/ntextfield.h | impedimentToProgress/UCI-BlueChip | 53e5d48b79079eaf60d42f7cb65bb795743d19fc | [
"MIT"
] | 3 | 2016-06-13T13:20:56.000Z | 2019-12-05T02:31:23.000Z | /*
* NanoWidgets v0.1
* (C) 1999 Screen Media AS
*
* Written by Vidar Hokstad
*
* Contains code from The Nano Toolkit,
* (C) 1999 by Alexander Peuchert.
*
*/
#ifndef __NTEXTFIELD_H
#define __NTEXTFIELD_H
DEFINE_NOBJECT(textfield,widget)
char * textbuf;
long maxsize; /* Maximum number of characters */
int curpos; /* Current cursor position */
int firstpos; /* First visible character */
long overwrite; /* Overwrite if 1, insert if 0 */
int esc; /* 1 if currently processing an escape sequence */
/* Handler to be called to verify input - Can be used to restrict input
* to for instance integers, or hexadecimal, or whatever format you want
*/
int (* verify_handler)(struct textfield_nobject *,char *);
END_NOBJECT
DEFINE_NCLASS(textfield,widget)
NSLOT(int,init);
NSLOT(void,settext);
NSLOT(const char * ,gettext);
END_NCLASS
#define n_textfield_init(__this__,__parent__,__text__) n_call(textfield,init,__this__,(__this__,__parent__,__text__))
typedef struct textfield_nobject NTEXTFIELD;
void n_init_textfield_class(void); /* Initialise textfield class */
#endif
| 26.363636 | 117 | 0.703448 |
a56fb5ec15c4ffe3be774eaab749dbc2530b736b | 309 | h | C | JobStatus.h | fin-alice/BitsClient | ced1ab1f05a89e28b3e6c8043739b19beef16a90 | [
"BSD-3-Clause"
] | 1 | 2018-07-11T09:51:33.000Z | 2018-07-11T09:51:33.000Z | JobStatus.h | fin-alice/BitsClient | ced1ab1f05a89e28b3e6c8043739b19beef16a90 | [
"BSD-3-Clause"
] | null | null | null | JobStatus.h | fin-alice/BitsClient | ced1ab1f05a89e28b3e6c8043739b19beef16a90 | [
"BSD-3-Clause"
] | 1 | 2018-10-11T07:52:32.000Z | 2018-10-11T07:52:32.000Z | #pragma once
#include <windows.h>
#include <commctrl.h>
class JobStatus
{
HWND status_bar;
class MainWindow * parent;
HINSTANCE instance;
UINT id;
public:
JobStatus(class MainWindow*, UINT);
~JobStatus();
void SendResizeMessage(WORD, WORD);
unsigned int GetHeight();
void SetText(const TCHAR*);
};
| 17.166667 | 36 | 0.731392 |
77e6fbcbaaae899e024c37e7124b9fe4f5627ce7 | 2,973 | h | C | Projects/HW3P3/SenderSocket.h | iamjeffx/CSCE-463 | c9724a993909db2f9cb58e9835e8c0ec6efa49e5 | [
"MIT"
] | null | null | null | Projects/HW3P3/SenderSocket.h | iamjeffx/CSCE-463 | c9724a993909db2f9cb58e9835e8c0ec6efa49e5 | [
"MIT"
] | null | null | null | Projects/HW3P3/SenderSocket.h | iamjeffx/CSCE-463 | c9724a993909db2f9cb58e9835e8c0ec6efa49e5 | [
"MIT"
] | 1 | 2022-01-24T09:01:59.000Z | 2022-01-24T09:01:59.000Z | #pragma once
#pragma comment(lib, "ws2_32")
#include "pch.h"
using namespace std;
#define IPLENGTH 15
#define SYNTYPE 0
#define FINTYPE 1
#define DATATYPE 2
#define FORWARD_PATH 0
#define RETURN_PATH 1
#define MAGIC_PROTOCOL 0x8311AA
// Possible status codes
#define STATUS_OK 0 // no error
#define ALREADY_CONNECTED 1 // second call to ss.Open() without closing connection
#define NOT_CONNECTED 2 // call to ss.Send()/Close() without ss.Open()
#define INVALID_NAME 3 // ss.Open() with targetHost that has no DNS entry
#define FAILED_SEND 4 // sendto() failed in kernel
#define TIMEOUT 5 // timeout after all retx attempts are exhausted
#define FAILED_RECV 6 // recvfrom() failed in kernel
#define MAGIC_PORT 22345 // receiver listens on this port
#define MAX_PKT_SIZE (1500-28) // maximum UDP packet size accepted by receiver
#define MAX_RTX 50
#pragma pack(push, 1)
class LinkProperties {
public:
// transfer parameters
float RTT; // propagation RTT (in sec)
float speed; // bottleneck bandwidth (in bits/sec)
float pLoss[2]; // probability of loss in each direction
DWORD bufferSize; // buffer size of emulated routers (in packets)
LinkProperties() { memset(this, 0, sizeof(*this)); }
};
class Flags {
public:
DWORD reserved : 5; // must be zero
DWORD SYN : 1;
DWORD ACK : 1;
DWORD FIN : 1;
DWORD magic : 24;
Flags() { memset(this, 0, sizeof(*this)); magic = MAGIC_PROTOCOL; }
};
class SenderDataHeader {
public:
Flags flags;
DWORD seq; // must begin from 0
};
class SenderSynHeader {
public:
SenderDataHeader sdh;
LinkProperties lp;
};
class ReceiverHeader {
public:
Flags flags;
DWORD recvWnd; // receiver window for flow control (in pkts)
DWORD ackSeq; // ack value = next expected sequence
};
class Packet {
public:
int type; // SYN, FIN, data
int size; // for the worker thread
clock_t txTime; // transmission time
SenderDataHeader sdh; // header
char data[MAX_PKT_SIZE]; // payload
};
#pragma pack(pop)
class SenderSocket {
public:
int numTO = 0;
int numRtx = 0;
int windowSize = 0;
int lastReleased;
int effectiveWindow;
SOCKET sock;
HANDLE quit;
HANDLE stats;
HANDLE workers;
HANDLE full;
HANDLE empty;
HANDLE receive;
HANDLE complete;
double estRTT = -1;
double devRTT = -1;
double alpha = 0.125;
double beta = 0.25;
int base;
int nextSeq;
int nextSend;
bool open = false;
Packet* packets = NULL;
struct sockaddr_in local;
struct sockaddr_in server;
struct hostent* remote;
int timeout;
double RTO;
SenderSocket();
~SenderSocket();
DWORD Open(string host, int port, int senderWindow, LinkProperties* lp);
DWORD Close(double timeElapsed);
DWORD Send(char* ptr, int bytes);
void ReceiveACK(int* dup, int* rtx);
static DWORD WINAPI Worker(LPVOID self);
static DWORD WINAPI Stats(LPVOID self);
};
| 22.353383 | 82 | 0.679448 |
a012a7b7abe0d215e105895ff9a7d07d9f2cd8f4 | 5,626 | h | C | src/select/mq.h | netsurf-alex/libcss | 0a4cdfdc7438d3d6348cdbba0c5614f0045c9368 | [
"MIT"
] | null | null | null | src/select/mq.h | netsurf-alex/libcss | 0a4cdfdc7438d3d6348cdbba0c5614f0045c9368 | [
"MIT"
] | null | null | null | src/select/mq.h | netsurf-alex/libcss | 0a4cdfdc7438d3d6348cdbba0c5614f0045c9368 | [
"MIT"
] | 1 | 2022-01-16T11:22:36.000Z | 2022-01-16T11:22:36.000Z | /*
* This file is part of LibCSS
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2018 Michael Drake <tlsa@netsurf-browser.org>
*/
#ifndef css_select_mq_h_
#define css_select_mq_h_
#include "select/helpers.h"
#include "select/unit.h"
static inline bool mq_match_feature_range_length_op1(
css_mq_feature_op op,
const css_mq_value *value,
const css_fixed client_len,
const css_unit_ctx *unit_ctx)
{
css_fixed v;
if (value->type != CSS_MQ_VALUE_TYPE_DIM) {
return false;
}
if (value->data.dim.unit != UNIT_PX) {
v = css_unit_len2px_mq(unit_ctx,
value->data.dim.len,
css__to_css_unit(value->data.dim.unit));
} else {
v = value->data.dim.len;
}
switch (op) {
case CSS_MQ_FEATURE_OP_BOOL: return false;
case CSS_MQ_FEATURE_OP_LT: return v < client_len;
case CSS_MQ_FEATURE_OP_LTE: return v <= client_len;
case CSS_MQ_FEATURE_OP_EQ: return v == client_len;
case CSS_MQ_FEATURE_OP_GTE: return v >= client_len;
case CSS_MQ_FEATURE_OP_GT: return v > client_len;
default:
return false;
}
}
static inline bool mq_match_feature_range_length_op2(
css_mq_feature_op op,
const css_mq_value *value,
const css_fixed client_len,
const css_unit_ctx *unit_ctx)
{
css_fixed v;
if (op == CSS_MQ_FEATURE_OP_UNUSED) {
return true;
}
if (value->type != CSS_MQ_VALUE_TYPE_DIM) {
return false;
}
if (value->data.dim.unit != UNIT_PX) {
v = css_unit_len2px_mq(unit_ctx,
value->data.dim.len,
css__to_css_unit(value->data.dim.unit));
} else {
v = value->data.dim.len;
}
switch (op) {
case CSS_MQ_FEATURE_OP_LT: return client_len < v;
case CSS_MQ_FEATURE_OP_LTE: return client_len <= v;
case CSS_MQ_FEATURE_OP_EQ: return client_len == v;
case CSS_MQ_FEATURE_OP_GTE: return client_len >= v;
case CSS_MQ_FEATURE_OP_GT: return client_len > v;
default:
return false;
}
}
/**
* Match media query features.
*
* \param[in] feat Condition to match.
* \param[in] unit_ctx Current unit conversion context.
* \param[in] media Current media spec, to check against feat.
* \return true if condition matches, otherwise false.
*/
static inline bool mq_match_feature(
const css_mq_feature *feat,
const css_unit_ctx *unit_ctx,
const css_media *media)
{
/* TODO: Use interned string for comparison. */
if (strcmp(lwc_string_data(feat->name), "width") == 0) {
if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
media->width, unit_ctx)) {
return false;
}
return mq_match_feature_range_length_op2(feat->op2,
&feat->value2, media->width, unit_ctx);
} else if (strcmp(lwc_string_data(feat->name), "height") == 0) {
if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
media->height, unit_ctx)) {
return false;
}
return mq_match_feature_range_length_op2(feat->op2,
&feat->value2, media->height, unit_ctx);
}
/* TODO: Look at other feature names. */
return false;
}
/**
* Match media query conditions.
*
* \param[in] cond Condition to match.
* \param[in] unit_ctx Current unit conversion context.
* \param[in] media Current media spec, to check against cond.
* \return true if condition matches, otherwise false.
*/
static inline bool mq_match_condition(
const css_mq_cond *cond,
const css_unit_ctx *unit_ctx,
const css_media *media)
{
bool matched = !cond->op;
for (uint32_t i = 0; i < cond->nparts; i++) {
bool part_matched;
if (cond->parts[i]->type == CSS_MQ_FEATURE) {
part_matched = mq_match_feature(
cond->parts[i]->data.feat,
unit_ctx, media);
} else {
assert(cond->parts[i]->type == CSS_MQ_COND);
part_matched = mq_match_condition(
cond->parts[i]->data.cond,
unit_ctx, media);
}
if (cond->op) {
/* OR */
matched |= part_matched;
if (matched) {
break; /* Short-circuit */
}
} else {
/* AND */
matched &= part_matched;
if (!matched) {
break; /* Short-circuit */
}
}
}
return matched != cond->negate;
}
/**
* Test whether media query list matches current media.
*
* If anything in the list matches, the list matches. If none match
* it doesn't match.
*
* \param[in] m Media query list.
* \param[in] unit_ctx Current unit conversion context.
* \param[in] media Current media spec, to check against m.
* \return true if media query list matches media
*/
static inline bool mq__list_match(
const css_mq_query *m,
const css_unit_ctx *unit_ctx,
const css_media *media)
{
for (; m != NULL; m = m->next) {
/* Check type */
if (!!(m->type & media->type) != m->negate_type) {
if (m->cond == NULL ||
mq_match_condition(m->cond,
unit_ctx, media)) {
/* We have a match, no need to look further. */
return true;
}
}
}
return false;
}
/**
* Test whether the rule applies for current media.
*
* \param rule Rule to test
* \param unit_ctx Current unit conversion context.
* \param media Current media spec
* \return true iff chain's rule applies for media
*/
static inline bool mq_rule_good_for_media(
const css_rule *rule,
const css_unit_ctx *unit_ctx,
const css_media *media)
{
bool applies = true;
const css_rule *ancestor = rule;
while (ancestor != NULL) {
const css_rule_media *m = (const css_rule_media *) ancestor;
if (ancestor->type == CSS_RULE_MEDIA) {
applies = mq__list_match(m->media, unit_ctx, media);
if (applies == false) {
break;
}
}
if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) {
ancestor = ancestor->parent;
} else {
ancestor = NULL;
}
}
return applies;
}
#endif
| 24.25 | 68 | 0.679168 |
53b4433cea47adc966c9f72344ed9fa0cb221736 | 235 | h | C | Wikipedia/Code/UIView+Debugging.h | the-sailor/wikipedia-ios | 1f8861fcedb0fbd273bfb497ef6e6b6c95ceab62 | [
"MIT"
] | 1 | 2016-10-10T14:39:30.000Z | 2016-10-10T14:39:30.000Z | Wikipedia/Code/UIView+Debugging.h | jindulys/Wikipedia | 78609a2397ff1d5826443a65d40ebd491e68678c | [
"MIT"
] | null | null | null | Wikipedia/Code/UIView+Debugging.h | jindulys/Wikipedia | 78609a2397ff1d5826443a65d40ebd491e68678c | [
"MIT"
] | 5 | 2016-10-11T20:06:21.000Z | 2019-07-17T17:43:17.000Z | // Created by Monte Hurd on 8/28/13.
// Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!
#import <UIKit/UIKit.h>
@interface UIView (Debugging)
- (void)randomlyColorSubviews;
@end
| 21.363636 | 102 | 0.740426 |
3efa7cbfc365798e56da170bd9a42031118cd363 | 3,467 | h | C | src/kaleidoscope/codeGenContext.h | moddyz/Kaleidoscope | 27a662d69ecaf0b9eaf0505a616befecc0ab3187 | [
"MIT"
] | null | null | null | src/kaleidoscope/codeGenContext.h | moddyz/Kaleidoscope | 27a662d69ecaf0b9eaf0505a616befecc0ab3187 | [
"MIT"
] | null | null | null | src/kaleidoscope/codeGenContext.h | moddyz/Kaleidoscope | 27a662d69ecaf0b9eaf0505a616befecc0ab3187 | [
"MIT"
] | null | null | null | #pragma once
#include <kaleidoscope/api.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/LegacyPassManager.h>
namespace llvm
{
class TargetMachine;
namespace orc
{
class KaleidoscopeJIT;
}
} // namespace llvm
namespace kaleidoscope
{
class PrototypeAST;
/// CodeGenContext is a structure storing the internal state
/// of the generated IR code, and various LLVM objects which
/// contribute to code-generation.
///
/// This class has ownership of the following objects:
/// - LLVM context
/// - a module.
/// - an IR builder.
/// - a function pass manager.
///
/// The module and function pass manager are not initialized upon CodeGenContext construction,
/// Use InitializeModule() in situations which only demand IR and/or object code generation.
/// Or, use InitializeModuleWithJIT() in situations which require both IR code generation and JIT execution.
///
/// MoveModule() facilitates ownership transfer of its module over to the JIT engine.
class CodeGenContext
{
public:
KALEIDOSCOPE_API
CodeGenContext();
/// Print out the generated IR code described in the module thus far.
KALEIDOSCOPE_API
void Print();
/// Get the LLVM context.
KALEIDOSCOPE_API
llvm::LLVMContext& GetLLVMContext();
/// Get the LLVM IR Builder.
KALEIDOSCOPE_API
llvm::IRBuilder<>& GetIRBuilder();
/// Initialize the module with target triple (architecture) and target machine.
KALEIDOSCOPE_API
void InitializeModule( const std::string& i_targetTriple, llvm::TargetMachine* i_targetMachine );
/// Initialize the module with data layout based on JIT.
KALEIDOSCOPE_API
void InitializeModuleWithJIT( llvm::orc::KaleidoscopeJIT& io_jit );
/// Get the LLVM module as a raw ptr.
KALEIDOSCOPE_API
llvm::Module* GetModule();
/// Move the LLVM module as a unique ptr, transfering ownership to an external entity.
KALEIDOSCOPE_API
std::unique_ptr< llvm::Module > MoveModule();
/// Get all the named values in scope.
KALEIDOSCOPE_API
std::map< std::string, llvm::Value* >& GetNamedValuesInScope();
/// Get the function pass manager.
KALEIDOSCOPE_API
llvm::legacy::FunctionPassManager* GetFunctionPassManager();
/// Generate code from an existing function prototype
llvm::Function* GetFunction( const std::string& i_functionName );
/// Add a function prototype to be discoverable by callers.
KALEIDOSCOPE_API
void AddFunction( std::unique_ptr< PrototypeAST >& io_prototype );
private:
/// Used internally for setting up optimization passes.
void InitializePassManager();
llvm::LLVMContext m_context; /// Storage of LLVM internals.
llvm::IRBuilder<> m_irBuilder; /// Helper object for generating instructions.
/// Manager all the optimization passes.
std::unique_ptr< llvm::legacy::FunctionPassManager > m_passManager = nullptr;
/// Top-level container for functions and global variables.
std::unique_ptr< llvm::Module > m_module = nullptr;
/// Keeps track of values defined in the scope, mapped to their IR.
/// Currently, only function parameters are referencable.
std::map< std::string, llvm::Value* > m_namedValuesInScope;
/// Tracks existing function prototypes which are declared.
using FunctionPrototypeMap = std::map< std::string, std::unique_ptr< PrototypeAST > >;
FunctionPrototypeMap m_functionPrototypes;
};
} // namespace kaleidoscope
| 31.518182 | 108 | 0.723969 |
9976ce4b14256d2145dfe8245dd26693fed4f77e | 466 | h | C | gpu/mappedMemory/randMem/common.h | efficient/gopt | 12539018f8861f1e556a3486f355116e5d700c33 | [
"Apache-2.0"
] | 39 | 2015-05-05T23:30:54.000Z | 2021-11-01T21:47:35.000Z | gpu/mappedMemory/randMem/common.h | tayler-hetherington/gopt | 12539018f8861f1e556a3486f355116e5d700c33 | [
"Apache-2.0"
] | null | null | null | gpu/mappedMemory/randMem/common.h | tayler-hetherington/gopt | 12539018f8861f1e556a3486f355116e5d700c33 | [
"Apache-2.0"
] | 17 | 2015-05-05T23:34:12.000Z | 2021-04-02T10:07:48.000Z | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include <unistd.h>
#include <assert.h>
#define LOG_CAP (64 * 1024 * 1024) // 512 MB
#define LOG_CAP_ (LOG_CAP - 1)
#define LOG_KEY 1
#define ITERS 1000
void printDeviceProperties();
long long get_cycles();
void waitForNonZero(volatile int *A, int N);
#define CPE(val, msg, err_code) \
if(val) { fprintf(stderr, msg); fprintf(stderr, " Error %d \n", err_code); \
exit(err_code);}
| 21.181818 | 77 | 0.690987 |
5b34967a73115982389c97b35b16bf0349f35d48 | 23,070 | c | C | v0100/tests/mandel.c | tilarids/SmallerC | 2e8c1542cea23c24ca741db19313c944eb16972b | [
"BSD-2-Clause"
] | null | null | null | v0100/tests/mandel.c | tilarids/SmallerC | 2e8c1542cea23c24ca741db19313c944eb16972b | [
"BSD-2-Clause"
] | null | null | null | v0100/tests/mandel.c | tilarids/SmallerC | 2e8c1542cea23c24ca741db19313c944eb16972b | [
"BSD-2-Clause"
] | 1 | 2020-07-17T03:21:43.000Z | 2020-07-17T03:21:43.000Z | /*
Generates an image of the Mandelbrot set and saves it as "mandel.ppm".
Copyright (c) 2010-2016 Ce, D34N4L3X, StealthyC, Phillips1012, Alexey Frunze.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled "GNU
Free Documentation License".
Adapted from http://rosettacode.org/wiki/Mandelbrot_set#JavaScript
How to compile for DOS (huge/.EXE, 32-bit DPMI/.EXE):
smlrcc -dosh mandel.c -o mandelh.exe
smlrcc -dosp mandel.c -o mandelp.exe
How to compile for Windows:
smlrcc -win mandel.c -o mandelw.exe
How to compile for Linux:
smlrcc -linux mandel.c -o mandell
*/
#include <stdio.h>
#include <math.h>
int mandelIter(double cx, double cy, int maxIter)
{
double x = 0;
double y = 0;
double xx = 0;
double yy = 0;
double xy = 0;
int i = maxIter;
while (i-- && xx + yy <= 4)
{
xy = x * y;
xx = x * x;
yy = y * y;
x = xx - yy + cx;
y = xy + xy + cy;
}
return maxIter - i;
}
void mandelbrot(FILE* f,
int width, int height,
double xmin, double xmax, double ymin, double ymax,
int iterations)
{
int ix, iy;
for (iy = 0; iy < height; ++iy)
{
for (ix = 0; ix < width; ++ix)
{
double x = xmin + (xmax - xmin) * ix / (width - 1);
double y = ymin + (ymax - ymin) * iy / (height - 1);
int i = mandelIter(x, y, iterations);
unsigned char pix[3];
if (i > iterations)
{
pix[0] = 0;
pix[1] = 0;
pix[2] = 0;
}
else
{
double c = 3 * log(i) / log(iterations - 1.0);
if (c < 1)
{
pix[0] = 255 * c;
pix[1] = 0;
pix[2] = 0;
}
else if (c < 2)
{
pix[0] = 255;
pix[1] = 255 * (c - 1);
pix[2] = 0;
}
else
{
pix[0] = 255;
pix[1] = 255;
pix[2] = 255 * (c - 2);
}
}
fwrite(pix, 1, sizeof pix, f);
}
}
}
int main(void)
{
FILE* f = fopen("mandel.ppm", "wb");
if (f)
{
enum
{
WIDTH = 640, HEIGHT = 428
// WIDTH = 800, HEIGHT = 534
// WIDTH = 900, HEIGHT = 600
};
fprintf(f, "P6\n %s\n %d\n %d\n %d\n", "#Mandelbrot Set", WIDTH, HEIGHT, 255);
mandelbrot(f, WIDTH, HEIGHT, -2, 1, -1, 1, 1000);
fclose(f);
}
return 0;
}
/*
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
*/
| 45.058594 | 82 | 0.768401 |
8583a3669fef1995744d23539921e49b9d7bef7a | 116 | h | C | TrabalhoPOO/HardSkin.h | mbcrocci/TrabalhoPOO | 30378382b412e3ed875dbb2bfb897061dafc73ef | [
"MIT"
] | null | null | null | TrabalhoPOO/HardSkin.h | mbcrocci/TrabalhoPOO | 30378382b412e3ed875dbb2bfb897061dafc73ef | [
"MIT"
] | null | null | null | TrabalhoPOO/HardSkin.h | mbcrocci/TrabalhoPOO | 30378382b412e3ed875dbb2bfb897061dafc73ef | [
"MIT"
] | null | null | null | #pragma once
#include "Trait.h"
class HardSkin :
public Trait
{
public:
HardSkin ();
virtual ~HardSkin ();
};
| 9.666667 | 22 | 0.655172 |
3f054ee183b95fe0f52588a3aa5bce422035f0a7 | 7,332 | c | C | receive433.c | MVO2015/poltergeist | bd1b57f189b88e01b44a5cc6f060674a670781dd | [
"MIT"
] | null | null | null | receive433.c | MVO2015/poltergeist | bd1b57f189b88e01b44a5cc6f060674a670781dd | [
"MIT"
] | null | null | null | receive433.c | MVO2015/poltergeist | bd1b57f189b88e01b44a5cc6f060674a670781dd | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pigpio.h>
#include <signal.h>
#include <time.h>
#include <string.h>
#define short_pulse 1000
#define long_pulse (2 * short_pulse)
#define PIN_INPUT_RF433 9
#define PIN_LED_GREEN 4
#define PIN_LED_AMBER 17
#define PIN_LED_RED 27
#define THERMOSTAT_ADDR "10011"
#define FILE_NAME "heating.dat"
#define LOG_FILE_NAME "/var/log/poltergeist/sensors.log"
#define SEASON_FILE_NAME "season_on.dat"
volatile sig_atomic_t stop;
void inthand(int signum) {
stop = 1;
}
uint32_t last_tick;
int wait_for_start = 0;
int wait_for_end = 1;
int bitCounter = 0;
char bitRegister[13] = {'0','0','0','0','0','0','0','0','0','0','0','0', '\0' };
char *thermostat = THERMOSTAT_ADDR "011";
char *value_off = "0100";
char *value_on = "0010";
char *text_off = "OFF";
char *text_on = "ON";
char *value_batt_full = "0110";
char *text_batt_full = "Battery full";
time_t rawtime, last_time = 0, command_recognized_time, insert_data_time;
struct tm * timeinfo;
char timestr[20]; // YYYY-MM-DD HH:MM:SS\0
char *last_command, *actual_command;
int data_packet_repeats;
FILE *fptr, *logptr, *fseason;
int startsWith(const char *pre, const char *str)
{
size_t lenpre = strlen(pre), lenstr = strlen(str);
return lenstr < lenpre ? 0 : strncmp(pre, str, lenpre) == 0;
}
char *getTime(time_t timer)
{
timeinfo = localtime(&timer);
strftime(timestr, 20, "%F %T", timeinfo);
return timestr;
}
void myISR(int gpio, int level, uint32_t tick)
{
uint32_t tick_diff;
char *text;
// Start pulse
if (1 == level) {
last_tick = tick;
return;
}
// End frame
if (2 == level && !wait_for_start) {
tick_diff = tick - last_tick;
if (tick_diff > (2 * long_pulse)) {
wait_for_end = 0;
wait_for_start = 1;
gpioWrite(PIN_LED_AMBER, 0);
if (bitCounter != 12) {
// Bad packet, ignoring
return;
}
if (!startsWith(thermostat, bitRegister)) {
// bad address
return;
}
int command_recognized = 1;
if (strcmp(&bitRegister[8], value_on) == 0) {
text = text_on;
gpioWrite(PIN_LED_RED, 1);
gpioWrite(PIN_LED_GREEN, 0);
actual_command = value_on;
} else if (strcmp(&bitRegister[8], value_off) == 0) {
text = text_off;
gpioWrite(PIN_LED_RED, 0);
gpioWrite(PIN_LED_GREEN, 1);
actual_command = value_off;
} else if (strcmp(&bitRegister[8], value_batt_full) == 0) {
text = text_batt_full;
} else {
gpioWrite(PIN_LED_RED, 1);
gpioWrite(PIN_LED_GREEN, 1);
text = "UNKNOWN COMMAND";
command_recognized = 0;
}
if (command_recognized) {
command_recognized_time = time(NULL);
if ((command_recognized_time - last_time > 59) || actual_command != last_command) {
last_command = actual_command;
last_time = command_recognized_time;
if (strcmp(text, text_on) == 0) {
fseek(fptr, 0, SEEK_SET);
fprintf(fptr, "%lu:1", command_recognized_time);
fflush(fptr);
}
if (strcmp(text, text_off) == 0) {
fseek(fptr, 0, SEEK_SET);
fprintf(fptr, "%lu:0", command_recognized_time);
fflush(fptr);
}
fseek(logptr, -1, SEEK_END);
if (fgetc(logptr) != '\n') {
fprintf(logptr, "\n");
}
fprintf(logptr, "%lu,THERMOSTAT,%s,%s,", time(&command_recognized_time), bitRegister, text);
fflush(logptr);
}
if ((command_recognized_time - last_time < 1) && actual_command == last_command) {
last_time = command_recognized_time;
fprintf(logptr, "+");
fflush(logptr);
}
}
}
}
if (0 == level) {
tick_diff = tick - last_tick;
gpioWrite(PIN_LED_AMBER, 0);
// Start frame
if (wait_for_start && !wait_for_end && tick_diff < short_pulse) {
wait_for_start = 0;
bitCounter = 0;
gpioWrite(PIN_LED_AMBER, 1);
return;
}
if (!wait_for_start && !wait_for_end) {
if (bitCounter > 11) {
// Overflow error, ignoring packet
wait_for_end = 1;
return;
}
if (tick_diff < short_pulse) {
bitRegister[bitCounter] = '0';
} else {
bitRegister[bitCounter] = '1';
}
bitCounter++;
}
}
}
void setup()
{
gpioSetSignalFunc(SIGINT, inthand);
gpioSetMode(PIN_LED_GREEN, PI_OUTPUT);
gpioSetMode(PIN_LED_AMBER, PI_OUTPUT);
gpioSetMode(PIN_LED_RED, PI_OUTPUT);
gpioWrite(PIN_LED_RED, 0);
gpioWrite(PIN_LED_AMBER, 0);
gpioWrite(PIN_LED_GREEN, 0);
gpioWrite(PIN_INPUT_RF433, 0);
gpioSetMode(PIN_INPUT_RF433, PI_INPUT);
gpioGlitchFilter(PIN_INPUT_RF433, short_pulse / 2);
if (gpioSetAlertFunc(PIN_INPUT_RF433, myISR ) < 0) {
fprintf(stderr, "Set Alert Error!\n");
}
if (gpioSetWatchdog(PIN_INPUT_RF433, long_pulse * 2 / 1000) < 0) {
fprintf(stderr, "Set Watchdog error!\n");
}
last_time = time(NULL) - 61;
last_tick = gpioTick();
fptr = fopen(HOME "/" FILE_NAME, "w");
if (fptr == NULL) {
fprintf(stderr, "Error - cannot open file %s\n", HOME "/" FILE_NAME);
exit(1);
}
logptr = fopen(LOG_FILE_NAME, "a+");
if (logptr == NULL) {
fprintf(stderr, "Error - cannot open file '" LOG_FILE_NAME "\n");
exit(1);
}
printf("All is OK!\n");
printf("Home is '%s'.\n", HOME);
printf("Logging to '%s'.\n", LOG_FILE_NAME);
fflush(stdout);
}
void cleanup()
{
gpioSetSignalFunc(SIGINT, NULL);
gpioSetAlertFunc(PIN_INPUT_RF433, NULL);
gpioSetWatchdog(PIN_INPUT_RF433, 0);
gpioWrite(PIN_LED_AMBER, 0);
gpioWrite(PIN_LED_GREEN, 0);
gpioWrite(PIN_LED_RED, 0);
gpioSetMode(PIN_LED_AMBER, PI_INPUT);
gpioSetMode(PIN_LED_GREEN, PI_INPUT);
gpioSetMode(PIN_LED_RED, PI_INPUT);
gpioTerminate();
fclose(fptr);
fclose(logptr);
}
int main()
{
time_t actual_time;
if (gpioInitialise() < 0) {
// pigpio initialisation failed.
return 1;
}
setup();
while(!stop) {
actual_time = time(NULL);
if (difftime(actual_time, last_time) > 61.0) {
gpioWrite(PIN_LED_GREEN, 0);
gpioWrite(PIN_LED_GREEN, 0);
gpioWrite(PIN_LED_AMBER, 1);
}
usleep(500000);
gpioWrite(PIN_LED_AMBER, 0);
usleep(500000);
fseason = fopen(HOME "/" SEASON_FILE_NAME, "r");
if (!fseason) {
stop = 1;
}
}
printf("\nExiting safely\n");
cleanup();
return 0;
}
| 29.445783 | 112 | 0.546508 |
8b8d1aeffff063f61ab74c216ed448c19bb2c697 | 822 | c | C | Exercise/57/3/cl.c | sunhuiquan/tlpi-learn | a4674ce2fd21f29f09e6471b12070cdc5eec2f91 | [
"MIT"
] | 49 | 2021-07-29T14:26:51.000Z | 2022-03-27T10:08:06.000Z | Exercise/57/3/cl.c | sunhuiquan/TLPI_learn_note | a4674ce2fd21f29f09e6471b12070cdc5eec2f91 | [
"MIT"
] | 1 | 2021-09-02T07:56:43.000Z | 2021-09-04T09:45:05.000Z | Exercise/57/3/cl.c | sunhuiquan/TLPI_learn_note | a4674ce2fd21f29f09e6471b12070cdc5eec2f91 | [
"MIT"
] | 4 | 2021-10-03T18:08:48.000Z | 2022-03-22T14:58:38.000Z | #include "myund.h"
int main(int argc, char *argv[])
{
int cfd;
struct sockaddr_un addr;
struct request req;
struct response res;
if (argc != 2 || *argv[1] == '-')
{
printf("%s usage: seq-num\n", argv[0]);
exit(EXIT_SUCCESS);
}
req.seqLen = atoi(argv[1]);
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
strncpy(&addr.sun_path[1], SOCKET_PATH, sizeof(addr.sun_path) - 2);
if ((cfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
errExit("socket");
if (connect(cfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) == -1)
errExit("connect");
if (send(cfd, &req, sizeof(struct request), 0) != sizeof(struct request))
errExit("send");
if (recv(cfd, &res, sizeof(struct response), 0) != sizeof(struct response))
errExit("recv");
printf("%d\n", res.seqNum);
return 0;
} | 24.909091 | 78 | 0.647202 |
e92c3c7eeee9e4da6a27369cb686f9a4c634142f | 21,398 | c | C | test/src/utility_test.c | Hannibal42/BundleFS | d32e25ce946cf21f3434c895aad201df8165799b | [
"MIT"
] | 1 | 2017-09-22T02:51:33.000Z | 2017-09-22T02:51:33.000Z | test/src/utility_test.c | Hannibal42/BundleFS | d32e25ce946cf21f3434c895aad201df8165799b | [
"MIT"
] | null | null | null | test/src/utility_test.c | Hannibal42/BundleFS | d32e25ce946cf21f3434c895aad201df8165799b | [
"MIT"
] | null | null | null | #include "utility_test.h"
#include "../../include/window_buffer.h"
#include "file_system.h"
#include "bit_functions.h"
uint8_t *table1, *table1_empty, *table2_empty, *table2;
uint8_t *data1, *data2, *data3;
uint8_t *buffer, *at_buffer;
struct DISK *disk1;
struct FILE_SYSTEM fs;
int find_seq_byte(uint8_t byte, uint length);
int find_seq(const uint8_t *table, uint table_size, uint length);
void write_seq(uint8_t *table, uint index, uint length);
void delete_seq(uint8_t *table, uint index, uint length);
void find_max_sequence(const uint8_t *table,
uint table_size, uint *max_start, uint *max_length,
uint *end_start, uint *end_length, bool *start_in_table);
bool check_seq(uint8_t *table, uint index, uint length);
int find_seq_small(const uint8_t *table, uint table_size, uint length);
int get_free_bit(uint8_t index, uint8_t byte);
int last_free_bits(uint8_t byte);
void write_bit(uint8_t *table, uint index, bool value);
TEST_GROUP(utility_tests);
TEST_SETUP(utility_tests)
{
uint i;
/* Allocation table */
table1 = malloc(64);
table1_empty = malloc(64);
table2 = malloc(256);
table2_empty = malloc(256);
for (i = 0; i < 64; ++i)
table1[i] = 0xFF;
for (i = 0; i < 64; ++i)
table1_empty[i] = 0x00;
for (i = 0; i < 256; ++i)
table2_empty[i] = 0x00;
for (i = 0; i < 256; ++i)
table2[i] = 0xFF;
/* Test Data */
data1 = malloc(128);
data2 = malloc(1024);
data3 = malloc(2048);
for (i = 0; i < 128; ++i)
data1[i] = 0x0F;
for (i = 0; i < 1024; ++i)
data2[i] = 0xD0;
for (i = 0; i < 2048; ++i)
data3[i] = 0xEE;
/* For global function testing */
disk1 = malloc(sizeof(struct DISK));
/*Struct setup*/
disk_fill(disk1, "disks/disk1.disk", 65536, 512);
disk_create(disk1, 65536);
disk1->sector_block_mapping = 8;
buffer = malloc(65536);
at_buffer = malloc(4096);
disk_initialize(disk1);
for (i = 0; i < 65536; ++i)
buffer[i] = 0xFF;
disk_write(disk1, buffer, 0, 16);
disk_shutdown(disk1);
disk_initialize(disk1);
fs.sector_size = 4096;
fs.sector_count = 16;
fs.disk = disk1;
fs.alloc_table = 0;
fs.alloc_table_size = 10;
fs.alloc_table_buffer_size = 4096;
struct AT_WINDOW *window = malloc(sizeof(struct AT_WINDOW));
init_window(window, &fs, at_buffer);
fs.at_win = window;
}
TEST_TEAR_DOWN(utility_tests)
{
free(table1);
free(table2);
free(table1_empty);
free(table2_empty);
free(data1);
free(data2);
free(data3);
free(buffer);
free(fs.at_win);
free(at_buffer);
free(disk1);
}
TEST(utility_tests, find_seq_small_test)
{
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 10), -1);
table1[0] = 0x87;
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 4), 1);
table1[1] = 0x08;
table1[2] = 0x0F;
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 5), 13);
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 6), 13);
table1[3] = 0x00;
table1[4] = 0x01;
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 8), 24);
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 8), 24);
TEST_ASSERT_EQUAL_INT(find_seq_small(table1, 64, 1), 1);
TEST_ASSERT_EQUAL_INT(find_seq_small(table2, 256, 10), -1);
table2[0] = 0x40;
table2[1] = 0x00;
table2[2] = 0x00;
table2[3] = 0x00;
table2[4] = 0x00;
TEST_ASSERT_EQUAL_INT(find_seq_small(table2, 256, 5), 2);
table2[0] = 0x07;
TEST_ASSERT_EQUAL_INT(find_seq_small(table2, 1, 5), 0);
}
TEST(utility_tests, popcount_test)
{
uint k, count;
uint8_t i, tmp;
for (i = 0; i < 255; ++i) {
count = 0;
tmp = i;
for (k = 128; k > 0; k /= 2) {
if (tmp / k) {
count += 1;
tmp -= k;
}
}
TEST_ASSERT_EQUAL_INT(popcount(i), count);
}
}
TEST(utility_tests, last_free_bits_test)
{
uint8_t tmp;
tmp = 0x00;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 8);
tmp = 0x80;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 7);
tmp = 0xC0;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 6);
tmp = 0xE0;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 5);
tmp = 0xF0;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 4);
tmp = 0x08;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 3);
tmp = 0x8C;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 2);
tmp = 0x1E;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 1);
tmp = 0x2F;
TEST_ASSERT_EQUAL_INT(last_free_bits(tmp), 0);
}
TEST(utility_tests, get_free_bit_test)
{
uint8_t tmp;
tmp = 0x00;
TEST_ASSERT_EQUAL_INT(get_free_bit(0, tmp), 8);
TEST_ASSERT_EQUAL_INT(get_free_bit(3, tmp), 5);
TEST_ASSERT_EQUAL_INT(get_free_bit(8, tmp), -1);
tmp = 0xFF;
TEST_ASSERT_EQUAL_INT(get_free_bit(0, tmp), 0);
TEST_ASSERT_EQUAL_INT(get_free_bit(10, tmp), -1);
TEST_ASSERT_EQUAL_INT(get_free_bit(3, tmp), 0);
tmp = 0x87;
TEST_ASSERT_EQUAL_INT(get_free_bit(1, tmp), 4);
TEST_ASSERT_EQUAL_INT(get_free_bit(2, tmp), 3);
tmp = 0xF0;
TEST_ASSERT_EQUAL_INT(get_free_bit(3, tmp), 0);
TEST_ASSERT_EQUAL_INT(get_free_bit(4, tmp), 4);
}
/*
TEST(utility_tests, find_bit_test)
{
table1[10] = 0x7F;
TEST_ASSERT_EQUAL_INT(find_bit(table1, 64), 80);
table1[10] = 0x00;
TEST_ASSERT_EQUAL_INT(find_bit(table1, 64), 80);
table1[9] = 0xF7;
TEST_ASSERT_EQUAL_INT(find_bit(table1, 64), 76);
table2[9] = 0xF7;
TEST_ASSERT_EQUAL_INT(find_bit(table2, 256), 76);
}*/
TEST(utility_tests, find_seq_test)
{
table1[10] = 0x78;
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 1), 80);
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 2), 85);
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 3), 85);
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 4), -1);
table1[11] = 0x7F;
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 4), 85);
table1[4] = 0xF0;
table1[5] = 0x00;
table1[6] = 0x0F;
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 14), 36);
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 15), 36);
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 17), -1);
TEST_ASSERT_EQUAL_INT(find_seq(table2_empty, 256, 256), 0);
TEST_ASSERT_EQUAL_INT(find_seq(table2_empty, 256, 50000), -1);
table1[4] = 0x80;
table1[5] = 0x00;
table1[6] = 0x10;
TEST_ASSERT_EQUAL_INT(find_seq(table1, 64, 15), 33);
}
TEST(utility_tests, write_seq_test)
{
uint i;
write_seq(table1_empty, 0, 7);
TEST_ASSERT_EQUAL_HEX8(table1_empty[0], 0xFE);
for (i = 1; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1_empty[i], 0x00);
write_seq(table1_empty, 7, 1);
TEST_ASSERT_EQUAL_HEX8(table1_empty[0], 0xFF);
for (i = 1; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1_empty[i], 0x00);
write_seq(table1_empty, 8, 15);
TEST_ASSERT_EQUAL_HEX8(table1_empty[1], 0xFF);
TEST_ASSERT_EQUAL_HEX8(table1_empty[2], 0xFE);
for (i = 3; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1_empty[i], 0x00);
write_seq(table1_empty, 25, 10);
TEST_ASSERT_EQUAL_HEX8(table1_empty[0], 0xFF);
TEST_ASSERT_EQUAL_HEX8(table1_empty[1], 0xFF);
TEST_ASSERT_EQUAL_HEX8(table1_empty[2], 0xFE);
TEST_ASSERT_EQUAL_HEX8(table1_empty[3], 0x7F);
TEST_ASSERT_EQUAL_HEX8(table1_empty[4], 0xE0);
for (i = 5; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1_empty[i], 0x00);
}
TEST(utility_tests, delete_seq_test)
{
uint i;
delete_seq(table1, 0, 4);
TEST_ASSERT_EQUAL_HEX8(table1[0], 0x0F);
for (i = 1; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1[i], 0xFF);
delete_seq(table1, 4, 3);
TEST_ASSERT_EQUAL_HEX8(table1[0], 0x01);
for (i = 1; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1[i], 0xFF);
delete_seq(table1, 7, 10);
TEST_ASSERT_EQUAL_HEX8(table1[0], 0x00);
TEST_ASSERT_EQUAL_HEX8(table1[1], 0x00);
TEST_ASSERT_EQUAL_HEX8(table1[2], 0x7F);
for (i = 3; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1[i], 0xFF);
delete_seq(table1, 0, 512);
for (i = 0; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1[i], 0x00);
/* Checks if the delete makes bit toggle, or sets them to 0 */
delete_seq(table1, 0, 512);
for (i = 0; i < 64; ++i)
TEST_ASSERT_EQUAL_HEX8(table1[i], 0x00);
}
TEST(utility_tests, write_bit_test)
{
table1[0] = 0xFF;
table1[1] = 0XF8;
table1[2] = 0x00;
table1[3] = 0xFF;
table1[4] = 0xFF;
write_bit(table1, 0, 0);
TEST_ASSERT_EQUAL_HEX8(table1[0], 0x7F);
write_bit(table1, 0, 1);
TEST_ASSERT_EQUAL_HEX8(table1[0], 0xFF);
write_bit(table1, 8, 1);
TEST_ASSERT_EQUAL_HEX8(table1[1], 0xF8);
write_bit(table1, 8, 0);
TEST_ASSERT_EQUAL_HEX8(table1[1], 0x78);
write_bit(table1, 18, 1);
TEST_ASSERT_EQUAL_HEX8(table1[2], 0x20);
write_bit(table1, 39, 0);
TEST_ASSERT_EQUAL_HEX8(table1[4], 0xFE);
}
TEST(utility_tests, quick_sort_inodes_test)
{
uint i;
struct INODE a, b, c, d, e, f, g, h;
a.location = 20;
b.location = 20;
c.location = 21;
d.location = 300;
e.location = 570;
f.location = 3245;
g.location = 324567;
h.location = 334567856;
struct INODE solution[8] = {a, b, c, d, e, f, g, h};
struct INODE inodes1[8] = {h, g, d, a, b, e, c, f};
struct INODE inodes2[8] = {c, d, e, f, a, g, h, b};
quicksort_inodes(inodes1, 8);
quicksort_inodes(inodes2, 8);
for (i = 0; i < 8; ++i)
TEST_ASSERT_EQUAL_UINT(solution[i].location,
inodes1[i].location);
for (i = 0; i < 8; ++i)
TEST_ASSERT_EQUAL_UINT(solution[i].location,
inodes2[i].location);
}
TEST(utility_tests, find_seq_byte_test)
{
TEST_ASSERT_EQUAL(0, find_seq_byte(0x03, 6));
TEST_ASSERT_EQUAL(1, find_seq_byte(0x80, 6));
TEST_ASSERT_EQUAL(0, find_seq_byte(0x07, 5));
}
TEST(utility_tests, check_seq_test)
{
table1[11] = 0xC0;
TEST_ASSERT_TRUE(check_seq(table1, 90, 6));
TEST_ASSERT_TRUE(check_seq(table1, 90, 6));
TEST_ASSERT_FALSE(check_seq(table1, 90, 7));
TEST_ASSERT_TRUE(check_seq(table1, 91, 5));
table1[12] = 0x01;
TEST_ASSERT_TRUE(check_seq(table1, 90, 7));
TEST_ASSERT_TRUE(check_seq(table1, 90, 13));
TEST_ASSERT_FALSE(check_seq(table1, 90, 14));
table1[12] = 0x00;
table1[13] = 0x70;
TEST_ASSERT_TRUE(check_seq(table1, 95, 6));
TEST_ASSERT_TRUE(check_seq(table1, 90, 14));
TEST_ASSERT_TRUE(check_seq(table1, 90, 15));
TEST_ASSERT_FALSE(check_seq(table1, 90, 16));
TEST_ASSERT_TRUE(check_seq(table1, 96, 9));
table1[14] = 0xEF;
TEST_ASSERT_TRUE(check_seq(table1, 115, 1));
TEST_ASSERT_TRUE(check_seq(table1, 115, 0));
TEST_ASSERT_TRUE(check_seq(table1, 160, 0));
}
TEST(utility_tests, calc_fake_crc_test)
{
uint8_t tmp;
reset_crc();
tmp = calc_crc(0x00);
TEST_ASSERT_EQUAL_HEX8(0x00, tmp);
calc_crc(0x70);
tmp = calc_crc(0xAA);
TEST_ASSERT_EQUAL_HEX8(0xDA, tmp);
tmp = calc_crc(0xFF);
TEST_ASSERT_EQUAL_HEX8(0x25, tmp);
reset_crc();
tmp = calc_crc(0x00);
TEST_ASSERT_EQUAL_HEX8(0x00, tmp);
}
/*
* TODO: Fix the fs to run this test
TEST(utility_tests, get_ino_pos_test)
{
struct FILE_SYSTEM fs;
uint8_t tmp[4];
uint *pos, ino_cnt;
tmp[0] = 0xF0; tmp[1] = 0xFF;
tmp[2] = 0xF8; tmp[3] = 0x8F;
fs.inode_sec = 5;
pos = malloc(5 * sizeof(uint));
get_ino_pos_new(&fs, 20, pos, &ino_cnt);
TEST_ASSERT_EQUAL_UINT(2, ino_cnt);
TEST_ASSERT_EQUAL_UINT(0, pos[0]);
TEST_ASSERT_EQUAL_UINT(4, pos[1]);
get_ino_pos_new(&fs, 25, pos, &ino_cnt);
TEST_ASSERT_EQUAL_UINT(2, ino_cnt);
TEST_ASSERT_EQUAL_UINT(3, pos[0]);
TEST_ASSERT_EQUAL_UINT(4, pos[1]);
fs.inode_sec = 7;
get_ino_pos_new(&fs, 25, pos, &ino_cnt);
TEST_ASSERT_EQUAL_UINT(4, ino_cnt);
TEST_ASSERT_EQUAL_UINT(3, pos[0]);
TEST_ASSERT_EQUAL_UINT(4, pos[1]);
TEST_ASSERT_EQUAL_UINT(5, pos[2]);
TEST_ASSERT_EQUAL_UINT(6, pos[3]);
get_ino_pos_new(&fs, 0, pos, &ino_cnt);
TEST_ASSERT_EQUAL_UINT(4, ino_cnt);
TEST_ASSERT_EQUAL_UINT(0, pos[0]);
TEST_ASSERT_EQUAL_UINT(1, pos[1]);
TEST_ASSERT_EQUAL_UINT(2, pos[2]);
TEST_ASSERT_EQUAL_UINT(3, pos[3]);
free(pos);
}*/
TEST(utility_tests, delete_seq_global_test)
{
int i;
TEST_ASSERT_TRUE(delete_seq_global(fs.at_win, 40, 10));
disk_read(disk1, buffer, 0, 16);
TEST_ASSERT_EQUAL_HEX8(0x00, buffer[5]);
TEST_ASSERT_EQUAL_HEX8(0x3F, buffer[6]);
TEST_ASSERT_TRUE(delete_seq_global(fs.at_win, 5000 * 8, 10));
disk_read(disk1, buffer, 0, 16);
TEST_ASSERT_EQUAL_HEX8(0x00, buffer[5000]);
TEST_ASSERT_EQUAL_HEX8(0x3F, buffer[5001]);
/* Delete more than one sector */
TEST_ASSERT_TRUE(delete_seq_global(fs.at_win, 5, 4900 * 8));
disk_read(disk1, buffer, 0, 16);
TEST_ASSERT_EQUAL_HEX8(0xF8, buffer[0]);
for (i = 1; i < 4900; ++i)
TEST_ASSERT_EQUAL_HEX8(0x00, buffer[i]);
TEST_ASSERT_EQUAL_HEX8(0x07, buffer[4900]);
/* Delete a lot sectors */
TEST_ASSERT_TRUE(delete_seq_global(fs.at_win, 5050 * 8 + 3, 4096 * 8 * 5));
disk_read(disk1, buffer, 0, 16);
TEST_ASSERT_EQUAL_HEX8(0xE0, buffer[5050]);
for (i = 5051; i < 4096 * 5 + 5050; ++i){
TEST_ASSERT_EQUAL_HEX8(0x00, buffer[i]);
}
/* Delete first byte */
TEST_ASSERT_TRUE(delete_seq_global(fs.at_win, 0, 8));
disk_read(disk1, buffer, 0, 16);
TEST_ASSERT_EQUAL_HEX8(0x00, buffer[0]);
}
TEST(utility_tests, write_seq_global_test) {
int i, k;
for (k = 0; k <= fs.at_win->global_end; ++k) {
move_window(fs.at_win, i);
for (i = 0; i < 4096; ++i)
fs.at_win->buffer[i] = 0x00;
}
save_window(fs.at_win);
/* Small sequence */
TEST_ASSERT_TRUE(write_seq_global(fs.at_win, 0, 10));
TEST_ASSERT_EQUAL_HEX8(0xFF, fs.at_win->buffer[0]);
TEST_ASSERT_EQUAL_HEX8(0xC0, fs.at_win->buffer[1]);
/* Longer sequence */
TEST_ASSERT_TRUE(write_seq_global(fs.at_win, 20, 300));
TEST_ASSERT_EQUAL_HEX8(0xC0, fs.at_win->buffer[1]);
TEST_ASSERT_EQUAL_HEX8(0x0F, fs.at_win->buffer[2]);
for (i = 4; i < 38; ++i)
TEST_ASSERT_EQUAL_HEX8(0xFF, fs.at_win->buffer[i]);
/* Over two sectors */
TEST_ASSERT_TRUE(write_seq_global(fs.at_win, 4095 * 8, 240));
move_window(fs.at_win, 0);
TEST_ASSERT_EQUAL_HEX8(0x00, fs.at_win->buffer[4094]);
TEST_ASSERT_EQUAL_HEX8(0xFF, fs.at_win->buffer[4095]);
move_window(fs.at_win, 1);
for (i = 0; i < 29; ++i)
TEST_ASSERT_EQUAL_HEX8(0xFF, fs.at_win->buffer[i]);
}
TEST(utility_tests, find_seq_global_1_test) {
uint i;
/* Smallest sequence */
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 1, &i));
buffer[0] = 0x7F;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 1, &i));
TEST_ASSERT_EQUAL_INT(0, i);
/* Small sequence */
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 40, &i));
disk_read(disk1, buffer, 0, 16);
buffer[0] = 0x00;
buffer[1] = 0x00;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 10, &i));
TEST_ASSERT_EQUAL_INT(0, i);
/* Sequence over 2 sectors */
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 20, &i));
buffer[4095] = 0x00;
buffer[4096] = 0x00;
buffer[4097] = 0x00;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 20, &i));
TEST_ASSERT_EQUAL(32760, i);
/* Sequence at the end of the allocation table */
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 32, &i));
/* TODO: What the fuck is not working with this?
Weird bug
buffer[4096 * 10 -1] = 0x00;
buffer[4096 * 10 -2] = 0x00;
buffer[4096 * 10 -3] = 0x00;
buffer[4096 * 10 -4] = 0x00;
disk_write(disk1, buffer, 0, 16);
*/
TEST_ASSERT_TRUE(move_window(fs.at_win, 9));
fs.at_win->buffer[4095] = 0x00;
fs.at_win->buffer[4094] = 0x00;
fs.at_win->buffer[4093] = 0x00;
fs.at_win->buffer[4092] = 0x00;
TEST_ASSERT_TRUE(save_window(fs.at_win));
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 32, &i));
TEST_ASSERT_EQUAL(327648, i);
}
/* Test some sequences that are longer than one buffer window */
TEST(utility_tests, find_seq_global_2_test) {
int i, tmp;
uint k = 0;
/* Window buffer size +1 */
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 4097 * 8, &k));
for (i = 0; i < 4097; ++i)
buffer[i] = 0x00;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 4097 * 8, &k));
TEST_ASSERT_EQUAL_UINT(0, k);
/* Sequence not starting at zero*/
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, 5000 * 8, &k));
buffer[0] = 0xFF;
for (i = 1; i < 5001; ++i)
buffer[i] = 0x00;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 5000 * 8, &k));
TEST_ASSERT_EQUAL_INT(8, k);
/* 4 sector sequence*/
tmp = 4096 * 4;
TEST_ASSERT_FALSE(find_seq_global(fs.at_win, tmp * 8, &k));
for (i = 0; i < tmp; ++i)
buffer[i] = 0x00;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, tmp * 8, &k));
TEST_ASSERT_EQUAL_INT(0, k);
/*Start in the second sector*/
for (i = 0; i < 4096; ++i)
buffer[i] = 0xFF;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 5000, &k));
TEST_ASSERT_EQUAL_INT(4096 * 8, k);
/* All sectors */
for (i = 0; i < 4096 * 10; ++i)
buffer[i] = 0;
disk_write(disk1, buffer, 0, 16);
TEST_ASSERT_TRUE(find_seq_global(fs.at_win, 4096 * 10 * 8, &k));
TEST_ASSERT_EQUAL_INT(0, k);
}
TEST(utility_tests, find_max_sequence_test) {
//TEST_ASSERT_FALSE(true);
uint i, max_start, max_length, end_start, end_length;
bool start_in_table;
max_length = 0;
max_start = 0;
/* No full free byte */
find_max_sequence(data1, 128, &max_start, &max_length,
&end_start, &end_length, &start_in_table);
TEST_ASSERT_EQUAL_UINT(0, max_start);
TEST_ASSERT_EQUAL_UINT(0, max_length);
TEST_ASSERT_FALSE(start_in_table);
/* Some sequences */
data1[20] = 0x00;
data1[21] = 0x00;
data1[10] = 0x00;
data1[60] = 0x00;
find_max_sequence(data1, 128, &max_start, &max_length,
&end_start, &end_length, &start_in_table);
TEST_ASSERT_EQUAL_UINT(160, max_start);
TEST_ASSERT_EQUAL_UINT(16, max_length);
TEST_ASSERT_EQUAL_UINT(1024, end_start);
TEST_ASSERT_EQUAL_UINT(0, end_length);
TEST_ASSERT_TRUE(start_in_table);
/* Long sequence at the start and sequence at the end */
max_start = 0;
max_length = 0;
end_start = 0;
end_length = 0;
for (i = 0; i < 30; ++i)
data1[i] = 0x00;
for (i = 120; i < 128; ++i)
data1[i] = 0x00;
find_max_sequence(data1, 128, &max_start, &max_length,
&end_start, &end_length, &start_in_table);
TEST_ASSERT_EQUAL_UINT(0, max_start);
TEST_ASSERT_EQUAL_UINT(30 * 8, max_length);
TEST_ASSERT_EQUAL_UINT(120 * 8, end_start);
TEST_ASSERT_EQUAL_UINT(8 * 8, end_length);
TEST_ASSERT_TRUE(start_in_table);
/* Sequence that started before, that is maximum*/
max_start = 1337;
max_length = 3000;
end_start = 1337;
end_length = 3000;
find_max_sequence(data1, 128, &max_start, &max_length,
&end_start, &end_length, &start_in_table);
TEST_ASSERT_EQUAL_UINT(1337, max_start);
TEST_ASSERT_EQUAL_UINT(3240, max_length);
TEST_ASSERT_EQUAL_UINT(120 * 8, end_start);
TEST_ASSERT_EQUAL_UINT(8 * 8, end_length);
TEST_ASSERT_FALSE(start_in_table);
/* No sequence that started before, but old maximum */
max_start = 1337;
max_length = 3000;
end_start = 0;
end_length = 0;
find_max_sequence(data1, 128, &max_start, &max_length,
&end_start, &end_length, &start_in_table);
TEST_ASSERT_EQUAL_UINT(1337, max_start);
TEST_ASSERT_EQUAL_UINT(3000, max_length);
TEST_ASSERT_EQUAL_UINT(120 * 8, end_start);
TEST_ASSERT_EQUAL_UINT(8 * 8, end_length);
TEST_ASSERT_FALSE(start_in_table);
}
TEST(utility_tests, find_max_sequence_global_test) {
uint i, k, start, length, buffer_size;
buffer_size = fs.at_win->sector_size * fs.at_win->sectors;
/* Easy sequence */
TEST_ASSERT_TRUE(find_max_sequence_global(fs.at_win, &start, &length));
TEST_ASSERT_EQUAL_UINT(0, length);
TEST_ASSERT_TRUE(move_window(fs.at_win, 0));
for (i = 50; i < 100; ++i)
fs.at_win->buffer[i] = 0x00;
TEST_ASSERT_TRUE(find_max_sequence_global(fs.at_win, &start, &length));
TEST_ASSERT_EQUAL_UINT(50 * 8, start);
TEST_ASSERT_EQUAL_UINT(50 * 8, length);
/* Sequence over two sectors */
TEST_ASSERT_TRUE(move_window(fs.at_win, 0));
for (i = 4000; i < buffer_size; ++i)
fs.at_win->buffer[i] = 0x00;
TEST_ASSERT_TRUE(move_window(fs.at_win, 1));
for (i = 0; i < 100; ++i)
fs.at_win->buffer[i] = 0x00;
TEST_ASSERT_TRUE(find_max_sequence_global(fs.at_win, &start, &length));
TEST_ASSERT_EQUAL_UINT(4000 * 8, start);
TEST_ASSERT_EQUAL_UINT((96 + 100) * 8, length);
/* On empty sector in the middle */
TEST_ASSERT_TRUE(move_window(fs.at_win, 1));
for (i = 0; i < buffer_size; ++i)
fs.at_win->buffer[i] = 0x00;
TEST_ASSERT_TRUE(move_window(fs.at_win, 2));
for (i = 0; i < 100; ++i)
fs.at_win->buffer[i] = 0x00;
TEST_ASSERT_TRUE(find_max_sequence_global(fs.at_win, &start, &length));
TEST_ASSERT_EQUAL_UINT(4000 * 8, start);
TEST_ASSERT_EQUAL_UINT((196 + 4096) * 8, length);
/*Empty allocation table*/
for (k = 0; k <= fs.at_win->global_end; ++k) {
TEST_ASSERT_TRUE(move_window(fs.at_win, k));
for (i = 0; i < buffer_size; ++i)
fs.at_win->buffer[i] = 0x00;
}
TEST_ASSERT_TRUE(find_max_sequence_global(fs.at_win, &start, &length));
TEST_ASSERT_EQUAL_UINT(0, start);
TEST_ASSERT_EQUAL_UINT((4096 * (fs.at_win->global_end + 1)) * 8, length);
}
TEST_GROUP_RUNNER(utility_tests)
{
//RUN_TEST_CASE(utility_tests, get_ino_pos_test);
RUN_TEST_CASE(utility_tests, write_bit_test);
RUN_TEST_CASE(utility_tests, write_seq_test);
RUN_TEST_CASE(utility_tests, delete_seq_test);
RUN_TEST_CASE(utility_tests, find_seq_test);
//RUN_TEST_CASE(utility_tests, find_bit_test);
RUN_TEST_CASE(utility_tests, get_free_bit_test);
RUN_TEST_CASE(utility_tests, last_free_bits_test);
RUN_TEST_CASE(utility_tests, popcount_test);
RUN_TEST_CASE(utility_tests, find_seq_small_test);
RUN_TEST_CASE(utility_tests, quick_sort_inodes_test);
RUN_TEST_CASE(utility_tests, find_seq_byte_test);
RUN_TEST_CASE(utility_tests, check_seq_test);
RUN_TEST_CASE(utility_tests, calc_fake_crc_test);
RUN_TEST_CASE(utility_tests, delete_seq_global_test);
RUN_TEST_CASE(utility_tests, write_seq_global_test);
RUN_TEST_CASE(utility_tests, find_seq_global_1_test);
RUN_TEST_CASE(utility_tests, find_seq_global_2_test);
RUN_TEST_CASE(utility_tests, find_max_sequence_test);
RUN_TEST_CASE(utility_tests, find_max_sequence_global_test);
}
| 26.614428 | 76 | 0.71273 |
8f2c9555caabd6d36196539f6430a89c3596b3ab | 7,577 | h | C | src/libraries/ros_lib/mavros_msgs/CommandCode.h | verlab/espcopter | 1b98b358db292fb2197ed939212a751faeb08c89 | [
"Apache-2.0"
] | 25 | 2020-05-13T10:31:16.000Z | 2022-02-04T19:14:22.000Z | src/libraries/ros_lib/mavros_msgs/CommandCode.h | a4aleem/espcopter | ac32f37fa2aa7a479ef37b11ba463ac3105ee4bd | [
"Apache-2.0"
] | null | null | null | src/libraries/ros_lib/mavros_msgs/CommandCode.h | a4aleem/espcopter | ac32f37fa2aa7a479ef37b11ba463ac3105ee4bd | [
"Apache-2.0"
] | 9 | 2020-01-11T14:53:26.000Z | 2021-09-15T15:45:13.000Z | #ifndef _ROS_mavros_msgs_CommandCode_h
#define _ROS_mavros_msgs_CommandCode_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
namespace mavros_msgs
{
class CommandCode : public ros::Msg
{
public:
enum { AIRFRAME_CONFIGURATION = 2520 };
enum { ARM_AUTHORIZATION_REQUEST = 3001 };
enum { COMPONENT_ARM_DISARM = 400 };
enum { CONDITION_DELAY = 112 };
enum { CONDITION_CHANGE_ALT = 113 };
enum { CONDITION_DISTANCE = 114 };
enum { CONDITION_YAW = 115 };
enum { CONDITION_LAST = 159 };
enum { CONDITION_GATE = 4501 };
enum { CONTROL_HIGH_LATENCY = 2600 };
enum { DO_FOLLOW = 32 };
enum { DO_FOLLOW_REPOSITION = 33 };
enum { DO_SET_MODE = 176 };
enum { DO_JUMP = 177 };
enum { DO_CHANGE_SPEED = 178 };
enum { DO_SET_HOME = 179 };
enum { DO_SET_PARAMETER = 180 };
enum { DO_SET_RELAY = 181 };
enum { DO_REPEAT_RELAY = 182 };
enum { DO_SET_SERVO = 183 };
enum { DO_REPEAT_SERVO = 184 };
enum { DO_FLIGHTTERMINATION = 185 };
enum { DO_CHANGE_ALTITUDE = 186 };
enum { DO_LAND_START = 189 };
enum { DO_RALLY_LAND = 190 };
enum { DO_GO_AROUND = 191 };
enum { DO_REPOSITION = 192 };
enum { DO_PAUSE_CONTINUE = 193 };
enum { DO_SET_REVERSE = 194 };
enum { DO_SET_ROI_LOCATION = 195 };
enum { DO_SET_ROI_WPNEXT_OFFSET = 196 };
enum { DO_SET_ROI_NONE = 197 };
enum { DO_CONTROL_VIDEO = 200 };
enum { DO_MOUNT_CONFIGURE = 204 };
enum { DO_MOUNT_CONTROL = 205 };
enum { DO_SET_CAM_TRIGG_DIST = 206 };
enum { DO_FENCE_ENABLE = 207 };
enum { DO_PARACHUTE = 208 };
enum { DO_MOTOR_TEST = 209 };
enum { DO_INVERTED_FLIGHT = 210 };
enum { DO_SET_CAM_TRIGG_INTERVAL = 214 };
enum { DO_MOUNT_CONTROL_QUAT = 220 };
enum { DO_GUIDED_MASTER = 221 };
enum { DO_GUIDED_LIMITS = 222 };
enum { DO_ENGINE_CONTROL = 223 };
enum { DO_LAST = 240 };
enum { DO_TRIGGER_CONTROL = 2003 };
enum { DO_VTOL_TRANSITION = 3000 };
enum { GET_HOME_POSITION = 410 };
enum { GET_MESSAGE_INTERVAL = 510 };
enum { IMAGE_START_CAPTURE = 2000 };
enum { IMAGE_STOP_CAPTURE = 2001 };
enum { LOGGING_START = 2510 };
enum { LOGGING_STOP = 2511 };
enum { MISSION_START = 300 };
enum { NAV_WAYPOINT = 16 };
enum { NAV_LOITER_UNLIM = 17 };
enum { NAV_LOITER_TURNS = 18 };
enum { NAV_LOITER_TIME = 19 };
enum { NAV_RETURN_TO_LAUNCH = 20 };
enum { NAV_LAND = 21 };
enum { NAV_TAKEOFF = 22 };
enum { NAV_LAND_LOCAL = 23 };
enum { NAV_TAKEOFF_LOCAL = 24 };
enum { NAV_FOLLOW = 25 };
enum { NAV_CONTINUE_AND_CHANGE_ALT = 30 };
enum { NAV_LOITER_TO_ALT = 31 };
enum { NAV_PATHPLANNING = 81 };
enum { NAV_SPLINE_WAYPOINT = 82 };
enum { NAV_VTOL_TAKEOFF = 84 };
enum { NAV_VTOL_LAND = 85 };
enum { NAV_GUIDED_ENABLE = 92 };
enum { NAV_DELAY = 93 };
enum { NAV_PAYLOAD_PLACE = 94 };
enum { NAV_LAST = 95 };
enum { NAV_SET_YAW_SPEED = 213 };
enum { NAV_FENCE_RETURN_POINT = 5000 };
enum { NAV_FENCE_POLYGON_VERTEX_INCLUSION = 5001 };
enum { NAV_FENCE_POLYGON_VERTEX_EXCLUSION = 5002 };
enum { NAV_FENCE_CIRCLE_INCLUSION = 5003 };
enum { NAV_FENCE_CIRCLE_EXCLUSION = 5004 };
enum { NAV_RALLY_POINT = 5100 };
enum { OVERRIDE_GOTO = 252 };
enum { PANORAMA_CREATE = 2800 };
enum { PAYLOAD_PREPARE_DEPLOY = 30001 };
enum { PAYLOAD_CONTROL_DEPLOY = 30002 };
enum { PREFLIGHT_CALIBRATION = 241 };
enum { PREFLIGHT_SET_SENSOR_OFFSETS = 242 };
enum { PREFLIGHT_UAVCAN = 243 };
enum { PREFLIGHT_STORAGE = 245 };
enum { PREFLIGHT_REBOOT_SHUTDOWN = 246 };
enum { REQUEST_PROTOCOL_VERSION = 519 };
enum { REQUEST_AUTOPILOT_CAPABILITIES = 520 };
enum { REQUEST_CAMERA_INFORMATION = 521 };
enum { REQUEST_CAMERA_SETTINGS = 522 };
enum { REQUEST_STORAGE_INFORMATION = 525 };
enum { REQUEST_CAMERA_CAPTURE_STATUS = 527 };
enum { REQUEST_FLIGHT_INFORMATION = 528 };
enum { REQUEST_CAMERA_IMAGE_CAPTURE = 2002 };
enum { REQUEST_VIDEO_STREAM_INFORMATION = 2504 };
enum { RESET_CAMERA_SETTINGS = 529 };
enum { SET_MESSAGE_INTERVAL = 511 };
enum { SET_CAMERA_MODE = 530 };
enum { SET_GUIDED_SUBMODE_STANDARD = 4000 };
enum { SET_GUIDED_SUBMODE_CIRCLE = 4001 };
enum { START_RX_PAIR = 500 };
enum { STORAGE_FORMAT = 526 };
enum { UAVCAN_GET_NODE_INFO = 5200 };
enum { VIDEO_START_CAPTURE = 2500 };
enum { VIDEO_STOP_CAPTURE = 2501 };
enum { VIDEO_START_STREAMING = 2502 };
enum { VIDEO_STOP_STREAMING = 2503 };
CommandCode()
{
}
virtual int serialize(unsigned char *outbuffer) const
{
int offset = 0;
return offset;
}
virtual int deserialize(unsigned char *inbuffer)
{
int offset = 0;
return offset;
}
const char * getType(){ return "mavros_msgs/CommandCode"; };
const char * getMD5(){ return "03a2b9eca2a527279a43b976fb73a9f3"; };
};
}
#endif
| 50.178808 | 72 | 0.425894 |
acafb2046ecd988abc369e18971d60af5132b074 | 2,685 | h | C | System/Library/PrivateFrameworks/Silex.framework/SXAdComponentInserter.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/PrivateFrameworks/Silex.framework/SXAdComponentInserter.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/Silex.framework/SXAdComponentInserter.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:16:43 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/PrivateFrameworks/Silex.framework/Silex
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <libobjc.A.dylib/SXComponentInserter.h>
@protocol SXComponentInsertionConditionEngine, SXAdvertisingSettingsFactory;
@class NSString;
@interface SXAdComponentInserter : NSObject <SXComponentInserter> {
id<SXComponentInsertionConditionEngine> _conditionEngine;
id<SXAdvertisingSettingsFactory> _advertisingSettingsFactory;
long long _insertedCount;
double _lastInsertedYOffset;
}
@property (nonatomic,readonly) id<SXAdvertisingSettingsFactory> advertisingSettingsFactory; //@synthesize advertisingSettingsFactory=_advertisingSettingsFactory - In the implementation block
@property (assign,nonatomic) long long insertedCount; //@synthesize insertedCount=_insertedCount - In the implementation block
@property (assign,nonatomic) double lastInsertedYOffset; //@synthesize lastInsertedYOffset=_lastInsertedYOffset - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
@property (nonatomic,readonly) id<SXComponentInsertionConditionEngine> conditionEngine; //@synthesize conditionEngine=_conditionEngine - In the implementation block
@property (nonatomic,readonly) unsigned long long componentTraits;
-(id<SXAdvertisingSettingsFactory>)advertisingSettingsFactory;
-(long long)insertedCount;
-(double)lastInsertedYOffset;
-(unsigned long long)adTypeFromBannerType:(unsigned long long)arg1 ;
-(void)setLastInsertedYOffset:(double)arg1 ;
-(void)setInsertedCount:(long long)arg1 ;
-(id)conditionsForDOMObjectProvider:(id)arg1 ;
-(BOOL)validateMarker:(id)arg1 DOMObjectProvider:(id)arg2 layoutProvider:(id)arg3 ;
-(id)componentInsertForMarker:(id)arg1 DOMObjectProvider:(id)arg2 layoutProvider:(id)arg3 ;
-(id<SXComponentInsertionConditionEngine>)conditionEngine;
-(unsigned long long)componentTraits;
-(id)cacheValidatorForCache:(id)arg1 DOMObjectProvider:(id)arg2 ;
-(void)componentInsertionCompleted;
-(id)initWithConditionEngine:(id)arg1 advertisingSettingsFactory:(id)arg2 ;
@end
| 55.9375 | 203 | 0.741527 |
55beac36f1292552df1902619636dfbe503d35a0 | 9,572 | c | C | hw3/tmp/libmini.c | ss8651twtw/Unix-Programming | bf6f132e03d1c57ee901dcba2104db102051052e | [
"MIT"
] | 19 | 2019-10-20T09:02:12.000Z | 2022-03-28T20:07:06.000Z | hw3/tmp/libmini.c | ss8651twtw/Unix-Programming | bf6f132e03d1c57ee901dcba2104db102051052e | [
"MIT"
] | null | null | null | hw3/tmp/libmini.c | ss8651twtw/Unix-Programming | bf6f132e03d1c57ee901dcba2104db102051052e | [
"MIT"
] | 3 | 2021-05-27T03:20:34.000Z | 2021-06-18T07:35:38.000Z | #include "libmini.h"
long errno;
#define WRAPPER_RETval(type) errno = 0; if(ret < 0) { errno = -ret; return -1; } return ((type) ret);
#define WRAPPER_RETptr(type) errno = 0; if(ret < 0) { errno = -ret; return NULL; } return ((type) ret);
#define __set_errno(val) (errno = (val))
ssize_t read(int fd, char *buf, size_t count) {
long ret = sys_read(fd, buf, count);
WRAPPER_RETval(ssize_t);
}
ssize_t write(int fd, const void *buf, size_t count) {
long ret = sys_write(fd, buf, count);
WRAPPER_RETval(ssize_t);
}
/* open is implemented in assembly, because of variable length arguments */
int close(unsigned int fd) {
long ret = sys_close(fd);
WRAPPER_RETval(int);
}
void * mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) {
long ret = sys_mmap(addr, len, prot, flags, fd, off);
WRAPPER_RETptr(void *);
}
int mprotect(void *addr, size_t len, int prot) {
long ret = sys_mprotect(addr, len, prot);
WRAPPER_RETval(int);
}
int munmap(void *addr, size_t len) {
long ret = sys_munmap(addr, len);
WRAPPER_RETval(int);
}
int pipe(int *filedes) {
long ret = sys_pipe(filedes);
WRAPPER_RETval(int);
}
int dup(int filedes) {
long ret = sys_dup(filedes);
WRAPPER_RETval(int);
}
int dup2(int oldfd, int newfd) {
long ret = sys_dup2(oldfd, newfd);
WRAPPER_RETval(int);
}
int pause() {
long ret = sys_pause();
WRAPPER_RETval(int);
}
int nanosleep(struct timespec *rqtp, struct timespec *rmtp) {
long ret = nanosleep(rqtp, rmtp);
WRAPPER_RETval(int);
}
pid_t fork(void) {
long ret = sys_fork();
WRAPPER_RETval(pid_t);
}
void exit(int error_code) {
sys_exit(error_code);
/* never returns? */
}
char * getcwd(char *buf, size_t size) {
long ret = sys_getcwd(buf, size);
WRAPPER_RETptr(char *);
}
int chdir(const char *pathname) {
long ret = sys_chdir(pathname);
WRAPPER_RETval(int);
}
int rename(const char *oldname, const char *newname) {
long ret = sys_rename(oldname, newname);
WRAPPER_RETval(int);
}
int mkdir(const char *pathname, int mode) {
long ret = sys_mkdir(pathname, mode);
WRAPPER_RETval(int);
}
int rmdir(const char *pathname) {
long ret = sys_rmdir(pathname);
WRAPPER_RETval(int);
}
int creat(const char *pathname, int mode) {
long ret = sys_creat(pathname, mode);
WRAPPER_RETval(int);
}
int link(const char *oldname, const char *newname) {
long ret = sys_link(oldname, newname);
WRAPPER_RETval(int);
}
int unlink(const char *pathname) {
long ret = sys_unlink(pathname);
WRAPPER_RETval(int);
}
ssize_t readlink(const char *path, char *buf, size_t bufsz) {
long ret = sys_readlink(path, buf, bufsz);
WRAPPER_RETval(ssize_t);
}
int chmod(const char *filename, mode_t mode) {
long ret = sys_chmod(filename, mode);
WRAPPER_RETval(int);
}
int chown(const char *filename, uid_t user, gid_t group) {
long ret = sys_chown(filename, user, group);
WRAPPER_RETval(int);
}
int umask(int mask) {
long ret = sys_umask(mask);
WRAPPER_RETval(int);
}
int gettimeofday(struct timeval *tv, struct timezone *tz) {
long ret = sys_gettimeofday(tv, tz);
WRAPPER_RETval(int);
}
uid_t getuid() {
long ret = sys_getuid();
WRAPPER_RETval(uid_t);
}
gid_t getgid() {
long ret = sys_getgid();
WRAPPER_RETval(uid_t);
}
int setuid(uid_t uid) {
long ret = sys_setuid(uid);
WRAPPER_RETval(int);
}
int setgid(gid_t gid) {
long ret = sys_setgid(gid);
WRAPPER_RETval(int);
}
uid_t geteuid() {
long ret = sys_geteuid();
WRAPPER_RETval(uid_t);
}
gid_t getegid() {
long ret = sys_getegid();
WRAPPER_RETval(uid_t);
}
void bzero(void *s, size_t size) {
char *ptr = (char *) s;
while(size-- > 0) *ptr++ = '\0';
}
size_t strlen(const char *s) {
size_t count = 0;
while(*s++) count++;
return count;
}
unsigned int alarm(unsigned int seconds) {
long ret = sys_alarm(seconds);
WRAPPER_RETval(unsigned int);
}
/* Return is sig is used internally. */
static inline int __is_internal_signal (int sig) {
return (sig == SIGCANCEL) || (sig == SIGSETXID);
}
int sigprocmask(int how, const sigset_t *set, sigset_t *oset) {
switch (how) {
case SIG_BLOCK:
case SIG_UNBLOCK:
case SIG_SETMASK:
break;
default:
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
int sigpending(sigset_t *set) {
if (set == NULL) {
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
sighandler_t signal(int sig, sighandler_t handler) {
__set_errno (ENOSYS);
return SIG_ERR;
}
int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
if (sig <= 0 || sig >= NSIG || __is_internal_signal(sig)) {
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
int sigemptyset(sigset_t *set) {
if (set == NULL) {
__set_errno (EINVAL);
return -1;
}
bzero(set, sizeof (sigset_t));
return 0;
}
#define PERRMSG_MIN 0
#define PERRMSG_MAX 133
static const char *errmsg[] = {
"Success",
"Operation not permitted",
"No such file or directory",
"No such process",
"Interrupted system call",
"I/O error",
"No such device or address",
"Argument list too long",
"Exec format error",
"Bad file number",
"No child processes",
"Try again",
"Out of memory",
"Permission denied",
"Bad address",
"Block device required",
"Device or resource busy",
"File exists",
"Cross-device link",
"No such device",
"Not a directory",
"Is a directory",
"Invalid argument",
"File table overflow",
"Too many open files",
"Not a typewriter",
"Text file busy",
"File too large",
"No space left on device",
"Illegal seek",
"Read-only file system",
"Too many links",
"Broken pipe",
"Math argument out of domain of func",
"Math result not representable",
"Resource deadlock would occur",
"File name too long",
"No record locks available",
"Invalid system call number",
"Directory not empty",
"Too many symbolic links encountered",
"Operation would block",
"No message of desired type",
"Identifier removed",
"Channel number out of range",
"Level 2 not synchronized",
"Level 3 halted",
"Level 3 reset",
"Link number out of range",
"Protocol driver not attached",
"No CSI structure available",
"Level 2 halted",
"Invalid exchange",
"Invalid request descriptor",
"Exchange full",
"No anode",
"Invalid request code",
"Invalid slot",
"Resource deadlock would occur",
"Bad font file format",
"Device not a stream",
"No data available",
"Timer expired",
"Out of streams resources",
"Machine is not on the network",
"Package not installed",
"Object is remote",
"Link has been severed",
"Advertise error",
"Srmount error",
"Communication error on send",
"Protocol error",
"Multihop attempted",
"RFS specific error",
"Not a data message",
"Value too large for defined data type",
"Name not unique on network",
"File descriptor in bad state",
"Remote address changed",
"Can not access a needed shared library",
"Accessing a corrupted shared library",
".lib section in a.out corrupted",
"Attempting to link in too many shared libraries",
"Cannot exec a shared library directly",
"Illegal byte sequence",
"Interrupted system call should be restarted",
"Streams pipe error",
"Too many users",
"Socket operation on non-socket",
"Destination address required",
"Message too long",
"Protocol wrong type for socket",
"Protocol not available",
"Protocol not supported",
"Socket type not supported",
"Operation not supported on transport endpoint",
"Protocol family not supported",
"Address family not supported by protocol",
"Address already in use",
"Cannot assign requested address",
"Network is down",
"Network is unreachable",
"Network dropped connection because of reset",
"Software caused connection abort",
"Connection reset by peer",
"No buffer space available",
"Transport endpoint is already connected",
"Transport endpoint is not connected",
"Cannot send after transport endpoint shutdown",
"Too many references: cannot splice",
"Connection timed out",
"Connection refused",
"Host is down",
"No route to host",
"Operation already in progress",
"Operation now in progress",
"Stale file handle",
"Structure needs cleaning",
"Not a XENIX named type file",
"No XENIX semaphores available",
"Is a named type file",
"Remote I/O error",
"Quota exceeded",
"No medium found",
"Wrong medium type",
"Operation Canceled",
"Required key not available",
"Key has expired",
"Key has been revoked",
"Key was rejected by service",
"Owner died",
"State not recoverable",
"Operation not possible due to RF-kill",
"Memory page has hardware error",
};
void perror(const char *prefix) {
const char *unknown = "Unknown";
long backup = errno;
if(prefix) {
write(2, prefix, strlen(prefix));
write(2, ": ", 2);
}
if(errno < PERRMSG_MIN || errno > PERRMSG_MAX) write(2, unknown, strlen(unknown));
else write(2, errmsg[backup], strlen(errmsg[backup]));
write(2, "\n", 1);
return;
}
#if 0 /* we have an equivalent implementation in assembly */
unsigned int sleep(unsigned int seconds) {
long ret;
struct timespec req, rem;
req.tv_sec = seconds;
req.tv_nsec = 0;
ret = sys_nanosleep(&req, &rem);
if(ret >= 0) return ret;
if(ret == -EINTR) {
return rem.tv_sec;
}
return 0;
}
#endif
| 23.576355 | 103 | 0.664438 |
c04a30eec12d9cedc1c53b5d7ba1b72ebb91ddf6 | 1,856 | c | C | OneNET_Demo_ESP8266_EDP_Sensors/Devices/adxl345.c | songsssss/onenet | f9f47df2096f4365dc2180e88c01fde78fc6ef2f | [
"MIT"
] | 67 | 2016-04-13T07:28:28.000Z | 2022-01-18T15:47:05.000Z | OneNET_Demo_ESP8266_EDP_Sensors/Devices/adxl345.c | bh3nvn/OneNET_demo_code_kylin | f9f47df2096f4365dc2180e88c01fde78fc6ef2f | [
"MIT"
] | null | null | null | OneNET_Demo_ESP8266_EDP_Sensors/Devices/adxl345.c | bh3nvn/OneNET_demo_code_kylin | f9f47df2096f4365dc2180e88c01fde78fc6ef2f | [
"MIT"
] | 57 | 2016-04-11T05:36:10.000Z | 2020-11-04T06:10:30.000Z | #include "stm32f10x.h"
#include "stdio.h"
#include "hal_i2c.h"
#include "utils.h"
#define ADXL345_ADDRESS 0x53
void ADXL345_init(void)
{
uint8_t ret = 0;
uint8_t devid;
//0 ±16g,13位模式
#define DATA_FORMAT_REG 0x31
//0x08 测量模式
#define POWER_CTL 0x2d
//0x80 使能DATA_READY中断,需要吗,需要禁止的吧。
#define INT_ENABLE 0x2e
#define BW_RATE 0x2c
#define OFSX 0x1e
#define OFSY 0x1f
#define OFSZ 0x20
mDelay(20);
Hal_I2C_ByteRead(I2C2, ADXL345_ADDRESS, 0x00, &devid);
printf("\r\ndevice ID=%x,\r\n", devid);
#if 0
mDelay(500);
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, POWER_CTL, &pw_ctl); //链接使能,测量模式
mDelay(2000);
#endif
ret = 0X2B;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, DATA_FORMAT_REG, &ret); //低电平中断输出,13位全分辨率,输出数据右对齐,16g量程
ret = 0x0A;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, BW_RATE, &ret); //数据输出速度为100Hz
ret = 0x28;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, POWER_CTL, &ret); //链接使能,测量模式
ret = 0x00;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, INT_ENABLE, &ret); //不使用中断
ret = 0x00;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, OFSX, &ret);
ret = 0x00;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, OFSY, &ret);
ret = 0x00;
Hal_I2C_ByteWrite(I2C2, ADXL345_ADDRESS, OFSZ, &ret);
mDelay(500);
}
uint8_t data[6];
/**
* @brief 获取ADXL345传感器数值,各方向LSB RAW数据.
* @param data_out:存储传感器采集结果
* @retval None
**/
void ADXL345_GETXYZ(int16_t data_out[3])
{
ADXL345_init(); //每次读写寄存器之前都要先读device ID
Hal_I2C_MutiRead(I2C2, data, ADXL345_ADDRESS, 0x32, 6);
data_out[0] = (int16_t)(data[0] + ((uint16_t)data[1] << 8));
data_out[1] = (int16_t)(data[2] + ((uint16_t)data[3] << 8));
data_out[2] = (int16_t)(data[4] + ((uint16_t)data[5] << 8));
printf("ADXL345 ******X=%d,Y=%d,Z=%d*****\n", data_out[0], data_out[1], data_out[2]);
}
| 29.935484 | 100 | 0.661099 |
07780dd7390870caca27195ac510ac379ae5563e | 1,001 | h | C | iOSOpenDev/frameworks/OfficeImport.framework/Headers/OADTableCellStyle.h | bzxy/cydia | f8c838cdbd86e49dddf15792e7aa56e2af80548d | [
"MIT"
] | 678 | 2017-11-17T08:33:19.000Z | 2022-03-26T10:40:20.000Z | iOSOpenDev/frameworks/OfficeImport.framework/Headers/OADTableCellStyle.h | chenfanfang/Cydia | 5efce785bfd5f1064b9c0f0e29a9cc05aa24cad0 | [
"MIT"
] | 22 | 2019-04-16T05:51:53.000Z | 2021-11-08T06:18:45.000Z | iOSOpenDev/frameworks/OfficeImport.framework/Headers/OADTableCellStyle.h | chenfanfang/Cydia | 5efce785bfd5f1064b9c0f0e29a9cc05aa24cad0 | [
"MIT"
] | 170 | 2018-06-10T07:59:20.000Z | 2022-03-22T16:19:33.000Z | /**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport
*/
#import <OfficeImport/XXUnknownSuperclass.h>
@class OADFill, OADTableCellBorderStyle;
__attribute__((visibility("hidden")))
@interface OADTableCellStyle : XXUnknownSuperclass {
@private
OADTableCellBorderStyle *mBorderStyle; // 4 = 0x4
OADFill *mFill; // 8 = 0x8
}
@property(retain) id borderStyle; // G=0x1dba6d; S=0x1b0ad9; converted property
@property(retain) id fill; // G=0x1dc23d; S=0x1b0c4d; converted property
+ (id)defaultFill; // 0x2a800d
+ (id)defaultStyle; // 0x2a7f59
- (void)dealloc; // 0x1b264d
// converted property getter: - (id)borderStyle; // 0x1dba6d
// converted property setter: - (void)setBorderStyle:(id)style; // 0x1b0ad9
// converted property getter: - (id)fill; // 0x1dc23d
// converted property setter: - (void)setFill:(id)fill; // 0x1b0c4d
- (id)shallowCopy; // 0x2a80a5
- (void)applyOverridesFrom:(id)from; // 0x2a8029
@end
| 34.517241 | 80 | 0.737263 |
357036fbfed3a10e53ebc6a57280c75f48c6f1ac | 565 | c | C | Chapter15/02_TwosComplementMethod/main.c | jmhong-simulation/tbc-workbook | e342856573537e89472a12f1d3fc373c8a227949 | [
"Unlicense"
] | 35 | 2020-05-17T04:26:19.000Z | 2022-03-01T03:05:10.000Z | Chapter15/02_TwosComplementMethod/main.c | learner-nosilv/TBC-workbook | 77365b2ed482a7695a64283c846e67b88dd66f64 | [
"Unlicense"
] | null | null | null | Chapter15/02_TwosComplementMethod/main.c | learner-nosilv/TBC-workbook | 77365b2ed482a7695a64283c846e67b88dd66f64 | [
"Unlicense"
] | 16 | 2020-05-27T10:29:10.000Z | 2022-03-01T03:05:19.000Z | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
void print_binary(const char num)
{
}
int main()
{
/*
Signed Integers
- Sign-magnitude representation
00000001 is 1 and 10000001 is -1
00000000 is +0, 10000000 is -0
Two zeros +0 -0, from -127 to +127
- One's complement method
To reverse the sign, invert each bit.
00000001 is 1 and 11111110 is -1.
11111111 is -0
from -127 to +127
- Two's complement method (commonly used in most systems)
To reverse the sign, invert each bit and add 1.
from -128 to +127
*/
return 0;
} | 16.142857 | 58 | 0.700885 |
89286722b296e570fa7cdfd83f878758e8fdfedd | 1,406 | h | C | WRK-V1.2/PUBLIC/INTERNAL/WINDOWS/SHELL/themes/uxtheme/cache.h | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/PUBLIC/INTERNAL/WINDOWS/SHELL/themes/uxtheme/cache.h | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/PUBLIC/INTERNAL/WINDOWS/SHELL/themes/uxtheme/cache.h | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | //---------------------------------------------------------------------------
// Cache.h - implements the CRenderCache object
//---------------------------------------------------------------------------
#pragma once
//---------------------------------------------------------------------------
#include "Render.h"
//---------------------------------------------------------------------------
struct BITMAPENTRY // for bitmap cache
{
int iDibOffset;
HBITMAP hBitmap;
//int iRefCount;
};
//---------------------------------------------------------------------------
class CRenderCache
{
public:
CRenderCache(CRenderObj *pRender, __int64 iUniqueId);
~CRenderCache();
public:
HRESULT GetBitmap(int iDibOffset, OUT HBITMAP *pBitmap);
HRESULT AddBitmap(int iDibOffset, HBITMAP hBitmap);
void ReturnBitmap(HBITMAP hBitmap);
HRESULT GetScaledFontHandle(HDC hdc, LOGFONT *plf, HFONT *phFont);
void ReturnFontHandle(HFONT hFont);
BOOL ValidateObj();
public:
//---- data ----
char _szHead[8];
CRenderObj *_pRenderObj;
__int64 _iUniqueId;
protected:
//---- bitmap cache ----
CSimpleArray<BITMAPENTRY> _BitmapCache;
//---- font cache -----
HFONT _hFont;
LOGFONT *_plfFont; // just keep ptr to it in shared memory
char _szTail[4];
};
//---------------------------------------------------------------------------
| 28.693878 | 77 | 0.444523 |
54c1925e5bd18c8bc868f54b40aea27859744759 | 5,041 | c | C | 21/src/21.c | VictorHachard/CommandPromptGame | 1fb11514ff2f1553731ee7cf89a6284fef6ab994 | [
"MIT"
] | null | null | null | 21/src/21.c | VictorHachard/CommandPromptGame | 1fb11514ff2f1553731ee7cf89a6284fef6ab994 | [
"MIT"
] | null | null | null | 21/src/21.c | VictorHachard/CommandPromptGame | 1fb11514ff2f1553731ee7cf89a6284fef6ab994 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define n 3
struct Card {
int init;
char valeur[5];
char couleur[7];
int hash;
};
void play();
int checkWin(struct Card tab[]);
int valeurToInt(char *);
int addToTab(struct Card, struct Card tab[]);
void printChoice();
void cleanTab();
int isInDrop(struct Card, struct Card tab[]);
int hashCard(struct Card);
struct Card randCard();
void printCard(struct Card tab[]);
void printAll();
char *TAB_VALEUR[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Valet", "Dame", "Roi", "As"};
char *TAB_COULEUR[] = {"Pique", "Carreau", "Coeur", "Trefle"};
struct Card TAB_DROP[n];
struct Card TAB_DROP_IA[n];
int main() {
char ch;
while (1) {
printf("1. Start a game\n");
printf("2. Rule\n");
printf("3. Exit\n");
scanf(" %c", &ch);
switch (ch) {
case '1':
play();
printf("\n\n\n\n\n\n");
break;
case '2':
printf("Reach a final score higher than the dealer without exceeding 21; or let the dealer draw additional cards until their hand exceeds 21.\n");
break;
case '3':
printf("Exiting Program\n");
return 0;
default:
printf("You entered an invalid choice\n");
break;
}
}
return 0;
}
void play() {
//init
printf("Starting the game\n");
cleanTab();
addToTab(randCard(), TAB_DROP_IA);
addToTab(randCard(), TAB_DROP);
printAll();
//user drop
char playerMove;
int iaMove;
int limit = 0;
while (1) {
printf("\n\n");
printf("1. Hit\n");
printf("2. Stand\n");
scanf(" %c", &playerMove);
//PLAYER
switch (playerMove) {
case '1': //player drop a new card
printf("You hit\n");
addToTab(randCard(), TAB_DROP);
break;
case '2': //player do not drop a new card
printf("You stand\n");
break;
default:
printf("You entered an invalid choice\n");
break;
}
//IA
if ((checkWin(TAB_DROP_IA) <= 21 && (checkWin(TAB_DROP_IA) > (checkWin(TAB_DROP)))) && limit < 2) { //hit
iaMove = 2;
} else { //stand
addToTab(randCard(), TAB_DROP_IA);
iaMove = 1;
}
//AFFICHAGE
printAll();
//VERIFICATION
if (checkWin(TAB_DROP) > 21) { //player lose
printf("You Lose\n");
return;
} else if (checkWin(TAB_DROP_IA) > 21) { //IA lose
printf("You Win\n");
return;
}
//IA and player Stand or the limit is max the biggest value win
if ((playerMove == '2' && iaMove == 2) || limit == 1) {
if (checkWin(TAB_DROP_IA) < checkWin(TAB_DROP)) {
printf("You Win\n");
return;
} else {
printf("You Lose\n");
return;
}
}
limit++;
}
}
//Print the hand of the IA and the player.
void printAll() {
printf("\n");
printf("Your Hand\n");
printCard(TAB_DROP);
printf("Dealer Hand\n");
printCard(TAB_DROP_IA);
}
//Return the somme of the card in the tab given in arg.
int checkWin(struct Card tab[]) {
int win = 0;
for (int i=0; i < n; i++) {
if (tab[i].init == 1) {
win += valeurToInt(tab[i].valeur);
} else {
return win;
}
} return win;
}
//Return the value of the card.
int valeurToInt(char valeur[]) {
int i = 0;
if ((strcmp(valeur, "Valet") == 0) ||
(strcmp(valeur, "Dame") == 0) ||
(strcmp(valeur, "Roi") == 0)) {
i = 10;
} else if (strcmp(valeur, "As") == 0) {
i = 1;
} else {
sscanf(valeur, "%d", &i);
}
return i;
}
//Add a card in the list tab, return 1 if all is ok, 0 otherwise.
int addToTab(struct Card card, struct Card tab[]) {
for (int i=0; i < n; i++) {
if (tab[i].init == 0) {
tab[i] = card;
return 1;
}
}
return 0;
}
//Print all the card in the list given in arg.
void printCard(struct Card tab[]) {
for (int i=0; i < n; i++) {
if (tab[i].init == 1) {
printf(" %s %s\n", tab[i].valeur, tab[i].couleur);
} else {
break;
}
}
printf("\n Total: %d\n\n",checkWin(tab));
}
//Clean the tab.
void cleanTab() {
for (int i=0; i < n; i++) {
struct Card ca;
ca.init = 0;
TAB_DROP[i] = ca, TAB_DROP_IA[i] = ca;
}
}
//Return 1 if the card is in the list given in arg, 0 if not.
int isInDrop(struct Card card, struct Card tab[]) {
for (int i=0; i < n; i++) {
if (tab[i].init == 1 &&
tab[i].hash == card.hash) {
return 1;
}
}
return 0;
}
//Generate a hash (the hash will be the same if the components are the same).
int hashCard(struct Card card) {
int i = (int)card.valeur + (int)card.couleur[1];
return i;
}
//Return a new random card that is not in the two list.
struct Card randCard() {
struct Card card;
card.init = 1;
strcpy(card.valeur, TAB_VALEUR[rand()%13]); // 0 12
strcpy(card.couleur, TAB_COULEUR[rand()%4]); // 0 3
card.hash = hashCard(card);
if (isInDrop(card, TAB_DROP) == 0 && isInDrop(card, TAB_DROP_IA) == 0) {
return card;
} else {
return randCard();
}
}
| 23.556075 | 154 | 0.555842 |
54fc7091f5f1fb20e81759536ea03f234b9450c7 | 8,507 | h | C | accfft/include/transpose_cuda.h | novatig/CubismUP_3D_old | 47f7dd5941d81853cfe879385080c7c2c68a9b71 | [
"MIT"
] | 2 | 2020-06-12T10:06:59.000Z | 2021-04-22T00:44:27.000Z | accfft/include/transpose_cuda.h | novatig/CubismUP_3D_old | 47f7dd5941d81853cfe879385080c7c2c68a9b71 | [
"MIT"
] | null | null | null | accfft/include/transpose_cuda.h | novatig/CubismUP_3D_old | 47f7dd5941d81853cfe879385080c7c2c68a9b71 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2014-2015, George Biros
* All rights reserved.
* This file is part of AccFFT library.
*
* AccFFT 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.
*
* AccFFT 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 AccFFT. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _TRANSPOSE_CUDA_
#define _TRANSPOSE_CUDA_
//#include "transpose.h"
#include <cuda.h>
#include <vector>
#include <cstddef>
template<typename T>
class Mem_Mgr_gpu {
public:
Mem_Mgr_gpu(int N0, int N1, int n_tuples, MPI_Comm Comm, int howmany = 1,
ptrdiff_t specified_alloc_local = 0);
ptrdiff_t N[2];
ptrdiff_t n_tuples;
//int procid,nprocs;
ptrdiff_t alloc_local;
ptrdiff_t local_n0;
ptrdiff_t local_n1;
bool PINNED;
T* buffer;
T* buffer_2;
T* buffer_d = nullptr;
T* buffer_d2 = nullptr;
//T* buffer_d3;
//T * data_cpu;
//MPI_Comm comm;
// Deconstructor
~Mem_Mgr_gpu();
};
template<typename T>
class T_Plan_gpu {
public:
T_Plan_gpu(int N0, int N1, int n_tuples, Mem_Mgr_gpu<T> * Mem_mgr, MPI_Comm,
int howmany = 1);
void which_method_gpu(T_Plan_gpu<T>*, T*);
void which_fast_method_gpu(T_Plan_gpu<T>*, T*, unsigned flags = 2,
int howmany = 1, int tag = 0);
void execute_gpu(T_Plan_gpu<T>*, T*, double*, unsigned flags = 0,
int howmany = 1, int tag = 0);
ptrdiff_t N[2];
ptrdiff_t n_tuples;
// Other procs local distribution
ptrdiff_t *local_n0_proc;
ptrdiff_t *local_n1_proc;
ptrdiff_t *local_0_start_proc;
ptrdiff_t *local_1_start_proc;
// My local distribution
ptrdiff_t local_n0;
ptrdiff_t local_n1;
ptrdiff_t local_0_start;
ptrdiff_t local_1_start;
int* scount_proc;
int* rcount_proc;
int* soffset_proc;
int* roffset_proc;
int* scount_proc_w; // for transpose_v8
int* rcount_proc_w;
int* soffset_proc_w;
int* roffset_proc_w;
int* scount_proc_f; // for fast transposes
int* rcount_proc_f;
int* soffset_proc_f;
int* roffset_proc_f;
int* scount_proc_v8;
int* rcount_proc_v8;
int* soffset_proc_v8;
int* roffset_proc_v8;
int last_recv_count;
int last_local_n0; //the last non zero local_n0
int last_local_n1; //the last non zero local_n1
int procid, nprocs;
int nprocs_0; // number of effective processes involved in the starting phase
int nprocs_1; // number of effective processes involved in the transposed phase
int method; // Transpose method
int kway; // Transpose_v7
bool kway_async; // Transpose_v7
ptrdiff_t alloc_local;
bool PINNED;
bool is_evenly_distributed;
std::vector<std::pair<int, double> >* pwhich_f_time;
MPI_Comm comm;
MPI_Datatype MPI_T;
MPI_Datatype *stype;
MPI_Datatype *rtype;
MPI_Datatype *stype_v8;
MPI_Datatype *rtype_v8;
MPI_Datatype *rtype_v8_;
T * buffer;
T * buffer_2;
T * buffer_d;
T * buffer_d2;
//T * data_cpu;
// Deconstructor
~T_Plan_gpu();
};
template<typename T>
void local_transpose_cuda(int r, int c, int n_tuples, T * in, T *out);
template<typename T>
void local_transpose_cuda(int r, int c, int n_tuples, int n_tuples2, T* in,
T* out);
template<typename T>
void local_transpose_cuda(int r, int c, int n_tuples, T* A);
template<typename T> void fast_transpose_cuda_v1(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0);
template<typename T> void fast_transpose_cuda_v1_2(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0);
template<typename T> void fast_transpose_cuda_v1_3(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0);
template<typename T> void fast_transpose_cuda_v2(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0);
template<typename T> void fast_transpose_cuda_v3(T_Plan_gpu<T>* T_plan,
T * data, double *timings, int kway, unsigned flags = 0,
int howmany = 1, int tag = 0);
template<typename T> void fast_transpose_cuda_v3_2(T_Plan_gpu<T>* T_plan,
T * data, double *timings, int kway, unsigned flags = 0,
int howmany = 1, int tag = 0);
template<typename T> void fast_transpose_cuda_v1_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags, int howmany, int tag = 0);
template<typename T> void fast_transpose_cuda_v1_2_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags, int howmany, int tag = 0);
template<typename T> void fast_transpose_cuda_v1_3_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags, int howmany, int tag = 0);
template<typename T> void fast_transpose_cuda_v2_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags, int howmany, int tag = 0);
template<typename T> void fast_transpose_cuda_v3_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, int kway, unsigned flags, int howmany,
int tag = 0);
template<typename T> void transpose_cuda_v5(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, unsigned flags = 0, int howmany = 1, int tag = 0); // INPLACE local transpose + mpiIsendIrecv+local transpose
template<typename T> void transpose_cuda_v5_2(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, unsigned flags = 0, int howmany = 1, int tag = 0); // INPLACE local transpose + multiple memcpy/mpiIsendIrecv+local transpose
template<typename T> void transpose_cuda_v5_3(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, unsigned flags = 0, int howmany = 1, int tag = 0); // INPLACE local transpose + multiple memcpy/mpiIsendIrecv+local transpose
template<typename T> void transpose_cuda_v6(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, unsigned flags = 0, int howmany = 1, int tag = 0); // INPLACE local transpose + mpialltoallv+local transpose
template<typename T> void transpose_cuda_v7(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, int kway, unsigned flags = 0, int howmany = 1,
int tag = 0); // INPLACE local transpose + paralltoallv+local transpose
template<typename T> void transpose_cuda_v7_2(T_Plan_gpu<T>* T_plan, T * inout,
double *timings, int kway, unsigned flags = 0, int howmany = 1,
int tag = 0); // INPLACE local transpose + paralltoallv+local transpose
template<typename T> void fast_transpose_cuda_v(T_Plan_gpu<T>* T_plan, T * data,
double *timings, unsigned flags = 0, int howmany = 1, int tag = 0); // handles only the cases where Flag=1
template<typename T> void fast_transpose_cuda_v_h(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0); // handles only the cases where Flag=1
template<typename T> void fast_transpose_cuda_v_i(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0); // handles only the cases where Flag=1
template<typename T> void fast_transpose_cuda_v_hi(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0); // handles only the cases where Flag=1
template<typename T> void fast_transpose_cuda_v1_2i(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0); // handles only the cases where Flag=1
template<typename T> void fast_transpose_cuda_v1_3i(T_Plan_gpu<T>* T_plan,
T * data, double *timings, unsigned flags = 0, int howmany = 1,
int tag = 0); // handles only the cases where Flag=1
// outplace local transpose multiple n_tuples for the last col
template<typename T>
void local_transpose_col_cuda(int r, int c, int n_tuples, int n_tuples2, T* in,
T* out);
template<typename T>
void memcpy_v1_h1(int nprocs_1, int howmany, int local_n0, int n_tuples,
ptrdiff_t* local_n1_proc, T* send_recv_d, T* data, int idist, int N1,
ptrdiff_t* local_1_start_proc);
template<typename T>
void memcpy_v1_h2(int nprocs_0, int howmany, ptrdiff_t* local_0_start_proc,
ptrdiff_t* local_n0_proc, T* data, int odist, int local_n1,
int n_tuples, T* send_recv_cpu);
//#include <../src/transpose_cuda.cu>
#endif
| 38.31982 | 146 | 0.719408 |
60d304af2d1253e01f43edddb0f3493b1b584773 | 739 | h | C | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APTSDBOptions.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-03-29T12:08:37.000Z | 2021-05-26T05:20:11.000Z | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APTSDBOptions.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | null | null | null | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APTSDBOptions.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-04-17T03:24:04.000Z | 2022-03-30T05:42:17.000Z | //
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <objc/NSObject.h>
@class NSTimeZone;
@interface APTSDBOptions : NSObject
{
_Bool _crc;
unsigned long long _ttl;
NSTimeZone *_timeZone;
unsigned long long _capacityLimit;
}
@property(nonatomic) unsigned long long capacityLimit; // @synthesize capacityLimit=_capacityLimit;
@property(nonatomic) _Bool crc; // @synthesize crc=_crc;
@property(retain, nonatomic) NSTimeZone *timeZone; // @synthesize timeZone=_timeZone;
@property(nonatomic) unsigned long long ttl; // @synthesize ttl=_ttl;
- (void).cxx_destruct;
- (id)init;
@end
| 26.392857 | 99 | 0.721245 |
8e4b199c6301133de95f2290038270d29be3d8ab | 4,406 | c | C | WRK-V1.2/tests/palsuite/threading/duplicatehandle/test9/test9.c | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/tests/palsuite/threading/duplicatehandle/test9/test9.c | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/tests/palsuite/threading/duplicatehandle/test9/test9.c | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | /*=====================================================================
**
** Source: test9.c (DuplicateHandle)
**
** Purpose: Tests the PAL implementation of the DuplicateHandle function,
** with a handle from GetCurrentProcess. The test will create a
** process, duplicate it, then using ReadProcessMemory will
** read from the memory location of the CreateProcess process
** memory and the DuplicateHandle process memory. If the
** duplication is correct the memory will be the same for both.
**
**
** Copyright (c) 2006 Microsoft Corporation. All rights reserved.
**
** The use and distribution terms for this software are contained in the file
** named license.txt, which can be found in the root of this distribution.
** By using this software in any fashion, you are agreeing to be bound by the
** terms of this license.
**
** You must not remove this notice, or any other, from this software.
**
**
**===================================================================*/
#include <palsuite.h>
int __cdecl main(int argc, char* argv[])
{
HANDLE hProcess;
HANDLE hDupProcess;
char lpBuffer[64];
char lpDupBuffer[64];
SIZE_T lpNumberOfBytesRead;
SIZE_T lpDupNumberOfBytesRead;
char lpTestBuffer[] = "abcdefghijklmnopqrstuvwxyz";
/* Initalize the PAL.
*/
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
/* Initalize the buffers.
*/
ZeroMemory( &lpBuffer, sizeof(lpBuffer) );
ZeroMemory( &lpDupBuffer, sizeof(lpDupBuffer) );
/* Get current proces, this will be duplicated.
*/
hProcess = GetCurrentProcess();
if(hProcess == NULL)
{
Fail("ERROR: Unable to get the current process\n");
}
/* Duplicate the current process handle.
*/
if (!(DuplicateHandle(GetCurrentProcess(), /* source handle process*/
hProcess, /* handle to duplicate*/
GetCurrentProcess(), /* target process handle*/
&hDupProcess, /* duplicate handle*/
(DWORD)0, /* requested access*/
FALSE, /* handle inheritance*/
DUPLICATE_SAME_ACCESS))) /* optional actions*/
{
Trace("ERROR:%u: Failed to create the duplicate handle"
" to hProcess=0x%lx",
GetLastError(),
hProcess);
CloseHandle(hProcess);
Fail("");
}
/* Get memory read of the current process.
*/
if ((ReadProcessMemory(hDupProcess, &lpTestBuffer,
lpDupBuffer, sizeof(lpDupBuffer), &lpDupNumberOfBytesRead)) == 0)
{
Trace("ERROR:%u: Unable to read the process memory of "
"hDupProcess=0x%lx.\n",
GetLastError(),
hDupProcess);
CloseHandle(hProcess);
CloseHandle(hDupProcess);
Fail("");
}
/* Get read memory of the created process.
*/
if ((ReadProcessMemory(hProcess, &lpTestBuffer,
lpBuffer, sizeof(lpBuffer), &lpNumberOfBytesRead)) == 0)
{
Trace("ERROR:%u: Unable to read the process memory of "
"hProcess=0x%lx.\n",
GetLastError(),
hProcess);
CloseHandle(hProcess);
CloseHandle(hDupProcess);
Fail("");
}
/* Compare the number of bytes that were read by each
* ReadProcessMemory.*/
if (lpDupNumberOfBytesRead != lpNumberOfBytesRead)
{
Trace("ERROR: ReadProcessMemory read different numbers of bytes "
"from duplicate process handles.\n");
CloseHandle(hProcess);
CloseHandle(hDupProcess);
Fail("");
}
/* Compare the two buffers to make sure they are equal.
*/
if ((strcmp(lpBuffer, lpDupBuffer)) != 0)
{
Trace("ERROR: ReadProcessMemory read different numbers of bytes "
"from duplicate process handles. hProcess read \"%s\" and "
"hDupProcess read \"%s\"\n",
lpBuffer,
lpDupBuffer);
CloseHandle(hProcess);
CloseHandle(hDupProcess);
Fail("");
}
/* Clean-up thread and Terminate the PAL.*/
CloseHandle(hProcess);
CloseHandle(hDupProcess);
PAL_Terminate();
return PASS;
}
| 32.880597 | 79 | 0.564231 |
c2583bb659664173ae7f3dd10f140d4b5cb6bbb6 | 6,843 | h | C | src/lcp-client-lib/public/LcpStatus.h | isabelleknott/readium-lcp-client | 764b28f5f4d879f771be7e727cf4a79ac0d62d9f | [
"BSD-3-Clause"
] | 11 | 2017-02-24T10:58:19.000Z | 2021-12-28T11:24:45.000Z | src/lcp-client-lib/public/LcpStatus.h | isabelleknott/readium-lcp-client | 764b28f5f4d879f771be7e727cf4a79ac0d62d9f | [
"BSD-3-Clause"
] | 19 | 2017-03-10T09:16:04.000Z | 2020-01-31T09:20:59.000Z | src/lcp-client-lib/public/LcpStatus.h | isabelleknott/readium-lcp-client | 764b28f5f4d879f771be7e727cf4a79ac0d62d9f | [
"BSD-3-Clause"
] | 10 | 2017-06-14T08:06:42.000Z | 2022-01-25T16:49:43.000Z | // Copyright (c) 2016 Mantano
// Licensed to the Readium Foundation under one or more contributor license agreements.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation and/or
// other materials provided with the distribution.
// 3. Neither the name of the organization 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 __LCP_STATUS_H__
#define __LCP_STATUS_H__
#include <string>
#ifdef _DEBUG
#pragma optimize( "", off )
#endif
namespace lcp
{
struct StatusCode
{
enum StatusCodeEnum
{
//
// Common errors
//
// No Error
ErrorCommonSuccess,
#if !DISABLE_NET_PROVIDER
// No NetProvider implementation has been given.
ErrorCommonNoNetProvider,
#endif //!DISABLE_NET_PROVIDER
// No StorageProvider implementation has been given.
ErrorCommonNoStorageProvider,
// Implementation of the Encryption Profile from the
// license file was not found
ErrorCommonEncryptionProfileNotFound,
// Algorithm from encryption profile doesn't match algorithm
// from license file or encryption.xml
ErrorCommonAlgorithmMismatch,
//
// Errors when opening a License Document.
//
// The given LCPL is not a valid License Document.
ErrorOpeningLicenseNotValid,
//
ErrorLicenseFailToInject,
// The license hasn't begun yet (right 'start'),
ErrorOpeningLicenseNotStarted,
// The license is expired (right 'end'),
ErrorOpeningLicenseExpired,
// The calculated License signature doesn't match the one
// provided by the License.
ErrorOpeningLicenseSignatureNotValid,
// No Root Certificate provided by the Client.
ErrorOpeningNoRootCertificate,
// Root Certificate provided by the Client is not valid
ErrorOpeningRootCertificateNotValid,
// Algorithm of the Root Certificate for signing child
// certificate was not found
ErrorOpeningRootCertificateSignatureAlgorithmNotFound,
// The Content Provider Certificate is not valid
ErrorOpeningContentProviderCertificateNotValid,
// The Content Provider Certificate was not found in the root
// chain or not verified because of the crypto error
ErrorOpeningContentProviderCertificateNotVerified,
// The Content Provider Certificate has been revoked.
ErrorOpeningContentProviderCertificateRevoked,
// The Content Provider Certificate hasn't begun yet
ErrorOpeningContentProviderCertificateNotStarted,
// The Content Provider Certificate is expired
ErrorOpeningContentProviderCertificateExpired,
// Trying to save duplicate license instance while opening
ErrorOpeningDuplicateLicenseInstance,
#if ENABLE_NET_PROVIDER_ACQUISITION
//
// Errors when acquiring a protected publication from a License.
//
// No acquisition link found in the license.
ErrorAcquisitionNoAcquisitionLink,
// The downloaded publication doesn't match the license hash.
ErrorAcquisitionPublicationCorrupted,
// Acquisition link has wrong type
ErrorAcquisitionPublicationWrongType,
// Cannot open file to write
ErrorAcquisitionInvalidFilePath,
#endif //ENABLE_NET_PROVIDER_ACQUISITION
//
// Errors when decrypting a License or data.
//
// The given User Pass phrase is not valid for this License
ErrorDecryptionUserPassphraseNotValid,
// The License is still encrypted and can't be used to decrypt data.
ErrorDecryptionLicenseEncrypted,
// The Publication is still encrypted and can't be used to decrypt data.
ErrorDecryptionPublicationEncrypted,
// Error of crypto library
ErrorDecryptionCommonError
#if !DISABLE_NET_PROVIDER
,
//
// Errors when doing HTTP network calls.
//
// 404 Not found
ErrorNetworkingRequestNotFound,
// Any other network error
ErrorNetworkingRequestFailed
#endif //!DISABLE_NET_PROVIDER
, LicenseStatusDocumentStartProcessing
};
};
struct Status
{
Status(StatusCode::StatusCodeEnum code, const std::string & extension = "")
: Code(code)
, Extension(extension)
{
if (code != StatusCode::ErrorCommonSuccess && extension.length() == 0) {
bool debugBreakpointHere = true;
}
}
StatusCode::StatusCodeEnum Code;
std::string Extension;
static std::string ToString(const Status & status)
{
std::string msg;
if (status.Extension.length() > 0) {
msg += " [";
msg += status.Extension;
msg += "]";
}
msg += " (";
msg += "x"; //status.Code; // ??
msg += ")";
return msg;
}
static bool IsSuccess(const Status & status)
{
return status.Code == StatusCode::ErrorCommonSuccess;
}
};
}
#endif //__LCP_STATUS_H__ | 39.784884 | 87 | 0.638463 |
32e74744038b8113a2ff245575944b47b8365412 | 536 | c | C | src/mmt_tcpip/lib/protocols/proto_yelp.c | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | 3 | 2022-01-31T09:38:29.000Z | 2022-02-13T19:58:16.000Z | src/mmt_tcpip/lib/protocols/proto_yelp.c | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | 1 | 2022-02-24T10:04:10.000Z | 2022-03-07T10:59:42.000Z | src/mmt_tcpip/lib/protocols/proto_yelp.c | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | null | null | null | #include "mmt_core.h"
#include "plugin_defs.h"
#include "extraction_lib.h"
#include "../mmt_common_internal_include.h"
/////////////// PROTOCOL INTERNAL CODE GOES HERE ///////////////////
/////////////// END OF PROTOCOL INTERNAL CODE ///////////////////
int init_proto_yelp_struct() {
protocol_t * protocol_struct = init_protocol_struct_for_registration(PROTO_YELP, PROTO_YELP_ALIAS);
if (protocol_struct != NULL) {
return register_protocol(protocol_struct, PROTO_YELP);
} else {
return 0;
}
}
| 25.52381 | 103 | 0.630597 |
fbbbb92a05926d3b001dc582ed0fc25779432e09 | 2,977 | h | C | drivers/crypto/keembay/ocs-hcu.h | jainsakshi2395/linux | 7ccb860232bb83fb60cd6bcf5aaf0c008d903acb | [
"Linux-OpenIB"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | kernel/drivers/crypto/keembay/ocs-hcu.h | SFIP/SFIP | e428a425d2d0e287f23d49f3dd583617ebd2e4a3 | [
"Zlib"
] | 1 | 2021-01-27T01:29:47.000Z | 2021-01-27T01:29:47.000Z | kernel/drivers/crypto/keembay/ocs-hcu.h | SFIP/SFIP | e428a425d2d0e287f23d49f3dd583617ebd2e4a3 | [
"Zlib"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /* SPDX-License-Identifier: GPL-2.0-only */
/*
* Intel Keem Bay OCS HCU Crypto Driver.
*
* Copyright (C) 2018-2020 Intel Corporation
*/
#include <linux/dma-mapping.h>
#ifndef _CRYPTO_OCS_HCU_H
#define _CRYPTO_OCS_HCU_H
#define OCS_HCU_DMA_BIT_MASK DMA_BIT_MASK(32)
#define OCS_HCU_HW_KEY_LEN 64
struct ocs_hcu_dma_list;
enum ocs_hcu_algo {
OCS_HCU_ALGO_SHA256 = 2,
OCS_HCU_ALGO_SHA224 = 3,
OCS_HCU_ALGO_SHA384 = 4,
OCS_HCU_ALGO_SHA512 = 5,
OCS_HCU_ALGO_SM3 = 6,
};
/**
* struct ocs_hcu_dev - OCS HCU device context.
* @list: List of device contexts.
* @dev: OCS HCU device.
* @io_base: Base address of OCS HCU registers.
* @engine: Crypto engine for the device.
* @irq: IRQ number.
* @irq_done: Completion for IRQ.
* @irq_err: Flag indicating an IRQ error has happened.
*/
struct ocs_hcu_dev {
struct list_head list;
struct device *dev;
void __iomem *io_base;
struct crypto_engine *engine;
int irq;
struct completion irq_done;
bool irq_err;
};
/**
* struct ocs_hcu_idata - Intermediate data generated by the HCU.
* @msg_len_lo: Length of data the HCU has operated on in bits, low 32b.
* @msg_len_hi: Length of data the HCU has operated on in bits, high 32b.
* @digest: The digest read from the HCU. If the HCU is terminated, it will
* contain the actual hash digest. Otherwise it is the intermediate
* state.
*/
struct ocs_hcu_idata {
u32 msg_len_lo;
u32 msg_len_hi;
u8 digest[SHA512_DIGEST_SIZE];
};
/**
* struct ocs_hcu_hash_ctx - Context for OCS HCU hashing operation.
* @algo: The hashing algorithm being used.
* @idata: The current intermediate data.
*/
struct ocs_hcu_hash_ctx {
enum ocs_hcu_algo algo;
struct ocs_hcu_idata idata;
};
irqreturn_t ocs_hcu_irq_handler(int irq, void *dev_id);
struct ocs_hcu_dma_list *ocs_hcu_dma_list_alloc(struct ocs_hcu_dev *hcu_dev,
int max_nents);
void ocs_hcu_dma_list_free(struct ocs_hcu_dev *hcu_dev,
struct ocs_hcu_dma_list *dma_list);
int ocs_hcu_dma_list_add_tail(struct ocs_hcu_dev *hcu_dev,
struct ocs_hcu_dma_list *dma_list,
dma_addr_t addr, u32 len);
int ocs_hcu_hash_init(struct ocs_hcu_hash_ctx *ctx, enum ocs_hcu_algo algo);
int ocs_hcu_hash_update(struct ocs_hcu_dev *hcu_dev,
struct ocs_hcu_hash_ctx *ctx,
const struct ocs_hcu_dma_list *dma_list);
int ocs_hcu_hash_finup(struct ocs_hcu_dev *hcu_dev,
const struct ocs_hcu_hash_ctx *ctx,
const struct ocs_hcu_dma_list *dma_list,
u8 *dgst, size_t dgst_len);
int ocs_hcu_hash_final(struct ocs_hcu_dev *hcu_dev,
const struct ocs_hcu_hash_ctx *ctx, u8 *dgst,
size_t dgst_len);
int ocs_hcu_digest(struct ocs_hcu_dev *hcu_dev, enum ocs_hcu_algo algo,
void *data, size_t data_len, u8 *dgst, size_t dgst_len);
int ocs_hcu_hmac(struct ocs_hcu_dev *hcu_dev, enum ocs_hcu_algo algo,
const u8 *key, size_t key_len,
const struct ocs_hcu_dma_list *dma_list,
u8 *dgst, size_t dgst_len);
#endif /* _CRYPTO_OCS_HCU_H */
| 27.82243 | 76 | 0.742022 |
f70a647cb41ef15883f548d8f56b540e32b4bf3d | 2,727 | h | C | Source/Drivers/PSLink/LinkProtoLib/XnServerUSBLinuxConnectionFactory.h | liweimcc/OpenNI-Vive | bb8834d88b9869469760d2def19683226665ff10 | [
"Apache-2.0"
] | 7 | 2019-12-08T02:37:21.000Z | 2022-02-12T02:38:52.000Z | Source/Drivers/PSLink/LinkProtoLib/XnServerUSBLinuxConnectionFactory.h | liweimcc/OpenNI-Vive | bb8834d88b9869469760d2def19683226665ff10 | [
"Apache-2.0"
] | 2 | 2018-04-16T10:51:56.000Z | 2018-04-24T06:35:09.000Z | Source/Drivers/PSLink/LinkProtoLib/XnServerUSBLinuxConnectionFactory.h | liweimcc/OpenNI-Vive | bb8834d88b9869469760d2def19683226665ff10 | [
"Apache-2.0"
] | 4 | 2016-05-26T13:12:37.000Z | 2019-12-10T11:53:05.000Z | /*****************************************************************************
* *
* OpenNI 2.x Alpha *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*****************************************************************************/
#ifndef XNSERVERUSBLINUXCONNECTIONFACTORY_H
#define XNSERVERUSBLINUXCONNECTIONFACTORY_H
#include "IConnectionFactory.h"
#include "XnServerUSBLinuxControlEndpoint.h"
#include <XnOS.h>
struct XnUSBDevice;
namespace xn
{
class ServerUSBLinuxConnectionFactory : public IConnectionFactory
{
public:
ServerUSBLinuxConnectionFactory();
virtual ~ServerUSBLinuxConnectionFactory();
virtual XnStatus Init(const XnChar* strConnString);
virtual void Shutdown();
virtual XnBool IsInitialized() const;
virtual XnUInt16 GetNumInputDataConnections() const;
virtual XnUInt16 GetNumOutputDataConnections() const;
/** The pointer returned by GetControlConnection() belongs to the connection factory and
must not be deleted by caller. **/
virtual XnStatus GetControlConnection(ISyncIOConnection*& pConn);
virtual XnStatus CreateOutputDataConnection(XnUInt16 nID, IOutputConnection*& pConn);
virtual XnStatus CreateInputDataConnection(XnUInt16 nID, IAsyncInputConnection*& pConn);
private:
ServerUSBLinuxControlEndpoint m_controlEndpoint;
XnUSBDevice* m_pDevice;
XnBool m_bInitialized;
};
}
#endif // XNSERVERUSBLINUXCONNECTIONFACTORY_H
| 44.704918 | 90 | 0.521819 |
59c0af1aedc1e7cf29ddefc11389c709339f1df1 | 1,219 | h | C | Project_Template/scenebasic_uniform.h | FaintSkyGames/COMP3015-Submission-2 | 616b2c07f985a70c25713959f2de1c05674590a5 | [
"CC-BY-4.0"
] | null | null | null | Project_Template/scenebasic_uniform.h | FaintSkyGames/COMP3015-Submission-2 | 616b2c07f985a70c25713959f2de1c05674590a5 | [
"CC-BY-4.0"
] | null | null | null | Project_Template/scenebasic_uniform.h | FaintSkyGames/COMP3015-Submission-2 | 616b2c07f985a70c25713959f2de1c05674590a5 | [
"CC-BY-4.0"
] | null | null | null | #ifndef SCENEBASIC_UNIFORM_H
#define SCENEBASIC_UNIFORM_H
#include "helper/scene.h"
#include "helper/plane.h"
#include "helper/objmesh.h"
#include "helper/skybox.h"
#include "helper/random.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glad/glad.h>
#include "helper/glslprogram.h"
#include <sstream>
class SceneBasic_Uniform : public Scene
{
private:
GLSLProgram volumeProg, renderProg, compProg, flatProg;
GLuint colorDepthFBO, fsQuad, quad;
GLuint spotTex, fenceTex, ufoTex, grassTex, mudTex, cloudTex, skyTex;
Random rand;
std::unique_ptr<ObjMesh> spot, ufo;
std::unique_ptr<ObjMesh> fenceMid, fenceMid2, fenceEnd, fenceCorner, plane;
glm::vec4 lightPos;
float ufoRotation, ufoHeight;
bool increaseHeight;
float angle, tPrev, rotSpeed, time, deltaT;
void setMatrices(GLSLProgram&);
void compile();
void setupFBO();
void drawScene(GLSLProgram&, bool);
void pass1();
void pass2();
void pass3();
void updateLight();
void updateUFO();
public:
SceneBasic_Uniform();
void initScene();
void update(float t);
void render();
void resize(int, int);
};
#endif // SCENEBASIC_UNIFORM_H
| 21.385965 | 79 | 0.698113 |
59fbf0c5a8a36f487801d98cde3b23c2625c61c4 | 11,185 | h | C | src/ICP.h | diegomazala/QtKinect | c51819980af92b857d87a417d19c5f01d8fada77 | [
"MIT"
] | 5 | 2016-08-04T14:14:11.000Z | 2018-05-27T13:46:13.000Z | src/ICP.h | diegomazala/QtKinect | c51819980af92b857d87a417d19c5f01d8fada77 | [
"MIT"
] | null | null | null | src/ICP.h | diegomazala/QtKinect | c51819980af92b857d87a417d19c5f01d8fada77 | [
"MIT"
] | 4 | 2015-12-08T06:22:46.000Z | 2022-03-15T10:29:17.000Z | #ifndef _ICP_H_
#define _ICP_H_
#include <Eigen/Dense>
#include <vector>
template <typename Type>
static Type distance_point_to_point(const Eigen::Matrix<Type, 4, 1>& v1, const Eigen::Matrix<Type, 4, 1>& v2)
{
//return (v1 - v2).norm();
return (v1 - v2).squaredNorm();
//return (v1.normalized() - v2.normalized()).squaredNorm();
}
#if 1
template <typename Type>
static Type distance_point_to_plane(const Eigen::Matrix<Type, 4, 1>& v, const Eigen::Matrix<Type, 3, 1>& normal, const Eigen::Matrix<Type, 4, 1>& v2)
{
Eigen::Matrix<Type, 3, 1> n = normal.normalized();
const Eigen::Matrix<Type, 3, 1> pt = (v / v.w()).head<3>();
const Eigen::Matrix<Type, 4, 1> plane(n.x(), n.y(), n.z(), -pt.dot(n)); // a*x + b*y + c*z + d = 0
return (plane.x() * v2.x() + plane.y() * v2.y() + plane.z() * v2.z() + plane.w());
}
#else
template <typename Type>
static Type distance_point_to_plane(const Eigen::Matrix<Type, 3, 1>& xp, const Eigen::Matrix<Type, 3, 1>& n, const Eigen::Matrix<Type, 3, 1>& x0)
{
return n.dot(x0 - xp) / n.norm();
}
template <typename Type>
static Type distance_point_to_plane(const Eigen::Matrix<Type, 4, 1>& xp, const Eigen::Matrix<Type, 3, 1>& n, const Eigen::Matrix<Type, 4, 1>& x0)
{
Eigen::Matrix<Type, 3, 1> xx0 = (x0 / x0.w()).head<3>();
Eigen::Matrix<Type, 3, 1> xxp = (xp / xp.w()).head<3>();
return n.dot(xx0 - xxp) / n.norm();
}
#endif
template <class Type>
class ICP
{
public:
enum DistanceMethod
{
PointToPoint,
PointToPlane
};
ICP(){};
virtual ~ICP(){};
void setInputCloud(const std::vector<Eigen::Matrix<Type, 4, 1>>& vertices)
{
input_vertices_ptr = &vertices;
vertices_icp = vertices;
}
void setInputCloud(const std::vector<Eigen::Matrix<Type, 4, 1>>& vertices, const std::vector<Eigen::Matrix<Type, 3, 1>>& normals)
{
input_vertices_ptr = &vertices;
input_normals_ptr = &normals;
vertices_icp = vertices;
normals_icp = normals;
}
void setTargetCloud(const std::vector<Eigen::Matrix<Type, 4, 1>>& vertices)
{
target_vertices_ptr = &vertices;
}
const std::vector<Eigen::Matrix<Type, 4, 1>>& getResultCloud() const
{
return vertices_icp;
}
bool align(const int iterations, const Type error_precision, const DistanceMethod distance_method = PointToPoint)
{
Eigen::Matrix<Type, 4, 4> identity = Eigen::Matrix<Type, 4, 4>::Identity();
Eigen::Matrix<Type, 4, 4> rigidTransform = Eigen::Matrix<Type, 4, 4>::Identity();
Eigen::Matrix<Type, 3, 3> R;
Eigen::Matrix<Type, 3, 1> t;
rotation = Eigen::Matrix<Type, 3, 3>::Identity();
translation = Eigen::Matrix<Type, 3, 1>::Zero();
for (int i = 0; i < iterations; ++i)
{
//if (align_iteration(vertices_icp, *input_normals_ptr, *target_vertices_ptr, R, t, distance_method))
if (align_iteration(vertices_icp, normals_icp, *target_vertices_ptr, R, t, distance_method))
{
rotation *= R;
translation += t;
//if (R.isIdentity(error_precision) && t.isZero(error_precision))
if (getTransform(R, t).isIdentity(error_precision))
{
std::cout << "[OK] They are approx. Iteration = " << i << std::endl;
return true;
}
rigidTransform = getTransform(rotation, translation);
//for (Eigen::Matrix<Type, 4, 1>& p : vertices_icp)
for (int p = 0; p < vertices_icp.size(); ++p)
{
Eigen::Matrix<Type, 4, 1>& v = vertices_icp[p];
v = rigidTransform * v;
v /= v.w();
Eigen::Matrix<Type, 4, 1> nn = normals_icp[i].homogeneous();
nn = rigidTransform * nn;
nn /= nn.w();
}
std::cout << i << std::endl << std::fixed << R << std::endl << t.transpose() << std::endl;
//std::cout << i << std::endl<< std::fixed << rigidTransform << std::endl << std::endl;
}
else
{
std::cout << "[FAIL] Could not compute ICP" << std::endl;
return false;
}
//std::cout << std::fixed
// << "Iteration Transform " << std::endl
// << rigidTransform << std::endl
// << std::endl;
}
return false;
}
static bool align_iteration(
const std::vector<Eigen::Matrix<Type, 4, 1>>& points_src,
const std::vector<Eigen::Matrix<Type, 4, 1>>& points_dst,
const int filter_width,
const Type max_distance,
const int frame_width,
const int frame_height,
Eigen::Matrix<Type, 3, 3>& R,
Eigen::Matrix<Type, 3, 1>& t)
{
Type sum_distances = 0;
const int numCols = frame_width;
const int numRows = frame_height;
const int half_fw = filter_width / 2;
std::vector<Eigen::Matrix<Type, 4, 1>> points_match_src;
std::vector<Eigen::Matrix<Type, 4, 1>> points_match_dst;
int i = 0;
for (const Eigen::Matrix<Type, 4, 1>& p1 : points_src)
{
Eigen::Matrix<Type, 4, 1> closer;
if (!p1.isZero(0.001f))
{
Type min_distance = (Type)FLT_MAX;
Type dist = (Type)FLT_MAX;
int x = i % numCols;
int y = i / numCols;
// x filter borders
int x_begin = std::max(x - half_fw, 0);
int x_end = std::min(x + half_fw, numCols - 1);
// y filter borders
int y_begin = std::max(y - half_fw, 0);
int y_end = std::min(y + half_fw, numRows - 1);
// computing neighbours
for (int yy = y_begin; yy <= y_end; ++yy)
{
for (int xx = x_begin; xx <= x_end; ++xx)
{
const Eigen::Matrix<Type, 4, 1>& p2 = points_dst[yy * numCols + xx];
dist = distance_point_to_point(p1, p2);
if (dist < min_distance)
{
closer = p2;
min_distance = dist;
}
}
}
if (min_distance < max_distance)
{
points_match_src.push_back(points_src[i]);
points_match_dst.push_back(closer);
sum_distances += min_distance;
}
}
++i;
}
std::cout << "Size of points match : " << points_match_dst.size() << std::endl;
std::cout << "Sum of distances : " << sum_distances << std::endl;
std::cout << "Max distance allowed : " << max_distance << std::endl;
//export_obj("../match_src.obj", points_match_src);
//export_obj("../match_dst.obj", points_match_dst);
return computeRigidTransform(points_match_src, points_match_dst, R, t);
}
static bool align_iteration(
const std::vector<Eigen::Matrix<Type, 4, 1>>& points_src,
const std::vector<Eigen::Matrix<Type, 3, 1>>& normals,
const std::vector<Eigen::Matrix<Type, 4, 1>>& points_dst,
const int filter_width,
const Type max_distance,
const int frame_width,
const int frame_height,
Eigen::Matrix<Type, 3, 3>& R,
Eigen::Matrix<Type, 3, 1>& t,
const DistanceMethod distance_method = PointToPlane)
{
const int numCols = frame_width;
const int numRows = frame_height;
const int half_fw = filter_width / 2;
std::vector<Eigen::Matrix<Type, 4, 1>> points_match_src;
std::vector<Eigen::Matrix<Type, 4, 1>> points_match_dst;
int i = 0;
for (const Eigen::Matrix<Type, 4, 1>& p1 : points_src)
{
Eigen::Matrix<Type, 4, 1> closer;
if (!p1.isZero(0.001f))
//if (!p1.isZero(0.001f) && normals[i].z() > 0)
{
Type min_distance = (Type)FLT_MAX;
Type dist = (Type)FLT_MAX;
int x = i % numCols;
int y = i / numCols;
// x filter borders
int x_begin = std::max(x - half_fw, 0);
int x_end = std::min(x + half_fw, numCols - 1);
// y filter borders
int y_begin = std::max(y - half_fw, 0);
int y_end = std::min(y + half_fw, numRows - 1);
// computing neighbours
for (int yy = y_begin; yy <= y_end; ++yy)
{
for (int xx = x_begin; xx <= x_end; ++xx)
{
const Eigen::Matrix<Type, 4, 1>& p2 = points_dst[yy * numCols + xx];
if (distance_method == DistanceMethod::PointToPoint)
dist = distance_point_to_point(p1, p2);
else
dist = distance_point_to_plane(p1, normals[i], p2);
if (dist < min_distance)
{
closer = p2;
min_distance = dist;
}
}
}
if (min_distance < max_distance)
{
points_match_src.push_back(points_src[i]);
points_match_dst.push_back(closer);
}
}
++i;
}
std::cout << "Size of points match : " << points_match_dst.size() << std::endl;
return computeRigidTransform(points_match_src, points_match_dst, R, t);
}
Eigen::Matrix<Type, 3, 3> getRotation() const { return rotation; }
Eigen::Matrix<Type, 3, 1> getTranslation() const { return rotation; }
Eigen::Matrix<Type, 4, 4> getTransform() const
{
Eigen::Matrix<Type, 4, 4> transform;
transform.block(0, 0, 3, 3) = rotation;
transform.row(3).setZero();
transform.col(3) = translation.homogeneous();
return transform;
}
static Eigen::Matrix<Type, 4, 4> getTransform(
const Eigen::Matrix<Type, 3, 3>& R,
const Eigen::Matrix<Type, 3, 1>& t)
{
Eigen::Matrix<Type, 4, 4> transform;
transform.block(0, 0, 3, 3) = R;
transform.row(3).setZero();
transform.col(3) = t.homogeneous();
return transform;
}
static bool computeRigidTransform(
const std::vector<Eigen::Matrix<Type, 4, 1>>& src,
const std::vector<Eigen::Matrix<Type, 4, 1>>& dst,
Eigen::Matrix<Type, 3, 3>& R,
Eigen::Matrix<Type, 3, 1>& t)
{
//
// Verify if the sizes of point arrays are the same
//
assert(src.size() == dst.size());
int pairSize = (int)src.size();
Eigen::Matrix<Type, 4, 1> center_src(0, 0, 0, 1), center_dst(0, 0, 0, 1);
//
// Compute centroid
//
for (int i = 0; i < pairSize; ++i)
{
center_src += src[i];
center_dst += dst[i];
}
center_src /= (Type)pairSize;
center_dst /= (Type)pairSize;
Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> S(pairSize, 3), D(pairSize, 3);
for (int i = 0; i < pairSize; ++i)
{
const Eigen::Matrix<Type, 4, 1> src4f = src[i] - center_src;
const Eigen::Matrix<Type, 4, 1> dst4f = dst[i] - center_dst;
S.row(i) = (src4f / src4f.w()).head<3>();
D.row(i) = (dst4f / dst4f.w()).head<3>();
}
Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> Dt = D.transpose();
Eigen::Matrix<Type, 3, 3> H = Dt * S;
Eigen::Matrix<Type, 3, 3> W, U, V;
//
// Compute SVD
//
//Eigen::JacobiSVD<Eigen::MatrixXf, Eigen::FullPivHouseholderQRPreconditioner> svd(H, Eigen::ComputeFullU | Eigen::ComputeFullV);
Eigen::JacobiSVD<Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic>, Eigen::ColPivHouseholderQRPreconditioner> svd(H, Eigen::ComputeThinU | Eigen::ComputeThinV);
if (!svd.computeU() || !svd.computeV())
{
std::cerr << "<Error> Decomposition error" << std::endl;
return false;
}
Eigen::Matrix<Type, 3, 1> center_src_3f = (center_src / center_src.w()).head<3>();
Eigen::Matrix<Type, 3, 1> center_dst_3f = (center_dst / center_dst.w()).head<3>();
//
// Compute rotation matrix and translation vector
//
Eigen::Matrix<Type, 3, 3> Vt = svd.matrixV().transpose();
R = svd.matrixU() * Vt;
t = center_dst_3f - R * center_src_3f;
return true;
}
protected:
const std::vector<Eigen::Matrix<Type, 4, 1>>* input_vertices_ptr = nullptr;
const std::vector<Eigen::Matrix<Type, 3, 1>>* input_normals_ptr = nullptr;
const std::vector<Eigen::Matrix<Type, 4, 1>>* target_vertices_ptr = nullptr;
std::vector<Eigen::Matrix<Type, 4, 1>> vertices_icp;
std::vector<Eigen::Matrix<Type, 3, 1>> normals_icp;
Eigen::Matrix<Type, 3, 3> rotation;
Eigen::Matrix<Type, 3, 1> translation;
};
#endif // _ICP_H_
| 27.214112 | 164 | 0.624944 |
ea467af92d11892d3a45f364151bac96ac213ec8 | 2,220 | c | C | c/DbConnection.c | Roobles/Security | 7e575cd095be4e3cc9730e6c36d718b0a4bc52f7 | [
"MIT"
] | null | null | null | c/DbConnection.c | Roobles/Security | 7e575cd095be4e3cc9730e6c36d718b0a4bc52f7 | [
"MIT"
] | null | null | null | c/DbConnection.c | Roobles/Security | 7e575cd095be4e3cc9730e6c36d718b0a4bc52f7 | [
"MIT"
] | null | null | null | #include <stdlib.h>
#include <mysql.h>
#include "DbConnection.h"
#include "LibRoo.h"
int dbSet = 0;
DbConnectionSettings _dbConnection;
// Implementation of DbConnection.h
DbConnectionSettings* GetDbConnectionSettings ()
{
return &_dbConnection;
}
#define DBCLEANSE(dbattr) tryfree (settings->dbattr);
void CleanseDbConnectionSettings ()
{
DbConnectionSettings* settings;
settings = GetDbConnectionSettings ();
if (dbSet)
{
trace ("Cleansing db connection settings.");
DBCLEANSE (Hostname);
DBCLEANSE (User);
DBCLEANSE (Password);
DBCLEANSE (Database);
DBCLEANSE (Socket);
settings->Port = 0;
settings->Flags = 0;
dbSet = 0;
}
}
#define DBCLONE(dbset,dbval) settings->dbset = strclone (dbval);
void SetDbConnectionSettings (const char* host, const char* user, const char* password,
const char* dbName, unsigned int port, const char* socket, unsigned long flag)
{
DbConnectionSettings* settings;
settings = GetDbConnectionSettings ();
trace ("Setting db connection settings.");
CleanseDbConnectionSettings ();
DBCLONE (Hostname, host);
DBCLONE (User, user);
DBCLONE (Password, password);
DBCLONE (Database, dbName);
DBCLONE (Socket, socket);
settings->Port = port;
settings->Flags = flag;
dbSet = 1;
}
#define ASSERT_DB_ASSET(asset,message) if (!asset) { error (message); CleanseDbConnection (conn); return NULL; }
MYSQL* NewDbConnection()
{
MYSQL* conn, *connected;
DbConnectionSettings* settings;
ASSERT_DB_ASSET (dbSet, "The database connection settings were never set.");
settings = GetDbConnectionSettings ();
trace ("Opening a new db connection.");
conn = mysql_init (NULL);
ASSERT_DB_ASSET (conn, "Error initializing database connection object.");
connected = mysql_real_connect (conn,
settings->Hostname,
settings->User,
settings->Password,
settings->Database,
settings->Port,
settings->Socket,
settings->Flags);
ASSERT_DB_ASSET (connected, "Error connection to the database.");
return connected;
}
void CleanseDbConnection (MYSQL* conn)
{
if (mysql_errno (conn))
error (mysql_error (conn));
trace ("Closing db connection object.");
mysql_close (conn);
}
| 23.125 | 112 | 0.708559 |
ea493b29ebc7067b5f598bb56d39e98bee18c857 | 749 | h | C | Portfolium/PFCommentsVC.h | iEiffel/Portfolium | 6b2890bfa7c5555ba2d7c5591cfa489a9e4a664b | [
"CECILL-B"
] | null | null | null | Portfolium/PFCommentsVC.h | iEiffel/Portfolium | 6b2890bfa7c5555ba2d7c5591cfa489a9e4a664b | [
"CECILL-B"
] | null | null | null | Portfolium/PFCommentsVC.h | iEiffel/Portfolium | 6b2890bfa7c5555ba2d7c5591cfa489a9e4a664b | [
"CECILL-B"
] | null | null | null | //
// PFCommentsVC.h
// Portfolium
//
// Created by John Eisberg on 8/9/14.
// Copyright (c) 2014 Portfolium. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PFPagedDatasourceDelegate.h"
#import "PFShimmedViewController.h"
@class PFLandingCommentsVC;
@interface PFCommentsVC : UIViewController<UITableViewDataSource,
UITableViewDelegate,
PFPagedDataSourceDelegate,
PFShimmedViewController,
UITextViewDelegate>
+ (PFCommentsVC *)_new:(NSNumber *)entryId;
+ (PFLandingCommentsVC *)_landing:(NSNumber *)entryId;
- (void)pushUserProfile:(NSNumber *)userId;
@end
| 27.740741 | 69 | 0.594126 |
2dad24040a041ad1244002c73b09d7c56f2f590a | 2,215 | h | C | usr/src/lib/libdhcputil/common/dhcpmsg.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libdhcputil/common/dhcpmsg.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libdhcputil/common/dhcpmsg.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DHCPMSG_H
#define _DHCPMSG_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <stdarg.h>
#include <syslog.h>
#include <errno.h> /* since consumers may want to 0 errno */
/*
* dhcpmsg.[ch] comprise the interface used to log messages, either to
* syslog(3C), or to the screen, depending on the debug level. see
* dhcpmsg.c for documentation on how to use the exported functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* the syslog levels, while useful, do not provide enough flexibility
* to do everything we want. consequently, we introduce another set
* of levels, which map to a syslog level, but also potentially add
* additional behavior.
*/
enum {
MSG_DEBUG, /* LOG_DEBUG, only if debug_level is 1 */
MSG_DEBUG2, /* LOG_DEBUG, only if debug_level is 1 or 2 */
MSG_INFO, /* LOG_INFO */
MSG_VERBOSE, /* LOG_INFO, only if is_verbose is true */
MSG_NOTICE, /* LOG_NOTICE */
MSG_WARNING, /* LOG_WARNING */
MSG_ERR, /* LOG_ERR, use errno if nonzero */
MSG_ERROR, /* LOG_ERR */
MSG_CRIT /* LOG_CRIT */
};
/* PRINTFLIKE2 */
extern void dhcpmsg(int, const char *, ...);
extern void dhcpmsg_init(const char *, boolean_t, boolean_t, int);
extern void dhcpmsg_fini(void);
#ifdef __cplusplus
}
#endif
#endif /* _DHCPMSG_H */
| 29.533333 | 70 | 0.716027 |
09e0faaee3740ed50f7a64761da43fc217b08fd7 | 408 | h | C | Bothtech/mapView/AJKMainViewController.h | d191562687/BothtechApp | 797ca8b1d0e974672e81a238cef012837b5a3ca2 | [
"Apache-2.0"
] | null | null | null | Bothtech/mapView/AJKMainViewController.h | d191562687/BothtechApp | 797ca8b1d0e974672e81a238cef012837b5a3ca2 | [
"Apache-2.0"
] | null | null | null | Bothtech/mapView/AJKMainViewController.h | d191562687/BothtechApp | 797ca8b1d0e974672e81a238cef012837b5a3ca2 | [
"Apache-2.0"
] | null | null | null | //
// AJKMainViewController.h
// MapAnnotationDemo
//
// Created by shan xu on 14-3-28.
// Copyright (c) 2014年 夏至. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MapViewController.h"
@interface AJKMainViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,MapViewControllerDelegate>
-(void)loadMapSiteMessage:(NSDictionary *)mapSiteDic;
- (id)initViewController;
@end
| 21.473684 | 120 | 0.769608 |
9166b7ab8965010a6efa686c74290ab8229b224b | 2,068 | h | C | include/geode/basic/passkey.h | Geode-solutions/OpenGeode | e47621989e6fc152f529d4e1e7e3b9ef9e7d6ccc | [
"MIT"
] | 64 | 2019-08-02T14:31:01.000Z | 2022-03-30T07:46:50.000Z | include/geode/basic/passkey.h | Geode-solutions/OpenGeode | e47621989e6fc152f529d4e1e7e3b9ef9e7d6ccc | [
"MIT"
] | 395 | 2019-08-02T17:15:10.000Z | 2022-03-31T15:10:27.000Z | include/geode/basic/passkey.h | Geode-solutions/OpenGeode | e47621989e6fc152f529d4e1e7e3b9ef9e7d6ccc | [
"MIT"
] | 8 | 2019-08-19T21:32:15.000Z | 2022-03-06T18:41:10.000Z | /*
* Copyright (c) 2019 - 2021 Geode-solutions
*
* 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
namespace geode
{
/*!
* This can be used to restrict which class can call methods
* Example:
* class A
* {
* // Add a key only B can create
* PASSKEY( B, KeyForB );
*
* public:
* void restrictive_method( KeyForB )
* {
* // do something
* }
* };
*
* Now, B class is the only class that can call A::restrictive_method
* class B
* {
* public:
* void run( A& a )
* {
* // the {} will implicitly create a KeyForB
* a.restrictive_method( {} );
* }
* };
*/
template < typename T >
class PassKey
{
friend T;
private:
PassKey(){};
};
#define PASSKEY( Friend, Key ) using Key = geode::PassKey< Friend >
} // namespace geode
| 31.333333 | 80 | 0.609284 |
87a6e1fee57ac7cd4e58dc31223a9beeb9661f26 | 14,414 | h | C | Core/MAGESLAM/Source/Utils/cv.h | syntheticmagus/mageslam | ba79a4e6315689c072c29749de18d70279a4c5e4 | [
"MIT"
] | 70 | 2020-05-07T03:09:09.000Z | 2022-02-11T01:04:54.000Z | Core/MAGESLAM/Source/Utils/cv.h | syntheticmagus/mageslam | ba79a4e6315689c072c29749de18d70279a4c5e4 | [
"MIT"
] | 3 | 2020-06-01T00:34:01.000Z | 2020-10-08T07:43:32.000Z | Core/MAGESLAM/Source/Utils/cv.h | syntheticmagus/mageslam | ba79a4e6315689c072c29749de18d70279a4c5e4 | [
"MIT"
] | 16 | 2020-05-07T03:09:13.000Z | 2022-03-31T15:36:49.000Z | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "Data/Data.h"
#include <Eigen/Dense>
#include <opencv2/core/eigen.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <assert.h>
#include <array>
#include <gsl/gsl>
#include "eigen.h"
namespace mage
{
using Quaternion = Eigen::Quaternionf;
inline Quaternion ToQuat(const cv::Matx33f& rotation)
{
Eigen::Matrix3f eigenMat;
cv::cv2eigen(rotation, eigenMat);
Quaternion eigenQuat(eigenMat);
// TODO validate if this normalize is even necessary, eigen might already be doing this
eigenQuat.normalize();
return eigenQuat;
}
template<int N>
inline Eigen::Map<Eigen::Matrix<float, N, 1>> ToMap(cv::Vec<float, N>& vec)
{
return Eigen::Map<Eigen::Vector3f>{ vec.val };
}
template<int N>
inline Eigen::Map<const Eigen::Matrix<float, N, 1>> ToCMap(const cv::Vec<float, N>& vec)
{
return Eigen::Map<const Eigen::Matrix<float, N, 1>>{ vec.val };
}
inline Eigen::Map<Eigen::Vector3f> ToMap(cv::Matx31f& vec)
{
return Eigen::Map<Eigen::Vector3f>{ vec.val };
}
inline Eigen::Map<const Eigen::Vector3f> ToCMap(const cv::Matx31f& vec)
{
return Eigen::Map<const Eigen::Vector3f>{ vec.val };
}
inline Eigen::Map<Eigen::Vector3f> ToMap(cv::Point3f& vec)
{
return Eigen::Map<Eigen::Vector3f>{ &vec.x };
}
inline Eigen::Map<const Eigen::Vector3f> ToCMap(const cv::Point3f& vec)
{
return Eigen::Map<const Eigen::Vector3f>{ &vec.x };
}
inline Eigen::Map<Eigen::Vector2f> ToMap(cv::Point2f& vec)
{
return Eigen::Map<Eigen::Vector2f>{ &vec.x };
}
inline Eigen::Map<const Eigen::Vector2f> ToCMap(const cv::Point2f& vec)
{
return Eigen::Map<const Eigen::Vector2f>{ &vec.x };
}
template<size_t N>
inline cv::Vec<float, N> ToVec(gsl::span<const float, N> values)
{
return cv::Vec<float, N>(values.data());
}
inline Quaternion QuatFromTwoVectors(const cv::Vec3f& from, const cv::Vec3f& to)
{
Quaternion quat;
quat.setFromTwoVectors(Eigen::Vector3f{ from(0), from(1), from(2) }, Eigen::Vector3f{ to(0), to(1), to(2) });
return quat;
}
inline cv::Matx33f ToMat(const Quaternion& quat)
{
cv::Matx33f mat;
cv::eigen2cv(quat.toRotationMatrix(), mat);
return mat;
}
inline cv::Matx33f ToMat(float pitchRads, float rollRads, float yawRads)
{
// Formula for (Pitch * Roll * Yaw) from http://www.songho.ca/opengl/gl_anglestoaxes.html
float a = pitchRads;
float b = yawRads;
float c = rollRads;
float sa = sinf(a);
float sb = sinf(b);
float sc = sinf(c);
float ca = cosf(a);
float cb = cosf(b);
float cc = cosf(c);
return cv::Matx33f{
cc * cb, -sc, cc * sb,
ca * sc * cb + sa * sb, ca * cc, ca * sc * sb - sa * cb,
sa * sc * cb - ca * sb, sa * cc, sa * sc * sb + ca * cb
};
}
inline cv::Matx44f To4x4(const cv::Matx34f& mat)
{
return{
mat(0, 0), mat(0, 1), mat(0, 2), mat(0, 3),
mat(1, 0), mat(1, 1), mat(1, 2), mat(1, 3),
mat(2, 0), mat(2, 1), mat(2, 2), mat(2, 3),
0, 0, 0, 1
};
}
inline cv::Matx34f To3x4(const cv::Matx44f& mat)
{
return{
mat(0, 0), mat(0, 1), mat(0, 2), mat(0, 3),
mat(1, 0), mat(1, 1), mat(1, 2), mat(1, 3),
mat(2, 0), mat(2, 1), mat(2, 2), mat(2, 3)
};
}
inline cv::Matx44f To4x4(const cv::Matx33f& rot, const cv::Vec3f& trans)
{
return{
rot(0, 0), rot(0, 1), rot(0, 2), trans(0),
rot(1, 0), rot(1, 1), rot(1, 2), trans(1),
rot(2, 0), rot(2, 1), rot(2, 2), trans(2),
0, 0, 0, 1
};
}
inline cv::Matx44f FromQuatAndTrans(const Quaternion& quat, const cv::Vec3f& trans)
{
return To4x4(ToMat(quat), trans);
}
inline cv::Matx33f Rotation(const cv::Matx44f& mat)
{
return{
mat(0, 0), mat(0, 1), mat(0, 2),
mat(1, 0), mat(1, 1), mat(1, 2),
mat(2, 0), mat(2, 1), mat(2, 2)
};
}
inline cv::Matx33f Rotation(const cv::Matx34f& mat)
{
return{
mat(0, 0), mat(0, 1), mat(0, 2),
mat(1, 0), mat(1, 1), mat(1, 2),
mat(2, 0), mat(2, 1), mat(2, 2)
};
}
inline cv::Vec3f Translation(const cv::Matx44f& mat)
{
return{
mat(0, 3),
mat(1, 3),
mat(2, 3)
};
}
inline cv::Vec3f Translation(const cv::Matx34f& mat)
{
return{
mat(0, 3),
mat(1, 3),
mat(2, 3)
};
}
//Swap the returned parameters to suppress x64 compile warning c4324
//c:\program files(x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.11.25503\include\utility(271) : warning C4324 : 'std::pair<mage::Quaternion,cv::Vec3f>' : structure was padded due to alignment specifier
inline std::pair<cv::Vec3f, Quaternion> Decompose(const cv::Matx44f& matrix)
{
return std::make_pair(Translation(matrix), ToQuat(matrix.get_minor<3, 3>(0, 0)));
}
template<int ROWS, int COLS>
inline bool MatxEqual(const cv::Matx<float, ROWS, COLS>& mat0, const cv::Matx<float, ROWS, COLS>& mat1)
{
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
if (mat0(i,j) != mat1(i,j))
return false;
}
}
return true;
}
inline bool MatEqual(const cv::Mat& mat0, const cv::Mat& mat1)
{
if (mat0.size != mat1.size)
return false;
for (int i = 0; i < mat0.rows; i++)
{
for (int j = 0; j < mat0.cols; j++)
{
if (mat0.at<float>(i, j) != mat1.at<float>(i, j))
return false;
}
}
return true;
}
template<int ROWS, int COLS>
inline cv::Matx44f Invert(const cv::Matx<float, ROWS, COLS>& transform)
{
static_assert((ROWS == 3 || ROWS == 4) && COLS == 4, "Invert only supports 3x4 or 4x4 matrices");
//invert rotation by transpose on copy of upper 3x3 for inverse rotation
cv::Matx44f invRotation{
transform(0, 0), transform(1, 0), transform(2, 0), 0,
transform(0, 1), transform(1, 1), transform(2, 1), 0,
transform(0, 2), transform(1, 2), transform(2, 2), 0,
0, 0, 0, 1
};
#ifndef NDEBUG
// this approach would only work if the upper 3x3 was a pure rotation matrix (no scale)
// that would mean all rows and columns were unit length and orthogonal. this tests for the former.
for(int idx=0; idx < 3; idx++)
{
assert(abs(1.0 - cv::norm(invRotation.col(idx))) <= 0.001 && "Expecting unit length (no scale) for rotation matrix");
assert(abs(1.0 - cv::norm(invRotation.row(idx))) <= 0.001 && "Expecting unit length (no scale) for rotation matrix");
}
//a valid rotation matrix has determinant 1 (a mirror would be -1)
assert(abs(1.0 - cv::determinant(invRotation)) < 0.001 && "Expecting determinant of 1 for rotation matrix");
#endif
//invert translation by negation on copy
cv::Matx44f invTranslation{
1, 0, 0, -transform(0, 3),
0, 1, 0, -transform(1, 3),
0, 0, 1, -transform(2, 3),
0, 0, 0, 1
};
//inverse matrix
return invRotation * invTranslation;
}
inline cv::Matx44f ComputeFrameTransform(const cv::Matx44f& from, const cv::Matx44f& to)
{
return to * Invert(from);
}
inline cv::Point3f UnProject(const cv::Matx33f& invCameraMatrix, const cv::Matx44f& viewMatrix, const cv::Point2i& point, float depth)
{
cv::Matx31f pixelSpace{ static_cast<float>(point.x), static_cast<float>(point.y), 1.f };
cv::Matx31f cameraSpace = invCameraMatrix * pixelSpace;
cameraSpace *= depth;
cv::Matx41f world = Invert(viewMatrix) * cv::Matx41f{ cameraSpace(0), cameraSpace(1), cameraSpace(2), 1 };
return{ world(0), world(1), world(2) };
}
const float NRM_EPSILON = 0.00001f;
inline float Length(const cv::Vec3f& vec)
{
return std::sqrtf(vec.dot(vec));
}
inline cv::Vec3f Normalize(const cv::Vec3f& vec)
{
float distance = Length(vec);
if (distance == 0)
return vec;
cv::Vec3f normVec = (vec / distance);
assert(abs(sqrt(normVec.dot(normVec)) - 1.0f) < NRM_EPSILON);
return normVec;
}
//rightHanded, column vec convention, intended for rotation of vectors (active)
//https://en.wikipedia.org/wiki/Rotation_matrix
//vs http://mathworld.wolfram.com/RotationMatrix.html intended for rotation of coordinate frames
inline cv::Matx44f RotationXForVectors(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, cosR, -sinR, 0.0f,
0.0f, sinR, cosR, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
//rightHanded, column vec convention, intended for rotation of vectors (active)
//https://en.wikipedia.org/wiki/Rotation_matrix
//vs http://mathworld.wolfram.com/RotationMatrix.html intended for rotation of coordinate frames
inline cv::Matx44f RotationYForVectors(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ cosR, 0.0f, sinR, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
-sinR, 0.0f, cosR, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
//rightHanded, column vec convention, intended for rotation of vectors (active)
//https://en.wikipedia.org/wiki/Rotation_matrix
//vs http://mathworld.wolfram.com/RotationMatrix.html intended for rotation of coordinate frames
inline cv::Matx44f RotationZForVectors(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ cosR, -sinR, 0.0f, 0.0f,
sinR, cosR, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
//rightHanded, column vec convention, intended for rotation of coordinate frames (passive)
//https://en.wikipedia.org/wiki/Rotation_matrix
//ala http://mathworld.wolfram.com/RotationMatrix.html
inline cv::Matx44f RotationXForCoordinateFrames(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, cosR, sinR, 0.0f,
0.0f, -sinR, cosR, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
//rightHanded, column vec convention,intended for rotation of coordinate frames (passive)
//https://en.wikipedia.org/wiki/Rotation_matrix
//ala http://mathworld.wolfram.com/RotationMatrix.html
inline cv::Matx44f RotationYForCoordinateFrames(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ cosR, 0.0f, -sinR, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
sinR, 0.0f, cosR, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
//rightHanded, column vec convention, intended for rotation of coordinate frames (passive)
//https://en.wikipedia.org/wiki/Rotation_matrix
//ala http://mathworld.wolfram.com/RotationMatrix.html
inline cv::Matx44f RotationZForCoordinateFrames(float radians)
{
float cosR = std::cosf(radians);
float sinR = std::sinf(radians);
return{ cosR, sinR, 0.0f, 0.0f,
-sinR, cosR, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
}
// encoding of axis/angle in a vec3f
// http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#rodrigues
inline cv::Matx33f RotationFromRodrigues(const cv::Matx31f& rotation)
{
cv::Matx33f rotationMat;
cv::Rodrigues(rotation, rotationMat);
return rotationMat;
}
template<typename T, size_t M, size_t N>
inline std::array<T, M*N> ArrayFromMat(const cv::Matx<T, M, N>& mat)
{
std::array<T, M * N> out;
std::copy(std::begin(mat.val), std::end(mat.val), out.begin());
return out;
}
inline cv::Matx44f ToCVMat4x4(const mage::Matrix& matrix)
{
return cv::Matx44f(&matrix.M11);
}
inline bool IsEntirelyOffscreen(const cv::Rect& rect, const cv::Size& screenResPixels)
{
assert(rect.width > 0 && "invalid rect");
assert(rect.height > 0 && "invalid rect");
assert(screenResPixels.width > 0 && "invalid screenResPixels");
assert(screenResPixels.height > 0 && "invalid screenResPixels");
int maxHorizPixel = rect.width + rect.x - 1;
int maxVerticalPixel = rect.height + rect.y - 1;
bool offscreenX = (maxHorizPixel < 0) || (rect.x >(int)(screenResPixels.width - 1));
bool offscreenY = (maxVerticalPixel < 0) || (rect.y >(int)(screenResPixels.height - 1));
return (offscreenX || offscreenY);
}
inline bool IsWithinArea(const cv::Point2f& pt, const cv::Rect& crop)
{
assert(crop.width > 0 && "width must be positive nonzero");
assert(crop.height > 0 && "height must be positive nonzero");
return (pt.x >= crop.x && pt.x < (crop.x+crop.width)) && (pt.y >= crop.y && pt.y <= (crop.y + crop.height));
}
inline cv::Rect ToCVRect(const mage::Rect& rect)
{
return { (int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height };
}
cv::Mat CreateGrayCVMat(const cv::Size& resolution, const PixelFormat& format, const gsl::span<const uint8_t> imageBytes);
cv::Mat CreateBGRCVMat(const cv::Mat& source, const PixelFormat& format);
}
| 32.983982 | 219 | 0.563411 |
0b89df73772ece5e113044d744ece2bb14d001a3 | 4,263 | h | C | tuya_ble_sdk_demo/board/include/ty_pin.h | liaoshangchao/magic_stick- | adfc797d9e82694179fd6a701400561fab0debf3 | [
"MIT"
] | 1 | 2022-03-21T09:49:08.000Z | 2022-03-21T09:49:08.000Z | tuya_ble_sdk_demo/board/include/ty_pin.h | liaoshangchao/magic_stick- | adfc797d9e82694179fd6a701400561fab0debf3 | [
"MIT"
] | null | null | null | tuya_ble_sdk_demo/board/include/ty_pin.h | liaoshangchao/magic_stick- | adfc797d9e82694179fd6a701400561fab0debf3 | [
"MIT"
] | null | null | null | /**
****************************************************************************
* @file ty_pin.h
* @brief ty_pin
* @author suding
* @version V1.0.0
* @date 2020-10
* @note
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2020 Tuya </center></h2>
*/
#ifndef __TY_PIN_H__
#define __TY_PIN_H__
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDE
*/
#include "board.h"
/*********************************************************************
* CONSTANT
*/
//2bit
#define TY_PIN_INIT_LOW ((uint16_t)(0x01 << 0))
#define TY_PIN_INIT_HIGH ((uint16_t)(0x02 << 0))
#define TY_PIN_INIT_MASK ((uint16_t)(0x03 << 0))
//3bit
#define TY_PIN_IN ((uint16_t)(0x01 << 2))
#define TY_PIN_IN_FL ((uint16_t)(0x02 << 2))
#define TY_PIN_IN_IRQ ((uint16_t)(0x03 << 2))
#define TY_PIN_OUT_PP ((uint16_t)(0x04 << 2))
#define TY_PIN_OUT_OD ((uint16_t)(0x05 << 2))
#define TY_PIN_INOUT_MASK ((uint16_t)(0x07 << 2))
//3bit
#define TY_PIN_IRQ_RISE ((uint16_t)(0x01 << 5))
#define TY_PIN_IRQ_FALL ((uint16_t)(0x02 << 5))
#define TY_PIN_IRQ_RISE_FALL ((uint16_t)(0x03 << 5))
#define TY_PIN_IRQ_LOW ((uint16_t)(0x04 << 5))
#define TY_PIN_IRQ_HIGH ((uint16_t)(0x05 << 5))
#define TY_PIN_IRQ_MASK ((uint16_t)(0x07 << 5))
//4bit
#define TY_PIN_PULL_UP ((uint16_t)(0x01 << 9))
#define TY_PIN_PULL_DOWN ((uint16_t)(0x02 << 9))
#define TY_PIN_PULL_NONE ((uint16_t)(0x03 << 9))
#define TY_PIN_MODE_MASK ((uint16_t)(0x0F << 9))
typedef enum {
//PU -> pull up
//PD -> pull dowm
//FL -> floating
//PP -> push pull
//OD -> open drain
//hiz -> high-impedance level
TY_PIN_MODE_IN_PU = TY_PIN_IN | TY_PIN_PULL_UP,
TY_PIN_MODE_IN_PD = TY_PIN_IN | TY_PIN_PULL_DOWN,
TY_PIN_MODE_IN_FL = TY_PIN_IN_FL,
TY_PIN_MODE_IN_IRQ_RISE = TY_PIN_IN_IRQ | TY_PIN_IRQ_RISE | TY_PIN_PULL_UP,
TY_PIN_MODE_IN_IRQ_FALL = TY_PIN_IN_IRQ | TY_PIN_IRQ_FALL | TY_PIN_PULL_UP,
TY_PIN_MODE_IN_IRQ_RISE_FALL = TY_PIN_IN_IRQ | TY_PIN_IRQ_RISE_FALL | TY_PIN_PULL_UP,
TY_PIN_MODE_IN_IRQ_LOW = TY_PIN_IN_IRQ | TY_PIN_IRQ_LOW | TY_PIN_PULL_UP,
TY_PIN_MODE_IN_IRQ_HIGH = TY_PIN_IN_IRQ | TY_PIN_IRQ_HIGH | TY_PIN_PULL_UP,
TY_PIN_MODE_OUT_PP_LOW = TY_PIN_OUT_PP | TY_PIN_INIT_LOW,
TY_PIN_MODE_OUT_PP_HIGH = TY_PIN_OUT_PP | TY_PIN_INIT_HIGH,
TY_PIN_MODE_OUT_PP_PU_LOW = TY_PIN_OUT_PP | TY_PIN_PULL_UP | TY_PIN_INIT_LOW,
TY_PIN_MODE_OUT_PP_PU_HIGH = TY_PIN_OUT_PP | TY_PIN_PULL_UP | TY_PIN_INIT_HIGH,
TY_PIN_MODE_OUT_PP_PD_LOW = TY_PIN_OUT_PP | TY_PIN_PULL_DOWN | TY_PIN_INIT_LOW,
TY_PIN_MODE_OUT_PP_PD_HIGH = TY_PIN_OUT_PP | TY_PIN_PULL_DOWN | TY_PIN_INIT_HIGH,
TY_PIN_MODE_OUT_OD_LOW = TY_PIN_OUT_OD | TY_PIN_INIT_LOW,
TY_PIN_MODE_OUT_OD_HIZ = TY_PIN_OUT_OD | TY_PIN_INIT_HIGH,
TY_PIN_MODE_OUT_OD_PU_LOW = TY_PIN_OUT_OD | TY_PIN_PULL_UP | TY_PIN_INIT_LOW,
TY_PIN_MODE_OUT_OD_PU_HIGH = TY_PIN_OUT_OD | TY_PIN_PULL_UP | TY_PIN_INIT_HIGH,
} ty_pin_mode_t;
typedef enum {
TY_PIN_LOW = 0,
TY_PIN_HIGH
} ty_pin_level_t;
/*********************************************************************
* STRUCT
*/
/*********************************************************************
* EXTERNAL VARIABLE
*/
/*********************************************************************
* EXTERNAL FUNCTION
*/
uint32_t ty_pin_init (uint8_t pin, ty_pin_mode_t mode);
uint32_t ty_pin_set (uint8_t pin, ty_pin_level_t level);
uint32_t ty_pin_get (uint8_t pin, ty_pin_level_t* p_level);
uint32_t ty_pin_control (uint8_t pin, uint8_t cmd, void* arg);
uint32_t ty_pin_uninit (uint8_t pin, ty_pin_mode_t mode);
#ifdef __cplusplus
}
#endif
#endif //__TY_PIN_H__
| 35.231405 | 95 | 0.555712 |
8fc08a063ccbda42f6e0f9056356025716ee1b67 | 2,351 | h | C | ofs/master/file/Directory.h | ooeyusea/zookeeper | 6dc5297ba2248d809b2b0344085f2e00331e0a61 | [
"MIT"
] | null | null | null | ofs/master/file/Directory.h | ooeyusea/zookeeper | 6dc5297ba2248d809b2b0344085f2e00331e0a61 | [
"MIT"
] | null | null | null | ofs/master/file/Directory.h | ooeyusea/zookeeper | 6dc5297ba2248d809b2b0344085f2e00331e0a61 | [
"MIT"
] | null | null | null | #ifndef __DIRECTORY_H__
#define __DIRECTORY_H__
#include "hnet.h"
#include "Node.h"
#include "File.h"
namespace ofs {
class Directory : public Node {
public:
Directory() : Node(true) {}
virtual ~Directory();
virtual void DoNotWantToObject() {}
template <typename Stream>
inline void Archive(hyper_net::IArchiver<Stream>& ar) {
Node::Archive(ar);
int32_t count = 0;
ar & count;
if (ar.Fail())
return;
for (int32_t i = 0; i < count; ++i) {
bool dir = false;
ar & dir;
if (ar.Fail())
return;
Node * node = nullptr;
if (dir) {
Directory * dir = new Directory;
ar & *dir;
node = dir;
}
else {
File * file = new File;
ar & *file;
node = file;
}
node->SetParent(this);
_children[node->GetName()] = node;
}
}
template <typename Stream>
inline void Archive(hyper_net::OArchiver<Stream>& ar) {
hn_shared_lock_guard<hn_shared_mutex> guard(_mutex);
Node::Archive(ar);
ar & (int32_t)_children.size();
for (auto itr = _children.begin(); itr != _children.end(); ++itr) {
if (itr->second->IsDir()) {
bool dir = true;
ar & dir;
ar & *static_cast<Directory*>(itr->second);
}
else {
bool dir = false;
ar & dir;
ar & *static_cast<File*>(itr->second);
}
}
}
int32_t CreateNode(User * user, const char * path, const char * name, int16_t authority, bool dir);
int32_t Remove(User * user, const char * path);
std::vector<Node*> List(User * user, const char * path);
int32_t QueryNode(User * user, const char * path, const std::function<int32_t(User * user, Node * node)>& fn);
void BuildAllFile();
inline bool Empty() const { return _children.empty(); }
inline std::tuple<std::string, const char*> FetchSubPath(const char * path) {
const char * slash = strchr(path, '/');
if (slash)
return std::make_tuple(std::string(path, slash - path), slash + 1);
return std::make_tuple(std::string(path), nullptr);
}
inline bool CanCleanUp() const { return !_canNotCleanUp; }
void StartGC(int64_t now);
private:
std::vector<Node*> List();
int32_t CreateNode(User * user, const char * name, int16_t authority, bool dir);
private:
bool _canNotCleanUp = false;
std::unordered_map<std::string, Node*> _children;
};
}
#endif //__DIRECTORY_H__
| 23.04902 | 112 | 0.622714 |
edaf560b27f2c1038692e038f227491f81a17647 | 5,284 | c | C | A10/thread_mandelbrot.c | caesardai/assignments | 2ed7ffb57cdb410e54580afd5206cc961bb18ce1 | [
"MIT"
] | null | null | null | A10/thread_mandelbrot.c | caesardai/assignments | 2ed7ffb57cdb410e54580afd5206cc961bb18ce1 | [
"MIT"
] | null | null | null | A10/thread_mandelbrot.c | caesardai/assignments | 2ed7ffb57cdb410e54580afd5206cc961bb18ce1 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <string.h>
#include "read_ppm.h"
struct thread_data {
int id;
int size;
float xmin;
float xmax;
float ymin;
float ymax;
int maxIterations;
int row_s, row_t, col_s, col_t;
struct ppm_pixel* palette;
struct ppm_pixel** graph_matrix;
};
void* compute_image(void* args);
int main(int argc, char* argv[]) {
int size = 800;
float xmin = -2.0;
float xmax = 0.47;
float ymin = -1.12;
float ymax = 1.12;
int maxIterations = 1000;
int numProcesses = 4;
double timer;
struct timeval tstart, tend;
pthread_t tid[4];
struct thread_data data[4];
int opt;
while ((opt = getopt(argc, argv, ":s:l:r:t:b:p:")) != -1) {
switch (opt) {
case 's': size = atoi(optarg); break;
case 'l': xmin = atof(optarg); break;
case 'r': xmax = atof(optarg); break;
case 't': ymax = atof(optarg); break;
case 'b': ymin = atof(optarg); break;
case '?': printf("usage: %s -s <size> -l <xmin> -r <xmax> "
"-b <ymin> -t <ymax> -p <numProcesses>\n", argv[0]); break;
}
}
printf("Generating mandelbrot with size %dx%d\n", size, size);
printf(" Num processes = %d\n", numProcesses);
printf(" X range = [%.4f,%.4f]\n", xmin, xmax);
printf(" Y range = [%.4f,%.4f]\n", ymin, ymax);
// todo: your code here
// generate pallet
struct ppm_pixel* palette = malloc(sizeof(struct ppm_pixel) * maxIterations);
if (palette == NULL) {
printf("Memory allocation failed. Exiting.\n");
exit(1);
}
srand(time(0));
for (int i = 0; i < maxIterations; i++) {
palette[i].red = rand() % 255;
palette[i].green = rand() % 255;
palette[i].blue = rand() % 255;
}
// alocate image memory
struct ppm_pixel** graph_matrix = malloc(sizeof(struct ppm_pixel*) * size);
if (graph_matrix == NULL) {
printf("Memory allocation failed. Exiting.\n");
exit(1);
}
for (int i = 0; i < size; i++) {
graph_matrix[i] = malloc(sizeof(struct ppm_pixel) * size);
if (graph_matrix[i] == NULL) {
printf("Memory allocation failed. Exiting.\n");
exit(1);
}
}
// compute image
gettimeofday(&tstart, NULL);
for (int i = 0; i < numProcesses; i++) {
int half = size / 2;
int row_s, row_t, col_s, col_t;
if (i == 0) { // first quadrant
row_s = 0;
row_t = half;
col_s = 0;
col_t = half;
} if (i == 1) { // second quadrant
row_s = 0;
row_t = half;
col_s = half;
col_t = size;
} if (i == 2) { // third quadrant
row_s = half;
row_t = size;
col_s = 0;
col_t = half;
} if (i == 3) { // forth quadrant
row_s = half;
row_t = size;
col_s = half;
col_t = size;
}
data[i].id = i;
data[i].size = size;
data[i].row_s = row_s;
data[i].row_t = row_t;
data[i].col_s = col_s;
data[i].col_t = col_t;
data[i].xmin = xmin;
data[i].xmax = xmax;
data[i].ymin = ymin;
data[i].ymax = ymax;
data[i].maxIterations = maxIterations;
data[i].palette = palette;
data[i].graph_matrix = graph_matrix;
pthread_create(&tid[i], NULL, compute_image, (void*) &data[i]);
}
for (int i = 0; i < numProcesses; i++) {
pthread_join(tid[i], NULL);
}
gettimeofday(&tend, NULL);
timer = tend.tv_sec - tstart.tv_sec + (tend.tv_usec - tstart.tv_usec)/1.e6;
printf("Computed mandelbrot set (%dx%d) in %.6f seconds\n", size, size, timer);
char output_name[128];
sprintf(output_name, "mandelbrot-%d-%.10ld.ppm", size, time(0));
int name_len = strlen(output_name);
output_name[name_len] = '\0';
// write file
write_ppm(output_name, graph_matrix, size, size);
// free memory
for (int i = 0; i < size; i++) {
free(graph_matrix[i]);
graph_matrix[i] = NULL;
}
free(graph_matrix);
graph_matrix = NULL;
free(palette);
palette = NULL;
return 0;
}
void *compute_image(void* args) {
int iter;
float xfrac, yfrac, x0, y0, x, y, xtmp;
struct thread_data* data = (struct thread_data *) args;
printf("Thread %d) sub-image block: cols (%d, %d) to rows (%d, %d)\n",
data->id, data->col_s, data->col_t, data->row_s, data->row_t);
for (int r = data->row_s; r < data->row_t; r++) {
for (int c = data->col_s; c < data->col_t; c++) {
xfrac = (float) r /data->size;
yfrac = (float) c /data->size;
x0 = data->xmin + xfrac * (data->xmax - data->xmin);
y0 = data->ymin + yfrac * (data->ymax - data->ymin);
x = 0;
y = 0;
iter = 0;
while (iter < data->maxIterations && x*x + y*y < 2*2) {
xtmp = x*x - y*y + x0;
y = 2*x*y + y0;
x = xtmp;
iter++;
}
if (iter < data->maxIterations) { //escaped
data->graph_matrix[c][r].red = data->palette[iter].red;
data->graph_matrix[c][r].green = data->palette[iter].green;
data->graph_matrix[c][r].blue = data->palette[iter].blue;
}
else { // else all black
data->graph_matrix[c][r].red = 0;
data->graph_matrix[c][r].green = 0;
data->graph_matrix[c][r].blue = 0;
}
}
}
printf("Thread %d) finished\n", data->id);
return (void *) NULL;
}
| 26.552764 | 81 | 0.57059 |
8e35e81f466479608db17be03cd6837e4d3162f1 | 356 | h | C | nunity/man/Files.u.h | jonahharris/osdb-unity | 19fcc2a1700af26e8265dfd98044cab5756d29ed | [
"LPL-1.02"
] | null | null | null | nunity/man/Files.u.h | jonahharris/osdb-unity | 19fcc2a1700af26e8265dfd98044cab5756d29ed | [
"LPL-1.02"
] | null | null | null | nunity/man/Files.u.h | jonahharris/osdb-unity | 19fcc2a1700af26e8265dfd98044cab5756d29ed | [
"LPL-1.02"
] | null | null | null | .\"
.\" Copyright (C) 2002 by Lucent Technologies
.\"
.TP 10
\fBA\fI<table>\fB.\fI<attribute>\fR and \fBB\fI<table>\fP.\fI<attribute>\fR
\- Index files for
.I <attribute>
in
.IR <table> .
.TP
\fBD\fI<table>\fR
\- Descriptor file for \fI<table>\fR, listing the
attributes, their delimiting-character or width,
printing information, and user-friendly names.
| 23.733333 | 75 | 0.710674 |
8e6adfb5739e1d74795ed8d7e4cb203235fecd1f | 5,959 | h | C | Demos/ODFAEG-CLIENT/application.h | Cwc-Test/ODFAEG | 5e5bd13e3145764c3d0182225aad591040691481 | [
"Zlib"
] | 5 | 2015-06-13T13:11:59.000Z | 2020-04-17T23:10:23.000Z | Demos/ODFAEG-CLIENT/application.h | Cwc-Test/ODFAEG | 5e5bd13e3145764c3d0182225aad591040691481 | [
"Zlib"
] | 4 | 2019-01-07T11:46:21.000Z | 2020-02-14T15:04:15.000Z | Demos/ODFAEG-CLIENT/application.h | Cwc-Test/ODFAEG | 5e5bd13e3145764c3d0182225aad591040691481 | [
"Zlib"
] | 4 | 2016-01-05T09:54:57.000Z | 2021-01-06T18:52:26.000Z |
#include <iostream>
#include <string>
#include <vector>
// *** END ***
#ifndef MY_APPLI
#define MY_APPLI
#include "odfaeg/Core/application.h"
#include "odfaeg/Graphics/convexShape.h"
#include "odfaeg/Graphics/rectangleShape.h"
#include "odfaeg/Graphics/circleShape.h"
#include "odfaeg/Graphics/tile.h"
#include "odfaeg/Core/world.h"
#include "odfaeg/Graphics/map.h"
#include "odfaeg/Graphics/perPixelLinkedListRenderComponent.hpp"
#include "odfaeg/Graphics/2D/decor.h"
#include "odfaeg/Graphics/anim.h"
#include "odfaeg/Graphics/2D/ambientLight.h"
#include "odfaeg/Graphics/2D/ponctualLight.h"
#include "odfaeg/Graphics/2D/wall.h"
#include "odfaeg/Graphics/tGround.h"
#include "odfaeg/Core/actionMap.h"
#include "odfaeg/Graphics/entitiesUpdater.h"
#include "odfaeg/Graphics/animationUpdater.h"
#include "odfaeg/Graphics/particleSystemUpdater.hpp"
#include "hero.h"
#include "monster.h"
#include "odfaeg/Network/network.h"
#include "odfaeg/Graphics/sprite.h"
#include "odfaeg/Graphics/zSortingRenderComponent.hpp"
#include "odfaeg/Graphics/shadowRenderComponent.hpp"
#include "odfaeg/Graphics/lightRenderComponent.hpp"
#include "odfaeg/Graphics/GUI/label.hpp"
#include "odfaeg/Graphics/GUI/button.hpp"
#include "odfaeg/Graphics/GUI/textArea.hpp"
#include "odfaeg/Graphics/GUI/passwordField.hpp"
#include "odfaeg/Graphics/GUI/progressBar.hpp"
#include "odfaeg/Graphics/GUI/panel.hpp"
#include "odfaeg/Graphics/GUI/table.hpp"
#include "odfaeg/Graphics/GUI/icon.hpp"
#include "odfaeg/Math/distributions.h"
#include "item.hpp"
#include <fstream>
#include <unordered_map>
#include "gameAction.hpp"
#include "itemAction.hpp"
#include "pnj.hpp"
#include "skill.hpp"
namespace sorrok {
class MyAppli : public odfaeg::core::Application,
public odfaeg::graphic::gui::ActionListener {
private :
unsigned int fps;
const float speed = 0.2f;
odfaeg::graphic::EntitiesUpdater *eu;
odfaeg::graphic::AnimUpdater *au;
odfaeg::graphic::ParticleSystemUpdater *psu;
bool running;
odfaeg::graphic::g2d::Wall *w;
Caracter* hero;
odfaeg::window::IKeyboard::Key actualKey, previousKey;
std::vector<odfaeg::graphic::Tile*> tiles;
std::vector<odfaeg::graphic::Tile*> walls;
odfaeg::graphic::Map* theMap;
odfaeg::graphic::g2d::PonctualLight* light2;
odfaeg::core::ResourceCache<> cache;
sf::Time timeBtwnTwoReq = sf::seconds(1.f);
sf::Int64 ping;
bool received = false;
static const unsigned int PATH_ERROR_MARGIN = 5;
odfaeg::graphic::RenderWindow* wResuHero, *wIdentification, *wPickupItems, *wInventory, *wDisplayQuests, *wDisplayQuest, *wDiary, *wSkills;
odfaeg::graphic::gui::Label* label, *labPseudo, *labMdp, *lQuestName, *lQuestTask;
odfaeg::graphic::gui::TextArea* taPseudo;
odfaeg::graphic::gui::PasswordField* taPassword;
odfaeg::graphic::gui::Button* button, *idButton, *invButton, *bAccept, *bDeny, *bGiveUp;
odfaeg::graphic::gui::ProgressBar* hpBar, *xpBar, *manaBar;
odfaeg::graphic::gui::Panel* pItems, *pInventory, *pQuestList, *pQuestNames, *pQuestProgress, *pRewards, *pSkills;
bool isClientAuthentified;
std::vector<std::pair<odfaeg::graphic::Sprite*, std::vector<Item>>> cristals;
std::pair<odfaeg::graphic::Sprite*, std::vector<Item>> selectedCristal;
Quest* selectedQuest;
Pnj* selectedPnj;
std::array<odfaeg::graphic::gui::Button*, 9> shorcutsButtons;
odfaeg::graphic::gui::Icon* floatingIcon;
std::map<odfaeg::physic::ParticleSystem*, std::pair<sf::Time, sf::Time>> particles;
std::vector<odfaeg::physic::ParticleSystem*> particles2;
std::map<std::string, sf::Time> doubleClicks;
odfaeg::physic::UniversalEmitter emitter, emitter2;
std::vector<std::pair<odfaeg::core::Variant<Hero::Novice, Hero::Warrior, Hero::Magician, Hero::Thief>, std::pair<odfaeg::core::Variant<Item, Skill>, Hero*>>> gameActions;
std::vector<std::pair<std::pair<Caracter*, odfaeg::graphic::Text>, std::pair<sf::Time, sf::Time>>> tmpTexts;
std::vector<odfaeg::graphic::Entity*> monsters;
std::array<odfaeg::core::Variant<Item, Skill>*, 9> shorcuts;
odfaeg::physic::ParticleSystem* ps;
public :
enum Fonts {
Serif
};
MyAppli(sf::VideoMode wm, std::string title);
void keyHeldDown (odfaeg::window::IKeyboard::Key key);
void pickUpItems (odfaeg::window::IKeyboard::Key key);
void leftMouseButtonPressed(sf::Vector2f mousePos);
void rightMouseButtonPressed(sf::Vector2f mousePos);
void showDiary();
bool mouseInside (sf::Vector2f mousePos);
void onMouseInside (sf::Vector2f mousePos);
void onLoad();
void onInit ();
void onRender(odfaeg::graphic::RenderComponentManager *cm);
void onDisplay(odfaeg::graphic::RenderWindow* window);
void onUpdate (odfaeg::graphic::RenderWindow* window, odfaeg::window::IEvent& event);
void onExec ();
void actionPerformed(odfaeg::graphic::gui::Button* item);
void dropItems (odfaeg::graphic::gui::Label* label);
void showInventory();
void onIconClicked(odfaeg::graphic::gui::Icon* icon);
void talkToPnj(odfaeg::window::IKeyboard::Key key);
void onLabQuestClicked(odfaeg::graphic::gui::Label* label);
void onLabDiaryQuestName(odfaeg::graphic::gui::Label* label);
void onLastHeal(odfaeg::graphic::gui::Label* label);
void onShowSkillPressed();
void launchSkillAnim(std::string name);
void onIconMoved(odfaeg::graphic::gui::Icon* icon);
void onIconMouseButtonReleased(odfaeg::graphic::gui::Icon* icon);
void onIconPressed(odfaeg::graphic::gui::Icon* icon);
void retractFromInventory(Item& item);
void onF1Pressed();
};
}
#endif // MY_APPLI
| 45.48855 | 178 | 0.686525 |
b04c4da79c6aa04bb08d01ea2151324bdf7da613 | 20,176 | h | C | foundation/atomic.h | rampantpixels/foundation_lib | 9d771dc1387babc6bf1f4fbc5c7f68361953bab3 | [
"Unlicense"
] | 191 | 2015-01-14T17:03:19.000Z | 2019-11-08T15:51:12.000Z | foundation/atomic.h | rampantpixels/foundation_lib | 9d771dc1387babc6bf1f4fbc5c7f68361953bab3 | [
"Unlicense"
] | 21 | 2015-01-14T17:00:26.000Z | 2019-02-06T18:52:25.000Z | foundation/atomic.h | rampantpixels/foundation_lib | 9d771dc1387babc6bf1f4fbc5c7f68361953bab3 | [
"Unlicense"
] | 27 | 2015-01-06T21:40:01.000Z | 2019-09-10T13:51:12.000Z | /* atomic.h - Foundation library - Public Domain - 2013 Mattias Jansson
*
* This library provides a cross-platform foundation library in C11 providing basic support
* data types and functions to write applications and games in a platform-independent fashion.
* The latest source code is always available at
*
* https://github.com/mjansson/foundation_lib
*
* This library is put in the public domain; you can redistribute it and/or modify it without
* any restrictions.
*/
#pragma once
/*! \file atomic.h
\brief Atomic operations and memory fences
Atomic operations and memory fences. For an excellent source of information on memory models,
atomic instructions and memory barrier/fences, go to
http://mintomic.github.io/lock-free/memory-model/
and/or
http://en.cppreference.com/w/cpp/atomic/memory_order
Atomic operations provide a means to atomically load, store and perform basic operations to
a 32 & 64 bit data location.
Signal fences guarantee memory order between threads on same core or between interrupt
and signal. Thread fences guarantee memory order between multiple threads on a multicore
system */
#include <foundation/platform.h>
#include <foundation/types.h>
#if !FOUNDATION_COMPILER_MSVC
#include <stdatomic.h>
#endif
/*! Atomically load 32 bit value
\param src Value
\param order The memory synchronization order for this operation. The order parameter cannot be
memory_order_release or memory_order_acq_rel
\return Current value */
static FOUNDATION_FORCEINLINE int32_t
atomic_load32(const atomic32_t* src, memory_order order);
/*! Atomically load 64 bit value
\param src Value
\param order The memory synchronization order for this operation. The order parameter cannot be
memory_order_release or memory_order_acq_rel
\return Current value */
static FOUNDATION_FORCEINLINE int64_t
atomic_load64(const atomic64_t* src, memory_order order);
/*! Atomically load pointer value
\param src Value
\param order The memory synchronization order for this operation. The order parameter cannot be
memory_order_release or memory_order_acq_rel
\return Current value */
static FOUNDATION_FORCEINLINE void*
atomic_load_ptr(const atomicptr_t* src, memory_order order);
/*! Atomically store 32 bit value
\param dst Target
\param order The memory synchronization order for this operation. The order argument cannot be
memory_order_acquire, memory_order_consume, or memory_order_acq_rel.
\param val Value to store */
static FOUNDATION_FORCEINLINE void
atomic_store32(atomic32_t* dst, int32_t val, memory_order order);
/*! Atomically store 64 bit value
\param dst Target
\param order The memory synchronization order for this operation. The order argument cannot be
memory_order_acquire, memory_order_consume, or memory_order_acq_rel.
\param val Value to store */
static FOUNDATION_FORCEINLINE void
atomic_store64(atomic64_t* dst, int64_t val, memory_order order);
/*! Atomically store pointer value
\param dst Target
\param order The memory synchronization order for this operation. The order argument cannot be
memory_order_acquire, memory_order_consume, or memory_order_acq_rel.
\param val Value to store */
static FOUNDATION_FORCEINLINE void
atomic_store_ptr(atomicptr_t* dst, void* val, memory_order order);
/*! Atomically add to the value of the 32 bit integer and returns its new value
\param val Value to change
\param add Value to add
\param order The memory synchronization order for this operation
\return New value after addition */
static FOUNDATION_FORCEINLINE int32_t
atomic_add32(atomic32_t* val, int32_t add, memory_order order);
/*! Atomically add to the value of the 64 bit integer and returns its new value
\param val Value to change
\param add Value to add
\param order The memory synchronization order for this operation
\return New value after addition */
static FOUNDATION_FORCEINLINE int64_t
atomic_add64(atomic64_t* val, int64_t add, memory_order order);
/*! Atomically increases the value of the 32 bit integer and returns its new value
\param val Value to change
\param order The memory synchronization order for this operation
\return New value after increase */
static FOUNDATION_FORCEINLINE int32_t
atomic_incr32(atomic32_t* val, memory_order order);
/*! Atomically increases the value of the 64 bit integer and returns its new value
\param val Value to change
\param order The memory synchronization order for this operation
\return New value after increase */
static FOUNDATION_FORCEINLINE int64_t
atomic_incr64(atomic64_t* val, memory_order order);
/*! Atomically decreases the value of the 32 bit integer and returns its new value
\param val Value to change
\param order The memory synchronization order for this operation
\return New value after decrease */
static FOUNDATION_FORCEINLINE int32_t
atomic_decr32(atomic32_t* val, memory_order order);
/*! Atomically decreases the value of the 64 bit integer and returns its new value
\param val Value to change
\param order The memory synchronization order for this operation
\return New value after decrease */
static FOUNDATION_FORCEINLINE int64_t
atomic_decr64(atomic64_t* val, memory_order order);
/*! Atomically add to the value of the 32 bit integer and returns its old value
\param val Value to change
\param add Value to add
\param order The memory synchronization order for this operation
\return Old value before addition */
static FOUNDATION_FORCEINLINE int32_t
atomic_exchange_and_add32(atomic32_t* val, int32_t add, memory_order order);
/*! Atomically add to the value of the 64 bit integer and returns its old value
\param val Value to change
\param add Value to add
\param order The memory synchronization order for this operation
\return Old value before addition */
static FOUNDATION_FORCEINLINE int64_t
atomic_exchange_and_add64(atomic64_t* val, int64_t add, memory_order order);
/*! Atomically compare and swap (CAS). The value in the destination location is compared to
the reference value, and if equal the new value is stored in the destination location.
A weak compare-and-exchange operation might fail spuriously. That is, even when the contents
of memory referred to by expected and object are equal, it might return false.
\param dst Value to change
\param val Value to set
\param ref Reference value
\param success The memory synchronization order for for the read-modify-write operation if the
comparison succeeds
\param failure The memory synchronization order for the load operation if the comparison fails. This
parameter cannot be memory_order_release or memory_order_acq_rel. You cannot specify it with a
memory synchronization order stronger than success
\return true if operation was successful and new value stored, false if comparison failed and
value was unchanged */
static FOUNDATION_FORCEINLINE bool
atomic_cas32(atomic32_t* dst, int32_t val, int32_t ref, memory_order success, memory_order failure);
/*! Atomically compare and swap (CAS). The value in the destination location is compared to
the reference value, and if equal the new value is stored in the destination location.
A weak compare-and-exchange operation might fail spuriously. That is, even when the contents
of memory referred to by expected and object are equal, it might return false.
\param dst Value to change
\param val Value to set
\param ref Reference value
\param success The memory synchronization order for for the read-modify-write operation if the
comparison succeeds
\param failure The memory synchronization order for the load operation if the comparison fails. This
parameter cannot be memory_order_release or memory_order_acq_rel. You cannot specify it with a
memory synchronization order stronger than success
\return true if operation was successful and new value stored, false if comparison failed and
value was unchanged */
static FOUNDATION_FORCEINLINE bool
atomic_cas64(atomic64_t* dst, int64_t val, int64_t ref, memory_order success, memory_order failure);
/*! Atomically compare and swap (CAS). The value in the destination location is compared to
the reference value, and if equal the new value is stored in the destination location.
A weak compare-and-exchange operation might fail spuriously. That is, even when the contents
of memory referred to by expected and object are equal, it might return false.
\param dst Value to change
\param val Value to set
\param ref Reference value
\param success The memory synchronization order for for the read-modify-write operation if the
comparison succeeds
\param failure The memory synchronization order for the load operation if the comparison fails. This
parameter cannot be memory_order_release or memory_order_acq_rel. You cannot specify it with a
memory synchronization order stronger than success
\return true if operation was successful and new value stored, false if comparison failed and
value was unchanged */
static FOUNDATION_FORCEINLINE bool
atomic_cas_ptr(atomicptr_t* dst, void* val, void* ref, memory_order success, memory_order failure);
/*! Signal fence making prior writes made to other memory locations done by a thread on
the same core doing a release fence visible to the calling thread. Implemented as a compile
barrier on all supported platforms */
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_acquire(void);
/*! Signal fence to make prior writes to functions doing an acquire fence in threads on
the same core. Implemented as a compile barrier on all supported platforms */
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_release(void);
/*! Signal fence combining acquire and release order as well as providing a single total
order on all sequentially consistent fences for threads on the same core. Implemented as
a compile barrier on all supported platforms */
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_sequentially_consistent(void);
/*! Thread fence making prior writes made to other memory locations done by a thread doing
a release fence visible to the calling thread. */
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_acquire(void);
/*! Thread fence making prior writes visible to other threads to do an acquire fence. */
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_release(void);
/*! Thread fence combining an acquire and release fence as well as enforcing a single
total order on all sequentially consistent fences. */
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_sequentially_consistent(void);
// Implementations
#if !FOUNDATION_COMPILER_MSVC && !defined(__STDC_NO_ATOMICS__)
// C11
#if FOUNDATION_COMPILER_CLANG
// Really, atomic load operations should be const-able
// C atomic_load_explicit(const volatile A* object, memory_order order);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
static FOUNDATION_FORCEINLINE int32_t
atomic_load32(const atomic32_t* src, memory_order order) {
return atomic_load_explicit((atomic32_t*)src, order);
}
static FOUNDATION_FORCEINLINE int64_t
atomic_load64(const atomic64_t* src, memory_order order) {
return atomic_load_explicit((atomic64_t*)src, order);
}
static FOUNDATION_FORCEINLINE void*
atomic_load_ptr(const atomicptr_t* src, memory_order order) {
return atomic_load_explicit((atomicptr_t*)src, order);
}
#pragma clang diagnostic pop
#else
static FOUNDATION_FORCEINLINE int32_t
atomic_load32(const atomic32_t* src, memory_order order) {
return atomic_load_explicit(src, order);
}
static FOUNDATION_FORCEINLINE int64_t
atomic_load64(const atomic64_t* src, memory_order order) {
return atomic_load_explicit(src, order);
}
static FOUNDATION_FORCEINLINE void*
atomic_load_ptr(const atomicptr_t* src, memory_order order) {
return atomic_load_explicit(src, order);
}
#endif
static FOUNDATION_FORCEINLINE void
atomic_store32(atomic32_t* dst, int32_t val, memory_order order) {
atomic_store_explicit(dst, val, order);
}
static FOUNDATION_FORCEINLINE void
atomic_store64(atomic64_t* dst, int64_t val, memory_order order) {
atomic_store_explicit(dst, val, order);
}
static FOUNDATION_FORCEINLINE void
atomic_store_ptr(atomicptr_t* dst, void* val, memory_order order) {
atomic_store_explicit(dst, val, order);
}
static FOUNDATION_FORCEINLINE int32_t
atomic_add32(atomic32_t* val, int32_t add, memory_order order) {
return atomic_fetch_add_explicit(val, add, order) + add;
}
static FOUNDATION_FORCEINLINE int64_t
atomic_add64(atomic64_t* val, int64_t add, memory_order order) {
return atomic_fetch_add_explicit(val, add, order) + add;
}
static FOUNDATION_FORCEINLINE int32_t
atomic_incr32(atomic32_t* val, memory_order order) {
return atomic_fetch_add_explicit(val, 1, order) + 1;
}
static FOUNDATION_FORCEINLINE int64_t
atomic_incr64(atomic64_t* val, memory_order order) {
return atomic_fetch_add_explicit(val, 1, order) + 1;
}
static FOUNDATION_FORCEINLINE int32_t
atomic_decr32(atomic32_t* val, memory_order order) {
return atomic_fetch_add_explicit(val, -1, order) - 1;
}
static FOUNDATION_FORCEINLINE int64_t
atomic_decr64(atomic64_t* val, memory_order order) {
return atomic_fetch_add_explicit(val, -1, order) - 1;
}
static FOUNDATION_FORCEINLINE int32_t
atomic_exchange_and_add32(atomic32_t* val, int32_t add, memory_order order) {
return atomic_fetch_add_explicit(val, add, order);
}
static FOUNDATION_FORCEINLINE int64_t
atomic_exchange_and_add64(atomic64_t* val, int64_t add, memory_order order) {
return atomic_fetch_add_explicit(val, add, order);
}
static FOUNDATION_FORCEINLINE bool
atomic_cas32(atomic32_t* dst, int32_t val, int32_t ref, memory_order success, memory_order failure) {
return atomic_compare_exchange_weak_explicit(dst, &ref, val, success, failure);
}
static FOUNDATION_FORCEINLINE bool
atomic_cas64(atomic64_t* dst, int64_t val, int64_t ref, memory_order success, memory_order failure) {
return atomic_compare_exchange_weak_explicit(dst, &ref, val, success, failure);
}
static FOUNDATION_FORCEINLINE bool
atomic_cas_ptr(atomicptr_t* dst, void* val, void* ref, memory_order success, memory_order failure) {
return atomic_compare_exchange_weak_explicit(dst, &ref, val, success, failure);
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_acquire(void) {
atomic_signal_fence(memory_order_acquire);
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_release(void) {
atomic_signal_fence(memory_order_release);
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_sequentially_consistent(void) {
atomic_signal_fence(memory_order_seq_cst);
}
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_acquire(void) {
atomic_thread_fence(memory_order_acquire);
}
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_release(void) {
atomic_thread_fence(memory_order_release);
}
static FOUNDATION_FORCEINLINE void
atomic_thread_fence_sequentially_consistent(void) {
atomic_signal_fence(memory_order_seq_cst);
}
#elif FOUNDATION_COMPILER_MSVC
// Microsoft
static FOUNDATION_FORCEINLINE int32_t
atomic_load32(const atomic32_t* val, memory_order order) {
if (order != memory_order_relaxed)
_ReadWriteBarrier();
return val->nonatomic;
}
static FOUNDATION_FORCEINLINE int64_t
atomic_load64(const atomic64_t* val, memory_order order) {
if (order != memory_order_relaxed)
_ReadWriteBarrier();
#if FOUNDATION_ARCH_X86
int64_t result;
__asm {
mov esi, val;
mov ebx, eax;
mov ecx, edx;
lock cmpxchg8b [esi];
mov dword ptr result, eax;
mov dword ptr result[4], edx;
}
return result;
#else
return val->nonatomic;
#endif
}
static FOUNDATION_FORCEINLINE void*
atomic_load_ptr(const atomicptr_t* val, memory_order order) {
if (order != memory_order_relaxed)
_ReadWriteBarrier();
return (void*)val->nonatomic;
}
static FOUNDATION_FORCEINLINE void
atomic_store32(atomic32_t* dst, int32_t val, memory_order order) {
dst->nonatomic = val;
if (order >= memory_order_release)
_ReadWriteBarrier();
}
static FOUNDATION_FORCEINLINE void
atomic_store64(atomic64_t* dst, int64_t val, memory_order order) {
#if FOUNDATION_ARCH_X86
#pragma warning(disable : 4731)
__asm {
push ebx;
mov esi, dst;
mov ebx, dword ptr val;
mov ecx, dword ptr val[4];
retry:
cmpxchg8b [esi];
jne retry;
pop ebx;
}
#else
dst->nonatomic = val;
#endif
if (order >= memory_order_release) _ReadWriteBarrier();
}
static FOUNDATION_FORCEINLINE void
atomic_store_ptr(atomicptr_t* dst, void* val, memory_order order) {
dst->nonatomic = val;
if (order >= memory_order_release)
_ReadWriteBarrier();
}
static FOUNDATION_FORCEINLINE int32_t
atomic_exchange_and_add32(atomic32_t* val, int32_t add, memory_order order) {
FOUNDATION_UNUSED(order);
return _InterlockedExchangeAdd((volatile long*)&val->nonatomic, add);
}
static FOUNDATION_FORCEINLINE int
atomic_add32(atomic32_t* val, int32_t add, memory_order order) {
FOUNDATION_UNUSED(order);
int32_t old = (int32_t)_InterlockedExchangeAdd((volatile long*)&val->nonatomic, add);
return (old + add);
}
static FOUNDATION_FORCEINLINE int
atomic_incr32(atomic32_t* val, memory_order order) {
FOUNDATION_UNUSED(order);
return atomic_add32(val, 1, order);
}
static FOUNDATION_FORCEINLINE int
atomic_decr32(atomic32_t* val, memory_order order) {
FOUNDATION_UNUSED(order);
return atomic_add32(val, -1, order);
}
static FOUNDATION_FORCEINLINE int64_t
atomic_exchange_and_add64(atomic64_t* val, int64_t add, memory_order order) {
FOUNDATION_UNUSED(order);
#if FOUNDATION_ARCH_X86
long long ref;
do {
ref = val->nonatomic;
} while (_InterlockedCompareExchange64((volatile long long*)&val->nonatomic, ref + add, ref) != ref);
return ref;
#else // X86_64
return _InterlockedExchangeAdd64(&val->nonatomic, add);
#endif
}
static FOUNDATION_FORCEINLINE int64_t
atomic_add64(atomic64_t* val, int64_t add, memory_order order) {
FOUNDATION_UNUSED(order);
#if FOUNDATION_ARCH_X86
return atomic_exchange_and_add64(val, add, order) + add;
#else
return _InterlockedExchangeAdd64(&val->nonatomic, add) + add;
#endif
}
static FOUNDATION_FORCEINLINE int64_t
atomic_incr64(atomic64_t* val, memory_order order) {
FOUNDATION_UNUSED(order);
return atomic_add64(val, 1LL, order);
}
static FOUNDATION_FORCEINLINE int64_t
atomic_decr64(atomic64_t* val, memory_order order) {
FOUNDATION_UNUSED(order);
return atomic_add64(val, -1LL, order);
}
static FOUNDATION_FORCEINLINE bool
atomic_cas32(atomic32_t* dst, int32_t val, int32_t ref, memory_order success, memory_order failure) {
FOUNDATION_UNUSED(success);
FOUNDATION_UNUSED(failure);
return (_InterlockedCompareExchange((volatile long*)&dst->nonatomic, val, ref) == ref) ? true : false;
}
static FOUNDATION_FORCEINLINE bool
atomic_cas64(atomic64_t* dst, int64_t val, int64_t ref, memory_order success, memory_order failure) {
FOUNDATION_UNUSED(success);
FOUNDATION_UNUSED(failure);
return (_InterlockedCompareExchange64((volatile long long*)&dst->nonatomic, val, ref) == ref) ? true : false;
}
static FOUNDATION_FORCEINLINE bool
atomic_cas_ptr(atomicptr_t* dst, void* val, void* ref, memory_order success, memory_order failure) {
FOUNDATION_UNUSED(success);
FOUNDATION_UNUSED(failure);
#if FOUNDATION_SIZE_POINTER == 8
return atomic_cas64((atomic64_t*)dst, (int64_t)(uintptr_t)val, (int64_t)(uintptr_t)ref, success, failure);
#else
return atomic_cas32((atomic32_t*)dst, (int32_t)(uintptr_t)val, (int32_t)(uintptr_t)ref, success, failure);
#endif
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_acquire(void) {
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_release(void) {
}
static FOUNDATION_FORCEINLINE void
atomic_signal_fence_sequentially_consistent(void) {
}
#include <intrin.h>
FOUNDATION_API void
internal_atomic_thread_fence_sequentially_consistent(void);
#define atomic_signal_fence_acquire() _ReadWriteBarrier()
#define atomic_signal_fence_release() _ReadWriteBarrier()
#define atomic_signal_fence_sequentially_consistent() _ReadWriteBarrier()
#define atomic_thread_fence_acquire() _ReadWriteBarrier()
#define atomic_thread_fence_release() _ReadWriteBarrier()
#define atomic_thread_fence_sequentially_consistent() internal_atomic_thread_fence_sequentially_consistent()
#else // __STDC_NO_ATOMICS__
#error Atomic operations not implemented
#endif
| 36.093023 | 110 | 0.804669 |
50acbbeda8ae37faa92584003ba7e4a5545ab08b | 2,692 | h | C | 3rdParty/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h | rohmer/LVGL_UI_Creator | 37a19be55e1de95d56717786a27506d8c78fd1ae | [
"MIT"
] | 33 | 2019-09-17T20:57:56.000Z | 2021-11-20T21:50:51.000Z | 3rdParty/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h | rohmer/LVGL_UI_Creator | 37a19be55e1de95d56717786a27506d8c78fd1ae | [
"MIT"
] | 4 | 2019-10-21T08:38:11.000Z | 2021-11-17T16:53:08.000Z | 3rdParty/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h | rohmer/LVGL_UI_Creator | 37a19be55e1de95d56717786a27506d8c78fd1ae | [
"MIT"
] | 16 | 2019-09-25T04:25:04.000Z | 2022-03-28T07:46:18.000Z | /*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __IDIRECTFBINPUTDEVICE_DISPATCHER_H__
#define __IDIRECTFBINPUTDEVICE_DISPATCHER_H__
#define IDIRECTFBINPUTDEVICE_METHOD_ID_AddRef 1
#define IDIRECTFBINPUTDEVICE_METHOD_ID_Release 2
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetID 3
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetDescription 4
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeymapEntry 5
#define IDIRECTFBINPUTDEVICE_METHOD_ID_CreateEventBuffer 6
#define IDIRECTFBINPUTDEVICE_METHOD_ID_AttachEventBuffer 7
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeyState 8
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetModifiers 9
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetLockState 10
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtons 11
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtonState 12
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetAxis 13
#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetXY 14
#define IDIRECTFBINPUTDEVICE_METHOD_ID_DetachEventBuffer 15
/*
* private data struct of IDirectFBInputDevice_Dispatcher
*/
typedef struct {
int ref; /* reference counter */
IDirectFBInputDevice *real;
VoodooInstanceID self;
VoodooInstanceID super;
} IDirectFBInputDevice_Dispatcher_data;
#endif
| 41.415385 | 88 | 0.718053 |
13130dce4629a23ac3be5d3a0ec2ac0de7e4f045 | 566 | h | C | MTKIT/lib/Category/SafeKit/VDM/NSObject+VSDependencyManager.h | MTKit/MTKit | f431c2d2c45316c6add3240c620748c3bc07adbf | [
"MIT"
] | 1 | 2017-09-25T04:40:57.000Z | 2017-09-25T04:40:57.000Z | MTKIT/lib/Category/SafeKit/VDM/NSObject+VSDependencyManager.h | MTKit/MTKit | f431c2d2c45316c6add3240c620748c3bc07adbf | [
"MIT"
] | null | null | null | MTKIT/lib/Category/SafeKit/VDM/NSObject+VSDependencyManager.h | MTKit/MTKit | f431c2d2c45316c6add3240c620748c3bc07adbf | [
"MIT"
] | null | null | null | //
// NSObject+deleteDependence.h
// VSReplaceMethod
//
// Created by YaoMing on 14-3-24.
// Copyright (c) 2014年 YaoMing. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject (VSDependencyManager)
- (void)addDependencyObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context;
- (void)removeOCObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath;
- (void)removeOCObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context;
@end
| 31.444444 | 150 | 0.763251 |
92f818222b9bf6d0b511d6021bda4fb604914f47 | 2,094 | c | C | pds_test.c | himanshujoshi5992/pds_version1 | d8d698c6f8028c89ef4f5ca1f1222c056500e733 | [
"MIT"
] | null | null | null | pds_test.c | himanshujoshi5992/pds_version1 | d8d698c6f8028c89ef4f5ca1f1222c056500e733 | [
"MIT"
] | null | null | null | pds_test.c | himanshujoshi5992/pds_version1 | d8d698c6f8028c89ef4f5ca1f1222c056500e733 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pds.h"
#include "contact.h"
void test_search();
void test_store();
void test_create();
//int pds_open(char*);
void printContact(struct Contact *c );
int main()
{
char *repo_name = "pds_demo.dat";
int status;
status = pds_open( repo_name );
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_open failed: %d\n", status);
exit(1);
}
test_store();
test_search();
pds_close();
printf("Program terminated successfully\n");
return 0;
}
void test_store()
{
int status, key;
struct Contact c1, c2;
// Testing pds_store
c1.contact_id = 101;
strcpy(c1.cname, "Contact #1");
strcpy(c1.mphone, "Phone #1");
strcpy(c1.email, "Email #1");
c2.contact_id = 102;
strcpy(c2.cname, "Contact #2");
strcpy(c2.mphone, "Phone #2");
strcpy(c2.email, "Email #2");
status = pds_store( &c1 );
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_store failed for key %d: errorcode %d\n", c1.contact_id, status);
}
status = pds_store( &c2 );
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_store failed for key %d: errorcode %d\n", c2.contact_id, status);
}
status = pds_store( &c2 );
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_store failed for key %d: errorcode %d\n", c2.contact_id, status);
}
}
void test_search() {
int status;
struct Contact c3;
int key;
key = 101;
status = pds_search_by_key(key, &c3);
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_search_by_key failed for key %d: errorcode %d\n", key, status);
}
else{
printContact(&c3);
}
key = 102;
status = pds_search_by_key(key, &c3);
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_search_by_key failed for key %d: errorcode %d\n", key, status);
}
else{
printContact(&c3);
}
key = 1020000;
status = pds_search_by_key(key, &c3);
if( status != PDS_SUCCESS ){
fprintf(stderr, "pds_search_by_key failed for key %d: errorcode %d\n", key, status);
}
else{
printContact(&c3);
}
}
void printContact(struct Contact *c )
{
printf("%d;%s;%s;%s\n", c->contact_id, c->cname, c->mphone, c->email);
}
| 20.529412 | 88 | 0.659981 |
598216e07fb56201e3e60606245562dbaa8d951f | 618 | h | C | include/core/program.h | giovgiac/cassio | b673c8fe082609057904befce9a099fa64077986 | [
"Apache-2.0"
] | null | null | null | include/core/program.h | giovgiac/cassio | b673c8fe082609057904befce9a099fa64077986 | [
"Apache-2.0"
] | null | null | null | include/core/program.h | giovgiac/cassio | b673c8fe082609057904befce9a099fa64077986 | [
"Apache-2.0"
] | null | null | null | /**
* @file program.h
* @brief
*
* @copyright Copyright (c) 2018 All Rights Reserved.
*
*/
#ifndef CORE_PROGRAM_H_
#define CORE_PROGRAM_H_
#include <declaration/declaration.h>
#include <function/function.h>
#include <tokens/token.h>
#include <list>
#include <memory>
namespace cassio {
/**
* @class Program
* @brief
*
* ...
*
*/
class Program {
public:
static std::unique_ptr<Program> Construct(std::list<Token> &tokens);
std::string Generate();
void Semanticate();
private:
std::unique_ptr<Declaration> declaration_;
std::unique_ptr<Function> function_;
};
}
#endif // CORE_PROGRAM_H_
| 14.714286 | 70 | 0.686084 |
d33d2eb86499ee792a208c23167db383e1f586b8 | 1,248 | h | C | libPathFitter/OsgPathFitter.h | vicrucann/CurveFitting | e60f37a1447b2e3bb503fd0fca87f4877ad614dc | [
"MIT"
] | 74 | 2016-10-18T02:16:02.000Z | 2022-02-16T14:52:10.000Z | libPathFitter/OsgPathFitter.h | daljit97/CurveFitting | e60f37a1447b2e3bb503fd0fca87f4877ad614dc | [
"MIT"
] | 1 | 2017-04-27T13:52:28.000Z | 2017-04-27T17:26:17.000Z | libPathFitter/OsgPathFitter.h | daljit97/CurveFitting | e60f37a1447b2e3bb503fd0fca87f4877ad614dc | [
"MIT"
] | 13 | 2016-08-29T19:39:11.000Z | 2022-03-11T19:52:42.000Z | #ifndef OSGPATHFITTER_H
#define OSGPATHFITTER_H
#include "PathFitter.h"
#include <osg/ref_ptr>
#include <osg/Array>
/*! \class OsgPathFitter
* \brief OpenSceneGraph-based class to perform path fitting.
*
* The container is of type osg::Vec3Array which can be directly used for drawing procedure by
* attaching it to the corresponding geometry.
*
* Each point is represented by osg::Vec3f - a 3D point; all the points lie within the same plane,
* e.g., they have format (x, 0, z). OpenSceneGraph's implementation of osg::Vec3f include all the
* linear algebra operators that are used by PathFitter, e.g., inner product as operator*(), cross
* product as operator^(), etc.
*/
template <typename Container, typename Point2, typename Real>
class OsgPathFitter : public PathFitter<osg::Vec3Array, osg::Vec3f, float>
{
public:
/*! Constructor */
OsgPathFitter();
/*! \return Container type that can be easily used within OpenSceneGraph. */
virtual Container* fit(Real error = 2.5);
protected:
/*! \return Euclidian distance between two points. */
virtual Real getDistance(const Point2& p1, const Point2& p2);
/*! \return NAN point type. */
virtual Point2 getNANPoint() const;
};
#endif // OSGPATHFITTER_H
| 31.2 | 98 | 0.721154 |
1cd285745a4ab84de836fffc854110b1f5dfa083 | 569 | h | C | HKYunLib/Frameworks/KKBLibrary.framework/Headers/UITextView+placeholder.h | kaikeba-github/HKYunLib | 4d27d1bd6081477eb862ad9b26bbbc1fcbad499d | [
"MIT"
] | null | null | null | HKYunLib/Frameworks/KKBLibrary.framework/Headers/UITextView+placeholder.h | kaikeba-github/HKYunLib | 4d27d1bd6081477eb862ad9b26bbbc1fcbad499d | [
"MIT"
] | null | null | null | HKYunLib/Frameworks/KKBLibrary.framework/Headers/UITextView+placeholder.h | kaikeba-github/HKYunLib | 4d27d1bd6081477eb862ad9b26bbbc1fcbad499d | [
"MIT"
] | null | null | null | //
// UITextView+placeholder.h
// KKBLibrary
//
// Created by Duane on 2019/6/4.
// Copyright © 2019 KaiKeBa. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITextView (placeholder)
/** placeholder */
@property(nonatomic, copy, nullable) NSString *placeholder;
/** placeholder颜色 */
@property(nonatomic,copy) UIColor *placeholderColor;
/** 富文本 */
@property(nonatomic,strong, nullable) NSAttributedString *attributePlaceholder;
/** 位置 */
@property(nonatomic,assign) CGPoint placeholderLocation;
@end
NS_ASSUME_NONNULL_END
| 18.966667 | 79 | 0.745167 |
872c1938c5fef7e1537e3c17f4ec99ee3a6ee61e | 12,555 | h | C | blinky/common/services/usb/class/phdc/device/udi_phdc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | blinky/common/services/usb/class/phdc/device/udi_phdc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | blinky/common/services/usb/class/phdc/device/udi_phdc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | /**
* \file
*
* \brief USB Device Personal Healthcare Device Class (PHDC)
* interface definitions.
*
* Copyright (c) 2009-2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _UDI_PHDC_H_
#define _UDI_PHDC_H_
#include "conf_usb.h"
#include "usb_protocol.h"
#include "usb_protocol_phdc.h"
#include "udd.h"
#include "udc_desc.h"
#include "udi.h"
/* Check if preample feature is supported (don't change it) */
#define UDI_PHDC_PREAMBLE_FEATURE false /* No preample message by default */
#if (0 != (UDI_PHDC_QOS_OUT & (UDI_PHDC_QOS_OUT - 1)))
/* There are many QOS for OUT then enable preample feature */
#undef UDI_PHDC_PREAMBLE_FEATURE
#define UDI_PHDC_PREAMBLE_FEATURE true
#endif
#if (0 != (UDI_PHDC_QOS_IN & (UDI_PHDC_QOS_IN - 1)))
/* There are many QOS for IN then enable preample feature */
#undef UDI_PHDC_PREAMBLE_FEATURE
#define UDI_PHDC_PREAMBLE_FEATURE true
#endif
/* Check QOS value */
#if (0 != (UDI_PHDC_QOS_OUT & USB_PHDC_QOS_LOW_GOOD))
#error The QOS Low Good is not authorized on OUT transfer
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* \addtogroup udi_phdc_group_udc
* @{
*/
/* ! Global structure which contains standard UDI API for UDC */
extern UDC_DESC_STORAGE udi_api_t udi_api_phdc;
/* @} */
/**
* \ingroup udi_phdc_group
* \defgroup udi_phdc_group_desc USB interface descriptors
*
* The following structures provide predefined USB interface descriptors.
* It must be used to define the final USB descriptors.
* @{
*/
COMPILER_PACK_SET(1)
/*! Array used only to compute the size of wDevSpecializations through sizeof()
* during compilation. This array is not used and is removed by compiler.
*/
static le16_t tmp_wDevSpecializations[] = UDI_PHDC_SPECIALIZATION;
/* ! Function specialization descriptor for interface descriptors */
typedef struct {
usb_phdc_fnctext_desc_t header;
le16_t wDevSpecializations[sizeof(tmp_wDevSpecializations) / 2];
} udi_phdc_fnctext_desc_t;
#ifdef UDI_PHDC_METADATA_DESC_BULK_IN
/*! Array used only to compute the size of wDevSpecializations through sizeof()
* during compilation. This array is not used and is removed by compiler.
*/
static uint8_t tmp_bulk_in[] = UDI_PHDC_METADATA_DESC_BULK_IN;
/* ! Metadata descriptor of bulk IN for interface descriptors */
typedef struct {
usb_phdc_meta_data_desc_t header;
uint8_t bOpaqueData[sizeof(tmp_bulk_in)];
} udi_phdc_metadata_desc_bulkin_t;
#endif
#ifdef UDI_PHDC_METADATA_DESC_BULK_OUT
/*! Array used only to compute the size of wDevSpecializations through sizeof()
* during compilation. This array is not used and is removed by compiler.
*/
static uint8_t tmp_bulk_out[] = UDI_PHDC_METADATA_DESC_BULK_OUT;
/* ! Metadata descriptor of bulk OUT for interface descriptors */
typedef struct {
usb_phdc_meta_data_desc_t header;
uint8_t bOpaqueData[sizeof(tmp_bulk_out)];
} udi_phdc_metadata_desc_bulkout_t;
#endif
#ifdef UDI_PHDC_METADATA_DESC_INT_IN
/*! Array used only to compute the size of wDevSpecializations through sizeof()
* during compilation. This array is not used and is removed by compiler.
*/
static uint8_t tmp_int_in[] = UDI_PHDC_METADATA_DESC_INT_IN;
/* ! Metadata descriptor of interrupt IN for interface descriptors */
typedef struct {
usb_phdc_meta_data_desc_t header;
uint8_t bOpaqueData[sizeof(tmp_int_in)];
} udi_phdc_metadata_desc_intin_t;
#endif
/* ! Interface descriptor structure for PHDC */
typedef struct {
usb_iface_desc_t iface;
usb_phdc_classfnct_desc_t classfnct;
#if (UDI_PHDC_DATAMSG_FORMAT == USB_PHDC_DATAMSG_FORMAT_11073_2060)
udi_phdc_fnctext_desc_t fnctext;
#endif
usb_ep_desc_t ep_bulk_in;
usb_phdc_qos_desc_t qos_bulk_in;
#ifdef UDI_PHDC_METADATA_DESC_BULK_IN
udi_phdc_metadata_desc_bulkin_t metadata_bulk_in;
#endif
usb_ep_desc_t ep_bulk_out;
usb_phdc_qos_desc_t qos_bulk_out;
#ifdef UDI_PHDC_METADATA_DESC_BULK_OUT
udi_phdc_metadata_desc_bulkout_t metadata_bulk_out;
#endif
#if ((UDI_PHDC_QOS_IN & USB_PHDC_QOS_LOW_GOOD) == USB_PHDC_QOS_LOW_GOOD)
usb_ep_desc_t ep_int_in;
usb_phdc_qos_desc_t qos_int_in;
# ifdef UDI_PHDC_METADATA_DESC_INT_IN
udi_phdc_metadata_desc_intin_t metadata_int_in;
# endif
#endif
} udi_phdc_desc_t;
COMPILER_PACK_RESET()
/* ! By default no string associated to this interface */
#ifndef UDI_PHDC_STRING_ID
#define UDI_PHDC_STRING_ID 0
#endif
/* ! Compute the number of endpoints used by the interface */
#if ((UDI_PHDC_QOS_IN & USB_PHDC_QOS_LOW_GOOD) == USB_PHDC_QOS_LOW_GOOD)
#define UDI_PHDC_NUM_ENDPOINT 3 /* Bulk IN, bulk OUT, Interrupt IN */
#else
#define UDI_PHDC_NUM_ENDPOINT 2 /* Bulk IN, bulk OUT */
#endif
/* ! Value to enable/disable in descriptor the feature metadata preample */
#if (UDI_PHDC_PREAMBLE_FEATURE == true)
#define UDI_PHDC_BMCAPABILITY USB_PHDC_CAPABILITY_METADATAMSG_PREAMBLE
#else
#define UDI_PHDC_BMCAPABILITY 0
#endif
/* ! Extension descriptor for optional format 11073 2060 */
#if (UDI_PHDC_DATAMSG_FORMAT == USB_PHDC_DATAMSG_FORMAT_11073_2060)
#define UDI_PHDC_FNCTEXT \
.fnctext.header.bLength = sizeof(udi_phdc_fnctext_desc_t), \
.fnctext.header.bDescriptorType = USB_DT_PHDC_11073PHD_FUNCTION, \
.fnctext.header.bReserved = 0, \
.fnctext.header.bNumDevSpecs = sizeof(tmp_wDevSpecializations) / 2, \
.fnctext.wDevSpecializations = UDI_PHDC_SPECIALIZATION,
#else
#define UDI_PHDC_FNCTEXT
#endif
/* ! Optional metadata descriptor for endpoint bulk IN */
#ifdef UDI_PHDC_METADATA_DESC_BULK_IN
#define UDI_PHDC_METADATA_BULKIN \
.metadata_bulk_in.header.bLength \
= sizeof(udi_phdc_metadata_desc_bulkin_t), \
.metadata_bulk_in.header.bDescriptorType = USB_DT_PHDC_METADATA, \
.metadata_bulk_in.bOpaqueData = UDI_PHDC_METADATA_DESC_BULK_IN,
#else
#define UDI_PHDC_METADATA_BULKIN
#endif
/* ! Optional metadata descriptor for endpoint bulk OUT */
#ifdef UDI_PHDC_METADATA_DESC_BULK_OUT
#define UDI_PHDC_METADATA_BULKOUT \
.metadata_bulk_out.header.bLength \
= sizeof(udi_phdc_metadata_desc_bulkout_t), \
.metadata_bulk_out.header.bDescriptorType = USB_DT_PHDC_METADATA, \
.metadata_bulk_in.bOpaqueData = UDI_PHDC_METADATA_DESC_BULK_OUT,
#else
#define UDI_PHDC_METADATA_BULKOUT
#endif
/* ! Optional metadata descriptor for endpoint interrupt IN */
#ifdef UDI_PHDC_METADATA_DESC_INT_IN
#define UDI_PHDC_METADATA_INTIN \
.metadata_int_in.header.bLength \
= sizeof(udi_phdc_metadata_desc_intin_t), \
.metadata_int_in.header.bDescriptorType = USB_DT_PHDC_METADATA, \
.metadata_int_in.bOpaqueData = UDI_PHDC_METADATA_DESC_INT_IN,
#else
#define UDI_PHDC_METADATA_INTIN
#endif
/* ! Declaration of endpoint interrupt IN in case of QOS low good */
#if ((UDI_PHDC_QOS_IN & USB_PHDC_QOS_LOW_GOOD) == USB_PHDC_QOS_LOW_GOOD)
#define UDI_PHDC_EP_INTIN \
.ep_int_in.bLength = sizeof(usb_ep_desc_t), \
.ep_int_in.bDescriptorType = USB_DT_ENDPOINT, \
.ep_int_in.bEndpointAddress = UDI_PHDC_EP_INTERRUPT_IN, \
.ep_int_in.bmAttributes = USB_EP_TYPE_INTERRUPT, \
.ep_int_in.wMaxPacketSize = LE16(UDI_PHDC_EP_SIZE_INT_IN), \
.ep_int_in.bInterval = 20, \
.qos_int_in.bLength = sizeof(usb_phdc_qos_desc_t), \
.qos_int_in.bDescriptorType = USB_DT_PHDC_QOS, \
.qos_int_in.bQoSEncodingVersion = USB_PHDC_QOS_ENCODING_VERSION_1, \
.qos_int_in.bmLatencyReliability = USB_PHDC_QOS_LOW_GOOD, \
UDI_PHDC_METADATA_INTIN
#else
#define UDI_PHDC_EP_INTIN
#endif
/* ! Content of PHDC interface descriptor for all speeds */
#define UDI_PHDC_DESC { \
.iface.bLength = sizeof(usb_iface_desc_t), \
.iface.bDescriptorType = USB_DT_INTERFACE, \
.iface.bInterfaceNumber = UDI_PHDC_IFACE_NUMBER, \
.iface.bAlternateSetting = 0, \
.iface.bNumEndpoints = UDI_PHDC_NUM_ENDPOINT, \
.iface.bInterfaceClass = PHDC_CLASS, \
.iface.bInterfaceSubClass = PHDC_SUB_CLASS, \
.iface.bInterfaceProtocol = PHDC_PROTOCOL, \
.iface.iInterface = UDI_PHDC_STRING_ID, \
.classfnct.bLength \
= sizeof(usb_phdc_classfnct_desc_t), \
.classfnct.bDescriptorType = USB_DT_PHDC_CLASSFUNCTION, \
.classfnct.bPHDCDataCode = UDI_PHDC_DATAMSG_FORMAT, \
.classfnct.bmCapability = UDI_PHDC_BMCAPABILITY, \
UDI_PHDC_FNCTEXT \
.ep_bulk_in.bLength = sizeof(usb_ep_desc_t), \
.ep_bulk_in.bDescriptorType = USB_DT_ENDPOINT, \
.ep_bulk_in.bEndpointAddress = UDI_PHDC_EP_BULK_IN, \
.ep_bulk_in.bmAttributes = USB_EP_TYPE_BULK, \
.ep_bulk_in.wMaxPacketSize = LE16(UDI_PHDC_EP_SIZE_BULK_IN), \
.ep_bulk_in.bInterval = 0, \
.qos_bulk_in.bLength \
= sizeof(usb_phdc_qos_desc_t), \
.qos_bulk_in.bDescriptorType = USB_DT_PHDC_QOS, \
.qos_bulk_in.bQoSEncodingVersion \
= USB_PHDC_QOS_ENCODING_VERSION_1, \
.qos_bulk_in.bmLatencyReliability \
= UDI_PHDC_QOS_IN & (~USB_PHDC_QOS_LOW_GOOD), \
UDI_PHDC_METADATA_BULKIN \
.ep_bulk_out.bLength = sizeof(usb_ep_desc_t), \
.ep_bulk_out.bDescriptorType = USB_DT_ENDPOINT, \
.ep_bulk_out.bEndpointAddress = UDI_PHDC_EP_BULK_OUT, \
.ep_bulk_out.bmAttributes = USB_EP_TYPE_BULK, \
.ep_bulk_out.wMaxPacketSize = LE16(UDI_PHDC_EP_SIZE_BULK_OUT), \
.ep_bulk_out.bInterval = 0, \
.qos_bulk_out.bLength \
= sizeof(usb_phdc_qos_desc_t), \
.qos_bulk_out.bDescriptorType = USB_DT_PHDC_QOS, \
.qos_bulk_out.bQoSEncodingVersion \
= USB_PHDC_QOS_ENCODING_VERSION_1, \
.qos_bulk_out.bmLatencyReliability = UDI_PHDC_QOS_OUT, \
UDI_PHDC_METADATA_BULKOUT \
UDI_PHDC_EP_INTIN \
}
/* @} */
/**
* \ingroup udi_group
* \defgroup udi_phdc_group USB Device Interface (UDI) for Personal Healthcare
* Device Class (PHDC)
*
* Common APIs used by high level application to use this USB class.
* @{
*/
/* ! Structure used in argument for routines
* udi_phdc_senddata and udi_phdc_waitdata
*/
typedef struct {
uint8_t qos;
uint8_t *opaquedata;
uint8_t opaque_size;
uint8_t *metadata;
uint16_t metadata_size;
} udi_phdc_metadata_t;
/**
* \brief Send metadata to USB host
*
* \param metadata Information about metadata to send
* \param callback Function to call at the end of transfer.
*
* \return \c 1 if function was successfully done, otherwise \c 0.
*/
bool udi_phdc_senddata(udi_phdc_metadata_t *metadata,
void (*callback)(uint16_t));
/**
* \brief Abort of send metadata to USB host
*/
void udi_phdc_senddata_abort(void);
/**
* \brief Wait metadata from USB host
*
* \param metadata Information about expected metadata
* \param callback Function to call at the end of transfer.
*
* \return \c 1 if function was successfully done, otherwise \c 0.
*/
bool udi_phdc_waitdata(udi_phdc_metadata_t *metadata,
void (*callback)(bool, uint16_t));
/* ! @} */
#ifdef __cplusplus
}
#endif
#endif /* _UDI_PHDC_H_ */
| 35.069832 | 90 | 0.757387 |
7c949755d8f6027fa2ad8edc49f937854ec455ad | 440 | h | C | DerydocaEngine.Editor/src/Dgui/InputText.h | Derydoca/derydocaengine | a9cdb71082fbb879d9448dc0c1a95581681d61f1 | [
"BSD-3-Clause"
] | 37 | 2018-05-21T15:21:26.000Z | 2020-11-16T17:50:44.000Z | DerydocaEngine.Editor/src/Dgui/InputText.h | Derydoca/derydocaengine | a9cdb71082fbb879d9448dc0c1a95581681d61f1 | [
"BSD-3-Clause"
] | 38 | 2018-03-09T23:57:07.000Z | 2020-07-10T20:52:42.000Z | DerydocaEngine.Editor/src/Dgui/InputText.h | Derydoca/derydocaengine | a9cdb71082fbb879d9448dc0c1a95581681d61f1 | [
"BSD-3-Clause"
] | 5 | 2018-08-28T11:12:18.000Z | 2019-09-05T09:30:41.000Z | #pragma once
namespace DerydocaEngine::Dgui
{
struct InputTextCallback_UserData
{
std::string* Str;
ImGuiInputTextCallback ChainCallback;
void* ChainCallbackUserData;
};
static int InputTextCallback(ImGuiInputTextCallbackData* data);
bool InputText(
std::string label,
std::string& str,
ImGuiInputTextFlags flags = ImGuiInputTextFlags_None,
ImGuiInputTextCallback callback = nullptr,
void* user_data = nullptr
);
} | 20 | 64 | 0.775 |
7b4dc8faccb3a16a68b50ea3039bcb0b8034a24e | 559 | h | C | plugins/chap10plugin/chap10plugin.h | cosmonaut/mddas | dff97888594ac57c4672d9c0680f418b612f4fe3 | [
"MIT"
] | 1 | 2016-09-27T15:36:55.000Z | 2016-09-27T15:36:55.000Z | plugins/chap10plugin/chap10plugin.h | cosmonaut/mddas | dff97888594ac57c4672d9c0680f418b612f4fe3 | [
"MIT"
] | null | null | null | plugins/chap10plugin/chap10plugin.h | cosmonaut/mddas | dff97888594ac57c4672d9c0680f418b612f4fe3 | [
"MIT"
] | null | null | null | #ifndef CHAP10PLUGIN_H
#define CHAP10PLUGIN_H
#include <stdint.h>
#include "samplingthreadinterface.h"
#include "samplingthreadplugin.h"
class UDPSocket;
class Chap10Plugin : public SamplingThreadPlugin {
Q_OBJECT
public:
Chap10Plugin();
~Chap10Plugin();
protected:
void run();
private:
QVector<MDDASDataPoint> parse_data(void);
UDPSocket *_sock;
uint16_t data_buf[4096];
/* Last word in data_buf */
uint32_t data_buf_ind;
uint64_t bad_words;
uint64_t udp_mismatch;
uint64_t udp_missed;
};
#endif
| 15.971429 | 50 | 0.711986 |
7b7597987fdcc33ca32968c8902e94b83746b3be | 66,775 | h | C | UWP/RadialDevice/winrt/internal/Windows.ApplicationModel.Chat.1.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | 23 | 2016-11-28T05:47:06.000Z | 2020-11-13T20:13:47.000Z | UWP/RadialDevice/winrt/internal/Windows.ApplicationModel.Chat.1.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | null | null | null | UWP/RadialDevice/winrt/internal/Windows.ApplicationModel.Chat.1.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | 5 | 2017-01-21T14:42:47.000Z | 2022-02-24T03:42:24.000Z | // C++ for the Windows Runtime v1.0.161012.5
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
#pragma once
#include "../base.h"
#include "Windows.ApplicationModel.Chat.0.h"
#include "Windows.Foundation.0.h"
#include "Windows.Media.MediaProperties.0.h"
#include "Windows.Security.Credentials.0.h"
#include "Windows.Storage.Streams.0.h"
#include "Windows.Foundation.Collections.1.h"
#include "Windows.Foundation.1.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::ApplicationModel::Chat {
struct __declspec(uuid("3aff77bc-39c9-4dd1-ad2d-3964dd9d403f")) __declspec(novtable) IChatCapabilities : Windows::IInspectable
{
virtual HRESULT __stdcall get_IsOnline(bool * result) = 0;
virtual HRESULT __stdcall get_IsChatCapable(bool * result) = 0;
virtual HRESULT __stdcall get_IsFileTransferCapable(bool * result) = 0;
virtual HRESULT __stdcall get_IsGeoLocationPushCapable(bool * result) = 0;
virtual HRESULT __stdcall get_IsIntegratedMessagingCapable(bool * result) = 0;
};
struct __declspec(uuid("b57a2f30-7041-458e-b0cf-7c0d9fea333a")) __declspec(novtable) IChatCapabilitiesManagerStatics : Windows::IInspectable
{
virtual HRESULT __stdcall abi_GetCachedCapabilitiesAsync(hstring address, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatCapabilities> ** result) = 0;
virtual HRESULT __stdcall abi_GetCapabilitiesFromNetworkAsync(hstring address, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatCapabilities> ** result) = 0;
};
struct __declspec(uuid("a58c080d-1a6f-46dc-8f3d-f5028660b6ee")) __declspec(novtable) IChatConversation : Windows::IInspectable
{
virtual HRESULT __stdcall get_HasUnreadMessages(bool * result) = 0;
virtual HRESULT __stdcall get_Id(hstring * result) = 0;
virtual HRESULT __stdcall get_Subject(hstring * result) = 0;
virtual HRESULT __stdcall put_Subject(hstring value) = 0;
virtual HRESULT __stdcall get_IsConversationMuted(bool * result) = 0;
virtual HRESULT __stdcall put_IsConversationMuted(bool value) = 0;
virtual HRESULT __stdcall get_MostRecentMessageId(hstring * result) = 0;
virtual HRESULT __stdcall get_Participants(Windows::Foundation::Collections::IVector<hstring> ** result) = 0;
virtual HRESULT __stdcall get_ThreadingInfo(Windows::ApplicationModel::Chat::IChatConversationThreadingInfo ** result) = 0;
virtual HRESULT __stdcall abi_DeleteAsync(Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_GetMessageReader(Windows::ApplicationModel::Chat::IChatMessageReader ** result) = 0;
virtual HRESULT __stdcall abi_MarkAllMessagesAsReadAsync(Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_MarkMessagesAsReadAsync(Windows::Foundation::DateTime value, Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_SaveAsync(Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_NotifyLocalParticipantComposing(hstring transportId, hstring participantAddress, bool isComposing) = 0;
virtual HRESULT __stdcall abi_NotifyRemoteParticipantComposing(hstring transportId, hstring participantAddress, bool isComposing) = 0;
virtual HRESULT __stdcall add_RemoteParticipantComposingChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Chat::ChatConversation, Windows::ApplicationModel::Chat::RemoteParticipantComposingChangedEventArgs> * handler, event_token * token) = 0;
virtual HRESULT __stdcall remove_RemoteParticipantComposingChanged(event_token token) = 0;
};
struct __declspec(uuid("0a030cd1-983a-47aa-9a90-ee48ee997b59")) __declspec(novtable) IChatConversation2 : Windows::IInspectable
{
virtual HRESULT __stdcall get_CanModifyParticipants(bool * result) = 0;
virtual HRESULT __stdcall put_CanModifyParticipants(bool value) = 0;
};
struct __declspec(uuid("055136d2-de32-4a47-a93a-b3dc0833852b")) __declspec(novtable) IChatConversationReader : Windows::IInspectable
{
virtual HRESULT __stdcall abi_ReadBatchAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatConversation>> ** result) = 0;
virtual HRESULT __stdcall abi_ReadBatchWithCountAsync(int32_t count, Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatConversation>> ** result) = 0;
};
struct __declspec(uuid("331c21dc-7a07-4422-a32c-24be7c6dab24")) __declspec(novtable) IChatConversationThreadingInfo : Windows::IInspectable
{
virtual HRESULT __stdcall get_ContactId(hstring * result) = 0;
virtual HRESULT __stdcall put_ContactId(hstring value) = 0;
virtual HRESULT __stdcall get_Custom(hstring * result) = 0;
virtual HRESULT __stdcall put_Custom(hstring value) = 0;
virtual HRESULT __stdcall get_ConversationId(hstring * result) = 0;
virtual HRESULT __stdcall put_ConversationId(hstring value) = 0;
virtual HRESULT __stdcall get_Participants(Windows::Foundation::Collections::IVector<hstring> ** result) = 0;
virtual HRESULT __stdcall get_Kind(winrt::Windows::ApplicationModel::Chat::ChatConversationThreadingKind * result) = 0;
virtual HRESULT __stdcall put_Kind(winrt::Windows::ApplicationModel::Chat::ChatConversationThreadingKind value) = 0;
};
struct __declspec(uuid("8751d000-ceb1-4243-b803-15d45a1dd428")) __declspec(novtable) IChatItem : Windows::IInspectable
{
virtual HRESULT __stdcall get_ItemKind(winrt::Windows::ApplicationModel::Chat::ChatItemKind * result) = 0;
};
struct __declspec(uuid("4b39052a-1142-5089-76da-f2db3d17cd05")) __declspec(novtable) IChatMessage : Windows::IInspectable
{
virtual HRESULT __stdcall get_Attachments(Windows::Foundation::Collections::IVector<Windows::ApplicationModel::Chat::ChatMessageAttachment> ** value) = 0;
virtual HRESULT __stdcall get_Body(hstring * value) = 0;
virtual HRESULT __stdcall put_Body(hstring value) = 0;
virtual HRESULT __stdcall get_From(hstring * value) = 0;
virtual HRESULT __stdcall get_Id(hstring * value) = 0;
virtual HRESULT __stdcall get_IsForwardingDisabled(bool * value) = 0;
virtual HRESULT __stdcall get_IsIncoming(bool * value) = 0;
virtual HRESULT __stdcall get_IsRead(bool * value) = 0;
virtual HRESULT __stdcall get_LocalTimestamp(Windows::Foundation::DateTime * value) = 0;
virtual HRESULT __stdcall get_NetworkTimestamp(Windows::Foundation::DateTime * value) = 0;
virtual HRESULT __stdcall get_Recipients(Windows::Foundation::Collections::IVector<hstring> ** value) = 0;
virtual HRESULT __stdcall get_RecipientSendStatuses(Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::ApplicationModel::Chat::ChatMessageStatus> ** value) = 0;
virtual HRESULT __stdcall get_Status(winrt::Windows::ApplicationModel::Chat::ChatMessageStatus * value) = 0;
virtual HRESULT __stdcall get_Subject(hstring * value) = 0;
virtual HRESULT __stdcall get_TransportFriendlyName(hstring * value) = 0;
virtual HRESULT __stdcall get_TransportId(hstring * value) = 0;
virtual HRESULT __stdcall put_TransportId(hstring value) = 0;
};
struct __declspec(uuid("86668332-543f-49f5-ac71-6c2afc6565fd")) __declspec(novtable) IChatMessage2 : Windows::IInspectable
{
virtual HRESULT __stdcall get_EstimatedDownloadSize(uint64_t * result) = 0;
virtual HRESULT __stdcall put_EstimatedDownloadSize(uint64_t value) = 0;
virtual HRESULT __stdcall put_From(hstring value) = 0;
virtual HRESULT __stdcall get_IsAutoReply(bool * result) = 0;
virtual HRESULT __stdcall put_IsAutoReply(bool value) = 0;
virtual HRESULT __stdcall put_IsForwardingDisabled(bool value) = 0;
virtual HRESULT __stdcall get_IsReplyDisabled(bool * result) = 0;
virtual HRESULT __stdcall put_IsIncoming(bool value) = 0;
virtual HRESULT __stdcall put_IsRead(bool value) = 0;
virtual HRESULT __stdcall get_IsSeen(bool * result) = 0;
virtual HRESULT __stdcall put_IsSeen(bool value) = 0;
virtual HRESULT __stdcall get_IsSimMessage(bool * result) = 0;
virtual HRESULT __stdcall put_LocalTimestamp(Windows::Foundation::DateTime value) = 0;
virtual HRESULT __stdcall get_MessageKind(winrt::Windows::ApplicationModel::Chat::ChatMessageKind * result) = 0;
virtual HRESULT __stdcall put_MessageKind(winrt::Windows::ApplicationModel::Chat::ChatMessageKind value) = 0;
virtual HRESULT __stdcall get_MessageOperatorKind(winrt::Windows::ApplicationModel::Chat::ChatMessageOperatorKind * result) = 0;
virtual HRESULT __stdcall put_MessageOperatorKind(winrt::Windows::ApplicationModel::Chat::ChatMessageOperatorKind value) = 0;
virtual HRESULT __stdcall put_NetworkTimestamp(Windows::Foundation::DateTime value) = 0;
virtual HRESULT __stdcall get_IsReceivedDuringQuietHours(bool * result) = 0;
virtual HRESULT __stdcall put_IsReceivedDuringQuietHours(bool value) = 0;
virtual HRESULT __stdcall put_RemoteId(hstring value) = 0;
virtual HRESULT __stdcall put_Status(winrt::Windows::ApplicationModel::Chat::ChatMessageStatus value) = 0;
virtual HRESULT __stdcall put_Subject(hstring value) = 0;
virtual HRESULT __stdcall get_ShouldSuppressNotification(bool * result) = 0;
virtual HRESULT __stdcall put_ShouldSuppressNotification(bool value) = 0;
virtual HRESULT __stdcall get_ThreadingInfo(Windows::ApplicationModel::Chat::IChatConversationThreadingInfo ** result) = 0;
virtual HRESULT __stdcall put_ThreadingInfo(Windows::ApplicationModel::Chat::IChatConversationThreadingInfo * value) = 0;
virtual HRESULT __stdcall get_RecipientsDeliveryInfos(Windows::Foundation::Collections::IVector<Windows::ApplicationModel::Chat::ChatRecipientDeliveryInfo> ** result) = 0;
};
struct __declspec(uuid("74eb2fb0-3ba7-459f-8e0b-e8af0febd9ad")) __declspec(novtable) IChatMessage3 : Windows::IInspectable
{
virtual HRESULT __stdcall get_RemoteId(hstring * value) = 0;
};
struct __declspec(uuid("2d144b0f-d2bf-460c-aa68-6d3f8483c9bf")) __declspec(novtable) IChatMessage4 : Windows::IInspectable
{
virtual HRESULT __stdcall get_SyncId(hstring * result) = 0;
virtual HRESULT __stdcall put_SyncId(hstring value) = 0;
};
struct __declspec(uuid("c7c4fd74-bf63-58eb-508c-8b863ff16b67")) __declspec(novtable) IChatMessageAttachment : Windows::IInspectable
{
virtual HRESULT __stdcall get_DataStreamReference(Windows::Storage::Streams::IRandomAccessStreamReference ** value) = 0;
virtual HRESULT __stdcall put_DataStreamReference(Windows::Storage::Streams::IRandomAccessStreamReference * value) = 0;
virtual HRESULT __stdcall get_GroupId(uint32_t * value) = 0;
virtual HRESULT __stdcall put_GroupId(uint32_t value) = 0;
virtual HRESULT __stdcall get_MimeType(hstring * value) = 0;
virtual HRESULT __stdcall put_MimeType(hstring value) = 0;
virtual HRESULT __stdcall get_Text(hstring * value) = 0;
virtual HRESULT __stdcall put_Text(hstring value) = 0;
};
struct __declspec(uuid("5ed99270-7dd1-4a87-a8ce-acdd87d80dc8")) __declspec(novtable) IChatMessageAttachment2 : Windows::IInspectable
{
virtual HRESULT __stdcall get_Thumbnail(Windows::Storage::Streams::IRandomAccessStreamReference ** result) = 0;
virtual HRESULT __stdcall put_Thumbnail(Windows::Storage::Streams::IRandomAccessStreamReference * value) = 0;
virtual HRESULT __stdcall get_TransferProgress(double * result) = 0;
virtual HRESULT __stdcall put_TransferProgress(double value) = 0;
virtual HRESULT __stdcall get_OriginalFileName(hstring * result) = 0;
virtual HRESULT __stdcall put_OriginalFileName(hstring value) = 0;
};
struct __declspec(uuid("205852a2-a356-5b71-6ca9-66c985b7d0d5")) __declspec(novtable) IChatMessageAttachmentFactory : Windows::IInspectable
{
virtual HRESULT __stdcall abi_CreateChatMessageAttachment(hstring mimeType, Windows::Storage::Streams::IRandomAccessStreamReference * dataStreamReference, Windows::ApplicationModel::Chat::IChatMessageAttachment ** value) = 0;
};
struct __declspec(uuid("f6b9a380-cdea-11e4-8830-0800200c9a66")) __declspec(novtable) IChatMessageBlockingStatic : Windows::IInspectable
{
virtual HRESULT __stdcall abi_MarkMessageAsBlockedAsync(hstring localChatMessageId, bool blocked, Windows::Foundation::IAsyncAction ** value) = 0;
};
struct __declspec(uuid("1c18c355-421e-54b8-6d38-6b3a6c82fccc")) __declspec(novtable) IChatMessageChange : Windows::IInspectable
{
virtual HRESULT __stdcall get_ChangeType(winrt::Windows::ApplicationModel::Chat::ChatMessageChangeType * value) = 0;
virtual HRESULT __stdcall get_Message(Windows::ApplicationModel::Chat::IChatMessage ** value) = 0;
};
struct __declspec(uuid("14267020-28ce-5f26-7b05-9a5c7cce87ca")) __declspec(novtable) IChatMessageChangeReader : Windows::IInspectable
{
virtual HRESULT __stdcall abi_AcceptChanges() = 0;
virtual HRESULT __stdcall abi_AcceptChangesThrough(Windows::ApplicationModel::Chat::IChatMessageChange * lastChangeToAcknowledge) = 0;
virtual HRESULT __stdcall abi_ReadBatchAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatMessageChange>> ** value) = 0;
};
struct __declspec(uuid("60b7f066-70a0-5224-508c-242ef7c1d06f")) __declspec(novtable) IChatMessageChangeTracker : Windows::IInspectable
{
virtual HRESULT __stdcall abi_Enable() = 0;
virtual HRESULT __stdcall abi_GetChangeReader(Windows::ApplicationModel::Chat::IChatMessageChangeReader ** value) = 0;
virtual HRESULT __stdcall abi_Reset() = 0;
};
struct __declspec(uuid("fbc6b30c-788c-4dcc-ace7-6282382968cf")) __declspec(novtable) IChatMessageChangedDeferral : Windows::IInspectable
{
virtual HRESULT __stdcall abi_Complete() = 0;
};
struct __declspec(uuid("b6b73e2d-691c-4edf-8660-6eb9896892e3")) __declspec(novtable) IChatMessageChangedEventArgs : Windows::IInspectable
{
virtual HRESULT __stdcall abi_GetDeferral(Windows::ApplicationModel::Chat::IChatMessageChangedDeferral ** result) = 0;
};
struct __declspec(uuid("1d45390f-9f4f-4e35-964e-1b9ca61ac044")) __declspec(novtable) IChatMessageManager2Statics : Windows::IInspectable
{
virtual HRESULT __stdcall abi_RegisterTransportAsync(Windows::Foundation::IAsyncOperation<hstring> ** result) = 0;
virtual HRESULT __stdcall abi_GetTransportAsync(hstring transportId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessageTransport> ** result) = 0;
};
struct __declspec(uuid("f15c60f7-d5e8-5e92-556d-e03b60253104")) __declspec(novtable) IChatMessageManagerStatic : Windows::IInspectable
{
virtual HRESULT __stdcall abi_GetTransportsAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatMessageTransport>> ** value) = 0;
virtual HRESULT __stdcall abi_RequestStoreAsync(Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessageStore> ** value) = 0;
virtual HRESULT __stdcall abi_ShowComposeSmsMessageAsync(Windows::ApplicationModel::Chat::IChatMessage * message, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_ShowSmsSettings() = 0;
};
struct __declspec(uuid("208b830d-6755-48cc-9ab3-fd03c463fc92")) __declspec(novtable) IChatMessageManagerStatics3 : Windows::IInspectable
{
virtual HRESULT __stdcall abi_RequestSyncManagerAsync(Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatSyncManager> ** result) = 0;
};
struct __declspec(uuid("fd344dfb-3063-4e17-8586-c6c08262e6c0")) __declspec(novtable) IChatMessageNotificationTriggerDetails : Windows::IInspectable
{
virtual HRESULT __stdcall get_ChatMessage(Windows::ApplicationModel::Chat::IChatMessage ** value) = 0;
};
struct __declspec(uuid("6bb522e0-aa07-4fd1-9471-77934fb75ee6")) __declspec(novtable) IChatMessageNotificationTriggerDetails2 : Windows::IInspectable
{
virtual HRESULT __stdcall get_ShouldDisplayToast(bool * result) = 0;
virtual HRESULT __stdcall get_ShouldUpdateDetailText(bool * result) = 0;
virtual HRESULT __stdcall get_ShouldUpdateBadge(bool * result) = 0;
virtual HRESULT __stdcall get_ShouldUpdateActionCenter(bool * result) = 0;
};
struct __declspec(uuid("b6ea78ce-4489-56f9-76aa-e204682514cf")) __declspec(novtable) IChatMessageReader : Windows::IInspectable
{
virtual HRESULT __stdcall abi_ReadBatchAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatMessage>> ** value) = 0;
};
struct __declspec(uuid("89643683-64bb-470d-9df4-0de8be1a05bf")) __declspec(novtable) IChatMessageReader2 : Windows::IInspectable
{
virtual HRESULT __stdcall abi_ReadBatchWithCountAsync(int32_t count, Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::ChatMessage>> ** result) = 0;
};
struct __declspec(uuid("31f2fd01-ccf6-580b-4976-0a07dd5d3b47")) __declspec(novtable) IChatMessageStore : Windows::IInspectable
{
virtual HRESULT __stdcall get_ChangeTracker(Windows::ApplicationModel::Chat::IChatMessageChangeTracker ** value) = 0;
virtual HRESULT __stdcall abi_DeleteMessageAsync(hstring localMessageId, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_DownloadMessageAsync(hstring localChatMessageId, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_GetMessageAsync(hstring localChatMessageId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessage> ** value) = 0;
virtual HRESULT __stdcall abi_GetMessageReader1(Windows::ApplicationModel::Chat::IChatMessageReader ** value) = 0;
virtual HRESULT __stdcall abi_GetMessageReader2(Windows::Foundation::TimeSpan recentTimeLimit, Windows::ApplicationModel::Chat::IChatMessageReader ** value) = 0;
virtual HRESULT __stdcall abi_MarkMessageReadAsync(hstring localChatMessageId, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_RetrySendMessageAsync(hstring localChatMessageId, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_SendMessageAsync(Windows::ApplicationModel::Chat::IChatMessage * chatMessage, Windows::Foundation::IAsyncAction ** value) = 0;
virtual HRESULT __stdcall abi_ValidateMessage(Windows::ApplicationModel::Chat::IChatMessage * chatMessage, Windows::ApplicationModel::Chat::IChatMessageValidationResult ** value) = 0;
virtual HRESULT __stdcall add_MessageChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Chat::ChatMessageStore, Windows::ApplicationModel::Chat::ChatMessageChangedEventArgs> * value, event_token * returnValue) = 0;
virtual HRESULT __stdcall remove_MessageChanged(event_token value) = 0;
};
struct __declspec(uuid("ad4dc4ee-3ad4-491b-b311-abdf9bb22768")) __declspec(novtable) IChatMessageStore2 : Windows::IInspectable
{
virtual HRESULT __stdcall abi_ForwardMessageAsync(hstring localChatMessageId, Windows::Foundation::Collections::IIterable<hstring> * addresses, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessage> ** result) = 0;
virtual HRESULT __stdcall abi_GetConversationAsync(hstring conversationId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatConversation> ** result) = 0;
virtual HRESULT __stdcall abi_GetConversationForTransportsAsync(hstring conversationId, Windows::Foundation::Collections::IIterable<hstring> * transportIds, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatConversation> ** result) = 0;
virtual HRESULT __stdcall abi_GetConversationFromThreadingInfoAsync(Windows::ApplicationModel::Chat::IChatConversationThreadingInfo * threadingInfo, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatConversation> ** result) = 0;
virtual HRESULT __stdcall abi_GetConversationReader(Windows::ApplicationModel::Chat::IChatConversationReader ** result) = 0;
virtual HRESULT __stdcall abi_GetConversationForTransportsReader(Windows::Foundation::Collections::IIterable<hstring> * transportIds, Windows::ApplicationModel::Chat::IChatConversationReader ** result) = 0;
virtual HRESULT __stdcall abi_GetMessageByRemoteIdAsync(hstring transportId, hstring remoteId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessage> ** result) = 0;
virtual HRESULT __stdcall abi_GetUnseenCountAsync(Windows::Foundation::IAsyncOperation<int32_t> ** result) = 0;
virtual HRESULT __stdcall abi_GetUnseenCountForTransportsReaderAsync(Windows::Foundation::Collections::IIterable<hstring> * transportIds, Windows::Foundation::IAsyncOperation<int32_t> ** result) = 0;
virtual HRESULT __stdcall abi_MarkAsSeenAsync(Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_MarkAsSeenForTransportsAsync(Windows::Foundation::Collections::IIterable<hstring> * transportIds, Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_GetSearchReader(Windows::ApplicationModel::Chat::IChatQueryOptions * value, Windows::ApplicationModel::Chat::IChatSearchReader ** result) = 0;
virtual HRESULT __stdcall abi_SaveMessageAsync(Windows::ApplicationModel::Chat::IChatMessage * chatMessage, Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_TryCancelDownloadMessageAsync(hstring localChatMessageId, Windows::Foundation::IAsyncOperation<bool> ** result) = 0;
virtual HRESULT __stdcall abi_TryCancelSendMessageAsync(hstring localChatMessageId, Windows::Foundation::IAsyncOperation<bool> ** result) = 0;
virtual HRESULT __stdcall add_StoreChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Chat::ChatMessageStore, Windows::ApplicationModel::Chat::ChatMessageStoreChangedEventArgs> * handler, event_token * token) = 0;
virtual HRESULT __stdcall remove_StoreChanged(event_token token) = 0;
};
struct __declspec(uuid("9adbbb09-4345-4ec1-8b74-b7338243719c")) __declspec(novtable) IChatMessageStore3 : Windows::IInspectable
{
virtual HRESULT __stdcall abi_GetMessageBySyncIdAsync(hstring syncId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::ChatMessage> ** result) = 0;
};
struct __declspec(uuid("65c66fac-fe8c-46d4-9119-57b8410311d5")) __declspec(novtable) IChatMessageStoreChangedEventArgs : Windows::IInspectable
{
virtual HRESULT __stdcall get_Id(hstring * result) = 0;
virtual HRESULT __stdcall get_Kind(winrt::Windows::ApplicationModel::Chat::ChatStoreChangedEventKind * result) = 0;
};
struct __declspec(uuid("63a9dbf8-e6b3-5c9a-5f85-d47925b9bd18")) __declspec(novtable) IChatMessageTransport : Windows::IInspectable
{
virtual HRESULT __stdcall get_IsAppSetAsNotificationProvider(bool * value) = 0;
virtual HRESULT __stdcall get_IsActive(bool * value) = 0;
virtual HRESULT __stdcall get_TransportFriendlyName(hstring * value) = 0;
virtual HRESULT __stdcall get_TransportId(hstring * value) = 0;
virtual HRESULT __stdcall abi_RequestSetAsNotificationProviderAsync(Windows::Foundation::IAsyncAction ** value) = 0;
};
struct __declspec(uuid("90a75622-d84a-4c22-a94d-544444edc8a1")) __declspec(novtable) IChatMessageTransport2 : Windows::IInspectable
{
virtual HRESULT __stdcall get_Configuration(Windows::ApplicationModel::Chat::IChatMessageTransportConfiguration ** result) = 0;
virtual HRESULT __stdcall get_TransportKind(winrt::Windows::ApplicationModel::Chat::ChatMessageTransportKind * result) = 0;
};
struct __declspec(uuid("879ff725-1a08-4aca-a075-3355126312e6")) __declspec(novtable) IChatMessageTransportConfiguration : Windows::IInspectable
{
virtual HRESULT __stdcall get_MaxAttachmentCount(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxMessageSizeInKilobytes(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxRecipientCount(int32_t * result) = 0;
virtual HRESULT __stdcall get_SupportedVideoFormat(Windows::Media::MediaProperties::IMediaEncodingProfile ** result) = 0;
virtual HRESULT __stdcall get_ExtendedProperties(Windows::Foundation::Collections::IMapView<hstring, Windows::IInspectable> ** result) = 0;
};
struct __declspec(uuid("25e93a03-28ec-5889-569b-7e486b126f18")) __declspec(novtable) IChatMessageValidationResult : Windows::IInspectable
{
virtual HRESULT __stdcall get_MaxPartCount(Windows::Foundation::IReference<uint32_t> ** value) = 0;
virtual HRESULT __stdcall get_PartCount(Windows::Foundation::IReference<uint32_t> ** value) = 0;
virtual HRESULT __stdcall get_RemainingCharacterCountInPart(Windows::Foundation::IReference<uint32_t> ** value) = 0;
virtual HRESULT __stdcall get_Status(winrt::Windows::ApplicationModel::Chat::ChatMessageValidationStatus * value) = 0;
};
struct __declspec(uuid("2fd364a6-bf36-42f7-b7e7-923c0aabfe16")) __declspec(novtable) IChatQueryOptions : Windows::IInspectable
{
virtual HRESULT __stdcall get_SearchString(hstring * result) = 0;
virtual HRESULT __stdcall put_SearchString(hstring value) = 0;
};
struct __declspec(uuid("ffc7b2a2-283c-4c0a-8a0e-8c33bdbf0545")) __declspec(novtable) IChatRecipientDeliveryInfo : Windows::IInspectable
{
virtual HRESULT __stdcall get_TransportAddress(hstring * result) = 0;
virtual HRESULT __stdcall put_TransportAddress(hstring value) = 0;
virtual HRESULT __stdcall get_DeliveryTime(Windows::Foundation::IReference<Windows::Foundation::DateTime> ** result) = 0;
virtual HRESULT __stdcall put_DeliveryTime(Windows::Foundation::IReference<Windows::Foundation::DateTime> * value) = 0;
virtual HRESULT __stdcall get_ReadTime(Windows::Foundation::IReference<Windows::Foundation::DateTime> ** result) = 0;
virtual HRESULT __stdcall put_ReadTime(Windows::Foundation::IReference<Windows::Foundation::DateTime> * value) = 0;
virtual HRESULT __stdcall get_TransportErrorCodeCategory(winrt::Windows::ApplicationModel::Chat::ChatTransportErrorCodeCategory * result) = 0;
virtual HRESULT __stdcall get_TransportInterpretedErrorCode(winrt::Windows::ApplicationModel::Chat::ChatTransportInterpretedErrorCode * result) = 0;
virtual HRESULT __stdcall get_TransportErrorCode(int32_t * result) = 0;
virtual HRESULT __stdcall get_IsErrorPermanent(bool * result) = 0;
virtual HRESULT __stdcall get_Status(winrt::Windows::ApplicationModel::Chat::ChatMessageStatus * result) = 0;
};
struct __declspec(uuid("4665fe49-9020-4752-980d-39612325f589")) __declspec(novtable) IChatSearchReader : Windows::IInspectable
{
virtual HRESULT __stdcall abi_ReadBatchAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::IChatItem>> ** result) = 0;
virtual HRESULT __stdcall abi_ReadBatchWithCountAsync(int32_t count, Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::IChatItem>> ** result) = 0;
};
struct __declspec(uuid("09f869b2-69f4-4aff-82b6-06992ff402d2")) __declspec(novtable) IChatSyncConfiguration : Windows::IInspectable
{
virtual HRESULT __stdcall get_IsSyncEnabled(bool * result) = 0;
virtual HRESULT __stdcall put_IsSyncEnabled(bool value) = 0;
virtual HRESULT __stdcall get_RestoreHistorySpan(winrt::Windows::ApplicationModel::Chat::ChatRestoreHistorySpan * result) = 0;
virtual HRESULT __stdcall put_RestoreHistorySpan(winrt::Windows::ApplicationModel::Chat::ChatRestoreHistorySpan value) = 0;
};
struct __declspec(uuid("7ba52c63-2650-486f-b4b4-6bd9d3d63c84")) __declspec(novtable) IChatSyncManager : Windows::IInspectable
{
virtual HRESULT __stdcall get_Configuration(Windows::ApplicationModel::Chat::IChatSyncConfiguration ** result) = 0;
virtual HRESULT __stdcall abi_AssociateAccountAsync(Windows::Security::Credentials::IWebAccount * webAccount, Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_UnassociateAccountAsync(Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_IsAccountAssociated(Windows::Security::Credentials::IWebAccount * webAccount, bool * result) = 0;
virtual HRESULT __stdcall abi_StartSync() = 0;
virtual HRESULT __stdcall abi_SetConfigurationAsync(Windows::ApplicationModel::Chat::IChatSyncConfiguration * configuration, Windows::Foundation::IAsyncAction ** result) = 0;
};
struct __declspec(uuid("d7cda5eb-cbd7-4f3b-8526-b506dec35c53")) __declspec(novtable) IRcsEndUserMessage : Windows::IInspectable
{
virtual HRESULT __stdcall get_TransportId(hstring * result) = 0;
virtual HRESULT __stdcall get_Title(hstring * result) = 0;
virtual HRESULT __stdcall get_Text(hstring * result) = 0;
virtual HRESULT __stdcall get_IsPinRequired(bool * result) = 0;
virtual HRESULT __stdcall get_Actions(Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::RcsEndUserMessageAction> ** result) = 0;
virtual HRESULT __stdcall abi_SendResponseAsync(Windows::ApplicationModel::Chat::IRcsEndUserMessageAction * action, Windows::Foundation::IAsyncAction ** result) = 0;
virtual HRESULT __stdcall abi_SendResponseWithPinAsync(Windows::ApplicationModel::Chat::IRcsEndUserMessageAction * action, hstring pin, Windows::Foundation::IAsyncAction ** result) = 0;
};
struct __declspec(uuid("92378737-9b42-46d3-9d5e-3c1b2dae7cb8")) __declspec(novtable) IRcsEndUserMessageAction : Windows::IInspectable
{
virtual HRESULT __stdcall get_Label(hstring * result) = 0;
};
struct __declspec(uuid("2d45ae01-3f89-41ea-9702-9e9ed411aa98")) __declspec(novtable) IRcsEndUserMessageAvailableEventArgs : Windows::IInspectable
{
virtual HRESULT __stdcall get_IsMessageAvailable(bool * result) = 0;
virtual HRESULT __stdcall get_Message(Windows::ApplicationModel::Chat::IRcsEndUserMessage ** result) = 0;
};
struct __declspec(uuid("5b97742d-351f-4692-b41e-1b035dc18986")) __declspec(novtable) IRcsEndUserMessageAvailableTriggerDetails : Windows::IInspectable
{
virtual HRESULT __stdcall get_Title(hstring * value) = 0;
virtual HRESULT __stdcall get_Text(hstring * value) = 0;
};
struct __declspec(uuid("3054ae5a-4d1f-4b59-9433-126c734e86a6")) __declspec(novtable) IRcsEndUserMessageManager : Windows::IInspectable
{
virtual HRESULT __stdcall add_MessageAvailableChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Chat::RcsEndUserMessageManager, Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableEventArgs> * handler, event_token * token) = 0;
virtual HRESULT __stdcall remove_MessageAvailableChanged(event_token token) = 0;
};
struct __declspec(uuid("7d270ac5-0abd-4f31-9b99-a59e71a7b731")) __declspec(novtable) IRcsManagerStatics : Windows::IInspectable
{
virtual HRESULT __stdcall abi_GetEndUserMessageManager(Windows::ApplicationModel::Chat::IRcsEndUserMessageManager ** result) = 0;
virtual HRESULT __stdcall abi_GetTransportsAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Chat::RcsTransport>> ** value) = 0;
virtual HRESULT __stdcall abi_GetTransportAsync(hstring transportId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Chat::RcsTransport> ** result) = 0;
virtual HRESULT __stdcall abi_LeaveConversationAsync(Windows::ApplicationModel::Chat::IChatConversation * conversation, Windows::Foundation::IAsyncAction ** value) = 0;
};
struct __declspec(uuid("f47ea244-e783-4866-b3a7-4e5ccf023070")) __declspec(novtable) IRcsServiceKindSupportedChangedEventArgs : Windows::IInspectable
{
virtual HRESULT __stdcall get_ServiceKind(winrt::Windows::ApplicationModel::Chat::RcsServiceKind * result) = 0;
};
struct __declspec(uuid("fea34759-f37c-4319-8546-ec84d21d30ff")) __declspec(novtable) IRcsTransport : Windows::IInspectable
{
virtual HRESULT __stdcall get_ExtendedProperties(Windows::Foundation::Collections::IMapView<hstring, Windows::IInspectable> ** value) = 0;
virtual HRESULT __stdcall get_IsActive(bool * value) = 0;
virtual HRESULT __stdcall get_TransportFriendlyName(hstring * value) = 0;
virtual HRESULT __stdcall get_TransportId(hstring * value) = 0;
virtual HRESULT __stdcall get_Configuration(Windows::ApplicationModel::Chat::IRcsTransportConfiguration ** result) = 0;
virtual HRESULT __stdcall abi_IsStoreAndForwardEnabled(winrt::Windows::ApplicationModel::Chat::RcsServiceKind serviceKind, bool * result) = 0;
virtual HRESULT __stdcall abi_IsServiceKindSupported(winrt::Windows::ApplicationModel::Chat::RcsServiceKind serviceKind, bool * result) = 0;
virtual HRESULT __stdcall add_ServiceKindSupportedChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Chat::RcsTransport, Windows::ApplicationModel::Chat::RcsServiceKindSupportedChangedEventArgs> * handler, event_token * token) = 0;
virtual HRESULT __stdcall remove_ServiceKindSupportedChanged(event_token token) = 0;
};
struct __declspec(uuid("1fccb102-2472-4bb9-9988-c1211c83e8a9")) __declspec(novtable) IRcsTransportConfiguration : Windows::IInspectable
{
virtual HRESULT __stdcall get_MaxAttachmentCount(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxMessageSizeInKilobytes(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxGroupMessageSizeInKilobytes(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxRecipientCount(int32_t * result) = 0;
virtual HRESULT __stdcall get_MaxFileSizeInKilobytes(int32_t * result) = 0;
virtual HRESULT __stdcall get_WarningFileSizeInKilobytes(int32_t * result) = 0;
};
struct __declspec(uuid("1ec045a7-cfc9-45c9-9876-449f2bc180f5")) __declspec(novtable) IRemoteParticipantComposingChangedEventArgs : Windows::IInspectable
{
virtual HRESULT __stdcall get_TransportId(hstring * result) = 0;
virtual HRESULT __stdcall get_ParticipantAddress(hstring * result) = 0;
virtual HRESULT __stdcall get_IsComposing(bool * result) = 0;
};
}
namespace ABI {
template <> struct traits<Windows::ApplicationModel::Chat::ChatCapabilities> { using default_interface = Windows::ApplicationModel::Chat::IChatCapabilities; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversation> { using default_interface = Windows::ApplicationModel::Chat::IChatConversation; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversationReader> { using default_interface = Windows::ApplicationModel::Chat::IChatConversationReader; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversationThreadingInfo> { using default_interface = Windows::ApplicationModel::Chat::IChatConversationThreadingInfo; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessage> { using default_interface = Windows::ApplicationModel::Chat::IChatMessage; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageAttachment> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageAttachment; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChange> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageChange; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangeReader> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageChangeReader; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangeTracker> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageChangeTracker; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangedDeferral> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageChangedDeferral; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangedEventArgs> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageChangedEventArgs; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageNotificationTriggerDetails> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageNotificationTriggerDetails; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageReader> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageReader; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageStore> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageStore; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageStoreChangedEventArgs> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageStoreChangedEventArgs; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageTransport> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageTransport; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageTransportConfiguration> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageTransportConfiguration; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageValidationResult> { using default_interface = Windows::ApplicationModel::Chat::IChatMessageValidationResult; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatQueryOptions> { using default_interface = Windows::ApplicationModel::Chat::IChatQueryOptions; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatRecipientDeliveryInfo> { using default_interface = Windows::ApplicationModel::Chat::IChatRecipientDeliveryInfo; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatSearchReader> { using default_interface = Windows::ApplicationModel::Chat::IChatSearchReader; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatSyncConfiguration> { using default_interface = Windows::ApplicationModel::Chat::IChatSyncConfiguration; };
template <> struct traits<Windows::ApplicationModel::Chat::ChatSyncManager> { using default_interface = Windows::ApplicationModel::Chat::IChatSyncManager; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessage> { using default_interface = Windows::ApplicationModel::Chat::IRcsEndUserMessage; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAction> { using default_interface = Windows::ApplicationModel::Chat::IRcsEndUserMessageAction; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableEventArgs> { using default_interface = Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableEventArgs; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableTriggerDetails> { using default_interface = Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableTriggerDetails; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageManager> { using default_interface = Windows::ApplicationModel::Chat::IRcsEndUserMessageManager; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsServiceKindSupportedChangedEventArgs> { using default_interface = Windows::ApplicationModel::Chat::IRcsServiceKindSupportedChangedEventArgs; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsTransport> { using default_interface = Windows::ApplicationModel::Chat::IRcsTransport; };
template <> struct traits<Windows::ApplicationModel::Chat::RcsTransportConfiguration> { using default_interface = Windows::ApplicationModel::Chat::IRcsTransportConfiguration; };
template <> struct traits<Windows::ApplicationModel::Chat::RemoteParticipantComposingChangedEventArgs> { using default_interface = Windows::ApplicationModel::Chat::IRemoteParticipantComposingChangedEventArgs; };
}
namespace Windows::ApplicationModel::Chat {
template <typename T> struct impl_IChatCapabilities;
template <typename T> struct impl_IChatCapabilitiesManagerStatics;
template <typename T> struct impl_IChatConversation;
template <typename T> struct impl_IChatConversation2;
template <typename T> struct impl_IChatConversationReader;
template <typename T> struct impl_IChatConversationThreadingInfo;
template <typename T> struct impl_IChatItem;
template <typename T> struct impl_IChatMessage;
template <typename T> struct impl_IChatMessage2;
template <typename T> struct impl_IChatMessage3;
template <typename T> struct impl_IChatMessage4;
template <typename T> struct impl_IChatMessageAttachment;
template <typename T> struct impl_IChatMessageAttachment2;
template <typename T> struct impl_IChatMessageAttachmentFactory;
template <typename T> struct impl_IChatMessageBlockingStatic;
template <typename T> struct impl_IChatMessageChange;
template <typename T> struct impl_IChatMessageChangeReader;
template <typename T> struct impl_IChatMessageChangeTracker;
template <typename T> struct impl_IChatMessageChangedDeferral;
template <typename T> struct impl_IChatMessageChangedEventArgs;
template <typename T> struct impl_IChatMessageManager2Statics;
template <typename T> struct impl_IChatMessageManagerStatic;
template <typename T> struct impl_IChatMessageManagerStatics3;
template <typename T> struct impl_IChatMessageNotificationTriggerDetails;
template <typename T> struct impl_IChatMessageNotificationTriggerDetails2;
template <typename T> struct impl_IChatMessageReader;
template <typename T> struct impl_IChatMessageReader2;
template <typename T> struct impl_IChatMessageStore;
template <typename T> struct impl_IChatMessageStore2;
template <typename T> struct impl_IChatMessageStore3;
template <typename T> struct impl_IChatMessageStoreChangedEventArgs;
template <typename T> struct impl_IChatMessageTransport;
template <typename T> struct impl_IChatMessageTransport2;
template <typename T> struct impl_IChatMessageTransportConfiguration;
template <typename T> struct impl_IChatMessageValidationResult;
template <typename T> struct impl_IChatQueryOptions;
template <typename T> struct impl_IChatRecipientDeliveryInfo;
template <typename T> struct impl_IChatSearchReader;
template <typename T> struct impl_IChatSyncConfiguration;
template <typename T> struct impl_IChatSyncManager;
template <typename T> struct impl_IRcsEndUserMessage;
template <typename T> struct impl_IRcsEndUserMessageAction;
template <typename T> struct impl_IRcsEndUserMessageAvailableEventArgs;
template <typename T> struct impl_IRcsEndUserMessageAvailableTriggerDetails;
template <typename T> struct impl_IRcsEndUserMessageManager;
template <typename T> struct impl_IRcsManagerStatics;
template <typename T> struct impl_IRcsServiceKindSupportedChangedEventArgs;
template <typename T> struct impl_IRcsTransport;
template <typename T> struct impl_IRcsTransportConfiguration;
template <typename T> struct impl_IRemoteParticipantComposingChangedEventArgs;
}
namespace impl {
template <> struct traits<Windows::ApplicationModel::Chat::IChatCapabilities>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatCapabilities;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatCapabilities<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatCapabilitiesManagerStatics>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatCapabilitiesManagerStatics;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatCapabilitiesManagerStatics<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatConversation>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatConversation;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatConversation<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatConversation2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatConversation2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatConversation2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatConversationReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatConversationReader;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatConversationReader<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatConversationThreadingInfo>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatConversationThreadingInfo;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatConversationThreadingInfo<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatItem>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatItem;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatItem<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessage>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessage;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessage<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessage2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessage2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessage2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessage3>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessage3;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessage3<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessage4>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessage4;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessage4<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageAttachment>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageAttachment;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageAttachment<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageAttachment2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageAttachment2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageAttachment2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageAttachmentFactory>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageAttachmentFactory;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageAttachmentFactory<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageBlockingStatic>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageBlockingStatic;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageBlockingStatic<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageChange>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageChange;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageChange<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageChangeReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageChangeReader;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageChangeReader<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageChangeTracker>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageChangeTracker;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageChangeTracker<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageChangedDeferral>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageChangedDeferral;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageChangedDeferral<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageChangedEventArgs;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageChangedEventArgs<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageManager2Statics>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageManager2Statics;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageManager2Statics<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageManagerStatic>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageManagerStatic;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageManagerStatic<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageManagerStatics3>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageManagerStatics3;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageManagerStatics3<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageNotificationTriggerDetails>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageNotificationTriggerDetails;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageNotificationTriggerDetails<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageNotificationTriggerDetails2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageNotificationTriggerDetails2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageNotificationTriggerDetails2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageReader;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageReader<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageReader2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageReader2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageReader2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageStore>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageStore;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageStore<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageStore2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageStore2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageStore2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageStore3>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageStore3;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageStore3<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageStoreChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageStoreChangedEventArgs;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageStoreChangedEventArgs<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageTransport>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageTransport;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageTransport<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageTransport2>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageTransport2;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageTransport2<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageTransportConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageTransportConfiguration;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageTransportConfiguration<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatMessageValidationResult>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatMessageValidationResult;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatMessageValidationResult<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatQueryOptions>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatQueryOptions;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatQueryOptions<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatRecipientDeliveryInfo>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatRecipientDeliveryInfo;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatRecipientDeliveryInfo<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatSearchReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatSearchReader;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatSearchReader<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatSyncConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatSyncConfiguration;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatSyncConfiguration<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IChatSyncManager>
{
using abi = ABI::Windows::ApplicationModel::Chat::IChatSyncManager;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IChatSyncManager<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsEndUserMessage>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsEndUserMessage;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsEndUserMessage<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsEndUserMessageAction>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsEndUserMessageAction;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsEndUserMessageAction<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableEventArgs;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsEndUserMessageAvailableEventArgs<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableTriggerDetails>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsEndUserMessageAvailableTriggerDetails;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsEndUserMessageAvailableTriggerDetails<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsEndUserMessageManager>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsEndUserMessageManager;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsEndUserMessageManager<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsManagerStatics>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsManagerStatics;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsManagerStatics<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsServiceKindSupportedChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsServiceKindSupportedChangedEventArgs;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsServiceKindSupportedChangedEventArgs<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsTransport>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsTransport;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsTransport<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRcsTransportConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRcsTransportConfiguration;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRcsTransportConfiguration<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::IRemoteParticipantComposingChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::IRemoteParticipantComposingChangedEventArgs;
template <typename D> using consume = Windows::ApplicationModel::Chat::impl_IRemoteParticipantComposingChangedEventArgs<D>;
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatCapabilities>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatCapabilities;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatCapabilities"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatCapabilitiesManager>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatCapabilitiesManager"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversation>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatConversation;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatConversation"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversationReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatConversationReader;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatConversationReader"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatConversationThreadingInfo>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatConversationThreadingInfo;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatConversationThreadingInfo"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessage>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessage;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessage"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageAttachment>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageAttachment;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageAttachment"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageBlocking>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageBlocking"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChange>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageChange;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageChange"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangeReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageChangeReader;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageChangeReader"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangeTracker>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageChangeTracker;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageChangeTracker"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangedDeferral>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageChangedDeferral;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageChangedDeferral"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageChangedEventArgs;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageChangedEventArgs"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageManager>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageManager"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageNotificationTriggerDetails>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageNotificationTriggerDetails;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageNotificationTriggerDetails"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageReader;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageReader"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageStore>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageStore;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageStore"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageStoreChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageStoreChangedEventArgs;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageStoreChangedEventArgs"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageTransport>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageTransport;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageTransport"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageTransportConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageTransportConfiguration;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageTransportConfiguration"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatMessageValidationResult>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatMessageValidationResult;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatMessageValidationResult"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatQueryOptions>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatQueryOptions;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatQueryOptions"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatRecipientDeliveryInfo>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatRecipientDeliveryInfo;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatRecipientDeliveryInfo"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatSearchReader>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatSearchReader;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatSearchReader"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatSyncConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatSyncConfiguration;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatSyncConfiguration"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::ChatSyncManager>
{
using abi = ABI::Windows::ApplicationModel::Chat::ChatSyncManager;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.ChatSyncManager"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessage>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsEndUserMessage;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsEndUserMessage"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAction>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsEndUserMessageAction;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsEndUserMessageAction"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableEventArgs;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsEndUserMessageAvailableEventArgs"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableTriggerDetails>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsEndUserMessageAvailableTriggerDetails;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsEndUserMessageAvailableTriggerDetails"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsEndUserMessageManager>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsEndUserMessageManager;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsEndUserMessageManager"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsManager>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsManager"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsServiceKindSupportedChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsServiceKindSupportedChangedEventArgs;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsServiceKindSupportedChangedEventArgs"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsTransport>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsTransport;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsTransport"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RcsTransportConfiguration>
{
using abi = ABI::Windows::ApplicationModel::Chat::RcsTransportConfiguration;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RcsTransportConfiguration"; }
};
template <> struct traits<Windows::ApplicationModel::Chat::RemoteParticipantComposingChangedEventArgs>
{
using abi = ABI::Windows::ApplicationModel::Chat::RemoteParticipantComposingChangedEventArgs;
static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Chat.RemoteParticipantComposingChangedEventArgs"; }
};
}
}
| 62.582006 | 271 | 0.796451 |
4c4f0f36037f74d23f05854bee11f5192fa55597 | 6,101 | h | C | src/emu/emumem_hedw.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | 26 | 2015-03-31T06:25:51.000Z | 2021-12-14T09:29:04.000Z | src/emu/emumem_hedw.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | null | null | null | src/emu/emumem_hedw.h | Robbbert/messui | 49b756e2140d8831bc81335298ee8c5471045e79 | [
"BSD-3-Clause"
] | 10 | 2015-03-27T05:45:51.000Z | 2022-02-04T06:57:36.000Z | // license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_EMU_EMUMEM_HEDW_H
#define MAME_EMU_EMUMEM_HEDW_H
#pragma once
// handler_entry_write_dispatch
// dispatches an access among multiple handlers indexed on part of the
// address and when appropriate a selected view
template<int HighBits, int Width, int AddrShift> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using mapping = typename handler_entry_write<Width, AddrShift>::mapping;
handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift> *handler);
handler_entry_write_dispatch(address_space *space, memory_view &view);
handler_entry_write_dispatch(handler_entry_write_dispatch<HighBits, Width, AddrShift> *src);
~handler_entry_write_dispatch();
void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift> *&handler) const override;
offs_t dispatch_entry(offs_t address) const override;
void dump_map(std::vector<memory_entry> &map) const override;
std::string name() const override;
void populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift> *handler) override;
void populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift> *handler) override;
void populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift> &descriptor, u8 rkey, std::vector<mapping> &mappings) override;
void populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift> &descriptor, std::vector<mapping> &mappings) override;
void populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift> *handler, std::vector<mapping> &mappings) override;
void populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift> *handler, std::vector<mapping> &mappings) override;
void detach(const std::unordered_set<handler_entry *> &handlers) override;
void range_cut_before(offs_t address, int start = COUNT);
void range_cut_after(offs_t address, int start = -1);
void enumerate_references(handler_entry::reflist &refs) const override;
const handler_entry_write<Width, AddrShift> *const *get_dispatch() const override;
void select_a(int slot) override;
void select_u(int slot) override;
void init_handlers(offs_t start_entry, offs_t end_entry, u32 lowbits, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift> **dispatch, handler_entry::range *ranges) override;
handler_entry_write<Width, AddrShift> *dup() override;
private:
static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_lowbits(HighBits, Width, AddrShift);
static constexpr u32 BITCOUNT = HighBits > LowBits ? HighBits - LowBits : 0;
static constexpr u32 COUNT = 1 << BITCOUNT;
static constexpr offs_t BITMASK = make_bitmask<offs_t>(BITCOUNT);
static constexpr offs_t LOWMASK = make_bitmask<offs_t>(LowBits);
static constexpr offs_t HIGHMASK = make_bitmask<offs_t>(HighBits) ^ LOWMASK;
static constexpr offs_t UPMASK = ~make_bitmask<offs_t>(HighBits);
class handler_array : public std::array<handler_entry_write<Width, AddrShift> *, COUNT>
{
public:
using std::array<handler_entry_write<Width, AddrShift> *, COUNT>::array;
handler_array()
{
std::fill(this->begin(), this->end(), nullptr);
}
};
class range_array : public std::array<handler_entry::range, COUNT>
{
public:
using std::array<handler_entry::range, COUNT>::array;
range_array()
{
std::fill(this->begin(), this->end(), handler_entry::range{ 0, 0 });
}
};
memory_view *m_view;
std::vector<handler_array> m_dispatch_array;
std::vector<range_array> m_ranges_array;
handler_entry_write<Width, AddrShift> **m_a_dispatch;
handler_entry::range *m_a_ranges;
handler_entry_write<Width, AddrShift> **m_u_dispatch;
handler_entry::range *m_u_ranges;
void populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift> *handler);
void populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift> *handler);
void populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift> &descriptor, u8 rkey, std::vector<mapping> &mappings);
void populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift> &descriptor, std::vector<mapping> &mappings);
void mismatched_patch(const memory_units_descriptor<Width, AddrShift> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift> *&target);
void populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift> *handler, std::vector<mapping> &mappings);
void populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift> *handler, std::vector<mapping> &mappings);
void passthrough_patch(handler_entry_write_passthrough<Width, AddrShift> *handler, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift> *&target);
};
#endif // MAME_EMU_EMUMEM_HEDW_H
| 57.556604 | 221 | 0.794296 |
f8f512669625b0395f860cd673f133cb72525a94 | 12,488 | h | C | osprey/ipa/common/ip_graph.h | sharugupta/OpenUH | daddd76858a53035f5d713f648d13373c22506e8 | [
"BSD-2-Clause"
] | null | null | null | osprey/ipa/common/ip_graph.h | sharugupta/OpenUH | daddd76858a53035f5d713f648d13373c22506e8 | [
"BSD-2-Clause"
] | null | null | null | osprey/ipa/common/ip_graph.h | sharugupta/OpenUH | daddd76858a53035f5d713f648d13373c22506e8 | [
"BSD-2-Clause"
] | null | null | null | /*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston MA 02111-1307, USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* -*-Mode: c++;-*- (Tell emacs to use c++ mode) */
/* ====================================================================
* ====================================================================
*
* Module: ip_graph.h
* Author: Seema Hiranandani
*
* $Revision: 1.1.1.1 $
* $Date: 2005/10/21 19:00:00 $
* $Author: marcel $
* $Source: /proj/osprey/CVS/open64/osprey1.0/ipa/common/ip_graph.h,v $
*
* Revision history:
* 19-Aug-95 - Original Version
*
* Description:
*
* This module contains data structures for a graph abstraction.
* This graph is used to construct, for instance, a call graph.
*
* ====================================================================
* ====================================================================
*/
#ifndef ip_graph_INCLUDED
#define ip_graph_INCLUDED
#ifndef mempool_INCLUDED
#include "mempool.h"
#endif
/* ====================================================================
*
* VERTEX / EDGE / GRAPH : Directed graph implementation
*
* A GRAPH is a set of VERTEX objects, connected by a set of EDGE
* objects. These sets are implemented as a vector of VERTEXes and a
* vector of EDGEs, with all references being indices into these
* vectors. The sets are allowed to grow (by adding VERTEXes or EDGEs)
* or to shrink (by deleting them). Growth may cause reallocation of
* the vector. To minimize reallocation cost, it is done in larger
* chunks than necessary. To avoid rearrangement of the data upon
* deletion, the deleted VERTEX/EDGE is simply marked invalid.
*
* ====================================================================
*/
/* EDGE/VERTEX index types, and reserved index values: */
typedef mINT32 NODE_INDEX;
typedef mINT32 EDGE_INDEX;
#define INVALID_NODE_INDEX -1
#define INVALID_EDGE_INDEX -1
/* ====================================================================
*
* A VERTEX contains two singly-linked lists of EDGEs, one of EDGEs
* starting at that VERTEX, and one of EDGEs ending at that VERTEX.
* Each list is represented in the VERTEX by the index of its first
* element (NODE_from and NODE_to) and a count of its elements
* (NODE_fcnt and NODE_tcnt). An invalid (i.e. unused) VERTEX is
* indicated by NODE_fcnt == INVALID_EDGE_INDEX. The VERTEX also
* contains a pointer NODE_user to additional data required by the
* client derived graph. The level of a vertex is defined as the (max level
* of the immediate successors of the vertex) + 1
* ====================================================================
*/
template <class T>
struct NODE
{
typedef T USER_TYPE;
USER_TYPE user; /* user information */
EDGE_INDEX from, to; /* first edge from and to this vertex */
EDGE_INDEX fcnt, tcnt;/* from/to counts */
INT32 level; /* level of the vertex */
};
/* Field access macros: */
#define NODE_user(vertex) ((vertex)->user)
#define NODE_from(vertex) ((vertex)->from)
#define NODE_to(vertex) ((vertex)->to)
#define NODE_fcnt(vertex) ((vertex)->fcnt)
#define NODE_tcnt(vertex) ((vertex)->tcnt)
#define NODE_level(vertex) ((vertex)->level)
/* ====================================================================
*
* A EDGE contains two VERTEXes, its from VERTEX (EDGE_from) and its
* to vertex (EDGE_to). It contains links (indices) to the next edges
* in the NODE_from list for its from VERTEX (EDGE_nfrom), and in the
* NODE_to list for its to VERTEX (EDGE_nto). It contains a flag
* word containing attributes, and a pointer EDGE_user to additional
* data required by the client derived graph.
*
* ====================================================================
*/
/* EDGE data structure: */
template <class T>
struct EDGE
{
typedef T USER_TYPE;
typedef mUINT8 ETYPEX;
USER_TYPE user; /* user information */
NODE_INDEX from, to; /* from and to vertices */
EDGE_INDEX nfrom; /* next edge from the from vertex */
EDGE_INDEX nto; /* next edge to the to vertex */
ETYPEX etype; /* edge type, i.e. is it a back edge resulting */
/* in a cycle: used to locate recursion */
};
/* Field access macros: */
#define EDGE_user(edge) ((edge)->user)
#define EDGE_from(edge) ((edge)->from)
#define EDGE_to(edge) ((edge)->to)
#define EDGE_nfrom(edge) ((edge)->nfrom)
#define EDGE_nto(edge) ((edge)->nto)
#define EDGE_etype(edge) ((edge)->etype)
/* Flag access: */
#define EDGE_RECURSIVE 1
#define Set_EDGE_recursive(edge) (EDGE_etype(edge) |= EDGE_RECURSIVE)
#define EDGE_recursive(edge) (EDGE_etype(edge) & EDGE_RECURSIVE)
/* ====================================================================
*
* A GRAPH is the top-level directed graph data structure. For both
* vertices and edges, it contains the number of VERTEX/EDGE structures
* actually allocated (GRAPH_vmax, GRAPH_emax), the number of actual
* VERTEX/EDGE components of the graph (GRAPH_vcnt, GRAPH_ecnt), the
* number of free VERTEX/EDGE structures that are allocated and
* available for use (GRAPH_vfree, GRAPH_efree), and the vector of
* NODE_EDGE components (GRAPH_v, GRAPH_e). It also contains the
* root of the graph (GRAPH_root) and the memory pool to use for
* allocation (GRAPH_m).
*
* ====================================================================
*/
struct GRAPH
{
typedef NODE<void*> NODE_TYPE;
typedef EDGE<void*> EDGE_TYPE;
NODE_INDEX vcnt; /* NODE count */
NODE_INDEX vmax; /* max vertices */
NODE_INDEX vfree; /* number of free vertices */
EDGE_INDEX ecnt; /* edge count */
EDGE_INDEX emax; /* max edges */
EDGE_INDEX efree; /* number of free edges */
NODE_INDEX root; /* root of the graph */
NODE_TYPE* v; /* list of vertices */
EDGE_TYPE* e; /* list of edges */
MEM_POOL *m; /* mem pool */
GRAPH (MEM_POOL *pool) :
vcnt(0), vmax(0), vfree(-1),
ecnt(0), emax(0), efree(-1),
root(INVALID_NODE_INDEX), v(0), e(0), m(pool)
{}
GRAPH (NODE_INDEX num_nodes, EDGE_INDEX num_edges, MEM_POOL* pool) :
vcnt(0), vmax(num_nodes), vfree(0),
ecnt(0), emax(num_edges), efree(0),
root(INVALID_NODE_INDEX), m(pool)
{
Build();
}
void Build ();
void Grow_Node_Array ();
void Grow_Edge_Array ();
NODE_INDEX Add_Node (void*);
EDGE_INDEX Add_Edge (NODE_INDEX, NODE_INDEX, void*);
void* Delete_Node (NODE_INDEX);
void Delete_Edge (EDGE_INDEX);
BOOL Is_Node (NODE_INDEX node_index) const
{
return (node_index < vmax &&
NODE_fcnt(&v[node_index]) != INVALID_NODE_INDEX);
}
INT32 Num_Preds (NODE_INDEX node_index) const
{
return NODE_tcnt(&v[node_index]);
}
INT32 Num_Succs (NODE_INDEX node_index) const
{
return NODE_fcnt(&v[node_index]);
}
BOOL Is_Recursive_Edge (EDGE_INDEX edge_index) const
{
return EDGE_recursive(&e[edge_index]);
}
void Set_Edge_User (EDGE_INDEX edge_index, void *user)
{
EDGE_user(&e[edge_index]) = user;
}
void Set_Node_Level (NODE_INDEX idx, INT32 level)
{
NODE_level(&v[idx]) = level;
}
INT32 Node_Level (NODE_INDEX idx) const
{
return NODE_level(&v[idx]);
}
NODE_TYPE *Nodes () const { return v; }
EDGE_TYPE *Edges () const { return e; }
};
template <class NODE_USER, class EDGE_USER>
struct GRAPH_TEMPLATE : public GRAPH
{
typedef NODE<NODE_USER> NODE_TYPE;
typedef EDGE<EDGE_USER> EDGE_TYPE;
GRAPH_TEMPLATE (MEM_POOL *p) : GRAPH (p) {}
NODE_TYPE *Nodes () const { return (NODE_TYPE *) v; }
EDGE_TYPE *Edges () const { return (EDGE_TYPE *) e; }
NODE_USER Node_User (NODE_INDEX node_index) const
{
FmtAssert(node_index != INVALID_NODE_INDEX, ("invalid node_index"));
return NODE_user(&(Nodes()[node_index]));
}
EDGE_USER Edge_User (EDGE_INDEX edge_index) const
{
FmtAssert(edge_index != INVALID_EDGE_INDEX, ("invalid edge_index"));
return EDGE_user(&(Edges()[edge_index]));
}
};
/* Field access macros: */
#define GRAPH_vcnt(g) ((g)->vcnt)
#define GRAPH_vmax(g) ((g)->vmax)
#define GRAPH_vfree(g) ((g)->vfree)
#define GRAPH_ecnt(g) ((g)->ecnt)
#define GRAPH_emax(g) ((g)->emax)
#define GRAPH_efree(g) ((g)->efree)
#define GRAPH_root(g) ((g)->root)
#define GRAPH_m(g) ((g)->m)
#define GRAPH_v(g) ((g)->Nodes())
#define GRAPH_v_i(g,index) ((g)->Nodes()[index])
#define GRAPH_e(g) ((g)->Edges())
#define GRAPH_e_i(g,index) ((g)->Edges()[index])
/* Walk all the valid vertices in the graph g, using NODE_INDEX v: */
#define FOR_EACH_NODE(g,v) \
for ( v = 0; v < GRAPH_vmax(g); v++ ) \
if ( NODE_fcnt (&GRAPH_v_i(g,v)) != INVALID_NODE_INDEX )
/* ====================================================================
*
* NODE_ITER: Vertex iterator control struct
*
* This struct is used to control an iterator over vertices.
*
* ====================================================================
*/
class NODE_ITER
{
private:
GRAPH *g; /* the graph */
NODE_INDEX c_v; /* the current vertex */
EDGE_INDEX from_e; /* from edge */
EDGE_INDEX to_e; /* to edge */
EDGE_INDEX fcnt; /* from count */
EDGE_INDEX nfrom; /* next from edge */
EDGE_INDEX tcnt; /* to count */
EDGE_INDEX nto; /* next to edges */
EDGE_INDEX c_e; /* current edge */
public:
NODE_ITER (GRAPH* graph, NODE_INDEX node_index) :
g (graph),
c_v (node_index),
from_e (NODE_from(&(GRAPH_v(graph)[node_index]))),
to_e (NODE_to(&(GRAPH_v(graph)[node_index]))),
fcnt (NODE_fcnt(&(GRAPH_v(graph)[node_index]))),
nfrom (-1),
tcnt (NODE_tcnt(&(GRAPH_v(graph)[node_index]))),
nto (-1),
c_e (INVALID_EDGE_INDEX)
{}
NODE_INDEX First_Pred ();
NODE_INDEX Next_Pred ();
NODE_INDEX First_Succ ();
NODE_INDEX Next_Succ ();
EDGE_INDEX Current_Edge_Index() const { return c_e; }
};
/* ====================================================================
*
* DFN: Depth-first numbering graph traversal control struct
*
* This struct is used to store an ordering of the nodes in a graph, to
* control traversal in a particular order. It contains a vector of
* the graph vertices in the traversal order (DFN_v_list), and the
* indices of the first useful index in the vector (GRAV_first) and of
* the index after the last useful index in the vector (DFN_end).
*
* ====================================================================
*/
struct DFN {
INT32 first;
INT32 end;
NODE_INDEX* v_list;
};
/* Field access macros: */
#define DFN_first(d) ((d)->first)
#define DFN_end(d) ((d)->end)
#define DFN_v_list(d) ((d)->v_list)
#define DFN_v_list_i(d,i) ((d)->v_list[i])
/* Trace a DFN ordering: */
extern void Print_DFN ( const FILE *, DFN * );
/* Construct a depth-first numbering of the given graph: */
extern DFN* Depth_First_Ordering ( GRAPH*, MEM_POOL * );
/* De-allocate a DFN ordering: */
extern void Free_DFN ( DFN *, MEM_POOL * );
#endif /* ip_graph_INCLUDED */
| 32.102828 | 75 | 0.606102 |
b67ec2221b463f1c07c9360c2cbd2e94ddc1e87c | 505 | c | C | mul.c | Fumenoid/C-programing | 185928ff04d2db8eac915d86c86a30488ca5991f | [
"MIT"
] | null | null | null | mul.c | Fumenoid/C-programing | 185928ff04d2db8eac915d86c86a30488ca5991f | [
"MIT"
] | null | null | null | mul.c | Fumenoid/C-programing | 185928ff04d2db8eac915d86c86a30488ca5991f | [
"MIT"
] | null | null | null | #include<stdio.h>
int a, b, x;
int m=0;
void main()
{
printf("Enter the two numbers to be multipied \n");
scanf("%d%d", &a, &b);
if((a>=0)&&(b>=0))
{
for(x=1;x<=b;x++)
{
m=m+a;
}
printf("Multiplificaton =%d \n", m);
}
else if(a>=0)
{
b=(b*-1);
for(x=1;x<=b;x++)
{
m=m+a;
}
printf("Multiplificaton =-%d \n", m);
}
else if(b>=0)
{
a=(a*-1);
for(x=1;x<=b;x++)
{
m=m+a;
}
printf("Multiplificaton =-%d \n", m);
}
else
{
b=(b*-1);
a=(a*-1);
for(x=1;x<=b;x++)
{
m=m+a;
}
printf("Multiplificaton =%d \n", m);
}
}
| 11.222222 | 51 | 0.508911 |
611f9279f8ca858a046a00568ba4497f3a3f3878 | 317 | h | C | usr/sys/bcm283x/dev/bcm283x_mbox.h | r1mikey/research-unix-v7 | 8b0bf75e2f5cf013ff7f236c4589711cbc3a12ff | [
"MIT"
] | 43 | 2020-02-12T08:14:49.000Z | 2022-03-30T19:25:52.000Z | usr/sys/bcm283x/dev/bcm283x_mbox.h | r1mikey/research-unix-v7 | 8b0bf75e2f5cf013ff7f236c4589711cbc3a12ff | [
"MIT"
] | null | null | null | usr/sys/bcm283x/dev/bcm283x_mbox.h | r1mikey/research-unix-v7 | 8b0bf75e2f5cf013ff7f236c4589711cbc3a12ff | [
"MIT"
] | 6 | 2020-02-13T12:56:27.000Z | 2022-02-11T20:59:46.000Z | #ifndef BCM283X_MBOX_H
#define BCM283X_MBOX_H
#include "../kstddef.h"
#include "../../h/types.h"
extern int bcm283x_mbox_get_arm_memory(u32 *v);
extern int bcm283x_mbox_set_uart_clock(u32 hz, u32 *new_hz);
extern int bcm283x_mbox_get_sdcard_clock(u32 *hz);
extern int bcm283x_mbox_sdcard_power(u32 onoff);
#endif
| 22.642857 | 60 | 0.785489 |
9fcd523852aadab1b2cd77f18bbc0912bd636179 | 436 | h | C | src/kem/ntruprime/pqclean_sntrup653_clean/crypto_decode_653xint16.h | codekat1/liboqs | 905ffff58409cf84ff55ccb416aac3508dd4ab3b | [
"MIT"
] | 997 | 2016-08-13T14:14:56.000Z | 2022-03-29T15:22:30.000Z | src/kem/ntruprime/pqclean_sntrup653_clean/crypto_decode_653xint16.h | codekat1/liboqs | 905ffff58409cf84ff55ccb416aac3508dd4ab3b | [
"MIT"
] | 816 | 2016-08-14T20:22:14.000Z | 2022-03-22T14:13:09.000Z | src/kem/ntruprime/pqclean_sntrup653_clean/crypto_decode_653xint16.h | codekat1/liboqs | 905ffff58409cf84ff55ccb416aac3508dd4ab3b | [
"MIT"
] | 310 | 2016-08-17T16:16:53.000Z | 2022-03-25T19:46:30.000Z | #ifndef PQCLEAN_SNTRUP653_CLEAN_CRYPTO_DECODE_653XINT16_H
#define PQCLEAN_SNTRUP653_CLEAN_CRYPTO_DECODE_653XINT16_H
#include <stdint.h>
#define PQCLEAN_SNTRUP653_CLEAN_crypto_decode_653xint16_STRBYTES 1306
#define PQCLEAN_SNTRUP653_CLEAN_crypto_decode_653xint16_ITEMS 653
#define PQCLEAN_SNTRUP653_CLEAN_crypto_decode_653xint16_ITEMBYTES 2
void PQCLEAN_SNTRUP653_CLEAN_crypto_decode_653xint16(void *v, const unsigned char *s);
#endif
| 39.636364 | 86 | 0.905963 |
667732c2e37e3415596a891bd2eabb724725ccdc | 1,734 | h | C | source/pcemu/src/plat-joystick.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pcemu/src/plat-joystick.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pcemu/src/plat-joystick.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | #ifdef __cplusplus
extern "C" {
#endif
void joystick_init();
void joystick_close();
void joystick_poll();
typedef struct plat_joystick_t
{
char name[64];
int a[8];
int b[32];
int p[4];
struct
{
char name[32];
int id;
} axis[8];
struct
{
char name[32];
int id;
} button[32];
struct
{
char name[32];
int id;
} pov[4];
int nr_axes;
int nr_buttons;
int nr_povs;
} plat_joystick_t;
#define MAX_PLAT_JOYSTICKS 8
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern int joysticks_present;
#define POV_X 0x80000000
#define POV_Y 0x40000000
typedef struct joystick_t
{
int axis[8];
int button[32];
int pov[4];
int plat_joystick_nr;
int axis_mapping[8];
int button_mapping[32];
int pov_mapping[4][2];
} joystick_t;
#define MAX_JOYSTICKS 4
extern joystick_t joystick_state[MAX_JOYSTICKS];
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
#ifdef __cplusplus
}
#endif
| 25.880597 | 78 | 0.392734 |
95b57258741141a95613ca21064aaa5e8e0a3291 | 1,348 | h | C | Lumos/src/Core/Typename.h | heitaoflower/Lumos | 9b7f75c656ab89e45489de357fb029591df3dfd9 | [
"MIT"
] | 1 | 2021-09-24T04:23:52.000Z | 2021-09-24T04:23:52.000Z | Lumos/src/Core/Typename.h | heitaoflower/Lumos | 9b7f75c656ab89e45489de357fb029591df3dfd9 | [
"MIT"
] | null | null | null | Lumos/src/Core/Typename.h | heitaoflower/Lumos | 9b7f75c656ab89e45489de357fb029591df3dfd9 | [
"MIT"
] | 1 | 2020-04-17T13:40:49.000Z | 2020-04-17T13:40:49.000Z | #pragma once
#include "lmpch.h"
#if defined(LUMOS_PLATFORM_WINDOWS)
namespace Lumos
{
template<typename T>
String GetTypename()
{
String delimiters = String(1, ' ');
size_t start = 0;
String string = typeid(T).name();
size_t end = string.find_first_of(delimiters);
std::vector<String> result;
while (end <= String::npos)
{
String token = string.substr(start, end - start);
if (!token.empty())
result.push_back(token);
if (end == String::npos)
break;
start = end + 1;
end = string.find_first_of(delimiters, start);
}
if (result.size() < 2)
{
LUMOS_LOG_WARN("Failed to GetTypename. Returning empty string!");
return "";
}
String name = "";
for (size_t i = 1; i < result.size(); i++)
{
name += result[i];
}
return name;
}
}
#define LUMOS_TYPENAME_STRING(T) GetTypename<T>()
#else
#include <cxxabi.h>
namespace Lumos
{
template<typename T>
std::string GetTypename()
{
int status;
char* realName = abi::__cxa_demangle(typeid(T).name(), 0, 0, &status);
String result = { realName };
free(realName);
return result;
}
}
#define LUMOS_TYPENAME_STRING(T) GetTypename<T>()
#endif
#define LUMOS_TYPENAME(T) typeid(T).hash_code()
| 19.823529 | 78 | 0.585312 |
bf49d2e2d04a31e5958285d35c68c84425823a40 | 2,363 | h | C | src/DSP/oscillators/base/Oscillator.h | nspotrepka/ofxPDSP | e106991f4abf4314116d4e7c4ef7ad69d6ca005f | [
"MIT"
] | 288 | 2016-02-06T18:50:47.000Z | 2022-03-21T12:54:30.000Z | src/DSP/oscillators/base/Oscillator.h | thomasgeissl/ofxPDSP | 9109a38f0dbc1de21cfa8ddc374a78f56a7649ac | [
"MIT"
] | 68 | 2016-03-09T15:12:48.000Z | 2021-11-29T14:05:49.000Z | src/DSP/oscillators/base/Oscillator.h | thomasgeissl/ofxPDSP | 9109a38f0dbc1de21cfa8ddc374a78f56a7649ac | [
"MIT"
] | 37 | 2016-02-11T20:36:28.000Z | 2022-01-23T17:31:22.000Z |
// Oscillator.h
// ofxPDSP
// Nicola Pisanti, MIT License, 2016
#ifndef PDSP_OSC_OSCILLATOR_H_INCLUDED
#define PDSP_OSC_OSCILLATOR_H_INCLUDED
#include "../../pdspCore.h"
namespace pdsp{
/*!
@brief Abstract class to implement oscillators
This is a abstract class to rapresent oscillators, with a phase input. You usually have just to implement the oscillate() method
*/
class Oscillator : public Unit{
public:
Oscillator();
/*!
@brief Sets "phase" as selected input and returns this Unit ready to be patched. This is the default input. You have to patch a "phase" output to this input, usuall taken from some kind of phazor like PMPhazor, LFOPhazor or ClockedPhazor
*/
Patchable& in_phase();
/*!
@brief Sets "signal" as selected output and returns this Unit ready to be patched. This is the default output. This is the oscillator waveform output.
*/
Patchable& out_signal();
/*!
@brief Returns the first value of the last processed output. Usually is more useful to track when the oscillator is running as LFO. This method is thread-safe.
*/
float meter_output() const;
protected:
/*!
@brief method to implement for preparing oscillator to play, overriding it is not mandatory
@param[in] sampleRate sample rate, already multiplied if the oscillator is oversampling
*/
virtual void prepareOscillator(double sampleRate);
/*!
@brief method to implement for cleaning up on resource release, overriding it is not mandatory
*/
virtual void releaseOscillator();
/*!
@brief the oscillator DSP method to implement
@param[out] outputBuffer buffer to fill with waveform output
@param[in] phaseBuffer buffer for the phase values
@param[in] bufferSize buffersize, already multipled if oversampling
*/
virtual void oscillate(float* outputBuffer, const float* phaseBuffer, int bufferSize) noexcept;
private:
void prepareUnit( int expectedBufferSize, double sampleRate) override;
void releaseResources() override;
void process(int bufferSize) noexcept override;
InputNode input_phase;
OutputNode output;
std::atomic<float> meter;
};
}
#endif // PDSP_OSC_OSCILLATOR_H_INCLUDED
| 29.911392 | 242 | 0.686839 |
451cb18b56ed08c449c15c87408617c9372c84d9 | 628 | h | C | Example/Pods/KFXAbstracts/KFXAbstracts/Classes/KFXViewController+MFMailComposer.h | ChristianFox/KFXCellularViewData | 81934831bb4fe27aa8dc1d4ea16dda902899af9e | [
"MIT"
] | null | null | null | Example/Pods/KFXAbstracts/KFXAbstracts/Classes/KFXViewController+MFMailComposer.h | ChristianFox/KFXCellularViewData | 81934831bb4fe27aa8dc1d4ea16dda902899af9e | [
"MIT"
] | null | null | null | Example/Pods/KFXAbstracts/KFXAbstracts/Classes/KFXViewController+MFMailComposer.h | ChristianFox/KFXCellularViewData | 81934831bb4fe27aa8dc1d4ea16dda902899af9e | [
"MIT"
] | null | null | null | /********************************
*
* Copyright © 2016-2017 Christian Fox
* All Rights Reserved
* Full licence details can be found in the file 'LICENSE' or in the Pods-{yourProjectName}-acknowledgements.markdown
*
* This file is included with KFXAbstracts
*
************************************/
#import "KFXViewController.h"
// Cocoa Frameworks
@import MessageUI;
@interface KFXViewController (MFMailComposer) <MFMailComposeViewControllerDelegate>
-(void)presentEmailComposerWithSubject:(NSString*)subject message:(NSString*)message messageIsHTML:(BOOL)isHTML receipients:(NSArray<NSString*>*)recipients;
@end
| 26.166667 | 156 | 0.69586 |
be25e0b7366b1ff7370a9cff6ccdca5b9201f1b9 | 10,172 | h | C | cccc/CParser.h | nachose/my_cccc | 249a6c03ce632e8c98ce522a3fb11a3e3d40b245 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | cccc/CParser.h | nachose/my_cccc | 249a6c03ce632e8c98ce522a3fb11a3e3d40b245 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | cccc/CParser.h | nachose/my_cccc | 249a6c03ce632e8c98ce522a3fb11a3e3d40b245 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | /*
* CParser: P a r s e r H e a d e r
*
* Generated from: cccc.g
*
* Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-1999
* Parr Research Corporation
* with Purdue University Electrical Engineering
* with AHPCRC, University of Minnesota
* ANTLR Version 1.33MR20
*/
#ifndef CParser_h
#define CParser_h
#ifndef ANTLR_VERSION
#define ANTLR_VERSION 13320
#endif
#ifndef zzTRACE_RULES
#define zzTRACE_RULES
#endif
#include "AParser.h"
#define zzTRACE_RULES
#include "AParser.h"
#include "cccc.h"
#include "cccc_utl.h"
#include "cccc_opt.h"
// the objects which PCCTS creates for ASTs as the #0 variable etc
// have type "pointer to ASTBase", which means they need to be cast
// to a pointer to my variant of AST if I want to call my AST
// methods on them
#define MY_AST(X) ( (AST*) X)
// we have a global variable member for the language of the parse so
// that we can supply the names of dialects (ansi_c, ansi_c++, mfc_c++ etc)
// for contexts where we wish to apply dialect-specific lexing or parsing
// rules
extern string parse_language;
class CParser : public ANTLRParser {
public:
static const ANTLRChar *tokenName(int tk);
protected:
static const ANTLRChar *_token_tbl[];
private:
ParseStore* ps;
ParseUtility* pu;
void tracein(const char *rulename) { pu->tracein(rulename,guessing,LT(1)); }
void traceout(const char *rulename) { pu->traceout(rulename,guessing,LT(1)); }
void syn(
_ANTLRTokenPtr tok, ANTLRChar *egroup, SetWordType *eset,
ANTLRTokenType etok, int k)
{
pu->syn(tok,egroup,eset,etok,k);
}
string typeCombine(const string& modifiers, const string& name, const string& indir)
{
string retval;
if(modifiers.size()>0)
{
retval=modifiers+" "+name;
}
else
{
retval=name;
}
if(indir.size()>0)
{
retval+=" ";
retval+=indir;
}
return retval;
}
// Many of the rules below accept string parameters to
// allow upward passing of attributes.
// Where the calling context does not need to receive
// the attributes, it can use the dummy values defined
// here to save allocating a string locally to satisfy the
// parameter list.
string d1,d2,d3;
public:
void init(const string& filename, const string& language)
{
pu=ParseUtility::currentInstance();
ps=ParseStore::currentInstance();
ANTLRParser::init();
parse_language=language;
}
protected:
static SetWordType err1[36];
static SetWordType err2[36];
static SetWordType err3[36];
static SetWordType setwd1[276];
static SetWordType setwd2[276];
static SetWordType err4[36];
static SetWordType err5[36];
static SetWordType err6[36];
static SetWordType setwd3[276];
static SetWordType err7[36];
static SetWordType err8[36];
static SetWordType setwd4[276];
static SetWordType err9[36];
static SetWordType err10[36];
static SetWordType err11[36];
static SetWordType err12[36];
static SetWordType setwd5[276];
static SetWordType err13[36];
static SetWordType err14[36];
static SetWordType setwd6[276];
static SetWordType err15[36];
static SetWordType err16[36];
static SetWordType err17[36];
static SetWordType err18[36];
static SetWordType setwd7[276];
static SetWordType err19[36];
static SetWordType err20[36];
static SetWordType setwd8[276];
static SetWordType err21[36];
static SetWordType err22[36];
static SetWordType err23[36];
static SetWordType err24[36];
static SetWordType setwd9[276];
static SetWordType err25[36];
static SetWordType err26[36];
static SetWordType setwd10[276];
static SetWordType err27[36];
static SetWordType err28[36];
static SetWordType setwd11[276];
static SetWordType err29[36];
static SetWordType err30[36];
static SetWordType err31[36];
static SetWordType err32[36];
static SetWordType err33[36];
static SetWordType setwd12[276];
static SetWordType err34[36];
static SetWordType err35[36];
static SetWordType err36[36];
static SetWordType setwd13[276];
static SetWordType err37[36];
static SetWordType err38[36];
static SetWordType err39[36];
static SetWordType setwd14[276];
static SetWordType err40[36];
static SetWordType err41[36];
static SetWordType setwd15[276];
static SetWordType err42[36];
static SetWordType err43[36];
static SetWordType setwd16[276];
static SetWordType err44[36];
static SetWordType err45[36];
static SetWordType setwd17[276];
static SetWordType err46[36];
static SetWordType err47[36];
static SetWordType err48[36];
static SetWordType setwd18[276];
static SetWordType err49[36];
static SetWordType err50[36];
static SetWordType err51[36];
static SetWordType err52[36];
static SetWordType setwd19[276];
static SetWordType err53[36];
static SetWordType err54[36];
static SetWordType err55[36];
static SetWordType err56[36];
static SetWordType setwd20[276];
static SetWordType err57[36];
static SetWordType err58[36];
static SetWordType err59[36];
static SetWordType err60[36];
static SetWordType setwd21[276];
static SetWordType err61[36];
static SetWordType err62[36];
static SetWordType err63[36];
static SetWordType err64[36];
static SetWordType err65[36];
static SetWordType setwd22[276];
static SetWordType EQUAL_OP_set[36];
static SetWordType OP_ASSIGN_OP_set[36];
static SetWordType SHIFT_OP_set[36];
static SetWordType REL_OP_set[36];
static SetWordType DIV_OP_set[36];
static SetWordType PM_OP_set[36];
static SetWordType INCR_OP_set[36];
static SetWordType setwd23[276];
static SetWordType ADD_OP_set[36];
static SetWordType BITWISE_OP_set[36];
static SetWordType err75[36];
static SetWordType err76[36];
static SetWordType err77[36];
static SetWordType err78[36];
static SetWordType err79[36];
static SetWordType setwd24[276];
static SetWordType err80[36];
static SetWordType err81[36];
static SetWordType err82[36];
static SetWordType setwd25[276];
static SetWordType err83[36];
static SetWordType WildCard_set[36];
static SetWordType setwd26[276];
static SetWordType err85[36];
static SetWordType err86[36];
static SetWordType err87[36];
static SetWordType setwd27[276];
static SetWordType err88[36];
static SetWordType err89[36];
static SetWordType err90[36];
static SetWordType setwd28[276];
private:
void zzdflthandlers( int _signal, int *_retsignal );
public:
CParser(ANTLRTokenBuffer *input);
void start(void);
void link_item( string& scope );
void end_of_file(void);
void definition_or_declaration( string& scope );
void resync_tokens(void);
void extern_linkage_block(void);
void namespace_block(void);
void using_statement(void);
void explicit_template_instantiation(void);
void class_declaration_or_definition( string& scope );
void class_suffix( bool& is_definition,string& scope );
void class_suffix_trailer(void);
void opt_instance_list(void);
void union_definition(void);
void anonymous_union_definition(void);
void named_union_definition(void);
void enum_definition(void);
void anonymous_enum_definition(void);
void named_enum_definition(void);
void instance_declaration( string& scopeName );
void class_block( string& scope );
void class_block_item_list( string& scope );
void class_block_item( string& scope );
void class_item_qualifier_list(void);
void class_item_qualifier(void);
void access_modifier(void);
void method_declaration_or_definition_with_implicit_type( string& implicitScope );
void method_declaration_or_definition_with_explicit_type( string &scope );
void method_suffix( bool& is_definition );
void method_signature( string& scope, string& methodName, string& paramList );
void type( string& cvQualifiers, string& typeName, string& indirMods );
void cv_qualifier( string& cvQualifiers );
void type_name( string& typeName );
void indirection_modifiers( string& indirMods );
void indirection_modifier( string& indirMods );
void builtin_type( string& typeName );
void type_keyword( string& typeName );
void user_type( string& typeName );
void scoped_member_name(void);
void scoped_identifier( string& scope, string& name );
void explicit_scope_spec( string& scope );
void unscoped_member_name( string& name );
void dtor_member_name( string& name );
void operator_member_name( string& name );
void operator_identifier( string& opname );
void new_or_delete(void);
void param_list( string& scope, string& params );
void param_list_items( string& scope, string& items );
void more_param_items( string& scope, string& items );
void param_item( string& scope, string& item );
void param_type( string& scope, string& typeName );
void param_spec(void);
void knr_param_decl_list(void);
void opt_const_modifier(void);
void typedef_definition(void);
void fptr_typedef_definition(void);
void struct_typedef_definition(void);
void simple_typedef_definition(void);
void identifier_opt(void);
void tag_list_opt(void);
void tag(void);
void simple_type_alias(void);
void fptr_type_alias(void);
void class_or_method_declaration_or_definition( string& scope );
void class_prefix( string& modname, string& modtype );
void inheritance_list( string& childName );
void inheritance_item_list( string& childName );
void inheritance_access_key(void);
void inheritance_item( string& childName );
void class_key( string& modtype );
void access_key(void);
void ctor_init_list(void);
void ctor_init_item_list(void);
void ctor_init_item(void);
void linkage_qualifiers(void);
void linkage_qualifier(void);
void identifier_or_brace_block_or_both(void);
void opt_brace_block(void);
void instance_item( string& indir,string& name );
void item_specifier( string& indir,string& name );
void opt_initializer(void);
void init_expr(void);
void init_expr_item(void);
void cast_keyword(void);
void init_value(void);
void keyword(void);
void op(void);
void constant(void);
void literal(void);
void string_literal(void);
void block(void);
void balanced(void);
void balanced_list(void);
void nested_token_list( int nl );
void nested_token( int nl );
void scoped(void);
void brace_block(void);
void skip_until_matching_rbrace( int brace_level );
void paren_block(void);
void brack_block(void);
void brack_list(void);
void angle_balanced_list(void);
void angle_block(void);
static SetWordType RESYNCHRONISATION_set[36];
};
#endif /* CParser_h */
| 30.546547 | 84 | 0.768679 |
9ca849b51aaa464c97ffd0c6055e623d6cdf2397 | 2,378 | h | C | vital/plugin_loader/plugin_filter_default.h | neal-siekierski/kwiver | 1c97ad72c8b6237cb4b9618665d042be16825005 | [
"BSD-3-Clause"
] | 1 | 2020-10-14T18:22:42.000Z | 2020-10-14T18:22:42.000Z | vital/plugin_loader/plugin_filter_default.h | neal-siekierski/kwiver | 1c97ad72c8b6237cb4b9618665d042be16825005 | [
"BSD-3-Clause"
] | null | null | null | vital/plugin_loader/plugin_filter_default.h | neal-siekierski/kwiver | 1c97ad72c8b6237cb4b9618665d042be16825005 | [
"BSD-3-Clause"
] | null | null | null | /*ckwg +29
* Copyright 2019 by Kitware, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * 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 name of Kitware, Inc. nor the names of any 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 AUTHORS 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 KWIVER_FITAL_PLUGIN_FILTER_DEFAULT_H
#define KWIVER_FITAL_PLUGIN_FILTER_DEFAULT_H
#include <vital/plugin_loader/vital_vpm_export.h>
#include <vital/plugin_loader/plugin_loader_filter.h>
namespace kwiver {
namespace vital {
// -----------------------------------------------------------------
/** Default plugin loader filter.
*
* This filter excludes duplicate plugins. An exception is thrown if a
* duplicate is found.
*/
class VITAL_VPM_EXPORT plugin_filter_default
: public plugin_loader_filter
{
public:
// -- CONSTRUCTORS --
plugin_filter_default() = default;
virtual ~plugin_filter_default() = default;
virtual bool add_factory( plugin_factory_handle_t fact ) const;
}; // end class plugin_filter_default
} } // end namespace
#endif // KWIVER_FITAL_PLUGIN_FILTER_DEFAULT_H
| 38.354839 | 81 | 0.748108 |
d5c0b718de9b1d316a0eb1b25f45ee33ef516d06 | 527 | h | C | src/game-source-code/Ghost.h | morisscofield/Pac-Man | 2b1ade41b5243ecb827c50761afbf9c6a802c7f9 | [
"Apache-2.0"
] | null | null | null | src/game-source-code/Ghost.h | morisscofield/Pac-Man | 2b1ade41b5243ecb827c50761afbf9c6a802c7f9 | [
"Apache-2.0"
] | null | null | null | src/game-source-code/Ghost.h | morisscofield/Pac-Man | 2b1ade41b5243ecb827c50761afbf9c6a802c7f9 | [
"Apache-2.0"
] | null | null | null | #ifndef GHOST_H_
#define GHOST_H_
#include "Grid.h"
#include "Entity.h"
#include "Direction.h"
class Ghost: public Entity
{
public:
Ghost(shared_ptr<Grid> & grid, const GhostColour & colour);
virtual void move()=0;
void reset();
Coordinates getStep() const;
protected:
shared_ptr<Grid> & grid_;
Coordinates step_;
Coordinates pacDest_;
Direction dir_;
GhostColour colour_;
unsigned int wallCollide_;
Coordinates getTempPosition() const;
bool isWallIntersection(const Entity & tempPos);
void exitBox();
};
#endif
| 19.518519 | 60 | 0.751423 |
5dea16e5cd956f7fa06e1f61ee57da1540e358a0 | 1,259 | h | C | drivers/battery/battery.h | f4deb/cen-electronic | 74302fb38cf41e060ccaf9435ccd8e8792f3e565 | [
"MIT"
] | 1 | 2019-07-24T08:30:33.000Z | 2019-07-24T08:30:33.000Z | drivers/battery/battery.h | f4deb/cen-electronic | 74302fb38cf41e060ccaf9435ccd8e8792f3e565 | [
"MIT"
] | 126 | 2015-01-01T20:03:57.000Z | 2018-05-06T19:55:31.000Z | drivers/battery/battery.h | f4deb/cen-electronic | 74302fb38cf41e060ccaf9435ccd8e8792f3e565 | [
"MIT"
] | 9 | 2015-04-10T07:18:04.000Z | 2020-11-04T11:40:21.000Z | #ifndef BATTERY_H
#define BATTERY_H
#include <stdbool.h>
/**
The ADC index to get the value of the battery.
0x01 corresponds to the pin AN9 / RB9
0x02 corresponds to the pin AN10 / RB10
...
*/
#define BATTERY_ADC_INDEX 0x09
// forward declaration
struct Battery;
typedef struct Battery Battery;
/**
* Returns a value between 0 and 65536 (max 65V) which represents the voltage in mV
* 1 V = 1000
* Ex : if the voltage = 16,5 V it returns 16500
*/
typedef unsigned int ReadBatteryVoltageFunction(Battery* battery);
/**
* Defines the contract for a battery object.
*/
struct Battery {
/** The function which must be used to read the content in the hardware to read the value of the battery */
ReadBatteryVoltageFunction* readBatteryValue;
};
/**
* Check if the structure is well initialized.
* @param battery POO Programming style
*/
bool isBatteryInitialized(Battery* battery);
/**
* Initialize the battery structure with read Function.
* @param battery POO Programming style
*/
void initBattery(Battery* battery, ReadBatteryVoltageFunction* readBatteryValue);
/**
* Default implementation of battery Voltage read.
*/
unsigned int getBatteryVoltage(Battery* battery);
#endif
| 24.211538 | 112 | 0.71247 |
b90bc4c611e198d0b88732b09c4285c12ce5d051 | 3,268 | h | C | src/eval_arithmetic.h | sergeyrachev/khaotica | e44b92e5579ecd0fe1c92061d49151a70197997b | [
"MIT"
] | 5 | 2016-11-25T08:43:00.000Z | 2021-06-20T19:30:35.000Z | src/eval_arithmetic.h | sergeyrachev/khaotica | e44b92e5579ecd0fe1c92061d49151a70197997b | [
"MIT"
] | 3 | 2017-02-13T21:22:16.000Z | 2017-09-25T20:42:12.000Z | src/eval_arithmetic.h | sergeyrachev/khaotica | e44b92e5579ecd0fe1c92061d49151a70197997b | [
"MIT"
] | 1 | 2019-12-03T05:15:01.000Z | 2019-12-03T05:15:01.000Z | #pragma once
#include "mpeg2_types.h"
#include <cassert>
#include <functional>
namespace khaotica {
namespace eval {
using khaotica::syntax::mpeg2::expression_v;
using khaotica::syntax::mpeg2::bitstring_v;
template<typename F>
struct arithmetical_t {
expression_v operator()(const int64_t &left, const int64_t &right) {
return F()(left, right);
}
expression_v operator()(const int64_t &left, const uint64_t &right) {
return F()(left, right);
}
expression_v operator()(const int64_t &left, const bool &right) {
return F()(left, right);
}
expression_v operator()(const int64_t &left, const bitstring_v &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const uint64_t &left, const int64_t &right) {
return F()(left, right);
}
expression_v operator()(const uint64_t &left, const uint64_t &right) {
return F()(left, right);
}
expression_v operator()(const uint64_t &left, const bool &right) {
return F()(left, right);
}
expression_v operator()(const uint64_t &left, const bitstring_v &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const bool &left, const uint64_t &right) {
return F()(left, right);
}
expression_v operator()(const bool &left, const int64_t &right) {
return F()(left, right);
}
expression_v operator()(const bool &left, const bool &right) {
return F()(static_cast<uint64_t>(left), static_cast<uint64_t>(right));
}
expression_v operator()(const bool &left, const bitstring_v &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const bitstring_v &left, const int64_t &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const bitstring_v &left, const bool &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const bitstring_v &left, const uint64_t &right) {
assert(false && "WAT?!");
return false;
}
expression_v operator()(const bitstring_v &left, const bitstring_v &right) {
assert(false && "WAT?!");
return false;
}
template<typename T, typename U>
expression_v operator()(const T &left, const U &right) {
assert(false && "WAT?!");
return false;
}
};
typedef arithmetical_t<std::minus<>> minus_t;
typedef arithmetical_t<std::plus<>> plus_t;
typedef arithmetical_t<std::multiplies<>> multiplies_t;
typedef arithmetical_t<std::divides<>> divides_t;
typedef arithmetical_t<std::modulus<>> modulus_t;
}
}
| 32.68 | 88 | 0.522338 |
fe3f9bd6adbec8f9da16129f9eca5d606a608713 | 390 | h | C | PrivateFrameworks/VideoProcessing/VCPRealTimeAnalysisServerProtocol-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/VideoProcessing/VCPRealTimeAnalysisServerProtocol-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/VideoProcessing/VCPRealTimeAnalysisServerProtocol-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
@class IOSurface, NSDictionary;
@protocol VCPRealTimeAnalysisServerProtocol
- (void)requestAnalysis:(unsigned long long)arg1 ofIOSurface:(IOSurface *)arg2 withProperties:(NSDictionary *)arg3 withReply:(void (^)(NSDictionary *, NSError *))arg4;
@end
| 30 | 167 | 0.728205 |
7dd7f0cf62e65c06acde8b99a7859504dd5fa7b1 | 1,111 | h | C | DQM/SiStripCommissioningSummary/interface/CommissioningSummaryFactory.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | DQM/SiStripCommissioningSummary/interface/CommissioningSummaryFactory.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-23T13:40:24.000Z | 2019-12-05T21:16:03.000Z | DQM/SiStripCommissioningSummary/interface/CommissioningSummaryFactory.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z | #ifndef DQM_SiStripCommissioningSummary_CommissioningSummaryFactory_H
#define DQM_SiStripCommissioningSummary_CommissioningSummaryFactory_H
#include "DQM/SiStripCommissioningSummary/interface/SummaryPlotFactory.h"
#include "DQM/SiStripCommissioningSummary/interface/SummaryPlotFactoryBase.h"
#include <boost/cstdint.hpp>
#include <map>
class CommissioningAnalysis;
template<>
class SummaryPlotFactory<CommissioningAnalysis*> : public SummaryPlotFactoryBase {
public:
SummaryPlotFactory<CommissioningAnalysis*>() {;}
virtual ~SummaryPlotFactory<CommissioningAnalysis*>() {;}
typedef std::map<uint32_t,CommissioningAnalysis*>::const_iterator Iterator;
uint32_t init( const sistrip::Monitorable&,
const sistrip::Presentation&,
const sistrip::View&,
const std::string& top_level_dir,
const sistrip::Granularity&,
const std::map<uint32_t,CommissioningAnalysis*>& data );
void fill( TH1& summary_histo );
protected:
virtual void extract( Iterator ) {;}
virtual void format() {;}
};
#endif // DQM_SiStripCommissioningSummary_CommissioningSummaryFactory_H
| 27.775 | 82 | 0.784878 |
70264a7de9dc26be53abfd22cc1482bd81949c8c | 933 | h | C | src/Generic/events/patterns/EventPatternSet.h | BBN-E/serif | 1e2662d82fb1c377ec3c79355a5a9b0644606cb4 | [
"Apache-2.0"
] | 1 | 2022-03-24T19:57:00.000Z | 2022-03-24T19:57:00.000Z | src/Generic/events/patterns/EventPatternSet.h | BBN-E/serif | 1e2662d82fb1c377ec3c79355a5a9b0644606cb4 | [
"Apache-2.0"
] | null | null | null | src/Generic/events/patterns/EventPatternSet.h | BBN-E/serif | 1e2662d82fb1c377ec3c79355a5a9b0644606cb4 | [
"Apache-2.0"
] | null | null | null | // Copyright 2008 by BBN Technologies Corp.
// All Rights Reserved.
#ifndef EVENT_PATTERN_SET_H
#define EVENT_PATTERN_SET_H
#include "Generic/common/Symbol.h"
#include "Generic/common/hash_map.h"
class EventPatternNode;
class Sexp;
class EventPatternSet {
public:
EventPatternSet(const char* filename);
~EventPatternSet();
private:
struct HashKey {
size_t operator()(const Symbol& s) const {
return s.hash_code();
}
};
struct EqualKey {
bool operator()(const Symbol& s1, const Symbol& s2) const {
return s1 == s2;
}
};
public:
struct NodeSet {
int n_nodes;
EventPatternNode** nodes;
};
typedef serif::hash_map<Symbol, NodeSet, HashKey, EqualKey> Map;
private:
Map* _map;
public:
EventPatternNode** getNodes(const Symbol s, int& n_nodes) const;
private:
void verifyEntityTypeSet(Sexp &sexp);
};
#endif
| 19.4375 | 68 | 0.652733 |
4664da4378690702b134d7d5765e311c05ef36f6 | 370 | h | C | PrivateFrameworks/AccessibilityUtilities.framework/AXReplayer.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | PrivateFrameworks/AccessibilityUtilities.framework/AXReplayer.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | PrivateFrameworks/AccessibilityUtilities.framework/AXReplayer.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities
*/
@interface AXReplayer : NSObject
+ (id)replayer;
- (void)replayWithName:(id)arg1 attempts:(long long)arg2 interval:(double)arg3 async:(bool)arg4 queue:(id)arg5 replayBlock:(id /* block */)arg6 completion:(id /* block */)arg7;
@end
| 30.833333 | 176 | 0.762162 |
cc344ee0cbbfa69e528afbb2507ba865a44941b8 | 2,026 | h | C | src/hobbits-core/pluginaction.h | nfi002/hobbits | b63a15e2e6d8238cba08f2bce686887d8626924b | [
"MIT"
] | null | null | null | src/hobbits-core/pluginaction.h | nfi002/hobbits | b63a15e2e6d8238cba08f2bce686887d8626924b | [
"MIT"
] | 1 | 2020-07-18T23:30:20.000Z | 2020-07-18T23:30:20.000Z | src/hobbits-core/pluginaction.h | nfi002/hobbits | b63a15e2e6d8238cba08f2bce686887d8626924b | [
"MIT"
] | null | null | null | #ifndef PLUGINACTION_H
#define PLUGINACTION_H
#include "actionwatcher.h"
#include "analyzerrunner.h"
#include "hobbitspluginmanager.h"
#include <QJsonObject>
#include <QtConcurrent/QtConcurrentRun>
#include "hobbits-core_global.h"
class BitContainerManager;
class HOBBITSCORESHARED_EXPORT PluginAction
{
public:
enum PluginType {
Framer = 1 /*Deprecated*/,
Operator = 2,
Analyzer = 3,
Importer = 4,
Exporter = 5,
NoAction = 6
};
PluginAction(PluginType pluginType, QString pluginName, QJsonObject pluginState);
static QSharedPointer<PluginAction> analyzerAction(QString pluginName, QJsonObject pluginState);
static QSharedPointer<PluginAction> operatorAction(QString pluginName, QJsonObject pluginState);
static QSharedPointer<PluginAction> importerAction(QString pluginName, QJsonObject pluginState = QJsonObject());
static QSharedPointer<PluginAction> exporterAction(QString pluginName, QJsonObject pluginState = QJsonObject());
static QSharedPointer<PluginAction> noAction();
PluginType getPluginType() const;
QString getPluginName() const;
QJsonObject getPluginState() const;
int minPossibleInputs(QSharedPointer<const HobbitsPluginManager> pluginManager) const;
int maxPossibleInputs(QSharedPointer<const HobbitsPluginManager> pluginManager) const;
QJsonObject serialize() const;
static QSharedPointer<PluginAction> deserialize(QJsonObject data);
inline bool operator==(const PluginAction &other) const
{
return (
m_pluginName == other.getPluginName()
&& m_pluginType == other.getPluginType()
&& m_pluginState == other.getPluginState()
);
}
private:
PluginType m_pluginType;
QString m_pluginName;
QJsonObject m_pluginState;
};
inline uint qHash(const PluginAction &key, uint seed)
{
return qHash(key.getPluginState(), seed) ^ uint(key.getPluginType()) ^ qHash(key.getPluginName(), seed);
}
#endif // PLUGINACTION_H
| 30.69697 | 116 | 0.731984 |
0bcca839f1868cdceaa93ba46c1e0f63af220f43 | 1,445 | h | C | mgfx_core/graphics3d/device/DX12/imguisdl_dx12.h | cmaughan/mgfx | 488453333f23b38b22ba06b984615a8069dadcbf | [
"MIT"
] | 36 | 2017-03-27T16:57:47.000Z | 2022-01-12T04:17:55.000Z | mgfx_core/graphics3d/device/DX12/imguisdl_dx12.h | cmaughan/mgfx | 488453333f23b38b22ba06b984615a8069dadcbf | [
"MIT"
] | 5 | 2017-03-04T12:13:54.000Z | 2017-03-26T21:55:08.000Z | mgfx_core/graphics3d/device/DX12/imguisdl_dx12.h | cmaughan/mgfx | 488453333f23b38b22ba06b984615a8069dadcbf | [
"MIT"
] | 7 | 2017-03-04T11:01:44.000Z | 2018-08-28T09:25:47.000Z | #pragma once
// ImGui Win32 + DirectX12 binding
// In this binding, ImTextureID is used to store a 'D3D12_GPU_DESCRIPTOR_HANDLE' texture identifier. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui
struct SDL_Window;
typedef union SDL_Event SDL_Event;
struct ID3D12Device;
struct ID3D12GraphicsCommandList;
struct D3D12_CPU_DESCRIPTOR_HANDLE;
struct D3D12_GPU_DESCRIPTOR_HANDLE;
namespace Mgfx
{
class Window;
class ImGuiSDL_DX12
{
public:
// cmdList is the command list that the implementation will use to render the
// GUI.
//
// Before calling ImGui::Render(), caller must prepare cmdList by resetting it
// and setting the appropriate render target and descriptor heap that contains
// fontSrvCpuDescHandle/fontSrvGpuDescHandle.
//
// fontSrvCpuDescHandle and fontSrvGpuDescHandle are handles to a single SRV
// descriptor to use for the internal font texture.
bool Init(SDL_Window* pWindow);
void Shutdown();
void NewFrame(SDL_Window* pWindow);
void Render();
private:
};
} // mgfx
| 32.840909 | 156 | 0.757785 |
a8a4b4d4538b098a2d4ae11e961fb7f15e645b7e | 158 | h | C | src/style.h | dev-frog/genetic_programming | 4490ba996ffc908e78b03e51c0333ea4f743a723 | [
"MIT"
] | null | null | null | src/style.h | dev-frog/genetic_programming | 4490ba996ffc908e78b03e51c0333ea4f743a723 | [
"MIT"
] | null | null | null | src/style.h | dev-frog/genetic_programming | 4490ba996ffc908e78b03e51c0333ea4f743a723 | [
"MIT"
] | null | null | null | #ifndef STYLE_H_
#define STYLE_H_
#define BACKGROUND_COLOR "353535"
#define GRID_COLOR "748CAB"
#define AGENT_COLOR "DA2C38"
#endif // STYLE_H_ | 15.8 | 33 | 0.721519 |
44b9c853b7d68768949ca4e95b2b86a6f0736fec | 4,841 | h | C | Source/Plugins/GraphicsPlugins/BladeModel/source/interface_imp/ModelSerializer.h | OscarGame/blade | 6987708cb011813eb38e5c262c7a83888635f002 | [
"MIT"
] | 146 | 2018-12-03T08:08:17.000Z | 2022-03-21T06:04:06.000Z | Source/Plugins/GraphicsPlugins/BladeModel/source/interface_imp/ModelSerializer.h | huangx916/blade | 3fa398f4d32215bbc7e292d61e38bb92aad1ee1c | [
"MIT"
] | 1 | 2019-01-18T03:35:49.000Z | 2019-01-18T03:36:08.000Z | Source/Plugins/GraphicsPlugins/BladeModel/source/interface_imp/ModelSerializer.h | huangx916/blade | 3fa398f4d32215bbc7e292d61e38bb92aad1ee1c | [
"MIT"
] | 31 | 2018-12-03T10:32:43.000Z | 2021-10-04T06:31:44.000Z | /********************************************************************
created: 2013/04/03
filename: ModelSerializer.h
author: Crazii
purpose:
*********************************************************************/
#ifndef __Blade_ModelSerializer_h__
#define __Blade_ModelSerializer_h__
#include <math/AxisAlignedBox.h>
#include <utility/BladeContainer.h>
#include <interface/public/ISerializer.h>
#include <interface/public/graphics/IImage.h>
#include <CascadeSerializer.h>
#include <TypeVersionSerializer.h>
#include <interface/IModelResource.h>
namespace Blade
{
class ModelResource;
class ModelSerializerBase : public CascadeSerializer, public TempAllocatable
{
public:
virtual ~ModelSerializerBase() {}
};
//default model serializer
class ModelSerializer : public TypeVersionSerializer<ModelSerializerBase>, public TempAllocatable
{
public:
typedef TypeVersionSerializer<ModelSerializerBase> BaseType;
public:
ModelSerializer() :BaseType(ModelConsts::MODEL_SERIALIZER_BINARY, IModelResource::MODEL_LATEST_SERIALIZER_VERSION )
{}
};
//xml model serializer
class ModelSerializerXML : public TypeVersionSerializer<ModelSerializerBase>, public TempAllocatable
{
public:
typedef TypeVersionSerializer<ModelSerializerBase> BaseType;
public:
ModelSerializerXML() :BaseType(ModelConsts::MODEL_SERIALIZER_XML, IModelResource::MODEL_LATEST_SERIALIZER_VERSION )
{}
};
class ModelSerializer_Binary : public ModelSerializerBase
{
public:
ModelSerializer_Binary();
~ModelSerializer_Binary();
/*
@describe this method will be called in main thread or background loading thread,\n
and the serializer should NOT care about in which thread it is executed(better to be thread safe always).
if the callback param is not NULL, then this is executed on main thread, otherwise it is on other threads.
@param
@return
*/
virtual bool loadResource(IResource* resource, const HSTREAM& stream, const ParamList& params);
/*
@describe process resource.like preLoadResource, this will be called in main thread.\n
i.e.TextureResource need to be loaded into graphics card.
@param
@return
*/
virtual void postProcessResource(IResource* resource);
/*
@describe
@param
@return
*/
virtual bool saveResource(const IResource* resource, const HSTREAM& stream);
/*
@describe
@param
@return
*/
virtual bool createResource(IResource* resource, ParamList& params);
/*
@describe this method is called when resource is reloaded,
the serializer hold responsibility to cache the loaded data for resource,
then in main thread ISerializer::reprocessResource() is called to fill the existing resource with new data.\n
this mechanism is used for reloading existing resource for multi-thread,
the existing resource is updated in main thread(synchronizing state),
to ensure that the data is changed only when it is not used in another thread.
like the loadResouce,this method will be called in main thread or background loading thread,\n
and the serializer should NOT care about in which thread it is executed.
@param
@return
*/
virtual bool reloadResource(IResource* resource, const HSTREAM& stream, const ParamList& params);
/*
@describe this method will be called in main thread (synchronous thread),
after the ISerializer::reloadResource called in asynchronous state.
@param
@return
*/
virtual bool reprocessResource(IResource* resource);
protected:
/************************************************************************/
/* custom methods */
/************************************************************************/
/** @brief load stream into mesh & materials */
bool loadModel(const HSTREAM& stream, const ParamList& params);
/** @brief postload/re-create from cached data */
bool createModel(ModelResource* resource);
/** @brief */
bool createBuffers(ModelResource* resource, IGraphicsResourceManager& manager, bool flipUV);
/** @brief */
bool mergeBuffer(IModelResource::MESHDATA** meshes, size_t count, IModelResource::MESHDATA& outMergedTarget);
typedef TempVector<IModelResource::MATERIAL_INFO > MaterialCache;
typedef TempVector<IModelResource::MESHDATA> MeshCache;
typedef TempVector<CascadeSerializer::SubResourceGroup*> TextureList;
typedef TempVector<uint32> BoneIDCache;
MaterialCache mMaterials;
BoneIDCache mBoneIDs;
MeshCache mMeshes;
TextureList mTextures;
ModelResource::MESHDATA mMergedOpaqueCache;
ModelResource::MESHDATA mMergedAlphaCache;
CascadeSerializer::SubResourceGroup* mSkeletonAnimation;
AABB mModelAABB;
scalar mModelRadius;
uint32 mNormalType;
bool mSoftWareMesh;
bool mSharedBuffer;
};
}//namespace Blade
#endif//__Blade_ModelSerializer_h__ | 33.618056 | 117 | 0.713902 |
13a937b07ea02ce2033c906b2aa4bc593938c5cf | 5,593 | h | C | admin/pchealth/upload/commonincludes/uploadmanagerdid.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | admin/pchealth/upload/commonincludes/uploadmanagerdid.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | admin/pchealth/upload/commonincludes/uploadmanagerdid.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /******************************************************************************
Copyright (c) 1999 Microsoft Corporation
Module Name:
UploadLibraryDID.h
Abstract:
This file contains the definition of some constants used by
the UploadManager Classes.
Revision History:
Davide Massarenti (Dmassare) 06/13/99
created
******************************************************************************/
#if !defined(__INCLUDED___UL___UPLOADLIBRARYDID_H___)
#define __INCLUDED___UL___UPLOADLIBRARYDID_H___
/////////////////////////////////////////////////////////////////////////
#define E_UPLOADLIBRARY_NOT_AUTHENTICATED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1001)
#define E_UPLOADLIBRARY_ACCESS_DENIED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1002)
#define E_UPLOADLIBRARY_SERVER_QUOTA_EXCEEDED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1003)
#define E_UPLOADLIBRARY_SERVER_BUSY MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1004)
#define E_UPLOADLIBRARY_NO_DATA MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1005)
#define E_UPLOADLIBRARY_INVALID_PARAMETERS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1006)
#define E_UPLOADLIBRARY_CLIENT_QUOTA_EXCEEDED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1007)
#define E_UPLOADLIBRARY_WRONG_SERVER_VERSION MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1008)
#define E_UPLOADLIBRARY_UNEXPECTED_RESPONSE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x1009)
/////////////////////////////////////////////////////////////////////////
#define DISPID_UL_BASE 0x08010000
#define DISPID_UL_BASE_UPLOAD (DISPID_UL_BASE + 0x0000)
#define DISPID_UL_BASE_UPLOADJOB (DISPID_UL_BASE + 0x0100)
#define DISPID_UL_BASE_UPLOADEVENTS (DISPID_UL_BASE + 0x0200)
#define DISPID_UL_BASE_CONNECTION (DISPID_UL_BASE + 0x0300)
/////////////////////////////////////////////////////////////////////////
#define DISPID_UL_UPLOAD_COUNT (DISPID_UL_BASE_UPLOAD + 0x0000)
#define DISPID_UL_UPLOAD_CREATEJOB (DISPID_UL_BASE_UPLOAD + 0x0001)
/////////////////////////////////////////////////////////////////////////
#define DISPID_UL_UPLOADJOB_SIG (DISPID_UL_BASE_UPLOADJOB + 0x0000)
#define DISPID_UL_UPLOADJOB_SERVER (DISPID_UL_BASE_UPLOADJOB + 0x0001)
#define DISPID_UL_UPLOADJOB_JOBID (DISPID_UL_BASE_UPLOADJOB + 0x0002)
#define DISPID_UL_UPLOADJOB_PROVIDERID (DISPID_UL_BASE_UPLOADJOB + 0x0003)
#define DISPID_UL_UPLOADJOB_CREATOR (DISPID_UL_BASE_UPLOADJOB + 0x0010)
#define DISPID_UL_UPLOADJOB_USERNAME (DISPID_UL_BASE_UPLOADJOB + 0x0011)
#define DISPID_UL_UPLOADJOB_PASSWORD (DISPID_UL_BASE_UPLOADJOB + 0x0012)
#define DISPID_UL_UPLOADJOB_ORIGINALSIZE (DISPID_UL_BASE_UPLOADJOB + 0x0020)
#define DISPID_UL_UPLOADJOB_TOTALSIZE (DISPID_UL_BASE_UPLOADJOB + 0x0021)
#define DISPID_UL_UPLOADJOB_SENTSIZE (DISPID_UL_BASE_UPLOADJOB + 0x0022)
#define DISPID_UL_UPLOADJOB_HISTORY (DISPID_UL_BASE_UPLOADJOB + 0x0030)
#define DISPID_UL_UPLOADJOB_STATUS (DISPID_UL_BASE_UPLOADJOB + 0x0031)
#define DISPID_UL_UPLOADJOB_ERRORCODE (DISPID_UL_BASE_UPLOADJOB + 0x0032)
#define DISPID_UL_UPLOADJOB_MODE (DISPID_UL_BASE_UPLOADJOB + 0x0040)
#define DISPID_UL_UPLOADJOB_PERSISTTODISK (DISPID_UL_BASE_UPLOADJOB + 0x0041)
#define DISPID_UL_UPLOADJOB_COMPRESSED (DISPID_UL_BASE_UPLOADJOB + 0x0042)
#define DISPID_UL_UPLOADJOB_PRIORITY (DISPID_UL_BASE_UPLOADJOB + 0x0043)
#define DISPID_UL_UPLOADJOB_CREATIONTIME (DISPID_UL_BASE_UPLOADJOB + 0x0050)
#define DISPID_UL_UPLOADJOB_COMPLETETIME (DISPID_UL_BASE_UPLOADJOB + 0x0051)
#define DISPID_UL_UPLOADJOB_EXPIRATIONTIME (DISPID_UL_BASE_UPLOADJOB + 0x0052)
#define DISPID_UL_UPLOADJOB_ONSTATUSCHANGE (DISPID_UL_BASE_UPLOADJOB + 0x0060)
#define DISPID_UL_UPLOADJOB_ONPROGRESSCHANGE (DISPID_UL_BASE_UPLOADJOB + 0x0061)
#define DISPID_UL_UPLOADJOB_ACTIVATESYNC (DISPID_UL_BASE_UPLOADJOB + 0x0080)
#define DISPID_UL_UPLOADJOB_ACTIVATEASYNC (DISPID_UL_BASE_UPLOADJOB + 0x0081)
#define DISPID_UL_UPLOADJOB_SUSPEND (DISPID_UL_BASE_UPLOADJOB + 0x0082)
#define DISPID_UL_UPLOADJOB_DELETE (DISPID_UL_BASE_UPLOADJOB + 0x0083)
#define DISPID_UL_UPLOADJOB_GETDATAFROMFILE (DISPID_UL_BASE_UPLOADJOB + 0x0090)
#define DISPID_UL_UPLOADJOB_PUTDATAINTOFILE (DISPID_UL_BASE_UPLOADJOB + 0x0091)
#define DISPID_UL_UPLOADJOB_GETDATAFROMSTREAM (DISPID_UL_BASE_UPLOADJOB + 0x0092)
#define DISPID_UL_UPLOADJOB_PUTDATAINTOSTREAM (DISPID_UL_BASE_UPLOADJOB + 0x0093)
#define DISPID_UL_UPLOADJOB_GETRESPONSEASSTREAM (DISPID_UL_BASE_UPLOADJOB + 0x0094)
/////////////////////////////////////////////////////////////////////////
#define DISPID_UL_UPLOADEVENTS_ONSTATUSCHANGE (DISPID_UL_BASE_UPLOADEVENTS + 0x0000)
#define DISPID_UL_UPLOADEVENTS_ONPROGRESSCHANGE (DISPID_UL_BASE_UPLOADEVENTS + 0x0001)
/////////////////////////////////////////////////////////////////////////
#define DISPID_UL_CONNECTION_AVAILABLE (DISPID_UL_BASE_CONNECTION + 0x0000)
#define DISPID_UL_CONNECTION_ISAMODEM (DISPID_UL_BASE_CONNECTION + 0x0001)
#define DISPID_UL_CONNECTION_BANDWIDTH (DISPID_UL_BASE_CONNECTION + 0x0002)
/////////////////////////////////////////////////////////////////////////
#endif // !defined(__INCLUDED___UL___UPLOADLIBRARYDID_H___)
| 53.266667 | 100 | 0.685857 |
ff08d473c2ca87b42d8a18e91ccb8fa3f9df516e | 1,844 | h | C | src/dfm/rpc/impl/TransactionSign.h | dfm-official/dfm | 97f133aa87b17c760b90f2358d6ba10bc7ad9d1f | [
"ISC"
] | null | null | null | src/dfm/rpc/impl/TransactionSign.h | dfm-official/dfm | 97f133aa87b17c760b90f2358d6ba10bc7ad9d1f | [
"ISC"
] | null | null | null | src/dfm/rpc/impl/TransactionSign.h | dfm-official/dfm | 97f133aa87b17c760b90f2358d6ba10bc7ad9d1f | [
"ISC"
] | null | null | null |
#ifndef RIPPLE_RPC_TRANSACTIONSIGN_H_INCLUDED
#define RIPPLE_RPC_TRANSACTIONSIGN_H_INCLUDED
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/rpc/Role.h>
#include <ripple/ledger/ApplyView.h>
namespace ripple {
class Application;
class LoadFeeTrack;
class Transaction;
class TxQ;
namespace RPC {
Json::Value checkFee (
Json::Value& request,
Role const role,
bool doAutoFill,
Config const& config,
LoadFeeTrack const& feeTrack,
TxQ const& txQ,
std::shared_ptr<OpenView const> const& ledger);
using ProcessTransactionFn =
std::function<void (std::shared_ptr<Transaction>& transaction,
bool bUnlimited, bool bLocal, NetworkOPs::FailHard failType)>;
inline ProcessTransactionFn getProcessTxnFn (NetworkOPs& netOPs)
{
return [&netOPs](std::shared_ptr<Transaction>& transaction,
bool bUnlimited, bool bLocal, NetworkOPs::FailHard failType)
{
netOPs.processTransaction(transaction, bUnlimited, bLocal, failType);
};
}
Json::Value transactionSign (
Json::Value params,
NetworkOPs::FailHard failType,
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app);
Json::Value transactionSubmit (
Json::Value params,
NetworkOPs::FailHard failType,
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction);
Json::Value transactionSignFor (
Json::Value params,
NetworkOPs::FailHard failType,
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app);
Json::Value transactionSubmitMultiSigned (
Json::Value params,
NetworkOPs::FailHard failType,
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction);
}
}
#endif
| 20.954545 | 77 | 0.722343 |
b1198684b28dde2d3dc62a7317100a64deb8d109 | 271 | h | C | KDImageCache/KDImageCache/TableViewCell.h | csyibei/KDImageCache | 2e9d5a516ae36e171603944364636f077ea72008 | [
"MIT"
] | null | null | null | KDImageCache/KDImageCache/TableViewCell.h | csyibei/KDImageCache | 2e9d5a516ae36e171603944364636f077ea72008 | [
"MIT"
] | null | null | null | KDImageCache/KDImageCache/TableViewCell.h | csyibei/KDImageCache | 2e9d5a516ae36e171603944364636f077ea72008 | [
"MIT"
] | null | null | null | //
// TableViewCell.h
// KDImageCache
//
// Created by laikidi on 17/3/23.
// Copyright © 2017年 KiDiL. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *cellImageView;
@end
| 18.066667 | 64 | 0.719557 |
d22ad85db31c735f23bb6b1eb4efca8ae81431e0 | 1,916 | h | C | Sources/Elastos/LibCore/inc/org/apache/http/params/CHttpProtocolParamBean.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/LibCore/inc/org/apache/http/params/CHttpProtocolParamBean.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/LibCore/inc/org/apache/http/params/CHttpProtocolParamBean.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | //=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=========================================================================
#ifndef __ORG_APACHE_HTTP_PARAMS_CHTTPPROTOCOLPARAMBEAN_H_
#define __ORG_APACHE_HTTP_PARAMS_CHTTPPROTOCOLPARAMBEAN_H_
#include "_Org_Apache_Http_Params_CHttpProtocolParamBean.h"
#include "org/apache/http/params/HttpAbstractParamBean.h"
#include "elastos/core/Object.h"
using Org::Apache::Http::IHttpVersion;
namespace Org {
namespace Apache {
namespace Http {
namespace Params {
CarClass(CHttpProtocolParamBean)
, public IHttpProtocolParamBean
, public HttpAbstractParamBean
{
public:
CAR_INTERFACE_DECL()
CAR_OBJECT_DECL()
CARAPI SetHttpElementCharset(
/* [in] */ const String& httpElementCharset);
CARAPI SetContentCharset(
/* [in] */ const String& contentCharset);
CARAPI SetVersion(
/* [in] */ IHttpVersion* version);
CARAPI SetUserAgent(
/* [in] */ const String& userAgent);
CARAPI SetUseExpectContinue(
/* [in] */ Boolean useExpectContinue);
CARAPI constructor(
/* [in] */ IHttpParams* params);
};
} // namespace Params
} // namespace Http
} // namespace Apache
} // namespace Org
#endif // __ORG_APACHE_HTTP_PARAMS_CHTTPPROTOCOLPARAMBEAN_H_
| 29.030303 | 75 | 0.672234 |
d26a9258f404c78e41fe28014185484474c885bf | 6,070 | c | C | Tests/Runnable1/Reference/r_argdefault.c | jwilk/Pyrex | 83dfbae1261788933472e3f9c501ad74c61a37c5 | [
"Apache-2.0"
] | 5 | 2019-05-26T20:48:36.000Z | 2021-07-09T01:38:38.000Z | Tests/Runnable1/Reference/r_argdefault.c | jwilk/Pyrex | 83dfbae1261788933472e3f9c501ad74c61a37c5 | [
"Apache-2.0"
] | null | null | null | Tests/Runnable1/Reference/r_argdefault.c | jwilk/Pyrex | 83dfbae1261788933472e3f9c501ad74c61a37c5 | [
"Apache-2.0"
] | 1 | 2022-02-10T07:14:58.000Z | 2022-02-10T07:14:58.000Z | #include "Python.h"
#define const
static PyObject *__Pyx_UnpackItem(PyObject *, int);
static int __Pyx_EndUnpack(PyObject *, int);
static int __Pyx_PrintItem(PyObject *);
static int __Pyx_PrintNewline(void);
static void __Pyx_ReRaise(void);
static void __Pyx_RaiseWithTraceback(PyObject *, PyObject *, PyObject *);
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list);
static PyObject *__Pyx_GetExcValue(void);
static PyObject *__Pyx_GetName(PyObject *dict, char *name);
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, char *name);
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static char (__pyx_k4[]) = "This swallow is called";
static char (__pyx_k5[]) = "This swallow is flying at";
static char (__pyx_k6[]) = "furlongs per fortnight";
static char (__pyx_k7[]) = "This swallow is carrying";
static char (__pyx_k8[]) = "coconuts";
static PyObject *__pyx_f_swallow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_swallow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_name = 0;
PyObject *__pyx_v_airspeed = 0;
PyObject *__pyx_v_coconuts = 0;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
int __pyx_2;
static char *__pyx_argnames[] = {"name","airspeed","coconuts",0};
__pyx_v_name = __pyx_k1;
__pyx_v_airspeed = __pyx_k2;
__pyx_v_coconuts = __pyx_k3;
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OOO", __pyx_argnames, &__pyx_v_name, &__pyx_v_airspeed, &__pyx_v_coconuts)) return 0;
Py_INCREF(__pyx_v_name);
Py_INCREF(__pyx_v_airspeed);
Py_INCREF(__pyx_v_coconuts);
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":2 */
__pyx_1 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_1) goto __pyx_L1;
__pyx_2 = __pyx_v_name != __pyx_1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":3 */
__pyx_1 = PyString_FromString(__pyx_k4); if (!__pyx_1) goto __pyx_L1;
if (__Pyx_PrintItem(__pyx_1) < 0) goto __pyx_L1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__Pyx_PrintItem(__pyx_v_name) < 0) goto __pyx_L1;
if (__Pyx_PrintNewline() < 0) goto __pyx_L1;
goto __pyx_L2;
}
__pyx_L2:;
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":4 */
__pyx_1 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_1) goto __pyx_L1;
__pyx_2 = __pyx_v_airspeed != __pyx_1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":5 */
__pyx_1 = PyString_FromString(__pyx_k5); if (!__pyx_1) goto __pyx_L1;
if (__Pyx_PrintItem(__pyx_1) < 0) goto __pyx_L1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__Pyx_PrintItem(__pyx_v_airspeed) < 0) goto __pyx_L1;
__pyx_1 = PyString_FromString(__pyx_k6); if (!__pyx_1) goto __pyx_L1;
if (__Pyx_PrintItem(__pyx_1) < 0) goto __pyx_L1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__Pyx_PrintNewline() < 0) goto __pyx_L1;
goto __pyx_L3;
}
__pyx_L3:;
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":6 */
__pyx_1 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_1) goto __pyx_L1;
__pyx_2 = __pyx_v_coconuts != __pyx_1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":7 */
__pyx_1 = PyString_FromString(__pyx_k7); if (!__pyx_1) goto __pyx_L1;
if (__Pyx_PrintItem(__pyx_1) < 0) goto __pyx_L1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__Pyx_PrintItem(__pyx_v_coconuts) < 0) goto __pyx_L1;
__pyx_1 = PyString_FromString(__pyx_k8); if (!__pyx_1) goto __pyx_L1;
if (__Pyx_PrintItem(__pyx_1) < 0) goto __pyx_L1;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__Pyx_PrintNewline() < 0) goto __pyx_L1;
goto __pyx_L4;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(__pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_name);
Py_DECREF(__pyx_v_airspeed);
Py_DECREF(__pyx_v_coconuts);
return __pyx_r;
}
static struct PyMethodDef __pyx_methods[] = {
{"swallow", (PyCFunction)__pyx_f_swallow, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
void initr_argdefault(void); /*proto*/
void initr_argdefault(void) {
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
__pyx_m = Py_InitModule4("r_argdefault", __pyx_methods, 0, 0, PYTHON_API_VERSION);
__pyx_b = PyImport_AddModule("__builtin__");
PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b);
/* "ProjectsA:Python:Pyrex:Tests:Runnable:r_argdefault.pyx":1 */
__pyx_1 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_1) goto __pyx_L1;
__pyx_k1 = __pyx_1;
__pyx_1 = 0;
__pyx_2 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_2) goto __pyx_L1;
__pyx_k2 = __pyx_2;
__pyx_2 = 0;
__pyx_3 = __Pyx_GetName(__pyx_b, "None"); if (!__pyx_3) goto __pyx_L1;
__pyx_k3 = __pyx_3;
__pyx_3 = 0;
return;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
}
/* Runtime support code */
static PyObject *__Pyx_GetName(PyObject *dict, char *name) {
PyObject *result;
result = PyObject_GetAttrString(dict, name);
if (!result)
PyErr_SetString(PyExc_NameError, name);
return result;
}
static PyObject *__Pyx_GetStdout(void) {
PyObject *f = PySys_GetObject("stdout");
if (!f) {
PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
}
return f;
}
static int __Pyx_PrintItem(PyObject *v) {
PyObject *f;
if (!(f = __Pyx_GetStdout()))
return -1;
if (PyFile_SoftSpace(f, 1)) {
if (PyFile_WriteString(" ", f) < 0)
return -1;
}
if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
return -1;
if (PyString_Check(v)) {
char *s = PyString_AsString(v);
int len = PyString_Size(v);
if (len > 0 &&
isspace(Py_CHARMASK(s[len-1])) &&
s[len-1] != ' ')
PyFile_SoftSpace(f, 0);
}
return 0;
}
static int __Pyx_PrintNewline(void) {
PyObject *f;
if (!(f = __Pyx_GetStdout()))
return -1;
if (PyFile_WriteString("\n", f) < 0)
return -1;
PyFile_SoftSpace(f, 0);
return 0;
}
| 31.614583 | 146 | 0.716804 |
9abeaae728c00df8dced8d160838e6e51d084134 | 867 | h | C | Source/Common/Internal/IGListIndexPathResultInternal.h | wneo/IGListKit | d53c8d2e60d2fab58edd8bab09151cb4db20795e | [
"MIT"
] | null | null | null | Source/Common/Internal/IGListIndexPathResultInternal.h | wneo/IGListKit | d53c8d2e60d2fab58edd8bab09151cb4db20795e | [
"MIT"
] | null | null | null | Source/Common/Internal/IGListIndexPathResultInternal.h | wneo/IGListKit | d53c8d2e60d2fab58edd8bab09151cb4db20795e | [
"MIT"
] | null | null | null | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "IGListIndexPathResult.h"
NS_ASSUME_NONNULL_BEGIN
@interface IGListIndexPathResult()
- (instancetype)initWithInserts:(NSArray<NSIndexPath *> *)inserts
deletes:(NSArray<NSIndexPath *> *)deletes
updates:(NSArray<NSIndexPath *> *)updates
moves:(NSArray<IGListMoveIndexPath *> *)moves
oldIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)oldIndexPathMap
newIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)newIndexPathMap;
@property (nonatomic, assign, readonly) NSInteger changeCount;
@end
NS_ASSUME_NONNULL_END
| 30.964286 | 91 | 0.681661 |
3c34effca0a3135718f1d162161aaa839efe32d4 | 7,341 | h | C | rv-externals/Eigen_pod/eigen-eigen-ca142d0540d3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h | hchengwang/rv-lcm-demo | fb03a5aa616ac89d6e6a6367f91a7cb3b133c8b7 | [
"MIT"
] | 11 | 2015-02-04T16:41:47.000Z | 2021-12-10T07:02:44.000Z | rv-externals/Eigen_pod/eigen-eigen-ca142d0540d3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h | hchengwang/rv-lcm-demo | fb03a5aa616ac89d6e6a6367f91a7cb3b133c8b7 | [
"MIT"
] | null | null | null | rv-externals/Eigen_pod/eigen-eigen-ca142d0540d3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h | hchengwang/rv-lcm-demo | fb03a5aa616ac89d6e6a6367f91a7cb3b133c8b7 | [
"MIT"
] | 6 | 2015-09-10T12:06:08.000Z | 2021-12-10T07:02:48.000Z |
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2012 Desire NUENTSA WAKAM <desire.nuentsa_wakam@inria.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, 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.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
#ifndef EIGEN_BROWSE_MATRICES_H
#define EIGEN_BROWSE_MATRICES_H
namespace Eigen {
enum {
SPD = 0x100,
NonSymmetric = 0x0
};
/**
* @brief Iterator to browse matrices from a specified folder
*
* This is used to load all the matrices from a folder.
* The matrices should be in Matrix Market format
* It is assumed that the matrices are named as matname.mtx
* and matname_SPD.mtx if the matrix is Symmetric and positive definite (or Hermitian)
* The right hand side vectors are loaded as well, if they exist.
* They should be named as matname_b.mtx.
* Note that the right hand side for a SPD matrix is named as matname_SPD_b.mtx
*
* Sometimes a reference solution is available. In this case, it should be named as matname_x.mtx
*
* Sample code
* \code
*
* \endcode
*
* \tparam Scalar The scalar type
*/
template <typename Scalar>
class MatrixMarketIterator
{
public:
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseMatrix<Scalar,ColMajor> MatrixType;
public:
MatrixMarketIterator(const std::string folder):m_sym(0),m_isvalid(false),m_matIsLoaded(false),m_hasRhs(false),m_hasrefX(false),m_folder(folder)
{
m_folder_id = opendir(folder.c_str());
if (!m_folder_id){
m_isvalid = false;
std::cerr << "The provided Matrix folder could not be opened \n\n";
abort();
}
Getnextvalidmatrix();
}
~MatrixMarketIterator()
{
if (m_folder_id) closedir(m_folder_id);
}
inline MatrixMarketIterator& operator++()
{
m_matIsLoaded = false;
m_hasrefX = false;
m_hasRhs = false;
Getnextvalidmatrix();
return *this;
}
inline operator bool() const { return m_isvalid;}
/** Return the sparse matrix corresponding to the current file */
inline MatrixType& matrix()
{
// Read the matrix
if (m_matIsLoaded) return m_mat;
std::string matrix_file = m_folder + "/" + m_matname + ".mtx";
if ( !loadMarket(m_mat, matrix_file))
{
m_matIsLoaded = false;
return m_mat;
}
m_matIsLoaded = true;
if (m_sym != NonSymmetric)
{ // Store the upper part of the matrix. It is needed by the solvers dealing with nonsymmetric matrices ??
MatrixType B;
B = m_mat;
m_mat = B.template selfadjointView<Lower>();
}
return m_mat;
}
/** Return the right hand side corresponding to the current matrix.
* If the rhs file is not provided, a random rhs is generated
*/
inline VectorType& rhs()
{
// Get the right hand side
if (m_hasRhs) return m_rhs;
std::string rhs_file;
rhs_file = m_folder + "/" + m_matname + "_b.mtx"; // The pattern is matname_b.mtx
m_hasRhs = Fileexists(rhs_file);
if (m_hasRhs)
{
m_rhs.resize(m_mat.cols());
m_hasRhs = loadMarketVector(m_rhs, rhs_file);
}
if (!m_hasRhs)
{
// Generate a random right hand side
if (!m_matIsLoaded) this->matrix();
m_refX.resize(m_mat.cols());
m_refX.setRandom();
m_rhs = m_mat * m_refX;
m_hasrefX = true;
m_hasRhs = true;
}
return m_rhs;
}
/** Return a reference solution
* If it is not provided and if the right hand side is not available
* then refX is randomly generated such that A*refX = b
* where A and b are the matrix and the rhs.
* Note that when a rhs is provided, refX is not available
*/
inline VectorType& refX()
{
// Check if a reference solution is provided
if (m_hasrefX) return m_refX;
std::string lhs_file;
lhs_file = m_folder + "/" + m_matname + "_x.mtx";
m_hasrefX = Fileexists(lhs_file);
if (m_hasrefX)
{
m_refX.resize(m_mat.cols());
m_hasrefX = loadMarketVector(m_refX, lhs_file);
}
return m_refX;
}
inline std::string& matname() { return m_matname; }
inline int sym() { return m_sym; }
inline bool hasRhs() {return m_hasRhs; }
inline bool hasrefX() {return m_hasrefX; }
protected:
inline bool Fileexists(std::string file)
{
std::ifstream file_id(file.c_str());
if (!file_id.good() )
{
return false;
}
else
{
file_id.close();
return true;
}
}
void Getnextvalidmatrix( )
{
m_isvalid = false;
// Here, we return with the next valid matrix in the folder
while ( (m_curs_id = readdir(m_folder_id)) != NULL) {
m_isvalid = false;
std::string curfile;
curfile = m_folder + "/" + m_curs_id->d_name;
// Discard if it is a folder
if (m_curs_id->d_type == DT_DIR) continue; //FIXME This may not be available on non BSD systems
// struct stat st_buf;
// stat (curfile.c_str(), &st_buf);
// if (S_ISDIR(st_buf.st_mode)) continue;
// Determine from the header if it is a matrix or a right hand side
bool isvector,iscomplex;
if(!getMarketHeader(curfile,m_sym,iscomplex,isvector)) continue;
if(isvector) continue;
// Get the matrix name
std::string filename = m_curs_id->d_name;
m_matname = filename.substr(0, filename.length()-4);
// Find if the matrix is SPD
size_t found = m_matname.find("SPD");
if( (found!=std::string::npos) && (m_sym != NonSymmetric) )
m_sym = SPD;
m_isvalid = true;
break;
}
}
int m_sym; // Symmetry of the matrix
MatrixType m_mat; // Current matrix
VectorType m_rhs; // Current vector
VectorType m_refX; // The reference solution, if exists
std::string m_matname; // Matrix Name
bool m_isvalid;
bool m_matIsLoaded; // Determine if the matrix has already been loaded from the file
bool m_hasRhs; // The right hand side exists
bool m_hasrefX; // A reference solution is provided
std::string m_folder;
DIR * m_folder_id;
struct dirent *m_curs_id;
};
} // end namespace Eigen
#endif
| 30.974684 | 147 | 0.631249 |
9606466cfed45df700ba5837578d95dc86a87072 | 5,341 | c | C | src/cs.c | marcocannici/scs | 799a4f7daed4294cd98c73df71676195e6c63de4 | [
"MIT"
] | 25 | 2017-06-30T15:31:33.000Z | 2021-04-21T20:12:18.000Z | src/cs.c | marcocannici/scs | 799a4f7daed4294cd98c73df71676195e6c63de4 | [
"MIT"
] | 34 | 2017-06-07T01:18:17.000Z | 2021-04-24T09:44:00.000Z | src/cs.c | marcocannici/scs | 799a4f7daed4294cd98c73df71676195e6c63de4 | [
"MIT"
] | 13 | 2017-06-07T01:16:09.000Z | 2021-06-07T09:12:56.000Z | #include "cs.h"
#include "scs.h"
/* -----------------------------------------------------------------
* NB: this is a subset of the routines in the CSPARSE package by
* Tim Davis et. al., for the full package please visit
* http://www.cise.ufl.edu/research/sparse/CSparse/
* ----------------------------------------------------------------- */
/* wrapper for malloc */
static void *scs_cs_malloc(scs_int n, scs_int size) {
return (scs_malloc(n * size));
}
/* wrapper for calloc */
static void *scs_cs_calloc(scs_int n, scs_int size) {
return (scs_calloc(n, size));
}
/* wrapper for free */
static void *scs_cs_free(void *p) {
if (p)
scs_free(p); /* free p if it is not already SCS_NULL */
return (SCS_NULL); /* return SCS_NULL to simplify the use of cs_free */
}
/* C = compressed-column form of a triplet matrix T */
scs_cs *scs_cs_compress(const scs_cs *T) {
scs_int m, n, nz, p, k, *Cp, *Ci, *w, *Ti, *Tj;
scs_float *Cx, *Tx;
scs_cs *C;
m = T->m;
n = T->n;
Ti = T->i;
Tj = T->p;
Tx = T->x;
nz = T->nz;
C = scs_cs_spalloc(m, n, nz, Tx != SCS_NULL, 0); /* allocate result */
w = scs_cs_calloc(n, sizeof (scs_int)); /* get workspace */
if (C == SCS_NULL || w == SCS_NULL)
return (scs_cs_done(C, w, SCS_NULL, 0)); /* out of memory */
Cp = C->p;
Ci = C->i;
Cx = C->x;
for (k = 0; k < nz; k++)
w[Tj[k]]++; /* column counts */
scs_cs_cumsum(Cp, w, n); /* column pointers */
for (k = 0; k < nz; k++) {
Ci[p = w[Tj[k]]++] = Ti[k]; /* A(i,j) is the pth entry in C */
if (Cx)
Cx[p] = Tx[k];
}
return (scs_cs_done(C, w, SCS_NULL, 1)); /* success; free w and return C */
}
scs_cs *scs_cs_done(scs_cs *C, void *w, void *x, scs_int ok) {
scs_cs_free(w); /* free workspace */
scs_cs_free(x);
return (ok ? C : scs_cs_spfree(C)); /* return result if OK, else free it */
}
scs_cs *scs_cs_spalloc(scs_int m, scs_int n, scs_int nzmax, scs_int values,
scs_int triplet) {
scs_cs *A = scs_cs_calloc(1, sizeof (scs_cs)); /* allocate the cs struct */
if (A == SCS_NULL) return (SCS_NULL); /* out of memory */
A->m = m; /* define dimensions and nzmax */
A->n = n;
A->nzmax = nzmax = MAX(nzmax, 1);
A->nz = triplet ? 0 : -1; /* allocate triplet or comp.col */
A->p = scs_cs_malloc(triplet ? nzmax : n + 1, sizeof (scs_int));
A->i = scs_cs_malloc(nzmax, sizeof (scs_int));
A->x = values ? scs_cs_malloc(nzmax, sizeof (scs_float)) : SCS_NULL;
return ((!A->p || !A->i || (values && !A->x)) ? scs_cs_spfree(A) : A);
}
scs_cs *scs_cs_spfree(scs_cs *A) {
if (A == SCS_NULL) return (SCS_NULL); /* do nothing if A already SCS_NULL */
scs_cs_free(A->p);
scs_cs_free(A->i);
scs_cs_free(A->x);
return ((scs_cs *) scs_cs_free(A)); /* free the cs struct and return SCS_NULL */
}
scs_float scs_cs_cumsum(scs_int *p, scs_int *c, scs_int n) {
scs_int i, nz = 0;
scs_float nz2 = 0;
if (p == SCS_NULL || c == SCS_NULL) return (-1); /* check inputs */
for (i = 0; i < n; i++) {
p[i] = nz;
nz += c[i];
nz2 += c[i]; /* also in scs_float to avoid scs_int overflow */
c[i] = p[i]; /* also copy p[0..n-1] back into c[0..n-1]*/
}
p[n] = nz;
return (nz2); /* return sum (c [0..n-1]) */
}
scs_int *scs_cs_pinv(scs_int const *p, scs_int n) {
scs_int k, *pinv;
if (p == SCS_NULL) return (SCS_NULL); /* p = SCS_NULL denotes identity */
pinv = scs_cs_malloc(n, sizeof (scs_int)); /* allocate result */
if (pinv == SCS_NULL)
return (SCS_NULL); /* out of memory */
for (k = 0; k < n; k++)
pinv[p[k]] = k; /* invert the permutation */
return (pinv); /* return result */
}
scs_cs *scs_cs_symperm(const scs_cs *A, const scs_int *pinv, scs_int values) {
scs_int i, j, p, q, i2, j2, n, *Ap, *Ai, *Cp, *Ci, *w;
scs_float *Cx, *Ax;
scs_cs *C;
n = A->n;
Ap = A->p;
Ai = A->i;
Ax = A->x;
C = scs_cs_spalloc(n, n, Ap[n], values && (Ax != SCS_NULL),
0); /* alloc result*/
w = scs_cs_calloc(n, sizeof (scs_int)); /* get workspace */
if (C == SCS_NULL || w == SCS_NULL)
return (scs_cs_done(C, w, SCS_NULL, 0)); /* out of memory */
Cp = C->p;
Ci = C->i;
Cx = C->x;
for (j = 0; j < n; j++) /* count entries in each column of C */ {
j2 = pinv ? pinv[j] : j; /* column j of A is column j2 of C */
for (p = Ap[j]; p < Ap[j + 1]; p++) {
i = Ai[p];
if (i > j)
continue; /* skip lower triangular part of A */
i2 = pinv ? pinv[i] : i; /* row i of A is row i2 of C */
w[MAX(i2, j2)]++; /* column count of C */
}
}
scs_cs_cumsum(Cp, w, n); /* compute column pointers of C */
for (j = 0; j < n; j++) {
j2 = pinv ? pinv[j] : j; /* column j of A is column j2 of C */
for (p = Ap[j]; p < Ap[j + 1]; p++) {
i = Ai[p];
if (i > j)
continue; /* skip lower triangular part of A*/
i2 = pinv ? pinv[i] : i; /* row i of A is row i2 of C */
Ci[q = w[MAX(i2, j2)]++] = MIN(i2, j2);
if (Cx)
Cx[q] = Ax[p];
}
}
return (scs_cs_done(C, w, SCS_NULL, 1)); /* success; free workspace, return C */
}
| 35.845638 | 84 | 0.516944 |
a95967a6e4dbd6e7bb6562cf1d4520fffcd69269 | 11,100 | c | C | projects/microchip/same54_xpro_winc1500/mplab/aws_tests/firmware/src/main.c | Darsh-Dev/amazon-freertos | 3b2a01b5060660c639c5e9362c82f8db83f0254a | [
"MIT"
] | 6 | 2020-02-23T13:30:47.000Z | 2021-08-08T17:05:14.000Z | projects/microchip/same54_xpro_winc1500/mplab/aws_tests/firmware/src/main.c | Darsh-Dev/amazon-freertos | 3b2a01b5060660c639c5e9362c82f8db83f0254a | [
"MIT"
] | 3 | 2019-11-22T03:56:18.000Z | 2020-05-20T04:23:43.000Z | projects/microchip/same54_xpro_winc1500/mplab/aws_tests/firmware/src/main.c | Darsh-Dev/amazon-freertos | 3b2a01b5060660c639c5e9362c82f8db83f0254a | [
"MIT"
] | 13 | 2019-12-31T21:22:09.000Z | 2022-03-07T15:55:27.000Z | /*
* Amazon FreeRTOS V1.4.7
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. 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.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
#include <stddef.h> // Defines NULL
#include <stdbool.h> // Defines true
#include <stdlib.h> // Defines EXIT_FAILURE
#include "definitions.h" // SYS function prototypes
#include "aws_test_runner.h"
#include "iot_logging_task.h"
#include "cryptoauthlib.h"
/* Standard includes. */
#include <time.h>
#include "atca_config.h"
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "task.h"
/* AWS System includes. */
#include "aws_application_version.h"
#include "iot_system_init.h"
#include "aws_clientcredential.h"
#include "aws_dev_mode_key_provisioning.h"
/* Demo application includes. */
#include "aws_demo_config.h"
#include "unity.h"
#include "iot_logging_task.h"
#include "iot_wifi.h"
#include "cryptoauthlib.h"
/* Application version info. */
#include "aws_application_version.h"
extern void initialize_wifi();
void prvWifiConnect( void );
extern void wifi_winc_crypto_init (void);
static void prvMiscInitialization( void );
/* Sleep on this platform */
#define Sleep( nMs ) vTaskDelay( pdMS_TO_TICKS( nMs ) );
/* Define a name that will be used for LLMNR and NBNS searches. Once running,
* you can "ping RTOSDemo" instead of pinging the IP address, which is useful when
* using DHCP. */
#define mainHOST_NAME "RTOSDemo"
#define mainDEVICE_NICK_NAME "Microchip_Demo"
#define mainLOGGING_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 5 )
#define mainLOGGING_MESSAGE_QUEUE_LENGTH ( 128 )
#define mainTEST_RUNNER_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 8 )
/* The default IP and MAC address used by the demo. The address configuration
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
* 1 but a DHCP server could not be contacted. See the online documentation for
* more information. In both cases the node can be discovered using
* "ping RTOSDemo". */
static const uint8_t ucIPAddress[ 4 ] =
{
configIP_ADDR0,
configIP_ADDR1,
configIP_ADDR2,
configIP_ADDR3
};
static const uint8_t ucNetMask[ 4 ] =
{
configNET_MASK0,
configNET_MASK1,
configNET_MASK2,
configNET_MASK3
};
static const uint8_t ucGatewayAddress[ 4 ] =
{
configGATEWAY_ADDR0,
configGATEWAY_ADDR1,
configGATEWAY_ADDR2,
configGATEWAY_ADDR3
};
static const uint8_t ucDNSServerAddress[ 4 ] =
{
configDNS_SERVER_ADDR0,
configDNS_SERVER_ADDR1,
configDNS_SERVER_ADDR2,
configDNS_SERVER_ADDR3
};
const uint8_t ucMACAddress[ 6 ] =
{
configMAC_ADDR0,
configMAC_ADDR1,
configMAC_ADDR2,
configMAC_ADDR3,
configMAC_ADDR4,
configMAC_ADDR5
};
/* Set the following constant to pdTRUE to log using the method indicated by the
name of the constant, or pdFALSE to not log using the method indicated by the
name of the constant. Options include to standard out (xLogToStdout), to a disk
file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
then UDP messages are sent to the IP address configured as the echo server
address (see the configECHO_SERVER_ADDR0 definitions in FreeRTOSConfig.h) and
the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
/* PIC32 note: xLogToFile is NOT supported! */
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
/**
* @brief Application task startup hook.
*/
void vApplicationDaemonTaskStartupHook( void );
/**
* @brief Initializes the board.
*/
static void prvMiscInitialization( void );
extern void vStartOTAUpdateDemoTask();
/*-----------------------------------------------------------*/
/**
* @brief Application runtime entry point.
*/
int main( void )
{
/* Perform any hardware initialization that does not require the RTOS to be
* running. */
prvMiscInitialization();
/* Start the scheduler. Initialization that requires the OS to be running,
* including the WiFi initialization, is performed in the RTOS daemon task
* startup hook. */
vTaskStartScheduler();
return 0;
}
void prvWifiConnect( void )
{
static int iInit=0;
if(!iInit)
{
SYSTEM_Init();
vDevModeKeyProvisioning();
wifi_winc_crypto_init();
WIFI_On();
WIFINetworkParams_t xNetworkParams = { 0 };
xNetworkParams.pcSSID = clientcredentialWIFI_SSID;
xNetworkParams.ucSSIDLength = sizeof( clientcredentialWIFI_SSID );
xNetworkParams.pcPassword = clientcredentialWIFI_PASSWORD;
xNetworkParams.ucPasswordLength = sizeof( clientcredentialWIFI_PASSWORD );
xNetworkParams.xSecurity = clientcredentialWIFI_SECURITY;
WIFI_ConnectAP( &xNetworkParams );
xTaskCreate( TEST_RUNNER_RunTests_task,
"TestRunner",
mainTEST_RUNNER_TASK_STACK_SIZE,
NULL,
tskIDLE_PRIORITY, NULL );
iInit=1;
}
}
/*-----------------------------------------------------------*/
static void CLOCK_DeInitialize(void)
{
// Enable DFLL
OSCCTRL_REGS->OSCCTRL_DFLLCTRLA = OSCCTRL_DFLLCTRLA_ENABLE_Msk ;
// Configure CPU to run from DFLL Clock
MCLK_REGS->MCLK_CPUDIV = MCLK_CPUDIV_DIV(0x01);
while((MCLK_REGS->MCLK_INTFLAG & MCLK_INTFLAG_CKRDY_Msk) != MCLK_INTFLAG_CKRDY_Msk)
{
/* Wait for the Main Clock to be Ready */
}
GCLK_REGS->GCLK_GENCTRL[0] = GCLK_GENCTRL_DIV(1) | GCLK_GENCTRL_SRC(6) | GCLK_GENCTRL_GENEN_Msk;
while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL_GCLK0) == GCLK_SYNCBUSY_GENCTRL_GCLK0)
{
/* wait for the Generator 0 synchronization */
}
/* Disable FDPLL0 */
OSCCTRL_REGS->DPLL[0].OSCCTRL_DPLLCTRLA &= (~OSCCTRL_DPLLCTRLA_ENABLE_Msk) ;
while((OSCCTRL_REGS->DPLL[0].OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk) == OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk )
{
/* Waiting for the DPLL enable synchronization */
}
/* Disable FDPLL1 */
OSCCTRL_REGS->DPLL[1].OSCCTRL_DPLLCTRLA &= (~OSCCTRL_DPLLCTRLA_ENABLE_Msk) ;
while((OSCCTRL_REGS->DPLL[1].OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk) == OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk )
{
/* Waiting for the DPLL enable synchronization */
}
}
static void prvMiscInitialization( void )
{
CLOCK_DeInitialize();
/* Start logging task. */
xLoggingTaskInitialize( mainLOGGING_TASK_STACK_SIZE,
tskIDLE_PRIORITY,
mainLOGGING_MESSAGE_QUEUE_LENGTH );
SYS_Initialize( NULL );
SOCKETS_Init();
initialize_wifi();
SYS_Tasks();
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
void vAssertCalled( const char * pcFile,
uint32_t ulLine )
{
const uint32_t ulLongSleep = 1000UL;
volatile uint32_t ulBlockVariable = 0UL;
volatile char * pcFileName = ( volatile char * ) pcFile;
volatile uint32_t ulLineNumber = ulLine;
( void ) pcFileName;
( void ) ulLineNumber;
configPRINTF( ( "vAssertCalled %s, %ld\n", pcFile, ( long ) ulLine ) );
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
* this function to be exited. */
taskDISABLE_INTERRUPTS();
{
while( ulBlockVariable == 0UL )
{
Sleep( ulLongSleep );
}
}
taskENABLE_INTERRUPTS();
}
/*-----------------------------------------------------------*/
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
BaseType_t xApplicationDNSQueryHook( const char * pcName )
{
BaseType_t xReturn;
/* Determine if a name lookup is for this node. Two names are given
* to this node: that returned by pcApplicationHostnameHook() and that set
* by mainDEVICE_NICK_NAME. */
if( strcmp( pcName, pcApplicationHostnameHook() ) == 0 )
{
xReturn = pdPASS;
}
else if( strcmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
{
xReturn = pdPASS;
}
else
{
xReturn = pdFAIL;
}
return xReturn;
}
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
/*-----------------------------------------------------------*/
void vApplicationIdleHook( void )
{
const uint32_t ulMSToSleep = 1;
const TickType_t xIdleCheckPeriod = pdMS_TO_TICKS( 1000UL );
static TickType_t xTimeNow, xLastTimeCheck = 0;
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
* to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
* task. It is essential that code added to this hook function never attempts
* to block in any way (for example, call xQueueReceive() with a block time
* specified, or call vTaskDelay()). If application tasks make use of the
* vTaskDelete() API function to delete themselves then it is also important
* that vApplicationIdleHook() is permitted to return to its calling function,
* because it is the responsibility of the idle task to clean up memory
* allocated by the kernel to any task that has since deleted itself. */
xTimeNow = xTaskGetTickCount();
if( ( xTimeNow - xLastTimeCheck ) > xIdleCheckPeriod )
{
/* do something in the idle task */
xLastTimeCheck = xTimeNow;
}
/* This is just a trivial example of an idle hook. It is called on each
* cycle of the idle task if configUSE_IDLE_HOOK is set to 1 in
* FreeRTOSConfig.h. It must *NOT* attempt to block. In this case the
* idle task just sleeps to lower the CPU usage. */
Sleep( ulMSToSleep );
}
/*-----------------------------------------------------------*/
| 31.896552 | 125 | 0.663243 |
656ef4223b8d18c6891ebb1601e41c7c45114017 | 14,015 | c | C | toys/posix/patch.c | milad77pnq/toybox | ca6fcbbc86009392645e094aa5fed6b34a328a05 | [
"0BSD"
] | null | null | null | toys/posix/patch.c | milad77pnq/toybox | ca6fcbbc86009392645e094aa5fed6b34a328a05 | [
"0BSD"
] | null | null | null | toys/posix/patch.c | milad77pnq/toybox | ca6fcbbc86009392645e094aa5fed6b34a328a05 | [
"0BSD"
] | null | null | null | /* patch.c - Apply a "universal" diff.
*
* Copyright 2007 Rob Landley <rob@landley.net>
*
* see http://opengroup.org/onlinepubs/9699919799/utilities/patch.html
* (But only does -u, because who still cares about "ed"?)
*
* TODO:
* -b backup
* -N ignore already applied
* -D define wrap #ifdef and #ifndef around changes
* -o outfile output here instead of in place
* -r rejectfile write rejected hunks to this file
* -E remove empty files --remove-empty-files
* git syntax (rename, etc)
USE_PATCH(NEWTOY(patch, ">2(no-backup-if-mismatch)(dry-run)"USE_TOYBOX_DEBUG("x")"F#g#fulp#d:i:Rs(quiet)", TOYFLAG_USR|TOYFLAG_BIN))
config PATCH
bool "patch"
default y
help
usage: patch [-Rlsu] [-d DIR] [-i PATCH] [-p DEPTH] [-F FUZZ] [--dry-run] [FILE [PATCH]]
Apply a unified diff to one or more files.
-d Modify files in DIR
-i Input patch file (default=stdin)
-l Loose match (ignore whitespace)
-p Number of '/' to strip from start of file paths (default=all)
-R Reverse patch
-s Silent except for errors
-u Ignored (only handles "unified" diffs)
--dry-run Don't change files, just confirm patch applies
This version of patch only handles unified diffs, and only modifies
a file when all hunks to that file apply. Patch prints failed hunks
to stderr, and exits with nonzero status if any hunks fail.
A file compared against /dev/null (or with a date <= the epoch) is
created/deleted as appropriate.
*/
#define FOR_patch
#include "toys.h"
GLOBALS(
char *i, *d;
long p, g, F;
void *current_hunk;
long oldline, oldlen, newline, newlen, linenum, outnum;
int context, state, filein, fileout, filepatch, hunknum;
char *tempname;
)
// Dispose of a line of input, either by writing it out or discarding it.
// state < 2: just free
// state = 2: write whole line to stderr
// state = 3: write whole line to fileout
// state > 3: write line+1 to fileout when *line != state
static void do_line(void *data)
{
struct double_list *dlist = data;
TT.outnum++;
if (TT.state>1)
if (0>dprintf(TT.state==2 ? 2 : TT.fileout,"%s\n",dlist->data+(TT.state>3)))
perror_exit("write");
if (FLAG(x))
fprintf(stderr, "DO %d %ld: %s\n", TT.state, TT.outnum, dlist->data);
llist_free_double(data);
}
static void finish_oldfile(void)
{
if (TT.tempname) replace_tempfile(TT.filein, TT.fileout, &TT.tempname);
TT.fileout = TT.filein = -1;
}
static void fail_hunk(void)
{
if (!TT.current_hunk) return;
fprintf(stderr, "Hunk %d FAILED %ld/%ld.\n",
TT.hunknum, TT.oldline, TT.newline);
toys.exitval = 1;
// If we got to this point, we've seeked to the end. Discard changes to
// this file and advance to next file.
TT.state = 2;
llist_traverse(TT.current_hunk, do_line);
TT.current_hunk = NULL;
if (!FLAG(dry_run)) delete_tempfile(TT.filein, TT.fileout, &TT.tempname);
TT.state = 0;
}
// Compare ignoring whitespace. Just returns 0/1, no > or <
static int loosecmp(char *aa, char *bb)
{
int a = 0, b = 0;
for (;;) {
while (isspace(aa[a])) a++;
while (isspace(bb[b])) b++;
if (aa[a] != bb[b]) return 1;
if (!aa[a]) return 0;
a++, b++;
}
}
// Given a hunk of a unified diff, make the appropriate change to the file.
// This does not use the location information, but instead treats a hunk
// as a sort of regex. Copies data from input to output until it finds
// the change to be made, then outputs the changed data and returns.
// (Finding EOF first is an error.) This is a single pass operation, so
// multiple hunks must occur in order in the file.
static int apply_one_hunk(void)
{
struct double_list *plist, *buf = 0, *check;
int matcheof, trail = 0, reverse = FLAG(R), backwarn = 0, allfuzz, fuzz, i;
int (*lcmp)(char *aa, char *bb) = FLAG(l) ? (void *)loosecmp : (void *)strcmp;
// Match EOF if there aren't as many ending context lines as beginning
dlist_terminate(TT.current_hunk);
for (fuzz = 0, plist = TT.current_hunk; plist; plist = plist->next) {
char c = *plist->data, *s;
if (c==' ') trail++;
else trail = 0;
// Only allow fuzz if 2 context lines have multiple nonwhitespace chars.
// avoids the "all context was blank or } lines" issue. Removed lines
// count as context since they're matched.
if (c==' ' || c=="-+"[reverse]) {
s = plist->data+1;
while (isspace(*s)) s++;
if (*s && s[1] && !isspace(s[1])) fuzz++;
}
if (FLAG(x)) fprintf(stderr, "HUNK:%s\n", plist->data);
}
matcheof = !trail || trail < TT.context;
if (fuzz<2) allfuzz = 0;
else allfuzz = FLAG(F) ? TT.F : (TT.context ? TT.context-1 : 0);
if (FLAG(x)) fprintf(stderr,"MATCHEOF=%c\n", matcheof ? 'Y' : 'N');
// Loop through input data searching for this hunk. Match all context
// lines and lines to be removed until we've found end of complete hunk.
plist = TT.current_hunk;
fuzz = 0;
for (;;) {
char *data = get_line(TT.filein);
// Figure out which line of hunk to compare with next. (Skip lines
// of the hunk we'd be adding.)
while (plist && *plist->data == "+-"[reverse]) {
if (data && !lcmp(data, plist->data+1))
if (!backwarn) backwarn = TT.linenum;
plist = plist->next;
}
// Is this EOF?
if (!data) {
if (FLAG(x)) fprintf(stderr, "INEOF\n");
// Does this hunk need to match EOF?
if (!plist && matcheof) break;
if (backwarn && !FLAG(s))
fprintf(stderr, "Possibly reversed hunk %d at %ld\n",
TT.hunknum, TT.linenum);
// File ended before we found a place for this hunk.
fail_hunk();
goto done;
} else {
TT.linenum++;
if (FLAG(x)) fprintf(stderr, "IN: %s\n", data);
}
check = dlist_add(&buf, data);
// Compare this line with next expected line of hunk. Match can fail
// because next line doesn't match, or because we hit end of a hunk that
// needed EOF and this isn't EOF.
for (i = 0;; i++) {
if (!plist || lcmp(check->data, plist->data+1)) {
// Match failed: can we fuzz it?
if (plist && *plist->data == ' ' && fuzz<allfuzz) {
if (FLAG(x))
fprintf(stderr, "FUZZED: %ld %s\n", TT.linenum, plist->data);
fuzz++;
goto fuzzed;
}
if (FLAG(x)) {
int bug = 0;
if (!plist) fprintf(stderr, "NULL plist\n");
else {
while (plist->data[bug] == check->data[bug]) bug++;
fprintf(stderr, "NOT(%d:%d!=%d): %s\n", bug, plist->data[bug],
check->data[bug], plist->data);
}
}
// If this hunk must match start of file, fail if it didn't.
if (!TT.context || trail>TT.context) {
fail_hunk();
goto done;
}
// Write out first line of buffer and recheck rest for new match.
TT.state = 3;
do_line(check = dlist_pop(&buf));
plist = TT.current_hunk;
fuzz = 0;
// If end of the buffer without finishing a match, read more lines.
if (!buf) break;
check = buf;
} else {
if (FLAG(x)) fprintf(stderr, "MAYBE: %s\n", plist->data);
fuzzed:
// This line matches. Advance plist, detect successful match.
plist = plist->next;
if (!plist && !matcheof) goto out;
check = check->next;
if (check == buf) break;
}
}
}
out:
// We have a match. Emit changed data.
TT.state = "-+"[reverse];
while ((plist = dlist_pop(&TT.current_hunk))) {
if (TT.state == *plist->data || *plist->data == ' ') {
if (*plist->data == ' ') dprintf(TT.fileout, "%s\n", buf->data);
llist_free_double(dlist_pop(&buf));
} else dprintf(TT.fileout, "%s\n", plist->data+1);
llist_free_double(plist);
}
TT.current_hunk = 0;
TT.state = 1;
done:
llist_traverse(buf, do_line);
return TT.state;
}
// read a filename that has been quoted or escaped
static char *unquote_file(char *filename)
{
char *s = filename, *t;
// Return copy of file that wasn't quoted
if (*s++ != '"' || !*s) return xstrdup(filename);
// quoted and escaped filenames are larger than the original
for (t = filename = xmalloc(strlen(s) + 1); *s != '"'; s++) {
if (!s[1]) error_exit("bad %s", filename);
// don't accept escape sequences unless the filename is quoted
if (*s != '\\') *t++ = *s;
else if (*++s >= '0' && *s < '8') {
*t++ = strtoul(s, &s, 8);
s--;
} else {
if (!(*t = unescape(*s))) *t = *s;;
t++;
}
}
*t = 0;
return filename;
}
// Read a patch file and find hunks, opening/creating/deleting files.
// Call apply_one_hunk() on each hunk.
// state 0: Not in a hunk, look for +++.
// state 1: Found +++ file indicator, look for @@
// state 2: In hunk: counting initial context lines
// state 3: In hunk: getting body
void patch_main(void)
{
int reverse = FLAG(R), state = 0, patchlinenum = 0, strip = 0;
char *oldname = NULL, *newname = NULL;
if (toys.optc == 2) TT.i = toys.optargs[1];
if (TT.i) TT.filepatch = xopenro(TT.i);
TT.filein = TT.fileout = -1;
if (TT.d) xchdir(TT.d);
// Loop through the lines in the patch
for (;;) {
char *patchline;
patchline = get_line(TT.filepatch);
if (!patchline) break;
// Other versions of patch accept damaged patches, so we need to also.
if (strip || !patchlinenum++) {
int len = strlen(patchline);
if (len && patchline[len-1] == '\r') {
if (!strip && !FLAG(s)) fprintf(stderr, "Removing DOS newlines\n");
strip = 1;
patchline[len-1]=0;
}
}
if (!*patchline) {
free(patchline);
patchline = xstrdup(" ");
}
// Are we assembling a hunk?
if (state >= 2) {
if (*patchline==' ' || *patchline=='+' || *patchline=='-') {
dlist_add((void *)&TT.current_hunk, patchline);
if (*patchline != '+') TT.oldlen--;
if (*patchline != '-') TT.newlen--;
// Context line?
if (*patchline==' ' && state==2) TT.context++;
else state=3;
// If we've consumed all expected hunk lines, apply the hunk.
if (!TT.oldlen && !TT.newlen) state = apply_one_hunk();
continue;
}
dlist_terminate(TT.current_hunk);
fail_hunk();
state = 0;
continue;
}
// Open a new file?
if (!strncmp("--- ", patchline, 4) || !strncmp("+++ ", patchline, 4)) {
char *s, **name = &oldname;
int i;
if (*patchline == '+') {
name = &newname;
state = 1;
}
free(*name);
finish_oldfile();
// Trim date from end of filename (if any). We don't care.
for (s = patchline+4; *s && *s!='\t'; s++);
i = atoi(s);
if (i>1900 && i<=1970) *name = xstrdup("/dev/null");
else {
*s = 0;
*name = unquote_file(patchline+4);
}
// We defer actually opening the file because svn produces broken
// patches that don't signal they want to create a new file the
// way the patch man page says, so you have to read the first hunk
// and _guess_.
// Start a new hunk? Usually @@ -oldline,oldlen +newline,newlen @@
// but a missing ,value means the value is 1.
} else if (state == 1 && !strncmp("@@ -", patchline, 4)) {
int i;
char *s = patchline+4;
// Read oldline[,oldlen] +newline[,newlen]
TT.oldlen = TT.newlen = 1;
TT.oldline = strtol(s, &s, 10);
if (*s == ',') TT.oldlen=strtol(s+1, &s, 10);
TT.newline = strtol(s+2, &s, 10);
if (*s == ',') TT.newlen = strtol(s+1, &s, 10);
TT.context = 0;
state = 2;
// If this is the first hunk, open the file.
if (TT.filein == -1) {
int oldsum, newsum, del = 0;
char *name;
oldsum = TT.oldline + TT.oldlen;
newsum = TT.newline + TT.newlen;
// If an original file was provided on the command line, it overrides
// *all* files mentioned in the patch, not just the first.
if (toys.optc) {
char **which = reverse ? &oldname : &newname;
free(*which);
*which = strdup(toys.optargs[0]);
// The supplied path should be taken literally with or without -p.
toys.optflags |= FLAG_p;
TT.p = 0;
}
name = reverse ? oldname : newname;
// We're deleting oldname if new file is /dev/null (before -p)
// or if new hunk is empty (zero context) after patching
if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) {
name = reverse ? newname : oldname;
del++;
}
// handle -p path truncation.
for (i = 0, s = name; *s;) {
if (FLAG(p) && TT.p == i) break;
if (*s++ != '/') continue;
while (*s == '/') s++;
name = s;
i++;
}
if (del) {
if (!FLAG(s)) printf("removing %s\n", name);
xunlink(name);
state = 0;
// If we've got a file to open, do so.
} else if (!FLAG(p) || i <= TT.p) {
// If the old file was null, we're creating a new one.
if ((!strcmp(oldname, "/dev/null") || !oldsum) && access(name, F_OK))
{
if (!FLAG(s)) printf("creating %s\n", name);
if (mkpath(name)) perror_exit("mkpath %s", name);
TT.filein = xcreate(name, O_CREAT|O_EXCL|O_RDWR, 0666);
} else {
if (!FLAG(s)) printf("patching %s\n", name);
TT.filein = xopenro(name);
}
if (FLAG(dry_run)) TT.fileout = xopen("/dev/null", O_RDWR);
else TT.fileout = copy_tempfile(TT.filein, name, &TT.tempname);
TT.linenum = TT.outnum = TT.hunknum = 0;
}
}
TT.hunknum++;
continue;
}
// If we didn't continue above, discard this line.
free(patchline);
}
finish_oldfile();
if (CFG_TOYBOX_FREE) {
close(TT.filepatch);
free(oldname);
free(newname);
}
}
| 29.819149 | 132 | 0.571959 |
ecfe625dfe207558bf3c2b5689aec23c80782811 | 3,247 | h | C | communication.h | korken89/kfly_gui | 5f859bf6136c65226645db9af638a1cdf5cc1022 | [
"BSL-1.0"
] | null | null | null | communication.h | korken89/kfly_gui | 5f859bf6136c65226645db9af638a1cdf5cc1022 | [
"BSL-1.0"
] | null | null | null | communication.h | korken89/kfly_gui | 5f859bf6136c65226645db9af638a1cdf5cc1022 | [
"BSL-1.0"
] | null | null | null | #ifndef COMMUNICATION_H
#define COMMUNICATION_H
#include <QtCore>
#include <QtWidgets>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <vector>
#include <thread>
#include "kfly_comm/kfly_comm.hpp"
class communication : public QObject
{
Q_OBJECT
private:
QSerialPort _serialport;
kfly_comm::codec _kfly_comm;
std::mutex _serialmutex;
std::vector<uint8_t> _transmitt_buffer;
QTimer _transmit_timer;
public:
explicit communication(QObject *parent = 0);
~communication();
bool openPort(const QString& portname, int baudrate);
void closePort();
void send(const std::vector<uint8_t>& message);
void subscribe(kfly_comm::commands cmd, unsigned int dt_ms);
void unsubscribe(kfly_comm::commands cmd);
void unsubscribe_all();
/* Functions registered to the KFly interface. */
void regPing(kfly_comm::datagrams::Ping);
void regSystemStrings(kfly_comm::datagrams::SystemStrings msg);
void regSystemStatus(kfly_comm::datagrams::SystemStatus msg);
void regRCInputSettings(kfly_comm::datagrams::RCInputSettings msg);
void regRCValues(kfly_comm::datagrams::RCValues msg);
void regRCOutputSettings(kfly_comm::datagrams::RCOutputSettings msg);
void regControlSignals(kfly_comm::datagrams::ControlSignals msg);
void regChannelMix(kfly_comm::datagrams::ChannelMix msg);
void regArmSettings(kfly_comm::datagrams::ArmSettings msg);
void regRateControllerData(kfly_comm::datagrams::RateControllerData msg);
void regAttitudeControllerData(kfly_comm::datagrams::AttitudeControllerData msg);
void regControllerLimits(kfly_comm::datagrams::ControllerLimits msg);
void regIMUCalibration(kfly_comm::datagrams::IMUCalibration msg);
void regRawIMUData(kfly_comm::datagrams::RawIMUData msg);
void regIMUData(kfly_comm::datagrams::IMUData msg);
void regControlFilterSettings(kfly_comm::datagrams::ControlFilterSettings msg);
private slots:
void parseSerialData();
void handleSerialError(QSerialPort::SerialPortError error);
void transmit_buffer();
signals:
void sigConnectionError(void);
void sigPing(void);
void sigSystemStrings(kfly_comm::datagrams::SystemStrings msg);
void sigSystemStatus(kfly_comm::datagrams::SystemStatus msg);
void sigRCInputSettings(kfly_comm::datagrams::RCInputSettings msg);
void sigRCValues(kfly_comm::datagrams::RCValues msg);
void sigRCOutputSettings(kfly_comm::datagrams::RCOutputSettings msg);
void sigControlSignals(kfly_comm::datagrams::ControlSignals msg);
void sigChannelMix(kfly_comm::datagrams::ChannelMix msg);
void sigArmSettings(kfly_comm::datagrams::ArmSettings msg);
void sigRateControllerData(kfly_comm::datagrams::RateControllerData msg);
void sigAttitudeControllerData(kfly_comm::datagrams::AttitudeControllerData msg);
void sigControllerLimits(kfly_comm::datagrams::ControllerLimits msg);
void sigIMUCalibration(kfly_comm::datagrams::IMUCalibration msg);
void sigRawIMUData(kfly_comm::datagrams::RawIMUData msg);
void sigIMUData(kfly_comm::datagrams::IMUData msg);
void sigControlFilterSettings(kfly_comm::datagrams::ControlFilterSettings msg);
};
#endif // COMMUNICATION_H
| 37.321839 | 85 | 0.773637 |
833f0b4456427ee284ace5590d21daef2de62247 | 160 | h | C | Example/Pods/Target Support Files/SQLCipher/SQLCipher-umbrella.h | lingen/PandaFMDB | a76251063b6eac3f367e2299e56f9a61b053f584 | [
"MIT"
] | 5 | 2017-05-15T10:15:52.000Z | 2018-06-12T05:05:51.000Z | Pods/Target Support Files/SQLCipher/SQLCipher-umbrella.h | ankitthakur/LocationManager | 60bf02e85eccf8e258c02f8916bb3836e66986b4 | [
"MIT"
] | null | null | null | Pods/Target Support Files/SQLCipher/SQLCipher-umbrella.h | ankitthakur/LocationManager | 60bf02e85eccf8e258c02f8916bb3836e66986b4 | [
"MIT"
] | null | null | null | #import <UIKit/UIKit.h>
#import "sqlite3.h"
FOUNDATION_EXPORT double SQLCipherVersionNumber;
FOUNDATION_EXPORT const unsigned char SQLCipherVersionString[];
| 20 | 63 | 0.825 |
8346687a6bde2937830f5d15f1c79bdc92e2affc | 264 | c | C | Easy Challenges/Challenge 0040 Easy/solutions/solution.c | FreddieV4/DailyProgrammerChallenges | f231fc4728b55ec9ac72d66e5d7ecc6b9377b9cc | [
"MIT"
] | 331 | 2016-03-04T02:13:43.000Z | 2017-10-18T09:07:53.000Z | Easy Challenges/Challenge 0040 Easy/solutions/solution.c | freddiev4/dailyprogrammerchallenges | f231fc4728b55ec9ac72d66e5d7ecc6b9377b9cc | [
"MIT"
] | 64 | 2016-03-15T23:46:42.000Z | 2017-10-19T18:25:30.000Z | Easy Challenges/Challenge 0040 Easy/solutions/solution.c | FreddieV4/DailyProgrammerChallenges | f231fc4728b55ec9ac72d66e5d7ecc6b9377b9cc | [
"MIT"
] | 116 | 2016-03-11T19:59:12.000Z | 2017-10-19T18:23:37.000Z | #include <stdio.h>
static int top = 1000;
int print_numbers(void);
int main(int argc, char **argv){
print_numbers();
return 0;
}
int print_numbers(void){
static int i = 0;
i++;
printf("%d\n", i);
return (i - top) && print_numbers();
}
| 13.894737 | 40 | 0.587121 |
835786ec146b53fcd8c55e8cd3654da805f696fc | 1,010 | c | C | lib/grm/datatype/string_list.c | cfelder/gr | 404ec4dff9cb5973d61ec842e5c71e1bb0618040 | [
"RSA-MD"
] | 137 | 2017-06-05T04:03:23.000Z | 2022-03-26T02:43:19.000Z | lib/grm/datatype/string_list.c | cfelder/gr | 404ec4dff9cb5973d61ec842e5c71e1bb0618040 | [
"RSA-MD"
] | 108 | 2019-01-23T11:49:07.000Z | 2022-03-31T15:09:50.000Z | lib/grm/datatype/string_list.c | cfelder/gr | 404ec4dff9cb5973d61ec842e5c71e1bb0618040 | [
"RSA-MD"
] | 16 | 2019-02-05T07:44:30.000Z | 2021-10-01T17:56:45.000Z | /* ######################### includes ############################################################################### */
#ifdef __unix__
#define _POSIX_C_SOURCE 200112L
#endif
#include "gkscore.h"
#include "string_list_int.h"
/* ######################### implementation ######################################################################### */
/* ========================= methods ================================================================================ */
/* ------------------------- string_list ---------------------------------------------------------------------------- */
DEFINE_LIST_METHODS(string)
error_t string_list_entry_copy(string_list_entry_t *copy, const string_list_const_entry_t entry)
{
string_list_entry_t _copy;
_copy = gks_strdup(entry);
if (_copy == NULL)
{
return ERROR_MALLOC;
}
*copy = _copy;
return NO_ERROR;
}
error_t string_list_entry_delete(string_list_entry_t entry)
{
free(entry);
return NO_ERROR;
}
#undef DEFINE_LIST_METHODS
| 24.634146 | 120 | 0.429703 |
ebecb17605a63faa80239c92d072e848ff698eac | 380 | h | C | utils/test.h | ondra-novak/tempe | faaae56c186597a090ece9afa66ad0388ee69a88 | [
"MIT"
] | null | null | null | utils/test.h | ondra-novak/tempe | faaae56c186597a090ece9afa66ad0388ee69a88 | [
"MIT"
] | null | null | null | utils/test.h | ondra-novak/tempe | faaae56c186597a090ece9afa66ad0388ee69a88 | [
"MIT"
] | null | null | null | /*
* Main.h
*
* Created on: 6.7.2012
* Author: ondra
*/
#ifndef MAIN_H_
#define MAIN_H_
#include <lightspeed/base/framework/app.h>
#include <tempe/interfaces.h>
namespace TempeTest {
using namespace LightSpeed;
using namespace Tempe;
class Main: public App {
public:
virtual integer start(const Args &args) ;
};
} /* namespace TempeTest */
#endif /* MAIN_H_ */
| 14.074074 | 42 | 0.686842 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.