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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e0f3824589db9109efcce4957b2d47f25252a4d5 | 2,503 | h | C | Headers/Frameworks/Flexo/FFXMLParameterNode.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | 3 | 2020-11-19T10:04:02.000Z | 2021-10-02T17:25:21.000Z | Headers/Frameworks/Flexo/FFXMLParameterNode.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | null | null | null | Headers/Frameworks/Flexo/FFXMLParameterNode.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | null | null | null | //
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Mar 11 2021 20:53:35).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class NSMutableArray, NSString, NSXMLElement;
__attribute__((visibility("hidden")))
@interface FFXMLParameterNode : NSObject
{
NSString *_name;
NSString *_paramKey;
NSString *_value;
NSMutableArray *_keyframes;
NSMutableArray *_subnodes;
CDStruct_1b6d18a9 _fadeIn;
CDStruct_1b6d18a9 _fadeOut;
int _fadeInType;
int _fadeOutType;
BOOL _isDefault;
BOOL _saveWhenAtDefaultState;
BOOL _disabled;
BOOL _canBeDisabled;
BOOL _disabledByDefault;
NSXMLElement *_sourceXMLElement;
NSString *_initialValue;
}
@property(retain, nonatomic) NSXMLElement *sourceXMLElement; // @synthesize sourceXMLElement=_sourceXMLElement;
@property(nonatomic) BOOL disabledByDefault; // @synthesize disabledByDefault=_disabledByDefault;
@property(nonatomic) BOOL canBeDisabled; // @synthesize canBeDisabled=_canBeDisabled;
@property(nonatomic) BOOL disabled; // @synthesize disabled=_disabled;
@property(nonatomic) BOOL saveWhenAtDefaultState; // @synthesize saveWhenAtDefaultState=_saveWhenAtDefaultState;
@property(nonatomic) BOOL isDefault; // @synthesize isDefault=_isDefault;
@property(retain, nonatomic) NSString *initialValue; // @synthesize initialValue=_initialValue;
@property(retain, nonatomic) NSString *paramKey; // @synthesize paramKey=_paramKey;
@property(retain, nonatomic) NSString *name; // @synthesize name=_name;
- (id)copyAsVector;
- (BOOL)isVector;
- (BOOL)_checkUniformKeyframes:(id *)arg1 count:(unsigned long long)arg2;
- (void)removeObjectFromSubnodesAtIndex:(unsigned long long)arg1;
- (void)insertObject:(id)arg1 inSubnodesAtIndex:(unsigned long long)arg2;
- (id)subnodeAtIndex:(unsigned long long)arg1;
- (id)subnodes;
- (unsigned long long)countOfSubnodes;
- (void)setFadeOutType:(int)arg1 duration:(CDStruct_1b6d18a9)arg2;
- (void)setFadeInType:(int)arg1 duration:(CDStruct_1b6d18a9)arg2;
- (int)fadeOutCurve;
- (int)fadeInCurve;
- (CDStruct_1b6d18a9)fadeOutDuration;
- (CDStruct_1b6d18a9)fadeInDuration;
- (void)setValue:(id)arg1 interpolation:(id)arg2 forTime:(CDStruct_1b6d18a9)arg3 smooth:(BOOL)arg4;
- (void)setValue:(id)arg1 interpolation:(id)arg2 forTime:(CDStruct_1b6d18a9)arg3;
- (unsigned long long)keyframeIndexForObject:(id)arg1 startingAtIndex:(unsigned long long)arg2;
- (id)keyframes;
- (id)initWithName:(id)arg1;
- (id)init;
- (void)dealloc;
@end
| 38.507692 | 112 | 0.771874 |
0b0bb87a96509639841bd6d3ab7634967bca58b7 | 302 | h | C | MLN-iOS/Example/MLN/DataBind/MLNDataBindArrayViewController.h | mmdongxin/MLN | 9e39f4c8e4f4fbe8015dd3458036625cb8e7092a | [
"MIT"
] | 1,615 | 2019-09-19T09:36:39.000Z | 2022-03-31T13:05:47.000Z | MLN-iOS/Example/MLN/DataBind/MLNDataBindArrayViewController.h | zhanghesheng/MLN | ecbcc26a6c0b54c885f86c5dfdf9cc3314b92220 | [
"MIT"
] | 193 | 2019-09-19T09:10:03.000Z | 2022-02-23T02:48:02.000Z | MLN-iOS/Example/MLN/DataBind/MLNDataBindArrayViewController.h | zhanghesheng/MLN | ecbcc26a6c0b54c885f86c5dfdf9cc3314b92220 | [
"MIT"
] | 203 | 2019-09-19T09:39:22.000Z | 2022-03-27T12:18:44.000Z | //
// MLNDataBindArrayViewController.h
// LuaNative
//
// Created by Dai Dongpeng on 2020/5/12.
// Copyright © 2020 MoMo. All rights reserved.
//
#import "MLNUIViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface MLNDataBindArrayViewController : MLNUIViewController
@end
NS_ASSUME_NONNULL_END
| 16.777778 | 63 | 0.774834 |
719a248b85d343218ddc0b630baa68f616a50a31 | 1,415 | h | C | src/schemeMate_memory.h | stefanseibert/schemeMate | e07a0e377ce30bebc7a0e9235e3d3d61bfdd8b93 | [
"MIT"
] | null | null | null | src/schemeMate_memory.h | stefanseibert/schemeMate | e07a0e377ce30bebc7a0e9235e3d3d61bfdd8b93 | [
"MIT"
] | null | null | null | src/schemeMate_memory.h | stefanseibert/schemeMate | e07a0e377ce30bebc7a0e9235e3d3d61bfdd8b93 | [
"MIT"
] | null | null | null | #ifndef MEMORY_HEADER
#define MEMORY_HEADER
#include "schemeMate_objects.h"
#define USE_REAL_HASH
#define INITIAL_SYMBOLTABLE_SIZE 1009
#define _INIT_BUFFER_SIZE 32
enum streamformat
{
FILE_STREAM,
STRING_STREAM
};
struct sm_stream_type
{
enum streamformat type;
FILE* file;
char* string;
int index;
int peek;
};
typedef struct sm_stream_type* sm_stream;
typedef struct buffer_struct {
char *memory;
int size;
int filled;
} buffer;
static sm_obj eof_singleton;
static sm_obj *symbolTable = NULL;
static int numKnownSymbols = 0;
static int symbolTableSize = 0;
void init_memory(int running_mode);
void shutdown_memory();
sm_obj new_int(int value);
sm_obj new_symbol(char* chars);
sm_obj new_string(char* chars);
sm_obj new_cons(sm_obj car, sm_obj cdr);
sm_obj sm_eof();
sm_obj sm_nil();
sm_obj sm_false();
sm_obj sm_true();
sm_obj sm_void();
sm_obj really_new_symbol(char* chars);
sm_stream new_file_stream(FILE* inFile);
sm_stream new_string_stream(char* string);
static sm_obj create_singleton(sm_tag tag);
static sm_obj get_symbol_or_null(char* chars);
static void remember_symbol(sm_obj obj);
static void grow_symbol_table();
static void check_table_size();
// Hash function
static inline long str_hash(char *cp) {
long hVal = 0;
char c;
#ifdef USE_REAL_HASH
while ((c = *cp++) != '\0') {
hVal = (hVal*63)+(c & 0xFF);
}
#endif
return(hVal);
}
#endif // MEMORY_HEADER | 20.214286 | 46 | 0.751237 |
bc618b2b566430774c87056aba68b24bfb8fd4f4 | 21,461 | c | C | trunk/xymonnet/netmodule.c | eagle-1/xymon | 2190e5b59c860fb1bb4e88075c61a1a25da04206 | [
"MIT"
] | null | null | null | trunk/xymonnet/netmodule.c | eagle-1/xymon | 2190e5b59c860fb1bb4e88075c61a1a25da04206 | [
"MIT"
] | null | null | null | trunk/xymonnet/netmodule.c | eagle-1/xymon | 2190e5b59c860fb1bb4e88075c61a1a25da04206 | [
"MIT"
] | null | null | null | /*----------------------------------------------------------------------------*/
/* Xymon monitor network test tool. */
/* */
/* Copyright (C) 2004-2011 Henrik Storner <henrik@hswn.dk> */
/* */
/* This program is released under the GNU General Public License (GPL), */
/* version 2. See the file "COPYING" for details. */
/* */
/*----------------------------------------------------------------------------*/
static char rcsid[] = "$Id$";
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <glob.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/wait.h>
#include "libxymon.h"
#include "tcptalk.h"
#include "sendresults.h"
#include "netmodule.h"
#include "netsql.h"
#define FORK_INTERVAL 100000 /* Microseconds for usleep() - 100000 = 0.1 second */
int timeout = 0;
char *extargs[10] = { NULL, };
/* pendingtests and donetests are a list of myconn_t records which holds the data for each test. */
static listhead_t *pendingtests = NULL;
static listhead_t *donetests = NULL;
static listhead_t *ip4tests = NULL, *ip6tests = NULL;
/*
* iptree is a cross-reference index that maps IP-adresses to record
* in the "pendingtests" list.
* It doesn't have any records on its own - it is just a tree indexed
* by the myconn_t pendingtests records' IP-address.
* We need it because fping returns only the IP's, not the hostnames that
* we must use when reporting back the results.
*/
static void *iptree = NULL;
/* "activeprocesses" is a list of the processes currently running */
typedef struct activeprocessrec_t {
pid_t pid;
char *basefn;
int subid;
void *datap;
time_t timeout;
int killcount;
struct timespec starttime;
} activeprocessrec_t;
static listhead_t *activeprocesses = NULL;
int running = 1;
time_t nextconfigreload = 0;
void sig_handler(int signum)
{
switch (signum) {
case SIGTERM:
case SIGINT:
running = 0;
break;
case SIGHUP:
nextconfigreload = 0;
break;
}
}
static pid_t launch_worker(char *workerdata, int talkproto, int subid, char *basefn, void *datap, char *opt1, char *opt2)
{
/*
* Fork a new worker process.
*/
int pfd[2];
pid_t workerpid;
if (pipe(pfd) == -1) {
errprintf("Cannot create pipe to worker process: %s\n", strerror(errno));
return 0;
}
workerpid = fork();
if (workerpid < 0) {
errprintf("Cannot fork worker process: %s\n", strerror(errno));
return 0;
}
else if (workerpid == 0) {
/* Child process */
char *workeroutfn, *workererrfn, *cmd;
int outfile, errfile;
char *cmdargs[10];
char timeoutstr[20];
int i;
close(pfd[1]); /* Close write end of pipe */
cmd = NULL;
memset(cmdargs, 0, sizeof(cmdargs));
sprintf(timeoutstr, "--timeout=%d", timeout);
dbgprintf("Running worker process in pid %d\n", (int)getpid());
workeroutfn = (char *)malloc(strlen(basefn) + 16);
sprintf(workeroutfn, "%s.%010d.out", basefn, (int)getpid());
workererrfn = (char *)malloc(strlen(basefn) + 16);
sprintf(workererrfn, "%s.%010d.err", basefn, (int)getpid());
outfile = open(workeroutfn, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR);
if (outfile == -1) errprintf("Cannot create file %s : %s\n", workeroutfn, strerror(errno));
errfile = open(workererrfn, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR);
if (errfile == -1) errprintf("Cannot create file %s : %s\n", workererrfn, strerror(errno));
if ((outfile == -1) || (errfile == -1)) {
/* Ouch - cannot create our output files. Abort. */
errprintf("Cannot create output/error files\n");
exit(EXIT_FAILURE);
}
/* Assign stdin to the pipe */
close(STDIN_FILENO);
if (dup2(pfd[0], STDIN_FILENO) != 0);
close(pfd[0]); /* No longer needed */
/* Assign stdout to the output logfile */
close(STDOUT_FILENO);
if (dup2(outfile, STDOUT_FILENO) != 0);
/* Assign stderr to the error logfile */
close(STDERR_FILENO);
if (dup2(errfile, STDERR_FILENO) != 0);
switch (talkproto) {
case TALK_PROTO_PING:
switch (subid) {
case 4: cmd = "fping4"; break;
case 6: cmd = "fping6"; break;
default: break;
}
/* Setup command line args. Should probably be configurable - at least the count */
cmdargs[1] = "-C3";
cmdargs[2] = "-q";
break;
case TALK_PROTO_LDAP:
cmd = "ldaptalk";
cmdargs[1] = timeoutstr;
cmdargs[2] = workerdata;
cmdargs[3] = opt1;
cmdargs[4] = opt2;
break;
case TALK_PROTO_EXTERNAL:
cmd = extargs[0];
for (i=1; (extargs[i] && (i < (sizeof(extargs)/sizeof(extargs[0])))); i++) {
if (strcasecmp(extargs[i], "%TEST") == 0) {
cmdargs[i-1] = workerdata;
}
else if (strcasecmp(extargs[i], "%IP") == 0) {
cmdargs[i-1] = opt1;
}
else {
cmdargs[i-1] = extargs[i];
}
}
break;
default:
break;
}
if (cmd) {
cmdargs[0] = cmd;
execvp(cmd, cmdargs);
}
/* Should never go here ... just kill the child */
errprintf("Command '%s' failed: %s\n", cmd, strerror(errno));
exit(EXIT_FAILURE);
}
else if (workerpid > 0) {
listitem_t *lwalk;
activeprocessrec_t *actrec;
/* Parent - feed IP's to the child, and add the child PID to our list of running worker processes. */
close(pfd[0]); /* Close read end of pipe */
switch (talkproto) {
case TALK_PROTO_PING:
if (subid == 4) lwalk = ip4tests->head;
else if (subid == 6) lwalk = ip6tests->head;
else lwalk = NULL;
while (lwalk) {
listitem_t *lnext = lwalk->next;
myconn_t *testrec = (myconn_t *)lwalk->data;
/* Set workerpid here, so we dont have to walk the list twice */
testrec->workerpid = workerpid;
write(pfd[1], testrec->netparams.destinationip, strlen(testrec->netparams.destinationip));
write(pfd[1], "\n", 1);
list_item_move(pendingtests, lwalk, "");
lwalk = lnext;
}
break;
case TALK_PROTO_LDAP:
case TALK_PROTO_EXTERNAL:
break;
default:
break;
}
close(pfd[1]);
actrec = (activeprocessrec_t *)calloc(1, sizeof(activeprocessrec_t));
actrec->pid = workerpid;
actrec->basefn = strdup(basefn);
actrec->subid = subid;
actrec->datap = datap;
actrec->timeout = gettimer() + timeout;
actrec->killcount = 0;
getntimer(&actrec->starttime);
list_item_create(activeprocesses, actrec, "");
/* Dont fork-bomb the system */
usleep(FORK_INTERVAL);
}
return workerpid;
}
static int scan_queue(char *id, int talkproto, int batchsize)
{
char basefn[PATH_MAX];
char *location, *hname, *ip, *testspec, *extras;
int intervalms, timeoutms;
int count = 0;
/* See what network we'll test */
location = xgetenv("XYMONNETWORK");
if (strlen(location) == 0) location = NULL;
dbgprintf("Scanning queue %s\n", id);
sprintf(basefn, "%s/moduledata-%s-%d-%s", xgetenv("XYMONTMP"), id, talkproto, (location ? location : ""));
while (xymon_sqldb_netmodule_row(id, location, &hname, &testspec, &ip, &extras, &intervalms, &timeoutms, batchsize)) {
void *hinfo;
int ipfamily = 0;
hinfo = hostinfo(hname);
ipfamily = conn_is_ip(ip);
if (hinfo && ip && (ipfamily != 0) && testspec) {
myconn_t *testrec;
char *username, *password;
xtreePos_t handle;
/*
* Lots of list / queue manipulation here.
* 1) Create a "myconn_t" record for the test - this will be used to
* collect test data and eventually submitted to send_test_results() for
* reporting the test results back to xymond.
* 2) Add the myconn_t record to the "pendingtests" list of active tests.
* 3) For ping tests: create / update a record in the "iptree" tree,
* so we can map the IP reported by fping back to the test record.
*/
testrec = (myconn_t *)calloc(1, sizeof(myconn_t));
testrec->talkprotocol = talkproto;
testrec->hostinfo = hinfo;
testrec->netparams.destinationip = strdup(ip);
testrec->interval = (intervalms / 1000);
testrec->timeout = (timeoutms / 1000);
testrec->teststarttime = getcurrenttime(NULL);
switch (talkproto) {
case TALK_PROTO_PING:
/* Add the test only if we haven't got it already */
handle = xtreeFind(iptree, ip);
if (handle == xtreeEnd(iptree)) {
xtreeAdd(iptree, testrec->netparams.destinationip, testrec);
switch (ipfamily) {
case 4:
testrec->listitem = list_item_create(ip4tests, testrec, testrec->testspec);
break;
case 6:
testrec->listitem = list_item_create(ip6tests, testrec, testrec->testspec);
break;
default:
break;
}
testrec->testspec = strdup(testspec);
}
break;
case TALK_PROTO_LDAP:
/* We do one ldaptalk process per test */
/* A plain "ldap" or "ldaps" test is converted to URL format on the fly */
if ((strcmp(testspec, "ldap") == 0) || (strcmp(testspec, "ldaps") == 0)) {
char urlspec[100];
sprintf(urlspec, "%s://%s/", testspec, ip);
testrec->testspec = strdup(urlspec);
}
else {
testrec->testspec = strdup(testspec);
}
testrec->listitem = list_item_create(pendingtests, testrec, testrec->testspec);
username = password = NULL;
if (extras && *extras) {
username = strtok(extras, ":");
if (username) password = strtok(NULL, "\t\r\n");
}
testrec->workerpid = launch_worker(testrec->testspec, TALK_PROTO_LDAP, 0, basefn, testrec, username, password);
break;
case TALK_PROTO_EXTERNAL:
/* We do one process per external test */
testrec->testspec = strdup(testspec);
testrec->listitem = list_item_create(pendingtests, testrec, testrec->testspec);
testrec->workerpid = launch_worker(testrec->testspec, TALK_PROTO_EXTERNAL, 0, basefn, testrec, ip, NULL);
break;
default:
break;
}
if (!testrec->listitem) {
/* Didn't add the test - zap the unused record */
if (testrec->testspec) xfree(testrec->testspec);
if (testrec->netparams.destinationip) xfree(testrec->netparams.destinationip);
if (testrec->netparams.sslname) xfree(testrec->netparams.sslname);
xfree(testrec);
}
}
count++;
}
switch (talkproto) {
case TALK_PROTO_PING:
/* We do one ping process per IP protocol for the entire batch */
if (ip4tests->len > 0) {
launch_worker(NULL, TALK_PROTO_PING, 4, basefn, NULL, NULL, NULL);
}
if (ip6tests->len > 0) {
launch_worker(NULL, TALK_PROTO_PING, 6, basefn, NULL, NULL, NULL);
}
break;
case TALK_PROTO_LDAP:
case TALK_PROTO_EXTERNAL:
/* Have already forked the children */
break;
default:
break;
}
return count;
}
static int collect_ping_results(void)
{
pid_t pid;
int status;
listitem_t *actwalk;
activeprocessrec_t *actrec;
listitem_t *testwalk;
myconn_t *testrec;
int found = 0;
/* Wait for one of the childs to finish */
pid = waitpid(-1, &status, WNOHANG);
if (pid == -1) {
if (errno != ECHILD) errprintf("waitpid failed: %s\n", strerror(errno));
return 0;
}
else if (pid == 0) {
return 0;
}
dbgprintf("waitpid returned pid %d\n", (int)pid);
/* Find the data about the process that finished */
actwalk = (listitem_t *)activeprocesses->head;
do {
actrec = (activeprocessrec_t *)actwalk->data;
found = (actrec->pid == pid);
if (!found) actwalk = actwalk->next;
} while (actwalk && !found);
if (found) list_item_delete(actwalk, "");
if (WIFEXITED(status)) {
char fn[PATH_MAX];
FILE *fd;
char l[1024];
xtreePos_t handle;
dbgprintf("Process %d terminated with status %d, testing IPv%d adresses\n", (int)pid, WEXITSTATUS(status), actrec->subid);
/*
* fping - when run with the -q option - sends all data to stderr (!)
*/
sprintf(fn, "%s.%010d.err", actrec->basefn, (int)pid);
fd = fopen(fn, "r");
if (!fd) {
errprintf("Cannot open file %s\n", fn);
goto collectioncleanup;
}
while (fgets(l, sizeof(l), fd)) {
char *ip, *delim, *results;
dbgprintf("%s", l);
ip = strtok(l, " \t");
delim = (ip ? strtok(NULL, " \t") : NULL);
results = (delim ? strtok(NULL, "\r\n") : NULL);
if (ip && results) {
handle = xtreeFind(iptree, ip);
if (handle != xtreeEnd(iptree)) {
int testcount = 0;
double pingtime = 0.0;
char *tok;
testrec = (myconn_t *)xtreeData(iptree, handle);
if (!testrec->textlog) testrec->textlog = newstrbuffer(0);
addtobuffer(testrec->textlog, results);
tok = strtok(results, " \t");
while (tok) {
if (strcmp(tok, "-") != 0) {
testcount++;
pingtime += atof(tok);
}
tok = strtok(NULL, " \t");
}
if (testcount > 0) {
testrec->elapsedus = ((1000.0 * pingtime) / testcount);
testrec->talkresult = TALK_OK;
}
else {
testrec->talkresult = TALK_CONN_FAILED;
}
testrec->testendtime = getcurrenttime(NULL);
list_item_move(donetests, testrec->listitem, "");
}
}
}
collectioncleanup:
if (fd) fclose(fd);
sprintf(fn, "%s.%010d.out", actrec->basefn, (int)pid);
if (!debug) remove(fn);
sprintf(fn, "%s.%010d.err", actrec->basefn, (int)pid);
if (!debug) remove(fn);
xfree(actrec->basefn);
xfree(actrec);
}
/* If there are any test records left in "pendingtests" which were handled by this worker process, then flag them as failed. */
testwalk = (listitem_t *)pendingtests->head;
while (testwalk) {
listitem_t *tnext = testwalk->next;
testrec = (myconn_t *)testwalk->data;
if (testrec->workerpid == pid) {
testrec->talkresult = TALK_MODULE_FAILED;
list_item_move(donetests, testwalk, "");
}
testwalk = tnext;
}
return 1;
}
static int collect_generic_results(char *toolid, int talkproto)
{
pid_t pid;
int status;
listitem_t *actwalk;
activeprocessrec_t *actrec;
myconn_t *testrec = NULL;
int found = 0;
char fn[PATH_MAX];
FILE *fd = NULL;
char l[1024];
/* Wait for one of the childs to finish */
pid = waitpid(-1, &status, WNOHANG);
if (pid == -1) {
dbgprintf("waitpid failed: %s\n", strerror(errno));
return 0;
}
else if (pid == 0) {
return 0;
}
dbgprintf("waitpid returned pid %d\n", (int)pid);
/* Find the data about the process that finished */
actwalk = (listitem_t *)activeprocesses->head;
do {
actrec = (activeprocessrec_t *)actwalk->data;
found = (actrec->pid == pid);
if (!found) actwalk = actwalk->next;
} while (actwalk && !found);
if (found) {
list_item_delete(actwalk, "");
testrec = (myconn_t *)actrec->datap;
}
if (!testrec) goto collectioncleanup;
testrec->testendtime = getcurrenttime(NULL);
if (!testrec->textlog) testrec->textlog = newstrbuffer(0);
if (WIFEXITED(status) && (WEXITSTATUS(status) == 0)) {
struct timespec now;
testrec->talkresult = TALK_OK;
getntimer(&now);
testrec->elapsedus = ntimerus(&actrec->starttime, &now);
sprintf(fn, "%s.%010d.out", actrec->basefn, (int)pid);
fd = fopen(fn, "r");
if (!fd) {
errprintf("Cannot open file %s\n", fn);
}
else {
while (fgets(l, sizeof(l), fd)) addtobuffer(testrec->textlog, l);
fclose(fd);
}
}
else {
testrec->talkresult = TALK_CONN_FAILED;
if (WIFEXITED(status)) {
switch (talkproto) {
case TALK_PROTO_LDAP:
switch (WEXITSTATUS(status)) {
case 1: /* Parse error */
case 2: /* Bind failed */
testrec->talkresult = TALK_CONN_FAILED;
break;
case 3: /* Bind timeout */
case 4: /* Search timeout */
testrec->talkresult = TALK_CONN_TIMEOUT;
break;
case 5: /* Search failed */
testrec->talkresult = TALK_BADDATA;
break;
}
break;
default:
break;
}
}
*l = '\0';
if (WIFEXITED(status)) sprintf(l, "%s process terminated with error status %d\n", toolid, WEXITSTATUS(status));
if (WIFSIGNALED(status)) sprintf(l, "%s process terminated by signal %d\n", toolid, WTERMSIG(status));
if (*l != '\0') {
errprintf("%s", l);
addtobuffer(testrec->textlog, l);
}
sprintf(fn, "%s.%010d.err", actrec->basefn, (int)pid);
fd = fopen(fn, "r");
if (!fd) {
errprintf("Cannot open file %s\n", fn);
}
else {
while (fgets(l, sizeof(l), fd)) addtobuffer(testrec->textlog, l);
fclose(fd);
}
}
list_item_move(donetests, testrec->listitem, "");
collectioncleanup:
sprintf(fn, "%s.%010d.out", actrec->basefn, (int)pid);
if (!debug) remove(fn);
sprintf(fn, "%s.%010d.err", actrec->basefn, (int)pid);
if (!debug) remove(fn);
if (actrec) {
xfree(actrec->basefn);
xfree(actrec);
}
return 1;
}
static int collect_ldap_results(void)
{
return collect_generic_results("ldaptalk", TALK_PROTO_LDAP);
}
static int collect_external_results(char *id)
{
return collect_generic_results(id, TALK_PROTO_EXTERNAL);
}
static void kill_stalled_tasks(void)
{
listitem_t *actwalk;
time_t now = gettimer();
actwalk = (listitem_t *)activeprocesses->head;
while (actwalk) {
activeprocessrec_t *actrec = (activeprocessrec_t *)actwalk->data;
if (actrec->timeout < now) {
/* Too old - kill it. On the next loop, collect_*_results() will pick it up. */
kill(actrec->pid, (actrec->killcount == 0) ? SIGTERM : SIGKILL);
actrec->killcount++;
}
actwalk = actwalk->next;
}
}
int main(int argc, char **argv)
{
int argi;
char *queueid = NULL, *collectorname;
int mytalkprotocol = TALK_PROTO_PING;
char *location = NULL;
int concurrency = 0;
int batchsize = 0;
int usebackfeedqueue = 0;
libxymon_init(argv[0]);
for (argi=1; (argi < argc); argi++) {
if (strcmp(argv[argi], "ping") == 0) {
queueid = argv[argi];
mytalkprotocol = TALK_PROTO_PING;
if (!timeout) timeout = 200;
if (!batchsize) batchsize = 500;
if (!concurrency) concurrency = 5;
}
else if (strcmp(argv[argi], "ldap") == 0) {
queueid = argv[argi];
mytalkprotocol = TALK_PROTO_LDAP;
if (!timeout) timeout = 30;
}
else if (queueid || *(argv[argi]) != '-') {
/* External network test module */
if (!queueid) {
queueid = argv[argi];
mytalkprotocol = TALK_PROTO_EXTERNAL;
if (!timeout) timeout = 30;
}
else {
int n;
for (n = 0; (extargs[n] && (n < (sizeof(extargs) / sizeof(extargs[0])))); n++) ;
if (n < (sizeof(extargs) / sizeof(extargs[0]))) {
extargs[n] = argv[argi];
}
}
}
else if (standardoption(argv[argi])) {
if (showhelp) return 0;
}
else if (argnmatch(argv[argi], "--timeout=")) {
char *p = strchr(argv[argi], '=');
timeout = atoi(p+1);
}
else if (argnmatch(argv[argi], "--concurrency=")) {
char *p = strchr(argv[argi], '=');
concurrency = atoi(p+1);
}
else if (argnmatch(argv[argi], "--batch-size=")) {
char *p = strchr(argv[argi], '=');
batchsize = atoi(p+1);
}
}
if (!queueid) {
errprintf("Unknown queue, aborting\n");
return 1;
}
collectorname = (char *)malloc(strlen(programname) + strlen(queueid) + 2);
sprintf(collectorname, "%s.%s", programname, queueid);
if (!concurrency) concurrency = 5;
if (!batchsize) batchsize = 10000;
{
struct sigaction sa;
setup_signalhandler(programname);
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_handler;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
}
if (xymon_sqldb_init() != 0) {
errprintf("Cannot open Xymon SQLite database - aborting\n");
return 1;
}
usebackfeedqueue = (sendmessage_init_local() > 0);
/* See what network we'll test */
location = xgetenv("XYMONNETWORK");
if (strlen(location) == 0) location = NULL;
if (mytalkprotocol == TALK_PROTO_PING) iptree = xtreeNew(strcmp);
activeprocesses = list_create("activeprocesses");
pendingtests = list_create("pending");
donetests = list_create("done");
ip4tests = list_create("ip4tests");
ip6tests = list_create("ip6tests");
while (running) {
time_t now = gettimer();
int anyaction = 0;
dbgprintf("Main loop\n");
if (now > nextconfigreload) {
nextconfigreload = now + 600;
load_hostnames("@", NULL, get_fqdn());
}
if (activeprocesses->len > 0) {
dbgprintf("Collecting results\n");
switch (mytalkprotocol) {
case TALK_PROTO_PING:
while (collect_ping_results()) anyaction++;
break;
case TALK_PROTO_LDAP:
while (collect_ldap_results()) anyaction++;
break;
case TALK_PROTO_EXTERNAL:
while (collect_external_results(queueid)) anyaction++;
break;
default:
break;
}
/* Nuke any tasks that have stalled */
kill_stalled_tasks();
}
dbgprintf("Pending:%d, done:%d\n", pendingtests->len, donetests->len);
if (donetests->len > 0) {
dbgprintf("Sending results\n");
send_test_results(donetests, collectorname, 1, location, usebackfeedqueue);
if (iptree) {
/* Zap IP's from the iptree */
listitem_t *walk;
for (walk = donetests->head; (walk); walk = walk->next) {
myconn_t *testrec = (myconn_t *)walk->data;
if (testrec->netparams.destinationip) xtreeDelete(iptree, testrec->netparams.destinationip);
}
}
cleanup_myconn_list(donetests);
}
if (activeprocesses->len < concurrency) {
/* OK to start new tasks - see if there's anything to do */
anyaction += scan_queue(queueid, mytalkprotocol, batchsize);
}
else {
dbgprintf("Max concurrency reached\n");
}
if (anyaction == 0) sleep(10);
}
if (usebackfeedqueue) sendmessage_finish_local();
return 0;
}
| 26.300245 | 128 | 0.629607 |
90ba09d7e8c5664464d9b4c65f0c332c8d116c4d | 3,648 | h | C | src/core/DDS/datalink_p.h | mvsframework/mvs | 4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81 | [
"Apache-2.0"
] | null | null | null | src/core/DDS/datalink_p.h | mvsframework/mvs | 4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81 | [
"Apache-2.0"
] | null | null | null | src/core/DDS/datalink_p.h | mvsframework/mvs | 4bbda9f18fab960a9bea9c4e5e2de16b77c6ff81 | [
"Apache-2.0"
] | null | null | null | //
// Copyright © 2015 Claus Christmann <hcc |ä| gatech.edu>.
//
// 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 DATALINKPRIVATE_H
#define DATALINKPRIVATE_H
#include "simitem_p.h"
#include <QtCore/QDebug>
#include <QtCore/QHash>
#include <QtCore/QString>
#include <ndds/ndds_cpp.h>
#include "IDL/messages.h"
#include "IDL/messagesSupport.h"
#include "DDS/ddssupport.h"
#include "DDS/validatingdatareaderlistener.h"
#include "DDS/subscriberlistener.h"
#include "datalink.h"
#include "Nodes/node.h"
#include "Nodes/node_p.h"
// class Node;
class Datalink;
class DatalinkPrivate : public SimItemPrivate
{
private:
Q_DECLARE_PUBLIC(Datalink);
Datalink* const q_ptr;
static DDS_DomainId_t const domainId = 0; //FIXME: Magic Numbers.
public:
DatalinkPrivate(Datalink* q, Datalink::Settings* const settings, Node* parent);
virtual ~DatalinkPrivate();
Datalink::Settings * const xmlSettings; // initialized in construction list
/** \brief The DDS participant.
* DomainParticipant objects enable an application to exchange messages within
* domains. An application must have a DomainParticipant for every domain in
* which the application will communicate.(Unless your application is a bridging
* application, it will typically participate in only one domain and have only
* one DomainParticipant.)
* DomainParticipants are used to create Topics, Publishers, DataWriters,
* Subscribers, and DataReaders in the corresponding domain.
*/
DDSDomainParticipant* participant = nullptr;
/** \brief A DDS Publisher. */
DDSPublisher* publisher = nullptr;
/** \brief A DDS Subscriber. */
DDSSubscriber* subscriber = nullptr;
/** \brief A custom listener attached to the subscriber. */
SubscriberListener* subscriberListener = nullptr;
/** \brief The Quality-of-Service settings of the participant.
* \sa DDSDomainParticipant::get_qos();
*/
DDS_DomainParticipantQos participant_qos;
/** \brief The globally unique Id of a datalink participant. */
DDS_GUID_t* guid = nullptr;
void initializeDatalink();
void unInitializeDatalink();
/** \brief A listener detecting Subscriptions by other participants. */
NodePrivate::BuiltInTopic_Subscriptions_Listener* builtInTopic_Subscriptions_Listener = nullptr;
/** \brief A listener detecting Publications by other participants. */
NodePrivate::BuiltInTopic_Publications_Listener* builtInTopic_Publications_Listener = nullptr;
/** \brief A listener detecting the presence of other participants. */
NodePrivate::BuiltInTopic_Participant_Listener* builtInTopic_Participant_Listener = nullptr;
/** \brief A listener directly attached to the domain participant. */
NodePrivate::Participant_Listener* participant_listener = nullptr;
void attachToBuiltInTopic(DDSDataReaderListener* listener,
char const * topicName,
DDS_StatusMask mask = DDS_DATA_AVAILABLE_STATUS );
};
#endif // DATALINKPRIVATE | 32.283186 | 99 | 0.717654 |
99ec2bf49eb96ed1544e8209542a9d43f1239dec | 521 | h | C | mmpool/CentralCache.h | DanteIoVeYou/CPP | 413076faf3df341c66b6958540d364bfa3e303d9 | [
"MIT"
] | null | null | null | mmpool/CentralCache.h | DanteIoVeYou/CPP | 413076faf3df341c66b6958540d364bfa3e303d9 | [
"MIT"
] | null | null | null | mmpool/CentralCache.h | DanteIoVeYou/CPP | 413076faf3df341c66b6958540d364bfa3e303d9 | [
"MIT"
] | null | null | null | #pragma once
#include "common.h"
class CentralCache {
public:
static CentralCache* GetInstance() {
return &_instance;
}
size_t GiveToThreadCache(void*& start, void*& end, size_t batch_size, size_t size);
Span* GetOneSpan(SpanList& span_list, size_t size);
void GetBackFromThreadCache(void* start, size_t size);
private:
CentralCache() {}
CentralCache(const CentralCache&) = delete;
CentralCache operator=(const CentralCache&) = delete;
static CentralCache _instance;
SpanList _span_lists[BUCKET_AMOUNT];
};
| 26.05 | 84 | 0.763916 |
82152fab74ac058fc18a6fc714b1135f96f21875 | 630 | h | C | include/FBGame.h | mkuczkowski/SDL-Flappy-Birds | 0437c604e80cf366ac79c7241f7586cb69dfd159 | [
"MIT"
] | null | null | null | include/FBGame.h | mkuczkowski/SDL-Flappy-Birds | 0437c604e80cf366ac79c7241f7586cb69dfd159 | [
"MIT"
] | null | null | null | include/FBGame.h | mkuczkowski/SDL-Flappy-Birds | 0437c604e80cf366ac79c7241f7586cb69dfd159 | [
"MIT"
] | null | null | null | #ifndef FBGAME_H
#define FBGAME_H
class FBGame: private SDLGraphics {
public:
FBGame();
virtual ~FBGame();
void start();
private:
SDL_Event event;
Player player;
bool isOver;
Pipe pipes[100];
float moveSpeed;
float distanceBetweenPipes;
void gameOver();
float getRandomValue(float minValue, float maxValue);
void checkForCollisions();
void moveAvailableGameObjects();
void drawBackground();
void assignGaps();
void quit();
void render();
void restart();
};
#endif // FBGAME_H
| 22.5 | 61 | 0.580952 |
955e4bd9b8544fa042e10c899ad7de07ec148778 | 35,295 | c | C | util/kvstore_filesystem.c | b1v1r/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 148 | 2015-01-10T01:53:39.000Z | 2022-03-20T20:48:12.000Z | util/kvstore_filesystem.c | ErikHendriks/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 8 | 2015-03-09T15:50:36.000Z | 2020-10-10T19:23:06.000Z | util/kvstore_filesystem.c | ErikHendriks/ironbee | 97b453afd9c3dc70342c6183a875bde22c9c4a76 | [
"Apache-2.0"
] | 46 | 2015-03-08T22:45:42.000Z | 2022-01-15T13:47:59.000Z | /*****************************************************************************
* Licensed to Qualys, Inc. (QUALYS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* QUALYS 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.
****************************************************************************/
/**
* @file
* @brief IronBee --- Persist to file system.
*/
#include "ironbee_config_auto.h"
/* Must be before other system headers. */
#include <uuid.h>
#include <ironbee/kvstore_filesystem.h>
#include "kvstore_private.h"
#include <ironbee/clock.h>
#include <ironbee/file.h>
#include <ironbee/kvstore.h>
#include <ironbee/path.h>
#include <ironbee/util.h>
#include <ironbee/uuid.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/stat.h>
/**
* Define the width for printing an expiration time.
* This is related to EXPIRE_STR_FMT.
* Both are 12 to accommodate the typical 10 digits and 2 buffer digits
* for extreme future-time use.
*/
static const size_t EPOCH_STR_WIDTH = 13;
/**
* The default fmode for created flies.
*/
static const mode_t DEFAULT_FILE_MODE = 0644;
/**
* The default dmode for created directories.
*/
static const mode_t DEFAULT_DIRECTORY_MODE = 0755;
/**
* The sprintf format used for expiration times.
*/
#define EPOCH_STR_FMT "%012u"
/**
* Creates a new, sha1, v5 uuid.
*
* @param[out] uuid_str The 37 byte UUID is written to this buffer.
* If this is NULL then it will be malloced by ossp-uuid.
* @param[in,out] uuid_str_len This should be 37. If, for some reason,
* that is not long enough (36 bytes and one \0 character)
* then an out-of-memory error is reported by ossp-uuid
* and IB_EOTHER is returned.
* If @a uuid_str is NULL, then this is ignored
* and is used as an output variable for the
* length of @a uuid_str allocated by malloc.
* @param[in] key The null-terminated string of the key we want to hash.
*
* @returns
* - IB_OK
* - IB_EOTHER if exporting the UUID or some other unexpected error occurs.
* - IB_EALLOC if a uuid object cannot be made.
*/
static ib_status_t uuid_create_v5_str(
char **uuid_str,
size_t *uuid_str_len,
const char *key
)
{
uuid_rc_t uuid_rc;
ib_status_t rc = IB_OK;
uuid_t *uuid_generator;
/* This is expensive relative to the rest of this function. If
* profiling reveals this is a performance bottleneck, it could be moved
* to static, lock-guarded, state similar to how util/uuid.c works.
*
* Alternately, this whole routine is just a way to hash a key to a
* filesystem safe string. A faster hash implementation could be used
* instead, e.g., one of the functions from hash.h.
*/
if (uuid_create(&uuid_generator) != UUID_RC_OK) {
return IB_EOTHER;
}
/* Load the nil UUID. */
uuid_rc = uuid_load(uuid_generator, "nil");
if (uuid_rc != UUID_RC_OK) {
rc = IB_EOTHER;
goto finish;
}
uuid_rc = uuid_make(uuid_generator, UUID_MAKE_V5, uuid_generator, key);
if (uuid_rc == UUID_RC_MEM) {
rc = IB_EALLOC;
goto finish;
}
else if (uuid_rc != UUID_RC_OK) {
rc = IB_EOTHER;
goto finish;
}
uuid_rc = uuid_export(uuid_generator, UUID_FMT_STR, uuid_str, uuid_str_len);
if (uuid_rc != UUID_RC_OK) {
rc = IB_EOTHER;
goto finish;
}
finish:
uuid_destroy(uuid_generator);
return rc;
}
/**
* Malloc and populate a filesystem path for a key/value pair.
*
* The path will include the key value, the expiration value, and the type
* of the pattern:
* @c <base_path>/<key>/<expiration>-<type>.
*
* @param[in] kvstore Key-Value store.
* @param[in] key The key to write to.
* @param[in] expiration The time this record expires.
* @param[in] type The type of the file. If null then expiration and creation
* are ignored and a shortened path is generated
* representing only the directory.
* @param[in] type_len The type length of the type_len.
* @param[in] prefix File name prefix (or NULL)
* @param[in] suffix File name suffix (or NULL)
* @param[in] mm @a path is allocated out of mm.
* @param[out] path The malloc'ed path. The caller must free this.
* The path variable will be set to NULL if a failure occurs.
*
* @return
* - IB_OK on success
* - IB_EOTHER on system call failure. See @c errno.
* - IB_EALLOC if a memory allocation fails.
*/
static ib_status_t build_key_path(
ib_kvstore_t *kvstore,
const ib_kvstore_key_t *key,
const ib_time_t expiration,
const char *type,
size_t type_len,
const char *prefix,
const char *suffix,
ib_mm_t mm,
char **path)
{
assert(kvstore != NULL);
assert(key != NULL);
assert(path != NULL);
/* System return code. */
int sys_rc;
/* IronBee return code */
ib_status_t rc = IB_OK;
/* A stat struct. sb is the name used in the man page example code. */
struct stat sb;
/* Constant size specified by ib_uuid_bin_to_ascii (minus the \0).*/
size_t key_uuid_sz = UUID_LEN_STR+1;
char *key_uuid_str = NULL;
char *key_str = NULL; /* Null-terminated copy of the key. */
char *path_base = NULL; /* Used to free path_tmp on failure. */
size_t prefix_len = 0;
size_t suffix_len = 0;
size_t path_size;
char *path_tmp; /* Used to manipulate the path we are building. */
const uint8_t *key_data;
size_t key_data_len;
ib_kvstore_filesystem_server_t *server =
(ib_kvstore_filesystem_server_t *)(kvstore->server);
/* Clear output variable. */
*path = NULL;
if (prefix != NULL) {
prefix_len = strlen(prefix);
}
if (suffix != NULL) {
suffix_len = strlen(suffix);
}
ib_kvstore_key_get(key, &key_data, &key_data_len);
key_str = ib_mm_alloc(mm, key_data_len+1);
if (key_str == NULL) {
return IB_EALLOC;
}
memcpy(key_str, key_data, key_data_len);
key_str[key_data_len] = '\0';
/* Allocate 37 byte block for the key to be written. */
key_uuid_str = ib_mm_alloc(mm, key_uuid_sz);
if (key_uuid_str == NULL) {
return IB_EALLOC;
}
rc = uuid_create_v5_str(&key_uuid_str, &key_uuid_sz, key_str);
if (rc != IB_OK) {
return rc;
}
path_size =
server->directory_length /* length of path */
+ 1 /* path separator */
+ UUID_LEN_STR /* key length */
+ 1 /* path separator */
+ prefix_len /* Prefix length */
+ EPOCH_STR_WIDTH /* width to format the expiration time. */
+ 1 /* dash. */
+ EPOCH_STR_WIDTH /* width to format a creation time. */
+ 1 /* dot. */
+ type_len /* type. */
+ suffix_len /* Suffix length. */
+ 1 /* '\0' */;
path_tmp = ib_mm_alloc(mm, path_size+1);
if (path_tmp == NULL) {
return IB_EALLOC;
}
path_base = path_tmp;
/* Push allocated path back to user. We now populate it. */
*path = path_tmp;
/* Append the path to the directory. */
path_tmp = (strncpy(path_tmp, server->directory, server->directory_length)
+ server->directory_length);
/* Append the key. */
path_tmp = strncpy(path_tmp, "/", 1) + 1;
path_tmp = strncpy(path_tmp, key_uuid_str, UUID_LEN_STR) + UUID_LEN_STR;
/* Momentarily tag the end of the path for the stat check. */
*path_tmp = '\0';
errno = 0;
/* Check for a key directory. Make one if able.*/
sys_rc = stat(*path, &sb);
if (errno == ENOENT) {
rc = ib_util_mkpath(*path, server->dmode);
if (rc != IB_OK) {
return IB_EOTHER;
}
}
else if (sys_rc) {
return IB_EOTHER;
}
else if (!S_ISDIR(sb.st_mode)) {
return IB_EOTHER;
}
if (type != NULL) {
ib_timeval_t creation_tv;
ib_time_t creation;
uint32_t expire_time_seconds;
uint32_t create_time_seconds;
ib_clock_gettimeofday(&creation_tv);
creation = IB_CLOCK_TIMEVAL_TIME(creation_tv);
expire_time_seconds = IB_CLOCK_SECS(expiration);
create_time_seconds = IB_CLOCK_SECS(creation);
if (expire_time_seconds > 0) {
expire_time_seconds += create_time_seconds;
}
path_tmp = strncpy(path_tmp, "/", 1) + 1;
if (prefix != NULL) {
path_tmp = strcpy(path_tmp, prefix) + prefix_len;
}
path_tmp += snprintf(
path_tmp,
EPOCH_STR_WIDTH + 1 + EPOCH_STR_WIDTH,
EPOCH_STR_FMT "-" EPOCH_STR_FMT,
expire_time_seconds,
create_time_seconds);
path_tmp = strncpy(path_tmp, ".", 1) + 1;
path_tmp = strncpy(path_tmp, type, type_len) + type_len;
if (suffix != NULL) {
path_tmp = strcpy(path_tmp, suffix) + suffix_len;
}
}
*path_tmp = '\0';
*path = path_base;
return rc;
}
/**
* Trivial merge policy that returns the first value in the list
* if the list is size 1 or greater.
*
* If the list size is 0, this does nothing.
*
* @param[in] kvstore Key-value store.
* @param[in] key The key that the values are listed under.
* @param[in] values Array of @ref ib_kvstore_value_t pointers.
* @param[in] value_size The length of values.
* @param[out] resultant_value Pointer to values[0] if value_size > 0.
* @param[in,out] cbdata Context callback data.
* @returns IB_OK
*/
static ib_status_t kvstore_filsystem_merge_policy(
ib_kvstore_t *kvstore,
const ib_kvstore_key_t *key,
ib_kvstore_value_t **values,
size_t value_size,
ib_kvstore_value_t **resultant_value,
ib_kvstore_cbdata_t *cbdata
)
{
assert(kvstore != NULL);
assert(key != NULL);
assert(resultant_value != NULL);
ib_time_t creation;
ib_kvstore_value_t *value;
if (value_size == 0) {
return IB_OK;
}
value = values[0];
creation = ib_kvstore_value_creation_get(value);
for (size_t i = 1; i < value_size; ++i) {
ib_kvstore_value_t *value_i = values[i];
ib_time_t creation_i = ib_kvstore_value_creation_get(value_i);
if (creation < creation_i) {
creation = creation_i;
value = value_i;
}
}
*resultant_value = value;
return IB_OK;
}
static ib_status_t kvconnect(
ib_kvstore_t *kvstore,
ib_kvstore_cbdata_t *cbdata)
{
assert(kvstore != NULL);
/* Nop. */
return IB_OK;
}
static ib_status_t kvdisconnect(
ib_kvstore_t *kvstore,
ib_kvstore_cbdata_t *cbdata)
{
assert(kvstore != NULL);
/* Nop. */
return IB_OK;
}
/**
* Extract time information from a file name
*
* The file name is expected to have one of the two formats from kvset().
* That is: "<expiration>-<creation>.<type>.XXXXXX", or
* ".<expiration>-<creation>.<type>.XXXXXX". The leading '.', if present,
* indicates that the file is a temporary file. The expiration time is then
* extracted, followed by the creation time, which is stored as a 16-digit
* hexadecimal string.
*
* @param[in] kvstore Key-value store (unused)
* @param[in] fname File name to extract from
* @param[out] expiration Expiration time from @a path
* @param[out] creation Creation time from @a path
*
* @returns
* - IB_OK on success.
* - IB_EALLOC on memory allocation failures.
* - IB_ENOENT if a / and . characters are not found to denote
* the location of the expiration decimals.
*/
static ib_status_t extract_time_info(
ib_kvstore_t *kvstore,
const char *fname,
ib_time_t *expiration,
ib_time_t *creation)
{
assert(kvstore != NULL);
assert(fname != NULL);
assert(expiration != NULL);
assert(creation != NULL);
char *pos = (char *)fname; /* stroll() takes a char * as arg 2 */
/* Ignore leading "." on file name */
if (*pos == '.') {
++pos;
}
if (!isdigit(*pos) ) {
return IB_EINVAL;
}
*expiration = strtoll(pos, &pos, 10) * 1000000;
if (*pos != '-') {
return IB_EINVAL;
}
/* Skip the '-' */
++pos;
if (!isdigit(*pos) ) {
return IB_EINVAL;
}
*creation = strtoll(pos, &pos, 10) * 1000000;
return IB_OK;
}
/**
* Extract the type information from a file name. See extract_time_info() for
* details of the filename format.
*
* @param[in] mm Memory manager to allocate @a type out of.
* @param[in] fname File name to extract from
* @param[out] type Copy of the type name
* @param[out] type_length Length of @a type.
*
* @returns
* - IB_OK on success.
* - IB_EALLOC on memory allocation failures.
* - IB_ENOENT if a / and . characters are not found to denote
* the location of the expiration decimals.
*/
static ib_status_t extract_type(
ib_mm_t mm,
const char *fname,
char **type,
size_t *type_length)
{
assert(fname != NULL);
assert(type != NULL);
assert(type_length != NULL);
const char *pos;
size_t len;
/* Skip over the date encoding (\d+-\d+) and stop at the '.'. */
pos = strchr(fname, '.');
if (pos == NULL) {
return IB_EINVAL;
}
/* Skip over '.'. */
++pos;
/* Length minus the '.' and the trailing .XXXXXX used by mkstemp(). */
len = strlen(pos) - 7;
*type = ib_mm_alloc(mm, len+1);
if (*type == NULL) {
return IB_EALLOC;
}
strncpy(*type, pos, len);
*type_length = len;
return IB_OK;
}
/**
* Load a value from a key-value store
*
* This function looks at the file name passed in, and calls
* extract_time_info() to get the expiration time, creation time and whether
* or not the file is a temporary file. If the file is found to be expired,
* it's deleted whether it's a temporary file or not; non-expired temporary
* files are ignored.
*
* For other files, the type of the file is extracted from the file name, and
* then the contents of the file are read into the the value structure.
*
* @param[in] kvstore Key-value store.
* @param[in] dpath Directory path
* @param[in] fname The file name.
* @param[in] mm Memory manager to do allocations for pvalue out of.
* @param[out] pvalue Pointer to the value to be built.
*
* @returns
* - IB_OK on success.
* - IB_EALLOC on memory failure from @c kvstore->malloc
* - IB_EOTHER on system call failure from file operations.
* - IB_DECLINED returned when @a fname is found to be either
* expired or a temporary file
*/
static ib_status_t load_kv_value(
ib_kvstore_t *kvstore,
const char *dpath,
const char *fname,
ib_mm_t mm,
ib_kvstore_value_t **pvalue)
{
assert(kvstore != NULL);
assert(dpath != NULL);
assert(fname != NULL);
assert(pvalue != NULL);
ib_status_t rc;
ib_timeval_t ib_timeval;
ib_time_t now;
ib_kvstore_value_t *value = NULL;
char *file_path = NULL;
size_t len;
ib_time_t expiration;
ib_time_t creation;
*pvalue = NULL;
/* Decline files that begin with a '.'. These are temporary files. */
if (*fname == '.') {
return IB_DECLINED;
}
/* Extract time info. Log invalid file names and ignore them. */
rc = extract_time_info(kvstore, fname, &expiration, &creation);
if (rc == IB_EINVAL) {
ib_util_log_error("kvstore: Ignoring file with invalid name \"%s\"",
fname);
return IB_OK;
}
else if (rc != IB_OK) {
return IB_EOTHER;
}
/* Build full path. */
len = strlen(dpath) + strlen(fname) + 2;
file_path = ib_mm_alloc(mm, len);
if (file_path == NULL) {
return IB_EALLOC;
}
strcpy(file_path, dpath);
strcat(file_path, "/");
strcat(file_path, fname);
/* Get the current time */
ib_clock_gettimeofday(&ib_timeval);
now = IB_CLOCK_TIMEVAL_TIME(ib_timeval);
/* Remove expired file and signal there is no entry for that file. */
if (now > expiration) {
/* Remove the expired file. */
unlink(file_path);
/* Try to remove the key directory, though it may not be empty.
* Failure is OK. */
rmdir(dpath);
return IB_DECLINED;
}
rc = ib_kvstore_value_create(&value, mm);
if (rc != IB_OK) {
return rc;
}
/* Populate expiration & creation times. */
ib_kvstore_value_expiration_set(value, expiration);
ib_kvstore_value_creation_set(value, creation);
/* Populate type and type_length. */
{
char *type;
size_t type_length;
rc = extract_type(
mm,
fname,
&type,
&type_length);
if (rc != IB_OK) {
return IB_EOTHER;
}
ib_kvstore_value_type_set(value, type, type_length);
}
/* Populate value and value_length. */
{
uint8_t *data;
size_t data_length;
rc = ib_file_readall(
mm,
file_path,
(const uint8_t**)&data,
&data_length);
if (rc != IB_OK) {
return IB_EOTHER;
}
ib_kvstore_value_value_set(value, data, data_length);
}
*pvalue = value;
return IB_OK;
}
typedef ib_status_t(*each_dir_t)(const char *path, const char *dirent, void *);
/**
* Count the entries that do not begin with a dot.
*
* @param[in] path The directory path.
* @param[in] dirent The directory entry in path.
* @param[in,out] data An int* representing the current count of directories.
*
* @returns IB_OK.
*/
static ib_status_t count_dirent(
const char *path,
const char *dirent,
void *data)
{
assert(path != NULL);
assert(dirent != NULL);
assert(data != NULL);
size_t *i = (size_t *)data;
if ( (*dirent != '.') || (strlen(dirent) > 2) ) {
++(*i);
}
return IB_OK;
}
/**
* Iterate through a directory in a standard way.
*
* @returns
* - IB_OK on success.
* - Other errors based on each_dir_t.
*/
static ib_status_t each_dir(const char *path, each_dir_t f, void* data)
{
assert(path != NULL);
assert(f != NULL);
int tmp_errno; /* Holds errno until other system calls finish. */
int sys_rc;
ib_status_t rc;
size_t dirent_sz; /* Size of a dirent structure. */
DIR *dir = NULL;
struct dirent *entry = NULL;
struct dirent *result = NULL;
dir = opendir(path);
if (!dir) {
rc = IB_EOTHER;
goto rc_failure;
}
/* Man page-specified to portably allocate the dirent buffer for entry. */
dirent_sz =
(
offsetof(struct dirent, d_name) +
pathconf(path, _PC_NAME_MAX) + 1 + sizeof(long)
) & -sizeof(long);
entry = malloc(dirent_sz);
if (!entry) {
rc = IB_EOTHER;
goto rc_failure;
}
while (1) {
sys_rc = readdir_r(dir, entry, &result);
if (sys_rc) {
rc = IB_EOTHER;
goto rc_failure;
}
if (result == NULL) {
break;
}
rc = f(path, result->d_name, data);
if ( (rc != IB_OK) && (rc != IB_DECLINED) ) {
goto rc_failure;
}
}
/* Clean exit. */
closedir(dir);
free(entry);
return IB_OK;
rc_failure:
tmp_errno = errno;
if (dir) {
closedir(dir);
}
if (entry) {
free(entry);
}
errno = tmp_errno;
return rc;
}
/**
* Callback user data structure for build_value callback function.
*/
struct build_value_t {
ib_mm_t mm; /**< Memory manager. */
ib_kvstore_t *kvstore; /**< Key value store. */
ib_kvstore_value_t **values; /**< Values array to be build. */
size_t values_idx; /**< Next value to be populated. */
size_t values_len; /**< Prevent new file causing array overflow. */
size_t path_len; /**< Cached path length value. */
};
typedef struct build_value_t build_value_t;
/**
* Build an array of values.
*
* @param[in] path The directory path.
* @param[in] file The file to load.
* @param[out] data The data structure to be populated.
* @returns
* - IB_OK
* - IB_EALLOC On a memory error.
*/
static ib_status_t build_value(const char *path, const char *file, void *data)
{
assert(path != NULL);
assert(file != NULL);
assert(data != NULL);
ib_status_t rc;
build_value_t *bv = (build_value_t *)(data);
ib_kvstore_value_t *value;
/* Return if there is no space left in our array.
* Partial results are not an error as an asynchronous write may
* create a new file. */
if (bv->values_idx >= bv->values_len) {
return IB_OK;
}
if ( (*file == '.') && (strlen(file) <= 2) ) {
return IB_OK;
}
rc = load_kv_value(bv->kvstore, path, file, bv->mm, &value);
/* DECLINE means expired or temporary file; ignore it.
* If OK, add the new value to the list */
if (rc == IB_DECLINED) {
return IB_OK;
}
else if (rc == IB_OK) {
*(bv->values + bv->values_idx) = value;
bv->values_idx++;
}
return rc;
}
/**
* Get implementations.
*
* @param[in] kvstore The key-value store.
* @param[in] mm Memory manager to allocate @a values out of.
* @param[in] key The key to fetch.
* @param[out] values A pointer to an array of pointers.
* @param[out] values_length The length of *values.
* @param[in,out] cbdata Callback data. Unused.
*/
static ib_status_t kvget(
ib_kvstore_t *kvstore,
ib_mm_t mm,
const ib_kvstore_key_t *key,
ib_kvstore_value_t ***values,
size_t *values_length,
ib_kvstore_cbdata_t *cbdata
)
{
assert(kvstore != NULL);
assert(key != NULL);
ib_status_t rc;
build_value_t build_val;
char *path = NULL;
size_t dirent_count = 0;
/* Build a path with no expiration value on it. */
rc = build_key_path(kvstore, key, 0, NULL, 0, NULL, NULL, mm, &path);
if (rc != IB_OK) {
return rc;
}
/* Count entries. */
rc = each_dir(path, &count_dirent, &dirent_count);
if (rc != IB_OK) {
return rc;
}
if (dirent_count == 0){
return IB_ENOENT;
}
/* Initialize build_values user data. */
build_val.mm = mm;
build_val.kvstore = kvstore;
build_val.path_len = strlen(path);
build_val.values_idx = 0;
build_val.values_len = dirent_count;
build_val.values = (ib_kvstore_value_t**)
ib_mm_alloc(mm, sizeof(*build_val.values) * dirent_count);
if (build_val.values == NULL) {
return IB_EALLOC;
}
/* Build value array. */
rc = each_dir(path, &build_value, &build_val);
if (rc != IB_OK) {
return rc;
}
/* Commit back results.
* NOTE: values_idx does not need a +1 because it points at the
* next empty slot in the values array. */
*values = build_val.values;
*values_length = build_val.values_idx;
/* Clean exit. */
return IB_OK;
}
/**
* Create an empty file for kv data storage.
*
* The file is first created, empty, and then replaced with a `mv`, but
* only if the temporary staging file can be successfully created.
*
* @sa create_tmp_kv_file()
*/
static ib_status_t create_empty_kv_file(
ib_kvstore_t *kvstore,
const ib_kvstore_key_t *key,
ib_kvstore_value_t *value,
ib_kvstore_filesystem_server_t *server,
ib_mm_t mm,
char **path_real
)
{
assert(kvstore != NULL);
assert(key != NULL);
assert(value != NULL);
assert(server != NULL);
assert(path_real != NULL);
int fd;
ib_status_t rc;
const char *type;
size_t type_length;
ib_kvstore_value_type_get(value, &type, &type_length);
/* Build a path with expiration value in it. */
rc = build_key_path(
kvstore,
key,
ib_kvstore_value_expiration_get(value),
type,
type_length,
NULL,
".XXXXXX", /* ".XXXXXX" suffix for mkstemp() */
mm,
path_real);
if (rc != IB_OK) {
return rc;
}
umask(!(server->dmode));
fd = mkstemp(*path_real);
if (fd < 0) {
return IB_EOTHER;
}
/* Close this file immediately; it's just a place holder,
* and we're not going to write to it */
close(fd);
return IB_OK;
}
/**
* @sa create_empty_kv_file().
*/
static ib_status_t create_tmp_kv_file(
ib_kvstore_t *kvstore,
const ib_kvstore_key_t *key,
ib_kvstore_value_t *value,
ib_kvstore_filesystem_server_t *server,
ib_mm_t mm,
int *fd,
char **path_tmp
)
{
assert(kvstore != NULL);
assert(key != NULL);
assert(value != NULL);
assert(server != NULL);
assert(path_tmp != NULL);
ib_status_t rc;
const char *type;
size_t type_length;
ib_kvstore_value_type_get(value, &type, &type_length);
/* Build a path with expiration value in it. */
rc = build_key_path(
kvstore,
key,
ib_kvstore_value_expiration_get(value),
type,
type_length,
".", /* Start the file name with a "." */
".XXXXXX", /* ".XXXXXX" suffix for mkstemp() */
mm,
path_tmp);
if (rc != IB_OK) {
return rc;
}
umask(!(server->dmode));
*fd = mkstemp(*path_tmp);
if (*fd < 0) {
return IB_EOTHER;
}
return IB_OK;
}
/**
* Set callback.
*
* This function creates 2 files with mkstemp(). The first file (path_real),
* has a file name format "<expiration>-<creation>.<type>.XXXXXX". The second
* file (path_tmp), has an identical layout, but with a leading ".", so it's
* ".<expiration>-<creation>.<type>.XXXXXX". The "real" file is a place
* holder, to prevent other processes / threads from writing to the same file.
* The "temporary" file (with the leading '.'), is created, written to,
* closed, and then renamed on top of the real file. Thus, we get a 2-phase
* commit with guaranteed file name uniqueness.
*
* The reader code (load_kv_value()), will ignore file names that start with a
* '.', unless the file is expired.
*
* @param[in] kvstore Key-value store.
* @param[in] merge_policy This implementation does not merge on writes.
* Merging is done by the framework on reads.
* @param[in] key The key to fetch all values for.
* @param[in] value The value to write. The framework contract says that this
* is also an out-parameters, but in this implementation the
* merge_policy is not used so value is never merged
* and never written to.
* @param[in,out] cbdata Callback data for the user.
*/
static ib_status_t kvset(
ib_kvstore_t *kvstore,
ib_kvstore_merge_policy_fn_t merge_policy,
const ib_kvstore_key_t *key,
ib_kvstore_value_t *value,
ib_kvstore_cbdata_t *cbdata
)
{
assert(kvstore != NULL);
assert(kvstore->server != NULL);
assert(key != NULL);
assert(value != NULL);
ib_status_t rc;
int sys_rc;
int fd = -1;
char *path_real = NULL;
char *path_tmp = NULL;
ssize_t written;
const uint8_t *data;
size_t data_length;
ib_kvstore_filesystem_server_t *server;
ib_mm_t mm;
ib_mpool_lite_t *mp;
server = (ib_kvstore_filesystem_server_t *)kvstore->server;
rc = ib_kvstore_remove(kvstore, key);
if (rc != IB_OK) {
ib_util_log_debug("Failed to remove key from kvstore.");
}
rc = ib_mpool_lite_create(&mp);
if (rc != IB_OK) {
return rc;
}
mm = ib_mm_mpool_lite(mp);
rc = create_empty_kv_file(
kvstore,
key,
value,
server,
mm,
&path_real);
if (rc != IB_OK) {
goto cleanup;
}
rc = create_tmp_kv_file(
kvstore,
key,
value,
server,
mm,
&fd,
&path_tmp);
if (rc != IB_OK) {
goto cleanup;
}
ib_kvstore_value_value_get(value, &data, &data_length);
/* Write to the tmp file. */
written = write(fd, data, data_length);
if (written < (ssize_t)data_length ){
rc = IB_EOTHER;
goto cleanup;
}
close(fd); /* Force all pending data to the file. */
fd = -1; /* Set fd to an invalid value to avoid a double close. */
/* Now, rename the temp file to the real file */
sys_rc = rename(path_tmp, path_real);
if (sys_rc < 0) {
rc = IB_EOTHER;
goto cleanup;
}
sys_rc = chmod(path_real, server->fmode);
if (sys_rc < 0) {
rc = IB_EOTHER;
goto cleanup;
}
rc = IB_OK;
cleanup:
if (fd >= 0) {
close(fd);
}
ib_mpool_lite_destroy(mp);
return rc;
}
/**
* Remove all entries from key directory.
*
* @param[in] path The path to the key directory. @c rmdir is called on this.
* @param[in] file The file inside of the directory pointed to by path
* which will be @c unlink'ed.
* @param[in,out] data This is a size_t pointer containing
* the length of the path argument.
* @returns
* - IB_OK
* - IB_EALLOC if a memory allocation fails concatenating path and file.
*/
static ib_status_t remove_file(
const char *path,
const char *file,
void *data)
{
assert(path != NULL);
assert(file != NULL);
assert(data != NULL);
char *full_path;
size_t path_len = *(size_t *)(data);
if (*file != '.') {
/* Build full path. */
full_path = malloc(path_len + strlen(file) + 2);
if (!full_path) {
return IB_EALLOC;
}
sprintf(full_path, "%s/%s", path, file);
unlink(full_path);
free(full_path);
}
return IB_OK;
}
/**
* Remove a key from the store.
*
* @param[in] kvstore Store.
* @param[in] key Key.
* @param[in,out] cbdata Callback data.
* @returns
* - IB_OK on success.
* - IB_EOTHER on system call failure in build_key_path. See @c errno.
* - IB_EALLOC if a memory allocation fails.
*/
static ib_status_t kvremove(
ib_kvstore_t *kvstore,
const ib_kvstore_key_t *key,
ib_kvstore_cbdata_t *cbdata)
{
assert(kvstore != NULL);
assert(key != NULL);
ib_status_t rc;
char *path = NULL;
size_t path_len;
ib_mpool_lite_t *mp;
ib_mm_t mm;
rc = ib_mpool_lite_create(&mp);
if (rc != IB_OK) {
return rc;
}
mm = ib_mm_mpool_lite(mp);
/* Build a path with no expiration value on it. */
rc = build_key_path(kvstore, key, 0, NULL, 0, NULL, NULL, mm, &path);
if (rc != IB_OK) {
goto cleanup;
}
path_len = strlen(path);
/* Remove all files in the key directory. */
each_dir(path, remove_file, &path_len);
/* Attempt to remove the key path. This may fail, and that is OK.
* Another process may write a new key while we were deleting old ones. */
rmdir(path);
cleanup:
ib_mpool_lite_destroy(mp);
return IB_OK;
}
/**
* Destroy any allocated elements of the kvstore structure.
* @param[out] kvstore to be destroyed. The contents on disk is untouched
* and another init of kvstore pointing at that directory
* will operate correctly.
* @param[in] cbdata Unused.
*/
static void kvdestroy(ib_kvstore_t* kvstore, ib_kvstore_cbdata_t *cbdata)
{
assert(kvstore != NULL);
ib_kvstore_filesystem_server_t *server =
(ib_kvstore_filesystem_server_t *)(kvstore->server);
free((void *)server->directory);
free(server);
kvstore->server = NULL;
return;
}
ib_status_t ib_kvstore_filesystem_init(
ib_kvstore_t* kvstore,
const char* directory)
{
assert(kvstore != NULL);
assert(directory != NULL);
/* There is no callback data used for this implementation. */
ib_kvstore_init(kvstore);
ib_kvstore_filesystem_server_t *server = malloc(sizeof(*server));
if ( server == NULL ) {
return IB_EALLOC;
}
server->directory = strdup(directory);
server->directory_length = strlen(directory);
server->fmode = DEFAULT_FILE_MODE;
server->dmode = DEFAULT_DIRECTORY_MODE;
if ( server->directory == NULL ) {
free(server);
return IB_EALLOC;
}
kvstore->server = (ib_kvstore_server_t *)server;
kvstore->get = kvget;
kvstore->set = kvset;
kvstore->remove = kvremove;
kvstore->connect = kvconnect;
kvstore->disconnect = kvdisconnect;
kvstore->destroy = kvdestroy;
kvstore->default_merge_policy = kvstore_filsystem_merge_policy;
kvstore->malloc_cbdata = NULL;
kvstore->free_cbdata = NULL;
kvstore->connect_cbdata = NULL;
kvstore->disconnect_cbdata = NULL;
kvstore->get_cbdata = NULL;
kvstore->set_cbdata = NULL;
kvstore->remove_cbdata = NULL;
kvstore->merge_policy_cbdata = NULL;
kvstore->destroy_cbdata = NULL;
return IB_OK;
}
void ib_kvstore_filesystem_set_directory_mode(
ib_kvstore_t *kvstore,
mode_t mode)
{
assert(kvstore != NULL);
assert(kvstore->server != NULL);
ib_kvstore_filesystem_server_t *server =
(ib_kvstore_filesystem_server_t *)(kvstore->server);
server->dmode = mode;
}
void ib_kvstore_filesystem_set_file_mode(ib_kvstore_t *kvstore, mode_t mode)
{
assert(kvstore != NULL);
assert(kvstore->server != NULL);
ib_kvstore_filesystem_server_t *server =
(ib_kvstore_filesystem_server_t *)(kvstore->server);
server->fmode = mode;
}
| 27.339272 | 80 | 0.598612 |
9ff07f2943e4c916054275c7009b1cf1dc29a9a5 | 645 | h | C | iOS/10.0.2/Frameworks/Foundation.framework/NSUnitLength.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 30 | 2016-10-09T20:13:00.000Z | 2022-01-24T04:14:57.000Z | iOS/10.0.2/Frameworks/Foundation.framework/NSUnitLength.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | null | null | null | iOS/10.0.2/Frameworks/Foundation.framework/NSUnitLength.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 7 | 2017-08-29T14:41:25.000Z | 2022-01-19T17:14:54.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/Frameworks/Foundation.framework/Foundation
*/
@interface NSUnitLength : NSDimension <NSSecureCoding>
+ (id)_measurementWithNaturalScale:(id)arg1 system:(unsigned long long)arg2;
+ (id)astronomicalUnits;
+ (id)baseUnit;
+ (id)centimeters;
+ (id)decameters;
+ (id)decimeters;
+ (id)fathoms;
+ (id)feet;
+ (id)furlongs;
+ (id)hectometers;
+ (id)inches;
+ (id)kilometers;
+ (id)lightyears;
+ (id)megameters;
+ (id)meters;
+ (id)micrometers;
+ (id)miles;
+ (id)millimeters;
+ (id)nanometers;
+ (id)nauticalMiles;
+ (id)parsecs;
+ (id)picometers;
+ (id)scandinavianMiles;
+ (id)yards;
@end
| 19.545455 | 76 | 0.706977 |
bf55374cbe9ab9f8146ae36fa58461cbdf7f98ae | 99 | h | C | IoT-Clients/SCRAPS_ATMEGA/full_verified/verifast/examples/crypto_ccs/symbolic_model/src/hash_item.h | sss-wue/scraps | 8558e1ff1a8461956e0f0454e4873054f53fdded | [
"Apache-2.0"
] | null | null | null | IoT-Clients/SCRAPS_ATMEGA/full_verified/verifast/examples/crypto_ccs/symbolic_model/src/hash_item.h | sss-wue/scraps | 8558e1ff1a8461956e0f0454e4873054f53fdded | [
"Apache-2.0"
] | 1 | 2022-03-23T15:58:56.000Z | 2022-03-23T17:25:28.000Z | IoT-Clients/SCRAPS_ATMEGA/full_verified/verifast/examples/crypto_ccs/symbolic_model/src/hash_item.h | sss-wue/scraps | 8558e1ff1a8461956e0f0454e4873054f53fdded | [
"Apache-2.0"
] | null | null | null | #ifndef HASH_ITEM_H
#define HASH_ITEM_H
#include "general.h"
#include "item_constraints.h"
#endif | 14.142857 | 29 | 0.787879 |
ba1260ef2106eda3a9dae8cbc6a928b7fc6c41c0 | 189 | h | C | CLObjcSugar/CLObjcSugar/ObjcSugar/NSArray+Log.h | zhongaiyemaozi/CLObjcSugar-Tool- | 5a0ff6cdcdeda41e599c9a962de45d1fce842b2c | [
"Apache-2.0"
] | 7 | 2017-05-07T14:13:38.000Z | 2018-10-29T09:41:08.000Z | CLObjcSugar/CLObjcSugar/ObjcSugar/NSArray+Log.h | zhongaiyemaozi/CLObjcSugar-Tool- | 5a0ff6cdcdeda41e599c9a962de45d1fce842b2c | [
"Apache-2.0"
] | null | null | null | CLObjcSugar/CLObjcSugar/ObjcSugar/NSArray+Log.h | zhongaiyemaozi/CLObjcSugar-Tool- | 5a0ff6cdcdeda41e599c9a962de45d1fce842b2c | [
"Apache-2.0"
] | 1 | 2018-08-29T02:39:04.000Z | 2018-08-29T02:39:04.000Z | //
// NSArray+Log.h
// CLOBJSugar
//
// Created by 夜猫子 on 2017/5/7.
// Copyright © 2017年 夜猫子. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (Log)
@end
| 13.5 | 47 | 0.656085 |
9c9ea772e24965e7c7d3437e37c81170b5e24e19 | 4,948 | h | C | lib/bcore/bcore_feature.h | johsteffens/beth | d1812bde925f8622b3016ac6822f099b860af03d | [
"Apache-2.0"
] | 3 | 2019-08-12T12:44:08.000Z | 2020-08-05T16:41:50.000Z | lib/bcore/bcore_feature.h | johsteffens/beth | d1812bde925f8622b3016ac6822f099b860af03d | [
"Apache-2.0"
] | null | null | null | lib/bcore/bcore_feature.h | johsteffens/beth | d1812bde925f8622b3016ac6822f099b860af03d | [
"Apache-2.0"
] | null | null | null | /** Author and Copyright 2017 Johannes Bernhard Steffens
*
* 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 BCORE_FEATURE_H
#define BCORE_FEATURE_H
#include <stdarg.h>
#include "bcore_types.h"
#include "bcore_sr.h"
/**********************************************************************************************************************/
/// init, down, copy
typedef void (*bcore_fp_init )( vd_t o ); // initialization (construction)
typedef void (*bcore_fp_down )( vd_t o ); // destruction
typedef void (*bcore_fp_copy )( vd_t o, vc_t src ); // deep copy
/// create, discard, clone and move are derived from above features
typedef void (*bcore_fp_move )( vd_t o, vd_t src ); // init(o); copy(o, src); down(src)
typedef vd_t (*bcore_fp_create )( void ); // allocate & init
typedef void (*bcore_fp_discard )( vd_t o ); // down & deallocate; o may be NULL in which case function does nothing
typedef vd_t (*bcore_fp_clone )( vc_t o ); // allocate & copy; o may be NULL in which case NULL is returned
typedef void (*bcore_fp_detach )( vd_t* o ); // if( o ) { discard( *o ); *o = NULL; }
typedef void (*bcore_fp_attach )( vd_t* o, vd_t src ); // if( o ) { if( *o != src ) { discard( *o ); *o = src; } }
typedef void (*bcore_fp_replicate )( vd_t* o, vc_t src ); // if( o ) { if( *o != src ) { discard( *o ); *o = clone( src ); } }
/// copy, create from another object with type conversion
typedef void (*bcore_fp_copy_typed )( vd_t o, tp_t type, vc_t src ); // deep conversion & copy
typedef vd_t (*bcore_fp_create_typed )( tp_t type, vc_t src ); // deep conversion & create
/// Sanity check of an object
typedef void (*bcore_fp_check_sanity )( vc_t o );
/**********************************************************************************************************************/
/// element access
typedef sr_s (*bcore_fp_get )( vc_t o );
typedef void (*bcore_fp_set )( vd_t o, sr_s val );
/**********************************************************************************************************************/
/// formatted logging
typedef void (*bcore_fp_logvf )( vd_t o, sc_t format, va_list args );
/*********************************************************************************************************************/
/// comparison
typedef s2_t (*bcore_fp_cmp )( vc_t v1, vc_t v2 ); // comparison: ==0: equal; >0: v1 before v2; <0 :v1 after v2
typedef s2_t (*bcore_fp_cmp_o )( vc_t o, vc_t v1, vc_t v2 ); // comparison: ==0: equal; >0: v1 before v2; <0 :v1 after v2
typedef struct bcore_cmp_f { bcore_fp_cmp_o f; vc_t o; } bcore_cmp_f; // comparison functor
/**********************************************************************************************************************/
/// generator
typedef bl_t (*bcore_fp_gen_o )( vc_t o, uz_t idx, vd_t dst ); // generator (on valid index: sets *dst (if dst != NULL) and returns true)
typedef struct bcore_gen_f { bcore_fp_gen_o f; vc_t o; } bcore_gen_f; // generator functor
/**********************************************************************************************************************/
/// data flow
typedef uz_t (*bcore_fp_flow_snk )( vd_t o, vc_t data, uz_t size ); // flow-sink; size in bytes; returns number of bytes transferred
typedef uz_t (*bcore_fp_flow_src )( vd_t o, vd_t data, uz_t size ); // flow_source; size in bytes; returns number of bytes transferred
/**********************************************************************************************************************/
/// marshalling (translator, interpreter objects)
typedef void ( *bcore_fp_translate )( vc_t o, sr_s obj, sr_s snk ); // translates object to be constructible via 'interpret_object'
typedef sr_s ( *bcore_fp_interpret )( vc_t o, sr_s src ); // constructs object (no information given)
/**********************************************************************************************************************/
/// rudimentary signaling (the actual meaning of arguments and return type is defined by the usage context)
typedef struct bcore_signal_s bcore_signal_s;
typedef vd_t ( *bcore_fp_signal_handler )( const bcore_signal_s* o );
/**********************************************************************************************************************/
vd_t bcore_feature_signal_handler( const bcore_signal_s* o );
#endif // BCORE_FEATURE_H
| 52.084211 | 137 | 0.53658 |
22fb36fb489792bd0b7096e7b1ed666cf82cdc8e | 2,600 | h | C | openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_lut/lut_llr2CnProcBuf_BG2_Z7_R23.h | danghoaison91/openairinterface | ca28acccb2dfe85a0644d5fd6d379928d89f72a6 | [
"Apache-2.0"
] | null | null | null | openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_lut/lut_llr2CnProcBuf_BG2_Z7_R23.h | danghoaison91/openairinterface | ca28acccb2dfe85a0644d5fd6d379928d89f72a6 | [
"Apache-2.0"
] | null | null | null | openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_lut/lut_llr2CnProcBuf_BG2_Z7_R23.h | danghoaison91/openairinterface | ca28acccb2dfe85a0644d5fd6d379928d89f72a6 | [
"Apache-2.0"
] | null | null | null | static const uint32_t lut_llr2CnProcBuf_BG2_Z7_R23[364] = {61829, 67971, 61833, 6915, 54916, 54922, 61830, 67972, 61834, 6916, 54917, 54923, 61824, 67973, 61835, 6917, 54918, 54924, 61825, 67974, 61836, 6918, 54912, 54925, 61826, 67968, 61837, 6912, 54913, 54919, 61827, 67969, 61831, 6913, 54914, 54920, 61828, 67970, 61832, 6914, 54915, 54921, 62594, 62601, 67979, 14597, 56066, 62595, 62602, 67980, 14598, 56067, 62596, 62603, 67981, 14592, 56068, 62597, 62604, 67975, 14593, 56069, 62598, 62605, 67976, 14594, 56070, 62592, 62599, 67977, 14595, 56064, 62593, 62600, 67978, 14596, 56065, 63365, 68744, 63366, 68745, 63360, 68746, 63361, 68747, 63362, 68748, 63363, 68749, 63364, 68743, 64129, 68741, 63370, 64130, 68742, 63371, 64131, 68736, 63372, 64132, 68737, 63373, 64133, 68738, 63367, 64134, 68739, 63368, 64128, 68740, 63369, 69508, 64140, 69517, 69509, 64141, 69511, 69510, 64135, 69512, 69504, 64136, 69513, 69505, 64137, 69514, 69506, 64138, 69515, 69507, 64139, 69516, 70277, 70281, 57221, 56072, 70278, 70282, 57222, 56073, 70272, 70283, 57216, 56074, 70273, 70284, 57217, 56075, 70274, 70285, 57218, 56076, 70275, 70279, 57219, 56077, 70276, 70280, 57220, 56071, 64899, 71044, 71049, 64900, 71045, 71050, 64901, 71046, 71051, 64902, 71040, 71052, 64896, 71041, 71053, 64897, 71042, 71047, 64898, 71043, 71048, 71811, 71817, 58373, 57227, 71812, 71818, 58374, 57228, 71813, 71819, 58368, 57229, 71814, 71820, 58369, 57223, 71808, 71821, 58370, 57224, 71809, 71815, 58371, 57225, 71810, 71816, 58372, 57226, 72582, 64903, 72588, 72576, 64904, 72589, 72577, 64905, 72583, 72578, 64906, 72584, 72579, 64907, 72585, 72580, 64908, 72586, 72581, 64909, 72587, 65670, 73348, 73351, 58377, 65664, 73349, 73352, 58378, 65665, 73350, 73353, 58379, 65666, 73344, 73354, 58380, 65667, 73345, 73355, 58381, 65668, 73346, 73356, 58375, 65669, 73347, 73357, 58376, 66438, 65671, 74125, 66432, 65672, 74119, 66433, 65673, 74120, 66434, 65674, 74121, 66435, 65675, 74122, 66436, 65676, 74123, 66437, 65677, 74124, 67200, 74112, 22276, 59523, 59528, 67201, 74113, 22277, 59524, 59529, 67202, 74114, 22278, 59525, 59530, 67203, 74115, 22272, 59526, 59531, 67204, 74116, 22273, 59520, 59532, 67205, 74117, 22274, 59521, 59533, 67206, 74118, 22275, 59522, 59527, 74880, 66439, 74881, 66440, 74882, 66441, 74883, 66442, 74884, 66443, 74885, 66444, 74886, 66445, 67207, 74887, 67208, 74888, 67209, 74889, 67210, 74890, 67211, 74891, 67212, 74892, 67213, 74893, 29952, 29953, 29954, 29955, 29956, 29957, 29958, 60672, 60673, 60674, 60675, 60676, 60677, 60678, 60679, 60680, 60681, 60682, 60683, 60684, 60685}; | 2,600 | 2,600 | 0.716538 |
b47bdeaf34436d039c36944e35a21e2ebea45901 | 348 | h | C | ya2d_ps3/libya2d/include/ya2d_utils.h | nikolaevich23/pk | 9e5219312ac0cc3ace0e3bf663cba513ebc42a05 | [
"MIT"
] | 4 | 2021-12-15T01:32:17.000Z | 2022-03-07T12:17:21.000Z | ya2d_ps3/libya2d/include/ya2d_utils.h | ErikPshat/PKGi-PS3-RUS-MOD | 97de918938322d4fe4b08d6ac33d994634068c08 | [
"MIT"
] | null | null | null | ya2d_ps3/libya2d/include/ya2d_utils.h | ErikPshat/PKGi-PS3-RUS-MOD | 97de918938322d4fe4b08d6ac33d994634068c08 | [
"MIT"
] | 1 | 2022-03-19T07:23:34.000Z | 2022-03-19T07:23:34.000Z | #ifndef _YA2D_UTILS_H_
#define _YA2D_UTILS_H_
#include <tiny3d.h>
#include "ya2d_main.h"
#include "ya2d_globals.h"
void swizzle_fast(u8* out, const u8* in, unsigned int width, unsigned int height); //from PSPSDK sample
unsigned int __attribute__((noinline)) next_pow2(unsigned int x); //from http://locklessinc.com/articles/next_pow2/
#endif
| 23.2 | 115 | 0.767241 |
f13e3941b03114d16563030b7139e92adc1e586a | 4,674 | h | C | graphic/scenes/tablesub/call.h | MihailJP/MiHaJong | b81168ab2696dd29af5c400b84c870a9b8a2f01e | [
"MIT"
] | 13 | 2016-01-20T02:10:52.000Z | 2022-03-08T15:51:36.000Z | graphic/scenes/tablesub/call.h | MihailJP/MiHaJong | b81168ab2696dd29af5c400b84c870a9b8a2f01e | [
"MIT"
] | 13 | 2020-09-28T12:57:52.000Z | 2022-02-20T19:20:57.000Z | graphic/scenes/tablesub/call.h | MihailJP/MiHaJong | b81168ab2696dd29af5c400b84c870a9b8a2f01e | [
"MIT"
] | 4 | 2016-09-19T13:44:10.000Z | 2022-02-18T08:13:37.000Z | #pragma once
#include "tablesub.h"
#include "../../gametbl.h"
#include "../../calltext.h"
namespace mihajong_graphic {
class TableSubsceneCallProto : public TableSubscene {
protected:
TexturePtr tCall;
virtual void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y) = 0;
virtual void ShowCall(PlayerID player, int x, int y) = 0;
virtual void ShowAllCall();
public:
TableSubsceneCallProto(DevicePtr device);
TableSubsceneCallProto(const TableSubsceneCallProto&) = delete; // Delete unexpected copy constructor
TableSubsceneCallProto& operator= (const TableSubsceneCallProto&) = delete; // Delete unexpected assign operator
virtual ~TableSubsceneCallProto();
virtual void skipEvent();
};
class TableSubsceneCallChankanRon;
class TableSubsceneCallZoomProto : public TableSubsceneCallProto {
protected:
void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y);
void ShowCall(PlayerID player, int x, int y);
public:
TableSubsceneCallZoomProto(DevicePtr device);
TableSubsceneCallZoomProto(const TableSubsceneCallZoomProto&) = delete; // Delete unexpected copy constructor
TableSubsceneCallZoomProto& operator= (const TableSubsceneCallZoomProto&) = delete; // Delete unexpected assign operator
virtual ~TableSubsceneCallZoomProto();
};
class TableSubsceneCall : public TableSubsceneCallZoomProto {
friend class TableSubsceneCallChankanRon;
public:
TableSubsceneCall(DevicePtr device);
TableSubsceneCall(const TableSubsceneCall&) = delete; // Delete unexpected copy constructor
TableSubsceneCall& operator= (const TableSubsceneCall&) = delete; // Delete unexpected assign operator
~TableSubsceneCall();
void Render();
};
class TableSubsceneCallFadeProto : public TableSubsceneCallProto {
protected:
void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y);
void ShowCall(PlayerID player, int x, int y);
public:
TableSubsceneCallFadeProto(DevicePtr device);
TableSubsceneCallFadeProto(const TableSubsceneCallFadeProto&) = delete; // Delete unexpected copy constructor
TableSubsceneCallFadeProto& operator= (const TableSubsceneCallFadeProto&) = delete; // Delete unexpected assign operator
virtual ~TableSubsceneCallFadeProto();
};
class TableSubsceneCallFade : public TableSubsceneCallFadeProto {
public:
TableSubsceneCallFade(DevicePtr device);
TableSubsceneCallFade(const TableSubsceneCallFade&) = delete; // Delete unexpected copy constructor
TableSubsceneCallFade& operator= (const TableSubsceneCallFade&) = delete; // Delete unexpected assign operator
~TableSubsceneCallFade();
void Render();
};
class TableSubsceneCallCutProto : public TableSubsceneCallProto {
protected:
virtual void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y);
void ShowCall(PlayerID player, int x, int y);
public:
TableSubsceneCallCutProto(DevicePtr device);
TableSubsceneCallCutProto(const TableSubsceneCallCutProto&) = delete; // Delete unexpected copy constructor
TableSubsceneCallCutProto& operator= (const TableSubsceneCallCutProto&) = delete; // Delete unexpected assign operator
virtual ~TableSubsceneCallCutProto();
};
class TableSubsceneCallCut : public TableSubsceneCallCutProto {
friend class TableSubsceneCallChankanRon;
public:
TableSubsceneCallCut(DevicePtr device);
TableSubsceneCallCut(const TableSubsceneCallCut&) = delete; // Delete unexpected copy constructor
TableSubsceneCallCut& operator= (const TableSubsceneCallCut&) = delete; // Delete unexpected assign operator
~TableSubsceneCallCut();
void Render();
};
class TableSubsceneCallChankanPre : public TableSubsceneCallCutProto {
protected:
void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y);
public:
TableSubsceneCallChankanPre(DevicePtr device);
TableSubsceneCallChankanPre(const TableSubsceneCallChankanPre&) = delete; // Delete unexpected copy constructor
TableSubsceneCallChankanPre& operator= (const TableSubsceneCallChankanPre&) = delete; // Delete unexpected assign operator
~TableSubsceneCallChankanPre();
void Render();
};
class TableSubsceneCallChankanRon : public TableSubsceneCallProto {
private:
TableSubsceneCall* zoomCall;
TableSubsceneCallCut* cutCall;
protected:
void ShowCallMsg(PlayerID player, calltext::CallType callType, int x, int y);
void ShowCall(PlayerID player, int x, int y);
public:
TableSubsceneCallChankanRon(DevicePtr device);
TableSubsceneCallChankanRon(const TableSubsceneCallChankanRon&) = delete; // Delete unexpected copy constructor
TableSubsceneCallChankanRon& operator= (const TableSubsceneCallChankanRon&) = delete; // Delete unexpected assign operator
~TableSubsceneCallChankanRon();
void Render();
};
}
| 41 | 123 | 0.809585 |
f1c0660f3accfab663a310c5fc4aec390c14106e | 2,523 | h | C | MEIClient/AMTHIClient/Include/GetSecurityParametersCommand.h | rgl/lms | cda6a25e0f39b2a18f10415560ee6a2cfc5fbbcb | [
"Apache-2.0"
] | 18 | 2019-04-17T10:43:35.000Z | 2022-03-22T22:30:39.000Z | MEIClient/AMTHIClient/Include/GetSecurityParametersCommand.h | rgl/lms | cda6a25e0f39b2a18f10415560ee6a2cfc5fbbcb | [
"Apache-2.0"
] | 9 | 2019-10-03T15:29:51.000Z | 2021-12-27T14:03:33.000Z | MEIClient/AMTHIClient/Include/GetSecurityParametersCommand.h | isabella232/lms | 50d16f81b49aba6007388c001e8137352c5eb42e | [
"Apache-2.0"
] | 8 | 2019-06-13T23:30:50.000Z | 2021-06-25T15:51:59.000Z | /* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2010-2019 Intel Corporation
*/
/*++
@file: GetSecurityParametersCommand.h
--*/
#ifndef __GET_SECURITY_PARAMETERS_COMMAND_H__
#define __GET_SECURITY_PARAMETERS_COMMAND_H__
#include "AMTHICommand.h"
#include "MEIparser.h"
namespace Intel
{
namespace MEI_Client
{
namespace AMTHI_Client
{
struct SECURITY_PARAMETERS
{
bool EnterpriseMode;
bool TLSEnabled;
bool HWCryptoEnabled;
AMT_PROVISIONING_STATE ProvisioningState;
bool NetworkInterfaceEnabled;
bool SOLEnabled;
bool IDEREnabled;
bool FWUpdateEnabled;
bool LinkIsUp;
bool KvmEnabled;
//vector<bool> Reserved; //size = 7
void parse (std::vector<uint8_t>::const_iterator& itr, const std::vector<uint8_t>::const_iterator end)
{
struct {
uint32_t tmp[17];
} tmp;
Intel::MEI_Client::parseData(tmp, itr, end);
EnterpriseMode = (tmp.tmp[0] == AMT_TRUE);
TLSEnabled = (tmp.tmp[1] == AMT_TRUE);
HWCryptoEnabled = (tmp.tmp[2] == AMT_TRUE);
ProvisioningState = (AMT_PROVISIONING_STATE)tmp.tmp[3];
NetworkInterfaceEnabled = (tmp.tmp[4] == AMT_TRUE);
SOLEnabled = (tmp.tmp[5] == AMT_TRUE);
IDEREnabled = (tmp.tmp[6] == AMT_TRUE);
FWUpdateEnabled = (tmp.tmp[7] == AMT_TRUE);
LinkIsUp = (tmp.tmp[8] == AMT_TRUE);
KvmEnabled = (tmp.tmp[9] == AMT_TRUE);
}
};
class GetSecurityParametersRequest;
class GetSecurityParametersCommand : public AMTHICommand
{
public:
GetSecurityParametersCommand();
virtual ~GetSecurityParametersCommand() {}
SECURITY_PARAMETERS getResponse();
private:
virtual void parseResponse(const std::vector<uint8_t>& buffer);
std::shared_ptr<AMTHICommandResponse<SECURITY_PARAMETERS>> m_response;
static const uint32_t RESPONSE_COMMAND_NUMBER = 0x0480001B;
};
class GetSecurityParametersRequest : public AMTHICommandRequest
{
public:
GetSecurityParametersRequest() {}
virtual ~GetSecurityParametersRequest() {}
private:
static const uint32_t REQUEST_COMMAND_NUMBER = 0x0400001B;
virtual unsigned int requestHeaderCommandNumber()
{
//this is the command number (taken from the AMTHI document)
return REQUEST_COMMAND_NUMBER;
}
virtual uint32_t requestDataSize()
{
return 0;
}
};
} // namespace AMTHI_Client
} // namespace MEI_Client
} // namespace Intel
#endif //__GET_SECURITY_PARAMETERS_COMMAND_H__ | 26.010309 | 106 | 0.68807 |
9a106c8674307887a05fb2bce8f2aecb762ddf03 | 2,851 | h | C | src/Camera.h | LeifNode/World-Generator | f9818fb6c5d507eede76141c2687a66f090cbdc1 | [
"MIT"
] | 16 | 2015-02-12T20:56:01.000Z | 2021-05-31T21:05:41.000Z | src/Camera.h | LeifNode/World-Generator | f9818fb6c5d507eede76141c2687a66f090cbdc1 | [
"MIT"
] | null | null | null | src/Camera.h | LeifNode/World-Generator | f9818fb6c5d507eede76141c2687a66f090cbdc1 | [
"MIT"
] | 3 | 2017-02-05T15:52:34.000Z | 2018-02-09T08:51:00.000Z | //The MIT License (MIT)
//
//Copyright (c) 2014 Leif Erkenbrach
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//THE SOFTWARE.
#pragma once
#include "glStd.h"
using glm::quat;
class Camera
{
public:
//Camera();
Camera(GLFWwindow* window, const vec3& position, const vec3& direction, const vec3& up);
~Camera();
mat4 getView();
mat4 getProj() const { return mProjection; }
__declspec(property(get = getPosition, put = setPosition)) dvec3 position;
dvec3 getPosition() const { return mPosition; }
void setPosition(const dvec3& newPosition) { mPosition = newPosition; }
__declspec(property(get = getDirection, put = setDirection)) vec3 direction;
vec3 getDirection();
void setDirection(const vec3& newDir);
__declspec(property(get = getPitch, put = setPitch)) float pitch;
float getPitch() const { return mPitch; }
void setPitch(float pitch);
__declspec(property(get = getYaw, put = setYaw)) float yaw;
float getYaw() const { return mYaw; }
void setYaw(float yaw) { mYaw = yaw; mDirectionChanged = true; }
float getNear() const { return mNear; }
float getFar() const { return mFar; }
float getVelocity() const { return mVelocity; }
void OnMouseMove(float x, float y);
void OnMouseDown(int button);
void OnMouseUp(int button);
void OnScreenResize(int width, int height);
void Update(float dt);
private:
void updatePosition(float dt);
void updateOrientation(float dt);
void setProjection(int width, int height, float fovVertical);
mat4 getLookAt(const vec3& eye, const vec3& direction, const vec3& up);
private:
GLFWwindow* mpWindow;
mat4 mProjection;
dvec3 mPosition;
vec3 mDirection;
vec3 mAdjustedDirection;
vec3 mUp, mRight;
quat mRotation;
float mNear;
float mFar;
float mVelocity;
float mPitch, mYaw;
vec2 mLastMousePosition;
bool mReadingMouse;
bool mDirectionChanged;
bool mFreeRoam;
}; | 30.010526 | 89 | 0.750263 |
62442e83a3e2cb19854e51a9f01c4b8c482cb823 | 93 | h | C | exercise3/knownprimes.h | SunriseFox/very-simple-cipher-lab | 40e1a9408c1ba89ebedf481904de592bd5d7c83e | [
"MIT"
] | null | null | null | exercise3/knownprimes.h | SunriseFox/very-simple-cipher-lab | 40e1a9408c1ba89ebedf481904de592bd5d7c83e | [
"MIT"
] | null | null | null | exercise3/knownprimes.h | SunriseFox/very-simple-cipher-lab | 40e1a9408c1ba89ebedf481904de592bd5d7c83e | [
"MIT"
] | null | null | null | #ifndef KNOWNPRIMES_H
#define KNOWNPRIMES_H
extern int primes[];
#endif // KNOWNPRIMES_H
| 18.6 | 24 | 0.763441 |
6d491f4a16de0592771df90d46ab53c01c3d8a22 | 819 | c | C | src/floors.c | mikeyhc/advent-of-code-2015 | b75cdf34c718604e31b00445d948abf354d4ac00 | [
"Unlicense"
] | null | null | null | src/floors.c | mikeyhc/advent-of-code-2015 | b75cdf34c718604e31b00445d948abf354d4ac00 | [
"Unlicense"
] | null | null | null | src/floors.c | mikeyhc/advent-of-code-2015 | b75cdf34c718604e31b00445d948abf354d4ac00 | [
"Unlicense"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#define _POSIX_C_SOURCE 200809L
int
main(int argc, char **argv)
{
FILE *input = stdin;
char *line = NULL;
size_t len = 0;
int floor = 0, basement = -1;
char *s;
if (argc > 1)
input = fopen(argv[1], "r");
if (input == NULL) {
perror("failure opening input file");
return -1;
}
if (getline(&line, &len, input) <= 0) {
fprintf(stderr, "no input provided\n");
exit(1);
}
s = line;
while (*s != '\n' && *s != '\0') {
if (*s == '(') {
++floor;
} else if (*s == ')') {
--floor;
} else {
fprintf(stderr, "unknown instruction: %c\n", *s);
return 1;
}
if (basement < 0 && floor < 0)
basement = s - line + 1;
++s;
}
free(line);
if (input != stdin)
fclose(input);
printf("%d\n", floor);
printf("%d\n", basement);
return 0;
}
| 15.45283 | 52 | 0.537241 |
137973603bf4b77abfcb7d0ecd627b6bf63203eb | 304 | h | C | src/content/xml/xml_range.h | lavima/GaME | f816dff62c731e0f807b00300a061d45e7ffd93b | [
"MIT"
] | null | null | null | src/content/xml/xml_range.h | lavima/GaME | f816dff62c731e0f807b00300a061d45e7ffd93b | [
"MIT"
] | null | null | null | src/content/xml/xml_range.h | lavima/GaME | f816dff62c731e0f807b00300a061d45e7ffd93b | [
"MIT"
] | null | null | null | #pragma once
namespace game::content::xml {
template<typename I> class GAME_API XmlRange {
private:
I begin_;
I end_;
public:
XmlRange(I begin, I end) : begin_(begin), end_(end) {}
I begin() { return begin_; }
I end() { return end_; }
};
}
| 14.47619 | 62 | 0.539474 |
1a9f3c60547aa75c7d13a4e99612e9a289597a4e | 10,344 | c | C | old/ar11/ar11.c | weiss/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 114 | 2015-01-18T22:55:52.000Z | 2022-02-17T10:45:02.000Z | old/ar11/ar11.c | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | null | null | null | old/ar11/ar11.c | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 29 | 2015-11-03T22:05:22.000Z | 2022-02-08T15:36:37.000Z | static char *sccsid = "@(#)ar11.c 4.6 (Berkeley) 05/11/89";
/* ar11 - archiver for PDP-11 formatted archives */
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/stat.h>
#include <stdio.h>
#include "pathnames.h"
#define ARMAG ((short)0177545)
struct ar_hdr {
char ar_name[14];
short ar_sdate[2];
char ar_uid;
char ar_gid;
short ar_mode;
short ar_ssize[2];
};
long ar_date;
long ar_size;
#ifdef vax
#define fixshort(s) (s)
#define mklong(sp) (((sp)[0] << 16) + (sp)[1])
#define unmklong(sp,l) { sp[0] = l >> 16; sp[1] = l & 0177777; }
#define fixhdr(hdr) (hdr)
#endif
#if defined(mc68000) || defined(tahoe)
#define fixshort(s) ((short)(((s>>8)&0377)+((s&0377)<<8)))
#define mklong(sp) (((sp)[0] << 16) + (sp)[1])
#define unmklong(sp,l) { sp[0] = l >> 16; sp[1] = l & 0177777; }
#define fixhdr(hdr) swaphdr(hdr)
struct ar_hdr swaphdr();
#endif
struct stat stbuf;
struct ar_hdr arbuf;
#define SKIP 1
#define IODD 2
#define OODD 4
#define HEAD 8
char *man = { "mrxtdp" };
char *opt = { "uvnbai" };
int signum[] = {SIGHUP, SIGINT, SIGQUIT, 0};
int sigdone();
int rcmd();
int dcmd();
int xcmd();
int tcmd();
int pcmd();
int mcmd();
int (*comfun)();
char flg[26];
char **namv;
int namc;
char *arnam;
char *ponam;
char *tfnam;
char *tf1nam;
char *tf2nam;
char *file;
char name[16];
int af;
int tf;
int tf1;
int tf2;
int bastate;
char buf[512];
char *trim();
char *mktemp();
char *ctime();
main(argc, argv)
char *argv[];
{
register i;
register char *cp;
for(i=0; signum[i]; i++)
if(signal(signum[i], SIG_IGN) != SIG_IGN)
signal(signum[i], sigdone);
if(argc < 3)
usage();
cp = argv[1];
for(cp = argv[1]; *cp; cp++)
switch(*cp) {
case 'c':
case 'v':
case 'u':
case 'n':
case 'a':
case 'b':
case 'i':
flg[*cp - 'a']++;
continue;
case 'r':
setcom(rcmd);
continue;
case 'd':
setcom(dcmd);
continue;
case 'x':
setcom(xcmd);
continue;
case 't':
setcom(tcmd);
continue;
case 'p':
setcom(pcmd);
continue;
case 'm':
setcom(mcmd);
continue;
default:
fprintf(stderr, "ar11: bad option `%c'\n", *cp);
done(1);
}
if(flg['i'-'a'])
flg['b'-'a']++;
if(flg['a'-'a'] || flg['b'-'a']) {
bastate = 1;
ponam = trim(argv[2]);
argv++;
argc--;
if(argc < 3)
usage();
}
arnam = argv[2];
namv = argv+3;
namc = argc-3;
if(comfun == 0) {
if(flg['u'-'a'] == 0) {
fprintf(stderr, "ar11: one of [%s] must be specified\n", man);
done(1);
}
setcom(rcmd);
}
(*comfun)();
done(notfound());
}
setcom(fun)
int (*fun)();
{
if(comfun != 0) {
fprintf(stderr, "ar11: only one of [%s] allowed\n", man);
done(1);
}
comfun = fun;
}
rcmd()
{
register f;
init();
if(getaf() && flg['c'-'a']==0) {
fprintf(stderr, "ar11: %s does not exist\n", arnam);
done(1);
}
while(!getdir()) {
bamatch();
if(namc == 0 || match()) {
f = stats();
if(f < 0) {
if(namc)
fprintf(stderr, "ar11: cannot open %s\n", file);
goto cp;
}
if(flg['u'-'a'])
if(stbuf.st_mtime <= ar_date) {
close(f);
goto cp;
}
mesg('r');
copyfil(af, -1, IODD+SKIP);
movefil(f);
continue;
}
cp:
mesg('c');
copyfil(af, tf, IODD+OODD+HEAD);
}
cleanup();
}
dcmd()
{
init();
if(getaf())
noar();
while(!getdir()) {
if(match()) {
mesg('d');
copyfil(af, -1, IODD+SKIP);
continue;
}
mesg('c');
copyfil(af, tf, IODD+OODD+HEAD);
}
install();
}
xcmd()
{
register f;
if(getaf())
noar();
while(!getdir()) {
if(namc == 0 || match()) {
f = creat(file, arbuf.ar_mode & 0777);
if(f < 0) {
fprintf(stderr, "ar11: %s cannot create\n", file);
goto sk;
}
mesg('x');
copyfil(af, f, IODD);
close(f);
continue;
}
sk:
mesg('c');
copyfil(af, -1, IODD+SKIP);
}
}
pcmd()
{
if(getaf())
noar();
while(!getdir()) {
if(namc == 0 || match()) {
if(flg['v'-'a']) {
printf("\n<%s>\n\n", file);
fflush(stdout);
}
copyfil(af, 1, IODD);
continue;
}
copyfil(af, -1, IODD+SKIP);
}
}
mcmd()
{
static char name2[] = _PATH_TMP2;
init();
if(getaf())
noar();
tf2nam = mktemp(name2);
close(creat(tf2nam, 0600));
tf2 = open(tf2nam, 2);
if(tf2 < 0) {
fprintf(stderr, "ar11: cannot create third temp\n");
done(1);
}
while(!getdir()) {
bamatch();
if(match()) {
mesg('m');
copyfil(af, tf2, IODD+OODD+HEAD);
continue;
}
mesg('c');
copyfil(af, tf, IODD+OODD+HEAD);
}
install();
}
tcmd()
{
if(getaf())
noar();
while(!getdir()) {
if(namc == 0 || match()) {
if(flg['v'-'a'])
longt();
printf("%s\n", trim(file));
}
copyfil(af, -1, IODD+SKIP);
}
}
init()
{
static char name0[] = _PATH_TMP0;
static short mbuf = fixshort(ARMAG);
tfnam = mktemp(name0);
close(creat(tfnam, 0600));
tf = open(tfnam, 2);
if(tf < 0) {
fprintf(stderr, "ar11: cannot create temp file\n");
done(1);
}
if (write(tf, (char *)&mbuf, sizeof(short)) != sizeof(short))
wrerr();
}
getaf()
{
short mbuf;
af = open(arnam, 0);
if(af < 0)
return(1);
if (read(af, (char *)&mbuf, sizeof(short)) != sizeof(short) ||
mbuf != fixshort(ARMAG)) {
fprintf(stderr, "ar11: %s not in PDP-11 archive format\n", arnam);
done(1);
}
return(0);
}
usage()
{
printf("usage: ar11 [%s][%s] archive files ...\n", opt, man);
done(1);
}
noar()
{
fprintf(stderr, "ar11: %s does not exist\n", arnam);
done(1);
}
sigdone()
{
done(100);
}
done(c)
{
if(tfnam)
unlink(tfnam);
if(tf1nam)
unlink(tf1nam);
if(tf2nam)
unlink(tf2nam);
exit(c);
}
notfound()
{
register i, n;
n = 0;
for(i=0; i<namc; i++)
if(namv[i]) {
fprintf(stderr, "ar11: %s not found\n", namv[i]);
n++;
}
return(n);
}
cleanup()
{
register i, f;
for(i=0; i<namc; i++) {
file = namv[i];
if(file == 0)
continue;
namv[i] = 0;
mesg('a');
f = stats();
if(f < 0) {
fprintf(stderr, "ar11: %s cannot open\n", file);
continue;
}
movefil(f);
}
install();
}
install()
{
register i;
for(i=0; signum[i]; i++)
signal(signum[i], (int (*)())1);
close(af);
af = creat(arnam, 0666);
if(af < 0) {
fprintf(stderr, "ar11: cannot create %s\n", arnam);
done(1);
}
lseek(tf, 0l, 0);
while((i = read(tf, buf, 512)) > 0)
if (write(af, buf, i) != i)
wrerr();
if(tf2nam) {
lseek(tf2, 0l, 0);
while((i = read(tf2, buf, 512)) > 0)
if (write(af, buf, i) != i)
wrerr();
}
if(tf1nam) {
lseek(tf1, 0l, 0);
while((i = read(tf1, buf, 512)) > 0)
if (write(af, buf, i) != i)
wrerr();
}
}
/*
* insert the file 'file'
* into the temporary file
*/
movefil(f)
{
register char *cp;
register i;
cp = trim(file);
for(i=0; i<14; i++)
if(arbuf.ar_name[i] = *cp)
cp++;
ar_size = stbuf.st_size;
ar_date = stbuf.st_mtime;
unmklong(arbuf.ar_ssize, ar_size);
unmklong(arbuf.ar_sdate, ar_date);
arbuf.ar_uid = stbuf.st_uid;
arbuf.ar_gid = stbuf.st_gid;
arbuf.ar_mode = stbuf.st_mode;
copyfil(f, tf, OODD+HEAD);
close(f);
}
stats()
{
register f;
f = open(file, 0);
if(f < 0)
return(f);
if(fstat(f, &stbuf) < 0) {
close(f);
return(-1);
}
return(f);
}
/*
* copy next file
* size given in arbuf
*/
copyfil(fi, fo, flag)
{
register i, o;
int pe;
if(flag & HEAD) {
struct ar_hdr tmpbuf;
tmpbuf = fixhdr(arbuf);
if (write(fo, (char *)&tmpbuf, sizeof arbuf) != sizeof arbuf)
wrerr();
}
pe = 0;
while(ar_size > 0) {
i = o = 512;
if(ar_size < i) {
i = o = ar_size;
if(i&1) {
if(flag & IODD)
i++;
if(flag & OODD)
o++;
}
}
if(read(fi, buf, i) != i)
pe++;
if((flag & SKIP) == 0)
if (write(fo, buf, o) != o)
wrerr();
ar_size -= 512;
}
if(pe)
phserr();
}
getdir()
{
register i;
i = read(af, (char *)&arbuf, sizeof arbuf);
if(i != sizeof arbuf) {
if(tf1nam) {
i = tf;
tf = tf1;
tf1 = i;
}
return(1);
}
arbuf = fixhdr(arbuf);
for(i=0; i<14; i++)
name[i] = arbuf.ar_name[i];
file = name;
ar_date = mklong(arbuf.ar_sdate);
ar_size = mklong(arbuf.ar_ssize);
return(0);
}
match()
{
register i;
for(i=0; i<namc; i++) {
if(namv[i] == 0)
continue;
if(strcmp(trim(namv[i]), file) == 0) {
file = namv[i];
namv[i] = 0;
return(1);
}
}
return(0);
}
bamatch()
{
static char name1[] = _PATH_TMP1;
register f;
switch(bastate) {
case 1:
if(strcmp(file, ponam) != 0)
return;
bastate = 2;
if(flg['a'-'a'])
return;
case 2:
bastate = 0;
tf1nam = mktemp(name1);
close(creat(tf1nam, 0600));
f = open(tf1nam, 2);
if(f < 0) {
fprintf(stderr, "ar11: cannot create second temp\n");
return;
}
tf1 = tf;
tf = f;
}
}
phserr()
{
fprintf(stderr, "ar11: phase error on %s\n", file);
}
mesg(c)
{
if(flg['v'-'a'])
if(c != 'c' || flg['v'-'a'] > 1)
printf("%c - %s\n", c, file);
}
char *
trim(s)
char *s;
{
register char *p1, *p2;
for(p1 = s; *p1; p1++)
;
while(p1 > s) {
if(*--p1 != '/')
break;
*p1 = 0;
}
p2 = s;
for(p1 = s; *p1; p1++)
if(*p1 == '/')
p2 = p1+1;
return(p2);
}
#define IFMT 060000
#define ISARG 01000
#define LARGE 010000
#define SUID 04000
#define SGID 02000
#define ROWN 0400
#define WOWN 0200
#define XOWN 0100
#define RGRP 040
#define WGRP 020
#define XGRP 010
#define ROTH 04
#define WOTH 02
#define XOTH 01
#define STXT 01000
longt()
{
register char *cp;
pmode();
printf("%3d/%1d", arbuf.ar_uid, arbuf.ar_gid);
printf("%7D", ar_size);
cp = ctime(&ar_date);
printf(" %-12.12s %-4.4s ", cp+4, cp+20);
}
int m1[] = { 1, ROWN, 'r', '-' };
int m2[] = { 1, WOWN, 'w', '-' };
int m3[] = { 2, SUID, 's', XOWN, 'x', '-' };
int m4[] = { 1, RGRP, 'r', '-' };
int m5[] = { 1, WGRP, 'w', '-' };
int m6[] = { 2, SGID, 's', XGRP, 'x', '-' };
int m7[] = { 1, ROTH, 'r', '-' };
int m8[] = { 1, WOTH, 'w', '-' };
int m9[] = { 2, STXT, 't', XOTH, 'x', '-' };
int *m[] = { m1, m2, m3, m4, m5, m6, m7, m8, m9};
pmode()
{
register int **mp;
for (mp = &m[0]; mp < &m[9];)
select(*mp++);
}
select(pairp)
int *pairp;
{
register int n, *ap;
ap = pairp;
n = *ap++;
while (--n>=0 && (arbuf.ar_mode&*ap++)==0)
ap++;
putchar(*ap);
}
wrerr()
{
perror("ar write error");
done(1);
}
#if defined(mc68000) || defined(tahoe)
struct ar_hdr
swaphdr(hdr)
struct ar_hdr hdr;
{
hdr.ar_sdate[0] = fixshort(hdr.ar_sdate[0]);
hdr.ar_sdate[1] = fixshort(hdr.ar_sdate[1]);
hdr.ar_ssize[0] = fixshort(hdr.ar_ssize[0]);
hdr.ar_ssize[1] = fixshort(hdr.ar_ssize[1]);
hdr.ar_mode = fixshort(hdr.ar_mode);
return (hdr);
}
#endif
| 15.211765 | 68 | 0.549111 |
9e2e2339cc948a18aa9e6fff2599728d6afd469f | 7,076 | c | C | src/depress.c | plzombie/depress | a3b3daa5fb26a03e6429fa3fa4da3144d1dc6aa7 | [
"BSD-2-Clause"
] | null | null | null | src/depress.c | plzombie/depress | a3b3daa5fb26a03e6429fa3fa4da3144d1dc6aa7 | [
"BSD-2-Clause"
] | null | null | null | src/depress.c | plzombie/depress | a3b3daa5fb26a03e6429fa3fa4da3144d1dc6aa7 | [
"BSD-2-Clause"
] | null | null | null | /*
BSD 2-Clause License
Copyright (c) 2021, Mikhail Morozov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE 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.
*/
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <process.h>
#include <wchar.h>
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <io.h>
#include "../include/depress_paths.h"
#include "../include/depress_tasks.h"
#include "../include/depress_threads.h"
int wmain(int argc, wchar_t **argv)
{
wchar_t **argsp;
int argsc;
wchar_t text_list_filename[32768], text_list_path[32768], *text_list_name_start;
size_t text_list_path_size;
wchar_t temp_path[32768];
wchar_t arg0[32770], arg1[32770], arg2[32770];
depress_flags_type flags;
size_t filecount = 0;
depress_task_type *tasks = 0;
size_t tasks_num = 0;
DWORD text_list_fn_length;
int threads_num = 0;
HANDLE *threads;
HANDLE global_error_event;
depress_djvulibre_paths_type djvulibre_paths;
depress_thread_arg_type *thread_args;
bool is_error = false;
int i;
clock_t time_start;
flags.bw = false;
setlocale(LC_ALL, "");
#ifdef _MSC_VER
_setmode(_fileno(stdin), _O_U16TEXT);
_setmode(_fileno(stdout), _O_U16TEXT);
_setmode(_fileno(stderr), _O_U16TEXT);
#endif
// Reading options
argsc = argc - 1;
argsp = argv + 1;
while(argsc > 0) {
if((*argsp)[0] != '-')
break;
argsc--;
if(!wcscmp(*argsp, L"-bw"))
flags.bw = true;
else
wprintf(L"Warning: unknown argument %ls\n", *argsp);
argsp++;
}
if(argsc < 2) {
wprintf(
L"\tdepress [options] input.txt output.djvu\n"
L"\t\toptions:\n"
L"\t\t\t-bw - create black and white document\n\n"
);
return 0;
}
time_start = clock();
if(wcslen(*(argsp + 1)) > 32767) {
wprintf(L"Error: output file name is too long\n");
return 0;
}
// Searching for files list with picture names
text_list_fn_length = SearchPathW(NULL, *argsp, L".txt", 32768, text_list_filename, &text_list_name_start);
if(!text_list_fn_length) {
wprintf(L"Can't find files list\n");
return 0;
}
if(text_list_fn_length > 32768) {
wprintf(L"Error: path for files list is too long\n");
return 0;
}
text_list_path_size = text_list_name_start - text_list_filename;
wcsncpy(text_list_path, text_list_filename, text_list_path_size);
text_list_path[text_list_path_size] = 0;
// Enabling safe search mode
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
// Get paths to djvulibre files
if(!depressGetDjvulibrePaths(&djvulibre_paths)) {
wprintf(L"Can't find djvulibre files\n");
return 0;
}
// Creating task list from file
wprintf(L"Opening list: \"%ls\"\n", text_list_filename);
if(!depressGetTempFolder(temp_path)) {
wprintf(L"Can't get path for temporary files\n");
return 0;
}
if(!depressCreateTasks(text_list_filename, text_list_path, *(argsp + 1), temp_path, flags, &tasks, &tasks_num)) {
wprintf(L"Can't create files list\n");
return 0;
}
threads_num = depressGetNumberOfThreads();
if(threads_num <= 0) threads_num = 1;
if(threads_num > 64) threads_num = 64;
threads = malloc(sizeof(HANDLE) * threads_num);
thread_args = malloc(sizeof(depress_thread_arg_type) * threads_num);
if(!threads || !thread_args) {
if(threads) free(threads);
if(thread_args) free(thread_args);
depressDestroyTasks(tasks, tasks_num);
depressDestroyTempFolder(temp_path);
wprintf(L"Can't allocate memory\n");
return 0;
}
global_error_event = CreateEventW(NULL, TRUE, FALSE, NULL);
if(global_error_event == NULL) {
free(threads);
free(thread_args);
depressDestroyTasks(tasks, tasks_num);
depressDestroyTempFolder(temp_path);
wprintf(L"Can't create event\n");
return 0;
}
for(i = 0; i < threads_num; i++) {
thread_args[i].tasks = tasks;
thread_args[i].djvulibre_paths = &djvulibre_paths;
thread_args[i].tasks_num = tasks_num;
thread_args[i].thread_id = i;
thread_args[i].threads_num = threads_num;
thread_args[i].global_error_event = global_error_event;
threads[i] = (HANDLE)_beginthreadex(0, 0, depressThreadProc, thread_args + i, 0, 0);
if(!threads[i]) {
int j;
WaitForMultipleObjects(i, threads, TRUE, INFINITE);
for(j = 0; j < i; j++)
CloseHandle(threads[j]);
is_error = true;
break;
}
}
// Creating djvu
if(!is_error) {
swprintf(arg1, 32770, L"\"%ls\"", *(argsp + 1));
for(filecount = 0; filecount < tasks_num; filecount++) {
if(!is_error)
if(WaitForSingleObject(global_error_event, 0) == WAIT_OBJECT_0)
is_error = true;
while(WaitForSingleObject(tasks[filecount].finished, INFINITE) != WAIT_OBJECT_0);
if(!tasks[filecount].is_completed)
continue;
if(tasks[filecount].is_error) {
wprintf(L"Error while converting file \"%ls\"\n", tasks[filecount].inputfile);
is_error = true;
} else {
if(is_error == false && filecount > 0) {
wprintf(L"Merging file \"%ls\"\n", tasks[filecount].inputfile);
swprintf(arg2, 32770, L"\"%ls\"", tasks[filecount].outputfile);
swprintf(arg0, 32770, L"\"%ls\"", djvulibre_paths.djvm_path);
if(_wspawnl(_P_WAIT, djvulibre_paths.djvm_path, arg0, L"-i", arg1, arg2, 0)) {
wprintf(L"Can't merge djvu files\n");
is_error = true;
}
}
if(filecount > 0)
if(!_waccess(tasks[filecount].outputfile, 06))
_wremove(tasks[filecount].outputfile);
}
}
}
if(!is_error) {
WaitForMultipleObjects(threads_num, threads, TRUE, INFINITE);
for(i = 0; i < threads_num; i++)
CloseHandle(threads[i]);
}
depressDestroyTempFolder(temp_path);
free(threads);
free(thread_args);
CloseHandle(global_error_event);
if(is_error) {
wprintf(L"Can't create djvu file\n");
if(!_waccess(*(argsp + 1), 06))
_wremove(*(argsp + 1));
} else
wprintf(L"Converted in %f s\n", (float)(clock()-time_start)/CLOCKS_PER_SEC);
depressDestroyTasks(tasks, tasks_num);
return 0;
}
| 26.304833 | 114 | 0.714245 |
7f5b86240b6f7e64457526f92d4d94b754bb2257 | 4,567 | h | C | vendors/microchip/harmony/v2.05/framework/system/dma/src/sys_dma_local_pic32c.h | nateglims/amazon-freertos | 5cc32eb29d935f124101a3584c6d29aa1f5d687d | [
"MIT"
] | 10 | 2019-09-10T11:20:19.000Z | 2021-08-10T02:14:57.000Z | vendors/microchip/harmony/v2.05/framework/system/dma/src/sys_dma_local_pic32c.h | nateglims/amazon-freertos | 5cc32eb29d935f124101a3584c6d29aa1f5d687d | [
"MIT"
] | 19 | 2018-12-07T03:41:15.000Z | 2020-02-05T14:42:04.000Z | vendors/microchip/harmony/v2.05/framework/system/dma/src/sys_dma_local_pic32c.h | nateglims/amazon-freertos | 5cc32eb29d935f124101a3584c6d29aa1f5d687d | [
"MIT"
] | 13 | 2019-12-31T21:22:09.000Z | 2022-03-07T15:55:27.000Z | /*******************************************************************************
DMA System Service Local Data Structures
Company:
Microchip Technology Inc.
File Name:
sys_dma_local_pic32c.h
Summary:
DMA System Service Local Data Structures
Description:
System Service Local Data Structures
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2012 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#ifndef _SYS_DMA_LOCAL_PIC32C_H
#define _SYS_DMA_LOCAL_PIC32C_H
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include "system/int/sys_int.h"
#include "system/dma/sys_dma.h"
// *****************************************************************************
// *****************************************************************************
// Section: Data Type Definitions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Minimum and maximum of two values */
#define MIN_SIZE(X, Y) (((X) <= (Y)) ? (X) : (Y))
#define MAX_SIZE(X, Y) (((X) >= (Y)) ? (X) : (Y))
/* PERID will be in the lower 2 bytes of DMA_TRIGGER_SOURCE enum value */
#define SYS_DMA_PERID_MASK 0x00FF
/* Micro-block bit-width */
#define SYS_DMA_UBLEN_BIT_WIDTH 24
// *****************************************************************************
typedef struct
{
/* DMA channel associated with this channel object */
DMA_CHANNEL channelID;
/* DMA channel trigger source */
DMA_TRIGGER_SOURCE channelTrigger;
/* Indicates whether the channel object is in use or not */
bool inUse;
/* Inidcates the error information for
the last DMA operation on this channel */
SYS_DMA_ERROR errorInfo;
/* Call back function for this DMA channel */
SYS_DMA_CHANNEL_TRANSFER_EVENT_HANDLER pEventCallBack;
/* Client data(Event Context) that will be returned at callback */
uintptr_t hClientArg;
} SYS_DMA_CHANNEL_OBJECT;
// *****************************************************************************
// *****************************************************************************
// Section: Local functions.
// *****************************************************************************
// *****************************************************************************
void _SYS_DMA_PeripheralSyncChannelSetup( SYS_DMA_CHANNEL_OBJECT *chanObj );
void _SYS_DMA_PeripheralSyncTransferSetup( SYS_DMA_CHANNEL_OBJECT *chanObj, size_t srcSize, size_t destSize );
void _SYS_DMA_ChannelTasks( DMA_CHANNEL channelID );
void _SYS_DMA_ChannelEnable( DMA_CHANNEL channelID );
#endif
/*******************************************************************************
End of File
*/
| 41.144144 | 110 | 0.509963 |
36bd2c73b5a626e1398e359e9651d31f5fc29ebf | 245 | c | C | main.c | clean-code-craft-tcq-1/modular-c-varshaar24 | c05277a0ec9c0993ce9877ae0c3c4cf00d968a59 | [
"MIT"
] | null | null | null | main.c | clean-code-craft-tcq-1/modular-c-varshaar24 | c05277a0ec9c0993ce9877ae0c3c4cf00d968a59 | [
"MIT"
] | null | null | null | main.c | clean-code-craft-tcq-1/modular-c-varshaar24 | c05277a0ec9c0993ce9877ae0c3c4cf00d968a59 | [
"MIT"
] | null | null | null | #include "Types.h"
int main() {
testNumberToPair(4, WHITE, BROWN);
testNumberToPair(5, WHITE, SLATE);
testPairToNumber(BLACK, ORANGE, 12);
testPairToNumber(VIOLET, SLATE, 25);
DisplayColourPairForm();
return 0;
}
| 17.5 | 40 | 0.653061 |
82d17ea21baae402fac875b6a0b64e8a6c2b68fc | 6,201 | c | C | head/contrib/openbsm/tools/audump.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | head/contrib/openbsm/tools/audump.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | head/contrib/openbsm/tools/audump.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | /*-
* Copyright (c) 2005-2009 Robert N. M. Watson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/trustedbsd/openbsm/tools/audump.c#9 $
*/
#include <bsm/libbsm.h>
#include <string.h>
#include <err.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
/*
* Simple tool to dump various /etc/security databases using the defined APIs.
*/
static void
usage(void)
{
fprintf(stderr, "usage: audump [class|class_r|control|event|event_r|"
"user|user_r]\n");
exit(-1);
}
static void
audump_class(void)
{
au_class_ent_t *cp;
while ((cp = getauclassent()) != NULL)
printf("0x%08x:%s:%s\n", cp->ac_class, cp->ac_name,
cp->ac_desc);
}
static void
audump_class_r(void)
{
char class_ent_name[AU_CLASS_NAME_MAX];
char class_ent_desc[AU_CLASS_DESC_MAX];
au_class_ent_t c, *cp;
bzero(&c, sizeof(c));
bzero(class_ent_name, sizeof(class_ent_name));
bzero(class_ent_desc, sizeof(class_ent_desc));
c.ac_name = class_ent_name;
c.ac_desc = class_ent_desc;
while ((cp = getauclassent_r(&c)) != NULL)
printf("0x%08x:%s:%s\n", cp->ac_class, cp->ac_name,
cp->ac_desc);
}
static void
audump_control(void)
{
char string[PATH_MAX], string2[PATH_MAX];
int ret, val;
long policy;
time_t age;
size_t size;
ret = getacflg(string, PATH_MAX);
if (ret == -2)
err(-1, "getacflg");
if (ret != 0)
errx(-1, "getacflg: %d", ret);
printf("flags:%s\n", string);
ret = getacmin(&val);
if (ret == -2)
err(-1, "getacmin");
if (ret != 0)
errx(-1, "getacmin: %d", ret);
printf("min:%d\n", val);
ret = getacna(string, PATH_MAX);
if (ret == -2)
err(-1, "getacna");
if (ret != 0)
errx(-1, "getacna: %d", ret);
printf("naflags:%s\n", string);
setac();
do {
ret = getacdir(string, PATH_MAX);
if (ret == -1)
break;
if (ret == -2)
err(-1, "getacdir");
if (ret != 0)
errx(-1, "getacdir: %d", ret);
printf("dir:%s\n", string);
} while (ret == 0);
ret = getacpol(string, PATH_MAX);
if (ret != 0)
err(-1, "getacpol");
if (au_strtopol(string, &policy) < 0)
err(-1, "au_strtopol");
if (au_poltostr(policy, PATH_MAX, string2) < 0)
err(-1, "au_poltostr");
printf("policy:%s\n", string2);
ret = getacfilesz(&size);
if (ret == -2)
err(-1, "getacfilesz");
if (ret != 0)
err(-1, "getacfilesz: %d", ret);
printf("filesz:%ldB\n", size);
ret = getachost(string, PATH_MAX);
if (ret == -2)
err(-1, "getachost");
if (ret == -3)
err(-1, "getachost: %d", ret);
if (ret == 0 && ret != 1)
printf("host:%s\n", string);
ret = getacexpire(&val, &age, &size);
if (ret == -2)
err(-1, "getacexpire");
if (ret == -1)
err(-1, "getacexpire: %d", ret);
if (ret == 0 && ret != 1)
printf("expire-after:%ldB %s %lds\n", size,
val ? "AND" : "OR", age);
}
static void
printf_classmask(au_class_t classmask)
{
au_class_ent_t *c;
u_int32_t i;
int first;
first = 1;
for (i = 0; i < 32; i++) {
if (classmask & (1 << i)) {
if (first)
first = 0;
else
printf(",");
c = getauclassnum(1 << i);
if (c != NULL)
printf("%s", c->ac_name);
else
printf("0x%x", 1 << i);
}
}
}
static void
audump_event(void)
{
au_event_ent_t *ep;
while ((ep = getauevent()) != NULL) {
printf("%d:%s:%s:", ep->ae_number, ep->ae_name, ep->ae_desc);
printf_classmask(ep->ae_class);
printf("\n");
}
}
static void
audump_event_r(void)
{
char event_ent_name[AU_EVENT_NAME_MAX];
char event_ent_desc[AU_EVENT_DESC_MAX];
au_event_ent_t e, *ep;
bzero(&e, sizeof(e));
bzero(event_ent_name, sizeof(event_ent_name));
bzero(event_ent_desc, sizeof(event_ent_desc));
e.ae_name = event_ent_name;
e.ae_desc = event_ent_desc;
while ((ep = getauevent_r(&e)) != NULL) {
printf("%d:%s:%s:", ep->ae_number, ep->ae_name, ep->ae_desc);
printf_classmask(ep->ae_class);
printf("\n");
}
}
static void
audump_user(void)
{
au_user_ent_t *up;
while ((up = getauuserent()) != NULL) {
printf("%s:", up->au_name);
// printf_classmask(up->au_always);
printf(":");
// printf_classmask(up->au_never);
printf("\n");
}
}
static void
audump_user_r(void)
{
char user_ent_name[AU_USER_NAME_MAX];
au_user_ent_t u, *up;
bzero(&u, sizeof(u));
bzero(user_ent_name, sizeof(user_ent_name));
u.au_name = user_ent_name;
while ((up = getauuserent_r(&u)) != NULL) {
printf("%s:", up->au_name);
// printf_classmask(up->au_always);
printf(":");
// printf_classmask(up->au_never);
printf("\n");
}
}
int
main(int argc, char *argv[])
{
if (argc != 2)
usage();
if (strcmp(argv[1], "class") == 0)
audump_class();
else if (strcmp(argv[1], "class_r") == 0)
audump_class_r();
else if (strcmp(argv[1], "control") == 0)
audump_control();
else if (strcmp(argv[1], "event") == 0)
audump_event();
else if (strcmp(argv[1], "event_r") == 0)
audump_event_r();
else if (strcmp(argv[1], "user") == 0)
audump_user();
else if (strcmp(argv[1], "user_r") == 0)
audump_user_r();
else
usage();
return (0);
}
| 22.714286 | 78 | 0.647476 |
d6362c904453f4ba11884d5c95a759c79e5b0340 | 3,494 | h | C | dev/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 1,738 | 2017-09-21T10:59:12.000Z | 2022-03-31T21:05:46.000Z | dev/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 427 | 2017-09-29T22:54:36.000Z | 2022-02-15T19:26:50.000Z | dev/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 671 | 2017-09-21T08:04:01.000Z | 2022-03-29T14:30:07.000Z | /*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <ScriptCanvas/CodeGen/CodeGen.h>
#include "OperatorArithmetic.h"
#include <Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.generated.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Operators
{
#define DIVIDABLE_TYPES { Data::Type::Number(), Data::Type::Vector2(), Data::Type::Vector3(), Data::Type::Vector4() }
class OperatorDivideByNumber
: public Node
{
public:
ScriptCanvas_Node(OperatorDivideByNumber,
ScriptCanvas_Node::Name("Divide by Number (/)")
ScriptCanvas_Node::Uuid("{8305B5C9-1B9F-4D5B-B3E7-66925F491E9D}")
ScriptCanvas_Node::Description("Divides certain types by a given number")
ScriptCanvas_Node::Version(1, OperatorDivideByNumberVersionConverter)
ScriptCanvas_Node::Category("Math")
);
enum Version
{
InitialVersion = 0,
RemoveOperatorBase,
Current
};
static bool OperatorDivideByNumberVersionConverter(AZ::SerializeContext& serializeContext, AZ::SerializeContext::DataElementNode& rootElement);
OperatorDivideByNumber() = default;
// Nodes
void OnInit() override;
void OnInputSignal(const SlotId& slotId) override;
////
ScriptCanvas_In(ScriptCanvas_In::Name("In", ""));
ScriptCanvas_Out(ScriptCanvas_Out::Name("Out", ""));
protected:
AZ::Crc32 GetDynamicGroupId() const { return AZ_CRC("DivideGroup", 0x66473fe4); }
ScriptCanvas_DynamicDataSlot(ScriptCanvas::DynamicDataType::Value,
ScriptCanvas::ConnectionType::Input,
ScriptCanvas_DynamicDataSlot::Name("Source", "The value to be divided by a number")
ScriptCanvas_DynamicDataSlot::DynamicGroup("DivideGroup")
ScriptCanvas_DynamicDataSlot::RestrictedTypeContractTag(DIVIDABLE_TYPES)
);
ScriptCanvas_DynamicDataSlot(ScriptCanvas::DynamicDataType::Value,
ScriptCanvas::ConnectionType::Output,
ScriptCanvas_DynamicDataSlot::Name("Result", "The result of the operation")
ScriptCanvas_DynamicDataSlot::DynamicGroup("DivideGroup")
ScriptCanvas_DynamicDataSlot::RestrictedTypeContractTag(DIVIDABLE_TYPES)
);
ScriptCanvas_PropertyWithDefaults(ScriptCanvas::Data::NumberType, 1.f,
ScriptCanvas_Property::Name("Divisor", "The number to divide by.")
ScriptCanvas_Property::Input);
SlotId m_operandId;
};
}
#undef DIVIDABLE_TYPES
}
} | 41.105882 | 159 | 0.613623 |
3248b687633abda6138145b6087e017923e1a220 | 1,289 | h | C | model/ezsignbulksend_create_object_v1_request.h | ezmaxinc/eZmax-SDK-c | 725eab79d6311127a2d5bd731b978bce94142d69 | [
"curl",
"MIT"
] | null | null | null | model/ezsignbulksend_create_object_v1_request.h | ezmaxinc/eZmax-SDK-c | 725eab79d6311127a2d5bd731b978bce94142d69 | [
"curl",
"MIT"
] | null | null | null | model/ezsignbulksend_create_object_v1_request.h | ezmaxinc/eZmax-SDK-c | 725eab79d6311127a2d5bd731b978bce94142d69 | [
"curl",
"MIT"
] | null | null | null | /*
* ezsignbulksend_create_object_v1_request.h
*
* Request for POST /1/object/ezsignbulksend
*/
#ifndef _ezsignbulksend_create_object_v1_request_H_
#define _ezsignbulksend_create_object_v1_request_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
typedef struct ezsignbulksend_create_object_v1_request_t ezsignbulksend_create_object_v1_request_t;
#include "ezsignbulksend_request_compound.h"
typedef struct ezsignbulksend_create_object_v1_request_t {
list_t *a_obj_ezsignbulksend; //nonprimitive container
} ezsignbulksend_create_object_v1_request_t;
ezsignbulksend_create_object_v1_request_t *ezsignbulksend_create_object_v1_request_create(
list_t *a_obj_ezsignbulksend
);
void ezsignbulksend_create_object_v1_request_free(ezsignbulksend_create_object_v1_request_t *ezsignbulksend_create_object_v1_request);
ezsignbulksend_create_object_v1_request_t *ezsignbulksend_create_object_v1_request_parseFromJSON(cJSON *ezsignbulksend_create_object_v1_requestJSON);
cJSON *ezsignbulksend_create_object_v1_request_convertToJSON(ezsignbulksend_create_object_v1_request_t *ezsignbulksend_create_object_v1_request);
#endif /* _ezsignbulksend_create_object_v1_request_H_ */
| 33.051282 | 149 | 0.868891 |
aae0f47bf2836263e2ea29cff44d03dec17927f7 | 7,402 | h | C | aws-cpp-sdk-kendra/include/aws/kendra/model/QueryResult.h | grujicbr/aws-sdk-cpp | bdd43c178042f09c6739645e3f6cd17822a7c35c | [
"Apache-2.0"
] | 1 | 2020-03-11T05:36:20.000Z | 2020-03-11T05:36:20.000Z | aws-cpp-sdk-kendra/include/aws/kendra/model/QueryResult.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-kendra/include/aws/kendra/model/QueryResult.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/kendra/Kendra_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/kendra/model/QueryResultItem.h>
#include <aws/kendra/model/FacetResult.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace kendra
{
namespace Model
{
class AWS_KENDRA_API QueryResult
{
public:
QueryResult();
QueryResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
QueryResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline const Aws::String& GetQueryId() const{ return m_queryId; }
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline void SetQueryId(const Aws::String& value) { m_queryId = value; }
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline void SetQueryId(Aws::String&& value) { m_queryId = std::move(value); }
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline void SetQueryId(const char* value) { m_queryId.assign(value); }
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline QueryResult& WithQueryId(const Aws::String& value) { SetQueryId(value); return *this;}
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline QueryResult& WithQueryId(Aws::String&& value) { SetQueryId(std::move(value)); return *this;}
/**
* <p>The unique identifier for the search. You use <code>QueryId</code> to
* identify the search when using the feedback API.</p>
*/
inline QueryResult& WithQueryId(const char* value) { SetQueryId(value); return *this;}
/**
* <p>The results of the search.</p>
*/
inline const Aws::Vector<QueryResultItem>& GetResultItems() const{ return m_resultItems; }
/**
* <p>The results of the search.</p>
*/
inline void SetResultItems(const Aws::Vector<QueryResultItem>& value) { m_resultItems = value; }
/**
* <p>The results of the search.</p>
*/
inline void SetResultItems(Aws::Vector<QueryResultItem>&& value) { m_resultItems = std::move(value); }
/**
* <p>The results of the search.</p>
*/
inline QueryResult& WithResultItems(const Aws::Vector<QueryResultItem>& value) { SetResultItems(value); return *this;}
/**
* <p>The results of the search.</p>
*/
inline QueryResult& WithResultItems(Aws::Vector<QueryResultItem>&& value) { SetResultItems(std::move(value)); return *this;}
/**
* <p>The results of the search.</p>
*/
inline QueryResult& AddResultItems(const QueryResultItem& value) { m_resultItems.push_back(value); return *this; }
/**
* <p>The results of the search.</p>
*/
inline QueryResult& AddResultItems(QueryResultItem&& value) { m_resultItems.push_back(std::move(value)); return *this; }
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline const Aws::Vector<FacetResult>& GetFacetResults() const{ return m_facetResults; }
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline void SetFacetResults(const Aws::Vector<FacetResult>& value) { m_facetResults = value; }
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline void SetFacetResults(Aws::Vector<FacetResult>&& value) { m_facetResults = std::move(value); }
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline QueryResult& WithFacetResults(const Aws::Vector<FacetResult>& value) { SetFacetResults(value); return *this;}
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline QueryResult& WithFacetResults(Aws::Vector<FacetResult>&& value) { SetFacetResults(std::move(value)); return *this;}
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline QueryResult& AddFacetResults(const FacetResult& value) { m_facetResults.push_back(value); return *this; }
/**
* <p>Contains the facet results. A <code>FacetResult</code> contains the counts
* for each attribute key that was specified in the <code>Facets</code> input
* parameter.</p>
*/
inline QueryResult& AddFacetResults(FacetResult&& value) { m_facetResults.push_back(std::move(value)); return *this; }
/**
* <p>The number of items returned by the search. Use this to determine when you
* have requested the last set of results.</p>
*/
inline int GetTotalNumberOfResults() const{ return m_totalNumberOfResults; }
/**
* <p>The number of items returned by the search. Use this to determine when you
* have requested the last set of results.</p>
*/
inline void SetTotalNumberOfResults(int value) { m_totalNumberOfResults = value; }
/**
* <p>The number of items returned by the search. Use this to determine when you
* have requested the last set of results.</p>
*/
inline QueryResult& WithTotalNumberOfResults(int value) { SetTotalNumberOfResults(value); return *this;}
private:
Aws::String m_queryId;
Aws::Vector<QueryResultItem> m_resultItems;
Aws::Vector<FacetResult> m_facetResults;
int m_totalNumberOfResults;
};
} // namespace Model
} // namespace kendra
} // namespace Aws
| 35.416268 | 128 | 0.677655 |
d2fe7d3d80c6f7d3ba1722f2068cbeb3f33bf063 | 6,138 | h | C | export/release/windows/obj/include/editors/DialogueEditorState.h | TheSlithyGamer4evr/Friend-Trouble-Source | a540ec9cf4cf3033e0c340e5e4f50d647b94d4a3 | [
"Apache-2.0"
] | null | null | null | export/release/windows/obj/include/editors/DialogueEditorState.h | TheSlithyGamer4evr/Friend-Trouble-Source | a540ec9cf4cf3033e0c340e5e4f50d647b94d4a3 | [
"Apache-2.0"
] | null | null | null | export/release/windows/obj/include/editors/DialogueEditorState.h | TheSlithyGamer4evr/Friend-Trouble-Source | a540ec9cf4cf3033e0c340e5e4f50d647b94d4a3 | [
"Apache-2.0"
] | null | null | null | #ifndef INCLUDED_editors_DialogueEditorState
#define INCLUDED_editors_DialogueEditorState
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#ifndef INCLUDED_MusicBeatState
#include <MusicBeatState.h>
#endif
HX_DECLARE_CLASS0(Alphabet)
HX_DECLARE_CLASS0(DialogueCharacter)
HX_DECLARE_CLASS0(MusicBeatState)
HX_DECLARE_CLASS1(editors,DialogueEditorState)
HX_DECLARE_CLASS1(flixel,FlxBasic)
HX_DECLARE_CLASS1(flixel,FlxObject)
HX_DECLARE_CLASS1(flixel,FlxSprite)
HX_DECLARE_CLASS1(flixel,FlxState)
HX_DECLARE_CLASS1(flixel,IFlxBasic)
HX_DECLARE_CLASS1(flixel,IFlxSprite)
HX_DECLARE_CLASS3(flixel,addons,transition,FlxTransitionableState)
HX_DECLARE_CLASS3(flixel,addons,transition,TransitionData)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxInputText)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUICheckBox)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUIGroup)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUIInputText)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUINumericStepper)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUIState)
HX_DECLARE_CLASS3(flixel,addons,ui,FlxUITabMenu)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,ICursorPointable)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IEventGetter)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IFlxUIClickable)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IFlxUIState)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IFlxUIWidget)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IHasParams)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,ILabeled)
HX_DECLARE_CLASS4(flixel,addons,ui,interfaces,IResizable)
HX_DECLARE_CLASS2(flixel,group,FlxTypedGroup)
HX_DECLARE_CLASS2(flixel,group,FlxTypedSpriteGroup)
HX_DECLARE_CLASS2(flixel,text,FlxText)
HX_DECLARE_CLASS2(flixel,util,IFlxDestroyable)
HX_DECLARE_CLASS2(openfl,events,ErrorEvent)
HX_DECLARE_CLASS2(openfl,events,Event)
HX_DECLARE_CLASS2(openfl,events,EventDispatcher)
HX_DECLARE_CLASS2(openfl,events,IEventDispatcher)
HX_DECLARE_CLASS2(openfl,events,IOErrorEvent)
HX_DECLARE_CLASS2(openfl,events,TextEvent)
HX_DECLARE_CLASS2(openfl,net,FileReference)
namespace editors{
class HXCPP_CLASS_ATTRIBUTES DialogueEditorState_obj : public ::MusicBeatState_obj
{
public:
typedef ::MusicBeatState_obj super;
typedef DialogueEditorState_obj OBJ_;
DialogueEditorState_obj();
public:
enum { _hx_ClassId = 0x1ef2e476 };
void __construct( ::flixel::addons::transition::TransitionData TransIn, ::flixel::addons::transition::TransitionData TransOut);
inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="editors.DialogueEditorState")
{ return ::hx::Object::operator new(inSize,inContainer,inName); }
inline void *operator new(size_t inSize, int extra)
{ return ::hx::Object::operator new(inSize+extra,true,"editors.DialogueEditorState"); }
static ::hx::ObjectPtr< DialogueEditorState_obj > __new( ::flixel::addons::transition::TransitionData TransIn, ::flixel::addons::transition::TransitionData TransOut);
static ::hx::ObjectPtr< DialogueEditorState_obj > __alloc(::hx::Ctx *_hx_ctx, ::flixel::addons::transition::TransitionData TransIn, ::flixel::addons::transition::TransitionData TransOut);
static void * _hx_vtable;
static Dynamic __CreateEmpty();
static Dynamic __Create(::hx::DynamicArray inArgs);
//~DialogueEditorState_obj();
HX_DO_RTTI_ALL;
::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
void __GetFields(Array< ::String> &outFields);
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
bool _hx_isInstanceOf(int inClassId);
::String __ToString() const { return HX_("DialogueEditorState",cc,ba,20,44); }
static void __boot();
static ::String DEFAULT_TEXT;
static Float DEFAULT_SPEED;
static ::String DEFAULT_BUBBLETYPE;
::DialogueCharacter character;
::flixel::FlxSprite box;
::Alphabet daText;
::flixel::text::FlxText selectedText;
::flixel::text::FlxText animText;
::Dynamic defaultLine;
::Dynamic dialogueFile;
void create();
::flixel::addons::ui::FlxUITabMenu UI_box;
void addEditorBox();
::Dynamic addEditorBox_dyn();
::flixel::addons::ui::FlxUIInputText characterInputText;
::flixel::addons::ui::FlxUIInputText lineInputText;
::flixel::addons::ui::FlxUICheckBox angryCheckbox;
::flixel::addons::ui::FlxUINumericStepper speedStepper;
void addDialogueLineUI();
::Dynamic addDialogueLineUI_dyn();
::Dynamic copyDefaultLine();
::Dynamic copyDefaultLine_dyn();
void updateTextBox();
::Dynamic updateTextBox_dyn();
void reloadCharacter();
::Dynamic reloadCharacter_dyn();
void reloadText(::hx::Null< Float > speed);
::Dynamic reloadText_dyn();
void getEvent(::String id, ::Dynamic sender, ::Dynamic data,::cpp::VirtualArray params);
int curSelected;
int curAnim;
::Array< ::Dynamic> blockPressWhileTypingOn;
bool transitioning;
void update(Float elapsed);
void changeText(::hx::Null< int > add);
::Dynamic changeText_dyn();
void characterAnimSpeed();
::Dynamic characterAnimSpeed_dyn();
::String ClipboardAdd(::String prefix);
::Dynamic ClipboardAdd_dyn();
::openfl::net::FileReference _file;
void loadDialogue();
::Dynamic loadDialogue_dyn();
void onLoadComplete( ::openfl::events::Event _);
::Dynamic onLoadComplete_dyn();
void onLoadCancel( ::openfl::events::Event _);
::Dynamic onLoadCancel_dyn();
void onLoadError( ::openfl::events::IOErrorEvent _);
::Dynamic onLoadError_dyn();
void saveDialogue();
::Dynamic saveDialogue_dyn();
void onSaveComplete( ::openfl::events::Event _);
::Dynamic onSaveComplete_dyn();
void onSaveCancel( ::openfl::events::Event _);
::Dynamic onSaveCancel_dyn();
void onSaveError( ::openfl::events::IOErrorEvent _);
::Dynamic onSaveError_dyn();
};
} // end namespace editors
#endif /* INCLUDED_editors_DialogueEditorState */
| 36.105882 | 189 | 0.782991 |
cf433506b16cff5c2efc51b4fc432604404f84cb | 1,704 | h | C | ControlCenterServices.framework/CCSModuleSettingsProvider.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 4 | 2021-10-06T12:15:26.000Z | 2022-02-21T02:26:00.000Z | ControlCenterServices.framework/CCSModuleSettingsProvider.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | null | null | null | ControlCenterServices.framework/CCSModuleSettingsProvider.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/ControlCenterServices.framework/ControlCenterServices
*/
@interface CCSModuleSettingsProvider : NSObject {
NSObject<OS_dispatch_queue> * _callOutQueue;
NSObject<OS_dispatch_source> * _configurationChangedSource;
NSHashTable * _observers;
NSArray * _orderedFixedModuleIdentifiers;
NSArray * _orderedUserEnabledModuleIdentifiers;
NSObject<OS_dispatch_queue> * _queue;
NSArray * _userDisabledModuleIdentifiers;
}
@property (nonatomic, readonly, copy) NSArray *orderedFixedModuleIdentifiers;
@property (nonatomic, readonly, copy) NSArray *orderedUserEnabledModuleIdentifiers;
@property (nonatomic, readonly, copy) NSArray *userDisabledModuleIdentifiers;
+ (id)_configurationDirectoryURL;
+ (id)_configurationFileURL;
+ (id)_defaultEnabledModuleOrder;
+ (id)_defaultFixedModuleIdentifiers;
+ (id)_defaultUserEnabledModuleIdentifiers;
+ (id)_readSettings;
+ (void)_writeOrderedIdentifiers:(id)arg1 userDisabledIdentifiers:(id)arg2;
+ (void)initialize;
+ (id)sharedProvider;
- (void).cxx_destruct;
- (void)_queue_handleConfigurationFileUpdate;
- (void)_queue_loadSettings;
- (void)_queue_runBlockOnListeners:(id /* block */)arg1;
- (void)_queue_saveSettings;
- (void)_queue_sendConfigurationFileUpdateMessageToObservers;
- (void)_queue_startMonitoringConfigurationUpdates;
- (void)_queue_stopMonitoringConfigurationUpdates;
- (void)addObserver:(id)arg1;
- (void)dealloc;
- (id)init;
- (id)orderedFixedModuleIdentifiers;
- (id)orderedUserEnabledModuleIdentifiers;
- (void)removeObserver:(id)arg1;
- (void)setAndSaveOrderedUserEnabledModuleIdentifiers:(id)arg1;
- (id)userDisabledModuleIdentifiers;
@end
| 36.255319 | 97 | 0.809859 |
cf552282dbd385d9a15a24b229200a6346cf87a7 | 393 | c | C | patch/bootstrap.c | C3RV1/LaytonEditor | 51e1a9a372a8acdaa4183ae008235a721dc56cdc | [
"Unlicense"
] | 6 | 2019-12-24T00:18:54.000Z | 2022-02-28T17:09:22.000Z | patch/bootstrap.c | C3RV1/LaytonEditor | 51e1a9a372a8acdaa4183ae008235a721dc56cdc | [
"Unlicense"
] | 1 | 2021-08-18T11:10:35.000Z | 2021-08-18T17:32:21.000Z | patch/bootstrap.c | C3RV1/LaytonEditor | 51e1a9a372a8acdaa4183ae008235a721dc56cdc | [
"Unlicense"
] | 2 | 2021-01-17T10:42:48.000Z | 2021-08-18T11:10:54.000Z | #include <stdint.h>
void* patch_address = (void*) CODEADDR;
uint32_t patch_lenght = CODELEN + 4;
extern void * _end;
void MIi_CpuCopy32(void *src, void *dest, uint32_t len);
void bootstrap()
{
// Copy the patch to the correct address.
MIi_CpuCopy32(&_end, patch_address, patch_lenght);
asm(".long 0xe3a0c301 "); // mov %r12, #0x04000000: The replaced instruction at 0x02000800
} | 28.071429 | 94 | 0.715013 |
5ce21dc2811f2debc7f6668734c48444bffc0964 | 12,821 | c | C | torch-test/mpich-3.4.3/src/mpi/request/testall.c | alchemy315/NoPFS | f3901e963e2301e8a6f1c7aac0511d0cf9a1889d | [
"BSD-3-Clause"
] | null | null | null | torch-test/mpich-3.4.3/src/mpi/request/testall.c | alchemy315/NoPFS | f3901e963e2301e8a6f1c7aac0511d0cf9a1889d | [
"BSD-3-Clause"
] | null | null | null | torch-test/mpich-3.4.3/src/mpi/request/testall.c | alchemy315/NoPFS | f3901e963e2301e8a6f1c7aac0511d0cf9a1889d | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/
#include "mpiimpl.h"
#if !defined(MPIR_REQUEST_PTR_ARRAY_SIZE)
#define MPIR_REQUEST_PTR_ARRAY_SIZE 16
#endif
/* -- Begin Profiling Symbol Block for routine MPI_Testall */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPI_Testall = PMPI_Testall
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPI_Testall MPI_Testall
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPI_Testall as PMPI_Testall
#elif defined(HAVE_WEAK_ATTRIBUTE)
int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[]) __attribute__ ((weak, alias("PMPI_Testall")));
#endif
/* -- End Profiling Symbol Block */
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_Testall
#define MPI_Testall PMPI_Testall
int MPIR_Testall_state(int count, MPIR_Request * request_ptrs[], int *flag,
MPI_Status array_of_statuses[], int requests_property,
MPID_Progress_state * state)
{
int i;
int mpi_errno = MPI_SUCCESS;
int n_completed = 0;
mpi_errno = MPID_Progress_test(state);
MPIR_ERR_CHECK(mpi_errno);
if (requests_property & MPIR_REQUESTS_PROPERTY__NO_GREQUESTS) {
for (i = 0; i < count; i++) {
if ((i + 1) % MPIR_CVAR_REQUEST_POLL_FREQ == 0) {
mpi_errno = MPID_Progress_test(state);
MPIR_ERR_CHECK(mpi_errno);
}
if (request_ptrs[i] == NULL || MPIR_Request_is_complete(request_ptrs[i])) {
n_completed++;
} else {
break;
}
}
} else {
for (i = 0; i < count; i++) {
if ((i + 1) % MPIR_CVAR_REQUEST_POLL_FREQ == 0) {
mpi_errno = MPID_Progress_test(state);
MPIR_ERR_CHECK(mpi_errno);
}
if (request_ptrs[i] != NULL) {
if (MPIR_Request_has_poll_fn(request_ptrs[i])) {
mpi_errno = MPIR_Grequest_poll(request_ptrs[i], &array_of_statuses[i]);
MPIR_ERR_CHECK(mpi_errno);
}
if (MPIR_Request_is_complete(request_ptrs[i])) {
n_completed++;
}
} else {
n_completed++;
}
}
}
*flag = (n_completed == count) ? TRUE : FALSE;
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
int MPIR_Testall_impl(int count, MPIR_Request * request_ptrs[], int *flag,
MPI_Status array_of_statuses[], int requests_property)
{
return MPIR_Testall_state(count, request_ptrs, flag, array_of_statuses,
requests_property, NULL);
}
int MPIR_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[])
{
MPIR_Request *request_ptr_array[MPIR_REQUEST_PTR_ARRAY_SIZE];
MPIR_Request **request_ptrs = request_ptr_array;
int i;
int n_completed;
int active_flag;
int rc = MPI_SUCCESS;
int proc_failure = FALSE;
int mpi_errno = MPI_SUCCESS;
int requests_property = MPIR_REQUESTS_PROPERTY__OPT_ALL;
int ignoring_status = (array_of_statuses == MPI_STATUSES_IGNORE);
MPIR_CHKLMEM_DECL(1);
int ii, icount, impi_errno;
n_completed = 0;
/* Convert MPI request handles to a request object pointers */
if (count > MPIR_REQUEST_PTR_ARRAY_SIZE) {
MPIR_CHKLMEM_MALLOC_ORJUMP(request_ptrs, MPIR_Request **,
count * sizeof(MPIR_Request *), mpi_errno, "request pointers",
MPL_MEM_OBJECT);
}
for (ii = 0; ii < count; ii += MPIR_CVAR_REQUEST_BATCH_SIZE) {
icount = count - ii > MPIR_CVAR_REQUEST_BATCH_SIZE ?
MPIR_CVAR_REQUEST_BATCH_SIZE : count - ii;
requests_property = MPIR_REQUESTS_PROPERTY__OPT_ALL;
for (i = ii; i < ii + icount; i++) {
if (array_of_requests[i] != MPI_REQUEST_NULL) {
MPIR_Request_get_ptr(array_of_requests[i], request_ptrs[i]);
/* Validate object pointers if error checking is enabled */
#ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_Request_valid_ptr(request_ptrs[i], mpi_errno);
if (mpi_errno)
goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
#endif
if (request_ptrs[i]->kind != MPIR_REQUEST_KIND__RECV &&
request_ptrs[i]->kind != MPIR_REQUEST_KIND__SEND) {
requests_property &= ~MPIR_REQUESTS_PROPERTY__SEND_RECV_ONLY;
if (request_ptrs[i]->kind == MPIR_REQUEST_KIND__GREQUEST) {
requests_property &= ~MPIR_REQUESTS_PROPERTY__NO_GREQUESTS;
}
}
} else {
request_ptrs[i] = NULL;
requests_property &= ~MPIR_REQUESTS_PROPERTY__NO_NULL;
}
}
impi_errno = MPID_Testall(icount, &request_ptrs[ii], flag,
ignoring_status ? MPI_STATUSES_IGNORE : &array_of_statuses[ii],
requests_property);
if (impi_errno != MPI_SUCCESS) {
mpi_errno = impi_errno;
goto fn_fail;
}
for (i = ii; i < ii + icount; i++) {
if (request_ptrs[i] == NULL || MPIR_Request_is_complete(request_ptrs[i]))
n_completed += 1;
#ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
if (request_ptrs[i] == NULL)
continue;
if (MPIR_Request_is_complete(request_ptrs[i])) {
rc = MPIR_Request_get_error(request_ptrs[i]);
if (rc != MPI_SUCCESS) {
if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(rc) ||
MPIX_ERR_PROC_FAILED_PENDING == MPIR_ERR_GET_CLASS(rc))
proc_failure = TRUE;
mpi_errno = MPI_ERR_IN_STATUS;
}
} else if (unlikely(MPIR_Request_is_anysrc_mismatched(request_ptrs[i]))) {
mpi_errno = MPI_ERR_IN_STATUS;
MPIR_ERR_SET(rc, MPIX_ERR_PROC_FAILED_PENDING, "**failure_pending");
if (!ignoring_status)
array_of_statuses[i].MPI_ERROR = rc;
proc_failure = TRUE;
}
}
MPID_END_ERROR_CHECKS;
}
#endif
}
}
*flag = (n_completed == count) ? TRUE : FALSE;
/* We only process completion of requests if all are finished, or
* there is an error. */
if (!(*flag || mpi_errno == MPI_ERR_IN_STATUS))
goto fn_exit;
if (ignoring_status && (requests_property & MPIR_REQUESTS_PROPERTY__SEND_RECV_ONLY)) {
for (i = 0; i < count; i++) {
if (request_ptrs[i] != NULL && MPIR_Request_is_complete(request_ptrs[i]))
MPIR_Request_completion_processing_fastpath(&array_of_requests[i], request_ptrs[i]);
}
goto fn_exit;
}
if (ignoring_status) {
for (i = 0; i < count; i++) {
if (request_ptrs[i] != NULL && MPIR_Request_is_complete(request_ptrs[i])) {
MPIR_Request_completion_processing(request_ptrs[i], MPI_STATUS_IGNORE);
if (!MPIR_Request_is_persistent(request_ptrs[i])) {
MPIR_Request_free(request_ptrs[i]);
array_of_requests[i] = MPI_REQUEST_NULL;
}
}
}
goto fn_exit;
}
for (i = 0; i < count; i++) {
if (request_ptrs[i] != NULL) {
if (MPIR_Request_is_complete(request_ptrs[i])) {
active_flag = MPIR_Request_is_active(request_ptrs[i]);
rc = MPIR_Request_completion_processing(request_ptrs[i], &array_of_statuses[i]);
if (!MPIR_Request_is_persistent(request_ptrs[i])) {
MPIR_Request_free(request_ptrs[i]);
array_of_requests[i] = MPI_REQUEST_NULL;
}
if (mpi_errno == MPI_ERR_IN_STATUS) {
if (active_flag) {
array_of_statuses[i].MPI_ERROR = rc;
} else {
array_of_statuses[i].MPI_ERROR = MPI_SUCCESS;
}
}
} else {
if (mpi_errno == MPI_ERR_IN_STATUS) {
if (!proc_failure)
array_of_statuses[i].MPI_ERROR = MPI_ERR_PENDING;
else
array_of_statuses[i].MPI_ERROR = MPIX_ERR_PROC_FAILED_PENDING;
}
}
} else {
MPIR_Status_set_empty(&array_of_statuses[i]);
if (mpi_errno == MPI_ERR_IN_STATUS) {
array_of_statuses[i].MPI_ERROR = MPI_SUCCESS;
}
}
}
fn_exit:
if (count > MPIR_REQUEST_PTR_ARRAY_SIZE) {
MPIR_CHKLMEM_FREEALL();
}
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif
/*@
MPI_Testall - Tests for the completion of all previously initiated
requests
Input Parameters:
+ count - lists length (integer)
- array_of_requests - array of requests (array of handles)
Output Parameters:
+ flag - True if all requests have completed; false otherwise (logical)
- array_of_statuses - array of status objects (array of Status). May be
'MPI_STATUSES_IGNORE'.
Notes:
'flag' is true only if all requests have completed. Otherwise, flag is
false and neither the 'array_of_requests' nor the 'array_of_statuses' is
modified.
If one or more of the requests completes with an error, 'MPI_ERR_IN_STATUS' is
returned. An error value will be present is elements of 'array_of_status'
associated with the requests. Likewise, the 'MPI_ERROR' field in the status
elements associated with requests that have successfully completed will be
'MPI_SUCCESS'. Finally, those requests that have not completed will have a
value of 'MPI_ERR_PENDING'.
While it is possible to list a request handle more than once in the
'array_of_requests', such an action is considered erroneous and may cause the
program to unexecpectedly terminate or produce incorrect results.
.N ThreadSafe
.N waitstatus
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_IN_STATUS
.N MPI_ERR_REQUEST
.N MPI_ERR_ARG
@*/
int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[])
{
int mpi_errno = MPI_SUCCESS;
MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_TESTALL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
MPIR_FUNC_TERSE_REQUEST_ENTER(MPID_STATE_MPI_TESTALL);
/* Check the arguments */
#ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
int i = 0;
MPIR_ERRTEST_COUNT(count, mpi_errno);
if (count != 0) {
MPIR_ERRTEST_ARGNULL(array_of_requests, "array_of_requests", mpi_errno);
/* NOTE: MPI_STATUSES_IGNORE != NULL */
MPIR_ERRTEST_ARGNULL(array_of_statuses, "array_of_statuses", mpi_errno);
}
MPIR_ERRTEST_ARGNULL(flag, "flag", mpi_errno);
for (i = 0; i < count; i++) {
MPIR_ERRTEST_ARRAYREQUEST_OR_NULL(array_of_requests[i], i, mpi_errno);
}
}
MPID_END_ERROR_CHECKS;
}
#endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_Testall(count, array_of_requests, flag, array_of_statuses);
if (mpi_errno != MPI_SUCCESS)
goto fn_fail;
/* ... end of body of routine ... */
fn_exit:
MPIR_FUNC_TERSE_REQUEST_EXIT(MPID_STATE_MPI_TESTALL);
MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
#ifdef HAVE_ERROR_CHECKING
{
mpi_errno =
MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, __func__, __LINE__, MPI_ERR_OTHER,
"**mpi_testall", "**mpi_testall %d %p %p %p", count,
array_of_requests, flag, array_of_statuses);
}
#endif
mpi_errno = MPIR_Err_return_comm(NULL, __func__, mpi_errno);
goto fn_exit;
/* --END ERROR HANDLING-- */
}
| 35.126027 | 100 | 0.591296 |
d0c04b79c13520ffa269e6ebae200bb08606d2d7 | 562 | c | C | tools-src/gnu/gcc/gcc/testsuite/gcc.dg/cpp/line5.c | enfoTek/tomato.linksys.e2000.nvram-mod | 2ce3a5217def49d6df7348522e2bfda702b56029 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/testsuite/gcc.dg/cpp/line5.c | unforgiven512/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/testsuite/gcc.dg/cpp/line5.c | unforgiven512/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | /* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-fpreprocessed" } */
/* Source: Neil Booth, 16 Sep 2001.
This file, with an indented line marker, is not possible without
user editing of preprocessed output, or the user using
-fpreprocessed on raw source. Nevertheless, we should not
segfault. This is a test that we don't back up two tokens in
cpplib.c - one to back up over the number, and one when we
recognise that it's not a valid directive in preprocessed input. */
# 1 "foo.c"
| 35.125 | 71 | 0.69395 |
30c1b491158f74ebf591e360a3d143efb2674cdd | 1,518 | h | C | EasyFramework3d/core/gl/model/VertexArrayBuilder.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | EasyFramework3d/core/gl/model/VertexArrayBuilder.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | EasyFramework3d/core/gl/model/VertexArrayBuilder.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | /**
* @file VertexArrayBuilder.h
* @author maccesch
* @date 26.09.2007
* @brief This file is part of the Vision Synthesis Easy Framework.\n
* This file has no copyright; you can change everything.
* Visit www.vision-synthesis.de or www.easy-framework.de for further informations.\n
* If there is a bug please send a mail to bug@vision-synthesis.de. No warranty is given!
*/
#ifndef VERTEXARRAYBUILDER_H_
#define VERTEXARRAYBUILDER_H_
// includes
#include <vs/Build.hpp>
#include <vs/core/gl/model/ModelVisitorInterface.h>
#include <list>
#include <vector>
using namespace std;
namespace vs
{
namespace core
{
namespace gl
{
namespace model
{
// TODO : isn't finished yet
/**
* Builds an OpenGL Vertex Array from a ModelData object.
* It is implemented as a ModelVisitor (@see ModelVisitorInterface).
*/
class VS_EXPORT VertexArrayBuilder : public ModelVisitorInterface
{
public:
VertexArrayBuilder();
virtual ~VertexArrayBuilder();
protected:
/**
* @see ModelVisitorInterFace::visit(ModelData &model)
*/
void visit(ModelData &model);
/**
* @see ModelVisitorInterFace::visit(ObjectData &object)
*/
void visit(ObjectData &object);
/**
* @see ModelVisitorInterFace::visit(FaceGroupData &faceGroup)
*/
void visit(FaceGroupData &faceGroup);
/**
* @see ModelVisitorInterFace::visit(VertexData &vertex)
*/
void visit(VertexData &vertex);
vector<float> currentVertexArray;
list<float> currentIndexArray;
};
} // model
} // gl
} // core
} // vs
#endif /*VERTEXARRAYBUILDER_H_*/
| 21.685714 | 89 | 0.730567 |
30d63492ee5ed6e955cb76c30eda8d98cf661e04 | 311 | h | C | src/common/resource/PatternType.h | smartdu/kafkaclient-cpp | 03d108808a50a13d7a26e63461a1ac27c5bc141c | [
"Apache-2.0"
] | 5 | 2019-04-29T11:09:55.000Z | 2019-11-28T02:53:59.000Z | src/common/resource/PatternType.h | smartdu/kafkaclient-cpp | 03d108808a50a13d7a26e63461a1ac27c5bc141c | [
"Apache-2.0"
] | 2 | 2019-05-10T09:37:49.000Z | 2019-05-14T02:40:16.000Z | src/common/resource/PatternType.h | smartdu/kafkaclient-cpp | 03d108808a50a13d7a26e63461a1ac27c5bc141c | [
"Apache-2.0"
] | 1 | 2019-05-10T10:07:50.000Z | 2019-05-10T10:07:50.000Z | #ifndef __KFK_PATTERNTYPE_H__
#define __KFK_PATTERNTYPE_H__
#pragma once
class PatternType
{
public:
static const char UNKNOWN = 0;
static const char ANY = 1;
static const char MATCH = 2;
static const char LITERAL = 3;
static const char PREFIXED = 4;
};
#endif // !__KFK_PATTERNTYPE_H__
| 18.294118 | 33 | 0.713826 |
aa80e5ffe0f60acbdfce752304c89cfb40714105 | 7,602 | c | C | test_conformance/commonfns/test_fminf.c | bhargavthriler/OpenCL-CTS | 6a64c5a0c74b9e4a83025628f2cdb746647cdfb1 | [
"Apache-2.0"
] | null | null | null | test_conformance/commonfns/test_fminf.c | bhargavthriler/OpenCL-CTS | 6a64c5a0c74b9e4a83025628f2cdb746647cdfb1 | [
"Apache-2.0"
] | null | null | null | test_conformance/commonfns/test_fminf.c | bhargavthriler/OpenCL-CTS | 6a64c5a0c74b9e4a83025628f2cdb746647cdfb1 | [
"Apache-2.0"
] | null | null | null | //
// Copyright (c) 2017 The Khronos Group Inc.
//
// 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.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#if !defined(_WIN32)
#include <stdbool.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include "procs.h"
static const char *fmin_kernel_code =
"__kernel void test_fmin(__global float *srcA, __global float *srcB, __global float *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" dst[tid] = fmin(srcA[tid], srcB[tid]);\n"
"}\n";
static const char *fmin2_kernel_code =
"__kernel void test_fmin2(__global float2 *srcA, __global float *srcB, __global float2 *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" dst[tid] = fmin(srcA[tid], srcB[tid]);\n"
"}\n";
static const char *fmin4_kernel_code =
"__kernel void test_fmin4(__global float4 *srcA, __global float *srcB, __global float4 *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" dst[tid] = fmin(srcA[tid], srcB[tid]);\n"
"}\n";
static const char *fmin8_kernel_code =
"__kernel void test_fmin8(__global float8 *srcA, __global float *srcB, __global float8 *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" dst[tid] = fmin(srcA[tid], srcB[tid]);\n"
"}\n";
static const char *fmin16_kernel_code =
"__kernel void test_fmin16(__global float16 *srcA, __global float *srcB, __global float16 *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" dst[tid] = fmin(srcA[tid], srcB[tid]);\n"
"}\n";
static const char *fmin3_kernel_code =
"__kernel void test_fmin3(__global float *srcA, __global float *srcB, __global float *dst)\n"
"{\n"
" int tid = get_global_id(0);\n"
" vstore3(fmin(vload3(tid,srcA), srcB[tid]),tid,dst);\n"
"}\n";
static int
verify_fmin(float *inptrA, float *inptrB, float *outptr, int n, int veclen)
{
float r;
int i, j;
for (i=0; i<n; ) {
int ii = i/veclen;
for (j=0; j<veclen && i<n; ++j, ++i) {
r = (inptrA[i] > inptrB[ii]) ? inptrB[ii] : inptrA[i];
if (r != outptr[i])
return -1;
}
}
return 0;
}
int
test_fminf(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
{
cl_mem streams[3];
cl_float *input_ptr[2], *output_ptr, *p;
cl_program *program;
cl_kernel *kernel;
void *values[3];
size_t threads[1];
int num_elements;
int err;
int i;
MTdata d;
program = (cl_program*)malloc(sizeof(cl_program)*kTotalVecCount);
kernel = (cl_kernel*)malloc(sizeof(cl_kernel)*kTotalVecCount);
num_elements = n_elems * (1 << (kTotalVecCount-1));
input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements);
input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements);
output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements);
streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL );
if (!streams[0])
{
log_error("clCreateBuffer failed\n");
return -1;
}
streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL );
if (!streams[1])
{
log_error("clCreateBuffer failed\n");
return -1;
}
streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL );
if (!streams[2])
{
log_error("clCreateBuffer failed\n");
return -1;
}
d = init_genrand( gRandomSeed );
p = input_ptr[0];
for (i=0; i<num_elements; i++)
{
p[i] = get_random_float(-0x20000000, 0x20000000, d);
}
p = input_ptr[1];
for (i=0; i<num_elements; i++)
{
p[i] = get_random_float(-0x20000000, 0x20000000, d);
}
free_mtdata(d); d = NULL;
err = clEnqueueWriteBuffer( queue, streams[0], true, 0, sizeof(cl_float)*num_elements,
(void *)input_ptr[0], 0, NULL, NULL );
if (err != CL_SUCCESS)
{
log_error("clWriteArray failed\n");
return -1;
}
err = clEnqueueWriteBuffer( queue, streams[1], true, 0, sizeof(cl_float)*num_elements,
(void *)input_ptr[1], 0, NULL, NULL );
if (err != CL_SUCCESS)
{
log_error("clWriteArray failed\n");
return -1;
}
err = create_single_kernel_helper( context, &program[0], &kernel[0], 1, &fmin_kernel_code, "test_fmin" );
if (err)
return -1;
err = create_single_kernel_helper( context, &program[1], &kernel[1], 1, &fmin2_kernel_code, "test_fmin2" );
if (err)
return -1;
err = create_single_kernel_helper( context, &program[2], &kernel[2], 1, &fmin4_kernel_code, "test_fmin4" );
if (err)
return -1;
err = create_single_kernel_helper( context, &program[3], &kernel[3], 1, &fmin8_kernel_code, "test_fmin8" );
if (err)
return -1;
err = create_single_kernel_helper( context, &program[4], &kernel[4], 1, &fmin16_kernel_code, "test_fmin16" );
if (err)
return -1;
err = create_single_kernel_helper( context, &program[5], &kernel[5], 1, &fmin3_kernel_code, "test_fmin3" );
if (err)
return -1;
values[0] = streams[0];
values[1] = streams[1];
values[2] = streams[2];
for (i=0; i < kTotalVecCount; i++)
{
err = clSetKernelArg(kernel[i], 0, sizeof streams[0], &streams[0] );
err |= clSetKernelArg(kernel[i], 1, sizeof streams[1], &streams[1] );
err |= clSetKernelArg(kernel[i], 2, sizeof streams[2], &streams[2] );
if (err != CL_SUCCESS)
{
log_error("clSetKernelArgs failed\n");
return -1;
}
}
threads[0] = (size_t)n_elems;
for (i=0; i < kTotalVecCount; i++)
{
err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, threads, NULL, 0, NULL, NULL );
if (err != CL_SUCCESS)
{
log_error("clEnqueueNDRangeKernel failed\n");
return -1;
}
err = clEnqueueReadBuffer( queue, streams[2], true, 0, sizeof(cl_float)*num_elements, output_ptr, 0, NULL, NULL );
if (err != CL_SUCCESS)
{
log_error("clEnqueueReadBuffer failed\n");
return -1;
}
if (verify_fmin(input_ptr[0], input_ptr[1], output_ptr, n_elems*((g_arrVecSizes[i])), (g_arrVecSizes[i])))
{
log_error("fmin float%d,float test failed\n", (g_arrVecSizes[i]));
err = -1;
}
else
{
log_info("fmin float%d,float test passed\n", (g_arrVecSizes[i]));
err = 0;
}
if (err)
break;
}
clReleaseMemObject(streams[0]);
clReleaseMemObject(streams[1]);
clReleaseMemObject(streams[2]);
for (i=0; i < kTotalVecCount; i++)
{
clReleaseKernel(kernel[i]);
clReleaseProgram(program[i]);
}
free(program);
free(kernel);
free(input_ptr[0]);
free(input_ptr[1]);
free(output_ptr);
return err;
}
| 31.283951 | 124 | 0.604446 |
a63e63d945f86433f31ba04078fc1d9c335dde41 | 1,588 | h | C | header6.6.1/WCPayTransToBankCardData.h | CrackerCat/iWeChat | 7b3dbc48090e2d60cb72417563c554777eded15f | [
"MIT"
] | 1,694 | 2018-05-04T12:34:53.000Z | 2022-03-23T10:33:46.000Z | header6.6.1/WCPayTransToBankCardData.h | CrackerCat/iWeChat | 7b3dbc48090e2d60cb72417563c554777eded15f | [
"MIT"
] | 6 | 2018-09-22T16:32:43.000Z | 2020-04-20T02:10:19.000Z | header6.6.1/WCPayTransToBankCardData.h | CrackerCat/iWeChat | 7b3dbc48090e2d60cb72417563c554777eded15f | [
"MIT"
] | 236 | 2018-05-05T11:00:28.000Z | 2022-03-09T03:57:28.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 <MMCommon/MMObject.h>
@class NSMutableArray, NSString, WCPayTransToBankCardReceiver;
@interface WCPayTransToBankCardData : MMObject
{
unsigned int _m_enterTimeScene;
unsigned int _m_uiTransferAmount;
unsigned int _m_uiPondage;
unsigned int _m_uiInputType;
WCPayTransToBankCardReceiver *_m_selectReceiver;
NSString *_m_nsTransferDesc;
NSMutableArray *_m_otherReceiverHistory;
NSMutableArray *_m_myReceiverHistory;
}
@property(retain, nonatomic) NSMutableArray *m_myReceiverHistory; // @synthesize m_myReceiverHistory=_m_myReceiverHistory;
@property(retain, nonatomic) NSMutableArray *m_otherReceiverHistory; // @synthesize m_otherReceiverHistory=_m_otherReceiverHistory;
@property(nonatomic) unsigned int m_uiInputType; // @synthesize m_uiInputType=_m_uiInputType;
@property(nonatomic) unsigned int m_uiPondage; // @synthesize m_uiPondage=_m_uiPondage;
@property(nonatomic) unsigned int m_uiTransferAmount; // @synthesize m_uiTransferAmount=_m_uiTransferAmount;
@property(retain, nonatomic) NSString *m_nsTransferDesc; // @synthesize m_nsTransferDesc=_m_nsTransferDesc;
@property(nonatomic) unsigned int m_enterTimeScene; // @synthesize m_enterTimeScene=_m_enterTimeScene;
@property(retain, nonatomic) WCPayTransToBankCardReceiver *m_selectReceiver; // @synthesize m_selectReceiver=_m_selectReceiver;
- (void).cxx_destruct;
- (_Bool)isSelectFromHistory;
@end
| 44.111111 | 131 | 0.804786 |
b7c4fd4bbb6c6762e2e897e4e08e4512c501d83c | 1,340 | h | C | eagleeye/algorithm/kmeans.h | MirrorYu/eagleeye | c251e7b3bc919673b41360212c38d5fda85bbe2f | [
"Apache-2.0"
] | 12 | 2020-09-21T02:24:11.000Z | 2022-03-10T03:02:03.000Z | eagleeye/ml/kmeans.h | nihui/eagleeye | eeb69204b7322e79904a4406b44d61a1a30a5c9a | [
"Apache-2.0"
] | 1 | 2020-11-30T08:22:50.000Z | 2020-11-30T08:22:50.000Z | eagleeye/ml/kmeans.h | nihui/eagleeye | eeb69204b7322e79904a4406b44d61a1a30a5c9a | [
"Apache-2.0"
] | 3 | 2020-03-16T12:10:55.000Z | 2021-07-20T09:58:15.000Z | #ifndef _KMEANS_H_
#define _KMEANS_H_
#include <fstream>
#include <memory.h>
#include <assert.h>
class KMeans{
public:
enum InitMode
{
InitRandom,
InitManual,
InitUniform,
};
KMeans(int dimNum = 1, int clusterNum = 1);
~KMeans();
void SetMean(int i, const float* u){ memcpy(m_means[i], u, sizeof(float) * m_dimNum); }
void SetInitMode(int i) { m_initMode = i; }
void SetMaxIterNum(int i) { m_maxIterNum = i; }
void SetEndError(float f) { m_endError = f; }
float* GetMean(int i) { return m_means[i]; }
int GetInitMode() { return m_initMode; }
int GetMaxIterNum() { return m_maxIterNum; }
float GetEndError() { return m_endError; }
/* SampleFile: <size><dim><data>...
LabelFile: <size><label>...
*/
void Cluster(const char* sampleFileName, const char* labelFileName);
void Init(std::ifstream& sampleFile);
void Init(float *data, int N);
void Cluster(float *data, int N, int *Label);
friend std::ostream& operator<<(std::ostream& out, KMeans& kmeans);
private:
int m_dimNum;
int m_clusterNum;
float** m_means;
int m_initMode;
int m_maxIterNum; // The stopping criterion regarding the number of iterations
float m_endError; // The stopping criterion regarding the error
float GetLabel(const float* x, int* label);
float CalcDistance(const float* x, const float* u, int dimNum);
};
#endif | 25.769231 | 88 | 0.7 |
4e45358f704afa4149608198bc3e596a61c63caf | 535 | h | C | src/stream_executor/platform_manager.h | wffpy/tinyflow-1 | f85a47f1b621036d3f5663b731e4451bf6233862 | [
"MIT"
] | null | null | null | src/stream_executor/platform_manager.h | wffpy/tinyflow-1 | f85a47f1b621036d3f5663b731e4451bf6233862 | [
"MIT"
] | null | null | null | src/stream_executor/platform_manager.h | wffpy/tinyflow-1 | f85a47f1b621036d3f5663b731e4451bf6233862 | [
"MIT"
] | null | null | null | #ifndef PLATFORM_MANAGER_H
#define PLATFORM_MANAGER_H
#include <string>
#include <vector>
#include <memory>
namespace stream_executor {
/**
* On the behalf of a kind device
*/
class Platform {
public:
using Id = int;
virtual std::string GetName() const = 0;
virtual Id GetId() const = 0;
};
/**
* Platforms manager
*/
class MultiPlatformManager {
static void RegisterPlatform(std::unique_ptr<Platform> platform);
static Platform* GetPaltform(std::string name);
static std::vector<Platform*> GetAllPlaforms();
};
}
#endif | 19.107143 | 66 | 0.727103 |
08665bd98eecf68cc80a12175a81307f30d73916 | 2,124 | h | C | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/VICertModule.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-03-29T12:08:37.000Z | 2021-05-26T05:20:11.000Z | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/VICertModule.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | null | null | null | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/VICertModule.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 "VIModule.h"
@class AUToast, NSDate, NSNumber, NSString, UIView;
@interface VICertModule : VIModule
{
NSString *_certCmd;
NSString *_progress_waiting_time;
NSString *_progress_content;
NSString *_pub_key_env;
NSString *_silent_install;
UIView *_backgroundView;
UIView *_keyWindow;
NSNumber *_isSignOnly;
NSDate *_signOnlyHUDStartDate;
AUToast *_progressToastView;
}
+ (id)certSnByKey:(id)arg1;
+ (id)keyMapper;
@property(retain, nonatomic) AUToast *progressToastView; // @synthesize progressToastView=_progressToastView;
@property(retain, nonatomic) NSDate *signOnlyHUDStartDate; // @synthesize signOnlyHUDStartDate=_signOnlyHUDStartDate;
@property(retain, nonatomic) NSNumber *isSignOnly; // @synthesize isSignOnly=_isSignOnly;
@property(nonatomic) __weak UIView *keyWindow; // @synthesize keyWindow=_keyWindow;
@property(retain, nonatomic) UIView *backgroundView; // @synthesize backgroundView=_backgroundView;
@property(retain, nonatomic) NSString *silent_install; // @synthesize silent_install=_silent_install;
@property(retain, nonatomic) NSString *pub_key_env; // @synthesize pub_key_env=_pub_key_env;
@property(retain, nonatomic) NSString *progress_content; // @synthesize progress_content=_progress_content;
@property(retain, nonatomic) NSString *progress_waiting_time; // @synthesize progress_waiting_time=_progress_waiting_time;
@property(retain, nonatomic) NSString *certCmd; // @synthesize certCmd=_certCmd;
- (void).cxx_destruct;
- (void)sendResult:(id)arg1 withService:(id)arg2;
- (void)presentToastWithin:(id)arg1 withIcon:(int)arg2 text:(id)arg3 duration:(double)arg4 completion:(CDUnknownBlockType)arg5;
- (void)showSuccessToastWithCompletion:(CDUnknownBlockType)arg1;
- (void)hideProgressHUD;
- (void)showProgressHUDWithText:(id)arg1;
- (void)moduleWillFinish;
- (void)parseAndExecuteWithInstruction:(id)arg1 response:(id)arg2;
- (void)start;
- (void)invalidate;
@end
| 42.48 | 127 | 0.776836 |
bd353a1f409558751732c7fc50eca9025b3493b5 | 4,800 | h | C | ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.h | brown-ccv/paraview-scalable | 64b221a540737d2ac94a120039bd8d1e661bdc8f | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-09-27T08:04:34.000Z | 2019-10-16T22:30:54.000Z | ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.h | sakjain92/paraview | f3af0cd9f6750e24ad038eac573b870c88d6b7dd | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.h | sakjain92/paraview | f3af0cd9f6750e24ad038eac573b870c88d6b7dd | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | /*=========================================================================
Program: ParaView
Module: vtkPVCompositeRepresentation.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkPVCompositeRepresentation
* @brief a data-representation used by ParaView.
*
* vtkPVCompositeRepresentation is a data-representation used by ParaView for showing
* a type of data-set in the render view. It is a composite-representation with
* some fixed representations for showing things like selection and polar axes.
* This representation has 1 input port and it ensures that that input is passed
* on to the internal representations
* (except SelectionRepresentation and PolarAxesRepresentation) properly.
* For SelectionRepresentation and PolarAxesRepresentation the client is expected
* to setup the input (look at vtkSMPVRepresentationProxy).
*/
#ifndef vtkPVCompositeRepresentation_h
#define vtkPVCompositeRepresentation_h
#include "vtkCompositeRepresentation.h"
#include "vtkPVClientServerCoreRenderingModule.h" //needed for exports
class vtkPolarAxesRepresentation;
class vtkSelectionRepresentation;
class vtkPVGridAxes3DRepresentation;
class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkPVCompositeRepresentation
: public vtkCompositeRepresentation
{
public:
static vtkPVCompositeRepresentation* New();
vtkTypeMacro(vtkPVCompositeRepresentation, vtkCompositeRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* These must only be set during initialization before adding the
* representation to any views or calling Update().
*/
void SetSelectionRepresentation(vtkSelectionRepresentation*);
void SetGridAxesRepresentation(vtkPVGridAxes3DRepresentation*);
/**
* This must only be set during initialization before adding the
* representation to any views or calling Update().
*/
void SetPolarAxesRepresentation(vtkPolarAxesRepresentation*);
/**
* Propagate the modification to all internal representations.
*/
void MarkModified() VTK_OVERRIDE;
/**
* Set visibility of the representation.
* Overridden to update the cube-axes and selection visibilities.
*/
void SetVisibility(bool visible) VTK_OVERRIDE;
/**
* Set the selection visibility.
*/
virtual void SetSelectionVisibility(bool visible);
/**
* Set the polar axes visibility.
*/
virtual void SetPolarAxesVisibility(bool visible);
//@{
/**
* Passed on to internal representations as well.
*/
void SetUpdateTime(double time) VTK_OVERRIDE;
void SetForceUseCache(bool val) VTK_OVERRIDE;
void SetForcedCacheKey(double val) VTK_OVERRIDE;
void SetInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void SetInputConnection(vtkAlgorithmOutput* input) VTK_OVERRIDE;
void AddInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void AddInputConnection(vtkAlgorithmOutput* input) VTK_OVERRIDE;
void RemoveInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void RemoveInputConnection(int port, int idx) VTK_OVERRIDE;
//@}
//@{
/**
* Forwarded to vtkSelectionRepresentation.
*/
virtual void SetPointFieldDataArrayName(const char*);
virtual void SetCellFieldDataArrayName(const char*);
//@}
/**
* Override because of internal composite representations that need to be
* initialized as well.
*/
unsigned int Initialize(unsigned int minIdAvailable, unsigned int maxIdAvailable) VTK_OVERRIDE;
protected:
vtkPVCompositeRepresentation();
~vtkPVCompositeRepresentation() override;
/**
* Adds the representation to the view. This is called from
* vtkView::AddRepresentation(). Subclasses should override this method.
* Returns true if the addition succeeds.
*/
bool AddToView(vtkView* view) VTK_OVERRIDE;
/**
* Removes the representation to the view. This is called from
* vtkView::RemoveRepresentation(). Subclasses should override this method.
* Returns true if the removal succeeds.
*/
bool RemoveFromView(vtkView* view) VTK_OVERRIDE;
vtkSelectionRepresentation* SelectionRepresentation;
vtkPVGridAxes3DRepresentation* GridAxesRepresentation;
vtkPolarAxesRepresentation* PolarAxesRepresentation;
bool SelectionVisibility;
private:
vtkPVCompositeRepresentation(const vtkPVCompositeRepresentation&) = delete;
void operator=(const vtkPVCompositeRepresentation&) = delete;
};
#endif
| 34.285714 | 97 | 0.752292 |
08b3aadba9eed7b46329d622ff42575301fcb3fc | 2,745 | h | C | intelmote2/support/sdk/c/camera_cmd/bigmsg_frame_part.h | tinyos-io/tinyos-3.x-contrib | 3aaf036722a2afc0c0aad588459a5c3e00bd3c01 | [
"BSD-3-Clause",
"MIT"
] | 1 | 2020-02-28T20:35:09.000Z | 2020-02-28T20:35:09.000Z | intelmote2/support/sdk/c/camera_cmd/bigmsg_frame_part.h | tinyos-io/tinyos-3.x-contrib | 3aaf036722a2afc0c0aad588459a5c3e00bd3c01 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | intelmote2/support/sdk/c/camera_cmd/bigmsg_frame_part.h | tinyos-io/tinyos-3.x-contrib | 3aaf036722a2afc0c0aad588459a5c3e00bd3c01 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | /**
* This file is automatically generated by mig. DO NOT EDIT THIS FILE.
* This file defines the layout of the 'bigmsg_frame_part' message type.
*/
#ifndef BIGMSG_FRAME_PART_H
#define BIGMSG_FRAME_PART_H
#include <message.h>
enum {
/** The default size of this message type in bytes. */
BIGMSG_FRAME_PART_SIZE = 68,
/** The Active Message type associated with this message. */
BIGMSG_FRAME_PART_AM_TYPE = 110,
/* Field part_id: type uint16_t, offset (bits) 0, size (bits) 16 */
/** Offset (in bytes) of the field 'part_id' */
BIGMSG_FRAME_PART_PART_ID_OFFSET = 0,
/** Offset (in bits) of the field 'part_id' */
BIGMSG_FRAME_PART_PART_ID_OFFSETBITS = 0,
/** Size (in bytes) of the field 'part_id' */
BIGMSG_FRAME_PART_PART_ID_SIZE = 2,
/** Size (in bits) of the field 'part_id' */
BIGMSG_FRAME_PART_PART_ID_SIZEBITS = 16,
/* Field node_id: type uint16_t, offset (bits) 16, size (bits) 16 */
/** Offset (in bytes) of the field 'node_id' */
BIGMSG_FRAME_PART_NODE_ID_OFFSET = 2,
/** Offset (in bits) of the field 'node_id' */
BIGMSG_FRAME_PART_NODE_ID_OFFSETBITS = 16,
/** Size (in bytes) of the field 'node_id' */
BIGMSG_FRAME_PART_NODE_ID_SIZE = 2,
/** Size (in bits) of the field 'node_id' */
BIGMSG_FRAME_PART_NODE_ID_SIZEBITS = 16,
/* Field buf: type uint8_t[], element size (bits) 8 */
/** Elementsize (in bytes) of the field 'buf' */
BIGMSG_FRAME_PART_BUF_ELEMENTSIZE = 1,
/** Elementsize (in bits) of the field 'buf' */
BIGMSG_FRAME_PART_BUF_ELEMENTSIZEBITS = 8,
/** The number of dimensions in the array 'buf'. */
BIGMSG_FRAME_PART_BUF_NUMDIMENSIONS = 1,
/** Number of elements in dimension 1 of array 'buf'. */
BIGMSG_FRAME_PART_BUF_NUMELEMENTS_1 = 64,
/** Total number of elements in the array 'buf'. */
BIGMSG_FRAME_PART_BUF_NUMELEMENTS = 64,
};
/**
* Return the value of the field 'part_id'
*/
uint16_t bigmsg_frame_part_part_id_get(tmsg_t *msg);
/**
* Set the value of the field 'part_id'
*/
void bigmsg_frame_part_part_id_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'node_id'
*/
uint16_t bigmsg_frame_part_node_id_get(tmsg_t *msg);
/**
* Set the value of the field 'node_id'
*/
void bigmsg_frame_part_node_id_set(tmsg_t *msg, uint16_t value);
/**
* Return the byte offset of an element of array 'buf'
*/
size_t bigmsg_frame_part_buf_offset(size_t index1);
/**
* Return an element of the array 'buf'
*/
uint8_t bigmsg_frame_part_buf_get(tmsg_t *msg, size_t index1);
/**
* Set an element of the array 'buf'
*/
void bigmsg_frame_part_buf_set(tmsg_t *msg, size_t index1, uint8_t value);
/**
* Return the bit offset of an element of array 'buf'
*/
size_t bigmsg_frame_part_buf_offsetbits(size_t index1);
#endif
| 30.164835 | 74 | 0.713661 |
4d01b00a50dbbb07270ef71b8f49f33edfef1092 | 1,004 | h | C | clocks/gravity/font.h | whonore/clocks | 31fe4afe42b665453fd29d1a9ac4a99f99fd0ad5 | [
"MIT"
] | null | null | null | clocks/gravity/font.h | whonore/clocks | 31fe4afe42b665453fd29d1a9ac4a99f99fd0ad5 | [
"MIT"
] | null | null | null | clocks/gravity/font.h | whonore/clocks | 31fe4afe42b665453fd29d1a9ac4a99f99fd0ad5 | [
"MIT"
] | null | null | null | #ifndef FONT_H
#define FONT_H
#include "clock.h"
// Hack to compute the correct file name for the current resolution.
// See:
// https://stackoverflow.com/questions/41766131/c-preprocessor-to-compute-product-specific-include
#define STR2(X) #X
#define STR(X) STR2(X)
#define FONT(digit) STR(fonts/digit-RESOLUTION.h)
#include FONT(0)
#include FONT(1)
#include FONT(2)
#include FONT(3)
#include FONT(4)
#include FONT(5)
#include FONT(6)
#include FONT(7)
#include FONT(8)
#include FONT(9)
const Point *const font[] =
{pts_0, pts_1, pts_2, pts_3, pts_4, pts_5, pts_6, pts_7, pts_8, pts_9};
const size_t font_len[] = {pts_0_len,
pts_1_len,
pts_2_len,
pts_3_len,
pts_4_len,
pts_5_len,
pts_6_len,
pts_7_len,
pts_8_len,
pts_9_len};
#endif /* FONT_H */
| 26.421053 | 98 | 0.548805 |
eabbdbd1ecaa69ebf99ebd520b224804d2ec8a26 | 1,952 | h | C | test/src/sw/redis++/sanity_test.h | paceholder/redis-plus-plus | 78031c26ed2e27eb0bf656960e8ecf841c6becc1 | [
"Apache-2.0"
] | 823 | 2018-01-08T07:16:57.000Z | 2022-03-31T16:18:56.000Z | test/src/sw/redis++/sanity_test.h | paceholder/redis-plus-plus | 78031c26ed2e27eb0bf656960e8ecf841c6becc1 | [
"Apache-2.0"
] | 320 | 2018-11-30T12:37:03.000Z | 2022-03-31T12:50:27.000Z | test/src/sw/redis++/sanity_test.h | paceholder/redis-plus-plus | 78031c26ed2e27eb0bf656960e8ecf841c6becc1 | [
"Apache-2.0"
] | 220 | 2018-12-07T22:38:22.000Z | 2022-03-30T09:39:27.000Z | /**************************************************************************
Copyright (c) 2017 sewenew
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 SEWENEW_REDISPLUSPLUS_TEST_SANITY_TEST_H
#define SEWENEW_REDISPLUSPLUS_TEST_SANITY_TEST_H
#include <sw/redis++/redis++.h>
namespace sw {
namespace redis {
namespace test {
template <typename RedisInstance>
class SanityTest {
public:
SanityTest(const ConnectionOptions &opts, RedisInstance &instance)
: _opts(opts), _redis(instance) {}
void run();
private:
void _test_uri();
void _test_uri_ctor();
std::string _build_uri(const ConnectionOptions &opts) const;
void _ping(Redis &instance);
void _test_move_ctor();
void _test_cmdargs();
void _test_generic_command();
void _test_hash_tag();
void _test_hash_tag(std::initializer_list<std::string> keys);
std::string _test_key(const std::string &key);
void _test_ping(Redis &instance);
void _test_pipeline(const StringView &key, Pipeline &pipeline);
void _test_transaction(const StringView &key, Transaction &transaction);
Pipeline _pipeline(const StringView &key);
Transaction _transaction(const StringView &key);
ConnectionOptions _opts;
RedisInstance &_redis;
};
}
}
}
#include "sanity_test.hpp"
#endif // end SEWENEW_REDISPLUSPLUS_TEST_SANITY_TEST_H
| 24.098765 | 76 | 0.678279 |
b31878c4f919489e474095b9c12d09e0526bd946 | 3,060 | c | C | fortran/src/H5Zf.c | hyoklee/hdf5 | d128e98a69039be58deeca9b737bf4b465b9756f | [
"BSD-3-Clause-LBNL"
] | 215 | 2020-04-27T17:08:20.000Z | 2022-03-09T14:36:37.000Z | fortran/src/H5Zf.c | hyoklee/hdf5 | d128e98a69039be58deeca9b737bf4b465b9756f | [
"BSD-3-Clause-LBNL"
] | 562 | 2020-06-21T15:38:20.000Z | 2022-03-31T15:33:59.000Z | fortran/src/H5Zf.c | hyoklee/hdf5 | d128e98a69039be58deeca9b737bf4b465b9756f | [
"BSD-3-Clause-LBNL"
] | 180 | 2020-04-30T17:05:42.000Z | 2022-03-31T16:04:26.000Z | /****h* H5Zf/H5Zf
* PURPOSE
* This file contains C stubs for H5Z Fortran APIs
*
* COPYRIGHT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
*/
#include "H5f90.h"
/****if* H5Zf/h5zunregister_c
* NAME
* h5zunregister_c
* PURPOSE
* Call H5Zunregister to unregister filter
* INPUTS
* filter identifier
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* Elena Pourmal
* Wednesday, March 12, 2003
* HISTORY
*
* SOURCE
*/
int_f
h5zunregister_c(int_f *filter)
/******/
{
int ret_value = -1;
herr_t status;
H5Z_filter_t c_filter;
/*
* Call H5Zunregister function.
*/
c_filter = (H5Z_filter_t)*filter;
status = H5Zunregister(c_filter);
if (status < 0)
return ret_value;
ret_value = 0;
return ret_value;
}
/****if* H5Zf/h5zfiletr_avail_c
* NAME
* h5zfiletr_avail_c
* PURPOSE
* Call H5Zfilter_avail to find if filter is available
* INPUTS
* filter - filter identifier
* OUTPUTS
* flag - status flag
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* Elena Pourmal
* Wednesday, March 12, 2003
* HISTORY
*
* SOURCE
*/
int_f
h5zfilter_avail_c(int_f *filter, int_f *flag)
/******/
{
int ret_value = 0;
H5Z_filter_t c_filter;
htri_t status;
c_filter = (H5Z_filter_t)*filter;
status = H5Zfilter_avail(c_filter);
*flag = (int_f)status;
if (status < 0)
ret_value = -1;
return ret_value;
}
/****if* H5Zf/h5zget_filter_info_c
* NAME
* h5zget_filter_info_c
* PURPOSE
* Call H5Zget_filter_info to find if filter has its encoder
* and/or its decoder available
* INPUTS
* filter - filter identifier
* OUTPUTS
* flag - status flag
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* Nat Furrer and James Laird
* Wednesday, June 16, 2004
* HISTORY
*
* SOURCE
*/
int_f
h5zget_filter_info_c(int_f *filter, int_f *flag)
/******/
{
int ret_value = 0;
H5Z_filter_t c_filter;
unsigned int c_flag;
c_filter = (H5Z_filter_t)*filter;
ret_value = H5Zget_filter_info(c_filter, &c_flag);
*flag = (int_f)c_flag;
return ret_value;
}
| 24.094488 | 78 | 0.558497 |
af74385b51d628e4dd9c6a53244c9c1f61a4b1c5 | 4,122 | h | C | src/game/uo_files/uofiles_macros.h | criminalx/Source-X | 7e656bb9edcbe78dd735feeb12a9ccff3b0f2fe3 | [
"Apache-2.0"
] | 21 | 2020-01-29T14:53:31.000Z | 2022-03-20T10:53:27.000Z | src/game/uo_files/uofiles_macros.h | criminalx/Source-X | 7e656bb9edcbe78dd735feeb12a9ccff3b0f2fe3 | [
"Apache-2.0"
] | 435 | 2020-01-20T12:50:15.000Z | 2022-03-29T03:31:27.000Z | src/game/uo_files/uofiles_macros.h | criminalx/Source-X | 7e656bb9edcbe78dd735feeb12a9ccff3b0f2fe3 | [
"Apache-2.0"
] | 47 | 2020-01-21T23:25:38.000Z | 2022-03-24T21:54:32.000Z | /**
* @file uofiles_macros.h
*
*/
#ifndef _INC_UOFILES_MACROS_H
#define _INC_UOFILES_MACROS_H
#include "uofiles_enums.h"
// Door ID Attribute flags
#define DOOR_OPENED 0x00000001 // set is open
#define DOOR_RIGHTLEFT 0x00000002
#define DOOR_INOUT 0x00000004
#define DOOR_NORTHSOUTH 0x00000008
// Sight distance definitions
#define UO_MAP_VIEW_SIGHT 14 // Max sight distance of creatures is 14.
#define UO_MAP_VIEW_SIZE_DEFAULT 18 // Visibility for normal items (on old clients it's always 18;
// since 2d client 7.0.55.27 it's dynamic 18-24 based on client screen resolution;
// enhanced client supports values up to 24)
#define UO_MAP_VIEW_SIZE_MAX 24
#define UO_MAP_VIEW_RADAR 31 // Visibility for castles, keeps and boats
// Map definitions
#define UO_BLOCK_SIZE 8 // Base width/height size of a block.
#define UO_BLOCK_ALIGN(i) ((i) & ~7 )
#define UO_BLOCK_OFFSET(i) ((i) & 7 ) // i%UO_BLOCK_SIZE
#define UO_SIZE_Z 127
#define UO_SIZE_MIN_Z -127
#define UO_SIZE_X_REAL 0x1400 // 640*UO_BLOCK_SIZE = 5120 = The actual world is only this big
#define UOTILE_BLOCK_QTY 32 // Come in blocks of 32.
// This should depend on height of players char.
#define PLAYER_HEIGHT 16 // We need x units of room to walk under something. (human) ??? this should vary based on creature type.
// Tiledata flags
#define UFLAG1_FLOOR 0x00000001 // 0= floor (Walkable at base position)
#define UFLAG1_EQUIP 0x00000002 // 1= equipable. m_layer is LAYER_TYPE
#define UFLAG1_NONBLOCKING 0x00000004 // 2= Signs and railings that do not block.
#define UFLAG1_LIQUID 0x00000008 // 3= blood,Wave,Dirt,webs,stain, (translucent items)
#define UFLAG1_WALL 0x00000010 // 4= wall type = wall/door/fireplace
#define UFLAG1_DAMAGE 0x00000020 // 5= damaging. (Sharp, hot or poisonous)
#define UFLAG1_BLOCK 0x00000040 // 6= blocked for normal human. (big and heavy)
#define UFLAG1_WATER 0x00000080 // 7= water/wet (blood/water)
#define UFLAG2_ZERO1 0x00000100 // 8= NOT USED (i checked)
#define UFLAG2_PLATFORM 0x00000200 // 9= platform/flat (can stand on, bed, floor, )
#define UFLAG2_CLIMBABLE 0x00000400 // a= climbable (stairs). m_height /= 2(For Stairs+Ladders)
#define UFLAG2_STACKABLE 0x00000800 // b= pileable/stackable (m_dwUnk7 = stack size ?)
#define UFLAG2_WINDOW 0x00001000 // c= window/arch/door can walk thru it
#define UFLAG2_WALL2 0x00002000 // d= another type of wall. (not sure why there are 2)
#define UFLAG2_A 0x00004000 // e= article a
#define UFLAG2_AN 0x00008000 // f= article an
#define UFLAG3_DESCRIPTION 0x00010000 // 10= descriptional tile. (Regions, professions, ...)
#define UFLAG3_TRANSPARENT 0x00020000 // 11= Transparent (Is used for leaves and sails)
#define UFLAG3_CLOTH 0x00040000 // 12= Probably dyeable ? effects the way the client colors the item. color gray scale stuff else must be converted to grayscale
#define UFLAG3_ZERO8 0x00080000 // 13= 0 NOT USED (i checked)
#define UFLAG3_MAP 0x00100000 // 14= map
#define UFLAG3_CONTAINER 0x00200000 // 15= container.
#define UFLAG3_EQUIP2 0x00400000 // 16= equipable (not sure why there are 2 of these)
#define UFLAG3_LIGHT 0x00800000 // 17= light source
#define UFLAG4_ANIM 0x01000000 // 18= animation with next several object frames.
#define UFLAG4_HOVEROVER 0x02000000 // 19= item can be hovered over (SA tiledata) (older tiledata has this applied to archway, easel, fountain - unknown purpose)
#define UFLAG4_WALL3 0x04000000 // 1a= tend to be types of walls ? I have no idea.
#define UFLAG4_BODYITEM 0x08000000 // 1b= Whole body item (ex.British", "Blackthorne", "GM Robe" and "Death shroud")
#define UFLAG4_ROOF 0x10000000 // 1c=
#define UFLAG4_DOOR 0x20000000 // 1d= door
#define UFLAG4_STAIRS 0x40000000 // 1e=
#define UFLAG4_WALKABLE 0x80000000 // 1f= We can walk here.
// Light levels
#define LIGHT_BRIGHT 0
#define LIGHT_DARK 30
#define LIGHT_BLACK 32
#define TRAMMEL_FULL_BRIGHTNESS 2 // light units LIGHT_BRIGHT
#define FELUCCA_FULL_BRIGHTNESS 6 // light units LIGHT_BRIGHT
#endif //_INC_UOFILES_MACROS_H
| 48.494118 | 162 | 0.745269 |
c606b1d9a577c5aa0ec04621c18f23f962ed513f | 444 | h | C | examples/gear_demo/src/DemoScene.h | rafael-radkowski/TrackingExpert- | 007310637e1582d9623e518510d5d9eccaa23c2c | [
"MIT"
] | 26 | 2020-02-28T06:20:36.000Z | 2021-12-09T09:52:06.000Z | examples/gear_demo/src/DemoScene.h | rafael-radkowski/TrackingExpert- | 007310637e1582d9623e518510d5d9eccaa23c2c | [
"MIT"
] | 6 | 2020-02-19T15:04:27.000Z | 2021-08-15T20:32:08.000Z | examples/gear_demo/src/DemoScene.h | rafael-radkowski/TrackingExpert- | 007310637e1582d9623e518510d5d9eccaa23c2c | [
"MIT"
] | 5 | 2020-07-09T18:58:34.000Z | 2021-08-16T00:40:06.000Z | #pragma once
/*
*/
// STL
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
// TrackingExpert
#include "graphicsx.h"
#include "ModelOBJ.h"
class DemoScene
{
public:
DemoScene();
~DemoScene();
/*
Create the demo scene
*/
void create(void);
void draw(glm::mat4 projectionMatrix, glm::mat4 viewMatrix);
private:
// vector containing the models
std::vector<cs557::OBJModel> _3d_models;
}; | 11.1 | 62 | 0.668919 |
b73cf174ca2ae01aeb1e224f69f140949f485316 | 2,425 | h | C | GTE/Graphics/BlendState.h | lakinwecker/GeometricTools | cff3e3fcb52d714afe0b6789839c460437c10b27 | [
"BSL-1.0"
] | null | null | null | GTE/Graphics/BlendState.h | lakinwecker/GeometricTools | cff3e3fcb52d714afe0b6789839c460437c10b27 | [
"BSL-1.0"
] | 1 | 2022-03-18T00:34:13.000Z | 2022-03-18T00:34:13.000Z | GTE/Graphics/BlendState.h | lakinwecker/GeometricTools | cff3e3fcb52d714afe0b6789839c460437c10b27 | [
"BSL-1.0"
] | 1 | 2022-03-17T21:54:55.000Z | 2022-03-17T21:54:55.000Z | // David Eberly, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2022
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Version: 6.0.2022.01.06
#pragma once
#include <Mathematics/Vector4.h>
#include <Graphics/DrawingState.h>
#include <cstdint>
namespace gte
{
class BlendState : public DrawingState
{
public:
enum Mode
{
ZERO,
ONE,
SRC_COLOR,
INV_SRC_COLOR,
SRC_ALPHA,
INV_SRC_ALPHA,
DEST_ALPHA,
INV_DEST_ALPHA,
DEST_COLOR,
INV_DEST_COLOR,
SRC_ALPHA_SAT,
FACTOR,
INV_FACTOR,
SRC1_COLOR,
INV_SRC1_COLOR,
SRC1_ALPHA,
INV_SRC1_ALPHA
};
enum Operation
{
ADD,
SUBTRACT,
REV_SUBTRACT,
MIN,
MAX
};
enum ColorWrite
{
ENABLE_RED = 1,
ENABLE_GREEN = 2,
ENABLE_BLUE = 4,
ENABLE_ALPHA = 8,
ENABLE_ALL = 15
};
static size_t constexpr NUM_TARGETS = 8;
struct Target
{
Target()
:
enable(false),
srcColor(Mode::ONE),
dstColor(Mode::ZERO),
opColor(Operation::ADD),
srcAlpha(Mode::ONE),
dstAlpha(Mode::ZERO),
opAlpha(Operation::ADD),
mask(ColorWrite::ENABLE_ALL)
{
}
bool enable;
uint32_t srcColor;
uint32_t dstColor;
uint32_t opColor;
uint32_t srcAlpha;
uint32_t dstAlpha;
uint32_t opAlpha;
uint8_t mask;
};
BlendState();
// Member access. The members are intended to be write-once before
// you create an associated graphics state.
bool enableAlphaToCoverage; // default: false
bool enableIndependentBlend; // default: false
std::array<Target, NUM_TARGETS> target;
Vector4<float> blendColor; // default: (0,0,0,0)
uint32_t sampleMask; // default: 0xFFFFFFFF
};
}
| 25.260417 | 75 | 0.496495 |
5b95db397d3ddca9dfcef0f89156abd70744359e | 4,269 | h | C | platform/shared/net/INetRequest.h | insphereapplication/rhodes | 57a2b4b64b04667e94c7c8924bf7038e4fdf60b3 | [
"MIT"
] | null | null | null | platform/shared/net/INetRequest.h | insphereapplication/rhodes | 57a2b4b64b04667e94c7c8924bf7038e4fdf60b3 | [
"MIT"
] | null | null | null | platform/shared/net/INetRequest.h | insphereapplication/rhodes | 57a2b4b64b04667e94c7c8924bf7038e4fdf60b3 | [
"MIT"
] | null | null | null | #pragma once
#include "common/RhoStd.h"
#include "common/InputStream.h"
#include "common/AutoPointer.h"
#include "common/RhoMutexLock.h"
namespace rho {
namespace common {
class CRhoFile;
}
namespace net {
struct INetResponse
{
virtual ~INetResponse(void){;}
virtual const char* getCharData() = 0;
virtual unsigned int getDataSize() = 0;
virtual int getRespCode() = 0;
virtual String getCookies() = 0;
virtual void setCharData(const char* szData) = 0;
};
struct IRhoSession
{
virtual void logout()=0;
virtual const String& getSession()=0;
virtual const String& getContentType()=0;
};
struct CMultipartItem
{
//mutually exclusive
String m_strFilePath;
String m_strBody;
//
String m_strName, m_strFileName, m_strContentType;
String m_strDataPrefix;
};
struct INetRequestImpl
{
virtual ~INetRequestImpl(void){;}
virtual INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders )=0;
virtual INetResponse* pullFile(const String& strUrl, common::CRhoFile& oFile, IRhoSession* oSession, Hashtable<String,String>* pHeaders)=0;
virtual INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders)=0;
virtual void cancel() = 0;
virtual boolean getSslVerifyPeer() = 0;
virtual void setSslVerifyPeer(boolean mode) = 0;
virtual INetResponse* createEmptyNetResponse() = 0;
};
typedef rho::common::CAutoPtr<rho::net::INetResponse> NetResponsePtr;
class CNetResponseWrapper
{
NetResponsePtr m_netResp;
public:
CNetResponseWrapper( INetResponse* resp = 0) : m_netResp(resp) {}
const char* getCharData(){ return m_netResp->getCharData(); }
unsigned int getDataSize(){ return m_netResp->getDataSize(); }
int getRespCode(){ return m_netResp->getRespCode(); }
String getCookies(){ return m_netResp->getCookies(); }
boolean isOK()
{
return getRespCode() == 200 || getRespCode() == 206;
}
boolean isUnathorized()
{
return getRespCode() == 401;
}
boolean isRedirect()
{
return getRespCode() == 301 || getRespCode() ==302;
}
boolean isSuccess()
{
return getRespCode() > 0 && getRespCode() < 400;
}
boolean isResponseRecieved(){ return getRespCode() != -1; }
};
class CNetRequestHolder
{
common::CMutex m_mxReq;
INetRequestImpl* m_pReq;
boolean m_bCancel;
boolean m_sslVerifyPeer;
public:
CNetRequestHolder() : m_pReq(0), m_bCancel(false), m_sslVerifyPeer(true){}
void setRequest(INetRequestImpl* pReq);
void cancel();
boolean isCancelled();
static String resolveUrl(const String& strUrl);
boolean getSslVerifyPeer() {return m_sslVerifyPeer;}
void setSslVerifyPeer(boolean mode) {m_sslVerifyPeer = mode;}
};
class CNetRequestWrapper
{
common::CAutoPtr<INetRequestImpl> m_pReqImpl;
CNetRequestHolder* m_pHolder;
public:
CNetRequestWrapper(INetRequestImpl* pImpl, CNetRequestHolder* pHolder);
~CNetRequestWrapper();
INetResponse* pullData(const String& strUrl, IRhoSession* oSession );
INetResponse* pushData(const String& strUrl, const String& strBody, IRhoSession* oSession);
INetResponse* pullCookies(const String& strUrl, const String& strBody, IRhoSession* oSession);
INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders );
INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
INetResponse* pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
INetResponse* pullFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
String resolveUrl(const String& strUrl);
};
}
}
typedef rho::net::CNetResponseWrapper NetResponse;
typedef rho::net::CNetRequestHolder NetRequest;
rho::net::CNetRequestWrapper getNetRequest(rho::net::CNetRequestHolder* pHolder = 0);
| 29.239726 | 164 | 0.718435 |
9dc83076e37824f1ee2565694e599f488275050a | 6,323 | c | C | avionics/firmware/cpu/io.c | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 1,178 | 2020-09-10T17:15:42.000Z | 2022-03-31T14:59:35.000Z | avionics/firmware/cpu/io.c | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 1 | 2020-05-22T05:22:35.000Z | 2020-05-22T05:22:35.000Z | avionics/firmware/cpu/io.c | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 107 | 2020-09-10T17:29:30.000Z | 2022-03-18T09:00:14.000Z | /*
* Copyright 2020 Makani Technologies LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "avionics/firmware/cpu/io.h"
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include "avionics/firmware/cpu/dcan_pin.h"
#include "avionics/firmware/cpu/gio.h"
#include "avionics/firmware/cpu/n2het.h"
#include "avionics/firmware/cpu/sci_pin.h"
#include "avionics/firmware/cpu/spi_pin.h"
#define GET_FUNC1(NAME) \
bool Io ## NAME(IoPin pin) { \
return GetFunc1(pin, \
DcanPin ## NAME, \
Gio ## NAME, \
N2het ## NAME, \
SciPin ## NAME, \
SpiPin ## NAME); \
}
#define SET_FUNC1(NAME) \
void Io ## NAME(IoPin pin) { \
SetFunc1(pin, \
DcanPin ## NAME, \
Gio ## NAME, \
N2het ## NAME, \
SciPin ## NAME, \
SpiPin ## NAME); \
}
#define SET_FUNC2(NAME) \
void Io ## NAME(IoPin pin, bool value) { \
SetFunc2(pin, value, \
DcanPin ## NAME, \
Gio ## NAME, \
N2het ## NAME, \
SciPin ## NAME, \
SpiPin ## NAME); \
}
static bool GetFunc1(IoPin pin,
bool (* const dcan_func)(DcanPin pin),
bool (* const gio_func)(GioPin pin),
bool (* const n2het_func)(N2hetPin pin),
bool (* const sci_func)(SciPin pin),
bool (* const spi_func)(SpiPin pin)) {
if (IoPinIsUnmappedPin(pin)) {
// No-op.
return false;
} else if (IoPinIsDcanPin(pin)) {
return dcan_func(IoPinToDcanPin(pin));
} else if (IoPinIsGioPin(pin)) {
return gio_func(IoPinToGioPin(pin));
} else if (IoPinIsN2hetPin(pin)) {
return n2het_func(IoPinToN2hetPin(pin));
} else if (IoPinIsSciPin(pin)) {
return sci_func(IoPinToSciPin(pin));
} else if (IoPinIsSpiPin(pin)) {
return spi_func(IoPinToSpiPin(pin));
} else {
assert(false);
return false;
}
}
static void SetFunc1(IoPin pin,
void (* const dcan_func)(DcanPin pin),
void (* const gio_func)(GioPin pin),
void (* const n2het_func)(N2hetPin pin),
void (* const sci_func)(SciPin pin),
void (* const spi_func)(SpiPin pin)) {
if (IoPinIsUnmappedPin(pin)) {
// No-op.
} else if (IoPinIsDcanPin(pin)) {
dcan_func(IoPinToDcanPin(pin));
} else if (IoPinIsGioPin(pin)) {
gio_func(IoPinToGioPin(pin));
} else if (IoPinIsN2hetPin(pin)) {
n2het_func(IoPinToN2hetPin(pin));
} else if (IoPinIsSciPin(pin)) {
sci_func(IoPinToSciPin(pin));
} else if (IoPinIsSpiPin(pin)) {
spi_func(IoPinToSpiPin(pin));
} else {
assert(false);
}
}
static void SetFunc2(IoPin pin, bool value,
void (* const dcan_func)(DcanPin pin, bool value),
void (* const gio_func)(GioPin pin, bool value),
void (* const n2het_func)(N2hetPin pin, bool value),
void (* const sci_func)(SciPin pin, bool value),
void (* const spi_func)(SpiPin pin, bool value)) {
if (IoPinIsUnmappedPin(pin)) {
// No-op.
} else if (IoPinIsDcanPin(pin)) {
dcan_func(IoPinToDcanPin(pin), value);
} else if (IoPinIsGioPin(pin)) {
gio_func(IoPinToGioPin(pin), value);
} else if (IoPinIsN2hetPin(pin)) {
n2het_func(IoPinToN2hetPin(pin), value);
} else if (IoPinIsSciPin(pin)) {
sci_func(IoPinToSciPin(pin), value);
} else if (IoPinIsSpiPin(pin)) {
spi_func(IoPinToSpiPin(pin), value);
} else {
assert(false);
}
}
void IoInit(void) {
GioInit();
N2hetInit();
}
bool IoPinIsUnmappedPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceUnmapped;
}
bool IoPinIsDcanPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceDcan;
}
bool IoPinIsGioPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceGio;
}
bool IoPinIsN2hetPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceN2het;
}
bool IoPinIsSciPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceSci;
}
bool IoPinIsSpiPin(IoPin pin) {
return IO_ENUM_TO_TYPE(pin) == kIoInterfaceSpi;
}
DcanPin IoPinToDcanPin(IoPin pin) {
assert(IO_ENUM_TO_TYPE(pin) == kIoInterfaceDcan);
return (DcanPin)IO_ENUM_TO_PIN(pin);
}
GioPin IoPinToGioPin(IoPin pin) {
assert(IO_ENUM_TO_TYPE(pin) == kIoInterfaceGio);
return (GioPin)IO_ENUM_TO_PIN(pin);
}
N2hetPin IoPinToN2hetPin(IoPin pin) {
assert(IO_ENUM_TO_TYPE(pin) == kIoInterfaceN2het);
return (N2hetPin)IO_ENUM_TO_PIN(pin);
}
SciPin IoPinToSciPin(IoPin pin) {
assert(IO_ENUM_TO_TYPE(pin) == kIoInterfaceSci);
return (SciPin)IO_ENUM_TO_PIN(pin);
}
SpiPin IoPinToSpiPin(IoPin pin) {
assert(IO_ENUM_TO_TYPE(pin) == kIoInterfaceSpi);
return (SpiPin)IO_ENUM_TO_PIN(pin);
}
SET_FUNC1(ConfigureAsInputPullDown);
SET_FUNC1(ConfigureAsInputPullUp);
SET_FUNC1(ConfigureAsInput);
SET_FUNC2(ConfigureAsOutputPushPull);
SET_FUNC2(ConfigureAsOutputOpenDrain);
SET_FUNC1(SetDirectionAsOutput);
SET_FUNC1(SetDirectionAsInput);
SET_FUNC2(SetValue);
GET_FUNC1(GetValue);
SET_FUNC1(SetOutputHigh);
SET_FUNC1(SetOutputLow);
SET_FUNC1(SetAsPushPull);
SET_FUNC1(SetAsOpenDrain);
SET_FUNC1(DisablePull);
SET_FUNC1(EnablePull);
SET_FUNC1(SetAsPullDown);
SET_FUNC1(SetAsPullUp);
| 31.457711 | 75 | 0.598925 |
6f47ffa07fce2aa6eff4d7cbf198a0d0f8cb65dc | 19,826 | c | C | omega_lib/src/hull.c | Alessandro-Barbieri/the-omega-project | e43941452fbb612b60f31d3741286334b8fa27e3 | [
"BSD-2-Clause"
] | 43 | 2015-06-02T21:09:46.000Z | 2022-03-09T12:16:18.000Z | omega_lib/src/hull.c | holycrap872/the-omega-project | 2e2890cacc1fe6e25f11255aecda063717f71f5b | [
"BSD-2-Clause"
] | 3 | 2021-08-07T23:32:34.000Z | 2022-01-06T02:06:58.000Z | omega_lib/src/hull.c | holycrap872/the-omega-project | 2e2890cacc1fe6e25f11255aecda063717f71f5b | [
"BSD-2-Clause"
] | 17 | 2015-07-21T08:11:16.000Z | 2021-08-07T23:00:27.000Z | /* $Id: hull.c,v 1.1.1.1 2004/09/13 21:07:48 mstrout Exp $ */
#include <omega.h>
#include <omega/farkas.h>
#include <omega/hull.h>
#include <basic/Bag.h>
#include <basic/Map.h>
namespace omega {
int hull_debug = 0;
Relation DecoupledConvexHull(NOT_CONST Relation &R) {
Relation S = Approximate(consume_and_regurgitate(R));
if (S.has_single_conjunct()) return S;
return Farkas(Farkas(S,Decoupled_Farkas),Convex_Combination_Farkas);
}
Relation ConvexHull(NOT_CONST Relation &R) {
Relation S = Approximate(consume_and_regurgitate(R));
if (S.has_single_conjunct()) return S;
return Farkas(Farkas(S,Basic_Farkas),Convex_Combination_Farkas);
}
Relation FastTightHull(NOT_CONST Relation &input_R,
NOT_CONST Relation &input_H) {
Relation R = Approximate(consume_and_regurgitate(input_R));
Relation H = Approximate(consume_and_regurgitate(input_H));
#ifdef DEBUG
Relation orig_R = R;
#endif
if (hull_debug) {
fprintf(DebugFile,"[ Computing FastTightHull of:\n");
R.prefix_print(DebugFile);
fprintf(DebugFile,"given known hull of:\n");
H.prefix_print(DebugFile);
}
if (!H.has_single_conjunct()) {
if (hull_debug)
fprintf(DebugFile,
"] bailing out of FastTightHull, known hull not convex\n");
return H;
}
if (!H.is_obvious_tautology()) {
R = Gist(R,copy(H));
R.simplify(1,0);
}
if (R.has_single_conjunct()) {
R = Intersection(R,H);
if (hull_debug) {
fprintf(DebugFile,
"] quick easy answer to FastTightHull\n");
R.prefix_print(DebugFile);
}
return R;
}
if (R.has_local(coefficient_of_constant_term)) {
if (hull_debug) {
fprintf(DebugFile,
"] Can't handle recursive application of Farkas lemma\n");
}
return H;
}
if (hull_debug) {
fprintf(DebugFile,"Gist of R given H is:\n");
R.prefix_print(DebugFile);
}
if (1) {
Set<Variable_ID> vars;
int conjuncts = 0;
for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) {
conjuncts++;
for (Variable_ID_Iterator v(*((*s)->variables())); v.live(); v++) {
bool found = false;
for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next())
if ((*eq).get_coef(*v) != 0) {
if (!found) vars.insert(*v);
found = true;
break;
}
if (!found) for (GEQ_Iterator geq = (*s)->GEQs();
geq.live(); geq.next())
if ((*geq).get_coef(*v) != 0) {
if (!found) vars.insert(*v);
found = true;
break;
}
}
}
// We now know which variables appear in R
if (hull_debug) {
fprintf(DebugFile,"Variables we need a better hull on are: ");
foreach(v,Variable_ID,vars,
fprintf(DebugFile," %s",v->char_name()));
fprintf(DebugFile,"\n");
}
Conjunct *c = H.single_conjunct();
int total=0;
int copied = 0;
for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) {
total++;
foreach(v,Variable_ID,vars,
if ((*eq).get_coef(v) != 0) {
R.and_with_EQ(*eq);
copied++;
break; // out of variable loop
}
);
}
for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) {
total++;
foreach(v,Variable_ID,vars,
if ((*geq).get_coef(v) != 0) {
R.and_with_GEQ(*geq);
copied++;
break; // out of variable loop
}
);
}
if (copied < total) {
R = Approximate(R);
if (hull_debug) {
fprintf(DebugFile,"Decomposed relation, copied only %d of %d constraints\n",copied,total);
fprintf(DebugFile,"Original R:\n");
R.prefix_print(DebugFile);
fprintf(DebugFile,"Known hull:\n");
H.prefix_print(DebugFile);
fprintf(DebugFile,"New R:\n");
R.prefix_print(DebugFile);
}
}
}
Relation F = Farkas(copy(R),Basic_Farkas);
if (hull_debug)
fprintf(DebugFile,"Farkas Difficulty = " coef_fmt "\n",
farkasDifficulty);
if (farkasDifficulty > 260) {
if (hull_debug) {
fprintf(DebugFile,
"] bailing out, farkas is way too complex\n");
fprintf(DebugFile,"Farkas:\n");
F.prefix_print(DebugFile);
}
return H;
}
else if (farkasDifficulty > 130) {
// Bail out
if (hull_debug) {
fprintf(DebugFile, coef_fmt " non-zeros in original farkas\n",
farkasDifficulty);
}
Relation tmp = Farkas(R,Decoupled_Farkas);
if (hull_debug) {
fprintf(DebugFile, coef_fmt " non-zeros in decoupled farkas\n",
farkasDifficulty);
}
if (farkasDifficulty > 260) {
if (hull_debug) {
fprintf(DebugFile,
"] bailing out, farkas is way too complex\n");
fprintf(DebugFile,"Farkas:\n");
F.prefix_print(DebugFile);
}
return H;
}
else {
if (farkasDifficulty > 130)
R = Intersection(H, Farkas(tmp,Affine_Combination_Farkas));
else R = Intersection(H,
Intersection(Farkas(tmp,Convex_Combination_Farkas),
Farkas(F,Affine_Combination_Farkas)));
if (hull_debug) {
fprintf(DebugFile,
"] bailing out, farkas is too complex, using affine hull\n");
fprintf(DebugFile,"Farkas:\n");
F.prefix_print(DebugFile);
fprintf(DebugFile,"Affine hull:\n");
R.prefix_print(DebugFile);
}
return R;
}}
R = Intersection(H,
Farkas(F,Convex_Combination_Farkas));
if (hull_debug) {
fprintf(DebugFile,
"] Result of FastTightHull:\n");
R.prefix_print(DebugFile);
}
return R;
}
Relation AffineHull(NOT_CONST Relation &R) {
return Farkas(Farkas(R,Basic_Farkas),Affine_Combination_Farkas);
}
Relation LinearHull(NOT_CONST Relation &R) {
return Farkas(Farkas(R,Basic_Farkas),Linear_Combination_Farkas);
}
Relation ConicHull(NOT_CONST Relation &R) {
return Farkas(Farkas(R,Basic_Farkas),Positive_Combination_Farkas);
}
Relation ConicClosure (NOT_CONST Relation &R)
{
assert(R.n_inp() == R.n_out());
int n = R.n_inp();
return DeltasToRelation(ConicHull(Deltas(R)),n,n);
} /* ConicClosure */
bool parallel(const GEQ_Handle &g1, const GEQ_Handle &g2) {
for(Constr_Vars_Iter cvi(g1, false); cvi; cvi++) {
coef_t c1 = (*cvi).coef;
coef_t c2 = g2.get_coef((*cvi).var);
if (c1 != c2) return false;
}
{
for(Constr_Vars_Iter cvi(g2, false); cvi; cvi++) {
coef_t c1 = g1.get_coef((*cvi).var);
coef_t c2 = (*cvi).coef;
if (c1 != c2) return false;
}
}
return true;
}
bool hull(const EQ_Handle &e, const GEQ_Handle &g, coef_t &hull) {
int sign = 0;
for(Constr_Vars_Iter cvi(e, false); cvi; cvi++) {
coef_t c1 = (*cvi).coef;
coef_t c2 = g.get_coef((*cvi).var);
if (sign == 0) sign = (c1*c2>=0?1:-1);
if (sign*c1 != c2) return false;
}
assert(sign != 0);
{for(Constr_Vars_Iter cvi(g, false); cvi; cvi++) {
coef_t c1 = e.get_coef((*cvi).var);
coef_t c2 = (*cvi).coef;
if (sign*c1 != c2) return false;
}
}
hull = max(sign * e.get_const(), g.get_const());
if (hull_debug) {
fprintf(DebugFile,"Hull of:\n %s\n",(const char *)e.print_to_string());
fprintf(DebugFile," %s\n",(const char *)g.print_to_string());
fprintf(DebugFile,"is " coef_fmt "\n\n",hull);
}
return true;
}
bool eq(const EQ_Handle &e1, const EQ_Handle &e2) {
int sign = 0;
for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) {
coef_t c1 = (*cvi).coef;
coef_t c2 = e2.get_coef((*cvi).var);
if (sign == 0) sign = (c1*c2>=0?1:-1);
if (sign*c1 != c2) return false;
}
assert(sign != 0);
{for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) {
coef_t c1 = e1.get_coef((*cvi).var);
coef_t c2 = (*cvi).coef;
if (sign*c1 != c2) return false;
}
}
return sign * e1.get_const() == e2.get_const();
}
static Relation QuickHull(Tuple<Relation> &Rs) {
assert(!Rs.empty());
if (Rs.size() == 1) return Rs[1];
Relation result = Relation::True(Rs[1]);
result.copy_names(Rs[1]);
use_ugly_names++;
Relation R = copy(Rs[1]);
for (int i = 2; i <= Rs.size(); i++)
R = Union(R,copy(Rs[i]));
#if 0
if (!R.is_set()) {
if (R.n_inp() == R.n_out()) {
Relation AC = DeltasToRelation(Hull(Deltas(copy(R),
min(R.n_inp(),R.n_out()))),
R.n_inp(),R.n_out());
Relation dH = Hull(Domain(copy(R)),false);
Relation rH = Hull(Range(copy(R)),false);
result = Intersection(AC,Cross_Product(dH,rH));
}
else {
Relation dH = Hull(Domain(copy(R)),false);
Relation rH = Hull(Range(copy(R)),false);
result = Cross_Product(dH,rH);
assert(Must_Be_Subset(copy(R),copy(result)));
}
}
#endif
Conjunct *first;
if (hull_debug > 1)
Rs[1].prefix_print(DebugFile);
Rs[1] = EQs_to_GEQs(Rs[1]);
if (hull_debug > 1)
for (int i = 1; i <= Rs.size(); i++) {
fprintf(DebugFile,"#%d \n",i);
Rs[i].prefix_print(DebugFile);
}
first = Rs[1].single_conjunct();
for (GEQ_Iterator candidate(first->GEQs()); candidate.live(); candidate.next()) {
coef_t maxConstantTerm = (*candidate).get_const();
bool found = 1;
if (hull_debug > 1) {
fprintf(DebugFile,"searching for bound on:\n %s\n",
(const char *)(*candidate).print_to_string());
}
for (int i = 2; i <= Rs.size(); i++) {
Conjunct *C = Rs[i].single_conjunct();
bool found_for_i = false;
for (GEQ_Iterator target(C->GEQs()); target.live(); target.next()) {
if (hull_debug > 2) {
fprintf(DebugFile,"candidate:\n %s\n",
(const char *)(*candidate).print_to_string());
fprintf(DebugFile,"target:\n %s\n",
(const char *)(*target).print_to_string());
}
if (parallel(*candidate,*target)) {
if (hull_debug > 1)
fprintf(DebugFile,"Found bound:\n %s\n",
(const char *)(*target).print_to_string());
maxConstantTerm = max(maxConstantTerm,(*target).get_const());
found_for_i = true;
break;
}
};
if (!found_for_i) {
for (EQ_Iterator target_e(C->EQs()); target_e.live(); target_e.next()) {
coef_t h;
if (hull(*target_e,*candidate,h)) {
if (hull_debug > 1)
fprintf(DebugFile,"Found bound of " coef_fmt ":\n %s\n",
h,(const char *)(*target_e).print_to_string());
maxConstantTerm = max(maxConstantTerm,h);
found_for_i = true;
break;
}
};
if (!found_for_i) {
if (hull_debug > 1) {
fprintf(DebugFile,"No bound found in:\n");
fprintf(DebugFile,"%s", (const char *) Rs[i].print_with_subs_to_string());
}
//if nothing found
found = 0;
break;
}
}
}
if (found) {
GEQ_Handle h = result.and_with_GEQ();
copy_constraint(h,*candidate);
if (hull_debug > 1)
fprintf(DebugFile,"Setting constant term to " coef_fmt " in\n %s\n",
maxConstantTerm,
(const char *) (h).print_to_string());
h.update_const(maxConstantTerm - (*candidate).get_const());
if (hull_debug > 1)
fprintf(DebugFile,"Updated constraint is\n %s\n",
(const char *)
(h).print_to_string());
}
}
for (EQ_Iterator candidate_eq(first->EQs()); candidate_eq.live(); candidate_eq.next()) {
bool found = true;
for (int i = 2; i <= Rs.size(); i++) {
Conjunct *C = Rs[i].single_conjunct();
bool found_for_i = false;
for (EQ_Iterator target(C->EQs()); target.live(); target.next()) {
if (eq(*candidate_eq,*target)) {
found_for_i = true;
break;
}
};
if (!found_for_i) {
//if nothing found
found = false;
break;
}
}
if (found) {
EQ_Handle h = result.and_with_EQ();
copy_constraint(h,*candidate_eq);
if (hull_debug > 1)
fprintf(DebugFile,"Adding eq constraint: %s\n",
(const char *)
(h).print_to_string());
}
}
use_ugly_names--;
if (hull_debug > 1) {
fprintf(DebugFile,"quick hull is of:");
result.print_with_subs(DebugFile);
}
return result;
}
void printRs(Tuple<Relation> &Rs) {
fprintf(DebugFile,"Rs:\n");
for (int i = 1; i <= Rs.size(); i++)
fprintf(DebugFile,"#%d : %s\n",i,
(const char *) Rs[i].print_with_subs_to_string());
}
Relation BetterHull(Tuple<Relation> &Rs, bool stridesAllowed, bool checkSubsets,
NOT_CONST Relation &input_knownHull = Relation::Null()) {
Relation knownHull = consume_and_regurgitate(input_knownHull);
static int OMEGA_WHINGE = -1;
if (OMEGA_WHINGE < 0)
{
OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0;
}
assert(!Rs.empty());
if (Rs.size() == 1) {
if (stridesAllowed) return Rs[1];
else return Approximate(Rs[1]);
}
if (checkSubsets) {
Tuple<bool> live(Rs.size());
if (hull_debug) {
fprintf(DebugFile,"Checking subsets in hull computation:\n");
printRs(Rs);
}
int i;
for(i=1;i <=Rs.size(); i++) live[i] = true;
for(i=1;i <=Rs.size(); i++)
for(int j=1;j <=Rs.size(); j++) if (i != j && live[j]) {
if (hull_debug) fprintf(DebugFile,"checking %d Is_Obvious_Subset %d\n",i,j);
if (Is_Obvious_Subset(copy(Rs[i]),copy(Rs[j]))) {
if (hull_debug) fprintf(DebugFile,"yes...\n");
live[i] = false;
break;
}
}
for(i=1;i <=Rs.size(); i++) if (!live[i]) {
if (i < Rs.size()) {
Rs[i] = Rs[Rs.size()];
live[i] = live[Rs.size()];
};
Rs[Rs.size()] = Relation();
Rs.delete_last();
i--;
}
}
Relation hull;
if (hull_debug) {
fprintf(DebugFile,"Better Hull:\n");
printRs(Rs);
fprintf(DebugFile,"known hull: %s\n",
(const char *)knownHull.print_with_subs_to_string());
};
if (knownHull.is_null()) hull = QuickHull(Rs);
else hull = Intersection(QuickHull(Rs),knownHull);
hull.simplify();
if (hull_debug) {
fprintf(DebugFile,"quick hull: %s\n",
(const char *)hull.print_with_subs_to_string());
};
Relation orig = Relation::False(Rs[1]);
int i;
for (i = 1; i <= Rs.size(); i++)
orig = Union(orig,copy(Rs[i]));
orig.simplify();
for (i = 1; i <= Rs.size(); i++) {
if (!hull.is_obvious_tautology()) Rs[i] = Gist(Rs[i],copy(hull));
Rs[i].simplify();
if (Rs[i].is_obvious_tautology()) return hull;
if (Rs[i].has_single_conjunct()) {
Rs[i] = EQs_to_GEQs(Rs[i],true);
if (hull_debug) {
fprintf(DebugFile,"Checking for hull constraints in:\n %s\n",
(const char *)Rs[i].print_with_subs_to_string());
}
Conjunct *c = Rs[i].single_conjunct();
for (GEQ_Iterator g(c->GEQs()); g.live(); g.next()) {
Relation tmp = Relation::True(Rs[i]);
tmp.and_with_GEQ(*g);
if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable())
hull.and_with_GEQ(*g);
}
for (EQ_Iterator e(c->EQs()); e.live(); e.next()) {
Relation tmp = Relation::True(Rs[i]);
tmp.and_with_EQ(*e);
if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable())
hull.and_with_EQ(*e);
}
}
}
hull = FastTightHull(orig,hull);
assert(hull.has_single_conjunct());
if (stridesAllowed) return hull;
else return Approximate(hull);
}
Relation Hull(NOT_CONST Relation &S,
bool stridesAllowed,
int effort,
NOT_CONST Relation &knownHull
) {
Relation R = consume_and_regurgitate(S);
R.simplify(1,0);
if (!R.is_upper_bound_satisfiable()) return R;
Tuple<Relation> Rs;
for (DNF_Iterator c(R.query_DNF()); c.live(); ) {
Rs.append(Relation(R,c.curr()));
c.next();
};
if (effort == 1)
return BetterHull(Rs,stridesAllowed,false,knownHull);
else
return QuickHull(Rs);
}
Relation Hull(Tuple<Relation> &Rs,
Tuple<int> &validMask,
int effort,
bool stridesAllowed,
NOT_CONST Relation &knownHull
) {
// Use relation of index i only when validMask[i] != 0
Tuple<Relation> Rs2;
for(int i = 1; i <= Rs.size(); i++) {
if (validMask[i]) {
Rs[i].simplify();
for (DNF_Iterator c(Rs[i].query_DNF()); c.live(); ) {
Rs2.append(Relation(Rs[i],c.curr()));
c.next();
};
}
}
assert(effort == 0 || effort == 1);
if (effort == 1)
return BetterHull(Rs2,stridesAllowed,true,knownHull);
else
return QuickHull(Rs2);
}
Relation CheckForConvexPairs(NOT_CONST Relation &S) {
Relation R = consume_and_regurgitate(S);
Relation hull = FastTightHull(copy(R),Relation::True(R));
R.simplify(1,0);
if (!R.is_upper_bound_satisfiable() || R.number_of_conjuncts() < 2) return R;
Tuple<Relation> Rs;
for (DNF_Iterator c(R.query_DNF()); c.live(); ) {
Rs.append(Relation(R,c.curr()));
c.next();
};
bool * dead = new bool[Rs.size()+1];
int i;
for(i = 1; i<=Rs.size();i++) dead[i] = false;
for(i = 1; i<=Rs.size();i++) if (!dead[i])
for(int j = i+1; j<=Rs.size();j++) if (!dead[j]) {
if (hull_debug) {
fprintf(DebugFile,"Comparing #%d and %d\n",i,j);
}
Relation U = Union(copy(Rs[i]),copy(Rs[j]));
Relation H_ij = FastTightHull(copy(U),copy(hull));
if (!Difference(copy(H_ij),U).is_upper_bound_satisfiable()) {
Rs[i] = H_ij;
dead[j] = true;
if (hull_debug) {
fprintf(DebugFile,"Combined them\n");
}
}
}
i = 1;
while(i<=Rs.size() && dead[i]) i++;
assert(i<=Rs.size());
R = Rs[i];
i++;
for(; i<=Rs.size();i++) if (!dead[i])
R = Union(R,Rs[i]);
delete dead;
return R;
}
Relation VennDiagramForm(NOT_CONST Relation &Context_In,
Tuple<Relation> &Rs,
int next,
bool anyPositives,
int weight) {
Relation Context = consume_and_regurgitate(Context_In);
if (hull_debug) {
fprintf(DebugFile,"[VennDiagramForm, next = %d, anyPositives = %d, weight = %d \n",
next,anyPositives,weight);
fprintf(DebugFile,"context:\n");
Context.prefix_print(DebugFile);
}
if (anyPositives && weight > 3) {
Context.simplify();
if (!Context.is_upper_bound_satisfiable()) {
if (hull_debug)
fprintf(DebugFile,"] not satisfiable\n");
return Context;
}
weight = 0;
}
if (next > Rs.size()) {
if (!anyPositives) {
if (hull_debug)
fprintf(DebugFile,"] no positives\n");
return Relation::False(Context);
}
Context.simplify();
if (hull_debug) {
fprintf(DebugFile,"] answer is:\n");
Context.prefix_print(DebugFile);
}
return Context;
}
Relation Pos = VennDiagramForm(Intersection(copy(Context),copy(Rs[next])),
Rs,
next+1,
true,
weight+2);
Relation Neg = VennDiagramForm(Difference(Context,copy(Rs[next])),
Rs,
next+1,
anyPositives,
weight+1);
if (hull_debug) {
fprintf(DebugFile,"] VennDiagramForm\n");
fprintf(DebugFile,"pos part:\n");
Pos.prefix_print(DebugFile);
fprintf(DebugFile,"neg part:\n");
Neg.prefix_print(DebugFile);
}
return Union(Pos,Neg);
}
Relation VennDiagramForm(
Tuple<Relation> &Rs,
NOT_CONST Relation &Context_In) {
Relation Context = consume_and_regurgitate(Context_In);
if (Context.is_null()) Context = Relation::True(Rs[1]);
if (hull_debug) {
fprintf(DebugFile,"Starting computation of VennDiagramForm\n");
fprintf(DebugFile,"Context:\n");
Context.prefix_print(DebugFile);
for(int i = 1; i <= Rs.size(); i++) {
fprintf(DebugFile,"#%d:\n",i);
Rs[i].prefix_print(DebugFile);
}
}
return VennDiagramForm(Context,Rs,1,false,0);
}
Relation VennDiagramForm(
NOT_CONST Relation &R_In,
NOT_CONST Relation &Context_In) {
Relation R = consume_and_regurgitate(R_In);
Relation Context = consume_and_regurgitate(Context_In);
Tuple<Relation> Rs;
for (DNF_Iterator c(R.query_DNF()); c.live(); ) {
Rs.append(Relation(R,c.curr()));
c.next();
};
return VennDiagramForm(Rs,Context);
}
Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In) {
Relation R = consume_and_regurgitate(R_In);
Relation h = Hull(copy(R));
if (!Difference(copy(h),copy(R)).is_upper_bound_satisfiable())
return h;
else
return R;
}
} // end of namespace omega
| 26.828146 | 91 | 0.606073 |
6ff62b028e24c5783e136946435ffef519c0a854 | 3,548 | h | C | usb.h | hasebems/TouchMIDI_Firmware | 0dd4dca97d8fe42a831b2568371c59ae2622822b | [
"MIT"
] | null | null | null | usb.h | hasebems/TouchMIDI_Firmware | 0dd4dca97d8fe42a831b2568371c59ae2622822b | [
"MIT"
] | null | null | null | usb.h | hasebems/TouchMIDI_Firmware | 0dd4dca97d8fe42a831b2568371c59ae2622822b | [
"MIT"
] | null | null | null | /*******************************************************************************
Module for Microchip USB Library
Company:
Microchip Technology Inc.
File Name:
usb.h
Summary:
This header file exposes the core library APIs and definitions for the USB
library.
Description:
This header file exposes the core library APIs and definitions for the USB
library. The user is responsible for also including the header file for
the specific driver they will be using.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#ifndef _USB_H_
//DOM-IGNORE-BEGIN
#define _USB_H_
//DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: All necessary USB Library headers
// *****************************************************************************
// *****************************************************************************
//#include "system.h"
//#include "system_config.h" // Must be defined by the application
#include "usb_common.h" // Common USB library definitions
#include "usb_ch9.h" // USB device framework definitions
#if defined( USB_SUPPORT_DEVICE )
#include "usb_device.h" // USB Device abstraction layer interface
#endif
#if defined( USB_SUPPORT_HOST )
#include "usb_host.h" // USB Host abstraction layer interface
#endif
#if defined ( USB_SUPPORT_OTG )
#include "usb_otg.h"
#endif
#include "usb_hal.h" // Hardware Abstraction Layer interface
/* USB Library version number. This can be used to verify in an application
specific version of the library is being used.
*/
#define USB_MAJOR_VER 2 // Firmware version, major release number.
#define USB_MINOR_VER 11 // Firmware version, minor release number.
#define USB_DOT_VER 0 // Firmware version, dot release number.
#endif // _USB_H_
| 40.318182 | 81 | 0.600902 |
5b183a63486cd4aefa4a38afca4c82c677adf117 | 1,553 | c | C | EGN3211_HW8Av3.c | AllanAV/EGN3211 | dec731bb72add112af2a7c126d98fd16b8ec84ad | [
"MIT"
] | null | null | null | EGN3211_HW8Av3.c | AllanAV/EGN3211 | dec731bb72add112af2a7c126d98fd16b8ec84ad | [
"MIT"
] | null | null | null | EGN3211_HW8Av3.c | AllanAV/EGN3211 | dec731bb72add112af2a7c126d98fd16b8ec84ad | [
"MIT"
] | null | null | null | /*
UCF EGN 3211
FALL 2018
Prof. Sundar Sinnappan
*** Homework 8A ***
by Allan Aquino Vieira
https://github.com/AllanAV/EGN3211/blob/master/EGN3211_HW8Av3.c
*/
#include <stdio.h>
#include <math.h>
int main(void)
{
//main VARIABLE DEFINITIONS
char prompt[] = {"Finding root for three degree polynomial Ax^3 = Bx^2 + Cx + D"
"using Newton-Raphson method"};
double A = 1.00;
double B = 3.00;
double C = -1.00;
double D = -4.00;
double guess = 1.00;
//printf("\nguess=%.10f\n", guess);
double precision = 0.000000001;
//printf("\nprecision=%.10f\n", precision);
printf("%s", "Enter value for the following coeficients\n");
printf("A= ");
scanf("%f", &A);
printf("B= ");
scanf("%f", &B);
printf("C= ");
scanf("%f", &C);
printf("D= ");
scanf("%f", &D);
printf("Initial root estimate: ");
scanf("%f", &guess);
double fx;
double dx;
int i=1;
double ans;
do
{
printf("\n%3d : Estimate : %.10f", i, guess);
//printf("\n%d ***********************************", i);
fx = (A*guess*guess*guess+B*guess*guess+C*guess+D);
//printf("\nf(x)=%.10g", fx);
//printf(" > %.10g", precision);
dx = (3.0*A*guess*guess+2.0*B*guess+C);
//printf("\ndx/dy=%.10f", dx);
double fxDx = fx/dx;
//printf("\n(fx/dx)=%.10f", fxDx);
guess = (guess - fxDx);
//printf("\nguess=%.10f\n", guess);
ans = guess;
++i;
}while(fabs(fx)>= precision);
printf("\n\nAproximate solution = %.10f\n\n", guess);
return 0;
}
| 19.910256 | 82 | 0.537669 |
128e08113a8435d88f957daa67da3d07abcee340 | 1,410 | h | C | Playground/Src/Engine/RenderObjects/Mesh.h | TheOrestes/PlaygroundRTX | 82d3acf08bc5dcdcf3f0e39ca6a9e0bae524bc27 | [
"MIT"
] | null | null | null | Playground/Src/Engine/RenderObjects/Mesh.h | TheOrestes/PlaygroundRTX | 82d3acf08bc5dcdcf3f0e39ca6a9e0bae524bc27 | [
"MIT"
] | null | null | null | Playground/Src/Engine/RenderObjects/Mesh.h | TheOrestes/PlaygroundRTX | 82d3acf08bc5dcdcf3f0e39ca6a9e0bae524bc27 | [
"MIT"
] | null | null | null | #pragma once
#include "PlaygroundPCH.h"
#include "vulkan/vulkan.h"
#include "Engine/Helpers/Utility.h"
#include "glm/glm.hpp"
#include "glm/gtc/type_ptr.hpp"
#include "glm/gtc/matrix_transform.hpp"
class VulkanDevice;
//---------------------------------------------------------------------------------------------------------------------
class Mesh
{
public:
Mesh() {};
Mesh(VulkanDevice* device, const std::vector<App::VertexPNTBT>& vertices, const std::vector<uint32_t>& indices);
Mesh(VulkanDevice* device, const std::vector<App::VertexPNT>& vertices, const std::vector<uint32_t>& indices);
Mesh(VulkanDevice* device, const std::vector<App::VertexP>& vertices, const std::vector<uint32_t>& indices);
void SetPushConstantData(glm::mat4 modelMatrix);
//inline PushConstantData GetPushConstantData() { return m_pushConstData; }
~Mesh();
void Cleanup(VulkanDevice* pDevice);
void CleanupOnWindowsResize(VulkanDevice* pDevice);
void MeshToVkGeometryKHR(VulkanDevice* pDevice);
public:
Vulkan::MeshData* m_pMeshData;
Vulkan::MeshInstance* m_pMeshInstanceData;
private:
void CreateVertexBuffer(VulkanDevice* device, const std::vector<App::VertexPNT>& vertices);
void CreateVertexBuffer(VulkanDevice* device, const std::vector<App::VertexPNTBT>& vertices);
void CreateIndexBuffer(VulkanDevice* device, const std::vector<uint32_t>& indices);
};
| 30.652174 | 119 | 0.680142 |
b1d5016b56f054c108d8c940915df4ba512fcc7a | 40,139 | c | C | src/clib/u8g2_font_wqy16_t_chinese1.c | kzhioki/U8g2_Arduino | 42bac40675ab7404e6df3444cb01124aa9bd17b2 | [
"BSD-2-Clause"
] | null | null | null | src/clib/u8g2_font_wqy16_t_chinese1.c | kzhioki/U8g2_Arduino | 42bac40675ab7404e6df3444cb01124aa9bd17b2 | [
"BSD-2-Clause"
] | null | null | null | src/clib/u8g2_font_wqy16_t_chinese1.c | kzhioki/U8g2_Arduino | 42bac40675ab7404e6df3444cb01124aa9bd17b2 | [
"BSD-2-Clause"
] | null | null | null | #include "u8g2.h"
/*
Fontname: -wenquanyi-wenquanyi bitmap song-medium-r-normal--16-160-75-75-P-80-iso10646-1
Copyright: (null)
Glyphs: 411/41295
BBX Build Mode: 0
*/
const uint8_t u8g2_font_wqy16_t_chinese1[14241] U8G2_FONT_SECTION("u8g2_font_wqy16_t_chinese1") =
"\233\0\4\2\5\5\3\5\6\22\22\376\374\13\375\14\374\1\351\3\364\5\310 \6\0\60\242\0!\10\301"
"\375\241\360 \42\42\11\304\270\242\20\361I\0#\34\210\21\242\23\11EB\221\310`\20)\212\204\42\241"
"Hd\60\210\24EB\221\14\0$\32\247\361\241\23\32(\42\21ID\22J\244V\211PD\22\221T"
"\14D\31\0%\35\250\361\241\241ID*\42\211HEF\221\213\345b\21M\42\222\210TD\42\42\5"
"\0&\32\211\21\252\262\312\204\62\241L*\221\13E\22\221\232DU$\225\251\310l\2'\10b\134\243"
"\240P\0(\15\4\226\231\23\251\211d\372Q&T)\16\4\226\231\20\252\11e\372I&R\3*\21"
"'Q\242\23\313D*\332l\22Mjb\31\0+\15k\25\266\25\355jp\240\212v\5,\11\202\330"
"\241\60H(\0-\7$p\226\60\10.\7B\370\241\60\10/\21\6\226\241U\224*J\25\245\212R"
"E\251\24\0\60\16g\25\242\262\251H\371U\42\223\231\0\61\13e\35\242\22\31\365'\3\1\62\16g"
"\25\242\262\251H\305R}\66\30\4\63\22g\25\242\61\210\204r\261TfW&\212\14\42\0\64\23h"
"\25\246\25S%B\221L'\241\310`\240\312\225\0\65\20g\25\242p +\33\350\312b\242\310 \2"
"\66\23g\25\242\62\210\244b\25\23M\42e\225\310d&\0\67\17g\25\242p\20K\305\252bU\261"
"\32\0\70\24g\25\242\262\251H\251\22\231\314\246\42\245Jd\62\23\0\71\22g\25\242\262\251HY%"
"\62\222E\254*\62\210\0:\7\341\30\222\220\12;\7\1\371\221\220\22<\14I\371\261\30S\271S*"
"\223\6=\13\212T\262\360 \217\32\34\4>\13J\365\261\20\365R\346!\0\77\17\206\25\242\242\211$"
"B\242V\365\220T\4@\31(\61\246\62\310\204\22\211\211(\241\30$\24\221\204b\220(\312\14\42\0"
"A\27i\21\252\24\314%b\211T&\224\311\14\6\221T$\225\310\351\2B\22g\21\242p\221r\224"
"\30HB\211\224\325`\220\0C\21h\21\246\62\220\244\22\261\134\207\271Td\240\0D\21h\21\246p"
"\222J\244\22\61_%R\211\301\4E\17g\21\242p k\66X\304\232\15\6\1F\15g\21\242p"
" k\66X\304:\3G\25i\21\252\62\230\304\22\271`\321@\247K\304\22\261\310`\1H\14h\21"
"\246\20\363lp\20\363,I\12c\21\222\260\210\364\27\3J\13\304\251\215\242\351\177\63H\0K\25g"
"\21\242\220\22%\62\221\232DH\225\10E\62%\241D*L\13g\21\242\20\353\237\15\6\1M\35k"
"\21\262\240\33\344\26\251\204\42\225\220d\42\222LD\223\310h\22\31QH\24R\6N\23h\21\246\20"
"\223\255\24!IF\23\21%T\63\263\0O\24j\21\256\62\330\304\42\261D\320\303D,\22\313\14&"
"\0P\16g\21\242p\221\362j\60H\304\232\1Q\26\251\321\251\62\320\244\42\251D\316\273D\244M\42"
"\63\20&\23\0R\21g\21\242p\221r\224\30HB\211P\42e\25S\21g\21\242\62\210\204d\271"
"\334\256,\225\30H\0T\12i\21\252\360(\330\77\2U\15h\21\246\20\363\317\22\241\314 \2V\26"
"i\21\252\220\323%R\221T$\225)\312\244\22\261D.\30\2W#m\21\272\220J\251R\252\212L"
"\42\23\311$\62\221L\42S\221I\204\22\231D(\221I\244\312R\31\0X\25i\21\252\220K\244\62"
"U\211\134\60\227\210%R\231\252D.Y\21g\21\242\220R%\62\221LE(\221\212u\3Z\20h"
"\21\246p\240\213\345b\271Xg\203\201\0[\13\304\371\241\60\320\364\277\31\4\134\22\307\361\241\20\313\305"
"r\261\134,\27\313\305r\261\0]\12\3\222\225\60\351\377\311 ^\11e\370\252\222I\324\4_\7*"
"\224\261\360 `\7B\34\243\20\11a\23\7\21\242\61\210\204b\221\201\42\224\10%\62\222I\0b\20"
"g\21\242\20k\61\321$R\256\66\211\304\4c\15\6\21\236\62\311\250\232e\42\13\0d\17g\21\242"
"\326dQ\263r\225\310H\26\1e\17\7\21\242\262\251H\15\316r\241\310 \1f\15d\21\226\242\310"
"D\6\211L\237\0g\22g\261\241\262\250Y\271Jd$\213X\42\223\231\0h\15g\21\242\20k\61"
"\321$R\276\12i\11b\21\222Q\242\350\7j\13\303\255\215R$\351O\26\0k\22g\21\242\20k"
"\224\310DjF\221LI(\221\12l\7a\25\222\360@m\24\13\21\262\220\230,\64F!QH\24"
"\22\205D!Q\1n\13\6\21\236\220XhD>\12o\16\7\21\242\262\251H\271Jd\62\23\0p"
"\26h\261\245\240\330h\42\251D*\221J\244\22\232Hb\223+\3q\25h\261\245\262Pd\24\251D"
"*\221J\244\42\31\315\42\327\2r\13\5\21\232\220\30hB=\2s\16\6\21\236\61H\204d\216\22"
"\203\4\0t\14E\21\232\21\312\14\24\241^\15u\23\7\21\242 J\204\22\241D(\21J\204\22\31"
"\311\42v\22\7\21\242\220R%\62\221L$S\21J\244\62\0w\33\13\21\262\20\12\211B\232D&"
"\21ID*\62\211H\42\223\310\244B\251\10\0x\20\7\21\242\220Jd*R\261T\42S\221\12y"
"\24g\261\241\220R%\62\221LE(\221\212\245b!\25\0z\12\6\21\236p\25\352\325`{\15\6"
"\226\241\63I\365H\23S\365l|\10\1\232\221\360\203\0}\17\6\226\241 K\365,&\21\245\272\21"
"\1~\11G\64\253\61\321(\0\200\23\207\21\242\263\251\210\245\6\232\324@\23\253\313d\26\0\0\0\0"
"\14Y\71\16!pk\20h\377\377 \23\11.\324\302\360\201\0N\0\10/\320\302\360\3N\12\20\357"
"\361\301\26\357\371`\20\214\367\341\340\3N\13\25\357\321\301\360\263x'\331L\64\224L\5S\301x\207"
"\0N\15\37\356\321\301\61x\20L\207\323aE\62\21\311E\62\251L(\23J%R)Y\272\31\0"
"N*\26\17\322\301\27O'\262\231d*W\25*Q\245t\361~\7N-\31\13\332\301\25m\65x"
"\24\22\205D!QH\24\32<\10UE[\1N:$\15\322\301W\24\314\4\63\341\330\340Y*\226"
"\212%\62\251L$\225\211\204r\231`$\231\310%*#\0N;\26\357\361\301\226\7\344\201\203\7\301"
"x\313\301\201\62\336\335\340\3NH\32\355\365\301\26\316\206\263\231\134(\26\212\245\332\26\305\212\202\221\301"
"\223d\0NK\23\356\365\301\25O\347a\203\307\375V\33I\206\6\7N_'\357\361\301\27\217f\242"
"\231\210,\263\210%\66\251I&\243\310\224e\312\62\211\262L$\227\211e\242\231hhp Nf\37"
"\16\322\301\226I\206\202\251\314\340\62\223\314$\63\311Lf\360@\326\277I\344B\301\34\0N\206\20\354"
"\325\301\360iKi\266_&\242\61\0N\213\42\17\322\301\27\317\15\276K\16\16D\215\6\7\312\344\340"
"@\31\212\14\276\13\205\6\7\312p\42\35\4N\216\23\357\321\301\62\70P\306\333\15\276\213\367q\42\35"
"\4N\221\31\357\321\301\62\70\320s\62\370,\35O\207\202\261\302\320\340Q\62\36\1N\222\33\317\361\301"
"\61x\20\213W\17\6\272X.V\27\253\33\14\344\351xj\360\1N\233(\357\361\301\225\211fr\221"
"L\223E$\24\311\254\42\231P\244&\24I\14\22\241\201l\240\310S\14\356\211\6\17\22\0N\244 "
"\17\322\301\226\7\304s\203\357\61\271X\60\224\213\264\212\304\62\331D\272\42\252\311\311\64\322\1N\272\31"
"\17\322\301\27\357u\42\234\310f\242\231d*\230\312U%\63\331D:N\316+\17\322\301\224\12\246\202"
"\251`*\230\12\246\202\251`*\30J\304\22\231D,R\21\213$\62\241T&T\25\11\305\22\241`"
"\0N\326/\17\322\301T\31J&\42\301H\205*\22Q\204$\11IH\242\210d\22\203H\277\212\264"
"\212T\250\42E\231H.\23\311e\62\203\201&\13N\345&\15\332\301\31Ke\212\62\241LQ\246\60"
"\23\314\344B\271P.\24\311\244\22\241DF\224\211\204Ru\231`\0N\352*\17\322\301\224\211\206\42"
"\261D\244*\222*I\205\64U\232\242D\246I(\221\13%r\251`*\30J\344\62e\221TEN"
"N\354\61\16\322\301\24\211f\222\231\304 \23\211e\42\261\210$\26\221\304\22%\61IY&\22\313D"
"b\231H,\23\211e\42\261L$\224\310DR\11\0N\366+\17\322\301\224\12\246\202\221\272L$\227"
"\31\14\62\222LL\222I%\212Jb\271\304\340 \23\313\305r\261\134,\27\313\305B\0N\375\63\17"
"\322\301\24\313e\42\271L$\26\312\244\62\241\220&\225\221\304\42\211\212\301B\22\312\244B\231T(\223"
"\12eR\231P*\23JE\62\211T\42\225\1O\30\61\17\322\301\224\211\344\62e\231\252P\62\61\70"
"\210\210\22\61Q\42\225\10%B\221P\42\27J\344\62\221\134&\222i\222)\311\64\11\15\62\211$\0"
"O\32!\17\322\301\27O'\262\231d*\246\223H\6\203\210\236b\360 \227\256\312U\15\16T\301\10"
"\0O )\17\322\301T\31J\206\202\221\301 U'\12*\6\7\211\242X$\23\215\14\6\251`*"
"S\26J\344R\301X.\26\2OF,\17\322\301\24\257\30\14D\221X(\22\313Hb\31\311` "
"IDb\211HY(\22\13E\6\3Q$\26\212W\14\16\62Y\0O\134*\17\322\301\24\311F\262"
"\221hf\60\320D\22AI\42\250\210\344\22\241\201\244(\31J\206\222\241\301\250\62\224\14%C\61\0"
"O`/\17\322\301\224\211f\242\231df\60\320\224E$\261\214\42\224J\304B\221L$\221\312D\212"
"\42\231H(\222i\21\312\224\345B\211\134*\5O\335+\17\322\301\24O\14\6\261D\252$U\222\12"
"I\6\203\220*\226H\225$\6G\241]&Q\26i\225\310\24\211jR\301T\12O\341)\17\322\301"
"T\231\12&\6\67\361\264f\60\310\210\23\331Hf\60\10\305k\6\203P&\25\312\244B\231\301 \224"
"I%\0P\250\66\17\322\301\23\313\305r\232\201\42R\24\311DB\211\214h\60P\350B\211A&\27"
"\211\14\66\221DM\211$S\222\31h\42\211\232\22I\246$\63\320\304\62\11\0P\317\65\17\322\301\24"
"\311F\6\272D(\226\30\34)\62\221\214\244&#\31\14$\211P,\222IdB\11E\253LD\226"
"\220(R\241DU&R\224P\324T\245\0QE&\17\322\301\226\7\344\6_\305\323\251\134\325\340@"
"\227\211\344\62\321L\64\223\14eR\241L(\225\211\350\6\11\0QF+\16\326\301\224IfR\231&"
"\65\221P\42\223H%\62\311\214N\223H%\62\221L$S\221)\14\325\204JR\241Dn\260\6Q"
"e\36\17\322\301\225\7\344\1\361\352D\70\21Nd\63\321L\62\25L\345\252\202\241h$,Ql!"
"\357\361\301\230\215d#\321P\62\24\214\25\206\252\42\251\230*\236I\246r\261\330\340 \226\313\0Qs"
"\36\17\322\301\223+\313\245\362\260\301\201\62^\67\370.\235\10'\262\231d*\246\223h\5Qv$\17"
"\322\301\224\12\246R\203\7\251\302Tp\60\10\246\202\251\340`\20L\5S\241\301\367\240T\256*\31\1"
"Q\205\42\15\326\301\26.\33<P\245T)UJ\224\10\211\42\31M(\42\211%\24\271\204\326\62!"
"M\0Q\214*\357\321\301\63\210\14R\221V\221V\221V\221V\221&\203o\42\255\42\255\42\255\42\255"
"\42\255\42\211L(\242h\223\312d\0Q\372!\15\326\301\26\316\205JB%\241\222P\311\340@\27\312"
"\205c\251\224*\245J\251R\203\7\342\0Q\373\30\17\322\301\27\257\34\34(\343u\203\357\342\311P\377"
"\243\301\201<\2R\6$\17\322\301\31\315DC\301T\256*\231\311&\42\203\201&\25J\206\222\241`"
"*\230\312\305\212\22\261\62\0R\7)\16\322\301\223\256\31\14\62\251LU&\63\210d\6\252LU\246"
"*SRS\221\251\321\204\62\241\272T,\223\210\245\42\0R @\17\322\301\236\30$\6\241D$\21"
"\11%\42\211HEI\42RQ\222\210T\224$\42\25\203\27M\22\221\212\222D\244\242$\21\251(I"
"D*J\22\221P\42\241\210\204D\211\222D(\23J\0R\60/\16\322\301=\70\10\25fb\221\232"
"\222D*\22\31\34$\42\241L\42\22JEB\251Hb\60\210\24\245\42\241`h \32\314\22\245\11"
"\0R\66\60\16\322\301\225\213\324E\352\42\203A\42\222\310\204\42\251Pd\360$\25\212\244B\221\310`"
"\220\210t\21\351\42R\242\10E*R-R\261\4\0R\67\70\17\322\301\36\31\14D\221X(\22\13"
"E\6\3E\244&\24\251\11EjB\221\310`\240\210$J*\42\211\222\212H\242\244\42\42\211(B"
"\231H\42\25K%b\25\0RM-\17\322\301\223+\313\245B\203\357!\3U(\23)\312D\212\6"
"\222\242L\244(\23)\32H\212\62\251P&\25J\324$B\221T\6Rj(\17\322\301\224\12\15\276"
"\207\14T\241L\244h )\312D\212\6\222\242L*\24\21\351\61\203w\261\272TEH\27\2R\241"
"\42\17\322\301\25O\17\6\62U,\22\321\232\350$\31\243\324fp\31\12\246\202\251\134\254(\21\253\2"
"R\250/\16\322\301\231N\15\64\351\354`\220\314\14\6\222L$\226\211\304\62\221T(\21\311\204\22\231"
"Hh\60H\244\22\231D*\226I\304R\21\0SC\22\17\322\301\233\35\210\6\363\356\6\337\305\373\35"
"\0SU\35\17\322\301\223\253Jfr\203\3Q\37\15\16D}\64\70P\306s\203\357\342u\0SZ"
"-\17\322\301\22K\244b\221Pbp \211\345\42\203\213\301\246\311\340&\222i\62\270\211dZ\206\22"
"\203\3I&\25\352I\42\24\314\0Sa\32\17\322\301\26\217\17\6\301x\341\340\263xI\66\23\15%"
"S\301x!\0Sp#\355\325\301\244\33d\6\203XH\26\222\205\6\203DH\26\222\205d!YH"
"\262h\61\212$\303U\0S\273\30\17\322\301\27\257\34\34(\343\355\6\237\305\323U\271\252\301\201<\2"
"S\314,\317\321\301p\61\30\304\42\241H&\22\212d\42\241L\42S\224\310TU\304R\211T\42\25"
"K\244j*B\231H&\22K\345\12S\321#\16\326\301\226\314TeB\231\312\301\263pz\60P%"
"R%\241\232\252P\42\25K\305\22I\215h'S\326,\357\321\301\360\60\223\30lJ\62\231\201$\323"
"$\323$\223\31H\62]\204\62\25\241\310 Q\62P\204\272\314$\202\221L.\221\12S\343\15\253\371"
"\301\360\245\377r\360 \31S\352\36\355\325\301\62\70\312\205r\241\134(\27\312\205r\241\301Q.\217I"
"\305\212\202\221\250\66S\357\37\356\325\301\360\201\64\235\32hR\231\252LU\246*S\225\251\32hR\231"
"\352\332D\70\4S\360\37\15\326\301\25\316V\325e\222\211\301\203D\64\17x\224\13\345B\271P.\64"
"\70\312E\0S\367\33\357\321\301\63\70\313\305r\261\134lp\217\31|\224\216\17\316\333&\322)\0S"
"\370%\354\325\301\61\70\320f\7\7\212l\311`\23\11e\42\241L$\224\211\204\62\221\301&\22\312$"
"\23\321\4\0T\14\42\354\331\301\360A\324b\60PHM\6\23I(\42\11E$\241\210d\60\221\204"
"\42RaB\231\0T\16#\17\322\301\233\35\250\6\322x|\360&\336b\60P%b\241H,\24\211"
"e\312\42\241\301@\27\213\0T')\316\365\301\65\30D\6\211H\27\221.\42]D\272\210t\61\30"
"D*R\221\212\340 \21\214$r\251\134*\27\33\14\4T\214)\16\322\301\25\36\16\322\241\201\250f"
"p\221\11\325dD\231\314\246$Q\222\211$J\62\211H(\243\11\15D\65\241t\22T\315\63\15\326"
"\301\30\16\15\62\251Hbp\222\210I\22\61I\42\61HH\22%\11I\242$!I\224$\6\212\222"
"\204$\221\30$R\261T,\25J\244*\0U.)\16\322\301\24\211f\222\203\203L(\67\70\220$"
"B\251\310\340 T\70\70\320C\6\7\241`(\30\12\206\6\7\241`\2UF*\15\326\301\225\216\15"
"\36dR\271Ljp IFj\42\25\251DD\61PHj\42m\42%\3Ie$\227\210\4#"
"\0Vh+\357\321\301\62\220\14\64%\231&\231\314@\62\20F\262\231\314\340\263DT#\323I\264\222"
"\201d\240)\311\64\311d\6\222\201\2V\336 \313\371\301\360\245\311@\42\311D$\231\210$\23\221d"
"\42\222LD\62\220(\225\203\7\311\0V\340#\355\325\301\360\201V\225R\245T)\305\340B\225\22%"
"B\242HF\23\212Hb\11E.\241\35|\33V\375!\355\325\301\360\201\326bp\241J\251R\222\301"
" \242J\251\22\31U$\242\30\134h\265\203o\3V\376$\355\325\301\360\201(&\212i\6\23\233\214"
"\42\222\10\251R\32\205f\240\32\210T\262\220F\246\22\15\276\15W(\42\17\322\301\26O'\7\37\305"
"C\301TN\25K$\6\27\221T\60\25L\5S\301Tp\360&\13W\60\63\357\361\301\23\313\305r"
"\261\134&\222\313D\22\212\301\42\242\10e\22\222Pd\21\11e\42E\231\210\42\224\211$R\213Hf"
"\20\212d\22\251Xp\60\10W>\61\17\322\301\23O\14\6\252L(\225)\313\324\14\26\221\134&\62"
"\10eR\241L*\24IdR\203D&\262\211$B\231P\62\223\310e\12U\2W@,\357\361\301"
"\23\313\305r\261\134&\222\313DB\203E$\227\211\14B\231H.\23\311e\42\271L$\267\210\204F"
"\221TIrp\20W[\42\357\361\301\23\257\31\14B\361\354`\34\31\334\304r\261\134*\230\12N\62"
"\221Q*\22\32\334\305\2W\203'\357\361\301\23J\246\202\251`<\62\30(\6\343`*\23JeB"
"\251P$\26\212\304&\65\253D*\230\34\34\4W\337\62\17\322\301\22Ld\202\221\302Tdp\20\11"
"f\6\262Tf\220\210\324D\22\221\232H\42R\23I\324d\6\211\232]d\265h\263Q\304\62\21e"
"(X\231\60\17\322\301\22\313\305r\221\301M,\227\211\224\14$\211\252\310\340 \22\317\14\6\241L*"
"\224I,B\213N\66\211E&\224\12\16\6\301T\4X\363\42\17\322\301\27\17\16\36\4\343\321\301="
"h\360@\21\26\247\6\203`*\230\312\305\62\221\134f\71\10Y\7#\17\322\301\25O\17\6\62UJ"
"\222\311.\67\227\233\301Y\246,S\66\70\313\224e\312\6g\271\14\0Y\15\42\17\322\301\23\217\17\16"
"\64\351\304\340&\222\213\15\316r\261\301az\60\220\251R\222Lv\271\271\34Y\32!\14\326\301\225\215"
"\16\6\241Tf\224\213$\25\61Ih\63X\325\250\42\222L\60\221\324\315\226\0Y'\32\17\322\301\27"
"\357n\360]<\235\10'\262\231h&\231\312U%#Z\1Y)\33\357\321\301\62\70P\306\333\15\276"
"K'\302\211l&\232I\246rU\311\210VY\64 \17\322\301\30\217f\262\221`\244\62\224\14\305c"
"\203\357\342\211l&\231\312\25)\23\332\4\0Y\71\36\17\322\301\27/\34<\10F\63u\221\332\334\340"
"\273t\42\234\310f\222\251\230N\242\25Yy\67\357\361\301\23\313\305r\261\134&\22\32,\42\11M$"
"\21Qd\42\211\204$\23\31$\42\231H\42\322\23E&\21\251He\42\231H\42R\223\310$b\242"
"\310`\20Y})\17\322\301\23\17\15F\311P\60\62X\225\204b\221P,\222\30\14$E\251H*"
"\226H\345b\25\251\232P\223D:\5Y\202*\16\322\301\223n\65x\222\211d\42\231H&\222\211d"
"\42\231D(\222\211\324\264\310\24\325TdJ\62\221\201\42\24\311\250\1[P\23\357\321\301\61x\335X"
"\235\33|\27\357q\42\35\4[W\32\17\322\301\226\7\4\7\17\24aqh\60P\267\33|\27o\234"
"H\7\1[X&\17\322\301\25O\16>\212\247#\203A*\227\222\245\22\251\222\304\340 \223\12\246\202"
"\251`*\230I\4C\61\0[f\37\17\322\301\222I\325\204R\231\352\324\340\201\42,\16\15\6\352\260"
"l\360]\274\70\221\16\2[\232#\17\322\301\226\7\4\7\17\24aq\36\63\70P\306\243\231hf\260"
"\312D\63\311D$\230\31\34\310\1[\235\35\357\361\301\226\7\4\7\17\24aq\36\62x\20\214W\16"
"\16\224\361H\66\223\31|[\236$\17\322\301\226\7\4\7\17\24aMQ,\222\215$C\321L\64\23"
"\33|\227\310f\222\251\230.#M\0[\242\42\17\322\301\226\7\4\7\17\24aM\60\65\30\310Zh"
"\262\313\315\345fp\226\213\345b\203\263\134\6[\244\37\357\361\301\226\7\4\7\17\24aqfp\240K"
"\247r\203\323L\64\71\70P\306s\203\17[\266'\17\322\301\226\7\4\7\17\24aqd\360 \27V"
"\204\62\33I\62Q(\221m\24IED\245\11\15\64\211t\16[\275(\17\322\301\226\7\4\7\17\24"
"aQ\246fp\240\313\344\201\203\263\134,S\226)\213$\42\301H*\243I\15b\203\1[\371%\16"
"\326\301\232\256\31\214\202\211\301 \25*IUD\312B\211X(\221J\244JB\65\241L\62\233\10\207"
"\0\134\17\36\17\322\301\27\357\64S\226\11\245\62\251L(\225\11\305\22\251\230\254.\36N\244\203\0\134"
"\61\62\17\322\301\22\13\246\22\231\301 R\33\311\306\6\212\301@\221\251\10e*B\231\212\320@\223\210"
"\205\42\241DIM\244\42R\323$Q\23\232d\202\0\134@%\356\321\301\62\70\320$\63\311\314\340@"
"\223N\17\236D#\221\301\244Q\244Q$\221\31L\22Ye\42\34\1\134O'\356\321\301\62\70\320$"
"\63\311\314\340@\23I\205\62U\211\301M\253L\325\340I\246\250&\224\11eBu\251\14\0\134^)"
"\356\321\301\62x\22\215\14\236\244\23\203\233T.\61\270IdZ\14nR\271\301\213\242H\242\305`\220"
"\220\344\22\231`\2^\26*\16\326\301\22\353\321@TQ\64X\24U\24U\24UT\14\6\211\256\22"
"]%\22\213T\246*S\225\311\14\6\231\252\4\0^&'\17\322\301\24)\214T\15\36\244\42\205\221"
"z\324\340\201\42\25\223\245B\203\263LY\246,\223(\313D\262\361\34\0^U'\17\322\301\225\211\15"
"\36\304\62\301\301Y.\66\70\313\305\6\207\311\301\67\255\6\7\22E\246BSQ\226\211ds\0^t"
"\35\17\322\301\23\217\17\16\64\251`*\27K\16\16R\241d(\31\212\15>\214w\6^{(\16\322"
"\301\224\16g\6\203L\62\222\211%B\261\301 \227\312\205\202\231d\244.\21\212\15\6\262D(\26M"
"\204#\0^\217&\17\322\301\227\7\4\7\17\42\361\314`\20\12\246*bu\211\301\201$\26\212\304\62"
"eu\261\134*\226H\307\0^\224'\357\361\301\227\7\4\7\17\42\361\242T&\221\11e\42E\231H"
"&\22\312D\212\62\241T&T\230\312\245\42\203\7^\227*\17\322\301\227\7\4\7\17\42\251`*\230"
"\12\246\6\233T\60\25\214\14\6\242H,\24\211e\312\62e\221\320`\240\213E\0^\246&\17\322\301"
"\227\7\4\7\17\42\231\262L\331\340M\263LYf \213'\6\3U$\25\252I\245V!\215j\67"
"_\0\42\357\321\301\61x\220*L\5S\301T\60\25\32|\224\12\246\202\251`*\27\313\305\352R\301"
"\20\0_\17%\17\322\301\31\311f\242\231hj\360e<\67\220$C\311P\62\25LeB\203L$"
"\61\310%\42Qy\0_\25$\14\326\301;\30\210b\241X(\26J\14F\211d\42)\35\14D\261"
"P,\24\13\305B\231D*\24\13_S\33\14\326\301VT\222\11e\42\231P\244\60\65x\333bp"
"\240\255\35<\310\6_U!\357\321\301\62\70\210\227\15\316k\6\337%CU\31I\60\221\20F\312\64"
"\31\211&\221\222\5\1_\227\60\17\322\301\24O\14\6\251H*\224\31\14\62\221D*\226\30\14Ri"
"\311` I\344\62\221\304\340 \223\213EB\261LY.\226J\304\212\0_\256\70\17\322\301S\224J"
"\64\11E\22%\231\212\66\221\304@\61\310\304\42\231`\42\242\30,:Ld\42\203H\42\23i\221\211"
"T\24E\42\222P\244E&\21Kdd\231\0_\303\42\317\361\301\226\7\344\1\361l<\26\212\344\62"
"\221\134&\22Ld\202\211L*\42J\5S\311\301\6`\0+\17\322\301\23\257\30\34db\71UE"
"M,\221\212%B\212L$\223\210\244\42\65\241D&\224I\5S\301T\60\25L\245\0`'-\17"
"\322\301\23\313\305r\231H.\23\311I\6\203H\242I*\21\311\244\22\261P$\226\313\14\6\241X."
"\226\213\345b\271\310\340&\13`\363+\357\361\301\24\317\14d\231\232\301\42\23\313\14T\232\252\311@\224"
"hS\222)\313\14\224\331L(R\23\251\210\304\42\242\301 \3b\17-\16\326\301\231Nd#\211\301"
"&\22\313$\63\3E$\61\210%B\221P*\22J%B\211P\42\24\11\325d$\272H\42\27\222"
"\25b\20*\17\322\301\231\10G\262\271\301\203H,\27\313\305\62\231\201$\323$\323E(S\21\312\204"
"\42\25\65\222D\246$Q\26\232\25b\21.\17\322\301\225IN\22\241A(\22\13Eb\241\324\340\243"
"\312P&\225\210dR\232H\312H\221\312\204*\42\241LE$\221Pi\242\1b\64\63\17\322\301\224"
"J\15\6\221D,\25I\14>M\15\6\221T\244\223\301 \322O\6\203H\42\224\251\310\14\6\231T"
"&\24\31\34$\232d\42\31EJ\25b@-\17\322\301\226\312m\236\245\202\251\340@\21\314$\6\203"
"H&\221\11e\22\231\320@\221\11\245\62\241T\246*\224I\205\42\251\272X\4bK\30\17\322\301\233"
"\35\210\6\363\312\301\201\62^\67\370.\336\70\221\16\2bS%\17\322\301\23/\31\334\304B\203Q."
"\226\213\345\22\241\234*&\13)b\271X.\226\213\245\22\241D\254\12bk'\16\322\301\223.\31\14"
"\64\311\301 \227If\222\231Db\60\310\10#\312E\62\223\314$\63\221\301@Q\31\311\2b\204-"
"\17\322\301\23\313\305r\261\134(Q\62\230$\42\241\212L\223LEIN\221\211dd\221\204\42\226H"
"\5S\271XU\42\244\313\350\0b\244*\17\322\301\223\12\306r\261\134f\360@\21\313\224e\312\62\211"
"\304`\240\221\304\42\232\234\42\23\315D#\331H\62Q\233\210\2b\245\70\17\322\301\23\317\14\6\241L"
"*\224I%\6\213L\42\224\11\245\62\321Db\60\10I\22\231\214&\221I(\62\221D*\23I\244"
"\62e\231H\42\223\310$\62E\252\0b\322.\17\322\301\23\317\14\6\232\322Ln\260\210f\6\203P"
"&\25JT\205$\251\214&\225Pd\6\203P&\232\211f\202\211\314` \11\3c\11.\17\322\301"
"\223\12\306r\261\134d\360@\221\313$\62E\251\240bp\42\312D\24\241L*\23J\205\24\261\272T"
"\42\224\10eB\31U\2cn\71\20\322\301\223\31\14D\231X(\23K\14\6\262Pf\60\20E\64"
"\271DMN\62\270i\246\251Jd\6\3E\244\42\25\212$R\241D$\25I\224\244\62\211\314`\220"
"\0c\211\60\17\322\301\23\313\305r\261\201&\26\32,\6\203P&\25J$\6\203\220$\225\321\14\6"
"\11E&R\24\313E\6\67\261\134,\225\210\325\205\0c\245/\17\322\301\23J\246\202\221\301@\224\35"
",B\251P$\226\30\34dRAQN\61x\21\312\244\62\241T(\22K\251\22\31\211(\42K\0"
"c\317\64\17\322\301\23\312\244B\231Tdp\23\312D\6\223L*\236\31\14B\211\222\42I\33M\244"
"B\221\31\14B\231HQ&R\224\211\264\310\14\6\231P*\1c\322\60\17\322\301\222\14\345\6\231\310"
"@\27K\15D\271\304\340@\22\313%\42\211\234B\222\70\311\64\311\64Y$\66\221L\223LE\311\340"
"$\223K\0d\34\65\17\322\301\23J\344\62\221\204(\23)\312D*\6\13EB\224\211\24e\42E"
"\211\304`\20R\305\64\203AB\21\312\244*bu\251D(\21\312\204\62*\1dD\71\17\322\301\23"
"\217\14\6\242L(\225\31L\6\213P*\63XeB\233\304`\240\322\205\24\203\304 \241\10%\42\241"
"H\242$\224\211$R\221D$\224(I\24%B\31\1dx.\17\322\301\323,S\226\30\34ej"
"\6\343\310`\220\212\244*\6\3\225\42\25\222\14\6\21E*\230\30\34U\344\62E\211H*\24\311\11"
"d\255\66\17\322\301\22\33\204\42\3]&RTQ\63P\14\6\232P\242*\23)J\350$\222\301 "
"\262\211\24e\42E\231\301 \224\211\24e\42-\62\203A&\224\212\0d\316\60\17\322\301R\24\32\14"
"$\261Hf\260\30,\64\211T&\221\31$B%\211L\42\63H$\64\252Pn\60\10'\7\7\312"
"\340\340A\60\255\3e\66\60\16\326\301\23\12\206R\221P*\222\211E\62\203\201\244(RQ\23\251)"
"\251)I\210\22\31E(\221\211\244r\241D,S\25I\205\22\271\0ep\61\17\322\301\224*i\226"
"\250\11\246\6\17\22\231\212\222L\244E&\221\251\210\204b\211\310`\220I\204\62\241\216$\241DJ\225"
"\10)\62\25\242D*e\207\37\17\322\301\226\7\304s\203or\261\134U\60\225\314d\23\351\212l&"
"\231\212\351$Z\1e\260\62\17\322\301\223\7\4#\203Ab\220\315e\42\301D&\65\30(\6\243\222"
"X(\222\31\14\22\221X(\22J\224\324D*\42\65\215\22\231\252L(\2e\271\37\17\322\301\226\7"
"\304s\203\257\342\345\203A\60\25L\5S\271X.V\227\252H\345R\0e\340\37\356\321\301\62\70\10"
"\246\33\16\36\244\42\321H\64\222\314$\63\301PI*\224\310\15\326\0e\366+\16\326\301\233\216\14d"
"\221L,\222I\14nb\221L,\62\220E\62\221L$SRSR\23\213\14d\221L,\233\10g"
"\0f/%\17\322\301\63\70\313\305r\261\301Y.\226\213\15\356\61\203\357\242\231hf\260\312$\23\221"
"`&\221K\15\16f>$\317\361\301\63\70\313\305r\261\301Y.\226\213\15\16\63\261L'\231\242D"
"&\222Jd\22\301Lj\360\1fz)\16\322\301\222\36H\6\212H(\23\252\31\134d*\62%\231"
"\310@\221\7\274\312\245r\251\301U.\225K\15\256r\21\0g\11&\17\322\301\26\17\16\276\212\247\7"
"\3],&K%\6\3Q$\226)\313\15\6\272X.\226\13%r\251\20\0g,\37\17\322\301\27"
"o\70x\220\333&J\23\225\221\272LU\250&\62\30D\22\261\272x\35\0g:-\17\322\301\23\317"
"\14d\231\262L\315`\221\211e\252\64U\223L(\321&\224hS\222)\313\224d\232d\42\241H&"
"\222\332$\222\0ge!\17\322\301\27/\34<\10F\63u\221L.R\64\370l\233\250\214\224i\62"
"\22UJ\27\317\1g\177\63\17\322\301\23L\345F\231A.\223\33,\242\231\301 \243Id\62\223D"
"&\222\350&\222h\222\210\324D\22\251LY\246,\222I\244\42\65\241D$\25g\234#\357\321\301\63"
"\70\313\224e\312\6g\231\262L\331\340,S\232\33|\225\250\214\224i\62\22UJ\227\3h\7*\17"
"\322\301\23\317\14\6\241xv\60\216\14Nd\261UE\223D&\321\244\42R\23\11E\62-B\231\262"
"\134(\221K\245\0h\17\42\17\322\301\23\317\204R\241L*\24\311\14\306\221\301\211z\233(MT\14"
"\6\211H\274\223\301M\26h\67)\17\322\301S\25\352M*;P\14nb\61Yl\62\30D\22E"
"\251D,\24\211\14nb\271X.\226\213\345b!\0h<\62\17\322\301\23J\206\222\241\201*\23\212"
"\14\24\232X\42\222\210\251r\233D*\321F\223\210\304&\211\304`\225\11\245\62\241T&\224\312\14V"
"\231P\4hL%\17\322\301\27\217\17\6\301\350\340 \25L\15\16R\301\324\340 \231\33|\225\250\214"
"\224i\62\22UJ\227\3hc.\16\322\301\23\253\211\324\204\22\221L(\21\31\14\42\211\242XJ\62"
"\30H\206\211v\211JIf\60\310$\63\311L\62\23\31\14\64\311\0i\375\71\17\322\301\23\212\304B"
"\221Xbp\220\11E\62\3\305` \212$\42\211\214d\60\320,J\22\221Dbp\222\310F\62\203"
"U&\224\312\14V\231P*\63XeB\21\0kL\70\17\322\301\32\32\14$\321Lj\220\210\14\26"
"\221D$\224\30$\212\302\231\301@\223\14\205\6\211PI\42\223\310D\22\231Df\220\310$\202\221L"
"*\21\311\304\42\251\0k{)\356\321\301\360\201&\24\14\5C\65\203D\246E$\224I\24%\42\11"
"QF\22\215$\63\241\232P&T\22\33(\302\0k\322$\17\322\301\227\34\34(\243\203\323\340\340A"
"\36\64\70\213\204b\231\232\301'\231P*\224I\15\36\207E\0l`\60\357\361\301\231\213\5#\205\221"
"\12I*\242\310\204\22\222L\42\242\210\244\6\221\252H\243L\244d\23I\210\62\221P$\223\213dr"
"\221\320` l\241#\357\321\301\22\32\310\62e\231f\231P\27e\33ud\60\10eR\221Q\67\251"
"\212X]H\241[\15l\325'\17\322\301\231\213\5S\301T\321\340$\27\313\5S\301\301\223Xj\25"
"\14%\63\241T$\26J\14\16b\271\4\0l\350#\357\361\301X\26\214'\6\27\301X.\226\13\246"
"\202\221\301@\23K\315r\261\134,\27\313%\6\7\2mO\65\16\322\301V\221*\11\245\42\211\301 "
"\22\214$D\221\212\242D$\321$\21IdZDB\231\304 \223\210$\42\231D$\21\251)I\204"
"\62\21]\42\234\0mj.\17\322\301X\26\214\14\6\251H*\222\252\11\15\6\231H\42\25K\244J"
"\6\203T\244j\23\311t\21\312\204R\231D&\224Q\311\202\0m\210\60\15\322\301\231\312Dj*\42"
"\231\212\206\241\320`\220\210$R\241D*\23\31\14\62\221\324 \223\212d\6\203H&\25\311\244\42\231"
"\212X(\1m\330\60\16\322\301\27\14%\63\203A&\22\23%R\211\324 \222\10%B\231PMb"
"\60HDR\241A&QR\223(\251\31HJ#\271D\70\2n\70\66\17\322\301\26J\205\62\261L"
"Yb\220\30\254\62\251P$\26Z\14B\221D\250$\221\11e\22\231\310&\221\30H\62\211L(R"
"\23\212\324\204\22\21EU.\3n\220\66\357\321\301\22\31\34d\22\241\134\42\223\12%\6\203H&\221"
"\212d\22\203A(Q\25J$\6\203L$\21\251\230\204b\221\212\242D\244M\242\246D\224H\247\0"
"n\321\62\357\321\301\222\31\14R\221T\311 R\25\251\211\14\16\24\221d&\62\30\244\42\251Pf\60"
"\210lR\241\314`\20\312\244B\231T(S\21\14e\0pk\42\17\322\301\27/\315\204R\231P*"
"S\25\212\304B\301P\42\234\310f\242\231d*W\225\214h\5po'\17\322\301\23/\31\334\304R"
"\211\242TBU\21\13Eb\271X.\226\213U\244b\221P*\23J\305\22\241`\12p\271!\16\322"
"\301\226\256\36\14d\351\344\340 \24\14\5C\301\320\340 \217\211\324\64\311$B\221\214\70q\66.\17"
"\322\301\23\313\305\22\251A&\222i&\31\134D\22\231P\42\222I\304\22\231D.S\25\312\204\252\42"
"\241\134\36\21\311\364E(S\1rG!\15\326\301\30K\305R\261T,\25\33\34H\302\305\203\201*"
"\226\212\245b\241\134(\227\11f\0rY \356\325\301\61x\231\316\245r\251X\331\340A,\21\215$"
"\63\301P.\225\222e\23\341\30\0ri\60\16\322\301\23\12\206b\211P,\21\32,\6\212>\251H"
"HR\211\232P$\221\231T\14\64\221\212\222L$\223\312Te\212jJ\22\241\134\4ry/\17\322"
"\301\23\313\305R\211X*\221\31\14\42\3Q*\21\13E\42\203\233`j\26\31d\6\3Ea*\224"
"I\225\244\202\251X\42\225\313\0s\251'\317\321\301p\61\30\204\342M\6\27\3IY(\22\13Eb"
"\241H,\24\211-\62\221A(\23I\204R\253$\0s\260\60\357\321\301\67\30$\6\213T(\223\12"
"e\42E\231HQ&R\62PD\212\62\221\242L\242Q*\21\13Eb\223\232Q&\222\10\225\244b"
"\3t\6,\317\361\301\67\30$\6\213HQ&R\224\31\14B\231HQ&R\62P\14\6\241X."
"\226\313\14\6\241Xn\24\332\245B\203\3u\37\34\357\361\301\27\315D\63\321Lr\360&\24L\345b"
"\361\344\340@\31o\67\370\0u('\355\321\301\62\70\220\204JB%\241\222\301\201$T\22*\11\225"
"\14\16$\241\222PI\250\42\25J\244\42\11i\2u\65%\15\332\301\25\256\33\34HB%\241\222P"
"\311\340@\22*\11\225\204J\6\7\222PE*\226\212\305\6\203\0u\305\61\17\322\301\230\7\4\7o"
"\262\221p\42\61\70I\244\202\251\234bp\222\250\251\210$\42\211H(Q\223\310DD\211L$\27\311"
"\244\22E\261\10\0v{,\357\361\301\30\34(\42\311DI&\222\211\244\22\231D.\225K\14\24\251"
"dD\61\270\320\344b\271\330\340.\225\314\304\6\17\22\0v~!\357\321\301\360\273t\355\340@\224\14"
"%C\311\320\340@\224\14%C\311P\62\64\70\20%#\0v\204*\15\326\301\222\212\245\312B\203\311"
"`\224\10\211\22!+Q$\63\30d\42\242LD\24\23\305D\261\301 &\312$\262\21\0v\330)"
"\357\361\301\226\16\17\316\62e\241Hf\360M.\26\11\245B\211\242`lp \212d\42\241H&\22"
"\212d\42\221\301\7w\13'\17\322\301\70\320\14\6\361\344\340@\30\34|\225N\17\256\22\261Pd\60"
"\320\224\345\6\3],\67\30\350b\31\0w\37\42\17\322\301\27\17\16\36\4\243\203\263\134lp\226\213"
"\15\316r\261\301Y.\63\370(\225\253JF\0w@(\17\322\301\224Jfb\203\7\301\344\340@\30"
"\34|\225\36\14d\262Tb\60\320Hb\271\301@\27\313\15\6\272X\6w\355'\17\322\301\22\17\15"
"\6\222A\64\221\215\204\6\243\276\30\14\22\241\242\301(\36\252I\204\62%\231H\246\64\65\70\7x\1"
"-\357\321\301\67\230\14f\251`*\224\11\245\62\241A$\223\221D\6\203\204$\250\210\4#\205\221\212"
"\301\42\62\10F\12#\301D:\2xl\64\357\321\301\67x \312\305r\231\301 \23\212\324\14\22\221"
"\22Ib\60\210H\22\221\212\222D\244&\222\30\14\62\221D$\66\210$b\221L.\225P\212\6x"
"\237\66\17\322\301\30I&\42\231\201\242$\25\31\34D\62\211H\250\42\22\32$\22\203\214$\221\214$"
"\6\3IQ,\62\70PD\62\253A$QTR\246\311(S\0x\301\70\17\322\301\27\212f\42\203"
"P$\25\31\34DB\65\251Pf\22\312(\42\211H\42\222(ID*\22\223M\42\23\312$\42\241"
"\320$TQ\222\210\304\6\211A\62\224\0y:\33\357\321\301\62\70\320s\62\370.\36\315\224eB\255"
"\42\251\230\254*\221\16\2y>'\17\322\301\222+\313\305B\3U\60\225\213\345\42\203\223UEQI"
"\42\224\213\345b\271X.\226K\14\16\62Y\0y\273,\17\322\301\226\7\344\6\337c\22\231D,\62"
"\211%\62\211\330\340\64\70x\20\11\305\42\231&\221\301 R\23\212T&\42\321\10\0y\315#\16\322"
"\301\224\212\215\62\203X\67\203\7\211HMI\211&R\62i\321b\60Ht\22\221\304\372\67\0y\373"
",\17\322\301\224\312\215B\203\324@\324M\42\22\31\214de\252Hh\42\11%\212\6\212\66!IF"
"\21\11\345T\271XJ\227\221\1z\13\60\357\321\301\244\30\14\22\203L*\224I\205\62\251\304`\61\30"
"\204\322cEb\60\210$\212R\211X(\222\31\14B\261\134,\27\313%\6\7\1z\227.\17\322\301"
"\226\7\4\7\17\24\221TFR\224\210e\7\7\242L*\224\31DB\221L$\224h\23\352&\221\11"
"Eb\241\301\201(\31\1{\24)\17\322\301\223\12\246r\203\305`\21\311D\62\241D(:\20\15\346"
"\361\301h\60\217\17\6\221\301 \226\213\345b\301\301 {R\65\17\322\301\223\12\246r\203\305`\222\310"
"DB\231D(\222\30\34\210\222\241\304`\220\10%C\221\201$\24\311DB\221L$\24\31HB\311"
"P.\21\12f\0{~+\357\361\301\223\12\246r\203\305`\222\310DB\231D(\222Jd\63\311T"
"L\61PH\264\262P,S\27)\14\305\6\17\22\0{\200\67\17\322\301\22\313\15\26\203E$\23\311"
"\204\22\241T\36\220\30\14B\311Pd \11E\62\221P$\23\11E\6\222P$\23\11E\62\221P"
"d \11%CA\11\0{\227*\17\322\301\22\313\15$\203E$\23\311\344\21\203\3Q\62\64\70\20"
"%C\203\3Q\62\64\70\220\245B\203\217R\271X]\10{\261\64\17\322\301\223\12\246r\203\305`\222"
"\310DB\231D(\222\211g\6\223\301\42\224\312\204B\232\301h\22\312$\32e\22\25\203IM(\221"
")Je\6\13\0|\230\63\17\322\301\23\313\305B\221D(\225(J%T\3M,\64\30\305d\261"
"\311`\20I\264\212$Z%\42\231T(\223\12eR\241\314`\20\312\244\22\0|\373\42\15\326\301\67"
"\220\14\246\331T\253\301 \33\25\205t\211\301\203X*\23\251\312\64\252\310$Ru\0} %\17\322"
"\301\227\34\34(\243\203\323\334\340\263t(\67\30\204\265\242\324\340@\31Je\42\261H\42\23\252\212\0"
"}\42'\17\322\301\27O\16\16\224\361\340\340\201\42\224\23\225\204\6\203\260V\224\32\34(C\251L$"
"\26IdBU\21\0~\277\61\17\322\301\223J\304R\221P,\27\311$&\231\304 \64\20\5S\211"
"A$\63P\345\62\211\301&\222\11\252\63\231M\42\62He\22E*y\0~\317(\357\361\301\23\317"
"\14\6\231d(\222\12eB\232\201(\222\12\325dd\211\364`\61\30D\202\361\334(\264K\205\6\7"
"~\334-\17\322\301\23J\206\202\251\201\250M$\241\311\14&\211\134*\227J\244j$\3EL\221I"
"\14\226\241\224$\24\31\325\244\6\313P\4~\335.\357\361\301\23J\206\202\251\201\250M$\21\312\14\22"
"\211\301 \224\211\324\204\42\255\42\25\3\311`\20I\305\243\222\330 \24K\304\6\203\0~\337.\17\322"
"\301\223\12\306\352b\231\301E$\224\32h\252\62\251Lfp\21\213D\6\233H(\26\311Fb\222L"
"d\20\312D\22\241\324*\11\177\26\60\16\322\301\23\12\246b\231\301@\222\211%\42\211\330`\61\30h"
"\42\311L\60\64x\220Pt\244h\225\30\14\62\213\26\203H\242'\25\231\134H\177Q-\355\325\301\360"
"\201\326\250B\21ID\22\222D$\221\320\204\42\232PD\222\210$\22\222D$\221PD\22\221\304("
"\245U&\244\11\0\200\14#\355\325\301\360A,\234\15\16\16$m\42m\42m\42m\42m\42m\42"
"m\42m\42\271D$\30\1\200\63\42\357\321\301\61x\20\312\305r\261\301Y.\226\213\15\316r\261\134"
",\66\320$\6\212\314@\26o\3\200JG\357\321\301p\222\213$\64\203D$\21ID\22\203D$"
"\21ID\22\221D$\21ID\22\221\304 \21ID\22\221D$\21ID\22\11E$\21\31$\22"
"\212\304 \21ITH\62\221\134&\222\213dr\211P\6\200T\61\17\322\301\230\211\14\66\221L$\224"
"\10E\262\203\310`\20\251*I\245\6\251\222\304\340\42\222*\321$B\203P\42#\311\224e\312\42\251"
"\212\134\0\200\375\64\17\322\301\223\312E\62%\241H\311`\240\230&\342\241\304`\22J\204\62\3E("
"\71\230d\42\241HM(\62\32Lb\241H(\21IDB\211Lh \201\21\66\17\322\301\31\33\244"
"JR%\203\3E$;\310F\62\221P$\21I\224Td\42\221A\42\23i\21I\224T\224$\42"
"\25\261HE,R\61\30(\42\302\4\0\201\352\27\11\336\301\224+\33\34\344\354\6\7:\335\340@g"
"\67\70\320\5\202\202!\17\322\301\224\12\246B\203\217R\301T\36\65x\230\12\246\202\251`*\30I$"
"\63\321x!\0\202\371\37\17\322\301\224\12\246B\203\217Ry\324\340A\60\232\251\213dr\221\332\334\340"
"\273x;\0\203\334%\17\322\301\224\12\246B\203\217Ry@v \32L\63u\251lp\360 \226\250"
"\214\224i\62\22UJ\227\3\204\335+\357\361\301\224\12\246B\203\217R\311H\60R\30\211\14\66\221\212"
"X$\221\311\243\6\7\242H&\22\212d\42\241H&\22\31|\205\317\66\17\322\301\225I\15\276\312D"
"\302\221\320\340EY*\221\30$R\213\222\242\304 \21I\14\22\221DM\42\61H\324$\332\224$j"
"\42%\203D\223XF\21K\5\210L$\17\322\301\24\217\14\6\241tI<\35\31\234\310R\211X("
"\22\313\305r\261\134,\27\313\205\22\271T\12\210h#\17\322\301\27\17\16\36\4\343\311\301\201\62\236\33"
"|\225\310f\252D\211T\42\25\222\324\310\22\61\221\22\211\201$\355\325\301\360A(\23\314\244\6\7\222"
"\232H\233Hdp \313\15\36\204\312B\261It)\331\354\22\0\211\306\61\17\322\301\222\7d\6\203"
"P&\225\30HR%\215\62\221\242L\244f\322E\223\212H\242G\251D,\24\211\205\42\261LI&"
"\22\212d\22\261\1\211\310*\15\326\301\224IE\62\251Hf\240\210\264\211$B\251\350\340(\27\312\24"
"e\212\62E\221D$\227HFB\21Mh\66\20\211\343\64\17\322\301\23\17\15\66\203P$\23\11E"
"\32%Z\14\24\231P\242(\225(I\244\6\222\201&\321$\225(J\15\24\203A$QT\222\10u"
"\23\22e\0\211\346\65\17\322\301\222\213\345R\203TId\60HD\62\221\222\201\42\322\242I\213&%"
"\3\305`\20I\64iQ\224\32\210\22\231DQ\244\42\61\70Hd\22\61\215\22\213\241#\17\322\301\231"
"\213\5S\301T\274j\220\30\34dR\301T\60\25L\5S\301D&(\12\246\342)\0\213\260$\317"
"\361\301\222\7d\6\253`\274d\20Le\6\253L(\225\211f\242\231h\242,#\211eB\203A\0"
"\213\272(\357\361\301\231\213\5C\211\134(\221\315$S\221A\42\247i\226\211\344\62\211`F\231\211&"
"\252B\222T(\64X\0\213\276)\357\321\301\22\32\310\62e\231\322L\62\65\30$\302\221\301 \225\11"
"\245\62e\241H,\21I\344D\301P\42\252\221\351\4\213\304&\357\321\301\222\31\14R\205\251l\244\62"
"\21\211\14\62\211\262T\60\61\70\310\244\202\251`\42\23\24\5S\361*\0\213\335+\17\322\301\34\312\15"
"B\231A.\26\217\16\36\304r\261\134,\227\31\14B\231T(\223\12%\252B\222T(\63\30\4S"
"\11\0\213\364*\17\322\301\226\12\265\312\224\225\16\6\301Td\20I\225\244J\6\203T(\221\13%r"
"\211\222\234\244\246$S\225\32\204\242\0\214\67$\17\322\301\224\12\306jB\255\42\241D\66\223L\305t"
"\22\255fp\226\213\345b\271X.\66\70\313e\0\215-\62\16\322\301\30\33Hb\231H,Q\62X"
"t\225\350*Q!\311$\332T\64\11%\232$\42\211n\22\231\314@\21I\304\22\221\272D&\224("
"\215\0\215\64\66\17\322\301\232\32\210R\231P*Q\224J\24\15\24\215R\211\242T\242(\225\250\30\14"
"\42\211V\221D\253P&\225IDR\231H\42\25\311$\6\203D,\225\0\215w,\17\322\301\24\257"
"\31h\6\253X.\226\213\14\6\211\201,S\224\310\4\23\231`b\21\312$\62\241L\42\64\220$\264"
"\221\301s\0\217l*\17\322\301\222\213\345b\271\320`\61\30D\202\251D\252$\62\370&\30Jf\6"
"\203\320.\61\10e*R\211X]Y.\3\217o-\17\322\301\223\12\246\202\251\324`\20\31hR\241"
"L\42\323\244\325`\23L\5C\211\334$\221\31\210\22\241H\246,S\26IU\344\2\217}.\17\322"
"\301\224\12\246\22\231\301 RU\64\370&\226\213E\22\203\201\244&\27i\225\310\14\6\221D\254n\220"
"\211\14V\211\242\32Q&\25\217\221\61\17\322\301\22\17\15FM\6\213P&\65\330$\262\221\304\340\203"
"D(\225\31\254\62\241\324b\60\31dB\231D&\62\320$\6\222T\60\25\214\0\217\307#\357\361\301"
"\233\12\306r\261\304\340 \33\317\14\42\241X\246,S\226\213\345b\251D\254E\66\63\70\10\217\324-"
"\357\361\301\34\312\15B\221A\60\22\217\17\6\212A$\26\212$\62\251HE,\222\311E*b\211H"
"&\225\250\312$\262\231\301A\0\217\330&\317\361\301\222\31\14D\261\134,\35O\15B\212X&\21I"
"EjB\211LQ*\230\12\246r\211lfp\20\217\331&\357\361\301X\26L\5\23\203\343d(\63"
"\310Dr\241D.\25\14%r\231\262H\252\42\26Jd\63\203\203\0\217\333,\357\361\301\30I\225\304"
"B\221Xd\60PF\262\221\314 \24\211%\6\7\231P$\26\212\304\62e\231\262H(\225\310f\6"
"\7\1\220\1+\20\322\301\226\213\244\212D\231X.:\270M\15b\301X\60\61\70\320\304\202\251D."
"\224\211eR\241D]$\223T\15\16\2\220\2)\357\361\301\71\10e\6\301T\60\25\35\34$S\203"
"T\60\62\30\244\42\251\222TI\252d\60HER\241D\66\63\70\10\220S*\357\361\301\226\12\325\304"
"\342\211\301ex\60\210\14\42\251\222\301 \25I\225\14\6\251H\252d\60HER\241D\66\63\70\10"
"\220\243,\356\321\301\61\230\14\64\221\232\222F\221&\203I\42\25i\24i\62\230dJjJj\42\231"
"\210\42S\222\310D\22\221PM:\4\220\256\64\15\326\301\23\16\15\64\241\314`\240\210$\42\25\221D"
"\244\242\244E$\21\251\210$\6\203DFR\221\221Td$\25\212\222\212\222\301 \21J%\302!\0"
"\220\350\63\17\322\301\223\7\244\6\212\301@\221\211F\62\241HQ$\223\210\14\16$\331H\66\23\31L"
"\62\221P$\23\11E\24\231P$\21\32Lb\241H<\4\220\375\66\17\322\301\24\317$\6\212\301\242"
"&\24i\225\310D\22\203\3E,\25\11\305\42\231\301$\223\20E\62\212P$\23\31L\24\231P$"
"\21*\211\15&\261P$\4\221M\65\357\321\301p\20Md\6\242D.\62\30\244\42\211V\221D\253"
"H\242\305@\222H,\62\21Q\42\226J\304\6\203D,\225H\251\22\251\301@\62\30\244\202\0\221w"
"=\17\322\301\233\31\14\42\211T\42\224H%B\3\305`\20Id\22\235d\22\215\62\211\26\203\201\42"
"\61\24\5S\221\201b\60\210d\22\251H&\221\212d\22\203Ad\240HE\62\11\0\221\314\32\317\361"
"\301\62\70\20\365\321\340@\324G\203\3e<\71\70P\306\353\6\37\224\256.\357\361\301\23\317\14F\203"
"L$\24\213dr\221\212A&\222*Ie\6\223\301$\223\12eR\241L*\224I%\42\231\224\246"
"*\62\70\224\376/\357\361\301\22LeB\251I&\25J\14\26\301\324 \225\210$\42\213H\250bp"
" \11\365h\60\220\204ZDB!I\42\23\212d\6\3\225\1\63\17\322\301\23\313e\42\65\203H\42"
"\222I%j\202\241\304 \61\30\204\62\251P&R\61XD\212\62\221\242L\244(\23)Jd\22\61"
"MU&\225+\225.\66\357\361\301\22L\5S\13\305@\23\312$\42\251\301@\61H\204\22m\42\3"
"Md\223\31H\22\3M$\221IE\22\203\201$\23J%\212R\212\312Df\60\10\225\355'\15\326"
"\301\221N\14\216e!YH\61\270\220\205T\42Q\42\244\211\204$\231\220\42\24\22%B\252\224\62!"
"M\0\226\62\64\16\326\301\230\32\210jB%\211\301A$\23K\204b\221L,\222\31,\62\221P\42"
"\23\11%\62\221PB\221\11%jR\211TE(\223\210dR\31\0\226D:\16\326\301\227\211\14$"
"\231H&\222\211\64\212\264\30\14\22\21Q$\242\10EZDj\22\221D$\223\210$\42\231D(\242"
"\210\204\42\211L(\222\12ER\221D$\225\311\0\226d\62\356\325\301\60\10\245\42\241T\42\224\10%"
"\62\65\232T$Q\61PLB\251H(\25I\14\6\12E(\225\310$jB\221\66-R\211L\42"
"\26\3\226\366(\17\322\301\62\70P\6\7\17\24\251\230d\221X\4\243\213\304\62\21\325\310$!\211*"
"\245\31\14\344IIX\17H\1\227b/\357\321\301\360\263x:;\70\20E\62\221P$\23\11E\6"
"\222P$\23\11E\62\221Pd \11E\62\221P$\23\11\15\16D\311\10\0\227\363\42\17\322\301\226"
"\7$\7\7zX*\231I\15\276\307\14\316r\261\134lp\226\213\345b\203\263\134\6\230u#\355\325"
"\301\360A*\33\35\34\345B\231\242LQ\246(S\224)\212$\42\271H\60\224\222E\224\11\0\230\221"
"\61\17\322\301\23\317\14\6\212\262Tb\23Kd\6\203H\42\223J\14\6\222\302HQ&\322\242I\213"
"&-\272I\204\62\211\134\246H\223J\210r\1\237 \60\15\332\301\223\34\15\42\311\310 \63\210$#"
"\311\310\340@\17HD\22\221\26\221D$T\222\210$\42-\42\211\204\250B\21Id\6\31U\0\0"
"";
| 88.217582 | 113 | 0.66895 |
d9dcfa3d33a5ae04991ce1805ff53baf34c7f883 | 4,333 | c | C | drivers/keyboard.c | dolumese/mKernel | 82383566fa8c8ffc6af69bd447fd19050724af47 | [
"MIT"
] | null | null | null | drivers/keyboard.c | dolumese/mKernel | 82383566fa8c8ffc6af69bd447fd19050724af47 | [
"MIT"
] | null | null | null | drivers/keyboard.c | dolumese/mKernel | 82383566fa8c8ffc6af69bd447fd19050724af47 | [
"MIT"
] | null | null | null | #include "keyboard.h"
/* --- Keyboad map initialization --- */
unsigned char kbMap[128] =
{
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */
'9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', /* 19 */
't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', /* Enter key *//* 28 */
0 /* Control */, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 39 */
'\'', '`', 0 /* Left shift */, '\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 49 */
'm', ',', '.', '/', 0 /* Right shift */, '*', 0 /* Alt */, ' ',
0 /* Caps lock */,
0 /* 59 - F1 > */, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* < F10 */,
0 /* 69 - Num lock*/, 0 /* Scroll Lock */, 0 /* Home key */, 0 /* Up Arrow */,
0 /* Page Up */, '-', 0 /* Left Arrow */, 0, 0 /* Right Arrow */, '+',
0 /* 79 - End key*/, 0 /* Down Arrow */, 0 /* Page Down */, 0 /* Insert Key */,
0 /* Delete Key */, 0, 0, 0, 0 /* F11 Key */, 0 /* F12 Key */,
0, /* All other keys are undefined */
};
unsigned char shift_kbMap[128] =
{
0, 27, '!', '@', '#', '$', '%', '^', '&', '*', /* 9 */
'(', ')', '_', '+', '\b', '\t', 'Q', 'W', 'E', 'R', /* 19 */
'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', /* Enter key */
0 /* Control */, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 39 */
'"', '~', 0 /* Left shift */, '|', 'Z', 'X', 'C', 'V', 'B', 'N', /* 49 */
'M', '<', '>', '?', 0 /* Right shift */, '*', 0 /* Alt */, ' ',
0 /* Caps lock */,
0 /* 59 - F1 > */, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* < F10 */,
0 /* 69 - Num lock*/, 0 /* Scroll Lock */, 0 /* Home key */, 0 /* Up Arrow */,
0 /* Page Up */, '-', 0 /* Left Arrow */, 0, 0 /* Right Arrow */, '+',
0 /* 79 - End key*/, 0 /* Down Arrow */, 0 /* Page Down */, 0 /* Insert Key */,
0 /* Delete Key */, 0, 0, 0, 0 /* F11 Key */, 0 /* F12 Key */,
0, /* All other keys are undefined */
};
/* --- Variable initialization --- */
unsigned int currLoc = 0;
unsigned int commandLen = 0;
unsigned int lineNum = 0;
char* vidPtr = (char*) VIDEO_PTR;
char shiftState = 0;
char storedChar = 0;
char runState = 0;
/* --- Function initialization --- */
void kbInit(void)
{
/* 0xFD is 11111101 - enables only IRQ1 (keyboard)*/
wPort(0x21 , 0xFD);
}
char specialKey(const unsigned char keycode)
{
restoreChar();
switch(keycode) {
case BACKSPACE_KEY_CODE: /* clear current character */
if (currLoc > (LINESIZE*lineNum + PROMPT_LEN)) {
vidPtr[--currLoc] = DEFAULT_COLOR;
vidPtr[--currLoc] = ' ';
} break;
case ENTER_KEY_CODE: /* move to new line */
runState = 1;
newline(runState); break;
case UP_KEY_CODE: /* move cursor up */
case DOWN_KEY_CODE: /* move cursor down */
break; /* Don't permit vertical cursor movement */
case LEFT_KEY_CODE: /* move cursor left - up till the prompt */
if (currLoc > (LINESIZE*lineNum + PROMPT_LEN))
currLoc -= BYTES_PER_CHAR;
break;
case RIGHT_KEY_CODE: /* move cursor right - up to the end of the line */
if (currLoc < (LINESIZE*(lineNum+1) - BYTES_PER_CHAR))
currLoc += BYTES_PER_CHAR;
break;
case RSHIFT_KEY_CODE: /* enable shift */
case LSHIFT_KEY_CODE:
shiftState = 1; break;
default:
return 0;
}
return 1;
}
void kbHandlerMain(void)
{
unsigned char kbStatus;
/* write EOI */
wPort(0x20, 0x20);
kbStatus = rPort(KEYBOARD_STATUS_PORT);
/* Lowest bit of status will be set if buffer is not empty */
if (kbStatus & 0x01) {
keycode = rPort(KEYBOARD_DATA_PORT); /* Read the keycode */
if (keycode < 0)
return;
if (specialKey(keycode) == 0) { // keycode is not special
if (shiftState == 0) { // use standard key map
vidPtr[currLoc++] = kbMap[(unsigned char) keycode];
} else { // use shifted key map
vidPtr[currLoc++] = shift_kbMap[(unsigned char) keycode];
shiftState = 0; // reset the shift state
}
vidPtr[currLoc++] = DEFAULT_COLOR;
if (currLoc > LINESIZE*(lineNum+1)) lineNum++; // keep line consistent
// Determine the current length of the command after the prompt
commandLen = (currLoc - (LINESIZE*lineNum + PROMPT_LEN))/2;
}
storedChar = vidPtr[currLoc]; /* store the current char */
showCursor();
}
}
| 34.664 | 82 | 0.493192 |
b8cecec21d8b43003baa5bb2c9506d21cbf30a21 | 7,420 | h | C | simulatorCore/src/meldProcessVMCommands.h | egartner/Multi-robots | 025cc9e0426b9880ae2084d8e1ce8c275cb5f106 | [
"Apache-2.0"
] | 4 | 2016-08-18T03:19:49.000Z | 2020-09-20T03:29:26.000Z | simulatorCore/src/meldProcessVMCommands.h | egartner/Multi-robots | 025cc9e0426b9880ae2084d8e1ce8c275cb5f106 | [
"Apache-2.0"
] | 2 | 2016-08-18T03:25:07.000Z | 2016-08-29T17:51:50.000Z | simulatorCore/src/meldProcessVMCommands.h | egartner/Multi-robots | 025cc9e0426b9880ae2084d8e1ce8c275cb5f106 | [
"Apache-2.0"
] | 3 | 2015-05-14T07:29:55.000Z | 2021-07-18T23:45:36.000Z | /*
* BlinkyBlocksVMCommands.h
*
* Created on: 11 aout 2013
* Author: Andre
*/
#ifndef MELDPROCESSVMCOMMANDS_H_
#define MELDPROCESSVMCOMMANDS_H_
#include "network.h"
#include "color.h"
#define VM_COMMAND_MAX_LENGHT_BYTES 544 // debugger
#define VM_COMMAND_TYPE_SIZE sizeof(commandType)
#define VM_COMMAND_MAX_LENGHT (VM_COMMAND_MAX_LENGHT_BYTES/VM_COMMAND_TYPE_SIZE)
#define VM_COMMAND_SET_ID 1
#define VM_COMMAND_STOP 4
#define VM_COMMAND_ADD_NEIGHBOR 5
#define VM_COMMAND_REMOVE_NEIGHBOR 6
#define VM_COMMAND_TAP 7
#define VM_COMMAND_SET_COLOR 8
#define VM_COMMAND_SEND_MESSAGE 12
#define VM_COMMAND_RECEIVE_MESSAGE 13
#define VM_COMMAND_ACCEL 14
#define VM_COMMAND_SHAKE 15
#define VM_COMMAND_DEBUG 16
#define VM_COMMAND_SET_DETERMINISTIC_MODE 20
#define VM_COMMAND_POLL_START 21
#define VM_COMMAND_END_POLL 22
#define VM_COMMAND_WORK_END 23
#define VM_COMMAND_TIME_INFO 24
typedef uint64_t commandType;
namespace MeldProcess {
//===========================================================================================================
//
// VMCommand (class)
//
//===========================================================================================================
class VMCommand {
protected:
commandType *data;
VMCommand(commandType *d, commandType s, commandType t, commandType src);
public:
VMCommand(commandType *d);
static commandType getType(commandType *d);
static commandType getTimestamp(commandType *d);
commandType getContentSize();
commandType getSize();
commandType getType();
commandType getTimestamp();
commandType getSource();
commandType* getData();
void setTimestamp(commandType ts);
void copyData();
static string getString(commandType t);
};
//===========================================================================================================
//
// SetColorVMCommand (class)
//
//===========================================================================================================
class SetColorVMCommand : public VMCommand {
public:
SetColorVMCommand(commandType *d);
Color getColor();
};
//===========================================================================================================
//
// SendMessageVMCommand (class)
//
//===========================================================================================================
class SendMessageVMCommand : public VMCommand, public Message {
public:
SendMessageVMCommand(commandType *d);
commandType getDestId();
commandType getDestFace();
};
//===========================================================================================================
//
// SetIdVMCommand (class)
//
//===========================================================================================================
class SetIdVMCommand : public VMCommand {
public:
SetIdVMCommand(commandType *d, commandType src);
};
//===========================================================================================================
//
// StopVMCommand (class)
//
//===========================================================================================================
class StopVMCommand : public VMCommand {
public:
StopVMCommand(commandType *d, commandType src);
};
//===========================================================================================================
//
// AddNeighborVMCommand (class)
//
//===========================================================================================================
class AddNeighborVMCommand : public VMCommand {
public:
AddNeighborVMCommand(commandType *d, commandType src, commandType t, commandType f);
};
//===========================================================================================================
//
// RemoveNeighborVMCommand (class)
//
//===========================================================================================================
class RemoveNeighborVMCommand : public VMCommand {
public:
RemoveNeighborVMCommand(commandType *d, commandType src, commandType f);
};
//===========================================================================================================
//
// TapVMCommand (class)
//
//===========================================================================================================
class TapVMCommand : public VMCommand {
public:
TapVMCommand(commandType *d, commandType src);
};
//===========================================================================================================
//
// ReceiveMessageVMCommand (class)
//
//===========================================================================================================
class ReceiveMessageVMCommand : public VMCommand, public Message {
public:
ReceiveMessageVMCommand(SendMessageVMCommand &c);
unsigned int size(); // redefine virtual size function of Message
~ReceiveMessageVMCommand();
};
//===========================================================================================================
//
// AccelVMCommand (class)
//
//===========================================================================================================
class AccelVMCommand : public VMCommand {
public:
AccelVMCommand(commandType *d, commandType src, commandType x, commandType y, commandType z);
};
//===========================================================================================================
//
// ShakeVMCommand (class)
//
//===========================================================================================================
class ShakeVMCommand : public VMCommand {
public:
ShakeVMCommand(commandType *d, commandType src, commandType f);
};
//===========================================================================================================
//
// SetDeterministicModeVMCommand (class)
//
//===========================================================================================================
class SetDeterministicModeVMCommand : public VMCommand {
public:
SetDeterministicModeVMCommand(commandType *d, commandType src);
};
//===========================================================================================================
//
// WorkEndVMCommand (class)
//
//===========================================================================================================
class WorkEndVMCommand : public VMCommand {
public:
WorkEndVMCommand(commandType *d);
commandType getNbProcessedMsg();
};
//===========================================================================================================
//
// DebbuggerVMCommand (class)
//
//===========================================================================================================
class DebbuggerVMCommand : public VMCommand {
public:
DebbuggerVMCommand(commandType *d);
commandType getDebuggerCommand();
};
//===========================================================================================================
//
// EndPollVMCommand (class)
//
//===========================================================================================================
class EndPollVMCommand : public VMCommand {
public:
EndPollVMCommand(commandType *d, commandType src);
};
}
#endif
| 31.046025 | 109 | 0.402965 |
ed5aff632452f9c1b1154ebe42a8e0fab63bf626 | 682 | c | C | firmware/flowenv/lib/std/_c/reorder.c | tcp-acceleration-service/FlexTOE | 096b1569403490c162df3f8bdfdf3e19fce85bab | [
"BSD-3-Clause"
] | 8 | 2022-02-25T00:12:37.000Z | 2022-03-31T04:34:08.000Z | firmware/flowenv/lib/std/_c/reorder.c | tcp-acceleration-service/FlexTOE | 096b1569403490c162df3f8bdfdf3e19fce85bab | [
"BSD-3-Clause"
] | null | null | null | firmware/flowenv/lib/std/_c/reorder.c | tcp-acceleration-service/FlexTOE | 096b1569403490c162df3f8bdfdf3e19fce85bab | [
"BSD-3-Clause"
] | null | null | null | #include <nfp/me.h>
#include <std/reorder.h>
__intrinsic
void reorder_start(unsigned int start_ctx, SIGNAL* sig)
{
ctassert(__is_ct_const(start_ctx));
signal_ctx(start_ctx, __signal_number(sig));
__implicit_write(sig);
}
__intrinsic
void reorder_signal(unsigned int next_ctx, SIGNAL* sig)
{
ctassert(__is_ct_const(next_ctx));
signal_ctx(next_ctx, __signal_number(sig));
__implicit_write(sig);
}
__intrinsic
void reorder_signal_next(SIGNAL* sig)
{
signal_next_ctx(__signal_number(sig));
__implicit_write(sig);
}
__intrinsic void reorder_self(SIGNAL* sig)
{
unsigned int ctx;
ctx = ctx();
signal_ctx(ctx, __signal_number(sig));
__implicit_write(sig);
}
| 18.432432 | 55 | 0.756598 |
c2e4c68f2db6158489a926caaf6390b31db93cf9 | 2,278 | h | C | TongueQT/TongueQT/include/ozcollide/sphere.h | lrkk1234/TongueSimulation | 347cf38452aa62d1173da1c4935f691456255e46 | [
"MIT"
] | 2 | 2020-03-28T03:15:49.000Z | 2020-09-09T02:54:33.000Z | TongueQT/TongueQT/include/ozcollide/sphere.h | lrkk1234/TongueSimulation | 347cf38452aa62d1173da1c4935f691456255e46 | [
"MIT"
] | null | null | null | TongueQT/TongueQT/include/ozcollide/sphere.h | lrkk1234/TongueSimulation | 347cf38452aa62d1173da1c4935f691456255e46 | [
"MIT"
] | 2 | 2020-09-08T19:28:19.000Z | 2021-07-25T00:35:26.000Z | /*
OZCollide - Collision Detection Library
Copyright (C) 2006-2014 by Igor Kravtchenko
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
Contact the author: igor@tsarevitch.org
*/
#ifndef OZCOLLIDE_SPHERE_H
#define OZCOLLIDE_SPHERE_H
#ifndef OZCOLLIDE_PCH
#include <ozcollide/ozcollide.h>
#endif
#include <ozcollide/vec3f.h>
ENTER_NAMESPACE_OZCOLLIDE
/**
* Represents a traditional 3D sphere.
*/
class Sphere {
public:
/**
* Creates an uninitialised sphere.
*/
Sphere() { };
/**
* Creates an initialised sphere.
* @param _center Center of the sphere.
* @param _radius Radius of the sphere.
*/
Sphere(const Vec3f &_center, float _radius) : center(_center), radius(_radius) { };
/**
* Test if this sphere collide with one other.
* @param _s The sphere to test collision with.
* @return true if collision occurs, false otherwhise.
*/
ozinline bool isCollide(const Sphere &_s) const
{
Vec3f diff = _s.center - center;
float sqDist = diff.lenSq();
float r = _s.radius + radius;
if (sqDist <= r * r)
return true;
return false;
}
/**
* Tests if a point is inside that sphere.
* @param _pt The point to test.
* @return true if the point is inside the sphere, false otherwhise.
*/
ozinline bool isPointInside(const Vec3f _pt) const
{
float dist = (_pt - center).len();
return dist < radius ? true : false;
}
Vec3f center; /**< Center of the sphere.*/
float radius; /**< Radius of the sphere.*/
};
LEAVE_NAMESPACE
#endif
| 26.8 | 87 | 0.678665 |
a6cc716bae0fe5a7c55e366acc06ba5fa82107cf | 14,560 | h | C | Common/CoordinateSystem/CoordSysTransform.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | 2 | 2017-04-19T01:38:30.000Z | 2020-07-31T03:05:32.000Z | Common/CoordinateSystem/CoordSysTransform.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | null | null | null | Common/CoordinateSystem/CoordSysTransform.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | 1 | 2021-12-29T10:46:12.000Z | 2021-12-29T10:46:12.000Z | //
// Copyright (C) 2004-2011 by Autodesk, Inc.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
// General Public License as published by the Free Software Foundation.
//
// 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
//
#ifndef _CCOORDINATESYSTEMTRANSFORM_H_
#define _CCOORDINATESYSTEMTRANSFORM_H_
namespace CSLibrary
{
class CCoordinateSystemTransform : public MgCoordinateSystemTransform
{
public:
CCoordinateSystemTransform(MgCoordinateSystem* source, MgCoordinateSystem* target);
virtual ~CCoordinateSystemTransform();
virtual MgCoordinate* Transform(double x, double y);
virtual MgCoordinate* TransformM(double x, double y, double m);
virtual MgCoordinate* Transform(double x, double y, double z);
virtual MgCoordinate* TransformM(double x, double y, double z, double m);
virtual MgCoordinate* Transform(MgCoordinate* coordinate);
virtual MgEnvelope* Transform(MgEnvelope* envelope);
virtual void TransformCoordinate(MgCoordinate* coordinate);
virtual bool IsValidSourcePoint(double x, double y);
virtual bool IsValidSourcePoint(double x, double y, double z);
virtual bool IsValidTargetPoint(double x, double y);
virtual bool IsValidTargetPoint(double x, double y, double z);
virtual MgCoordinateSystem* GetSource();
virtual MgCoordinateSystem* GetTarget();
virtual void SetSourceAndTarget(MgCoordinateSystem* pSource, MgCoordinateSystem* pTarget);
// Geodetic Transformation Information
virtual INT32 GetGeodeticTransformationCount();
virtual MgCoordinateSystemGeodeticTransformDef* GetGeodeticTransformation (INT32 index);
virtual INT32 GetGeodeticTransformationDirection (INT32 index);
virtual MgCoordinateSystemGeodeticPath* GetExplicitGeodeticPath();
virtual void IgnoreDatumShiftWarning(bool bIgnoreDatumShiftWarning);
virtual bool IsIgnoreDatumShiftWarning();
virtual void IgnoreOutsideDomainWarning(bool bIgnoreOutsideDomainWarning);
virtual bool IsIgnoreOutsideDomainWarning();
virtual INT32 GetSourceWarningCount (void);
virtual INT32 GetdatumWarningCount (void);
virtual INT32 GetTargetWarningCount (void);
virtual INT32 GetLastTransformStatus();
virtual void ResetLastTransformStatus();
INTERNAL_API:
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the X and Y ordinates.
///
/// \param x
/// The X ordinate to transform.
/// \param y
/// The Y ordinate to transform.
///
/// \return
/// Nothing.
///
virtual void Transform(double* x, double* y);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the array of X and Y ordinates.
///
/// \param x
/// The X ordinates to transform.
/// \param y
/// The Y ordinates to transform.
/// \param arraySize
/// The size of the arrays. All the arrays must be the same size.
///
/// \return
/// Nothing.
///
virtual void Transform(double x[], double y[], int arraySize);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the X, Y ordinates and the measure.
///
/// \param x
/// The X ordinate to transform.
/// \param y
/// The Y ordinate to transform.
/// \param m
/// The measure to transform.
///
/// \return
/// Nothing.
///
virtual void TransformM(double* x, double* y, double* m);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the array of X, Y ordinates and the measure.
///
/// \param x
/// The X ordinates to transform.
/// \param y
/// The Y ordinates to transform.
/// \param m
/// The measures to transform.
/// \param arraySize
/// The size of the arrays. All the arrays must be the same size.
///
/// \return
/// Nothing.
///
virtual void TransformM(double x[], double y[], double m[], int arraySize);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the X, Y, and Z ordinates.
///
/// \param x
/// The X ordinate to transform.
/// \param y
/// The Y ordinate to transform.
/// \param z
/// The Z ordinate to transform.
///
/// \return
/// Nothing.
///
virtual void Transform(double* x, double* y, double* z);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the array of X, Y, and Z ordinates.
///
/// \param x
/// The X ordinates to transform.
/// \param y
/// The Y ordinates to transform.
/// \param z
/// The Z ordinates to transform.
/// \param arraySize
/// The size of the arrays. All the arrays must be the same size.
///
/// \return
/// Nothing.
///
virtual void Transform(double x[], double y[], double z[], int arraySize);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the X, Y, Z ordinates and the measure.
///
/// \param x
/// The X ordinate to transform.
/// \param y
/// The Y ordinate to transform.
/// \param z
/// The Z ordinate to transform.
/// \param m
/// The measure to transform.
///
/// \return
/// Nothing.
///
virtual void TransformM(double* x, double* y, double* z, double* m);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms the array of X, Y, Z ordinates and the measure.
///
/// \param x
/// The X ordinates to transform.
/// \param y
/// The Y ordinates to transform.
/// \param z
/// The Z ordinates to transform.
/// \param m
/// The measures to transform.
/// \param arraySize
/// The size of the arrays. All the arrays must be the same size.
///
/// \return
/// Nothing.
///
virtual void TransformM(double x[], double y[], double z[], double m[], int arraySize);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transform 2D conversion on an array of 2D XY points.
///
/// \param xy
/// The array of 2D XY points to be converted.
/// \param pointCount
/// The number of 2D points in the array which are to be converted.
/// \return
/// Nothing.
/// \remark
/// Use the Get...WarningCount functions above to determine the status of
/// the conversion. A conversion of all points will be attemted regardless
/// of the status of any specific point conversion. Warning counts will
/// accumulate on successive calls to this function unless the
/// ResetLastTransformStatus member function is called. This function
/// will throw an exception only in the case of what is considered a
/// total failure. That is, a condition which suggests that there is a
/// a problem with the conversion process (i.e. a physical I>O error on
/// disk) that is not related to the data being converted. In the case of
/// this function, GetConversionStatus will return the most serious (i.e.
/// highest value) warning condition encountered.
virtual void Transform2D (double xy[][2],INT32 pointCount);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Transforms a 3D conversion on an array of 3D XYZ points.
///
/// \param xy
/// The array of 3D XYZ points to be converted.
/// \param pointCount
/// The number of 3D points in the array which are to be converted.
/// \return
/// Nothing.
/// \remark
/// Use the Get...WarningCount functions above to determine the status of
/// the conversion. A conversion of all points will be attemted regardless
/// of the status of any specific point conversion. Warning counts will
/// accumulate on successive calls to this function unless the
/// ResetLastTransformStatus member function is called. This function
/// will throw an exception only in the case of what is considered a
/// total failure. That is, a condition which suggests that there is a
/// a problem with the conversion process (i.e. a physical I>O error on
/// disk) that is not related to the data being converted. In the case of
/// this function, GetConversionStatus will return the most serious (i.e.
/// highest value) warning condition encountered.
virtual void Transform3D (double xy[][3],INT32 pointCount);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Generates a MgCoordinateCollection which represents in the target
/// coordinate system the linear line segment provided in the source
/// coordinate system.
///
/// \param fromPnt
/// The result of the transformation is returned here. While the result
/// can be a single straight line segment, more often it will be a multi-
/// segment approximation of a complex curve.
/// \param fromPnt
/// The starting point of the linear segment in source system coordinates.
/// \param toPnt
/// The end point of the linear segment in source system coordinates.
/// \param chordValue
/// The returned line string is to segmented to the degree necessary such
/// that the distance between the LineString approximation of the true
/// cuve and the true curve is never more than this value. Units must
/// be the same as the target coordinate system.
/// \param maxPoints
/// The generation algorithm will always quit after generating this
/// number of points in result.
/// \return
/// Status of the operation, nature of which is yet to be determined.
/// \remarks
/// Does not, currently, have code to deal with exceptions thrown by the
/// functions it calls.
virtual MgLineString* GridLine (MgCoordinate* fromPnt,MgCoordinate* toPnt,
double curvePrecision,
UINT32 maxPoints = 500);
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Give a line segement in coordinates of the source system via the the
/// fromPnt and toPnt parameters, this function returns the position of
/// a point on that line segment which, when converted to target
/// coordinates, will have an ordinate value equal to the ordinateValue
/// parameter. Used, primarily, to locate the position of a tick line
/// on a map border.
///
/// \param position
/// The result of the calculation is returned here. This must be a
/// valid pointer to an exisitng MgCOordinate object. THis function will
/// not alter the reference count status in any way.
/// \param ordinateValue
/// The specific value whose position is to be located.
/// \param orientation
/// A value of the MgCoordinateSystemGridOrientation class. This parameter
/// indicates whether the ordinateValue parameter is an X ordinate or a Y
/// ordinate.
/// \param fromPnt
/// A two dimensional point given in coordinates of the source coordinate
/// system of this <b>Transform<\b> object which represents the starting
/// point of the line segment which is to be processed.
/// \param toPnt
/// A two dimensional point given in coordinates of the source coordinate
/// system of this <b>Transform<\b> object which represents the ending
/// point of the line segment which is to be processed.
/// \return
/// Will return a zero for success. A positive non-zero return indicates
/// a failure to calculate a position for one of the normal reasons:
/// 1> for no such value on this line segment;
/// 2> line orientation is inappropriate for this ordinate
/// For failure of anyother type, and MgException is thrown.
/// \remarks
/// The order of the two points provided is immaterial. This object
/// attempts to eliminate possible duplicate positions by ignoring
/// the to pont in the calculation of poosition.
virtual INT32 PositionOfValue (MgCoordinate* position,double ordinateValue,
INT32 orientation,
MgCoordinate* fromPnt,
MgCoordinate* toPnt);
protected:
//MgDisposable
virtual void Dispose();
protected:
//Data members
Ptr<MgCoordinateSystem> m_pCsSource;
Ptr<MgCoordinateSystem> m_pCsTarget;
cs_Dtcprm_ *m_pDtcprm;
cs_Csprm_ m_src;
cs_Csprm_ m_dst;
bool m_bSrcIsGeographic;
bool m_bDatumXfrmIsNull;
bool m_bIsReentrant;
bool m_bIgnoreDatumShiftWarning;
bool m_bIgnoreOutsideDomainWarning;
bool m_bSourceTargetSame;
INT32 m_nTransformStatus;
// Status Accumulation
INT32 m_nSourceCount;
INT32 m_nDatumCount;
INT32 m_nTargetCount;
//Private member functions
void SetCatalog(MgCoordinateSystemCatalog *pCatalog);
bool IsInitialized();
void Uninitialize();
bool IsValidPoint(cs_Csprm_& csprm, double x, double y, double z);
private:
//Unimplemented stuff
CCoordinateSystemTransform(const CCoordinateSystemTransform&);
CCoordinateSystemTransform& operator=(const CCoordinateSystemTransform&);
// Private function required to support the PositionOfValue function.
int TransformInverse (double& xx,double& yy);
INT32 TransformPoint2D (double dCoords [3]); /* 2D conversion without Critical Section */
INT32 TransformPoint3D (double dCoords [3]); /* 3D conversion without Critical Section */
void InterpretStatus (INT32 status);
};
} // End of namespace
#endif //_CCOORDINATESYSTEMTRANSFORM_H_
| 39.351351 | 100 | 0.618681 |
727f209d5096a31e9ee383b481d8494a8763e057 | 5,371 | c | C | src/jsoninf.c | TanchukVlad/swapi_c | ef3c22457c61cd6d9943b409f0edcb16a1bc0ec6 | [
"MIT"
] | null | null | null | src/jsoninf.c | TanchukVlad/swapi_c | ef3c22457c61cd6d9943b409f0edcb16a1bc0ec6 | [
"MIT"
] | null | null | null | src/jsoninf.c | TanchukVlad/swapi_c | ef3c22457c61cd6d9943b409f0edcb16a1bc0ec6 | [
"MIT"
] | null | null | null | /**
* - JsonInf can reads information from JSON file and show the string from object
* in this file. Uses libjson-c-dev – JSON-C implements a reference counting
* object model that allows you to easily construct JSON objects in C, output
* them as JSON formatted strings and parse JSON formatted strings back into the
* C representation of JSON objects.
*
* - We takes information about api from https://swapi.dev/documentation .
* From this site we take jason file.
*
*/
#include "takejson.h"
#include "jsoninf.h"
#include <stdio.h>
#include <string.h>
#include <json-c/json.h>
/**
* conc() - Makes concatenation.
* @s1: The first string.
* @s2: The second string.
*
* This function makes concatenation of two strings and adds in the end "/".
*
* Context: Concatenates link string and parameter string.
* Return: String which contains new link.
*/
char *conc(char *s1, char *s2)
{
size_t len1 = strlen(s1);
size_t len2 = strlen(s2);
char *res = malloc(len1 + len2 + 1);
strcpy(res, s1);
strcat(res, s2);
strcat(res, "/");
return res;
}
/**
* set_count() - Set count of objects from swapi.dev.
* @name: The name of resource which count is needed.
*
* This function set count of objects from resource which locats in swapi.dev.
*
* Context: If object not found shows Error and return 0.
* Return: count of object.
*/
int set_count(char *name)
{
int count;
if(strcmp(name, "people") == 0) {
count = 82;
}else if(strcmp(name, "planets") == 0) {
count = 60;
}else if(strcmp(name, "species") == 0) {
count = 37;
}else if(strcmp(name, "vehicles") == 0) {
count = 39;
}else if(strcmp(name, "starships") == 0) {
count = 36;
}else {
fprintf(stderr, "Error: Not found\n");
return 0;
}
return count;
}
/**
* get_atr() - Get information from json attribute.
* @atr_name: The name of attribute from which information is taken.
* @buf: The buffer of json file from which attribute is taken.
*
* This function uses buffer of json file and takes from them attribute
* information. The attribute has string information.
*
* Context: If json file doesn't have attribute this function shows Error and
* return string "none".
* Return: String of attribute information.
*/
char *get_atr(char *atr_name, char *buf)
{
char *str;
int res;
struct json_object *obj;
struct json_object *atr;
obj = json_tokener_parse(buf);
res = json_object_object_get_ex(obj, atr_name, &atr);
if (!res){
fprintf(stderr, "No object\n");
return "none";
}
str = (char *)malloc(strlen(json_object_get_string(atr)));
str = (char *)json_object_get_string(atr);
return str;
}
/**
* get_search_link() - Makes search link.
* @link: From this link makes search link.
* @name: The name of thing which is searched.
*
* This function creates a search link. Uses the base link, the string
* "?search=" and the name.
*
* Return: String of the search link.
*/
char *get_search_link(char *link, char *name)
{
char *search_link;
search_link = malloc(strlen(link) + strlen(name) + strlen("?search="));
strcpy(search_link, link);
strcat(search_link, "?search=");
strcat(search_link, name);
return search_link;
}
/**
* search_name() - Gets information about found name.
* @atr_name: The name of attribute from which information is taken.
* @buf: The buffer of json file from which attribute is taken.
*
* This function uses buffer of json file and takes from them attribute
* information. The attribute has string information. The buffer took
* information from search reference. A result of searching has array of found
* objects. This function take string of the object and take information from
* this string about attribute.
*
* Context: If json file doesn't have attribute or has not found objects after
* searching this function shows Error and return string "none".
* Return: String of attribute information.
*/
char *search_name(char *atr_name, char *buf)
{
char *str;
int res;
struct json_object *obj;
struct json_object *results;
struct json_object *result;
struct json_object *atr;
struct json_object *count;
obj = json_tokener_parse(buf);
res = json_object_object_get_ex(obj, "count", &count);
if (!res){
fprintf(stderr, "No object\n");
return "none";
}
if(!json_object_get_int(count)) {
fprintf(stderr, "No object\n");
return "none";
}
res = json_object_object_get_ex(obj, "results", &results);
if (!res){
fprintf(stderr, "No object\n");
return "none";
}
result = json_object_array_get_idx(results, 0);
str = (char *)malloc(strlen(json_object_get_string(result)));
str = (char *)json_object_get_string(result);
obj = json_tokener_parse(str);
res = json_object_object_get_ex(obj, atr_name, &atr);
if (!res){
fprintf(stderr, "No object\n");
return "none";
}
str = (char *)malloc(strlen(json_object_get_string(atr)));
str = (char *)json_object_get_string(atr);
return str;
}
void get_list_of_name(char link[], char par[])
{
char *api_link = conc(link, par);
char *buf;
int count = set_count(par);
for (int i = 0; i < count; i++) {
char p[11];
sprintf(p, "%d", i+1);
char* count_link = conc(api_link, p);
buf = take_json(count_link);
printf("%s %s #%d: %s\n", par, "name", i+1, get_atr("name", buf));
free(count_link);
free(buf);
}
}
| 26.589109 | 83 | 0.678086 |
60e6414e1a72faa627ae78a5027fa5d75342c9a3 | 4,088 | h | C | lib/title.h | doomnuggets/mdtoc | d555c066ecf3801e6ece5ce6d059d3b7109e2592 | [
"WTFPL"
] | 1 | 2017-02-04T14:51:35.000Z | 2017-02-04T14:51:35.000Z | lib/title.h | doomnuggets/mdtoc | d555c066ecf3801e6ece5ce6d059d3b7109e2592 | [
"WTFPL"
] | null | null | null | lib/title.h | doomnuggets/mdtoc | d555c066ecf3801e6ece5ce6d059d3b7109e2592 | [
"WTFPL"
] | null | null | null | #ifndef TITLE_H
#define TITLE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <wctype.h>
#include "constants.h"
struct Title
{
int level;
wchar_t *title;
wchar_t *anchor;
struct Title *next;
};
// Generates a new unique anchor.
void unique_anchor(struct Title *first_title, struct Title *new_title)
{
wchar_t *tmp_anchor = calloc(MAX_ANCHOR, sizeof(wchar_t));
wcsncpy(tmp_anchor, new_title->anchor, MAX_ANCHOR-1);
struct Title *current_title = first_title;
int is_unique = 0;
int unique_id = 0;
while(is_unique != 1)
{
while(current_title != NULL)
{
if(wcscmp(tmp_anchor, current_title->anchor) == 0 && current_title != new_title)
{
unique_id++;
is_unique = 0;
break;
}
else
{
is_unique = 1;
}
current_title = current_title->next;
}
if(is_unique == 0)
{
memset(tmp_anchor, '\0', MAX_LINE);
swprintf(tmp_anchor, sizeof(wchar_t)*MAX_LINE-1, L"%ls-%d", new_title->anchor, unique_id);
}
}
memset(new_title->anchor, '\0', MAX_LINE);
wcsncpy(new_title->anchor, tmp_anchor, MAX_LINE-1);
free(tmp_anchor);
}
// Builds a new title struct with the passed args.
struct Title *create_title(struct Title *previous, int indent_level, wchar_t *title, wchar_t *anchor)
{
struct Title *t = malloc(sizeof(struct Title));
t->level = indent_level;
t->title = calloc(MAX_LINE, sizeof(wchar_t));
t->anchor = calloc(MAX_LINE, sizeof(wchar_t));
wcsncpy(t->title, title, MAX_LINE-1);
wcsncpy(t->anchor, anchor, MAX_LINE-1);
t->next = NULL;
if(previous != NULL)
{
previous->next = t;
}
return t;
}
// Iterates over all titles in the linked list and frees all allocated resources.
void free_titles(struct Title *first_title)
{
struct Title *current_title = first_title;
while((current_title = first_title) != NULL)
{
first_title = first_title->next;
free(current_title->title);
free(current_title->anchor);
free(current_title);
}
}
/* This counts how many '#' are in front of the actual title. It is used to indent
* the entry in the table of contents.
*/
int count_title_level(wchar_t *line)
{
int title_level = 0;
while(line[title_level] == '#' && title_level <= 6)
{
title_level++;
}
return title_level;
}
/* Extracts the actual title without the leading '#'. */
wchar_t *extract_title(wchar_t *line)
{
int title_index = 0;
while((line[title_index] == L'#' || line[title_index] == L' ') && line[title_index] != '\0')
{
title_index++;
}
return line+title_index;
}
/* Converts a title to a valid anchor. */
void to_anchor(wchar_t *title, wchar_t *anchor)
{
int anchor_index = 1;
anchor[0] = L'#';
for(int i = 0; title[i] != L'\0'; i++)
{
if(anchor_index >= MAX_ANCHOR)
{
break;
}
if(title[i] < L'0' && title[i] != L' ')
continue;
else if(title[i] > L'9' && title[i] < L'A')
continue;
else if(title[i] > L'Z' && title[i] < L'a')
continue;
else if(title[i] > L'z' && title[i] < 192)
continue;
if(title[i] == L' ' || title[i] == L'_' || title[i] == L'-')
anchor[anchor_index] = L'-';
else
anchor[anchor_index] = towlower(title[i]);
anchor_index++;
}
}
/* Prints the final table of contents. */
void print_toc(struct Title *first_title)
{
struct Title *current_title = first_title;
while(current_title != NULL)
{
// Indent the title if needed.
for(int indent = 1; indent < current_title->level; indent++)
{
wprintf(L" ");
}
wprintf(L"+ [%ls](%ls)\n", current_title->title, current_title->anchor);
current_title = current_title->next;
}
}
#endif /* TITLE_H */
| 25.391304 | 102 | 0.574364 |
fd7b1b77cb3d85f902bea17082f611ca286cd180 | 7,755 | h | C | embree-2.0/embree/include/embree.h | PetrVevoda/smallupbp | 15430256733938d529a2f5c7ef4cdcd940ae4208 | [
"MIT",
"Apache-2.0",
"Unlicense"
] | 107 | 2015-01-27T22:01:49.000Z | 2021-12-27T07:44:25.000Z | src/thirdparty/embree/include/embree.h | westlicht/tungsten | 457c65226734784cb4d03a0d4846bc6797ab9bb7 | [
"Apache-2.0",
"Unlicense"
] | 1 | 2015-03-17T18:53:59.000Z | 2015-03-17T18:53:59.000Z | src/thirdparty/embree/include/embree.h | westlicht/tungsten | 457c65226734784cb4d03a0d4846bc6797ab9bb7 | [
"Apache-2.0",
"Unlicense"
] | 17 | 2015-03-12T19:11:30.000Z | 2020-11-30T15:51:23.000Z | // ======================================================================== //
// Copyright 2009-2013 Intel Corporation //
// //
// 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 __EMBREE_RTCORE_H__
#define __EMBREE_RTCORE_H__
#if defined(_MSC_VER) && !defined(__SSE__)
#define __SSE__
#endif
#if !defined(_WIN32) && !defined(__forceinline)
#define __forceinline inline __attribute__((always_inline))
#endif
#include "intersector1.h"
#if defined(__SSE__)
#include "intersector4.h"
#endif
#if defined(__AVX__)
#include "intersector8.h"
#endif
#if defined(__MIC__)
#include "intersector16.h"
#endif
namespace embree
{
/*! Opaque event type */
struct RTCEvent;
/*! Opaque geometry type */
struct RTCGeometry;
/*! Triangle indices */
struct RTCTriangle
{
/*! Constructs a builder triangle. */
__forceinline RTCTriangle(int v0, //!< reference to 1st vertex of the triangle
int v1, //!< reference to 2nd vertex of the triangle
int v2, //!< reference to 3rd vertex of the triangle
int id0 = 0, //!< 1st optional user ID
int id1 = 0) //!< 2nd optional user ID
: v0(v0), v1(v1), v2(v2), id0(id0), id1(id1) { }
public:
int v0, v1, v2; //!< references to 1st, 2nd, and 3rd triangle vertex
int id0, id1; //!< two user IDs
};
/*! Vertex type */
struct RTCVertex {
public:
RTCVertex (float x, float y, float z) : x(x), y(y), z(z), align(0) {}
public:
float x,y,z;
private:
int align;
};
/*! Transformation type */
struct RTCTransformation
{
float vxx,vxy,vxz;
float vyx,vyy,vyz;
float vzx,vzy,vzz;
float px ,py ,pz ;
};
/*! Initialized the ray tracing core. */
void rtcInit();
/*! Starts the Embree threads. Embree threads might spin depending on implementation. */
void rtcStartThreads(size_t numThreads = 0);
/*! Stops the Embree threads. Threads will stop spinning. */
void rtcStopThreads();
/*! Cleanup the ray tracing core. */
void rtcExit();
/*! Print debug info. */
void rtcDebug();
/*! Frees all unused internal memory. */
void rtcFreeMemory();
/*! enable verbose output */
void rtcSetVerbose(int verbose);
/*! New list of objects. */
RTCGeometry* rtcNewVirtualGeometry (const size_t numObjects, //!< maximal number of objects
const char* accelTy //!< type of acceleration structure to use
);
/*! Set virtual object user data. */
void rtcSetVirtualGeometryUserData (RTCGeometry* geom, const size_t i, const int id0, const int id1, const int mask = -1);
/*! Set virtual object bounding box and transformation. */
void rtcSetVirtualGeometryBounds (RTCGeometry* geom, const size_t i, const float* lower, const float* upper, const RTCTransformation* local2world = NULL);
/*! Set virtual object intersector1. */
void rtcSetVirtualGeometryIntersector1 (RTCGeometry* geom, const size_t i, const RTCIntersector1* intersector1);
/*! Set virtual object intersector4. */
#if defined(__SSE__)
void rtcSetVirtualGeometryIntersector4 (RTCGeometry* geom, const size_t i, const RTCIntersector4* intersector4);
#endif
/*! Set virtual object intersector8. */
#if defined(__AVX__)
void rtcSetVirtualGeometryIntersector8 (RTCGeometry* geom, const size_t i, const RTCIntersector8* intersector8);
#endif
/*! Set virtual object intersector16. */
#if defined(__MIC__)
void rtcSetVirtualGeometryIntersector16 (RTCGeometry* geom, const size_t i, const RTCIntersector16* intersector16);
#endif
/*! Creates new triangle mesh. */
RTCGeometry* rtcNewTriangleMesh (const size_t numTriangles, //!< number of triangles
const size_t numPositions, //!< maximal number of vertices
const char* accelTy //!< type of acceleration structure to use
);
/*! Map position buffer */
RTCVertex* rtcMapPositionBuffer(RTCGeometry* mesh);
/*! Unmap position buffer */
void rtcUnmapPositionBuffer(RTCGeometry* mesh);
/*! Map triangle buffer. */
RTCTriangle* rtcMapTriangleBuffer(RTCGeometry* mesh);
/*! Unmap triangle buffer. */
void rtcUnmapTriangleBuffer(RTCGeometry* mesh);
/*! Set optional approximate bounds. */
void rtcSetApproxBounds (RTCGeometry* geom, const float* lower, const float* upper);
/*! Builds acceleration structure of specified type over some geometry. */
void rtcBuildAccel (RTCGeometry* geom, //!< geometry to build acceleration structure for
const char* builderTy //!< builder to use
);
/*! Asynchronous build of acceleration structure of specified type over some geometry. */
void rtcBuildAccelAsync (RTCEvent* event, //!< event to trigger if build is finished
RTCGeometry* geom, //!< geometry to build acceleration structure for
const char* builderTy //!< builder to use
);
/*! Free unused data of the geometry. A later modification of the geometry is no longer possible. */
void rtcCleanupGeometry (RTCGeometry* mesh);
/*! Destroys geometry. */
void rtcDeleteGeometry (RTCGeometry* mesh);
/*! Returns bounding box. */
void rtcGetBounds (RTCGeometry* geom, float* lower_o, float* upper_o);
/*! Query RTCIntersector1 interface for single rays */
RTCIntersector1* rtcQueryIntersector1 (const RTCGeometry* geom, const char* type);
/*! Delete intersector1. */
void rtcDeleteIntersector1 (RTCIntersector1* intersector);
#if defined(__SSE__)
/*! Query Intersector4 interface for packets of 4 rays. */
RTCIntersector4* rtcQueryIntersector4 (const RTCGeometry* geom, const char* type);
/*! Delete intersector4. */
void rtcDeleteIntersector4 (RTCIntersector4* intersector);
#endif
#if defined(__AVX__)
/*! Query RTCIntersector8 interface for packets of 8 rays. */
RTCIntersector8* rtcQueryIntersector8 (const RTCGeometry* geom, const char* type);
/*! Delete intersector8. */
void rtcDeleteIntersector8 (RTCIntersector8* intersector);
#endif
#if defined(__MIC__)
/*! Query RTCIntersector16 interface for packets of 16 rays. */
RTCIntersector16* rtcQueryIntersector16 (const RTCGeometry* geom, const char* type);
/*! Delete intersector16. */
void rtcDeleteIntersector16 (RTCIntersector16* intersector);
#endif
/*! Create a new event */
RTCEvent* rtcNewEvent();
/*! Waits for an event */
void rtcWait(RTCEvent* event);
/*! Delete event */
void rtcDeleteEvent(RTCEvent* event);
}
#endif
| 34.775785 | 156 | 0.618956 |
a1c09ae7aa329652923f26d8746c891bd56073bc | 4,424 | h | C | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_process_descriptor.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2020-12-22T05:48:31.000Z | 2022-02-08T19:49:49.000Z | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_process_descriptor.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 4 | 2020-05-22T18:36:43.000Z | 2021-05-19T10:20:23.000Z | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_process_descriptor.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-12-06T11:48:16.000Z | 2021-09-16T04:44:47.000Z | // Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
#ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_CHROME_PROCESS_DESCRIPTOR_PROTO_H_
#define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_CHROME_PROCESS_DESCRIPTOR_PROTO_H_
#include <stddef.h>
#include <stdint.h>
#include "perfetto/protozero/message.h"
#include "perfetto/protozero/packed_repeated_fields.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/protozero/proto_utils.h"
namespace perfetto {
namespace protos {
namespace pbzero {
enum ChromeProcessDescriptor_ProcessType : int32_t;
enum ChromeProcessDescriptor_ProcessType : int32_t {
ChromeProcessDescriptor_ProcessType_PROCESS_UNSPECIFIED = 0,
ChromeProcessDescriptor_ProcessType_PROCESS_BROWSER = 1,
ChromeProcessDescriptor_ProcessType_PROCESS_RENDERER = 2,
ChromeProcessDescriptor_ProcessType_PROCESS_UTILITY = 3,
ChromeProcessDescriptor_ProcessType_PROCESS_ZYGOTE = 4,
ChromeProcessDescriptor_ProcessType_PROCESS_SANDBOX_HELPER = 5,
ChromeProcessDescriptor_ProcessType_PROCESS_GPU = 6,
ChromeProcessDescriptor_ProcessType_PROCESS_PPAPI_PLUGIN = 7,
ChromeProcessDescriptor_ProcessType_PROCESS_PPAPI_BROKER = 8,
};
const ChromeProcessDescriptor_ProcessType ChromeProcessDescriptor_ProcessType_MIN = ChromeProcessDescriptor_ProcessType_PROCESS_UNSPECIFIED;
const ChromeProcessDescriptor_ProcessType ChromeProcessDescriptor_ProcessType_MAX = ChromeProcessDescriptor_ProcessType_PROCESS_PPAPI_BROKER;
class ChromeProcessDescriptor_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/4, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
public:
ChromeProcessDescriptor_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
explicit ChromeProcessDescriptor_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
explicit ChromeProcessDescriptor_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
bool has_process_type() const { return at<1>().valid(); }
int32_t process_type() const { return at<1>().as_int32(); }
bool has_process_priority() const { return at<2>().valid(); }
int32_t process_priority() const { return at<2>().as_int32(); }
bool has_legacy_sort_index() const { return at<3>().valid(); }
int32_t legacy_sort_index() const { return at<3>().as_int32(); }
bool has_host_app_package_name() const { return at<4>().valid(); }
::protozero::ConstChars host_app_package_name() const { return at<4>().as_string(); }
};
class ChromeProcessDescriptor : public ::protozero::Message {
public:
using Decoder = ChromeProcessDescriptor_Decoder;
enum : int32_t {
kProcessTypeFieldNumber = 1,
kProcessPriorityFieldNumber = 2,
kLegacySortIndexFieldNumber = 3,
kHostAppPackageNameFieldNumber = 4,
};
using ProcessType = ::perfetto::protos::pbzero::ChromeProcessDescriptor_ProcessType;
static const ProcessType PROCESS_UNSPECIFIED = ChromeProcessDescriptor_ProcessType_PROCESS_UNSPECIFIED;
static const ProcessType PROCESS_BROWSER = ChromeProcessDescriptor_ProcessType_PROCESS_BROWSER;
static const ProcessType PROCESS_RENDERER = ChromeProcessDescriptor_ProcessType_PROCESS_RENDERER;
static const ProcessType PROCESS_UTILITY = ChromeProcessDescriptor_ProcessType_PROCESS_UTILITY;
static const ProcessType PROCESS_ZYGOTE = ChromeProcessDescriptor_ProcessType_PROCESS_ZYGOTE;
static const ProcessType PROCESS_SANDBOX_HELPER = ChromeProcessDescriptor_ProcessType_PROCESS_SANDBOX_HELPER;
static const ProcessType PROCESS_GPU = ChromeProcessDescriptor_ProcessType_PROCESS_GPU;
static const ProcessType PROCESS_PPAPI_PLUGIN = ChromeProcessDescriptor_ProcessType_PROCESS_PPAPI_PLUGIN;
static const ProcessType PROCESS_PPAPI_BROKER = ChromeProcessDescriptor_ProcessType_PROCESS_PPAPI_BROKER;
void set_process_type(::perfetto::protos::pbzero::ChromeProcessDescriptor_ProcessType value) {
AppendTinyVarInt(1, value);
}
void set_process_priority(int32_t value) {
AppendVarInt(2, value);
}
void set_legacy_sort_index(int32_t value) {
AppendVarInt(3, value);
}
void set_host_app_package_name(const std::string& value) {
AppendBytes(4, value.data(), value.size());
}
void set_host_app_package_name(const char* data, size_t size) {
AppendBytes(4, data, size);
}
};
} // Namespace.
} // Namespace.
} // Namespace.
#endif // Include guard.
| 49.155556 | 147 | 0.815778 |
59c11a59bf987e2659455f73486f9d7e8c79a35a | 7,394 | c | C | compiler/ast.c | gadget114514/yasl | 20bd610bcfad6529eb6bc5f43dc3f372ab36d448 | [
"MIT"
] | null | null | null | compiler/ast.c | gadget114514/yasl | 20bd610bcfad6529eb6bc5f43dc3f372ab36d448 | [
"MIT"
] | null | null | null | compiler/ast.c | gadget114514/yasl | 20bd610bcfad6529eb6bc5f43dc3f372ab36d448 | [
"MIT"
] | null | null | null | #include "ast.h"
#include <stdarg.h>
#include "debug.h"
#include "yasl_conf.h"
struct Node *node_clone(const struct Node *const node) {
if (node == NULL) return NULL;
struct Node *clone = malloc(sizeof(struct Node) + node->children_len*sizeof(struct Node*));
clone->nodetype = node->nodetype;
clone->type = node->type;
clone->children_len = node->children_len;
for (size_t i = 0; i < clone->children_len; i++) {
clone->children[i] = node_clone(node->children[i]);
}
switch (node->nodetype) {
case N_INT:
case N_BOOL:
case N_FLOAT:
clone->value.ival = node->value.ival;
break;
default:
clone->value.sval.str_len = node->value.sval.str_len;
clone->value.sval.str = malloc(node->value.sval.str_len);
memcpy(clone->value.sval.str, node->value.sval.str, clone->value.sval.str_len);
}
clone->line = node->line;
return clone;
}
static struct Node *new_Node(AST nodetype, enum Token type, size_t line, size_t name_len, char *name /* OWN */, size_t n, ... /* OWN */) {
struct Node *node = malloc(sizeof(struct Node) + n*sizeof(struct Node*));
node->nodetype = nodetype;
node->type = type;
node->children_len = n;
node->value.sval.str_len = name_len;
node->value.sval.str = name;
node->line = line;
va_list children;
va_start(children, n);
for (size_t i = 0; i < n; i++) {
node->children[i] = va_arg(children, struct Node*);
}
va_end(children);
return node;
}
#define new_Node_0(nodetype, type, name, name_len, line) new_Node(nodetype, type, line, name_len, name, 0)
#define new_Node_1(nodetype, type, child, name, name_len, line) new_Node(nodetype, type, line, name_len, name, 1, child)
#define new_Node_2(nodetype, type, child1, child2, name, name_len, line) new_Node(nodetype, type, line, name_len, name, 2, child1, child2)
#define new_Node_3(nodetype, type, child1, child2, child3, name, name_len, line) new_Node(nodetype, type, line, name_len, name, 3, child1, child2, child3)
struct Node *new_ExprStmt(struct Node *child, size_t line) {
return new_Node_1(N_EXPRSTMT, T_UNKNOWN, child, NULL, 0, line);
}
struct Node *new_Block(struct Node *body, size_t line) {
return new_Node_1(N_BLOCK, T_UNKNOWN, body, NULL, 0, line);
}
struct Node *new_Body(size_t line) {
return new_Node_0(N_BODY, T_UNKNOWN, NULL, 0, line);
}
void body_append(struct Node **node, struct Node *const child) {
YASL_TRACE_LOG("%s\n", "appending to block");
*node = realloc(*node, sizeof(struct Node) + (++(*node)->children_len)*sizeof(struct Node*));
(*node)->children[(*node)->children_len-1] = child;
}
struct Node *new_FnDecl(struct Node *params, struct Node *body, char *name, size_t name_len, size_t line) {
return new_Node_2(N_FNDECL, T_UNKNOWN, params, body, name, name_len, line);
}
struct Node *new_Return(struct Node *expr, size_t line) {
return new_Node_1(N_RET, T_UNKNOWN, expr, NULL, 0, line);
}
struct Node *new_Call(struct Node *params, struct Node *object, size_t line) {
return new_Node_2(N_CALL, T_UNKNOWN, params, object, NULL, 0, line);
}
struct Node *new_MethodCall(struct Node *params, struct Node *object, char *value, size_t len, size_t line) {
return new_Node_2(N_MCALL, T_UNKNOWN, params, object, value, len, line);
}
struct Node *new_Set(struct Node *collection, struct Node *key, struct Node *value, size_t line) {
return new_Node_3(N_SET, T_UNKNOWN, collection, key, value, NULL, 0, line);
}
struct Node *new_Get(struct Node *collection, struct Node *value, size_t line) {
return new_Node_2(N_GET, T_UNKNOWN, collection, value, NULL, 0, line);
}
struct Node *new_ListComp(struct Node *expr, struct Node *iter, struct Node *cond, size_t line) {
return new_Node_3(N_LISTCOMP, T_UNKNOWN, expr, iter, cond, NULL, 0, line);
}
struct Node *new_TableComp(struct Node *expr, struct Node *iter, struct Node *cond, size_t line) {
return new_Node_3(N_TABLECOMP, T_UNKNOWN, expr, iter, cond, NULL, 0, line);
}
struct Node *new_LetIter(struct Node *var, struct Node *collection, size_t line) {
return new_Node_2(N_LETITER, T_UNKNOWN, var, collection, NULL, 0, line);
}
struct Node *new_ForIter(struct Node *iter, struct Node *body, size_t line) {
return new_Node_2(N_FORITER, T_UNKNOWN, iter, body, NULL, 0, line);
}
struct Node *new_While(struct Node *cond, struct Node *body, struct Node *post, size_t line) {
return new_Node_3(N_WHILE, T_UNKNOWN, cond, body, post, NULL, 0, line);
}
struct Node *new_Break(size_t line) {
return new_Node_0(N_BREAK, T_UNKNOWN, NULL, 0, line);
}
struct Node *new_Continue(size_t line) {
return new_Node_0(N_CONT, T_UNKNOWN, NULL, 0, line);
}
struct Node *new_If(struct Node *cond, struct Node *then_node, struct Node *else_node, size_t line) {
return new_Node_3(N_IF, T_UNKNOWN, cond, then_node, else_node, NULL, 0, line);
}
struct Node *new_Print(struct Node *expr, size_t line) {
return new_Node_1(N_PRINT, T_UNKNOWN, expr, NULL, 0, line);
}
struct Node *new_Let(char *name, size_t name_len, struct Node *expr, size_t line) {
return new_Node_1(N_LET, T_UNKNOWN, expr, name, name_len, line);
}
struct Node *new_Const(char *name, size_t name_len, struct Node *expr, size_t line) {
return new_Node_1(N_CONST, T_UNKNOWN, expr, name, name_len, line);
}
struct Node *new_TriOp(enum Token op, struct Node *left, struct Node *middle, struct Node *right, size_t line) {
return new_Node_3(N_TRIOP, op, left, middle, right, NULL, 0, line);
}
struct Node *new_BinOp(enum Token op, struct Node *left, struct Node *right, size_t line) {
return new_Node_2(N_BINOP, op, left, right, NULL, 0, line);
}
struct Node *new_UnOp(enum Token op, struct Node *child, size_t line) {
return new_Node_1(N_UNOP, op, child, NULL, 0, line);
}
struct Node *new_Assign(char *name, size_t name_len, struct Node *child, size_t line) {
return new_Node_1(N_ASSIGN, T_UNKNOWN, child, name, name_len, line);
}
struct Node *new_Var(char *name, size_t name_len, size_t line) {
return new_Node_0(N_VAR, T_UNKNOWN, name, name_len, line);
}
struct Node *new_Undef(size_t line) {
return new_Node_0(N_UNDEF, T_UNKNOWN, NULL, 0, line);
}
struct Node *new_Float(double val, size_t line) {
struct Node *node = new_Node_0(N_FLOAT, T_UNKNOWN, NULL, 0, line);
node->value.dval = val;
return node;
}
struct Node *new_Integer(yasl_int val, size_t line) {
struct Node *node = new_Node_0(N_INT, T_UNKNOWN, NULL, 0, line);
node->value.ival = val;
return node;
}
struct Node *new_Boolean(int val, size_t line) {
struct Node *node = new_Node_0(N_BOOL, T_UNKNOWN, NULL, 0, line);
node->value.ival = val;
return node;
}
struct Node *new_String(char *value, size_t len, size_t line) {
return new_Node_0(N_STR, T_UNKNOWN, value, len, line);
}
struct Node *new_List(struct Node *values, size_t line) {
return new_Node_1(N_LIST, T_UNKNOWN, values, NULL, 0, line);
}
struct Node *new_Table(struct Node *keys, size_t line) {
return new_Node_1(N_TABLE, T_UNKNOWN, keys, NULL, 0, line);
}
void node_del(struct Node *node) {
if (!node) return;
while (node->children_len-- > 0) {
if (node->children[node->children_len] != NULL)
node_del(node->children[node->children_len]);
}
switch (node->nodetype) {
case N_BOOL:
case N_INT:
case N_FLOAT:
break;
default:
free(node->value.sval.str);
}
free(node);
}
| 34.713615 | 154 | 0.698675 |
de88f33c6be21ca1b9acd7a8931617b8cf381b11 | 3,268 | h | C | drv/gim_atombios.h | olealgoritme/MxGPU-Virtualization | fd45aeda397ced0f7e57e6e4e77462f4f1aab554 | [
"MIT"
] | 146 | 2017-12-14T19:33:59.000Z | 2022-03-20T18:03:55.000Z | drv/gim_atombios.h | olealgoritme/MxGPU-Virtualization | fd45aeda397ced0f7e57e6e4e77462f4f1aab554 | [
"MIT"
] | 40 | 2017-12-22T06:56:15.000Z | 2021-12-16T18:10:58.000Z | drv/gim_atombios.h | olealgoritme/MxGPU-Virtualization | fd45aeda397ced0f7e57e6e4e77462f4f1aab554 | [
"MIT"
] | 73 | 2018-01-05T10:57:42.000Z | 2022-03-26T16:19:14.000Z | /*
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE
*/
#ifndef _GPU_IOV_MODULE__GIM_ATOMBIOS_H
#define _GPU_IOV_MODULE__GIM_ATOMBIOS_H
#include "gim_adapter.h"
#include "gim_atombios_com.h"
#define ATOM_DATATABLE 0
#define ATOM_COMMANDTABLE 1
#define ATOM_MASTER_ROM_HEADERTABLE 2
#define ATOM_ASIC_POSTED 0
#define ATOM_ASIC_NEED_POST 1
#define ONE_K 0x00000400L
#define HALF_K 0x00000200L
#define VBIOS_POST_INIT_ASIC 0
#define VBIOS_POST_LOAD_UCODE 1
#define VBIOS_POST_FULL_POST 2
#define VBIOS_POST_REPOST 3
#define VBIOS_POST_UNKNOWN 4
#define FORCE_VBIOS_POST 10
#define POST_VBIOS_IF_NEEDED 11
#define UPDATE_FIRMWARE_SMU 0x01
#define UPDATE_FIRMWARE_RLCV 0x02
#define UPDATE_FIRMWARE_TOC 0x04
#define UPDATE_FIRMWARE_SMC_PATCH 0x8
#define PPSMC_MSG_THERMAL_CNTL_ENABLE (0x10a)
int atom_init_parser(struct adapter *adapt);
int atom_post_vbios(struct adapter *adapt, int post_type);
int atom_chk_asic_status(struct adapter *adapt);
int patch_firmware(struct adapter *adapt);
struct cail_parser_table_context {
uint32_t size;
uint32_t table_index; /* indicate index of Command table */
void *para_ptr; /* Parameter space pointer */
uint32_t parser_result; /* Save the result from Parser */
};
struct cail_adapter_config_info {
uint32_t rom_length; /* Size of ATI ROM in bytes */
uint32_t rom_header_offset; /* Offset to ROM header */
void *rom_base_addr; /* Mapped logical base addr of ROM */
void *io_base_addr; /* IO access address */
};
int atom_dpm_state_cntl(struct adapter *adapt,
struct pwr_mgt_param *param);
void enable_thermal_control(struct adapter *adapt);
#define GIM_VBIOS_SIGNATURE "761295520"
#define GIM_VBIOS_SIGNATURE_OFFSET 0x30
#define GIM_VBIOS_SIGNATURE_SIZE sizeof(GIM_VBIOS_SIGNATURE)
#define GIM_VBIOS_SIGNATURE_END (GIM_VBIOS_SIGNATURE_OFFSET \
+ GIM_VBIOS_SIGNATURE_SIZE)
#define GIM_IS_VALID_VBIOS(p) \
((p)[0] == 0x55 && (p)[1] == 0xAA)
#define GIM_VBIOS_LENGTH(p) \
((p)[2] << 9)
#endif
| 35.139785 | 80 | 0.737148 |
97c8a19d8e52cc6eba7491415fb0d054b9714cd5 | 4,708 | h | C | stira/wavelet/wavelet/WaveletTaps.h | frooms/stira | 60b419f3e478397a8ab43ce9315a259567d94a26 | [
"MIT"
] | 8 | 2016-03-23T08:12:33.000Z | 2022-01-25T14:07:03.000Z | stira/wavelet/wavelet/WaveletTaps.h | frooms/stira | 60b419f3e478397a8ab43ce9315a259567d94a26 | [
"MIT"
] | null | null | null | stira/wavelet/wavelet/WaveletTaps.h | frooms/stira | 60b419f3e478397a8ab43ce9315a259567d94a26 | [
"MIT"
] | 8 | 2015-06-29T12:00:06.000Z | 2019-09-03T12:40:47.000Z |
/***********************************************************************************
* Copyright (C) 2009 by Filip Rooms *
* *
* Terms and conditions for using this software in any form are provided in the *
* file COPYING, which can be found in the root directory of this project. *
* *
* Contact data: filip.rooms@gmail.com *
* http://www.filiprooms.be/ *
* *
***********************************************************************************/
#ifndef STIRA_WAVELET_WAVELETTAPS_H
#define STIRA_WAVELET_WAVELETTAPS_H
namespace stira {
namespace wavelet {
/** \brief filter taps for some orthogonal wavelet types */
/** \brief enum describing which type of wavelet to use */
enum WaveletType { DAUBECHIES_1, DAUBECHIES_2, DAUBECHIES_4, DAUBECHIES_8,
SYMLET_1, SYMLET_2, SYMLET_4, SYMLET_8,
COIFLET_1, COIFLET_2, COIFLET_3, COIFLET_4,
};
// from Rice Wavelet Toolbox function daubcqf(16)
// print with higher precision by typing "format long" first
const double Daub8[16] =
{
-0.000117476784125, 0.000675449406451, -0.000391740373377, -0.004870352993455,
0.008746094047414, 0.013981027917413, -0.044088253930833, -0.017369301001855,
0.128747426620509, 0.000472484573806, -0.284015542961952, -0.015829105256623,
0.585354683654413, 0.675630736297671, 0.312871590914497, 0.054415842243140
};
const double Daub4[8] =
{
-0.010597401785069, 0.032883011666885, 0.030841381835560, -0.187034811719093,
-0.027983769416859, 0.630880767929859, 0.714846570552915, 0.230377813308896
};
const double Daub2[4] =
{
-0.129409522551260, 0.224143868042013, 0.836516303737808, 0.482962913144534
};
const double Daub1[2] =
{
0.707106781186548, 0.707106781186548
};
const double Sym8[16] =
{
-0.003382415951359, -0.000542132331636, 0.031695087810345, 0.007607487325285,
-0.143294238351054, -0.061273359067909, 0.481359651259201, 0.777185751699748,
0.364441894835956, -0.051945838107875, -0.027219029916814, 0.049137179673477,
0.003808752014060, -0.014952258336793, -0.000302920514552, 0.001889950332901
};
// using Stanford WaveLab function MakeONFilter('Symmlet', 4)
// http://www-stat.stanford.edu/~wavelab/
const double Sym4[8] =
{
-0.075765714789341, -0.029635527645954, 0.497618667632458, 0.803738751805216,
0.297857795605542, -0.099219543576935, -0.012603967262261, 0.032223100604071
};
// standard matlab wavelet toolbox wfilters('sym2')
const double Sym2[4] =
{
-0.129409522550921, 0.224143868041857, 0.836516303737469, 0.482962913144690
};
// standard matlab wavelet toolbox wfilters('sym1')
const double Sym1[2] =
{
0.707106781186548, 0.707106781186548
};
// standard matlab wavelet toolbox wfilters('coif1')
const double Coif1[6] =
{
-0.015655728135465, -0.072732619512854, 0.384864846864203, 0.852572020212255, 0.337897662457809, -0.072732619512854
};
// standard matlab wavelet toolbox wfilters('coif2')
const double Coif2[12] =
{
-0.000720549445365, -0.001823208870703, 0.005611434819394, 0.023680171946334, -0.059434418646457, -0.076488599078306,
0.417005184421693, 0.812723635445542, 0.386110066821162 -0.067372554721963, -0.041464936781759, 0.016387336463522
};
// standard matlab wavelet toolbox wfilters('coif3')
const double Coif3[18] =
{
-0.000034599772836, -0.000070983303138, 0.000466216960113, 0.001117518770891, -0.002574517688750, -0.009007976136662,
0.015880544863616, 0.034555027573062, -0.082301927106886, -0.071799821619312, 0.428483476377619, 0.793777222625621,
0.405176902409617, -0.061123390002673, -0.065771911281855, 0.023452696141836, 0.007782596427325, -0.003793512864491
};
// standard matlab wavelet toolbox wfilters('coif4')
const double Coif4[24] =
{
-0.000001784985003, -0.000003259680237, 0.000031229875865, 0.000062339034461,
-0.000259974552488, -0.000589020756244, 0.001266561929299, 0.003751436157278,
-0.005658286686611, -0.015211731527946, 0.025082261844864, 0.039334427123337,
-0.096220442033988, -0.066627474263425, 0.434386056491468, 0.782238930920499,
0.415308407030430, -0.056077313316755, -0.081266699680879, 0.026682300156053,
0.016068943964776, -0.007346166327642, -0.001629492012602, 0.000892313668582
};
}
}
#endif
| 41.298246 | 122 | 0.646559 |
209e1865a84df50fdf65dab66f7d7bd22f4fae73 | 1,992 | h | C | MyGUIEngine/include/MyGUI_RotatingSkin.h | paroj/mygui | 09b64e3503b0804756fad4af48b4c66f075fcd6e | [
"MIT"
] | 113 | 2015-06-25T06:24:59.000Z | 2021-09-26T02:46:02.000Z | MyGUIEngine/include/MyGUI_RotatingSkin.h | AxolotGames/mygui | 1c8e8c5cbdb8df3c3e6103aa3f17cb04866a6388 | [
"MIT"
] | 2 | 2015-05-03T07:22:49.000Z | 2017-12-11T09:17:20.000Z | MyGUIEngine/include/MyGUI_RotatingSkin.h | AxolotGames/mygui | 1c8e8c5cbdb8df3c3e6103aa3f17cb04866a6388 | [
"MIT"
] | 17 | 2015-11-10T15:07:15.000Z | 2021-01-19T15:28:16.000Z | /*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_ROTATING_SKIN_H_
#define MYGUI_ROTATING_SKIN_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Types.h"
#include "MyGUI_ISubWidgetRect.h"
#include "MyGUI_RenderFormat.h"
namespace MyGUI
{
class MYGUI_EXPORT RotatingSkin :
public ISubWidgetRect
{
MYGUI_RTTI_DERIVED( RotatingSkin )
public:
RotatingSkin();
virtual ~RotatingSkin();
/** Set angle of rotation in radians */
void setAngle(float _angle);
/** Get angle of rotation in radians */
float getAngle() const;
/** Set center of rotation
@param _center Center point.
*/
void setCenter(const IntPoint& _center);
/** Get center of rotation */
IntPoint getCenter(bool _local = true) const;
virtual void setAlpha(float _alpha);
virtual void setVisible(bool _visible);
virtual void setStateData(IStateInfo* _data);
virtual void createDrawItem(ITexture* _texture, ILayerNode* _node);
virtual void destroyDrawItem();
// метод для отрисовки себя
virtual void doRender();
/*internal:*/
virtual void _updateView();
virtual void _correctView();
virtual void _setAlign(const IntSize& _oldsize);
virtual void _setUVSet(const FloatRect& _rect);
virtual void _setColour(const Colour& _value);
protected:
void _rebuildGeometry();
private:
bool mGeometryOutdated;
float mAngle;
IntPoint mCenterPos;
enum {RECT_VERTICIES_COUNT = 4, GEOMETRY_VERTICIES_TOTAL_COUNT = 8};
FloatPoint mResultVerticiesPos[GEOMETRY_VERTICIES_TOTAL_COUNT];
FloatPoint mResultVerticiesUV[GEOMETRY_VERTICIES_TOTAL_COUNT];
bool mEmptyView;
VertexColourType mVertexFormat;
uint32 mCurrentColour;
FloatRect mCurrentTexture;
IntCoord mCurrentCoord;
ILayerNode* mNode;
RenderItem* mRenderItem;
};
} // namespace MyGUI
#endif // MYGUI_ROTATING_SKIN_H_
| 22.636364 | 84 | 0.752008 |
2d92b7de2614241a5b24a22df6ecd4d314adf5a6 | 1,011 | h | C | imiss-ios-master/music/Classes/ThirdParty/SGAdvertScrollView/LinkageView/LinkageConfig.h | WiitterSimithYU/-scollview-imissMusic | 146757323aa5a9ba7b8d8d5b4064ab66f0241bef | [
"MIT"
] | 121 | 2018-10-08T08:32:53.000Z | 2021-12-06T06:47:52.000Z | imiss-ios-master/music/Classes/ThirdParty/SGAdvertScrollView/LinkageView/LinkageConfig.h | WiitterSimithYU/-scollview-imissMusic | 146757323aa5a9ba7b8d8d5b4064ab66f0241bef | [
"MIT"
] | null | null | null | imiss-ios-master/music/Classes/ThirdParty/SGAdvertScrollView/LinkageView/LinkageConfig.h | WiitterSimithYU/-scollview-imissMusic | 146757323aa5a9ba7b8d8d5b4064ab66f0241bef | [
"MIT"
] | 21 | 2018-10-09T04:18:15.000Z | 2021-12-18T08:53:07.000Z | //
// LinkageConfig.h
// ZhongLv
//
// Created by MAC on 2018/4/27.
// Copyright © 2018年 Zhonglv. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BaseViewController.h"
@interface LinkageConfig : NSObject
@property (nonatomic, assign) CGRect titleFrame;
@property (nonatomic, assign) CGRect contentFrame;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) UIFont *titleSelectedFont;
@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, strong) UIColor *titleSelectedColor;
@property (nonatomic, strong) UIColor *indicatorColor;
@property (nonatomic, assign) CGFloat indicatorFixedWidth;
@property (nonatomic, assign) CGFloat indicatorAdditionalWidth;
@property (nonatomic, strong) UIColor *bottomSeparatorColor;
// 一下需要单独设置
@property (nonatomic, weak ) BaseViewController *vc;
@property (nonatomic, strong) NSArray *vcs;
@property (nonatomic, strong) NSArray<NSString *> *titles;
/// 项目默认设置
+ (instancetype)initWithDefaultStyle;
@end
| 29.735294 | 63 | 0.769535 |
7c41aa84f8c1f47535bb3c79fde3d275f7b82b40 | 2,468 | h | C | release/src/linux/linux/arch/ia64/kernel/perfmon_generic.h | ghsecuritylab/tomato_egg | 50473a46347f4631eb4878a0f47955cc64c87293 | [
"FSFAP"
] | 278 | 2015-11-03T03:01:20.000Z | 2022-01-20T18:21:05.000Z | release/src/linux/linux/arch/ia64/kernel/perfmon_generic.h | ghsecuritylab/tomato_egg | 50473a46347f4631eb4878a0f47955cc64c87293 | [
"FSFAP"
] | 374 | 2015-11-03T12:37:22.000Z | 2021-12-17T14:18:08.000Z | release/src/linux/linux/arch/ia64/kernel/perfmon_generic.h | ghsecuritylab/tomato_egg | 50473a46347f4631eb4878a0f47955cc64c87293 | [
"FSFAP"
] | 96 | 2015-11-22T07:47:26.000Z | 2022-01-20T19:52:19.000Z | /*
* This file contains the architected PMU register description tables
* and pmc checker used by perfmon.c.
*
* Copyright (C) 2002 Hewlett Packard Co
* Stephane Eranian <eranian@hpl.hp.com>
*/
#define RDEP(x) (1UL<<(x))
#if defined(CONFIG_ITANIUM) || defined (CONFIG_MCKINLEY)
#error "This file should not be used when CONFIG_ITANIUM or CONFIG_MCKINLEY is defined"
#endif
static pfm_reg_desc_t pmc_gen_desc[PMU_MAX_PMCS]={
/* pmc0 */ { PFM_REG_CONTROL , 0, 0x1UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc1 */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc2 */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc3 */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc4 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(4),0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc5 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(5),0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc6 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(6),0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
/* pmc7 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(7),0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
{ PFM_REG_END , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}}, /* end marker */
};
static pfm_reg_desc_t pmd_gen_desc[PMU_MAX_PMDS]={
/* pmd0 */ { PFM_REG_NOTIMPL , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}},
/* pmd1 */ { PFM_REG_NOTIMPL , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}},
/* pmd2 */ { PFM_REG_NOTIMPL , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}},
/* pmd3 */ { PFM_REG_NOTIMPL , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}},
/* pmd4 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(4),0UL, 0UL, 0UL}},
/* pmd5 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(5),0UL, 0UL, 0UL}},
/* pmd6 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(6),0UL, 0UL, 0UL}},
/* pmd7 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(7),0UL, 0UL, 0UL}},
{ PFM_REG_END , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}}, /* end marker */
};
/*
* impl_pmcs, impl_pmds are computed at runtime to minimize errors!
*/
static pmu_config_t pmu_conf={
disabled: 1,
ovfl_val: (1UL << 32) - 1,
num_ibrs: 8,
num_dbrs: 8,
pmd_desc: pfm_gen_pmd_desc,
pmc_desc: pfm_gen_pmc_desc
};
| 50.367347 | 106 | 0.613047 |
2df5a295fe07894af46c95d1f73000f59f865a23 | 1,328 | h | C | LGResStudy/Libs/YJPlayerView/Classes/YJBasePlayerView.h | LYajun/LGResStudy | 8c82eb5ea79758ea0aae183455900e9a313939e5 | [
"MIT"
] | 17 | 2018-04-18T15:25:03.000Z | 2021-10-23T00:49:47.000Z | LGResStudy/Libs/YJPlayerView/Classes/YJBasePlayerView.h | LYajun/LGResStudy | 8c82eb5ea79758ea0aae183455900e9a313939e5 | [
"MIT"
] | 5 | 2019-07-01T02:23:11.000Z | 2020-04-12T09:54:03.000Z | LGResStudy/Libs/YJPlayerView/Classes/YJBasePlayerView.h | LYajun/LGResStudy | 8c82eb5ea79758ea0aae183455900e9a313939e5 | [
"MIT"
] | 6 | 2018-05-07T00:50:14.000Z | 2020-09-18T14:50:59.000Z | //
// YJOrientationView.h
// YJPlayerViewDemo
//
// Created by 刘亚军 on 2018/3/15.
// Copyright © 2018年 刘亚军. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "YJPlayModel.h"
// 枚举值,包含水平移动方向和垂直移动方向
typedef NS_ENUM(NSInteger, PanDirection){
PanDirectionHorizontalMoved, // 横向移动
PanDirectionVerticalMoved // 纵向移动
};
@interface YJBasePlayerView : UIView
@property (nonatomic, strong) YJPlayModel *playModel;
/** 父视图 */
@property (nonatomic,weak) UIView *fatherView;
/** 是否是全屏 */
@property(nonatomic,assign) BOOL isFullScreen;
/** 是否是用户手动全屏 */
@property(nonatomic,assign) BOOL isFullScreenByUser;
/** 自动选择开关 */
@property (nonatomic,assign) BOOL autoRotationDisable;
/** 系统音量 */
@property (nonatomic,assign) CGFloat volumeValue;
/** 用户手动旋转 */
- (void)userRotationAction;
/** 手动旋转 */
- (void)interfaceOrientation:(UIInterfaceOrientation)orientation;
/**销毁播放器*/
-(void)destroyPlayer;
/** 点击手势 */
- (void)singleTap:(UITapGestureRecognizer *)tap;
/** 双击手势 */
-(void)doubleTap:(UITapGestureRecognizer *)tap;
/** 平移手势 */
-(void)panDirection:(UIPanGestureRecognizer *)pan;
/** 平移手势开关 */
@property (nonatomic,assign) BOOL panEnable;
/** 状态栏开关 */
@property (nonatomic,assign) BOOL hideStateBar;
/** 相关通知方法 */
- (void)appDidEnterBackground:(NSNotification *)note;
- (void)appDidEnterPlayground:(NSNotification *)note;
@end
| 27.666667 | 65 | 0.728163 |
f55407ef505e96c5fe9540af6266e3ef8c552f2c | 401 | h | C | include/logging/log_level.h | alexey-rasskazov/logging | 007c424066a994f21b6f5060bdd69b61c27fd56c | [
"MIT"
] | null | null | null | include/logging/log_level.h | alexey-rasskazov/logging | 007c424066a994f21b6f5060bdd69b61c27fd56c | [
"MIT"
] | null | null | null | include/logging/log_level.h | alexey-rasskazov/logging | 007c424066a994f21b6f5060bdd69b61c27fd56c | [
"MIT"
] | null | null | null | #pragma once
namespace logging {
/**
* @brief Logging level enumeration.
*
*/
enum class LogLevel
{
DEBUG = 10,
INFO = 20,
WARNING = 30,
ERROR = 40,
FATAL = 50,
DISABLED = 100,
UNKNOWN = 255,
};
const char* log_level_name(LogLevel level);
LogLevel log_level_by_name(const char* name);
} // logging
using logging::LogLevel; | 14.851852 | 45 | 0.571072 |
f4af524a2b998d02265c0a36627a12a18f8a48a9 | 2,758 | c | C | arm/sphincs/hash.c | kste/sphincs | 58e200d2338c60803978715ac6b75386dcf3fc8d | [
"MIT"
] | 3 | 2019-03-17T01:52:55.000Z | 2020-07-12T21:58:41.000Z | arm/sphincs/hash.c | zhaoxiaomeng/sphincs | 58e200d2338c60803978715ac6b75386dcf3fc8d | [
"MIT"
] | 3 | 2017-11-05T08:06:53.000Z | 2018-10-23T23:43:09.000Z | arm/sphincs/hash.c | zhaoxiaomeng/sphincs | 58e200d2338c60803978715ac6b75386dcf3fc8d | [
"MIT"
] | 4 | 2017-11-05T06:20:51.000Z | 2020-07-12T21:58:44.000Z | #include "params.h"
#include "permute.h"
#include "../crypto_hash_blake256.h"
#include "../crypto_hash_blake512.h"
#include "hash.h"
#include <stddef.h>
#include <arm_neon.h>
#define u128 uint8x16_t
#define XOR(a, b) veorq_u8(a, b)
#define LOAD(src) vld1q_u8(src)
#define STORE(dest,src) vst1q_u8(dest,src)
int varlen_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen)
{
crypto_hash_blake256(out,in,inlen);
return 0;
}
int msg_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen)
{
crypto_hash_blake512(out,in,inlen);
return 0;
}
int hash_2n_n(unsigned char *out,const unsigned char *in)
{
hash_h(out, in);
return 0;
}
int hash_2n_n_mask(unsigned char *out,const unsigned char *in, const unsigned char *mask)
{
unsigned char buf[2*HASH_BYTES];
int i;
for(i=0;i<2*HASH_BYTES;i++)
buf[i] = in[i] ^ mask[i];
hash_h(out, buf);
return 0;
}
int hash_n_n(unsigned char *out,const unsigned char *in)
{
unsigned char x[32];
int i;
for(i=0;i<32;i++)
{
x[i] = in[i];
}
hash_f(out,x);
return 0;
}
int hash_n_n_mask(unsigned char *out,const unsigned char *in, const unsigned char *mask)
{
unsigned char buf[HASH_BYTES];
int i;
for(i=0;i<HASH_BYTES;i++)
buf[i] = in[i] ^ mask[i];
hash_f(out, buf);
return 0;
}
int hash_n_n_mask_8x(unsigned char *out,const unsigned char *in,
const unsigned char *mask)
{
unsigned char x[32*8];
int i;
u128 fullmask = LOAD(mask);
for(i=0;i<16;i++)
{
STORE(x + 16*i, XOR(LOAD(in + 16*i), fullmask));
}
hash_f_8x(out, x);
}
int hash_2n_n_8x(unsigned char *out,const unsigned char *in,
unsigned long long out_dist, unsigned long long in_dist)
{
hash_h_8x(out, in);
}
int hash_2n_n_mask_8x(unsigned char *out,const unsigned char *in,
unsigned long long out_dist, unsigned long long in_dist,
const unsigned char *mask)
{
unsigned char x[in_dist*8];
int i;
u128 mask_a = LOAD(mask);
u128 mask_b = LOAD(mask + 16);
u128 mask_c = LOAD(mask + 32);
u128 mask_d = LOAD(mask + 48);
for(i=0;i<8;i++)
{
STORE(x + 64*i, XOR(LOAD(in + 64*i), mask_a));
STORE(x + 64*i + 16, XOR(LOAD(in + 64*i + 16), mask_b));
STORE(x + 64*i + 32, XOR(LOAD(in + 64*i + 32), mask_c));
STORE(x + 64*i + 48, XOR(LOAD(in + 64*i + 48), mask_d));
}
hash_h_8x(out, x);
}
int loop_hash_2n_n_mask_8x(unsigned char *out,const unsigned char *in,
unsigned long loops, const unsigned char *mask)
{
int j;
for(j=0;j<8*loops;j+=8)
hash_2n_n_mask_8x(out+(j)*HASH_BYTES, in+(2*j)*HASH_BYTES,
HASH_BYTES, 2*HASH_BYTES, mask);
}
int hash_n_n_8x(unsigned char *out,const unsigned char *in)
{
hash_f_8x(out, in);
}
| 22.064 | 89 | 0.645395 |
21a98dccf9021c004eb5fb0b4682ac68e3f8a50f | 3,156 | h | C | ECSUtil/CRWLock.h | EMCECS/ecs-object-client-windows-cpp | ebea5a98e345da2e2d8d0fa6450b6c17fa1de4d0 | [
"Apache-2.0"
] | 1 | 2018-10-22T15:44:54.000Z | 2018-10-22T15:44:54.000Z | ECSUtil/CRWLock.h | EMCECS/ecs-object-client-windows-cpp | ebea5a98e345da2e2d8d0fa6450b6c17fa1de4d0 | [
"Apache-2.0"
] | 1 | 2018-10-31T18:40:29.000Z | 2018-10-31T18:40:29.000Z | ECSUtil/CRWLock.h | EMCECS/ecs-object-client-windows-cpp | ebea5a98e345da2e2d8d0fa6450b6c17fa1de4d0 | [
"Apache-2.0"
] | 2 | 2018-01-30T04:15:50.000Z | 2018-10-31T08:58:26.000Z | /*
* Copyright (c) 2017 - 2021, Dell Technologies, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include "exportdef.h"
using namespace std;
namespace ecs_sdk
{
class ECSUTIL_EXT_CLASS CSimpleRWLockAcquire;
class ECSUTIL_EXT_CLASS CSimpleRWLock
{
friend class CSimpleRWLockAcquire;
private:
SRWLOCK RWLock; // lock used by the caller
public:
CSimpleRWLock& operator = (const CSimpleRWLock& Src); // no implementation
CSimpleRWLock(const CSimpleRWLock& Src); // no implementation
public:
CSimpleRWLock();
~CSimpleRWLock();
};
class ECSUTIL_EXT_CLASS CSimpleRWLockAcquire
{
friend class CSimpleRWLock;
private:
CSimpleRWLock* pLock;
DWORD dwThreadId; // current thread ID
bool bLocked; // set if lock has been acquired
bool bWrite; // set if write lock
private:
CSimpleRWLockAcquire& operator = (const CSimpleRWLockAcquire& ptr); // no implementation
CSimpleRWLockAcquire(const CSimpleRWLockAcquire& Src); // no implementation
public:
CSimpleRWLockAcquire(CSimpleRWLock* pLockParam, bool bWriteParam = false, bool bGetLock = true);
~CSimpleRWLockAcquire();
void Unlock(void) throw();
void Lock(bool bWriteParam = false) throw();
bool IsLocked(void) const;
bool IsWriteLocked(void) const;
};
class CRWLockAcquire;
//lint -save -esym(1539, CRWLock::rwlListLock)
class ECSUTIL_EXT_CLASS CRWLock
{
friend class CRWLockAcquire;
private:
vector<CRWLockAcquire*> Instances; // list of CRWLockAcquire instances
mutable CSimpleRWLock rwlListLock; // lock used for accessing the map
SRWLOCK RWLock; // lock used by the caller
public:
CRWLock& operator = (const CRWLock& Src); // no implementation
CRWLock(const CRWLock& Src); // no implementation
bool IsLocked(void) const;
bool IsWriteLocked(void) const;
public:
CRWLock();
~CRWLock() throw();
};
//lint -restore
class ECSUTIL_EXT_CLASS CRWLockAcquire
{
friend class CRWLock;
private:
CRWLock* pLock;
DWORD dwThreadId; // current thread ID
bool bLocked; // set if lock has been acquired
bool bWrite; // set if write lock
bool bWaiting; // if set, waiting for a lock (used for debugging)
private:
CRWLockAcquire& operator = (const CRWLockAcquire& ptr); // no implementation
CRWLockAcquire(const CRWLockAcquire& Src); // no implementation
public:
CRWLockAcquire(CRWLock* pLockParam, bool bWriteParam = false, bool bGetLock = true);
~CRWLockAcquire() throw();
void Unlock(void) throw();
void Lock(bool bWriteParam = false) throw();
bool IsLocked(void) const;
bool IsWriteLocked(void) const;
};
}
| 28.178571 | 98 | 0.718631 |
bc37d2b03555c33682340065a92ace0a05d6b340 | 1,031 | h | C | Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppApplication.h | liu3xing3long/MITK-2016.11 | 385c506f9792414f40337e106e13d5fd61aa3ccc | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKDiffusionImagingAppAPPLICATION_H_
#define QMITKDiffusionImagingAppAPPLICATION_H_
#include <berryIApplication.h>
class QmitkDiffusionImagingAppApplication : public QObject, public berry::IApplication
{
Q_OBJECT
Q_INTERFACES(berry::IApplication)
public:
QmitkDiffusionImagingAppApplication() {}
~QmitkDiffusionImagingAppApplication() {}
QVariant Start(berry::IApplicationContext*) override;
void Stop() override;
};
#endif /*QMITKDiffusionImagingAppAPPLICATION_H_*/
| 27.864865 | 87 | 0.676043 |
09779e7d144ae906d8b9a7e5556b14c01f27524e | 2,910 | h | C | include/tcp/TcpClient.h | morphogencc/ofxAsio | ee5c7271e607b850fefaa5d3170dd532438db5dd | [
"MIT"
] | 4 | 2016-09-01T03:42:10.000Z | 2020-03-30T10:45:52.000Z | include/tcp/TcpClient.h | morphogencc/ofxAsio | ee5c7271e607b850fefaa5d3170dd532438db5dd | [
"MIT"
] | 4 | 2016-02-07T01:44:02.000Z | 2016-08-12T16:48:59.000Z | include/tcp/TcpClient.h | morphogencc/ofxAsio | ee5c7271e607b850fefaa5d3170dd532438db5dd | [
"MIT"
] | 6 | 2016-03-23T16:10:20.000Z | 2020-07-21T06:50:34.000Z | // Copyright (c) 2022 Nathan S Lachenmyer
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <chrono>
#include <thread>
#include "../Datagram.h"
#include "asio/asio.hpp"
#include "asio/system_timer.hpp"
namespace sitara {
namespace tcp {
class TcpClient {
public:
~TcpClient();
static std::shared_ptr<TcpClient> make();
void connect(std::string ip_address, int port);
void disconnect();
void send(const std::string& message);
// void addOnSendFn(std::function<void(std::shared_ptr<Datagram> msg)> response);
// void addOnResponseFn(std::function<void(std::shared_ptr<Datagram> msg)> response);
protected:
TcpClient();
void init();
void start_connect(asio::ip::tcp::resolver::iterator resolver);
void handle_connect(const asio::error_code& ec, asio::ip::tcp::resolver::iterator endpoint_iter);
void start_read();
void handle_read(const asio::error_code& ec, size_t bytes_received);
void start_write();
void handle_write(const asio::error_code& e, size_t bytes_receivedc);
void check_deadline(const asio::error_code& error);
// void onReceive(const asio::error_code& error, size_t bytes_received);
// void onResponse(const asio::error_code& error);
bool mIsConnected;
asio::streambuf input_buffer_;
asio::io_service mService;
asio::io_service::work mWork;
std::thread mServiceThread;
asio::ip::tcp::socket mSocket;
std::shared_ptr<asio::ip::tcp::resolver> mResolver;
asio::system_timer mTimer;
asio::system_timer mHeartbeatTimer;
std::shared_ptr<Datagram> mIncomingDatagram;
std::string mIncomingMessage;
std::vector<std::function<void(std::shared_ptr<Datagram> msg)> > mOnSendFns;
std::vector<std::function<void(std::shared_ptr<Datagram> msg)> > mOnResponseFns;
};
} // namespace tcp
} // namespace sitara
| 40.416667 | 101 | 0.730241 |
099effe1812fc4f260f64d476ad3396c52ae1de9 | 671 | h | C | include/devif/backends/net/e1000_devif.h | kvenux/barrelfish | 42a741c73e76dd28ed7be5a79eb6e7e4ee40db37 | [
"MIT"
] | 4 | 2017-09-16T01:23:48.000Z | 2017-09-22T08:02:47.000Z | include/devif/backends/net/e1000_devif.h | kvenux/barrelfish | 42a741c73e76dd28ed7be5a79eb6e7e4ee40db37 | [
"MIT"
] | null | null | null | include/devif/backends/net/e1000_devif.h | kvenux/barrelfish | 42a741c73e76dd28ed7be5a79eb6e7e4ee40db37 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2017 ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef E1000_DEVIF_H
#define E1000_DEVIF_H
struct e1000_queue;
// interrupt_mode: 0 - none, 1 - normal, 2 - interrupt test
errval_t e1000_queue_create(struct e1000_queue** q, uint32_t vendor, uint32_t deviceid,
uint32_t bus, uint32_t device, uint32_t function, unsigned interrupt_mode,
void (*isr)(void *));
errval_t e1000_queue_destroy(struct e1000_queue* q);
#endif
| 30.5 | 87 | 0.742176 |
51b3c21395ee0dd11ccb5a4cbd9ebc27db04c33c | 366 | h | C | MatchViewController.h | jzucker2/PubNubPong | fd530253a697ad23cdd538aea2ea844e7d0cc9e3 | [
"MIT"
] | 1 | 2017-01-21T13:32:57.000Z | 2017-01-21T13:32:57.000Z | MatchViewController.h | jzucker2/PubNubPong | fd530253a697ad23cdd538aea2ea844e7d0cc9e3 | [
"MIT"
] | null | null | null | MatchViewController.h | jzucker2/PubNubPong | fd530253a697ad23cdd538aea2ea844e7d0cc9e3 | [
"MIT"
] | null | null | null | //
// MatchViewController.h
// PubNubPong
//
// Created by Jordan Zucker on 6/13/16.
// Copyright © 2016 Jordan Zucker. All rights reserved.
//
#import <UIKit/UIKit.h>
@class PubNub;
@interface MatchViewController : UIViewController
- (instancetype)initWithPubNubClient:(PubNub *)client;
+ (instancetype)matchViewControllerWithClient:(PubNub *)client;
@end
| 19.263158 | 63 | 0.743169 |
550b974a8f354a6223949ebeb757ce0388908178 | 552 | h | C | src/fs.h | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null | src/fs.h | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null | src/fs.h | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null |
struct _DirectoryEntry
{
uint8_t Filename[8];
uint8_t Ext[3];
uint8_t Attrib;
uint8_t Reserved;
uint8_t TimeCreatedMs;
uint16_t TimeCreated;
uint16_t DateCreated;
uint16_t DateLastAccessed;
uint16_t FirstClusterHiBytes;
uint16_t LastModTime;
uint16_t LastModDate;
uint16_t FirstCluster;
uint32_t FileSize;
};
// Filesystem mount information
struct _MountInfo
{
uint32_t NumSectors;
uint32_t FatOffset;
uint32_t NumRootEntries;
uint32_t RootOffset;
uint32_t RootSize;
uint32_t FatSize;
uint32_t ClusterSize;
};
| 17.25 | 31 | 0.771739 |
99e6d72268514af4dc20126ae529131c1b3d707a | 1,854 | h | C | threepp/light/LightShadow.h | Graphics-Physics-Libraries/three.cpp-imported | 788b4202e15fa245a4b60e2da0b91f7d4d0592e1 | [
"MIT"
] | 76 | 2017-12-20T05:09:04.000Z | 2022-01-24T10:20:15.000Z | threepp/light/LightShadow.h | melMass/three.cpp | 5a328b40036e359598baec8b3fcddae4f33e410a | [
"MIT"
] | 5 | 2018-06-06T15:41:01.000Z | 2019-11-30T15:10:25.000Z | threepp/light/LightShadow.h | melMass/three.cpp | 5a328b40036e359598baec8b3fcddae4f33e410a | [
"MIT"
] | 23 | 2017-10-12T16:46:33.000Z | 2022-03-16T06:16:03.000Z | //
// Created by byter on 14.09.17.
//
#ifndef THREEPP_LIGHTSHADOW_H
#define THREEPP_LIGHTSHADOW_H
#include <type_traits>
#include <threepp/camera/PerspectiveCamera.h>
#include <threepp/math/Vector2.h>
#include <threepp/renderers/Renderer.h>
#include "Light.h"
namespace three {
class Light;
class LightShadow
{
protected:
float _bias = 0;
float _radius = 1;
math::Vector2 _mapSize {512, 512};
Renderer::Target::Ptr _map;
math::Matrix4 _matrix;
public:
using Ptr = std::shared_ptr<LightShadow>;
float bias() const {return _bias;}
float radius() const {return _radius;}
float &bias() {return _bias;}
float &radius() {return _radius;}
const math::Vector2 &mapSize() const {return _mapSize;}
math::Vector2 &mapSize() {return _mapSize;}
const Renderer::Target::Ptr &map() const {return _map;}
void setMap(const Renderer::Target::Ptr &map) {_map = map;}
math::Matrix4 &matrix() {return _matrix;}
const math::Matrix4 &matrix() const {return _matrix;}
virtual const Camera::Ptr camera() const = 0;
virtual void update() {}
virtual LightShadow *cloned() const = 0;
};
template <typename Camera_t>
class LightShadowT : public LightShadow
{
static_assert(std::is_base_of<three::Camera, Camera_t>::value, "Camera_t must be a three::Camera subtype");
friend class LightShadow;
protected:
typename Camera_t::Ptr _camera;
explicit LightShadowT(typename Camera_t::Ptr camera) : _camera(camera) {}
public:
using Ptr = std::shared_ptr<LightShadowT>;
static Ptr make(std::shared_ptr<Camera_t> camera) {
return Ptr(new LightShadowT(camera));
}
const Camera::Ptr camera() const override {return _camera;}
const typename Camera_t::Ptr camera_t() const {return _camera;}
LightShadowT *cloned() const override {
return new LightShadowT(*this);
}
};
}
#endif //THREEPP_LIGHTSHADOW_H
| 22.337349 | 109 | 0.714671 |
ab2cf3f87631b4cc76f13de124df86921b5620ae | 264 | h | C | VChat/Me/SexTableViewCell.h | Re-cover/VChat | ce0afd2c852dcc1809b6e023f58a316e02d5d628 | [
"MIT"
] | null | null | null | VChat/Me/SexTableViewCell.h | Re-cover/VChat | ce0afd2c852dcc1809b6e023f58a316e02d5d628 | [
"MIT"
] | null | null | null | VChat/Me/SexTableViewCell.h | Re-cover/VChat | ce0afd2c852dcc1809b6e023f58a316e02d5d628 | [
"MIT"
] | null | null | null | //
// SexTableViewCell.h
// VChat
//
// Created by Recover on 16/5/19.
// Copyright © 2016年 Recover. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SexTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *sexLabel;
@end
| 16.5 | 55 | 0.708333 |
0561831d1283fce720c8bd5924ee4cd03bedcb21 | 488 | h | C | include/pegasocks/codec/vmess.h | mokhtarabadi/pegasocks | 7e51669de256024a21f29c72c1761879f6925af9 | [
"BSD-3-Clause"
] | 105 | 2020-07-31T18:20:11.000Z | 2022-02-08T17:59:54.000Z | include/pegasocks/codec/vmess.h | mokhtarabadi/pegasocks | 7e51669de256024a21f29c72c1761879f6925af9 | [
"BSD-3-Clause"
] | 19 | 2020-07-12T07:51:19.000Z | 2022-01-05T01:45:20.000Z | include/pegasocks/codec/vmess.h | mokhtarabadi/pegasocks | 7e51669de256024a21f29c72c1761879f6925af9 | [
"BSD-3-Clause"
] | 34 | 2020-07-23T08:49:50.000Z | 2021-12-07T05:24:23.000Z | #ifndef _PGS_CODEC_VMESS_H
#define _PGS_CODEC_VMESS_H
#include "session/session.h"
typedef void (*pgs_session_write_fn)(pgs_session_t *, uint8_t *, size_t);
typedef struct pgs_vmess_resp_s {
uint8_t v;
uint8_t opt;
uint8_t cmd;
uint8_t m;
} pgs_vmess_resp_t;
bool vmess_write_remote(pgs_session_t *session, const uint8_t *data,
size_t data_len, size_t *olen);
bool vmess_write_local(pgs_session_t *session, const uint8_t *data,
size_t data_len, size_t *olen);
#endif
| 23.238095 | 73 | 0.770492 |
05a87f1e3409b78edbf6325717d124912ce4a0e4 | 11,087 | h | C | src/mongo/db/pipeline/document_source_merge.h | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/mongo/db/pipeline/document_source_merge.h | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/mongo/db/pipeline/document_source_merge.h | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright (C) 2019-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* 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
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#pragma once
#include "mongo/db/pipeline/document_source_merge_gen.h"
#include "mongo/db/pipeline/document_source_writer.h"
#include "mongo/db/pipeline/lite_parsed_pipeline.h"
namespace mongo {
/**
* A class for the $merge aggregation stage to handle all supported merge modes. Each instance of
* this class must be initialized (via a constructor) with a 'MergeDescriptor', which defines a
* a particular merge strategy for a pair of 'whenMatched' and 'whenNotMatched' merge modes.
*/
class DocumentSourceMerge final : public DocumentSourceWriter<MongoProcessInterface::BatchObject> {
public:
static constexpr StringData kStageName = "$merge"_sd;
// A descriptor for a merge strategy. Holds a merge strategy function and a set of actions
// the client should be authorized to perform in order to be able to execute a merge operation
// using this merge strategy.
struct MergeStrategyDescriptor {
using WhenMatched = MergeWhenMatchedModeEnum;
using WhenNotMatched = MergeWhenNotMatchedModeEnum;
using MergeMode = std::pair<WhenMatched, WhenNotMatched>;
// A function encapsulating a merge strategy for the $merge stage based on the pair of
// whenMatched/whenNotMatched modes.
using MergeStrategy = std::function<void(const boost::intrusive_ptr<ExpressionContext>&,
const NamespaceString&,
const WriteConcernOptions&,
boost::optional<OID>,
BatchedObjects&&)>;
MergeMode mode;
ActionSet actions;
MergeStrategy strategy;
};
/**
* A "lite parsed" $merge stage to disallow passthrough from mongos even if the source
* collection is unsharded. This ensures that the unique index verification happens once on
* mongos and can be bypassed on the shards.
*/
class LiteParsed final : public LiteParsedDocumentSourceNestedPipelines {
public:
LiteParsed(std::string parseTimeName,
NamespaceString foreignNss,
MergeWhenMatchedModeEnum whenMatched,
MergeWhenNotMatchedModeEnum whenNotMatched,
boost::optional<LiteParsedPipeline> onMatchedPipeline)
: LiteParsedDocumentSourceNestedPipelines(
std::move(parseTimeName), std::move(foreignNss), std::move(onMatchedPipeline)),
_whenMatched(whenMatched),
_whenNotMatched(whenNotMatched) {}
static std::unique_ptr<LiteParsed> parse(const NamespaceString& nss,
const BSONElement& spec);
bool allowedToPassthroughFromMongos() const {
return false;
}
ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
bool isImplicitDefault) const final {
ReadConcernSupportResult result = {
{level == repl::ReadConcernLevel::kLinearizableReadConcern,
{ErrorCodes::InvalidOptions,
"{} cannot be used with a 'linearizable' read concern level"_format(kStageName)}},
Status::OK()};
auto pipelineReadConcern = LiteParsedDocumentSourceNestedPipelines::supportsReadConcern(
level, isImplicitDefault);
// Merge the result from the sub-pipeline into the $merge specific read concern result
// to preserve the $merge errors over the internal pipeline errors.
result.merge(pipelineReadConcern);
return result;
}
PrivilegeVector requiredPrivileges(bool isMongos,
bool bypassDocumentValidation) const final;
private:
MergeWhenMatchedModeEnum _whenMatched;
MergeWhenNotMatchedModeEnum _whenNotMatched;
};
virtual ~DocumentSourceMerge() = default;
const char* getSourceName() const final {
return kStageName.rawData();
}
StageConstraints constraints(Pipeline::SplitState pipeState) const final;
boost::optional<DistributedPlanLogic> distributedPlanLogic() final;
Value serialize(boost::optional<ExplainOptions::Verbosity> explain = boost::none) const final;
/**
* Creates a new $merge stage from the given arguments.
*/
static boost::intrusive_ptr<DocumentSource> create(
NamespaceString outputNs,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
MergeStrategyDescriptor::WhenMatched whenMatched,
MergeStrategyDescriptor::WhenNotMatched whenNotMatched,
boost::optional<BSONObj> letVariables,
boost::optional<std::vector<BSONObj>> pipeline,
std::set<FieldPath> mergeOnFields,
boost::optional<ChunkVersion> targetCollectionVersion);
/**
* Parses a $merge stage from the user-supplied BSON.
*/
static boost::intrusive_ptr<DocumentSource> createFromBson(
BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& pExpCtx);
auto getPipeline() const {
return _pipeline;
}
void initialize() override {
// This implies that the stage will soon start to write, so it's safe to verify the target
// collection version. This is done here instead of parse time since it requires that locks
// are not held.
if (!pExpCtx->inMongos && _targetCollectionVersion) {
// If mongos has sent us a target shard version, we need to be sure we are prepared to
// act as a router which is at least as recent as that mongos.
pExpCtx->mongoProcessInterface->checkRoutingInfoEpochOrThrow(
pExpCtx, getOutputNs(), *_targetCollectionVersion);
}
}
private:
/**
* Builds a new $merge stage which will merge all documents into 'outputNs'. If
* 'targetCollectionVersion' is provided then processing will stop with an error if the
* collection's epoch changes during the course of execution. This is used as a mechanism to
* prevent the shard key from changing.
*/
DocumentSourceMerge(NamespaceString outputNs,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
const MergeStrategyDescriptor& descriptor,
boost::optional<BSONObj> letVariables,
boost::optional<std::vector<BSONObj>> pipeline,
std::set<FieldPath> mergeOnFields,
boost::optional<ChunkVersion> targetCollectionVersion);
/**
* Creates an UpdateModification object from the given 'doc' to be used with the batched update.
*/
auto makeBatchUpdateModification(const Document& doc) const {
return _pipeline ? write_ops::UpdateModification(*_pipeline)
: write_ops::UpdateModification::parseFromClassicUpdate(doc.toBson());
}
/**
* Resolves 'let' defined variables against the 'doc' and stores the results in the returned
* BSON.
*/
boost::optional<BSONObj> resolveLetVariablesIfNeeded(const Document& doc) const {
// When we resolve 'let' variables, an empty BSON object or boost::none won't make any
// difference at the end-point (in the PipelineExecutor), as in both cases we will end up
// with the update pipeline ExpressionContext not being populated with any variables, so we
// are not making a distinction between these two cases here.
if (!_letVariables || _letVariables->empty()) {
return boost::none;
}
BSONObjBuilder bob;
for (auto&& [name, expr] : *_letVariables) {
bob << name << expr->evaluate(doc, &pExpCtx->variables);
}
return bob.obj();
}
void spill(BatchedObjects&& batch) override;
void waitWhileFailPointEnabled() override;
std::pair<BatchObject, int> makeBatchObject(Document&& doc) const override;
boost::optional<ChunkVersion> _targetCollectionVersion;
// A merge descriptor contains a merge strategy function describing how to merge two
// collections, as well as some other metadata needed to perform the merge operation. This is
// a reference to an element in a static const map 'kMergeStrategyDescriptors', which owns the
// descriptor.
const MergeStrategyDescriptor& _descriptor;
// Holds 'let' variables defined in this stage. These variables are propagated to the
// ExpressionContext of the pipeline update for use in the inner pipeline execution. The key
// of the map is a variable name as defined in the $merge spec 'let' argument, and the value is
// a parsed Expression, defining how the variable value must be evaluated.
boost::optional<stdx::unordered_map<std::string, boost::intrusive_ptr<Expression>>>
_letVariables;
// A custom pipeline to compute a new version of merging documents.
boost::optional<std::vector<BSONObj>> _pipeline;
// Holds the fields used for uniquely identifying documents. There must exist a unique index
// with this key pattern. Default is "_id" for unsharded collections, and "_id" plus the shard
// key for sharded collections.
std::set<FieldPath> _mergeOnFields;
// True if '_mergeOnFields' contains the _id. We store this as a separate boolean to avoid
// repeated lookups into the set.
bool _mergeOnFieldsIncludesId;
};
} // namespace mongo
| 46.389121 | 100 | 0.67268 |
5ed68ff452c9baeca8ba51283686877e12aad2e1 | 31 | c | C | scripts/4_World/Entities/Firearms/Rifle/Trumpet.c | Da0ne/DayZCommunityOfflineMode | 77ebd221a877270e704c75bcc529a7b97c918f2e | [
"MIT"
] | 1 | 2018-11-07T18:38:15.000Z | 2018-11-07T18:38:15.000Z | SourceCode/scripts/4_World/Entities/Firearms/Rifle/Trumpet.c | DevulTj/DayZOfflineMode | 0ba7e58858c7cd62e6a08f451ba60a3961575353 | [
"MIT"
] | null | null | null | SourceCode/scripts/4_World/Entities/Firearms/Rifle/Trumpet.c | DevulTj/DayZOfflineMode | 0ba7e58858c7cd62e6a08f451ba60a3961575353 | [
"MIT"
] | null | null | null | class Trumpet : Rifle_Base
{
}; | 10.333333 | 26 | 0.709677 |
193a40f8b10e31741b34edc1df20d4cee7ad7009 | 8,382 | h | C | include/fluid/data_structures/short_vec.h | lukedan/libfluid | cb78d82a34b3d01d3278ef39274a0b4ce72bcde8 | [
"Apache-2.0"
] | 15 | 2020-03-24T14:55:17.000Z | 2021-12-18T06:16:18.000Z | include/fluid/data_structures/short_vec.h | lukedan/libfluid | cb78d82a34b3d01d3278ef39274a0b4ce72bcde8 | [
"Apache-2.0"
] | 1 | 2021-08-28T02:22:28.000Z | 2021-08-28T02:22:28.000Z | include/fluid/data_structures/short_vec.h | lukedan/libfluid | cb78d82a34b3d01d3278ef39274a0b4ce72bcde8 | [
"Apache-2.0"
] | 3 | 2020-12-03T17:23:25.000Z | 2021-10-05T12:16:40.000Z | #pragma once
/// \file
/// Short vectors.
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <utility>
namespace fluid {
/// A short vector. The vector itself has capacity for \p Count elements, and if more elements are added all
/// elements will be moved to heap-allocated memory.
template <typename T, std::size_t Count> struct short_vec {
template <typename, std::size_t> friend struct short_vec;
public:
using value_type = T; ///< Value type.
using size_type = std::size_t; ///< Size type.
using difference_type = std::ptrdiff_t; ///< Difference type.
using reference = value_type&; ///< Reference type;
using const_reference = const value_type&; ///< Const reference type;
using pointer = value_type*; ///< Pointer type.
using const_pointer = const value_type*; ///< Const pointer type.
using iterator = T*; ///< Iterator type.
using const_iterator = const T*; ///< Const iterator type.
/// Initializes this short vector to be empty.
short_vec() : _first(_local), _last(_local) {
}
/// Copy construction.
template <std::size_t OtherCount> short_vec(const short_vec<T, OtherCount> &source) {
size_type src_count = source.size();
if (src_count <= Count) { // don't allocate
_first = _local;
_last = _local + src_count;
} else { // allocate
size_type cap = src_count;
_first = _alloc(cap);
_last = _capacity = _first + cap;
}
// copy elements
auto src = source.begin();
for (T *dst = _first; dst != _last; ++src, ++dst) {
new (dst) T(*src);
}
}
/// Move construction.
template <std::size_t OtherCount> short_vec(short_vec<T, OtherCount> &&source) {
if (!source._using_internal()) { // always take over memory
_first = source._first;
_last = source._last;
_capacity = source._capacity;
} else { // prefer using internal storage
size_type src_count = source.size();
if (src_count <= Count) { // use internal storage
_first = _local;
_last = _local + src_count;
} else {
size_type cap = src_count;
_first = _alloc(cap);
_last = _capacity = _first + cap;
}
// move elements
for (T *src = source._first, *dst = _first; dst != _last; ++src, ++dst) {
new (dst) T(std::move(*src));
src->~T();
}
}
source._first = source._last = source._local; // reset source
}
/// Copy assignment.
template <std::size_t OtherCount> short_vec &operator=(const short_vec<T, OtherCount> &source) {
// first destroy all existing elements
for (T *cur = _first; cur != _last; ++cur) {
cur->~T();
}
// decide where to store elements, result stored in _first
size_type src_count = source.size();
if (src_count <= Count) { // can use local storage
if (!_using_internal()) { // has heap storage
if (capacity() < src_count) { // not enough capacity, just use local instead
_free(_first);
_first = _local;
} // otherwise use heap storage
}
} else {
if (_using_internal()) { // allocate memory
size_type cap = src_count;
_first = _alloc(cap);
_capacity = _first + cap;
} else { // already has allocated heap memory
if (capacity() < src_count) { // not enough space
_free(_first);
size_type cap = src_count;
_first = _alloc(cap);
_capacity = _first + cap;
} // otherwise use old memory
}
}
_last = _first + src_count; // adjust _last
// copy elements
auto src = source.begin();
for (T *dst = _first; dst != _last; ++src, ++dst) {
new (dst) T(*src);
}
return *this;
}
/// Move assignment.
template <std::size_t OtherCount> short_vec &operator=(short_vec<T, OtherCount> &&source) {
// first destroy all existing elements
for (T *cur = _first; cur != _last; ++cur) {
cur->~T();
}
if (source._using_internal()) {
size_type src_count = source.size();
if (src_count > capacity()) { // have to allocate new memory no matter what
if (!_using_internal()) {
_free(_first);
}
size_type cap = src_count;
_first = _alloc(cap);
_capacity = _first + cap;
} // otherwise simply move elements over
_last = _first + src_count; // update _last
// move elements over
for (T *src = source._first, *dst = _first; dst != _last; ++src, ++dst) {
new (dst) T(std::move(*src));
src->~T();
}
} else { // just take over
if (!_using_internal()) {
_free(_first);
}
_first = source._first;
_last = source._last;
_capacity = source._capacity;
}
source._first = source._last = source._local; // reset source
return *this;
}
/// Destroys all elements and, if necessary, frees allocated memory.
~short_vec() {
for (T *cur = _first; cur != _last; ++cur) {
cur->~T();
}
if (!_using_internal()) {
_free(_first);
}
}
/// Returns the size of this vector.
size_type size() const {
return _last - _first;
}
/// Returns the capacity of this vector.
size_type capacity() const {
return _using_internal() ? Count : _capacity - _first;
}
/// Returns whether this vector is empty.
bool empty() const {
return _first == _last;
}
// modification
/// Constructs a new element in-place at the back of this vector.
template <typename ...Args> reference emplace_back(Args &&...args) {
size_type cur_size = size();
if (cur_size == capacity()) { // full, needs extension
size_type new_cap = _extended_capacity();
T *new_array = _alloc(new_cap);
// construct the new element first
new (new_array + cur_size) T(std::forward<Args>(args)...);
// then move the rest elements
for (T *src = _first, *dst = new_array; src != _last; ++src, ++dst) {
new (dst) T(std::move(*src));
src->~T();
}
if (!_using_internal()) { // free previously allocated memory
_free(_first);
}
// no member has been altered yet, start now
_first = new_array;
_last = new_array + cur_size;
_capacity = new_array + new_cap;
} else { // simply construct in-place
new (_last) T(std::forward<Args>(args)...);
}
return *(_last++);
}
/// Returns the last element.
reference back() {
assert(!empty());
return *(_last - 1);
}
/// \overload
const_reference back() const {
assert(!empty());
return *(_last - 1);
}
/// Pops an element from the back of this vector.
void pop_back() {
assert(!empty());
--_last;
_last->~T();
// TODO shrink?
}
/// Clears the contents of this vector without freeing heap memory.
void clear() {
for (T *cur = _first; cur != _last; ++cur) {
cur->~T();
}
_last = _first;
}
// indexing
/// Returns an iterator to the first element.
iterator begin() {
return _first;
}
/// Returns an iterator past the last element.
iterator end() {
return _last;
}
/// \overload
const_iterator begin() const {
return _first;
}
/// \overload
const_iterator end() const {
return _last;
}
/// Indexing.
reference at(size_type i) {
assert(i < size());
return _first[i];
}
/// \overload
const_reference at(size_type i) const {
assert(i < size());
return _first[i];
}
/// Indexing.
reference operator[](size_type i) {
return at(i);
}
/// \overload
const_reference operator[](size_type i) const {
return at(i);
}
private:
union {
T _local[Count]; ///< Elements that are stored on the stack.
T *_capacity; ///< The capacity of (past) this vector, when using heap-allocated memory.
};
T
*_first = nullptr, ///< Pointer to the first element.
*_last = nullptr; ///< Pointer past the last element.
/// Allocates memory for the specified number of elements.
inline static T *_alloc(size_type count) {
#ifdef _MSC_VER
return static_cast<T*>(::_aligned_malloc(sizeof(T) * count, alignof(T)));
#else
return static_cast<T*>(std::aligned_alloc(alignof(T), sizeof(T) * count));
#endif
}
/// Frees memory.
inline static void _free(T *ptr) {
#ifdef _MSC_VER
::_aligned_free(ptr);
#else
std::free(ptr);
#endif
}
/// Returns whether this vector is using the internal array.
bool _using_internal() const {
return _first == _local;
}
/// Returns the capacity if it were to be extended.
size_type _extended_capacity() const {
return static_cast<size_type>(capacity() * 1.5); // TODO magic number
}
};
}
| 28.804124 | 109 | 0.623479 |
c39b90b07d1e65cca2478786bb0823ee8c87ec23 | 1,043 | h | C | extensions/ImGuiEXT/imgui_impl_adxe.h | rh101/engine-x | 17ad9829dd410c689857760b6ece89d99e877a95 | [
"MIT"
] | 76 | 2021-05-20T12:27:10.000Z | 2022-03-23T15:27:42.000Z | extensions/ImGuiEXT/imgui_impl_adxe.h | rh101/engine-x | 17ad9829dd410c689857760b6ece89d99e877a95 | [
"MIT"
] | 171 | 2021-05-18T11:07:25.000Z | 2022-03-29T20:53:27.000Z | extensions/ImGuiEXT/imgui_impl_adxe.h | rh101/engine-x | 17ad9829dd410c689857760b6ece89d99e877a95 | [
"MIT"
] | 42 | 2021-05-18T10:05:06.000Z | 2022-03-22T05:40:56.000Z | #pragma once
#include "imgui/imgui.h"
typedef void (*ImGuiImplCocos2dxLoadFontFun)(void* userdata);
IMGUI_IMPL_API bool ImGui_ImplAdxe_Init(bool install_callbacks);
IMGUI_IMPL_API void ImGui_ImplAdxe_Shutdown();
IMGUI_IMPL_API void ImGui_ImplAdxe_NewFrame();
IMGUI_IMPL_API void ImGui_ImplAdxe_RenderDrawData(ImDrawData* draw_data);
IMGUI_IMPL_API void ImGui_ImplAdxe_RenderPlatform();
// Called by Init/NewFrame/Shutdown
// TODO: maybe hide for internal use only
IMGUI_IMPL_API bool ImGui_ImplAdxe_CreateDeviceObjects();
IMGUI_IMPL_API void ImGui_ImplAdxe_DestroyDeviceObjects();
// TODO: check whether needs public this API
IMGUI_IMPL_API bool ImGui_ImplAdxe_CreateFontsTexture();
IMGUI_IMPL_API void ImGui_ImplAdxe_DestroyFontsTexture();
// Get FontTexture object cocos2d::Texture2D*
IMGUI_IMPL_API void ImGui_ImplAdxe_SetCustomFontLoader(ImGuiImplCocos2dxLoadFontFun fun, void* userdata);
IMGUI_IMPL_API void* ImGui_ImplAdxe_GetFontsTexture();
// Sets Device objects dirty
IMGUI_IMPL_API void ImGui_ImplAdxe_SetDeviceObjectsDirty();
| 38.62963 | 105 | 0.85139 |
c7b54b871f032a26e547fe630c209f9f1a6fa36b | 3,272 | h | C | src/SubscriptionClientImpl.h | hbdmapi/huobi_swap_Cpp | f316cc1cfa349752f95e9289950a9d3c804d57b2 | [
"Apache-2.0"
] | 9 | 2020-05-27T05:40:07.000Z | 2022-02-07T22:56:25.000Z | src/SubscriptionClientImpl.h | hbdmapi/huobi_swap_Cpp | f316cc1cfa349752f95e9289950a9d3c804d57b2 | [
"Apache-2.0"
] | 2 | 2020-09-04T19:43:02.000Z | 2021-01-20T11:28:14.000Z | src/SubscriptionClientImpl.h | hbdmapi/huobi_swap_Cpp | f316cc1cfa349752f95e9289950a9d3c804d57b2 | [
"Apache-2.0"
] | 4 | 2020-05-28T03:55:56.000Z | 2021-03-03T15:23:18.000Z | #ifndef WEBSOCKETIMPL_H
#define WEBSOCKETIMPL_H
#include <list>
#include "HuobiSwap/SubscriptionClient.h"
#include "HuobiSwap/SubscriptionOptions.h"
#include "WebSocketApiImpl.h"
#include "WebSocketRequest.h"
#include "WebSocketConnection.h"
#include "WebSocketWatchDog.h"
#include "HuobiSwap/RequestOptions.h"
#include "GetHost.h"
#include "RestApiImpl.h"
namespace HuobiSwap {
class SubscriptionClientImpl : public SubscriptionClient {
private:
std::string apiKey;
std::string secretKey;
WebSocketApiImpl *impl;
std::list<WebSocketConnection*> connectionList;
SubscriptionOptions op;
std::string host = "api.hbdm.vn";
WebSocketWatchDog* dog = nullptr;
struct lws_context* context = nullptr;
public:
void startService() override;
void startReq(WebSocketRequest* webSocketRequest);
void init_context();
SubscriptionClientImpl() {
apiKey = "";
secretKey = "";
impl = new WebSocketApiImpl(apiKey, secretKey);
}
SubscriptionClientImpl(SubscriptionOptions& op) {
apiKey = "";
secretKey = "";
impl = new WebSocketApiImpl(apiKey, secretKey);
this->op = op;
}
SubscriptionClientImpl(
std::string apiKey,
std::string secretKey, SubscriptionOptions& op) {
this->apiKey = apiKey;
this->secretKey = secretKey;
this->op = op;
impl = new WebSocketApiImpl(apiKey, secretKey);
if (!op.url.empty()) {
host = GetHost(op.url);
RequestOptions resop;
resop.url = op.url;
RestApiImpl* restimpl = new RestApiImpl(apiKey.c_str(), secretKey.c_str(), resop);
delete restimpl;
} else {
RestApiImpl* restimpl = new RestApiImpl(apiKey.c_str(), secretKey.c_str());
delete restimpl;
}
}
~SubscriptionClientImpl() {
delete dog;
delete impl;
}
void createConnection(WebSocketRequest* request);
void subscribeCandlestickEvent(
const char* symbols,
CandlestickInterval interval,
const std::function<void(const CandlestickEvent&) >& callback,
const std::function<void(Error&)>& errorHandler = std::function<void(Error&)>()) override;
void subscribeOrderUpdateEvent(
const char* symbols,
const std::function<void(const OrderUpdateEvent&) >& callback,
const std::function<void(Error&)>& errorHandler = std::function<void(Error&)>()) override;
WebSocketRequest* requestCandlestickEvent(
bool autoClose,
const char* symbols,
CandlestickInterval interval,
long startTime,
long endTime,
const std::function<void(const std::vector<CandlestickEvent>&) >& callback,
const std::function<void(Error&)>& errorHandler);
private:
std::list<std::string> parseSymbols(const char* symbols);
};
}
#endif /* WEBSOCKETIMPL_H */
| 31.76699 | 106 | 0.585269 |
242f7aa6eb49df99195f8a82f4f0a307b01a2961 | 1,765 | h | C | FuzzyAutocomplete/DVTTextCompletionSession+FuzzyAutocomplete.h | ratanki/FuzzyAutocompletePlugin | a65991e031ed4888bdfd8cbe0f16dc70209b15a5 | [
"MIT"
] | 2,039 | 2015-01-01T13:28:59.000Z | 2022-03-24T18:45:01.000Z | FuzzyAutocomplete/DVTTextCompletionSession+FuzzyAutocomplete.h | ratanki/FuzzyAutocompletePlugin | a65991e031ed4888bdfd8cbe0f16dc70209b15a5 | [
"MIT"
] | 71 | 2015-01-08T01:55:27.000Z | 2017-04-20T12:53:12.000Z | FuzzyAutocomplete/DVTTextCompletionSession+FuzzyAutocomplete.h | ratanki/FuzzyAutocompletePlugin | a65991e031ed4888bdfd8cbe0f16dc70209b15a5 | [
"MIT"
] | 351 | 2015-01-01T05:33:56.000Z | 2021-12-18T15:54:13.000Z | //
// DVTTextCompletionSession+FuzzyAutocomplete.h
// FuzzyAutocomplete
//
// Created by Jack Chen on 19/10/2013.
// Copyright (c) 2013 Sproutcube. All rights reserved.
//
// Extended by Leszek Slazynski.
// Copyright (c) 2014 United Lines of Code. All rights reserved.
//
#import "DVTTextCompletionSession.h"
@protocol DVTTextCompletionItem;
@interface DVTTextCompletionSession (FuzzyAutocomplete)
/// Swizzles methods to enable/disable the plugin
+ (void) fa_swizzleMethods;
/// Current filtering query.
- (NSString *) fa_filteringQuery;
/// Time (in seconds) spent on last filtering operation.
- (NSTimeInterval) fa_lastFilteringTime;
/// Number of items with non-zero scores.
- (NSUInteger) fa_nonZeroScores;
/// Gets array of ranges matched by current search string in given items name.
- (NSArray *) fa_matchedRangesForItem: (id<DVTTextCompletionItem>) item;
/// Gets array of ranges matched in second pass by current search string in given items name.
- (NSArray *) fa_secondPassMatchedRangesForItem: (id<DVTTextCompletionItem>) item;
/// Retrieves a previously calculated autocompletion score for given item.
- (NSNumber *) fa_scoreForItem: (id<DVTTextCompletionItem>) item;
/// Try to convert ranges ocurring in fromString into toString.
/// Optionally offsets the resulting ranges.
///
/// Handled cases:
///
/// a) fromString is a substring of toString - offset ranges
///
/// b) both fromString and toString contain word segments
/// try to find ranges within segments (may divide ranges)
///
- (NSArray *) fa_convertRanges: (NSArray *) originalRanges
fromString: (NSString *) fromString
toString: (NSString *) toString
addOffset: (NSUInteger) additionalOffset;
@end
| 30.964912 | 93 | 0.726346 |
beae37dcab9ed96c532ae2d6e473fee430d1b2eb | 1,663 | h | C | Native/src/uAsset/FontFace.h | fuse-open/Uno.Native | 541e40e78a70e30934563d9a99961ac37124ef0e | [
"MIT"
] | 2 | 2018-05-15T18:05:24.000Z | 2018-07-23T01:49:51.000Z | Native/src/uAsset/FontFace.h | fuse-open/Uno.Native | 541e40e78a70e30934563d9a99961ac37124ef0e | [
"MIT"
] | null | null | null | Native/src/uAsset/FontFace.h | fuse-open/Uno.Native | 541e40e78a70e30934563d9a99961ac37124ef0e | [
"MIT"
] | 4 | 2018-05-14T17:03:52.000Z | 2018-12-01T08:05:58.000Z | #ifndef __UASSETS_FONT_FACE_H__
#define __UASSETS_FONT_FACE_H__
#include <uAsset/Base.h>
/**
\ingroup uFontFace
*/
struct uFontFaceInfo
{
uString FamilyName;
uString StyleName;
};
/**
\ingroup uFontFace
*/
struct uFontLineMetricInfo
{
float Ascender;
float Descender;
float LineHeight;
};
/**
\ingroup uFontFace
*/
struct uFontKerningInfo
{
float KerningX;
float KerningY;
};
/**
\ingroup uFontFace
*/
enum uFontRenderMode
{
uFontRenderModeNone = 0,
uFontRenderModeNormal = 1,
uFontRenderModeMonochrome = 2,
uFontRenderModeForceInt = 0x7fffffff,
};
/**
\ingroup uFontFace
*/
struct uFontGlyphInfo
{
float AdvanceX;
float AdvanceY;
float BearingX;
float BearingY;
int BitmapWidth;
int BitmapHeight;
int PixelFormat;
};
/**
\addtogroup uFontFace
@{
*/
EXPORT int STDCALL uLoadFontFace(uHandle handle, uString filename, uFontFaceInfo* result);
EXPORT int STDCALL uLoadFontFaceFromMemory(uHandle handle, void* data, int size, uFontFaceInfo* result);
EXPORT int STDCALL uFontFace_GetLineMetrics(uHandle handle, float pixelSize, uFontLineMetricInfo* result);
EXPORT int STDCALL uFontFace_GetKerning(uHandle handle, float pixelSize, unsigned int left, unsigned int right, uFontKerningInfo* result);
EXPORT int STDCALL uFontFace_ContainsGlyph(uHandle handle, float pixelSize, unsigned int glyph, int* result);
EXPORT int STDCALL uFontFace_RenderGlyph(uHandle handle, float pixelSize, unsigned int glyph, uFontRenderMode mode, uFontGlyphInfo* result);
EXPORT int STDCALL uFontFace_ReadGlyphBitmap(uHandle handle, void* result, int byteCount);
/** @} */
#endif
| 21.597403 | 140 | 0.744438 |
d57e0b7522c837d9244c5719033cdae11efc744d | 938 | h | C | Rootkits/vault/90210/sw_remove/bruteforcer.h | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | 46 | 2017-05-15T11:15:08.000Z | 2018-07-02T03:32:52.000Z | Rootkits/vault/90210/sw_remove/bruteforcer.h | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | null | null | null | Rootkits/vault/90210/sw_remove/bruteforcer.h | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | 24 | 2017-05-17T03:26:17.000Z | 2018-07-09T07:00:50.000Z | /*++
Module Name:
bruteforcer.h
Abstract:
Int 0x0e handler bruteforcer definitions.
Author:
90210 19-Aug-2005
--*/
#ifndef _BRUTEFORCER_
#define _BRUTEFORCER_
#include <ntddk.h>
#include "util.h"
#include "codewalk.h"
#include "int0e.h"
extern PVOID g_NtoskrnlStart;
extern PVOID g_NtoskrnlEnd;
typedef struct _KNOWN_BRANCH {
LIST_ENTRY le;
PVOID Address; // execution will somehow come to the iretd or to the unpredictable jump from this address
ULONG Kind; // kind of the branch - does it pass execution to the original handler or not (KIND_PASSDOWN or KIND_ENDS_WITH_IRETD)
} KNOWN_BRANCH, *PKNOWN_BRANCH;
NTSTATUS NTAPI StartTracer();
#define PAGE_ADDRESS_ADDITION 0x800
extern PUCHAR g_Int0EHandler;
extern LIST_ENTRY g_KnownBranches;
extern ULONG g_PageToCheck;
extern KEVENT g_ShutdownEvent;
extern PETHREAD g_BruteforcerThread;
#endif // _BRUTEFORCER_ | 19.957447 | 131 | 0.739872 |
41878d9e5966ad938d0f4a86eed017b03dd0f433 | 1,134 | h | C | src/H5_type_info.h | Jiefei-Wang/HighFive | 51532adb27b7f354d36d988a9eb9866ff29f9d87 | [
"MIT"
] | 1 | 2020-12-12T17:40:23.000Z | 2020-12-12T17:40:23.000Z | src/H5_type_info.h | Jiefei-Wang/HighFive | 51532adb27b7f354d36d988a9eb9866ff29f9d87 | [
"MIT"
] | null | null | null | src/H5_type_info.h | Jiefei-Wang/HighFive | 51532adb27b7f354d36d988a9eb9866ff29f9d87 | [
"MIT"
] | null | null | null | #ifndef HEADER_H5_TYPE_INFO
#define HEADER_H5_TYPE_INFO
#include <vector>
#include "H5Cpp.h"
class H5_type_info;
struct Compound_info{
H5::CompType type;
size_t elt_numbers;
std::vector<H5_type_info> elt_types;
std::vector<size_t> elt_offsets;
std::vector<H5std_string> elt_names;
Compound_info(H5::CompType& type);
};
struct Simple_info{
H5::DataType type;
Simple_info(H5::DataType& type);
};
class H5_type_info{
private:
H5T_class_t type_class;
size_t type_size;
void* type_object_ptr = nullptr;
public:
H5_type_info(){}
H5_type_info(H5::DataSet &dataset);
H5_type_info(H5::CompType& type);
H5_type_info(H5::DataType& type);
H5_type_info(const H5_type_info &t);
H5_type_info& operator = (const H5_type_info &t);
~H5_type_info();
H5T_class_t get_type_class() const;
size_t get_type_size() const;
Compound_info& get_compound_info() const;
Simple_info& get_simple_info() const;
private:
void init(H5::DataSet &dataset);
void init(H5::CompType &type);
void init(H5::DataType &type);
void copy(const H5_type_info &t);
};
#endif | 24.652174 | 54 | 0.707231 |
3b8576addb08a7ebca91d7378f5987ef3fd096d5 | 324 | h | C | Headers/Frameworks/ProInspector/OZGradientColorGroupController.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | 3 | 2020-11-19T10:04:02.000Z | 2021-10-02T17:25:21.000Z | Headers/Frameworks/ProInspector/OZGradientColorGroupController.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | null | null | null | Headers/Frameworks/ProInspector/OZGradientColorGroupController.h | CommandPost/FinalCutProFrameworks | d98b00ff0c84af80942d71514e9238d624aca50a | [
"MIT"
] | null | null | null | //
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Mar 11 2021 20:53:35).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <ProInspector/OZViewControllerGroup.h>
@interface OZGradientColorGroupController : OZViewControllerGroup
{
}
- (BOOL)isCollapsed;
- (void)expand;
- (void)collapse;
@end
| 17.052632 | 90 | 0.712963 |
22e8550cff33f2a458ab82518fd4d4c75ac35052 | 1,661 | c | C | projects/tinyframework-game-loop/main.c | wldomiciano/sdl2-playground | 473e7289b622d3f2f82571d134210d5febabace9 | [
"MIT"
] | 1 | 2020-01-15T06:27:20.000Z | 2020-01-15T06:27:20.000Z | projects/tinyframework-game-loop/main.c | wldomiciano/sdl2-playground | 473e7289b622d3f2f82571d134210d5febabace9 | [
"MIT"
] | null | null | null | projects/tinyframework-game-loop/main.c | wldomiciano/sdl2-playground | 473e7289b622d3f2f82571d134210d5febabace9 | [
"MIT"
] | null | null | null | #include "tinyframework.h"
int main(__attribute__((unused)) int argc, __attribute__((unused)) char** argv) {
initializeAllWithContext(0, 0, "Hello", 400, 400, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, SDL_RENDERER_PRESENTVSYNC);
Sprite* const ship = createSprite(NULL, "/assets/images/image.bmp", NULL);
float velocity = 900;
const double DT = 1 / 60.0;
double previous = getTicks();
double lag = 0;
while (wasQuitNotRequested()) {
const double current = getTicks();
const double delta = current - previous;
lag += delta;
previous = current;
handleEvents();
while (lag >= DT) {
const vec2 pos = moveSprite(ship, VEC2(velocity * (float) DT, 0));
if (pos.x + 50 >= 500 || pos.x <= 0) velocity = -velocity;
lag -= DT;
}
clearRender(NULL, 0, 0, 0, 255);
drawSprite(ship);
presentRender(NULL);
}
// create_game(500, 300);
// SDL_Rect rect = {0, 0, 50, 50};
// float velocity = 1000;
// const float DT = 1 / 60.0;
// float previous = getTicks();
// float current = 0;
// float delta = 0;
// float lag = 0;
// while (is_running()) {
// current = getTicks();
// delta = current - previous;
// lag += delta;
// previous = current;
// handle_input();
// while (lag >= DT) {
// rect.x += velocity * DT;
// if (rect.x + rect.w >= 500 || rect.x <= 0) velocity = -velocity;
// lag -= DT;
// }
// render_clear();
// draw_rect(&rect);
// render_present();
// }
// destroy_game();
return 0;
}
| 24.791045 | 131 | 0.542444 |
f309392bc870de9a23f498382adc340b0b6a0b9b | 16,683 | h | C | Functions.h | MartinsAndzans/Windows-Desktop-Application-Template- | 46fb0e71517927b74a4b8a8cef657fb4218cf937 | [
"MIT"
] | null | null | null | Functions.h | MartinsAndzans/Windows-Desktop-Application-Template- | 46fb0e71517927b74a4b8a8cef657fb4218cf937 | [
"MIT"
] | null | null | null | Functions.h | MartinsAndzans/Windows-Desktop-Application-Template- | 46fb0e71517927b74a4b8a8cef657fb4218cf937 | [
"MIT"
] | null | null | null | #ifndef _FUNCTIONS_
#define _FUNCTIONS_
/************************************************
* *
* Copyright(c) Martins Andzans *
* *
************************************************/
#include <ciso646>
#include <Windows.h>
#include <string>
#include <fstream>
class Functions {
public:
/// <summary>
/// Converts Integer To Char Array
/// <para>1234 % 10 = 4 | 1234 / 10 = 123 || 123 % 10 = 3 | 123 / 10 = 12 || 12 % 10 = 2 | 12 / 10 = 1 || 1 % 10 = 1 | 1 / 10 = 0</para>
/// </summary>
/// <param name="Value">Integer Type [int64_t] Value To Be Converted</param>
/// <param name="Buffer">Char Buffer</param>
/// <param name="BufferSize">Buffer Size</param>
/// <returns>If Function Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL _itoa(int64_t Value, LPSTR Buffer, SIZE_T BufferSize) noexcept {
BOOL Minus = FALSE;
CONST SHORT ASCI_VALUE_ZERO = 48; // * Char Value 48 *
std::string StringValue{};
if (Value == INT64_MIN) {
OutputDebugStringA("\'[Functions::_itoa] - Value \"OVERFLOW\"\'\r\n");
return FALSE;
}
if (Value < 0) {
Minus = TRUE;
Value *= -1; // -Value *= -1
}
do {
CHAR Character = static_cast<CHAR>(Value % 10 + ASCI_VALUE_ZERO); // * Get Last Number - Char Value 48 - 57 *
Value = Value / 10; // Remove Last Number
StringValue.insert(0, 1, Character); // Add Character To Begining of StringValue
} while (Value != 0);
if (Minus) {
StringValue.insert(0, "-");
}
if (BufferSize >= StringValue.length() + 1) {
strcpy_s(Buffer, BufferSize, StringValue.c_str());
} else {
OutputDebugStringA("\'[Functions::_itoa] - Buffer To Small\'\r\n");
return FALSE;
}
return TRUE;
}
/// <summary>
/// This Function Encrypt Text To ASCII Value Code
/// </summary>
/// <param name="TextToBeEncrypted">Text To Be Encrypted</param>
/// <returns>Encrypted Text</returns>
static std::string EncryptText(const std::string &TextToBeEncrypted) noexcept {
std::string EncryptedText{};
for (CHAR CHARACTER : TextToBeEncrypted) {
USHORT ASCII_VALUE = static_cast<USHORT>(CHARACTER);
EncryptedText += std::to_string(ASCII_VALUE) + ":";
}
return EncryptedText;
}
/// <summary>
/// This Function Encrypt Unicode Text To ASCII Value Code
/// </summary>
/// <param name="UTextToBeEncrypted">Unicode Text To Be Encrypted</param>
/// <returns>Encrypted Unicode Text</returns>
static std::wstring EncryptText(const std::wstring &UTextToBeEncrypted) noexcept {
std::wstring EncryptedUText{};
for (WCHAR UCHARACTER : UTextToBeEncrypted) {
USHORT ASCII_VALUE = static_cast<USHORT>(UCHARACTER);
EncryptedUText += std::to_wstring(ASCII_VALUE) + L":";
}
return EncryptedUText;
}
/// <summary>
/// This Function Decrypt Text From ASCII Value Code
/// </summary>
/// <param name="EncryptedText">Text To Be Decrypted</param>
/// <returns>Decrypted Text</returns>
static std::string DecryptText(std::string EncryptedText) noexcept {
std::string DecryptedText{};
while (EncryptedText.length() != 0) {
if (EncryptedText.ends_with(':')) {
CHAR CHARACTER = static_cast<CHAR>(std::stoi(EncryptedText));
DecryptedText += CHARACTER;
EncryptedText.replace(0, EncryptedText.find(':') + 1, "");
} else {
return "Cannot Decrypt Text Because Text Is Corrupted!";
}
}
return DecryptedText;
}
/// <summary>
/// This Function Decrypt Unicode Text From ASCII Value Code
/// </summary>
/// <param name="UEncryptedText">Unicode Text To Be Decrypted</param>
/// <returns>Decrypted Unicode Text</returns>
static std::wstring DecryptText(std::wstring UEncryptedText) noexcept {
std::wstring UDecryptedText{};
while (UEncryptedText.length() != 0) {
if (UEncryptedText.ends_with(L':')) {
WCHAR UCHARACTER = static_cast<WCHAR>(std::stoi(UEncryptedText));
UDecryptedText += UCHARACTER;
UEncryptedText.replace(0, UEncryptedText.find(L':') + 1, L"");
} else {
return L"Cannot Decrypt Unicode Text Because Unicode Text Is Corrupted!";
}
}
return UDecryptedText;
}
/// <summary>
/// This Function Finds Character Position Into String
/// </summary>
/// <param name="Text">Text</param>
/// <param name="Char">Character To Find</param>
/// <param name="TextLength">Text Length In Characters</param>
/// <returns>
/// If Character has been found Function Returns Character Position,
/// <para>but If Character not found Function Returns MAXSIZE_T Value</para>
/// </returns>
static SIZE_T FindChar(LPCSTR Text, CONST CHAR Char, SIZE_T TextLength) noexcept {
for (SIZE_T I = 0; I < TextLength; I++) {
if (Text[I] == Char) {
return I;
}
}
return static_cast<SIZE_T>(-1);
}
/// <summary>
/// This Function Finds Unicode Character Position Into Unicode String
/// </summary>
/// <param name="UText">Unicode Text</param>
/// <param name="UChar">Unicode Character To Find</param>
/// <param name="UTextLength">Unicode Text Length In Characters</param>
/// <returns>
/// If Unicode Character has been found Function Returns Unicode Character Position,
/// <para>but If Character not found Function Returns MAXSIZE_T Value</para>
/// </returns>
static SIZE_T FindChar(LPCWSTR UText, CONST WCHAR UChar, SIZE_T UTextLength) noexcept {
for (SIZE_T I = 0; I < UTextLength; I++) {
if (UText[I] == UChar) {
return I;
}
}
return static_cast<SIZE_T>(-1);
}
/// <summary>
/// This Function Rounds Double String
/// </summary>
/// <param name="DoubleString">Double String</param>
/// <returns>Rounded Double String</returns>
static std::string RoundDoubleString(std::string DoubleString) noexcept {
if (DoubleString.find('.') != std::string::npos) {
while (DoubleString.ends_with('0') or DoubleString.ends_with('.')) {
if (DoubleString.ends_with('.')) {
DoubleString.pop_back();
return DoubleString;
}
DoubleString.pop_back();
}
return DoubleString;
}
return DoubleString;
}
/// <summary>
/// This Function Copy Text To Clipboard
/// </summary>
/// <param name="NewClipboardOwner">New Clipboard Owner</param>
/// <param name="Text">Text To Clipboard</param>
/// <param name="TextLength">Text Length In Characters Without [null character] - [\0]</param>
/// <returns>If Function Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL CopyTextToClipboard(HWND NewClipboardOwner, LPCSTR Text, SIZE_T TextLength) noexcept {
if (TextLength != 0) {
if (OpenClipboard(NewClipboardOwner)) {
EmptyClipboard();
HLOCAL CopyData = LocalAlloc(LPTR | LMEM_VALID_FLAGS, sizeof(CHAR) * (TextLength + 1));
if (CopyData == NULL) {
CloseClipboard();
return FALSE;
}
void *CopyDataPtr = LocalLock(CopyData);
if (CopyDataPtr == nullptr) {
LocalFree(CopyData);
CloseClipboard();
return FALSE;
}
memcpy(CopyDataPtr, static_cast<const void*>(Text), sizeof(CHAR) * (TextLength + 1));
SetClipboardData(CF_TEXT, CopyData);
LocalUnlock(CopyData);
LocalFree(CopyData);
CloseClipboard();
return TRUE;
}
}
return FALSE;
}
/// <summary>
/// This Function Copy Unicode Text To Clipboard
/// </summary>
/// <param name="NewClipboardOwner">New Clipboard Owner</param>
/// <param name="UText">Unicode Text To Clipboard</param>
/// <param name="UTextLength">Unicode Text Length In Characters Without [null character] - [\0]</param>
/// <returns>If Function Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL CopyTextToClipboard(HWND NewClipboardOwner, LPCWSTR UText, SIZE_T UTextLength) noexcept {
if (UTextLength != 0) {
if (OpenClipboard(NewClipboardOwner)) {
EmptyClipboard();
HLOCAL CopyData = LocalAlloc(LPTR | LMEM_VALID_FLAGS, sizeof(WCHAR) * (UTextLength + 1));
if (CopyData == NULL) {
CloseClipboard();
return FALSE;
}
void *CopyDataPtr = LocalLock(CopyData);
if (CopyDataPtr == nullptr) {
LocalFree(CopyData);
CloseClipboard();
return FALSE;
}
memcpy(CopyDataPtr, static_cast<const void*>(UText), sizeof(WCHAR) * (UTextLength + 1));
SetClipboardData(CF_UNICODETEXT, CopyData);
LocalUnlock(CopyData);
LocalFree(CopyData);
CloseClipboard();
return TRUE;
}
}
return FALSE;
}
/// <summary>
/// This Function Gets Text From Clipboard
/// </summary>
/// <param name="NewClipboardOwner">New Clipboard Owner</param>
/// <param name="Buffer">Text From Clipboard</param>
/// <returns>If Function Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL GetTextFromClipboard(HWND NewClipboardOwner, std::string &Buffer) noexcept {
if (OpenClipboard(NewClipboardOwner)) {
HLOCAL ClipboardData = GetClipboardData(CF_TEXT);
if (ClipboardData == NULL) {
CloseClipboard();
return FALSE;
}
void *ClipboardDataPtr = LocalLock(ClipboardData);
if (ClipboardDataPtr == nullptr) {
LocalFree(ClipboardData);
CloseClipboard();
return FALSE;
}
Buffer += static_cast<char*>(ClipboardDataPtr);
LocalUnlock(ClipboardData);
LocalFree(ClipboardData);
CloseClipboard();
return TRUE;
}
return FALSE;
}
/// <summary>
/// This Function Gets Unicode Text From Clipboard
/// </summary>
/// <param name="NewClipboardOwner">New Clipboard Owner</param>
/// <param name="UBuffer">Unicode Text From Clipboard</param>
/// <returns>If Function Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL GetTextFromClipboard(HWND NewClipboardOwner, std::wstring &UBuffer) noexcept {
if (OpenClipboard(NewClipboardOwner)) {
HLOCAL ClipboardData = GetClipboardData(CF_UNICODETEXT);
if (ClipboardData == NULL) {
CloseClipboard();
return FALSE;
}
void *ClipboardDataPtr = LocalLock(ClipboardData);
if (ClipboardDataPtr == nullptr) {
LocalFree(ClipboardData);
CloseClipboard();
return FALSE;
}
UBuffer += static_cast<wchar_t*>(ClipboardDataPtr);
LocalUnlock(ClipboardData);
LocalFree(ClipboardData);
CloseClipboard();
return TRUE;
}
return FALSE;
}
/// <summary>
/// Shows Last Error Message
/// </summary>
/// <param name="ParentWindow">Parent Window</param>
/// <param name="AdditionalErroMessage">Additional Error Message</param>
static VOID ShowLastError(HWND ParentWindow = HWND_DESKTOP, std::string AdditionalErrorMessage = " - Additional Error Message") noexcept {
std::string ErrorMessage = "ERROR " + std::to_string(GetLastError()) + AdditionalErrorMessage;
MessageBoxA(ParentWindow, ErrorMessage.c_str(), "-ERROR-", MB_OK | MB_ICONERROR);
}
/// <summary>
/// Saves Bitmap To File
/// </summary>
/// <param name="Bitmap">Bitmap</param>
/// <param name="FilePath">File Path With ".bmp" Extension</param>
/// <param name="BitmapSize">Bitmap Size In Pixels</param>
/// <returns>If Succeeded Returns TRUE, but If not Returns FALSE</returns>
static BOOL SaveBitmapToFile(HBITMAP Bitmap, LPCSTR FilePath, CONST SIZE &BitmapSize) noexcept {
std::ofstream image;
CONST WORD BM = 0x4D42; // ASCII 'B' = 66 / 0x42 | 'M' = 77 / 0x4D
CONST DWORD BitmapSizeCXxCY = BitmapSize.cx * BitmapSize.cy; // Bitmap Size [cx * cy]
BITMAPFILEHEADER bmfheader = { 0 };
bmfheader.bfType = BM;
bmfheader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(COLORREF) * BitmapSizeCXxCY; // File Size
bmfheader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); // Offset To Color Bits
bmfheader.bfReserved1 = NULL;
bmfheader.bfReserved2 = NULL;
BITMAPINFOHEADER bmiheader = { 0 };
bmiheader.biSize = sizeof(BITMAPINFOHEADER);
bmiheader.biWidth = BitmapSize.cx; // Bitmap Width In Pixels
bmiheader.biHeight = BitmapSize.cy; // Bitmap Height In Pixels
bmiheader.biPlanes = 0x01; // 1 - Bitmap has a one plane
bmiheader.biBitCount = 0x20; // 32 - Bitmap has a maximum of 2^32 colors
bmiheader.biCompression = BI_RGB;
bmiheader.biSizeImage = BitmapSizeCXxCY;
bmiheader.biXPelsPerMeter = BitmapSize.cx;
bmiheader.biYPelsPerMeter = BitmapSize.cy;
bmiheader.biClrUsed = NULL;
bmiheader.biClrImportant = NULL;
std::unique_ptr<COLORREF[]> BitmapBytesPtr = std::make_unique<COLORREF[]>(BitmapSizeCXxCY);
if (BitmapBytesPtr) {
BITMAPINFO bminfo = { 0 };
bminfo.bmiHeader = bmiheader;
HDC ScreenDC = GetDC(HWND_DESKTOP);
GetDIBits(ScreenDC, Bitmap, 0, BitmapSize.cy, BitmapBytesPtr.get(), &bminfo, DIB_RGB_COLORS);
ReleaseDC(HWND_DESKTOP, ScreenDC);
image.open(FilePath, std::ios::binary); // Open File
if (image.is_open()) {
image.write(reinterpret_cast<char*>(&bmfheader), sizeof(BITMAPFILEHEADER)); // BITMAP FILE HEADER
image.write(reinterpret_cast<char*>(&bmiheader), sizeof(BITMAPINFOHEADER)); // BITMAP INFO HEADER
image.write(reinterpret_cast<char*>(BitmapBytesPtr.get()), sizeof(COLORREF) * BitmapSizeCXxCY); // COLOR BYTE ARRAY
image.close(); // Close File
return TRUE;
}
}
return FALSE;
}
};
class Sound {
public:
typedef DWORD MCISTATUSCODE; // * MCISTATUSCODE [DWORD] is a 32-bit unsigned integer *
typedef DWORD MCISTATUS; // * MCISTATUS [DWORD] is a 32-bit unsigned integer *
/// <summary>
/// MCI Error Codes
/// </summary>
enum MCI {
MCI_OK = 0 // MCI Success Code
};
/// <summary>
/// This Function Opens MCIDevice
/// <para>Music File Path "*.wav" / "*.wma" / "*.mp3" || Video Formats not Supported Yet ||</para>
/// </summary>
static MCIERROR Open(LPCWSTR Alias, LPCWSTR FilePath) {
MCI_OPEN_PARMS open = { 0 };
open.lpstrAlias = Alias;
open.lpstrElementName = FilePath;
return mciSendCommand(NULL, MCI_OPEN, MCI_WAIT | MCI_OPEN_ELEMENT | MCI_OPEN_ALIAS, (DWORD_PTR)&open);
}
/// <summary>
/// This Function Obtains Playback Status
/// <para>MCI_STATUS_POSITION - Obtains Current Playback Position</para>
/// <para>MCI_STATUS_LENGTH - Obtains Total Media Length</para>
/// <para>MCI_STATUS_MODE - Obtains Current Mode of The Device</para>
/// <para>MCI_STATUS_TIME_FORMAT - Obtains Current Time Format of The Device</para>
/// </summary>
static MCIERROR GetPlaybackStatus(LPCWSTR Alias, MCISTATUSCODE StatusCode, MCISTATUS &PlaybackStatus) {
MCI_STATUS_PARMS status = { 0 };
status.dwItem = StatusCode; // Status Code
status.dwReturn = NULL; // Return
MCIERROR Error = mciSendCommand(mciGetDeviceID(Alias), MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (DWORD_PTR)&status);
PlaybackStatus = static_cast<MCISTATUS>(status.dwReturn);
return Error;
}
/// <summary>
/// This Function Plays Music From The Beginning
/// <para>If Notify is TRUE MCI Sends To Callback Window [MM_MCINOTIFY] Message 'LOWORD(lParam) - MCIDeviceID'</para>
/// </summary>
static MCIERROR Play(HWND CallbackWindow, LPCWSTR Alias, BOOL Notify = FALSE) {
MCI_PLAY_PARMS play = { 0 };
play.dwCallback = reinterpret_cast<DWORD_PTR>(CallbackWindow);
play.dwFrom = 0;
if (Notify) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_PLAY, MCI_NOTIFY | MCI_FROM, (DWORD_PTR)&play);
} else {
return mciSendCommand(mciGetDeviceID(Alias), MCI_PLAY, MCI_FROM, (DWORD_PTR)&play);
}
}
/// <summary>
/// This Function Seek To Specified Point of Playback
/// <para>MCI_SEEK_TO_START - Seek To Beginning of Playback</para>
/// <para>MCI_SEEK_TO_END - Seek To End of Playback</para>
/// </summary>
static MCIERROR Seek(LPCWSTR Alias, DWORD SeekTo) {
MCI_SEEK_PARMS seek = { 0 };
seek.dwTo = SeekTo;
if (SeekTo == MCI_SEEK_TO_START) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_SEEK, MCI_WAIT | MCI_SEEK_TO_START, NULL);
} else if (SeekTo == MCI_SEEK_TO_END) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_SEEK, MCI_WAIT | MCI_SEEK_TO_END, NULL);
} else {
return mciSendCommand(mciGetDeviceID(Alias), MCI_SEEK, MCI_WAIT | MCI_TO, (DWORD_PTR)&seek);
}
}
/// <summary>
/// This Function Pauses Playbeck
/// </summary>
static MCIERROR Pause(LPCWSTR Alias) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_PAUSE, MCI_WAIT, NULL);
}
/// <summary>
/// This Function Resumes Playbeck
/// </summary>
static MCIERROR Resume(LPCWSTR Alias) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_RESUME, MCI_WAIT, NULL);
}
/// <summary>
/// This Function Stops Playbeck
/// </summary>
static MCIERROR Stop(LPCWSTR Alias) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_STOP, MCI_WAIT, NULL);
}
/// <summary>
/// This Function Closes MCIDevice
/// </summary>
static MCIERROR Close(LPCWSTR Alias) {
return mciSendCommand(mciGetDeviceID(Alias), MCI_CLOSE, MCI_WAIT, NULL);
}
};
#endif // _FUNCTIONS_
| 30.443431 | 139 | 0.681712 |
24fec19c93638c1d96f99dd031acaf8ec5342468 | 381 | h | C | headers/nms_interface.h | psvvsp/NonMaximumSuppression | 35e151042320952909a53086d368fdae0fceda7d | [
"MIT"
] | null | null | null | headers/nms_interface.h | psvvsp/NonMaximumSuppression | 35e151042320952909a53086d368fdae0fceda7d | [
"MIT"
] | null | null | null | headers/nms_interface.h | psvvsp/NonMaximumSuppression | 35e151042320952909a53086d368fdae0fceda7d | [
"MIT"
] | null | null | null | #pragma once
#include "box.h"
#include <vector>
class NMS_interface
{
public:
virtual ~NMS_interface() {}
virtual bool init(size_t boxesCountMax) = 0;
virtual bool doIt(
const std::vector<Box>& boxesIn,
const std::vector<real>& scoresIn,
real threshold,
std::vector<Box>& boxesOut,
std::vector<real>& scoresOut
) = 0;
}; | 18.142857 | 48 | 0.614173 |
044f1c18254d833f1aea3584376871db90b4301c | 9,242 | h | C | src/include/LiteChaCha/SHA512.h | Matt-and-Gib/gleemail | 74c1e0f709620884187f8079aae0bcfd19b0cce1 | [
"Unlicense"
] | null | null | null | src/include/LiteChaCha/SHA512.h | Matt-and-Gib/gleemail | 74c1e0f709620884187f8079aae0bcfd19b0cce1 | [
"Unlicense"
] | 83 | 2021-11-04T03:26:54.000Z | 2022-03-20T23:15:24.000Z | src/include/LiteChaCha/SHA512.h | Matt-and-Gib/gleemail | 74c1e0f709620884187f8079aae0bcfd19b0cce1 | [
"Unlicense"
] | null | null | null | #ifndef SHA512_H
#define SHA512_H
#include <stdint.h>
class SHA512Hash {
private:
static const constexpr unsigned short HASH_BYTES = 64;
static const constexpr unsigned short WORD_CONVERSION = 8; // 8 bytes/1 word, 1 word/8 bytes.
static const constexpr unsigned short HASH_WORDS = HASH_BYTES/WORD_CONVERSION;
static const constexpr unsigned short ROUNDS = 80;
static const constexpr unsigned short BIT_CONVERSION = 8; // 8 bits/1 byte, 1 byte/8 bits.
static const constexpr unsigned short BLOCK_BITS = 1024;
static const constexpr unsigned short BLOCK_BYTES = BLOCK_BITS/BIT_CONVERSION;
static const constexpr unsigned short APPEND_BIT = 1;
static const constexpr unsigned short MESSAGE_LENGTH_BITS = 128;
static const constexpr unsigned short WORD_BITS = 64;
static const constexpr unsigned short MESSAGE_LENGTH_WORDS = MESSAGE_LENGTH_BITS/WORD_BITS;
static const constexpr unsigned short BLOCK_WORDS = BLOCK_BITS/WORD_BITS;
static const constexpr unsigned short HALF_WORD_CONVERSION = WORD_CONVERSION/2;
static const constexpr unsigned short HALF_WORD_SHIFT = 24;
static const constexpr unsigned short HALF_WORD_BITS = WORD_BITS/2;
static const constexpr unsigned short WORD_SHIFT = WORD_BITS - BIT_CONVERSION;
uint64_t h[HASH_WORDS];
const uint64_t hInit[HASH_WORDS] = {0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179}; // Derived from the first 64 bits of the fractional parts of the square roots of the first 8 primes.
unsigned short messageRemainderBits;
unsigned short zeroBits;
unsigned short zeroWords;
unsigned long long messageWords;
unsigned short wordRemainder;
unsigned long long wordIndex;
unsigned long long blockCount;
uint32_t halfWordBuffer;
uint64_t wordBuffer;
uint64_t w[ROUNDS]; // Message schedule array.
uint64_t s0;
uint64_t s1;
uint64_t a[HASH_WORDS]; // Working variables.
uint64_t t0;
uint64_t t1;
const uint64_t k[ROUNDS] = {
0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118,
0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235, 0xc19bf174cf692694,
0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65, 0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5,
0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725, 0x06ca6351e003826f, 0x142929670a0e6e70,
0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b,
0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218, 0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8,
0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3,
0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec, 0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b,
0xca273eceea26619c, 0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b,
0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
}; // Derived from the first 64 bits of the fractional parts of the cube roots of the first 80 primes.
void initialize(unsigned long long);
void buildMessage(uint64_t*, char*, unsigned long long);
void rotR(uint64_t, unsigned short);
void hashProcess(uint64_t*);
void outputHash(char[HASH_BYTES]);
public:
SHA512Hash();
~SHA512Hash();
void hashBytes(char[HASH_BYTES], char*, unsigned long long);
};
SHA512Hash::SHA512Hash() {
}
SHA512Hash::~SHA512Hash() {
}
void SHA512Hash::initialize(unsigned long long messageBytes) {
for(unsigned short i = 0; i < HASH_WORDS; i += 1) {
h[i] = hInit[i];
}
messageRemainderBits = (messageBytes % BLOCK_BYTES)*BIT_CONVERSION;
zeroBits = BLOCK_BITS - ((((messageRemainderBits + APPEND_BIT + MESSAGE_LENGTH_BITS) - 1) % BLOCK_BITS) + 1);
zeroWords = zeroBits/WORD_BITS;
messageWords = messageBytes/WORD_CONVERSION;
wordRemainder = messageBytes % WORD_CONVERSION;
wordIndex = messageWords + zeroWords + MESSAGE_LENGTH_WORDS;
blockCount = (wordIndex + 1)/BLOCK_WORDS;
}
void SHA512Hash::buildMessage(uint64_t* message, char* messageIn, unsigned long long messageBytes) {
for(unsigned long long i = 0; i < messageWords; i += 1) {
message[i] = 0x0000000000000000;
for(unsigned short j = 0; j < HALF_WORD_CONVERSION; j += 1) {
message[i] |= ((uint64_t)messageIn[(WORD_CONVERSION*i) + j] << (HALF_WORD_SHIFT - (BIT_CONVERSION*j)));
}
message[i] = message[i] << HALF_WORD_BITS;
halfWordBuffer = 0x00000000;
for(unsigned short j = HALF_WORD_CONVERSION; j < WORD_CONVERSION; j += 1) {
halfWordBuffer |= (messageIn[(WORD_CONVERSION*i) + j] << (HALF_WORD_SHIFT - (BIT_CONVERSION*(j - HALF_WORD_CONVERSION))));
}
message[i] |= halfWordBuffer;
}
if(wordRemainder == 0) {
message[messageWords] = 0x8000000000000000;
} else {
message[messageWords] = 0x0000000000000000;
if(wordRemainder < HALF_WORD_CONVERSION) {
for(unsigned short i = 0; i < wordRemainder; i += 1) {
message[messageWords] |= ((uint64_t)messageIn[(WORD_CONVERSION*messageWords) + i] << (HALF_WORD_SHIFT - (BIT_CONVERSION*i)));
}
message[messageWords] |= (0x0000000000000080 << (HALF_WORD_SHIFT - (BIT_CONVERSION*wordRemainder)));
message[messageWords] = message[messageWords] << HALF_WORD_BITS;
} else if(wordRemainder == HALF_WORD_CONVERSION) {
for(unsigned short i = 0; i < wordRemainder; i += 1) {
message[messageWords] |= ((uint64_t)messageIn[(WORD_CONVERSION*messageWords) + i] << (HALF_WORD_SHIFT - (BIT_CONVERSION*i)));
}
message[messageWords] = message[messageWords] << HALF_WORD_BITS;
halfWordBuffer = 0x80000000;
message[messageWords] |= halfWordBuffer;
} else {
for(unsigned short i = 0; i < HALF_WORD_CONVERSION; i += 1) {
message[messageWords] |= ((uint64_t)messageIn[(WORD_CONVERSION*messageWords) + i] << (HALF_WORD_SHIFT - (BIT_CONVERSION*i)));
}
message[messageWords] = message[messageWords] << HALF_WORD_BITS;
halfWordBuffer = 0x00000000;
for(unsigned short i = HALF_WORD_CONVERSION; i < wordRemainder; i += 1) {
halfWordBuffer |= (messageIn[(WORD_CONVERSION*messageWords) + i] << (HALF_WORD_SHIFT - (BIT_CONVERSION*(i - HALF_WORD_CONVERSION))));
}
halfWordBuffer |= (0x80 << (HALF_WORD_SHIFT - (BIT_CONVERSION*(wordRemainder % HALF_WORD_CONVERSION))));
message[messageWords] |= halfWordBuffer;
}
}
for(unsigned long long i = 0; i < zeroWords; i += 1) {
message[(messageWords + 1) + i] = 0x0000000000000000;
}
message[wordIndex - 1] = (uint64_t)messageBytes >> 61; // Has the effect of multiplying messageBytes by 8 (to convert from bytes to bits).
message[wordIndex] = (uint64_t)messageBytes << 3;
}
void SHA512Hash::rotR(uint64_t n, unsigned short c) {
wordBuffer = ((n >> c) | (n << (WORD_BITS - c)));
}
void SHA512Hash::hashProcess(uint64_t* message) {
for(unsigned long long b = 0; b < blockCount; b += 1) {
for(unsigned short i = 0; i < BLOCK_WORDS; i += 1) {
w[i] = message[(BLOCK_WORDS*b) + i];
}
for(unsigned short i = BLOCK_WORDS; i < ROUNDS; i += 1) {
rotR(w[i - 15], 1);
s0 = wordBuffer;
rotR(w[i - 15], 8);
s0 ^= wordBuffer;
s0 ^= (w[i - 15] >> 7);
rotR(w[i - 2], 19);
s1 = wordBuffer;
rotR(w[i - 2], 61);
s1 ^= wordBuffer;
s1 ^= (w[i - 2] >> 6);
w[i] = w[i - 16] + s0 + w[i - 7] + s1;
}
for(unsigned short i = 0; i < HASH_WORDS; i += 1) {
a[i] = h[i];
}
for(unsigned short i = 0; i < ROUNDS; i += 1) {
rotR(a[4], 14);
s1 = wordBuffer;
rotR(a[4], 18);
s1 ^= wordBuffer;
rotR(a[4], 41);
s1 ^= wordBuffer;
s0 = (a[4] & a[5]) ^ ((~a[4]) & a[6]);
t0 = a[7] + s1 + s0 + k[i] + w[i];
rotR(a[0], 28);
s0 = wordBuffer;
rotR(a[0], 34);
s0 ^= wordBuffer;
rotR(a[0], 39);
s0 ^= wordBuffer;
s1 = (a[0] & a[1]) ^ (a[0] & a[2]) ^ (a[1] & a[2]);
t1 = s0 + s1;
a[7] = a[6];
a[6] = a[5];
a[5] = a[4];
a[4] = a[3] + t0;
a[3] = a[2];
a[2] = a[1];
a[1] = a[0];
a[0] = t0 + t1;
}
for(unsigned short i = 0; i < HASH_WORDS; i += 1) {
h[i] += a[i];
}
}
}
void SHA512Hash::outputHash(char* hashOut) {
for(unsigned short i = 0; i < HASH_WORDS; i += 1) {
for(unsigned short j = 0; j < WORD_CONVERSION; j += 1) {
hashOut[(WORD_CONVERSION*i) + j] = h[i] >> (WORD_SHIFT - (BIT_CONVERSION*j));
}
}
}
void SHA512Hash::hashBytes(char* hashOut, char* messageIn, unsigned long long messageBytes) {
initialize(messageBytes);
uint64_t* message = new uint64_t[wordIndex + 1];
buildMessage(message, messageIn, messageBytes);
hashProcess(message);
outputHash(hashOut);
delete[] message;
}
#endif | 36.385827 | 298 | 0.721381 |
0bdd851f732e18b7e935b2df879881ac6a4fb835 | 7,706 | c | C | src/sim/sad_api.c | noboruatkek/SAD | 3881a190af8903537774c57b56963ffc94cfc039 | [
"BSD-3-Clause"
] | 11 | 2019-04-01T15:54:57.000Z | 2022-03-09T16:47:20.000Z | src/sim/sad_api.c | noboruatkek/SAD | 3881a190af8903537774c57b56963ffc94cfc039 | [
"BSD-3-Clause"
] | null | null | null | src/sim/sad_api.c | noboruatkek/SAD | 3881a190af8903537774c57b56963ffc94cfc039 | [
"BSD-3-Clause"
] | 9 | 2017-03-15T08:52:45.000Z | 2021-07-19T08:06:40.000Z | /* Extended Allocation API */
#include <sim/sad_api.h>
#include <sim/sad_memory.h>
#include <sim/TFCODE.h>
#include <sim/TFCBK.h>
#include <sim/TFSTK.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>
/* asprintf() for SAD */
int sad_asprintf(char **ptr, const char *format, ...) {
int count;
va_list va0, va;
va_start(va0, format);
va_copy(va, va0);
count = vsnprintf(NULL, 0, format, va);
if(count <= 0) {
*ptr = NULL;
return count;
}
*ptr = malloc(count + 1);
count = vsnprintf(*ptr, count + 1, format, va0);
va_end(va0);
return count;
}
/* Expand `~' prefix by shell rule and return new allocated string */
char* expand_tilde(const char *path) {
int n;
char *user, *home, *buf;
struct passwd *pe;
if(path[0] != '~') return strdup(path);
if(path[1] == '/' || path[1] == '\0') {
home = getenv("HOME"); n = 0;
if(home == NULL) {
pe = getpwuid(getuid());
if(pe == NULL) return NULL;
home = pe->pw_dir;
}
} else {
for(n = 1; path[1 + n] != '/' && path[1 + n] != '\0'; n++);
user = malloc(n + 1);
if(user == NULL) return NULL;
memcpy(user, path + 1, n); user[n] = '\0';
pe = getpwnam(user); free(user);
if(pe == NULL) return NULL;
home = pe->pw_dir;
}
if(home == NULL) return NULL;
buf = malloc(strlen(home) + strlen(path) - n);
strcpy(buf, home);
strcat(buf, path + 1 + n);
return buf;
}
/* Fortran2008 LEN_TRIM() for C */
integer len_trim(const_character str, ftnlen slen) {
for(int i = slen - 1; i >= 0; i--)
if(str[i] != ' ')
return i + 1;
return 0;
}
integer8 ktsalocbref_(integer4 *mode, const char **str, integer4 *length) {
return ktsalocb_(mode, *str, length, *length);
}
integer8 ktsalocbcstrs_(integer4 *mode, const char **str, integer4 *index) {
const char *string = str[*index];
integer4 length;
length = strlen(string);
return ktsalocb_(mode, string, &length, length);
}
/* Wrapper function for SAD internal API */
void tfreadbuf(integer4 lfn, integer4 *ib, integer4 *nc) {
__readbuf_MOD_tfreadbuf(&lfn, ib, nc);
}
void trbinit(integer4 lfn, integer4 *ib) {
__tfrbuf_MOD_trbinit(&lfn, ib);
}
integer8 kfromr_(real8 *x){
return kfromr(*x);
}
real8 rfromk_(integer8 *k){
return rfromk(*k);
}
real8 rgetgl1(const char *var) {
return rgetgl1_(var, strlen(var));
}
integer8 ktfcopy(integer8 k) {
return ktfcopy_(&k);
}
integer4 itfsyserr(integer4 level) {
return itfsyserr_(&level);
}
integer4 itfmessage(integer4 level, const char *msg, const char *arg) {
return itfmessage_(&level, msg, arg, strlen(msg), strlen(arg));
}
integer8 ktfsymbolz(const char *symbol) {
integer4 length = strlen(symbol);
return ktfsymbolz_(symbol, &length, length);
}
integer8 ktfsymbolf(const char *symbol, logical4 l) {
integer4 length = strlen(symbol);
return ktfsymbolf_(symbol, &length, &l, length);
}
void tfree(integer8 ia) {
__tfmem_MOD_tfree(&ia);
}
integer8 ktsalocb(integer4 mode, const char *str) {
integer4 length = strlen(str);
return ktsalocb_(&mode, str, &length, length);
}
integer8 ktsalocbl(integer4 mode, const char *str, integer4 length) {
return ktsalocb_(&mode, str, &length, length);
}
/*
integer4 italoc(integer4 nd) {
return italoc_(&nd);
}*/
integer8 ktavaloc(integer4 mode, integer4 nd) {
return ktavaloc_(&mode, &nd);
}
integer8 ktadaloc(integer4 mode, integer4 nd) {
return ktadaloc_(&mode, &nd);
}
integer8 ktfmaloc(integer8 k, integer4 *n, integer4 *m,
logical4 vec, logical4 trans, integer4 *irtc) {
return ktfmaloc_(&k, n, m, &vec, &trans, irtc);
}
integer8 ktfmakelist(integer4 isp1) {
return ktfmakelist_(&isp1);
}
void tfsetlist(integer8 kx, integer8 iax, integer4 i) {
tfsetlist_(&kx, &iax, &i);
}
void tfmakerulestk(integer8 ias, integer8 kx) {
/* fprintf(stderr,"mkrs_c: %d %f\n",kx); */
tfmakerulestk_(&ias,&kx);
}
void tfevals(const char *buf,
integer8 *kx, integer4 *irtc) {
integer4 length = strlen(buf);
tfevalb_(buf, length, kx, irtc);
}
void tfevalc(const char *buf) {
integer4 length = strlen(buf);
tfevalc_(buf, length);
}
void tfdeval(integer4 isp1, integer8 iad,
integer8 *kx,
integer4 next,
logical4 def, integer4 *ev, integer4 *irtc) {
tfdeval_(&isp1, &iad, kx, &next, &def, ev, irtc);
}
void tflocal(integer8 kx) {
tflocal_(&kx);
}
void tflocal1(integer8 kx) {
tflocal1_(&kx);
}
/*
int tfinitstk(tfstk_t *stack, integer4 size) {
integer4 stk_size, stk_offset;
stk_size = size > 1024 ? size : 1024;
stk_offset = italoc(stk_size * 2);
if(stk_offset < 0)
return -1;
stack->__isporg = stk_offset - 1;
stack->__ivstkoffset = stk_size;
stack->__isp = stack->__isporg;
stack->__mstk = stack->__isporg + stack->__ivstkoffset;
stack->__ipurefp = 0;
stack->__napuref = 0;
return 0;
}*/
static bool itfgetoption1(integer8 ia, integer8 kr,
integer8 *kx) {
integer8 iar;
int i;
iar = ktamask & kr;
if(klist(iar) == ktfoper + mtflist) {
for(i = 1; i <= ilist(2, iar - 1); i++) {
if(itfgetoption1(ia, klist(iar + i), kx))
return true;
}
} else if((ktfmask & klist(iar + 1)) == ktfsymbol
&& tfsamesymbolqk_(&ia, &klist(iar + 1))) {
*kx = klist(iar + 2);
return true;
}
return false;
}
integer4 itfgetoptionstk(integer4 isp1, const char **optv) {
integer8 *iopt;
integer4 isp0, ispopt;
int optc, i, j;
optc = 0;
while(optv[optc] != NULL) optc += 1;
if(optc < 1) return -1;
iopt = malloc(sizeof(integer8) * optc);
if(iopt == NULL) return -1;
for(i = 0; i < optc; i++)
iopt[i] = ktfsymbolz(optv[i]);
isp0 = isp;
for(ispopt = isp0; isp1 <= ispopt; ispopt--)
if(!tfruleqk_(&ktastk(ispopt)))
break;
ispopt += 1;
isp = isp0 + optc;
for(i = 1; i <= optc; i++)
ktastk(isp0 + i) = ktfref;
if(ispopt <= isp0)
for(i = 1; i <= optc; i++)
for(j = ispopt; j <= isp0; j++)
if(itfgetoption1(iopt[i - 1], ktastk(j), & ktastk(isp0 +i)))
break;
free(iopt);
return ispopt;
}
/* Debug routines */
#ifdef DEBUG_DUMPER
void dumpstk_(integer4 *isp1) {
int i, ia;
printf(" Index jstk(1) jstk(2) istk(1) istk(2) vstk()\n");
for(i = 0, ia = *isp1; ia <= isp; i ++, ia++)
printf("stk[%3d]: %6d %6d 0x%08x %10d %e \n",
i, jtastk(1, ia), jtastk(2, ia), itastk(1, ia), itastk(2, ia),
vstk(ivstkoffset + ia));
printf("\n");
}
void dumptok_(const_character str, integer4 *istart, integer4 *istop,
integer4 *iti, integer4 *iai, real8 *vi,
ftnlen slen) {
int i;
printf(" tfetok -> (itt=%d ia=%d v=%e): cur=\"",
*iti, *iai, *vi);
for(i = 0; i < *istop - *istart; i++)
switch(str[i]) {
case '\\':
printf("\\\\");
break;
case '"':
printf("\\\"");
break;
case '\t':
printf("\\t");
break;
case '\r':
printf("\\r");
break;
case '\n':
printf("\\n");
break;
case '\0':
printf("\\0");
break;
default:
printf("%c", str[i]);
break;
}
printf("\" next=\"");
for(i = *istop - *istart; i < slen; i++)
switch(str[i]) {
case '\\':
printf("\\\\");
break;
case '"':
printf("\\\"");
break;
case '\t':
printf("\\t");
break;
case '\r':
printf("\\r");
break;
case '\n':
printf("\\n");
break;
case '\0':
printf("\\0");
break;
default:
printf("%c", str[i]);
break;
}
printf("\"\n");
}
#endif /* DEBUG_DUMPER */
/* End of File */
| 20.494681 | 76 | 0.588632 |
9a0287fb682b8a887a076b6d210c6a3646f94dfe | 1,999 | h | C | src/handlers/autocomplete/CompletionProvider.h | Aerijo/latex-language-server | fbd520e40e7878ca9b114e408b21b6b1e181a875 | [
"MIT"
] | 4 | 2019-04-08T17:03:24.000Z | 2019-09-13T17:20:20.000Z | src/handlers/autocomplete/CompletionProvider.h | Aerijo/latex-language-server | fbd520e40e7878ca9b114e408b21b6b1e181a875 | [
"MIT"
] | null | null | null | src/handlers/autocomplete/CompletionProvider.h | Aerijo/latex-language-server | fbd520e40e7878ca9b114e408b21b6b1e181a875 | [
"MIT"
] | null | null | null | #ifndef LATEX_LANGUAGE_SERVER_COMPLETIONPROVIDER_H
#define LATEX_LANGUAGE_SERVER_COMPLETIONPROVIDER_H
#include <lsp-tools/Handler.h>
#include "range.h"
enum class PrefixType {
None,
TextCommand,
MathCommand,
Citation, // for \cite{...|}
CitationShort, // for @...|
MathShift,
Magic,
Env, // for \begin{...|}
EnvShort, // for #...|
Package,
Reference,
};
struct PrefixData {
PrefixType type { PrefixType::None };
Range range {};
string value {};
};
enum class InsertTextFormat {
PlainText = 1,
Snippet = 2
};
struct TextEdit {
void reflect (StringWriter &writer);
Range range {};
string newText {};
};
struct CompletionItem { // snippet by default
void reflect (StringWriter &writer);
string label {};
CompletionItemKind kind { CompletionItemKind::Snippet };
string detail {};
string documentation {}; // can also be markdown
bool deprecated { false };
InsertTextFormat format { InsertTextFormat::Snippet };
TextEdit textEdit {};
string sortText {};
};
struct CompletionList {
void reflect (StringWriter &writer);
bool empty ();
void addSnippet (string &&prefix, string &&body, Range &range, string &&sortText = "");
void addSnippet (string &prefix, string &body, Range &range, string &&sortText = "");
void addCommand (string prefix, Range &range);
void addShortEnv (const string &name, Range &range);
void addEnvironment (string &prefix, string &envName, Range &range);
bool isIncomplete { false }; // TODO: Support partial lists (when gathering from across files?)
vector<CompletionItem> items {};
};
class CompletionProvider : public RequestHandler {
public:
CompletionProvider () : RequestHandler ("textDocument/completion") {};
void registerCapabilities (Init::ServerCapabilities &capabilities) override;
void run (Id &id, optional<Value> ¶ms) override;
};
#endif //LATEX_LANGUAGE_SERVER_COMPLETIONPROVIDER_H
| 24.378049 | 99 | 0.678839 |
f2c95b5c9b6b9f23af5c5efe0e5d324006845981 | 4,893 | h | C | ADS_lab4v2/Graph.h | mbdevpl/wut-bsc-algorithms-and-data-structures | decb770215863cf4de6bfb41b69bc8990cb4ce3c | [
"Apache-2.0"
] | null | null | null | ADS_lab4v2/Graph.h | mbdevpl/wut-bsc-algorithms-and-data-structures | decb770215863cf4de6bfb41b69bc8990cb4ce3c | [
"Apache-2.0"
] | null | null | null | ADS_lab4v2/Graph.h | mbdevpl/wut-bsc-algorithms-and-data-structures | decb770215863cf4de6bfb41b69bc8990cb4ce3c | [
"Apache-2.0"
] | null | null | null | #include <stdio.h>
#include <iostream>
#include <list>
using namespace std;
class Graph {
public:
/*
Adds an edge between given vertices.
If the edge already exists or we try to add a loop, no edge is added.
Returns:
0 if an edge is added
-1 if we try to create a loop
-2 if there are no such vertices
-3 if the edge already exists
*/
virtual int addEdge(int,int) abstract;
/*
Removes an edge between given vertices.
If the edge does not exist, nothing is changed.
Returns:
0 if an edge is removed
-1 if an edge does not exist
-2 if vertices do not exist
*/
virtual int removeEdge(int, int) abstract;
/*
Returns:
1 if given vertices are connected by an egde
0 if the vertices are not connected
-1 if the vertices do not exist
*/
virtual int areConnected(int,int) abstract;
/*
Prints the representation of a graph.
*/
virtual void show() abstract;
/*
Adds new isolated vertex to a graph.
Returns:
0 if everything is OK
-1 in case of error (e.g. with memory allocation).
*/
virtual int addVertex() abstract;
/*
Removes given vertex from the graph and all the edges containing it.
Returns:
0 if no error occurs
-1 otherwise
*/
virtual int removeVertex(int) abstract;
/*
Returns the number of vertices in a graph.
*/
virtual int getVerticesCount() abstract;
/*
Returns the number of edges in a graph.
*/
virtual int getEdgesCount() abstract;
/*
Returns:
degree of the given vertex
-1 if no such vertex exists.
*/
virtual int getDegree(int) abstract;
/*
Returns:
a pointer to the list of neighbors of a given vertex (for isolated vertex list is empty)
null if no such vertex exists
*/
virtual list<int>* getNeighbors(int) abstract;
/* Implement breadth-first-search algorithm using only the methods of the class Graph
Returns order of vertices in BFS starting from 'start' vertex.
3pt - algorithm working for a connected graph
4pt - algorithm working for a disconnected graph
*/
list<int> BFS(int start) {
list<int> order; //0. Order <- <>
if(!inGraph(start)) return order;
queue<int> q; //S - queue
list<int> v; //visited
int curr_start = start;
while(!allChecked(order)) {
v.push_back(curr_start); //1. Mark start as visited
q.push(curr_start); //2. S <- {start}
//we do the following for every segment, if the graph is connected, we do this only once
while (q.size() > 0) { //3. If S == {} Return
int curr = q.front();
q.pop(); //this and line before: 4. v <- S.dequeue()
order.push_back(curr); //5. order <- order + v
list<int> *n = getNeighbors(curr);
for(list<int>::iterator w = n->begin(); w != n->end() ; w++)
if (!isVisited(v,*w)) { //6.1 If w is not visited
v.push_back(*w); //6.1.1 Mark w as visited
q.push(*w); //6.1.2 S.enqueue(w)
}
delete n;
//7. Go to 3.
}
v.clear();
while(q.size() > 0) q.pop();
//for disconnected graph, we search for the first vertex that is not in the output
// and repeat the algorithm for the segment that this found vertex is a part of
if(!allChecked(order))
for(int i = 0; i < getVerticesCount(); i++)
if(!isVisited(order, i)) {
curr_start = i;
break;
}
}
return order;
}
//list<int> BFS(int start)
//{
// list<int> order; //0. Order <- <>
// queue<int> S; //S - queue
// list<int> visited;
// visited.push_back(start); // 1. Mark start as visited
// S.push(start); // 2. S <- {start}
// while(!S.empty()){ // 3. If S == {} Return
// int v =S.front();
// S.pop(); // 4. v <- S.dequeue()
// order.push_back(v); // 5. order <- order + v
// list<int> *neighbours = getNeighbors(v);
// // neighbours->push_back(...);
// // (*neighbours).push_back(...);
// for (list<int>::iterator i = neighbours->begin(); i != neighbours->end() ; i++ ) { // 6. For each w: wv in E(G)
// int w = *i;
// bool w_is_visited = false;
// for (list<int>::iterator a = visited.begin(); a != visited.end() ; a++ ){
// if(*a==w) {
// w_is_visited =true;
// break;
// }
// }
// if(!w_is_visited) { // 6.1 If w is not visited
// visited.push_back(w); // 6.1.1 Mark w as visited
// S.push(w);// 6.1.2 S.enqueue(w)
// }
// }
// delete neighbours;
// } // 7. Go to 3.
// return order;
// }
private:
/*
1 if vertex is in this graph, 0 otherwise
*/
int inGraph(int vertex) {
if(vertex < 0) return 0;
if(vertex >= getVerticesCount()) return 0;
return 1;
}
/*
1 if the vertex is visted, 0 otherwise
*/
int isVisited(list<int>& v, int vertex) {
if(v.size() == 0) return 0;
for (list<int>::iterator i = v.begin(); i != v.end(); i++)
if (*i == vertex) return 1;
return 0;
}
//checks if the list o has the same number of members as this list
bool allChecked(list<int>& o) {
if(o.size() == getVerticesCount()) return true;
return false;
}
};
| 26.306452 | 116 | 0.621704 |
d102e92e119d8e749e3a09123a0ef9a95cd73241 | 3,972 | c | C | kronos_apps/ioserver/io_task_read.c | ecmwf/kronos | 4f8c896baa634fc937f866d2bd05b438106c1663 | [
"Apache-2.0"
] | 4 | 2020-09-15T15:16:17.000Z | 2021-08-17T14:02:28.000Z | kronos_apps/ioserver/io_task_read.c | ecmwf/kronos | 4f8c896baa634fc937f866d2bd05b438106c1663 | [
"Apache-2.0"
] | 4 | 2020-09-12T07:22:35.000Z | 2020-10-13T17:08:35.000Z | kronos_apps/ioserver/io_task_read.c | ecmwf/kronos | 4f8c896baa634fc937f866d2bd05b438106c1663 | [
"Apache-2.0"
] | null | null | null |
#include "ioserver/io_task_read.h"
#include "common/json.h"
#include "common/logger.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <errno.h>
#include <assert.h>
#include "limits.h"
/*
* get task name
*/
static const char* get_name_taskr(const void* data){
const IOTaskReadInputData* task_data = data;
assert(task_data != NULL);
return task_data->name;
}
/*
* execute a read (open-seek-read-close)
* NB: caller has ownership of "out_data"
*/
static int execute_read_file(void* data, IOData** out_data){
IOTaskReadInputData* task_data = data;
FILE* file_d;
long result;
int ret;
long int iread;
long int iread_total;
long int read_chunk = task_data->n_bytes / task_data->n_reads;
char* read_tmp;
char* reading_ptr;
long int offset_total;
DEBG1("--> executing reading.. ");
/* allocate space for the output */
DEBG2("allocating %i bytes", task_data->n_reads * read_chunk);
(*out_data)->size = task_data->n_reads * read_chunk;
(*out_data)->content = malloc(task_data->n_reads * read_chunk);
DEBG2("%i bytes allocated", task_data->n_reads * read_chunk);
/* open-seek-read-close */
iread_total = 0;
for (iread=0; iread<task_data->n_reads; iread++)
{
file_d = fopen(task_data->file, "rb");
DEBG2("file %s open", task_data->file);
if (file_d != NULL) {
/* at each read move to the correct offset */
offset_total = task_data->offset+iread*read_chunk;
ret = fseek(file_d, offset_total, SEEK_SET);
DEBG2("--> trying to read %i bytes ", read_chunk);
if (ret == -1) {
ERRO2("A error occurred seeking in file: %s (%d) %s", task_data->file);
return -1;
} else {
/* read from file from the proper offset location */
reading_ptr = (char*)((*out_data)->content) + offset_total;
result = fread( reading_ptr, 1, read_chunk, file_d);
if (result != read_chunk) {
ERRO2("A read error occurred reading file: %s (%d) %s", task_data->file);
return -1;
}
DEBG2("--> read %i bytes ", result);
/* --------------------------------- */
iread_total += result;
}
fclose(file_d);
DEBG2("file %s closed.", task_data->file);
}
}
DEBG2("check on total bytes read: %i.", iread_total);
memset((char*)((*out_data)->content)+iread_total,'\0',1);
DEBG2("output: %s", (char*)((*out_data)->content));
DEBG1("..reading done!");
return 0;
}
/*
* free a iotask_read
*/
static int free_data_iotask_read(void* data){
IOTaskReadInputData* task_data = data;
free(task_data->name);
free(task_data->file);
/* finally free everything */
free(task_data);
}
/*
* init functor
*/
IOTaskFunctor* init_iotask_read(const JSON* config){
IOTaskFunctor* functor;
IOTaskReadInputData* data;
DEBG1("initialising iotask read..");
functor = malloc(sizeof(IOTaskFunctor));
data = (IOTaskReadInputData*)malloc(sizeof(IOTaskReadInputData));
/* fill up the write functor as appropriate */
json_as_string_ptr(json_object_get(config, "name"), (const char**)(&(data->name)) );
json_as_string_ptr(json_object_get(config, "file"), (const char**)(&(data->file)) );
json_object_get_integer(config, "n_bytes", &(data->n_bytes));
json_object_get_integer(config, "offset", &(data->offset));
json_object_get_integer(config, "n_reads", &(data->n_reads));
/* prepare the functor */
functor->data = data;
functor->execute = execute_read_file;
functor->free_data = free_data_iotask_read;
functor->get_name = get_name_taskr;
DEBG1("initialisation done!");
return functor;
}
| 25.461538 | 93 | 0.602971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.