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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
abf632e7edb9adb59d0d107d9a7bbb66ff9570c1 | 471 | h | C | Music/Music/Music.h | devinroth/music | 8241531755cda4614ecaa6f0102321c2db14147c | [
"MIT"
] | 7 | 2016-08-02T23:23:11.000Z | 2021-12-17T21:08:08.000Z | Music/Music/Music.h | devinroth/music | 8241531755cda4614ecaa6f0102321c2db14147c | [
"MIT"
] | null | null | null | Music/Music/Music.h | devinroth/music | 8241531755cda4614ecaa6f0102321c2db14147c | [
"MIT"
] | null | null | null | //
// Music.h
// Music
//
// Created by Devin Roth on 7/18/16.
// Copyright © 2016 Devin Roth Music. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for Music.
FOUNDATION_EXPORT double MusicVersionNumber;
//! Project version string for Music.
FOUNDATION_EXPORT const unsigned char MusicVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Music/PublicHeader.h>
| 23.55 | 130 | 0.7431 |
4dd979d3c4df76cf33b5b3cf3e04bacef8e0743f | 1,793 | c | C | Lib/MAX6675/MAX6675.c | gkiryaziev/STM32-CMSIS_Libraries | 6ea263062ff0e5b6aab95a5c6bbdd0f057a5d03a | [
"MIT"
] | 30 | 2019-05-31T08:29:10.000Z | 2022-03-29T08:13:27.000Z | Lib/MAX6675/MAX6675.c | gkiryaziev/STM32-CMSIS_Libraries | 6ea263062ff0e5b6aab95a5c6bbdd0f057a5d03a | [
"MIT"
] | null | null | null | Lib/MAX6675/MAX6675.c | gkiryaziev/STM32-CMSIS_Libraries | 6ea263062ff0e5b6aab95a5c6bbdd0f057a5d03a | [
"MIT"
] | 10 | 2019-08-28T13:46:48.000Z | 2022-02-09T02:48:42.000Z | /*
* MAX6675.c
*
* Created on: 25.05.2019
* Author: Admin
*
* // SPI
* NSS - PA4 (General purpose output push-pull)
* SCK - PA5 (Alternate function push-pull)
* MISO - PA6 (Input floating / Input pull-up)
* MOSI - PA7 (Alternate function push-pull)
*
* // BitBang
* SCK - PB13 (General purpose output push-pull)
* CS - PB14 (General purpose output push-pull)
* SO - PB12 (Input floating / Input pull-up)
*/
#include "MAX6675.h"
uint8_t MAX6675_SPI_Read(float *temperature) {
uint16_t temp_val = 0;
SPI1_EnableSlave();
temp_val = SPI1_Write(0x0);
temp_val <<= 8;
temp_val |= SPI1_Write(0x0);
SPI1_DisableSlave();
*temperature = (float)(temp_val >> 3) * 0.25;
return ((temp_val >> 2) & 0x1);
}
void MAX6675_Init() {
GPIO_Enable(GPIOB);
GPIO_SetMode_Output_50MHz_PP(MAX6675_SCK_Port, MAX6675_SCK_Pin);
GPIO_SetMode_Output_50MHz_PP(MAX6675_CS_Port, MAX6675_CS_Pin);
GPIO_SetMode_Input_Floating(MAX6675_SO_Port, MAX6675_SO_Pin);
GPIO_WritePin(MAX6675_CS_Port, MAX6675_CS_Pin, 1); // CS high
GPIO_WritePin(MAX6675_SCK_Port, MAX6675_SCK_Pin, 0); // SCK low
}
uint16_t MAX6675_Read(float *temperature) {
uint16_t timeout = 1000;
uint16_t temp_val = 0;
GPIO_WritePin(MAX6675_CS_Port, MAX6675_CS_Pin, 0); // CS low
for (int8_t i = 15; i >= 0; --i) {
GPIO_WritePin(MAX6675_SCK_Port, MAX6675_SCK_Pin, 1); // SCK high
while(timeout--);
if (GPIO_ReadPin(MAX6675_SO_Port, MAX6675_SO_Pin)) {
temp_val |= (1 << i);
}
GPIO_WritePin(MAX6675_SCK_Port, MAX6675_SCK_Pin, 0); // SCK low
}
GPIO_WritePin(MAX6675_CS_Port, MAX6675_CS_Pin, 1); // CS high
*temperature = (float)(temp_val >> 3) * 0.25;
return ((temp_val >> 2) & 0x1);
}
| 24.902778 | 68 | 0.655884 |
06513bb129208a1a77380ad0b3977bfd1caa4c37 | 673 | h | C | includes/gui/ObjectUI.h | sps1112/opengl_project | b8d1cb863834f725a88147f0010448c20b492f18 | [
"MIT"
] | 1 | 2021-07-09T12:25:17.000Z | 2021-07-09T12:25:17.000Z | includes/gui/ObjectUI.h | sps1112/opengl-project | b8d1cb863834f725a88147f0010448c20b492f18 | [
"MIT"
] | null | null | null | includes/gui/ObjectUI.h | sps1112/opengl-project | b8d1cb863834f725a88147f0010448c20b492f18 | [
"MIT"
] | null | null | null | #ifndef OBJECTUI_H
#define OBJECTUI_H
#include <rendering/Shader.h>
#include <rendering/Texture.h>
#include <iostream>
class ShaderUI
{
public:
std::string vertexPath;
std::string fragmentPath;
ShaderUI();
ShaderUI(std::string vertexPath, std::string fragmentPath);
};
class TextureUI
{
public:
std::string diffusePath;
std::string specularPath;
std::string emmisionPath;
std::string normalPath;
std::string depthPath;
TextureUI();
TextureUI(std::string diffusePath, std::string specularPath = "",
std::string emmisionPath = "", std::string normalPath = "",
std::string depthPath = "");
};
#endif | 21.03125 | 73 | 0.668648 |
9eac11db55b60b190eab2b3fa58f0b8c07680fb0 | 1,315 | h | C | System/Library/PrivateFrameworks/Message.framework/MFDAMessage.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/Message.framework/MFDAMessage.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/Message.framework/MFDAMessage.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:45:56 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/Message.framework/Message
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <Message/MFMailMessage.h>
@class DAMailMessage, MFMessage, MFMailboxUid, NSString;
@interface MFDAMessage : MFMailMessage {
DAMailMessage* _DAMailMessage;
MFMessage* _rfc822CreatedMessage;
MFMailboxUid* _mailbox;
NSString* _externalConversationID;
}
@property (nonatomic,readonly) DAMailMessage * DAMailMessage; //@synthesize DAMailMessage=_DAMailMessage - In the implementation block
-(id)messageBody;
-(unsigned long long)messageSize;
-(id)initWithDAMailMessage:(id)arg1 mailbox:(id)arg2 ;
-(id)externalConversationID;
-(BOOL)messageData:(id*)arg1 messageSize:(unsigned long long*)arg2 isComplete:(BOOL*)arg3 downloadIfNecessary:(BOOL)arg4 ;
-(BOOL)messageDataHolder:(id*)arg1 messageSize:(unsigned long long*)arg2 isComplete:(BOOL*)arg3 downloadIfNecessary:(BOOL)arg4 ;
-(id)remoteMailboxURL;
-(DAMailMessage *)DAMailMessage;
-(id)mailbox;
-(id)headersIfAvailable;
-(unsigned long long)messageFlags;
-(id)headers;
-(id)remoteID;
-(void)dealloc;
@end
| 33.717949 | 147 | 0.775665 |
7f31a346b7d806e44de69479f2b5db980230b247 | 1,133 | h | C | ui/gl/gl_utils.h | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | ui/gl/gl_utils.h | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | ui/gl/gl_utils.h | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2021-01-05T23:43:46.000Z | 2021-01-07T23:36:34.000Z | // Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains some useful utilities for the ui/gl classes.
#ifndef UI_GL_GL_UTILS_H_
#define UI_GL_GL_UTILS_H_
#include "base/command_line.h"
#include "build/build_config.h"
#include "ui/gl/gl_export.h"
#if defined(OS_WIN)
#include <dxgi1_6.h>
#endif
#if defined(OS_ANDROID)
#include "base/files/scoped_file.h"
#endif
namespace gl {
GL_EXPORT void Crash();
GL_EXPORT void Hang();
#if defined(OS_ANDROID)
GL_EXPORT base::ScopedFD MergeFDs(base::ScopedFD a, base::ScopedFD b);
#endif
GL_EXPORT bool UsePassthroughCommandDecoder(
const base::CommandLine* command_line);
GL_EXPORT bool PassthroughCommandDecoderSupported();
#if defined(OS_WIN)
GL_EXPORT bool AreOverlaysSupportedWin();
// Calculates present during in 100 ns from number of frames per second.
GL_EXPORT unsigned int FrameRateToPresentDuration(float frame_rate);
GL_EXPORT UINT GetOverlaySupportFlags(DXGI_FORMAT format);
#endif
} // namespace gl
#endif // UI_GL_GL_UTILS_H_
| 24.106383 | 73 | 0.781112 |
d275d843c1550dd27e25e3a6af0e219b929f2849 | 7,992 | c | C | tools/perf/util/cputopo.c | Sunrisepeak/Linux2.6-Reading | c25102a494a37f9f30a27ca2cd4a1a412bffc80f | [
"MIT"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | tools/perf/util/cputopo.c | Sunrisepeak/Linux2.6-Reading | c25102a494a37f9f30a27ca2cd4a1a412bffc80f | [
"MIT"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | tools/perf/util/cputopo.c | Sunrisepeak/Linux2.6-Reading | c25102a494a37f9f30a27ca2cd4a1a412bffc80f | [
"MIT"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | // SPDX-License-Identifier: GPL-2.0
#include <sys/param.h>
#include <sys/utsname.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <api/fs/fs.h>
#include <linux/zalloc.h>
#include <perf/cpumap.h>
#include "cputopo.h"
#include "cpumap.h"
#include "debug.h"
#include "env.h"
#include "pmu-hybrid.h"
#define PACKAGE_CPUS_FMT \
"%s/devices/system/cpu/cpu%d/topology/package_cpus_list"
#define PACKAGE_CPUS_FMT_OLD \
"%s/devices/system/cpu/cpu%d/topology/core_siblings_list"
#define DIE_CPUS_FMT \
"%s/devices/system/cpu/cpu%d/topology/die_cpus_list"
#define CORE_CPUS_FMT \
"%s/devices/system/cpu/cpu%d/topology/core_cpus_list"
#define CORE_CPUS_FMT_OLD \
"%s/devices/system/cpu/cpu%d/topology/thread_siblings_list"
#define NODE_ONLINE_FMT \
"%s/devices/system/node/online"
#define NODE_MEMINFO_FMT \
"%s/devices/system/node/node%d/meminfo"
#define NODE_CPULIST_FMT \
"%s/devices/system/node/node%d/cpulist"
static int build_cpu_topology(struct cpu_topology *tp, int cpu)
{
FILE *fp;
char filename[MAXPATHLEN];
char *buf = NULL, *p;
size_t len = 0;
ssize_t sret;
u32 i = 0;
int ret = -1;
scnprintf(filename, MAXPATHLEN, PACKAGE_CPUS_FMT,
sysfs__mountpoint(), cpu);
if (access(filename, F_OK) == -1) {
scnprintf(filename, MAXPATHLEN, PACKAGE_CPUS_FMT_OLD,
sysfs__mountpoint(), cpu);
}
fp = fopen(filename, "r");
if (!fp)
goto try_dies;
sret = getline(&buf, &len, fp);
fclose(fp);
if (sret <= 0)
goto try_dies;
p = strchr(buf, '\n');
if (p)
*p = '\0';
for (i = 0; i < tp->package_cpus_lists; i++) {
if (!strcmp(buf, tp->package_cpus_list[i]))
break;
}
if (i == tp->package_cpus_lists) {
tp->package_cpus_list[i] = buf;
tp->package_cpus_lists++;
buf = NULL;
len = 0;
}
ret = 0;
try_dies:
if (!tp->die_cpus_list)
goto try_threads;
scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT,
sysfs__mountpoint(), cpu);
fp = fopen(filename, "r");
if (!fp)
goto try_threads;
sret = getline(&buf, &len, fp);
fclose(fp);
if (sret <= 0)
goto try_threads;
p = strchr(buf, '\n');
if (p)
*p = '\0';
for (i = 0; i < tp->die_cpus_lists; i++) {
if (!strcmp(buf, tp->die_cpus_list[i]))
break;
}
if (i == tp->die_cpus_lists) {
tp->die_cpus_list[i] = buf;
tp->die_cpus_lists++;
buf = NULL;
len = 0;
}
ret = 0;
try_threads:
scnprintf(filename, MAXPATHLEN, CORE_CPUS_FMT,
sysfs__mountpoint(), cpu);
if (access(filename, F_OK) == -1) {
scnprintf(filename, MAXPATHLEN, CORE_CPUS_FMT_OLD,
sysfs__mountpoint(), cpu);
}
fp = fopen(filename, "r");
if (!fp)
goto done;
if (getline(&buf, &len, fp) <= 0)
goto done;
p = strchr(buf, '\n');
if (p)
*p = '\0';
for (i = 0; i < tp->core_cpus_lists; i++) {
if (!strcmp(buf, tp->core_cpus_list[i]))
break;
}
if (i == tp->core_cpus_lists) {
tp->core_cpus_list[i] = buf;
tp->core_cpus_lists++;
buf = NULL;
}
ret = 0;
done:
if (fp)
fclose(fp);
free(buf);
return ret;
}
void cpu_topology__delete(struct cpu_topology *tp)
{
u32 i;
if (!tp)
return;
for (i = 0 ; i < tp->package_cpus_lists; i++)
zfree(&tp->package_cpus_list[i]);
for (i = 0 ; i < tp->die_cpus_lists; i++)
zfree(&tp->die_cpus_list[i]);
for (i = 0 ; i < tp->core_cpus_lists; i++)
zfree(&tp->core_cpus_list[i]);
free(tp);
}
static bool has_die_topology(void)
{
char filename[MAXPATHLEN];
struct utsname uts;
if (uname(&uts) < 0)
return false;
if (strncmp(uts.machine, "x86_64", 6) &&
strncmp(uts.machine, "s390x", 5))
return false;
scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT,
sysfs__mountpoint(), 0);
if (access(filename, F_OK) == -1)
return false;
return true;
}
struct cpu_topology *cpu_topology__new(void)
{
struct cpu_topology *tp = NULL;
void *addr;
u32 nr, i, nr_addr;
size_t sz;
long ncpus;
int ret = -1;
struct perf_cpu_map *map;
bool has_die = has_die_topology();
ncpus = cpu__max_present_cpu().cpu;
/* build online CPU map */
map = perf_cpu_map__new(NULL);
if (map == NULL) {
pr_debug("failed to get system cpumap\n");
return NULL;
}
nr = (u32)(ncpus & UINT_MAX);
sz = nr * sizeof(char *);
if (has_die)
nr_addr = 3;
else
nr_addr = 2;
addr = calloc(1, sizeof(*tp) + nr_addr * sz);
if (!addr)
goto out_free;
tp = addr;
addr += sizeof(*tp);
tp->package_cpus_list = addr;
addr += sz;
if (has_die) {
tp->die_cpus_list = addr;
addr += sz;
}
tp->core_cpus_list = addr;
for (i = 0; i < nr; i++) {
if (!perf_cpu_map__has(map, (struct perf_cpu){ .cpu = i }))
continue;
ret = build_cpu_topology(tp, i);
if (ret < 0)
break;
}
out_free:
perf_cpu_map__put(map);
if (ret) {
cpu_topology__delete(tp);
tp = NULL;
}
return tp;
}
static int load_numa_node(struct numa_topology_node *node, int nr)
{
char str[MAXPATHLEN];
char field[32];
char *buf = NULL, *p;
size_t len = 0;
int ret = -1;
FILE *fp;
u64 mem;
node->node = (u32) nr;
scnprintf(str, MAXPATHLEN, NODE_MEMINFO_FMT,
sysfs__mountpoint(), nr);
fp = fopen(str, "r");
if (!fp)
return -1;
while (getline(&buf, &len, fp) > 0) {
/* skip over invalid lines */
if (!strchr(buf, ':'))
continue;
if (sscanf(buf, "%*s %*d %31s %"PRIu64, field, &mem) != 2)
goto err;
if (!strcmp(field, "MemTotal:"))
node->mem_total = mem;
if (!strcmp(field, "MemFree:"))
node->mem_free = mem;
if (node->mem_total && node->mem_free)
break;
}
fclose(fp);
fp = NULL;
scnprintf(str, MAXPATHLEN, NODE_CPULIST_FMT,
sysfs__mountpoint(), nr);
fp = fopen(str, "r");
if (!fp)
return -1;
if (getline(&buf, &len, fp) <= 0)
goto err;
p = strchr(buf, '\n');
if (p)
*p = '\0';
node->cpus = buf;
fclose(fp);
return 0;
err:
free(buf);
if (fp)
fclose(fp);
return ret;
}
struct numa_topology *numa_topology__new(void)
{
struct perf_cpu_map *node_map = NULL;
struct numa_topology *tp = NULL;
char path[MAXPATHLEN];
char *buf = NULL;
size_t len = 0;
u32 nr, i;
FILE *fp;
char *c;
scnprintf(path, MAXPATHLEN, NODE_ONLINE_FMT,
sysfs__mountpoint());
fp = fopen(path, "r");
if (!fp)
return NULL;
if (getline(&buf, &len, fp) <= 0)
goto out;
c = strchr(buf, '\n');
if (c)
*c = '\0';
node_map = perf_cpu_map__new(buf);
if (!node_map)
goto out;
nr = (u32) perf_cpu_map__nr(node_map);
tp = zalloc(sizeof(*tp) + sizeof(tp->nodes[0])*nr);
if (!tp)
goto out;
tp->nr = nr;
for (i = 0; i < nr; i++) {
if (load_numa_node(&tp->nodes[i], perf_cpu_map__cpu(node_map, i).cpu)) {
numa_topology__delete(tp);
tp = NULL;
break;
}
}
out:
free(buf);
fclose(fp);
perf_cpu_map__put(node_map);
return tp;
}
void numa_topology__delete(struct numa_topology *tp)
{
u32 i;
for (i = 0; i < tp->nr; i++)
zfree(&tp->nodes[i].cpus);
free(tp);
}
static int load_hybrid_node(struct hybrid_topology_node *node,
struct perf_pmu *pmu)
{
const char *sysfs;
char path[PATH_MAX];
char *buf = NULL, *p;
FILE *fp;
size_t len = 0;
node->pmu_name = strdup(pmu->name);
if (!node->pmu_name)
return -1;
sysfs = sysfs__mountpoint();
if (!sysfs)
goto err;
snprintf(path, PATH_MAX, CPUS_TEMPLATE_CPU, sysfs, pmu->name);
fp = fopen(path, "r");
if (!fp)
goto err;
if (getline(&buf, &len, fp) <= 0) {
fclose(fp);
goto err;
}
p = strchr(buf, '\n');
if (p)
*p = '\0';
fclose(fp);
node->cpus = buf;
return 0;
err:
zfree(&node->pmu_name);
free(buf);
return -1;
}
struct hybrid_topology *hybrid_topology__new(void)
{
struct perf_pmu *pmu;
struct hybrid_topology *tp = NULL;
u32 nr, i = 0;
nr = perf_pmu__hybrid_pmu_num();
if (nr == 0)
return NULL;
tp = zalloc(sizeof(*tp) + sizeof(tp->nodes[0]) * nr);
if (!tp)
return NULL;
tp->nr = nr;
perf_pmu__for_each_hybrid_pmu(pmu) {
if (load_hybrid_node(&tp->nodes[i], pmu)) {
hybrid_topology__delete(tp);
return NULL;
}
i++;
}
return tp;
}
void hybrid_topology__delete(struct hybrid_topology *tp)
{
u32 i;
for (i = 0; i < tp->nr; i++) {
zfree(&tp->nodes[i].pmu_name);
zfree(&tp->nodes[i].cpus);
}
free(tp);
}
| 18.205011 | 74 | 0.633759 |
323428877d99fc349a1a11daee44ca082d0b687f | 1,924 | h | C | System/Library/Frameworks/MLCompute.framework/MLCEmbeddingLayer.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | 1 | 2020-11-11T06:05:23.000Z | 2020-11-11T06:05:23.000Z | System/Library/Frameworks/MLCompute.framework/MLCEmbeddingLayer.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | null | null | null | System/Library/Frameworks/MLCompute.framework/MLCEmbeddingLayer.h | lechium/tvOS142Headers | c7696f6d760e4822f61b9f2c2adcd18749700fda | [
"MIT"
] | null | null | null | /*
* This header is generated by classdump-dyld 1.5
* on Tuesday, November 10, 2020 at 10:18:58 PM Mountain Standard Time
* Operating System: Version 14.2 (Build 18K57)
* Image Source: /System/Library/Frameworks/MLCompute.framework/MLCompute
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <MLCompute/MLCLayer.h>
@class MLCEmbeddingDescriptor, MLCTensor, MLCTensorParameter;
@interface MLCEmbeddingLayer : MLCLayer {
MLCEmbeddingDescriptor* _descriptor;
MLCTensor* _weights;
MLCTensorParameter* _weightsParameter;
}
@property (nonatomic,copy,readonly) MLCEmbeddingDescriptor * descriptor; //@synthesize descriptor=_descriptor - In the implementation block
@property (nonatomic,retain,readonly) MLCTensor * weights; //@synthesize weights=_weights - In the implementation block
@property (nonatomic,retain,readonly) MLCTensorParameter * weightsParameter; //@synthesize weightsParameter=_weightsParameter - In the implementation block
+(id)layerWithDescriptor:(id)arg1 weights:(id)arg2 ;
+(BOOL)supportsDataType:(int)arg1 onDevice:(id)arg2 ;
-(id)description;
-(MLCEmbeddingDescriptor *)descriptor;
-(MLCTensor *)weights;
-(BOOL)compileForDevice:(id)arg1 sourceTensors:(id)arg2 resultTensor:(id)arg3 ;
-(BOOL)allocateDataForOptimizer:(id)arg1 ;
-(unsigned long long)allocatedDataSizeForTraining:(BOOL)arg1 optimizer:(id)arg2 ;
-(id)summarizedDOTDescription;
-(void)linkAssociatedTensors;
-(void)unlinkAssociatedTensors;
-(BOOL)isSupportedShapeForTensorSources:(id)arg1 ;
-(id)resultTensorFromSources:(id)arg1 ;
-(MLCTensorParameter *)weightsParameter;
-(void)allocateGradientsForParameters;
-(id)initWithDescriptor:(id)arg1 weight:(id)arg2 ;
@end
| 45.809524 | 168 | 0.716736 |
9a4fd08d87e0d1f5ef536dc131c618ce3e302a24 | 533 | h | C | src/reindexer/vendor/spdlog/sinks/null_sink.h | arock121/pocketnet.core | bc08bf9dc565c60d7e7d53e3cc615408b76f9bde | [
"ECL-2.0",
"Apache-2.0"
] | 695 | 2017-07-07T16:54:23.000Z | 2022-03-19T09:48:30.000Z | src/reindexer/vendor/spdlog/sinks/null_sink.h | arock121/pocketnet.core | bc08bf9dc565c60d7e7d53e3cc615408b76f9bde | [
"ECL-2.0",
"Apache-2.0"
] | 153 | 2021-01-20T08:10:23.000Z | 2022-03-31T23:30:50.000Z | src/reindexer/vendor/spdlog/sinks/null_sink.h | arock121/pocketnet.core | bc08bf9dc565c60d7e7d53e3cc615408b76f9bde | [
"ECL-2.0",
"Apache-2.0"
] | 72 | 2017-07-12T21:12:59.000Z | 2021-11-28T14:35:06.000Z | //
// Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#pragma once
#include "base_sink.h"
#include "../details/null_mutex.h"
#include <mutex>
namespace spdlog
{
namespace sinks
{
template <class Mutex>
class null_sink : public base_sink<Mutex>
{
protected:
void _sink_it(const details::log_msg&) override
{}
void _flush() override
{}
};
using null_sink_mt = null_sink<details::null_mutex>;
using null_sink_st = null_sink<details::null_mutex>;
}
}
| 14.805556 | 73 | 0.709193 |
327835686a219988789551e7f53f6a316b0b50a0 | 2,380 | h | C | src/random.h | henningw/libfortuna | daf91992e619d20b344d2e51cdd9fab5e41e3889 | [
"PostgreSQL"
] | null | null | null | src/random.h | henningw/libfortuna | daf91992e619d20b344d2e51cdd9fab5e41e3889 | [
"PostgreSQL"
] | null | null | null | src/random.h | henningw/libfortuna | daf91992e619d20b344d2e51cdd9fab5e41e3889 | [
"PostgreSQL"
] | null | null | null | /*
* random.h
* Acquire randomness from system. For seeding RNG.
* Get pseudo random numbers from RNG.
*
* Copyright (c) 2001 Marko Kreen
* Copyright (c) 2019 Henning Westerholt
* All rights reserved.
*
* Based on https://github.com/waitman/libfortuna, refactoring
* done in this version: https://github.com/henningw/libfortuna
*
* 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.
*
* contrib/pgcrypto/random.c
*/
#ifndef _RANDOM_H_
#define _RANDOM_H_
/*
* System reseeds should be separated at least this much.
*/
#define SYSTEM_RESEED_MIN (20*60) /* 20 min */
/*
* How often to roll dice.
*/
#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */
/*
* The chance is x/256 that the reseed happens.
*/
#define SYSTEM_RESEED_CHANCE (4) /* 256/4 * 10min ~ 10h */
/*
* If this much time has passed, force reseed.
*/
#define SYSTEM_RESEED_MAX (12*60*60) /* 12h */
int get_pseudo_random_bytes(unsigned char *dst, unsigned count);
int add_entropy(const unsigned char *data, unsigned count);
#endif
| 36.615385 | 78 | 0.703361 |
aad43a24edff3aa0e4d92a0333ae6f43b6981b06 | 7,416 | c | C | contrib/tools/python/src/Modules/cgensupport.c | HeyLey/catboost | f472aed90604ebe727537d9d4a37147985e10ec2 | [
"Apache-2.0"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | contrib/tools/python/src/Modules/cgensupport.c | HeyLey/catboost | f472aed90604ebe727537d9d4a37147985e10ec2 | [
"Apache-2.0"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | contrib/tools/python/src/Modules/cgensupport.c | HeyLey/catboost | f472aed90604ebe727537d9d4a37147985e10ec2 | [
"Apache-2.0"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z |
/* Functions used by cgen output */
#include "Python.h"
#include "cgensupport.h"
/* Functions to extract arguments.
These needs to know the total number of arguments supplied,
since the argument list is a tuple only of there is more than
one argument. */
int
PyArg_GetObject(register PyObject *args, int nargs, int i, PyObject **p_arg)
{
if (nargs != 1) {
if (args == NULL || !PyTuple_Check(args) ||
nargs != PyTuple_Size(args) ||
i < 0 || i >= nargs) {
return PyErr_BadArgument();
}
else {
args = PyTuple_GetItem(args, i);
}
}
if (args == NULL) {
return PyErr_BadArgument();
}
*p_arg = args;
return 1;
}
int
PyArg_GetLong(register PyObject *args, int nargs, int i, long *p_arg)
{
if (nargs != 1) {
if (args == NULL || !PyTuple_Check(args) ||
nargs != PyTuple_Size(args) ||
i < 0 || i >= nargs) {
return PyErr_BadArgument();
}
args = PyTuple_GetItem(args, i);
}
if (args == NULL || !PyInt_Check(args)) {
return PyErr_BadArgument();
}
*p_arg = PyInt_AsLong(args);
return 1;
}
int
PyArg_GetShort(register PyObject *args, int nargs, int i, short *p_arg)
{
long x;
if (!PyArg_GetLong(args, nargs, i, &x))
return 0;
*p_arg = (short) x;
return 1;
}
static int
extractdouble(register PyObject *v, double *p_arg)
{
if (v == NULL) {
/* Fall through to error return at end of function */
}
else if (PyFloat_Check(v)) {
*p_arg = PyFloat_AS_DOUBLE((PyFloatObject *)v);
return 1;
}
else if (PyInt_Check(v)) {
*p_arg = PyInt_AS_LONG((PyIntObject *)v);
return 1;
}
else if (PyLong_Check(v)) {
*p_arg = PyLong_AsDouble(v);
return 1;
}
return PyErr_BadArgument();
}
static int
extractfloat(register PyObject *v, float *p_arg)
{
if (v == NULL) {
/* Fall through to error return at end of function */
}
else if (PyFloat_Check(v)) {
*p_arg = (float) PyFloat_AS_DOUBLE((PyFloatObject *)v);
return 1;
}
else if (PyInt_Check(v)) {
*p_arg = (float) PyInt_AS_LONG((PyIntObject *)v);
return 1;
}
else if (PyLong_Check(v)) {
*p_arg = (float) PyLong_AsDouble(v);
return 1;
}
return PyErr_BadArgument();
}
int
PyArg_GetFloat(register PyObject *args, int nargs, int i, float *p_arg)
{
PyObject *v;
float x;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (!extractfloat(v, &x))
return 0;
*p_arg = x;
return 1;
}
int
PyArg_GetString(PyObject *args, int nargs, int i, string *p_arg)
{
PyObject *v;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (!PyString_Check(v)) {
return PyErr_BadArgument();
}
*p_arg = PyString_AsString(v);
return 1;
}
int
PyArg_GetChar(PyObject *args, int nargs, int i, char *p_arg)
{
string x;
if (!PyArg_GetString(args, nargs, i, &x))
return 0;
if (x[0] == '\0' || x[1] != '\0') {
/* Not exactly one char */
return PyErr_BadArgument();
}
*p_arg = x[0];
return 1;
}
int
PyArg_GetLongArraySize(PyObject *args, int nargs, int i, long *p_arg)
{
PyObject *v;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (PyTuple_Check(v)) {
*p_arg = PyTuple_Size(v);
return 1;
}
if (PyList_Check(v)) {
*p_arg = PyList_Size(v);
return 1;
}
return PyErr_BadArgument();
}
int
PyArg_GetShortArraySize(PyObject *args, int nargs, int i, short *p_arg)
{
long x;
if (!PyArg_GetLongArraySize(args, nargs, i, &x))
return 0;
*p_arg = (short) x;
return 1;
}
/* XXX The following four are too similar. Should share more code. */
int
PyArg_GetLongArray(PyObject *args, int nargs, int i, int n, long *p_arg)
{
PyObject *v, *w;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (PyTuple_Check(v)) {
if (PyTuple_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyTuple_GetItem(v, i);
if (!PyInt_Check(w)) {
return PyErr_BadArgument();
}
p_arg[i] = PyInt_AsLong(w);
}
return 1;
}
else if (PyList_Check(v)) {
if (PyList_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyList_GetItem(v, i);
if (!PyInt_Check(w)) {
return PyErr_BadArgument();
}
p_arg[i] = PyInt_AsLong(w);
}
return 1;
}
else {
return PyErr_BadArgument();
}
}
int
PyArg_GetShortArray(PyObject *args, int nargs, int i, int n, short *p_arg)
{
PyObject *v, *w;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (PyTuple_Check(v)) {
if (PyTuple_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyTuple_GetItem(v, i);
if (!PyInt_Check(w)) {
return PyErr_BadArgument();
}
p_arg[i] = (short) PyInt_AsLong(w);
}
return 1;
}
else if (PyList_Check(v)) {
if (PyList_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyList_GetItem(v, i);
if (!PyInt_Check(w)) {
return PyErr_BadArgument();
}
p_arg[i] = (short) PyInt_AsLong(w);
}
return 1;
}
else {
return PyErr_BadArgument();
}
}
int
PyArg_GetDoubleArray(PyObject *args, int nargs, int i, int n, double *p_arg)
{
PyObject *v, *w;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (PyTuple_Check(v)) {
if (PyTuple_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyTuple_GetItem(v, i);
if (!extractdouble(w, &p_arg[i]))
return 0;
}
return 1;
}
else if (PyList_Check(v)) {
if (PyList_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyList_GetItem(v, i);
if (!extractdouble(w, &p_arg[i]))
return 0;
}
return 1;
}
else {
return PyErr_BadArgument();
}
}
int
PyArg_GetFloatArray(PyObject *args, int nargs, int i, int n, float *p_arg)
{
PyObject *v, *w;
if (!PyArg_GetObject(args, nargs, i, &v))
return 0;
if (PyTuple_Check(v)) {
if (PyTuple_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyTuple_GetItem(v, i);
if (!extractfloat(w, &p_arg[i]))
return 0;
}
return 1;
}
else if (PyList_Check(v)) {
if (PyList_Size(v) != n) {
return PyErr_BadArgument();
}
for (i = 0; i < n; i++) {
w = PyList_GetItem(v, i);
if (!extractfloat(w, &p_arg[i]))
return 0;
}
return 1;
}
else {
return PyErr_BadArgument();
}
}
| 23.845659 | 76 | 0.511192 |
30894f8b66e0477e0a5b62e3daa009b158f38b41 | 601 | c | C | d/changan/nanan-daokou.c | zhangyifei/mud | b2090bbd2a8d3d82b86148d794a7ca59cd2429f3 | [
"MIT"
] | null | null | null | d/changan/nanan-daokou.c | zhangyifei/mud | b2090bbd2a8d3d82b86148d794a7ca59cd2429f3 | [
"MIT"
] | null | null | null | d/changan/nanan-daokou.c | zhangyifei/mud | b2090bbd2a8d3d82b86148d794a7ca59cd2429f3 | [
"MIT"
] | null | null | null | //Room: nanan-daokou.c
inherit ROOM;
void create ()
{
set ("short", "南安道口");
set ("long", @LONG
长安城自古是繁华胜地,为数代皇朝建都之地,又为盐商大贾所聚
集,殷富甲于天下。南安道口是一个四通八达的路口,东西方向通往华
瑞街,南面是长安南城门,北方有一条大路通到故皇宫的金水桥。
LONG);
set("exits",([//sizeof() == 4
"south" : __DIR__"nan-chengmen",
"north" : __DIR__"nanan-dadao",
"west" : __DIR__"huarui3",
"east" : __DIR__"huarui4",
"northeast" : __DIR__"bingying4",
"northwest" : __DIR__"bingying5",
]));
set("outdoors", "changan");
setup();
replace_program(ROOM);
}
| 23.115385 | 42 | 0.554077 |
65fe2b3713bc0dc14fcc7d17960d08d2e070a8ad | 3,301 | h | C | include/tubeComputeTrainingMask.h | jsdelivrbot/ITKTubeTK | b89403a7178ed6635e7860bec4f2eb009dd70711 | [
"Apache-2.0"
] | null | null | null | include/tubeComputeTrainingMask.h | jsdelivrbot/ITKTubeTK | b89403a7178ed6635e7860bec4f2eb009dd70711 | [
"Apache-2.0"
] | null | null | null | include/tubeComputeTrainingMask.h | jsdelivrbot/ITKTubeTK | b89403a7178ed6635e7860bec4f2eb009dd70711 | [
"Apache-2.0"
] | null | null | null | /*=========================================================================
Library: TubeTK
Copyright 2010 Kitware Inc. 28 Corporate Drive,
Clifton Park, NY, 12065, USA.
All rights reserved.
Licensed under the Apache License, Version 2.0 ( the "License" );
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef __tubeComputeTrainingMask_h
#define __tubeComputeTrainingMask_h
// ITK Includes
#include "itkProcessObject.h"
// TubeTK Includes
#include "tubeWrappingMacros.h"
#include "itktubeComputeTrainingMaskFilter.h"
namespace tube
{
/** \class ComputeTrainingMask
*
* \ingroup TubeTK
*/
template< typename TImage >
class ComputeTrainingMask : public itk::ProcessObject
{
public:
/** Standard class typedefs. */
typedef ComputeTrainingMask Self;
typedef itk::ProcessObject Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro( Self );
/** Run-time type information ( and related methods ). */
itkTypeMacro( ComputeTrainingMask, ProcessObject );
/** Typedef to images */
typedef TImage ImageType;
itkStaticConstMacro( ImageDimension, unsigned int,
ImageType::ImageDimension );
typedef typename itk::tube::ComputeTrainingMaskFilter< ImageType >
FilterType;
typedef typename FilterType::ImageTypeShort ImageTypeShort;
tubeWrapSetMacro( Gap, double, ComputeTrainingMaskFilter );
tubeWrapGetMacro( Gap, double, ComputeTrainingMaskFilter );
tubeWrapSetMacro( NotVesselWidth, double, ComputeTrainingMaskFilter );
tubeWrapGetMacro( NotVesselWidth, double, ComputeTrainingMaskFilter );
tubeWrapGetConstObjectMacro( NotVesselMask, ImageTypeShort,
ComputeTrainingMaskFilter );
tubeWrapSetObjectMacro( Input, ImageType,
ComputeTrainingMaskFilter );
tubeWrapCallMacro( Update, ComputeTrainingMaskFilter );
tubeWrapGetObjectMacro( Output, ImageTypeShort,
ComputeTrainingMaskFilter );
protected:
ComputeTrainingMask( void );
~ComputeTrainingMask() {}
void PrintSelf( std::ostream & os, itk::Indent indent ) const;
private:
/** itkComputeTrainingMask parameters **/
ComputeTrainingMask( const Self & );
void operator=( const Self & );
// To remove warning "was hidden [-Woverloaded-virtual]"
void SetInput( const DataObjectIdentifierType &, itk::DataObject * ) {};
typename FilterType::Pointer m_ComputeTrainingMaskFilter;
};
} // End namespace tube
#ifndef ITK_MANUAL_INSTANTIATION
#include "tubeComputeTrainingMask.hxx"
#endif
#endif // End !defined( __tubeComputeTrainingMask_h )
| 30.284404 | 75 | 0.686762 |
e70c109c9ba03f0b981b581d5fcf6872728b48b3 | 231 | h | C | packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibraryImageLoader.h | rudylee/expo | b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc | [
"Apache-2.0",
"MIT"
] | 16,461 | 2017-03-24T19:59:01.000Z | 2022-03-31T21:52:45.000Z | packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibraryImageLoader.h | rudylee/expo | b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc | [
"Apache-2.0",
"MIT"
] | 13,016 | 2017-03-25T22:49:31.000Z | 2022-03-31T23:23:58.000Z | packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibraryImageLoader.h | rudylee/expo | b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc | [
"Apache-2.0",
"MIT"
] | 3,945 | 2017-03-25T07:12:57.000Z | 2022-03-31T20:55:18.000Z | // Copyright 2015-present 650 Industries. All rights reserved.
#if __has_include(<React/RCTImageURLLoader.h>)
#import <React/RCTImageURLLoader.h>
@interface EXMediaLibraryImageLoader : NSObject <RCTImageURLLoader>
@end
#endif
| 19.25 | 67 | 0.796537 |
aa37d7af961a31b855962f7ea24482c3e7547489 | 1,548 | h | C | selfdrive/hardware/hw.h | TMORI135/openpilot | bc986477eb34f554933caafeac71538c57fb6838 | [
"MIT"
] | 16 | 2018-09-27T06:29:11.000Z | 2022-03-17T22:56:38.000Z | selfdrive/hardware/hw.h | TMORI135/openpilot | bc986477eb34f554933caafeac71538c57fb6838 | [
"MIT"
] | 3 | 2018-12-29T01:34:02.000Z | 2022-01-07T19:08:20.000Z | selfdrive/hardware/hw.h | TMORI135/openpilot | bc986477eb34f554933caafeac71538c57fb6838 | [
"MIT"
] | 14 | 2018-08-24T00:34:17.000Z | 2021-03-19T11:57:15.000Z | #pragma once
#include <cstdlib>
#include <fstream>
#include <common/util.h>
#ifdef QCOM
#define Hardware HardwareEon
#elif QCOM2
#define Hardware HardwareTici
#else
#define Hardware HardwareNone
#endif
// no-op base hw class
class HardwareNone {
public:
static std::string get_os_version() { return "openpilot for PC"; };
static void reboot() {};
static void poweroff() {};
static void set_brightness(int percent) {};
};
class HardwareEon : public HardwareNone {
public:
static std::string get_os_version() {
return "NEOS " + util::read_file("/VERSION");
};
static void reboot() { std::system("reboot"); };
static void poweroff() { std::system("LD_LIBRARY_PATH= svc power shutdown"); };
static void set_brightness(int percent) {
std::ofstream brightness_control("/sys/class/leds/lcd-backlight/brightness");
if (brightness_control.is_open()) {
brightness_control << (int)(percent * (255/100.)) << "\n";
brightness_control.close();
}
};
};
class HardwareTici : public HardwareNone {
public:
static std::string get_os_version() {
return "AGNOS " + util::read_file("/VERSION");
};
static void reboot() { std::system("sudo reboot"); };
static void poweroff() { std::system("sudo poweroff"); };
static void set_brightness(int percent) {
std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness");
if (brightness_control.is_open()) {
brightness_control << (percent * (int)(1023/100.)) << "\n";
brightness_control.close();
}
};
};
| 25.377049 | 89 | 0.678941 |
e77fda5ff13b9205a0fc52e772c6bda915218074 | 195 | h | C | JQTrack/Classes/AutoTrack/UIKit/Private/UIControl+JQTPrivate.h | jqoo/JQTrack | 3490c674273eea51d4045b51880905346a21cf8a | [
"MIT"
] | 1 | 2020-07-21T09:29:46.000Z | 2020-07-21T09:29:46.000Z | JQTrack/Classes/AutoTrack/UIKit/Private/UIControl+JQTPrivate.h | jqoo/JQTrack | 3490c674273eea51d4045b51880905346a21cf8a | [
"MIT"
] | null | null | null | JQTrack/Classes/AutoTrack/UIKit/Private/UIControl+JQTPrivate.h | jqoo/JQTrack | 3490c674273eea51d4045b51880905346a21cf8a | [
"MIT"
] | null | null | null | //
// UIControl+JQTPrivate.h
// JQTrack
//
// Created by jqoo on 2019/7/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIControl (JQTPrivate)
@end
NS_ASSUME_NONNULL_END
| 11.470588 | 33 | 0.717949 |
43a446983b2732a3545cae2b701f9eb1f39e8b1c | 1,282 | h | C | qqtw/qqheaders7.2/QzoneFeedGiftItem.h | onezens/QQTweak | 04b9efd1d93eba8ef8fec5cf9a20276637765777 | [
"MIT"
] | 5 | 2018-02-20T14:24:17.000Z | 2020-08-06T09:31:21.000Z | qqtw/qqheaders7.2/QzoneFeedGiftItem.h | onezens/QQTweak | 04b9efd1d93eba8ef8fec5cf9a20276637765777 | [
"MIT"
] | 1 | 2020-06-10T07:49:16.000Z | 2020-06-12T02:08:35.000Z | qqtw/qqheaders7.2/QzoneFeedGiftItem.h | onezens/SmartQQ | 04b9efd1d93eba8ef8fec5cf9a20276637765777 | [
"MIT"
] | null | null | null | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "QzoneModel.h"
@class NSString;
@interface QzoneFeedGiftItem : QzoneModel
{
}
// Remaining properties
@property(nonatomic) long long actionType; // @dynamic actionType;
@property(retain, nonatomic) NSString *actionUrl; // @dynamic actionUrl;
@property(retain, nonatomic) NSString *audioURL; // @dynamic audioURL;
@property(retain, nonatomic) NSString *backURL; // @dynamic backURL;
@property(retain, nonatomic) NSString *bigURL; // @dynamic bigURL;
@property(retain, nonatomic) NSString *giftBackId; // @dynamic giftBackId;
@property(retain, nonatomic) NSString *giftDesc; // @dynamic giftDesc;
@property(retain, nonatomic) NSString *giftId; // @dynamic giftId;
@property(retain, nonatomic) NSString *giftName; // @dynamic giftName;
@property(retain, nonatomic) NSString *giftType; // @dynamic giftType;
@property(nonatomic) _Bool hasSent; // @dynamic hasSent;
@property(nonatomic) _Bool isTiming; // @dynamic isTiming;
@property(nonatomic) long long moreFlag; // @dynamic moreFlag;
@property(retain, nonatomic) NSString *sendTime; // @dynamic sendTime;
@property(retain, nonatomic) NSString *smallURL; // @dynamic smallURL;
@end
| 37.705882 | 83 | 0.74181 |
bdc65bb86e685ef397fc034b710d5087c3a39388 | 2,956 | h | C | 3rdparty/CGAL/include/CGAL/internal/deprecation_warning.h | daergoth/SubdivisionSandbox | d67386980eb978a552e5a98ba1c4b25cf5a9a328 | [
"MIT"
] | 23 | 2017-05-26T06:09:25.000Z | 2021-11-17T06:26:28.000Z | 3rd_party/cgal_4.9/include/cgal/internal/deprecation_warning.h | nimzi/CGALViewer | 25e28196a9192c2b7174a5656f441f97b9c94bd8 | [
"MIT"
] | 2 | 2017-07-10T10:32:04.000Z | 2018-09-28T03:12:57.000Z | 3rd_party/cgal_4.9/include/cgal/internal/deprecation_warning.h | nimzi/CGALViewer | 25e28196a9192c2b7174a5656f441f97b9c94bd8 | [
"MIT"
] | 8 | 2016-11-23T10:36:18.000Z | 2020-09-21T06:41:53.000Z | // Copyright (c) 2011 GeometryFactory (France). All rights reserved.
// All rights reserved.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Philipp Möller
// Including this header will issue a warning during compilation or
// cause compilation to fail if CGAL_NO_DEPRECATED_CODE is defined.
// CGAL_DEPRECATED_HEADER and CGAL_REPLACEMENT_HEADER can be defined
// to a string literal to customize the warning.
// CGAL_DEPRECATED_HEADER and CGAL_REPLACEMENT_HEADER are undefined,
// after the file is included.
// The lack of an include guard is intentional and necessary.
#include <CGAL/assertions.h>
#ifndef CGAL_NO_DEPRECATION_WARNINGS
#if defined(CGAL_NO_DEPRECATED_CODE)
// No deprecated code.
CGAL_static_assertion_msg(false, "A deprecated header has been included and CGAL_NO_DEPRECATED_CODE is defined.");
#endif // CGAL_NO_DEPRECATED_CODE
// Build the message
#define CGAL_INTERNAL_DEPRECATED_MESSAGE "Warning: A deprecated header has been included."
#if defined(CGAL_DEPRECATED_HEADER) && defined(CGAL_REPLACEMENT_HEADER)
# undef CGAL_INTERNAL_DEPRECATED_MESSAGE
# define CGAL_INTERNAL_DEPRECATED_MESSAGE "Warning: The header " CGAL_DEPRECATED_HEADER " is deprecated. " \
"Please use " CGAL_REPLACEMENT_HEADER " instead."
#elif defined(CGAL_DEPRECATED_HEADER)
# undef CGAL_INTERNAL_DEPRECATED_MESSAGE
# define CGAL_INTERNAL_DEPRECATED_MESSAGE "Warning: The header " CGAL_DEPRECATED_HEADER " is deprecated."
#endif
// don't trigger on NO_DEPRECATIOON_WARNINGS and don't trigger twice on NO_DEPRECATED_CODE
#if !defined(CGAL_NO_DEPRECATION_WARNINGS) && !defined(CGAL_NO_DEPRECATED_CODE)
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
# pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
# elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
// warning does not expand its arguments, issue a warning and add the message.
# warning "A deprecated header has been included."
# pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
# endif //defined
#endif
#endif // CGAL_NO_DEPRECATION_WARNINGS
#if defined(CGAL_DEPRECATED_HEADER)
# undef CGAL_DEPRECATED_HEADER
#endif
#if defined(CGAL_REPLACEMENT_HEADER)
# undef CGAL_REPLACEMENT_HEADER
#endif
#if defined(CGAL_INTERNAL_DEPRECATED_MESSAGE)
# undef CGAL_INTERNAL_DEPRECATED_MESSAGE
#endif
| 39.413333 | 114 | 0.777064 |
83298a93a20981d27de54dfa2524e5c4af34d801 | 7,261 | c | C | modules/rst/rst.c | mbattista/baresip | dcf28c26138803aea155c3ba547f1d0db54a3c2e | [
"X11"
] | 4 | 2018-07-25T15:20:23.000Z | 2021-04-11T01:49:21.000Z | modules/rst/rst.c | mbattista/baresip | dcf28c26138803aea155c3ba547f1d0db54a3c2e | [
"X11"
] | 1 | 2020-08-28T14:48:47.000Z | 2020-08-28T14:48:47.000Z | modules/rst/rst.c | mbattista/baresip | dcf28c26138803aea155c3ba547f1d0db54a3c2e | [
"X11"
] | 2 | 2020-08-15T18:40:31.000Z | 2021-09-26T07:11:03.000Z | /**
* @file rst.c MP3/ICY HTTP AV Source
*
* Copyright (C) 2011 Creytiv.com
*/
#include <string.h>
#include <re.h>
#include <rem.h>
#include <baresip.h>
#include "rst.h"
/**
* @defgroup rst rst
*
* Audio and video source module using mpg123 as input
*
* The module 'rst' is using the mpg123 to play streaming
* media (MP3) and provide this as an internal audio/video source.
*
* Example config:
\verbatim
audio_source rst,http://relay.slayradio.org:8000/
video_source rst,http://relay.slayradio.org:8000/
\endverbatim
*/
enum {
RETRY_WAIT = 10000,
};
struct rst {
const char *id;
struct ausrc_st *ausrc_st;
struct vidsrc_st *vidsrc_st;
struct tmr tmr;
struct dns_query *dnsq;
struct tcp_conn *tc;
struct mbuf *mb;
char *host;
char *path;
char *name;
char *meta;
bool head_recv;
size_t metaint;
size_t metasz;
size_t bytec;
uint16_t port;
};
static int rst_connect(struct rst *rst);
static void destructor(void *arg)
{
struct rst *rst = arg;
tmr_cancel(&rst->tmr);
mem_deref(rst->dnsq);
mem_deref(rst->tc);
mem_deref(rst->mb);
mem_deref(rst->host);
mem_deref(rst->path);
mem_deref(rst->name);
mem_deref(rst->meta);
}
static void reconnect(void *arg)
{
struct rst *rst = arg;
int err;
rst->mb = mem_deref(rst->mb);
rst->name = mem_deref(rst->name);
rst->meta = mem_deref(rst->meta);
rst->head_recv = false;
rst->metaint = 0;
rst->metasz = 0;
rst->bytec = 0;
err = rst_connect(rst);
if (err)
tmr_start(&rst->tmr, RETRY_WAIT, reconnect, rst);
}
static void recv_handler(struct mbuf *mb, void *arg)
{
struct rst *rst = arg;
size_t n;
if (!rst->head_recv) {
struct pl hdr, name, metaint, eoh;
if (rst->mb) {
size_t pos;
int err;
pos = rst->mb->pos;
rst->mb->pos = rst->mb->end;
err = mbuf_write_mem(rst->mb, mbuf_buf(mb),
mbuf_get_left(mb));
if (err) {
warning("rst: buffer write error: %m\n", err);
rst->tc = mem_deref(rst->tc);
tmr_start(&rst->tmr, RETRY_WAIT,
reconnect, rst);
return;
}
rst->mb->pos = pos;
}
else {
rst->mb = mem_ref(mb);
}
if (re_regex((const char *)mbuf_buf(rst->mb),
mbuf_get_left(rst->mb),
"[^\r\n]1\r\n\r\n", &eoh))
return;
rst->head_recv = true;
hdr.p = (const char *)mbuf_buf(rst->mb);
hdr.l = eoh.p + 5 - hdr.p;
if (!re_regex(hdr.p, hdr.l, "icy-name:[ \t]*[^\r\n]+\r\n",
NULL, &name))
(void)pl_strdup(&rst->name, &name);
if (!re_regex(hdr.p, hdr.l, "icy-metaint:[ \t]*[0-9]+\r\n",
NULL, &metaint))
rst->metaint = pl_u32(&metaint);
if (rst->metaint == 0) {
info("rst: icy meta interval not available\n");
rst->tc = mem_deref(rst->tc);
tmr_start(&rst->tmr, RETRY_WAIT, reconnect, rst);
return;
}
rst_video_update(rst->vidsrc_st, rst->name, NULL);
rst->mb->pos += hdr.l;
info("rst: name='%s' metaint=%zu\n", rst->name, rst->metaint);
if (rst->mb->pos >= rst->mb->end)
return;
mb = rst->mb;
}
while (mb->pos < mb->end) {
if (rst->metasz > 0) {
n = min(mbuf_get_left(mb), rst->metasz - rst->bytec);
if (rst->meta)
mbuf_read_mem(mb,
(uint8_t *)&rst->meta[rst->bytec],
n);
else
mb->pos += n;
rst->bytec += n;
#if 0
info("rst: metadata %zu bytes\n", n);
#endif
if (rst->bytec >= rst->metasz) {
#if 0
info("rst: metadata: [%s]\n", rst->meta);
#endif
rst->metasz = 0;
rst->bytec = 0;
rst_video_update(rst->vidsrc_st, rst->name,
rst->meta);
}
}
else if (rst->bytec < rst->metaint) {
n = min(mbuf_get_left(mb), rst->metaint - rst->bytec);
rst_audio_feed(rst->ausrc_st, mbuf_buf(mb), n);
rst->bytec += n;
mb->pos += n;
#if 0
info("rst: mp3data %zu bytes\n", n);
#endif
}
else {
rst->metasz = mbuf_read_u8(mb) * 16;
rst->bytec = 0;
rst->meta = mem_deref(rst->meta);
rst->meta = mem_zalloc(rst->metasz + 1, NULL);
#if 0
info("rst: metalength %zu bytes\n", rst->metasz);
#endif
}
}
}
static void estab_handler(void *arg)
{
struct rst *rst = arg;
struct mbuf *mb;
int err;
info("rst: connection established\n");
mb = mbuf_alloc(512);
if (!mb) {
err = ENOMEM;
goto out;
}
err = mbuf_printf(mb,
"GET %s HTTP/1.0\r\n"
"Icy-MetaData: 1\r\n"
"\r\n",
rst->path);
if (err)
goto out;
mb->pos = 0;
err = tcp_send(rst->tc, mb);
if (err)
goto out;
out:
if (err) {
warning("rst: error sending HTTP request: %m\n", err);
}
mem_deref(mb);
}
static void close_handler(int err, void *arg)
{
struct rst *rst = arg;
info("rst: tcp closed: %m\n", err);
rst->tc = mem_deref(rst->tc);
tmr_start(&rst->tmr, RETRY_WAIT, reconnect, rst);
}
static void dns_handler(int err, const struct dnshdr *hdr, struct list *ansl,
struct list *authl, struct list *addl, void *arg)
{
struct rst *rst = arg;
struct dnsrr *rr;
struct sa srv;
(void)err;
(void)hdr;
(void)authl;
(void)addl;
rr = dns_rrlist_find(ansl, rst->host, DNS_TYPE_A, DNS_CLASS_IN, true);
if (!rr) {
warning("rst: unable to resolve: %s\n", rst->host);
tmr_start(&rst->tmr, RETRY_WAIT, reconnect, rst);
return;
}
sa_set_in(&srv, rr->rdata.a.addr, rst->port);
err = tcp_connect(&rst->tc, &srv, estab_handler, recv_handler,
close_handler, rst);
if (err) {
warning("rst: tcp connect error: %m\n", err);
tmr_start(&rst->tmr, RETRY_WAIT, reconnect, rst);
return;
}
}
static int rst_connect(struct rst *rst)
{
struct sa srv;
int err;
if (!sa_set_str(&srv, rst->host, rst->port)) {
err = tcp_connect(&rst->tc, &srv, estab_handler, recv_handler,
close_handler, rst);
if (err) {
warning("rst: tcp connect error: %m\n", err);
}
}
else {
err = dnsc_query(&rst->dnsq, net_dnsc(baresip_network()),
rst->host, DNS_TYPE_A,
DNS_CLASS_IN, true, dns_handler, rst);
if (err) {
warning("rst: dns query error: %m\n", err);
}
}
return err;
}
int rst_alloc(struct rst **rstp, const char *dev)
{
struct pl host, port, path;
struct rst *rst;
int err;
if (!rstp || !dev)
return EINVAL;
if (re_regex(dev, strlen(dev), "http://[^:/]+[:]*[0-9]*[^]+",
&host, NULL, &port, &path)) {
warning("rst: bad http url: %s\n", dev);
return EBADMSG;
}
rst = mem_zalloc(sizeof(*rst), destructor);
if (!rst)
return ENOMEM;
rst->id = "rst";
err = pl_strdup(&rst->host, &host);
if (err)
goto out;
err = pl_strdup(&rst->path, &path);
if (err)
goto out;
rst->port = pl_u32(&port);
rst->port = rst->port ? rst->port : 80;
err = rst_connect(rst);
if (err)
goto out;
out:
if (err)
mem_deref(rst);
else
*rstp = rst;
return err;
}
void rst_set_audio(struct rst *rst, struct ausrc_st *st)
{
if (!rst)
return;
rst->ausrc_st = st;
}
void rst_set_video(struct rst *rst, struct vidsrc_st *st)
{
if (!rst)
return;
rst->vidsrc_st = st;
}
static int module_init(void)
{
int err;
err = rst_audio_init();
if (err)
goto out;
err = rst_video_init();
if (err)
goto out;
out:
if (err) {
rst_audio_close();
rst_video_close();
}
return err;
}
static int module_close(void)
{
rst_audio_close();
rst_video_close();
return 0;
}
EXPORT_SYM const struct mod_export DECL_EXPORTS(rst) = {
"rst",
"avsrc",
module_init,
module_close
};
| 17.125 | 77 | 0.606941 |
839cf14a4e52a76be169a114c386dde9b5b4b885 | 1,776 | h | C | System/Library/PrivateFrameworks/Home.framework/HFPowerStateControlItem.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 11 | 2019-11-06T04:48:48.000Z | 2022-02-09T17:48:15.000Z | System/Library/PrivateFrameworks/Home.framework/HFPowerStateControlItem.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 1 | 2020-04-16T01:41:56.000Z | 2020-04-16T04:32:00.000Z | System/Library/PrivateFrameworks/Home.framework/HFPowerStateControlItem.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 3 | 2019-12-22T20:17:53.000Z | 2021-01-25T09:47:49.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Tuesday, November 5, 2019 at 2:41:25 AM Mountain Standard Time
* Operating System: Version 13.0 (Build 17J586)
* Image Source: /System/Library/PrivateFrameworks/Home.framework/Home
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <Home/HFPrimaryStateControlItem.h>
#import <Home/HFPrimaryStateWriter.h>
@class NSSet, NSString;
@interface HFPowerStateControlItem : HFPrimaryStateControlItem <HFPrimaryStateWriter> {
NSSet* _auxiliaryTargetValueTuples;
}
@property (nonatomic,readonly) NSSet * auxiliaryTargetValueTuples; //@synthesize auxiliaryTargetValueTuples=_auxiliaryTargetValueTuples - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
+(Class)valueClass;
+(id)_powerStateTargetValues;
-(id)initWithValueSource:(id)arg1 displayResults:(id)arg2 ;
-(id)initWithValueSource:(id)arg1 auxiliaryTargetValueTuples:(id)arg2 displayResults:(id)arg3 ;
-(id)initWithValueSource:(id)arg1 auxiliaryTargetValueTuples:(id)arg2 additionalCharacteristicOptions:(id)arg3 displayResults:(id)arg4 ;
-(NSSet *)auxiliaryTargetValueTuples;
-(id)toggleValue;
-(id)writePrimaryState:(long long)arg1 ;
-(id)_allTargetValues;
-(id)togglePrimaryState;
-(id)initWithValueSource:(id)arg1 characteristicTypes:(id)arg2 displayResults:(id)arg3 ;
-(BOOL)canCopyWithCharacteristicOptions:(id)arg1 ;
-(id)copyWithCharacteristicOptions:(id)arg1 valueSource:(id)arg2 ;
-(id)valueForCharacteristicValues:(id)arg1 ;
-(id)characteristicValuesForValue:(id)arg1 ;
-(BOOL)supportsItemRepresentingServices:(id)arg1 ;
@end
| 41.302326 | 178 | 0.796171 |
39f4b6ab04b429b0908de1392d3cbf6a4046e169 | 3,407 | c | C | kernel/drivers/scsi/libfc/fc_libfc.c | LoongPenguin/Linux_210 | d941ed620798fb9c96b5d06764fb1dcb68057513 | [
"Apache-2.0"
] | 21 | 2021-01-22T06:47:38.000Z | 2022-03-20T14:24:29.000Z | kernel/drivers/scsi/libfc/fc_libfc.c | LoongPenguin/Linux_210 | d941ed620798fb9c96b5d06764fb1dcb68057513 | [
"Apache-2.0"
] | 1 | 2021-02-24T05:16:58.000Z | 2021-02-24T05:16:58.000Z | kernel/drivers/scsi/libfc/fc_libfc.c | LoongPenguin/Linux_210 | d941ed620798fb9c96b5d06764fb1dcb68057513 | [
"Apache-2.0"
] | 12 | 2021-01-22T14:59:28.000Z | 2022-02-22T04:03:31.000Z | /*
* Copyright(c) 2009 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/scatterlist.h>
#include <linux/crc32.h>
#include <scsi/libfc.h>
#include "fc_libfc.h"
MODULE_AUTHOR("Open-FCoE.org");
MODULE_DESCRIPTION("libfc");
MODULE_LICENSE("GPL v2");
unsigned int fc_debug_logging;
module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
/**
* libfc_init() - Initialize libfc.ko
*/
static int __init libfc_init(void)
{
int rc = 0;
rc = fc_setup_fcp();
if (rc)
return rc;
rc = fc_setup_exch_mgr();
if (rc)
goto destroy_pkt_cache;
rc = fc_setup_rport();
if (rc)
goto destroy_em;
return rc;
destroy_em:
fc_destroy_exch_mgr();
destroy_pkt_cache:
fc_destroy_fcp();
return rc;
}
module_init(libfc_init);
/**
* libfc_exit() - Tear down libfc.ko
*/
static void __exit libfc_exit(void)
{
fc_destroy_fcp();
fc_destroy_exch_mgr();
fc_destroy_rport();
}
module_exit(libfc_exit);
/**
* fc_copy_buffer_to_sglist() - This routine copies the data of a buffer
* into a scatter-gather list (SG list).
*
* @buf: pointer to the data buffer.
* @len: the byte-length of the data buffer.
* @sg: pointer to the pointer of the SG list.
* @nents: pointer to the remaining number of entries in the SG list.
* @offset: pointer to the current offset in the SG list.
* @km_type: dedicated page table slot type for kmap_atomic.
* @crc: pointer to the 32-bit crc value.
* If crc is NULL, CRC is not calculated.
*/
u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
struct scatterlist *sg,
u32 *nents, size_t *offset,
enum km_type km_type, u32 *crc)
{
size_t remaining = len;
u32 copy_len = 0;
while (remaining > 0 && sg) {
size_t off, sg_bytes;
void *page_addr;
if (*offset >= sg->length) {
/*
* Check for end and drop resources
* from the last iteration.
*/
if (!(*nents))
break;
--(*nents);
*offset -= sg->length;
sg = sg_next(sg);
continue;
}
sg_bytes = min(remaining, sg->length - *offset);
/*
* The scatterlist item may be bigger than PAGE_SIZE,
* but we are limited to mapping PAGE_SIZE at a time.
*/
off = *offset + sg->offset;
sg_bytes = min(sg_bytes,
(size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT),
km_type);
if (crc)
*crc = crc32(*crc, buf, sg_bytes);
memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes);
kunmap_atomic(page_addr, km_type);
buf += sg_bytes;
*offset += sg_bytes;
remaining -= sg_bytes;
copy_len += sg_bytes;
}
return copy_len;
}
| 25.237037 | 79 | 0.689169 |
261ccca3537698f45c26d5433bb17bfcf225db86 | 1,451 | h | C | include/bpf.h | vivienb73/cafebabe | 495fd21ef2f571fbb85962d2ce74959e4da7774c | [
"MIT"
] | null | null | null | include/bpf.h | vivienb73/cafebabe | 495fd21ef2f571fbb85962d2ce74959e4da7774c | [
"MIT"
] | null | null | null | include/bpf.h | vivienb73/cafebabe | 495fd21ef2f571fbb85962d2ce74959e4da7774c | [
"MIT"
] | null | null | null | #ifndef BPF_H
#define BPF_H
#include <poll.h> /* poll() */
#include <sys/ioctl.h> /* ioctl() */
#include <fcntl.h> /* open() */
#include <string.h> /* memset() */
#include <stdio.h> /* sprintf() */
#include <stdlib.h> /* malloc(), free() */
#include <unistd.h> /* read() */
#include <sys/time.h> /* struct timeval */
#include <poll.h>
#include <net/ethernet.h> /* ETHERTYPE_IP */
#include <netinet/ip.h> /* IPPROTO_TCP */
#include <net/bpf.h>
#include <net/if.h> /* struct ifreq */
/* linked list struct for bpf data */
struct bpfData{
int length;
char *data;
struct bpfData *nxt;
};
#define NODESIZ sizeof(struct bpfData)
/* opens a /dev/bpf device file */
int openDev(void);
/* sets the bpf interface */
int devInterface(int, char *);
/* fetch the kernel bpf buffer size */
int devLength(int);
/* sets the interface associated with the device to promiscuous */
int devPromisc(int);
/* set immmediate mode for the bpf device */
int devImm(int);
/* calls all the above set* functions, excluding setFilter() */
int setAll(int, char *, int);
/* initialises the linked list */
struct bpfData *initList(void);
/* adds a new node to the linked list */
int addData(struct bpfData *, char *, unsigned int);
/* trashes linked list */
void trashAll(struct bpfData *);
void *getData(struct bpfData *, int);
int getLength(struct bpfData *);
/* reads one or more packets from the bpf device */
int readDev(int, struct bpfData *, int);
#endif
| 22.671875 | 66 | 0.671261 |
64637dea8a19991949e5359b2e079fda235c548d | 893 | h | C | Alien Engine/CoreData/AlienEngineScripts/CameraUltiMode.h | OverPowered-Team/Alien-GameEngine | 713a8846a95fdf253d0869bdcad4ecd006b2e166 | [
"MIT"
] | 7 | 2020-02-20T15:11:11.000Z | 2020-05-19T00:29:04.000Z | Alien Engine/CoreData/AlienEngineScripts/CameraUltiMode.h | OverPowered-Team/Alien-GameEngine | 713a8846a95fdf253d0869bdcad4ecd006b2e166 | [
"MIT"
] | 125 | 2020-02-29T17:17:31.000Z | 2020-05-06T19:50:01.000Z | Alien Engine/CoreData/AlienEngineScripts/CameraUltiMode.h | OverPowered-Team/Alien-GameEngine | 713a8846a95fdf253d0869bdcad4ecd006b2e166 | [
"MIT"
] | 1 | 2020-05-19T00:29:06.000Z | 2020-05-19T00:29:06.000Z | #pragma once
#include "..\..\Alien Engine\Alien.h"
#include "Macros/AlienScripts.h"
class ALIEN_ENGINE_API CameraUltiMode : public Alien {
enum class Zoom{
NONE,
ZOOM_OUT,
ZOOM_IN,
STAYING_OUT,
};
public:
CameraUltiMode();
virtual ~CameraUltiMode();
void Start();
void Update();
void DejaVou();
public:
ComponentCamera* camera = nullptr;
float zoom_out_fov = 0.f;
float speed = 0.f;
float staying_time = 0.f;
private:
float prev_fov = 0.f;
float difference = 0.f;
bool is_dejavouing = false;
float timer = 0.f;
Zoom zoomer = Zoom::NONE;
};
ALIEN_FACTORY CameraUltiMode* CreateCameraUltiMode() {
CameraUltiMode* alien = new CameraUltiMode();
// To show in inspector here
SHOW_IN_INSPECTOR_AS_DRAGABLE_FLOAT(alien->zoom_out_fov);
SHOW_IN_INSPECTOR_AS_DRAGABLE_FLOAT(alien->speed);
SHOW_IN_INSPECTOR_AS_DRAGABLE_FLOAT(alien->staying_time);
return alien;
}
| 19.413043 | 58 | 0.737962 |
311dbbe130bbcdea12d3ee8bf337127d2a4586ae | 129 | h | C | Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/in_filter.h | MrsTrier/RememberArt | 90314d1f05a1d63b9885ebb17d37bab5134a24f3 | [
"MIT"
] | null | null | null | Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/in_filter.h | MrsTrier/RememberArt | 90314d1f05a1d63b9885ebb17d37bab5134a24f3 | [
"MIT"
] | null | null | null | Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/in_filter.h | MrsTrier/RememberArt | 90314d1f05a1d63b9885ebb17d37bab5134a24f3 | [
"MIT"
] | null | null | null | version https://git-lfs.github.com/spec/v1
oid sha256:5cd928cc99a73b6a530b150bfbe044addd4b19128a408c7da317836ca771423f
size 1268
| 32.25 | 75 | 0.883721 |
230b31bf1514ab16673a473aa701edfff162eda1 | 1,335 | h | C | Pods/ParseKit/include/ParseKit/PKPattern.h | allewun/Peckham | cfed35a410b70e0bbf2d376a231c03bd63292247 | [
"MIT"
] | 261 | 2015-01-05T19:59:08.000Z | 2022-02-22T23:57:36.000Z | Pods/ParseKit/include/ParseKit/PKPattern.h | allewun/Peckham | cfed35a410b70e0bbf2d376a231c03bd63292247 | [
"MIT"
] | 626 | 2015-01-05T23:36:25.000Z | 2021-11-04T17:51:00.000Z | Pods/ParseKit/include/ParseKit/PKPattern.h | allewun/Peckham | cfed35a410b70e0bbf2d376a231c03bd63292247 | [
"MIT"
] | 96 | 2015-01-05T19:59:17.000Z | 2021-10-16T23:24:22.000Z | // Copyright 2010 Todd Ditchendorf
//
// 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.
#import <Foundation/Foundation.h>
#import <ParseKit/PKTerminal.h>
#import <ParseKit/PKToken.h>
typedef enum {
PKPatternOptionsNone = 0,
PKPatternOptionsIgnoreCase = 2,
PKPatternOptionsComments = 4,
PKPatternOptionsMultiline = 8,
PKPatternOptionsDotAll = 32,
PKPatternOptionsUnicodeWordBoundaries = 256
} PKPatternOptions;
@interface PKPattern : PKTerminal {
PKPatternOptions options;
}
+ (PKPattern *)patternWithString:(NSString *)s;
+ (PKPattern *)patternWithString:(NSString *)s options:(PKPatternOptions)opts;
- (id)initWithString:(NSString *)s;
- (id)initWithString:(NSString *)s options:(PKPatternOptions)opts;
@end
| 33.375 | 78 | 0.701124 |
03896f7c859c72f8636c6408b3f2fc7735fe3342 | 1,674 | h | C | src/algorithms/local_search/operator.h | LBROUBRE/vroom-backend | b55e9334f538e854c2643073a82281fa97824056 | [
"BSD-2-Clause"
] | 1 | 2020-05-13T19:03:14.000Z | 2020-05-13T19:03:14.000Z | src/algorithms/local_search/operator.h | LBROUBRE/vroom-backend | b55e9334f538e854c2643073a82281fa97824056 | [
"BSD-2-Clause"
] | null | null | null | src/algorithms/local_search/operator.h | LBROUBRE/vroom-backend | b55e9334f538e854c2643073a82281fa97824056 | [
"BSD-2-Clause"
] | null | null | null | #ifndef OPERATOR_H
#define OPERATOR_H
/*
This file is part of VROOM.
Copyright (c) 2015-2020, Julien Coupey.
All rights reserved (see LICENSE).
*/
#include "structures/typedefs.h"
#include "structures/vroom/input/input.h"
#include "structures/vroom/raw_route.h"
#include "structures/vroom/solution_state.h"
namespace vroom {
namespace ls {
class Operator {
protected:
const Input& _input;
const utils::SolutionState& _sol_state;
// Source of move for this operator.
RawRoute& source;
std::vector<Index>& s_route;
const Index s_vehicle;
const Index s_rank;
// Target of move for this operator.
RawRoute& target;
std::vector<Index>& t_route;
const Index t_vehicle;
const Index t_rank;
bool gain_computed;
Gain stored_gain;
virtual void compute_gain() = 0;
public:
Operator(const Input& input,
const utils::SolutionState& sol_state,
RawRoute& s_raw_route,
Index s_vehicle,
Index s_rank,
RawRoute& t_raw_route,
Index t_vehicle,
Index t_rank)
: _input(input),
_sol_state(sol_state),
source(s_raw_route),
s_route(s_raw_route.route),
s_vehicle(s_vehicle),
s_rank(s_rank),
target(t_raw_route),
t_route(t_raw_route.route),
t_vehicle(t_vehicle),
t_rank(t_rank),
gain_computed(false),
stored_gain(0) {
}
virtual Gain gain();
virtual bool is_valid() = 0;
virtual void apply() = 0;
virtual std::vector<Index> addition_candidates() const = 0;
virtual std::vector<Index> update_candidates() const = 0;
virtual ~Operator() {
}
};
} // namespace ls
} // namespace vroom
#endif
| 20.168675 | 61 | 0.669056 |
03d7832a00e2de983e79a05996bc08aa34dfb27c | 37,534 | c | C | org.yafra.tdb.classic/act/lib/AKTreservat.c | yafraorg/yafra-tdb-c | c81c965a4a8947e7d6bad497ca09768243fcc26b | [
"Apache-2.0"
] | 1 | 2019-01-10T16:44:23.000Z | 2019-01-10T16:44:23.000Z | org.yafra.tdb.classic/act/lib/AKTreservat.c | yafraorg/yafra-tdb-c | c81c965a4a8947e7d6bad497ca09768243fcc26b | [
"Apache-2.0"
] | 1 | 2015-03-23T10:30:35.000Z | 2015-03-23T10:30:35.000Z | org.yafra.tdb.classic/act/lib/AKTreservat.c | yafraorg/yafra-tdb-c | c81c965a4a8947e7d6bad497ca09768243fcc26b | [
"Apache-2.0"
] | null | null | null | /*D***********************************************************
* Name: AKTreservat.c
*
* Modul: AKT base moduls
* Handle reservation long and short print forms
*
* Copyright: yafra.org, Basel, Switzerland
*************************************************************/
/* RCS static ID */
static char rcsid[]="$Header: /yafra/cvsroot/mapo/source/act/lib/AKTreservat.c,v 1.2 2008-11-02 19:55:50 mwn Exp $";
/* MarcoPolo API includes */
#include <mpact.h> /* Standard Includefile */
/*P--- EXTERNALS -----------------------------------------------------------*/
/*P--- PROTOTYPES ----------------------------------------------------------*/
/*P--- LAYOUT --------------------------------------------------------------*/
#define TEXTID7 7
#define COL_DL1 "%-2s" /* DL margin */
#define COL_DL2 "%-30.30s" /* DL bezeichnung */
#define COL_DL3 "%-s" /* DL anfang day */
#define COL_DL4 "%-2.2s" /* DL gap */
#define COL_DL5 "%-s" /* DL anfang date */
#define NOTIME "-------" /* no time */
/*P--- GLOBALS -----------------------------------------------------------*/
/*-- Common object texts -----------*/
#define AKTCOM_KAT_ZUSATZ 20
/*--- SQL ------------------------------------------------------------------*/
#define _SEL_ALL_RES_PERS "SELECT * FROM TDBADMIN.RESERVATION \
WHERE BID = %d \
AND PERS_ID = %d ORDER BY DLG_ID ;"
#define _SEL_ALL_AKT_DETAIL "SELECT * FROM TDBADMIN.AKT_DETAIL \
WHERE BID = %d AND PERS_ID = %d \
AND DLG_ID = %d AND A_TYP_ID = %d ;"
#define _SEL_DLG_DLG "SELECT * FROM TDBADMIN.DLG_DLG \
WHERE DLG_ID = %d ORDER BY ORD ;"
/*-- Res with status -----------*/
#define _SEL_RES_STA "SELECT * FROM TDBADMIN.RESERVATION R \
WHERE R_STA >= %d AND R_STA <= %d \
ORDER BY BID, PERS_ID, DLG_ID;" /*????? */
#define _SEL_RESBCH_STA "SELECT * FROM TDBADMIN.RESERVATION \
WHERE BID = %d \
AND R_STA >= %d AND R_STA <= %d \
ORDER BY BID, PERS_ID;"
#define _SEL_RESDL_STA "SELECT * FROM TDBADMIN.RESERVATION \
WHERE DLG_ID = %d \
AND R_STA >= %d AND R_STA <= %d \
ORDER BY BID, PERS_ID;"
#define _SEL_RES_DL "SELECT * FROM TDBADMIN.RESERVATION \
WHERE DLG_ID = %d \
ORDER BY PERS_ID;"
/*-- Res view with status ------*/
#define _SEL_RESV_ST "SELECT * FROM TDBADMIN.RES_DL_VIEW R \
WHERE R.R_STA >= %d AND R.R_STA <= %d \
ORDER BY R.R_STA, R.RESAZEIT, R.DLAZEIT, R.BID, R.PERS_ID;"
#define _SEL_RESV_BCH_ST "SELECT * FROM TDBADMIN.RES_DL_VIEW R \
WHERE R.BID = %d \
AND R.R_STA >= %d AND R.R_STA <= %d \
ORDER BY R.R_STA, R.RESAZEIT, R.DLAZEIT, R.BID, R.PERS_ID;"
#define _SEL_RESV_DL_ST "SELECT * FROM TDBADMIN.RES_DL_VIEW R \
WHERE R.DL_ID = %d \
AND R.R_STA >= %d AND R.R_STA <= %d \
ORDER BY R.R_STA, R.RESAZEIT, R.DLAZEIT, R.BID, R.PERS_ID;"
/*-- Res Buchung DL -----------*/
#define _SEL_RESBCH_DLG "SELECT * FROM TDBADMIN.RESERVATION WHERE BID = %d \
AND DLG_ID = %d ORDER BY PERS_ID, DL_ID, TEIL;"
/*-- Res view for PAX Cruise ---*/
#ifdef ps_unix
#define _SEL_RESV_DL "SELECT * FROM TDBADMIN.RES_DL_VIEW \
WHERE DL_ID = %d AND S_ID = %d \
GROUP BY KAT_ID, KATBEZ, DLT_ID, DLTBEZ, BID, PERS_ID, NAME, DL_ID, \
BID, DLAZEIT, TDL_ID, TDLAZEIT, TDLEZEIT,\
RESAZEIT, RESEZEIT, TYP_ID, KONT_ID, R_STA, S_ID \
ORDER BY KATBEZ, DLTBEZ, BID, PERS_ID;"
#endif
#ifdef ps_win
#define _SEL_RESV_DL "SELECT * FROM TDBADMIN.RES_DL_VIEW \
WHERE DL_ID = %d AND S_ID = %d \
ORDER BY KATBEZ, DLTBEZ, PERS_ID;"
#endif
/*-- Res view for PAX Bus ------*/
#define _SEL_RESV_DL_1 "SELECT * FROM TDBADMIN.RES_DL_VIEW \
WHERE DL_ID = %d AND S_ID = %d \
ORDER BY NAME, PERS_ID, DL_ID, TDLEZEIT ;"
/*-- Get first part of a Hostdlid ---*/
#define _SEL_FIRST_DLG_PART "SELECT * FROM TDBADMIN.DLG_PARTS \
WHERE H_DL_ID = %d \
AND ORD = (SELECT MIN(ORD) FROM TDBADMIN.DLG_PARTS \
WHERE H_DL_ID = %d);"
/*-- Get all dlg_id from one bid ---*/
#define _SEL_BID_DLG "SELECT DISTINCT(DLG_ID) FROM TDBADMIN.RESERVATION \
WHERE BID = %d;"
/*F--------------------------------------------------------------------------
* Function: AKTreservatMemobjectInit
* init memory for reservations operations
*---------------------------------------------------------------------------
*/
void AKTreservatMemobjInit( )
{
extern MEMOBJ resmem, *pResmem;
extern RESERVATION *reservation ;
extern MEMOBJ aktdetmem, *pAktdetmem;
extern AKT_DETAIL *aktdetail ;
/*--- reservation --------------*/
reservation = (RESERVATION *)NULL;
resmem.buffer = NULL;
resmem.alloclen = 0;
resmem.datalen = 0;
pResmem = &resmem;
/*--- aktion detail ------------*/
aktdetail = (AKT_DETAIL *)NULL;
aktdetmem.buffer = NULL;
aktdetmem.alloclen = 0;
aktdetmem.datalen = 0;
pAktdetmem = &aktdetmem;
}
/*F--------------------------------------------------------------------------
* Function: AKTresViewMemobjInit
* init memory for reservations view operations
*---------------------------------------------------------------------------
*/
void AKTresViewMemobjInit( )
{
extern MEMOBJ resvmem, *pResvmem;
extern RES_DL_VIEW *resview ;
/*--- reservation --------------*/
resview = (RES_DL_VIEW *)NULL;
resvmem.buffer = NULL;
resvmem.alloclen = 0;
resvmem.datalen = 0;
pResvmem = &resvmem;
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatMemobjectFree
* free memory of reservations
*---------------------------------------------------------------------------
*/
void AKTreservatMemobjFree( )
{
extern MEMOBJ resmem;
extern MEMOBJ aktdetmem;
/*--- reservation --------------*/
MPfreeobj(&resmem);
/*--- action detail ------------*/
MPfreeobj(&aktdetmem);
/*--- prepare for next usage ---*/
AKTreservatMemobjInit();
}
/*F--------------------------------------------------------------------------
* Function: AKTresViewMemobjFree
* free memory of reservations view
*---------------------------------------------------------------------------
*/
void AKTresViewMemobjFree( )
{
extern MEMOBJ resvmem, *pResvmem;
extern RES_DL_VIEW *resview ;
/*--- reservation --------------*/
MPfreeobj(&resvmem);
/*--- prepare for next usage ---*/
AKTresViewMemobjInit();
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatFindDl
* look for all reservation with a Dl
*
* in: dl id
* out: array of RESs ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatFindDl( int aDlid )
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- query reservations -------*/
if (aDlid != (int)_UNDEF)
{
(void)sprintf(query, _SEL_RES_DL, aDlid );
status = MPAPIdb_sqlquery((int)_RESERVATION, (char **)(&resmem.buffer),
query, &anzRes, &resmem.datalen, &resmem.alloclen );
}
else
status = (int)MPERROR;
reservation = (RESERVATION *)resmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatFindAll
* look for all reservation for a dln
*
* in: dln id
* out: array of RESs ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatFindAll( int aBid, int aPersid )
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- query reservations -------*/
if (aPersid != (int)_UNDEF)
{
(void)sprintf(query, _SEL_ALL_RES_PERS, aBid, aPersid);
status = MPAPIdb_sqlquery((int)_RESERVATION, (char **)(&resmem.buffer),
query, &anzRes, &resmem.datalen, &resmem.alloclen );
}
else
status = (int)MPERROR;
reservation = (RESERVATION *)resmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatFindCat
* look for category in all reservation for a dln
*
* in: dlg id
* out: string with the Category Bez
* return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatFindCat( int aDlgid, int aDlnid, char *CatTxt )
{
extern RESERVATION *reservation ;
extern int anzRes;
int id, ires, status;
KAT_VIEW kat_view;
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- reservation loop -------*/
if (aDlgid != (int)_UNDEF && aDlnid != (int)_UNDEF )
{
for ( ires=0; ires < anzRes; ires++ )
{
if ( ( reservation[ires].dlg_id == aDlgid ) &&
( reservation[ires].pers_id == aDlnid ) )
{
if ( reservation[ires].kat_id != (int)_UNDEF )
{
id = MPAPIselectOneId((int)_KAT_VIEW, reservation[ires].kat_id,
(char *)&kat_view);
if ( id != (int)_UNDEF )
{
copyTextTo( CatTxt, kat_view.bez, _CHAR30 );
}
else
{
strcpy( CatTxt, "?" );
}
}
else
{
strcpy( CatTxt, " " );
}
}
}
}
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatBidDlgid
* look for all reservation for a dl
*
* in: dln id
* out: array of RESs ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatBidDlgid( int aBid, int aDlid )
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- query reservations -------*/
if ((aBid != (int)_UNDEF) && (aDlid != (int)_UNDEF))
{
(void)sprintf(query, _SEL_RESBCH_DLG, aBid, aDlid);
status = MPAPIdb_sqlquery((int)_RESERVATION, (char **)(&resmem.buffer),
query, &anzRes, &resmem.datalen, &resmem.alloclen );
}
else
status = (int)MPERROR;
reservation = (RESERVATION *)resmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatStatus
* look for all reservation which are < tartget status
*
* in: dln id
* out: array of RESs ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatStatus( int aBid, int aDlid, int aSourcesta, int aTargetsta )
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
extern int DebugFlag;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- get all needed RESERVATION ---------------*/
if (aBid != (int)_UNDEF)
(void)sprintf( query, _SEL_RESBCH_STA, aBid, aSourcesta, aTargetsta);
else if (aDlid != (int)_UNDEF)
(void)sprintf( query, _SEL_RESDL_STA, aDlid, aSourcesta, aTargetsta);
else
(void)sprintf( query, _SEL_RES_STA, aSourcesta, aTargetsta);
/*.... DEBUG .......*/
if (DebugFlag)
printf("%sAKTreservatStatus: sql-query %s%s", _P_EOL_, query, _P_EOL_ );
status = MPAPIdb_sqlquery((int)_RESERVATION, (char **)(&resmem.buffer),
query, &anzRes, &resmem.datalen, &resmem.alloclen );
reservation = (RESERVATION *)resmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTresViewStatus
* look for all reservation views which are in status range
*
* in: a bchid, a dlid , source and target status
* out: array of resview ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTresViewStatus( int aBid, int aDlid, int aSourcesta, int aTargetsta )
{
extern MEMOBJ resvmem, *pResvmem;
extern RES_DL_VIEW *resview ;
extern int anzResv;
extern int DebugFlag;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- get all needed RES_DL_VIEW ---------------*/
if (aBid != (int)_UNDEF)
(void)sprintf( query, _SEL_RESV_BCH_ST, aBid, aSourcesta, aTargetsta);
else if (aDlid != (int)_UNDEF)
(void)sprintf( query, _SEL_RESV_DL_ST, aDlid, aSourcesta, aTargetsta);
else
(void)sprintf( query, _SEL_RESV_ST, aSourcesta, aTargetsta);
/*DEBUG*****************/
if (DebugFlag)
printf("%sAKTresViewStatus: sql-query %s%s", _P_EOL_, query, _P_EOL_ );
/*--- query reservations views -----------------------*/
if ((aSourcesta != (int)_UNDEF)&&(aTargetsta != (int)_UNDEF))
{
status = MPAPIdb_sqlquery((int)_RES_DL_VIEW, (char **)(&resvmem.buffer),
query, &anzResv, &resvmem.datalen, &resvmem.alloclen );
}
else
status = (int)MPERROR;
resview = (RES_DL_VIEW *)resvmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTresViewDl
* look for all reservation views with Dl id
*
* in: a dlid
* out: array of resview ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTresViewDl( int aDlid )
{
extern MEMOBJ resvmem, *pResvmem;
extern RES_DL_VIEW *resview ;
extern int anzResv;
extern int DebugFlag;
extern int outputsprache;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
*query = (char)NULL ;
/*?????!!!! hardcoded sprache 1 in query *********/
/*--- get all needed RES_DL_VIEW ---------------*/
if (aDlid != (int)_UNDEF)
{
(void)sprintf( query, _SEL_RESV_DL, aDlid, 1); /*???! hardcoded sprache 1 */
}
/*..... DEBUG ......../
if (DebugFlag)
printf("%sAKTresViewDl: sql-query %s%s", _P_EOL_, query, _P_EOL_ );
/*--- query reservations views -----------------------*/
if ( strlen(query) > 0)
status = MPAPIdb_sqlquery((int)_RES_DL_VIEW, (char **)(&resvmem.buffer),
query, &anzResv, &resvmem.datalen, &resvmem.alloclen );
else
status = (int)MPERROR;
resview = (RES_DL_VIEW *)resvmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTresViewDl_variant
* look for all reservation views with Dl id
* Order by is variable
* in: a dlid
* out: array of resview ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTresViewDl_variant( int aDlid, int aVariant)
{
extern MEMOBJ resvmem, *pResvmem;
extern RES_DL_VIEW *resview ;
extern int anzResv;
extern int DebugFlag;
extern int outputsprache;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
*query = (char)NULL ;
/*--- pre-conditions --------------------*/
if (aDlid == (int)_UNDEF)
return((int)MPERROR); /*>>>>>> exit >>>>*/
/*?????!!!! hardcoded sprache 1 in query *********/
/*--- get all needed RES_DL_VIEW ---------------*/
if (aVariant == VARIANT_0)
(void)sprintf( query, _SEL_RESV_DL, aDlid, 1);
if (aVariant == VARIANT_1)
(void)sprintf( query, _SEL_RESV_DL_1, aDlid, 1);
/*..... DEBUG ......../
if (DebugFlag)
printf("%sAKTresViewDl: sql-query %s%s", _P_EOL_, query, _P_EOL_ );
/*--- query reservations views -----------------------*/
if ( strlen(query) > 0)
status = MPAPIdb_sqlquery((int)_RES_DL_VIEW, (char **)(&resvmem.buffer),
query, &anzResv, &resvmem.datalen, &resvmem.alloclen );
else
status = (int)MPERROR;
resview = (RES_DL_VIEW *)resvmem.buffer;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatCopyDate()
* collect all date/time in same res structure
* In: -
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatCopyDate()
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
DLG_PART dlg_part;
DIENSTLEISTUNG dl;
int k, idd;
RESERVATION *pRes;
/*--- Loop for all RESERVATIONs -----------------------------------*/
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
/*--- check complete DL ----------------------*/
if (pRes->dl_id == -1)
{
if ( pRes->a_zeit <= (int)0 )
{
idd = MPAPIselectOneId((int)_DIENSTLEISTUNG, pRes->dlg_id, (char *)&dl);
pRes->a_zeit = dl.a_zeit;
pRes->e_zeit = dl.a_zeit; /* force with a_zeit ! */
}
}
else
{
/*--- Dl_part -----------------------------*/
idd = MPAPIselectOneId((int)_DLG_PART, pRes->dl_id, (char *)&dlg_part);
/*--- Normalize date/time in RES struct ---*/
if (dlg_part.res_f != _RES_DYNAMIC)
{
pRes->a_zeit = dlg_part.a_zeit;
pRes->e_zeit = dlg_part.e_zeit;
}
}
}
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatCopySortDate()
* collect all date/time in same res structure, order by date
* In: -
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatCopySortDate()
{
extern RESERVATION *reservation ;
extern int anzRes;
int (*comparefunc)(void *, void *);
/*--- copy date from parts so that we are ready to sort -----*/
AKTreservatCopyDate();
/*--- Order by date/time -------------------------------------------*/
if (anzRes > 1 )
{
comparefunc = AKTcompareResDate;
qsort((void*)reservation, (size_t)anzRes, (size_t)sizeof(RESERVATION),
comparefunc );
}
#ifdef DEBUG_GING
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
fprintf(stderr, "persid:%d, dlg_id:%d, dl_id: %d, teil:%d %s",
pRes->pers_id, pRes->dlg_id, pRes->dl_id, pRes->teil, _P_EOL_ );
}
#endif
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatReplaceDl()
* replace the -1 parameter in a reservation with host dl_id
* In: -
* out: -
* Return: -status
*---------------------------------------------------------------------------
*/
int AKTreservatReplaceDl()
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
DLG_PART dlg_part;
int status, k, idd;
RESERVATION *pRes;
status = (int)MPOK;
/*--- Loop for all RESERVATIONs -----------------------------------*/
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
/*--- get complete host DL -------------------*/
if (pRes->dl_id == -1)
{
idd = MPAPIselectTDL( pRes->dlg_id, &dlg_part);
pRes->dl_id = dlg_part.dl_id;
}
}
return (status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatPartsExpand()
* check if there are DL with -1 to be expanded
* save the old to ex-reservation array
* expand the DLs with all parts to reservation array
* In: -
* out: -
* Return: -status
*---------------------------------------------------------------------------
*/
int AKTreservatPartsExpand()
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
char query[2*RECLAENGE];
int status, k, n, idd, totalRes;
DLG_PART dlg_part, *pDlg_part;
RESERVATION *pRes, *pExres ;
DLG_DLG *dlgdlg, *pDlgdlg;
MEMOBJ dlgdlgmem, *pDlgdlgmem; /* memory for dlg_dlg*/
int anzDlgdlg;
MEMOBJ exresmem;
RESERVATION *exreservation;
/*--- Init memory objects ------*/
dlgdlgmem.buffer = NULL;
dlgdlgmem.alloclen = 0;
dlgdlgmem.datalen = 0;
pDlgdlgmem = &dlgdlgmem;
/*--- expanded reservation -----*/
exreservation = (RESERVATION *)NULL;
exresmem.buffer = NULL;
exresmem.alloclen = 0;
exresmem.datalen = 0;
status = (int)MPOK;
totalRes = 0;
/*--- Allocate mem and copy compressed ex-reservation --------------*/
exresmem.datalen = anzRes * (sizeof(RESERVATION)) ;
exreservation = (RESERVATION *)MPallocobj( &exresmem, LITTELMEMCHUNK);
exresmem.buffer = (char *)exreservation;
(void)memcpy( (void *)(exreservation), (void *)reservation, exresmem.datalen);
/*--- Loop for all RESERVATIONs -----------------------------------*/
for (k=0; k < anzRes; k++)
{
pExres = &exreservation[k];
/*--- check complete DL -------------------*/
if (pExres->dl_id == -1)
{
/*---- Get all dlg_dlg's --------*/
(void)sprintf(query, _SEL_DLG_DLG, pExres->dlg_id);
status = MPAPIdb_sqlquery((int)_DLG_DLG, (char **)(&dlgdlgmem.buffer),
query, &anzDlgdlg, &dlgdlgmem.datalen, &dlgdlgmem.alloclen );
if (status != (int)MPOK)
return ( status); /*>>>> exit >>>>>>>>>*/
dlgdlg = (DLG_DLG *)dlgdlgmem.buffer;
/*--- Allocate memory for new reservation struct ------------*/
resmem.datalen = (totalRes + anzDlgdlg) * (sizeof(RESERVATION)) ;
reservation = (RESERVATION *)MPallocobj( &resmem, LITTELMEMCHUNK);
resmem.buffer = (char *)reservation;
/*-- next free struct -----------------*/
pRes = &reservation[totalRes] ;
/*-- Copy parts stuff if more than ONE ----------*/
for (n=0; n < anzDlgdlg; n++)
{
/*-- Get DL id and selct TDL --------*/
pDlgdlg = &dlgdlg[n];
idd = MPAPIselectOneId((int)_DLG_PART, pDlgdlg->dl_id, (char *)&dlg_part);
if (idd == (int)_UNDEF)
return ((int)MPERROR ); /* >>>>>>>>> exit >>>*/
/*-- copy default DL struct ---------*/
*pRes = *pExres;
/*-- Fill with specific part --------*/
pDlg_part = &dlg_part;
pRes->dl_id = pDlg_part->dl_id ;
pRes->teil = pDlg_part->ord ;
if (dlg_part.res_f != _RES_DYNAMIC)
{
pRes->a_zeit = pDlg_part->a_zeit ;
pRes->e_zeit = pDlg_part->e_zeit ;
}
pRes++; /* next struct */
}
/*-- forward subscript ------------*/
totalRes += anzDlgdlg ;
}
else
{
/*--- Allocate memory for new reservation struct ------------*/
resmem.datalen = (totalRes + 1) * (sizeof(RESERVATION)) ;
reservation = (RESERVATION *)MPallocobj( &resmem, LITTELMEMCHUNK);
resmem.buffer = (char *)reservation;
/*-- next free struct -----------------*/
pRes = &reservation[totalRes] ;
/*-- copy ex reservation -------*/
*pRes = *pExres;
pRes++; /* next struct */
/*-- forward subscript ------------*/
totalRes += 1 ;
}
}
anzRes = totalRes;
/*--- conclusion ----------------*/
MPfree((void *)dlgdlgmem.buffer);
MPfree((void *)exresmem.buffer);
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatSortService ()
* sort and eliminate duplicate teil dl in same booking
* In: -
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatSortService()
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
int k;
int oldBid, oldDlgId, oldPersid;
RESERVATION *pRes;
/*--- Loop for all RESERVATIONs -----------------------------------*/
oldDlgId = (int)_UNDEF;
oldBid = (int)_UNDEF;
oldPersid = (int)_UNDEF;
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
/*--- eliminate duplicates keep only new Dl ---*/
if ((pRes->dlg_id == oldDlgId) && (pRes->bid == oldBid) && (pRes->pers_id == oldPersid))
pRes->dlg_id = (int)_UNDEF;
else
oldDlgId = pRes->dlg_id;
/*--- rotations -------------------------------*/
/* oldDlgId = pRes->dlg_id; */
oldBid = pRes->bid;
oldPersid = pRes->pers_id;
}
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatSortLeader ()
* enable only the leader entries in same booking
* In: -
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatSortLeader()
{
extern RESERVATION *reservation ;
extern int anzRes;
int k;
int oldBid, oldPersid;
RESERVATION *pRes;
/*--- Loop for all RESERVATIONs -----------------------------------*/
oldBid = (int)_UNDEF;
oldPersid = (int)_UNDEF;
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
if ( pRes->bid != oldBid )
oldPersid = pRes->pers_id;
/*--- eliminate duplicates keep only new Dl ---*/
if ((pRes->bid == oldBid) && (pRes->pers_id != oldPersid))
pRes->dlg_id = (int)_UNDEF;
/*--- rotations -------------------------------*/
oldBid = pRes->bid;
}
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatGetStartDate ()
* look for the first date available: Precondition must be sorted!
* In: -ptr to startDate
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatGetStartDate( time_t *startDate)
{
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
int k;
RESERVATION *pRes;
/*--- Loop for all RESERVATIONs -----------------------------------*/
*startDate = 0;
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
if (pRes->dlg_id != (int)_UNDEF )
{
/*--- get the earliest date of all since ordered --*/
if ((pRes->a_zeit != 0) && (*startDate == 0))
*startDate = pRes->a_zeit;
}
}
}
/*F--------------------------------------------------------------------------
* Function: AKTactionDetailFind
* look for all reservations responding to action type
*
* in: memory ptr, anzahl, buchung id, personen id, Dlg id,
* aktionstype id
* out: array of AKT_DETAILs ptrs to fill, numbers
* return: success code
*---------------------------------------------------------------------------
*/
int AKTactionDetailFind( int aBchid, int aPersid, int aDlgid, int anAkttid )
{
extern MEMOBJ aktdetmem, *pAktdetmem;
extern AKT_DETAIL *aktdetail ;
extern int anzAktdet;
int status;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MPOK ;
/*--- query aktion_detail tables -------*/
if ((aBchid != (int)_UNDEF) && (aPersid != (int)_UNDEF) &&
(aDlgid != (int)_UNDEF) && (anAkttid != (int)_UNDEF) )
{
(void)sprintf(query, _SEL_ALL_AKT_DETAIL, aBchid, aPersid, aDlgid, anAkttid);
status = MPAPIdb_sqlquery((int)_AKT_DETAIL, (char **)(&aktdetmem.buffer),
query, &anzAktdet, &aktdetmem.datalen, &aktdetmem.alloclen );
}
else
status = MPERROR;
return(status);
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatCheckActionType ()
* check if all reservations are ok for that action
* In: -res array, number, buchung id, personen id
* out: -changes startDate
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservatCheckActionType( )
{
extern int akttid; /* interface parameter */
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
extern MEMOBJ aktdetmem;
extern int anzAktdet;
int k, status;
RESERVATION *pRes;
/*--- Loop for all RESERVATIONs -----------------------------------*/
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
/*--- Valid Dl ? --------------*/
if (pRes->dlg_id != (int)_UNDEF )
{
/*--- Check if ok for that aktion typ ----------*/
status = AKTactionDetailFind( pRes->bid, pRes->pers_id, pRes->dlg_id,
akttid);
if (status != (int)MPOK)
{
AKTmsg( ACT_ERROR, MPA_SELECTERROR, NULL);
continue;
}
#ifdef DEBUG_GING
fprintf(stderr, "bid:%d, persid:%d, dlg_id:%d, anzAktdet: %d %s",
pRes->bid, pRes->pers_id, pRes->dlg_id, anzAktdet, _P_EOL_ );
#endif
/*--- eliminate Dl if not in aktdetail -----*/
if (anzAktdet <= 0)
pRes->dlg_id = (int)_UNDEF ;
}
}
}
/*F--------------------------------------------------------------------------
* Function: AKTreservationMini ()
* print out reservation text in short form
* In: -
* out: -
* Return: -
*---------------------------------------------------------------------------
*/
void AKTreservationMini()
{
extern FILE *FPout;
extern MEMOBJ resmem;
extern RESERVATION *reservation ;
extern int anzRes;
extern char language[];
DIENSTLEISTUNG dl;
int k, idd;
char format[_CHAR80+1];
char titleTxt[_CHAR80+1];
char bezDl[_CHAR80+1];
char adate[_DATELEN], azeit[_DATELEN], aday[_DATELEN]; /* anfang */
RESERVATION *pRes;
/*--- inits --------------*/
*bezDl = (char)NULL;
sprintf(format, "%s%s%s%s%s%s", _P_EOL_, COL_DL1, COL_DL2, COL_DL3, COL_DL4, COL_DL5);
/*--- Services title -----*/
fprintf(FPout, "%s", _P_EOL_ );
AKTlayoutLinesAdd( 1 );
(void)AKTobjtxt( (int)_COMMON_TYP, (int)TEXTID7, titleTxt, NOMARGIN);
fprintf(FPout, "%s", titleTxt);
AKTlayoutLinesAdd( 1 );
/*--- Loop for all RESERVATIONs -----------------------------------*/
for (k=0; k < anzRes; k++)
{
pRes = &reservation[k];
/*--- valid dl ? ------------------------------------------*/
if (pRes->dlg_id != (int)_UNDEF )
{
/*--- Dl bez in actual or default language ------*/
idd = MPAPIselectOneId((int)_DIENSTLEISTUNG, pRes->dlg_id, (char *)&dl);
(void)AKTobjbez( (int)_DIENSTLEISTUNG, dl.bez_id, bezDl);
/*--- Date and time -----------------------------*/
AKTdatetimeday( pRes->a_zeit, adate, azeit, aday, language);
/*--- Compute/Print out -------------------------------*/
fprintf(FPout, format, " ", bezDl, aday, " ", adate );
AKTlayoutLinesAdd( 1 );
}
}
fprintf(FPout, "%s", _P_EOL_);
AKTlayoutLinesAdd( 1 );
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatCheckFirstLeg( int aBid, int aTdlid )
* check if the given aTdlid is on the first leg or not
* In: - BuchungsId und HostTeildienstleistung
* out: -
* Return: - status MP_NOT_MATCHING == reservation nicht auf erstem Leg
* MP_MATCHING == reservation auf dem ersten Leg
* MP_ERROR == Datanbankfehler
*---------------------------------------------------------------------------
*/
int AKTreservatCheckFirstLeg( int aBid, int aTdlid )
{
extern MEMOBJ dlgdlgmem;
extern DLG_DLG *dlgdlg ;
extern int anzDlgdlg;
extern int DebugFlag;
DLG_PART *dlg_part;
DLG_DLG *aDlgdlg;
unsigned long datalength, alloclength;
int *Dlgid;
int status, i, k;
int First_Tdlid;
int anzDlg, anzDl;
char query[2*RECLAENGE];
/*--- general inits ------------*/
status = (int)MP_NOT_MATCHING;
/*--- query the first dlg_parts of the host dlid -------*/
if ( aTdlid != (int)_UNDEF )
{
/*--- get first Part of the Hostdlid -------------------*/
(void)sprintf(query, _SEL_FIRST_DLG_PART, aTdlid, aTdlid );
anzDl = (int)0;
alloclength = (unsigned long)0;
dlg_part = (DLG_PART *)NULL;
status = MPAPIdb_sqlquery((int)_DLG_PART, (char **)&dlg_part,
query, &anzDl, &datalength, &alloclength );
if ( status != (int)MPOK ) /*--- SQL error occurred ---*/
{
/*--- Free allocated mem --------------*/
MPfree((void *)dlg_part);
return( MP_NOT_MATCHING );
}
else
{
if ( anzDl > (int)1 ) /*--- not a single record has been found ---*/
{
/*--- Free allocated mem --------------*/
MPfree((void *)dlg_part);
return( (int)MP_NOT_MATCHING );
}
else if ( anzDl == (int)0 ) /*--- there is no detail entry ---*/
{
MPfree((void *)dlg_part);
return( (int)MP_MATCHING );
}
else
{
First_Tdlid = dlg_part[0].dl_id;
/*--- Free allocated mem --------------*/
MPfree((void *)dlg_part);
}
}
}
else
return( (int)MP_NOT_MATCHING );
anzDlg = (int)0;
(void)sprintf(query, _SEL_BID_DLG, aBid);
Dlgid = (int *)NULL;
alloclength = (unsigned long)0;
status = MPAPIdb_sqlquery((int)_INTEGER, (char **)&Dlgid, query, &anzDlg,
&datalength, &alloclength );
/*--- Loop over all dlg's -----------------------------------*/
for (k=0; k < anzDlg; k++)
{
if ( Dlgid[k] != (int)UNDEF )
{
/*--- get all dlg_parts of the reserved dlg ---*/
status = AKTdlgdlgFindAll( Dlgid[k] );
if ( status == (int)MPOK )
{
/*--- loop over all dlg_dlg entries of the dlg ---*/
for ( i = 0; i < anzDlgdlg; i++ )
{
aDlgdlg = &dlgdlg[i];
if ( aDlgdlg->dl_id == First_Tdlid )
{
if (DebugFlag)
fprintf(stderr, "Bid %d : First Part matches %d%s", aBid, First_Tdlid, _P_EOL_ );
/*--- Free allocated mem --------------*/
MPfree((void *)Dlgid);
return( (int)MP_MATCHING );
}
}
}
}
}
if (DebugFlag)
fprintf(stderr, "Bid %d : First Part NOT found %d%s", aBid, First_Tdlid, _P_EOL_ );
/*--- Free allocated mem --------------*/
MPfree((void *)Dlgid);
return ( (int)MP_NOT_MATCHING );
}
/*F--------------------------------------------------------------------------
* Function: AKTreservatChangeZusatzbett( int aDlgId, int aZusatzid )
* Change to Zusatzbett
* In: - Zusatzbett TypId
* out: -
* Return: - return: success code
*---------------------------------------------------------------------------
*/
void AKTreservatChangeZusatzbett( int aDlgId, int aZusatzid )
{
extern RESERVATION *reservation ;
extern int anzRes;
RESERVATION *pRes ;
int found, type;
char tmpBuf[_TEXTLEN+1];
char *ptr, *bufptr;
int j;
/*--- check presence in DB types -------------------*/
(void)AKTobjtxt((int)_COMMON_TYP, (int)AKTCOM_KAT_ZUSATZ, tmpBuf, NOMARGIN);
for (j=0; j < anzRes; j++) /* force zusatzbett */
{
pRes = &reservation[j];
if ( aDlgId == pRes->dlg_id ) /* only for this dlg */
{
bufptr = tmpBuf;
found = 0;
while ((ptr = strchr(bufptr, '$')) != NULL)
{
ptr++ ;
type = atoi(ptr);
bufptr = ptr;
if ( pRes->kat_id == type )
{
found = 1 ;
break;
}
}
if ( ! found )
{
pRes->typ_id = aZusatzid ;
}
}
}
}
/*SF-------------------------------------------------------------------------
* function: AKTreservatGetStrechFrom
* Create the From To Strech of a Teil
*
* In: - a PersId, a Part,
* out: - a Strech
* Return: - return: success code
*---------------------------------------------------------------------------
*/
int AKTreservatGetStrechFrom ( int aPersId, int aTeil, char *aFrom, char *aTo )
{
extern DLG_PART tdl;
extern DIENST_ANGEBOT dla;
extern RESERVATION *reservation ;
extern int anzRes;
RESERVATION *pRes;
DLG_PART aTdl;
DIENST_ANGEBOT aDla;
ORT aOrt;
int i, status, id;
int firstpart, lastpart;
/*--- init --------*/
status = (int)MPOK;
*aFrom = '\0';
*aTo = '\0';
firstpart = (int)TRUE;
lastpart = (int)FALSE;
for ( i=0; i<anzRes; i++ )
{
pRes = &reservation[i];
/* skip entries that do not belong to arguments */
if ( pRes->teil != aTeil || pRes->pers_id != aPersId )
continue;
/*--- DLA_TYP suchen ----------------------*/
id = MPAPIselectOneId((int)_DLG_PART, pRes->dl_id, (char *)&aTdl );
if (id == (int)_UNDEF)
return ( (int)MPERROR ); /* >>>> exit >>>*/
id = MPAPIselectOneId((int)_DIENST_ANGEBOT, aTdl.dla_id, (char *)&aDla );
if (id == (int)_UNDEF)
return ( (int)MPERROR ); /* >>>> exit >>>*/
/*--- Erster Teil der Strecke ---*/
if ( firstpart == (int)TRUE )
{
/*--- Von Ort der Strecke ----*/
id = MPAPIselectOneId ( (int)_ORT, aDla.von, (char*)&aOrt );
if ( id != (int)_UNDEF )
{
(void)copyTextTo( aFrom, aOrt.krzl, 3 );
}
else
(void)strcpy ( aFrom, "-" );
firstpart = (int)FALSE;
lastpart = (int)TRUE;
}
/*--- Last part of the individual route ---*/
if ( lastpart == (int)TRUE )
{
/*--- Von Ort der Strecke ----*/
id = MPAPIselectOneId ( (int)_ORT, aDla.nach, (char*)&aOrt );
if ( id != (int)_UNDEF )
(void)copyTextTo( aTo, aOrt.krzl, 3 );
else
(void)strcpy ( aTo, "-" );
}
}
return(status);
}
| 28.221053 | 116 | 0.505542 |
03e278a59d95a9f67b01b0fc9581b81e94a3b163 | 1,765 | h | C | NewsCore.framework/FCOfflineANFArticlesFetchOperation.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 4 | 2021-10-06T12:15:26.000Z | 2022-02-21T02:26:00.000Z | NewsCore.framework/FCOfflineANFArticlesFetchOperation.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | null | null | null | NewsCore.framework/FCOfflineANFArticlesFetchOperation.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 1 | 2021-10-08T07:40:53.000Z | 2021-10-08T07:40:53.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/NewsCore.framework/NewsCore
*/
@interface FCOfflineANFArticlesFetchOperation : FCOperation {
NSArray * _articleIDs;
bool _cachedOnly;
<FCContentContext> * _context;
id /* block */ _fetchCompletionHandler;
<FCFlintHelper> * _flintHelper;
unsigned long long _maximumMissingArticles;
id /* block */ _progressHandler;
id _resultHoldToken;
}
@property (nonatomic, retain) NSArray *articleIDs;
@property (nonatomic) bool cachedOnly;
@property (nonatomic, retain) <FCContentContext> *context;
@property (nonatomic, copy) id /* block */ fetchCompletionHandler;
@property (nonatomic, retain) <FCFlintHelper> *flintHelper;
@property (nonatomic) unsigned long long maximumMissingArticles;
@property (nonatomic, copy) id /* block */ progressHandler;
@property (nonatomic, retain) id resultHoldToken;
- (void).cxx_destruct;
- (id)_promiseANFResourcesFromHeadlines:(id)arg1;
- (id)_promiseHeadlines;
- (id)_promiseThumbnailsAndANFDocumentsFromHeadlines:(id)arg1;
- (id)articleIDs;
- (bool)cachedOnly;
- (id)context;
- (id /* block */)fetchCompletionHandler;
- (id)flintHelper;
- (id)initWithContext:(id)arg1 flintHelper:(id)arg2 articleIDs:(id)arg3;
- (unsigned long long)maximumMissingArticles;
- (void)operationWillFinishWithError:(id)arg1;
- (void)performOperation;
- (id /* block */)progressHandler;
- (id)resultHoldToken;
- (void)setArticleIDs:(id)arg1;
- (void)setCachedOnly:(bool)arg1;
- (void)setContext:(id)arg1;
- (void)setFetchCompletionHandler:(id /* block */)arg1;
- (void)setFlintHelper:(id)arg1;
- (void)setMaximumMissingArticles:(unsigned long long)arg1;
- (void)setProgressHandler:(id /* block */)arg1;
- (void)setResultHoldToken:(id)arg1;
@end
| 35.3 | 72 | 0.751275 |
d872c83213c8c1bc700061c4efa021bb590af446 | 97,680 | h | C | applications/ConstitutiveLawsApplication/constitutive_laws_application.h | qaumann/Kratos | fd1702687997322d7a94642fb58e3453f7d4b002 | [
"BSD-4-Clause"
] | null | null | null | applications/ConstitutiveLawsApplication/constitutive_laws_application.h | qaumann/Kratos | fd1702687997322d7a94642fb58e3453f7d4b002 | [
"BSD-4-Clause"
] | null | null | null | applications/ConstitutiveLawsApplication/constitutive_laws_application.h | qaumann/Kratos | fd1702687997322d7a94642fb58e3453f7d4b002 | [
"BSD-4-Clause"
] | null | null | null | // | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Alejandro Cornejo Velazquez
// Riccardo Rossi
//
#if !defined(KRATOS_CONSTITUTIVE_LAWS_APPLICATION_H_INCLUDED )
#define KRATOS_CONSTITUTIVE_LAWS_APPLICATION_H_INCLUDED
// System includes
// External includes
// Project includes
#include "includes/kratos_application.h"
// Constitutive laws
#include "custom_constitutive/wrinkling_linear_2d_law.h"
#include "custom_constitutive/truss_plasticity_constitutive_law.h"
#include "custom_constitutive/hyper_elastic_isotropic_ogden_1d.h"
#include "custom_constitutive/hyper_elastic_isotropic_henky_1d.h"
#include "custom_constitutive/elastic_isotropic_plane_stress_uncoupled_shear.h"
#include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_3d.h"
#include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_plane_stress_2d.h"
#include "custom_constitutive/hyper_elastic_isotropic_kirchhoff_plane_strain_2d.h"
#include "custom_constitutive/hyper_elastic_isotropic_neo_hookean_3d.h"
#include "custom_constitutive/hyper_elastic_isotropic_neo_hookean_plane_strain_2d.h"
#include "custom_constitutive/linear_elastic_orthotropic_2D_law.h"
#include "custom_constitutive/small_strain_j2_plasticity_plane_strain_2d.h"
#include "custom_constitutive/small_strain_j2_plasticity_3d.h"
#include "custom_constitutive/small_strain_isotropic_damage_3d.h"
#include "custom_constitutive/small_strain_isotropic_damage_plane_strain_2d.h"
#include "custom_constitutive/small_strain_isotropic_damage_traction_only_3d.h"
#include "custom_constitutive/plane_stress_d_plus_d_minus_damage_masonry_2d.h"
#include "custom_constitutive/d_plus_d_minus_damage_masonry_3d.h"
#include "custom_constitutive/small_strain_isotropic_plasticity_factory.h"
#include "custom_constitutive/small_strain_kinematic_plasticity_factory.h"
#include "custom_constitutive/generic_small_strain_isotropic_plasticity.h"
#include "custom_constitutive/generic_small_strain_kinematic_plasticity.h"
#include "custom_constitutive/finite_strain_isotropic_plasticity_factory.h"
#include "custom_constitutive/finite_strain_kinematic_plasticity_factory.h"
#include "custom_constitutive/generic_finite_strain_isotropic_plasticity.h"
#include "custom_constitutive/generic_finite_strain_kinematic_plasticity.h"
#include "custom_constitutive/generic_small_strain_isotropic_damage.h"
#include "custom_constitutive/small_strain_isotropic_damage_factory.h"
#include "custom_constitutive/viscous_generalized_kelvin.h"
#include "custom_constitutive/viscous_generalized_maxwell.h"
#include "custom_constitutive/generic_small_strain_viscoplasticity_3d.h"
#include "custom_constitutive/generic_small_strain_d_plus_d_minus_damage.h"
#include "custom_constitutive/plasticity_isotropic_kinematic_j2.h"
#include "custom_constitutive/generic_small_strain_plastic_damage_model.h"
#include "custom_constitutive/generic_small_strain_orthotropic_damage.h"
#include "custom_constitutive/serial_parallel_rule_of_mixtures_law.h"
#include "custom_constitutive/generic_anisotropic_3d_law.h"
#include "custom_constitutive/multi_linear_elastic_1d_law.h"
#include "custom_constitutive/multi_linear_isotropic_plane_stress_2d.h"
// Integrators
#include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_damage.h"
#include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_plasticity.h"
#include "custom_constitutive/constitutive_laws_integrators/generic_constitutive_law_integrator_kinematic_plasticity.h"
#include "custom_constitutive/constitutive_laws_integrators/generic_finite_strain_constitutive_law_integrator_plasticity.h"
#include "custom_constitutive/constitutive_laws_integrators/generic_finite_strain_constitutive_law_integrator_kinematic_plasticity.h"
#include "custom_constitutive/constitutive_laws_integrators/d+d-constitutive_law_integrators/generic_compression_constitutive_law_integrator.h"
#include "custom_constitutive/constitutive_laws_integrators/d+d-constitutive_law_integrators/generic_tension_constitutive_law_integrator.h"
#include "custom_constitutive/generic_small_strain_high_cycle_fatigue_law.h"
// Yield surfaces
#include "custom_constitutive/yield_surfaces/generic_yield_surface.h"
#include "custom_constitutive/yield_surfaces/von_mises_yield_surface.h"
#include "custom_constitutive/yield_surfaces/modified_mohr_coulomb_yield_surface.h"
#include "custom_constitutive/yield_surfaces/mohr_coulomb_yield_surface.h"
#include "custom_constitutive/yield_surfaces/rankine_yield_surface.h"
#include "custom_constitutive/yield_surfaces/simo_ju_yield_surface.h"
#include "custom_constitutive/yield_surfaces/drucker_prager_yield_surface.h"
#include "custom_constitutive/yield_surfaces/tresca_yield_surface.h"
// Plastic potentials
#include "custom_constitutive/plastic_potentials/generic_plastic_potential.h"
#include "custom_constitutive/plastic_potentials/von_mises_plastic_potential.h"
#include "custom_constitutive/plastic_potentials/tresca_plastic_potential.h"
#include "custom_constitutive/plastic_potentials/modified_mohr_coulomb_plastic_potential.h"
#include "custom_constitutive/plastic_potentials/mohr_coulomb_plastic_potential.h"
#include "custom_constitutive/plastic_potentials/drucker_prager_plastic_potential.h"
// Rules of mixtures
#include "custom_constitutive/rule_of_mixtures_law.h"
namespace Kratos {
///@name Kratos Globals
///@{
///@}
///@name Type Definitions
///@{
///@}
///@name Enum's
///@{
///@}
///@name Functions
///@{
///@}
///@name Kratos Classes
///@{
/// Short class definition.
/** Detail class definition.
*/
class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) KratosConstitutiveLawsApplication : public KratosApplication {
public:
///@name Type Definitions
///@{
/// Pointer definition of KratosConstitutiveLawsApplication
KRATOS_CLASS_POINTER_DEFINITION(KratosConstitutiveLawsApplication);
///@}
///@name Life Cycle
///@{
/// Default constructor.
KratosConstitutiveLawsApplication();
/// Destructor.
~KratosConstitutiveLawsApplication() override {}
///@}
///@name Operators
///@{
///@}
///@name Operations
///@{
void Register() override;
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
/// Turn back information as a string.
std::string Info() const override
{
return "KratosConstitutiveLawsApplication";
}
/// Print information about this object.
void PrintInfo(std::ostream& rOStream) const override
{
rOStream << Info();
PrintData(rOStream);
}
///// Print object's data.
void PrintData(std::ostream& rOStream) const override
{
KRATOS_WATCH("in my application");
KRATOS_WATCH(KratosComponents<VariableData>::GetComponents().size() );
rOStream << "Variables:" << std::endl;
KratosComponents<VariableData>().PrintData(rOStream);
rOStream << std::endl;
rOStream << "Elements:" << std::endl;
KratosComponents<Element>().PrintData(rOStream);
rOStream << std::endl;
rOStream << "Conditions:" << std::endl;
KratosComponents<Condition>().PrintData(rOStream);
}
///@}
///@name Friends
///@{
///@}
protected:
///@name Protected static Member Variables
///@{
///@}
///@name Protected member Variables
///@{
///@}
///@name Protected Operators
///@{
///@}
///@name Protected Operations
///@{
///@}
///@name Protected Access
///@{
///@}
///@name Protected Inquiry
///@{
///@}
///@name Protected LifeCycle
///@{
///@}
private:
///@name Static Member Variables
///@{
// static const ApplicationCondition msApplicationCondition;
///@}
///@name Member Variables
///@{
// Damage and plasticity laws
const ElasticIsotropicPlaneStressUncoupledShear mElasticIsotropicPlaneStressUncoupledShear;
const HyperElasticIsotropicKirchhoff3D mHyperElasticIsotropicKirchhoff3D;
const HyperElasticIsotropicKirchhoffPlaneStress2D mHyperElasticIsotropicKirchhoffPlaneStress2D;
const HyperElasticIsotropicKirchhoffPlaneStrain2D mHyperElasticIsotropicKirchhoffPlaneStrain2D;
const HyperElasticIsotropicNeoHookean3D mHyperElasticIsotropicNeoHookean3D;
const HyperElasticIsotropicNeoHookeanPlaneStrain2D mHyperElasticIsotropicNeoHookeanPlaneStrain2D;
const LinearElasticOrthotropic2DLaw mLinearElasticOrthotropic2DLaw;
const SmallStrainJ2Plasticity3D mSmallStrainJ2Plasticity3D;
const SmallStrainJ2PlasticityPlaneStrain2D mSmallStrainJ2PlasticityPlaneStrain2D;
const SmallStrainIsotropicDamage3D mSmallStrainIsotropicDamage3D;
const SmallStrainIsotropicDamagePlaneStrain2D mSmallStrainIsotropicDamagePlaneStrain2D;
const SmallStrainIsotropicDamageTractionOnly3D mSmallStrainIsotropicDamageTractionOnly3D;
const TrussPlasticityConstitutiveLaw mTrussPlasticityConstitutiveLaw;
const HyperElasticIsotropicOgden1D mHyperElasticIsotropicOgden1D;
const HyperElasticIsotropicHenky1D mHyperElasticIsotropicHenky1D;
const WrinklingLinear2DLaw mWrinklingLinear2DLaw;
const MultiLinearElastic1DLaw mMultiLinearElastic1DLaw;
const MultiLinearIsotropicPlaneStress2D mMultiLinearIsotropicPlaneStress2D;
// Damage and plasticity laws
const SerialParallelRuleOfMixturesLaw mSerialParallelRuleOfMixturesLaw;
const SmallStrainIsotropicPlasticityFactory mSmallStrainIsotropicPlasticityFactory;
const SmallStrainKinematicPlasticityFactory mSmallStrainKinematicPlasticityFactory;
const FiniteStrainIsotropicPlasticityFactory mFiniteStrainIsotropicPlasticityFactory;
const SmallStrainIsotropicDamageFactory mSmallStrainIsotropicDamageFactory;
const ViscousGeneralizedKelvin<ElasticIsotropic3D> mViscousGeneralizedKelvin3D;
const ViscousGeneralizedMaxwell<ElasticIsotropic3D> mViscousGeneralizedMaxwell3D;
const GenericSmallStrainViscoplasticity3D mGenericSmallStrainViscoplasticity3D;
const PlasticityIsotropicKinematicJ2 mPlasticityIsotropicKinematicJ2;
/// Plasticity
/* Small strain */
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DVonMisesVonMises;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DVonMisesDruckerPrager;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DVonMisesTresca;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DModifiedMohrCoulombVonMises;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DModifiedMohrCoulombTresca;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DTrescaVonMises;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DTrescaModifiedMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DTrescaDruckerPrager;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DTrescaTresca;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DDruckerPragerVonMises;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DDruckerPragerDruckerPrager;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DDruckerPragerTresca;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DVonMisesMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DMohrCoulombVonMises;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DMohrCoulombMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DMohrCoulombTresca;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DTrescaMohrCoulomb;
const GenericSmallStrainIsotropicPlasticity <GenericConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicPlasticity3DDruckerPragerMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DVonMisesVonMises;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DVonMisesDruckerPrager;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DVonMisesTresca;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DModifiedMohrCoulombVonMises;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DModifiedMohrCoulombTresca;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DTrescaVonMises;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DTrescaModifiedMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DTrescaDruckerPrager;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DTrescaTresca;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DDruckerPragerVonMises;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DDruckerPragerDruckerPrager;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DDruckerPragerTresca;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DVonMisesMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DMohrCoulombVonMises;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DMohrCoulombMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DMohrCoulombDruckerPrager;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DMohrCoulombTresca;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DTrescaMohrCoulomb;
const GenericSmallStrainKinematicPlasticity <GenericConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainKinematicPlasticity3DDruckerPragerMohrCoulomb;
// Plastic Damage Model
const GenericSmallStrainPlasticDamageModel <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainPlasticDamageModel3DVonMisesVonMisesVonMises;
const GenericSmallStrainPlasticDamageModel <GenericConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainPlasticDamageModel3DVonMisesVonMisesDruckerPrager;
/* Finite strain */
// Kirchhoff
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DVonMisesVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DVonMisesDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DVonMisesTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DModifiedMohrCoulombVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DModifiedMohrCoulombTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DTrescaVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DTrescaModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DTrescaDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DTrescaTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DDruckerPragerVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DDruckerPragerDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DDruckerPragerTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DVonMisesMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DMohrCoulombVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DMohrCoulombMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DMohrCoulombDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DMohrCoulombTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DTrescaMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicKirchhoffPlasticity3DDruckerPragerMohrCoulomb;
// Neo-Hookean
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DVonMisesVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DVonMisesDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DVonMisesTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DModifiedMohrCoulombVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DModifiedMohrCoulombTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DTrescaVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DTrescaModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DTrescaDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DTrescaTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DDruckerPragerVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DDruckerPragerDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DDruckerPragerTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DVonMisesMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DMohrCoulombVonMises;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DMohrCoulombMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DMohrCoulombDruckerPrager;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DMohrCoulombTresca;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DTrescaMohrCoulomb;
const GenericFiniteStrainIsotropicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticIsotropicNeoHookeanPlasticity3DDruckerPragerMohrCoulomb;
/* Finite strain */
// Kirchhoff
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DVonMisesVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DVonMisesDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DVonMisesTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DModifiedMohrCoulombVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DModifiedMohrCoulombTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DTrescaVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DTrescaModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DTrescaDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DTrescaTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DDruckerPragerVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DDruckerPragerDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DDruckerPragerTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DVonMisesMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DMohrCoulombVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DMohrCoulombMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DMohrCoulombDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DMohrCoulombTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DTrescaMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicKirchhoff3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticKirchhoffKinematicPlasticity3DDruckerPragerMohrCoulomb;
// Neo-Hookean
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DVonMisesVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DVonMisesModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DVonMisesDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DVonMisesTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DModifiedMohrCoulombVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DModifiedMohrCoulombDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DModifiedMohrCoulombTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DTrescaVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DTrescaModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DTrescaDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DTrescaTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DDruckerPragerVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DDruckerPragerModifiedMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DDruckerPragerDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DDruckerPragerTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DVonMisesMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DMohrCoulombVonMises;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DMohrCoulombMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DMohrCoulombDruckerPrager;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DMohrCoulombTresca;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DTrescaMohrCoulomb;
const GenericFiniteStrainKinematicPlasticity <HyperElasticIsotropicNeoHookean3D, GenericFiniteStrainConstitutiveLawIntegratorKinematicPlasticity<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mHyperElasticNeoHookeanKinematicPlasticity3DDruckerPragerMohrCoulomb;
/// Damage
/* Small strain 3D */
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DVonMisesVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DVonMisesModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DVonMisesDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DVonMisesTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DModifiedMohrCoulombVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DModifiedMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DModifiedMohrCoulombTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DTrescaVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DTrescaModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DTrescaDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DTrescaTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DDruckerPragerVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DDruckerPragerModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DDruckerPragerDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DDruckerPragerTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DRankineVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DRankineModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DRankineDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DRankineTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DSimoJuVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DSimoJuModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DSimoJuDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DSimoJuTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DVonMisesMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DMohrCoulombVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DMohrCoulombMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DMohrCoulombTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DTrescaMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DDruckerPragerMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DRankineMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<MohrCoulombPlasticPotential<6>>>> mSmallStrainIsotropicDamage3DSimoJuMohrCoulomb;
/* Small strain 2D */
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DVonMisesVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DVonMisesModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DVonMisesDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DVonMisesTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DModifiedMohrCoulombVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DModifiedMohrCoulombModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DModifiedMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DModifiedMohrCoulombTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DTrescaVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DTrescaModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DTrescaDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DTrescaTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DDruckerPragerVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DDruckerPragerModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DDruckerPragerDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DDruckerPragerTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DRankineVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DRankineModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DRankineDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DRankineTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DSimoJuVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<ModifiedMohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DSimoJuModifiedMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DSimoJuDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DSimoJuTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DVonMisesMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DMohrCoulombVonMises;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DMohrCoulombMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<DruckerPragerPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DMohrCoulombDruckerPrager;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<TrescaPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DMohrCoulombTresca;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DTrescaMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DDruckerPragerMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DRankineMohrCoulomb;
const GenericSmallStrainIsotropicDamage <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<MohrCoulombPlasticPotential<3>>>> mSmallStrainIsotropicDamage2DSimoJuMohrCoulomb;
// HCF (High Cycle Fatigue)
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawVonMisesVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawVonMisesModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawVonMisesDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawVonMisesTresca;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawModifiedMohrCoulombVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawModifiedMohrCoulombModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawModifiedMohrCoulombDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawModifiedMohrCoulombTresca;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawTrescaVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawTrescaModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawTrescaDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawTrescaTresca;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawDruckerPragerVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawDruckerPragerModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawDruckerPragerDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawDruckerPragerTresca;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawRankineVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawRankineModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawRankineDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawRankineTresca;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawSimoJuVonMises;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<ModifiedMohrCoulombPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawSimoJuModifiedMohrCoulomb;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<DruckerPragerPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawSimoJuDruckerPrager;
const GenericSmallStrainHighCycleFatigueLaw <GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<TrescaPlasticPotential<6>>>> mSmallStrainHighCycleFatigue3DLawSimoJuTresca;
// d+d- laws (3D)
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerModifiedMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombRankine3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombSimoJu3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombVonMises3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombTresca3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageMohrCoulombDruckerPrager3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageRankineMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageSimoJuMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageVonMisesMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageTrescaMohrCoulomb3D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainDplusDminusDamageDruckerPragerMohrCoulomb3D;
// d+d- laws (2D)
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageModifiedMohrCoulombDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerModifiedMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombRankine2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombSimoJu2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombVonMises2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombTresca2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageMohrCoulombDruckerPrager2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageRankineMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageSimoJuMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageVonMisesMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageTrescaMohrCoulomb2D;
const GenericSmallStrainDplusDminusDamage<GenericTensionConstitutiveLawIntegratorDplusDminusDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>, GenericCompressionConstitutiveLawIntegratorDplusDminusDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainDplusDminusDamageDruckerPragerMohrCoulomb2D;
const DamageDPlusDMinusMasonry2DLaw mDamageDPlusDMinusPlaneStressMasonry2DLaw;
const DamageDPlusDMinusMasonry3DLaw mDamageDPlusDMinusMasonry3DLaw;
// Orthotropic Damage
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageRankine3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageVonMises3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageDruckerPrager3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageTresca3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageMohrCoulomb3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageModifiedMohrCoulomb3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<VonMisesPlasticPotential<6>>>> mSmallStrainOrthotropicDamageSimoJu3D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<RankineYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageRankine2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<VonMisesYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageVonMises2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<DruckerPragerYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageDruckerPrager2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<TrescaYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageTresca2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<MohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageMohrCoulomb2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<ModifiedMohrCoulombYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageModifiedMohrCoulomb2D;
const GenericSmallStrainOrthotropicDamage<GenericConstitutiveLawIntegratorDamage<SimoJuYieldSurface<VonMisesPlasticPotential<3>>>> mSmallStrainOrthotropicDamageSimoJu2D;
// Rules of mixtures
const ParallelRuleOfMixturesLaw<3> mParallelRuleOfMixturesLaw3D;
const ParallelRuleOfMixturesLaw<2> mParallelRuleOfMixturesLaw2D;
// Anisotropic law
const GenericAnisotropic3DLaw mGenericAnisotropic3DLaw;
///@}
///@name Private Operators
///@{
///@}
///@name Private Operations
///@{
///@}
///@name Private Access
///@{
///@}
///@name Private Inquiry
///@{
///@}
///@name Un accessible methods
///@{
/// Assignment operator.
KratosConstitutiveLawsApplication& operator=(KratosConstitutiveLawsApplication const& rOther);
/// Copy constructor.
KratosConstitutiveLawsApplication(KratosConstitutiveLawsApplication const& rOther);
///@}
}; // Class KratosConstitutiveLawsApplication
///@}
///@name Type Definitions
///@{
///@}
///@name Input and output
///@{
///@}
} // namespace Kratos.
#endif // KRATOS_CONSTITUTIVE_LAWS_APPLICATION_H_INCLUDED defined
| 137.771509 | 360 | 0.905016 |
9ce339c7b8532585fa4cfb079adb7db282e15d59 | 4,439 | h | C | src/guacenc/buffer.h | dev-ddoe/guacamole-server | 8ecdedb05aed4aa9c282ce11d0d1fc8b247265cb | [
"Apache-2.0"
] | 1,450 | 2017-11-29T07:18:10.000Z | 2022-03-30T04:20:50.000Z | src/guacenc/buffer.h | dev-ddoe/guacamole-server | 8ecdedb05aed4aa9c282ce11d0d1fc8b247265cb | [
"Apache-2.0"
] | 122 | 2017-12-19T09:17:49.000Z | 2022-03-22T19:58:49.000Z | src/guacenc/buffer.h | dev-ddoe/guacamole-server | 8ecdedb05aed4aa9c282ce11d0d1fc8b247265cb | [
"Apache-2.0"
] | 431 | 2017-12-05T16:35:42.000Z | 2022-03-31T22:49:20.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 GUACENC_BUFFER_H
#define GUACENC_BUFFER_H
#include "config.h"
#include <cairo/cairo.h>
#include <stdbool.h>
/**
* The image and size storage for either a buffer (a Guacamole layer with a
* negative index) or a layer (a Guacamole layer with a non-negative index).
*/
typedef struct guacenc_buffer {
/**
* Whether this buffer should be automatically resized to fit any draw
* operation.
*/
bool autosize;
/**
* The width of this buffer or layer, in pixels.
*/
int width;
/**
* The height of this buffer or layer, in pixels.
*/
int height;
/**
* The number of bytes in each row of image data.
*/
int stride;
/**
* The underlying image data of this surface. If the width or height of
* this surface are 0, this will be NULL.
*/
unsigned char* image;
/**
* The Cairo surface wrapping the underlying image data of this surface. If
* the width or height of this surface are 0, this will be NULL.
*/
cairo_surface_t* surface;
/**
* The current graphics context of the Cairo surface. If the width or
* height of this surface are 0, this will be NULL.
*/
cairo_t* cairo;
} guacenc_buffer;
/**
* Allocates and initializes a new buffer object. This allocation is
* independent of the Guacamole video encoder display; the allocated
* guacenc_buffer will not automatically be associated with the active display.
*
* @return
* A newly-allocated and initialized guacenc_buffer, or NULL if allocation
* fails.
*/
guacenc_buffer* guacenc_buffer_alloc();
/**
* Frees all memory associated with the given buffer object. If the buffer
* provided is NULL, this function has no effect.
*
* @param buffer
* The buffer to free, which may be NULL.
*/
void guacenc_buffer_free(guacenc_buffer* buffer);
/**
* Resizes the given buffer to the given dimensions, allocating or freeing
* memory as necessary, and updating the buffer's width, height, and stride
* properties.
*
* @param buffer
* The buffer to resize.
*
* @param width
* The new width of the buffer, in pixels.
*
* @param height
* The new height of the buffer, in pixels.
*
* @return
* Zero if the resize operation is successful, non-zero on error.
*/
int guacenc_buffer_resize(guacenc_buffer* buffer, int width, int height);
/**
* Resizes the given buffer as necessary to contain at the given X/Y
* coordinate, allocating or freeing memory as necessary, and updating the
* buffer's width, height, and stride properties. If the buffer already
* contains the given coordinate, this function has no effect.
*
* @param buffer
* The buffer to resize.
*
* @param x
* The X coordinate to ensure is within the buffer.
*
* @param y
* The Y coordinate to ensure is within the buffer.
*
* @return
* Zero if the resize operation is successful or no resize was performed,
* non-zero if the resize operation failed.
*/
int guacenc_buffer_fit(guacenc_buffer* buffer, int x, int y);
/**
* Copies the entire contents of the given source buffer to the destination
* buffer, ignoring the current contents of the destination. The destination
* buffer's contents are entirely replaced.
*
* @param dst
* The destination buffer whose contents should be replaced.
*
* @param src
* The source buffer whose contents should replace those of the destination
* buffer.
*
* @return
* Zero if the copy operation was successful, non-zero on failure.
*/
int guacenc_buffer_copy(guacenc_buffer* dst, guacenc_buffer* src);
#endif
| 28.63871 | 79 | 0.699257 |
145e23dca9eefe3c3d4b321acd44fd225f57a968 | 1,607 | h | C | src/backend/gporca/libnaucrates/include/naucrates/dxl/operators/CDXLDatumOid.h | JunfengYang/gpdb | 7f1589a786e7fd9cac950ee104a729e370ec3606 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/backend/gporca/libnaucrates/include/naucrates/dxl/operators/CDXLDatumOid.h | JunfengYang/gpdb | 7f1589a786e7fd9cac950ee104a729e370ec3606 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/backend/gporca/libnaucrates/include/naucrates/dxl/operators/CDXLDatumOid.h | JunfengYang/gpdb | 7f1589a786e7fd9cac950ee104a729e370ec3606 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | //---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2012 EMC Corp.
//
// @filename:
// CDXLDatumOid.h
//
// @doc:
// Class for representing DXL oid datum
//
// @owner:
//
//
// @test:
//
//---------------------------------------------------------------------------
#ifndef GPDXL_CDXLDatumOid_H
#define GPDXL_CDXLDatumOid_H
#include "gpos/base.h"
#include "naucrates/dxl/operators/CDXLDatum.h"
namespace gpdxl
{
using namespace gpos;
// fwd decl
class CXMLSerializer;
//---------------------------------------------------------------------------
// @class:
// CDXLDatumOid
//
// @doc:
// Class for representing DXL oid datums
//
//---------------------------------------------------------------------------
class CDXLDatumOid : public CDXLDatum
{
private:
// oid value
OID m_oid_val;
public:
CDXLDatumOid(const CDXLDatumOid &) = delete;
// ctor
CDXLDatumOid(CMemoryPool *mp, IMDId *mdid_type, BOOL is_null, OID oid_val);
// dtor
~CDXLDatumOid() override = default;
// accessor of oid value
OID OidValue() const;
// serialize the datum as the given element
void Serialize(CXMLSerializer *xml_serializer) override;
// datum type
EdxldatumType
GetDatumType() const override
{
return CDXLDatum::EdxldatumOid;
}
// conversion function
static CDXLDatumOid *
Cast(CDXLDatum *dxl_datum)
{
GPOS_ASSERT(NULL != dxl_datum);
GPOS_ASSERT(CDXLDatum::EdxldatumOid == dxl_datum->GetDatumType());
return dynamic_cast<CDXLDatumOid *>(dxl_datum);
}
};
} // namespace gpdxl
#endif // !GPDXL_CDXLDatumOid_H
// EOF
| 19.361446 | 77 | 0.572495 |
0034b0561e4d2b8c3b71c4a2388488ab85a6f0bb | 5,345 | h | C | bdw.h | wingo/gcbench | 04a8edf1174cb21b091820c04a9f04bdaa7435ce | [
"Unlicense"
] | null | null | null | bdw.h | wingo/gcbench | 04a8edf1174cb21b091820c04a9f04bdaa7435ce | [
"Unlicense"
] | null | null | null | bdw.h | wingo/gcbench | 04a8edf1174cb21b091820c04a9f04bdaa7435ce | [
"Unlicense"
] | null | null | null | #include <stdint.h>
#include "conservative-roots.h"
// When pthreads are used, let `libgc' know about it and redirect
// allocation calls such as `GC_MALLOC ()' to (contention-free, faster)
// thread-local allocation.
#define GC_THREADS 1
#define GC_REDIRECT_TO_LOCAL 1
// Don't #define pthread routines to their GC_pthread counterparts.
// Instead we will be careful inside the benchmarks to use API to
// register threads with libgc.
#define GC_NO_THREAD_REDIRECTS 1
#include <gc/gc.h>
#include <gc/gc_inline.h> /* GC_generic_malloc_many */
#define GC_INLINE_GRANULE_WORDS 2
#define GC_INLINE_GRANULE_BYTES (sizeof(void *) * GC_INLINE_GRANULE_WORDS)
/* A freelist set contains GC_INLINE_FREELIST_COUNT pointers to singly
linked lists of objects of different sizes, the ith one containing
objects i + 1 granules in size. This setting of
GC_INLINE_FREELIST_COUNT will hold freelists for allocations of
up to 256 bytes. */
#define GC_INLINE_FREELIST_COUNT (256U / GC_INLINE_GRANULE_BYTES)
struct heap {
pthread_mutex_t lock;
int multithreaded;
};
struct mutator {
void *freelists[GC_INLINE_FREELIST_COUNT];
struct heap *heap;
};
static inline size_t gc_inline_bytes_to_freelist_index(size_t bytes) {
return (bytes - 1U) / GC_INLINE_GRANULE_BYTES;
}
static inline size_t gc_inline_freelist_object_size(size_t idx) {
return (idx + 1U) * GC_INLINE_GRANULE_BYTES;
}
// The values of these must match the internal POINTERLESS and NORMAL
// definitions in libgc, for which unfortunately there are no external
// definitions. Alack.
enum gc_inline_kind {
GC_INLINE_KIND_POINTERLESS,
GC_INLINE_KIND_NORMAL
};
static void* allocate_small_slow(void **freelist, size_t idx,
enum gc_inline_kind kind) NEVER_INLINE;
static void* allocate_small_slow(void **freelist, size_t idx,
enum gc_inline_kind kind) {
size_t bytes = gc_inline_freelist_object_size(idx);
GC_generic_malloc_many(bytes, kind, freelist);
void *head = *freelist;
if (UNLIKELY (!head)) {
fprintf(stderr, "ran out of space, heap size %zu\n",
GC_get_heap_size());
abort();
}
*freelist = *(void **)(head);
return head;
}
static inline void *
allocate_small(void **freelist, size_t idx, enum gc_inline_kind kind) {
void *head = *freelist;
if (UNLIKELY (!head))
return allocate_small_slow(freelist, idx, kind);
*freelist = *(void **)(head);
return head;
}
#define GC_HEADER /**/
static inline void* allocate(struct mutator *mut, enum alloc_kind kind,
size_t size) {
size_t idx = gc_inline_bytes_to_freelist_index(size);
if (UNLIKELY(idx >= GC_INLINE_FREELIST_COUNT))
return GC_malloc(size);
return allocate_small(&mut->freelists[idx], idx, GC_INLINE_KIND_NORMAL);
}
static inline void* allocate_pointerless(struct mutator *mut,
enum alloc_kind kind, size_t size) {
// Because the BDW API requires us to implement a custom marker so
// that the pointerless freelist gets traced, even though it's in a
// pointerless region, we punt on thread-local pointerless freelists.
return GC_malloc_atomic(size);
}
static inline void collect(struct mutator *mut) {
GC_gcollect();
}
static inline void init_field(void **addr, void *val) {
*addr = val;
}
static inline void set_field(void **addr, void *val) {
*addr = val;
}
static inline void* get_field(void **addr) {
return *addr;
}
static inline struct mutator *add_mutator(struct heap *heap) {
struct mutator *ret = GC_malloc(sizeof(struct mutator));
ret->heap = heap;
return ret;
}
static inline struct heap *mutator_heap(struct mutator *mutator) {
return mutator->heap;
}
static int initialize_gc(size_t heap_size, struct heap **heap,
struct mutator **mutator) {
// GC_full_freq = 30;
// GC_free_space_divisor = 16;
// GC_enable_incremental();
GC_INIT();
size_t current_heap_size = GC_get_heap_size();
if (heap_size > current_heap_size) {
GC_set_max_heap_size (heap_size);
GC_expand_hp(heap_size - current_heap_size);
}
GC_allow_register_threads();
*heap = GC_malloc(sizeof(struct heap));
pthread_mutex_init(&(*heap)->lock, NULL);
*mutator = add_mutator(*heap);
return 1;
}
static struct mutator* initialize_gc_for_thread(uintptr_t *stack_base,
struct heap *heap) {
pthread_mutex_lock(&heap->lock);
if (!heap->multithreaded) {
GC_allow_register_threads();
heap->multithreaded = 1;
}
pthread_mutex_unlock(&heap->lock);
struct GC_stack_base base = { stack_base };
GC_register_my_thread(&base);
return add_mutator(heap);
}
static void finish_gc_for_thread(struct mutator *mut) {
GC_unregister_my_thread();
}
static void* call_without_gc(struct mutator *mut, void* (*f)(void*),
void *data) NEVER_INLINE;
static void* call_without_gc(struct mutator *mut,
void* (*f)(void*),
void *data) {
return GC_do_blocking(f, data);
}
static inline void print_start_gc_stats(struct heap *heap) {
}
static inline void print_end_gc_stats(struct heap *heap) {
printf("Completed %ld collections\n", (long)GC_get_gc_no());
printf("Heap size is %ld\n", (long)GC_get_heap_size());
}
| 30.542857 | 77 | 0.699719 |
76adf6d39801f8a176d2c4714e9f74f21639520b | 522 | h | C | Source/Headers/Project/Doubles/CDRSpyInfo.h | sgravrock/cedar | 176a091e663ccbe4b7a3139e188b55b0a2d329d0 | [
"MIT"
] | 357 | 2015-01-02T01:16:19.000Z | 2017-10-26T13:30:36.000Z | Source/Headers/Project/Doubles/CDRSpyInfo.h | sgravrock/cedar | 176a091e663ccbe4b7a3139e188b55b0a2d329d0 | [
"MIT"
] | 93 | 2015-01-16T15:11:04.000Z | 2017-02-22T22:29:02.000Z | Source/Headers/Project/Doubles/CDRSpyInfo.h | sgravrock/cedar | 176a091e663ccbe4b7a3139e188b55b0a2d329d0 | [
"MIT"
] | 54 | 2015-01-17T16:54:34.000Z | 2017-09-30T16:21:32.000Z | #import <Foundation/Foundation.h>
@class CedarDoubleImpl;
@interface CDRSpyInfo : NSObject
@property (nonatomic, assign) Class publicClass;
@property (nonatomic, assign) Class spiedClass;
@property (nonatomic, retain) CedarDoubleImpl *cedarDouble;
+ (void)storeSpyInfoForObject:(id)object;
+ (BOOL)clearSpyInfoForObject:(id)object;
+ (CDRSpyInfo *)spyInfoForObject:(id)object;
+ (CedarDoubleImpl *)cedarDoubleForObject:(id)object;
+ (Class)publicClassForObject:(id)object;
- (IMP)impForSelector:(SEL)selector;
@end
| 24.857143 | 59 | 0.779693 |
bbc15f1996ad834dbb29ff8c831f593149abbc2c | 13,834 | c | C | ObitSystem/ObitSD/src/ObitOTFCalFlag.c | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | 5 | 2019-08-26T06:53:08.000Z | 2020-10-20T01:08:59.000Z | ObitSystem/ObitSD/src/ObitOTFCalFlag.c | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | null | null | null | ObitSystem/ObitSD/src/ObitOTFCalFlag.c | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | 8 | 2017-08-29T15:12:32.000Z | 2022-03-31T12:16:08.000Z | /* $Id$ */
/*--------------------------------------------------------------------*/
/*; Copyright (C) 2003-2008 */
/*; Associated Universities, Inc. Washington DC, USA. */
/*; */
/*; This program is free software; you can redistribute it and/or */
/*; modify it under the terms of the GNU General Public License as */
/*; published by the Free Software Foundation; either version 2 of */
/*; the License, or (at your option) any later version. */
/*; */
/*; This program is distributed in the hope that it will be useful, */
/*; but WITHOUT ANY WARRANTY; without even the implied warranty of */
/*; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/*; GNU General Public License for more details. */
/*; */
/*; You should have received a copy of the GNU General Public */
/*; License along with this program; if not, write to the Free */
/*; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, */
/*; MA 02139, USA. */
/*; */
/*;Correspondence about this software should be addressed as follows: */
/*; Internet email: bcotton@nrao.edu. */
/*; Postal address: William Cotton */
/*; National Radio Astronomy Observatory */
/*; 520 Edgemont Road */
/*; Charlottesville, VA 22903-2475 USA */
/*--------------------------------------------------------------------*/
#include "ObitOTFCalFlagDef.h"
#include "ObitOTFCalFlag.h"
#include "ObitOTFDesc.h"
#include "ObitOTFSel.h"
#include "ObitTableOTFFlag.h"
#include "ObitTableUtil.h"
/*----------------Obit: Merx mollis mortibus nuper ------------------*/
/**
* \file ObitOTFCalFlag.c
* ObitOTFCal utilities for applying flagging to uv data
*/
/*-------------------Private function prototypes-------------------*/
/** Private: Create structure for flagging. */
static ObitOTFCalFlagS* newObitOTFCalFlagS (ObitOTFCal *in);
/** Private: Update flagging arrays. */
static void ObitOTFCalFlagUpdate (ObitOTFCalFlagS *in, ObitOTFSel *sel, ofloat time,
ObitErr *err);
/*----------------------Public functions---------------------------*/
/**
* Initialize structures for Flagging.
* \param in Flag Object.
* \param sel Data selector.
* \param desc Data descriptor.
* \param err ObitError stack.
*/
void ObitOTFCalFlagInit (ObitOTFCal *in, ObitOTFSel *sel, ObitOTFDesc *desc,
ObitErr *err)
{
ObitIOCode retCode;
ObitOTFCalFlagS *me;
ObitTableOTFFlag *FGTab;
gchar *routine="ObitOTFCalFlagInit";
/* error checks */
g_assert(ObitErrIsA(err));
if (err->error) return;
g_assert (ObitOTFCalIsA(in));
in->doFlag = sel->doFlag;
if (!in->doFlag) return;
in->flag = newObitOTFCalFlagS(in);
/* pointer to flagging structure */
me = in->flag;
/* Copy Selector information */
/* Copy Cal information */
me->FlagTable = ObitTableRef(in->FlagTable);
me->LastRowRead = 0;
me->numChan = desc->inaxes[desc->jlocf];
me->numStok = desc->inaxes[desc->jlocs];
/* First stokes parameter in data */
if (desc->crval[desc->jlocs] > 0)
me->stoke0 = desc->crval[desc->jlocs] +
(1.0-desc->crpix[desc->jlocs]) * desc->cdelt[desc->jlocs] + 0.5;
else
me->stoke0 = desc->crval[desc->jlocs] +
(1.0-desc->crpix[desc->jlocs]) * desc->cdelt[desc->jlocs] - 0.5;
/* Copy descriptor information */
me->numFeed = desc->inaxes[desc->jlocfeed];
me->numChan = desc->inaxes[desc->jlocf];
/* Make sure sorted in time order */
FGTab = (ObitTableOTFFlag*)me->FlagTable;
if (FGTab->myDesc->sort[0]!=(FGTab->TimeRangeOff+1)) {
retCode = ObitTableUtilSort ((ObitTable*)FGTab, "TIME RANGE ", FALSE, err);
if (err->error) Obit_traceback_msg (err, routine, FGTab->name);
}
/* Open Flagging table */
retCode =
ObitTableOTFFlagOpen (FGTab, OBIT_IO_ReadWrite, err);
if ((retCode!=OBIT_IO_OK) || (err->error)) /* add traceback,return */
Obit_traceback_msg (err, routine, in->name);
/* create row structure */
me->FlagTableRow = (Obit*)newObitTableOTFFlagRow(FGTab);
/* table information */
me->numRow = FGTab->myDesc->nrow;
/* Allocate flagging arrays */
me->maxFlag = 5000;
me->numFlag = 0;
me->flagTarget = g_malloc0(me->maxFlag*sizeof(olong));
me->flagFeed = g_malloc0(me->maxFlag*sizeof(olong));
me->flagBChan = g_malloc0(me->maxFlag*sizeof(olong));
me->flagEChan = g_malloc0(me->maxFlag*sizeof(olong));
me->flagPol = g_malloc0(4*me->maxFlag*sizeof(gboolean));
me->flagEndTime = g_malloc0(me->maxFlag*sizeof(ofloat));
/* Initial time to trigger update of calibration arrays */
me->flagTime = -1.0e20;
} /* end ObitOTFCalFlagInit */
/**
* Flag a record
* Adapted from AIPS DATFLG.FOR
* \param in Flag Object.
* \param time Time of datum
* \param recIn 1 record as an array of floats,
* \param err ObitError stack.
*/
void ObitOTFCalFlag (ObitOTFCal *in, float time, ofloat *recIn, ObitErr *err)
{
olong iflag, ifeed, istoke, ichan, TargetID;
olong limc1, limc2, soff, foff, coff, incdatawt;
ObitOTFCalFlagS *me;
ObitOTFDesc *desc;
ObitOTFSel *sel;
ofloat *data, fblank = ObitMagicF();
gboolean doDataWt;
gchar *routine="ObitOTFCalFlag";
/* error checks */
g_assert(ObitErrIsA(err));
if (err->error) return;
g_assert (ObitOTFCalIsA(in));
/* local pointers for structures */
me = in->flag;
desc = in->myDesc;
sel = in->mySel;
incdatawt = desc->incdatawt; /* increment in data-wt axis */
doDataWt = incdatawt>1; /* Have Data-Wt axis? */
/* see if new time - update cal. */
if (time > me->flagTime) {
ObitOTFCalFlagUpdate (me, sel, time, err);
if (err->error) Obit_traceback_msg (err, routine, in->name);
}
/* If no currently active flags, nothing to do */
if (me->numFlag <= 0) return;
/* Target ID */
if (desc->iloctar >= 0) TargetID = recIn[desc->iloctar] + 0.1;
else TargetID = 0;
/* loop thru flagging criteria */
for (iflag= 0; iflag<me->numFlag; iflag++) {
/* check source */
if ((me->flagTarget[iflag] != TargetID) && (me->flagTarget[iflag] > 0) &&
(TargetID != 0)) continue;
/* some data to be flagged - set limits */
limc1 = me->flagBChan[iflag];
limc2 = me->flagEChan[iflag];
data = &recIn[desc->ilocdata]; /* Data array pointer */
/* loop over data */
for (istoke=0; istoke<me->numStok; istoke++) {
if (me->flagPol[iflag*4+istoke]) { /* flag this one? */
soff = istoke * desc->incs; /* offset in data */
/* Loop over feeds */
for (ifeed=1; ifeed<=me->numFeed; ifeed++) { /* flag this one */
if ((ifeed==me->flagFeed[iflag]) || (me->flagFeed[iflag]<=0)) {
foff = soff + (ifeed-1) * desc->incfeed;
/* Channel loop */
for (ichan=limc1; ichan<=limc2; ichan++) {
coff = foff + (ichan-1) * desc->incf;
data[coff] = fblank;
if (doDataWt) data[coff+1] = 0.0;
} /* end channel loop */
} /* end if feed selected for flagging */
} /* end Feed loop */
} /* end if Stokes selected for flagging */
} /* end Stokes loop */
} /* end loop over flagging entries */;
} /* end ObitOTFCalFlag */
/**
* Shutdown baseline dependent Calibrate.
* Close any open file and destroy structures.
* \param in Flag Object.
* \param err ObitError stack.
*/
void ObitOTFCalFlagShutdown (ObitOTFCal *in, ObitErr *err)
{
ObitOTFCalFlagS *me;
ObitIOCode retCode;
gchar *routine="ObitOTFCalFlagShutdown";
/* error checks */
g_assert(ObitErrIsA(err));
if (err->error) return;
g_assert (ObitOTFCalIsA(in));
/* Close calibration table */
me = in->flag;
retCode = ObitTableOTFFlagClose ((ObitTableOTFFlag*)me->FlagTable, err);
if (err->error) Obit_traceback_msg (err, routine, in->name);
/* Release row structure */
me->FlagTableRow = ObitTableOTFFlagRowUnref(me->FlagTableRow);
/* delete structure */
in->flag = ObitOTFCalFlagSUnref(in->flag);
} /* end ObitOTFCalFlagShutdown */
/**
* Destroy structure for Flagging .
* \param in Flag Object.
* \return NULL
*/
ObitOTFCalFlagS*
ObitOTFCalFlagSUnref (ObitOTFCalFlagS *in)
{
if (in==NULL) return in;
in->FlagTable = ObitTableOTFFlagUnref((ObitTableOTFFlag*)in->FlagTable);
in->FlagTableRow = ObitTableOTFFlagRowUnref((ObitTableOTFFlagRow*)in->FlagTableRow);
if (in->flagTarget) g_free(in->flagTarget); in->flagTarget = NULL;
if (in->flagFeed) g_free(in->flagFeed); in->flagFeed = NULL;
if (in->flagBChan) g_free(in->flagBChan); in->flagBChan = NULL;
if (in->flagEChan) g_free(in->flagEChan); in->flagEChan = NULL;
if (in->flagPol) g_free(in->flagPol); in->flagPol = NULL;
if (in->flagEndTime) g_free(in->flagEndTime); in->flagEndTime = NULL;
/* basic structure */
g_free (in);
return NULL;
} /* end ObitOTFCalFlagSUnref */
/*---------------Private functions---------------------------*/
/**
* Create structure for baseline dependent Calibrate .
* \param in Flag Object.
* \return newly created object.
*/
static ObitOTFCalFlagS*
newObitOTFCalFlagS (ObitOTFCal *in)
{
ObitOTFCalFlagS* out;
out = g_malloc0(sizeof(ObitOTFCalFlagS));
/* Null pointers */
out->FlagTable = NULL;
out->FlagTableRow = NULL;
out->flagTarget = NULL;
out->flagFeed = NULL;
out->flagPol = NULL;
out->flagEndTime = NULL;
return out;
} /* end newObitOTFCalFlagS */
/**
* Update ObitOTFCalFlag calibration tables for time time.
* Adapted from AIPS NXTFLG.FOR
* \param in Flag Object.
* \param sel OTF selector object
* \param time desired time in days
* \param err Error stack for messages and errors.
*/
static void ObitOTFCalFlagUpdate (ObitOTFCalFlagS *in, ObitOTFSel *sel, ofloat time,
ObitErr *err)
{
olong ndrop, limit, it;
olong irow, i, limit4;
gboolean done;
ObitIOCode retCode;
ObitTableOTFFlag *FlagTable = NULL;
ObitTableOTFFlagRow *FlagTableRow = NULL;
gchar *routine="ObitOTFCalFlagUpdate";
/* error checks */
g_assert(ObitErrIsA(err));
if (err->error) return;
g_assert(in!=NULL);
g_assert(ObitOTFSelIsA(sel));
/* New time for flags */
in->flagTime = time;
/* check if any flags expired. */
done = (in->numFlag <= 0);
while (!done) {
/* find highest number expired flag */
ndrop = -1;
for (i= 0; i<in->numFlag; i++) { /* */
if (in->flagEndTime[i] < time) ndrop = i;
} /* end loop */;
/* see if any to be dropped. */
done = (ndrop < 0);
if (done) break;
/* compress, dropping flag. */
if ((ndrop+1) < in->numFlag) { /* This is not the last one the list */
limit = ndrop;
for (i= limit; i<in->numFlag-1; i++) {
in->flagEndTime[i] = in->flagEndTime[i+1];
in->flagTarget[i] = in->flagTarget[i+1];
in->flagFeed[i] = in->flagFeed[i+1];
in->flagBChan[i] = in->flagBChan[i+1];
in->flagEChan[i] = in->flagEChan[i+1];
in->flagPol[i*4] = in->flagPol[4*(i+1)];
in->flagPol[i*4+1] = in->flagPol[4*(i+1)+1];
in->flagPol[i*4+2] = in->flagPol[4*(i+1)+2];
in->flagPol[i*4+3] = in->flagPol[4*(i+1)+3];
} /* end loop */;
}
in->numFlag--;
} /* end loop deleting expired entries */
/* check if list exhausted */
if (in->LastRowRead > in->numRow) return;
/* Flag table - set local pointers */
FlagTable = (ObitTableOTFFlag*)in->FlagTable;
FlagTableRow = (ObitTableOTFFlagRow*)in->FlagTableRow;
/* Find next valid flag. Loop through records */
limit4 = MAX (1, in->LastRowRead+1);
for (i= limit4; i<=in->numRow; i++) {
irow = i;
retCode = ObitTableOTFFlagReadRow (FlagTable, irow, FlagTableRow, err);
if (err->error) Obit_traceback_msg (err, routine, "Flag Table");
if (FlagTableRow->status < 0) continue; /* entry flagged? */
if (time < FlagTableRow->TimeRange[0]) return;
if (time > FlagTableRow->TimeRange[1]) continue;
/* Check that starting channel is in range */
if ((FlagTableRow->chans[0] > 0) && (FlagTableRow->chans[0] > in->numChan)) continue;
/* Is this source wanted */
if (!ObitOTFSelWantTarget(sel, (olong)FlagTableRow->TargetID)) continue;
/* Must want this one - save it */
in->LastRowRead = i;
in->numFlag = in->numFlag + 1;
/* check if too big */
if (in->numFlag > in->maxFlag) {
Obit_log_error(err, OBIT_Error,
"ERROR: Exceeded limit of %d simultaneous flags for %s",
in->maxFlag, sel->name);
return;
}
/* fill in tables */
it = in->numFlag - 1;
in->flagEndTime[it] = FlagTableRow->TimeRange[1];
in->flagTarget[it] = FlagTableRow->TargetID;
in->flagFeed[it] = FlagTableRow->Feed;
in->flagBChan[it] = FlagTableRow->chans[0];
in->flagEChan[it] = MIN (in->numChan, FlagTableRow->chans[1]);
if (in->flagBChan[it] <= 0) in->flagBChan[it] = 1;
if (in->flagEChan[it] <= 0) in->flagEChan[it] = in->numChan;
/* Ensure that channel selection is in range */
in->flagEChan[it] = MIN (in->flagEChan[it], in->numChan);
/* Stokes flags are packed into a bit array */
in->flagPol[it*4] = FlagTableRow->pFlags[0] & 0x1;
in->flagPol[it*4+1] = FlagTableRow->pFlags[0] & 0x2;
in->flagPol[it*4+2] = FlagTableRow->pFlags[0] & 0x4;
in->flagPol[it*4+3] = FlagTableRow->pFlags[0] & 0x8;
} /* end loop over file */
} /* end ObitOTFCalFlagUpdate */
| 33.823961 | 89 | 0.599031 |
8d2ad9e8f7f383cda5f27b949f7474f1c4f19861 | 540 | h | C | src/framework/Navi/Navi/Components/Hori/NVHoriPanel.h | design-to-release/sketch-navi | a29006b37fa6b3a313041b0adc7ccb35e0cd71a8 | [
"MIT"
] | 1 | 2020-06-18T08:58:45.000Z | 2020-06-18T08:58:45.000Z | src/framework/Navi/Navi/Components/Hori/NVHoriPanel.h | design-to-release/sketch-navi | a29006b37fa6b3a313041b0adc7ccb35e0cd71a8 | [
"MIT"
] | 3 | 2020-11-04T09:24:49.000Z | 2021-08-31T19:48:22.000Z | src/framework/Navi/Navi/Components/Hori/NVHoriPanel.h | design-to-release/sketch-navi | a29006b37fa6b3a313041b0adc7ccb35e0cd71a8 | [
"MIT"
] | 2 | 2020-08-17T14:38:24.000Z | 2020-11-24T11:33:11.000Z | //
// NVHoriPanel.h
// Navi
//
// Created by QIANSC on 2020/11/9.
// Copyright © 2020 Qian,Sicheng. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "NVPanelHeaderView.h"
#import "NVPanel.h"
#import "NVHoriCollectionView.h"
#import "MSLayerArray.h"
NS_ASSUME_NONNULL_BEGIN
@interface NVHoriPanel : NVPanel
@property (nonatomic,strong) IBOutlet NVHoriCollectionView *collectionView;
@property (nonatomic,strong) MSLayerArray *selections;
@property (strong) IBOutlet NSSegmentedControl *modButton;
@end
NS_ASSUME_NONNULL_END
| 20.769231 | 75 | 0.768519 |
8b2a512cc52f5da4320b6e7d2b91029f0744d5a9 | 3,616 | h | C | foundation/pnacl.h | uael/libadt | 0607c5ce31609a1513e0b59d256637f5db0c419b | [
"Unlicense"
] | null | null | null | foundation/pnacl.h | uael/libadt | 0607c5ce31609a1513e0b59d256637f5db0c419b | [
"Unlicense"
] | null | null | null | foundation/pnacl.h | uael/libadt | 0607c5ce31609a1513e0b59d256637f5db0c419b | [
"Unlicense"
] | null | null | null | /* pnacl.h - Foundation library - Public Domain - 2013 Mattias Jansson / Rampant Pixels
*
* This library provides a cross-platform foundation library in C11 providing basic support
* data types and functions to write applications and games in a platform-independent fashion.
* The latest source code is always available at
*
* https://github.com/rampantpixels/foundation_lib
*
* This library is put in the public domain; you can redistribute it and/or modify it without
* any restrictions.
*/
#pragma once
/*! \file pnacl.h
\brief Safe inclusion of PNaCl headers
Safe inclusion of PNaCl headers, and PNaCl specific entry points. */
#include <foundation/platform.h>
#include <foundation/types.h>
#if FOUNDATION_PLATFORM_PNACL
#if FOUNDATION_COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
#endif
#define __error_t_defined 1
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sched.h>
#include <pwd.h>
#include <time.h>
#include <pthread.h>
#include <string.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <ppapi/c/ppp.h>
#include <ppapi/c/pp_instance.h>
#include <ppapi/c/pp_resource.h>
#include <ppapi/c/pp_errors.h>
/*! PNaCl array wrapper, keeping track of current element count and a pointer
to the array memory */
typedef struct pnacl_array_t {
/*! Array memory */
void* data;
/*! Current element count */
unsigned int count;
} pnacl_array_t;
/*! Initialize PNaCl module instance
\param module_id Module ID
\param get_browser Interface to browser
\return PP_OK if successful, error code if not */
FOUNDATION_API int
pnacl_module_initialize(PP_Module module_id, PPB_GetInterface get_browser);
/*! Get module interface for given interface name
\param interface Interface name string
\param length Length of interface name string
\return Interface, null if not found or error occurred */
FOUNDATION_API const void*
pnacl_module_interface(const char* interface, size_t length);
/*! Finalize PNaCl module instance */
FOUNDATION_API void
pnacl_module_finalize(void);
/*! Get error description string for error code
\param err Error code
\return Error description string */
FOUNDATION_API string_const_t
pnacl_error_message(int err);
/*! Get current PNaCl instance
\return Instance */
FOUNDATION_API PP_Instance
pnacl_instance(void);
/*! Get instance interface for given interface name
\param interface Interface name string
\param length Length of interface name string
\return Interface, null if not found or error occurred */
FOUNDATION_API const void*
pnacl_interface(const char* interface, size_t length);
/*! Array output wrapper, handling allocation of array storage
\param arr Array object pointer
\param count Number of elements
\param size Size of an element
\return Array data pointer */
FOUNDATION_API void*
pnacl_array_output(void* arr, uint32_t count, uint32_t size);
/*! Post log message to JavaScript as a JSON object with "type" set to "log".
Other attributes are "context" holding the log context, "severity" holding the
error level severity and "msg" holding the log message.
\param context Log context
\param severity Error level severity
\param msg Log message
\param msglen Length of log message */
FOUNDATION_API void
pnacl_post_log(hash_t context, error_level_t severity, const char* msg, size_t msglen);
/*! Main entry point for PNaCl instance
\param instance Instance
\return Exit code */
FOUNDATION_API int
pnacl_main(PP_Instance instance);
#if FOUNDATION_COMPILER_CLANG
# pragma clang diagnostic pop
#endif
#endif
| 28.928 | 94 | 0.774889 |
a05ea7d6d2ee985460596d0c34ef8000c4d17429 | 2,851 | c | C | src/asn/ngap/ASN_NGAP_CellIDCancelledNR-Item.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 16 | 2020-04-16T02:07:37.000Z | 2020-07-23T10:48:27.000Z | src/asn/ngap/ASN_NGAP_CellIDCancelledNR-Item.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 8 | 2020-07-13T17:11:35.000Z | 2020-08-03T16:46:31.000Z | src/asn/ngap/ASN_NGAP_CellIDCancelledNR-Item.c | aligungr/ue-ran-sim | 564f9d228723f03adfa2b02df2ea019bdf305085 | [
"MIT"
] | 9 | 2020-03-04T15:05:08.000Z | 2020-07-30T06:18:18.000Z | /*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "NGAP-IEs"
* found in "asn/ngap-15.8.0.asn1"
* `asn1c -fcompound-names -pdu=all -findirect-choice -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ngap`
*/
#include "ASN_NGAP_CellIDCancelledNR-Item.h"
#include "ASN_NGAP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_ASN_NGAP_CellIDCancelledNR_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ASN_NGAP_CellIDCancelledNR_Item, nR_CGI),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_ASN_NGAP_NR_CGI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"nR-CGI"
},
{ ATF_NOFLAGS, 0, offsetof(struct ASN_NGAP_CellIDCancelledNR_Item, numberOfBroadcasts),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_ASN_NGAP_NumberOfBroadcasts,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"numberOfBroadcasts"
},
{ ATF_POINTER, 1, offsetof(struct ASN_NGAP_CellIDCancelledNR_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_ASN_NGAP_ProtocolExtensionContainer_6861P23,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_ASN_NGAP_CellIDCancelledNR_Item_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_ASN_NGAP_CellIDCancelledNR_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nR-CGI */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* numberOfBroadcasts */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_ASN_NGAP_CellIDCancelledNR_Item_specs_1 = {
sizeof(struct ASN_NGAP_CellIDCancelledNR_Item),
offsetof(struct ASN_NGAP_CellIDCancelledNR_Item, _asn_ctx),
asn_MAP_ASN_NGAP_CellIDCancelledNR_Item_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_ASN_NGAP_CellIDCancelledNR_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_ASN_NGAP_CellIDCancelledNR_Item = {
"CellIDCancelledNR-Item",
"CellIDCancelledNR-Item",
&asn_OP_SEQUENCE,
asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1,
sizeof(asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1)
/sizeof(asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1[0]), /* 1 */
asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1, /* Same as above */
sizeof(asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1)
/sizeof(asn_DEF_ASN_NGAP_CellIDCancelledNR_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_ASN_NGAP_CellIDCancelledNR_Item_1,
3, /* Elements count */
&asn_SPC_ASN_NGAP_CellIDCancelledNR_Item_specs_1 /* Additional specs */
};
| 38.527027 | 118 | 0.742546 |
ae203e29859358c07f191e4983b9704406f8e2a4 | 1,660 | c | C | xvbell.c | yoshinari-nomura/xvbell | 36e2ce940d212e62273173fbdf659589479f7f7a | [
"MIT"
] | null | null | null | xvbell.c | yoshinari-nomura/xvbell | 36e2ce940d212e62273173fbdf659589479f7f7a | [
"MIT"
] | null | null | null | xvbell.c | yoshinari-nomura/xvbell | 36e2ce940d212e62273173fbdf659589479f7f7a | [
"MIT"
] | null | null | null | /// xvbell --- Flash X screen from command line.
///
/// Copyright (C) 2020 Yoshinari Nomura <nom@quickhack.net>
/// All rights reserved.
///
/// Created: 2020-04-11
/// Version: 1.0
/// License: MIT
///
/// * Compile
/// gcc -Wall -Wextra -Werror -o xvbell xvbell.c -lX11
///
/// * Usage
/// xvbell [color_name]
///
/// * Example
/// xvbell green
///
#include <X11/Xlib.h>
#include <stdlib.h>
#include <unistd.h>
unsigned long name_to_pixel(Display *display, char *color_name)
{
int scr = XDefaultScreen(display);
Colormap cmap = XDefaultColormap(display, scr);
XColor c1, c2;
if (XAllocNamedColor(display, cmap, color_name, &c1, &c2)) {
return c1.pixel;
}
return WhitePixel(display, scr);
}
int main(int argc, char *argv[])
{
Display *dpy = XOpenDisplay(NULL);
if (!dpy)
exit(-1);
int scr = XDefaultScreen(dpy);
char *color_name = "white";
if (argc > 1) color_name = argv[1];
XSetWindowAttributes attr;
attr.background_pixel = name_to_pixel(dpy, color_name);
attr.override_redirect = True;
attr.save_under = True;
Window win = XCreateWindow(
dpy,
XRootWindow(dpy, scr), // parent
0, 0, // x, y
DisplayWidth(dpy, scr),
DisplayHeight(dpy, scr),
0, // border_width
XDefaultDepth(dpy, scr),
InputOutput, // class
XDefaultVisual(dpy, scr),
CWBackPixel | CWOverrideRedirect | CWSaveUnder,
&attr);
XMapRaised(dpy, win);
XFlush(dpy);
usleep(100000); // 0.1 sec = 100,000
XUnmapWindow(dpy, win);
exit(0);
}
| 23.380282 | 64 | 0.58494 |
c43209dab8a160dc8fe79f310eca0a8aceea5135 | 1,123 | h | C | src/auxiliary.h | mwthinker/Zombie | ae50fbc121fc9f33ae97861c33d142bdd218215c | [
"MIT"
] | 4 | 2016-09-12T15:23:42.000Z | 2021-05-01T13:15:51.000Z | src/auxiliary.h | mwthinker/Zombie | ae50fbc121fc9f33ae97861c33d142bdd218215c | [
"MIT"
] | 2 | 2015-08-26T06:36:39.000Z | 2015-08-26T06:37:00.000Z | src/auxiliary.h | mwthinker/Zombie | ae50fbc121fc9f33ae97861c33d142bdd218215c | [
"MIT"
] | 1 | 2019-01-05T19:58:02.000Z | 2019-01-05T19:58:02.000Z | #ifndef ZOMBIE_AUXILIARY_H
#define ZOMBIE_AUXILIARY_H
#include "box2ddef.h"
#include <cmath>
namespace zombie {
template <typename T>
T calculateDifferenceBetweenAngles(T firstAngle, T secondAngle) {
static_assert(std::is_signed<T>());
T difference = firstAngle - secondAngle;
while (difference < -Pi) difference += 2 * Pi;
while (difference > Pi) difference -= 2 * Pi;
return difference;
}
inline float calculateAnglePointToPoint(const b2Vec2& p1, const b2Vec2& p2) {
return std::atan2(p2.y - p1.y, p2.x - p1.x);
}
template <typename T>
T calculateAnglePointToPoint(T x, T y, T pX, T pY) {
return std::atan2(pY-y, pX-x);
}
template <typename T>
constexpr T sign(const T& value) {
static_assert(std::is_signed<T>());
return value < 0 ? -1 : 1;
}
inline Position directionVector(float angle) {
return {std::cos(angle), std::sin(angle)};
}
// Returns a random number. Uniformly distributed on the interval [0, 1).
float random();
// Returns a random number. Uniformly distributed on the interval [a, b).
float random(float a, float b);
int randomInt(int a, int b);
}
#endif
| 22.918367 | 78 | 0.693678 |
8b5f30979982c5e430520ed59ccbf86da0cb6a03 | 1,618 | h | C | contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSPanGestureRecognizer.h | Phikzel2/haroldcoin-main-MacOS | 15c949c8f722d424fd9603fab3c49ec4b2b720eb | [
"MIT"
] | null | null | null | contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSPanGestureRecognizer.h | Phikzel2/haroldcoin-main-MacOS | 15c949c8f722d424fd9603fab3c49ec4b2b720eb | [
"MIT"
] | null | null | null | contrib/gitian-builder/inputs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSPanGestureRecognizer.h | Phikzel2/haroldcoin-main-MacOS | 15c949c8f722d424fd9603fab3c49ec4b2b720eb | [
"MIT"
] | 1 | 2021-08-13T21:12:07.000Z | 2021-08-13T21:12:07.000Z | /*
NSPanGestureRecognizer.h
Application Kit
Copyright (c) 2013-2018, Apple Inc.
All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <AppKit/NSGestureRecognizer.h>
NS_ASSUME_NONNULL_BEGIN
NS_CLASS_AVAILABLE(10_10, NA)
@interface NSPanGestureRecognizer : NSGestureRecognizer <NSCoding> {
@private
NSPoint _location APPKIT_IVAR;
NSPoint _translation APPKIT_IVAR;
NSUInteger _buttonMask APPKIT_IVAR;
NSInteger _buttonCount APPKIT_IVAR;
id _velocityFilter APPKIT_IVAR;
CGFloat private0 __unused APPKIT_IVAR;
CGFloat private1 __unused APPKIT_IVAR;
struct __pgrFlags {
unsigned int reserved0:1;
unsigned int reserved:31;
} __pgrFlags __unused APPKIT_IVAR;
id _reserved0 APPKIT_IVAR;
id _reserved1 __unused APPKIT_IVAR;
}
/* bitfield of the button(s) required to recognize this click where bit 0 is the primary button, 1 is the secondary button, etc...
NSClickGestureRecognizer.h dynamically returns YES to delay primary, secondary and other mouse events depending on this value.
*/
@property NSUInteger buttonMask; // Defaults to 0x1
/* translation in the coordinate system of the specified view */
- (NSPoint)translationInView:(nullable NSView*)view;
- (void)setTranslation:(NSPoint)translation inView:(nullable NSView*)view;
/* velocity of the pan in points/second in the coordinate system of the specified view */
- (NSPoint)velocityInView:(nullable NSView*)view;
@end
@interface NSPanGestureRecognizer (NSTouchBar)
@property NSInteger numberOfTouchesRequired NS_AVAILABLE_MAC(10_12_2);
@end
NS_ASSUME_NONNULL_END
| 32.36 | 130 | 0.771941 |
27872dad9ac9e49fc74b4f8ed3550267a5aa2496 | 413 | h | C | Example/MSYTableView/Example/Presenter/MSYExamplePresenter.h | CoderMSY/MSYTableView | 1f28920546ff9bdb301bcc69ca4977d33d255e08 | [
"MIT"
] | null | null | null | Example/MSYTableView/Example/Presenter/MSYExamplePresenter.h | CoderMSY/MSYTableView | 1f28920546ff9bdb301bcc69ca4977d33d255e08 | [
"MIT"
] | null | null | null | Example/MSYTableView/Example/Presenter/MSYExamplePresenter.h | CoderMSY/MSYTableView | 1f28920546ff9bdb301bcc69ca4977d33d255e08 | [
"MIT"
] | null | null | null | //
// MSYExamplePresenter.h
// MSYTableView_Example
//
// Created by Simon Miao on 2021/8/23.
// Copyright © 2021 SimonMiao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MSYExamplePresenterIO.h"
NS_ASSUME_NONNULL_BEGIN
@interface MSYExamplePresenter : NSObject <MSYExamplePresenterInput>
@property (nonatomic, weak) id <MSYExamplePresenterOutput>output;
@end
NS_ASSUME_NONNULL_END
| 19.666667 | 68 | 0.779661 |
8f7c238f963c1343f3e3d0b6201daa26cc1bcdb4 | 2,516 | h | C | mplayer/libmpcodecs/vd.h | qinjidong/EasyMPlayer | 76a8d052dd7a2d5f1916fdc32b07088d127ee5da | [
"Apache-2.0"
] | null | null | null | mplayer/libmpcodecs/vd.h | qinjidong/EasyMPlayer | 76a8d052dd7a2d5f1916fdc32b07088d127ee5da | [
"Apache-2.0"
] | null | null | null | mplayer/libmpcodecs/vd.h | qinjidong/EasyMPlayer | 76a8d052dd7a2d5f1916fdc32b07088d127ee5da | [
"Apache-2.0"
] | 1 | 2021-04-15T18:27:37.000Z | 2021-04-15T18:27:37.000Z | /*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_VD_H
#define MPLAYER_VD_H
#include "m_option.h"
#include "mp_image.h"
#include "mpc_info.h"
#include "libmpdemux/stheader.h"
typedef mp_codec_info_t vd_info_t;
/* interface of video decoder drivers */
typedef struct vd_functions
{
const vd_info_t *info;
int (*init)(sh_video_t *sh);
void (*uninit)(sh_video_t *sh);
int (*control)(sh_video_t *sh,int cmd,void* arg, ...);
mp_image_t* (*decode)(sh_video_t *sh,void* data,int len,int flags);
} vd_functions_t;
// NULL terminated array of all drivers
extern const vd_functions_t * const mpcodecs_vd_drivers[];
extern int flip;
extern int fullscreen;
extern int opt_screen_size_x;
extern int opt_screen_size_y;
extern int softzoom;
extern int vd_use_slices;
extern int vidmode;
extern float movie_aspect;
extern float screen_size_xy;
extern const m_option_t lavc_decode_opts_conf[];
extern const m_option_t xvid_dec_opts[];
#define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */
#define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
#define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
#define VDCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
#define VDCTRL_GET_EQUALIZER 7 /* get color options (brightness,contrast etc) */
#define VDCTRL_RESYNC_STREAM 8 /* seeking */
#define VDCTRL_QUERY_UNSEEN_FRAMES 9 /* current decoder lag */
// callbacks:
int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt);
mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y);
#define VDFLAGS_DROPFRAME 3
#endif /* MPLAYER_VD_H */
| 35.43662 | 102 | 0.753975 |
8fb1edc7f2c8d884309b08e6dc4ff7a7a5affac2 | 481 | c | C | _background/Johann Rocholl's Source/Initial/BlurCode/Decoder/minmax.c | Farranco/HyperopicBarcode | e1389f496f1d21e4ffcf216982a09a15fa998db7 | [
"Intel",
"Unlicense"
] | 1 | 2016-08-31T04:57:05.000Z | 2016-08-31T04:57:05.000Z | _background/Johann Rocholl's Source/Initial/BlurCode/Decoder/minmax.c | Farranco/HyperopicBarcode | e1389f496f1d21e4ffcf216982a09a15fa998db7 | [
"Intel",
"Unlicense"
] | null | null | null | _background/Johann Rocholl's Source/Initial/BlurCode/Decoder/minmax.c | Farranco/HyperopicBarcode | e1389f496f1d21e4ffcf216982a09a15fa998db7 | [
"Intel",
"Unlicense"
] | null | null | null | #include "minmax.h"
int compare_int(const void* a_ptr, const void* b_ptr)
{
int a = *(int*) a_ptr;
int b = *(int*) b_ptr;
return a - b;
}
int compare_unsigned_char(const void* a_ptr, const void* b_ptr)
{
int a = *(unsigned char*) a_ptr;
int b = *(unsigned char*) b_ptr;
return a - b;
}
int compare_float(const void* a_ptr, const void* b_ptr)
{
float a = *(float*) a_ptr;
float b = *(float*) b_ptr;
if (a > b) return 1;
if (b > a) return -1;
return 0;
}
| 17.178571 | 63 | 0.613306 |
e9709e8e7b9a346069a66ccffb014cce6c5e24f7 | 109 | h | C | external/src/yasm/config.h | emarc99/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 146 | 2017-03-21T07:50:43.000Z | 2022-03-19T03:32:22.000Z | external/src/yasm/config.h | Crasader/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 50 | 2017-03-22T04:08:15.000Z | 2019-10-21T16:55:48.000Z | external/src/yasm/config.h | Crasader/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 55 | 2017-03-21T07:52:58.000Z | 2021-12-27T13:02:08.000Z | #if defined(_WIN32) || defined(_WIN64)
# include "config_win32.h"
#else
# include "config_unix.h"
#endif
| 18.166667 | 38 | 0.697248 |
6a78bf3a98858710602583289d5ef084e39e4b7e | 1,995 | c | C | programs/progman/string.c | xilwen/wine | 2318484e1e33cb30f00eb9a62cb9aa5f83e5dc99 | [
"MIT"
] | 2,322 | 2015-01-10T13:48:25.000Z | 2022-03-31T18:52:48.000Z | programs/progman/string.c | xilwen/wine | 2318484e1e33cb30f00eb9a62cb9aa5f83e5dc99 | [
"MIT"
] | 136 | 2018-08-21T23:38:26.000Z | 2022-03-31T16:55:57.000Z | programs/progman/string.c | xilwen/wine | 2318484e1e33cb30f00eb9a62cb9aa5f83e5dc99 | [
"MIT"
] | 980 | 2015-01-05T05:50:50.000Z | 2022-03-31T09:29:07.000Z | /*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "progman.h"
/* Class names */
const WCHAR STRING_MAIN_WIN_CLASS_NAME[] = L"PMMain";
const WCHAR STRING_MDI_WIN_CLASS_NAME[] = L"MDICLIENT";
const WCHAR STRING_GROUP_WIN_CLASS_NAME[] = L"PMGroup";
const WCHAR STRING_PROGRAM_WIN_CLASS_NAME[] = L"PMProgram";
VOID STRING_LoadMenus(VOID)
{
CHAR caption[MAX_STRING_LEN];
HMENU hMainMenu;
/* Set frame caption */
LoadStringA(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowTextA(Globals.hMainWnd, caption);
/* Create menu */
hMainMenu = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(MAIN_MENU));
Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
if (Globals.hMDIWnd)
SendMessageW(Globals.hMDIWnd, WM_MDISETMENU,
(WPARAM) hMainMenu,
(LPARAM) Globals.hWindowsMenu);
else SetMenu(Globals.hMainWnd, hMainMenu);
/* Destroy old menu */
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
}
| 33.25 | 80 | 0.746366 |
6a3358ef195c8ef00124bbc11582e0220b229724 | 214 | c | C | eloadasok/11_rekurzio_headers_egyeb/sources/fakt_iterativ.c | jabbalaci/Programozas_1 | 5717502b94bca35b23460c8b1aa7b25ba8069eb4 | [
"MIT"
] | 11 | 2020-02-10T16:38:30.000Z | 2022-02-15T07:12:25.000Z | eloadasok/11_rekurzio_headers_egyeb/sources/fakt_iterativ.c | jabbalaci/Programozas_1 | 5717502b94bca35b23460c8b1aa7b25ba8069eb4 | [
"MIT"
] | null | null | null | eloadasok/11_rekurzio_headers_egyeb/sources/fakt_iterativ.c | jabbalaci/Programozas_1 | 5717502b94bca35b23460c8b1aa7b25ba8069eb4 | [
"MIT"
] | 24 | 2020-02-16T13:28:38.000Z | 2022-03-05T16:55:18.000Z | #include <stdio.h>
int fakt(int n)
{
int x = 1;
for (int i = 1; i <= n; ++i) {
x *= i;
}
return x;
}
int main()
{
int result = fakt(5);
printf("%d\n", result);
return 0;
}
| 9.727273 | 34 | 0.425234 |
16afe5b6d0316aea0ddf3c945ca9dc34c340afe1 | 5,761 | h | C | Executor/DataProviders/Nanex/DataProviderNanex.h | utahman/Executor2 | db40318e88e81306787dbe30188cd0061a959334 | [
"MIT"
] | 2 | 2020-10-21T13:44:50.000Z | 2021-08-29T16:02:35.000Z | Executor/DataProviders/Nanex/DataProviderNanex.h | utahman/Executor2 | db40318e88e81306787dbe30188cd0061a959334 | [
"MIT"
] | null | null | null | Executor/DataProviders/Nanex/DataProviderNanex.h | utahman/Executor2 | db40318e88e81306787dbe30188cd0061a959334 | [
"MIT"
] | 1 | 2021-08-29T16:02:40.000Z | 2021-08-29T16:02:40.000Z | // Copyright(C) 2020 utahman https://github.com/utahman
// MIT License http://www.opensource.org/licenses/mit-license.php
#pragma once
#include "Config.h"
#include "C:\Program Files (x86)\Nanex\NxCoreAPI\NxCoreAPI_Wrapper_C++.h"
#define CATEGORY_TYPE_EquityFundamental 9
#define CATEGORY_TYPE_DTNEquityFundamental 10
#define CATEGORY_TYPE_52WeekHiLo 13
#define CATEGORY_TYPE_OHLC 16 // OHLC - Open, High, Low, Close
#define CATEGORY_TYPE_RootSymbolInfo 70
#define CATEGORY_STR_Beta "Beta" // In EquityFundamental
#define CATEGORY_STR_Volatility "Volatility" // In DTNEquityFundamental
#define CATEGORY_STR_AvgVolume "AvgVolume" // In DTNEquityFundamental
#define CATEGORY_STR_PE "PE" // In DTNEquityFundamental
#define CATEGORY_STR_Yield "Yield" // In DTNEquityFundamental
#define CATEGORY_STR_52WeekHigh "High" // In 52WeekHiLo
#define CATEGORY_STR_52WeekLow "Low" // In 52WeekHiLo
#define CATEGORY_STR_Open "Open" // In OHLC
#define CATEGORY_STR_High "High" // In OHLC
#define CATEGORY_STR_Low "Low" // In OHLC
#define CATEGORY_STR_Close "Close" // In OHLC
#define CATEGORY_STR_Volume "Volume" // In OHLC
#define CATEGORY_STR_QuotedUnit "QuotedUnit" // In RootSymbolInfo
#define NC_EXCHNAGE_NYSE 3 // Stocks
#define NC_EXCHNAGE_AMEX 4
#define NC_EXCHNAGE_PACF 7 // For DIA, SPY and more stocks
#define NC_EXCHNAGE_NASDAQ_NATIONAL 12
#define NC_EXCHNAGE_NASDAQ_SM_CAPS 13
#define NC_EXCHNAGE_CME 20 // Futures
#define NC_EXCHNAGE_CBOT 24 // Futures
#define NC_EXCHNAGE_BARK 45 // Forex quotes from Barklays
// For bitwise operations, so keep growing at power of 2
#define CHANGED_BID 1
#define CHANGED_ASK 2
#define CHANGED_LAST1 4
#define CHANGED_PREV_OPEN 8
#define CHANGED_PREV_HIGH 16
#define CHANGED_PREV_LOW 32
#define CHANGED_PREV_CLOSE 64
#define CHANGED_BETA 128
#define CHANGED_VOLATILITY 256
#define CHANGED_AVER_VOLUME 512
#define CHANGED_PE 1024
#define CHANGED_YIELD 2048
#define CHANGED_52WEEK_HIGH 4096
#define CHANGED_52WEEK_LOW 8192
#define CHANGED_PREMARKET_LAST 16384
class DataProviderNanex : public IDataProvider
{
protected:
NxCoreClass _core;
volatile bool _thread_running = false;
volatile bool _exiting = false;
volatile int _tapeStatus = -1;
std::string _tapes_folder;
std::string _tape_name;
bool _initialized = false;
int _recid = 0; // Record id in the nanex tape
bool _bEndOfTape = false;
int _UseSecurities = 0;
char* _UnusedStockName = (char*)"BADBAD";
ILogs* _logs = NULL;
std::string _dll_path;
std::vector <std::pair<std::string, std::string>> _renames;
static DataProviderNanex* _object;
public:
DataProviderNanex();
~DataProviderNanex()
{
Stop();
}
bool Start();
void Stop()
{
_exiting = true;
while (_thread_running)
Sleep(10);
//g_Symbols.DestroyAllSymbols();
}
bool EndOfTape() { return _bEndOfTape; }
bool IsThreadRunning() { return _thread_running; }
static char* GetNameFromNxCoreName(char* core_name);
static int ExceptionFilter(unsigned int code, struct _EXCEPTION_POINTERS* ep);
void AddForegnSymbol(char* name, USHORT exchange, char SecurityType);
std::vector < std::pair<std::string, std::string>>& GetRenamesVector() { return _renames; }
int GetCurrentRID() { return _recid; }
private: // Internal methods
virtual void Data_Process(FastData* /*pdata*/) // From DataProcessor
{
}
int RID() { return _recid++; }
float FieldToFloat(NxCategoryField& f);
bool IsGoodNCStockSymbolName(char* name);
bool IsGoodNCFuturesSymbolName(char* name);
bool IsGoodNCForexSymbolName(char* name);
void AddSymbol(char* clean_name, USHORT exchange, char SecurityType, const NxCoreMessage* pNxCoreMessage);
void OnError(const int StatusData, const char* StatusString)
{
_logs->Add(0, format("Error : %d %s", StatusData, StatusString));
}
void OnWarning(const int StatusData, const char* StatusString)
{
_logs->Add(0, format("Warning : %d %s", StatusData, StatusString));
}
static UINT ThreadNxCoreAPI(void* pparam);
static int __stdcall CoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMsg);
bool IsCorrectExchange(USHORT exchange);
int processNxCoreStatClk(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMsg);
int processNxCoreExgQuote(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage);
int processNxCoreTrade(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage);
int processNxCoreSymSpin(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage);
int processNxCoreSymChg(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage);
int processNxCoreCategory(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage);
int processNxCoreMMQuote(const NxCoreSystem* /*pNxCoreSys*/, const NxCoreMessage* /*pNxCoreMessage*/)
{
return NxCALLBACKRETURN_CONTINUE; // return this value to continue processing messages.
}
};
inline bool IsStockExchange(int exchange)
{
if (exchange == NC_EXCHNAGE_NASDAQ_NATIONAL ||
exchange == NC_EXCHNAGE_NASDAQ_SM_CAPS ||
exchange == NC_EXCHNAGE_NYSE ||
exchange == NC_EXCHNAGE_AMEX)
return true;
return false;
}
inline bool IsStockExchangeWithETF(int exchange)
{
if (exchange == NC_EXCHNAGE_NASDAQ_NATIONAL ||
exchange == NC_EXCHNAGE_NASDAQ_SM_CAPS ||
exchange == NC_EXCHNAGE_PACF ||
exchange == NC_EXCHNAGE_NYSE ||
exchange == NC_EXCHNAGE_AMEX)
return true;
return false;
}
inline bool IsFuturesExchange(int exchange)
{
if (exchange == NC_EXCHNAGE_CME ||
exchange == NC_EXCHNAGE_CBOT)
return true;
return false;
}
inline bool IsForexExchange(int exchange)
{
if (exchange == NC_EXCHNAGE_BARK)
return true;
return false;
}
| 33.888235 | 107 | 0.75959 |
364a27c4b8ad6bc7e32136760108c0cd8e47db38 | 335 | h | C | Cyano/Cyano/class/model/apps/MDApps.h | ontio-cyano/cyano-ios-oc-sdk | 7cf25d0ccf7cb2754ef9ae9f976f092e5ae75347 | [
"MIT"
] | null | null | null | Cyano/Cyano/class/model/apps/MDApps.h | ontio-cyano/cyano-ios-oc-sdk | 7cf25d0ccf7cb2754ef9ae9f976f092e5ae75347 | [
"MIT"
] | 1 | 2019-02-22T02:57:21.000Z | 2019-02-22T02:57:21.000Z | Cyano/Cyano/class/model/apps/MDApps.h | ontio-cyano/cyano-ios-oc-sdk | 7cf25d0ccf7cb2754ef9ae9f976f092e5ae75347 | [
"MIT"
] | 1 | 2019-01-14T06:18:02.000Z | 2019-01-14T06:18:02.000Z | //
// MDApps.h
// Cyano
//
// Created by Yuanhai on 30/12/18.
// Copyright © 2018年 Yuanhai. All rights reserved.
//
#import "BaseModel.h"
#import "MDBanner.h"
#import "MDApp.h"
@interface MDApps : BaseModel
@property (strong, nonatomic) NSArray <MDBanner *> *banner;
@property (strong, nonatomic) NSArray <MDApp *> *apps;
@end
| 17.631579 | 59 | 0.677612 |
384f61dfeac3ba894b9844025b6498a8fe195d1c | 5,585 | h | C | Malmo-0.30.0/Cpp_Examples/include/ArgumentParser.h | JeremyHi/402-CryptoSym | 13e62c33be65c0e192cdee401c9cf8891410f08a | [
"MIT"
] | 2 | 2017-04-10T21:01:35.000Z | 2019-06-08T10:02:16.000Z | Malmo-0.30.0/Cpp_Examples/include/ArgumentParser.h | JeremyHi/402-CryptoSym | 13e62c33be65c0e192cdee401c9cf8891410f08a | [
"MIT"
] | null | null | null | Malmo-0.30.0/Cpp_Examples/include/ArgumentParser.h | JeremyHi/402-CryptoSym | 13e62c33be65c0e192cdee401c9cf8891410f08a | [
"MIT"
] | 1 | 2018-08-02T10:51:51.000Z | 2018-08-02T10:51:51.000Z | // --------------------------------------------------------------------------------------------------
// Copyright (c) 2016 Microsoft Corporation
//
// 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 _ARGUMENTPARSER_H_
#define _ARGUMENTPARSER_H_
// Boost:
#include <boost/program_options.hpp>
// STL:
#include <string>
#include <vector>
namespace malmo
{
//! A general purpose command-line argument parser.
class ArgumentParser
{
public:
//! Construct an argument parser.
//! \param title The title of the program to display.
ArgumentParser(const std::string& title);
//! Parses a list of strings given in the C style. Throws std::exception if parsing fails.
/*! Available in C++ only. In other languages use the parse function instead. */
//! \param argc The number of arguments.
//! \param argv The arguments to parse.
//! \see parse()
void parseArgs(int argc, const char** argv);
//! Parses a list of strings. Throws std::exception if parsing fails.
/*! In C++: takes a std::vector<std::string>.
In Python: takes a list of strings.
In Lua: takes a table of strings. */
//! \param args The arguments to parse.
void parse(const std::vector< std::string >& args);
//! Specify an integer argument that can be given on the command line.
//! \param name The name of the argument. To be given as "--name <value>"
//! \param description The explanation of the argument that can be printed out.
//! \param defaultValue The value that this argument should have if not given on the command line.
void addOptionalIntArgument(const std::string& name, const std::string& description, int defaultValue);
//! Specify a floating-point argument that can be given on the command line.
//! \param name The name of the argument. To be given as "--name <value>"
//! \param description The explanation of the argument that can be printed out.
//! \param defaultValue The value that this argument should have if not given on the command line.
void addOptionalFloatArgument(const std::string& name, const std::string& description, double defaultValue);
//! Specify a string argument that can be given on the command line.
//! \param name The name of the argument. To be given as "--name <value>"
//! \param description The explanation of the argument that can be printed out.
//! \param defaultValue The value that this argument should have if not given on the command line.
void addOptionalStringArgument(const std::string& name, const std::string& description, const std::string& defaultValue);
//! Specify a boolean flag that can be given on the command line.
//! \param name The name of the flag. To be given as "--name"
//! \param description The explanation of the flag that can be printed out.
void addOptionalFlag(const std::string& name, const std::string& description);
//! Gets a string that describes the current set of options we expect.
//! \returns The usage string, for displaying.
std::string getUsage() const;
//! Gets whether a named argument was parsed on the command-line arguments.
//! \param name The name of the argument.
//! \returns True if the named argument was received.
bool receivedArgument(const std::string& name) const;
//! Retrieves the value of a named integer argument.
//! \param name The name of the argument.
//! \returns The value of the named argument.
int getIntArgument(const std::string& name) const;
//! Retrieves the value of a named floating-point argument.
//! \param name The name of the argument.
//! \returns The value of the named argument.
double getFloatArgument(const std::string& name) const;
//! Retrieves the value of a named string argument.
//! \param name The name of the argument.
//! \returns The value of the named argument.
std::string getStringArgument(const std::string& name) const;
private:
boost::program_options::options_description spec; // the specifications of the options we expect
boost::program_options::variables_map opts; // the names and values of the options we received
};
}
#endif
| 50.772727 | 129 | 0.657117 |
e075e67a96375e6c50a28182f1ad1863051e80f5 | 6,308 | c | C | kernel/src/fs/binfmt/binfmt_elf.c | khoek/k-os | 8eb15bf831b877b9fd00e7ab2dfcbf88924e2f49 | [
"BSD-2-Clause"
] | 10 | 2017-07-26T20:58:32.000Z | 2020-08-04T15:42:13.000Z | kernel/src/fs/binfmt/binfmt_elf.c | khoek/k-os | 8eb15bf831b877b9fd00e7ab2dfcbf88924e2f49 | [
"BSD-2-Clause"
] | 1 | 2015-09-15T22:09:56.000Z | 2015-12-07T01:42:55.000Z | kernel/src/fs/binfmt/binfmt_elf.c | escortkeel/k-os | 8eb15bf831b877b9fd00e7ab2dfcbf88924e2f49 | [
"BSD-2-Clause"
] | 1 | 2021-08-04T10:04:33.000Z | 2021-08-04T10:04:33.000Z | #include <stdbool.h>
#include "common/types.h"
#include "lib/string.h"
#include "common/math.h"
#include "init/initcall.h"
#include "bug/debug.h"
#include "arch/pl.h"
#include "mm/mm.h"
#include "arch/proc.h"
#include "sched/task.h"
#include "fs/binfmt.h"
#include "fs/elf.h"
#include "log/log.h"
#define USTACK_ADDR_START 0xB0000000
#define UARGS_ADDR_START 0xB8000000
#define USTACK_NUM_PAGES 8
#define UARGS_NUM_PAGES 1
#define USTACK_SIZE (USTACK_NUM_PAGES * PAGE_SIZE)
#define designate_stack(t) \
designate_space(t, (void *) USTACK_ADDR_START, USTACK_NUM_PAGES)
#define designate_args(t) \
designate_space(t, (void *) UARGS_ADDR_START, UARGS_NUM_PAGES)
static bool elf_header_valid(Elf32_Ehdr *ehdr) {
return ehdr->e_ident[EI_MAG0] == ELFMAG0
&& ehdr->e_ident[EI_MAG1] == ELFMAG1
&& ehdr->e_ident[EI_MAG2] == ELFMAG2
&& ehdr->e_ident[EI_MAG3] == ELFMAG3
&& ehdr->e_ident[EI_CLASS] == ELFCLASS32
&& ehdr->e_ident[EI_DATA] == ELFDATA2LSB
&& ehdr->e_ident[EI_VERSION] == EV_CURRENT
&& ehdr->e_version == EV_CURRENT
&& ehdr->e_machine == EM_386;
}
static void * designate_space(thread_t *t, void *start, uint32_t num_pages) {
while(resolve_virt(t, start)) {
panic("WRITING TO ALREADY ALLOC'D SPACE!");
//start += num_pages * PAGE_SIZE;
}
page_t *page = alloc_pages(num_pages, ALLOC_ZERO);
user_map_pages(current, start, page_to_phys(page), num_pages);
return start;
}
static uint32_t calculate_strtablen(char **tab) {
if(!tab) return 0;
uint32_t tablen = 0;
while(*(tab++)) {
tablen++;
}
return tablen;
}
uint32_t strcpylen(char *dest, const char *src) {
uint32_t len = 0;
while ((*dest++ = *src++) != '\0') {
len++;
}
return len;
}
//returns a pointer to just after the copied strtab
static void * build_strtab(char **start, char **tab, uint32_t *out_tablen) {
uint32_t tablen = calculate_strtablen(tab);
if(out_tablen) {
*out_tablen = tablen;
}
char *end = (void *) (start + tablen * sizeof(char *) + 1);
while(*tab) {
*(start++) = end;
end += strcpylen(end, *tab++) + 1;
}
*start = NULL;
return end;
}
static int32_t load_elf(binary_t *binary) {
uint32_t flags;
irqsave(&flags);
void *olddir = arch_replace_mem(current, NULL);
Elf32_Ehdr *ehdr = kmalloc(sizeof(Elf32_Ehdr));
if(vfs_seek(binary->file, 0, SEEK_SET) != 0) {
goto fail_io;
}
if(vfs_read(binary->file, ehdr, sizeof(Elf32_Ehdr)) != sizeof(Elf32_Ehdr)) {
//TODO check for error, and in this case report fail_io instead
goto fail_not_elf;
}
if(!elf_header_valid(ehdr)) goto fail_not_elf;
if(!ehdr->e_phoff) goto fail_not_elf;
kprintf("binfmt_elf - phdr @ %X", ehdr->e_phoff);
Elf32_Phdr *phdr = kmalloc(sizeof(Elf32_Phdr) * ehdr->e_phnum);
if(vfs_seek(binary->file, ehdr->e_phoff, SEEK_SET) != ehdr->e_phoff) {
goto fail_io;
}
if(vfs_read(binary->file, phdr, sizeof(Elf32_Phdr) * ehdr->e_phnum)
!= ((ssize_t) (sizeof(Elf32_Phdr) * ehdr->e_phnum))) {
goto fail_io;
}
for(uint32_t i = 0; i < ehdr->e_phnum; i++) {
// TODO: validate the segments as we are going, like, everything is
// vulnerable!
switch(phdr[i].p_type) {
case PT_NULL:
break;
case PT_LOAD: {
kprintf("binfmt_elf - LOAD (%X, %X) @ %X -> %X - %X", phdr[i].p_filesz, phdr[i].p_memsz, phdr[i].p_offset, phdr[i].p_vaddr, phdr[i].p_vaddr + phdr[i].p_memsz);
void *addr = (void *) phdr[i].p_vaddr;
if(vfs_seek(binary->file, phdr[i].p_offset, SEEK_SET)
!= phdr[i].p_offset) {
goto fail_io;
}
uint32_t bytes_written = 0;
while(bytes_written < phdr[i].p_memsz) {
if(!user_get_page(current, addr + bytes_written)) {
user_alloc_page(current, addr + bytes_written, 0);
}
uint32_t page_bytes_left = PAGE_SIZE - (((uint32_t) (addr + bytes_written)) % PAGE_SIZE);
int32_t chunk_len;
if(bytes_written < phdr[i].p_filesz) {
chunk_len = MIN(page_bytes_left, phdr[i].p_filesz - bytes_written);
if(vfs_read(binary->file, addr + bytes_written, chunk_len) != chunk_len) {
goto fail_io;
}
} else {
chunk_len = MIN(page_bytes_left, phdr[i].p_memsz - bytes_written);
memset(addr + bytes_written, 0, chunk_len);
}
bytes_written += chunk_len;
}
break;
}
case PT_TLS: {
panicf("binfmt_elf - unsupported phdr TLS");
break;
}
default:
panicf("binfmt_elf - unsupported phdr type (0x%X)", phdr[i].p_type);
break;
}
}
kprintf("binfmt_elf - entry: %X", ehdr->e_entry);
irqdisable();
thread_t *me = current;
task_node_t *node = obtain_task_node(me);
//an irqsave guards this entire function
spin_lock(&node->lock);
node->argv = binary->argv;
node->envp = binary->envp;
spin_unlock(&node->lock);
void *ustack = designate_stack(me) + USTACK_SIZE;
uint32_t argc;
void *arg_buff = designate_args(me);
void *uargv = arg_buff;
arg_buff = build_strtab(arg_buff, binary->argv, &argc);
void *uenvp = arg_buff;
arg_buff = build_strtab(arg_buff, binary->envp, NULL);
pl_bootstrap_userland((void *) ehdr->e_entry, ustack, argc, uargv, uenvp);
BUG();
fail_not_elf:
arch_replace_mem(current, olddir);
irqstore(flags);
return -ENOEXEC;
fail_io:
arch_replace_mem(current, olddir);
irqstore(flags);
return -EIO;
}
static binfmt_t elf = {
.load = load_elf,
};
static INITCALL elf_register_binfmt() {
binfmt_register(&elf);
return 0;
}
core_initcall(elf_register_binfmt);
| 28.160714 | 175 | 0.577521 |
6de7580ee5c9ef76afa68eac22916cc55ff103e8 | 1,673 | h | C | RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-23T13:40:24.000Z | 2019-12-05T21:16:03.000Z | RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecific.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z |
#ifndef RecoEcal_EgammaCoreTools_EcalClusterEnergyCorrection_ObjectSpecific_h
#define RecoEcal_EgammaCoreTools_EcalClusterEnergyCorrection_ObjectSpecific_h
/** \class EcalClusterEnergyCorrectionObjectSpecific
* Function that provides supercluster energy correction due to Bremsstrahlung loss
*
* $Id: EcalClusterEnergyCorrectionObjectSpecific.h
* $Date:
* $Revision:
* \author Nicolas Chanon, October 2011
*/
//#include "DataFormats/EgammaCandidates/interface/Photon.h"
//#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrectionObjectSpecificBaseClass.h"
class EcalClusterEnergyCorrectionObjectSpecific : public EcalClusterEnergyCorrectionObjectSpecificBaseClass {
public:
EcalClusterEnergyCorrectionObjectSpecific( const edm::ParameterSet &){};
// compute the correction
//float getValue( const reco::Photon &, const int mode) const;
//virtual float getValue( const reco::GsfElectron &, const int mode) const;
float getValue( const reco::SuperCluster &, const int mode) const override;
float getValue( const reco::BasicCluster &, const EcalRecHitCollection & ) const override { return 0.;};
float fEta (float energy, float eta, int algorithm) const;
//float fBrem (float e, float eta, int algorithm) const;
//float fEtEta(float et, float eta, int algorithm) const;
float fBremEta(float sigmaPhiSigmaEta, float eta, int algorithm) const;
float fEt(float et, int algorithm) const;
float fEnergy(float e, int algorithm) const;
//float r9;
//float e5x5;
};
#endif
| 36.369565 | 120 | 0.747759 |
768b9715ca473c547f40883c81e28a12d627b0a4 | 277 | h | C | DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Message/SSKit/Add/AppDelegate+SSAdd.h | webersongao/DiscuzQ_iOS | 71ee9bdbcce2fcadc18e1916febcea8d3470e704 | [
"Apache-2.0"
] | 27 | 2020-04-05T14:02:58.000Z | 2021-09-13T02:14:12.000Z | DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Message/SSKit/Add/AppDelegate+SSAdd.h | webersongao/DiscuzQ_iOS | 71ee9bdbcce2fcadc18e1916febcea8d3470e704 | [
"Apache-2.0"
] | null | null | null | DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Message/SSKit/Add/AppDelegate+SSAdd.h | webersongao/DiscuzQ_iOS | 71ee9bdbcce2fcadc18e1916febcea8d3470e704 | [
"Apache-2.0"
] | 6 | 2020-07-18T11:36:11.000Z | 2022-01-30T06:09:48.000Z | //
// AppDelegate+DEAdd.h
// Project
//
// Created by soldoros on 16/6/27.
// Copyright © 2016年 soldoros. All rights reserved.
//
#import "DZQDelegate.h"
@interface DZQDelegate (SSAdd)
/**
获取单例
@return 返回delegate单例
*/
+(DZQDelegate *)sharedAppDelegate;
@end
| 9.892857 | 52 | 0.66065 |
63373e5dc7734b785a4c07bce578111b72c6c00e | 3,005 | c | C | sys/src/cmd/ndb/dnsquery.c | ekaitz-zarraga/jehanne | 431c7ae36521d0d931a21e1100d8522893d22a35 | [
"RSA-MD"
] | null | null | null | sys/src/cmd/ndb/dnsquery.c | ekaitz-zarraga/jehanne | 431c7ae36521d0d931a21e1100d8522893d22a35 | [
"RSA-MD"
] | null | null | null | sys/src/cmd/ndb/dnsquery.c | ekaitz-zarraga/jehanne | 431c7ae36521d0d931a21e1100d8522893d22a35 | [
"RSA-MD"
] | null | null | null | /*
* This file is part of the UCB release of Plan 9. It is subject to the license
* terms in the LICENSE file found in the top-level directory of this
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
* part of the UCB release of Plan 9, including this file, may be copied,
* modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
/* Portions of this file are Copyright (C) 2015-2018 Giacomo Tesio <giacomo@tesio.it>
* See /doc/license/gpl-2.0.txt for details about the licensing.
*/
#include <u.h>
#include <lib9.h>
#include <bio.h>
#include <ctype.h>
#include <ndb.h>
#include "dns.h"
#include "ip.h"
static int domount;
static char *mtpt, *dns, *srv;
static int
setup(int argc, char **argv)
{
int fd;
if(argc == 1){
domount = 0;
mtpt = argv[0];
}
fd = open(dns, ORDWR);
if(fd < 0){
if(domount == 0)
sysfatal("can't open %s: %r", dns);
fd = open(srv, ORDWR);
if(fd < 0)
sysfatal("can't open %s: %r", srv);
if(mount(fd, -1, mtpt, MBEFORE, "", '9') < 0)
sysfatal("can't mount(%s, %s): %r", srv, mtpt);
fd = open(dns, ORDWR);
if(fd < 0)
sysfatal("can't open %s: %r", dns);
}
return fd;
}
static void
querydns(int fd, char *line, int n)
{
char buf[1024];
seek(fd, 0, 0);
if(write(fd, line, n) != n) {
print("!%r\n");
return;
}
seek(fd, 0, 0);
buf[0] = '\0';
while((n = read(fd, buf, sizeof(buf))) > 0){
buf[n] = '\0';
print("%s\n", buf);
}
}
static void
query(int fd)
{
int n, len;
char *lp, *p, *np;
char buf[1024], line[1024];
Biobuf in;
Binit(&in, 0, OREAD);
for(print("> "); lp = Brdline(&in, '\n'); print("> ")){
n = Blinelen(&in) -1;
while(isspace(lp[n]))
lp[n--] = 0;
n++;
while(isspace(*lp)){
lp++;
n--;
}
if(!*lp)
continue;
strcpy(line, lp);
/* default to an "ip" request if alpha, "ptr" if numeric */
if(strchr(line, ' ') == nil)
if(strcmp(ipattr(line), "ip") == 0) {
strcat(line, " ptr");
n += 4;
} else {
strcat(line, " ip");
n += 3;
}
/* inverse queries may need to be permuted */
if(n > 4 && strcmp(" ptr", &line[n-4]) == 0 &&
cistrstr(line, ".arpa") == nil){
/* TODO: reversing v6 addrs is harder */
for(p = line; *p; p++)
if(*p == ' '){
*p = '.';
break;
}
np = buf;
len = 0;
while(p >= line){
len++;
p--;
if(*p == '.'){
memmove(np, p+1, len);
np += len;
len = 0;
}
}
memmove(np, p+1, len);
np += len;
strcpy(np, "in-addr.arpa ptr"); /* TODO: ip6.arpa for v6 */
strcpy(line, buf);
n = strlen(line);
}
querydns(fd, line, n);
}
Bterm(&in);
}
void
main(int argc, char *argv[])
{
mtpt = "/net";
dns = "/net/dns";
srv = "/srv/dns";
domount = 1;
ARGBEGIN {
case 'x':
mtpt = "/net.alt";
dns = "/net.alt/dns";
srv = "/srv/dns_net.alt";
break;
default:
fprint(2, "usage: %s [-x] [dns-mount-point]\n", argv0);
exits("usage");
} ARGEND;
query(setup(argc, argv));
exits(0);
}
| 19.640523 | 85 | 0.551747 |
498b0225489048a87d10f59db650da667cc04a86 | 17,200 | c | C | java/ddlogapi.c | Argc0/differential-datalog | dcc73e765f3e39d3faa10ee32bbe9f91958deb76 | [
"MIT"
] | null | null | null | java/ddlogapi.c | Argc0/differential-datalog | dcc73e765f3e39d3faa10ee32bbe9f91958deb76 | [
"MIT"
] | null | null | null | java/ddlogapi.c | Argc0/differential-datalog | dcc73e765f3e39d3faa10ee32bbe9f91958deb76 | [
"MIT"
] | null | null | null | /* Wrapper that converts a JNI C interface to calls to the native ddlog C API */
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "ddlogapi_DDlogAPI.h"
#include "ddlog.h"
/* The _1 in all the function names below
is the JNI translation of the _ character from Java */
// Describes a callback to an instance method.
struct CallbackInfo {
JNIEnv* env; // may be NULL if the callback is invoked from a different thread.
JavaVM* jvm; // Used to retrieve a new env when it is NULL.
// Class containing method to be called. A global JNI reference.
jclass cls;
// Instance object of the class. A global JNI reference.
jobject obj;
// Handle to the method to call.
jmethodID method;
// chained so we can resolve the leaks.
struct CallbackInfo* next;
};
static struct CallbackInfo* toDelete = NULL;
// Debugging code
static void printClass(JNIEnv* env, jobject obj) {
jclass cls = (*env)->GetObjectClass(env, obj);
// First get the class object
jmethodID mid = (*env)->GetMethodID(env, cls, "getClass", "()Ljava/lang/Class;");
jobject clsObj = (*env)->CallObjectMethod(env, obj, mid);
// Now get the class object's class descriptor
cls = (*env)->GetObjectClass(env, clsObj);
// Find the getName() method on the class object
mid = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
// Call the getName() to get a jstring object back
jstring strObj = (jstring)(*env)->CallObjectMethod(env, clsObj, mid);
const char* str = (*env)->GetStringUTFChars(env, strObj, NULL);
// Print the class name
fprintf(stderr, "Class is: %s\n", str);
(*env)->ReleaseStringUTFChars(env, strObj, str);
}
static struct CallbackInfo* createCallback(JNIEnv* env, jobject obj, jstring method, const char* signature) {
if (method == NULL)
return NULL;
struct CallbackInfo* cbinfo = malloc(sizeof(struct CallbackInfo));
if (cbinfo == NULL)
return NULL;
jint error = (*env)->GetJavaVM(env, &cbinfo->jvm);
cbinfo->env = NULL;
cbinfo->obj = (*env)->NewGlobalRef(env, obj);
jclass thisClass = (*env)->GetObjectClass(env, cbinfo->obj);
cbinfo->cls = (jclass)(*env)->NewGlobalRef(env, thisClass);
const char* methodstr = (*env)->GetStringUTFChars(env, method, NULL);
jmethodID methodId = (*env)->GetMethodID(env, cbinfo->cls, methodstr, signature);
(*env)->ReleaseStringUTFChars(env, method, methodstr);
if (methodId == NULL)
return NULL;
cbinfo->method = methodId;
// chain all structures to be deleted.
cbinfo->next = toDelete;
toDelete = cbinfo;
return cbinfo;
}
static void deleteCallback(struct CallbackInfo* cbinfo) {
if (cbinfo == NULL)
return;
JNIEnv* env;
if (cbinfo->env == NULL)
(*cbinfo->jvm)->AttachCurrentThread(cbinfo->jvm, (void**)&env, NULL);
else
env = cbinfo->env;
(*env)->DeleteGlobalRef(env, cbinfo->cls);
(*env)->DeleteGlobalRef(env, cbinfo->obj);
if (cbinfo->env == NULL)
(*cbinfo->jvm)->DetachCurrentThread(cbinfo->jvm);
free(cbinfo);
}
void commit_callback(void* callbackInfo, table_id tableid, const ddlog_record* rec, bool polarity) {
struct CallbackInfo* cbi = (struct CallbackInfo*)callbackInfo;
if (cbi == NULL || cbi->jvm == NULL)
return;
JNIEnv* env;
(*cbi->jvm)->AttachCurrentThreadAsDaemon(cbi->jvm, (void**)&env, NULL);
(*env)->CallVoidMethod(
env, cbi->obj, cbi->method, (jint)tableid, (jlong)rec, (jboolean)polarity);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1run(
JNIEnv *env, jobject obj, jboolean storeData, jint workers, jstring callback) {
if (workers <= 0)
workers = 1;
if (callback == NULL)
return (jlong)ddlog_run((unsigned)workers, storeData, NULL, 0, NULL);
struct CallbackInfo* cbinfo = createCallback(env, obj, callback, "(IJZ)V");
if (cbinfo == NULL)
return 0;
return (jlong)ddlog_run((unsigned)workers, storeData, commit_callback, (uintptr_t)cbinfo, NULL);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1record_1commands(
JNIEnv *env, jobject obj, jlong handle, jstring filename) {
int ret;
int fd;
const char *c_filename = (*env)->GetStringUTFChars(env, filename, NULL);
if (c_filename == NULL) {
return -1;
}
fd = open(c_filename, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
(*env)->ReleaseStringUTFChars(env, filename, c_filename);
if (fd < 0) {
return fd;
} else if ((ret = ddlog_record_commands((ddlog_prog)handle, fd))) {
close(fd);
return ret;
} else {
return fd;
}
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1stop_1recording(
JNIEnv *env, jobject obj, jlong handle, jint fd)
{
ddlog_record_commands((ddlog_prog)handle, -1);
close(fd);
return 0;
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1stop(
JNIEnv *env, jobject obj, jlong handle) {
struct CallbackInfo* current = toDelete;
while (current != NULL) {
struct CallbackInfo* next = current->next;
deleteCallback(current);
current = next;
}
toDelete = NULL;
return ddlog_stop((ddlog_prog)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1transaction_1start(
JNIEnv * env, jobject obj, jlong handle) {
return ddlog_transaction_start((ddlog_prog)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1transaction_1commit(
JNIEnv * env, jobject obj, jlong handle) {
return ddlog_transaction_commit((ddlog_prog)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1transaction_1commit_1dump_1changes(
JNIEnv * env, jobject obj, jlong handle, jstring callback) {
if (callback == NULL)
return ddlog_transaction_commit_dump_changes((ddlog_prog)handle, NULL, 0);
struct CallbackInfo* cbinfo = createCallback(env, obj, callback, "(IJZ)V");
if (cbinfo == NULL)
return -1;
return ddlog_transaction_commit_dump_changes((ddlog_prog)handle,
commit_callback,
(uintptr_t)cbinfo);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1transaction_1rollback(
JNIEnv * env, jobject obj, jlong handle) {
return ddlog_transaction_rollback((ddlog_prog)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1apply_1updates(
JNIEnv *env, jclass obj, jlong progHandle, jlongArray commandHandles) {
jlong *a = (*env)->GetLongArrayElements(env, commandHandles, NULL);
size_t size = (*env)->GetArrayLength(env, commandHandles);
ddlog_cmd** updates = malloc(sizeof(ddlog_cmd*) * size);
for (size_t i = 0; i < size; i++)
updates[i] = (ddlog_cmd*)a[i];
int result = ddlog_apply_updates(
(ddlog_prog)progHandle, updates, size);
(*env)->ReleaseLongArrayElements(env, commandHandles, a, 0);
free(updates);
return (jint)result;
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1table_1id(
JNIEnv *env, jclass class, jstring table) {
const char* tbl = (*env)->GetStringUTFChars(env, table, NULL);
table_id id = ddlog_get_table_id(tbl);
(*env)->ReleaseStringUTFChars(env, table, tbl);
return (jint)id;
}
bool dump_callback(uintptr_t callbackInfo, const ddlog_record* rec) {
struct CallbackInfo* cbi = (struct CallbackInfo*)callbackInfo;
JNIEnv* env = cbi->env;
assert(env);
jboolean result = (*env)->CallBooleanMethod(env, cbi->obj, cbi->method, (jlong)rec);
return (bool)result;
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_dump_1table(
JNIEnv *env, jobject obj, jlong progHandle, jint table, jstring callback) {
struct CallbackInfo* cbinfo = createCallback(env, obj, callback, "(J)Z");
if (cbinfo == NULL)
return -1;
cbinfo->env = env; // the dump_callback will be called on the same thread
int result = ddlog_dump_table((ddlog_prog)progHandle, table, dump_callback, (uintptr_t)cbinfo);
return (jint)result;
}
JNIEXPORT jstring JNICALL Java_ddlogapi_DDlogAPI_ddlog_1profile(
JNIEnv *env, jobject obj, jlong progHandle) {
char* profile = ddlog_profile((ddlog_prog)progHandle);
jstring result = (*env)->NewStringUTF(env, profile);
ddlog_string_free(profile);
return result;
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1enable_1cpu_1profiling(
JNIEnv *env, jobject obj, jlong progHandle, jboolean enable) {
return ddlog_enable_cpu_profiling((ddlog_prog)progHandle, enable);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1bool(
JNIEnv *env, jclass obj, jboolean b) {
return (jlong)ddlog_bool(b);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1u64(
JNIEnv *env, jclass obj, jlong l) {
return (jlong)ddlog_u64(l);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1u128(
JNIEnv *env, jclass obj, jlong hi, jlong lo) {
return (jlong)ddlog_u128((((__uint128_t)hi) << 64) | ((__uint128_t)lo));
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1string(
JNIEnv *env, jclass obj, jstring s) {
const char* str = (*env)->GetStringUTFChars(env, s, NULL);
ddlog_record* result = ddlog_string(str);
(*env)->ReleaseStringUTFChars(env, s, str);
return (jlong)result;
}
jlong create_from_vector(JNIEnv *env, jclass obj, jlongArray handles,
ddlog_record* (*creator)(ddlog_record** fields, size_t size)) {
jlong *a = (*env)->GetLongArrayElements(env, handles, NULL);
if (a == NULL)
return -1;
jsize len = (*env)->GetArrayLength(env, handles);
ddlog_record** fields = malloc(len * sizeof(ddlog_record*));
for (size_t i = 0; i < len; i++)
fields[i] = (ddlog_record*)a[i];
ddlog_record* result = creator(fields, (size_t)len);
(*env)->ReleaseLongArrayElements(env, handles, a, 0);
free(fields);
return (jlong)result;
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1tuple(
JNIEnv *env, jclass obj, jlongArray handles) {
return create_from_vector(env, obj, handles, ddlog_tuple);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1vector(
JNIEnv *env, jclass obj, jlongArray handles) {
return create_from_vector(env, obj, handles, ddlog_vector);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1set(
JNIEnv *env, jclass obj, jlongArray handles) {
return create_from_vector(env, obj, handles, ddlog_set);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1map(
JNIEnv *env, jclass obj, jlongArray handles) {
return create_from_vector(env, obj, handles, ddlog_map);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1pair(
JNIEnv *env, jclass obj, jlong h1, jlong h2) {
return (jlong)ddlog_pair((ddlog_record*)h1, (ddlog_record*)h2);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1struct(
JNIEnv *env, jclass obj, jstring s, jlongArray handles) {
const char* str = (*env)->GetStringUTFChars(env, s, NULL);
jsize len = (*env)->GetArrayLength(env, handles);
jlong *a = (*env)->GetLongArrayElements(env, handles, NULL);
if (a == NULL)
return -1;
ddlog_record** fields = malloc(len * sizeof(ddlog_record*));
for (size_t i = 0; i < len; i++)
fields[i] = (ddlog_record*)a[i];
ddlog_record* result = ddlog_struct(str, fields, len);
(*env)->ReleaseLongArrayElements(env, handles, a, 0);
free(fields);
(*env)->ReleaseStringUTFChars(env, s, str);
return (jlong)result;
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1bool(
JNIEnv *env, jclass obj, jlong handle) {
return (jboolean)ddlog_is_bool((ddlog_record*)handle);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1bool(
JNIEnv *env, jclass obj, jlong handle) {
return (jboolean)ddlog_get_bool((ddlog_record*)handle);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1int(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_int((ddlog_record*)handle);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1u64(
JNIEnv *env, jclass obj, long handle) {
return (jlong)ddlog_get_u64((ddlog_record*)handle);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1u128(
JNIEnv *env, jclass obj, long handle, jlongArray data) {
__uint128_t value = ddlog_get_u128((ddlog_record*)handle);
jlong *a = (*env)->GetLongArrayElements(env, data, NULL);
if (a == NULL)
return false;
a[0] = (jlong)value;
a[1] = (jlong)(value >> 64);
(*env)->ReleaseLongArrayElements(env, data, a, 0);
return true;
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1string(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_string((ddlog_record*)handle);
}
const jstring toJString(JNIEnv* env, const char* nonNullStr, size_t size) {
char* buf = malloc(size + 1);
strncpy(buf, nonNullStr, size);
buf[size] = 0;
jstring result = (*env)->NewStringUTF(env, buf);
free(buf);
return result;
}
JNIEXPORT jstring JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1str(
JNIEnv *env, jclass obj, long handle) {
const char *s = ddlog_get_str_non_nul((const ddlog_record*)handle);
size_t size = ddlog_get_strlen((const ddlog_record*)handle);
return toJString(env, s, size);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1tuple(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_tuple((ddlog_record*)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1tuple_1size(
JNIEnv *env, jclass obj, long handle) {
return (jint)ddlog_get_tuple_size((ddlog_record*)handle);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1tuple_1field(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_tuple_field((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1vector(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_vector((ddlog_record*)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1vector_1size(
JNIEnv *env, jclass obj, long handle) {
return (jint)ddlog_get_vector_size((ddlog_record*)handle);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1vector_1elem(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_vector_elem((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1set(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_set((ddlog_record*)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1set_1size(
JNIEnv *env, jclass obj, long handle) {
return (jint)ddlog_get_set_size((ddlog_record*)handle);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1set_1elem(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_set_elem((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1map(
JNIEnv *env, jclass obj, long handle) {
return (jboolean)ddlog_is_map((ddlog_record*)handle);
}
JNIEXPORT jint JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1map_1size(
JNIEnv *env, jclass obj, long handle) {
return (jint)ddlog_get_map_size((ddlog_record*)handle);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1map_1key(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_map_key((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1map_1val(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_map_val((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jboolean JNICALL Java_ddlogapi_DDlogAPI_ddlog_1is_1struct(
JNIEnv *env, jclass obj, jlong handle) {
return (jboolean)ddlog_is_struct((ddlog_record*)handle);
}
JNIEXPORT jstring JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1constructor(
JNIEnv *env, jclass obj, jlong handle) {
size_t size;
const char *s = ddlog_get_constructor_non_null((const ddlog_record*)handle, &size);
return toJString(env, s, size);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1get_1struct_1field(
JNIEnv *env, jclass obj, jlong handle, jint index) {
return (jlong)ddlog_get_struct_field((ddlog_record*)handle, (size_t)index);
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1insert_1cmd(
JNIEnv *env, jclass obj, jint table, jlong handle) {
ddlog_cmd* result = ddlog_insert_cmd(table, (ddlog_record*)handle);
return (jlong)result;
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1delete_1val_1cmd(
JNIEnv *env, jclass obj, jint table, jlong handle) {
ddlog_cmd* result = ddlog_delete_val_cmd(table, (ddlog_record*)handle);
return (jlong)result;
}
JNIEXPORT jlong JNICALL Java_ddlogapi_DDlogAPI_ddlog_1delete_1key_1cmd(
JNIEnv *env, jclass obj, jint table, jlong handle) {
ddlog_cmd* result = ddlog_delete_key_cmd(table, (ddlog_record*)handle);
return (jlong)result;
}
| 36.440678 | 109 | 0.714593 |
17acd7a17f277b8e7b3f89a4221514a31ce72519 | 10,619 | c | C | app/src/main/jni/etzwallet-core/ethereum/les/BREthereumNode.c | etherzero-org/ETZ-Android | f6229e6625965509a54a3c2d504b344f8ca4bf66 | [
"MIT"
] | 2 | 2018-12-27T02:10:46.000Z | 2021-06-28T07:45:55.000Z | app/src/main/jni/etzwallet-core/ethereum/les/BREthereumNode.c | etherzero-org/ETZ-Android | f6229e6625965509a54a3c2d504b344f8ca4bf66 | [
"MIT"
] | null | null | null | app/src/main/jni/etzwallet-core/ethereum/les/BREthereumNode.c | etherzero-org/ETZ-Android | f6229e6625965509a54a3c2d504b344f8ca4bf66 | [
"MIT"
] | 8 | 2018-08-01T20:58:59.000Z | 2021-01-11T08:16:41.000Z | //
// BREthereumNode.c
// etzwallet-core Ethereum
//
// Created by Lamont Samuels on 3/10/2018.
// Copyright (c) 2018 etzwallet LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <string.h>
#include "BREthereumNode.h"
#include "BREthereumHandshake.h"
#include "BREthereumBase.h"
#include "BRKey.h"
#define PTHREAD_STACK_SIZE (512 * 1024)
#define CONNECTION_TIME 3.0
#define DEFAULT_LES_PORT 30303
/**
* BREthereumNodeContext - holds information about the client les node
*/
typedef struct {
//The peer information for this node
BREthereumPeer peer;
//The public identifier for a node
UInt512 id;
//The Key for for a node
BRKey key;
//The current connection status of a node
BREthereumNodeStatus status;
//The handshake context
BREthereumHandShake handshake;
//The thread representing this node
pthread_t thread;
//Lock to handle shared resources in the node
pthread_mutex_t lock;
//Represents whether this ndoe should start the handshake or wait for auth
BREthereumBoolean shouldOriginate;
}BREthereumNodeContext;
/**** Private functions ****/
static BREthereumBoolean _isAddressIPv4(UInt128 address);
static int _openEtheruemPeerSocket(BREthereumNode node, int domain, double timeout, int *error);
static void _updateStatus(BREthereumNodeContext * node, BREthereumNodeStatus status);
static void *_nodeThreadRunFunc(void *arg);
/**
* Note: This function is a direct copy of Aaron's _BRPeerOpenSocket function with a few modifications to
* work for the Ethereum Core.
* TODO: May want to make this more modular to work for both etheruem and bitcoin
*/
static int _openEtheruemPeerSocket(BREthereumNode node, int domain, double timeout, int *error)
{
BREthereumNodeContext * cxt = (BREthereumNodeContext *)node;
BREthereumPeer * peerCtx = &cxt->peer;
struct sockaddr_storage addr;
struct timeval tv;
fd_set fds;
socklen_t addrLen, optLen;
int count, arg = 0, err = 0, on = 1, r = 1;
peerCtx->socket = socket(domain, SOCK_STREAM, 0);
if (peerCtx->socket < 0) {
err = errno;
r = 0;
}
else {
tv.tv_sec = 1; // one second timeout for send/receive, so thread doesn't block for too long
tv.tv_usec = 0;
setsockopt(peerCtx->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(peerCtx->socket, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
setsockopt(peerCtx->socket, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
#ifdef SO_NOSIGPIPE // BSD based systems have a SO_NOSIGPIPE socket option to supress SIGPIPE signals
setsockopt(peerCtx->socket, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));
#endif
arg = fcntl(peerCtx->socket, F_GETFL, NULL);
if (arg < 0 || fcntl(peerCtx->socket, F_SETFL, arg | O_NONBLOCK) < 0) r = 0; // temporarily set socket non-blocking
if (! r) err = errno;
}
if (r) {
memset(&addr, 0, sizeof(addr));
if (domain == PF_INET6) {
((struct sockaddr_in6 *)&addr)->sin6_family = AF_INET6;
((struct sockaddr_in6 *)&addr)->sin6_addr = *(struct in6_addr *)&peerCtx->address;
((struct sockaddr_in6 *)&addr)->sin6_port = htons(peerCtx->port);
addrLen = sizeof(struct sockaddr_in6);
}
else {
((struct sockaddr_in *)&addr)->sin_family = AF_INET;
((struct sockaddr_in *)&addr)->sin_addr = *(struct in_addr *)&peerCtx->address.u32[3];
((struct sockaddr_in *)&addr)->sin_port = htons(peerCtx->port);
addrLen = sizeof(struct sockaddr_in);
}
if (connect(peerCtx->socket, (struct sockaddr *)&addr, addrLen) < 0) err = errno;
if (err == EINPROGRESS) {
err = 0;
optLen = sizeof(err);
tv.tv_sec = timeout;
tv.tv_usec = (long)(timeout*1000000) % 1000000;
FD_ZERO(&fds);
FD_SET(peerCtx->socket, &fds);
count = select(peerCtx->socket + 1, NULL, &fds, NULL, &tv);
if (count <= 0 || getsockopt(peerCtx->socket, SOL_SOCKET, SO_ERROR, &err, &optLen) < 0 || err) {
if (count == 0) err = ETIMEDOUT;
if (count < 0 || ! err) err = errno;
r = 0;
}
}
else if (err && domain == PF_INET6 && ETHEREUM_BOOLEAN_IS_TRUE(_isAddressIPv4(peerCtx->address))) {
return _openEtheruemPeerSocket(node, PF_INET, timeout, error); // fallback to IPv4
}
else if (err) r = 0;
if (r) {
bre_peer_log(peerCtx, "ethereum socket connected");
}
fcntl(peerCtx->socket, F_SETFL, arg); // restore socket non-blocking status
}
if (! r && err) {
bre_peer_log(peerCtx, "ethereum connect error: %s", strerror(err));
}
if (error && err) *error = err;
return r;
}
/**
* This is the theard run functions for an ethereum function. This function is called
* when a node needs to begin connecting to a remote peer and start sending messages to the
* remote node.
*/
static void *_nodeThreadRunFunc(void *arg) {
BREthereumNodeContext * ctx = (BREthereumNodeContext *)arg;
while(ctx->status != BRE_NODE_DISCONNECTED)
{
switch (ctx->status) {
case BRE_NODE_DISCONNECTED:
{
continue;
}
break;
case BRE_NODE_CONNECTING:
{
// ctx->handshake = ethereumHandshakeCreate(&ctx->peer, &ctx->key, ctx->shouldOriginate);
ctx->status = BRE_NODE_PERFORMING_HANDSHAKE;
}
break;
case BRE_NODE_PERFORMING_HANDSHAKE:
{
if(ethereumHandshakeTransition(ctx->handshake) == BRE_HANDSHAKE_FINISHED) {
ctx->status = BRE_NODE_CONNECTED;
ethereumHandshakeFree(ctx->handshake);
}
}
break;
case BRE_NODE_CONNECTED:
{
//TODO: Read back messages from the remote peer
}
break;
default:
break;
}
}
return NULL;
}
static BREthereumBoolean _isAddressIPv4(UInt128 address)
{
return (address.u64[0] == 0 && address.u16[4] == 0 && address.u16[5] == 0xffff) ? ETHEREUM_BOOLEAN_TRUE : ETHEREUM_BOOLEAN_FALSE;
}
/*** Public functions ***/
BREthereumNode ethereumNodeCreate(BREthereumPeer peer, BREthereumBoolean originate) {
BREthereumNodeContext * node = calloc (1, sizeof(*node));
node->status = BRE_NODE_DISCONNECTED;
node->peer.address = peer.address;
node->peer.port = peer.port;
node->peer.socket = peer.socket;
node->peer.remoteId = peer.remoteId;
node->handshake = NULL;
node->shouldOriginate = originate;
strncpy(node->peer.host, peer.host, sizeof(peer.host));
node->id = UINT512_ZERO;
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&node->lock, &attr);
pthread_mutexattr_destroy(&attr);
}
return (BREthereumNode)node;
}
void ethereumNodeConnect(BREthereumNode node) {
BREthereumNodeContext *ctx = (BREthereumNodeContext *)node;
int error = 0;
pthread_attr_t attr;
if(_openEtheruemPeerSocket(node, PF_INET6, CONNECTION_TIME, &error)) {
if (ctx->status == BRE_NODE_DISCONNECTED) {
ctx->status = BRE_NODE_CONNECTING;
if (pthread_attr_init(&attr) != 0) {
error = ENOMEM;
bre_peer_log(&ctx->peer, "error creating thread");
ctx->status = BRE_NODE_DISCONNECTED;
}
else if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0 ||
pthread_attr_setstacksize(&attr, PTHREAD_STACK_SIZE) != 0 ||
pthread_create(&ctx->thread, &attr, _nodeThreadRunFunc, node) != 0) {
error = EAGAIN;
bre_peer_log(&ctx->peer, "error creating thread");
pthread_attr_destroy(&attr);
ctx->status = BRE_NODE_DISCONNECTED;
}
}
}
}
BREthereumNodeStatus ethereumNodeStatus(BREthereumNode node){
BREthereumNodeContext *ctx = (BREthereumNodeContext *)node;
return ctx->status;
}
void ethereumNodeDisconnect(BREthereumNode node) {
BREthereumNodeContext *ctx = (BREthereumNodeContext *)node;
ctx->status = BRE_NODE_DISCONNECTED;
int socket = ctx->peer.socket;
if (socket >= 0) {
ctx->peer.socket = -1;
if (shutdown(socket, SHUT_RDWR) < 0){
bre_peer_log(&ctx->peer, "%s", strerror(errno));
}
close(socket);
}
}
void ethereumNodeFree(BREthereumNode node) {
BREthereumNodeContext *ctx = (BREthereumNodeContext *)node;
free(ctx);
}
const char * ethereumPeerGetHost(BREthereumPeer* peer){
if( peer->host[0] == '\0') {
if (ETHEREUM_BOOLEAN_IS_TRUE(_isAddressIPv4(peer->address))) {
inet_ntop(AF_INET, &peer->address.u32[3], peer->host, sizeof(peer->host));
}else {
inet_ntop(AF_INET6, &peer->address, peer->host, sizeof(peer->host));
}
}
return peer->host;
}
| 34.816393 | 133 | 0.630285 |
17fdf72774e85eaf6b8939ddd21ae35caae6decd | 2,673 | c | C | orte/mca/filem/raw/filem_raw_component.c | Slbomber/ompi | 4d1559e03c5a193454f5df517ef2ab295f3c424f | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | orte/mca/filem/raw/filem_raw_component.c | Slbomber/ompi | 4d1559e03c5a193454f5df517ef2ab295f3c424f | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | orte/mca/filem/raw/filem_raw_component.c | Slbomber/ompi | 4d1559e03c5a193454f5df517ef2ab295f3c424f | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "opal/util/output.h"
#include "orte/constants.h"
#include "orte/mca/filem/filem.h"
#include "orte/mca/filem/base/base.h"
#include "filem_raw.h"
/*
* Public string for version number
*/
const char *orte_filem_raw_component_version_string =
"ORTE FILEM raw MCA component version " ORTE_VERSION;
/*
* Local functionality
*/
static int filem_raw_register(void);
static int filem_raw_open(void);
static int filem_raw_close(void);
static int filem_raw_query(mca_base_module_t **module, int *priority);
bool orte_filem_raw_flatten_trees=false;
orte_filem_base_component_t mca_filem_raw_component = {
.base_version = {
ORTE_FILEM_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "raw",
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = filem_raw_open,
.mca_close_component = filem_raw_close,
.mca_query_component = filem_raw_query,
.mca_register_component_params = filem_raw_register,
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
};
static int filem_raw_register(void)
{
mca_base_component_t *c = &mca_filem_raw_component.base_version;
orte_filem_raw_flatten_trees = false;
(void) mca_base_component_var_register(c, "flatten_directory_trees",
"Put all files in the working directory instead of creating their respective directory trees",
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&orte_filem_raw_flatten_trees);
return ORTE_SUCCESS;
}
static int filem_raw_open(void)
{
return ORTE_SUCCESS;
}
static int filem_raw_close(void)
{
return ORTE_SUCCESS;
}
static int filem_raw_query(mca_base_module_t **module, int *priority)
{
*priority = 0;
/* never for an APP */
if (ORTE_PROC_IS_APP) {
*module = NULL;
return ORTE_ERROR;
}
/* otherwise, use if selected */
*module = (mca_base_module_t*) &mca_filem_raw_module;
return ORTE_SUCCESS;
}
| 27.556701 | 137 | 0.648335 |
9df7e75b9089b81c62ad53bac108c4d3897d758b | 531 | h | C | include/GameLoop.h | hyark/wx2dGame | 615bc0543aedb9493103968b0932e982aa6f5e32 | [
"Apache-2.0"
] | 5 | 2019-12-18T15:49:05.000Z | 2020-08-14T23:57:42.000Z | include/GameLoop.h | hyark/wx2dGame | 615bc0543aedb9493103968b0932e982aa6f5e32 | [
"Apache-2.0"
] | null | null | null | include/GameLoop.h | hyark/wx2dGame | 615bc0543aedb9493103968b0932e982aa6f5e32 | [
"Apache-2.0"
] | null | null | null | #ifndef GAMELOOP_H
#define GAMELOOP_H
#include <wx/thread.h>
#include <wx/msgdlg.h>
#include <wx/app.h>
#define TICKS_PER_SECOND 60
class GameLoop : public wxThread
{
public:
GameLoop();
virtual void tick() = 0;
void* Entry() override;
bool IsStarted() const { return m_Started; }
int GetElapsedTicks() const { return m_ElapsedTicks; }
protected:
wxApp& m_App = wxGetApp();
bool m_Started = false;
int m_ElapsedTicks = 0;
};
#endif // GAMELOOP_H
| 18.310345 | 62 | 0.619586 |
1734c12cf2ef572c3aee2c8df3cd3e783549b6e7 | 235 | c | C | tests/errors/target.c | swils/verifast | b0bdb6b5bb49cb6a6ae5457e703ee3eea9f3463e | [
"MIT"
] | 272 | 2016-01-28T16:01:28.000Z | 2022-03-10T11:53:19.000Z | tests/errors/target.c | swils/verifast | b0bdb6b5bb49cb6a6ae5457e703ee3eea9f3463e | [
"MIT"
] | 207 | 2016-01-28T16:03:17.000Z | 2022-03-11T14:38:58.000Z | tests/errors/target.c | swils/verifast | b0bdb6b5bb49cb6a6ae5457e703ee3eea9f3463e | [
"MIT"
] | 59 | 2016-04-03T17:52:17.000Z | 2022-01-28T11:35:57.000Z | #include <assert.h>
void foo()
//@ requires true;
//@ ensures true;
{
assert(sizeof(int) == 4 || sizeof(void *) == 4); //~should_fail
}
void bar()
//@ requires true;
//@ ensures true;
{
assert(sizeof(long) == 4); //~should_fail
} | 15.666667 | 65 | 0.595745 |
c0e0b3effbfc19eafffeed8c0cbf8d91567cd7ff | 835 | h | C | src/modules/command.h | bartobri/spring-server | 5321335ac945a82250d335ed68177ad8ebbbb776 | [
"MIT"
] | 80 | 2016-09-26T13:39:38.000Z | 2021-09-04T16:04:31.000Z | src/modules/command.h | bartobri/SPCServer | 5321335ac945a82250d335ed68177ad8ebbbb776 | [
"MIT"
] | null | null | null | src/modules/command.h | bartobri/SPCServer | 5321335ac945a82250d335ed68177ad8ebbbb776 | [
"MIT"
] | 8 | 2016-09-26T13:52:01.000Z | 2019-07-09T22:33:56.000Z | // Copyright (c) 2017 Brian Barto
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the MIT License. See LICENSE for more details.
#ifndef COMMAND_H
#define COMMAND_H 1
/*
* These symbolic constants define the parameters and the return value for
* functions executed in response to a given command.
*/
#define COMMAND_PARAMS int socket, char *payload
#define COMMAND_RETURN void
/*
* Define a data type for a function pointer whos paramaters are
* COMMAND_PARAMS and return value is COMMAND_RETURN.
*/
typedef COMMAND_RETURN (*comFunctionType)(COMMAND_PARAMS);
/*
* Function Declarations
*/
void command_init(void);
void command_add(char *, comFunctionType);
int command_exists(char *command);
void command_exec(char *command, char *payload, int socket);
#endif
| 26.935484 | 74 | 0.755689 |
a55496dd9254f6ebb3e02647b817b47103386f9e | 1,976 | h | C | src/prod/src/ServiceModel/naming/ServiceNotificationPageId.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/ServiceModel/naming/ServiceNotificationPageId.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/ServiceModel/naming/ServiceNotificationPageId.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Naming
{
class ServiceNotificationPageId : public Serialization::FabricSerializable
{
public:
struct Hasher
{
size_t operator() (ServiceNotificationPageId const & key) const
{
return key.NotificationId.Guid.GetHashCode() + key.NotificationId.Index + key.pageIndex_;
}
bool operator() (ServiceNotificationPageId const & left, ServiceNotificationPageId const & right) const
{
return (left == right);
}
};
public:
ServiceNotificationPageId();
ServiceNotificationPageId(
Common::ActivityId const & notificationId,
uint64 pageIndex);
__declspec (property(get=get_NotificationId)) Common::ActivityId const & NotificationId;
Common::ActivityId const & get_NotificationId() const { return notificationId_; }
__declspec (property(get=get_PageIndex)) uint64 PageIndex;
uint64 get_PageIndex() const { return pageIndex_; }
bool operator < (ServiceNotificationPageId const & other) const;
bool operator == (ServiceNotificationPageId const & other) const;
bool operator != (ServiceNotificationPageId const & other) const;
void WriteTo(Common::TextWriter& w, Common::FormatOptions const& f) const;
static std::string AddField(Common::TraceEvent & traceEvent, std::string const & name);
void FillEventData(Common::TraceEventContext & context) const;
FABRIC_FIELDS_02(notificationId_, pageIndex_);
private:
Common::ActivityId notificationId_;
uint64 pageIndex_;
};
}
| 37.283019 | 116 | 0.617915 |
a010ce8e4558c1885e47a9ce26ce45a8afc16871 | 4,515 | h | C | Hoverboard/HUGS/Inc/defines.h | gearsincorg/Hoverboards-for-assistive-devices | 8bc73dd2c7654954ac699d921fa1de044737fdd3 | [
"MIT"
] | 8 | 2020-08-24T19:17:27.000Z | 2022-02-02T00:42:43.000Z | Hoverboard/HUGS/Inc/defines.h | gearsincorg/Hoverboards-for-assistive-devices | 8bc73dd2c7654954ac699d921fa1de044737fdd3 | [
"MIT"
] | 4 | 2021-01-24T00:24:29.000Z | 2021-08-02T02:39:28.000Z | Hoverboard/HUGS/Inc/defines.h | gearsincorg/Hoverboards-for-assistive-devices | 8bc73dd2c7654954ac699d921fa1de044737fdd3 | [
"MIT"
] | 3 | 2021-03-16T13:28:25.000Z | 2021-11-10T23:23:23.000Z | /*
* This file is part of the Hoverboard Utility Gateway System (HUGS) project.
*
* The HUGS project goal is to enable Hoverboards, or Hoverboard drive components
* to be re-purposed to provide low-cost mobility to other systems, such
* as assistive devices for the disabled, general purpose robots or other
* labor saving devices.
*
* Copyright (C) 2020 Phil Malone
* Copyright (C) 2018 Florian Staeblein
* Copyright (C) 2018 Jakob Broemauer
* Copyright (C) 2018 Kai Liebich
* Copyright (C) 2018 Christoph Lehnert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef DEFINES_H
#define DEFINES_H
#include "gd32f1x0.h"
#include "../Inc/config.h"
// LED defines
#define LED_GREEN GPIO_PIN_15
#define LED_GREEN_PORT GPIOA
#define LED_ORANGE GPIO_PIN_12
#define LED_ORANGE_PORT GPIOA
#define LED_RED GPIO_PIN_3
#define LED_RED_PORT GPIOB
#define UPPER_LED_PIN GPIO_PIN_1
#define UPPER_LED_PORT GPIOA
#define LOWER_LED_PIN GPIO_PIN_0
#define LOWER_LED_PORT GPIOA
// Mosfet output
#define MOSFET_OUT_PIN GPIO_PIN_13
#define MOSFET_OUT_PORT GPIOC
// Brushless Control DC (BLDC) defines
// Channel G
#define RCU_TIMER_BLDC RCU_TIMER0
#define TIMER_BLDC TIMER0
#define TIMER_BLDC_CHANNEL_G TIMER_CH_2
#define TIMER_BLDC_GH_PIN GPIO_PIN_10
#define TIMER_BLDC_GH_PORT GPIOA
#define TIMER_BLDC_GL_PIN GPIO_PIN_15
#define TIMER_BLDC_GL_PORT GPIOB
// Channel B
#define TIMER_BLDC_CHANNEL_B TIMER_CH_1
#define TIMER_BLDC_BH_PIN GPIO_PIN_9
#define TIMER_BLDC_BH_PORT GPIOA
#define TIMER_BLDC_BL_PIN GPIO_PIN_14
#define TIMER_BLDC_BL_PORT GPIOB
// Channel Y
#define TIMER_BLDC_CHANNEL_Y TIMER_CH_0
#define TIMER_BLDC_YH_PIN GPIO_PIN_8
#define TIMER_BLDC_YH_PORT GPIOA
#define TIMER_BLDC_YL_PIN GPIO_PIN_13
#define TIMER_BLDC_YL_PORT GPIOB
// Timer BLDC short circuit emergency shutoff define
#define TIMER_BLDC_EMERGENCY_SHUTDOWN_PIN GPIO_PIN_12
#define TIMER_BLDC_EMERGENCY_SHUTDOWN_PORT GPIOB
// Hall sensor defines
#define HALL_A_PIN GPIO_PIN_11
#define HALL_A_PORT GPIOB
#define HALL_B_PIN GPIO_PIN_1
#define HALL_B_PORT GPIOF
#define HALL_C_PIN GPIO_PIN_14
#define HALL_C_PORT GPIOC
// Usart HUGS defines
#define USART_HUGS USART1
#define USART_HUGS_TX_PIN GPIO_PIN_2
#define USART_HUGS_TX_PORT GPIOA
#define USART_HUGS_RX_PIN GPIO_PIN_3
#define USART_HUGS_RX_PORT GPIOA
// ADC defines
#define VBATT_PIN GPIO_PIN_4
#define VBATT_PORT GPIOA
#define VBATT_CHANNEL ADC_CHANNEL_4
#define CURRENT_DC_PIN GPIO_PIN_6
#define CURRENT_DC_PORT GPIOA
#define CURRENT_DC_CHANNEL ADC_CHANNEL_6
// Self hold defines
#define SELF_HOLD_PIN GPIO_PIN_2
#define SELF_HOLD_PORT GPIOB
// Button defines
#define BUTTON_PIN GPIO_PIN_15
#define BUTTON_PORT GPIOC
// Usart steer defines
#define USART_STEER_COM USART0
#define USART_STEER_COM_TX_PIN GPIO_PIN_6
#define USART_STEER_COM_TX_PORT GPIOB
#define USART_STEER_COM_RX_PIN GPIO_PIN_7
#define USART_STEER_COM_RX_PORT GPIOB
// Buzzer defins
#define BUZZER_PIN GPIO_PIN_10
#define BUZZER_PORT GPIOB
// Charge state defines
#define CHARGE_STATE_PIN GPIO_PIN_0
#define CHARGE_STATE_PORT GPIOF
#endif
// Debug pin defines
#define DEBUG_PIN GPIO_PIN_4
#define DEBUG_PORT GPIOB
// ADC value conversion defines
#define MOTOR_AMP_CONV_DC_AMP 0.2015 // 3,3V * 1/3 - 0,004Ohm * IL(ampere) = (ADC-Data/4095) *3,3v
#define MOTOR_AMP_CONV_DC_MICRO_AMP 201500 // 3,3V * 1/3 - 0,004Ohm * IL(u ampere) = (ADC-Data/4095) *3,3V * 1000000
#define ADC_BATTERY_VOLT 0.02417 // V_Batt to V_BattMeasure = factor 30: ( (ADC-Data/4095) *3,3V *30 )
#define ADC_BATTERY_MICRO_VOLT 24170 // V_Batt to V_BattMeasure = factor 30: ( (ADC-Data/4095) *3,3V * 30 * 1000000 )
// Useful math function defines
#define ABS(a) (((a) < 0.0) ? -(a) : (a))
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define MAX(x, high) (((x) > (high)) ? (high) : (x))
#define MAP(x, xMin, xMax, yMin, yMax) ((x - xMin) * (yMax - yMin) / (xMax - xMin) + yMin)
// ADC buffer struct
typedef struct
{
uint16_t v_batt;
uint16_t current_dc;
} adc_buf_t;
void resetInactivityTimer(void);
| 30.506757 | 130 | 0.778073 |
c44dea45f191b8376e08bf06faecb39f8de7ebf1 | 67 | h | C | Voidfall/ECS/Components/Colour.h | Ticou93/Voidfall | 6b2d8d99ac555b1097b28b86bd16e5c9ccedf34f | [
"MIT"
] | null | null | null | Voidfall/ECS/Components/Colour.h | Ticou93/Voidfall | 6b2d8d99ac555b1097b28b86bd16e5c9ccedf34f | [
"MIT"
] | 4 | 2020-04-26T20:37:48.000Z | 2020-05-14T07:42:33.000Z | Voidfall/ECS/Components/Colour.h | Ticou93/Voidfall | 6b2d8d99ac555b1097b28b86bd16e5c9ccedf34f | [
"MIT"
] | null | null | null | #pragma once
#include <cstdint>
struct Colour {
float colour;
};
| 9.571429 | 18 | 0.701493 |
b9ef6bf9fc4792f308b41255b07e78782da329f8 | 113 | c | C | os/OS/lab4/writeex.c | EgorBolt/studying | d279e1c4aebcf5ec852d577159ac94cfafd17cae | [
"MIT"
] | null | null | null | os/OS/lab4/writeex.c | EgorBolt/studying | d279e1c4aebcf5ec852d577159ac94cfafd17cae | [
"MIT"
] | null | null | null | os/OS/lab4/writeex.c | EgorBolt/studying | d279e1c4aebcf5ec852d577159ac94cfafd17cae | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <unistd.h>
int main() {
char i = 'a';
write(STDOUT_FILENO, &i, 1);
return 0;
}
| 10.272727 | 29 | 0.59292 |
ac715449c7290dacf268905415b7fac6b0596cec | 616 | c | C | src/lrc_check.c | ibmibmibm/liblyric | 945bde0a48f9ba575a08888549daef28912de246 | [
"WTFPL"
] | null | null | null | src/lrc_check.c | ibmibmibm/liblyric | 945bde0a48f9ba575a08888549daef28912de246 | [
"WTFPL"
] | null | null | null | src/lrc_check.c | ibmibmibm/liblyric | 945bde0a48f9ba575a08888549daef28912de246 | [
"WTFPL"
] | null | null | null | #include <stdio.h>
#include <errno.h>
#include <lyric.h>
static int usage(const char *program_name) {
if (errno != 0) {
perror(program_name);
}
fprintf(stderr, "usage: %s filename.\n", program_name);
return 0;
}
int main(int argc, const char *argv[]) {
FILE *file;
Lyric *lyric;
if (argc != 2) {
return usage(argv[0]);
}
file = fopen(argv[1], "r");
lyric = lyric_read_lrc_file(file);
if (lyric == NULL) {
return usage(argv[0]);
}
lyric_write_file(lyric, stdout);
lyric_lyric_delete(lyric);
return 0;
}
// vim:ts=4 sts=4 sw=4 et
| 19.870968 | 59 | 0.579545 |
5909769b6bb51b0ff97dee521b0c778bb9b28587 | 544 | c | C | Chapter9/chap9_14_alt.c | Capella87/CPractice | 1ce8c3b1a0ce2477df7a776db3ed0fb9bf6a1e34 | [
"Unlicense"
] | 2 | 2020-05-14T17:15:27.000Z | 2020-11-11T15:50:26.000Z | Chapter9/chap9_14_alt.c | Capella87/CPractice | 1ce8c3b1a0ce2477df7a776db3ed0fb9bf6a1e34 | [
"Unlicense"
] | null | null | null | Chapter9/chap9_14_alt.c | Capella87/CPractice | 1ce8c3b1a0ce2477df7a776db3ed0fb9bf6a1e34 | [
"Unlicense"
] | null | null | null | #include <stdio.h>
int add_to_k(int*, int*);
int main(void) // code with two static variables in add_to_k()
{
int d[100];
int n, total = 0;
int* pos = d;
scanf("%d", &n);
for (; pos < d + n; pos++)
{
scanf("%d", pos);
if (pos == d + n - 1)
total = add_to_k(d, pos);
else add_to_k(d, pos);
}
printf("%d\n", total);
return 0;
}
int add_to_k(int* a, int* b)
{
static int total = 0;
static int b4 = 0;
total += b4 + *b;
b4 += *b;
return total;
}
| 16.484848 | 62 | 0.472426 |
df45b54d1a76274d033d3c64d9ed8050b4e3cd65 | 9,247 | c | C | handlers/auth/handle_login.c | sunqingyao/kernod | ff54b80aac406b0998c268a9dabb85366eb895bc | [
"MIT"
] | 1 | 2020-07-02T18:32:19.000Z | 2020-07-02T18:32:19.000Z | handlers/auth/handle_login.c | sunqingyao/kernod | ff54b80aac406b0998c268a9dabb85366eb895bc | [
"MIT"
] | 1 | 2020-08-27T08:13:52.000Z | 2020-08-27T08:13:52.000Z | handlers/auth/handle_login.c | nalzok/kernod | ff54b80aac406b0998c268a9dabb85366eb895bc | [
"MIT"
] | null | null | null | //
// Created by 孙庆耀 on 2018/7/10.
//
#include "handle_login.h"
#include "../../utils/utils.h"
#include "../../config.h"
#include <ksql.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
enum login_state {
LOGIN_SUCCESS,
LOGIN_SUCCESS_BUT_REHASH_FAILURE,
LOGIN_FAILURE,
};
enum rehash_state {
REHASH_SUCCESS,
REHASH_FAILURE,
};
enum login_stmt {
STMT_SELECT_ID_PASSWORD,
STMT_UPDATE_PASSWORD,
STMT__MAX
};
static const char *const stmts[STMT__MAX] = {
"SELECT user_id, password FROM users "
"WHERE username = ?",
"UPDATE users SET password = ? "
"WHERE username = ?",
};
static void insert_login_form(struct khtmlreq *htmlreq);
static enum login_state process_login_form(struct kreq *req);
static enum rehash_state rehash_password(struct ksql *sql, const char *username, const char *password);
extern enum khttp handle_login(struct kreq *req) {
struct khtmlreq *htmlreq = NULL;
switch (req->method) {
case KMETHOD_GET:
htmlreq = html_resp_alloc(req, KHTTP_200, "log in");
khtml_elem(htmlreq, KELEM_H1);
khtml_puts(htmlreq, "Login to continue");
khtml_closeelem(htmlreq, 1);
const struct user_t *user = current_user();
if (user != NULL) {
khtml_elem(htmlreq, KELEM_I);
khtml_puts(htmlreq, "You are already logged in as ");
khtml_puts(htmlreq, user->username);
khtml_closeelem(htmlreq, 1);
}
insert_login_form(htmlreq);
khtml_attr(htmlreq, KELEM_A,
KATTR_HREF, pages[PAGE_REGISTER],
KATTR__MAX);
khtml_puts(htmlreq, "Don't have an account? Join now!");
khtml_closeelem(htmlreq, 1);
free_html_resp(htmlreq);
khttp_free(req);
return KHTTP_200;
case KMETHOD_POST:
/* Post/Redirect/Get pattern */
if (process_login_form(req) == LOGIN_SUCCESS) {
redirect_resp(req, pages[PAGE_INDEX]);
} else {
redirect_resp(req, pages[PAGE_LOGIN]);
}
return KHTTP_303;
default:
status_only_resp(req, KHTTP_405);
return KHTTP_405;
}
}
static void insert_login_form(struct khtmlreq *htmlreq) {
size_t pos = khtml_elemat(htmlreq);
khtml_attr(htmlreq, KELEM_FORM,
KATTR_METHOD, "post",
KATTR_ACTION, "login",
KATTR__MAX);
khtml_elem(htmlreq, KELEM_FIELDSET);
khtml_elem(htmlreq, KELEM_LEGEND);
khtml_puts(htmlreq, "Login");
khtml_closeelem(htmlreq, 1);
khtml_attr(htmlreq, KELEM_LABEL,
KATTR_FOR, "username",
KATTR__MAX);
khtml_puts(htmlreq, "Username");
khtml_closeelem(htmlreq, 1);
khtml_attr(htmlreq, KELEM_INPUT,
KATTR_TYPE, "text",
KATTR_ID, "username",
KATTR_NAME, key_and_cookies[KEY_USERNAME].name,
KATTR__MAX);
khtml_attr(htmlreq, KELEM_LABEL,
KATTR_FOR, "password",
KATTR__MAX);
khtml_puts(htmlreq, "Password");
khtml_closeelem(htmlreq, 1);
khtml_attr(htmlreq, KELEM_INPUT,
KATTR_TYPE, "password",
KATTR_ID, "password",
KATTR_NAME, key_and_cookies[KEY_PASSWORD].name,
KATTR__MAX);
khtml_attr(htmlreq, KELEM_LABEL,
KATTR_FOR, "remember-me",
KATTR__MAX);
khtml_puts(htmlreq, "Remember me");
khtml_closeelem(htmlreq, 1);
khtml_attr(htmlreq, KELEM_INPUT,
KATTR_TYPE, "checkbox",
KATTR_ID, "remember-me",
KATTR_NAME, key_and_cookies[KEY_REMEMBER_ME].name,
KATTR__MAX);
khtml_elem(htmlreq, KELEM_P);
khtml_attr(htmlreq, KELEM_INPUT,
KATTR_TYPE, "submit",
KATTR_VALUE, "Submit",
KATTR__MAX);
khtml_closeelem(htmlreq, 1);
/* this is necessary due to a bug of kcgihtml */
if (khtml_elemat(htmlreq) != pos) {
khtml_closeto(htmlreq, pos);
}
}
static enum login_state process_login_form(struct kreq *req) {
/* Check if all fields are present */
struct kpair *pusername;
if ((pusername = req->fieldmap[KEY_USERNAME]) == NULL) {
flash("Invalid username", MSG_TYPE_DANGER);
return LOGIN_FAILURE;
}
struct kpair *ppassword;
if ((ppassword = req->fieldmap[KEY_PASSWORD]) == NULL) {
flash("Invalid password", MSG_TYPE_DANGER);
return LOGIN_FAILURE;
}
/* Initialize database connection */
struct ksqlcfg cfg;
ksql_cfg_defaults(&cfg);
cfg.stmts.stmts = stmts;
cfg.stmts.stmtsz = STMT__MAX;
struct ksql *sql;
sql = ksql_alloc_child(&cfg, NULL, NULL);
ksql_open(sql, "kernod.sqlite");
/* Get user ID and hashed password from database */
struct ksqlstmt *select_id_password_stmt;
ksql_stmt_alloc(sql, &select_id_password_stmt, NULL, STMT_SELECT_ID_PASSWORD);
ksql_bind_str(select_id_password_stmt, 0, pusername->parsed.s);
enum ksqlc select_id_password_rv;
select_id_password_rv = ksql_stmt_step(select_id_password_stmt);
if (select_id_password_rv != KSQL_ROW) {
flash("User doesn't exist", MSG_TYPE_DANGER);
ksql_stmt_free(select_id_password_stmt);
ksql_free(sql);
return LOGIN_FAILURE;
}
int64_t user_id;
ksql_result_int(select_id_password_stmt, &user_id, 0);
const char *hashed_volatile;
char *hashed;
ksql_result_str(select_id_password_stmt, &hashed_volatile, 1);
if ((hashed = strdup(hashed_volatile)) == NULL) {
ksql_stmt_free(select_id_password_stmt);
ksql_free(sql);
perror("strdup");
exit(EXIT_FAILURE);
}
ksql_stmt_free(select_id_password_stmt);
/* Validate password */
if (crypto_pwhash_str_verify(hashed, ppassword->parsed.s,
strlen(ppassword->parsed.s)) != 0) {
flash("Wrong password", MSG_TYPE_DANGER);
ksql_free(sql);
return LOGIN_FAILURE;
}
/* Initialize libsodium */
if (sodium_init() < 0) {
flash("libsodium error", MSG_TYPE_DANGER);
ksql_free(sql);
return LOGIN_FAILURE;
}
/* Issue a random session ID to the client */
char session_id[81];
sprintf(session_id, "%"
PRIx32
"%"
PRIx32
"%"
PRIx32
"%"
PRIx32
"%"
PRIx32
"%"
PRIx32
"%"
PRIx32
"%"
PRIx32,
randombytes_random(), randombytes_random(), randombytes_random(), randombytes_random(),
randombytes_random(), randombytes_random(), randombytes_random(), randombytes_random());
char time_buffer[30];
khttp_head(req, kresps[KRESP_SET_COOKIE],
"%s=%s; Path=/; expires=%s",
key_and_cookies[COOKIE_SESSION_ID].name,
session_id,
kutil_epoch2str(time(NULL) + KERNOD_SESSION_EXPIRE_SECONDS,
time_buffer, sizeof time_buffer));
flash("Welcome!", MSG_TYPE_SUCCESS);
/* Also store the session ID and user ID in Redis */
set_value_integer("session", session_id, user_id, KERNOD_SESSION_EXPIRE_SECONDS);
/* Rehash password if necessary */
int needs_rehash = crypto_pwhash_str_needs_rehash(hashed,
KERNOD_PWHASH_OPSLIMIT,
KERNOD_PWHASH_MEMLIMIT);
if (needs_rehash == 0) {
/* No need to rehash */
ksql_free(sql);
return LOGIN_SUCCESS;
}
enum rehash_state rehash_password_rv;
rehash_password_rv = rehash_password(sql, pusername->parsed.s, ppassword->parsed.s);
ksql_free(sql);
if (rehash_password_rv == REHASH_SUCCESS) {
return LOGIN_SUCCESS;
} else {
/* failed to rehash, but we can do it the next time */
return LOGIN_SUCCESS_BUT_REHASH_FAILURE;
}
}
static enum rehash_state rehash_password(struct ksql *sql, const char *username, const char *password) {
/* Compute a new hash */
char *new_hashed = hash_password_alloc(password);
if (new_hashed == NULL) {
fprintf(stderr, "Error computing password hash\n");
return REHASH_FAILURE;
}
/* Update password hash */
struct ksqlstmt *update_password_stmt;
ksql_stmt_alloc(sql, &update_password_stmt, NULL, STMT_UPDATE_PASSWORD);
ksql_bind_str(update_password_stmt, 0, new_hashed);
ksql_bind_str(update_password_stmt, 1, username);
enum ksqlc update_password_rv;
update_password_rv = ksql_stmt_step(update_password_stmt);
ksql_stmt_free(update_password_stmt);
if (update_password_rv != KSQL_DONE) {
flash("Cannot update password hash", MSG_TYPE_WARNING);
return REHASH_FAILURE;
}
flash("Password rehashed", MSG_TYPE_SUCCESS);
return REHASH_SUCCESS;
}
| 28.987461 | 104 | 0.61155 |
ce92dc60abf2d0fa33a03815c1d0359e9f2c2c3d | 446 | h | C | poacMF/Student/StudentGraphPopoverViewController.h | harriska2/POACMathFact | a9c58b469acaa62eae2af0d16ec42441a3180018 | [
"Unlicense"
] | null | null | null | poacMF/Student/StudentGraphPopoverViewController.h | harriska2/POACMathFact | a9c58b469acaa62eae2af0d16ec42441a3180018 | [
"Unlicense"
] | null | null | null | poacMF/Student/StudentGraphPopoverViewController.h | harriska2/POACMathFact | a9c58b469acaa62eae2af0d16ec42441a3180018 | [
"Unlicense"
] | null | null | null | //
// StudentGraphPopoverViewController.h
// poacMF
//
// Created by Chris Vanderschuere on 08/07/2012.
// Copyright (c) 2012 CDVConcepts. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Result.h"
@interface StudentGraphPopoverViewController : UIViewController <CPTPlotSpaceDelegate,CPTPlotDataSource>
@property (nonatomic, weak) IBOutlet CPTGraphHostingView *graphView;
@property (nonatomic, strong) NSArray* resultsArray;
@end
| 24.777778 | 104 | 0.775785 |
e1f2de424fadda01080add87316a7a1f6c5f8f72 | 4,579 | h | C | engine/texture.h | 2-complex/g2c | 462888a5614badf673a6403d85abd1d01e35295c | [
"MIT"
] | 1 | 2016-05-19T14:48:27.000Z | 2016-05-19T14:48:27.000Z | engine/texture.h | 2-complex/g2c | 462888a5614badf673a6403d85abd1d01e35295c | [
"MIT"
] | 1 | 2015-06-11T18:47:33.000Z | 2015-06-11T18:47:33.000Z | engine/texture.h | 2-complex/g2c | 462888a5614badf673a6403d85abd1d01e35295c | [
"MIT"
] | null | null | null | #ifndef _TEXTURE_
#define _TEXTURE_
#include <string>
#include "opengl.h"
#include "element.h"
#include <stdint.h>
namespace cello
{
class Bank;
class Model;
class Bitmap;
/*! Represents an uncompressed bitmapped image in CPU memory space. A Bitmap may be initialized from a
file or from raw data in memory. A Bitmap may be used to populate a Texture object in GPU space.*/
class Bitmap {
public:
/*! Construct a Bitmap with the default constructor and then populate using set().*/
Bitmap();
/*! Constuct a Bitmap by copying another Bitmap, mimicks the argument in newly
allocated memory.*/
Bitmap(const Bitmap& b);
virtual ~Bitmap();
/*! Copy another Bitmap.*/
Bitmap& operator=(const Bitmap& b);
/*! Use this function to populate the Bitmap with existing data in
memory. Replaces whatever is currently in the Bitmap.*/
void set(uint8_t* inData, int inWidth, int inHeight, int inBitsPerPixel);
/*! Flips image in place.*/
void flipVertically();
/*! Swaps red and blue.*/
void swizzleRGB();
/*! Resizes image, picture no longer valid.*/
void resize(int inWidth, int inHeight);
/*! Accessor for pointer to bitmap data. Do not deallocate.*/
const uint8_t* const getData() const;
/*! Accessor for width of image.*/
int getWidth() const;
/*! Accessor for height of image.*/
int getHeight() const;
/*! Accessor for the bit depth.*/
int getBitsPerPixel() const;
private:
uint8_t* data;
int width;
int height;
int bitsPerPixel;
void mimmic(const Bitmap& b);
void sample(double x, double y, double* color) const;
};
/*! Texture is an abstract base-class for Texture2D and CubeMap holding functionality
common between the two. Texture's*/
class Texture : public Element {
protected:
Texture(GLenum target);
Texture(GLenum target, int unit);
virtual ~Texture();
bool mipmaps;
public:
GLuint getUnit() const;
GLuint getIndex() const;
GLuint getTarget() const;
virtual std::string serializeElements(std::string indent = "") const;
virtual void handleChild(const parse::Node* n);
int bitsPerPixel;
GLuint index;
GLuint unit;
GLenum target;
};
/*! Texture2D represents a rectangular texture in GPU memory. To use, initialize with a Bitmap.
A Texture2D can be constructed with a unit. This refers to an OpenGL texture unit.*/
class Texture2D : public Texture {
friend class Value;
public:
Texture2D();
Texture2D(int unit);
virtual ~Texture2D();
GLubyte* data;
int width;
int height;
std::string file;
void initWithImageData(const GLubyte* inData,
int inWidth,
int inHeight,
int inBitsPerPixel);
void initWithBitmap(const Bitmap& bitmap);
virtual std::string serializeElements(std::string indent = "") const;
virtual void handleChild(const parse::Node* n);
};
/*! CubeMap represents a texture in GPU memory. To use, initialize with six Bitmap objects
one for each face of the cube. These bitmaps must be square.
A CubeMap can be constructed with a unit. This refers to an OpenGL texture unit.*/
class CubeMap : public Texture {
friend class Value;
public:
CubeMap();
CubeMap(int unit);
virtual ~CubeMap();
int width;
std::string positiveXFile;
std::string negativeXFile;
std::string positiveYFile;
std::string negativeYFile;
std::string positiveZFile;
std::string negativeZFile;
void initWithImageData(const GLubyte* positiveXData,
const GLubyte* negativeXData,
const GLubyte* positiveYData,
const GLubyte* negativeYData,
const GLubyte* positiveZData,
const GLubyte* negativeZData,
int inWidth,
int inBitsPerPixel);
void initWithBitmaps(const Bitmap& bitmapPositiveX,
const Bitmap& bitmapNegativeX,
const Bitmap& bitmapPositiveY,
const Bitmap& bitmapNegativeY,
const Bitmap& bitmapPositiveZ,
const Bitmap& bitmapNegativeZ);
protected:
virtual std::string serializeElements(std::string indent = "") const;
virtual void handleChild(const parse::Node* n);
};
} // end namespace
#endif
| 27.094675 | 103 | 0.630269 |
c00c8481de46121731ec5145e65e2c5fe63e7e36 | 1,550 | h | C | sdktools/iasinfdb/inf2db.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | sdktools/iasinfdb/inf2db.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | sdktools/iasinfdb/inf2db.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | ///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 1999, Microsoft Corp. All rights reserved.
//
// FILE
//
// inf2db.h
//
// SYNOPSIS
//
// Header file for inf2db: the main file for that project.
//
//
// MODIFICATION HISTORY
//
// 02/11/1999 Original version.
//
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DATABASE_H__2B7B2F60_C53F_11D2_9E33_00C04F6EA5B6__INCLUDED_)
#define AFX_DATABASE_H__2B7B2F60_C53F_11D2_9E33_00C04F6EA5B6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "precomp.hpp"
#include "database.h"
#include "simpletableex.h"
#include "command.h"
using namespace std;
namespace
{
bool g_FatalError;
class CLocalBinding
{
public:
WCHAR ColumnName[SIZELINEMAX];
LONG Ordinal;
LONG DBType;
};
}
HRESULT Uninitialize(HINF *phINF, CDatabase& Database);
HRESULT Process(const HINF& hINF, CDatabase& Database);
HRESULT ProcessAllRows(
const HINF& hINF,
CSimpleTableEx& pSimpleTable,
const WCHAR* pTableName
);
HRESULT ProcessOneRow(
HINF inf,
CSimpleTableEx& table,
PCWSTR rowName);
#endif
// !defined(AFX_DATABASE_H__2B7B2F60_C53F_11D2_9E33_00C04F6EA5B6__INCLUDED_)
| 22.142857 | 80 | 0.526452 |
0757c9f55030035e8b5c11e46ad97e930e457885 | 396 | h | C | BTWidgetView/anim/BTNumAnimView.h | StoneMover/BTDialog | 1998e22db46048068b070622e46629c6a478847b | [
"MIT"
] | 3 | 2019-08-14T12:43:50.000Z | 2020-06-11T06:44:39.000Z | BTCoreExample/Pods/BTWidgetView/BTWidgetView/anim/BTNumAnimView.h | StoneMover/BTCore | 484f45fcef60c054d77fe448d128f02e99baee7c | [
"MIT"
] | null | null | null | BTCoreExample/Pods/BTWidgetView/BTWidgetView/anim/BTNumAnimView.h | StoneMover/BTCore | 484f45fcef60c054d77fe448d128f02e99baee7c | [
"MIT"
] | 1 | 2019-08-14T12:43:51.000Z | 2019-08-14T12:43:51.000Z | //
// BTNumAnimView.h
// BTWidgetViewExample
//
// Created by apple on 2021/1/13.
// Copyright © 2021 stone. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BTNumAnimView : UIView
- (instancetype)initWithFrame:(CGRect)frame color:(UIColor*)color font:(UIFont*)font;
- (void)startAnimTo:(NSInteger)index time:(CGFloat)time;
@end
NS_ASSUME_NONNULL_END
| 18 | 85 | 0.742424 |
b889281a1e8b183a5980d7f6e5d35ae61d56aad3 | 379 | h | C | usr/libexec/FullKeyboardAccess/FKAAXNotificationObserverDelegate-Protocol.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | usr/libexec/FullKeyboardAccess/FKAAXNotificationObserverDelegate-Protocol.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | usr/libexec/FullKeyboardAccess/FKAAXNotificationObserverDelegate-Protocol.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | //
// 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.
//
@class FKAAXNotificationObserver;
@protocol FKAAXNotificationObserverDelegate
- (void)observer:(FKAAXNotificationObserver *)arg1 didObserveNotification:(int)arg2 notificationData:(const void *)arg3;
@end
| 29.153846 | 120 | 0.762533 |
ed128cdc57e37f186ec92e36a0000ae4648f1d2f | 1,534 | h | C | Core/Source/MFDTXMLDocument.h | IFTS/MobFox-iOS-SDK | 1d2ae6322199e2fdb3aff3249a6581d836406bb8 | [
"Apache-2.0"
] | null | null | null | Core/Source/MFDTXMLDocument.h | IFTS/MobFox-iOS-SDK | 1d2ae6322199e2fdb3aff3249a6581d836406bb8 | [
"Apache-2.0"
] | null | null | null | Core/Source/MFDTXMLDocument.h | IFTS/MobFox-iOS-SDK | 1d2ae6322199e2fdb3aff3249a6581d836406bb8 | [
"Apache-2.0"
] | null | null | null | #import <Foundation/Foundation.h>
@class MFDTXMLDocument, MFDTXMLElement;
@protocol MFDTXMLDocumentDelegate <NSObject>
@optional
- (void) didFinishLoadingXmlDocument:(MFDTXMLDocument *)xmlDocument;
- (void) xmlDocument:(MFDTXMLDocument *)xmlDocument didFailWithError:(NSError *)error;
- (NSURLCredential *) userCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
@end
@interface MFDTXMLDocument : NSObject
{
NSURL *_url;
MFDTXMLElement *documentRoot;
__unsafe_unretained id <MFDTXMLDocumentDelegate> _delegate;
MFDTXMLElement *currentElement;
NSMutableData *receivedData;
NSURLConnection *theConnection;
BOOL doneLoading;
}
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) MFDTXMLElement *documentRoot;
@property (nonatomic, assign) __unsafe_unretained id <MFDTXMLDocumentDelegate> delegate;
@property (nonatomic, readonly) BOOL doneLoading;
+ (MFDTXMLDocument *) documentWithData:(NSData *)data;
+ (MFDTXMLDocument *) documentWithContentsOfFile:(NSString *)path;
+ (MFDTXMLDocument *) documentWithContentsOfFile:(NSString *)path delegate:(id<MFDTXMLDocumentDelegate>)delegate;
+ (MFDTXMLDocument *) documentWithContentsOfURL:(NSURL *)url delegate:(id<MFDTXMLDocumentDelegate>)adelegate;
- (id) initWithContentsOfFile:(NSString *)path;
- (id) initWithContentsOfFile:(NSString *)path delegate:(id<MFDTXMLDocumentDelegate>)delegate;
- (id) initWithContentsOfURL:(NSURL *)url delegate:(id<MFDTXMLDocumentDelegate>)delegate;
- (id) initWithData:(NSData *)data;
@end
| 34.088889 | 113 | 0.801825 |
d44786164399dcf72097a547ae92d50e910be940 | 3,934 | h | C | src/brew/core/linux/LinuxSystemInfo.h | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | 1 | 2018-02-09T16:20:50.000Z | 2018-02-09T16:20:50.000Z | src/brew/core/linux/LinuxSystemInfo.h | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | null | null | null | src/brew/core/linux/LinuxSystemInfo.h | grrrrunz/brew | 13e17e2f6c9fb0f612c3a0bcabd233085ca15867 | [
"MIT"
] | null | null | null | /**
*
* |_ _ _
* |_)| (/_VV
*
* Copyright 2015-2018 Marcus v. Keil
*
* Created on: 17.05.17
*
*/
#ifndef BREW_LINUXSYSTEMINFO_H
#define BREW_LINUXSYSTEMINFO_H
#include <brew/core/SystemInfo.h>
#include <fstream>
#include <sys/types.h>
#include <unistd.h>
#include <vector>
namespace brew {
namespace detail {
/**
* Reads a file from the local file system.
* @param filename The filename.
* @return The file contents.
*/
std::vector<String> readFile(const String& filename) {
std::ifstream f(filename);
std::vector<String> lines;
while(f.good() && !f.eof() && f.is_open()) {
String line;
std::getline(f, line);
lines.push_back(line);
}
return lines;
}
const std::vector<String> cpuInfo = readFile("/proc/cpuinfo");
const std::vector<String> memInfo = readFile("/proc/meminfo");
/**
* System query implementation for linux systems.
*/
class LinuxSystemQuery : public SystemQuery {
public:
/**
* @return The total number of logical processors on this system.
*/
SizeT getNumLogicalProcessors() const override {
SizeT result = 0;
for(const String& line : cpuInfo) {
if(line.find("processor") == 0) {
result++;
}
}
return result;
}
/**
* @return The total number of physical processors on this system.
*/
SizeT getNumPhysicalProcessors() const override {
for(const String& line : cpuInfo) {
if(line.find("cpu cores") == 0) {
SizeT value = std::stoul(
line.substr(line.find_last_of(":")+1)
);
if(value > 0) {
return value;
}
}
}
}
/**
* @return The total number of physical memory on this system.
*/
SizeT getPhysicalMemory() const override {
for(const String& line : memInfo) {
if(line.find("MemTotal") == 0) {
SizeT value = std::stoul(
line.substr(line.find_last_of(":")+1)
);
if(value > 0) {
return value * 1000;
}
}
}
}
/**
* @return The total number of unallocated physical memory on this system.
*/
SizeT getPhysicalMemoryAvailable() const override {
for(const String& line : memInfo) {
if(line.find("MemAvailable") == 0) {
SizeT value = std::stoul(
line.substr(line.find_last_of(":")+1)
);
if(value > 0) {
return value * 1000;
}
}
}
}
/**
* @return The total number of virtual memory on this system.
*/
SizeT getVirtualMemory() const override {
for(const String& line : memInfo) {
if(line.find("SwapTotal") == 0) {
SizeT value = std::stoul(
line.substr(line.find_last_of(":")+1)
);
if(value > 0) {
return value * 1000;
}
}
}
}
/**
* @return The platform name.
*/
const String& getPlatformName() override {
static const String platformName = "Linux";
return platformName;
}
/**
* @return The current working directory.
*/
const String& getCWD() override {
char szTmp[1024];
char pBuf[1024];
ssize_t len = 1024;
sprintf(szTmp, "/proc/%d/exe", getpid());
int bytes = std::min(readlink(szTmp, pBuf, len), len - 1);
if(bytes >= 0)
pBuf[bytes] = '\0';
static String result = pBuf;
result = result.substr(0, result.find_last_of("/"));
return result;
}
};
} /* namespace detail */
} /* namespace brew */
#endif //BREW_LINUXSYSTEMINFO_H
| 24.134969 | 78 | 0.512456 |
355cddb8a2926ebbbfa5dab1879b5dbd845c1df3 | 12,248 | c | C | old/berknet/prot.c | weiss/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 114 | 2015-01-18T22:55:52.000Z | 2022-02-17T10:45:02.000Z | old/berknet/prot.c | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | null | null | null | old/berknet/prot.c | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 29 | 2015-11-03T22:05:22.000Z | 2022-02-08T15:36:37.000Z | static char sccsid[] = "@(#)prot.c 4.1 (Berkeley) 09/12/82";
/* Protocol driver, user level, Berkeley network */
/*
This code is a little complicated because of a number of different
protocols used. Here is an explanation:
Level Description
0 Normal Case (6 bit with no kernel driver support)
1 Line Discipline -- uses NETLDISP in sgtty.h and ioctl to set the
line discipline. At Berkeley this means avoiding interrupting on
every character by using a Silo on a DH or DZ board, and (optionally)
bypassing the canonicalization in the tty code by putting the charactars
directly in a buffer.
condition (netd.dp_bnetldis != 0)
2 8-bit TTY protocol -- implies Level 1 and inserts record separators(012)
and escapes other occurrences of 012. Since the driver on the other
end must interpolate the escapes, this is an asymmetric protocol where
the sender puts in the escapes but the receiver at the user level knows
they have already been removed.
condition (netd.dp_bnetldis != 0 && netd.dp_use8bit != 0)
3 8-bit Block Device protocol -- this is for a DMC-11, it writes fixed
length blocks in both directions with no quoting.
condition (netd.dp_bnetldis != 0 && netd.dp_usehighspeed != 0)
4 RAND 8-bit protocol -- included for completeness, is not
correctly specified here.
Specified by an IFDEF.
If the daemons are being simulated by pipes, then netd.dp_pipesim != 0
and each of the 4 levels (except RAND) are simulated.
In this case at level 2 (use8bit) on the receiver end it does the quoting.
Timing statistics: We estimate 300 micros for queue/dequeue and then
20 micros per interrupt for 30 cps => 2.5% of system for 9600 Baud line
Max packet lengths=> to CSVAX with 1k buffers and 6-bit prot = 758 chars
to Ing70 with 512 byte buffers and no NETLDISC, only 182 chars
*/
# include "defs.h"
/* global */
struct dumpstruc dump;
struct daemonparms netd;
/* local */
static int bufleft;
static char retransmit;
static jmp_buf env;
static short masterseqno, lastseqno;
/* writing packet */
static char wpack[MAXNBUF];
/*
one problem has been character loss on
overloaded systems due to the daemon
taking too long to swap in
and losing characters.
A high priority process of small size
with a pipe would do the job.
*/
alarmint(){
errno = 100;
signal(SIGALRM,SIG_IGN); /* alarm off */
longjmp(env,0); /* ugh */
}
/* returns number of bytes written, error returns WRITEFAIL (-3) */
/* inbuf is buffer of amt chars to be written */
xwrite(inbuf,amt)
char *inbuf;
{
register char *p, *b;
register int i;
int cnt, num, savetime;
struct packet *rpp, *xptr;
xptr = (struct packet *)wpack;
cnt = 0;
retransmit = 0;
savetime = netd.dp_atime;
while(amt > 0){
if(retransmit > netd.dp_maxbread){
debug("xwrite fail");
return(WRITEFAIL);
}
/* format the packet to send */
num = min(netd.dp_datasize,amt);
/* set the length down if escapes are being used */
if(netd.dp_use8bit)num = min(num,MAXNBUF/2);
xptr->pcode = REQUEST;
xptr->seqno = masterseqno;
xptr->len = num;
p = xptr->data;
i = num;
b = inbuf+cnt;
while(i--)*p++ = *b++;
/* send it */
sendpacket(xptr);
rpp = getpacket();
if(rpp == NULL){
netd.dp_atime += 3; /* wait three more secs */
retransmit++;
dump.nretrans++;
continue;
}
/* various errors */
if(rpp->chksum != 0 || rpp->pcode != ACK
|| rpp->seqno != xptr->seqno ){
if(rpp->seqno == 1 && rpp->pcode == REQUEST){
error("collision");
return(WRITEFAIL);
}
if(rpp->chksum != 0)
error("chksum %d",rpp->seqno);
else if(rpp->pcode != ACK)
error("not ack %d %d",rpp->pcode,rpp->seqno);
else if(rpp->seqno != xptr ->seqno)
error("WRSQNO got %d request %d",rpp->seqno,
xptr->seqno);
netd.dp_atime += 3;
retransmit++;
dump.nretrans++;
continue;
}
masterseqno++;
retransmit = 0;
amt -= num;
cnt += num;
}
netd.dp_atime = savetime;
return(cnt);
}
/* return the number of bytes read, or error = BROKENREAD (-2) */
nread(bptr,num)
register char *bptr;
{
register char *p;
register struct packet *pp;
register char *q;
int bcnt = 0;
int n,j,cnt;
static char savebuf[MAXNBUF];
/* first see if theres any left from the last packet */
cnt = 0;
if(bufleft > 0){
p = savebuf;
cnt = n = min(bufleft,num);
while(n--)*bptr++ = *p++;
num -= cnt;
bufleft -= cnt;
if(bufleft > 0){
q = savebuf;
n = bufleft;
while(n--)*q++ = *p++;
}
}
if(num <= 0)
return(cnt);
/* now read a packet */
retransmit = 0;
for(;;){
pp = getpacket();
if(pp == NULL){
if(++bcnt >= netd.dp_maxbread){
debug("read timeout");
return(BROKENREAD);
}
continue;
}
/* various errors */
if(pp->chksum != 0){
error("chksum %d",pp->seqno);
retransmit++;
continue;
}
if(pp->pcode & ~REQUEST){
error("pcode %d %d",pp->pcode,pp->seqno);
retransmit++;
continue;
}
/* this is the normal case, so we ack it */
else { /* else was a REQUEST packet, no chksum errs */
/*
if(pp->seqno == 1)debug("^R ");
*/
pp->pcode = ACK;
n = pp->len;
pp->len = 0;
sendpacket(pp); /* send ACK */
pp->len = n;
break;
}
}
/* now process this packet, bptr points to where we left off */
retransmit = 0;
j = n = min(num,pp->len);
cnt += j;
p = pp->data;
while(n--)*bptr++ = *p++;
if(pp->len > num){
n = bufleft = pp->len - num;
bptr = savebuf;
while(n--)*bptr++ = *p++;
}
return(cnt);
}
printpacket(pp,dest)
char *dest;
struct packet *pp; {
char *s;
int i;
char c;
dest[0] = 0;
if(pp == NULL)return;
if(pp->pcode == REQUEST)c='r';
else if(pp->pcode == ACK)c = 'a';
else if(pp->pcode == PURGE)c = 'p';
else c = 'u';
sprintf(dest,"p:%d len:%d c:%c d:", pp->seqno, pp->len, c);
s = dest + strlen(dest);
for(i=0; i<pp->len && pp->data[i]; i++)*s++ = pp->data[i];
*s = 0;
}
/*
* A purge can always be sent -
* the receiver totally ignores it.
* It is used to push the packet terminator
* down the wire in case of a crash
* leaving the receiver half reading.
*/
sendpurge()
{
struct packet *xptr;
xptr = (struct packet *)wpack;
xptr->pcode = PURGE;
xptr->seqno = 0;
xptr->len = 0;
debug("send purge");
sendpacket(xptr);
}
/* init sequence numbers */
initseqno(){
masterseqno = 1;
lastseqno = 0;
bufleft = 0; /* if any chars are left in buffer, flush them*/
netd.dp_atime = netd.dp_oatime + ((rand()>>8)%15);
}
/*
* Just sends packet pp
* Calculates the chksum
*/
sendpacket(pp)
struct packet *pp; {
register char *q, *p;
register int j;
char *finalp;
static char raw[MAXNBUF];
int len, n, i;
/* writes the data to be sent in array raw */
/* finalp will point to either pp or raw */
dump.nbytesent += pp->len;
dump.npacksent++;
pp->chksum = 0;
n = 0;
p = (char *)pp;
len = ACKLENGTH + pp->len;
for(j = 0; j < len; j++)n ^= *p++;
pp->chksum = n;
# ifdef SWAB
switchem(pp);
# endif
# ifndef RAND
if(netd.dp_usehispeed)finalp = (char *)pp;
else if(netd.dp_use8bit){
if(len >= MAXNBUF){
fprintf(stderr,"Packet size too big- error\n");
exit(1);
}
/* add escapes */
p = (char *)pp;
q = raw;
i = len;
len = 0;
for(j = 0; j < i; j++){
if(*p == '\n' || *p == '\\'){
*q++ = '\\';
*q++ = *p++;
len++;
len++;
}
else {
*q++ = *p++;
len++;
}
}
*q = '\n';
len++;
finalp = raw;
}
else {
/* now change 8-bit data to 6-bit data */
if(((len+2)*4)/3 >= MAXNBUF){
fprintf(stderr,"Packet size too big- error\n");
exit(1);
}
p = raw;
q = (char *)pp;
len = n = (len+2)/3;
while(n--){
*p++ = (*q & 077) + INCR;
j = (*q++ >> 6) &03;
*p++ = (((*q << 2) | j) & 077) + INCR;
j = (*q++ >> 4) & 017;
*p++ = (((*q << 4) | j) & 077) + INCR;
*p++ = ((*q++ >> 2) & 077) + INCR;
}
*p++ = '\n';
*p = 0;
/* because of bugs in processing around erase and kill in v6 */
for(p=raw; *p; p++)
if(*p == '\\')*p = '}';
len = len * 4 + 1;
finalp = raw;
}
/*
debug("send %d <<%s>>",len,raw);
*/
if(netd.dp_usehispeed){
if(len > SENDLEN)error("send length too long");
len = SENDLEN;
}
if(netd.dp_pipesim) i = write(netd.dp_pwritefd,finalp,len);
else i = write(netd.dp_linefd,finalp,len);
dump.braw += i;
dump.brawtot += i;
# ifdef SWAB
switchem(pp);
# endif
# else
/* for RAND */
i = write(netd.dp_linefd, (char *)pp,len);
# endif
/*
debug("count %d",i);
*/
}
static int tooshort;
/*
* returns NULL if couldn't get a packet with correct seqno
* chksum not checked here
* because other programs may want to interrogate checksum
*/
struct packet *getpacket() {
register struct packet *gptr;
register char *p;
register int i;
int n, bcnt, len;
struct packet *decpacket();
bcnt = 0;
errno = 0;
setjmp(env);
alarm(0);
signal(SIGALRM,alarmint);
for(;;){
if(bcnt++ > netd.dp_maxbread)errno = 100; /* give up */
if(errno == 100){
if(debugflg)putchar('^');
return(NULL);
}
/* decode the buffer, including 6-8 bit conv, etc. */
gptr = decpacket();
if(gptr == NULL){
error("getpacket fails");
return(NULL);
}
if(tooshort || gptr->len < 0 || gptr->len > MAXNBUF){
error("too short p:%d l:%d",gptr->seqno,gptr->len);
continue;
}
if(gptr->seqno == 1 && gptr->pcode != ACK){
debug("got reset");
addtolog(remote,"^R ");
}
if(gptr->pcode == PURGE){
debug("got purge");
continue; /* never seen */
}
if(gptr->seqno == lastseqno){
if(retransmit)break;
/* send ACK - it was lost first time thru */
len = gptr->len;
n = gptr->pcode;
gptr->len = 0;
gptr->pcode = ACK;
sendpacket(gptr);
gptr->len = len;
gptr->pcode = n;
error("sendlostack %d",lastseqno);
break;
}
/* this is the correct case */
if(gptr->seqno == lastseqno + 1)break;
error("Wrong seq no g: %d last: %d",gptr->seqno,
lastseqno);
}
lastseqno = gptr->seqno;
n = 0;
len = gptr->len + ACKLENGTH;
p = (char *)gptr;
for(i=0; i < len; i++)n ^= *p++;
gptr->chksum = n;
if(n != 0)dump.ncksum++;
dump.nbytercv += gptr->len;
dump.npackrcv++;
return(gptr);
}
/* read in and decode packet */
/* as a side effect sets "tooshort" */
static struct packet *decpacket()
{
# ifndef RAND
register char *p, *q;
register int i,j;
int n, len, ch;
struct packet *pp;
static char cooked[MAXNBUF], raw[MAXNBUF];
/* read in chars to raw, if processed then return in cooked, otherwise
return in raw */
alarm(netd.dp_atime);
tooshort = 0;
if(netd.dp_pipesim){
if(netd.dp_usehispeed)
len = read(fileno(netd.dp_rdfile),raw,SENDLEN);
else {
q = raw;
len = 0;
for(;;){
ch = getc(netd.dp_rdfile);
len++;
if(ch == '\n'){
*q++ = '\n';
break;
}
/* eat up the backslashes */
if(ch == '\\' && netd.dp_use8bit)
ch = getc(netd.dp_rdfile);
*q++ = ch;
}
if(netd.dp_use8bit)len--;
}
}
else if(netd.dp_usehispeed)
len = read(fileno(netd.dp_rdfile),raw,SENDLEN);
else len = read(netd.dp_linefd,raw,MAXNBUF);
alarm(0);
if(len == 0)fprintf(stderr,"eof pip %d\n",fileno(netd.dp_rdfile));
if(len <= 0)return(NULL);
raw[len] = 0;
dump.braw += len;
dump.brawtot += len;
/*
debug("receive %d <<%s>>",len,raw);
*/
/* if 8 bit the all we need to do is return */
if(netd.dp_usehispeed)return((struct packet *)raw);
if(netd.dp_use8bit){
pp = (struct packet *)raw;
if(len != ACKLENGTH + pp->len)tooshort = 1;
return(pp);
}
/* remove this loop later */
for(p=raw; *p; p++)
if(*p == '}')*p = '\\';
p = raw;
q = cooked;
n = (len+3) /4;
while(n--){
if(*p == '\n')break;
if(*p < INCR || *p & 0200)error("bad char %o\n",*p);
i = *p++ - INCR;
j = *p++ - INCR;
*q++ = ((j & 03) << 6) | (i & 077);
i = *p++ -INCR;
*q++ = ((i & 017) << 4) | ((j >> 2) & 017);
j = *p++ - INCR;
*q++ = ((j & 077) << 2) | ((i >> 4) & 03);
}
*q = 0;
pp = (struct packet *)cooked;
# ifdef SWAB
switchem(pp);
# endif
if(len != ((ACKLENGTH + pp->len + 2)/3)*4 + 1) tooshort = 1;
# else
/* for RAND */
/* not sure of the length computation */
if(len != ACKLENGTH + gptr->len) tooshort = 1;
# endif
return((struct packet *)cooked);
}
# ifdef SWAB
switchem(pp)
register struct packet *pp; {
register short *p;
p = &(pp->seqno);
swab(p, p, 2);
p = &(pp->len);
swab(p, p, 2);
}
# endif
| 23.463602 | 74 | 0.596506 |
dca999fe1e4261c5b4d9434314ead8e4dabceddc | 12,238 | h | C | CPP/Modules/NavServerCom/Server.h | wayfinder/Wayfinder-S60-Navigator | 14d1b729b2cea52f726874687e78f17492949585 | [
"BSD-3-Clause"
] | 6 | 2015-12-01T01:12:33.000Z | 2021-07-24T09:02:34.000Z | CPP/Modules/NavServerCom/Server.h | wayfinder/Wayfinder-S60-Navigator | 14d1b729b2cea52f726874687e78f17492949585 | [
"BSD-3-Clause"
] | null | null | null | CPP/Modules/NavServerCom/Server.h | wayfinder/Wayfinder-S60-Navigator | 14d1b729b2cea52f726874687e78f17492949585 | [
"BSD-3-Clause"
] | 2 | 2017-02-02T19:31:29.000Z | 2018-12-17T21:00:45.000Z | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SERVER_H
#define SERVER_H
#include <vector>
#include <algorithm>
#include <functional>
namespace isab{
/** Utlity class to keep track of a server with a port.*/
class Server{
char* m_host;
char* m_url;
char* m_hostAndPort;
uint16 m_port;
public:
/** If set, indicates that this Server should be kept for the next
* session*/
bool persistent;
private:
int m_group;
bool m_unreachable;
public:
bool isReachable() const;
void setUnreachable();
void setReachable() { m_unreachable = false;}
int group() const;
void setGroup(int newGroup) {m_group = newGroup;}
bool isGroup(int group) { return m_group == group; }
/** A fully qualified domain name, or ip address as text. */
const char* getHost() const;
/** A port. Anything less than or equal to 1024 is invalid.*/
uint16 getPort() const;
/** Constructs a Server object from a string and a port.
* @param host a fully qualified domain nam or an ip address as text.
* @param port a port number. Anything less than 1025 is invalid. */
Server(const char* host, uint16 port);
/** Constructs a Server object from a FQDN and a port encoded in
* a string with a colon as delimiter: host.domain:port
* @param hostAndPort a host and port encoded as described above.*/
Server(const char* hostAndPort);
// Server() : host(NULL), port(0), persistent(false) {}
~Server();
static Server* factory(Buffer& buf, int lastGroup, int delim = ',',
int groupDelim = ';');
/** Allocates enough memory and writes a string in it that can be used
* to create a new Server object.
* @return a pointer to a dynamically allocated string that the caller
* must delete[] at a later time.*/
const char * getHostAndPort() const;
const char * getUrl() const;
void toString(Buffer& buf) const;
Server(const Server& server);
const Server& operator=(const Server& rhs);
bool operator<(const Server& rhs) const;
bool operator==(const Server& rhs) const;
};
//===================Server inlines ==================================
inline Server::Server(const Server& server) :
m_host(NULL), m_url(NULL), m_hostAndPort(NULL), m_port(server.m_port),
persistent(server.persistent),
m_group(server.m_group), m_unreachable(server.m_unreachable)
{
m_host = strdup_new(server.m_host);
m_url = strdup_new(server.m_url);
m_hostAndPort = strdup_new(server.m_hostAndPort);
}
inline const Server& Server::operator=(const Server& rhs)
{
if(this != &rhs){
m_port = rhs.m_port;
persistent = rhs.persistent;
m_group = rhs.m_group;
m_unreachable = rhs.m_unreachable;
m_host = strdup_new(rhs.m_host);
m_url = strdup_new(rhs.m_url);
m_hostAndPort = strdup_new(rhs.m_hostAndPort);
}
return *this;
}
inline Server::~Server(){
delete[] m_host;
delete[] m_url;
delete[] m_hostAndPort;
}
inline const char * Server::getHostAndPort() const
{
return m_hostAndPort;
}
inline const char * Server::getUrl() const
{
return m_url;
}
inline bool Server::isReachable() const
{
return !m_unreachable;
}
inline int Server::group() const
{
return m_group;
}
inline void Server::setUnreachable()
{
m_unreachable = true;
}
inline bool Server::operator<(const Server& rhs) const
{
return strcmp(this->m_hostAndPort, rhs.m_hostAndPort) < 0;
}
inline bool Server::operator==(const Server& rhs) const
{
return 0 == strcmp(this->m_hostAndPort, rhs.m_hostAndPort);
}
//============= end of Server inlines ==============================
class ServerList{
typedef std::vector<Server*> container;
typedef std::vector<Server*>::iterator iterator;
container m_list;
iterator m_current;
public:
ServerList();
~ServerList();
unsigned populate(Buffer& buf, int lastGroup,
bool keepPersistent = false,
bool keepNonpersistent = true, int delim = ',',
int groupDelim = ';');
const Server* getServer(bool first = false);
const char* getHost() const;
uint16 getPort() const;
const char* getHostAndPort() const;
unsigned size() const;
bool empty() const;
void setUnreachable();
void removeCurrent();
void setAllReachable();
bool addServer(const char* host, uint16 port,
bool persistent = false, int group = -1);
void clear();
uint32 saveParameter(ParameterProviderPublic& ppp);
private:
ServerList(const ServerList& rhs);
const ServerList& operator=(const ServerList& rhs);
};
//================ ServerList inlines =============================
inline ServerList::ServerList()
{
m_current = m_list.end();
}
inline ServerList::~ServerList()
{
while(!m_list.empty()){
Server* tmp = m_list.back();
m_list.pop_back();
delete tmp;
}
}
inline unsigned ServerList::populate(Buffer& buf, int lastGroup,
bool /*keepPersistent*/,
bool /*keepNonpersistent*/,
int /*delim*/, int /*groupDelim*/)
{
bool end = m_current == m_list.end();
unsigned cnt = 0;
uint8 next = '\0';
do{
Server* tmp = Server::factory(buf, lastGroup);
if(!tmp){
break;
}
m_list.push_back(tmp);
cnt++;
next = buf.readNext8bit();
if(next == ';'){
next = ',';
lastGroup++;
}
}while(next == ',');
if(end){
m_current = m_list.end();
}
return cnt;
}
inline const Server* ServerList::getServer(bool first)
{
Server* ret = NULL;
if(first){
//XXX
} else if(m_current != m_list.end()){
ret = *m_current;
}
return ret;
}
inline const char* ServerList::getHost() const
{
if(m_current != m_list.end()){
return (*m_current)->getHost();
}
return NULL;
}
inline uint16 ServerList::getPort() const
{
if(m_current != m_list.end()){
return (*m_current)->getPort();
}
return 0;
}
inline const char* ServerList::getHostAndPort() const
{
if(m_current != m_list.end()){
return (*m_current)->getHostAndPort();
}
return NULL;
}
inline unsigned ServerList::size() const
{
return m_list.size();
}
inline bool ServerList::empty() const
{
return m_list.empty();
}
inline void ServerList::setUnreachable()
{
if(m_current != m_list.end()){
(*m_current)->setUnreachable();
//XXX get next
}
}
inline void ServerList::removeCurrent()
{
}
inline void ServerList::setAllReachable()
{
for(iterator q = m_list.begin(); q != m_list.end(); ++q){
(*q)->setReachable();
}
//XXX get next
}
inline bool ServerList::addServer(const char* /*host*/, uint16 /*port*/,
bool /*persistent*/, int /*group*/)
{
return false;
}
inline void ServerList::clear()
{
}
inline uint32 ServerList::saveParameter(ParameterProviderPublic& /*ppp*/)
{
return 0;
}
//===========end of ServerList inlines =========================
class ServerCmpLess :
public std::binary_function<const Server* const&, const Server* const&, bool>{
public:
result_type operator()(first_argument_type a,
second_argument_type b)const
{
return strcmp(a->getHostAndPort(), b->getHostAndPort()) < 0;
}
};
class ServerCmpEqual :
public std::binary_function<const Server* const&, const Server* const&, bool>{
public:
result_type operator()(first_argument_type a,
second_argument_type b) const
{
return (0 == strcmp(a->getHostAndPort(), b->getHostAndPort()));
}
};
///Sorts Servers by group and reachability.
///The first sorting criteria is group.
///The second sorting criteria is reachability, where reachables
/// preceedes unreachebles.
///If two servers have the same group and reachablity they are
/// considered equal.
class ServerGroupLess :
public std::binary_function<const Server* const&, const Server* const&, bool>{
public:
result_type operator()(first_argument_type a,
second_argument_type b) const
{
if(a->group() == b->group()){
if((a->isReachable() && b->isReachable()) ||
!(a->isReachable() || b->isReachable())){
return false;
} else { //a is reachable, b is not =>
return a->isReachable(); //a preceedes b
}
} else {
return a->group() < b->group();
}
}
};
class ServerGroupLessStrict :
public std::binary_function<const Server* const&, const Server* const&, bool>{
public:
result_type operator()(first_argument_type a,
second_argument_type b) const
{
return a->group() < b->group();
}
};
int nextServer(int64& seed, std::vector<Server*>& v, int oldIndex = -1);
inline int findFirstServer(std::vector<Server*>& v, int64& seed){
return nextServer(seed, v);
}
inline void setReachable(std::vector<Server*>& v){
std::vector<Server*>::iterator q;
for(q = v.begin(); q != v.end(); ++q){
(*q)->setReachable();
}
}
inline void removeServer(std::vector<Server*>& v, int idx){
std::vector<Server*>::iterator toRemove = v.begin();
std::advance(toRemove, idx);
Server* bad = *toRemove;
v.erase(toRemove);
delete bad;
}
}
#endif
| 32.290237 | 756 | 0.572806 |
0d24dc33714d302dda0702869b88e5aae8844521 | 543 | h | C | Server/skillmodel.h | ROLL-E/roll-e | ddf7112ed7bf196616bafa9b9453df6b0b22ca38 | [
"MIT"
] | 1 | 2020-07-30T19:37:58.000Z | 2020-07-30T19:37:58.000Z | Server/skillmodel.h | ROLL-E/roll-e | ddf7112ed7bf196616bafa9b9453df6b0b22ca38 | [
"MIT"
] | null | null | null | Server/skillmodel.h | ROLL-E/roll-e | ddf7112ed7bf196616bafa9b9453df6b0b22ca38 | [
"MIT"
] | null | null | null | #ifndef SKILLMODEL_H
#define SKILLMODEL_H
#include <QAbstractListModel>
#include <QList>
class Skill;
class SkillModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit SkillModel(QObject *parent = 0);
SkillModel(QList<Skill*> new_skills) : skills(new_skills) {}
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
signals:
public slots:
private:
QList<Skill*> skills;
};
#endif // SKILLMODEL_H
| 19.392857 | 64 | 0.751381 |
c2f1df5cd531fd45e7e399bbeebfe2839724d59c | 993 | h | C | OBAKit/Location/OBARegionHelper.h | fossabot/onebusaway-iphone | a0162739b9a8f1366def14fdd31369700dd26776 | [
"Apache-2.0"
] | null | null | null | OBAKit/Location/OBARegionHelper.h | fossabot/onebusaway-iphone | a0162739b9a8f1366def14fdd31369700dd26776 | [
"Apache-2.0"
] | 1 | 2018-05-30T21:00:57.000Z | 2018-05-30T21:00:57.000Z | OBAKit/Location/OBARegionHelper.h | fossabot/onebusaway-iphone | a0162739b9a8f1366def14fdd31369700dd26776 | [
"Apache-2.0"
] | 1 | 2018-05-30T20:51:08.000Z | 2018-05-30T20:51:08.000Z | //
// OBARegionHelper.h
// org.onebusaway.iphone
//
// Created by Sebastian Kießling on 11.08.13.
// Copyright (c) 2013 OneBusAway. All rights reserved.
//
@import Foundation;
#import <OBAKit/OBAModelService.h>
#import <OBAKit/OBARegionV2.h>
#import <OBAKit/OBALocationManager.h>
#import <OBAKit/OBAModelDAO.h>
NS_ASSUME_NONNULL_BEGIN
@class OBARegionHelper;
@protocol OBARegionHelperDelegate <NSObject>
- (void)regionHelperShowRegionListController:(OBARegionHelper*)regionHelper;
@end
@interface OBARegionHelper : NSObject
@property(nonatomic,strong) OBALocationManager *locationManager;
@property(nonatomic,strong) OBAModelDAO *modelDAO;
@property(nonatomic,strong) OBAModelService *modelService;
@property(nonatomic,weak) id<OBARegionHelperDelegate> delegate;
- (instancetype)initWithLocationManager:(OBALocationManager*)locationManager NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
- (void)updateNearestRegion;
- (void)updateRegion;
@end
NS_ASSUME_NONNULL_END
| 27.583333 | 103 | 0.810675 |
8912371f79c87fcce4eebf6f59830da905b5bc2a | 1,353 | h | C | src/apps/vis/base/vis_liveview.h | itm/shawn | 49cb715d0044a20a01a19bc4d7b62f9f209df83c | [
"BSD-3-Clause"
] | 15 | 2015-07-07T15:48:30.000Z | 2019-10-27T18:49:49.000Z | src/apps/vis/base/vis_liveview.h | itm/shawn | 49cb715d0044a20a01a19bc4d7b62f9f209df83c | [
"BSD-3-Clause"
] | null | null | null | src/apps/vis/base/vis_liveview.h | itm/shawn | 49cb715d0044a20a01a19bc4d7b62f9f209df83c | [
"BSD-3-Clause"
] | 4 | 2016-11-23T05:50:01.000Z | 2019-09-18T12:44:36.000Z | /************************************************************************
** This file is part of the network simulator Shawn. **
** Copyright (C) 2004,2005 by SwarmNet (www.swarmnet.de) **
** and SWARMS (www.swarms.de) **
** Shawn is free software; you can redistribute it and/or modify it **
** under the terms of the GNU General Public License, version 2. **
************************************************************************/
#ifndef __SHAWN_VIS_LIVEVIEW_H
#define __SHAWN_VIS_LIVEVIEW_H
#include "../buildfiles/_apps_enable_cmake.h"
#ifdef ENABLE_VIS
#ifdef HAVE_GLUT
#ifdef HAVE_BOOST
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#endif
namespace vis
{
/**
* Creates an external Window of the provided size an using the provided
* texture resolution.
*/
void createWindow(int sizex, int sizey, int resx, int resy);
/**
* Notifies the external window that the texture has changed and needs to
* be updated.
*/
void updateTexture(unsigned char* textureData);
/**
* Returns a pointer to the currently used texture data.
*/
unsigned char* getTexture();
#ifdef HAVE_BOOST
/**
* Returns the mutex that needs to be locked before changing or reading
* texture data.
*/
boost::mutex* getUpdateMutex();
#endif
}
#endif
#endif
#endif
| 26.529412 | 74 | 0.609017 |
72b6f5312a13da5508842233cee1b76e53feaf56 | 3,348 | h | C | simulation.h | TheTimmy/CrankNicolson | 44e2e5e3fa07af17444f1e341e9021c47ab87601 | [
"MIT"
] | null | null | null | simulation.h | TheTimmy/CrankNicolson | 44e2e5e3fa07af17444f1e341e9021c47ab87601 | [
"MIT"
] | null | null | null | simulation.h | TheTimmy/CrankNicolson | 44e2e5e3fa07af17444f1e341e9021c47ab87601 | [
"MIT"
] | 1 | 2021-02-16T06:09:34.000Z | 2021-02-16T06:09:34.000Z | #pragma once
#include <vector>
#include <complex>
#include <memory>
#include "Vector.h"
#include "wave.h"
#include "observable.h"
#include "hamiltonian.h"
#include "TridiagonalMatrix.h"
#include "SimulationParameter.h"
typedef TridiagonalMatrix<std::complex<double>> ComplexTridiagonalMatrix;
typedef HamiltonianSolver<std::complex<double>> ComplexHamiltonianSolver;
typedef Vector<std::complex<double>> ComplexVector;
typedef Wave<std::complex<double>> ComplexWave;
/**
* @brief The Simulation class is the main class for the simulation which glue alltogether.
* This class hold the atoms and the equation solver and all filters.
* It also does the iteration and calls the filter methods of the observables.
* This class its basicly design to work like a sandbox with bounds.
*/
class Simulation
{
public:
/**
* @brief Simulation The constructor of the class which sets the current solver and the
* simulation parameter.
* @param params The simulation parameter.
* @param hamiltonian The solver which solves the Schrödinger equation.
*/
Simulation(SimulationParameter params, std::shared_ptr<ComplexHamiltonianSolver> hamiltonian);
~Simulation();
/**
* @brief #run Runs the simulation and call the filter method of the observables.
*/
void run();
/**
* @brief #setSolver Sets the current solver of the simulation.
* @param solver The solver for the Schrödinger equation.
*/
void setSolver(ComplexHamiltonianSolver* solver);
/**
* @brief #getSolver return the solver for the current simulation.
* @return The solver of the simulation.
*/
ComplexHamiltonianSolver* getSolver() const;
/**
* @brief #setSolver Sets the current solver of the simulation.
* @param solver The solver for the Schrödinger equation.
*/
void setSolver(std::shared_ptr<ComplexHamiltonianSolver> solver);
/**
* @brief #addWave Add a wave to the simulation.
* @param wave The wave to add.
*/
void addWave(const ComplexWave* wave);
/**
* @brief #addFilter Add an observable to the simulation, which gets called in the run method.
* @param filter The observable to add.
*/
void addFilter(Observable* filter);
/**
* @brief #addFilter Add an observable to the simulation, which gets called in the run method.
* @param filter The observable to add.
*/
void addFilter(std::shared_ptr<Observable> filter);
/**
* @brief #getParameter Return the current SimulationParameter of the simulation.
* @return The simulation parameter with timestep and resolution.
*/
SimulationParameter getParameter() const { return parameter; }
/**
* @brief #getIteration Returns the current iteration index.
* @return The iteration index.
*/
int getIteration() const { return currentIteration; }
/**
* @brief #getAtoms Get the atoms in the current simulation in a vector.
* @return The atoms in the simulation in a vector.
*/
ComplexVector getAtoms() const { return atoms; }
protected:
ComplexVector atoms;
std::shared_ptr<ComplexHamiltonianSolver> hamiltonian;
std::vector<std::shared_ptr<Observable>> filter;
SimulationParameter parameter;
int currentIteration;
};
| 32.823529 | 98 | 0.693548 |
60c709745fcd021070aac0a828a8e831fb42f93e | 953 | c | C | src/ALSP/forkexec_parent.c | pr0gr4m/Study | da6792b181644c05ca0545c2bb5e19bdef593a78 | [
"Apache-2.0"
] | null | null | null | src/ALSP/forkexec_parent.c | pr0gr4m/Study | da6792b181644c05ca0545c2bb5e19bdef593a78 | [
"Apache-2.0"
] | null | null | null | src/ALSP/forkexec_parent.c | pr0gr4m/Study | da6792b181644c05ca0545c2bb5e19bdef593a78 | [
"Apache-2.0"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
int main()
{
pid_t pid_child;
printf("Parent[%d]: Start\n", getpid());
int fd = open("forkexec.log", O_WRONLY | O_CREAT | O_APPEND, 0644);
if (fd == -1)
{
perror("FAIL: open");
exit(EXIT_FAILURE);
}
dprintf(fd, "Parent[%d]: Open log file(fd = %d) \n", getpid(), fd);
#ifdef APPLY_FD_CLOEXEC
int ret_fcntl;
if ( (ret_fcntl = fcntl(fd, F_SETFD, FD_CLOEXEC)) == -1)
{
perror("FAIL: fcntl(F_SETFD, FD_CLOEXEC)");
exit(EXIT_FAILURE);
}
#endif
/* fork-exec code */
char *argv_exec[] = { "forkexec_child", (char *)NULL };
switch ( (pid_child = fork()) )
{
case 0:
execv( argv_exec[0], argv_exec );
break;
case -1:
perror("FAIL: FORK");
break;
default:
wait(NULL);
break;
}
printf("Parent[%d]: Exit\n", getpid());
return 0;
}
| 20.276596 | 68 | 0.620147 |
fc0757e98169fde2086202dfb3bf42f8f1d96acc | 672 | h | C | compat/BSPassByTargetTriggerModifier_1.h | BlazesRus/hkxcmd | e00a554225234e40e111e808b095156ac1d4b1fe | [
"Intel"
] | 38 | 2015-03-24T00:41:59.000Z | 2022-03-23T09:18:29.000Z | compat/BSPassByTargetTriggerModifier_1.h | BlazesRus/hkxcmd | e00a554225234e40e111e808b095156ac1d4b1fe | [
"Intel"
] | 2 | 2015-10-14T07:41:48.000Z | 2015-12-14T02:19:05.000Z | compat/BSPassByTargetTriggerModifier_1.h | BlazesRus/hkxcmd | e00a554225234e40e111e808b095156ac1d4b1fe | [
"Intel"
] | 24 | 2015-08-03T20:41:07.000Z | 2022-03-27T03:58:37.000Z | #pragma once
#include <Common/Base/hkBase.h>
#include "hkbModifier_0.h"
#include "hkbEventProperty_1.h"
class BSPassByTargetTriggerModifier : public hkbModifier
{
public:
HK_DECLARE_CLASS_ALLOCATOR( HK_MEMORY_CLASS_BEHAVIOR_RUNTIME );
HK_DECLARE_REFLECTION();
public:
HK_FORCE_INLINE BSPassByTargetTriggerModifier(void) {}
HK_FORCE_INLINE BSPassByTargetTriggerModifier( hkFinishLoadedObjectFlag flag ) : hkbModifier(flag)
{}
// Properties
hkVector4 m_targetPosition;
hkReal m_radius;
hkVector4 m_movementDirection;
hkbEventProperty m_triggerEvent;
hkBool m_targetPassed;
};
extern const hkClass BSPassByTargetTriggerModifierClass;
| 25.846154 | 102 | 0.799107 |
ccd3c38087ed8e7bd470b0fea8777bed5223ef9e | 1,023 | c | C | sun3_neg_word.c | nineties-retro/sun3 | 22672580429b54f05946774908d62b794e171e06 | [
"BSD-3-Clause"
] | 1 | 2019-06-13T18:17:04.000Z | 2019-06-13T18:17:04.000Z | sun3_neg_word.c | nineties-retro/sun3 | 22672580429b54f05946774908d62b794e171e06 | [
"BSD-3-Clause"
] | null | null | null | sun3_neg_word.c | nineties-retro/sun3 | 22672580429b54f05946774908d62b794e171e06 | [
"BSD-3-Clause"
] | 2 | 2020-04-03T09:23:27.000Z | 2022-03-21T18:56:44.000Z | #include "sun3_instruction.h"
#include "sun3_neg_word.h"
static void sun3_instr_neg_word_execute(sun3_word_instruction * neg)
{
neg->ans= -neg->dest;
}
static void sun3_instr_neg_word_set_flags(sun3_word_instruction * neg, sun3_sr * sr)
{
sun3_sr_set_n(*sr, sun3_unsigned_word_sign(neg->ans));
sun3_sr_set_z(*sr, neg->ans==0);
sun3_sr_set_v(*sr, sun3_unsigned_word_sign(neg->dest)&sun3_unsigned_word_sign(neg->ans));
sun3_sr_set_c(*sr, sun3_unsigned_word_sign(neg->dest)|sun3_unsigned_word_sign(neg->ans));
sun3_sr_set_x(*sr, sun3_sr_c(*sr));
}
sun3_word_instruction sun3_instr_neg_word = {
.legal_execute_modes = sun3_ea_mode_drd|sun3_ea_mode_ari|sun3_ea_mode_aripi|sun3_ea_mode_aripd|sun3_ea_mode_arid|sun3_ea_mode_arii|sun3_ea_mode_asa|sun3_ea_mode_ala,
.execute = sun3_instr_neg_word_execute,
.legal_flag_modes = sun3_ea_mode_drd|sun3_ea_mode_ari|sun3_ea_mode_aripi|sun3_ea_mode_aripd|sun3_ea_mode_arid|sun3_ea_mode_arii|sun3_ea_mode_asa|sun3_ea_mode_ala,
.set_flags = sun3_instr_neg_word_set_flags
};
| 36.535714 | 166 | 0.826979 |
693d001e4fb550b7b57cd24495da48dfc612d806 | 6,784 | h | C | src/scene/material.h | chiguire/nttcitygenerator | 7c449e74d4363b54c1a59684b7aeb2e13686d695 | [
"MIT"
] | 3 | 2019-04-09T04:43:46.000Z | 2020-01-19T03:31:32.000Z | src/scene/material.h | chiguire/nttcitygenerator | 7c449e74d4363b54c1a59684b7aeb2e13686d695 | [
"MIT"
] | null | null | null | src/scene/material.h | chiguire/nttcitygenerator | 7c449e74d4363b54c1a59684b7aeb2e13686d695 | [
"MIT"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
//
// (C) Andy Thomason 2012, 2013
//
// Modular Framework for OpenGLES2 rendering on multiple platforms.
//
// Material
//
//
// Materials are represented as GL textures with solid colours as single pixel textures.
// This simplifies shader design.
//
namespace octet {
class material : public resource {
// material
ref<param> diffuse;
ref<param> ambient;
ref<param> emission;
ref<param> specular;
ref<param> bump;
ref<param> shininess;
ref<param> building_a;
ref<param> building_b;
ref<param> building_c;
void bind_textures() const {
// set textures 0, 1, 2, 3 to their respective values
diffuse->render(0, GL_TEXTURE_2D);
ambient->render(1, GL_TEXTURE_2D);
emission->render(2, GL_TEXTURE_2D);
specular->render(3, GL_TEXTURE_2D);
bump->render(4, GL_TEXTURE_2D);
shininess->render(5, GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
}
void bind_textures_buildings() const {
diffuse->render(0, GL_TEXTURE_2D);
ambient->render(1, GL_TEXTURE_2D);
emission->render(2, GL_TEXTURE_2D);
specular->render(3, GL_TEXTURE_2D);
bump->render(4, GL_TEXTURE_2D);
shininess->render(5, GL_TEXTURE_2D);
building_a->render(6, GL_TEXTURE_2D);
building_b->render(7, GL_TEXTURE_2D);
building_c->render(8, GL_TEXTURE_2D);
// glActiveTexture(GL_TEXTURE0);
}
void init(param *param_) {
specular = diffuse = ambient = param_;
emission = new param(vec4(0, 0, 0, 0));
bump = new param(vec4(0, 0, 0, 0));
shininess = new param(vec4(30.0f/255, 0, 0, 0));
}
public:
RESOURCE_META(material)
// default constructor makes a blank material.
material() {
diffuse = 0;
ambient = 0;
emission = 0;
specular = 0;
bump = 0;
shininess = 0;
}
// don't use this too much, it creates a new image every time.
material(const char *texture, sampler *sampler_ = 0) {
init(new param(new image(texture), sampler_));
}
// don't use this too much, it creates a new image every time.
material(const vec4 &color) {
init(new param(color));
}
material(image *img, bool shiny=true, float shininess_=30.0f/255) {
//init(new param(img));
param *p = new param(img);
init(p, p, new param(vec4(0.0f)), shiny? p:new param(vec4(0.0f)), new param(vec4(0.0f)), new param(vec4(shininess_, 0.0f, 0.0f, 0.0f)));
}
material( image *img_a, image *img_b, image *img_c, image *img_d, bool shiny=true, float shininess_=30.0f/255) {
param *pa = new param(img_a);
param *pb = new param(img_b);
param *pc = new param(img_c);
param *pd = new param(img_d);
init_building(pa, pa, new param(vec4(0.0f)), shiny? pa:new param(vec4(0.0f)), new param(vec4(0.0f)), new param(vec4(shininess_, 0.0f, 0.0f, 0.0f)), pb, pc, pd);
}
material(image *img, image *bumpImg, bool shiny=true, float shininess_=30.0f/255) {
param *p = new param(img);
emission = new param(vec4(0));
specular = shiny? new param(vec4(1, 1, 1, 0)): new param(vec4(0));
bump = new param(bumpImg);
shininess = new param(vec4(shininess_, 0.0f, 0.0f, 0.0f));
init(p, p, emission, specular, bump, shininess);
}
/*
material(image *img, const vec4 &color, bool bumpy, bool shiny) {
img->multiplyColor(color);
param *p = new param(img);
emission = new param(vec4(0, 0, 0, 0));
specular = shiny ? new param(vec4(1, 1, 1, 0)) : new param(vec4(0, 0, 0, 0));
bump = bumpy ? new param(new image("!bump")) : new param(vec4(0.5f, 0.5f, 1, 0));
shininess = new param(vec4(30.0f/255, 0, 0, 0));
init(p, p, emission, specular, bump, shininess);
}
*/
void visit(visitor &v) {
v.visit(diffuse, atom_diffuse);
v.visit(ambient, atom_ambient);
v.visit(emission, atom_emission);
v.visit(specular, atom_specular);
v.visit(bump, atom_bump);
v.visit(shininess, atom_shininess);
}
void init(param *diffuse, param *ambient, param *emission, param *specular, param *bump, param *shininess) {
this->diffuse = diffuse;
this->ambient = ambient;
this->emission = emission;
this->specular = specular;
this->bump = bump;
this->shininess = shininess;
}
void init_building(param *diffuse, param *ambient, param *emission, param *specular, param *bump, param *shininess, param *building_a, param *building_b, param *building_c) {
this->diffuse = diffuse;
this->ambient = ambient;
this->emission = emission;
this->specular = specular;
this->bump = bump;
this->shininess = shininess;
this->building_a = building_a;
this->building_b = building_b;
this->building_c = building_c;
}
// make a solid color with a specular highlight
void make_color(const vec4 &color, bool bumpy, bool shiny) {
diffuse = ambient = new param(color);
emission = new param(vec4(0, 0, 0, 0));
specular = shiny ? new param(vec4(1, 1, 1, 0)) : new param(vec4(0, 0, 0, 0));
bump = bumpy ? new param(new image("!bump")) : new param(vec4(0.5f, 0.5f, 1, 0));
shininess = new param(vec4(30.0f/255, 0, 0, 0));
}
void render(bump_shader &shader, const mat4t &modelToProjection, const mat4t &modelToCamera, vec4 *light_uniforms, int num_light_uniforms, int num_lights) const {
shader.render(modelToProjection, modelToCamera, light_uniforms, num_light_uniforms, num_lights);
bind_textures();
}
void render_building(city_buildings_bump_shader &shader, const mat4t &modelToProjection, const mat4t &modelToCamera, vec4 *light_uniforms, int num_light_uniforms, int num_lights, float building_height, float building_area, int texture_switcher, int part_to_render) const {
shader.render(modelToProjection, modelToCamera, light_uniforms, num_light_uniforms, num_lights, building_height, building_area, texture_switcher, part_to_render);
bind_textures_buildings();
}
void render_skinned(bump_shader &shader, const mat4t &cameraToProjection, const mat4t *modelToCamera, int num_nodes, vec4 *light_uniforms, int num_light_uniforms, int num_lights) const {
shader.render_skinned(cameraToProjection, modelToCamera, num_nodes, light_uniforms, num_light_uniforms, num_lights);
bind_textures();
}
///////////////////////////////////////////////////
void render_road(city_bump_shader &shader, const mat4t &modelToProjection, const mat4t &modelToCamera, vec4 *light_uniforms, int num_light_uniforms, int num_lights) const {
shader.render(modelToProjection, modelToCamera, light_uniforms, num_light_uniforms, num_lights);
bind_textures();
}
};
}
| 37.688889 | 273 | 0.649469 |
f8afc0d7e6dccc74f8ed399cf4471ba0edf2b900 | 2,783 | h | C | rongwei/Tool/UIkit/NSString+GHRegular.h | zhangfuyu/rongwei | 85f7d6555a8ebf49a80f5df4f9c3fb8e23677375 | [
"Apache-2.0"
] | null | null | null | rongwei/Tool/UIkit/NSString+GHRegular.h | zhangfuyu/rongwei | 85f7d6555a8ebf49a80f5df4f9c3fb8e23677375 | [
"Apache-2.0"
] | null | null | null | rongwei/Tool/UIkit/NSString+GHRegular.h | zhangfuyu/rongwei | 85f7d6555a8ebf49a80f5df4f9c3fb8e23677375 | [
"Apache-2.0"
] | null | null | null | //
// NSString+GHRegular.h
// 掌上优医
//
// Created by GH on 2018/10/29.
// Copyright © 2018 GH. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (GHRegular)
/**
验证邮箱
@return <#return value description#>
*/
- (BOOL)isValidateEmail;
/**
验证身份证格式
@return <#return value description#>
*/
- (BOOL)isValidateIDCard;
/**
验证手机号码
@return <#return value description#>
*/
- (BOOL)isMobileNumber;
/**
验证是否纯数字
@return <#return value description#>
*/
- (BOOL)isNumber;
/**
验证是否存在特殊字符
@return <#return value description#>
*/
- (BOOL)isNormalString;
- (BOOL)isTelNum;
/**
验证是否包含 emoji 表情
@param string <#string description#>
@return <#return value description#>
*/
+ (BOOL)stringContainsEmoji:(NSString *)string;
/**
验证是否为中文
@return <#return value description#>
*/
- (BOOL)isChineseString;
- (BOOL)isEnglishString;
/**
验证是否只包含中英文
@return <#return value description#>
*/
-(BOOL)isHaveNumber;
/**
验证是否为字符和数字的结合
@return <#return value description#>
*/
- (BOOL)isCodeAndNumber;
/**
将 Unicode 编码格式字符串的转换成中文
@return <#return value description#>
*/
- (NSString *)replaceUnicode;
///**
// 将固定的表情格式转换成文字展现
//
// @param string <#string description#>
// @return <#return value description#>
// */
//- (NSString *)replaceExpression:(NSString *)string;
/**
验证只可输入中文 数字
@return <#return value description#>
*/
- (BOOL)isAlphString;
/**
验证只可输入英文 数字
@return <#return value description#>
*/
- (BOOL)isNumberAndEnglish;
/**
根据相对路径得到绝对路径
@return <#return value description#>
*/
- (NSString *)absolutePath;
/**
验证车牌
@return <#return value description#>
*/
- (BOOL)isCarNumber;
- (BOOL)isMacAddress;
/**
验证 URL
@return <#return value description#>
*/
- (BOOL)isValidUrl;
/**
验证邮编
@return <#return value description#>
*/
- (BOOL)isValidPostalcode;
/**
验证 IP
@return <#return value description#>
*/
- (BOOL)isIPAddress;
- (BOOL)isValidTaxNo;
/**
验证是否是正确格式的密码
@return <#return value description#>
*/
- (BOOL)isConnetPassword;
/**
验证银行卡号
@return <#return value description#>
*/
- (BOOL)bankCardluhmCheck;
- (BOOL)isValidWithMinLenth:(NSInteger)minLenth
maxLenth:(NSInteger)maxLenth
containChinese:(BOOL)containChinese
firstCannotBeDigtal:(BOOL)firstCannotBeDigtal;
- (BOOL)isValidWithMinLenth:(NSInteger)minLenth
maxLenth:(NSInteger)maxLenth
containChinese:(BOOL)containChinese
containDigtal:(BOOL)containDigtal
containLetter:(BOOL)containLetter
containOtherCharacter:(NSString *)containOtherCharacter
firstCannotBeDigtal:(BOOL)firstCannotBeDigtal;
+ (BOOL)isEmpty:(NSString *)str;
@end
NS_ASSUME_NONNULL_END
| 13.777228 | 61 | 0.663672 |
0a43ba75b52957e337f42c2f3c8da5bd8602bc5c | 429 | h | C | Stickies Viewer/SVReader.h | kainjow/StickiesViewer | 7f42718b04ea060c58a554cd784c4e0a2ac2bc67 | [
"MIT"
] | 2 | 2018-11-14T21:08:24.000Z | 2019-09-25T02:17:03.000Z | Stickies Viewer/SVReader.h | kainjow/StickiesViewer | 7f42718b04ea060c58a554cd784c4e0a2ac2bc67 | [
"MIT"
] | null | null | null | Stickies Viewer/SVReader.h | kainjow/StickiesViewer | 7f42718b04ea060c58a554cd784c4e0a2ac2bc67 | [
"MIT"
] | null | null | null | //
// Created by Kevin Wojniak on 2/3/12.
// Copyright (c) 2013 Kevin Wojniak. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface SVReader : NSObject
+ (NSArray *)notesWithContentsOfURL:(NSURL *)url;
@end
@interface SVNote : NSObject
@property (strong) NSAttributedString *attributedString;
@property (strong) NSDate *dateCreated;
@property (strong) NSDate *dateModified;
@property (strong) NSColor *color;
@end
| 19.5 | 58 | 0.734266 |
7415d50962050ee5598a8084e0056d662a498300 | 1,826 | c | C | examples/http-client/main.c | diemlt4/mongoose | a82b721a735a0ad5b92f59811bcaf2c74f047e53 | [
"OpenSSL"
] | null | null | null | examples/http-client/main.c | diemlt4/mongoose | a82b721a735a0ad5b92f59811bcaf2c74f047e53 | [
"OpenSSL"
] | null | null | null | examples/http-client/main.c | diemlt4/mongoose | a82b721a735a0ad5b92f59811bcaf2c74f047e53 | [
"OpenSSL"
] | null | null | null | // Copyright (c) 2020 Cesanta Software Limited
// All rights reserved
//
// Example HTTP client. Connect to `s_url`, send request, wait for a response,
// print the response and exit.
//
// To enable SSL/TLS for this client, build it like this:
// make MBEDTLS_DIR=/path/to/your/mbedtls/installation
#include "mongoose.h"
// The very first web page in history
static const char *s_url = "http://info.cern.ch";
// Print HTTP response and signal that we're done
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_CONNECT) {
// Connected to server
struct mg_str host = mg_url_host(s_url);
if (mg_url_is_ssl(s_url)) {
// If s_url is https://, tell client connection to use TLS
struct mg_tls_opts opts = {.ca = "ca.pem"};
mg_tls_init(c, &opts);
}
// Send request
mg_printf(c, "GET %s HTTP/1.0\r\nHost: %.*s\r\n\r\n", mg_url_uri(s_url),
(int) host.len, host.ptr);
} else if (ev == MG_EV_HTTP_MSG) {
// Response is received. Print it
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
printf("%.*s", (int) hm->message.len, hm->message.ptr);
c->is_closing = 1; // Tell mongoose to close this connection
*(bool *) fn_data = true; // Tell event loop to stop
}
}
int main(void) {
struct mg_mgr mgr; // Event manager
bool done = false; // Event handler flips it to true
mg_log_set("3"); // Set to 0 to disable debug
mg_mgr_init(&mgr); // Initialise event manager
mg_http_connect(&mgr, s_url, fn, &done); // Create client connection
while (!done) mg_mgr_poll(&mgr, 1000); // Infinite event loop
mg_mgr_free(&mgr); // Free resources
return 0;
}
| 38.041667 | 79 | 0.615553 |
2d3f24debdd15ea8b7c37ecc92a617257f23ae9a | 852 | h | C | ios/Frameworks/MCCMerchant.framework/Headers/MCCMasterpassButton.h | erikpoort/react-native-mastercard | 627b44b9a6b7aabfce5aecadd333d378309b3583 | [
"MIT"
] | 1 | 2019-06-27T09:52:26.000Z | 2019-06-27T09:52:26.000Z | ios/Frameworks/MCCMerchant.framework/Headers/MCCMasterpassButton.h | erikpoort/react-native-mastercard | 627b44b9a6b7aabfce5aecadd333d378309b3583 | [
"MIT"
] | 1 | 2020-01-27T08:01:16.000Z | 2020-12-08T03:46:49.000Z | ios/Frameworks/MCCMerchant.framework/Headers/MCCMasterpassButton.h | erikpoort/react-native-mastercard | 627b44b9a6b7aabfce5aecadd333d378309b3583 | [
"MIT"
] | 1 | 2019-12-06T02:25:28.000Z | 2019-12-06T02:25:28.000Z | //
// MCCMasterpassButton.h
//
// Created by Gajera, Semal on 2/12/16.
// Copyright © 2016 Mastercard. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
* MCCMasterpassButton implements a "Pay with masterpass" button on device's touch screen. This class restrict the use of UIButton methods to set title, image and also restrict to add event on UIButton.
Overview:
This class provides API to add itself to specified super view. It also handle the object that implement MCCTransactionDataSource protocol.
@date 2016-02-17
*/
@interface MCCMasterpassButton : UIButton
/**
*
* Adds button on the view.
*
* This method will add the object of MCCMasterpassButton on the passed UIView object.
*
* @param superView
UIView object on which button will be added.
*
*/
- (void)addButtonToview:(UIView* _Nonnull) superView;
@end
| 23.666667 | 202 | 0.732394 |
050657e55993373159ede1926d0edb3a56d45838 | 1,684 | h | C | filesystem/fat/include/platform.h | flit/stmp_media_archive | 69374674f714f25185fea413610ea46d8d352dd8 | [
"BSD-3-Clause"
] | 2 | 2018-01-18T21:24:33.000Z | 2021-06-13T23:30:05.000Z | filesystem/fat/include/platform.h | flit/stmp_media_archive | 69374674f714f25185fea413610ea46d8d352dd8 | [
"BSD-3-Clause"
] | null | null | null | filesystem/fat/include/platform.h | flit/stmp_media_archive | 69374674f714f25185fea413610ea46d8d352dd8 | [
"BSD-3-Clause"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
//! \addtogroup os_file
//! @{
//!
// Copyright (c) 2005 SigmaTel, Inc.
//!
//! \file platform.h
//! \brief FAT file system internal API to peek/poke inside a sector buffer.
//! \version 0.1
//! \date 03/2005
//!
//! This file provides a FAT file system internal API for reading or writing
//! 8-bit, 16-bit, or 32-bit objects inside a sector buffer.
//!
////////////////////////////////////////////////////////////////////////////////
#ifndef _PLATFORM_H
#define _PLATFORM_H
////////////////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////////////////
#include <types.h>
////////////////////////////////////////////////////////////////////////////////
// Definitions
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Prototypes
////////////////////////////////////////////////////////////////////////////////
extern int32_t FSGetByte(uint8_t *buffer, int32_t iOffsetInUint8);
extern int32_t FSGetWord(uint8_t *buffer, int32_t iOffsetInUint8);
extern uint32_t FSGetDWord(uint8_t *buffer, int32_t iOffsetInUint8);
#define FS_GET_LITTLEENDIAN_INT32(buffer, Offset) (((uint32_t *)buffer)[(Offset)>>2])
extern void PutByte(uint8_t *buffer, uint8_t byte,int32_t Offset);
extern void PutWord(uint8_t *buffer, int32_t word, int32_t Offset);
extern void PutDword(uint8_t *buffer, uint32_t dword, int32_t Offset);
#endif // _PLATFORM_H
//! @}
| 39.162791 | 86 | 0.430523 |
0caeca18df653343a27d358c66d354a3d8eb71c8 | 1,120 | c | C | src/lib/fileio/fileutils.c | shamilatesoglu/hu-cs-fall2019-assignment1 | db826d3a3bdd4ad2ece3fcaa37b7868b277aeb85 | [
"MIT"
] | null | null | null | src/lib/fileio/fileutils.c | shamilatesoglu/hu-cs-fall2019-assignment1 | db826d3a3bdd4ad2ece3fcaa37b7868b277aeb85 | [
"MIT"
] | null | null | null | src/lib/fileio/fileutils.c | shamilatesoglu/hu-cs-fall2019-assignment1 | db826d3a3bdd4ad2ece3fcaa37b7868b277aeb85 | [
"MIT"
] | 1 | 2019-12-04T19:48:09.000Z | 2019-12-04T19:48:09.000Z | //
// Created by MSA on 26/10/2019.
//
#include <stdio.h>
#include <stdlib.h>
#include "fileutils.h"
#include "../memory/memutils.h"
#include <string.h>
char *
read_file(const char *path)
{
FILE *f = fopen(path, "rb");
if (f == NULL)
{
char *msg = ALLOC(30 + strlen(path), char);
sprintf(msg, "Error while opening the file %s", path);
perror(msg);
free(msg);
exit(EXIT_FAILURE);
}
fseek(f, 0, SEEK_END);
long int fsize = ftell(f);
fseek(f, 0, SEEK_SET); /* To reset seek. */
char *string = ALLOC(fsize + 1, char);
fread(string, fsize, 1, f);
fclose(f);
string[fsize] = '\0';
return string;
}
char *
safe_read_file(const char *path)
{
FILE *f = fopen(path, "rb");
if (f == NULL)
{
return NULL;
}
fseek(f, 0, SEEK_END);
long int fsize = ftell(f);
fseek(f, 0, SEEK_SET); /* To reset seek. */
char *string = ALLOC(fsize + 1, char);
fread(string, fsize, 1, f);
fclose(f);
string[fsize] = '\0';
return string;
}
| 18.983051 | 63 | 0.517857 |
dc835938eff9b07e617e644a8fd0bc7bcd3e2856 | 1,577 | h | C | third_party/webrtc/src/chromium/src/sql/mojo/mojo_vfs.h | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 27 | 2016-04-27T01:02:03.000Z | 2021-12-13T08:53:19.000Z | third_party/webrtc/src/chromium/src/sql/mojo/mojo_vfs.h | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 2 | 2017-03-09T09:00:50.000Z | 2017-09-21T15:48:20.000Z | third_party/webrtc/src/chromium/src/sql/mojo/mojo_vfs.h | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 17 | 2016-04-27T02:06:39.000Z | 2019-12-18T08:07:00.000Z | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SQL_MOJO_MOJO_VFS_H_
#define SQL_MOJO_MOJO_VFS_H_
#include "base/macros.h"
#include "components/filesystem/public/interfaces/directory.mojom.h"
typedef struct sqlite3_vfs sqlite3_vfs;
namespace sql {
// Changes the default sqlite3 vfs to a vfs that uses proxies calls to the
// mojo:filesystem service. Instantiating this object transparently changes how
// the entire //sql/ subsystem works in the process of the caller; all paths
// are treated as relative to |directory|.
class ScopedMojoFilesystemVFS {
public:
explicit ScopedMojoFilesystemVFS(filesystem::DirectoryPtr directory);
~ScopedMojoFilesystemVFS();
// Returns the directory of the current VFS.
filesystem::DirectoryPtr& GetDirectory();
private:
friend sqlite3_vfs* GetParentVFS(sqlite3_vfs* mojo_vfs);
friend filesystem::DirectoryPtr& GetRootDirectory(sqlite3_vfs* mojo_vfs);
// The default vfs at the time MojoVFS was installed. We use the to pass
// through things like randomness requests and per-platform sleep calls.
sqlite3_vfs* parent_;
// When we initialize the subsystem, we are given a filesystem::Directory
// object, which is the root directory of a mojo:filesystem. All access to
// various files are specified from this root directory.
filesystem::DirectoryPtr root_directory_;
DISALLOW_COPY_AND_ASSIGN(ScopedMojoFilesystemVFS);
};
} // namespace sql
#endif // SQL_MOJO_MOJO_VFS_H_
| 34.282609 | 79 | 0.780596 |
67a011a3b10db5a16fe68e861b501e43a73d8419 | 3,416 | h | C | include/emane/utils/conversionutils.h | lihebi/emane | 24b626c41e36bee79884b26b8450c3932af18a5a | [
"BSD-3-Clause"
] | 114 | 2015-04-10T18:29:45.000Z | 2022-03-24T20:22:35.000Z | include/emane/utils/conversionutils.h | lihebi/emane | 24b626c41e36bee79884b26b8450c3932af18a5a | [
"BSD-3-Clause"
] | 184 | 2015-01-06T15:33:54.000Z | 2022-03-24T22:17:56.000Z | include/emane/utils/conversionutils.h | lihebi/emane | 24b626c41e36bee79884b26b8450c3932af18a5a | [
"BSD-3-Clause"
] | 34 | 2015-04-15T14:13:18.000Z | 2022-03-16T11:05:30.000Z | /*
* Copyright (c) 2013 - Adjacent Link LLC, Bridgewater, New Jersey
* Copyright (c) 2012 - DRS CenGen, LLC, Columbia, Maryland
* 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 DRS CenGen, LLC nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMANEUTILSCONVERSIONUTILS_HEADER_
#define EMANEUTILSCONVERSIONUTILS_HEADER_
#include <cmath>
#include "emane/constants.h"
namespace EMANE
{
namespace Utils
{
inline double NORMALIZE_VECTOR(const double x, const double y, const double z)
{
return sqrt((x * x) + (y * y) + (z * z));
}
inline double DEGREES_TO_RADIANS(const double deg)
{
return deg * (M_PIl / 180.0);
}
inline void AI_TO_BE_DEGREES(double & val, const double A, const double B)
{
// less than A
if (val < A)
{
while (val < A)
{
val += 360.0;
}
}
// greater or equal to B
else if(val >= B)
{
while(val >= B)
{
val -= 360.0;
}
}
}
inline void AI_TO_BI_DEGREES(double & val, const double A, const double B)
{
// less than A
if (val < A)
{
while (val < A)
{
val += 360.0;
}
}
// greater than B
else if(val > B)
{
while(val > B)
{
val -= 360.0;
}
}
}
inline void NEG_90_TO_POS_90_DEGREES(double & val)
{
// ensure (-90 <= val <= 90)
while(val > 90.0)
{
if(val < 270.0)
{
val -= 180.0;
}
else
{
val -= 360.0;
}
}
}
inline double MILLIWATT_TO_DB(double dMillWatt)
{
return 10.0 * log10(dMillWatt);
}
inline double DB_TO_MILLIWATT(double ddB)
{
return pow(10.0,ddB / 10.0);
}
}
}
#endif // EMANEUTILSCONVERSIONUTILS_HEADER_
| 26.897638 | 82 | 0.60363 |
8c95aacc218ea3c338d8f52b00d9d1cb5237dad4 | 15,872 | c | C | src/gallium/drivers/zink/zink_surface.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | src/gallium/drivers/zink/zink_surface.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | src/gallium/drivers/zink/zink_surface.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | /*
* Copyright 2018 Collabora 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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 "zink_context.h"
#include "zink_framebuffer.h"
#include "zink_resource.h"
#include "zink_screen.h"
#include "zink_surface.h"
#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
VkImageViewCreateInfo
create_ivci(struct zink_screen *screen,
struct zink_resource *res,
const struct pipe_surface *templ,
enum pipe_texture_target target)
{
VkImageViewCreateInfo ivci;
/* zero holes since this is hashed */
memset(&ivci, 0, sizeof(VkImageViewCreateInfo));
ivci.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
ivci.image = res->obj->image;
switch (target) {
case PIPE_TEXTURE_1D:
ivci.viewType = res->need_2D_zs ? VK_IMAGE_VIEW_TYPE_2D : VK_IMAGE_VIEW_TYPE_1D;
break;
case PIPE_TEXTURE_1D_ARRAY:
ivci.viewType = res->need_2D_zs ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_1D_ARRAY;
break;
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D;
break;
case PIPE_TEXTURE_2D_ARRAY:
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
break;
case PIPE_TEXTURE_CUBE:
ivci.viewType = VK_IMAGE_VIEW_TYPE_CUBE;
break;
case PIPE_TEXTURE_CUBE_ARRAY:
ivci.viewType = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
break;
case PIPE_TEXTURE_3D:
ivci.viewType = VK_IMAGE_VIEW_TYPE_3D;
break;
default:
unreachable("unsupported target");
}
ivci.format = zink_get_format(screen, templ->format);
assert(ivci.format != VK_FORMAT_UNDEFINED);
/* TODO: it's currently illegal to use non-identity swizzles for framebuffer attachments,
* but if that ever changes, this will be useful
const struct util_format_description *desc = util_format_description(templ->format);
ivci.components.r = zink_component_mapping(zink_clamp_void_swizzle(desc, PIPE_SWIZZLE_X));
ivci.components.g = zink_component_mapping(zink_clamp_void_swizzle(desc, PIPE_SWIZZLE_Y));
ivci.components.b = zink_component_mapping(zink_clamp_void_swizzle(desc, PIPE_SWIZZLE_Z));
ivci.components.a = zink_component_mapping(zink_clamp_void_swizzle(desc, PIPE_SWIZZLE_W));
*/
ivci.components.r = VK_COMPONENT_SWIZZLE_R;
ivci.components.g = VK_COMPONENT_SWIZZLE_G;
ivci.components.b = VK_COMPONENT_SWIZZLE_B;
ivci.components.a = VK_COMPONENT_SWIZZLE_A;
ivci.subresourceRange.aspectMask = res->aspect;
ivci.subresourceRange.baseMipLevel = templ->u.tex.level;
ivci.subresourceRange.levelCount = 1;
ivci.subresourceRange.baseArrayLayer = templ->u.tex.first_layer;
ivci.subresourceRange.layerCount = 1 + templ->u.tex.last_layer - templ->u.tex.first_layer;
ivci.viewType = zink_surface_clamp_viewtype(ivci.viewType, templ->u.tex.first_layer, templ->u.tex.last_layer, res->base.b.array_size);
return ivci;
}
static void
init_surface_info(struct zink_surface *surface, struct zink_resource *res, VkImageViewCreateInfo *ivci)
{
VkImageViewUsageCreateInfo *usage_info = (VkImageViewUsageCreateInfo *)ivci->pNext;
surface->info.flags = res->obj->vkflags;
surface->info.usage = usage_info ? usage_info->usage : res->obj->vkusage;
surface->info.width = surface->base.width;
surface->info.height = surface->base.height;
surface->info.layerCount = ivci->subresourceRange.layerCount;
surface->info.format = ivci->format;
surface->info_hash = _mesa_hash_data(&surface->info, sizeof(surface->info));
}
static struct zink_surface *
create_surface(struct pipe_context *pctx,
struct pipe_resource *pres,
const struct pipe_surface *templ,
VkImageViewCreateInfo *ivci)
{
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_resource *res = zink_resource(pres);
unsigned int level = templ->u.tex.level;
struct zink_surface *surface = CALLOC_STRUCT(zink_surface);
if (!surface)
return NULL;
VkImageViewUsageCreateInfo usage_info;
usage_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO;
usage_info.pNext = NULL;
VkFormatFeatureFlags feats = res->optimal_tiling ?
screen->format_props[templ->format].optimalTilingFeatures :
screen->format_props[templ->format].linearTilingFeatures;
VkImageUsageFlags attachment = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
usage_info.usage = res->obj->vkusage & ~attachment;
if ((res->obj->vkusage & attachment) &&
!(feats & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) {
ivci->pNext = &usage_info;
}
pipe_resource_reference(&surface->base.texture, pres);
pipe_reference_init(&surface->base.reference, 1);
surface->base.context = pctx;
surface->base.format = templ->format;
surface->base.width = u_minify(pres->width0, level);
assert(surface->base.width);
surface->base.height = u_minify(pres->height0, level);
assert(surface->base.height);
surface->base.nr_samples = templ->nr_samples;
surface->base.u.tex.level = level;
surface->base.u.tex.first_layer = templ->u.tex.first_layer;
surface->base.u.tex.last_layer = templ->u.tex.last_layer;
surface->obj = zink_resource(pres)->obj;
util_dynarray_init(&surface->framebuffer_refs, NULL);
util_dynarray_init(&surface->desc_set_refs.refs, NULL);
init_surface_info(surface, res, ivci);
if (VKSCR(CreateImageView)(screen->dev, ivci, NULL,
&surface->image_view) != VK_SUCCESS) {
FREE(surface);
return NULL;
}
return surface;
}
static uint32_t
hash_ivci(const void *key)
{
return _mesa_hash_data((char*)key + offsetof(VkImageViewCreateInfo, flags), sizeof(VkImageViewCreateInfo) - offsetof(VkImageViewCreateInfo, flags));
}
struct pipe_surface *
zink_get_surface(struct zink_context *ctx,
struct pipe_resource *pres,
const struct pipe_surface *templ,
VkImageViewCreateInfo *ivci)
{
struct zink_surface *surface = NULL;
struct zink_resource *res = zink_resource(pres);
uint32_t hash = hash_ivci(ivci);
simple_mtx_lock(&res->surface_mtx);
struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(&res->surface_cache, hash, ivci);
if (!entry) {
/* create a new surface */
surface = create_surface(&ctx->base, pres, templ, ivci);
surface->base.nr_samples = 0;
surface->hash = hash;
surface->ivci = *ivci;
entry = _mesa_hash_table_insert_pre_hashed(&res->surface_cache, hash, &surface->ivci, surface);
if (!entry) {
simple_mtx_unlock(&res->surface_mtx);
return NULL;
}
surface = entry->data;
} else {
surface = entry->data;
p_atomic_inc(&surface->base.reference.count);
}
simple_mtx_unlock(&res->surface_mtx);
return &surface->base;
}
static struct pipe_surface *
wrap_surface(struct pipe_context *pctx, struct pipe_surface *psurf)
{
struct zink_ctx_surface *csurf = CALLOC_STRUCT(zink_ctx_surface);
csurf->base = *psurf;
pipe_reference_init(&csurf->base.reference, 1);
csurf->surf = (struct zink_surface*)psurf;
csurf->base.context = pctx;
return &csurf->base;
}
static struct pipe_surface *
zink_create_surface(struct pipe_context *pctx,
struct pipe_resource *pres,
const struct pipe_surface *templ)
{
VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen),
zink_resource(pres), templ, pres->target);
if (pres->target == PIPE_TEXTURE_3D)
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D;
struct pipe_surface *psurf = zink_get_surface(zink_context(pctx), pres, templ, &ivci);
if (!psurf)
return NULL;
struct zink_ctx_surface *csurf = (struct zink_ctx_surface*)wrap_surface(pctx, psurf);
if (templ->nr_samples) {
/* transient fb attachment: not cached */
struct pipe_resource rtempl = *pres;
rtempl.nr_samples = templ->nr_samples;
rtempl.bind |= ZINK_BIND_TRANSIENT;
struct zink_resource *transient = zink_resource(pctx->screen->resource_create(pctx->screen, &rtempl));
if (!transient)
return NULL;
ivci.image = transient->obj->image;
csurf->transient = (struct zink_ctx_surface*)wrap_surface(pctx, (struct pipe_surface*)create_surface(pctx, &transient->base.b, templ, &ivci));
if (!csurf->transient) {
pipe_resource_reference((struct pipe_resource**)&transient, NULL);
pipe_surface_release(pctx, &psurf);
return NULL;
}
pipe_resource_reference((struct pipe_resource**)&transient, NULL);
}
return &csurf->base;
}
/* framebuffers are owned by their surfaces, so each time a surface that's part of a cached fb
* is destroyed, it has to unref all the framebuffers it's attached to in order to avoid leaking
* all the framebuffers
*
* surfaces are always batch-tracked, so it is impossible for a framebuffer to be destroyed
* while it is in use
*/
static void
surface_clear_fb_refs(struct zink_screen *screen, struct pipe_surface *psurface)
{
struct zink_surface *surface = zink_surface(psurface);
util_dynarray_foreach(&surface->framebuffer_refs, struct zink_framebuffer*, fb_ref) {
struct zink_framebuffer *fb = *fb_ref;
for (unsigned i = 0; i < fb->state.num_attachments; i++) {
if (fb->surfaces[i] == psurface) {
simple_mtx_lock(&screen->framebuffer_mtx);
fb->surfaces[i] = NULL;
_mesa_hash_table_remove_key(&screen->framebuffer_cache, &fb->state);
zink_framebuffer_reference(screen, &fb, NULL);
simple_mtx_unlock(&screen->framebuffer_mtx);
break;
}
}
}
util_dynarray_fini(&surface->framebuffer_refs);
}
void
zink_destroy_surface(struct zink_screen *screen, struct pipe_surface *psurface)
{
struct zink_surface *surface = zink_surface(psurface);
struct zink_resource *res = zink_resource(psurface->texture);
if (!psurface->nr_samples) {
simple_mtx_lock(&res->surface_mtx);
if (psurface->reference.count) {
/* got a cache hit during deletion */
simple_mtx_unlock(&res->surface_mtx);
return;
}
struct hash_entry *he = _mesa_hash_table_search_pre_hashed(&res->surface_cache, surface->hash, &surface->ivci);
assert(he);
assert(he->data == surface);
_mesa_hash_table_remove(&res->surface_cache, he);
simple_mtx_unlock(&res->surface_mtx);
}
if (!screen->info.have_KHR_imageless_framebuffer)
surface_clear_fb_refs(screen, psurface);
zink_descriptor_set_refs_clear(&surface->desc_set_refs, surface);
util_dynarray_fini(&surface->framebuffer_refs);
pipe_resource_reference(&psurface->texture, NULL);
if (surface->simage_view)
VKSCR(DestroyImageView)(screen->dev, surface->simage_view, NULL);
VKSCR(DestroyImageView)(screen->dev, surface->image_view, NULL);
FREE(surface);
}
static void
zink_surface_destroy(struct pipe_context *pctx,
struct pipe_surface *psurface)
{
struct zink_ctx_surface *csurf = (struct zink_ctx_surface *)psurface;
zink_surface_reference(zink_screen(pctx->screen), &csurf->surf, NULL);
pipe_surface_release(pctx, (struct pipe_surface**)&csurf->transient);
FREE(csurf);
}
bool
zink_rebind_surface(struct zink_context *ctx, struct pipe_surface **psurface)
{
struct zink_surface *surface = zink_surface(*psurface);
struct zink_resource *res = zink_resource((*psurface)->texture);
struct zink_screen *screen = zink_screen(ctx->base.screen);
if (surface->simage_view)
return false;
VkImageViewCreateInfo ivci = create_ivci(screen,
zink_resource((*psurface)->texture), (*psurface), surface->base.texture->target);
uint32_t hash = hash_ivci(&ivci);
simple_mtx_lock(&res->surface_mtx);
struct hash_entry *new_entry = _mesa_hash_table_search_pre_hashed(&res->surface_cache, hash, &ivci);
if (zink_batch_usage_exists(surface->batch_uses))
zink_batch_reference_surface(&ctx->batch, surface);
surface_clear_fb_refs(screen, *psurface);
zink_descriptor_set_refs_clear(&surface->desc_set_refs, surface);
if (new_entry) {
/* reuse existing surface; old one will be cleaned up naturally */
struct zink_surface *new_surface = new_entry->data;
simple_mtx_unlock(&res->surface_mtx);
zink_batch_usage_set(&new_surface->batch_uses, ctx->batch.state);
zink_surface_reference(screen, (struct zink_surface**)psurface, new_surface);
return true;
}
struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(&res->surface_cache, surface->hash, &surface->ivci);
assert(entry);
_mesa_hash_table_remove(&res->surface_cache, entry);
VkImageView image_view;
if (VKSCR(CreateImageView)(screen->dev, &ivci, NULL, &image_view) != VK_SUCCESS) {
debug_printf("zink: failed to create new imageview");
simple_mtx_unlock(&res->surface_mtx);
return false;
}
surface->hash = hash;
surface->ivci = ivci;
entry = _mesa_hash_table_insert_pre_hashed(&res->surface_cache, surface->hash, &surface->ivci, surface);
assert(entry);
surface->simage_view = surface->image_view;
surface->image_view = image_view;
surface->obj = zink_resource(surface->base.texture)->obj;
/* update for imageless fb */
surface->info.flags = res->obj->vkflags;
surface->info.usage = res->obj->vkusage;
surface->info_hash = _mesa_hash_data(&surface->info, sizeof(surface->info));
zink_batch_usage_set(&surface->batch_uses, ctx->batch.state);
simple_mtx_unlock(&res->surface_mtx);
return true;
}
struct pipe_surface *
zink_surface_create_null(struct zink_context *ctx, enum pipe_texture_target target, unsigned width, unsigned height, unsigned samples)
{
struct pipe_surface surf_templ = {0};
struct pipe_resource *pres;
struct pipe_resource templ = {0};
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
templ.format = PIPE_FORMAT_R8_UINT;
templ.target = target;
templ.bind = PIPE_BIND_RENDER_TARGET;
templ.nr_samples = samples;
pres = ctx->base.screen->resource_create(ctx->base.screen, &templ);
if (!pres)
return NULL;
surf_templ.format = PIPE_FORMAT_R8_UINT;
surf_templ.nr_samples = 0;
struct pipe_surface *psurf = ctx->base.create_surface(&ctx->base, pres, &surf_templ);
pipe_resource_reference(&pres, NULL);
return psurf;
}
void
zink_context_surface_init(struct pipe_context *context)
{
context->create_surface = zink_create_surface;
context->surface_destroy = zink_surface_destroy;
}
| 38.430993 | 151 | 0.714529 |
4c82f13ebdeff522e9c19fcbe040dedff5d0b61e | 830 | h | C | HLT/EMCAL/OnlineDisplay/AliHLTEMCALGetEventButton.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | HLT/EMCAL/OnlineDisplay/AliHLTEMCALGetEventButton.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | HLT/EMCAL/OnlineDisplay/AliHLTEMCALGetEventButton.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | //-*- Mode: C++ -*-
// $Id: AliHLTEMCALGetEventButton.h 29824 2008-11-10 13:43:55Z richterm $
#ifndef ALIHLTEMCALGETEVENTBUTTON_H
#define ALIHLTEMCALGETEVENTBUTTON_H
/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
#include <TGButton.h>
#include <TGFrame.h>
class AliHLTEMCALOnlineDisplay;
class AliHLTEMCALGetEventButton : public TGTextButton
{
public:
AliHLTEMCALGetEventButton();
AliHLTEMCALGetEventButton(TGGroupFrame *gfPtr, char *name, char opt ='e');
AliHLTEMCALGetEventButton(TGCompositeFrame *gfPtr, char *name, char opt='e');
// AliHLTEMCALGetEventButton(AliHLTEMCALOnlineDisplay *gfPtr, char *name);
virtual Bool_t HandleButton(Event_t* event);
private:
AliHLTEMCALOnlineDisplay* onlineDisplayPtr;
char fOption;
};
#endif
| 29.642857 | 79 | 0.768675 |
482ab59a26b9b356536f777bc0add977f63e729a | 733 | h | C | src/gui/PRBaseInfoViewController.h | musicman3320/Pandorita | 7d63abde20ba00eeee71117d93145561d6aa9c14 | [
"MIT"
] | 4 | 2015-02-04T18:42:32.000Z | 2015-10-21T09:36:35.000Z | src/gui/PRBaseInfoViewController.h | musicman3320/Pandorita | 7d63abde20ba00eeee71117d93145561d6aa9c14 | [
"MIT"
] | 2 | 2016-01-25T20:05:09.000Z | 2016-08-27T18:36:57.000Z | src/gui/PRBaseInfoViewController.h | musicman3320/Pandorita | 7d63abde20ba00eeee71117d93145561d6aa9c14 | [
"MIT"
] | null | null | null | //
// PRBaseInfoViewController.h
// Pandorita
//
// Created by Chris O'Neill on 10/24/12.
//
//
#import <Cocoa/Cocoa.h>
#import "TFHpple.h"
@interface PRBaseInfoViewController : NSViewController <NSTextViewDelegate>
{
CGFloat desiredHeight;
}
- (NSString *)title;
- (CGFloat)desiredHeight;
// call from a separate thread
- (BOOL)downloadData;
// call from the main thread
- (void)displayData;
+ (NSString *)pandoritaLinkForLink:(NSString *)linkStr;
+ (NSAttributedString *)attributedString:(NSAttributedString *)str forLink:(NSString *)link;
+ (NSAttributedString *)attributedStringForElement:(TFHppleElement *)element;
+ (BOOL)textView:(NSTextView *)aTextView clickedOnLink:(id)link atIndex:(NSUInteger)charIndex;
@end
| 21.558824 | 94 | 0.748977 |
21c95f218515703c2e1f92753849ae5029cd977b | 2,280 | h | C | src/hal/m5fire.h | DierkJ/ESP32-Paxcounter | 37582b39bdd26b56da8c9f9c4644edf5d8260737 | [
"Apache-2.0"
] | null | null | null | src/hal/m5fire.h | DierkJ/ESP32-Paxcounter | 37582b39bdd26b56da8c9f9c4644edf5d8260737 | [
"Apache-2.0"
] | null | null | null | src/hal/m5fire.h | DierkJ/ESP32-Paxcounter | 37582b39bdd26b56da8c9f9c4644edf5d8260737 | [
"Apache-2.0"
] | null | null | null | // clang-format off
// upload_speed 921600
// board m5stack-fire
#ifndef _M5FIRE_H
#define _M5FIRE_H
#include <stdint.h>
#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no M5 RA01 LoRa module
#define LORA_SCK SCK
#define LORA_CS SS
#define LORA_MISO MISO
#define LORA_MOSI MOSI
#define LORA_RST GPIO_NUM_26
#define LORA_IRQ GPIO_NUM_36
#define LORA_IO1 GPIO_NUM_34 // must be wired by you on PCB!
#define LORA_IO2 LMIC_UNUSED_PIN
// enable only if you want to store a local paxcount table on the device
#define HAS_SDCARD 1 // this board has an SD-card-reader/writer
#define SDCARD_CS GPIO_NUM_4
#define SDCARD_MOSI MOSI
#define SDCARD_MISO MISO
#define SDCARD_SCLK SCK
// user defined sensors
//#define HAS_SENSORS 1 // comment out if device has user defined sensors
#define CFG_sx1276_radio 1 // select LoRa chip
#define BOARD_HAS_PSRAM // use if board has external PSRAM
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
//#define HAS_DISPLAY 2 // TFT-LCD, support work in progess, not ready yet
//#define MY_DISPLAY_FLIP 1 // use if display is rotated
//#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board
#define HAS_LED NOT_A_PIN // no on board LED
#define RGB_LED_COUNT 5 // we use 5 of 10 LEDs (1 side)
#define HAS_RGB_LED SmartLed rgb_led(LED_SK6812, RGB_LED_COUNT, GPIO_NUM_15) // LED_SK6812 RGB LED on GPIO15
#define HAS_BUTTON (39) // on board button A
// GPS settings
#define HAS_GPS 0 // use on board GPS
#define GPS_SERIAL 9600, SERIAL_8N1, RXD2, TXD2 // UBlox NEO 6M RX, TX
// #define GPS_INT GPIO_NUM_35 // 30ns accurary timepulse, to be external wired on pcb: shorten R12!
// Display Settings
#define MY_DISPLAY_WIDTH 320
#define MY_DISPLAY_HEIGHT 240
#define MY_DISPLAY_TYPE LCD_ILI9341
#define MY_DISPLAY_CS GPIO_NUM_14 // Display CS pin
#define MY_DISPLAY_CLK GPIO_NUM_18 // SPI CLOCK pin
#define MY_DISPLAY_DC GPIO_NUM_27 // Display command/data pin
#define MY_DISPLAY_MOSI GPIO_NUM_23 // SPI MOSI
#define MY_DISPLAY_MISO GPIO_NUM_19 // SPI MISO
#define MY_DISPLAY_BL GPIO_NUM_32 // backlight control
#define MY_DISPLAY_RST GPIO_NUM_33 // RESET control
#endif | 36.774194 | 108 | 0.777632 |
3456ae6f3b84dadd542c397d2a2bd0db3e3c4848 | 830 | h | C | TBToolCategory/Classes/tools/TZDateFormatter.h | Bintong/TBToolCategory | e9f7e5ff7ea75c28c8ed763c34b42902bf321b07 | [
"MIT"
] | 46 | 2019-03-18T02:53:06.000Z | 2021-11-14T15:06:54.000Z | Example/Pods/TBToolCategory/TBToolCategory/Classes/TZDateFormatter.h | Bintong/TBFormFactory | 9476f41213dca11dca5d756948cb2a99fc9081b0 | [
"MIT"
] | 2 | 2019-04-02T03:59:55.000Z | 2019-04-11T08:27:38.000Z | Example/Pods/TBToolCategory/TBToolCategory/Classes/TZDateFormatter.h | Bintong/TBFormFactory | 9476f41213dca11dca5d756948cb2a99fc9081b0 | [
"MIT"
] | 5 | 2019-04-02T02:05:58.000Z | 2019-09-05T18:51:32.000Z | //
// TZDateFormatter.h
// disUser
//
// Created by YXY on 2019/1/29.
// Copyright © 2019 songshupinpin. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TZDateFormatter : NSObject
//yyyy-MM-dd HH:mm:ss
+ (NSDateFormatter *)shareYearMonthDayAndHourMinutesSecondsFormatter;
//yyyy-MM-dd HH:mm
+ (NSDateFormatter *)shareYearMonthDayAndHourMinutesFormatter;
//yyyy-MM-dd
+ (NSDateFormatter *)shareYearMonthDayFormatter;
//MM-dd
+ (NSDateFormatter *)shareMonthDayFormatter;
//yyyy年mm月
+ (NSDateFormatter *)shareYearMonthAsChineseFormatter;
//yyyy年MM月dd日
+ (NSDateFormatter *)shareYearMonthDayAsChineseFormatter;
//MM月dd日
+ (NSDateFormatter *)shareMonthDayAsChineseFormatter;
//MM月dd日 HH:mm
+ (NSDateFormatter *)shareMonthDayHHMMAsChineseFormatter;
@end
NS_ASSUME_NONNULL_END
| 20.75 | 69 | 0.787952 |
4ef5f3100691c5e94b87123a59b007d1da2be3c3 | 1,514 | h | C | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/HLPCacheResponseInfo.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-03-29T12:08:37.000Z | 2021-05-26T05:20:11.000Z | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/HLPCacheResponseInfo.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | null | null | null | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/HLPCacheResponseInfo.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-04-17T03:24:04.000Z | 2022-03-30T05:42:17.000Z | //
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <objc/NSObject.h>
@class HLPCacheMatchInfo, NSDictionary, NSMutableURLRequest, NSString, NSURLResponse;
@interface HLPCacheResponseInfo : NSObject
{
NSString *_source;
double _timeStamp;
NSString *_key;
long long _type;
HLPCacheMatchInfo *_mathInfo;
NSDictionary *_responseDic;
NSString *_responseString;
NSURLResponse *_response;
NSMutableURLRequest *_request;
}
+ (id)createWithRequestInfo:(id)arg1 responseDic:(id)arg2 responseString:(id)arg3 response:(id)arg4 request:(id)arg5;
@property(retain, nonatomic) NSMutableURLRequest *request; // @synthesize request=_request;
@property(retain, nonatomic) NSURLResponse *response; // @synthesize response=_response;
@property(retain, nonatomic) NSString *responseString; // @synthesize responseString=_responseString;
@property(retain, nonatomic) NSDictionary *responseDic; // @synthesize responseDic=_responseDic;
@property(retain, nonatomic) HLPCacheMatchInfo *mathInfo; // @synthesize mathInfo=_mathInfo;
@property(nonatomic) long long type; // @synthesize type=_type;
@property(retain, nonatomic) NSString *key; // @synthesize key=_key;
@property(nonatomic) double timeStamp; // @synthesize timeStamp=_timeStamp;
@property(copy, nonatomic) NSString *source; // @synthesize source=_source;
- (void).cxx_destruct;
- (id)init;
@end
| 38.820513 | 117 | 0.757596 |
fbdcd893308c2081da62aec94f4f1f20c07c89ea | 11,553 | c | C | ctlib/cterror.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 5 | 2015-03-12T03:01:01.000Z | 2020-11-22T18:30:25.000Z | ctlib/cterror.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 5 | 2017-01-30T13:21:04.000Z | 2021-02-09T12:03:08.000Z | ctlib/cterror.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 10 | 2015-07-24T19:19:37.000Z | 2020-11-22T18:30:27.000Z | /*******************************************************************************
*
* MODULE: cterror.c
*
********************************************************************************
*
* DESCRIPTION: Error reporting for the ctlib
*
********************************************************************************
*
* Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
* This program is free software; you can redistribute it and/or modify
* it under the same terms as Perl itself.
*
*******************************************************************************/
/*===== GLOBAL INCLUDES ======================================================*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
/*===== LOCAL INCLUDES =======================================================*/
#include "cterror.h"
#include "util/memalloc.h"
#include "ucpp/cpp.h"
#include "ucpp/mem.h"
#include "cppreent.h"
/*===== DEFINES ==============================================================*/
#define INIT_CHECK \
do { \
if (!initialized) \
{ \
fprintf(stderr, "FATAL: print functions have not been set!\n"); \
abort(); \
} \
} while(0)
/*===== TYPEDEFS =============================================================*/
/*===== STATIC FUNCTION PROTOTYPES ===========================================*/
static CTLibError *error_new(enum CTErrorSeverity severity, void *str);
static void error_delete(CTLibError *error);
static void push_str(CParseInfo *pCPI, enum CTErrorSeverity severity, void *str);
static void push_verror(CParseInfo *pCPI, enum CTErrorSeverity severity,
const char *fmt, va_list *pap);
/*===== EXTERNAL VARIABLES ===================================================*/
/*===== GLOBAL VARIABLES =====================================================*/
/*===== STATIC VARIABLES =====================================================*/
static int initialized = 0;
static PrintFunctions F;
/*===== STATIC FUNCTIONS =====================================================*/
/*******************************************************************************
*
* ROUTINE: error_new
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
static CTLibError *error_new(enum CTErrorSeverity severity, void *str)
{
CTLibError *perr;
const char *string;
size_t len;
string = F.cstring(str, &len);
AllocF(CTLibError *, perr, sizeof(CTLibError));
AllocF(char *, perr->string, len + 1);
perr->severity = severity;
strncpy(perr->string, string, len);
perr->string[len] = '\0';
return perr;
}
/*******************************************************************************
*
* ROUTINE: error_delete
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
static void error_delete(CTLibError *error)
{
if (error)
{
if (error->string)
Free(error->string);
Free(error);
}
}
/*******************************************************************************
*
* ROUTINE: push_str
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
static void push_str(CParseInfo *pCPI, enum CTErrorSeverity severity, void *str)
{
if (pCPI == NULL || pCPI->errorStack == NULL)
F.fatalerr(str);
LL_push(pCPI->errorStack, error_new(severity, str));
}
/*******************************************************************************
*
* ROUTINE: push_verror
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
static void push_verror(CParseInfo *pCPI, enum CTErrorSeverity severity,
const char *fmt, va_list *pap)
{
void *str = F.newstr();
F.vscatf(str, fmt, pap);
push_str(pCPI, severity, str);
F.destroy(str);
}
/*===== FUNCTIONS ============================================================*/
/*******************************************************************************
*
* ROUTINE: set_print_functions
*
* WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void set_print_functions(PrintFunctions *pPF)
{
if (pPF->newstr == NULL ||
pPF->destroy == NULL ||
pPF->scatf == NULL ||
pPF->vscatf == NULL ||
pPF->cstring == NULL ||
pPF->fatalerr == NULL)
{
fprintf(stderr, "FATAL: all print functions must be set!\n");
abort();
}
F = *pPF;
initialized = 1;
}
/*******************************************************************************
*
* ROUTINE: pop_all_errors
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void pop_all_errors(CParseInfo *pCPI)
{
LL_flush(pCPI->errorStack, (LLDestroyFunc) error_delete);
}
/*******************************************************************************
*
* ROUTINE: push_error
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void push_error(CParseInfo *pCPI, const char *fmt, ...)
{
va_list ap;
INIT_CHECK;
va_start(ap, fmt);
push_verror(pCPI, CTES_ERROR, fmt, &ap);
va_end(ap);
}
/*******************************************************************************
*
* ROUTINE: push_warning
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void push_warning(CParseInfo *pCPI, const char *fmt, ...)
{
va_list ap;
INIT_CHECK;
va_start(ap, fmt);
push_verror(pCPI, CTES_WARNING, fmt, &ap);
va_end(ap);
}
/*******************************************************************************
*
* ROUTINE: fatal_error
*
* WRITTEN BY: Marcus Holland-Moritz ON: Nov 2003
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void fatal_error(const char *fmt, ...)
{
va_list ap;
void *str;
INIT_CHECK;
va_start(ap, fmt);
str = F.newstr();
F.vscatf(str, fmt, &ap);
va_end(ap);
F.fatalerr(str);
}
/*******************************************************************************
*
* ROUTINE: my_ucpp_ouch
*
* WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void my_ucpp_ouch(pUCPP_ char *fmt, ...)
{
va_list ap;
void *str;
INIT_CHECK;
va_start(ap, fmt);
str = F.newstr();
F.scatf(str, "%s: (FATAL) ", r_current_filename);
F.vscatf(str, fmt, &ap);
va_end(ap);
F.fatalerr(str);
}
/*******************************************************************************
*
* ROUTINE: my_ucpp_error
*
* WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void my_ucpp_error(pUCPP_ long line, char *fmt, ...)
{
va_list ap;
void *str;
INIT_CHECK;
va_start(ap, fmt);
str = F.newstr();
if (line > 0)
F.scatf(str, "%s, line %ld: ", r_current_filename, line);
else if (line == 0)
F.scatf(str, "%s: ", r_current_filename);
F.vscatf(str, fmt, &ap);
if (line >= 0)
{
struct stack_context *sc = report_context(aUCPP);
size_t i;
for (i = 0; sc[i].line >= 0; i++)
F.scatf(str, "\n\tincluded from %s:%ld",
sc[i].long_name ? sc[i].long_name : sc[i].name,
sc[i].line);
freemem(sc);
}
va_end(ap);
push_str(r_callback_arg, CTES_ERROR, str);
F.destroy(str);
}
/*******************************************************************************
*
* ROUTINE: my_ucpp_warning
*
* WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002
* CHANGED BY: ON:
*
********************************************************************************
*
* DESCRIPTION:
*
* ARGUMENTS:
*
* RETURNS:
*
*******************************************************************************/
void my_ucpp_warning(pUCPP_ long line, char *fmt, ...)
{
va_list ap;
void *str;
INIT_CHECK;
va_start(ap, fmt);
str = F.newstr();
if (line > 0)
F.scatf(str, "%s, line %ld: (warning) ",
r_current_filename, line);
else if (line == 0)
F.scatf(str, "%s: (warning) ", r_current_filename);
else
F.scatf(str, "(warning) ");
F.vscatf(str, fmt, &ap);
if (line >= 0)
{
struct stack_context *sc = report_context(aUCPP);
size_t i;
for (i = 0; sc[i].line >= 0; i++)
F.scatf(str, "\n\tincluded from %s:%ld",
sc[i].long_name ? sc[i].long_name : sc[i].name,
sc[i].line);
freemem(sc);
}
va_end(ap);
push_str(r_callback_arg, CTES_WARNING, str);
F.destroy(str);
}
| 24.845161 | 81 | 0.358608 |
d50c2678b020b29a3c2021db4744289680512e26 | 688 | h | C | buffer/buffer_pool.h | invzhi/vtab | 8af23691c51651dda35707e437b3361a49b47fb4 | [
"MIT"
] | null | null | null | buffer/buffer_pool.h | invzhi/vtab | 8af23691c51651dda35707e437b3361a49b47fb4 | [
"MIT"
] | null | null | null | buffer/buffer_pool.h | invzhi/vtab | 8af23691c51651dda35707e437b3361a49b47fb4 | [
"MIT"
] | null | null | null | #ifndef VTAB_BUFFER_BUFFER_POOL_H
#define VTAB_BUFFER_BUFFER_POOL_H
#include <list>
#include <mutex>
#include <unordered_map>
#include "page/page.h"
#include "disk/disk.h"
#include "buffer/lru.h"
class BufferPool {
public:
BufferPool(size_t size, Disk *disk);
~BufferPool();
Page *NewPage();
Page *FetchPage(PageID page_id);
bool UnpinPage(PageID page_id, bool is_dirty);
bool FlushPage(PageID page_id);
void FlushAllPages();
bool DeletePage(PageID page_id);
private:
size_t size_;
Page *pages_;
Disk *disk_;
std::unordered_map<PageID, Page *> *page_table_;
LRUReplacer<Page *> *replacer_;
std::list<Page *> *free_list_;
std::mutex mutex_;
};
#endif
| 19.657143 | 50 | 0.72093 |
80bd8cc5d9053420890d290a4469ba882aa9a5da | 667 | c | C | C-Programs/drawChessBoard.c | adityaverma121/Simple-Programs | 8450560b97f89e0fa3da16a623ad35c0b26409c9 | [
"MIT"
] | 71 | 2021-09-30T11:25:12.000Z | 2021-10-03T11:33:22.000Z | C-Programs/drawChessBoard.c | adityaverma121/Simple-Programs | 8450560b97f89e0fa3da16a623ad35c0b26409c9 | [
"MIT"
] | 186 | 2021-09-30T12:25:16.000Z | 2021-10-03T13:45:04.000Z | C-Programs/drawChessBoard.c | adityaverma121/Simple-Programs | 8450560b97f89e0fa3da16a623ad35c0b26409c9 | [
"MIT"
] | 385 | 2021-09-30T11:34:23.000Z | 2021-10-03T13:41:00.000Z | void drawChessBoard()
{
printf("this is a function for drawing the chess board \n");
int temp = 1;
int highest = 9;
for (int i = 0; i < 8; i++)
{
for (int j = temp; j < highest; j++)
{
if (j % 2 == 0)
{
printf(" B ");
}
else
{
printf(" W ");
}
}
if (temp == 1 && highest == 9)
{
temp = 0;
highest = 8;
}
else
{
temp = 1;
highest = 9;
}
printf("\n");
}
printf("\n");
}
int main()
{
drawChessBoard();
}
| 17.102564 | 64 | 0.323838 |
c53b95283fe473bf9814c39aa4fdd33770898606 | 14,843 | c | C | src/Posts/involution_mix.c | Marc-B-Reynolds/Stand-alone-junk | 05921f91ea1d7a8552311bf6b21ebcbf23a53c26 | [
"Unlicense"
] | 29 | 2016-04-19T14:53:48.000Z | 2021-12-28T22:04:16.000Z | src/Posts/involution_mix.c | Marc-B-Reynolds/Stand-alone-junk | 05921f91ea1d7a8552311bf6b21ebcbf23a53c26 | [
"Unlicense"
] | null | null | null | src/Posts/involution_mix.c | Marc-B-Reynolds/Stand-alone-junk | 05921f91ea1d7a8552311bf6b21ebcbf23a53c26 | [
"Unlicense"
] | 7 | 2016-02-16T14:40:11.000Z | 2020-09-03T22:34:09.000Z | // Public Domain under http://unlicense.org, see link for details.
// http://marc-b-reynolds.github.io/
#include <stdint.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
// if defined run testu01 (needs to be installed if enabled) rabbit battery
// clang -O3 -Wall -Wextra -o foo involution_mix.c -lm -ltestu01 -lmylib
//#define TESTU01
// number of draws for avalanche test
//#define SAC_LEN 0x00800000 // post uses this
#define SAC_LEN 0x003fffff
//#define SAC_LEN 0x0003ffff
//#define SAC_LEN 0x000fffff
//#define DUMP_FIGURE
// if defined brute force check function is an involution
//#define VALIDATE_INVOLUTION
#if defined(TESTU01)
#define RABBIT
// number of draws for rabbit test
#define RABBIT_DRAWS 2048.0
// run smallcrush battery if defined
#define SMALLCRUSH
// run crush battery if defined (FYI: call it 25-30 minute per hash function)
//#define CRUSH
#endif
// function pointers
typedef uint32_t (*hash32_t)(uint32_t);
typedef uint64_t (*hash64_t)(uint64_t);
typedef enum
{
F_INVOL = 1<<0
} flag_t;
typedef struct {
hash32_t f;
uint32_t flags;
char* name;
} hash32_table_t;
//---------------------------------------
void u64_array_print(uint64_t* d, uint32_t n)
{
printf("{");
for (uint32_t i=0; i<n-1; i++)
printf("%ld,", d[i]);
printf("%ld}\n", d[n-1]);
}
void u64_array_print_f(uint64_t* d, uint32_t n, double s)
{
printf("{");
for (uint32_t i=0; i<n-1; i++)
printf("%f,", s*(double)d[i]);
printf("%f}\n", s*(double)d[n-1]);
}
void u64_array_print_e(uint64_t* d, uint32_t n, double s)
{
printf("{");
for (uint32_t i=0; i<n-1; i++)
printf("%e,", s*(double)d[i]);
printf("%e}\n", s*(double)d[n-1]);
}
static uint64_t rng_state[2] = {0xac564b0527d4eb2d, 0};
inline uint64_t rotl(const uint64_t v, int i)
{
#if defined(__clang__)
return __builtin_rotateleft64(v,(uint32_t)i);
#else
return (v << i)|(v >> (64-i));
#endif
}
inline uint64_t rng_u64(void)
{
uint64_t s0 = rng_state[0];
uint64_t s1 = rng_state[1];
uint64_t r = s0 + s1;
s1 ^= s0;
rng_state[0] = rotl(s0,55) ^ s1 ^ (s1<<14);
rng_state[1] = rotl(s1,36);
return r;
}
inline uint32_t rng_u32(void)
{
return (uint32_t)rng_u64();
}
// end of PRNG
// Sobol stuff
typedef struct { uint32_t i, d0; } sobol32_t;
typedef struct { uint64_t i, d0; } sobol64_t;
sobol32_t sobol32 = { .d0=0, .i=~0u };
sobol64_t sobol64 = { .d0=0, .i=~0u };
inline void sobol32_init(uint32_t hash)
{
sobol32.d0 = hash;
sobol32.i = ~0u;
}
inline void sobol64_init(uint64_t hash)
{
sobol64.d0 = hash;
sobol64.i = ~0u;
}
inline void sobol32_update()
{
uint32_t c = (uint32_t)__builtin_ctz(sobol32.i);
sobol32.d0 ^= 0x80000000 >> c;
sobol32.i -= 1;
}
inline void sobol64_update()
{
uint64_t c = (uint64_t)__builtin_ctzl(sobol64.i);
sobol64.d0 ^= 0x8000000000000000LL >> c;
sobol64.i -= 1;
}
inline uint32_t sobol32_next()
{
sobol32_update();
return sobol32.d0;
}
inline uint64_t sobol64_next()
{
sobol64_update();
return sobol64.d0;
}
// rotate left
inline uint32_t rot(uint32_t x, uint32_t i)
{
#if defined(__clang__)
return __builtin_rotateleft32(x,i);
#elif defined(_MSC_VER)
return _rotl(x,i);
#else
return (x << i) | (x >> (-i & 31));
#endif
}
inline uint32_t xor_rot2(uint32_t x, uint32_t a, uint32_t b)
{
return x^rot(x,a)^rot(x,b);
}
inline uint32_t xor_rot3(uint32_t x, uint32_t a, uint32_t b, uint32_t c)
{
return rot(x,a)^rot(x,b)^rot(x,c);
}
#define UNUSED __attribute__((unused))
// a uniform random number for baseline
uint32_t ref(UNUSED uint32_t h)
{
// the XORing of hi into lo bits is overkill..but why not
uint64_t u = rng_u64();
u ^= u >> 32;
return (uint32_t)u;
}
// wang hash
uint32_t wang(uint32_t h)
{
h = (h ^ 61) ^ (h >> 16);
h *= 9;
h = h ^ (h >> 4);
h *= 0x27d4eb2d;
h = h ^ (h >> 15);
return h;
}
// xxHash
uint32_t xxh32(uint32_t h)
{
h ^= h >> 15; h *= 0x85ebca77;
h ^= h >> 13; h *= 0xc2b2ae3d;
h ^= h >> 16;
return h;
}
// MurmurHash3
uint32_t mh3(uint32_t h)
{
h ^= h >> 16; h *= 0x85ebca6b;
h ^= h >> 13; h *= 0xc2b2ae35;
h ^= h >> 16;
return h;
}
// https://github.com/skeeto/hash-prospector
uint32_t hp0(uint32_t x)
{
x ^= x >> 16; x *= 0x7feb352d;
x ^= x >> 15; x *= 0x846ca68b;
x ^= x >> 16;
return x;
}
// https://github.com/skeeto/hash-prospector
uint32_t hp1(uint32_t x)
{
x ^= x >> 17; x *= 0xed5ad4bb;
x ^= x >> 11; x *= 0xac4c1b51;
x ^= x >> 15; x *= 0x31848bab;
x ^= x >> 14;
return x;
}
// pcg_output_rxs_m_xs_32_32
uint32_t pcg(uint32_t x)
{
uint32_t t = ((x >> ((x >> 28) + 4)) ^ x) * 277803737;
return (t >> 22) ^ t;
}
// bad idea #1
uint32_t g0(uint32_t x)
{
if (x & 1) {
x *= 0xac564b05;
x += 0x85ebca77;
}
else {
x -= 0x85ebca77;
x *= 0xdc33c9cd;
}
return x;
}
#define M0 0x5f356495
#define M1 0x32c446bd
//#define M0 0xac564b05
//#define M1 0xdc33c9cd
//#define M0 0x2c9277b5
//#define M1 0xcc2bfe9d
//#define M0 0x34ed9de5
//#define M1 0xec2c57ed
//#define M0 0x01c8e815
//#define M1 0x608fa73d
uint32_t f0(uint32_t x)
{
x *= M0;
x ^= (x>>25);
x *= M1;
return x;
}
// involution rot2 is (x,K,K+16)
uint32_t f1(uint32_t x)
{
x *= M0;
x = xor_rot2(x,6,22);
x *= M1;
return x;
}
uint32_t f2(uint32_t x)
{
x ^= x >> 16;
x *= M0;
x = xor_rot2(x,6,22);
x *= M1;
x ^= x >> 16;
return x;
}
uint32_t f3(uint32_t x)
{
x = xor_rot2(x,11,16); x *= M0;
x = xor_rot2(x, 6,22); x *= M1;
x = xor_rot3(x,10,21,26);
return x;
}
// goodness of fit statstics
typedef struct {
double perBitX2;
double iBitX2;
double oBitX2;
double maxBias;
double iMaxBias;
double oMaxBias;
} gof_t;
// oi = 1st index: bit position of flipped input
// 2nd index: bit position in output
typedef struct {
uint64_t oi[32][32]; // per bit position counts
uint64_t oiI[32]; // output bit
uint64_t oiO[32]; // input bit
uint64_t pop[33]; // population count
gof_t le; // gof for low entropy input
gof_t he; // gof for high entropy input
uint32_t n; // number of inputs processed
} stats32_t;
double bias_max(uint64_t* d, double s, uint32_t n)
{
double max = 0.0;
for(uint32_t i=0; i<n; i++) {
double t = fabs(fma((double)d[i],s, -1.0));
max = (max >= t) ? max : t;
}
return max;
}
// hack dump for blog plots
void bias_array(uint64_t* d, double s, uint32_t w, uint32_t h)
{
printf("[");
do {
h--;
uint32_t id = w*h;
for(uint32_t x=0; x<w; x++) {
double v = fma((double)d[id+x], s, -1.0);
uint32_t m = (uint32_t)round(255.0*v);
printf("%d,",m);
}
} while(h != 0);
printf("]\n");
}
// Core of computing a chi-squared statistic where the expected
// distribution is uniform: Sum[(oi[n]-e)^2]
// oi: observed counts
// e: expected counts (scaled probablity)
// n: length of array (oi)
// The final division (and any extra required scaling) is up
// to the caller.
static double gof_chi_squared_eq(uint64_t* oi, uint32_t n, double e)
{
#if 0
double r = 0.0;
for (uint32_t i=0; i<n; i++) {
double d = ((double)oi[i])-e;
r = fma(d,d,r);
}
return r;
#else
double r0 = 0.0;
double r1 = 0.0;
double r2 = 0.0;
double r3 = 0.0;
uint32_t j = n >> 2;
uint32_t i = 0;
while(j != 0) {
double d0 = ((double)oi[i ])-e;
double d1 = ((double)oi[i+1])-e;
double d2 = ((double)oi[i+2])-e;
double d3 = ((double)oi[i+3])-e;
r0 = fma(d0,d0,r0);
r1 = fma(d1,d1,r1);
r2 = fma(d2,d2,r2);
r3 = fma(d3,d3,r3);
i += 4; j--;
}
double re = 0.0;
n &= 3;
while (n != 0) {
double d = ((double)oi[i])-e;
re = fma(d,d,re);
i++; n--;
}
return r0+r1+r2+r3+re;
#endif
}
// walk the per-bit data and compute a chi-squared statistic
static double bias_chi_squared(stats32_t* s)
{
uint32_t n = s->n;
// each bit as p=.5 of being flipped so expected counts per bin is n/2
double ei = (double)n*0.5;
double base = sqrt(gof_chi_squared_eq(&s->oi[0][0], 32*32, ei));
// the 'n' input samples have each bit flipped (the extra 32 factor)
return (100.0/(32.0*ei))*base;
}
// clear all incremental count storage and
// reset any PRNG and/or LDS to common starting point
void bias_clear_counts(stats32_t* s)
{
s->n = 0;
memset(&s->oi, 0, sizeof(s->oi));
memset(&s->oiI, 0, sizeof(s->oiI));
memset(&s->oiO, 0, sizeof(s->oiO));
memset(&s->pop, 0, sizeof(s->pop));
rng_state[0] = 0xac564b0527d4eb2d;
rng_state[1] = 0x85ebca77;
sobol32_init(0);
}
void sac_gather_oio(stats32_t* s)
{
for (uint32_t j=0; j<32; j++) {
uint64_t sum = 0;
for (uint32_t i=0; i<32; i++) {
sum += s->oi[i][j];
}
s->oiO[j] = sum;
}
}
// gather counts with low-entropy input
void sac_le_count_32(stats32_t* s, hash32_t f, uint32_t n)
{
s->n += n;
// walk the 'n' samples
for(uint32_t i=0; i<n; i++) {
uint32_t x = sobol32_next();
uint32_t h = f(x);
// flip each bit of input 'x'
for (uint32_t i=0; i<32; i++) {
uint32_t t = h ^ f(x ^ (1<<i));
uint32_t pop = 0;
// gather bit-by-bit counts
for (uint32_t j=0; j<32; j++) {
uint32_t b = (t >> j) & 1;
pop += b;
s->oi[i][j] += b;
}
s->oiI[i] += pop;
s->pop[pop]++;
}
}
}
// gather counts with 'n' high-entropy values (add extra count gathering of le variant)
void sac_he_count_32(stats32_t* s, hash32_t f, uint32_t n)
{
s->n += n;
for(uint32_t i=0; i<n; i++) {
uint32_t x = rng_u32();
uint32_t h = f(x);
for (uint32_t i=0; i<32; i++) {
uint32_t t = h ^ f(x ^ (1<<i));
uint32_t pop = 0;
for (uint32_t j=0; j<32; j++) {
uint32_t b = (t >> j) & 1;
pop += b;
s->oi[i][j] += b;
}
s->oiI[i] += pop;
s->pop[pop]++;
}
}
}
// gather counts with very low-entropy input {0,1,2...}
void sac_vle_count_32(stats32_t* s, hash32_t f, uint32_t n)
{
s->n += n;
for(uint32_t i=0; i<n; i++) {
uint32_t x = i;
uint32_t h = f(x);
for (uint32_t i=0; i<32; i++) {
uint32_t t = h ^ f(x ^ (1<<i));
uint32_t pop = 0;
for (uint32_t j=0; j<32; j++) {
uint32_t b = (t >> j) & 1;
pop += b;
s->oi[i][j] += b;
}
s->oiI[i] += pop;
s->pop[pop]++;
}
}
}
void gof_print(gof_t* gof)
{
printf("max: %g, chi: %f\n", gof->maxBias,gof->perBitX2);
}
// helper: chi-squared for oiI & oiO
double bias_chi_squared_rc(stats32_t* s, uint64_t* o)
{
double e = (32.0/2.0)*(double)s->n;
double r = sqrt(gof_chi_squared_eq(o, 32, e));
return (100.0/e)*r;
}
void sac_gof_32(stats32_t* s, gof_t* gof)
{
// 1/expected
double ie = 2.0/s->n;
sac_gather_oio(s);
gof->perBitX2 = bias_chi_squared(s);
gof->iBitX2 = bias_chi_squared_rc(s,&s->oiI[0]);
gof->oBitX2 = bias_chi_squared_rc(s,&s->oiO[0]);
gof->maxBias = 100.0*bias_max(&s->oi[0][0], ie, 32*32);
gof->iMaxBias = 100.0*bias_max(&s->oiI[0], ie*(1.0/32.0), 32);
gof->oMaxBias = 100.0*bias_max(&s->oiO[0], ie*(1.0/32.0), 32);
#if defined(DUMP_FIGURE)
bias_array(&s->oi[0][0], ie, 32,32);
#endif
}
// helpers: gather 'n' samples and gen all statistics
void sac_vle_32(stats32_t* s, hash32_t f, uint32_t n)
{
sac_vle_count_32(s,f,n);
sac_gof_32(s, &s->le);
}
void sac_le_32(stats32_t* s, hash32_t f, uint32_t n)
{
sac_le_count_32(s,f,n);
sac_gof_32(s, &s->le);
}
// helper: gather 'n' samples and gen all statistics
void sac_he_32(stats32_t* s, hash32_t f, uint32_t n)
{
sac_he_count_32(s,f,n);
sac_gof_32(s, &s->he);
}
#if defined(TESTU01)
#include "gdef.h"
#include "swrite.h"
#include "bbattery.h"
#include "scomp.h"
#include "swalk.h"
#include "svaria.h"
#include "util.h"
#include "unif01.h"
#include "swrite.h"
#include <float.h>
static uint32_t state;
static uint32_t next_u32(UNUSED void* p, hash32_t func)
{
return func(state++);
}
static double next_f64(void* p, void* s)
{
uint32_t a = next_u32(p,s);
uint32_t b = next_u32(p,s);
uint64_t i = (((uint64_t)a) << 21) + (((uint64_t)b) >> 11);
return (double)i*0x1.0p-53;
}
static void print_state(UNUSED void* s)
{
printf(" S = 0x%04x\n", state);
}
static unif01_Gen tu01 =
{
.name = "temp",
.GetU01 = (void*)&next_f64,
.GetBits = (void*)&next_u32,
.Write = &print_state
};
#endif
// brute-force check that 'func' is an involution
void rt_sanity(hash32_t func)
{
printf(" round-trip: ");
uint32_t i=0;
do {
uint32_t r = func(func(i));
if (r != i) {
printf("failed\n");
return;
}
} while(++i != 0);
printf("pass\n");
}
static void test_32(hash32_table_t* t)
{
hash32_t f = t->f;
#if 1
stats32_t stats = {.oi={{0}}};
printf("TESTING: %s\n", t->name);
sac_vle_32(&stats,f, SAC_LEN);
printf("cn: "); gof_print(&stats.le);
bias_clear_counts(&stats);
sac_le_32(&stats,f, SAC_LEN);
printf("le: "); gof_print(&stats.le);
bias_clear_counts(&stats);
sac_he_32(&stats,f, SAC_LEN);
printf("he: "); gof_print(&stats.he);
#endif
#if defined(DUMP_RAW_EXTRA)
printf("oiI:"); u64_array_print(&stats.oiI[0], 32);
printf("oiO:"); u64_array_print(&stats.oiO[0], 32);
printf("pop:"); u64_array_print(&stats.pop[0], 32);
#endif
#if defined(TESTU01)
state = 0;
tu01.state = f;
tu01.name = t->name;
#if defined(RABBIT)
bbattery_Rabbit(&tu01, RABBIT_DRAWS*32.0);
#endif
#if defined(SMALLCRUSH)
bbattery_SmallCrush(&tu01);
#endif
#if defined(CRUSH)
bbattery_Crush(&tu01);
#endif
#endif
#if defined(VALIDATE_INVOLUTION)
if (t->flags & F_INVOL)
rt_sanity(f);
#endif
printf("-------------\n");
}
#define M0 0x5f356495
#define M1 0x32c446bd
uint32_t foo(uint32_t x)
{
x ^= x >> 17;
x *= M0;
x ^= x >> 25;
x *= M1;
x ^= x >> 17;
return x;
}
static hash32_table_t hash32_table[] =
{
#if 1
{.f = &ref, .name = "baseline", .flags=0 },
{.f = &g0, .name = "g0", .flags=F_INVOL },
{.f = &f0, .name = "f0", .flags=F_INVOL },
{.f = &f1, .name = "f1", .flags=F_INVOL },
{.f = &f2, .name = "f2", .flags=F_INVOL },
{.f = &f3, .name = "f3", .flags=F_INVOL },
//{.f = &wang, .name = "wang", .flags=0 },
{.f = &xxh32, .name = "xxhash32", .flags=0 },
{.f = &mh3, .name = "murmurhash3", .flags=0 },
{.f = &hp0, .name = "lowbias", .flags=0 },
{.f = &hp1, .name = "triple32", .flags=0 },
//{.f = &pcg, .name = "pcg", .flags=0 }
#else
{.f = &foo, .name = "foo", .flags=0 }
#endif
};
static const uint32_t num_hash32 = sizeof(hash32_table)/sizeof(hash32_table[0]);
int main()
{
#if defined(TESTU01)
swrite_Basic = FALSE; // only print summary
#endif
for(uint32_t i=0; i<num_hash32; i++)
test_32(hash32_table+i);
return 0;
}
| 19.530263 | 87 | 0.589706 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.