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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c457cdb6132c1672471f2572d8964352da580cfe | 1,776 | h | C | include/PlatformDll/types.h | MisterVento3/SteelEngine | 403511b53b6575eb869b4ccfbda18514f0838e8d | [
"MIT"
] | 3 | 2017-05-10T10:58:17.000Z | 2018-10-30T09:50:26.000Z | include/PlatformDll/types.h | mVento3/SteelEngine | 403511b53b6575eb869b4ccfbda18514f0838e8d | [
"MIT"
] | 3 | 2017-05-09T21:17:09.000Z | 2020-02-24T14:46:22.000Z | include/PlatformDll/types.h | mVento3/SteelEngine | 403511b53b6575eb869b4ccfbda18514f0838e8d | [
"MIT"
] | null | null | null | #pragma once
// Big thanks to John Jackson: https://github.com/MrFrenik
#include <stdlib.h> // malloc, realloc, free ( for now )
#include <stdint.h> // standard types
#include <limits.h> // INT32_MAX, UINT32_MAX
#include <string.h> // memset
#include <float.h> // FLT_MAX
#include "RuntimeReflection/Macro.h"
SE_DONT_PARSE
#define _inline static inline
#define _local_persist static
#define _global static
#if ( defined _WIN32 || defined _WIN64 )
#define _force_inline static __forceinline
#elif ( defined __APPLE__ || defined _APPLE )
#define _force_inline static __attribute__((always_inline))
#else
#define _force_inline _inline
#endif
/*============================================================
// Resource Declarations
============================================================*/
#define se_resource( type )\
se_resource_##type
// Strongly typed declarations for resource handles (slot array handles)
#define se_declare_resource_type( type )\
typedef struct se_resource( type ) {\
u32 id;\
} se_resource( type );\
/*============================================================
// Primitives
============================================================*/
#ifndef __cplusplus
#define false 0
#define true 1
#endif
typedef size_t usize;
#ifdef __cplusplus
typedef bool b8;
#else
typedef _Bool b8;
#endif
typedef uint8_t u8;
typedef int8_t s8;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef s32 b32;
typedef uint64_t u64;
typedef int64_t s64;
typedef float f32;
typedef double f64;
typedef const char* const_str;
#define u16_max UINT16_MAX
#define u32_max UINT32_MAX
#define s32_max INT32_MAX
#define f32_max FLT_MAX
#define f32_min FLT_MIN | 24 | 72 | 0.633446 |
e25e38ca6bade1f9d9b60f5cd52de9ebf89e2076 | 2,141 | h | C | MessageKit/Example/Pods/MessageLib/MessageLib/Classes/Model/CTMSGConversation.h | fireJera/IM | 255d50a1c3ef8faa1a4290b299adf5999badd916 | [
"MIT"
] | null | null | null | MessageKit/Example/Pods/MessageLib/MessageLib/Classes/Model/CTMSGConversation.h | fireJera/IM | 255d50a1c3ef8faa1a4290b299adf5999badd916 | [
"MIT"
] | null | null | null | MessageKit/Example/Pods/MessageLib/MessageLib/Classes/Model/CTMSGConversation.h | fireJera/IM | 255d50a1c3ef8faa1a4290b299adf5999badd916 | [
"MIT"
] | null | null | null | //
// CTMSGConversation.h
// ChatMessageKit
//
// Created by Jeremy on 2019/4/2.
// Copyright © 2019 JersiZhu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CTMSGEnumDefine.h"
@class CTMSGMessageContent;
NS_ASSUME_NONNULL_BEGIN
@interface CTMSGConversation : NSObject <NSCoding>
/*!
会话类型
*/
@property(nonatomic, assign) CTMSGConversationType conversationType;
/*!
目标会话ID
*/
@property(nonatomic, strong) NSString *targetId;
/*!
会话的标题
*/
@property(nonatomic, strong) NSString *conversationTitle;
/*!
会话中的未读消息数量
*/
@property(nonatomic, assign) int unreadMessageCount;
/*!
是否置顶,默认值为NO
@discussion
如果设置了置顶,在MessageKit的CTMSGConversationListViewController中会将此会话置顶显示。
*/
@property(nonatomic, assign) BOOL isTop;
/*!
置顶时间
*/
@property(nonatomic, assign) long long topTime;
/*!
会话中最后一条消息的接收状态
*/
@property(nonatomic, assign) CTMSGReceivedStatus receivedStatus;
/*!
会话中最后一条消息的发送状态
*/
@property(nonatomic, assign) CTMSGSentStatus sentStatus;
/*!
会话中最后一条消息的接收时间(Unix时间戳、毫秒)
*/
@property(nonatomic, assign) long long receivedTime;
/*!
会话中最后一条消息的发送时间(Unix时间戳、毫秒)
*/
@property(nonatomic, assign) long long sentTime;
/*!
会话中存在的草稿
*/
@property(nonatomic, strong) NSString *draft;
/*!
会话中最后一条消息的类型名
*/
@property(nonatomic, strong) NSString *objectName;
/*!
会话中最后一条消息的发送者用户ID
*/
@property(nonatomic, strong) NSString *senderUserId;
/*!
会话中最后一条消息的消息ID
*/
@property(nonatomic, assign) long lastestMessageId;
/*!
会话中最后一条消息的内容
*/
@property(nonatomic, strong) CTMSGMessageContent *lastestMessage;
/*!
会话中最后一条消息的方向
*/
@property(nonatomic, assign) CTMSGMessageDirection lastestMessageDirection;
/*!
会话中最后一条消息的json Dictionary
@discussion 此字段存放最后一条消息内容中未编码的json数据。
SDK内置的消息,如果消息解码失败,默认会将消息的内容存放到此字段;如果编码和解码正常,此字段会置为nil。
*/
@property(nonatomic, strong) NSDictionary *jsonDict;
/*!
最后一条消息的全局唯一ID
@discussion 服务器消息唯一ID(在同一个Appkey下全局唯一)
*/
@property(nonatomic, strong) NSString *lastestMessageUId;
/*!
会话中是否存在被@的消息
@discussion 在清除会话未读数(clearMessagesUnreadStatus:targetId:)的时候,会将此状态置成 NO。
*/
@property(nonatomic, assign) BOOL hasUnreadMentioned;
@end
NS_ASSUME_NONNULL_END
| 16.992063 | 75 | 0.75432 |
eb6037c352981e7c01a8e5a45be91166cfe75f5d | 2,779 | h | C | framework/include_stst/vulkan_resource_bundle.h | johannesugb/origin_of_cg_base | 6f07703b051b8b360cb1ce8f70863f3838675964 | [
"MIT"
] | 1 | 2020-01-06T19:29:25.000Z | 2020-01-06T19:29:25.000Z | framework/include_stst/vulkan_resource_bundle.h | johannesugb/please_render | 6f07703b051b8b360cb1ce8f70863f3838675964 | [
"MIT"
] | 14 | 2018-08-29T11:51:32.000Z | 2019-08-08T16:09:33.000Z | framework/include_stst/vulkan_resource_bundle.h | johannesugb/please_render | 6f07703b051b8b360cb1ce8f70863f3838675964 | [
"MIT"
] | 1 | 2019-02-20T07:30:33.000Z | 2019-02-20T07:30:33.000Z | #pragma once
#include <unordered_map>
#include "vulkan_resource_bundle_layout.h"
#include "vulkan_texture.h"
#include "vulkan_buffer.h"
namespace cgb {
class vulkan_resource_bundle_group;
class vulkan_resource_bundle
{
friend class vulkan_resource_bundle_group;
public:
virtual ~vulkan_resource_bundle();
void add_image_resource(uint32_t binding, vk::ImageLayout imageLayout, std::shared_ptr<vulkan_texture> texture,
uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
void add_dynamic_image_resource(uint32_t binding, vk::ImageLayout imageLayout, std::vector<std::shared_ptr<vulkan_texture>> textures,
uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
void add_buffer_resource(uint32_t binding, std::shared_ptr<vulkan_buffer> buffer, vk::DeviceSize range, vk::DeviceSize offset = 0, uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
void add_dynamic_buffer_resource(uint32_t binding, std::vector<std::shared_ptr<vulkan_buffer>> buffers, vk::DeviceSize range, vk::DeviceSize offset = 0, uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
std::vector<vk::DescriptorSet> get_descriptor_sets() { return mDescriptorSets; }
vk::DescriptorSet& get_descriptor_set() { return mDescriptorSets[vulkan_context::instance().currentFrame]; }
private:
vulkan_resource_bundle(std::shared_ptr<vulkan_resource_bundle_layout> resourceBundleLayout, bool dynamicResource);
std::shared_ptr<vulkan_resource_bundle_layout> mResourceBundleLayout;
std::vector<vk::DescriptorSet> mDescriptorSets;
// TODO maybe clear after descriptor set creation
std::vector<std::vector<vk::WriteDescriptorSet>> mDescriptorWrites;
std::unordered_map<uint32_t, std::vector<std::shared_ptr<vulkan_texture>>> mTextureMap;
std::unordered_map<uint32_t, std::vector<std::shared_ptr<vulkan_buffer>>> mBufferMap;
std::unordered_map<uint32_t, std::vector<vk::DescriptorImageInfo>> mDescriptorImageInfoMap;
std::unordered_map<uint32_t, std::vector<vk::DescriptorBufferInfo>> mDescriptorBufferInfoMap;
vk::WriteDescriptorSet& create_image_resource_descriptor_write(uint32_t binding, vk::ImageLayout imageLayout, std::shared_ptr<vulkan_texture> texture,
uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
vk::WriteDescriptorSet& create_buffer_resource_descriptor_write(uint32_t binding, std::shared_ptr<vulkan_buffer> buffer, vk::DeviceSize range, vk::DeviceSize offset = 0, uint32_t dstArrayElement = 0, uint32_t descriptorCount = 1);
// specifies if this resource bundle contains dynamic resources
// e.g. resources which are updated on a per frame basis
bool mDynamicResource;
size_t get_resource_count() { return (mDynamicResource) ? vulkan_context::instance().dynamicRessourceCount : 1; };
};
} | 46.316667 | 232 | 0.797049 |
ac24446146728619e64b323325209c403103029a | 3,399 | c | C | Validation/pyFrame3DD-master/gcc-master/gcc/testsuite/c-c++-common/goacc/host_data-1.c | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/testsuite/c-c++-common/goacc/host_data-1.c | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/testsuite/c-c++-common/goacc/host_data-1.c | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | /* Test valid use of host_data directive. */
/* { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } */
int v1[3][3];
void
f (void)
{
#pragma acc host_data use_device(v1)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(v1\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(v1\\)$" 1 "gimple" } } */
;
#pragma acc host_data use_device(v1) if_present
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data if_present use_device_ptr\\(v1\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data if_present use_device_ptr\\(if_present:v1\\)$" 1 "gimple" } } */
;
}
void bar (float *, float *);
void
foo (float *x, float *y, float *yy)
{
int n = 1 << 10;
#pragma acc data create(x[0:n])
{
bar (x, y);
/* This should fail at run time because y is not mapped. */
#pragma acc host_data use_device(x,y)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(y\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(y\\) use_device_ptr\\(x\\)$" 1 "gimple" } } */
bar (x, y);
/* y is still not mapped, but this should not fail at run time but
continue execution with y remaining as the host address. */
#pragma acc host_data use_device(x,y) if_present
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data if_present use_device_ptr\\(y\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data if_present use_device_ptr\\(if_present:y\\) use_device_ptr\\(if_present:x\\)$" 1 "gimple" } } */
bar (x, y);
#pragma acc data copyout(yy[0:n])
{
#pragma acc host_data use_device(x,yy)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "gimple" } } */
bar (x, yy);
#pragma acc host_data use_device(x,yy) if_present
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data if_present use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data if_present use_device_ptr\\(if_present:yy\\) use_device_ptr\\(if_present:x\\)$" 1 "gimple" } } */
bar (x, yy);
#pragma acc host_data use_device(x,yy) if(x != yy)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data if\\(x \\!= yy\\) use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data if\\(D\\.\[0-9\]+\\) use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "gimple" } } */
bar (x, yy);
#pragma acc host_data use_device(x,yy) if_present if(x == yy)
/* { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data if\\(x == yy\\) if_present use_device_ptr\\(yy\\) use_device_ptr\\(x\\)$" 1 "original" } }
{ dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data if\\(D\\.\[0-9\]+\\) if_present use_device_ptr\\(if_present:yy\\) use_device_ptr\\(if_present:x\\)$" 1 "gimple" } } */
bar (x, yy);
}
}
}
| 49.26087 | 193 | 0.639011 |
fefc14294fb64879df63ff83ce7e464504a108b4 | 334 | h | C | src/component/touch/drag/OnDragEvent.h | daysofwonder/cocos2d-x-common | a2a5e9e1e6ade01242c4d7269f507549df7feb0d | [
"Apache-2.0"
] | null | null | null | src/component/touch/drag/OnDragEvent.h | daysofwonder/cocos2d-x-common | a2a5e9e1e6ade01242c4d7269f507549df7feb0d | [
"Apache-2.0"
] | null | null | null | src/component/touch/drag/OnDragEvent.h | daysofwonder/cocos2d-x-common | a2a5e9e1e6ade01242c4d7269f507549df7feb0d | [
"Apache-2.0"
] | 1 | 2021-07-28T01:25:24.000Z | 2021-07-28T01:25:24.000Z | /*
* OnDragEvent.h
*
* Created on: Feb 4, 2015
* Author: dawid
*/
#pragma once
#include <predeclare.h>
#include <Vec.h>
namespace Dexode
{
namespace Component
{
struct OnDragEvent
{
cocos2d::CCTouch* touch;
cocos2d::CCNode* node;
cocos2d::Vec2 startPosition;
};
} /* namespace Component */
} /* namespace Dexode */
| 12.37037 | 29 | 0.664671 |
3d4ccb1a2c5027837b4ba4ccbde271b415434390 | 1,146 | c | C | queue/linkQueue.c | erqidiy/data-structure | 6e24c36ae85c424c8511e9b1ae3f94013871ebaf | [
"MIT"
] | 2 | 2019-08-22T02:08:58.000Z | 2019-08-28T15:00:39.000Z | queue/linkQueue.c | erqidiy/data-structure | 6e24c36ae85c424c8511e9b1ae3f94013871ebaf | [
"MIT"
] | null | null | null | queue/linkQueue.c | erqidiy/data-structure | 6e24c36ae85c424c8511e9b1ae3f94013871ebaf | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int data;
struct linkNode *next;
}linkNode;
typedef struct {
linkNode *front, *rear;
}linkQueue, *queue;
queue initQueue() {
linkNode *head = malloc(sizeof(linkNode));
head->next = NULL;
queue q = malloc(sizeof(linkQueue));
q->front = q->rear = head;
return q;
}
bool isEmpty(queue q) {
return q->front == q->rear;
}
void enQueue(queue q, int value) {
printf("EnQueue value = %d...\n", value);
linkNode *aws = (linkNode *) malloc(sizeof(linkNode));
aws->data = value;
aws->next == NULL;
q->rear->next = aws;
q->rear = aws;
}
bool deQueue(queue q, int *value) {
if(isEmpty(q)) {
printf("The queue is empty. DeQueue failed.\n");
return false;
}
linkNode * head = q->front->next;
*value = head->data;
q->front->next = head->next;
// just one node left
if(head == q->rear) {
q->rear = q->front;
}
free(head);
return true;
}
int main() {
queue q = initQueue();
int i, value;
for(i = 1; i <= 10; i++)
enQueue(q, i * 10);
for(i = 1; i <= 5; i++)
if(deQueue(q, &value))
printf("DeQueue value: %d\n", value);
return 0;
}
| 16.852941 | 55 | 0.61082 |
ceaabc0ec1aad8735557c356b2229754902cecb9 | 644 | h | C | app/application.h | matejus/bcf-generic-node | ae52f6d63bd7c55194c7e43a66f0ef43e9796c75 | [
"MIT"
] | null | null | null | app/application.h | matejus/bcf-generic-node | ae52f6d63bd7c55194c7e43a66f0ef43e9796c75 | [
"MIT"
] | null | null | null | app/application.h | matejus/bcf-generic-node | ae52f6d63bd7c55194c7e43a66f0ef43e9796c75 | [
"MIT"
] | null | null | null | #ifndef _APPLICATION_H
#define _APPLICATION_H
#ifndef FIRMWARE
#define FIRMWARE "generic-node"
#endif
#ifndef VERSION
#define VERSION "vdev"
#endif
#include <bcl.h>
typedef struct
{
uint8_t channel;
float value;
bc_tick_t next_pub;
} event_param_t;
typedef struct
{
bc_tag_temperature_t self;
event_param_t param;
} temperature_tag_t;
typedef struct
{
bc_tag_humidity_t self;
event_param_t param;
} humidity_tag_t;
typedef struct
{
bc_tag_lux_meter_t self;
event_param_t param;
} lux_meter_tag_t;
typedef struct
{
bc_tag_barometer_t self;
event_param_t param;
} barometer_tag_t;
#endif
| 12.627451 | 31 | 0.73913 |
a853adef528d3f46745898852b7e56934377ce59 | 628 | h | C | src/engine/basemanager.h | nsweb/bigfx | d52d956cd2afda308581c14a912f407b3bb37f52 | [
"MIT"
] | null | null | null | src/engine/basemanager.h | nsweb/bigfx | d52d956cd2afda308581c14a912f407b3bb37f52 | [
"MIT"
] | null | null | null | src/engine/basemanager.h | nsweb/bigfx | d52d956cd2afda308581c14a912f407b3bb37f52 | [
"MIT"
] | null | null | null |
#ifndef BB_BASEMANAGER_H
#define BB_BASEMANAGER_H
#define STATIC_MANAGER_H( Manager ) \
private:\
static Manager* m_pStaticInstance;\
public:\
static Manager* GetStaticInstance() { return m_pStaticInstance; }
#define STATIC_MANAGER_CPP( Manager ) \
Manager* Manager::m_pStaticInstance = NULL;
namespace bigfx
{
class BIGFX_API BaseManager
{
public:
BaseManager();
virtual ~BaseManager();
virtual void Create();
virtual void Destroy();
virtual void Tick( struct TickContext& tick_ctxt );
virtual void _Render( struct RenderContext& render_ctxt );
};
} /* namespace bigfx */
#endif // BB_BASEMANAGER_H | 18.470588 | 67 | 0.745223 |
6dbbccbf192e724050c950a3560e6937b12dcf30 | 11,955 | c | C | src/tests/comp310_a2_test1.c | vladglv/OS-kv-store | 6d6aed6e9cbec634cf7316301c58bcaec284212f | [
"MIT"
] | 2 | 2021-03-22T05:44:40.000Z | 2021-06-11T12:32:45.000Z | src/tests/comp310_a2_test1.c | vladglv/OS-kv-store | 6d6aed6e9cbec634cf7316301c58bcaec284212f | [
"MIT"
] | null | null | null | src/tests/comp310_a2_test1.c | vladglv/OS-kv-store | 6d6aed6e9cbec634cf7316301c58bcaec284212f | [
"MIT"
] | null | null | null | /* Written by Xiru Zhu
* This is for testing your assignment 2.
*/
#include "comp310_a2_test.h"
void kill_shared_mem() {
// In case it already exists
shm_unlink(__TEST_SHARED_MEM_NAME__);
}
void intHandler(int dummy) {
UNUSED(dummy);
kv_delete_db();
exit(0);
}
void read_write_test(char** keys_buf,
char*** data_buf,
int elem_num[__TEST_MAX_KEY__],
int i,
int* errors) {
int temp_flag = -1;
char* temp;
generate_string(data_buf[i][elem_num[i]], __TEST_MAX_DATA_LENGTH__);
generate_key(keys_buf[i], __TEST_MAX_KEY_SIZE__, keys_buf, i + 1);
temp_flag = kv_store_write(keys_buf[i], data_buf[i][elem_num[i]]);
temp = kv_store_read(keys_buf[i]);
if(temp == NULL || temp_flag != 0) {
printf("Gave NULL when value should be there or write failed\n");
errors++;
} else if(strcmp(temp, data_buf[i][elem_num[i]]) != 0) {
printf(
"Read : %s\nShould have read %s\n", temp, data_buf[i][elem_num[i]]);
errors++;
}
elem_num[i]++;
free(temp);
}
void write_test(char** keys_buf,
char*** data_buf,
int elem_num[__TEST_MAX_KEY__],
int k,
int* errors) {
int temp_flag = -1;
printf("-----------Attempting Writes ROUND %d/%d-----------\n",
k + 1,
__TEST_MAX_POD_ENTRY__);
for(int i = 0; i < __TEST_MAX_KEY__; i++) {
generate_unique_data(data_buf[i][elem_num[i]],
(rand() + 5) % __TEST_MAX_DATA_LENGTH__,
data_buf[i],
k);
temp_flag = kv_store_write(keys_buf[i], data_buf[i][elem_num[i]]);
if(temp_flag != 0) {
printf("Write failed\n");
*errors += 1;
}
elem_num[i]++;
}
printf("-----------Error Count: %d-----------\n\n", *errors);
}
void read_test(char** keys_buf,
char*** data_buf,
int elem_num[__TEST_MAX_KEY__],
int expected_result[__TEST_MAX_POD_ENTRY__][__TEST_MAX_KEY__],
int k,
int* errors) {
int temp_flag = -1;
char* temp;
printf("-----------Attempting Reads ROUND %d/%d-----------\n",
k + 1,
__TEST_MAX_POD_ENTRY__);
for(int i = 0; i < __TEST_MAX_KEY__; i++) {
temp = kv_store_read(keys_buf[i]);
if(temp == NULL) {
printf(
"This should not return NULL. All these keys do have values\n");
*errors += 1;
continue;
}
temp_flag = -1;
for(int j = 0; j < elem_num[i]; j++) {
if(strcmp(temp, data_buf[i][j]) == 0) {
temp_flag = j;
break;
}
}
if(temp_flag == -1) {
printf("No Value %s Stored at key %s\n", temp, keys_buf[i]);
*errors += 1;
} else {
expected_result[k][i] = temp_flag;
}
free(temp);
}
printf("-----------Error Count: %d-----------\n\n", *errors);
}
void get_patterns(int expected_result[__TEST_MAX_POD_ENTRY__][__TEST_MAX_KEY__],
int i,
int* patterns,
int* pattern_length,
int* errors) {
*pattern_length = 1;
int min_pattern = __TEST_MAX_POD_ENTRY__ + 1;
int min_index = 0;
int pattern_index;
int all_same_flag = 1;
memset(patterns,
__TEST_MAX_POD_ENTRY__ + 1,
__TEST_MAX_POD_ENTRY__ * sizeof(int));
// Find Pattern
for(int k = 0; k < __TEST_MAX_POD_ENTRY__; k++) {
if(min_pattern > expected_result[k][i]) {
min_pattern = expected_result[k][i];
min_index = k;
}
}
patterns[0] = min_pattern;
for(int k = 1; k < __TEST_MAX_POD_ENTRY__; k++) {
pattern_index = (k + min_index) % __TEST_MAX_POD_ENTRY__;
if(patterns[0] == expected_result[pattern_index][i]) {
break;
} else {
patterns[k] = expected_result[pattern_index][i];
*pattern_length += 1;
}
}
// Test for extreme collision
for(int k = 1; k < __TEST_MAX_POD_ENTRY__; k++) {
if(expected_result[0][i] != expected_result[k][i]) {
all_same_flag = 0;
break;
}
}
if(all_same_flag) {
printf("Only returning a single value for each key. There should be "
"multiple unless extreme collision. \n");
*errors += __TEST_MAX_POD_ENTRY__;
}
}
void
read_order_test(int expected_result[__TEST_MAX_POD_ENTRY__][__TEST_MAX_KEY__],
int i,
int* patterns,
int pattern_length,
int* errors) {
// Check Read Order
int FIFO_TEST[pattern_length];
int start_index = 0;
for(int k = 0; k < pattern_length; k++) {
if(expected_result[0][i] == patterns[k]) {
start_index = k;
break;
}
}
for(int k = 0; k < __TEST_MAX_POD_ENTRY__; k++) {
if(expected_result[k][i] !=
patterns[(k + start_index) % pattern_length]) {
printf("Invalid Ordering ... %d %d %d\n",
pattern_length,
patterns[pattern_length - 1],
expected_result[k][i]);
errors++;
printf("Current Pattern: ");
for(int j = 0; j < __TEST_MAX_POD_ENTRY__; j++) {
printf("%d, ", expected_result[j][i]);
}
printf("\n");
break;
}
}
memset(FIFO_TEST, -1, pattern_length * sizeof(int));
// - BUG: pattern_length?
for(int i = 0; i < pattern_length; i++) {
int v = __TEST_MAX_POD_ENTRY__ - 1 - patterns[i];
if(v >= 0 && v < pattern_length)
FIFO_TEST[v] = 1;
}
for(int i = 0; i < pattern_length; i++) {
if(FIFO_TEST[i] != 1) {
printf("Error! Missing value %d This should have been read\n",
__TEST_MAX_POD_ENTRY__ - 1 - i);
errors++;
}
}
}
void
read_all_test(char** keys_buf,
char*** data_buf,
int expected_result[__TEST_MAX_POD_ENTRY__][__TEST_MAX_KEY__],
int i,
int* patterns,
int pattern_length,
int* errors) {
// Read All tests
char** read_all;
int start_index = 0;
int total_read = 0;
read_all = kv_store_read_all(keys_buf[i]);
if(read_all == NULL) {
printf("No Value returned by read all\n");
*errors += 1;
} else {
for(int k = 0; k < pattern_length; k++) {
if(strcmp(read_all[0], data_buf[i][patterns[k]]) == 0) {
start_index = k;
break;
}
}
for(int k = 0;; k++) {
if(read_all[k] == NULL) {
break;
} else {
total_read++;
}
}
if(total_read != pattern_length) {
printf("Invalid Read Length Based on Pattern Analysis\n");
*errors += total_read > pattern_length ?
total_read - pattern_length :
pattern_length - total_read;
}
for(int k = 0;
k < (total_read < pattern_length ? total_read : pattern_length);
k++) {
if(strcmp(
read_all[k],
data_buf[i][patterns[(k + start_index) % pattern_length]]) !=
0) {
printf("Invalid Ordering ... %d %d %d\n",
pattern_length,
patterns[pattern_length - 1],
expected_result[k][i]);
*errors += 1;
printf("Current Pattern: ");
for(int j = 0; j < __TEST_MAX_POD_ENTRY__; j++) {
printf("%d, ", expected_result[j][i]);
}
printf("\n");
break;
}
}
for(int k = 0; k < total_read; k++) {
free(read_all[k]);
}
free(read_all);
}
}
int main() {
int errors = 0;
char* temp;
char** temp_all;
char*** data_buf;
char** keys_buf;
int elem_num[__TEST_MAX_KEY__];
int expected_result[__TEST_MAX_POD_ENTRY__][__TEST_MAX_KEY__];
int patterns[__TEST_MAX_POD_ENTRY__];
int pattern_length = 0;
srand(time(NULL));
// Handlers
signal(SIGINT, intHandler);
signal(SIGQUIT, intHandler);
signal(SIGTSTP, intHandler);
kill_shared_mem();
for(int i = 0; i < __TEST_MAX_POD_ENTRY__; i++) {
memset(expected_result, -1, __TEST_MAX_KEY__ * sizeof(int));
}
memset(elem_num, 0, __TEST_MAX_KEY__ * sizeof(int));
memset(patterns,
__TEST_MAX_POD_ENTRY__ + 1,
__TEST_MAX_POD_ENTRY__ * sizeof(int));
data_buf = calloc(1, sizeof(char**) * __TEST_MAX_KEY__);
keys_buf = calloc(1, sizeof(char**) * __TEST_MAX_KEY__);
for(int i = 0; i < __TEST_MAX_KEY__; i++) {
data_buf[i] = calloc(1, sizeof(char*) * __TEST_MAX_POD_ENTRY__);
keys_buf[i] = calloc(1, sizeof(char*) * __TEST_MAX_KEY_SIZE__);
for(int j = 0; j < __TEST_MAX_POD_ENTRY__; j++) {
data_buf[i][j] =
calloc(1, sizeof(char) * __TEST_MAX_DATA_LENGTH__ + 1);
}
}
printf("-----------One Threaded Testing Of Shared Memory "
"Database-----------\n");
printf("-----------Initializing DB-----------\n");
kv_store_create(__TEST_SHARED_MEM_NAME__);
printf("-----------Attempting Invalid Read-----------\n");
temp = kv_store_read("gtx 1080ti!!!");
if(temp != NULL) {
errors++;
printf("Did not return null on invalid key. \n");
free(temp);
}
temp_all = kv_store_read_all("need that ryzen");
if(temp_all != NULL) {
errors++;
printf("Did not return null on invalid key. \n");
free(temp_all);
}
printf("-----------Attempting Simple Read and Writes-----------\n");
for(int i = 0; i < __TEST_MAX_KEY__; i++) {
read_write_test(keys_buf, data_buf, elem_num, i, &errors);
}
printf("-----------Error Count: %d-----------\n\n", errors);
for(int k = 0; k < __TEST_MAX_POD_ENTRY__ - 1; k++) {
write_test(keys_buf, data_buf, elem_num, k, &errors);
}
/*for(int k = 0; k < __TEST_MAX_KEY__; k++) {
for(int l = 0; l < __TEST_MAX_POD_ENTRY__; l++) {
printf("DATA: Bucket %d | Element %d | Key='%s' | Value='%s'\n",
k,
l,
keys_buf[k],
data_buf[k][l]);
}
}*/
//kv_store_print();
for(int k = 0; k < __TEST_MAX_POD_ENTRY__; k++) {
read_test(keys_buf, data_buf, elem_num, expected_result, k, &errors);
}
printf("-----------Testing FIFO/Read Order/Read Alls -----------\n");
for(int i = 0; i < 1; i++) {
get_patterns(expected_result, i, patterns, &pattern_length, &errors);
read_order_test(expected_result, i, patterns, pattern_length, &errors);
read_all_test(keys_buf,
data_buf,
expected_result,
i,
patterns,
pattern_length,
&errors);
}
printf("-----------Error Count: %d-----------\n\n", errors);
printf("-----------One Threaded Testing Of Shared Memory Database "
"END-----------\n");
printf("-----------TOTAL ERROR: %d-----------\n\n", errors);
for(int i = 0; i < __TEST_MAX_KEY__; i++) {
for(int j = 0; j < __TEST_MAX_POD_ENTRY__; j++) {
free(data_buf[i][j]);
}
free(data_buf[i]);
free(keys_buf[i]);
}
free(data_buf);
free(keys_buf);
kv_delete_db();
}
| 32.398374 | 80 | 0.504057 |
a318c79cf185c3eaf483dd8662e7a6594a1e6cfb | 548 | h | C | AWS iOS SDK/DDB/Models/UADDBProvisionedThroughputDescription.h | unsignedapps/ua-aws-sdk-ios | dc742b022e5f1b37a30f269ba47d4fc1f25b3f47 | [
"MIT"
] | 2 | 2015-05-21T02:49:06.000Z | 2015-08-21T04:51:16.000Z | AWS iOS SDK/DDB/Models/UADDBProvisionedThroughputDescription.h | unsignedapps/ua-aws-sdk-ios | dc742b022e5f1b37a30f269ba47d4fc1f25b3f47 | [
"MIT"
] | 1 | 2015-08-21T04:44:10.000Z | 2016-01-01T03:21:47.000Z | AWS iOS SDK/DDB/Models/UADDBProvisionedThroughputDescription.h | unsignedapps/ua-aws-sdk-ios | dc742b022e5f1b37a30f269ba47d4fc1f25b3f47 | [
"MIT"
] | null | null | null | //
// UADDBProvisionedThroughputDescription.h
// AWS iOS SDK
//
// Copyright © Unsigned Apps 2014. See License file.
// Created by Rob Amos.
//
//
#import "UADDBModel.h"
@interface UADDBProvisionedThroughputDescription : UADDBModel
@property (nonatomic, strong) NSDate *lastIncreaseDateTime;
@property (nonatomic, strong) NSDate *lastDecreaseDateTime;
@property (nonatomic, strong) NSNumber *numberOfDecreasesToday;
@property (nonatomic, strong) NSNumber *readCapacityUnits;
@property (nonatomic, strong) NSNumber *writeCapacityUnits;
@end
| 26.095238 | 63 | 0.777372 |
ed592bdb8b909776c38969a5b162d8da98cfd40e | 1,331 | h | C | src/alloy/compiler/compiler.h | hlide/xenia | a5dbec2f02f07cb9038317a5f275c6fe073d7f65 | [
"BSD-3-Clause"
] | 1 | 2016-11-18T23:13:21.000Z | 2016-11-18T23:13:21.000Z | src/alloy/compiler/compiler.h | jdarpinian/xenia | 609d7c755f260e86a865703dc1dcd6df064b1fa0 | [
"BSD-3-Clause"
] | null | null | null | src/alloy/compiler/compiler.h | jdarpinian/xenia | 609d7c755f260e86a865703dc1dcd6df064b1fa0 | [
"BSD-3-Clause"
] | null | null | null | /**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef ALLOY_COMPILER_COMPILER_H_
#define ALLOY_COMPILER_COMPILER_H_
#include <memory>
#include <vector>
#include <alloy/core.h>
#include <alloy/hir/hir_builder.h>
namespace alloy {
namespace runtime {
class Runtime;
} // namespace runtime
} // namespace alloy
namespace alloy {
namespace compiler {
class CompilerPass;
class Compiler {
public:
Compiler(runtime::Runtime* runtime);
~Compiler();
runtime::Runtime* runtime() const { return runtime_; }
Arena* scratch_arena() { return &scratch_arena_; }
void AddPass(std::unique_ptr<CompilerPass> pass);
void Reset();
int Compile(hir::HIRBuilder* builder);
private:
runtime::Runtime* runtime_;
Arena scratch_arena_;
std::vector<std::unique_ptr<CompilerPass>> passes_;
};
} // namespace compiler
} // namespace alloy
#endif // ALLOY_COMPILER_COMPILER_H_
| 24.2 | 79 | 0.563486 |
dce6540746e1304f571ac038725dc87e8de08efd | 20,768 | h | C | tms_rp/skeleton_description/calc_joint_angles/for_model01.h | SigmaHayashi/ros_tms_for_smart_previewed_reality | 4ace908bd3da0519246b3c45d0230cbd02e49da0 | [
"BSD-3-Clause"
] | null | null | null | tms_rp/skeleton_description/calc_joint_angles/for_model01.h | SigmaHayashi/ros_tms_for_smart_previewed_reality | 4ace908bd3da0519246b3c45d0230cbd02e49da0 | [
"BSD-3-Clause"
] | null | null | null | tms_rp/skeleton_description/calc_joint_angles/for_model01.h | SigmaHayashi/ros_tms_for_smart_previewed_reality | 4ace908bd3da0519246b3c45d0230cbd02e49da0 | [
"BSD-3-Clause"
] | null | null | null | #ifndef _CALC_JOINT_ANGLES_H_
#define _CALC_JOINT_ANGLES_H_
#include <math.h>
#include <vector>
#include <map>
#include <Eigen/Eigen>
#include <tms_msg_ss/Skeleton.h>
<<<<<<< HEAD
using namespace std;
typedef enum
{
=======
typedef enum {
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
SpineBase,
SpineMid,
Neck,
Head,
ShoulderLeft,
ElbowLeft,
WristLeft,
HandLeft,
ShoulderRight,
ElbowRight,
WristRight,
HandRight,
HipLeft,
KneeLeft,
AnkleLeft,
FootLeft,
HipRight,
KneeRight,
AnkleRight,
FootRight,
SpineShoulder,
HandTipLeft,
ThumbLeft,
HandTipRight,
ThumbRight,
JOINT_NUM
} JOINT_NAME;
<<<<<<< HEAD
const char *kJointName[] = {
//"WAIST_JOINT1",
//"WAIST_JOINT2",
"R_ARM_JOINT1", "R_ARM_JOINT2", "R_ARM_JOINT3", "R_ARM_JOINT4", "R_ARM_JOINT5", "R_ARM_JOINT6", "R_ARM_JOINT7",
//"R_ARM_JOINT8",
"L_ARM_JOINT1", "L_ARM_JOINT2", "L_ARM_JOINT3", "L_ARM_JOINT4", "L_ARM_JOINT5", "L_ARM_JOINT6", "L_ARM_JOINT7",
//"L_ARM_JOINT8",
"NECK_JOINT0", "NECK_JOINT1", "NECK_JOINT2", "R_LEG_JOINT1", "R_LEG_JOINT2", "R_LEG_JOINT3", "R_LEG_JOINT4",
"R_LEG_JOINT5", "R_LEG_JOINT6",
//"R_LEG_JOINT7",
"L_LEG_JOINT1", "L_LEG_JOINT2", "L_LEG_JOINT3", "L_LEG_JOINT4", "L_LEG_JOINT5", "L_LEG_JOINT6"
//"L_LEG_JOINT7",
=======
const char* kJointName[] = {
//"WAIST_JOINT1",
//"WAIST_JOINT2",
"R_ARM_JOINT1",
"R_ARM_JOINT2",
"R_ARM_JOINT3",
"R_ARM_JOINT4",
"R_ARM_JOINT5",
"R_ARM_JOINT6",
"R_ARM_JOINT7",
//"R_ARM_JOINT8",
"L_ARM_JOINT1",
"L_ARM_JOINT2",
"L_ARM_JOINT3",
"L_ARM_JOINT4",
"L_ARM_JOINT5",
"L_ARM_JOINT6",
"L_ARM_JOINT7",
//"L_ARM_JOINT8",
"NECK_JOINT0",
"NECK_JOINT1",
"NECK_JOINT2",
"R_LEG_JOINT1",
"R_LEG_JOINT2",
"R_LEG_JOINT3",
"R_LEG_JOINT4",
"R_LEG_JOINT5",
"R_LEG_JOINT6",
//"R_LEG_JOINT7",
"L_LEG_JOINT1",
"L_LEG_JOINT2",
"L_LEG_JOINT3",
"L_LEG_JOINT4",
"L_LEG_JOINT5",
"L_LEG_JOINT6"
//"L_LEG_JOINT7",
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
};
const int kModel01BaseLink = SpineMid;
// Keep consistency with kJointName
const int kJointDoF = 29;
<<<<<<< HEAD
template < class T >
int calcForModel01(const tms_msg_ss::Skeleton &in, Eigen::Matrix< T, 3, 1 > &position, Eigen::Quaternion< T > &rotation,
std::map< std::string, T > &out)
=======
template <class T>
int calcForModel01(
const tms_msg_ss::Skeleton &in,
Eigen::Matrix<T, 3, 1> &position,
Eigen::Quaternion<T> &rotation,
std::map<std::string, T> &out)
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
{
if (in.user_id < 0)
{
// Set data to disappear from environment
<<<<<<< HEAD
position = Eigen::Matrix< T, 3, 1 >(0.0, 0.0, 0.0);
rotation = Eigen::Quaternion< T >(1.0, 0.0, 0.0, 0.0);
for (int j = 0; j < kJointDoF; j++)
=======
position = Eigen::Matrix<T, 3, 1>(0.0, 0.0, 0.0);
rotation = Eigen::Quaternion<T>(1.0, 0.0, 0.0, 0.0);
for (int j=0; j < kJointDoF; j++)
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
{
out[kJointName[j]] = 0.0;
}
return -1;
}
else
{
<<<<<<< HEAD
std::vector< Eigen::Matrix< T, 3, 1 > > j;
j.resize(JOINT_NUM);
for (int i = 0; i < JOINT_NUM; i++)
{
j[i] = Eigen::Matrix< T, 3, 1 >(in.position[i].x, in.position[i].y, in.position[i].z);
}
// Calculation of position.
position = Eigen::Matrix< T, 3, 1 >(j[SpineMid][0], j[SpineMid][1], j[SpineMid][2]);
// Calculation of rotation.
Eigen::Matrix< T, 3, 1 > x, y, z;
y = ((j[SpineMid] - j[SpineBase]).cross(j[HipRight] - j[HipLeft])).normalized();
z = (j[SpineMid] - j[SpineBase]).normalized();
x = (y.cross(z)).normalized();
Eigen::Matrix< T, 3, 3 > mat;
mat << x[0], y[0], z[0], x[1], y[1], z[1], x[2], y[2], z[2];
=======
std::vector<Eigen::Matrix<T,3,1> > j;
j.resize(JOINT_NUM);
for (int i=0; i<JOINT_NUM; i++)
{
j[i] = Eigen::Matrix<T, 3, 1>(
in.position[i].x,
in.position[i].y,
in.position[i].z);
}
// Calculation of position.
position = Eigen::Matrix<T,3,1>(
j[SpineMid][0],
j[SpineMid][1],
j[SpineMid][2]);
// Calculation of rotation.
Eigen::Matrix<T, 3, 1> x,y,z;
y = ((j[SpineMid]-j[SpineBase]).cross(j[HipRight]-j[HipLeft])).normalized();
z = (j[SpineMid]-j[SpineBase]).normalized();
x = (y.cross(z)).normalized();
Eigen::Matrix<T, 3, 3> mat;
mat <<
x[0], y[0], z[0],
x[1], y[1], z[1],
x[2], y[2], z[2];
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
rotation = mat;
// Avoiding Error : I don't know why this error happens.
<<<<<<< HEAD
if (isnan(rotation.x()))
{
// It happens when gets same j[SpinMid], j[SpineBase], j[HipRight] and j[HipLeft]
rotation = Eigen::Quaternion< T >(1.0, 0.0, 0.0, 0.0);
}
// Initialize
for (int i = 0; i < kJointDoF; i++)
=======
if ( isnan(rotation.x()) )
{
// It happens when gets same j[SpinMid], j[SpineBase], j[HipRight] and j[HipLeft]
rotation = Eigen::Quaternion<T>(1.0, 0.0, 0.0, 0.0);
}
// Initialize
for (int i=0; i < kJointDoF; i++)
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
{
out[kJointName[i]] = 0.0;
}
<<<<<<< HEAD
// Calculation of joint angles.
Eigen::Matrix< T, 3, 1 > vec;
Eigen::Quaternion< T > rot[2];
// -*- Invalid calculation -*-
// if (1)//req.skeleton.confidence[SpineMid] == 2 &&
=======
// Calculation of joint angles.
Eigen::Matrix<T, 3, 1> vec;
Eigen::Quaternion<T> rot[2];
// -*- Invalid calculation -*-
//if (1)//req.skeleton.confidence[SpineMid] == 2 &&
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
// //req.skeleton.confidence[SpineBase] == 2 &&
// //req.skeleton.confidence[SpineShoulder] == 2 &&
// //req.skeleton.confidence[ShoulderLeft] == 2 &&
// //req.skeleton.confidence[ShoulderRight] == 2)
//{
// // 0:WAIST_JOINT1
// z = (j[SpineMid]-j[SpineBase]).normalized();
// x = ((j[HipLeft]-j[HipRight]).cross(j[SpineMid]-j[SpineBase])).normalized();
// y = (j[HipLeft]-j[HipRight]).normalized();
// vec = (j[SpineShoulder]-j[SpineMid]).cross(j[ShoulderLeft]-j[ShoulderRight]);
// out[kJointName[0]] = atan2(y.dot(vec),x.dot(vec));
// rot[0] = Eigen::AngleAxis<T>(out[kJointName[0]],x.cross(y));
// // 1:WAIST_JOINT2
// x = rot[0] * (j[SpineMid]-j[SpineBase]).normalized();
// y = rot[0] * ((j[SpineMid]-j[SpineBase]).cross(j[HipRight]-j[HipLeft])).normalized();
// vec = j[SpineShoulder]-j[SpineMid];
// out[kJointName[1]] = atan2(y.dot(vec),x.dot(vec));
//}
// Right Shoulder
<<<<<<< HEAD
if (in.confidence[SpineShoulder] == 2 && in.confidence[ShoulderRight] == 2 && in.confidence[SpineMid] == 2 &&
in.confidence[ElbowRight] == 2)
{
// 2:R_ARM_JOINT1
x = (j[SpineMid] - j[SpineShoulder]).normalized();
y = ((j[SpineShoulder] - j[ShoulderRight]).cross(j[SpineMid] - j[SpineShoulder])).normalized();
vec = j[ElbowRight] - j[ShoulderRight];
out["R_ARM_JOINT1"] = atan2(y.dot(vec), x.dot(vec));
rot[0] = Eigen::AngleAxis< T >(out["R_ARM_JOINT1"], x.cross(y));
// 3:R_ARM_JOINT2
x = rot[0] * (j[SpineMid] - j[SpineShoulder]).normalized();
y = rot[0] * (j[SpineShoulder] - j[ShoulderRight]).normalized();
vec = j[ElbowRight] - j[ShoulderRight];
out["R_ARM_JOINT2"] = atan2(y.dot(vec), x.dot(vec));
rot[1] = Eigen::AngleAxis< T >(out["R_ARM_JOINT2"], x.cross(y));
// 4:R_ARM_JOINT3
x = rot[1] * rot[0] * (j[ShoulderRight] - j[SpineShoulder]).normalized();
y = rot[1] * rot[0] * ((j[ShoulderRight] - j[SpineShoulder]).cross(j[SpineMid] - j[SpineShoulder])).normalized();
vec = (j[WristRight] - j[ElbowRight]).cross(j[ShoulderRight] - j[ElbowRight]);
out["R_ARM_JOINT3"] = atan2(y.dot(vec), x.dot(vec));
}
// Right Elbow
if (in.confidence[ShoulderRight] == 2 && in.confidence[ElbowRight] == 2 && in.confidence[WristRight] == 2)
{
// 5:R_ARM_JOINT4
z = (j[ShoulderRight] - j[ElbowRight]).cross(j[WristRight] - j[ElbowRight]);
y = (z.cross(j[ElbowRight] - j[ShoulderRight])).normalized();
x = (j[ElbowRight] - j[ShoulderRight]).normalized();
vec = j[WristRight] - j[ElbowRight];
out["R_ARM_JOINT4"] = atan2(y.dot(vec), x.dot(vec));
}
// Left Shoulder
if (in.confidence[SpineShoulder] == 2 && in.confidence[ShoulderLeft] == 2 && in.confidence[SpineMid] == 2 &&
in.confidence[ElbowLeft] == 2)
{
// 10:L_ARM_JOINT1
z = j[ShoulderLeft] - j[SpineShoulder];
x = (j[SpineMid] - j[SpineShoulder]).normalized();
y = (z.cross(j[SpineMid] - j[SpineShoulder])).normalized();
vec = j[ElbowLeft] - j[ShoulderLeft];
out["L_ARM_JOINT1"] = atan2(y.dot(vec), x.dot(vec));
rot[0] = Eigen::AngleAxis< T >(out["L_ARM_JOINT1"], x.cross(y));
// 11:L_ARM_JOINT2
x = rot[0] * (j[SpineMid] - j[SpineShoulder]).normalized();
y = rot[0] * (j[ShoulderLeft] - j[SpineShoulder]).normalized();
vec = j[ElbowLeft] - j[ShoulderLeft];
out["L_ARM_JOINT2"] = atan2(y.dot(vec), x.dot(vec));
rot[1] = Eigen::AngleAxis< T >(out["L_ARM_JOINT2"], x.cross(y));
// 12:L_ARM_JOINT3
x = rot[1] * rot[0] * (j[ShoulderLeft] - j[SpineShoulder]).normalized();
y = rot[1] * rot[0] * ((j[ShoulderLeft] - j[SpineShoulder]).cross(j[SpineMid] - j[SpineShoulder])).normalized();
vec = (j[ShoulderLeft] - j[ElbowLeft]).cross(j[WristLeft] - j[ElbowLeft]);
out["L_ARM_JOINT3"] = atan2(y.dot(vec), x.dot(vec));
}
// Left Elbow
if (in.confidence[SpineMid] == 2 && in.confidence[ElbowLeft] == 2 && in.confidence[WristLeft] == 2)
{
// 13:L_ARM_JOINT4
z = (j[ShoulderLeft] - j[ElbowLeft]).cross(j[WristLeft] - j[ElbowLeft]);
x = (j[ElbowLeft] - j[ShoulderLeft]).normalized();
y = (z.cross(j[ElbowLeft] - j[ShoulderLeft])).normalized();
vec = j[WristLeft] - j[ElbowLeft];
out["L_ARM_JOINT4"] = atan2(y.dot(vec), x.dot(vec));
}
// Right Hip
if (in.confidence[SpineBase] == 2 && in.confidence[SpineMid] == 2 && in.confidence[HipRight] == 2 &&
in.confidence[HipLeft] == 2 && in.confidence[ElbowRight] == 2)
{
// 20:R_LEG_JOINT1
z = j[SpineBase] - j[HipRight];
x = (j[SpineBase] - j[SpineMid]).normalized();
y = (z.cross(j[SpineBase] - j[SpineMid])).normalized();
vec = j[KneeRight] - j[HipRight];
out["R_LEG_JOINT1"] = atan2(y.dot(vec), x.dot(vec));
rot[0] = Eigen::AngleAxis< T >(out["R_LEG_JOINT1"], x.cross(y));
// 21:R_LEG_JOINT2
z = rot[0] * (j[HipRight] - j[HipLeft]).cross(j[SpineBase] - j[SpineMid]);
x = rot[0] * (j[SpineBase] - j[SpineMid]).normalized();
y = (z.cross(j[SpineBase] - j[SpineMid])).normalized();
vec = j[KneeRight] - j[HipRight];
out["R_LEG_JOINT2"] = atan2(y.dot(vec), x.dot(vec));
rot[1] = Eigen::AngleAxis< T >(out["R_LEG_JOINT2"], x.cross(y));
// 22:R_LEG_JOINT3
x = rot[1] * rot[0] * (j[HipRight] - j[HipLeft]).normalized();
y = rot[1] * rot[0] * ((j[HipRight] - j[HipLeft]).cross(j[SpineBase] - j[SpineMid])).normalized();
vec = (j[HipRight] - j[KneeRight]).cross(j[AnkleRight] - j[KneeRight]);
out["R_LEG_JOINT3"] = atan2(y.dot(vec), x.dot(vec));
}
// Right Knee
if (in.confidence[HipRight] == 2 && in.confidence[ElbowRight] == 2 && in.confidence[AnkleRight] == 2)
{
// 23:R_LEG_JOINT4
z = (j[AnkleRight] - j[KneeRight]).cross(j[HipRight] - j[KneeRight]);
x = (j[KneeRight] - j[HipRight]).normalized();
y = (z.cross(j[KneeRight] - j[HipRight])).normalized();
vec = j[AnkleRight] - j[KneeRight];
out["R_LEG_JOINT4"] = atan2(y.dot(vec), x.dot(vec));
}
// Left Hip
if (in.confidence[SpineBase] == 2 && in.confidence[SpineMid] == 2 && in.confidence[HipRight] == 2 &&
in.confidence[HipLeft] == 2 && in.confidence[ElbowLeft] == 2)
{
// 27:L_LEG_JOINT1
z = j[HipLeft] - j[SpineBase];
x = (j[SpineBase] - j[SpineMid]).normalized();
y = (z.cross(j[SpineBase] - j[SpineMid])).normalized();
vec = j[KneeLeft] - j[HipLeft];
out["L_LEG_JOINT1"] = atan2(y.dot(vec), x.dot(vec));
rot[0] = Eigen::AngleAxis< T >(out["L_LEG_JOINT1"], x.cross(y));
// 28:L_LEG_JOINT2
z = rot[0] * (j[HipRight] - j[HipLeft]).cross(j[SpineBase] - j[SpineMid]);
x = rot[0] * (j[SpineBase] - j[SpineMid]).normalized();
y = (z.cross(j[SpineBase] - j[SpineMid])).normalized();
vec = j[KneeLeft] - j[HipLeft];
out["L_LEG_JOINT2"] = atan2(y.dot(vec), x.dot(vec));
rot[1] = Eigen::AngleAxis< T >(out["L_LEG_JOINT2"], x.cross(y));
// 29:L_LEG_JOINT3
z = j[HipLeft] - j[KneeLeft];
x = rot[1] * rot[0] * (j[HipRight] - j[HipLeft]).normalized();
y = (z.cross(x)).normalized();
vec = (j[HipLeft] - j[KneeLeft]).cross(j[AnkleLeft] - j[KneeLeft]);
out["L_LEG_JOINT3"] = atan2(y.dot(vec), x.dot(vec));
}
// Left Knee
if (in.confidence[HipLeft] == 2 && in.confidence[ElbowLeft] == 2 && in.confidence[AnkleLeft] == 2)
{
// 30:L_LEG_JOINT4
z = (j[AnkleLeft] - j[KneeLeft]).cross(j[HipLeft] - j[KneeLeft]);
x = (j[KneeLeft] - j[HipLeft]).normalized();
y = (z.cross(j[KneeLeft] - j[HipLeft])).normalized();
vec = j[AnkleLeft] - j[KneeLeft];
out["L_LEG_JOINT4"] = atan2(y.dot(vec), x.dot(vec));
}
for (int i = 0; i < kJointDoF; i++)
=======
if (in.confidence[SpineShoulder] == 2 &&
in.confidence[ShoulderRight] == 2 &&
in.confidence[SpineMid] == 2 &&
in.confidence[ElbowRight] == 2)
{
// 2:R_ARM_JOINT1
x = (j[SpineMid]-j[SpineShoulder]).normalized();
y = ((j[SpineShoulder]-j[ShoulderRight]).cross(j[SpineMid]-j[SpineShoulder])).normalized();
vec = j[ElbowRight]-j[ShoulderRight];
out["R_ARM_JOINT1"] = atan2(y.dot(vec),x.dot(vec));
rot[0] = Eigen::AngleAxis<T>(out["R_ARM_JOINT1"],x.cross(y));
// 3:R_ARM_JOINT2
x = rot[0] * (j[SpineMid]-j[SpineShoulder]).normalized();
y = rot[0] * (j[SpineShoulder]-j[ShoulderRight]).normalized();
vec = j[ElbowRight]-j[ShoulderRight];
out["R_ARM_JOINT2"] = atan2(y.dot(vec),x.dot(vec));
rot[1] = Eigen::AngleAxis<T>(out["R_ARM_JOINT2"],x.cross(y));
// 4:R_ARM_JOINT3
x = rot[1] * rot[0] * (j[ShoulderRight]-j[SpineShoulder]).normalized();
y = rot[1] * rot[0] * ((j[ShoulderRight]-j[SpineShoulder]).cross(j[SpineMid]-j[SpineShoulder])).normalized();
vec = (j[WristRight]-j[ElbowRight]).cross(j[ShoulderRight]-j[ElbowRight]);
out["R_ARM_JOINT3"] = atan2(y.dot(vec),x.dot(vec));
}
// Right Elbow
if (in.confidence[ShoulderRight] == 2 &&
in.confidence[ElbowRight] == 2 &&
in.confidence[WristRight] == 2)
{
// 5:R_ARM_JOINT4
z = (j[ShoulderRight]-j[ElbowRight]).cross(j[WristRight]-j[ElbowRight]);
y = (z.cross(j[ElbowRight]-j[ShoulderRight])).normalized();
x = (j[ElbowRight]-j[ShoulderRight]).normalized();
vec = j[WristRight]-j[ElbowRight];
out["R_ARM_JOINT4"] = atan2(y.dot(vec),x.dot(vec));
}
// Left Shoulder
if (in.confidence[SpineShoulder] == 2 &&
in.confidence[ShoulderLeft] == 2 &&
in.confidence[SpineMid] == 2 &&
in.confidence[ElbowLeft] == 2)
{
// 10:L_ARM_JOINT1
z = j[ShoulderLeft]-j[SpineShoulder];
x = (j[SpineMid]-j[SpineShoulder]).normalized();
y = (z.cross(j[SpineMid]-j[SpineShoulder])).normalized();
vec = j[ElbowLeft]-j[ShoulderLeft];
out["L_ARM_JOINT1"] = atan2(y.dot(vec),x.dot(vec));
rot[0] = Eigen::AngleAxis<T>(out["L_ARM_JOINT1"],x.cross(y));
// 11:L_ARM_JOINT2
x = rot[0] * (j[SpineMid]-j[SpineShoulder]).normalized();
y = rot[0] * (j[ShoulderLeft]-j[SpineShoulder]).normalized();
vec = j[ElbowLeft]-j[ShoulderLeft];
out["L_ARM_JOINT2"] = atan2(y.dot(vec),x.dot(vec));
rot[1] = Eigen::AngleAxis<T>(out["L_ARM_JOINT2"],x.cross(y));
// 12:L_ARM_JOINT3
x = rot[1] * rot[0] * (j[ShoulderLeft]-j[SpineShoulder]).normalized();
y = rot[1] * rot[0] * ((j[ShoulderLeft]-j[SpineShoulder]).cross(j[SpineMid]-j[SpineShoulder])).normalized();
vec = (j[ShoulderLeft]-j[ElbowLeft]).cross(j[WristLeft]-j[ElbowLeft]);
out["L_ARM_JOINT3"] = atan2(y.dot(vec),x.dot(vec));
}
// Left Elbow
if(in.confidence[SpineMid] == 2 &&
in.confidence[ElbowLeft] == 2 &&
in.confidence[WristLeft] == 2)
{
// 13:L_ARM_JOINT4
z = (j[ShoulderLeft]-j[ElbowLeft]).cross(j[WristLeft]-j[ElbowLeft]);
x = (j[ElbowLeft]-j[ShoulderLeft]).normalized();
y = (z.cross(j[ElbowLeft]-j[ShoulderLeft])).normalized();
vec = j[WristLeft]-j[ElbowLeft];
out["L_ARM_JOINT4"] = atan2(y.dot(vec),x.dot(vec));
}
// Right Hip
if (in.confidence[SpineBase] == 2 &&
in.confidence[SpineMid] == 2 &&
in.confidence[HipRight] == 2 &&
in.confidence[HipLeft] == 2 &&
in.confidence[ElbowRight] == 2)
{
// 20:R_LEG_JOINT1
z = j[SpineBase]-j[HipRight];
x = (j[SpineBase]-j[SpineMid]).normalized();
y = (z.cross(j[SpineBase]-j[SpineMid])).normalized();
vec = j[KneeRight]-j[HipRight];
out["R_LEG_JOINT1"] = atan2(y.dot(vec),x.dot(vec));
rot[0] = Eigen::AngleAxis<T>(out["R_LEG_JOINT1"],x.cross(y));
// 21:R_LEG_JOINT2
z = rot[0] * (j[HipRight]-j[HipLeft]).cross(j[SpineBase]-j[SpineMid]);
x = rot[0] * (j[SpineBase]-j[SpineMid]).normalized();
y = (z.cross(j[SpineBase]-j[SpineMid])).normalized();
vec = j[KneeRight]-j[HipRight];
out["R_LEG_JOINT2"] = atan2(y.dot(vec),x.dot(vec));
rot[1] = Eigen::AngleAxis<T>(out["R_LEG_JOINT2"],x.cross(y));
// 22:R_LEG_JOINT3
x = rot[1] * rot[0] * (j[HipRight]-j[HipLeft]).normalized();
y = rot[1] * rot[0] * ((j[HipRight]-j[HipLeft]).cross(j[SpineBase]-j[SpineMid])).normalized();
vec = (j[HipRight]-j[KneeRight]).cross(j[AnkleRight]-j[KneeRight]);
out["R_LEG_JOINT3"] = atan2(y.dot(vec),x.dot(vec));
}
// Right Knee
if (in.confidence[HipRight] == 2 &&
in.confidence[ElbowRight] == 2 &&
in.confidence[AnkleRight] == 2)
{
// 23:R_LEG_JOINT4
z = (j[AnkleRight]-j[KneeRight]).cross(j[HipRight]-j[KneeRight]);
x = (j[KneeRight]-j[HipRight]).normalized();
y = (z.cross(j[KneeRight]-j[HipRight])).normalized();
vec = j[AnkleRight]-j[KneeRight];
out["R_LEG_JOINT4"] = atan2(y.dot(vec),x.dot(vec));
}
// Left Hip
if (in.confidence[SpineBase] == 2 &&
in.confidence[SpineMid] == 2 &&
in.confidence[HipRight] == 2 &&
in.confidence[HipLeft] == 2 &&
in.confidence[ElbowLeft] == 2)
{
// 27:L_LEG_JOINT1
z = j[HipLeft]-j[SpineBase];
x = (j[SpineBase]-j[SpineMid]).normalized();
y = (z.cross(j[SpineBase]-j[SpineMid])).normalized();
vec = j[KneeLeft]-j[HipLeft];
out["L_LEG_JOINT1"] = atan2(y.dot(vec),x.dot(vec));
rot[0] = Eigen::AngleAxis<T>(out["L_LEG_JOINT1"],x.cross(y));
// 28:L_LEG_JOINT2
z = rot[0] * (j[HipRight]-j[HipLeft]).cross(j[SpineBase]-j[SpineMid]);
x = rot[0] * (j[SpineBase]-j[SpineMid]).normalized();
y = (z.cross(j[SpineBase]-j[SpineMid])).normalized();
vec = j[KneeLeft]-j[HipLeft];
out["L_LEG_JOINT2"] = atan2(y.dot(vec),x.dot(vec));
rot[1] = Eigen::AngleAxis<T>(out["L_LEG_JOINT2"],x.cross(y));
// 29:L_LEG_JOINT3
z = j[HipLeft]-j[KneeLeft];
x = rot[1] * rot[0] * (j[HipRight]-j[HipLeft]).normalized();
y = (z.cross(x)).normalized();
vec = (j[HipLeft]-j[KneeLeft]).cross(j[AnkleLeft]-j[KneeLeft]);
out["L_LEG_JOINT3"] = atan2(y.dot(vec),x.dot(vec));
}
// Left Knee
if (in.confidence[HipLeft] == 2 &&
in.confidence[ElbowLeft] == 2 &&
in.confidence[AnkleLeft] == 2)
{
// 30:L_LEG_JOINT4
z = (j[AnkleLeft]-j[KneeLeft]).cross(j[HipLeft]-j[KneeLeft]);
x = (j[KneeLeft]-j[HipLeft]).normalized();
y = (z.cross(j[KneeLeft]-j[HipLeft])).normalized();
vec = j[AnkleLeft]-j[KneeLeft];
out["L_LEG_JOINT4"] = atan2(y.dot(vec),x.dot(vec));
}
for (int i=0; i < kJointDoF; i++)
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
{
out[kJointName[i]] = (isnan(out[kJointName[i]]) ? 0.0 : out[kJointName[i]]);
}
}
return 0;
}
<<<<<<< HEAD
#endif //_CALC_JOINT_ANGLES_H_
=======
#endif //_CALC_JOINT_ANGLES_H_
>>>>>>> 51ecc3540900cfe208d8c2ca1ecaf2184d407ca7
| 38.176471 | 120 | 0.586383 |
9886da3c5501f5cd67cfb7dc54a2a92e95892c89 | 558 | h | C | arduino/libraries/ComplementaryFilter/ComplementaryFilter.h | magnusoy/SelfBalancingRobot | 38c89c9a86ee1792cf0b0504d1fd32fdce69a2fa | [
"MIT"
] | null | null | null | arduino/libraries/ComplementaryFilter/ComplementaryFilter.h | magnusoy/SelfBalancingRobot | 38c89c9a86ee1792cf0b0504d1fd32fdce69a2fa | [
"MIT"
] | null | null | null | arduino/libraries/ComplementaryFilter/ComplementaryFilter.h | magnusoy/SelfBalancingRobot | 38c89c9a86ee1792cf0b0504d1fd32fdce69a2fa | [
"MIT"
] | null | null | null | #ifndef _COMPLEMENTARYFILTER_H_
#define _COMPLEMENTARYFILTER_H_
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class ComplementaryFilter {
public:
ComplementaryFilter(const double HIGHPASS_COEFFICIENT=0.8, const double LOWPASS_COEFFICIENT=0.2);
void in(double gyro, double accel, int dt);
double out(void);
void setDt(int dt);
private:
const double _HIGHPASS_COEFFICIENT;
const double LOWPASS_COEFFICIENT;
int _dt;
double _filteredOutput:
double _gyro;
double _accel;
};
#endif // _COMPLEMENTARYFILTER_H_
| 16.909091 | 98 | 0.770609 |
6c219dae94863f0bb83afb176611aaca18f7057d | 1,764 | c | C | src/asn/ngap/ASN_NGAP_ServedGUAMIList.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 16 | 2020-04-16T02:07:37.000Z | 2020-07-23T10:48:27.000Z | src/asn/ngap/ASN_NGAP_ServedGUAMIList.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 8 | 2020-07-13T17:11:35.000Z | 2020-08-03T16:46:31.000Z | src/asn/ngap/ASN_NGAP_ServedGUAMIList.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 9 | 2020-03-04T15:05:08.000Z | 2020-07-30T06:18:18.000Z | /*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* found in "asn/ngap-15.8.0.asn1"
* `asn1c -fcompound-names -pdu=all -findirect-choice -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ngap`
*/
#include "ASN_NGAP_ServedGUAMIList.h"
#include "ASN_NGAP_ServedGUAMIItem.h"
asn_per_constraints_t asn_PER_type_ASN_NGAP_ServedGUAMIList_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_ASN_NGAP_ServedGUAMIList_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_ASN_NGAP_ServedGUAMIItem,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SET_OF_specifics_t asn_SPC_ASN_NGAP_ServedGUAMIList_specs_1 = {
sizeof(struct ASN_NGAP_ServedGUAMIList),
offsetof(struct ASN_NGAP_ServedGUAMIList, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_ASN_NGAP_ServedGUAMIList = {
"ServedGUAMIList",
"ServedGUAMIList",
&asn_OP_SEQUENCE_OF,
asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1,
sizeof(asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1)
/sizeof(asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1[0]), /* 1 */
asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1, /* Same as above */
sizeof(asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1)
/sizeof(asn_DEF_ASN_NGAP_ServedGUAMIList_tags_1[0]), /* 1 */
{ 0, &asn_PER_type_ASN_NGAP_ServedGUAMIList_constr_1, SEQUENCE_OF_constraint },
asn_MBR_ASN_NGAP_ServedGUAMIList_1,
1, /* Single element */
&asn_SPC_ASN_NGAP_ServedGUAMIList_specs_1 /* Additional specs */
};
| 34.588235 | 118 | 0.753401 |
edbb04161e9b7bb52fab1c69b48a99f53bbc13b0 | 327 | h | C | KeyProject/Cores/ColaDataManager/Core.h | hoanglinhkd/KS | 45e673ba4bbda0c5ddd476c6517dcaa1769ffe02 | [
"Apache-2.0"
] | null | null | null | KeyProject/Cores/ColaDataManager/Core.h | hoanglinhkd/KS | 45e673ba4bbda0c5ddd476c6517dcaa1769ffe02 | [
"Apache-2.0"
] | null | null | null | KeyProject/Cores/ColaDataManager/Core.h | hoanglinhkd/KS | 45e673ba4bbda0c5ddd476c6517dcaa1769ffe02 | [
"Apache-2.0"
] | null | null | null | //
// Core.h
// TestAFNetWorking
//
// Created by LinhNguyen on 8/25/14.
// Copyright (c) 2014 CSC. All rights reserved.
//
#ifndef TestAFNetWorking_Core_h
#define TestAFNetWorking_Core_h
/*
Define Functions
*/
typedef void(^onSuccessReturn)(NSArray* object);
typedef void(^onFailedReturn)(NSError* error);
#endif
| 14.217391 | 48 | 0.718654 |
547949fea3b6b5619e3610b0c5a123b5a351c946 | 14,293 | c | C | thirdparty/gsl-2.7/interpolation/test2d.c | igormcoelho/optstats | 6d95cf06fbb96b1cc047fa570690c6eb3d21ece4 | [
"MIT"
] | null | null | null | thirdparty/gsl-2.7/interpolation/test2d.c | igormcoelho/optstats | 6d95cf06fbb96b1cc047fa570690c6eb3d21ece4 | [
"MIT"
] | null | null | null | thirdparty/gsl-2.7/interpolation/test2d.c | igormcoelho/optstats | 6d95cf06fbb96b1cc047fa570690c6eb3d21ece4 | [
"MIT"
] | null | null | null | /* interpolation/test2d.c
*
* Copyright 2012 David Zaslavsky
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
#include <math.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_test.h>
#include <gsl/gsl_interp.h>
#include <gsl/gsl_interp2d.h>
#include <gsl/gsl_spline2d.h>
/* tests a single evaluator function from the low-level interface */
static int
test_single_low_level(
double (*evaluator)(const gsl_interp2d *, const double[], const double[],
const double[], const double, const double,
gsl_interp_accel *, gsl_interp_accel *),
int (*evaluator_e)(const gsl_interp2d *, const double[], const double[],
const double[], const double, const double,
gsl_interp_accel *, gsl_interp_accel *, double *),
const gsl_interp2d * interp, const double xarr[], const double yarr[],
const double zarr[], const double x, const double y,
gsl_interp_accel * xa, gsl_interp_accel * ya,
const double expected_results[], size_t i)
{
if (expected_results != NULL)
{
int status;
double result = evaluator(interp, xarr, yarr, zarr, x, y, xa, ya);
gsl_test_rel(result, expected_results[i], 1e-10,
"low level %s %d", gsl_interp2d_name(interp), i);
status = evaluator_e(interp, xarr, yarr, zarr, x, y, xa, ya, &result);
if (status == GSL_SUCCESS)
{
gsl_test_rel(result, expected_results[i], 1e-10,
"low level _e %s %d", gsl_interp2d_name(interp), i);
}
}
return 0;
}
/* tests a single evaluator function from the high-level interface */
static int
test_single_high_level(
double (*evaluator)(const gsl_spline2d *, const double, const double,
gsl_interp_accel *, gsl_interp_accel *),
int (*evaluator_e)(const gsl_spline2d *, const double, const double,
gsl_interp_accel *, gsl_interp_accel *, double *),
const gsl_spline2d * interp, const double x, const double y,
gsl_interp_accel * xa, gsl_interp_accel * ya,
const double expected_results[], size_t i)
{
if (expected_results != NULL)
{
int status;
double result = evaluator(interp, x, y, xa, ya);
gsl_test_rel(result, expected_results[i], 1e-10,
"high level %s %d", gsl_spline2d_name(interp), i);
status = evaluator_e(interp, x, y, xa, ya, &result);
if (status == GSL_SUCCESS)
{
gsl_test_rel(result, expected_results[i], 1e-10,
"high level _e %s %d", gsl_spline2d_name(interp), i);
}
}
return 0;
}
/*
* Tests that a given interpolation type reproduces the data points
* it is given, and then tests that it correctly reproduces additional
* values.
*/
static int
test_interp2d(
const double xarr[], const double yarr[], const double zarr[], /* data */
size_t xsize, size_t ysize, /* array sizes */
const double xval[], const double yval[], /* test points */
const double zval[], /* expected results */
const double zxval[], const double zyval[],
const double zxxval[], const double zyyval[], const double zxyval[],
size_t test_size, /* number of test points */
const gsl_interp2d_type * T)
{
gsl_interp_accel *xa = gsl_interp_accel_alloc();
gsl_interp_accel *ya = gsl_interp_accel_alloc();
int status = 0;
size_t xi, yi, zi, i;
gsl_interp2d * interp = gsl_interp2d_alloc(T, xsize, ysize);
gsl_spline2d * interp_s = gsl_spline2d_alloc(T, xsize, ysize);
unsigned int min_size = gsl_interp2d_type_min_size(T);
gsl_test_int(min_size, T->min_size, "gsl_interp2d_type_min_size on %s", gsl_interp2d_name(interp));
gsl_interp2d_init(interp, xarr, yarr, zarr, xsize, ysize);
gsl_spline2d_init(interp_s, xarr, yarr, zarr, xsize, ysize);
/* First check that the interpolation reproduces the given points */
for (xi = 0; xi < xsize; xi++)
{
double x = xarr[xi];
for (yi = 0; yi < ysize; yi++)
{
double y = yarr[yi];
zi = gsl_interp2d_idx(interp, xi, yi);
test_single_low_level(&gsl_interp2d_eval, &gsl_interp2d_eval_e,
interp, xarr, yarr, zarr, x, y,
xa, ya, zarr, zi);
test_single_low_level(&gsl_interp2d_eval_extrap,
&gsl_interp2d_eval_extrap_e, interp,
xarr, yarr, zarr, x, y, xa, ya, zarr, zi);
test_single_high_level(&gsl_spline2d_eval, &gsl_spline2d_eval_e,
interp_s, x, y, xa, ya, zarr, zi);
test_single_high_level(&gsl_spline2d_eval_extrap, &gsl_spline2d_eval_extrap_e,
interp_s, x, y, xa, ya, zarr, zi);
}
}
/* Then check additional points provided */
for (i = 0; i < test_size; i++)
{
double x = xval[i];
double y = yval[i];
test_single_low_level(&gsl_interp2d_eval, &gsl_interp2d_eval_e, interp, xarr, yarr, zarr, x, y, xa, ya, zval, i);
test_single_low_level(&gsl_interp2d_eval_deriv_x, &gsl_interp2d_eval_deriv_x_e, interp, xarr, yarr, zarr, x, y, xa, ya, zxval, i);
test_single_low_level(&gsl_interp2d_eval_deriv_y, &gsl_interp2d_eval_deriv_y_e, interp, xarr, yarr, zarr, x, y, xa, ya, zyval, i);
test_single_low_level(&gsl_interp2d_eval_deriv_xx,&gsl_interp2d_eval_deriv_xx_e, interp, xarr, yarr, zarr, x, y, xa, ya, zxxval, i);
test_single_low_level(&gsl_interp2d_eval_deriv_yy,&gsl_interp2d_eval_deriv_yy_e, interp, xarr, yarr, zarr, x, y, xa, ya, zyyval, i);
test_single_low_level(&gsl_interp2d_eval_deriv_xy,&gsl_interp2d_eval_deriv_xy_e, interp, xarr, yarr, zarr, x, y, xa, ya, zxyval, i);
test_single_high_level(&gsl_spline2d_eval, &gsl_spline2d_eval_e, interp_s, x, y, xa, ya, zval, i);
test_single_high_level(&gsl_spline2d_eval_extrap, &gsl_spline2d_eval_extrap_e, interp_s, x, y, xa, ya, zval, i);
test_single_high_level(&gsl_spline2d_eval_deriv_x, &gsl_spline2d_eval_deriv_x_e, interp_s, x, y, xa, ya, zxval, i);
test_single_high_level(&gsl_spline2d_eval_deriv_y, &gsl_spline2d_eval_deriv_y_e, interp_s, x, y, xa, ya, zyval, i);
test_single_high_level(&gsl_spline2d_eval_deriv_xx,&gsl_spline2d_eval_deriv_xx_e, interp_s, x, y, xa, ya, zxxval, i);
test_single_high_level(&gsl_spline2d_eval_deriv_yy,&gsl_spline2d_eval_deriv_yy_e, interp_s, x, y, xa, ya, zyyval, i);
test_single_high_level(&gsl_spline2d_eval_deriv_xy,&gsl_spline2d_eval_deriv_xy_e, interp_s, x, y, xa, ya, zxyval, i);
test_single_low_level(&gsl_interp2d_eval_extrap, &gsl_interp2d_eval_extrap_e, interp, xarr, yarr, zarr, x, y, xa, ya, zval, i);
}
gsl_interp_accel_free(xa);
gsl_interp_accel_free(ya);
gsl_interp2d_free(interp);
gsl_spline2d_free(interp_s);
return status;
}
/*
* Tests bilinear interpolation using a symmetric function, f(x,y)==f(y,x),
* and diagonal interpolation points (x,y) where x==y. If these tests don't
* pass, something is seriously broken.
*/
static int
test_bilinear_symmetric()
{
int status;
double xarr[] = {0.0, 1.0, 2.0, 3.0};
double yarr[] = {0.0, 1.0, 2.0, 3.0};
double zarr[] = {1.0, 1.1, 1.2, 1.3,
1.1, 1.2, 1.3, 1.4,
1.2, 1.3, 1.4, 1.5,
1.3, 1.4, 1.5, 1.6};
double xval[] = {0.0, 0.5, 1.0, 1.5, 2.5, 3.0};
double yval[] = {0.0, 0.5, 1.0, 1.5, 2.5, 3.0};
double zval[] = {1.0, 1.1, 1.2, 1.3, 1.5, 1.6};
size_t xsize = sizeof(xarr) / sizeof(xarr[0]);
size_t ysize = sizeof(yarr) / sizeof(yarr[0]);
size_t test_size = sizeof(xval) / sizeof(xval[0]);
status = test_interp2d(xarr, yarr, zarr, xsize, ysize, xval, yval, zval,
NULL, NULL, NULL, NULL, NULL, test_size,
gsl_interp2d_bilinear);
gsl_test(status, "bilinear interpolation with symmetric values");
return status;
}
/*
* Tests bilinear interpolation with an asymmetric function, f(x,y)!=f(y,x),
* and off-diagonal interpolation points (x,y) where x and y may or may not
* be equal.
*/
static int
test_bilinear_asymmetric_z()
{
int status;
double xarr[] = {0.0, 1.0, 2.0, 3.0};
double yarr[] = {0.0, 1.0, 2.0, 3.0};
double zarr[] = {1.0, 1.1, 1.2, 1.4,
1.3, 1.4, 1.5, 1.7,
1.5, 1.6, 1.7, 1.9,
1.6, 1.9, 2.2, 2.3};
double xval[] = { 0.0, 0.5, 1.0, 1.5, 2.5, 3.0,
1.3954, 1.6476, 0.824957,
2.41108, 2.98619, 1.36485 };
double yval[] = {0.0, 0.5, 1.0, 1.5, 2.5, 3.0,
0.265371, 2.13849, 1.62114,
1.22198, 0.724681, 0.0596087 };
/* results computed using Mathematica 9.0.1.0 */
double zval[] = {1.0, 1.2, 1.4, 1.55, 2.025, 2.3,
1.2191513, 1.7242442248, 1.5067237,
1.626612, 1.6146423, 1.15436761};
size_t xsize = sizeof(xarr) / sizeof(xarr[0]);
size_t ysize = sizeof(yarr) / sizeof(yarr[0]);
size_t test_size = sizeof(xval) / sizeof(xval[0]);
status = test_interp2d(xarr, yarr, zarr, xsize, ysize, xval, yval, zval,
NULL, NULL, NULL, NULL, NULL, test_size,
gsl_interp2d_bilinear);
gsl_test(status, "bilinear interpolation with asymmetric z values");
return status;
}
static int
test_bicubic()
{
int status;
double xarr[] = {0.0, 1.0, 2.0, 3.0};
double yarr[] = {0.0, 1.0, 2.0, 3.0};
double zarr[] = {1.0, 1.1, 1.2, 1.3,
1.1, 1.2, 1.3, 1.4,
1.2, 1.3, 1.4, 1.5,
1.3, 1.4, 1.5, 1.6};
double xval[] = {1.0, 1.5, 2.0};
double yval[] = {1.0, 1.5, 2.0};
double zval[] = {1.2, 1.3, 1.4};
size_t xsize = sizeof(xarr) / sizeof(xarr[0]);
size_t ysize = sizeof(yarr) / sizeof(yarr[0]);
size_t test_size = sizeof(xval) / sizeof(xval[0]);
status = test_interp2d(xarr, yarr, zarr, xsize, ysize, xval, yval, zval,
NULL, NULL, NULL, NULL, NULL, test_size,
gsl_interp2d_bicubic);
gsl_test(status, "bicubic interpolation on linear function");
return status;
}
static int
test_bicubic_nonlinear()
{
int status;
double xarr[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
double yarr[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
/* least common multiple of x and y */
double zarr[] = { 1, 2, 3, 4, 5, 6, 7, 8,
2, 2, 6, 4, 10, 6, 14, 8,
3, 6, 3, 12, 15, 6, 21, 24,
4, 4, 12, 4, 20, 12, 28, 8,
5, 10, 15, 20, 5, 30, 35, 40,
6, 6, 6, 12, 30, 6, 42, 24,
7, 14, 21, 28, 35, 42, 7, 56,
8, 8, 24, 8, 40, 24, 56, 8};
double xval[] = {1.4, 2.3, 4.7, 3.3, 7.5, 6.6, 5.1};
double yval[] = {1.0, 1.8, 1.9, 2.5, 2.7, 4.1, 3.3};
/* results computed using GSL 1D cubic interpolation twice */
double zval[] = { 1.4, 3.11183531264736, 8.27114315792559, 5.03218982537718,
22.13230634702637, 23.63206834997871, 17.28553080971182 };
size_t xsize = sizeof(xarr) / sizeof(xarr[0]);
size_t ysize = sizeof(yarr) / sizeof(yarr[0]);
size_t test_size = sizeof(xval) / sizeof(xval[0]);
status = test_interp2d(xarr, yarr, zarr, xsize, ysize, xval, yval, zval,
NULL, NULL, NULL, NULL, NULL, test_size,
gsl_interp2d_bicubic);
gsl_test(status, "bicubic interpolation on nonlinear symmetric function");
return status;
}
/* This function contributed by Andrew W. Steiner <awsteiner@gmail.com> */
static int
test_bicubic_nonlinear_nonsq()
{
int status;
double xarr[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
double yarr[] = {1.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0};
double zarr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2, 2, 6, 4, 10, 6, 14, 8, 11, 12,
3, 6, 3, 12, 15, 6, 21, 24, 13, 14,
4, 4, 12, 4, 20, 12, 28, 8, 15, 16,
5, 10, 15, 20, 5, 30, 35, 40, 17, 18,
6, 6, 6, 12, 30, 6, 42, 24, 19, 20,
7, 14, 21, 28, 35, 42, 7, 56, 21, 22,
8, 8, 24, 8, 40, 24, 56, 8, 23, 24};
double xval[] = {1.4, 2.3, 9.7, 3.3, 9.5, 6.6, 5.1};
double yval[] = {1.0, 1.8, 1.9, 2.5, 2.7, 4.1, 3.3};
/* results computed using GSL 1D cubic interpolation twice */
double zval[] = { 1.4, 2.46782030941187003, 10.7717721621846465,
4.80725067958096375, 11.6747032398627297,
11.2619968682970111, 9.00168877916872567};
size_t xsize = sizeof(xarr) / sizeof(xarr[0]);
size_t ysize = sizeof(yarr) / sizeof(yarr[0]);
size_t test_size = sizeof(xval) / sizeof(xval[0]);
status = test_interp2d(xarr, yarr, zarr, xsize, ysize, xval, yval, zval,
NULL, NULL, NULL, NULL, NULL, test_size,
gsl_interp2d_bicubic);
gsl_test(status, "bicubic interpolation on nonlinear symmetric function");
return status;
}
/* runs all the tests */
int
test_interp2d_main(void)
{
int status = 0;
status += test_bilinear_symmetric();
status += test_bilinear_asymmetric_z();
status += test_bicubic();
status += test_bicubic_nonlinear();
status += test_bicubic_nonlinear_nonsq();
return status;
}
| 41.071839 | 138 | 0.595606 |
54958d70910c462420497b6ad2bf622cf17c3dd6 | 4,672 | h | C | firmware/HaskinoFirmwareShallow/HaskinoCommands.h | ku-fpg/arduino-lab | 9a0709c92c2da9b9371e292b00fd076e5539eb18 | [
"BSD-3-Clause"
] | 72 | 2015-11-22T12:47:16.000Z | 2022-02-15T12:57:05.000Z | firmware/HaskinoFirmwareShallow/HaskinoCommands.h | ku-fpg/arduino-lab | 9a0709c92c2da9b9371e292b00fd076e5539eb18 | [
"BSD-3-Clause"
] | 3 | 2016-02-16T16:45:25.000Z | 2018-06-17T13:57:02.000Z | firmware/HaskinoFirmwareShallow/HaskinoCommands.h | ku-fpg/arduino-lab | 9a0709c92c2da9b9371e292b00fd076e5539eb18 | [
"BSD-3-Clause"
] | 7 | 2015-12-18T00:49:34.000Z | 2018-06-08T09:29:21.000Z | #ifndef HaskinoCommandsH
#define HaskinoCommandsH
// Base Expression Types
#define EXPR_BOOL 0x01
#define EXPR_WORD8 0x02
#define EXPR_WORD16 0x03
#define EXPR_WORD32 0x04
#define EXPR_INT8 0x05
#define EXPR_INT16 0x06
#define EXPR_INT32 0x07
#define EXPR_LIST8 0x08
#define EXPR_FLOAT 0x09
// Base Expression Ops
#define EXPR_LIT 0x00
// Note: None of the CMD_TYPE's should be 0x7x, so that there
// is no possibility of sending an HDLC frame or escape as
// a command and causing an extra escape to be sent.
// Also, not using 0x0x as a command type to avoid sending an
// all zero message.
#define CMD_TYPE_MASK 0xF0
#define CMD_SUBTYPE_MASK 0x0F
// Board Control commands
#define BC_CMD_TYPE 0x10
#define BC_CMD_SYSTEM_RESET (BC_CMD_TYPE | 0x0)
#define BC_CMD_SET_PIN_MODE (BC_CMD_TYPE | 0x1)
#define BC_CMD_DELAY_MILLIS (BC_CMD_TYPE | 0x2)
#define BC_CMD_DELAY_MICROS (BC_CMD_TYPE | 0x3)
#define BC_CMD_ITERATE (BC_CMD_TYPE | 0x4)
#define BC_CMD_IF_THEN_ELSE (BC_CMD_TYPE | 0x5)
// Board Control responses
#define BC_RESP_DELAY (BC_CMD_TYPE | 0x8)
#define BC_RESP_IF_THEN_ELSE (BC_CMD_TYPE | 0x9)
#define BC_RESP_ITERATE (BC_CMD_TYPE | 0xA)
// Board Status commands
#define BS_CMD_TYPE 0x20
#define BS_CMD_REQUEST_VERSION (BS_CMD_TYPE | 0x0)
#define BS_CMD_REQUEST_TYPE (BS_CMD_TYPE | 0x1)
#define BS_CMD_REQUEST_MICROS (BS_CMD_TYPE | 0x2)
#define BS_CMD_REQUEST_MILLIS (BS_CMD_TYPE | 0x3)
#define BS_CMD_DEBUG (BS_CMD_TYPE | 0x4)
// Board Status responses
#define BS_RESP_VERSION (BS_CMD_TYPE | 0x8)
#define BS_RESP_TYPE (BS_CMD_TYPE | 0x9)
#define BS_RESP_MICROS (BS_CMD_TYPE | 0xA)
#define BS_RESP_MILLIS (BS_CMD_TYPE | 0xB)
#define BS_RESP_STRING (BS_CMD_TYPE | 0xC)
#define BS_RESP_DEBUG (BS_CMD_TYPE | 0xD)
// Digital commands
#define DIG_CMD_TYPE 0x30
#define DIG_CMD_READ_PIN (DIG_CMD_TYPE | 0x0)
#define DIG_CMD_WRITE_PIN (DIG_CMD_TYPE | 0x1)
#define DIG_CMD_READ_PORT (DIG_CMD_TYPE | 0x2)
#define DIG_CMD_WRITE_PORT (DIG_CMD_TYPE | 0x3)
// Digital responses
#define DIG_RESP_READ_PIN (DIG_CMD_TYPE | 0x8)
#define DIG_RESP_READ_PORT (DIG_CMD_TYPE | 0x9)
// Analog commands
#define ALG_CMD_TYPE 0x40
#define ALG_CMD_READ_PIN (ALG_CMD_TYPE | 0x0)
#define ALG_CMD_WRITE_PIN (ALG_CMD_TYPE | 0x1)
#define ALG_CMD_TONE_PIN (ALG_CMD_TYPE | 0x2)
#define ALG_CMD_NOTONE_PIN (ALG_CMD_TYPE | 0x3)
// Analog responses
#define ALG_RESP_READ_PIN (ALG_CMD_TYPE | 0x8)
// I2C commands
#define I2C_CMD_TYPE 0x50
#define I2C_CMD_CONFIG (I2C_CMD_TYPE | 0x0)
#define I2C_CMD_READ (I2C_CMD_TYPE | 0x1)
#define I2C_CMD_WRITE (I2C_CMD_TYPE | 0x2)
// I2C responses
#define I2C_RESP_READ (I2C_CMD_TYPE | 0x8)
// Servo commands
#define SRVO_CMD_TYPE 0x80
#define SRVO_CMD_ATTACH (SRVO_CMD_TYPE | 0x0)
#define SRVO_CMD_DETACH (SRVO_CMD_TYPE | 0x1)
#define SRVO_CMD_WRITE (SRVO_CMD_TYPE | 0x2)
#define SRVO_CMD_WRITE_MICROS (SRVO_CMD_TYPE | 0x3)
#define SRVO_CMD_READ (SRVO_CMD_TYPE | 0x4)
#define SRVO_CMD_READ_MICROS (SRVO_CMD_TYPE | 0x5)
// Servo responses
#define SRVO_RESP_ATTACH (SRVO_CMD_TYPE | 0x8)
#define SRVO_RESP_READ (SRVO_CMD_TYPE | 0x9)
#define SRVO_RESP_READ_MICROS (SRVO_CMD_TYPE | 0xA)
// Stepper commands
#define STEP_CMD_TYPE 0x90
#define STEP_CMD_2PIN (STEP_CMD_TYPE | 0x0)
#define STEP_CMD_4PIN (STEP_CMD_TYPE | 0x1)
#define STEP_CMD_SET_SPEED (STEP_CMD_TYPE | 0x2)
#define STEP_CMD_STEP (STEP_CMD_TYPE | 0x3)
// Stepper responses
#define STEP_RESP_2PIN (STEP_CMD_TYPE | 0x8)
#define STEP_RESP_4PIN (STEP_CMD_TYPE | 0x9)
#define STEP_RESP_STEP (STEP_CMD_TYPE | 0xA)
// Serial commands
#define SER_CMD_TYPE 0xE0
#define SER_CMD_BEGIN (SER_CMD_TYPE | 0x0)
#define SER_CMD_END (SER_CMD_TYPE | 0x1)
#define SER_CMD_AVAIL (SER_CMD_TYPE | 0x2)
#define SER_CMD_READ (SER_CMD_TYPE | 0x3)
#define SER_CMD_READ_LIST (SER_CMD_TYPE | 0x4)
#define SER_CMD_WRITE (SER_CMD_TYPE | 0x5)
#define SER_CMD_WRITE_LIST (SER_CMD_TYPE | 0x6)
// Serial responses
#define SER_RESP_AVAIL (SER_CMD_TYPE | 0x8)
#define SER_RESP_READ (SER_CMD_TYPE | 0x9)
#define SER_RESP_READ_LIST (SER_CMD_TYPE | 0xA)
#endif /* HaskinoCommandsH */
| 35.664122 | 62 | 0.685574 |
c276ac4ffa437b688cfc570a1645881317b0a216 | 5,516 | c | C | tools/vpd_encode/type1.c | dhendrix/mosys | 8baa261c5a7335ed9e089eb70564654c82305a9f | [
"BSD-3-Clause"
] | null | null | null | tools/vpd_encode/type1.c | dhendrix/mosys | 8baa261c5a7335ed9e089eb70564654c82305a9f | [
"BSD-3-Clause"
] | null | null | null | tools/vpd_encode/type1.c | dhendrix/mosys | 8baa261c5a7335ed9e089eb70564654c82305a9f | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2012, Google 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 the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* 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.
*
* FIXME: this code is absolutely atrocious and needs to be re-written
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <uuid/uuid.h>
#include "mosys/log.h"
#include "lib/math.h"
#include "lib/string.h"
#include "lib/vpd.h"
#include "lib/vpd_tables.h"
#include "lib_vpd_encode.h"
#include "symbol.h"
/**
* vpd_append_type1 - append type 1 (system info) structure
*
* @handle: handle for this structure
* @buf: buffer to append to
* @len: length of buffer
*
* @product_name: name of the product
* @version: version of the product
* @serial_number: serial number of the product
* @uuid: uuid of the product
* @sku: SKU of the product
* @family: family the product belongs in
*
* returns total size of newly re-sized buffer if successful
* returns <0 to indicate failure
*/
int vpd_append_type1(uint16_t handle, uint8_t **buf, size_t len,
char *manufacturer, char *product_name, char *version,
char *serial_number, char *uuid, char *sku, char *family)
{
struct vpd_header *header;
struct vpd_table_system *data;
uint8_t *strings, *p;
size_t struct_len, total_len;
/* FIXME: Add sanity checking */
struct_len = sizeof(struct vpd_header) +
sizeof(struct vpd_table_system) +
strlen(manufacturer) + 1 +
strlen(product_name) + 1 +
strlen(version) + 1 +
strlen(serial_number) + 1 +
strlen(sku) + 1 +
strlen(family) + 1 +
1; /* structure terminator */
total_len = len + struct_len;
*buf = realloc(*buf, total_len);
memset(*buf + len, 0, struct_len);
p = *buf + len;
header = (struct vpd_header *)p;
p += sizeof(*header);
data = (struct vpd_table_system *)p;
p += sizeof(*data);
strings = p;
/* fill in structure header details */
header->type = VPD_TYPE_SYSTEM;
header->length = sizeof(*header) + sizeof(*data);
header->handle = handle;
data->manufacturer = 1;
data->name = 2;
data->version = 3;
data->serial_number = 4;
if (uuid_parse(uuid, data->uuid) < 0)
printf("invalid UUID \"%s\" specified\n", uuid);
data->wakeup_type = 0; /* for legacy smbios compatibility only */
data->sku_number = 5;
data->family = 6;
sprintf(strings, "%s%c%s%c%s%c%s%c%s%c%s%c",
manufacturer, '\0',
product_name, '\0',
version, '\0',
serial_number, '\0',
sku, '\0',
family, '\0');
memset(*buf + struct_len, 0, 1); /* terminator */
lprintf(LOG_DEBUG, "%s: total length (including strings): %u\n",
__func__, (unsigned)total_len);
print_buf(LOG_DEBUG, data, total_len);
return total_len;
}
/**
* sym2type1 - extract symbols and append system info table to buffer
*
* @handle: handle for this structure
* @buf: buffer to append to
* @len: length of buffer
*
* This function is intended to hide tedious symbol extraction steps from
* higher-level logic.
*
* returns total size of newly re-sized buffer if successful
* returns <0 to indicate failure
*/
int sym2type1(uint16_t handle, uint8_t **buf, size_t len)
{
char *manufacturer, *name, *version, *serial_num,
*uuid, *sku, *family;
/* All strings are required in this data structure */
if (!(manufacturer = sym2str("CONFIG_SYSTEM_MANUFACTURER"))) return -1;
if (!(name = sym2str("CONFIG_SYSTEM_PRODUCT_NAME"))) return -1;
if (!(version = sym2str("CONFIG_SYSTEM_VERSION"))) return -1;
if (!(serial_num = sym2str("CONFIG_SYSTEM_SERIAL_NUMBER"))) return -1;
if (!(uuid = sym2str("CONFIG_SYSTEM_UUID"))) return -1;
if (!(sku = sym2str("CONFIG_SYSTEM_SKU"))) return -1;
if (!(family = sym2str("CONFIG_SYSTEM_FAMILY"))) return -1;
return vpd_append_type1(handle, buf, len, manufacturer, name,
version, serial_num, uuid, sku, family);
}
| 33.840491 | 75 | 0.675308 |
7440041e790d90dd0836fb8a2f2cc30289efaa00 | 2,167 | h | C | src/headers/rules.process.h | Shikanime/my_kawai_printf | 8a341db3931496e66c86826a1962b28122f86a44 | [
"MIT"
] | null | null | null | src/headers/rules.process.h | Shikanime/my_kawai_printf | 8a341db3931496e66c86826a1962b28122f86a44 | [
"MIT"
] | null | null | null | src/headers/rules.process.h | Shikanime/my_kawai_printf | 8a341db3931496e66c86826a1962b28122f86a44 | [
"MIT"
] | null | null | null | /*
rules.process.h for my_printf in /home/asuramaru/Project/print/phetsi_w/src
Made by PHETSINORATH William
Login <phetsi_w@etna-alternance.net>
Started on Fri Mar 24 14:39:20 2017 PHETSINORATH William
Last update Fri Mar 24 14:39:28 2017 PHETSINORATH William
*/
#ifndef MY_PRINTF_RULLES_PROCESS_H
#define MY_PRINTF_RULLES_PROCESS_H
/* Helpers */
#define PROCESS_NUMBER 10
enum {
flagsMod,
widthMod,
precisionMod,
lenghtMod,
typeMod
};
enum {
longIntLenght,
shortIntLenght,
longDoubleLenght
};
#include <stdarg.h>
/* Usable functions */
int (*process[PROCESS_NUMBER]) (const char * query, int n, int * opt, va_list * ap);
/* Internal functions */
int escapeProcess (const char * query, int n, int * opt, va_list * ap);
int integerProcess (const char * query, int n, int * opt, va_list * ap);
int charProcess (const char * query, int n, int * opt, va_list * ap);
int stringProcess (const char * query, int n, int * opt, va_list * ap);
int pointerProcess (const char * query, int n, int * opt, va_list * ap);
int hexadecimalProcess (const char * query, int n, int * opt, va_list * ap);
int octalProcess (const char * query, int n, int * opt, va_list * ap);
int unsignedIntegerProcess (const char * query, int n, int * opt, va_list * ap);
int floatPointProcess (const char * query, int n, int * opt, va_list * ap);
int doublePrecisionProcess (const char * query, int n, int * opt, va_list * ap);
/* External functions */
void charPrintHelper (char c);
long int stringLengthHelper (const char * s);
void stringPrintHelper (const char * s);
void integerPrintHelper (int n);
void unsignedIntegerPrintHelper (unsigned int n);
void addressPrintHelper (unsigned int n);
void hexadecimalPrintHelper (unsigned int n);
void hexadecimalCapitalPrintHelper (unsigned int n);
void octalPrintHelper (unsigned int n);
#endif //MY_PRINTF_RULLES_PROCESS
| 33.859375 | 85 | 0.632672 |
fb27ab1d6e9c524e98bc83d150dba1fa4e9f33a3 | 2,347 | h | C | code/engine/xrGame/ai_space.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 58 | 2016-11-20T19:14:35.000Z | 2021-12-27T21:03:35.000Z | code/engine/xrGame/ai_space.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 59 | 2016-09-10T10:44:20.000Z | 2018-09-03T19:07:30.000Z | code/engine/xrGame/ai_space.h | InNoHurryToCode/xray-162 | fff9feb9ffb681b3c6ba1dc7c4534fe80006f87e | [
"Apache-2.0"
] | 39 | 2017-02-05T13:35:37.000Z | 2022-03-14T11:00:12.000Z | ////////////////////////////////////////////////////////////////////////////
// Module : ai_space.h
// Created : 12.11.2003
// Modified : 12.11.2003
// Author : Dmitriy Iassenev
// Description : AI space class
////////////////////////////////////////////////////////////////////////////
#pragma once
class CGameGraph;
class CGameLevelCrossTable;
class CLevelGraph;
class CGraphEngine;
class CEF_Storage;
class CALifeSimulator;
class CCoverManager;
class CScriptEngine;
class CPatrolPathStorage;
class moving_objects;
namespace doors {
class manager;
} // namespace doors
class CAI_Space {
private:
friend class CALifeSimulator;
friend class CALifeGraphRegistry;
friend class CALifeSpawnRegistry;
friend class CALifeSpawnRegistry;
friend class CLevel;
private:
CGameGraph* m_game_graph;
CLevelGraph* m_level_graph;
CGraphEngine* m_graph_engine;
CEF_Storage* m_ef_storage;
CALifeSimulator* m_alife_simulator;
CCoverManager* m_cover_manager;
CScriptEngine* m_script_engine;
CPatrolPathStorage* m_patrol_path_storage;
moving_objects* m_moving_objects;
doors::manager* m_doors_manager;
private:
void load(LPCSTR level_name);
void unload(bool reload = false);
void patrol_path_storage_raw(IReader& stream);
void patrol_path_storage(IReader& stream);
void set_alife(CALifeSimulator* alife_simulator);
void game_graph(CGameGraph* game_graph);
public:
CAI_Space();
virtual ~CAI_Space();
void init();
IC CGameGraph& game_graph() const;
IC CGameGraph* get_game_graph() const;
IC CLevelGraph& level_graph() const;
IC const CLevelGraph* get_level_graph() const;
const CGameLevelCrossTable& cross_table() const;
const CGameLevelCrossTable* get_cross_table() const;
IC const CPatrolPathStorage& patrol_paths() const;
IC CEF_Storage& ef_storage() const;
IC CGraphEngine& graph_engine() const;
IC const CALifeSimulator& alife() const;
IC const CALifeSimulator* get_alife() const;
IC const CCoverManager& cover_manager() const;
IC CScriptEngine& script_engine() const;
IC moving_objects& moving_objects() const;
IC doors::manager& doors() const;
#ifdef DEBUG
void validate(const u32 level_id) const;
#endif
};
IC CAI_Space& ai();
extern CAI_Space* g_ai_space;
#include "ai_space_inline.h" | 28.277108 | 76 | 0.696208 |
1f90eb204ad898fa859afc4eeced721baaec04e3 | 2,403 | h | C | System/Library/PrivateFrameworks/ContextKitExtraction.framework/CKContextContentProviderUIScene.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | 1 | 2020-11-04T15:43:01.000Z | 2020-11-04T15:43:01.000Z | System/Library/PrivateFrameworks/ContextKitExtraction.framework/CKContextContentProviderUIScene.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/ContextKitExtraction.framework/CKContextContentProviderUIScene.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | /*
* This header is generated by classdump-dyld 1.0
* on Sunday, September 27, 2020 at 11:45:09 AM Mountain Standard Time
* Operating System: Version 14.0 (Build 18A373)
* Image Source: /System/Library/PrivateFrameworks/ContextKitExtraction.framework/ContextKitExtraction
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <ContextKitExtraction/CKContextContentProvider.h>
#import <libobjc.A.dylib/_UISceneComponentProviding.h>
@class UIScene, UIButton, NSTimer, NSString;
@interface CKContextContentProviderUIScene : CKContextContentProvider <_UISceneComponentProviding> {
UIButton* _debugButton;
BOOL _allowDebugControls;
NSTimer* _toolInstallationTimer;
UIScene* __scene;
}
@property (assign,setter=_setScene:,getter=_scene,nonatomic,__weak) UIScene * _scene; //@synthesize _scene=__scene - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
+(void)initialize;
+(void)extractFromScene:(id)arg1 usingExecutor:(id)arg2 ;
+(id)_bestVisibleStringForView:(id)arg1 usingExecutor:(id)arg2 ;
+(void)_donateContentsOfWindow:(id)arg1 usingExecutor:(id)arg2 ;
+(unsigned char)_controlCodeForExecutor:(id)arg1 ;
+(BOOL)_isSensitiveTextContentType:(id)arg1 ;
+(BOOL)_isRelevantForExtractionWithView:(id)arg1 ;
+(id)_blocksFromText:(id)arg1 ;
+(id)_descendantsRelevantForContentExtractionFromView:(id)arg1 ;
+(id)_handlePDFView:(id)arg1 withExecutor:(id)arg2 ;
+(BOOL)_textBlockLooksLikeAListWithText:(id)arg1 ;
+(void)_donateText:(id)arg1 withDebugText:(id)arg2 debugUrlString:(id)arg3 usingContextFromExecutor:(id)arg4 ;
+(id)_bestContentStringForWebViewContentString:(id)arg1 andTitle:(id)arg2 ;
+(id)_handleWKWebView:(id)arg1 withExecutor:(id)arg2 ;
-(UIScene *)_scene;
-(void)_setScene:(id)arg1 ;
-(void)_didSelectDebugControl:(id)arg1 ;
-(void)_setUpDebuggingControlsIfPossibleAfterDelay:(double)arg1 ;
-(id)initWithScene:(id)arg1 ;
-(void)_sceneWillInvalidate:(id)arg1 ;
-(BOOL)_shouldInstallDebugControls;
-(void)extractUsingExecutor:(id)arg1 ;
-(id)_containerViewForDebugButton;
-(void)_installDebuggingControlsIfApplicable;
-(id)_descendantsRelevantForDebugControls:(id)arg1 ;
-(void)_installDebuggingButton;
-(BOOL)_determineIfDebuggingControlsShouldBeAllowed;
@end
| 42.157895 | 157 | 0.799001 |
dd668aea05af8a8e04cf0190cf66ed43c0540e9a | 376 | h | C | src/compiler/rules/named_symbol.h | zachwaugh/tree-sitter | 9ac496aced1d1bbeed71c1ce09887f0b6b65f496 | [
"MIT"
] | 1 | 2019-12-17T07:31:13.000Z | 2019-12-17T07:31:13.000Z | src/compiler/rules/named_symbol.h | zachwaugh/tree-sitter | 9ac496aced1d1bbeed71c1ce09887f0b6b65f496 | [
"MIT"
] | 1 | 2021-05-20T20:30:08.000Z | 2021-05-20T20:30:08.000Z | src/compiler/rules/named_symbol.h | zachwaugh/tree-sitter | 9ac496aced1d1bbeed71c1ce09887f0b6b65f496 | [
"MIT"
] | 1 | 2018-12-16T13:41:35.000Z | 2018-12-16T13:41:35.000Z | #ifndef COMPILER_RULES_NAMED_SYMBOL_H_
#define COMPILER_RULES_NAMED_SYMBOL_H_
#include <string>
namespace tree_sitter {
namespace rules {
struct NamedSymbol {
std::string value;
inline bool operator==(const NamedSymbol &other) const {
return value == other.value;
}
};
} // namespace rules
} // namespace tree_sitter
#endif // COMPILER_RULES_NAMED_SYMBOL_H_ | 18.8 | 58 | 0.755319 |
ea5b9cdb2274b88732a782cd00652f71dfd3c36c | 3,018 | h | C | HDL_IP_Example_1/sysgen/xilinx_transfer_function_1.h | muhammedtarikyildiz/fractional-order-msbl-fpga | 60c54a85c34fd192fd410eb10acfeb80b094d0f1 | [
"MIT"
] | 1 | 2021-07-03T05:11:33.000Z | 2021-07-03T05:11:33.000Z | HDL_IP_Example_1/sysgen/xilinx_transfer_function_1.h | muhammedtarikyildiz/fractional-order-msbl-fpga | 60c54a85c34fd192fd410eb10acfeb80b094d0f1 | [
"MIT"
] | null | null | null | HDL_IP_Example_1/sysgen/xilinx_transfer_function_1.h | muhammedtarikyildiz/fractional-order-msbl-fpga | 60c54a85c34fd192fd410eb10acfeb80b094d0f1 | [
"MIT"
] | null | null | null | #ifndef XILINX_TRANSFER_FUNCTION_1__H
#define XILINX_TRANSFER_FUNCTION_1__H
#ifdef __cplusplus
extern "C" {
#endif
/***************************** Include Files *********************************/
#ifndef __linux__
#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xil_io.h"
#else
#include <stdint.h>
#include <assert.h>
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stddef.h>
#endif
#include "xilinx_transfer_function_1_hw.h"
/**************************** Type Definitions ******************************/
#ifdef __linux__
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
#else
typedef struct {
u16 DeviceId;
u32 xilinx_transfer_function_1_BaseAddress;
} xilinx_transfer_function_1_Config;
#endif
/**
* The xilinx_transfer_function_1 driver instance data. The user is required to
* allocate a variable of this type for every xilinx_transfer_function_1 device in the system.
* A pointer to a variable of this type is then passed to the driver
* API functions.
*/
typedef struct {
u32 xilinx_transfer_function_1_BaseAddress;
u32 IsReady;
} xilinx_transfer_function_1;
/***************** Macros (Inline Functions) Definitions *********************/
#ifndef __linux__
#define xilinx_transfer_function_1_WriteReg(BaseAddress, RegOffset, Data) \
Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
#define xilinx_transfer_function_1_ReadReg(BaseAddress, RegOffset) \
Xil_In32((BaseAddress) + (RegOffset))
#else
#define xilinx_transfer_function_1_WriteReg(BaseAddress, RegOffset, Data) \
*(volatile u32*)((BaseAddress) + (RegOffset)) = (u32)(Data)
#define xilinx_transfer_function_1_ReadReg(BaseAddress, RegOffset) \
*(volatile u32*)((BaseAddress) + (RegOffset))
#define Xil_AssertVoid(expr) assert(expr)
#define Xil_AssertNonvoid(expr) assert(expr)
#define XST_SUCCESS 0
#define XST_DEVICE_NOT_FOUND 2
#define XST_OPEN_DEVICE_FAILED 3
#define XIL_COMPONENT_IS_READY 1
#endif
/************************** Function Prototypes *****************************/
#ifndef __linux__
int xilinx_transfer_function_1_Initialize(xilinx_transfer_function_1 *InstancePtr, u16 DeviceId);
xilinx_transfer_function_1_Config* xilinx_transfer_function_1_LookupConfig(u16 DeviceId);
int xilinx_transfer_function_1_CfgInitialize(xilinx_transfer_function_1 *InstancePtr, xilinx_transfer_function_1_Config *ConfigPtr);
#else
int xilinx_transfer_function_1_Initialize(xilinx_transfer_function_1 *InstancePtr, const char* InstanceName);
int xilinx_transfer_function_1_Release(xilinx_transfer_function_1 *InstancePtr);
#endif
/**
* Read from gateway_out2 gateway of xilinx_transfer_function_1. Assignments are LSB-justified.
*
* @param InstancePtr is the gateway_out2 instance to operate on.
*
* @return int
*
* @note .
*
*/
int xilinx_transfer_function_1_gateway_out2_read(xilinx_transfer_function_1 *InstancePtr);
#ifdef __cplusplus
}
#endif
#endif
| 33.533333 | 132 | 0.740888 |
6b2721f115276f886cd868177da383e601679f81 | 366 | h | C | QuickStart/SendBirdDesk.xcframework/ios-i386_x86_64-simulator/SendBirdDesk.framework/Headers/SendBirdDesk.h | jalakoo/quickstart-desk-ios | f2b74b28816d90b9c45be507ab32f482e0d35bac | [
"MIT"
] | null | null | null | QuickStart/SendBirdDesk.xcframework/ios-i386_x86_64-simulator/SendBirdDesk.framework/Headers/SendBirdDesk.h | jalakoo/quickstart-desk-ios | f2b74b28816d90b9c45be507ab32f482e0d35bac | [
"MIT"
] | null | null | null | QuickStart/SendBirdDesk.xcframework/ios-i386_x86_64-simulator/SendBirdDesk.framework/Headers/SendBirdDesk.h | jalakoo/quickstart-desk-ios | f2b74b28816d90b9c45be507ab32f482e0d35bac | [
"MIT"
] | null | null | null | //
// SendBirdDesk.h
// SendBirdDesk
//
// Created by Sendbird on 2020/11/16.
//
#import <Foundation/Foundation.h>
#import <SendBirdSDK/SendBirdSDK.h>
//! Project version number for SendBirdDesk.
FOUNDATION_EXPORT double SendBirdDeskVersionNumber;
//! Project version string for SendBirdDesk.
FOUNDATION_EXPORT const unsigned char SendBirdDeskVersionString[];
| 22.875 | 66 | 0.778689 |
86e849e42a6fd8c5a17b776d05f178acdf98f5f7 | 4,273 | h | C | src/ChrysalisCore/ECS/Components/Qi.h | ivanhawkes/Chrysalis | fa46a1b8fdf8f076c125083dd772a608b60d982b | [
"BSD-2-Clause"
] | 59 | 2016-07-31T14:54:11.000Z | 2022-03-05T16:42:29.000Z | src/ChrysalisCore/ECS/Components/Qi.h | davchezt/Chrysalis | fa46a1b8fdf8f076c125083dd772a608b60d982b | [
"BSD-2-Clause"
] | 2 | 2018-01-23T05:25:26.000Z | 2020-03-04T21:31:19.000Z | src/ChrysalisCore/ECS/Components/Qi.h | davchezt/Chrysalis | fa46a1b8fdf8f076c125083dd772a608b60d982b | [
"BSD-2-Clause"
] | 18 | 2017-03-28T09:45:59.000Z | 2021-04-13T20:46:28.000Z | #pragma once
#include <ECS/Components/Components.h>
#include <ECS/Components/Spells/Spell.h>
#include <ECS/Components/Components.h>
namespace Chrysalis::ECS
{
struct Qi final
{
Qi() = default;
~Qi() = default;
Qi(AttributeType qi) :
qi(qi)
{
}
inline bool operator==(const Qi& rhs) const { return 0 == memcmp(this, &rhs, sizeof(rhs)); }
static void ReflectType(Schematyc::CTypeDesc<Qi>& desc)
{
desc.SetGUID("{6C1E5EE5-B467-48BF-843E-5A8D54B51F52}"_cry_guid);
desc.SetLabel("Qi");
desc.SetDescription("Qi of an actor.");
}
void Serialize(Serialization::IArchive& ar)
{
ar(qi, "qi", "qi");
ar(timeSinceLastSpellcast, "timeSinceLastSpellcast", "Time since they last cast a spell.");
ar(qiRegenerationPerSecond, "qiRegenerationPerSecond", "Qi regeneration per second.");
}
#ifdef IMGUI
void ImGuiRender();
#endif
/** Qi attribute. */
AttributeType qi;
/** Time delta since the last spell cast. */
float timeSinceLastSpellcast {0.0f};
/** Qi regeneration per second. */
float qiRegenerationPerSecond {0.02f};
};
struct UtiliseQi final
{
UtiliseQi() = default;
~UtiliseQi() = default;
UtiliseQi(float quantity) :
quantity(quantity)
{
}
void Serialize(Serialization::IArchive& ar)
{
ar(targetTargetType, "targetTargetType", "targetTargetType");
ar(quantity, "quantity", "quantity");
}
#ifdef IMGUI
void ImGuiRender();
#endif
/** Use the spell's target or source for this component's target. */
TargetTargetType targetTargetType {TargetTargetType::target};
/** Modify an attribute by this amount. */
float quantity {0.0f};
};
struct UtiliseQiOverTime final
{
UtiliseQiOverTime() = default;
~UtiliseQiOverTime() = default;
UtiliseQiOverTime(float quantity,
float duration, float interval) :
quantity(quantity), duration(duration), interval(interval)
{
}
void Serialize(Serialization::IArchive& ar)
{
ar(targetTargetType, "targetTargetType", "targetTargetType");
ar(quantity, "quantity", "quantity");
ar(duration, "duration", "duration");
ar(interval, "interval", "interval");
}
#ifdef IMGUI
void ImGuiRender();
#endif
/** Use the spell's target or source for this component's target. */
TargetTargetType targetTargetType {TargetTargetType::target};
/** Modify an attribute by this amount. */
float quantity {0.0f};
/** Limit the duration for this modifier. Given as remaining time in seconds. */
float duration {10.0f};
/** The damage ticks need to occur at this interval. */
float interval {1.0f};
/** Gametime passed since the last tick. */
float deltaSinceTick {0.0f};
/** Ticks remaining. */
float ticksRemaining {duration / interval};
};
struct ReplenishQi final
{
ReplenishQi() = default;
~ReplenishQi() = default;
ReplenishQi(float quantity) :
quantity(quantity)
{
}
void Serialize(Serialization::IArchive& ar)
{
ar(targetTargetType, "targetTargetType", "targetTargetType");
ar(quantity, "quantity", "quantity");
}
#ifdef IMGUI
void ImGuiRender();
#endif
/** Use the spell's target or source for this component's target. */
TargetTargetType targetTargetType {TargetTargetType::target};
/** Modify an attribute by this amount. */
float quantity {0.0f};
};
struct ReplenishQiOverTime final
{
ReplenishQiOverTime() = default;
~ReplenishQiOverTime() = default;
ReplenishQiOverTime(float quantity,
float duration, float interval) :
quantity(quantity), duration(duration), interval(interval)
{
}
void Serialize(Serialization::IArchive& ar)
{
ar(targetTargetType, "targetTargetType", "targetTargetType");
ar(quantity, "quantity", "quantity");
ar(duration, "duration", "duration");
ar(interval, "interval", "interval");
}
#ifdef IMGUI
void ImGuiRender();
#endif
/** Use the spell's target or source for this component's target. */
TargetTargetType targetTargetType {TargetTargetType::target};
/** Modify an attribute by this amount. */
float quantity {0.0f};
/** Limit the duration for this modifier. Given as remaining time in seconds. */
float duration {10.0f};
/** The ticks need to occur at this interval. */
float interval {1.0f};
/** Gametime passed since the last tick. */
float deltaSinceTick {0.0f};
/** Ticks remaining. */
float ticksRemaining {duration / interval};
};
} | 20.543269 | 93 | 0.706295 |
5642377edaebfd06d57da8ac18b7ef0413e10156 | 1,832 | h | C | Arduino/PMS7003_OTA_update_httpserver/ESP8266HTTPUpdateServerCustom.h | shescitech/TIFR_Mask_Efficiency | d595835869aea20e38eaa43a3295897f25dc36b4 | [
"MIT"
] | null | null | null | Arduino/PMS7003_OTA_update_httpserver/ESP8266HTTPUpdateServerCustom.h | shescitech/TIFR_Mask_Efficiency | d595835869aea20e38eaa43a3295897f25dc36b4 | [
"MIT"
] | null | null | null | Arduino/PMS7003_OTA_update_httpserver/ESP8266HTTPUpdateServerCustom.h | shescitech/TIFR_Mask_Efficiency | d595835869aea20e38eaa43a3295897f25dc36b4 | [
"MIT"
] | null | null | null | #ifndef __HTTP_UPDATE_SERVER_CUSTOM_H
#define __HTTP_UPDATE_SERVER_CUSTOM_H
#include <ESP8266WebServer.h>
namespace esp8266httpupdateservercustom {
using namespace esp8266webserver;
template <typename ServerType>
class ESP8266HTTPUpdateServerCustomTemplate
{
public:
ESP8266HTTPUpdateServerCustomTemplate(bool serial_debug=false);
void setup(ESP8266WebServerTemplate<ServerType> *server)
{
setup(server, emptyString, emptyString);
}
void setup(ESP8266WebServerTemplate<ServerType> *server, const String& path)
{
setup(server, path, emptyString, emptyString);
}
void setup(ESP8266WebServerTemplate<ServerType> *server, const String& username, const String& password)
{
setup(server, "/update", username, password);
}
void setup(ESP8266WebServerTemplate<ServerType> *server, const String& path, const String& username, const String& password);
void updateCredentials(const String& username, const String& password)
{
_username = username;
_password = password;
}
protected:
void _setUpdaterError();
private:
bool _serial_output;
ESP8266WebServerTemplate<ServerType> *_server;
String _username;
String _password;
bool _authenticated;
String _updaterError;
};
};
#include "ESP8266HTTPUpdateServerCustom-impl.h"
using ESP8266HTTPUpdateServerCustom = esp8266httpupdateservercustom::ESP8266HTTPUpdateServerCustomTemplate<WiFiServer>;
namespace BearSSL {
using ESP8266HTTPUpdateServerSecure = esp8266httpupdateservercustom::ESP8266HTTPUpdateServerCustomTemplate<WiFiServerSecure>;
};
namespace axTLS {
using ESP8266HTTPUpdateServerSecure = esp8266httpupdateservercustom::ESP8266HTTPUpdateServerCustomTemplate<WiFiServerSecure>;
};
#endif
| 27.757576 | 130 | 0.748908 |
c67708628ed4c48cf97f0d3dd7f6e521e0f8686f | 597 | h | C | panda/src/collide/collisionTube.h | Psychotropos/panda3d | ffe4f387ae9dd6299e6002be95037a44aa5b2a27 | [
"PHP-3.01",
"PHP-3.0"
] | null | null | null | panda/src/collide/collisionTube.h | Psychotropos/panda3d | ffe4f387ae9dd6299e6002be95037a44aa5b2a27 | [
"PHP-3.01",
"PHP-3.0"
] | null | null | null | panda/src/collide/collisionTube.h | Psychotropos/panda3d | ffe4f387ae9dd6299e6002be95037a44aa5b2a27 | [
"PHP-3.01",
"PHP-3.0"
] | null | null | null | /**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file collisionTube.h
* @author rdb
* @date 2018-12-23
*/
#ifndef COLLISIONTUBE_H
#define COLLISIONTUBE_H
#include "collisionCapsule.h"
BEGIN_PUBLISH
/**
* Alias for backward compatibility.
* @deprecated use CollisionCapsule instead.
*/
typedef CollisionCapsule CollisionTube;
END_PUBLISH
#endif
| 21.321429 | 70 | 0.742044 |
56985e6c2883075e7c165e6757e65be69d7019fb | 7,586 | h | C | Source/Renderer/Commands/OpenGL/ArrayCommands.h | pgrabas/MoonGlare | 25807680700697023d04830402af168f624ffb35 | [
"MIT"
] | 1 | 2018-03-18T16:29:16.000Z | 2018-03-18T16:29:16.000Z | Source/Renderer/Commands/OpenGL/ArrayCommands.h | pgrabas/MoonGlare | 25807680700697023d04830402af168f624ffb35 | [
"MIT"
] | null | null | null | Source/Renderer/Commands/OpenGL/ArrayCommands.h | pgrabas/MoonGlare | 25807680700697023d04830402af168f624ffb35 | [
"MIT"
] | null | null | null | #pragma once
#include "../CommandQueueBase.h"
#include "Common.h"
namespace MoonGlare::Renderer::Commands {
struct VAOBindArgument {
Device::VAOHandle m_VAO;
static void Execute(const VAOBindArgument *arg) {
glBindVertexArray(arg->m_VAO);
}
};
using VAOBind = CommandTemplate<VAOBindArgument>;
struct VAOBindResourceArgument {
Device::VAOHandle *m_VAO;
static void Execute(const VAOBindResourceArgument *arg) {
glBindVertexArray(*arg->m_VAO);
}
};
using VAOBindResource = CommandTemplate<VAOBindResourceArgument>;
struct VAOReleaseArgument {
static void Execute(const VAOReleaseArgument *arg) {
glBindVertexArray(0);
}
};
using VAORelease = CommandTemplate<VAOReleaseArgument>;
//---------------------------------------------------------------------------------------
struct VAODrawTrianglesArgument {
unsigned m_NumIndices;
unsigned m_IndexValueType;
static void Execute(const VAODrawTrianglesArgument *arg) {
glDrawElements(GL_TRIANGLES, arg->m_NumIndices, arg->m_IndexValueType, 0);
}
};
using VAODrawTriangles = CommandTemplate<VAODrawTrianglesArgument>;
struct VAODrawTrianglesBaseArgument {
unsigned m_NumIndices;
unsigned m_IndexValueType;
unsigned m_BaseIndex;
static void Execute(const VAODrawTrianglesBaseArgument *arg) {
glDrawElements(GL_TRIANGLES, arg->m_NumIndices, arg->m_IndexValueType, reinterpret_cast<void*>(arg->m_BaseIndex));
}
};
using VAODrawTrianglesBase = CommandTemplate<VAODrawTrianglesBaseArgument>;
struct VAODrawTrianglesBaseVertexArgument {
unsigned m_NumIndices;
unsigned m_IndexValueType;
unsigned m_BaseIndex;
GLint m_BaseVertex;
static void Execute(const VAODrawTrianglesBaseVertexArgument *arg) {
glDrawElementsBaseVertex(GL_TRIANGLES, arg->m_NumIndices, arg->m_IndexValueType, reinterpret_cast<void*>(arg->m_BaseIndex), arg->m_BaseVertex);
}
};
using VAODrawTrianglesBaseVertex = CommandTemplate<VAODrawTrianglesBaseVertexArgument>;
struct VAODrawElementsArgument {
GLenum m_ElementMode;
unsigned m_NumIndices;
unsigned m_IndexValueType;
static void Execute(const VAODrawElementsArgument *arg) {
glDrawElements(arg->m_ElementMode, arg->m_NumIndices, arg->m_IndexValueType, 0);
}
};
using VAODrawElements = CommandTemplate<VAODrawElementsArgument>;
struct VAODrawArraysArgument {
GLenum mode;
GLint first;
GLsizei count;
static void Execute(const VAODrawArraysArgument *arg) {
glDrawArrays(arg->mode, arg->first, arg->count);
}
};
using VAODrawArrays = CommandTemplate<VAODrawArraysArgument>;
//---------------------------------------------------------------------------------------
//Buffer handling
//---------------------------------------------------------------------------------------
namespace detail {
template<GLenum target>
struct BufferHandling {
static void Bind(Device::BufferHandle handle) {
glBindBuffer(target, handle);
}
static void Data(GLenum mode, GLsizeiptr bytecount, const void* data){
glBufferData(target, bytecount, data, mode);
}
};
template<typename Handler>
struct BindBufferArgument {
Device::BufferHandle m_Handle;
static void Execute(const BindBufferArgument *arg) {
Handler::Bind(arg->m_Handle);
}
};
template<typename Handler>
struct BindBufferResourceArgument {
Device::BufferHandle *m_Handle;
static void Execute(const BindBufferResourceArgument *arg) {
Handler::Bind(*arg->m_Handle);
}
};
template<typename Handler, GLenum Mode>
struct BufferDataArgument {
GLsizeiptr m_ByteCount;
const void *m_DataPtr;
static void Execute(const BufferDataArgument *arg) {
Handler::Data(Mode, arg->m_ByteCount, arg->m_DataPtr);
}
};
template<GLboolean Normalized>
struct BufferChannelArgument {
GLuint m_Channel;
GLint m_ElementSize;
GLenum m_ElementType;
static void Channel(GLuint Channel, GLint ElementSize, GLenum ElementType) {
glEnableVertexAttribArray(Channel);
glVertexAttribPointer(Channel, ElementSize, ElementType, Normalized, 0, 0);
}
static void Execute(const BufferChannelArgument *arg) {
Channel(arg->m_Channel, arg->m_ElementSize, arg->m_ElementType);
}
};
using BindArrayBufferArgument = BindBufferArgument<BufferHandling<GL_ARRAY_BUFFER>>;
using BindArrayIndexBufferArgument = BindBufferArgument<BufferHandling<GL_ELEMENT_ARRAY_BUFFER>>;
using BindArrayBufferResourceArgument = BindBufferResourceArgument<BufferHandling<GL_ARRAY_BUFFER>>;
using BindArrayIndexBufferResourceArgument = BindBufferResourceArgument<BufferHandling<GL_ELEMENT_ARRAY_BUFFER>>;
using ArrayBufferStaticDataArgument = BufferDataArgument<BufferHandling<GL_ARRAY_BUFFER>, GL_STATIC_DRAW>;
using IndexArrayBufferStaticDataArgument = BufferDataArgument<BufferHandling<GL_ELEMENT_ARRAY_BUFFER>, GL_STATIC_DRAW>;
using ArrayBufferDynamicDataArgument = BufferDataArgument<BufferHandling<GL_ARRAY_BUFFER>, GL_DYNAMIC_DRAW>;
using IndexArrayBufferDynamicDataArgument = BufferDataArgument<BufferHandling<GL_ELEMENT_ARRAY_BUFFER>, GL_DYNAMIC_DRAW>;
}
using BindArrayBuffer = CommandTemplate<detail::BindArrayBufferArgument>;
using BindArrayIndexBuffer = CommandTemplate<detail::BindArrayIndexBufferArgument>;
using BindArrayBufferResource = CommandTemplate<detail::BindArrayBufferResourceArgument>;
using BindArrayIndexBufferResource = CommandTemplate<detail::BindArrayIndexBufferResourceArgument>;
using ArrayBufferStaticData = CommandTemplate<detail::ArrayBufferStaticDataArgument>;
using ArrayIndexBufferStaticData = CommandTemplate<detail::IndexArrayBufferStaticDataArgument>;
using ArrayBufferDynamicData = CommandTemplate<detail::ArrayBufferDynamicDataArgument>;
using ArrayIndexBufferDynamicData = CommandTemplate<detail::IndexArrayBufferDynamicDataArgument>;
using ArrayBufferChannel = CommandTemplate<detail::BufferChannelArgument<GL_FALSE>>;
using ArrayBufferNormalizedChannel = CommandTemplate<detail::BufferChannelArgument<GL_TRUE>>;
//---------------------------------------------------------------------------------------
//Buffer allocation
//---------------------------------------------------------------------------------------
namespace detail {
struct BufferAllocation {
using Handle_t = Device::BufferHandle;
static void Allocate(GLsizei count, Handle_t *out) {
glGenBuffers(count, out);
}
static void Release(GLsizei count, Handle_t *out) {
glDeleteBuffers(count, out);
}
};
}
using BufferSingleAllocate = CommandTemplate<detail::SingleAllocate <detail::BufferAllocation> >;
using BufferSingleRelease = CommandTemplate<detail::SingleRelease <detail::BufferAllocation> >;
using BufferBulkAllocate = CommandTemplate<detail::BulkAllocate <detail::BufferAllocation> >;
using BufferBulkRelease = CommandTemplate<detail::BulkRelease <detail::BufferAllocation> >;
//---------------------------------------------------------------------------------------
//VAO allocation
//---------------------------------------------------------------------------------------
namespace detail {
struct VAOAllocation {
using Handle_t = Device::VAOHandle;
static void Allocate(GLsizei count, Handle_t *out) {
glGenVertexArrays(count, out);
}
static void Release(GLsizei count, Handle_t *out) {
glDeleteVertexArrays(count, out);
}
};
}
using VAOSingleAllocate = CommandTemplate<detail::SingleAllocate <detail::VAOAllocation> >;
using VAOSingleRelease = CommandTemplate<detail::SingleRelease <detail::VAOAllocation> >;
using VAOBulkAllocate = CommandTemplate<detail::BulkAllocate <detail::VAOAllocation> >;
using VAOBulkRelease = CommandTemplate<detail::BulkRelease <detail::VAOAllocation> >;
} //namespace MoonGlare::Renderer::Commands
| 35.283721 | 145 | 0.738993 |
14db553969807b7fba46e5b7a8dfd1d57e4b66a1 | 2,564 | c | C | usr/src/lib/libast/common/string/fmtnum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libast/common/string/fmtnum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libast/common/string/fmtnum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* return scaled number n
* string width is 5 chars or less
* if m>1 then n divided by m before scaling
*/
#include <ast.h>
char*
fmtnum(register unsigned long n, int m)
{
register int i;
register unsigned long r;
char* buf;
int z;
char suf[2];
if (m > 1)
{
r = n;
n /= m;
r -= n;
}
else
r = 0;
suf[1] = 0;
if (n < 1024)
suf[0] = 0;
else if (n < 1024 * 1024)
{
suf[0] = 'k';
r = ((n % 1024) * 100) / 1024;
n /= 1024;
}
else if (n < 1024 * 1024 * 1024)
{
suf[0] = 'm';
r = ((n % (1024 * 1024)) * 100) / (1024 * 1024);
n /= 1024 * 1024;
}
else
{
suf[0] = 'g';
r = ((n % (1024 * 1024 * 1024)) * 100) / (1024 * 1024 * 1024);
n /= 1024 * 1024 * 1024;
}
if (r)
{
if (n >= 100)
r = 0;
else if (n >= 10)
{
i = 1;
if (r >= 10)
r /= 10;
}
else
i = 2;
}
buf = fmtbuf(z = 8);
if (r)
sfsprintf(buf, z, "%lu.%0*lu%s", n, i, r, suf);
else
sfsprintf(buf, z, "%lu%s", n, suf);
return buf;
}
| 27.569892 | 72 | 0.349454 |
5e58677f35309f36a9fc79754fbf025f6886f56b | 4,202 | c | C | sdk-6.5.20/libs/sdklt/sal/os/posix/sal_sysrq.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | sdk-6.5.20/libs/sdklt/sal/os/posix/sal_sysrq.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | sdk-6.5.20/libs/sdklt/sal/os/posix/sal_sysrq.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | /*! \file sal_sysrq.c
*
* Platform-dependent system requests.
*/
/*
* This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
*
* Copyright 2007-2020 Broadcom Inc. All rights reserved.
*/
#include <sal/sal_sysrq.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <sys/syscall.h>
/* Backtrace is currently supported only as a glibc extension */
#ifndef SAL_BACKTRACE_SUPPORT
#if defined(__GLIBC__) && !defined(__UCLIBC__)
#define SAL_BACKTRACE_SUPPORT 1
#else
#define SAL_BACKTRACE_SUPPORT 0
#endif
#endif
#if SAL_BACKTRACE_SUPPORT == 1
#include <execinfo.h>
#define BT_REC_MAX 64
static void
gnu_backtrace(void)
{
int nrecs;
void *bt_recs[BT_REC_MAX];
/* Link with -rdynamic to get function names. */
nrecs = backtrace(bt_recs, BT_REC_MAX);
backtrace_symbols_fd(bt_recs, nrecs, STDOUT_FILENO);
}
static int
gdb_present(void)
{
int status;
int pid = fork();
if (pid == -1) {
return -1;
}
if (pid == 0) {
/*
* Use a child to test for gdb, since a ptrace test from the
* primary thread will prevent the backtrace gdb instance from
* attaching later.
*/
int ppid = getppid();
if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) {
/* Wait for the parent to stop and let it continue */
waitpid(ppid, NULL, 0);
ptrace(PTRACE_CONT, NULL, NULL);
/* Presumably gdb is not present */
ptrace(PTRACE_DETACH, getppid(), NULL, NULL);
exit(0);
}
/* Trace failed so assume that gdb is present */
exit(1);
}
/* Let parent wait for child to detemine trace status */
waitpid(pid, &status, 0);
return WEXITSTATUS(status);
}
static int
gdb_backtrace(void)
{
char pid_buf[30];
char cmd_buf[384];
char name_buf[256];
int name_len;
int output_enable;
int tid = 0;
FILE *gdb_out;
#ifdef SYS_gettid
tid = syscall(SYS_gettid);
#endif
/* Get our own name */
name_len = readlink("/proc/self/exe", name_buf, sizeof(name_buf) - 1);
if (name_len <= 0) {
return -1;
}
name_buf[name_len] = 0;
/*
* Since gdb has its own thread numbering system, we cannot
* request a backtrace for a specific thread based on the thread
* ID (tid). Instead we request backtraces for all threads and
* filter the output to suit our needs.
*/
snprintf(cmd_buf, sizeof(cmd_buf) - 1,
"gdb --batch -n -ex 'thread apply all bt' --pid=%d %s",
getpid(), name_buf);
snprintf(pid_buf, sizeof(pid_buf) - 1, "LWP %d", tid);
printf("Attaching gdb for %s ...\n", pid_buf);
if ((gdb_out = popen(cmd_buf, "r")) == NULL) {
printf("FAILED\n");
return -1;
}
output_enable = 0;
while (fgets(cmd_buf, sizeof(cmd_buf) - 1, gdb_out) != NULL) {
if (output_enable) {
if (tid && *cmd_buf != '#') {
/* End of backtrace for this thread */
output_enable = 0;
}
} else {
if (tid == 0 || strstr(cmd_buf, pid_buf) != NULL) {
/* Found matching thread ID */
output_enable = 1;
}
}
if (output_enable) {
/* Only show backtrace for matching thread ID */
printf("%s", cmd_buf);
}
}
pclose(gdb_out);
return 0;
}
static void
show_backtrace(int try_gdb)
{
if (try_gdb == 0 || gdb_present()) {
gnu_backtrace();
} else {
if (gdb_backtrace() < 0) {
gnu_backtrace();
}
}
}
#else
/* No built-in backtrace support */
static void
show_backtrace(int try_gdb)
{
printf("Backtrace not available\n");
}
#endif
void
sal_sysrq(sal_sysrq_t req, unsigned long prm)
{
switch (req) {
case SAL_SYSRQ_EXIT:
exit((int)prm);
break;
case SAL_SYSRQ_RESET:
exit((int)prm);
break;
case SAL_SYSRQ_BACKTRACE:
show_backtrace(prm);
break;
case SAL_SYSRQ_ABORT:
default:
abort();
break;
}
}
| 22.961749 | 134 | 0.591623 |
16d4ede8e8b28b73aeb3a22d78c58836295027be | 269 | h | C | packages/mp_ios_runtime/src/components/basic/MPIOSOverlay.h | aosic/mpflutter | 4219538c2ed2420bf6c15c6fa39bc2776493afd1 | [
"Apache-2.0"
] | 1 | 2022-03-25T12:30:20.000Z | 2022-03-25T12:30:20.000Z | packages/mp_ios_runtime/src/components/basic/MPIOSOverlay.h | aosic/mpflutter | 4219538c2ed2420bf6c15c6fa39bc2776493afd1 | [
"Apache-2.0"
] | null | null | null | packages/mp_ios_runtime/src/components/basic/MPIOSOverlay.h | aosic/mpflutter | 4219538c2ed2420bf6c15c6fa39bc2776493afd1 | [
"Apache-2.0"
] | null | null | null | //
// MPIOSOverlay.h
// mp_ios_runtime
//
// Created by PonyCui on 2021/6/23.
// Copyright © 2021 MPFlutter. All rights reserved.
//
#import "MPIOSComponentView.h"
NS_ASSUME_NONNULL_BEGIN
@interface MPIOSOverlay : MPIOSComponentView
@end
NS_ASSUME_NONNULL_END
| 14.944444 | 52 | 0.750929 |
e52e4c9da9303951750305a8b620fad8e5bbcd36 | 111 | h | C | TapFramework/Classes/TapListController.h | clickntap/TapFramework | 10f05524918540431d9e07944d5aa9c3449a1133 | [
"MIT"
] | null | null | null | TapFramework/Classes/TapListController.h | clickntap/TapFramework | 10f05524918540431d9e07944d5aa9c3449a1133 | [
"MIT"
] | null | null | null | TapFramework/Classes/TapListController.h | clickntap/TapFramework | 10f05524918540431d9e07944d5aa9c3449a1133 | [
"MIT"
] | null | null | null | #import "TapController.h"
@interface TapListController : TapController {
UIScrollView* container;
}
@end
| 13.875 | 46 | 0.747748 |
394fead70da08996f4daf843d2ea5d21061c78a0 | 6,021 | h | C | clustering_curves.h | dsoumis/VCClustering | 264155331fe6e256a2f3f6d711785e204b4226ae | [
"MIT"
] | null | null | null | clustering_curves.h | dsoumis/VCClustering | 264155331fe6e256a2f3f6d711785e204b4226ae | [
"MIT"
] | null | null | null | clustering_curves.h | dsoumis/VCClustering | 264155331fe6e256a2f3f6d711785e204b4226ae | [
"MIT"
] | null | null | null | #ifndef SECOND_STEP_CLUSTERING_CURVES_H
#define SECOND_STEP_CLUSTERING_CURVES_H
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <unordered_map>
#include <cstdio>
#include <ctime>
#include <chrono>
#include <random>
#include "InputImplementation.h"
#include "HashTables.h"
#include "BruteForceImplementation.h"
#include "ClusterStructure.h"
#include "Dtw.h"
#include "GridImplementation.h"
#include "HashPair.h"
#include "kmeansPlusPlus.h"
using namespace std;
template<class inputData>
class CurveClustering {
private:
unsigned int k;
//Centers consist of a string ItemID the vector of this item and its index in curvesVector. If the item is out of dataset ItemID="OutOfDataset" and index=-1
vector<tuple<string, vector<inputData>, int>> centers;
unsigned int maxCurveSize, minCurveSize;
vector<struct cluster<inputData>> clusters;
//Will be used to save the distances between vectors and save a lot of time when there is a demand of recalculating.
//New hashing because unordered map can't support pairs
//The key to unordered map are the indexes in curvesVector
unordered_map<pair<int, int>, double, hash_pair> calculatedDistances;
class LSH {
public:
int L_grid;
int k_vec;
double max_coord;
double radius;
vector<Grid<inputData>> grids;
vector<HashTables<inputData>> hashTables;
vector<HashFunctions<double>> hashFunctions;
vector<double> w; //One w for each grid
vector<vector<vector<double>>> concatenated_gridCurve_vectors;
LSH(int const &k_vec_given, int const &L_given,
double const &radius_given, unsigned int const &minCurveSize, unsigned int const &maxCurveSize,
unsigned int const &dimensions, double const &delta, InputGenericVector<inputData> const &curvesVector,
double const &max_coord_given) {
k_vec = k_vec_given;
L_grid = L_given;
radius = radius_given;
max_coord = max_coord_given;
grids.reserve((unsigned long) L_grid);
hashFunctions.reserve((unsigned long) L_grid);
hashTables.reserve((unsigned long) L_grid);
w.resize((unsigned long) L_grid);
concatenated_gridCurve_vectors.resize((unsigned long) L_grid);
for (unsigned int v = 0; v < L_grid; v++) {
concatenated_gridCurve_vectors[v].resize(curvesVector.itemValues.size());
}
for (unsigned int i = 0; i < L_grid; i++) {
grids.emplace_back(Grid<inputData>(minCurveSize, dimensions, delta));//Create L_grid grids
//Create the concatenated grid curve vector for each curve of each grid
for (unsigned int curve = 0; curve < curvesVector.itemValues.size(); curve++) {
concatenated_gridCurve_vectors[i][curve] = grids[i].concatenated_vector_from_gridCurve(
curvesVector.itemValues[curve].second, maxCurveSize, max_coord);
}
//Exact Neighbours here calculates only 5% of neighbors for speed
ExactNeighboursVector<double> temp_concatenatedNeighbors(concatenated_gridCurve_vectors[i],
concatenated_gridCurve_vectors[i], true);
w[i] = temp_concatenatedNeighbors.wCalculator();
hashFunctions.emplace_back(
HashFunctions<double>(k_vec, maxCurveSize,
w[i]));//Create L_grid g functions. One for each grid.
hashTables.emplace_back(HashTables<inputData>(1)); //Create L_grid LSHs with one hash table each.
}
}
};
LSH *lsh;
//Unordered map of itemIDs
//key is index in curvesVector
//pair of index of cluster assigned to, distance from centroid of cluster
unordered_map<int, pair<int, double>> assignedItems;
double fast_distance_calculationC(int const &index1, int const &index2, vector<inputData> const &item1,
vector<inputData> const &item2);
void InitializationSimplest(InputGenericVector<inputData> const &curvesVector);
void InitializationKmeansPlusPlus(InputGenericVector<inputData> const &curvesVector);
void AssignmentSimplest(InputGenericVector<inputData> const &curvesVector);
void
ReverseAssignmentPreload(InputGenericVector<inputData> &curvesVector, int const &k_vec_given, int const &L_given,
unsigned int const &dimensions);
void ReverseAssignment(InputGenericVector<inputData> const &curvesVector);
void InitializationUpdate(unsigned int const &cluster_index, InputGenericVector<inputData> const &curvesVector,
unsigned long &lamda, vector<inputData> &C);
void UpdateSimplest(InputGenericVector<inputData> const &curvesVector, bool &unchangedCenters);
void UpdateALaLoyd(InputGenericVector<inputData> const &curvesVector, bool &unchangedCenters);
void Silhouette(InputGenericVector<inputData> &curvesVector);
void Printing(unsigned int const &whichInitialization, unsigned int const &whichAssignment,
unsigned int const &whichUpdate, bool const &complete, double const &duration,
InputGenericVector<inputData> &curvesVector, string const &outputFile);
public:
explicit CurveClustering(InputGenericVector<inputData> &curvesVector, unsigned int const &k_given,
unsigned int const &maxSize, unsigned int const &minSize,
unsigned int const &whichInitialization, unsigned int const &whichAssignment,
unsigned int const &whichUpdate, unsigned int const &k_of_lsh, unsigned int const &L_grid,
bool const &complete, string const &outputFile);
};
#endif //SECOND_STEP_CLUSTERING_CURVES_H
| 43.007143 | 160 | 0.669158 |
c2253ea98adb5e3dc6e2f48ca7f5fda1338a5c56 | 7,304 | h | C | Source/Scripting/bsfScript/BsScriptEnginePrerequisites.h | ValtoFrameworks/bsf | bb7a21e813a400dfdb8473dc3827e8e75150de99 | [
"MIT"
] | 2 | 2019-07-08T17:26:25.000Z | 2019-10-13T19:15:28.000Z | Source/Scripting/bsfScript/BsScriptEnginePrerequisites.h | ValtoFrameworks/bsf | bb7a21e813a400dfdb8473dc3827e8e75150de99 | [
"MIT"
] | null | null | null | Source/Scripting/bsfScript/BsScriptEnginePrerequisites.h | ValtoFrameworks/bsf | bb7a21e813a400dfdb8473dc3827e8e75150de99 | [
"MIT"
] | 4 | 2019-06-23T09:55:47.000Z | 2019-07-08T17:23:05.000Z | //********************************* bs::framework - Copyright 2018-2019 Marko Pintera ************************************//
//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
#pragma once
#include "BsMonoPrerequisites.h"
// DLL export
#if BS_PLATFORM == BS_PLATFORM_WIN32 // Windows
# if BS_COMPILER == BS_COMPILER_MSVC
# if defined(BS_SCR_BE_STATIC_LIB) || defined(BS_SBGEN)
# define BS_SCR_BE_EXPORT
# else
# if defined(BS_SCR_BE_EXPORTS)
# define BS_SCR_BE_EXPORT __declspec(dllexport)
# else
# define BS_SCR_BE_EXPORT __declspec(dllimport)
# endif
# endif
# else
# if defined(BS_SCR_BE_STATIC_LIB) || defined(BS_SBGEN)
# define BS_SCR_BE_EXPORT
# else
# if defined(BS_SCR_BE_EXPORTS)
# define BS_SCR_BE_EXPORT __attribute__ ((dllexport))
# else
# define BS_SCR_BE_EXPORT __attribute__ ((dllimport))
# endif
# endif
# endif
# define BS_SCR_BE_HIDDEN
#else // Linux/Mac settings
# define BS_SCR_BE_EXPORT __attribute__ ((visibility ("default")))
# define BS_SCR_BE_HIDDEN __attribute__ ((visibility ("hidden")))
#endif
/** @addtogroup Plugins
* @{
*/
/** @defgroup bsfScript bsfScript
* Contains script interop objects and other scripting functionality for the engine layer.
* @{
*/
/** @defgroup ScriptInteropEngine Interop
* Script interop objects for communicating between native code and the managed assembly.
*/
/** @cond RTTI */
/** @defgroup RTTI-Impl-SEngine RTTI types
* Types containing RTTI for specific classes.
*/
/** @endcond */
/** @} */
/** @} */
namespace bs
{
#if !BS_IS_BANSHEE3D
constexpr const char* ENGINE_ASSEMBLY = "bsfSharpCore";
#else
constexpr const char* ENGINE_ASSEMBLY = "MBansheeEngine";
constexpr const char* SCRIPT_GAME_ASSEMBLY = "MScriptGame";
#endif
constexpr const char* ENGINE_NS = "bs";
class ScriptObjectBase;
class ScriptResourceManager;
class ScriptResourceBase;
class ScriptFont;
class ScriptSpriteTexture;
class ScriptShaderInclude;
class ScriptTexture;
class ScriptPlainText;
class ScriptScriptCode;
class ScriptShader;
class ScriptMaterial;
class ScriptMesh;
class ScriptPrefab;
class ScriptStringTable;
class ScriptGUIElementStyle;
class ScriptGUIElementStateStyle;
class ScriptGUILayout;
class ScriptGUILabel;
class ScriptGUIScrollArea;
class ScriptGUIScrollAreaLayout;
class ScriptGameObjectBase;
class ScriptSceneObject;
class ScriptComponentBase;
class ScriptComponent;
class ScriptManagedComponent;
class ScriptManagedResource;
class ScriptRenderTarget;
class ScriptRenderTexture;
class ManagedComponent;
class ManagedSerializableFieldData;
class ManagedSerializableFieldKey;
class ManagedSerializableFieldDataEntry;
class ManagedSerializableTypeInfo;
class ManagedSerializableTypeInfoPrimitive;
class ManagedSerializableTypeInfoObject;
class ManagedSerializableTypeInfoArray;
class ManagedSerializableTypeInfoList;
class ManagedSerializableTypeInfoDictionary;
class ManagedSerializableObject;
class ManagedSerializableArray;
class ManagedSerializableList;
class ManagedSerializableDictionary;
class ManagedSerializableAssemblyInfo;
class ManagedSerializableObjectInfo;
class ManagedSerializableMemberInfo;
class ManagedSerializableObjectData;
class ManagedSerializableDiff;
class ManagedResource;
class ManagedResourceMetaData;
class ScriptSerializableProperty;
class ScriptAssemblyManager;
class ScriptHString;
class ScriptContextMenu;
class ScriptGUISkin;
class ScriptResourceRef;
class ScriptPhysicsMaterial;
class ScriptPhysicsMesh;
class ScriptRigidbody;
class ScriptColliderBase;
class ScriptAudioClip;
class ScriptReflectableBase;
struct ScriptMeta;
typedef GameObjectHandle<ManagedComponent> HManagedComponent;
typedef ResourceHandle<ManagedResource> HManagedResource;
enum TypeID_bsfScript
{
TID_ManagedComponent = 50000,
TID_ScriptSerializableObject = 50001,
TID_ScriptSerializableArray = 50002,
TID_SerializableAssemblyInfo = 50004,
TID_SerializableObjectInfo = 50005,
TID_SerializableMemberInfo = 50006,
TID_SerializableTypeInfo = 50007,
TID_SerializableTypeInfoPrimitive = 50008,
TID_SerializableTypeInfoObject = 50009,
TID_SerializableTypeInfoArray = 50010,
TID_SerializableFieldData = 50011,
TID_SerializableFieldKey = 50012,
TID_SerializableFieldDataEntry = 50013,
TID_SerializableFieldDataBool = 50014,
TID_SerializableFieldDataChar = 50015,
TID_SerializableFieldDataI8 = 50016,
TID_SerializableFieldDataU8 = 50017,
TID_SerializableFieldDataI16 = 50018,
TID_SerializableFieldDataU16 = 50019,
TID_SerializableFieldDataI32 = 50020,
TID_SerializableFieldDataU32 = 50021,
TID_SerializableFieldDataI64 = 50022,
TID_SerializableFieldDataU64 = 50023,
TID_SerializableFieldDataFloat = 50024,
TID_SerializableFieldDataDouble = 50025,
TID_SerializableFieldDataString = 50026,
TID_SerializableFieldDataResourceRef = 50027,
TID_SerializableFieldDataGameObjectRef = 50028,
TID_SerializableFieldDataObject = 50029,
TID_SerializableFieldDataArray = 50030,
TID_SerializableFieldDataList = 50031,
TID_SerializableFieldDataDictionary = 50032,
TID_SerializableTypeInfoList = 50033,
TID_SerializableTypeInfoDictionary = 50034,
TID_ScriptSerializableList = 50035,
TID_ScriptSerializableDictionary = 50036,
TID_ManagedResource = 50037,
TID_ManagedResourceMetaData = 50038,
TID_ScriptSerializableObjectData = 50039,
TID_ScriptSerializableDiff = 50040,
TID_ScriptModification = 50041,
TID_ScriptModifiedObject = 50042,
TID_ScriptModifiedArray = 50043,
TID_ScriptModifiedDictionary = 50044,
TID_ScriptModifiedEntry = 50045,
TID_ScriptModifiedField = 50046,
TID_ScriptModifiedArrayEntry = 50047,
TID_ScriptModifiedDictionaryEntry = 50048,
TID_ScriptSerializableDictionaryKeyValue = 50049,
TID_SerializableTypeInfoRef = 50050,
TID_SerializableFieldInfo = 50051,
TID_SerializablePropertyInfo = 50052,
TID_SerializableTypeInfoRRef = 50053,
TID_SerializableTypeInfoEnum = 50054,
TID_SerializableFieldDataReflectableRef = 50055,
};
/** Information about a builtin component wrapped as a script object. */
struct BuiltinComponentInfo
{
const ScriptMeta* metaData;
UINT32 typeId;
MonoClass* monoClass;
std::function<ScriptComponentBase*(const HComponent&)> createCallback;
};
/** Types of resources accessible from script code. */
enum class ScriptResourceType // Note: Must be the same as C# enum ResourceType
{
Texture, SpriteTexture, Mesh, Font, Shader, ShaderInclude, Material, Prefab,
PlainText, ScriptCode, StringTable, GUISkin, PhysicsMaterial, PhysicsMesh, AudioClip, AnimationClip,
VectorField, Undefined
};
/** Information about a builtin resource wrapped as a script object. */
struct BuiltinResourceInfo
{
const ScriptMeta* metaData;
UINT32 typeId;
MonoClass* monoClass;
ScriptResourceType resType;
std::function<ScriptResourceBase*(const HResource&, MonoObject*)> createCallback;
};
/** Information about a native reflectable object wrapped as a script object. */
struct ReflectableTypeInfo
{
const ScriptMeta* metaData;
UINT32 typeId;
MonoClass* monoClass;
std::function<MonoObject*(const SPtr<IReflectable>&)> createCallback;
};
} | 31.895197 | 124 | 0.786008 |
05a6630d67e28c83742af79e9cccdfadd2edcd93 | 439 | h | C | src/handle_signals.h | bkerivan/LANScanner | 7f4b2cd58de00805878f086ae3b26b5c75aabfa2 | [
"MIT"
] | 1 | 2019-09-22T14:32:04.000Z | 2019-09-22T14:32:04.000Z | src/handle_signals.h | bkerivan/LANScanner | 7f4b2cd58de00805878f086ae3b26b5c75aabfa2 | [
"MIT"
] | null | null | null | src/handle_signals.h | bkerivan/LANScanner | 7f4b2cd58de00805878f086ae3b26b5c75aabfa2 | [
"MIT"
] | null | null | null | #ifndef HANDLE_SIGNALS_H
#define HANDLE_SIGNALS_H
/*
* Global signal flag that can be used by various functions, namely run_scan,
* to terminate execution when a signal is caught
*/
extern int signal_flag;
/*
* Set signal flag if a marked signal has been caught.
*/
void
sighandler(int signum);
/*
* Catch all catchable signals that terminate process (plus SIGQUIT).
*/
void
catch_signals(void);
#endif /* HANDLE_SIGNALS_H */
| 18.291667 | 77 | 0.740319 |
1977a6439959c1b3ff7b7b9d9eb64f8f8eb35b95 | 959 | h | C | include/display/display.h | PurplePachyderm/free-freeciv | f29ec74b568f36dd1d10e343b5b15b63595290c1 | [
"MIT"
] | null | null | null | include/display/display.h | PurplePachyderm/free-freeciv | f29ec74b568f36dd1d10e343b5b15b63595290c1 | [
"MIT"
] | null | null | null | include/display/display.h | PurplePachyderm/free-freeciv | f29ec74b568f36dd1d10e343b5b15b63595290c1 | [
"MIT"
] | null | null | null | #pragma once
#include "../coord.h"
#include "../game/game.h"
//Essential macros/functions for display, game and camera events management
//Macros
#define REFRESH_PERIOD 17
#define SCREEN_WIDTH 1920
#define SCREEN_HEIGHT 1080
#define TILE_SIZE 50
#define MAX_ZOOM 5
#define MIN_ZOOM 0.8
#define ZOOM_FACTOR 0.25
//Event macros (defines types of events)
#define MENU 1
#define TILE_SELECTION 2
#define CAMERA 3
#define END_TURN 4
//Structures
typedef struct{
coord offset;
float zoom;
int leftClick;
}view;
//Prototypes
void setRectangle(SDL_Rect * rect, int x, int y, int w, int h);
void blitSprite(SDL_Renderer * renderer, SDL_Texture * texture, int xSprite, int ySprite, int x, int y, int width);
int events(SDL_Event event, view *camera, struct game game, coord * selectedTile);
void movementAnim(SDL_Renderer * renderer, SDL_Texture * texture, view * camera, struct game * game, coord * path, int length, int tokenId);
| 22.833333 | 140 | 0.735141 |
b271335a0cd1c0d97d2ef478e4d587baab021272 | 1,031 | h | C | src/qif191/QIFDocument/type_t.CInspectionScopeEnumType.h | QualityInformationFramework/QIFResourcesEditor | 4ff1de9d1dd20d9c43eaa9cc320caeff1c57760e | [
"BSL-1.0"
] | null | null | null | src/qif191/QIFDocument/type_t.CInspectionScopeEnumType.h | QualityInformationFramework/QIFResourcesEditor | 4ff1de9d1dd20d9c43eaa9cc320caeff1c57760e | [
"BSL-1.0"
] | null | null | null | src/qif191/QIFDocument/type_t.CInspectionScopeEnumType.h | QualityInformationFramework/QIFResourcesEditor | 4ff1de9d1dd20d9c43eaa9cc320caeff1c57760e | [
"BSL-1.0"
] | null | null | null | #pragma once
namespace qif191
{
namespace t
{
class CInspectionScopeEnumType : public TypeBase
{
public:
QIF191_EXPORT CInspectionScopeEnumType(xercesc::DOMNode* const& init);
QIF191_EXPORT CInspectionScopeEnumType(CInspectionScopeEnumType const& init);
void operator=(CInspectionScopeEnumType const& other) { m_node = other.m_node; }
static altova::meta::SimpleType StaticInfo() { return altova::meta::SimpleType(types + _altova_ti_t_altova_CInspectionScopeEnumType); }
enum EnumValues {
Invalid = -1,
k_DETAIL = 0, // DETAIL
k_ASSEMBLY = 1, // ASSEMBLY
EnumValueCount
};
void operator= (const string_type& value)
{
altova::XmlFormatter* Formatter = static_cast<altova::XmlFormatter*>(altova::AnySimpleTypeFormatter);
XercesTreeOperations::SetValue(GetNode(), Formatter->Format(value));
}
operator string_type()
{
return CastAs<string_type >::Do(GetNode(), 0);
}
};
} // namespace t
} // namespace qif191
//#endif // _ALTOVA_INCLUDED_QIFDocument_ALTOVA_t_ALTOVA_CInspectionScopeEnumType
| 23.431818 | 136 | 0.757517 |
95b4e346496f574aed628b86c8121880839ddeeb | 928 | h | C | LibFoundation/Core/include/bf/math/bifrost_math.h | BluFedora/BluFedoraEngine | 41d0948f6a3a41c38fcc9217fe68105e6f1f9c5f | [
"MIT"
] | null | null | null | LibFoundation/Core/include/bf/math/bifrost_math.h | BluFedora/BluFedoraEngine | 41d0948f6a3a41c38fcc9217fe68105e6f1f9c5f | [
"MIT"
] | null | null | null | LibFoundation/Core/include/bf/math/bifrost_math.h | BluFedora/BluFedoraEngine | 41d0948f6a3a41c38fcc9217fe68105e6f1f9c5f | [
"MIT"
] | null | null | null | // TODO(SR): Delete Me!
#ifndef BIFROST_MATH2_H
#define BIFROST_MATH2_H
#include <float.h> /* DBL_MAX, FLT_MAX, DBL_EPSILON, FLT_EPSILON */
#include <math.h> /* pow, powf, fabs, fabsf, sqrt, sqrtf */
#define BIFROST_PHYSICS_DBL 0
#define BIFROST_PHYSICS_FLT 1
#if defined(BIFROST_USE_DOUBLE) && BIFROST_USE_DOUBLE
#define BIFROST_PHYSICS_PRECISION BIFROST_PHYSICS_DBL
#else
#define BIFROST_PHYSICS_PRECISION BIFROST_PHYSICS_FLT
#endif
#if BIFROST_PHYSICS_PRECISION == BIFROST_PHYSICS_DBL
#define max_real DBL_MAX
#define pow_real pow
#define abs_real fabs
#define sqrt_real sqrt
#define epsilon_real DBL_EPSILON
typedef double bf_real;
#elif BIFROST_PHYSICS_PRECISION == BIFROST_PHYSICS_FLT
#define max_real FLT_MAX
#define pow_real powf
#define abs_real fabsf
#define sqrt_real sqrtf
#define epsilon_real FLT_EPSILON
typedef float bf_real;
#else
#error "A floating point precision must be specified."
#endif
#endif
| 26.514286 | 67 | 0.807112 |
d788579f0cd737c99d7d41146bd15b8bbc3c64e0 | 316 | h | C | HypnoNerd/HypnoNerd/BWHHypnosisViewController.h | huangbow/iOSDevLearning | 4f126be79de3ae5d8491edc08f44cdd1869899a9 | [
"MIT"
] | null | null | null | HypnoNerd/HypnoNerd/BWHHypnosisViewController.h | huangbow/iOSDevLearning | 4f126be79de3ae5d8491edc08f44cdd1869899a9 | [
"MIT"
] | null | null | null | HypnoNerd/HypnoNerd/BWHHypnosisViewController.h | huangbow/iOSDevLearning | 4f126be79de3ae5d8491edc08f44cdd1869899a9 | [
"MIT"
] | null | null | null | //
// BWHHypnosisViewController.h
// HypnoNerd
//
// Created by Bowen Huang on 4/12/15.
// Copyright (c) 2015 bowen. All rights reserved.
//
//#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface BWHHypnosisViewController : UIViewController
//@property (nonatomic, strong) UIView *view;
@end
| 18.588235 | 55 | 0.718354 |
f97eb1449541aac2de72f551e7b17db663b6f006 | 2,771 | h | C | dbms/src/Storages/Transaction/RegionManager.h | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 85 | 2022-03-25T09:03:16.000Z | 2022-03-25T09:45:03.000Z | dbms/src/Storages/Transaction/RegionManager.h | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 7 | 2022-03-25T08:59:10.000Z | 2022-03-25T09:40:13.000Z | dbms/src/Storages/Transaction/RegionManager.h | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 11 | 2022-03-25T09:15:36.000Z | 2022-03-25T09:45:07.000Z | // Copyright 2022 PingCAP, Ltd.
//
// 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.
#pragma once
#include <Storages/Transaction/RegionsRangeIndex.h>
#include <Storages/Transaction/Types.h>
#include <Storages/Transaction/Utils.h>
#include <unordered_map>
namespace DB
{
class RegionTaskLock;
struct RegionTaskCtrl : MutexLockWrap
{
/// The life time of each RegionTaskElement element should be as long as RegionManager, just return const ref.
struct RegionTaskElement : private boost::noncopyable
{
mutable std::mutex mutex;
};
/// Encapsulate the task lock for region
RegionTaskLock genRegionTaskLock(RegionID region_id) const;
private:
mutable std::unordered_map<RegionID, RegionTaskElement> regions;
};
/// RegionManager is used to store region instance and mutex for region to execute raft cmd/task.
struct RegionManager : SharedMutexLockWrap
{
struct RegionReadLock
{
std::shared_lock<std::shared_mutex> lock;
const RegionMap & regions;
const RegionsRangeIndex & index;
};
struct RegionWriteLock
{
std::unique_lock<std::shared_mutex> lock;
RegionMap & regions;
RegionsRangeIndex & index;
};
RegionReadLock genRegionReadLock() const
{
return {genReadLockGuard(), regions, region_range_index};
}
RegionWriteLock genRegionWriteLock()
{
return {genWriteLockGuard(), regions, region_range_index};
}
/// Encapsulate the task lock for region
RegionTaskLock genRegionTaskLock(RegionID region_id) const;
/// RegionManager can only be constructed by KVStore.
RegionManager() = default;
private:
RegionTaskCtrl region_task_ctrl;
RegionMap regions;
// region_range_index must be protected by task_mutex. It's used to search for region by range.
// region merge/split/apply-snapshot/remove will change the range.
RegionsRangeIndex region_range_index;
};
/// Task lock for region to prevent other thread persist middle state during applying raft cmd.
class RegionTaskLock : private boost::noncopyable
{
friend struct RegionTaskCtrl;
explicit RegionTaskLock(std::mutex & mutex_)
: lock(mutex_)
{}
std::lock_guard<std::mutex> lock;
};
} // namespace DB
| 29.478723 | 114 | 0.722122 |
c7b03be0ff3b88055bcae7146e8aa0973036551c | 287 | h | C | db-4.8.30/examples_c/ex_apprec/ex_apprec_auto.h | Li-Simon/bitcoin-msvc | b874e6f6113d974f055e9aaa1f576ec243b5025a | [
"MIT"
] | 28 | 2017-05-16T11:05:49.000Z | 2022-01-23T15:53:17.000Z | db-4.8.30/examples_c/ex_apprec/ex_apprec_auto.h | Li-Simon/bitcoin-msvc | b874e6f6113d974f055e9aaa1f576ec243b5025a | [
"MIT"
] | 8 | 2017-03-10T16:13:36.000Z | 2021-03-03T07:22:35.000Z | db-4.8.30/examples_c/ex_apprec/ex_apprec_auto.h | Li-Simon/bitcoin-msvc | b874e6f6113d974f055e9aaa1f576ec243b5025a | [
"MIT"
] | 26 | 2017-06-06T05:20:40.000Z | 2020-01-18T01:17:35.000Z | /* Do not edit: automatically built by gen_rec.awk. */
#ifndef ex_apprec_AUTO_H
#define ex_apprec_AUTO_H
#define DB_ex_apprec_mkdir 10000
typedef struct _ex_apprec_mkdir_args {
u_int32_t type;
DB_TXN *txnp;
DB_LSN prev_lsn;
DBT dirname;
} ex_apprec_mkdir_args;
#endif
| 20.5 | 54 | 0.759582 |
44038a284c1a72639d92bca58eb20575d782cc57 | 2,371 | h | C | TAO/tao/ORB_Core_TSS_Resources.h | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 36 | 2015-01-10T07:27:33.000Z | 2022-03-07T03:32:08.000Z | TAO/tao/ORB_Core_TSS_Resources.h | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 2 | 2018-08-13T07:30:51.000Z | 2019-02-25T03:04:31.000Z | TAO/tao/ORB_Core_TSS_Resources.h | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 38 | 2015-01-08T14:12:06.000Z | 2022-01-19T08:33:00.000Z | // -*- C++ -*-
// ===================================================================
/**
* @file ORB_Core_TSS_Resources.h
*
* $Id: ORB_Core_TSS_Resources.h 91153 2010-07-21 10:04:02Z vzykov $
*
* @author DOC Center - Washington University at St. Louis
* @author DOC Laboratory - University of California at Irvine
*/
// ===================================================================
#ifndef TAO_ORB_CORE_TSS_RESOURCES_H
#define TAO_ORB_CORE_TSS_RESOURCES_H
#include /**/ "ace/pre.h"
#include /**/ "tao/TAO_Export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "tao/orbconf.h"
#include "ace/Array_Base.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
class TAO_ORB_Core;
/**
* @class TAO_ORB_Core_TSS_Resources
*
* @brief The TSS resoures of an ORB core.
*
* This class is used by the ORB_Core to store the resources
* potentially bound to a thread in TSS storage. The members are public
* because only the ORB Core is expected to access them.
*/
class TAO_Export TAO_ORB_Core_TSS_Resources
{
public:
/// Constructor
TAO_ORB_Core_TSS_Resources (void);
/// destructor
~TAO_ORB_Core_TSS_Resources (void);
/// Cleans TSS resources.
void fini (void);
private:
/// The ORB Core TSS resources should not be copied
TAO_ORB_Core_TSS_Resources (const TAO_ORB_Core_TSS_Resources&);
void operator= (const TAO_ORB_Core_TSS_Resources&);
public:
/**
* @todo
* The rest of the resources are not currently in use, just a plan
* for the future...
*/
/// Counter for how (nested) calls this thread has made to run the
/// event loop.
int event_loop_thread_;
/// Counter for how many times this thread has become a client
/// leader.
int client_leader_thread_;
/// Lane for this thread.
void *lane_;
/// Generic container for thread-specific objects.
ACE_Array_Base<void *> ts_objects_;
// Set to true by the wait_on_lf_no_nested_upcall wait strategy
// @CJC@ maybe we should use allocate_tss_slot_id() instead?
bool upcalls_temporarily_suspended_on_this_thread_;
/// Pointer to the ORB core. Needed to get access to the TSS
/// cleanup functions for the TSS objects stored in the TSS object
/// array in this class.
TAO_ORB_Core *orb_core_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* TAO_ORB_CORE_H */
| 24.957895 | 71 | 0.680304 |
442af727008e77a63f1c25c4832ce92963f43376 | 1,746 | h | C | UI/GUIEdge.h | DeeDive/TSP-Solver | 9e445724fe9f85975a37d93777d96e0ef63f17d3 | [
"MIT"
] | null | null | null | UI/GUIEdge.h | DeeDive/TSP-Solver | 9e445724fe9f85975a37d93777d96e0ef63f17d3 | [
"MIT"
] | null | null | null | UI/GUIEdge.h | DeeDive/TSP-Solver | 9e445724fe9f85975a37d93777d96e0ef63f17d3 | [
"MIT"
] | null | null | null | #ifndef GUIEDGE_H
#define GUIEDGE_H
#include <QGraphicsItem>
class GUINode;
/**
* @brief The GUIEdge class represent an edge in the GUI scene.
*
* An edge connects two nodes and is always directed.
*/
class GUIEdge : public QGraphicsItem
{
public:
/**
* Creates a new GUIEdge with the specified destination
* and source nodes (cities).
* @param sourceGUINode the origin node.
* @param destGUINode the destination node.
*/
GUIEdge(GUINode* sourceGUINode, GUINode* destGUINode);
/**
* @return the source node of the edge.
*/
GUINode* sourceGUINode() const;
/**
* @return the destination node of the edge.
*/
GUINode* destGUINode() const;
/**
* Refresh the position of the edge depending on the node position.
*/
void adjust();
/**
* @return the type identifier of this scene item.
*/
int type() const override { return UserType + 2; }
protected:
/**
* @return the bouding rect of the item.
*/
QRectF boundingRect() const override;
/**
* Paints the edge (line + arrow).
* @param painter the QPainter used to paint the GUIEdge.
* @param option the painting options.
* @param widget the corresponding widget.
*/
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
private:
/** The source node of the edge. */
GUINode* source;
/** The destination node of the edge. */
GUINode* dest;
/** The source point of the edge. */
QPointF sourcePoint;
/** The destination point of the edge. */
QPointF destPoint;
/** The size of the arrow at the end of the edge. */
qreal arrowSize;
};
#endif // GUIEDGE_H
| 24.25 | 100 | 0.636884 |
be59e3d69a8bda87be1d455363407358d34112c6 | 2,717 | h | C | src/envoy/tcp/mixer/config.h | AdamDang/proxy | 634dd620ebedfd1ecd32f6c8433daa40706caacf | [
"Apache-2.0"
] | null | null | null | src/envoy/tcp/mixer/config.h | AdamDang/proxy | 634dd620ebedfd1ecd32f6c8433daa40706caacf | [
"Apache-2.0"
] | null | null | null | src/envoy/tcp/mixer/config.h | AdamDang/proxy | 634dd620ebedfd1ecd32f6c8433daa40706caacf | [
"Apache-2.0"
] | null | null | null | /* Copyright 2017 Istio Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
*/
#pragma once
#include "mixer/v1/config/client/client_config.pb.h"
#include "src/envoy/utils/config.h"
namespace Envoy {
namespace Tcp {
namespace Mixer {
namespace {
// Default time interval for periodical report is 10 seconds.
const std::chrono::milliseconds kDefaultReportIntervalMs(10000);
// Minimum time interval for periodical report is 1 seconds.
const std::chrono::milliseconds kMinReportIntervalMs(1000);
} // namespace
// Config for tcp filter.
class Config {
public:
Config(const ::istio::mixer::v1::config::client::TcpClientConfig& config_pb)
: config_pb_(config_pb) {
Utils::SetDefaultMixerClusters(config_pb_.mutable_transport());
if (config_pb_.has_report_interval() &&
config_pb_.report_interval().seconds() >= 0 &&
config_pb_.report_interval().nanos() >= 0) {
report_interval_ms_ = std::chrono::milliseconds(
config_pb_.report_interval().seconds() * 1000 +
config_pb_.report_interval().nanos() / 1000000);
// If configured time interval is less than 1 second, then set report
// interval to 1 second.
if (report_interval_ms_ < kMinReportIntervalMs) {
report_interval_ms_ = kMinReportIntervalMs;
}
} else {
report_interval_ms_ = kDefaultReportIntervalMs;
}
}
// The Tcp client config.
const ::istio::mixer::v1::config::client::TcpClientConfig& config_pb() const {
return config_pb_;
}
// check cluster
const std::string& check_cluster() const {
return config_pb_.transport().check_cluster();
}
// report cluster
const std::string& report_cluster() const {
return config_pb_.transport().report_cluster();
}
std::chrono::milliseconds report_interval_ms() const {
return report_interval_ms_;
}
private:
// The Tcp client config.
::istio::mixer::v1::config::client::TcpClientConfig config_pb_;
// Time interval in milliseconds for sending periodical delta reports.
std::chrono::milliseconds report_interval_ms_;
};
typedef std::unique_ptr<Config> ConfigPtr;
} // namespace Mixer
} // namespace Tcp
} // namespace Envoy
| 31.593023 | 80 | 0.716231 |
80c1bf077409c055226c95fe0a5b39ea9844b699 | 5,833 | c | C | conf/objs/process.c | papan-singh/cortx-motr-1 | 79351a56dffcb3968db9a6d4fee685a5443ed2f7 | [
"Apache-2.0"
] | 45 | 2020-09-25T09:33:23.000Z | 2022-02-23T02:54:10.000Z | conf/objs/process.c | mbcortx/cortx-motr | 8d45476d627d0f82047e88dff317db64cc142f58 | [
"Apache-2.0"
] | 1,057 | 2020-09-24T15:29:24.000Z | 2022-03-31T20:48:17.000Z | conf/objs/process.c | mbcortx/cortx-motr | 8d45476d627d0f82047e88dff317db64cc142f58 | [
"Apache-2.0"
] | 178 | 2020-09-24T13:38:26.000Z | 2022-03-31T07:50:58.000Z | /*
* Copyright (c) 2014-2020 Seagate Technology LLC and/or its Affiliates
*
* 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.
*
* For any questions about this software or licensing,
* please email opensource@seagate.com or cortx-questions@seagate.com.
*
*/
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CONF
#include "lib/trace.h"
#include "conf/objs/common.h"
#include "conf/onwire_xc.h" /* m0_confx_process_xc */
#include "motr/magic.h" /* M0_CONF_PROCESS_MAGIC */
#define XCAST(xobj) ((struct m0_confx_process *)(&(xobj)->xo_u))
M0_BASSERT(offsetof(struct m0_confx_process, xr_header) == 0);
static bool process_check(const void *bob)
{
const struct m0_conf_process *self = bob;
const struct m0_conf_obj *self_obj = &self->pc_obj;
M0_PRE(m0_conf_obj_type(self_obj) == &M0_CONF_PROCESS_TYPE);
return m0_conf_obj_is_stub(self_obj) || _0C(self->pc_endpoint != NULL);
}
M0_CONF__BOB_DEFINE(m0_conf_process, M0_CONF_PROCESS_MAGIC, process_check);
M0_CONF__INVARIANT_DEFINE(process_invariant, m0_conf_process);
static size_t _bitmap_width(const struct m0_bitmap_onwire *bow)
{
return bow->bo_size * CHAR_BIT * sizeof bow->bo_words[0];
}
static int
process_decode(struct m0_conf_obj *dest, const struct m0_confx_obj *src)
{
int rc;
struct m0_conf_process *d = M0_CONF_CAST(dest, m0_conf_process);
const struct m0_confx_process *s = XCAST(src);
rc = m0_bitmap_init(&d->pc_cores, _bitmap_width(&s->xr_cores));
if (rc != 0)
return M0_ERR(rc);
m0_bitmap_load(&s->xr_cores, &d->pc_cores);
d->pc_memlimit_as = s->xr_mem_limit_as;
d->pc_memlimit_rss = s->xr_mem_limit_rss;
d->pc_memlimit_stack = s->xr_mem_limit_stack;
d->pc_memlimit_memlock = s->xr_mem_limit_memlock;
d->pc_endpoint = m0_buf_strdup(&s->xr_endpoint);
if (d->pc_endpoint == NULL) {
m0_bitmap_fini(&d->pc_cores);
return M0_ERR(-ENOMEM);
}
return M0_RC(m0_conf_dir_new(dest, &M0_CONF_PROCESS_SERVICES_FID,
&M0_CONF_SERVICE_TYPE, &s->xr_services,
&d->pc_services));
}
static int
process_encode(struct m0_confx_obj *dest, const struct m0_conf_obj *src)
{
int rc;
struct m0_conf_process *s = M0_CONF_CAST(src, m0_conf_process);
struct m0_confx_process *d = XCAST(dest);
confx_encode(dest, src);
rc = m0_bitmap_onwire_init(&d->xr_cores, s->pc_cores.b_nr);
if (rc != 0)
return M0_ERR(rc);
if (s->pc_cores.b_words != NULL)
m0_bitmap_store(&s->pc_cores, &d->xr_cores);
d->xr_mem_limit_as = s->pc_memlimit_as;
d->xr_mem_limit_rss = s->pc_memlimit_rss;
d->xr_mem_limit_stack = s->pc_memlimit_stack;
d->xr_mem_limit_memlock = s->pc_memlimit_memlock;
return M0_RC((s->pc_endpoint == NULL ? 0 :
m0_buf_copy(&d->xr_endpoint,
&M0_BUF_INITS((char *)s->pc_endpoint))) ?:
arrfid_from_dir(&d->xr_services, s->pc_services));
}
static bool
process_match(const struct m0_conf_obj *cached, const struct m0_confx_obj *flat)
{
const struct m0_confx_process *xobj = XCAST(flat);
const struct m0_conf_process *obj =
M0_CONF_CAST(cached, m0_conf_process);
return obj->pc_memlimit_as == xobj->xr_mem_limit_as &&
obj->pc_memlimit_rss == xobj->xr_mem_limit_rss &&
obj->pc_memlimit_stack == xobj->xr_mem_limit_stack &&
obj->pc_memlimit_memlock == xobj->xr_mem_limit_memlock &&
m0_buf_streq(&xobj->xr_endpoint, obj->pc_endpoint) &&
m0_conf_dir_elems_match(obj->pc_services, &xobj->xr_services);
}
static int process_lookup(const struct m0_conf_obj *parent,
const struct m0_fid *name, struct m0_conf_obj **out)
{
struct m0_conf_process *proc = M0_CONF_CAST(parent, m0_conf_process);
const struct conf_dir_relation dirs[] = {
{ proc->pc_services, &M0_CONF_PROCESS_SERVICES_FID }
};
M0_PRE(parent->co_status == M0_CS_READY);
return M0_RC(conf_dirs_lookup(out, name, dirs, ARRAY_SIZE(dirs)));
}
static const struct m0_fid **process_downlinks(const struct m0_conf_obj *obj)
{
static const struct m0_fid *rels[] = { &M0_CONF_PROCESS_SERVICES_FID,
NULL };
M0_PRE(m0_conf_obj_type(obj) == &M0_CONF_PROCESS_TYPE);
return rels;
}
static void process_delete(struct m0_conf_obj *obj)
{
struct m0_conf_process *x = M0_CONF_CAST(obj, m0_conf_process);
m0_free((void *)x->pc_endpoint);
m0_conf_process_bob_fini(x);
if (x->pc_cores.b_nr != 0)
m0_bitmap_fini(&x->pc_cores);
m0_free(x);
}
static const struct m0_conf_obj_ops process_ops = {
.coo_invariant = process_invariant,
.coo_decode = process_decode,
.coo_encode = process_encode,
.coo_match = process_match,
.coo_lookup = process_lookup,
.coo_readdir = NULL,
.coo_downlinks = process_downlinks,
.coo_delete = process_delete
};
M0_CONF__CTOR_DEFINE(process_create, m0_conf_process, &process_ops);
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE = {
.cot_ftype = {
.ft_id = M0_CONF__PROCESS_FT_ID,
.ft_name = "conf_process",
},
.cot_create = &process_create,
.cot_xt = &m0_confx_process_xc,
.cot_branch = "u_process",
.cot_xc_init = &m0_xc_m0_confx_process_struct_init,
.cot_magic = M0_CONF_PROCESS_MAGIC
};
#undef XCAST
#undef M0_TRACE_SUBSYSTEM
/*
* Local variables:
* c-indentation-style: "K&R"
* c-basic-offset: 8
* tab-width: 8
* fill-column: 80
* scroll-step: 1
* End:
*/
/*
* vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
*/
| 31.026596 | 80 | 0.727927 |
578fed29521e418b0e9aeac2a7f1d03fc7a5ea3f | 45,493 | c | C | utest/a2w.c | PiRSquared17/warc-tools | f200a5ed086159a1b1833f7361b35389b1ad1ef4 | [
"Apache-2.0"
] | null | null | null | utest/a2w.c | PiRSquared17/warc-tools | f200a5ed086159a1b1833f7361b35389b1ad1ef4 | [
"Apache-2.0"
] | null | null | null | utest/a2w.c | PiRSquared17/warc-tools | f200a5ed086159a1b1833f7361b35389b1ad1ef4 | [
"Apache-2.0"
] | null | null | null |
/* ------------------------------------------------------------------- */
/* Copyright (c) 2007-2008 Hanzo Archives Limited. */
/* */
/* 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. */
/* */
/* You may find more information about Hanzo Archives at */
/* */
/* http://www.hanzoarchives.com/ */
/* */
/* You may find more information about the WARC Tools project at */
/* */
/* http://code.google.com/p/warc-tools/ */
/* ------------------------------------------------------------------- */
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <Basic.h>
#include <Console.h>
#include <Automated.h>
#include <CUnit.h>
#include <CUError.h>
#include <TestDB.h>
#include <TestRun.h>
#include <warc.h>
#include <menu.h>
#include <afile.h>
#include <arecord.h>
#include <wversion.h>
#define WARC_MAX_SIZE 629145600LLU
#define makeS(s) ((warc_u8_t *) s), w_strlen((warc_u8_t *) (s))
int init_suite1(void) { return 0; }
int clean_suite1(void) { return 0; }
int init_suite2(void) { return 0; }
int clean_suite2(void) { return 0; }
int init_suite3(void) { return 0; }
int clean_suite3(void) { return 0; }
int init_suite4(void) { return 0; }
int clean_suite4(void) { return 0; }
void test1 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/file.arc", ARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "file.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_FAIL ("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
else CU_PASS (" retrieve the ArcRecord object");
wr = bless (WRecord);
unless (wr)
{
CU_FAIL( "unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
else CU_PASS (" retrieve the ArcRecord object");
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL (
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS (" retrieve the ArcRecord object");
if (WFile_storeRecord (w, wr) )
{ CU_FAIL( "failed to write the WRecord");}
else CU_PASS (" retrieve the ArcRecord object");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test2 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "file.warc", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
/*
fprintf (stdout, "WarcId: %-20s\n", WRecord_getWarcId (r) );
fprintf (stdout, "Content Length: %-20d\n", WRecord_getContentLength (r) );
fprintf (stdout, "RecordType: %-20d\n", WRecord_getRecordType (r) );
fprintf (stdout, "TargetUri: %-20s\n", WRecord_getTargetUri (r) );
fprintf (stdout, "CreationDate: %-20s\n", WRecord_getDate (r) );
fprintf (stdout, "ContentType: %-20s\n", WRecord_getContentType (r) );
fprintf (stdout, "Ip Address: %-20s\n", WRecord_getIpAddress (r));
fprintf (stdout, "RecordId: %-20s\n", WRecord_getRecordId (r) );*/
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==2)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==3)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test3 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/mrec.arc", ARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "mrec.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
assert(a);
assert(w);
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_FAIL("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
/*else CU_PASS("retrieve the ArcRecord object");*/
wr = bless (WRecord);
unless (wr)
{
CU_FAIL("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
/*else CU_FAIL("create the WRecord object");*/
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL(
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS(" pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{CU_FAIL("failed to write the WRecord");}
else CU_PASS("write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test4 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "mrec.warc", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==2)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==3)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==4)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==5)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
if(i==6)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test5 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/test1.arc", ARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "test1.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS ("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
/* else CU_FAIL ("retrieve the ArcRecord object");*/
wr = bless (WRecord);
unless (wr)
{
CU_PASS ("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
/*else CU_FAIL ("create the WRecord object");*/
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL(
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS( "pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_FAIL("failed to write the WRecord");}
else CU_PASS("write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test6 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "test1.warc", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
/* fprintf (stdout, "===========================================================================\n");*/
/*print WHDLine object for this WRecord */
/* fprintf (stdout, "WarcId: %-20s\n", WRecord_getWarcId (r) );
fprintf (stdout, "ContentLength: %-20d\n", WRecord_getContentLength (r) );
fprintf (stdout, "RecordType: %-20d\n", WRecord_getRecordType (r) );
fprintf (stdout, "TargetUri: %-20s\n", WRecord_getTargetUri (r) );
fprintf (stdout, "CreationDate: %-20s\n", WRecord_getDate (r) );
fprintf (stdout, "ContentType: %-20s\n", WRecord_getContentType (r) );
fprintf (stdout, "RecordId: %-20s\n", WRecord_getRecordId (r) );
fprintf (stdout, "Ip Address: %-20s\n", WRecord_getIpAddress (r));*/
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "12.68.40.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==2)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "25.35.75.11");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==3)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "11.18.68.48");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==4)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "12.68.40.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==5)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "25.35.75.11");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==6)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "11.18.68.48");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==7)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "12.68.40.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==8)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "25.35.75.11");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
if(i==9)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 1363);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2006-11-19T18:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "11.18.68.48");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "iledesc://BnF-elec2007-20061119183301-00236-atlas1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test7 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/err1.arc", WARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "err1.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
fprintf(stdout,"****************** Test 7:******************\n");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS ("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return;
}
wr = bless (WRecord);
unless (wr)
{
CU_PASS ( "unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL ("Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS ("pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_FAIL("failed to write the WRecord");}
else CU_PASS(" write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test8 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/err2.arc", ARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "err2.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
fprintf(stdout,"****************** Test 8:******************\n");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
else CU_FAIL(" retrieve the ArcRecord object");
wr = bless (WRecord);
unless (wr)
{
CU_PASS("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
else CU_FAIL("create the WRecord object");
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_PASS ("Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_FAIL (" pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_PASS("failed to write the WRecord");}
else CU_FAIL(" write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test9 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/test2.arc", ARC_FILE_UNCOMPRESSED, ".");
void * w = bless (WFile, "test2.warc",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert (a);
assert (w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
wr = bless (WRecord);
unless (wr)
{
CU_PASS("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL (
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS (
" pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_FAIL ("failed to write the WRecord");}
else CU_PASS("write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test10 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
w = bless (WFile, "test2.warc", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_UNCOMPRESSED, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
destroy (r);
}
CU_PASS ("success");
destroy (w);
}
void test11 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/file.arc.gz", ARC_FILE_COMPRESSED_GZIP, ".");
void * w = bless (WFile, "file.warc.gz",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_COMPRESSED_GZIP, ".");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS ("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
wr = bless (WRecord);
unless (wr)
{
CU_PASS("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL (
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS (
" pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{
CU_PASS ( "failed to write the WRecord");
destroy (a);
destroy (ar);
destroy (w);
destroy (wr);
return ;
}
else CU_PASS ( " write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test12 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "file.warc.gz", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_COMPRESSED_GZIP, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
/* fprintf (stdout, "============================================================================\n");*/
/*print WHDLine object for this WRecord */
/*fprintf (stdout, "WarcId: %-20s\n", WRecord_getWarcId (r) );
fprintf (stdout, "Content Length: %-20d\n", WRecord_getContentLength (r) );
fprintf (stdout, "RecordType: %-20d\n", WRecord_getRecordType (r) );
fprintf (stdout, "TargetUri: %-20s\n", WRecord_getTargetUri (r) );
fprintf (stdout, "CreationDate: %-20s\n", WRecord_getDate (r) );
fprintf (stdout, "ContentType: %-20s\n", WRecord_getContentType (r) );
fprintf (stdout, "Ip Address: %-20s\n", WRecord_getIpAddress (r));
fprintf (stdout, "RecordId: %-20s\n", WRecord_getRecordId (r) );*/
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test13 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/sfile.arc.gz", ARC_FILE_COMPRESSED_GZIP, ".");
void * w = bless (WFile, "sfile.warc.gz",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_COMPRESSED_GZIP, ".");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
/*else CU_FAIL(" retrieve the ArcRecord object");*/
wr = bless (WRecord);
unless (wr)
{
CU_PASS ("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
/*else CU_FAIL ("create the WRecord object");*/
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL( "Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS("pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{CU_FAIL("failed to write the WRecord");}
CU_PASS("write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test14 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "sfile.warc.gz", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_COMPRESSED_GZIP, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
/* fprintf (stdout, "============================================================================\n");*/
/*print WHDLine object for this WRecord */
/* fprintf (stdout, "WarcId: %-20s\n", WRecord_getWarcId (r) );
fprintf (stdout, "Content Length: %-20d\n", WRecord_getContentLength (r) );
fprintf (stdout, "RecordType: %-20d\n", WRecord_getRecordType (r) );
fprintf (stdout, "TargetUri: %-20s\n", WRecord_getTargetUri (r) );
fprintf (stdout, "CreationDate: %-20s\n", WRecord_getDate (r) );
fprintf (stdout, "ContentType: %-20s\n", WRecord_getContentType (r) );
fprintf (stdout, "Ip Address: %-20s\n", WRecord_getIpAddress (r));
fprintf (stdout, "RecordId: %-20s\n", WRecord_getRecordId (r) );*/
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test15 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/mfile.arc.gz", ARC_FILE_COMPRESSED_GZIP, ".");
void * w = bless (WFile, "mfile.warc.gz",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_COMPRESSED_GZIP, ".");
fprintf(stdout,"****************** Test 15:******************\n");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS ("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
/*else
CU_PASS(" retrieve the ArcRecord object");*/
wr = bless (WRecord);
unless (wr)
{
CU_PASS("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
/*else CU_FAIL("create the WRecord object");*/
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_FAIL("Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_PASS("pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_FAIL("failed to write the WRecord");}
else CU_PASS(" write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
void test16 (void)
{
void * w = NIL; /* warc file object */
void * r = NIL; /* to recover records */
warc_u32_t i = 1;
w = bless (WFile, "mfile.warc.gz", WARC_MAX_SIZE, WARC_FILE_READER, WARC_FILE_COMPRESSED_GZIP, ".");
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(w);
while (WFile_hasMoreRecords (w) )
{
unless ( (r = WFile_nextRecord (w) ) )
{
destroy (w);
return ;
}
/* fprintf (stdout, "============================================================================\n");*/
/*print WHDLine object for this WRecord */
/* fprintf (stdout, "WarcId: %-20s\n", WRecord_getWarcId (r) );
fprintf (stdout, "Content Length: %-20d\n", WRecord_getContentLength (r) );
fprintf (stdout, "RecordType: %-20d\n", WRecord_getRecordType (r) );
fprintf (stdout, "TargetUri: %-20s\n", WRecord_getTargetUri (r) );
fprintf (stdout, "CreationDate: %-20s\n", WRecord_getDate (r) );
fprintf (stdout, "ContentType: %-20s\n", WRecord_getContentType (r) );
fprintf (stdout, "Ip Address: %-20s\n", WRecord_getIpAddress (r));
fprintf (stdout, "RecordId: %-20s\n", WRecord_getRecordId (r) );*/
if(i==1)
{
CU_ASSERT_STRING_EQUAL(WRecord_getWarcId (r), WARC_VERSION);
CU_ASSERT( WRecord_getContentLength (r) == 22566);
CU_ASSERT(WRecord_getRecordType (r)==8);
CU_ASSERT_STRING_EQUAL(WRecord_getTargetUri (r) , "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
CU_ASSERT_STRING_EQUAL(WRecord_getDate (r) , "2007-05-24T11:33:01Z");
CU_ASSERT_STRING_EQUAL(WRecord_getContentType (r) , "text/plain");
CU_ASSERT_STRING_EQUAL( WRecord_getIpAddress (r), "0.0.0.0");
CU_ASSERT_STRING_EQUAL(WRecord_getRecordId (r), "filedesc://BnF-elec2007-20070524113301-00040-heritrix1.arc");
}
i++;
destroy (r);
}
destroy (w);
}
void test17 (void)
{
void * a = bless (AFile, "./app/wdata/arc2warc/mmfile.arc.gz", ARC_FILE_COMPRESSED_GZIP, ".");
void * w = bless (WFile, "mmfile.warc.gz",
WARC_MAX_SIZE, WARC_FILE_WRITER, WARC_FILE_COMPRESSED_GZIP, ".");
fprintf(stdout,"****************** Test 17:******************\n");
CU_ASSERT_PTR_NOT_EQUAL(a,NIL);
CU_ASSERT_PTR_NOT_EQUAL(w,NIL);
assert(a);
assert(w);
while (AFile_hasMoreRecords (a) )
{
void * ar = AFile_nextRecord (a);
void * wr = NIL;
unless (ar)
{
CU_PASS("unable to retrieve the ArcRecord object");
destroy (w);
destroy (a);
return ;
}
/*else CU_FAIL("retrieve the ArcRecord object");*/
wr = bless (WRecord);
unless (wr)
{
CU_PASS("unable to create the WRecord object");
destroy (w);
destroy (a);
destroy (ar);
return ;
}
/*else CU_FAIL(" create the WRecord object");*/
WRecord_setTargetUri (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setRecordType (wr, WARC_RESOURCE_RECORD);
WRecord_setDateFromArc (wr, makeS (ARecord_getCreationDate (ar) ) );
WRecord_setContentType (wr, makeS (ARecord_getMimeType (ar) ) );
WRecord_setRecordId (wr, makeS (ARecord_getUrl (ar) ) );
WRecord_setIpAddress (wr, makeS (ARecord_getIpAddress (ar) ) );
if (ARecord_transferContent (ar, wr, a) )
{
CU_PASS (
"Unable to pass content to the Warc Record");
destroy (w);
destroy (a);
destroy (wr);
destroy (ar);
return ;
}
else CU_FAIL (" pass content to the Warc Record");
if (WFile_storeRecord (w, wr) )
{ CU_PASS ("failed to write the WRecord");}
else CU_FAIL(" write the WRecord");
destroy (wr);
destroy (ar);
} /* end of while */
destroy (w);
destroy (a);
}
int main (void)
{
CU_pSuite pSuite = NULL;
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
/* add a suite to the registry */
pSuite = CU_add_suite("Suite1", init_suite1, clean_suite1);
if (NULL == pSuite) {
CU_cleanup_registry();
return CU_get_error();
}
/* add the tests to the suite */
if ((NULL == CU_add_test(pSuite, " 1: converting an uncompressed Arc which contain a single record File to the Warc format", test1)) ||
(NULL == CU_add_test(pSuite, " 2: reading an automatically created warc file from arc file", test2))||
(NULL == CU_add_test(pSuite, " 3: converting a uncomprssed Arc File Which contains several records to the Warc format", test3))||
(NULL == CU_add_test(pSuite, " 4: reading an automatically created warc file from arc file", test4)))
{
CU_cleanup_registry();
return CU_get_error();
}
/* add a suite to the registry */
pSuite = CU_add_suite("Suite2", init_suite2, clean_suite2);
if (NULL == pSuite) {
CU_cleanup_registry();
return CU_get_error();
}
/* add the tests to the suite */
if ((NULL == CU_add_test(pSuite, " 5: converting an Arc File Which contains several records to the Warc format", test5)) ||
(NULL == CU_add_test(pSuite, " 6: reading a warc file created automatically from a arc file ", test6))||
(NULL == CU_add_test(pSuite, " 7: converting a corrupted Arc File in the second record to the Warc format", test7))||
(NULL == CU_add_test(pSuite, " 8: converting a corrupted Arc File in the first to the Warc format", test8)))
{
CU_cleanup_registry();
return CU_get_error();
}
/* add a suite to the registry */
pSuite = CU_add_suite("Suite3", init_suite3, clean_suite3);
if (NULL == pSuite) {
CU_cleanup_registry();
return CU_get_error();
}
/* add the tests to the suite */
if ((NULL == CU_add_test(pSuite, " 9: converting a Arc File wich contains several records to the Warc format", test9)) ||
(NULL == CU_add_test(pSuite, " 10: reading an automatically created warc file from arc file", test10))||
(NULL == CU_add_test(pSuite, " 11: converting a compressed Arc File wich contains a single record to the Warc format", test11))||
(NULL == CU_add_test(pSuite, " 12: reading an automatically created warc file from arc file", test12)))
{
CU_cleanup_registry();
return CU_get_error();
}
/* add a suite to the registry */
pSuite = CU_add_suite("Suite4", init_suite4, clean_suite4);
if (NULL == pSuite) {
CU_cleanup_registry();
return CU_get_error();
}
/* add the tests to the suite */
if ((NULL == CU_add_test(pSuite, " 13: converting a compressed Arc File wich contains several record to the Warc format ", test13)) ||
(NULL == CU_add_test(pSuite, " 14: reading an automatically created warc file from arc file", test14))||
(NULL == CU_add_test(pSuite, " 15: converting a corrupted Arc File at the second record to the Warc format", test15))||
(NULL == CU_add_test(pSuite, " 16: reading an automatically created warc file from arc file", test16))||
(NULL == CU_add_test(pSuite, " 17: converting a corrupted Arc File in the first record to the Warc format", test17)))
{
CU_cleanup_registry();
return CU_get_error();
}
switch (menu())
{
case 1: {CU_console_run_tests();break;}
case 2: {
case 21: {CU_basic_set_mode(CU_BRM_NORMAL); CU_basic_run_tests(); break;}
case 22:{CU_basic_set_mode(CU_BRM_VERBOSE ); CU_basic_run_tests(); break;}
case 23:{CU_basic_set_mode(CU_BRM_SILENT); CU_basic_run_tests(); break;}
}
case 3:{
CU_set_output_filename("./utest/outputs/a2w");
CU_set_output_filename("./utest/outputs/a2w" );
CU_automated_run_tests();
CU_list_tests_to_file();
break;
}
}
CU_cleanup_registry();
return CU_get_error();
}
| 31.6363 | 139 | 0.613633 |
3be52aae0f436adf4e8bb9fa70e59c74046666ed | 4,672 | h | C | include/sageBridge.h | benyaboy/sage-graphics | 090640167329ace4b6ad266d47db5bb2b0394232 | [
"Unlicense"
] | null | null | null | include/sageBridge.h | benyaboy/sage-graphics | 090640167329ace4b6ad266d47db5bb2b0394232 | [
"Unlicense"
] | null | null | null | include/sageBridge.h | benyaboy/sage-graphics | 090640167329ace4b6ad266d47db5bb2b0394232 | [
"Unlicense"
] | 1 | 2021-07-02T10:31:03.000Z | 2021-07-02T10:31:03.000Z | /******************************************************************************
* SAGE - Scalable Adaptive Graphics Environment
*
* Module: sageBridge.h
* Author : Byungil Jeong
*
* Copyright (C) 2004 Electronic Visualization Laboratory,
* University of Illinois at Chicago
*
* 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 the name of the University of Illinois at Chicago 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.
*
* Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or
* http://www.evl.uic.edu/cavern/forum/
*
*****************************************************************************/
#ifndef SAGEBRIDGE_H_
#define SAGEBRIDGE_H_
#include "sage.h"
#define MAX_BRIDGE_NODE 100
class messageInterface;
class sageBridge;
class streamProtocol;
class bridgeSharedData;
class sageTcpModule;
class sageUdpModule;
class sageNwConfig;
class appInstance;
class sageSyncServer;
class syncGroup;
class sageEvent;
class sageAudioBridge;
typedef struct {
sageBridge *This;
streamProtocol *nwObj;
} nwCheckThreadParam;
class sageBridge {
protected:
bridgeSharedData *shared;
sageTcpModule *tcpObj;
sageUdpModule *udpObj;
sageNwConfig *nwCfg;
sageAudioBridge *audioBridge;
bool master;
char masterIP[SAGE_IP_LEN];
int streamPort, msgPort, syncPort, audioPort;
int slaveNum;
int memSize;
int allocPolicy;
char slaveIPs[MAX_BRIDGE_NODE][SAGE_IP_LEN];
int slaveList[MAX_BRIDGE_NODE];
messageInterface *msgInf;
std::vector<appInstance*> appInstList;
int instNum;
sageSyncServer *syncServerObj;
//sageSyncClient *syncClientObj;
bool bridgeEnd;
int syncGroupID;
int initMaster(const char *cFile);
int initSlave(char *data);
int launchSlaves();
int regApp(sageMessage &msg, int clientID);
int shareApp(char *msgData, int clientID);
int connectApp(appInstance *inst);
int sendStreamInfo(appInstance *inst);
appInstance* findApp(int id, int& index);
int connectToFSManager(appInstance *inst);
int connectToFSManager(appInstance *inst, char *ip, int port);
syncGroup* addSyncGroup();
appInstance* clientIDtoAppInstance(int clientID, int &orgIdx);
appInstance* forwardToAppinstance(sageMessage &msg, int clientID);
appInstance* findAppInstance(int instID);
appInstance* delieverMessage(sageMessage &msg, int clientID);
int parseMessage(sageMessage &msg, int clientID);
int parseEvent(sageEvent *event);
int findMinLoadNode();
int startPerformanceReport(sageMessage &msg);
int stopPerformanceReport(sageMessage &msg);
int perfReport();
int shutdownApp(int instID, bool fsmToApp);
int forwardToSail(int instID, sageMessage &msg);
int shutdownAllApps();
int initNetworks();
int checkNetworks();
int initStreams(char *msg, streamProtocol *nwObj);
static void* msgCheckThread(void *args);
static void* perfReportThread(void *args);
static void* nwCheckThread(void *args);
public:
sageBridge(int argc, char **argv);
~sageBridge();
void mainLoop();
friend class appInstance;
};
#endif
| 33.371429 | 85 | 0.698416 |
5f5cb41a05853b987bad50e12ac9e47d7df9b433 | 22,125 | c | C | src/stt/stt_named_functions_simple_list_tests.c | katesalazar/bat | 3c84a3c2263f3d40147411843c066b9313b967b4 | [
"Apache-2.0"
] | 1 | 2019-06-04T22:39:37.000Z | 2019-06-04T22:39:37.000Z | src/stt/stt_named_functions_simple_list_tests.c | katesalazar/bat | 3c84a3c2263f3d40147411843c066b9313b967b4 | [
"Apache-2.0"
] | null | null | null | src/stt/stt_named_functions_simple_list_tests.c | katesalazar/bat | 3c84a3c2263f3d40147411843c066b9313b967b4 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2018-2020 Mercedes Catherine Salazar
*
* 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.
*
* src/stt/stt_named_functions_simple_list_tests.c: Test the Amara
* syntax tree application named functions simple list.
*/
/* For `void assertion(int expression)`. */
#include "../asr/assertion.h"
#include "stt_named_function_tests.h"
#include "stt_node.h"
stt_named_functions_simple_list *
stt_named_functions_simple_list_example_two_named_functions()
{
stt_named_function * function_;
stt_named_functions_simple_list * ret_;
function_ = stt_named_function_example_print_string_literal_bar();
forced_assertion(function_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
function_);
#endif
ret_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(ret_ != NULL);
#ifndef NDEBUG
assertion(ret_->first == NULL);
assertion(ret_->next == NULL);
#endif
ret_ = stt_named_functions_simple_list_push_front(ret_, function_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
function_);
#endif
forced_assertion(ret_ != NULL);
forced_assertion(ret_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
ret_->first);
assertion(ret_->next == NULL);
#endif
stt_named_function_destructor(function_);
function_ = stt_named_function_example_print_string_literal_foo();
forced_assertion(function_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
function_);
#endif
ret_ = stt_named_functions_simple_list_push_front(ret_, function_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
function_);
#endif
forced_assertion(ret_ != NULL);
forced_assertion(ret_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
ret_->first);
#endif
forced_assertion(ret_->next != NULL);
forced_assertion(ret_->next->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
ret_->next->first);
assertion(ret_->next->next == NULL);
#endif
stt_named_function_destructor(function_);
return ret_;
}
#ifndef NDEBUG
void
assert_expectations_on_stt_named_functions_simple_list_example_two_named_functions(
const stt_named_functions_simple_list * list)
{
assertion(list != NULL);
assertion(list->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list->first);
assertion(list->next != NULL);
assertion(list->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list->next->first);
assertion(list->next->next == NULL);
}
#endif
stt_named_functions_simple_list *
stt_named_functions_simple_list_example_one_invalid_named_function(void)
{
stt_named_function * invalid_named_function_;
stt_named_functions_simple_list * ret_;
ret_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(ret_ != NULL);
#ifndef NDEBUG
assertion(ret_->first == NULL);
assertion(ret_->next == NULL);
#endif
invalid_named_function_ = stt_named_function_ill_formed_example_print_identifier_foo();
forced_assertion(invalid_named_function_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_ill_formed_example_print_identifier_foo(
invalid_named_function_);
#endif
ret_ = stt_named_functions_simple_list_push_front(
ret_, invalid_named_function_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_ill_formed_example_print_identifier_foo(
invalid_named_function_);
#endif
forced_assertion(ret_ != NULL);
forced_assertion(ret_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_ill_formed_example_print_identifier_foo(
ret_->first);
assertion(ret_->next == NULL);
#endif
stt_named_function_destructor(invalid_named_function_);
return ret_;
}
#ifndef NDEBUG
void
assert_expectations_on_stt_named_functions_simple_list_example_one_invalid_named_function(
const stt_named_functions_simple_list * list)
{
assertion(list != NULL);
assertion(list->first != NULL);
assert_expectations_on_stt_named_function_ill_formed_example_print_identifier_foo(
list->first);
assertion(list->next == NULL);
}
#endif
stt_named_functions_simple_list *
stt_named_functions_simple_list_example_one_valid_named_function_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(void)
{
stt_named_function * named_function_;
stt_named_functions_simple_list * ret_;
ret_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(ret_ != NULL);
#ifndef NDEBUG
assertion(ret_->first == NULL);
assertion(ret_->next == NULL);
#endif
named_function_ = stt_named_function_example_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo();
forced_assertion(named_function_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(
named_function_);
#endif
ret_ = stt_named_functions_simple_list_push_front(
ret_, named_function_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(
named_function_);
#endif
forced_assertion(ret_ != NULL);
forced_assertion(ret_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(
ret_->first);
assertion(ret_->next == NULL);
#endif
stt_named_function_destructor(named_function_);
return ret_;
}
#ifndef NDEBUG
void
assert_expectations_on_stt_named_functions_simple_list_example_one_valid_named_function_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(
const stt_named_functions_simple_list * list)
{
assertion(list != NULL);
assertion(list->first != NULL);
assert_expectations_on_stt_named_function_example_print_identifier_foo_where_identifier_foo_is_bound_to_string_literal_foo(
list->first);
assertion(list->next == NULL);
}
#endif
void
stt_named_functions_simple_list_default_constructor_test()
{
stt_named_functions_simple_list * list_;
list_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(list_ != NULL);
forced_assertion(list_->first == NULL);
forced_assertion(list_->next == NULL);
stt_named_functions_simple_list_destructor(list_);
}
void
stt_named_functions_simple_list_default_constructor_tests()
{
stt_named_functions_simple_list_default_constructor_test();
}
tests_simple_list *
register_stt_named_functions_simple_list_default_constructor_tests(
tests_simple_list * tests)
__amara__warn_unused_result__
;
tests_simple_list *
register_stt_named_functions_simple_list_default_constructor_tests(
tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = tests;
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_default_constructor_test);
return returning_;
}
void
stt_named_functions_simple_list_copy_constructor_test_0()
{
stt_named_functions_simple_list * list_zero_;
stt_named_functions_simple_list * list_one_;
list_zero_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(list_zero_ != NULL);
assertion(list_zero_->first == NULL);
assertion(list_zero_->next == NULL);
list_one_ = stt_named_functions_simple_list_copy_constructor(
list_zero_);
assertion(list_zero_->first == NULL);
assertion(list_zero_->next == NULL);
forced_assertion(list_one_ != NULL);
assertion(list_one_->first == NULL);
assertion(list_one_->next == NULL);
stt_named_functions_simple_list_destructor(list_zero_);
stt_named_functions_simple_list_destructor(list_one_);
}
void
stt_named_functions_simple_list_copy_constructor_test_1()
{
stt_named_functions_simple_list * list_zero_;
stt_named_functions_simple_list * list_one_;
stt_named_function * named_function_;
list_zero_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(list_zero_ != NULL);
assertion(list_zero_->first == NULL);
assertion(list_zero_->next == NULL);
named_function_ = stt_named_function_example_print_string_literal_foo();
forced_assertion(named_function_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_);
#endif
list_zero_ = stt_named_functions_simple_list_push_front(
list_zero_, named_function_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_);
#endif
forced_assertion(list_zero_ != NULL);
forced_assertion(list_zero_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_zero_->first);
assertion(list_zero_->next == NULL);
#endif
list_one_ = stt_named_functions_simple_list_copy_constructor(
list_zero_);
#ifndef NDEBUG
assertion(list_zero_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_zero_->first);
assertion(list_zero_->next == NULL);
#endif
forced_assertion(list_one_ != NULL);
forced_assertion(list_one_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_one_->first);
assertion(list_one_->next == NULL);
#endif
stt_named_functions_simple_list_destructor(list_one_);
stt_named_function_destructor(named_function_);
stt_named_functions_simple_list_destructor(list_zero_);
}
void
stt_named_functions_simple_list_copy_constructor_test_2()
{
stt_named_functions_simple_list * list_zero_;
stt_named_functions_simple_list * list_one_;
stt_named_function * named_function_zero_;
stt_named_function * named_function_one_;
list_zero_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(list_zero_ != NULL);
assertion(list_zero_->first == NULL);
assertion(list_zero_->next == NULL);
named_function_zero_ = stt_named_function_example_print_string_literal_bar();
forced_assertion(named_function_zero_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
#endif
named_function_one_ = stt_named_function_example_print_string_literal_foo();
forced_assertion(named_function_one_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_one_);
#endif
list_zero_ = stt_named_functions_simple_list_push_front(
list_zero_, named_function_zero_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
#endif
forced_assertion(list_zero_ != NULL);
forced_assertion(list_zero_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_zero_->first);
assertion(list_zero_->next == NULL);
#endif
list_zero_ = stt_named_functions_simple_list_push_front(
list_zero_, named_function_one_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_one_);
assertion(list_zero_ != NULL);
assertion(list_zero_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_zero_->first);
assertion(list_zero_->next != NULL);
assertion(list_zero_->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_zero_->next->first);
assertion(list_zero_->next->next == NULL);
#endif
list_one_ = stt_named_functions_simple_list_copy_constructor(
list_zero_);
#ifndef NDEBUG
assertion(list_zero_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_zero_->first);
assertion(list_zero_->next != NULL);
assertion(list_zero_->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_zero_->next->first);
assertion(list_zero_->next->next == NULL);
#endif
forced_assertion(list_one_ != NULL);
#ifndef NDEBUG
assertion(list_one_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_one_->first);
assertion(list_one_->next != NULL);
assertion(list_one_->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_one_->next->first);
assertion(list_one_->next->next == NULL);
#endif
stt_named_functions_simple_list_destructor(list_one_);
stt_named_function_destructor(named_function_one_);
stt_named_function_destructor(named_function_zero_);
stt_named_functions_simple_list_destructor(list_zero_);
}
void
stt_named_functions_simple_list_copy_constructor_tests()
{
stt_named_functions_simple_list_copy_constructor_test_0();
stt_named_functions_simple_list_copy_constructor_test_1();
stt_named_functions_simple_list_copy_constructor_test_2();
}
tests_simple_list *
register_stt_named_functions_simple_list_copy_constructors_tests(
tests_simple_list * tests)
__amara__warn_unused_result__
;
tests_simple_list *
register_stt_named_functions_simple_list_copy_constructor_tests(
tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = tests;
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_copy_constructor_test_0);
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_copy_constructor_test_1);
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_copy_constructor_test_2);
return returning_;
}
void
stt_named_functions_simple_list_constructors_tests()
{
stt_named_functions_simple_list_default_constructor_tests();
stt_named_functions_simple_list_copy_constructor_tests();
}
tests_simple_list *
register_stt_named_functions_simple_list_constructors_tests(
tests_simple_list * tests)
__amara__warn_unused_result__
;
tests_simple_list *
register_stt_named_functions_simple_list_constructors_tests(
tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = register_stt_named_functions_simple_list_default_constructor_tests(
tests);
returning_ = register_stt_named_functions_simple_list_copy_constructor_tests(
returning_);
return returning_;
}
void
stt_named_functions_simple_list_length_test_0()
{
stt_named_functions_simple_list * list_;
unsigned char length_;
list_ = NULL;
length_ = stt_named_functions_simple_list_length(list_);
forced_assertion(length_ == 0);
}
void
stt_named_functions_simple_list_length_test_1()
{
stt_named_functions_simple_list * list_;
unsigned char length_;
list_ = stt_named_functions_simple_list_default_constructor();
assertion(list_ != NULL);
assertion(list_->first == NULL);
assertion(list_->next == NULL);
length_ = stt_named_functions_simple_list_length(list_);
assertion(list_ != NULL);
assertion(list_->first == NULL);
assertion(list_->next == NULL);
forced_assertion(length_ == 0);
stt_named_functions_simple_list_destructor(list_);
}
void
stt_named_functions_simple_list_length_test_2()
{
stt_named_functions_simple_list * list_;
stt_named_function * named_function_zero_;
unsigned char length_;
list_ = stt_named_functions_simple_list_default_constructor();
assertion(list_ != NULL);
assertion(list_->first == NULL);
assertion(list_->next == NULL);
named_function_zero_ = stt_named_function_example_print_string_literal_bar();
#ifndef NDEBUG
assertion(named_function_zero_ != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
#endif
list_ = stt_named_functions_simple_list_push_front(
list_, named_function_zero_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
assertion(list_ != NULL);
assertion(list_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_->first);
assertion(list_->next == NULL);
#endif
length_ = stt_named_functions_simple_list_length(list_);
#ifndef NDEBUG
assertion(list_ != NULL);
assertion(list_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_->first);
assertion(list_->next == NULL);
#endif
forced_assertion(length_ == 1);
stt_named_function_destructor(named_function_zero_);
stt_named_functions_simple_list_destructor(list_);
}
void
stt_named_functions_simple_list_length_test_3()
{
stt_named_functions_simple_list * list_;
stt_named_function * named_function_zero_;
stt_named_function * named_function_one_;
unsigned char length_;
list_ = stt_named_functions_simple_list_default_constructor();
forced_assertion(list_ != NULL);
#ifndef NDEBUG
assertion(list_->first == NULL);
assertion(list_->next == NULL);
#endif
named_function_zero_ = stt_named_function_example_print_string_literal_bar();
forced_assertion(named_function_zero_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
#endif
named_function_one_ = stt_named_function_example_print_string_literal_foo();
forced_assertion(named_function_one_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_one_);
#endif
list_ = stt_named_functions_simple_list_push_front(
list_, named_function_zero_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
named_function_zero_);
#endif
forced_assertion(list_ != NULL);
forced_assertion(list_->first != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_->first);
assertion(list_->next == NULL);
#endif
stt_named_function_destructor(named_function_zero_);
list_ = stt_named_functions_simple_list_push_front(
list_, named_function_one_);
#ifndef NDEBUG
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
named_function_one_);
#endif
forced_assertion(list_ != NULL);
#ifndef NDEBUG
assertion(list_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_->first);
assertion(list_->next != NULL);
assertion(list_->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_->next->first);
assertion(list_->next->next == NULL);
#endif
stt_named_function_destructor(named_function_one_);
length_ = stt_named_functions_simple_list_length(list_);
#ifndef NDEBUG
assertion(list_->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_foo(
list_->first);
assertion(list_->next != NULL);
assertion(list_->next->first != NULL);
assert_expectations_on_stt_named_function_example_print_string_literal_bar(
list_->next->first);
assertion(list_->next->next == NULL);
#endif
forced_assertion(length_ == 2);
stt_named_functions_simple_list_destructor(list_);
}
void
stt_named_functions_simple_list_length_tests()
{
stt_named_functions_simple_list_length_test_0();
stt_named_functions_simple_list_length_test_1();
stt_named_functions_simple_list_length_test_2();
stt_named_functions_simple_list_length_test_3();
}
tests_simple_list *
register_stt_named_functions_simple_list_length_tests(
tests_simple_list * tests)
__amara__warn_unused_result__
;
tests_simple_list *
register_stt_named_functions_simple_list_length_tests(
tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = tests;
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_length_test_0);
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_length_test_1);
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_length_test_2);
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_length_test_3);
return returning_;
}
void
stt_named_functions_simple_list_push_front_test_0()
{
stt_named_functions_simple_list * list_;
list_ = stt_named_functions_simple_list_example_two_named_functions();
forced_assertion(list_ != NULL);
#ifndef NDEBUG
assert_expectations_on_stt_named_functions_simple_list_example_two_named_functions(
list_);
#endif
stt_named_functions_simple_list_destructor(list_);
}
void
stt_named_functions_simple_list_push_front_tests()
{
stt_named_functions_simple_list_push_front_test_0();
}
tests_simple_list *
register_stt_named_functions_simple_list_push_front_tests(
tests_simple_list * tests)
__amara__warn_unused_result__
;
tests_simple_list *
register_stt_named_functions_simple_list_push_front_tests(
tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = tests;
tests_simple_list_push_back(
returning_,
& stt_named_functions_simple_list_push_front_test_0);
return returning_;
}
void
stt_named_functions_simple_list_tests()
{
stt_named_functions_simple_list_constructors_tests();
stt_named_functions_simple_list_length_tests();
stt_named_functions_simple_list_push_front_tests();
}
tests_simple_list *
register_stt_named_functions_simple_list_tests(tests_simple_list * tests)
{
tests_simple_list * returning_;
returning_ = register_stt_named_functions_simple_list_constructors_tests(
tests);
returning_ = register_stt_named_functions_simple_list_length_tests(
returning_);
returning_ = register_stt_named_functions_simple_list_push_front_tests(
returning_);
return returning_;
}
| 30.020353 | 161 | 0.833763 |
46a53ed161af0f14d2d1a432756ae9f6e19e036b | 1,783 | c | C | Data_Structures/Queue/circular_queue.c | arslantalib3/algo_ds_101 | a1293f407e00b8346f93e8770727f769e7add00e | [
"MIT"
] | 182 | 2020-10-01T17:16:42.000Z | 2021-10-04T17:52:49.000Z | Data_Structures/Queue/circular_queue.c | arslantalib3/algo_ds_101 | a1293f407e00b8346f93e8770727f769e7add00e | [
"MIT"
] | 759 | 2020-10-01T00:12:21.000Z | 2021-10-04T19:35:11.000Z | Data_Structures/Queue/circular_queue.c | arslantalib3/algo_ds_101 | a1293f407e00b8346f93e8770727f769e7add00e | [
"MIT"
] | 1,176 | 2020-10-01T16:02:13.000Z | 2021-10-04T19:20:19.000Z | #include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
struct queue
{
int info;
struct queue *next;
} *rear,*front,*temp;;
int size = 0;
void enqueue(int info);
void dequeue();
void display();
void main(){
int choice,x;
do{
printf("1-Insert\n2-Delete\n3-Display\n\nEnter a choice: ");
scanf("%d",&choice);
switch(choice){
case 1: printf("\nEnter the info to be inserted in the Queue : ");
scanf("%d",&x);
enqueue(x);
display();
break;
case 2: dequeue();
display();
break;
case 3: display();
break;
default:printf("Invalid choice, please try again.\n");
exit(0);
}
}while(choice!=4);
}
void enqueue(int x)
{
temp = (struct queue*) malloc(sizeof(struct queue));
temp -> info = x;
if(front == NULL)
front = temp;
else
{
rear -> next = temp;
rear = temp;
}
rear -> next = front;
size++;
}
void dequeue()
{
int x;
if (front == NULL)
{
printf("\nQueue is Empty");
}
else if (front == rear)
{
x = front->info;
free (front);
front = rear = NULL;
}
else
{
temp = front;
x = temp -> info;
front = front -> next;
rear -> next = front;
free (temp);
}
size--;
printf("\nThe deleted element is: %d",x);
}
void display()
{
if(front == NULL)
printf("\nQueue is Empty!!!\n");
temp = front;
while (temp->next!=NULL) {
printf("%d\n", temp->info);
temp = temp->next;
}
printf("%d\n", temp->info);
}
| 19.811111 | 78 | 0.456534 |
f19478a5524e35603b9bb1ac17ba3f17110e7bcb | 2,760 | h | C | source/lowlevel/brstaticrtti.h | Olde-Skuul/burgerlib | 80848a4dfa17c5c05095ecea14a9bd87f86dfb9d | [
"Zlib"
] | 115 | 2015-01-18T17:29:30.000Z | 2022-01-30T04:31:48.000Z | source/lowlevel/brstaticrtti.h | Olde-Skuul/burgerlib | 80848a4dfa17c5c05095ecea14a9bd87f86dfb9d | [
"Zlib"
] | 9 | 2015-01-22T04:53:38.000Z | 2015-01-31T13:52:40.000Z | source/lowlevel/brstaticrtti.h | Olde-Skuul/burgerlib | 80848a4dfa17c5c05095ecea14a9bd87f86dfb9d | [
"Zlib"
] | 9 | 2015-01-23T20:06:46.000Z | 2020-05-20T16:06:00.000Z | /***************************************
Run Time Type Information class
Copyright (c) 1995-2020 by Rebecca Ann Heineman <becky@burgerbecky.com>
It is released under an MIT Open Source license. Please see LICENSE for
license details. Yes, you can use it in a commercial title without paying
anything, just give me a credit.
Please? It's not like I'm asking you for money!
***************************************/
#ifndef __BRSTATICRTTI_H__
#define __BRSTATICRTTI_H__
#ifndef __BRTYPES_H__
#include "brtypes.h"
#endif
/* BEGIN */
namespace Burger {
struct StaticRTTI {
const char* m_pClassName; ///< Pointer to the name of the class
const StaticRTTI* m_pParent; ///< Pointer to the parent in a derived class
BURGER_INLINE const char* GetClassName(void) const BURGER_NOEXCEPT
{
return m_pClassName;
}
uint_t BURGER_API IsInList(const StaticRTTI* pInput) const BURGER_NOEXCEPT;
};
}
#define BURGER_RTTI_IN_CLASS() \
public: \
const Burger::StaticRTTI* GetStaticRTTI(void) \
const BURGER_NOEXCEPT BURGER_OVERRIDE; \
static const Burger::StaticRTTI g_StaticRTTI
#define BURGER_RTTI_IN_BASE_CLASS() \
public: \
BURGER_INLINE const char* GetClassName(void) const BURGER_NOEXCEPT \
{ \
return GetStaticRTTI()->GetClassName(); \
} \
virtual const Burger::StaticRTTI* GetStaticRTTI(void) \
const BURGER_NOEXCEPT; \
static const Burger::StaticRTTI g_StaticRTTI
#define BURGER_CREATE_STATICRTTI_BASE(__ClassName) \
const Burger::StaticRTTI* __ClassName::GetStaticRTTI(void) \
const BURGER_NOEXCEPT \
{ \
return &g_StaticRTTI; \
} \
const Burger::StaticRTTI __ClassName::g_StaticRTTI = {#__ClassName, nullptr}
#define BURGER_CREATE_STATICRTTI_PARENT(__ClassName, __ParentClass) \
const Burger::StaticRTTI* __ClassName ::GetStaticRTTI(void) \
const BURGER_NOEXCEPT \
{ \
return &g_StaticRTTI; \
} \
const Burger::StaticRTTI __ClassName::g_StaticRTTI = { \
#__ClassName, &__ParentClass::g_StaticRTTI}
#define BURGER_STATICRTTI_ISTYPE(__ClassName, __Pointer) \
(__Pointer)->GetStaticRTTI()->IsInList(&__ClassName::g_StaticRTTI)
#define BURGER_RTTICAST(__ClassName, __Pointer) \
((__Pointer) && \
((__Pointer)->GetStaticRTTI()->IsInList( \
&__ClassName::g_StaticRTTI)) ? \
static_cast<__ClassName*>(__Pointer) : \
nullptr)
#define BURGER_RTTICONSTCAST(__ClassName, __Pointer) \
((__Pointer) && \
((__Pointer)->GetStaticRTTI()->IsInList( \
&__ClassName::g_StaticRTTI)) ? \
static_cast<const __ClassName*>(__Pointer) : \
nullptr)
/* END */
#endif
| 31.363636 | 80 | 0.662681 |
0bd479225cab7ada95356d6f249a3035876090cd | 170 | h | C | src/file.h | ahoka/replay | 03eedd775dbf4b5638d34a2bf3d9e6cbe61f1ab3 | [
"0BSD"
] | 1 | 2016-05-09T04:08:20.000Z | 2016-05-09T04:08:20.000Z | src/file.h | ahoka/replay | 03eedd775dbf4b5638d34a2bf3d9e6cbe61f1ab3 | [
"0BSD"
] | null | null | null | src/file.h | ahoka/replay | 03eedd775dbf4b5638d34a2bf3d9e6cbe61f1ab3 | [
"0BSD"
] | null | null | null | #ifndef FILE_H
#define FILE_H
size_t file_getsize(const char*);
FILE *file_open(const char *);
size_t file_read(void *, size_t, FILE *);
int file_close(FILE *);
#endif
| 17 | 41 | 0.729412 |
cc7f3b462eeb9e3dcce8c256918df4d4896f17b7 | 277 | h | C | Onekit_Tools Test/OneKit/UIViewController+OneKit.h | VIPLimited-Jenny/Onekit_Tools | ab40acc4ca7928f2c75c466449d6b02ed34798ac | [
"MIT"
] | null | null | null | Onekit_Tools Test/OneKit/UIViewController+OneKit.h | VIPLimited-Jenny/Onekit_Tools | ab40acc4ca7928f2c75c466449d6b02ed34798ac | [
"MIT"
] | null | null | null | Onekit_Tools Test/OneKit/UIViewController+OneKit.h | VIPLimited-Jenny/Onekit_Tools | ab40acc4ca7928f2c75c466449d6b02ed34798ac | [
"MIT"
] | null | null | null | //
// UIViewController+OneKit.h
// OneKit
//
// Created by 张瑾 on 15/6/30.
// Copyright (c) 2015年 visitors. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController(OneKit)
+ (UIViewController*)current;
- (void)callback:(dispatch_block_t)callback;
@end
| 18.466667 | 54 | 0.711191 |
78e9d7c15efc0a3a04286305a8d78cd2983068b3 | 5,351 | h | C | src/evtlog.h | taviso/mpgravity | f6a2a7a02014b19047e44db76ae551bd689c16ac | [
"BSD-3-Clause"
] | 9 | 2020-04-01T04:15:22.000Z | 2021-09-26T21:03:47.000Z | src/evtlog.h | taviso/mpgravity | f6a2a7a02014b19047e44db76ae551bd689c16ac | [
"BSD-3-Clause"
] | 17 | 2020-04-02T19:38:40.000Z | 2020-04-12T05:47:08.000Z | src/evtlog.h | taviso/mpgravity | f6a2a7a02014b19047e44db76ae551bd689c16ac | [
"BSD-3-Clause"
] | null | null | null | /*****************************************************************************/
/* SOURCE CONTROL VERSIONS */
/*---------------------------------------------------------------------------*/
/* */
/* Version Date Time Author / Comment (optional) */
/* */
/* $Log: evtlog.h,v $
/* Revision 1.1 2010/07/21 17:14:57 richard_wood
/* Initial checkin of V3.0.0 source code and other resources.
/* Initial code builds V3.0.0 RC1
/*
/* Revision 1.1 2009/06/09 13:21:28 richard_wood
/* *** empty log message ***
/*
/* Revision 1.2 2008/09/19 14:51:24 richard_wood
/* Updated for VS 2005
/*
/* */
/*****************************************************************************/
/**********************************************************************************
Copyright (c) 2003, Albert M. Choy
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 the name of Microplanet, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT 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.
**********************************************************************************/
#pragma once
// Priority, Time, Source, Description
// Error general
// Warning pump
// Info scribe
// decode
//
class TEventEntry {
public:
enum EPriority { kInfo, kWarning, kError };
enum ESource { kGeneral, kPump, kScribe, kRules, kDecode, kTasker, kCleaner };
TEventEntry() { m_pExtendedDesc = 0; }
TEventEntry(EPriority ePriority,
ESource eSource,
const CTime& time,
LPCTSTR desc,
LPCTSTR extDesc = NULL);
~TEventEntry();
// assignment
TEventEntry& operator= (const TEventEntry& rhs);
TEventEntry(const TEventEntry& src);
EPriority m_ePriority;
ESource m_eSource;
CString m_desc;
CString* m_pExtendedDesc;
CTime m_time;
};
//////////////////////////////////////////////////////////////////
class TEventLog {
friend class TEventViewerDlg;
public:
TEventLog();
~TEventLog();
void Add(TEventEntry::EPriority ePriority,
TEventEntry::ESource eSource,
LPCTSTR desc,
LPCTSTR extDesc = NULL);
// simpler versions have Preset priorities
void AddInfo(
TEventEntry::ESource eSource,
LPCTSTR desc,
LPCTSTR extDesc = NULL)
{
Add (TEventEntry::kInfo, eSource, desc, extDesc);
}
void AddWarning(
TEventEntry::ESource eSource,
LPCTSTR desc,
LPCTSTR extDesc = NULL)
{
Add (TEventEntry::kWarning, eSource, desc, extDesc);
}
void AddError(
TEventEntry::ESource eSource,
LPCTSTR desc,
LPCTSTR extDesc = NULL)
{
Add (TEventEntry::kError, eSource, desc, extDesc);
}
// add the entry, then show the event log dialog
void AddShowError (TEventEntry::ESource eSource,
LPCTSTR desc,
LPCTSTR extDesc = NULL);
void Lock();
void Unlock();
protected:
CArray<TEventEntry, TEventEntry&> m_vEvents;
CRITICAL_SECTION m_critSect;
BOOL m_fViewIsOutofdate;
};
extern TEventLog* gpEventLog;
class TProcessLog
{
public:
TProcessLog();
~TProcessLog();
bool IsActive ();
int ActivateLog (bool fActive, LPCTSTR serverName);
int AddString (const CString& msg);
int SaveLog ();
protected:
CRITICAL_SECTION m_critSect;
CMemFile m_memFile;
bool m_fActive;
};
extern TProcessLog* gpProcessLog;
| 35.203947 | 85 | 0.547935 |
60455a4174323ef3e53a269b4d4c7b93a94340d1 | 59 | c | C | 3rdparty/suitesparse-metis-for-windows-1.2.1/SuiteSparse/UMFPACK/SourceWrappers/umfpack_zi_report_control.o.c | luoyongheng/dtslam | d3c2230d45db14c811eff6fd43e119ac39af1352 | [
"BSD-3-Clause"
] | 370 | 2015-01-30T01:04:37.000Z | 2022-03-26T18:48:39.000Z | 3rdparty/suitesparse-metis-for-windows-1.2.1/SuiteSparse/UMFPACK/SourceWrappers/umfpack_zi_report_control.o.c | luoyongheng/dtslam | d3c2230d45db14c811eff6fd43e119ac39af1352 | [
"BSD-3-Clause"
] | 85 | 2015-02-03T22:57:35.000Z | 2021-12-17T12:39:55.000Z | 3rdparty/suitesparse-metis-for-windows-1.2.1/SuiteSparse/UMFPACK/SourceWrappers/umfpack_zi_report_control.o.c | luoyongheng/dtslam | d3c2230d45db14c811eff6fd43e119ac39af1352 | [
"BSD-3-Clause"
] | 234 | 2015-01-14T15:09:09.000Z | 2022-03-26T18:48:41.000Z | #define ZINT
#include <../Source/umfpack_report_control.c>
| 19.666667 | 45 | 0.779661 |
93b5f5667c18132538b7b5a0922a788ecb2bb329 | 285 | h | C | MZCoupon/Pojo/WalletTxnDataModel.h | Mezzofy/MZCoupon_lib | 2d89d51d6d36eecaf7eb412e1ab83dc6392f5a6d | [
"MIT"
] | null | null | null | MZCoupon/Pojo/WalletTxnDataModel.h | Mezzofy/MZCoupon_lib | 2d89d51d6d36eecaf7eb412e1ab83dc6392f5a6d | [
"MIT"
] | null | null | null | MZCoupon/Pojo/WalletTxnDataModel.h | Mezzofy/MZCoupon_lib | 2d89d51d6d36eecaf7eb412e1ab83dc6392f5a6d | [
"MIT"
] | 2 | 2018-06-27T10:49:11.000Z | 2018-07-09T04:58:36.000Z | //
// WalletTxnDataModel.h
// Mezzofy
//
// Created by Mezzofy on 15/09/17.
// Copyright © 2018 Mezzofy. All rights reserved.
//
#import "MZJastor.h"
#import "WalletTxnData.h"
@interface WalletTxnDataModel : MZJastor
@property (strong, nonatomic)WalletTxnData *wallettxn;
@end
| 16.764706 | 54 | 0.719298 |
fad4a311e66cc16089a8084684238ded19caa533 | 852 | h | C | include/pola/graphic/particle/Particle3DAffector.h | lij0511/pandora | 5988618f29d2f1ba418ef54a02e227903c1e7108 | [
"Apache-2.0"
] | null | null | null | include/pola/graphic/particle/Particle3DAffector.h | lij0511/pandora | 5988618f29d2f1ba418ef54a02e227903c1e7108 | [
"Apache-2.0"
] | null | null | null | include/pola/graphic/particle/Particle3DAffector.h | lij0511/pandora | 5988618f29d2f1ba418ef54a02e227903c1e7108 | [
"Apache-2.0"
] | null | null | null | /*
* Particle3DAffector.h
*
* Created on: 2016年7月25日
* Author: lijing
*/
#ifndef POLA_PARTICLE3DAFFECTOR_H_
#define POLA_PARTICLE3DAFFECTOR_H_
#include "pola/utils/RefBase.h"
#include "pola/graphic/particle/Particle3D.h"
namespace pola {
namespace graphic {
class Particle3DSystem;
/*
*
*/
class Particle3DAffector : public pola::utils::RefBase {
public:
virtual void updateAffector(Particle3D* particle, float deltaTime);
/** Enables or disables the emitter.
*/
void setEnabled (bool enabled) { _isEnabled = enabled; }
bool isEnabled(void) const { return _isEnabled; }
public:
Particle3DAffector();
virtual ~Particle3DAffector();
protected:
friend class Particle3DSystem;
Particle3DSystem* _particleSystem;
bool _isEnabled;
};
} /* namespace graphic */
} /* namespace pola */
#endif /* POLA_PARTICLE3DAFFECTOR_H_ */
| 18.521739 | 68 | 0.739437 |
44ff5066afbc2124e7fb3ef2e73302b1f793f857 | 631 | h | C | src/log.h | james-elastic/rogue | e458de2ab081cadaedad6143823126d5269c6037 | [
"MIT"
] | null | null | null | src/log.h | james-elastic/rogue | e458de2ab081cadaedad6143823126d5269c6037 | [
"MIT"
] | null | null | null | src/log.h | james-elastic/rogue | e458de2ab081cadaedad6143823126d5269c6037 | [
"MIT"
] | null | null | null | class Log {
public:
/* This might not be the best "cpp" style to recreate tons of functions
* here however when thinking of the caller (the app dev ie me) I'd rather
* read and type Log::Debug() than Log::Message(<debug_const>, <msg>) and
* move the "type" of log (eg debug, error, info, etc) into the function
* name simplifying both the typing of the function and the readability.
*/
static void Debug(const char *debugStr);
static void Debug(int category,
const char *debugStr);
static void Error(const char *errorStr);
static void Error(int category,
const char *errorStr);
private:
};
| 33.210526 | 76 | 0.694136 |
fa021f5c2fffae198cefe5ac295bfa9f2b74ac68 | 8,935 | h | C | src/mongo/db/dbmessage.h | morsvolia/mongo | 8cbe89efab77d70ac653d20b693cffe15a47acea | [
"Apache-2.0"
] | 324 | 2015-01-01T14:56:10.000Z | 2022-03-08T04:52:37.000Z | src/mongo/db/dbmessage.h | morsvolia/mongo | 8cbe89efab77d70ac653d20b693cffe15a47acea | [
"Apache-2.0"
] | 38 | 2015-01-31T03:57:16.000Z | 2019-04-21T03:30:53.000Z | src/mongo/db/dbmessage.h | morsvolia/mongo | 8cbe89efab77d70ac653d20b693cffe15a47acea | [
"Apache-2.0"
] | 60 | 2015-01-14T14:19:41.000Z | 2021-02-10T21:54:12.000Z | // dbmessage.h
/**
* Copyright (C) 2008 10gen Inc.
* Copyright (C) 2013 Tokutek Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "mongo/bson/bson_validate.h"
#include "mongo/client/constants.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/instance.h"
#include "mongo/util/net/message.h"
namespace mongo {
/* db response format
Query or GetMore: // see struct QueryResult
int resultFlags;
int64 cursorID;
int startingFrom;
int nReturned;
list of marshalled JSObjects;
*/
/* db request message format
unsigned opid; // arbitary; will be echoed back
byte operation;
int options;
then for:
dbInsert:
string collection;
a series of JSObjects
dbDelete:
string collection;
int flags=0; // 1=DeleteSingle
JSObject query;
dbUpdate:
string collection;
int flags; // 1=upsert
JSObject query;
JSObject objectToUpdate;
objectToUpdate may include { $inc: <field> } or { $set: ... }, see struct Mod.
dbQuery:
string collection;
int nToSkip;
int nToReturn; // how many you want back as the beginning of the cursor data (0=no limit)
// greater than zero is simply a hint on how many objects to send back per "cursor batch".
// a negative number indicates a hard limit.
JSObject query;
[JSObject fieldsToReturn]
dbGetMore:
string collection; // redundant, might use for security.
int nToReturn;
int64 cursorID;
dbKillCursors=2007:
int n;
int64 cursorIDs[n];
Note that on Update, there is only one object, which is different
from insert where you can pass a list of objects to insert in the db.
Note that the update field layout is very similar layout to Query.
*/
#pragma pack(1)
struct QueryResult : public MsgData {
long long cursorId;
int startingFrom;
int nReturned;
const char *data() {
return (char *) (((int *)&nReturned)+1);
}
int resultFlags() {
return dataAsInt();
}
int& _resultFlags() {
return dataAsInt();
}
void setResultFlagsToOk() {
_resultFlags() = ResultFlag_AwaitCapable;
}
void initializeResultFlags() {
_resultFlags() = 0;
}
};
#pragma pack()
/* For the database/server protocol, these objects and functions encapsulate
the various messages transmitted over the connection.
See http://dochub.mongodb.org/core/mongowireprotocol
*/
class DbMessage {
public:
DbMessage(const Message& _m) : m(_m) , mark(0) {
// for received messages, Message has only one buffer
theEnd = _m.singleData()->_data + _m.header()->dataLen();
char *r = _m.singleData()->_data;
reserved = (int *) r;
data = r + 4;
nextjsobj = data;
}
/** the 32 bit field before the ns
* track all bit usage here as its cross op
* 0: InsertOption_ContinueOnError
* 1: fromWriteback
*/
int& reservedField() { return *reserved; }
const char * getns() const {
return data;
}
const char * afterNS() const {
return data + strlen( data ) + 1;
}
int getInt( int num ) const {
const int * foo = (const int*)afterNS();
return foo[num];
}
int getQueryNToReturn() const {
return getInt( 1 );
}
/**
* get an int64 at specified offsetBytes after ns
*/
long long getInt64( int offsetBytes ) const {
const char * x = afterNS();
x += offsetBytes;
const long long * ll = (const long long*)x;
return ll[0];
}
void resetPull() { nextjsobj = data; }
int pullInt() const { return pullInt(); }
int& pullInt() {
if ( nextjsobj == data )
nextjsobj += strlen(data) + 1; // skip namespace
int& i = *((int *)nextjsobj);
nextjsobj += 4;
return i;
}
long long pullInt64() const {
return pullInt64();
}
long long &pullInt64() {
if ( nextjsobj == data )
nextjsobj += strlen(data) + 1; // skip namespace
long long &i = *((long long *)nextjsobj);
nextjsobj += 8;
return i;
}
OID* getOID() const {
return (OID *) (data + strlen(data) + 1); // skip namespace
}
void getQueryStuff(const char *&query, int& ntoreturn) {
int *i = (int *) (data + strlen(data) + 1);
ntoreturn = *i;
i++;
query = (const char *) i;
}
/* for insert and update msgs */
bool moreJSObjs() const {
return nextjsobj != 0;
}
BSONObj nextJsObj() {
if ( nextjsobj == data ) {
nextjsobj += strlen(data) + 1; // skip namespace
massert( 13066 , "Message contains no documents", theEnd > nextjsobj );
}
massert( 10304,
"Client Error: Remaining data too small for BSON object",
theEnd - nextjsobj >= 5 );
if ( cmdLine.objcheck ) {
Status status = validateBSON( nextjsobj, theEnd - nextjsobj );
massert( 10307,
str::stream() << "Client Error: bad object in message: " << status.reason(),
status.isOK() );
}
BSONObj js(nextjsobj);
verify( js.objsize() >= 5 );
verify( js.objsize() < ( theEnd - data ) );
nextjsobj += js.objsize();
if ( nextjsobj >= theEnd )
nextjsobj = 0;
return js;
}
const Message& msg() const { return m; }
const char * markGet() {
return nextjsobj;
}
void markSet() {
mark = nextjsobj;
}
void markReset( const char * toMark = 0) {
if( toMark == 0 ) toMark = mark;
verify( toMark );
nextjsobj = toMark;
}
private:
const Message& m;
int* reserved;
const char *data;
const char *nextjsobj;
const char *theEnd;
const char * mark;
};
/* a request to run a query, received from the database */
class QueryMessage {
public:
const char *ns;
int ntoskip;
int ntoreturn;
int queryOptions;
BSONObj query;
BSONObj fields;
/* parses the message into the above fields */
QueryMessage(DbMessage& d) {
ns = d.getns();
ntoskip = d.pullInt();
ntoreturn = d.pullInt();
query = d.nextJsObj();
if ( d.moreJSObjs() ) {
fields = d.nextJsObj();
}
queryOptions = d.msg().header()->dataAsInt();
}
};
void replyToQuery(int queryResultFlags,
AbstractMessagingPort* p, Message& requestMsg,
void *data, int size,
int nReturned, int startingFrom = 0,
long long cursorId = 0
);
/* object reply helper. */
void replyToQuery(int queryResultFlags,
AbstractMessagingPort* p, Message& requestMsg,
const BSONObj& responseObj);
/* helper to do a reply using a DbResponse object */
void replyToQuery( int queryResultFlags, Message& m, DbResponse& dbresponse, BSONObj obj );
/**
* Helper method for setting up a response object.
*
* @param queryResultFlags The flags to set to the response object.
* @param response The object to be used for building the response. The internal buffer of
* this object will contain the raw data from resultObj after a successful call.
* @param resultObj The bson object that contains the reply data.
*/
void replyToQuery( int queryResultFlags, Message& response, const BSONObj& resultObj );
} // namespace mongo
| 30.391156 | 111 | 0.546279 |
3232125c8a2cd5cb26f6c9317988919124bbcf76 | 563 | h | C | Drohne/SDK/ARDrone_SDK_2_0_1/ARDrone_SDK_2_0_1/Examples/Win32/sdk_demo/Sources/Video/video_stage.h | ffriedl/csc-at-hackathon | e01032680c8277df0f05601e71f09c18c3bf0ff4 | [
"Apache-2.0"
] | 46 | 2015-02-11T13:56:53.000Z | 2021-03-25T20:46:14.000Z | Drohne/SDK/ARDrone_SDK_2_0_1/ARDrone_SDK_2_0_1/Examples/Win32/sdk_demo/Sources/Video/video_stage.h | ffriedl/csc-at-hackathon | e01032680c8277df0f05601e71f09c18c3bf0ff4 | [
"Apache-2.0"
] | 2 | 2018-02-23T02:22:51.000Z | 2020-07-17T03:57:09.000Z | Drohne/SDK/ARDrone_SDK_2_0_1/ARDrone_SDK_2_0_1/Examples/Win32/sdk_demo/Sources/Video/video_stage.h | ffriedl/csc-at-hackathon | e01032680c8277df0f05601e71f09c18c3bf0ff4 | [
"Apache-2.0"
] | 20 | 2015-03-03T16:03:07.000Z | 2020-01-23T14:48:49.000Z | /********************************************************************
* COPYRIGHT PARROT 2010
********************************************************************
* PARROT - A.R.Drone SDK Windows Client Example
*-----------------------------------------------------------------*/
#ifndef _VIDEO_STAGE_H
#define _VIDEO_STAGE_H
#include <config.h>
#include <VP_Api/vp_api_thread_helper.h>
/* Declares the thread in charge of reading
the video socket and decoding the video stream. */
PROTO_THREAD_ROUTINE(video_stage, data);
#endif
| 31.277778 | 69 | 0.454707 |
89dedbc9b3726406ae91dddf46453b8ae18f587a | 35,888 | h | C | src/ASF/sam/utils/cmsis/sam3x/include/pio/pio_sam3x4e.h | jpietari/VME-SAM3X | 270305c7e2652373bee630e859b2b9402ec87ae9 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | src/ASF/sam/utils/cmsis/sam3x/include/pio/pio_sam3x4e.h | jpietari/VME-SAM3X | 270305c7e2652373bee630e859b2b9402ec87ae9 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | src/ASF/sam/utils/cmsis/sam3x/include/pio/pio_sam3x4e.h | jpietari/VME-SAM3X | 270305c7e2652373bee630e859b2b9402ec87ae9 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | /**
* \file
*
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
*
* Subject to your compliance with these terms, you may use Microchip
* software and any derivatives exclusively with Microchip products.
* It is your responsibility to comply with third party license terms applicable
* to your use of third party software (including open source software) that
* may accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
*/
#ifndef _SAM3X4E_PIO_
#define _SAM3X4E_PIO_
#define PIO_PA0 (1u << 0) /**< \brief Pin Controlled by PA0 */
#define PIO_PA1 (1u << 1) /**< \brief Pin Controlled by PA1 */
#define PIO_PA2 (1u << 2) /**< \brief Pin Controlled by PA2 */
#define PIO_PA3 (1u << 3) /**< \brief Pin Controlled by PA3 */
#define PIO_PA4 (1u << 4) /**< \brief Pin Controlled by PA4 */
#define PIO_PA5 (1u << 5) /**< \brief Pin Controlled by PA5 */
#define PIO_PA6 (1u << 6) /**< \brief Pin Controlled by PA6 */
#define PIO_PA7 (1u << 7) /**< \brief Pin Controlled by PA7 */
#define PIO_PA8 (1u << 8) /**< \brief Pin Controlled by PA8 */
#define PIO_PA9 (1u << 9) /**< \brief Pin Controlled by PA9 */
#define PIO_PA10 (1u << 10) /**< \brief Pin Controlled by PA10 */
#define PIO_PA11 (1u << 11) /**< \brief Pin Controlled by PA11 */
#define PIO_PA12 (1u << 12) /**< \brief Pin Controlled by PA12 */
#define PIO_PA13 (1u << 13) /**< \brief Pin Controlled by PA13 */
#define PIO_PA14 (1u << 14) /**< \brief Pin Controlled by PA14 */
#define PIO_PA15 (1u << 15) /**< \brief Pin Controlled by PA15 */
#define PIO_PA16 (1u << 16) /**< \brief Pin Controlled by PA16 */
#define PIO_PA17 (1u << 17) /**< \brief Pin Controlled by PA17 */
#define PIO_PA18 (1u << 18) /**< \brief Pin Controlled by PA18 */
#define PIO_PA19 (1u << 19) /**< \brief Pin Controlled by PA19 */
#define PIO_PA20 (1u << 20) /**< \brief Pin Controlled by PA20 */
#define PIO_PA21 (1u << 21) /**< \brief Pin Controlled by PA21 */
#define PIO_PA22 (1u << 22) /**< \brief Pin Controlled by PA22 */
#define PIO_PA23 (1u << 23) /**< \brief Pin Controlled by PA23 */
#define PIO_PA24 (1u << 24) /**< \brief Pin Controlled by PA24 */
#define PIO_PA25 (1u << 25) /**< \brief Pin Controlled by PA25 */
#define PIO_PA26 (1u << 26) /**< \brief Pin Controlled by PA26 */
#define PIO_PA27 (1u << 27) /**< \brief Pin Controlled by PA27 */
#define PIO_PA28 (1u << 28) /**< \brief Pin Controlled by PA28 */
#define PIO_PA29 (1u << 29) /**< \brief Pin Controlled by PA29 */
#define PIO_PB0 (1u << 0) /**< \brief Pin Controlled by PB0 */
#define PIO_PB1 (1u << 1) /**< \brief Pin Controlled by PB1 */
#define PIO_PB2 (1u << 2) /**< \brief Pin Controlled by PB2 */
#define PIO_PB3 (1u << 3) /**< \brief Pin Controlled by PB3 */
#define PIO_PB4 (1u << 4) /**< \brief Pin Controlled by PB4 */
#define PIO_PB5 (1u << 5) /**< \brief Pin Controlled by PB5 */
#define PIO_PB6 (1u << 6) /**< \brief Pin Controlled by PB6 */
#define PIO_PB7 (1u << 7) /**< \brief Pin Controlled by PB7 */
#define PIO_PB8 (1u << 8) /**< \brief Pin Controlled by PB8 */
#define PIO_PB9 (1u << 9) /**< \brief Pin Controlled by PB9 */
#define PIO_PB10 (1u << 10) /**< \brief Pin Controlled by PB10 */
#define PIO_PB11 (1u << 11) /**< \brief Pin Controlled by PB11 */
#define PIO_PB12 (1u << 12) /**< \brief Pin Controlled by PB12 */
#define PIO_PB13 (1u << 13) /**< \brief Pin Controlled by PB13 */
#define PIO_PB14 (1u << 14) /**< \brief Pin Controlled by PB14 */
#define PIO_PB15 (1u << 15) /**< \brief Pin Controlled by PB15 */
#define PIO_PB16 (1u << 16) /**< \brief Pin Controlled by PB16 */
#define PIO_PB17 (1u << 17) /**< \brief Pin Controlled by PB17 */
#define PIO_PB18 (1u << 18) /**< \brief Pin Controlled by PB18 */
#define PIO_PB19 (1u << 19) /**< \brief Pin Controlled by PB19 */
#define PIO_PB20 (1u << 20) /**< \brief Pin Controlled by PB20 */
#define PIO_PB21 (1u << 21) /**< \brief Pin Controlled by PB21 */
#define PIO_PB22 (1u << 22) /**< \brief Pin Controlled by PB22 */
#define PIO_PB23 (1u << 23) /**< \brief Pin Controlled by PB23 */
#define PIO_PB24 (1u << 24) /**< \brief Pin Controlled by PB24 */
#define PIO_PB25 (1u << 25) /**< \brief Pin Controlled by PB25 */
#define PIO_PB26 (1u << 26) /**< \brief Pin Controlled by PB26 */
#define PIO_PB27 (1u << 27) /**< \brief Pin Controlled by PB27 */
#define PIO_PB28 (1u << 28) /**< \brief Pin Controlled by PB28 */
#define PIO_PB29 (1u << 29) /**< \brief Pin Controlled by PB29 */
#define PIO_PB30 (1u << 30) /**< \brief Pin Controlled by PB30 */
#define PIO_PB31 (1u << 31) /**< \brief Pin Controlled by PB31 */
#define PIO_PC0 (1u << 0) /**< \brief Pin Controlled by PC0 */
#define PIO_PC1 (1u << 1) /**< \brief Pin Controlled by PC1 */
#define PIO_PC2 (1u << 2) /**< \brief Pin Controlled by PC2 */
#define PIO_PC3 (1u << 3) /**< \brief Pin Controlled by PC3 */
#define PIO_PC4 (1u << 4) /**< \brief Pin Controlled by PC4 */
#define PIO_PC5 (1u << 5) /**< \brief Pin Controlled by PC5 */
#define PIO_PC6 (1u << 6) /**< \brief Pin Controlled by PC6 */
#define PIO_PC7 (1u << 7) /**< \brief Pin Controlled by PC7 */
#define PIO_PC8 (1u << 8) /**< \brief Pin Controlled by PC8 */
#define PIO_PC9 (1u << 9) /**< \brief Pin Controlled by PC9 */
#define PIO_PC10 (1u << 10) /**< \brief Pin Controlled by PC10 */
#define PIO_PC11 (1u << 11) /**< \brief Pin Controlled by PC11 */
#define PIO_PC12 (1u << 12) /**< \brief Pin Controlled by PC12 */
#define PIO_PC13 (1u << 13) /**< \brief Pin Controlled by PC13 */
#define PIO_PC14 (1u << 14) /**< \brief Pin Controlled by PC14 */
#define PIO_PC15 (1u << 15) /**< \brief Pin Controlled by PC15 */
#define PIO_PC16 (1u << 16) /**< \brief Pin Controlled by PC16 */
#define PIO_PC17 (1u << 17) /**< \brief Pin Controlled by PC17 */
#define PIO_PC18 (1u << 18) /**< \brief Pin Controlled by PC18 */
#define PIO_PC19 (1u << 19) /**< \brief Pin Controlled by PC19 */
#define PIO_PC20 (1u << 20) /**< \brief Pin Controlled by PC20 */
#define PIO_PC21 (1u << 21) /**< \brief Pin Controlled by PC21 */
#define PIO_PC22 (1u << 22) /**< \brief Pin Controlled by PC22 */
#define PIO_PC23 (1u << 23) /**< \brief Pin Controlled by PC23 */
#define PIO_PC24 (1u << 24) /**< \brief Pin Controlled by PC24 */
#define PIO_PC25 (1u << 25) /**< \brief Pin Controlled by PC25 */
#define PIO_PC26 (1u << 26) /**< \brief Pin Controlled by PC26 */
#define PIO_PC27 (1u << 27) /**< \brief Pin Controlled by PC27 */
#define PIO_PC28 (1u << 28) /**< \brief Pin Controlled by PC28 */
#define PIO_PC29 (1u << 29) /**< \brief Pin Controlled by PC29 */
#define PIO_PC30 (1u << 30) /**< \brief Pin Controlled by PC30 */
#define PIO_PD0 (1u << 0) /**< \brief Pin Controlled by PD0 */
#define PIO_PD1 (1u << 1) /**< \brief Pin Controlled by PD1 */
#define PIO_PD2 (1u << 2) /**< \brief Pin Controlled by PD2 */
#define PIO_PD3 (1u << 3) /**< \brief Pin Controlled by PD3 */
#define PIO_PD4 (1u << 4) /**< \brief Pin Controlled by PD4 */
#define PIO_PD5 (1u << 5) /**< \brief Pin Controlled by PD5 */
#define PIO_PD6 (1u << 6) /**< \brief Pin Controlled by PD6 */
#define PIO_PD7 (1u << 7) /**< \brief Pin Controlled by PD7 */
#define PIO_PD8 (1u << 8) /**< \brief Pin Controlled by PD8 */
#define PIO_PD9 (1u << 9) /**< \brief Pin Controlled by PD9 */
#define PIO_PD10 (1u << 10) /**< \brief Pin Controlled by PD10 */
/* ========== Pio definition for ADC peripheral ========== */
#define PIO_PA2X1_AD0 (1u << 2) /**< \brief Adc signal: AD0 */
#define PIO_PA3X1_AD1 (1u << 3) /**< \brief Adc signal: AD1/WKUP1 */
#define PIO_PA3X1_WKUP1 (1u << 3) /**< \brief Adc signal: AD1/WKUP1 */
#define PIO_PB17X1_AD10 (1u << 17) /**< \brief Adc signal: AD10 */
#define PIO_PB18X1_AD11 (1u << 18) /**< \brief Adc signal: AD11 */
#define PIO_PB19X1_AD12 (1u << 19) /**< \brief Adc signal: AD12 */
#define PIO_PB20X1_AD13 (1u << 20) /**< \brief Adc signal: AD13 */
#define PIO_PB21X1_AD14 (1u << 21) /**< \brief Adc signal: AD14/WKUP13 */
#define PIO_PB21X1_WKUP13 (1u << 21) /**< \brief Adc signal: AD14/WKUP13 */
#define PIO_PA4X1_AD2 (1u << 4) /**< \brief Adc signal: AD2 */
#define PIO_PA6X1_AD3 (1u << 6) /**< \brief Adc signal: AD3 */
#define PIO_PA22X1_AD4 (1u << 22) /**< \brief Adc signal: AD4 */
#define PIO_PA23X1_AD5 (1u << 23) /**< \brief Adc signal: AD5 */
#define PIO_PA24X1_AD6 (1u << 24) /**< \brief Adc signal: AD6 */
#define PIO_PA16X1_AD7 (1u << 16) /**< \brief Adc signal: AD7 */
#define PIO_PB12X1_AD8 (1u << 12) /**< \brief Adc signal: AD8 */
#define PIO_PB13X1_AD9 (1u << 13) /**< \brief Adc signal: AD9 */
#define PIO_PA11B_ADTRG (1u << 11) /**< \brief Adc signal: ADTRG */
/* ========== Pio definition for CAN0 peripheral ========== */
#define PIO_PA1A_CANRX0 (1u << 1) /**< \brief Can0 signal: CANRX0 */
#define PIO_PA0A_CANTX0 (1u << 0) /**< \brief Can0 signal: CANTX0 */
/* ========== Pio definition for CAN1 peripheral ========== */
#define PIO_PB15A_CANRX1 (1u << 15) /**< \brief Can1 signal: CANRX1 */
#define PIO_PB14A_CANTX1 (1u << 14) /**< \brief Can1 signal: CANTX1 */
/* ========== Pio definition for DACC peripheral ========== */
#define PIO_PB15X1_DAC0 (1u << 15) /**< \brief Dacc signal: DAC0/WKUP12 */
#define PIO_PB15X1_WKUP12 (1u << 15) /**< \brief Dacc signal: DAC0/WKUP12 */
#define PIO_PB16X1_DAC1 (1u << 16) /**< \brief Dacc signal: DAC1 */
#define PIO_PA10B_DATRG (1u << 10) /**< \brief Dacc signal: DATRG */
/* ========== Pio definition for EBI peripheral ========== */
#define PIO_PC21A_A0 (1u << 21) /**< \brief Ebi signal: A0/NBS0 */
#define PIO_PC21A_NBS0 (1u << 21) /**< \brief Ebi signal: A0/NBS0 */
#define PIO_PC22A_A1 (1u << 22) /**< \brief Ebi signal: A1 */
#define PIO_PD0A_A10 (1u << 0) /**< \brief Ebi signal: A10 */
#define PIO_PD22A_A10 (1u << 22) /**< \brief Ebi signal: A10 */
#define PIO_PD1A_A11 (1u << 1) /**< \brief Ebi signal: A11 */
#define PIO_PD23A_A11 (1u << 23) /**< \brief Ebi signal: A11 */
#define PIO_PD2A_A12 (1u << 2) /**< \brief Ebi signal: A12 */
#define PIO_PD24A_A12 (1u << 24) /**< \brief Ebi signal: A12 */
#define PIO_PD3A_A13 (1u << 3) /**< \brief Ebi signal: A13 */
#define PIO_PD25A_A13 (1u << 25) /**< \brief Ebi signal: A13 */
#define PIO_PD4A_A14 (1u << 4) /**< \brief Ebi signal: A14 */
#define PIO_PD26A_A14 (1u << 26) /**< \brief Ebi signal: A14 */
#define PIO_PD5A_A15 (1u << 5) /**< \brief Ebi signal: A15 */
#define PIO_PD27A_A15 (1u << 27) /**< \brief Ebi signal: A15 */
#define PIO_PD6A_A16 (1u << 6) /**< \brief Ebi signal: A16/BA0 */
#define PIO_PD6A_BA0 (1u << 6) /**< \brief Ebi signal: A16/BA0 */
#define PIO_PD28A_A16 (1u << 28) /**< \brief Ebi signal: A16/BA0 */
#define PIO_PD28A_BA0 (1u << 28) /**< \brief Ebi signal: A16/BA0 */
#define PIO_PD7A_A17 (1u << 7) /**< \brief Ebi signal: A17/BA1 */
#define PIO_PD7A_BA1 (1u << 7) /**< \brief Ebi signal: A17/BA1 */
#define PIO_PD29A_A17 (1u << 29) /**< \brief Ebi signal: A17/BA1 */
#define PIO_PD29A_BA1 (1u << 29) /**< \brief Ebi signal: A17/BA1 */
#define PIO_PA25B_A18 (1u << 25) /**< \brief Ebi signal: A18 */
#define PIO_PB10B_A18 (1u << 10) /**< \brief Ebi signal: A18 */
#define PIO_PD30A_A18 (1u << 30) /**< \brief Ebi signal: A18 */
#define PIO_PA26B_A19 (1u << 26) /**< \brief Ebi signal: A19 */
#define PIO_PB11B_A19 (1u << 11) /**< \brief Ebi signal: A19 */
#define PIO_PE0A_A19 (1u << 0) /**< \brief Ebi signal: A19 */
#define PIO_PC23A_A2 (1u << 23) /**< \brief Ebi signal: A2 */
#define PIO_PA18B_A20 (1u << 18) /**< \brief Ebi signal: A20 */
#define PIO_PA27B_A20 (1u << 27) /**< \brief Ebi signal: A20 */
#define PIO_PE1A_A20 (1u << 1) /**< \brief Ebi signal: A20 */
#define PIO_PD8A_A21 (1u << 8) /**< \brief Ebi signal: A21/NANDALE */
#define PIO_PD8A_NANDALE (1u << 8) /**< \brief Ebi signal: A21/NANDALE */
#define PIO_PE2A_A21 (1u << 2) /**< \brief Ebi signal: A21/NANDALE */
#define PIO_PE2A_NANDALE (1u << 2) /**< \brief Ebi signal: A21/NANDALE */
#define PIO_PD9A_A22 (1u << 9) /**< \brief Ebi signal: A22/NANDCLE */
#define PIO_PD9A_NANDCLE (1u << 9) /**< \brief Ebi signal: A22/NANDCLE */
#define PIO_PE3A_A22 (1u << 3) /**< \brief Ebi signal: A22/NANDCLE */
#define PIO_PE3A_NANDCLE (1u << 3) /**< \brief Ebi signal: A22/NANDCLE */
#define PIO_PE4A_A23 (1u << 4) /**< \brief Ebi signal: A23 */
#define PIO_PC24A_A3 (1u << 24) /**< \brief Ebi signal: A3 */
#define PIO_PC25A_A4 (1u << 25) /**< \brief Ebi signal: A4 */
#define PIO_PC26A_A5 (1u << 26) /**< \brief Ebi signal: A5 */
#define PIO_PD17A_A5 (1u << 17) /**< \brief Ebi signal: A5 */
#define PIO_PC27A_A6 (1u << 27) /**< \brief Ebi signal: A6 */
#define PIO_PD18A_A6 (1u << 18) /**< \brief Ebi signal: A6 */
#define PIO_PC28A_A7 (1u << 28) /**< \brief Ebi signal: A7 */
#define PIO_PD19A_A7 (1u << 19) /**< \brief Ebi signal: A7 */
#define PIO_PC29A_A8 (1u << 29) /**< \brief Ebi signal: A8 */
#define PIO_PD20A_A8 (1u << 20) /**< \brief Ebi signal: A8 */
#define PIO_PC30A_A9 (1u << 30) /**< \brief Ebi signal: A9 */
#define PIO_PD21A_A9 (1u << 21) /**< \brief Ebi signal: A9 */
#define PIO_PD16A_CAS (1u << 16) /**< \brief Ebi signal: CAS */
#define PIO_PC2A_D0 (1u << 2) /**< \brief Ebi signal: D0 */
#define PIO_PC3A_D1 (1u << 3) /**< \brief Ebi signal: D1 */
#define PIO_PC12A_D10 (1u << 12) /**< \brief Ebi signal: D10 */
#define PIO_PC13A_D11 (1u << 13) /**< \brief Ebi signal: D11 */
#define PIO_PC14A_D12 (1u << 14) /**< \brief Ebi signal: D12 */
#define PIO_PC15A_D13 (1u << 15) /**< \brief Ebi signal: D13 */
#define PIO_PC16A_D14 (1u << 16) /**< \brief Ebi signal: D14 */
#define PIO_PC17A_D15 (1u << 17) /**< \brief Ebi signal: D15 */
#define PIO_PC4A_D2 (1u << 4) /**< \brief Ebi signal: D2 */
#define PIO_PC5A_D3 (1u << 5) /**< \brief Ebi signal: D3 */
#define PIO_PC6A_D4 (1u << 6) /**< \brief Ebi signal: D4 */
#define PIO_PC7A_D5 (1u << 7) /**< \brief Ebi signal: D5 */
#define PIO_PC8A_D6 (1u << 8) /**< \brief Ebi signal: D6 */
#define PIO_PC9A_D7 (1u << 9) /**< \brief Ebi signal: D7 */
#define PIO_PC10A_D8 (1u << 10) /**< \brief Ebi signal: D8 */
#define PIO_PC11A_D9 (1u << 11) /**< \brief Ebi signal: D9 */
#define PIO_PC19A_NANDOE (1u << 19) /**< \brief Ebi signal: NANDOE */
#define PIO_PA2B_NANDRDY (1u << 2) /**< \brief Ebi signal: NANDRDY */
#define PIO_PC20A_NANDWE (1u << 20) /**< \brief Ebi signal: NANDWE */
#define PIO_PA6B_NCS0 (1u << 6) /**< \brief Ebi signal: NCS0 */
#define PIO_PA7B_NCS1 (1u << 7) /**< \brief Ebi signal: NCS1 */
#define PIO_PB24B_NCS2 (1u << 24) /**< \brief Ebi signal: NCS2 */
#define PIO_PB27A_NCS3 (1u << 27) /**< \brief Ebi signal: NCS3 */
#define PIO_PE5A_NCS4 (1u << 5) /**< \brief Ebi signal: NCS4 */
#define PIO_PE6A_NCS5 (1u << 6) /**< \brief Ebi signal: NCS5 */
#define PIO_PE18B_NCS6 (1u << 18) /**< \brief Ebi signal: NCS6 */
#define PIO_PE27A_NCS7 (1u << 27) /**< \brief Ebi signal: NCS7 */
#define PIO_PA29B_NRD (1u << 29) /**< \brief Ebi signal: NRD */
#define PIO_PA4B_NWAIT (1u << 4) /**< \brief Ebi signal: NWAIT */
#define PIO_PC18A_NWR0 (1u << 18) /**< \brief Ebi signal: NWR0/NWE */
#define PIO_PC18A_NWE (1u << 18) /**< \brief Ebi signal: NWR0/NWE */
#define PIO_PD10A_NWR1 (1u << 10) /**< \brief Ebi signal: NWR1/NBS1 */
#define PIO_PD10A_NBS1 (1u << 10) /**< \brief Ebi signal: NWR1/NBS1 */
#define PIO_PD15A_RAS (1u << 15) /**< \brief Ebi signal: RAS */
#define PIO_PD11A_SDA10 (1u << 11) /**< \brief Ebi signal: SDA10 */
#define PIO_PD13A_SDCKE (1u << 13) /**< \brief Ebi signal: SDCKE */
#define PIO_PD12A_SDCS (1u << 12) /**< \brief Ebi signal: SDCS */
#define PIO_PD14A_SDWE (1u << 14) /**< \brief Ebi signal: SDWE */
/* ========== Pio definition for EMAC peripheral ========== */
#define PIO_PC13B_ECOL (1u << 13) /**< \brief Emac signal: ECOL */
#define PIO_PC10B_ECRS (1u << 10) /**< \brief Emac signal: ECRS */
#define PIO_PB4A_ECRSDV (1u << 4) /**< \brief Emac signal: ECRSDV/ERXDV */
#define PIO_PB4A_ERXDV (1u << 4) /**< \brief Emac signal: ECRSDV/ERXDV */
#define PIO_PB8A_EMDC (1u << 8) /**< \brief Emac signal: EMDC */
#define PIO_PB9A_EMDIO (1u << 9) /**< \brief Emac signal: EMDIO */
#define PIO_PB5A_ERX0 (1u << 5) /**< \brief Emac signal: ERX0 */
#define PIO_PB6A_ERX1 (1u << 6) /**< \brief Emac signal: ERX1 */
#define PIO_PC11B_ERX2 (1u << 11) /**< \brief Emac signal: ERX2 */
#define PIO_PC12B_ERX3 (1u << 12) /**< \brief Emac signal: ERX3 */
#define PIO_PC14B_ERXCK (1u << 14) /**< \brief Emac signal: ERXCK */
#define PIO_PB7A_ERXER (1u << 7) /**< \brief Emac signal: ERXER */
#define PIO_PB2A_ETX0 (1u << 2) /**< \brief Emac signal: ETX0 */
#define PIO_PB3A_ETX1 (1u << 3) /**< \brief Emac signal: ETX1 */
#define PIO_PC15B_ETX2 (1u << 15) /**< \brief Emac signal: ETX2 */
#define PIO_PC16B_ETX3 (1u << 16) /**< \brief Emac signal: ETX3 */
#define PIO_PB0A_ETXCK (1u << 0) /**< \brief Emac signal: ETXCK */
#define PIO_PB1A_ETXEN (1u << 1) /**< \brief Emac signal: ETXEN */
#define PIO_PC17B_ETXER (1u << 17) /**< \brief Emac signal: ETXER */
/* ========== Pio definition for HSMCI peripheral ========== */
#define PIO_PA20A_MCCDA (1u << 20) /**< \brief Hsmci signal: MCCDA */
#define PIO_PE20B_MCCDB (1u << 20) /**< \brief Hsmci signal: MCCDB */
#define PIO_PA19A_MCCK (1u << 19) /**< \brief Hsmci signal: MCCK */
#define PIO_PA21A_MCDA0 (1u << 21) /**< \brief Hsmci signal: MCDA0 */
#define PIO_PA22A_MCDA1 (1u << 22) /**< \brief Hsmci signal: MCDA1 */
#define PIO_PA23A_MCDA2 (1u << 23) /**< \brief Hsmci signal: MCDA2 */
#define PIO_PA24A_MCDA3 (1u << 24) /**< \brief Hsmci signal: MCDA3 */
#define PIO_PD0B_MCDA4 (1u << 0) /**< \brief Hsmci signal: MCDA4 */
#define PIO_PD1B_MCDA5 (1u << 1) /**< \brief Hsmci signal: MCDA5 */
#define PIO_PD2B_MCDA6 (1u << 2) /**< \brief Hsmci signal: MCDA6 */
#define PIO_PD3B_MCDA7 (1u << 3) /**< \brief Hsmci signal: MCDA7 */
#define PIO_PE22B_MCDB0 (1u << 22) /**< \brief Hsmci signal: MCDB0 */
#define PIO_PE24B_MCDB1 (1u << 24) /**< \brief Hsmci signal: MCDB1 */
#define PIO_PE26B_MCDB2 (1u << 26) /**< \brief Hsmci signal: MCDB2 */
#define PIO_PE27B_MCDB3 (1u << 27) /**< \brief Hsmci signal: MCDB3 */
/* ========== Pio definition for PMC peripheral ========== */
#define PIO_PA1B_PCK0 (1u << 1) /**< \brief Pmc signal: PCK0 */
#define PIO_PB22B_PCK0 (1u << 22) /**< \brief Pmc signal: PCK0 */
#define PIO_PA24B_PCK1 (1u << 24) /**< \brief Pmc signal: PCK1 */
#define PIO_PA30B_PCK1 (1u << 30) /**< \brief Pmc signal: PCK1 */
#define PIO_PA28B_PCK2 (1u << 28) /**< \brief Pmc signal: PCK2 */
#define PIO_PA31B_PCK2 (1u << 31) /**< \brief Pmc signal: PCK2 */
/* ========== Pio definition for PWM peripheral ========== */
#define PIO_PA5B_PWMFI0 (1u << 5) /**< \brief Pwm signal: PWMFI0 */
#define PIO_PA3B_PWMFI1 (1u << 3) /**< \brief Pwm signal: PWMFI1 */
#define PIO_PD6B_PWMFI2 (1u << 6) /**< \brief Pwm signal: PWMFI2 */
#define PIO_PA8B_PWMH0 (1u << 8) /**< \brief Pwm signal: PWMH0 */
#define PIO_PB12B_PWMH0 (1u << 12) /**< \brief Pwm signal: PWMH0 */
#define PIO_PC3B_PWMH0 (1u << 3) /**< \brief Pwm signal: PWMH0 */
#define PIO_PE15A_PWMH0 (1u << 15) /**< \brief Pwm signal: PWMH0 */
#define PIO_PA19B_PWMH1 (1u << 19) /**< \brief Pwm signal: PWMH1 */
#define PIO_PB13B_PWMH1 (1u << 13) /**< \brief Pwm signal: PWMH1 */
#define PIO_PC5B_PWMH1 (1u << 5) /**< \brief Pwm signal: PWMH1 */
#define PIO_PE16A_PWMH1 (1u << 16) /**< \brief Pwm signal: PWMH1 */
#define PIO_PA13B_PWMH2 (1u << 13) /**< \brief Pwm signal: PWMH2 */
#define PIO_PB14B_PWMH2 (1u << 14) /**< \brief Pwm signal: PWMH2 */
#define PIO_PC7B_PWMH2 (1u << 7) /**< \brief Pwm signal: PWMH2 */
#define PIO_PA9B_PWMH3 (1u << 9) /**< \brief Pwm signal: PWMH3 */
#define PIO_PB15B_PWMH3 (1u << 15) /**< \brief Pwm signal: PWMH3 */
#define PIO_PC9B_PWMH3 (1u << 9) /**< \brief Pwm signal: PWMH3 */
#define PIO_PF3A_PWMH3 (1u << 3) /**< \brief Pwm signal: PWMH3 */
#define PIO_PC20B_PWMH4 (1u << 20) /**< \brief Pwm signal: PWMH4 */
#define PIO_PE20A_PWMH4 (1u << 20) /**< \brief Pwm signal: PWMH4 */
#define PIO_PC19B_PWMH5 (1u << 19) /**< \brief Pwm signal: PWMH5 */
#define PIO_PE22A_PWMH5 (1u << 22) /**< \brief Pwm signal: PWMH5 */
#define PIO_PC18B_PWMH6 (1u << 18) /**< \brief Pwm signal: PWMH6 */
#define PIO_PE24A_PWMH6 (1u << 24) /**< \brief Pwm signal: PWMH6 */
#define PIO_PE26A_PWMH7 (1u << 26) /**< \brief Pwm signal: PWMH7 */
#define PIO_PA21B_PWML0 (1u << 21) /**< \brief Pwm signal: PWML0 */
#define PIO_PB16B_PWML0 (1u << 16) /**< \brief Pwm signal: PWML0 */
#define PIO_PC2B_PWML0 (1u << 2) /**< \brief Pwm signal: PWML0 */
#define PIO_PE18A_PWML0 (1u << 18) /**< \brief Pwm signal: PWML0 */
#define PIO_PA12B_PWML1 (1u << 12) /**< \brief Pwm signal: PWML1 */
#define PIO_PB17B_PWML1 (1u << 17) /**< \brief Pwm signal: PWML1 */
#define PIO_PC4B_PWML1 (1u << 4) /**< \brief Pwm signal: PWML1 */
#define PIO_PA20B_PWML2 (1u << 20) /**< \brief Pwm signal: PWML2 */
#define PIO_PB18B_PWML2 (1u << 18) /**< \brief Pwm signal: PWML2 */
#define PIO_PC6B_PWML2 (1u << 6) /**< \brief Pwm signal: PWML2 */
#define PIO_PE17A_PWML2 (1u << 17) /**< \brief Pwm signal: PWML2 */
#define PIO_PA0B_PWML3 (1u << 0) /**< \brief Pwm signal: PWML3 */
#define PIO_PB19B_PWML3 (1u << 19) /**< \brief Pwm signal: PWML3 */
#define PIO_PC8B_PWML3 (1u << 8) /**< \brief Pwm signal: PWML3 */
#define PIO_PB6B_PWML4 (1u << 6) /**< \brief Pwm signal: PWML4 */
#define PIO_PC21B_PWML4 (1u << 21) /**< \brief Pwm signal: PWML4 */
#define PIO_PE19A_PWML4 (1u << 19) /**< \brief Pwm signal: PWML4 */
#define PIO_PB7B_PWML5 (1u << 7) /**< \brief Pwm signal: PWML5 */
#define PIO_PC22B_PWML5 (1u << 22) /**< \brief Pwm signal: PWML5 */
#define PIO_PE21A_PWML5 (1u << 21) /**< \brief Pwm signal: PWML5 */
#define PIO_PB8B_PWML6 (1u << 8) /**< \brief Pwm signal: PWML6 */
#define PIO_PC23B_PWML6 (1u << 23) /**< \brief Pwm signal: PWML6 */
#define PIO_PE23A_PWML6 (1u << 23) /**< \brief Pwm signal: PWML6 */
#define PIO_PB9B_PWML7 (1u << 9) /**< \brief Pwm signal: PWML7 */
#define PIO_PC24B_PWML7 (1u << 24) /**< \brief Pwm signal: PWML7 */
#define PIO_PE25A_PWML7 (1u << 25) /**< \brief Pwm signal: PWML7 */
/* ========== Pio definition for SPI0 peripheral ========== */
#define PIO_PA25A_SPI0_MISO (1u << 25) /**< \brief Spi0 signal: SPI0_MISO */
#define PIO_PA26A_SPI0_MOSI (1u << 26) /**< \brief Spi0 signal: SPI0_MOSI */
#define PIO_PA28A_SPI0_NPCS0 (1u << 28) /**< \brief Spi0 signal: SPI0_NPCS0 */
#define PIO_PA29A_SPI0_NPCS1 (1u << 29) /**< \brief Spi0 signal: SPI0_NPCS1 */
#define PIO_PB20B_SPI0_NPCS1 (1u << 20) /**< \brief Spi0 signal: SPI0_NPCS1 */
#define PIO_PA30A_SPI0_NPCS2 (1u << 30) /**< \brief Spi0 signal: SPI0_NPCS2 */
#define PIO_PB21B_SPI0_NPCS2 (1u << 21) /**< \brief Spi0 signal: SPI0_NPCS2 */
#define PIO_PA31A_SPI0_NPCS3 (1u << 31) /**< \brief Spi0 signal: SPI0_NPCS3 */
#define PIO_PB23B_SPI0_NPCS3 (1u << 23) /**< \brief Spi0 signal: SPI0_NPCS3 */
#define PIO_PA27A_SPI0_SPCK (1u << 27) /**< \brief Spi0 signal: SPI0_SPCK */
/* ========== Pio definition for SSC peripheral ========== */
#define PIO_PB18A_RD (1u << 18) /**< \brief Ssc signal: RD */
#define PIO_PB17A_RF (1u << 17) /**< \brief Ssc signal: RF */
#define PIO_PB19A_RK (1u << 19) /**< \brief Ssc signal: RK */
#define PIO_PA16B_TD (1u << 16) /**< \brief Ssc signal: TD */
#define PIO_PA15B_TF (1u << 15) /**< \brief Ssc signal: TF */
#define PIO_PA14B_TK (1u << 14) /**< \brief Ssc signal: TK */
/* ========== Pio definition for TC0 peripheral ========== */
#define PIO_PB26B_TCLK0 (1u << 26) /**< \brief Tc0 signal: TCLK0 */
#define PIO_PA4A_TCLK1 (1u << 4) /**< \brief Tc0 signal: TCLK1 */
#define PIO_PA7A_TCLK2 (1u << 7) /**< \brief Tc0 signal: TCLK2 */
#define PIO_PB25B_TIOA0 (1u << 25) /**< \brief Tc0 signal: TIOA0 */
#define PIO_PA2A_TIOA1 (1u << 2) /**< \brief Tc0 signal: TIOA1 */
#define PIO_PA5A_TIOA2 (1u << 5) /**< \brief Tc0 signal: TIOA2 */
#define PIO_PB27B_TIOB0 (1u << 27) /**< \brief Tc0 signal: TIOB0 */
#define PIO_PA3A_TIOB1 (1u << 3) /**< \brief Tc0 signal: TIOB1 */
#define PIO_PA6A_TIOB2 (1u << 6) /**< \brief Tc0 signal: TIOB2 */
/* ========== Pio definition for TC1 peripheral ========== */
#define PIO_PA22B_TCLK3 (1u << 22) /**< \brief Tc1 signal: TCLK3 */
#define PIO_PA23B_TCLK4 (1u << 23) /**< \brief Tc1 signal: TCLK4 */
#define PIO_PB16A_TCLK5 (1u << 16) /**< \brief Tc1 signal: TCLK5 */
#define PIO_PB0B_TIOA3 (1u << 0) /**< \brief Tc1 signal: TIOA3 */
#define PIO_PE9A_TIOA3 (1u << 9) /**< \brief Tc1 signal: TIOA3 */
#define PIO_PB2B_TIOA4 (1u << 2) /**< \brief Tc1 signal: TIOA4 */
#define PIO_PE11A_TIOA4 (1u << 11) /**< \brief Tc1 signal: TIOA4 */
#define PIO_PB4B_TIOA5 (1u << 4) /**< \brief Tc1 signal: TIOA5 */
#define PIO_PE13A_TIOA5 (1u << 13) /**< \brief Tc1 signal: TIOA5 */
#define PIO_PB1B_TIOB3 (1u << 1) /**< \brief Tc1 signal: TIOB3 */
#define PIO_PE10A_TIOB3 (1u << 10) /**< \brief Tc1 signal: TIOB3 */
#define PIO_PB3B_TIOB4 (1u << 3) /**< \brief Tc1 signal: TIOB4 */
#define PIO_PE12A_TIOB4 (1u << 12) /**< \brief Tc1 signal: TIOB4 */
#define PIO_PB5B_TIOB5 (1u << 5) /**< \brief Tc1 signal: TIOB5 */
#define PIO_PE14A_TIOB5 (1u << 14) /**< \brief Tc1 signal: TIOB5 */
/* ========== Pio definition for TC2 peripheral ========== */
#define PIO_PC27B_TCLK6 (1u << 27) /**< \brief Tc2 signal: TCLK6 */
#define PIO_PC30B_TCLK7 (1u << 30) /**< \brief Tc2 signal: TCLK7 */
#define PIO_PD9B_TCLK8 (1u << 9) /**< \brief Tc2 signal: TCLK8 */
#define PIO_PC25B_TIOA6 (1u << 25) /**< \brief Tc2 signal: TIOA6 */
#define PIO_PC28B_TIOA7 (1u << 28) /**< \brief Tc2 signal: TIOA7 */
#define PIO_PD7B_TIOA8 (1u << 7) /**< \brief Tc2 signal: TIOA8 */
#define PIO_PC26B_TIOB6 (1u << 26) /**< \brief Tc2 signal: TIOB6 */
#define PIO_PC29B_TIOB7 (1u << 29) /**< \brief Tc2 signal: TIOB7 */
#define PIO_PD8B_TIOB8 (1u << 8) /**< \brief Tc2 signal: TIOB8 */
/* ========== Pio definition for TWI0 peripheral ========== */
#define PIO_PA18A_TWCK0 (1u << 18) /**< \brief Twi0 signal: TWCK0 */
#define PIO_PA17A_TWD0 (1u << 17) /**< \brief Twi0 signal: TWD0 */
/* ========== Pio definition for TWI1 peripheral ========== */
#define PIO_PB13A_TWCK1 (1u << 13) /**< \brief Twi1 signal: TWCK1 */
#define PIO_PB12A_TWD1 (1u << 12) /**< \brief Twi1 signal: TWD1 */
/* ========== Pio definition for UART peripheral ========== */
#define PIO_PA8A_URXD (1u << 8) /**< \brief Uart signal: URXD */
#define PIO_PA9A_UTXD (1u << 9) /**< \brief Uart signal: UTXD */
/* ========== Pio definition for UOTGHS peripheral ========== */
#define PIO_PB11A_UOTGID (1u << 11) /**< \brief Uotghs signal: UOTGID */
#define PIO_PB10A_UOTGVBOF (1u << 10) /**< \brief Uotghs signal: UOTGVBOF */
/* ========== Pio definition for USART0 peripheral ========== */
#define PIO_PB26A_CTS0 (1u << 26) /**< \brief Usart0 signal: CTS0 */
#define PIO_PB25A_RTS0 (1u << 25) /**< \brief Usart0 signal: RTS0 */
#define PIO_PA10A_RXD0 (1u << 10) /**< \brief Usart0 signal: RXD0 */
#define PIO_PA17B_SCK0 (1u << 17) /**< \brief Usart0 signal: SCK0 */
#define PIO_PA11A_TXD0 (1u << 11) /**< \brief Usart0 signal: TXD0 */
/* ========== Pio definition for USART1 peripheral ========== */
#define PIO_PA15A_CTS1 (1u << 15) /**< \brief Usart1 signal: CTS1 */
#define PIO_PA14A_RTS1 (1u << 14) /**< \brief Usart1 signal: RTS1 */
#define PIO_PA12A_RXD1 (1u << 12) /**< \brief Usart1 signal: RXD1 */
#define PIO_PA16A_SCK1 (1u << 16) /**< \brief Usart1 signal: SCK1 */
#define PIO_PA13A_TXD1 (1u << 13) /**< \brief Usart1 signal: TXD1 */
/* ========== Pio definition for USART2 peripheral ========== */
#define PIO_PB23A_CTS2 (1u << 23) /**< \brief Usart2 signal: CTS2 */
#define PIO_PB22A_RTS2 (1u << 22) /**< \brief Usart2 signal: RTS2 */
#define PIO_PB21A_RXD2 (1u << 21) /**< \brief Usart2 signal: RXD2 */
#define PIO_PB24A_SCK2 (1u << 24) /**< \brief Usart2 signal: SCK2 */
#define PIO_PB20A_TXD2 (1u << 20) /**< \brief Usart2 signal: TXD2 */
/* ========== Pio definition for USART3 peripheral ========== */
#define PIO_PF4A_CTS3 (1u << 4) /**< \brief Usart3 signal: CTS3 */
#define PIO_PF5A_RTS3 (1u << 5) /**< \brief Usart3 signal: RTS3 */
#define PIO_PD5B_RXD3 (1u << 5) /**< \brief Usart3 signal: RXD3 */
#define PIO_PE16B_SCK3 (1u << 16) /**< \brief Usart3 signal: SCK3 */
#define PIO_PD4B_TXD3 (1u << 4) /**< \brief Usart3 signal: TXD3 */
/* ========== Pio indexes ========== */
#define PIO_PA0_IDX 0
#define PIO_PA1_IDX 1
#define PIO_PA2_IDX 2
#define PIO_PA3_IDX 3
#define PIO_PA4_IDX 4
#define PIO_PA5_IDX 5
#define PIO_PA6_IDX 6
#define PIO_PA7_IDX 7
#define PIO_PA8_IDX 8
#define PIO_PA9_IDX 9
#define PIO_PA10_IDX 10
#define PIO_PA11_IDX 11
#define PIO_PA12_IDX 12
#define PIO_PA13_IDX 13
#define PIO_PA14_IDX 14
#define PIO_PA15_IDX 15
#define PIO_PA16_IDX 16
#define PIO_PA17_IDX 17
#define PIO_PA18_IDX 18
#define PIO_PA19_IDX 19
#define PIO_PA20_IDX 20
#define PIO_PA21_IDX 21
#define PIO_PA22_IDX 22
#define PIO_PA23_IDX 23
#define PIO_PA24_IDX 24
#define PIO_PA25_IDX 25
#define PIO_PA26_IDX 26
#define PIO_PA27_IDX 27
#define PIO_PA28_IDX 28
#define PIO_PA29_IDX 29
#define PIO_PB0_IDX 32
#define PIO_PB1_IDX 33
#define PIO_PB2_IDX 34
#define PIO_PB3_IDX 35
#define PIO_PB4_IDX 36
#define PIO_PB5_IDX 37
#define PIO_PB6_IDX 38
#define PIO_PB7_IDX 39
#define PIO_PB8_IDX 40
#define PIO_PB9_IDX 41
#define PIO_PB10_IDX 42
#define PIO_PB11_IDX 43
#define PIO_PB12_IDX 44
#define PIO_PB13_IDX 45
#define PIO_PB14_IDX 46
#define PIO_PB15_IDX 47
#define PIO_PB16_IDX 48
#define PIO_PB17_IDX 49
#define PIO_PB18_IDX 50
#define PIO_PB19_IDX 51
#define PIO_PB20_IDX 52
#define PIO_PB21_IDX 53
#define PIO_PB22_IDX 54
#define PIO_PB23_IDX 55
#define PIO_PB24_IDX 56
#define PIO_PB25_IDX 57
#define PIO_PB26_IDX 58
#define PIO_PB27_IDX 59
#define PIO_PB28_IDX 60
#define PIO_PB29_IDX 61
#define PIO_PB30_IDX 62
#define PIO_PB31_IDX 63
#define PIO_PC0_IDX 64
#define PIO_PC1_IDX 65
#define PIO_PC2_IDX 66
#define PIO_PC3_IDX 67
#define PIO_PC4_IDX 68
#define PIO_PC5_IDX 69
#define PIO_PC6_IDX 70
#define PIO_PC7_IDX 71
#define PIO_PC8_IDX 72
#define PIO_PC9_IDX 73
#define PIO_PC10_IDX 74
#define PIO_PC11_IDX 75
#define PIO_PC12_IDX 76
#define PIO_PC13_IDX 77
#define PIO_PC14_IDX 78
#define PIO_PC15_IDX 79
#define PIO_PC16_IDX 80
#define PIO_PC17_IDX 81
#define PIO_PC18_IDX 82
#define PIO_PC19_IDX 83
#define PIO_PC20_IDX 84
#define PIO_PC21_IDX 85
#define PIO_PC22_IDX 86
#define PIO_PC23_IDX 87
#define PIO_PC24_IDX 88
#define PIO_PC25_IDX 89
#define PIO_PC26_IDX 90
#define PIO_PC27_IDX 91
#define PIO_PC28_IDX 92
#define PIO_PC29_IDX 93
#define PIO_PC30_IDX 94
#define PIO_PD0_IDX 96
#define PIO_PD1_IDX 97
#define PIO_PD2_IDX 98
#define PIO_PD3_IDX 99
#define PIO_PD4_IDX 100
#define PIO_PD5_IDX 101
#define PIO_PD6_IDX 102
#define PIO_PD7_IDX 103
#define PIO_PD8_IDX 104
#define PIO_PD9_IDX 105
#define PIO_PD10_IDX 106
#endif /* _SAM3X4E_PIO_ */
| 64.315412 | 93 | 0.567961 |
964bf664a07723baee0514dee31a8c2b01142dd3 | 11,572 | h | C | Code/Framework/AzFramework/AzFramework/Components/CameraBus.h | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | 11 | 2021-07-08T09:58:26.000Z | 2022-03-17T17:59:26.000Z | Code/Framework/AzFramework/AzFramework/Components/CameraBus.h | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | 29 | 2021-07-06T19:33:52.000Z | 2022-03-22T10:27:49.000Z | Code/Framework/AzFramework/AzFramework/Components/CameraBus.h | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | 4 | 2021-07-06T19:24:43.000Z | 2022-03-31T12:42:27.000Z | /*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Component/ComponentBus.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Math/Transform.h>
namespace Camera
{
//! Stores camera configuration values that describe the camera's view frustum.
struct Configuration
{
float m_fovRadians = 0.f;
float m_nearClipDistance = 0.f;
float m_farClipDistance = 0.f;
float m_frustumWidth = 0.f;
float m_frustumHeight = 0.f;
};
//! Use this bus to send messages to a camera component on an entity
//! If you create your own camera you should implement this bus
//! Call like this:
//! Camera::CameraRequestBus::Event(cameraEntityId, &Camera::CameraRequestBus::Events::SetFov, newFov);
class CameraComponentRequests
: public AZ::ComponentBus
{
public:
virtual ~CameraComponentRequests() = default;
//! Gets the camera's field of view in degrees
//! @return The camera's field of view in degrees
virtual float GetFov()
{
AZ_WarningOnce("CameraBus", false, "GetFov is deprecated. Please use GetFovDegrees or GetFovRadians.");
return GetFovDegrees();
}
//! Gets the camera's field of view in degrees
//! @return The camera's field of view in degrees
virtual float GetFovDegrees() = 0;
//! Gets the camera's field of view in radians
//! @return The camera's field of view in radians
virtual float GetFovRadians() = 0;
//! Gets the camera's distance from the near clip plane in meters
//! @return The camera's distance from the near clip plane in meters
virtual float GetNearClipDistance() = 0;
//! Gets the camera's distance from the far clip plane in meters
//! @return The camera's distance from the far clip plane in meters
virtual float GetFarClipDistance() = 0;
//! Gets the camera frustum's width
//! @return The camera frustum's width
virtual float GetFrustumWidth() = 0;
//! Gets the camera frustum's height
//! @return The camera frustum's height
virtual float GetFrustumHeight() = 0;
//! Gets whether or not the camera is using an orthographic projection.
//! @return True if the camera is using an orthographic projection, or false if the camera is using a perspective projection.
virtual bool IsOrthographic() = 0;
//! @return The half width of the orthographic projection, @see SetOrthographicHalfWidth.
virtual float GetOrthographicHalfWidth() = 0;
//! Sets the camera's field of view in degrees between 0 < fov < 180 degrees
//! @param fov The camera frustum's new field of view in degrees
virtual void SetFov(float fov)
{
AZ_WarningOnce("CameraBus", false, "SetFov is deprecated. Please use SetFovDegrees or SetFovRadians.");
SetFovDegrees(fov);
}
//! Sets the camera's field of view in degrees between 0 < fov < 180 degrees
//! @param fov The camera frustum's new field of view in degrees
virtual void SetFovDegrees(float fovInDegrees) = 0;
//! Sets the camera's field of view in radians between 0 < fov < pi radians
//! @param fov The camera frustum's new field of view in radians
virtual void SetFovRadians(float fovInRadians) = 0;
//! Sets the near clip plane to a given distance from the camera in meters. Should be small, but greater than 0
//! @param nearClipDistance The camera frustum's new near clip plane distance from camera
virtual void SetNearClipDistance(float nearClipDistance) = 0;
//! Sets the far clip plane to a given distance from the camera in meters.
//! @param farClipDistance The camera frustum's new far clip plane distance from camera
virtual void SetFarClipDistance(float farClipDistance) = 0;
//! Sets the camera frustum's width
//! @param width The camera frustum's new width
virtual void SetFrustumWidth(float width) = 0;
//! Sets the camera frustum's height
//! @param height The camera frustum's new height
virtual void SetFrustumHeight(float height) = 0;
//! Sets whether or not the camera should use an orthographic projection in place of a perspective projection.
//! @param orthographic If true, the camera will use an orthographic projection
virtual void SetOrthographic(bool orthographic) = 0;
//! Sets the half-width of the orthographic projection.
//! @params halfWidth Used to calculate the bounds of the projection while in orthographic mode.
//! The height is calculated automatically based on the aspect ratio.
virtual void SetOrthographicHalfWidth(float halfWidth) = 0;
//! Makes the camera the active view
virtual void MakeActiveView() = 0;
//! Check if this camera is the active render camera
virtual bool IsActiveView() = 0;
//! Get the camera frustum's aggregate configuration
virtual Configuration GetCameraConfiguration()
{
return Configuration
{
GetFovRadians(),
GetNearClipDistance(),
GetFarClipDistance(),
GetFrustumWidth(),
GetFrustumHeight()
};
}
//! Unprojects a position in screen space pixel coordinates to world space.
//! With a depth of zero, the position returned will be on the near clip plane of the camera
//! in world space.
//! @param screenPosition The absolute screen position
//! @param depth The depth offset into the world relative to the near clip plane of the camera
//! @return the position in world space
virtual AZ::Vector3 ScreenToWorld(const AZ::Vector2& screenPosition, float depth) = 0;
//! Unprojects a position in screen space normalized device coordinates to world space.
//! With a depth of zero, the position returned will be on the near clip plane of the camera
//! in world space.
//! @param screenNdcPosition The normalized device coordinates in the range [0,1]
//! @param depth The depth offset into the world relative to the near clip plane of the camera
//! @return the position in world space
virtual AZ::Vector3 ScreenNdcToWorld(const AZ::Vector2& screenNdcPosition, float depth) = 0;
//! Projects a position in world space to screen space for the given camera.
//! @param worldPosition The world position
//! @return The absolute screen position
virtual AZ::Vector2 WorldToScreen(const AZ::Vector3& worldPosition) = 0;
//! Projects a position in world space to screen space normalized device coordinates.
//! @param worldPosition The world position
//! @return The normalized device coordinates in the range [0,1]
virtual AZ::Vector2 WorldToScreenNdc(const AZ::Vector3& worldPosition) = 0;
};
using CameraRequestBus = AZ::EBus<CameraComponentRequests>;
//! Use this broadcast bus to gather a list of all active cameras
//! If you create your own camera you should handle this bus
//! Call like this:
//! AZ::EBusAggregateResults<AZ::EntityId> results;
//! Camera::CameraBus::BroadcastResult(results, &Camera::CameraRequests::GetCameras);
class CameraRequests
: public AZ::EBusTraits
{
public:
virtual ~CameraRequests() = default;
/// Get a list of all cameras
virtual AZ::EntityId GetCameras() = 0;
};
using CameraBus = AZ::EBus<CameraRequests>;
//! Use this system broadcast for things like getting the active camera
class CameraSystemRequests
: public AZ::EBusTraits
{
public:
virtual ~CameraSystemRequests() = default;
//! returns the camera being used by the active view
virtual AZ::EntityId GetActiveCamera() = 0;
};
using CameraSystemRequestBus = AZ::EBus<CameraSystemRequests>;
//! This system broadcast offer the active camera information
//! even when the camera is not attached to an entity.
class ActiveCameraRequests
: public AZ::EBusTraits
{
public:
virtual ~ActiveCameraRequests() = default;
//! This returns the transform of the active view
virtual const AZ::Transform& GetActiveCameraTransform() = 0;
//! This returns the configuration of the active camera.
virtual const Configuration& GetActiveCameraConfiguration() = 0;
};
using ActiveCameraRequestBus = AZ::EBus<ActiveCameraRequests>;
//! Handle this bus if you want to know when cameras are added or removed during edit or run time
//! You will get an OnCameraAdded event for each camera that is already active
//! If you create your own camera you should call this bus on activation/deactivation
//! Connect to the bus like this
//! Camera::CameraNotificationBus::Handler::Connect()
class CameraNotifications
: public AZ::EBusTraits
{
public:
template<class Bus>
struct CameraNotificationConnectionPolicy
: public AZ::EBusConnectionPolicy<Bus>
{
static void Connect(typename Bus::BusPtr& busPtr, typename Bus::Context& context, typename Bus::HandlerNode& handler, typename Bus::Context::ConnectLockGuard& connectLock, const typename Bus::BusIdType& id = 0)
{
AZ::EBusConnectionPolicy<Bus>::Connect(busPtr, context, handler, connectLock, id);
AZ::EBusAggregateResults<AZ::EntityId> results;
CameraBus::BroadcastResult(results, &CameraRequests::GetCameras);
for (const AZ::EntityId& cameraId : results.values)
{
handler->OnCameraAdded(cameraId);
}
AZ::EntityId activeView;
CameraSystemRequestBus::BroadcastResult(activeView, &CameraSystemRequestBus::Events::GetActiveCamera);
if (activeView.IsValid())
{
handler->OnActiveViewChanged(activeView);
}
}
};
//! If the camera is active when a handler connects to the bus,
//! then OnCameraAdded() is immediately dispatched.
template<class Bus>
using ConnectionPolicy = CameraNotificationConnectionPolicy<Bus>;
virtual ~CameraNotifications() = default;
//! Called whenever a camera entity is added
//! @param cameraId The id of the camera added
virtual void OnCameraAdded(const AZ::EntityId& /*cameraId*/) {}
//! Called whenever a camera entity is removed
//! @param cameraId The id of the camera removed
virtual void OnCameraRemoved(const AZ::EntityId& /*cameraId*/) {}
//! Called whenever the active camera entity changes
//! @param cameraId The id of the newly activated camera
virtual void OnActiveViewChanged(const AZ::EntityId&) {}
};
using CameraNotificationBus = AZ::EBus<CameraNotifications>;
#define CameraComponentTypeId "{E2DC7EB8-02D1-4E6D-BFE4-CE652FCB7C7F}"
#define EditorCameraComponentTypeId "{CA11DA46-29FF-4083-B5F6-E02C3A8C3A3D}"
} // namespace Camera
| 44.167939 | 222 | 0.658659 |
cf39d3793f488e59ed350f8a55b441d09cfd7ff9 | 2,451 | h | C | Accounts/util/iOS-SDK/SalesforceSDK/include/SalesforceSDK/FMResultSet.h | FireFish/Salesforce-for-iPad | 8910888ab2879f240824b2175b64318df14b29e8 | [
"BSD-3-Clause"
] | 1 | 2022-01-05T20:29:29.000Z | 2022-01-05T20:29:29.000Z | Accounts/util/iOS-SDK/SalesforceSDK/include/SalesforceSDK/FMResultSet.h | FireFish/Salesforce-for-iPad | 8910888ab2879f240824b2175b64318df14b29e8 | [
"BSD-3-Clause"
] | null | null | null | Accounts/util/iOS-SDK/SalesforceSDK/include/SalesforceSDK/FMResultSet.h | FireFish/Salesforce-for-iPad | 8910888ab2879f240824b2175b64318df14b29e8 | [
"BSD-3-Clause"
] | null | null | null | /*
Copyright (c) 2008 Flying Meat Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "sqlite3.h"
@class FMDatabase;
@interface FMResultSet : NSObject {
FMDatabase *parentDB;
sqlite3_stmt *pStmt;
NSString *query;
NSArray *binds;
NSMutableDictionary *columnNameToIndexMap;
BOOL columnNamesSetup;
BOOL defaultColumnValues;
int columnCount;
}
+ (id) resultSetWithStatement:(sqlite3_stmt *)stmt query:(NSString *)sql binds:(NSArray *)binds parentDb:(FMDatabase*)aDB;
- (void) close;
- (BOOL) next;
- (NSString *)query;
- (int) intForColumn:(NSString*)columnName;
- (int) intForColumnIndex:(int)columnIdx;
- (long) longForColumn:(NSString*)columnName;
- (long) longForColumnIndex:(int)columnIdx;
- (BOOL) boolForColumn:(NSString*)columnName;
- (BOOL) boolForColumnIndex:(int)columnIdx;
- (double) doubleForColumn:(NSString*)columnName;
- (double) doubleForColumnIndex:(int)columnIdx;
- (NSNumber *) nsnumberForColumn:(NSString *)columnName;
- (NSString*) stringForColumn:(NSString*)columnName;
- (NSString*) stringForColumnIndex:(int)columnIdx;
- (NSDate*) dateForColumn:(NSString*)columnName;
- (NSDate*) dateForColumnIndex:(int)columnIdx;
- (NSData*) dataForColumn:(NSString*)columnName;
- (NSData*) dataForColumnIndex:(int)columnIdx;
- (void) kvcMagic:(id)object;
- (NSArray *)originalColumnNames;
- (int) columnIndexForName:(NSString*)columnName;
@end
| 32.68 | 122 | 0.756834 |
d66c58f3e17aa4ea6dd5206d8d9152dbc48dae8a | 2,014 | h | C | win_col_event/mcfilter/grpc.h | zaza6677/Hades-Windows | f599eb08d841a3e0e017acfbda9078e2108078a3 | [
"Apache-2.0"
] | 1 | 2021-12-30T10:48:51.000Z | 2021-12-30T10:48:51.000Z | win_col_event/mcfilter/grpc.h | zaza6677/Hades-Windows | f599eb08d841a3e0e017acfbda9078e2108078a3 | [
"Apache-2.0"
] | null | null | null | win_col_event/mcfilter/grpc.h | zaza6677/Hades-Windows | f599eb08d841a3e0e017acfbda9078e2108078a3 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <grpcpp/grpcpp.h>
#include <grpc++/security/credentials.h>
#include <fstream>
#include "hades_win.grpc.pb.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using proto::Transfer;
using proto::RawData;
using proto::Command;
using namespace std;
const char rootcrt_path[] = "./ssl_key/ca.pem";
const char clientcrt_path[] = "./ssl_key/client.pem";
const char clientkey_path[] = "./ssl_key/client_key.pem";
static std::string get_file_contents(const char* fpath)
{
std::ifstream finstream((char*)fpath);
std::string contents;
contents.assign((std::istreambuf_iterator<char>(finstream)),
std::istreambuf_iterator<char>());
finstream.close();
return contents;
}
class Grpc
{
public:
Grpc(std::shared_ptr<Channel> channel)
: stub_(Transfer::NewStub(channel))
{
m_stream = nullptr;
}
~Grpc()
{
Grpc_steamDon();
ThreadPool_Free();
}
unique_ptr<::grpc::ClientReaderWriter<::proto::RawData, ::proto::Command>> Grpc_streamInit()
{
unique_ptr<::grpc::ClientReaderWriter<::proto::RawData, ::proto::Command>> stream(stub_->Transfer(&m_context));
return stream;
}
bool Grpc_Getstream()
{
if (!m_stream)
m_stream = Grpc_streamInit();
return true;
}
void Grpc_steamDon()
{
if (m_stream)
{
m_stream->WritesDone();
m_stream->Finish();
m_stream = nullptr;
}
}
bool Grpc_Transfer(RawData rawData);
void Grpc_ReadC2Thread(LPVOID lpThreadParameter);
void Grpc_ReadDispatchHandle(Command& command);
bool Grpc_pushQueue(const int code, const char* buf, int len);
bool ThreadPool_Init();
bool ThreadPool_Free();
void threadProc();
private:
unique_ptr<Transfer::Stub> stub_;
ClientContext m_context;
unique_ptr<::grpc::ClientReaderWriter<::proto::RawData, ::proto::Command>> m_stream;
typedef std::vector<HANDLE> tThreads;
tThreads m_threads;
HANDLE m_jobAvailableEvent;
// void Grpc_ReadDispatchHandle(Command& command);
};
| 20.14 | 114 | 0.722443 |
fdc052f415c2706ca62533f81b99af0713510e6e | 1,481 | h | C | chrome/browser/ash/lock_screen_apps/toast_dialog_view.h | iridium-browser/iridium-browser | 907e31cf5ce5ad14d832796e3a7c11e496828959 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | chrome/browser/ash/lock_screen_apps/toast_dialog_view.h | iridium-browser/iridium-browser | 907e31cf5ce5ad14d832796e3a7c11e496828959 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | chrome/browser/ash/lock_screen_apps/toast_dialog_view.h | iridium-browser/iridium-browser | 907e31cf5ce5ad14d832796e3a7c11e496828959 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_LOCK_SCREEN_APPS_TOAST_DIALOG_VIEW_H_
#define CHROME_BROWSER_ASH_LOCK_SCREEN_APPS_TOAST_DIALOG_VIEW_H_
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
namespace lock_screen_apps {
// The system modal bubble dialog shown to the user when a lock screen app is
// first launched from the lock screen. The dialog will block the app UI until
// the user closes it.
class ToastDialogView : public views::BubbleDialogDelegateView {
public:
METADATA_HEADER(ToastDialogView);
ToastDialogView(const std::u16string& app_name,
base::OnceClosure dismissed_callback);
ToastDialogView(const ToastDialogView&) = delete;
ToastDialogView& operator=(const ToastDialogView&) = delete;
~ToastDialogView() override;
// views::BubbleDialogDelegateView:
void AddedToWidget() override;
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override;
private:
// Callback to be called when the user closes the dialog.
base::OnceClosure dismissed_callback_;
};
} // namespace lock_screen_apps
#endif // CHROME_BROWSER_ASH_LOCK_SCREEN_APPS_TOAST_DIALOG_VIEW_H_
| 35.261905 | 78 | 0.770425 |
a97dbbd2de99880e6c59c35ea8e10195729841fc | 3,511 | h | C | linsched-linsched-alpha/drivers/net/ethernet/sfc/mdio_10g.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 47 | 2015-03-10T23:21:52.000Z | 2022-02-17T01:04:14.000Z | linsched-linsched-alpha/drivers/net/ethernet/sfc/mdio_10g.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 1 | 2017-05-26T04:28:56.000Z | 2017-08-13T12:12:31.000Z | linsched-linsched-alpha/drivers/net/ethernet/sfc/mdio_10g.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 19 | 2015-02-25T19:50:05.000Z | 2021-10-05T14:35:54.000Z | /****************************************************************************
* Driver for Solarflare Solarstorm network controllers and boards
* Copyright 2006-2011 Solarflare Communications Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation, incorporated herein by reference.
*/
#ifndef EFX_MDIO_10G_H
#define EFX_MDIO_10G_H
#include <linux/mdio.h>
/*
* Helper functions for doing 10G MDIO as specified in IEEE 802.3 clause 45.
*/
#include "efx.h"
static inline unsigned efx_mdio_id_rev(u32 id) { return id & 0xf; }
static inline unsigned efx_mdio_id_model(u32 id) { return (id >> 4) & 0x3f; }
extern unsigned efx_mdio_id_oui(u32 id);
static inline int efx_mdio_read(struct efx_nic *efx, int devad, int addr)
{
return efx->mdio.mdio_read(efx->net_dev, efx->mdio.prtad, devad, addr);
}
static inline void
efx_mdio_write(struct efx_nic *efx, int devad, int addr, int value)
{
efx->mdio.mdio_write(efx->net_dev, efx->mdio.prtad, devad, addr, value);
}
static inline u32 efx_mdio_read_id(struct efx_nic *efx, int mmd)
{
u16 id_low = efx_mdio_read(efx, mmd, MDIO_DEVID2);
u16 id_hi = efx_mdio_read(efx, mmd, MDIO_DEVID1);
return (id_hi << 16) | (id_low);
}
static inline bool efx_mdio_phyxgxs_lane_sync(struct efx_nic *efx)
{
int i, lane_status;
bool sync;
for (i = 0; i < 2; ++i)
lane_status = efx_mdio_read(efx, MDIO_MMD_PHYXS,
MDIO_PHYXS_LNSTAT);
sync = !!(lane_status & MDIO_PHYXS_LNSTAT_ALIGN);
if (!sync)
netif_dbg(efx, hw, efx->net_dev, "XGXS lane status: %x\n",
lane_status);
return sync;
}
extern const char *efx_mdio_mmd_name(int mmd);
/*
* Reset a specific MMD and wait for reset to clear.
* Return number of spins left (>0) on success, -%ETIMEDOUT on failure.
*
* This function will sleep
*/
extern int efx_mdio_reset_mmd(struct efx_nic *efx, int mmd,
int spins, int spintime);
/* As efx_mdio_check_mmd but for multiple MMDs */
int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask);
/* Check the link status of specified mmds in bit mask */
extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask);
/* Generic transmit disable support though PMAPMD */
extern void efx_mdio_transmit_disable(struct efx_nic *efx);
/* Generic part of reconfigure: set/clear loopback bits */
extern void efx_mdio_phy_reconfigure(struct efx_nic *efx);
/* Set the power state of the specified MMDs */
extern void efx_mdio_set_mmds_lpower(struct efx_nic *efx,
int low_power, unsigned int mmd_mask);
/* Set (some of) the PHY settings over MDIO */
extern int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd);
/* Push advertising flags and restart autonegotiation */
extern void efx_mdio_an_reconfigure(struct efx_nic *efx);
/* Get pause parameters from AN if available (otherwise return
* requested pause parameters)
*/
u8 efx_mdio_get_pause(struct efx_nic *efx);
/* Wait for specified MMDs to exit reset within a timeout */
extern int efx_mdio_wait_reset_mmds(struct efx_nic *efx,
unsigned int mmd_mask);
/* Set or clear flag, debouncing */
static inline void
efx_mdio_set_flag(struct efx_nic *efx, int devad, int addr,
int mask, bool state)
{
mdio_set_flag(&efx->mdio, efx->mdio.prtad, devad, addr, mask, state);
}
/* Liveness self-test for MDIO PHYs */
extern int efx_mdio_test_alive(struct efx_nic *efx);
#endif /* EFX_MDIO_10G_H */
| 31.070796 | 80 | 0.726858 |
654cd99e955d9c2ef11d76381e583e548770939c | 6,266 | h | C | libc/newlib/libm/machine/spu/headers/tanhd2.h | The0x539/wasp | 5f83aab7bf0c0915b1d3491034d35b091c7aebdf | [
"MIT"
] | 453 | 2016-07-29T23:26:30.000Z | 2022-02-21T01:09:13.000Z | libc/newlib/libm/machine/spu/headers/tanhd2.h | The0x539/wasp | 5f83aab7bf0c0915b1d3491034d35b091c7aebdf | [
"MIT"
] | 175 | 2018-05-30T03:06:15.000Z | 2019-02-06T23:54:24.000Z | libc/newlib/libm/machine/spu/headers/tanhd2.h | The0x539/wasp | 5f83aab7bf0c0915b1d3491034d35b091c7aebdf | [
"MIT"
] | 57 | 2016-07-29T23:34:09.000Z | 2021-07-13T18:17:02.000Z | /* -------------------------------------------------------------- */
/* (C)Copyright 2007,2008, */
/* International Business Machines Corporation */
/* 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 the name of IBM Corporation 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. */
/* -------------------------------------------------------------- */
/* PROLOG END TAG zYx */
#ifdef __SPU__
#ifndef _TANHD2_H_
#define _TANHD2_H_ 1
#include <spu_intrinsics.h>
#include "expd2.h"
#include "divd2.h"
/*
* Taylor coefficients for tanh
*/
#define TANH_TAY01 1.000000000000000000000000000000E0
#define TANH_TAY02 -3.333333333333333333333333333333E-1
#define TANH_TAY03 1.333333333333333333333333333333E-1
#define TANH_TAY04 -5.396825396825396825396825396825E-2
#define TANH_TAY05 2.186948853615520282186948853616E-2
#define TANH_TAY06 -8.863235529902196568863235529902E-3
#define TANH_TAY07 3.592128036572481016925461369906E-3
#define TANH_TAY08 -1.455834387051318268249485180702E-3
#define TANH_TAY09 5.900274409455859813780759937000E-4
#define TANH_TAY10 -2.391291142435524814857314588851E-4
#define TANH_TAY11 9.691537956929450325595875000389E-5
#define TANH_TAY12 -3.927832388331683405337080809312E-5
#define TANH_TAY13 1.591890506932896474074427981657E-5
#define TANH_TAY14 -6.451689215655430763190842315303E-6
#define TANH_TAY15 2.614771151290754554263594256410E-6
#define TANH_TAY16 -1.059726832010465435091355394125E-6
#define TANH_TAY17 4.294911078273805854820351280397E-7
/*
* FUNCTION
* vector double _tanhd2(vector double x)
*
* DESCRIPTION
* The _tanhd2 function computes the hyperbolic tangent for each
* element of the input vector.
*
* We use the following to approximate tanh:
*
* |x| <= .25: Taylor Series
* |x| > .25: tanh(x) = (exp(2x) - 1)/(exp(2x) + 1)
*
*
* SPECIAL CASES:
* - tanh(+/- 0) = +/-0
* - tanh(+/- infinity) = +/- 1
* - tanh(NaN) = NaN
*
*/
static __inline vector double _tanhd2(vector double x)
{
vector double signbit = spu_splats(-0.0);
vector double oned = spu_splats(1.0);
vector double twod = spu_splats(2.0);
vector double infd = (vector double)spu_splats(0x7FF0000000000000ull);
vector double xabs;
vector double x2;
vector unsigned long long gttaylor;
vector double e;
vector double tresult;
vector double eresult;
vector double result;
xabs = spu_andc(x, signbit);
/*
* This is where we switch from Taylor Series
* to exponential formula.
*/
gttaylor = spu_cmpgt(xabs, spu_splats(0.25));
/*
* Taylor Series Approximation
*/
x2 = spu_mul(x,x);
tresult = spu_madd(x2, spu_splats(TANH_TAY11), spu_splats(TANH_TAY10));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY09));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY08));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY07));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY06));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY05));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY04));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY03));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY02));
tresult = spu_madd(x2, tresult, spu_splats(TANH_TAY01));
tresult = spu_mul(xabs, tresult);
/*
* Exponential Formula
* Our expd2 function gives a more accurate result in general
* with xabs instead of x for x<0. We correct for sign later.
*/
e = _expd2(spu_mul(xabs, twod));
eresult = _divd2(spu_sub(e, oned), spu_add(e, oned));
/*
* Select Taylor or exp result.
*/
result = spu_sel(tresult, eresult, gttaylor);
/*
* Inf and NaN special cases. NaN is already in result
* for x = NaN.
*/
result = spu_sel(result, oned, spu_cmpeq(xabs, infd));
/*
* Antisymmetric function - preserve sign bit of x
* in the result.
*/
result = spu_sel(result, x, (vec_ullong2)signbit);
return result;
}
#endif /* _TANHD2_H_ */
#endif /* __SPU__ */
| 38.679012 | 75 | 0.610756 |
655b0d3ce62f35b9fa0c3c9376b29b6f90f41b4a | 958 | c | C | libft/ft_putchar.c | VincentMatthys/42_GNL | a5c1dd566a6bd7c67b7b352f50dfb1a94a1273ac | [
"MIT"
] | null | null | null | libft/ft_putchar.c | VincentMatthys/42_GNL | a5c1dd566a6bd7c67b7b352f50dfb1a94a1273ac | [
"MIT"
] | 1 | 2017-08-02T07:27:03.000Z | 2017-08-05T20:55:35.000Z | libft/ft_putchar.c | VincentMatthys/42_GNL | a5c1dd566a6bd7c67b7b352f50dfb1a94a1273ac | [
"MIT"
] | 2 | 2017-08-09T08:35:10.000Z | 2019-05-14T22:27:28.000Z | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmatthys <vmatthys@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/05 21:35:27 by vmatthys #+# #+# */
/* Updated: 2016/11/08 09:11:44 by vmatthys ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putchar(char c)
{
write(1, &c, 1);
}
| 50.421053 | 80 | 0.150313 |
656a34a34711393432c713cab2439bf2e1e67398 | 230 | c | C | openbsd/sys/xfs/xfs_syscalls-dummy.c | MarginC/kame | 2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30 | [
"BSD-3-Clause"
] | 91 | 2015-01-05T15:18:31.000Z | 2022-03-11T16:43:28.000Z | openbsd/sys/xfs/xfs_syscalls-dummy.c | MarginC/kame | 2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30 | [
"BSD-3-Clause"
] | 1 | 2016-02-25T15:57:55.000Z | 2016-02-25T16:01:02.000Z | openbsd/sys/xfs/xfs_syscalls-dummy.c | MarginC/kame | 2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30 | [
"BSD-3-Clause"
] | 21 | 2015-02-07T08:23:07.000Z | 2021-12-14T06:01:49.000Z | /*
* This code released into public domain by Artur Grabowski <art@openbsd.org>
*/
#include <xfs/xfs_locl.h>
#include <sys/syscallargs.h>
int
sys_xfspioctl(struct proc *proc, void *varg, register_t *retval)
{
return ENOSYS;
}
| 19.166667 | 77 | 0.730435 |
805e3a5799e73c506c5267bf7a19ec236e27087a | 19,852 | h | C | NeoML/include/NeoML/FineObjLite/ArrayFOL.h | zimka/neoml | 853e6f7d593949bf7e9dfaffd412b405fad32029 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2021-05-30T09:19:35.000Z | 2021-05-30T09:19:35.000Z | NeoML/include/NeoML/FineObjLite/ArrayFOL.h | zimka/neoml | 853e6f7d593949bf7e9dfaffd412b405fad32029 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | NeoML/include/NeoML/FineObjLite/ArrayFOL.h | zimka/neoml | 853e6f7d593949bf7e9dfaffd412b405fad32029 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | /* Copyright © 2017-2020 ABBYY Production LLC
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.
--------------------------------------------------------------------------------------------------------------*/
#pragma once
#include "SortFOL.h"
#include "ArchiveFOL.h"
#include "ObjectFOL.h"
namespace FObj {
// Check if the type may be bitwise moved in memory
template<typename T>
struct IsMemmoveable {
static const bool Value =
sizeof(T) <= sizeof( void* ) || std::is_trivially_copyable<T>::value;
};
template<class T>
inline void ArrayMemMoveElement( T* dest, T* source );
// The template function used by CArray to move elements in the buffer
// It uses the copy constructor
template<class T>
inline void ArrayMemMove( T* dest, T* source, int count )
{
if( dest > source ) {
for( int i = count - 1; i >= 0; i-- ) {
ArrayMemMoveElement( dest + i, source + i );
}
} else {
for( int i = 0; i < count; i++ ) {
ArrayMemMoveElement( dest + i, source + i );
}
}
}
template<class T>
inline void ArrayMemMoveElement( T* dest, T* source )
{
PresumeFO( dest != source );
::new( dest ) T( *source );
source->~T();
}
template<class T>
inline void ArrayMemMoveBitwize( T* dest, T* source, int count )
{
::memmove( reinterpret_cast<char*>( dest ), reinterpret_cast<char*>( source ), count * sizeof( T ) );
}
/*
// Specialized IsMemmoveable to indicate that CArray can be moved in memory
template<class T, class Allocator>
struct IsMemmoveable< CArray<T, Allocator> > {
static const bool Value = true;
};
*/
// Array template. Elements are added with the help of copy constructor
// When elements are deleted their destructors are called
template<class T, class Allocator = CurrentMemoryManager>
class CArray {
struct CDataHolder {
CDataHolder( const T& data ) : Data( data ) {}
~CDataHolder() {}
T Data;
};
struct CDataHolderExt {
CDataHolderExt() {}
T Data;
};
public:
typedef T TElement;
typedef Allocator AllocatorType;
CArray();
CArray( std::initializer_list<T> list );
~CArray() { FreeBuffer(); }
CArray& operator=( std::initializer_list<T> list );
// The number of elements in the array
int Size() const;
// Gets the size of the current memory buffer for the array, in terms of elements
// Buffer size may be greater than array size
int BufferSize() const;
// Returns true if there are no elements in the array
bool IsEmpty() const { return Size() == 0; }
void Empty() { DeleteAll(); }
// Returns the pointer to the first element in the array
// If the array is empty, 0 is returned
T* GetPtr();
const T* GetPtr() const;
// Returns the pointer to the first element in the array
T* GetBufferPtr() { return reinterpret_cast<T*>( dataPtr ); }
const T* GetBufferPtr() const { return reinterpret_cast<T*>( dataPtr ); }
// Accessing elements by index
const T& operator [] ( int location ) const;
T& operator [] ( int location );
// Gets the last element in the array
const T& Last() const;
T& Last();
// Gets the first element in the array
const T& First() const;
T& First();
// Checks if an index is valid for this array
bool IsValidIndex( int index ) const;
// Sets the buffer size, in terms of elements
// You may only increase the size with this method
void SetBufferSize( int nElements );
// Grows the buffer size according to the growth policy
void Grow( int newSize ) { grow( newSize ); }
// Sets the array size
void SetSize( int newSize );
// Adds elements to the end of the array. Copy constructor is used
void Add( const T& anElem );
void Add( const T& anElem, int count ) { InsertAt( anElem, Size(), count ); }
void Add( const CArray& ar ) { InsertAt( ar, Size() ); }
void Add( std::initializer_list<T> list ) { InsertAt( list, Size() ); }
// Adds an "empty" element to the end of the array
T& Append() { SetSize( Size() + 1 ); return Last(); }
// Inserts an element into the given position in the array (including the last)
// Copy constructor is used
void InsertAt( const T& what, int location );
void InsertAt( const T& what, int location, int count );
void InsertAt( const CArray& what, int location );
void InsertAt( std::initializer_list<T> list, int location );
// Replaces an element in the array. The old element is deleted using its destructor
// The new element is copied into the array using the copy constructor
void ReplaceAt( const T& newElem, int location );
// Deletes elements from the array. Their destructors will be called
// The buffer size does not decrease when deleting
void DeleteAt( int location, int num = 1 );
// Deletes the last element in the array
// presume is used to check if the element is there
void DeleteLast();
// Deletes all elements from the array. Their destructors will be called
// The array buffer is not cleared when deleting
void DeleteAll();
// Deletes all element from the array and clears the array buffer
// The destructors will be called for all elements
void FreeBuffer();
// Copies the array into another array. The original elements of the target array are deleted
void CopyTo( CArray& dest ) const;
// Moves the array into another array. The original elements of the target array are deleted
void MoveTo( CArray& dest );
// Checking if the arrays are equal
bool operator==( const CArray& other ) const;
bool operator!=( const CArray& other ) const;
// Linear search in the array. Operator == is used for comparison
int Find( const T& what, int startPos = 0 ) const;
// Checks if the array contains the specified element. Uses linear search and comparison operator
bool Has( const T& what ) const { return Find( what ) != NotFound; }
// Sorts the array with the help of comparison class (see AscendingFOL.h, DescendingFOL.h for examples)
template<class COMPARE>
void QuickSort( COMPARE* param );
template<class COMPARE>
void QuickSort();
// Checks if the array is sorted
template<class COMPARE>
bool IsSorted( COMPARE* compare ) const;
template<class COMPARE>
bool IsSorted() const;
// Binary searches for the correct position to insert an element into the sorted array
template<class COMPARE, class SEARCHED_TYPE>
int FindInsertionPoint( const SEARCHED_TYPE& what, COMPARE* param ) const;
template<class COMPARE, class SEARCHED_TYPE>
int FindInsertionPoint( const SEARCHED_TYPE& what ) const;
void Serialize( CArchive& );
private:
int size;
int bufferSize;
CDataHolder* dataPtr;
void growAt( int location, int newSize );
void grow( int newSize );
void reallocateBuffer( int newSize );
static void moveData( CDataHolder* destDataPtr, int destIndex, CDataHolder* srcDataPtr, int srcIndex, int count );
CArray( const CArray& );
CArray& operator=( const CArray& );
};
template<class T, class Allocator>
inline CArray<T, Allocator>::CArray() :
size( 0 ),
bufferSize( 0 ),
dataPtr( 0 )
{
static_assert( sizeof( T ) == sizeof( CDataHolder ), "sizeof( T ) != sizeof( CDataHolder )" );
}
template<class T, class Allocator>
inline CArray<T, Allocator>::CArray( std::initializer_list<T> list ) :
CArray()
{
Add( list );
}
template<class T, class Allocator>
inline CArray<T, Allocator>& CArray<T, Allocator>::operator=( std::initializer_list<T> list )
{
DeleteAll();
Add( list );
return *this;
}
template<class T, class Allocator>
inline int CArray<T, Allocator>::Size() const
{
return size;
}
template<class T, class Allocator>
inline int CArray<T, Allocator>::BufferSize() const
{
return bufferSize;
}
template<class T, class Allocator>
inline T* CArray<T, Allocator>::GetPtr()
{
if( Size() == 0 ) {
return 0;
}
return ( T* )dataPtr;
}
template<class T, class Allocator>
inline const T* CArray<T, Allocator>::GetPtr() const
{
if( Size() == 0 ) {
return 0;
}
return ( const T* )dataPtr;
}
template<class T, class Allocator>
inline const T& CArray<T, Allocator>::operator [] ( int location ) const
{
PresumeFO( location >= 0 );
PresumeFO( location < size );
return dataPtr[location].Data;
}
template<class T, class Allocator>
inline T& CArray<T, Allocator>::operator [] ( int location )
{
PresumeFO( location >= 0 );
PresumeFO( location < size );
return dataPtr[location].Data;
}
template<class T, class Allocator>
inline const T& CArray<T, Allocator>::Last() const
{
PresumeFO( size > 0 );
return dataPtr[size - 1].Data;
}
template<class T, class Allocator>
inline T& CArray<T, Allocator>::Last()
{
PresumeFO( size > 0 );
return dataPtr[size - 1].Data;
}
template<class T, class Allocator>
inline const T& CArray<T, Allocator>::First() const
{
PresumeFO( size > 0 );
return dataPtr[0].Data;
}
template<class T, class Allocator>
inline T& CArray<T, Allocator>::First()
{
PresumeFO( size > 0 );
return dataPtr[0].Data;
}
template<class T, class Allocator>
inline bool CArray<T, Allocator>::IsValidIndex( int index ) const
{
return index >= 0 && index < size;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::SetBufferSize( int newSize )
{
PresumeFO( newSize >= 0 );
if( newSize > bufferSize ) {
reallocateBuffer( newSize );
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::SetSize( int newSize )
{
PresumeFO( newSize >= 0 );
for( int index = newSize; index < size; index++ ) {
dataPtr[index].~CDataHolder();
}
grow( newSize );
for( int i = size; i < newSize; i++ ) {
::new( &dataPtr[i] ) CDataHolderExt();
}
size = newSize;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::Add( const T& what )
{
// The elements from the same array may not be inserted
PresumeFO( dataPtr == 0 || AddressOfObject( what ) < ( T* )dataPtr || AddressOfObject( what ) >= ( T* )( dataPtr + size ) );
PresumeFO( size <= bufferSize );
if( size + 1 > bufferSize ) {
grow( size + 1 );
}
::new( ( void* )&dataPtr[size] ) CDataHolder( what );
size++;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::InsertAt( const T& what, int location )
{
PresumeFO( location >= 0 );
PresumeFO( location <= size );
// The elements from the same array may not be inserted
PresumeFO( dataPtr == 0 || AddressOfObject( what ) < ( T* )dataPtr || AddressOfObject( what ) >= ( T* )( dataPtr + size ) );
growAt( location, size + 1 );
::new( ( void* )&dataPtr[location] ) CDataHolder( what );
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::InsertAt( const T& what, int location, int count )
{
PresumeFO( location >= 0 );
PresumeFO( location <= size );
PresumeFO( count >= 0 );
// The elements from the same array may not be inserted
PresumeFO( dataPtr == 0 || AddressOfObject( what ) < ( T* )dataPtr || AddressOfObject( what ) >= ( T* )( dataPtr + size ) );
if( count > 0 ) {
growAt( location, size + count );
for( int i = 0; i < count; i++ ) {
::new( ( void* )&dataPtr[location + i] ) CDataHolder( what );
}
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::InsertAt( const CArray<T, Allocator>& what, int location )
{
PresumeFO( location >= 0 );
PresumeFO( location <= size );
PresumeFO( &what != this );
if( what.Size() > 0 ) {
growAt( location, size + what.Size() );
for( int i = 0; i < what.Size(); i++ ) {
::new( &dataPtr[location + i] ) CDataHolder( what[i] );
}
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::InsertAt( std::initializer_list<T> list, int location )
{
PresumeFO( location >= 0 );
PresumeFO( location <= size );
const int listSize = to<int>( list.size() );
if( listSize > 0 ) {
growAt( location, size + listSize );
int pos = location;
for( const T& element : list ) {
::new( &dataPtr[pos] ) CDataHolder( element );
pos++;
}
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::ReplaceAt( const T& newElem, int location )
{
PresumeFO( location >= 0 );
PresumeFO( location < size );
PresumeFO( AddressOfObject( newElem ) != AddressOfObject( dataPtr[location].Data ) );
dataPtr[location].~CDataHolder();
::new( &dataPtr[location] ) CDataHolder( newElem );
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::DeleteAt( int location, int num )
{
PresumeFO( num >= 0 );
PresumeFO( num <= size );
PresumeFO( location >= 0 );
PresumeFO( location <= size - num );
if( num == 0 ) {
return;
}
for( int index = location + num - 1; index >= location; index-- ) {
dataPtr[index].~CDataHolder();
}
moveData( dataPtr, location, dataPtr, location + num, size - location - num );
size -= num;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::DeleteLast()
{
PresumeFO( size > 0 );
dataPtr[size - 1].~CDataHolder();
size--;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::DeleteAll()
{
for( int index = size - 1; index >= 0; index-- ) {
dataPtr[index].~CDataHolder();
}
size = 0;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::FreeBuffer()
{
DeleteAll();
CDataHolder* oldDataPtr = dataPtr;
dataPtr = 0;
if( oldDataPtr != 0 ) {
Allocator::Free( oldDataPtr );
}
bufferSize = 0;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::CopyTo( CArray<T, Allocator>& dest ) const
{
if( &dest == this ) {
return;
}
dest.DeleteAll();
dest.SetBufferSize( size );
dest.size = size;
for( int i = 0; i < size; i++ ) {
::new( &dest.dataPtr[i] ) CDataHolder( dataPtr[i] );
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::MoveTo( CArray<T, Allocator>& dest )
{
if( &dest == this ) {
return;
}
dest.FreeBuffer();
dest.dataPtr = dataPtr;
dest.bufferSize = bufferSize;
dest.size = size;
dataPtr = 0;
bufferSize = 0;
size = 0;
}
template<class T, class Allocator>
inline bool CArray<T, Allocator>::operator==( const CArray& other ) const
{
if( this == &other ) {
return true;
}
if( Size() != other.Size() ) {
return false;
}
for( int i = 0; i < Size(); i++ ) {
if( !( (*this)[i] == other[i] ) ) {
return false;
}
}
return true;
}
template<class T, class Allocator>
inline bool CArray<T, Allocator>::operator!=( const CArray& other ) const
{
return !( *this == other );
}
template<class T, class Allocator>
inline int CArray<T, Allocator>::Find( const T& what, int startPos ) const
{
PresumeFO( startPos >= 0 );
for( int i = startPos; i < Size(); i++ ) {
if( what == ( *this )[i] ) {
return i;
}
}
return NotFound;
}
template<class T, class Allocator> template<class COMPARE>
inline void CArray<T, Allocator>::QuickSort( COMPARE* param )
{
FObj::QuickSort<T, COMPARE>( GetPtr(), Size(), param );
}
template<class T, class Allocator> template<class COMPARE>
inline void CArray<T, Allocator>::QuickSort()
{
FObj::QuickSort<T, COMPARE>( GetPtr(), Size() );
}
template<class T, class Allocator> template<class COMPARE>
inline bool CArray<T, Allocator>::IsSorted( COMPARE* compare ) const
{
return FObj::IsSorted<T, COMPARE>( GetPtr(), Size(), compare );
}
template<class T, class Allocator> template<class COMPARE>
inline bool CArray<T, Allocator>::IsSorted() const
{
return FObj::IsSorted<T, COMPARE>( GetPtr(), Size() );
}
template<class T, class Allocator> template<class COMPARE, class SEARCHED_TYPE>
inline int CArray<T, Allocator>::FindInsertionPoint( const SEARCHED_TYPE& what, COMPARE* param ) const
{
return FObj::FindInsertionPoint<T, COMPARE, SEARCHED_TYPE>( what, GetPtr(), Size(), param );
}
template<class T, class Allocator> template<class COMPARE, class SEARCHED_TYPE>
inline int CArray<T, Allocator>::FindInsertionPoint( const SEARCHED_TYPE& what ) const
{
return FObj::FindInsertionPoint<T, COMPARE, SEARCHED_TYPE>( what, GetPtr(), Size() );
}
//----------------------------------------------------------------------------------------------
static const int MinBufferGrowSize = 8;
template<class T, class Allocator>
inline void CArray<T, Allocator>::moveData( typename CArray<T, Allocator>::CDataHolder* destDataPtr, int destIndex,
typename CArray<T, Allocator>::CDataHolder* srcDataPtr, int srcIndex, int count )
{
if( count > 0 ) {
if( IsMemmoveable<T>::Value ) {
ArrayMemMoveBitwize( AddressOfObject( destDataPtr[destIndex].Data ),
AddressOfObject( srcDataPtr[srcIndex].Data ), count );
} else {
ArrayMemMove( AddressOfObject( destDataPtr[destIndex].Data ),
AddressOfObject( srcDataPtr[srcIndex].Data ), count );
}
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::growAt( int location, int newSize )
{
PresumeFO( newSize > size );
PresumeFO( location <= size );
if( newSize > bufferSize ) {
grow( newSize );
}
if( location != size ) {
moveData( dataPtr, location + newSize - size, dataPtr, location, size - location );
}
size = newSize;
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::grow( int newSize )
{
PresumeFO( newSize >= 0 );
if( newSize > bufferSize ) {
int delta = min( max( newSize - bufferSize, max( bufferSize / 2, MinBufferGrowSize ) ), INT_MAX - bufferSize );
reallocateBuffer( bufferSize + delta );
}
}
template<class T, class Allocator>
inline void CArray<T, Allocator>::reallocateBuffer( int newSize )
{
PresumeFO( newSize > 0 );
PresumeFO( newSize >= size );
CDataHolder* oldDataPtr = dataPtr;
AssertFO( static_cast<size_t>( newSize ) <= UINTPTR_MAX / sizeof( CDataHolder ) );
dataPtr = static_cast<CDataHolder*>( ALLOCATE_MEMORY( Allocator, newSize * sizeof( CDataHolder ) ) );
moveData( dataPtr, 0, oldDataPtr, 0, size );
if( oldDataPtr != 0 ) {
Allocator::Free( oldDataPtr );
}
bufferSize = newSize;
}
//------------------------------------------------------------------------------------------------------------
// Serialization
template<class T, class Allocator>
inline void CArray<T, Allocator>::Serialize( CArchive& arch )
{
if( arch.IsLoading() ) {
DeleteAll();
unsigned int nElems;
arch >> nElems;
check( static_cast<int>( nElems ) >= 0, ERR_BAD_ARCHIVE, arch.Name() );
SetBufferSize( nElems );
SetSize( nElems );
for( int i = 0; i < static_cast<int>( nElems ); i++ ) {
arch >> ( *this )[i];
}
} else {
arch << static_cast<unsigned int>( Size() );
for( int i = 0; i < Size(); i++ ) {
arch << ( *this )[i];
}
}
}
template<class T, class Allocator>
inline CArchive& operator>>( CArchive& archive, CArray<T, Allocator>& arr )
{
arr.Serialize( archive );
return archive;
}
template<class T, class Allocator>
inline CArchive& operator<<( CArchive& archive, const CArray<T, Allocator>& arr )
{
const_cast<CArray<T, Allocator>&>( arr ).Serialize( archive );
return archive;
}
//------------------------------------------------------------------------------------------------------
// Objects array
template<class T, class Allocator = CurrentMemoryManager>
class CObjectArray : public CArray< CPtr<T>, Allocator > {
public:
CObjectArray() {}
};
//---------------------------------------------------------------------------------------------------
// Specialized ArrayMemMove for the types that may be bitwise moved in memory
template<class T, class Allocator>
inline void ArrayMemMove( CArray<T, Allocator>* dest, CArray<T, Allocator>* source, int count )
{
ArrayMemMoveBitwize( dest, source, count );
}
inline void ArrayMemMove( double* dest, double* source, int count )
{
ArrayMemMoveBitwize( dest, source, count );
}
inline void ArrayMemMove( __int64* dest, __int64* source, int count )
{
ArrayMemMoveBitwize( dest, source, count );
}
} // namespace FineObjects
| 28.079208 | 125 | 0.67026 |
a26127b213993c16687c7dcc1531213286af794e | 15,074 | h | C | include/drivers/video.h | markus-becker-tridonic-com/sdk-zephyr | 332206bcad13edffb14f0de684b62b795b871903 | [
"Apache-2.0"
] | 4 | 2020-10-14T11:21:36.000Z | 2020-11-24T15:20:24.000Z | include/drivers/video.h | markus-becker-tridonic-com/sdk-zephyr | 332206bcad13edffb14f0de684b62b795b871903 | [
"Apache-2.0"
] | 1 | 2020-11-13T15:45:36.000Z | 2020-11-23T10:37:50.000Z | include/drivers/video.h | markus-becker-tridonic-com/sdk-zephyr | 332206bcad13edffb14f0de684b62b795b871903 | [
"Apache-2.0"
] | null | null | null | /**
* @file
*
* @brief Public APIs for Video.
*/
/*
* Copyright (c) 2019 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_VIDEO_H_
#define ZEPHYR_INCLUDE_VIDEO_H_
/**
* @brief Video Interface
* @defgroup video_interface Video Interface
* @ingroup io_interfaces
* @{
*/
#include <device.h>
#include <stddef.h>
#include <zephyr.h>
#include <zephyr/types.h>
#include <drivers/video-controls.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief video format structure
*
* Used to configure frame format.
*
* @param pixelformat is the fourcc pixel format value.
* @param width is the frame width in pixels.
* @param height is the frame height in pixels.
* @param pitch is the line stride, the number of bytes that needs to be added
* to the address in the first pixel of a row in order to go to the address
* of the first pixel of the next row (>=width).
*/
struct video_format {
uint32_t pixelformat;
uint32_t width;
uint32_t height;
uint32_t pitch;
};
/**
* @brief video format capability
*
* Used to describe a video endpoint format capability.
*
* @param pixelformat is a list of supported pixel formats (0 terminated).
* @param width_min is the minimum supported frame width.
* @param width_max is the maximum supported frame width.
* @param height_min is the minimum supported frame width.
* @param height_max is the maximum supported frame width.
* @param width_step is the width step size.
* @param height_step is the height step size.
*/
struct video_format_cap {
uint32_t pixelformat;
uint32_t width_min;
uint32_t width_max;
uint32_t height_min;
uint32_t height_max;
uint16_t width_step;
uint16_t height_step;
};
/**
* @brief video capabilities
*
* Used to describe video endpoint capabilities.
*
* @param format_caps is a list of video format capabilities (zero terminated).
* @param min_vbuf_count is the minimal count of video buffers to enqueue
* before being able to start the stream.
*/
struct video_caps {
const struct video_format_cap *format_caps;
uint8_t min_vbuf_count;
};
/**
* @brief video buffer structure
*
* Represent a video frame.
*
* @param driver_data is a pointer to driver specific data.
* @param buffer is a pointer to the start of the buffer.
* @param size is the size in bytes of the buffer.
* @param bytesused is the number of bytes occupied by the valid data in
* the buffer.
* @param timestamp is a time reference in milliseconds at which the last data
* byte was actually received for input endpoints or to be consumed for
* output endpoints.
*/
struct video_buffer {
void *driver_data;
uint8_t *buffer;
uint32_t size;
uint32_t bytesused;
uint32_t timestamp;
};
/**
* @brief video_endpoint_id enum
* Identify the video device endpoint.
*/
enum video_endpoint_id {
VIDEO_EP_NONE,
VIDEO_EP_ANY,
VIDEO_EP_IN,
VIDEO_EP_OUT,
};
/**
* @brief video_event enum
* Identify video event.
*/
enum video_signal_result {
VIDEO_BUF_DONE,
VIDEO_BUF_ABORTED,
VIDEO_BUF_ERROR,
};
/**
* @typedef video_api_set_format_t
* @brief Set video format
* See video_set_format() for argument descriptions.
*/
typedef int (*video_api_set_format_t)(struct device *dev,
enum video_endpoint_id ep,
struct video_format *fmt);
/**
* @typedef video_api_get_format_t
* @brief get current video format
* See video_get_format() for argument descriptions.
*/
typedef int (*video_api_get_format_t)(struct device *dev,
enum video_endpoint_id ep,
struct video_format *fmt);
/**
* @typedef video_api_enqueue_t
* @brief Enqueue a buffer in the driver’s incoming queue.
* See video_enqueue() for argument descriptions.
*/
typedef int (*video_api_enqueue_t)(struct device *dev,
enum video_endpoint_id ep,
struct video_buffer *buf);
/**
* @typedef video_api_dequeue_t
* @brief Dequeue a buffer from the driver’s outgoing queue.
* See video_dequeue() for argument descriptions.
*/
typedef int (*video_api_dequeue_t)(struct device *dev,
enum video_endpoint_id ep,
struct video_buffer **buf,
k_timeout_t timeout);
/**
* @typedef video_api_flush_t
* @brief Flush endpoint buffers, buffer are moved from incoming queue to
* outgoing queue.
* See video_flush() for argument descriptions.
*/
typedef int (*video_api_flush_t)(struct device *dev,
enum video_endpoint_id ep,
bool cancel);
/**
* @typedef video_api_stream_start_t
* @brief Start the capture or output process.
* See video_stream_start() for argument descriptions.
*/
typedef int (*video_api_stream_start_t)(struct device *dev);
/**
* @typedef video_api_stream_stop_t
* @brief Stop the capture or output process.
* See video_stream_stop() for argument descriptions.
*/
typedef int (*video_api_stream_stop_t)(struct device *dev);
/**
* @typedef video_api_set_ctrl_t
* @brief set a video control value.
* See video_set_ctrl() for argument descriptions.
*/
typedef int (*video_api_set_ctrl_t)(struct device *dev, unsigned int cid,
void *value);
/**
* @typedef video_api_get_ctrl_t
* @brief get a video control value.
* See video_get_ctrl() for argument descriptions.
*/
typedef int (*video_api_get_ctrl_t)(struct device *dev, unsigned int cid,
void *value);
/**
* @typedef video_api_get_caps_t
* @brief Get capabilities of a video endpoint.
* See video_get_caps() for argument descriptions.
*/
typedef int (*video_api_get_caps_t)(struct device *dev,
enum video_endpoint_id ep,
struct video_caps *caps);
/**
* @typedef video_api_set_signal_t
* @brief Register/Unregister poll signal for buffer events.
* See video_set_signal() for argument descriptions.
*/
typedef int (*video_api_set_signal_t)(struct device *dev,
enum video_endpoint_id ep,
struct k_poll_signal *signal);
struct video_driver_api {
/* mandatory callbacks */
video_api_set_format_t set_format;
video_api_get_format_t get_format;
video_api_stream_start_t stream_start;
video_api_stream_stop_t stream_stop;
video_api_get_caps_t get_caps;
/* optional callbacks */
video_api_enqueue_t enqueue;
video_api_dequeue_t dequeue;
video_api_flush_t flush;
video_api_set_ctrl_t set_ctrl;
video_api_set_ctrl_t get_ctrl;
video_api_set_signal_t set_signal;
};
/**
* @brief Set video format.
*
* Configure video device with a specific format.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param fmt Pointer to a video format struct.
*
* @retval 0 Is successful.
* @retval -EINVAL If parameters are invalid.
* @retval -ENOTSUP If format is not supported.
* @retval -EIO General input / output error.
*/
static inline int video_set_format(struct device *dev,
enum video_endpoint_id ep,
struct video_format *fmt)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
__ASSERT(api->set_format, "set_format must be implemented by driver");
return api->set_format(dev, ep, fmt);
}
/**
* @brief Get video format.
*
* Get video device current video format.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param fmt Pointer to video format struct.
*
* @retval pointer to video format
*/
static inline int video_get_format(struct device *dev,
enum video_endpoint_id ep,
struct video_format *fmt)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
__ASSERT(api->get_format, "get_format must be implemented by driver");
return api->get_format(dev, ep, fmt);
}
/**
* @brief Enqueue a video buffer.
*
* Enqueue an empty (capturing) or filled (output) video buffer in the driver’s
* endpoint incoming queue.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param buf Pointer to the video buffer.
*
* @retval 0 Is successful.
* @retval -EINVAL If parameters are invalid.
* @retval -EIO General input / output error.
*/
static inline int video_enqueue(struct device *dev, enum video_endpoint_id ep,
struct video_buffer *buf)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->enqueue == NULL) {
return -ENOTSUP;
}
return api->enqueue(dev, ep, buf);
}
/**
* @brief Dequeue a video buffer.
*
* Dequeue a filled (capturing) or displayed (output) buffer from the driver’s
* enpoint outgoing queue.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param buf Pointer a video buffer pointer.
* @param timeout Timeout
*
* @retval 0 Is successful.
* @retval -EINVAL If parameters are invalid.
* @retval -EIO General input / output error.
*/
static inline int video_dequeue(struct device *dev, enum video_endpoint_id ep,
struct video_buffer **buf,
k_timeout_t timeout)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->dequeue == NULL) {
return -ENOTSUP;
}
return api->dequeue(dev, ep, buf, timeout);
}
/**
* @brief Flush endpoint buffers.
*
* A call to flush finishes when all endpoint buffers have been moved from
* incoming queue to outgoing queue. Either because canceled or fully processed
* through the video function.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param cancel If true, cancel buffer processing instead of waiting for
* completion.
*
* @retval 0 Is successful, -ERRNO code otherwise.
*/
static inline int video_flush(struct device *dev, enum video_endpoint_id ep,
bool cancel)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->flush == NULL) {
return -ENOTSUP;
}
return api->flush(dev, ep, cancel);
}
/**
* @brief Start the video device function.
*
* video_stream_start is called to enter ‘streaming’ state (capture, output...).
* The driver may receive buffers with video_enqueue() before video_stream_start
* is called. If driver/device needs a minimum number of buffers before being
* able to start streaming, then driver set the min_vbuf_count to the related
* endpoint capabilities.
*
* @retval 0 Is successful.
* @retval -EIO General input / output error.
*/
static inline int video_stream_start(struct device *dev)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
__ASSERT(api->stream_start,
"stream_start must be implemented by driver");
return api->stream_start(dev);
}
/**
* @brief Stop the video device function.
*
* On video_stream_stop, driver must stop any transactions or wait until they
* finish.
*
* @retval 0 Is successful.
* @retval -EIO General input / output error.
*/
static inline int video_stream_stop(struct device *dev)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
int ret;
__ASSERT(api->stream_stop,
"stream_stop must be implemented by driver");
ret = api->stream_stop(dev);
video_flush(dev, VIDEO_EP_ANY, true);
return ret;
}
/**
* @brief Get the capabilities of a video endpoint.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param caps Pointer to the video_caps struct to fill.
*
* @retval 0 Is successful, -ERRNO code otherwise.
*/
static inline int video_get_caps(struct device *dev,
enum video_endpoint_id ep,
struct video_caps *caps)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
__ASSERT(api->get_caps, "get_caps must be implemented by driver");
return api->get_caps(dev, ep, caps);
}
/**
* @brief Set the value of a control.
*
* This set the value of a video control, value type depends on control ID, and
* must be interpreted accordingly.
*
* @param dev Pointer to the device structure for the driver instance.
* @param cid Control ID.
* @param value Pointer to the control value.
*
* @retval 0 Is successful.
* @retval -EINVAL If parameters are invalid.
* @retval -ENOTSUP If format is not supported.
* @retval -EIO General input / output error.
*/
static inline int video_set_ctrl(struct device *dev, unsigned int cid,
void *value)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->set_ctrl == NULL) {
return -ENOTSUP;
}
return api->set_ctrl(dev, cid, value);
}
/**
* @brief Get the current value of a control.
*
* This retrieve the value of a video control, value type depends on control ID,
* and must be interpreted accordingly.
*
* @param dev Pointer to the device structure for the driver instance.
* @param cid Control ID.
* @param value Pointer to the control value.
*
* @retval 0 Is successful.
* @retval -EINVAL If parameters are invalid.
* @retval -ENOTSUP If format is not supported.
* @retval -EIO General input / output error.
*/
static inline int video_get_ctrl(struct device *dev, unsigned int cid,
void *value)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->get_ctrl == NULL) {
return -ENOTSUP;
}
return api->get_ctrl(dev, cid, value);
}
/**
* @brief Register/Unregister k_poll signal for a video endpoint.
*
* Register a poll signal to the endpoint, which will be signaled on frame
* completion (done, aborted, error). Registering a NULL poll signal
* unregisters any previously registered signal.
*
* @param dev Pointer to the device structure for the driver instance.
* @param ep Endpoint ID.
* @param signal Pointer to k_poll_signal
*
* @retval 0 Is successful, -ERRNO code otherwise.
*/
static inline int video_set_signal(struct device *dev,
enum video_endpoint_id ep,
struct k_poll_signal *signal)
{
const struct video_driver_api *api =
(const struct video_driver_api *)dev->api;
if (api->set_signal == NULL) {
return -ENOTSUP;
}
return api->set_signal(dev, ep, signal);
}
/**
* @brief Allocate video buffer.
*
* @param size Size of the video buffer.
*
* @retval pointer to allocated video buffer
*/
struct video_buffer *video_buffer_alloc(size_t size);
/**
* @brief Release a video buffer.
*
* @param buf Pointer to the video buffer to release.
*/
void video_buffer_release(struct video_buffer *buf);
/* fourcc - four-character-code */
#define video_fourcc(a, b, c, d)\
((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
/* Raw bayer formats */
#define VIDEO_PIX_FMT_BGGR8 video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */
#define VIDEO_PIX_FMT_GBRG8 video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
#define VIDEO_PIX_FMT_GRBG8 video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
#define VIDEO_PIX_FMT_RGGB8 video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
/* RGB formats */
#define VIDEO_PIX_FMT_RGB565 video_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* ZEPHYR_INCLUDE_VIDEO_H_ */
| 26.538732 | 87 | 0.715669 |
3191e84d0360b23effc76d01b9c8b1c5c3175bdc | 111 | c | C | no-strict/ErrLogicalANDExpression.c | silveira24/C-Parser | f3972a1e87963135a088b07b9e4d5ceb79aa6510 | [
"Apache-2.0"
] | null | null | null | no-strict/ErrLogicalANDExpression.c | silveira24/C-Parser | f3972a1e87963135a088b07b9e4d5ceb79aa6510 | [
"Apache-2.0"
] | null | null | null | no-strict/ErrLogicalANDExpression.c | silveira24/C-Parser | f3972a1e87963135a088b07b9e4d5ceb79aa6510 | [
"Apache-2.0"
] | null | null | null | int main() {
int a;
scanf("%/d", &a);
if (a < 3 && ) {
printf("esta no intervalo\n");
}
return 0;
}
| 8.538462 | 32 | 0.459459 |
4e5481161f4dcc0f6a89f2a211e861a35e684a1e | 290 | h | C | ds/stack.h | tornado80/pacman | 428ebd45671bc453aabe2b6afa38d55b988d7640 | [
"MIT"
] | 7 | 2020-06-08T11:25:16.000Z | 2022-03-09T17:03:12.000Z | ds/stack.h | tornado80/pacman | 428ebd45671bc453aabe2b6afa38d55b988d7640 | [
"MIT"
] | null | null | null | ds/stack.h | tornado80/pacman | 428ebd45671bc453aabe2b6afa38d55b988d7640 | [
"MIT"
] | 1 | 2021-10-02T14:51:11.000Z | 2021-10-02T14:51:11.000Z | struct stack_node {
int data;
struct stack_node * next;
};
typedef struct stack_node StackNode;
typedef StackNode* StackNodePtr;
int popStack (StackNodePtr* stackTopNodePtr);
void pushStack (StackNodePtr* stackTopNodePtr, int value);
int isStackEmpty(StackNodePtr stackTopNode);
| 24.166667 | 58 | 0.786207 |
034a07b9705c7bc08bdc8c539adaa09ec957f620 | 386 | c | C | 0x13-more_singly_linked_lists/4-free_listint.c | pxnmatz/holbertonschool-low_level_programming | 0e713d001f0a48fdbd315db7e17065e7d49fdb69 | [
"MIT"
] | 1 | 2021-04-04T18:12:16.000Z | 2021-04-04T18:12:16.000Z | 0x13-more_singly_linked_lists/4-free_listint.c | pxnmatz/holbertonschool-low_level_programming | 0e713d001f0a48fdbd315db7e17065e7d49fdb69 | [
"MIT"
] | null | null | null | 0x13-more_singly_linked_lists/4-free_listint.c | pxnmatz/holbertonschool-low_level_programming | 0e713d001f0a48fdbd315db7e17065e7d49fdb69 | [
"MIT"
] | null | null | null | #include "lists.h"
/**
* free_listint - frees a listint_t list.
* @head: pointer to the list.
**/
void free_listint(listint_t *head)
{
listint_t *actual_node;
listint_t *next_node;
if (head)
{
actual_node = head;
next_node = head->next;
while (next_node)
{
free(actual_node);
actual_node = next_node;
next_node = next_node->next;
}
free(actual_node);
}
}
| 15.44 | 41 | 0.660622 |
c14ecea8c1a691662af3d03e981adfaca4017f9e | 749 | h | C | docs/docsets/FWApplication.docset/Contents/Resources/Documents/FWApplication/UILabel+FWApplication.h | lszzy/FWApplication | e81feebdfe9b49fcb42a10da030d3ae90d01ddd1 | [
"MIT"
] | 1 | 2021-09-26T05:36:16.000Z | 2021-09-26T05:36:16.000Z | FWApplication/Classes/FWApplication/View/Extension/UILabel+FWApplication.h | lszzy/FWApplication | e81feebdfe9b49fcb42a10da030d3ae90d01ddd1 | [
"MIT"
] | null | null | null | FWApplication/Classes/FWApplication/View/Extension/UILabel+FWApplication.h | lszzy/FWApplication | e81feebdfe9b49fcb42a10da030d3ae90d01ddd1 | [
"MIT"
] | 1 | 2022-01-07T08:10:16.000Z | 2022-01-07T08:10:16.000Z | /**
@header UILabel+FWApplication.h
@indexgroup FWApplication
UILabel+FWApplication
@author wuyong
@copyright Copyright © 2018 wuyong.site. All rights reserved.
@updated 2018/10/22
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
UILabel+FWApplication
@note 注意UILabel的lineBreakMode默认值为TruncatingTail,如设置numberOfLines为0时,需显示修改lineBreakMode值;
自动布局时,可设置preferredMaxLayoutWidth,从而通过intrinsicContentSize获取多行Label的高度
*/
@interface UILabel (FWApplication)
#pragma mark - Size
// 计算当前文本所占尺寸,需frame或者宽度布局完整
@property (nonatomic, assign, readonly) CGSize fwTextSize;
// 计算当前属性文本所占尺寸,需frame或者宽度布局完整,attributedText需指定字体
@property (nonatomic, assign, readonly) CGSize fwAttributedTextSize;
@end
NS_ASSUME_NONNULL_END
| 23.40625 | 89 | 0.795728 |
1870efbf84d6e51844d38840460df4bf1f893054 | 244 | h | C | KidsTC/KidsTC/Business/Main/UserCenter/Order/OrderBooking/OrderBooking/V/OrderBookingStoreInfoCell.h | zhpigh/KidsTC_Objective-C | ef095ae4d7fd7c3a69565ba5f0eb44f9e93e40b6 | [
"MIT"
] | null | null | null | KidsTC/KidsTC/Business/Main/UserCenter/Order/OrderBooking/OrderBooking/V/OrderBookingStoreInfoCell.h | zhpigh/KidsTC_Objective-C | ef095ae4d7fd7c3a69565ba5f0eb44f9e93e40b6 | [
"MIT"
] | null | null | null | KidsTC/KidsTC/Business/Main/UserCenter/Order/OrderBooking/OrderBooking/V/OrderBookingStoreInfoCell.h | zhpigh/KidsTC_Objective-C | ef095ae4d7fd7c3a69565ba5f0eb44f9e93e40b6 | [
"MIT"
] | 1 | 2018-09-18T07:26:36.000Z | 2018-09-18T07:26:36.000Z | //
// OrderBookingStoreInfoCell.h
// KidsTC
//
// Created by zhanping on 2016/9/19.
// Copyright © 2016年 zhanping. All rights reserved.
//
#import "OrderBookingBaseCell.h"
@interface OrderBookingStoreInfoCell : OrderBookingBaseCell
@end
| 17.428571 | 59 | 0.741803 |
4b4784337602f3a186ac467ba5f95bf41d691c85 | 25,179 | h | C | include/winapi/ntdef.h | GrieferAtWork/KOSmk2 | 446a982c7930eeb48710bcb234c4e4b15446b869 | [
"Zlib"
] | 1 | 2021-01-02T22:15:14.000Z | 2021-01-02T22:15:14.000Z | include/winapi/ntdef.h | GrieferAtWork/KOSmk2 | 446a982c7930eeb48710bcb234c4e4b15446b869 | [
"Zlib"
] | null | null | null | include/winapi/ntdef.h | GrieferAtWork/KOSmk2 | 446a982c7930eeb48710bcb234c4e4b15446b869 | [
"Zlib"
] | 1 | 2019-10-21T17:39:46.000Z | 2019-10-21T17:39:46.000Z | /*
* ntdef.h
*
* This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef _NTDEF_
#define _NTDEF_
#include "__winstd.h"
#if defined(__x86_64) && \
!(defined(_X86_) || defined(__i386__) || defined(_IA64_))
#if !defined(_AMD64_)
#define _AMD64_
#endif
#endif /* _AMD64_ */
#if defined(__ia64__) && \
!(defined(_X86_) || defined(__x86_64) || defined(_AMD64_))
#if !defined(_IA64_)
#define _IA64_
#endif
#endif /* _IA64_ */
/* Dependencies */
#include <ctype.h>
#include "basetsd.h"
#include "excpt.h"
#include "sdkddkver.h"
// FIXME: Shouldn't be included!
#include <stdarg.h>
#include <string.h>
/* Pseudo Modifiers for Input Parameters */
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#ifndef OPTIONAL
#define OPTIONAL
#endif
#ifndef NOTHING
#define NOTHING
#endif
#ifndef CRITICAL
#define CRITICAL
#endif
#ifndef FAR
#define FAR
#endif
/* Defines the "size" of an any-size array */
#ifndef ANYSIZE_ARRAY
#define ANYSIZE_ARRAY 1
#endif
/* Constant modifier */
#ifndef CONST
#define CONST const
#endif
/* TRUE/FALSE */
#define FALSE 0
#define TRUE 1
/* NULL/NULL64 */
#ifndef NULL
#ifdef __cplusplus
#ifndef _WIN64
#define NULL 0
#else
#define NULL 0LL
#endif /* W64 */
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#ifndef NULL64
#ifdef __cplusplus
#define NULL64 0LL
#else
#define NULL64 ((void * POINTER_64)0)
#endif
#endif /* NULL64 */
#undef UNALIGNED /* avoid redefinition warnings vs _mingw.h */
#undef UNALIGNED64
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
#define ALIGNMENT_MACHINE
#define UNALIGNED __unaligned
#if defined(_WIN64)
#define UNALIGNED64 __unaligned
#else
#define UNALIGNED64
#endif
#else
#undef ALIGNMENT_MACHINE
#define UNALIGNED
#define UNALIGNED64
#endif
#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
#define RESTRICTED_POINTER __restrict
#else
#define RESTRICTED_POINTER
#endif
#define ARGUMENT_PRESENT(ArgumentPointer) \
((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
/* Returns the base address of a structure from a structure member */
#ifndef CONTAINING_RECORD
#define CONTAINING_RECORD(address, type, field) \
((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
#endif
/* Returns the byte offset of the specified structure's member */
#ifndef FIELD_OFFSET
#ifndef __GNUC__
#define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
#else
#define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field)
#endif
#endif
/* Returns the type's alignment */
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#define TYPE_ALIGNMENT(t) __alignof(t)
#else
#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
#endif
/* Calling Conventions */
#if defined(_M_IX86)
#define FASTCALL __fastcall
#else
#define FASTCALL
#endif
#define NTAPI __stdcall
/* Import and Export Specifiers */
/* Done the same way as in windef.h for now */
#ifndef DECLSPEC_IMPORT
#define DECLSPEC_IMPORT __declspec(dllimport)
#endif /* !DECLSPEC_IMPORT */
#ifndef DECLSPEC_NORETURN
#define DECLSPEC_NORETURN __declspec(noreturn)
#endif /* !DECLSPEC_NORETURN */
#ifndef DECLSPEC_ADDRSAFE
#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
#define DECLSPEC_ADDRSAFE __declspec(address_safe)
#else
#define DECLSPEC_ADDRSAFE
#endif
#endif /* DECLSPEC_ADDRSAFE */
#if !defined(_NTSYSTEM_)
#define NTSYSAPI DECLSPEC_IMPORT
#define NTSYSCALLAPI DECLSPEC_IMPORT
#else
#define NTSYSAPI
#if defined(_NTDLLBUILD_)
#define NTSYSCALLAPI
#else
#define NTSYSCALLAPI DECLSPEC_ADDRSAFE
#endif
#endif
/* Inlines */
#ifndef FORCEINLINE
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#define FORCEINLINE __forceinline
#elif defined(_MSC_VER)
#define FORCEINLINE __inline
#else /* __GNUC__ */
#define FORCEINLINE extern __inline__ __attribute__((always_inline))
#endif
#endif /* FORCEINLINE */
#ifndef DECLSPEC_NOINLINE
#if (_MSC_VER >= 1300)
#define DECLSPEC_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
#define DECLSPEC_NOINLINE __attribute__((noinline))
#else
#define DECLSPEC_NOINLINE
#endif
#endif /* DECLSPEC_NOINLINE */
#if !defined(_M_CEE_PURE)
#define NTAPI_INLINE NTAPI
#else
#define NTAPI_INLINE
#endif
/* Use to specify structure alignment */
#ifndef DECLSPEC_ALIGN
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
#define DECLSPEC_ALIGN(x) __declspec(align(x))
#elif defined(__GNUC__)
#define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__ (x)))
#else
#define DECLSPEC_ALIGN(x)
#endif
#endif /* DECLSPEC_ALIGN */
/* Use to silence unused variable warnings when it is intentional */
#ifndef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(P) {(P) = (P);}
#endif /* !UNREFERENCED_PARAMETER */
#ifndef UNREFERENCED_LOCAL_VARIABLE
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L) = (L);}
#endif /* !UNREFERENCED_LOCAL_VARIABLE */
#ifndef DBG_UNREFERENCED_PARAMETER
#define DBG_UNREFERENCED_PARAMETER(P) (P)
#endif /* !DBG_UNREFERENCED_PARAMETER */
#ifndef DBG_UNREFERENCED_LOCAL_VARIABLE
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) (L)
#endif /* !DBG_UNREFERENCED_LOCAL_VARIABLE */
/* min/max helper macros */
#ifndef NOMINMAX
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#endif /* NOMINMAX */
/* Tell windef.h that we have defined some basic types */
#define BASETYPES
/* Void Pointers */
typedef void *PVOID;
typedef void * POINTER_64 PVOID64;
/* Handle Type */
#ifdef STRICT
typedef void *HANDLE;
#ifndef DECLARE_HANDLE
#define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
#endif /* !DECLARE_HANDLE */
#else
typedef PVOID HANDLE;
#ifndef DECLARE_HANDLE
#define DECLARE_HANDLE(n) typedef HANDLE n
#endif /* !DECLARE_HANDLE */
#endif
typedef HANDLE *PHANDLE;
/* Upper-Case Versions of Some Standard C Types */
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#if !defined(MIDL_PASS)
typedef int INT;
#endif
#endif
typedef double DOUBLE;
/* Unsigned Types */
typedef unsigned char UCHAR, *PUCHAR;
typedef unsigned short USHORT, *PUSHORT;
typedef unsigned long ULONG, *PULONG;
typedef CONST UCHAR *PCUCHAR;
typedef CONST USHORT *PCUSHORT;
typedef CONST ULONG *PCULONG;
typedef UCHAR FCHAR;
typedef USHORT FSHORT;
typedef ULONG FLONG;
typedef UCHAR BOOLEAN, *PBOOLEAN;
typedef ULONG LOGICAL;
typedef ULONG *PLOGICAL;
/* Signed Types */
typedef SHORT *PSHORT;
typedef LONG *PLONG;
typedef LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
typedef signed char SCHAR;
typedef SCHAR *PSCHAR;
#ifndef _DEF_WINBOOL_
#define _DEF_WINBOOL_
typedef int WINBOOL;
#pragma push_macro("BOOL")
#undef BOOL
#if !defined(__OBJC__) && !defined(__OBJC_BOOL) && !defined(__objc_INCLUDE_GNU)
typedef WINBOOL BOOL;
#endif
#pragma pop_macro("BOOL")
typedef WINBOOL *PBOOL;
typedef WINBOOL *LPBOOL;
#endif /* _DEF_WINBOOL_ */
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef LONG HRESULT;
#endif
/* 64-bit types */
#define _ULONGLONG_
__MINGW_EXTENSION typedef __int64 LONGLONG, *PLONGLONG;
__MINGW_EXTENSION typedef unsigned __int64 ULONGLONG, *PULONGLONG;
#define _DWORDLONG_
typedef ULONGLONG DWORDLONG, *PDWORDLONG;
/* Update Sequence Number */
typedef LONGLONG USN;
/* ANSI (Multi-byte Character) types */
typedef CHAR *PCHAR, *LPCH, *PCH;
typedef CONST CHAR *LPCCH, *PCCH;
typedef CHAR *NPSTR, *LPSTR, *PSTR;
typedef PSTR *PZPSTR;
typedef CONST PSTR *PCZPSTR;
typedef CONST CHAR *LPCSTR, *PCSTR;
typedef PCSTR *PZPCSTR;
/* Pointer to an Asciiz string */
typedef CHAR *PSZ;
typedef CONST char *PCSZ;
/* UNICODE (Wide Character) types */
#ifndef __WCHAR_DEFINED
#define __WCHAR_DEFINED
typedef wchar_t WCHAR;
#endif
typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
typedef CONST WCHAR *LPCWCH, *PCWCH;
typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
typedef PWSTR *PZPWSTR;
typedef CONST PWSTR *PCZPWSTR;
typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
typedef CONST WCHAR *LPCWSTR, *PCWSTR;
typedef PCWSTR *PZPCWSTR;
typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
/* Cardinal Data Types */
typedef char CCHAR, *PCCHAR;
typedef short CSHORT, *PCSHORT;
typedef ULONG CLONG, *PCLONG;
/* NLS basics (Locale and Language Ids) */
typedef ULONG LCID;
typedef PULONG PLCID;
typedef USHORT LANGID;
/* Used to store a non-float 8 byte aligned structure */
typedef struct _QUAD {
__MINGW_EXTENSION union {
__MINGW_EXTENSION __int64 UseThisFieldToCopy;
double DoNotUseThisField;
} DUMMYUNIONNAME;
} QUAD, *PQUAD, UQUAD, *PUQUAD;
/* Large Integer Unions */
#ifndef __LARGE_INTEGER_DEFINED
#define __LARGE_INTEGER_DEFINED 1
#if defined(MIDL_PASS)
typedef struct _LARGE_INTEGER {
#else
typedef union _LARGE_INTEGER {
__MINGW_EXTENSION struct {
ULONG LowPart;
LONG HighPart;
} DUMMYSTRUCTNAME;
struct {
ULONG LowPart;
LONG HighPart;
} u;
#endif /* MIDL_PASS */
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
#if defined(MIDL_PASS)
typedef struct _ULARGE_INTEGER {
#else
typedef union _ULARGE_INTEGER {
__MINGW_EXTENSION struct {
ULONG LowPart;
ULONG HighPart;
} DUMMYSTRUCTNAME;
struct {
ULONG LowPart;
ULONG HighPart;
} u;
#endif /* MIDL_PASS */
ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
#endif /* !__LARGE_INTEGER_DEFINED */
/* Physical Addresses are always treated as 64-bit wide */
typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
/* Locally Unique Identifier */
#ifndef __LUID_DEFINED
#define __LUID_DEFINED 1
typedef struct _LUID {
ULONG LowPart;
LONG HighPart;
} LUID, *PLUID;
#endif /* !__LUID_DEFINED */
/* Native API Return Value Macros */
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
#define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
#define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
/* String Types */
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING;
typedef const UNICODE_STRING* PCUNICODE_STRING;
#define UNICODE_NULL ((WCHAR)0)
typedef struct _CSTRING {
USHORT Length;
USHORT MaximumLength;
CONST CHAR *Buffer;
} CSTRING, *PCSTRING;
#define ANSI_NULL ((CHAR)0)
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING, *PSTRING;
typedef STRING ANSI_STRING;
typedef PSTRING PANSI_STRING;
typedef STRING OEM_STRING;
typedef PSTRING POEM_STRING;
typedef CONST STRING* PCOEM_STRING;
typedef STRING CANSI_STRING;
typedef PSTRING PCANSI_STRING;
typedef struct _STRING32 {
USHORT Length;
USHORT MaximumLength;
ULONG Buffer;
} STRING32, *PSTRING32,
UNICODE_STRING32, *PUNICODE_STRING32,
ANSI_STRING32, *PANSI_STRING32;
typedef struct _STRING64 {
USHORT Length;
USHORT MaximumLength;
ULONGLONG Buffer;
} STRING64, *PSTRING64,
UNICODE_STRING64, *PUNICODE_STRING64,
ANSI_STRING64, *PANSI_STRING64;
/* LangID and NLS */
#ifndef MAKELANGID
#define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
#endif /* !MAKELANGID */
#ifndef PRIMARYLANGID
#define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
#endif /* !PRIMARYLANGID */
#ifndef SUBLANGID
#define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
#endif /* !SUBLANGID */
#ifndef NLS_VALID_LOCALE_MASK
#define NLS_VALID_LOCALE_MASK 0x000fffff
#endif /* !NLS_VALID_LOCALE_MASK */
#ifndef MAKELCID
#define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
((ULONG)((USHORT)(lgid)))))
#endif /* !MAKELCID */
#ifndef MAKESORTLCID
#define MAKESORTLCID(lgid, srtid, ver) \
((ULONG)((MAKELCID(lgid, srtid)) | \
(((ULONG)((USHORT)(ver))) << 20)))
#endif /* !MAKESORTLCID */
#ifndef LANGIDFROMLCID
#define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
#endif /* !LANGIDFROMLCID */
#ifndef SORTIDFROMLCID
#define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
#endif /* !SORTIDFROMLCID */
#ifndef SORTVERSIONFROMLCID
#define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
#endif /* !SORTVERSIONFROMLCID */
/* Object Attributes */
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
HANDLE RootDirectory;
PUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
/* Values for the Attributes member */
#define OBJ_INHERIT 0x00000002
#define OBJ_PERMANENT 0x00000010
#define OBJ_EXCLUSIVE 0x00000020
#define OBJ_CASE_INSENSITIVE 0x00000040
#define OBJ_OPENIF 0x00000080
#define OBJ_OPENLINK 0x00000100
#define OBJ_KERNEL_HANDLE 0x00000200
#define OBJ_FORCE_ACCESS_CHECK 0x00000400
#define OBJ_VALID_ATTRIBUTES 0x000007F2
/* Helper Macro */
#define InitializeObjectAttributes(p,n,a,r,s) { \
(p)->Length = sizeof(OBJECT_ATTRIBUTES); \
(p)->RootDirectory = (r); \
(p)->Attributes = (a); \
(p)->ObjectName = (n); \
(p)->SecurityDescriptor = (s); \
(p)->SecurityQualityOfService = NULL; \
}
/* Product Types */
typedef enum _NT_PRODUCT_TYPE {
NtProductWinNt = 1,
NtProductLanManNt,
NtProductServer
} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
typedef enum _EVENT_TYPE {
NotificationEvent,
SynchronizationEvent
} EVENT_TYPE;
typedef enum _TIMER_TYPE {
NotificationTimer,
SynchronizationTimer
} TIMER_TYPE;
typedef enum _WAIT_TYPE {
WaitAll,
WaitAny
} WAIT_TYPE;
/* Doubly Linked Lists */
#ifndef __LIST_ENTRY_DEFINED
#define __LIST_ENTRY_DEFINED 1
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
} LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
typedef struct LIST_ENTRY32 {
ULONG Flink;
ULONG Blink;
} LIST_ENTRY32, *PLIST_ENTRY32;
typedef struct LIST_ENTRY64 {
ULONGLONG Flink;
ULONGLONG Blink;
} LIST_ENTRY64, *PLIST_ENTRY64;
/* Singly Linked Lists */
typedef struct _SINGLE_LIST_ENTRY {
struct _SINGLE_LIST_ENTRY *Next;
} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
#endif /* !__LIST_ENTRY_DEFINED */
typedef struct _PROCESSOR_NUMBER {
USHORT Group;
UCHAR Number;
UCHAR Reserved;
} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
struct _CONTEXT;
struct _EXCEPTION_RECORD;
typedef EXCEPTION_DISPOSITION
(NTAPI *PEXCEPTION_ROUTINE)(
struct _EXCEPTION_RECORD *ExceptionRecord,
PVOID EstablisherFrame,
struct _CONTEXT *ContextRecord,
PVOID DispatcherContext);
typedef struct _GROUP_AFFINITY {
KAFFINITY Mask;
USHORT Group;
USHORT Reserved[3];
} GROUP_AFFINITY, *PGROUP_AFFINITY;
/* Helper Macros */
#define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
#define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
#ifdef ENABLE_RTL_NUMBER_OF_V2
#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
#else
#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
#endif
#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
/* Type Limits */
#ifndef MINCHAR
#define MINCHAR 0x80
#endif /* !MINCHAR */
#ifndef MAXCHAR
#define MAXCHAR 0x7f
#endif /* !MAXCHAR */
#ifndef MINSHORT
#define MINSHORT 0x8000
#endif /* !MINSHORT */
#ifndef MAXSHORT
#define MAXSHORT 0x7fff
#endif /* !MAXSHORT */
#ifndef MINLONG
#define MINLONG 0x80000000
#endif /* !MINLONG */
#ifndef MAXLONG
#define MAXLONG 0x7fffffff
#endif /* !MAXLONG */
#ifndef MAXUCHAR
#define MAXUCHAR 0xff
#endif /* !MAXUCHAR */
#ifndef MAXUSHORT
#define MAXUSHORT 0xffff
#endif /* !MAXUSHORT */
#ifndef MAXULONG
#define MAXULONG 0xffffffff
#endif /* !MAXULONG */
#ifndef MAXLONGLONG
#define MAXLONGLONG (0x7fffffffffffffffLL)
#endif /* !MAXLONGLONG */
/* Multiplication and Shift Operations */
#ifndef Int32x32To64
#define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
#endif /* !Int32x32To64 */
#ifndef UInt32x32To64
#define UInt32x32To64(a,b) ((ULONGLONG)(a)*(ULONGLONG)(b))
#endif /* !UInt32x32To64 */
#ifndef Int64ShllMod32
#define Int64ShllMod32(a,b) ((ULONGLONG)(a)<<(b))
#endif /* !Int64ShllMod32 */
#ifndef Int64ShraMod32
#define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
#endif /* !Int64ShraMod32 */
#ifndef Int64ShrlMod32
#define Int64ShrlMod32(a,b) ((ULONGLONG)(a)>>(b))
#endif /* !Int64ShrlMod32 */
/* C_ASSERT Definition */
#ifndef C_ASSERT
#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
#endif /* !C_ASSERT */
#define VER_WORKSTATION_NT 0x40000000
#define VER_SERVER_NT 0x80000000
#define VER_SUITE_SMALLBUSINESS 0x00000001
#define VER_SUITE_ENTERPRISE 0x00000002
#define VER_SUITE_BACKOFFICE 0x00000004
#define VER_SUITE_COMMUNICATIONS 0x00000008
#define VER_SUITE_TERMINAL 0x00000010
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
#define VER_SUITE_EMBEDDEDNT 0x00000040
#define VER_SUITE_DATACENTER 0x00000080
#define VER_SUITE_SINGLEUSERTS 0x00000100
#define VER_SUITE_PERSONAL 0x00000200
#define VER_SUITE_BLADE 0x00000400
#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
#define VER_SUITE_SECURITY_APPLIANCE 0x00001000
#define VER_SUITE_STORAGE_SERVER 0x00002000
#define VER_SUITE_COMPUTE_SERVER 0x00004000
#define VER_SUITE_WH_SERVER 0x00008000
/* Primary language IDs. */
#define LANG_NEUTRAL 0x00
#define LANG_INVARIANT 0x7f
#define LANG_AFRIKAANS 0x36
#define LANG_ALBANIAN 0x1c
#define LANG_ALSATIAN 0x84
#define LANG_AMHARIC 0x5e
#define LANG_ARABIC 0x01
#define LANG_ARMENIAN 0x2b
#define LANG_ASSAMESE 0x4d
#define LANG_AZERI 0x2c
#define LANG_BASHKIR 0x6d
#define LANG_BASQUE 0x2d
#define LANG_BELARUSIAN 0x23
#define LANG_BENGALI 0x45
#define LANG_BRETON 0x7e
#define LANG_BOSNIAN 0x1a
#define LANG_BOSNIAN_NEUTRAL 0x781a
#define LANG_BULGARIAN 0x02
#define LANG_CATALAN 0x03
#define LANG_CHINESE 0x04
#define LANG_CHINESE_SIMPLIFIED 0x04
#define LANG_CHINESE_TRADITIONAL 0x7c04
#define LANG_CORSICAN 0x83
#define LANG_CROATIAN 0x1a
#define LANG_CZECH 0x05
#define LANG_DANISH 0x06
#define LANG_DARI 0x8c
#define LANG_DIVEHI 0x65
#define LANG_DUTCH 0x13
#define LANG_ENGLISH 0x09
#define LANG_ESTONIAN 0x25
#define LANG_FAEROESE 0x38
#define LANG_FARSI 0x29
#define LANG_FILIPINO 0x64
#define LANG_FINNISH 0x0b
#define LANG_FRENCH 0x0c
#define LANG_FRISIAN 0x62
#define LANG_GALICIAN 0x56
#define LANG_GEORGIAN 0x37
#define LANG_GERMAN 0x07
#define LANG_GREEK 0x08
#define LANG_GREENLANDIC 0x6f
#define LANG_GUJARATI 0x47
#define LANG_HAUSA 0x68
#define LANG_HEBREW 0x0d
#define LANG_HINDI 0x39
#define LANG_HUNGARIAN 0x0e
#define LANG_ICELANDIC 0x0f
#define LANG_IGBO 0x70
#define LANG_INDONESIAN 0x21
#define LANG_INUKTITUT 0x5d
#define LANG_IRISH 0x3c
#define LANG_ITALIAN 0x10
#define LANG_JAPANESE 0x11
#define LANG_KANNADA 0x4b
#define LANG_KASHMIRI 0x60
#define LANG_KAZAK 0x3f
#define LANG_KHMER 0x53
#define LANG_KICHE 0x86
#define LANG_KINYARWANDA 0x87
#define LANG_KONKANI 0x57
#define LANG_KOREAN 0x12
#define LANG_KYRGYZ 0x40
#define LANG_LAO 0x54
#define LANG_LATVIAN 0x26
#define LANG_LITHUANIAN 0x27
#define LANG_LOWER_SORBIAN 0x2e
#define LANG_LUXEMBOURGISH 0x6e
#define LANG_MACEDONIAN 0x2f
#define LANG_MALAY 0x3e
#define LANG_MALAYALAM 0x4c
#define LANG_MALTESE 0x3a
#define LANG_MANIPURI 0x58
#define LANG_MAORI 0x81
#define LANG_MAPUDUNGUN 0x7a
#define LANG_MARATHI 0x4e
#define LANG_MOHAWK 0x7c
#define LANG_MONGOLIAN 0x50
#define LANG_NEPALI 0x61
#define LANG_NORWEGIAN 0x14
#define LANG_OCCITAN 0x82
#define LANG_ORIYA 0x48
#define LANG_PASHTO 0x63
#define LANG_PERSIAN 0x29
#define LANG_POLISH 0x15
#define LANG_PORTUGUESE 0x16
#define LANG_PUNJABI 0x46
#define LANG_QUECHUA 0x6b
#define LANG_ROMANIAN 0x18
#define LANG_ROMANSH 0x17
#define LANG_RUSSIAN 0x19
#define LANG_SAMI 0x3b
#define LANG_SANSKRIT 0x4f
#define LANG_SERBIAN 0x1a
#define LANG_SERBIAN_NEUTRAL 0x7c1a
#define LANG_SINDHI 0x59
#define LANG_SINHALESE 0x5b
#define LANG_SLOVAK 0x1b
#define LANG_SLOVENIAN 0x24
#define LANG_SOTHO 0x6c
#define LANG_SPANISH 0x0a
#define LANG_SWAHILI 0x41
#define LANG_SWEDISH 0x1d
#define LANG_SYRIAC 0x5a
#define LANG_TAJIK 0x28
#define LANG_TAMAZIGHT 0x5f
#define LANG_TAMIL 0x49
#define LANG_TATAR 0x44
#define LANG_TELUGU 0x4a
#define LANG_THAI 0x1e
#define LANG_TIBETAN 0x51
#define LANG_TIGRIGNA 0x73
#define LANG_TSWANA 0x32
#define LANG_TURKISH 0x1f
#define LANG_TURKMEN 0x42
#define LANG_UIGHUR 0x80
#define LANG_UKRAINIAN 0x22
#define LANG_UPPER_SORBIAN 0x2e
#define LANG_URDU 0x20
#define LANG_UZBEK 0x43
#define LANG_VIETNAMESE 0x2a
#define LANG_WELSH 0x52
#define LANG_WOLOF 0x88
#define LANG_XHOSA 0x34
#define LANG_YAKUT 0x85
#define LANG_YI 0x78
#define LANG_YORUBA 0x6a
#define LANG_ZULU 0x35
#endif /* _NTDEF_ */
| 29.657244 | 103 | 0.637913 |
15f2f671f83786428145787d48a65d11388d4b81 | 40,781 | h | C | gempak/include/proto_gemlib.h | oxelson/gempak | e7c477814d7084c87d3313c94e192d13d8341fa1 | [
"BSD-3-Clause"
] | null | null | null | gempak/include/proto_gemlib.h | oxelson/gempak | e7c477814d7084c87d3313c94e192d13d8341fa1 | [
"BSD-3-Clause"
] | null | null | null | gempak/include/proto_gemlib.h | oxelson/gempak | e7c477814d7084c87d3313c94e192d13d8341fa1 | [
"BSD-3-Clause"
] | null | null | null | /************************************************************************
* proto_gemlib.h *
* *
* NOTE: When adding entries, please maintain alphabetical order. *
* *
** *
* Log: *
* T. Piper/GSC 12/00 Created *
* S. Jacobs/NCEP 12/00 Added GB library public prototypes *
* A. Hardy/GSC 2/01 Added GETMAP *
* J. Wu/GSC 03/01 Added parameter 'ilogo' into 'glogo' *
* T. Piper/GSC 04/01 Added cv_rduc *
* A. Hardy/GSC 6/01 Added gg_wcur,fixed gg_wtch call. seq. *
* A. Hardy/GSC 7/01 Added im_chtb *
* S. Jacobs/NCEP 7/01 Added prnlon and pr_mskn *
* T. Lee/SAIC 10/01 Added fill types to gcfill calling seq. *
* D. Kidwell/NCEP 6/02 Added gsgtgn *
* A. Hardy/NCEP 8/02 Added gg_csig *
* S. Jacobs/NCEP 9/02 Added mv_itob *
* J. Wu/SAIC 9/02 Added gplbnd *
* D.W.Plummer/NCEP 3/03 Chgs for IM_BTOT, IM_TTOB, IM_GVTOTA *
* D.W.Plummer/NCEP 3/03 Added im_gtmp *
* K. Brill/HPC 5/03 Added dg_intl *
* M. Li/SAIC 6/03 Added gg_wwfo *
* T. Piper/SAIC 7/03 Added ip_svar *
* A. Hardy/NCEP 8/03 Added ti_elcl *
* A. Hardy/NCEP 8/03 Added gg_wcvf and fl_fpth *
* D.W.Plummer/NCEP 9/03 Added gqgprj *
* M. Li/SAIC 10/03 Added ip_idnt, ip_dynm, ip_exit *
* M. Li/SAIC 11/03 Added im_cbar *
* J. Wu/SAIC 01/04 Added er_gnumerr & er_gerrmsg *
* R. Tian/SAIC 01/04 Changed dg_intl calling sequence *
* R. Tian/SAIC 02/04 Changed dg_intl calling sequence back *
* J. Wu/SAIC 02/04 Changed er_gerrmsg *
* B. Yin/SAIC 02/04 Added 4 gh functions *
* T. Piper/SAIC 03/04 Added various functions *
* T. Piper/SAIC 03/04 Removed cfdate and ss_gtim *
* B. Yin/SAIC 03/04 Changed gh_bksq calling sequence *
* m.gamazaychikov/SAIC 04/04 Added gh_bkpl, gh_bktb *
* B. Yin/SAIC 05/04 Added gh_ftbl *
* F. J. Yen/NCEP 06/04 Changed gg_qsrd calling sequence *
* D.W.Plummer/NCEP 06/04 Chg call seq of im_gtmp *
* m.gamazaychikov/SAIC 08/04 Changed call to gh_bkpl *
* B. Yin/SAIC 08/04 Added gh_tctx, gh_wwbk, gh_wwtx *
* H. Zeng/SAIC 09/04 Added gg_wcck and gg_wwtp *
* T. Piper/SAIC 10/04 Changed calling sequence for csleep.c *
* m.gamazaychikov/SAIC 11/04 Added gg_wfps *
* T. Piper/SAIC 11/04 Changed Cardinal to size_t for 64-bit *
* D. Kidwell/NCEP 2/05 Added gh_wwbl, changed gh_wwtx call seq *
* S. Jacobs/NCEP 2/05 Added gh_fstn *
* H. Zeng/SAIC 03/05 Added in_catminp&in_catmmap *
* D. Plummer/NCEP 03/05 Changed ggdriv arguments list *
* A. Hardy/NCEP 03/05 Added int* to gg_wcck *
* C. Bailey/HPC 03/05 Added ggsave *
* M. Li/SAIC 04/05 Added 3 char* to gh_tctx *
* A. Hardy/NCEP 04/05 Added gg_cwcp and gg_wcpb *
* T. Piper/SAIC 04/05 Added sn_clos, sn_rstr, sn_sstn, sn_stim*
* B. Yin/SAIC 04/05 Added issuing status in gh_wwtx *
* T. Piper/SAIC 04/05 Added im_dump and im_icmn *
* R. Tian/SAIC 04/05 Added oabsdr *
* F. J. Yen/NCEP 4/05 Added gg_wlso *
* D. Kidwell/NCEP 4/05 Changed gh_wwbk call seq, 275 -> 605 *
* H. Zeng/SAIC 05/05 Added 5 in_xxxx functions *
* M. Li/SAIC 05/05 Changed ggdriv argument list *
* G. Grosshans/SPC 06/06 Added int* to gg_wwtp *
* F. J. Yen/NCEP 8/05 Changed gg_wlso *
* M. Li/SAIC 9/05 Removed gh_bkrd and gh_bkus *
* D.W.Plummer/NCEP 9/05 Added dg_nend and modified ggapsm *
* M. Li/SAIC 9/05 Added gg_update *
* m.gamazaychikov/SAIC 09/05 Added ip_log *
* D. Kidwell/NCEP 10/05 Added int* to gh_wwtx for adv num *
* S. Gilbert/NCEP 11/05 Added gh_0bkp *
* m.gamazaychikov/SAIC 12/05 Added gg_rdvgf, changed gg_update *
* S. Gilbert/NCEP 01/06 Added gh_advn; changes gh_wwtx, gh_0bkp *
* H. Zeng/SAIC 03/06 added conditional compiling in PR lib. *
* M. Li/SAIC 04/06 added in_discqleft *
* R. Tian/SAIC 4/06 Removed DG library prototypes *
* T. Piper/SAIC 07/06 Added gg_wsrd.c *
* R. Tian/SAIC 8/06 Added inc_outt *
* R. Tian/SAIC 8/06 Added grc_geni and grc_wnmc *
* D.W.Plummer/NCEP 9/06 Added some DM library functions *
* R. Tian/SAIC 9/06 Added gr_sscl,in_scal,ip_resp,tm_accp *
* R. Tian/SAIC 9/06 Added tm_str *
* T. Piper/SAIC 09/06 Added im_qimg, im_rtbl, im_smgd *
* R. Tian/SAIC 10/06 Removed na_*, added gd_cref, gg_proj, *
* gr_algn, gr_mbn2, gr_suba *
* S. Gilbert/NCEP 10/06 Added gr_vnav *
* S. Gilbert/NCEP 07/07 Set up GU library section *
* S. Gilbert/NCEP 10/07 Added gh_bkcal and gh_bkloc *
* E. Safford/SAIC 12/07 use G_Cardinal to rm X/Motif dependency *
* E. Safford/SAIC 01/08 add prototypes for gmesg, gsatim *
* T. Piper/SAIC 01/08 Added gd_init *
* T. Piper/SAIC 03/08 Added new UNISYS navigation routines *
* m.gamazaychikov/SAIC 04/08 Changed gh_bkpl prototype adding size_t *
* J. Wu/SAIC 06/08 add "intensity" in inc_pgfatxt *
* J. Wu/SAIC 06/08 add "coverage" in inc_pgfatxt *
* J. Wu/SAIC 06/08 add "category/frequency" in inc_pgfatxt *
* L. Hinson/AWC 06/08 Add cycle parameter to inc_pgfatxt *
* S. Gilbert/NCEP 06/09 Added gh_bkme *
* L. Hinson/AWC 07/09 Add inc_pccftxt *
* m.gamazaychikov/CWS 01/10 Add DB library prototypes, tb_nidsdb *
* X. Guo/CWS 04/10 Add im_nexbz function prototype *
* X. Guo/CWS 04/10 Added im_nexbzwmo function *
* m.gamazaychikov/CWS 03/11 Remove db_checkConnection, db_gradhdr, *
* db_gradimg, db_gsathdr, db_gsatimg, *
* db_getBinaryData, db_gNextColumn. *
* Add db_gtim, db_getduri, db_getgnav, *
* db_getRData, db_rdtr, db_getstinfo. *
* Change prototype for db_runQuery. *
* S. Jacobs/NCO 04/12 Added gg_osrd *
* S. Jacobs/NCEP 5/13 Removed old DB functions; added da_runpy*
* S. Jacobs/NCEP 9/13 Added more DA functions *
* S. Guan//NCEP 6/15 ADDed im_rcdf4 *
* S. Gilbert/NCEP 2/16 Added cycle and fcst args to *
* da_getheader *
* P. Moyer/NCEP 06/30/16 R17968 Added DA functions for new *
* processing through EDEX *
* S. Guan/NCEP 07/20 Added tzone as an input of TI_DST *
************************************************************************/
/* AW library */
void awrfil(char fname[], int *nbytes, unsigned char barr[], int *iret);
/* CV library */
void cv_mdfy(int *npo, float *xo, float *yo, int *npc, float *xc, float *yc,
int *sm_lvl, int *oline, int *maxpts, int *np, float *x, float *y,
int *is, int *ie, int *iret);
void cv_prmt(int*, float*, float*, float*, int*, float*, int*, int*, int*,
float*, float*, int *iret);
void cv_rduc(int *npts, float *xpts, float *ypts, float *filt, int *nout,
float *xout, float *yout, int *iret);
/* DG library */
void dgc_grid(const char *gdattm, const char *glevel, const char *gvcord,
const char *gfunc, char *pfunc, float *grid, int *igx, int *igy,
char *time1, char *time2, int * level1, int *level2, int *ivcord,
char *parm, int *iret);
void dgc_ndtm(const char *gdatm, int *iret);
void dgc_nfil(const char *gdfile, const char *gdoutf, int *iret);
void dgc_ntim(const int *chngnv, const int *coladd, char *time1, char *time2,
int *nxtok, int *iret);
void dg_intl(int *iret);
void dg_nend(int *iret);
void dg_onav(const float *rnvblk, int *iret);
/* ER library */
void er_gerrmsg(int *indx, char *msg, int *iret);
void er_gnumerr(int *errnum, int *iret);
void er_init(int *iret);
void er_lmsg(int*, char*, int*, char*, int*, size_t, ...);
void er_smsg(char *string, int *iret);
void er_stat(int*, int*, int*, int *iret);
void er_wbuf(int *iret);
void er_wmsg(char *errgrp, int *numerr, char *errstr, int *iret, size_t,
size_t);
/* DB library */
void da_getdti(char *station, char *time, int *partnum, int *iflno, int *idthdr,
int *idata, int *nval, int *iret);
void da_getdtc(char *station, char *time, int *partnum, int *iflno, int *idthdr,
char *cdata, int *nchr, int *iret);
void da_getdtr(char *station, char *time, int *partnum, int *iflno, int *idthdr,
float *rdata, int *nval, int *iret);
void da_getdtrgd(char *cycle, char* forecast, char *level1, char *level2,
char *gvcord, char *gparm, int *iflno, int *idthdr, float *rdata,
int *nval, int *iret);
void da_getfilhdc(int *iflno, char *fhdnam, int *mxchar, char *cheadr,
int *nchar, int *iret);
void da_getfilhdi(int *iflno, char *fhdnam, int *mxword, int *iheadr,
int *nword, int *iret);
void da_getfilhdr(int *iflno, char *fhdnam, int *mxword, float *rheadr,
int *nword, int *iret);
void da_getfhdr(int *iflno, int *nfhdr, int *type, int *fhlen, int *iret);
void da_getheader(int *iflno, char *hdrtyp, char *cycle, char* forecast,
int *nval, int *values, int *iret);
void da_getlabel(int *iflno, char *label, int *iret);
void da_getname(int *iflno, char *key, int *nkey1, int *nkey2, char *str,
int *iret);
void da_getnums(int *iflno, int *rows, int *cols, int *prts, int *fhds,
int *iret);
void da_getparm(int *iflno, int *npart, int *nparm, int *scale, int *offset,
int *bits, int *iret);
void da_getpart(int *iflno, int *npart, int *type, int *nparm, int *iret);
void da_getsorc(int *iflno, int *type, int *source, int *iret);
void da_getvers(int *iflno, int *version, int *iret);
void da_insertParam(char* paramName, char* paramSource, int typeVal,
char* paramReport, float valuef, int valuei, char* valuec, void** root);
void da_insertParamArray(char* paramName, char* paramSource, int typeVal,
char* paramReport, int size, float* valuef, int* valuei, char** valuec, void** root);
void da_insertStation(char* station, void* paramTree, void** root);
void da_insertStationParams(void* station, void* newParamTree);
void da_insertTimesParam(void** root, char* param, int typeVal,
char* parmSource, char* paramReport);
void da_insertTimestamp(char* timestamp, void* stationRoot,
void** timestampRoot);
void da_insertTimestampParams(void* timestampRoot, char** params, int parmSize,
int type, char* parmSource, char* paramReport);
void da_paramcmp(char* param1, char* source1, char* report1, char* param2,
char* source2, char* report2, int* iret);
void da_paramExistsStation(void* root, char* param, char* source, char* report, int* iret,
void** node);
void da_paramExistsTimestamp(void* timestampRoot, char** params, int parmSize,
char* parmSource, char* paramReport, int* iret);
void da_paramExistsTree(void* root, char* param, char* parmSource, char* paramReport, int* iret);
void da_readxml(char *filnam, int *iflno, int *iret);
void da_returnParamValue(char* param, void* root, int* iRetType, float* fValue,
int* iValue, char** cValue);
void da_returnStationValueTree(char* station, void* root, void** paramTree);
void da_runpy(char *pyfile, char *pymeth, int *iret);
void da_runpy_once(char *pyfile, char *pymeth, int *iret);
void da_timeExists(char* time, int* iret, void* root, void** result);
/* DM library */
void dm_rint(int*, int*, int*, int*, int *iret);
void dm_pkgd(float*, int*, int*, int*, int*, int *, int*, int*, float*, float*,
float*, int *iret);
void dm_wpkg(int*, float*, int*, int*, int*, int*, int *, int*, int*, int*,
float*, float*, float*, int *iret);
void dp_ugrb(int*, int*, int*, float*, float*, int*, float*, int *iret);
void dp_unmc(int*, int*, int*, float*, float*, float*, int *iret);
void dp_udif(int*, int*, int*, float*, float*, float*, int*, int*, float*,
int *iret);
/* FL library */
void fl_fpth(char*, char*, char*, int *iret, size_t, size_t, size_t);
/* GB library */
void gb_clos(int *iret);
void gb_diag(char *gbdiag, int *iret);
void gb_gbdh(int *length, int *bdflag, int *scale, float *ref, int *nbits,
int *iret);
void gb_ggds(float *gdsarr, int *irltv, int *nrmflg, int *iret);
void gb_gpbd(int *kx, int *ky, int *iuscal, float *ref, float *scale,
int *nbits, int *igrid, int *lengrd, int *iret);
void gb_gpds(int *itime, int *iaccm, int *ilevel, int *ivcord, int *iparm,
int *igrdnm, int *icodtbl, int *icenter, int *isgds, int *isbms,
int *ispdse, char *cpds, int *iclen, int *iret);
void gb_gubd(int *kx, int *ky, int *iuscal, int *misflg, float *rmsval,
int *nrmflg, int *irltv, int *nbits, float *fgrid, int *iret);
void gb_next(int *ivers, int *iret);
void gb_open(char *filnam, int *lenfil, char *idxnam, int *lenidx, int *iret);
void gb_read(int *mxgrib, int *ipack, int *iret);
/* GD library */
void gdc_open(char *gdfile, int *wrtflg, int *mxanl, int *mxnav, int *iacss,
float *anl, float *rnav, int *msxgrd, int *iret);
void gd_clos(int *iacss, int *iret);
void gd_cref(const char*, const int*, const float*, const int*, const float*,
const int*, const int*, int*, int*, size_t);
void gd_geni(char *gdfile, int *nlun, int *luns, int *iret, size_t);
void gd_gcyc(char*, char*, int*, char*, int *iret, ...);
void gd_init(int *iret);
void gd_open(char *, int *, int *, int *, int *, float *, float *, int *,
int *iret, size_t);
void gd_wpgd(int*, float*, int*, int*, int*, char*, int*, int*, char*, int*,
int*, int*, int *iret, size_t, size_t);
/* GG library */
void gg_asrd(char *filtyp, char *filnam, char *stime, char *etime, char *dtime,
float fwninc[], int icolrs[], int icolrs2[], int *numclr, int *iskip,
int *interv, int *itmclr, int iflags[], int *ityp, int *iret);
void gg_cbar(char*, int*, float*, int*, int *iret, size_t);
void gg_csig(char*, int*, int*, int*, int *iret, size_t);
void gg_cwcp(int*, int*, int*, float*, float*, int* iret);
void gg_dltn(int *, int *, int *, int *, float *, float *, int *, int *);
void gg_dvgf(char *vgfile, int *icol, int *iret);
void gg_init(int *mode, int *iret);
void gg_isig(char*, int*, float*, int*, int*, int*, int *iret, size_t);
void gg_ltln(char *latlon, int *iret, size_t);
void gg_ltng(char*, int*, int*, int*, float*, float*, int*, int *iret, size_t);
void gg_map(char *map, int *iret, size_t);
void gg_maps(char *proj, char *garea, char *imgfil, int *idrpfl, int *iret,
size_t, size_t, size_t);
void gg_motf(char *window, int *iret, size_t);
void gg_osrd(char *filtyp, char *filnam, char *stime, char *etime, char *dtime,
float fwninc[], int icolrs[], int icolrs2[], int *numclr, int *iskip,
int *interv, int *itmclr, int iflags[], int *ityp, int *iret);
void gg_panl(char *panel, int *iret, size_t);
void gg_proj(const char*, char*, float*, float*, int*, int*, size_t, size_t);
void gg_qsrd(char *filtyp, char *filnam, char *cstime, char *etime, char *dtime,
float fwninc[], int icolrs[], int icolrs2[], int *numclr, int *iskip,
int *interv, int *itmclr, int iflags[], int *ityp, int *iret);
void gg_sdev(char*, int *iret, size_t);
void gg_splt(char *stnplt, int *iret, size_t);
void gg_sttl(char *ttlstr, int *iret, size_t);
void gg_warn(char *filtyp, char*, int*, int*, int*, float*, int*, int*,
int *iret, size_t, size_t);
void gg_wcck(int*, char*, char*, int*, int*, int*, char*, char*, int*, size_t,
size_t, size_t, size_t);
void gg_wcpb(int*, char*, char*, char*, char*, char*, char*, int*);
void gg_wcur(char *date, int*, int*, int*, size_t);
void gg_wcvf(int*, int *iret);
void gg_wfps(int*, char*, char*, int*, int wcnty[], int*, size_t, size_t);
void gg_wlbl(int*, float*, float*, float*, float*, int *iret);
void gg_wlso(int *npts, int nfips[], int *mxp, int *nunion, int *nv, float xp[],
float yp[], float *xc, float* yc, float* area, int *iret);
void gg_wsrd(char *filtyp, char *filnam, char *stime, char *etime, char *dtime,
float fwninc[], int icolrs[], int icolrs2[], int *numclr, int *iskip,
int *interv, int *itmclr, int iflags[], int *ityp, int *iret);
void gg_wstr(char *string, int *line, int *iret, size_t);
void gg_wtch(char*, int*, float*, int*, int*, int *iret, size_t);
void gg_wusc(char *ugcin, char *stin, char *namin, int *numb, char *cday,
char *chour, int *vtecln, char *prdcod, char *actn, char *offid,
char *phen, char *sigcd, char *etn, int vtime[], int etime[],
char *cntystr, int *ilenout, int *iret);
void gg_wwfo(char*, char*, int *iret, size_t, size_t);
void gg_wwtp(int*, int*, char*, char*, char*, char*, char*, char*, int*, char*,
char*, char*, int*, char*, char*, char*, char*, int*, int*, int*, int*,
size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t,
size_t, size_t, size_t, size_t);
/* GH library */
void gh_advn(char *, int *, int *, int *);
void gh_bkcal(int*, int*);
void gh_bkloc(char*, char*, char*, int*, size_t, size_t, size_t);
void gh_bkme(int*, int*);
void gh_bkpl(int (*)[4], int*, char*, int (*)[4], int (*)[4], int*, size_t);
void gh_bksq(char*, int*, int*, int*);
void gh_bktb(int*);
void gh_fstn(char*, char*, char*, int*, int*, int*, char*, int*);
void gh_ftbl(int*);
void gh_rtbl(int*);
void gh_tctx(char*, char*, char*, char*, char*);
void gh_wwbk(int (*)[4], int[], int (*)[4], int[], int*, char (*)[1000],
char (*)[1000], int (*)[3], char (*)[605], int*, char*, int*, size_t,
size_t, size_t, size_t);
void gh_wwbl(int (*)[4], int[], int (*)[4], int[], int*, char (*)[1000],
char (*)[1000], int (*)[3], char (*)[605], int*, char*, int*, size_t,
size_t, size_t, size_t);
void gh_wwtx(char*, char*, char*, char*, char*, int*, char*, int*, char*, char*,
char (*)[1000], char (*)[1000], int (*)[3], char (*)[605], int*, size_t,
size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t,
size_t);
void gh_0bkp(char*, char*, int*, float*, float*, int*, float*, int*, int*,
size_t, size_t);
/* GP library */
void gp_azdr(float *azim, float *xm, float *ym, float *dir, int *iret);
void gp_draz(float *dir, float *xm, float *ym, float *azim, int *iret);
/* GU library */
void gcboxx(const int *, const int *, const float *, const int *, const int *,
const int *, const int *, const float *, const int *, const int *,
const int *, const int *, int *);
void gcfill(int*, int*, float*, int*, int*, int*, int*, float*, int*, int*,
int*, int*);
void gclgrn(int*, int*, float*, int*, int*, int*, int*, float*, char*, int*,
int*, int*, int*, int*, int*, int);
void gstrml(const int *, const int *, float *, float *, const int *,
const int *, const int *, const int *, int *, float *, float *, float *,
float *, float *, int *);
/* IM library */
void im_cbar ( char *clrbar, int *iret, size_t );
void im_btot ( int *nvals, int *brit, float *tmpk, int *iret ) ;
void im_chtb ( char *chanl, int *itype, int *iret, size_t );
void im_drop ( int *iret );
void im_dump ( int *iret );
void im_gpix ( char *imgfil, char *garea, char *dattim, float *rlat,
float *rlon, int *maxdst, int *tblflg, int *mstflg,
int *iarrea, int *mode, int *ipix, float *tmpk,
char *stid, float *dist, float *pres, float *hght,
int *npt, int *iret, ... );
void im_gtmp ( char *imagefile, char *garea, char *sys, float *cenlat,
float *cenlon, int *irad, int *numx, int *numy, float *temps,
float *flats, float *flons,
int *ier, size_t, size_t, size_t );
void im_gvtota ( int *nvals, unsigned int *gv, float *ta, int *iret );
void im_icmn ( int *hv, int *iret );
void im_lutf ( char*, int *iret, size_t );
void im_nexbz ( char filnam[], int *itype, int *ioff, int *iret );
void im_nexbzwmo ( char filnam[],unsigned char *barr, int len, int *itype, int *ioff, int *iret );
void im_nexz ( char filnam[], int *nline, int *itype, int *ioff, int *iret );
void im_nzhd ( char*, unsigned char *barr, int *ipdoff, int *iret, size_t );
void im_qchn ( char *chntyp, int *iret, size_t );
void im_qimg ( int *, int *, int *, int *, int *iret );
void im_qlut ( char*, int *iret, size_t );
void im_qsiz ( int *ncol, int *nrow, int *iret );
void im_qtim ( int *idate, int *itime, int *iret );
void im_rcdf ( char imgfil[], int *kx, int *ky, int *isorc, int *itype,
int *idate, int *itime, int *iproj, float *clat,
float *clon, float *xmin, float *xmax, float *ymin,
float *ymax, int *iret );
void im_rcdf4 ( char imgfil[], int area[64], int nav[640], int *isorc, int *itype,
int *idate, int *itime, int *iproj, float *clat,
float *clon, int *ixmin, int *ixmax, int *iymin,
int *iymax, int *iret );
void im_rfax ( char *filnam, int *lenfil, int *isize, int *ixlen,
int *iylen, int *iret );
/* void im_rgin ( char filnam[], int *lenf, int *offset, int *lendat, int *iret ); */
/* S. Chiswell - modified im_rgin for compressed gini in NOAAPORT */
void im_rgin ( char filnam[], int *lenf, int *imcflg, int *offset, int *lendat, int *iret );
void im_rtbl ( int *iret );
void im_sbgn ( int *kx, int *ky, int *ixlef, int *iytop, int *ixrit,
int *iybot, int *ipix, int *iret );
void im_simg ( char *cproj, char *imgfil, int *iret, size_t, size_t );
void im_smgd ( char*, char*, int*, int*, char*, int *iret, size_t, size_t, size_t);
void im_ttob ( int *nvals, float *tmpk, float *brit, int *iret ) ;
void im_wgin ( char filnam[], int *lenf, int *offset, int *lendat, int *iret );
void lc_km_to_latlon( double*, double*, double*, double* );
void lc_latlon_to_km( double*, double*, double*, double* );
void prnlon ( int *np, float *dlon, int *iret );
void psn_km_to_latlon_alaska( double*, double*, double*, double* );
void psn_km_to_latlon_hawaii( double*, double*, double*, double* );
void inc_pccftxt(char *tops, char *growth, char *prob, char *coverage,
char *instr, char *outstrfin, int *iret);
void inc_pgfatxt(char *status, char *hazard, char *tag, char *cycle,
char *fcsthr, char *dueto, char *top, char *base, char *fzltop,
char *fzlbse, char *level, char *intensity, char *coverage,
char *category, char *frequency, char *instr, char *outstrfin,
int *iret);
/* GR library */
void gr_acol(int *, int *, float *, int *, int *, int *iret);
void gr_algn(const float*, const float*, const float*, float*, int*, int*,
int*);
void gr_cnav(float *, float *, int *, int *, int *iret);
void gr_dorg(int *, int *, int *, float *, int *iret);
void gr_gtim(char *, char *, char *, char *, char *, int *, size_t, size_t,
size_t, size_t, size_t);
void gr_levl(char *, int *, int *, int *iret, size_t);
void gr_ltln(int *, int *, float *, float *, int *iret);
void gr_mbn2(const float*, const int*, const float*, const float*, float*,
int*);
void gr_mnav(char*, int*, int*, float*, float*, float*, float*, float*, float*,
float*, int*, float*, int *iret, size_t);
void gr_pack(char *, int *, int *, int *iret, size_t);
void gr_plin(char *, int *, int *, float *, float *, float *, float *,
int *iret, size_t);
void gr_ploc(char *, float *, float *, float *, float *, int *iret, size_t);
void gr_rban(float *, float *, float *, float *, float *, float *, float *,
int *, int *iret);
void gr_rnav(float *, char *, int *, int *, int *, size_t);
void gr_setr(int *, int *, int *, int *iret);
void gr_snav(int *, float *, int *iret);
void gr_sscl(int*, const int*, const int*, const int*, const int*, const int*,
const int*, float*, float*, float*, int*);
void gr_stat(float *, int *, int *, int *, int *, int *, int *, float*, float*,
float*, float*, int *iret);
void gr_suba(const char*, const int*, float*, float*, int*, int*, int*, int*,
size_t);
void gr_vnav(char*, int*, int*, float*, float*, float*, float*, float*, float*,
float*, int*, int*, int *iret, size_t);
void gr_wgb2(int*, int*, int*, int*, char*, int*, int*, char*, int*, int*, int*,
int*, int*, int*, int*, size_t, size_t);
/* GRC library */
void grc_geni(const char *gdfile, FILE **fps, const int *nfps, int *iret);
void grc_wnmc(FILE **fps, const int *nfps, const int *title, const int *num,
const char *gdattm1, const char *gdattm2, const int *level1,
const int *level2, const int *ivcord, const char *parm,
const int *nmcprm, const int *nmcvco, const int *nmcgdn, int *iret);
/* IN library */
void in_bdta(int *iret);
void in_cint(char*, float*, int *npts, float *gmin, float *gmax, float*, int*,
float *frint, int *iret, size_t);
void in_line(char*, float*, int *nexp, int*, int*, int*, int*, float *smooth,
float *filter, int *iret, size_t);
void in_outt(char *output, char *name, int *lun, int *nlun, char *devs,
int *iret, size_t, size_t, size_t);
void in_text(char *test, int *iret, size_t);
void in_txtn(char *text, int *ifont, int *ihwsw, float *siztxt, int *itxwid,
int *ibrdr, int *irrotn, int *ijust, int *iret, size_t);
void in_scal(const char*, int*, int*, int*, size_t);
void in_catminp(char *catmap, int *iret);
void in_catmmap(char *string, float *value, int *iret);
void in_discrete(char *discrete, int *iret);
void in_discmap(float *v_line1, float *v_line2, float *v_out, int *iret);
void in_discq(int *state, int *iret);
void in_discqleft(float *value, float *newval, int *iret);
void in_dlines(char *dlines, int *iret);
void in_dlinq(int *stateR, int *stateL, float *epsilon, int *iret);
void inc_outt(const char *output, const char *def, int *termflg, int *fileflg,
char *filnam, int *iret);
/* IP library */
void ip_dynm(int *done, int *iret);
void ip_exit(int *iret);
void ip_help(char *pname, int *pagflg, int *iret, size_t);
void ip_idnt(char *program, int *iret, size_t);
void ip_init(int *respnd, int *iret);
void ip_putv(char*, char*, int *iret, size_t, size_t);
void ip_str(char *pname, char *parm, int *iret, size_t, size_t);
void ip_strp(char *progrm, int *iret, size_t);
void ip_svar(char*, int *iret, size_t);
void ip_log(char *pname, int *logprm, int *iret, size_t);
void ip_resp(int*, int*);
/* LC library */
void lc_gare(char *garea, float *grltln, char *cdproj, float *centrd, int *iret,
size_t, size_t);
/* LV library */
void lv_ccrd(int *ivcord, char *vcoord, int *iret, size_t);
void lv_cord(char *vcoord, char *vparm, int *ivert, int *iret, size_t, size_t);
void lv_sort(int *, int *, float *, int *iret);
/* MV library */
void mv_btoi(unsigned char *barray, int *istart, int *nbytes, int *negflg,
int *ivalue, int *iret);
int mv_ev32(int *n, float *valin, float *valout);
void mv_itob(int *ivalue, int *istart, int *nbytes, unsigned char *barray,
int *iret);
int mv_swp2(int *n, void *input, void *output);
int mv_swp4(int *n, void *input, void *output);
int mv_ve32(int *n, float *valin, float *valout);
/* PR library */
#ifdef G_64BIT
double pr_hgmf ( float *hght );
double pr_mskn ( float *sped );
double pr_tmkc ( float *tmpk );
double pr_hgfm ( float* );
double pr_knms ( float* );
double pr_knmh ( float* );
#else
float pr_hgmf(float *hght);
float pr_mskn(float *sped);
float pr_tmkc(float *tmpk);
float pr_hgfm(float*);
float pr_knms(float*);
float pr_knmh(float*);
#endif
/* SF library */
void sf_clos(int *isffln, int *iret);
void sf_rspc(int *isffln, char *string, int *nchar, int *ihhmm, int *nrep,
int *iret, size_t);
void sf_rstr(int *isffln, char *string, int *ihhmm, int *nchar, int *iret,
size_t);
void sf_sstn(int *isffln, char *stn, char *stid, int *istnm, float *slat,
float *slon, float *selv, int *ispri, int *iret, size_t, size_t);
void sf_stim(int *isffln, char *dattim, int *iret, size_t);
/* SN library */
void sn_clos(int *isnfln, int *iret);
void sn_rstr(int *isnfln, char *part, char *string, int *ihhmm, int *nchar,
int *iret, size_t, size_t);
void sn_sstn(int *isnfln, char *stn, char *stid, int *istnm, float *slat,
float *slon, float *selev, int *iret, size_t, size_t);
void sn_stim(int *isnfln, char *dattim, int *iret, size_t);
/* SS library */
void csleep(float *nsec, int *iret);
void ss_vers(char*, int*, size_t);
/* ST library */
void st_atoe(char *instr, int *nchar, unsigned char *barry, int *iret, size_t);
void st_gtst(char*, char*, char*, char*, char*, int*, int *iret, ...);
void st_null(char *string, char *outstr, int *lens, int *iret, size_t, size_t);
void st_numb(char *string, int *ival, int *iret, size_t);
void st_opcl(char *, int *, char *, int *, int *iret, size_t, size_t);
/* TB library */
void tb_idst(char *stid, char *statnam, int *iret, size_t, size_t);
void tb_fgeo(char *geog, float*, float*, float*, float*, char *cdproj, float*,
float*, int *iret, size_t, size_t);
void tb_nids(const int *, const int *, char *, int *, char *, float *, char *,
int *iret);
void tb_nidsdb(char *prdnam, char *res, int *iprod, int *iret);
/* TG library */
void tg_ctoi(char *, int *, int *, size_t);
void tg_diff(char *, char *, int *, int *iret, size_t, size_t);
void tg_dual(char *, char *, int *iret, size_t, size_t);
void tg_itoc(int *intdtf, char *gdattm, int *iret, size_t);
void tg_vald(char *gdattm, char *vdattm, int *iret, size_t, size_t);
/* TI library */
void ti_addd(int*, int*, int *iret);
void ti_addm(int*, int*, int*, int *iret);
void ti_c2i(char*, int*, int*, int*, int *iret, size_t);
void ti_ccnt(char*, char*, int *iret, size_t, size_t);
void ti_cdtm(int*, int*, char *dattim, int *iret, size_t);
void ti_ctoi(char*, int*, int *iret, size_t);
void ti_daym(int*, int*, int*, int *iret);
void ti_dayw(int*, int*, int *iret);
void ti_difd(char*, char*, float*, int *iret, size_t, size_t);
void ti_diff(char*, char*, int*, int *iret, size_t, size_t);
void ti_dspl(int*, char*, char*, int *iret, size_t, size_t);
void ti_dst(int*, char*, int*, int *iret);
void ti_dtm4(char*, char*, int *iret, size_t, size_t);
void ti_elcl(char*, char*, char*, int *iret, size_t, size_t, size_t);
void ti_find(char*, int*, char*, char*, int*, char*, int *iret, size_t, size_t,
size_t, size_t);
void ti_form(char*, char*, int *iret, size_t, size_t);
void ti_i2c(int*, int*, int*, char*, int *iret, size_t);
void ti_idtm(char *dattim, int*, int*, int *iret, size_t);
void ti_itoc(int*, char*, int *iret, size_t);
void ti_itoj(int*, int*, int*, int *iret);
void ti_jtoi(int*, int*, int*, int *iret);
void ti_mdif(int*, int*, int*, int *iret);
void cti_mtch(int match, const char *dattim, const char **times, int ntime,
int minute, int *ipos, int *iret);
void ti_mtch(int*, char *dattim, char*, int*, int*, int*, int *iret, size_t,
size_t);
void ti_mtchw(int*, char*, char*, int*, int*, int*, int *iret, size_t, size_t);
void cti_rseq(int, char**, char**);
void ti_rseq(int*, char*, char*, int *iret, size_t, size_t);
void ti_sort(int*, char*, char*, int *iret, size_t, size_t);
void ti_stan(char*, char*, char*, int *iret, size_t, size_t, size_t);
void ti_stnt(char *dattim, int*, char*, int *iret, size_t, size_t);
void ti_subd(int*, int*, int *iret);
void ti_subm(int*, int*, int*, int *iret);
void cti_tmln(char **timin, int nin, int mrange, int intrvl, int idir,
int iflag, int iauto, char *basetm, char *endtim, int *idelrt,
char **timout, int *ntime, int *iret);
void ti_tzdf(int*, char*, char*, int*, float*, int *iret, size_t, size_t);
void ti_yy24(int*, int*, int *iret);
void ti_yymd(int*, int*, int *iret);
void cti_yyyy(int ntime, char **timin, char **outime, int *iret);
void ti_yyyy(int*, char*, char*, int *iret, size_t, size_t);
/* TM library */
void tm_accp(int*);
void tm_str(char*, int*, int*, char*, int*, size_t, size_t);
/*=====================================================================*/
/* GPLT functions */
void gcbar(char *clrbar, int *nflvl, float *flvl, int *ifcolr, int *iret,
size_t);
void gclear(int *iret);
void gclpnl(float*, float*, float*, float*, int *iret);
void gdpltb(int *iframe, char *prfxtt, int *iret, size_t);
void gdpstp(char *pname, char *s, int *iret, size_t, size_t);
void gdpstt(char *lparm, int *value, int *iret, size_t);
void gdptmc(char *gdatim, char *gdfile, char *cycle, char *sep, int *maxlen,
int *ntimes, char *timstr, int *length, int *iret, size_t, size_t,
size_t, size_t, size_t);
void genanm(int *iret);
void gendp(int *ieop, int *iret);
void geplot(int*);
void getmap(int *maptyp, int *mxelts, int *mxpts, int *nelts, int *npts,
int *ielts, float *xlats, float *ylons, int *iret);
void ggapsm(float*, float*, int*, int*, int*, int*, int*, int*, float*, float*,
int*, int *iret);
void ggdriv(float *grid, float *grid1, int *kx, int *ky, float *hist,
float *work1, float *work2, float *work3, float *buffer, int *rspflg,
int *iret);
void ggsave(char*, int *iframe, int *nframe, int *iret, G_Cardinal);
void ggtpnt(char *sys, int *ityp, float *x, float *y, int *iret, size_t);
void ginitp(int *mode, int *istat, int *iret);
void gqbnd(char *sys, float*, float*, float*, float*, int *iret, size_t);
void gqcvsc(float *dvcvsc, int *iret);
void gqgprj(char *proj, float*, float*, float*, int*, int*, float*, float*,
float*, float*, int *iret, size_t);
void gqmprj(char *proj, float*, float*, float*, float*, float*, float*, float*,
int *iret, size_t);
void groam(int *ityp, char *sys, float *x, float *y, int *iret, size_t);
void gsdeva(char*, int*, char*, int*, float*, float*, int *iret, ...);
void gsatim(char*, int*, size_t);
void gsgprj(char *, float *, float *, float *, int *, int *, float *, float*,
float*, float*, int *iret, size_t);
void gsgraf(int*, int*, float*, float*, float*, float*, float*, int *iret);
void gsgtgn(int*, int*, int*);
void gsicmn(int *iret);
void gslwin(char *wname, int *iret, size_t);
void gsmfil(char *mapfil, int *iret, size_t);
void gsmprj(char *proj, float*, float*, float*, float*, float*, float*, float*,
int *iret, size_t);
void gsplot(int *iret);
void gstanm(int *iret);
void gsview(float*, float*, float*, float*, int *iret);
void gqarrw(float*, float*, int*, int*, int*);
void gsarrw(float*, float*, int*, int*, int*);
void gqbarb(float*, int*, int*, int*);
void gsbarb(float*, int*, int*, int*);
void gsbrgb(int *icbank, int *ncolr, int *icolrs, int *reds, int *igrns,
int *iblus, int *iret);
void gqclr2(int*, int*, int*);
void gsclr2(int*, int*, int*);
void gqcmbo(float*, int*, int*);
void gscmbo(float*, int*, int*);
void gqcolr(int*, int*);
void gscolr(int*, int*);
void gscrgb(int*, int*, int*, int*, int*);
void gqctyp(float*, int*, int*);
void gsctyp(float*, int*, int*);
void gqdarr(float*, float*, int*, int*, int*);
void gsdarr(float*, float*, int*, int*, int*);
void gqdatt(int*, char*, int*, float*, float*, int*, int *iret, size_t);
void gqfill(float*, int*, int*);
void gsfill(float*, int*, int*);
void gqfrnt(int*, float*, int*, int*, int*);
void gsfrnt(int*, float*, int*, int*, int*);
void gqhash(float*, int*, int*, int*);
void gshash(float*, int*, int*, int*);
void gqicng(float*, int*, int*);
void gsicng(float*, int*, int*);
void gqline(int*, int*, int*, int*, int*);
void gsline(int*, int*, int*, int*, int*);
void gqmrkr(int*, int*, float*, int*, int*);
void gsmrkr(int*, int*, float*, int*, int*);
void gqptnd(float*, int*, int*);
void gsptnd(float*, int*, int*);
void gqpwth(float*, int*, int*);
void gspwth(float*, int*, int*);
void gqsizd(float*, float*, float*, float*, float*, float*, int *iret);
void gqsky(float*, int*, int*, int*);
void gssky(float*, int*, int*, int*);
void gqsmth(int*, float*, int*);
void gssmth(int*, float*, int*);
void gqspcl(float*, int*, int*);
void gsspcl(float*, int*, int*);
void gqspln(int*, int*, int*, float*, int*, int*);
void gsspln(int*, int*, int*, float*, int*, int*);
void gqtext(int*, int*, float*, int*, int*, int*, int*, int*);
void gstext(int*, int*, float*, int*, int*, int*, int*, int*);
void gqturb(float*, int*, int*);
void gsturb(float*, int*, int*);
void gqwthr(float*, int*, int*);
void gswthr(float*, int*, int*);
void garrw(char*, int*, float*, float*, float*, float*, int*, size_t);
void gbarb(char*, int*, float*, float*, float*, float*, int*, size_t);
void gcircl(char*, float*, float*, float*, float*, int*, int*, size_t);
void gcmbo(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gctyp(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gdarr(char*, int*, float*, float*, float*, int*, size_t);
void gfill(char*, int*, float*, float*, int*, size_t);
void gfrnt(char*, int*, float*, float*, int*, size_t);
void ghash(char*, int*, float*, float*, float*, int*, size_t);
void gicng(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gline(char*, int*, float*, float*, int*, size_t);
void glogo(char *sys, float *x, float *y, float *size, int *iclmod, int *ilogo,
int *iret, size_t);
void gmark(char*, int*, float*, float*, int*, size_t);
void gmesg(char*, int*, size_t);
void gptnd(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gpwth(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gplbnd(char*, int*, float*, int*, float*, int*, int*, int*, int*, char*,
int*, int*, float*, int*, int*, size_t, size_t);
void gsky(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gspcl(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gspln(char*, int*, float*, float*, int*, size_t);
void gsroam(int *irmflg, int *ipwdth, int *iphght, int *iret);
void gtext(char*, float*, float*, char*, float*, int*, int*, int*, size_t,
size_t);
void gtextc(char *sys, float *x, float *y, char *cchar, float *rotat,
int *ixoff, int *iyoff, int *iret, size_t, size_t);
void gtrans(char*, char*, int*, float*, float*, float*, float*, int*, size_t,
size_t);
void gturb(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void gtxsy(char*, int*, int*, int*, int*, int*, float*, float*, float*, char*,
int*, size_t, size_t);
void gwthr(char*, int*, float*, float*, float*, int*, int*, int*, size_t);
void oabsdr(float *gelat, float *gelon, float *coslat, float *data,
int *infoflg, int *iret);
/* G2G library */
void gg_update(char *vname, char *iname, int *cur_layer, char *catmap,
int *plt_ext, int *iret);
void gg_rdvgf(char *vname, char *iname, char *catmap, int *iret);
| 52.149616 | 98 | 0.5954 |
18b841930d275ee13a59dbcc9483fc9b37b0dd66 | 620 | c | C | cil/test/small1/const1.c | petr-muller/abductor | 4c9199378e847e22660daab5e5843805d4035d0a | [
"Intel",
"Unlicense"
] | 266 | 2015-01-23T16:06:52.000Z | 2022-03-17T19:49:34.000Z | cil/test/small1/const1.c | petr-muller/abductor | 4c9199378e847e22660daab5e5843805d4035d0a | [
"Intel",
"Unlicense"
] | 93 | 2015-07-31T21:38:04.000Z | 2022-03-24T03:21:34.000Z | cil/test/small1/const1.c | petr-muller/abductor | 4c9199378e847e22660daab5e5843805d4035d0a | [
"Intel",
"Unlicense"
] | 73 | 2015-01-11T17:06:17.000Z | 2022-02-21T06:20:37.000Z | #include "testharness.h"
unsigned long long x1 = 0xff00000000000000ULL;
int main() {
// We'll use shift left to test for sign
if((2147483647 /* 2^31 - 1 */ >> 31) != 0) E(1); // Should be signed
if(((2147483647 + 1) >> 31) != -1) E(2); // Should be signed int
// Should be signed long long, but both GCC and MSVC treat it as unsigned int
if((2147483648 /* 2^31 */ >> 31) != 1) E(3);
if(((2147483647U + 1) >> 31) != 1) E(4); // Should be unsigned signed int
if(x1 >> 56 != 255) E(5);
// now see if constant folding misbehaves
if(0xff00000000000000ULL >> 56 != 255) E(6);
SUCCESS;
}
| 22.142857 | 79 | 0.593548 |
a53acf9ceb7a7f624a23f0434863305f9281127f | 2,426 | h | C | src/app/settings/dialogsettings.h | botorabi/Meet4Eat-Desktop | a3f27df5ab4b4697fcb5682900f48716b2021869 | [
"MIT"
] | 1 | 2018-03-20T08:21:34.000Z | 2018-03-20T08:21:34.000Z | src/app/settings/dialogsettings.h | botorabi/Meet4Eat-Desktop | a3f27df5ab4b4697fcb5682900f48716b2021869 | [
"MIT"
] | 2 | 2018-03-15T10:13:59.000Z | 2018-03-15T10:20:15.000Z | src/app/settings/dialogsettings.h | botorabi/Meet4Eat-Desktop | a3f27df5ab4b4697fcb5682900f48716b2021869 | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2017 by Botorabi. All rights reserved.
* https://github.com/botorabi/Meet4Eat
*
* License: MIT License (MIT), read the LICENSE text in
* main directory for more details.
*/
#ifndef DIALOGSETTINGS_H
#define DIALOGSETTINGS_H
#include <configuration.h>
#include <user/userauth.h>
#include <webapp/webapp.h>
#include <common/basedialog.h>
namespace Ui {
class WidgetSettings;
}
namespace m4e
{
namespace settings
{
/**
* @brief Class for app settings dialog
*
* @author boto
* @date Sep 12, 2017
*/
class DialogSettings : public common::BaseDialog
{
/**
* @brief TAG Used for logging
*/
const std::string TAG = "(DialogSettings) ";
Q_OBJECT
public:
/**
* @brief Dialog buttons
*/
enum Buttons
{
BtnOk = common::BaseDialog::Btn1
};
/**
* @brief Create a settings dialog instance.
*
* @param p_webApp Web application interface
* @param p_parent Parent widget
*/
explicit DialogSettings( webapp::WebApp* p_webApp, QWidget* p_parent );
/**
* @brief Destroy the instance.
*/
virtual ~DialogSettings();
protected slots:
/**
* @brief Overridden method for handling Apply button click
*/
virtual bool onButton1Clicked();
void onBtnSignInClicked();
void onBtnSignOutClicked();
void onLinkActivated( QString link );
/**
* @brief This signal is received to notify about user authentication results.
*
* @param success true if the user was successfully authenticated, otherwise false
* @param userId User ID, valid if success is true
*/
void onUserSignedIn( bool success, QString userId );
protected:
void showEvent( QShowEvent* p_event );
void setupUI();
void storeCredentials();
bool validateInput();
Ui::WidgetSettings* _p_ui = nullptr;
webapp::WebApp* _p_webApp = nullptr;
};
} // namespace settings
} // namespace m4e
#endif // DIALOGSETTINGS_H
| 23.326923 | 98 | 0.537098 |
9d1689f1380a214d063bc44fbcd9c1592acd81fa | 189 | h | C | Pods/Target Support Files/Pods-ProxImagesUITests/Pods-ProxImagesUITests-umbrella.h | larsacus/ProxImages | fa086480811067ba52eb316dab1cd582664e9be9 | [
"MIT"
] | null | null | null | Pods/Target Support Files/Pods-ProxImagesUITests/Pods-ProxImagesUITests-umbrella.h | larsacus/ProxImages | fa086480811067ba52eb316dab1cd582664e9be9 | [
"MIT"
] | null | null | null | Pods/Target Support Files/Pods-ProxImagesUITests/Pods-ProxImagesUITests-umbrella.h | larsacus/ProxImages | fa086480811067ba52eb316dab1cd582664e9be9 | [
"MIT"
] | null | null | null | #ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
FOUNDATION_EXPORT double Pods_ProxImagesUITestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_ProxImagesUITestsVersionString[];
| 21 | 76 | 0.857143 |
ae447deae368ad5543bcfcf17c8f5bcac5ac4cf6 | 1,692 | h | C | include/Texture.h | sujeong-choi/2020-1-OSSP2-CarpeDiem-5 | f6873e347aac05598e7d3e3a5d7547b9e82555ac | [
"MIT"
] | 24 | 2015-02-02T15:36:59.000Z | 2022-01-29T01:32:32.000Z | include/Texture.h | sujeong-choi/2020-1-OSSP2-CarpeDiem-5 | f6873e347aac05598e7d3e3a5d7547b9e82555ac | [
"MIT"
] | 20 | 2020-04-14T06:25:36.000Z | 2020-06-21T09:01:01.000Z | include/Texture.h | kyureekim/2020-1-OSSP2-CarpeDiem-5 | 646560fb22301c77282756b71c497adfb12dbfa8 | [
"MIT"
] | 9 | 2015-02-21T04:07:33.000Z | 2021-03-25T19:56:30.000Z | /*******************************************************************//*
* This class encapsulates functionality functionality for textures
*
* @author Brandon To
* @version 1.0
* @since 2015-02-05
* @modified 2015-02-19
*********************************************************************/
#ifndef SPACESHOOTER_TEXTURE_
#define SPACESHOOTER_TEXTURE_
#include <string>
#include <vector>
#ifdef _WIN32
#include <SDL.h>
#endif
#ifdef __linux
#include <SDL2/SDL.h>
#endif
#define OPAQUE 255
struct WindowElements;
class Texture
{
private:
//Fields
WindowElements* windowElements;
SDL_Texture* sprite;
SDL_Rect sourceRect;
int spriteWidth;
int spriteHeight;
double angle;
int alpha;
bool alphaEnabled;
std::vector<SDL_Rect> animationRect;
int currentAnimationFrame;
bool partitioned;
public:
//Constructor
Texture(WindowElements* windowElements);
//Destructor
~Texture();
//Methods
void setTexture(std::string imagePath);
void setTexture(SDL_Texture* texture);
SDL_Texture* getTexture();
void setSourceRect(SDL_Rect* rect);
SDL_Rect getSourceRect();
int getSpriteWidth();
int getSpriteHeight();
void setAngle(double angle);
double getAngle();
void enableAlphaBlend();
void disableAlphaBlend();
void setAlphaBlend(Uint8 alpha);
Uint8 getAlphaBlend();
bool partitionSpritesheet(std::string xmlPath);
bool advanceAnimation();
bool setAnimationFrame(int animationFrame);
};
#endif
| 22.263158 | 71 | 0.578014 |
0ee8a2b0baebfcb926c3e7361272a4bc478f7162 | 346 | h | C | Classes/scenes/MainMenuScene.h | m-peko/CrazyFlappyBird | 351819a063cb0d9f79478ade03f9cd03e1e9d74f | [
"MIT"
] | 5 | 2017-12-05T18:41:42.000Z | 2021-11-03T11:24:26.000Z | Classes/scenes/MainMenuScene.h | m-peko/CrazyFlappyBird | 351819a063cb0d9f79478ade03f9cd03e1e9d74f | [
"MIT"
] | 1 | 2020-07-15T15:55:01.000Z | 2020-07-20T06:54:48.000Z | Classes/scenes/MainMenuScene.h | m-peko/CrazyFlappyBird | 351819a063cb0d9f79478ade03f9cd03e1e9d74f | [
"MIT"
] | 1 | 2020-11-04T12:50:42.000Z | 2020-11-04T12:50:42.000Z | #ifndef __MAINMENU_SCENE_H__
#define __MAINMENU_SCENE_H__
#include "cocos2d.h"
class MainMenu : public cocos2d::Scene
{
private:
void goToGame();
public:
static cocos2d::Scene* createScene();
virtual bool init();
// implement the "static create()" method manually
CREATE_FUNC(MainMenu);
};
#endif // __MAINMENU_SCENE_H__
| 17.3 | 54 | 0.719653 |
164fe25f308a43198c1848829d82d0d0340c0e62 | 102 | c | C | lldb/test/API/macosx/macCatalystAppMacOSFramework/main.c | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 2,338 | 2018-06-19T17:34:51.000Z | 2022-03-31T11:00:37.000Z | lldb/test/API/macosx/macCatalystAppMacOSFramework/main.c | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | lldb/test/API/macosx/macCatalystAppMacOSFramework/main.c | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 500 | 2019-01-23T07:49:22.000Z | 2022-03-30T02:59:37.000Z | #include "foo.h"
int main() {
const char *s = "Hello macCatalyst!";
return foo(); // break here
}
| 17 | 39 | 0.607843 |
8b73dfe603609afc3b8a0c5142b01f30631a67c4 | 3,485 | h | C | MacOS/Sources/Application/Preferences_Dialog/Edit_Identities/CEditIdentityOptions.h | mulberry-mail/mulberry4-client | cdaae15c51dd759110b4fbdb2063d0e3d5202103 | [
"ECL-2.0",
"Apache-2.0"
] | 12 | 2015-04-21T16:10:43.000Z | 2021-11-05T13:41:46.000Z | MacOS/Sources/Application/Preferences_Dialog/Edit_Identities/CEditIdentityOptions.h | mulberry-mail/mulberry4-client | cdaae15c51dd759110b4fbdb2063d0e3d5202103 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2015-11-02T13:32:11.000Z | 2019-07-10T21:11:21.000Z | MacOS/Sources/Application/Preferences_Dialog/Edit_Identities/CEditIdentityOptions.h | mulberry-mail/mulberry4-client | cdaae15c51dd759110b4fbdb2063d0e3d5202103 | [
"ECL-2.0",
"Apache-2.0"
] | 6 | 2015-01-12T08:49:12.000Z | 2021-03-27T09:11:10.000Z | /*
Copyright (c) 2007 Cyrus Daboo. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.
*/
// Header for CEditIdentityOptions class
#ifndef __CEDITIDENTITYOPTIONS__MULBERRY__
#define __CEDITIDENTITYOPTIONS__MULBERRY__
#include "CPrefsTabSubPanel.h"
#include "cdstring.h"
#include <LListener.h>
// Constants
// Panes
const PaneIDT paneid_EditIdentityOptions = 5108;
const PaneIDT paneid_EditIdentityUseCopyTo = 'CBT1';
const PaneIDT paneid_EditIdentityCopyToGroup = 'GRP1';
const PaneIDT paneid_EditIdentityCopyToNone = 'CBT2';
const PaneIDT paneid_EditIdentityCopyToChoose = 'CBT3';
const PaneIDT paneid_EditIdentityCopyTo = 'COPY';
const PaneIDT paneid_EditIdentityCopyToPopup = 'COPM';
const PaneIDT paneid_EditIdentityCopyToActive = 'COPA';
const PaneIDT paneid_EditIdentityCopyReplied = 'ALSO';
const PaneIDT paneid_EditIdentityHeader = 'HEAD';
const PaneIDT paneid_EditIdentityHeaderActive = 'HEAA';
const PaneIDT paneid_EditIdentityHeaderGroup = 'GRP2';
const PaneIDT paneid_EditIdentityFooter = 'FOOT';
const PaneIDT paneid_EditIdentityFooterActive = 'FOOA';
const PaneIDT paneid_EditIdentityFooterGroup = 'GRP3';
// Mesages
const MessageT msg_IdentityHeader = 5150;
const MessageT msg_IdentityFooter = 5151;
const MessageT msg_IdentityServerDefault = 'SERA';
const MessageT msg_IdentityUseCopyTo = 'CBT1';
const MessageT msg_IdentityCopyToNone = 'CBT2';
const MessageT msg_IdentityCopyToChoose = 'CBT3';
const MessageT msg_IdentityCopyToPopup = 'COPM';
const MessageT msg_IdentityCopyToActive = 'COPA';
const MessageT msg_IdentityHeaderActive = 'HEAA';
const MessageT msg_IdentityFooterActive = 'FOOA';
// Resources
const ResIDT RidL_CEditIdentityOptionsBtns = 5108;
// Classes
class LCheckBoxGroupBox;
class LCheckBox;
class CMailboxPopup;
class CTextFieldX;
class LRadioButton;
class LBevelButton;
class CEditIdentityOptions : public CPrefsTabSubPanel,
public LListener
{
private:
LCheckBoxGroupBox* mCopyToActive;
LRadioButton* mUseCopyTo;
LRadioButton* mCopyToNone;
LRadioButton* mCopyToChoose;
CTextFieldX* mCopyTo;
CMailboxPopup* mCopyToPopup;
LCheckBox* mCopyReplied;
LCheckBoxGroupBox* mHeaderActive;
LBevelButton* mHeaderBtn;
LCheckBoxGroupBox* mFooterActive;
LBevelButton* mFooterBtn;
cdstring mHeader;
cdstring mFooter;
public:
enum { class_ID = 'Ieop' };
CEditIdentityOptions();
CEditIdentityOptions(LStream *inStream);
virtual ~CEditIdentityOptions();
protected:
virtual void FinishCreateSelf(void); // Do odds & ends
public:
virtual void ListenToMessage(MessageT inMessage,
void *ioParam); // Respond to clicks in the buttons
virtual void ToggleICDisplay(bool IC_on); // Toggle display of IC
virtual void SetData(void* data); // Set data
virtual void UpdateData(void* data); // Force update of data
private:
virtual void EditHeadFoot(cdstring* text,
bool header); // Edit header or footer
};
#endif
| 30.570175 | 76 | 0.773027 |
e9e42a6a1573a93f3a340407fd93c774db27abfc | 364 | h | C | authenticated_encryption/ta/user_ta_header_defines.h | aman-v1729/optee_automotive_security | 6e86713d6f092fcb07157ea816818f1f0d439d66 | [
"MIT"
] | null | null | null | authenticated_encryption/ta/user_ta_header_defines.h | aman-v1729/optee_automotive_security | 6e86713d6f092fcb07157ea816818f1f0d439d66 | [
"MIT"
] | null | null | null | authenticated_encryption/ta/user_ta_header_defines.h | aman-v1729/optee_automotive_security | 6e86713d6f092fcb07157ea816818f1f0d439d66 | [
"MIT"
] | 1 | 2021-05-20T06:13:03.000Z | 2021-05-20T06:13:03.000Z | #ifndef USER_TA_HEADER_DEFINES_H
#define USER_TA_HEADER_DEFINES_H
#include <authenticated_encryption_ta.h>
#define TA_UUID TA_AUTHENTICATED_ENCRYPTION_UUID
#define TA_FLAGS TA_FLAG_EXEC_DDR
#define TA_STACK_SIZE (2 * 1024)
#define TA_DATA_SIZE (32 * 1024)
#define TA_VERSION "1.0"
#define TA_DESCRIPTION "Trusted Application for Authenticated Encryption"
#endif | 28 | 73 | 0.837912 |
5bfa0e78770fe9b755222e8ff183dc4d27fff156 | 1,131 | h | C | jsUnits/jsRotationPerLength.h | dnv-opensource/Reflection | 27effb850e9f0cc6acc2d48630ee6aa5d75fa000 | [
"BSL-1.0"
] | null | null | null | jsUnits/jsRotationPerLength.h | dnv-opensource/Reflection | 27effb850e9f0cc6acc2d48630ee6aa5d75fa000 | [
"BSL-1.0"
] | null | null | null | jsUnits/jsRotationPerLength.h | dnv-opensource/Reflection | 27effb850e9f0cc6acc2d48630ee6aa5d75fa000 | [
"BSL-1.0"
] | null | null | null | // Copyright (c) 2021 DNV AS
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#ifndef JSROTATIONPERLENGTH_H
#define JSROTATIONPERLENGTH_H
#include <jsUnits/jsUnits_config.h>
#include <jsUnits/jsTQuantity.h>
#include <Units/RotationPerLength.h>
class JSUNITS_IMPORT_EXPORT jsRotationPerLength : public jsTQuantity<jsRotationPerLength>
{
public:
jsRotationPerLength(const DNVS::MoFa::Units::RotationPerLength& value) : jsTQuantity<jsRotationPerLength>(value) {}
jsRotationPerLength(const jsTQuantity<jsRotationPerLength>& value) : jsTQuantity<jsRotationPerLength>(value) {}
jsRotationPerLength(double value = 0, unitType unit = databaseUnit) : jsTQuantity<jsRotationPerLength>(value, unit == databaseUnit) {}
jsRotationPerLength(double value, const std::string& unitName) : jsTQuantity<jsRotationPerLength>(value, unitName) {}
virtual ~jsRotationPerLength() {}
static DNVS::MoFa::Units::Runtime::DynamicPhenomenon GetPhenomenon();
static void init(jsTypeLibrary& typeLibrary);
};
#endif
| 40.392857 | 138 | 0.77542 |
0df3aca118e33100456c976d09f0221aab619834 | 1,734 | h | C | src/ratebuilder.h | EddyRivasLab/R-scape | e7f45f72965737d720e9e52c0eeb87162cde136d | [
"BSD-3-Clause"
] | 2 | 2020-02-03T11:51:08.000Z | 2021-03-19T21:55:49.000Z | src/ratebuilder.h | EddyRivasLab/R-scape | e7f45f72965737d720e9e52c0eeb87162cde136d | [
"BSD-3-Clause"
] | 1 | 2021-02-15T19:06:43.000Z | 2021-02-15T19:06:43.000Z | src/ratebuilder.h | EddyRivasLab/R-scape | e7f45f72965737d720e9e52c0eeb87162cde136d | [
"BSD-3-Clause"
] | null | null | null | /* ratebuilder - Standardized functions for reading a scoring matrix
*
*/
#ifndef RATEBUILDER_INCLUDED
#define RATEBUILDER_INCLUDED
#include <stdio.h> /* FILE */
#include "easel.h"
#include "esl_dmatrix.h"
#include "esl_ratematrix.h"
#include "esl_scorematrix.h"
#include "e1_bg.h"
typedef struct ratebuilder_s {
ESL_SCOREMATRIX *S; /* residue score matrix [Kp x Kp] */
ESL_DMATRIX *P; /* P->mx[a][b] = P(b|a) residue conditions probabilities [K x K] */
ESL_DMATRIX *Q; /* Q->mx[a][b] = log(P(b|a)) the rate matrix [K x K] */
ESL_DMATRIX *E; /* Q->mx[a][b] = E->mx[a][b] * p[b] the exchangeability matrix [K x K] */
double *p; /* marginal probabilites such that p[a] P(b|a) = P(a|b) p[b] [0..k-1]
* this are also the saturation probabilities of the rate matrix */
double lambda;
const ESL_ALPHABET *abc; /* COPY of alphabet */
char errbuf[eslERRBUFSIZE]; /* informative message on model construction failure */
} RATEBUILDER;
extern RATEBUILDER *ratebuilder_Create(const ESL_ALPHABET *abc);
extern int ratebuilder_LoadScoreSystem(RATEBUILDER *bld, const char *matrix, E1_BG *bg, int scaledrate);
extern int ratebuilder_SetScoreSystem(RATEBUILDER *bld, const char *mxfile, const char *env, E1_BG *bg);
extern void ratebuilder_Destroy(RATEBUILDER *bld);
#endif /*RATEBUILDER_INCLUDED*/
/************************************************************
* @LICENSE@
************************************************************/
| 43.35 | 114 | 0.544983 |
3d7ace368181e4b4224ac3d026670b0844241a83 | 1,519 | h | C | wrappers/7.0.0/vtkHeapWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | 6 | 2016-02-03T12:48:36.000Z | 2020-09-16T15:07:51.000Z | wrappers/7.0.0/vtkHeapWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | 4 | 2016-02-13T01:30:43.000Z | 2020-03-30T16:59:32.000Z | wrappers/7.0.0/vtkHeapWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | null | null | null | /* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */
#ifndef NATIVE_EXTENSION_VTK_VTKHEAPWRAP_H
#define NATIVE_EXTENSION_VTK_VTKHEAPWRAP_H
#include <nan.h>
#include <vtkSmartPointer.h>
#include <vtkHeap.h>
#include "vtkObjectWrap.h"
#include "../../plus/plus.h"
class VtkHeapWrap : public VtkObjectWrap
{
public:
using Nan::ObjectWrap::Wrap;
static void Init(v8::Local<v8::Object> exports);
static void InitPtpl();
static void ConstructorGetter(
v8::Local<v8::String> property,
const Nan::PropertyCallbackInfo<v8::Value>& info);
VtkHeapWrap(vtkSmartPointer<vtkHeap>);
VtkHeapWrap();
~VtkHeapWrap( );
static Nan::Persistent<v8::FunctionTemplate> ptpl;
private:
static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfAllocations(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfBlocks(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void IsA(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void Reset(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void StringDup(const Nan::FunctionCallbackInfo<v8::Value>& info);
#ifdef VTK_NODE_PLUS_VTKHEAPWRAP_CLASSDEF
VTK_NODE_PLUS_VTKHEAPWRAP_CLASSDEF
#endif
};
#endif
| 31.645833 | 87 | 0.765635 |
a811a20bc1b25cf3eca6cc7f5e2e0e46a307c796 | 318 | c | C | tutorials/C/recursion/main.c | JustinDFuller/monorepo | 3b8f0bc50215e642ed7ad51ce8c34c984dcb3e90 | [
"MIT"
] | null | null | null | tutorials/C/recursion/main.c | JustinDFuller/monorepo | 3b8f0bc50215e642ed7ad51ce8c34c984dcb3e90 | [
"MIT"
] | 1 | 2019-09-03T00:45:56.000Z | 2019-09-03T00:45:56.000Z | tutorials/C/recursion/main.c | JustinDFuller/monorepo | 3b8f0bc50215e642ed7ad51ce8c34c984dcb3e90 | [
"MIT"
] | null | null | null | #include <stdio.h>
int factorial(unsigned int number) {
int sum = number;
if (sum > 1) {
sum *= factorial(number - 1);
}
return sum;
}
void main() {
/* testing code */
printf("1! = %i\n", factorial(1));
printf("3! = %i\n", factorial(3));
printf("5! = %i\n", factorial(5));
} | 17.666667 | 38 | 0.515723 |
e1b8d53e21e601124eb02109770b5580ee152f44 | 2,959 | h | C | Classes/CoreDataHelper.h | danielbowden/CoreDataHelper | 147126b0a6936ba46148ef0eb5f17a1c6062bd22 | [
"MIT"
] | 2 | 2015-01-17T03:00:52.000Z | 2015-08-05T08:21:30.000Z | Classes/CoreDataHelper.h | danielbowden/CoreDataHelper | 147126b0a6936ba46148ef0eb5f17a1c6062bd22 | [
"MIT"
] | null | null | null | Classes/CoreDataHelper.h | danielbowden/CoreDataHelper | 147126b0a6936ba46148ef0eb5f17a1c6062bd22 | [
"MIT"
] | null | null | null | //
// CoreDataHelper.h
//
// Daniel Bowden
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface CoreDataHelper : NSObject
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (nonatomic, assign) BOOL loggingEnabled;
+ (CoreDataHelper *)sharedManager;
+ (void)initDataStorePath:(NSString *)path;
+ (void)saveContext;
+ (void)rollbackChanges;
//INSERTS
+ (id)insertObject:(NSString *)objectName;
//DELETES
+ (void)deleteObject:(id)object;
+ (void)deleteObjectsNamed:(NSString*)name;
+ (void)deleteObjectsNamed:(NSString *)name
predicate:(NSPredicate*)predicate;
//SELECTS
+ (NSArray *)selectObjectsNamed:(NSString *)name;
+ (NSArray *)selectObjectsNamed:(NSString*)name
predicate:(NSPredicate*)predicate;
+ (NSArray *)selectObjectsNamed:(NSString*)name
predicate:(NSPredicate*)predicate
sortDescriptors:(NSArray*)sortDescriptors
limit:(int)limit;
+ (NSArray *)selectObjectsNamed:(NSString *)name
orderBy:(NSString *)order
ascending:(BOOL)asc;
+ (NSArray *)selectObjectsNamed:(NSString *)name
predicate:(NSPredicate *)predicate
orderBy:(NSString *)order
ascending:(BOOL)asc;
+ (NSManagedObject *)selectObjectNamed:(NSString *)name
predicate:(NSPredicate *)predicate
orderBy:(NSString *)order
ascending:(BOOL)asc;
+ (NSManagedObject *)selectObjectNamed:(NSString *)name
predicate:(NSPredicate *)predicate;
+ (NSManagedObject *)selectObjectNamed:(NSString *)name;
+ (NSManagedObject *)selectObjectNamed:(NSString *)name
orderBy:(NSString *)order
ascending:(BOOL)asc;
+ (NSArray *)selectIdsOfObjectsNamed:(NSString *)name
predicate:(NSPredicate *)predicate;
//COUNTS
+ (NSUInteger)countForObjectsNamed:(NSString *)name
predicate:(NSPredicate *)predicate
includeSubentities:(BOOL)includeSubentities;
+ (NSUInteger)countForObjectsNamed:(NSString *)name
includeSubentities:(BOOL)includeSubentities;
//FETCHED RESULTS CONTROLLERS
+ (NSFetchedResultsController *)fetchedResultsControllerForObjectNamed:(NSString *)name
predicate:(NSPredicate *)predicate
sortDescriptors:(NSArray *)sortDescriptors
sectionNameKeyPath:(NSString *)sectionName;
@end
| 32.877778 | 97 | 0.615411 |
c03a0c620f5162dedc8e17cbc9253cf94fd35ea8 | 3,734 | h | C | Example/Pods/Digits/iOS/DigitsKit.framework/Headers/DGTContactsInvitationDataSource.h | vmouta/VMLogin | 75a82c30ca88ea216fcd53cb9631b5895723f1b3 | [
"MIT"
] | null | null | null | Example/Pods/Digits/iOS/DigitsKit.framework/Headers/DGTContactsInvitationDataSource.h | vmouta/VMLogin | 75a82c30ca88ea216fcd53cb9631b5895723f1b3 | [
"MIT"
] | null | null | null | Example/Pods/Digits/iOS/DigitsKit.framework/Headers/DGTContactsInvitationDataSource.h | vmouta/VMLogin | 75a82c30ca88ea216fcd53cb9631b5895723f1b3 | [
"MIT"
] | null | null | null | //
// DGTContactsInvitationDataSource.h
// DigitsKit
//
// Copyright © 2016 Twitter Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DGTContactsFetcher.h"
@class DGTConfigurableTableViewCell;
@class DGTAddressBookContact;
@class DGTContactsInvitationDataSource;
NS_ASSUME_NONNULL_BEGIN
@protocol DGTContactsInvitationDataSourceDelegate <NSObject>
@optional
/**
* Implement this method if you require additional steps that are outside the
* scope of overriding the configure method on DGTConfigurableTableViewCell.
*/
- (void)contactsInvitationDataSource:(DGTContactsInvitationDataSource *)dataSource
configurableCell:(DGTConfigurableTableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath;
@end
/**
* A drop-in class that conforms to and implements the required UITableViewDataSource protocol
* methods using a generic DGTConfigurableCell.
*/
@interface DGTContactsInvitationDataSource : NSObject <UITableViewDataSource>
/**
* A reference the the class type. The class must be a kind of DGTConfigurableTableViewCell.
* Only one of the cellClass or cellNibName can be set, not both.
*/
@property (nonatomic, strong, nullable) Class cellClass;
/**
* A reference to a UITableView that uses this class as a UITableViewDataSource.
* This must be set in order to use this class as a drop in for UITableViewDataSource.
*/
@property (nonatomic, strong, nullable) UITableView *tableView;
/**
* Responsible for fetching address book data and their current state.
*/
@property (nonatomic, strong) DGTContactsFetcher *contactsFetcher;
/**
* Currently the delegate only has on protocol to conform to if additional functionality
* is required when using a DGTConfigurableTableViewCell.
*/
@property (nonatomic, weak) id<DGTContactsInvitationDataSourceDelegate> delegate;
/**
* Returns an instance of a DGTContactsInvitationDataSource or nil if there is no current digits session.
* This is used as a drop in for UITableViewDataSource.
*/
- (instancetype)init;
/**
* Returns the associated address book contact for the given index path. This method
* returns nil if the index is out of bounds.
*
* @param index An index within the range of the contacts array.
*/
- (DGTAddressBookContact *)contactAtIndex:(NSInteger)index;
/**
* Fetches a list of contacts from the address book and their states from the digits api.
* The result is stored in contacts after the fetch request is made and the same data is
* also available in the parameters of DGTContactFetchCompletionBlock. The contacts
* parameter in DGTContactFetchCompletionBlock contains a list of contacts with either
* a pending, in app or invitable state. If the user has not granted contacts permissions,
* the completion block will pass back an error. The completion block is invoked on the main queue.
*
* @param shouldFetchInAppContactsOnly (required) A boolean flag that determines if only in app contacts
* should be fetched.
*/
- (void)fetchContactsOnlyInApp:(BOOL)shouldFetchInAppContactsOnly
withCompletion:(DGTContactFetchCompletionBlock)completion;
/**
* Implementation of tableView:cellForRowAtIndexPath: UITableViewDataSource method.
* Override this to implement more custom logic with cell configuration.
*/
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
* Implementation of tableView:numberOfRowsInSection: UITableViewDataSource method.
* Override this to implement more custom logic with multiple sections and data sources.
*/
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
@end
NS_ASSUME_NONNULL_END
| 35.903846 | 107 | 0.772898 |
dbfdafaa327b2fa1afa7ac6a6ee3022ca8d5ad2a | 19,715 | c | C | FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libboard_samv7-ek/source/s25fl1.c | JVVJV/FreeRTOS | 2b956b97c76f48053e87b89df39afb2b9426eee5 | [
"MIT"
] | 2,603 | 2019-10-09T04:47:13.000Z | 2022-03-31T13:59:08.000Z | FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libboard_samv7-ek/source/s25fl1.c | JVVJV/FreeRTOS | 2b956b97c76f48053e87b89df39afb2b9426eee5 | [
"MIT"
] | 296 | 2019-11-22T03:29:07.000Z | 2022-03-21T23:23:01.000Z | FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libboard_samv7-ek/source/s25fl1.c | JVVJV/FreeRTOS | 2b956b97c76f48053e87b89df39afb2b9426eee5 | [
"MIT"
] | 1,040 | 2019-09-26T20:18:24.000Z | 2022-03-30T08:12:34.000Z | /* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* 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 disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: 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
* 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.
* ----------------------------------------------------------------------------
*/
/**
* \addtogroup at25d_module S25FL1 driver
* \ingroup lib_spiflash
* The S25FL1 serial dataflash driver is based on the corresponding S25FL1 SPI driver.
* A S25FL1 instance has to be initialized using the Dataflash levle function
* S25FL1D_Configure(). S25FL1 Dataflash can be automatically detected using
* the S25FL1D_FindDevice() function. Then S25FL1 dataflash operations such as
* read, write and erase DF can be launched using S25FL1D_SendCommand function
* with corresponding S25FL1 command set.
*
* \section Usage
* <ul>
* <li> Reads a serial flash device ID using S25FL1D_ReadJedecId().</li>
* <li> Reads data from the S25fl1 at the specified address using S25FL1D_Read().</li>
* <li> Writes data on the S25fl1 at the specified address using S25FL1D_Write().</li>
* <li> Erases all chip using S25FL1D_EraseBlock().</li>
* <li> Erases a specified block using S25FL1D_EraseBlock().</li>
* <li> Poll until the S25fl1 has completed of corresponding operations using
* S25FL1D_IsBusy().</li>
* <li> Retrieves and returns the S25fl1 current using S25FL1D_ReadStatus().</li>
* </ul>
*
* Related files :\n
* \ref at25d.c\n
* \ref at25d.h.\n
*/
/*@{*/
/*@}*/
/**
* \file
*
* Implementation for the S25FL1 Serialflash driver.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include <board.h>
//#include <libspiflash.h>
#include <assert.h>
#include "stdlib.h"
#include "string.h"
static qspiFrame *pDev, *pMem;
#define READ_DEV 0
#define WRITE_DEV 1
/*----------------------------------------------------------------------------
* Local functions
*----------------------------------------------------------------------------*/
static void S25FL1D_DefaultParams(void)
{
pDev->spiMode = QSPI_IFR_WIDTH_SINGLE_BIT_SPI;
pDev->ContinuousRead = 0;
pDev->DataSize = 0;
pDev->DummyCycles = 0;
pDev->InstAddr = 0;
pDev->InstAddrFlag = 0;
pDev->OptionEn = 0;
}
static uint8_t S25FL1D_SendCommand(uint8_t Instr, AccesType ReadWrite)
{
pDev->Instruction = Instr;
QSPI_SendFrame(QSPI, pDev, ReadWrite);
return 0;
}
/**
* \brief Reads and returns the status register of the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*/
static uint8_t S25FL1D_ReadStatus(void)
{
uint8_t status;
pDev->DataSize = 1;
S25FL1D_SendCommand(0x05, READ_DEV);
status = *(pDev->pData);
return status;
}
/**
* \brief Reads and returns the status register of the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*/
static uint8_t S25FL1D_ReadStatus2(void)
{
uint8_t status;
pDev->DataSize = 1;
S25FL1D_SendCommand(0x35, READ_DEV);
status = *(pDev->pData);
return status;
}
/**
* \brief Reads and returns the status register of the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*/
static uint8_t S25FL1D_ReadStatus3(void)
{
uint8_t status;
pDev->DataSize = 1;
S25FL1D_SendCommand(0x33, READ_DEV);
status = *(pDev->pData);
return status;
}
/**
* \brief Wait for transfer to finish calling the SPI driver ISR. (interrupts are disabled)
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*/
static void S25FL1D_IsBusy(void)
{
while(S25FL1D_ReadStatus() & STATUS_RDYBSY);
}
static void S25FL1D_EnableWrite(void)
{
uint8_t status;
status = S25FL1D_ReadStatus();
while(status != STATUS_WEL)
{
pDev->DataSize = 0;
S25FL1D_SendCommand(WRITE_ENABLE, READ_DEV);
status = S25FL1D_ReadStatus();
}
}
static void S25FL1D_DisableWrite(void)
{
uint8_t status;
status = S25FL1D_ReadStatus();
while( (status & STATUS_WEL) != 0)
{
pDev->DataSize = 0;
S25FL1D_SendCommand(WRITE_DISABLE, READ_DEV);
status = S25FL1D_ReadStatus();
}
}
/**
* \brief Writes the given value in the status register of the serial flash device.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param status Status to write.
*/
static void S25FL1D_WriteStatus( uint8_t *pStatus)
{
S25FL1D_EnableWrite();
pDev->DataSize = 3;
pDev->Instruction = WRITE_STATUS;
pDev->pData = pStatus;
QSPI_SendFrame(QSPI, pDev, Device_Write);
S25FL1D_DisableWrite();
}
/**
* \brief Writes the given value in the status register of the serial flash device.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param status Status to write.
*/
static void S25FL1D_WriteVolatileStatus( uint8_t *pStatus)
{
pDev->DataSize = 0;
S25FL1D_SendCommand(0x50, READ_DEV);
pDev->DataSize = 3;
pDev->Instruction = WRITE_STATUS;
pDev->pData = pStatus;
QSPI_SendFrame(QSPI, pDev, Device_Write);
S25FL1D_DisableWrite();
}
/*----------------------------------------------------------------------------
* Global functions
*----------------------------------------------------------------------------*/
void S25FL1D_InitFlashInterface(void)
{
pDev = (qspiFrame *)malloc (sizeof(qspiFrame));
memset(pDev, 0, sizeof(qspiFrame));
pDev->spiMode = QSPI_IFR_WIDTH_SINGLE_BIT_SPI;
pDev->pData = (uint8_t *)malloc (sizeof(uint32_t));
pMem = (qspiFrame *)malloc (sizeof(qspiFrame));
memset(pMem, 0, sizeof(qspiFrame));
pMem->spiMode = QSPI_IFR_WIDTH_SINGLE_BIT_SPI;
pMem->pData = (uint8_t *)malloc (sizeof(uint8_t));
}
/**
* \brief Reads and returns the serial flash device ID.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*/
unsigned int S25FL1D_ReadJedecId(void)
{
unsigned int id = 0;
pDev->DataSize = 3;
S25FL1D_SendCommand(READ_JEDEC_ID, READ_DEV);
id = ( (pDev->pData[0] << 16) || (pDev->pData[1] << 8) || (pDev->pData[2]));
return id;
}
/**
* \brief Enables critical writes operation on a serial flash device, such as sector
* protection, status register, etc.
*
* \para pS25fl1 Pointer to an S25FL1 driver instance.
*/
void S25FL1D_EnableQuadMode(void)
{
uint8_t status[3];
status[0] = S25FL1D_ReadStatus();
status[1] = S25FL1D_ReadStatus2();
status[2] = S25FL1D_ReadStatus3();
while(!(status[1] & STATUS_QUAD_ENABLE))
{
status[1] |= STATUS_QUAD_ENABLE;
S25FL1D_WriteStatus(status);
status[1] = S25FL1D_ReadStatus2();
Wait(50);
}
}
/**
* \brief Enables critical writes operation on a serial flash device, such as sector
* protection, status register, etc.
*
* \para pS25fl1 Pointer to an S25FL1 driver instance.
*/
void S25FL1D_EnableWrap(uint8_t ByetAlign)
{
uint8_t status[3];
status[0] = S25FL1D_ReadStatus();
status[1] = S25FL1D_ReadStatus2();
status[2] = S25FL1D_ReadStatus3();
status[2] = (ByetAlign << 5);
pDev->DataSize = 1;
*(pDev->pData) = status[2];
pDev->DummyCycles = 24;
S25FL1D_SendCommand(WRAP_ENABLE, WRITE_DEV);
pDev->DummyCycles = 0;
S25FL1D_WriteVolatileStatus(status);
status[2] = S25FL1D_ReadStatus3();
Wait(50);
}
void S25FL1D_SoftReset(void)
{
pDev->DataSize = 0;
S25FL1D_SendCommand(SOFT_RESET_ENABLE, READ_DEV);
S25FL1D_SendCommand(SOFT_RESET, READ_DEV);
}
/**
* \brief Unprotects the contents of the serial flash device.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*
* \return 0 if the device has been unprotected; otherwise returns
* S25FL1D_ERROR_PROTECTED.
*/
unsigned char S25FL1D_Unprotect(void)
{
unsigned char status[3];
/* Get the status register value to check the current protection */
status[0]= S25FL1D_ReadStatus();
status[1]= S25FL1D_ReadStatus2();
status[2]= S25FL1D_ReadStatus3();
if ((status[0] & STATUS_SWP) == STATUS_SWP_PROTNONE) {
/* Protection already disabled */
return 0;
}
status[0] &= (!STATUS_SWP);
/* Check if sector protection registers are locked */
if ((status[0] & STATUS_SPRL) == STATUS_SPRL_LOCKED) {
status[0] &= (!STATUS_SPRL);
/* Unprotect sector protection registers by writing the status reg. */
S25FL1D_WriteStatus(status);
}
S25FL1D_WriteStatus(status);
/* Check the new status */
status[0] = S25FL1D_ReadStatus();
if ((status[0] & (STATUS_SPRL | STATUS_SWP)) != 0) {
return ERROR_PROTECTED;
}
else {
return 0;
}
}
/**
* \brief Unprotects the contents of the serial flash device.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*
* \return 0 if the device has been unprotected; otherwise returns
* S25FL1D_ERROR_PROTECTED.
*/
unsigned char S25FL1D_Protect(uint32_t StartAddr, uint32_t Size)
{
unsigned char status[3];
/* Get the status register value to check the current protection */
status[0]= S25FL1D_ReadStatus();
status[1]= S25FL1D_ReadStatus2();
status[2]= S25FL1D_ReadStatus3();
status[0] &= (!STATUS_SWP);
/* Check if sector protection registers are locked */
if ((status[0] & STATUS_SPRL) == STATUS_SPRL_LOCKED) {
status[0] &= (!STATUS_SPRL);
/* Unprotect sector protection registers by writing the status reg. */
S25FL1D_WriteStatus(status);
}
S25FL1D_WriteStatus(status);
/* Check the new status */
status[0] = S25FL1D_ReadStatus();
if ((status[0] & (STATUS_SPRL | STATUS_SWP)) != 0) {
return ERROR_PROTECTED;
}
else {
return 0;
}
}
/**
* \brief Erases all the content of the memory chip.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
*
* \return 0 if the device has been unprotected; otherwise returns
* ERROR_PROTECTED.
*/
unsigned char S25FL1D_EraseChip(void)
{
char wait_ch[4] = {'\\','|','/','-' };
uint8_t i=0;
S25FL1D_EnableWrite();
pDev->DataSize=0;
S25FL1D_SendCommand(CHIP_ERASE_2, READ_DEV);
S25FL1D_ReadStatus();
while(*(pDev->pData) & STATUS_RDYBSY)
{
S25FL1D_ReadStatus();
Wait(500);
printf("Erasing flash memory %c\r", wait_ch[i]);
i++;
if(i==4)
i=0;
}
printf("\rErasing flash memory done..... 100%\n\r");
return 0;
}
/**
*\brief Erases the specified block of the serial firmware dataflash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param address Address of the block to erase.
*
* \return 0 if successful; otherwise returns ERROR_PROTECTED if the
* device is protected or ERROR_BUSY if it is busy executing a command.
*/
unsigned char S25FL1D_EraseSector(unsigned int address)
{
uint8_t status;
uint32_t EraseAddr;
EraseAddr = address;
/* Check that the flash is ready and unprotected */
status = S25FL1D_ReadStatus();
if ((status & STATUS_RDYBSY) != STATUS_RDYBSY_READY) {
TRACE_ERROR("EraseBlock : Flash busy\n\r");
return ERROR_BUSY;
}
else if ((status & STATUS_SWP) != STATUS_SWP_PROTNONE) {
TRACE_ERROR("S25FL1D_EraseBlock : Flash protected\n\r");
return ERROR_PROTECTED;
}
/* Enable critical write operation */
S25FL1D_EnableWrite();
pDev->InstAddrFlag = 1;
pDev->InstAddr = address;
/* Start the block erase command */
S25FL1D_SendCommand(BLOCK_ERASE_4K, WRITE_DEV);
S25FL1D_DefaultParams();
/* Wait for transfer to finish */
S25FL1D_IsBusy();
return 0;
}
/**
*\brief Erases the specified 64KB block of the serial firmware dataflash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param address Address of the block to erase.
*
* \return 0 if successful; otherwise returns ERROR_PROTECTED if the
* device is protected or ERROR_BUSY if it is busy executing a command.
*/
unsigned char S25FL1D_Erase64KBlock( unsigned int address)
{
unsigned char status;
/* Check that the flash is ready and unprotected */
status = S25FL1D_ReadStatus();
if ((status & STATUS_RDYBSY) != STATUS_RDYBSY_READY) {
TRACE_ERROR("S25FL1D_EraseBlock : Flash busy\n\r");
return ERROR_BUSY;
}
else if ((status & STATUS_SWP) != STATUS_SWP_PROTNONE) {
TRACE_ERROR("EraseBlock : Flash protected\n\r");
return ERROR_PROTECTED;
}
/* Enable critical write operation */
S25FL1D_EnableWrite();
pDev->DataSize = 0;
pDev->InstAddrFlag = 1;
pDev->InstAddr = address;
/* Start the block erase command */
S25FL1D_SendCommand(BLOCK_ERASE_64K, WRITE_DEV);
S25FL1D_DefaultParams();
/* Wait for transfer to finish */
S25FL1D_IsBusy();
return 0;
}
/**
* \brief Writes data at the specified address on the serial firmware dataflash. The
* page(s) to program must have been erased prior to writing. This function
* handles page boundary crossing automatically.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param pData Data buffer.
* \param size Number of bytes in buffer.
* \param address Write address.
*
* \return 0 if successful; otherwise, returns ERROR_PROGRAM is there has
* been an error during the data programming.
*/
unsigned char S25FL1D_Write(
uint8_t *pData,
uint32_t size,
uint32_t address)
{
unsigned int pageSize = 256;
unsigned int writeSize;
unsigned int i = 0;
writeSize = size >> 8;
S25FL1D_EnableWrite();
pMem->Instruction = 0x02;
pMem->InstAddrFlag=1; pMem->InstAddr=address;
if(writeSize ==0) // if less than page size
{
pMem->pData = (pData);
pMem->DataSize = size;
QSPI_SendFrameToMem(QSPI, pMem, Device_Write);
}
else // mulptiple pagesize
{
pMem->DataSize = pageSize;
for(i=0; i< writeSize; i++)
{
S25FL1D_EnableWrite();
pMem->pData = pData;
QSPI_SendFrameToMem(QSPI, pMem, Device_Write);
S25FL1D_IsBusy();
pData += pageSize;
pMem->InstAddr += pageSize;
memory_barrier();
}
if((writeSize * pageSize) < size)
{
S25FL1D_EnableWrite();
pMem->DataSize = (size - (writeSize * pageSize)) ;
pMem->pData = pData;
QSPI_SendFrameToMem(QSPI, pMem, Device_Write);
S25FL1D_IsBusy();
}
}
S25FL1D_DisableWrite();
return 0;
}
/**
* \brief Reads data from the specified address on the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param pData Data buffer.
* \param size Number of bytes to read.
* \param address Read address.
*
* \return 0 if successful; otherwise, fail.
*/
unsigned char S25FL1D_Read(
uint8_t *pData,
uint32_t size,
uint32_t address)
{
pMem->Instruction = READ_ARRAY_LF;
pMem->InstAddrFlag=1; pMem->InstAddr=address;
pMem->pData = pData;
pMem->DataSize = size;
pMem->DummyCycles = 0;
pMem->spiMode = QSPI_IFR_WIDTH_SINGLE_BIT_SPI;
QSPI_SendFrameToMem(QSPI, pMem, Device_Read);
return 0;
}
/**
* \brief Reads data from the specified address on the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param pData Data buffer.
* \param size Number of bytes to read.
* \param address Read address.
*
* \return 0 if successful; otherwise, fail.
*/
unsigned char S25FL1D_ReadDual(
uint8_t *pData,
uint32_t size,
uint32_t address)
{
pMem->Instruction = READ_ARRAY_DUAL;
pMem->InstAddrFlag=1; pMem->InstAddr=address;
pMem->pData = pData;
pMem->DataSize = size;
pMem->DummyCycles = 8;
pMem->spiMode = QSPI_IFR_WIDTH_DUAL_OUTPUT;
QSPI_SendFrameToMem(QSPI, pMem, Device_Read);
return 0;
}
/**
* \brief Reads data from the specified address on the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param pData Data buffer.
* \param size Number of bytes to read.
* \param address Read address.
*
* \return 0 if successful; otherwise, fail.
*/
unsigned char S25FL1D_ReadQuad(
uint8_t *pData,
uint32_t size,
uint32_t address)
{
pMem->Instruction = READ_ARRAY_QUAD;
pMem->InstAddrFlag=1; pMem->InstAddr=address;
pMem->pData = pData;
pMem->DataSize = size;
pMem->DummyCycles = 8;
pMem->spiMode = QSPI_IFR_WIDTH_QUAD_OUTPUT;
QSPI_SendFrameToMem(QSPI, pMem, Device_Read);
return 0;
}
/**
* \brief Reads data from the specified address on the serial flash.
*
* \param pS25fl1 Pointer to an S25FL1 driver instance.
* \param pData Data buffer.
* \param size Number of bytes to read.
* \param address Read address.
*
* \return 0 if successful; otherwise, fail.
*/
unsigned char S25FL1D_ReadQuadIO(
uint8_t *pData,
uint32_t size,
uint32_t address,
uint8_t ContMode)
{
pMem->Instruction = READ_ARRAY_QUAD_IO;
pMem->InstAddrFlag=1;
pMem->InstAddr=address;
pMem->pData = pData;
pMem->DataSize = size;
pMem->DummyCycles = 6;
if(ContMode)
{
pMem->OptionLen = QSPI_IFR_OPTL_OPTION_4BIT;
pMem->Option = 0x2;
pMem->ContinuousRead = ContMode;
pMem->DummyCycles = 5;
pMem->OptionEn = ContMode;
}
pMem->spiMode = QSPI_IFR_WIDTH_QUAD_IO;
QSPI_SendFrameToMem(QSPI, pMem, Device_Read);
pMem->OptionEn = 0;
pMem->ContinuousRead = 0;
return 0;
}
| 27.268326 | 92 | 0.616181 |
33c64db315ac4fdc2099a06df4c1312bd8f3bbf7 | 26,008 | c | C | liboil/i386/composite_i386.c | PPCDroid/external-liboil | 30c33c74706cc8cebe4f74c552d75d632eef02be | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause"
] | 1 | 2018-04-28T07:47:28.000Z | 2018-04-28T07:47:28.000Z | liboil/i386/composite_i386.c | PPCDroid/external-liboil | 30c33c74706cc8cebe4f74c552d75d632eef02be | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause"
] | null | null | null | liboil/i386/composite_i386.c | PPCDroid/external-liboil | 30c33c74706cc8cebe4f74c552d75d632eef02be | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause"
] | null | null | null | /*
* LIBOIL - Library of Optimized Inner Loops
* Copyright (c) 2005 David A. Schleef <ds@schleef.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <liboil/liboil.h>
#include <liboil/liboilfunction.h>
OIL_DECLARE_CLASS (composite_in_argb);
OIL_DECLARE_CLASS (composite_in_argb_const_src);
OIL_DECLARE_CLASS (composite_in_argb_const_mask);
OIL_DECLARE_CLASS (composite_over_argb);
OIL_DECLARE_CLASS (composite_over_argb_const_src);
OIL_DECLARE_CLASS (composite_add_argb);
OIL_DECLARE_CLASS (composite_add_argb_const_src);
OIL_DECLARE_CLASS (composite_in_over_argb);
OIL_DECLARE_CLASS (composite_in_over_argb_const_src);
OIL_DECLARE_CLASS (composite_in_over_argb_const_mask);
#if 0
static void
composite_in_argb_mmx (uint32_t *dest, uint32_t *src, uint8_t *mask, int n)
{
int i;
for(i=0;i<n;i++){
dest[i] = ARGB(
COMPOSITE_IN(ARGB_A(src[i]), mask[i]),
COMPOSITE_IN(ARGB_R(src[i]), mask[i]),
COMPOSITE_IN(ARGB_G(src[i]), mask[i]),
COMPOSITE_IN(ARGB_B(src[i]), mask[i]));
}
}
OIL_DEFINE_IMPL_FULL (composite_in_argb_mmx, composite_in_argb);
#endif
/*
* This macro loads the constants:
* mm7 = { 0, 0, 0, 0 }
* mm6 = { 128, 128, 128, 128 }
* mm5 = { 255, 255, 255, 255 }
*/
#define MMX_LOAD_CONSTANTS \
" pxor %%mm7, %%mm7\n" \
" movl $0x80808080, %%eax\n" \
" movd %%eax, %%mm6\n" \
" punpcklbw %%mm7, %%mm6\n" \
" movl $0xffffffff, %%eax\n" \
" movd %%eax, %%mm5\n" \
" punpcklbw %%mm7, %%mm5\n"
/*
* a = muldiv255(a, b)
* a, b are unpacked
* destroys both registers
* requires mm6 set up as above
*/
#define MMX_MULDIV255(a,b) \
" pmullw %%" #b ", %%" #a "\n" \
" paddw %%mm6, %%" #a "\n" \
" movq %%" #a ", %%" #b "\n" \
" psrlw $8, %%" #b "\n" \
" paddw %%" #b ", %%" #a "\n" \
" psrlw $8, %%" #a "\n"
static void
composite_in_argb_mmx (uint32_t *dest, uint32_t *src, const uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
"1:\n"
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm1\n"
" movd (%1), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $4, %1\n"
" addl $1, %2\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_argb_mmx, composite_in_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
/*
* This is a different style than the others. Should be moved elsewhere.
*/
static void
composite_in_argb_mmx2 (uint32_t *dest, uint32_t *src, const uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
"1:\n"
" movl (%2), %%eax\n"
/* if alpha == 0, write a 0 */
" testl $0x000000ff, %%eax\n"
" je 2f\n"
/* if alpha == 0xff, write src value */
" cmp $0xff, %%al\n"
" je 3f\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm1\n"
" movd (%1), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" jmp 4f\n"
"2:\n"
" movl $0, (%0)\n"
" jmp 4f\n"
"3:\n"
" movl (%1), %%eax\n"
" movl %%eax, (%0)\n"
"4:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" addl $1, %2\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_argb_mmx2, composite_in_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_in_argb_const_src_mmx (uint32_t *dest, uint32_t *src, const uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" movd (%1), %%mm3\n"
" punpcklbw %%mm7, %%mm3\n"
"1:\n"
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm1\n"
" movq %%mm3, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $1, %2\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_argb_const_src_mmx, composite_in_argb_const_src, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_in_argb_const_mask_mmx (uint32_t *dest, uint32_t *src, const uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm3\n"
"1:\n"
" movq %%mm3, %%mm1\n"
" movd (%1), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_argb_const_mask_mmx, composite_in_argb_const_mask, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_over_argb_mmx (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm0, %%mm1\n"
" pxor %%mm5, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_mmx, composite_over_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
/* unroll 2 */
static void
composite_over_argb_mmx_2 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" testl $0x1, %2\n"
" jz 2f\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 1f\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm0, %%mm1\n"
" pxor %%mm5, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
" pmullw %%mm1, %%mm2\n"
" paddw %%mm6, %%mm2\n"
" movq %%mm2, %%mm1\n"
" psrlw $8, %%mm1\n"
" paddw %%mm1, %%mm2\n"
" psrlw $8, %%mm2\n"
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
"1:\n"
" addl $4, %0\n"
" addl $4, %1\n"
"2:\n"
" shr $1, %2\n"
" jz 5f\n"
"3:\n"
" movl (%1), %%eax\n"
" orl 4(%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 4f\n"
" movd (%1), %%mm0\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm0\n"
" movd 4(%1), %%mm3\n"
" pshufw $0xff, %%mm0, %%mm1\n"
" punpcklbw %%mm7, %%mm2\n"
" pxor %%mm5, %%mm1\n"
" movd 4(%0), %%mm4\n"
" pmullw %%mm1, %%mm2\n"
" punpcklbw %%mm7, %%mm3\n"
" paddw %%mm6, %%mm2\n"
" punpcklbw %%mm7, %%mm4\n"
" movq %%mm2, %%mm1\n"
" pshufw $0xff, %%mm3, %%mm7\n"
" psrlw $8, %%mm1\n"
" pxor %%mm5, %%mm7\n"
" paddw %%mm1, %%mm2\n"
" pmullw %%mm7, %%mm4\n"
" psrlw $8, %%mm2\n"
" paddw %%mm6, %%mm4\n"
" paddw %%mm0, %%mm2\n"
" movq %%mm4, %%mm7\n"
" packuswb %%mm2, %%mm2\n"
" psrlw $8, %%mm7\n"
" movd %%mm2, (%0)\n"
" paddw %%mm7, %%mm4\n"
" psrlw $8, %%mm4\n"
" paddw %%mm3, %%mm4\n"
" packuswb %%mm4, %%mm4\n"
" movd %%mm4, 4(%0)\n"
" pxor %%mm7, %%mm7\n"
"4:\n"
" addl $8, %0\n"
" addl $8, %1\n"
" decl %2\n"
" jnz 3b\n"
"5:\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_mmx_2, composite_over_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
/* replace pshufw with punpck */
static void
composite_over_argb_mmx_3 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" movq %%mm0, %%mm1\n"
" punpckhwd %%mm1, %%mm1\n"
" punpckhdq %%mm1, %%mm1\n"
" pxor %%mm5, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
" pmullw %%mm1, %%mm2\n"
" paddw %%mm6, %%mm2\n"
" movq %%mm2, %%mm1\n"
" psrlw $8, %%mm1\n"
" paddw %%mm1, %%mm2\n"
" psrlw $8, %%mm2\n"
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_mmx_3, composite_over_argb, OIL_IMPL_FLAG_MMX);
/* written for gromit */
static void
composite_over_argb_mmx_4 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (" pxor %%mm7, %%mm7\n" // mm7 = { 0, 0, 0, 0 }
" movl $0x80808080, %%eax\n"
" movd %%eax, %%mm6\n" // mm6 = { 128, 128, 128, 128 }
" punpcklbw %%mm7, %%mm6\n"
" movl $0xffffffff, %%eax\n" // mm5 = { 255, 255, 255, 255 }
" movd %%eax, %%mm5\n"
" punpcklbw %%mm7, %%mm5\n"
" movl $0x02020202, %%eax\n"
" movd %%eax, %%mm4\n"
" punpcklbw %%mm7, %%mm4\n"
" paddw %%mm5, %%mm4\n" // mm5 = { 257, 257, 257, 257 }
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm0, %%mm1\n"
" pxor %%mm5, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
" pmullw %%mm1, %%mm2\n"
" paddw %%mm6, %%mm2\n"
" pmulhuw %%mm4, %%mm2\n"
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" subl $1, %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_mmx_4, composite_over_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_over_argb_mmx_5 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (" pxor %%mm7, %%mm7\n" // mm7 = { 0, 0, 0, 0 }
" movl $0x80808080, %%eax\n"
" movd %%eax, %%mm6\n" // mm6 = { 128, 128, 128, 128 }
" punpcklbw %%mm7, %%mm6\n"
#if 0
" movl $0xffffffff, %%eax\n" // mm5 = { 255, 255, 255, 255 }
" movd %%eax, %%mm5\n"
" punpcklbw %%mm7, %%mm5\n"
#else
" pcmpeqw %%mm5, %%mm5\n"
" psrlw $8, %%mm5\n" // mm5 = { 255, 255, 255, 255 }
#endif
" movl $0x02020202, %%eax\n"
" movd %%eax, %%mm4\n"
" punpcklbw %%mm7, %%mm4\n"
" paddw %%mm5, %%mm4\n" // mm5 = { 257, 257, 257, 257 }
"1:\n"
" movd (%1), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" xor %%eax, %%eax\n"
" pextrw $3, %%mm0, %%eax\n"
" test %%eax, %%eax\n"
" jz 2f\n"
" pshufw $0xff, %%mm0, %%mm1\n"
" pxor %%mm5, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
" pmullw %%mm1, %%mm2\n"
" paddw %%mm6, %%mm2\n"
" pmulhuw %%mm4, %%mm2\n"
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" subl $1, %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_mmx_5, composite_over_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_over_argb_sse2 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (" pxor %%xmm7, %%xmm7\n" // mm7 = { 0, 0, 0, 0 }
" movl $0x80808080, %%eax\n"
" movd %%eax, %%xmm6\n" // mm6 = { 128, 128, 128, 128 }
" punpcklbw %%xmm7, %%xmm6\n"
" movl $0xffffffff, %%eax\n" // mm5 = { 255, 255, 255, 255 }
" movd %%eax, %%xmm5\n"
" punpcklbw %%xmm7, %%xmm5\n"
" movl $0x02020202, %%eax\n"
" movd %%eax, %%xmm4\n"
" punpcklbw %%xmm7, %%xmm4\n"
" paddw %%xmm5, %%xmm4\n" // mm4 = { 255, 255, 255, 255 }
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd (%1), %%xmm1\n"
" punpcklbw %%xmm7, %%xmm1\n"
" pshuflw $0xff, %%xmm1, %%xmm0\n"
" pxor %%xmm5, %%xmm0\n"
" movd (%0), %%xmm3\n"
" punpcklbw %%xmm7, %%xmm3\n"
" pmullw %%xmm0, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" paddw %%xmm1, %%xmm3\n"
" packuswb %%xmm3, %%xmm3\n"
" movd %%xmm3, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %2\n"
" jnz 1b\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_sse2, composite_over_argb, OIL_IMPL_FLAG_SSE2);
/* written for shaun */
static void
composite_over_argb_sse2_2 (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (" pxor %%xmm7, %%xmm7\n" // mm7 = { 0, 0, 0, 0 }
" movl $0x80808080, %%eax\n"
" movd %%eax, %%xmm6\n" // mm6 = { 128, 128, 128, 128 }
" punpcklbw %%xmm7, %%xmm6\n"
" punpcklwd %%xmm6, %%xmm6\n"
" movl $0xffffffff, %%eax\n" // mm5 = { 255, 255, 255, 255 }
" movd %%eax, %%xmm5\n"
" punpcklbw %%xmm7, %%xmm5\n"
" punpcklwd %%xmm5, %%xmm5\n"
" movl $0x02020202, %%eax\n"
" movd %%eax, %%xmm4\n"
" punpcklbw %%xmm7, %%xmm4\n"
" paddw %%xmm5, %%xmm4\n" // mm4 = { 257, 257, 257, 257 }
" punpcklwd %%xmm4, %%xmm4\n"
:
:
:"eax");
if (n&1) {
__asm__ __volatile__ (
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 1f\n"
" movd (%1), %%xmm1\n"
" punpcklbw %%xmm7, %%xmm1\n"
" pshuflw $0xff, %%xmm1, %%xmm0\n"
" pxor %%xmm5, %%xmm0\n"
" movd (%0), %%xmm3\n"
" punpcklbw %%xmm7, %%xmm3\n"
" pmullw %%xmm0, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" paddw %%xmm1, %%xmm3\n"
" packuswb %%xmm3, %%xmm3\n"
" movd %%xmm3, (%0)\n"
"1:\n"
" addl $4, %0\n"
" addl $4, %1\n"
:"+r" (dest), "+r" (src)
:
:"eax");
}
n>>=1;
if (n>0){
__asm__ __volatile__ ("\n"
"3:\n"
#if 0
" movl (%1), %%eax\n"
" orl 4(%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 4f\n"
#endif
" movq (%1), %%xmm1\n"
" punpcklbw %%xmm7, %%xmm1\n"
" pshuflw $0xff, %%xmm1, %%xmm0\n"
" pshufhw $0xff, %%xmm0, %%xmm0\n"
" pxor %%xmm5, %%xmm0\n"
" movq (%0), %%xmm3\n"
" punpcklbw %%xmm7, %%xmm3\n"
" pmullw %%xmm0, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" paddw %%xmm1, %%xmm3\n"
" packuswb %%xmm3, %%xmm3\n"
" movq %%xmm3, (%0)\n"
"4:\n"
" addl $8, %0\n"
" addl $8, %1\n"
" subl $1, %2\n"
" jnz 3b\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_sse2_2, composite_over_argb, OIL_IMPL_FLAG_SSE2);
/* written for shaun */
static void
composite_over_argb_sse2_3 (uint32_t *dest, uint32_t *src, int n)
{
int begin;
int middle;
int end;
__asm__ __volatile__ (" pxor %%xmm7, %%xmm7\n" // mm7 = { 0, 0, 0, 0 }
" movl $0x80808080, %%eax\n"
" movd %%eax, %%xmm6\n" // mm6 = { 128, 128, 128, 128 }
" punpcklbw %%xmm7, %%xmm6\n"
" punpcklwd %%xmm6, %%xmm6\n"
" movl $0xffffffff, %%eax\n" // mm5 = { 255, 255, 255, 255 }
" movd %%eax, %%xmm5\n"
" punpcklbw %%xmm7, %%xmm5\n"
" punpcklwd %%xmm5, %%xmm5\n"
" movl $0x02020202, %%eax\n"
" movd %%eax, %%xmm4\n"
" punpcklbw %%xmm7, %%xmm4\n"
" paddw %%xmm5, %%xmm4\n" // mm4 = { 257, 257, 257, 257 }
" punpcklwd %%xmm4, %%xmm4\n"
:
:
:"eax");
begin = 0x3 & (4 - (((unsigned long)dest & 0xf) >> 2));
if (begin>n) {
begin = n;
middle = 0;
end = 0;
} else {
middle = (n-begin)>>2;
end = n - begin - middle*4;
}
if (begin>0) {
__asm__ __volatile__ ("\n"
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd (%1), %%xmm1\n"
" punpcklbw %%xmm7, %%xmm1\n"
" pshuflw $0xff, %%xmm1, %%xmm0\n"
" pxor %%xmm5, %%xmm0\n"
" movd (%0), %%xmm3\n"
" punpcklbw %%xmm7, %%xmm3\n"
" pmullw %%xmm0, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" paddw %%xmm1, %%xmm3\n"
" packuswb %%xmm3, %%xmm3\n"
" movd %%xmm3, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" subl $1, %2\n"
" jnz 1b\n"
:"+r" (dest), "+r" (src), "+r" (begin)
:
:"eax");
}
if (middle>0){
__asm__ __volatile__ ("\n"
"1:\n"
" movq (%1), %%xmm1\n"
" movq 8(%1), %%xmm0\n"
" movl (%1), %%eax\n"
" orl 4(%1), %%eax\n"
" orl 8(%1), %%eax\n"
" orl 12(%1), %%eax\n"
" test $0xff000000, %%eax\n"
" jz 2f\n"
" punpcklbw %%xmm7, %%xmm1\n"
" punpcklbw %%xmm7, %%xmm0\n"
" pshuflw $0xff, %%xmm1, %%xmm1\n"
" pshuflw $0xff, %%xmm0, %%xmm0\n"
" pshufhw $0xff, %%xmm1, %%xmm1\n"
" pshufhw $0xff, %%xmm0, %%xmm0\n"
" pxor %%xmm5, %%xmm1\n"
" pxor %%xmm5, %%xmm0\n"
" movq (%0), %%xmm3\n"
" movq 8(%0), %%xmm2\n"
" punpcklbw %%xmm7, %%xmm3\n"
" punpcklbw %%xmm7, %%xmm2\n"
" pmullw %%xmm1, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" pmullw %%xmm0, %%xmm2\n"
" paddw %%xmm6, %%xmm2\n"
" pmulhuw %%xmm4, %%xmm2\n"
" packuswb %%xmm2, %%xmm3\n"
" movdqu (%1), %%xmm1\n"
" paddb %%xmm1, %%xmm3\n"
" movdqa %%xmm3, (%0)\n"
"2:\n"
" addl $16, %0\n"
" addl $16, %1\n"
" subl $1, %2\n"
" jnz 1b\n"
:"+r" (dest), "+r" (src), "+r" (middle)
:
:"eax");
}
if (end>0) {
__asm__ __volatile__ ("\n"
"1:\n"
" movl (%1), %%eax\n"
" testl $0xff000000, %%eax\n"
" jz 2f\n"
" movd (%1), %%xmm1\n"
" punpcklbw %%xmm7, %%xmm1\n"
" pshuflw $0xff, %%xmm1, %%xmm0\n"
" pxor %%xmm5, %%xmm0\n"
" movd (%0), %%xmm3\n"
" punpcklbw %%xmm7, %%xmm3\n"
" pmullw %%xmm0, %%xmm3\n"
" paddw %%xmm6, %%xmm3\n"
" pmulhuw %%xmm4, %%xmm3\n"
" paddw %%xmm1, %%xmm3\n"
" packuswb %%xmm3, %%xmm3\n"
" movd %%xmm3, (%0)\n"
"2:\n"
" addl $4, %0\n"
" addl $4, %1\n"
" subl $1, %2\n"
" jnz 1b\n"
:"+r" (dest), "+r" (src), "+r" (end)
:
:"eax");
}
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_sse2_3, composite_over_argb, OIL_IMPL_FLAG_SSE2);
static void
composite_over_argb_const_src_mmx (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" movl (%1), %%eax\n"
" movd %%eax, %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm0, %%mm3\n"
" pxor %%mm5, %%mm3\n"
"1:\n"
" movq %%mm3, %%mm1\n"
" movd (%0), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" decl %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_over_argb_const_src_mmx, composite_over_argb_const_src, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_add_argb_mmx (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
"1:\n"
" movd (%1), %%mm0\n"
" movd (%0), %%mm2\n"
" paddusb %%mm0, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_add_argb_mmx, composite_add_argb, OIL_IMPL_FLAG_MMX);
static void
composite_add_argb_const_src_mmx (uint32_t *dest, uint32_t *src, int n)
{
__asm__ __volatile__ (
" movd (%1), %%mm0\n"
"1:\n"
" movd (%0), %%mm2\n"
" paddusb %%mm0, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" decl %2\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_add_argb_const_src_mmx, composite_add_argb_const_src, OIL_IMPL_FLAG_MMX);
static void
composite_in_over_argb_mmx (uint32_t *dest, uint32_t *src, uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
"1:\n"
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm1\n"
" movd (%1), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" movd (%0), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm2, %%mm1\n"
" pxor %%mm5, %%mm1\n"
MMX_MULDIV255(mm0, mm1)
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $4, %1\n"
" addl $1, %2\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_over_argb_mmx, composite_in_over_argb, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_in_over_argb_const_src_mmx (uint32_t *dest, uint32_t *src, uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" movd (%1), %%mm3\n"
" punpcklbw %%mm7, %%mm3\n"
"1:\n"
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm1\n"
" movq %%mm3, %%mm2\n"
MMX_MULDIV255(mm2, mm1)
" movd (%0), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm2, %%mm1\n"
" pxor %%mm5, %%mm1\n"
MMX_MULDIV255(mm0, mm1)
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $1, %2\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_over_argb_const_src_mmx, composite_in_over_argb_const_src, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
static void
composite_in_over_argb_const_mask_mmx (uint32_t *dest, uint32_t *src, uint8_t *mask, int n)
{
__asm__ __volatile__ (
MMX_LOAD_CONSTANTS
" movd (%2), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0x00, %%mm0, %%mm3\n"
"1:\n"
" movd (%1), %%mm2\n"
" punpcklbw %%mm7, %%mm2\n"
" movq %%mm3, %%mm1\n"
MMX_MULDIV255(mm2, mm1)
" movd (%0), %%mm0\n"
" punpcklbw %%mm7, %%mm0\n"
" pshufw $0xff, %%mm2, %%mm1\n"
" pxor %%mm5, %%mm1\n"
MMX_MULDIV255(mm0, mm1)
" paddw %%mm0, %%mm2\n"
" packuswb %%mm2, %%mm2\n"
" movd %%mm2, (%0)\n"
" addl $4, %0\n"
" addl $4, %1\n"
" decl %3\n"
" jnz 1b\n"
" emms\n"
:"+r" (dest), "+r" (src), "+r" (mask), "+r" (n)
:
:"eax");
}
OIL_DEFINE_IMPL_FULL (composite_in_over_argb_const_mask_mmx, composite_in_over_argb_const_mask, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_MMXEXT);
| 26.16499 | 138 | 0.492733 |
ed034d2e17113d6694404a04e35f775763a06975 | 281 | h | C | Example/FFFTest/TTTAppDelegate.h | haoxiaofeng91/FFFTest | a28a24563422b791edab536be83a071b1552d632 | [
"MIT"
] | null | null | null | Example/FFFTest/TTTAppDelegate.h | haoxiaofeng91/FFFTest | a28a24563422b791edab536be83a071b1552d632 | [
"MIT"
] | null | null | null | Example/FFFTest/TTTAppDelegate.h | haoxiaofeng91/FFFTest | a28a24563422b791edab536be83a071b1552d632 | [
"MIT"
] | null | null | null | //
// TTTAppDelegate.h
// FFFTest
//
// Created by haoxiaofeng91 on 07/17/2019.
// Copyright (c) 2019 haoxiaofeng91. All rights reserved.
//
@import UIKit;
@interface TTTAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| 17.5625 | 63 | 0.725979 |
4bdf4812da2c305351922578a637a0ab4713ca1b | 1,774 | h | C | libs/sge_engine/src/sge_engine/actors/ATimeline.h | Alekssasho/sge_source | 2db4ae08f7b3434d32dd9767fe1136234cb70b83 | [
"MIT"
] | 34 | 2021-06-15T10:24:49.000Z | 2022-03-22T19:20:23.000Z | libs/sge_engine/src/sge_engine/actors/ATimeline.h | Alekssasho/sge_source | 2db4ae08f7b3434d32dd9767fe1136234cb70b83 | [
"MIT"
] | 9 | 2021-03-04T21:34:03.000Z | 2021-05-04T18:33:47.000Z | libs/sge_engine/src/sge_engine/actors/ATimeline.h | Alekssasho/sge_source | 2db4ae08f7b3434d32dd9767fe1136234cb70b83 | [
"MIT"
] | 2 | 2021-12-29T01:15:22.000Z | 2022-02-01T10:53:15.000Z | #pragma once
#include "sge_engine/Actor.h"
#include "sge_engine/GameInspector.h"
#include "sge_engine/InspectorCmd.h"
#include "sge_engine/traits/TraitCustomAE.h"
#include "sge_engine/traits/TraitModel.h"
#include "sge_engine/traits/TraitPath.h"
#include "sge_engine/traits/TraitViewportIcon.h"
#include "sge_utils/utils/vector_map.h"
namespace sge {
//--------------------------------------------------------
// ATimeline
//--------------------------------------------------------
struct ATimeline : public Actor, public IActorCustomAttributeEditorTrait {
enum PlaybackMethod : int {
playbackMethod_reset,
playbackMethod_stop,
playbackMethod_flipflop,
};
AABox3f getBBoxOS() const override;
void create() override;
void postUpdate(const GameUpdateSets& updateSets) override;
// IActorCustomAttributeEditorTrait
void doAttributeEditor(GameInspector* inspector) override;
float getRawAnimationLength() const {
const float res = keyFrames.size() == 0 ? 0.f : keyFrames.getAllKeys().back();
return res;
}
public:
TraitViewportIcon ttViewportIcon;
bool relativeMode = false; ///< If true, the animation should be played relative to the timeline node.
transf3d relativeModeOrigin; ///< This is the transform that we are going to use to make the keyfames
bool isInEditMode = false;
bool doesEditModeNeedsUpdate = false;
bool m_isEnabled = false;
bool m_useSmoothInterpolation = false;
float m_gameplayEvalTime = 0.f;
float m_editingEvaltime = 0;
bool moveObjectsOnTop = false;
PlaybackMethod playbackMethod = playbackMethod_reset;
float flipFlopDir = 1.f;
int framesPerSecond = 30;
int frameCount = 30;
vector_set<ObjectId> affectedActorsIds;
vector_map<int, vector_map<ObjectId, transf3d>> keyFrames;
};
} // namespace sge
| 27.292308 | 105 | 0.722661 |
b4e2658639f82936ccf23c34c63861c9dbef5c0e | 1,509 | h | C | AYSegmentController/AYSegmentController/AYSegmentController/AYSegmentBar.h | AnGuoli/AYSegmentVC | a259ecae8b9f1b88ea7a2fa91716169ca5d44298 | [
"MIT"
] | null | null | null | AYSegmentController/AYSegmentController/AYSegmentController/AYSegmentBar.h | AnGuoli/AYSegmentVC | a259ecae8b9f1b88ea7a2fa91716169ca5d44298 | [
"MIT"
] | null | null | null | AYSegmentController/AYSegmentController/AYSegmentController/AYSegmentBar.h | AnGuoli/AYSegmentVC | a259ecae8b9f1b88ea7a2fa91716169ca5d44298 | [
"MIT"
] | null | null | null | //
// AYSegmentBar.h
// AYSegmentController
//
// Created by 国立安 on 2018/3/6.
// Copyright © 2018年 国立安. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AYSegmentBarConfig.h"
typedef NS_ENUM(NSInteger, AYSegmentBarScrollMode) {
AYSegmentBarScrollModeNormal, // 默认滚动模式
AYSegmentBarScrollModeCenter // 中间滚动模式
};
typedef NS_ENUM(NSInteger, AYSegmentBarLinkMode) {
AYSegmentBarLinkModeNormal, // 默认联动模式
AYSegmentBarLinkModeProgress // 根据进度的联动模式
};
@protocol AYSegmentBarDelegate;
@interface AYSegmentBar : UIView
/** 数据源 */
@property (nonatomic, copy) NSArray <NSString *> *items;
/** 代理 */
@property (nonatomic, weak) id <AYSegmentBarDelegate> delegate;
/** 当前选中的索引, 双向设置 */
@property (nonatomic, assign) NSInteger selectIndex;
/** 滚动模式 */
@property (nonatomic, assign) AYSegmentBarScrollMode scrollMode;
/** 联动模式 */
@property (nonatomic, assign) AYSegmentBarLinkMode linkMode;
/** 指示器进度 */
@property (nonatomic, assign) CGFloat indicatorProgress;
/** 是否开启标题颜色渐变 默认为NO */
@property (nonatomic, assign) BOOL enableTitleColorGradient;
/** 是否开启标题大小渐变 默认为NO */
@property (nonatomic, assign) BOOL enableTitleSizeGradient;
/**
* 配置Bar的各种参数
*/
- (void)updateWithConfig:(void(^)(AYSegmentBarConfig *config))block;
@end
@protocol AYSegmentBarDelegate <NSObject>
- (void)segmentBar:(AYSegmentBar *)segmentBar didSelectedIndex:(NSInteger)toIndex fromIndex:(NSInteger)fromIndex;
@end
UIKIT_EXTERN NSString * const AYSegmentBarSelectionDidChangeNotification;
| 19.597403 | 113 | 0.744201 |
dce2475a5f844175d7e4d53266270324dfbd3643 | 3,997 | h | C | sparrow/src/Classes/SPTouchEvent.h | squarepoet/Sparrow-Framework | 5301569ebbd38dab26c8601d6033b9aba4990509 | [
"BSD-2-Clause-FreeBSD"
] | 110 | 2015-01-14T03:27:41.000Z | 2022-03-27T18:23:00.000Z | sparrow/src/Classes/SPTouchEvent.h | squarepoet/Sparrow-Framework | 5301569ebbd38dab26c8601d6033b9aba4990509 | [
"BSD-2-Clause-FreeBSD"
] | 20 | 2015-03-30T11:39:07.000Z | 2021-07-23T07:35:34.000Z | sparrow/src/Classes/SPTouchEvent.h | squarepoet/Sparrow-Framework | 5301569ebbd38dab26c8601d6033b9aba4990509 | [
"BSD-2-Clause-FreeBSD"
] | 35 | 2015-01-23T22:44:52.000Z | 2019-06-28T13:23:39.000Z | //
// SPTouchEvent.h
// Sparrow
//
// Created by Daniel Sperl on 02.05.09.
// Copyright 2011-2015 Gamua. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Simplified BSD License.
//
#import <Sparrow/SparrowBase.h>
#import <Sparrow/SPEvent.h>
#import <Sparrow/SPTouch.h>
NS_ASSUME_NONNULL_BEGIN
SP_EXTERN NSString *const SPEventTypeTouch;
/** ------------------------------------------------------------------------------------------------
When one or more fingers touch the screen, move around or are raised, an SPTouchEvent is triggered.
The event contains a list of all touches that are currently present. Each individual touch is
stored in an object of type "Touch". Since you are normally only interested in the touches
that occurred on top of certain objects, you can query the event for touches with a
specific target through the `touchesWithTarget:` method. In this context, the target of a
touch is not only the object that was touched (e.g. an SPImage), but also each of its parents -
e.g. the container that holds that image.
Here is an example of how to react on touch events at 'self', which could be a subclass of SPSprite:
// e.g. in 'init'
[self addEventListener:@selector(onTouch:) atObject:self forType:SPEventTypeTouch];
// the corresponding listener:
- (void)onTouch:(SPTouchEvent *)event
{
// query all touches that are currently moving on top of 'self'
NSArray *touches = [[event touchesWithTarget:self andPhase:SPTouchPhaseMoved] allObjects];
if (touches.count == 1)
{
// one finger touching
SPTouch *touch = [touches objectAtIndex:0];
SPPoint *currentPos = [touch locationInSpace:self.parent];
SPPoint *previousPos = [touch previousLocationInSpace:self.parent];
// ...
}
else if (touches.count >= 2)
{
// two fingers touching
// ...
}
}
------------------------------------------------------------------------------------------------- */
@interface SPTouchEvent : SPEvent
/// --------------------
/// @name Initialization
/// --------------------
/// Creates a touch event with a set of touches. _Designated Initializer_.
- (instancetype)initWithType:(NSString *)type bubbles:(BOOL)bubbles touches:(SP_GENERIC(NSSet, SPTouch*) *)touches;
/// Creates a touch event with a set of touches.
- (instancetype)initWithType:(NSString *)type touches:(SP_GENERIC(NSSet, SPTouch*) *)touches;
/// Factory method.
+ (instancetype)eventWithType:(NSString *)type touches:(SP_GENERIC(NSSet, SPTouch*) *)touches;
/// -------------
/// @name Methods
/// -------------
/// Gets a set of SPTouch objects that originated over a certain target.
- (SP_GENERIC(NSSet, SPTouch*) *)touchesWithTarget:(SPDisplayObject *)target;
/// Gets a set of SPTouch objects that originated over a certain target and are in a certain phase.
- (SP_GENERIC(NSSet, SPTouch*) *)touchesWithTarget:(SPDisplayObject *)target andPhase:(SPTouchPhase)phase;
/// Returns a touch that originated over a certain target.
- (SPTouch *)touchWithTarget:(SPDisplayObject *)target;
/// Returns a touch that originated over a certain target with a certain phase.
- (SPTouch *)touchWithTarget:(SPDisplayObject *)target andPhase:(SPTouchPhase)phase;
/// Returns a touch that originated over a certain target with a certain phase and ID.
- (SPTouch *)touchWithTarget:(SPDisplayObject *)target andPhase:(SPTouchPhase)phase touchID:(size_t)touchID;
/// Indicates if a target is currently being touched or hovered over.
- (BOOL)interactsWithTarget:(SPDisplayObject *)target;
/// ----------------
/// @name Properties
/// ----------------
/// All touches that are currently available.
@property (nonatomic, readonly) SP_GENERIC(NSSet, SPTouch*) *touches;
/// The time the event occurred (in seconds since application launch).
@property (nonatomic, readonly) double timestamp;
@end
NS_ASSUME_NONNULL_END
| 36.669725 | 115 | 0.671754 |
0d24334fe1f96194fc3adab28c3eaecfdb31db70 | 387 | c | C | src/utilities.c | joesavage/phishbait | 6f8ee3fa884284e83b55e3b93a4badc12870d640 | [
"MIT"
] | 3 | 2016-03-17T15:46:58.000Z | 2018-08-10T03:45:48.000Z | src/utilities.c | joesavage/phishbait | 6f8ee3fa884284e83b55e3b93a4badc12870d640 | [
"MIT"
] | null | null | null | src/utilities.c | joesavage/phishbait | 6f8ee3fa884284e83b55e3b93a4badc12870d640 | [
"MIT"
] | null | null | null | #include <stdlib.h>
#include <stdio.h>
// NOTE: In future, it would be nice to avoid using malloc/free directly (custom allocator[s]!)
void *memory_alloc(size_t size) {
void *result = malloc(size);
if (!result) {
fprintf(stderr, "'malloc' failed - insufficient storage space available.\n");
exit(1);
}
return result;
}
void memory_free(void *memory) {
return free(memory);
}
| 21.5 | 95 | 0.69509 |
812ce149317420c30cf5e94e2864abc61686ba33 | 409 | h | C | OscilloscopeUI/CustomSingleChannelDataProvider.h | mejustandrew/software-oscilloscope | 36d61837ae96c7edf3c55fe217116143b9587967 | [
"BSD-2-Clause"
] | null | null | null | OscilloscopeUI/CustomSingleChannelDataProvider.h | mejustandrew/software-oscilloscope | 36d61837ae96c7edf3c55fe217116143b9587967 | [
"BSD-2-Clause"
] | null | null | null | OscilloscopeUI/CustomSingleChannelDataProvider.h | mejustandrew/software-oscilloscope | 36d61837ae96c7edf3c55fe217116143b9587967 | [
"BSD-2-Clause"
] | null | null | null | #pragma once
#pragma once
#include "ISingleChannelDataProvider.h"
#include "SignalGenerator.h"
class CustomSingleChannelDataProvider : public ISingleChannelDataProvider
{
SignalGenerator * signalGenerator;
public:
CustomSingleChannelDataProvider(SignalGenerator * signalGenerator);
void ChangeSignalGenerator(SignalGenerator * signalGenerator);
virtual IDataResponse* GetNewData(int numberOfSamples);
}; | 29.214286 | 73 | 0.843521 |
813fa0ca816929409123354314bfd9f41850f9eb | 143 | h | C | Sources/CFFmpeg/include/avformat_shim.h | JimmyAustin/swiftffmpegtest | 3c5d70db5fc66a9e831f6794369e421b1966d14c | [
"Apache-2.0"
] | 320 | 2018-07-08T10:57:05.000Z | 2022-03-31T15:25:18.000Z | Sources/CFFmpeg/avformat_shim.h | yanglhan/SwiftFFmpeg | 72910cca54b52a062a06e1a68ac55ad4fb5f7eea | [
"Apache-2.0"
] | 47 | 2018-09-28T00:01:50.000Z | 2022-01-05T09:46:54.000Z | Sources/CFFmpeg/avformat_shim.h | yanglhan/SwiftFFmpeg | 72910cca54b52a062a06e1a68ac55ad4fb5f7eea | [
"Apache-2.0"
] | 59 | 2018-07-14T18:03:19.000Z | 2022-03-22T09:57:18.000Z | #ifndef AVFORMAT_SHIM_H
#define AVFORMAT_SHIM_H
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#endif /* AVFORMAT_SHIM_H */
| 17.875 | 33 | 0.783217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.