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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
881b7d625b2098a52c2f09ecec402e49a1462a49 | 3,327 | h | C | Origin/src/Origin/Renderer/Primitives/Buffers.h | UnNabbo/OriginEngine | d4b51f8cf0e716e2b5dee739de20d49f0e24872a | [
"Apache-2.0"
] | 2 | 2022-02-04T09:26:47.000Z | 2022-02-04T20:31:12.000Z | Origin/src/Origin/Renderer/Primitives/Buffers.h | UnNabbo/OriginEngine | d4b51f8cf0e716e2b5dee739de20d49f0e24872a | [
"Apache-2.0"
] | null | null | null | Origin/src/Origin/Renderer/Primitives/Buffers.h | UnNabbo/OriginEngine | d4b51f8cf0e716e2b5dee739de20d49f0e24872a | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "Origin/Core/Core.h"
#include "stdint.h"
namespace Origin {
enum class ShaderDataType {
None = 0,
Float, Float2, Float3, Float4,
Int, Int2, Int3, Int4,
Bool,
Mat3, Mat4,
};
struct ORIGIN_API BufferElement {
std::string Name;
ShaderDataType Type;
uint32_t Size;
uint32_t Offset;
bool Normalized;
BufferElement(ShaderDataType type, std::string name, bool normalized = false)
: Name(name), Type(type), Size(SizeOfShaderDataType(type)), Offset(0), Normalized(normalized){}
uint32_t GetComponetCount() const {
switch (Type) {
case ShaderDataType::Bool: return 1;
case ShaderDataType::Int: return 1;
case ShaderDataType::Int2: return 2;
case ShaderDataType::Int3: return 3;
case ShaderDataType::Int4: return 4;
case ShaderDataType::Float: return 1;
case ShaderDataType::Float2: return 2;
case ShaderDataType::Float3: return 3;
case ShaderDataType::Float4: return 4;
case ShaderDataType::Mat3: return 3 * 3;
case ShaderDataType::Mat4: return 4 * 4;
}
}
private:
uint32_t SizeOfShaderDataType(ShaderDataType type) {
switch (type) {
case ShaderDataType::Bool: return 1;
case ShaderDataType::Int: return 4;
case ShaderDataType::Int2: return 4 * 2;
case ShaderDataType::Int3: return 4 * 3;
case ShaderDataType::Int4: return 4 * 4;
case ShaderDataType::Float: return 4;
case ShaderDataType::Float2: return 4 * 2;
case ShaderDataType::Float3: return 4 * 3;
case ShaderDataType::Float4: return 4 * 4;
case ShaderDataType::Mat3: return 4 * 3 * 3;
case ShaderDataType::Mat4: return 4 * 4 * 4;
}
ORIGIN_ASSERT(false, "Unknow ShaderDataType!");
return 0;
}
};
class ORIGIN_API BufferLayout {
public:
BufferLayout(const std::initializer_list<BufferElement>& elements)
: m_Elements(elements){
CalculateOffsetAndStride();
}
inline const std::vector<BufferElement>& GetElements() const{ return m_Elements; }
inline uint32_t GetStride() const { return m_stride; }
std::vector<BufferElement>::iterator begin() { return m_Elements.begin(); }
std::vector<BufferElement>::iterator end() { return m_Elements.end(); }
private:
void CalculateOffsetAndStride() {
uint32_t offset = 0;
for (auto& element : m_Elements) {
element.Offset = offset;
offset += element.Size;
m_stride += element.Size;
}
}
private:
std::vector<BufferElement> m_Elements;
uint32_t m_stride = 0;
};
class ORIGIN_API VertexBuffer {
public:
virtual ~VertexBuffer() {}
static Reference<VertexBuffer> Create(uint32_t size);
static Reference<VertexBuffer> Create(float* data, uint32_t size);
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
virtual void SetLayout(const BufferLayout& layout) = 0;
virtual const BufferLayout& GetLayout() const = 0;
virtual void SetData(const void* data, uint32_t offset) = 0;
};
class ORIGIN_API IndexBuffer {
public:
virtual ~IndexBuffer(){}
static Reference<IndexBuffer> Create(uint32_t size);
static Reference<IndexBuffer> Create(uint32_t* data, uint32_t size);
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
virtual uint32_t GetCount() const = 0;
virtual void SetData(uint32_t* data, uint32_t size) = 0;
};
} | 25.396947 | 98 | 0.692516 |
e6dd7f0f0946fd59b901348bebc4725424516454 | 948 | h | C | 4.Demos/GD3_FT81X_Fish_tank/pez1.h | lightcalamar/GD3_HOTMCU | f3ac0d8242d7ee301485f978a5f16b77053b8508 | [
"BSD-3-Clause"
] | null | null | null | 4.Demos/GD3_FT81X_Fish_tank/pez1.h | lightcalamar/GD3_HOTMCU | f3ac0d8242d7ee301485f978a5f16b77053b8508 | [
"BSD-3-Clause"
] | 2 | 2017-06-12T08:29:39.000Z | 2019-04-12T08:55:41.000Z | 6. Sliders/ArduOS_3_aqua/pez1.h | lightcalamar/GD3_HOTMCU | f3ac0d8242d7ee301485f978a5f16b77053b8508 | [
"BSD-3-Clause"
] | null | null | null | #define LOAD_ASSETS1() GD.safeload("pez1.gd2");
#define PEZ1D_HANDLE 0
#define PEZ1D_WIDTH 200
#define PEZ1D_HEIGHT 131
#define PEZ1D_CELLS 1
#define PEZ1I_HANDLE 1
#define PEZ1I_WIDTH 200
#define PEZ1I_HEIGHT 131
#define PEZ1I_CELLS 1
#define PEZ1C_HANDLE 2
#define PEZ1C_WIDTH 178
#define PEZ1C_HEIGHT 178
#define PEZ1C_CELLS 1
#define BPEZ1_HANDLE 3
#define BPEZ1_WIDTH 75
#define BPEZ1_HEIGHT 80
#define BPEZ1_CELLS 1
#define BPEZ2_HANDLE 4
#define BPEZ2_WIDTH 75
#define BPEZ2_HEIGHT 80
#define BPEZ2_CELLS 1
#define BPEZ3_HANDLE 5
#define BPEZ3_WIDTH 40
#define BPEZ3_HEIGHT 40
#define BPEZ3_CELLS 1
#define ASSETS_END 195368UL
static const shape_t PEZ1D_SHAPE = {0, 200, 131, 0};
static const shape_t PEZ1I_SHAPE = {1, 200, 131, 0};
static const shape_t PEZ1C_SHAPE = {2, 178, 178, 0};
static const shape_t BPEZ1_SHAPE = {3, 75, 80, 0};
static const shape_t BPEZ2_SHAPE = {4, 75, 80, 0};
static const shape_t BPEZ3_SHAPE = {5, 40, 40, 0};
| 28.727273 | 52 | 0.777426 |
1120d7dc19f7c8e6f563d93f52081aba3e616274 | 2,225 | c | C | list_funcs1.c | mrgiulls/monty | 2db9c6d66d4beb1afa7a1fc978f82d9f2309005f | [
"MIT"
] | null | null | null | list_funcs1.c | mrgiulls/monty | 2db9c6d66d4beb1afa7a1fc978f82d9f2309005f | [
"MIT"
] | null | null | null | list_funcs1.c | mrgiulls/monty | 2db9c6d66d4beb1afa7a1fc978f82d9f2309005f | [
"MIT"
] | null | null | null | #include "monty.h"
/**
* dlistint_len - returns the number of nodes in a doubly linked list
* @h: pointer to the list
*
* Return: number of nodes
*/
size_t dlistint_len(const dlistint_t *h)
{
size_t nodes = 0;
if (!h)
return (0);
while (h)
{
nodes++;
h = h->next;
}
return (nodes);
}
/**
* add_dnodeint - adds a new node at the beginning of a doubly linked list
* @head: double pointer to the list
* @n: data to insert in the new node
*
* Return: the address of the new element, or NULL if it failed
*/
dlistint_t *add_dnodeint(dlistint_t **head, const int n)
{
dlistint_t *new;
if (!head)
return (NULL);
new = malloc(sizeof(dlistint_t));
if (!new)
return (NULL);
new->n = n;
new->next = *head;
new->prev = NULL;
if (*head)
(*head)->prev = new;
*head = new;
return (new);
}
/**
* print_dlistint - prints a doubly linked list
* @h: pointer to the list
*
* Return: number of nodes in the list
*/
size_t print_dlistint(const dlistint_t *h)
{
size_t nodes = 0;
if (!h)
return (0);
while (h)
{
printf("%d\n", h->n);
h = h->next;
nodes++;
}
return (nodes);
}
/**
* delete_dnodeint_at_index - deltes a node in a doubly linked list
* at a given index
* @head: double pointer to the list
* @index: index of the node to delete
*
* Return: 1 on success, -1 on failure
*/
int delete_dnodeint_at_index(dlistint_t **head, unsigned int index)
{
dlistint_t *temp = *head;
unsigned int i = 0;
if (!index)
{
(*head) = temp->next;
if (temp->next)
temp->next->prev = NULL;
temp->next = NULL;
free(temp);
return (1);
}
while (i < index)
{
temp = temp->next;
i++;
if (!temp)
return (0);
}
temp->prev->next = temp->next;
if (temp->next)
temp->next->prev = temp->prev;
free(temp);
return (1);
}
/**
* get_dnodeint_at_index - gets the nth node of a doubly linked list
* @head: pointer to the list
* @index: index of the node to return
*
* Return: address of the node, or if it does not exist, NULL
*/
dlistint_t *get_dnodeint_at_index(dlistint_t *head, unsigned int index)
{
unsigned int i = 0;
if (!head)
return (NULL);
while (head && i < index)
{
head = head->next;
i++;
}
return (head ? head : NULL);
}
| 15.892857 | 74 | 0.621573 |
11345f6f6b8a9c49ac69819f603c315f25ac2a14 | 8,738 | c | C | parser/mml/MMLSEMDumper.c | noriyoshiabe/NASequencer | 00e976a800791d86c3b8638b7969ed6d35f16b03 | [
"Apache-2.0"
] | null | null | null | parser/mml/MMLSEMDumper.c | noriyoshiabe/NASequencer | 00e976a800791d86c3b8638b7969ed6d35f16b03 | [
"Apache-2.0"
] | null | null | null | parser/mml/MMLSEMDumper.c | noriyoshiabe/NASequencer | 00e976a800791d86c3b8638b7969ed6d35f16b03 | [
"Apache-2.0"
] | null | null | null | #include "MMLSEMDumper.h"
#include "MMLSEM.h"
#include <NACString.h>
#include <NALog.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
typedef struct _MMLSEMDumper {
SEMVisitor visitor;
Analyzer analyzer;
int indent;
} MMLSEMDumper;
static Node *process(void *self, Node *node)
{
if (__IsDebug__) {
node->accept(node, self);
}
return NodeRetain(node);
}
static void destroy(void *self)
{
free(self);
}
static void dump(MMLSEMDumper *self, void *_node, ...)
{
Node *node = _node;
printf("%*s", self->indent, "");
printf("[%s]", node->type);
va_list argList;
va_start(argList, _node);
const char *str;
int i = 0;
while ((str = va_arg(argList, const char *))) {
printf("%c", 0 == i % 2 ? ' ' : '=');
printf("%s", str);
++i;
}
va_end(argList);
printf(" at %s:%d:%d\n", node->location.filepath, node->location.line, node->location.column);
}
#define INTEGER(sem, name) #name, NACStringFromInteger(sem->name)
#define FLOAT(sem, name) #name, NACStringFromFloat(sem->name, 2)
#define STRING(sem, name) #name, sem->name ? sem->name : "(null)"
#define CHAR(sem, name) #name, '\0' == sem->name ? "none" : NACStringFromChar(sem->name)
#define BOOL(sem, name) #name, NACStringFromBoolean(sem->name)
static void visitList(void *_self, SEMList *sem)
{
MMLSEMDumper *self = _self;
dump(self, sem, NULL);
self->indent += 4;
NAIterator *iterator = NAArrayGetIterator(sem->node.children);
while (iterator->hasNext(iterator)) {
Node *node = iterator->next(iterator);
node->accept(node, self);
}
self->indent -= 4;
}
static void visitTimebase(void *self, SEMTimebase *sem)
{
dump(self, sem, INTEGER(sem, timebase), NULL);
}
static void visitTitle(void *self, SEMTitle *sem)
{
dump(self, sem, STRING(sem, title), NULL);
}
static void visitCopyright(void *self, SEMCopyright *sem)
{
dump(self, sem, STRING(sem, text), NULL);
}
static void visitMarker(void *self, SEMMarker *sem)
{
dump(self, sem, STRING(sem, text), NULL);
}
static void visitVelocityReverse(void *self, SEMVelocityReverse *sem)
{
dump(self, sem, NULL);
}
static void visitOctaveReverse(void *self, SEMOctaveReverse *sem)
{
dump(self, sem, NULL);
}
static void visitChannel(void *self, SEMChannel *sem)
{
dump(self, sem, INTEGER(sem, number), NULL);
}
static void visitSynth(void *self, SEMSynth *sem)
{
dump(self, sem, STRING(sem, name), NULL);
}
static void visitBankSelect(void *self, SEMBankSelect *sem)
{
dump(self, sem, INTEGER(sem, bankNo), NULL);
}
static void visitProgramChange(void *self, SEMProgramChange *sem)
{
dump(self, sem, INTEGER(sem, programNo), NULL);
}
static void visitVolume(void *self, SEMVolume *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitChorus(void *self, SEMChorus *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitReverb(void *self, SEMReverb *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitExpression(void *self, SEMExpression *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitPan(void *self, SEMPan *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitPitch(void *self, SEMPitch *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitDetune(void *self, SEMDetune *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitPitchSense(void *self, SEMPitchSense *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitSustain(void *self, SEMSustain *sem)
{
dump(self, sem, INTEGER(sem, value), NULL);
}
static void visitTempo(void *self, SEMTempo *sem)
{
dump(self, sem, FLOAT(sem, tempo), NULL);
}
static void visitTime(void *self, SEMTime *sem)
{
dump(self, sem, INTEGER(sem, numerator), INTEGER(sem, denominator), NULL);
}
static void visitNote(void *_self, SEMNote *sem)
{
MMLSEMDumper *self = _self;
Node *node = (Node *)sem;
printf("%*s[%s]", self->indent, "", node->type);
printf(" baseNote=%s", BaseNote2String(sem->baseNote));
printf(" accidental=%s", Accidental2String(sem->accidental));
printf(" %s=%s", INTEGER(sem, length.length));
printf(" %s=%s", INTEGER(sem, length.dotCount));
printf(" %s=%s", INTEGER(sem, length.step));
printf(" %s=%s", STRING(sem, noteString));
printf(" from %s:%d:%d\n", node->location.filepath, node->location.line, node->location.column);
}
static void visitRest(void *self, SEMRest *sem)
{
dump(self, sem, INTEGER(sem, length.length), INTEGER(sem, length.dotCount), INTEGER(sem, length.step), NULL);
}
static void visitOctave(void *self, SEMOctave *sem)
{
dump(self, sem, CHAR(sem, direction), INTEGER(sem, value), NULL);
}
static void visitTransepose(void *self, SEMTranspose *sem)
{
dump(self, sem, BOOL(sem, relative), INTEGER(sem, value), NULL);
}
static void visitTie(void *self, SEMTie *sem)
{
dump(self, sem, NULL);
}
static void visitLength(void *self, SEMLength *sem)
{
dump(self, sem, INTEGER(sem, length), NULL);
}
static void visitGatetime(void *self, SEMGatetime *sem)
{
dump(self, sem, BOOL(sem, absolute), INTEGER(sem, value), NULL);
}
static void visitVelocity(void *self, SEMVelocity *sem)
{
dump(self, sem, CHAR(sem, direction), BOOL(sem, absolute), INTEGER(sem, value), NULL);
}
static void visitTuplet(void *_self, SEMTuplet *sem)
{
MMLSEMDumper *self = _self;
dump(self, sem, INTEGER(sem, division), INTEGER(sem, length.length), INTEGER(sem, length.dotCount), INTEGER(sem, length.step), NULL);
self->indent += 4;
NAIterator *iterator = NAArrayGetIterator(sem->node.children);
while (iterator->hasNext(iterator)) {
Node *node = iterator->next(iterator);
node->accept(node, self);
}
self->indent -= 4;
}
static void visitTrackChange(void *self, SEMTrackChange *sem)
{
dump(self, sem, NULL);
}
static void visitRepeat(void *_self, SEMRepeat *sem)
{
MMLSEMDumper *self = _self;
dump(self, sem, INTEGER(sem, times), NULL);
self->indent += 4;
NAIterator *iterator = NAArrayGetIterator(sem->node.children);
while (iterator->hasNext(iterator)) {
Node *node = iterator->next(iterator);
node->accept(node, self);
}
self->indent -= 4;
}
static void visitRepeatBreak(void *self, SEMRepeatBreak *sem)
{
dump(self, sem, NULL);
}
static void visitChord(void *_self, SEMChord *sem)
{
MMLSEMDumper *self = _self;
dump(self, sem, NULL);
self->indent += 4;
NAIterator *iterator = NAArrayGetIterator(sem->node.children);
while (iterator->hasNext(iterator)) {
Node *node = iterator->next(iterator);
node->accept(node, self);
}
self->indent -= 4;
}
Analyzer *MMLSEMDumperCreate(ParseContext *context)
{
MMLSEMDumper *self = calloc(1, sizeof(MMLSEMDumper));
self->visitor.visitList = visitList;
self->visitor.visitTimebase = visitTimebase;
self->visitor.visitTitle = visitTitle;
self->visitor.visitCopyright = visitCopyright;
self->visitor.visitMarker = visitMarker;
self->visitor.visitVelocityReverse = visitVelocityReverse;
self->visitor.visitOctaveReverse = visitOctaveReverse;
self->visitor.visitChannel = visitChannel;
self->visitor.visitSynth = visitSynth;
self->visitor.visitBankSelect = visitBankSelect;
self->visitor.visitProgramChange = visitProgramChange;
self->visitor.visitVolume = visitVolume;
self->visitor.visitChorus = visitChorus;
self->visitor.visitReverb = visitReverb;
self->visitor.visitExpression = visitExpression;
self->visitor.visitPan = visitPan;
self->visitor.visitPitch = visitPitch;
self->visitor.visitDetune = visitDetune;
self->visitor.visitPitchSense = visitPitchSense;
self->visitor.visitSustain = visitSustain;
self->visitor.visitTempo = visitTempo;
self->visitor.visitTime = visitTime;
self->visitor.visitNote = visitNote;
self->visitor.visitRest = visitRest;
self->visitor.visitOctave = visitOctave;
self->visitor.visitTransepose = visitTransepose;
self->visitor.visitTie = visitTie;
self->visitor.visitLength = visitLength;
self->visitor.visitGatetime = visitGatetime;
self->visitor.visitVelocity = visitVelocity;
self->visitor.visitTuplet = visitTuplet;
self->visitor.visitTrackChange = visitTrackChange;
self->visitor.visitRepeat = visitRepeat;
self->visitor.visitRepeatBreak = visitRepeatBreak;
self->visitor.visitChord = visitChord;
self->analyzer.process = process;
self->analyzer.destroy = destroy;
self->analyzer.self = self;
return &self->analyzer;
}
| 26.083582 | 137 | 0.674182 |
11487143bae145dbb5f6e52642c5e682493e9ae3 | 1,267 | h | C | tacmap/DT_Circle.h | parrishmyers/tacmap | 21c494723e482b3622362278144613819e21dafc | [
"MIT"
] | null | null | null | tacmap/DT_Circle.h | parrishmyers/tacmap | 21c494723e482b3622362278144613819e21dafc | [
"MIT"
] | null | null | null | tacmap/DT_Circle.h | parrishmyers/tacmap | 21c494723e482b3622362278144613819e21dafc | [
"MIT"
] | null | null | null | //
// Circle.h
// tacmap_cmd
//
// Created by Parrish Myers on 4/10/16.
// Copyright © 2016 Parrish Myers. All rights reserved.
//
#ifndef Circle_h
#define Circle_h
#include <stdio.h>
#include "json.hpp"
using json = nlohmann::json;
class Circle {
public:
enum CarC {
X = 0,
Y = 1,
R = 2,
};
private:
double data[3];
public:
Circle(double x = 0.0, double y = 0.0, double r = 0.0) {
set(x,y,r);
}
void set(double x = 0.0, double y = 0.0, double r = 0.0) {
data[X] = x;
data[Y] = y;
data[R] = r;
}
double getX() const { return data[X]; }
double getY() const { return data[Y]; }
double getR() const { return data[R]; }
void printIt(FILE *fh) {
fprintf(fh,"%f, %f, %f", data[X], data[Y], data[R]);
}
bool pointInside(double x, double y) {
double diff_x = x - data[X];
double diff_y = y - data[Y];
double dist = std::sqrt( diff_x * diff_x + diff_y * diff_y );
if (dist <= data[R])
return true;
else
return false;
}
json to_json() {
json j;
j["circle"] = { data[X], data[Y], data[R] };
return j;
}
};
#endif /* Circle_h */
| 20.111111 | 69 | 0.498027 |
fd86600d15156c7d2a36e19c56a80c5e54f1bcfd | 9,926 | h | C | MediaPlayer/AndroidSLESMediaPlayer/include/AndroidSLESMediaPlayer/FFmpegDecoder.h | grvweb/avs-device-sdk | 3adeb12230b02a182c928de45d26bc7268d49bb7 | [
"Apache-2.0"
] | 1 | 2018-09-05T05:29:21.000Z | 2018-09-05T05:29:21.000Z | MediaPlayer/AndroidSLESMediaPlayer/include/AndroidSLESMediaPlayer/FFmpegDecoder.h | grvweb/avs-device-sdk | 3adeb12230b02a182c928de45d26bc7268d49bb7 | [
"Apache-2.0"
] | null | null | null | MediaPlayer/AndroidSLESMediaPlayer/include/AndroidSLESMediaPlayer/FFmpegDecoder.h | grvweb/avs-device-sdk | 3adeb12230b02a182c928de45d26bc7268d49bb7 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_
#define ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
#include <utility>
#include "AndroidSLESMediaPlayer/DecoderInterface.h"
#include "AndroidSLESMediaPlayer/FFmpegInputControllerInterface.h"
struct AVCodec;
struct AVCodecContext;
struct AVDictionary;
struct AVFormatContext;
struct AVFrame;
struct AVInputFormat;
struct AVIOContext;
struct SwrContext;
namespace alexaClientSDK {
namespace mediaPlayer {
namespace android {
/**
* Class responsible for decoding and re-sampling the audio from an input controller.
*
* The decoding is performed on demand. Every time the @c read method is called, the decoder will read the input, and
* decode it until the provided buffer is full.
*
* Decoding is done when the @c DecodingState is equal to DONE or INVALID.
*
* @warning This class is not thread safe, except for the @c abort() method.
*/
class FFmpegDecoder : public DecoderInterface {
public:
/**
* Creates a new decoder buffer queue that reads input data using the given controller.
*
* @param inputController The controller used to retrieve input data.
* @return The new decoder buffer queue if create succeeds, @c nullptr otherwise.
*/
static std::unique_ptr<FFmpegDecoder> create(std::unique_ptr<FFmpegInputControllerInterface> inputController);
/// @name DecoderInterface method overrides.
/// @{
std::pair<Status, size_t> read(int16_t* buffer, size_t size) override;
void abort() override;
/// @}
/**
* Callback function used by FFmpeg to check when a blocking operation should be interrupted.
*
* We interrupt FFmpeg in two different scenarios:
* - @c FFmpegDecoder state is @c INVALID (usually due to a call to @c abort).
* - FFmpeg initialization is taking too long.
*
* @note: The second option is a work around for ACSDK-1679. FFmpeg doesn't seem to be handling @c EAGAIN as
* expected. If an @c EAGAIN occurs during @c avformat_find_stream_info, the method gets stuck. Thus, this method
* will interrupt FFmpeg if initialization is taking too long.
*
* @return @c true if FFmpeg should be interrupted; false otherwise.
*/
bool shouldInterruptFFmpeg();
private:
/**
* Constructor.
*
* @param inputController A controller for the input encoded data.
*/
FFmpegDecoder(std::unique_ptr<FFmpegInputControllerInterface> inputController);
/**
* This enumeration represents the states that the decoder can be in. The possible transitions are:
*
* INITIALIZING -> {DECODING, INVALID}
* DECODING -> {INITIALIZING, FLUSHING_DECODER, INVALID}
* FLUSHING_DECODER -> {FLUSHING_RESAMPLER, INVALID}
* FLUSHING_RESAMPLER -> {FINISHED, INVALID}
*
* The transition from DECODING to INITIALIZING happens when input controller has next track.
*
* @note: The order of states matter since we use less than comparisons.
*/
enum class DecodingState {
/// The input provided still has data that needs to be decoded.
DECODING,
/// The input has been read completely, but decoding hasn't finished yet.
FLUSHING_DECODER,
/// The decoding has finished but the re-sampling might still have unread data.
FLUSHING_RESAMPLER,
/// Decoder is initializing.
INITIALIZING,
/// There is no more data to be decoded / re-sampled. Calls to @c read will return 0 bytes.
FINISHED,
/// The decoder has found an error and it is in an invalid state. Calls to @c read will return 0 bytes.
INVALID
};
/// Friend relationship to allow accessing State to convert it to a string for logging.
friend std::ostream& operator<<(std::ostream& stream, const DecodingState state);
/**
* Sets the @c m_state variable to the value given if and only if the transition is valid.
*
* @param nextState The state that we would like to set.
*/
void setState(DecodingState nextState);
/**
* Internal class used to manage data that was decoded but that didn't fit the buffer passed to @c read.
*/
class UnreadData {
public:
/// Constructor
UnreadData();
/**
* Get the internal frame.
*
* @return A reference to the internal frame.
*/
AVFrame& getFrame();
/**
* Get the current offset.
*
* @return The offset for the first unread sample.
*/
int getOffset() const;
/**
* Resize the buffer if current capacity is less than the required minimum.
*
* @param minimumCapacity The minimum capacity required.
*/
void resize(size_t minimumCapacity);
/**
* Return whether there is any data that hasn't been unread yet.
*
* @return true if there is no unread data, false otherwise.
*/
bool isEmpty() const;
/**
* Set the read offset to given value.
*
* @param offset The new offset value pointing to a position that hasn't been read.
*/
void setOffset(int offset);
private:
/// The resampleFrame buffer size. This is used to know when we need to resize the frame buffer.
size_t m_capacity;
/// The current offset of the unread data inside the frame.
int m_offset;
/// The frame where the data is stored.
std::shared_ptr<AVFrame> m_frame;
};
/**
* Read the data that has been decoded.
*
* @param buffer The buffer where the data will be written to.
* @param size The buffer size in bytes.
* @param wordsRead The number of words that has been read already. This is used to calculate the write offset and
* the amount of data that can still be written to the buffer.
* @return The number of words copied to @c buffer.
*/
size_t readData(int16_t* buffer, size_t size, size_t wordsRead);
/**
* Call the resampler for the given input frame. This method will fill @c m_unreadData with the resampled data.
*
* @param inputFrame The frame with the media data that has to be resampled.
*/
void resample(std::shared_ptr<AVFrame> inputFrame);
/// Call the decoder to start processing more input data.
void decode();
/// Set input controller to point to the next media.
void next();
/// Sleep according to the retry policy. Sleeping thread will be awaken by @c abort() call.
void sleep();
/**
* Read the available decoded frame.
*
* @param decodedFrame A pointer to the frame where the new data will be written to.
*/
void readDecodedFrame(std::shared_ptr<AVFrame>& decodedFrame);
/**
* Initialize the decoder. If it succeeds, it will set the decoder state to @c DECODING.
*
* If there is an unrecoverable error, it will set the decoder to @c INVALID state.
*/
void initialize();
/**
* Parse the status returned by an FFmpeg function.
*
* - If there was a unrecoverable error, set the decoder state to @c INVALID.
* - If the error is recoverable, call @c sleep before returning that an error was found (stay in the same state).
* - If error represents a EOF, move to next state.
*
* @param status The status code returned by the ffmpeg function.
* @param nextState The next state that the decoder should move to in case of a EOF error.
* @param functionName The name of the function that was called. This is used for logging purpose.
* @return @c true if status indicates that the operation succeeded or EOF was found; @c false, otherwise.
*/
bool transitionStateUsingStatus(int status, DecodingState nextState, const std::string& functionName);
/// The decoder state.
std::atomic<DecodingState> m_state;
/// A controller for the input data.
std::unique_ptr<FFmpegInputControllerInterface> m_inputController;
/// Input format context object.
std::shared_ptr<AVFormatContext> m_formatContext;
/// Pointer to the codec context. This is used during the decoding process.
std::shared_ptr<AVCodecContext> m_codecContext;
/// Pointer to the resample context.
std::shared_ptr<SwrContext> m_swrContext;
/// Object that keeps the unread data leftover from the last @c read.
UnreadData m_unreadData;
/// Retry counter used to count the times where data was not available.
size_t m_retryCount;
/// Condition variable used to abort possible wait in the read cycle.
std::condition_variable m_abortCondition;
/// Time when the initialize method started. This is used to abort initialization that might be taking too long.
std::chrono::time_point<std::chrono::steady_clock> m_initializeStartTime;
};
} // namespace android
} // namespace mediaPlayer
} // namespace alexaClientSDK
#endif // ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_
| 36.627306 | 118 | 0.685775 |
fb582c7aa2e77fbe280ff1178da9cd59e2ab74d2 | 1,180 | h | C | CartGrids/GridTypes.h | bulldozer00/BD00UtilityLib | 6bc88362a97eb4381d1a9e3f8603117c0e54909b | [
"MIT"
] | null | null | null | CartGrids/GridTypes.h | bulldozer00/BD00UtilityLib | 6bc88362a97eb4381d1a9e3f8603117c0e54909b | [
"MIT"
] | null | null | null | CartGrids/GridTypes.h | bulldozer00/BD00UtilityLib | 6bc88362a97eb4381d1a9e3f8603117c0e54909b | [
"MIT"
] | null | null | null | #ifndef GRIDTYPES_H_
#define GRIDTYPES_H_
#include <cstdint>
#include <list>
namespace cruRrp {
namespace msp {
namespace topics {
namespace util {
template<typename Entry>
struct SmartEntry {
SmartEntry(const Entry& entryVal, int32_t binIdxVal = 0,
typename std::list<SmartEntry>::iterator iterVal = typename std::list<SmartEntry>::iterator()) :
entry(entryVal), binIdx(binIdxVal), iter(iterVal) {
}
Entry entry; //value
int32_t binIdx; //bin in grid
typename std::list<SmartEntry>::iterator iter; //position in bin
};
struct GridDef {
GridDef(double minMeters, double maxMeters, double deltaBinMeters) :
_minMeters(minMeters), _maxMeters(maxMeters), _deltaBinMeters(deltaBinMeters) {
}
GridDef() :
_minMeters(0.0), _maxMeters(0.0), _deltaBinMeters(1.0) {
}
double _minMeters;
double _maxMeters;
double _deltaBinMeters;
};
struct XyzBinCoords {
int32_t xBin;
int32_t yBin;
int32_t zBin;
};
struct XyzPosCoords {
double xMeters;
double yMeters;
double zMeters;
};
} // namespace util
} // namespace topics
} // namespace msp
} // namespace cruRrp
#endif /* GRIDTYPES_H_ */
| 18.4375 | 109 | 0.690678 |
97d63ae04b37afa56815cebca2d99dca508bf2a8 | 2,947 | h | C | src/ADTF_filter/DH_checkTraffic/checkTraffic.h | jackiecx/AADC_2015_DrivingHorse | 3e2c9893eafc802c64f19ea31c5d43224c56dbbf | [
"BSD-3-Clause"
] | 1 | 2019-06-14T15:21:21.000Z | 2019-06-14T15:21:21.000Z | src/ADTF_filter/DH_checkTraffic/checkTraffic.h | jackiecx/AADC_2015_DrivingHorse | 3e2c9893eafc802c64f19ea31c5d43224c56dbbf | [
"BSD-3-Clause"
] | null | null | null | src/ADTF_filter/DH_checkTraffic/checkTraffic.h | jackiecx/AADC_2015_DrivingHorse | 3e2c9893eafc802c64f19ea31c5d43224c56dbbf | [
"BSD-3-Clause"
] | null | null | null | #ifndef _CHECKTRAFFIC_FILTER_H_
#define _CHECKTRAFFIC_FILTER_H_
#define OID_ADTF_CHECKTRAFFIC_FILTER "adtf.user.CHECKTRAFFIC"
//*************************************************************************************************
class cCheckTraffic : public adtf::cFilter
{
ADTF_FILTER(OID_ADTF_CHECKTRAFFIC_FILTER, "Check Traffic", adtf::OBJCAT_DataFilter);
protected:
cInputPin m_pin_input_range_front_left;
cInputPin m_pin_input_range_front_right;
cInputPin m_pin_input_ir_front_center_long;
cInputPin m_pin_input_ir_front_center_short;
cInputPin m_pin_input_ir_rear_center_short;
cInputPin m_pin_input_ir_rear_right_short;
cInputPin m_pin_input_crossing_type;
cInputPin m_pin_input_reset;
cOutputPin m_pin_output_crossing_type;
tFloat32 m_sensor_front_long, m_sensor_front_short;
tFloat32 m_ussensor_front_left, m_ussensor_front_right;
tFloat32 m_maxdistright, m_maxdistfront, m_maxdistleft, m_minchange, m_recheckint;
tInt32 status;
tInt32 active;
tFloat32 m_front_old, m_left_old, m_right_old;
tInt8 m_type;
tInt8 m_count, m_master_count;
public:
cCheckTraffic(const tChar* __info);
virtual ~cCheckTraffic();
protected:
tResult Init(tInitStage eStage, __exception);
tResult Shutdown(tInitStage eStage, __exception);
tResult Start(__exception = NULL);
tResult Stop(__exception = NULL);
tResult PropertyChanged(const char* strProperty);
// implements IPinEventSink
tResult OnPinEvent(IPin* pSource,
tInt nEventCode,
tInt nParam1,
tInt nParam2,
IMediaSample* pMediaSample);
tResult ProcessCheckTraffic();
tResult TransmitCrossingType(const tInt8 crossingType);
tResult FilterReset();
tHandle m_hTimer;
cCriticalSection m_oCriticalSectionTransmit;
cCriticalSection m_oCriticalSectionTimerSetup;
tResult createTimer();
tResult destroyTimer(__exception = NULL);
tResult Run(tInt nActivationCode, const tVoid* pvUserData, tInt szUserDataSize, ucom::IException** __exception_ptr=NULL);
/*! Coder Descriptor for the output pins*/
cObjectPtr<IMediaTypeDescription> m_pCoderDescSignalOutput;
cObjectPtr<IMediaTypeDescription> m_pCoderDescBoolSignalOutput;
cObjectPtr<IMediaTypeDescription> m_pCoderDescCrossingTypeInput;
/*! Coder Descriptor for the input pins*/
cObjectPtr<IMediaTypeDescription> m_pCoderDescSignalInput;
cObjectPtr<IMediaTypeDescription> m_pCoderDescBoolSignalInput;
cObjectPtr<IMediaTypeDescription> m_pCoderDescCrossingTypeOutput;
};
//*************************************************************************************************
#endif // _CHECKTRAFFIC_PROJECT_FILTER_H_
| 33.488636 | 123 | 0.669834 |
5aef72dd7eedb58f360116b4fd58655ab22484b8 | 1,116 | h | C | src/drivers/mtd/opennand/opennand.h | nikitavlaev/embox | 7ab7a5b649d8a408ecbdaafee8318b1c3dc9cf62 | [
"BSD-2-Clause"
] | 809 | 2015-04-12T00:57:55.000Z | 2022-03-18T13:39:59.000Z | src/drivers/mtd/opennand/opennand.h | nikitavlaev/embox | 7ab7a5b649d8a408ecbdaafee8318b1c3dc9cf62 | [
"BSD-2-Clause"
] | 819 | 2015-04-14T17:54:29.000Z | 2022-03-26T08:52:12.000Z | src/drivers/mtd/opennand/opennand.h | nikitavlaev/embox | 7ab7a5b649d8a408ecbdaafee8318b1c3dc9cf62 | [
"BSD-2-Clause"
] | 274 | 2015-04-15T16:11:52.000Z | 2022-03-25T10:24:43.000Z | /**
* @file
*
* @date Jul 30, 2018
* @author Anton Bondarev
*/
#ifndef SRC_DRIVERS_MTD_OPENNAND_H_
#define SRC_DRIVERS_MTD_OPENNAND_H_
/*
* Command Register F220h (R/W)
*/
#define ONENAND_CMD_READ (0x00)
#define ONENAND_CMD_READOOB (0x13)
#define ONENAND_CMD_PROG (0x80)
#define ONENAND_CMD_PROGOOB (0x1A)
#define ONENAND_CMD_2X_PROG (0x7D)
#define ONENAND_CMD_2X_CACHE_PROG (0x7F)
#define ONENAND_CMD_UNLOCK (0x23)
#define ONENAND_CMD_LOCK (0x2A)
#define ONENAND_CMD_LOCK_TIGHT (0x2C)
#define ONENAND_CMD_UNLOCK_ALL (0x27)
#define ONENAND_CMD_ERASE (0x94)
#define ONENAND_CMD_MULTIBLOCK_ERASE (0x95)
#define ONENAND_CMD_ERASE_VERIFY (0x71)
#define ONENAND_CMD_RESET (0xF0)
#define ONENAND_CMD_OTP_ACCESS (0x65)
#define ONENAND_CMD_READID (0x90)
#define FLEXONENAND_CMD_PI_UPDATE (0x05)
#define FLEXONENAND_CMD_PI_ACCESS (0x66)
#define FLEXONENAND_CMD_RECOVER_LSB (0x05)
#endif /* SRC_DRIVERS_MTD_OPENNAND_H_ */
| 31.885714 | 46 | 0.663978 |
2d4c8a1f5ee4a45476a432ee1e9f17ff3e6d4af5 | 403 | h | C | ai/DeepCoder/docker/DeepCoder/include/find-program.h | quanpan302/test | 313c6e310be0ef608543c23bd52a5466047cd378 | [
"Apache-2.0"
] | null | null | null | ai/DeepCoder/docker/DeepCoder/include/find-program.h | quanpan302/test | 313c6e310be0ef608543c23bd52a5466047cd378 | [
"Apache-2.0"
] | null | null | null | ai/DeepCoder/docker/DeepCoder/include/find-program.h | quanpan302/test | 313c6e310be0ef608543c23bd52a5466047cd378 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <vector>
#include <experimental/optional>
#include "dsl/ast.h"
#include "attribute.h"
#include "example-generator.h"
std::experimental::optional<dsl::Program> dfs(size_t max_length, const Attribute &attr, const std::vector<Example> &examples);
std::experimental::optional<dsl::Program> sort_and_add(size_t max_length, const Attribute &attr, const std::vector<Example> &examples); | 40.3 | 135 | 0.774194 |
eedd15cd13f4385925a0226ae51e2c7197784c1f | 471 | h | C | QiniuSDKTests/QiniuSDKTests.h | noark9/ios-sdk | b45e74f91de1439b57f94ef55a91c70303503bc9 | [
"MIT"
] | 1 | 2015-11-06T03:01:37.000Z | 2015-11-06T03:01:37.000Z | QiniuSDKTests/QiniuSDKTests.h | noark9/ios-sdk | b45e74f91de1439b57f94ef55a91c70303503bc9 | [
"MIT"
] | null | null | null | QiniuSDKTests/QiniuSDKTests.h | noark9/ios-sdk | b45e74f91de1439b57f94ef55a91c70303503bc9 | [
"MIT"
] | null | null | null | //
// QiniuSDKTests.h
// QiniuSDKTests
//
// Created by Qiniu Developers 2013
//
#import <XCTest/XCTest.h>
#import "QiniuSimpleUploader.h"
#import "QiniuResumableUploader.h"
@interface QiniuSDKTests : XCTestCase<QiniuUploadDelegate>
{
BOOL _succeed;
BOOL _done;
BOOL _progressReceived;
NSError *_error;
NSDictionary *_retDictionary;
NSString *_filePath;
NSString *_fileMedium;
NSString *_fileLarge;
NSString *_token;
}
@end
| 17.444444 | 58 | 0.704883 |
6b02ba49b4989cdceb1b506b4b74f3489f48aa21 | 445 | h | C | OpenWeatherFramework/Mac/OpenWeatherMapOSX.framework/Versions/A/Headers/OWMSys.h | jacekgrygiel/OpenWeatherMap-OSX-IOS | d5517c174aa6a19d4d513facfb5736d4ebd4fdda | [
"MIT"
] | null | null | null | OpenWeatherFramework/Mac/OpenWeatherMapOSX.framework/Versions/A/Headers/OWMSys.h | jacekgrygiel/OpenWeatherMap-OSX-IOS | d5517c174aa6a19d4d513facfb5736d4ebd4fdda | [
"MIT"
] | null | null | null | OpenWeatherFramework/Mac/OpenWeatherMapOSX.framework/Versions/A/Headers/OWMSys.h | jacekgrygiel/OpenWeatherMap-OSX-IOS | d5517c174aa6a19d4d513facfb5736d4ebd4fdda | [
"MIT"
] | null | null | null | //
// Sys.h
// OpenWeatherMap Universal Framework
//
// Created by Jacek Grygiel on 24/04/14.
// Copyright (c) 2014 JacekGrygiel. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "OWMBasicModel.h"
@interface OWMSys : OWMBasicModel
@property(nonatomic,strong) NSString *country;
@property(nonatomic, assign) float message;
@property(nonatomic, assign) long long sunrise;
@property(nonatomic, assign) long long sunset;
@end
| 24.722222 | 57 | 0.750562 |
4c03d4a6b8202ad470420fd7d54f841bbdeb5bee | 4,604 | c | C | executor/operator/ref/kernel/detectionOutput/ref_detectionOutput_fp16.c | wangshankun/Tengine_Atlas | b5485039e72b4a624c795ff95d73eb6d719c7706 | [
"Apache-2.0"
] | 25 | 2018-12-09T09:31:56.000Z | 2021-08-12T10:32:19.000Z | executor/operator/ref/kernel/detectionOutput/ref_detectionOutput_fp16.c | wangshankun/Tengine_Atlas | b5485039e72b4a624c795ff95d73eb6d719c7706 | [
"Apache-2.0"
] | 1 | 2022-03-31T03:33:42.000Z | 2022-03-31T03:33:42.000Z | executor/operator/ref/kernel/detectionOutput/ref_detectionOutput_fp16.c | wangshankun/Tengine_Atlas | b5485039e72b4a624c795ff95d73eb6d719c7706 | [
"Apache-2.0"
] | 6 | 2018-12-16T01:18:42.000Z | 2019-09-18T07:29:56.000Z | void get_boxes_fp16(std::vector<Box>& boxes, int num_prior, const __fp16* loc_ptr, const __fp16* prior_ptr)
{
for(int i = 0; i < num_prior; i++)
{
const __fp16* loc = loc_ptr + i * 4;
const __fp16* pbox = prior_ptr + i * 4;
const __fp16* pvar = pbox + num_prior * 4;
// pbox [xmin,ymin,xmax,ymax]
float pbox_w = fp16_to_fp32(pbox[2]) - fp16_to_fp32(pbox[0]);
float pbox_h = fp16_to_fp32(pbox[3]) - fp16_to_fp32(pbox[1]);
float pbox_cx = (fp16_to_fp32(pbox[0]) + fp16_to_fp32(pbox[2])) * 0.5f;
float pbox_cy = (fp16_to_fp32(pbox[1]) + fp16_to_fp32(pbox[3])) * 0.5f;
// loc []
float bbox_cx = fp16_to_fp32(pvar[0]) * fp16_to_fp32(loc[0]) * pbox_w + pbox_cx;
float bbox_cy = fp16_to_fp32(pvar[1]) * fp16_to_fp32(loc[1]) * pbox_h + pbox_cy;
float bbox_w = pbox_w * exp(fp16_to_fp32(pvar[2]) * fp16_to_fp32(loc[2]));
float bbox_h = pbox_h * exp(fp16_to_fp32(pvar[3]) * fp16_to_fp32(loc[3]));
// bbox [xmin,ymin,xmax,ymax]
boxes[i].x0 = bbox_cx - bbox_w * 0.5f;
boxes[i].y0 = bbox_cy - bbox_h * 0.5f;
boxes[i].x1 = bbox_cx + bbox_w * 0.5f;
boxes[i].y1 = bbox_cy + bbox_h * 0.5f;
}
}
static inline float intersection_area_fp16(const Box& a, const Box& b)
{
if(a.x0 > b.x1 || a.x1 < b.x0 || a.y0 > b.y1 || a.y1 < b.y0)
{
return 0.f;
}
float inter_width = std::min(a.x1, b.x1) - std::max(a.x0, b.x0);
float inter_height = std::min(a.y1, b.y1) - std::max(a.y0, b.y0);
return inter_width * inter_height;
}
void nms_sorted_bboxes_fp16(const std::vector<Box>& bboxes, std::vector<int>& picked, float nms_threshold)
{
picked.clear();
const int n = bboxes.size();
std::vector<float> areas(n);
for(int i = 0; i < n; i++)
{
const Box& r = bboxes[i];
float width = r.x1 - r.x0;
float height = r.y1 - r.y0;
areas[i] = width * height;
}
for(int i = 0; i < n; i++)
{
const Box& a = bboxes[i];
int keep = 1;
for(int j = 0; j < ( int )picked.size(); j++)
{
const Box& b = bboxes[picked[j]];
float inter_area = intersection_area_fp16(a, b);
float union_area = areas[i] + areas[picked[j]] - inter_area;
if(inter_area / union_area > nms_threshold)
keep = 0;
}
if(keep)
picked.push_back(i);
}
}
int ref_DetectionOutput_fp16(const __fp16* location, const __fp16* confidence, const __fp16* priorbox,
std::vector<int> dims, ddo_param* param_)
{
const int num_priorx4 = dims[2];
const int num_prior = num_priorx4 / 4;
const int num_classes = param_->num_classes;
const __fp16* loc_ptr = location;
const __fp16* conf_ptr = confidence;
const __fp16* prior_ptr = priorbox;
std::vector<Box> boxes(num_prior);
get_boxes_fp16(boxes, num_prior, loc_ptr, prior_ptr);
std::vector<std::vector<Box>> temp_all_box;
temp_all_box.clear();
temp_all_box.resize(num_classes);
for(int i = 1; i < num_classes; i++)
{
std::vector<Box> class_box;
for(int j = 0; j < num_prior; j++)
{
float score = fp16_to_fp32(conf_ptr[j * num_classes + i]);
if(score > param_->confidence_threshold)
{
boxes[j].score = score;
boxes[j].class_idx = i;
class_box.push_back(boxes[j]);
}
}
std::sort(class_box.begin(), class_box.end(), [](const Box& a, const Box& b) { return a.score > b.score; });
if(param_->nms_top_k < ( int )class_box.size())
{
class_box.resize(param_->nms_top_k);
}
std::vector<int> picked;
nms_sorted_bboxes_fp16(class_box, picked, param_->nms_threshold);
for(int j = 0; j < ( int )picked.size(); j++)
{
int z = picked[j];
temp_all_box[i].push_back(class_box[z]);
}
}
param_->bbox_rects.clear();
for(int i = 0; i < param_->num_classes; i++)
{
const std::vector<Box> class_bbox_rects = temp_all_box[i];
param_->bbox_rects.insert(param_->bbox_rects.end(), class_bbox_rects.begin(), class_bbox_rects.end());
}
std::sort(param_->bbox_rects.begin(), param_->bbox_rects.end(),
[](const Box& a, const Box& b) { return a.score > b.score; });
if(param_->keep_top_k < ( int )param_->bbox_rects.size())
{
param_->bbox_rects.resize(param_->keep_top_k);
}
return 0;
}
| 32.652482 | 116 | 0.567984 |
492c634d016829eca80a12700877b9f618302188 | 1,395 | c | C | libft/srcs/lst/ft_lstnew.c | Iipal/obfuscation | 5219d7ece5b137a28ddd0d7ac919617047159899 | [
"MIT"
] | 5 | 2019-01-01T19:04:43.000Z | 2020-01-16T05:04:12.000Z | libft/srcs/lst/ft_lstnew.c | Iipal/obfuscation | 5219d7ece5b137a28ddd0d7ac919617047159899 | [
"MIT"
] | null | null | null | libft/srcs/lst/ft_lstnew.c | Iipal/obfuscation | 5219d7ece5b137a28ddd0d7ac919617047159899 | [
"MIT"
] | 1 | 2019-01-02T10:31:59.000Z | 2019-01-02T10:31:59.000Z | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaluh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/27 17:56:10 by tmaluh #+# #+# */
/* Updated: 2018/10/27 18:14:38 by tmaluh ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../includes/lft_lst.h"
#include "../../includes/lft_mem.h"
t_list *ft_lstnew(void const *content, size_t content_size)
{
t_list *out;
if ((out = (t_list*)malloc(sizeof(t_list))) == NULL)
return (NULL);
if (content == NULL)
{
out->content = NULL;
out->content_size = 0;
}
else
{
if ((out->content = malloc(content_size)) == NULL)
return (NULL);
ft_memmove(out->content, content, content_size);
out->content_size = content_size;
}
out->next = NULL;
return (out);
}
| 37.702703 | 80 | 0.295341 |
407c3df81fefef3036460d379d9b1ff4f9fb8b65 | 870 | c | C | deps/unixODBC-2.3.4/ini/iniClose.c | abdalla/docker-image-for-python-boto3-mysql | 43cc72ff611ddc7578ff2c815c73fc333d27074a | [
"MIT"
] | null | null | null | deps/unixODBC-2.3.4/ini/iniClose.c | abdalla/docker-image-for-python-boto3-mysql | 43cc72ff611ddc7578ff2c815c73fc333d27074a | [
"MIT"
] | null | null | null | deps/unixODBC-2.3.4/ini/iniClose.c | abdalla/docker-image-for-python-boto3-mysql | 43cc72ff611ddc7578ff2c815c73fc333d27074a | [
"MIT"
] | null | null | null | /**********************************************************************************
* .
*
*
**************************************************
* This code was created by Peter Harvey @ CodeByDesign.
* Released under LGPL 28.JAN.99
*
* Contributions from...
* -----------------------------------------------
* Peter Harvey - pharvey@codebydesign.com
**************************************************/
#include <config.h>
#include "ini.h"
/******************************
* iniClose
*
* 1. free memory previously allocated for HINI
* 2. DO NOT save any changes (see iniCommit)
******************************/
int iniClose( HINI hIni )
{
/* SANITY CHECKS */
if ( hIni == NULL )
return INI_ERROR;
hIni->hCurObject = hIni->hFirstObject;
while ( iniObjectDelete( hIni ) == INI_SUCCESS )
{
}
free( hIni );
return INI_SUCCESS;
}
| 21.75 | 83 | 0.41954 |
5614297bf6965f3bddc31a42a89f987036d96ccb | 242 | c | C | lib/wizards/walla/dl/eq/shittyrags.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | lib/wizards/walla/dl/eq/shittyrags.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | lib/wizards/walla/dl/eq/shittyrags.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | inherit "obj/armour";
start() {
set_class(2);
set_slot("torso");
set_name("rags");
set_alias("rags");
set_short("Shitty rags");
set_long("These are nothing more but shitty rags.");
set_value(1);
set_weight(1);
}
| 18.615385 | 56 | 0.615702 |
f43b356183df213f47908d8efbe2db8692cb39f8 | 1,102 | c | C | d/player_houses/daelmas/rooms/land5.c | gesslar/shadowgate | 97ce5d33a2275bb75c0cf6556602564b7870bc77 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/player_houses/daelmas/rooms/land5.c | gesslar/shadowgate | 97ce5d33a2275bb75c0cf6556602564b7870bc77 | [
"MIT"
] | null | null | null | d/player_houses/daelmas/rooms/land5.c | gesslar/shadowgate | 97ce5d33a2275bb75c0cf6556602564b7870bc77 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | //Coded by Diego//
#include <std.h>
#include "../daelmas.h"
inherit VAULT;
void create(){
::create();
set_name("Fifth landing");
set_short("fifth landing");
set_long(
"%^RESET%^"+
"You take a deep breath, unsure if you can climb yet "+
"another step. A torch lights the stairway as it continues "+
"its ascension upwards. There are also wooden doors to the "+
"left and right of you.\n"
);
set_terrain(STONE_BUILDING);
set_travel(PAVED_ROAD);
set_property("indoors",1);
set_property("light",2);
set_smell("default","The air is clean and smells faintly of flowers.");
set_listen("default","You hear hushed whispers from somewhere within the tower.");
set_items(([
]));
set_door("door",DROOMS+"study","east","marble key");
set_locked("door",1,"lock");
(DROOMS+"study")->set_locked("door",1,"lock");
set_door_description("door","The door is made of polished oak.");
set_string("door","open","You open the door into a study.\n");
set_exits(([
"up" : DROOMS+"land6",
"down" : DROOMS+"land4",
"east" : DROOMS+"study"
]));
} | 29 | 85 | 0.647005 |
3cdc8d8c604723006ac42f1470959a986c894472 | 577 | h | C | CentipedeGame_gageoconnor/Game Components/TEAL/CollisionGridBase.h | Shaditto/centipede-teal | f078b11eaecddae17709dc9f917348b7b0733d56 | [
"MIT"
] | null | null | null | CentipedeGame_gageoconnor/Game Components/TEAL/CollisionGridBase.h | Shaditto/centipede-teal | f078b11eaecddae17709dc9f917348b7b0733d56 | [
"MIT"
] | null | null | null | CentipedeGame_gageoconnor/Game Components/TEAL/CollisionGridBase.h | Shaditto/centipede-teal | f078b11eaecddae17709dc9f917348b7b0733d56 | [
"MIT"
] | 1 | 2019-11-13T19:26:34.000Z | 2019-11-13T19:26:34.000Z | // CollisionGridBase
// Andre Berthiaume, July 2012
#ifndef _CollisionGridBase
#define _CollisionGridBase
class CollisionGridBase
{
protected:
bool ReflexiveCollision;
bool FixedType;
public:
CollisionGridBase(){ ReflexiveCollision = false; FixedType = false; }
virtual void ClearInstance(){};
virtual void SetInstance( CollisionGridBase* instanceptr ){};
virtual void DestroyInstance() =0;
void SetReflexiveCollision(bool b){ ReflexiveCollision = b; }
void SetFixedType(bool b){ FixedType = b; }
virtual void PartitionSpace() =0;
};
#endif _CollisionGridBase | 22.192308 | 70 | 0.769497 |
14b67ab5a51b2402dc665d528e2c2cbf782d79e6 | 1,469 | h | C | code/addons/faudio/audioserver.h | gscept/nebula-trifid | e7c0a0acb05eedad9ed37a72c1bdf2d658511b42 | [
"BSD-2-Clause"
] | 67 | 2015-03-30T19:56:16.000Z | 2022-03-11T13:52:17.000Z | code/addons/faudio/audioserver.h | gscept/nebula-trifid | e7c0a0acb05eedad9ed37a72c1bdf2d658511b42 | [
"BSD-2-Clause"
] | 5 | 2015-04-15T17:17:33.000Z | 2016-02-11T00:40:17.000Z | code/addons/faudio/audioserver.h | gscept/nebula-trifid | e7c0a0acb05eedad9ed37a72c1bdf2d658511b42 | [
"BSD-2-Clause"
] | 34 | 2015-03-30T15:08:00.000Z | 2021-09-23T05:55:10.000Z | #pragma once
//------------------------------------------------------------------------------
/**
@class FAudio::AudioServer
Front-end of the Audio subsystem. Initializes the audio
subsystem.
(C) 2014-2016 Individual contributors, see AUTHORS file
*/
#include "core/refcounted.h"
#include "core/singleton.h"
namespace FAudio { class AudioDevice; class AudioHandler; }
namespace Db { class Database; }
//------------------------------------------------------------------------------
namespace FAudio
{
class AudioServer : public Core::RefCounted
{
__DeclareClass(AudioServer);
__DeclareSingleton(AudioServer);
public:
/// constructor
AudioServer();
/// destructor
virtual ~AudioServer();
/// open the audio subsystem (waits for completion)
void Open();
/// close the audio subsystem (waits for completion)
void Close();
/// return true if the audio subsystem is open
bool IsOpen() const;
/// called per-frame
void OnFrame();
/// load all banks marked as autoload
void LoadBanks(const Ptr<Db::Database> & staticDb);
private:
bool isOpen;
IndexT adapterIndex;
Ptr<AudioDevice> device;
Ptr<AudioHandler> handler;
};
//------------------------------------------------------------------------------
/**
*/
inline bool
AudioServer::IsOpen() const
{
return this->isOpen;
}
} // namespace FAudio
//------------------------------------------------------------------------------
| 24.898305 | 80 | 0.535058 |
14d899265bb64935e3d266856e5aaf7adf318005 | 1,073 | c | C | src/math/log_e.c | jairaj-arava/sof | bcccf1253d8b52bfdfc2ba1c4b178d747ee0cf79 | [
"BSD-3-Clause"
] | null | null | null | src/math/log_e.c | jairaj-arava/sof | bcccf1253d8b52bfdfc2ba1c4b178d747ee0cf79 | [
"BSD-3-Clause"
] | null | null | null | src/math/log_e.c | jairaj-arava/sof | bcccf1253d8b52bfdfc2ba1c4b178d747ee0cf79 | [
"BSD-3-Clause"
] | 1 | 2022-01-09T19:23:11.000Z | 2022-01-09T19:23:11.000Z | // SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2021 Intel Corporation. All rights reserved.
//
// Author: Shriram Shastry <malladi.sastry@linux.intel.com>
//
//
#include <sof/math/log.h>
#include <sof/audio/format.h>
/**
* Base-e logarithm loge(x)
*
* loge = (u) computes the base-e logarithm of
* u using lookup table.
* input u must be scalar/real number and positive
*
* +------------------+-----------------+--------+--------+
* | inpfxp |loge (returntype)| inpfxp | loge |
* +----+-----+-------+----+----+-------+--------+--------+
* |WLen| FLen|Signbit|WLen|FLen|Signbit| Qformat| Qformat|
* +----+-----+-------+----+----+-------+--------+--------+
* | 32 | 0 | 0 | 32 | 27 | 0 | 32.0 | 5.27 |
* +------------------+-----------------+--------+--------+
*
* Arguments : uint32_t numerator [1 to 4294967295- Q32.0]
* Return Type : uint32_t UQ5.27 [ 0 to 22.1808076352]
*/
uint32_t ln_int32(uint32_t numerator)
{
return((uint32_t)Q_SHIFT_RND((int64_t)base2_logarithm(numerator) *
ONE_OVER_LOG2_E, 64, 32));
}
| 31.558824 | 67 | 0.51165 |
addd672a6a7b15c069e34bdb3060cea300882386 | 15,277 | h | C | source/textfont.h | tajmone/hugo | 691869933e7b5cbfc9208fd2b4c6483a529e25e1 | [
"BSD-2-Clause"
] | null | null | null | source/textfont.h | tajmone/hugo | 691869933e7b5cbfc9208fd2b4c6483a529e25e1 | [
"BSD-2-Clause"
] | 1 | 2019-10-25T00:46:02.000Z | 2019-10-25T00:46:02.000Z | source/textfont.h | tajmone/hugo | 691869933e7b5cbfc9208fd2b4c6483a529e25e1 | [
"BSD-2-Clause"
] | null | null | null | /*
* textfont.h
*
* Non-proportional 8x8 font definition, in the event that no
* other font map is available.
*
*/
#define FONT_WIDTH 8
#define FONT_HEIGHT 8
#define FONT_COUNT 224
static unsigned char text_font[FONT_COUNT][FONT_HEIGHT] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ' ' */
{ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* '!' */
{ 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* '"' */
{ 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00 }, /* '#' */
{ 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00 }, /* '$' */
{ 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00 }, /* '%' */
{ 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00 }, /* '&' */
{ 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* ''' */
{ 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00 }, /* '(' */
{ 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00 }, /* ')' */
{ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00 }, /* '*' */
{ 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00 }, /* '+' */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 }, /* ',' */
{ 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00 }, /* '-' */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 }, /* '.' */
{ 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00 }, /* '/' */
{ 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00 }, /* '0' */
{ 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00 }, /* '1' */
{ 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00 }, /* '2' */
{ 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00 }, /* '3' */
{ 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00 }, /* '4' */
{ 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00 }, /* '5' */
{ 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00 }, /* '6' */
{ 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00 }, /* '7' */
{ 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00 }, /* '8' */
{ 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00 }, /* '9' */
{ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 }, /* ':' */
{ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 }, /* ';' */
{ 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00 }, /* '<' */
{ 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00 }, /* '=' */
{ 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00 }, /* '>' */
{ 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00 }, /* '?' */
{ 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00 }, /* '@' */
{ 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00 }, /* 'A' */
{ 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00 }, /* 'B' */
{ 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00 }, /* 'C' */
{ 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00 }, /* 'D' */
{ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00 }, /* 'E' */
{ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00 }, /* 'F' */
{ 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00 }, /* 'G' */
{ 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00 }, /* 'H' */
{ 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* 'I' */
{ 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00 }, /* 'J' */
{ 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00 }, /* 'K' */
{ 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00 }, /* 'L' */
{ 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00 }, /* 'M' */
{ 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00 }, /* 'N' */
{ 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00 }, /* 'O' */
{ 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 }, /* 'P' */
{ 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00 }, /* 'Q' */
{ 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00 }, /* 'R' */
{ 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00 }, /* 'S' */
{ 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* 'T' */
{ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00 }, /* 'U' */
{ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00 }, /* 'V' */
{ 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 }, /* 'W' */
{ 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00 }, /* 'X' */
{ 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00 }, /* 'Y' */
{ 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00 }, /* 'Z' */
{ 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00 }, /* '[' */
{ 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00 }, /* '\' */
{ 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00 }, /* ']' */
{ 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00 }, /* '^' */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }, /* '_' */
{ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* '`' */
{ 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00 }, /* 'a' */
{ 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00 }, /* 'b' */
{ 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00 }, /* 'c' */
{ 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00 }, /* 'd' */
{ 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 }, /* 'e' */
{ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00 }, /* 'f' */
{ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 }, /* 'g' */
{ 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00 }, /* 'h' */
{ 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* 'i' */
{ 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78 }, /* 'j' */
{ 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00 }, /* 'k' */
{ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* 'l' */
{ 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00 }, /* 'm' */
{ 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00 }, /* 'n' */
{ 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00 }, /* 'o' */
{ 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0 }, /* 'p' */
{ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E }, /* 'q' */
{ 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00 }, /* 'r' */
{ 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00 }, /* 's' */
{ 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00 }, /* 't' */
{ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00 }, /* 'u' */
{ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00 }, /* 'v' */
{ 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00 }, /* 'w' */
{ 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00 }, /* 'x' */
{ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 }, /* 'y' */
{ 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00 }, /* 'z' */
{ 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00 }, /* '{' */
{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 }, /* '|' */
{ 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00 }, /* '}' */
{ 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* '~' */
{ 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00 }, /* '' */
{ 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x18, 0x0C, 0x78 }, /* '€' */
{ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 }, /* '' */
{ 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 }, /* '‚' */
{ 0x7E, 0xC3, 0x3C, 0x06, 0x3E, 0x66, 0x3F, 0x00 }, /* 'ƒ' */
{ 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 }, /* '„' */
{ 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 }, /* '…' */
{ 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 }, /* '†' */
{ 0x00, 0x00, 0x78, 0xC0, 0xC0, 0x78, 0x0C, 0x38 }, /* '‡' */
{ 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00 }, /* 'ˆ' */
{ 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 }, /* '‰' */
{ 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00 }, /* 'Š' */
{ 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* '‹' */
{ 0x7C, 0xC6, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00 }, /* 'Œ' */
{ 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* '' */
{ 0xC6, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00 }, /* 'Ž' */
{ 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00 }, /* '' */
{ 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00 }, /* '' */
{ 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00 }, /* '‘' */
{ 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00 }, /* '’' */
{ 0x78, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 }, /* '“' */
{ 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 }, /* '”' */
{ 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 }, /* '•' */
{ 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 }, /* '–' */
{ 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 }, /* '—' */
{ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8 }, /* '˜' */
{ 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00 }, /* '™' */
{ 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00 }, /* 'š' */
{ 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18 }, /* '›' */
{ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00 }, /* 'œ' */
{ 0xCC, 0xCC, 0x78, 0xFC, 0x30, 0xFC, 0x30, 0x30 }, /* '' */
{ 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC7 }, /* 'ž' */
{ 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70 }, /* 'Ÿ' */
{ 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x7E, 0x00 }, /* ' ' */
{ 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 }, /* '¡' */
{ 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00 }, /* '¢' */
{ 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x7E, 0x00 }, /* '£' */
{ 0x00, 0xF8, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0x00 }, /* '¤' */
{ 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00 }, /* '¥' */
{ 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00 }, /* '¦' */
{ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00 }, /* '§' */
{ 0x30, 0x00, 0x30, 0x60, 0xC0, 0xCC, 0x78, 0x00 }, /* '¨' */
{ 0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00 }, /* '©' */
{ 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00 }, /* 'ª' */
{ 0xC3, 0xC6, 0xCC, 0xDE, 0x33, 0x66, 0xCC, 0x0F }, /* '«' */
{ 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6F, 0xCF, 0x03 }, /* '¬' */
{ 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* '' */
{ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00 }, /* '®' */
{ 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00 }, /* '¯' */
{ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 }, /* '°' */
{ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA }, /* '±' */
{ 0xDB, 0x77, 0xDB, 0xEE, 0xDB, 0x77, 0xDB, 0xEE }, /* '²' */
{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }, /* '³' */
{ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18 }, /* '´' */
{ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18 }, /* 'µ' */
{ 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36 }, /* '¶' */
{ 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36 }, /* '·' */
{ 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18 }, /* '¸' */
{ 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36 }, /* '¹' */
{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }, /* 'º' */
{ 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36 }, /* '»' */
{ 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00 }, /* '¼' */
{ 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00 }, /* '½' */
{ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00 }, /* '¾' */
{ 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18 }, /* '¿' */
{ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00 }, /* 'À' */
{ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00 }, /* 'Á' */
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18 }, /* 'Â' */
{ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18 }, /* 'Ã' */
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 }, /* 'Ä' */
{ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18 }, /* 'Å' */
{ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18 }, /* 'Æ' */
{ 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36 }, /* 'Ç' */
{ 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00 }, /* 'È' */
{ 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36 }, /* 'É' */
{ 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00 }, /* 'Ê' */
{ 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36 }, /* 'Ë' */
{ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36 }, /* 'Ì' */
{ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00 }, /* 'Í' */
{ 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36 }, /* 'Î' */
{ 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00 }, /* 'Ï' */
{ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00 }, /* 'Ð' */
{ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18 }, /* 'Ñ' */
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36 }, /* 'Ò' */
{ 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00 }, /* 'Ó' */
{ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00 }, /* 'Ô' */
{ 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18 }, /* 'Õ' */
{ 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36 }, /* 'Ö' */
{ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36 }, /* '×' */
{ 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18 }, /* 'Ø' */
{ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00 }, /* 'Ù' */
{ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18 }, /* 'Ú' */
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, /* 'Û' */
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF }, /* 'Ü' */
{ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0 }, /* 'Ý' */
{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F }, /* 'Þ' */
{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 }, /* 'ß' */
{ 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00 }, /* 'à' */
{ 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0 }, /* 'á' */
{ 0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00 }, /* 'â' */
{ 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00 }, /* 'ã' */
{ 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00 }, /* 'ä' */
{ 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00 }, /* 'å' */
{ 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0 }, /* 'æ' */
{ 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00 }, /* 'ç' */
{ 0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC }, /* 'è' */
{ 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00 }, /* 'é' */
{ 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00 }, /* 'ê' */
{ 0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00 }, /* 'ë' */
{ 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00 }, /* 'ì' */
{ 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0 }, /* 'í' */
{ 0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00 }, /* 'î' */
{ 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00 }, /* 'ï' */
{ 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x00 }, /* 'ð' */
{ 0x30, 0x30, 0xFC, 0x30, 0x30, 0x00, 0xFC, 0x00 }, /* 'ñ' */
{ 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00 }, /* 'ò' */
{ 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00 }, /* 'ó' */
{ 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18 }, /* 'ô' */
{ 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70 }, /* 'õ' */
{ 0x30, 0x30, 0x00, 0xFC, 0x00, 0x30, 0x30, 0x00 }, /* 'ö' */
{ 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00 }, /* '÷' */
{ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00 }, /* 'ø' */
{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 }, /* 'ù' */
{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 }, /* 'ú' */
{ 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C }, /* 'û' */
{ 0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00 }, /* 'ü' */
{ 0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00 }, /* 'ý' */
{ 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00 }, /* 'þ' */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 'ÿ' */
};
| 63.390041 | 66 | 0.490476 |
7142a772d736b9e43819f1cfc286a5fbe160e16d | 308 | h | C | Learn/5.3.x/CryEngineEditor/MFC/Editor/Editor/CryHeader.h | longlongwaytogo/CryEngineV_Proj | 2073b5e7a86445f41ef70f8986213e39c0ae37a0 | [
"Apache-2.0"
] | null | null | null | Learn/5.3.x/CryEngineEditor/MFC/Editor/Editor/CryHeader.h | longlongwaytogo/CryEngineV_Proj | 2073b5e7a86445f41ef70f8986213e39c0ae37a0 | [
"Apache-2.0"
] | null | null | null | Learn/5.3.x/CryEngineEditor/MFC/Editor/Editor/CryHeader.h | longlongwaytogo/CryEngineV_Proj | 2073b5e7a86445f41ef70f8986213e39c0ae37a0 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <CryCore/Project/CryModuleDefs.h>
#define eCryModule eCryM_Editor //eCryM_Launcher // eCryM_Editor
#define Cry_Error(info) OutputDebugStringA(info)
#include <CryCommon/CryCore/Platform/platform.h>
#include <CrySystem/ISystem.h>
#include <CryCommon/CryCore/Platform/platform_impl.inl> | 34.222222 | 65 | 0.814935 |
516f358f5f3f153c9641337fd6ee4fa41a77aa5d | 541 | c | C | C/MinimumASCIIDeleteSumforTwoStrings.c | JumHorn/leetcode | 1447237ae8fc3920b19f60b30c71a84b088cc200 | [
"MIT"
] | 1 | 2018-01-22T12:06:28.000Z | 2018-01-22T12:06:28.000Z | C/MinimumASCIIDeleteSumforTwoStrings.c | JumHorn/leetcode | 1447237ae8fc3920b19f60b30c71a84b088cc200 | [
"MIT"
] | null | null | null | C/MinimumASCIIDeleteSumforTwoStrings.c | JumHorn/leetcode | 1447237ae8fc3920b19f60b30c71a84b088cc200 | [
"MIT"
] | null | null | null | #include <string.h>
#define min(a, b) (((a) < (b)) ? (a) : (b))
int minimumDeleteSum(char* s1, char* s2)
{
int M = strlen(s1), N = strlen(s2);
int dp[M + 1][N + 1];
dp[0][0] = 0;
for (int i = 0; i < M; ++i)
dp[i + 1][0] = dp[i][0] + s1[i];
for (int j = 0; j < N; ++j)
dp[0][j + 1] = dp[0][j] + s2[j];
for (int i = 0; i < M; ++i)
{
for (int j = 0; j < N; ++j)
{
if (s1[i] == s2[j])
dp[i + 1][j + 1] = dp[i][j];
else
dp[i + 1][j + 1] = min(dp[i + 1][j] + s2[j], dp[i][j + 1] + s1[i]);
}
}
return dp[M][N];
}
| 20.807692 | 71 | 0.406654 |
5e56b9699c90d7a304e3ec94db17e4e30448de88 | 1,236 | h | C | Src/Data/QvtkBiopsyData.h | wuzhuobin/QvtkProject | 30bfc798aca0e79043438aa16840464e6731e38c | [
"RSA-MD"
] | 1 | 2018-09-10T12:14:43.000Z | 2018-09-10T12:14:43.000Z | Src/Data/QvtkBiopsyData.h | wuzhuobin/QvtkProject | 30bfc798aca0e79043438aa16840464e6731e38c | [
"RSA-MD"
] | 3 | 2018-05-22T11:00:59.000Z | 2018-12-07T09:36:19.000Z | Src/Data/QvtkBiopsyData.h | wuzhuobin/QvtkProject | 30bfc798aca0e79043438aa16840464e6731e38c | [
"RSA-MD"
] | null | null | null | #ifndef __QVTK_BIOPSY_DATA_H__
#define __QVTK_BIOPSY_DATA_H__
#pragma once
// me
#include "QvtkPolyData.h"
#include "data_export.h"
namespace Q {
namespace vtk {
// class BiopsyData :
// public PolyData
// {
// Q_OBJECT;
// Q_VTK_DATA_H(
// BiopsyData,
// Q_VTK_KEY(Radius)
// )
// public:
// BiopsyData();
// virtual ~BiopsyData() override;
// virtual void printSelf() const override;
//
// virtual void readXML(const QDomElement& xml, QString directoryPath = QString()) override;
// virtual void writeXML(QDomElement& xml, QString directoryPath = QString()) const override;
//
// virtual bool writeData(QString rootDirectory = QString()) const override;
//
// virtual double getRadius() const { return this->m_radius; }
// public slots:
// virtual void setRadius(double radius) { this->m_radius = radius; }
//
// protected:
// virtual BiopsyData* newInstance() const override { return new BiopsyData; }
//
// private:
// double m_radius;
//
// };
class DATA_EXPORT BiopsyData : public PolyData
{
Q_OBJECT;
Q_VTK_DATA_H(BiopsyData);
protected:
virtual BiopsyData *newInstance() const override { return new BiopsyData; }
};
}
}
////class BiopsyData:
//
#endif // !__QVTK_BIOPSY_DATA_H__
| 24.235294 | 95 | 0.694984 |
999b8073958734fe1ec934485ad0e890db6e43b6 | 11,153 | c | C | DroneOS/Source/comPacketQueue.c | hightower70/CygnusFlightControllerDev | 95fbb1823b6db5eaded2fc7a46d96e99c15de4c9 | [
"BSD-2-Clause"
] | null | null | null | DroneOS/Source/comPacketQueue.c | hightower70/CygnusFlightControllerDev | 95fbb1823b6db5eaded2fc7a46d96e99c15de4c9 | [
"BSD-2-Clause"
] | null | null | null | DroneOS/Source/comPacketQueue.c | hightower70/CygnusFlightControllerDev | 95fbb1823b6db5eaded2fc7a46d96e99c15de4c9 | [
"BSD-2-Clause"
] | null | null | null | /*****************************************************************************/
/* Communication packet queue handling functions */
/* */
/* Copyright (C) 2014-2015 Laszlo Arvai */
/* All rights reserved. */
/* */
/* This software may be modified and distributed under the terms */
/* of the GNU General Public License. See the LICENSE file for details. */
/*****************************************************************************/
/*****************************************************************************/
/* Includes */
/*****************************************************************************/
#include <comPacketQueue.h>
/*****************************************************************************/
/* Constants */
/*****************************************************************************/
/*****************************************************************************/
/* Module local functions */
/*****************************************************************************/
static void comPacketQueueCallbackExecute(comPacketQueue* in_queue, comQueueEvent in_event);
/*****************************************************************************/
/* Public functions */
/*****************************************************************************/
///////////////////////////////////////////////////////////////////////////////
/// @brief Initialize packet queue
/// @param in_queue Packet queue description
/// @param in_packet_buffer Packet data buffer
/// @param in_buffer_size Packet data buffer size in bytes
void comPacketQueueInitialize(comPacketQueue* in_queue, uint8_t* in_packet_buffer, uint16_t in_buffer_size)
{
in_queue->Buffer = in_packet_buffer;
in_queue->BufferSize = in_buffer_size;
sysMutexCreate(in_queue->PushLock);
in_queue->PushIndex = 0;
in_queue->PopIndex = 0;
in_queue->Callback = sysNULL;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Gets pointer to the packet info header in the packet queue
/// @param in_queue Queue description
/// @param in_packet_index Packet index
comPacketInfo* comPacketQueueGetPacketInfo(comPacketQueue* in_queue, uint16_t in_packet_index)
{
return (comPacketInfo*)&(in_queue->Buffer[in_packet_index]);
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Gets pointer to the packet buffer
/// @param in_queue Queue description
/// @param in_packet_index Packet index
uint8_t* comPacketQueueGetPacketBuffer(comPacketQueue* in_queue, uint16_t in_packet_index)
{
return ((uint8_t*)&(in_queue->Buffer[in_packet_index])) + sizeof(comPacketInfo);
}
/*****************************************************************************/
/* Queue PUSH functions */
/*****************************************************************************/
///////////////////////////////////////////////////////////////////////////////
/// @brief Allocated space for a packet in the queue. Handles multiple thread access.
/// @param in_queue Queue descriptor
/// @param in_size Size of the packet to allocate
/// @param in_source_interface Source Interface number (where the packet comes)
uint16_t comPacketQueuePushBegin(comPacketQueue* in_queue, uint8_t in_size, uint8_t in_source_interface)
{
uint16_t total_size;
comPacketInfo* packet_info = sysNULL;
uint16_t packet_index = comINVALID_PACKET_INDEX;
sysASSERT(in_queue != sysNULL);
// reserve storage from the queue
total_size = sizeof(comPacketInfo) + in_size;
// reserve storage in a critical section
sysMutexTake(in_queue->PushLock, sysINFINITE_TIMEOUT);
// reserve space from the end of the buffer
if (in_queue->PopIndex <= in_queue->PushIndex && in_queue->PushIndex + total_size < in_queue->BufferSize)
{
// there is enough space at the end of the buffer
packet_index = in_queue->PushIndex;
packet_info = (comPacketInfo*)&(in_queue->Buffer[packet_index]);
in_queue->PushIndex += total_size;
packet_info->Status = comPQS_Reserved;
// wrap around push index
if (in_queue->PushIndex >= in_queue->BufferSize)
{
// there is no space beind this packet -> wrap push pointer
in_queue->PushIndex = 0;
}
}
else
{
// handle push pointer wrap around condition -> terminate queue
if (in_queue->PopIndex <= in_queue->PushIndex)
{
// terminate end of the queue
((comPacketInfo*)&in_queue->Buffer[in_queue->PushIndex])->Status = comPQS_EndOfQueue;
in_queue->PushIndex = 0;
}
// reserve space from the beginning of the buffer
if (in_queue->PushIndex + total_size + 1 < in_queue->PopIndex) // +1 to never have the same value of the push and pop index except when queue is empty
{
packet_index = in_queue->PushIndex;
packet_info = (comPacketInfo*)&(in_queue->Buffer[packet_index]);
in_queue->PushIndex += total_size;
packet_info->Status = comPQS_Reserved;
}
else
{
// no free space in the buffer
packet_index = comINVALID_PACKET_INDEX;
}
}
// release lock
sysMutexGive(in_queue->PushLock);
// initialize packet info
if (packet_info != sysNULL)
{
packet_info->Size = in_size;
packet_info->Interface = in_source_interface;
packet_info->Timestamp = sysGetSystemTick();
}
return packet_index;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Finishes push operation
/// @param in_queue Queue description
/// @param in_packet_index Packet index to finish
void comPacketQueuePushEnd(comPacketQueue* in_queue, uint16_t in_packet_index)
{
comPacketInfo* packet_info = sysNULL;
sysASSERT(in_queue != sysNULL);
sysASSERT(in_packet_index < in_queue->BufferSize);
// mark packet as 'ready'
packet_info = (comPacketInfo*)&(in_queue->Buffer[in_packet_index]);
sysASSERT(packet_info->Status == comPQS_Reserved);
packet_info->Status = comPQS_Ready;
// execute callback
comPacketQueueCallbackExecute(in_queue, comQE_PacketPushed);
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Cancels push operation
/// @param in_queue Queue description
/// @param in_packet_index Packet index to cancel
void comPacketQueuePushCancel(comPacketQueue* in_queue, uint16_t in_packet_index)
{
comPacketInfo* packet_info = sysNULL;
sysASSERT(in_queue != sysNULL);
sysASSERT(in_packet_index < in_queue->BufferSize);
// mark packet as 'deleted'
packet_info = (comPacketInfo*)&in_queue->Buffer[in_packet_index];
sysASSERT(packet_info->Status == comPQS_Reserved);
packet_info->Status = comPQS_Deleted;
// execute callback
comPacketQueueCallbackExecute(in_queue, comQE_PacketPushed);
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Stores one byte in the given packet at the given position
/// @param in_queue Queue description
/// @param in_packet_index Packet index which will receive the new byte
/// @parma in_byte_index Position of the byte within the packet
/// @param in_data Data byte to store
void comPacketQueueStoreByte(comPacketQueue* in_queue, uint16_t in_packet_index, uint8_t in_byte_index, uint8_t in_data)
{
comPacketInfo* packet_info = sysNULL;
sysASSERT(in_queue != sysNULL);
sysASSERT(in_packet_index < in_queue->BufferSize);
packet_info = (comPacketInfo*)&(in_queue->Buffer[in_packet_index]);
sysASSERT(packet_info->Status == comPQS_Reserved);
sysASSERT(in_byte_index < packet_info->Size);
in_queue->Buffer[sizeof(comPacketInfo) + in_packet_index + in_byte_index] = in_data;
}
/*****************************************************************************/
/* Queue POP functions */
/*****************************************************************************/
///////////////////////////////////////////////////////////////////////////////
/// @brief Starts popping the next pecket from the queue
/// @param in_queue Queue description
/// @return Buffer in of the poping packet or comINVALID_PACKET_INDEX when no packet is available
uint16_t comPacketQueuePopBegin(comPacketQueue* in_queue)
{
uint16_t pop_index;
uint16_t total_size;
comPacketInfo* packet_info = sysNULL;
bool next_packet;
sysASSERT(in_queue != sysNULL);
do
{
next_packet = false;
// if there is no packet in the buffer
if (in_queue->PopIndex == in_queue->PushIndex)
{
packet_info = sysNULL;
pop_index = comINVALID_PACKET_INDEX;
}
else
{
// check packet header
packet_info = (comPacketInfo*)&in_queue->Buffer[in_queue->PopIndex];
pop_index = in_queue->PopIndex;
// advance pop index to the next packet when no valid packet was found
switch(packet_info->Status)
{
// end of queue was found
case comPQS_EndOfQueue:
// wrap around
in_queue->PopIndex = 0;
next_packet = true;
break;
// deleted packet was found
case comPQS_Deleted:
// increment pop index
total_size = sizeof(comPacketInfo) + packet_info->Size;
if (in_queue->PopIndex + total_size < in_queue->BufferSize)
{
in_queue->PopIndex += total_size;
}
else
{
in_queue->PopIndex = 0;
}
next_packet = true;
break;
default:
next_packet = false;
break;
}
}
} while (packet_info != sysNULL && next_packet); // skip deleted packets and end of queue
return pop_index;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief End popping a packet and releases packet storage
/// @param in_queue Queue description
void comPacketQueuePopEnd(comPacketQueue* in_queue)
{
uint16_t total_size;
comPacketInfo* packet_info = sysNULL;
packet_info = (comPacketInfo*)&in_queue->Buffer[in_queue->PopIndex];
// increment pop index
total_size = sizeof(comPacketInfo) + packet_info->Size;
if (in_queue->PopIndex + total_size < in_queue->BufferSize)
{
in_queue->PopIndex += total_size;
}
else
{
in_queue->PopIndex = 0;
}
// execute callback
comPacketQueueCallbackExecute(in_queue, comQE_PacketPushed);
}
/*****************************************************************************/
/* Module local functions */
/*****************************************************************************/
///////////////////////////////////////////////////////////////////////////////
/// @brief Executes callback function of the queue
/// @param in_queue Queue description
/// @param in_event Event code of the callback
static void comPacketQueueCallbackExecute(comPacketQueue* in_queue, comQueueEvent in_event)
{
if (in_queue->Callback != sysNULL)
in_queue->Callback(in_event);
}
| 35.861736 | 152 | 0.559222 |
397bde04e0a00d4dce582301f1b31074c6b96f6e | 10,113 | h | C | drivers/staging/renesas/rcar/ddr/ddr_a/boot_init_dram_regdef.h | jollysxilinx/arm-trusted-firmware | 9c5e716364e021b08d2654afa49af4c88d49c844 | [
"BSD-3-Clause"
] | null | null | null | drivers/staging/renesas/rcar/ddr/ddr_a/boot_init_dram_regdef.h | jollysxilinx/arm-trusted-firmware | 9c5e716364e021b08d2654afa49af4c88d49c844 | [
"BSD-3-Clause"
] | null | null | null | drivers/staging/renesas/rcar/ddr/ddr_a/boot_init_dram_regdef.h | jollysxilinx/arm-trusted-firmware | 9c5e716364e021b08d2654afa49af4c88d49c844 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2015-2019, Renesas Electronics Corporation
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef BOOT_INIT_DRAM_REGDEF_H_
#define BOOT_INIT_DRAM_REGDEF_H_
/* DBSC registers */
#define DBSC_DBSYSCONF0 0xE6790000U
#define DBSC_DBSYSCONF1 0xE6790004U
#define DBSC_DBPHYCONF0 0xE6790010U
#define DBSC_DBKIND 0xE6790020U
#define DBSC_DBMEMCONF00 0xE6790030U
#define DBSC_DBMEMCONF01 0xE6790034U
#define DBSC_DBMEMCONF02 0xE6790038U
#define DBSC_DBMEMCONF03 0xE679003CU
#define DBSC_DBMEMCONF10 0xE6790040U
#define DBSC_DBMEMCONF11 0xE6790044U
#define DBSC_DBMEMCONF12 0xE6790048U
#define DBSC_DBMEMCONF13 0xE679004CU
#define DBSC_DBMEMCONF20 0xE6790050U
#define DBSC_DBMEMCONF21 0xE6790054U
#define DBSC_DBMEMCONF22 0xE6790058U
#define DBSC_DBMEMCONF23 0xE679005CU
#define DBSC_DBMEMCONF30 0xE6790060U
#define DBSC_DBMEMCONF31 0xE6790064U
#define DBSC_DBMEMCONF32 0xE6790068U
#define DBSC_DBMEMCONF33 0xE679006CU
#define DBSC_DBSYSCNT0 0xE6790100U
#define DBSC_DBSVCR1 0xE6790104U
#define DBSC_DBSTATE0 0xE6790108U
#define DBSC_DBSTATE1 0xE679010CU
#define DBSC_DBINTEN 0xE6790180U
#define DBSC_DBINTSTAT0 0xE6790184U
#define DBSC_DBACEN 0xE6790200U
#define DBSC_DBRFEN 0xE6790204U
#define DBSC_DBCMD 0xE6790208U
#define DBSC_DBWAIT 0xE6790210U
#define DBSC_DBSYSCTRL0 0xE6790280U
#define DBSC_DBTR0 0xE6790300U
#define DBSC_DBTR1 0xE6790304U
#define DBSC_DBTR2 0xE6790308U
#define DBSC_DBTR3 0xE679030CU
#define DBSC_DBTR4 0xE6790310U
#define DBSC_DBTR5 0xE6790314U
#define DBSC_DBTR6 0xE6790318U
#define DBSC_DBTR7 0xE679031CU
#define DBSC_DBTR8 0xE6790320U
#define DBSC_DBTR9 0xE6790324U
#define DBSC_DBTR10 0xE6790328U
#define DBSC_DBTR11 0xE679032CU
#define DBSC_DBTR12 0xE6790330U
#define DBSC_DBTR13 0xE6790334U
#define DBSC_DBTR14 0xE6790338U
#define DBSC_DBTR15 0xE679033CU
#define DBSC_DBTR16 0xE6790340U
#define DBSC_DBTR17 0xE6790344U
#define DBSC_DBTR18 0xE6790348U
#define DBSC_DBTR19 0xE679034CU
#define DBSC_DBTR20 0xE6790350U
#define DBSC_DBTR21 0xE6790354U
#define DBSC_DBTR22 0xE6790358U
#define DBSC_DBTR23 0xE679035CU
#define DBSC_DBTR24 0xE6790360U
#define DBSC_DBTR25 0xE6790364U
#define DBSC_DBBL 0xE6790400U
#define DBSC_DBRFCNF1 0xE6790414U
#define DBSC_DBRFCNF2 0xE6790418U
#define DBSC_DBTSPCNF 0xE6790420U
#define DBSC_DBCALCNF 0xE6790424U
#define DBSC_DBRNK2 0xE6790438U
#define DBSC_DBRNK3 0xE679043CU
#define DBSC_DBRNK4 0xE6790440U
#define DBSC_DBRNK5 0xE6790444U
#define DBSC_DBPDNCNF 0xE6790450U
#define DBSC_DBODT0 0xE6790460U
#define DBSC_DBODT1 0xE6790464U
#define DBSC_DBODT2 0xE6790468U
#define DBSC_DBODT3 0xE679046CU
#define DBSC_DBODT4 0xE6790470U
#define DBSC_DBODT5 0xE6790474U
#define DBSC_DBODT6 0xE6790478U
#define DBSC_DBODT7 0xE679047CU
#define DBSC_DBADJ0 0xE6790500U
#define DBSC_DBDBICNT 0xE6790518U
#define DBSC_DBDFIPMSTRCNF 0xE6790520U
#define DBSC_DBDFIPMSTRSTAT 0xE6790524U
#define DBSC_DBDFILPCNF 0xE6790528U
#define DBSC_DBDFICUPDCNF 0xE679052CU
#define DBSC_DBDFISTAT0 0xE6790600U
#define DBSC_DBDFICNT0 0xE6790604U
#define DBSC_DBPDCNT00 0xE6790610U
#define DBSC_DBPDCNT01 0xE6790614U
#define DBSC_DBPDCNT02 0xE6790618U
#define DBSC_DBPDCNT03 0xE679061CU
#define DBSC_DBPDLK0 0xE6790620U
#define DBSC_DBPDRGA0 0xE6790624U
#define DBSC_DBPDRGD0 0xE6790628U
#define DBSC_DBPDSTAT00 0xE6790630U
#define DBSC_DBDFISTAT1 0xE6790640U
#define DBSC_DBDFICNT1 0xE6790644U
#define DBSC_DBPDCNT10 0xE6790650U
#define DBSC_DBPDCNT11 0xE6790654U
#define DBSC_DBPDCNT12 0xE6790658U
#define DBSC_DBPDCNT13 0xE679065CU
#define DBSC_DBPDLK1 0xE6790660U
#define DBSC_DBPDRGA1 0xE6790664U
#define DBSC_DBPDRGD1 0xE6790668U
#define DBSC_DBPDSTAT10 0xE6790670U
#define DBSC_DBDFISTAT2 0xE6790680U
#define DBSC_DBDFICNT2 0xE6790684U
#define DBSC_DBPDCNT20 0xE6790690U
#define DBSC_DBPDCNT21 0xE6790694U
#define DBSC_DBPDCNT22 0xE6790698U
#define DBSC_DBPDCNT23 0xE679069CU
#define DBSC_DBPDLK2 0xE67906A0U
#define DBSC_DBPDRGA2 0xE67906A4U
#define DBSC_DBPDRGD2 0xE67906A8U
#define DBSC_DBPDSTAT20 0xE67906B0U
#define DBSC_DBDFISTAT3 0xE67906C0U
#define DBSC_DBDFICNT3 0xE67906C4U
#define DBSC_DBPDCNT30 0xE67906D0U
#define DBSC_DBPDCNT31 0xE67906D4U
#define DBSC_DBPDCNT32 0xE67906D8U
#define DBSC_DBPDCNT33 0xE67906DCU
#define DBSC_DBPDLK3 0xE67906E0U
#define DBSC_DBPDRGA3 0xE67906E4U
#define DBSC_DBPDRGD3 0xE67906E8U
#define DBSC_DBPDSTAT30 0xE67906F0U
#define DBSC_DBBUS0CNF0 0xE6790800U
#define DBSC_DBBUS0CNF1 0xE6790804U
#define DBSC_DBCAM0CNF1 0xE6790904U
#define DBSC_DBCAM0CNF2 0xE6790908U
#define DBSC_DBCAM0CNF3 0xE679090CU
#define DBSC_DBCAM0CTRL0 0xE6790940U
#define DBSC_DBCAM0STAT0 0xE6790980U
#define DBSC_DBCAM1STAT0 0xE6790990U
#define DBSC_DBBCAMSWAP 0xE67909F0U
#define DBSC_DBBCAMDIS 0xE67909FCU
#define DBSC_DBSCHCNT0 0xE6791000U
#define DBSC_DBSCHCNT1 0xE6791004U
#define DBSC_DBSCHSZ0 0xE6791010U
#define DBSC_DBSCHRW0 0xE6791020U
#define DBSC_DBSCHRW1 0xE6791024U
#define DBSC_DBSCHQOS00 0xE6791030U
#define DBSC_DBSCHQOS01 0xE6791034U
#define DBSC_DBSCHQOS02 0xE6791038U
#define DBSC_DBSCHQOS03 0xE679103CU
#define DBSC_DBSCHQOS10 0xE6791040U
#define DBSC_DBSCHQOS11 0xE6791044U
#define DBSC_DBSCHQOS12 0xE6791048U
#define DBSC_DBSCHQOS13 0xE679104CU
#define DBSC_DBSCHQOS20 0xE6791050U
#define DBSC_DBSCHQOS21 0xE6791054U
#define DBSC_DBSCHQOS22 0xE6791058U
#define DBSC_DBSCHQOS23 0xE679105CU
#define DBSC_DBSCHQOS30 0xE6791060U
#define DBSC_DBSCHQOS31 0xE6791064U
#define DBSC_DBSCHQOS32 0xE6791068U
#define DBSC_DBSCHQOS33 0xE679106CU
#define DBSC_DBSCHQOS40 0xE6791070U
#define DBSC_DBSCHQOS41 0xE6791074U
#define DBSC_DBSCHQOS42 0xE6791078U
#define DBSC_DBSCHQOS43 0xE679107CU
#define DBSC_DBSCHQOS50 0xE6791080U
#define DBSC_DBSCHQOS51 0xE6791084U
#define DBSC_DBSCHQOS52 0xE6791088U
#define DBSC_DBSCHQOS53 0xE679108CU
#define DBSC_DBSCHQOS60 0xE6791090U
#define DBSC_DBSCHQOS61 0xE6791094U
#define DBSC_DBSCHQOS62 0xE6791098U
#define DBSC_DBSCHQOS63 0xE679109CU
#define DBSC_DBSCHQOS70 0xE67910A0U
#define DBSC_DBSCHQOS71 0xE67910A4U
#define DBSC_DBSCHQOS72 0xE67910A8U
#define DBSC_DBSCHQOS73 0xE67910ACU
#define DBSC_DBSCHQOS80 0xE67910B0U
#define DBSC_DBSCHQOS81 0xE67910B4U
#define DBSC_DBSCHQOS82 0xE67910B8U
#define DBSC_DBSCHQOS83 0xE67910BCU
#define DBSC_DBSCHQOS90 0xE67910C0U
#define DBSC_DBSCHQOS91 0xE67910C4U
#define DBSC_DBSCHQOS92 0xE67910C8U
#define DBSC_DBSCHQOS93 0xE67910CCU
#define DBSC_DBSCHQOS100 0xE67910D0U
#define DBSC_DBSCHQOS101 0xE67910D4U
#define DBSC_DBSCHQOS102 0xE67910D8U
#define DBSC_DBSCHQOS103 0xE67910DCU
#define DBSC_DBSCHQOS110 0xE67910E0U
#define DBSC_DBSCHQOS111 0xE67910E4U
#define DBSC_DBSCHQOS112 0xE67910E8U
#define DBSC_DBSCHQOS113 0xE67910ECU
#define DBSC_DBSCHQOS120 0xE67910F0U
#define DBSC_DBSCHQOS121 0xE67910F4U
#define DBSC_DBSCHQOS122 0xE67910F8U
#define DBSC_DBSCHQOS123 0xE67910FCU
#define DBSC_DBSCHQOS130 0xE6791100U
#define DBSC_DBSCHQOS131 0xE6791104U
#define DBSC_DBSCHQOS132 0xE6791108U
#define DBSC_DBSCHQOS133 0xE679110CU
#define DBSC_DBSCHQOS140 0xE6791110U
#define DBSC_DBSCHQOS141 0xE6791114U
#define DBSC_DBSCHQOS142 0xE6791118U
#define DBSC_DBSCHQOS143 0xE679111CU
#define DBSC_DBSCHQOS150 0xE6791120U
#define DBSC_DBSCHQOS151 0xE6791124U
#define DBSC_DBSCHQOS152 0xE6791128U
#define DBSC_DBSCHQOS153 0xE679112CU
#define DBSC_SCFCTST0 0xE6791700U
#define DBSC_SCFCTST1 0xE6791708U
#define DBSC_SCFCTST2 0xE679170CU
#define DBSC_DBMRRDR0 0xE6791800U
#define DBSC_DBMRRDR1 0xE6791804U
#define DBSC_DBMRRDR2 0xE6791808U
#define DBSC_DBMRRDR3 0xE679180CU
#define DBSC_DBMRRDR4 0xE6791810U
#define DBSC_DBMRRDR5 0xE6791814U
#define DBSC_DBMRRDR6 0xE6791818U
#define DBSC_DBMRRDR7 0xE679181CU
#define DBSC_DBDTMP0 0xE6791820U
#define DBSC_DBDTMP1 0xE6791824U
#define DBSC_DBDTMP2 0xE6791828U
#define DBSC_DBDTMP3 0xE679182CU
#define DBSC_DBDTMP4 0xE6791830U
#define DBSC_DBDTMP5 0xE6791834U
#define DBSC_DBDTMP6 0xE6791838U
#define DBSC_DBDTMP7 0xE679183CU
#define DBSC_DBDQSOSC00 0xE6791840U
#define DBSC_DBDQSOSC01 0xE6791844U
#define DBSC_DBDQSOSC10 0xE6791848U
#define DBSC_DBDQSOSC11 0xE679184CU
#define DBSC_DBDQSOSC20 0xE6791850U
#define DBSC_DBDQSOSC21 0xE6791854U
#define DBSC_DBDQSOSC30 0xE6791858U
#define DBSC_DBDQSOSC31 0xE679185CU
#define DBSC_DBDQSOSC40 0xE6791860U
#define DBSC_DBDQSOSC41 0xE6791864U
#define DBSC_DBDQSOSC50 0xE6791868U
#define DBSC_DBDQSOSC51 0xE679186CU
#define DBSC_DBDQSOSC60 0xE6791870U
#define DBSC_DBDQSOSC61 0xE6791874U
#define DBSC_DBDQSOSC70 0xE6791878U
#define DBSC_DBDQSOSC71 0xE679187CU
#define DBSC_DBOSCTHH00 0xE6791880U
#define DBSC_DBOSCTHH01 0xE6791884U
#define DBSC_DBOSCTHH10 0xE6791888U
#define DBSC_DBOSCTHH11 0xE679188CU
#define DBSC_DBOSCTHH20 0xE6791890U
#define DBSC_DBOSCTHH21 0xE6791894U
#define DBSC_DBOSCTHH30 0xE6791898U
#define DBSC_DBOSCTHH31 0xE679189CU
#define DBSC_DBOSCTHH40 0xE67918A0U
#define DBSC_DBOSCTHH41 0xE67918A4U
#define DBSC_DBOSCTHH50 0xE67918A8U
#define DBSC_DBOSCTHH51 0xE67918ACU
#define DBSC_DBOSCTHH60 0xE67918B0U
#define DBSC_DBOSCTHH61 0xE67918B4U
#define DBSC_DBOSCTHH70 0xE67918B8U
#define DBSC_DBOSCTHH71 0xE67918BCU
#define DBSC_DBOSCTHL00 0xE67918C0U
#define DBSC_DBOSCTHL01 0xE67918C4U
#define DBSC_DBOSCTHL10 0xE67918C8U
#define DBSC_DBOSCTHL11 0xE67918CCU
#define DBSC_DBOSCTHL20 0xE67918D0U
#define DBSC_DBOSCTHL21 0xE67918D4U
#define DBSC_DBOSCTHL30 0xE67918D8U
#define DBSC_DBOSCTHL31 0xE67918DCU
#define DBSC_DBOSCTHL40 0xE67918E0U
#define DBSC_DBOSCTHL41 0xE67918E4U
#define DBSC_DBOSCTHL50 0xE67918E8U
#define DBSC_DBOSCTHL51 0xE67918ECU
#define DBSC_DBOSCTHL60 0xE67918F0U
#define DBSC_DBOSCTHL61 0xE67918F4U
#define DBSC_DBOSCTHL70 0xE67918F8U
#define DBSC_DBOSCTHL71 0xE67918FCU
#define DBSC_DBMEMSWAPCONF0 0xE6792000U
/* CPG registers */
#define CPG_SRCR4 0xE61500BCU
#define CPG_PLLECR 0xE61500D0U
#define CPG_CPGWPR 0xE6150900U
#define CPG_CPGWPCR 0xE6150904U
#define CPG_SRSTCLR4 0xE6150950U
/* MODE Monitor registers */
#define RST_MODEMR 0xE6160060U
#endif /* BOOT_INIT_DRAM_REGDEF_H_*/
| 34.633562 | 59 | 0.860872 |
823daba7ebe41863dcbb02f46f8858c4c2c4af97 | 5,520 | h | C | dialog.h | Grovety/Qt_Test_Verilog_Ethernet | cef2934d3b4b6617c813d7da50be2bb87cb1d0dd | [
"MIT"
] | null | null | null | dialog.h | Grovety/Qt_Test_Verilog_Ethernet | cef2934d3b4b6617c813d7da50be2bb87cb1d0dd | [
"MIT"
] | null | null | null | dialog.h | Grovety/Qt_Test_Verilog_Ethernet | cef2934d3b4b6617c813d7da50be2bb87cb1d0dd | [
"MIT"
] | null | null | null | #ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QSerialPort>
#include "MDIO_UART.h"
#include "pcap-int.h"
#include "Packet32.h"
#include <QThread>
#include <QDebug>
#include <QFile>
class Dialog;
class QUdpSocket;
class QHostAddress;
class receivedPacket
{
protected:
int m_len;
uint8_t* m_pData;
pcap_pkthdr m_hdr;
qint64 m_timeStamp;
public:
receivedPacket(int len)
{
m_len = len;
m_pData = new uint8_t[len];
}
~receivedPacket()
{
// qDebug()<<"Destructor!";
if (m_pData != 0)
{
delete[] m_pData;
}
}
inline uint8_t* GetData()
{
return m_pData;
}
inline int GetSize()
{
return m_len;
}
void clear()
{
delete[] m_pData;
m_pData = 0;
}
inline pcap_pkthdr* GetHdrPtr ()
{
return &m_hdr;
}
inline qint64 GetTimeStamp()
{
return m_timeStamp;
}
inline void SetTimeStamp(qint64 timeStamp)
{
m_timeStamp = timeStamp;
}
};
class CReceiverThread : public QThread
{
public:
Dialog* m_pDialog;
// QThread interface
protected:
void run();
};
class CARPThread : public QThread
{
public:
Dialog* m_pDialog;
// QThread interface
protected:
void run();
};
QT_BEGIN_NAMESPACE
namespace Ui { class Dialog; }
QT_END_NAMESPACE
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = nullptr);
~Dialog();
pcap_t* m_hCardSource;
QElapsedTimer m_timer;
uint8_t m_macSource[6];
uint8_t m_localIp [4];
struct udpData
{
uint8_t* m_pData;
uint8_t* m_pUserData;
int m_userSize;
int m_totalDataSize;
udpData ()
{
m_pData = 0;
m_userSize = 0;
m_totalDataSize = 0;
}
~udpData ()
{
if (m_pData != 0)
{
delete[] m_pData;
}
}
void SetUserSize (int userSizeInBytes)
{
if (m_totalDataSize == userSizeInBytes + 42)
{
return;
}
if (m_pData != 0)
{
delete[] m_pData;
}
// 42 bytes - header
m_totalDataSize =userSizeInBytes + 42;
m_pData = new uint8_t [m_totalDataSize];
m_pUserData = m_pData + 42;
m_userSize = userSizeInBytes;
}
uint8_t& operator[](int index)
{
return m_pData[index];
}
void SaveToFile (const char* fileName)
{
QFile file (fileName);
if (!file.open(QIODevice::WriteOnly))
{
return;
}
int len = 0;
while (len < m_totalDataSize)
{
char txt [16];
sprintf (txt,"%02X\r\n",m_pData[len]);
file.write(txt,4);
len += 1;
}
// PAD
while (len < 60)
{
file.write("00\r\n",4);
len += 1;
}
file.close();
}
inline int GetUserSize(){return m_userSize;}
};
virtual bool ReadEeprom (int addr,int size, QByteArray& data);
virtual bool WriteEeprom (int addr,int size, const char* data);
private:
Ui::Dialog *ui;
protected:
virtual uint32_t CalculateCRC(uint8_t* pData,int size);
uint8_t m_macDestination[6];
int m_pktId;
struct addrAndPort
{
uint8_t* mac;
uint32_t ip;
uint32_t port;
};
int m_nSendPktCnt;
udpData* m_dataForSend;
QUdpSocket* m_udpSocket;
QHostAddress* m_ourAddress;
unsigned short BytesTo16(unsigned char X,unsigned char Y)
{
unsigned short Tmp = X;
Tmp = Tmp << 8;
Tmp = Tmp | Y;
return Tmp;
}
unsigned int BytesTo32(unsigned char W,unsigned char X,unsigned char Y,unsigned char Z)
{
unsigned int Tmp = W;
Tmp = Tmp << 8;
Tmp = Tmp | X;
Tmp = Tmp << 8;
Tmp = Tmp | Y;
Tmp = Tmp << 8;
Tmp = Tmp | Z;
return Tmp;
}
void CreatePacket
( addrAndPort& source,
addrAndPort& destination,
udpData& packet
);
unsigned short CalculateUDPChecksum(udpData& packet);
unsigned short CalculateIPChecksum(udpData& packet/*,UINT TotalLen,UINT ID,UINT SourceIP,UINT DestIP*/);
QSerialPort m_serial;
uint8_t m_receivedData [0x200];
uint32_t m_receivedPtr;
enum
{
rcvBhReadMdioRegisterPhy0 = 0,
rcvBhReadMdioRegisterPhy1,
rcvBhNoNeedReaction
} m_rcvBehaviour;
CReceiverThread m_rcvThread;
CARPThread m_arpThread;
public:
std::list <receivedPacket*> m_receivedPackets;
private slots:
// QObject interface
void on_m_btnOpenEthCard_clicked();
void on_m_btnCloseEthCard_clicked();
void on_m_btnSendPkt_clicked();
void on_pushButton_clicked();
void on_m_btnExportBad_clicked();
void on_m_btnCrewateTestPkt_clicked();
void on_m_btnReadEeprom_2_clicked();
void on_m_btnWriteEeprom_clicked();
void on_m_btnEraseEeprom_clicked();
void on_m_btnCreateDhcpTemplete_clicked();
void on_m_btnSendDHCPOffer_clicked();
};
#endif // DIALOG_H
| 21.647059 | 108 | 0.544746 |
e8e2e4eb143ef5194ea435d01951c0e8aa94fa70 | 9,113 | h | C | Sources/Elastos/Runtime/Library/inc/car/elaobj.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Sample/RPC/Switch/RPCServer/app/src/main/cpp/elastos/inc/elaobj.h | xiaoweiruby/Elastos.RT | 238e9b747f70fc129769ae7850def4362c43e443 | [
"Apache-2.0"
] | null | null | null | Sources/Sample/RPC/Switch/RPCServer/app/src/main/cpp/elastos/inc/elaobj.h | xiaoweiruby/Elastos.RT | 238e9b747f70fc129769ae7850def4362c43e443 | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | //=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=========================================================================
#ifndef __ELAOBJ_H__
#define __ELAOBJ_H__
#include <elstring.h>
extern "C" {
typedef interface IInterface IInterface;
typedef interface IInterface SynchronizedIObject;
typedef interface IAspect IAspect;
typedef interface IInterface* PInterface;
typedef interface IAspect* PASPECT;
typedef interface IRegime* PRegime;
typedef enum AggregateType
{
AggrType_AspectAttach = 1,
AggrType_AspectDetach,
AggrType_Aggregate,
AggrType_Unaggregate,
AggrType_ObjectEnter,
AggrType_ObjectLeave,
AggrType_EnteredRegime,
AggrType_LeftRegime,
AggrType_Connect,
AggrType_Disconnect,
AggrType_AddConnection,
AggrType_FriendEnter,
AggrType_FriendLeave,
AggrType_ChildConstruct,
AggrType_ChildDestruct,
AggrType_ParentAttach,
AggrType_AspectDetached,
} AggregateType, AggrType;
EXTERN_C const _ELASTOS InterfaceID EMUID_NULL;
EXTERN_C const _ELASTOS InterfaceID EIID_IInterface;
EXTERN_C const _ELASTOS InterfaceID EIID_IObject;
EXTERN_C const _ELASTOS InterfaceID EIID_IAspect;
EXTERN_C const _ELASTOS InterfaceID EIID_IProxy;
EXTERN_C const _ELASTOS InterfaceID EIID_IProxyDeathRecipient;
EXTERN_C const _ELASTOS InterfaceID EIID_IWeakReference;
EXTERN_C const _ELASTOS InterfaceID EIID_IWeakReferenceSource;
#define BASE_INTERFACE_METHOD_COUNT 4
CAR_INTERFACE("00000000-0000-0000-C000-000000000066")
IInterface
{
virtual CARAPI_(PInterface) Probe(
/* [in] */ _ELASTOS REIID riid) = 0;
static CARAPI_(IInterface*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IInterface*)object->Probe(EIID_IInterface);
}
virtual CARAPI_(_ELASTOS UInt32) AddRef() = 0;
virtual CARAPI_(_ELASTOS UInt32) Release() = 0;
virtual CARAPI GetInterfaceID(
/* [in] */ IInterface* object,
/* [out] */ _ELASTOS InterfaceID* iid) = 0;
};
CAR_INTERFACE("00000000-0000-0000-C000-000000000068")
IObject : public IInterface
{
using IInterface::Probe;
static CARAPI_(IObject*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IObject*)object->Probe(EIID_IObject);
}
virtual CARAPI Aggregate(
/* [in] */ AggregateType type,
/* [in] */ IInterface* object) = 0;
virtual CARAPI GetDomain(
/* [out] */ IInterface** object) = 0;
virtual CARAPI GetClassID(
/* [out] */ _ELASTOS ClassID* clsid) = 0;
virtual CARAPI GetClassInfo(
/* [out] */ IInterface** clsInfo) = 0;
virtual CARAPI Equals(
/* [in] */ IInterface* object,
/* [out] */ _ELASTOS Boolean* equals) = 0;
virtual CARAPI GetHashCode(
/* [out] */ _ELASTOS Int32* hashCode) = 0;
virtual CARAPI ToString(
/* [out] */ _ELASTOS String* info) = 0;
};
struct CCarObject{};
CAR_INTERFACE("00010002-0000-0000-C000-000000000066")
IAspect : public IInterface
{
using IInterface::Probe;
static CARAPI_(IAspect*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IAspect*)object->Probe(EIID_IAspect);
}
virtual CARAPI AspectAggregate(
/* [in] */ AggregateType type,
/* [in] */ PInterface object) = 0;
virtual CARAPI AspectGetDomain(
/* [out] */ PInterface* object) = 0;
virtual CARAPI GetAspectID(
/* [out] */ _ELASTOS ClassID* clsid) = 0;
};
interface ICallbackSink;
CAR_INTERFACE("00010004-0000-0000-C000-000000000066")
ICallbackConnector : public IInterface
{
virtual CARAPI AcquireCallbackSink(
/* [in] */ ICallbackSink** callbackSink) = 0;
virtual CARAPI CheckCallbackSinkConnection(
/* [in] */ _ELASTOS Int32 event) = 0;
virtual CARAPI DisconnectCallbackSink() = 0;
};
interface IProxyDeathRecipient;
struct _CIClassInfo;
interface IInterfaceInfo;
CAR_INTERFACE("00010005-0000-0000-C000-000000000066")
IProxy : public IInterface
{
using IInterface::Probe;
static CARAPI_(IProxy*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IProxy*)object->Probe(EIID_IProxy);
}
virtual CARAPI GetInterfaceCount(
/* [out] */ _ELASTOS Int32* count) = 0;
virtual CARAPI GetAllInterfaceInfos(
/* [out] */ _ELASTOS ArrayOf<IInterfaceInfo*>* interfaceInfos) = 0;
virtual CARAPI GetInterface(
/* [in] */ _ELASTOS UInt32 index,
/* [out] */ IInterface** object) = 0;
virtual CARAPI GetInterfaceIndex(
/* [in] */ IInterface* object,
/* [out] */ _ELASTOS UInt32* index) = 0;
virtual CARAPI GetClassID(
/* [out] */ _ELASTOS EMuid* clsid) = 0;
virtual CARAPI GetClassInfo(
/* [out] */ _CIClassInfo** classInfo) = 0;
virtual CARAPI IsStubAlive(
/* [out] */ _ELASTOS Boolean* result) = 0;
virtual CARAPI LinkToDeath(
/* [in] */ IProxyDeathRecipient* recipient,
/* [in] */ _ELASTOS Int32 flags) = 0;
virtual CARAPI UnlinkToDeath(
/* [in] */ IProxyDeathRecipient* recipient,
/* [in] */ _ELASTOS Int32 flags,
/* [out] */ _ELASTOS Boolean* result) = 0;
};
CAR_INTERFACE("0001000D-0000-0000-C000-000000000066")
IProxyDeathRecipient : public IInterface
{
using IInterface::Probe;
static CARAPI_(IProxyDeathRecipient*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IProxyDeathRecipient*)object->Probe(EIID_IProxyDeathRecipient);
}
virtual CARAPI ProxyDied() = 0;
};
CAR_INTERFACE("00010008-0000-0000-C000-000000000066")
IWeakReference : public IInterface
{
using IInterface::Probe;
static CARAPI_(IWeakReference*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IWeakReference*)object->Probe(EIID_IWeakReference);
}
virtual CARAPI Resolve(
/* [in] */ _ELASTOS REIID riid,
/* [out] */ IInterface** objectReference) = 0;
};
CAR_INTERFACE("0001000A-0000-0000-C000-000000000066")
IWeakReferenceSource : public IInterface
{
using IInterface::Probe;
static CARAPI_(IWeakReferenceSource*) Probe(
/* [in] */ PInterface object)
{
if (object == NULL) return NULL;
return (IWeakReferenceSource*)object->Probe(EIID_IWeakReferenceSource);
}
virtual CARAPI GetWeakReference(
/* [out] */ IWeakReference** weakReference) = 0;
};
} // extern "C"
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
//
template <class T, class U>
struct ConversionHelper
{
typedef char Small;
struct Big { char dummy[2]; };
static Big Test(...);
static Small Test(U);
static T & MakeT();
};
// class template Conversion
// Figures out the conversion relationships between two types
// Invocations (T and U are types):
// exists: returns (at compile time) true if there is an implicit conversion
// from T to U (example: Derived to Base)
// Caveat: might not work if T and U are in a private inheritance hierarchy.
//
template <class T, class U>
struct Conversion
{
typedef ConversionHelper<T, U> H;
enum {
exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT())))
};
enum { exists2Way = exists && Conversion<U, T>::exists };
enum { sameType = FALSE };
};
template <class T>
class Conversion<T, T>
{
public:
enum { exists = TRUE, exists2Way = TRUE, sameType = TRUE };
};
template <>
struct Conversion<void, CCarObject>
{
enum { exists = FALSE, exists2Way = FALSE, sameType = FALSE };
};
#ifndef SUPERSUBCLASS
#define SUPERSUBCLASS(SuperT, SubT) \
(Conversion<SubT*, SuperT*>::exists && !Conversion<SuperT*, void*>::sameType)
#endif
#ifndef SUPERSUBCLASS_EX
#define SUPERSUBCLASS_EX(Super, Sub) \
(Conversion<Sub, Super>::exists && !Conversion<Super, void*>::sameType)
#endif
#ifndef DEFINE_CONVERSION_FOR
#define DEFINE_CONVERSION_FOR(DerivedT, BaseT) \
template <> \
struct Conversion<DerivedT*, BaseT*> \
{ \
enum { exists = TRUE, exists2Way = FALSE, sameType = FALSE }; \
};
#endif
#endif // __ELAOBJ_H__
| 28.213622 | 81 | 0.645013 |
7f01481c40b7fbf02e91e3723a3d3e3736b53e34 | 139 | h | C | Infantry_SystemIdentification/SuperPower/Mylib/iwdg.h | gjhhust/Infantary | 16f4ed0ddcc815d7ef85bba9e3e0a481dd1c57df | [
"MIT"
] | null | null | null | Infantry_SystemIdentification/SuperPower/Mylib/iwdg.h | gjhhust/Infantary | 16f4ed0ddcc815d7ef85bba9e3e0a481dd1c57df | [
"MIT"
] | null | null | null | Infantry_SystemIdentification/SuperPower/Mylib/iwdg.h | gjhhust/Infantary | 16f4ed0ddcc815d7ef85bba9e3e0a481dd1c57df | [
"MIT"
] | null | null | null | #ifndef __IWDG_H
#define __IWDG_H
#include "stm32f10x_iwdg.h"
void IWDG_Config(uint8_t prv ,uint16_t rlv);
void IWDG_Feed(void);
#endif
| 13.9 | 44 | 0.776978 |
b2571c8bf09b50662dff8530b3928a2f2758102a | 658 | h | C | lib/GxEPD/src/imglib/gridicons_create.h | JaccoVeldscholten/e-inkOctoDisplay | c8cbff104abe4a9ac06e825d3a1c5a75c48f861f | [
"MIT"
] | 134 | 2019-04-08T01:40:58.000Z | 2022-03-18T09:27:53.000Z | lib/GxEPD/src/imglib/gridicons_create.h | JaccoVeldscholten/e-inkOctoDisplay | c8cbff104abe4a9ac06e825d3a1c5a75c48f861f | [
"MIT"
] | 13 | 2019-07-01T05:31:47.000Z | 2021-03-19T00:49:59.000Z | lib/GxEPD/src/imglib/gridicons_create.h | JaccoVeldscholten/e-inkOctoDisplay | c8cbff104abe4a9ac06e825d3a1c5a75c48f861f | [
"MIT"
] | 42 | 2019-05-06T20:21:51.000Z | 2021-12-16T22:46:24.000Z | #if defined(ESP8266) || defined(ESP32)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
// 24 x 24 gridicons_create
const unsigned char gridicons_create[] PROGMEM = { /* 0X01,0X01,0XB4,0X00,0X40,0X00, */
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xE0, 0x0F, 0xF0, 0xF0, 0x07, 0xF0,
0xFF, 0xE7, 0xF0, 0xFF, 0xE7, 0xF1, 0x1F, 0xE7,
0xFF, 0x1F, 0xE7, 0xFE, 0x07, 0xE7, 0xFE, 0x07,
0xE7, 0xEF, 0x01, 0xE7, 0xEF, 0x81, 0xE7, 0xE7,
0xC0, 0x67, 0xE7, 0xE0, 0x67, 0xE7, 0xF0, 0x67,
0xE7, 0xF8, 0x67, 0xE7, 0xFF, 0xE7, 0xE7, 0xFF,
0xE7, 0xE0, 0x00, 0x07, 0xF0, 0x00, 0x0F, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
| 36.555556 | 87 | 0.676292 |
95dae0b82aaa432e30552aacfc21cedf3372d535 | 258 | h | C | TDSGlobalSDK/TDSSDK/TDSGlobalSDKCoreKit.framework/Headers/TDSGlobalLog.h | horizon554/FrameworkTest | 2ab76e5e740025b1fe389e6e85e23daf625a9fb7 | [
"MIT"
] | null | null | null | TDSGlobalSDK/TDSSDK/TDSGlobalSDKCoreKit.framework/Headers/TDSGlobalLog.h | horizon554/FrameworkTest | 2ab76e5e740025b1fe389e6e85e23daf625a9fb7 | [
"MIT"
] | null | null | null | TDSGlobalSDK/TDSSDK/TDSGlobalSDKCoreKit.framework/Headers/TDSGlobalLog.h | horizon554/FrameworkTest | 2ab76e5e740025b1fe389e6e85e23daf625a9fb7 | [
"MIT"
] | null | null | null | //
// TDSGlobalLog.h
// TDSGlobalSDKCoreKit
//
// Created by JiangJiahao on 2020/10/27.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TDSGlobalLog : NSObject
+ (void)TDSGlobalLog:(NSString *)log;
@end
NS_ASSUME_NONNULL_END
| 13.578947 | 41 | 0.744186 |
c9438b78a52c4f43526b4880ab033aa71daee9b9 | 1,044 | h | C | KNPhotoBrowser/KNPhotoBrowser/KNPhotoAVPlayer/KNPhotoAVPlayerActionBar.h | wblzu/KNPhotoBrowser | 6504ba280ec43b668e34d854222daf3203f91c60 | [
"MIT"
] | null | null | null | KNPhotoBrowser/KNPhotoBrowser/KNPhotoAVPlayer/KNPhotoAVPlayerActionBar.h | wblzu/KNPhotoBrowser | 6504ba280ec43b668e34d854222daf3203f91c60 | [
"MIT"
] | null | null | null | KNPhotoBrowser/KNPhotoBrowser/KNPhotoAVPlayer/KNPhotoAVPlayerActionBar.h | wblzu/KNPhotoBrowser | 6504ba280ec43b668e34d854222daf3203f91c60 | [
"MIT"
] | 1 | 2020-09-07T02:36:50.000Z | 2020-09-07T02:36:50.000Z | //
// KNPhotoAVPlayerActionBar.h
// KNPhotoBrowser
//
// Created by LuKane on 2019/6/14.
// Copyright © 2019 LuKane. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol KNPhotoAVPlayerActionBarDelegate <NSObject>
@optional
/**
actionBar pause or stop btn did click
@param isNeedPlay isNeedPlay
*/
- (void)photoAVPlayerActionBarClickWithIsPlay:(BOOL)isNeedPlay;
@optional
/**
actionBar value has changed by slider
@param value value
*/
- (void)photoAVPlayerActionBarChangeValue:(float)value;
@end
@interface KNPhotoAVPlayerActionBar : UIView
/**
current play time of the video
*/
@property (nonatomic,assign) float currentTime;
/**
duration of the video
*/
@property (nonatomic,assign) float allDuration;
@property (nonatomic,weak ) id<KNPhotoAVPlayerActionBarDelegate> delegate;
/**
setter or getter of isPlaying of ActionBar
*/
@property (nonatomic,assign) BOOL isPlaying;
/**
reset all information of ActionBar
*/
- (void)resetActionBarAllInfo;
@end
NS_ASSUME_NONNULL_END
| 17.4 | 75 | 0.751916 |
f9630c14d56408f7de527a6967ea3eb92ec29345 | 3,662 | h | C | src/Menge/MengeCore/PluginEngine/Plugin.h | zhuzhao-tech/Menge | cdb1060c4780262b8936956c24eca8457ffb3298 | [
"Apache-2.0"
] | null | null | null | src/Menge/MengeCore/PluginEngine/Plugin.h | zhuzhao-tech/Menge | cdb1060c4780262b8936956c24eca8457ffb3298 | [
"Apache-2.0"
] | null | null | null | src/Menge/MengeCore/PluginEngine/Plugin.h | zhuzhao-tech/Menge | cdb1060c4780262b8936956c24eca8457ffb3298 | [
"Apache-2.0"
] | null | null | null | /*
Menge Crowd Simulation Framework
Copyright and trademark 2012-17 University of North Carolina at Chapel Hill
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
or
LICENSE.txt in the root of the Menge repository.
Any questions or comments should be sent to the authors menge@cs.unc.edu
<http://gamma.cs.unc.edu/Menge/>
*/
/*!
@file Plugin.h
@brief The basic specification of a plug in
*/
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#include "MengeCore/CoreConfig.h"
#include "MengeCore/MengeException.h"
#include "MengeCore/PluginEngine/SharedLibrary.h"
#include "MengeCore/Runtime/Logger.h"
#include <string>
namespace Menge {
namespace PluginEngine {
/*!
@brief The base plug-in class
*/
template <typename EngineType>
class Plugin {
public:
/*!
@brief Plugin function pointer for functions which return strings.
*/
typedef const char* GetCharPtrFcn();
/*!
@brief Declaration of registration function pointer type
*/
typedef void RegisterPluginFcn(EngineType*);
/*!
@brief Constructor.
@param filename The filename of the plugin to instantiate.
@throws std::exception if there is a problem initializing the plugin.
*/
Plugin(const std::string& filename)
: _handle(0), _registerFcnAddr(0x0), _getNameFcnAddr(0x0), _getDescFcnAddr(0x0) {
// This might throw a std::runtime_error which will immediately propagate upwards
try {
// 加载共享库
_handle = SharedLibrary::Load(filename);
} catch (std::exception& e) {
logger << Logger::ERR_MSG << e.what();
throw;
}
try {
_registerFcnAddr = SharedLibrary::GetFunctionPointer<RegisterPluginFcn>(_handle, getRegisterName());
_getNameFcnAddr = SharedLibrary::GetFunctionPointer<GetCharPtrFcn>(_handle, "getName");
_getDescFcnAddr = SharedLibrary::GetFunctionPointer<GetCharPtrFcn>(_handle, "getDescription");
} catch (std::exception& e) {
logger << Logger::ERR_MSG << e.what();
SharedLibrary::Unload(_handle);
throw;
}
}
/*!
@brief Destructor.
*/
~Plugin() {
if (_handle != 0) SharedLibrary::Unload(_handle);
}
/*!
@brief Reports the name of the registraiton function for this plugin type.
*/
const char* getRegisterName() const {
throw MengeFatalException("Failed to define plugin register function name.");
}
/*!
@brief Registers the plugin to the PluginEngine.
@param engine The PluginEngine.
*/
void registerPlugin(EngineType* engine) { _registerFcnAddr(engine); }
/*!
@brief Returns the name of the plugin.
@returns The name of the plug-in.
*/
const char* getName() { return _getNameFcnAddr(); }
/*!
@brief Returns the description of the plugin.
@returns The description of the plug-in.
*/
const char* getDescription() { return _getDescFcnAddr(); }
private:
/*!
@brief The shared library handle.
*/
SharedLibrary::HandleType _handle;
/*!
@brief A function pointer to the plugin registration function.
This should get initialized in the constructor.
*/
RegisterPluginFcn* _registerFcnAddr;
/*!
@brief A function pointer to the function which returns the plugin name.
*/
GetCharPtrFcn* _getNameFcnAddr;
/*!
@brief A function pointer to the function which returns the plugin
description.
*/
GetCharPtrFcn* _getDescFcnAddr;
};
} // namespace PluginEngine
} // namespace Menge
#endif // __PLUGIN_H__
| 25.430556 | 106 | 0.687329 |
c7e25777d859b8f27afc4c2027396cdf0b3376ed | 4,077 | c | C | Core/Memory/Memory.c | AlfonsoJLuna/nesswemu | b436d2db607cdad40e4ec1b80c78d16c5a6d7be8 | [
"BSD-3-Clause"
] | 3 | 2016-07-23T15:01:36.000Z | 2019-05-19T11:34:31.000Z | Core/Memory/Memory.c | AlfonsoJLuna/nesswemu | b436d2db607cdad40e4ec1b80c78d16c5a6d7be8 | [
"BSD-3-Clause"
] | null | null | null | Core/Memory/Memory.c | AlfonsoJLuna/nesswemu | b436d2db607cdad40e4ec1b80c78d16c5a6d7be8 | [
"BSD-3-Clause"
] | null | null | null | #include "Memory.h"
#include "Audio.h"
#include "Cartridge.h"
#include "Controller.h"
#include "Graphics.h"
static uint8_t WRAM[0x800];
static uint8_t VRAM[0x800];
static inline uint8_t Mirrored_Read(uint16_t Address)
{
if (Cartridge_Get_Mirroring() == Horizontal)
{
if (Address <= 0x27FF)
{
return VRAM[Address % 0x400];
}
else
{
return VRAM[0x400 + (Address % 0x400)];
}
}
else
{
if (Address <= 0x23FF)
{
return VRAM[Address % 0x400];
}
else if (Address <= 0x27FF)
{
return VRAM[0x400 + (Address % 0x400)];
}
else if (Address <= 0x2BFF)
{
return VRAM[Address % 0x400];
}
else
{
return VRAM[0x400 + (Address % 0x400)];
}
}
}
static inline void Mirrored_Write(uint16_t Address, uint8_t Data)
{
if (Cartridge_Get_Mirroring() == Horizontal)
{
if (Address <= 0x27FF)
{
VRAM[Address % 0x400] = Data;
}
else
{
VRAM[0x400 + (Address % 0x400)] = Data;
}
}
else
{
if (Address <= 0x23FF)
{
VRAM[Address % 0x400] = Data;
}
else if (Address <= 0x27FF)
{
VRAM[0x400 + (Address % 0x400)] = Data;
}
else if (Address <= 0x2BFF)
{
VRAM[Address % 0x400] = Data;
}
else
{
VRAM[0x400 + (Address % 0x400)] = Data;
}
}
}
uint8_t Memory_CPU_Read(uint16_t Address)
{
if (Address <= 0x1FFF)
{
return WRAM[Address % 0x800];
}
else if (Address <= 0x3FFF)
{
return Graphics_PPU_Register_Read(0x2000 + (Address % 0x8));
}
else if (Address <= 0x4013)
{
return Audio_APU_Register_Read(Address);
}
else if (Address == 0x4014)
{
return Graphics_PPU_Register_Read(Address);
}
else if (Address == 0x4015)
{
return Audio_APU_Register_Read(Address);
}
else if (Address == 0x4016)
{
return Controller_1_Read();
}
else if (Address == 0x4017)
{
return Controller_2_Read();
}
else if (Address >= 0x6000)
{
return Cartridge_PRG_Read(Address);
}
else
{
return 0;
}
}
void Memory_CPU_Write(uint16_t Address, uint8_t Data)
{
if (Address <= 0x1FFF)
{
WRAM[Address % 0x800] = Data;
}
else if (Address <= 0x3FFF)
{
Graphics_PPU_Register_Write(0x2000 + (Address % 0x8), Data);
}
else if (Address <= 0x4013)
{
Audio_APU_Register_Write(Address, Data);
}
else if (Address == 0x4014)
{
Graphics_PPU_Register_Write(Address, Data);
}
else if (Address == 0x4015)
{
Audio_APU_Register_Write(Address, Data);
}
else if (Address == 0x4016)
{
Controller_Write(Data);
}
else if (Address == 0x4017)
{
Audio_APU_Register_Write(Address, Data);
}
else if (Address >= 0x6000)
{
Cartridge_PRG_Write(Address, Data);
}
}
uint8_t Memory_PPU_Read(uint16_t Address)
{
Address %= 0x4000;
if (Address <= 0x1FFF)
{
return Cartridge_CHR_Read(Address);
}
else if (Address <= 0x3EFF)
{
return Mirrored_Read(0x2000 + (Address % 0x1000));
}
else
{
return Graphics_PPU_Palette_Read(0x3F00 + (Address % 0x20));
}
}
void Memory_PPU_Write(uint16_t Address, uint8_t Data)
{
Address %= 0x4000;
if (Address <= 0x1FFF)
{
Cartridge_CHR_Write(Address, Data);
}
else if (Address <= 0x3EFF)
{
Mirrored_Write(0x2000 + (Address % 0x1000), Data);
}
else
{
Graphics_PPU_Palette_Write(0x3F00 + (Address % 0x20), Data);
}
}
| 21.234375 | 69 | 0.505519 |
2410d936625fdc0e5c6fe08d75cd4bb647d76867 | 1,976 | c | C | libnet/tests/fixaddr.c | pwmarcz/netacka | af119bea92b4504a6184840f568e23d3e6058012 | [
"MIT"
] | 8 | 2017-02-23T11:42:17.000Z | 2021-11-13T19:52:49.000Z | libnet/tests/fixaddr.c | Aliced3645/DataCenterMarketing | 67bc485e73cf538498a89b28465afb822717affb | [
"Apache-2.0"
] | null | null | null | libnet/tests/fixaddr.c | Aliced3645/DataCenterMarketing | 67bc485e73cf538498a89b28465afb822717affb | [
"Apache-2.0"
] | 1 | 2018-05-19T01:46:16.000Z | 2018-05-19T01:46:16.000Z | /* Test program for `fixupaddress' functions, mostly by Peter Wang */
#include <stdio.h>
#include <string.h>
#include <libnet.h>
#define DRIVER NET_DRIVER_SOCKETS
#define ADDRESS "127.0.0.1"
int main (int argc, char **argv)
{
NET_CONN *listen, *conn = NULL;
NET_CHANNEL *chan;
char remote[NET_MAX_ADDRESS_LENGTH], buf[NET_MAX_ADDRESS_LENGTH];
char *p, c;
int server = -1;
if (argc > 1) {
if (!strcmp (argv[1], "server")) server = 1;
else if (!strcmp (argv[1], "client")) server = 0;
}
if (server == -1) {
puts ("Pass `server' or `client' on the command line.");
return 1;
}
net_init();
net_detectdrivers(net_drivers_all);
net_initdrivers(net_drivers_all);
if (server) {
listen = net_openconn(DRIVER, "");
net_listen(listen);
while (!conn)
conn = net_poll_listen(listen);
} else {
conn = net_openconn(DRIVER, NULL);
if (net_connect_wait_time(conn, ADDRESS, 5) != 0) {
printf("Error connecting\n");
return 1;
}
}
chan = net_openchannel(DRIVER, NULL);
p = net_getlocaladdress(chan);
net_send_rdm(conn, p, strlen(p) + 1);
while (!net_query_rdm(conn)) ;
net_receive_rdm(conn, remote, sizeof remote);
printf ("Address before fixing: %s\n", remote);
if (net_fixupaddress_conn(conn, remote, buf) != 0) {
printf("Didn't work\n");
return 1;
}
printf ("Address after fixing: %s\n", buf);
printf("assigning target: %s\n", buf);
net_assigntarget(chan, buf);
do {
c = fgetc(stdin);
if (c == '1')
net_send(chan, "** Channel", 11);
else if (c == '2')
net_send_rdm(conn, "** Conn", 8);
while (net_query(chan)) {
net_receive(chan, buf, sizeof buf, NULL);
printf("%s\n", buf);
}
while (net_query_rdm(conn)) {
net_receive_rdm(conn, buf, sizeof buf);
printf("%s\n", buf);
}
} while (c != 'q');
return 0;
}
| 23.247059 | 69 | 0.58249 |
242358b58392ca10cda71cd5633894b7c621c239 | 2,738 | h | C | mp/src/old/game_shared/ammodef.h | MaartenS11/Team-Fortress-Invasion | f36b96d27f834d94e0db2d2a9470b05b42e9b460 | [
"Unlicense"
] | 1 | 2021-03-20T14:27:45.000Z | 2021-03-20T14:27:45.000Z | mp/src/old/game_shared/ammodef.h | MaartenS11/Team-Fortress-Invasion | f36b96d27f834d94e0db2d2a9470b05b42e9b460 | [
"Unlicense"
] | null | null | null | mp/src/old/game_shared/ammodef.h | MaartenS11/Team-Fortress-Invasion | f36b96d27f834d94e0db2d2a9470b05b42e9b460 | [
"Unlicense"
] | null | null | null | //=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: Holds defintion for game ammo types
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#ifndef AI_AMMODEF_H
#define AI_AMMODEF_H
#pragma once
class ConVar;
struct Ammo_t
{
char *pName;
int nDamageType;
int eTracerType;
float physicsForceImpulse;
// Values for player/NPC damage and carrying capability
// If the integers are set, they override the CVars
int pPlrDmg; // CVar for player damage amount
int pNPCDmg; // CVar for NPC damage amount
int pMaxCarry; // CVar for maximum number can carry
const ConVar* pPlrDmgCVar; // CVar for player damage amount
const ConVar* pNPCDmgCVar; // CVar for NPC damage amount
const ConVar* pMaxCarryCVar; // CVar for maximum number can carry
};
// Used to tell AmmoDef to use the cvars, not the integers
#define USE_CVAR -1
// Ammo is infinite
#define INFINITE_AMMO -2
enum AmmoTracer_E
{
TRACER_NONE,
TRACER_LINE,
TRACER_RAIL,
TRACER_BEAM,
};
#include "shareddefs.h"
//=============================================================================
// >> CAmmoDef
//=============================================================================
class CAmmoDef
{
public:
int m_nAmmoIndex;
Ammo_t m_AmmoType[MAX_AMMO_TYPES];
Ammo_t *GetAmmoOfIndex(int nAmmoIndex);
int Index(const char *psz);
int PlrDamage(int nAmmoIndex);
int NPCDamage(int nAmmoIndex);
int MaxCarry(int nAmmoIndex);
int DamageType(int nAmmoIndex);
int TracerType(int nAmmoIndex);
float DamageForce(int nAmmoIndex);
void AddAmmoType(char const* name, int damageType, int tracerType, int plr_dmg, int npc_dmg, int carry, float physicsForceImpulse);
void AddAmmoType(char const* name, int damageType, int tracerType, char const* plr_cvar, char const* npc_var, char const* carry_cvar, float physicsForceImpulse);
CAmmoDef(void);
~CAmmoDef( void );
private:
bool AddAmmoType(char const* name, int damageType, int tracerType);
};
// Get the global ammodef object. This is usually implemented in each mod's game rules file somewhere,
// so the mod can setup custom ammo types.
CAmmoDef* GetAmmoDef();
#endif // AI_AMMODEF_H
| 29.12766 | 165 | 0.62637 |
0fc08e8611a90d5e055a61efb5e4c7f9c6cfc179 | 383 | h | C | Demo/Demo/Airport.h | dimazen/map_index | 8c9150ebaef55b00a397084bd71a1a13623f659b | [
"MIT"
] | 5 | 2015-02-21T16:00:24.000Z | 2021-09-01T10:49:11.000Z | Demo/Demo/Airport.h | dimazen/map_index | 8c9150ebaef55b00a397084bd71a1a13623f659b | [
"MIT"
] | null | null | null | Demo/Demo/Airport.h | dimazen/map_index | 8c9150ebaef55b00a397084bd71a1a13623f659b | [
"MIT"
] | null | null | null | //
// Airport.h
// Airports
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface Airport : NSObject<MKAnnotation> {
CLLocationCoordinate2D coordinate;
UIImage* icon;
}
@property(nonatomic,copy) NSString *city, *code;
@property(nonatomic) CLLocationCoordinate2D coordinate;
@property(nonatomic,readonly) UIImage *icon;
+(NSArray*)allAirports;
@end
| 18.238095 | 55 | 0.741514 |
689afbb14dc25dc2c80f747dd77568578b3deff6 | 201 | h | C | Example/LCCategoryKit/LCViewController.h | lcgagaCoding/LCCategoryKit | e13cd9fc7255b5ebb4e5cb3ff5482d830de0829c | [
"MIT"
] | null | null | null | Example/LCCategoryKit/LCViewController.h | lcgagaCoding/LCCategoryKit | e13cd9fc7255b5ebb4e5cb3ff5482d830de0829c | [
"MIT"
] | null | null | null | Example/LCCategoryKit/LCViewController.h | lcgagaCoding/LCCategoryKit | e13cd9fc7255b5ebb4e5cb3ff5482d830de0829c | [
"MIT"
] | null | null | null | //
// LCViewController.h
// LCCategoryKit
//
// Created by 刘成 on 03/26/2019.
// Copyright (c) 2019 刘成. All rights reserved.
//
@import UIKit;
@interface LCViewController : UIViewController
@end
| 14.357143 | 47 | 0.691542 |
806aa871372c83e0f88ab88306a73ffd583834aa | 349 | h | C | Mantle/Source/MTL.h | AiManti1/Graphics | 050816bf16202b09440412314338373a4d0d6c04 | [
"Apache-2.0"
] | null | null | null | Mantle/Source/MTL.h | AiManti1/Graphics | 050816bf16202b09440412314338373a4d0d6c04 | [
"Apache-2.0"
] | null | null | null | Mantle/Source/MTL.h | AiManti1/Graphics | 050816bf16202b09440412314338373a4d0d6c04 | [
"Apache-2.0"
] | null | null | null | #pragma once
// This headers are used by Mantle's Client application.
#include "Main.h"
#include "MEngine.h"
#include "Log.h"
#include "Layers/Layer.h"
#include "Layers/ImGuiLayer.h"
/*Input section*/
#include "Window/Input.h"
#include "Window/KeyCodes.h"
#include "Window/MouseButtonCodes.h"
/*Graphics section*/
//#include "OpenGL/Sprite.h"
| 17.45 | 56 | 0.724928 |
84b2ac1817c734623706e4e395fd2a8cbb30e947 | 1,143 | c | C | tests/apple2/reflect.c | ac-pevans/erc | 21623257efb6a50662da9044c1ab588f412be8fc | [
"MIT"
] | null | null | null | tests/apple2/reflect.c | ac-pevans/erc | 21623257efb6a50662da9044c1ab588f412be8fc | [
"MIT"
] | null | null | null | tests/apple2/reflect.c | ac-pevans/erc | 21623257efb6a50662da9044c1ab588f412be8fc | [
"MIT"
] | null | null | null | #include <criterion/criterion.h>
#include "apple2/apple2.h"
#include "apple2/event.h"
#include "vm_di.h"
static apple2 *mach;
static void
setup()
{
mach = apple2_create(100, 100);
mach->paused = false;
mach->debug = false;
vm_di_set(VM_PAUSE_FUNC, NULL);
vm_di_set(VM_DEBUG_FUNC, NULL);
apple2_event_init();
}
static void
teardown()
{
apple2_free(mach);
vm_di_set(VM_PAUSE_FUNC, NULL);
vm_di_set(VM_DEBUG_FUNC, NULL);
}
TestSuite(apple2_event, .init = setup, .fini = teardown);
Test(apple2_event, init)
{
cr_assert_neq(vm_di_get(VM_PAUSE_FUNC), NULL);
cr_assert_neq(vm_di_get(VM_DEBUG_FUNC), NULL);
}
/* Test(apple2_reflect, cpu_info) */
/* Test(apple2_reflect, machine_info) */
Test(apple2_event, pause)
{
apple2_event_pause(mach);
cr_assert_eq(mach->paused, true);
apple2_event_pause(mach);
cr_assert_eq(mach->paused, false);
}
Test(apple2_event, debug)
{
apple2_event_debug(mach);
cr_assert_eq(mach->paused, true);
cr_assert_eq(mach->debug, true);
apple2_event_debug(mach);
cr_assert_eq(mach->paused, true);
cr_assert_eq(mach->debug, true);
}
| 19.05 | 57 | 0.696413 |
84c4f2642cdf2ef05307675b4a8cd59ce3112b84 | 6,707 | c | C | thirdparty/glut/progs/mesademos/texobj.c | ShiroixD/pag_zad_2 | cdb6ccf48402cf4dbf1284827a4e281d3b12a64b | [
"MIT"
] | 1 | 2019-01-11T13:55:53.000Z | 2019-01-11T13:55:53.000Z | thirdparty/glut/progs/mesademos/texobj.c | ShiroixD/pag_zad_2 | cdb6ccf48402cf4dbf1284827a4e281d3b12a64b | [
"MIT"
] | 1 | 2018-08-10T19:11:58.000Z | 2018-08-10T19:12:17.000Z | thirdparty/glut/progs/mesademos/texobj.c | ShiroixD/pag_zad_2 | cdb6ccf48402cf4dbf1284827a4e281d3b12a64b | [
"MIT"
] | null | null | null | /* texobj.c */
/*
* Example of using the 1.1 texture object functions.
* Also, this demo utilizes Mesa's fast texture map path.
*
* Brian Paul June 1996
*/
/* Conversion to GLUT by Mark J. Kilgard */
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <GL/glut.h>
static GLuint TexObj[2];
static GLfloat Angle = 0.0f;
static GLboolean HaveTexObj = GL_FALSE;
#if defined(GL_VERSION_1_1)
#define TEXTURE_OBJECT 1
#elif defined(GL_EXT_texture_object)
#define TEXTURE_OBJECT 1
#define glBindTexture(A,B) glBindTextureEXT(A,B)
#define glGenTextures(A,B) glGenTexturesEXT(A,B)
#define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B)
#endif
#ifdef TEXTURE_OBJECT
static int
supportsOneDotOne(void)
{
const char *version;
int major, minor;
version = (char *) glGetString(GL_VERSION);
if (sscanf(version, "%d.%d", &major, &minor) == 2)
return major >= 1 && minor >= 1;
return 0; /* OpenGL version string malformed! */
}
#endif
static void
draw(void)
{
/* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); */
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
/* draw first polygon */
glPushMatrix();
glTranslatef(-1.0, 0.0, 0.0);
glRotatef(Angle, 0.0, 0.0, 1.0);
if (HaveTexObj) {
#ifdef TEXTURE_OBJECT
glBindTexture(GL_TEXTURE_2D, TexObj[0]);
#endif
} else {
glCallList(TexObj[0]);
}
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0);
glVertex2f(-1.0, -1.0);
glTexCoord2f(1.0, 0.0);
glVertex2f(1.0, -1.0);
glTexCoord2f(1.0, 1.0);
glVertex2f(1.0, 1.0);
glTexCoord2f(0.0, 1.0);
glVertex2f(-1.0, 1.0);
glEnd();
glPopMatrix();
/* draw second polygon */
glPushMatrix();
glTranslatef(1.0, 0.0, 0.0);
glRotatef(Angle - 90.0, 0.0, 1.0, 0.0);
if (HaveTexObj) {
#ifdef TEXTURE_OBJECT
glBindTexture(GL_TEXTURE_2D, TexObj[1]);
#endif
} else {
glCallList(TexObj[0]);
}
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0);
glVertex2f(-1.0, -1.0);
glTexCoord2f(1.0, 0.0);
glVertex2f(1.0, -1.0);
glTexCoord2f(1.0, 1.0);
glVertex2f(1.0, 1.0);
glTexCoord2f(0.0, 1.0);
glVertex2f(-1.0, 1.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void
idle(void)
{
Angle += 2.0;
glutPostRedisplay();
}
/* exit upon ESC */
/* ARGSUSED1 */
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
#ifdef TEXTURE_OBJECT
glDeleteTextures(2, TexObj);
#endif
exit(0);
}
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 ); */
glFrustum(-2.0, 2.0, -2.0, 2.0, 6.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -8.0);
}
static void
init(void)
{
static int width = 8, height = 8;
static GLubyte tex1[] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
static GLubyte tex2[] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 2, 2, 0, 0, 0,
0, 0, 2, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 0,
0, 0, 2, 2, 2, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
GLubyte tex[64][3];
GLint i, j;
glDisable(GL_DITHER);
/* Setup texturing */
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
/* generate texture object IDs */
if (HaveTexObj) {
#ifdef TEXTURE_OBJECT
glGenTextures(2, TexObj);
#endif
} else {
TexObj[0] = glGenLists(2);
TexObj[1] = TexObj[0] + 1;
}
/* setup first texture object */
if (HaveTexObj) {
#ifdef TEXTURE_OBJECT
glBindTexture(GL_TEXTURE_2D, TexObj[0]);
#endif
} else {
glNewList(TexObj[0], GL_COMPILE);
}
/* red on white */
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int p = i * width + j;
if (tex1[(height - i - 1) * width + j]) {
tex[p][0] = 255;
tex[p][1] = 0;
tex[p][2] = 0;
} else {
tex[p][0] = 255;
tex[p][1] = 255;
tex[p][2] = 255;
}
}
}
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
if (!HaveTexObj) {
glEndList();
}
/* end of texture object */
/* setup second texture object */
if (HaveTexObj) {
#ifdef TEXTURE_OBJECT
glBindTexture(GL_TEXTURE_2D, TexObj[1]);
#endif
} else {
glNewList(TexObj[1], GL_COMPILE);
}
/* green on blue */
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int p = i * width + j;
if (tex2[(height - i - 1) * width + j]) {
tex[p][0] = 0;
tex[p][1] = 255;
tex[p][2] = 0;
} else {
tex[p][0] = 0;
tex[p][1] = 0;
tex[p][2] = 255;
}
}
}
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
if (!HaveTexObj) {
glEndList();
}
/* end texture object */
}
void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow("Texture Objects");
/* Check that renderer has the GL_EXT_texture_object
extension or supports OpenGL 1.1. */
#ifdef TEXTURE_OBJECT
if (supportsOneDotOne() || glutExtensionSupported("GL_EXT_texture_object")) {
HaveTexObj = GL_TRUE;
}
#endif
if (!HaveTexObj) {
printf("\nThis program doesn't really work the way it is supposed\n");
printf("to if you lack OpenGL 1.1 or the EXT_texture_object extension.\n");
printf("Each textured object should have a different numbered image.\n\n");
}
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutVisibilityFunc(visible);
glutDisplayFunc(draw);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
| 22.890785 | 79 | 0.61488 |
70edda64e33ec6e38388a05d21381170e12bde10 | 126 | h | C | Source/Engine/Old/Public/IEngine.h | cyj0912/Construct3 | 7a24c59e830e26762e02af98419392b881198933 | [
"WTFPL"
] | null | null | null | Source/Engine/Old/Public/IEngine.h | cyj0912/Construct3 | 7a24c59e830e26762e02af98419392b881198933 | [
"WTFPL"
] | null | null | null | Source/Engine/Old/Public/IEngine.h | cyj0912/Construct3 | 7a24c59e830e26762e02af98419392b881198933 | [
"WTFPL"
] | null | null | null | #pragma once
#include <Core.h>
C3_NAMESPACE_BEGIN
class IEngine
{
public:
};
IEngine* ConstructEngine();
C3_NAMESPACE_END
| 9 | 27 | 0.761905 |
ce05309db292bd9bbba162f01423f42c1dba0deb | 1,702 | h | C | src/include/nodes/rootNode/trainModel/linear_regression.h | J-Y2020/CARMI | 17c18dc5d615fdcf2d9e3086f9cc476a721a4d9b | [
"MIT"
] | null | null | null | src/include/nodes/rootNode/trainModel/linear_regression.h | J-Y2020/CARMI | 17c18dc5d615fdcf2d9e3086f9cc476a721a4d9b | [
"MIT"
] | null | null | null | src/include/nodes/rootNode/trainModel/linear_regression.h | J-Y2020/CARMI | 17c18dc5d615fdcf2d9e3086f9cc476a721a4d9b | [
"MIT"
] | null | null | null | /**
* @file linear_regression.h
* @author Jiaoyi
* @brief
* @version 0.1
* @date 2021-03-11
*
* @copyright Copyright (c) 2021
*
*/
#ifndef SRC_INCLUDE_NODES_ROOTNODE_TRAINMODEL_LINEAR_REGRESSION_H_
#define SRC_INCLUDE_NODES_ROOTNODE_TRAINMODEL_LINEAR_REGRESSION_H_
#include <algorithm>
#include <fstream>
#include <iostream>
#include <random>
#include <utility>
#include <vector>
#include "../../../params.h"
template <typename DataVectorType, typename KeyType>
class LinearRegression {
public:
LinearRegression() {
theta1 = 0.0001;
theta2 = 0.666;
}
void Train(const DataVectorType &dataset) {
int idx = 0;
int size = dataset.size();
std::vector<double> index(size, 0);
for (int i = 0; i < size; i++) {
index[idx++] = static_cast<double>(i) / size * length;
}
if (size == 0) return;
double t1 = 0, t2 = 0, t3 = 0, t4 = 0;
for (int i = 0; i < size; i++) {
t1 += dataset[i].first * dataset[i].first;
t2 += dataset[i].first;
t3 += dataset[i].first * index[i];
t4 += index[i];
}
theta1 = (t3 * size - t2 * t4) / (t1 * size - t2 * t2);
theta2 = (t1 * t4 - t2 * t3) / (t1 * size - t2 * t2);
}
int Predict(double key) const {
int p = PredictIdx(key);
return p;
}
inline double PredictIdx(KeyType key) const {
// return the predicted idx in the children
double p = theta1 * key + theta2;
if (p < 0)
p = 0;
else if (p > length)
p = length;
return p;
}
int length;
private:
double theta1;
double theta2;
};
#endif // SRC_INCLUDE_NODES_ROOTNODE_TRAINMODEL_LINEAR_REGRESSION_H_
| 23.638889 | 70 | 0.586369 |
701eddd138f27b8c18c01db0dbdf4844f812bfd7 | 359 | h | C | Example/CGCircularCollectionView/CGViewController.h | guoshencheng/CGCircularCollectionView | 0e780b51340a7a85c1d2284d1a5b1dccf5f6cc6b | [
"MIT"
] | null | null | null | Example/CGCircularCollectionView/CGViewController.h | guoshencheng/CGCircularCollectionView | 0e780b51340a7a85c1d2284d1a5b1dccf5f6cc6b | [
"MIT"
] | null | null | null | Example/CGCircularCollectionView/CGViewController.h | guoshencheng/CGCircularCollectionView | 0e780b51340a7a85c1d2284d1a5b1dccf5f6cc6b | [
"MIT"
] | null | null | null | //
// CGViewController.h
// CGCircularCollectionView
//
// Created by guoshencheng on 04/15/2016.
// Copyright (c) 2016 guoshencheng. All rights reserved.
//
#import "CGCircularCollectionView.h"
@interface CGViewController : UIViewController
@property (weak, nonatomic) IBOutlet CGCircularCollectionView *collectionView;
+ (instancetype)create;
@end
| 19.944444 | 78 | 0.766017 |
2ae946f38b30d2206850c901ef32f5671d7fa629 | 8,827 | h | C | include/Event.h | RhiannonSJ/SBND_Analysis_Tool | e31378c59da54295e2fe58ab73dfee5d6cf7f7fd | [
"Apache-2.0"
] | null | null | null | include/Event.h | RhiannonSJ/SBND_Analysis_Tool | e31378c59da54295e2fe58ab73dfee5d6cf7f7fd | [
"Apache-2.0"
] | null | null | null | include/Event.h | RhiannonSJ/SBND_Analysis_Tool | e31378c59da54295e2fe58ab73dfee5d6cf7f7fd | [
"Apache-2.0"
] | null | null | null | #ifndef EVENT_H
#define EVENT_H
#include "Particle.h"
#include "TVector3.h"
#include "TLorentzVector.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <map>
#include "TH1.h"
#include "TF1.h"
namespace ana{
// Typedef for the map
typedef std::map< std::vector< int >, int > TopologyMap;
typedef std::vector<Particle> ParticleList;
typedef std::vector< vector<double> > ParticleMatrix;
/**
* @brief Event class
*/
class Event{
public :
/**
* @brief Constructor
*
* @param mc_particles list of the MC particle objects in the event
* @param reco_particles list of the reconstructed particle objects in the event
* @param interaction the interaction type corresponding to the event
* @param is_cc is this a charged or neutral current event
* @param mc_vertex Monte Carlo neutrino vertex
* @param reco_vertex reconstructed neutrino vertex
* @param file the file number the event was from
* @param id the id of the event
*/
Event(const ParticleList &mc_particles, const ParticleList &reco_particles, const unsigned int interaction, const unsigned int scatter, const int neutrino_pdg, const unsigned int charged_pi, const unsigned int neutral_pi, const bool is_cc, const TVector3 &mc_vertex, const TVector3 &reco_vertex, const float neutrino_energy, const int &file, const int &id);
/**
* @brief CountMCParticlesWithPdg
*
* @param pdg pdg code to count
*
* @return number of Monte Carlo particles with the given pdg code
*/
unsigned int CountMCParticlesWithPdg(const int pdg) const;
/**
* @brief CountRecoParticlesWithPdg
*
* @param pdg pdg code to count
*
* @return number of reconstructed partices with the given pdg code
*/
unsigned int CountRecoParticlesWithPdg(const int pdg) const;
/**
* @brief CheckMCTopology
*
* @param topology map of the chosen topology which holds the number of each chosen type of particle to look for
*
* @return boolean as to whether the event has the desired Monte Carlo topology
*/
bool CheckMCTopology(const TopologyMap &topology) const;
/**
* @brief CheckRecoTopology
*
* @param topology map of the chosen topology which holds the number of each chosen type of particle to look for
*
* @return boolean as to whether the event has the desired reconstructed topology
*/
bool CheckRecoTopology(const TopologyMap &topology) const;
/**
* @brief Get the list of MC particls for this event
*/
ParticleList GetMCParticleList() const;
/**
* @brief Get the list of reconstructed particls for this event
*/
ParticleList GetRecoParticleList() const;
/**
* @brief Get the file id the current event came from
*/
int GetFileId() const;
/**
* @brief Get the id of the current event
*/
int GetId() const;
/**
* @brief Get the interaction type of the event \n
* <tt>
* 0 : Unknown \n
* 1 : Weak CC \n
* 2 : Weak NC \n
* 3 : Weak CC + NC + Interference \n
* 4 : Nucleon decay \n
* </tt>
*/
int GetInteractionType() const;
/**
* @brief Get the scattering code of the event: the physical process \n
* <tt>
* 0 : Unknown \n
* 1 : QE \n
* 2 : Single kaon \n
* 3 : DIS \n
* 4 : Resonant \n
* 5 : Coherent \n
* 6 : Diffractive \n
* 7 : \f$ \nu \f$- e elastic \n
* 8 : Inverse \f$ \mu \f$ decay \n
* 9 : AM \f$ \nu - \gamma \f$ \n
* 10 : MEC \n
* 11 : Coherent elastic \n
* 12 : Inverse \f$ \beta \f$ decay \n
* 13 : Glashow resonance \n
* 14 : IMD Annihilation \n
* </tt>
*
*/
int GetPhysicalProcess() const;
/**
* @brief Get the neutrino pdg code in the event
*/
int GetNeutrinoPdgCode() const;
/**
* @brief Get the number of charged pions
*/
int GetNChargedPions() const;
/**
* @brief Get the number of neutral pions
*/
int GetNNeutralPions() const;
/**
* @brief Get whether the true neutrino interaction happened within the SBND fiducial
* volume
*/
bool IsSBNDTrueFiducial() const;
/**
* @brief Get whether all the reconstructed tracks in an event are contained
*/
bool AllContained() const;
/**
* @brief Get if the event is CC or NC
*/
bool GetIsCC() const;
/**
* @brief Get the Monte Carlo neutrino vertex position
*/
TVector3 GetMCNuVertex() const;
/**
* @brief Get the reconstructed neutrino vertex position
*/
TVector3 GetRecoNuVertex() const;
/**
* @brief Get the true neutrino energy
*/
float GetTrueNuEnergy() const;
/**
* @brief Get the most energetic reconstructed particle
*
* @return Particle most energetic reco
*/
Particle GetMostEnergeticRecoParticle() const;
/**
* @brief Get the most energetic true particle
*
* @return Particle most energetic true
*/
Particle GetMostEnergeticTrueParticle() const;
/**
* @brief Get the minimum x,y,z positions of the SBND fiducial volume
*
* @return Vector of lowest x,y,z positions
*/
TVector3 GetMinimumFiducialDimensions() const;
/**
* @brief Get the maximum x,y,z positions of the SBND fiducial volume
*
* @return Vector of highest x,y,z positions
*/
TVector3 GetMaximumFiducialDimensions() const;
private :
/**
* @brief CountParticlesWithPdg
*
* @param pdg pdg code to count
*
* @return number of partices with the given pdg code
*/
unsigned int CountParticlesWithPdg(const int pdg, const ParticleList &particle_list) const;
/**
* @brief CheckTopology
*
* @param topology map of the chosen topology which holds the number of each chosen type of particle to look for
*
* @return boolean as to whether the event has the desired topology
*/
bool CheckTopology(const TopologyMap &topology, const ParticleList &particle_list) const;
/**
* @brief Get the most energetic particle
*
* @return Particle most energetic
*/
Particle GetMostEnergeticParticle(const ParticleList &particle_list) const;
// Member variables
ParticleList m_mc_particles; ///< vector of Monte Carlo particles
ParticleList m_reco_particles; ///< vector of reconstructed particles
unsigned int m_interaction; ///< interaction type of the event
unsigned int m_scatter; ///< scatter code for the event: physical process
int m_nu_pdg; ///< Neutrino pdg code of the event
unsigned int m_charged_pi; ///< Number of charged pions in the event
unsigned int m_neutral_pi; ///< Number of neutral pions in the event
bool m_is_cc; ///< whether the event contains and CC or NC interaction
TVector3 m_reco_vertex; ///< reconstructed neutrino vertex
TVector3 m_mc_vertex; ///< reconstructed neutrino vertex
float m_neutrino_energy; ///< true neutrino energy
int m_file; ///< file id
int m_id; ///< event id
float m_sbnd_border_x; ///< fiducial border in x for the sbnd detector
float m_sbnd_border_y; ///< fiducial border in y for the sbnd detector
float m_sbnd_border_z; ///< fiducial border in z for the sbnd detector
float m_sbnd_offset_x; ///< offset in x for the sbnd detector
float m_sbnd_offset_y; ///< offset in y for the sbnd detector
float m_sbnd_offset_z; ///< offset in z for the sbnd detector
float m_sbnd_half_length_x; ///< detector half length in x
float m_sbnd_half_length_y; ///< detector half length in y
float m_sbnd_half_length_z; ///< detector half length in z
}; // Event
} // ana
#endif
| 33.435606 | 363 | 0.57528 |
acfdf1d941d4605b40972d12a48c5989ec46835d | 462 | c | C | Src/xy_trees.c | AlbesK/Barnes-Hut-C | b54769104ab957520436b2b605d0f31c220f039c | [
"MIT"
] | 1 | 2021-03-02T14:56:13.000Z | 2021-03-02T14:56:13.000Z | Src/xy_trees.c | AlbesK/Barnes-Hut-C | b54769104ab957520436b2b605d0f31c220f039c | [
"MIT"
] | null | null | null | Src/xy_trees.c | AlbesK/Barnes-Hut-C | b54769104ab957520436b2b605d0f31c220f039c | [
"MIT"
] | 1 | 2022-02-04T20:46:23.000Z | 2022-02-04T20:46:23.000Z | #include<stdio.h>
#include<stdlib.h>
#include "bhHeaders.h"
/*
Function to print quad tree data into csv files
*/
void xy_trees(struct quad* nd){
FILE * f;
f = fopen("/home/albes/Desktop/nodestd.txt", "w"); /* open the file for writing*/
printf("Writting...\n");
/* write 10 lines of text into the file stream*/
fprintf(f, "N,X,Y,S\n");
printdata(nd, f);
/* close the file*/
fclose (f);
printf("Closed file.\n");
} | 25.666667 | 85 | 0.599567 |
f2f65ab9a764cbc8dc07ede49858167145712269 | 2,253 | h | C | System/Library/PrivateFrameworks/UIKitCore.framework/_UINavigationBarAugmentedTitleView.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | 1 | 2020-11-04T15:43:01.000Z | 2020-11-04T15:43:01.000Z | System/Library/PrivateFrameworks/UIKitCore.framework/_UINavigationBarAugmentedTitleView.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/UIKitCore.framework/_UINavigationBarAugmentedTitleView.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | /*
* This header is generated by classdump-dyld 1.0
* on Sunday, September 27, 2020 at 11:38:39 AM Mountain Standard Time
* Operating System: Version 14.0 (Build 18A373)
* Image Source: /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol _UINavigationBarAugmentedTitleView <NSObject>
@property (nonatomic,readonly) BOOL _underlayNavigationBarContent;
@property (nonatomic,readonly) double _navigationBarContentHeight;
@property (nonatomic,readonly) double _navigationBarBackButtonMaximumWidth;
@property (nonatomic,readonly) BOOL _hideNavigationBarBackButton;
@property (nonatomic,readonly) BOOL _hideNavigationBarLeadingBarButtons;
@property (nonatomic,readonly) BOOL _hideNavigationBarStandardTitle;
@property (nonatomic,readonly) BOOL _hideNavigationBarTrailingBarButtons;
@property (nonatomic,readonly) double _navigationBarBackButtonAlpha;
@property (nonatomic,readonly) double _navigationBarLeadingBarButtonsAlpha;
@property (nonatomic,readonly) double _navigationBarTrailingBarButtonsAlpha;
@property (nonatomic,readonly) long long _preferredAlignment;
@required
-(void)_navigationBarTraitCollectionDidChangeTo:(id)arg1 from:(id)arg2;
-(BOOL)_wantsTwoPartTransition;
-(void)_navigationBarTransitionCompleted:(long long)arg1 willBeDisplayed:(BOOL)arg2;
-(void)_performNavigationBarTransition:(long long)arg1 willBeDisplayed:(BOOL)arg2;
-(BOOL)_hideNavigationBarStandardTitle;
-(double)_navigationBarBackButtonAlpha;
-(void)_contentDidChange;
-(void)_navigationBarTransitionWillBegin:(long long)arg1 willBeDisplayed:(BOOL)arg2;
-(double)_navigationBarLeadingBarButtonsAlpha;
-(BOOL)_hideNavigationBarTrailingBarButtons;
-(BOOL)_hideNavigationBarBackButton;
-(double)_navigationBarTrailingBarButtonsAlpha;
-(id)_traitCollectionOverridesForNavigationBarTraitCollection:(id)arg1;
-(void)_setDataSource:(id)arg1 navigationItem:(id)arg2 titleLocation:(long long)arg3;
-(long long)_preferredContentSizeForSize:(long long)arg1;
-(BOOL)_hideNavigationBarLeadingBarButtons;
-(long long)_preferredAlignment;
-(double)_navigationBarContentHeight;
-(double)_navigationBarBackButtonMaximumWidth;
-(BOOL)_underlayNavigationBarContent;
@end
| 48.978261 | 85 | 0.84332 |
7a8491572c347923b0ccf20c7faa4e99f0fe81a2 | 416 | h | C | ZhiDa_Home/Main/ProductCenter/ZDHProductCenterOtherViewController.h | GentHuang/ZDHome_01 | 6a4b2193d67a4af775dfbac9d12e4015143f7b08 | [
"Apache-2.0"
] | null | null | null | ZhiDa_Home/Main/ProductCenter/ZDHProductCenterOtherViewController.h | GentHuang/ZDHome_01 | 6a4b2193d67a4af775dfbac9d12e4015143f7b08 | [
"Apache-2.0"
] | null | null | null | ZhiDa_Home/Main/ProductCenter/ZDHProductCenterOtherViewController.h | GentHuang/ZDHome_01 | 6a4b2193d67a4af775dfbac9d12e4015143f7b08 | [
"Apache-2.0"
] | null | null | null | //
// ZDHProductCenterOtherViewController.h
// ZhiDa_Home
//
// Created by apple on 15/8/19.
// Copyright (c) 2015年 软碟技术. All rights reserved.
//
#import "ZDHParentViewController.h"
#import "ZDHProductCenterBrandBottomCollectionView.h"
@interface ZDHProductCenterOtherViewController : ZDHParentViewController
@property (strong, nonatomic) NSString *titleName;
@property (strong, nonatomic) NSString *tid;
@end
| 26 | 72 | 0.78125 |
ffca9c1899f34a20b22686a8bb8e72ddd8778b43 | 306 | h | C | SVIEngine/jni/SVI/Animation/Transition/SVIWaveEffector.h | Samsung/SVIEngine | 36964f5b296317a3b7b2825137fef921a8c94973 | [
"Apache-2.0"
] | 27 | 2015-04-24T07:14:55.000Z | 2020-01-24T16:16:37.000Z | SVIEngine/jni/SVI/Animation/Transition/SVIWaveEffector.h | Lousnote5/SVIEngine | 36964f5b296317a3b7b2825137fef921a8c94973 | [
"Apache-2.0"
] | null | null | null | SVIEngine/jni/SVI/Animation/Transition/SVIWaveEffector.h | Lousnote5/SVIEngine | 36964f5b296317a3b7b2825137fef921a8c94973 | [
"Apache-2.0"
] | 15 | 2015-12-08T14:46:19.000Z | 2020-01-21T19:26:41.000Z | #ifndef __SVI_WAVEEFFECTOR_H_
#define __SVI_WAVEEFFECTOR_H_
#include "SVITransitionEffector.h"
namespace SVI {
class SVIWaveEffector : public SVITransitionEffector {
public:
SVIWaveEffector(SVIGLSurface *surface);
virtual ~SVIWaveEffector() {}
protected:
void setAnimation();
};
}
#endif | 14.571429 | 55 | 0.764706 |
d8cb6e321fc6972eeddc382083fb72a76757c624 | 424 | h | C | include/hdlConvertor/vhdlConvertor/variableParser.h | the-moog/hdlConvertor | 5c8f5c6bf2bdceddf0c8cf6b5213d1b56b358f00 | [
"MIT"
] | 184 | 2016-08-12T14:26:52.000Z | 2022-03-24T21:42:17.000Z | include/hdlConvertor/vhdlConvertor/variableParser.h | hdl4fpga/hdlConvertor | 291991042135bf688ee2864cf7fb37d8e8a057db | [
"MIT"
] | 142 | 2016-08-10T03:12:03.000Z | 2022-03-30T17:35:06.000Z | include/hdlConvertor/vhdlConvertor/variableParser.h | hdl4fpga/hdlConvertor | 291991042135bf688ee2864cf7fb37d8e8a057db | [
"MIT"
] | 50 | 2016-08-06T10:38:29.000Z | 2022-03-30T11:03:42.000Z | #pragma once
#include <vector>
#include <hdlConvertor/vhdlConvertor/vhdlParser/vhdlParser.h>
#include <hdlConvertor/hdlAst/hdlIdDef.h>
namespace hdlConvertor {
namespace vhdl {
class VhdlVariableParser {
public:
using vhdlParser = vhdl_antlr::vhdlParser;
static std::unique_ptr<
std::vector<std::unique_ptr<hdlAst::HdlIdDef>>> visitVariable_declaration(
vhdlParser::Variable_declarationContext *ctx);
};
}
}
| 17.666667 | 77 | 0.773585 |
d8ec3bb14d7138da39b2116e7b7d53d021eb1fd1 | 7,091 | h | C | src/snmp-agent/agent-config.h | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 11 | 2017-05-20T22:34:34.000Z | 2022-02-15T00:30:49.000Z | src/snmp-agent/agent-config.h | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 1 | 2019-12-10T01:40:18.000Z | 2019-12-10T01:40:18.000Z | src/snmp-agent/agent-config.h | verrio/osnmpd | a7c7830cfbbb77fc20d18021531e250267da67e3 | [
"MIT"
] | 5 | 2017-05-20T22:40:25.000Z | 2021-03-18T19:00:54.000Z | /*
* This file is part of the osnmpd project (https://github.com/verrio/osnmpd).
* Copyright (C) 2016 Olivier Verriest
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SRC_AGENT_CONFIG_H_
#define SRC_AGENT_CONFIG_H_
#include "snmp-agent/snmpd.h"
#include "snmp-core/snmp-crypto.h"
#define ENGINE_ID_MAX_LEN 0x20
#define USER_NAME_MAX_LEN 0x40
#define USER_PASSWORD_MIN_LEN 0x8
#define USER_PASSWORD_MAX_LEN 0x40
typedef struct {
int enabled;
int confirmed;
SnmpUserSlot user;
char *destination;
uint16_t port;
uint32_t retries;
uint32_t timeout;
} TrapConfiguration;
typedef struct {
/* user profile */
SnmpUserSlot user;
/* user enabled */
int enabled;
/* user name */
char *name;
/* privacy password or derived key */
SnmpUSMSecret priv_secret;
/* authentication password or derived key */
SnmpUSMSecret auth_secret;
/* security model enforced for this user */
SnmpSecurityModel security_model;
/* security level enforced for this user */
SnmpSecurityLevel security_level;
} UserConfiguration;
/**
* set_config_file - sets the configuration file to the given path.
*
* @param path IN - config file path (not duplicated)
*/
void set_config_file(char *path);
/**
* load_configuration - initialize the agent configuration.
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int load_configuration(void);
/**
* write_configuration - write the current agent configuration to disk.
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int write_configuration(void);
/**
* get_cache_dir - returns the directory in which to store the agent's cache.
*
* @return cache directory.
*/
char *get_cache_dir(void);
/**
* get_max_log_size - returns the maximum trap log size.
*
* @return max trap log size.
*/
uint32_t get_max_log_size(void);
/**
* get_uid - returns the daemon UID.
*
* @return daemon user ID.
*/
int get_agent_uid(void);
/**
* get_gid - returns the daemon GID.
*
* @return daemon user group.
*/
int get_agent_gid(void);
/**
* get_port - returns the UDP port on which to bind.
*
* @return UDP port on which to bind.
*/
__attribute__((visibility("default")))
int get_agent_port(void);
/**
* set_port - sets the UDP port on which to bind.
*
* @param port IN - new UDP port
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_agent_port(int port);
/**
* get_interfaces - returns the list of interfaces on which to listen,
* or NULL if no such list exists.
*
* @return interfaces on which to listen.
*/
char **get_agent_interfaces(void);
/**
* set_interfaces - sets the interfaces on which to listen.
*
* @param ifaces IN - new list of interfaces
*
* @return 0 on success or -1 on any error
*/
int set_agent_interfaces(char *ifaces[]);
/**
* get_trap_configuration - returns the trap configuration.
*
* @return pointer to trap configuration (internal, not freed by caller)
*/
__attribute__((visibility("default")))
TrapConfiguration *get_trap_configuration(void);
/**
* set_trap_configuration - updates the trap configuration.
*
* @param configuration IN - new trap configuration
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_trap_configuration(TrapConfiguration *configuration);
/**
* get_user_configuration - returns the configuration for the given user profile.
*
* @param user IN - selected user
*
* @return pointer to user configuration (internal, not freed by caller)
*/
__attribute__((visibility("default")))
UserConfiguration *get_user_configuration(SnmpUserSlot user);
/**
* set_user_configuration - updates the configuration for a given user profile.
* password field is ignored.
*
* @param configuration IN - new user configuration
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_user_configuration(UserConfiguration *configuration);
/**
* set_user_priv_password - updates the privacy password for a given user.
*
* @param user IN - selected user slot
* @param password IN - new privacy password
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_user_priv_password(SnmpUserSlot user, char *password);
/**
* set_user_auth_password - updates the authentication password for a given user.
*
* @param user IN - selected user slot
* @param password IN - new authentication password
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_user_auth_password(SnmpUserSlot user, char *password);
/**
* set_user_priv_derived_key - updates the privacy key for a given user.
*
* @param user IN - selected user slot
* @param key IN - new privacy key
* @param key_len IN - key length
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_user_priv_key(SnmpUserSlot user, const uint8_t *key, size_t key_len);
/**
* set_user_auth_derived_key - updates the authentication key for a given user.
*
* @param user IN - selected user slot
* @param key IN - new authentication key
* @param key_len IN - key length
*
* @return 0 on success or -1 on any error
*/
__attribute__((visibility("default")))
int set_user_auth_key(SnmpUserSlot user, const uint8_t *key, size_t key_len);
/**
* get_engine_id - updates the engine ID to the given string.
* internal pointer, should not be freed by caller.
*
* @param engine_id OUT - pointer to start of engine id buffer
*
* @return length of engine ID
*/
__attribute__((visibility("default")))
size_t get_engine_id(uint8_t **engine_id);
/**
* set_engine_id - updates the engine ID to the given string.
*
* @param engine_id IN - pointer to start of engine id buffer
* @param engine_id_len IN - length of new engine id
*
* @return 0 on success or -1 on any error
*/
int set_engine_id(const uint8_t *engine_id, const size_t engine_id_len);
#endif /* SRC_AGENT_CONFIG_H_ */
| 26.961977 | 81 | 0.726132 |
1a71943600a3888a4ed7275ae14e9364c93fd944 | 10,936 | h | C | src/lkl_wrap/include/lkl/linux/virtio_net.h | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | 11 | 2022-02-05T12:12:43.000Z | 2022-03-08T08:09:08.000Z | src/lkl_wrap/include/lkl/linux/virtio_net.h | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | null | null | null | src/lkl_wrap/include/lkl/linux/virtio_net.h | dme26/intravisor | 9bf9c50aa14616bd9bd66eee47623e8b61514058 | [
"MIT"
] | 1 | 2022-02-22T20:32:22.000Z | 2022-02-22T20:32:22.000Z | #ifndef _LKL_LINUX_VIRTIO_NET_H
#define _LKL_LINUX_VIRTIO_NET_H
/* This header is BSD licensed so anyone can use the definitions to implement
* compatible drivers/servers.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of IBM 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 IBM 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. */
#include <lkl/linux/types.h>
#include <lkl/linux/virtio_ids.h>
#include <lkl/linux/virtio_config.h>
#include <lkl/linux/virtio_types.h>
#include <lkl/linux/if_ether.h>
/* The feature bitmap for virtio net */
#define LKL_VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
#define LKL_VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
#define LKL_VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */
#define LKL_VIRTIO_NET_F_MTU 3 /* Initial MTU advice */
#define LKL_VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
#define LKL_VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
#define LKL_VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
#define LKL_VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
#define LKL_VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
#define LKL_VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
#define LKL_VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
#define LKL_VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
#define LKL_VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
#define LKL_VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
#define LKL_VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
#define LKL_VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
#define LKL_VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
#define LKL_VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
#define LKL_VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
#define LKL_VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
* network */
#define LKL_VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
* Steering */
#define LKL_VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
#define LKL_VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */
#ifndef VIRTIO_NET_NO_LEGACY
#define LKL_VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
#endif /* VIRTIO_NET_NO_LEGACY */
#define LKL_VIRTIO_NET_S_LINK_UP 1 /* Link is up */
#define LKL_VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
struct lkl_virtio_net_config {
/* The config defining mac address (if LKL_VIRTIO_NET_F_MAC) */
__lkl__u8 mac[LKL_ETH_ALEN];
/* See LKL_VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
__lkl__u16 status;
/* Maximum number of each of transmit and receive queues;
* see LKL_VIRTIO_NET_F_MQ and LKL_VIRTIO_NET_CTRL_MQ.
* Legal values are between 1 and 0x8000
*/
__lkl__u16 max_virtqueue_pairs;
/* Default maximum transmit unit advice */
__lkl__u16 mtu;
/*
* speed, in units of 1Mb. All values 0 to INT_MAX are legal.
* Any other value stands for unknown.
*/
__lkl__u32 speed;
/*
* 0x00 - half duplex
* 0x01 - full duplex
* Any other value stands for unknown.
*/
__lkl__u8 duplex;
} __attribute__((packed));
/*
* This header comes first in the scatter-gather list. If you don't
* specify GSO or CSUM features, you can simply ignore the header.
*
* This is bitwise-equivalent to the legacy struct lkl_virtio_net_hdr_mrg_rxbuf,
* only flattened.
*/
struct lkl_virtio_net_hdr_v1 {
#define LKL_VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
#define LKL_VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */
__lkl__u8 flags;
#define LKL_VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */
#define LKL_VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */
#define LKL_VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */
#define LKL_VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */
#define LKL_VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */
__lkl__u8 gso_type;
__lkl__virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
__lkl__virtio16 gso_size; /* Bytes to append to hdr_len per frame */
__lkl__virtio16 csum_start; /* Position to start checksumming from */
__lkl__virtio16 csum_offset; /* Offset after that to place checksum */
__lkl__virtio16 num_buffers; /* Number of merged rx buffers */
};
#ifndef VIRTIO_NET_NO_LEGACY
/* This header comes first in the scatter-gather list.
* For legacy virtio, if LKL_VIRTIO_F_ANY_LAYOUT is not negotiated, it must
* be the first element of the scatter-gather list. If you don't
* specify GSO or CSUM features, you can simply ignore the header. */
struct lkl_virtio_net_hdr {
/* See VIRTIO_NET_HDR_F_* */
__lkl__u8 flags;
/* See VIRTIO_NET_HDR_GSO_* */
__lkl__u8 gso_type;
__lkl__virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
__lkl__virtio16 gso_size; /* Bytes to append to hdr_len per frame */
__lkl__virtio16 csum_start; /* Position to start checksumming from */
__lkl__virtio16 csum_offset; /* Offset after that to place checksum */
};
/* This is the version of the header to use when the MRG_RXBUF
* feature has been negotiated. */
struct lkl_virtio_net_hdr_mrg_rxbuf {
struct lkl_virtio_net_hdr hdr;
__lkl__virtio16 num_buffers; /* Number of merged rx buffers */
};
#endif /* ...VIRTIO_NET_NO_LEGACY */
/*
* Control virtqueue data structures
*
* The control virtqueue expects a header in the first sg entry
* and an ack/status response in the last entry. Data for the
* command goes in between.
*/
struct lkl_virtio_net_ctrl_hdr {
__lkl__u8 class;
__lkl__u8 cmd;
} __attribute__((packed));
typedef __lkl__u8 lkl_virtio_net_ctrl_ack;
#define LKL_VIRTIO_NET_OK 0
#define LKL_VIRTIO_NET_ERR 1
/*
* Control the RX mode, ie. promisucous, allmulti, etc...
* All commands require an "out" sg entry containing a 1 byte
* state value, zero = disable, non-zero = enable. Commands
* 0 and 1 are supported with the LKL_VIRTIO_NET_F_CTRL_RX feature.
* Commands 2-5 are added with LKL_VIRTIO_NET_F_CTRL_RX_EXTRA.
*/
#define LKL_VIRTIO_NET_CTRL_RX 0
#define LKL_VIRTIO_NET_CTRL_RX_PROMISC 0
#define LKL_VIRTIO_NET_CTRL_RX_ALLMULTI 1
#define LKL_VIRTIO_NET_CTRL_RX_ALLUNI 2
#define LKL_VIRTIO_NET_CTRL_RX_NOMULTI 3
#define LKL_VIRTIO_NET_CTRL_RX_NOUNI 4
#define LKL_VIRTIO_NET_CTRL_RX_NOBCAST 5
/*
* Control the MAC
*
* The MAC filter table is managed by the hypervisor, the guest should
* assume the size is infinite. Filtering should be considered
* non-perfect, ie. based on hypervisor resources, the guest may
* received packets from sources not specified in the filter list.
*
* In addition to the class/cmd header, the TABLE_SET command requires
* two out scatterlists. Each contains a 4 byte count of entries followed
* by a concatenated byte stream of the LKL_ETH_ALEN MAC addresses. The
* first sg list contains unicast addresses, the second is for multicast.
* This functionality is present if the LKL_VIRTIO_NET_F_CTRL_RX feature
* is available.
*
* The ADDR_SET command requests one out scatterlist, it contains a
* 6 bytes MAC address. This functionality is present if the
* LKL_VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
*/
struct lkl_virtio_net_ctrl_mac {
__lkl__virtio32 entries;
__lkl__u8 macs[][LKL_ETH_ALEN];
} __attribute__((packed));
#define LKL_VIRTIO_NET_CTRL_MAC 1
#define LKL_VIRTIO_NET_CTRL_MAC_TABLE_SET 0
#define LKL_VIRTIO_NET_CTRL_MAC_ADDR_SET 1
/*
* Control VLAN filtering
*
* The VLAN filter table is controlled via a simple ADD/DEL interface.
* VLAN IDs not added may be filterd by the hypervisor. Del is the
* opposite of add. Both commands expect an out entry containing a 2
* byte VLAN ID. VLAN filterting is available with the
* LKL_VIRTIO_NET_F_CTRL_VLAN feature bit.
*/
#define LKL_VIRTIO_NET_CTRL_VLAN 2
#define LKL_VIRTIO_NET_CTRL_VLAN_ADD 0
#define LKL_VIRTIO_NET_CTRL_VLAN_DEL 1
/*
* Control link announce acknowledgement
*
* The command LKL_VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
* driver has recevied the notification; device would clear the
* LKL_VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
* this command.
*/
#define LKL_VIRTIO_NET_CTRL_ANNOUNCE 3
#define LKL_VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
/*
* Control Receive Flow Steering
*
* The command LKL_VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
* enables Receive Flow Steering, specifying the number of the transmit and
* receive queues that will be used. After the command is consumed and acked by
* the device, the device will not steer new packets on receive virtqueues
* other than specified nor read from transmit virtqueues other than specified.
* Accordingly, driver should not transmit new packets on virtqueues other than
* specified.
*/
struct lkl_virtio_net_ctrl_mq {
__lkl__virtio16 virtqueue_pairs;
};
#define LKL_VIRTIO_NET_CTRL_MQ 4
#define LKL_VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
#define LKL_VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
#define LKL_VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
/*
* Control network offloads
*
* Reconfigures the network offloads that Guest can handle.
*
* Available with the LKL_VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit.
*
* Command data format matches the feature bit mask exactly.
*
* See VIRTIO_NET_F_GUEST_* for the list of offloads
* that can be enabled/disabled.
*/
#define LKL_VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
#define LKL_VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
#endif /* _LKL_LINUX_VIRTIO_NET_H */
| 41.740458 | 84 | 0.766002 |
9e83ef02eaf4b6fd90cc12639a24a8932f23a0ce | 6,238 | h | C | ObjectARX 2016/inc/AcDbAssocNetworkSurfaceActionBody.h | huanjka/AutoCADPlugin-HeatSource | ab0865402b41fe45d3b509c01c6f114d128522a8 | [
"MIT"
] | 1 | 2020-02-06T14:08:24.000Z | 2020-02-06T14:08:24.000Z | ObjectARX 2016/inc/AcDbAssocNetworkSurfaceActionBody.h | huanjka/AutoCADPlugin-HeatSource | ab0865402b41fe45d3b509c01c6f114d128522a8 | [
"MIT"
] | null | null | null | ObjectARX 2016/inc/AcDbAssocNetworkSurfaceActionBody.h | huanjka/AutoCADPlugin-HeatSource | ab0865402b41fe45d3b509c01c6f114d128522a8 | [
"MIT"
] | 2 | 2020-02-21T00:52:24.000Z | 2022-02-10T06:05:35.000Z | //////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
//
//////////////////////////////////////////////////////////////////////////////
//
// CREATED BY: Tom Ball August 2009
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "AcDbAssocPathBasedSurfaceActionBody.h"
#include "AcDbAssocLoftedSurfaceActionBody.h"
#pragma pack (push, 8)
/// <summary>
/// Action that sets the contents of AcDbLoftedSurface entity created by surface network operation
/// </summary>
///
class ACDB_PORT AcDbAssocNetworkSurfaceActionBody : public AcDbAssocPathBasedSurfaceActionBody
{
public:
ACRX_DECLARE_MEMBERS(AcDbAssocNetworkSurfaceActionBody);
/// <summary> Default constructor. </summary>
/// <param name="createImpObject"> See AcDbAssocCreateImpObject explanation. </param>
///
explicit AcDbAssocNetworkSurfaceActionBody(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject);
/// <summary>
/// Get continuity of a specified profile that used to create the resulting network surface
/// </summary>
/// <param name="type"> Specify which profile to get continuity. </param>
/// <param name="continuity"> Returned continuity, can be 0(G0), 1(G1), 2(G2). </param>
/// <param name="expression"> Expression of the parameter, empty string if no expression is being used. </param>
/// <param name="evaluatorId"> The id of the expression evaluator that is used to parse the expression, empty string if no expression is being used </param>
/// <returns> Acad::ErrorStatus. </returns>
///
Acad::ErrorStatus getContinuity( AcDbAssocLoftedSurfaceActionBody::ProfileType type,
int &continuity, AcString& expression = dummyString(),
AcString& evaluatorId = dummyString() ) const;
/// <summary>
/// Set continuity of a specified profile that used to create the resulting network surface
/// </summary>
/// <param name="type"> Specify which profile to set continuity. </param>
/// <param name="continuity"> New continuity value, can be 0(G0), 1(G1), 2(G2). </param>
/// <param name="expression"> Expression of the parameter, if the value is controlled by other parameters</param>
/// <param name="evaluatorId"> The id of the expression evaluator that is used to parse the expression, if an expression is used. </param>
/// <returns> Acad::ErrorStatus. </returns>
///
Acad::ErrorStatus setContinuity( AcDbAssocLoftedSurfaceActionBody::ProfileType type,
int continuity, const AcString& expression = AcString(),
const AcString& evaluatorId = AcString() );
/// <summary>
/// Get bulge of a specified profile that used to create the resulting network surface
/// </summary>
/// <param name="type"> Specify which profile to get bulge. </param>
/// <param name="bulge"> Returned bulge. </param>
/// <param name="expression"> Expression of the parameter, empty string if no expression is being used. </param>
/// <param name="evaluatorId"> The id of the expression evaluator that is used to parse the expression, empty string if no expression is being used </param>
/// <returns> Acad::ErrorStatus. </returns>
///
Acad::ErrorStatus getBulge( AcDbAssocLoftedSurfaceActionBody::ProfileType type,
double &bulge, AcString& expression = dummyString(),
AcString& evaluatorId = dummyString() ) const;
/// <summary>
/// Set bulge of a specified profile that used to create the resulting network surface
/// </summary>
/// <param name="type"> Specify which profile to set bulge. </param>
/// <param name="bulge"> New bulge value. </param>
/// <param name="expression"> Expression of the parameter, if the value is controlled by other parameters</param>
/// <param name="evaluatorId"> The id of the expression evaluator that is used to parse the expression, if an expression is used. </param>
/// <returns> Acad::ErrorStatus. </returns>
///
Acad::ErrorStatus setBulge( AcDbAssocLoftedSurfaceActionBody::ProfileType type,
double bulge, const AcString& expression = AcString(),
const AcString& evaluatorId = AcString() );
/// <summary>
/// Create an instance of AcDbAssocNetworkSurfaceActionBody
/// </summary>
/// <param name="resultingSurfaceId"> Resulting network surface id. </param>
/// <param name="crossSections"> Array of cross sections that used to create the resulting network surface. </param>
/// <param name="guideCurves"> Array of guide curves that used to create the resulting network surface. </param>
/// <param name="continuityArray"> Array of continuity for each cross section and guide curve, the order is the same as the order in cross section array following the order of guide curve array. </param>
/// <param name="bulgeArray"> Array of bulge for each cross section and guide curve, the order is the same as the order in cross section array following the order of guide curve array. </param>
/// <param name="bEnabled"> Specify if the action is fully associative. </param>
/// <param name="createdActionId"> Id of created action. </param>
/// <returns> Acad::ErrorStatus. </returns>
///
static Acad::ErrorStatus createInstance( const AcDbObjectId& resultingSurfaceId,
const AcArray<AcDbPathRef>& crossSections,
const AcArray<AcDbPathRef>& guideCurves,
const AcArray<int>& continuityArray,
const AcArray<double>& bulgeArray,
bool bEnabled,
AcDbObjectId& createdActionId);
}; // class AcDbAssocNetworkSurfaceActionBody
#pragma pack (pop)
| 56.198198 | 208 | 0.647002 |
9e988d98ada3bfef2e3af3b799e50105f22a7c7e | 1,800 | h | C | soc/xtensa/esp32/soc.h | mckaymatthew/zephyr | e231d50535794e3783b0683264615e9f7ee00548 | [
"Apache-2.0"
] | 1 | 2017-05-20T00:11:14.000Z | 2017-05-20T00:11:14.000Z | soc/xtensa/esp32/soc.h | mckaymatthew/zephyr | e231d50535794e3783b0683264615e9f7ee00548 | [
"Apache-2.0"
] | null | null | null | soc/xtensa/esp32/soc.h | mckaymatthew/zephyr | e231d50535794e3783b0683264615e9f7ee00548 | [
"Apache-2.0"
] | 1 | 2021-08-05T06:36:20.000Z | 2021-08-05T06:36:20.000Z | /*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __SOC_H__
#define __SOC_H__
#include <soc/dport_reg.h>
#include <soc/rtc_cntl_reg.h>
#include <soc/soc_caps.h>
#include <esp32/rom/ets_sys.h>
#include <esp32/rom/spi_flash.h>
#include <zephyr/types.h>
#include <stdbool.h>
#include <arch/xtensa/arch.h>
#include <xtensa/core-macros.h>
#include <esp32/clk.h>
static inline void esp32_set_mask32(uint32_t v, uint32_t mem_addr)
{
sys_write32(sys_read32(mem_addr) | v, mem_addr);
}
static inline void esp32_clear_mask32(uint32_t v, uint32_t mem_addr)
{
sys_write32(sys_read32(mem_addr) & ~v, mem_addr);
}
extern void esp32_rom_intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
extern int esp32_rom_gpio_matrix_in(uint32_t gpio, uint32_t signal_index,
bool inverted);
extern int esp32_rom_gpio_matrix_out(uint32_t gpio, uint32_t signal_index,
bool out_inverted,
bool out_enabled_inverted);
extern void esp32_rom_uart_attach(void);
extern void esp32_rom_uart_tx_wait_idle(uint8_t uart_no);
extern STATUS esp32_rom_uart_tx_one_char(uint8_t chr);
extern STATUS esp32_rom_uart_rx_one_char(uint8_t *chr);
extern void esp32_rom_Cache_Flush(int cpu);
extern void esp32_rom_Cache_Read_Enable(int cpu);
extern void esp32_rom_ets_set_appcpu_boot_addr(void *addr);
/* ROM functions which read/write internal i2c control bus for PLL, APLL */
extern uint8_t esp32_rom_i2c_readReg(uint8_t block, uint8_t host_id, uint8_t reg_add);
extern void esp32_rom_i2c_writeReg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data);
/* ROM information related to SPI Flash chip timing and device */
extern esp_rom_spiflash_chip_t g_rom_flashchip;
extern uint8_t g_rom_spiflash_dummy_len_plus[];
#endif /* __SOC_H__ */
| 31.034483 | 98 | 0.791667 |
367b31e5309eb65c7eedf01d9db5361170887454 | 2,964 | c | C | userspace/core/ps.c | monday-lesley/ponyos | aec744f0a2740d8bb6b8e59c53b135a49e297603 | [
"CC-BY-3.0"
] | null | null | null | userspace/core/ps.c | monday-lesley/ponyos | aec744f0a2740d8bb6b8e59c53b135a49e297603 | [
"CC-BY-3.0"
] | null | null | null | userspace/core/ps.c | monday-lesley/ponyos | aec744f0a2740d8bb6b8e59c53b135a49e297603 | [
"CC-BY-3.0"
] | null | null | null | /* vim: tabstop=4 shiftwidth=4 noexpandtab
* This file is part of ToaruOS and is released under the terms
* of the NCSA / University of Illinois License - see LICENSE.md
* Copyright (C) 2013 Kevin Lange
*
* ps
*
* print a list of running processes
*/
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syscall.h>
#include <unistd.h>
#include <dirent.h>
#include <pwd.h>
#include "lib/list.h"
#define LINE_LEN 4096
static int show_all = 0;
void print_username(int uid) {
struct passwd * p = getpwuid(uid);
if (p) {
printf("%-8s", p->pw_name);
} else {
printf("%-8d", uid);
}
endpwent();
}
void print_entry(struct dirent * dent) {
char tmp[256], buf[4096];
FILE * f;
int read = 1;
char line[LINE_LEN];
int pid, uid, tgid;
char name[100];
snprintf(tmp, 256, "/proc/%s/status", dent->d_name);
f = fopen(tmp, "r");
while (fgets(line, LINE_LEN, f) != NULL) {
if (strstr(line, "Pid:") == line) {
sscanf(line, "%s %d", &buf, &pid);
} else if (strstr(line, "Uid:") == line) {
sscanf(line, "%s %d", &buf, &uid);
} else if (strstr(line, "Tgid:") == line) {
sscanf(line, "%s %d", &buf, &tgid);
} else if (strstr(line, "Name:") == line) {
sscanf(line, "%s %s", &buf, &name);
}
}
fclose(f);
if ((tgid != pid) && !show_all) {
/* Skip threads */
return;
}
print_username(uid);
if (show_all) {
printf("%5d.%-5d", tgid, pid);
} else {
printf(" %5d", pid);
}
printf(" ");
snprintf(tmp, 256, "/proc/%s/cmdline", dent->d_name);
f = fopen(tmp, "r");
memset(buf, 0x00, 4096);
read = fread(buf, 1, 4096, f);
fclose(f);
buf[read] = '\0';
for (int i = 0; i < read; ++i) {
if (buf[i] == '\036') {
buf[i] = ' ';
}
}
if (tgid != pid) {
printf("{%s}\n", buf);
} else {
printf("%s\n", buf);
}
}
void show_usage(int argc, char * argv[]) {
printf(
"ps - list running processes\n"
"\n"
"usage: %s [-A] [format]\n"
"\n"
" -A \033[3mignored\033[0m\n"
" -? \033[3mshow this help text\033[0m\n"
"\n", argv[0]);
}
int main (int argc, char * argv[]) {
/* Parse arguments */
if (argc > 1) {
int index, c;
while ((c = getopt(argc, argv, "A?")) != -1) {
switch (c) {
case 'A':
show_all = 1;
break;
case '?':
show_usage(argc, argv);
return 0;
}
}
}
/* Open the directory */
DIR * dirp = opendir("/proc");
/* Read the entries in the directory */
list_t * ents_list = list_create();
struct dirent * ent = readdir(dirp);
while (ent != NULL) {
if (ent->d_name[0] >= '0' && ent->d_name[0] <= '9') {
struct dirent * entcpy = malloc(sizeof(struct dirent));
memcpy(entcpy, ent, sizeof(struct dirent));
list_insert(ents_list, (void *)entcpy);
}
ent = readdir(dirp);
}
closedir(dirp);
foreach(entry, ents_list) {
print_entry(entry->value);
}
return 0;
}
/*
* vim: tabstop=4
* vim: shiftwidth=4
* vim: noexpandtab
*/
| 18.409938 | 64 | 0.569163 |
9a6b980bf3509c945022f0b8a101cd5b0a8b0eb6 | 1,423 | c | C | atm.c | ishanrajpal/Atm-matchine | 0716f01b99a7aa7942291eba5c2f70eb23e57a4b | [
"CC0-1.0"
] | null | null | null | atm.c | ishanrajpal/Atm-matchine | 0716f01b99a7aa7942291eba5c2f70eb23e57a4b | [
"CC0-1.0"
] | null | null | null | atm.c | ishanrajpal/Atm-matchine | 0716f01b99a7aa7942291eba5c2f70eb23e57a4b | [
"CC0-1.0"
] | null | null | null | //# Atm-matchine
Statement - ATM money dispatch count while currencies are 1000,500 and 100
***************************************************************************/
#include<stdio.h>
#include<conio.h>
int totalThousand =1000;
int totalFiveFundred =1000;
int totalOneHundred =1000;
void main(){
unsigned long withdrawAmount;
unsigned long totalMoney;
int thousand=0,fiveHundred=0,oneHundred=0;
clrscr();
printf("Enter the amount in multiple of 100: ");
scanf("%lu",&withdrawAmount);
if(withdrawAmount %100 != 0){
printf("Invalid amount;");
getch();
return;
}
totalMoney = totalThousand * 1000 + totalFiveFundred* 500 + totalOneHundred*100;
if(withdrawAmount > totalMoney){
printf("Sorry,Insufficient money");
getch();
return;
}
thousand = withdrawAmount / 1000;
if(thousand > totalThousand)
thousand = totalThousand;
withdrawAmount = withdrawAmount - thousand * 1000;
if (withdrawAmount > 0){
fiveHundred = withdrawAmount / 500;
if(fiveHundred > totalFiveFundred)
fiveHundred = totalFiveFundred;
withdrawAmount = withdrawAmount - fiveHundred * 500;
}
if (withdrawAmount > 0)
oneHundred = withdrawAmount / 100;
printf("Total 1000 note: %d\n",thousand);
printf("Total 500 note: %d\n",fiveHundred);
printf("Total 100 note: %d\n",oneHundred);
getch();
}
| 24.964912 | 85 | 0.623331 |
1925d8a80adfc31ebd340ab53f0e38fba572d283 | 1,154 | h | C | libs/ubuntu_arm/include/pointcloud-1.0.0/RegisterProgrammer.h | pointcloudAI/libDepthEye | d6a55be236d8b4a0451a7ec4cc3ef38a21fcbadc | [
"MIT"
] | 1 | 2022-03-26T09:52:03.000Z | 2022-03-26T09:52:03.000Z | libs/windows/include/pointcloud-1.0.0/RegisterProgrammer.h | pointcloudAI/libDepthEye | d6a55be236d8b4a0451a7ec4cc3ef38a21fcbadc | [
"MIT"
] | null | null | null | libs/windows/include/pointcloud-1.0.0/RegisterProgrammer.h | pointcloudAI/libDepthEye | d6a55be236d8b4a0451a7ec4cc3ef38a21fcbadc | [
"MIT"
] | null | null | null | /*
* PointCloud Lib component.
*
* Copyright (c) 2018 PointCloud.ai Inc.
*/
#ifndef POINTCLOUD_REGISTER_PROGRAMMER_H
#define POINTCLOUD_REGISTER_PROGRAMMER_H
#include "Common.h"
#include <stdint.h>
namespace PointCloud
{
/**
* \addtogroup IO
* @{
*/
class POINTCLOUD_EXPORT Parameter;
class POINTCLOUD_EXPORT RegisterProgrammer
{
public:
virtual bool isInitialized() const = 0;
// NOTE: Make these thread-safe when implementing
virtual bool setValue(const Parameter ¶m, uint32_t value, bool writeOnly = false) = 0;
virtual bool getValue(const Parameter ¶m, uint32_t &value) const = 0;
virtual bool readRegister(uint32_t address, uint32_t &value) const = 0;
virtual bool writeRegister(uint32_t address, uint32_t value) = 0;
//pointcloud.ai support 16bit register address
virtual bool readRegister(uint16_t slave_address,uint16_t register_address, uint32_t &value,uint8_t length) const = 0;
virtual bool writeRegister(uint16_t slave_address, uint16_t register_address, uint32_t &value,uint8_t length) = 0;
virtual bool reset() = 0;
virtual ~RegisterProgrammer() {}
};
/**
* @}
*/
}
#endif
| 22.627451 | 120 | 0.737435 |
cf8620b5a53e0cc7d0baa3d3ec175866898aa39f | 2,772 | h | C | src/World.h | apodrugin/Sourcehold | c18c134eda7a9cf8efe55d8f780439e1b2a4c9aa | [
"MIT"
] | null | null | null | src/World.h | apodrugin/Sourcehold | c18c134eda7a9cf8efe55d8f780439e1b2a4c9aa | [
"MIT"
] | null | null | null | src/World.h | apodrugin/Sourcehold | c18c134eda7a9cf8efe55d8f780439e1b2a4c9aa | [
"MIT"
] | null | null | null | #pragma once
#include <memory>
#include <entt/entt.hpp>
#include "GameMap.h"
#include "GameManager.h"
#include "GUI/UIState.h"
#include "GUI/Ingame.h"
#include "Parsers/Gm1File.h"
#include "Rendering/Texture.h"
#include "Rendering/Camera.h"
#include "Events/Event.h"
#include "Events/Keyboard.h"
#include "Events/Mouse.h"
#include "Events/Touch.h"
#include "ECS/System/RenderSystem.h"
#include "ECS/System/AnimationFrameSystem.h"
#include "ECS/System/TestTeleportingDeerSystem.h"
namespace Sourcehold {
namespace Parsers {
class TgxFile;
class Gm1File;
}
namespace Game {
struct Scroll {
bool shouldScroll = false;
bool setByKeyboard = false;
bool setByMouse = false;
explicit operator bool() {
return shouldScroll;
}
};
struct ScrollInformation {
Scroll up;
Scroll down;
Scroll right;
Scroll left;
};
using namespace GUI;
using namespace Parsers;
using namespace Events;
// Just testing. Nothing to see here, move along! //
class Unit {
public:
Unit(int x, int y, const char *f) : x(x), y(y) {
file = GetGm1(std::string("gm/") + f + std::string(".gm1"));
}
virtual void Update(double dt) {};
void Render() {
Camera& cam = Camera::instance();
int px = x * 30 - cam.positionX;
int py = y * 15 - cam.positionY;
SDL_Rect r = file->GetTextureAtlas()->Get(index);
Rendering::Render(*file->GetTextureAtlas(), px, py, &r);
}
int x, y;
protected:
int index=0;
std::shared_ptr<Gm1File> file;
};
/**
* Handles everything related to the game world, including
* loading, rendering and moving the camera
*/
class Building;
class Entity;
class World :
public GameMap,
private EventConsumer<Keyboard>,
private EventConsumer<Mouse>,
private EventConsumer<Touch>
{
ScrollInformation scroll;
IngameGUI gui;
std::vector<Unit*> units;
entt::registry registry;
public:
World();
World(const World&) = delete;
~World();
UIState Play();
protected:
void UpdateCamera(double dt);
private:
void onEventReceive(Keyboard& keyEvent) override;
void onEventReceive(Mouse& mouseEvent) override;
void onEventReceive(Touch& touchEvent) override;
};
}
}
| 25.431193 | 76 | 0.53824 |
65c9d6686f944dc35f25151549f296d510303b60 | 795 | h | C | arch/x64/sysroot/include/termios.h | FuchsiaOS/Fuchsia-SDK | 869668003f20d560a40802c7d820ef0fefba0462 | [
"BSD-3-Clause"
] | 49 | 2018-12-20T00:35:06.000Z | 2021-12-30T22:40:05.000Z | arch/x64/sysroot/include/termios.h | gxbllm/Fuchsia-SDK | 869668003f20d560a40802c7d820ef0fefba0462 | [
"BSD-3-Clause"
] | null | null | null | arch/x64/sysroot/include/termios.h | gxbllm/Fuchsia-SDK | 869668003f20d560a40802c7d820ef0fefba0462 | [
"BSD-3-Clause"
] | 21 | 2019-01-03T11:06:10.000Z | 2021-08-06T00:55:50.000Z | #pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_pid_t
#include <bits/alltypes.h>
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
#define NCCS 32
#include <bits/termios.h>
speed_t cfgetospeed(const struct termios*);
speed_t cfgetispeed(const struct termios*);
int cfsetospeed(struct termios*, speed_t);
int cfsetispeed(struct termios*, speed_t);
int tcgetattr(int, struct termios*);
int tcsetattr(int, int, const struct termios*);
int tcsendbreak(int, int);
int tcdrain(int);
int tcflush(int, int);
int tcflow(int, int);
pid_t tcgetsid(int);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
void cfmakeraw(struct termios*);
int cfsetspeed(struct termios*, speed_t);
#endif
#ifdef __cplusplus
}
#endif
| 18.068182 | 48 | 0.759748 |
65cc20c7e688ea9635e57773dbdd699df32f3e55 | 1,771 | h | C | onnxruntime/core/providers/cpu/tensor/reshape_helper.h | codemzs/onnxruntime | c69194ec4c8c9674368113aa6044d0db708cd813 | [
"MIT"
] | 4 | 2019-06-06T23:48:57.000Z | 2021-06-03T11:51:45.000Z | onnxruntime/core/providers/cpu/tensor/reshape_helper.h | Montaer/onnxruntime | 6dc25a60f8b058a556964801d99d5508641dcf69 | [
"MIT"
] | 10 | 2019-03-25T21:47:46.000Z | 2019-04-30T02:33:05.000Z | onnxruntime/core/providers/cpu/tensor/reshape_helper.h | Montaer/onnxruntime | 6dc25a60f8b058a556964801d99d5508641dcf69 | [
"MIT"
] | 3 | 2019-05-07T01:29:04.000Z | 2020-08-09T08:36:12.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "core/common/common.h"
#include "core/framework/tensor.h"
#include "gsl/gsl"
namespace onnxruntime {
// Verify and convert unknown dim during reshape
class ReshapeHelper {
public:
ReshapeHelper(const TensorShape& input_shape, std::vector<int64_t>& requested_shape) {
auto nDims = requested_shape.size();
ptrdiff_t unknown_dim = -1;
int64_t size = 1;
for (size_t i = 0; i < nDims; ++i) {
ORT_ENFORCE(requested_shape[i] >= -1, "A dimension cannot be less than -1.");
if (requested_shape[i] == -1) {
ORT_ENFORCE(unknown_dim == -1, "At most one dimension can be -1.");
unknown_dim = i;
} else {
if (requested_shape[i] == 0) {
ORT_ENFORCE(i < input_shape.NumDimensions(),
"The dimension with value zero exceeds"
" the dimension size of the input tensor.");
requested_shape[i] = input_shape[i];
}
size *= requested_shape[i];
}
}
if (unknown_dim != -1) {
// calculate unknown dimension
ORT_ENFORCE((input_shape.Size() % size) == 0,
"The input tensor cannot be reshaped to the requested shape. Input shape:", input_shape, ", requested shape:", TensorShape(requested_shape));
requested_shape[unknown_dim] = input_shape.Size() / size;
} else {
// check if the output shape is valid.
ORT_ENFORCE(gsl::narrow_cast<int64_t>(input_shape.Size()) == size,
"The input tensor cannot be reshaped to the requested shape. Input shape:", input_shape, ", requested shape:", TensorShape(requested_shape));
}
}
};
} //namespace onnxruntime
| 36.142857 | 159 | 0.63354 |
d0339f4f94c97f8e9ea55f11ff6dcf637fba1222 | 6,382 | h | C | Source/ScillSDK/Public/ScillApiWrapper/ScillApiBattlePassesApi.h | SFuhrmann/scill-unreal | 9bb2b173711aaaeb17341e4cfd6e1596a7ee832c | [
"MIT"
] | 2 | 2021-06-14T20:19:18.000Z | 2021-08-06T14:44:32.000Z | Source/ScillSDK/Public/ScillApiWrapper/ScillApiBattlePassesApi.h | scillgame/scill-unreal | 9773ad28f13fdd79f8ba6a7a9117c5ee221c0231 | [
"MIT"
] | null | null | null | Source/ScillSDK/Public/ScillApiWrapper/ScillApiBattlePassesApi.h | scillgame/scill-unreal | 9773ad28f13fdd79f8ba6a7a9117c5ee221c0231 | [
"MIT"
] | 2 | 2021-02-23T07:45:42.000Z | 2022-01-29T20:32:12.000Z | /**
* SCILL API
* SCILL gives you the tools to activate, retain and grow your user base in your app or game by bringing you features well known in the gaming industry: Gamification. We take care of the services and technology involved so you can focus on your game and content.
*
* OpenAPI spec version: 1.0.0
* Contact: support@scillgame.com
*
* NOTE: This class is auto generated by OpenAPI Generator
* https://github.com/OpenAPITools/openapi-generator
* Do not edit the class manually.
*/
#pragma once
#include "CoreMinimal.h"
#include "ScillApiWrapper/ScillApiBaseModel.h"
namespace ScillSDK
{
class SCILLSDK_API ScillApiBattlePassesApi
{
public:
ScillApiBattlePassesApi();
~ScillApiBattlePassesApi();
/* Sets the URL Endpoint.
* Note: several fallback endpoints can be configured in request retry policies, see Request::SetShouldRetry */
void SetURL(const FString& Url);
/* Adds global header params to all requests */
void AddHeaderParam(const FString& Key, const FString& Value);
void ClearHeaderParams();
/* Sets the retry manager to the user-defined retry manager. User must manage the lifetime of the retry manager.
* If no retry manager is specified and a request needs retries, a default retry manager will be used.
* See also: Request::SetShouldRetry */
void SetHttpRetryManager(FHttpRetrySystem::FManager& RetryManager);
FHttpRetrySystem::FManager& GetHttpRetryManager();
class ActivateBattlePassLevelRequest;
class ActivateBattlePassLevelResponse;
class ClaimBattlePassLevelRewardRequest;
class ClaimBattlePassLevelRewardResponse;
class GetActiveBattlePassesRequest;
class GetActiveBattlePassesResponse;
class GetAllBattlePassLevelsRequest;
class GetAllBattlePassLevelsResponse;
class GetBattlePassRequest;
class GetBattlePassResponse;
class GetBattlePassLevelsRequest;
class GetBattlePassLevelsResponse;
class GetBattlePassesRequest;
class GetBattlePassesResponse;
class GetUnlockedBattlePassesRequest;
class GetUnlockedBattlePassesResponse;
class UnlockBattlePassRequest;
class UnlockBattlePassResponse;
DECLARE_DELEGATE_OneParam(FActivateBattlePassLevelDelegate, const ActivateBattlePassLevelResponse&);
DECLARE_DELEGATE_OneParam(FClaimBattlePassLevelRewardDelegate, const ClaimBattlePassLevelRewardResponse&);
DECLARE_DELEGATE_OneParam(FGetActiveBattlePassesDelegate, const GetActiveBattlePassesResponse&);
DECLARE_DELEGATE_OneParam(FGetAllBattlePassLevelsDelegate, const GetAllBattlePassLevelsResponse&);
DECLARE_DELEGATE_OneParam(FGetBattlePassDelegate, const GetBattlePassResponse&);
DECLARE_DELEGATE_OneParam(FGetBattlePassLevelsDelegate, const GetBattlePassLevelsResponse&);
DECLARE_DELEGATE_OneParam(FGetBattlePassesDelegate, const GetBattlePassesResponse&);
DECLARE_DELEGATE_OneParam(FGetUnlockedBattlePassesDelegate, const GetUnlockedBattlePassesResponse&);
DECLARE_DELEGATE_OneParam(FUnlockBattlePassDelegate, const UnlockBattlePassResponse&);
FHttpRequestPtr ActivateBattlePassLevel(const ActivateBattlePassLevelRequest& Request, const FActivateBattlePassLevelDelegate& Delegate = FActivateBattlePassLevelDelegate()) const;
FHttpRequestPtr ClaimBattlePassLevelReward(const ClaimBattlePassLevelRewardRequest& Request, const FClaimBattlePassLevelRewardDelegate& Delegate = FClaimBattlePassLevelRewardDelegate()) const;
FHttpRequestPtr GetActiveBattlePasses(const GetActiveBattlePassesRequest& Request, const FGetActiveBattlePassesDelegate& Delegate = FGetActiveBattlePassesDelegate()) const;
FHttpRequestPtr GetAllBattlePassLevels(const GetAllBattlePassLevelsRequest& Request, const FGetAllBattlePassLevelsDelegate& Delegate = FGetAllBattlePassLevelsDelegate()) const;
FHttpRequestPtr GetBattlePass(const GetBattlePassRequest& Request, const FGetBattlePassDelegate& Delegate = FGetBattlePassDelegate()) const;
FHttpRequestPtr GetBattlePassLevels(const GetBattlePassLevelsRequest& Request, const FGetBattlePassLevelsDelegate& Delegate = FGetBattlePassLevelsDelegate()) const;
FHttpRequestPtr GetBattlePasses(const GetBattlePassesRequest& Request, const FGetBattlePassesDelegate& Delegate = FGetBattlePassesDelegate()) const;
FHttpRequestPtr GetUnlockedBattlePasses(const GetUnlockedBattlePassesRequest& Request, const FGetUnlockedBattlePassesDelegate& Delegate = FGetUnlockedBattlePassesDelegate()) const;
FHttpRequestPtr UnlockBattlePass(const UnlockBattlePassRequest& Request, const FUnlockBattlePassDelegate& Delegate = FUnlockBattlePassDelegate()) const;
private:
void OnActivateBattlePassLevelResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FActivateBattlePassLevelDelegate Delegate) const;
void OnClaimBattlePassLevelRewardResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FClaimBattlePassLevelRewardDelegate Delegate) const;
void OnGetActiveBattlePassesResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetActiveBattlePassesDelegate Delegate) const;
void OnGetAllBattlePassLevelsResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetAllBattlePassLevelsDelegate Delegate) const;
void OnGetBattlePassResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetBattlePassDelegate Delegate) const;
void OnGetBattlePassLevelsResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetBattlePassLevelsDelegate Delegate) const;
void OnGetBattlePassesResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetBattlePassesDelegate Delegate) const;
void OnGetUnlockedBattlePassesResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FGetUnlockedBattlePassesDelegate Delegate) const;
void OnUnlockBattlePassResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FUnlockBattlePassDelegate Delegate) const;
FHttpRequestRef CreateHttpRequest(const Request& Request) const;
bool IsValid() const;
void HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceeded, Response& InOutResponse) const;
FString Url;
TMap<FString,FString> AdditionalHeaderParams;
mutable FHttpRetrySystem::FManager* RetryManager = nullptr;
mutable TUniquePtr<HttpRetryManager> DefaultRetryManager;
};
}
| 62.568627 | 262 | 0.8466 |
fdc38c699df46b40c6e21b6f5d92fcbd4f6adbd6 | 11,310 | h | C | Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/animation/Animator.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/animation/Animator.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/animation/Animator.h | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | //=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=========================================================================
#ifndef __ELASTOS_DROID_ANIMATION_ANIMATOR_H__
#define __ELASTOS_DROID_ANIMATION_ANIMATOR_H__
#include "Elastos.Droid.Animation.h"
#include "elastos/droid/ext/frameworkext.h"
#include <elastos/utility/etl/List.h>
#include <elastos/core/Object.h>
using Elastos::Core::ICloneable;
using Elastos::Utility::IArrayList;
using Elastos::Utility::Etl::List;
namespace Elastos {
namespace Droid {
namespace Animation {
class AnimatorSet;
/**
* This is the superclass for classes which provide basic support for animations which can be
* started, ended, and have <code>AnimatorListeners</code> added to them.
*/
class ECO_PUBLIC Animator
: public Object
, public ICloneable
, public IAnimator
{
public:
CAR_INTERFACE_DECL()
Animator();
virtual ~Animator();
/**
* Starts this animation. If the animation has a nonzero startDelay, the animation will start
* running after that delay elapses. A non-delayed animation will have its initial
* value(s) set immediately, followed by calls to
* {@link AnimatorListener#onAnimationStart(Animator)} for any listeners of this animator.
*
* <p>The animation started by calling this method will be run on the thread that called
* this method. This thread should have a Looper on it (a runtime exception will be thrown if
* this is not the case). Also, if the animation will animate
* properties of objects in the view hierarchy, then the calling thread should be the UI
* thread for that view hierarchy.</p>
*
*/
virtual CARAPI Start();
/**
* Cancels the animation. Unlike {@link #end()}, <code>cancel()</code> causes the animation to
* stop in its tracks, sending an
* {@link android.animation.Animator.AnimatorListener#onAnimationCancel(Animator)} to
* its listeners, followed by an
* {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} message.
*
* <p>This method must be called on the thread that is running the animation.</p>
*/
virtual CARAPI Cancel();
/**
* Ends the animation. This causes the animation to assign the end value of the property being
* animated, then calling the
* {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} method on
* its listeners.
*
* <p>This method must be called on the thread that is running the animation.</p>
*/
virtual CARAPI End();
/**
* Pauses a running animation. This method should only be called on the same thread on
* which the animation was started. If the animation has not yet been {@link
* #isStarted() started} or has since ended, then the call is ignored. Paused
* animations can be resumed by calling {@link #resume()}.
*
* @see #resume()
* @see #isPaused()
* @see AnimatorPauseListener
*/
virtual CARAPI Pause();
/**
* Resumes a paused animation, causing the animator to pick up where it left off
* when it was paused. This method should only be called on the same thread on
* which the animation was started. Calls to resume() on an animator that is
* not currently paused will be ignored.
*
* @see #pause()
* @see #isPaused()
* @see AnimatorPauseListener
*/
virtual CARAPI Resume();
/**
* Returns whether this animator is currently in a paused state.
*
* @return True if the animator is currently paused, false otherwise.
*
* @see #pause()
* @see #resume()
*/
virtual CARAPI IsPaused(
/* [out] */ Boolean* paused);
/**
* The amount of time, in milliseconds, to delay starting the animation after
* {@link #start()} is called.
*
* @return the number of milliseconds to delay running the animation
*/
using IAnimator::GetStartDelay;
/**
* The amount of time, in milliseconds, to delay starting the animation after
* {@link #start()} is called.
* @param startDelay The amount of the delay, in milliseconds
*/
using IAnimator::SetStartDelay;
/**
* Sets the length of the animation.
*
* @param duration The length of the animation, in milliseconds.
*/
using IAnimator::SetDuration;
/**
* Gets the length of the animation.
*
* @return The length of the animation, in milliseconds.
*/
using IAnimator::GetDuration;
/**
* The time interpolator used in calculating the elapsed fraction of this animation. The
* interpolator determines whether the animation runs with linear or non-linear motion,
* such as acceleration and deceleration. The default value is
* {@link android.view.animation.AccelerateDecelerateInterpolator}
*
* @param value the interpolator to be used by this animation
*/
using IAnimator::SetInterpolator;
virtual CARAPI GetInterpolator(
/* [out] */ ITimeInterpolator** interpolator);
/**
* Returns whether this Animator is currently running (having been started and gone past any
* initial startDelay period and not yet ended).
*
* @return Whether the Animator is running.
*/
using IAnimator::IsRunning;
/**
* Returns whether this Animator has been started and not yet ended. This state is a superset
* of the state of {@link #isRunning()}, because an Animator with a nonzero
* {@link #getStartDelay() startDelay} will return true for {@link #isStarted()} during the
* delay phase, whereas {@link #isRunning()} will return true only after the delay phase
* is complete.
*
* @return Whether the Animator has been started and not yet ended.
*/
virtual CARAPI IsStarted(
/* [out] */ Boolean* started);
/**
* Adds a listener to the set of listeners that are sent events through the life of an
* animation, such as start, repeat, and end.
*
* @param listener the listener to be added to the current set of listeners for this animation.
*/
virtual CARAPI AddListener(
/* [in] */ IAnimatorListener* listener);
/**
* Removes a listener from the set listening to this animation.
*
* @param listener the listener to be removed from the current set of listeners for this
* animation.
*/
virtual CARAPI RemoveListener(
/* [in] */ IAnimatorListener* listener);
/**
* Gets the set of {@link android.animation.Animator.AnimatorListener} objects that are currently
* listening for events on this <code>Animator</code> object.
*
* @return ArrayList<AnimatorListener> The set of listeners.
*/
virtual CARAPI GetListeners(
/* [out] */ IArrayList** listeners);
/**
* Adds a pause listener to this animator.
*
* @param listener the listener to be added to the current set of pause listeners
* for this animation.
*/
virtual CARAPI AddPauseListener(
/* [in] */ IAnimatorPauseListener* listener);
/**
* Removes a pause listener from the set listening to this animation.
*
* @param listener the listener to be removed from the current set of pause
* listeners for this animation.
*/
virtual CARAPI RemovePauseListener(
/* [in] */ IAnimatorPauseListener* listener);
/**
* Removes all {@link #addListener(android.animation.Animator.AnimatorListener) listeners}
* and {@link #addPauseListener(android.animation.Animator.AnimatorPauseListener)
* pauseListeners} from this object.
*/
virtual CARAPI RemoveAllListeners();
/**
* This method tells the object to use appropriate information to extract
* starting values for the animation. For example, a AnimatorSet object will pass
* this call to its child objects to tell them to set up the values. A
* ObjectAnimator object will use the information it has about its target object
* and PropertyValuesHolder objects to get the start values for its properties.
* A ValueAnimator object will ignore the request since it does not have enough
* information (such as a target object) to gather these values.
*/
virtual CARAPI SetupStartValues();
/**
* This method tells the object to use appropriate information to extract
* ending values for the animation. For example, a AnimatorSet object will pass
* this call to its child objects to tell them to set up the values. A
* ObjectAnimator object will use the information it has about its target object
* and PropertyValuesHolder objects to get the start values for its properties.
* A ValueAnimator object will ignore the request since it does not have enough
* information (such as a target object) to gather these values.
*/
virtual CARAPI SetupEndValues();
/**
* Sets the target object whose property will be animated by this animation. Not all subclasses
* operate on target objects (for example, {@link ValueAnimator}, but this method
* is on the superclass for the convenience of dealing generically with those subclasses
* that do handle targets.
*
* @param target The object being animated
*/
virtual CARAPI SetTarget(
/* [in] */ IInterface* target);
// Hide reverse() and canReverse() for now since reverse() only work for simple
// cases, like we don't support sequential, neither startDelay.
// TODO: make reverse() works for all the Animators.
/**
* @hide
*/
virtual CARAPI CanReverse(
/* [out] */ Boolean* can);
/**
* @hide
*/
virtual CARAPI Reverse();
virtual CARAPI SetAllowRunningAsynchronously(
/* [in] */ Boolean mayRunAsync);
CARAPI SetParent(
/* [in] */ IAnimatorSet* parent);
CARAPI ReleaseParent();
protected:
CARAPI CloneImpl(
/* [in] */ IAnimator* anim);
protected:
/**
* The set of listeners to be sent events through the life of an animation.
*/
AutoPtr<IArrayList> mListeners;
/**
* The set of listeners to be sent pause/resume events through the life
* of an animation.
*/
AutoPtr<IArrayList> mPauseListeners;
/**
* Whether this animator is currently in a paused state.
*/
Boolean mPaused;
friend class AnimatorSet;
private:
IAnimatorSet* mParent;
Int32 mParentRefCount;
};
} //namespace Animation
} //namespace Droid
} //namespace Elastos
#endif // __ELASTOS_DROID_ANIMATION_ANIMATOR_H__
| 34.907407 | 101 | 0.665517 |
aa2751398b784af1db6c4ffaf0952f38a2297664 | 429 | h | C | usr/libexec/corespeechd/CSDarkWakePowerAssertionMac.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | 2 | 2021-04-15T10:50:21.000Z | 2021-08-19T19:00:09.000Z | usr/sbin/usr/libexec/corespeechd/CSDarkWakePowerAssertionMac.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | null | null | null | usr/sbin/usr/libexec/corespeechd/CSDarkWakePowerAssertionMac.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | null | null | null | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@interface CSDarkWakePowerAssertionMac : NSObject
{
}
- (void)invalidate; // IMP=0x0000000100085818
- (id)init; // IMP=0x0000000100085800
- (id)initWithDescription:(id)arg1 timeout:(double)arg2; // IMP=0x00000001000857e8
@end
| 22.578947 | 120 | 0.72028 |
aa511be5bb8d9e7122afd4171f56355fa4022050 | 429 | c | C | Dataset/Leetcode/valid/88/289.c | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/valid/88/289.c | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/valid/88/289.c | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | void XXX(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n){
if (n == 0) {
return;
}
int len = nums1Size;
while (n > 0) {
if (m == 0 || *(nums2 + n - 1) >= *(nums1 + m - 1)) {
*(nums1 + len - 1) = *(nums2 + n - 1);
n--;
} else {
*(nums1 + len - 1) = *(nums1 + m - 1);
m = m > 0 ? --m : 0;
}
len--;
}
}
| 23.833333 | 78 | 0.34965 |
802341a383e77c3034e5f60de4f03a67f9d0f349 | 1,779 | h | C | src/chainparamsseeds.h | Crave-Project/Crave-NG | b3ef37b9bc492d2cccda3afe4c9b962056c3765a | [
"MIT"
] | 15 | 2018-04-14T22:28:48.000Z | 2022-03-05T01:53:46.000Z | src/chainparamsseeds.h | Ampakinetic/Crave-Project | f0879e4b6d3d75fdf62f901bafa2c80637b328f3 | [
"MIT"
] | 8 | 2018-03-02T09:28:20.000Z | 2021-06-10T20:32:18.000Z | src/chainparamsseeds.h | Crave-Project/Crave-NG | b3ef37b9bc492d2cccda3afe4c9b962056c3765a | [
"MIT"
] | 16 | 2018-02-27T19:55:47.000Z | 2020-02-14T17:41:21.000Z | #ifndef BITCOIN_CHAINPARAMSSEEDS_H
#define BITCOIN_CHAINPARAMSSEEDS_H
/**
* List of fixed seed nodes for the bitcoin network
* AUTOGENERATED by contrib/seeds/generate-seeds.py
*
* Each line contains a 16-byte IPv6 address and a port.
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd4,0x18,0x6d,0x52}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x67,0xfd,0xc2,0xdc}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd9,0x55,0xaa}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6d,0x6f,0x08,0x62}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x33,0x4b,0x45,0x72}, 48881},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8c,0x52,0x27,0xc0}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcb,0x9f,0x5d,0x33}, 48898},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4e,0x72,0x46,0xdc}, 9999},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x42,0x37,0x4e,0x39}, 48882},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4a,0xde,0x05,0xbc}, 9999},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0x0f,0xdc,0x99}, 48883},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb0,0x1f,0xa2,0x8f}, 48880},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x53,0x4d,0xbe,0x56}, 5555}
};
static SeedSpec6 pnSeed6_test[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x59,0xde,0xe9,0xde}, 48884}
};
#endif // BITCOIN_CHAINPARAMSSEEDS_H
| 59.3 | 95 | 0.73131 |
b7a35b7cbf0dd4e8bb2bfe5f214d93f7ca9be3c9 | 3,969 | h | C | src/vendor/mariadb-10.6.7/sql/threadpool_generic.h | zettadb/zettalib | 3d5f96dc9e3e4aa255f4e6105489758944d37cc4 | [
"Apache-2.0"
] | null | null | null | src/vendor/mariadb-10.6.7/sql/threadpool_generic.h | zettadb/zettalib | 3d5f96dc9e3e4aa255f4e6105489758944d37cc4 | [
"Apache-2.0"
] | null | null | null | src/vendor/mariadb-10.6.7/sql/threadpool_generic.h | zettadb/zettalib | 3d5f96dc9e3e4aa255f4e6105489758944d37cc4 | [
"Apache-2.0"
] | 2 | 2022-02-27T14:00:01.000Z | 2022-03-31T06:24:22.000Z | /* Copyright(C) 2019, 2020, MariaDB
*
* This program is free software; you can redistribute itand /or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
#if defined (HAVE_POOL_OF_THREADS)
#include <my_global.h>
#include <sql_plist.h>
#include <my_pthread.h>
#include <mysqld.h>
#include <threadpool.h>
#include <violite.h>
#ifdef _WIN32
#include <windows.h>
#include "threadpool_winsockets.h"
/* AIX may define this, too ?*/
#define HAVE_IOCP
#endif
#ifdef _WIN32
typedef HANDLE TP_file_handle;
#else
typedef int TP_file_handle;
#define INVALID_HANDLE_VALUE -1
#endif
#ifdef __linux__
#include <sys/epoll.h>
typedef struct epoll_event native_event;
#elif defined(HAVE_KQUEUE)
#include <sys/event.h>
typedef struct kevent native_event;
#elif defined (__sun)
#include <port.h>
typedef port_event_t native_event;
#elif defined (HAVE_IOCP)
typedef OVERLAPPED_ENTRY native_event;
#else
#error threadpool is not available on this platform
#endif
struct thread_group_t;
/* Per-thread structure for workers */
struct worker_thread_t
{
ulonglong event_count; /* number of request handled by this thread */
thread_group_t* thread_group;
worker_thread_t* next_in_list;
worker_thread_t** prev_in_list;
mysql_cond_t cond;
bool woken;
};
typedef I_P_List<worker_thread_t, I_P_List_adapter<worker_thread_t,
& worker_thread_t::next_in_list,
& worker_thread_t::prev_in_list>,
I_P_List_counter
>
worker_list_t;
struct TP_connection_generic :public TP_connection
{
TP_connection_generic(CONNECT* c);
~TP_connection_generic();
int init() override { return 0; }
void set_io_timeout(int sec) override;
int start_io() override;
void wait_begin(int type) override;
void wait_end() override;
thread_group_t* thread_group;
TP_connection_generic* next_in_queue;
TP_connection_generic** prev_in_queue;
ulonglong abs_wait_timeout;
ulonglong enqueue_time;
TP_file_handle fd;
bool bound_to_poll_descriptor;
int waiting;
bool fix_group;
#ifdef _WIN32
win_aiosocket win_sock{};
void init_vio(st_vio *vio) override
{ win_sock.init(vio);}
#endif
};
typedef I_P_List<TP_connection_generic,
I_P_List_adapter<TP_connection_generic,
& TP_connection_generic::next_in_queue,
& TP_connection_generic::prev_in_queue>,
I_P_List_counter,
I_P_List_fast_push_back<TP_connection_generic> >
connection_queue_t;
const int NQUEUES = 2; /* We have high and low priority queues*/
enum class operation_origin
{
WORKER,
LISTENER
};
struct thread_group_counters_t
{
ulonglong thread_creations;
ulonglong thread_creations_due_to_stall;
ulonglong wakes;
ulonglong wakes_due_to_stall;
ulonglong throttles;
ulonglong stalls;
ulonglong dequeues[2];
ulonglong polls[2];
};
struct thread_group_t
{
mysql_mutex_t mutex;
connection_queue_t queues[NQUEUES];
worker_list_t waiting_threads;
worker_thread_t* listener;
pthread_attr_t* pthread_attr;
TP_file_handle pollfd;
int thread_count;
int active_thread_count;
int connection_count;
/* Stats for the deadlock detection timer routine.*/
int io_event_count;
int queue_event_count;
ulonglong last_thread_creation_time;
int shutdown_pipe[2];
bool shutdown;
bool stalled;
thread_group_counters_t counters;
char pad[CPU_LEVEL1_DCACHE_LINESIZE];
};
#define TP_INCREMENT_GROUP_COUNTER(group,var) do {group->counters.var++;}while(0)
extern thread_group_t* all_groups;
#endif
| 25.120253 | 83 | 0.773747 |
c8a6f081ab106bec0ce4ece0101740f0d650ee14 | 1,118 | c | C | lib/linux/sbrk.c | christianb93/ctOS | 644d92636b4fa2d9d355ce20c59cd567a5579ae4 | [
"MIT"
] | 19 | 2018-08-13T18:35:53.000Z | 2022-01-19T10:21:50.000Z | lib/linux/sbrk.c | christianb93/ctOS | 644d92636b4fa2d9d355ce20c59cd567a5579ae4 | [
"MIT"
] | 4 | 2018-05-07T20:57:15.000Z | 2018-06-16T18:37:50.000Z | lib/linux/sbrk.c | christianb93/ctOS | 644d92636b4fa2d9d355ce20c59cd567a5579ae4 | [
"MIT"
] | 5 | 2020-03-15T20:37:47.000Z | 2022-02-25T13:35:54.000Z | /*
* sbrk.c
*
*/
#include "lib/os/oscalls.h"
#define __NR_brk 45
#define _syscall1(name,a) \
{ \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "a" (__NR_##name),"b" (a)); \
}
/*
* Here we save the initial program break
*/
static unsigned int current_brk = 0;
/*
* This is set by the linker
*/
extern unsigned int _end;
/*
* Note that the brk system call in Linux returns the new system break
*/
unsigned int __ctOS_sbrk(unsigned int size) {
unsigned int new_brk;
unsigned int __res;
/*
* If this is the first call, set initial break
* from linker symbol _end
*/
if (0==current_brk) {
current_brk = ((unsigned int) &_end);
if (current_brk % 4096)
current_brk = (current_brk / 4096)*4096 + 4096;
_syscall1(brk, current_brk);
current_brk = __res;
}
if (0==size)
return current_brk;
new_brk = current_brk + size;
if (new_brk % 4096)
new_brk = (new_brk / 4096)*4096+4096;
_syscall1(brk, new_brk);
if (__res>current_brk)
return __res;
else
return 0;
}
| 19.964286 | 70 | 0.588551 |
74032970650cf3b42ecd1293676d2e41f72e208e | 823 | c | C | ProjetSMART.X/interupt.c | AymericMa/Projet-smart | 76ac059116e123ca03e46374e66ae4309d60fe86 | [
"BSD-2-Clause"
] | null | null | null | ProjetSMART.X/interupt.c | AymericMa/Projet-smart | 76ac059116e123ca03e46374e66ae4309d60fe86 | [
"BSD-2-Clause"
] | null | null | null | ProjetSMART.X/interupt.c | AymericMa/Projet-smart | 76ac059116e123ca03e46374e66ae4309d60fe86 | [
"BSD-2-Clause"
] | null | null | null |
#include <pic16f18325.h>
#include "interupt.h"
#include "app.h"
extern bool FlaginterruptRx;
extern buffer monBuffer ;
unsigned char RX_byte ;
inline void EnableGlobalinterupts(void)
{
INTCONbits.GIE = 1 ;
}
inline void DisableGlobalinterupts(void)
{
INTCONbits.GIE = 0 ;
}
inline void EnablePeripheralInterupts(void)
{
INTCONbits.PEIE = 1 ;
}
inline void DisablePeripheralInterupts(void)
{
INTCONbits.PEIE = 0 ;
}
inline void EnableRXInterupts(void)
{
PIE1bits.RCIE = 1 ;
}
inline void DisableRXInterupts(void)
{
PIE1bits.RCIE = 0 ;
}
void __interrupt() interupt1(void)
{
//UART1_SendStr("coucou prout!!!\n");
if(PIR1bits.RCIF) // si ils'agit d'une interuption RX
{
FlaginterruptRx = 1;
RX_byte = EUSART_Read();
}
//autres interuptions ici !
} | 16.46 | 57 | 0.675577 |
bdc232afe733606bf757c37339e7f43b9e79520b | 1,393 | h | C | System/Library/PrivateFrameworks/StoreKitUI.framework/SKUIMediaSocialAdminPermissionsCoordinator.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 12 | 2019-06-02T02:42:41.000Z | 2021-04-13T07:22:20.000Z | System/Library/PrivateFrameworks/StoreKitUI.framework/SKUIMediaSocialAdminPermissionsCoordinator.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/StoreKitUI.framework/SKUIMediaSocialAdminPermissionsCoordinator.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 3 | 2019-06-11T02:46:10.000Z | 2019-12-21T14:58:16.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:47:16 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/StoreKitUI.framework/StoreKitUI
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol OS_dispatch_queue;
@class NSObject, NSArray, NSDate, NSMutableArray, NSNumber;
@interface SKUIMediaSocialAdminPermissionsCoordinator : NSObject {
NSObject*<OS_dispatch_queue> _callbackQueue;
NSObject*<OS_dispatch_queue> _dispatchQueue;
NSArray* _lastKnownAuthors;
NSDate* _lastRequestDate;
NSMutableArray* _resultBlocks;
}
@property (copy,readonly) NSNumber * lastKnownAdminStatus;
@property (copy,readonly) NSArray * lastKnownAuthors;
+(id)sharedCoordinator;
-(NSNumber *)lastKnownAdminStatus;
-(void)getAdminStatusWithOptions:(id)arg1 resultBlock:(/*^block*/id)arg2 ;
-(NSArray *)lastKnownAuthors;
-(void)getAuthorsWithOptions:(id)arg1 authorsBlock:(/*^block*/id)arg2 ;
-(void)getAuthorsAndWaitWithOptions:(id)arg1 authorsBlock:(/*^block*/id)arg2 ;
-(void)_authenticateOnCompletion:(/*^block*/id)arg1 ;
-(void)_queueResultBlock:(/*^block*/id)arg1 ;
-(void)_getAuthors;
-(void)_handleOperationResponseWithAuthors:(id)arg1 error:(id)arg2 ;
-(void)_fireResultsBlocksWithAuthors:(id)arg1 error:(id)arg2 ;
-(id)init;
-(void)reset;
@end
| 34.825 | 81 | 0.779612 |
8360fd5768b2ef586142ff41e46b90669288bfaa | 6,010 | h | C | real/overdrive/resistance/sdk/modelinfo.h | DankPaster/OverdriveCheat | d9aabc75382d02a7c8429f0cdf20f82c3e157d0a | [
"MIT"
] | 5 | 2018-01-24T00:50:50.000Z | 2020-11-02T00:16:40.000Z | old/resistance/sdk/modelinfo.h | DankPaster/OverdriveCheat | d9aabc75382d02a7c8429f0cdf20f82c3e157d0a | [
"MIT"
] | 1 | 2018-01-23T23:11:11.000Z | 2018-01-23T23:11:11.000Z | real/overdrive/resistance/sdk/modelinfo.h | DankPaster/OverdriveCheat | d9aabc75382d02a7c8429f0cdf20f82c3e157d0a | [
"MIT"
] | 4 | 2018-01-24T00:50:51.000Z | 2019-11-13T15:21:02.000Z | #pragma once
#define MAX_QPATH 260
#define BONE_CALCULATE_MASK 0x1F
#define BONE_PHYSICALLY_SIMULATED 0x01 // bone is physically simulated when physics are active
#define BONE_PHYSICS_PROCEDURAL 0x02 // procedural when physics is active
#define BONE_ALWAYS_PROCEDURAL 0x04 // bone is always procedurally animated
#define BONE_SCREEN_ALIGN_SPHERE 0x08 // bone aligns to the screen, not constrained in motion.
#define BONE_SCREEN_ALIGN_CYLINDER 0x10 // bone aligns to the screen, constrained by it's own axis.
#define BONE_USED_MASK 0x0007FF00
#define BONE_USED_BY_ANYTHING 0x0007FF00
#define BONE_USED_BY_HITBOX 0x00000100 // bone (or child) is used by a hit box
#define BONE_USED_BY_ATTACHMENT 0x00000200 // bone (or child) is used by an attachment point
#define BONE_USED_BY_VERTEX_MASK 0x0003FC00
#define BONE_USED_BY_VERTEX_LOD0 0x00000400 // bone (or child) is used by the toplevel model via skinned vertex
#define BONE_USED_BY_VERTEX_LOD1 0x00000800
#define BONE_USED_BY_VERTEX_LOD2 0x00001000
#define BONE_USED_BY_VERTEX_LOD3 0x00002000
#define BONE_USED_BY_VERTEX_LOD4 0x00004000
#define BONE_USED_BY_VERTEX_LOD5 0x00008000
#define BONE_USED_BY_VERTEX_LOD6 0x00010000
#define BONE_USED_BY_VERTEX_LOD7 0x00020000
#define BONE_USED_BY_BONE_MERGE 0x00040000 // bone is available for bone merge to occur against it
#define BONE_USED_BY_VERTEX_AT_LOD(lod) ( BONE_USED_BY_VERTEX_LOD0 << (lod) )
#define BONE_USED_BY_ANYTHING_AT_LOD(lod) ( ( BONE_USED_BY_ANYTHING & ~BONE_USED_BY_VERTEX_MASK ) | BONE_USED_BY_VERTEX_AT_LOD(lod) )
#define MAX_NUM_LODS 8
#define MAXSTUDIOBONES 128 // total bones actually used
#define BONE_TYPE_MASK 0x00F00000
#define BONE_FIXED_ALIGNMENT 0x00100000 // bone can't spin 360 degrees, all interpolation is normalized around a fixed orientation
#define BONE_HAS_SAVEFRAME_POS 0x00200000 // Vector48
#define BONE_HAS_SAVEFRAME_ROT64 0x00400000 // Quaternion64
#define BONE_HAS_SAVEFRAME_ROT32 0x00800000 // Quaternion32
struct mstudiobbox_t
{
int bone;
int group; // intersection group
Vector bbmin; // bounding box
Vector bbmax;
int szhitboxnameindex; // offset to the name of the hitbox.
int unused[8];
const char* pszHitboxName()
{
if (szhitboxnameindex == 0)
return "";
return ((char*)this) + szhitboxnameindex;
}
mstudiobbox_t() {}
private:
mstudiobbox_t(const mstudiobbox_t& vOther);
};
struct mstudiobone_t
{
int sznameindex;
inline char * const pszName(void) const { return ((char *)this) + sznameindex; }
int parent; // parent bone
int bonecontroller[6]; // bone controller index, -1 == none
// default values
Vector pos;
Quaternion quat;
Vector rot;
// compression scale
Vector posscale;
Vector rotscale;
VMatrix poseToBone;
Quaternion qAlignment;
int flags;
int proctype;
int procindex; // procedural rule
mutable int physicsbone; // index into physically simulated bone
inline void *pProcedure() const { if (procindex == 0) return NULL; else return (void *)(((byte *)this) + procindex); };
int surfacepropidx; // index into string tablefor property name
inline char * const pszSurfaceProp(void) const { return ((char *)this) + surfacepropidx; }
int contents; // See BSPFlags.h for the contents flags
int unused[8]; // remove as appropriate
mstudiobone_t(){}
private:
// No copy constructors allowed
mstudiobone_t(const mstudiobone_t& vOther);
};
struct mstudiohitboxset_t
{
int sznameindex;
inline char * const pszName(void) const { return ((char *)this) + sznameindex; }
int numhitboxes;
int hitboxindex;
inline mstudiobbox_t *pHitbox(int i) const { return (mstudiobbox_t *)(((byte *)this) + hitboxindex) + i; };
};
struct studiohdr_t
{
int id;
int version;
long checksum; // this has to be the same in the phy and vtx files to load!
inline const char * pszName(void) const { return name; }
char name[64];
int length;
Vector eyeposition; // ideal eye position
Vector illumposition; // illumination center
Vector hull_min; // ideal movement hull size
Vector hull_max;
Vector view_bbmin; // clipping bounding box
Vector view_bbmax;
int flags;
int numbones; // bones
int boneindex;
inline mstudiobone_t *pBone(int i) const { return (mstudiobone_t *)(((byte *)this) + boneindex) + i; };
int RemapSeqBone(int iSequence, int iLocalBone) const; // maps local sequence bone to global bone
int RemapAnimBone(int iAnim, int iLocalBone) const; // maps local animations bone to global bone
int numbonecontrollers; // bone controllers
int bonecontrollerindex;
inline void *pBonecontroller(int i) const { return (((byte *)this) + bonecontrollerindex) + i; };
int numhitboxsets;
int hitboxsetindex;
// Look up hitbox set by index
mstudiohitboxset_t *pHitboxSet(int i) const
{
return (mstudiohitboxset_t *)(((byte *)this) + hitboxsetindex) + i;
};
// Calls through to hitbox to determine size of specified set
inline mstudiobbox_t *pHitbox(int i, int set) const
{
mstudiohitboxset_t const *s = pHitboxSet(set);
if (!s)
return NULL;
return s->pHitbox(i);
};
// Calls through to set to get hitbox count for set
inline int iHitboxCount(int set) const
{
mstudiohitboxset_t const *s = pHitboxSet(set);
if (!s)
return 0;
return s->numhitboxes;
};
studiohdr_t() {}
private:
// No copy constructors allowed
studiohdr_t(const studiohdr_t& vOther);
friend struct virtualmodel_t;
};
struct model_t;
//0x3F00FB33
class CModelInfo
{
public:
studiohdr_t* GetStudioModel(const model_t* Model)
{
typedef studiohdr_t*(__thiscall* Fn)(void*, const model_t*);
return VMT.getvfunc<Fn>(this, 29)(this, Model);
}
}; | 33.20442 | 144 | 0.705324 |
8ad71831f3e1feb5bf9ff463b314424c843a769d | 4,456 | h | C | src/ofApp.h | thesstefan/OpenTorium | 5d419251553b6ac04fed08a96309397bc232e816 | [
"MIT"
] | 1 | 2021-10-08T17:56:50.000Z | 2021-10-08T17:56:50.000Z | src/ofApp.h | thesstefan/OpenTorium | 5d419251553b6ac04fed08a96309397bc232e816 | [
"MIT"
] | null | null | null | src/ofApp.h | thesstefan/OpenTorium | 5d419251553b6ac04fed08a96309397bc232e816 | [
"MIT"
] | null | null | null | /**
* @file ofApp.h
*
* @brief This file provides the interface of ofApp.
*/
#pragma once
#include <memory>
#include <list>
#include "ofMain.h"
#include "zone_map.h"
#include "level_parser.h"
#include "emitter.h"
#include "field.h"
#include "target.h"
#include "constants.h"
#include "exceptions.h"
#include "ofxBlur.h"
/**
* @class ofApp
*
* This class encapsulates the behaviour of the program.
*
* An Emitter is used to create Particle instances with various
* trajectories and speeds which are displayed on the screen.
*/
class ofApp : public ofBaseApp {
private:
/** @brief The dimensions of the screen. **/
ofVec2f screenBounds;
/**
* @brief If END is true, the game ends (the end message is the only
* one rendered).
*
* That happens when all the Target objectives are achieved.
*/
bool END = false;
bool UNSUPPORTED_RES = false;
/** @brief The Target instances, encapsulated by a ZoneMap. **/
ZoneMap<Target> targetMap;
/** @brief The static Field instances, encapsulated by a ZoneMap. **/
ZoneMap<Field> fieldMap;
/** @brief The Emitter used to create Particle instances. **/
std::vector<std::unique_ptr<Emitter>> emitters;
/** @brief The Field instances which can be modified by the user. **/
std::vector<std::unique_ptr<Field>> fields;
/** @brief The std::list used to store the Particle instances used. **/
std::list<std::unique_ptr<Particle>> particles;
/** @brief The time that has passed since the beginning of the program. **/
float timePassed;
/** @brief The position of the cursor at the last mouseDragged call. **/
LevelParser parser;
/** @brief The position of the last drag event. */
ofPoint lastDragPosition;
/** @brief The iterator of the last dragged Field. */
std::vector<std::unique_ptr<Field>>::iterator lastDragField;
/** @brief Adds an object to the game environment. **/
void addObject(const std::pair<void *, std::string> &object);
/** @brief Loads a level file, given the path. */
void loadLevel(const std::string &path);
/** @brief Draws an overlay when the resolution is to small. */
void drawLowResOverlay();
/** @brief Blur shader which creates a glow effect. */
ofxBlur blur;
public:
/**
* @brief The minimum area of a Field. It can't be shrinked if
* it's already smaller.
*
* The field can actually have its area smaller than the limit.
*
* Actual limit => (MIN_FIELD_AREA + 1) * 0.9.
*/
constexpr static float MIN_FIELD_AREA = 2500;
/** @brief The maximum area of a Feild. It can't be enlarged
* if it's already larger.
*
* The field can actually have its area bigger than the limit.
*
* Actual limit => (MAX_FIELD_AREA - 1) * 1.1;
*/
constexpr static float MAX_FIELD_AREA = 125000;
/**
* @brief Construts ofApp.
*/
ofApp();
/**
* @brief Sets initial properties of the program
* (e.g. frame rate, background color).
*/
void setup();
/**
* @brief Updates the screen / program.
*
* The Emitter and every Particle are updated.
*/
void update();
/**
* @brief Draws the Particle instances.
*
* draw() is called for every Particle.
*/
void draw() override;
/**
* @brief Clears out the dead particles in a container.
*
* The container might be resized. Iterators are invalidated.
*/
void clearDeadParticles();
/** @brief Called when the mouse is pressed. **/
void mousePressed(int x, int y, int button);
/** @brief Called when the mouse is releasde. **/
void mouseReleased(int x, int y, int button);
/** @brief Called when the mouse is dragged. **/
void mouseDragged(int x, int y, int button);
/** @brief Called when the mouse is scrolled. **/
void mouseScrolled(int x, int y, float scrollX, float scrollY);
/** @brief Called when the window is resized. **/
void windowResized(int w, int h);
};
| 28.935065 | 83 | 0.580341 |
268d05ded11ba7c05501558ad3d01f975dcb00be | 8,036 | c | C | src/main_ttf.c | abaffa/chip8 | be787ce9ff0ed9e6ecdc9bee860ae0d4b1ab8d27 | [
"MIT"
] | null | null | null | src/main_ttf.c | abaffa/chip8 | be787ce9ff0ed9e6ecdc9bee860ae0d4b1ab8d27 | [
"MIT"
] | null | null | null | src/main_ttf.c | abaffa/chip8 | be787ce9ff0ed9e6ecdc9bee860ae0d4b1ab8d27 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <windows.h>
#include "SDL2/SDL.h"
#include "SDL2/SDL_ttf.h"
#include "chip8.h"
const char keyboard_map[CHIP8_TOTAL_KEYS] = {
SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_a, SDLK_b,
SDLK_c, SDLK_d, SDLK_e, SDLK_f};
void cls(HANDLE hConsole)
{
COORD coordScreen = { 0, 0 }; // home for the cursor
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
// Get the number of character cells in the current buffer.
if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
{
return;
}
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
// Fill the entire screen with blanks.
if (!FillConsoleOutputCharacter(hConsole, // Handle to console screen buffer
(TCHAR)' ', // Character to write to the buffer
dwConSize, // Number of cells to write
coordScreen, // Coordinates of first cell
&cCharsWritten)) // Receive number of characters written
{
return;
}
// Get the current text attribute.
if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
{
return;
}
// Set the buffer's attributes accordingly.
if (!FillConsoleOutputAttribute(hConsole, // Handle to console screen buffer
csbi.wAttributes, // Character attributes to use
dwConSize, // Number of cells to set attribute
coordScreen, // Coordinates of first cell
&cCharsWritten)) // Receive number of characters written
{
return;
}
// Put the cursor at its home coordinates.
SetConsoleCursorPosition(hConsole, coordScreen);
}
void print_font(SDL_Renderer* renderer, TTF_Font* sans, int x, int y, char *text){
SDL_Color White = {255, 255, 255}; // this is the color in rgb format, maxing out all would give you the color white, and it will be your text's color
SDL_Surface* surfaceMessage = TTF_RenderText_Solid(sans, text, White); // as TTF_RenderText_Solid could only be used on SDL_Surface then you have to create the surface first
SDL_Texture* message = SDL_CreateTextureFromSurface(renderer, surfaceMessage); //now you can convert it into a texture
SDL_Rect Message_rect; //create a rect
Message_rect.x = x; //controls the rect's x coordinate
Message_rect.y = y; // controls the rect's y coordinte
Message_rect.w = surfaceMessage->w; // controls the width of the rect
Message_rect.h = surfaceMessage->h; // controls the height of the rect
//Mind you that (0,0) is on the top left of the window/screen, think a rect as the text's box, that way it would be very simple to understand
//Now since it's a texture, you have to put RenderCopy in your game loop area, the area where the whole code executes
SDL_RenderCopy(renderer, message, NULL, &Message_rect); //you put the renderer's name first, the Message, the crop size(you can ignore this if you don't want to dabble with cropping), and the rect which is the size and coordinate of your texture
//SDL_FreeSurface(surfaceMessage);
//SDL_DestroyTexture(message);
}
int main(int argc, char** argv)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
cls(hConsole);
if(argc < 2)
{
printf("You must provide a file to load\n");
return -1;
}
const char* filename = argv[1];
printf("The filename to load is: %s\n", filename);
FILE* f = fopen(filename, "rb");
if(!f)
{
printf("Failed to open the file");
return -1;
}
fseek(f, 0, SEEK_END);
long size = ftell(f);
fseek(f, 0, SEEK_SET);
char buf[size];
int res = fread(buf, size, 1, f);
if(res != 1)
{
printf("Failed to read from file");
return -1;
}
struct chip8 chip8;
chip8_init(&chip8);
chip8_load(&chip8, buf, size);
chip8_keyboard_set_map(&chip8.keyboard, keyboard_map);
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window* window = SDL_CreateWindow(
EMULATOR_WINDOW_TITLE,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
CHIP8_WIDTH * CHIP8_WINDOW_MULTIPLIER,
CHIP8_HEIGHT * CHIP8_WINDOW_MULTIPLIER,
SDL_WINDOW_SHOWN
);
//TTF_Init();
//TTF_Font* sans = TTF_OpenFont("arial.ttf", 24); //this opens a font style and sets a size
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_TEXTUREACCESS_TARGET);
Uint64 NOW = SDL_GetPerformanceCounter();
Uint64 LAST = 0;
double deltaTime = 0;
double frame = 0;
while(1){
LAST = NOW;
NOW = SDL_GetPerformanceCounter();
deltaTime = (double)((NOW - LAST)*1000 / (double)SDL_GetPerformanceFrequency() );
SDL_Event event;
while(SDL_PollEvent(&event)){
switch(event.type){
case SDL_QUIT:
goto out;
break;
case SDL_KEYDOWN:{
char key = event.key.keysym.sym;
int vkey = chip8_keyboard_map(&chip8.keyboard, key);
if(vkey != -1)
chip8_keyboard_down(&chip8.keyboard, vkey);
}
break;
case SDL_KEYUP:{
char key = event.key.keysym.sym;
int vkey = chip8_keyboard_map(&chip8.keyboard, key);
if(vkey != -1)
chip8_keyboard_up(&chip8.keyboard, vkey);
}
break;
}
}
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0);
int x, y;
for(x = 0; x < CHIP8_WIDTH; x++)
{
for(y = 0; y < CHIP8_HEIGHT; y++)
{
if(chip8_screen_is_set(&chip8.screen, x, y))
{
SDL_Rect r;
r.x = x * CHIP8_WINDOW_MULTIPLIER;
r.y = y * CHIP8_WINDOW_MULTIPLIER;
r.w = CHIP8_WINDOW_MULTIPLIER;
r.h = CHIP8_WINDOW_MULTIPLIER;
SDL_RenderFillRect(renderer, &r);
}
}
}
SDL_RenderPresent(renderer);
/*
if(chip8.registers.delay_timer > 0){
Sleep(1);
chip8.registers.delay_timer--;
}
*/
if(chip8.registers.sound_timer > 0){
//Beep(15000, 100 * chip8.registers.sound_timer);
chip8.registers.sound_timer = 0;
}
if(frame > 4){
if(chip8.registers.delay_timer > 0)
chip8.registers.delay_timer--;
else{
unsigned short opcode = chip8_memory_get_short(&chip8.memory, chip8.registers.PC);
chip8.registers.PC += 2;
chip8_exec(&chip8, opcode);
}
frame = 0;
COORD pos = {0, 0};
SetConsoleCursorPosition(hConsole, pos);
int i = 0;
for(i = 0; i < 12; i++)
printf(" V%02d|", i);
printf("\n");
for(i = 0; i < 12; i++)
printf(" %02x |", chip8.registers.V[i]);
printf("\n\n");
printf(" I | dt | st | PC | SP |\n");
printf(" %04x |", chip8.registers.I);
printf(" %02x |", chip8.registers.delay_timer);
printf(" %02x |", chip8.registers.sound_timer);
printf(" %04x |", chip8.registers.PC);
printf(" %02x |", chip8.registers.SP);
}
frame += deltaTime;
}
out:
SDL_DestroyWindow(window);
return 0;
} | 31.027027 | 249 | 0.553758 |
fcdb72a39ca2e8c92645a6248f57256ed185eff4 | 936 | h | C | examples/03_Applications/DoubleExposure/LaserController.h | khoih-prog/TeensyTimerTool | 6447b9f7b0248772b78c81b7315392b4b760db3e | [
"MIT"
] | 46 | 2020-01-15T22:47:19.000Z | 2022-03-26T09:54:44.000Z | examples/03_Applications/DoubleExposure/LaserController.h | khoih-prog/TeensyTimerTool | 6447b9f7b0248772b78c81b7315392b4b760db3e | [
"MIT"
] | 14 | 2020-01-20T17:52:39.000Z | 2022-02-11T17:18:49.000Z | examples/03_Applications/DoubleExposure/LaserController.h | khoih-prog/TeensyTimerTool | 6447b9f7b0248772b78c81b7315392b4b760db3e | [
"MIT"
] | 15 | 2020-01-22T02:56:51.000Z | 2022-03-25T14:16:06.000Z | #pragma once
#include "PulseGenerator.h"
#include "TeensyTimerTool.h"
class LaserController
{
public:
void begin(unsigned preTriggerPin, unsigned triggerPin, unsigned camPin);
void shoot();
protected:
PulseGenerator preTrigger, trigger, camera;
};
void LaserController::begin(unsigned preTriggerPin, unsigned triggerPin, unsigned camPin)
{
preTrigger.begin(preTriggerPin);
trigger.begin(triggerPin);
camera.begin(camPin);
}
void LaserController::shoot()
{
constexpr float t_warmup = 140 - 5.5;
constexpr float t_p = 10 - 3;
constexpr float t_camDelay = 130 - 7.5;
constexpr float t_int = 30 - 3;
preTrigger.schedulePulse(0, t_p); // immediately generate the pretrigger pulse
trigger.schedulePulse(t_warmup, t_p); // schedule the trigger pulse to start after the warmup time
camera.schedulePulse(t_camDelay, t_int); // schedule the cam pulse after the camDelay time
}
| 28.363636 | 105 | 0.726496 |
149d209d4aedf5286e009521dc945ba0bad29a6d | 6,424 | h | C | BootloaderCommonPkg/Library/Ext23Lib/LibsaFsStand.h | sbl-support/slimbootloader | c6999f497aad12c7004eb61becab1345e5136157 | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause",
"MIT"
] | 1 | 2019-05-10T16:28:17.000Z | 2019-05-10T16:28:17.000Z | BootloaderCommonPkg/Library/Ext23Lib/LibsaFsStand.h | sbl-support/slimbootloader | c6999f497aad12c7004eb61becab1345e5136157 | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause",
"MIT"
] | null | null | null | BootloaderCommonPkg/Library/Ext23Lib/LibsaFsStand.h | sbl-support/slimbootloader | c6999f497aad12c7004eb61becab1345e5136157 | [
"BSD-2-Clause-NetBSD",
"BSD-2-Clause",
"MIT"
] | null | null | null | /** @file
Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Christopher G. Demetriou
for the NetBSD Project.
4. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission
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.
Copyright (c) 1993
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
@file stand.h 8.1 (Berkeley) 6/11/93
libsa_fs_stand.h
Definitions (file-system related) for/from the NetBSD libsa library.
**/
#ifndef _LIBSA_FS_STAND_H_
#define _LIBSA_FS_STAND_H_
#define LIBSA_SINGLE_DEVICE bdev
enum seek {
SEEK_SET = 0,
SEEK_CUR,
SEEK_END
};
//
// File information (stats); returned by the fs_readdir() function:
//
typedef struct {
UINT32 StatMode; // file type and protection (access permissions)
UINT32
StatSize; // file size (in bytes)
} STAT;
//
// <sys/types.h>
//
typedef long int DADDRESS;
typedef long int OFFSET;
typedef unsigned long ULONG;
typedef unsigned long INODE;
typedef struct {
INT32 FileFlags; // see F_* below
#if !defined(LIBSA_SINGLE_DEVICE)
DEVSW *DevPtr; // pointer to device operations
#endif
VOID *FileDevData; // device specific data
#if !defined(LIBSA_SINGLE_FILESYSTEM)
const struct fs_ops *FileOperations; // pointer to file system operations
#endif
VOID *FileSystemSpecificData; // file system specific data
#if !defined(LIBSA_NO_RAW_ACCESS)
OFFSET FileOffset; // current file offset (F_RAW)
#endif
} OPEN_FILE;
#if ! defined(LIBSA_SINGLE_DEVICE)
typedef const struct {
CHAR8 *Devname;
INT32 (*DevStrategy) (VOID *, INT32, DADDRESS, UINT32, VOID *, UINT32 *);
INT32 (*DevOpen) (OPEN_FILE *, ...);
INT32 (*DevClose) (OPEN_FILE *);
INT32 (*DevIoctl) (OPEN_FILE *, ULONG, VOID *);
} DEVSW;
#define DEV_NAME(d) ((d)->Devname)
#define DEV_STRATEGY(d) ((d)->DevStrategy)
#else
/**
Gives the info of device block config.
@param DevData Device privete data.
@param ReadWrite Read write
@param BlockNum Block number to start
@param Size Size to read block.
@param Buf Buffer to read the block data.
@param RSize
@retval EFI_SUCCESS The function completed successfully.
@retval !EFI_SUCCESS Something error while read FILE.
**/
INT32
BDevStrategy (
VOID *DevData,
INT32 ReadWrite,
DADDRESS BlockNum,
UINT32 Size,
VOID *Buf,
UINT32 *RSize
);
#endif
struct fs_ops {
INT32 (*open) (CHAR8 *, OPEN_FILE *);
INT32 (*close) (OPEN_FILE *);
INT32 (*read) (OPEN_FILE *, VOID *, UINT32, UINT32 *);
INT32 (*write) (OPEN_FILE *, VOID *, UINT32 size, UINT32 *);
OFFSET (*seek) (OPEN_FILE *, OFFSET, INT32);
INT32 (*stat) (OPEN_FILE *, STAT *);
VOID (*ls) (OPEN_FILE *, const CHAR8 *);
INT32 (*disk_blocks) (OPEN_FILE *, UINT32, UINT32, UINT32 *);
INT32 (*lookup_file) (OPEN_FILE *, STAT *, CHAR8 *, UINT32);
};
//
// f_flags values
//
#define F_READ 0x0001 // file opened for reading
#define F_WRITE 0x0002 // file opened for writing
#define F_RAW 0x0004 // raw device open - no file system
#define F_NODEV 0x0008 // network open - no device
//
// dosfs_stat() needs them
//
#define S_IFMT 00170000
#define S_IFSOCK 0140000
#define S_IFLNK 0120000
#define S_IFREG 0100000
#define S_IFBLK 0060000
#define S_IFDIR 0040000
#define S_IFCHR 0020000
#define S_IFIFO 0010000
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#endif
| 34.913043 | 82 | 0.725093 |
9b0022e45ccc1971107a279d27146e034b858dd7 | 1,439 | c | C | mplayer/src/alsa-utils-1.1.9/axfer/container-raw.c | Minaduki-Shigure/BeagleBone_Proj | f6f66a4758f64515dcfd4f8d6cd02d02a5a0b35b | [
"MIT"
] | null | null | null | mplayer/src/alsa-utils-1.1.9/axfer/container-raw.c | Minaduki-Shigure/BeagleBone_Proj | f6f66a4758f64515dcfd4f8d6cd02d02a5a0b35b | [
"MIT"
] | null | null | null | mplayer/src/alsa-utils-1.1.9/axfer/container-raw.c | Minaduki-Shigure/BeagleBone_Proj | f6f66a4758f64515dcfd4f8d6cd02d02a5a0b35b | [
"MIT"
] | null | null | null | // SPDX-License-Identifier: GPL-2.0
//
// container-raw.c - a parser/builder for a container with raw data frame.
//
// Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
//
// Licensed under the terms of the GNU General Public License, version 2.
#include "container.h"
#include "misc.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
static int raw_builder_pre_process(struct container_context *cntr,
snd_pcm_format_t *sample_format,
unsigned int *samples_per_frame,
unsigned int *frames_per_second,
uint64_t *byte_count)
{
*byte_count = UINT64_MAX;
return 0;
}
static int raw_parser_pre_process(struct container_context *cntr,
snd_pcm_format_t *sample_format,
unsigned int *samples_per_frame,
unsigned int *frames_per_second,
uint64_t *byte_count)
{
struct stat buf = {0};
int err;
if (cntr->stdio) {
*byte_count = UINT64_MAX;
return 0;
}
err = fstat(cntr->fd, &buf);
if (err < 0)
return err;
*byte_count = buf.st_size;
if (*byte_count == 0)
*byte_count = UINT64_MAX;
return 0;
}
const struct container_parser container_parser_raw = {
.format = CONTAINER_FORMAT_RAW,
.max_size = UINT64_MAX,
.ops = {
.pre_process = raw_parser_pre_process,
},
};
const struct container_builder container_builder_raw = {
.format = CONTAINER_FORMAT_RAW,
.max_size = UINT64_MAX,
.ops = {
.pre_process = raw_builder_pre_process,
},
};
| 21.477612 | 74 | 0.708131 |
88c82d5e4d5507463748f3f3fa5de081fefbaad9 | 298 | h | C | examples/iOS/Swift3/SnowboyTest/SnowboyTest-Bridging-Header.h | iseaboy/snowboy | 75ef4f5408a08beb8c1b00a1e37cf6c338f38a1d | [
"Apache-2.0"
] | 2,842 | 2016-05-11T19:35:41.000Z | 2022-03-31T02:50:54.000Z | examples/iOS/Swift3/SnowboyTest/SnowboyTest-Bridging-Header.h | iseaboy/snowboy | 75ef4f5408a08beb8c1b00a1e37cf6c338f38a1d | [
"Apache-2.0"
] | 629 | 2016-05-13T10:03:08.000Z | 2022-03-27T13:25:26.000Z | examples/iOS/Swift3/SnowboyTest/SnowboyTest-Bridging-Header.h | iseaboy/snowboy | 75ef4f5408a08beb8c1b00a1e37cf6c338f38a1d | [
"Apache-2.0"
] | 944 | 2016-05-14T08:59:15.000Z | 2022-03-19T07:09:08.000Z | //
// SnowboyTest-Bridging-Header.h
// SnowboyTest
//
// Created by Bi, Sheng on 2/13/17.
// Copyright © 2017 Bi, Sheng. All rights reserved.
//
#ifndef SnowboyTest_Bridging_Header_h
#define SnowboyTest_Bridging_Header_h
#import "SnowboyWrapper.h"
#endif /* SnowboyTest_Bridging_Header_h */
| 19.866667 | 52 | 0.744966 |
af47b7201f2366592b827819cd50396e3fcecf81 | 10,040 | c | C | xun/xnu-6153.81.5/osfmk/arm64/copyio.c | L-Zheng/AppleOpenSource | 65fac74ce17dc97404f1aeb8c24625fe82b7d142 | [
"MIT"
] | null | null | null | xun/xnu-6153.81.5/osfmk/arm64/copyio.c | L-Zheng/AppleOpenSource | 65fac74ce17dc97404f1aeb8c24625fe82b7d142 | [
"MIT"
] | null | null | null | xun/xnu-6153.81.5/osfmk/arm64/copyio.c | L-Zheng/AppleOpenSource | 65fac74ce17dc97404f1aeb8c24625fe82b7d142 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2012-2013 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#include <arm/cpu_data_internal.h>
#include <arm/misc_protos.h>
#include <kern/thread.h>
#include <sys/errno.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <san/kasan.h>
#undef copyin
#undef copyout
extern int _bcopyin(const char *src, char *dst, vm_size_t len);
extern int _bcopyinstr(const char *src, char *dst, vm_size_t max, vm_size_t *actual);
extern int _bcopyout(const char *src, char *dst, vm_size_t len);
extern int _copyin_atomic32(const char *src, uint32_t *dst);
extern int _copyin_atomic32_wait_if_equals(const char *src, uint32_t dst);
extern int _copyin_atomic64(const char *src, uint64_t *dst);
extern int _copyout_atomic32(uint32_t u32, const char *dst);
extern int _copyout_atomic64(uint64_t u64, const char *dst);
extern int copyoutstr_prevalidate(const void *kaddr, user_addr_t uaddr, size_t len);
extern pmap_t kernel_pmap;
/* On by default, optionally disabled by boot-arg */
extern boolean_t copyio_zalloc_check;
/*!
* @typedef copyio_flags_t
*
* @const COPYIO_IN
* The copy is user -> kernel.
* One of COPYIO_IN or COPYIO_OUT should always be specified.
*
* @const COPYIO_OUT
* The copy is kernel -> user
* One of COPYIO_IN or COPYIO_OUT should always be specified.
*
* @const COPYIO_ALLOW_KERNEL_TO_KERNEL
* The "user_address" is allowed to be in the VA space of the kernel.
*
* @const COPYIO_VALIDATE_USER_ONLY
* There isn't really a kernel address used, and only the user address
* needs to be validated.
*
* @const COPYIO_ATOMIC
* The copyio operation is atomic, ensure that it is properly aligned.
*/
__options_decl(copyio_flags_t, uint32_t, {
COPYIO_IN = 0x0001,
COPYIO_OUT = 0x0002,
COPYIO_ALLOW_KERNEL_TO_KERNEL = 0x0004,
COPYIO_VALIDATE_USER_ONLY = 0x0008,
COPYIO_ATOMIC = 0x0010,
});
static inline void
user_access_enable(void)
{
#if __ARM_PAN_AVAILABLE__
assert(__builtin_arm_rsr("pan") != 0);
__builtin_arm_wsr("pan", 0);
#endif /* __ARM_PAN_AVAILABLE__ */
}
static inline void
user_access_disable(void)
{
#if __ARM_PAN_AVAILABLE__
__builtin_arm_wsr("pan", 1);
#endif /* __ARM_PAN_AVAILABLE__ */
}
/*
* Copy sizes bigger than this value will cause a kernel panic.
*
* Yes, this is an arbitrary fixed limit, but it's almost certainly
* a programming error to be copying more than this amount between
* user and wired kernel memory in a single invocation on this
* platform.
*/
const int copysize_limit_panic = (64 * 1024 * 1024);
static inline bool
is_kernel_to_kernel_copy()
{
return current_thread()->map->pmap == kernel_pmap;
}
/*
* Validate the arguments to copy{in,out} on this platform.
*
* Returns EXDEV when the current thread pmap is the kernel's
* which is non fatal for certain routines.
*/
static int
copy_validate(const user_addr_t user_addr, uintptr_t kernel_addr,
vm_size_t nbytes, copyio_flags_t flags)
{
thread_t self = current_thread();
user_addr_t user_addr_last;
uintptr_t kernel_addr_last;
if (__improbable(nbytes > copysize_limit_panic)) {
panic("%s(%p, %p, %lu) - transfer too large", __func__,
(void *)user_addr, (void *)kernel_addr, nbytes);
}
if (__improbable((user_addr < vm_map_min(self->map)) ||
os_add_overflow(user_addr, nbytes, &user_addr_last) ||
(user_addr_last > vm_map_max(self->map)))) {
return EFAULT;
}
if (flags & COPYIO_ATOMIC) {
if (__improbable(user_addr & (nbytes - 1))) {
return EINVAL;
}
}
if ((flags & COPYIO_VALIDATE_USER_ONLY) == 0) {
if (__improbable((kernel_addr < VM_MIN_KERNEL_ADDRESS) ||
os_add_overflow(kernel_addr, nbytes, &kernel_addr_last) ||
(kernel_addr_last > VM_MAX_KERNEL_ADDRESS))) {
panic("%s(%p, %p, %lu) - kaddr not in kernel", __func__,
(void *)user_addr, (void *)kernel_addr, nbytes);
}
}
if (is_kernel_to_kernel_copy()) {
if (__improbable((flags & COPYIO_ALLOW_KERNEL_TO_KERNEL) == 0)) {
return EFAULT;
}
return EXDEV;
}
if (__improbable(user_addr & TBI_MASK)) {
return EINVAL;
}
if ((flags & COPYIO_VALIDATE_USER_ONLY) == 0) {
if (__probable(copyio_zalloc_check)) {
vm_size_t kernel_buf_size = zone_element_size((void *)kernel_addr, NULL);
if (__improbable(kernel_buf_size && kernel_buf_size < nbytes)) {
panic("copyio_preflight: kernel buffer 0x%lx has size %lu < nbytes %lu",
kernel_addr, kernel_buf_size, nbytes);
}
}
#if KASAN
/* For user copies, asan-check the kernel-side buffer */
if (flags & COPYIO_IN) {
__asan_storeN(kernel_addr, nbytes);
} else {
__asan_loadN(kernel_addr, nbytes);
kasan_check_uninitialized((vm_address_t)kernel_addr, nbytes);
}
#endif
}
return 0;
}
int
copyin_kern(const user_addr_t user_addr, char *kernel_addr, vm_size_t nbytes)
{
bcopy((const char*)(uintptr_t)user_addr, kernel_addr, nbytes);
return 0;
}
int
copyout_kern(const char *kernel_addr, user_addr_t user_addr, vm_size_t nbytes)
{
bcopy(kernel_addr, (char *)(uintptr_t)user_addr, nbytes);
return 0;
}
int
copyin(const user_addr_t user_addr, void *kernel_addr, vm_size_t nbytes)
{
int result;
if (__improbable(nbytes == 0)) {
return 0;
}
result = copy_validate(user_addr, (uintptr_t)kernel_addr, nbytes,
COPYIO_IN | COPYIO_ALLOW_KERNEL_TO_KERNEL);
if (result == EXDEV) {
return copyin_kern(user_addr, kernel_addr, nbytes);
}
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _bcopyin((const char *)user_addr, kernel_addr, nbytes);
user_access_disable();
return result;
}
/*
* copy{in,out}_atomic{32,64}
* Read or store an aligned value from userspace as a single memory transaction.
* These functions support userspace synchronization features
*/
int
copyin_atomic32(const user_addr_t user_addr, uint32_t *kernel_addr)
{
int result = copy_validate(user_addr, (uintptr_t)kernel_addr, 4,
COPYIO_IN | COPYIO_ATOMIC);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _copyin_atomic32((const char *)user_addr, kernel_addr);
user_access_disable();
return result;
}
int
copyin_atomic32_wait_if_equals(const user_addr_t user_addr, uint32_t value)
{
int result = copy_validate(user_addr, 0, 4,
COPYIO_OUT | COPYIO_ATOMIC | COPYIO_VALIDATE_USER_ONLY);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _copyin_atomic32_wait_if_equals((const char *)user_addr, value);
user_access_disable();
return result;
}
int
copyin_atomic64(const user_addr_t user_addr, uint64_t *kernel_addr)
{
int result = copy_validate(user_addr, (uintptr_t)kernel_addr, 8,
COPYIO_IN | COPYIO_ATOMIC);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _copyin_atomic64((const char *)user_addr, kernel_addr);
user_access_disable();
return result;
}
int
copyout_atomic32(uint32_t value, user_addr_t user_addr)
{
int result = copy_validate(user_addr, 0, 4,
COPYIO_OUT | COPYIO_ATOMIC | COPYIO_VALIDATE_USER_ONLY);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _copyout_atomic32(value, (const char *)user_addr);
user_access_disable();
return result;
}
int
copyout_atomic64(uint64_t value, user_addr_t user_addr)
{
int result = copy_validate(user_addr, 0, 8,
COPYIO_OUT | COPYIO_ATOMIC | COPYIO_VALIDATE_USER_ONLY);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _copyout_atomic64(value, (const char *)user_addr);
user_access_disable();
return result;
}
int
copyinstr(const user_addr_t user_addr, char *kernel_addr, vm_size_t nbytes, vm_size_t *lencopied)
{
int result;
vm_size_t bytes_copied = 0;
*lencopied = 0;
if (__improbable(nbytes == 0)) {
return ENAMETOOLONG;
}
result = copy_validate(user_addr, (uintptr_t)kernel_addr, nbytes, COPYIO_IN);
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _bcopyinstr((const char *)user_addr, kernel_addr, nbytes,
&bytes_copied);
user_access_disable();
if (result != EFAULT) {
*lencopied = bytes_copied;
}
return result;
}
int
copyout(const void *kernel_addr, user_addr_t user_addr, vm_size_t nbytes)
{
int result;
if (nbytes == 0) {
return 0;
}
result = copy_validate(user_addr, (uintptr_t)kernel_addr, nbytes,
COPYIO_OUT | COPYIO_ALLOW_KERNEL_TO_KERNEL);
if (result == EXDEV) {
return copyout_kern(kernel_addr, user_addr, nbytes);
}
if (__improbable(result)) {
return result;
}
user_access_enable();
result = _bcopyout(kernel_addr, (char *)user_addr, nbytes);
user_access_disable();
return result;
}
int
copyoutstr_prevalidate(const void *__unused kaddr, user_addr_t __unused uaddr, size_t __unused len)
{
if (__improbable(is_kernel_to_kernel_copy())) {
return EFAULT;
}
return 0;
}
| 27.582418 | 99 | 0.73506 |
4984eae375572db13d4b70e2e8b431d488ffb1b2 | 2,840 | c | C | projects/simulator/pthread_tests/pthread_cancel.2-1.c | maurizioabba/rose | 7597292cf14da292bdb9a4ef573001b6c5b9b6c0 | [
"BSD-3-Clause"
] | 488 | 2015-01-09T08:54:48.000Z | 2022-03-30T07:15:46.000Z | projects/simulator2/pthread_tests/pthread_cancel.2-1.c | sujankh/rose-matlab | 7435d4fa1941826c784ba97296c0ec55fa7d7c7e | [
"BSD-3-Clause"
] | 174 | 2015-01-28T18:41:32.000Z | 2022-03-31T16:51:05.000Z | projects/simulator2/pthread_tests/pthread_cancel.2-1.c | sujankh/rose-matlab | 7435d4fa1941826c784ba97296c0ec55fa7d7c7e | [
"BSD-3-Clause"
] | 146 | 2015-04-27T02:48:34.000Z | 2022-03-04T07:32:53.000Z | /*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
* Test pthread_cancel
* When the cancelation is acted on, the cancelation cleanup handlers for
* 'thread' shall be called.
*
* STEPS:
* 1. Create a thread
* 2. In the thread function, push a cleanup function onto the stack
* 3. Cancel the thread. The cleanup function should be automatically
* executed, else the test will fail.
*/
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "posixtest.h"
int sem; /* Manual semaphore */
int cleanup_flag; /* Made global so that the cleanup function
can manipulate the value as well. */
/* A cleanup function that sets the cleanup_flag to 1, meaning that the
* cleanup function was reached. */
void a_cleanup_func()
{
cleanup_flag=1;
sem=0;
return;
}
/* A thread function called at the creation of the thread. It will push
* the cleanup function onto it's stack, then go into a continuous 'while'
* loop, never reaching the cleanup_pop function. So the only way the cleanup
* function can be called is when the thread is canceled and all the cleanup
* functions are supposed to be popped. */
void *a_thread_func()
{
/* To enable thread immediate cancelation, since the default
* is PTHREAD_CANCEL_DEFERRED. */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_cleanup_push(a_cleanup_func,NULL);
sem=1;
while(sem==1)
sleep(1);
sleep(5);
sem=0;
/* Should never be reached, but is required to be in the code
* since pthread_cleanup_push is in the code. Else a compile error
* will result. */
pthread_cleanup_pop(0);
perror("Operation timed out, thread could not be canceled\n");
pthread_exit(0);
return NULL;
}
int main()
{
pthread_t new_th;
int i;
/* Initializing the cleanup flag. */
cleanup_flag=0;
sem=0;
/* Create a new thread. */
if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
{
perror("Error creating thread\n");
return PTS_UNRESOLVED;
}
/* Make sure thread is created before we cancel it. */
while(sem==0)
sleep(1);
if(pthread_cancel(new_th) != 0)
{
printf("Error canceling thread\n");
return PTS_FAIL;
}
i=0;
while(sem==1)
{
sleep(1);
if(i==10)
{
printf("Test FAILED: Timed out while waiting for cancelation cleanup handlers to execute\n");
return PTS_FAIL;
}
i++;
}
/* If the cleanup function was not reached by calling the
* pthread_cancel function, then the test fails. */
if(cleanup_flag != 1)
{
printf("Test FAILED: Could not cancel thread\n");
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
}
| 25.132743 | 96 | 0.704225 |
49b9dd6508084ce202d220519e8384df4252176d | 152 | h | C | LiveCam/Unused/FX/Custom/FxChicagoBullsFaceSwap.h | KanSmith/LiveCam | 8b863f55f08cb3ea5090e417c68ad82ded690743 | [
"MIT"
] | null | null | null | LiveCam/Unused/FX/Custom/FxChicagoBullsFaceSwap.h | KanSmith/LiveCam | 8b863f55f08cb3ea5090e417c68ad82ded690743 | [
"MIT"
] | null | null | null | LiveCam/Unused/FX/Custom/FxChicagoBullsFaceSwap.h | KanSmith/LiveCam | 8b863f55f08cb3ea5090e417c68ad82ded690743 | [
"MIT"
] | null | null | null | #pragma once
#include <fx\FxSwap2.h>
class FxChicagoBullsFaceSwap : public FxSwap2
{
public:
FxChicagoBullsFaceSwap();
~FxChicagoBullsFaceSwap();
}; | 15.2 | 45 | 0.769737 |
ebaa2fc8fbaf2a5697f1280a2b066f9c7c799442 | 662 | h | C | src/serializer/SerializationException.h | chovy1/serialbox | b71c9749855d2d9bbb60da7ff779013640fede30 | [
"BSD-2-Clause"
] | 6 | 2016-01-26T14:07:23.000Z | 2019-09-18T13:03:09.000Z | src/serializer/SerializationException.h | chovy1/serialbox | b71c9749855d2d9bbb60da7ff779013640fede30 | [
"BSD-2-Clause"
] | 5 | 2015-12-30T10:52:20.000Z | 2017-03-27T14:29:17.000Z | src/serializer/SerializationException.h | chovy1/serialbox | b71c9749855d2d9bbb60da7ff779013640fede30 | [
"BSD-2-Clause"
] | 8 | 2015-12-17T08:52:26.000Z | 2019-10-23T23:47:12.000Z | #pragma once
//This file is released under terms of BSD license`
//See LICENSE.txt for more information
#include <exception>
#include <string>
namespace ser {
class SerializationException : public std::exception
{
public:
SerializationException() throw() { }
~SerializationException() throw() { }
void Init(const std::string& errormsg)
{
message_ = errormsg;
}
const char* what() const throw()
{
return message_.c_str();
}
const std::string& message() const { return message_; }
private:
std::string message_;
};
}//namespace ser
| 20.060606 | 63 | 0.590634 |
9df9f3466add112f5f9e491950cd6aebf3abd875 | 5,992 | h | C | partitioner/analysis/library/graph.h | ssrg-vt/aira | 96a830480d1ed8317e0175a10d950d7991fb2bb7 | [
"Unlicense"
] | 3 | 2018-12-17T08:20:40.000Z | 2020-02-24T02:08:23.000Z | partitioner/analysis/library/graph.h | ssrg-vt/aira | 96a830480d1ed8317e0175a10d950d7991fb2bb7 | [
"Unlicense"
] | null | null | null | partitioner/analysis/library/graph.h | ssrg-vt/aira | 96a830480d1ed8317e0175a10d950d7991fb2bb7 | [
"Unlicense"
] | null | null | null | // graph.h -- Provide access to requires Boost Graph Library Functionality.
//
// This file is distributed under the MIT license, see LICENSE.txt.
//
// To avoid the need to use the Boost Graph Library directly in the main code
// we have this abstraction layer. It provides graphs where each vertex can
// have a name and a partition assignment, edge properties are templated.
//
// The main purpose of Graph<> is to provide a way to record edge properties
//
// Not all functions make sense for all template types, this should only be a
// "problem" for FlowNetworks, but it's not actually a problem because those
// are only used in one place in a very specific way. Partitioning (global
// min-cut or s-t min-cut) is only implemented for UndirectedGraph, it is
// possible to implement it for DirectedGraph but the implementation will be
// different and I never had the need.
//
// Most functions are implemented in graph_impl.h, but a few functions which
// have per-template specialisations are implemented in graph.cpp.
//
// As Boost is massively templated this class is lightly templated, however at
// the very bottom of this file three different template combinations
// typedef'd, these represent the only current use cases of the Graph<> class.
#ifndef _GRAPH_H
#define _GRAPH_H
#include <map>
#include <vector>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include "types.h"
template <typename D, typename EP> // Direction, EdgeProperty
class Graph {
public:
// All the properties that we store per-vertex.
struct VertexProperty {
node_t name;
int partition;
VertexProperty() : name("unnamed"), partition(0) {}
VertexProperty(node_t _name) : name(_name), partition(0) {}
bool operator==(node_t other) const { return NODE_T_EQ(name, other); }
};
// A wrapper class for various boost types or helper functions given more
// convient names.
class Types {
public:
typedef typename boost::adjacency_list<boost::vecS, boost::vecS, D,
VertexProperty, EP> G;
typedef typename boost::graph_traits<G>::vertex_descriptor V;
typedef typename boost::graph_traits<G>::edge_descriptor E;
typedef typename boost::graph_traits<G>::vertex_iterator VI;
typedef typename boost::graph_traits<G>::edge_iterator EI;
typedef typename boost::graph_traits<G>::out_edge_iterator OEI;
static const V Null() { return G::null_vertex(); }
static boost::iterator_range<VI> Vertices(const G &g) {
std::pair<VI, VI> v = boost::vertices(g);
return boost::make_iterator_range(v.first, v.second);
}
static boost::iterator_range<EI> Edges(const G &g) {
std::pair<EI, EI> e = boost::edges(g);
return boost::make_iterator_range(e.first, e.second);
}
static boost::iterator_range<OEI> OutEdges(const V &v, const G &g) {
std::pair<OEI, OEI> e = boost::out_edges(v, g);
return boost::make_iterator_range(e.first, e.second);
}
};
void addNode(node_t n);
void addEdge(node_t source, node_t sink, edge_t e);
// Return a vector containing the names associated with every vertex in the
// graph, or every vertex belonging to a particular partition.
std::vector<node_t> allNodes() const;
std::vector<node_t> allNodes(int partition) const;
// The sum of all edges in the graph.
edge_t sumEdges() const;
// Return the weight associated with the edge between two nodes. This
// function only makes sense for template types which use edge_weight as
// their edge property (EP in the template).
edge_t edge(node_t source, node_t sink) const;
// Whether or not there exists a vertex with the given name property.
bool exists(node_t n) const;
// Partition the graph based on min-cut, or s-t min-cut. The former is
// computed directly, the latter coverts to a network flow graph, solves for
// max-flow and then uses max-flow/min-cut duality to pick a partitioning.
// Note: These functions are only implemented for undirected graphs.
edge_t partition();
edge_t partition(node_t s, node_t t);
// Output a DOT graph representing all data contained within. Because we
// need to output (slightly) different DOT graphs for directed or undirected
// graphs we make use of the type system to pick the correct implementation.
void draw(const char *file) const;
static void draw_implementation(const typename Types::G &g, const char *file,
const char *graph_str, const char *edge_str);
private:
// The actual boost graph.
typename Types::G g;
// Boost accesses vertices via numbers, but we want to look them up by name.
// So we have a map of names to vertex numbers so that we can quickly find
// the correct vertex. The labeled_graph type in Boost could actually do
// this work for us, but it is very poorly supported compared to the other
// graph types.
std::map<node_t, typename Types::V, NODE_T_COMPARATOR> map;
typename Types::V node(node_t n) const;
};
// Define some 'simple' weighted graphs, directed and undirected.
typedef boost::property<boost::edge_weight_t, edge_t> Weight;
typedef Graph<boost::directedS, Weight> DirectedGraph;
typedef Graph<boost::undirectedS, Weight> UndirectedGraph;
// Define a flow-network graph. This is more complicated as Boost requires
// that each edge has a capacity and a residual capacity, and that every edge
// should (a) have a reverse edge, and (b) that every edge should know which
// edge is its reverse.
typedef boost::adjacency_list_traits<boost::vecS, boost::vecS,
boost::directedS> FlowTrait;
typedef boost::property<boost::edge_capacity_t, edge_t,
boost::property<boost::edge_residual_capacity_t, edge_t,
boost::property<boost::edge_reverse_t,
FlowTrait::edge_descriptor>>> Flow;
typedef Graph<boost::directedS, Flow> FlowNetwork;
#include "graph_impl.h"
#endif // _GRAPH_H
| 41.041096 | 79 | 0.714286 |
8b40f394ba91ca656b7fd7eeb0773febeab7cf2f | 2,074 | h | C | src/netconf_server_ssh.h | andrei-pavel/netopeer2 | 58ef149a69567078b92582e3dd2955327e7a948d | [
"BSD-3-Clause"
] | null | null | null | src/netconf_server_ssh.h | andrei-pavel/netopeer2 | 58ef149a69567078b92582e3dd2955327e7a948d | [
"BSD-3-Clause"
] | 2 | 2021-01-06T13:26:39.000Z | 2021-01-06T16:57:05.000Z | src/netconf_server_ssh.h | andrei-pavel/netopeer2 | 58ef149a69567078b92582e3dd2955327e7a948d | [
"BSD-3-Clause"
] | null | null | null | /**
* @file netconf_server_ssh.h
* @author Michal Vasko <mvasko@cesnet.cz>
* @brief ietf-netconf-server SSH callbacks header
*
* Copyright (c) 2019 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*/
#ifndef NP2SRV_NETCONF_SERVER_SSH_H_
#define NP2SRV_NETCONF_SERVER_SSH_H_
#include <libssh/libssh.h>
#include <sysrepo.h>
int np2srv_hostkey_cb(const char *name, void *user_data, char **privkey_path, char **privkey_data,
NC_SSH_KEY_TYPE *privkey_type);
int np2srv_pubkey_auth_cb(const struct nc_session *session, ssh_key key, void *user_data);
int np2srv_endpt_ssh_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath, sr_event_t event,
uint32_t request_id, void *private_data);
int np2srv_endpt_ssh_hostkey_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath,
uint32_t request_id, sr_event_t event, void *private_data);
int np2srv_endpt_ssh_auth_methods_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath,
uint32_t request_id, sr_event_t event, void *private_data);
int np2srv_endpt_ssh_auth_users_oper_cb(sr_session_ctx_t *session, const char *module_name, const char *path,
const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data);
int np2srv_ch_client_endpt_ssh_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath,
uint32_t request_id, sr_event_t event, void *private_data);
int np2srv_ch_endpt_ssh_hostkey_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath,
uint32_t request_id, sr_event_t event, void *private_data);
int np2srv_ch_endpt_ssh_auth_methods_cb(sr_session_ctx_t *session, const char *module_name, const char *xpath,
uint32_t request_id, sr_event_t event, void *private_data);
#endif /* NP2SRV_NETCONF_SERVER_SSH_H_ */
| 43.208333 | 112 | 0.773867 |
a050a091077c327458d5ce97be2be4373eaf778c | 1,498 | h | C | gen/objcgen.h | ryuukk/ldc | 5a28329e2f027ff2e3ea77a299f245e5baa4247c | [
"Apache-2.0"
] | 858 | 2015-01-02T10:06:15.000Z | 2022-03-30T18:26:49.000Z | gen/objcgen.h | ryuukk/ldc | 5a28329e2f027ff2e3ea77a299f245e5baa4247c | [
"Apache-2.0"
] | 2,533 | 2015-01-04T14:31:13.000Z | 2022-03-31T22:12:24.000Z | gen/objcgen.h | ryuukk/ldc | 5a28329e2f027ff2e3ea77a299f245e5baa4247c | [
"Apache-2.0"
] | 220 | 2015-01-06T05:24:36.000Z | 2022-03-13T10:47:32.000Z | //===-- gen/objcgen.cpp -----------------------------------------*- C++ -*-===//
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Functions for generating Objective-C method calls.
//
//===----------------------------------------------------------------------===//
#pragma once
#include <vector>
#include "llvm/ADT/StringMap.h"
struct ObjcSelector;
namespace llvm {
class Constant;
class GlobalVariable;
class Module;
class Triple;
}
bool objc_isSupported(const llvm::Triple &triple);
// Objective-C state tied to an LLVM module (object file).
class ObjCState {
public:
ObjCState(llvm::Module &module) : module(module) {}
llvm::GlobalVariable *getMethVarRef(const ObjcSelector &sel);
void finalize();
private:
llvm::Module &module;
// symbols that shouldn't be optimized away
std::vector<llvm::Constant *> retainedSymbols;
llvm::StringMap<llvm::GlobalVariable *> methVarNameMap;
llvm::StringMap<llvm::GlobalVariable *> methVarRefMap;
llvm::GlobalVariable *getCStringVar(const char *symbol,
const llvm::StringRef &str,
const char *section);
llvm::GlobalVariable *getMethVarName(const llvm::StringRef &name);
void retain(llvm::Constant *sym);
void genImageInfo();
void retainSymbols();
};
| 27.236364 | 80 | 0.576101 |
9969fe1b25599e4401223b50c0e8cf671cd654d8 | 18,620 | h | C | libs/itree/MiddleStructure.h | BBrumback/Final_project_mesh_unfolder | 4fbb1f9b4e34f6061c87ae08dc0c4e7ab256cddc | [
"MIT"
] | 1 | 2021-04-23T09:11:23.000Z | 2021-04-23T09:11:23.000Z | libs/itree/MiddleStructure.h | jmlien/mesh_unfolder | 3f1ed2f4b906a57bebf7b35ed75c7c3fa976de58 | [
"MIT"
] | null | null | null | libs/itree/MiddleStructure.h | jmlien/mesh_unfolder | 3f1ed2f4b906a57bebf7b35ed75c7c3fa976de58 | [
"MIT"
] | null | null | null | //------------------------------------------------------------------------------
// Copyright 2010-2012 by Jyh-Ming Lien and George Mason University
// See the file "LICENSE" for more information
//------------------------------------------------------------------------------
#pragma once
#ifndef _MIDDLE_STRUCTURE_H_
#define _MIDDLE_STRUCTURE_H_
#include "RectangleTree.h"
template< class rectKD, int K > class MiddleTree;
///////////////////////////////////////////////////////////////////////////////
//
// MiddleStructure
//
///////////////////////////////////////////////////////////////////////////////
//The middle structure stores the segments containing the node's values
template< class _rectKD, int K >
class MiddleStructure {
public:
typedef _rectKD rectKD;
typedef typename rectKD::Int Int;
typedef typename rectKD::Pt Pt;
typedef vector<rectKD*> rectList;
typedef vector<const Pt*> ptList;
typedef MiddleTree<rectKD,K> Mtree;
friend class RectangleTree<MiddleStructure,K>; //the only creator of this class
protected: //only RectangleTree can create MiddleStructure
///////////////////////////////////////////////////////////////////////////
MiddleStructure(){
msTree_Root=msTree_Left=msTree_Right=NULL;
}
~MiddleStructure()
{
//delete [] msTree_Root;
if (msTree_Root != msTree_Left) delete msTree_Root;
delete [] msTree_Left;
}
///////////////////////////////////////////////////////////////////////////
bool Build( ptList & ptlist, int Level );
bool query( rectKD *q, QueryInfo info );
bool query_lastlevel( rectKD *q, const QueryInfo & info );
void print(){
Mtree * leaf=msTree_Left;
cout<<" * ";
while( leaf!=NULL ){
cout<<leaf->getPoint()->getValue()<<" ";
leaf=leaf->getRight();
}
cout<<"\n";
if( msTree_Root->subTree!=NULL ) msTree_Root->subTree->print();
}
protected:
//RectangleTree<rectKD,K> * primary_node;
//middle sub tree, pointer to root, left most, and right most.
Mtree * msTree_Root, * msTree_Left, * msTree_Right;
};
///////////////////////////////////////////////////////////////////////////////
//
// MiddleTree
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K >
class MiddleTree {
friend class MiddleStructure<rectKD,K>;
protected:
typedef typename rectKD::Int Int;
typedef typename rectKD::Pt Pt;
typedef MiddleStructure<rectKD,K> MTree;
typedef typename MTree::rectList rectList;
//friend class MiddleStructure<rectKD,K>;
///////////////////////////////////////////////////////////////////////////
// Core
MiddleTree(){
subTree=NULL; point=NULL;
Left=Right=NULL; type=Internal;
new_right = new_left = false;
}
~MiddleTree(){
delete subTree;
if (new_right) delete Right;
if (new_left) delete Left;
subTree = NULL;
Left=NULL;
Right=NULL;
}
bool Build( MiddleTree * leaves, int size, int level );
MiddleTree * b_search( double pt ); //biniary search on the tree
bool query(rectKD *q, const QueryInfo & info);
bool query_sub(rectKD *q, const QueryInfo & info);
///////////////////////////////////////////////////////////////////////////
// Access
void setAsLeaf(){ type=Leaf; } //set this node as lead
void setAsInternal(){ type=Internal; } //set this node as internal (default)
void setLeft(MiddleTree *l){ Left=l; } //set left child
MiddleTree * getLeft() const { return Left; } //get left child
void setRight(MiddleTree *r){ Right=r; } //set right child
MiddleTree * getRight() const { return Right; } //get right child
void setPoint( const Pt * point ){ this->point=point; }
const Pt * getPoint()const{ return point; }
///////////////////////////////////////////////////////////////////////////
enum NodeType{ Internal=0, Leaf };
///////////////////////////////////////////////////////////////////////////
RectangleTree<MTree,K> * subTree;
const Pt * point; //point value for largest value in left subtree
NodeType type; //type of this node, either internal or leaf
MiddleTree * Left;
MiddleTree * Right;
bool new_right, new_left;
};
///////////////////////////////////////////////////////////////////////////////
//
// MiddleStructure_ez
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K > class MiddleTree_ez;
template< class rectKD, int K >
class MiddleStructure_ez : public MiddleStructure<rectKD,K>
{
friend class RectangleTree<MiddleStructure_ez,K>; //the only creator of this class
typedef MiddleStructure<rectKD,K> Base;
typedef typename Base::Int Int;
typedef typename Base::Pt Pt;
typedef typename Base::rectList rectList;
typedef typename Base::ptList ptList;
protected: //only RectangleTree can create MiddleStructure
MiddleStructure_ez(){ subTree=NULL; }
typedef MiddleTree_ez<rectKD,K> Mtree;
bool Build( ptList & ptlist, int Level );
bool query( rectKD *q, QueryInfo info );
bool query_tree( rectKD *q, const QueryInfo & info );
void print(){
Mtree * leaf=(Mtree*)this->msTree_Left;
cout<<" * ";
while( leaf!=NULL ){
cout<<leaf->getPoint()->getValue()<<" ";
leaf=(Mtree*)(leaf->getRight());
}
cout<<"\n";
if( subTree!=NULL ) subTree->print();
}
RectangleTree<MiddleStructure_ez,K> * subTree;
};
///////////////////////////////////////////////////////////////////////////////
//
// MiddleTree_ez
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K >
class MiddleTree_ez : public MiddleTree<rectKD,K> {
friend class MiddleStructure_ez<rectKD,K>;
protected:
typedef MiddleStructure_ez<rectKD,K> MTree;
bool Build( MiddleTree_ez * leaves, int size, int level );
bool query(rectKD *q, const QueryInfo & info){return false;}
bool query_sub(rectKD *q, const QueryInfo & info){return false;}
};
///////////////////////////////////////////////////////////////////////////////
//
// MiddleStructure Implementation
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K > bool MiddleStructure<rectKD,K>
::Build( ptList & ptlist, int Level )
{
//check condition
if( Level>=K || Level<0 ) return false;
//build middle sub tree.
int ptSize=ptlist.size();
Mtree * leaves=new Mtree[ptSize];
if( leaves==NULL ){
cerr<<"MiddleStructure::Build Error : Not Enough Memory"<<endl;
return false;
}
for( int i=0;i<ptSize;i++ ){
leaves[i].setAsLeaf(); //deafult is internal
leaves[i].setLeft((i==0)?NULL:&leaves[i-1]);
leaves[i].setRight((i==ptSize-1)?NULL:&leaves[i+1]);
leaves[i].setPoint(ptlist[i]);
}
msTree_Left=&leaves[0];
msTree_Right=&leaves[ptSize-1];
if( ptSize==1 ){ msTree_Root=&leaves[0]; return true; }
if( (msTree_Root=new Mtree())==NULL ){
cerr<<"MiddleStructure::Build Error : Not Enough Memory"<<endl;
return false;
}
if( msTree_Root->Build(leaves,ptSize,Level)==false ){
cerr<<"MiddleStructure::Build Error"<<endl;
return false;
}
return true;
}
template< class rectKD, int K > bool MiddleStructure<rectKD,K>
::query(rectKD *q, QueryInfo info)
{
//Mtree * leaf=msTree_Left;
if( info.level==K-1 ){
return query_lastlevel(q,info);
}
else{
info.level++;
info.split_found=false;
return msTree_Root->query(q,info);
}
return false; //should not happen
}
template< class rectKD, int K > bool MiddleStructure<rectKD,K>
::query_lastlevel(rectKD *q, const QueryInfo & info)
{
Int & intval=q->getInterval(info.level);
if ( info.dir == QueryInfo::ALL ){
Mtree * leaf=msTree_Left;
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::LEFT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id);
}
leaf=leaf->getRight();
}
}
else if(info.dir==QueryInfo::LEFT_TO_RIGHT){
Mtree * leaf=msTree_Root->b_search(intval.getTo().getValue()+1e-10);
if( (*leaf->getPoint())>intval.getTo() ) leaf=leaf->getLeft();
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::LEFT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id);
}
leaf=leaf->getLeft();
}
}
else if(info.dir==QueryInfo::RIGHT_TO_LEFT){
Mtree * leaf=msTree_Root->b_search(intval.getFrom().getValue()-1e-10);
if( (*leaf->getPoint())<intval.getFrom() ) leaf=leaf->getRight();
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::RIGHT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id);
}
leaf=leaf->getRight();
}
}
return true;
}
///////////////////////////////////////////////////////////////////////////////
//
// MiddleTree Implementation
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K > bool MiddleTree<rectKD,K>
::Build( MiddleTree<rectKD,K> * leaves, int size, int level )
{
if( type==Leaf ) return false; //Leaf does not have to "buid"
int left_size=size/2; int right_size=size-left_size;
//cout<<"size="<<size<<" MiddleTree<rectKD,K> left_size="<<left_size<<" right_size="<<right_size<<endl;
if( left_size==1 ){
Left=&leaves[0];
point=Left->getPoint();
}
else{
point=leaves[left_size-1].getPoint();
if( (Left=new MiddleTree())==NULL ) return false;
Left->Build(leaves,left_size, level);
new_left = true;
}
//cout<<"1 size="<<size<<endl;
if( right_size==1 ){
Right=&leaves[left_size];
}
else{
if( (Right=new MiddleTree())==NULL ) return false;
Right->Build(&leaves[left_size],right_size, level);
new_right = true;
}
/*cout<<"A"<<endl;
cout<<"2 size="<<size<<endl;
cout<<"K="<<K<<" leve="<<level<<endl;
cout<<"B"<<endl;
*/
//build middle tree
if( level==K-1 ){
//cout<<"//there is no more sub tree"<<endl;
return true; //there is no more sub tree
}
rectList rects; rects.reserve(size);
const Pt * first=leaves[0].getPoint();
rects.push_back((rectKD*)first->getInterval()->getOwner());
for( int i=1;i<size;i++ ){
//cout<<"???@ rects size="<<rects.size()<<" size="<<size<<endl;
const Pt * point=leaves[i].getPoint();
if( point->getType()==Pt::RIGHT_ENDPOINT ){
if( point->getInterval()->getFrom()>=(*first) )
continue;
}
rects.push_back((rectKD*)point->getInterval()->getOwner());
}
//cout<<"??? rects size="<<rects.size()<<endl;
if( (subTree=new RectangleTree<MTree,K>())==NULL ) return false;
if( subTree->Build(rects,level+1)==false ) return false;
return true;
}
template< class rectKD, int K > MiddleTree<rectKD,K> *
MiddleTree<rectKD,K>::b_search( double pt )
{
if( type==Leaf ) return this;
if( pt>point->getValue() ) return Right->b_search(pt);
return Left->b_search(pt);
}
template< class rectKD, int K > bool MiddleTree<rectKD,K>::
query( rectKD *q, const QueryInfo & info )
{
if( info.dir==QueryInfo::ALL || type==Leaf ) return query_sub(q,info);
Int & intval=q->getInterval(info.level-1);
if( info.dir==QueryInfo::LEFT_TO_RIGHT ){
const Pt & pt=intval.getTo();
if( (pt.getValue()+1e-10)>point->getValue() ){
if( Left->query_sub(q,info)==false ) return false;
if( Right->query(q,info)==false ) return false;
}
else{
if( Left->query(q,info)==false ) return false;
}
}
else if( info.dir==QueryInfo::RIGHT_TO_LEFT ){
const Pt & pt=intval.getFrom();
if( (pt.getValue()-1e-10)<point->getValue() ){
if( Right->query_sub(q,info)==false ) return false;
if( Left->query(q,info)==false ) return false;
}
else{
if( Right->query(q,info)==false ) return false;
}
}
else return false; //unknow dir
return true;
}
template< class rectKD, int K > bool MiddleTree<rectKD,K>::
query_sub(rectKD *q, const QueryInfo & info)
{
if( type!=Leaf ){
if( subTree==NULL ) return false;
return subTree->query(q,info);
}
//leaf
rectKD * rect=(rectKD *)point->getInterval()->getOwner();
for( int l=info.level-1; l<K; l++ ){
Int & i1=q->getInterval(l);
Int & i2=rect->getInterval(l);
if( i1.getTo()<i2.getFrom() ) return true; //not intersect
if( i1.getFrom()>i2.getTo() ) return true; //not intersect
}
q->intersects(rect->getVID());
return true;
}
///////////////////////////////////////////////////////////////////////////////
//
// MiddleStructure_ez Implementation
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K > bool MiddleStructure_ez<rectKD,K>
::Build( ptList & ptlist, int Level )
{
//check condition
if( Level>=K || Level<0 ) return false;
//build middle sub tree.
int ptSize=ptlist.size();
Mtree * leaves=new Mtree[ptSize];
if( leaves==NULL ){
cerr<<"MiddleStructure::Build Error : Not Enough Memory"<<endl;
return false;
}
for( int i=0;i<ptSize;i++ ){
leaves[i].setAsLeaf(); //deafult is internal
leaves[i].setLeft((i==0)?NULL:&leaves[i-1]);
leaves[i].setRight((i==ptSize-1)?NULL:&leaves[i+1]);
leaves[i].setPoint(ptlist[i]);
}
this->msTree_Left=&leaves[0];
this->msTree_Right=&leaves[ptSize-1];
if( ptSize==1 ){ this->msTree_Root=&leaves[0]; return true; }
if( (this->msTree_Root=new Mtree())==NULL ){
cerr<<"MiddleStructure::Build Error : Not Enough Memory"<<endl;
return false;
}
if( ((Mtree*)this->msTree_Root)->Build(leaves,ptSize,Level)==false ){
cerr<<"MiddleStructure::Build Error"<<endl;
return false;
}
if( Level<K-1 ){
//build lower dimensional tree
rectList rects; rects.reserve(ptSize/2);
typedef typename ptList::iterator IT;
for(IT iP=ptlist.begin();iP!=ptlist.end();iP++ ){
if( (*iP)->getType()==Pt::RIGHT_ENDPOINT ) continue;
rects.push_back((rectKD*)(*iP)->getInterval()->getOwner());
}
if( (subTree=new RectangleTree<MiddleStructure_ez,K>())==NULL ) return false;
if( subTree->Build(rects,Level+1)==false ) return false;
}
return true;
}
template< class rectKD, int K > bool MiddleStructure_ez<rectKD,K>
::query(rectKD *q, QueryInfo info)
{
query_tree(q,info);
if( info.level<K-1 ){
QueryInfo newinfo; newinfo.level=info.level+1;
if( subTree->query(q,newinfo)==false ) return false;
}
return true;
}
template< class rectKD, int K > bool MiddleStructure_ez<rectKD,K>
::query_tree(rectKD *q, const QueryInfo & info)
{
Int & intval=q->getInterval(info.level);
if ( info.dir == QueryInfo::ALL ){
Mtree * leaf=(Mtree *)this->msTree_Left;
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::LEFT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id,info.level);
}
leaf=(Mtree *)(leaf->getRight());
}
}
else if(info.dir==QueryInfo::LEFT_TO_RIGHT){
Mtree * leaf=(Mtree *)((Mtree*)this->msTree_Root)->b_search(intval.getTo().getValue()+1e-10);
if( (*leaf->getPoint())>intval.getTo() ) leaf=(Mtree *)(leaf->getLeft());
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::LEFT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id,info.level);
}
leaf=(Mtree *)(leaf->getLeft());
}
}
else if(info.dir==QueryInfo::RIGHT_TO_LEFT){
Mtree * leaf=(Mtree *)((Mtree*)this->msTree_Root)->b_search(intval.getFrom().getValue()-1e-10);
if( (*leaf->getPoint())<intval.getFrom() ) leaf=(Mtree *)(leaf->getRight());
while( leaf!=NULL ){
if (leaf->getPoint()->getType() == Pt::RIGHT_ENDPOINT){
VID id=leaf->getPoint()->getInterval()->getOwner()->getVID();
q->intersects(id,info.level);
}
leaf=(Mtree *)(leaf->getRight());
}
}
return true;
}
///////////////////////////////////////////////////////////////////////////////
//
// MiddleTree_ez Implementation
//
///////////////////////////////////////////////////////////////////////////////
template< class rectKD, int K > bool MiddleTree_ez<rectKD,K>
::Build( MiddleTree_ez<rectKD,K> * leaves, int size, int level )
{
typedef MiddleTree_ez<rectKD,K> me;
if( this->type==this->Leaf ) return false; //Leaf does not have to "buid"
int left_size=size/2; int right_size=size-left_size;
if( left_size==1 ){
this->Left=&leaves[0];
this->point=((me *)this->Left)->getPoint();
}
else{
this->point=leaves[left_size-1].getPoint();
if( (this->Left=new MiddleTree_ez())==NULL ) return false;
((me *)this->Left)->Build(leaves,left_size, level);
}
if( right_size==1 ) this->Right=&leaves[left_size];
else{
if( (this->Right=new MiddleTree_ez())==NULL ) return false;
((me *)this->Right)->Build(&leaves[left_size],right_size, level);
}
return true;
}
#endif //_MIDDLE_STRUCTURE_H_
| 32.270364 | 108 | 0.522664 |
1254d627d5b6995c3a1bd9483c00508a17fb1d4f | 611 | h | C | gui/voip/linux/VideoFrameLinux.h | Vavilon3000/icq | 9fe7a3c42c07eb665d2e3b0ec50052de382fd89c | [
"Apache-2.0"
] | 1 | 2021-03-18T20:00:07.000Z | 2021-03-18T20:00:07.000Z | gui/voip/linux/VideoFrameLinux.h | Vavilon3000/icq | 9fe7a3c42c07eb665d2e3b0ec50052de382fd89c | [
"Apache-2.0"
] | null | null | null | gui/voip/linux/VideoFrameLinux.h | Vavilon3000/icq | 9fe7a3c42c07eb665d2e3b0ec50052de382fd89c | [
"Apache-2.0"
] | null | null | null | #ifndef __VIDEO_FRAME_LINUX_H__
#define __VIDEO_FRAME_LINUX_H__
#include <QWidget>
#include "../VideoFrame.h"
#include <GLFW/glfw3.h>
#include <mutex>
namespace Ui
{
class BaseVideoPanel;
}
namespace platform_linux
{
class GraphicsPanelLinux : public platform_specific::GraphicsPanel
{
Q_OBJECT
public:
GraphicsPanelLinux(QWidget* _parent, std::vector<Ui::BaseVideoPanel*>& _panels, bool primaryVideo);
virtual ~GraphicsPanelLinux();
WId frameId() const;
void resizeEvent(QResizeEvent * event) override;
private:
GLFWwindow *_videoWindow;
};
}
#endif//__VIDEO_FRAME_WIN32_H__
| 18.515152 | 103 | 0.756137 |
c44fcfc2c76173817807e1835f75e36b3fb3c9d2 | 1,877 | h | C | D#0003-optimizing_cosine_distance_searching_in_a_million_feature-set/code/search_best.h | awesome-archive/CaptainBlackboard | c8ec5f1adf2301724a3a864890df6c0bcb598505 | [
"MIT"
] | 961 | 2019-01-30T01:46:26.000Z | 2022-03-31T01:09:39.000Z | D#0003-optimizing_cosine_distance_searching_in_a_million_feature-set/code/search_best.h | zhangshaokun999/CaptainBlackboard | f0f6781f55cf24d2bcb28cb65ef124505d411e27 | [
"MIT"
] | 125 | 2019-02-20T14:24:17.000Z | 2021-04-22T12:33:08.000Z | D#0003-optimizing_cosine_distance_searching_in_a_million_feature-set/code/search_best.h | zhangshaokun999/CaptainBlackboard | f0f6781f55cf24d2bcb28cb65ef124505d411e27 | [
"MIT"
] | 171 | 2019-09-30T01:36:18.000Z | 2022-03-23T06:37:02.000Z | #ifndef _SEARCHBEST_
#define _SEARCHBEST_
#include <assert.h>
#include <cmath>
#include <float.h>
#include <climits>
// use openblas
#include <cblas.h>
#include "cosine_similarity.h"
// Step 1, g++ main.cpp search_best.cpp cosine_similarity.cpp -std=c++11
// Step 2, g++ main.cpp search_best.cpp cosine_similarity.cpp -std=c++11 -O3
// Step 3, g++ main.cpp search_best.cpp cosine_similarity.cpp -std=c++11 -O3 -Ofast -ffast-math
template <typename T>
int SearchBest(const T* __restrict__ const pVecA, // 待搜索的单个特征向量首地址
const int lenA, // 待搜索特征向量长度(1 x 单个特征维数)
const T* __restrict__ const pVecDB, // 底库首地址
const int lenDB) // 底库长度(特征个数 x 单个特征维数)
{
assert(lenDB%lenA == 0);
const int featsize = lenA;
const int facenum = lenDB / lenA;
int best_index = - INT_MAX;
T best_similarity = - FLT_MAX;
#if 0
// Step 5, 加上OpenMP
//GCC很聪明,OpenMP默认线程数就是多核处理器的核心数量,不必显示指定
//OpenMP起线程,收回线程也是有开销的,所以要合理安排每个线程的任务量大小,不宜放入内层for循环(任务量太小划不来)
//#pragma omp parallel for num_threads(8)
#pragma omp parallel for
for(int i = 0; i < facenum; i++) {
// 普通C++代码实现的余弦相似度计算
T similarity = Cosine_similarity(pVecA, pVecDB + i*featsize, featsize);
// 使用向量化代码实现的余弦相似度计算
//T similarity = Cosine_similarity_avx(pVecA, pVecDB + i*featsize, featsize);
if(similarity > best_similarity) {
best_similarity = similarity;
best_index = i;
}
}
#else
// Step 12,使用OpenBLAS
T simAll[facenum] = {0.0f};
cblas_sgemv(CblasRowMajor, CblasNoTrans, facenum, featsize, 1, pVecDB, featsize, pVecA, 1, 0, simAll, 1);
// 寻找simAll里面最大的,它的序号就是要找的id
for(int i = 0; i < facenum; i++) {
if(simAll[i] > best_similarity) {
best_similarity = simAll[i];
best_index = i;
}
}
#endif
return best_index;
}
#endif //!_SEARCHBEST_
| 30.770492 | 109 | 0.649441 |
e20eadc0e2bce9b1c2436a7d3801f52d44b35529 | 1,305 | c | C | src/svshm.c | xingfeng2510/tlpi | 915e4e391cee08d402e6af054ea3ee3f4fef2128 | [
"Apache-2.0"
] | null | null | null | src/svshm.c | xingfeng2510/tlpi | 915e4e391cee08d402e6af054ea3ee3f4fef2128 | [
"Apache-2.0"
] | null | null | null | src/svshm.c | xingfeng2510/tlpi | 915e4e391cee08d402e6af054ea3ee3f4fef2128 | [
"Apache-2.0"
] | null | null | null | #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdlib.h>
#include <stdio.h>
#include "common.h"
int main(int argc, char *argv[])
{
int shmid;
void *addr, *addr2;
size_t page_size;
page_size = sysconf(_SC_PAGESIZE);
if (page_size == -1)
handle_error("sysconf");
shmid = shmget(IPC_PRIVATE, 8*page_size, IPC_CREAT | S_IRUSR | S_IWUSR);
if (shmid == -1)
handle_error("shmget");
if (shmctl(shmid, SHM_LOCK, NULL) == -1)
handle_error("shmctl - lock");
printf("shmid=%d\n", shmid);
addr = shmat(shmid, NULL, 0);
if (addr == (void *) -1)
handle_error("shmat 1");
printf("%d -> %p\n", shmid, addr);
for (int i = 0; i < 8; i++)
*((char *) addr + i * page_size) = 'a';
addr2 = shmat(shmid, NULL, SHM_RDONLY);
if (addr2 == (void *) -1)
handle_error("shmat 2");
printf("%d -> %p\n", shmid, addr2);
printf("sleeping 5 seconds\n");
sleep(5);
if (shmdt(addr2) == -1)
handle_error("shmdt 2");
if (shmdt(addr) == -1)
handle_error("shmdt");
if (shmctl(shmid, IPC_RMID, 0) == -1)
handle_error("shmctl - rmid");
printf("shmdt/shmctl done\n");
sleep(5);
exit(EXIT_SUCCESS);
}
| 22.894737 | 76 | 0.559387 |
420cd3b09e5b1863033ea9412b23ac225da7f48a | 1,191 | h | C | src/ram/Operation.h | langston-barrett/souffle | ff495925363f920b63e51aeb580aa03952005ba9 | [
"UPL-1.0"
] | 570 | 2016-03-15T15:17:18.000Z | 2022-03-27T09:47:45.000Z | src/ram/Operation.h | langston-barrett/souffle | ff495925363f920b63e51aeb580aa03952005ba9 | [
"UPL-1.0"
] | 1,744 | 2016-03-16T19:19:19.000Z | 2022-03-31T21:28:28.000Z | src/ram/Operation.h | langston-barrett/souffle | ff495925363f920b63e51aeb580aa03952005ba9 | [
"UPL-1.0"
] | 183 | 2016-03-12T17:51:20.000Z | 2022-03-24T12:03:47.000Z | /*
* Souffle - A Datalog Compiler
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved
* Licensed under the Universal Permissive License v 1.0 as shown at:
* - https://opensource.org/licenses/UPL
* - <souffle root>/licenses/SOUFFLE-UPL.txt
*/
/************************************************************************
*
* @file Operation.h
*
* Defines the Operation of a relational algebra query.
*
***********************************************************************/
#pragma once
#include "ram/Node.h"
#include <iosfwd>
namespace souffle::ram {
/**
* @class Operation
* @brief Abstract class for a relational algebra operation
*/
class Operation : public Node {
public:
Operation* cloning() const override = 0;
protected:
void print(std::ostream& os) const override {
print(os, 0);
}
/** @brief Pretty print with indentation */
virtual void print(std::ostream& os, int tabpos) const = 0;
/** @brief Pretty print jump-bed */
static void print(const Operation* operation, std::ostream& os, int tabpos) {
operation->print(os, tabpos);
}
friend class Query;
};
} // namespace souffle::ram
| 24.8125 | 81 | 0.586062 |
3f22b00da2d807d4207c5a776d185eb02b40cad8 | 2,365 | h | C | src/language.h | SKRYMr/fastText | 5edd56142e794cfa0fbe0d6ffb5730e895b59f8f | [
"MIT"
] | null | null | null | src/language.h | SKRYMr/fastText | 5edd56142e794cfa0fbe0d6ffb5730e895b59f8f | [
"MIT"
] | null | null | null | src/language.h | SKRYMr/fastText | 5edd56142e794cfa0fbe0d6ffb5730e895b59f8f | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <istream>
#include <memory>
#include <ostream>
#include <random>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace fasttext {
typedef int32_t id_type;
enum class entry_type : int8_t { word = 0, label = 1 };
struct entry {
std::string word;
int64_t count;
entry_type type;
std::vector<int32_t> subwords;
};
struct lang {
uint8_t MAXLEN;
std::unordered_set<std::string> PROFANITY;
std::unordered_set<std::string> STOPWORDS;
};
class Language {
std::unordered_map<std::string, uint8_t> LONGEST_WORDS = {{"en", 24}, {"it", 24}, {"de", 32}, {"fr", 24}, {"es", 23}, {"pt", 24}};
// STRICT_PUNCT is forbidden at the beginning and end of the word
const std::unordered_set<std::string> STRICT_PUNCT{"&", "-"};
// PUNCT is forbidden anywhere inside the word
const std::vector<char*> PUNCT = {"!", "\"", "#", "$", "%", "\\", "\'", "(", ")", "*", "+", ",", ".", "/", ":", ";", "<", "=", ">", "?", "@", "[", "]", "^", "_", "`", "{", "|", "}", "~"};
protected:
lang lang_;
std::unordered_set<std::string> dict_;
std::unordered_set<std::string> load(const std::string&);
public:
Language(const std::string& lang);
std::vector<entry> words;
uint8_t max() {
return lang_.MAXLEN;
};
void init(const std::string& lang);
void addWord(const entry);
bool isWord(const std::string); // check that there is at least a letter
bool isDuplicate(std::string); // check that the word isn't already present after stripping punctuation and lowercasing,
// also check that individual tokens are present in the model after splitting on punctuation?
bool isProfanity(const std::string); // dictionary-based check that word is not profanity
bool isStopword(const std::string); // check that word is not a stopword
bool isWeb(const std::string); // check that word is not an URL and that it's not an HTML tag
bool isUUID(const std::string); // check that word is not a UUID (apparently very common)
};
} // namespace fasttext
| 32.847222 | 191 | 0.622833 |
e9584565f684028b098539c60ec9ea8c1ecf9a40 | 5,876 | c | C | t/00unit/lib/handler/mimemap.c | mingodad/h2o | 7c471d5807808d63715243ace65eea319b9021f9 | [
"MIT"
] | 7 | 2015-05-27T23:01:46.000Z | 2020-02-17T21:51:36.000Z | t/00unit/lib/handler/mimemap.c | mingodad/h2o | 7c471d5807808d63715243ace65eea319b9021f9 | [
"MIT"
] | null | null | null | t/00unit/lib/handler/mimemap.c | mingodad/h2o | 7c471d5807808d63715243ace65eea319b9021f9 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2014 DeNA Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "../../test.h"
#include "../../../../lib/handler/mimemap.c"
static void test_default_attributes(void)
{
h2o_mime_attributes_t attr;
h2o_mimemap_get_default_attributes("text/plain", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL);
h2o_mimemap_get_default_attributes("text/plain; charset=utf-8", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL);
h2o_mimemap_get_default_attributes("application/xhtml+xml", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL);
h2o_mimemap_get_default_attributes("application/xhtml+xml; charset=utf-8", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL);
h2o_mimemap_get_default_attributes("text/css", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_HIGHEST);
h2o_mimemap_get_default_attributes("text/css; charset=utf-8", &attr);
ok(attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_HIGHEST);
h2o_mimemap_get_default_attributes("application/octet-stream", &attr);
ok(!attr.is_compressible);
ok(attr.priority == H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL);
}
static int is_mimetype(h2o_mimemap_type_t *type, const char *expected)
{
return type->type == H2O_MIMEMAP_TYPE_MIMETYPE && type->data.mimetype.len == strlen(expected) &&
memcmp(type->data.mimetype.base, expected, type->data.mimetype.len) == 0;
}
static void test_basic()
{
h2o_mimemap_t *mimemap = h2o_mimemap_create(), *mimemap2;
subtest("default-attributes", test_default_attributes);
/* default and set default */
ok(is_mimetype(h2o_mimemap_get_default_type(mimemap), "application/octet-stream"));
{
char buf[sizeof("text/plain")];
strcpy(buf, "text/plain");
h2o_mimemap_set_default_type(mimemap, buf, NULL);
memset(buf, 0, sizeof(buf));
}
ok(is_mimetype(h2o_mimemap_get_default_type(mimemap), "text/plain"));
/* set and overwrite */
h2o_mimemap_define_mimetype(mimemap, "foo", "example/foo", NULL);
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))), "example/foo"));
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("FOO"))), "example/foo"));
ok(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))) ==
h2o_mimemap_get_type_by_mimetype(mimemap, h2o_iovec_t::create(H2O_STRLIT("example/foo")), 0));
h2o_mimemap_define_mimetype(mimemap, "foo", "example/overwritten", NULL);
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))), "example/overwritten"));
ok(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))) ==
h2o_mimemap_get_type_by_mimetype(mimemap, h2o_iovec_t::create(H2O_STRLIT("example/overwritten")), 0));
ok(h2o_mimemap_get_type_by_mimetype(mimemap, h2o_iovec_t::create(H2O_STRLIT("example/foo")), 0) == NULL);
/* clone and release */
mimemap2 = h2o_mimemap_clone(mimemap);
ok(is_mimetype(h2o_mimemap_get_default_type(mimemap2), "text/plain"));
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap2, h2o_iovec_t::create(H2O_STRLIT("foo"))), "example/overwritten"));
ok(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))) ==
h2o_mimemap_get_type_by_mimetype(mimemap, h2o_iovec_t::create(H2O_STRLIT("example/overwritten")), 0));
h2o_mem_release_shared(mimemap2);
/* check original */
ok(is_mimetype(h2o_mimemap_get_default_type(mimemap), "text/plain"));
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))), "example/overwritten"));
/* remove */
h2o_mimemap_remove_type(mimemap, "foo");
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))), "text/plain"));
ok(h2o_mimemap_get_type_by_mimetype(mimemap, h2o_iovec_t::create(H2O_STRLIT("example/overwritten")), 0) == NULL);
h2o_mimemap_remove_type(mimemap, "foo");
ok(is_mimetype(h2o_mimemap_get_type_by_extension(mimemap, h2o_iovec_t::create(H2O_STRLIT("foo"))), "text/plain"));
h2o_mem_release_shared(mimemap);
}
static void test_dynamic()
{
h2o_mimemap_t *mimemap = h2o_mimemap_create();
const char *exts[] = {".php", NULL};
h2o_globalconf_t global = {};
h2o_mimemap_define_dynamic(mimemap, exts, &global);
h2o_mem_release_shared(mimemap);
}
void test_lib__handler__mimemap_c()
{
subtest("basic", test_basic);
subtest("dynamic", test_dynamic);
}
| 45.90625 | 128 | 0.743022 |
64cf8d902cf921dae891049f0416927b79443ddf | 828 | h | C | QZPengKe/QZUtils/MobScreenShare/MobScreenshotCenter.h | qzWhy/QZPengKe | dae0eeb788a1d6d89124ab668473ed571865ce1f | [
"MIT"
] | null | null | null | QZPengKe/QZUtils/MobScreenShare/MobScreenshotCenter.h | qzWhy/QZPengKe | dae0eeb788a1d6d89124ab668473ed571865ce1f | [
"MIT"
] | null | null | null | QZPengKe/QZUtils/MobScreenShare/MobScreenshotCenter.h | qzWhy/QZPengKe | dae0eeb788a1d6d89124ab668473ed571865ce1f | [
"MIT"
] | null | null | null | //
// MobScreenshotCenter.h
// MobScreenShareDome
//
// Created by youzu on 17/1/23.
// Copyright © 2017年 mob. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, SSEScreenCaptureUIMode){
//全屏幕主要界面
SSEScreenCaptureUIModeDefault = 0,
//提示界面
SSEScreenCaptureUIModeAlert = 1
};
/**
监听截屏时间 iOS7及以上支持
*/
@interface MobScreenshotCenter : NSObject
+ (MobScreenshotCenter *)shareInstance;
/**
启动截屏监听
*/
- (void)start;
/**
停止截屏监听
*/
- (void)stop;
/**
截图并显示UI
@param mode 现实的UI模式
@param duration 持续时间 SSEScreenCaptureUIModeAlert 模式生效
@param useClientShare 是否优先使用客户端进行分享
*/
- (void)screenCaptureShareWithMode:(SSEScreenCaptureUIMode)mode
duration:(NSTimeInterval)duration
useClientShare:(BOOL)useClientShare;
@end
| 17.617021 | 63 | 0.689614 |
d413db82de59e5c471fcccc180a65c45fe46f2a4 | 3,464 | h | C | ext/drsyms/drsyms_obj.h | uci-plrg/blackbox | 1f567bd58769501334843fc1714141f669c27ee5 | [
"BSD-3-Clause"
] | 2 | 2016-03-19T23:37:25.000Z | 2016-06-18T16:43:46.000Z | ext/drsyms/drsyms_obj.h | uci-plrg/blackbox | 1f567bd58769501334843fc1714141f669c27ee5 | [
"BSD-3-Clause"
] | null | null | null | ext/drsyms/drsyms_obj.h | uci-plrg/blackbox | 1f567bd58769501334843fc1714141f669c27ee5 | [
"BSD-3-Clause"
] | 2 | 2016-06-24T20:51:01.000Z | 2019-12-26T02:07:06.000Z | /* **********************************************************
* Copyright (c) 2011-2013 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 VMware, 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 VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/* drsyms UNIX arch-specific (ELF or PECOFF) header, separated so we don't
* have to include dwarf.h everywhere
*/
#ifndef DRSYMS_ARCH_H
#define DRSYMS_ARCH_H
#include "drsyms.h"
#include "dwarf.h"
#include "libdwarf.h"
/***************************************************************************
* Platform-specific: Linux (ELF) or Cygwin (PECOFF)
*/
void
drsym_obj_init(void);
void *
drsym_obj_mod_init_pre(byte *map_base, size_t file_size);
bool
drsym_obj_mod_init_post(void *mod_in);
bool
drsym_obj_dwarf_init(void *mod_in, Dwarf_Debug *dbg);
void
drsym_obj_mod_exit(void *mod_in);
drsym_debug_kind_t
drsym_obj_info_avail(void *mod_in);
byte *
drsym_obj_load_base(void *mod_in);
const char *
drsym_obj_debuglink_section(void *mod_in);
uint
drsym_obj_num_symbols(void *mod_in);
const char *
drsym_obj_symbol_name(void *mod_in, uint idx);
/* For a symbol that should be skipped (e.g., it's an import symbol in
* the same table being indexed), returns DRSYM_ERROR_SYMBOL_NOT_FOUND
* and 0 for *offs_start.
*/
drsym_error_t
drsym_obj_symbol_offs(void *mod_in, uint idx, size_t *offs_start OUT,
size_t *offs_end OUT);
drsym_error_t
drsym_obj_addrsearch_symtab(void *mod_in, size_t modoffs, uint *idx OUT);
bool
drsym_obj_same_file(const char *path1, const char *path2);
const char *
drsym_obj_debug_path(void);
/***************************************************************************
* DWARF
*/
void *
drsym_dwarf_init(Dwarf_Debug dbg, byte *load_base);
void
drsym_dwarf_exit(void *mod_in);
bool
drsym_dwarf_search_addr2line(void *mod_in, Dwarf_Addr pc, drsym_info_t *sym_info INOUT);
drsym_error_t
drsym_dwarf_enumerate_lines(void *mod_in, drsym_enumerate_lines_cb callback, void *data);
#endif /* DRSYMS_ARCH_H */
| 30.928571 | 89 | 0.703522 |
6a0428a8c913be3a962d1764cfce2bb0f1dc5698 | 87 | h | C | third_party/aten/src/THS/THS.h | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 58 | 2019-01-03T02:20:41.000Z | 2022-02-25T14:24:13.000Z | third_party/aten/src/THS/THS.h | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 6 | 2019-02-12T03:52:08.000Z | 2020-12-17T02:40:37.000Z | third_party/aten/src/THS/THS.h | gautamkmr/caffe2 | cde7f21d1e34ec714bc08dbfab945a1ad30e92ff | [
"MIT"
] | 5 | 2019-01-03T06:46:04.000Z | 2019-10-29T07:40:11.000Z | #ifndef THS_INC
#define THS_INC
#include "THGeneral.h"
#include "THSTensor.h"
#endif
| 10.875 | 22 | 0.747126 |
582797fac107c307329071e5bda31929fc1b22b8 | 4,920 | h | C | dlib/bit_stream/bit_stream_kernel_c.h | ckproc/dlib-19.7 | 0ca40f5e85de2436e557bee9a805d3987d2d9507 | [
"BSL-1.0"
] | 1 | 2016-10-11T18:37:52.000Z | 2016-10-11T18:37:52.000Z | dlib/bit_stream/bit_stream_kernel_c.h | ckproc/dlib-19.7 | 0ca40f5e85de2436e557bee9a805d3987d2d9507 | [
"BSL-1.0"
] | 4 | 2018-02-27T15:44:25.000Z | 2018-02-28T01:26:03.000Z | dlib/bit_stream/bit_stream_kernel_c.h | ckproc/dlib-19.7 | 0ca40f5e85de2436e557bee9a805d3987d2d9507 | [
"BSL-1.0"
] | 4 | 2016-04-19T06:15:01.000Z | 2020-01-02T11:11:57.000Z | // Copyright (C) 2003 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BIT_STREAM_KERNEl_C_
#define DLIB_BIT_STREAM_KERNEl_C_
#include "bit_stream_kernel_abstract.h"
#include "../algs.h"
#include "../assert.h"
#include <iosfwd>
namespace dlib
{
template <
typename bit_stream_base // implements bit_stream/bit_stream_kernel_abstract.h
>
class bit_stream_kernel_c : public bit_stream_base
{
public:
void set_input_stream (
std::istream& is
);
void set_output_stream (
std::ostream& os
);
void close (
);
void write (
int bit
);
bool read (
int& bit
);
};
template <
typename bit_stream_base
>
inline void swap (
bit_stream_kernel_c<bit_stream_base>& a,
bit_stream_kernel_c<bit_stream_base>& b
) { a.swap(b); }
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// member function definitions
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <
typename bit_stream_base
>
void bit_stream_kernel_c<bit_stream_base>::
set_input_stream (
std::istream& is
)
{
// make sure requires clause is not broken
DLIB_CASSERT(( this->is_in_write_mode() == false ) && ( this->is_in_read_mode() == false ),
"\tvoid bit_stream::set_intput_stream"
<< "\n\tbit_stream must not be in write or read mode"
<< "\n\tthis: " << this
);
// call the real function
bit_stream_base::set_input_stream(is);
}
// ----------------------------------------------------------------------------------------
template <
typename bit_stream_base
>
void bit_stream_kernel_c<bit_stream_base>::
set_output_stream (
std::ostream& os
)
{
// make sure requires clause is not broken
DLIB_CASSERT(( this->is_in_write_mode() == false ) && ( this->is_in_read_mode() == false ),
"\tvoid bit_stream::set_output_stream"
<< "\n\tbit_stream must not be in write or read mode"
<< "\n\tthis: " << this
);
// call the real function
bit_stream_base::set_output_stream(os);
}
// ----------------------------------------------------------------------------------------
template <
typename bit_stream_base
>
void bit_stream_kernel_c<bit_stream_base>::
close (
)
{
// make sure requires clause is not broken
DLIB_CASSERT(( this->is_in_write_mode() == true ) || ( this->is_in_read_mode() == true ),
"\tvoid bit_stream::close"
<< "\n\tyou can't close a bit_stream that isn't open"
<< "\n\tthis: " << this
);
// call the real function
bit_stream_base::close();
}
// ----------------------------------------------------------------------------------------
template <
typename bit_stream_base
>
void bit_stream_kernel_c<bit_stream_base>::
write (
int bit
)
{
// make sure requires clause is not broken
DLIB_CASSERT(( this->is_in_write_mode() == true ) && ( bit == 0 || bit == 1 ),
"\tvoid bit_stream::write"
<< "\n\tthe bit stream bust be in write mode and bit must be either 1 or 0"
<< "\n\tis_in_write_mode() == " << this->is_in_write_mode()
<< "\n\tbit == " << bit
<< "\n\tthis: " << this
);
// call the real function
bit_stream_base::write(bit);
}
// ----------------------------------------------------------------------------------------
template <
typename bit_stream_base
>
bool bit_stream_kernel_c<bit_stream_base>::
read (
int& bit
)
{
// make sure requires clause is not broken
DLIB_CASSERT(( this->is_in_read_mode() == true ),
"\tbool bit_stream::read"
<< "\n\tyou can't read from a bit_stream that isn't in read mode"
<< "\n\tthis: " << this
);
// call the real function
return bit_stream_base::read(bit);
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BIT_STREAM_KERNEl_C_
| 28.439306 | 101 | 0.440244 |
5bebd81be26124cb4ba89649e34df95b19ccb3ba | 1,916 | h | C | FreeBSD/gnu/usr.bin/cc/include/__wmmintrin_pclmul.h | TigerBSD/FreeBSD-Custom-ThinkPad | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | 4 | 2016-08-22T22:02:55.000Z | 2017-03-04T22:56:44.000Z | FreeBSD/gnu/usr.bin/cc/include/__wmmintrin_pclmul.h | TigerBSD/FreeBSD-Custom-ThinkPad | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | 21 | 2016-08-11T09:43:43.000Z | 2017-01-29T12:52:56.000Z | FreeBSD/gnu/usr.bin/cc/include/__wmmintrin_pclmul.h | TigerBSD/TigerBSD | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
] | null | null | null | /*-
* Copyright 2013 John-Mark Gurney
* 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 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 AUTHOR 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.
*
* $FreeBSD$
*
*/
#ifndef _WMMINTRIN_PCLMUL_H_
#define _WMMINTRIN_PCLMUL_H_
#include <emmintrin.h>
/*
* c selects which parts of a and b to multiple:
* 0x00: a[ 63: 0] * b[ 63: 0]
* 0x01: a[127:64] * b[ 63: 0]
* 0x10: a[ 63: 0] * b[127:64]
* 0x11: a[127:64] * b[127:64]
*/
#define _mm_clmulepi64_si128(a, b, c) \
({ \
__m128i _a = (a); \
__m128i _b = (b); \
\
__asm__("pclmulqdq %3, %2, %0": "=x" (_a): "0" (_a), "xm" (_b), \
"i" (c)); \
\
_a; \
})
#endif /* _WMMINTRIN_PCLMUL_H_ */
| 35.481481 | 77 | 0.684238 |
55de2c4fa0fb4f21fd64f4220502f0f4f471e037 | 7,348 | c | C | linux/arch/m68knommu/platform/68328/traps.c | CodeAsm/PS1Linux | 8c3c4d9ffccf446dd061a38186efc924da8a66be | [
"CC0-1.0"
] | 4 | 2020-01-01T20:26:42.000Z | 2021-10-17T21:51:58.000Z | linux/arch/m68knommu/platform/68328/traps.c | CodeAsm/PS1Linux | 8c3c4d9ffccf446dd061a38186efc924da8a66be | [
"CC0-1.0"
] | 4 | 2020-07-23T11:20:30.000Z | 2020-07-24T20:09:09.000Z | linux/arch/m68knommu/platform/68328/traps.c | CodeAsm/PS1Linux | 8c3c4d9ffccf446dd061a38186efc924da8a66be | [
"CC0-1.0"
] | null | null | null | /*
* linux/arch/$(ARCH)/platform/$(PLATFORM)/traps.c -- general exception handling code
*
* Cloned from Linux/m68k.
*
* No original Copyright holder listed,
* Probabily original (C) Roman Zippel (assigned DJD, 1999)
*
* Copyright 2000-2001 Lineo, Inc. D. Jeff Dionne <jeff@lineo.ca>
* Copyright 1999-2000 D. Jeff Dionne, <jeff@uclinux.org>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
#include <linux/errno.h>
#include <asm/system.h>
#include <asm/irq.h>
#include <asm/traps.h>
#include <asm/page.h>
#include <asm/machdep.h>
/* table for system interrupt handlers */
static irq_handler_t irq_list[SYS_IRQS];
static const char *default_names[SYS_IRQS] = {
"spurious int", "int1 handler", "int2 handler", "int3 handler",
"int4 handler", "int5 handler", "int6 handler", "int7 handler"
};
/* The number of spurious interrupts */
volatile unsigned int num_spurious;
#define NUM_IRQ_NODES 16
static irq_node_t nodes[NUM_IRQ_NODES];
#if defined( CONFIG_M68328 ) || defined ( CONFIG_M68EZ328 )
asm ("
.global _start, __ramend
.section .romvec
e_vectors:
.long __ramend-4, _start, buserr, trap, trap, trap, trap, trap
.long trap, trap, trap, trap, trap, trap, trap, trap
.long trap, trap, trap, trap, trap, trap, trap, trap
.long trap, trap, trap, trap
.long trap, trap, trap, trap
/*.long inthandler, inthandler, inthandler, inthandler
.long inthandler4, inthandler, inthandler, inthandler */
/* TRAP #0-15 */
.long system_call, trap, trap, trap, trap, trap, trap, trap
.long trap, trap, trap, trap, trap, trap, trap, trap
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.text
ignore: rte
");
#endif /* CONFIG_M68328 || CONFIG_M68EZ328 */
/*
* void init_IRQ(void)
*
* Parameters: None
*
* Returns: Nothing
*
* This function should be called during kernel startup to initialize
* the IRQ handling routines.
*/
void init_IRQ(void)
{
int i;
for (i = 0; i < SYS_IRQS; i++) {
if (mach_default_handler)
irq_list[i].handler = (*mach_default_handler)[i];
else
irq_list[i].handler = NULL;
irq_list[i].flags = IRQ_FLG_STD;
irq_list[i].dev_id = NULL;
irq_list[i].devname = default_names[i];
}
for (i = 0; i < NUM_IRQ_NODES; i++)
nodes[i].handler = NULL;
mach_init_IRQ ();
}
irq_node_t *new_irq_node(void)
{
irq_node_t *node;
short i;
for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--)
if (!node->handler)
return node;
printk ("new_irq_node: out of nodes\n");
return NULL;
}
int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
{
if (irq)
return mach_request_irq(irq, handler, flags, devname, dev_id);
if (irq < IRQ1 || irq > IRQ7) {
printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
return -ENXIO;
}
if (!(irq_list[irq].flags & IRQ_FLG_STD)) {
if (irq_list[irq].flags & IRQ_FLG_LOCK) {
printk("%s: IRQ %d from %s is not replaceable\n",
__FUNCTION__, irq, irq_list[irq].devname);
return -EBUSY;
}
if (flags & IRQ_FLG_REPLACE) {
printk("%s: %s can't replace IRQ %d from %s\n",
__FUNCTION__, devname, irq, irq_list[irq].devname);
return -EBUSY;
}
}
irq_list[irq].handler = handler;
irq_list[irq].flags = flags;
irq_list[irq].dev_id = dev_id;
irq_list[irq].devname = devname;
return 0;
}
void free_irq(unsigned int irq, void *dev_id)
{
if (irq) {
mach_free_irq(irq, dev_id);
return;
}
if (irq < IRQ1 || irq > IRQ7) {
printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
return;
}
if (irq_list[irq].dev_id != dev_id)
printk("%s: Removing probably wrong IRQ %d from %s\n",
__FUNCTION__, irq, irq_list[irq].devname);
if (mach_default_handler)
irq_list[irq].handler = (*mach_default_handler)[irq];
else
irq_list[irq].handler = NULL;
irq_list[irq].flags = IRQ_FLG_STD;
irq_list[irq].dev_id = NULL;
irq_list[irq].devname = default_names[irq];
}
/*
* Do we need these probe functions on the m68k?
*/
unsigned long probe_irq_on (void)
{
return 0;
}
int probe_irq_off (unsigned long irqs)
{
return 0;
}
asmlinkage void process_int(unsigned long vec, struct pt_regs *fp)
{
if (vec >= VEC_INT1 && vec <= VEC_INT7 && !MACH_IS_BVME6000) {
vec -= VEC_SPUR;
kstat.irqs[0][vec]++;
irq_list[vec].handler(vec, irq_list[vec].dev_id, fp);
} else {
if (mach_process_int)
mach_process_int(vec, fp);
else
panic("Can't process interrupt vector %ld\n", vec);
return;
}
}
int get_irq_list(char *buf)
{
int i, len = 0;
/* autovector interrupts */
if (mach_default_handler) {
for (i = 0; i < SYS_IRQS; i++) {
len += sprintf(buf+len, "auto %2d: %10u ", i,
i ? kstat.irqs[0][i] : num_spurious);
len += sprintf(buf+len, " ");
len += sprintf(buf+len, "%s\n", irq_list[i].devname);
}
}
len += mach_get_irq_list(buf+len);
return len;
}
/*
* Generic dumping code. Used for panic and debug.
*/
void dump(struct pt_regs *fp)
{
unsigned long *sp;
unsigned char *tp;
int i;
printk("\nCURRENT PROCESS:\n\n");
#if 0
{
extern int swt_lastjiffies, swt_reference;
printk("WATCHDOG: jiffies=%d lastjiffies=%d [%d] reference=%d\n",
jiffies, swt_lastjiffies, (swt_lastjiffies - jiffies),
swt_reference);
}
#endif
printk("COMM=%s PID=%d\n", current->comm, current->pid);
if (current->mm) {
printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
(int) current->mm->start_code,
(int) current->mm->end_code,
(int) current->mm->start_data,
(int) current->mm->end_data,
(int) current->mm->end_data,
(int) current->mm->brk);
printk("USER-STACK=%08x\n\n",
(int) current->mm->start_stack);
}
printk("PC: %08lx\n", fp->pc);
printk("SR: %08lx SP: %08lx\n", (long) fp->sr, (long) fp);
printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
fp->d0, fp->d1, fp->d2, fp->d3);
printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
fp->d4, fp->d5, fp->a0, fp->a1);
printk("\nUSP: %08x TRAPFRAME: %08x\n",
rdusp(), (unsigned int) fp);
printk("\nCODE:");
tp = ((unsigned char *) fp->pc) - 0x20;
for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
if ((i % 0x10) == 0)
printk("\n%08x: ", (int) (tp + i));
printk("%08x ", (int) *sp++);
}
printk("\n");
printk("\nKERNEL STACK:");
tp = ((unsigned char *) fp) - 0x40;
for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
if ((i % 0x10) == 0)
printk("\n%08x: ", (int) (tp + i));
printk("%08x ", (int) *sp++);
}
printk("\n");
/*
if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
printk("(Possibly corrupted stack page??)\n");
printk("\n");
*/
printk("\nUSER STACK:");
tp = (unsigned char *) (rdusp() - 0x10);
for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {
if ((i % 0x10) == 0)
printk("\n%08x: ", (int) (tp + i));
printk("%08x ", (int) *sp++);
}
printk("\n\n");
}
| 25.873239 | 85 | 0.612139 |
e051f87a7ee5b311231e3dfac273a71b1373aa93 | 491 | h | C | swig/classes/include/wxSocketOutputStream.h | eumario/wxruby | c348d0dd64f9549f51cbfd22658de42e7ca37194 | [
"MIT"
] | 7 | 2019-02-18T23:54:31.000Z | 2021-12-04T01:06:37.000Z | swig/classes/include/wxSocketOutputStream.h | eumario/wxruby | c348d0dd64f9549f51cbfd22658de42e7ca37194 | [
"MIT"
] | null | null | null | swig/classes/include/wxSocketOutputStream.h | eumario/wxruby | c348d0dd64f9549f51cbfd22658de42e7ca37194 | [
"MIT"
] | null | null | null | // wxSocketOutputStream.h
// This file was automatically generated
// by extractxml.rb, part of the wxRuby project
// Do not make changes directly to this file!
#if !defined(_wxSocketOutputStream_h_)
#define _wxSocketOutputStream_h_
class wxSocketOutputStream : public wxOutputStream
{
public:
/**
* \brief Creates a new write-only socket stream using the specified initialized
socket connection.
* \param wxSocketBase&
*/
wxSocketOutputStream(wxSocketBase& s ) ;
};
#endif
| 22.318182 | 81 | 0.761711 |
3563f7639affa405ea8fb7806a5b3181bc8bf941 | 1,391 | c | C | Samples/Grove_4_Digital_Display/main.c | djaus2/MT3620_Grove_Shield | 712eb82b66da68453d6cbb28a3a215b7fa532448 | [
"MIT"
] | 1 | 2021-02-25T02:39:28.000Z | 2021-02-25T02:39:28.000Z | Samples/Grove_4_Digital_Display/main.c | maximejf42/MT3620_Grove_Shield | 94247cd78485106fd1a94c7a77ba0378cb822a9f | [
"MIT"
] | null | null | null | Samples/Grove_4_Digital_Display/main.c | maximejf42/MT3620_Grove_Shield | 94247cd78485106fd1a94c7a77ba0378cb822a9f | [
"MIT"
] | 1 | 2020-06-16T12:38:10.000Z | 2020-06-16T12:38:10.000Z | #include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <applibs/log.h>
#include <applibs/gpio.h>
#include "../../MT3620_Grove_Shield_Library/Grove.h"
#include "../../MT3620_Grove_Shield_Library/Sensors/Grove4DigitDisplay.h"
static volatile sig_atomic_t terminationRequested = false;
/// <summary>
/// Signal handler for termination requests. This handler must be async-signal-safe.
/// </summary>
static void TerminationHandler(int signalNumber)
{
// Don't use Log_Debug here, as it is not guaranteed to be async signal safe
terminationRequested = true;
}
/// <summary>
/// Main entry point for this sample.
/// </summary>
int main(int argc, char *argv[])
{
int number = 1234;
Log_Debug("Application starting\n");
// Register a SIGTERM handler for termination requests
struct sigaction action;
memset(&action, 0, sizeof(struct sigaction));
action.sa_handler = TerminationHandler;
sigaction(SIGTERM, &action, NULL);
// Initialize Grove 4 Digital Display, use pin_4 as pin_clik, pin_5 as pin_dio
void *dev = Grove4DigitDisplay_Open(4, 5);
// Enable clock point
Grove4DigitDisplay_DisplayClockPoint(true);
// Main loop
while (!terminationRequested) {
// Display increasing number
Grove4DigitDisplay_DisplayValue(dev, number++);
usleep(1000000);
}
Log_Debug("Application exiting\n");
return 0;
}
| 24.403509 | 88 | 0.734723 |
375b9644d7877cc11102b1919fcd95b58871ec76 | 391 | h | C | syslibs/ksapi/include/ksapi_commonFuncs.h | fransvanderlek/acplt-rte | 8c664d247e4a0c9291b97aafc930c05341f3b048 | [
"Apache-2.0"
] | 18 | 2015-12-07T15:15:53.000Z | 2021-10-07T04:09:36.000Z | syslibs/ksapi/include/ksapi_commonFuncs.h | fransvanderlek/acplt-rte | 8c664d247e4a0c9291b97aafc930c05341f3b048 | [
"Apache-2.0"
] | 41 | 2015-12-08T13:31:41.000Z | 2022-01-31T16:32:14.000Z | syslibs/ksapi/include/ksapi_commonFuncs.h | fransvanderlek/acplt-rte | 8c664d247e4a0c9291b97aafc930c05341f3b048 | [
"Apache-2.0"
] | 12 | 2015-06-11T13:09:41.000Z | 2019-02-07T13:33:37.000Z |
#include "ksapi.h"
OV_RESULT ksapi_getClientPointers(OV_INSTPTR_ksapi_KSApiCommon pCommon,
OV_INSTPTR_ksbase_ClientBase* pClient, OV_VTBLPTR_ksbase_ClientBase* pVtblClient);
#define KSAPI_COMMON_INTERNALERROR 128
#define KSAPI_COMMON_EXTERNALERROR 64
#define KSAPI_COMMON_INITIAL 0
#define KSAPI_COMMON_WAITINGFORANSWER 1
#define KSAPI_COMMON_REQUESTCOMPLETED 2
| 30.076923 | 87 | 0.823529 |
b862ef3541d37238d7a6dba58c3b854542d6a063 | 358 | c | C | euler12/main.c | kirbasyunus/ProjectEuler-solution-with-c | d437dcce3da26348d7194f8e998949394d6701ea | [
"Unlicense"
] | null | null | null | euler12/main.c | kirbasyunus/ProjectEuler-solution-with-c | d437dcce3da26348d7194f8e998949394d6701ea | [
"Unlicense"
] | null | null | null | euler12/main.c | kirbasyunus/ProjectEuler-solution-with-c | d437dcce3da26348d7194f8e998949394d6701ea | [
"Unlicense"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
int main()
{
int sum=0, counter=0, i=1, k=1;
while(counter<501){
sum=sum+k;
for(i=1;i<sum+1;i++){
if(sum%i==0)
counter++;
}
if(counter<500){
counter=0;
}
k++;
printf("%d\n",sum);
}
printf("%d\n%d",sum,counter);
}
| 16.272727 | 35 | 0.421788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.