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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b3e85289e3c8baf8085e728cca65719d7577cdb | 2,127 | c | C | criu/test/zdtm/static/sk-unix-rel.c | depaul-dice/provenance-to-use | e16e2824fbbe0b4e09cc50f0d2bcec3400bf4b87 | [
"BSD-3-Clause"
] | null | null | null | criu/test/zdtm/static/sk-unix-rel.c | depaul-dice/provenance-to-use | e16e2824fbbe0b4e09cc50f0d2bcec3400bf4b87 | [
"BSD-3-Clause"
] | null | null | null | criu/test/zdtm/static/sk-unix-rel.c | depaul-dice/provenance-to-use | e16e2824fbbe0b4e09cc50f0d2bcec3400bf4b87 | [
"BSD-3-Clause"
] | null | null | null |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <limits.h>
#include <fcntl.h>
#include "zdtmtst.h"
const char *test_doc = "Test unix stream sockets with relative name\n";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org";
#define SK_DATA "packet"
char *filename;
TEST_OPTION(filename, string, "socket file name", 1);
#define TEST_MODE 0640
int main(int argc, char *argv[])
{
struct sockaddr_un addr;
unsigned int addrlen;
int sock[2];
char path[PATH_MAX];
char buf[64];
char *cwd;
int ret;
test_init(argc, argv);
cwd = get_current_dir_name();
if (!cwd) {
fail("getcwd\n");
exit(1);
}
snprintf(path, sizeof(path), "%s/%s", cwd, filename);
unlink(path);
addr.sun_family = AF_UNIX;
addrlen = strlen(filename);
if (addrlen > sizeof(addr.sun_path))
return 1;
memcpy(addr.sun_path, filename, addrlen);
addrlen += sizeof(addr.sun_family);
sock[0] = socket(AF_UNIX, SOCK_STREAM, 0);
sock[1] = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock[0] < 0 || sock[1] < 0) {
fail("socket\n");
exit(1);
}
if (setsockopt(sock[0], SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)) < 0 ||
setsockopt(sock[1], SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)) < 0) {
fail("setsockopt\n");
exit(1);
}
ret = bind(sock[0], (struct sockaddr *) &addr, addrlen);
if (ret) {
fail("bind\n");
exit(1);
}
ret = listen(sock[0], 16);
if (ret) {
fail("bind\n");
exit(1);
}
test_daemon();
test_waitsig();
if (connect(sock[1], (struct sockaddr *) &addr, addrlen)) {
fail("connect\n");
exit(1);
}
ret = accept(sock[0], NULL, NULL);
if (ret < 0) {
fail("accept");
exit(1);
}
memset(buf, 0, sizeof(buf));
write(sock[1], SK_DATA, sizeof(SK_DATA));
read(ret, &buf, sizeof(buf));
if (strcmp(buf, SK_DATA)) {
fail("data corrupted\n");
exit(1);
}
test_msg("stream : '%s'\n", buf);
close(sock[0]);
close(sock[1]);
unlink(path);
pass();
return 0;
}
| 18.991071 | 83 | 0.630936 |
1282d10104aec2180de3694d8bd34bc1c96c6d73 | 390 | h | C | inc/zc/lex/token_queue.h | zestier/zc-lex | 251698097466b8c7a7eaf9f652d7d16a1ff67a16 | [
"MIT"
] | null | null | null | inc/zc/lex/token_queue.h | zestier/zc-lex | 251698097466b8c7a7eaf9f652d7d16a1ff67a16 | [
"MIT"
] | null | null | null | inc/zc/lex/token_queue.h | zestier/zc-lex | 251698097466b8c7a7eaf9f652d7d16a1ff67a16 | [
"MIT"
] | null | null | null | #pragma once
#include "lexer.h"
#include "token.h"
#include <string_view>
namespace zc::lex {
class TokenQueue {
public:
struct Options {
bool skipWhitespace;
bool skipComments;
};
private:
Lexer lexer;
Token next;
Options options;
public:
TokenQueue(std::string_view input, Options defaultOptions = Options{});
public:
Token Peek() const;
Token Pop();
};
} | 14.444444 | 73 | 0.684615 |
85426e5930477b9fdf94102230531f746376f2ed | 24,383 | c | C | mjd/siginspect.c | sjmeijer/rw0nbb | fa116c33c9727e873e977f91c45df33e9b8d7ae1 | [
"BSD-2-Clause"
] | null | null | null | mjd/siginspect.c | sjmeijer/rw0nbb | fa116c33c9727e873e977f91c45df33e9b8d7ae1 | [
"BSD-2-Clause"
] | null | null | null | mjd/siginspect.c | sjmeijer/rw0nbb | fa116c33c9727e873e977f91c45df33e9b8d7ae1 | [
"BSD-2-Clause"
] | 4 | 2021-02-03T20:06:34.000Z | 2021-04-30T19:45:15.000Z | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "MJDSort.h"
#define VERBOSE 0
#define DELTATIME 1 // resolving time for timestamp selection
#define FILTER_10MHZ 0
void signalselect(FILE *f_in, MJDetInfo *detInfo, MJRunInfo *runInfo);
int main(int argc, char **argv) {
FILE *f_in, *f_lis=0;
MJDetInfo detInfo[NMJDETS];
int nDets;
MJRunInfo runInfo;
int argn=1;
char *c, fname[256], line[256];
if (argc < 6) {
fprintf(stderr, "\nusage: %s fname_in chnum_lo chnum_hi e_lo e_hi [-nakKdpzilt]\n"
" -n: do not subtract initial baseline\n"
" -z: subtract final signal, so that shifted value is zero after rise\n"
" -a: align signals to t80 = sample 1100\n"
" -k: e_lo, e_hi are in keV rather than ADC\n"
" -K: e_lo, e_hi are in keV, calculated using PZ correction\n"
" -p: do PZ correction\n"
" -d: take derivative of signal\n"
" -i: do not try to correct for INL\n"
" -l: select only events passing A/E and DCR but failing lq cut\n"
" -t: read a list of timestamps to get from ts.input\n\n", argv[0]);
return -1;
}
/* open raw data file as input */
if (strstr(argv[argn], ".lis")) { // input argument is a list file
if ((f_lis = fopen(argv[argn],"r")) == NULL) {
fprintf(stderr, "\n Failed to open list input file %s\n", argv[argn]);
return 0;
}
if (!fgets(fname, sizeof(fname), f_lis)) {
fprintf(stderr, "\n Failed to read list input file %s\n", argv[argn]);
return 0;
}
for (c = fname + strlen(fname); *c < '0'; c--) *c = 0; // removing trailing junk
} else { // use command argument as input file
strncpy(fname, argv[argn], sizeof(fname));
}
while (argn < argc && argv[argn][0] == '-') argn ++;
if ((f_in = fopen(fname, "r")) == NULL) {
fprintf(stderr, "\n Failed to open input file %s\n", fname);
return 0;
}
printf("\n >>> Reading %s\n\n", fname);
strncpy(runInfo.filename, fname, 256);
runInfo.argc = argc;
runInfo.argv = argv;
/* read file header */
nDets = decode_runfile_header(f_in, detInfo, &runInfo);
if (nDets < 1) return 1;
if (runInfo.dataIdGM == 0 && runInfo.dataIdGA == 0)
printf("\n No data ID found for Gretina4M or 4A data!\n");
if (runInfo.dataIdGM)
printf("\n Data ID %d found for Gretina4M data\n", runInfo.dataIdGM);
if (runInfo.dataIdGA)
printf("\n Data ID %d found for Gretina4A data\n", runInfo.dataIdGA);
printf(" Run number: %d in file %s\n", runInfo.runNumber, runInfo.filename);
/* loop over all input files */
while (1) {
/* read through all the events in the file */
runInfo.analysisPass = 0;
signalselect(f_in, detInfo, &runInfo);
fclose(f_in);
if (!f_lis) break;
/* get next input file name */
if (!fgets(fname, sizeof(fname), f_lis)) // no more lines in the input list file
strncpy(fname, "0", strlen(fname)); // special string
for (c = fname + strlen(fname); *c < '0'; c--) *c = 0; // removing trailing junk
if (strlen(fname) < 2) break; // no more files to process
/* open next file and read header size and run number */
if ((f_in = fopen(fname,"r")) == NULL) {
fprintf(stderr, "\n Failed to open input file %s\n", fname);
return 0;
}
strncpy(runInfo.filename, fname, sizeof(runInfo.filename));
printf("\n >>> Reading %s\n\n", fname);
fread(&runInfo.fileHeaderLen, 1, sizeof(int), f_in);
/* loop through the lines of the XML data until we find the run number */
while (fgets(line, sizeof(line), f_in) && strncmp(line, "</plist>", 8)) {
if (strstr(line, "<key>RunNumber</key>")) {
fgets(line, sizeof(line), f_in);
if (!(c=strstr(line, "<integer>")) ||
(1 != sscanf(c+9, "%d", &runInfo.runNumber))) {
fprintf(stderr, "\n ERROR decoding run number:\n %s\n", line);
return -1;
}
break;
}
}
/* position at start of data */
fseek(f_in, 4*runInfo.fileHeaderLen, SEEK_SET);
}
printf("\n All Done.\n\n");
return 0;
}
/* ========================================================== */
void signalselect(FILE *f_in, MJDetInfo *Dets, MJRunInfo *runInfo) {
int i, j, k, crate=0, slot=0, evlen, ch, chan, sig_len, dd0, dd1, d;
int board_type, dataIdRun=0;
unsigned int head[2], evtdat[20000];
static int totevts=0, out_evts=0, clo, chi, elo, ehi;
static int doINL = 1, doPZ = 0, doLQ = 0, current_runNumber = 0;
static long long int time, tsget[2000] = {0};
static int module_lu[NCRATES+1][21]; // lookup table to map VME crate&slot into module IDs
static int det_lu[NBDS][16]; // lookup table to map module&chan into detector IDs
static int chan_lu[NBDS][16]; // lookup table to map module&chan into parameter IDs
static PZinfo PZI;
static PSAinfo PSA;
static FILE *f_out=0, *f_ts = 0;
static int argn = 1, subbl = 1, kev = 0, align = 0, ts_sel = 0, erro, ntsget = 0, norm = 0, deriv=0;
short *signal, ucsig[8192], sigu[2048]; // ucsig = uncompressed signal (presumming corrected)
float fsignal[8192] = {0}, fs2[8192] = {0}, e1;
float drift, aovere, dcr, lq;
double e_raw, e_adc, e_ctc;
int t80, t95, t100, bl, step, tsmatch = 0;
char line[256];
/* initialize some values */
if (!f_out) {
if (ep_init(Dets, runInfo, module_lu, det_lu, chan_lu) < 0) return;
for (argn = 1; argn < runInfo->argc; argn++) {
if (runInfo->argv[argn][0] == '-') {
if (strstr(runInfo->argv[argn], "n")) subbl = 0;
if (strstr(runInfo->argv[argn], "z")) norm = 1;
if (strstr(runInfo->argv[argn], "a")) align = 1;
if (strstr(runInfo->argv[argn], "k")) kev = 1;
if (strstr(runInfo->argv[argn], "K")) kev = 2;
if (strstr(runInfo->argv[argn], "p")) doPZ = 1;
if (strstr(runInfo->argv[argn], "d")) deriv = 1;
if (strstr(runInfo->argv[argn], "i")) doINL = 0;
if (strstr(runInfo->argv[argn], "l")) doLQ = 1;
if (strstr(runInfo->argv[argn], "t") &&
(f_ts = fopen("ts.input", "r"))) ts_sel = 1;
}
}
argn = 2;
clo = atoi(runInfo->argv[argn++]);
chi = atoi(runInfo->argv[argn++]);
elo = atoi(runInfo->argv[argn++]);
ehi = atoi(runInfo->argv[argn++]);
printf("\nChs %d to %d, e_trapmax %d to %d\n\n", clo, chi, elo, ehi);
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "n")) subbl = 0;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "z")) norm = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "a")) align = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "k")) kev = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "K")) kev = 2;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "p")) doPZ = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "d")) deriv = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "i")) doINL = 0;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "l")) doLQ = 1;
if (runInfo->argc > argn && strstr(runInfo->argv[argn], "t") &&
(f_ts = fopen("ts.input", "r"))) ts_sel = 1;
if (doLQ) doPZ = 1;
/* read A/E, DCR, and lamda values from psa.input */
/* also read individual trapezoid values from filters.input (if it exists) */
if (!PSA_info_read(runInfo, &PSA)) {
printf("\n ERROR: No initial PSA data read. Does psa.input exist?\n");
if (doLQ) {
printf(" LQ cut requires psa.input; aborting.\n");
exit(-1);
}
}
f_out = fopen("s.rms", "w");
if (kev==2 || doPZ) doPZ = PZ_info_read(runInfo, &PZI);
if (kev==2 && !doPZ) {
printf("\n ERROR: No initial pole-zero data read, needed for keV. Does PZ.input exist?\n");
return;
}
while (ts_sel &&
ntsget < 2000 &&
fgets(line, sizeof(line), f_ts)) {
if (strlen(line) > 5 && line[0] != '#' &&
sscanf(line, "%lld", &tsget[ntsget]) == 1) {
if (tsget[ntsget] > 168 ||
sscanf(line, "%d %f %lld", &j, &e1, &tsget[ntsget]) == 3) ntsget++;
}
}
if (ts_sel) printf(" >>>> %d timestamps to look for matches\n", ntsget);
}
for (i=0; i<runInfo->idNum; i++) {
if (strstr(runInfo->decoder[i], "ORRunDecoderForRun")) {
dataIdRun = runInfo->dataId[i];
printf("dataIdRun = %d %s %d\n", dataIdRun, runInfo->decoder[i], i);
}
}
printf("dataIdRun = %d\n", dataIdRun);
/* start loop over reading events from input file
============================================== */
while (fread(head, sizeof(head), 1, f_in) == 1) {
board_type = head[0] >> 18;
evlen = (head[0] & 0x3ffff);
if (board_type == 0) { // a new runfile header! file must be corrupt?
printf("\n >>>> ERROR: DataID = 0; found a second file header??"
" Ending scan of this file!\n"
" >>>> head = %8.8x %8.8x evlen = %d\n", head[0], head[1], evlen);
break;
}
if (board_type == dataIdRun) {
fread(evtdat, 8, 1, f_in);
if (head[1] & 0x21) {
// printf("------- START Run %d at %d", evtdat[0], evtdat[1]);
current_runNumber = evtdat[0];
}
continue;
}
/* if we don't want to decode this type of data, just skip forward in the file */
if (board_type != runInfo->dataIdGM &&
board_type != runInfo->dataIdGA) {
if (evlen > 10000) {
printf("\n >>>> ERROR: Event length too long??\n"
" >>>> This file is probably corruped, ending scan!\n");
break;
}
fseek(f_in, 4*(evlen-2), SEEK_CUR);
continue;
}
slot = (head[1] >> 16) & 0x1f;
crate = (head[1] >> 21) & 0xf;
if (crate < 0 || crate > NCRATES ||
slot < 0 || slot > 20) {
printf("ERROR: Illegal VME crate or slot number %d %d\n", crate, slot);
if (fread(evtdat, sizeof(int), evlen-2, f_in) != evlen-2) break;
continue;
}
/* ========== read in the rest of the event data ========== */
if (fread(evtdat, sizeof(int), evlen-2, f_in) != evlen-2) {
printf(" No more data...\n");
break;
}
if (++totevts % 20000 == 0) {
printf(" %8d evts in, %d out\n", totevts, out_evts); fflush(stdout);
}
/* --------------- Gretina4M digitizer data ---------------- */
time = (evtdat[3] & 0xffff);
time = time << 32 | evtdat[2];
if (time < 0) continue;
tsmatch = 0;
for (i=0; i<ntsget; i++) {
if (time >= tsget[i] - DELTATIME && time <= tsget[i] + DELTATIME) {
ch = (evtdat[1] & 0xf);
chan = chan_lu[module_lu[crate][slot]][ch];
printf(" >>>> timestamp %14lld matches, chan %3d, run %6d\n",
time, chan, current_runNumber);
tsmatch = 1;
break;
}
}
ch = (evtdat[1] & 0xf);
if ((j = module_lu[crate][slot]) >= 0 && ch < 10) {
chan = chan_lu[j][ch];
if (chan >= 0 && chan <= 157 &&
((chan < 100 && !Dets[chan].HGChEnabled) ||
(chan > 99 && !Dets[chan-100].LGChEnabled))) {
printf("Data from detector not enabled! Chan = %d crate, slot, j, ch = %d %d %d %d\n", chan, crate, slot, j, ch);
chan = -1;
}
if (chan < clo || chan > chi) continue;
signal = (short *) evtdat + 28;
if (evlen != 1026 && signal[0] == 2020 && // signal is compressed; decompress it
2020 == decompress_signal((unsigned short *)signal, sigu, 2*(evlen - 2) - 28)) {
signal = sigu;
evlen = 1026;
}
sig_len = 2012;
if (chan <= 99) {
k = Dets[chan].HGPrerecnt + Dets[chan].HGPostrecnt; // expected location of presumming start
} else {
k = Dets[chan-100].LGPrerecnt + Dets[chan-100].LGPostrecnt;
}
erro = 0;
if (k > 10 && k < sig_len) { // correct for presumming
// FIXME: replace hard-coded factor of 4 with data from header
step = k;
j = (signal[step-5] + signal[step-4] + signal[step-3] + signal[step-2])/4;
if (j > 10 || j < -10) {
/* --- Find transition to 4x presumming ------- */
for (step=k; step<k+2; step++) {
if (j > 0 && signal[step] > 2*j) break;
if (j < 0 && signal[step] < 2*j) break;
}
if (step == k+2) {
step = k+1;
erro = 1;
printf("Hmmm... step not found in %d - %d in chan %3d, counts %d\n",
step-1, step, chan, j);
}
}
/* --- uncompress --- */
for (i=0; i<step; i++) ucsig[i+10] = signal[i];
for (i=step; i<sig_len; i++) { // NOTE: This is wrong for signal < 0
for (j=0; j<4; j++)
ucsig[step + 10 + 4*(i-step) + j] = signal[i]/4; // dist sums over 4 bins each
for (j=0; j<signal[i]%4; j++)
ucsig[step + 10 + 4*(i-step) + j]++; // and make sure sum is right
}
sig_len += 3*(sig_len-step);
signal = &ucsig[10];
}
/* --- Done with 4x presumming ------- */
if (kev==2) {
if (PZ_correct(signal, fsignal, sig_len, chan, &PZI))
printf(" >>> PZ_correct return error for chan %d\n", chan);
e1 = float_trap_max(fsignal, &j, 401, 250)/401.0;
} else {
e1 = trap_max(signal, &j, 401, 200)/401;
}
if (kev) {
if (chan <= 57) {
e1 *= Dets[chan].HGcalib[0];
} else if (chan > 99 && chan <= 157) {
e1 *= Dets[chan-100].LGcalib[0];
}
}
if (// !erro &&
(e1 < elo || e1 > ehi) &&
!tsmatch) continue;
/* sticky-bit fix */
d = 128; // basically a sensitivity threshold; max change found will be d/2
if (chan > 99 && chan < 100+runInfo->nGe) d = 64;
for (i=20; i<sig_len-10; i++) {
// calculate second derivatives
dd0 = abs((int) signal[i+1] - 2*((int) signal[i]) + (int) signal[i-1]);
dd1 = abs((int) signal[i+2] - 2*((int) signal[i+1]) + (int) signal[i]);
if (dd0 > d && dd0 > dd1 && dd0 > abs(signal[i+1] - signal[i-1])) {
// possible occurrence; make sure it's not just high-frequency noise
for (k=i-8; k<i+8; k++) {
if (k==i-1 || k==i || k == i+1) continue;
dd1 = abs((int) signal[k+1] - 2*((int) signal[k]) + (int) signal[k-1]);
if (dd0 < dd1*3) break;
}
if (k<i+8) continue;
dd0 = (int) signal[i+1] - 2*((int) signal[i]) + (int) signal[i-1];
j = lrintf((float) dd0 / (float) d);
printf("Fixing sticky bit in signal %d, chan %d, t=%d, change %d\n",
out_evts-1, chan, i, j*d/2);
//signal[i] += j*d/2;
break;
}
}
/* find mean baseline value */
bl = 0;
for (i=300; i<400; i++) bl += signal[i];
bl /= 100;
// lost events for doLQ=0 between here
//out_evts++;
/* find t100, t95, and t80 (t80 will be redone later of -l is specified) */
t100 = 700; // FIXME? arbitrary 700?
for (i = t100+1; i < sig_len - 500; i++)
if (signal[t100] < signal[i]) t100 = i;
if (t100 > sig_len - 700) continue; // FIXME ?? - important for cleaning, gets rid of pileup
/* get mean baseline value */
if (doPZ &&
((bl - PZI.baseline[chan]) < -10 || (bl - PZI.baseline[chan]) > 50)) continue; // a little data cleaning
i = bl + (signal[t100] - bl)*19/20;
for (t95 = t100-1; t95 > 500; t95--)
if (signal[t95] <= i) break;
i = bl + (signal[t100] - bl)*4/5;
for (t80 = t100-1; t80 > 500; t80--)
if (signal[t80] <= i) break;
// and here
//out_evts++;
/* do (optional) INL and PZ corrections */
if (doINL) {
if (inl_correct(Dets, runInfo, signal, fsignal, sig_len, chan))
printf(" >>> inl_correct return error for chan %d\n", chan);
if (doPZ) {
if (PZ_fcorrect(fsignal, sig_len, chan, &PZI))
printf(" >>> PZ_correct return error for chan %d\n", chan);
}
for (i=0; i<sig_len; i++) signal[i] = lrintf(fsignal[i]);
} else if (doPZ) {
if (PZ_correct(signal, fsignal, sig_len, chan, &PZI))
printf(" >>> PZ_correct return error for chan %d\n", chan);
for (i=0; i<sig_len; i++) signal[i] = lrintf(fsignal[i]);
}
if (1 && (doINL || doPZ)) bl = PZI.baseline[chan];
if (doLQ) {
/* get raw (e_raw) and drift-time-corrected energy (e_adc and e_ctc)
and effective drift time */
int tmax, t0;
e_ctc = get_CTC_energy(fsignal, sig_len, chan, Dets, &PSA,
&t0, &e_adc, &e_raw, &drift, 0.0);
if (e_ctc < 0.001) {
printf("E_ctc = %.1f < 1 eV!\n", e_ctc);
if (VERBOSE) printf("chan, t0, t100: %d %d %d; e, drift: %.2f %.2f\n",
chan, t0, t100, e_raw, drift);
continue;
}
if (runInfo->flashcam) {
e_ctc /= 2.0;
e_adc /= 2.0;
e_raw /= 2.0;
drift /= 2.0;
}
/* find A/E */
if (e_ctc > 50 && t0 > 200 && t0 < 1500) {
float s2 = float_trap_max_range(fsignal, &tmax, PSA.a_e_rise[chan], 0, t0-20, t0+300); // FIXME: hardwired range??
aovere = s2 * PSA.a_e_factor[chan] / e_raw;
/* do quadratic fit/interpolation over +- one sample, to improve max A/E determination
does this help? seems to work well in some cases, in other cases not so much?
*/
if (AoE_quad_int) {
float s1, s3, a, b, aoe;
int rise = PSA.a_e_rise[chan];
s1 = s2 - (fsignal[tmax ] - 2.0*fsignal[tmax + rise] + fsignal[tmax + 2*rise]);
s3 = s2 + (fsignal[tmax+1] - 2.0*fsignal[tmax+1 + rise] + fsignal[tmax+1 + 2*rise]);
b = s2 - (s1+s3)/2.0;
a = s2 - s1 + b;
aoe = s1 + a*a/(4.0*b);
if (aoe > s2) aovere = aoe * PSA.a_e_factor[chan] / e_raw;
}
if (runInfo->flashcam) aovere /= 2.0;
} else {
aovere = 0;
if (e_raw > 1000)
printf("Error getting A/E: chan %d e_raw, e_ctc = %.0f, %.0f t0 = %d\n", chan, e_raw, e_ctc, t0);
}
/* ---- This next section calculates the GERDA-style A/E ---- */
if (PSA.gerda_aoe[chan]) {
float ssig[6][2000];
for (k=100; k<2000; k++) ssig[0][k] = fsignal[k] - fsignal[300];
for (j=1; j<6; j++) { // number of cycles
for (i=200; i < 1500; i++) {
ssig[j][i] = 0.0;
for (k=0; k<10; k++) {
ssig[j][i] += ssig[j-1][i+k-5];
}
ssig[j][i] /= 10.0;
}
}
aovere = 0;
for (k=250; k<1450; k++) {
if (aovere < ssig[5][k] - ssig[5][k-1]) aovere = ssig[5][k] - ssig[5][k-1];
}
aovere *= 12.71*1593/e_raw;
}
/* ---- end of GERDA-style A/E ---- */
float dtc = drift*3.0*2614.0/e_adc; // in (x)us, for DT- correction to A/E
if (chan%100 == 50) dtc *= 3.0; // special hack for detector 50; has especially strong variation
float ec = e_ctc/1000.0 - 2.0; // in MeV, for E-correction to A/E
float aovere1 = aovere + PSA.ae_dt_slope[chan] * dtc;
float aovere2 = aovere1 + PSA.ae_e_slope[chan] * ec;
//if (AOE_CORRECT_NOISE)
// aovere2 -= (2.0 * PZI.bl_rms[chan] * sqrt(2.0 * (float) PSA.a_e_rise[chan]) *
// PSA.a_e_factor[chan] * gain/1593.0 * (1.0 - 1593.0/e_ctc)); // 1593 keV = DEP
aovere2 -= AOE_CORRECT_EDEP * (PSA.ae_pos[chan] - PSA.ae_cut[chan]) * (1.0 - e_ctc*e_ctc/1593.0/1593.0);
if (PSA.ae_pos[chan] > 100 && aovere2 < PSA.ae_cut[chan]) continue; // fails A/E cut and doLQ == 1
/* get DCR from slope of PZ-corrected signal tail */
if (sig_len < 2450) {
if (t95 + 760 > sig_len) {
if (VERBOSE)
printf("Error getting DCR in skim.c: t95 = %d, sig_len = %d\n", t95, sig_len);
continue;
}
dcr = float_trap_fixed(fsignal, t95+50, 100, 500) / 25.0;
} else {
if (t95 + 1180 > sig_len) {
if (VERBOSE)
printf("Error getting DCR in skim.c: t95 = %d, sig_len = %d\n", t95, sig_len);
continue;
}
dcr = float_trap_fixed(fsignal, t95+50, 160, 800) / 40.0;
}
dcr -= PSA.dcr_dt_slope[chan] * drift;
if (dcr > PSA.dcr_lim[chan]) continue; // fails DCR cut and doLQ == 1
/* find bl, t80, lq from PZ-corrected signal */
/* get mean baseline value */
float fbl = 0;
for (i=300; i<400; i++) fbl += fsignal[i];
fbl /= 100.0;
float ff = fbl + e_raw * 0.8;
for (t80 = t95; t80 > 500; t80--)
if (fsignal[t80] <= ff) break;
lq = (fsignal[t80+1] - ff) / (fsignal[t80+1] - fsignal[t80]); // floating remainder for t80
lq *= (e_raw + fbl - (fsignal[t80+1] + ff)/2.0); // charge (not yet) arriving during that remainder
/* get late charge (lq) = delay in charge arriving after t80 */
lq += float_trap_fixed(fsignal, t80+1, 100, 100);
lq /= e_raw/100.0;
lq -= PSA.lq_dt_slope[chan] * dtc; // do DT correction to lq
if (lq < PSA.lq_lim[chan]) continue; // passes LQ cut and doLQ == 1 selects only LQ-failing events
if (0)
printf("chan %3d | A/E, cut: %6.1f %6.1f | DCR, cut: %5.1f %5.1f | lq, cut: %5.1f %5.1f\n",
chan, aovere2, PSA.ae_cut[chan], dcr, PSA.dcr_lim[chan], lq, PSA.lq_lim[chan]);
} // end if (doLQ) {
out_evts++;
// optionally subtract initial baseline
if (subbl)
for (i=0; i<sig_len; i++) signal[i] -= bl;
// optionally remove 10MHz noise
if (FILTER_10MHZ) {
if (!doINL && !doPZ) {
for (i=0; i<sig_len; i++) fsignal[i] = signal[i];
} else if (subbl) {
for (i=0; i<sig_len; i++) fsignal[i] -= bl;
}
// 3-2-3 trap filter
fs2[0] = 0;
for (i=0; i < 3; i++) fs2[0] += fsignal[i+5] - fsignal[i];
for (i=1; i < sig_len-7; i++) {
fs2[i] = fs2[i-1] + fsignal[i+7] - fsignal[i+4] - fsignal[i+2] + fsignal[i-1];
}
// for (i=6; i < sig_len; i++) signal[i] = lrintf(fsignal[i] - 0.19*fs2[i-6]);
for (i=6; i < sig_len-6; i++) signal[i] = lrintf(fsignal[i] - 0.095*fs2[i-6] + 0.095*fs2[i-1]);
}
// optionally subtract final signal value, so signal ends at 0 ADC
if (norm) {
d = 100;
for (i=1700; i<1900; i++) d += signal[i];
d /= 200;
for (i=0; i<sig_len; i++)
if (signal[i] > d/2) signal[i] -= d;
}
// optionally align t80 to t=1100
if (align) {
if (t80 > 1100) {
j = t80 - 1100;
for (i=1; i+j < sig_len; i++)
signal[i] = signal[i+j];
} else if (t80 < 1100) {
j = 1100 - t80;
for (i=sig_len - 1; i-j > 0; i--)
signal[i] = signal[i-j];
}
}
// optionally take derivative of signal (4-0-4 samples trap filter)
if (deriv) {
k = 0;
for (i=0; i < 4; i++) k += signal[i+5] - signal[i+1];
signal[0] = k;
for (i=1; i < sig_len-9; i++) {
k += signal[i+8] - 2*signal[i+4] + signal[i];
signal[i] = k;
}
for (; i < sig_len; i++) signal[i]=0;
}
// optionally add some extra information at the start
if (1) {
signal -= 8; // 8 extra words (shorts)
sig_len += 8;
for (i=0; i<8; i++) signal[i] = 0;
signal[2] = (short) e1;
signal[4] = (short) ((evtdat[8]>>11)&0xf)*100; // CHECKME
signal[6] = (short) chan;
}
write_sig(signal, sig_len, chan, f_out);
// printf("output signal: chan %d time %lld energy %.1f\n", chan, time, e1);
}
}
//fclose(f_out);
printf(" %8d evts in, %d out\n", totevts, out_evts);
return;
} /* signalselect() */
| 39.582792 | 124 | 0.513308 |
6ad8529206e1b6ca9aa5decda5e90dedac197f29 | 247 | h | C | futures/futures/Mine/V/MXZFeedbackBtn.h | iOSfutures/futures | bff2a131dea94c882ec375a86e871128381386e8 | [
"MIT"
] | 3 | 2020-05-19T08:32:42.000Z | 2020-05-29T13:07:57.000Z | futures/futures/Mine/V/MXZFeedbackBtn.h | iOSfutures/futures | bff2a131dea94c882ec375a86e871128381386e8 | [
"MIT"
] | null | null | null | futures/futures/Mine/V/MXZFeedbackBtn.h | iOSfutures/futures | bff2a131dea94c882ec375a86e871128381386e8 | [
"MIT"
] | null | null | null | //
// MXZFeedbackBtn.h
// futures
//
// Created by Francis on 2020/5/26.
// Copyright © 2020 Francis. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MXZFeedbackBtn : UIButton
@end
NS_ASSUME_NONNULL_END
| 13.722222 | 50 | 0.724696 |
0eb48f9266c4dff20f612213e785e8c52256b7b7 | 15,598 | h | C | include/dsn/tool-api/task_spec.h | chen-hwera/rDSN | cbaf0ef284016dd8a6f520fce57f2a53e600255a | [
"MIT"
] | 953 | 2015-05-15T23:06:00.000Z | 2019-05-04T13:12:38.000Z | include/dsn/tool-api/task_spec.h | chen-hwera/rDSN | cbaf0ef284016dd8a6f520fce57f2a53e600255a | [
"MIT"
] | 349 | 2015-10-15T00:13:57.000Z | 2019-04-02T08:44:59.000Z | include/dsn/tool-api/task_spec.h | chen-hwera/rDSN | cbaf0ef284016dd8a6f520fce57f2a53e600255a | [
"MIT"
] | 244 | 2015-05-15T21:15:15.000Z | 2019-04-29T03:20:36.000Z | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 Microsoft Corporation
*
* -=- Robust Distributed System Nucleus (rDSN) -=-
*
* 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.
*/
/*
* Description:
* specification for the labeled tasks (task kinds)
*
* Revision history:
* Mar., 2015, @imzhenyu (Zhenyu Guo), first version
* xxxx-xx-xx, author, fix bug about xxx
*/
# pragma once
# include <dsn/service_api_c.h>
# include <dsn/cpp/utils.h>
# include <dsn/cpp/config_helper.h>
# include <dsn/cpp/safe_string.h>
# include <dsn/utility/enum_helper.h>
# include <dsn/utility/customizable_id.h>
# include <dsn/utility/singleton_vector_store.h>
# include <dsn/utility/join_point.h>
# include <dsn/utility/extensible_object.h>
# include <dsn/utility/exp_delay.h>
# include <dsn/utility/dlib.h>
# include <dsn/tool-api/perf_counter.h>
ENUM_BEGIN(dsn_log_level_t, LOG_LEVEL_INVALID)
ENUM_REG(LOG_LEVEL_INFORMATION)
ENUM_REG(LOG_LEVEL_DEBUG)
ENUM_REG(LOG_LEVEL_WARNING)
ENUM_REG(LOG_LEVEL_ERROR)
ENUM_REG(LOG_LEVEL_FATAL)
ENUM_END(dsn_log_level_t)
ENUM_BEGIN(dsn_task_type_t, TASK_TYPE_INVALID)
ENUM_REG(TASK_TYPE_RPC_REQUEST)
ENUM_REG(TASK_TYPE_RPC_RESPONSE)
ENUM_REG(TASK_TYPE_COMPUTE)
ENUM_REG(TASK_TYPE_AIO)
ENUM_REG(TASK_TYPE_CONTINUATION)
ENUM_END(dsn_task_type_t)
ENUM_BEGIN(dsn_task_priority_t, TASK_PRIORITY_INVALID)
ENUM_REG(TASK_PRIORITY_LOW)
ENUM_REG(TASK_PRIORITY_COMMON)
ENUM_REG(TASK_PRIORITY_HIGH)
ENUM_END(dsn_task_priority_t)
namespace dsn {
enum worker_priority_t
{
THREAD_xPRIORITY_LOWEST,
THREAD_xPRIORITY_BELOW_NORMAL,
THREAD_xPRIORITY_NORMAL,
THREAD_xPRIORITY_ABOVE_NORMAL,
THREAD_xPRIORITY_HIGHEST,
THREAD_xPRIORITY_COUNT,
THREAD_xPRIORITY_INVALID
};
ENUM_BEGIN(worker_priority_t, THREAD_xPRIORITY_INVALID)
ENUM_REG(THREAD_xPRIORITY_LOWEST)
ENUM_REG(THREAD_xPRIORITY_BELOW_NORMAL)
ENUM_REG(THREAD_xPRIORITY_NORMAL)
ENUM_REG(THREAD_xPRIORITY_ABOVE_NORMAL)
ENUM_REG(THREAD_xPRIORITY_HIGHEST)
ENUM_END(worker_priority_t)
enum task_state
{
TASK_STATE_READY,
TASK_STATE_RUNNING,
TASK_STATE_FINISHED,
TASK_STATE_CANCELLED,
TASK_STATE_COUNT,
TASK_STATE_INVALID
};
ENUM_BEGIN(task_state, TASK_STATE_INVALID)
ENUM_REG(TASK_STATE_READY)
ENUM_REG(TASK_STATE_RUNNING)
ENUM_REG(TASK_STATE_FINISHED)
ENUM_REG(TASK_STATE_CANCELLED)
ENUM_END(task_state)
typedef enum ioe_mode
{
IOE_PER_NODE, // each node has shared io engine (rpc/disk/nfs/timer)
IOE_PER_QUEUE, // each queue has shared io engine (rpc/disk/nfs/timer)
IOE_COUNT,
IOE_INVALID
} ioe_mode;
ENUM_BEGIN(ioe_mode, IOE_INVALID)
ENUM_REG(IOE_PER_NODE)
ENUM_REG(IOE_PER_QUEUE)
ENUM_END(ioe_mode)
typedef enum grpc_mode_t
{
GRPC_TO_LEADER, // the rpc is sent to the leader (if exist)
GRPC_TO_ALL, // the rpc is sent to all
GRPC_TO_ANY, // the rpc is sent to one of the group member
GRPC_COUNT,
GRPC_INVALID
} grpc_mode_t;
ENUM_BEGIN(grpc_mode_t, GRPC_INVALID)
ENUM_REG(GRPC_TO_LEADER)
ENUM_REG(GRPC_TO_ALL)
ENUM_REG(GRPC_TO_ANY)
ENUM_END(grpc_mode_t)
typedef enum throttling_mode_t
{
TM_NONE, // no throttling applied
TM_REJECT, // reject the incoming request
TM_DELAY, // delay network receive ops to reducing incoming rate
TM_COUNT,
TM_INVALID
} throttling_mode_t;
ENUM_BEGIN(throttling_mode_t, TM_INVALID)
ENUM_REG(TM_NONE)
ENUM_REG(TM_REJECT)
ENUM_REG(TM_DELAY)
ENUM_END(throttling_mode_t)
ENUM_BEGIN(dsn_msg_serialize_format, DSF_INVALID)
ENUM_REG(DSF_THRIFT_BINARY)
ENUM_REG(DSF_THRIFT_COMPACT)
ENUM_REG(DSF_THRIFT_JSON)
ENUM_REG(DSF_PROTOC_BINARY)
ENUM_REG(DSF_PROTOC_JSON)
ENUM_END(dsn_msg_serialize_format)
// define network header format for RPC
DEFINE_CUSTOMIZED_ID_TYPE(network_header_format)
DEFINE_CUSTOMIZED_ID(network_header_format, NET_HDR_INVALID)
DEFINE_CUSTOMIZED_ID(network_header_format, NET_HDR_DSN)
// define network channel types for RPC
DEFINE_CUSTOMIZED_ID_TYPE(rpc_channel)
DEFINE_CUSTOMIZED_ID(rpc_channel, RPC_CHANNEL_TCP)
DEFINE_CUSTOMIZED_ID(rpc_channel, RPC_CHANNEL_UDP)
// define thread pool code
DEFINE_CUSTOMIZED_ID_TYPE(threadpool_code2)
class task;
class task_queue;
class aio_task;
class rpc_request_task;
class rpc_response_task;
class message_ex;
class admission_controller;
typedef void (*task_rejection_handler)(task*, admission_controller*);
struct rpc_handler_info;
typedef struct __io_mode_modifier__
{
ioe_mode mode; // see ioe_mode for details
task_queue* queue; // when mode == IOE_PER_QUEUE
int port_shift_value; // port += port_shift_value
} io_modifer;
class task_spec : public extensible_object<task_spec, 4>
{
public:
DSN_API static task_spec* get(int ec);
DSN_API static void register_task_code(dsn_task_code_t code, dsn_task_type_t type, dsn_task_priority_t pri, dsn_threadpool_code_t pool);
public:
// not configurable [
dsn_task_code_t code;
dsn_task_type_t type;
safe_string name;
dsn_task_code_t rpc_paired_code;
shared_exp_delay rpc_request_delayer;
// ]
// configurable [
dsn_task_priority_t priority;
grpc_mode_t grpc_mode; // used when a rpc request is sent to a group address
dsn_threadpool_code_t pool_code;
// allow task executed in other thread pools or tasks
// for TASK_TYPE_COMPUTE - allow-inline allows a task being executed in its caller site
// for other tasks - allow-inline allows a task being execution in io-thread
bool allow_inline;
bool randomize_timer_delay_if_zero; // to avoid many timers executing at the same time
network_header_format rpc_call_header_format;
dsn_msg_serialize_format rpc_msg_payload_serialize_default_format;
rpc_channel rpc_call_channel;
bool rpc_message_crc_required;
int32_t rpc_timeout_milliseconds;
int32_t rpc_request_resend_timeout_milliseconds; // 0 for no auto-resend
throttling_mode_t rpc_request_throttling_mode; //
safe_vector<int> rpc_request_delays_milliseconds; // see exp_delay for delaying recving
bool rpc_request_dropped_before_execution_when_timeout;
// layer 2 configurations
bool rpc_request_layer2_handler_required; // need layer 2 handler
bool rpc_request_is_write_operation; // need stateful replication
bool rpc_request_is_write_allow_batch; // if write allow batch
// ]
task_rejection_handler rejection_handler;
// COMPUTE
/*!
@addtogroup tool-api-hooks
@{
*/
join_point<void, task*, task*> on_task_create;
join_point<void, task*, task*> on_task_enqueue;
join_point<void, task*> on_task_begin; // TODO: parent task
join_point<void, task*> on_task_end;
join_point<void, task*> on_task_cancelled;
join_point<void, task*, task*, uint32_t> on_task_wait_pre; // waitor, waitee, timeout
join_point<void, task*> on_task_wait_notified;
join_point<void, task*, task*, bool> on_task_wait_post; // wait succeeded or timedout
join_point<void, task*, task*, bool> on_task_cancel_post; // cancel succeeded or not
// AIO
join_point<bool, task*, aio_task*> on_aio_call; // return true means continue, otherwise early terminate with task::set_error_code
join_point<void, aio_task*> on_aio_enqueue; // aio done, enqueue callback
// RPC_REQUEST
join_point<bool, task*, message_ex*, rpc_response_task*> on_rpc_call; // return true means continue, otherwise dropped and (optionally) timedout
join_point<bool, rpc_request_task*> on_rpc_request_enqueue;
// RPC_RESPONSE
join_point<bool, task*, message_ex*> on_rpc_reply;
join_point<bool, rpc_response_task*> on_rpc_response_enqueue; // response, task
// message data flow
join_point<void, message_ex*, message_ex*> on_rpc_create_response;
/*@}*/
public:
DSN_API task_spec(int code, const char* name, dsn_task_type_t type, dsn_task_priority_t pri, dsn_threadpool_code_t pool);
public:
DSN_API static bool init();
DSN_API void init_profiling(bool profile);
};
CONFIG_BEGIN(task_spec)
CONFIG_FLD_ENUM(dsn_task_priority_t, priority, TASK_PRIORITY_COMMON, TASK_PRIORITY_INVALID, true, "task priority")
CONFIG_FLD_ENUM(grpc_mode_t, grpc_mode, GRPC_TO_LEADER, GRPC_INVALID, false, "group rpc mode: GRPC_TO_LEADER, GRPC_TO_ALL, GRPC_TO_ANY")
CONFIG_FLD_ID(threadpool_code2, pool_code, THREAD_POOL_DEFAULT, true, "thread pool to execute the task")
CONFIG_FLD(bool, bool, allow_inline, false,
"allow task executed in other thread pools or tasks "
"for TASK_TYPE_COMPUTE - allow-inline allows a task being executed in its caller site "
"for other tasks - allow-inline allows a task being execution in io-thread "
)
CONFIG_FLD(bool, bool, randomize_timer_delay_if_zero, false, "whether to randomize the timer delay to random(0, timer_interval), if the initial delay is zero, to avoid multiple timers executing at the same time (e.g., checkpointing)")
CONFIG_FLD_ID(network_header_format, rpc_call_header_format, NET_HDR_DSN, false, "what kind of header format for this kind of rpc calls")
CONFIG_FLD_ENUM(dsn_msg_serialize_format, rpc_msg_payload_serialize_default_format, DSF_THRIFT_BINARY, DSF_INVALID, false, "what kind of payload serialization format for this kind of msgs")
CONFIG_FLD_ID(rpc_channel, rpc_call_channel, RPC_CHANNEL_TCP, false, "what kind of network channel for this kind of rpc calls")
CONFIG_FLD(bool, bool, rpc_message_crc_required, false, "whether to calculate the crc checksum when send request/response")
CONFIG_FLD(int32_t, uint64, rpc_timeout_milliseconds, 5000, "what is the default timeout (ms) for this kind of rpc calls")
CONFIG_FLD(int32_t, uint64, rpc_request_resend_timeout_milliseconds, 0, "for how long (ms) the request will be resent if no response is received yet, 0 for disable this feature")
CONFIG_FLD_ENUM(throttling_mode_t, rpc_request_throttling_mode, TM_NONE, TM_INVALID, false, "throttling mode for rpc requets: TM_NONE, TM_REJECT, TM_DELAY when queue length > pool.queue_length_throttling_threshold")
CONFIG_FLD_INT_LIST(rpc_request_delays_milliseconds, "how many milliseconds to delay recving rpc session for when queue length ~= [1.0, 1.2, 1.4, 1.6, 1.8, >=2.0] x pool.queue_length_throttling_threshold, e.g., 0, 0, 1, 2, 5, 10")
CONFIG_FLD(bool, bool, rpc_request_dropped_before_execution_when_timeout, false, "whether to drop a request right before execution when its queueing time is already greater than its timeout value")
// layer 2 configurations
CONFIG_FLD(bool, bool, rpc_request_layer2_handler_required, false, "whether this request needs to be handled by a layer2 handler (e.g., replicated or partitioned)")
CONFIG_FLD(bool, bool, rpc_request_is_write_operation, false, "whether this request updates app's state which needs to be replicated using a replication layer2 handler")
CONFIG_FLD(bool, bool, rpc_request_is_write_allow_batch, true, "whether this write request allows updating app's state in batch mode")
CONFIG_END
struct threadpool_spec
{
safe_string name;
dsn_threadpool_code_t pool_code;
int worker_count;
worker_priority_t worker_priority;
bool worker_share_core;
uint64_t worker_affinity_mask;
int dequeue_batch_size;
bool partitioned; // false by default
safe_string queue_factory_name;
safe_string worker_factory_name;
safe_list<safe_string> queue_aspects;
safe_list<safe_string> worker_aspects;
int queue_length_throttling_threshold;
bool enable_virtual_queue_throttling;
safe_string admission_controller_factory_name;
safe_string admission_controller_arguments;
threadpool_spec(const dsn_threadpool_code_t& code) : name(dsn_threadpool_code_to_string(code)), pool_code(code) {}
threadpool_spec(const threadpool_spec& source) = default;
threadpool_spec& operator=(const threadpool_spec& source) = default;
DSN_API static bool init(/*out*/ safe_vector<threadpool_spec>& specs);
};
CONFIG_BEGIN(threadpool_spec)
// CONFIG_FLD_ID(dsn_threadpool_code_t, pool_code) // no need to define it inside section
CONFIG_FLD_STRING(name, "", "thread pool name")
CONFIG_FLD(int, uint64, worker_count, 2, "thread/worker count")
CONFIG_FLD(int, uint64, dequeue_batch_size, 5, "how many tasks (if available) should be returned for one dequeue call for best batching performance")
CONFIG_FLD_ENUM(worker_priority_t, worker_priority, THREAD_xPRIORITY_NORMAL, THREAD_xPRIORITY_INVALID, false, "thread priority")
CONFIG_FLD(bool, bool, worker_share_core, true, "whether the threads share all assigned cores")
CONFIG_FLD(uint64_t, uint64, worker_affinity_mask, 0, "what CPU cores are assigned to this pool, 0 for all")
CONFIG_FLD(bool, bool, partitioned, false, "whethe the threads share a single queue(partitioned=false) or not; the latter is usually for workload hash partitioning for avoiding locking")
CONFIG_FLD_STRING(queue_factory_name, "", "task queue provider name")
CONFIG_FLD_STRING(worker_factory_name, "", "task worker provider name")
CONFIG_FLD_STRING_LIST(queue_aspects, "task queue aspects names, usually for tooling purpose")
CONFIG_FLD_STRING_LIST(worker_aspects, "task aspects names, usually for tooling purpose")
CONFIG_FLD(int, uint64, queue_length_throttling_threshold, 1000000, "throttling: throttling threshold above which rpc requests will be dropped")
CONFIG_FLD(bool, bool, enable_virtual_queue_throttling, false, "throttling: whether to enable throttling with virtual queues")
CONFIG_FLD_STRING(admission_controller_factory_name, "", "customized admission controller for the task queues")
CONFIG_FLD_STRING(admission_controller_arguments, "", "arguments for the cusotmized admission controller")
CONFIG_END
} // end namespace
| 44.3125 | 238 | 0.738556 |
6dc83233435abbd3316d930bde219fedea7bb909 | 4,615 | h | C | src/math/plane3.h | Alec-Sobeck/FPS-Game | 3a0f3e82bdbc651ee99e7b10d71d55ba43bb6d35 | [
"MIT"
] | null | null | null | src/math/plane3.h | Alec-Sobeck/FPS-Game | 3a0f3e82bdbc651ee99e7b10d71d55ba43bb6d35 | [
"MIT"
] | null | null | null | src/math/plane3.h | Alec-Sobeck/FPS-Game | 3a0f3e82bdbc651ee99e7b10d71d55ba43bb6d35 | [
"MIT"
] | 1 | 2015-02-04T23:29:59.000Z | 2015-02-04T23:29:59.000Z | #ifndef PLANE3_H
#define PLANE3_H
class Polygon3;
#include <string>
#include <memory>
#include <vector>
#include "glm/vec3.hpp"
#include "math/ilinevariant.h"
#include "math/polygon3.h"
/**
* Plane3 implements a plane that exists in the third dimension. A plane can be
* defined by either 3 or more points that are not all co-linear, 2 direction vectors
* and a point, or a normal and a point on the plane. Plane3 will accept any of those
* when constructing the Plane3, but stores only a point on the plane and the normal.
* <br><br>
* Plane3 are immutable.
* @author Alec Sobeck
*/
class Plane3
{
public:
/**
* Constructs a new Plane3 with the provided glm::vec3 and glm::vec3, performing only a calculation
* to normalize the provided glm::vec3.
* @param pointOnPlane a glm::vec3 that is on the plane
* @param normal a glm::vec3 that is normal(thusly perpendicular) to the plane
*/
Plane3(glm::vec3 pointOnPlane, glm::vec3 normal);
/**
* Constructs a new Plane3 with the provided glm::vec3 and direction vectors. A computation
* will be done to find the normal to this plane.
* @param pointOnPlane a glm::vec3 that is on the plane somewhere
* @param directions a glm::vec3[] containing two distinct direction vectors which are on this plane.
*/
Plane3(glm::vec3 pointOnPlane, std::vector<glm::vec3> directions);
/**
* Creates a plane using the scalar equation for a plane ax + by + cz = d.
* @param a a double representing a in the above equation.
* @param b a double representing b in the above equation.
* @param c a double representing c in the above equation.
* @param d a double representing d in the above equation.
*/
Plane3(double a, double b, double c, double d);
/**
* Constructs a new Plane3 with the provided glm::vec3 and direction vectors. A computation
* will be done to find the normal to this plane. co-linear points will cause an
* IllegalArgumentException to be thrown.
* @param point1 a first distinct glm::vec3 that is on the plane somewhere
* @param point2 a second distinct glm::vec3 that is on the plane somewhere
* @param point3 a third distinct glm::vec3 that is on the plane somewhere
* @throws IllegalArgumentException throws this exception if the points are co-linear
*/
Plane3(glm::vec3 point1, glm::vec3 point2, glm::vec3 point3);
/**
* Checks to see if a glm::vec3 is perpendicular to this Plane3. This condition is met should
* the provided glm::vec3 be parallel to the normal of this plane.
* @param other a glm::vec3 to check against this Plane3 to see if it is perpendicular
* @return a boolean, true if the provided glm::vec3 is perpendicular to this Plane3; otherwise false
*/
bool isPerpendicular(glm::vec3 other);
/**
* A method to determine if the provided ILineVariant intersects with the plane.
* Returns false if the line variant is parallel to the plane.
* @param line is the ILineVariant to check for intersection
* @return a Boolean representing if the line variant and plane intersect
*/
bool does_intersect_line(ILineVariant &line);
/**
* Returns true if the provided polygon intersects with the plane
* @param poly the polygon against which to check
* @return a Boolean representing if the poly intersects the plane
*/
bool doesIntersectPoly(Polygon3 &poly);
/**
* Returns the specific point at which the plane and the provided line variant intersect.
* Returns NULL if no intersection occurs (as per does_intersect_plane(Ray3)).
* @param line - the line variant against which to check
* @return A glm::vec3 representing the point on the plane at which the line variant intersects.
* NULL if no intersection occurs.
*/
std::shared_ptr<glm::vec3> lineIntersectPoint(ILineVariant &line);
/**
* Returns a general equation for the plane as a Vector4, in the form <a,b,c,d>
* for the equation aX + bY + cZ + d = 0
* @return a Vector4 representing the plane
*/
glm::vec4 getGeneralEquation();
/**
* Gets the signed distance between the plane and the provided vector
* @param vector the glm::vec3 to calculate the distance for
* @return the signed distance between the point and the plane
*/
double distanceToPoint(glm::vec3 vector);
glm::vec3 getNormal();
glm::vec3 getUnitNormal();
glm::vec3 getPointOnPlane();
std::string toString();
private:
/** A normal to the plane, which is therefore by definition parallel to the plane.
* This will be normalized on plane creation. */
glm::vec3 normal;
/** A point that is somewhere on the plane. Required to define the plane properly.*/
glm::vec3 pointOnPlane;
};
#endif
| 41.576577 | 102 | 0.730878 |
6df5d86eb9ca1a3b303ed34252a12079e2e4caa2 | 283 | h | C | da-hua-she-ji-mo-shi/23-command/command/command/command/BakeMuttonCommand.h | wang-jun-coder/reading-notes | 85a9b27abca0c6905b08f48ac346263cd716a2b1 | [
"MIT"
] | 6 | 2018-12-19T01:46:02.000Z | 2022-01-06T12:34:43.000Z | da-hua-she-ji-mo-shi/23-command/command/command/command/BakeMuttonCommand.h | wang-jun-coder/reading-notes | 85a9b27abca0c6905b08f48ac346263cd716a2b1 | [
"MIT"
] | null | null | null | da-hua-she-ji-mo-shi/23-command/command/command/command/BakeMuttonCommand.h | wang-jun-coder/reading-notes | 85a9b27abca0c6905b08f48ac346263cd716a2b1 | [
"MIT"
] | 4 | 2019-02-21T08:01:07.000Z | 2021-05-16T11:15:23.000Z | //
// BakeMuttonCommand.h
// command
//
// Created by 王俊 on 2019/1/9.
// Copyright © 2019 王俊. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "./Command.h"
NS_ASSUME_NONNULL_BEGIN
@interface BakeMuttonCommand : NSObject<Command>
@end
NS_ASSUME_NONNULL_END
| 14.894737 | 48 | 0.724382 |
33cb2307fd8be2acaace23c3e0a258c0a5a39d30 | 7,250 | h | C | src/drivers/winc1500/include/driver/include/m2m_ssl.h | jiskra/openmv | a0f321836f77f94d8118910598dcdb79eb784d58 | [
"MIT"
] | 1,761 | 2015-07-10T23:14:17.000Z | 2022-03-30T07:49:49.000Z | src/drivers/winc1500/include/driver/include/m2m_ssl.h | jiskra/openmv | a0f321836f77f94d8118910598dcdb79eb784d58 | [
"MIT"
] | 487 | 2015-07-07T23:21:20.000Z | 2022-03-30T17:13:22.000Z | src/drivers/winc1500/include/driver/include/m2m_ssl.h | jiskra/openmv | a0f321836f77f94d8118910598dcdb79eb784d58 | [
"MIT"
] | 882 | 2015-08-01T08:34:19.000Z | 2022-03-30T07:36:23.000Z | /**
*
* \file
*
* \brief WINC Application Interface Internal Types.
*
* Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
*
* Subject to your compliance with these terms, you may use Microchip
* software and any derivatives exclusively with Microchip products.
* It is your responsibility to comply with third party license terms applicable
* to your use of third party software (including open source software) that
* may accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* \asf_license_stop
*
*/
/**@defgroup SSLAPI SSL
@brief
Provides a description of the SSL Layer.
@{
@defgroup SSLCallbacks Callbacks
@brief
Provides detail on the available callbacks for the SSL Layer.
@defgroup SSLEnums Enumerations and Typedefs
@brief
Specifies the enums and Data Structures used by the SSL APIs.
@defgroup SSLFUNCTIONS Functions
@brief
Provides detail on the available APIs for the SSL Layer.
@}
*/
#ifndef __M2M_SSL_H__
#define __M2M_SSL_H__
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
INCLUDES
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
#include "common/include/nm_common.h"
#include "driver/include/m2m_types.h"
#include "driver/include/nmdrv.h"
#include "driver/include/ecc_types.h"
#include "socket/include/socket.h"
/*!
@ingroup SSLCallbacks
@typedef void (*tpfAppSSLCb)(uint8 u8MsgType, void* pvMsg);
@brief A callback to get SSL notifications.
@param[in] u8MsgType
The type of the message received.
@param[in] pvMsg
A structure to provide notification payload.
*/
typedef void (*tpfAppSSLCb) (uint8 u8MsgType, void * pvMsg);
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
FUNCTION PROTOTYPES
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_init(tpfAppSSLCb pfAppSSLCb);
@brief Initializes the SSL layer.
@param [in] pfAppSslCb
Application SSL callback function.
@return The function returns @ref M2M_SUCCESS for success and a negative value otherwise.
*/
NMI_API sint8 m2m_ssl_init(tpfAppSSLCb pfAppSSLCb);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_handshake_rsp(tstrEccReqInfo* strECCResp, uint8* pu8RspDataBuff, uint16 u16RspDataSz);
@brief Sends ECC responses to the WINC
@param [in] strECCResp
ECC Response struct.
@param [in] pu8RspDataBuff
Pointer of the response data to be sent.
@param [in] u16RspDataSz
Response data size.
@return The function returns @ref M2M_SUCCESS for success and a negative value otherwise.
*/
NMI_API sint8 m2m_ssl_handshake_rsp(tstrEccReqInfo* strECCResp, uint8* pu8RspDataBuff, uint16 u16RspDataSz);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_send_certs_to_winc(uint8* pu8Buffer, uint32 u32BufferSz);
@brief Sends certificates to the WINC
@param [in] pu8Buffer
Pointer to the certificates.
@param [in] u32BufferSz
Size of the certificates.
@return The function returns @ref M2M_SUCCESS for success and a negative value otherwise.
*/
NMI_API sint8 m2m_ssl_send_certs_to_winc(uint8* pu8Buffer, uint32 u32BufferSz);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_retrieve_cert(uint16* pu16CurveType, uint8* pu8Hash, uint8* pu8Sig, tstrECPoint* pu8Key);
@brief Retrieve the certificate to be verified from the WINC
@param [in] pu16CurveType
Pointer to the certificate curve type.
@param [in] pu8Hash
Pointer to the certificate hash.
@param [in] pu8Sig
Pointer to the certificate signature.
@param [in] pu8Key
Pointer to the certificate Key.
@return The function returns @ref M2M_SUCCESS for success and a negative value otherwise.
*/
NMI_API sint8 m2m_ssl_retrieve_cert(uint16* pu16CurveType, uint8* pu8Hash, uint8* pu8Sig, tstrECPoint* pu8Key);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_retrieve_hash(uint8* pu8Hash, uint16 u16HashSz);
@brief Retrieve the certificate hash.
@param [in] pu8Hash
Pointer to the certificate hash.
@param [in] u16HashSz
Hash size.
@return The function returns @ref M2M_SUCCESS for success and a negative value otherwise.
*/
NMI_API sint8 m2m_ssl_retrieve_hash(uint8* pu8Hash, uint16 u16HashSz);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API void m2m_ssl_stop_processing_certs(void);
@brief Allow ssl driver to tidy up in case application does not read all available certificates.
@warning This API must only be called if some certificates are left unread.
@return None.
*/
NMI_API void m2m_ssl_stop_processing_certs(void);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API void m2m_ssl_ecc_process_done(void);
@brief Allow ssl driver to tidy up after application has finished processing ecc message.
@warning This API must be called after receiving a SSL callback with message type @ref M2M_SSL_REQ_ECC.
@return None.
*/
NMI_API void m2m_ssl_ecc_process_done(void);
/*!
@ingroup SSLFUNCTIONS
@fn NMI_API sint8 m2m_ssl_set_active_ciphersuites(uint32 u32SslCsBMP);
@brief Sets the active ciphersuites.
@details Override the default Active SSL ciphers in the SSL module with a certain combination selected by
the caller in the form of a bitmap containing the required ciphers to be on.\n
There is no need to call this function if the application will not change the default ciphersuites.
@param [in] u32SslCsBMP
Bitmap containing the desired ciphers to be enabled for the SSL module. The ciphersuites are defined in
@ref SSLCipherSuiteID.
The default ciphersuites are all ciphersuites supported by the firmware with the exception of ECC ciphersuites.
The caller can override the default with any desired combination, except for combinations involving both RSA
and ECC; if any RSA ciphersuite is enabled, then firmware will disable all ECC ciphersuites.
If u32SslCsBMP does not contain any ciphersuites supported by firmware, then the current active list will not
change.
@return
- @ref SOCK_ERR_NO_ERROR
- @ref SOCK_ERR_INVALID_ARG
*/
NMI_API sint8 m2m_ssl_set_active_ciphersuites(uint32 u32SslCsBMP);
#endif /* __M2M_SSL_H__ */
| 38.978495 | 123 | 0.704276 |
b888f604ab6e17280835e83f6bc5fae3d5a1d371 | 3,432 | h | C | plugins/flash3kyuu_deband/src/include/f3kdb.h | darcyg/vapoursynth-plugins | 5aaf090d3523cb8c53841949f2da286688ba33bb | [
"BSD-2-Clause"
] | null | null | null | plugins/flash3kyuu_deband/src/include/f3kdb.h | darcyg/vapoursynth-plugins | 5aaf090d3523cb8c53841949f2da286688ba33bb | [
"BSD-2-Clause"
] | null | null | null | plugins/flash3kyuu_deband/src/include/f3kdb.h | darcyg/vapoursynth-plugins | 5aaf090d3523cb8c53841949f2da286688ba33bb | [
"BSD-2-Clause"
] | 1 | 2020-04-06T16:52:59.000Z | 2020-04-06T16:52:59.000Z | #pragma once
#include "f3kdb_enums.h"
#include "f3kdb_params.h"
// Input plane can be unaligned, but all output planes need to be aligned to 16-byte boundary
static const int PLANE_ALIGNMENT = 16;
enum {
// Supposed to be the same as corresponding values in avisynth
PLANE_Y = 1<<0,
PLANE_CB = 1<<1,
PLANE_CR = 1<<2
};
typedef struct _f3kdb_video_info_t
{
// width and height are in actual pixels, NOT pixels after applying hacks
int width;
int height;
int chroma_width_subsampling;
int chroma_height_subsampling;
PIXEL_MODE pixel_mode;
int depth;
// Can be set to an estimated number if unknown when initializing
int num_frames;
inline int get_plane_width(int plane)
{
return plane == PLANE_Y ? width : width >> chroma_width_subsampling;
}
inline int get_plane_height(int plane)
{
return plane == PLANE_Y ? height : height >> chroma_height_subsampling;
}
} f3kdb_video_info_t;
static const int F3KDB_INTERFACE_VERSION = 2 << 16 | sizeof(f3kdb_params_t) << 8 | sizeof(f3kdb_video_info_t);
class f3kdb_core_t;
enum
{
F3KDB_SUCCESS = 0,
F3KDB_ERROR_INVALID_INTERFACE_VERSION,
F3KDB_ERROR_INSUFFICIENT_MEMORY,
F3KDB_ERROR_INVALID_ARGUMENT,
F3KDB_ERROR_INVALID_STATE,
F3KDB_ERROR_INVALID_NAME,
F3KDB_ERROR_INVALID_VALUE,
F3KDB_ERROR_VALUE_OUT_OF_RANGE,
F3KDB_ERROR_NOT_IMPLEMENTED,
F3KDB_ERROR_UNEXPECTED_END,
F3KDB_ERROR_MAX
};
// Stolen from VapourSynth
// Convenience for C++ users.
#ifdef __cplusplus
# define F3KDB_EXTERN_C extern "C"
#else
# define F3KDB_EXTERN_C
#endif
#if defined(_WIN32) && !defined(_WIN64)
# define F3KDB_CC __stdcall
#else
# define F3KDB_CC
#endif
// And now for some symbol hide-and-seek...
#if defined(_WIN32) // Windows being special
# define F3KDB_EXTERNAL_API(ret) F3KDB_EXTERN_C __declspec(dllexport) ret F3KDB_CC
#elif defined(__GNUC__) && __GNUC__ >= 4
# define F3KDB_EXTERNAL_API(ret) F3KDB_EXTERN_C __attribute__((visibility("default"))) ret F3KDB_CC
#else
# define F3KDB_EXTERNAL_API(ret) F3KDB_EXTERN_C ret F3KDB_CC
#endif
#if !defined(FLASH3KYUU_DEBAND_EXPORTS) && defined(_WIN32) && !defined(F3KDB_STATIC) && !defined(__GNUC__)
# define F3KDB_API(ret) F3KDB_EXTERN_C __declspec(dllimport) ret F3KDB_CC
#else
# define F3KDB_API(ret) F3KDB_EXTERNAL_API(ret)
#endif
F3KDB_API(int) f3kdb_params_init_defaults(f3kdb_params_t* params, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_params_fill_by_string(f3kdb_params_t* params, const char* param_string, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_params_fill_preset(f3kdb_params_t* params, const char* preset, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_params_sanitize(f3kdb_params_t* params, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_video_info_sanitize(f3kdb_video_info_t* vi, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_create(const f3kdb_video_info_t* video_info, const f3kdb_params_t* params, f3kdb_core_t** core_out, char* extra_error_msg = nullptr, int error_msg_size = 0, int interface_version = F3KDB_INTERFACE_VERSION);
F3KDB_API(int) f3kdb_destroy(f3kdb_core_t* core);
F3KDB_API(int) f3kdb_process_plane(f3kdb_core_t* core, int frame_index, int plane, unsigned char* dst_frame_ptr, int dst_pitch, const unsigned char* src_frame_ptr, int src_pitch);
| 34.666667 | 227 | 0.776515 |
ed68dbd7980df4aa961e23ba5da206cec28cc86b | 90 | h | C | src/Core/CoreExternals/FreeType/src/autofit/PaxHeaders.3012/afranges.h | bluespeck/OakVR | 65d56942af390dc2ab2d969b44285d23bd53f139 | [
"MIT"
] | 15 | 2016-09-17T16:29:42.000Z | 2021-11-24T06:21:27.000Z | libs/freetype/src/autofit/PaxHeaders.3012/afranges.h | podgorskiy/TinyFEM | c1a5fedf21e6306fc11fa19afdaf48dab1b6740f | [
"MIT"
] | null | null | null | libs/freetype/src/autofit/PaxHeaders.3012/afranges.h | podgorskiy/TinyFEM | c1a5fedf21e6306fc11fa19afdaf48dab1b6740f | [
"MIT"
] | 3 | 2017-04-07T13:33:57.000Z | 2021-03-31T02:04:48.000Z | 30 mtime=1390725112.037786701
30 atime=1394128265.568260091
30 ctime=1390725112.037786701
| 22.5 | 29 | 0.866667 |
b49da5b8877ecb4b86206445fc831ed94e12d4ed | 2,481 | h | C | modules/iphone/io.scanbot.barcode.titaniumsdk/1.0.0/platform/ScanbotBarcodeScannerSDK.framework/Headers/SBSDKBarcodeAdditionalParameters.h | doo/scanbot-sdk-example-titanium | d79e6b7356989c33642b96833585939c63a0c27d | [
"Apache-2.0"
] | null | null | null | modules/iphone/io.scanbot.barcode.titaniumsdk/1.0.0/platform/ScanbotBarcodeScannerSDK.framework/Headers/SBSDKBarcodeAdditionalParameters.h | doo/scanbot-sdk-example-titanium | d79e6b7356989c33642b96833585939c63a0c27d | [
"Apache-2.0"
] | null | null | null | modules/iphone/io.scanbot.barcode.titaniumsdk/1.0.0/platform/ScanbotBarcodeScannerSDK.framework/Headers/SBSDKBarcodeAdditionalParameters.h | doo/scanbot-sdk-example-titanium | d79e6b7356989c33642b96833585939c63a0c27d | [
"Apache-2.0"
] | null | null | null | //
// SBSDKBarcodeAdditionalParameters.h
// ScanbotSDK
//
// Created by Yevgeniy Knizhnik on 08.03.21.
// Copyright © 2021 doo GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
/** The checksum algorithm for MSI-Plessey type barcodes. */
typedef NS_ENUM(NSInteger, SBSDKBarcodeMSIPlesseyChecksumAlgorithm) {
/** None. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmNone = 0,
/** Mod10. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10 = 0x1,
/** Mod11IBM. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod11IBM = 0x2,
/** Mod11NCR. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod11NCR = 0x4,
/** Mod1010. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1010 = 0x8,
/** Mod110IBM. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110IBM = 0x10,
/** Mod1110NCR. */
SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110NCR = 0x20
};
/**
* A class that contains additional parameters for barcodes detection and filtering.
*/
@interface SBSDKBarcodeAdditionalParameters : NSObject
/**
* With this option, the scanner assumes that the barcode can be a GS1 barcode, and modify the behavior as needed.
* You can set it to NO, if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
* The default is YES.
*/
@property (nonatomic) BOOL enableGS1Decoding;
/**
* Minimum required text length of the detected barcode.
* The default is 0.
* NOTE: Currently works for ITF barcodes only!
*/
@property (nonatomic) NSUInteger minimumTextLength;
/**
* Maximum text length of the detected barcode. Setting to zero removes the limit.
* The default is 0.
* NOTE: Currently works for ITF barcodes only!
*/
@property (nonatomic) NSUInteger maximumTextLength;
/**
* Minimum required quiet zone on the barcode. Measured in modules (the size of minimal bar on the barcode).
* The default is 10.
* NOTE: Currently works for ITF barcodes only!
*/
@property (nonatomic) NSUInteger minimum1DBarcodesQuietZone;
/**
* The checksum algorithm for MSI Plessey barcodes.
* The default value is SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10.
*/
@property (nonatomic, assign) SBSDKBarcodeMSIPlesseyChecksumAlgorithm msiPlesseyChecksumAlgorithm;
/**
* With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
* Has no effect if both single and double digit MSI Plessey checksums are enabled.
* The default is NO
*/
@property (nonatomic, assign) BOOL stripCheckDigits;
@end
| 30.256098 | 114 | 0.746473 |
897fb06b0fc211575a92ff2e3ffa7bf0facc2e0a | 7,452 | h | C | cpp/platform/impl/windows/generated/winrt/impl/Windows.Media.SpeechSynthesis.1.h | edwinwutw/nearby-connections | 56b7daf88dc3e36360818a2ea78875b4a2e63fec | [
"Apache-2.0"
] | null | null | null | cpp/platform/impl/windows/generated/winrt/impl/Windows.Media.SpeechSynthesis.1.h | edwinwutw/nearby-connections | 56b7daf88dc3e36360818a2ea78875b4a2e63fec | [
"Apache-2.0"
] | null | null | null | cpp/platform/impl/windows/generated/winrt/impl/Windows.Media.SpeechSynthesis.1.h | edwinwutw/nearby-connections | 56b7daf88dc3e36360818a2ea78875b4a2e63fec | [
"Apache-2.0"
] | null | null | null | // WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.210505.3
#ifndef WINRT_Windows_Media_SpeechSynthesis_1_H
#define WINRT_Windows_Media_SpeechSynthesis_1_H
#include "winrt/impl/Windows.Foundation.0.h"
#include "winrt/impl/Windows.Storage.Streams.0.h"
#include "winrt/impl/Windows.Media.SpeechSynthesis.0.h"
WINRT_EXPORT namespace winrt::Windows::Media::SpeechSynthesis
{
struct __declspec(empty_bases) IInstalledVoicesStatic :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IInstalledVoicesStatic>
{
IInstalledVoicesStatic(std::nullptr_t = nullptr) noexcept {}
IInstalledVoicesStatic(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IInstalledVoicesStatic(IInstalledVoicesStatic const&) noexcept = default;
IInstalledVoicesStatic(IInstalledVoicesStatic&&) noexcept = default;
IInstalledVoicesStatic& operator=(IInstalledVoicesStatic const&) & noexcept = default;
IInstalledVoicesStatic& operator=(IInstalledVoicesStatic&&) & noexcept = default;
};
struct __declspec(empty_bases) IInstalledVoicesStatic2 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IInstalledVoicesStatic2>
{
IInstalledVoicesStatic2(std::nullptr_t = nullptr) noexcept {}
IInstalledVoicesStatic2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IInstalledVoicesStatic2(IInstalledVoicesStatic2 const&) noexcept = default;
IInstalledVoicesStatic2(IInstalledVoicesStatic2&&) noexcept = default;
IInstalledVoicesStatic2& operator=(IInstalledVoicesStatic2 const&) & noexcept = default;
IInstalledVoicesStatic2& operator=(IInstalledVoicesStatic2&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesisStream :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesisStream>,
impl::require<winrt::Windows::Media::SpeechSynthesis::ISpeechSynthesisStream, winrt::Windows::Foundation::IClosable, winrt::Windows::Storage::Streams::IInputStream, winrt::Windows::Storage::Streams::IOutputStream, winrt::Windows::Storage::Streams::IRandomAccessStream, winrt::Windows::Storage::Streams::IContentTypeProvider, winrt::Windows::Storage::Streams::IRandomAccessStreamWithContentType>
{
ISpeechSynthesisStream(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesisStream(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesisStream(ISpeechSynthesisStream const&) noexcept = default;
ISpeechSynthesisStream(ISpeechSynthesisStream&&) noexcept = default;
ISpeechSynthesisStream& operator=(ISpeechSynthesisStream const&) & noexcept = default;
ISpeechSynthesisStream& operator=(ISpeechSynthesisStream&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesizer :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesizer>
{
ISpeechSynthesizer(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesizer(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesizer(ISpeechSynthesizer const&) noexcept = default;
ISpeechSynthesizer(ISpeechSynthesizer&&) noexcept = default;
ISpeechSynthesizer& operator=(ISpeechSynthesizer const&) & noexcept = default;
ISpeechSynthesizer& operator=(ISpeechSynthesizer&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesizer2 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesizer2>
{
ISpeechSynthesizer2(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesizer2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesizer2(ISpeechSynthesizer2 const&) noexcept = default;
ISpeechSynthesizer2(ISpeechSynthesizer2&&) noexcept = default;
ISpeechSynthesizer2& operator=(ISpeechSynthesizer2 const&) & noexcept = default;
ISpeechSynthesizer2& operator=(ISpeechSynthesizer2&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesizerOptions :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesizerOptions>
{
ISpeechSynthesizerOptions(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesizerOptions(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesizerOptions(ISpeechSynthesizerOptions const&) noexcept = default;
ISpeechSynthesizerOptions(ISpeechSynthesizerOptions&&) noexcept = default;
ISpeechSynthesizerOptions& operator=(ISpeechSynthesizerOptions const&) & noexcept = default;
ISpeechSynthesizerOptions& operator=(ISpeechSynthesizerOptions&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesizerOptions2 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesizerOptions2>
{
ISpeechSynthesizerOptions2(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesizerOptions2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesizerOptions2(ISpeechSynthesizerOptions2 const&) noexcept = default;
ISpeechSynthesizerOptions2(ISpeechSynthesizerOptions2&&) noexcept = default;
ISpeechSynthesizerOptions2& operator=(ISpeechSynthesizerOptions2 const&) & noexcept = default;
ISpeechSynthesizerOptions2& operator=(ISpeechSynthesizerOptions2&&) & noexcept = default;
};
struct __declspec(empty_bases) ISpeechSynthesizerOptions3 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<ISpeechSynthesizerOptions3>
{
ISpeechSynthesizerOptions3(std::nullptr_t = nullptr) noexcept {}
ISpeechSynthesizerOptions3(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
ISpeechSynthesizerOptions3(ISpeechSynthesizerOptions3 const&) noexcept = default;
ISpeechSynthesizerOptions3(ISpeechSynthesizerOptions3&&) noexcept = default;
ISpeechSynthesizerOptions3& operator=(ISpeechSynthesizerOptions3 const&) & noexcept = default;
ISpeechSynthesizerOptions3& operator=(ISpeechSynthesizerOptions3&&) & noexcept = default;
};
struct __declspec(empty_bases) IVoiceInformation :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IVoiceInformation>
{
IVoiceInformation(std::nullptr_t = nullptr) noexcept {}
IVoiceInformation(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IVoiceInformation(IVoiceInformation const&) noexcept = default;
IVoiceInformation(IVoiceInformation&&) noexcept = default;
IVoiceInformation& operator=(IVoiceInformation const&) & noexcept = default;
IVoiceInformation& operator=(IVoiceInformation&&) & noexcept = default;
};
}
#endif
| 66.535714 | 402 | 0.752952 |
81997a28784288bd5f4593186ad6af7463577765 | 617 | c | C | tests/platform-independent-tests/tests/raw_audio_stream/main.c | BlueGhostGH/rayfork | 16d10c11e4638afa2686952817172792c504acf4 | [
"Unlicense"
] | 302 | 2019-12-19T07:31:47.000Z | 2022-03-13T16:17:56.000Z | tests/platform-independent-tests/tests/raw_audio_stream/main.c | BlueGhostGH/rayfork | 16d10c11e4638afa2686952817172792c504acf4 | [
"Unlicense"
] | 30 | 2019-12-19T01:15:10.000Z | 2021-11-02T00:42:53.000Z | tests/platform-independent-tests/tests/raw_audio_stream/main.c | BlueGhostGH/rayfork | 16d10c11e4638afa2686952817172792c504acf4 | [
"Unlicense"
] | 22 | 2019-12-19T13:05:11.000Z | 2022-03-08T15:42:32.000Z | //In this file we only initialise the window using sokol_app
#define SOKOL_IMPL
#define SOKOL_GLCORE33
#define SOKOL_WIN32_NO_GL_LOADER
#include "sokol_app.h"
#define screen_width 800
#define screen_height 450
extern void on_init(void);
extern void on_frame(void);
extern void on_cleanup(void);
extern void on_event(const sapp_event* event);
sapp_desc sokol_main(int argc, char** argv)
{
return (sapp_desc)
{
.width = screen_width,
.height = screen_height,
.init_cb = on_init,
.frame_cb = on_frame,
.cleanup_cb = on_cleanup,
.event_cb = on_event,
};
} | 22.851852 | 60 | 0.698541 |
5490c32103e2f7608f5c0e5f06754c6460a36e47 | 2,486 | c | C | kubernetes/unit-test/test_io_k8s_api_apps_v1_daemon_set_list.c | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | kubernetes/unit-test/test_io_k8s_api_apps_v1_daemon_set_list.c | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | kubernetes/unit-test/test_io_k8s_api_apps_v1_daemon_set_list.c | zouxiaoliang/nerv-kubernetes-client-c | 07528948c643270fd757d38edc68da8c9628ee7a | [
"Apache-2.0"
] | null | null | null | #ifndef io_k8s_api_apps_v1_daemon_set_list_TEST
#define io_k8s_api_apps_v1_daemon_set_list_TEST
// the following is to include only the main from the first c file
#ifndef TEST_MAIN
#define TEST_MAIN
#define io_k8s_api_apps_v1_daemon_set_list_MAIN
#endif // TEST_MAIN
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "../external/cJSON.h"
#include "../model/io_k8s_api_apps_v1_daemon_set_list.h"
io_k8s_api_apps_v1_daemon_set_list_t* instantiate_io_k8s_api_apps_v1_daemon_set_list(int include_optional);
#include "test_io_k8s_apimachinery_pkg_apis_meta_v1_list_meta.c"
io_k8s_api_apps_v1_daemon_set_list_t* instantiate_io_k8s_api_apps_v1_daemon_set_list(int include_optional) {
io_k8s_api_apps_v1_daemon_set_list_t* io_k8s_api_apps_v1_daemon_set_list = NULL;
if (include_optional) {
io_k8s_api_apps_v1_daemon_set_list = io_k8s_api_apps_v1_daemon_set_list_create(
"0",
list_create(),
"0",
// false, not to have infinite recursion
instantiate_io_k8s_apimachinery_pkg_apis_meta_v1_list_meta(0)
);
} else {
io_k8s_api_apps_v1_daemon_set_list = io_k8s_api_apps_v1_daemon_set_list_create(
"0",
list_create(),
"0",
NULL
);
}
return io_k8s_api_apps_v1_daemon_set_list;
}
#ifdef io_k8s_api_apps_v1_daemon_set_list_MAIN
void test_io_k8s_api_apps_v1_daemon_set_list(int include_optional) {
io_k8s_api_apps_v1_daemon_set_list_t* io_k8s_api_apps_v1_daemon_set_list_1 = instantiate_io_k8s_api_apps_v1_daemon_set_list(include_optional);
cJSON* jsonio_k8s_api_apps_v1_daemon_set_list_1 = io_k8s_api_apps_v1_daemon_set_list_convertToJSON(io_k8s_api_apps_v1_daemon_set_list_1);
printf("io_k8s_api_apps_v1_daemon_set_list :\n%s\n", cJSON_Print(jsonio_k8s_api_apps_v1_daemon_set_list_1));
io_k8s_api_apps_v1_daemon_set_list_t* io_k8s_api_apps_v1_daemon_set_list_2 = io_k8s_api_apps_v1_daemon_set_list_parseFromJSON(jsonio_k8s_api_apps_v1_daemon_set_list_1);
cJSON* jsonio_k8s_api_apps_v1_daemon_set_list_2 = io_k8s_api_apps_v1_daemon_set_list_convertToJSON(io_k8s_api_apps_v1_daemon_set_list_2);
printf("repeating io_k8s_api_apps_v1_daemon_set_list:\n%s\n", cJSON_Print(jsonio_k8s_api_apps_v1_daemon_set_list_2));
}
int main() {
test_io_k8s_api_apps_v1_daemon_set_list(1);
test_io_k8s_api_apps_v1_daemon_set_list(0);
printf("Hello world \n");
return 0;
}
#endif // io_k8s_api_apps_v1_daemon_set_list_MAIN
#endif // io_k8s_api_apps_v1_daemon_set_list_TEST
| 37.104478 | 169 | 0.834674 |
60cda5577dbfd147f2853344ff52c42b64991aed | 356 | h | C | DWBianMin/BianMin/Entity/RequestMerchantDetail.h | kunlingyijia/YMUSER | 63028fbcd0706afd284c384adff4f9a11ebc644d | [
"Apache-2.0"
] | null | null | null | DWBianMin/BianMin/Entity/RequestMerchantDetail.h | kunlingyijia/YMUSER | 63028fbcd0706afd284c384adff4f9a11ebc644d | [
"Apache-2.0"
] | null | null | null | DWBianMin/BianMin/Entity/RequestMerchantDetail.h | kunlingyijia/YMUSER | 63028fbcd0706afd284c384adff4f9a11ebc644d | [
"Apache-2.0"
] | null | null | null | //
// RequestMerchantDetail.h
// BianMin
//
// Created by kkk on 16/6/22.
// Copyright © 2016年 bianming. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RequestMerchantDetail : NSObject
@property (nonatomic, copy) NSString *merchantId;
@property (nonatomic, copy) NSString *lat;
@property (nonatomic, copy) NSString *lng;
@end
| 19.777778 | 52 | 0.724719 |
8e5b8d574d989888c3549b46f6b030f85288a901 | 880 | h | C | src/settingsdialog.h | blindpirate/no2-linggong-road | dba45d5ffac722857925fba98357d79878272df7 | [
"WTFPL"
] | 111 | 2020-01-12T17:52:25.000Z | 2022-03-30T04:53:16.000Z | src/settingsdialog.h | blindpirate/no2-linggong-road | dba45d5ffac722857925fba98357d79878272df7 | [
"WTFPL"
] | 4 | 2020-01-14T03:34:47.000Z | 2021-03-26T15:50:26.000Z | src/settingsdialog.h | blindpirate/no2-linggong-road | dba45d5ffac722857925fba98357d79878272df7 | [
"WTFPL"
] | 26 | 2020-01-12T17:52:26.000Z | 2022-01-22T07:49:21.000Z | #ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include "lgl.h"
#include "dbio.h"
namespace Ui {
class SettingsDialog;
}
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingsDialog(QWidget *parent,KeyboardControl *key);
~SettingsDialog();
private slots:
void on_okButton_clicked();
void on_setDefaultButton_clicked();
void on_cancelButton_clicked();
private:
Ui::SettingsDialog *ui;
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
bool eventFilter(QObject *, QEvent *);
QString keyToString(int key);
int upKeyValue;
int downKeyValue;
int leftKeyValue;
int rightKeyValue;
int actionKeyValue;
int cancelKeyValue;
int menuKeyValue;
KeyboardControl *key;
};
#endif // SETTINGSDIALOG_H
| 20 | 67 | 0.676136 |
c23f9540a0994b8541a3217641d5af5b34e03ad5 | 4,464 | h | C | Source/Skelly/Private/SkellyPoseEditor.h | davchezt/Skelly | 437d87396d6b5d37529dd40ae7748d50307bff03 | [
"MIT"
] | 1 | 2021-03-14T07:30:37.000Z | 2021-03-14T07:30:37.000Z | Source/Skelly/Private/SkellyPoseEditor.h | davchezt/Skelly | 437d87396d6b5d37529dd40ae7748d50307bff03 | [
"MIT"
] | null | null | null | Source/Skelly/Private/SkellyPoseEditor.h | davchezt/Skelly | 437d87396d6b5d37529dd40ae7748d50307bff03 | [
"MIT"
] | null | null | null | //-------------------------------------------------------------------------------
// The MIT License (MIT)
//
// Copyright (c) 2014 Vadim Macagon
//
// 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 "Toolkits/AssetEditorToolkit.h"
#include "PreviewScene.h"
class USkellyBone;
class USkellyPose;
class USkeletalMesh;
class UDebugSkelMeshComponent;
class IDetailsView;
namespace Skelly {
/** Editor for USkellyPose assets. */
class FPoseEditor : public FAssetEditorToolkit, public FEditorUndoClient, public FGCObject
{
public: // FAssetEditorToolkit interface
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& tabManager) override;
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& tabManager) override;
virtual FName GetToolkitFName() const override;
virtual FText GetBaseToolkitName() const override;
virtual FString GetWorldCentricTabPrefix() const override;
virtual FLinearColor GetWorldCentricTabColorScale() const override;
public: // FEditorUndoClient interface
virtual void PostUndo(bool bSuccess) override;
virtual void PostRedo(bool bSuccess) override;
public: // FGCObject interface
virtual void AddReferencedObjects(FReferenceCollector& collector) override;
public:
FPoseEditor();
~FPoseEditor();
/** Called on module startup. Initialize state shared by all pose editor instances. */
static void Startup();
/** Called on module shutdown. Cleanup state shared by all pose editor instances. */
static void Shutdown();
void InitPoseEditor(
EToolkitMode::Type toolkitMode, TSharedPtr<IToolkitHost>& editWithinLevelEditor,
USkellyPose* poseToEdit
);
FPreviewScene& GetPreviewScene();
private:
TSharedRef<FTabManager::FLayout> GenerateDefaultStandaloneLayout();
void SetPreviewSkeletalMesh(USkeletalMesh* inPreviewSkeletalMesh);
void SetSelectedBoneNames(const TArray<FName>& inBoneNames);
void GetSelectedBoneNames(TArray<FName>& outBoneNames) const;
// get the UObject whose properties should be displayed in the details view
UObject* GetDetailsViewSourceObject();
private: // event handlers
TSharedRef<SDockTab> OnSpawnSkeletonTab(const FSpawnTabArgs& args);
TSharedRef<SDockTab> OnSpawnViewportTab(const FSpawnTabArgs& args);
TSharedRef<SDockTab> OnSpawnDetailsTab(const FSpawnTabArgs& args);
void SkeletonTree_OnSelectionChanged();
void Viewport_OnSelectionChanged();
private:
// the pose currently being edited
USkellyPose* _currentPose;
FText _skeletonTabTitle;
FText _viewportTabTitle;
FText _detailsTabTitle;
// the scene to be displayed in the viewport
FPreviewScene _previewScene;
// the viewport that displays the preview scene
TSharedPtr<class SPoseEditorViewport> _viewport;
// the viewport's client, for convenience
TWeakPtr<class FPoseEditorViewportClient> _viewportClientWeakPtr;
// the component that will draw the current pose
UDebugSkelMeshComponent* _skeletalMeshPreviewComponent;
// the skeleton tree displayed on the skeleton tab
TSharedPtr<class SSkeletonTree> _skeletonTree;
// the details view displayed on the details tab
TSharedPtr<IDetailsView> _detailsView;
// bone whose properties will be displayed on the details tab
USkellyBone* _detailsViewBone;
private:
static FName PoseEditorAppName;
};
inline FPreviewScene& FPoseEditor::GetPreviewScene()
{
return _previewScene;
}
} // namespace Skelly | 35.712 | 90 | 0.767473 |
9098fd9e1ffe5395e393b1aa206816282c8cf6cb | 613 | h | C | include/cnl/_impl/scaled_integer/tag.h | RodrigoHolztrattner/cnl | d37a6da54d3146c2d22aeade786d0ede3a476915 | [
"BSL-1.0"
] | null | null | null | include/cnl/_impl/scaled_integer/tag.h | RodrigoHolztrattner/cnl | d37a6da54d3146c2d22aeade786d0ede3a476915 | [
"BSL-1.0"
] | null | null | null | include/cnl/_impl/scaled_integer/tag.h | RodrigoHolztrattner/cnl | d37a6da54d3146c2d22aeade786d0ede3a476915 | [
"BSL-1.0"
] | null | null | null |
// Copyright John McFarlane 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file ../LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(CNL_IMPL_SCALED_INTEGER_TAG_H)
#define CNL_IMPL_SCALED_INTEGER_TAG_H
#include "../num_traits/tag.h"
#include "../type_traits/type_identity.h"
#include "declaration.h"
/// compositional numeric library
namespace cnl {
template<typename Rep, class Scale>
struct tag<scaled_integer<Rep, Scale>> : _impl::type_identity<Scale> {
};
}
#endif // CNL_IMPL_SCALED_INTEGER_TAG_H
| 27.863636 | 74 | 0.725938 |
5037c192e1c3f032915b7de25af93307171411fb | 236 | c | C | nemu/src/cpu/exec/misc/jcc.c | jasha64/ics2015 | b6073effe3a7f4f73e60163b060274350a243d10 | [
"MIT"
] | 2 | 2020-07-24T10:59:26.000Z | 2021-05-05T06:47:28.000Z | nemu/src/cpu/exec/misc/jcc.c | jasha64/ics2015 | b6073effe3a7f4f73e60163b060274350a243d10 | [
"MIT"
] | null | null | null | nemu/src/cpu/exec/misc/jcc.c | jasha64/ics2015 | b6073effe3a7f4f73e60163b060274350a243d10 | [
"MIT"
] | null | null | null | #include "cpu/exec/helper.h"
#define DATA_BYTE 1
#include "jcc-template.h"
#undef DATA_BYTE
//#define DATA_BYTE 2
//#include "call-template.h"
//#undef DATA_BYTE
//#define DATA_BYTE 4
//#include "call-template.h"
//#undef DATA_BYTE
| 15.733333 | 28 | 0.720339 |
59ab5597b38ca879fc32b9d6681ecef6ea415250 | 4,170 | h | C | windows_sysroot/include/msvc/msclr/auto_handle.h | ci-fuzz/bazel-toolchain | 4f42c70f17fd1a64bff2aa53a1a3d97a0b55dcdd | [
"Apache-2.0"
] | null | null | null | windows_sysroot/include/msvc/msclr/auto_handle.h | ci-fuzz/bazel-toolchain | 4f42c70f17fd1a64bff2aa53a1a3d97a0b55dcdd | [
"Apache-2.0"
] | null | null | null | windows_sysroot/include/msvc/msclr/auto_handle.h | ci-fuzz/bazel-toolchain | 4f42c70f17fd1a64bff2aa53a1a3d97a0b55dcdd | [
"Apache-2.0"
] | null | null | null | /***
*auto_handle.h
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose: automatic resource management, like std::auto_ptr for ref classes
*
* [Public]
*
****/
#pragma once
#if !defined (_INC_MSCLR_AUTO_HANDLE)
#ifndef __cplusplus_cli
#error ERROR: msclr libraries are not compatible with /clr:oldSyntax
#endif /* __cplusplus_cli */
#include <msclr/safebool.h>
namespace msclr
{
// wrap a resource to enforce strict ownership and ensure proper cleanup
template<typename _element_type>
ref class auto_handle
{
private:
// disallow explicit comparisons to _safe_bool
bool operator==( _detail_class::_safe_bool );
bool operator!=( _detail_class::_safe_bool );
public:
// Constructors
auto_handle()
: m_handle( nullptr )
{
}
// construct from object pointer
auto_handle( _element_type ^ _ptr )
: m_handle( _ptr )
{
}
// construct by assuming pointer from _right auto_handle
auto_handle(auto_handle<_element_type> % _right )
: m_handle( _right.release() )
{
}
template<typename _other_type>
auto_handle( auto_handle<_other_type> % _right )
: m_handle( _right.release() )
{
}
// assign compatible _right
auto_handle<_element_type> % operator=(
auto_handle<_element_type> % _right )
{
reset( _right.release() );
return *this;
}
template<typename _other_type>
auto_handle<_element_type> % operator=(
auto_handle<_other_type> % _right )
{
reset( _right.release() );
return *this;
}
_element_type ^ get()
{
return m_handle;
}
// return pointer to class object (assume pointer)
_element_type ^ operator->()
{
return m_handle;
}
// for use when auto_handle appears in a conditional
operator _detail_class::_safe_bool()
{
return valid() ? _detail_class::_safe_true : _detail_class::_safe_false;
}
// for use when auto_handle appears in a conditional
bool operator!()
{
return ! valid();
}
template<typename _other_type>
operator auto_handle<_other_type>()
{
return auto_handle<_other_type>( *this );
}
void swap( auto_handle<_element_type> % _right )
{
auto_handle<_element_type> tmp = _right;
_right = *this;
*this = tmp;
}
void reset( _element_type ^ _new_ptr )
{
if( m_handle != _new_ptr )
{
if( valid() )
{
delete m_handle;
}
m_handle = _new_ptr;
}
}
void reset( )
{
reset(nullptr);
}
_element_type ^ release()
{
_element_type ^_tmp_ptr = m_handle;
m_handle = nullptr;
return _tmp_ptr;
}
// destroy the object
~auto_handle()
{
if( valid() )
{
delete m_handle;
}
}
private:
bool valid()
{
// see if the managed resource is in the invalid state.
return m_handle != nullptr;
}
// the wrapped object
_element_type ^ m_handle;
};
// swap the contents of two auto_handle objects
template<typename _element_type>
void swap( auto_handle<_element_type> % _left,
auto_handle<_element_type> % _right )
{
_left.swap( _right );
}
} // namespace msclr
#define _INC_MSCLR_AUTO_HANDLE
#endif /* !defined (_INC_MSCLR_AUTO_HANDLE) */
| 23.965517 | 85 | 0.505036 |
74f8619492e607b85d03b447153dd2bb68fc91bd | 1,266 | h | C | _Foundation/Core/Extension/NSMutableDictionary+Extension.h | zhangkn/ToolUtility | 003ea194efad61a74fe9797f7c2663e44f573fca | [
"MIT"
] | null | null | null | _Foundation/Core/Extension/NSMutableDictionary+Extension.h | zhangkn/ToolUtility | 003ea194efad61a74fe9797f7c2663e44f573fca | [
"MIT"
] | null | null | null | _Foundation/Core/Extension/NSMutableDictionary+Extension.h | zhangkn/ToolUtility | 003ea194efad61a74fe9797f7c2663e44f573fca | [
"MIT"
] | null | null | null |
#import <Foundation/Foundation.h>
#import "NSDictionary+Extension.h"
#pragma mark -
@interface NSMutableDictionary (Extension)
+ (NSMutableDictionary *)nonRetainingDictionary;
+ (NSMutableDictionary *)keyValues:(id)first, ...;
- (BOOL)setObject:(NSObject *)obj atPath:(NSString *)path;
- (BOOL)setObject:(NSObject *)obj atPath:(NSString *)path separator:(NSString *)separator;
- (BOOL)setKeyValues:(id)first, ...;
- (id)objectForOneOfKeys:(NSArray *)array remove:(BOOL)flag;
//- (NSNumber *)numberForOneOfKeys:(NSArray *)array remove:(BOOL)flag;
//- (NSString *)stringForOneOfKeys:(NSArray *)array remove:(BOOL)flag;
@end
#pragma mark -
NS_ASSUME_NONNULL_BEGIN
@interface __GENERICS(NSMutableDictionary, KeyType, ObjectType) (Function)
/** Filters a mutable dictionary to the key/value pairs matching the block.
*/
- (void)performSelect:(BOOL (^)(KeyType key, ObjectType obj))block;
/** Filters a mutable dictionary to the key/value pairs not matching the block,
the logical inverse to select:.
*/
- (void)performReject:(BOOL (^)(KeyType key, ObjectType obj))block;
/** Transform each value of the dictionary to a new value, as returned by the
block.
*/
- (void)performMap:(id (^)(KeyType key, ObjectType obj))block;
@end
NS_ASSUME_NONNULL_END
| 26.93617 | 90 | 0.739336 |
eef4bdb0405f36137bf015aa57091009cf947476 | 6,148 | h | C | Source/Entity/Entity.h | pigpigyyy/Dorothy-SSR | ddcf484ccfee616e284d3462bd0d368a2a1155fd | [
"MIT"
] | 43 | 2020-01-29T02:22:41.000Z | 2021-12-06T04:20:12.000Z | Source/Entity/Entity.h | pigpigyyy/Dorothy-SSR | ddcf484ccfee616e284d3462bd0d368a2a1155fd | [
"MIT"
] | 1 | 2020-03-19T16:23:12.000Z | 2020-03-19T16:23:12.000Z | Source/Entity/Entity.h | pigpigyyy/Dorothy-SSR | ddcf484ccfee616e284d3462bd0d368a2a1155fd | [
"MIT"
] | 8 | 2020-03-08T13:46:08.000Z | 2021-07-19T11:30:23.000Z | /* Copyright (c) 2021 Jin Li, http://www.luvfight.me
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 "Support/Value.h"
NS_DOROTHY_BEGIN
class Dictionary;
class Entity;
typedef Acf::Delegate<void(Entity*)> EntityHandler;
class Entity : public Object
{
public:
enum
{
Add,
Change,
AddOrChange,
Remove
};
Entity(int index);
PROPERTY_READONLY(int, Index);
PROPERTY_READONLY_CLASS(uint32_t, Count);
void destroy();
bool has(String name) const;
void remove(String name);
static Entity* create();
static bool each(const std::function<bool(Entity*)>& func);
static void clear();
Value* getComponent(String name) const;
Value* getOldCom(String name) const;
void clearOldComs();
public:
template<typename T>
void set(String name, const T& value, bool rawFlag = false);
template<typename T>
void setNext(String name, const T& value);
template<typename T>
const T& get(String name) const;
float get(String key, float def) const;
template<typename T>
const T& get(String name, const T& def) const;
public:
int getIndex(String name);
bool has(int index) const;
bool hasOld(int index) const;
void remove(int index);
void removeNext(int index);
void set(int index, Own<Value>&& value);
void setNext(int index, Own<Value>&& value);
Value* getComponent(int index) const;
Value* getOldCom(int index) const;
protected:
void updateComponent(int index, Own<Value>&& com, bool add);
private:
int _index;
std::vector<Own<Value>> _components;
std::vector<Own<Value>> _oldComs;
DORA_TYPE_OVERRIDE(Entity);
};
struct WRefEntityHasher
{
std::hash<Entity*> hash;
inline size_t operator () (const WRef<Entity>& entity) const
{
return hash(entity.get());
}
};
class EntityGroup : public Object
{
public:
PROPERTY_READONLY(int, Count);
EntityGroup(const std::vector<std::string>& components);
virtual ~EntityGroup();
virtual bool init() override;
static EntityGroup* create(const std::vector<std::string>& components);
static EntityGroup* create(Slice components[], int count);
public:
template<typename Func>
bool each(const Func& func);
template<typename Func>
Entity* find(const Func& func);
EntityGroup* every(const EntityHandler& handler);
public:
void onAdd(Entity* entity);
void onRemove(Entity* entity);
private:
std::unordered_set<WRef<Entity>, WRefEntityHasher> _entities;
std::vector<int> _components;
DORA_TYPE_OVERRIDE(EntityGroup);
};
class EntityObserver : public Object
{
public:
EntityObserver(int option, const std::vector<std::string>& components);
virtual ~EntityObserver();
virtual bool init() override;
static EntityObserver* create(int option, const std::vector<std::string>& components);
static EntityObserver* create(int option, Slice components[], int count);
public:
template<typename Func>
bool each(const Func& func);
EntityObserver* every(const EntityHandler& handler);
public:
void onEvent(Entity* entity);
void clear();
private:
int _option;
std::unordered_set<WRef<Entity>, WRefEntityHasher> _entities;
std::vector<int> _components;
DORA_TYPE_OVERRIDE(EntityObserver);
};
template<typename T>
void Entity::set(String name, const T& value, bool rawFlag)
{
int index = getIndex(name);
Value* com = getComponent(index);
if (rawFlag)
{
AssertIf(com == nullptr, "raw set non-exist component \"{}\".", name);
if constexpr (std::is_base_of_v<Object, std::remove_pointer_t<T>>)
{
auto objVal = DoraAs<ValueObject>(com);
AssertIf(objVal == nullptr, "assign non-exist component \"{}\".", name);
objVal->set(value);
}
else
{
com->to<T>() = value;
}
return;
}
if (com)
{
if constexpr (std::is_base_of_v<Object, std::remove_pointer_t<T>>)
{
auto object = DoraAs<ValueObject>(com);
AssertIf(object == nullptr, "component value type mismatch\"{}\".", name);
updateComponent(index, object->clone(), false);
object->set(value);
}
else
{
updateComponent(index, com->clone(), false);
com->to<T>() = value;
}
}
else
{
updateComponent(index, Value::alloc(value), true);
}
}
template<typename T>
void Entity::setNext(String name, const T& value)
{
int index = getIndex(name);
setNext(index, Value::alloc(value));
}
template<typename T>
const T& Entity::get(String name) const
{
Value* com = getComponent(name);
AssertIf(com == nullptr, "access non-exist component \"{}\".", name);
return com->to<T>();
}
template<typename T>
const T& Entity::get(String name, const T& def) const
{
Value* com = getComponent(name);
if (com) return com->to<T>();
else return def;
}
template<typename Func>
bool EntityGroup::each(const Func& func)
{
decltype(_entities) entities = _entities;
for (Entity* entity : entities)
{
if (entity && func(entity)) return true;
}
return false;
}
template<typename Func>
Entity* EntityGroup::find(const Func& func)
{
for (Entity* entity : _entities)
{
if (entity && func(entity)) return entity;
}
return nullptr;
}
template<typename Func>
bool EntityObserver::each(const Func& func)
{
static decltype(_entities) entities;
entities = _entities;
for (Entity* entity : entities)
{
if (entity && func(entity)) return true;
}
return false;
}
NS_DOROTHY_END
| 27.569507 | 463 | 0.728204 |
0ca7f83ce0acfbddbeeedb3ade867fa2509b5563 | 504 | h | C | Engine/Dependences/Framework/Graphics/inc/Environment/TextureFilters.h | GlebShikovec/SREngine | bb806c3e4da06ef6fddee5b46ed5d2fca231be43 | [
"MIT"
] | null | null | null | Engine/Dependences/Framework/Graphics/inc/Environment/TextureFilters.h | GlebShikovec/SREngine | bb806c3e4da06ef6fddee5b46ed5d2fca231be43 | [
"MIT"
] | 1 | 2022-03-07T14:42:22.000Z | 2022-03-07T14:42:22.000Z | Engine/Dependences/Framework/Graphics/inc/Environment/TextureFilters.h | GlebShikovec/SREngine | bb806c3e4da06ef6fddee5b46ed5d2fca231be43 | [
"MIT"
] | null | null | null | //
// Created by Nikita on 12.12.2020.
//
#ifndef GAMEENGINE_TEXTUREFILTERS_H
#define GAMEENGINE_TEXTUREFILTERS_H
namespace Framework::Graphics {
enum class TextureType {
Unknown, Diffuse, Normal, Specular, Roughness, Glossiness
};
enum class TextureFilter {
Unknown, NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST,
LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR
};
enum class TextureCompression{
};
}
#endif //GAMEENGINE_TEXTUREFILTERS_H
| 22.909091 | 74 | 0.732143 |
676177a3c8c52dbf5bc94c352226522986b3e492 | 1,480 | c | C | basics/classical-ciphers/vigenere-cipher/src/vigenere_cipher.c | AdamBromiley/kermit | bbbcb30b35c3a1b91913ab41877a4b2bfe0c65d5 | [
"MIT"
] | null | null | null | basics/classical-ciphers/vigenere-cipher/src/vigenere_cipher.c | AdamBromiley/kermit | bbbcb30b35c3a1b91913ab41877a4b2bfe0c65d5 | [
"MIT"
] | null | null | null | basics/classical-ciphers/vigenere-cipher/src/vigenere_cipher.c | AdamBromiley/kermit | bbbcb30b35c3a1b91913ab41877a4b2bfe0c65d5 | [
"MIT"
] | null | null | null | #include <vigenere_cipher.h>
/* Encrypt/decrypt string using the Vigenere Cipher */
int vigenereEncrypt(char *ciphertext, const char *plaintext, size_t plaintextSize, char *key, size_t keyLength, enum VigenereMode mode)
{
size_t i;
char c, k, baseChar;
int shift;
/* Convert key to uppercase and check for non-alphabetic characters */
for (i = 0; i < keyLength; ++i)
{
k = key[i];
if (isalpha(k) == 0)
{
return 1;
}
key[i] = toupper(k);
}
for (i = 0; i < plaintextSize; ++i)
{
c = plaintext[i];
/* Ignore non-alphabetic characters */
if (isalpha(c) != 0)
{
/* Get respective key character */
k = key[i % keyLength];
/* Get index of k in the alphabet */
shift = k - BASE_UPPER;
if (mode == VIGENERE_DECRYPT)
{
shift = -(shift);
}
/* Get index of c in the alphabet */
baseChar = isupper(c) ? BASE_UPPER : BASE_LOWER;
c -= baseChar;
/* Add shift */
c = (c + shift) % ALPHABET_LENGTH;
/* If decrypting and c goes below 0 (% is not modulo) */
if (c < 0)
{
c += ALPHABET_LENGTH;
}
/* Convert alphabet index back to ASCII char */
c += baseChar;
}
ciphertext[i] = c;
}
return 0;
} | 23.125 | 135 | 0.481081 |
8cad8524a7a85f9180e28a163132ac006bc77602 | 384 | c | C | Chapter05/jmp-call-shellcode.c | firebitsbr/Penetration-Testing-with-Shellcode | 2d756bccace6b727e050b2010ebf23e08d221fdc | [
"MIT"
] | 30 | 2018-05-15T21:45:09.000Z | 2022-03-23T20:04:25.000Z | Chapter05/jmp-call-shellcode.c | naveenselvan/Penetration-Testing-with-Shellcode | 2d756bccace6b727e050b2010ebf23e08d221fdc | [
"MIT"
] | 1 | 2020-10-19T13:03:32.000Z | 2020-11-24T05:50:17.000Z | Chapter05/jmp-call-shellcode.c | naveenselvan/Penetration-Testing-with-Shellcode | 2d756bccace6b727e050b2010ebf23e08d221fdc | [
"MIT"
] | 18 | 2018-02-20T21:21:23.000Z | 2022-01-26T04:19:28.000Z | #include<stdio.h>
#include<string.h>
unsigned char code[] =
"\xeb\x1f\x5e\xb0\x01\x48\x31\xff\x48\x83\xc7\x01\x48\x31\xd2\x48\x83\xc2\x0c\x0f\x05\x48\x31\xc0\x48\x83\xc0\x3c\x48\x31\xff\x0f\x05\xe8\xdc\xff\xff\xff\x68\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\x0a";
int main()
{
printf("Shellcode Length: %d\n", (int)strlen(code));
int (*ret)() = (int(*)())code;
ret();
}
| 32 | 203 | 0.65625 |
87b869e21e9b526e16553457419cb21bc3f629b8 | 4,735 | c | C | src/agtm/main/agtm_process.c | cumthqb/AntDB | ac2aa27563a378cd6af86181aa36fbbf216b50bc | [
"PostgreSQL",
"Apache-2.0"
] | 1 | 2019-03-01T02:44:33.000Z | 2019-03-01T02:44:33.000Z | src/agtm/main/agtm_process.c | cumthqb/AntDB | ac2aa27563a378cd6af86181aa36fbbf216b50bc | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/agtm/main/agtm_process.c | cumthqb/AntDB | ac2aa27563a378cd6af86181aa36fbbf216b50bc | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | #include "postgres.h"
#include "access/printtup.h"
#include "access/xact.h"
#include "agtm/agtm.h"
#include "agtm/agtm_msg.h"
#include "agtm/agtm_sequence.h"
#include "agtm/agtm_transaction.h"
#include "agtm/agtm_utils.h"
#include "catalog/pg_type.h"
#include "libpq/libpq-fe.h"
#include "libpq/libpq-int.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "tcop/pquery.h"
#include "utils/memutils.h"
#include "utils/portal.h"
#include "utils/ps_status.h"
static TupleTableSlot* get_agtm_command_slot(void);
void
ProcessAGtmCommand(StringInfo input_message, CommandDest dest)
{
DestReceiver *receiver;
const char *msg_name;
MemoryContext oldcontext;
StringInfo output;
AGTM_MessageType mtype;
static StringInfoData buf={NULL, 0, 0, 0};
mtype = pq_getmsgint(input_message, sizeof (AGTM_MessageType));
msg_name = gtm_util_message_name(mtype);
set_ps_display(msg_name, true);
BeginCommand(msg_name, dest);
ereport(DEBUG1,
(errmsg("[ pid=%d] Process Command mtype = %s (%d).",
MyProcPid, msg_name, (int)mtype)));
if(buf.data == NULL)
{
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
initStringInfo(&buf);
enlargeStringInfo(&buf, VARHDRSZ);
MemoryContextSwitchTo(oldcontext);
}
resetStringInfo(&buf);
buf.len = VARDATA(buf.data) - buf.data;
switch (mtype)
{
case AGTM_MSG_GET_GXID:
output = ProcessGetGXIDCommand(input_message, &buf);
break;
case AGTM_MSG_GET_TIMESTAMP:
output = ProcessGetTimestamp(input_message, &buf);
break;
case AGTM_MSG_SNAPSHOT_GET:
output = ProcessGetSnapshot(input_message, &buf);
break;
case AGTM_MSG_GET_XACT_STATUS:
output = ProcessGetXactStatus(input_message, &buf);
break;
case AGTM_MSG_SYNC_XID:
output = ProcessSyncXID(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_INIT:
output = ProcessSequenceInit(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_ALTER:
output = ProcessSequenceAlter(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_DROP:
output = ProcessSequenceDrop(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_DROP_BYDB:
output = ProcessSequenceDropByDatabase(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_RENAME:
output = ProcessSequenceRename(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_RENAME_BYDB:
output = ProcessSequenceRenameByDatabase(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_SET_VAL:
PG_TRY();
{
output = ProcessSetSeqCommand(input_message, &buf);
} PG_CATCH();
{
/* CommitTransactionCommand();*/
PG_RE_THROW();
} PG_END_TRY();
break;
case AGTM_MSG_SEQUENCE_GET_NEXT:
PG_TRY();
{
output = ProcessNextSeqCommand(input_message, &buf);
} PG_CATCH();
{
/* CommitTransactionCommand();*/
PG_RE_THROW();
} PG_END_TRY();
break;
case AGTM_MSG_SEQUENCE_GET_CUR:
output = ProcessCurSeqCommand(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_GET_LAST:
output = PorcessLastSeqCommand(input_message, &buf);
break;
case AGTM_MSG_SEQUENCE_RESET_CACHE:
output = ProcessDiscardCommand(input_message, &buf);
break;
default:
ereport(FATAL,
(EPROTO,
errmsg("[ pid=%d] invalid frontend message type %d",
MyProcPid, mtype)));
break;
}
if(output != NULL)
{
TupleTableSlot *slot;
static int16 format = 1;
Assert(output->len >= VARHDRSZ);
SET_VARSIZE(output->data, output->len);
oldcontext = MemoryContextSwitchTo(MessageContext);
slot = ExecClearTuple(get_agtm_command_slot());
slot->tts_values[0] = PointerGetDatum(output->data);
slot->tts_isnull[0] = false;
ExecStoreVirtualTuple(slot);
receiver = CreateDestReceiver(dest);
if (dest == DestRemote)
StartupRemoteDestReceiver(receiver, slot->tts_tupleDescriptor, &format);
(*receiver->receiveSlot)(slot, receiver);
(*receiver->rShutdown)(receiver);
(*receiver->rDestroy)(receiver);
}
EndCommand(msg_name, dest);
resetStringInfo(&buf);
}
static TupleTableSlot* get_agtm_command_slot(void)
{
MemoryContext oldcontext;
static TupleTableSlot *slot = NULL;
static TupleDesc desc = NULL;
if(desc == NULL)
{
TupleDesc volatile temp = NULL;
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
PG_TRY();
{
temp = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry((TupleDesc)temp, 1, "result", BYTEAOID, -1, 0);
}PG_CATCH();
{
if(temp)
FreeTupleDesc((TupleDesc)temp);
PG_RE_THROW();
}PG_END_TRY();
desc = (TupleDesc)temp;
MemoryContextSwitchTo(oldcontext);
}
if(slot == NULL)
{
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
slot = MakeSingleTupleTableSlot(desc);
ExecSetSlotDescriptor(slot, desc);
MemoryContextSwitchTo(oldcontext);
}
return slot;
}
| 24.035533 | 75 | 0.726294 |
f439910c9ebcae1c3f1e8098889f78918e0f4f70 | 317 | h | C | src/Include/Spotify/Spotify_Session_AudioBufferStats.h | sialcasa/jlibspotify | 3fb825a1bc01b83e4ef52837ebe39b4b691856f9 | [
"Apache-2.0"
] | 2 | 2015-12-01T14:01:59.000Z | 2015-12-01T14:02:03.000Z | src/Include/Spotify/Spotify_Session_AudioBufferStats.h | sialcasa/jlibspotify | 3fb825a1bc01b83e4ef52837ebe39b4b691856f9 | [
"Apache-2.0"
] | null | null | null | src/Include/Spotify/Spotify_Session_AudioBufferStats.h | sialcasa/jlibspotify | 3fb825a1bc01b83e4ef52837ebe39b4b691856f9 | [
"Apache-2.0"
] | null | null | null | /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Spotify_Session_AudioBufferStats */
#ifndef _Included_Spotify_Session_AudioBufferStats
#define _Included_Spotify_Session_AudioBufferStats
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif
| 22.642857 | 56 | 0.769716 |
736e3bd9a323fef3f829c1f3a5d621503faed67c | 5,681 | h | C | src/dataio.h | glaivesoft/biomedicaldataio | 73e5fd6379e45ac06efdab7728edba645852d8ff | [
"BSD-3-Clause"
] | 2 | 2018-06-25T21:52:54.000Z | 2019-09-19T00:27:50.000Z | src/dataio.h | glaivesoft/biomedicaldataio | 73e5fd6379e45ac06efdab7728edba645852d8ff | [
"BSD-3-Clause"
] | 1 | 2017-01-20T22:27:17.000Z | 2017-01-20T22:27:17.000Z | src/dataio.h | glaivesoft/biomedicaldataio | 73e5fd6379e45ac06efdab7728edba645852d8ff | [
"BSD-3-Clause"
] | null | null | null | // dataio.h
// read/write .tif, .nii, .raw, ...
// developed by Yang Yu (gnayuy@gmail.com)
#ifndef __DATAIO_H__
#define __DATAIO_H__
#include "biomedicaldataio.h"
//
extern "C" {
#include "tiff.h"
#include "tiffio.h"
#include "nifti1_io.h"
#include "znzlib.h"
};
#include "klb_imageIO.h"
//
template <class Tdata, class Tidx>
int convertImageOrder(Tdata *&p, Tidx dimx, Tidx dimy, Tidx dimz, Tidx dimc, bool cxyz2xyzc)
{
//
/// convert image order [CXYZ] <-> [XYZC]
//
//
if(!p)
{
cout<<"Invalid pointer for convertImageOrder."<<endl;
return -1;
}
//
Tidx offset_tif_x = dimc;
Tidx offset_tif_y = offset_tif_x*dimx;
Tidx offset_tif_z = offset_tif_y*dimy;
Tidx offset_ilia_y = dimx;
Tidx offset_ilia_z = offset_ilia_y*dimy;
Tidx offset_ilia_c = offset_ilia_z*dimz;
Tidx imagesz = dimc*offset_ilia_c;
//
Tdata *pTmp = NULL;
new1dp<Tdata, Tidx>(pTmp, imagesz);
memcpy(pTmp, p, imagesz * sizeof(Tdata) );
// std::copy(&p[0], &p[imagesz-1], pTmp);
//
for (Tidx c=0; c<dimc; c++)
{
Tidx offset_out_c = c*offset_ilia_c;
for (Tidx z=0; z<dimz; z++)
{
Tidx offset_in_z = z*offset_tif_z;
Tidx offset_out_z = z*offset_ilia_z + offset_out_c;
for (Tidx y=0; y<dimy; y++)
{
Tidx offset_in_y = y*offset_tif_y + offset_in_z;
Tidx offset_out_y = y*offset_ilia_y + offset_out_z;
for (Tidx x=0; x<dimx; x++)
{
Tidx idx_in = offset_in_y + x*offset_tif_x + c;
Tidx idx_out = offset_out_y + x;
if(cxyz2xyzc)
{
// CXYZ -> XYZC
p[idx_out] = pTmp[idx_in];
}
else
{
// XYZC -> CXYZ
p[idx_in] = pTmp[idx_out];
}
}// x
}// y
}// z
}// c
// de-alloc
del1dp<Tdata>(pTmp);
//
return 0;
}
// TIFF
class TiffIO : public BioMedicalDataIO
{
public:
TiffIO();
~TiffIO();
public:
// reading
bool canReadFile(char *fileNameToRead);
int read();
// writing
bool canWriteFile(char *fileNameToWrite);
int write();
//
void close();
//
void changeImageOrder(bool io);
private:
uint16 config;
uint16 bitspersample, samplesperpixel;
uint16 compression, photometric;
uint32 width, length;
uint16 orientation;
uint32 tilewidth, tilelength, rowsperstrip;
uint16 transferR, transferG, transferB, transferA;
uint16 colormapR, colormapG, colormapB, colormapA;
bool bICC;
uint32 lenICC;
void** dataICC;
bool bINKS, bInkName;
uint16 ninks;
const char* inknames;
int inknameslen;
bool bPG;
unsigned short m_CurrentPage, m_NumberOfPages;
bool bTiled;
uint16 fillorder;
uint32 m_NumberOfTiles;
private:
uint32 m_SUBFILETYPE;
uint16 m_THRESHHOLDING;
char* m_DOCUMENTNAME;
char* m_IMAGEDESCRIPTION;
char* m_MAKE;
char* m_MODEL;
uint16 m_MINSAMPLEVALUE;
uint16 m_MAXSAMPLEVALUE;
float m_XRESOLUTION;
float m_YRESOLUTION;
char* m_PAGENAME;
float m_XPOSITION;
float m_YPOSITION;
uint16 m_RESOLUTIONUNIT;
char* m_SOFTWARE;
char* m_DATETIME;
char* m_ARTIST;
char* m_HOSTCOMPUTER;
float* m_WHITEPOINT;
float* m_PRIMARYCHROMATICITIES;
uint16 m_HALFTONEHINTS1, m_HALFTONEHINTS2;
uint16 m_INKSET;
uint16 m_DOTRANGE1, m_DOTRANGE2;
char* m_TARGETPRINTER;
uint16 m_SAMPLEFORMAT;
float* m_YCBCRCOEFFICIENTS;
uint16 m_YCBCRSUBSAMPLING1, m_YCBCRSUBSAMPLING2;
uint16 m_YCBCRPOSITIONING;
float* m_REFERENCEBLACKWHITE;
uint16 m_EXTRASAMPLES1;
uint16* m_EXTRASAMPLES2;
double m_SMINSAMPLEVALUE;
double m_SMAXSAMPLEVALUE;
double m_STONITS;
unsigned int m_SubFiles;
unsigned int m_IgnoredSubFiles;
//
TIFF* m_TiffImage;
};
// NIfTI
class NiftiIO : public BioMedicalDataIO
{
public:
NiftiIO();
~NiftiIO();
public:
// reading
bool canReadFile(char *fileNameToRead);
int read();
// writing
bool canWriteFile(char *fileNameToWrite);
int write();
int write(const void *buffer, long sx, long sy, long sz, long sc, long st, int datatype, float vx, float vy, float vz);
// compressed ?
int isCompressed(const char * filename);
private:
bool mustRescale();
void setPixelType(IOPixelType pt);
private:
znzFile m_GZFile;
nifti_image *m_NiftiImage;
double m_RescaleSlope;
double m_RescaleIntercept;
bool m_LegacyAnalyze75Mode;
IOPixelType m_PixelType;
};
// KLB
class KLBIO : public BioMedicalDataIO
{
public:
KLBIO();
~KLBIO();
public:
// reading
bool canReadFile(char *fileNameToRead);
// writing
bool canWriteFile(char *fileNameToWrite);
private:
KLB_COMPRESSION_TYPE compressionType;
int numThreads;
uint32_t xyzct[KLB_DATA_DIMS], blockSize[KLB_DATA_DIMS];
float32_t voxelsize[KLB_DATA_DIMS];
KLB_DATA_TYPE datatype;
char metadata[KLB_METADATA_SIZE];
};
// RAW
class RawIO : public BioMedicalDataIO
{
public:
RawIO();
~RawIO();
public:
// reading
bool canReadFile(char *fileNameToRead);
int read();
// writing
bool canWriteFile(char *fileNameToWrite);
int write();
};
#endif // __DATAIO_H__
| 21.118959 | 123 | 0.600422 |
981b24054288b56e18d4cccfa9785ca2d80d9c93 | 2,419 | h | C | MQ/include/MQ/CommandServer.h | fbraem/mqweb | c030b300a0b7312c24948e0add4eb6a9b7f8a05b | [
"MIT"
] | 18 | 2015-01-12T20:17:27.000Z | 2022-02-11T17:40:54.000Z | MQ/include/MQ/CommandServer.h | hlkiltas/mqweb | 9b70e0cba70050e856a9cc5a04c660df8d880d15 | [
"MIT"
] | 12 | 2015-01-20T12:47:01.000Z | 2019-03-13T07:10:19.000Z | MQ/include/MQ/CommandServer.h | hlkiltas/mqweb | 9b70e0cba70050e856a9cc5a04c660df8d880d15 | [
"MIT"
] | 8 | 2015-01-13T13:52:29.000Z | 2021-12-10T12:07:29.000Z | /*
* Copyright 2017 - KBC Group NV - Franky Braem - The 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.
*/
#ifndef _MQ_CommandServer_h
#define _MQ_CommandServer_h
#include <cmqc.h>
#include <vector>
#include "MQ/Queue.h"
#include "MQ/PCF.h"
#include "Poco/SharedPtr.h"
namespace MQ {
class QueueManager;
class CommandServer
/// Class for sending PCF commands to a queuemanager
{
public:
CommandServer(Poco::SharedPtr<QueueManager> qmgr, const std::string& modelQueue);
/// Constructor.
std::string commandQName() const;
/// Returns the name of the command queue.
PCF::Ptr createCommand(MQLONG command) const;
/// Returns a shared pointer to a PCF object for the given command.
void sendCommand(PCF::Ptr& command, PCF::Vector& response);
/// Sends the command to the queuemanager. The response is returned
/// as a vector of PCF objects. Can throw a MQException.
std::string replyQName() const;
/// Returns the name of the reply queue.
private:
CommandServer(const CommandServer& copy);
CommandServer& operator = (const CommandServer& copy);
Poco::SharedPtr<QueueManager> _qmgr;
Queue _commandQ;
Queue _replyQ;
friend class QueueManager;
};
inline std::string CommandServer::commandQName() const
{
return _commandQ.name();
}
inline std::string CommandServer::replyQName() const
{
return _replyQ.name();
}
} // namespace MQ
#endif // _MQ_CommandServer_h
| 29.5 | 82 | 0.755271 |
29b13c53951f48b8cd0a6c360292d4e2265fbdab | 7,872 | c | C | sdk/ble_stack_com/profiles/FCC0/src/fcc0s.c | Yulong007/bk3435_BLEMesh_DesignKit | ee1069fba8a137ccea16c3a1c247ec8972248e24 | [
"Apache-2.0"
] | 4 | 2020-02-29T08:45:14.000Z | 2021-01-13T12:31:58.000Z | sdk/ble_stack_com/profiles/FCC0/src/fcc0s.c | Yulong007/bk3435_BLEMesh_DesignKit | ee1069fba8a137ccea16c3a1c247ec8972248e24 | [
"Apache-2.0"
] | null | null | null | sdk/ble_stack_com/profiles/FCC0/src/fcc0s.c | Yulong007/bk3435_BLEMesh_DesignKit | ee1069fba8a137ccea16c3a1c247ec8972248e24 | [
"Apache-2.0"
] | 8 | 2020-02-29T08:45:31.000Z | 2021-06-01T06:18:45.000Z | /**
****************************************************************************************
*
* @file fff0s.c
*
* @brief fff0 Server Implementation.
*
* Copyright (C) beken 2009-2015
*
*
****************************************************************************************
*/
#include "rwip_config.h"
#if (BLE_FCC0_SERVER)
#include "attm.h"
#include "fcc0s.h"
#include "fcc0s_task.h"
#include "prf_utils.h"
#include "prf.h"
#include "ke_mem.h"
#include "attm_util128.h"
#include "uart.h"
/*
* FFF0 ATTRIBUTES DEFINITION
****************************************************************************************
*/
/// Full FFF0 Database Description - Used to add attributes into the database
const struct attm_desc fcc0_att_db[FCC0S_IDX_NB] =
{
// FFF0 Service Declaration
[FCC0S_IDX_SVC] = {ATT_DECL_PRIMARY_SERVICE, PERM(RD, ENABLE), 0, 0},
[FCC0S_IDX_FCC2_LVL_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), 0, 0},
// Characteristic Value
[FCC0S_IDX_FCC2_LVL_VAL] = {ATT_USER_SERVER_CHAR_FCC2, PERM(WRITE_COMMAND, ENABLE), PERM(UUID_LEN, UUID_128) | PERM(RI, ENABLE) | ATT_UUID_128_LEN, FCC0_FCC2_DATA_LEN * sizeof(uint8_t)},
// fff1 Level Characteristic Declaration
[FCC0S_IDX_FCC1_LVL_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), 0, 0},
// fff1 Level Characteristic Value
[FCC0S_IDX_FCC1_LVL_VAL] = {ATT_USER_SERVER_CHAR_FCC1, PERM(WRITE_COMMAND, ENABLE), PERM(UUID_LEN, UUID_128) | PERM(RI, ENABLE) | ATT_UUID_128_LEN, FCC0_FCC1_DATA_LEN * sizeof(uint8_t)},
// fff1 Level Characteristic - Client Characteristic Configuration Descriptor
[FCC0S_IDX_FCC1_LVL_NTF_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, PERM(RD, ENABLE) | PERM(WRITE_REQ, ENABLE), 0, 0},
};/// Macro used to retrieve permission value from access and rights on attribute.
static uint8_t fcc0s_init (struct prf_task_env *env, uint16_t *start_hdl, uint16_t app_task, uint8_t sec_lvl, struct fcc0s_db_cfg *params)
{
uint16_t shdl;
struct fcc0s_env_tag *fcc0s_env = NULL;
// Status
uint8_t status = GAP_ERR_NO_ERROR;
//-------------------- allocate memory required for the profile ---------------------
fcc0s_env = (struct fcc0s_env_tag * ) ke_malloc(sizeof(struct fcc0s_env_tag), KE_MEM_ATT_DB);
memset(fcc0s_env, 0, sizeof(struct fcc0s_env_tag));
// Service content flag
uint8_t cfg_flag = FCC0S_CFG_FLAG_MANDATORY_MASK;
// Save database configuration
fcc0s_env->features |= (params->features) ;
shdl = *start_hdl;
//Create FFC0 in the DB
//------------------ create the attribute database for the profile -------------------
status = attm_util_svc_create_db128(&(shdl), ATT_USER_SERVER_FCC0, (uint8_t *)&cfg_flag,
FCC0S_IDX_NB, NULL, env->task, &fcc0_att_db[0],
(sec_lvl & (PERM_MASK_SVC_DIS | PERM_MASK_SVC_AUTH | PERM_MASK_SVC_EKS)));
//Set optional permissions
if (status == GAP_ERR_NO_ERROR)
{
//Set optional permissions
if (params->features == FCC0_FCC1_LVL_NTF_SUP)
{
// Battery Level characteristic value permissions
uint16_t perm = PERM(RD, ENABLE) | PERM(NTF, ENABLE);
attm_att_set_permission(shdl + FCC0S_IDX_FCC1_LVL_VAL, perm, 0);
}
}
//-------------------- Update profile task information ---------------------
if (status == ATT_ERR_NO_ERROR)
{
// allocate BASS required environment variable
env->env = (prf_env_t *) fcc0s_env;
*start_hdl = shdl;
fcc0s_env->start_hdl = *start_hdl;
fcc0s_env->prf_env.app_task = app_task
| (PERM_GET(sec_lvl, SVC_MI) ? PERM(PRF_MI, ENABLE) : PERM(PRF_MI, DISABLE));
fcc0s_env->prf_env.prf_task = env->task | PERM(PRF_MI, DISABLE);
// initialize environment variable
env->id = TASK_ID_FCC0S;
env->desc.idx_max = FCC0S_IDX_MAX;
env->desc.state = fcc0s_env->state;
env->desc.default_handler = &fcc0s_default_handler;
// service is ready, go into an Idle state
ke_state_set(env->task, FCC0S_IDLE);
}
else if (fcc0s_env != NULL)
{
ke_free(fcc0s_env);
}
return (status);
}
static void fcc0s_destroy(struct prf_task_env *env)
{
struct fcc0s_env_tag *fcc0s_env = (struct fcc0s_env_tag *) env->env;
// clear on-going operation
if (fcc0s_env->operation != NULL)
{
ke_free(fcc0s_env->operation);
}
// free profile environment variables
env->env = NULL;
ke_free(fcc0s_env);
}
static void fcc0s_create(struct prf_task_env *env, uint8_t conidx)
{
struct fcc0s_env_tag *fff0s_env = (struct fcc0s_env_tag *) env->env;
ASSERT_ERR(conidx < BLE_CONNECTION_MAX);
// force notification config to zero when peer device is connected
fff0s_env->ntf_cfg[conidx] = 0;
}
static void fcc0s_cleanup(struct prf_task_env *env, uint8_t conidx, uint8_t reason)
{
struct fcc0s_env_tag *fcc0s_env = (struct fcc0s_env_tag *) env->env;
ASSERT_ERR(conidx < BLE_CONNECTION_MAX);
// force notification config to zero when peer device is disconnected
fcc0s_env->ntf_cfg[conidx] = 0;
}
void fcc0s_notify_fcc1_lvl(struct fcc0s_env_tag *fcc0s_env, struct fcc0s_fcc1_level_upd_req const *param)
{
// Allocate the GATT notification message
struct gattc_send_evt_cmd *fcc1_lvl = KE_MSG_ALLOC_DYN(GATTC_SEND_EVT_CMD,
KE_BUILD_ID(TASK_GATTC, 0), prf_src_task_get(&(fcc0s_env->prf_env), 0),
gattc_send_evt_cmd, sizeof(uint8_t) * (param->length));
// Fill in the parameter structure
fcc1_lvl->operation = GATTC_NOTIFY;
fcc1_lvl->handle = fcc0s_get_att_handle(FCC0S_IDX_FCC1_LVL_VAL);
// pack measured value in database
fcc1_lvl->length = param->length;
memcpy(&fcc1_lvl->value[0], ¶m->fcc1_level[0], param->length);
// send notification to peer device
ke_msg_send(fcc1_lvl);
}
/// BASS Task interface required by profile manager
const struct prf_task_cbs fcc0s_itf =
{
(prf_init_fnct) fcc0s_init,
fcc0s_destroy,
fcc0s_create,
fcc0s_cleanup,
};
const struct prf_task_cbs *fcc0s_prf_itf_get(void)
{
return &fcc0s_itf;
}
uint16_t fcc0s_get_att_handle( uint8_t att_idx)
{
struct fcc0s_env_tag *fcc0s_env = PRF_ENV_GET(FCC0S, fcc0s);
uint16_t handle = ATT_INVALID_HDL;
handle = fcc0s_env->start_hdl;
// increment index according to expected index
if (att_idx < FCC0S_IDX_FCC1_LVL_NTF_CFG)
{
handle += att_idx;
}
// FFF1 notification
else if ((att_idx == FCC0S_IDX_FCC1_LVL_NTF_CFG) && (((fcc0s_env->features ) & 0x01) == FCC0_FCC1_LVL_NTF_SUP))
{
handle += FCC0S_IDX_FCC1_LVL_NTF_CFG;
}
else
{
handle = ATT_INVALID_HDL;
}
return handle;
}
uint8_t fcc0s_get_att_idx(uint16_t handle, uint8_t *att_idx)
{
struct fcc0s_env_tag *fcc0s_env = PRF_ENV_GET(FCC0S, fcc0s);
uint16_t hdl_cursor = fcc0s_env->start_hdl;
uint8_t status = PRF_APP_ERROR;
// Browse list of services
// handle must be greater than current index
// check if it's a mandatory index
if (handle <= (hdl_cursor + FCC0S_IDX_FCC1_LVL_VAL))
{
*att_idx = handle - hdl_cursor;
status = GAP_ERR_NO_ERROR;
}
hdl_cursor += FCC0S_IDX_FCC1_LVL_VAL;
// check if it's a notify index
if (((fcc0s_env->features ) & 0x01) == FCC0_FCC1_LVL_NTF_SUP)
{
hdl_cursor++;
if (handle == hdl_cursor)
{
*att_idx = FCC0S_IDX_FCC1_LVL_NTF_CFG;
status = GAP_ERR_NO_ERROR;
}
}
hdl_cursor++;
return (status);
}
#endif // (BLE_ffC0_SERVER)
| 30.63035 | 194 | 0.631479 |
4e68b67ffb5e2db3a9e9141b18aa0b47f3be11ce | 526 | h | C | Classes/Encoding/Xml/XmlObjectBuilder/NSObject+FLXmlObjectBuilder.h | fishlamp-released/FishLamp3 | 216293cc4d08945853ac271affff0968f8137655 | [
"MIT"
] | 1 | 2015-12-30T13:15:11.000Z | 2015-12-30T13:15:11.000Z | Classes/Encoding/Xml/XmlObjectBuilder/NSObject+FLXmlObjectBuilder.h | fishlamp-released/FishLamp3 | 216293cc4d08945853ac271affff0968f8137655 | [
"MIT"
] | null | null | null | Classes/Encoding/Xml/XmlObjectBuilder/NSObject+FLXmlObjectBuilder.h | fishlamp-released/FishLamp3 | 216293cc4d08945853ac271affff0968f8137655 | [
"MIT"
] | null | null | null | //
// NSObject+FLXmlObjectBuilder.h
// FishLampCocoa
//
// Created by Mike Fullerton on 5/7/13.
// Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
#import "FishLampCore.h"
@class FLParsedXmlElement;
@class FLXmlObjectBuilder;
@interface NSObject (FLXmlObjectBuilder)
+ (id) objectWithXmlFilePath:(NSString*) xmlFilePath;
+ (id) objectWithXmlFile:(NSString*) xmlFileName inBundle:(NSBundle*) bundleOrNil;
@end
| 25.047619 | 90 | 0.754753 |
2285db2b596c6d65fc95934da2fb80a7cc2a648f | 628 | h | C | Snippets/Source/RFHighlightsController.h | microdotblog/microblog-ios | 86d94b69683eb398d19e66aa4bf99e2b896388c3 | [
"MIT"
] | 25 | 2021-06-30T19:38:04.000Z | 2022-03-29T10:25:50.000Z | Snippets/Source/RFHighlightsController.h | microdotblog/microblog-ios | 86d94b69683eb398d19e66aa4bf99e2b896388c3 | [
"MIT"
] | 11 | 2021-07-01T14:57:14.000Z | 2022-02-04T12:59:49.000Z | Snippets/Source/RFHighlightsController.h | microdotblog/microblog-ios | 86d94b69683eb398d19e66aa4bf99e2b896388c3 | [
"MIT"
] | 8 | 2021-06-30T21:39:08.000Z | 2022-02-11T03:13:34.000Z | //
// RFHighlightsController.h
// Micro.blog
//
// Created by Manton Reece on 9/12/20.
// Copyright © 2020 Riverfold Software. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class RFHighlight;
@interface RFHighlightsController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) IBOutlet UITableView* tableView;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView* progressSpinner;
@property (strong, nonatomic) NSArray* highlights; // RFHighlight
@property (strong, nonatomic) RFHighlight* selectedHighlight;
@end
NS_ASSUME_NONNULL_END
| 24.153846 | 97 | 0.788217 |
22965bbf0b4053fcce7bbb6629892914c893bc3d | 2,384 | h | C | headers/TNDRChatLikeCell.h | Tatsh-archive/tynder | bbbf0a2b7480d1a1519483ddcead6736d9ba6501 | [
"MIT"
] | 1 | 2015-03-03T13:37:47.000Z | 2015-03-03T13:37:47.000Z | headers/TNDRChatLikeCell.h | Tatsh/tynder | bbbf0a2b7480d1a1519483ddcead6736d9ba6501 | [
"MIT"
] | null | null | null | headers/TNDRChatLikeCell.h | Tatsh/tynder | bbbf0a2b7480d1a1519483ddcead6736d9ba6501 | [
"MIT"
] | null | null | null | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "UICollectionViewCell.h"
@class NSDate, NSDateFormatter, TNDRMatch, TNDRMessage, TNDRMoment, UIImageView, UILabel;
@interface TNDRChatLikeCell : UICollectionViewCell
{
struct CGRect _defaultTimestampBounds;
NSDateFormatter *_timeFormatter;
NSDateFormatter *_dateFormatter;
BOOL _showsTimestamp;
TNDRMatch *_match;
TNDRMessage *_message;
TNDRMoment *_moment;
int _cellType;
NSDate *_timestamp;
UIImageView *_momentImageView;
UIImageView *_heartImageView;
UILabel *_textLabel;
UILabel *_timestampLabel;
UILabel *_topTimestampLabel;
}
+ (id)dateFormatter;
+ (float)heightForCell;
+ (void)initialize;
+ (id)timeFormatter;
- (void).cxx_destruct;
- (void)adjustSubviewsForRightAlignment;
- (void)adjustSubviewsForTimestamp;
@property(nonatomic) int cellType; // @synthesize cellType=_cellType;
- (struct CGRect)defaultMomentRect;
@property(retain, nonatomic) UIImageView *heartImageView; // @synthesize heartImageView=_heartImageView;
- (id)initWithFrame:(struct CGRect)arg1;
@property(retain, nonatomic) TNDRMatch *match; // @synthesize match=_match;
@property(retain, nonatomic) TNDRMessage *message; // @synthesize message=_message;
@property(retain, nonatomic) TNDRMoment *moment; // @synthesize moment=_moment;
@property(retain, nonatomic) UIImageView *momentImageView; // @synthesize momentImageView=_momentImageView;
- (void)prepareForReuse;
- (void)resetAllSubviews;
- (void)restoreDefaultCellPosition;
- (void)retrieveMomentImage;
@property(nonatomic, getter=shouldShowTimestamp) BOOL showsTimestamp; // @synthesize showsTimestamp=_showsTimestamp;
@property(retain, nonatomic) UILabel *textLabel; // @synthesize textLabel=_textLabel;
@property(retain, nonatomic) NSDate *timestamp; // @synthesize timestamp=_timestamp;
@property(retain, nonatomic) UILabel *timestampLabel; // @synthesize timestampLabel=_timestampLabel;
@property(retain, nonatomic) UILabel *topTimestampLabel; // @synthesize topTimestampLabel=_topTimestampLabel;
- (void)setup;
- (void)setupHeartImageView;
- (void)setupMomentImageView;
- (void)setupTextLabel;
- (void)setupTimestampLabel;
- (void)translateToShowTimeWithTranslation:(float)arg1;
- (void)updateTextLabel;
- (void)updateTimestampLabel;
@end
| 37.25 | 116 | 0.776426 |
39510d219844885fe18cc72aa8fba4cc2534fcd3 | 366 | h | C | lib/globlib.h | UnexomWid/eryn | 4f9e2ba4151ffaad1d8aca66f8bfd56ddf9b1d4a | [
"MIT"
] | 6 | 2020-05-02T18:18:47.000Z | 2022-03-27T02:03:03.000Z | lib/globlib.h | UnexomWid/eryn | 4f9e2ba4151ffaad1d8aca66f8bfd56ddf9b1d4a | [
"MIT"
] | 43 | 2020-05-02T18:27:48.000Z | 2022-03-26T16:30:10.000Z | lib/globlib.h | UnexomWid/eryn | 4f9e2ba4151ffaad1d8aca66f8bfd56ddf9b1d4a | [
"MIT"
] | 4 | 2020-06-27T12:42:56.000Z | 2020-08-01T20:25:44.000Z | #ifndef GLOBLIB_H_GUARD
#define GLOBLIB_H_GUARD
#include <string.h>
#include <stdbool.h>
#define GLOB_NO_FLAGS 0x0
#define GLOB_MATCH_DOTFILES 0x1
#ifdef __cplusplus
extern "C" {
#endif
/// Returns true if a path matches a modern glob. False otherwise.
bool match(const char *path, const char *glob, const char flags);
#ifdef __cplusplus
}
#endif
#endif
| 16.636364 | 66 | 0.748634 |
79b111ebf40c16734333d6c04c4448025668f207 | 81,701 | h | C | Data/Juliet-C/Juliet-C-v102/testcases/CWE758_Undefined_Behavior/testcases.h | b19e93n/PLC-Pyramid | 6d5b57be6995a94ef7402144cee965862713b031 | [
"MIT"
] | null | null | null | Data/Juliet-C/Juliet-C-v102/testcases/CWE758_Undefined_Behavior/testcases.h | b19e93n/PLC-Pyramid | 6d5b57be6995a94ef7402144cee965862713b031 | [
"MIT"
] | null | null | null | Data/Juliet-C/Juliet-C-v102/testcases/CWE758_Undefined_Behavior/testcases.h | b19e93n/PLC-Pyramid | 6d5b57be6995a94ef7402144cee965862713b031 | [
"MIT"
] | null | null | null | // NOTE - eventually this file will be automatically updated using a Perl script that understand
// the naming of test case files, functions, and namespaces.
#ifndef _TESTCASES_H
#define _TESTCASES_H
#ifdef __cplusplus
extern "C" {
#endif
// declare C good and bad functions
#ifndef OMITGOOD
/* BEGIN-AUTOGENERATED-C-GOOD-FUNCTION-DECLARATIONS */
void CWE758_Undefined_Behavior__bare_return_01_good();
void CWE758_Undefined_Behavior__bare_return_implicit_01_good();
void CWE758_Undefined_Behavior__char_alloca_use_01_good();
void CWE758_Undefined_Behavior__char_alloca_use_02_good();
void CWE758_Undefined_Behavior__char_alloca_use_03_good();
void CWE758_Undefined_Behavior__char_alloca_use_04_good();
void CWE758_Undefined_Behavior__char_alloca_use_05_good();
void CWE758_Undefined_Behavior__char_alloca_use_06_good();
void CWE758_Undefined_Behavior__char_alloca_use_07_good();
void CWE758_Undefined_Behavior__char_alloca_use_08_good();
void CWE758_Undefined_Behavior__char_alloca_use_09_good();
void CWE758_Undefined_Behavior__char_alloca_use_10_good();
void CWE758_Undefined_Behavior__char_alloca_use_11_good();
void CWE758_Undefined_Behavior__char_alloca_use_12_good();
void CWE758_Undefined_Behavior__char_alloca_use_13_good();
void CWE758_Undefined_Behavior__char_alloca_use_14_good();
void CWE758_Undefined_Behavior__char_alloca_use_15_good();
void CWE758_Undefined_Behavior__char_alloca_use_16_good();
void CWE758_Undefined_Behavior__char_alloca_use_17_good();
void CWE758_Undefined_Behavior__char_alloca_use_18_good();
void CWE758_Undefined_Behavior__char_alloca_use_19_good();
void CWE758_Undefined_Behavior__char_malloc_use_01_good();
void CWE758_Undefined_Behavior__char_malloc_use_02_good();
void CWE758_Undefined_Behavior__char_malloc_use_03_good();
void CWE758_Undefined_Behavior__char_malloc_use_04_good();
void CWE758_Undefined_Behavior__char_malloc_use_05_good();
void CWE758_Undefined_Behavior__char_malloc_use_06_good();
void CWE758_Undefined_Behavior__char_malloc_use_07_good();
void CWE758_Undefined_Behavior__char_malloc_use_08_good();
void CWE758_Undefined_Behavior__char_malloc_use_09_good();
void CWE758_Undefined_Behavior__char_malloc_use_10_good();
void CWE758_Undefined_Behavior__char_malloc_use_11_good();
void CWE758_Undefined_Behavior__char_malloc_use_12_good();
void CWE758_Undefined_Behavior__char_malloc_use_13_good();
void CWE758_Undefined_Behavior__char_malloc_use_14_good();
void CWE758_Undefined_Behavior__char_malloc_use_15_good();
void CWE758_Undefined_Behavior__char_malloc_use_16_good();
void CWE758_Undefined_Behavior__char_malloc_use_17_good();
void CWE758_Undefined_Behavior__char_malloc_use_18_good();
void CWE758_Undefined_Behavior__char_malloc_use_19_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_01_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_02_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_03_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_04_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_05_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_06_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_07_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_08_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_09_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_10_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_11_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_12_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_13_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_14_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_15_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_16_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_17_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_18_good();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_19_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_01_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_02_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_03_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_04_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_05_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_06_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_07_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_08_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_09_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_10_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_11_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_12_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_13_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_14_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_15_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_16_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_17_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_18_good();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_19_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_01_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_02_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_03_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_04_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_05_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_06_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_07_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_08_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_09_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_10_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_11_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_12_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_13_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_14_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_15_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_16_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_17_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_18_good();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_19_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_01_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_02_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_03_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_04_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_05_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_06_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_07_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_08_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_09_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_10_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_11_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_12_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_13_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_14_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_15_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_16_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_17_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_18_good();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_19_good();
void CWE758_Undefined_Behavior__int_alloca_use_01_good();
void CWE758_Undefined_Behavior__int_alloca_use_02_good();
void CWE758_Undefined_Behavior__int_alloca_use_03_good();
void CWE758_Undefined_Behavior__int_alloca_use_04_good();
void CWE758_Undefined_Behavior__int_alloca_use_05_good();
void CWE758_Undefined_Behavior__int_alloca_use_06_good();
void CWE758_Undefined_Behavior__int_alloca_use_07_good();
void CWE758_Undefined_Behavior__int_alloca_use_08_good();
void CWE758_Undefined_Behavior__int_alloca_use_09_good();
void CWE758_Undefined_Behavior__int_alloca_use_10_good();
void CWE758_Undefined_Behavior__int_alloca_use_11_good();
void CWE758_Undefined_Behavior__int_alloca_use_12_good();
void CWE758_Undefined_Behavior__int_alloca_use_13_good();
void CWE758_Undefined_Behavior__int_alloca_use_14_good();
void CWE758_Undefined_Behavior__int_alloca_use_15_good();
void CWE758_Undefined_Behavior__int_alloca_use_16_good();
void CWE758_Undefined_Behavior__int_alloca_use_17_good();
void CWE758_Undefined_Behavior__int_alloca_use_18_good();
void CWE758_Undefined_Behavior__int_alloca_use_19_good();
void CWE758_Undefined_Behavior__int_malloc_use_01_good();
void CWE758_Undefined_Behavior__int_malloc_use_02_good();
void CWE758_Undefined_Behavior__int_malloc_use_03_good();
void CWE758_Undefined_Behavior__int_malloc_use_04_good();
void CWE758_Undefined_Behavior__int_malloc_use_05_good();
void CWE758_Undefined_Behavior__int_malloc_use_06_good();
void CWE758_Undefined_Behavior__int_malloc_use_07_good();
void CWE758_Undefined_Behavior__int_malloc_use_08_good();
void CWE758_Undefined_Behavior__int_malloc_use_09_good();
void CWE758_Undefined_Behavior__int_malloc_use_10_good();
void CWE758_Undefined_Behavior__int_malloc_use_11_good();
void CWE758_Undefined_Behavior__int_malloc_use_12_good();
void CWE758_Undefined_Behavior__int_malloc_use_13_good();
void CWE758_Undefined_Behavior__int_malloc_use_14_good();
void CWE758_Undefined_Behavior__int_malloc_use_15_good();
void CWE758_Undefined_Behavior__int_malloc_use_16_good();
void CWE758_Undefined_Behavior__int_malloc_use_17_good();
void CWE758_Undefined_Behavior__int_malloc_use_18_good();
void CWE758_Undefined_Behavior__int_malloc_use_19_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_01_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_02_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_03_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_04_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_05_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_06_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_07_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_08_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_09_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_10_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_11_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_12_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_13_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_14_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_15_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_16_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_17_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_18_good();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_19_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_01_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_02_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_03_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_04_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_05_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_06_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_07_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_08_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_09_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_10_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_11_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_12_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_13_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_14_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_15_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_16_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_17_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_18_good();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_19_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_01_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_02_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_03_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_04_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_05_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_06_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_07_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_08_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_09_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_10_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_11_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_12_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_13_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_14_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_15_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_16_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_17_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_18_good();
void CWE758_Undefined_Behavior__long_long_alloca_use_19_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_01_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_02_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_03_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_04_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_05_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_06_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_07_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_08_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_09_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_10_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_11_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_12_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_13_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_14_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_15_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_16_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_17_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_18_good();
void CWE758_Undefined_Behavior__long_long_malloc_use_19_good();
void CWE758_Undefined_Behavior__no_return_01_good();
void CWE758_Undefined_Behavior__no_return_implicit_01_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_01_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_02_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_03_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_04_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_05_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_06_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_07_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_08_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_09_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_10_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_11_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_12_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_13_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_14_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_15_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_16_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_17_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_18_good();
void CWE758_Undefined_Behavior__twoints_alloca_use_19_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_01_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_02_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_03_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_04_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_05_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_06_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_07_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_08_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_09_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_10_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_11_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_12_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_13_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_14_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_15_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_16_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_17_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_18_good();
void CWE758_Undefined_Behavior__twoints_malloc_use_19_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_01_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_02_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_03_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_04_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_05_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_06_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_07_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_08_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_09_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_10_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_11_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_12_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_13_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_14_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_15_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_16_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_17_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_18_good();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_19_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_01_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_02_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_03_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_04_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_05_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_06_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_07_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_08_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_09_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_10_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_11_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_12_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_13_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_14_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_15_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_16_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_17_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_18_good();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_19_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_01_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_02_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_03_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_04_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_05_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_06_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_07_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_08_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_09_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_10_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_11_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_12_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_13_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_14_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_15_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_16_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_17_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_18_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_19_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_01_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_02_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_03_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_04_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_05_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_06_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_07_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_08_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_09_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_10_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_11_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_12_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_13_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_14_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_15_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_16_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_17_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_18_good();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_19_good();
/* END-AUTOGENERATED-C-GOOD-FUNCTION-DECLARATIONS */
#endif // OMITGOOD
#ifndef OMITBAD
/* BEGIN-AUTOGENERATED-C-BAD-FUNCTION-DECLARATIONS */
void CWE758_Undefined_Behavior__bare_return_01_bad();
void CWE758_Undefined_Behavior__bare_return_implicit_01_bad();
void CWE758_Undefined_Behavior__char_alloca_use_01_bad();
void CWE758_Undefined_Behavior__char_alloca_use_02_bad();
void CWE758_Undefined_Behavior__char_alloca_use_03_bad();
void CWE758_Undefined_Behavior__char_alloca_use_04_bad();
void CWE758_Undefined_Behavior__char_alloca_use_05_bad();
void CWE758_Undefined_Behavior__char_alloca_use_06_bad();
void CWE758_Undefined_Behavior__char_alloca_use_07_bad();
void CWE758_Undefined_Behavior__char_alloca_use_08_bad();
void CWE758_Undefined_Behavior__char_alloca_use_09_bad();
void CWE758_Undefined_Behavior__char_alloca_use_10_bad();
void CWE758_Undefined_Behavior__char_alloca_use_11_bad();
void CWE758_Undefined_Behavior__char_alloca_use_12_bad();
void CWE758_Undefined_Behavior__char_alloca_use_13_bad();
void CWE758_Undefined_Behavior__char_alloca_use_14_bad();
void CWE758_Undefined_Behavior__char_alloca_use_15_bad();
void CWE758_Undefined_Behavior__char_alloca_use_16_bad();
void CWE758_Undefined_Behavior__char_alloca_use_17_bad();
void CWE758_Undefined_Behavior__char_alloca_use_18_bad();
void CWE758_Undefined_Behavior__char_alloca_use_19_bad();
void CWE758_Undefined_Behavior__char_malloc_use_01_bad();
void CWE758_Undefined_Behavior__char_malloc_use_02_bad();
void CWE758_Undefined_Behavior__char_malloc_use_03_bad();
void CWE758_Undefined_Behavior__char_malloc_use_04_bad();
void CWE758_Undefined_Behavior__char_malloc_use_05_bad();
void CWE758_Undefined_Behavior__char_malloc_use_06_bad();
void CWE758_Undefined_Behavior__char_malloc_use_07_bad();
void CWE758_Undefined_Behavior__char_malloc_use_08_bad();
void CWE758_Undefined_Behavior__char_malloc_use_09_bad();
void CWE758_Undefined_Behavior__char_malloc_use_10_bad();
void CWE758_Undefined_Behavior__char_malloc_use_11_bad();
void CWE758_Undefined_Behavior__char_malloc_use_12_bad();
void CWE758_Undefined_Behavior__char_malloc_use_13_bad();
void CWE758_Undefined_Behavior__char_malloc_use_14_bad();
void CWE758_Undefined_Behavior__char_malloc_use_15_bad();
void CWE758_Undefined_Behavior__char_malloc_use_16_bad();
void CWE758_Undefined_Behavior__char_malloc_use_17_bad();
void CWE758_Undefined_Behavior__char_malloc_use_18_bad();
void CWE758_Undefined_Behavior__char_malloc_use_19_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_01_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_02_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_03_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_04_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_05_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_06_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_07_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_08_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_09_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_10_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_11_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_12_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_13_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_14_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_15_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_16_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_17_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_18_bad();
void CWE758_Undefined_Behavior__char_pointer_alloca_use_19_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_01_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_02_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_03_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_04_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_05_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_06_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_07_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_08_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_09_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_10_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_11_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_12_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_13_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_14_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_15_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_16_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_17_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_18_bad();
void CWE758_Undefined_Behavior__char_pointer_malloc_use_19_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_01_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_02_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_03_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_04_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_05_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_06_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_07_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_08_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_09_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_10_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_11_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_12_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_13_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_14_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_15_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_16_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_17_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_18_bad();
void CWE758_Undefined_Behavior__double_pointer_alloca_use_19_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_01_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_02_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_03_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_04_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_05_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_06_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_07_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_08_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_09_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_10_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_11_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_12_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_13_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_14_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_15_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_16_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_17_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_18_bad();
void CWE758_Undefined_Behavior__double_pointer_malloc_use_19_bad();
void CWE758_Undefined_Behavior__int_alloca_use_01_bad();
void CWE758_Undefined_Behavior__int_alloca_use_02_bad();
void CWE758_Undefined_Behavior__int_alloca_use_03_bad();
void CWE758_Undefined_Behavior__int_alloca_use_04_bad();
void CWE758_Undefined_Behavior__int_alloca_use_05_bad();
void CWE758_Undefined_Behavior__int_alloca_use_06_bad();
void CWE758_Undefined_Behavior__int_alloca_use_07_bad();
void CWE758_Undefined_Behavior__int_alloca_use_08_bad();
void CWE758_Undefined_Behavior__int_alloca_use_09_bad();
void CWE758_Undefined_Behavior__int_alloca_use_10_bad();
void CWE758_Undefined_Behavior__int_alloca_use_11_bad();
void CWE758_Undefined_Behavior__int_alloca_use_12_bad();
void CWE758_Undefined_Behavior__int_alloca_use_13_bad();
void CWE758_Undefined_Behavior__int_alloca_use_14_bad();
void CWE758_Undefined_Behavior__int_alloca_use_15_bad();
void CWE758_Undefined_Behavior__int_alloca_use_16_bad();
void CWE758_Undefined_Behavior__int_alloca_use_17_bad();
void CWE758_Undefined_Behavior__int_alloca_use_18_bad();
void CWE758_Undefined_Behavior__int_alloca_use_19_bad();
void CWE758_Undefined_Behavior__int_malloc_use_01_bad();
void CWE758_Undefined_Behavior__int_malloc_use_02_bad();
void CWE758_Undefined_Behavior__int_malloc_use_03_bad();
void CWE758_Undefined_Behavior__int_malloc_use_04_bad();
void CWE758_Undefined_Behavior__int_malloc_use_05_bad();
void CWE758_Undefined_Behavior__int_malloc_use_06_bad();
void CWE758_Undefined_Behavior__int_malloc_use_07_bad();
void CWE758_Undefined_Behavior__int_malloc_use_08_bad();
void CWE758_Undefined_Behavior__int_malloc_use_09_bad();
void CWE758_Undefined_Behavior__int_malloc_use_10_bad();
void CWE758_Undefined_Behavior__int_malloc_use_11_bad();
void CWE758_Undefined_Behavior__int_malloc_use_12_bad();
void CWE758_Undefined_Behavior__int_malloc_use_13_bad();
void CWE758_Undefined_Behavior__int_malloc_use_14_bad();
void CWE758_Undefined_Behavior__int_malloc_use_15_bad();
void CWE758_Undefined_Behavior__int_malloc_use_16_bad();
void CWE758_Undefined_Behavior__int_malloc_use_17_bad();
void CWE758_Undefined_Behavior__int_malloc_use_18_bad();
void CWE758_Undefined_Behavior__int_malloc_use_19_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_01_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_02_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_03_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_04_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_05_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_06_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_07_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_08_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_09_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_10_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_11_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_12_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_13_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_14_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_15_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_16_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_17_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_18_bad();
void CWE758_Undefined_Behavior__int_pointer_alloca_use_19_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_01_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_02_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_03_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_04_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_05_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_06_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_07_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_08_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_09_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_10_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_11_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_12_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_13_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_14_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_15_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_16_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_17_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_18_bad();
void CWE758_Undefined_Behavior__int_pointer_malloc_use_19_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_01_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_02_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_03_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_04_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_05_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_06_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_07_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_08_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_09_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_10_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_11_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_12_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_13_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_14_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_15_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_16_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_17_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_18_bad();
void CWE758_Undefined_Behavior__long_long_alloca_use_19_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_01_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_02_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_03_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_04_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_05_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_06_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_07_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_08_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_09_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_10_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_11_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_12_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_13_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_14_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_15_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_16_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_17_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_18_bad();
void CWE758_Undefined_Behavior__long_long_malloc_use_19_bad();
void CWE758_Undefined_Behavior__no_return_01_bad();
void CWE758_Undefined_Behavior__no_return_implicit_01_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_01_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_02_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_03_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_04_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_05_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_06_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_07_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_08_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_09_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_10_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_11_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_12_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_13_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_14_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_15_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_16_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_17_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_18_bad();
void CWE758_Undefined_Behavior__twoints_alloca_use_19_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_01_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_02_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_03_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_04_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_05_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_06_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_07_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_08_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_09_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_10_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_11_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_12_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_13_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_14_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_15_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_16_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_17_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_18_bad();
void CWE758_Undefined_Behavior__twoints_malloc_use_19_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_01_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_02_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_03_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_04_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_05_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_06_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_07_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_08_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_09_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_10_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_11_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_12_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_13_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_14_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_15_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_16_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_17_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_18_bad();
void CWE758_Undefined_Behavior__twoints_pointer_alloca_use_19_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_01_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_02_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_03_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_04_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_05_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_06_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_07_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_08_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_09_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_10_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_11_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_12_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_13_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_14_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_15_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_16_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_17_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_18_bad();
void CWE758_Undefined_Behavior__twoints_pointer_malloc_use_19_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_01_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_02_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_03_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_04_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_05_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_06_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_07_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_08_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_09_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_10_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_11_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_12_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_13_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_14_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_15_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_16_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_17_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_18_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_alloca_use_19_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_01_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_02_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_03_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_04_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_05_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_06_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_07_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_08_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_09_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_10_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_11_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_12_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_13_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_14_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_15_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_16_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_17_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_18_bad();
void CWE758_Undefined_Behavior__wchar_t_pointer_malloc_use_19_bad();
/* END-AUTOGENERATED-C-BAD-FUNCTION-DECLARATIONS */
#endif // OMITBAD
#ifdef __cplusplus
} // end extern "C"
#endif
#ifdef __cplusplus
// declare C++ namespaces and good and bad functions
#ifndef OMITGOOD
/* BEGIN-AUTOGENERATED-CPP-GOOD-FUNCTION-DECLARATIONS */
namespace CWE758_Undefined_Behavior__char_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__char_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__int_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__long_long_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__twoints_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_19 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_01 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_02 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_03 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_04 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_05 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_06 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_07 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_08 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_09 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_10 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_11 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_12 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_13 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_14 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_15 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_16 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_17 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_18 { void good();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_19 { void good();}
/* END-AUTOGENERATED-CPP-GOOD-FUNCTION-DECLARATIONS */
#endif // OMITGOOD
#ifndef OMITBAD
/* BEGIN-AUTOGENERATED-CPP-BAD-FUNCTION-DECLARATIONS */
namespace CWE758_Undefined_Behavior__char_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__char_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__char_pointer_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__double_pointer_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__int_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__int_pointer_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__long_long_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__twointsclass_pointer_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__twoints_pointer_new_use_19 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_01 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_02 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_03 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_04 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_05 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_06 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_07 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_08 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_09 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_10 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_11 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_12 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_13 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_14 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_15 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_16 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_17 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_18 { void bad();}
namespace CWE758_Undefined_Behavior__wchar_t_pointer_new_use_19 { void bad();}
/* END-AUTOGENERATED-CPP-BAD-FUNCTION-DECLARATIONS */
#endif // OMITBAD
#endif // __cplusplus
#endif // _TESTCASES_H
| 36.055163 | 97 | 0.848435 |
c212feaec972429b3df893f294de090d48c19fdc | 690 | h | C | Applications/Podcasts/MZUniversalPlaybackPositionDataSource.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 11 | 2019-11-06T04:48:48.000Z | 2022-02-09T17:48:15.000Z | Applications/Podcasts/MZUniversalPlaybackPositionDataSource.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 1 | 2020-04-16T01:41:56.000Z | 2020-04-16T04:32:00.000Z | Applications/Podcasts/MZUniversalPlaybackPositionDataSource.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 3 | 2019-12-22T20:17:53.000Z | 2021-01-25T09:47:49.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Tuesday, November 5, 2019 at 1:50:19 PM Mountain Standard Time
* Operating System: Version 13.0 (Build 17J586)
* Image Source: /Applications/Podcasts.app/Podcasts
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol MZUniversalPlaybackPositionDataSource <NSObject>
@required
-(void)performBlockAndWait:(/*^block*/id)arg1;
-(void)cancelUniversalPlaybackPositionTransaction:(id)arg1;
-(id)beginTransactionWithItemsToSyncEnumerationBlock:(/*^block*/id)arg1;
-(void)commitUniversalPlaybackPositionTransaction:(id)arg1 domainVersion:(id)arg2 metadataEnumerationBlock:(/*^block*/id)arg3;
@end
| 36.315789 | 126 | 0.792754 |
39a7b935ada16415a180ed25636da075042ac780 | 9,582 | h | C | Geometry/Geometry2D.h | COFS-UWA/MPM3D | 1a0c5dc4e92dff3855367846002336ca5a18d124 | [
"MIT"
] | null | null | null | Geometry/Geometry2D.h | COFS-UWA/MPM3D | 1a0c5dc4e92dff3855367846002336ca5a18d124 | [
"MIT"
] | 2 | 2020-10-19T02:03:11.000Z | 2021-03-19T16:34:39.000Z | Geometry/Geometry2D.h | COFS-UWA/MPM3D | 1a0c5dc4e92dff3855367846002336ca5a18d124 | [
"MIT"
] | 1 | 2020-04-28T00:33:14.000Z | 2020-04-28T00:33:14.000Z | #ifndef __Geometry_2D_h__
#define __Geometry_2D_h__
#include <cmath>
struct Point2D
{
union
{
struct { double x, y; };
double data[2];
};
inline Point2D() {}
inline Point2D(double _x, double _y) : x(_x), y(_y) {}
inline Point2D(const Point2D &other) : x(other.x), y(other.y) {}
};
struct Rect
{
double xl, xu, yl, yu;
inline Rect() {}
inline Rect(double _xl, double _xu, double _yl, double _yu) :
xl(_xl), xu(_xu), yl(_yl), yu(_yu) {}
inline Rect(const Rect& other) :
xl(other.xl), xu(other.xu), yl(other.yl), yu(other.yu) {}
inline bool is_in_box(double x, double y) const noexcept
{ return !(x < xl || x > xu || y < yl || y > yu); }
template <typename Point2D>
inline bool is_in_box(Point2D& point) const noexcept
{ return is_in_box(point.x, point.y); }
inline void envelop(const Rect& other) noexcept
{
if (xl > other.xl)
xl = other.xl;
if (xu < other.xu)
xu = other.xu;
if (yl > other.yl)
yl = other.yl;
if (yu < other.yu)
yu = other.yu;
}
inline void envelop(
const Rect &rect1,
const Rect &rect2
) noexcept
{
xl = rect1.xl < rect2.xl ? rect1.xl : rect2.xl;
xu = rect1.xu > rect2.xu ? rect1.xu : rect2.xu;
yl = rect1.yl < rect2.yl ? rect1.yl : rect2.yl;
yu = rect1.yu > rect2.yu ? rect1.yu : rect2.yu;
}
};
struct Vector2D
{
double x, y;
inline Vector2D() {}
inline Vector2D(double _x, double _y) : x(_x), y(_y) {}
inline Vector2D(const Vector2D &other) : x(other.x), y(other.y) {}
inline double norm() const noexcept { return sqrt(x*x + y*y); }
inline Vector2D &normalize() noexcept
{
double len = norm();
if (len != 0.0)
{
x /= len;
y /= len;
}
return *this;
}
inline Vector2D &reverse() noexcept
{ x = -x; y = -y; return *this; }
inline Vector2D &scale(double fac) noexcept
{ x *= fac; y *= fac; return *this; }
inline Vector2D& add(double e_x, double e_y) noexcept
{ x += e_x; y += e_y; return *this; }
inline Vector2D& add(double e1_x, double e1_y,
double e2_x, double e2_y) noexcept
{ x = e1_x + e2_x; y = e1_y + e2_y; return *this; }
inline Vector2D& substract(double e_x, double e_y) noexcept
{ x -= e_x; y -= e_y; return *this; }
inline Vector2D& substract(double e1_x, double e1_y,
double e2_x, double e2_y) noexcept
{ x = e1_x - e2_x; y = e1_y - e2_y; return *this; }
inline double dot(double e2_x, double e2_y) const noexcept
{ return x * e2_x + y * e2_y; }
template <typename Point2D>
inline Vector2D& add(Point2D& p) noexcept
{ x += p.x; y += p.y; return *this; }
template <typename Point2D>
inline Vector2D& add(Point2D& p1, Point2D& p2) noexcept
{ x = p1.x + p2.x; y = p1.y + p2.y; return *this; }
template <typename Point2D>
inline Vector2D& substract(Point2D& p) noexcept
{ x -= p.x; y -= p.y; return *this; }
template <typename Point2D>
inline Vector2D& substract(Point2D& p1, Point2D& p2) noexcept
{ x = p1.x - p2.x; y = p1.y - p2.y; return *this; }
template <typename Point2D>
inline double dot(Point2D& p2) const noexcept
{ return x * p2.x + y * p2.y; }
};
// distance between 2D points
template <typename Node2D, typename Point2D>
inline double cal_point2d_distance(const Node2D &p1, const Point2D &p2) noexcept
{
double dx = p1.x - p2.x;
double dy = p1.y - p2.y;
return sqrt(dx * dx + dy * dy);
}
// distance between rectangle and point
inline double cal_rect_point_distance(const Rect& rec, const Point2D& p) noexcept
{
double cx, cy, x_diff, y_diff;
cx = p.x < rec.xu ? p.x : rec.xu;
cx = rec.xl > cx ? rec.xl : cx;
cy = p.y < rec.yu ? p.y : rec.yu;
cy = rec.yl > cy ? rec.yl : cy;
x_diff = p.x - cx;
y_diff = p.y - cy;
return sqrt(x_diff * x_diff + y_diff * y_diff);
}
inline bool detect_rect_collision(const Rect &c1, const Rect &c2) noexcept
{
return !(c1.xu < c2.xl || c1.xl > c2.xu ||
c1.yu < c2.yl || c1.yl > c2.yu);
}
struct OBB2D
{
double xo, yo;
double xlen, ylen;
Vector2D ix, iy;
};
struct OBB2DAABBCollisionSAT
{
double xhlen, yhlen;
Vector2D ix, iy;
double ix_min, ix_max;
double iy_min, iy_max;
double it1x_min, it1x_max;
double it1y_min, it1y_max;
double it2x_min, it2x_max;
double it2y_min, it2y_max;
inline void init_obb2d(const OBB2D& obb) noexcept
{
xhlen = obb.xlen * 0.5;
yhlen = obb.ylen * 0.5;
ix = obb.ix;
iy = obb.iy;
double cen;
// ix
cen = ix.x * obb.xo + ix.y * obb.yo;
ix_min = cen - xhlen;
ix_max = cen + xhlen;
// iy
cen = iy.x * obb.xo + iy.y * obb.yo;
iy_min = cen - yhlen;
iy_max = cen + yhlen;
}
inline bool detect_collision_with_rect(const Rect& rect) const noexcept
{
double rect_xm = (rect.xl + rect.xu) * 0.5;
double rect_ym = (rect.yl + rect.yu) * 0.5;
double rect_xhlen = (rect.xu - rect.xl) * 0.5;
double rect_yhlen = (rect.yu - rect.yl) * 0.5;
double ix_rect_cen = ix.x * rect_xm + ix.y * rect_ym;
double ix_rect_range = abs(ix.x * rect_xhlen) + abs(ix.y * rect_yhlen);
double iy_rect_cen = iy.x * rect_xm + iy.y * rect_ym;
double iy_rect_range = abs(iy.x * rect_xhlen) + abs(iy.y * rect_yhlen);
return !(is_seperating_axis(ix_rect_range, ix_rect_cen, ix_min, ix_max) ||
is_seperating_axis(iy_rect_range, iy_rect_cen, iy_min, iy_max));
}
protected:
inline bool is_seperating_axis(
double rect_range,
double rect_cen,
double obb_min,
double obb_max
) const noexcept
{
return ((obb_min - rect_cen) > rect_range ||
(obb_max + rect_cen) < -rect_range);
}
};
inline bool detect_obb2d_cube_collision(
const OBB2D &obb,
const Rect &rect
) noexcept
{
double rect_xl = rect.xl - obb.xo;
double rect_xu = rect.xu - obb.xo;
double rect_yl = rect.yl - obb.yo;
double rect_yu = rect.yu - obb.yo;
double obb_hxlen = obb.xlen * 0.5;
double obb_hylen = obb.ylen * 0.5;
double tmp1, tmp2, proj_min, proj_max;
// ix as seperating axis
const Vector2D &obb_ix = obb.ix;
tmp1 = rect_xl * obb_ix.x;
tmp2 = rect_xu * obb_ix.x;
if (tmp1 > tmp2)
{
proj_max = tmp1;
proj_min = tmp2;
}
else
{
proj_max = tmp2;
proj_min = tmp1;
}
tmp1 = rect_yl * obb_ix.y;
tmp2 = rect_yu * obb_ix.y;
if (tmp1 > tmp2)
{
proj_max += tmp1;
proj_min += tmp2;
}
else
{
proj_max += tmp2;
proj_min += tmp1;
}
// whether ix is the seperating axis
if (proj_max < -obb_hxlen || proj_min > obb_hxlen)
return false;
// iy as seperating axis
const Vector2D& obb_iy = obb.iy;
tmp1 = rect_xl * obb_iy.x;
tmp2 = rect_xu * obb_iy.x;
if (tmp1 > tmp2)
{
proj_max = tmp1;
proj_min = tmp2;
}
else
{
proj_max = tmp2;
proj_min = tmp1;
}
tmp1 = rect_yl * obb_iy.y;
tmp2 = rect_yu * obb_iy.y;
if (tmp1 > tmp2)
{
proj_max += tmp1;
proj_min += tmp2;
}
else
{
proj_max += tmp2;
proj_min += tmp1;
}
// whether iy is the seperating axis
if (proj_max < -obb_hylen || proj_min > obb_hylen)
return false;
return true;
}
template <typename Point2DType1, typename Point2DType2>
inline void point_from_global_to_local_coordinate(
const Point2D &loc_cen,
const Vector2D &loc_ix,
const Vector2D &loc_iy,
const Point2DType1& gp,
Point2DType2& lp
) noexcept
{
double dx = gp.x - loc_cen.x;
double dy = gp.y - loc_cen.y;
lp.x = loc_ix.x * dx + loc_ix.y * dy;
lp.y = loc_iy.x * dx + loc_iy.y * dy;
}
template <typename Point2DType1, typename Point2DType2>
inline void point_from_local_to_global_coordinate(
const Point2D& loc_cen,
const Vector2D& loc_ix,
const Vector2D& loc_iy,
const Point2DType1& lp,
Point2DType2& gp
) noexcept
{
gp.x = loc_ix.x * lp.x + loc_iy.x * lp.y + loc_cen.x;
gp.y = loc_ix.y * lp.x + loc_iy.y * lp.y + loc_cen.y;
}
template <typename Vector2DType1, typename Vector2DType2>
inline void vector_from_global_to_local_coordinate(
const Vector2D& loc_ix,
const Vector2D& loc_iy,
const Vector2DType1& gp,
Vector2DType2& lp
) noexcept
{
lp.x = loc_ix.x * gp.x + loc_ix.y * gp.y;
lp.y = loc_iy.x * gp.x + loc_iy.y * gp.y;
}
template <typename Vector2DType1, typename Vector2DType2>
inline void vector_from_local_to_global_coordinate(
const Vector2D& loc_ix,
const Vector2D& loc_iy,
const Vector2DType1& lp,
Vector2DType2& gp
) noexcept
{
gp.x = loc_ix.x * lp.x + loc_iy.x * lp.y;
gp.y = loc_ix.y * lp.x + loc_iy.y * lp.y;
}
template <typename Point2DType1, typename Point2DType2>
inline void point_from_global_to_local_coordinate(
const Point2D& loc_cen,
const double angle,
const Point2DType1& gp,
Point2DType2& lp
) noexcept
{
double dx = gp.x - loc_cen.x;
double dy = gp.y - loc_cen.y;
double sin_ang = sin(angle);
double cos_ang = cos(angle);
lp.x = cos_ang * dx + sin_ang * dy;
lp.y = -sin_ang * dx + cos_ang * dy;
}
template <typename Point2DType1, typename Point2DType2>
inline void point_from_local_to_global_coordinate(
const Point2D& loc_cen,
const double angle,
const Point2DType1& lp,
Point2DType2& gp
) noexcept
{
double sin_ang = sin(angle);
double cos_ang = cos(angle);
gp.x = cos_ang * lp.x - sin_ang * lp.y + loc_cen.x;
gp.y = sin_ang * lp.x + cos_ang * lp.y + loc_cen.y;
}
template <typename Vector2DType1, typename Vector2DType2>
inline void vector_from_global_to_local_coordinate(
const double angle,
const Vector2DType1& gp,
Vector2DType2& lp
) noexcept
{
double sin_ang = sin(angle);
double cos_ang = cos(angle);
lp.x = cos_ang * gp.x + sin_ang * gp.y;
lp.y = -sin_ang * gp.x + cos_ang * gp.y;
}
template <typename Vector2DType1, typename Vector2DType2>
inline void vector_from_local_to_global_coordinate(
const double angle,
const Vector2DType1& lp,
Vector2DType2& gp
) noexcept
{
double sin_ang = sin(angle);
double cos_ang = cos(angle);
gp.x = cos_ang * lp.x - sin_ang * lp.y;
gp.y = sin_ang * lp.x + cos_ang * lp.y;
}
#endif | 24.888312 | 81 | 0.668128 |
7f18376d82a2ef90b7dfa1d632229b0fdd36e153 | 17,018 | c | C | src/dsl-var.c | RandomContributions/soloscuro | 75fb4967d5317d66551866484822a8f383663a9a | [
"MIT"
] | null | null | null | src/dsl-var.c | RandomContributions/soloscuro | 75fb4967d5317d66551866484822a8f383663a9a | [
"MIT"
] | null | null | null | src/dsl-var.c | RandomContributions/soloscuro | 75fb4967d5317d66551866484822a8f383663a9a | [
"MIT"
] | null | null | null | #include "ds-string.h"
#include "dsl-var.h"
#include <string.h>
/* externals first */
uint16_t this_gpl_file = 0;
uint16_t this_gpl_type = 0;
/* Now static to file... */
static uint8_t dsl_global_flags[DSL_GFLAGVAR_SIZE];
static uint8_t dsl_local_flags[DSL_LFLAGVAR_SIZE];
static int32_t accum; //, number;
static unsigned char* dsl_data;
static unsigned char* dsl_data_start;
static int16_t *dsl_global_nums = 0;
static int16_t *dsl_local_nums = 0;
static int32_t *dsl_global_bnums = 0;
static int32_t *dsl_local_bnums = 0;
static dsl_control_t control_table[MAX_OBJECT_PATH];
static check_index_t gunused_checks;
static dsl_check_t *check;
lua_State *lua_state = NULL;
// For Debugging
const char* debug_index_names[] = {
"UNSUED CHECK",
"TALK CHECK",
"ATTACK CHECK",
"POV CHECK",
"PICKUP CHECK",
"OTHER CHECK",
"OTHER1 CHECK",
"MOVE TILE CHECK",
"LOOK CHECK",
"USE CHECK",
"USE WITH CHECK",
"MOVE BOX CHECK",
};
static dsl_check_t checks[MAX_CHECK_TYPES][MAX_DSL_CHECKS];
static int checks_pos[MAX_CHECK_TYPES];
static name_t new_name;
static name2_t new_name2;
typedef struct _dsl_state_t {
unsigned char *dsl_data_start;
unsigned char *dsl_data;
} dsl_state_t;
int32_t gBignum;
int32_t *gBignumptr;
#define MAX_DSL_STATES (100)
static int dsl_state_pos = -1;
static dsl_state_t states[MAX_DSL_STATES];
/* All those commands... */
void global_addr_name(param_t *par) {
new_name.addr = par->val[0];
new_name.file = par->val[1];
new_name.name = par->val[2];
new_name.global = 0;
if (this_gpl_file == GLOBAL_MAS) {
if (this_gpl_type == MASFILE) {
new_name.global = 1;
}
}
}
void name_name_global_addr(param_t *par) {
new_name2.name1 = par->val[0];
new_name2.name2 = par->val[1];
new_name2.addr = par->val[2];
new_name2.file = par->val[3];
new_name2.global = 0;
if (this_gpl_file == GLOBAL_MAS) {
if (this_gpl_type == MASFILE) {
//printf("GLOBAL!!!!!!!!!!!!!\n");
new_name2.global = 1;
}
}
}
static char buf[1024];
static const char* get_so_name(so_object_t *so) {
disk_object_t dobj;
switch(so->type) {
case SO_DS1_COMBAT:
return so->data.ds1_combat.name;
break;
case SO_DS1_ITEM:
gff_read_object(so->data.ds1_item.id, &dobj);
//dobj = gff_get_object(so->data.ds1_item.name_index);
//sprintf(buf, "item (index = %d, bmp_id = %d)", so->data.ds1_item.name_index, dobj->bmp_id);
sprintf(buf, "item (id = %d, bmp_id = %d, script_id = %d)", so->data.ds1_item.id, dobj.bmp_id,
dobj.script_id);
//return "<ITEM-need to implement>";
return buf;
break;
}
return "UNKNOWN";
}
static void print_name_check(int check_index) {
debug("new_name.name = %d\n", new_name.name);
so_object_t *so = gff_object_inspect(OBJEX_GFF_INDEX, abs(new_name.name));
debug("When I %s to '%s' (%d) goto file: %d, addr: %d, global = %d\n",
debug_index_names[check_index], get_so_name(so), new_name.name,
new_name.file, new_name.addr, new_name.global);
free(so);
}
void generic_name_check(int check_index) {
int cpos = checks_pos[check_index]; // Where in the list we are.
if (cpos > MAX_DSL_CHECKS) {
fprintf(stderr, "FATAL ERROR: Max checks reached! ci = %d\n", check_index);
exit(1);
}
checks[check_index][cpos].data.name_check = new_name;
checks[check_index][cpos].next = cpos + 1;
checks[check_index][cpos].type = check_index;
print_name_check(check_index);
checks_pos[check_index]++;
}
void print_all_checks() {
box_t box;
tile_t tile;
name_t name;
name2_t name2;
for (int i = 0; i < MAX_CHECK_TYPES; i++) {
for (int j = 0; j < checks_pos[i]; j++) {
box = checks[i][j].data.box_check;
tile = checks[i][j].data.tile_check;
name = checks[i][j].data.name_check;
name2 = checks[i][j].data.name2_check;
switch(i) {
case UNUSED_CHECK_INDEX:
debug("check['%s'] =\n", debug_index_names[i]);
break;
case TALK_TO_CHECK_INDEX:
debug("check['%s']: talk to %d call %d:%d (global = %d)\n",
debug_index_names[i], name.name, name.file, name.addr, name.global);
break;
case ATTACK_CHECK_INDEX:
debug("check['%s']: attacks %d call %d:%d (global = %d)\n",
debug_index_names[i], name.name, name.file, name.addr, name.global);
break;
case POV_CHECK_INDEX:
debug("check['%s'] =\n", debug_index_names[i]);
break;
case PICKUP_CHECK_INDEX:
debug("check['%s'] =\n", debug_index_names[i]);
break;
case OTHER_CHECK_INDEX:
debug("check['%s'] =\n", debug_index_names[i]);
break;
case OTHER1_CHECK_INDEX:
debug("check['%s'] =\n", debug_index_names[i]);
break;
case MOVE_TILE_CHECK_INDEX:
debug("check['%s']: when I move to (%d, %d) call %d:%d (pc-only = %d) \n",
debug_index_names[i], tile.x, tile.y, tile.file, tile.addr, tile.trip);
break;
case LOOK_CHECK_INDEX:
debug("check['%s']: look at %d call %d:%d (global = %d)\n",
debug_index_names[i], name.name, name.file, name.addr, name.global);
break;
case USE_CHECK_INDEX:
debug("check['%s']: use %d call %d:%d (global = %d)\n",
debug_index_names[i], name.name, name.file, name.addr, name.global);
break;
case USE_WITH_CHECK_INDEX:
debug("check['%s']: use %d on %d call %d:%d (global = %d)\n",
debug_index_names[i], name2.name2, name2.name1, name2.file, name2.addr, name2.global);
break;
case MOVE_BOX_CHECK_INDEX:
debug("check['%s']: when I move to within (%d, %d) -> (%d, %d) call %d:%d (pc-only = %d) \n",
debug_index_names[i], box.x, box.y, box.x + box.xd,
box.y + box.yd, box.file, box.addr, box.trip);
break;
}
/*
typedef struct dsl_check_s {
union {
box_t box_check;
tile_t tile_check;
name_t name_check;
name2_t name2_check;
} data;
uint8_t type;
uint16_t next;
} dsl_check_t;
*/
}
}
}
#define DSL_CHECKS (200)
void dsl_init_vars() {
memset(dsl_global_flags, 0x00, DSL_GFLAGVAR_SIZE);
memset(dsl_local_flags, 0x00, DSL_LFLAGVAR_SIZE);
dsl_global_bnums = malloc(DSL_GBIGNUMVAR_SIZE * sizeof(int32_t));
memset(dsl_global_bnums, 0x00, DSL_GBIGNUMVAR_SIZE * sizeof(int32_t));
dsl_global_nums = malloc(DSL_GNUMVAR_SIZE);
memset(dsl_global_nums, 0x00, DSL_GNUMVAR_SIZE);
dsl_local_bnums = malloc(DSL_LBIGNUMVAR_SIZE * sizeof(int32_t));
memset(dsl_local_bnums, 0x00, DSL_LBIGNUMVAR_SIZE * sizeof(int32_t));
dsl_local_nums = malloc(DSL_LNUMVAR_SIZE);
memset(dsl_local_nums, 0x00, DSL_LNUMVAR_SIZE);
memset(checks, 0x00, sizeof(dsl_check_t) * MAX_CHECK_TYPES * MAX_DSL_CHECKS);
memset(checks_pos, 0x00, sizeof(int) * MAX_CHECK_TYPES);
memset(control_table, 0x00, sizeof(dsl_control_t) * MAX_OBJECT_PATH);
gunused_checks = 0;
check = (dsl_check_t*) malloc(sizeof(dsl_check_t) * DSL_CHECKS);
memset(check, 0x0, sizeof(dsl_check_t) * DSL_CHECKS);
for (int i = 0; i < DSL_CHECKS; i++) {
check[i].next = i + 1;
}
check[DSL_CHECKS - 1].next = NULL_CHECK;
}
void dsl_cleanup_vars() {
free(dsl_global_bnums);
free(dsl_global_nums);
free(dsl_local_bnums);
free(dsl_local_nums);
free(check);
}
void set_data_ptr(unsigned char *start, unsigned char *cpos) {
dsl_data_start = start;
dsl_data = cpos;
}
void set_accumulator(int32_t a) {
accum = a;
//printf("accum = %d\n", accum);
}
int32_t get_accumulator() {
return accum;
}
unsigned char* get_data_start_ptr() {
return dsl_data_start;
}
unsigned char* get_data_ptr() {
return dsl_data;
}
void push_data_ptr(unsigned char *data) {
// The first one isn't pushed on the stack.
if (dsl_state_pos < 0) {
dsl_state_pos = 0;
return;
}
states[dsl_state_pos].dsl_data_start = dsl_data_start;
states[dsl_state_pos].dsl_data = dsl_data;
dsl_state_pos++;
dsl_data_start = data;
debug("pushing %p: %p\n", dsl_data_start, dsl_data);
}
void clear_local_vars() {
//memset(dsl_global_flags, 0x0, DSL_GFLAGVAR_SIZE);
}
unsigned char* pop_data_ptr() {
dsl_state_pos--;
if (dsl_state_pos < 0) {
return NULL;
}
dsl_data_start = states[dsl_state_pos].dsl_data_start;
dsl_data = states[dsl_state_pos].dsl_data;
debug("pop %p: %p\n", dsl_data_start, dsl_data);
return states[dsl_state_pos].dsl_data_start;
}
uint8_t get_byte() {
uint8_t answer = (uint8_t) *dsl_data;
dsl_data++;
return answer;
}
static uint16_t get_word() {
uint16_t ret;
ret = get_byte() * 0x100;
ret += get_byte();
return ret;
}
uint8_t peek_one_byte() {
return *dsl_data;
}
uint16_t peek_half_word() {
uint16_t ret;
ret = (*dsl_data) *0x100;
ret += *(dsl_data + 1);
return ret;
}
uint16_t get_half_word() {
uint16_t ret = get_byte() * 0x100;
ret += get_byte();
return ret;
}
uint8_t preview_byte(uint8_t offset) {
return *(dsl_data + offset);
}
static uint8_t access_complex(int16_t *header, uint16_t *depth, uint16_t *element) {
uint16_t i;
int32_t obj_name;
obj_name = get_word();
debug("header = %d, depth = %d, element = %d, obj_name = %d\n", *header, *depth, *element, obj_name);
if (obj_name < 0x8000) {
debug("access_complex: I need to convert from ID to header!\n");
} else {
debug("access_complex: I need to set the *head to the correct view\n");
switch (obj_name & 0x7FFF) {
case 0x25: // POV
case 0x26: // ACTIVE
case 0x27: // PASSIVE
case 0x28: // OTHER
case 0x2C: // OTHER1
case 0x2B: // THING
debug("access_complex:valid obj_name(%d), need to set header (but can't yet...)\n", obj_name & 0x7FFF);
break;
default:
return 0;
}
}
*depth = get_byte();
debug("depth = %d\n", *depth);
for (i = 1; i <= *depth; i++) {
element[i-1] = get_byte();
debug("element[%d] = %d\n", i-1, element[i-1]);
}
return 1;
}
/*
static int32_t read_complex(void) {
int32_t ret = 0;
uint16_t depth = 0;
int16_t header = 0;
uint16_t element[MAX_SEARCH_STACK];
memset(element, 0x0, sizeof(uint16_t) * MAX_SEARCH_STACK);
if (access_complex(&header, &depth, element) == 1) {
debug("reading header (%d) at depth (%d)\n", header, depth);
ret = get_complex_data(header, depth, element);
return ret;
} else {
printf("read_complex: else not implemented!\n");
command_implemented = 0;
}
return ret;
}
*/
void setrecord() {
uint16_t depth = 0;
int16_t header = 0;
uint16_t element[MAX_SEARCH_STACK];
uint16_t tmp = peek_half_word();
if (tmp > 0x8000) {
access_complex(&header, &depth, element);
//accum = read_number();
//smart_write_data(header, depth, element, accum);
return;
}
if (tmp == 0) {
printf("dsl_setrecord: need to implement party...\n");
command_implemented = 0;
return;
}
if (tmp < 0x8000) {
access_complex(&header, &depth, element);
//set_accumulator(read_number());
printf("I need to write depth/element/accum to list of headers!\n");
return;
}
}
void set_any_order(name_t *name, int16_t to, int16_t los_order, int16_t range) {
warn("set_any_order: lua callback needed: Get all objects with 'name' and set then to to with los_order and in range\n");
warn("then set the order!");
/*
foreach obj_index, where object's name = pName->name
control_table[obj_index].addr[to] = name->addr;
control_table[obj_index].file[to] = file->addr;
if (to == DSL_LOS_ORDER) {
control_table[obj_index].command[to] = losOrder;
control_table[obj_index].flags &= CF_MOVED;
control_table[obj_index].flags |= range;
}
*/
}
/*
static check_index_t get_check_node() {
check_index_t node_index;
if (gunused_checks == NULL_CHECK) {
return NULL_CHECK;
}
node_index = gunused_checks;
gunused_checks = check[node_index].next;
check[node_index].next = NULL_CHECK;
return node_index;
}
static void insert_check(check_index_t *cindex) {
check_index_t new_head, old_head;
if (*cindex == NULL_CHECK) {
*cindex = get_check_node();
return;
}
old_head = *cindex;
new_head = get_check_node();
if (new_head == NULL_CHECK) {
return;
}
check[new_head].next = old_head;
*cindex = new_head;
}
*/
void use_with_check() {
name2_t name = new_name2;
int check_index = USE_WITH_CHECK_INDEX;
int cpos = checks_pos[check_index]; // Where in the list we are.
if (cpos > MAX_DSL_CHECKS) {
fprintf(stderr, "FATAL ERROR: Max checks reached! ci = %d\n", check_index);
exit(1);
}
checks[check_index][cpos].data.name2_check = name;
checks[check_index][cpos].next = cpos + 1;
checks[check_index][cpos].type = check_index;
//print_name_check(check_index);
checks_pos[check_index]++;
debug("insert with check = {file = %d, addr = %d, name1 = %d, name2 = %d, is_global = %d}\n",
name.file, name.addr, name.name1,
name.name2, name.global);
}
void generic_box_check(int check_index, box_t box) {
int cpos = checks_pos[check_index]; // Where in the list we are.
if (cpos > MAX_DSL_CHECKS) {
fprintf(stderr, "FATAL ERROR: Max checks reached! ci = %d\n", check_index);
exit(1);
}
checks[check_index][cpos].data.box_check = box;
checks[check_index][cpos].next = cpos + 1;
checks[check_index][cpos].type = check_index;
//print_name_check(check_index);
checks_pos[check_index]++;
debug("tile with check = {file = %d, addr = %d, x = %d, y = %d, xd = %d, yd = %d, trip = %d}\n",
box.file, box.addr, box.x, box.xd, box.yd,
box.y, box.trip);
}
void generic_tile_check(int check_index, tile_t tile) {
int cpos = checks_pos[check_index]; // Where in the list we are.
if (cpos > MAX_DSL_CHECKS) {
fprintf(stderr, "FATAL ERROR: Max checks reached! ci = %d\n", check_index);
exit(1);
}
checks[check_index][cpos].data.tile_check = tile;
checks[check_index][cpos].next = cpos + 1;
checks[check_index][cpos].type = check_index;
//print_name_check(check_index);
checks_pos[check_index]++;
debug("tile with check = {file = %d, addr = %d, x = %d, y = %d, trip = %d}\n",
tile.file, tile.addr, tile.x,
tile.y, tile.trip);
}
static void add_save_orders(int16_t los_order, name_t name, int16_t range, int ordertype) {
if (name.name < 0) {
warn("*******************add_save_orders (with name < 0) not implemented****************\n");
warn("addr = %d, file = %d, name = %d, global = %d\n", name.addr, name.file, name.name, name.global);
//command_implemented = 0;
}
}
#define DSL_ORDER (0)
#define DSL_LOS_ORDER (1)
void set_los_order(int16_t los_order, int16_t range) {
warn("LOS Check ignored: addr = %d, file = %d, name = %d, global = %d\n", new_name.addr,
new_name.file, new_name.name, new_name.global);
add_save_orders(los_order, new_name, range, DSL_LOS_ORDER);
set_any_order(&new_name, DSL_LOS_ORDER, los_order, range);
}
// Uses global new_name!
void set_new_order() {
warn("new_name->{addr = %d, file = %d, name = %d, global = %d}\n", new_name.addr, new_name.file, new_name.name,
new_name.global);
if (!new_name.file) {
if (new_name.name < 0) {
error("set_new_order name < 0 not implemented!\n");
command_implemented = 0;
}
} else {
add_save_orders(0, new_name, 0, DSL_ORDER);
}
set_any_order(&new_name, DSL_ORDER, 0, 0);
}
void print_vars(int what) {
printf("--------------------------------------print vars------------------\n");
if (what == 0) {
for (int i = 0; i < DSL_LFLAGVAR_SIZE; i++) {
printf("%x, ", dsl_local_flags[i]);
}
printf("\n");
}
}
| 31.168498 | 125 | 0.597426 |
c354735166df2d2bba16eaab38ebc58e699f55ca | 1,068 | h | C | src/lib/include/uart.h | ybl33/osc2022 | 75b63c201f0ac655369cca346dfa3f8af42c4542 | [
"MIT"
] | 4 | 2022-02-23T06:48:38.000Z | 2022-03-31T09:59:20.000Z | src/lib/include/uart.h | ybl33/osc2022 | 75b63c201f0ac655369cca346dfa3f8af42c4542 | [
"MIT"
] | null | null | null | src/lib/include/uart.h | ybl33/osc2022 | 75b63c201f0ac655369cca346dfa3f8af42c4542 | [
"MIT"
] | null | null | null | #ifndef __UART__H__
#define __UART__H__
#include "stddef.h"
#include "gpio.h"
#include "aux.h"
#include "exception.h"
#define AUX_MU_LSR_TRANS_EMPTY (1 << 5)
#define AUX_MU_LSR_DATA_READY (1)
void uart_init();
bool uart_rx_valid();
bool uart_tx_ready();
void uart_flush();
char uart_get();
char uart_getc();
void uart_put(char c);
void uart_puth(unsigned int d);
void uart_putu(unsigned int d);
void uart_puts(char *s);
/* Asynchronous Read and Write */
#define READ_BUF_SIZE (1024)
#define WRITE_BUF_SIZE (1024)
extern char read_buffer[READ_BUF_SIZE];
extern char write_buffer[WRITE_BUF_SIZE];
// TO DO : maybe need to handle buffer overflow
extern unsigned int read_head;
extern unsigned int write_head;
extern unsigned int read_tail;
extern unsigned int write_tail;
void asyn_uart_init();
void set_uart_rx_int(bool enable);
void set_uart_tx_int(bool enable);
char asyn_uart_get();
char asyn_uart_getc();
void asyn_uart_put(char c);
void asyn_uart_puth(unsigned int d);
void asyn_uart_putu(unsigned int d);
void asyn_uart_puts(char *s);
#endif | 24.837209 | 47 | 0.76779 |
f9a9a1ee759c0377cb1b32fdb619fbcea0a6975e | 2,284 | c | C | TadList/list.c | Alespitale/TADs | e872dd140151d0d562c99038ab728d57db889958 | [
"MIT"
] | null | null | null | TadList/list.c | Alespitale/TADs | e872dd140151d0d562c99038ab728d57db889958 | [
"MIT"
] | null | null | null | TadList/list.c | Alespitale/TADs | e872dd140151d0d562c99038ab728d57db889958 | [
"MIT"
] | null | null | null | #include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "list.h"
struct node{
type_elem elem;
list next;
};
list empty(){
list l;
l= NULL;
return l;
}
list addl(type_elem e, list l){
list p = calloc(1, sizeof(list));
p -> elem = e;
p -> next = l;
l = p;
return l;
}
void destroy(list l){
list p;
while(l != NULL){
p=l;
l= l -> next;
free(p);
}
}
bool is_empty(list l){
bool b;
b=(l == NULL);
return b;
}
type_elem head(list l){
assert(!is_empty(l));
type_elem e;
e = l-> elem;
return e;
}
list tail(list l){
assert(!is_empty(l));
list p;
p=l;
l= l-> next;
free(p);
return l;
}
list addr(list l, type_elem e){
list p;
list q = calloc(1, sizeof(list));
q -> elem = e;
q -> next = NULL;
if(!(is_empty(l))){
p=l;
while(p -> next != NULL){
p= p -> next;
}
p -> next = q;
}else{
l=q;
}
return l;
}
unsigned int length(list l){
list p=l;
unsigned int n=0;
while(p != NULL){
n= n+1;
p= p -> next;
}
return n;
}
list concat(list l, list l0){
while(length(l0)!=0){
l= addr(l, l0 -> elem);
l0= tail(l0);
}
return l;
}
type_elem index(list l, unsigned int n){
assert(!(is_empty(l)));
type_elem e;
list p=l;
unsigned int aux=0;
while (aux < n){
p= p -> next;
aux= aux+1;
}
e= p -> elem;
return e;
}
list take(list l, unsigned int n){
assert(!(is_empty(l)));
assert(length(l)>=n);
list q,z;
list p=l;
unsigned int aux=0;
while(aux != (n-1)){
p= p -> next;
aux= aux +1;
}
q= p -> next;
p -> next = NULL;
while(q != NULL){
z=q;
q= q -> next;
free(z);
}
free(q);
return l;
}
list drop(list l, unsigned int n){
assert(!(is_empty(l)));
assert(length(l)>=n);
unsigned int aux=0;
while(aux != n){
l= tail(l);
aux= aux+1;
}
return l;
}
list copy_list(list l){
list l0;
l0=empty();
list p=l;
while(p != NULL){
l0=addr(l0, p -> elem);
p= p -> next;
}
return l0;
}
| 15.432432 | 40 | 0.465412 |
bfaab3047d9fd6934cb5c4310ca6f56dc166ec57 | 5,562 | h | C | admin/wmi/wbem/providers/snmpprovider/common/sclcomm/include/timer.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | admin/wmi/wbem/providers/snmpprovider/common/sclcomm/include/timer.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | admin/wmi/wbem/providers/snmpprovider/common/sclcomm/include/timer.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
/*--------------------------------------------------
Filename: timer.hpp
Author: B.Rajeev
Purpose: Provides declarations for the Timer class.
--------------------------------------------------*/
#ifndef __TIMER__
#define __TIMER__
#define ILLEGAL_TIMER_EVENT_ID 0
#define RETRY_TIMEOUT_FACTOR 10
typedef UINT_PTR TimerEventId;
#include <snmpevt.h>
#include <snmpthrd.h>
#include "forward.h"
#include "common.h"
#include "message.h"
typedef CMap< TimerEventId, TimerEventId, Timer *, Timer * > TimerMapping;
typedef CList< WaitingMessage * , WaitingMessage * > WaitingMessageContainer;
class SnmpClThreadObject : public SnmpThreadObject
{
private:
protected:
public:
SnmpClThreadObject () ;
void Initialise () ;
void Uninitialise () ;
} ;
class SnmpClTrapThreadObject : public SnmpThreadObject
{
private:
protected:
public:
SnmpClTrapThreadObject () ;
void Initialise () ;
void Uninitialise () ;
} ;
/*--------------------------------------------------
Overview
--------
Timer: Provides methods for setting and cancelling timer
events. When the timer is informed of a timer event, it determines
the corresponding waiting message and notifies it.
note - the timer has static data structures which enable it
to identify the timer instance corresponding to a timer event id.
therefore, each timer event must not only be registered as a
<timer_event_id, waiting_message *> pair within a timer instance, but
also as a <timer_event_id, timer *> pair in the static CMap. The CriticalSection
is needed to serialize access to the CMap
--------------------------------------------------*/
class Timer
{
// counter to generate timer_event_id
static TimerEventId next_timer_event_id;
// v1 session: for obtaining the event handler
SnmpImpSession *session;
// map for (event_id, waiting_message) association and
// unique event_id generation
static TimerMapping timer_mapping;
WaitingMessageContainer waiting_message_mapping;
static BOOL CreateCriticalSection();
static void DestroyCriticalSection();
public:
Timer(SnmpImpSession &session);
// generates and returns a new event id
// associates the pair (event_id, waiting_message)
// creates the timer event
void SetMessageTimerEvent (WaitingMessage &waiting_message);
TimerEventId SetTimerEvent(UINT timeout_value);
// Removes the association (event_id, waiting_message)
void CancelMessageTimer(WaitingMessage &waiting_message,TimerEventId event_id);
// Kills the registered timer event
void CancelTimer(TimerEventId event_id);
// used to create the static CriticalSection
static BOOL InitializeStaticComponents();
// used to destroy the static CriticalSection
static void DestroyStaticComponents();
// it determines the corresponding Timer and calls
// its TimerEventNotification with the appropriate parameters
static void CALLBACK HandleGlobalEvent(HWND hWnd ,UINT message,
UINT_PTR idEvent, DWORD dwTime);
// informs the timer instance of the event. the instance
// must pass the event to the corresponding waiting message
void TimerEventNotification(TimerEventId event_id);
virtual ~Timer(void);
static SnmpClThreadObject *g_timerThread ;
static UINT g_SnmpWmTimer ;
// the CriticalSection serializes accesses to the static timer_mapping
static CriticalSection timer_CriticalSection;
};
class SnmpTimerObject
{
private:
HWND hWnd ;
UINT_PTR timerId ;
TIMERPROC lpTimerFunc ;
protected:
public:
SnmpTimerObject (
HWND hWnd ,
UINT_PTR timerId ,
UINT elapsedTime ,
TIMERPROC lpTimerFunc
) ;
~SnmpTimerObject () ;
UINT_PTR GetTimerId () { return timerId ; }
HWND GetHWnd () { return hWnd ; }
TIMERPROC GetTimerFunc () { return lpTimerFunc ; }
static Window *window ;
static CMap <UINT_PTR,UINT_PTR,SnmpTimerObject *,SnmpTimerObject *> timerMap ;
static void TimerNotification ( HWND hWnd , UINT timerId ) ;
} ;
class SnmpTimerEventObject : public SnmpTaskObject
{
private:
protected:
SnmpTimerEventObject () {}
public:
virtual ~SnmpTimerEventObject () {} ;
} ;
class SnmpSetTimerObject : public SnmpTimerEventObject
{
private:
UINT_PTR timerId ;
HWND hWnd ;
UINT elapsedTime ;
TIMERPROC lpTimerFunc ;
protected:
public:
SnmpSetTimerObject (
HWND hWnd, // handle of window for timer messages
UINT_PTR nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
) ;
~SnmpSetTimerObject () ;
UINT_PTR GetTimerId () { return timerId ; }
void Process () ;
} ;
class SnmpKillTimerObject : public SnmpTimerEventObject
{
private:
BOOL status ;
HWND hWnd ;
UINT_PTR timerId ;
protected:
public:
SnmpKillTimerObject (
HWND hWnd , // handle of window that installed timer
UINT_PTR uIDEvent // timer identifier
) ;
~SnmpKillTimerObject () {} ;
void Process () ;
BOOL GetStatus () { return status ; }
} ;
UINT_PTR SnmpSetTimer (
HWND hWnd, // handle of window for timer messages
UINT_PTR nIDEvent, // timer identifier
UINT uElapse, // time-out value,
TIMERPROC lpTimerFunc // address of timer procedure
) ;
BOOL SnmpKillTimer (
HWND hWnd, // handle of window that installed timer
UINT_PTR uIDEvent // timer identifier
) ;
#endif // __TIMER__
| 23.468354 | 83 | 0.692736 |
7b97888f1caaee4698df7ac139a6a4d695900905 | 471 | h | C | src/machine/namco05.h | ascottix/tickle | de3b7df8a6e719b7682398ac689a7e439b40876f | [
"MIT"
] | 1 | 2021-05-31T21:09:50.000Z | 2021-05-31T21:09:50.000Z | src/machine/namco05.h | ascottix/tickle | de3b7df8a6e719b7682398ac689a7e439b40876f | [
"MIT"
] | null | null | null | src/machine/namco05.h | ascottix/tickle | de3b7df8a6e719b7682398ac689a7e439b40876f | [
"MIT"
] | null | null | null | /*
Namco 05xx (starfield generator) custom chip emulator
Copyright (c) 2011 Alessandro Scotti
*/
#ifndef NAMCO_05XX_
#define NAMCO_05XX_
#include <emu/emu_bitmap.h>
struct Namco05xx {
unsigned char state_;
int scroll_x_;
int scroll_y_;
Namco05xx();
void reset();
void writeRegister( unsigned index, unsigned char value );
void update();
void render( TBitmapIndexed * screen );
};
#endif // NAMCO_05XX_
| 16.821429 | 62 | 0.653928 |
562cb4a2e477f75bfaea988525d32c44c6a3677b | 10,763 | h | C | tmp/out.h | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | tmp/out.h | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | tmp/out.h | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | // Generated by tfcompile, the TensorFlow graph compiler. DO NOT EDIT!
//
// This header was generated via ahead-of-time compilation of a TensorFlow
// graph. An object file corresponding to this header was also generated.
// This header gives access to the functionality in that object file.
//
// clang-format off
#ifndef TFCOMPILE_GENERATED_entry_H_ // NOLINT(build/header_guard)
#define TFCOMPILE_GENERATED_entry_H_ // NOLINT(build/header_guard)
#include "tensorflow/compiler/tf2xla/xla_compiled_cpu_function.h"
#include "tensorflow/core/platform/types.h"
namespace Eigen { struct ThreadPoolDevice; }
namespace xla { class ExecutableRunOptions; }
// (Implementation detail) Entry point to the function in the object file.
extern "C" void entry(
void* result, const xla::ExecutableRunOptions* run_options,
const void** args, void** temps, tensorflow::int64* profile_counters);
// TmpComp represents a computation previously specified in a
// TensorFlow graph, now compiled into executable code. This extends the generic
// XlaCompiledCpuFunction class with statically type-safe arg and result
// methods. Usage example:
//
// TmpComp computation;
// // ...set args using computation.argN methods
// CHECK(computation.Run());
// // ...inspect results using computation.resultN methods
//
// The Run method invokes the actual computation, with inputs read from arg
// buffers, and outputs written to result buffers. Each Run call may also use
// a set of temporary buffers for the computation.
//
// By default each instance of this class manages its own arg, result and temp
// buffers. The AllocMode constructor parameter may be used to modify the
// buffer allocation strategy.
//
// Under the default allocation strategy, this class is thread-compatible:
// o Calls to non-const methods require exclusive access to the object.
// o Concurrent calls to const methods are OK, if those calls are made while it
// is guaranteed that no thread may call a non-const method.
//
// The logical function signature is:
// (arg0: f32[2,2], arg1: f32[2,2]) -> (f32[2,2], f32[2,2])
//
// Memory stats:
// arg bytes total: 32
// arg bytes aligned: 128
// temp bytes total: 48
// temp bytes aligned: 192
class TmpComp : public tensorflow::XlaCompiledCpuFunction {
public:
// Number of input arguments for the compiled computation.
static constexpr size_t kNumArgs = 2;
// Byte size of each argument buffer. There are kNumArgs entries.
static const ::tensorflow::int64 ArgSize(::tensorflow::int32 index) {
return BufferInfos()[ArgIndexToBufferIndex()[index]].size();
}
// Returns static data used to create an XlaCompiledCpuFunction.
static const tensorflow::XlaCompiledCpuFunction::StaticData& StaticData() {
static XlaCompiledCpuFunction::StaticData* kStaticData = [](){
XlaCompiledCpuFunction::StaticData* data =
new XlaCompiledCpuFunction::StaticData;
data->set_raw_function(entry);
data->set_buffer_infos(BufferInfos());
data->set_num_buffers(kNumBuffers);
data->set_arg_index_table(ArgIndexToBufferIndex());
data->set_num_args(kNumArgs);
data->set_result_index(kResultIndex);
data->set_arg_names(StaticArgNames());
data->set_result_names(StaticResultNames());
data->set_program_shape(StaticProgramShape());
data->set_hlo_profile_printer_data(StaticHloProfilePrinterData());
return data;
}();
return *kStaticData;
}
TmpComp(AllocMode alloc_mode = AllocMode::ARGS_RESULTS_PROFILES_AND_TEMPS)
: XlaCompiledCpuFunction(StaticData(), alloc_mode) {}
TmpComp(const TmpComp&) = delete;
TmpComp& operator=(const TmpComp&) = delete;
// Arg methods for managing input buffers. Buffers are in row-major order.
// There is a set of methods for each positional argument, with the following
// general form:
//
// void set_argN_data(void* data)
// Sets the buffer of type T for positional argument N. May be called in
// any AllocMode. Must be called before Run to have an affect. Must be
// called in AllocMode::RESULTS_PROFILES_AND_TEMPS_ONLY for each positional
// argument, to set the argument buffers.
//
// T* argN_data()
// Returns the buffer of type T for positional argument N.
//
// T& argN(...dim indices...)
// Returns a reference to the value of type T for positional argument N,
// with dim indices specifying which value. No bounds checking is performed
// on dim indices.
void set_arg0_data(void* data) {
set_arg_data(0, data);
}
float* arg0_data() {
return static_cast<float*>(arg_data(0));
}
float& arg0(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
arg_data(0)))[dim0][dim1];
}
const float* arg0_data() const {
return static_cast<const float*>(arg_data(0));
}
const float& arg0(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
arg_data(0)))[dim0][dim1];
}
void set_arg_x_data(void* data) {
set_arg_data(0, data);
}
float* arg_x_data() {
return static_cast<float*>(arg_data(0));
}
float& arg_x(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
arg_data(0)))[dim0][dim1];
}
const float* arg_x_data() const {
return static_cast<const float*>(arg_data(0));
}
const float& arg_x(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
arg_data(0)))[dim0][dim1];
}
void set_arg1_data(void* data) {
set_arg_data(1, data);
}
float* arg1_data() {
return static_cast<float*>(arg_data(1));
}
float& arg1(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
arg_data(1)))[dim0][dim1];
}
const float* arg1_data() const {
return static_cast<const float*>(arg_data(1));
}
const float& arg1(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
arg_data(1)))[dim0][dim1];
}
void set_arg_y_data(void* data) {
set_arg_data(1, data);
}
float* arg_y_data() {
return static_cast<float*>(arg_data(1));
}
float& arg_y(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
arg_data(1)))[dim0][dim1];
}
const float* arg_y_data() const {
return static_cast<const float*>(arg_data(1));
}
const float& arg_y(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
arg_data(1)))[dim0][dim1];
}
// Result methods for managing output buffers. Buffers are in row-major order.
// Must only be called after a successful Run call. There is a set of methods
// for each positional result, with the following general form:
//
// T* resultN_data()
// Returns the buffer of type T for positional result N.
//
// T& resultN(...dim indices...)
// Returns a reference to the value of type T for positional result N,
// with dim indices specifying which value. No bounds checking is performed
// on dim indices.
//
// Unlike the arg methods, there is no set_resultN_data method. The result
// buffers are managed internally, and may change after each call to Run.
float* result0_data() {
return static_cast<float*>(result_data(0));
}
float& result0(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
result_data(0)))[dim0][dim1];
}
const float* result0_data() const {
return static_cast<const float*>(result_data(0));
}
const float& result0(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
result_data(0)))[dim0][dim1];
}
float* result_x_y_prod_data() {
return static_cast<float*>(result_data(0));
}
float& result_x_y_prod(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
result_data(0)))[dim0][dim1];
}
const float* result_x_y_prod_data() const {
return static_cast<const float*>(result_data(0));
}
const float& result_x_y_prod(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
result_data(0)))[dim0][dim1];
}
float* result1_data() {
return static_cast<float*>(result_data(1));
}
float& result1(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
result_data(1)))[dim0][dim1];
}
const float* result1_data() const {
return static_cast<const float*>(result_data(1));
}
const float& result1(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
result_data(1)))[dim0][dim1];
}
float* result_x_y_sum_data() {
return static_cast<float*>(result_data(1));
}
float& result_x_y_sum(size_t dim0, size_t dim1) {
return (*static_cast<float(*)[2][2]>(
result_data(1)))[dim0][dim1];
}
const float* result_x_y_sum_data() const {
return static_cast<const float*>(result_data(1));
}
const float& result_x_y_sum(size_t dim0, size_t dim1) const {
return (*static_cast<const float(*)[2][2]>(
result_data(1)))[dim0][dim1];
}
private:
// Number of buffers for the compiled computation.
static constexpr size_t kNumBuffers = 5;
static const ::tensorflow::cpu_function_runtime::BufferInfo* BufferInfos() {
static const ::tensorflow::cpu_function_runtime::BufferInfo
kBufferInfos[kNumBuffers] = {
::tensorflow::cpu_function_runtime::BufferInfo({65ULL, ~0ULL}),
::tensorflow::cpu_function_runtime::BufferInfo({65ULL, ~0ULL}),
::tensorflow::cpu_function_runtime::BufferInfo({65ULL, ~0ULL}),
::tensorflow::cpu_function_runtime::BufferInfo({66ULL, 0ULL}),
::tensorflow::cpu_function_runtime::BufferInfo({66ULL, 1ULL})
};
return kBufferInfos;
}
static const ::tensorflow::int32* ArgIndexToBufferIndex() {
static constexpr ::tensorflow::int32 kArgIndexToBufferIndex[kNumArgs] = {
3, 4
};
return kArgIndexToBufferIndex;
}
// The 0-based index of the result tuple in the temporary buffers.
static constexpr size_t kResultIndex = 2;
// Array of names of each positional argument, terminated by nullptr.
static const char** StaticArgNames() {
return nullptr;
}
// Array of names of each positional result, terminated by nullptr.
static const char** StaticResultNames() {
return nullptr;
}
// Shape of the args and results.
static const xla::ProgramShape* StaticProgramShape() {
static const xla::ProgramShape* kShape = nullptr;
return kShape;
}
// Metadata that can be used to pretty-print profile counters.
static const xla::HloProfilePrinterData* StaticHloProfilePrinterData() {
static const xla::HloProfilePrinterData* kHloProfilePrinterData =
nullptr;
return kHloProfilePrinterData;
}
};
#endif // TFCOMPILE_GENERATED_entry_H_
// clang-format on
| 34.060127 | 80 | 0.693022 |
6627f9c2340e6025767ac8101579f91834d80ad4 | 2,635 | c | C | physicalrobots/player/examples/plugins/opaquedriver/opaque.c | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | physicalrobots/player/examples/plugins/opaquedriver/opaque.c | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | physicalrobots/player/examples/plugins/opaquedriver/opaque.c | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | /*
Copyright (c) 2006, Brad Kratochvil
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Player Project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <playerconfig.h>
#include <libplayerc/playerc.h>
#include "sharedstruct.h"
int
main(int argc, const char **argv)
{
playerc_client_t *client;
playerc_opaque_t *opaque;
test_t t;
int i;
// Create a client and connect it to the server.
client = playerc_client_create(NULL, "localhost", 6665);
if (0 != playerc_client_connect(client))
return -1;
// Create and subscribe to a opaque device.
opaque = playerc_opaque_create(client, 0);
if (playerc_opaque_subscribe(opaque, PLAYER_OPEN_MODE))
return -1;
for (i=0; i<10; ++i)
{
// Wait for new data from server
playerc_client_read(client);
t = *((test_t*)opaque->data);
printf("test data %i\n", i);
printf("%i\n", t.uint8);
printf("%i\n", t.int8);
printf("%i\n", t.uint16);
printf("%i\n", t.int16);
printf("%i\n", t.uint32);
printf("%i\n", t.int32);
printf("%0.3f\n", t.doub);
}
// Shutdown
playerc_opaque_unsubscribe(opaque);
playerc_opaque_destroy(opaque);
playerc_client_disconnect(client);
playerc_client_destroy(client);
return 0;
}
| 33.35443 | 80 | 0.734725 |
19ec6ab66e4425e3449b7ccc58cafb7f6b9f0d86 | 219 | h | C | src/config.h | brewpi-remix/uno-test | a153a5277bea2a8e58ee479792d6977f0beb853e | [
"MIT"
] | null | null | null | src/config.h | brewpi-remix/uno-test | a153a5277bea2a8e58ee479792d6977f0beb853e | [
"MIT"
] | null | null | null | src/config.h | brewpi-remix/uno-test | a153a5277bea2a8e58ee479792d6977f0beb853e | [
"MIT"
] | 1 | 2021-07-31T15:23:07.000Z | 2021-07-31T15:23:07.000Z | #ifndef _CONFIG_H
#define _CONFIG_H
#define LEDON LOW
#define LEDOFF HIGH
#define RELAYON LOW
#define RELAYOFF HIGH
#define NORMAL_PIN A4
#define I2C_PIN A0
#define HEATRELAY 5
#define COOLRELAY 6
#endif // _CONFIG_H
| 15.642857 | 21 | 0.789954 |
615809a357286a911c8b3661646ca44216debba2 | 1,050 | h | C | SubscriptionBox/SubscriptionBox/Expand/XExpand/XTools/XLocationManager/XLocationManager.h | hiETsang/SubscriptionBox | 043d2d1abca253eae0f5d1ec0bf659a11a976016 | [
"MIT"
] | null | null | null | SubscriptionBox/SubscriptionBox/Expand/XExpand/XTools/XLocationManager/XLocationManager.h | hiETsang/SubscriptionBox | 043d2d1abca253eae0f5d1ec0bf659a11a976016 | [
"MIT"
] | null | null | null | SubscriptionBox/SubscriptionBox/Expand/XExpand/XTools/XLocationManager/XLocationManager.h | hiETsang/SubscriptionBox | 043d2d1abca253eae0f5d1ec0bf659a11a976016 | [
"MIT"
] | null | null | null | //
// XLocationManager.h
// LEVE
//
// Created by canoe on 2018/1/5.
// Copyright © 2018年 canoe. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
typedef void (^LocationSuccess)(double lat ,double lng);
typedef void (^GetAddressSuccess)(NSString *address);
typedef void (^GetCitySuccess)(NSString *city);
typedef void (^LocationFailed)(NSError *error);
@interface XLocationManager : NSObject
+ (XLocationManager *)shareManager;
/**
是否一次性获取定位信息,default is NO
*/
@property(assign, nonatomic) BOOL stopAfterUpdates;
/**
获取当前定位
@param success 成功返回经纬度
@param failure 错误信息
*/
- (void)getLocationWithSuccess:(LocationSuccess)success failure:(LocationFailed)failure;
/**
获取详细地址
@param success 详细地址
@param failure 错误信息
*/
- (void)getAddressWithSuccess:(GetAddressSuccess)success failure:(LocationFailed)failure;
/**
获取城市
@param success 城市名称
@param failure 错误信息
*/
- (void)getCityWithSuccess:(GetCitySuccess)success failure:(LocationFailed)failure;
/**
停止定位
*/
- (void)stop;
@end
| 18.75 | 89 | 0.740952 |
5ed07c9446a8141298b37a2fc064ac8b82d6e701 | 780 | h | C | SDK/Classes/Dto/MCInmobiDto.h | poholo/MCAds | 30ddb0f9f31cddaa879c39003a007c6000212feb | [
"MIT"
] | 7 | 2019-03-12T03:17:57.000Z | 2020-11-25T00:30:03.000Z | SDK/Classes/Dto/MCInmobiDto.h | poholo/MCAds | 30ddb0f9f31cddaa879c39003a007c6000212feb | [
"MIT"
] | 1 | 2018-12-20T03:53:02.000Z | 2018-12-20T10:42:04.000Z | SDK/Classes/Dto/MCInmobiDto.h | poholo/MCAds | 30ddb0f9f31cddaa879c39003a007c6000212feb | [
"MIT"
] | 6 | 2019-02-21T10:06:50.000Z | 2020-06-08T00:18:39.000Z | //
// Created by majiancheng on 16/6/29.
// Copyright (c) 2016 poholo. All rights reserved.
//
#import "MCDto.h"
@interface MCInmobiDto : MCDto
@property(nonatomic, copy) NSString *pubContent;
@property(nonatomic, strong) NSDictionary *eventTracking;
@property(nonatomic, copy) NSString *landingPage;
@property(nonatomic, copy) NSString *beaconUrl;
@property(nonatomic, copy) NSString *requestId;
@property(nonatomic, copy) NSString *time;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, copy) NSString *descriptiontext;
@property(nonatomic, copy) NSString *iconURL;
@property(nonatomic, copy) NSString *screenshotsURL;
@property(nonatomic, copy) NSString *landingURL;
@property(nonatomic, assign) BOOL showed;
@property(nonatomic, assign) BOOL clicked;
@end | 31.2 | 57 | 0.773077 |
e87ec8d65a5ebf83fa1969f9b6c63c50e2a02461 | 3,287 | h | C | library/public/eaarlio/tld_opener.h | usgs/eaarl-io | 71abbd44dbc7c821d397df36822831f892e51d86 | [
"CC0-1.0"
] | 1 | 2018-11-16T06:44:19.000Z | 2018-11-16T06:44:19.000Z | library/public/eaarlio/tld_opener.h | usgs/eaarl-io | 71abbd44dbc7c821d397df36822831f892e51d86 | [
"CC0-1.0"
] | null | null | null | library/public/eaarlio/tld_opener.h | usgs/eaarl-io | 71abbd44dbc7c821d397df36822831f892e51d86 | [
"CC0-1.0"
] | null | null | null | #ifndef EAARLIO_TLD_OPENER_H
#define EAARLIO_TLD_OPENER_H
/**
* @file
* @brief Interface for opening TLD files
*
* This header defines an interface for opening TLD files for reading. It is
* intended to permit a TLD file to be opened using just the file name provided
* from the EDB file. The TLD opener is responsible for resolving the file's
* actual location in the filesystem and is responsible for opening an
* appropriate stream for it.
*/
#include "eaarlio/error.h"
#include "eaarlio/stream.h"
/**
* TLD file opener interface
*
* This interface generalizes the operations needed to open a TLD file in read
* mode given its file name as provided by an EDB file. This interface
* addresses several issues:
* - The TLD file name in the EDB does not have any path information. The TLD
* opener is responsible for knowing where to look for the file given just
* its name.
* - The TLD opener is also responsible for knowing how to open a stream for
* that file.
*
* Both functions return an ::eaarlio_error and should use ::EAARLIO_SUCCESS to
* represent a successful outcome. Each function is documented with some
* suggested error codes for failing conditions, but you are not restricted to
* those listed. In particular, stream-related errors should be propagated to
* the caller as-is.
*/
struct eaarlio_tld_opener {
/**
* Open a readable stream for a TLD file
*
* @param[in] self The TLD opener being used
* @param[out] stream The stream to be opened
* @param[in] tld_file The name of the TLD file to open
*
* @retval ::EAARLIO_SUCCESS on success
* @retval ::EAARLIO_NULL if provided a null pointer
* @retval ::EAARLIO_TLD_OPENER_INVALID if the TLD opener is not valid
*
* @post On success, @p stream must be a valid, readable stream for the
* requested TLD file.
*/
eaarlio_error (*open_tld)(struct eaarlio_tld_opener *self,
struct eaarlio_stream *stream,
char const *tld_file);
/**
* Close the opener
*
* @param[in] self The TLD opener to be closed
*
* @retval ::EAARLIO_SUCCESS on success
* @retval ::EAARLIO_NULL if provided a null pointer
* @retval ::EAARLIO_TLD_OPENER_INVALID if the TLD opener is not valid
*
* @post On success, any internal resources allocated by the implementation
* must be released.
* @post On success, @p self should have all of its pointers set to @c
* NULL, as by ::eaarlio_tld_opener_empty.
*/
eaarlio_error (*close)(struct eaarlio_tld_opener *self);
/**
* Internal data pointer
*
* This is not used by calling code directly. It provides a means for the
* functions in the structure to maintain internal state. If you do not
* need it, you can set it to @c NULL.
*/
void *opaque;
};
/**
* Empty eaarlio_tld_opener value
*
* All pointers will be null.
*/
#define eaarlio_tld_opener_empty() \
(struct eaarlio_tld_opener) \
{ \
NULL, NULL, NULL \
}
#endif
| 35.344086 | 80 | 0.640402 |
b0265cf1d7ba9ea2b07494a0d24add7e510b6c79 | 392 | h | C | ios/versioned/sdk45/EXBrightness/EXBrightness/ABI45_0_0EXBrightness.h | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | ios/versioned/sdk45/EXBrightness/EXBrightness/ABI45_0_0EXBrightness.h | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | ios/versioned/sdk45/EXBrightness/EXBrightness/ABI45_0_0EXBrightness.h | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | #import <ABI45_0_0ExpoModulesCore/ABI45_0_0EXExportedModule.h>
#import <ABI45_0_0ExpoModulesCore/ABI45_0_0EXModuleRegistryConsumer.h>
#import <ABI45_0_0ExpoModulesCore/ABI45_0_0EXEventEmitter.h>
#import <ABI45_0_0ExpoModulesCore/ABI45_0_0EXEventEmitterService.h>
@interface ABI45_0_0EXBrightness : ABI45_0_0EXExportedModule <ABI45_0_0EXModuleRegistryConsumer, ABI45_0_0EXEventEmitter>
@end
| 43.555556 | 121 | 0.890306 |
e5d4d900d2664363a8530c16673f67c255895e79 | 12,026 | h | C | src/include/container/bplustree/tree.h | rickard1117/PidanDB | 6955f6913cb404a0f09a5e44c07f36b0729c0a78 | [
"MIT"
] | 7 | 2020-08-01T04:09:15.000Z | 2021-08-08T17:26:19.000Z | src/include/container/bplustree/tree.h | rickard1117/PidanDB | 6955f6913cb404a0f09a5e44c07f36b0729c0a78 | [
"MIT"
] | null | null | null | src/include/container/bplustree/tree.h | rickard1117/PidanDB | 6955f6913cb404a0f09a5e44c07f36b0729c0a78 | [
"MIT"
] | 2 | 2020-09-16T02:29:52.000Z | 2020-09-28T10:51:38.000Z | #pragma once
#include <atomic>
#include <fstream>
#include <functional>
#include <thread>
#include "common/macros.h"
#include "common/type.h"
#include "container/bplustree/node.h"
namespace pidan {
// 一个垃圾节点,等待被GC的回收
struct GarbageNode {
Node *node{nullptr};
GarbageNode *next{nullptr};
};
// 一个EpochNode存储了一个Epoch周期中待回收的垃圾数据
struct EpochNode {
// 当前Epoch中活跃的线程数
std::atomic<uint64_t> active_thread_count{0};
// 当前Epoch中待回收的垃圾节点链表
std::atomic<GarbageNode *> garbage_list{nullptr};
// 下一个EpochNode
EpochNode *next{nullptr};
};
class EpochManager {
public:
DISALLOW_COPY_AND_MOVE(EpochManager);
EpochManager() : head_epoch_(new EpochNode()), current_epoch_(head_epoch_){};
~EpochManager() { Stop(); }
// 启动一个线程,不断地去更新epoch
void Start() {
terminate_.store(false);
thread_ = new std::thread([this] {
while (!terminate_) {
this->PerformGC();
this->CreateNewEpoch();
std::this_thread::sleep_for(std::chrono::milliseconds(BPLUSTREE_EPOCH_INTERVAL));
}
});
}
void Stop() {
terminate_.store(true);
if (thread_ != nullptr) {
thread_->join();
delete thread_;
}
}
EpochNode *JoinEpoch() {
// 我们必须保证join的Epoch和leave的Epoch是同一个
EpochNode *epoch = current_epoch_;
current_epoch_->active_thread_count.fetch_add(1);
return current_epoch_;
}
void LeaveEpoch(EpochNode *epoch) { epoch->active_thread_count.fetch_sub(1); }
// 增加一个待回收的Node,会在其他线程调用
void AddGarbageNode(Node *node) {
// 这里要copy一份current_epoch_的复制,因为GC线程可能会调用CreateNewEpoch
EpochNode *epoch = current_epoch_;
auto *garbage = new GarbageNode();
garbage->node = node;
garbage->next = epoch->garbage_list.load();
for (;;) {
auto result = epoch->garbage_list.compare_exchange_strong(garbage->next, garbage);
if (result) {
break;
}
// 如果CAS失败,那么garbage->next会更新为epoch->garbage_list的新值,则继续重试就好了。
}
}
void PerformGC() {
for (;;) {
if (head_epoch_ == current_epoch_) {
// 我们至少要保留一个epoch
return;
}
// 从head开始遍历epoch node链表
if (head_epoch_->active_thread_count.load() > 0) {
return;
}
// 已经没有线程在这个epoch上了,可以直接释放它所有的garbage节点。
while (head_epoch_->garbage_list != nullptr) {
GarbageNode *garbage_node = head_epoch_->garbage_list.load();
delete garbage_node->node;
head_epoch_->garbage_list = head_epoch_->garbage_list.load()->next;
delete garbage_node;
#ifndef NDEBUG
garbage_node_del_num_.fetch_add(1);
#endif
}
EpochNode *epoch = head_epoch_;
head_epoch_ = head_epoch_->next;
delete epoch;
#ifndef NDEBUG
epoch_del_num_.fetch_add(1);
#endif
}
}
#ifndef NDEBUG
uint32_t GarbageNodeDelNum() {
return garbage_node_del_num_.load();
}
#endif
void CreateNewEpoch() {
auto *new_epoch = new EpochNode();
current_epoch_->next = new_epoch;
current_epoch_ = new_epoch;
}
private:
// Epoch链表的头结点,不需要atomic因为只有GC线程会修改和读取它
EpochNode *head_epoch_;
// 当前Epoch所在的节点,不需要atomic因为只有GC线程会修改,业务线程虽然会读取,但是读到旧数据也没关系
EpochNode *current_epoch_;
std::atomic<bool> terminate_{true};
std::thread *thread_{nullptr};
#ifndef NDEBUG
std::atomic<uint32_t> garbage_node_del_num_{0}; // 删除的垃圾节点的数量
std::atomic<uint32_t> epoch_del_num_{0}; // 删除的epoch节点的数量
#endif
};
// 支持变长key,定长value,非重复key的线程安全B+树。
template <typename KeyType, typename ValueType>
class BPlusTree {
public:
BPlusTree() : root_(new LNode) { }
// 查找key对应的value,找到返回true,否则返回false。
bool Lookup(const KeyType &key, ValueType *value) const {
for (;;) {
Node *node = root_.load();
bool need_restart = false;
EpochNode *epoch = epoch_manager_.JoinEpoch();
bool result = StartLookup(node, nullptr, INVALID_OLC_LOCK_VERSION, key, value, &need_restart);
epoch_manager_.LeaveEpoch(epoch);
if (need_restart) {
// 查找失败,需要重启整个流程。
continue;
}
return result;
}
}
// 插入一对key value,要求key是唯一的。如果key已经存在则返回false,并将value设置为已经存在的值。
// 插入成功返回true,不对value做任何改动。
bool InsertUnique(const KeyType &key, const ValueType &value, ValueType *old_val) {
for (;;) {
Node *node = root_.load();
bool need_restart = false;
EpochNode *epoch = epoch_manager_.JoinEpoch();
bool result = StartInsertUnique(node, nullptr, INVALID_OLC_LOCK_VERSION, key, value, old_val, &need_restart);
epoch_manager_.LeaveEpoch(epoch);
if (need_restart) {
continue;
}
return result;
}
}
// 查找key,如果找到,返回true并返回对应的Value值。如果没找到则返回false并构造一个新的value。
bool CreateIfNotExist(const KeyType &key, ValueType *new_val, const std::function<ValueType(void)> &creater) {
for (;;) {
}
}
// 只是测试用
void DrawTreeDot(const std::string &filename) {
std::ofstream out(filename);
out << "digraph g { " << '\n';
out << "node [shape = record,height=0.1];" << '\n';
IDGenerator g;
draw_node(root_, out, g.gen(), g);
out << "}" << '\n';
}
private:
using LNode = LeafNode<KeyType, ValueType>;
using INode = InnerNode<KeyType>;
class IDGenerator {
public:
IDGenerator() : id_(0) {}
size_t gen() { return id_++; }
private:
size_t id_;
};
void draw_node(Node *node, std::ofstream &ofs, size_t my_id, IDGenerator &g) {
std::string my_id_s = std::to_string(my_id);
ofs.flush();
if (!node->IsLeaf()) {
INode *inner = static_cast<INode *>(node);
ofs << "node" << my_id_s << "[label = \"";
for (uint16_t i = 0; i < inner->key_map_.size(); i++) {
ofs << "<f" << std::to_string(i) << ">";
ofs << "|" << inner->key_map_.KeyAt(i).ToString() << "|";
}
ofs << "<f" << inner->key_map_.size() << ">\"];\n";
size_t childid = g.gen();
ofs << "\"node" << my_id_s << "\""
<< ":f"
<< "0"
<< "->"
<< "\"node" << std::to_string(childid) << "\"\n";
draw_node(inner->first_child_, ofs, childid, g);
for (uint16_t i = 0; i < inner->key_map_.size(); i++) {
childid = g.gen();
ofs << "\"node" << my_id_s << "\""
<< ":f" << std::to_string(i + 1) << "->"
<< "\"node" << std::to_string(childid) << "\"\n";
draw_node(inner->key_map_.ValueAt(i), ofs, childid, g);
}
return;
}
LNode *leaf = static_cast<LNode *>(node);
for (uint16_t i = 0; i < leaf->key_map_.size(); i++) {
if (i > 0) {
ofs << "|";
}
ofs << leaf->key_map_.KeyAt(i).ToString();
}
ofs << "\"];\n";
}
// 从node节点开始,向树中插入key value,插入失败返回false,否则返回true。
bool StartInsertUnique(Node *node, INode *parent, uint64_t parent_version, const KeyType &key, const ValueType &val,
ValueType *old_val, bool *need_restart) {
uint64_t version;
if (!node->ReadLockOrRestart(&version)) {
*need_restart = true;
return false;
}
if (!node->IsLeaf()) {
INode *inner = static_cast<INode *>(node);
if (!inner->EnoughSpaceFor(MAX_KEY_SIZE)) {
// 节点空间不足,要分裂。
if (parent) {
if (!parent->UpgradeToWriteLockOrRestart(parent_version)) {
*need_restart = true;
return false;
}
}
if (!inner->UpgradeToWriteLockOrRestart(version)) {
if (parent) {
parent->WriteUnlock();
}
*need_restart = true;
return false;
}
// TODO: 这个地方有疑问,到底应不应该判断。
if (parent == nullptr && (inner != root_.load())) {
// node原本是根节点,但是同时有其他线程在此线程对根节点加写锁之前已经将根节点分裂或删除了
// 此时虽然加写锁可以成功,但根节点已经是新的节点了,因此要重启。
inner->WriteUnlock();
*need_restart = true;
return false;
}
KeyType split_key;
INode *sibling = inner->Split(&split_key);
if (parent) {
bool result = parent->Insert(split_key, sibling);
assert(result);
} else {
root_ = new INode(inner->level() + 1, inner, sibling, split_key);
}
inner->WriteUnlock();
if (parent) {
parent->WriteUnlock();
}
// 分裂完毕,重新开始插入流程。
*need_restart = true;
return false;
}
if (parent) {
if (!parent->ReadUnlockOrRestart(parent_version)) {
*need_restart = true;
return false;
}
}
Node *child = inner->FindChild(key);
if (!inner->CheckOrRestart(version)) {
*need_restart = true;
return false;
}
return StartInsertUnique(child, inner, version, key, val, old_val, need_restart);
}
LNode *leaf = static_cast<LNode *>(node);
if (leaf->Exists(key, old_val)) {
if (!leaf->ReadUnlockOrRestart(version)) {
*need_restart = true;
} else {
*need_restart = false;
}
return false;
}
if (!leaf->EnoughSpaceFor(MAX_KEY_SIZE)) {
if (parent) {
// leaf节点要分裂,会向父节点插入key,要先拿到父节点的写锁。
// 之前访问父节点已经保证了父节点的空间足够,如果在访问后父节点发生了改动,那么这里会加锁失败。
if (!parent->UpgradeToWriteLockOrRestart(parent_version)) {
*need_restart = true;
return false;
}
}
if (!leaf->UpgradeToWriteLockOrRestart(version)) {
*need_restart = true;
if (parent) {
parent->WriteUnlock();
}
return false;
}
// TODO: 这个地方有疑问,到底应不应该判断。
if (parent == nullptr && (node != root_)) {
// node原本是根节点,但是同时有其他线程在此线程对根节点加写锁之前已经将根节点分裂或删除了
// 此时虽然加写锁可以成功,但根节点已经是新的节点了,因此要重启。
leaf->WriteUnlock();
*need_restart = true;
return false;
}
KeyType split_key;
LNode *sibling = leaf->Split(&split_key);
if (parent) {
bool result = parent->Insert(split_key, sibling);
assert(result);
} else {
// 当前节点是leaf node,那么父节点的level必须是1
root_ = new INode(1, leaf, sibling, split_key);
}
// TODO : 分裂完毕了,此时是否可以直接将key插入到leaf或者sibling节点了,还是需要再重启一次?
// if (key < split_key) {
// leaf->Insert(key, val);
// } else {
// sibling->Insert(key, val);
// }
leaf->WriteUnlock();
if (parent) {
parent->WriteUnlock();
}
*need_restart = true;
return false;
} else {
// leaf 节点空间足够,直接插入不需要再对父节点加写锁了
if (!leaf->UpgradeToWriteLockOrRestart(version)) {
*need_restart = true;
return false;
}
if (parent) {
if (!parent->ReadUnlockOrRestart(parent_version)) {
*need_restart = true;
leaf->WriteUnlock();
return false;
}
}
leaf->Insert(key, val);
leaf->WriteUnlock();
return true;
}
}
// 从节点node开始查找key,没有找到则返回false
bool StartLookup(const Node *node, const Node *parent, const uint64_t parent_version, const KeyType &key,
ValueType *val, bool *need_restart) const {
// a_.fetch_add(1);
uint64_t version;
if (!node->ReadLockOrRestart(&version)) {
*need_restart = true;
return false;
}
if (parent) {
if (!parent->ReadUnlockOrRestart(parent_version)) {
*need_restart = true;
return false;
}
}
if (node->IsLeaf()) {
const LNode *leaf = static_cast<const LNode *>(node);
bool result = leaf->FindValue(key, val);
if (!leaf->ReadUnlockOrRestart(version)) {
*need_restart = true;
return false;
}
*need_restart = false;
return result;
}
const INode *inner = static_cast<const INode *>(node);
const Node *child = inner->FindChild(key);
assert(child != nullptr);
// 这里需要再次检查,以保证child指针的有效性。
if (!inner->CheckOrRestart(version)) {
*need_restart = true;
return false;
}
return StartLookup(child, node, version, key, val, need_restart);
}
private:
std::atomic<Node *> root_;
mutable EpochManager epoch_manager_;
};
// 画出树的dot图,仅用于测试
void DrawTreeDot(const std::string &filename);
} // namespace pidan | 27.394077 | 118 | 0.594296 |
58c08fd08bfb640346967759ce79bc9210fb42f8 | 735 | h | C | TimeSchedule/timeeditdelegate.h | SteakingCoder/MyTimeSchedule | 1cc017e8439f9830fa056dda11bd40536eba8986 | [
"Apache-2.0"
] | null | null | null | TimeSchedule/timeeditdelegate.h | SteakingCoder/MyTimeSchedule | 1cc017e8439f9830fa056dda11bd40536eba8986 | [
"Apache-2.0"
] | 1 | 2018-02-08T15:16:12.000Z | 2018-03-03T16:18:55.000Z | TimeSchedule/timeeditdelegate.h | HuangDanGeeker/MyTimeSchedule | 1cc017e8439f9830fa056dda11bd40536eba8986 | [
"Apache-2.0"
] | null | null | null | #ifndef TIMEEDITDELEGATE_H
#define TIMEEDITDELEGATE_H
#include <QObject>
#include <QItemDelegate>
class TimeEditDelegate : public QItemDelegate
{
public:
TimeEditDelegate(QObject * parent);
//返回改变Model数据的widget,该widget是经过定制行为的Widget
QWidget *createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
//将可操作的数据提供给widget
void setEditorData(QWidget * editor, const QModelIndex & index) const;
//将widget的数据展示到Item中
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // TIMEEDITDELEGATE_H
| 30.625 | 115 | 0.77551 |
d7a52e2501b34098bc8f0cb0d5ef7de0fe3b8c7f | 585 | c | C | Language Specific Notes/C Language Notes/Structures/02_Basic_structures.c | sayanmondal31/dev_stage | 0e52eb90ef71ee2a2c631720e38b0d36fe73e626 | [
"MIT"
] | 1 | 2020-10-17T06:53:36.000Z | 2020-10-17T06:53:36.000Z | Language Specific Notes/C Language Notes/Structures/02_Basic_structures.c | debajyatibanerjee0002/dev_stage | 2d853de917f574353f200b040427e8572e00d140 | [
"MIT"
] | 4 | 2020-10-17T16:30:38.000Z | 2020-10-19T10:18:48.000Z | Language Specific Notes/C Language Notes/Structures/02_Basic_structures.c | debajyatibanerjee0002/dev_stage | 2d853de917f574353f200b040427e8572e00d140 | [
"MIT"
] | 3 | 2020-10-17T12:40:21.000Z | 2020-10-18T16:26:39.000Z | #include <stdio.h>
int main()
{
struct book
{
char name[20];
float price;
int pages;
} b1, b2, b3;
printf("Enter the values for the following:-\n");
scanf("%s %f %d", &b1.name, &b1.price, &b1.pages);
scanf("%s %f %d", &b2.name, &b2.price, &b2.pages);
scanf("%s %f %d", &b3.name, &b3.price, &b3.pages);
printf("The entered values are:-\n");
printf("%s %0.2f %d\n", b1.name, b1.price, b1.pages);
printf("%s %0.2f %d\n", b2.name, b2.price, b2.pages);
printf("%s %0.2f %d\n", b3.name, b3.price, b3.pages);
return 0;
} | 30.789474 | 57 | 0.535043 |
c97547e9f9ffcaca92109830ce8d5e4ace445c81 | 495 | h | C | board/BDW01-STM32L496VG/BSP/Inc/mymath.h | QingChuanWS/tencentos-tiny-with-tflitemicro-and-iot | e036d344b4729e70877f55026bb11841991f6650 | [
"Apache-2.0"
] | 4 | 2021-02-01T07:14:21.000Z | 2021-04-08T08:24:25.000Z | board/BDW01-STM32L496VG/BSP/Inc/mymath.h | QingChuanWS/tencentos-tiny-with-tflitemicro-and-iot | e036d344b4729e70877f55026bb11841991f6650 | [
"Apache-2.0"
] | null | null | null | board/BDW01-STM32L496VG/BSP/Inc/mymath.h | QingChuanWS/tencentos-tiny-with-tflitemicro-and-iot | e036d344b4729e70877f55026bb11841991f6650 | [
"Apache-2.0"
] | 3 | 2021-01-10T09:56:57.000Z | 2022-02-08T19:56:50.000Z | #ifndef __MYMATH_H
#define __MYMATH_H
void Ascii_to_hex_char(char *dstbuf,char*rstbuf);
void HexStrToByte(const char* source, unsigned char* dest, int sourceLen);
void ByteToHexStr(const unsigned char* source, char* dest, int sourceLen);
void Hex2Str( const char *sSrc, char *sDest, int nSrcLen );
int Myatoi(char *buf);
char * Myitoa(int val);
int str_to_hex(char *string, unsigned char *cbuf, int len);
void hex_to_str(char *ptr,unsigned char *buf,int len);
#endif
| 26.052632 | 77 | 0.723232 |
4544da2c121969f4f0133f030f8cac336aafb38a | 1,023 | h | C | include/SDRP/Core/Core.h | wrren/srdp | 075b361df9f63129776af848ab07382b6d8da909 | [
"MIT"
] | null | null | null | include/SDRP/Core/Core.h | wrren/srdp | 075b361df9f63129776af848ab07382b6d8da909 | [
"MIT"
] | null | null | null | include/SDRP/Core/Core.h | wrren/srdp | 075b361df9f63129776af848ab07382b6d8da909 | [
"MIT"
] | null | null | null | /************************************************************************
* Radicle Design *
* Service Discovery Routing Protocol *
* *
* Author: Warren Kenny <warren.kenny@gmail.com> *
* Platforms: ns-2, Unix, Windows *
* *
* Copyright 2010 Radicle Design. All rights reserved. *
************************************************************************/
#ifndef RD_SDRP_CORE_H
#define RD_SDRP_CORE_H
// STL
#include <map>
#include <set>
#include <list>
#include <vector>
#include <string>
#include <memory>
#include <iostream>
#include <algorithm>
// Core
#include <SDRP/Core/Types.h>
#include <SDRP/Core/Macros.h>
#include <SDRP/Core/Exception.h>
#include <SDRP/Core/Publisher.h>
#include <SDRP/Core/Connection.h>
#include <SDRP/Core/ErrorCodes.h>
#include <SDRP/Core/Definitions.h>
#include <SDRP/Core/BloomFilter.h>
#include <SDRP/Core/ISerializable.h>
// Utilities
#include <SDRP/Utilities/Logger.h>
#include <SDRP/Utilities/Serializer.h>
#endif // RD_SDRP_CORE_H
| 24.95122 | 74 | 0.59433 |
57ba673d6073d6d60a574db4f0dc9131895e21b4 | 3,754 | h | C | src/libsshqtquestiondialog.h | artoka/libsshqt | 5c69fbf478a1514380308e72815dbe02f2b290e6 | [
"MIT"
] | 6 | 2015-04-21T07:13:05.000Z | 2022-03-08T01:26:49.000Z | src/libsshqtquestiondialog.h | artoka/libsshqt | 5c69fbf478a1514380308e72815dbe02f2b290e6 | [
"MIT"
] | null | null | null | src/libsshqtquestiondialog.h | artoka/libsshqt | 5c69fbf478a1514380308e72815dbe02f2b290e6 | [
"MIT"
] | 4 | 2017-09-26T20:00:13.000Z | 2021-11-10T18:54:02.000Z | #ifndef LIBSSHQTQUESTIONDIALOG_H
#define LIBSSHQTQUESTIONDIALOG_H
#include <QDialog>
#include "libsshqtclient.h"
namespace Ui {
class LibsshQtQuestionDialog;
}
/*!
LibsshQtQuestionDialog - Question and message dialog for LibsshQtClient
LibsshQtQuestionDialog implements the standard question dialogs needed while
connecting to a SSH server. Specifically LibsshQtQuestionDialog handles
unknownHost, needPassword and needKbiAnswers signals emitted by
LibsshQtClient and displays the appropriate dialog to the user.
If the user types the wrong password then LibsshQtQuestionDialog re-enables
the attempted authentication method and re-displays the authentication
dialog. Specifically If LibsshQtClient emits authFailed signal and the
failed authentication type is either UseAuthPassword or UseAuthKbi and if
the server actually supports the attempted method, then
LibsshQtQuestionDialog will re-enable the failed authentication method.
If LibsshQtClient emits allAuthsFailed or error signal then
LibsshQtQuestionDialog displays either "Authentication Failed" or "Error"
messagebox. If you want to display these messages yourself, you can disable
these messageboxes with setShowAuthsFailedDlg() and setShowErrorDlg()
functions.
If user cancels a dialog, LibsshQtClient::disconnectFromHost() is called.
Use setClient() function to set which LibsshQtClient object is handled by
LibsshQtQuestionDialog.
*/
class LibsshQtQuestionDialog : public QDialog
{
Q_OBJECT
public:
Q_ENUMS(State)
enum State
{
StateHidden,
StateUnknownHostDlg,
StatePasswordAuthDlg,
StateKbiAuthDlg
};
explicit LibsshQtQuestionDialog(QWidget *parent = 0);
~LibsshQtQuestionDialog();
static const char *enumToString(const State value);
void setClient(LibsshQtClient *client);
void setUnknownHostIcon(QIcon icon);
void setAuthIcon(QIcon icon);
void setShowAuthsFailedDlg(bool enabled);
void setShowErrorDlg(bool enabled);
State state() const;
void done(int code);
void setVisible(bool visible);
private slots:
void handleDebugChanged();
void handleUnknownHost();
void handleNeedPassword();
void handleNeedKbiAnswers();
void showNextKbiQuestion();
void handleAuthFailed(int auth);
void handleAllAuthsFailed();
void handleError();
private:
void setState(State state);
void showHostDlg(QString message, QString info);
void showAuthDlg(QString message, bool show_answer = false);
void showInfoDlg(QString message, QString title);
private:
QString debug_prefix_;
bool debug_output_;
Ui::LibsshQtQuestionDialog *ui_;
LibsshQtClient *client_;
State state_;
QList<LibsshQtClient::KbiQuestion> kbi_questions_;
QStringList kbi_answers_;
int kbi_pos_;
bool show_auths_failed_dlg_;
bool show_error_dlg_;
};
// Include <QDebug> before "libsshqt.h" if you want to use these operators
#ifdef QDEBUG_H
inline QDebug operator<<(QDebug dbg, const LibsshQtQuestionDialog *gui)
{
dbg.nospace() << "LibsshQtQuestionDialog( "
<< LibsshQtQuestionDialog::enumToString(gui->state())
<< " )";
return dbg.space();
}
inline QDebug operator<<(QDebug dbg, const LibsshQtQuestionDialog::State value)
{
dbg << LibsshQtQuestionDialog::enumToString(value);
return dbg;
}
#endif
#endif // LIBSSHQTQUESTIONDIALOG_H
| 24.376623 | 80 | 0.689664 |
7ed62c0d367bff059aa242c18f4b442cc5ebdd5b | 667 | h | C | include/qpl/qpl.h | intel/qpl | cdc8442f7a5e7a6ff6eea39c69665e0c5034d85d | [
"MIT"
] | 11 | 2022-02-25T08:20:23.000Z | 2022-03-25T08:36:19.000Z | include/qpl/qpl.h | intel/qpl | cdc8442f7a5e7a6ff6eea39c69665e0c5034d85d | [
"MIT"
] | null | null | null | include/qpl/qpl.h | intel/qpl | cdc8442f7a5e7a6ff6eea39c69665e0c5034d85d | [
"MIT"
] | null | null | null | /*******************************************************************************
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
******************************************************************************/
/*
* Intel® Query Processing Library (Intel® QPL)
* Job API (public C API)
*/
/**
* @defgroup JOB_API Public API: Low-level (C)
* @{
* @brief Public Intel® Query Processing Library (Intel® QPL) C API based on the @ref qpl_job structure (Job API).
* @}
*/
#ifndef QPL_H__
#define QPL_H__
#include "c_api/version.h"
#include "c_api/defs.h"
#include "c_api/job.h"
#include "c_api/index_table.h"
#endif /* //QPL_H__ */
| 23.821429 | 114 | 0.506747 |
47e09706342d8c2a6117e40f9e3a26e8afc331be | 317 | h | C | MDLiveShow/MDLiveShow/Classes/Home/Hot/Model/XLHotData.h | ShangDuRuiORG/DuRuiMDLiveShow | 664f12d037f35a0b895d165e506afce63a2183de | [
"Apache-2.0"
] | null | null | null | MDLiveShow/MDLiveShow/Classes/Home/Hot/Model/XLHotData.h | ShangDuRuiORG/DuRuiMDLiveShow | 664f12d037f35a0b895d165e506afce63a2183de | [
"Apache-2.0"
] | null | null | null | MDLiveShow/MDLiveShow/Classes/Home/Hot/Model/XLHotData.h | ShangDuRuiORG/DuRuiMDLiveShow | 664f12d037f35a0b895d165e506afce63a2183de | [
"Apache-2.0"
] | null | null | null | //
// XLHotData.h
// XLMiaoBo
//
// Created by XuLi on 16/8/31.
// Copyright © 2016年 XuLi. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface XLHotData : NSObject
/** 返回多少条主播信息 */
@property (nonatomic, strong) NSNumber *counts;
/** 主播信息列表 */
@property (nonatomic, strong) NSArray *list;
@end
| 17.611111 | 48 | 0.678233 |
cc132528e7b2ee1af246b7a41413120b0ee88304 | 1,077 | h | C | autoKeepGoing/matchLikeMacro.h | XiaoPanPanKevinPan/C-string-switch | 2907143eea7220552c72f2e90a86d44e0a313f55 | [
"MIT"
] | null | null | null | autoKeepGoing/matchLikeMacro.h | XiaoPanPanKevinPan/C-string-switch | 2907143eea7220552c72f2e90a86d44e0a313f55 | [
"MIT"
] | null | null | null | autoKeepGoing/matchLikeMacro.h | XiaoPanPanKevinPan/C-string-switch | 2907143eea7220552c72f2e90a86d44e0a313f55 | [
"MIT"
] | null | null | null |
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
/* `while(){}` or `do{}while();` makes `break` possible */
/* the loop goes twice, and `other` runs at 2nd time,
* so it will try to compare anything until nothing matches,
* and then run the block for exception
*/
#define match(sth) { char *_____toMatch = sth;\
while(true){\
static bool _____keepGoing = false, _____haveMatched = false, _____first = true; \
{\
{
#define like(a) }\
}if(_____keepGoing || (_____first && strcmp(_____toMatch, a)==0)){\
_____keepGoing = true; _____haveMatched = true; {
#define other }\
}if(!_____first || _____keepGoing){\
_____keepGoing = true;\
{
#define thenGo(sth) _____toMatch = sth; _____keepGoing = false; continue
#define thenGoOther _____first = false; _____keepGoing = false; continue
#define endMatch }\
}if(_____first && !_____haveMatched){\
_____first = false;\
}else{\
break;\
}\
}\
}
| 27.615385 | 90 | 0.594243 |
4a379256f1d106e309608943c6e0277c69269a28 | 999 | c | C | libft/src/ft_putnbr.c | ZacheryFaria/Fillit | 4acbc68e66e6a8e595183ad84ac21286e4319cc0 | [
"MIT"
] | null | null | null | libft/src/ft_putnbr.c | ZacheryFaria/Fillit | 4acbc68e66e6a8e595183ad84ac21286e4319cc0 | [
"MIT"
] | null | null | null | libft/src/ft_putnbr.c | ZacheryFaria/Fillit | 4acbc68e66e6a8e595183ad84ac21286e4319cc0 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: awindham <awindham@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/28 20:33:04 by awindham #+# #+# */
/* Updated: 2018/12/02 16:28:34 by awindham ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <limits.h>
#include "libft.h"
void ft_putnbr(int n)
{
ft_putnbr_fd(n, 1);
}
| 47.571429 | 80 | 0.175175 |
4a876702cedeff4de31e8db51985338dabfced76 | 3,635 | h | C | src/link/tcpForwardService.h | LueyEscargot/mapper | 51a36428c985cd60597b21e66cc38c194d53cfca | [
"MIT"
] | 2 | 2020-09-07T12:01:15.000Z | 2021-07-12T14:48:38.000Z | src/link/tcpForwardService.h | LueyEscargot/mapper | 51a36428c985cd60597b21e66cc38c194d53cfca | [
"MIT"
] | 22 | 2019-11-03T14:28:22.000Z | 2020-02-10T13:20:30.000Z | src/link/tcpForwardService.h | LueyEscargot/mapper | 51a36428c985cd60597b21e66cc38c194d53cfca | [
"MIT"
] | null | null | null | /**
* @file tcpForwardService.h
* @author Liu Yu (source@liuyu.com)
* @brief TCP Service Class.
* @version 1.0
* @date 2020-01-05
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __MAPPER_LINK_TCPFORWARDSERVICE_H__
#define __MAPPER_LINK_TCPFORWARDSERVICE_H__
#include <list>
#include <memory>
#include <set>
#include <string>
#include <thread>
#include "forward.h"
#include "service.h"
#include "targetMgr.h"
#include "utils.h"
#include "../buffer/dynamicBuffer.h"
#include "../utils/timerList.h"
namespace mapper
{
namespace link
{
class TcpForwardService : public Service
{
protected:
static const uint32_t EPOLL_THREAD_RETRY_INTERVAL;
static const uint32_t EPOLL_MAX_EVENTS;
static const uint32_t INTERVAL_EPOLL_WAIT_TIME;
protected:
TcpForwardService(const TcpForwardService &) : Service(""){};
TcpForwardService &operator=(const TcpForwardService &) { return *this; }
public:
TcpForwardService();
virtual ~TcpForwardService();
bool init(std::list<std::shared_ptr<Forward>> &forwardList,
Service::Setting_t &setting);
void join() override;
void stop() override;
void close() override;
std::string getStatistic(time_t curTime) override;
void resetStatistic() override;
void postProcess(time_t curTime);
void scanTimeout(time_t curTime);
protected:
void epollThread();
bool initEnv();
void closeEnv();
bool doEpoll(int epollfd);
void doTunnelSoc(time_t curTime, Endpoint_t *pe, uint32_t events);
static void setStatus(Tunnel_t *pt, TunnelState_t stat);
Tunnel_t *getTunnel();
void acceptClient(time_t curTime, Endpoint_t *pe);
bool connect(time_t curTime, Endpoint_t *pse, Tunnel_t *pt);
void onRead(time_t curTime, int events, Endpoint_t *pe);
void onWrite(time_t curTime, int events, Endpoint_t *pe);
inline void addToCloseList(Tunnel_t *pt) { mPostProcessList.insert(pt); };
inline void addToCloseList(Endpoint_t *pe) { addToCloseList((Tunnel_t *)pe->container); }
void closeTunnel(Tunnel_t *pt);
void releaseEndpointBuffer(Endpoint_t *pe);
inline void addToTimer(utils::TimerList &timer, time_t curTime, Tunnel_t *pt)
{
timer.push_back(curTime, &pt->timerEntity);
}
inline void removeFromTimer(utils::TimerList &timer, Tunnel_t *pt)
{
timer.erase(&pt->timerEntity);
}
inline void refreshTimer(utils::TimerList &timer, time_t curTime, Tunnel_t *pt)
{
timer.refresh(curTime, &pt->timerEntity);
}
void refreshTimer(time_t curTime, Tunnel_t *pt);
inline void switchTimer(utils::TimerList &src, utils::TimerList &dst, time_t curTime, Tunnel_t *pt)
{
src.erase(&pt->timerEntity);
dst.push_back(curTime, &pt->timerEntity);
}
static const bool StateMaine[TUNNEL_STATE_COUNT][TUNNEL_STATE_COUNT];
int mEpollfd;
volatile bool mStopFlag;
std::thread mMainRoutineThread;
std::list<std::shared_ptr<Forward>> mForwardList;
Service::Setting_t mSetting;
buffer::DynamicBuffer *mpDynamicBuffer;
std::set<Tunnel_t *> mPostProcessList;
std::set<Tunnel_t *> mCloseList;
TargetManager mTargetManager;
std::map<sockaddr_in, Endpoint_t *, Utils::Comparator_t> mAddr2ServiceEndpoint;
std::set<Tunnel_t *> mTunnelList;
utils::TimerList mConnectTimer;
utils::TimerList mSessionTimer;
utils::TimerList mReleaseTimer;
// for statistic
volatile float mUp;
volatile float mDown;
volatile float mTotalUp;
volatile float mTotalDown;
};
} // namespace link
} // namespace mapper
#endif // __MAPPER_LINK_TCPFORWARDSERVICE_H__
| 28.178295 | 103 | 0.708666 |
cd688fedaf37a30f111c441093c9a7e88cc0ce4d | 3,265 | h | C | example/bt/legacy_cm256sm/libbsa/include/bta_gp_api.h | Stanley-Y/QuecOpen | 372403f19507a19d26750a5cec422b7ba31390e6 | [
"MIT"
] | 30 | 2019-05-08T17:07:10.000Z | 2022-03-22T05:46:42.000Z | example/bt/legacy_cm256sm/libbsa/include/bta_gp_api.h | Stanley-Y/QuecOpen | 372403f19507a19d26750a5cec422b7ba31390e6 | [
"MIT"
] | null | null | null | example/bt/legacy_cm256sm/libbsa/include/bta_gp_api.h | Stanley-Y/QuecOpen | 372403f19507a19d26750a5cec422b7ba31390e6 | [
"MIT"
] | 9 | 2019-04-02T14:40:12.000Z | 2022-03-30T08:19:36.000Z |
/*****************************************************************************
**
** Name: bta_gp_api.h
**
** Description: This file contains the common API functions used
** for the Generic PIM Access Profiles (GP).
**
** Copyright (c) 20114, Broadcom Corp., All Rights Reserved.
** Broadcom Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef BTA_GP_API_H
#define BTA_GP_API_H
#include "bta_gse_api.h" /* For tBTA_GP_MSG_TYPE */
#include <stdio.h>
typedef struct
{
UINT16 size; /* Size of the buffer */
UINT8 * p_buffer; /* Pointer to buffer */
UINT8 * p_next; /* Pointer to next byte to use in buffer */
}tBTA_GP_MEM_STREAM;
typedef struct
{
int fd;
}tBTA_GP_FILE_STREAM;
/* Structure used for streaming data */
typedef struct
{
#define STRM_TYPE_MEMORY 0
#define STRM_TYPE_FILE 1
UINT8 type;
#define STRM_SUCCESS 0
#define STRM_ERROR_OVERFLOW 1
#define STRM_ERROR_FILE 2
UINT8 status;
union
{
tBTA_GP_MEM_STREAM mem;
tBTA_GP_FILE_STREAM file;
} u;
} tBTA_GP_STREAM;
typedef struct
{
UINT8 *p_data; /* Pointer to property data. */
UINT32 parameters; /* Property parameters. */
UINT16 name; /* Property name. */
UINT16 len; /* Length of data. */
UINT8 *p_param; /* Pointer to the Parameters */
UINT16 param_len; /* Param Len */
} tBTA_GP_PROP;
/* Status */
#define BTA_GP_CO_OK 0 /* Operation successful. */
#define BTA_GP_CO_FAIL 1 /* Operation failed. */
#define BTA_GP_CO_MEM 2 /* Not enough memory to complete operation. */
typedef UINT8 tBTA_GP_CO_STATUS;
/*******************************************************************************
**
** bMessage functions
**
** Description The following API functions are generic in a sense that
** they do not imply how the data is stored (to memory or
** to file, etc.).
**
** They operate on a generic set of structure types. Though
** the internal structure of those types are implementation
** specific.
**
*******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function BTA_GpInitMemStream
**
** Description Initializes a memory based stream
**
** Parameters p_stream - pointer to stream information.
** p_buffer - pointer to buffer to be manipulated.
** size - size of buffer pointed to by 'p_buffer'.
**
** Returns TRUE if stream is successfully initialized
**
*******************************************************************************/
BTA_API extern BOOLEAN BTA_GpInitMemStream(tBTA_GP_STREAM *p_stream, UINT8 *p_buffer, UINT16 size);
#ifdef __cplusplus
}
#endif
#endif /* BTA_GP_API_H */
| 29.151786 | 99 | 0.501072 |
9470a82d7bfeab963c2edddf7905845bca37d77b | 2,198 | h | C | Surface/src/Surface/Window.h | almic/Surface-Engine | be859f86f224042817b855199afd7e4f80596042 | [
"MIT"
] | 2 | 2020-05-04T16:05:39.000Z | 2021-12-28T06:29:46.000Z | Surface/src/Surface/Window.h | almic/Surface-Engine | be859f86f224042817b855199afd7e4f80596042 | [
"MIT"
] | null | null | null | Surface/src/Surface/Window.h | almic/Surface-Engine | be859f86f224042817b855199afd7e4f80596042 | [
"MIT"
] | null | null | null | #pragma once
#include "Core.h"
#include "Event.h"
struct GLFWwindow;
namespace Surface {
enum class WindowForm : unsigned
{
HIDDEN,
MINIMIZED,
WINDOWED,
MAXIMIZED,
BORDERLESS,
WINDOWED_FULLSCREEN,
FULLSCREEN,
RESTORE
};
struct SURF_API WindowProperties
{
using EventCallbackFunc = std::function<void(Event&)>;
std::string title;
unsigned int width;
unsigned int height;
unsigned int xPos;
unsigned int yPos;
bool setPosition;
bool vsync;
int targetFPS;
WindowForm form;
EventCallbackFunc eventCallback;
WindowProperties(const std::string& title = "Surface",
unsigned int width = 853,
unsigned int height = 480,
int xPos = 0,
int yPos = 0,
bool setPosition = false,
bool vsync = true,
int targetFPS = 0,
WindowForm form = WindowForm::WINDOWED)
: title(title), width(width), height(height), xPos(xPos), yPos(yPos), setPosition(setPosition), vsync(vsync), targetFPS(targetFPS), form(form) {}
static WindowProperties& GetProperties(GLFWwindow* window);
// Changing these will not actually update the size or location of the window, this is only for the end application
inline void SetSize(unsigned int width, unsigned int height) { this->width = width; this->height = height; }
inline void SetPosition(unsigned int xPos, unsigned int yPos) { this->xPos = xPos; this->yPos = yPos; }
};
class SURF_API Window
{
public:
using EventCallbackFunc = std::function<void(Event&)>;
WindowProperties properties;
virtual ~Window() {}
static Window* Create(const WindowProperties& props);
virtual void Close() = 0;
virtual GLFWwindow* GetGLFWwindow() = 0;
virtual void OnUpdate() = 0;
virtual void SetEventCallback(const EventCallbackFunc& callback) = 0;
virtual void SetSize(unsigned int width, unsigned int height) = 0;
virtual void SetWindowForm(WindowForm form) = 0;
virtual void SetVSync(bool enabled) = 0;
virtual void SetTargetFPS(int targetFPS) = 0;
virtual bool IsVSync() const = 0;
inline static void GLFWErrorCallback(int code, const char* reason) { SURF_CORE_ERROR("GLFW Error {0} {1}", code, reason); }
};
}
| 27.475 | 148 | 0.695632 |
7f56be9301f44cff8e5ff0febb3f912f217b85ba | 4,417 | h | C | tiledb/sm/query/strategy_base.h | upj977155/TileDB | 1c96c6a0c030e058930ff9d47409865fbfe2178f | [
"MIT"
] | 1,478 | 2017-06-15T13:58:50.000Z | 2022-03-30T13:46:00.000Z | tiledb/sm/query/strategy_base.h | upj977155/TileDB | 1c96c6a0c030e058930ff9d47409865fbfe2178f | [
"MIT"
] | 1,435 | 2017-05-25T01:16:18.000Z | 2022-03-31T21:57:06.000Z | tiledb/sm/query/strategy_base.h | upj977155/TileDB | 1c96c6a0c030e058930ff9d47409865fbfe2178f | [
"MIT"
] | 169 | 2017-06-09T18:35:45.000Z | 2022-03-13T01:11:18.000Z | /**
* @file strategy_base.h
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2017-2021 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @section DESCRIPTION
*
* This file defines class StrategyBase.
*/
#ifndef TILEDB_STRATEGY_BASE_H
#define TILEDB_STRATEGY_BASE_H
#include "tiledb/common/status.h"
#include "tiledb/sm/array_schema/dimension.h"
#include "tiledb/sm/misc/types.h"
namespace tiledb {
namespace sm {
class Array;
class ArraySchema;
class StorageManager;
class Subarray;
/** Processes read or write queries. */
class StrategyBase {
public:
/* ********************************* */
/* CONSTRUCTORS & DESTRUCTORS */
/* ********************************* */
/** Constructor. */
StrategyBase(
stats::Stats* stats,
StorageManager* storage_manager,
Array* array,
Config& config,
std::unordered_map<std::string, QueryBuffer>& buffers,
Subarray& subarray,
Layout layout);
/** Destructor. */
~StrategyBase() = default;
/* ********************************* */
/* API */
/* ********************************* */
/** Returns `stats_`. */
stats::Stats* stats() const;
/** Returns the configured offsets format mode. */
std::string offsets_mode() const;
/** Sets the offsets format mode. */
Status set_offsets_mode(const std::string& offsets_mode);
/** Returns `True` if offsets are configured to have an extra element. */
bool offsets_extra_element() const;
/** Sets if offsets are configured to have an extra element. */
Status set_offsets_extra_element(bool add_extra_element);
/** Returns the configured offsets bitsize */
uint32_t offsets_bitsize() const;
/** Sets the bitsize of offsets */
Status set_offsets_bitsize(const uint32_t bitsize);
protected:
/* ********************************* */
/* PROTECTED ATTRIBUTES */
/* ********************************* */
/** The class stats. */
stats::Stats* stats_;
/** The array. */
const Array* array_;
/** The array schema. */
const ArraySchema* array_schema_;
/** The config for query-level parameters only. */
Config& config_;
/**
* Maps attribute/dimension names to their buffers.
* `TILEDB_COORDS` may be used for the special zipped coordinates
* buffer.
* */
std::unordered_map<std::string, QueryBuffer>& buffers_;
/** The layout of the cells in the result of the subarray. */
Layout layout_;
/** The storage manager. */
StorageManager* storage_manager_;
/** The query subarray (initially the whole domain by default). */
Subarray& subarray_;
/** The offset format used for variable-sized attributes. */
std::string offsets_format_mode_;
/**
* If `true`, an extra element that points to the end of the values buffer
* will be added in the end of the offsets buffer of var-sized attributes
*/
bool offsets_extra_element_;
/** The offset bitsize used for variable-sized attributes. */
uint32_t offsets_bitsize_;
/* ********************************* */
/* PROTECTED METHODS */
/* ********************************* */
/**
* Gets statistics about the number of attributes and dimensions in
* the query.
*/
void get_dim_attr_stats() const;
};
} // namespace sm
} // namespace tiledb
#endif // TILEDB_STRATEGY_BASE_H | 29.059211 | 80 | 0.64614 |
89df695bf6520b327b1545bff46bb75be7da2282 | 5,156 | c | C | src/packet/packet_route.c | fredrikwidlund/libpacket | 6dda95e3b5de41d66c44dcc59d912d4a0ac48c33 | [
"MIT"
] | 1 | 2018-02-05T00:23:51.000Z | 2018-02-05T00:23:51.000Z | src/packet/packet_route.c | fredrikwidlund/libpacket | 6dda95e3b5de41d66c44dcc59d912d4a0ac48c33 | [
"MIT"
] | null | null | null | src/packet/packet_route.c | fredrikwidlund/libpacket | 6dda95e3b5de41d66c44dcc59d912d4a0ac48c33 | [
"MIT"
] | 1 | 2020-04-18T21:50:52.000Z | 2020-04-18T21:50:52.000Z | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <linux/rtnetlink.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include "packet_header.h"
#include "packet_route.h"
struct packet_route_request
{
struct nlmsghdr nlmsg;
struct rtmsg rtm;
uint8_t data[1024];
};
static int packet_route_resolve_ip_dst(packet_route *r, char *node)
{
struct addrinfo *ai;
struct sockaddr_in *sin;
int e;
e = getaddrinfo(node, NULL, (struct addrinfo []){{.ai_family = AF_INET}}, &ai);
if (e == -1 || !ai)
return -1;
sin = (struct sockaddr_in *) ai->ai_addr;
if (sin->sin_family == AF_INET)
r->ip_dst = sin->sin_addr.s_addr;
freeaddrinfo(ai);
return r->ip_dst ? 0 : -1;
}
static int packet_route_resolve_gateway(packet_route *r)
{
int s;
struct packet_route_request req;
struct rtattr *rta;
ssize_t n;
req = (struct packet_route_request) {
.nlmsg.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)),
.nlmsg.nlmsg_flags = NLM_F_REQUEST,
.nlmsg.nlmsg_type = RTM_GETROUTE,
.rtm.rtm_family = AF_INET
};
rta = RTM_RTA(&req.rtm);
rta->rta_type = RTA_DST;
rta->rta_len = RTA_LENGTH(sizeof r->ip_dst);
memcpy(RTA_DATA(rta), &r->ip_dst, sizeof r->ip_dst);
req.nlmsg.nlmsg_len += rta->rta_len;
s = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (s == -1)
return -1;
n = send(s, &req, req.nlmsg.nlmsg_len, 0);
if (n != -1)
n = recv(s, &req, sizeof(req), 0);
(void) close(s);
if (n == -1 || n < (ssize_t) NLMSG_LENGTH(sizeof(struct rtmsg)) || req.nlmsg.nlmsg_type == NLMSG_ERROR ||
n != req.nlmsg.nlmsg_len)
return -1;
for (rta = RTM_RTA(&req.rtm), n = NLMSG_PAYLOAD(&req.nlmsg, 0); RTA_OK(rta, n); rta = RTA_NEXT(rta, n))
switch (rta->rta_type)
{
case RTA_OIF:
if (rta->rta_len != RTA_LENGTH(sizeof r->index))
break;
memcpy(&r->index, RTA_DATA(rta), sizeof r->index);
break;
case RTA_GATEWAY:
if (rta->rta_len != RTA_LENGTH(sizeof r->gateway))
break;
memcpy(&r->gateway, RTA_DATA(rta), sizeof r->gateway);
break;
}
if (!r->gateway)
r->gateway = r->ip_dst;
return r->index && r->gateway ? 0 : -1;
}
static int packet_route_resolve_ether_src(packet_route *r)
{
struct ifreq ifr = {0};
int s, e;
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
return -1;
(void) if_indextoname(r->index, ifr.ifr_name);
e = ioctl(s, SIOCGIFHWADDR, &ifr);
(void) close(s);
if (e == -1)
return -1;
r->link_type = ifr.ifr_hwaddr.sa_family;
if (r->link_type != ARPHRD_ETHER && r->link_type != ARPHRD_LOOPBACK)
return -1;
memcpy(r->ether_src, ifr.ifr_hwaddr.sa_data, sizeof r->ether_src);
return 0;
}
static int packet_route_resolve_ip_src(packet_route *r)
{
struct ifreq ifr = {.ifr_addr.sa_family = AF_INET};
int s, e;
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
return -1;
(void) if_indextoname(r->index, ifr.ifr_name);
e = ioctl(s, SIOCGIFADDR, &ifr);
(void) close(s);
if (e == -1)
return -1;
r->ip_src = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
return 0;
}
static int packet_route_resolve_ether_dst(packet_route *r)
{
struct arpreq arp = {0};
int s, e;
if (r->link_type == ARPHRD_LOOPBACK)
return 0;
arp.arp_pa.sa_family = AF_INET;
((struct sockaddr_in *) &arp.arp_pa)->sin_addr.s_addr = r->gateway;
arp.arp_ha.sa_family = r->link_type;
(void) if_indextoname(r->index, arp.arp_dev);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
return -1;
e = ioctl(s, SIOCGARP, &arp);
(void) close(s);
if (e == -1 || (arp.arp_flags & ATF_COM) == 0)
return -1;
memcpy(r->ether_dst, arp.arp_ha.sa_data, sizeof r->ether_dst);
return 0;
}
int packet_route_construct(packet_route *r, char *node)
{
int e;
*r = (packet_route) {0};
e = packet_route_resolve_ip_dst(r, node);
if (e == 0)
e = packet_route_resolve_gateway(r);
if (e == 0)
e = packet_route_resolve_ether_src(r);
if (e == 0)
e = packet_route_resolve_ip_src(r);
if (e == 0)
e = packet_route_resolve_ether_dst(r);
return e;
}
void packet_route_debug(packet_route *r, FILE *out)
{
char name[IFNAMSIZ];
(void) if_indextoname(r->index, name);
(void) fprintf(out, "[route %s ", name);
(void) fprintf(out, "%s/", ether_ntoa((struct ether_addr *) r->ether_src));
(void) fprintf(out, "%s -> ", inet_ntoa(*(struct in_addr *) &r->ip_src));
(void) fprintf(out, "%s/", ether_ntoa((struct ether_addr *) r->ether_dst));
(void) fprintf(out, "%s", inet_ntoa(*(struct in_addr *) &r->ip_dst));
(void) fprintf(out, "(%s)]\n", inet_ntoa(*(struct in_addr *) &r->gateway));
}
void packet_route_ether(packet_route *r, struct ethhdr *h, uint16_t proto)
{
packet_header_ether(h, r->ether_src, r->ether_dst, proto);
}
void packet_route_ip(packet_route *r, struct iphdr *ip, size_t size, int protocol)
{
packet_header_ip(ip, size, protocol, r->ip_src, r->ip_dst);
}
| 25.27451 | 107 | 0.641777 |
c5c69bf1ee7a99c3bfee03c18172aeb1e99cea66 | 474 | h | C | mock/nosync/activity-handle-mock.h | nokia/libNoSync | af0f0e5b738feac8c42c357c9dbdf3dc7e541a76 | [
"BSD-3-Clause"
] | 2 | 2018-04-28T18:29:08.000Z | 2018-07-03T08:16:34.000Z | mock/nosync/activity-handle-mock.h | nokia/libNoSync | af0f0e5b738feac8c42c357c9dbdf3dc7e541a76 | [
"BSD-3-Clause"
] | null | null | null | mock/nosync/activity-handle-mock.h | nokia/libNoSync | af0f0e5b738feac8c42c357c9dbdf3dc7e541a76 | [
"BSD-3-Clause"
] | 1 | 2018-04-27T07:53:16.000Z | 2018-04-27T07:53:16.000Z | // This file is part of libnosync library. See LICENSE file for license details.
#ifndef NOSYNC__ACTIVITY_HANDLE_MOCK_H
#define NOSYNC__ACTIVITY_HANDLE_MOCK_H
#include <gmock/gmock.h>
#include <nosync/activity-handle.h>
namespace nosync
{
class activity_handle_mock : public activity_handle
{
public:
activity_handle_mock() = default;
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD0(disable, void());
};
}
#endif /* NOSYNC__ACTIVITY_HANDLE_MOCK_H */
| 19.75 | 80 | 0.770042 |
a929275f9777777a6b5f9a1180fc2bd5751c57d8 | 7,282 | c | C | engine/SE/Plyfile/plyremoveface.c | Akalu/phy-engine | 6dfc7467675b7de6607cf05cd06923479811ad93 | [
"MIT"
] | 1 | 2021-07-19T04:37:24.000Z | 2021-07-19T04:37:24.000Z | engine/SE/Plyfile/plyremoveface.c | akalu/phy-engine | 6dfc7467675b7de6607cf05cd06923479811ad93 | [
"MIT"
] | null | null | null | engine/SE/Plyfile/plyremoveface.c | akalu/phy-engine | 6dfc7467675b7de6607cf05cd06923479811ad93 | [
"MIT"
] | null | null | null |
#include <stdio.h>
#include <math.h>
#include <strings.h>
#include <ply.h>
#define FALSE 0
#define TRUE 1
#define X 0
#define Y 1
#define Z 2
double LAmag,LAsum; int LAi,LAj,LAk;
#define VEC3_ZERO(a) { a[0]=a[1]=a[2]=0; }
#define VEC3_NEG(a,b) { a[0]= -b[0]; a[1]= -b[1];a[2]= -b[2];}
#define VEC3_V_OP_V(a,b,op,c) { a[0] = b[0] op c[0]; \
a[1] = b[1] op c[1]; \
a[2] = b[2] op c[2]; \
}
#define VEC3_ASN_OP(a,op,b) {a[0] op b[0]; a[1] op b[1]; a[2] op b[2];}
#define DOTPROD3(a, b) (a[0]*b[0] + a[1]*b[1] + a[2]*b[2])
#define CROSSPROD3(a,b,c) {a[0]=b[1]*c[2]-b[2]*c[1]; \
a[1]=b[2]*c[0]-b[0]*c[2]; \
a[2]=b[0]*c[1]-b[1]*c[0];}
#define NORMALIZE3(a) {LAmag=1./sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);\
a[0] *= LAmag; a[1] *= LAmag; a[2] *= LAmag;}
#define ZERO3_TOL(a, tol) { a[0] = ((a[0]<tol)&&(a[0]>-tol))?0.0:a[0];\
a[1] = ((a[1]<tol)&&(a[1]>-tol))?0.0:a[1];\
a[2] = ((a[2]<tol)&&(a[2]>-tol))?0.0:a[2];\
}
#define SQ_DIST3(a, b) ((a[0]-b[0])*(a[0]-b[0]) + \
(a[1]-b[1])*(a[1]-b[1]) + \
(a[2]-b[2])*(a[2]-b[2]))
#define FMAX(x,y) ((x)>(y) ? (x) : (y))
#define FMIN(x,y) ((x)<(y) ? (x) : (y))
#define FP_EQ_EPS( a, b, c ) ((((a) - (b)) <= (c)) && (((a) - (b)) >= -(c)))
typedef float Point[3];
typedef float Vector[3];
typedef struct Vertex {
int id;
unsigned char deleted;
void *other_props;
} Vertex;
typedef struct Face {
int id;
unsigned char nverts;
int *verts;
void *other_props;
unsigned char deleted;
} Face;
PlyProperty vert_props[1];
PlyProperty face_props[] = {
{"vertex_indices", PLY_INT, PLY_INT, offsetof(Face,verts),
1, PLY_UCHAR, PLY_UCHAR, offsetof(Face,nverts)},
};
static int nverts,nfaces;
static Vertex **vlist;
static Face **flist;
static PlyOtherElems *other_elements = NULL;
static PlyOtherProp *vert_other,*face_other,*edge_other;
static int nelems;
static char **element_list;
static int num_comments;
static char **comments;
static int num_obj_info;
static char **obj_info;
static int file_type;
int has_fverts;
char **deleted_faces;
int num_deleted_faces;
main(int argc, char *argv[])
{
get_options(argc, argv);
read_file();
delete_faces();
write_file();
}
get_options(int argc, char *argv[])
{
char *s;
char *progname;
int dummy;
progname = argv[0];
while (--argc > 0 && (*++argv)[0]=='-')
{
for (s = argv[0]+1; *s; s++)
switch (*s)
{
case 'f':
++argv;
deleted_faces = argv;
for (num_deleted_faces = 0;
((*argv) && (sscanf((*argv), "%d\n", &dummy) == 1));
num_deleted_faces++)
++argv;
--argv;
argc -= num_deleted_faces;
break;
default:
usage (progname);
exit (-1);
break;
}
}
}
usage(char *progname)
{
fprintf(stderr, "usage: %s [flags] <in.ply >out.ply\n", progname);
fprintf(stderr, " -- optional flags -- \n");
fprintf(stderr, " -a : average neighboring vertex curvatures\n");
}
delete_faces()
{
int i, j;
int id;
Face *face;
for (i=0; i<nfaces; i++)
flist[i]->deleted = FALSE;
for (i=0; i<num_deleted_faces; i++)
{
if ((sscanf(deleted_faces[i], "%d", &id) != 1) ||
(id < 0) || (id >= nfaces))
{
fprintf(stderr, "Invalid face id\n");
exit(-1);
}
flist[id]->deleted = TRUE;
}
for (i=0; i<nverts; i++)
vlist[i]->deleted = TRUE;
for (i=0; i<nfaces; i++)
{
face = flist[i];
if (face->deleted == TRUE)
continue;
for (j=0; j<face->nverts; j++)
vlist[face->verts[j]]->deleted = FALSE;
}
}
read_file()
{
int i,j,k;
PlyFile *ply;
int nprops;
int num_elems;
PlyProperty **plist;
char *elem_name;
float version;
ply = ply_read (stdin, &nelems, &element_list);
ply_get_info (ply, &version, &file_type);
for (i = 0; i < nelems; i++) {
elem_name = element_list[i];
plist = ply_get_element_description (ply, elem_name, &num_elems, &nprops);
if (equal_strings ("vertex", elem_name)) {
vlist = (Vertex **) malloc (sizeof (Vertex *) * num_elems);
nverts = num_elems;
vert_other = ply_get_other_properties (ply, elem_name,
offsetof(Vertex,other_props));
for (j = 0; j < num_elems; j++) {
vlist[j] = (Vertex *) malloc (sizeof (Vertex));
ply_get_element (ply, (void *) vlist[j]);
vlist[j]->id = j;
}
}
else if (equal_strings ("face", elem_name)) {
flist = (Face **) malloc (sizeof (Face *) * num_elems);
nfaces = num_elems;
has_fverts = FALSE;
for (j=0; j<nprops; j++)
{
if (equal_strings("vertex_indices", plist[j]->name))
{
ply_get_property (ply, elem_name, &face_props[0]);
has_fverts = TRUE;
}
}
face_other = ply_get_other_properties (ply, elem_name,
offsetof(Face,other_props));
if (!has_fverts)
{
fprintf(stderr, "Faces must have vertex indices\n");
exit(-1);
}
for (j = 0; j < num_elems; j++) {
flist[j] = (Face *) malloc (sizeof (Face));
ply_get_element (ply, (void *) flist[j]);
flist[j]->id = j;
}
}
else
other_elements = ply_get_other_element (ply, elem_name, num_elems);
}
comments = ply_get_comments (ply, &num_comments);
obj_info = ply_get_obj_info (ply, &num_obj_info);
ply_close (ply);
}
write_file()
{
int i,j,k;
PlyFile *ply;
int num_elems;
char *elem_name;
int new_nverts, new_nfaces;
Face *face;
Vertex *vert;
static char *known_elements[] = {"vertex", "face"};
ply = ply_write (stdout, 2, known_elements, file_type);
for (i=0, new_nverts=0; i<nverts; i++)
{
vert = vlist[i];
if (vert->deleted == TRUE)
continue;
vert->id = new_nverts++;
}
for (i=0, new_nfaces=0; i<nfaces; i++)
{
face = flist[i];
if (face->deleted == TRUE)
continue;
for (j=0; j<face->nverts; j++)
face->verts[j] = vlist[face->verts[j]]->id;
new_nfaces++;
}
ply_element_count (ply, "vertex", new_nverts);
ply_describe_other_properties (ply, vert_other, offsetof(Vertex,other_props));
ply_element_count (ply, "face", new_nfaces);
ply_describe_property (ply, "face", &face_props[0]);
ply_describe_other_properties (ply, face_other, offsetof(Face,other_props));
ply_describe_other_elements (ply, other_elements);
for (i = 0; i < num_comments; i++)
ply_put_comment (ply, comments[i]);
for (i = 0; i < num_obj_info; i++)
ply_put_obj_info (ply, obj_info[i]);
ply_header_complete (ply);
ply_put_element_setup (ply, "vertex");
for (i = 0; i < nverts; i++)
if (vlist[i]->deleted == FALSE)
ply_put_element (ply, (void *) vlist[i]);
ply_put_element_setup (ply, "face");
for (i = 0; i < nfaces; i++)
if (flist[i]->deleted == FALSE)
ply_put_element (ply, (void *) flist[i]);
ply_put_other_elements (ply);
ply_close (ply);
}
| 20.805714 | 80 | 0.54312 |
a9f74ef73a977a8f985a19478b7d86ac0cf640e1 | 1,232 | h | C | skeletons/CoMD/src/initAtoms.h | jjwilke/sst-macro | d5139c0e2e6c0055bd2ef6dc9ac565a6ec1fd4d9 | [
"BSD-Source-Code"
] | null | null | null | skeletons/CoMD/src/initAtoms.h | jjwilke/sst-macro | d5139c0e2e6c0055bd2ef6dc9ac565a6ec1fd4d9 | [
"BSD-Source-Code"
] | null | null | null | skeletons/CoMD/src/initAtoms.h | jjwilke/sst-macro | d5139c0e2e6c0055bd2ef6dc9ac565a6ec1fd4d9 | [
"BSD-Source-Code"
] | null | null | null | /// \file
/// Initialize the atom configuration.
#ifndef __INIT_ATOMS_H
#define __INIT_ATOMS_H
#include "mytype.h"
struct SimFlatSt;
struct LinkCellSt;
/// Atom data
typedef struct AtomsSt
{
// atom-specific data
int nLocal; //!< total number of atoms on this processor
long long nGlobal; //!< total number of atoms in simulation
#pragma sst null_variable delete_all
int* gid; //!< A globally unique id for each atom
#pragma sst null_variable delete_all
int* iSpecies; //!< the species index of the atom
#pragma sst null_variable delete_all
real3* r; //!< positions
#pragma sst null_variable delete_all
real3* p; //!< momenta of atoms
#pragma sst null_variable delete_all
real3* f; //!< forces
#pragma sst null_variable delete_all
real_t* U; //!< potential energy per atom
} Atoms;
/// Allocates memory to store atom data.
Atoms* initAtoms(struct LinkCellSt* boxes);
void destroyAtoms(struct AtomsSt* atoms);
void createFccLattice(int nx, int ny, int nz, real_t lat, struct SimFlatSt* s);
void setVcm(struct SimFlatSt* s, real_t vcm[3]);
void setTemperature(struct SimFlatSt* s, real_t temperature);
void randomDisplacements(struct SimFlatSt* s, real_t delta);
#endif
| 28.651163 | 79 | 0.724838 |
1070c799bae50000e95a0e791ff37bbcdd169787 | 1,002 | c | C | libft/ft_tolower.c | k-allard/raycasting_game | d8499af610477dbd16a0d16ef81dbc73d5897013 | [
"MIT"
] | null | null | null | libft/ft_tolower.c | k-allard/raycasting_game | d8499af610477dbd16a0d16ef81dbc73d5897013 | [
"MIT"
] | null | null | null | libft/ft_tolower.c | k-allard/raycasting_game | d8499af610477dbd16a0d16ef81dbc73d5897013 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_tolower.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kallard <kallard@student.21-school.ru> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/30 21:18:06 by kallard #+# #+# */
/* Updated: 2020/04/30 21:27:49 by kallard ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_tolower(int ch)
{
if (ch >= 'A' && ch <= 'Z')
return (ch + 32);
return (ch);
}
| 47.714286 | 80 | 0.162675 |
b7c03043879948fadaf8347a25fc25bdc6d630fd | 1,387 | h | C | wikiswift/Business_Layout/Common/Utilities/NSBundle+WMFInfoUtils.h | trujunzhang/wikiswift | ef9d41e7cf96fd7b05eb83728cfbed5283d1ac0d | [
"MIT"
] | 1 | 2016-10-10T14:39:30.000Z | 2016-10-10T14:39:30.000Z | Wikipedia/Code/NSBundle+WMFInfoUtils.h | jindulys/Wikipedia | 78609a2397ff1d5826443a65d40ebd491e68678c | [
"MIT"
] | null | null | null | Wikipedia/Code/NSBundle+WMFInfoUtils.h | jindulys/Wikipedia | 78609a2397ff1d5826443a65d40ebd491e68678c | [
"MIT"
] | null | null | null | //
// NSBundle+WMFInfoUtils.h
// Wikipedia
//
// Created by Brian Gerstle on 5/1/15.
// Copyright (c) 2015 Wikimedia Foundation. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSBundle (WMFInfoUtils)
- (NSString*)wmf_bundleName;
///
/// @name App Version Information
///
/// @return The value for Info.plist key `CFBundleIdentifier`, i.e. the app's bundle identifier.
- (NSString*)wmf_bundleIdentifier;
/// @return `YES` if `wmf_bundleIdentifier` ends in "wikipedia", otherwise `NO`.
- (BOOL)wmf_isAppStoreBundleIdentifier;
/// @return The value for Info.plist key `CFBundleShortVersionString`, i.e. the "public" app version.
- (NSString*)wmf_shortVersionString;
/// @return The value for Info.plist key `CFBundleVersion`, i.e. the build number.
- (NSString*)wmf_bundleVersion;
/// @return A string which represents the full app verison, including the build number: `M.m.p.build`.
- (NSString*)wmf_debugVersion;
/// @return A string that shows the full version in "TestFlight/Apple" format: `M.m.p (build)`.
- (NSString*)wmf_releaseVersion;
/// @return Either `wmf_releaseVersion` or `wmf_debugVersion` depending on the bundle identifier.
- (NSString*)wmf_versionForCurrentBundleIdentifier;
///
/// @name App Configuration
///
- (BOOL)wmf_shouldShowDebugMenu;
/// @return HockeyApp ID for crash reports
- (NSString*)wmf_hockeyappIdentifier;
@end
| 27.74 | 102 | 0.736121 |
2e608bdd9aa78c411f4a973caf511eb342776783 | 675 | h | C | src/include/menu.h | attilathedud/Clunk | 3d806e00253fafdef954603e83c6df27cb7eada3 | [
"Apache-2.0"
] | 3 | 2020-04-30T18:04:16.000Z | 2020-07-07T20:19:28.000Z | src/include/menu.h | attilathedud/Clunk | 3d806e00253fafdef954603e83c6df27cb7eada3 | [
"Apache-2.0"
] | 1 | 2018-05-28T00:49:02.000Z | 2018-12-24T19:17:46.000Z | src/include/menu.h | attilathedud/Clunk | 3d806e00253fafdef954603e83c6df27cb7eada3 | [
"Apache-2.0"
] | null | null | null | #ifndef MENU_H
#define MENU_H
#include "storage.h"
#include "editor.h"
#define KEY_UPPER_Y 89
#define KEY_LOWER_Y 121
#define KEY_LOWER_N 110
#define KEY_UPPER_N 78
#define KEY_ESC 27
#define RENAME_BUFFER_LEN 128
typedef struct
{
Storage s;
int selected_file_index;
int scroll_offset;
int is_deleting_file;
int is_renaming_file;
int has_changed_file;
int display_about_screen;
char rename_buffer[RENAME_BUFFER_LEN];
char *notes_directory;
} Menu;
int menu_init(Menu *, char *);
int menu_handle_input(Menu *, Editor *, const int);
void menu_print(Menu *);
void menu_cleanup(Menu *);
void menu_save_note(Menu *, const char *);
#endif
| 19.285714 | 51 | 0.740741 |
2ec88d2889151adc37fb4ed31583ffc29c90301f | 256 | c | C | SingleSource/UnitTests/2006-02-04-DivRem.c | gmlueck/llvm-test-suite | 7ff842b8fec970561fed78c9347e496538cf74f5 | [
"Apache-2.0"
] | 70 | 2019-01-15T03:03:55.000Z | 2022-03-28T02:16:13.000Z | SingleSource/UnitTests/2006-02-04-DivRem.c | gmlueck/llvm-test-suite | 7ff842b8fec970561fed78c9347e496538cf74f5 | [
"Apache-2.0"
] | 519 | 2020-09-15T07:40:51.000Z | 2022-03-31T20:51:15.000Z | SingleSource/UnitTests/2006-02-04-DivRem.c | gmlueck/llvm-test-suite | 7ff842b8fec970561fed78c9347e496538cf74f5 | [
"Apache-2.0"
] | 117 | 2020-06-24T13:11:04.000Z | 2022-03-23T15:44:23.000Z | #include <stdio.h>
void test(unsigned X, unsigned Y) {
printf("%u %u %u %u\n", X, Y, X / (8 << (Y&15)), X % (8 << (Y&15)));
}
int i;
int main(void) {
long long l;
for(i=10; i<139045193; i*=-3) {
test(i, i^12345);
i++;
}
return(0);
}
| 13.473684 | 70 | 0.480469 |
c8d5484ad4934f5d5d546c254e18b81000ebf9b3 | 530 | h | C | kongxia/Views/Common/public/ZZMoneyTextField.h | zuwome/kongxia | 87f6f33410da1fedd315089c9a92917b5226125d | [
"MIT"
] | null | null | null | kongxia/Views/Common/public/ZZMoneyTextField.h | zuwome/kongxia | 87f6f33410da1fedd315089c9a92917b5226125d | [
"MIT"
] | 1 | 2022-01-08T05:58:03.000Z | 2022-01-08T05:58:03.000Z | kongxia/Views/Common/public/ZZMoneyTextField.h | zuwome/kongxia | 87f6f33410da1fedd315089c9a92917b5226125d | [
"MIT"
] | null | null | null | //
// ZZMoneyTextField.h
// zuwome
//
// Created by angBiu on 2016/11/11.
// Copyright © 2016年 zz. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ZZMoneyTextField : UITextField <UITextFieldDelegate>
@property (nonatomic, strong) NSString *lastStr;
@property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, assign) BOOL pure;
@property (nonatomic, assign) BOOL noEndEditing;
@property (nonatomic, copy) dispatch_block_t valueChanged;
@property (nonatomic, copy) dispatch_block_t touchReturn;
@end
| 23.043478 | 63 | 0.750943 |
ae84d904e2e9c30d6c6f966bc91e817c7ee382f1 | 5,407 | h | C | dependencies/slicksocket/include/slicksocket/http_client.h | kzhdev/zorro_websockets_proxy | 89e60400178e2a7132f1c0d739ceaac3f4758a6f | [
"MIT"
] | 1 | 2021-03-12T22:07:49.000Z | 2021-03-12T22:07:49.000Z | dependencies/slicksocket/include/slicksocket/http_client.h | kzhdev/zorro_websockets_proxy | 89e60400178e2a7132f1c0d739ceaac3f4758a6f | [
"MIT"
] | null | null | null | dependencies/slicksocket/include/slicksocket/http_client.h | kzhdev/zorro_websockets_proxy | 89e60400178e2a7132f1c0d739ceaac3f4758a6f | [
"MIT"
] | null | null | null | /***
* MIT License
*
* Copyright (c) 2018-2021 SlickTech <support@slicktech.org>
*
* 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 SLICK_HTTP_CLIENT_H
#define SLICK_HTTP_CLIENT_H
#include <string>
#include <unordered_map>
#include <functional>
#include <sstream>
#include <memory>
#include <thread>
namespace slick {
namespace net {
/**
* Http Request
*/
struct http_request {
private:
std::string body_;
std::string content_type_;
/**
* NOTE: Header name must end with ":"
*/
std::unordered_map<std::string, std::string> headers_;
public:
http_request() = default;
/**
* Add a request header
* @param key Header name
* @param value Header value
*/
void add_header(std::string key, std::string value) noexcept {
if (key.back() != ':') {
key.append(":");
}
headers_.emplace(std::move(key), std::move(value));
}
/**
* Add request body
* @param body Body content
* @param content_type Content type
*/
void add_body(std::string body, std::string content_type) noexcept {
body_ = std::move(body);
content_type_ = std::move(content_type);
}
/**
* Request Headers
* @return All request headers
*/
const std::unordered_map<std::string, std::string>& headers() const noexcept { return headers_; }
/**
* Request Body
* @return Request body content
*/
const std::string& body() const noexcept { return body_; }
/**
* Content Type
* @return Request body content type
*/
const std::string& content_type() const noexcept { return content_type_; }
};
/**
* HTTP Response
*/
struct http_response {
int32_t status = 0;
std::string content_type;
std::string response_text;
http_response(int32_t stat, std::string &&type, std::string &&response) noexcept
: status(stat), content_type(std::move(type)), response_text(std::move(response)) {}
};
// forward declaration
class socket_service;
/**
* HTTP Client
*/
class http_client {
socket_service* service_;
std::string address_;
std::string origin_;
int16_t port_ = -1;
public:
using AsyncCallback = std::function<void(http_response)>;
/**
* Constructor
* @param address Request domain url.
* @param origin The Origin of http request. Default to "".
* @param ca_file_path ssl certificate file path. Default to "".
* In most of case, system should be able to find a suitable ssl certificate.
* If it can't find ssl certificate, pass in ca_file_path to specify a ssl certificate file.
* @param cpu_affinity Pin service thread to specified CPU. Default to -1 means not pin to specific CPU.
* @param use_global_thread Use
*/
http_client(std::string address,
std::string origin = "",
std::string ca_file_path = "",
int32_t cpu_affinity = -1,
bool use_global_thread = false) noexcept;
virtual ~http_client() noexcept;
// Synchronous Requests
/**
* Synchronous Request
* @param method HTTP request method. e.g. "GET", "POST', "PUT", "DELETE" etc.
* NOTE: method must be all UPPER CASE
* @param path Request path.
* @param request Http request struct.
* @return Request response.
*/
http_response request(const char* method, std::string path, const std::shared_ptr<http_request>& request = nullptr);
// Async requests
/**
* Asynchronous Request
*
* @param method HTTP request method. e.g. "GET", "POST', "PUT", "DELETE" etc.
* NOTE: method must be all UPPER CASE
* @param path Request path.
* @param callback Asynchronous callback function.
*/
void request(const char* method, std::string path, AsyncCallback&& callback);
/**
* Asynchronous Request
*
* @param method HTTP request method. e.g. "GET", "POST', "PUT", "DELETE" etc.
* NOTE: method must be all UPPER CASE
* @param path Request path.
* @param request Http request struct.
* @param callback Asynchronous callback function.
*/
void request(const char* method, std::string path, const std::shared_ptr<http_request>& request, AsyncCallback&& callback);
};
}
}
#endif //SLICK_HTTP_CLIENT_H
| 29.708791 | 125 | 0.653782 |
64bbd3be26485e595921855edd0210c00075c98f | 978 | c | C | ft_putstr.c | nsierra-/libft | 9fbc2d973581788a522c92cea90f4f7de34544f7 | [
"MIT"
] | null | null | null | ft_putstr.c | nsierra-/libft | 9fbc2d973581788a522c92cea90f4f7de34544f7 | [
"MIT"
] | null | null | null | ft_putstr.c | nsierra-/libft | 9fbc2d973581788a522c92cea90f4f7de34544f7 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nsierra- <nsierra-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/22 23:24:27 by nsierra- #+# #+# */
/* Updated: 2013/11/22 23:25:21 by nsierra- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putstr(const char *s)
{
while (*s)
ft_putchar(*s++);
}
| 48.9 | 80 | 0.155419 |
afe7bb54e245f5192b3f6a5a1e584c761889df77 | 949 | h | C | gEarth.Pack/MeasureAreaHandler.h | songgod/gEarth | e4ea0fa15a40f08481c7ea7e42e6f4ace8659984 | [
"MIT"
] | 5 | 2021-06-16T06:24:29.000Z | 2022-03-10T03:41:44.000Z | gEarth.Pack/MeasureAreaHandler.h | songgod/gEarth | e4ea0fa15a40f08481c7ea7e42e6f4ace8659984 | [
"MIT"
] | 1 | 2020-10-14T14:20:58.000Z | 2020-10-14T14:20:58.000Z | gEarth.Pack/MeasureAreaHandler.h | songgod/gEarth | e4ea0fa15a40f08481c7ea7e42e6f4ace8659984 | [
"MIT"
] | 2 | 2021-06-16T06:24:32.000Z | 2021-08-02T09:05:42.000Z | #pragma once
#include "MeasureBaseHandler.h"
namespace gEarthPack
{
class MeasureAreaHandler : public MeasureBaseHandler
{
public:
MeasureAreaHandler();
~MeasureAreaHandler();
public:
class MeasureAreaResultHandler : public osg::Referenced
{
public:
virtual void onAreaChanged(MeasureAreaHandler* sender, double area) = 0;
};
public:
typedef std::vector<osg::ref_ptr<MeasureAreaResultHandler>> ResultHandlers;
ResultHandlers& getResHandlers() { return _reshandlers; }
const ResultHandlers& getResHandlers() const { return _reshandlers; }
void setSurface(bool b);
bool getSurface() const { return _bsurface; }
public:
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa);
virtual osgEarth::Features::Feature* createFeature();
virtual void fireMeasureChanged();
virtual void clear();
private:
bool _bsurface;
bool _bnewmeasure;
ResultHandlers _reshandlers;
};
}
| 21.088889 | 85 | 0.74921 |
148a16d20dca1ab29e038c872a3e0e5c09473e1b | 5,656 | c | C | plugins/eppclient/src/eppclient.c | yschaeff/opendnssec | ccc7948ce20fa24c45f28c6b02eff4d7af039445 | [
"BSD-2-Clause"
] | null | null | null | plugins/eppclient/src/eppclient.c | yschaeff/opendnssec | ccc7948ce20fa24c45f28c6b02eff4d7af039445 | [
"BSD-2-Clause"
] | 3 | 2017-10-23T12:14:51.000Z | 2017-12-13T09:14:39.000Z | plugins/eppclient/src/eppclient.c | yschaeff/opendnssec | ccc7948ce20fa24c45f28c6b02eff4d7af039445 | [
"BSD-2-Clause"
] | null | null | null | /*
* $Id$
*
* Copyright (c) 2010 .SE (The Internet Infrastructure Foundation).
* All rights reserved.
*
* Written by Björn Stenberg <bjorn@haxx.se> for .SE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <ldns/ldns.h>
#include "eppconfig.h"
#define MIN(_x_, _y_) (_x_ < _y_ ? _x_ : _y_)
void usage()
{
printf("OpenDNSSEC EPP plugin\n");
printf("Usage: eppclient [OPTIONS]\n");
printf("Options:\n");
printf(" -h Show this help screen.\n");
printf(" --help Show this help screen.\n");
printf(" -v Show version info.\n");
printf(" --version Show version info.\n");
printf("\n");
printf("\n");
printf("eppclient reads DNSKEY RR lines from stdin and sends them to eppclientd.\n");
printf("More information is available in the corresponding man page.\n");
}
enum {
OPT_HELP = 0x100,
OPT_VERSION
};
static const struct option long_options[] = {
{ "help", 0, NULL, OPT_HELP },
{ "version", 0, NULL, OPT_VERSION },
{ NULL, 0, NULL, 0 }
};
int main(int argc, char *argv[])
{
int opt;
int option_index = 0;
while ((opt = getopt_long(argc, argv, "hv", long_options, &option_index)) != -1) {
switch (opt) {
case OPT_VERSION:
case 'v':
printf("%s\n", PACKAGE_VERSION);
exit(0);
break;
case OPT_HELP:
case 'h':
default:
usage();
exit(0);
break;
}
}
read_config();
char* pipename = config_value("/eppclient/pipe");
int fd = open(pipename, O_RDWR);
if (fd < 0) {
perror(pipename);
exit(-1);
}
int linenum = 1;
char line[1024];
ldns_rr* first_rr = NULL;
ldns_buffer* outbuf = ldns_buffer_new(1024);
while (fgets(line, sizeof line, stdin)) {
char* eol = strchr(line, '\n');
if (eol)
*eol = 0;
/* parse it to find errors */
ldns_rr* rr;
ldns_status rc = ldns_rr_new_frm_str(&rr, line, 0, NULL, NULL);
if (rc != LDNS_STATUS_OK) {
fprintf(stderr, "Error in line %d: %s\n",
linenum, ldns_get_errorstr_by_id(rc));
return -1;
}
/* we only support DNSKEY right now */
if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) {
fprintf(stderr,
"Error in line %d: Only RR type DNSKEY is supported.\n",
linenum);
ldns_rr_free(rr);
return -1;
}
if (linenum == 1) {
/* keep first RR for zone name */
first_rr = rr;
}
else {
/* check that this RR is the same zone as the first RR */
ldns_rdf* owner1 = ldns_rr_owner(rr);
ldns_buffer* obuf1 = ldns_buffer_new(256);
ldns_rdf2buffer_str(obuf1, owner1);
ldns_rdf* owner2 = ldns_rr_owner(first_rr);
ldns_buffer* obuf2 = ldns_buffer_new(256);
ldns_rdf2buffer_str(obuf2, owner2);
if ((obuf1->_position != obuf2->_position) ||
memcmp(obuf1->_data, obuf2->_data, obuf1->_position))
{
fprintf(stderr,
"Error in line %d: owner mismatch: '%*s' vs '%*s'\n",
linenum,
(int)obuf1->_position, obuf1->_data,
(int)obuf2->_position, obuf2->_data);
ldns_buffer_free(obuf1);
ldns_buffer_free(obuf2);
return -1;
}
ldns_buffer_free(obuf1);
ldns_buffer_free(obuf2);
ldns_rr_free(rr);
}
ldns_buffer_printf(outbuf, "%s\n", line);
linenum++;
}
ldns_rr_free(first_rr);
int len = outbuf->_position;
int rc = write(fd, outbuf->_data, len);
if (rc < len) {
if (rc < 0)
perror(pipename);
else
fprintf(stderr,
"Error: Short write to pipe. Only %d of %d bytes written.\n",
rc, len);
return -1;
}
ldns_buffer_free(outbuf);
close(fd);
return 0;
}
| 31.076923 | 89 | 0.564356 |
bb44db9cede5de20efc6e77089e870b9b6ac1b69 | 1,077 | h | C | src/rendering/shadow/pssm_shadow_mapping.h | krait-games/hyperion-engine | 5c52085658630fbf0992f794ecfcb25325b80b1c | [
"MIT"
] | 21 | 2022-01-23T15:20:59.000Z | 2022-03-31T22:10:14.000Z | src/rendering/shadow/pssm_shadow_mapping.h | krait-games/hyperion-engine | 5c52085658630fbf0992f794ecfcb25325b80b1c | [
"MIT"
] | 2 | 2022-01-30T22:24:58.000Z | 2022-03-28T02:37:07.000Z | src/rendering/shadow/pssm_shadow_mapping.h | krait-games/hyperion-engine | 5c52085658630fbf0992f794ecfcb25325b80b1c | [
"MIT"
] | 2 | 2022-02-10T13:55:26.000Z | 2022-03-31T22:10:16.000Z | #ifndef PSSM_SHADOW_MAPPING_H
#define PSSM_SHADOW_MAPPING_H
#include "shadow_mapping.h"
#include "../renderer.h"
#include "../renderable.h"
#include "../camera/camera.h"
#include <vector>
#include <memory>
namespace hyperion {
class Shader;
class PssmShadowMapping : public Renderable {
public:
PssmShadowMapping(int num_splits, double max_dist);
~PssmShadowMapping() = default;
int NumSplits() const;
void SetLightDirection(const Vector3 &dir);
inline const Vector3 &GetOrigin() const { return m_origin; }
void SetOrigin(const Vector3 &origin);
inline bool IsVarianceShadowMapping() const { return m_is_variance_shadow_mapping; }
void SetVarianceShadowMapping(bool value);
virtual void Render(Renderer *renderer, Camera *cam) override;
private:
const int m_num_splits;
const double m_max_dist;
bool m_is_variance_shadow_mapping;
std::vector<std::shared_ptr<ShadowMapping>> m_shadow_renderers;
Vector3 m_origin;
virtual std::shared_ptr<Renderable> CloneImpl() override;
};
} // namespace hyperion
#endif
| 23.933333 | 88 | 0.744661 |
af41ec139e65519f62667883fd7da045054143a5 | 431 | h | C | dkk_lib/include/Driver.h | mjf-89/DistributedKernelKmeans | ca6daa81cd51a0f2400a111c5d10a9ef144f1574 | [
"MIT"
] | null | null | null | dkk_lib/include/Driver.h | mjf-89/DistributedKernelKmeans | ca6daa81cd51a0f2400a111c5d10a9ef144f1574 | [
"MIT"
] | null | null | null | dkk_lib/include/Driver.h | mjf-89/DistributedKernelKmeans | ca6daa81cd51a0f2400a111c5d10a9ef144f1574 | [
"MIT"
] | null | null | null | #ifndef DKK_DRIVER_H
#define DKK_DRIVER_H
#include "Types.h"
#include "WindowsExport.h"
#include "Unit.h"
#include "Array2D.h"
#include "DistributedArray2D.h"
namespace DKK{
class DKK_EXPORT Driver : public Unit{
public:
const std::string &getType(){
static std::string type = "DRIVER";
return type;
}
virtual void execute(Reader &reader, Kernel &kernel, Initializer &initializer, Iterator &iterator) = 0;
};
}
#endif
| 17.24 | 104 | 0.728538 |
e49aef48f5a4218fea87b16455a009f4b6f2309e | 10,070 | h | C | GamePlay/GameNetMsgs.h | TaylorClark/PrimeTime | 3c62f6c53e0494146a95be1412273de3cf05bcd2 | [
"MIT"
] | null | null | null | GamePlay/GameNetMsgs.h | TaylorClark/PrimeTime | 3c62f6c53e0494146a95be1412273de3cf05bcd2 | [
"MIT"
] | null | null | null | GamePlay/GameNetMsgs.h | TaylorClark/PrimeTime | 3c62f6c53e0494146a95be1412273de3cf05bcd2 | [
"MIT"
] | null | null | null | //=================================================================================================
/*!
\file GameNetMsgs.h
Game Play Library
Auto-Generated Game Network Message Header
\author The NetMsgGen application, but that is by Taylor Clark
\date Thu Oct 05 18:01:43 2006
This file is auto-generated contains the definitions for the game network message objects. It
should not be editted directly, but rather the source file should be altered and this file
regenerated.
*/
//=================================================================================================
#pragma once
#ifndef __GameNetMsgs_h
#define __GameNetMsgs_h
#include "Network/NetMsg.h"
#include "GameDefines.h"
/// The game network message IDs
enum EGameNetMsgIDs
{
GNMI_Error = -1,
GNMI_GameRunning,
GNMI_GameClosed,
GNMI_SendMeYourInfo,
GNMI_PlayerInfo,
GNMI_GameInfo,
GNMI_StartGameQuery,
GNMI_StartGameResponse,
GNMI_COUNT
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgGameRunning
\brief The message to alert clients that a game is running
*/
//-------------------------------------------------------------------------------------------------
class NetMsgGameRunning : public NetMsg
{
public:
/// The port to connect to the server to in order to join the game
uint16 m_ServerListenPort;
GameDefines::EGameType m_GameType;
GameDefines::EGameplayDiffLevel m_HostDiff;
std::wstring m_sHostName;
/// The default constructor
NetMsgGameRunning()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
// Ensure the data block contains the right amount of data (Calculated during message
// generation)
if( dataBlock.GetRemainingBytes() < 6 )
return 0;
// Create the new message and fill in the data
NetMsgGameRunning* pNewMsg = new NetMsgGameRunning();
pNewMsg->m_ServerListenPort = (uint16)dataBlock.ReadUint16();
pNewMsg->m_GameType = (GameDefines::EGameType)dataBlock.ReadUint16();
pNewMsg->m_HostDiff = (GameDefines::EGameplayDiffLevel)dataBlock.ReadUint8();
pNewMsg->m_sHostName = dataBlock.ReadString();
// Return the message
return pNewMsg;
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& dataOut ) const
{
uint32 startPos = dataOut.GetCurPosition();
dataOut.WriteVal16( (uint16)m_ServerListenPort );
dataOut.WriteVal8( (uint8)m_GameType );
dataOut.WriteVal8( (uint8)m_HostDiff );
dataOut.WriteString( m_sHostName );
return dataOut.GetCurPosition() - startPos;
}
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_GameRunning; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgGameClosed
\brief The message to alert clients that a game can no longer be joined
*/
//-------------------------------------------------------------------------------------------------
class NetMsgGameClosed : public NetMsg
{
public:
/// The port the server was listening on before closing
uint16 m_ServerListenPort;
/// The default constructor
NetMsgGameClosed()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
// Ensure the data block contains the right amount of data (Calculated during message
// generation)
if( dataBlock.GetRemainingBytes() < 2 )
return 0;
// Create the new message and fill in the data
NetMsgGameClosed* pNewMsg = new NetMsgGameClosed();
pNewMsg->m_ServerListenPort = (uint16)dataBlock.ReadUint16();
// Return the message
return pNewMsg;
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& dataOut ) const
{
uint32 startPos = dataOut.GetCurPosition();
dataOut.WriteVal16( (uint16)m_ServerListenPort );
return dataOut.GetCurPosition() - startPos;
}
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_GameClosed; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgSendMeYourInfo
\brief The message for a player to send to another player to get their information
*/
//-------------------------------------------------------------------------------------------------
class NetMsgSendMeYourInfo : public NetMsg
{
public:
/// The default constructor
NetMsgSendMeYourInfo()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
if( dataBlock.GetRemainingBytes() > 0 )
return 0;
return new NetMsgSendMeYourInfo();
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& ) const { return 0; }
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_SendMeYourInfo; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgPlayerInfo
\brief A message containing a player's data
*/
//-------------------------------------------------------------------------------------------------
class NetMsgPlayerInfo : public NetMsg
{
public:
/// The player's name
std::wstring m_sPlayerName;
GameDefines::EGameplayDiffLevel m_CurDiff;
bool m_IsReady;
/// The default constructor
NetMsgPlayerInfo()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
// Ensure the data block contains the right amount of data (Calculated during message
// generation)
if( dataBlock.GetRemainingBytes() < 4 )
return 0;
// Create the new message and fill in the data
NetMsgPlayerInfo* pNewMsg = new NetMsgPlayerInfo();
pNewMsg->m_sPlayerName = dataBlock.ReadString();
pNewMsg->m_CurDiff = (GameDefines::EGameplayDiffLevel)dataBlock.ReadUint8();
pNewMsg->m_IsReady = dataBlock.ReadUint8() != 0;
// Return the message
return pNewMsg;
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& dataOut ) const
{
uint32 startPos = dataOut.GetCurPosition();
dataOut.WriteString( m_sPlayerName );
dataOut.WriteVal8( (uint8)m_CurDiff );
dataOut.WriteVal8( (uint8)m_IsReady );
return dataOut.GetCurPosition() - startPos;
}
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_PlayerInfo; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgGameInfo
\brief The pre-net-game message storing the settings
*/
//-------------------------------------------------------------------------------------------------
class NetMsgGameInfo : public NetMsg
{
public:
/// The type of game to play
GameDefines::EGameType m_GameType;
/// The time limit for the game
uint16 m_TimeLimit;
/// The default constructor
NetMsgGameInfo()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
// Ensure the data block contains the right amount of data (Calculated during message
// generation)
if( dataBlock.GetRemainingBytes() < 3 )
return 0;
// Create the new message and fill in the data
NetMsgGameInfo* pNewMsg = new NetMsgGameInfo();
pNewMsg->m_GameType = (GameDefines::EGameType)dataBlock.ReadUint16();
pNewMsg->m_TimeLimit = (uint16)dataBlock.ReadUint16();
// Return the message
return pNewMsg;
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& dataOut ) const
{
uint32 startPos = dataOut.GetCurPosition();
dataOut.WriteVal8( (uint8)m_GameType );
dataOut.WriteVal16( (uint16)m_TimeLimit );
return dataOut.GetCurPosition() - startPos;
}
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_GameInfo; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgStartGameQuery
\brief The message sent by the server telling the client that a game is to be started
*/
//-------------------------------------------------------------------------------------------------
class NetMsgStartGameQuery : public NetMsg
{
public:
/// The default constructor
NetMsgStartGameQuery()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
if( dataBlock.GetRemainingBytes() > 0 )
return 0;
return new NetMsgStartGameQuery();
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& ) const { return 0; }
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_StartGameQuery; }
};
//-------------------------------------------------------------------------------------------------
/*!
\class NetMsgStartGameResponse
\brief The message sent by the client in response to the server's StartGameQuery message
*/
//-------------------------------------------------------------------------------------------------
class NetMsgStartGameResponse : public NetMsg
{
public:
/// If the client is allowing the start
bool m_AllowStart;
/// The default constructor
NetMsgStartGameResponse()
{
}
/// Create this message upon receiving data
static NetMsg* CreateMsg( NetDataBlock dataBlock )
{
// Ensure the data block contains the right amount of data (Calculated during message
// generation)
if( dataBlock.GetRemainingBytes() < 1 )
return 0;
// Create the new message and fill in the data
NetMsgStartGameResponse* pNewMsg = new NetMsgStartGameResponse();
pNewMsg->m_AllowStart = dataBlock.ReadUint8() != 0;
// Return the message
return pNewMsg;
}
/// Fill in a buffer with the message data
virtual uint32 StoreInBuffer( NetDataBlockOut& dataOut ) const
{
uint32 startPos = dataOut.GetCurPosition();
dataOut.WriteVal8( (uint8)m_AllowStart );
return dataOut.GetCurPosition() - startPos;
}
/// Get the message type ID
virtual uint16 GetMsgTypeID() const { return GNMI_StartGameResponse; }
};
#endif // __GameNetMsgs_h | 27.289973 | 99 | 0.623039 |
4f8dcd6ac79e55af9c878eb8d9bcd5b85cd526bd | 658 | c | C | C-Programming-Language/Homework/Week 11/move1.c | D-Hank/UCAS-CS | e2b8a214057e6a411e742a78a988b43a49c7741f | [
"MIT"
] | 9 | 2020-12-02T05:42:03.000Z | 2022-03-29T11:25:26.000Z | C-Programming-Language/Homework/Week 11/move1.c | Hambaobao/UCAS-CS | e2b8a214057e6a411e742a78a988b43a49c7741f | [
"MIT"
] | null | null | null | C-Programming-Language/Homework/Week 11/move1.c | Hambaobao/UCAS-CS | e2b8a214057e6a411e742a78a988b43a49c7741f | [
"MIT"
] | 4 | 2021-03-27T04:02:55.000Z | 2022-01-26T06:35:22.000Z | #include <stdio.h>
#include <string.h>
#define MAXLEN 100
int mygetline(char s[],int lim);
void move(char input[],int m,int n);
int main(){
int m,n;
char input[MAXLEN];
n=mygetline(input,MAXLEN);
scanf("%d",&m);
move(input,m,n);
printf("%s",input);
return 0;
}
void move(char *input,int m,int n){
char temp[n];
char *t;
t=temp;
for(int i=m,k=0;i<n;i++,k++)
*(t+k)=*(input+i);
for(int i=0,k=n-m;i<n;i++,k++)
*(t+k)=*(input+i);
for(int i=0;i<n;i++)
*(input+i)=*(t+i);
}
int mygetline(char s[],int lim)
{ int i,c;
i=0;
while(--lim>0 && (c=getchar())!=EOF && c!='\n')
s[i++]=c;
if(c=='\n')
s[i++]='\n';
s[i]='\0';
return i-1;
}
| 16.04878 | 48 | 0.541033 |
c42e865b096e74ea907ec5bb788fbacea673e0e1 | 17,581 | c | C | usr/src/lib/libcmd/common/cksum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libcmd/common/cksum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/lib/libcmd/common/cksum.c | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1992-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* sum -- list file checksum and size
*/
static const char usage[] =
"[-?\n@(#)$Id: sum (AT&T Research) 2009-11-28 $\n]"
USAGE_LICENSE
"[+NAME?cksum,md5sum,sum - print file checksum and block count]"
"[+DESCRIPTION?\bsum\b lists the checksum, and for most methods the block"
" count, for each file argument. The standard input is read if there are"
" no \afile\a arguments. \bgetconf UNIVERSE\b determines the default"
" \bsum\b method: \batt\b for the \batt\b universe, \bbsd\b otherwise."
" The default for the other commands is the command name itself. The"
" \batt\b method is a true sum, all others are order dependent.]"
"[+?Method names consist of a leading identifier and 0 or more options"
" separated by -.]"
"[+?\bgetconf PATH_RESOLVE\b determines how symbolic links are handled. This"
" can be explicitly overridden by the \b--logical\b, \b--metaphysical\b,"
" and \b--physical\b options below. \bPATH_RESOLVE\b can be one of:]{"
" [+logical?Follow all symbolic links.]"
" [+metaphysical?Follow command argument symbolic links,"
" otherwise don't follow.]"
" [+physical?Don't follow symbolic links.]"
"}"
"[a:all?List the checksum for all files. Use with \b--total\b to list both"
" individual and total checksums and block counts.]"
"[b:binary?Read files in binary mode. This is the default.]"
"[B:scale?Block count scale (bytes per block) override for methods that"
" include size in the output. The default is method specific.]#[scale]"
"[c:check?Each \afile\a is interpreted as the output from a previous \bsum\b."
" If \b--header\b or \b--permissions\b was specified in the previous"
" \bsum\b then the checksum method is automatically determined,"
" otherwise \b--method\b must be specified. The listed checksum is"
" compared with the current value and a warning is issued for each file"
" that does not match. If \afile\a was generated by \b--permissions\b"
" then the file mode, user and group are also checked. Empty lines,"
" lines starting with \b#<space>\b, or the line \b#\b are ignored. Lines"
" containing no blanks are interpreted as [no]]\aname\a[=\avalue\a]]"
" options:]{"
" [+method=name?Checksum method to apply to subsequent lines.]"
" [+permissions?Subsequent lines were generated with"
" \b--permissions\b.]"
"}"
"[h:header?Print the checksum method as the first output line. Used with"
" \b--check\b and \b--permissions\b.]"
"[l:list?Each \afile\a is interpreted as a list of files, one per line,"
" that is checksummed.]"
"[p:permissions?If \b--check\b is not specified then list the file"
" mode, user and group between the checksum and path. User and group"
" matching the caller are output as \b-\b. If \b--check\b is"
" specified then the mode, user and group for each path in \afile\a"
" are updated if necessary to match those in \afile\a. A warning is"
" printed on the standard error for each changed file.]"
"[R:recursive?Recursively checksum the contents of directories.]"
"[S:silent|status?No output for \b--check\b; 0 exit status means all sums"
" matched, non-0 means at least one sum failed to match. Ignored for"
" \b--permissions\b.]"
"[t:total?List only the total checksum and block count of all files."
" \b--all\b \b--total\b lists each checksum and the total. The"
" total checksum and block count may be different from the checksum"
" and block count of the catenation of all files due to partial"
" blocks that may occur when the files are treated separately.]"
"[T:text?Read files in text mode (i.e., treat \b\\r\\n\b as \b\\n\b).]"
"[w!:warn?Warn about invalid \b--check\b lines.]"
"[x:method|algorithm?Specifies the checksum \amethod\a to"
" apply. Parenthesized method options are readonly implementation"
" details.]:[method]{\fmethods\f}"
"[L:logical|follow?Follow symbolic links when traversing directories. The"
" default is determined by \bgetconf PATH_RESOLVE\b.]"
"[H:metaphysical?Follow command argument symbolic links, otherwise don't"
" follow symbolic links when traversing directories. The default is"
" determined by \bgetconf PATH_RESOLVE\b.]"
"[P:physical?Don't follow symbolic links when traversing directories. The"
" default is determined by \bgetconf PATH_RESOLVE\b.]"
"[r:bsd?Equivalent to \b--method=bsd --scale=512\b for compatibility with"
" other \bsum\b(1) implementations.]"
"[s:sysv?Equivalent to \b--method=sys5\b for compatibility with other"
" \bsum\b(1) implementations.]"
"\n"
"\n[ file ... ]\n"
"\n"
"[+SEE ALSO?\bgetconf\b(1), \btw\b(1), \buuencode\b(1)]"
;
#include <cmd.h>
#include <sum.h>
#include <ls.h>
#include <modex.h>
#include <fts_fix.h>
#include <error.h>
typedef struct State_s /* program state */
{
int all; /* list all items */
Sfio_t* check; /* check previous output */
int flags; /* sumprint() SUM_* flags */
gid_t gid; /* caller gid */
int header; /* list method on output */
int list; /* list file name too */
Sum_t* oldsum; /* previous sum method */
int permissions; /* include mode,uer,group */
int haveperm; /* permissions in the input */
int recursive; /* recursively descend dirs */
size_t scale; /* scale override */
unsigned long size; /* combined size of all files */
int silent; /* silent check, 0 exit if ok */
int (*sort)(FTSENT* const*, FTSENT* const*);
Sum_t* sum; /* sum method */
int text; /* \r\n == \n */
int total; /* list totals only */
uid_t uid; /* caller uid */
int warn; /* invalid check line warnings */
} State_t;
static void verify(State_t*, char*, char*, Sfio_t*);
/*
* open path for read mode
*/
static Sfio_t*
openfile(const char* path, const char* mode)
{
Sfio_t* sp;
if (!path || streq(path, "-") || streq(path, "/dev/stdin") || streq(path, "/dev/fd/0"))
{
sp = sfstdin;
sfopen(sp, NiL, mode);
}
else if (!(sp = sfopen(NiL, path, mode)))
error(ERROR_SYSTEM|2, "%s: cannot read", path);
return sp;
}
/*
* close an openfile() stream
*/
static int
closefile(Sfio_t* sp)
{
return sp == sfstdin ? 0 : sfclose(sp);
}
/*
* compute and print sum on an open file
*/
static void
pr(State_t* state, Sfio_t* op, Sfio_t* ip, char* file, int perm, struct stat* st, Sfio_t* check)
{
register char* p;
register char* r;
register char* e;
register int peek;
struct stat ss;
if (check)
{
state->oldsum = state->sum;
while (p = sfgetr(ip, '\n', 1))
verify(state, p, file, check);
state->sum = state->oldsum;
if (state->warn && !sfeof(ip))
error(2, "%s: last line incomplete", file);
return;
}
suminit(state->sum);
if (state->text)
{
peek = 0;
while (p = sfreserve(ip, SF_UNBOUND, 0))
{
e = p + sfvalue(ip);
if (peek)
{
peek = 0;
if (*p != '\n')
sumblock(state->sum, "\r", 1);
}
while (r = memchr(p, '\r', e - p))
{
if (++r >= e)
{
e--;
peek = 1;
break;
}
sumblock(state->sum, p, r - p - (*r == '\n'));
p = r;
}
sumblock(state->sum, p, e - p);
}
if (peek)
sumblock(state->sum, "\r", 1);
}
else
while (p = sfreserve(ip, SF_UNBOUND, 0))
sumblock(state->sum, p, sfvalue(ip));
if (sfvalue(ip))
error(ERROR_SYSTEM|2, "%s: read error", file);
sumdone(state->sum);
if (!state->total || state->all)
{
sumprint(state->sum, op, state->flags|SUM_SCALE, state->scale);
if (perm >= 0)
{
if (perm)
{
if (!st && fstat(sffileno(ip), st = &ss))
error(ERROR_SYSTEM|2, "%s: cannot stat", file);
else
sfprintf(sfstdout, " %04o %s %s",
modex(st->st_mode & S_IPERM),
(st->st_uid != state->uid && ((st->st_mode & S_ISUID) || (st->st_mode & S_IRUSR) && !(st->st_mode & (S_IRGRP|S_IROTH)) || (st->st_mode & S_IXUSR) && !(st->st_mode & (S_IXGRP|S_IXOTH)))) ? fmtuid(st->st_uid) : "-",
(st->st_gid != state->gid && ((st->st_mode & S_ISGID) || (st->st_mode & S_IRGRP) && !(st->st_mode & S_IROTH) || (st->st_mode & S_IXGRP) && !(st->st_mode & S_IXOTH))) ? fmtgid(st->st_gid) : "-");
}
if (ip != sfstdin)
sfprintf(op, " %s", file);
sfputc(op, '\n');
}
}
}
/*
* verify previous sum output
*/
static void
verify(State_t* state, register char* s, char* check, Sfio_t* rp)
{
register char* t;
char* e;
char* file;
int attr;
int mode;
int uid;
int gid;
Sfio_t* sp;
struct stat st;
if (!*s || *s == '#' && (!*(s + 1) || *(s + 1) == ' ' || *(s + 1) == '\t'))
return;
if (t = strchr(s, ' '))
{
if ((t - s) > 10 || !(file = strchr(t + 1, ' ')))
file = t;
*file++ = 0;
attr = 0;
if ((mode = strtol(file, &e, 8)) && *e == ' ' && (e - file) == 4)
{
mode = modei(mode);
if (t = strchr(++e, ' '))
{
if (*e == '-' && (t - e) == 1)
uid = -1;
else
{
*t = 0;
uid = struid(e);
*t = ' ';
}
if (e = strchr(++t, ' '))
{
if (*t == '-' && (e - t) == 1)
gid = -1;
else
{
*e = 0;
gid = struid(t);
*e = ' ';
}
file = e + 1;
attr = 1;
}
}
}
if (sp = openfile(file, "rb"))
{
pr(state, rp, sp, file, -1, NiL, NiL);
if (!(t = sfstruse(rp)))
error(ERROR_SYSTEM|3, "out of space");
if (!streq(s, t))
{
if (state->silent)
error_info.errors++;
else
error(2, "%s: checksum changed", file);
}
else if (attr)
{
if (fstat(sffileno(sp), &st))
{
if (state->silent)
error_info.errors++;
else
error(ERROR_SYSTEM|2, "%s: cannot stat", file);
}
else
{
if (uid < 0 || uid == st.st_uid)
uid = -1;
else if (!state->permissions)
{
if (state->silent)
error_info.errors++;
else
error(2, "%s: uid should be %s", file, fmtuid(uid));
}
if (gid < 0 || gid == st.st_gid)
gid = -1;
else if (!state->permissions)
{
if (state->silent)
error_info.errors++;
else
error(2, "%s: gid should be %s", file, fmtgid(gid));
}
if (state->permissions && (uid >= 0 || gid >= 0))
{
if (chown(file, uid, gid) < 0)
{
if (uid < 0)
error(ERROR_SYSTEM|2, "%s: cannot change group to %s", file, fmtgid(gid));
else if (gid < 0)
error(ERROR_SYSTEM|2, "%s: cannot change user to %s", file, fmtuid(uid));
else
error(ERROR_SYSTEM|2, "%s: cannot change user to %s and group to %s", file, fmtuid(uid), fmtgid(gid));
}
else
{
if (uid < 0)
error(1, "%s: changed group to %s", file, fmtgid(gid));
else if (gid < 0)
error(1, "%s: changed user to %s", file, fmtuid(uid));
else
error(1, "%s: changed user to %s and group to %s", file, fmtuid(uid), fmtgid(gid));
}
}
if ((st.st_mode & S_IPERM) ^ mode)
{
if (state->permissions)
{
if (chmod(file, mode) < 0)
error(ERROR_SYSTEM|2, "%s: cannot change mode to %s", file, fmtmode(mode, 0));
else
error(ERROR_SYSTEM|1, "%s: changed mode to %s", file, fmtmode(mode, 0));
}
else if (state->silent)
error_info.errors++;
else
error(2, "%s: mode should be %s", file, fmtmode(mode, 0));
}
}
}
closefile(sp);
}
}
else if (strneq(s, "method=", 7))
{
s += 7;
if (state->sum != state->oldsum)
sumclose(state->sum);
if (!(state->sum = sumopen(s)))
error(3, "%s: %s: unknown checksum method", check, s);
}
else if (streq(s, "permissions"))
state->haveperm = 1;
else
error(1, "%s: %s: unknown option", check, s);
}
/*
* sum the list of files in lp
*/
static void
list(State_t* state, register Sfio_t* lp)
{
register char* file;
register Sfio_t* sp;
while (file = sfgetr(lp, '\n', 1))
if (sp = openfile(file, state->check ? "rt" : "rb"))
{
pr(state, sfstdout, sp, file, state->permissions, NiL, state->check);
closefile(sp);
}
}
/*
* order child entries
*/
static int
order(FTSENT* const* f1, FTSENT* const* f2)
{
return strcoll((*f1)->fts_name, (*f2)->fts_name);
}
/*
* optget() info discipline function
*/
static int
optinfo(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp)
{
if (streq(s, "methods"))
return sumusage(sp);
return 0;
}
int
b_cksum(int argc, register char** argv, void* context)
{
register int flags;
char* file;
char* method;
Sfio_t* sp;
FTS* fts;
FTSENT* ent;
int logical;
Optdisc_t optdisc;
State_t state;
cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
memset(&state, 0, sizeof(state));
flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER;
state.flags = SUM_SIZE;
state.warn = 1;
logical = 1;
method = 0;
optinit(&optdisc, optinfo);
for (;;)
{
switch (optget(argv, usage))
{
case 'a':
state.all = 1;
continue;
case 'b':
state.text = 0;
continue;
case 'B':
state.scale = opt_info.num;
continue;
case 'c':
if (!(state.check = sfstropen()))
error(3, "out of space [check]");
continue;
case 'h':
state.header = 1;
continue;
case 'l':
state.list = 1;
continue;
case 'p':
state.permissions = 1;
continue;
case 'r':
method = "bsd";
state.scale = 512;
state.flags |= SUM_LEGACY;
continue;
case 'R':
flags &= ~FTS_TOP;
state.recursive = 1;
state.sort = order;
logical = 0;
continue;
case 's':
method = "sys5";
continue;
case 'S':
state.silent = opt_info.num;
continue;
case 't':
state.total = 1;
continue;
case 'w':
state.warn = opt_info.num;
continue;
case 'x':
method = opt_info.arg;
continue;
case 'H':
flags |= FTS_META|FTS_PHYSICAL;
logical = 0;
continue;
case 'L':
flags &= ~(FTS_META|FTS_PHYSICAL);
logical = 0;
continue;
case 'P':
flags &= ~FTS_META;
flags |= FTS_PHYSICAL;
logical = 0;
continue;
case 'T':
state.text = 1;
continue;
case '?':
error(ERROR_USAGE|4, "%s", opt_info.arg);
break;
case ':':
error(2, "%s", opt_info.arg);
break;
}
break;
}
argv += opt_info.index;
if (error_info.errors)
error(ERROR_USAGE|4, "%s", optusage(NiL));
/*
* check the method
*/
if (method && !(state.sum = sumopen(method)))
error(3, "%s: unknown checksum method", method);
if (!state.sum && !(state.sum = sumopen(error_info.id)) && !(state.sum = sumopen(astconf("UNIVERSE", NiL, NiL))))
state.sum = sumopen(NiL);
/*
* do it
*/
if (logical)
{
flags &= ~(FTS_META|FTS_PHYSICAL);
flags |= FTS_SEEDOTDIR;
}
if (state.permissions)
{
state.uid = geteuid();
state.gid = getegid();
state.silent = 0;
}
if (!state.check && (state.header || state.permissions))
{
sfprintf(sfstdout, "method=%s\n", state.sum->name);
if (state.permissions)
sfprintf(sfstdout, "permissions\n");
}
if (state.list)
{
if (*argv)
{
while (file = *argv++)
if (sp = openfile(file, "rt"))
{
list(&state, sp);
closefile(sp);
}
}
else if (sp = openfile(NiL, "rt"))
{
list(&state, sp);
closefile(sp);
}
}
else if (!*argv && !state.recursive)
pr(&state, sfstdout, sfstdin, "/dev/stdin", state.permissions, NiL, state.check);
else if (!(fts = fts_open(argv, flags, state.sort)))
error(ERROR_system(1), "%s: not found", *argv);
else
{
while (!sh_checksig(context) && (ent = fts_read(fts)))
switch (ent->fts_info)
{
case FTS_SL:
if (!(flags & FTS_PHYSICAL) || (flags & FTS_META) && ent->fts_level == 1)
fts_set(NiL, ent, FTS_FOLLOW);
break;
case FTS_F:
if (sp = openfile(ent->fts_accpath, "rb"))
{
pr(&state, sfstdout, sp, ent->fts_path, state.permissions, ent->fts_statp, state.check);
closefile(sp);
}
break;
case FTS_DC:
error(ERROR_warn(0), "%s: directory causes cycle", ent->fts_accpath);
break;
case FTS_DNR:
error(ERROR_system(0), "%s: cannot read directory", ent->fts_accpath);
break;
case FTS_DNX:
error(ERROR_system(0), "%s: cannot search directory", ent->fts_accpath);
break;
case FTS_NS:
error(ERROR_system(0), "%s: not found", ent->fts_accpath);
break;
}
fts_close(fts);
}
if (state.total)
{
sumprint(state.sum, sfstdout, state.flags|SUM_TOTAL|SUM_SCALE, state.scale);
sfputc(sfstdout, '\n');
}
sumclose(state.sum);
return error_info.errors != 0;
}
| 27.774092 | 219 | 0.574654 |
c444f44fa7b972f6b06fe70a80927413a17d811e | 8,744 | h | C | software/jetson/ArduCAM/MIPI_Camera/RPI/lens_shading_table/imx135/ls_table_2592x1944.h | abstractguy/TSO_project | 1130e6fb081d1486ff15339a9757c46a927a2965 | [
"BSD-2-Clause"
] | 1 | 2021-06-06T14:12:32.000Z | 2021-06-06T14:12:32.000Z | software/jetson/ArduCAM/MIPI_Camera/RPI/lens_shading_table/imx135/ls_table_2592x1944.h | abstractguy/TSO_project | 1130e6fb081d1486ff15339a9757c46a927a2965 | [
"BSD-2-Clause"
] | 6 | 2021-04-06T12:35:34.000Z | 2022-03-12T00:58:16.000Z | software/jetson/ArduCAM/MIPI_Camera/RPI/lens_shading_table/imx135/ls_table_2592x1944.h | abstractguy/TSO_project | 1130e6fb081d1486ff15339a9757c46a927a2965 | [
"BSD-2-Clause"
] | 2 | 2020-03-05T00:09:48.000Z | 2021-06-03T20:06:03.000Z | {
122, 119, 113, 108, 104, 100, 97, 94, 91, 88, 86, 84, 82, 81, 80, 80, 80, 80, 81, 83, 85, 87, 90, 93, 95, 99, 102, 106, 110, 115,
118, 114, 109, 105, 101, 97, 94, 90, 88, 85, 82, 80, 78, 77, 77, 76, 76, 77, 78, 79, 81, 83, 86, 89, 92, 95, 98, 102, 106, 111,
114, 111, 106, 102, 98, 94, 90, 87, 84, 81, 79, 77, 75, 74, 73, 73, 73, 73, 74, 76, 78, 80, 83, 86, 89, 92, 95, 99, 103, 108,
116, 112, 107, 103, 99, 95, 92, 88, 85, 82, 79, 77, 75, 74, 73, 73, 73, 74, 75, 76, 78, 81, 83, 86, 90, 93, 97, 100, 105, 109,
119, 116, 111, 106, 102, 98, 94, 91, 87, 84, 82, 79, 77, 76, 75, 75, 75, 76, 77, 78, 80, 83, 86, 89, 93, 96, 100, 104, 108, 112,
121, 118, 113, 108, 104, 100, 96, 92, 88, 85, 82, 80, 78, 77, 76, 76, 76, 76, 77, 79, 81, 84, 87, 90, 94, 98, 101, 106, 110, 114,
119, 116, 111, 106, 102, 98, 94, 90, 86, 83, 80, 78, 76, 75, 74, 74, 74, 74, 75, 77, 79, 82, 85, 88, 91, 95, 99, 103, 107, 112,
113, 110, 105, 101, 97, 93, 88, 85, 81, 78, 75, 73, 71, 70, 69, 69, 69, 70, 71, 72, 74, 77, 80, 83, 86, 90, 94, 98, 102, 107,
107, 105, 100, 96, 91, 87, 83, 80, 77, 73, 71, 69, 67, 66, 65, 65, 65, 65, 66, 68, 70, 72, 75, 78, 81, 85, 89, 93, 97, 101,
106, 103, 98, 94, 90, 86, 82, 78, 75, 72, 69, 67, 66, 65, 64, 64, 64, 64, 65, 66, 68, 71, 73, 77, 80, 83, 88, 91, 95, 100,
109, 106, 101, 97, 93, 89, 85, 81, 78, 74, 72, 70, 68, 67, 66, 66, 66, 67, 67, 69, 71, 73, 76, 79, 83, 86, 90, 94, 98, 102,
115, 112, 107, 103, 99, 94, 90, 87, 83, 80, 77, 75, 73, 72, 71, 71, 71, 71, 72, 74, 76, 78, 81, 85, 88, 92, 96, 100, 104, 109,
121, 117, 112, 108, 104, 100, 96, 92, 89, 85, 82, 80, 78, 77, 76, 76, 76, 76, 77, 79, 81, 83, 87, 90, 94, 97, 101, 105, 109, 114,
122, 119, 114, 110, 106, 102, 98, 94, 91, 88, 85, 82, 80, 79, 78, 78, 78, 78, 80, 81, 83, 86, 89, 92, 96, 99, 103, 107, 111, 116,
121, 117, 112, 108, 104, 100, 96, 93, 90, 86, 84, 81, 80, 78, 77, 77, 77, 77, 79, 80, 82, 85, 88, 91, 94, 98, 101, 105, 109, 114,
118, 114, 109, 105, 101, 97, 94, 90, 88, 85, 82, 80, 78, 77, 76, 75, 75, 76, 77, 79, 81, 83, 86, 88, 92, 95, 98, 102, 106, 111,
117, 114, 109, 104, 100, 96, 93, 90, 87, 85, 82, 80, 78, 77, 76, 76, 76, 76, 77, 79, 81, 83, 86, 88, 91, 94, 98, 101, 106, 111,
131, 127, 120, 114, 108, 104, 100, 96, 93, 90, 87, 84, 82, 81, 80, 80, 80, 81, 82, 84, 86, 88, 91, 95, 98, 102, 106, 111, 117, 123,
127, 123, 116, 110, 105, 101, 97, 93, 89, 86, 83, 81, 79, 77, 77, 76, 76, 77, 78, 80, 82, 85, 88, 91, 95, 98, 103, 107, 113, 119,
123, 119, 112, 107, 102, 98, 94, 90, 86, 82, 80, 77, 75, 74, 73, 73, 73, 74, 75, 77, 79, 81, 84, 88, 92, 96, 100, 104, 110, 116,
125, 121, 114, 109, 104, 99, 95, 91, 87, 83, 80, 78, 75, 74, 73, 73, 73, 74, 75, 77, 79, 82, 85, 89, 93, 97, 102, 106, 111, 117,
129, 125, 118, 113, 107, 103, 98, 93, 89, 85, 82, 79, 77, 76, 75, 75, 75, 75, 77, 78, 81, 84, 87, 91, 96, 100, 105, 110, 115, 121,
131, 126, 120, 114, 109, 104, 99, 94, 90, 86, 82, 80, 78, 76, 75, 75, 75, 76, 77, 79, 81, 84, 88, 92, 97, 101, 106, 111, 117, 123,
127, 124, 117, 112, 106, 101, 96, 91, 87, 83, 80, 77, 75, 74, 73, 73, 73, 73, 74, 76, 79, 82, 85, 89, 94, 99, 104, 109, 114, 120,
120, 117, 111, 105, 100, 95, 90, 86, 82, 78, 75, 72, 70, 69, 69, 68, 68, 69, 70, 71, 74, 77, 80, 84, 88, 93, 98, 103, 108, 114,
115, 111, 105, 100, 95, 90, 86, 81, 77, 73, 70, 68, 66, 65, 65, 64, 64, 65, 66, 67, 70, 72, 75, 79, 83, 88, 93, 98, 103, 108,
113, 110, 104, 99, 94, 89, 84, 80, 76, 72, 69, 67, 65, 64, 64, 64, 64, 64, 65, 66, 69, 71, 74, 78, 82, 87, 91, 96, 101, 106,
117, 114, 108, 102, 98, 92, 88, 83, 79, 75, 72, 70, 68, 67, 66, 66, 66, 67, 68, 69, 71, 74, 78, 82, 86, 90, 95, 100, 105, 110,
125, 121, 115, 109, 104, 99, 94, 89, 85, 81, 78, 75, 73, 72, 71, 71, 71, 72, 73, 74, 77, 80, 83, 87, 92, 96, 101, 106, 112, 117,
131, 127, 120, 115, 110, 104, 100, 95, 90, 86, 83, 80, 78, 77, 76, 75, 76, 76, 77, 79, 82, 85, 89, 93, 97, 102, 107, 112, 118, 123,
133, 129, 122, 117, 111, 106, 102, 97, 93, 89, 85, 82, 80, 79, 78, 78, 78, 78, 80, 82, 84, 87, 91, 95, 99, 104, 108, 114, 119, 125,
131, 126, 120, 114, 109, 104, 100, 96, 91, 88, 85, 82, 80, 78, 77, 77, 77, 78, 79, 81, 83, 86, 90, 93, 97, 102, 106, 111, 117, 123,
127, 123, 116, 111, 106, 101, 97, 93, 90, 86, 83, 81, 79, 77, 76, 76, 76, 77, 78, 80, 82, 85, 88, 91, 95, 99, 103, 108, 114, 120,
128, 123, 117, 111, 106, 101, 97, 93, 90, 87, 84, 82, 80, 79, 78, 77, 77, 78, 79, 81, 83, 85, 88, 91, 95, 99, 103, 108, 113, 120,
131, 127, 120, 114, 109, 104, 100, 97, 93, 90, 88, 85, 83, 82, 81, 81, 81, 82, 83, 84, 87, 89, 92, 95, 99, 103, 107, 111, 117, 123,
126, 122, 116, 110, 105, 101, 97, 93, 90, 86, 84, 81, 79, 78, 77, 77, 77, 78, 79, 81, 83, 85, 88, 91, 95, 99, 103, 107, 113, 119,
123, 119, 112, 107, 102, 98, 94, 90, 86, 83, 80, 78, 76, 74, 74, 73, 73, 74, 75, 77, 79, 82, 85, 88, 92, 96, 100, 104, 110, 116,
124, 120, 114, 108, 104, 99, 95, 90, 87, 83, 80, 78, 76, 74, 74, 73, 73, 74, 75, 77, 79, 82, 85, 89, 93, 97, 101, 106, 111, 117,
128, 124, 118, 112, 107, 102, 98, 93, 89, 85, 82, 80, 78, 76, 75, 75, 75, 76, 77, 79, 81, 84, 87, 91, 96, 100, 105, 110, 115, 120,
130, 125, 119, 114, 108, 104, 98, 94, 90, 86, 82, 80, 78, 76, 76, 75, 75, 76, 77, 79, 82, 85, 88, 92, 96, 101, 106, 111, 117, 122,
127, 123, 117, 111, 106, 101, 96, 91, 87, 83, 80, 77, 75, 74, 73, 73, 73, 74, 75, 76, 79, 82, 85, 89, 94, 98, 103, 108, 114, 119,
120, 116, 110, 105, 100, 95, 90, 86, 81, 78, 75, 72, 71, 69, 69, 68, 69, 69, 70, 72, 74, 77, 80, 84, 88, 93, 98, 103, 108, 113,
114, 110, 104, 100, 95, 90, 85, 81, 77, 73, 70, 68, 66, 65, 65, 64, 65, 65, 66, 67, 70, 72, 75, 79, 83, 88, 92, 97, 102, 107,
112, 108, 103, 98, 93, 88, 84, 80, 75, 72, 69, 67, 65, 64, 64, 64, 64, 64, 65, 66, 69, 71, 74, 78, 82, 86, 91, 96, 101, 106,
116, 112, 107, 101, 96, 92, 87, 83, 79, 75, 72, 70, 68, 67, 66, 66, 66, 67, 68, 69, 71, 74, 77, 81, 85, 90, 94, 99, 104, 110,
123, 120, 114, 108, 103, 98, 93, 89, 85, 81, 78, 75, 73, 72, 71, 71, 71, 72, 73, 74, 77, 80, 83, 87, 91, 96, 101, 105, 111, 116,
130, 125, 119, 114, 108, 104, 99, 94, 90, 86, 83, 80, 78, 77, 76, 75, 76, 76, 77, 79, 82, 85, 88, 92, 97, 101, 106, 111, 117, 122,
132, 128, 121, 116, 111, 105, 101, 96, 92, 88, 85, 82, 80, 79, 78, 78, 78, 78, 80, 82, 84, 87, 90, 95, 99, 103, 108, 113, 118, 124,
130, 125, 119, 113, 108, 104, 99, 95, 91, 88, 85, 82, 80, 78, 77, 77, 77, 78, 79, 81, 83, 86, 89, 93, 97, 101, 106, 111, 116, 122,
126, 122, 116, 110, 105, 101, 97, 93, 89, 86, 83, 81, 79, 77, 76, 76, 76, 77, 78, 80, 82, 85, 87, 91, 95, 99, 103, 107, 113, 119,
126, 122, 116, 110, 105, 100, 97, 93, 90, 87, 84, 82, 80, 79, 78, 77, 77, 78, 79, 81, 83, 85, 88, 91, 95, 99, 103, 107, 113, 119,
116, 112, 107, 102, 98, 94, 91, 88, 85, 83, 81, 79, 77, 76, 76, 75, 76, 76, 77, 78, 80, 82, 84, 87, 90, 93, 96, 100, 105, 110,
113, 110, 105, 100, 96, 92, 89, 86, 83, 81, 78, 77, 75, 74, 73, 73, 73, 74, 75, 76, 78, 80, 82, 85, 87, 91, 94, 98, 102, 107,
113, 110, 105, 100, 96, 92, 89, 86, 83, 80, 78, 76, 75, 74, 73, 73, 73, 73, 74, 76, 77, 79, 82, 84, 87, 91, 94, 98, 102, 107,
118, 115, 109, 105, 100, 97, 93, 90, 86, 83, 81, 79, 78, 77, 76, 76, 76, 76, 77, 79, 80, 83, 85, 88, 91, 95, 99, 103, 107, 112,
122, 119, 114, 109, 105, 101, 97, 93, 90, 87, 84, 82, 80, 80, 79, 78, 78, 79, 80, 82, 83, 86, 88, 92, 95, 99, 103, 107, 111, 116,
122, 118, 114, 109, 105, 100, 96, 92, 89, 86, 83, 81, 80, 79, 78, 78, 78, 78, 79, 81, 83, 85, 88, 91, 94, 98, 102, 107, 111, 115,
116, 112, 108, 103, 99, 95, 91, 87, 84, 81, 78, 76, 75, 74, 73, 73, 73, 74, 75, 76, 78, 80, 83, 86, 89, 93, 97, 101, 106, 110,
108, 105, 100, 96, 92, 87, 84, 80, 77, 74, 72, 70, 69, 68, 67, 67, 67, 68, 68, 70, 71, 73, 76, 79, 82, 86, 90, 94, 98, 102,
103, 100, 95, 91, 87, 83, 80, 76, 73, 70, 68, 66, 65, 64, 64, 64, 64, 64, 65, 66, 67, 69, 72, 75, 78, 81, 85, 89, 93, 97,
104, 101, 96, 92, 88, 84, 80, 77, 74, 71, 69, 67, 66, 65, 64, 64, 64, 65, 65, 67, 68, 70, 73, 76, 79, 82, 86, 90, 94, 98,
110, 107, 102, 98, 94, 90, 86, 83, 79, 76, 74, 72, 71, 70, 69, 69, 69, 69, 70, 71, 73, 75, 78, 81, 84, 88, 92, 96, 100, 105,
118, 115, 110, 106, 101, 97, 93, 90, 86, 83, 80, 78, 77, 76, 75, 75, 75, 76, 76, 78, 80, 82, 85, 88, 91, 95, 99, 104, 108, 112,
122, 119, 114, 110, 105, 101, 97, 94, 90, 87, 84, 82, 80, 79, 78, 78, 78, 79, 80, 81, 83, 86, 88, 92, 95, 99, 103, 107, 111, 117,
121, 118, 112, 108, 104, 99, 96, 92, 89, 86, 83, 81, 80, 78, 78, 77, 78, 78, 79, 81, 83, 85, 88, 91, 94, 98, 102, 106, 110, 115,
116, 112, 108, 103, 99, 95, 91, 88, 85, 83, 80, 78, 76, 75, 74, 74, 74, 75, 76, 77, 79, 81, 84, 87, 90, 93, 97, 101, 105, 110,
112, 109, 104, 99, 95, 92, 88, 85, 83, 80, 78, 76, 74, 73, 72, 72, 72, 73, 74, 75, 77, 79, 81, 84, 87, 90, 93, 97, 102, 107,
114, 111, 105, 100, 96, 93, 90, 87, 84, 82, 79, 77, 76, 75, 74, 74, 74, 74, 75, 77, 78, 80, 83, 85, 88, 91, 94, 99, 103, 108,
};
#0#
$30$
% 17 %
| 118.162162 | 131 | 0.531565 |
584860113917312b134b8fe9063ada07a9675592 | 2,952 | h | C | Hot Spot Reference/Hot Spot/InstagramUserDataFetcher.h | patrickreynolds/Hot-Spot-APP | d1d71fa58f3af6959bf479c88b2f86f750627d20 | [
"MIT"
] | null | null | null | Hot Spot Reference/Hot Spot/InstagramUserDataFetcher.h | patrickreynolds/Hot-Spot-APP | d1d71fa58f3af6959bf479c88b2f86f750627d20 | [
"MIT"
] | null | null | null | Hot Spot Reference/Hot Spot/InstagramUserDataFetcher.h | patrickreynolds/Hot-Spot-APP | d1d71fa58f3af6959bf479c88b2f86f750627d20 | [
"MIT"
] | null | null | null | //
// InstagramUserDataFetcher.h
// InstaFetcher
//
// Created by Patrick Reynolds on 1/7/14.
// Copyright (c) 2014 Patrick Reynolds. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface InstagramUserDataFetcher : NSObject
// Takes a string initializing InstagramUserDataFetcher with an Instagram access_token
- (InstagramUserDataFetcher *)initDataFetcher :(NSString *)withAccessToken;
// Takes an Instagram username and returns the user's internal Instagram ID.
// This ID is used for additional API calls.
- (NSString *)getUserIdForUsername :(NSString *)username;
// Takes an Instagram username and returns an array of InstagramMedia objects
- (NSArray *)getPhotoListForUsername :(NSString *)username;
// Takes an Instagram username and returns a Dictionary modeling a complete
// list of all users who have liked the passed usernames content paired with cumulative counts.
// Dictionary Key -> Instagram Username
// Dictionary Value -> Cumulative count of media that user has liked.
- (NSDictionary *)getPopularLikesForUsername:(NSString *)username;
// Takes an Instagram username and returns a Dictionary modeling a complete
// list of all users who have commented on the passed username's content, paired with cumulative counts.
// Dictionary Key -> Instagram Username
// Dictionary Value -> Cumulative count of media that user has commented on.
- (NSDictionary *)getPopularCommentsForUsername:(NSString *)username;
// Takes an Instagram username and returns an NSNumber object of the current
// number of media (images + video) the user has posted.
- (NSNumber *)mediaCount:(NSString *)username :(NSString *)withOptionalUserID;
// Takes two parameters: an Instagram username and the userID for that user if available.
// If the internal Instagram userID is now known, follows will retrieve the
// userID by doing an additional API request, getUserIdForUsername:username.
// Returns an array of Instagram username strings that the passed username follows.
- (NSArray *)follows:(NSString *)username :(NSString *)withOptionalUserID;
// Takes two parameters: an Instagram username and the userID for that user if available.
// If the internal Instagram userID is now known, follows will retrieve the
// userID by doing an additional API request, getUserIdForUsername:username.
// Returns an array of Instagram username strings of users that follow the passed username.
- (NSArray *)followed_by:(NSString *)username :(NSString *)withOptionalUserID;
// Takes an Instagram username and returns a list of users that the passed
// username follows, who don't follow them back.
- (NSArray *)whoDoesntUserFollowBack :(NSString *)username :(NSString *)withOptionalUserID;
// Takes an Instagram username and returns a list of userns who follow the past
// username that the passed username does not follow back. Mah bad.
- (NSArray *)whoDoesntFollowUserBack :(NSString *)username :(NSString *)withOptionalUserID;
@end
| 43.411765 | 104 | 0.778455 |
166472b61e81c75a9b4287c0e74a2217fb98f084 | 993 | h | C | third_party/pdfium/fpdfsdk/include/javascript/JavaScript.h | satorumpen/node-pdfium-native | 90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c | [
"BSD-2-Clause"
] | 303 | 2015-03-13T08:31:24.000Z | 2022-03-21T10:06:45.000Z | third_party/pdfium/fpdfsdk/include/javascript/JavaScript.h | satorumpen/node-pdfium-native | 90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c | [
"BSD-2-Clause"
] | 15 | 2015-04-03T02:33:53.000Z | 2020-01-28T10:42:29.000Z | third_party/pdfium/fpdfsdk/include/javascript/JavaScript.h | satorumpen/node-pdfium-native | 90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c | [
"BSD-2-Clause"
] | 100 | 2015-03-13T08:28:56.000Z | 2022-02-18T03:19:39.000Z | // Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _JAVASCRIPT_H_
#define _JAVASCRIPT_H_
#ifndef _INC_PDFAPI
#define _INC_PDFAPI
#include "../../../core/include/fpdfapi/fpdf_module.h"
#include "../../../core/include/fpdfdoc/fpdf_doc.h"
#include "../../../core/include/fpdfdoc/fpdf_vt.h"
#include "../../../core/include/fxcrt/fx_xml.h"
#include "../../../core/include/fdrm/fx_crypt.h"
#include "../../../core/include/fpdfapi/fpdf_pageobj.h"
#include "../../../core/include/fpdfapi/fpdf_serial.h"
#include "../../include/fx_systemhandler.h"
#endif
#include "../jsapi/fxjs_v8.h"
#include "../fxedit/fx_edit.h"
#include "../pdfwindow/IPDFWindow.h"
#include "../fsdk_mgr.h"
#include <string>
//#pragma warning( disable : 4786)
#include <vector>
#endif //_JAVASCRIPT_H_
| 24.825 | 80 | 0.691843 |
7501c9a96f0c54874f3bb90ce2acbe0cf471dde1 | 1,603 | h | C | GATE_Engine/ResourceMesh.h | DocDonkeys/3D_Engine | bb2868884c6eec0ef619a45b7e21f5cf3857fe1b | [
"MIT"
] | 1 | 2019-12-28T18:28:27.000Z | 2019-12-28T18:28:27.000Z | GATE_Engine/ResourceMesh.h | DocDonkeys/3D_Engine | bb2868884c6eec0ef619a45b7e21f5cf3857fe1b | [
"MIT"
] | null | null | null | GATE_Engine/ResourceMesh.h | DocDonkeys/3D_Engine | bb2868884c6eec0ef619a45b7e21f5cf3857fe1b | [
"MIT"
] | 3 | 2020-02-13T22:52:44.000Z | 2020-10-21T06:55:45.000Z | #ifndef __RESOURCE_MESH_H__
#define __RESOURCE_MESH_H__
#include "Resource.h"
#include "JsonLoader.h"
#include "libs/MathGeoLib/include/Geometry/AABB.h"
struct aiMesh;
class ResourceMesh : public Resource
{
public:
ResourceMesh(uint32 uid);
~ResourceMesh();
public:
bool LoadInMemory() override;
void Save(json& config) const override;
void Load(const json& config) override;
void LoadVertices(const aiMesh* loaded_mesh);
void LoadIndices(const aiMesh* loaded_mesh);
void LoadNormals(const aiMesh* loaded_mesh);
void LoadTexCoords(const aiMesh* loaded_mesh);
void ChangeNormalsLength(float new_length);
void LoadMeshBounds();
AABB GetBounds() { return bounds; }
float3 GetSize() { return size; }
public:
std::string path;
std::string filename;
uint id_index = 0; // index in VRAM
uint num_index = 0;
uint* index = nullptr;
uint id_vertex = 0; // unique vertex in VRAM
uint num_vertex = 0;
float3* vertex = nullptr;
uint id_normals = 0; // index in VRAM
uint num_normals = 0;
float3* normals_vector = nullptr; // Store the Vectors of the normals
float3* normals_faces = nullptr; // Since on resize vertex positions will change we store the position
float3* normals_faces_vector = nullptr;
uint id_tex_coords = 0; // index in VRAM
uint num_tex_coords = 0;
float* tex_coords = nullptr;
AABB bounds; // In local space of the imported FBX
float3 size = { 0.0f, 0.0f, 0.0f }; // Absolute distance between bound max/min points
float normals_length = 1.0f;
float normals_last_length = 1.0f;
unsigned long int num_polys = 0;
};
#endif // !__RESOURCE_MESH_H__
| 25.444444 | 103 | 0.739863 |
59012c81487f7c8ec593f4ec5c4e0aaab16e004a | 3,470 | h | C | STEER/STEER/AliRecoInputHandler.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | STEER/STEER/AliRecoInputHandler.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | STEER/STEER/AliRecoInputHandler.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | #ifndef ALIRECOINPUTHANDLER_H
#define ALIRECOINPUTHANDLER_H
/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
//-------------------------------------------------------------------------
// Reconstruction-specific input handler
// Author: Andrei Gheata, CERN
//-------------------------------------------------------------------------
#ifndef ALIESDINPUTHANDLER_H
#include "AliESDInputHandler.h"
#endif
class AliReconstruction;
class AliRecoInputHandler : public AliESDInputHandler {
public:
AliRecoInputHandler() {}
AliRecoInputHandler(const char* name, const char* title);
virtual ~AliRecoInputHandler() {}
virtual Bool_t Notify() { return AliESDInputHandler::Notify(); };
virtual Bool_t Notify(const char *) {return kTRUE;}
virtual Bool_t Init(Option_t* opt) {return AliESDInputHandler::Init(opt);}
virtual Bool_t Init(TTree* tree, Option_t* opt="LOCAL");
virtual Bool_t BeginEvent(Long64_t entry);
virtual Bool_t FinishEvent() {return kTRUE;}
// void CheckSelectionMask();
// AliESDEvent *GetEvent() const {return fEvent;}
// Option_t *GetAnalysisType() const {return fAnalysisType;}
// Option_t *GetDataType() const;
// Tag cut summary analysis
// Int_t GetNEventAcceptedInFile();
// Int_t GetNEventRejectedInFile();
// Bool_t GetCutSummaryForChain(Int_t *aTotal, Int_t *aAccepted, Int_t *aRejected);
// Int_t GetNFilesEmpty();
// HLT analysis
// AliESDEvent *GetHLTEvent() const {return fHLTEvent;}
// TTree *GetHLTTree() const {return fHLTTree;}
// void SetReadHLT() {fUseHLT = kTRUE;}
// Friends&Co
// AliESDfriend *GetESDfriend() const {return fFriend;}
// void SetReadFriends(Bool_t flag) {fReadFriends = flag;}
// void SetFriendFileName(const char *fname) {fFriendFileName = fname;}
// Tag analysis
// void SetReadTags() {fUseTags = kTRUE;}
// AliRunTag *GetRunTag() const {return fRunTag;}
// const AliEventTag *GetEventTag() const {return fEventTag;}
// Get the statistics object (currently TH2). Option can be BIN0.
// virtual TObject *GetStatistics(Option_t *option="") const;
//PID response
// virtual AliPIDResponse* GetPIDResponse() {return (AliPIDResponse*)fESDpid;}
// virtual void CreatePIDResponse(Bool_t isMC=kFALSE);
// AliESDpid *GetESDpid() const {return fESDpid;}
// void SetESDpid(AliESDpid* pid) {fESDpid = pid;}
private:
AliRecoInputHandler(const AliESDInputHandler& handler);
AliRecoInputHandler& operator=(const AliESDInputHandler& handler);
// Private setters used by AliReconstruction
friend class AliReconstruction;
void SetEvent(AliESDEvent *event) {fEvent = event;}
void SetESDfriend(AliESDfriend *esdfriend) {fFriend = esdfriend;}
void SetHLTEvent(AliESDEvent *hltevent) {fHLTEvent = hltevent;}
void SetHLTTree(TTree *hlttree) {fHLTTree = hlttree;}
ClassDef(AliRecoInputHandler, 1);
};
#endif
| 47.534247 | 100 | 0.58732 |
ad11b263ed90e34aa155f289e90e2c49c583fd18 | 603 | h | C | applications/pcba_test/record_test_page.h | h-hys/rk2108_202012_SDK | c0880365a8eb208979df0a45ae350c8fe8f565c6 | [
"Apache-2.0"
] | null | null | null | applications/pcba_test/record_test_page.h | h-hys/rk2108_202012_SDK | c0880365a8eb208979df0a45ae350c8fe8f565c6 | [
"Apache-2.0"
] | 1 | 2021-08-19T10:47:10.000Z | 2021-08-19T10:47:10.000Z | applications/pcba_test/record_test_page.h | h-hys/rk2108_202012_SDK | c0880365a8eb208979df0a45ae350c8fe8f565c6 | [
"Apache-2.0"
] | 3 | 2021-04-24T23:33:56.000Z | 2022-01-14T07:13:38.000Z | /*
* @Copyright: Copyright (c) 2020 Fuzhou Rockchip Electronic Co.,Ltd
*
* @License: SPDX-License-Identifier: Apache-2.0
*
* @Author: Chad.ma
* @Date: 2020-05-20 10:20:18
* @Company: Rockchip
* @LastEditTime: 2020-06-29 11:25:07
* @LastEditors: Do not edit
* @Description:
*/
#ifndef __RECORD_TEST_PAGE_H__
#define __RECORD_TEST_PAGE_H__
#include "pcba_def.h"
extern void record_page_init(int p_page);
extern void record_page_deinit(void);
extern void record_page_refresh(size_t type, size_t value);
extern void record_page_key(size_t type, size_t value);
#endif //__RECORD_TEST_PAGE_H__ | 25.125 | 68 | 0.749585 |
384103c6e2e5e4e2f7883d17b03ef0d476d2ccfa | 218 | h | C | interfaces/magnetism/magnetism.h | eliimata/ruuvi.drivers.c | fc0e0cb9bbc0d8af63ad6fa0e1e09b1742ffbd86 | [
"BSD-3-Clause"
] | null | null | null | interfaces/magnetism/magnetism.h | eliimata/ruuvi.drivers.c | fc0e0cb9bbc0d8af63ad6fa0e1e09b1742ffbd86 | [
"BSD-3-Clause"
] | null | null | null | interfaces/magnetism/magnetism.h | eliimata/ruuvi.drivers.c | fc0e0cb9bbc0d8af63ad6fa0e1e09b1742ffbd86 | [
"BSD-3-Clause"
] | null | null | null | #ifndef MAGNETISM_H
#define MAGNETISM_H
#include "ruuvi_error.h"
#define MAGNETISM_INVALID RUUVI_FLOAT_INVALID
// Unit is mg
typedef struct
{
float x_mg;
float y_mg;
float z_mg;
}ruuvi_magnetism_data_t;
#endif | 14.533333 | 45 | 0.779817 |
c06b307f3cc1145631df2f74fba27e67d5ed40a0 | 2,087 | h | C | rpc/thrift/with-folly/FrameUtils.h | curoky/my-own-x | 825273af2d73dff76562422ca87a077635ee870b | [
"Apache-2.0"
] | null | null | null | rpc/thrift/with-folly/FrameUtils.h | curoky/my-own-x | 825273af2d73dff76562422ca87a077635ee870b | [
"Apache-2.0"
] | null | null | null | rpc/thrift/with-folly/FrameUtils.h | curoky/my-own-x | 825273af2d73dff76562422ca87a077635ee870b | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2018-2022 curoky(cccuroky@gmail.com).
*
* This file is part of my-own-x.
* See https://github.com/curoky/my-own-x for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <thrift/lib/cpp/transport/THeader.h>
#include <memory>
#include <tuple>
#include <utility>
namespace mox {
class FrameUtils {
public:
using THeader = apache::thrift::transport::THeader;
static std::tuple<std::unique_ptr<folly::IOBuf>, size_t, std::unique_ptr<THeader>> removeFrame(
folly::IOBufQueue* q) {
if (!q || !q->front() || q->front()->empty()) {
return make_tuple(std::unique_ptr<folly::IOBuf>(), 0, nullptr);
}
auto header = std::make_unique<THeader>(THeader::ALLOW_BIG_FRAMES);
std::unique_ptr<folly::IOBuf> buf;
size_t remaining = 0;
try {
THeader::StringToStringMap persistentReadHeaders;
buf = header->removeHeader(q, remaining, persistentReadHeaders);
} catch (const std::exception& e) {
LOG(ERROR) << "Received invalid request from client: " << folly::exceptionStr(e);
throw;
}
if (!buf) {
return make_tuple(std::unique_ptr<folly::IOBuf>(), remaining, nullptr);
}
return make_tuple(std::move(buf), 0, std::move(header));
}
static std::unique_ptr<folly::IOBuf> addFrame(std::unique_ptr<folly::IOBuf> buf,
THeader* header) {
THeader::StringToStringMap persistentWriteHeaders;
return header->addHeader(std::move(buf), persistentWriteHeaders, false);
}
};
} // namespace mox
| 33.126984 | 97 | 0.675611 |
0e58a1fec721ecc4f7d87240f0bb626c8e7a4b7a | 871 | h | C | test/template-test/input/{{args.ProductName}}/{{args.ProductName}}/Values/{{args.Prefix}}ThemeColors.h | PennySuu/nei-toolkit | e66731ff7658f440b4703e2abb7a836a90e5976b | [
"MIT"
] | 703 | 2016-04-19T12:46:48.000Z | 2019-10-15T08:33:43.000Z | test/template-test/input/{{args.ProductName}}/{{args.ProductName}}/Values/{{args.Prefix}}ThemeColors.h | PennySuu/nei-toolkit | e66731ff7658f440b4703e2abb7a836a90e5976b | [
"MIT"
] | 106 | 2016-04-19T12:22:50.000Z | 2019-10-17T07:51:56.000Z | test/template-test/input/{{args.ProductName}}/{{args.ProductName}}/Values/{{args.Prefix}}ThemeColors.h | PennySuu/nei-toolkit | e66731ff7658f440b4703e2abb7a836a90e5976b | [
"MIT"
] | 113 | 2016-04-20T08:23:02.000Z | 2019-09-30T07:08:12.000Z | //
// {{args.Prefix}}ThemeColors.h
// {{args.ProductName}}
//
// Created by Baitianyu on 05/12/2016.
// Copyright © 2016 Netease. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface {{args.Prefix}}ThemeColors : NSObject
/* ********************* 主题背景色(通常由视觉统一规范规定)相关, 可根据所需自由添加 *************************/
/// 主题色,每个 App 都会有主题色(当然有些可换肤)
+ (UIColor *)themeColor;
/// 1 像素线的颜色
+ (UIColor *)themeLineColor;
/// 按钮的背景色
+ (UIColor *)themeButtonColor;
/// 按钮高亮时的背景色
+ (UIColor *)themeHighlightButtonColor;
/* *********************************** 导航栏颜色相关,可根据所需自由添加 ********************************/
/// 导航栏背景色
+ (UIColor *)naviBackgroundColor;
/// 导航栏字体颜色
+ (UIColor *)naviForegroundColor;
/* ********************* 主题字体颜色(通常由视觉统一规范规定)相关,可根据所需自由添加 ************************/
/// 默认字体颜色
+ (UIColor *)defaultTextColor;
@end
| 19.355556 | 90 | 0.560276 |
c40d458a215d4afe2e0224ac81c3b14d9173c84e | 284 | h | C | XQQChatProj/XQQChatProj/Classes/Tool/XQQToastTool.h | xiaogehenjimo/XQQDemo | 57a68cc2321ad71751960e6d6936fed17c8f60b0 | [
"Apache-2.0"
] | 12 | 2016-12-16T09:58:08.000Z | 2019-12-12T10:12:57.000Z | XQQChatProj/XQQChatProj/Classes/Tool/XQQToastTool.h | xiaogehenjimo/XQQDemo | 57a68cc2321ad71751960e6d6936fed17c8f60b0 | [
"Apache-2.0"
] | 2 | 2016-12-24T03:30:53.000Z | 2017-09-21T06:09:03.000Z | XQQChatProj/XQQChatProj/Classes/Tool/XQQToastTool.h | xiaogehenjimo/XQQDemo | 57a68cc2321ad71751960e6d6936fed17c8f60b0 | [
"Apache-2.0"
] | 3 | 2017-04-15T01:09:29.000Z | 2020-07-21T10:16:34.000Z | //
// XQQToastTool.h
// XQQChatProj
//
// Created by XQQ on 2016/11/15.
// Copyright © 2016年 UIP. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface XQQToastTool : NSObject
+ (void)showToastWithStr:(NSString*)str
view:(UIView*)view;
@end
| 17.75 | 47 | 0.647887 |
0d5657e294232e6bf9bb4b1a747c03767baf00f5 | 7,043 | h | C | bcap_core/include/bcap_core/bCAPServer/bcap_mapid.h | rizgiak/denso_robot_ros | 522f696528b0bf07419671a3f23eee7cff792d99 | [
"BSD-3-Clause"
] | 40 | 2017-11-24T15:50:17.000Z | 2021-12-21T02:29:20.000Z | bcap_core/include/bcap_core/bCAPServer/bcap_mapid.h | rizgiak/denso_robot_ros | 522f696528b0bf07419671a3f23eee7cff792d99 | [
"BSD-3-Clause"
] | 46 | 2017-12-08T11:49:24.000Z | 2022-03-19T12:12:16.000Z | bcap_core/include/bcap_core/bCAPServer/bcap_mapid.h | rizgiak/denso_robot_ros | 522f696528b0bf07419671a3f23eee7cff792d99 | [
"BSD-3-Clause"
] | 36 | 2017-12-04T10:36:25.000Z | 2022-03-08T19:48:11.000Z | #ifndef BCAP_MAPID_H_
#define BCAP_MAPID_H_
/**
* @file bcap_mapid.h
* @brief b-CAP MAP ID file.
* @details Defines b-CAP MAP IDs.
*
* @version 1.0
* @date 2015/12/16
* @author DENSO WAVE
*
* Software License Agreement (MIT License)
*
* @copyright Copyright (c) 2015 DENSO WAVE INCORPORATED
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "../bcap_funcid.h"
/**
* @struct MAP_ID
* @brief A map for function id information.
*/
struct MAP_ID
{
int32_t relation_id; /**< Function ID */
int return_flag; /**< If 1 then sends the response packet with a argument, else without any argument */
};
static const struct MAP_ID m_map_id[] =
{
{ 0, 0 },
{ ID_SERVICE_STOP, 0 }, // ID_SERVICE_START
{ -1, 0 }, // ID_SERVICE_STOP
{ ID_CONTROLLER_DISCONNECT, 1 }, // ID_CONTROLLER_CONNECT
{ -1, 0 }, // ID_CONTROLLER_DISCONNECT
{ ID_EXTENSION_RELEASE, 1 }, // ID_CONTROLLER_GETEXTENSION
{ ID_FILE_RELEASE, 1 }, // ID_CONTROLLER_GETFILE
{ ID_ROBOT_RELEASE, 1 }, // ID_CONTROLLER_GETROBOT
{ ID_TASK_RELEASE, 1 }, // ID_CONTROLLER_GETTASK
{ ID_VARIABLE_RELEASE, 1 }, // ID_CONTROLLER_GETVARIABLE
{ ID_COMMAND_RELEASE, 1 }, // ID_CONTROLLER_GETCOMMAND
{ 0, 1 }, // ID_CONTROLLER_GETEXTENSIONNAMES
{ 0, 1 }, // ID_CONTROLLER_GETFILENAMES
{ 0, 1 }, // ID_CONTROLLER_GETROBOTNAMES
{ 0, 1 }, // ID_CONTROLLER_GETTASKNAMES
{ 0, 1 }, // ID_CONTROLLER_GETVARIABLENAMES
{ 0, 1 }, // ID_CONTROLLER_GETCOMMANDNAMES
{ 0, 1 }, // ID_CONTROLLER_EXECUTE
{ ID_MESSAGE_RELEASE, 1 }, // ID_CONTROLLER_GETMESSAGE
{ 0, 1 }, // ID_CONTROLLER_GETATTRIBUTE
{ 0, 1 }, // ID_CONTROLLER_GETHELP
{ 0, 1 }, // ID_CONTROLLER_GETNAME
{ 0, 1 }, // ID_CONTROLLER_GETTAG
{ 0, 0 }, // ID_CONTROLLER_PUTTAG
{ 0, 1 }, // ID_CONTROLLER_GETID
{ 0, 0 }, // ID_CONTROLLER_PUTID
{ ID_VARIABLE_RELEASE, 1 }, // ID_EXTENSION_GETVARIABLE
{ 0, 1 }, // ID_EXTENSION_GETVARIABLENAMES
{ 0, 1 }, // ID_EXTENSION_EXECUTE
{ 0, 1 }, // ID_EXTENSION_GETATTRIBUTE
{ 0, 1 }, // ID_EXTENSION_GETHELP
{ 0, 1 }, // ID_EXTENSION_GETNAME
{ 0, 1 }, // ID_EXTENSION_GETTAG
{ 0, 0 }, // ID_EXTENSION_PUTTAG
{ 0, 1 }, // ID_EXTENSION_GETID
{ 0, 0 }, // ID_EXTENSION_PUTID
{ -1, 0 }, // ID_EXTENSION_RELEASE
{ ID_FILE_RELEASE, 1 }, // ID_FILE_GETFILE
{ ID_VARIABLE_RELEASE, 1 }, // ID_FILE_GETVARIABLE
{ 0, 1 }, // ID_FILE_GETFILENAMES
{ 0, 1 }, // ID_FILE_GETVARIABLENAMES
{ 0, 1 }, // ID_FILE_EXECUTE
{ 0, 0 }, // ID_FILE_COPY
{ 0, 0 }, // ID_FILE_DELETE
{ 0, 0 }, // ID_FILE_MOVE
{ 0, 1 }, // ID_FILE_RUN
{ 0, 1 }, // ID_FILE_GETDATECREATED
{ 0, 1 }, // ID_FILE_GETDATELASTACCESSED
{ 0, 1 }, // ID_FILE_GETDATELASTMODIFIED
{ 0, 1 }, // ID_FILE_GETPATH
{ 0, 1 }, // ID_FILE_GETSIZE
{ 0, 1 }, // ID_FILE_GETTYPE
{ 0, 1 }, // ID_FILE_GETVALUE
{ 0, 0 }, // ID_FILE_PUTVALUE
{ 0, 1 }, // ID_FILE_GETATTRIBUTE
{ 0, 1 }, // ID_FILE_GETHELP
{ 0, 1 }, // ID_FILE_GETNAME
{ 0, 1 }, // ID_FILE_GETTAG
{ 0, 0 }, // ID_FILE_PUTTAG
{ 0, 1 }, // ID_FILE_GETID
{ 0, 0 }, // ID_FILE_PUTID
{ -1, 0 }, // ID_FILE_RELEASE
{ ID_VARIABLE_RELEASE, 1 }, // ID_ROBOT_GETVARIABLE
{ 0, 1 }, // ID_ROBOT_GETVARIABLENAMES
{ 0, 1 }, // ID_ROBOT_EXECUTE
{ 0, 0 }, // ID_ROBOT_ACCELERATE
{ 0, 0 }, // ID_ROBOT_CHANGE
{ 0, 0 }, // ID_ROBOT_CHUCK
{ 0, 0 }, // ID_ROBOT_DRIVE
{ 0, 0 }, // ID_ROBOT_GOHOME
{ 0, 0 }, // ID_ROBOT_HALT
{ 0, 0 }, // ID_ROBOT_HOLD
{ 0, 0 }, // ID_ROBOT_MOVE
{ 0, 0 }, // ID_ROBOT_ROTATE
{ 0, 0 }, // ID_ROBOT_SPEED
{ 0, 0 }, // ID_ROBOT_UNCHUCK
{ 0, 0 }, // ID_ROBOT_UNHOLD
{ 0, 1 }, // ID_ROBOT_GETATTRIBUTE
{ 0, 1 }, // ID_ROBOT_GETHELP
{ 0, 1 }, // ID_ROBOT_GETNAME
{ 0, 1 }, // ID_ROBOT_GETTAG
{ 0, 0 }, // ID_ROBOT_PUTTAG
{ 0, 1 }, // ID_ROBOT_GETID
{ 0, 0 }, // ID_ROBOT_PUTID
{ -1, 0 }, // ID_ROBOT_RELEASE
{ ID_VARIABLE_RELEASE, 1 }, // ID_TASK_GETVARIABLE
{ 0, 1 }, // ID_TASK_GETVARIABLENAMES
{ 0, 1 }, // ID_TASK_EXECUTE
{ 0, 0 }, // ID_TASK_START
{ 0, 0 }, // ID_TASK_STOP
{ 0, 0 }, // ID_TASK_DELETE
{ 0, 1 }, // ID_TASK_GETFILENAME
{ 0, 1 }, // ID_TASK_GETATTRIBUTE
{ 0, 1 }, // ID_TASK_GETHELP
{ 0, 1 }, // ID_TASK_GETNAME
{ 0, 1 }, // ID_TASK_GETTAG
{ 0, 0 }, // ID_TASK_PUTTAG
{ 0, 1 }, // ID_TASK_GETID
{ 0, 0 }, // ID_TASK_PUTID
{ -1, 0 }, // ID_TASK_RELEASE
{ 0, 1 }, // ID_VARIABLE_GETDATETIME
{ 0, 1 }, // ID_VARIABLE_GETVALUE
{ 0, 0 }, // ID_VARIABLE_PUTVALUE
{ 0, 1 }, // ID_VARIABLE_GETATTRIBUTE
{ 0, 1 }, // ID_VARIABLE_GETHELP
{ 0, 1 }, // ID_VARIABLE_GETNAME
{ 0, 1 }, // ID_VARIABLE_GETTAG
{ 0, 0 }, // ID_VARIABLE_PUTTAG
{ 0, 1 }, // ID_VARIABLE_GETID
{ 0, 0 }, // ID_VARIABLE_PUTID
{ 0, 1 }, // ID_VARIABLE_GETMICROSECOND
{ -1, 0 }, // ID_VARIABLE_RELEASE
{ 0, 0 }, // ID_COMMAND_EXECUTE
{ 0, 0 }, // ID_COMMAND_CANCEL
{ 0, 1 }, // ID_COMMAND_GETTIMEOUT
{ 0, 0 }, // ID_COMMAND_PUTTIMEOUT
{ 0, 1 }, // ID_COMMAND_GETSTATE
{ 0, 1 }, // ID_COMMAND_GETPARAMETERS
{ 0, 0 }, // ID_COMMAND_PUTPARAMETERS
{ 0, 1 }, // ID_COMMAND_GETRESULT
{ 0, 1 }, // ID_COMMAND_GETATTRIBUTE
{ 0, 1 }, // ID_COMMAND_GETHELP
{ 0, 1 }, // ID_COMMAND_GETNAME
{ 0, 1 }, // ID_COMMAND_GETTAG
{ 0, 1 }, // ID_COMMAND_PUTTAG
{ 0, 1 }, // ID_COMMAND_GETID
{ 0, 0 }, // ID_COMMAND_PUTID
{ -1, 0 }, // ID_COMMAND_RELEASE
{ 0, 0 }, // ID_MESSAGE_REPLY
{ 0, 0 }, // ID_MESSAGE_CLEAR
{ 0, 1 }, // ID_MESSAGE_GETDATETIME
{ 0, 1 }, // ID_MESSAGE_GETDESCRIPTION
{ 0, 1 }, // ID_MESSAGE_GETDESTINATION
{ 0, 1 }, // ID_MESSAGE_GETNUMBER
{ 0, 1 }, // ID_MESSAGE_GETSERIALNUMBER
{ 0, 1 }, // ID_MESSAGE_GETSOURCE
{ 0, 1 }, // ID_MESSAGE_GETVALUE
{ -1, 0 }, // ID_MESSAGE_RELEASE
};
#endif /* BCAP_MAPID_H_ */
| 36.874346 | 109 | 0.61806 |
33eeaa79af64cfc0f7382cba47be96cd35b42085 | 2,841 | c | C | 13_IPC_FIFO/IPC_FIFO.c | suda-morris/CUnderLinux | 02c47f952c6fae0aadf118965b4b1ee1cd0c6cc1 | [
"Apache-2.0"
] | 2 | 2020-04-03T16:41:48.000Z | 2021-02-23T01:58:10.000Z | 13_IPC_FIFO/IPC_FIFO.c | suda-morris/c_review | 02c47f952c6fae0aadf118965b4b1ee1cd0c6cc1 | [
"Apache-2.0"
] | null | null | null | 13_IPC_FIFO/IPC_FIFO.c | suda-morris/c_review | 02c47f952c6fae0aadf118965b4b1ee1cd0c6cc1 | [
"Apache-2.0"
] | 2 | 2020-12-08T02:13:12.000Z | 2021-10-10T19:55:05.000Z | /*
* IPC_FIFO.c
*
* Created on: 2016年11月1日
* Author: morris
* 要求:
* 进程间通信之---有名管道
* 一个终端写数据到管道中,另一个终端从管道中读取数据
* ********************************************************************
* 1. 有名管道是对无名管道的一种改进,其特点为:
* a. 可以使互不相关的两个进程实现彼此间通信
* b. 该管道可以通过路径名来指定,并且在文件系统中是可见的。
* c. 在建立了管道之后,两个进程就可以把它当作普通文件来进行读写操作,在创建管道
* 成功后,就可以使用open、read和write这些函数了
* d. 严格的遵循先进先出规则,它们不支持文件定位操作,如lseek等
* 2. 有名管道的创建可以使用mkfifo,该函数类似于文件中的open操作,
* 可以指定管道的路径和打开模式。用户还可以在命令行使用“mknod 管道名 p”来创建有名管道
* 3. 打开有名管道,如果只有读端或者写端,那么open函数会阻塞,只有读写端都存在,
* 才能打开成功。这个问题可以在调用open函数的时候增加O_NONBLOCK选项解决
* 4. ‘有名’的含义:有一个对应的文件存放在文件系统中(大小始终为0)
* ********************************************************************
* int mkfifo(const char* filename, mode_t mode);创建有名管道
* filename:要创建的管道名字
* mode:文件的权限,可以用八进制数表示
* 返回:
* 成功:返回0
* 出错:返回-1,并设置errno
* int access(const char *name, int type);测试文件的访问权限
* name:文件名字符串
* type:测试的类型
* R_OK:是否可读
* W_OK:是否可写
* X_OK:是否可执行
* F_OK:是否存在
* 返回:
* 成功:返回0
* 出错:返回-1,并设置errno
*/
#include <asm-generic/errno-base.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#define MYFIFO_STR "/tmp/myfifo" //有名管道文件名
#define BUFFER_SIZE 512
/* 程序用法提示 */
void Usage(char* arg) {
printf("Usage:%s w/W/r/R [string for write]\r\n", arg);
}
int main(int argc, char **argv) {
char buf[BUFFER_SIZE];
int fd;
int real_write, real_read;
/* 参数检查 */
if (argc <= 1) {
Usage(argv[0]);
exit(1);
}
/* 向FIFO中写入数据 */
if ((strncasecmp(argv[1], "W", 1) == 0)) {
if (argc <= 2) {
Usage(argv[0]);
exit(1);
}
/* 丛输入命令行中提取要写如的数据 */
sscanf(argv[2], "%s", buf);
/* 以只写阻塞的方式打开有名管道 */
fd = open(MYFIFO_STR, O_WRONLY);
if (fd < 0) {
perror("open");
exit(1);
}
/* 将数据写入管道 */
real_write = write(fd, buf, BUFFER_SIZE);
if (real_write == -1) {
if (errno != EAGAIN) {
perror("write");
exit(1);
}
} else if (real_write > 0) {
printf("Write '%s' to FIFO\r\n", buf);
}
} else if ((strncasecmp(argv[1], "R", 1) == 0)) { //从FIFO中读取数据
/* 判断管道文件是否已经存在 */
if (access(MYFIFO_STR, F_OK) == -1) {
/* 管道不存在,若尚未创建,则以相应的权限创建 */
if (mkfifo(MYFIFO_STR, 0666) < 0) {
perror("mkfifo");
exit(1);
}
}
/* 以只读阻塞的方式打开管道文件 */
fd = open(MYFIFO_STR, O_RDONLY);
if (fd < 0) {
perror("open");
exit(1);
}
/* 循环读取管道中的数据 */
while (1) {
memset(buf, 0, BUFFER_SIZE);
real_read = read(fd, buf, BUFFER_SIZE);
if (real_read == -1) {
if (errno != EAGAIN) {
perror("read");
exit(1);
}
} else if (real_read > 0) {
printf("Read '%s' from FIFO\r\n", buf);
/* 如果收到quit字符串就退出 */
if (strncmp(buf, "quit", 4) == 0) {
break;
}
}
}
} else {
exit(1);
}
/* 关闭管道文件 */
close(fd);
return 0;
}
| 21.853846 | 72 | 0.564942 |
dca0f784cf2c62a1f4c0f2c4b1a97895f4677d3b | 2,713 | h | C | src/rtree.h | xtang2/RTree | e1e913be0bfbfb60fbdfacb536a84398c6c0c5fc | [
"MIT"
] | null | null | null | src/rtree.h | xtang2/RTree | e1e913be0bfbfb60fbdfacb536a84398c6c0c5fc | [
"MIT"
] | null | null | null | src/rtree.h | xtang2/RTree | e1e913be0bfbfb60fbdfacb536a84398c6c0c5fc | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <sstream>
#include <utility>
#include <stack>
using namespace std;
struct Page;
struct Entry;
typedef struct Rectangle
{
int x1,y1,x2,y2;
string label;
Rectangle(string lab, int x_1, int y_1, int x_2, int y_2){ // rectangle constructor
label = lab;
x1 = x_1;
y1 = y_1;
x2 = x_2;
y2 = y_2;
};
Rectangle(){ label = ""; };
}Rectangle;
typedef struct Entry // 1 data entry in a page
{
Rectangle rect; // rectangle
Page *ptr; // pointer to subtree page
Entry(){ rect.label = "";};
}Entry;
typedef struct Page
{
Entry entries[4]; // the subtrees of the intermediate node
bool isLeaf; // is the page a leaf or not?
Page(){ isLeaf = false;};
}Page;
//Page newPage = new Page;
//Page leaf = new Page;//create a leaf page
typedef struct Pair{
Page *vP;
int index;
}Pair;
class RTree{
public:
Page* root;//pointer to the root of the tree
bool TreeisEmpty;
//Pair visited;
stack<Pair> mystack;
std::ostringstream mbrstr;
RTree();
//simply inserts into your RTree page.
void insert(string label, int x1, int y1, int x2, int y2 );
// returns the nearest rectangle to the given point (x1, y1).
void nearest_neighbor(int x1, int y1);
// returns all of the rectangles contained within the given rectangle (x1, y1, x2, y2)
void contains(int x1, int y1, int x2, int y2);
//compute the MBR of a page
Rectangle computeMBR1(Entry *ent);
//compute the MBR of two rectangle
Rectangle computeMBR2(Rectangle A, Rectangle B);
int computeArea(int x1, int y1, int x2, int y2);
//find the area dfference between R1 and R2
int Difference(Rectangle R1, Rectangle R2);
//display the tree
void display();
//insert
int doInsert(Page *p, Rectangle Rect, Page *ptr);
Rectangle* linearSort(Rectangle *rectangles);
//check if the page is full
bool isFull(Page *p);
//split if a page is full
void Split(Page *p, Rectangle newNode);
//RTree &operator= (const RTree&);
};
//simply inserts into your RTree page.
//void insert(string label, float x1, float y1, float x2, float y2 );
// returns the nearest rectangle to the given point (x1, y1).
//void nearest_neighbor(float x1, float y1);
// returns all of the rectangles contained within the given rectangle (x1, y1, x2, y2)
//void contains(float x1, float y1, float x2, float y2);
//void Initial();
//void display();//display the entries in the rtree
// compute the mbr of the set of rectangles
//rectangle computeMBR(rectangle *rectangles);
| 22.798319 | 90 | 0.64836 |
98888d794138c5450ea9cc87a08cfe30ab58fff6 | 1,772 | h | C | include/batteries/ibattery-batt.h | pvavercak/randomness-testing-toolkit | 8a29349edee0dc44bc8e765708555dda57b9e339 | [
"MIT"
] | null | null | null | include/batteries/ibattery-batt.h | pvavercak/randomness-testing-toolkit | 8a29349edee0dc44bc8e765708555dda57b9e339 | [
"MIT"
] | null | null | null | include/batteries/ibattery-batt.h | pvavercak/randomness-testing-toolkit | 8a29349edee0dc44bc8e765708555dda57b9e339 | [
"MIT"
] | null | null | null | #ifndef RTT_IBATTERY_H
#define RTT_IBATTERY_H
#include "batteries/itest-batt.h"
#include "batteries/itestresult-batt.h"
namespace rtt {
namespace batteries {
/**
* @brief The IBattery class General interface for batteries to store their settings and tests.
*/
class IBattery {
public:
/**
* @brief getInstance Creates an initialized object
* @param cont Global settings
* @return
*/
static std::unique_ptr<IBattery> getInstance(const GlobalContainer & cont);
/**
* @brief runTests Executes all tests in the battery
*/
void runTests();
/**
* @brief ~IBattery Destructor.
*/
virtual ~IBattery() {}
/**
* @brief getTestResults
* @return Results of the executed tests, will throw
* error if the Battery wasn't executed before.
*/
virtual std::vector<std::unique_ptr<ITestResult>> getTestResults() const = 0;
protected:
IBattery(const GlobalContainer & cont);
/* Variables common for all batteries. Set in getInstance().
* Used by batteries in later stages. */
/* Objects pointing to global object storage -
* many classes use these objects */
clinterface::RTTCliOptions * rttCliOptions;
Configuration * batteryConfiguration;
ToolkitSettings * toolkitSettings;
Logger * logger;
/* Variables initialized in getInstance() */
time_t creationTime;
clinterface::BatteryArg battery;
std::string objectInfo;
/* Battery is keeping track of tests set to execution.
* Test objects keep track of their settings and execution results. */
std::vector<std::unique_ptr<ITest>> tests;
/* Set to true after execution */
bool executed = false;
};
} // namespace batteries
} // namespace rtt
#endif // RTT_IBATTERY_H
| 27.261538 | 95 | 0.681151 |
8994d757dc61c3c6dccf524ba19b29ff7ffa305c | 1,412 | h | C | track.h | light-bringer/refactoring-exercise | dbf3fed6b947569d12bf7f34964c79d54d9872c2 | [
"MIT"
] | null | null | null | track.h | light-bringer/refactoring-exercise | dbf3fed6b947569d12bf7f34964c79d54d9872c2 | [
"MIT"
] | null | null | null | track.h | light-bringer/refactoring-exercise | dbf3fed6b947569d12bf7f34964c79d54d9872c2 | [
"MIT"
] | null | null | null | /* * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Program: MyTunes Music Player */
/* Author: Louis Nel */
/* Date: 21-SEP-2017 */
/* */
/* (c) 2017 Louis Nel */
/* All rights reserved. Distribution and */
/* reposting, in part or in whole, requires */
/* written consent of the author. */
/* */
/* COMP 2404 students may reuse this content for */
/* their course assignments without seeking consent */
/* * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _TRACK_H
#define _TRACK_H
#include <ostream>
#include <string>
using namespace std;
#include "song.h"
class Track {
/*
Track represents a audio recording of a single Song
*/
public:
Track(const int aTrackID, Song * songptr, const string & anMp3FileName = "Unknown" );
~Track(void);
int getID();
Song * getSong();
string getMp3FileName();
string toString() const;
private:
int id;
Song * song; //song that tracks is a recording of
string mp3FileName;
Track(const Track & aTrack); //hide copy constructor in private section
};
ostream & operator<<(ostream & out, const Track & aTrack);
#endif | 32.090909 | 87 | 0.478045 |
817003047f6b4d385c756d1da9ca78589c65cc5f | 661 | h | C | Uranus/src/Uranus/Renderer/Texture.h | zaka7024/Uranus | 948312ae5b39c92b4f0c415afc39ca2b4ae636f0 | [
"Apache-2.0"
] | 4 | 2020-12-11T13:32:06.000Z | 2021-01-05T16:10:21.000Z | Uranus/src/Uranus/Renderer/Texture.h | zaka7024/Uranus | 948312ae5b39c92b4f0c415afc39ca2b4ae636f0 | [
"Apache-2.0"
] | null | null | null | Uranus/src/Uranus/Renderer/Texture.h | zaka7024/Uranus | 948312ae5b39c92b4f0c415afc39ca2b4ae636f0 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "Uranus/Core/Core.h"
#include <filesystem>
namespace Uranus {
class Texture {
public:
~Texture() = default;
virtual void Bind(uint32_t slot = 0) = 0;
virtual void SetData(void* data, uint32_t size) = 0;
virtual uint32_t GetWidth() const = 0;
virtual uint32_t GetHeight() const = 0;
virtual uint32_t GetRendereId() const = 0;
virtual std::filesystem::path GetAssetFilePath() = 0;
virtual bool operator==(const Texture& other) const = 0;
};
class Texture2D : public Texture {
public:
static Ref<Texture2D> Create(const std::string& path);
static Ref<Texture2D> Create(uint32_t width, uint32_t height);
};
} | 22.033333 | 64 | 0.70348 |
81ac01e835907939174c0025b9754836690e9be5 | 2,092 | h | C | include/s3/s3.h | aggarwalanubhav/Nucleus | 107113cd9a1b68b1a28b35091ed17785ed32d319 | [
"Apache-2.0"
] | null | null | null | include/s3/s3.h | aggarwalanubhav/Nucleus | 107113cd9a1b68b1a28b35091ed17785ed32d319 | [
"Apache-2.0"
] | null | null | null | include/s3/s3.h | aggarwalanubhav/Nucleus | 107113cd9a1b68b1a28b35091ed17785ed32d319 | [
"Apache-2.0"
] | 1 | 2021-05-18T07:21:24.000Z | 2021-05-18T07:21:24.000Z | /*
* Copyright 2019-present Open Networking Foundation
* Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __UE_S3_H_
#define __UE_S3_H_
#include <stdint.h>
#include <stdbool.h>
#include "log.h"
#include "s11_structs.h"
#include <gtpV2StackWrappers.h>
/*No of threads handling S11 GTPv2 messages coming in*/
#define S3_THREADPOOL_SIZE 5
#define S3_GTPV2C_BUF_LEN 4096
/*GTPv2c IE message types*/
#define S3_IE_CAUSE 2
#define S3_IE_FTEID_C 87
#define S3_IE_PAA 79
#define S3_IE_APN_RESTRICTION 127
#define S3_IE_BEARER_CTX 93
#define S3_IE_EPS_BEARER_ID 73
int
init_s3();
void
handle_s3_message(void *message);
int
init_s3();
void
handle_s3_message(void *message);
int
s3_transation(char * buf, unsigned int len);
/*void* create_session_handler(void *);
void* create_bearer_resp_handler(void *);
void* delete_bearer_resp_handler(void *);
void* modify_bearer_handler(void *);
void* release_bearer_handler(void *);
void* delete_session_handler(void *);
void* ddn_ack_handler(void *);
void* ddn_failure_ind_handler(void *);
int s11_CS_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip);
int s11_CB_req_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip, uint16_t src_port);
int s11_DB_req_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip, uint16_t src_port);
int s11_MB_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip);
int s11_DS_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip);
int s11_RB_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip);
int s11_DDN_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip);
int s11_ECHO_req_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr, uint32_t sgw_ip_val, uint16_t src_port);*/
void get_sequence(uint32_t *seq);
void
bswap8_array(uint8_t *src, uint8_t *dest, uint32_t len);
int parse_gtpv2c_IEs(char *msg, int len, struct s11_proto_IE *proto_ies);
#endif /*S3_H*/
| 29.464789 | 117 | 0.793499 |
ed7fdc43dc5ece3c0239dc19c8343b2edeee38e8 | 22,007 | c | C | apps/restconf/restconf_main.c | loeliger/clixon | 9bd67b21e68872299c1db12eb06b19bdcf42cb4f | [
"Apache-2.0"
] | null | null | null | apps/restconf/restconf_main.c | loeliger/clixon | 9bd67b21e68872299c1db12eb06b19bdcf42cb4f | [
"Apache-2.0"
] | null | null | null | apps/restconf/restconf_main.c | loeliger/clixon | 9bd67b21e68872299c1db12eb06b19bdcf42cb4f | [
"Apache-2.0"
] | null | null | null | /*
*
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
This file is part of CLIXON.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 3 or later (the "GPL"),
in which case the provisions of the GPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of the GPL, and not to allow others to
use your version of this file under the terms of Apache License version 2,
indicate your decision by deleting the provisions above and replace them with
the notice and other provisions required by the GPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the Apache License version 2 or the GPL.
***** END LICENSE BLOCK *****
*/
/*
* This program should be run as user www-data
*
* See draft-ietf-netconf-restconf-13.txt [draft]
* sudo apt-get install libfcgi-dev
* gcc -o fastcgi fastcgi.c -lfcgi
* sudo su -c "/www-data/clixon_restconf -D 1 -f /usr/local/etc/example.xml " -s /bin/sh www-data
* This is the interface:
* api/data/profile=<name>/metric=<name> PUT data:enable=<flag>
* api/test
*/
#ifdef HAVE_CONFIG_H
#include "clixon_config.h" /* generated by config & autoconf */
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <syslog.h>
#include <fcntl.h>
#include <time.h>
#include <limits.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <libgen.h>
/* cligen */
#include <cligen/cligen.h>
/* clicon */
#include <clixon/clixon.h>
#include <fcgiapp.h> /* Need to be after clixon_xml.h due to attribute format */
/* restconf */
#include "restconf_lib.h"
#include "restconf_methods.h"
#include "restconf_stream.h"
/* Command line options to be passed to getopt(3) */
#define RESTCONF_OPTS "hD:f:l:p:y:a:u:"
/* RESTCONF enables deployments to specify where the RESTCONF API is
located. The client discovers this by getting the "/.well-known/host-meta"
resource
*/
#define RESTCONF_WELL_KNOWN "/.well-known/host-meta"
/*! Generic REST method, GET, PUT, DELETE, etc
* @param[in] h CLIXON handle
* @param[in] r Fastcgi request handle
* @param[in] api_path According to restconf (Sec 3.5.1.1 in [draft])
* @param[in] pcvec Vector of path ie DOCUMENT_URI element
* @param[in] pi Offset, where to start pcvec
* @param[in] qvec Vector of query string (QUERY_STRING)
* @param[in] dvec Stream input daat
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] use_xml Set to 0 for JSON and 1 for XML
* @param[in] parse_xml Set to 0 for JSON and 1 for XML for input data
*/
static int
api_data(clicon_handle h,
FCGX_Request *r,
char *api_path,
cvec *pcvec,
int pi,
cvec *qvec,
char *data,
int pretty,
int use_xml,
int parse_xml)
{
int retval = -1;
char *request_method;
clicon_debug(1, "%s", __FUNCTION__);
request_method = FCGX_GetParam("REQUEST_METHOD", r->envp);
clicon_debug(1, "%s method:%s", __FUNCTION__, request_method);
if (strcmp(request_method, "OPTIONS")==0)
retval = api_data_options(h, r);
else if (strcmp(request_method, "HEAD")==0)
retval = api_data_head(h, r, pcvec, pi, qvec, pretty, use_xml);
else if (strcmp(request_method, "GET")==0)
retval = api_data_get(h, r, pcvec, pi, qvec, pretty, use_xml);
else if (strcmp(request_method, "POST")==0)
retval = api_data_post(h, r, api_path, pcvec, pi, qvec, data, pretty, use_xml, parse_xml);
else if (strcmp(request_method, "PUT")==0)
retval = api_data_put(h, r, api_path, pcvec, pi, qvec, data, pretty, use_xml, parse_xml);
else if (strcmp(request_method, "PATCH")==0)
retval = api_data_patch(h, r, api_path, pcvec, pi, qvec, data);
else if (strcmp(request_method, "DELETE")==0)
retval = api_data_delete(h, r, api_path, pi, pretty, use_xml);
else
retval = notfound(r);
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
/*! Operations REST method, POST
* @param[in] h CLIXON handle
* @param[in] r Fastcgi request handle
* @param[in] path According to restconf (Sec 3.5.1.1 in [draft])
* @param[in] pcvec Vector of path ie DOCUMENT_URI element
* @param[in] pi Offset, where to start pcvec
* @param[in] qvec Vector of query string (QUERY_STRING)
* @param[in] data Stream input data
* @param[in] parse_xml Set to 0 for JSON and 1 for XML for input data
*/
static int
api_operations(clicon_handle h,
FCGX_Request *r,
char *path,
cvec *pcvec,
int pi,
cvec *qvec,
char *data,
int pretty,
int use_xml,
int parse_xml)
{
int retval = -1;
char *request_method;
clicon_debug(1, "%s", __FUNCTION__);
request_method = FCGX_GetParam("REQUEST_METHOD", r->envp);
clicon_debug(1, "%s method:%s", __FUNCTION__, request_method);
if (strcmp(request_method, "GET")==0)
retval = api_operations_get(h, r, path, pcvec, pi, qvec, data, pretty, use_xml);
else if (strcmp(request_method, "POST")==0)
retval = api_operations_post(h, r, path, pcvec, pi, qvec, data,
pretty, use_xml, parse_xml);
else
retval = notfound(r);
return retval;
}
/*! Determine the root of the RESTCONF API
* @param[in] h Clicon handle
* @param[in] r Fastcgi request handle
* @note Hardcoded to "/restconf"
* Return see RFC8040 3.1 and RFC7320
* In line with the best practices defined by [RFC7320], RESTCONF
* enables deployments to specify where the RESTCONF API is located.
*/
static int
api_well_known(clicon_handle h,
FCGX_Request *r)
{
clicon_debug(1, "%s", __FUNCTION__);
FCGX_FPrintF(r->out, "Content-Type: application/xrd+xml\r\n");
FCGX_FPrintF(r->out, "\r\n");
FCGX_SetExitStatus(200, r->out); /* OK */
FCGX_FPrintF(r->out, "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>\n");
FCGX_FPrintF(r->out, " <Link rel='restconf' href='/restconf'/>\n");
FCGX_FPrintF(r->out, "</XRD>\r\n");
return 0;
}
/*! Retrieve the Top-Level API Resource
* @param[in] h Clicon handle
* @param[in] r Fastcgi request handle
* @note Only returns null for operations and data,...
* See RFC8040 3.3
*/
static int
api_root(clicon_handle h,
FCGX_Request *r)
{
int retval = -1;
char *media_accept;
int use_xml = 0; /* By default use JSON */
cxobj *xt = NULL;
cbuf *cb = NULL;
int pretty;
clicon_debug(1, "%s", __FUNCTION__);
pretty = clicon_option_bool(h, "CLICON_RESTCONF_PRETTY");
media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp);
if (strcmp(media_accept, "application/yang-data+xml")==0)
use_xml++;
clicon_debug(1, "%s use-xml:%d media-accept:%s", __FUNCTION__, use_xml, media_accept);
FCGX_SetExitStatus(200, r->out); /* OK */
FCGX_FPrintF(r->out, "Content-Type: application/yang-data+%s\r\n", use_xml?"xml":"json");
FCGX_FPrintF(r->out, "\r\n");
if (xml_parse_string("<restconf><data></data><operations></operations><yang-library-version>2016-06-21</yang-library-version></restconf>", NULL, &xt) < 0)
goto done;
if ((cb = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
}
if (xml_rootchild(xt, 0, &xt) < 0)
goto done;
if (use_xml){
if (clicon_xml2cbuf(cb, xt, 0, pretty) < 0)
goto done;
}
else
if (xml2json_cbuf(cb, xt, pretty) < 0)
goto done;
FCGX_FPrintF(r->out, "%s", cb?cbuf_get(cb):"");
FCGX_FPrintF(r->out, "\r\n\r\n");
retval = 0;
done:
if (cb)
cbuf_free(cb);
if (xt)
xml_free(xt);
return retval;
}
/*!
* See https://tools.ietf.org/html/rfc7895
*/
static int
api_yang_library_version(clicon_handle h,
FCGX_Request *r)
{
int retval = -1;
char *media_accept;
int use_xml = 0; /* By default use JSON */
cxobj *xt = NULL;
cbuf *cb = NULL;
int pretty;
char *ietf_yang_library_revision = "2016-06-21"; /* XXX */
clicon_debug(1, "%s", __FUNCTION__);
pretty = clicon_option_bool(h, "CLICON_RESTCONF_PRETTY");
media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp);
if (strcmp(media_accept, "application/yang-data+xml")==0)
use_xml++;
FCGX_SetExitStatus(200, r->out); /* OK */
FCGX_FPrintF(r->out, "Content-Type: application/yang-data+%s\r\n", use_xml?"xml":"json");
FCGX_FPrintF(r->out, "\r\n");
if (xml_parse_va(&xt, NULL, "<yang-library-version>%s</yang-library-version>", ietf_yang_library_revision) < 0)
goto done;
if (xml_rootchild(xt, 0, &xt) < 0)
goto done;
if ((cb = cbuf_new()) == NULL){
goto done;
}
if (use_xml){
if (clicon_xml2cbuf(cb, xt, 0, pretty) < 0)
goto done;
}
else{
if (xml2json_cbuf(cb, xt, pretty) < 0)
goto done;
}
clicon_debug(1, "%s cb%s", __FUNCTION__, cbuf_get(cb));
FCGX_FPrintF(r->out, "%s\n", cb?cbuf_get(cb):"");
FCGX_FPrintF(r->out, "\n\n");
retval = 0;
done:
if (cb)
cbuf_free(cb);
if (xt)
xml_free(xt);
return retval;
}
/*! Process a FastCGI request
* @param[in] r Fastcgi request handle
*/
static int
api_restconf(clicon_handle h,
FCGX_Request *r)
{
int retval = -1;
char *path;
char *query;
char *method;
char **pvec = NULL;
int pn;
cvec *qvec = NULL;
cvec *dvec = NULL;
cvec *pcvec = NULL; /* for rest api */
cbuf *cb = NULL;
char *data;
int authenticated = 0;
char *media_accept;
char *media_content_type;
int pretty;
int parse_xml = 0; /* By default expect and parse JSON */
int use_xml = 0; /* By default use JSON */
cbuf *cbret = NULL;
cxobj *xret = NULL;
cxobj *xerr;
clicon_debug(1, "%s", __FUNCTION__);
path = FCGX_GetParam("REQUEST_URI", r->envp);
query = FCGX_GetParam("QUERY_STRING", r->envp);
pretty = clicon_option_bool(h, "CLICON_RESTCONF_PRETTY");
/* get xml/json in put and output */
media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp);
if (media_accept && strcmp(media_accept, "application/yang-data+xml")==0)
use_xml++;
media_content_type = FCGX_GetParam("HTTP_CONTENT_TYPE", r->envp);
if (media_content_type &&
strcmp(media_content_type, "application/yang-data+xml")==0)
parse_xml++;
if ((pvec = clicon_strsep(path, "/", &pn)) == NULL)
goto done;
/* Sanity check of path. Should be /restconf/ */
if (pn < 2){
notfound(r);
goto ok;
}
if (strlen(pvec[0]) != 0){
retval = notfound(r);
goto done;
}
if (strcmp(pvec[1], RESTCONF_API)){
retval = notfound(r);
goto done;
}
test(r, 1);
if (pn == 2){
retval = api_root(h, r);
goto done;
}
if ((method = pvec[2]) == NULL){
retval = notfound(r);
goto done;
}
clicon_debug(1, "%s: method=%s", __FUNCTION__, method);
if (str2cvec(query, '&', '=', &qvec) < 0)
goto done;
if (str2cvec(path, '/', '=', &pcvec) < 0) /* rest url eg /album=ricky/foo */
goto done;
/* data */
if ((cb = readdata(r)) == NULL)
goto done;
data = cbuf_get(cb);
clicon_debug(1, "%s DATA=%s", __FUNCTION__, data);
if (str2cvec(data, '&', '=', &dvec) < 0)
goto done;
/* If present, check credentials. See "plugin_credentials" in plugin
* See RFC 8040 section 2.5
*/
if ((authenticated = clixon_plugin_auth(h, r)) < 0)
goto done;
clicon_debug(1, "%s auth:%d %s", __FUNCTION__, authenticated, clicon_username_get(h));
/* If set but no user, we set a dummy user */
if (authenticated){
if (clicon_username_get(h) == NULL)
clicon_username_set(h, "none");
}
else{
if (netconf_access_denied_xml(&xret, "protocol", "The requested URL was unauthorized") < 0)
goto done;
if ((xerr = xpath_first(xret, "//rpc-error")) != NULL){
if (api_return_err(h, r, xerr, pretty, use_xml) < 0)
goto done;
goto ok;
}
goto ok;
}
clicon_debug(1, "%s auth2:%d %s", __FUNCTION__, authenticated, clicon_username_get(h));
if (strcmp(method, "yang-library-version")==0){
if (api_yang_library_version(h, r) < 0)
goto done;
}
else if (strcmp(method, "data") == 0){ /* restconf, skip /api/data */
if (api_data(h, r, path, pcvec, 2, qvec, data,
pretty, use_xml, parse_xml) < 0)
goto done;
}
else if (strcmp(method, "operations") == 0){ /* rpc */
if (api_operations(h, r, path, pcvec, 2, qvec, data,
pretty, use_xml, parse_xml) < 0)
goto done;
}
else if (strcmp(method, "test") == 0)
test(r, 0);
else
notfound(r);
ok:
retval = 0;
done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
if (pvec)
free(pvec);
if (dvec)
cvec_free(dvec);
if (qvec)
cvec_free(qvec);
if (pcvec)
cvec_free(pcvec);
if (cb)
cbuf_free(cb);
if (cbret)
cbuf_free(cbret);
if (xret)
xml_free(xret);
return retval;
}
/* Need global variable to for signal handler XXX */
static clicon_handle _CLICON_HANDLE = NULL;
/*! Signall terminates process
*/
static void
restconf_sig_term(int arg)
{
static int i=0;
if (i++ == 0)
clicon_log(LOG_NOTICE, "%s: %s: pid: %u Signal %d",
__PROGRAM__, __FUNCTION__, getpid(), arg);
else
exit(-1);
if (_CLICON_HANDLE){
stream_child_freeall(_CLICON_HANDLE);
restconf_terminate(_CLICON_HANDLE);
}
clicon_exit_set(); /* checked in event_loop() */
exit(-1);
}
static void
restconf_sig_child(int arg)
{
int status;
int pid;
if ((pid = waitpid(-1, &status, 0)) != -1 && WIFEXITED(status))
stream_child_free(_CLICON_HANDLE, pid);
}
/*! Usage help routine
* @param[in] argv0 command line
* @param[in] h Clicon handle
*/
static void
usage(clicon_handle h,
char *argv0)
{
fprintf(stderr, "usage:%s [options]\n"
"where options are\n"
"\t-h \t\tHelp\n"
"\t-D <level>\tDebug level\n"
"\t-f <file>\tConfiguration file (mandatory)\n"
"\t-l <s|f<file>> \tLog on (s)yslog, (f)ile (syslog is default)\n"
"\t-d <dir>\tSpecify restconf plugin directory dir (default: %s)\n"
"\t-y <file>\tLoad yang spec file (override yang main module)\n"
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
"\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n",
argv0,
clicon_restconf_dir(h)
);
exit(0);
}
/*! Main routine for grideye fastcgi API
*/
int
main(int argc,
char **argv)
{
int retval = -1;
int sock;
char *argv0 = argv[0];
FCGX_Request request;
FCGX_Request *r = &request;
char c;
char *sockpath;
char *path;
clicon_handle h;
char *yangspec=NULL;
char *dir;
char *tmp;
int logdst = CLICON_LOG_SYSLOG;
yang_spec *yspec = NULL;
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
char *yang_filename = NULL;
char *stream_path;
int finish;
/* In the startup, logs to stderr & debug flag set later */
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
/* Create handle */
if ((h = clicon_handle_init()) == NULL)
goto done;
_CLICON_HANDLE = h; /* for termination handling */
while ((c = getopt(argc, argv, RESTCONF_OPTS)) != -1)
switch (c) {
case 'h':
usage(h, argv[0]);
break;
case 'D' : /* debug */
if (sscanf(optarg, "%d", &debug) != 1)
usage(h, argv[0]);
break;
case 'f': /* override config file */
if (!strlen(optarg))
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
break;
case 'l': /* Log destination: s|e|o */
if ((logdst = clicon_log_opt(optarg[0])) < 0)
usage(h, argv[0]);
if (logdst == CLICON_LOG_FILE &&
strlen(optarg)>1 &&
clicon_log_file(optarg+1) < 0)
goto done;
break;
} /* switch getopt */
/*
* Logs, error and debug to stderr or syslog, set debug level
*/
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
clicon_debug_init(debug, NULL);
clicon_log(LOG_NOTICE, "%s: %u Started", __PROGRAM__, getpid());
if (set_signal(SIGTERM, restconf_sig_term, NULL) < 0){
clicon_err(OE_DEMON, errno, "Setting signal");
goto done;
}
if (set_signal(SIGINT, restconf_sig_term, NULL) < 0){
clicon_err(OE_DEMON, errno, "Setting signal");
goto done;
}
if (set_signal(SIGCHLD, restconf_sig_child, NULL) < 0){
clicon_err(OE_DEMON, errno, "Setting signal");
goto done;
}
/* Create configure yang-spec */
if ((yspecfg = yspec_new()) == NULL)
goto done;
/* Find and read configfile */
if (clicon_options_main(h, yspecfg) < 0)
goto done;
clicon_config_yang_set(h, yspecfg);
stream_path = clicon_option_str(h, "CLICON_STREAM_PATH");
/* Now rest of options, some overwrite option file */
optind = 1;
opterr = 0;
while ((c = getopt(argc, argv, RESTCONF_OPTS)) != -1)
switch (c) {
case 'h' : /* help */
case 'D' : /* debug */
case 'f': /* config file */
case 'l': /* log */
break; /* see above */
case 'd': /* Plugin directory */
if (!strlen(optarg))
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_RESTCONF_DIR", optarg);
break;
case 'y' : /* Load yang spec file (override yang main module) */
yang_filename = optarg;
break;
case 'a': /* internal backend socket address family */
clicon_option_str_set(h, "CLICON_SOCK_FAMILY", optarg);
break;
case 'u': /* internal backend socket unix domain path or ip host */
if (!strlen(optarg))
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_SOCK", optarg);
break;
default:
usage(h, argv[0]);
break;
}
argc -= optind;
argv += optind;
/* Overwrite yang module with -y option */
if (yangspec)
clicon_option_str_set(h, "CLICON_YANG_MODULE_MAIN", yangspec);
/* Initialize plugins group */
if ((dir = clicon_restconf_dir(h)) != NULL)
if (clixon_plugins_load(h, CLIXON_PLUGIN_INIT, dir, NULL) < 0)
return -1;
/* Create top-level yang spec and store as option */
if ((yspec = yspec_new()) == NULL)
goto done;
clicon_dbspec_yang_set(h, yspec);
/* Load main application yang specification either module or specific file
* If -y <file> is given, it overrides main module */
if (yang_filename){
if (yang_spec_parse_file(h, yang_filename, clicon_yang_dir(h), yspec, NULL) < 0)
goto done;
}
else if (yang_spec_parse_module(h, clicon_yang_module_main(h),
clicon_yang_dir(h),
clicon_yang_module_revision(h),
yspec, NULL) < 0)
goto done;
/* Load yang module library, RFC7895 */
if (yang_modules_init(h) < 0)
goto done;
/* Add system modules */
if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC8040") &&
yang_spec_parse_module(h, "ietf-restconf-monitoring", CLIXON_DATADIR, NULL, yspec, NULL)< 0)
goto done;
if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC5277") &&
yang_spec_parse_module(h, "ietf-netconf-notification", CLIXON_DATADIR, NULL, yspec, NULL)< 0)
goto done;
/* Call start function in all plugins before we go interactive
Pass all args after the standard options to plugin_start
*/
tmp = *(argv-1);
*(argv-1) = argv0;
clixon_plugin_start(h, argc+1, argv-1);
*(argv-1) = tmp;
if ((sockpath = clicon_option_str(h, "CLICON_RESTCONF_PATH")) == NULL){
clicon_err(OE_CFG, errno, "No CLICON_RESTCONF_PATH in clixon configure file");
goto done;
}
if (FCGX_Init() != 0){ /* How to cleanup memory after this? */
clicon_err(OE_CFG, errno, "FCGX_Init");
goto done;
}
clicon_debug(1, "restconf_main: Opening FCGX socket: %s", sockpath);
if ((sock = FCGX_OpenSocket(sockpath, 10)) < 0){
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
goto done;
}
if (FCGX_InitRequest(r, sock, 0) != 0){
clicon_err(OE_CFG, errno, "FCGX_InitRequest");
goto done;
}
while (1) {
finish = 1; /* If zero, dont finish request, initiate new */
if (FCGX_Accept_r(r) < 0) {
clicon_err(OE_CFG, errno, "FCGX_Accept_r");
goto done;
}
clicon_debug(1, "------------");
if ((path = FCGX_GetParam("REQUEST_URI", r->envp)) != NULL){
clicon_debug(1, "path: %s", path);
if (strncmp(path, "/" RESTCONF_API, strlen("/" RESTCONF_API)) == 0)
api_restconf(h, r); /* This is the function */
else if (strncmp(path+1, stream_path, strlen(stream_path)) == 0) {
api_stream(h, r, stream_path, &finish);
}
else if (strncmp(path, RESTCONF_WELL_KNOWN, strlen(RESTCONF_WELL_KNOWN)) == 0) {
api_well_known(h, r); /* */
}
else{
clicon_debug(1, "top-level %s not found", path);
notfound(r);
}
}
else
clicon_debug(1, "NULL URI");
if (finish)
FCGX_Finish_r(r);
else{ /* A handler is forked so we initiate a new request after instead
of finnishing the old */
if (FCGX_InitRequest(r, sock, 0) != 0){
clicon_err(OE_CFG, errno, "FCGX_InitRequest");
goto done;
}
}
}
retval = 0;
done:
stream_child_freeall(h);
restconf_terminate(h);
return retval;
}
| 30.438451 | 158 | 0.628845 |
07154817e9ceb0165ff924c122936aaf7e7a7351 | 254 | h | C | SimpleNetC/neural_net.h | MarceloJacinto/MachineLearningExperiments | 6453e40bd31466c4a4e6dd0182f45bd194d76be4 | [
"MIT"
] | null | null | null | SimpleNetC/neural_net.h | MarceloJacinto/MachineLearningExperiments | 6453e40bd31466c4a4e6dd0182f45bd194d76be4 | [
"MIT"
] | null | null | null | SimpleNetC/neural_net.h | MarceloJacinto/MachineLearningExperiments | 6453e40bd31466c4a4e6dd0182f45bd194d76be4 | [
"MIT"
] | null | null | null | #if !defined(NEURAL_NET)
#define NEURAL_NET
#include "activation_function.h"
/**
* @author Marcelo Fialho Jacinto
* @date 26/05/2020
*/
class NeuralNet{
public:
NeuralNet(ActivationFunction * ac) {};
};
#endif // NEURAL_NET
| 12.7 | 46 | 0.645669 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.