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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b52c4aedbbe3203e33caada9ca2016102b51c163 | 2,472 | h | C | applications/qTox/src/widget/genericchatroomwidget.h | gaohangaohan/qkd-net | 90f52104412b5c5c82668362dbd3e4791261f332 | [
"MIT"
] | 17 | 2019-04-21T14:10:57.000Z | 2022-03-26T09:32:53.000Z | applications/qTox/src/widget/genericchatroomwidget.h | gaohangaohan/qkd-net | 90f52104412b5c5c82668362dbd3e4791261f332 | [
"MIT"
] | 22 | 2019-01-11T19:13:44.000Z | 2022-02-26T17:58:32.000Z | applications/qTox/src/widget/genericchatroomwidget.h | gaohangaohan/qkd-net | 90f52104412b5c5c82668362dbd3e4791261f332 | [
"MIT"
] | 17 | 2019-03-06T17:29:29.000Z | 2021-08-10T10:17:09.000Z | /*
Copyright © 2014-2015 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GENERICCHATROOMWIDGET_H
#define GENERICCHATROOMWIDGET_H
#include "genericchatitemwidget.h"
class CroppingLabel;
class MaskablePixmapWidget;
class QVBoxLayout;
class QHBoxLayout;
class ContentLayout;
class Friend;
class Group;
class GenericChatroomWidget : public GenericChatItemWidget
{
Q_OBJECT
public:
explicit GenericChatroomWidget(bool compact, QWidget* parent = 0);
virtual void setAsActiveChatroom() = 0;
virtual void setAsInactiveChatroom() = 0;
virtual void updateStatusLight() = 0;
virtual void resetEventFlags() = 0;
virtual QString getStatusString() const = 0;
virtual const Friend* getFriend() const
{
return nullptr;
}
virtual Group* getGroup() const
{
return nullptr;
}
virtual bool eventFilter(QObject*, QEvent*) final override;
bool isActive();
void setActive(bool active);
void setName(const QString& name);
void setStatusMsg(const QString& status);
QString getStatusMsg() const;
QString getTitle() const;
void reloadTheme();
public slots:
void activate();
void compactChange(bool compact);
signals:
void chatroomWidgetClicked(GenericChatroomWidget* widget);
void newWindowOpened(GenericChatroomWidget* widget);
protected:
virtual void mouseReleaseEvent(QMouseEvent* event) override;
virtual void enterEvent(QEvent* e) override;
virtual void leaveEvent(QEvent* e) override;
QPoint dragStartPos;
protected:
QColor lastColor;
QHBoxLayout* mainLayout = nullptr;
QVBoxLayout* textLayout = nullptr;
MaskablePixmapWidget* avatar;
CroppingLabel* statusMessageLabel;
bool active;
};
#endif // GENERICCHATROOMWIDGET_H
| 27.466667 | 72 | 0.731392 |
d570ea5cf454282bde38aaf7cce5988edf03ec97 | 9,701 | c | C | kern/io/drv/pc/sb16.c | JamesLinus/OS-Zero | effa0bd7c35ac21ba6132120549b4e882001b0e6 | [
"BSD-3-Clause"
] | 1 | 2019-04-22T09:09:28.000Z | 2019-04-22T09:09:28.000Z | kern/io/drv/pc/sb16.c | JamesLinus/OS-Zero | effa0bd7c35ac21ba6132120549b4e882001b0e6 | [
"BSD-3-Clause"
] | null | null | null | kern/io/drv/pc/sb16.c | JamesLinus/OS-Zero | effa0bd7c35ac21ba6132120549b4e882001b0e6 | [
"BSD-3-Clause"
] | null | null | null | #include <stdint.h>
#include <sys/io.h>
#include <zero/cdefs.h>
#include <zero/param.h>
#include <zero/mtx.h>
#include <zero/trix.h>
#include <kern/util.h>
#include <kern/tmr.h>
#include <kern/malloc.h>
#include <kern/mem/vm.h>
//#include <kern/prio.h>
//#include <kern/thr.h>
#include <kern/io/drv/pc/dma.h>
#include <kern/io/drv/pc/sb16.h>
void sb16intr(void);
void sb16setrate(long cmd, uint16_t hz);
void sb16setvol(uint16_t reg, uint8_t val);
//extern void pitsleep(long msec, void (*func)(void));
extern void *irqvec[];
/* intpu and output buffers are allocated from DMA zone according to channels */
#define SB16DATA8BUFSIZE (8 * SB16BUFSIZE)
#define SB16DATA16BUFSIZE (16 * SB16BUFSIZE)
static struct sb16drv sb16drv ALIGNED(PAGESIZE);
#if 0
uint16_t
sb16ackint(void)
{
uint16_t ret = inb(SB16RDBUFSTAT);
return ret;
}
#endif
long
sb16setup(void)
{
uint8_t u8val;
/* probe IRQ */
outb(SB16CONFIRQ, SB16MIXERADR);
u8val = inb(SB16MIXERDATA);
switch (u8val) {
case SB16IRQ5BIT:
sb16drv.irq = 5;
break;
case SB16IRQ7BIT:
sb16drv.irq = 7;
break;
case SB16IRQ10BIT:
sb16drv.irq = 10;
break;
default:
return 0;
}
/* probe DMA */
outb(SB16CONFDMA, SB16MIXERADR);
u8val = inb(SB16MIXERDATA);
switch (u8val & 0x0f) {
case SB16DMA0BIT:
sb16drv.dma8 = 0;
break;
case SB16DMA1BIT:
sb16drv.dma8 = 1;
break;
case SB16DMA3BIT:
sb16drv.dma8 = 3;
break;
default:
return 0;
}
switch (u8val & 0xf0) {
case SB16DMA5BIT:
sb16drv.dma16 = 5;
break;
case SB16DMA6BIT:
sb16drv.dma16 = 6;
break;
case SB16DMA7BIT:
sb16drv.dma16 = 7;
break;
default:
return 0;
}
dmatakechan(sb16drv.dma8);
dmatakechan(sb16drv.dma16);
kprintf("SB16 @ 0x%x, IRQ %d, DMA %d (8-bit), DMA %d (16-bit)\n",
SB16BASE, sb16drv.irq, sb16drv.dma8, sb16drv.dma16);
/* initialize DMA interface */
/* reserve buffers from DMA zone */
sb16drv.dmabuf8 = dmabufadr(sb16drv.dma8);
sb16drv.dmabuf16 = (uint16_t *)dmabufadr(sb16drv.dma16);
/* initialise DMA transfer environment */
dmasetmode(sb16drv.dma8, DMAAUTOINIT | DMAADRINCR | DMABLOCK);
dmasetmode(sb16drv.dma16, DMAAUTOINIT | DMAADRINCR | DMABLOCK);
dmasetadr(sb16drv.dma8, sb16drv.dmabuf8);
dmasetadr(sb16drv.dma16, sb16drv.dmabuf16);
dmasetcnt(sb16drv.dma8, SB16BUFSIZE >> 1);
dmasetcnt(sb16drv.dma16, SB16BUFSIZE >> 1);
/* set input and output rates */
sb16setrate(SB16INPUTRATE, 44100);
sb16setrate(SB16OUTPUTRATE, 44100);
/* TODO: set mixer volumes */
sb16setvol(SB16MASTERLVOL, SB16MAXVOL >> 1);
sb16setvol(SB16MASTERRVOL, SB16MAXVOL >> 1);
/* set block transfer size (16-bit words) */
outw(SB16BUFSIZE >> 2, SB16SETBLKSIZE);
sb16drv.init = 1;
/* initialize interrupt management */
irqvec[sb16drv.irq] = sb16intr;
return 1;
}
void
sb16init(void)
{
sb16drv.dmaout8empty = 1;
sb16drv.dmaout16empty = 1;
/* reset sound card */
sb16reset();
/* sleep for SB16RESETMS milliseconds, then trigger sb16setup() */
/* usleep(SB16RESETMS * 1000); */
pitsleep(SB16RESETMS);
if (!sb16setup()) {
return;
}
/* initialise and zero wired buffers */
#if 0
sb16drv.inbuf8 = kwalloc(SB16DATA8BUFSIZE);
kbzero(sb16drv.inbuf8, SB16DATA8BUFSIZE);
sb16drv.outbuf8 = kwalloc(SB16DATA8BUFSIZE);
kbzero(sb16drv.outbuf8, SB16DATA8BUFSIZE);
sb16drv.inbuf16 = kwalloc(SB16DATA16BUFSIZE);
kbzero(sb16drv.inbuf16, SB16DATA16BUFSIZE);
sb16drv.outbuf16 = kwalloc(SB16DATA16BUFSIZE);
kbzero(sb16drv.outbuf16, SB16DATA16BUFSIZE);
#endif
vmmapseg((uint32_t *)&_pagetab,
(uint32_t)dmabufadr(sb16drv.dma8),
(uint32_t)dmabufadr(sb16drv.dma8),
(uint32_t)dmabufadr(sb16drv.dma8) + SB16DATA8BUFSIZE,
PAGEPRES | PAGEWRITE | PAGENOCACHE);
vmmapseg((uint32_t *)&_pagetab,
(uint32_t)dmabufadr(sb16drv.dma16),
(uint32_t)dmabufadr(sb16drv.dma16),
(uint32_t)dmabufadr(sb16drv.dma16) + SB16DATA16BUFSIZE,
PAGEPRES | PAGEWRITE | PAGENOCACHE);
sb16drv.inbuf8 = dmabufadr(sb16drv.dma8);
kbzero(sb16drv.inbuf8, SB16DATA8BUFSIZE);
sb16drv.outbuf8 = dmabufadr(sb16drv.dma8) + (DMACHANBUFSIZE >> 1);
kbzero(sb16drv.outbuf8, SB16DATA8BUFSIZE);
sb16drv.inbuf16 = (uint16_t *)dmabufadr(sb16drv.dma16);
kbzero(sb16drv.inbuf16, SB16DATA16BUFSIZE);
sb16drv.outbuf16 = (uint16_t *)dmabufadr(sb16drv.dma16)
+ (DMACHANBUFSIZE >> 2);
kbzero(sb16drv.outbuf16, SB16DATA16BUFSIZE);
sb16drv.inptr8 = sb16drv.inbuf8;
sb16drv.inlim8 = sb16drv.inbuf8 + SB16DATA8BUFSIZE - (SB16BUFSIZE >> 1);
sb16drv.outptr8 = sb16drv.outbuf8;
sb16drv.outlim8 = sb16drv.outbuf8 + SB16DATA8BUFSIZE - (SB16BUFSIZE >> 1);
sb16drv.inptr16 = sb16drv.inbuf16;
sb16drv.inlim16 = sb16drv.inbuf16 + SB16DATA16BUFSIZE - (SB16BUFSIZE >> 2);
sb16drv.outptr16 = sb16drv.outbuf16;
sb16drv.outlim16 = sb16drv.outbuf16
+ SB16DATA16BUFSIZE - (SB16BUFSIZE >> 2);
return;
}
void
sb16unload(void)
{
#if 0
kfree(sb16drv.inbuf8);
kfree(sb16drv.outbuf8);
kfree(sb16drv.inbuf16);
kfree(sb16drv.outbuf16);
#endif
return;
}
void
sb16filloutbuf8(void)
{
;
}
void
sb16filloutbuf16(void)
{
;
}
void
sb16flushinbuf8(void)
{
;
}
void
sb16flushinbuf16(void)
{
;
}
/* FIXME: this function doesn't work with virtualbox */
void
sb16intr(void)
{
uint16_t reg = 0;
uint16_t stat;
long val;
long op = DMAWRITEOP;
stat = inb(SB16RDBUFSTAT);
if (stat & SB16BUFSTATBIT) {
op = DMAREADOP;
}
outb(SB16INTRSTAT, SB16MIXERADR);
stat = inb(SB16MIXERDATA);
switch (stat) {
case SB16DMA8MIDIBIT:
reg = SB16DMA8MIDISTAT;
val = DMAIOBUFSIZE >> 1;
mtxlk(&sb16drv.buflock);
if (op == DMAREADOP) {
if (sb16drv.dmain8full) {
sb16flushinbuf8();
}
kmemcpy(sb16drv.inptr8,
sb16drv.dmabuf8 + sb16drv.dmainofs8,
val);
sb16drv.dmainofs8 = (sb16drv.dmainofs8 + val)
& (DMAIOBUFSIZE - 1);
if (sb16drv.inptr8 < sb16drv.inlim8) {
sb16drv.inptr8 += val;
sb16drv.dmain8full = 0;
} else {
sb16drv.inptr8 = sb16drv.inbuf8;
sb16drv.dmain8full = 1;
}
} else {
if (sb16drv.dmaout8empty) {
sb16filloutbuf8();
}
kmemcpy(sb16drv.dmabuf8 + sb16drv.dmaoutofs8,
sb16drv.outptr8,
val);
sb16drv.dmaoutofs8 = (sb16drv.dmaoutofs8 + val)
& (DMAIOBUFSIZE - 1);
if (sb16drv.outptr8 < sb16drv.outlim8) {
sb16drv.outptr8 += val;
sb16drv.dmaout8empty = 0;
} else {
sb16drv.outptr8 = sb16drv.outbuf8;
sb16drv.dmaout8empty = 1;
}
}
mtxunlk(&sb16drv.buflock);
break;
case SB16DMA16BIT:
reg = SB16DMA16STAT;
val = DMAIOBUFSIZE >> 2;
mtxlk(&sb16drv.buflock);
if (op == DMAREADOP) {
if (sb16drv.dmain16full) {
sb16flushinbuf16();
}
kmemcpy(sb16drv.inptr16,
sb16drv.dmabuf16 + sb16drv.dmainofs16,
val);
sb16drv.dmainofs16 = (sb16drv.dmainofs16 + val)
& (DMAIOBUFSIZE - 1);
if (sb16drv.inptr16 < sb16drv.inlim16) {
sb16drv.inptr16 += val;
sb16drv.dmain16full = 0;
} else {
sb16drv.inptr16 = sb16drv.inbuf16;
sb16drv.dmain16full = 1;
}
} else {
if (sb16drv.dmaout16empty) {
sb16filloutbuf16();
}
kmemcpy(sb16drv.dmabuf16 + sb16drv.dmaoutofs16,
sb16drv.outptr16,
val);
sb16drv.dmaoutofs16 = (sb16drv.dmaoutofs16 + val)
& (DMAIOBUFSIZE - 1);
if (sb16drv.outptr16 < sb16drv.outlim16) {
sb16drv.outptr16 += val;
sb16drv.dmaout16empty = 0;
} else {
sb16drv.outptr16 = sb16drv.outbuf16;
sb16drv.dmaout16empty = 1;
}
}
mtxunlk(&sb16drv.buflock);
break;
case SB16MPU401BIT:
reg = SB16MPU401STAT;
break;
default:
break;
}
/* acknowledge IRQ */
val = inb(reg);
}
/* see sb16.h for the reg parameter (0x30..0x3b) */
void
sb16setvol(uint16_t reg, uint8_t val)
{
val = min(val, SB16MAXVOL);
outb(reg, SB16MIXERADR);
outb(val, SB16MIXERDATA);
return;
}
/* cmd is SB16INPUTRATE or SB16OUTPUTRATE */
void
sb16setrate(long cmd, uint16_t hz)
{
outb(cmd, SB16WRITE);
outb(hz & 0xff, SB16WRITE);
outb((hz >> 8) & 0xff, SB16WRITE);
return;
}
| 27.173669 | 80 | 0.562622 |
413bb901d9173f90dd98ef86341aee1af9b2f89f | 391 | h | C | Safari Extension/SafariExtensionViewController.h | ahoyfubar/SlogBlocker | 81b7b905eaa7de113c50f29204f3e6d537e18431 | [
"MIT"
] | null | null | null | Safari Extension/SafariExtensionViewController.h | ahoyfubar/SlogBlocker | 81b7b905eaa7de113c50f29204f3e6d537e18431 | [
"MIT"
] | 1 | 2021-12-24T18:15:18.000Z | 2021-12-25T21:05:33.000Z | Safari Extension/SafariExtensionViewController.h | ahoyfubar/SavageLUBE | 81b7b905eaa7de113c50f29204f3e6d537e18431 | [
"MIT"
] | null | null | null | //
// SafariExtensionViewController.h
// The Actual Extension
//
// Created by fubar on 2020-12-14.
// Copyright © 2020 fubar. All rights reserved.
//
#import <SafariServices/SafariServices.h>
#import <WebKit/WebKit.h>
@interface SafariExtensionViewController : SFSafariExtensionViewController
+ (SafariExtensionViewController *)sharedController;
@property WKWebView *webView;
@end
| 20.578947 | 74 | 0.772379 |
414d3009312564ac641300c161437263d7cf415e | 1,122 | c | C | apue/libread.c | nkysg/Asenal | 12444c7e50fae2be82d3c4737715a52e3693a3cd | [
"Apache-2.0"
] | 5 | 2017-04-10T03:35:40.000Z | 2020-11-26T10:00:57.000Z | apue/libread.c | nkysg/Asenal | 12444c7e50fae2be82d3c4737715a52e3693a3cd | [
"Apache-2.0"
] | 1 | 2015-04-09T13:45:25.000Z | 2015-04-09T13:45:25.000Z | apue/libread.c | baotiao/Asenal | 102170aa92ae72b1d589dd74e8bbbc9ae27a8d97 | [
"Apache-2.0"
] | 15 | 2015-03-10T04:15:10.000Z | 2021-03-19T13:00:48.000Z | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <event.h>
#include <unistd.h>
void keypadhandler(int fd, short event, void* arg) {
fcntl(fd, F_SETFL, O_NONBLOCK);
printf("i am here\n");
struct event *ev = arg;
printf("%d, %d, %d\n", fd, event, *(int *)arg);
int ntowrite;
char buf[3];
//ntowrite = read(fd, buf, sizeof(buf));
//struct input_event buff;
//read(fd, &buff, sizeof(struct input_event));
//printf("type %d, codd: %d, value %d\n", buff.type, buff.code, buff.value);
}
int main()
{
struct event ev;
int fd;
fd = open("/dev/tty", O_RDONLY);
//fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
puts("can not open \n");
return -1;
}
printf("fd is %d\n", fd);
//fcntl(fd, F_SETFL, O_NONBLOCK);
char buf[10];
int n;
//n = read(fd, buf, 10);
printf("after read is come\n");
event_init();
event_set(&ev, fd, EV_READ, keypadhandler, &ev);
printf("after event_set\n");
event_add(&ev, NULL);
event_dispatch();
printf("after sidpatch\n");
event_del(&ev);
return 0;
}
| 22.897959 | 80 | 0.568627 |
cb28551535133d4cfda3c8ef3d9fc39e7363a908 | 38,172 | c | C | gpac-0.7.1/src/bifs/com_dec.c | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | null | null | null | gpac-0.7.1/src/bifs/com_dec.c | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | null | null | null | gpac-0.7.1/src/bifs/com_dec.c | xu5343/ffmpegtoolkit_CentOS7 | 974496c709a1c8c69034e46ae5ce7101cf03716f | [
"Apache-2.0"
] | 1 | 2021-04-15T18:27:37.000Z | 2021-04-15T18:27:37.000Z | /*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2012
* All rights reserved
*
* This file is part of GPAC / BIFS codec sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/maths.h>
#include <gpac/internal/bifs_dev.h>
#include "quant.h"
#ifndef GPAC_DISABLE_BIFS
GF_Err BD_DecMFFieldList(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
GF_Err BD_DecMFFieldVec(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
void gf_bifs_dec_name(GF_BitStream *bs, char *name)
{
u32 i = 0;
while (1) {
name[i] = gf_bs_read_int(bs, 8);
if (!name[i]) break;
i++;
}
}
static GF_Err BD_XReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_FieldInfo targetField, fromField;
GF_Node *target, *n, *fromNode;
s32 pos = -2;
void *slot_ptr;
u32 id, nbBits, ind, aind;
GF_Err e;
id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
target = gf_sg_find_node(codec->current_graph, id);
if (!target) return GF_SG_UNKNOWN_NODE;
nbBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(target, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, nbBits);
e = gf_bifs_get_field_index(target, ind, GF_SG_FIELD_CODING_IN, &aind);
if (e) return e;
e = gf_node_get_field(target, aind, &targetField);
if (e) return e;
if (!gf_sg_vrml_is_sf_field(targetField.fieldType)) {
/*this is indexed replacement*/
if (gf_bs_read_int(bs, 1)) {
/*index is dynamic*/
if (gf_bs_read_int(bs, 1)) {
id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
n = gf_sg_find_node(codec->current_graph, id);
if (!n) return GF_SG_UNKNOWN_NODE;
nbBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(n, GF_SG_FIELD_CODING_DEF)-1);
ind = gf_bs_read_int(bs, nbBits);
e = gf_bifs_get_field_index(n, ind, GF_SG_FIELD_CODING_DEF, &aind);
if (e) return e;
e = gf_node_get_field(n, aind, &fromField);
if (e) return e;
pos = 0;
switch (fromField.fieldType) {
case GF_SG_VRML_SFBOOL:
if (*(SFBool*)fromField.far_ptr) pos = 1;
break;
case GF_SG_VRML_SFINT32:
if (*(SFInt32*)fromField.far_ptr >=0) pos = *(SFInt32*)fromField.far_ptr;
break;
case GF_SG_VRML_SFFLOAT:
if ( (*(SFFloat *)fromField.far_ptr) >=0) pos = (s32) floor( FIX2FLT(*(SFFloat*)fromField.far_ptr) );
break;
case GF_SG_VRML_SFTIME:
if ( (*(SFTime *)fromField.far_ptr) >=0) pos = (s32) floor( (*(SFTime *)fromField.far_ptr) );
break;
}
} else {
u32 type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = gf_bs_read_int(bs, 16);
break;
case 2:
pos = 0;
break;
case 3:
pos = -1;
break;
}
}
}
if (targetField.fieldType==GF_SG_VRML_MFNODE) {
if (gf_bs_read_int(bs, 1)) {
target = gf_node_list_get_child(*(GF_ChildNodeItem **)targetField.far_ptr, pos);
if (!target) return GF_SG_UNKNOWN_NODE;
nbBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(target, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, nbBits);
e = gf_bifs_get_field_index(target, ind, GF_SG_FIELD_CODING_IN, &aind);
if (e) return e;
e = gf_node_get_field(target, aind, &targetField);
if (e) return e;
pos = -2;
}
}
}
fromNode = NULL;
if (gf_bs_read_int(bs, 1)) {
id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
fromNode = gf_sg_find_node(codec->current_graph, id);
if (!fromNode) return GF_SG_UNKNOWN_NODE;
nbBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(fromNode, GF_SG_FIELD_CODING_DEF)-1);
ind = gf_bs_read_int(bs, nbBits);
e = gf_bifs_get_field_index(fromNode, ind, GF_SG_FIELD_CODING_DEF, &aind);
if (e) return e;
e = gf_node_get_field(fromNode, aind, &fromField);
if (e) return e;
}
/*indexed replacement*/
if (pos>=-1) {
/*if MFNode remove the child and set new node*/
if (targetField.fieldType == GF_SG_VRML_MFNODE) {
GF_Node *newnode;
if (fromNode) {
newnode = *(GF_Node**)fromField.far_ptr;
} else {
newnode = gf_bifs_dec_node(codec, bs, targetField.NDTtype);
}
gf_node_replace_child(target, (GF_ChildNodeItem**) targetField.far_ptr, pos, newnode);
if (newnode) gf_node_register(newnode, NULL);
}
/*erase the field item*/
else {
u32 sftype;
if ((pos < 0) || ((u32) pos >= ((GenMFField *) targetField.far_ptr)->count) ) {
pos = ((GenMFField *)targetField.far_ptr)->count - 1;
/*may happen with text and default value*/
if (pos < 0) {
pos = 0;
gf_sg_vrml_mf_alloc(targetField.far_ptr, targetField.fieldType, 1);
}
}
e = gf_sg_vrml_mf_get_item(targetField.far_ptr, targetField.fieldType, & slot_ptr, pos);
if (e) return e;
sftype = gf_sg_vrml_get_sf_type(targetField.fieldType);
if (fromNode) {
if (sftype==fromField.fieldType)
gf_sg_vrml_field_copy(slot_ptr, fromField.far_ptr, sftype);
} else {
GF_FieldInfo sffield;
memcpy(&sffield, &targetField, sizeof(GF_FieldInfo));
sffield.fieldType = sftype;
sffield.far_ptr = slot_ptr;
gf_bifs_dec_sf_field(codec, bs, target, &sffield, GF_FALSE);
}
}
gf_bifs_check_field_change(target, &targetField);
return GF_OK;
}
switch (targetField.fieldType) {
case GF_SG_VRML_SFNODE:
{
GF_Node *newnode;
if (fromNode) {
newnode = *(GF_Node**)fromField.far_ptr;
} else {
newnode = gf_bifs_dec_node(codec, bs, targetField.NDTtype);
}
n = *((GF_Node **) targetField.far_ptr);
*((GF_Node **) targetField.far_ptr) = newnode;
if (newnode) gf_node_register(newnode, target);
if (n) gf_node_unregister(n, target);
break;
}
case GF_SG_VRML_MFNODE:
{
GF_ChildNodeItem *previous = * (GF_ChildNodeItem **) targetField.far_ptr;
* ((GF_ChildNodeItem **) targetField.far_ptr) = NULL;
if (fromNode) {
GF_ChildNodeItem *list, *prev, *cur;
list = * ((GF_ChildNodeItem **) targetField.far_ptr);
prev=NULL;
while (list) {
cur = (GF_ChildNodeItem*)gf_malloc(sizeof(GF_ChildNodeItem));
cur->next = NULL;
cur->node = list->node;
if (prev) {
prev->next = cur;
} else {
* ((GF_ChildNodeItem **) targetField.far_ptr) = cur;
}
gf_node_register(list->node, target);
prev = cur;
list = list->next;
}
} else {
e = gf_bifs_dec_field(codec, bs, target, &targetField, GF_FALSE);
if (e) return e;
}
if (previous)
gf_node_unregister_children(target, previous);
break;
}
default:
if (!gf_sg_vrml_is_sf_field(targetField.fieldType)) {
e = gf_sg_vrml_mf_reset(targetField.far_ptr, targetField.fieldType);
}
if (e) return e;
if (fromNode) {
if (fromField.fieldType == targetField.fieldType)
gf_sg_vrml_field_clone(targetField.far_ptr, fromField.far_ptr, targetField.fieldType, codec->current_graph);
} else {
e = gf_bifs_dec_field(codec, bs, target, &targetField, GF_FALSE);
}
break;
}
gf_bifs_check_field_change(target, &targetField);
return e;
}
static GF_Err BD_DecProtoDelete(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 ID, flag, count;
GF_Proto *proto;
flag = gf_bs_read_int(bs, 1);
if (flag) {
flag = gf_bs_read_int(bs, 1);
while (flag) {
ID = gf_bs_read_int(bs, codec->info->config.ProtoIDBits);
proto = gf_sg_find_proto(codec->current_graph, ID, NULL);
if (proto) gf_sg_proto_del(proto);
flag = gf_bs_read_int(bs, 1);
}
} else {
flag = gf_bs_read_int(bs, 5);
count = gf_bs_read_int(bs, flag);
while (count) {
ID = gf_bs_read_int(bs, codec->info->config.ProtoIDBits);
proto = gf_sg_find_proto(codec->current_graph, ID, NULL);
if (proto) gf_sg_proto_del(proto);
count--;
}
}
return GF_OK;
}
static GF_Err BD_DecMultipleIndexReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 ID, ind, field_ind, NumBits, lenpos, lennum, count, pos;
GF_Node *node, *new_node;
GF_Err e;
GF_FieldInfo field, sffield;
ID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, ID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (gf_sg_vrml_is_sf_field(field.fieldType)) return GF_NON_COMPLIANT_BITSTREAM;
lenpos = gf_bs_read_int(bs, 5);
lennum = gf_bs_read_int(bs, 5);
count = gf_bs_read_int(bs, lennum);
/*cf index value replace */
if (field.fieldType == GF_SG_VRML_MFNODE) {
while (count) {
pos = gf_bs_read_int(bs, lenpos);
/*first decode*/
new_node = gf_bifs_dec_node(codec, bs, field.NDTtype);
if (!new_node) return codec->LastError;
e = gf_node_register(new_node, node);
if (e) return e;
/*then replace*/
e = gf_node_replace_child(node, (GF_ChildNodeItem**) field.far_ptr, pos, new_node);
count--;
}
if (!e) gf_bifs_check_field_change(node, &field);
return e;
}
/*Not a node list*/
memcpy(&sffield, &field, sizeof(GF_FieldInfo));
sffield.fieldType = gf_sg_vrml_get_sf_type(field.fieldType);
while (count) {
pos = gf_bs_read_int(bs, lenpos);
if (pos && pos >= ((GenMFField *)field.far_ptr)->count) {
pos = ((GenMFField *)field.far_ptr)->count - 1;
}
e = gf_sg_vrml_mf_get_item(field.far_ptr, field.fieldType, & sffield.far_ptr, pos);
if (e) return e;
e = gf_bifs_dec_sf_field(codec, bs, node, &sffield, GF_FALSE);
if (e) break;
count--;
}
if (!e) gf_bifs_check_field_change(node, &field);
return e;
}
static GF_Err BD_DecMultipleReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Err e;
u32 NodeID, flag;
GF_Node *node;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
flag = gf_bs_read_int(bs, 1);
if (flag) {
e = gf_bifs_dec_node_mask(codec, bs, node, GF_FALSE);
} else {
e = gf_bifs_dec_node_list(codec, bs, node, GF_FALSE);
}
return e;
}
static GF_Err BD_DecGlobalQuantizer(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Node *node;
node = gf_bifs_dec_node(codec, bs, NDT_SFWorldNode);
/*reset global QP*/
if (codec->scenegraph->global_qp) {
gf_node_unregister(codec->scenegraph->global_qp, NULL);
codec->scenegraph->global_qp = NULL;
}
codec->ActiveQP = NULL;
if (!node || (gf_node_get_tag(node) != TAG_MPEG4_QuantizationParameter)) {
if (node) gf_node_unregister(node, NULL);
return codec->LastError;
}
/*register global QP*/
codec->scenegraph->global_qp = node;
gf_node_register(node, NULL);
codec->ActiveQP = (M_QuantizationParameter *) node;
codec->ActiveQP->isLocal = 0;
return GF_OK;
}
static GF_Err BD_DecNodeDeleteEx(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 NodeID;
GF_Node *node;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
return gf_node_replace(node, NULL, GF_TRUE);
}
#ifdef GPAC_UNUSED_FUNC
static GF_Err BD_DecOperandReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
s32 pos;
GF_FieldInfo field;
GF_FieldInfo src_field;
GF_Err e;
u32 NodeID, NumBits, ind, field_ind, type, src_type, dst_type;
GF_Node *node, *src;
void *src_ptr, *dst_ptr;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (e) return e;
dst_type = field.fieldType;
dst_ptr = field.far_ptr;
pos = -2;
if (! gf_sg_vrml_is_sf_field(field.fieldType)) {
type = gf_bs_read_int(bs, 2);
switch (type) {
/*no index*/
case 0:
break;
/*specified*/
case 1:
pos = gf_bs_read_int(bs, 8);
break;
/*first*/
case 2:
pos = 0;
break;
/*last*/
case 3:
/*-1 means append*/
pos = ((GenMFField *)field.far_ptr)->count;
if (!pos)
return GF_NON_COMPLIANT_BITSTREAM;
pos -= 1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
if (pos>-2) {
dst_type = gf_sg_vrml_get_sf_type(field.fieldType);
e = gf_sg_vrml_mf_get_item(field.far_ptr, field.fieldType, &dst_ptr, pos);
if (e) return e;
}
}
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
src = gf_sg_find_node(codec->current_graph, NodeID);
if (!src) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(src, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(src, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(src, field_ind, &src_field);
if (e) return e;
src_type = src_field.fieldType;
src_ptr = src_field.far_ptr;
pos = -2;
if (! gf_sg_vrml_is_sf_field(src_field.fieldType)) {
type = gf_bs_read_int(bs, 2);
switch (type) {
/*no index*/
case 0:
break;
/*specified*/
case 1:
pos = gf_bs_read_int(bs, 8);
break;
/*first*/
case 2:
pos = 0;
break;
/*last*/
case 3:
/*-1 means append*/
pos = ((GenMFField *)src_field.far_ptr)->count;
if (!pos)
return GF_NON_COMPLIANT_BITSTREAM;
pos -= 1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
if (pos>-2) {
src_type = gf_sg_vrml_get_sf_type(src_field.fieldType);
e = gf_sg_vrml_mf_get_item(src_field.far_ptr, src_field.fieldType, &src_ptr, pos);
if (e) return e;
}
}
if (src_type!=dst_type) return GF_NON_COMPLIANT_BITSTREAM;
gf_sg_vrml_field_copy(dst_ptr, src_ptr, src_type);
return GF_OK;
}
#endif /*GPAC_UNUSED_FUNC*/
static GF_Err BD_DecExtendedUpdate(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 type;
type = gf_bs_read_int(bs, 8);
switch (type) {
case 0:
return gf_bifs_dec_proto_list(codec, bs, NULL);
case 1:
return BD_DecProtoDelete(codec, bs);
case 2:
return gf_sg_delete_all_protos(codec->current_graph);
case 3:
return BD_DecMultipleIndexReplace(codec, bs);
case 4:
return BD_DecMultipleReplace(codec, bs);
case 5:
return BD_DecGlobalQuantizer(codec, bs);
case 6:
return BD_DecNodeDeleteEx(codec, bs);
case 7:
return BD_XReplace(codec, bs);
default:
return GF_BIFS_UNKNOWN_VERSION;
}
}
/*inserts a node in a container (node.children)*/
static GF_Err BD_DecNodeInsert(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 NodeID, NDT;
s32 type, pos;
GF_Node *node, *def;
GF_Err e;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
def = gf_sg_find_node(codec->current_graph, NodeID);
if (!def) return GF_NON_COMPLIANT_BITSTREAM;
NDT = gf_bifs_get_child_table(def);
if (!NDT) return GF_NON_COMPLIANT_BITSTREAM;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = gf_bs_read_int(bs, 8);
break;
case 2:
pos = 0;
break;
case 3:
/*-1 means append*/
pos = -1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
node = gf_bifs_dec_node(codec, bs, NDT);
if (!node) return codec->LastError;
e = gf_node_register(node, def);
if (e) return e;
e = gf_node_insert_child(def, node, pos);
if (!e) {
GF_FieldInfo field;
/*get it by name in case no add/removeChildren*/
e = gf_node_get_field_by_name(def, "children", &field);
if (e) return e;
gf_bifs_check_field_change(def, &field);
}
return e;
}
/*NB This can insert a node as well (but usually not in the .children field)*/
static GF_Err BD_DecIndexInsert(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Err e;
u32 NodeID;
u32 NumBits, ind, field_ind;
u8 type;
s32 pos;
GF_Node *def, *node;
GF_FieldInfo field, sffield;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
def = gf_sg_find_node(codec->current_graph, NodeID);
if (!def) return GF_NON_COMPLIANT_BITSTREAM;
/*index insertion uses IN mode for field index*/
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(def, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(def, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = gf_bs_read_int(bs, 16);
break;
case 2:
pos = 0;
break;
case 3:
pos = -1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
e = gf_node_get_field(def, field_ind, &field);
if (e) return e;
if (gf_sg_vrml_is_sf_field(field.fieldType)) return GF_NON_COMPLIANT_BITSTREAM;
memcpy(&sffield, &field, sizeof(GF_FieldInfo));
sffield.fieldType = gf_sg_vrml_get_sf_type(field.fieldType);
/*rescale the MFField and parse the SFField*/
if (field.fieldType==GF_SG_VRML_MFNODE) {
node = gf_bifs_dec_node(codec, bs, field.NDTtype);
if (!node) return codec->LastError;
e = gf_node_register(node, def);
if (e) return e;
/*this is generic MFNode container*/
if (pos== -1) {
e = gf_node_list_add_child( (GF_ChildNodeItem **) field.far_ptr, node);
} else {
e = gf_node_list_insert_child((GF_ChildNodeItem **) field.far_ptr, node, pos);
}
if (!e) gf_bifs_check_field_change(def, &field);
} else {
if (pos == -1) {
e = gf_sg_vrml_mf_append(field.far_ptr, field.fieldType, & sffield.far_ptr);
} else {
/*insert is 0-based*/
e = gf_sg_vrml_mf_insert(field.far_ptr, field.fieldType, & sffield.far_ptr, pos);
}
if (e) return e;
e = gf_bifs_dec_sf_field(codec, bs, def, &sffield, GF_FALSE);
if (!e) gf_bifs_check_field_change(def, &field);
}
return e;
}
static GF_Err BD_DecInsert(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u8 type;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
return BD_DecNodeInsert(codec, bs);
/*Extended BIFS updates*/
case 1:
return BD_DecExtendedUpdate(codec, bs);
case 2:
return BD_DecIndexInsert(codec, bs);
case 3:
return gf_bifs_dec_route(codec, bs, GF_TRUE);
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
}
static GF_Err BD_DecIndexDelete(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 NodeID, NumBits, SF_type, ind, field_ind;
s32 pos;
u8 type;
GF_Node *node;
GF_Err e;
GF_FieldInfo field;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN) - 1);
ind = gf_bs_read_int(bs, NumBits);
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = (u32) gf_bs_read_int(bs, 16);
break;
case 2:
pos = 0;
break;
case 3:
pos = -1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (e) return e;
if (gf_sg_vrml_is_sf_field(field.fieldType)) return GF_NON_COMPLIANT_BITSTREAM;
SF_type = gf_sg_vrml_get_sf_type(field.fieldType);
/*special handling in case of a node*/
if (SF_type == GF_SG_VRML_SFNODE) {
GF_ChildNodeItem** nlist_ptr = (GF_ChildNodeItem**) field.far_ptr;
if (*nlist_ptr) {
e = gf_node_replace_child(node, nlist_ptr, pos, NULL);
}
} else {
e = gf_sg_vrml_mf_remove(field.far_ptr, field.fieldType, pos);
}
/*deletion -> node has changed*/
if (!e) gf_bifs_check_field_change(node, &field);
return e;
}
static GF_Err BD_DecDelete(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u8 type;
u32 ID;
GF_Node *n;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
ID = 1+gf_bs_read_int(bs, codec->info->config.NodeIDBits);
n = gf_sg_find_node(codec->current_graph, ID);
#ifdef MPEG4_STRICT
if (!n) return GF_NON_COMPLIANT_BITSTREAM;
#else
if (!n) return GF_OK;
#endif
/*this is a delete of a DEF node, remove ALL INSTANCES*/
return gf_node_replace(n, NULL, GF_FALSE);
case 2:
return BD_DecIndexDelete(codec, bs);
case 3:
ID = 1+gf_bs_read_int(bs, codec->info->config.RouteIDBits);
/*don't complain if route can't be deleted (not present)*/
gf_sg_route_del_by_id(codec->current_graph, ID);
return GF_OK;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
return GF_OK;
}
static GF_Err BD_DecNodeReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u32 NodeID;
GF_Node *node, *new_node;
GF_Err e;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
/*this is delete / new on a DEF node: replace ALL instances*/
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
/*and just parse a new GF_Node - it is encoded in SFWorldNode table */
new_node = gf_bifs_dec_node(codec, bs, NDT_SFWorldNode);
if (!new_node && codec->LastError) return codec->LastError;
e = gf_node_replace(node, new_node, GF_FALSE);
return e;
}
static GF_Err BD_DecFieldReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Err e;
u32 NodeID, ind, field_ind, NumBits;
GF_Node *node, *prev_node;
GF_ChildNodeItem *prev_child;
GF_FieldInfo field;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (e) return e;
prev_node = NULL;
prev_child = NULL;
/*store prev SF node*/
if (field.fieldType == GF_SG_VRML_SFNODE) {
prev_node = *((GF_Node **) field.far_ptr);
}
/*store prev MFNode content*/
else if (field.fieldType == GF_SG_VRML_MFNODE) {
prev_child = * ((GF_ChildNodeItem **) field.far_ptr);
* ((GF_ChildNodeItem **) field.far_ptr) = NULL;
}
/*regular field*/
else if (!gf_sg_vrml_is_sf_field(field.fieldType)) {
gf_sg_vrml_mf_reset(field.far_ptr, field.fieldType);
}
/*parse the field*/
codec->is_com_dec = GF_TRUE;
e = gf_bifs_dec_field(codec, bs, node, &field, GF_FALSE);
codec->is_com_dec = GF_FALSE;
/*remove prev nodes*/
if (field.fieldType == GF_SG_VRML_SFNODE) {
if (prev_node) e = gf_node_unregister(prev_node, node);
} else if (field.fieldType == GF_SG_VRML_MFNODE) {
gf_node_unregister_children(node, prev_child);
}
if (!e) gf_bifs_check_field_change(node, &field);
return e;
}
static GF_Err BD_DecIndexValueReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Node *new_node;
u32 NodeID, ind, field_ind, NumBits, pos;
u8 type;
GF_Node *node;
GF_Err e;
GF_FieldInfo field, sffield;
/*get the node*/
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN)-1);
ind = gf_bs_read_int(bs, NumBits);
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (e) return e;
if (gf_sg_vrml_is_sf_field(field.fieldType)) return GF_NON_COMPLIANT_BITSTREAM;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = gf_bs_read_int(bs, 16);
break;
case 2:
pos = 0;
break;
case 3:
pos = ((GenMFField *) field.far_ptr)->count - 1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
/*if MFNode remove the child and parse new node*/
if (field.fieldType == GF_SG_VRML_MFNODE) {
/*get the new node*/
new_node = gf_bifs_dec_node(codec, bs, field.NDTtype);
if (codec->LastError) {
e = codec->LastError;
goto exit;
}
if (new_node) {
e = gf_node_register(new_node, node);
if (e) return e;
}
/*replace prev node*/
e = gf_node_replace_child(node, (GF_ChildNodeItem**) field.far_ptr, pos, new_node);
if (!e) gf_bifs_check_field_change(node, &field);
}
/*erase the field item*/
else {
memcpy(&sffield, &field, sizeof(GF_FieldInfo));
sffield.fieldType = gf_sg_vrml_get_sf_type(field.fieldType);
/*make sure this is consistent*/
if (pos && pos >= ((GenMFField *)field.far_ptr)->count) {
pos = ((GenMFField *)field.far_ptr)->count - 1;
}
e = gf_sg_vrml_mf_get_item(field.far_ptr, field.fieldType, & sffield.far_ptr, pos);
if (e) return e;
e = gf_bifs_dec_sf_field(codec, bs, node, &sffield, GF_FALSE);
if (!e) gf_bifs_check_field_change(node, &field);
}
exit:
return e;
}
static GF_Err BD_DecRouteReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Err e;
u32 RouteID, numBits, ind, node_id, fromID, toID;
char name[1000], *ptr;
GF_Route *r;
GF_Node *OutNode, *InNode;
RouteID = 1+gf_bs_read_int(bs, codec->info->config.RouteIDBits);
r = gf_sg_route_find(codec->current_graph, RouteID);
#ifdef MPEG4_STRICT
if (!r) return GF_NON_COMPLIANT_BITSTREAM;
ptr = gf_sg_route_get_name(r);
gf_sg_route_del(r);
#else
ptr = NULL;
if (r) {
ptr = gf_sg_route_get_name(r);
// gf_sg_route_del(r);
}
#endif
if (ptr) strcpy(name, ptr);
/*origin*/
node_id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
OutNode = gf_sg_find_node(codec->current_graph, node_id);
if (!OutNode) return GF_NON_COMPLIANT_BITSTREAM;
numBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(OutNode, GF_SG_FIELD_CODING_OUT) - 1);
ind = gf_bs_read_int(bs, numBits);
e = gf_bifs_get_field_index(OutNode, ind, GF_SG_FIELD_CODING_OUT, &fromID);
if (e) return e;
/*target*/
node_id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
InNode = gf_sg_find_node(codec->current_graph, node_id);
if (!InNode) return GF_NON_COMPLIANT_BITSTREAM;
numBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(InNode, GF_SG_FIELD_CODING_IN) - 1);
ind = gf_bs_read_int(bs, numBits);
e = gf_bifs_get_field_index(InNode, ind, GF_SG_FIELD_CODING_IN, &toID);
if (e) return e;
if (r) {
if (r->FromNode->sgprivate->interact)
gf_list_del_item(r->FromNode->sgprivate->interact->routes, r);
r->is_setup = 0;
r->lastActivateTime = 0;
r->FromNode = OutNode;
r->FromField.fieldIndex = fromID;
r->ToNode = InNode;
r->ToField.fieldIndex = toID;
if (!r->FromNode->sgprivate->interact) {
GF_SAFEALLOC(r->FromNode->sgprivate->interact, struct _node_interactive_ext);
if (!r->FromNode->sgprivate->interact) return GF_OUT_OF_MEM;
}
if (!r->FromNode->sgprivate->interact->routes) {
r->FromNode->sgprivate->interact->routes = gf_list_new();
if (!r->FromNode->sgprivate->interact->routes) return GF_OUT_OF_MEM;
}
gf_list_add(r->FromNode->sgprivate->interact->routes, r);
} else {
r = gf_sg_route_new(codec->current_graph, OutNode, fromID, InNode, toID);
if (!r) return GF_OUT_OF_MEM;
gf_sg_route_set_id(r, RouteID);
if (ptr) e = gf_sg_route_set_name(r, name);
}
return e;
}
static GF_Err BD_DecReplace(GF_BifsDecoder * codec, GF_BitStream *bs)
{
u8 type;
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
return BD_DecNodeReplace(codec, bs);
case 1:
return BD_DecFieldReplace(codec, bs);
case 2:
return BD_DecIndexValueReplace(codec, bs);
case 3:
return BD_DecRouteReplace(codec, bs);
}
return GF_OK;
}
/*if parent is non-NULL, we are in a proto code parsing, otherwise this is a top-level proto*/
GF_Err gf_bifs_dec_proto_list(GF_BifsDecoder * codec, GF_BitStream *bs, GF_List *proto_list)
{
u8 flag, field_type, event_type, useQuant, useAnim, f;
u32 i, NbRoutes, ID, numProtos, numFields, count, qpsftype, QP_Type, NumBits;
GF_Node *node;
char name[1000];
GF_ProtoFieldInterface *proto_field;
GF_Proto *proto, *ParentProto;
GF_Err e;
u32 hasMinMax;
void *qp_min_value, *qp_max_value;
GF_SceneGraph *rootSG;
GF_FieldInfo field;
NumBits = qpsftype = 0;
//store proto at codec level
rootSG = codec->current_graph;
ParentProto = codec->pCurrentProto;
e = GF_OK;
numProtos = 0;
proto = NULL;
flag = gf_bs_read_int(bs, 1);
while (flag) {
if (!codec->info->config.ProtoIDBits) return GF_NON_COMPLIANT_BITSTREAM;
/*1- proto interface declaration*/
ID = gf_bs_read_int(bs, codec->info->config.ProtoIDBits);
if (codec->UseName) {
gf_bifs_dec_name(bs, name);
} else {
sprintf(name, "Proto%d", numProtos);
}
/*create a proto in the current graph*/
proto = gf_sg_proto_new(codec->current_graph, ID, name, proto_list ? GF_TRUE : GF_FALSE);
if (proto_list) gf_list_add(proto_list, proto);
/*during parsing, this proto is the current active one - all nodes/proto defined/declared
below it will belong to its namespace*/
codec->current_graph = gf_sg_proto_get_graph(proto);
codec->pCurrentProto = proto;
numFields = 0;
flag = gf_bs_read_int(bs, 1);
while (flag) {
event_type = gf_bs_read_int(bs, 2);
field_type = gf_bs_read_int(bs, 6);
if (codec->UseName) {
gf_bifs_dec_name(bs, name);
} else {
sprintf(name, "_field%d", numFields);
}
/*create field interface*/
proto_field = gf_sg_proto_field_new(proto, field_type, event_type, name);
/*get field info */
gf_sg_proto_field_get_field(proto_field, &field);
switch (event_type) {
case GF_SG_EVENT_EXPOSED_FIELD:
case GF_SG_EVENT_FIELD:
/*parse default value except nodes ...*/
if (gf_sg_vrml_is_sf_field(field_type)) {
e = gf_bifs_dec_sf_field(codec, bs, NULL, &field, GF_FALSE);
} else {
if (codec->info->config.UsePredictiveMFField) {
f = gf_bs_read_int(bs, 1);
/*predictive encoding of proto field is not possible since QP info is not present yet*/
assert(!f);
}
/*reserved*/
f = gf_bs_read_int(bs, 1);
if (!f) {
if (gf_bs_read_int(bs, 1)) {
e = BD_DecMFFieldList(codec, bs, NULL, &field);
} else {
e = BD_DecMFFieldVec(codec, bs, NULL, &field);
}
}
}
if (e) goto exit;
break;
}
flag = gf_bs_read_int(bs, 1);
numFields++;
}
/*2- parse proto code*/
flag = gf_bs_read_int(bs, 1);
/*externProto*/
if (flag) {
memset(&field, 0, sizeof(GF_FieldInfo));
field.far_ptr = gf_sg_proto_get_extern_url(proto);
field.fieldType = GF_SG_VRML_MFURL;
field.name = "ExternProto";
if (codec->info->config.UsePredictiveMFField) {
flag = gf_bs_read_int(bs, 1);
assert(!flag);
}
/*reserved*/
gf_bs_read_int(bs, 1);
/*list or vector*/
flag = gf_bs_read_int(bs, 1);
if (flag) {
e = BD_DecMFFieldList(codec, bs, NULL, &field);
} else {
e = BD_DecMFFieldVec(codec, bs, NULL, &field);
}
if (e) goto exit;
}
/*get proto code*/
else {
/*parse sub-proto list - subprotos are ALWAYS registered with parent proto graph*/
e = gf_bifs_dec_proto_list(codec, bs, NULL);
if (e) goto exit;
flag = 1;
while (flag) {
/*parse all nodes in SFWorldNode table*/
node = gf_bifs_dec_node(codec, bs, NDT_SFWorldNode);
if (!node) {
if (codec->LastError) {
e = codec->LastError;
goto exit;
} else {
flag = gf_bs_read_int(bs, 1);
continue;
}
}
e = gf_node_register(node, NULL);
if (e) goto exit;
//Ivica patch - Flush immediately because of proto instantiation
gf_bifs_flush_command_list(codec);
gf_sg_proto_add_node_code(proto, node);
flag = gf_bs_read_int(bs, 1);
}
/*routes*/
flag = gf_bs_read_int(bs, 1);
if (flag) {
flag = gf_bs_read_int(bs, 1);
if (flag) {
/*list route*/
while (flag) {
e = gf_bifs_dec_route(codec, bs, GF_FALSE);
if (e) goto exit;
flag = gf_bs_read_int(bs, 1);
}
} else {
/*vector*/
i = gf_bs_read_int(bs, 5);
NbRoutes = gf_bs_read_int(bs, i);
for (i=0; i<NbRoutes; i++) {
e = gf_bifs_dec_route(codec, bs, GF_FALSE);
if (e) goto exit;
}
}
}
}
/*restore the namespace*/
codec->current_graph = rootSG;
/*3- parse anim and Quantization stuff*/
useQuant = gf_bs_read_int(bs, 1);
useAnim = gf_bs_read_int(bs, 1);
count = gf_sg_proto_get_field_count(proto);
for (i=0; i<count; i++) {
proto_field = gf_sg_proto_field_find(proto, i);
gf_sg_proto_field_get_field(proto_field, &field);
/*quant*/
if (useQuant && ( (field.eventType == GF_SG_EVENT_FIELD) || (field.eventType == GF_SG_EVENT_EXPOSED_FIELD) )) {
QP_Type = gf_bs_read_int(bs, 4);
if (QP_Type==QC_LINEAR_SCALAR) {
NumBits = gf_bs_read_int(bs, 5);
}
hasMinMax = gf_bs_read_int(bs, 1);
qp_min_value = qp_max_value = NULL;
if (hasMinMax) {
/*parse min and max*/
qpsftype = gf_sg_vrml_get_sf_type(field.fieldType);
switch (qpsftype) {
case GF_SG_VRML_SFINT32:
case GF_SG_VRML_SFTIME:
break;
/*other fields are of elementary type SFFloat or shouldn't have min/max*/
default:
qpsftype = GF_SG_VRML_SFFLOAT;
break;
}
field.fieldType = qpsftype;
qp_min_value = gf_sg_vrml_field_pointer_new(qpsftype);
field.name = "QPMinValue";
field.far_ptr = qp_min_value;
gf_bifs_dec_sf_field(codec, bs, NULL, &field, GF_FALSE);
qp_max_value = gf_sg_vrml_field_pointer_new(qpsftype);
field.name = "QPMaxValue";
field.far_ptr = qp_max_value;
gf_bifs_dec_sf_field(codec, bs, NULL, &field, GF_FALSE);
}
/*and store*/
if (QP_Type) {
e = gf_bifs_proto_field_set_aq_info(proto_field, QP_Type, hasMinMax, qpsftype, qp_min_value, qp_max_value, NumBits);
gf_sg_vrml_field_pointer_del(qp_min_value, qpsftype);
gf_sg_vrml_field_pointer_del(qp_max_value, qpsftype);
}
}
/*anim - not supported yet*/
if (useAnim && ( (field.eventType == GF_SG_EVENT_IN) || (field.eventType == GF_SG_EVENT_EXPOSED_FIELD) )) {
flag = gf_bs_read_int(bs, 1);
if (flag) {
/*Anim_Type = */gf_bs_read_int(bs, 4);
}
}
}
numProtos ++;
/*4- get next proto*/
flag = gf_bs_read_int(bs, 1);
}
exit:
if (e) {
if (proto) gf_sg_proto_del(proto);
codec->current_graph = rootSG;
}
/*restore original parent proto at codec level*/
codec->pCurrentProto = ParentProto;
return e;
}
GF_Err gf_bifs_dec_route(GF_BifsDecoder * codec, GF_BitStream *bs, Bool is_insert)
{
GF_Err e;
u8 flag;
GF_Route *r;
GF_Node *InNode, *OutNode;
u32 RouteID, outField, inField, numBits, ind, node_id;
char name[1000];
RouteID = 0;
flag = gf_bs_read_int(bs, 1);
/*def'ed route*/
if (flag) {
RouteID = 1 + gf_bs_read_int(bs, codec->info->config.RouteIDBits);
if (codec->UseName) gf_bifs_dec_name(bs, name);
}
/*origin*/
node_id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
OutNode = gf_sg_find_node(codec->current_graph, node_id);
if (!OutNode) return GF_SG_UNKNOWN_NODE;
numBits = gf_node_get_num_fields_in_mode(OutNode, GF_SG_FIELD_CODING_OUT) - 1;
numBits = gf_get_bit_size(numBits);
ind = gf_bs_read_int(bs, numBits);
e = gf_bifs_get_field_index(OutNode, ind, GF_SG_FIELD_CODING_OUT, &outField);
if (e) return e;
/*target*/
node_id = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
InNode = gf_sg_find_node(codec->current_graph, node_id);
if (!InNode) return GF_SG_UNKNOWN_NODE;
numBits = gf_node_get_num_fields_in_mode(InNode, GF_SG_FIELD_CODING_IN) - 1;
numBits = gf_get_bit_size(numBits);
ind = gf_bs_read_int(bs, numBits);
e = gf_bifs_get_field_index(InNode, ind, GF_SG_FIELD_CODING_IN, &inField);
if (e) return e;
r = gf_sg_route_new(codec->current_graph, OutNode, outField, InNode, inField);
if (!r) return GF_OUT_OF_MEM;
if (RouteID) {
e = gf_sg_route_set_id(r, RouteID);
if (!e && codec->UseName) e = gf_sg_route_set_name(r, name);
}
return e;
}
GF_Err BD_DecSceneReplace(GF_BifsDecoder * codec, GF_BitStream *bs, GF_List *proto_list)
{
u8 flag;
u32 i, nbR;
GF_Err e;
GF_Node *root;
/*Reset the existing scene / scene graph, protos and route lists*/
if (!proto_list) gf_sg_reset(codec->current_graph);
/*reserved*/
gf_bs_read_int(bs, 6);
codec->UseName = (Bool)gf_bs_read_int(bs, 1);
/*parse PROTOS*/
e = gf_bifs_dec_proto_list(codec, bs, proto_list);
if (e) goto exit;
assert(codec->pCurrentProto==NULL);
/*Parse the top node - always of type SFTopNode*/
root = gf_bifs_dec_node(codec, bs, NDT_SFTopNode);
if (!root && codec->LastError) {
e = codec->LastError;
goto exit;
}
if (root) {
e = gf_node_register(root, NULL);
if (e) goto exit;
}
gf_sg_set_root_node(codec->current_graph, root);
/*Parse the routes*/
flag = gf_bs_read_int(bs, 1);
if (flag) {
flag = gf_bs_read_int(bs, 1);
if (flag) {
/*list*/
while (flag) {
e = gf_bifs_dec_route(codec, bs, GF_FALSE);
if (e) goto exit;
flag = gf_bs_read_int(bs, 1);
}
} else {
/*vector*/
i = gf_bs_read_int(bs, 5);
nbR = gf_bs_read_int(bs, i);
for (i=0; i<nbR; i++) {
e = gf_bifs_dec_route(codec, bs, GF_FALSE);
if (e) goto exit;
}
}
}
exit:
return e;
}
GF_Err gf_bifs_dec_command(GF_BifsDecoder * codec, GF_BitStream *bs)
{
GF_Err e;
e = codec->LastError = GF_OK;
codec->ActiveQP = (M_QuantizationParameter*)codec->scenegraph->global_qp;
while (1) {
u8 type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
e = BD_DecInsert(codec, bs);
break;
case 1:
e = BD_DecDelete(codec, bs);
break;
case 2:
e = BD_DecReplace(codec, bs);
break;
case 3:
e = BD_DecSceneReplace(codec, bs, NULL);
break;
}
if (e) return e;
if (! gf_bs_read_int(bs, 1)) break;
}
while (gf_list_count(codec->QPs)) {
gf_bifs_dec_qp_remove(codec, GF_TRUE);
}
gf_bifs_flush_command_list(codec);
return GF_OK;
}
#endif /*GPAC_DISABLE_BIFS*/
| 27.442128 | 121 | 0.695955 |
7e3128e1f4a9db8016dbc1c2a3424f9c5bdf89fd | 3,236 | c | C | XFree86-3.3/xc/programs/Xserver/hw/ibm/aix/lftUtils.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | 46 | 2015-12-04T17:12:58.000Z | 2022-03-11T04:30:49.000Z | XFree86-3.3/xc/programs/Xserver/hw/ibm/aix/lftUtils.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | null | null | null | XFree86-3.3/xc/programs/Xserver/hw/ibm/aix/lftUtils.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | 23 | 2016-10-24T09:18:14.000Z | 2022-02-25T02:11:35.000Z | /*
*
* Copyright IBM Corporation 1987,1988,1989,1990,1991
*
* All Rights Reserved
*
* License to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND
* NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL
* IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
#ifdef _IBM_LFT
#include <fcntl.h>
#include <sys/lft_ioctl.h>
#include <sys/cfgodm.h>
#include <sys/cfgdb.h>
#include "ibmTrace.h"
#include "lftUtils.h"
static lft_disp_query_t lfq_disp;
char *get_rcm_path()
{
char *rcmpath;
rcmpath = (char *) malloc(strlen("/dev/rcm0") + 1);
strcpy(rcmpath, "/dev/rcm0");
return(rcmpath);
}
static int rcm_fd = -1;
int get_rcm_fd()
{
char *rcm_path;
if(rcm_fd <0) {
rcm_path = get_rcm_path();
if(rcm_path) {
rcm_fd = open(rcm_path, O_RDWR);
}
else return -1;
}
else return rcm_fd;
}
int
init_lft_disp_info()
{
int fd;
lft_query_t lfq;
int i;
int rc;
extern int aixForceFlag;
TRACE(("init_lft_disp_info\n"));
if(aixForceFlag) {
fd = open("/dev/lft0", O_RDONLY);
}
else {
fd = open("/dev/tty", O_RDONLY);
}
if(fd <0) {
ibmInfoMsg("init_lft_disp_info : Couldnot open /dev/tty\n");
return FALSE;
}
rc = ioctl(fd, LFT_QUERY_LFT, &lfq);
if(rc < 0) {
close(fd);
ibmInfoMsg("init_lft_disp_info : ioctl LFT_QUERY_LFT failed\n");
return FALSE;
}
lfq_disp.lft_disp = (lft_disp_info_t*)malloc(
sizeof(lft_disp_info_t)* lfq.number_of_displays);
lfq_disp.num_of_disps = lfq.number_of_displays;
rc = ioctl(fd, LFT_QUERY_DISP, &lfq_disp);
if(rc < 0) {
ibmInfoMsg("init_lft_disp_info : ioctl LFT_QUERY_DISP failed\n");
close(fd);
return FALSE;
}
close(fd);
return TRUE;
}
char *get_disp_name_by_number(anumber)
int anumber; /* 0,1,2..*/
{
extern lft_disp_query_t lfq_disp;
if((anumber >= lfq_disp.num_of_disps) || (anumber <0))
return NULL;
if(lfq_disp.lft_disp[anumber].disp_enable)
return lfq_disp.lft_disp[anumber].disp_name ;
else
return NULL;
}
/* Currently we support only SKYWAY,
* Add other devices here
*/
unsigned long get_lft_disp_id(anumber)
int anumber;
{
char *disp_name;
disp_name = get_disp_name_by_number(anumber);
if(!disp_name)
return 0xffffffff;
else if(!strncmp(disp_name, "gda", 3)) {
return SKYWAY_ID ;
}
else
return 0xffffffff;
}
int get_num_lft_displays()
{
return lfq_disp.num_of_disps;
}
#endif
| 23.114286 | 73 | 0.690667 |
fe6aa356a24ff8ccf8bc0c4c80d34361c7d189e9 | 323 | h | C | Teamwork/Base Controllers/TWController.h | shashankpatel/Teamwork-Client | cbb8f3df0eabc8bd8774550c562490bc8b9a26f1 | [
"MIT"
] | null | null | null | Teamwork/Base Controllers/TWController.h | shashankpatel/Teamwork-Client | cbb8f3df0eabc8bd8774550c562490bc8b9a26f1 | [
"MIT"
] | null | null | null | Teamwork/Base Controllers/TWController.h | shashankpatel/Teamwork-Client | cbb8f3df0eabc8bd8774550c562490bc8b9a26f1 | [
"MIT"
] | null | null | null | //
// TWController.h
// pro
//
// Created by Shashank Patel on 12/09/16.
// Copyright © 2016 iOS. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BackgroundView.h"
#define VIEW_HEIGHT self.view.frame.size.height
#define VIEW_WIDTH self.view.frame.size.width
@interface TWController : UIViewController
@end
| 17.944444 | 47 | 0.727554 |
e0eccc16b73bf51cbf9593b50d1cee77fae0779b | 1,667 | h | C | src/widgets/slicecontrolwidget.h | aalele/MRCEditor | 016f77e6f986a5134e3fd27680208c12a574129b | [
"MIT"
] | 4 | 2018-10-31T14:49:25.000Z | 2018-12-01T05:04:54.000Z | src/widgets/slicecontrolwidget.h | aalele/MRCEditor | 016f77e6f986a5134e3fd27680208c12a574129b | [
"MIT"
] | null | null | null | src/widgets/slicecontrolwidget.h | aalele/MRCEditor | 016f77e6f986a5134e3fd27680208c12a574129b | [
"MIT"
] | 1 | 2019-05-21T14:29:22.000Z | 2019-05-21T14:29:22.000Z | #ifndef SLICECONTROLWIDGET_H
#define SLICECONTROLWIDGET_H
#include <QWidget>
class SliceEditorWidget;
class RenderWidget;
class AbstractSliceDataModel;
class TitledSliderWithSpinBox;
QT_BEGIN_NAMESPACE
class QCheckBox;
class QToolButton;
class QButtonGroup;
class QLabel;
class QComboBox;
QT_END_NAMESPACE;
enum class SliceType;
/**
* \brief This is widget used to control the slice index for both slice view and volume view
*/
class SliceControlWidget:public QWidget
{
Q_OBJECT
public:
SliceControlWidget(SliceEditorWidget* sliceWidget, RenderWidget* volumeWidget,QWidget * parent = nullptr);
void setControlledWidget(SliceEditorWidget* sliceWidget, RenderWidget* volumeWidget);
private slots:
void onSliceTimer();
void updateDataModel();
private:
AbstractSliceDataModel * m_dataModel;
RenderWidget *m_volumeWidget;
SliceEditorWidget *m_sliceWidget;
enum class PlayDirection
{
Forward,
Backward
};
// Widgets
QCheckBox * m_topSliceCheckBox;
TitledSliderWithSpinBox * m_topSlider;
QToolButton *m_topSlicePlayAction;
QCheckBox * m_rightSliceCheckBox;
TitledSliderWithSpinBox * m_rightSlider;
QToolButton *m_rightSlicePlayAction;
QCheckBox * m_frontSliceCheckBox;
TitledSliderWithSpinBox * m_frontSlider;
QToolButton *m_frontSlicePlayAction;
QLabel * m_intervalLabel;
QComboBox * m_intervalCBBox;
QToolButton *m_stopAction;
//QToolButton * m_menuButton;
// State
PlayDirection m_topSlicePlayDirection;
PlayDirection m_rightSlicePlayDirection;
PlayDirection m_frontSlicePlayDirection;
SliceType m_playSliceType;
// Timer
QTimer *m_sliceTimer;
QButtonGroup * m_playButtonGroup;
};
#endif // SLICECONTROLWIDGET_H | 21.934211 | 110 | 0.812837 |
4698f8c4363cd6a0af91a5d6d579bc0539b9316d | 1,852 | h | C | tools/gn/config_values_extractors.h | MIPS/external-chromium_org | e31b3128a419654fd14003d6117caa8da32697e7 | [
"BSD-3-Clause"
] | 2 | 2017-03-21T23:19:25.000Z | 2019-02-03T05:32:47.000Z | tools/gn/config_values_extractors.h | carlosavignano/android_external_chromium_org | 2b5652f7889ccad0fbdb1d52b04bad4c23769547 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | tools/gn/config_values_extractors.h | carlosavignano/android_external_chromium_org | 2b5652f7889ccad0fbdb1d52b04bad4c23769547 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 3 | 2017-07-31T19:09:52.000Z | 2019-01-04T18:48:50.000Z | // Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
#define TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
#include <ostream>
#include <string>
#include <vector>
#include "tools/gn/config.h"
#include "tools/gn/config_values.h"
#include "tools/gn/target.h"
template<typename T, class Writer>
inline void ConfigValuesToStream(
const ConfigValues& values,
const std::vector<T>& (ConfigValues::* getter)() const,
const Writer& writer,
std::ostream& out) {
const std::vector<T>& v = (values.*getter)();
for (size_t i = 0; i < v.size(); i++)
writer(v[i], out);
};
// Writes a given config value that applies to a given target. This collects
// all values from the target itself and all configs that apply, and writes
// then in order.
template<typename T, class Writer>
inline void RecursiveTargetConfigToStream(
const Target* target,
const std::vector<T>& (ConfigValues::* getter)() const,
const Writer& writer,
std::ostream& out) {
// Note: if you make any changes to this, also change the writer in the
// implementation of the "desc" command.
// First write the values from the config itself.
ConfigValuesToStream(target->config_values(), getter, writer, out);
// Then write the configs in order.
for (size_t i = 0; i < target->configs().size(); i++) {
ConfigValuesToStream(target->configs()[i]->config_values(), getter,
writer, out);
}
}
// Writes the values out as strings with no transformation.
void RecursiveTargetConfigStringsToStream(
const Target* target,
const std::vector<std::string>& (ConfigValues::* getter)() const,
std::ostream& out);
#endif // TOOLS_GN_CONFIG_VALUES_EXTRACTORS_H_
| 33.071429 | 76 | 0.704644 |
abf927d55be45acdd0d7376f1034f5e9fc072c24 | 491 | h | C | source/ios/ThemeColorCell.h | wvuRc2/rc2client | fcf20ddbdc186d96978a985771134512308d07e8 | [
"0BSD"
] | 1 | 2019-01-10T15:54:54.000Z | 2019-01-10T15:54:54.000Z | source/ios/ThemeColorCell.h | wvuRc2/rc2client | fcf20ddbdc186d96978a985771134512308d07e8 | [
"0BSD"
] | null | null | null | source/ios/ThemeColorCell.h | wvuRc2/rc2client | fcf20ddbdc186d96978a985771134512308d07e8 | [
"0BSD"
] | null | null | null | //
// ThemeColorCell.h
// Rc2Client
//
// Created by Mark Lilback on 3/13/13.
// Copyright (c) 2013 West Virginia University. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ThemeColorEntry;
@interface ColorView : UIView
@property (nonatomic, strong) UIColor *color;
@end
@interface ThemeColorCell : UITableViewCell
@property (strong) IBOutlet UILabel *nameLabel;
@property (strong) IBOutlet ColorView *colorView;
@property (nonatomic, weak) ThemeColorEntry *colorEntry;
@end
| 22.318182 | 69 | 0.749491 |
1a3204b2a52056f56ccb4c7ce13d0baa163d7a4c | 634 | h | C | JHSDKDemo/Frameworks/IEagle/IEagle.framework/Headers/IECommon.h | mikegame/iOS-JHSDKDemo | faec652dd82e248a0ba2d7bed348927a812fbce7 | [
"MIT"
] | null | null | null | JHSDKDemo/Frameworks/IEagle/IEagle.framework/Headers/IECommon.h | mikegame/iOS-JHSDKDemo | faec652dd82e248a0ba2d7bed348927a812fbce7 | [
"MIT"
] | null | null | null | JHSDKDemo/Frameworks/IEagle/IEagle.framework/Headers/IECommon.h | mikegame/iOS-JHSDKDemo | faec652dd82e248a0ba2d7bed348927a812fbce7 | [
"MIT"
] | null | null | null | //
// IECommon.h
// IBUnionSDK
//
// Created by bingniao on 17/4/22.
// Copyright © 2017年 junhai. All rights reserved.
//
#ifndef IECommon_h
#define IECommon_h
/** SDK强制旋转方向 */
typedef NS_OPTIONS(NSInteger, IEScreenDirectionType)
{
IEScreenDirectionUnlimited = -1,
IEScreenDirectionPortrait = 0,
IEScreenDirectionLandscape = 1,
};
/** 用户扩展信息动作(GAME/ROLEUPDATE) */
typedef NS_OPTIONS(NSInteger, IEUploadUserDataAction)
{
IEonEnterServer = 0,
IEonRoleUpdate = 1,
};
/** 接口版本禁用声明 */
#define IE_DEPRECATED(_version, ...) __attribute__((deprecated("接口已不可用,版本号:"#_version#__VA_ARGS__)))
#endif /* IECommon_h */
| 20.451613 | 100 | 0.709779 |
4de798d7994635e5dc74103109eea13cbc61b685 | 7,572 | h | C | tools/zhAnimationStudio/src/AnimationStudioApp.h | tpejsa/ZombieHorse | 0064a62738dc1a37aac90fb3636e9f4ac4828eff | [
"Unlicense"
] | null | null | null | tools/zhAnimationStudio/src/AnimationStudioApp.h | tpejsa/ZombieHorse | 0064a62738dc1a37aac90fb3636e9f4ac4828eff | [
"Unlicense"
] | null | null | null | tools/zhAnimationStudio/src/AnimationStudioApp.h | tpejsa/ZombieHorse | 0064a62738dc1a37aac90fb3636e9f4ac4828eff | [
"Unlicense"
] | null | null | null | /******************************************************************************
Copyright (C) 2013 Tomislav Pejsa
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 __AnimationStudioApp_h__
#define __AnimationStudioApp_h__
#include "AnimationStudio.h"
#include "ParamSkeletonEditor.h"
class AnimationStudioFrame;
/**
* @brief Timer used for rendering at constant framerate.
*/
class RenderTimer : public wxTimer
{
public:
void Notify();
};
/**
* @brief Animation Studio application class.
*/
class AnimationStudioApp : public wxApp, public FrameListener
{
public:
/**
* Constructor.
*/
AnimationStudioApp();
/**
* Destructor.
*/
~AnimationStudioApp();
/**
* Gets a pointer to the main application frame.
*/
AnimationStudioFrame* getAppFrame() const;
/**
* Gets the OGRE system root.
*/
Ogre::Root* getOgreRoot() const { return mOgreRoot; }
/**
* Gets a pointer to the OGRE camera.
*/
Camera* getCamera() const;
/**
* Gets a pointer to the OGRE SceneManager.
*/
SceneManager* getSceneManager() const;
/**
* Selects the skeleton with the specified name,
* loading and displaying the corresponding OGRE entity.
*
* @param name Skeleton name.
* @return Pointer to the character or NULL if no skeleton
* has been selected.
*/
zh::Skeleton* selectSkeleton( const string& name );
/**
* Removes the specified skeleton.
*
* @param name Skeleton name.
*/
void removeSkeleton( const string& name );
/**
* Gets the parametric skeleton editor.
*/
ParamSkeletonEditor* getParamSkeletonEditor() const;
/**
* Selects the animation clip with the specified name
* for playback and editing.
*
* @param anim Fully qualified name of the animation.
* @return Pointer to the animation clip or NULL if no animation
* has been selected.
*/
zh::Animation* selectAnimation( const string& anim );
/**
* Deselect current animation.
*/
void deselectAnimation();
/**
* Gets a pointer to the currently selected animation clip.
*/
zh::Animation* getCurrentAnimation() const;
/**
* If true, animation is enabled (updates are sent to ZombieHorse system).
*/
bool getAnimationEnabled() const { return mAnimEnabled; }
/**
* If true, animation is enabled (updates are sent to ZombieHorse system).
*/
void setAnimationEnabled( bool enabled = true ) { mAnimEnabled = enabled; }
/**
* Displays visual markers on specified skeleton joints.
*
* @remark Specify empty set to display markers on ALL joints.
*/
void displayJointMarkers( const std::set<std::string>& boneNames, bool enable = true );
/**
* Displays a visual marker on a single skeleton joint.
*/
void displayJointMarker( const std::string& boneName, bool enable = true );
/**
* Returns true if there is a marker on the specified joint,
* false otherwise.
*/
bool hasJointMarker( const std::string& boneName ) const;
/**
* Enables tracing of motion paths of specified skeleton joint markers.
*
* @remark Specify empty set to display traces on ALL joints.
*/
void traceJointPaths( const std::set<std::string>& boneNames, bool enable = true );
/**
* Enables tracing of the motion path of a single skeleton joint marker.
*/
void traceJointPath( const std::string& boneName, bool enable = true );
/**
* Returns true if there is path trace on the specified joint,
* false otherwise.
*/
bool hasJointTrace( const std::string& boneName ) const;
/**
* Create a dummy environment object at the specified location.
*
* @param name Object name.
* @param pos Object position in world space.
* @return Pointer to the object.
*/
zh::Bone* createEnvironmentObject( const std::string& name, const zh::Vector3& pos );
/**
* Delete the specified environment object.
*
* @param name Object name.
*/
void deleteEnvironmentObject( const std::string& name );
/**
* Delete all environment objects.
*/
void deleteAllEnvironmentObjects();
/**
* Toggles rendering at constant framerate on/off.
*
* @remark Frame rate will be locked to the frame rate of the currently
* selected animation, as long as the latter is 20 fps or higher.
*/
void useConstFrameRate( bool useConstFR = true );
/**
* OGRE calls this method at the beginning of a new frame.
*/
bool frameStarted( const FrameEvent& evt );
/**
* OGRE calls this method at the end of the current frame.
*/
bool frameEnded( const FrameEvent& evt );
/**
* Resizes the render window.
*/
void resize( unsigned int width, unsigned int height );
/**
* For handling application-wide keyboard events
*/
int FilterEvent( wxEvent& evt );
/**
* This method is called on application initialization.
*/
bool OnInit();
/**
* This method is called on application exit.
*/
int OnExit();
/**
* This method is called when there are no messages left to process
* (extremely often, so this is where we put the render loop).
*/
void OnIdle( wxIdleEvent& evt );
protected:
bool init( wxWindow* wnd = NULL ); ///< Initializes OGRE and ZombieHorse.
bool initOgreCore( wxWindow* renderWnd = NULL ); ///< Initializes OGRE system core.
bool createSceneManager(); ///< Creates a scene manager.
bool createCamera(); ///< Creates a camera.
bool createViewports(); ///< Creates viewports.
bool createFrameListener(); ///< Sets up a frame listener.
bool loadResourceLocations(); ///< Loads resource locations from resources.cfg.
bool createScene(); ///< Creates the default scene.
bool destroyScene(); ///< Destroys the default scene.
bool initZombieHorse(); ///< Initializes ZombieHorse system.
void _toggleIK( unsigned long solverClassId );
// Compute joint trace path (piecewise linear) for the specified set of bones and the current animation...
void _computeJointTracePath( const std::string& boneName, std::vector<Ogre::Vector3>& path );
DECLARE_EVENT_TABLE()
AnimationStudioFrame* mFrmMain;
RenderTimer* mRenderTimer;
float mFrameTime;
Root *mOgreRoot; ///< OGRE system.
Camera* mCam; ///< Camera.
SceneManager* mSceneMgr; ///< Scene manager.
RenderWindow* mRenderWnd; ///< OGRE render window.
zh::Animation* mCurAnim; ///< Currently selected animation.
bool mAnimEnabled; ///< Updates to the animation system enabled/disabled.
ParamSkeletonEditor* mParamSkelEditor;
// Motion visualization
std::set<std::string> mJointsWithMarkers;
std::set<std::string> mTracedJoints;
zh::Animation* mTracedJointAnim;
std::map<std::string, std::vector<std::pair<float,zh::Vector3>>> mTracedJointPaths;
};
extern AnimationStudioApp* gApp;
#endif // __AnimationStudioApp_h__
| 27.434783 | 107 | 0.711701 |
ff234124cf75664b36f1cb08263fbacf416fa443 | 1,002 | h | C | GraphicRealTime/graphic.h | axpaul/GraphicRealTime | 166dbd114fa4e57076409054191e973a2461a4cc | [
"BSD-3-Clause"
] | 1 | 2021-12-26T05:20:32.000Z | 2021-12-26T05:20:32.000Z | GraphicRealTime/graphic.h | axpaul/GraphicRealTime | 166dbd114fa4e57076409054191e973a2461a4cc | [
"BSD-3-Clause"
] | null | null | null | GraphicRealTime/graphic.h | axpaul/GraphicRealTime | 166dbd114fa4e57076409054191e973a2461a4cc | [
"BSD-3-Clause"
] | null | null | null | #ifndef GRAPHIC_H
#define GRAPHIC_H
#include <QObject>
#include <QDebug>
#include <QDate>
#include <QMutex>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>
#include <QtCharts/QDateTimeAxis>
#include <QtCharts/QValueAxis>
#include <QtCharts/QSplineSeries>
#include <QtCharts/QAbstractAxis>
#include <QtCore/QRandomGenerator>
#include <QtCore/QTimer>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
#include "controller.h"
class Controller;
QT_CHARTS_BEGIN_NAMESPACE
class QSplineSeries;
class QValueAxis;
QT_CHARTS_END_NAMESPACE
QT_CHARTS_USE_NAMESPACE
class Graphic : public QChart
{
Q_OBJECT
public:
Graphic(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = {});
~Graphic();
public slots:
void addPoint(qreal newPoint);
private:
QSplineSeries *m_series;
QDateTimeAxis *m_axisX;
QValueAxis *m_axisY;
QDateTime *m_timeActu;
Controller *m_controller;
QMutex *m_mutex;
qreal m_x;
qreal m_y;
};
#endif // GRAPHIC_H
| 18.218182 | 74 | 0.748503 |
ff431f215428cf34b7a7ff6adccd2fcec6ae6738 | 422 | h | C | Class/Category/UINib+LoadXIBDynamically.h | hmuronaka/LoadXIBDynamically | 7c2fb1f8d03b3840f8b3def8d3d597e2adb783a7 | [
"MIT"
] | 1 | 2020-05-01T04:14:38.000Z | 2020-05-01T04:14:38.000Z | Class/Category/UINib+LoadXIBDynamically.h | hmuronaka/LoadXIBDynamically | 7c2fb1f8d03b3840f8b3def8d3d597e2adb783a7 | [
"MIT"
] | null | null | null | Class/Category/UINib+LoadXIBDynamically.h | hmuronaka/LoadXIBDynamically | 7c2fb1f8d03b3840f8b3def8d3d597e2adb783a7 | [
"MIT"
] | null | null | null | //
// UINib+LoadXIBDynamically.h
// LoadXIBDynamically
//
// Created by Muronaka Hiroaki on 2015/11/11.
// Copyright © 2015年 Muronaka Hiroaki. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UINib (LoadXIBDynamically)
+(instancetype)lx_loadWithNibName:(NSString*)nibName bundle:(NSBundle*)bundleOrNil;
+(instancetype)lx_loadDynamicallyWithNibName:(NSString*)nibName bundle:(NSBundle *)bundleOrNil;
@end
| 24.823529 | 95 | 0.770142 |
9e7674c1dbff2388804c249abf8af13cdc338a99 | 39,560 | h | C | lib/rttr/include/rttr/detail/variant/variant_data_policy.h | lopea/GigaEngine | 4e736c96e16867e3ee582581cc81e6866b45e831 | [
"MIT"
] | 17 | 2017-04-02T00:17:47.000Z | 2021-11-23T21:42:48.000Z | lib/rttr/include/rttr/detail/variant/variant_data_policy.h | lopea/GigaEngine | 4e736c96e16867e3ee582581cc81e6866b45e831 | [
"MIT"
] | 16 | 2019-03-01T09:37:33.000Z | 2019-05-13T13:10:54.000Z | lib/rttr/include/rttr/detail/variant/variant_data_policy.h | lopea/GigaEngine | 4e736c96e16867e3ee582581cc81e6866b45e831 | [
"MIT"
] | 5 | 2017-08-06T12:47:18.000Z | 2020-08-14T14:16:22.000Z | /************************************************************************************
* *
* Copyright (c) 2014 - 2018 Axel Menzel <info@rttr.org> *
* *
* This file is part of RTTR (Run Time Type Reflection) *
* License: 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 RTTR_VARIANT_DATA_POLICY_H_
#define RTTR_VARIANT_DATA_POLICY_H_
#include "rttr/detail/misc/misc_type_traits.h"
#include "rttr/detail/variant/variant_data.h"
#include "rttr/detail/misc/argument_wrapper.h"
#include "rttr/detail/variant_associative_view/variant_associative_view_creator.h"
#include "rttr/detail/variant_sequential_view/variant_sequential_view_creator.h"
#include "rttr/detail/variant/variant_data_converter.h"
#include "rttr/detail/comparison/compare_equal.h"
#include "rttr/detail/comparison/compare_less.h"
#include <cstdint>
namespace rttr
{
namespace detail
{
template<typename T, typename Converter = empty_type_converter<T>>
struct variant_data_policy_big;
template<typename T, typename Converter = empty_type_converter<T>>
struct variant_data_policy_small;
template<typename T>
struct variant_data_policy_array_small;
template<typename T>
struct variant_data_policy_array_big;
struct void_variant_type;
struct variant_data_policy_void;
struct variant_data_policy_nullptr_t;
struct variant_data_policy_string;
template<typename T>
struct variant_data_policy_arithmetic;
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T, bool Can_Place = (sizeof(T) <= sizeof(variant_data)) &&
(std::alignment_of<T>::value <= std::alignment_of<variant_data>::value)>
using can_place_in_variant = std::integral_constant<bool, Can_Place>;
/*!
* This template alias will determine the manager class for the given type \p T which is placed inside the variant.
*
* Small types will be placed inside the variant without explicit allocation of memory.
* This will improve the performance a lot.
*
* \remark Raw char arrays with rank equal to one, will be copied to a std::string.
*
* \return The manager class for the type T.
*/
template<typename T>
using variant_policy = conditional_t<std::is_same<T, void_variant_type>::value,
variant_data_policy_void,
conditional_t<is_nullptr_t<T>::value,
variant_data_policy_nullptr_t,
conditional_t<std::is_same<T, std::string>::value || is_one_dim_char_array<T>::value,
variant_data_policy_string,
conditional_t<can_place_in_variant<T>::value,
conditional_t<std::is_arithmetic<T>::value,
variant_data_policy_arithmetic<T>,
conditional_t<std::is_array<T>::value,
variant_data_policy_array_small<T>,
conditional_t<std::is_enum<T>::value,
variant_data_policy_small<T, default_type_converter<T, convert_from_enum<T>>>,
variant_data_policy_small<T>
>
>
>,
conditional_t<std::is_array<T>::value,
variant_data_policy_array_big<T>,
conditional_t<std::is_enum<T>::value,
variant_data_policy_big<T, default_type_converter<T, convert_from_enum<T>>>,
variant_data_policy_big<T>
>
>
>
>
>
>;
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* \brief This enum is used in the invoke function to delegate
* the execution of certain operations.
*
*/
enum class variant_policy_operation : uint8_t
{
DESTROY,
CLONE,
SWAP,
EXTRACT_WRAPPED_VALUE,
CREATE_WRAPPED_VALUE,
GET_VALUE,
GET_TYPE,
GET_PTR,
GET_RAW_TYPE,
GET_RAW_PTR,
GET_ADDRESS_CONTAINER,
IS_ASSOCIATIVE_CONTAINER,
IS_SEQUENTIAL_CONTAINER,
CREATE_ASSOCIATIV_VIEW,
CREATE_SEQUENTIAL_VIEW,
IS_VALID,
IS_NULLPTR,
CONVERT,
COMPARE_EQUAL,
COMPARE_LESS
};
/////////////////////////////////////////////////////////////////////////////////////////
using variant_policy_func = bool (*)(variant_policy_operation, const variant_data&, argument_wrapper);
/////////////////////////////////////////////////////////////////////////////////////////
// some ugly workaround for MSVC < v. 1800
#if RTTR_COMPILER == RTTR_COMPILER_MSVC && RTTR_COMP_VER <= 1800
#define COMPARE_EQUAL_PRE_PROC(lhs, rhs, ok) \
compare_equal(const_cast<typename remove_const<T>::type&>(Tp::get_value(lhs)), const_cast<typename remove_const<T>::type&>(rhs.get_value<T>()), ok)
#else
#define COMPARE_EQUAL_PRE_PROC(lhs, rhs, ok) \
compare_equal(Tp::get_value(src_data), rhs.get_value<T>(), ok)
#endif
#if RTTR_COMPILER == RTTR_COMPILER_MSVC && RTTR_COMP_VER <= 1800
#define COMPARE_LESS_PRE_PROC(lhs, rhs, result) \
compare_less_than(const_cast<typename remove_const<T>::type&>(Tp::get_value(lhs)), const_cast<typename remove_const<T>::type&>(rhs.get_value<T>()), result)
#else
#define COMPARE_LESS_PRE_PROC(lhs, rhs, result) \
compare_less_than(Tp::get_value(src_data), rhs.get_value<T>(), result)
#endif
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
enable_if_t<std::is_pointer<T>::value, bool>
static RTTR_INLINE is_nullptr(T& val)
{
return (val == nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
enable_if_t<!std::is_pointer<T>::value, bool>
static RTTR_INLINE is_nullptr(T& to)
{
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
#if RTTR_COMPILER == RTTR_COMPILER_MSVC && RTTR_COMP_VER <= 1800
// MSVC 2013 has not a full working "std::is_copy_constructible", thats why
// this workaround is used here
template<typename T>
using is_copyable = ::rttr::detail::is_copy_constructible<T>;
#else
template<typename T>
using is_copyable = std::is_copy_constructible<T>;
#endif
template<typename T, typename Tp = decay_except_array_t<wrapper_mapper_t<T>> >
enable_if_t<is_copyable<Tp>::value &&
is_wrapper<T>::value, variant> get_wrapped_value(T& value)
{
using raw_wrapper_type = remove_cv_t<remove_reference_t<T>>;
return variant(wrapper_mapper<raw_wrapper_type>::get(value));
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T, typename Tp = decay_except_array_t<wrapper_mapper_t<T>>>
enable_if_t<!is_copyable<Tp>::value ||
!is_wrapper<T>::value, variant> get_wrapped_value(T& value)
{
return variant();
}
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This class represents the base implementation for variant_data policy.
*
* We use the C++ idiom CRTP (Curiously Recurring Template Pattern) to avoid rewriting the same code over an over again.
* The template parameter \p Tp represents the derived class, which will be invoked.
* Hopefully, the function call to derived class will be inlined.
*/
template<typename T, typename Tp, typename Converter>
struct variant_data_base_policy
{
static bool invoke(variant_policy_operation op, const variant_data& src_data, argument_wrapper arg)
{
switch (op)
{
case variant_policy_operation::DESTROY:
{
Tp::destroy(const_cast<T&>(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::CLONE:
{
Tp::clone(Tp::get_value(src_data), arg.get_value<variant_data>());
break;
}
case variant_policy_operation::SWAP:
{
Tp::swap(const_cast<T&>(Tp::get_value(src_data)), arg.get_value<variant_data>());
break;
}
case variant_policy_operation::EXTRACT_WRAPPED_VALUE:
{
arg.get_value<variant>() = get_wrapped_value(Tp::get_value(src_data));
break;
}
case variant_policy_operation::CREATE_WRAPPED_VALUE:
{
const auto& params = arg.get_value<std::tuple<variant&, const type&>>();
variant& var = std::get<0>(params);
const type& wrapper_type = std::get<1>(params);
wrapper_type.create_wrapped_value(Tp::get_value(src_data), var);
break;
}
case variant_policy_operation::GET_VALUE:
{
arg.get_value<const void*>() = &Tp::get_value(src_data);
break;
}
case variant_policy_operation::GET_TYPE:
{
arg.get_value<type>() = type::get<T>();
break;
}
case variant_policy_operation::GET_PTR:
{
arg.get_value<void*>() = as_void_ptr(std::addressof(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::GET_RAW_TYPE:
{
arg.get_value<type>() = type::get<typename raw_type<T>::type>();
break;
}
case variant_policy_operation::GET_RAW_PTR:
{
arg.get_value<void*>() = as_void_ptr(raw_addressof(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::GET_ADDRESS_CONTAINER:
{
data_address_container& data = arg.get_value<data_address_container>();
data.m_type = type::get< raw_addressof_return_type_t<T> >();
data.m_wrapped_type = type::get< wrapper_address_return_type_t<T> >();
data.m_data_address = as_void_ptr(raw_addressof(Tp::get_value(src_data)));
data.m_data_address_wrapped_type = as_void_ptr(wrapped_raw_addressof(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::IS_ASSOCIATIVE_CONTAINER:
{
return can_create_associative_view<T>::value;
}
case variant_policy_operation::IS_SEQUENTIAL_CONTAINER:
{
return can_create_sequential_view<T>::value;
}
case variant_policy_operation::CREATE_ASSOCIATIV_VIEW:
{
arg.get_value<variant_associative_view_private&>() = create_variant_associative_view(const_cast<T&>(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::CREATE_SEQUENTIAL_VIEW:
{
arg.get_value<variant_sequential_view_private&>() = create_variant_sequential_view(const_cast<T&>(Tp::get_value(src_data)));
break;
}
case variant_policy_operation::CONVERT:
{
return Converter::convert_to(Tp::get_value(src_data), arg.get_value<argument>());
}
case variant_policy_operation::IS_VALID:
{
return true;
}
case variant_policy_operation::IS_NULLPTR:
{
return is_nullptr(Tp::get_value(src_data));
}
case variant_policy_operation::COMPARE_EQUAL:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& lhs = std::get<0>(param);
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
const type rhs_type = rhs.get_type();
const type lhs_type = type::get<T>();
const auto is_lhs_arithmetic = std::is_arithmetic<T>::value;
RTTR_BEGIN_DISABLE_CONDITIONAL_EXPR_WARNING
if (lhs_type == rhs_type)
{
return COMPARE_EQUAL_PRE_PROC(src_data, rhs, ok);
}
else
{
if (is_lhs_arithmetic && rhs_type.is_arithmetic())
{
return variant_compare_equal(lhs, lhs_type, rhs, rhs_type, ok);
}
else
{
variant var_tmp;
if (rhs.convert(lhs_type, var_tmp))
return COMPARE_EQUAL_PRE_PROC(src_data, var_tmp, ok);
else if (lhs.convert(rhs_type, var_tmp))
return (var_tmp.compare_equal(rhs, ok));
else if (rhs.is_nullptr())
return is_nullptr(Tp::get_value(src_data));
}
}
RTTR_END_DISABLE_CONDITIONAL_EXPR_WARNING
return false;
}
case variant_policy_operation::COMPARE_LESS:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& lhs = std::get<0>(param);
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
const type rhs_type = rhs.get_type();
const type lhs_type = type::get<T>();
int result = 0;
if (lhs_type == rhs_type)
{
if ((ok = COMPARE_LESS_PRE_PROC(src_data, rhs, result)) == true)
return (result == -1 ? true : false);
}
else
{
return variant_compare_less(lhs, lhs_type, rhs, rhs_type, ok);
}
bool ok1 = false;
bool ok2 = false;
auto ret = (lhs.to_string(&ok1) < rhs.to_string(&ok2));
if (ok1 && ok2)
{
ok = true;
return ret;
}
else
{
return false;
}
}
}
return true;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used for small custom data types.
*
* These are types which will fit into the storage of \ref variant_data.
* The data will be placed with "placement new" inside the variant.
* That also means the destructor will be called explicitly.
*/
template<typename T, typename Converter>
struct variant_data_policy_small : variant_data_base_policy<T, variant_data_policy_small<T>, Converter>
{
static RTTR_INLINE const T& get_value(const variant_data& data)
{
return reinterpret_cast<const T&>(data);
}
static RTTR_INLINE void destroy(T& value)
{
value.~T();
}
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
new (&dest) T(value);
}
static RTTR_INLINE void swap(T& value, variant_data& dest)
{
new (&dest) T(value);
destroy(value);
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
new (&dest) T(std::forward<U>(value));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used for custom types that size does NOT fit into variant_data.
*
* Then the type will be allocated on the heap and a pointer to the data is stored in variant_data.
*/
template<typename T, typename Converter>
struct variant_data_policy_big : variant_data_base_policy<T, variant_data_policy_big<T>, Converter>
{
static RTTR_INLINE const T& get_value(const variant_data& data)
{
return *reinterpret_cast<T* const &>(data);
}
static RTTR_INLINE void destroy(T& value)
{
delete &value;
}
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
reinterpret_cast<T*&>(dest) = new T(value);
}
static RTTR_INLINE void swap(T& value, variant_data& dest)
{
reinterpret_cast<T*&>(dest) = &value;
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
reinterpret_cast<T*&>(dest) = new T(std::forward<U>(value));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
#if RTTR_COMPILER == RTTR_COMPILER_MSVC && RTTR_COMP_VER <= 1800
#define COPY_ARRAY_PRE_PROC(value, dest) \
copy_array(const_cast<typename remove_const<T>::type&>(value), const_cast<typename remove_const<T>::type&>(get_value(dest)))
#else
#define COPY_ARRAY_PRE_PROC(value, dest) \
copy_array(value, const_cast<typename remove_const<T>::type&>(get_value(dest)));
#endif
/*!
* This policy is used for small raw array types, which fit in \p variant_data.
*
* The array data will be copied into \p variant_data.
*/
template<typename T>
struct variant_data_policy_array_small : variant_data_base_policy<T, variant_data_policy_array_small<T>>
{
static RTTR_INLINE const T& get_value(const variant_data& data)
{
return reinterpret_cast<const T&>(data);
}
static RTTR_INLINE void destroy(T& value)
{
}
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
COPY_ARRAY_PRE_PROC(value, dest);
}
static RTTR_INLINE void swap(T& value, variant_data& dest)
{
clone(value, dest);
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
COPY_ARRAY_PRE_PROC(value, dest);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used for raw array types of arbitrary rank, which fit NOT into \p variant_data.
*
* A copy of the given array value will be allocated on the heap. The pointer to the array is stored in \p variant_data.
*/
template<typename T>
struct variant_data_policy_array_big : variant_data_base_policy<T, variant_data_policy_array_big<T>>
{
using array_dest_type = decltype(new T);
static RTTR_INLINE const T& get_value(const variant_data& data)
{
return reinterpret_cast<const T&>(*reinterpret_cast<const array_dest_type&>(data));
}
static RTTR_INLINE void destroy(T& value)
{
delete [] &value;
}
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
reinterpret_cast<array_dest_type&>(dest) = new T;
COPY_ARRAY_PRE_PROC(value, dest);
}
static RTTR_INLINE void swap(T& value, variant_data& dest)
{
reinterpret_cast<array_dest_type&>(dest) = value;
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
using array_dest_type = decltype(new T);
reinterpret_cast<array_dest_type&>(dest) = new T;
COPY_ARRAY_PRE_PROC(value, dest);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used for all arithmetic types, which fit into the storage of variant_data.
*
* The data will be raw copied into the variant_data.
*/
template<typename T>
struct variant_data_policy_arithmetic : variant_data_base_policy<T, variant_data_policy_arithmetic<T>, default_type_converter<T>>
{
static RTTR_INLINE const T& get_value(const variant_data& data)
{
return reinterpret_cast<const T&>(data);
}
static RTTR_INLINE void destroy(T& value)
{
}
static RTTR_INLINE void clone(const T& value, variant_data& dest)
{
reinterpret_cast<T&>(dest) = value;
}
static RTTR_INLINE void swap(T& value, variant_data& dest)
{
clone(value, dest);
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
reinterpret_cast<T&>(dest) = value;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy will manage the type std::string.
*
* This type has build in converter for several other basic types, that why we have a specialization here for it.
*/
struct RTTR_API variant_data_policy_string : variant_data_policy_big<std::string, default_type_converter<std::string>>
{
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
reinterpret_cast<std::string*&>(dest) = new std::string(std::forward<U>(value));
}
template<std::size_t N>
static RTTR_INLINE void create(const char (&value)[N], variant_data& dest)
{
reinterpret_cast<std::string*&>(dest) = new std::string(value, N - 1);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used when the variant does not contain any data. So in fact an invalid variant.
*
* With this approach we avoid checking for an valid variant. E.g. during destruction.
*/
struct RTTR_API variant_data_policy_empty
{
static bool invoke(variant_policy_operation op, const variant_data& src_data, argument_wrapper arg)
{
switch (op)
{
case variant_policy_operation::DESTROY:
case variant_policy_operation::CLONE:
case variant_policy_operation::SWAP:
case variant_policy_operation::EXTRACT_WRAPPED_VALUE:
case variant_policy_operation::CREATE_WRAPPED_VALUE:
{
break;
}
case variant_policy_operation::GET_VALUE:
{
arg.get_value<const void*>() = nullptr;
break;
}
case variant_policy_operation::GET_TYPE:
{
arg.get_value<type>() = get_invalid_type();
break;
}
case variant_policy_operation::GET_PTR:
{
arg.get_value<void*>() = nullptr;
break;
}
case variant_policy_operation::GET_RAW_TYPE:
{
arg.get_value<type>() = get_invalid_type();
break;
}
case variant_policy_operation::GET_RAW_PTR:
{
arg.get_value<void*>() = nullptr;
break;
}
case variant_policy_operation::GET_ADDRESS_CONTAINER:
{
data_address_container& data = arg.get_value<data_address_container>();
data.m_type = get_invalid_type();
data.m_wrapped_type = get_invalid_type();
data.m_data_address = nullptr;
data.m_data_address_wrapped_type = nullptr;
break;
}
case variant_policy_operation::IS_ASSOCIATIVE_CONTAINER:
{
return false;
}
case variant_policy_operation::IS_SEQUENTIAL_CONTAINER:
{
return false;
}
case variant_policy_operation::CREATE_ASSOCIATIV_VIEW:
{
break;
}
case variant_policy_operation::CREATE_SEQUENTIAL_VIEW:
{
break;
}
case variant_policy_operation::IS_VALID:
{
return false;
}
case variant_policy_operation::IS_NULLPTR:
{
return false;
}
case variant_policy_operation::CONVERT:
{
return false;
}
case variant_policy_operation::COMPARE_EQUAL:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
if (!rhs.is_valid())
ok = true;
return ok;
}
case variant_policy_operation::COMPARE_LESS:
{
return false;
}
}
return true;
}
template<typename U>
static RTTR_INLINE void create(U&&, variant_data&)
{
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used when the variant does contain a `void`.
*
* A `void` variant is a special variant to indicate that a function call was successful.
* So in fact it does not contain any data, but the returned type of \ref variant::get_type() is a `void`.
*/
struct RTTR_API variant_data_policy_void
{
static bool invoke(variant_policy_operation op, const variant_data& src_data, argument_wrapper arg)
{
switch (op)
{
case variant_policy_operation::DESTROY:
case variant_policy_operation::CLONE:
case variant_policy_operation::SWAP:
case variant_policy_operation::EXTRACT_WRAPPED_VALUE:
{
break;
}
case variant_policy_operation::GET_VALUE:
{
arg.get_value<const void*>() = nullptr;
break;
}
case variant_policy_operation::GET_TYPE:
{
arg.get_value<type>() = type::get<void>();
break;
}
case variant_policy_operation::GET_PTR:
{
arg.get_value<void*>() = nullptr;
}
case variant_policy_operation::GET_RAW_TYPE:
{
arg.get_value<type>() = type::get<void>();
break;
}
case variant_policy_operation::GET_RAW_PTR:
{
arg.get_value<void*>() = nullptr;
break;
}
case variant_policy_operation::GET_ADDRESS_CONTAINER:
{
data_address_container& data = arg.get_value<data_address_container>();
data.m_type = type::get<void>();
data.m_wrapped_type = type::get<void>();
data.m_data_address = nullptr;
data.m_data_address_wrapped_type = nullptr;
break;
}
case variant_policy_operation::IS_ASSOCIATIVE_CONTAINER:
{
return false;
}
case variant_policy_operation::IS_SEQUENTIAL_CONTAINER:
{
return false;
}
case variant_policy_operation::CREATE_ASSOCIATIV_VIEW:
{
break;
}
case variant_policy_operation::CREATE_SEQUENTIAL_VIEW:
{
break;
}
case variant_policy_operation::CREATE_WRAPPED_VALUE:
{
return false;
}
case variant_policy_operation::IS_NULLPTR:
{
return false;
}
case variant_policy_operation::IS_VALID:
{
return true;
}
case variant_policy_operation::CONVERT:
{
return false;
}
case variant_policy_operation::COMPARE_EQUAL:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
if (rhs.is_type<void>())
ok = true;
return ok;
}
case variant_policy_operation::COMPARE_LESS:
{
return false;
}
}
return true;
}
template<typename U>
static RTTR_INLINE void create(U&&, variant_data&)
{
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* This policy is used when the variant does contain a `nullptr`.
*
* We need this special handling because MSVC 2013 cannot handle correct a const std::nullptr_t,
* On the other hand we have some special handling for comparison.
*/
struct RTTR_API variant_data_policy_nullptr_t
{
static RTTR_INLINE std::nullptr_t& get_value(const variant_data& data)
{
return reinterpret_cast<std::nullptr_t&>(const_cast<variant_data&>(data));
}
static RTTR_INLINE void destroy(std::nullptr_t& value)
{
// for unknown reason we have to fully qualify the dtor call here;
// otherwise mingw has reports a problems here: "request for member 'nullptr_t' in non-class type 'std::nullptr_t'"
value.std::nullptr_t::~nullptr_t();
}
static RTTR_INLINE void clone(const std::nullptr_t& value, variant_data& dest)
{
new (&dest) std::nullptr_t(value);
}
static RTTR_INLINE void swap(std::nullptr_t& value, variant_data& dest)
{
new (&dest) std::nullptr_t(value);
destroy(value);
}
static bool invoke(variant_policy_operation op, const variant_data& src_data, argument_wrapper arg)
{
switch (op)
{
case variant_policy_operation::DESTROY:
{
destroy(get_value(src_data));
break;
}
case variant_policy_operation::CLONE:
{
clone(get_value(src_data), arg.get_value<variant_data>());
break;
}
case variant_policy_operation::SWAP:
{
swap(get_value(src_data), arg.get_value<variant_data>());
break;
}
case variant_policy_operation::CREATE_WRAPPED_VALUE:
{
return false;
}
case variant_policy_operation::EXTRACT_WRAPPED_VALUE:
{
break;
}
case variant_policy_operation::GET_VALUE:
{
arg.get_value<const void*>() = &get_value(src_data);
break;
}
case variant_policy_operation::GET_TYPE:
{
arg.get_value<type>() = type::get<std::nullptr_t>();
break;
}
case variant_policy_operation::GET_PTR:
{
arg.get_value<void*>() = as_void_ptr(std::addressof(get_value(src_data)));
}
case variant_policy_operation::GET_RAW_TYPE:
{
arg.get_value<type>() = type::get<std::nullptr_t>();
break;
}
case variant_policy_operation::GET_RAW_PTR:
{
arg.get_value<void*>() = as_void_ptr(raw_addressof(get_value(src_data)));
break;
}
case variant_policy_operation::GET_ADDRESS_CONTAINER:
{
data_address_container& data = arg.get_value<data_address_container>();
data.m_type = type::get<std::nullptr_t>();
data.m_wrapped_type = type::get<std::nullptr_t>();
data.m_data_address = as_void_ptr(raw_addressof(get_value(src_data)));
data.m_data_address_wrapped_type = as_void_ptr(wrapped_raw_addressof(get_value(src_data)));
break;
}
case variant_policy_operation::IS_ASSOCIATIVE_CONTAINER:
{
return false;
}
case variant_policy_operation::IS_SEQUENTIAL_CONTAINER:
{
return false;
}
case variant_policy_operation::CREATE_ASSOCIATIV_VIEW:
{
break;
}
case variant_policy_operation::CREATE_SEQUENTIAL_VIEW:
{
break;
}
case variant_policy_operation::IS_VALID:
{
return true;
}
case variant_policy_operation::IS_NULLPTR:
{
return true;
}
case variant_policy_operation::CONVERT:
{
return false;
}
case variant_policy_operation::COMPARE_EQUAL:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
ok = true;
return rhs.is_nullptr();
}
case variant_policy_operation::COMPARE_LESS:
{
const auto& param = arg.get_value<std::tuple<const variant&, const variant&, bool&>>();
const variant& lhs = std::get<0>(param);
const variant& rhs = std::get<1>(param);
bool& ok = std::get<2>(param);
ok = true;
return (lhs.is_nullptr() && !rhs.is_nullptr());
}
}
return true;
}
template<typename U>
static RTTR_INLINE void create(U&& value, variant_data& dest)
{
new (&dest) std::nullptr_t(std::forward<U>(value));
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// default export, to reduce compile time, and code bloat
template struct RTTR_API variant_data_policy_arithmetic<bool>;
template struct RTTR_API variant_data_policy_arithmetic<char>;
template struct RTTR_API variant_data_policy_arithmetic<float>;
template struct RTTR_API variant_data_policy_arithmetic<double>;
template struct RTTR_API variant_data_policy_arithmetic<std::uint8_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::uint16_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::uint32_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::uint64_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::int8_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::int16_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::int32_t>;
template struct RTTR_API variant_data_policy_arithmetic<std::int64_t>;
template struct RTTR_API variant_data_policy_small<bool*>;
template struct RTTR_API variant_data_policy_small<char*>;
template struct RTTR_API variant_data_policy_small<float*>;
template struct RTTR_API variant_data_policy_small<double*>;
template struct RTTR_API variant_data_policy_small<std::uint8_t*>;
template struct RTTR_API variant_data_policy_small<std::uint16_t*>;
template struct RTTR_API variant_data_policy_small<std::uint32_t*>;
template struct RTTR_API variant_data_policy_small<std::uint64_t*>;
template struct RTTR_API variant_data_policy_small<std::int8_t*>;
template struct RTTR_API variant_data_policy_small<std::int16_t*>;
template struct RTTR_API variant_data_policy_small<std::int32_t*>;
template struct RTTR_API variant_data_policy_small<std::int64_t*>;
/////////////////////////////////////////////////////////////////////////////////////////
} // end namespace detail
} // end namespace rttr
#endif // RTTR_VARIANT_DATA_POLICY_H_
| 38.48249 | 199 | 0.521663 |
9ed5b700f20eca9945b9f7429bd9f8b2938887c8 | 305 | h | C | ChartDemo/Pods/CJCategory/CJCategory/UIImage/UIImage+CJLaunchImage.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | ChartDemo/Pods/CJCategory/CJCategory/UIImage/UIImage+CJLaunchImage.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | ChartDemo/Pods/CJCategory/CJCategory/UIImage/UIImage+CJLaunchImage.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | //
// UIImage+CJLaunchImage.h
// LibraryAndUtilDemo
//
// Created by lichq on 2016/12/14.
// Copyright © 2016年 ciyouzen. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (CJLaunchImage)
+ (UIImage *)cj_LaunchImageDefault;
+ (UIImage *)cj_LaunchImageNamed:(NSString *)name;
@end
| 16.944444 | 52 | 0.711475 |
b1154ffa778741636950affa6945e39c6caecb43 | 27,895 | h | C | pack/Engine/source/T3D/player.h | logicking/GMK | ed1ebd275734777263434396ce8518b65429b5ae | [
"MIT"
] | 3 | 2015-05-30T21:35:07.000Z | 2016-01-10T01:41:48.000Z | T3D/Engine/source/T3D/player.h | logicking/GMK | ed1ebd275734777263434396ce8518b65429b5ae | [
"MIT"
] | null | null | null | T3D/Engine/source/T3D/player.h | logicking/GMK | ed1ebd275734777263434396ce8518b65429b5ae | [
"MIT"
] | 6 | 2015-01-17T21:16:51.000Z | 2018-12-17T22:49:30.000Z | //-----------------------------------------------------------------------------
// Torque
// Copyright GarageGames, LLC 2011
//-----------------------------------------------------------------------------
#ifndef _PLAYER_H_
#define _PLAYER_H_
#ifndef _SHAPEBASE_H_
#include "T3D/shapeBase.h"
#endif
#ifndef _BOXCONVEX_H_
#include "collision/boxConvex.h"
#endif
#include "T3D/gameBase/gameProcess.h"
class Material;
class ParticleEmitter;
class ParticleEmitterData;
class DecalData;
class SplashData;
class PhysicsPlayer;
class Player;
//----------------------------------------------------------------------------
struct PlayerData: public ShapeBaseData {
typedef ShapeBaseData Parent;
enum Constants {
RecoverDelayBits = 7,
JumpDelayBits = 7,
NumSpineNodes = 6,
ImpactBits = 3,
NUM_SPLASH_EMITTERS = 3,
BUBBLE_EMITTER = 2,
};
bool renderFirstPerson; ///< Render the player shape in first person
StringTableEntry imageAnimPrefix; ///< Passed along to mounted images to modify
/// animation sequences played in third person. [optional]
bool allowImageStateAnimation; ///< When true a new thread is added to the player to allow for
/// mounted images to request a sequence be played on the player
/// through the image's state machine. It is only optional so
/// that we don't create a TSThread on the player if we don't
/// need to.
StringTableEntry shapeNameFP[ShapeBase::MaxMountedImages]; ///< Used to render with mounted images in first person [optional]
StringTableEntry imageAnimPrefixFP; ///< Passed along to mounted images to modify
/// animation sequences played in first person. [optional]
Resource<TSShape> mShapeFP[ShapeBase::MaxMountedImages]; ///< First person mounted image shape resources [optional]
U32 mCRCFP[ShapeBase::MaxMountedImages]; ///< Computed CRC values for the first person mounted image shapes
/// Depends on the ShapeBaseData computeCRC field.
bool mValidShapeFP[ShapeBase::MaxMountedImages]; ///< Indicates that there is a valid first person mounted image shape
F32 pickupRadius; ///< Radius around player for items (on server)
F32 maxTimeScale; ///< Max timeScale for action animations
F32 minLookAngle; ///< Lowest angle (radians) the player can look
F32 maxLookAngle; ///< Highest angle (radians) the player can look
F32 maxFreelookAngle; ///< Max left/right angle the player can look
/// @name Physics constants
/// @{
F32 maxStepHeight; ///< Maximum height the player can step up
F32 runSurfaceAngle; ///< Maximum angle from vertical in degrees the player can run up
F32 horizMaxSpeed; ///< Max speed attainable in the horizontal
F32 horizResistSpeed; ///< Speed at which resistance will take place
F32 horizResistFactor; ///< Factor of resistance once horizResistSpeed has been reached
F32 upMaxSpeed; ///< Max vertical speed attainable
F32 upResistSpeed; ///< Speed at which resistance will take place
F32 upResistFactor; ///< Factor of resistance once upResistSpeed has been reached
F32 fallingSpeedThreshold; ///< Downward speed at which we consider the player falling
S32 recoverDelay; ///< # tick
F32 recoverRunForceScale; ///< RunForce multiplier in recover state
F32 landSequenceTime; ///< If greater than 0 then the legacy fall recovery system will be bypassed
/// in favour of just playing the player's land sequence. The time to
/// recover from a fall then becomes this parameter's time and the land
/// sequence's playback will be scaled to match.
bool transitionToLand; ///< When going from a fall to a land, should we transition between the two?
// Running/Walking
F32 runForce; ///< Force used to accelerate player
F32 runEnergyDrain; ///< Energy drain/tick
F32 minRunEnergy; ///< Minimum energy required to run
F32 maxForwardSpeed; ///< Maximum forward speed when running
F32 maxBackwardSpeed; ///< Maximum backward speed when running
F32 maxSideSpeed; ///< Maximum side speed when running
// Jumping
F32 jumpForce; ///< Force exerted per jump
F32 jumpEnergyDrain; ///< Energy drained per jump
F32 minJumpEnergy; ///< Minimum energy required to jump
F32 minJumpSpeed; ///< Minimum speed needed to jump
F32 maxJumpSpeed; ///< Maximum speed before the player can no longer jump
F32 jumpSurfaceAngle; ///< Angle from vertical in degrees where the player can jump
S32 jumpDelay; ///< Delay time in ticks between jumps
// Sprinting
F32 sprintForce; ///< Force used to accelerate player
F32 sprintEnergyDrain; ///< Energy drain/tick
F32 minSprintEnergy; ///< Minimum energy required to sprint
F32 maxSprintForwardSpeed; ///< Maximum forward speed when sprinting
F32 maxSprintBackwardSpeed; ///< Maximum backward speed when sprinting
F32 maxSprintSideSpeed; ///< Maximum side speed when sprinting
F32 sprintStrafeScale; ///< Amount to scale strafing motion vector while sprinting
F32 sprintYawScale; ///< Amount to scale yaw motion while sprinting
F32 sprintPitchScale; ///< Amount to scale pitch motion while sprinting
bool sprintCanJump; ///< Can the player jump while sprinting
// Swimming
F32 swimForce; ///< Force used to accelerate player while swimming
F32 maxUnderwaterForwardSpeed; ///< Maximum underwater forward speed when running
F32 maxUnderwaterBackwardSpeed; ///< Maximum underwater backward speed when running
F32 maxUnderwaterSideSpeed; ///< Maximum underwater side speed when running
// Crouching
F32 crouchForce; ///< Force used to accelerate player while crouching
F32 maxCrouchForwardSpeed; ///< Maximum forward speed when crouching
F32 maxCrouchBackwardSpeed; ///< Maximum backward speed when crouching
F32 maxCrouchSideSpeed; ///< Maximum side speed when crouching
// Prone
F32 proneForce; ///< Force used to accelerate player while prone
F32 maxProneForwardSpeed; ///< Maximum forward speed when prone
F32 maxProneBackwardSpeed; ///< Maximum backward speed when prone
F32 maxProneSideSpeed; ///< Maximum side speed when prone
// Jetting
F32 jetJumpForce;
F32 jetJumpEnergyDrain; ///< Energy per jump
F32 jetMinJumpEnergy;
F32 jetMinJumpSpeed;
F32 jetMaxJumpSpeed;
F32 jetJumpSurfaceAngle; ///< Angle vertical degrees
/// @}
/// @name Hitboxes
/// @{
F32 boxHeadPercentage;
F32 boxTorsoPercentage;
F32 boxHeadLeftPercentage;
F32 boxHeadRightPercentage;
F32 boxHeadBackPercentage;
F32 boxHeadFrontPercentage;
/// @}
F32 minImpactSpeed; ///< Minimum impact speed required to apply fall damage
F32 minLateralImpactSpeed; ///< Minimum impact speed required to apply non-falling damage.
F32 decalOffset;
F32 groundImpactMinSpeed; ///< Minimum impact speed required to apply fall damage with the ground
VectorF groundImpactShakeFreq; ///< Frequency in each direction for the camera to shake
VectorF groundImpactShakeAmp; ///< How much to shake
F32 groundImpactShakeDuration; ///< How long to shake
F32 groundImpactShakeFalloff; ///< How fast the shake disapates
/// Zounds!
enum Sounds {
FootSoft,
FootHard,
FootMetal,
FootSnow,
FootShallowSplash,
FootWading,
FootUnderWater,
FootBubbles,
MoveBubbles,
WaterBreath,
ImpactSoft,
ImpactHard,
ImpactMetal,
ImpactSnow,
ImpactWaterEasy,
ImpactWaterMedium,
ImpactWaterHard,
ExitWater,
MaxSounds
};
SFXTrack* sound[MaxSounds];
Point3F boxSize; ///< Width, depth, height
Point3F crouchBoxSize;
Point3F proneBoxSize;
Point3F swimBoxSize;
/// Animation and other data initialized in onAdd
struct ActionAnimationDef {
const char* name; ///< Sequence name
struct Vector {
F32 x,y,z;
} dir; ///< Default direction
};
struct ActionAnimation {
const char* name; ///< Sequence name
S32 sequence; ///< Sequence index
VectorF dir; ///< Dir of animation ground transform
F32 speed; ///< Speed in m/s
bool velocityScale; ///< Scale animation by velocity
bool death; ///< Are we dying?
};
enum {
// *** WARNING ***
// These enum values are used to index the ActionAnimationList
// array instantiated in player.cc
// The first several are selected in the move state based on velocity
RootAnim,
RunForwardAnim,
BackBackwardAnim,
SideLeftAnim,
SideRightAnim,
SprintRootAnim,
SprintForwardAnim,
SprintBackwardAnim,
SprintLeftAnim,
SprintRightAnim,
CrouchRootAnim,
CrouchForwardAnim,
CrouchBackwardAnim,
CrouchLeftAnim,
CrouchRightAnim,
ProneRootAnim,
ProneForwardAnim,
ProneBackwardAnim,
SwimRootAnim,
SwimForwardAnim,
SwimBackwardAnim,
SwimLeftAnim,
SwimRightAnim,
// These are set explicitly based on player actions
FallAnim,
JumpAnim,
StandJumpAnim,
LandAnim,
JetAnim,
//
NumTableActionAnims = JetAnim + 1,
NumExtraActionAnims = 512 - NumTableActionAnims,
NumActionAnims = NumTableActionAnims + NumExtraActionAnims,
ActionAnimBits = 9,
NullAnimation = (1 << ActionAnimBits) - 1
};
static ActionAnimationDef ActionAnimationList[NumTableActionAnims];
ActionAnimation actionList[NumActionAnims];
U32 actionCount;
U32 lookAction;
S32 spineNode[NumSpineNodes];
S32 pickupDelta; ///< Base off of pcikupRadius
F32 runSurfaceCos; ///< Angle from vertical in cos(runSurfaceAngle)
F32 jumpSurfaceCos; ///< Angle from vertical in cos(jumpSurfaceAngle)
enum Impacts {
ImpactNone,
ImpactNormal,
};
enum Recoil {
LightRecoil,
MediumRecoil,
HeavyRecoil,
NumRecoilSequences
};
S32 recoilSequence[NumRecoilSequences];
/// @name Particles
/// All of the data relating to environmental effects
/// @{
ParticleEmitterData * footPuffEmitter;
S32 footPuffID;
S32 footPuffNumParts;
F32 footPuffRadius;
DecalData* decalData;
S32 decalID;
ParticleEmitterData * dustEmitter;
S32 dustID;
SplashData* splash;
S32 splashId;
F32 splashVelocity;
F32 splashAngle;
F32 splashFreqMod;
F32 splashVelEpsilon;
F32 bubbleEmitTime;
F32 medSplashSoundVel;
F32 hardSplashSoundVel;
F32 exitSplashSoundVel;
F32 footSplashHeight;
// Air control
F32 airControl;
// Jump off surfaces at their normal rather than straight up
bool jumpTowardsNormal;
// For use if/when mPhysicsPlayer is created
StringTableEntry physicsPlayerType;
ParticleEmitterData* splashEmitterList[NUM_SPLASH_EMITTERS];
S32 splashEmitterIDList[NUM_SPLASH_EMITTERS];
/// @}
//
DECLARE_CONOBJECT(PlayerData);
PlayerData();
bool preload(bool server, String &errorStr);
void getGroundInfo(TSShapeInstance*,TSThread*,ActionAnimation*);
bool isTableSequence(S32 seq);
bool isJumpAction(U32 action);
static void initPersistFields();
virtual void packData(BitStream* stream);
virtual void unpackData(BitStream* stream);
/// @name Callbacks
/// @{
DECLARE_CALLBACK( void, onPoseChange, ( Player* obj, const char* oldPose, const char* newPose ) );
DECLARE_CALLBACK( void, onStartSwim, ( Player* obj ) );
DECLARE_CALLBACK( void, onStopSwim, ( Player* obj ) );
DECLARE_CALLBACK( void, onStartSprintMotion, ( Player* obj ) );
DECLARE_CALLBACK( void, onStopSprintMotion, ( Player* obj ) );
DECLARE_CALLBACK( void, doDismount, ( Player* obj ) );
DECLARE_CALLBACK( void, onEnterLiquid, ( Player* obj, F32 coverage, const char* type ) );
DECLARE_CALLBACK( void, onLeaveLiquid, ( Player* obj, const char* type ) );
DECLARE_CALLBACK( void, animationDone, ( Player* obj ) );
DECLARE_CALLBACK( void, onEnterMissionArea, ( Player* obj ) );
DECLARE_CALLBACK( void, onLeaveMissionArea, ( Player* obj ) );
/// @}
};
//----------------------------------------------------------------------------
class Player: public ShapeBase
{
typedef ShapeBase Parent;
public:
enum Pose {
StandPose = 0,
SprintPose,
CrouchPose,
PronePose,
SwimPose,
NumPoseBits = 3
};
protected:
/// Bit masks for different types of events
enum MaskBits {
ActionMask = Parent::NextFreeMask << 0,
MoveMask = Parent::NextFreeMask << 1,
ImpactMask = Parent::NextFreeMask << 2,
NextFreeMask = Parent::NextFreeMask << 3
};
struct Range {
Range(F32 _min,F32 _max) {
min = _min;
max = _max;
delta = _max - _min;
};
F32 min,max;
F32 delta;
};
SimObjectPtr<ParticleEmitter> mSplashEmitter[PlayerData::NUM_SPLASH_EMITTERS];
F32 mBubbleEmitterTime;
/// Client interpolation/warp data
struct StateDelta {
Move move; ///< Last move from server
F32 dt; ///< Last interpolation time
/// @name Interpolation data
/// @{
Point3F pos;
Point3F rot;
Point3F head;
VectorF posVec;
VectorF rotVec;
VectorF headVec;
/// @}
/// @name Warp data
/// @{
S32 warpTicks;
Point3F warpOffset;
Point3F rotOffset;
/// @}
};
StateDelta delta; ///< Used for interpolation on the client. @see StateDelta
S32 mPredictionCount; ///< Number of ticks to predict
// Current pos, vel etc.
Point3F mHead; ///< Head rotation, uses only x & z
Point3F mRot; ///< Body rotation, uses only z
VectorF mVelocity; ///< Velocity
Point3F mAnchorPoint; ///< Pos compression anchor
static F32 mGravity; ///< Gravity
S32 mImpactSound;
bool mUseHeadZCalc; ///< Including mHead.z in transform calculations
S32 mMountPending; ///< mMountPending suppresses tickDelay countdown so players will sit until
///< their mount, or another animation, comes through (or 13 seconds elapses).
/// Main player state
enum ActionState {
NullState,
MoveState,
RecoverState,
NumStateBits = 3
};
ActionState mState; ///< What is the player doing? @see ActionState
bool mFalling; ///< Falling in mid-air?
S32 mJumpDelay; ///< Delay till next jump
Pose mPose;
bool mAllowJumping;
bool mAllowJetJumping;
bool mAllowSprinting;
bool mAllowCrouching;
bool mAllowProne;
bool mAllowSwimming;
S32 mContactTimer; ///< Ticks since last contact
Point3F mJumpSurfaceNormal; ///< Normal of the surface the player last jumped on
U32 mJumpSurfaceLastContact; ///< How long it's been since the player landed (ticks)
F32 mWeaponBackFraction; ///< Amount to slide the weapon back (if it's up against something)
SFXSource* mMoveBubbleSound; ///< Sound for moving bubbles
SFXSource* mWaterBreathSound; ///< Sound for underwater breath
SimObjectPtr<ShapeBase> mControlObject; ///< Controlling object
/// @name Animation threads & data
/// @{
struct ActionAnimation {
U32 action;
TSThread* thread;
S32 delayTicks; // before picking another.
bool forward;
bool firstPerson;
bool waitForEnd;
bool holdAtEnd;
bool animateOnServer;
bool atEnd;
} mActionAnimation;
struct ArmAnimation {
U32 action;
TSThread* thread;
} mArmAnimation;
TSThread* mArmThread;
TSThread* mHeadVThread;
TSThread* mHeadHThread;
TSThread* mRecoilThread;
TSThread* mImageStateThread;
static Range mArmRange;
static Range mHeadVRange;
static Range mHeadHRange;
/// @}
bool mInMissionArea; ///< Are we in the mission area?
//
S32 mRecoverTicks; ///< same as recoverTicks in the player datablock
U32 mReversePending;
F32 mRecoverDelay; ///< When bypassing the legacy recover system and only using the land sequence,
/// this is how long the player will be in the land sequence.
bool mInWater; ///< Is true if WaterCoverage is greater than zero
bool mSwimming; ///< Is true if WaterCoverage is above the swimming threshold
//
PlayerData* mDataBlock; ///< MMmmmmm...datablock...
Point3F mLastPos; ///< Holds the last position for physics updates
Point3F mLastWaterPos; ///< Same as mLastPos, but for water
struct ContactInfo
{
bool contacted, jump, run;
SceneObject *contactObject;
VectorF contactNormal;
void clear()
{
contacted=jump=run=false;
contactObject = NULL;
contactNormal.set(1,1,1);
}
ContactInfo() { clear(); }
} mContactInfo;
struct Death {
F32 lastPos;
Point3F posAdd;
VectorF rotate;
VectorF curNormal;
F32 curSink;
void clear() {dMemset(this, 0, sizeof(*this)); initFall();}
VectorF getPosAdd() {VectorF ret(posAdd); posAdd.set(0,0,0); return ret;}
bool haveVelocity() {return posAdd.x != 0 || posAdd.y != 0;}
void initFall() {curNormal.set(0,0,1); curSink = 0;}
Death() {clear();}
MatrixF* fallToGround(F32 adjust, const Point3F& pos, F32 zrot, F32 boxRad);
} mDeath;
PhysicsPlayer *mPhysicsRep;
// First person mounted image shapes
TSShapeInstance* mShapeFPInstance[ShapeBase::MaxMountedImages];
TSThread *mShapeFPAmbientThread[ShapeBase::MaxMountedImages];
TSThread *mShapeFPVisThread[ShapeBase::MaxMountedImages];
TSThread *mShapeFPAnimThread[ShapeBase::MaxMountedImages];
TSThread *mShapeFPFlashThread[ShapeBase::MaxMountedImages];
TSThread *mShapeFPSpinThread[ShapeBase::MaxMountedImages];
public:
// New collision
OrthoBoxConvex mConvex;
Box3F mWorkingQueryBox;
/// Standing / Crouched / Prone or Swimming
Pose getPose() const { return mPose; }
virtual const char* getPoseName() const;
/// Setting this from script directly might not actually work,
/// This is really just a helper for the player class so that its bounding box
/// will get resized appropriately when the pose changes
void setPose( Pose pose );
PhysicsPlayer* getPhysicsRep() const { return mPhysicsRep; }
protected:
virtual void reSkin();
void setState(ActionState state, U32 ticks=0);
void updateState();
// Jetting
bool mJetting;
///Update the movement
virtual void updateMove(const Move *move);
///Interpolate movement
Point3F _move( const F32 travelTime, Collision *outCol );
F32 _doCollisionImpact( const Collision *collision, bool fallingCollision);
void _handleCollision( const Collision &collision );
virtual bool updatePos(const F32 travelTime = TickSec);
///Update head animation
void updateLookAnimation(F32 dT = 0.f);
///Update other animations
void updateAnimation(F32 dt);
void updateAnimationTree(bool firstPerson);
bool step(Point3F *pos,F32 *maxStep,F32 time);
///See if the player is still in the mission area
void checkMissionArea();
virtual U32 getArmAction() const { return mArmAnimation.action; }
virtual bool setArmThread(U32 action);
virtual void setActionThread(U32 action,bool forward,bool hold = false,bool wait = false,bool fsp = false, bool forceSet = false);
virtual void updateActionThread();
virtual void pickBestMoveAction(U32 startAnim, U32 endAnim, U32 * action, bool * forward) const;
virtual void pickActionAnimation();
/// @name Mounted objects
/// @{
virtual void onUnmount( ShapeBase *obj, S32 node );
virtual void unmount();
/// @}
void setPosition(const Point3F& pos,const Point3F& viewRot);
void setRenderPosition(const Point3F& pos,const Point3F& viewRot,F32 dt=-1);
void _findContact( SceneObject **contactObject, VectorF *contactNormal, Vector<SceneObject*> *outOverlapObjects );
void findContact( bool *run, bool *jump, VectorF *contactNormal );
void buildImagePrefixPaths(String* prefixPaths);
S32 findPrefixSequence(String* prefixPaths, const String& baseSeq);
S32 convertActionToImagePrefix(U32 action);
virtual void onImage(U32 imageSlot, bool unmount);
virtual void onImageRecoil(U32 imageSlot,ShapeBaseImageData::StateData::RecoilState);
virtual void onImageStateAnimation(U32 imageSlot, const char* seqName, bool direction, bool scaleToState, F32 stateTimeOutValue);
virtual const char* getImageAnimPrefix(U32 imageSlot, S32 imageShapeIndex);
virtual void onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState, const char* anim, F32 pos, F32 timeScale, bool reset=false);
virtual void onImageAnimThreadUpdate(U32 imageSlot, S32 imageShapeIndex, F32 dt);
virtual void updateDamageLevel();
virtual void updateDamageState();
/// Set which client is controlling this player
void setControllingClient(GameConnection* client);
void calcClassRenderData();
/// Play sound for foot contact.
///
/// @param triggeredLeft If true, left foot hit; right otherwise.
/// @param contactMaterial Material onto which the player stepped; may be NULL.
/// @param contactObject Object onto which the player stepped; may be NULL.
void playFootstepSound( bool triggeredLeft, Material* contactMaterial, SceneObject* contactObject );
/// Play an impact sound.
void playImpactSound();
/// Are we in the process of dying?
bool inDeathAnim();
F32 deathDelta(Point3F &delta);
void updateDeathOffsets();
bool inSittingAnim();
/// @name Water
/// @{
void updateSplash(); ///< Update the splash effect
void updateFroth( F32 dt ); ///< Update any froth
void updateWaterSounds( F32 dt ); ///< Update water sounds
void createSplash( Point3F &pos, F32 speed ); ///< Creates a splash
bool collidingWithWater( Point3F &waterHeight ); ///< Are we colliding with water?
/// @}
void disableHeadZCalc() { mUseHeadZCalc = false; }
void enableHeadZCalc() { mUseHeadZCalc = true; }
//.logicking
// for AI to handle obstacle avoidance
virtual void wallAvoindance(const VectorF& wallNormal) {}
public:
DECLARE_CONOBJECT(Player);
Player();
~Player();
static void consoleInit();
/// @name Transforms
/// @{
void setTransform(const MatrixF &mat);
void getEyeTransform(MatrixF* mat);
void getEyeBaseTransform(MatrixF* mat);
void getRenderEyeTransform(MatrixF* mat);
void getRenderEyeBaseTransform(MatrixF* mat);
void getCameraParameters(F32 *min, F32 *max, Point3F *offset, MatrixF *rot);
void getMuzzleTransform(U32 imageSlot,MatrixF* mat);
void getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat);
virtual void getMuzzleVector(U32 imageSlot,VectorF* vec);
/// @}
F32 getSpeed() const;
Point3F getVelocity() const;
void setVelocity(const VectorF& vel);
/// Apply an impulse at the given point, with magnitude/direction of vec
void applyImpulse(const Point3F& pos,const VectorF& vec);
/// Get the rotation of the player
const Point3F& getRotation() { return mRot; }
/// Get the rotation of the head of the player
const Point3F& getHeadRotation() { return mHead; }
void getDamageLocation(const Point3F& in_rPos, const char *&out_rpVert, const char *&out_rpQuad);
void allowAllPoses();
void allowJumping(bool state) { mAllowJumping = state; }
void allowJetJumping(bool state) { mAllowJetJumping = state; }
void allowSprinting(bool state) { mAllowSprinting = state; }
void allowCrouching(bool state) { mAllowCrouching = state; }
void allowProne(bool state) { mAllowProne = state; }
void allowSwimming(bool state) { mAllowSwimming = state; }
bool canJump(); ///< Can the player jump?
bool canJetJump(); ///< Can the player jet?
bool canSwim(); ///< Can the player swim?
bool canCrouch();
bool canStand();
bool canProne();
bool canSprint();
bool haveContact() const { return !mContactTimer; } ///< Is it in contact with something
void getMuzzlePointAI( U32 imageSlot, Point3F *point );
F32 getMaxForwardVelocity() const { return (mDataBlock != NULL ? mDataBlock->maxForwardSpeed : 0); }
virtual bool isDisplacable() const;
virtual Point3F getMomentum() const;
virtual void setMomentum(const Point3F &momentum);
virtual bool displaceObject(const Point3F& displaceVector);
virtual bool getAIMove(Move*);
bool checkDismountPosition(const MatrixF& oldPos, const MatrixF& newPos); ///< Is it safe to dismount here?
//
bool onAdd();
void onRemove();
bool onNewDataBlock( GameBaseData *dptr, bool reload );
void onScaleChanged();
Box3F mScaledBox;
// Animation
const char* getStateName();
bool setActionThread(const char* sequence,bool hold,bool wait,bool fsp = false);
const String& getArmThread() const;
bool setArmThread(const char* sequence);
// Object control
void setControlObject(ShapeBase *obj);
ShapeBase* getControlObject();
//
void updateWorkingCollisionSet();
virtual void processTick(const Move *move);
void interpolateTick(F32 delta);
void advanceTime(F32 dt);
bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &sphere);
void buildConvex(const Box3F& box, Convex* convex);
bool isControlObject();
void onCameraScopeQuery(NetConnection *cr, CameraScopeQuery *);
void writePacketData(GameConnection *conn, BitStream *stream);
void readPacketData (GameConnection *conn, BitStream *stream);
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *conn, BitStream *stream);
virtual void prepRenderImage( SceneRenderState* state );
virtual void renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
virtual void renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state );
};
typedef Player::Pose PlayerPose;
DefineEnumType( PlayerPose );
#endif
| 36.51178 | 178 | 0.646424 |
7ff2b3687597166ad1b02dd1cf083e0faf73e100 | 15,173 | h | C | gap8/rtos/pulp/pulp-os/include/rt/rt_event.h | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 118 | 2018-05-22T08:45:59.000Z | 2022-03-30T07:00:45.000Z | gap8/rtos/pulp/pulp-os/include/rt/rt_event.h | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 213 | 2018-07-25T02:37:32.000Z | 2022-03-30T18:04:01.000Z | gap8/rtos/pulp/pulp-os/include/rt/rt_event.h | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 76 | 2018-07-04T08:19:27.000Z | 2022-03-24T09:58:05.000Z | /*
* Copyright (C) 2018 ETH Zurich and University of Bologna
*
* 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.
*/
/*
* Copyright (C) 2018 GreenWaves Technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __RT_RT_EVENT_H__
#define __RT_RT_EVENT_H__
/**
* @ingroup groupKernel
*/
/**
* @defgroup Event Event scheduler
*
* The asynchronous interactions between the fabric controller, the cluster and the peripherals are managed
* with events on the fabric controller side.
*
* An event is a function callback which can be pushed to an event scheduler, for a deferred execution.
* All events in the same scheduler are executed in-order, in a FIFO manner.
*
* In order to manage several levels of event priorities, there may be several event schedulers at the same
* time. The application is entered with one event scheduler already created in the runtime, which is the
* one which can be used as the default scheduler. However the application can then create multiple
* event schedulers in order to build a more complex multi-priority scenario.
*
* Event schedulers are only executed when specific actions are executed by the application. They can
* be either invoked explicitly by calling rt_event_execute or implicitly when for example no thread
* is active and the application is blocked waiting for something.
*
* The pool of events which can be pushed to schedulers must be explicitly managed by the application.
* There is by default no event allocated. They must be first allocated before they can be pushed to
* schedulers. This allows the application to decide the optimal number of events that it needs
* depending on the various actions which can occur.
*
* When a scheduler is invoked, it executes all its pending events, unless the current thread is preempted
* to schedule another thread. To execute an event, it removes it from the queue and executes the associated
* callback with its argument, until the callback returns. This scheduler can not execute any other event
* until the callback has returned.
*
* Each thread is assigned an event scheduler. By default, when a thread is created, it is assigned
* the internal event scheduler. Another scheduler can then be assigned by the application.
* This scheduler is the one implicitly invoked when the thread is calling a blocking operation such
* as waiting for an event.
*/
/**
* @addtogroup Event
* @{
*/
/**@{*/
/** \brief Creates an event scheduler.
*
* This initialize the scheduler and makes it usable. As soon as this function is executed, events can be enqueued to the scheduler.
*
* \param sched Pointer to the scheduler structure. This structure must be allocated by the caller and must be kept allocated until the scheduler is not used anymore.
*/
void rt_event_sched_init(rt_event_sched_t *sched);
/** \brief Allocate new events.
*
* Allocates the specified number of events and put them in the free list. These events can then be reserved through other functions and pushed to the scheduler.
* Note that this function can be called several times in order to add more events to the scheduler.
*
* \param sched The scheduler for which the events are intended to be used. If NULL the default scheduler for the current thread is used.
* \param nb_events The number of events to allocate.
* \return 0 if successfull, 1 otherwise.
*/
int rt_event_alloc(rt_event_sched_t *sched, int nb_events);
/** \brief Free events.
*
* Removes the specified number of events from the free list and frees them.
*
* \param sched The scheduler for which the events must be freed
* \param nb_events The number of events to free.
*/
void rt_event_free(rt_event_sched_t *sched, int nb_events);
/** \brief Reserve an event and set its callback and argument.
*
* This gets an event from the free list and initializes it with the specified callback.
* The event is then ready to be pushed to the scheduler.
*
* \param sched The scheduler for which to get the event for.
* \param callback The function which will be called when the event is executed.
* \param arg The argument of the function callback.
* \return The assigned event if there was at least one available, or NULL if not.
*/
rt_event_t *rt_event_get(rt_event_sched_t *sched, void (*callback)(void *), void *arg);
/** \brief Reserve a permanent event and set its callback and argument.
*
* This gets an event from the free list and initializes it with the specified callback.
* The event is then ready to be pushed to the scheduler.
* Compared to normal events, this one is never released and can be
* reused without being re-allocated, for example for regular actions.
*
* \param sched The scheduler for which to get the event for.
* \param callback The function which will be called when the event is executed.
* \param arg The argument of the function callback.
* \return The assigned event if there was at least one available, or NULL if not.
*/
rt_event_t *rt_event_get_permanent(rt_event_sched_t *sched, void (*callback)(void *), void *arg);
/** \brief Reserve an IRQ event and set its callback and argument.
*
* This gets an IRQ event from the free list and initializes it with the specified callback.
* Contrary to classic events, IRQ events are not meant to be pushed
* to a scheduler, they should instead be used in specific cases
* where an interrupt handler should execute directly the callback
* instead of enqueueing the event to a scheduler.
* These events should be used in very specific cases where it
* is explicitely mentionned they can be used.
*
* \param callback The function which will be called when the event is executed.
* \param arg The argument of the function callback.
* \return The assigned event if there was at least one available, or NULL if not.
*/
static inline rt_event_t *rt_event_irq_get(void (*callback)(void *), void *arg);
/** \brief Reserve an event for blocking wait.
*
* This gets an event from the free list, which can then be used for a blocking wait using
* rt_event_wait.
*
* \param sched The scheduler for which to get the event for.
* \return The assigned event if there was at least one available, or NULL if not.
*/
rt_event_t *rt_event_get_blocking(rt_event_sched_t *sched);
/** \brief Enqueue an event to a scheduler.
*
* This pushes the event to its scheduler, and makes it ready to be executed.
* \param event The event to be pushed.
*/
void rt_event_push(rt_event_t *event);
/** \brief Enqueue a callback to a scheduler.
*
* This pushes a function callback to the specified scheduler. An event is reserved from the scheduler,
* initialized with the callback, and pushed to the scheduler.
*
* \param sched The scheduler to push the callback on.
* \param callback The function which will be called when the event is executed.
* \param arg The argument of the function callback.
* \return 0 if successful, 1 otherwise.
*/
int rt_event_push_callback(rt_event_sched_t *sched, void (*callback)(void *), void *arg);
/** \brief Execute all pending events.
*
* This will invoke the specified scheduler and execute all its pending events. If no
* event is ready when the scheduler is invoked and the wait argument is 1, the calling thread
* is blocked until something happens, otherwise the function just returns.
*
* \param sched The scheduler on which the events are executed.
* \param wait If 1, this will block the calling thread until something happens.
*/
static inline void rt_event_execute(rt_event_sched_t *sched, int wait);
/** \brief Execute pending events.
*
* This will invoke the specified scheduler and execute all its pending events. If no
* event is ready when the scheduler is invoked, the calling thread is blocked until
* something appens.
*
* \param sched The scheduler on which the events are executed.
*/
static inline void rt_event_yield(rt_event_sched_t *sched);
/** \brief Return the internal runtime event scheduler.
*
* This returns the runtime event scheduler which is created at boot time and which can be used
* as a default scheduler.
*
* \return The runtime scheduler.
*/
static inline rt_event_sched_t *rt_event_internal_sched();
/** \brief Set a thread event scheduler.
*
* This sets the event scheduler of the thread, i.e. the event scheduler which is implicitly
* invoked when the thread is blocked waiting for something. This means only events from this
* scheduler will be able to wake-up this thread.
*
* \param thread The thread for which the event scheduler must be set.
* \param sched The new scheduler of the thread.
*/
static inline void rt_event_thread_sched(rt_thread_t *thread, rt_event_sched_t *sched);
/** \brief Block the execution until the event has been triggered.
*
* The event must be a blocking one, allocated through rt_event_get_blocking.
*
* \param event The event to wait for.
*/
void rt_event_wait(rt_event_t *event);
/** \brief Enqueue an event to a scheduler after the specified amount of time.
*
* This first waits that the specified amount of time has passed and then
* pushes the event to its scheduler, and makes it ready to be executed.
* The time is specified in microseconds and is a minimum amount of time. The
* actual time may be bigger due to timer resolution.
*
* \param event The event to be pushed.
* \param time_us The time in microseconds after which the event is pushed to the scheduler.
*/
void rt_event_push_delayed(rt_event_t *event, int time_us);
//!@}
/**
* @} end of Event group
*/
/// @cond IMPLEM
#include "hal/pulp.h"
#include "rt/rt_alloc.h"
extern RT_FC_TINY_DATA rt_event_t *__rt_first_free;
extern rt_event_sched_t __rt_sched;
static inline rt_event_sched_t *__rt_event_get_current_sched()
{
return rt_event_internal_sched();
}
static inline void __rt_event_release(rt_event_t *event)
{
event->next = __rt_first_free;
__rt_first_free = event;
}
static inline rt_event_t *rt_event_irq_get(void (*callback)(void *), void *arg)
{
return (rt_event_t *)((((unsigned int)rt_event_get(NULL, callback, arg)) | 1));
}
void __rt_event_free(rt_event_t *event);
void __rt_sched_event_cancel(rt_event_t *event);
static inline void __rt_event_min_init(rt_event_t *event)
{
event->implem.pending = 0;
event->implem.keep = 0;
}
void __rt_event_init(rt_event_t *event, rt_event_sched_t *sched);
static inline void __rt_event_set_pending(rt_event_t *event)
{
event->implem.pending = 1;
}
static inline void __rt_event_set_keep(rt_event_t *event)
{
event->implem.keep = 1;
}
void __rt_event_execute(rt_event_sched_t *sched, int wait);
void __rt_event_yield(rt_event_sched_t *sched);
static inline void rt_event_execute(rt_event_sched_t *sched, int wait)
{
int irq = rt_irq_disable();
__rt_event_execute(__rt_event_get_current_sched(), wait);
rt_irq_restore(irq);
}
static inline void rt_event_yield(rt_event_sched_t *sched)
{
rt_event_execute(NULL, 1);
}
static inline rt_event_sched_t *rt_event_internal_sched()
{
return &__rt_sched;
}
static inline void rt_event_thread_sched(rt_thread_t *thread, rt_event_sched_t *sched)
{
//if (thread == NULL) thread = __rt_thread_current;
//thread->sched = sched;
}
void __rt_wait_event(rt_event_t *event);
static inline void __rt_wait_event_check(rt_event_t *event, rt_event_t *call_event)
{
if (event == NULL) __rt_wait_event(call_event);
}
static inline void __rt_wait_event_check_irq(rt_event_t *event, rt_event_t *call_event)
{
int irq = rt_irq_disable();
if (event == NULL) __rt_wait_event(call_event);
rt_irq_restore(irq);
}
rt_event_t *__rt_wait_event_prepare_blocking();
static inline rt_event_t *__rt_wait_event_prepare(rt_event_t *event)
{
if (likely(event != NULL)) return event;
return __rt_wait_event_prepare_blocking();
}
static inline void __rt_event_save(rt_event_t *event)
{
event->implem.saved_pending = event->implem.pending;
// The user can still check the event while it is being
// reused. It will also check saved_pending to avoid
// checking the wrong status.
rt_compiler_barrier();
event->implem.saved_callback = (void (*)(void *))event->arg[0];
event->implem.saved_arg = (void *)event->arg[1];
}
static inline void __rt_event_restore(rt_event_t *event)
{
event->implem.pending = event->implem.saved_pending;
event->arg[0] = (uintptr_t)event->implem.saved_callback;
event->arg[1] = (uintptr_t)event->implem.saved_arg;
rt_compiler_barrier();
event->implem.saved_pending = 0;
}
static inline rt_event_t *__rt_init_event(rt_event_t *event, rt_event_sched_t *sched, void (*callback)(void *), void *arg)
{
__rt_event_min_init(event);
event->arg[0] = (uintptr_t)callback;
event->arg[1] = (uintptr_t)arg;
return event;
}
static inline void __rt_event_enqueue(rt_event_t *event)
{
rt_event_sched_t *sched = rt_event_internal_sched();
event->next = NULL;
if (sched->first) {
sched->last->next = event;
} else {
sched->first = event;
}
sched->last = event;
}
void __rt_event_unblock(rt_event_t *event);
static inline void rt_event_enqueue(rt_event_t *event) {
int irq = rt_irq_disable();
__rt_event_enqueue(event);
rt_irq_restore(irq);
}
static inline __attribute__((always_inline)) void __rt_enqueue_event_to_sched(rt_event_sched_t *sched, rt_event_t *event)
{
event->next = NULL;
if (sched->first == NULL) {
sched->first = event;
} else {
sched->last->next = event;
}
sched->last = event;
}
static inline __attribute__((always_inline)) void __rt_push_event(rt_event_sched_t *sched, rt_event_t *event)
{
// Enqueue the event into the scheduler tail
__rt_enqueue_event_to_sched(sched, event);
}
void __rt_event_sched_init();
static inline void __rt_task_init(pi_task_t *task)
{
task->done = 0;
}
static inline void __rt_task_init_from_cluster(pi_task_t *task)
{
task->implem.keep = 1;
}
static inline void __rt_event_handle_end_of_task(pi_task_t *task)
{
rt_event_enqueue(task);
}
/// @endcond
#endif
| 33.420705 | 170 | 0.742964 |
36d45c9cf09cfa220dec1d26ac249bdfecf26546 | 1,588 | h | C | lib/linux-5.18-rc3-smdk/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h | OpenMPDK/SMDK | 8f19d32d999731242cb1ab116a4cb445d9993b15 | [
"BSD-3-Clause"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | releases/hanggai/src/linux-5.18/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h | marmolak/gray486linux | 6403fc9d12cf6e8c6f42213ae287bc1e19b83e60 | [
"BSD-2-Clause"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | releases/hanggai/src/linux-5.18/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h | marmolak/gray486linux | 6403fc9d12cf6e8c6f42213ae287bc1e19b83e60 | [
"BSD-2-Clause"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* IDT RC32434 specific CPU feature overrides
*
* Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
*
* This file was derived from: include/asm-mips/cpu-features.h
* Copyright (C) 2003, 2004 Ralf Baechle
* Copyright (C) 2004 Maciej W. Rozycki
*/
#ifndef __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
#define __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
/*
* The IDT RC32434 SOC has a built-in MIPS 4Kc core.
*/
#define cpu_has_tlb 1
#define cpu_has_4kex 1
#define cpu_has_3k_cache 0
#define cpu_has_4k_cache 1
#define cpu_has_sb1_cache 0
#define cpu_has_fpu 0
#define cpu_has_32fpr 0
#define cpu_has_counter 1
#define cpu_has_watch 1
#define cpu_has_divec 1
#define cpu_has_vce 0
#define cpu_has_cache_cdex_p 0
#define cpu_has_cache_cdex_s 0
#define cpu_has_prefetch 1
#define cpu_has_mcheck 1
#define cpu_has_ejtag 1
#define cpu_has_llsc 1
#define cpu_has_mips16 0
#define cpu_has_mips16e2 0
#define cpu_has_mdmx 0
#define cpu_has_mips3d 0
#define cpu_has_smartmips 0
#define cpu_has_vtag_icache 0
#define cpu_has_mips32r1 1
#define cpu_has_mips32r2 0
#define cpu_has_mips64r1 0
#define cpu_has_mips64r2 0
#define cpu_has_dsp 0
#define cpu_has_dsp2 0
#define cpu_has_mipsmt 0
/* #define cpu_has_nofpuex ? */
#define cpu_has_64bits 0
#define cpu_has_64bit_zero_reg 0
#define cpu_has_64bit_gp_regs 0
#define cpu_has_inclusive_pcaches 0
#define cpu_dcache_line_size() 16
#define cpu_icache_line_size() 16
#endif /* __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H */
| 25.206349 | 63 | 0.777708 |
9a4ba97d9fd2b93e3bc00b8ad0c6f40cc438101a | 27,651 | h | C | include/bricklet_barometer_v2.h | davidplotzki/sensorlogger | 8ee255fba5f8560650e2b79fc967aeec8d8ec7b7 | [
"MIT"
] | null | null | null | include/bricklet_barometer_v2.h | davidplotzki/sensorlogger | 8ee255fba5f8560650e2b79fc967aeec8d8ec7b7 | [
"MIT"
] | null | null | null | include/bricklet_barometer_v2.h | davidplotzki/sensorlogger | 8ee255fba5f8560650e2b79fc967aeec8d8ec7b7 | [
"MIT"
] | null | null | null | /* ***********************************************************
* This file was automatically generated on 2021-05-06. *
* *
* C/C++ Bindings Version 2.1.32 *
* *
* If you have a bugfix for this file and want to commit it, *
* please fix the bug in the generator. You can find a link *
* to the generators git repository on tinkerforge.com *
*************************************************************/
#ifndef BRICKLET_BAROMETER_V2_H
#define BRICKLET_BAROMETER_V2_H
#include "ip_connection.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup BrickletBarometerV2 Barometer Bricklet 2.0
*/
/**
* \ingroup BrickletBarometerV2
*
* Measures air pressure and altitude changes
*/
typedef Device BarometerV2;
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_AIR_PRESSURE 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION 3
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_ALTITUDE 5
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION 6
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION 7
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_TEMPERATURE 9
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION 10
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION 11
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION 13
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION 14
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_REFERENCE_AIR_PRESSURE 15
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_REFERENCE_AIR_PRESSURE 16
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_CALIBRATION 17
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_CALIBRATION 18
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_SENSOR_CONFIGURATION 19
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_SENSOR_CONFIGURATION 20
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_SPITFP_ERROR_COUNT 234
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_BOOTLOADER_MODE 235
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_BOOTLOADER_MODE 236
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_WRITE_FIRMWARE_POINTER 237
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_WRITE_FIRMWARE 238
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_SET_STATUS_LED_CONFIG 239
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_STATUS_LED_CONFIG 240
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_CHIP_TEMPERATURE 242
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_RESET 243
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_WRITE_UID 248
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_READ_UID 249
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_FUNCTION_GET_IDENTITY 255
/**
* \ingroup BrickletBarometerV2
*
* Signature: \code void callback(int32_t air_pressure, void *user_data) \endcode
*
* This callback is triggered periodically according to the configuration set by
* {@link barometer_v2_set_air_pressure_callback_configuration}.
*
* The parameter is the same as {@link barometer_v2_get_air_pressure}.
*/
#define BAROMETER_V2_CALLBACK_AIR_PRESSURE 4
/**
* \ingroup BrickletBarometerV2
*
* Signature: \code void callback(int32_t altitude, void *user_data) \endcode
*
* This callback is triggered periodically according to the configuration set by
* {@link barometer_v2_set_altitude_callback_configuration}.
*
* The parameter is the same as {@link barometer_v2_get_altitude}.
*/
#define BAROMETER_V2_CALLBACK_ALTITUDE 8
/**
* \ingroup BrickletBarometerV2
*
* Signature: \code void callback(int32_t temperature, void *user_data) \endcode
*
* This callback is triggered periodically according to the configuration set by
* {@link barometer_v2_set_temperature_callback_configuration}.
*
* The parameter is the same as {@link barometer_v2_get_temperature}.
*/
#define BAROMETER_V2_CALLBACK_TEMPERATURE 12
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_THRESHOLD_OPTION_OFF 'x'
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_THRESHOLD_OPTION_OUTSIDE 'o'
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_THRESHOLD_OPTION_INSIDE 'i'
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_THRESHOLD_OPTION_SMALLER '<'
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_THRESHOLD_OPTION_GREATER '>'
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_OFF 0
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_1HZ 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_10HZ 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_25HZ 3
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_50HZ 4
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_DATA_RATE_75HZ 5
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_LOW_PASS_FILTER_OFF 0
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_LOW_PASS_FILTER_1_9TH 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_LOW_PASS_FILTER_1_20TH 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_MODE_BOOTLOADER 0
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_MODE_FIRMWARE 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT 3
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT 4
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_OK 0
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_INVALID_MODE 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_NO_CHANGE 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT 3
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT 4
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_BOOTLOADER_STATUS_CRC_MISMATCH 5
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_STATUS_LED_CONFIG_OFF 0
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_STATUS_LED_CONFIG_ON 1
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_STATUS_LED_CONFIG_SHOW_HEARTBEAT 2
/**
* \ingroup BrickletBarometerV2
*/
#define BAROMETER_V2_STATUS_LED_CONFIG_SHOW_STATUS 3
/**
* \ingroup BrickletBarometerV2
*
* This constant is used to identify a Barometer Bricklet 2.0.
*
* The {@link barometer_v2_get_identity} function and the
* {@link IPCON_CALLBACK_ENUMERATE} callback of the IP Connection have a
* \c device_identifier parameter to specify the Brick's or Bricklet's type.
*/
#define BAROMETER_V2_DEVICE_IDENTIFIER 2117
/**
* \ingroup BrickletBarometerV2
*
* This constant represents the display name of a Barometer Bricklet 2.0.
*/
#define BAROMETER_V2_DEVICE_DISPLAY_NAME "Barometer Bricklet 2.0"
/**
* \ingroup BrickletBarometerV2
*
* Creates the device object \c barometer_v2 with the unique device ID \c uid and adds
* it to the IPConnection \c ipcon.
*/
void barometer_v2_create(BarometerV2 *barometer_v2, const char *uid, IPConnection *ipcon);
/**
* \ingroup BrickletBarometerV2
*
* Removes the device object \c barometer_v2 from its IPConnection and destroys it.
* The device object cannot be used anymore afterwards.
*/
void barometer_v2_destroy(BarometerV2 *barometer_v2);
/**
* \ingroup BrickletBarometerV2
*
* Returns the response expected flag for the function specified by the
* \c function_id parameter. It is *true* if the function is expected to
* send a response, *false* otherwise.
*
* For getter functions this is enabled by default and cannot be disabled,
* because those functions will always send a response. For callback
* configuration functions it is enabled by default too, but can be disabled
* via the barometer_v2_set_response_expected function. For setter functions it is
* disabled by default and can be enabled.
*
* Enabling the response expected flag for a setter function allows to
* detect timeouts and other error conditions calls of this setter as well.
* The device will then send a response for this purpose. If this flag is
* disabled for a setter function then no response is sent and errors are
* silently ignored, because they cannot be detected.
*/
int barometer_v2_get_response_expected(BarometerV2 *barometer_v2, uint8_t function_id, bool *ret_response_expected);
/**
* \ingroup BrickletBarometerV2
*
* Changes the response expected flag of the function specified by the
* \c function_id parameter. This flag can only be changed for setter
* (default value: *false*) and callback configuration functions
* (default value: *true*). For getter functions it is always enabled.
*
* Enabling the response expected flag for a setter function allows to detect
* timeouts and other error conditions calls of this setter as well. The device
* will then send a response for this purpose. If this flag is disabled for a
* setter function then no response is sent and errors are silently ignored,
* because they cannot be detected.
*/
int barometer_v2_set_response_expected(BarometerV2 *barometer_v2, uint8_t function_id, bool response_expected);
/**
* \ingroup BrickletBarometerV2
*
* Changes the response expected flag for all setter and callback configuration
* functions of this device at once.
*/
int barometer_v2_set_response_expected_all(BarometerV2 *barometer_v2, bool response_expected);
/**
* \ingroup BrickletBarometerV2
*
* Registers the given \c function with the given \c callback_id. The
* \c user_data will be passed as the last parameter to the \c function.
*/
void barometer_v2_register_callback(BarometerV2 *barometer_v2, int16_t callback_id, void (*function)(void), void *user_data);
/**
* \ingroup BrickletBarometerV2
*
* Returns the API version (major, minor, release) of the bindings for this
* device.
*/
int barometer_v2_get_api_version(BarometerV2 *barometer_v2, uint8_t ret_api_version[3]);
/**
* \ingroup BrickletBarometerV2
*
* Returns the measured air pressure.
*
*
* If you want to get the value periodically, it is recommended to use the
* {@link BAROMETER_V2_CALLBACK_AIR_PRESSURE} callback. You can set the callback configuration
* with {@link barometer_v2_set_air_pressure_callback_configuration}.
*/
int barometer_v2_get_air_pressure(BarometerV2 *barometer_v2, int32_t *ret_air_pressure);
/**
* \ingroup BrickletBarometerV2
*
* The period is the period with which the {@link BAROMETER_V2_CALLBACK_AIR_PRESSURE} callback is triggered
* periodically. A value of 0 turns the callback off.
*
* If the `value has to change`-parameter is set to true, the callback is only
* triggered after the value has changed. If the value didn't change
* within the period, the callback is triggered immediately on change.
*
* If it is set to false, the callback is continuously triggered with the period,
* independent of the value.
*
* It is furthermore possible to constrain the callback with thresholds.
*
* The `option`-parameter together with min/max sets a threshold for the {@link BAROMETER_V2_CALLBACK_AIR_PRESSURE} callback.
*
* The following options are possible:
*
* \verbatim
* "Option", "Description"
*
* "'x'", "Threshold is turned off"
* "'o'", "Threshold is triggered when the value is *outside* the min and max values"
* "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
* "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
* "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
* \endverbatim
*
* If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
*/
int barometer_v2_set_air_pressure_callback_configuration(BarometerV2 *barometer_v2, uint32_t period, bool value_has_to_change, char option, int32_t min, int32_t max);
/**
* \ingroup BrickletBarometerV2
*
* Returns the callback configuration as set by {@link barometer_v2_set_air_pressure_callback_configuration}.
*/
int barometer_v2_get_air_pressure_callback_configuration(BarometerV2 *barometer_v2, uint32_t *ret_period, bool *ret_value_has_to_change, char *ret_option, int32_t *ret_min, int32_t *ret_max);
/**
* \ingroup BrickletBarometerV2
*
* Returns the relative altitude of the air pressure sensor. The value
* is calculated based on the difference between the
* current air pressure and the reference air pressure that can be set
* with {@link barometer_v2_set_reference_air_pressure}.
*
*
* If you want to get the value periodically, it is recommended to use the
* {@link BAROMETER_V2_CALLBACK_ALTITUDE} callback. You can set the callback configuration
* with {@link barometer_v2_set_altitude_callback_configuration}.
*/
int barometer_v2_get_altitude(BarometerV2 *barometer_v2, int32_t *ret_altitude);
/**
* \ingroup BrickletBarometerV2
*
* The period is the period with which the {@link BAROMETER_V2_CALLBACK_ALTITUDE} callback is triggered
* periodically. A value of 0 turns the callback off.
*
* If the `value has to change`-parameter is set to true, the callback is only
* triggered after the value has changed. If the value didn't change
* within the period, the callback is triggered immediately on change.
*
* If it is set to false, the callback is continuously triggered with the period,
* independent of the value.
*
* It is furthermore possible to constrain the callback with thresholds.
*
* The `option`-parameter together with min/max sets a threshold for the {@link BAROMETER_V2_CALLBACK_ALTITUDE} callback.
*
* The following options are possible:
*
* \verbatim
* "Option", "Description"
*
* "'x'", "Threshold is turned off"
* "'o'", "Threshold is triggered when the value is *outside* the min and max values"
* "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
* "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
* "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
* \endverbatim
*
* If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
*/
int barometer_v2_set_altitude_callback_configuration(BarometerV2 *barometer_v2, uint32_t period, bool value_has_to_change, char option, int32_t min, int32_t max);
/**
* \ingroup BrickletBarometerV2
*
* Returns the callback configuration as set by {@link barometer_v2_set_altitude_callback_configuration}.
*/
int barometer_v2_get_altitude_callback_configuration(BarometerV2 *barometer_v2, uint32_t *ret_period, bool *ret_value_has_to_change, char *ret_option, int32_t *ret_min, int32_t *ret_max);
/**
* \ingroup BrickletBarometerV2
*
* Returns the temperature of the air pressure sensor.
*
* This temperature is used internally for temperature compensation
* of the air pressure measurement. It is not as accurate as the
* temperature measured by the :ref:`temperature_v2_bricklet` or the
* :ref:`temperature_ir_v2_bricklet`.
*
*
* If you want to get the value periodically, it is recommended to use the
* {@link BAROMETER_V2_CALLBACK_TEMPERATURE} callback. You can set the callback configuration
* with {@link barometer_v2_set_temperature_callback_configuration}.
*/
int barometer_v2_get_temperature(BarometerV2 *barometer_v2, int32_t *ret_temperature);
/**
* \ingroup BrickletBarometerV2
*
* The period is the period with which the {@link BAROMETER_V2_CALLBACK_TEMPERATURE} callback is triggered
* periodically. A value of 0 turns the callback off.
*
* If the `value has to change`-parameter is set to true, the callback is only
* triggered after the value has changed. If the value didn't change
* within the period, the callback is triggered immediately on change.
*
* If it is set to false, the callback is continuously triggered with the period,
* independent of the value.
*
* It is furthermore possible to constrain the callback with thresholds.
*
* The `option`-parameter together with min/max sets a threshold for the {@link BAROMETER_V2_CALLBACK_TEMPERATURE} callback.
*
* The following options are possible:
*
* \verbatim
* "Option", "Description"
*
* "'x'", "Threshold is turned off"
* "'o'", "Threshold is triggered when the value is *outside* the min and max values"
* "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
* "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
* "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
* \endverbatim
*
* If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
*/
int barometer_v2_set_temperature_callback_configuration(BarometerV2 *barometer_v2, uint32_t period, bool value_has_to_change, char option, int32_t min, int32_t max);
/**
* \ingroup BrickletBarometerV2
*
* Returns the callback configuration as set by {@link barometer_v2_set_temperature_callback_configuration}.
*/
int barometer_v2_get_temperature_callback_configuration(BarometerV2 *barometer_v2, uint32_t *ret_period, bool *ret_value_has_to_change, char *ret_option, int32_t *ret_min, int32_t *ret_max);
/**
* \ingroup BrickletBarometerV2
*
* Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
* for the air pressure and temperature measurements.
*
* Setting the length to 1 will turn the averaging off. With less
* averaging, there is more noise on the data.
*
* If you want to do long term measurements the longest moving average will give
* the cleanest results.
*/
int barometer_v2_set_moving_average_configuration(BarometerV2 *barometer_v2, uint16_t moving_average_length_air_pressure, uint16_t moving_average_length_temperature);
/**
* \ingroup BrickletBarometerV2
*
* Returns the moving average configuration as set by
* {@link barometer_v2_set_moving_average_configuration}.
*/
int barometer_v2_get_moving_average_configuration(BarometerV2 *barometer_v2, uint16_t *ret_moving_average_length_air_pressure, uint16_t *ret_moving_average_length_temperature);
/**
* \ingroup BrickletBarometerV2
*
* Sets the reference air pressure for the altitude calculation.
* Setting the reference to the
* current air pressure results in a calculated altitude of 0mm. Passing 0 is
* a shortcut for passing the current air pressure as reference.
*
* Well known reference values are the Q codes
* `QNH <https://en.wikipedia.org/wiki/QNH>`__ and
* `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
* used in aviation.
*/
int barometer_v2_set_reference_air_pressure(BarometerV2 *barometer_v2, int32_t air_pressure);
/**
* \ingroup BrickletBarometerV2
*
* Returns the reference air pressure as set by {@link barometer_v2_set_reference_air_pressure}.
*/
int barometer_v2_get_reference_air_pressure(BarometerV2 *barometer_v2, int32_t *ret_air_pressure);
/**
* \ingroup BrickletBarometerV2
*
* Sets the one point calibration (OPC) values for the air pressure measurement.
*
* Before the Bricklet can be calibrated any previous calibration has to be removed
* by setting ``measured air pressure`` and ``actual air pressure`` to 0.
*
* Then the current air pressure has to be measured using the Bricklet
* (``measured air pressure``) and with an accurate reference barometer
* (``actual air pressure``) at the same time and passed to this function.
*
* After proper calibration the air pressure measurement can achieve an accuracy
* up to 0.2 hPa.
*
* The calibration is saved in the EEPROM of the Bricklet and only needs to be
* configured once.
*/
int barometer_v2_set_calibration(BarometerV2 *barometer_v2, int32_t measured_air_pressure, int32_t actual_air_pressure);
/**
* \ingroup BrickletBarometerV2
*
* Returns the air pressure one point calibration values as set by
* {@link barometer_v2_set_calibration}.
*/
int barometer_v2_get_calibration(BarometerV2 *barometer_v2, int32_t *ret_measured_air_pressure, int32_t *ret_actual_air_pressure);
/**
* \ingroup BrickletBarometerV2
*
* Configures the data rate and air pressure low pass filter. The low pass filter
* cut-off frequency (if enabled) can be set to 1/9th or 1/20th of the configure
* data rate to decrease the noise on the air pressure data.
*
* The low pass filter configuration only applies to the air pressure measurement.
* There is no low pass filter for the temperature measurement.
*
* A higher data rate will result in a less precise temperature because of
* self-heating of the sensor. If the accuracy of the temperature reading is
* important to you, we would recommend the 1Hz data rate.
*/
int barometer_v2_set_sensor_configuration(BarometerV2 *barometer_v2, uint8_t data_rate, uint8_t air_pressure_low_pass_filter);
/**
* \ingroup BrickletBarometerV2
*
* Returns the sensor configuration as set by {@link barometer_v2_set_sensor_configuration}.
*/
int barometer_v2_get_sensor_configuration(BarometerV2 *barometer_v2, uint8_t *ret_data_rate, uint8_t *ret_air_pressure_low_pass_filter);
/**
* \ingroup BrickletBarometerV2
*
* Returns the error count for the communication between Brick and Bricklet.
*
* The errors are divided into
*
* * ACK checksum errors,
* * message checksum errors,
* * framing errors and
* * overflow errors.
*
* The errors counts are for errors that occur on the Bricklet side. All
* Bricks have a similar function that returns the errors on the Brick side.
*/
int barometer_v2_get_spitfp_error_count(BarometerV2 *barometer_v2, uint32_t *ret_error_count_ack_checksum, uint32_t *ret_error_count_message_checksum, uint32_t *ret_error_count_frame, uint32_t *ret_error_count_overflow);
/**
* \ingroup BrickletBarometerV2
*
* Sets the bootloader mode and returns the status after the requested
* mode change was instigated.
*
* You can change from bootloader mode to firmware mode and vice versa. A change
* from bootloader mode to firmware mode will only take place if the entry function,
* device identifier and CRC are present and correct.
*
* This function is used by Brick Viewer during flashing. It should not be
* necessary to call it in a normal user program.
*/
int barometer_v2_set_bootloader_mode(BarometerV2 *barometer_v2, uint8_t mode, uint8_t *ret_status);
/**
* \ingroup BrickletBarometerV2
*
* Returns the current bootloader mode, see {@link barometer_v2_set_bootloader_mode}.
*/
int barometer_v2_get_bootloader_mode(BarometerV2 *barometer_v2, uint8_t *ret_mode);
/**
* \ingroup BrickletBarometerV2
*
* Sets the firmware pointer for {@link barometer_v2_write_firmware}. The pointer has
* to be increased by chunks of size 64. The data is written to flash
* every 4 chunks (which equals to one page of size 256).
*
* This function is used by Brick Viewer during flashing. It should not be
* necessary to call it in a normal user program.
*/
int barometer_v2_set_write_firmware_pointer(BarometerV2 *barometer_v2, uint32_t pointer);
/**
* \ingroup BrickletBarometerV2
*
* Writes 64 Bytes of firmware at the position as written by
* {@link barometer_v2_set_write_firmware_pointer} before. The firmware is written
* to flash every 4 chunks.
*
* You can only write firmware in bootloader mode.
*
* This function is used by Brick Viewer during flashing. It should not be
* necessary to call it in a normal user program.
*/
int barometer_v2_write_firmware(BarometerV2 *barometer_v2, uint8_t data[64], uint8_t *ret_status);
/**
* \ingroup BrickletBarometerV2
*
* Sets the status LED configuration. By default the LED shows
* communication traffic between Brick and Bricklet, it flickers once
* for every 10 received data packets.
*
* You can also turn the LED permanently on/off or show a heartbeat.
*
* If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
*/
int barometer_v2_set_status_led_config(BarometerV2 *barometer_v2, uint8_t config);
/**
* \ingroup BrickletBarometerV2
*
* Returns the configuration as set by {@link barometer_v2_set_status_led_config}
*/
int barometer_v2_get_status_led_config(BarometerV2 *barometer_v2, uint8_t *ret_config);
/**
* \ingroup BrickletBarometerV2
*
* Returns the temperature as measured inside the microcontroller. The
* value returned is not the ambient temperature!
*
* The temperature is only proportional to the real temperature and it has bad
* accuracy. Practically it is only useful as an indicator for
* temperature changes.
*/
int barometer_v2_get_chip_temperature(BarometerV2 *barometer_v2, int16_t *ret_temperature);
/**
* \ingroup BrickletBarometerV2
*
* Calling this function will reset the Bricklet. All configurations
* will be lost.
*
* After a reset you have to create new device objects,
* calling functions on the existing ones will result in
* undefined behavior!
*/
int barometer_v2_reset(BarometerV2 *barometer_v2);
/**
* \ingroup BrickletBarometerV2
*
* Writes a new UID into flash. If you want to set a new UID
* you have to decode the Base58 encoded UID string into an
* integer first.
*
* We recommend that you use Brick Viewer to change the UID.
*/
int barometer_v2_write_uid(BarometerV2 *barometer_v2, uint32_t uid);
/**
* \ingroup BrickletBarometerV2
*
* Returns the current UID as an integer. Encode as
* Base58 to get the usual string version.
*/
int barometer_v2_read_uid(BarometerV2 *barometer_v2, uint32_t *ret_uid);
/**
* \ingroup BrickletBarometerV2
*
* Returns the UID, the UID where the Bricklet is connected to,
* the position, the hardware and firmware version as well as the
* device identifier.
*
* The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
* A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
* position 'z'.
*
* The device identifier numbers can be found :ref:`here <device_identifier>`.
* |device_identifier_constant|
*/
int barometer_v2_get_identity(BarometerV2 *barometer_v2, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier);
#ifdef __cplusplus
}
#endif
#endif
| 32.114983 | 220 | 0.762757 |
2cf39e6d519d58c6724e73e38d6e27fcbaa9db30 | 6,805 | c | C | drivers/video/backlight/ili9320.c | fergy/aplit_linux-5 | a6ef4cb0e17e1eec9743c064e65f730c49765711 | [
"MIT"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | drivers/video/backlight/ili9320.c | fergy/aplit_linux-5 | a6ef4cb0e17e1eec9743c064e65f730c49765711 | [
"MIT"
] | 5 | 2020-04-04T09:24:09.000Z | 2020-04-19T12:33:55.000Z | drivers/video/backlight/ili9320.c | fergy/aplit_linux-5 | a6ef4cb0e17e1eec9743c064e65f730c49765711 | [
"MIT"
] | 30 | 2018-05-02T08:43:27.000Z | 2022-01-23T03:25:54.000Z | /* drivers/video/backlight/ili9320.c
*
* ILI9320 LCD controller driver core.
*
* Copyright 2007 Simtec Electronics
* http://armlinux.simtec.co.uk/
* Ben Dooks <ben@simtec.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/lcd.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <video/ili9320.h>
#include "ili9320.h"
static inline int ili9320_write_spi(struct ili9320 *ili,
unsigned int reg,
unsigned int value)
{
struct ili9320_spi *spi = &ili->access.spi;
unsigned char *addr = spi->buffer_addr;
unsigned char *data = spi->buffer_data;
/* spi message consits of:
* first byte: ID and operation
*/
addr[0] = spi->id | ILI9320_SPI_INDEX | ILI9320_SPI_WRITE;
addr[1] = reg >> 8;
addr[2] = reg;
/* second message is the data to transfer */
data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE;
data[1] = value >> 8;
data[2] = value;
return spi_sync(spi->dev, &spi->message);
}
int ili9320_write(struct ili9320 *ili, unsigned int reg, unsigned int value)
{
dev_dbg(ili->dev, "write: reg=%02x, val=%04x\n", reg, value);
return ili->write(ili, reg, value);
}
EXPORT_SYMBOL_GPL(ili9320_write);
int ili9320_write_regs(struct ili9320 *ili,
const struct ili9320_reg *values,
int nr_values)
{
int index;
int ret;
for (index = 0; index < nr_values; index++, values++) {
ret = ili9320_write(ili, values->address, values->value);
if (ret != 0)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(ili9320_write_regs);
static void ili9320_reset(struct ili9320 *lcd)
{
struct ili9320_platdata *cfg = lcd->platdata;
cfg->reset(1);
mdelay(50);
cfg->reset(0);
mdelay(50);
cfg->reset(1);
mdelay(100);
}
static inline int ili9320_init_chip(struct ili9320 *lcd)
{
int ret;
ili9320_reset(lcd);
ret = lcd->client->init(lcd, lcd->platdata);
if (ret != 0) {
dev_err(lcd->dev, "failed to initialise display\n");
return ret;
}
lcd->initialised = 1;
return 0;
}
static inline int ili9320_power_on(struct ili9320 *lcd)
{
if (!lcd->initialised)
ili9320_init_chip(lcd);
lcd->display1 |= (ILI9320_DISPLAY1_D(3) | ILI9320_DISPLAY1_BASEE);
ili9320_write(lcd, ILI9320_DISPLAY1, lcd->display1);
return 0;
}
static inline int ili9320_power_off(struct ili9320 *lcd)
{
lcd->display1 &= ~(ILI9320_DISPLAY1_D(3) | ILI9320_DISPLAY1_BASEE);
ili9320_write(lcd, ILI9320_DISPLAY1, lcd->display1);
return 0;
}
#define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL)
static int ili9320_power(struct ili9320 *lcd, int power)
{
int ret = 0;
dev_dbg(lcd->dev, "power %d => %d\n", lcd->power, power);
if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power))
ret = ili9320_power_on(lcd);
else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power))
ret = ili9320_power_off(lcd);
if (ret == 0)
lcd->power = power;
else
dev_warn(lcd->dev, "failed to set power mode %d\n", power);
return ret;
}
static inline struct ili9320 *to_our_lcd(struct lcd_device *lcd)
{
return lcd_get_data(lcd);
}
static int ili9320_set_power(struct lcd_device *ld, int power)
{
struct ili9320 *lcd = to_our_lcd(ld);
return ili9320_power(lcd, power);
}
static int ili9320_get_power(struct lcd_device *ld)
{
struct ili9320 *lcd = to_our_lcd(ld);
return lcd->power;
}
static struct lcd_ops ili9320_ops = {
.get_power = ili9320_get_power,
.set_power = ili9320_set_power,
};
static void ili9320_setup_spi(struct ili9320 *ili,
struct spi_device *dev)
{
struct ili9320_spi *spi = &ili->access.spi;
ili->write = ili9320_write_spi;
spi->dev = dev;
/* fill the two messages we are going to use to send the data
* with, the first the address followed by the data. The datasheet
* says they should be done as two distinct cycles of the SPI CS line.
*/
spi->xfer[0].tx_buf = spi->buffer_addr;
spi->xfer[1].tx_buf = spi->buffer_data;
spi->xfer[0].len = 3;
spi->xfer[1].len = 3;
spi->xfer[0].bits_per_word = 8;
spi->xfer[1].bits_per_word = 8;
spi->xfer[0].cs_change = 1;
spi_message_init(&spi->message);
spi_message_add_tail(&spi->xfer[0], &spi->message);
spi_message_add_tail(&spi->xfer[1], &spi->message);
}
int ili9320_probe_spi(struct spi_device *spi,
struct ili9320_client *client)
{
struct ili9320_platdata *cfg = dev_get_platdata(&spi->dev);
struct device *dev = &spi->dev;
struct ili9320 *ili;
struct lcd_device *lcd;
int ret = 0;
/* verify we where given some information */
if (cfg == NULL) {
dev_err(dev, "no platform data supplied\n");
return -EINVAL;
}
if (cfg->hsize <= 0 || cfg->vsize <= 0 || cfg->reset == NULL) {
dev_err(dev, "invalid platform data supplied\n");
return -EINVAL;
}
/* allocate and initialse our state */
ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL);
if (ili == NULL)
return -ENOMEM;
ili->access.spi.id = ILI9320_SPI_IDCODE | ILI9320_SPI_ID(1);
ili->dev = dev;
ili->client = client;
ili->power = FB_BLANK_POWERDOWN;
ili->platdata = cfg;
spi_set_drvdata(spi, ili);
ili9320_setup_spi(ili, spi);
lcd = devm_lcd_device_register(&spi->dev, "ili9320", dev, ili,
&ili9320_ops);
if (IS_ERR(lcd)) {
dev_err(dev, "failed to register lcd device\n");
return PTR_ERR(lcd);
}
ili->lcd = lcd;
dev_info(dev, "initialising %s\n", client->name);
ret = ili9320_power(ili, FB_BLANK_UNBLANK);
if (ret != 0) {
dev_err(dev, "failed to set lcd power state\n");
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(ili9320_probe_spi);
int ili9320_remove(struct ili9320 *ili)
{
ili9320_power(ili, FB_BLANK_POWERDOWN);
return 0;
}
EXPORT_SYMBOL_GPL(ili9320_remove);
#ifdef CONFIG_PM_SLEEP
int ili9320_suspend(struct ili9320 *lcd)
{
int ret;
ret = ili9320_power(lcd, FB_BLANK_POWERDOWN);
if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) {
ili9320_write(lcd, ILI9320_POWER1, lcd->power1 |
ILI9320_POWER1_SLP |
ILI9320_POWER1_DSTB);
lcd->initialised = 0;
}
return ret;
}
EXPORT_SYMBOL_GPL(ili9320_suspend);
int ili9320_resume(struct ili9320 *lcd)
{
dev_info(lcd->dev, "resuming from power state %d\n", lcd->power);
if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP)
ili9320_write(lcd, ILI9320_POWER1, 0x00);
return ili9320_power(lcd, FB_BLANK_UNBLANK);
}
EXPORT_SYMBOL_GPL(ili9320_resume);
#endif
/* Power down all displays on reboot, poweroff or halt */
void ili9320_shutdown(struct ili9320 *lcd)
{
ili9320_power(lcd, FB_BLANK_POWERDOWN);
}
EXPORT_SYMBOL_GPL(ili9320_shutdown);
MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
MODULE_DESCRIPTION("ILI9320 LCD Driver");
MODULE_LICENSE("GPL v2");
| 22.384868 | 76 | 0.703012 |
fdc7048cae7e962e5a7e91489a862de05f342928 | 206 | h | C | dfb/DWduifubao/MyPage/spectrumVC.h | kunlingyijia/DKFKB | b2c710a50e8c22ab8fb7b5e7b47ce933ad1c2f5a | [
"Apache-2.0"
] | null | null | null | dfb/DWduifubao/MyPage/spectrumVC.h | kunlingyijia/DKFKB | b2c710a50e8c22ab8fb7b5e7b47ce933ad1c2f5a | [
"Apache-2.0"
] | null | null | null | dfb/DWduifubao/MyPage/spectrumVC.h | kunlingyijia/DKFKB | b2c710a50e8c22ab8fb7b5e7b47ce933ad1c2f5a | [
"Apache-2.0"
] | null | null | null | //
// spectrumVC.h
// DWduifubao
//
// Created by 席亚坤 on 17/2/9.
// Copyright © 2017年 bianming. All rights reserved.
//
#import "BaseViewController.h"
@interface spectrumVC : BaseViewController
@end
| 14.714286 | 52 | 0.694175 |
e72294ff75c102e4dfad55007a89e368e7fa6b6e | 2,146 | c | C | src/mshell.c | wteiwewte/Shell | 28548519599470943b23546285994237b9776d1f | [
"MIT"
] | null | null | null | src/mshell.c | wteiwewte/Shell | 28548519599470943b23546285994237b9776d1f | [
"MIT"
] | null | null | null | src/mshell.c | wteiwewte/Shell | 28548519599470943b23546285994237b9776d1f | [
"MIT"
] | null | null | null | #include "config.h"
#include "siparse.h"
#include "utils.h"
#include "builtins.h"
#include "buffers.h"
#include "pipes.h"
#include "background.h"
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
//initialization our variables
int len;
offset = 0;
foreground_childs = 0;
skip_the_next_line = false;
line_pack first_line;
initiate(background_childs.id, BACKGROUND_SIZE);
initiate(arr_foreground, FOREGROUND_SIZE);
/*
we're blocking sigchld, so we can handle it in future
*/
struct sigaction sa;
sa.sa_handler = handler_sigchld;
sigaction(SIGCHLD, &sa, NULL);
while( (len = read(0, buf + offset, 2*MAX_LINE_LENGTH-offset)) != 0 ){
if( check_prompt() ) print_prompt();
if( len == ERROR_READ ) continue;
offset += len;
first_line = get_first_line(offset);
if( first_line.info == GOT_EOL ){
/*
we got whole line with EOF
so we can proceed with our line
*/
process_line(first_line);
moving_bytes(first_line);
}
else if( first_line.info == NOT_GOT_EOL ) {
//we got part of line without EOL
if( is_line_too_long(offset) ) {
/*
if this part is already too long
we want to skip the next part,
so we setting our bool to true
*/
skip_the_next_line = true;
/*
and we are moving bytes (we know we won't use it because of line's length)
*/
moving_bytes(first_line);
}
}
}
while( offset > 0 ){
first_line = get_first_line(offset);
moving_bytes(first_line);
process_line(first_line);
}
}
| 22.829787 | 95 | 0.537279 |
30be89f93136c7a990d7a926acd434cf53a4c82f | 11,533 | h | C | test/test-mongocrypt.h | rozza/libmongocrypt | 87a8f8418bec057c1d8605ff55ac4e176d8add9b | [
"Apache-2.0"
] | null | null | null | test/test-mongocrypt.h | rozza/libmongocrypt | 87a8f8418bec057c1d8605ff55ac4e176d8add9b | [
"Apache-2.0"
] | null | null | null | test/test-mongocrypt.h | rozza/libmongocrypt | 87a8f8418bec057c1d8605ff55ac4e176d8add9b | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2019-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_MONGOCRYPT_H
#define TEST_MONGOCRYPT_H
#include <bson/bson.h>
#include <stdint.h>
#include "mongocrypt.h"
#include "mongocrypt-ctx-private.h"
#include "mongocrypt-private.h"
#include "mongocrypt-buffer-private.h"
#include "mongocrypt-kms-ctx-private.h"
#include "mongocrypt-key-broker-private.h"
struct __mongocrypt_tester_t;
typedef void (*_mongocrypt_test_fn) (struct __mongocrypt_tester_t *tester);
/* Arbitrary max of 1024 instances of temporary test data. Increase as needed.
*/
#define TEST_DATA_COUNT 1024
typedef struct __mongocrypt_tester_t {
int test_count;
char *test_names[TEST_DATA_COUNT];
_mongocrypt_test_fn test_fns[TEST_DATA_COUNT];
int file_count;
char *file_paths[TEST_DATA_COUNT];
_mongocrypt_buffer_t file_bufs[TEST_DATA_COUNT];
int bson_count;
bson_t test_bson[TEST_DATA_COUNT];
int bin_count;
mongocrypt_binary_t *test_bin[TEST_DATA_COUNT];
int blob_count;
uint8_t *test_blob[TEST_DATA_COUNT];
char *key_file_path;
/* Example encrypted doc. */
_mongocrypt_buffer_t encrypted_doc;
} _mongocrypt_tester_t;
/* Load a .json file as bson */
void
_load_json_as_bson (const char *path, bson_t *out);
void
_mongocrypt_tester_satisfy_kms (_mongocrypt_tester_t *tester,
mongocrypt_kms_ctx_t *kms);
void
_mongocrypt_tester_run_ctx_to (_mongocrypt_tester_t *tester,
mongocrypt_ctx_t *ctx,
mongocrypt_ctx_state_t stop_state);
mongocrypt_binary_t *
_mongocrypt_tester_encrypted_doc (_mongocrypt_tester_t *tester);
/* Return a repeated character with no null terminator. */
char *
_mongocrypt_repeat_char (char c, uint32_t times);
void
_mongocrypt_tester_fill_buffer (_mongocrypt_buffer_t *buf, int n);
/* Return a new initialized mongocrypt_t for testing. */
mongocrypt_t *
_mongocrypt_tester_mongocrypt (void);
#define ASSERT_OR_PRINT_MSG(_statement, msg) \
do { \
if (!(_statement)) { \
fprintf (stderr, \
"FAIL:%s:%d %s()\n %s\n %s\n\n", \
__FILE__, \
__LINE__, \
BSON_FUNC, \
#_statement, \
(msg)); \
fflush (stderr); \
abort (); \
} \
} while (0)
#define ASSERT_OR_PRINT(_statement, _err) \
ASSERT_OR_PRINT_MSG (_statement, mongocrypt_status_message (_err, NULL))
#define ASSERT_OK_STATUS(_stmt, _status) \
do { \
bool _retval = (_stmt); \
bool _status_ok = mongocrypt_status_ok (_status); \
const char *_msg = mongocrypt_status_message (_status, NULL); \
if (!_retval) { \
fprintf (stderr, "%s failed with msg: %s", #_stmt, _msg); \
} else if (!_status_ok) { \
fprintf (stderr, \
"%s resulted in unexpected error status: %s\n", \
#_stmt, \
_msg); \
} \
BSON_ASSERT (_retval &&_status_ok); \
} while (0)
#define ASSERT_FAILS_STATUS(_stmt, _status, _msg_pattern) \
do { \
bool _retval = (_stmt); \
bool _status_ok = mongocrypt_status_ok (_status); \
const char *_msg = mongocrypt_status_message (_status, NULL); \
bool _found_msg = _msg && strstr (_msg, _msg_pattern) != NULL; \
if (_retval) { \
fprintf (stderr, \
"%s succeeded (but should have failed) with msg: '%s'", \
#_stmt, \
_msg_pattern); \
} else if (_status_ok) { \
fprintf (stderr, \
"%s resulted in unexpected ok status: %s\n", \
#_stmt, \
_msg); \
} else if (!_found_msg) { \
fprintf (stderr, "'%s' does not contain '%s'\n", _msg, _msg_pattern); \
} \
BSON_ASSERT (!_retval && !_status_ok && _found_msg); \
} while (0)
#define ASSERT_OK(_stmt, _obj) ASSERT_OK_STATUS (_stmt, (_obj)->status)
#define ASSERT_FAILS(_stmt, _obj, _msg_pattern) \
ASSERT_FAILS_STATUS (_stmt, (_obj)->status, _msg_pattern)
#define ASSERT_OR_PRINT_BSON(_statement, _err) \
ASSERT_OR_PRINT_MSG (_statement, _err.message)
#define ASSERT_STATUS_CONTAINS(status, _msg_pattern) \
ASSERT_FAILS_STATUS (false, status, _msg_pattern)
#define ASSERT_STREQUAL(_expr_a, _expr_b) \
do { \
const char *_str_a = (_expr_a); \
const char *_str_b = (_expr_b); \
int _ret = strcmp (_str_a, _str_b); \
if (_ret != 0) { \
fprintf ( \
stderr, "strings not equal:\n%s\nvs.\n%s\n", _str_a, _str_b); \
} \
BSON_ASSERT (0 == _ret); \
} while (0);
#define ASSERT_STRCONTAINS(_expr_a, _expr_b) \
do { \
const char *_str_a = (_expr_a); \
const char *_str_b = (_expr_b); \
char *_ret = strstr (_str_a, _str_b); \
if (_ret == NULL) { \
fprintf (stderr, "string %s does not contain %s\n", _str_a, _str_b); \
} \
BSON_ASSERT (NULL != _ret); \
} while (0);
void
_assert_bin_bson_equal (mongocrypt_binary_t *bin_a, mongocrypt_binary_t *bin_b);
void
_assert_match_bson (const bson_t *doc, const bson_t *pattern);
typedef enum {
CRYPTO_REQUIRED,
CRYPTO_OPTIONAL,
CRYPTO_PROHIBITED
} _mongocrypt_tester_crypto_spec_t;
void
_mongocrypt_tester_install (_mongocrypt_tester_t *tester,
char *name,
_mongocrypt_test_fn fn,
_mongocrypt_tester_crypto_spec_t crypto_spec);
const char *
_mongocrypt_tester_plaintext (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_crypto (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_log (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_data_key (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_ctx (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_ctx_encrypt (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_ctx_decrypt (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_ciphertext (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_key_broker (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_local_kms (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_cache (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_buffer (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_ctx_setopt (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_key (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_marking (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_traverse_util (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_crypto_hooks (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_key_cache (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_kms_responses (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_status (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_endpoint (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_kek (_mongocrypt_tester_t *tester);
void
_mongocrypt_tester_install_cache_oauth (_mongocrypt_tester_t *tester);
/* Conveniences for getting test data. */
/* Get a temporary bson_t from a JSON string. Do not free it. */
bson_t *
_mongocrypt_tester_bson_from_json (_mongocrypt_tester_t *tester,
const char *json,
...);
#define TMP_BSON(...) _mongocrypt_tester_bson_from_json (tester, __VA_ARGS__)
/* Get a temporary binary from a JSON string. Do not free it. */
mongocrypt_binary_t *
_mongocrypt_tester_bin_from_json (_mongocrypt_tester_t *tester,
const char *json,
...);
#define TEST_BSON(...) _mongocrypt_tester_bin_from_json (tester, __VA_ARGS__)
/* Return a binary blob with the repeating sequence of 123. Do not free it. */
mongocrypt_binary_t *
_mongocrypt_tester_bin (_mongocrypt_tester_t *tester, int size);
#define TEST_BIN(size) _mongocrypt_tester_bin (tester, size)
/* Return either a .json file as BSON or a .txt file as characters. Do not free
* it. */
mongocrypt_binary_t *
_mongocrypt_tester_file (_mongocrypt_tester_t *tester, const char *path);
#define TEST_FILE(path) _mongocrypt_tester_file (tester, path)
#define INSTALL_TEST(fn) \
_mongocrypt_tester_install (tester, #fn, fn, CRYPTO_REQUIRED)
#define INSTALL_TEST_CRYPTO(fn, crypto) \
_mongocrypt_tester_install (tester, #fn, fn, crypto)
void
_load_json_as_bson (const char *path, bson_t *out);
#endif
| 36.381703 | 80 | 0.551634 |
2c567ff14a83c2ad5a4b2c7309129c6cae7f7d36 | 14,517 | h | C | source/val/function.h | iburinoc/SPIRV-Tools | 48326d443e434f55eb50a7cfc9acdc968daad5e3 | [
"Apache-2.0"
] | null | null | null | source/val/function.h | iburinoc/SPIRV-Tools | 48326d443e434f55eb50a7cfc9acdc968daad5e3 | [
"Apache-2.0"
] | null | null | null | source/val/function.h | iburinoc/SPIRV-Tools | 48326d443e434f55eb50a7cfc9acdc968daad5e3 | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2015-2016 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBSPIRV_VAL_FUNCTION_H_
#define LIBSPIRV_VAL_FUNCTION_H_
#include <functional>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "val/basic_block.h"
#include "val/construct.h"
namespace spvtools {
struct bb_constr_type_pair_hash {
std::size_t operator()(
const std::pair<const BasicBlock*, ConstructType>& p) const {
auto h1 = std::hash<const BasicBlock*>{}(p.first);
auto h2 = std::hash<std::underlying_type<ConstructType>::type>{}(
static_cast<std::underlying_type<ConstructType>::type>(p.second));
return (h1 ^ h2);
}
};
enum class FunctionDecl {
kFunctionDeclUnknown, /// < Unknown function declaration
kFunctionDeclDeclaration, /// < Function declaration
kFunctionDeclDefinition /// < Function definition
};
/// This class manages all function declaration and definitions in a module. It
/// handles the state and id information while parsing a function in the SPIR-V
/// binary.
class Function {
public:
Function(uint32_t id, uint32_t result_type_id,
SpvFunctionControlMask function_control, uint32_t function_type_id);
/// Registers a function parameter in the current function
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterFunctionParameter(uint32_t id, uint32_t type_id);
/// Sets the declaration type of the current function
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterSetFunctionDeclType(FunctionDecl type);
/// Registers a block in the current function. Subsequent block instructions
/// will target this block
/// @param id The ID of the label of the block
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterBlock(uint32_t id, bool is_definition = true);
/// Registers a variable in the current block
///
/// @param[in] type_id The type ID of the varaible
/// @param[in] id The ID of the varaible
/// @param[in] storage The storage of the variable
/// @param[in] init_id The initializer ID of the variable
///
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterBlockVariable(uint32_t type_id, uint32_t id,
SpvStorageClass storage, uint32_t init_id);
/// Registers a loop merge construct in the function
///
/// @param[in] merge_id The merge block ID of the loop
/// @param[in] continue_id The continue block ID of the loop
///
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterLoopMerge(uint32_t merge_id, uint32_t continue_id);
/// Registers a selection merge construct in the function
/// @return Returns SPV_SUCCESS if the call was successful
spv_result_t RegisterSelectionMerge(uint32_t merge_id);
/// Registers the end of the block
///
/// @param[in] successors_list A list of ids to the block's successors
/// @param[in] branch_instruction the branch instruction that ended the block
void RegisterBlockEnd(std::vector<uint32_t> successors_list,
SpvOp branch_instruction);
/// Registers the end of the function. This is idempotent.
void RegisterFunctionEnd();
/// Returns true if the \p id block is the first block of this function
bool IsFirstBlock(uint32_t id) const;
/// Returns true if the \p merge_block_id is a BlockType of \p type
bool IsBlockType(uint32_t merge_block_id, BlockType type) const;
/// Returns a pair consisting of the BasicBlock with \p id and a bool
/// which is true if the block has been defined, and false if it is
/// declared but not defined. This function will return nullptr if the
/// \p id was not declared and not defined at the current point in the binary
std::pair<const BasicBlock*, bool> GetBlock(uint32_t id) const;
std::pair<BasicBlock*, bool> GetBlock(uint32_t id);
/// Returns the first block of the current function
const BasicBlock* first_block() const;
/// Returns the first block of the current function
BasicBlock* first_block();
/// Returns a vector of all the blocks in the function
const std::vector<BasicBlock*>& ordered_blocks() const;
/// Returns a vector of all the blocks in the function
std::vector<BasicBlock*>& ordered_blocks();
/// Returns a list of all the cfg constructs in the function
const std::list<Construct>& constructs() const;
/// Returns a list of all the cfg constructs in the function
std::list<Construct>& constructs();
/// Returns the number of blocks in the current function being parsed
size_t block_count() const;
/// Returns the id of the function
uint32_t id() const { return id_; }
/// Returns return type id of the function
uint32_t GetResultTypeId() const { return result_type_id_; }
/// Returns the number of blocks in the current function being parsed
size_t undefined_block_count() const;
const std::unordered_set<uint32_t>& undefined_blocks() const {
return undefined_blocks_;
}
/// Returns the block that is currently being parsed in the binary
BasicBlock* current_block();
/// Returns the block that is currently being parsed in the binary
const BasicBlock* current_block() const;
// For dominance calculations, we want to analyze all the
// blocks in the function, even in degenerate control flow cases
// including unreachable blocks. We therefore make an "augmented CFG"
// which is the same as the ordinary CFG but adds:
// - A pseudo-entry node.
// - A pseudo-exit node.
// - A minimal set of edges so that a forward traversal from the
// pseudo-entry node will visit all nodes.
// - A minimal set of edges so that a backward traversal from the
// pseudo-exit node will visit all nodes.
// In particular, the pseudo-entry node is the unique source of the
// augmented CFG, and the psueo-exit node is the unique sink of the
// augmented CFG.
/// Returns the pseudo exit block
BasicBlock* pseudo_entry_block() { return &pseudo_entry_block_; }
/// Returns the pseudo exit block
const BasicBlock* pseudo_entry_block() const { return &pseudo_entry_block_; }
/// Returns the pseudo exit block
BasicBlock* pseudo_exit_block() { return &pseudo_exit_block_; }
/// Returns the pseudo exit block
const BasicBlock* pseudo_exit_block() const { return &pseudo_exit_block_; }
using GetBlocksFunction =
std::function<const std::vector<BasicBlock*>*(const BasicBlock*)>;
/// Returns the block successors function for the augmented CFG.
GetBlocksFunction AugmentedCFGSuccessorsFunction() const;
/// Like AugmentedCFGSuccessorsFunction, but also includes a forward edge from
/// a loop header block to its continue target, if they are different blocks.
GetBlocksFunction
AugmentedCFGSuccessorsFunctionIncludingHeaderToContinueEdge() const;
/// Returns the block predecessors function for the augmented CFG.
GetBlocksFunction AugmentedCFGPredecessorsFunction() const;
/// Returns the control flow nesting depth of the given basic block.
/// This function only works when you have structured control flow.
/// This function should only be called after the control flow constructs have
/// been identified and dominators have been computed.
int GetBlockDepth(BasicBlock* bb);
/// Prints a GraphViz digraph of the CFG of the current funciton
void PrintDotGraph() const;
/// Prints a directed graph of the CFG of the current funciton
void PrintBlocks() const;
/// Registers execution model limitation such as "Feature X is only available
/// with Execution Model Y".
void RegisterExecutionModelLimitation(SpvExecutionModel model,
const std::string& message);
/// Registers execution model limitation with an |is_compatible| functor.
void RegisterExecutionModelLimitation(
std::function<bool(SpvExecutionModel, std::string*)> is_compatible) {
execution_model_limitations_.push_back(is_compatible);
}
/// Returns true if the given execution model passes the limitations stored in
/// execution_model_limitations_. Returns false otherwise and fills optional
/// |reason| parameter.
bool IsCompatibleWithExecutionModel(SpvExecutionModel model,
std::string* reason = nullptr) const;
// Inserts id to the set of functions called from this function.
void AddFunctionCallTarget(uint32_t call_target_id) {
function_call_targets_.insert(call_target_id);
}
// Returns a set with ids of all functions called from this function.
const std::set<uint32_t> function_call_targets() const {
return function_call_targets_;
}
private:
// Computes the representation of the augmented CFG.
// Populates augmented_successors_map_ and augmented_predecessors_map_.
void ComputeAugmentedCFG();
// Adds a copy of the given Construct, and tracks it by its entry block.
// Returns a reference to the stored construct.
Construct& AddConstruct(const Construct& new_construct);
// Returns a reference to the construct corresponding to the given entry
// block.
Construct& FindConstructForEntryBlock(const BasicBlock* entry_block,
ConstructType t);
/// The result id of the OpLabel that defined this block
uint32_t id_;
/// The type of the function
uint32_t function_type_id_;
/// The type of the return value
uint32_t result_type_id_;
/// The control fo the funciton
SpvFunctionControlMask function_control_;
/// The type of declaration of each function
FunctionDecl declaration_type_;
// Have we finished parsing this function?
bool end_has_been_registered_;
/// The blocks in the function mapped by block ID
std::unordered_map<uint32_t, BasicBlock> blocks_;
/// A list of blocks in the order they appeared in the binary
std::vector<BasicBlock*> ordered_blocks_;
/// Blocks which are forward referenced by blocks but not defined
std::unordered_set<uint32_t> undefined_blocks_;
/// The block that is currently being parsed
BasicBlock* current_block_;
/// A pseudo entry node used in dominance analysis.
/// After the function end has been registered, the successor list of the
/// pseudo entry node is the minimal set of nodes such that all nodes in the
/// CFG can be reached by following successor lists. That is, the successors
/// will be:
/// - Any basic block without predecessors. This includes the entry
/// block to the function.
/// - A single node from each otherwise unreachable cycle in the CFG, if
/// such cycles exist.
/// The pseudo entry node does not appear in the predecessor or successor
/// list of any ordinary block.
/// It has no predecessors.
/// It has Id 0.
BasicBlock pseudo_entry_block_;
/// A pseudo exit block used in dominance analysis.
/// After the function end has been registered, the predecessor list of the
/// pseudo exit node is the minimal set of nodes such that all nodes in the
/// CFG can be reached by following predecessor lists. That is, the
/// predecessors will be:
/// - Any basic block without successors. This includes any basic block
/// ending with an OpReturn, OpReturnValue or similar instructions.
/// - A single node from each otherwise unreachable cycle in the CFG, if
/// such cycles exist.
/// The pseudo exit node does not appear in the predecessor or successor
/// list of any ordinary block.
/// It has no successors.
BasicBlock pseudo_exit_block_;
// Maps a block to its successors in the augmented CFG, if that set is
// different from its successors in the ordinary CFG.
std::unordered_map<const BasicBlock*, std::vector<BasicBlock*>>
augmented_successors_map_;
// Maps a block to its predecessors in the augmented CFG, if that set is
// different from its predecessors in the ordinary CFG.
std::unordered_map<const BasicBlock*, std::vector<BasicBlock*>>
augmented_predecessors_map_;
// Maps a structured loop header to its CFG successors and also its
// continue target if that continue target is not the loop header
// itself. This might have duplicates.
std::unordered_map<const BasicBlock*, std::vector<BasicBlock*>>
loop_header_successors_plus_continue_target_map_;
/// The constructs that are available in this function
std::list<Construct> cfg_constructs_;
/// The variable IDs of the functions
std::vector<uint32_t> variable_ids_;
/// The function parameter ids of the functions
std::vector<uint32_t> parameter_ids_;
/// Maps a construct's entry block to the construct(s).
/// Since a basic block may be the entry block of different types of
/// constructs, the type of the construct should also be specified in order to
/// get the unique construct.
std::unordered_map<std::pair<const BasicBlock*, ConstructType>, Construct*,
bb_constr_type_pair_hash>
entry_block_to_construct_;
/// This map provides the header block for a given merge block.
std::unordered_map<BasicBlock*, BasicBlock*> merge_block_header_;
/// Stores the control flow nesting depth of a given basic block
std::unordered_map<BasicBlock*, int> block_depth_;
/// Stores execution model limitations imposed by instructions used within the
/// function. The functor stored in the list return true if execution model
/// is compatible, false otherwise. If the functor returns false, it can also
/// optionally fill the string parameter with the reason for incompatibility.
std::list<std::function<bool(SpvExecutionModel, std::string*)>>
execution_model_limitations_;
/// Stores ids of all functions called from this function.
std::set<uint32_t> function_call_targets_;
};
} // namespace spvtools
#endif /// LIBSPIRV_VAL_FUNCTION_H_
| 40.663866 | 80 | 0.733278 |
4e2ff219d96dc600f48111cd9efd3584276a11c5 | 218 | c | C | Licence 2/I31/TP 2/ex_3.c | axelcoezard/licence | 1ed409c4572dea080169171beb7e8571159ba071 | [
"MIT"
] | 8 | 2020-11-26T20:45:12.000Z | 2021-11-29T15:46:22.000Z | Licence 2/I31/TP 2/ex_3.c | axelcoezard/licence | 1ed409c4572dea080169171beb7e8571159ba071 | [
"MIT"
] | null | null | null | Licence 2/I31/TP 2/ex_3.c | axelcoezard/licence | 1ed409c4572dea080169171beb7e8571159ba071 | [
"MIT"
] | 6 | 2020-10-23T15:29:24.000Z | 2021-05-05T19:10:45.000Z | #include <stdio.h>
int main()
{
int n;
printf("Entrer un nombre n:");
scanf("%d", &n);
int q = n, index = 0;
do
{
q /= 10;
index++;
} while (q > 0);
printf("%d est composé de %d chiffres\n", n, index);
} | 12.823529 | 53 | 0.527523 |
a2eee9f438a2a36f798c51880224bf3d977ec897 | 276 | h | C | NFA.h | teodoranemtanu/LFA_NFAtoDFA | 0ac6a0cf0504e5c9a91a2b967135f61794390368 | [
"MIT"
] | null | null | null | NFA.h | teodoranemtanu/LFA_NFAtoDFA | 0ac6a0cf0504e5c9a91a2b967135f61794390368 | [
"MIT"
] | null | null | null | NFA.h | teodoranemtanu/LFA_NFAtoDFA | 0ac6a0cf0504e5c9a91a2b967135f61794390368 | [
"MIT"
] | null | null | null | //
// Created by teone on 22-Apr-18.
//
#ifndef UNTITLED_NFA_H
#define UNTITLED_NFA_H
#include "DFA.h"
using namespace std;
class NFA : public DFA {
public:
ifstream &read(ifstream &fin);
DFA convertion();
bool testWord(string word);
};
#endif //UNTITLED_NFA_H
| 15.333333 | 34 | 0.692029 |
08b205acb986cabe182544a4da6b84f0b5ac3718 | 154 | h | C | ExampleGame.h | FRCTeamPhoenix/CMDGames2021 | 8112fb0ced2ec5a8ce0add77060dbb7e85290458 | [
"MIT"
] | null | null | null | ExampleGame.h | FRCTeamPhoenix/CMDGames2021 | 8112fb0ced2ec5a8ce0add77060dbb7e85290458 | [
"MIT"
] | 5 | 2021-11-16T16:32:29.000Z | 2021-11-18T23:46:48.000Z | ExampleGame.h | FRCTeamPhoenix/CMDGames2021 | 8112fb0ced2ec5a8ce0add77060dbb7e85290458 | [
"MIT"
] | 2 | 2021-11-01T23:46:16.000Z | 2021-11-04T22:46:03.000Z | #pragma once
#include "Game.h"
class ExampleGame : public Game{
public:
ExampleGame(){}
virtual void Run() override;
}; | 15.4 | 36 | 0.564935 |
d96681c29052f468f0f85d36e4a84c1826a08ee5 | 335 | h | C | include/coord.h | vbacaksiz/Space-Box | 76578863440392f4113f8e013f590f70373b75ad | [
"MIT"
] | null | null | null | include/coord.h | vbacaksiz/Space-Box | 76578863440392f4113f8e013f590f70373b75ad | [
"MIT"
] | null | null | null | include/coord.h | vbacaksiz/Space-Box | 76578863440392f4113f8e013f590f70373b75ad | [
"MIT"
] | null | null | null | #ifndef COORD_H
#define COORD_H
class coord
{
public:
coord();
virtual ~coord();
coord(int xx,int yy);
double setCoord(int x[20],int y[20],int range,int numOfBox);
void printCoord(int numOfBox);
double x[20];
double y[20];
protected:
private:
};
#endif // COORD_H
| 16.75 | 68 | 0.567164 |
c174c9909bdc8287c20f08a5da664e9f26c16781 | 2,456 | h | C | public/ddk/inc/mountdev.h | yang235/wrk-v1.2 | daeeb598c7bf091b1370e8875626ad0cb3cd1ec0 | [
"Intel"
] | 209 | 2018-10-30T15:59:10.000Z | 2022-03-31T06:02:48.000Z | public/ddk/inc/mountdev.h | WindowsExploitation/wrk-v1.2 | daeeb598c7bf091b1370e8875626ad0cb3cd1ec0 | [
"Intel"
] | 2 | 2019-01-17T04:52:33.000Z | 2019-06-11T06:37:43.000Z | public/ddk/inc/mountdev.h | WindowsExploitation/wrk-v1.2 | daeeb598c7bf091b1370e8875626ad0cb3cd1ec0 | [
"Intel"
] | 66 | 2018-08-03T11:15:44.000Z | 2022-03-31T01:03:03.000Z | /*++
Copyright (c) Microsoft Corporation. All rights reserved.
You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt).
If you do not agree to the terms, do not use the code.
Module Name:
mountdev.h
Abstract:
This file defines the private interfaces between the mount point manager
and the mounted devices.
--*/
#ifndef _MOUNTDEV_
#define _MOUNTDEV_
#include <mountmgr.h>
#define IOCTL_MOUNTDEV_QUERY_UNIQUE_ID CTL_CODE(MOUNTDEVCONTROLTYPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY CTL_CODE(MOUNTDEVCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MOUNTDEV_LINK_CREATED CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_MOUNTDEV_LINK_DELETED CTL_CODE(MOUNTDEVCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_MOUNTDEV_QUERY_STABLE_GUID CTL_CODE(MOUNTDEVCONTROLTYPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
//
// Output structure for IOCTL_MOUNTDEV_QUERY_UNIQUE_ID.
// Input structure for IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY.
//
typedef struct _MOUNTDEV_UNIQUE_ID {
USHORT UniqueIdLength;
UCHAR UniqueId[1];
} MOUNTDEV_UNIQUE_ID, *PMOUNTDEV_UNIQUE_ID;
//
// Output structure for IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY.
//
typedef struct _MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT {
ULONG Size;
USHORT OldUniqueIdOffset;
USHORT OldUniqueIdLength;
USHORT NewUniqueIdOffset;
USHORT NewUniqueIdLength;
} MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT, *PMOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT;
//
// MOUNTDEV_NAME
//
// Input structure for IOCTL_MOUNTDEV_LINK_CREATED.
// Input structure for IOCTL_MOUNTDEV_LINK_DELETED.
//
//
// Output structure for IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
//
typedef struct _MOUNTDEV_SUGGESTED_LINK_NAME {
BOOLEAN UseOnlyIfThereAreNoOtherLinks;
USHORT NameLength;
WCHAR Name[1];
} MOUNTDEV_SUGGESTED_LINK_NAME, *PMOUNTDEV_SUGGESTED_LINK_NAME;
//
// Output structure for IOCTL_MOUNTDEV_QUERY_STABLE_GUID.
//
typedef struct _MOUNTDEV_STABLE_GUID {
GUID StableGuid;
} MOUNTDEV_STABLE_GUID, *PMOUNTDEV_STABLE_GUID;
#endif
| 30.320988 | 139 | 0.790309 |
caef62b611f205b076cf973e7efc3af6838584b3 | 756 | h | C | Bayesian/BayesianClass.h | rajasrijan/BayesianClassification | c6b7e0bec4b5593a25def9c12dd6041c794b1ae4 | [
"MIT"
] | null | null | null | Bayesian/BayesianClass.h | rajasrijan/BayesianClassification | c6b7e0bec4b5593a25def9c12dd6041c794b1ae4 | [
"MIT"
] | null | null | null | Bayesian/BayesianClass.h | rajasrijan/BayesianClassification | c6b7e0bec4b5593a25def9c12dd6041c794b1ae4 | [
"MIT"
] | null | null | null | #pragma once
#include <iostream>
#include <stdint.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <map>
#include "dirent.h"
#include <fstream>
#include <sstream>
using namespace std;
string const blacklist = "after,alt,anybody,anymore,anything,ask,go,able,about,ah,again,as,are,also,and,an,am,be,the,than,thats,yours,or,maybe,if,else,then,because";
class BayesianClass
{
private:
map<string,int> wi;
int filterString(char* ptr,int size);
void calculateHistogram(string file_path);
int fileCount;
double word_count;
public:
string className;
BayesianClass(string name,string path);
BayesianClass(string name);
~BayesianClass(void);
void serialize();
void deserialize(string name);
double p(map<string,int> t);
};
| 21.6 | 165 | 0.75 |
121ce5eb2f816d02ec3376a6e704f9e92242a927 | 267 | h | C | xhcf/xhcf/XHCFCoverView.h | forscape/xhcf | 24b474b5c1db4e7dfed49e3930ec826e285428cf | [
"Apache-2.0"
] | null | null | null | xhcf/xhcf/XHCFCoverView.h | forscape/xhcf | 24b474b5c1db4e7dfed49e3930ec826e285428cf | [
"Apache-2.0"
] | null | null | null | xhcf/xhcf/XHCFCoverView.h | forscape/xhcf | 24b474b5c1db4e7dfed49e3930ec826e285428cf | [
"Apache-2.0"
] | null | null | null | //
// XHCFCoverView.h
// xhcf
//
// Created by 刘学 on 17/1/4.
// Copyright © 2017年 Ethan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XHCFCoverView : UIView
@property (nonatomic, copy) void (^playVideoBlock)(UIButton *);
- (void)showView;
@end
| 14.833333 | 63 | 0.666667 |
af72e46d07a3a2c0466c7efe50ed9cf8b97b0da8 | 5,067 | h | C | moltenvk/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.h | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | moltenvk/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.h | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | moltenvk/MoltenVK/MoltenVK/GPUObjects/MVKSwapchain.h | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | /*
* MVKSwapchain.h
*
* Copyright (c) 2015-2021 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* 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 "MVKDevice.h"
#include "MVKImage.h"
#include "MVKSmallVector.h"
#import "CAMetalLayer+MoltenVK.h"
#import <Metal/Metal.h>
class MVKWatermark;
@class MVKBlockObserver;
#pragma mark -
#pragma mark MVKSwapchain
/** Represents a Vulkan swapchain. */
class MVKSwapchain : public MVKVulkanAPIDeviceObject {
public:
/** Returns the Vulkan type of this object. */
VkObjectType getVkObjectType() override { return VK_OBJECT_TYPE_SWAPCHAIN_KHR; }
/** Returns the debug report object type of this object. */
VkDebugReportObjectTypeEXT getVkDebugReportObjectType() override { return VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT; }
/** Returns the number of images in this swapchain. */
inline uint32_t getImageCount() { return (uint32_t)_presentableImages.size(); }
/** Returns the image at the specified index. */
inline MVKPresentableSwapchainImage* getPresentableImage(uint32_t index) { return _presentableImages[index]; }
/**
* Returns the array of presentable images associated with this swapchain.
*
* If pSwapchainImages is null, the value of pCount is updated with the number of
* presentable images associated with this swapchain.
*
* If pSwapchainImages is not null, then pCount images are copied into the array.
* If the number of available images is less than pCount, the value of pCount is
* updated to indicate the number of images actually returned in the array.
*
* Returns VK_SUCCESS if successful. Returns VK_INCOMPLETE if the number of supported
* images is larger than pCount. Returns other values if an error occurs.
*/
VkResult getImages(uint32_t* pCount, VkImage* pSwapchainImages);
/** Returns the index of the next swapchain image. */
VkResult acquireNextImageKHR(uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
uint32_t deviceMask,
uint32_t* pImageIndex);
/** Returns whether the parent surface is now lost and this swapchain must be recreated. */
inline bool getIsSurfaceLost() { return _surfaceLost; }
/** Returns whether the surface size has changed since the last time this function was called. */
inline bool getHasSurfaceSizeChanged() {
return !CGSizeEqualToSize(_mtlLayer.naturalDrawableSizeMVK, _mtlLayer.drawableSize);
}
/** Returns the status of the surface. Surface loss takes precedence over out-of-date errors. */
inline VkResult getSurfaceStatus() {
if (getIsSurfaceLost()) { return VK_ERROR_SURFACE_LOST_KHR; }
if (getHasSurfaceSizeChanged()) { return VK_SUBOPTIMAL_KHR; }
return VK_SUCCESS;
}
/** Adds HDR metadata to this swapchain. */
void setHDRMetadataEXT(const VkHdrMetadataEXT& metadata);
/** VK_GOOGLE_display_timing - returns the duration of the refresh cycle */
VkResult getRefreshCycleDuration(VkRefreshCycleDurationGOOGLE *pRefreshCycleDuration);
/** VK_GOOGLE_display_timing - returns past presentation times */
VkResult getPastPresentationTiming(uint32_t *pCount, VkPastPresentationTimingGOOGLE *pPresentationTimings);
#pragma mark Construction
MVKSwapchain(MVKDevice* device, const VkSwapchainCreateInfoKHR* pCreateInfo);
~MVKSwapchain() override;
protected:
friend class MVKPresentableSwapchainImage;
void propagateDebugName() override;
void initCAMetalLayer(const VkSwapchainCreateInfoKHR* pCreateInfo, uint32_t imgCnt);
void initSurfaceImages(const VkSwapchainCreateInfoKHR* pCreateInfo, uint32_t imgCnt);
void releaseUndisplayedSurfaces();
uint64_t getNextAcquisitionID();
void willPresentSurface(id<MTLTexture> mtlTexture, id<MTLCommandBuffer> mtlCmdBuff);
void renderWatermark(id<MTLTexture> mtlTexture, id<MTLCommandBuffer> mtlCmdBuff);
void markFrameInterval();
void recordPresentTime(MVKPresentTimingInfo presentTimingInfo, uint64_t actualPresentTime = 0);
CAMetalLayer* _mtlLayer;
MVKWatermark* _licenseWatermark;
MVKSmallVector<MVKPresentableSwapchainImage*, kMVKMaxSwapchainImageCount> _presentableImages;
std::atomic<uint64_t> _currentAcquisitionID;
uint64_t _lastFrameTime;
uint32_t _currentPerfLogFrameCount;
std::atomic<bool> _surfaceLost;
MVKBlockObserver* _layerObserver;
static const int kMaxPresentationHistory = 60;
VkPastPresentationTimingGOOGLE _presentTimingHistory[kMaxPresentationHistory];
uint32_t _presentHistoryCount;
uint32_t _presentHistoryIndex;
uint32_t _presentHistoryHeadIndex;
std::mutex _presentHistoryLock;
};
| 37.813433 | 123 | 0.779949 |
b71a733b00f9b9c1fa4fa9a403be65bc2e630d3b | 13,177 | c | C | src/server/wsmand-daemon.c | sigorbor/openwsman | 981bb76a21b73d1013dd8a5de18da822afc47c15 | [
"BSD-3-Clause"
] | null | null | null | src/server/wsmand-daemon.c | sigorbor/openwsman | 981bb76a21b73d1013dd8a5de18da822afc47c15 | [
"BSD-3-Clause"
] | null | null | null | src/server/wsmand-daemon.c | sigorbor/openwsman | 981bb76a21b73d1013dd8a5de18da822afc47c15 | [
"BSD-3-Clause"
] | null | null | null | /*******************************************************************************
* Copyright (C) 2004-2006 Intel Corp. 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 Intel Corp. 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 Intel Corp. OR THE 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.
*******************************************************************************/
/**
* @author Anas Nashif
*/
#ifdef HAVE_CONFIG_H
#include <wsman_config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <assert.h>
#include "u/libu.h"
#include "wsmand-daemon.h"
#include "wsman-server-api.h"
#ifdef PACKAGE_SUBSCRIPTION_DIR
#define DEFAULT_SUBSCRIPTION_REPOSITORY PACKAGE_SUBSCRIPTION_DIR
#else
#define DEFAULT_SUBSCRIPTION_REPOSITORY "/var/lib/openwsman/subscriptions"
#endif
#ifdef __APPLE__
#define DEFAULT_BASIC_AUTH "libwsman_file_auth.dylib"
#else
#define DEFAULT_BASIC_AUTH "libwsman_file_auth.so"
#endif
//int facility = LOG_DAEMON;
static const char **wsmand_argv = NULL;
static int server_port = -1;
static int server_ssl_port = -1;
static int use_ipv4 = 1;
#ifdef ENABLE_IPV6
static int use_ipv6 = 0;
#endif
static int use_digest = 0;
static char *ssl_key_file = NULL;
static char *service_path = DEFAULT_SERVICE_PATH;
static char *ssl_cert_file = NULL;
static char *ssl_disabled_protocols = NULL;
static char *ssl_cipher_list = NULL;
static char *pid_file = DEFAULT_PID_PATH;
static char *uri_subscription_repository = DEFAULT_SUBSCRIPTION_REPOSITORY;
static int daemon_flag = 0;
static int no_plugin_flag = 0;
static int use_ssl = 0;
static int debug_level = -1;
static int foreground_debug = 0;
static int syslog_level = -1;
static char *log_location = NULL;
static char *digest_password_file = NULL;
static char *basic_password_file = NULL;
static char *custom_anon_identify_file = NULL;
static char *custom_identify_file = NULL;
static char *basic_authenticator_arg = NULL;
static char *basic_authenticator = DEFAULT_BASIC_AUTH;
static int max_threads = 1;
static unsigned long enumIdleTimeout = 100;
static char *thread_stack_size="0";
static int max_connections_per_thread=20;
static char *config_file = NULL;
int wsmand_parse_options(int argc, char **argv)
{
char retval;
u_option_context_t *opt_ctx;
u_error_t *error = NULL;
char *version = NULL;
u_option_entry_t options[] = {
#if 0
{"no-plugins", 'n', U_OPTION_ARG_NONE, &no_plugin_flag,
"Do not load any plugins", NULL},
#endif
{"ssl", 'S', U_OPTION_ARG_NONE, &use_ssl,
"Use SSL port", NULL},
{"version", 'q', U_OPTION_ARG_NONE, &version,
"Display application version", NULL},
{"debug", 'd', U_OPTION_ARG_NONE, &foreground_debug,
"Start daemon in foreground and turn on debugging", NULL},
{"syslog", 's', U_OPTION_ARG_INT, &syslog_level,
"Set the verbosity of syslog output.", "0-6"},
{"enum-idle-timeout", 'e', U_OPTION_ARG_INT,
&enumIdleTimeout,
"Enumeration Idle timeout in secs", "default 100"},
{"config-file", 'c', U_OPTION_ARG_STRING, &config_file,
"Alternate configuration file", "<file>"},
{"pid-file", 'p', U_OPTION_ARG_STRING, &pid_file,
"PID file", "<file>"},
{"subscription-repository-location", 'r', U_OPTION_ARG_STRING, &uri_subscription_repository,
"Subscription Repository Location", "<uri>"},
{NULL}
};
wsmand_argv = (const char **) argv;
opt_ctx = u_option_context_new("WS-Management Server");
u_option_context_set_ignore_unknown_options(opt_ctx, FALSE);
u_option_context_add_main_entries(opt_ctx, options, "wsman");
retval = u_option_context_parse(opt_ctx, &argc, &argv, &error);
if (error) {
if (error->message)
printf("%s\n", error->message);
retval = 0;
}
if (version) {
fprintf(stdout, PACKAGE_NAME " " PACKAGE_VERSION "\n\n");
exit(0);
}
u_error_free(error);
u_option_context_free(opt_ctx);
return retval;
}
const char **wsmand_options_get_argv(void)
{
return wsmand_argv;
}
int wsmand_read_config(dictionary * ini)
{
if (!iniparser_find_entry(ini, "server")) {
return 0;
}
server_port = iniparser_getint(ini, "server:port", 5985);
server_ssl_port = iniparser_getint(ini, "server:ssl_port", 5986);
debug_level = iniparser_getint(ini, "server:debug_level", 0);
enumIdleTimeout =
(unsigned long) iniparser_getint(ini,
"server:enum_idle_timeout",
100);
service_path =
iniparser_getstring(ini, "server:service_path", "/wsman");
ssl_key_file = iniparser_getstr(ini, "server:ssl_key_file");
ssl_cert_file = iniparser_getstr(ini, "server:ssl_cert_file");
ssl_disabled_protocols = iniparser_getstr(ini, "server:ssl_disabled_protocols");
ssl_cipher_list = iniparser_getstr(ini, "server:ssl_cipher_list");
use_ipv4 = iniparser_getboolean(ini, "server:ipv4", 1);
#ifdef ENABLE_IPV6
use_ipv6 = iniparser_getboolean(ini, "server:ipv6", 1);
if (! (use_ipv4 || use_ipv6)) {
fprintf(stderr, "Neither ipv4 nor ipv6 is enabled in openwsman.conf !\n");
exit(1);
}
#endif
use_digest = iniparser_getboolean(ini, "server:use_digest", 0);
digest_password_file = iniparser_getstr(ini,
"server:digest_password_file");
basic_password_file =
iniparser_getstr(ini, "server:basic_password_file");
custom_identify_file =
iniparser_getstr(ini, "server:identify_file");
custom_anon_identify_file =
iniparser_getstr(ini, "server:anon_identify_file");
basic_authenticator =
iniparser_getstr(ini, "server:basic_authenticator");
basic_authenticator_arg =
iniparser_getstr(ini, "server:basic_authenticator_arg");
log_location = iniparser_getstr(ini, "server:log_location");
max_threads = iniparser_getint(ini, "server:max_threads", 0);
uri_subscription_repository = iniparser_getstring(ini, "server:subs_repository", DEFAULT_SUBSCRIPTION_REPOSITORY);
max_connections_per_thread = iniparser_getint(ini, "server:max_connections_per_thread", iniparser_getint(ini, "server:max_connextions_per_thread", 20));
thread_stack_size = iniparser_getstring(ini, "server:thread_stack_size", "0");
#ifdef ENABLE_EVENTING_SUPPORT
wsman_server_set_subscription_repos(uri_subscription_repository);
#endif
return 1;
}
int wsmand_options_get_max_connections_per_thread(void)
{
return max_connections_per_thread;
}
unsigned int wsmand_options_get_thread_stack_size(void)
{
errno=0;
unsigned int stack_size = strtoul(thread_stack_size,NULL,10);
if(errno){
debug("failed to convert string to unsigned int : %s", strerror(errno));
return 0;
}
return stack_size;
}
const char *wsmand_options_get_config_file(void)
{
char *p;
if (config_file == NULL) {
config_file = DEFAULT_CONFIG_FILE;
}
if (config_file != NULL && !u_path_is_absolute(config_file)) {
char cwd[PATH_MAX];
if ((p = getcwd(cwd, PATH_MAX)) != NULL)
config_file =
u_strdup_printf("%s/%s", cwd, config_file);
}
return config_file;
}
char *wsmand_options_get_digest_password_file(void)
{
return digest_password_file;
}
char *wsmand_options_get_basic_password_file(void)
{
return basic_password_file;
}
char *wsmand_options_get_identify_file(void)
{
return custom_identify_file;
}
char *wsmand_options_get_anon_identify_file(void)
{
return custom_anon_identify_file;
}
char *wsmand_options_get_service_path(void)
{
return service_path;
}
int wsmand_options_get_daemon_flag(void)
{
return daemon_flag;
}
int wsmand_options_get_no_plugins_flag(void)
{
return no_plugin_flag;
}
int wsmand_options_get_use_ssl(void)
{
return use_ssl;
}
int wsmand_options_get_use_ipv4(void)
{
return use_ipv4;
}
#ifdef ENABLE_IPV6
int wsmand_options_get_use_ipv6(void)
{
return use_ipv6;
}
/* called when opening an ipv6 socket failed */
void wsmand_options_disable_use_ipv6(void)
{
use_ipv6 = 0;
}
#endif
int wsmand_options_get_foreground_debug(void)
{
if (foreground_debug)
return 6;
else
return -1;
}
int wsmand_options_get_debug_level(void)
{
return debug_level;
}
int wsmand_options_get_syslog_level(void)
{
return syslog_level;
}
int wsmand_options_get_server_port(void)
{
return server_port;
}
int wsmand_options_get_server_ssl_port(void)
{
return server_ssl_port;
}
char *wsmand_options_get_ssl_key_file(void)
{
return ssl_key_file;
}
char *wsmand_options_get_ssl_cert_file(void)
{
return ssl_cert_file;
}
char *wsmand_options_get_ssl_disabled_protocols(void)
{
return ssl_disabled_protocols;
}
char *wsmand_options_get_ssl_cipher_list(void)
{
return ssl_cipher_list;
}
int wsmand_options_get_digest(void)
{
return use_digest;
}
char *wsmand_options_get_pid_file(void)
{
return pid_file;
}
int wsmand_options_get_max_threads(void)
{
//XXX: we might wish to return a constant 1 till the
//MT issues on unix are solved. See compat_unix.h for
//details on the issue.
return max_threads;
}
char *wsmand_default_basic_authenticator()
{
return DEFAULT_BASIC_AUTH;
}
char *wsmand_option_get_basic_authenticator()
{
return basic_authenticator;
}
char *wsmand_option_get_basic_authenticator_arg()
{
return basic_authenticator_arg;
}
unsigned long wsmand_options_get_enumIdleTimeout()
{
return enumIdleTimeout;
}
typedef struct _ShutdownHandler ShutdownHandler;
struct _ShutdownHandler {
WsmandShutdownFn fn;
void *user_data;
};
static list_t *shutdown_handlers = NULL;
static int shutdown_counter = 0;
static int shutdown_pending = 0;
static int shutting_down = 0;
void wsmand_shutdown_add_handler(WsmandShutdownFn fn, void *user_data)
{
ShutdownHandler *handler;
lnode_t *n;
if (fn == NULL)
return;
handler = u_zalloc(sizeof(ShutdownHandler));
handler->fn = fn;
handler->user_data = user_data;
n = lnode_create(handler);
if (!shutdown_handlers)
shutdown_handlers = list_create(LISTCOUNT_T_MAX);
list_prepend(shutdown_handlers, n);
}
void wsmand_shutdown_block(void)
{
if (shutdown_counter < 0)
return;
if (shutting_down) {
debug
("Attempting to block shut-down while shut-down is already in progress!");
}
++shutdown_counter;
}
void wsmand_shutdown_allow(void)
{
if (shutdown_counter <= 0)
return;
--shutdown_counter;
if (shutdown_counter == 0 && shutdown_pending) {
wsmand_shutdown();
}
}
static int shutdown_idle_cb(void *user_data)
{
// int restart = (int )user_data;
lnode_t *n;
if (shutdown_handlers == NULL) {
goto NULL_SHUTDOWN_HANDLERS;
}
if (list_isempty(shutdown_handlers)) {
goto EMPTY_LIST;
}
n = list_first(shutdown_handlers);
debug("shutdown_idle_cb started");
while (n) {
ShutdownHandler *handler = n->list_data;
if (handler && handler->fn)
handler->fn(handler->user_data);
u_free(handler);
n = list_next(shutdown_handlers, n);
}
// list_destroy_nodes (shutdown_handlers);
EMPTY_LIST:
// list_destroy (shutdown_handlers);
NULL_SHUTDOWN_HANDLERS:
if (user_data == NULL) {
/* We should be quitting the main loop (which will cause us to
exit) in a handler. If not, we'll throw in an exit just to be
sure. */
exit(0);
} else {
const char **argv = wsmand_options_get_argv();
errno = 0;
if ((execv(argv[0], (char **) argv)) < 0) {
debug("Can not restart wsmand: %s",
strerror(errno));
exit(EXIT_FAILURE);
}
}
/* We should never reach here... */
assert(1 == 1);
return 0;
}
static void do_shutdown(int restart)
{
if (shutdown_counter > 0) {
debug("Shutting down pended");
shutdown_pending = TRUE;
return;
}
debug("Shutting down daemon...");
if (shutting_down) {
debug
("Shut-down request received while shut-down is already in progress!");
return;
}
shutting_down = TRUE;
if (restart) {
shutdown_idle_cb((void *) 1);
} else {
shutdown_idle_cb(NULL);
}
}
void wsmand_shutdown(void)
{
do_shutdown(FALSE);
}
void wsmand_restart(void)
{
do_shutdown(TRUE);
}
| 24.492565 | 160 | 0.733475 |
49a5a8cb50f25b3c02a067aeedad9a32ee9f9421 | 3,230 | h | C | components/render/scene_render/server/sources/shared/sg/sprite_list.h | untgames/funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 7 | 2016-03-30T17:00:39.000Z | 2017-03-27T16:04:04.000Z | components/render/scene_render/server/sources/shared/sg/sprite_list.h | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2017-11-21T11:25:49.000Z | 2018-09-20T17:59:27.000Z | components/render/scene_render/server/sources/shared/sg/sprite_list.h | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2016-11-29T15:18:40.000Z | 2017-03-27T16:04:08.000Z | #ifndef RENDER_SCENE_SERVER_SPRITE_LIST_SHARED_HEADER
#define RENDER_SCENE_SERVER_SPRITE_LIST_SHARED_HEADER
#include <shared/sg/visual_model.h>
namespace render
{
namespace scene
{
namespace server
{
using interchange::SpriteMode;
using interchange::PrimitiveUsage;
using interchange::SpriteDesc;
///////////////////////////////////////////////////////////////////////////////////////////////////
///Список спрайтов
///////////////////////////////////////////////////////////////////////////////////////////////////
class SpriteList: public VisualModel
{
public:
typedef interchange::uint32 subid_t;
///////////////////////////////////////////////////////////////////////////////////////////////////
///Конструкторы / деструктор / присваивание
///////////////////////////////////////////////////////////////////////////////////////////////////
SpriteList (RenderManager& render_manager);
~SpriteList ();
///////////////////////////////////////////////////////////////////////////////////////////////////
///Добавление / удаление спрайтов
///////////////////////////////////////////////////////////////////////////////////////////////////
void CreateList (subid_t subid, SpriteMode mode, PrimitiveUsage usage, const math::vec3f& up, const char* batch);
void RemoveList (subid_t subid);
void ReserveLists (subid_t count);
///////////////////////////////////////////////////////////////////////////////////////////////////
///Основные параметры
///////////////////////////////////////////////////////////////////////////////////////////////////
SpriteMode Mode (subid_t subid) const;
PrimitiveUsage Usage (subid_t subid) const;
const math::vec3f& OrtUp (subid_t subid) const;
const char* Batch (subid_t subid) const;
///////////////////////////////////////////////////////////////////////////////////////////////////
///Имя материала
///////////////////////////////////////////////////////////////////////////////////////////////////
void SetMaterial (subid_t subid, const char* name);
const char* Material (subid_t subid) const;
///////////////////////////////////////////////////////////////////////////////////////////////////
///Количество спрайтов / размер буфера
///////////////////////////////////////////////////////////////////////////////////////////////////
size_t Size (subid_t subid) const;
size_t Capacity (subid_t subid) const;
///////////////////////////////////////////////////////////////////////////////////////////////////
///Изменение размера списка спрайтов / резервирование места для хранения спрайтов
///////////////////////////////////////////////////////////////////////////////////////////////////
void Resize (subid_t subid, size_t count);
void Reserve (subid_t subid, size_t count);
///////////////////////////////////////////////////////////////////////////////////////////////////
///Обновление дескрипторов спрайтов
///////////////////////////////////////////////////////////////////////////////////////////////////
void SetDescs (subid_t subid, size_t first, size_t count, const SpriteDesc* descs);
private:
struct Impl;
stl::auto_ptr<Impl> impl;
};
}
}
}
#endif
| 38.915663 | 119 | 0.367183 |
0afbe0a86b15c16747b7745fd91e569b7c0ca4dc | 448 | h | C | CheatEngine/stdafx.h | iPhreak2G/CheatEngine | 194280a197b3003ea176ea35647cefc7ffdcc258 | [
"MIT"
] | 4 | 2019-06-13T10:10:14.000Z | 2021-11-25T10:45:55.000Z | CheatEngine/stdafx.h | iPhreak2G/CheatEngine | 194280a197b3003ea176ea35647cefc7ffdcc258 | [
"MIT"
] | null | null | null | CheatEngine/stdafx.h | iPhreak2G/CheatEngine | 194280a197b3003ea176ea35647cefc7ffdcc258 | [
"MIT"
] | 3 | 2019-05-29T13:21:01.000Z | 2021-07-13T18:26:35.000Z | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include <xtl.h>
#include <xboxmath.h>
#include "kernel.h"
#include "tools.h"
#include "auth.h"
#include "net.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <iomanip>
// TODO: reference additional headers your program requires here
| 23.578947 | 67 | 0.709821 |
77dde6da3a617c786243ab9dcea1caa8b8a9b5b9 | 1,709 | c | C | mptcore/object/properties_print.c | becm/mpt-base | 49e8b2022b975b5e159088b5dd052d6b5e7afe6e | [
"0BSD"
] | 3 | 2018-08-31T22:04:49.000Z | 2020-06-12T07:00:25.000Z | mptcore/object/properties_print.c | becm/mpt-base | 49e8b2022b975b5e159088b5dd052d6b5e7afe6e | [
"0BSD"
] | null | null | null | mptcore/object/properties_print.c | becm/mpt-base | 49e8b2022b975b5e159088b5dd052d6b5e7afe6e | [
"0BSD"
] | null | null | null | /*!
* loop trough object/metatype properties
*/
#include <string.h>
#include <sys/uio.h>
#include "convert.h"
#include "object.h"
struct outData
{
MPT_TYPE(property_handler) h;
void *p;
};
static ssize_t saveString(void *ctx, const char *str, size_t len)
{
struct iovec *vec = ctx;
char *to;
if (len >= vec->iov_len) {
return MPT_ERROR(MissingData);
}
to = memcpy(vec->iov_base, str, len);
vec->iov_base = to + len;
vec->iov_len -= len;
return len;
}
static int mprint(void *data, const MPT_STRUCT(property) *prop)
{
char buf[1024];
struct iovec vec;
struct outData *par = data;
MPT_STRUCT(property) pr = *prop;
int len;
*buf = 0;
if (!pr.val.fmt) {
if (!pr.val.ptr) { pr.val.ptr = buf; *buf = 0; }
return par->h(par->p, &pr);
}
if (!pr.val.ptr) {
return *pr.val.fmt ? -1 : 0;
}
vec.iov_base = buf;
vec.iov_len = sizeof(buf);
if ((len = mpt_tostring(&pr.val, saveString, &vec))) {
return par->h(par->p, prop);
}
buf[sizeof(buf) - vec.iov_len] = 0;
pr.val.ptr = buf;
pr.val.fmt = 0;
return par->h(par->p, &pr);
}
/*!
* \ingroup mptObject
* \brief print properties
*
* Process object properties matching traverse types.
*
* \param get property query operation
* \param obj property source
* \param proc process string/unprintable property
* \param data argument for property processing
* \param match properties to process
*
* \return index of requested property
*/
extern int mpt_properties_print(int (*get)(void *, MPT_STRUCT(property) *), void *obj, MPT_TYPE(property_handler) proc, void *data, int mask)
{
struct outData par;
par.h = proc;
par.p = data;
return mpt_properties_foreach(get, obj, mprint, &par, mask);
}
| 19.872093 | 141 | 0.654769 |
8b16a3b761fa77d606cbecc307676d61a2a0dbae | 359 | c | C | src/dynamic_dbl.c | 99991/dynamic | b18320e11ef68e3f09148c56164cf2c3acf30d32 | [
"MIT"
] | null | null | null | src/dynamic_dbl.c | 99991/dynamic | b18320e11ef68e3f09148c56164cf2c3acf30d32 | [
"MIT"
] | null | null | null | src/dynamic_dbl.c | 99991/dynamic | b18320e11ef68e3f09148c56164cf2c3acf30d32 | [
"MIT"
] | null | null | null | #include "dynamic.h"
TypeInfo dbl_type_info = {
"num",
NULL,
NULL,
obj_dbl_cmp,
obj_dbl_str,
obj_dbl_json,
obj_dbl_hash,
};
bool obj_is_dbl(var object){
return object && object->type_info == &dbl_type_info;
}
var dbl(double value){
var object = obj_new(&dbl_type_info);
object->dvalue = value;
return object;
}
| 15.608696 | 57 | 0.643454 |
a03522af62d49bb89782e8160f0d3add79a69d78 | 2,523 | h | C | src/game/client/cstrike/cs_hud_achievement_announce.h | DeadZoneLuna/csso-src | 6c978ea304ee2df3796bc9c0d2916bac550050d5 | [
"Unlicense"
] | 4 | 2021-10-03T05:16:55.000Z | 2021-12-28T16:49:27.000Z | src/game/client/cstrike/cs_hud_achievement_announce.h | cafeed28/what | 08e51d077f0eae50afe3b592543ffa07538126f5 | [
"Unlicense"
] | null | null | null | src/game/client/cstrike/cs_hud_achievement_announce.h | cafeed28/what | 08e51d077f0eae50afe3b592543ffa07538126f5 | [
"Unlicense"
] | 3 | 2022-02-02T18:09:58.000Z | 2022-03-06T18:54:39.000Z | //========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef CS_HUD_ACHIVEMENT_ANNOUNCE_H
#define CS_HUD_ACHIVEMENT_ANNOUNCE_H
#ifdef _WIN32
#pragma once
#endif
#include <KeyValues.h>
#include <vgui/IScheme.h>
#include <vgui/ISurface.h>
#include <vgui/ISystem.h>
#include <vgui_controls/AnimationController.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/ScalableImagePanel.h>
#include "vgui/ILocalize.h"
#include "vgui_avatarimage.h"
#include "hud.h"
#include "hudelement.h"
#include "cs_hud_playerhealth.h"
#include "cs_shareddefs.h"
using namespace vgui;
class IAchievement;
class CCSAchivementInfoPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CCSAchivementInfoPanel, vgui::EditablePanel );
public:
CCSAchivementInfoPanel( vgui::Panel *parent, const char* name);
~CCSAchivementInfoPanel();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
void SetAchievement(IAchievement* pAchievement);
private:
vgui::Label *m_pAchievementNameLabel;
vgui::Label *m_pAchievementDescLabel;
vgui::ScalableImagePanel *m_pAchievementIcon;
};
class CCSAchievementAnnouncePanel: public EditablePanel, public CHudElement
{
private:
DECLARE_CLASS_SIMPLE( CCSAchievementAnnouncePanel, EditablePanel );
public:
CCSAchievementAnnouncePanel( const char *pElementName );
~CCSAchievementAnnouncePanel();
virtual void Reset();
virtual void Init();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void FireGameEvent( IGameEvent * event );
void Show();
void Hide();
virtual bool ShouldDraw( void );
virtual void Paint( void );
void OnThink( void );
bool GetAlphaFromTime(float elapsedTime, float delay, float fadeInTime, float holdTime, float fadeOutTime, float&alpha);
int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
protected:
bool GetGlowAlpha (float time, float& alpha);
bool GetAchievementPanelAlpha (float time, float& alpha);
private:
CUtlQueue<eCSAchievementType> m_achievementQueue;
eCSAchievementType m_currentDisplayedAchievement;
float m_displayStartTime;
vgui::EditablePanel *m_pGlowPanel;
CCSAchivementInfoPanel *m_pAchievementInfoPanel;
bool m_bShouldBeVisible;
};
#endif //CS_HUD_ACHIVEMENT_ANNOUNCE_H | 27.423913 | 121 | 0.713436 |
ae3358c8853de34e0dd6299e9a7b6c9d29e96bf0 | 1,079 | h | C | EquinoxBasedT2C.h | dazsfun/XX11Codes | fd0a847c040e159d5cb8fac03104b4cda07d7510 | [
"MIT"
] | null | null | null | EquinoxBasedT2C.h | dazsfun/XX11Codes | fd0a847c040e159d5cb8fac03104b4cda07d7510 | [
"MIT"
] | null | null | null | EquinoxBasedT2C.h | dazsfun/XX11Codes | fd0a847c040e159d5cb8fac03104b4cda07d7510 | [
"MIT"
] | 1 | 2020-01-10T16:02:31.000Z | 2020-01-10T16:02:31.000Z | // EquinoxBasedT2C.h: interface for the CEquinoxBasedT2C class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_EQUINOXBASEDT2C_H__CDD852A8_A448_478B_802E_DD98A6245B4A__INCLUDED_)
#define AFX_EQUINOXBASEDT2C_H__CDD852A8_A448_478B_802E_DD98A6245B4A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afx.h>
#include "Safeauxilary.h"
class CEquinoxBasedT2C
{
private:
char m_dirconfig[1024];
int mjd;
double sod;
public:
void FromSecondtoYMD(double refsecond,int &year,int &month,int &day,int &hour,int &minute,double &second);
double FromYMDtoSecond(int year,int month,int day,int hour,int minute,double second);
void TertoCel(double *R, double *dR);
void CeltoTer(double *R,double *dR);
void Inittime(int year,int month,int day,int hour,int minute ,double second);
BOOL Initdir(CString path,CString ipath);
CEquinoxBasedT2C();
virtual ~CEquinoxBasedT2C();
};
#endif // !defined(AFX_EQUINOXBASEDT2C_H__CDD852A8_A448_478B_802E_DD98A6245B4A__INCLUDED_)
| 29.972222 | 108 | 0.713624 |
8b94147cdad8892a4de9f3ff8fc9ff2de0a60a11 | 669 | c | C | ipc/posix_mq/mq_recv.c | zhangjiaxing/linux-c | 8cbfee6f831eb15939397bcd0cfe9f245da1e043 | [
"MIT"
] | 3 | 2020-04-15T11:00:55.000Z | 2022-03-23T03:15:38.000Z | ipc/posix_mq/mq_recv.c | zhangjiaxing/linux-c | 8cbfee6f831eb15939397bcd0cfe9f245da1e043 | [
"MIT"
] | null | null | null | ipc/posix_mq/mq_recv.c | zhangjiaxing/linux-c | 8cbfee6f831eb15939397bcd0cfe9f245da1e043 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <mqueue.h>
#define MSGSIZE 8192
int main(void){
const char testbuf[] = "hello mq";
size_t bufsize = sizeof(testbuf);
mqd_t mymq = mq_open("/testmq", O_CREAT| O_RDWR, 00600, NULL);
if(mymq == -1){
perror("mq_open failed.");
exit(-1);
}
#if 1
char recv_buf[MSGSIZE];
ssize_t recv_size;
while( (recv_size = mq_receive(mymq, recv_buf, MSGSIZE, NULL)) > 1){
printf("recv %s\n", recv_buf);
fflush(stdout);
}
printf("read ok\n");
#endif
mq_close(mymq);
// mq_unlink("/testmq");
return 0;
}
| 16.725 | 72 | 0.584454 |
eb4a30581932dc9d296214f23e5fa55769cfc383 | 3,543 | h | C | logdevice/common/LibeventTimer.h | SimonKinds/LogDevice | fc9ac2fccb6faa3292b2b0a610a9eb77fd445824 | [
"BSD-3-Clause"
] | null | null | null | logdevice/common/LibeventTimer.h | SimonKinds/LogDevice | fc9ac2fccb6faa3292b2b0a610a9eb77fd445824 | [
"BSD-3-Clause"
] | null | null | null | logdevice/common/LibeventTimer.h | SimonKinds/LogDevice | fc9ac2fccb6faa3292b2b0a610a9eb77fd445824 | [
"BSD-3-Clause"
] | null | null | null | /**
* Copyright (c) 2017-present, Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <boost/noncopyable.hpp>
#include <chrono>
#include <functional>
#include "event2/event_struct.h"
#include <folly/IntrusiveList.h>
#include "logdevice/common/RunState.h"
/**
* @file
* Convenience class for a timer that runs on libevent.
*
* This class is not thread-safe in general. All operations (including
* construction, and destruction if the timer is active) should be mode
* on a single thread.
*/
namespace facebook { namespace logdevice {
class TimeoutMap;
class LibeventTimer : boost::noncopyable {
public:
LibeventTimer();
/**
* Creates an initially inactive timer.
*
* A typical pattern is for the object to be a member in a class and for the
* callback to want to call a method of the owning class. This is safe; as
* long as the timer object is destroyed with the class, there is no risk of
* the callback getting invoked when the parent class has already been
* destroyed. It's also safe to destroy the owning LibeventTimer object within
* the callback.
*
* @param base event base to attach events to throughout the lifetime of the
* timer object
* @param callback to be called (with this LibeventTimer object as argument)
* when timer fires, must be copyable
*/
LibeventTimer(struct event_base* base, std::function<void()> callback);
// Uses nullptr callback. setCallback() must be called before the timer is
// activated.
LibeventTimer(struct event_base* base);
// Methods are virtual to allow MockLibeventTimer to override in tests
virtual void assign(struct event_base* base, std::function<void()> callback);
/**
* Activates the timer to fire once after the specified delay. Microseconds
* are the granularity which libevent offers. Larger std::chrono::duration
* classes implicitly convert to smaller ones so you can call this with
* seconds or milliseconds too.
*
* If a TimeoutMap object is provided, it will be used to convert the given
* delay to struct timeval (possibly using libevent's common timeout
* optimization).
*
* If activate() is called while the timer is already active, it effectively
* cancels the previous timer.
*/
virtual void activate(std::chrono::microseconds delay,
TimeoutMap* timeout_map = nullptr);
/**
* Variant of activate() that takes a struct timeval.
*/
virtual void activate(const struct timeval* delay);
/**
* Cancels the timer if active.
*/
virtual void cancel();
/**
* Is the timer active?
*/
virtual bool isActive() const;
/**
* Has this timer been assigned to an event base?
*/
virtual bool isAssigned() const;
/**
* Changes the callback.
*/
virtual void setCallback(std::function<void()> callback) {
callback_ = callback;
}
virtual ~LibeventTimer();
private:
bool initialized_{false};
struct event timer_;
std::function<void()> callback_;
bool active_ = false;
// The worker run state that this timer was activated in. Will be propagated
// with all callbacks.
RunState workerRunState_;
// Called by libevent when the timer goes off. Invokes the supplied
// callback.
static void libeventCallback(void* instance, short);
};
}} // namespace facebook::logdevice
| 28.804878 | 80 | 0.699125 |
64d3387491674c226972d46804352c63f820208c | 6,187 | h | C | cutil/include/HashTable.h | jjzhang166/eric-wang-cutil | ff52df69c743c21a10a263f1771bc13ceb4b17b9 | [
"Apache-2.0"
] | 1 | 2021-12-09T10:27:06.000Z | 2021-12-09T10:27:06.000Z | cutil/include/HashTable.h | eric-wang/cutil | ff52df69c743c21a10a263f1771bc13ceb4b17b9 | [
"Apache-2.0"
] | null | null | null | cutil/include/HashTable.h | eric-wang/cutil | ff52df69c743c21a10a263f1771bc13ceb4b17b9 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2015 The CUtil Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Eric Wang
* Update: 2015-03-20
*/
#ifndef __HASHTABLE_H__
#define __HASHTABLE_H__
/************************************************************************/
/* Include */
/************************************************************************/
#include "CUtil.h"
/************************************************************************/
/* define */
/************************************************************************/
typedef struct Tag_HashTableEntry {
CHAR* key; /* key '0' term. str */
OBJECT value; /* payload '0' term. str */
UINT valueType;
struct Tag_HashTableEntry *next;
}T_HashTableEntry, *HashTableEntry;
typedef struct Tag_HashTable {
ULONG capacity; /* capacity of hash buckets */
FLOAT factor; /* factor of hash buckets */
ULONG size; /* current HashTable size. */
ULONG threshold; /* The next size value at which to resize (capacity * factor) */
HashTableEntry* table; /* HashTable table */
/*************************** Functions defined ****************************/
/**
* Test HashTable is empty or not.
* @param map -- The HashTable create by hashmap_new function.
* @return CUTILSUCCESS / CUTILFAILED.
*/
UINT (*isEmpty)(struct Tag_HashTable* map);
/**
* Get HashTable's size.
* @param map -- The HashTable create by hashmap_new function.
* @return size of HashTable.
*/
UINT (*getSize)(struct Tag_HashTable* map);
/**
* Get HashTable's capacity.
* @param map -- The HashTable create by hashmap_new function.
* @return size of HashTable.
*/
UINT (*getCapacity)(struct Tag_HashTable* map);
UINT ( *put)(struct Tag_HashTable* map, CHAR* key, OBJECT value, UINT valueType);
UINT ( *putChar)(struct Tag_HashTable* map, CHAR* key, CHAR value);
UINT ( *putByte)(struct Tag_HashTable* map, CHAR* key, BYTE value);
UINT ( *putShort)(struct Tag_HashTable* map, CHAR* key, SHORT value);
/**
* Add a key-value to the HashTable. If the key is available in the HashTable, update the old value.
* @param map -- The HashTable create by hashmap_new function.
* @param key -- hash key, need string type.
* @param value -- key value, INT type.
* @return CUTILSUCCESS / CUTILFAILED..
*/
UINT ( *putInt)(struct Tag_HashTable* map, CHAR* key, INT value);
UINT ( *putUint)(struct Tag_HashTable* map, CHAR* key, UINT value);
UINT ( *putLong)(struct Tag_HashTable* map, CHAR* key, LONG value);
UINT ( *putUlong)(struct Tag_HashTable* map, CHAR* key, ULONG value);
UINT ( *putFloat)(struct Tag_HashTable* map, CHAR* key, FLOAT value);
UINT ( *putDouble)(struct Tag_HashTable* map, CHAR* key, DOUBLE value);
/**
* Add a key-value to the HashTable. If the key is available in the HashTable, update the old value.
* @param map -- The HashTable create by hashmap_new function.
* @param key -- hash key, need string type.
* @param value -- key value, INT type.
* @return CUTILSUCCESS / CUTILFAILED..
*/
UINT ( *putString)(struct Tag_HashTable* map, CHAR* key, CHAR* value);
UINT ( *putObject)(struct Tag_HashTable* map, CHAR* key, OBJECT value);
/**
* get value from HashTable by hash key.
* @param map -- The HashTable create by hashmap_new function.
* @param key -- hash key, need string type.
* @return void type value, should cast the value type when used.
*/
OBJECT (*get)(struct Tag_HashTable* map, const CHAR* key);
UINT (*contains)(struct Tag_HashTable* map, const CHAR* key);
VOID* (*remove)(struct Tag_HashTable* map, const CHAR* key);
UINT (*clear)(struct Tag_HashTable* map);
struct Tag_HashTable* (*clone)(struct Tag_HashTable* map);
VOID (*print)(struct Tag_HashTable* map);
VOID (*printByIndex)(struct Tag_HashTable* map, ULONG index);
}T_HashTable, *HashTable;
/****************************** Prototypes ***********************************/
/**
* Create HashTable and init the capacity.
* @param capacity -- The initial HashTable capacity.
* @param factor -- The initial HashTable factor, used to dynamic expand the HashTable.
* @return HashTable initial by capacity and factor. NULL if create failed.
*/
HashTable newHashTable(LONG capacity, FLOAT factor);
/**
* Free HashTable memory.
* @param map -- The HashTable create by hashmap_new function.
* @return CUTILSUCCESS / CUTILFAILED.
*/
UINT deleteHashTable(HashTable map);
VOID printHashTableIndex(HashTable map, LONG index);
VOID printHashTable(HashTable map);
#endif /* __HASHTABLE_H__ */
| 39.660256 | 142 | 0.525941 |
03b527f4305a3eb6de8d48fafd022c7ae6ee1fc4 | 2,023 | h | C | MUON/MUONrec/AliMUONTrackerDataSourceTypes.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | MUON/MUONrec/AliMUONTrackerDataSourceTypes.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | MUON/MUONrec/AliMUONTrackerDataSourceTypes.h | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | #ifndef ALIMUONTRACKERDATASOURCETYPES_H
#define ALIMUONTRACKERDATASOURCETYPES_H
#ifndef ROOT_TObject
# include "TObject.h"
#endif
/// \ingroup graphics
/// \class AliMUONTrackerDataSourceTypes
/// \brief Short names and aliases for data source types recognized by AliMUONTrackerData related classes.
///
/// \author Laurent Aphecetche <laurent.aphecetche@cern.ch>, Subatech
///
class AliMUONTrackerDataSourceTypes : public TObject
{
public:
static const char* ShortNameForConfig() { return "CONF"; }
static const char* AliasesForConfig() { return "CONF CONFIG Configuration"; }
static const char* ShortNameForHV() { return "HV"; }
static const char* AliasesForHV() { return "HV"; }
static const char* ShortNameForLV() { return "LV"; }
static const char* AliasesForLV() { return "LV"; }
static const char* ShortNameForOccupancy() { return "OCC"; }
static const char* AliasesForOccupancy() { return "OCC Occupancy"; }
static const char* ShortNameForPedestals() { return "PED"; }
static const char* AliasesForPedestals() { return "PED PEDESTAL Pedestals"; }
static const char* ShortNameForRejectList() { return "RL"; }
static const char* AliasesForRejectList() { return "RL RejectList"; }
static const char* ShortNameForStatus() { return "STAT"; }
static const char* AliasesForStatus() { return "STAT Status"; }
static const char* ShortNameForStatusMap() { return "STATMAP"; }
static const char* AliasesForStatusMap() { return "STATMAP StatusMap"; }
static Bool_t IsConfig(const char* type);
static Bool_t IsHV(const char* type);
static Bool_t IsLV(const char* type);
static Bool_t IsOccupancy(const char* type);
static Bool_t IsPedestals(const char* type);
static Bool_t IsRejectList(const char* type);
static Bool_t IsStatus(const char* type);
static Bool_t IsStatusMap(const char* type);
private:
static Bool_t IsInAliasList(const char* type, const char* aliases);
/// \cond CLASSIMP
ClassDef(AliMUONTrackerDataSourceTypes,0);
/// \endcond
};
#endif
| 32.629032 | 106 | 0.736036 |
26d09f9567de10b5055623869bafca50a4097014 | 5,032 | c | C | src/data.c | ford442/wasm-asteroids | 0c260db07cbe063477f1cad3f0aade636e1c8553 | [
"MIT"
] | null | null | null | src/data.c | ford442/wasm-asteroids | 0c260db07cbe063477f1cad3f0aade636e1c8553 | [
"MIT"
] | null | null | null | src/data.c | ford442/wasm-asteroids | 0c260db07cbe063477f1cad3f0aade636e1c8553 | [
"MIT"
] | null | null | null | #include <stdlib.h>
#include "options.h"
#include "shape.h"
static const float asteroid1_vertices[]={
-.02f,-.04f,
.00f,-.03f,
.02f,-.04f,
.04f,-.02f,
.03f,.00f,
.04f,.02f,
.00f,.04f,
-.04f,.02f,
-.04f,-.02f
};
static const float asteroid2_vertices[]={
-.02f,-.04f,
.00f,-.03f,
.02f,-.04f,
.04f,-.02f,
.02f,-.01f,
.04f,.01f,
.02f,.04f,
-.01f,.03f,
-.02f,.04f,
-.04f,.02f,
-.03f,.00f,
-.04f,-.02f
};
static const float asteroid3_vertices[]={
-.01f,-.04f,
.02f,-.04f,
.04f,-.01f,
.04f,.01f,
.02f,.04f,
.00f,.04f,
.00f,.01f,
-.02f,.04f,
-.04f,.01f,
-.02f,.00f,
-.04f,-.01f
};
static const float asteroid4_vertices[]={
-.02f,-.04f,
.01f,-.04f,
.04f,-.02f,
.04f,-.01f,
.01f,.00f,
.04f,.02f,
.02f,.04f,
.01f,.03f,
-.02f,.04f,
-.04f,.01f,
-.04f,-.01f,
-.01f,-.02f
};
const struct shape asteroid_shape_data[]={
{
asteroid1_vertices,
sizeof(asteroid1_vertices) / sizeof(float) / 2,
NULL,
0
},
{
asteroid2_vertices,
sizeof(asteroid2_vertices) / sizeof(float) / 2,
NULL,
0
},
{
asteroid3_vertices,
sizeof(asteroid3_vertices) / sizeof(float) / 2,
NULL,
0
},
{
asteroid4_vertices,
sizeof(asteroid4_vertices) / sizeof(float) / 2,
NULL,
0
}
};
static const float box_vertices[]={
-.04f,-.04f,
.04f,-.04f,
.04f,.04f,
-.04f,.04f
};
const struct shape box_shape_data={
box_vertices,
sizeof(box_vertices) / sizeof(float) / 2,
NULL,
0
};
const float
_a[]={7.0f,.00f,.06f,.00f,.02f,.015f,.00f,.03f,.02f,.03f,.06f,.03f,.03f,.00f,.03f},
_b[]={12.0f,.00f,.06f,.00f,.00f,.02f,.00f,.03f,.01f,.03f,.02f,.02f,.03f,.00f,.03f,.02f,.03f,.03f,.04f,.03f,.05f,.02f,
.06f,.00f,.06f},
_c[]={6.0f,.03f,.00f,.01f,.00f,.00f,.01f,.00f,.05f,.01f,.06f,.03f,.06f},
_d[]={7.0f,.00f,.00f,.02f,.00f,.03f,.01f,.03f,.05f,.02f,.06f,.00f,.06f,.00f,.00f},
_e[]={7.0f,.03f,.00f,.00f,.00f,.00f,.03f,.02f,.03f,.00f,.03f,.00f,.06f,.03f,.06f},
_f[]={6.0f,.03f,.00f,.00f,.00f,.00f,.03f,.02f,.03f,.00f,.03f,.00f,.06f},
_g[]={10.0f,.03f,.01f,.02f,.00f,.01f,.00f,.00f,.01f,.00f,.05f,.01f,.06f,.02f,.06f,.03f,.05f,.03f,.04f,.02f,.04f},
_h[]={6.0f,.00f,.00f,.00f,.06f,.00f,.03f,.03f,.03f,.03f,.00f,.03f,.06f},
_i[]={6.0f,.00f,.00f,.03f,.00f,.015f,.00f,.015f,.06f,.00f,.06f,.03f,.06f},
_j[]={5.0f,.01f,.00f,.03f,.00f,.03f,.06f,.01f,.06f,.00f,.05f},
_k[]={6.0f,.00f,.00f,.00f,.06f,.00f,.03f,.03f,.00f,.00f,.03f,.03f,.06f},
_l[]={3.0f,.00f,.00f,.00f,.06f,.03f,.06f},
_m[]={5.0f,.00f,.06f,.00f,.00f,.015f,.02f,.03f,.00f,.03f,.06f},
_n[]={4.0f,.00f,.06f,.00f,.00f,.03f,.06f,.03f,.00f},
_o[]={5.0f,.00f,.00f,.03f,.00f,.03f,.06f,.00f,.06f,.00f,.00f},
_p[]={5.0f,.00f,.06f,.00f,.00f,.03f,.00f,.03f,.03f,.00f,.03f},
_q[]={9.0f,.02f,.05f,.025f,.055f,.02f,.06f,.00f,.06f,.00f,.00f,.03f,.00f,.03f,.05f,.025f,.055f,.03f,.06f},
_r[]={7.0f,.00f,.06f,.00f,.00f,.03f,.00f,.03f,.03f,.00f,.03f,.01f,.03f,.03f,.06f},
_s[]={6.0f,.03f,.00f,.00f,.00f,.00f,.03f,.03f,.03f,.03f,.06f,.00f,.06f},
_t[]={4.0f,.00f,.00f,.03f,.00f,.015f,.00f,.015f,.06f},
_u[]={4.0f,.00f,.00f,.00f,.06f,.03f,.06f,.03f,.00f},
_v[]={3.0f,.00f,.00f,.015f,.06f,.03f,.00f},
_w[]={5.0f,.00f,.00f,.00f,.06f,.015f,.04f,.03f,.06f,.03f,.00f},
_x[]={5.0f,.00f,.00f,.03f,.06f,.015f,.03f,.03f,.00f,.00f,.06f},
_y[]={5.0f,.00f,.00f,.015f,.03f,.03f,.00f,.015f,.03f,.015f,.06f},
_z[]={4.0f,.00f,.00f,.03f,.00f,.00f,.06f,.03f,.06f},
_0[]={6.0f,.00f,.00f,.03f,.00f,.03f,.06f,.00f,.06f,.00f,.00f,.03f,.06f},
_1[]={2.0f,.015f,.00f,.015f,.06f},
_2[]={6.0f,.00f,.00f,.03f,.00f,.03f,.03f,.00f,.03f,.00f,.06f,.03f,.06f},
_3[]={7.0f,.00f,.00f,.03f,.00f,.03f,.03f,.00f,.03f,.03f,.03f,.03f,.06f,.00f,.06f},
_4[]={5.0f,.00f,.00f,.00f,.03f,.03f,.03f,.03f,.00f,.03f,.06f},
_5[]={6.0f,.03f,.00f,.00f,.00f,.00f,.03f,.03f,.03f,.03f,.06f,.00f,.06f},
_6[]={7.0f,.03f,.00f,.01f,.00f,.00f,.01f,.00f,.06f,.03f,.06f,.03f,.03f,.00f,.03f},
_7[]={3.0f,.00f,.00f,.03f,.00f,.03f,.06f},
_8[]={8.0f,.00f,.03f,.00f,.00f,.03f,.00f,.03f,.03f,.00f,.03f,.00f,.06f,.03f,.06f,.03f,.03f},
_9[]={6.0f,.03f,.06f,.03f,.03f,.00f,.03f,.00f,.00f,.03f,.00f,.03f,.03f},
__[]={2.0f,.00f,.06f,.03f,.06f},
_minus[]={2.0f,.00f,.03f,.03f,.03f};
const float *_font[256]={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 00 - 0F */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 10 - 1F */
0,0,0,0,0,0,0,0,0,0,0,0,0, /* 20 - 2C */
_minus,0,0, /* 2D - 2F */
_0, /* 30 */
_1, /* 31 */
_2, /* 32 */
_3, /* 33 */
_4, /* 34 */
_5, /* 35 */
_6, /* 36 */
_7, /* 37 */
_8, /* 38 */
_9, /* 39 */
0,0,0,0,0,0,0, /* 3A - 40 */
_a, /* 41 */
_b, /* 42 */
_c, /* 43 */
_d, /* 44 */
_e, /* 45 */
_f, /* 46 */
_g, /* 47 */
_h, /* 48 */
_i, /* 49 */
_j, /* 4A */
_k, /* 4B */
_l, /* 4C */
_m, /* 4D */
_n, /* 4E */
_o, /* 4F */
_p, /* 50 */
_q, /* 51 */
_r, /* 52 */
_s, /* 53 */
_t, /* 54 */
_u, /* 55 */
_v, /* 56 */
_w, /* 57 */
_x, /* 58 */
_y, /* 59 */
_z, /* 5A */
0,0,0,0,__,0,0, /* 5B - 60 */
_a, /* 61 */
_b, /* 62 */
_c, /* 63 */
_d, /* 64 */
_e, /* 65 */
_f, /* 66 */
_g, /* 67 */
_h, /* 68 */
_i, /* 69 */
_j, /* 6A */
_k, /* 6B */
_l, /* 6C */
_m, /* 6D */
_n, /* 6E */
_o, /* 6F */
_p, /* 70 */
_q, /* 71 */
_r, /* 72 */
_s, /* 73 */
_t, /* 74 */
_u, /* 75 */
_v, /* 76 */
_w, /* 77 */
_x, /* 78 */
_y, /* 79 */
_z /* 7A */
};
| 23.735849 | 117 | 0.535771 |
b300c360bab8be569f912e209ab6582beb4b6926 | 8,596 | h | C | asp/tinet/netapp/dhcp4_cli.h | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | 1 | 2019-12-13T05:51:34.000Z | 2019-12-13T05:51:34.000Z | asp/tinet/netapp/dhcp4_cli.h | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | null | null | null | asp/tinet/netapp/dhcp4_cli.h | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | 1 | 2021-09-17T15:41:36.000Z | 2021-09-17T15:41:36.000Z | /*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
* Copyright (c) 1995, 1996, 1997, 1998, 1999
* The Internet Software Consortium. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The Internet Software Consortium 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 INTERNET SOFTWARE CONSORTIUM 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 INTERNET SOFTWARE CONSORTIUM 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.
*
* This software has been written for the Internet Software Consortium
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
* Enterprises. To learn more about the Internet Software Consortium,
* see ``http://www.vix.com/isc''. To learn more about Vixie
* Enterprises, see ``http://www.vix.com''.
*
* This client was substantially modified and enhanced by Elliot Poger
* for use on Linux while he was working on the MosquitoNet project at
* Stanford.
*
* The current version owes much to Elliot's Linux enhancements, but
* was substantially reorganized and partially rewritten by Ted Lemon
* so as to use the same networking framework that the Internet Software
* Consortium DHCP server uses. Much system-specific configuration code
* was moved into a shell script so that as support for more operating
* systems is added, it will not be necessary to port and maintain
* system-specific configuration code to these operating systems - instead,
* the shell script can invoke the native tools to accomplish the same
* purpose.
*/
/*
* WIDE Project DHCP Implementation
* Copyright (c) 1995-1997 Akihiro Tominaga
* Copyright (c) 1995-1997 WIDE Project
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided the following conditions
* are satisfied,
*
* 1. Both the copyright notice and this permission notice appear in
* all copies of the software, derivative works or modified versions,
* and any portions thereof, and that both notices appear in
* supporting documentation.
* 2. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by WIDE Project and
* its contributors.
* 3. Neither the name of WIDE 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 DEVELOPER ``AS IS'' AND WIDE
* PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
* WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE
* IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED.
*
* Feedback of the results generated from any improvements or
* extensions made to this software would be much appreciated.
* Any such feedback should be sent to:
*
* Akihiro Tominaga
* WIDE Project
* Keio University, Endo 5322, Kanagawa, Japan
* (E-mail: dhcp-dist@wide.ad.jp)
*
* WIDE project has the rights to redistribute these changes.
*/
/*
* TINET (TCP/IP Protocol Stack)
*
* Copyright (C) 2011 by Dep. of Computer Science and Engineering
* Tomakomai National College of Technology, JAPAN
*
* 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
* によって公表されている GNU General Public License の Version 2 に記
* 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
* を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
* 利用と呼ぶ)することを無償で許諾する.
* (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
* 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
* スコード中に含まれていること.
* (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
* 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
* 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
* の無保証規定を掲載すること.
* (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
* 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
* と.
* (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
* 作権表示,この利用条件および下記の無保証規定を掲載すること.
* (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
* 報告すること.
* (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
* 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
*
* 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
* よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
* 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
* 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
*
* @(#) $Id$
*/
#ifndef DHCP4_CLI_H
#define DHCP4_CLI_H
#include <netapp/dhcp4.h>
/*
* DHCP クライアントのスタックサイズ
*/
#define DHCP4_CLI_STACK_SIZE 1024 /* DHCP クライアントタスクのスタックサイズ */
/*
* DHCP クライアントの優先度
*/
#define DHCP4_CLI_MAIN_PRIORITY 5 /* DHCP クライアントタスクの優先度 */
/* 推奨度の定義 */
#define DHCP4_CLI_CFG_PREFER_ADDR 100 /* アドレスの推奨度 */
/* DHCP クライアントメッセージの受信リストサイズ(2以上指定すること) */
#define NUM_DHCP4_MSG_LIST 3
/*
* DHCP クライアントメッセージ構造体数【変更禁止】
* +1 は送信用
*/
#define NUM_MPF_DHCP4_CLI_MSG (NUM_DHCP4_MSG_LIST+1)
/*
* コンパイル時コンフィギュレーション
*/
/* DHCP 必須オプションリスト */
#ifndef DHCP4_CLI_CFG_REQUIRED_OLIST
#define DHCP4_CLI_CFG_REQUIRED_OLIST { \
DHCP4_OPT_SUBNET_MASK, \
DHCP4_OPT_ROUTER, \
}
#endif /* of #ifndef DHCP4_CLI_CFG_REQUIRED_OLIST */
/* DHCP 要求オプションリスト */
#ifndef DHCP4_CLI_CFG_REQUEST_OLIST
#if defined(USE_RESOLVER)
#define DHCP4_CLI_CFG_REQUEST_OLIST { \
DHCP4_OPT_DNS_SERVER, \
DHCP4_OPT_DOMAIN_NAME, \
}
#endif /* of #if defined(USE_RESOLVER) */
#endif /* of #ifndef DHCP4_CLI_CFG_REQUEST_OLIST */
/*
* タイムアウト値
*/
/* 受信タイムアウト */
#define TMO_DHCP4C_OFFER (ULONG_C(120)*SYSTIM_HZ) /* OFFER メッセージ */
#define TMO_DHCP4C_ACK (ULONG_C(60)*SYSTIM_HZ) /* ACK/NAK メッセージ */
/* リース時間の既定値 */
#define TMO_DHCP4C_DEF_LEASE (ULONG_C(12*60*60)*SYSTIM_HZ) /* 標準時間 */
#define TMO_DHCP4C_MIN_LEASE (ULONG_C(60)*SYSTIM_HZ) /* 最小時間 */
/* メッセージの送信周期 */
#define TMO_DHCP4C_INIT_INTVL (ULONG_C(3)*SYSTIM_HZ) /* 初期値 */
#define TMO_DHCP4C_MAX_BACKOFF (ULONG_C(15)*SYSTIM_HZ) /* 制限値 */
/* DHCP サーバへの UDP 送信タイムアウト */
#define TMO_DHCP4C_UDP_SND ULONG_C(1000000) /* [us] */
/* メッセージ構造体獲得タイムアウト */
#define TMO_DHCP4C_MPF_GET ULONG_C(1000000) /* [us] */
/* ARP 要求を送信してからの待ち時間 */
#define TMO_DHCP4C_ARP_WAIT ULONG_C(1000000) /* [us] */
/* RELEASE メッセージを送信してからの待ち時間 */
#define TMO_DHCP4C_SND_REL_WAIT ULONG_C(1000000) /* [us] */
#ifndef _MACRO_ONLY
#ifdef T_IPV4EP_DEFINED
/*
* DHCP クライアントメッセージ構造体
*/
typedef struct dhcp4_cli_msg {
/* 4バイト境界にアラインする。*/
T_DHCP4_MSG msg; /* DHCP メッセージ構造体 */
struct dhcp4_cli_msg *next; /* リストの次のメッセージ構造体 */
T_IPV4EP srv; /* サーバのIPv4アドレス/ポート番号 */
uint16_t len; /* msg の有効長 */
uint16_t prefer; /* msg の推奨度 */
uint8_t type; /* メッセージタイプ */
} T_DHCP4_CLI_MSG;
#endif /*of #ifdef T_IPV4EP_DEFINED */
/*
* コールバック関数
*/
extern ER callback_nblk_dhcp4_cli (ID cepid, FN fncd, void *p_parblk);
/*
* タスク
*/
extern void dhcp4_cli_task(intptr_t exinf);
/*
* 関数
*/
#ifdef T_IN4_ADDR_DEFINED
extern ER dhcp4c_rel_info (void);
extern ER dhcp4c_renew_info (void);
extern ER dhcp4c_get_info (T_IN4_ADDR *addr, uint32_t *expire, uint32_t *renew,
uint32_t *rebind, SYSTIM *bind_start);
#endif /* of #ifdef T_IN4_ADDR_DEFINED */
#endif /* of #ifndef _MACRO_ONLY */
#endif /* of #ifndef DHCP4_CLI_H */
| 32.80916 | 84 | 0.707422 |
6c5abf7906ac0724ace114c0d4d7a8db10410991 | 4,790 | h | C | src/MockCluster.h | IMCG/RamCloud | dad96cf34d330608acb43b009d12949ed2d938f4 | [
"0BSD"
] | 1 | 2021-12-06T01:24:22.000Z | 2021-12-06T01:24:22.000Z | src/MockCluster.h | behnamm/cs244b_project | 957e8b3979e4ca24814edd73254cc4c69ea14126 | [
"0BSD"
] | null | null | null | src/MockCluster.h | behnamm/cs244b_project | 957e8b3979e4ca24814edd73254cc4c69ea14126 | [
"0BSD"
] | 1 | 2021-05-24T12:32:33.000Z | 2021-05-24T12:32:33.000Z | /* Copyright (c) 2012 Stanford University
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef RAMCLOUD_MOCKCLUSTER_H
#define RAMCLOUD_MOCKCLUSTER_H
#include "BindTransport.h"
#include "CoordinatorService.h"
#include "Log.h"
#include "Logger.h"
#include "MockExternalStorage.h"
#include "Segment.h"
#include "Server.h"
#include "ServerList.h"
#include "ServiceMask.h"
#include "TableManager.h"
namespace RAMCloud {
/**
* Utility to make setting up unit testing involving many "servers" painless.
* The details of how each server in the cluster are created is specified by
* a ServerConfig (just as it is during normal execution, though some additional
* fields may be consulted). Details about each of those fields is documented
* as part of ServerConfig.
*
* Internally this class uses BindTransport to allow the servers to communicate.
* It tries to take care of as many of the details of testing as possible. It
* registers and unregisters the transport, it creates a coordinator, as servers
* are added it registers them with the coordinator, it can auto-assign service
* locators to each of the servers, and, finally, it provides factories to
* easily construct clients to the created services.
*
* All resources returned by an instance are cleaned up automatically and are
* valid for the lifetime of the MockCluster instance. You shouldn't ever
* free anything returned by a MockCluster. Everything is public so feel free
* to get at the internals of this class, but expect your unit tests to break
* from time-to-time as this class is updated.
*
* There are some limitations to be aware of:
* - Keep in mind that RAMCloud code doesn't behave well when backup servers
* go away before (or while) masters go away. Masters make every effort to
* back their data up, and if there aren't enough backups this means waiting
* forever.
* - Control over the details of the coordinator is limited to just choosing
* its service locator. The coordinator of the MockCluster doesn't run
* additional services like the PingService. For now, those must be created
* manually and registered. In the future, perhaps the coordinator will
* have a CoordinatorConfig of some kind to make this easier. It was
* just left out because it wouldn't have simplified our test much at the
* time of writing.
*/
class MockCluster {
public:
explicit MockCluster(Context* context,
string coordinatorLocator = "mock:host=coordinator");
~MockCluster();
Server* addServer(ServerConfig config);
void syncCoordinatorServerList();
void haltCoordinatorServerListUpdater();
/// Caller-supplied context that we manage to provide access to
/// the cluster (see documentation for constructor parameter).
Context* linkedContext;
/// Context that will be used for the cluster coordinator.
Context coordinatorContext;
/// Dummy version for use in coordinatorContext.
MockExternalStorage externalStorage;
/**
* Transport the servers in the cluster use to communicate. Unlike a
* normal tranport more than one server uses it and each is registered
* with a seperate service locator that other servers use to address rpcs
* to it.
*
* Clients for the services of each of the servers can be created using
* service locators or the get() method can be used as a shortcut.
*/
BindTransport transport;
/// Locator of the coordinator of the MockCluster.
string coordinatorLocator;
/// The coordinator of the MockCluster.
Tub<CoordinatorService> coordinator;
/// Servers in the cluster; used to delete them when the cluster goes away.
vector<Server*> servers;
/// Contexts in this array correspond to entries in the \c servers vector.
/// Used to clean them up when the cluster goes away.
vector<Context*> contexts;
/// If linkedContext didn't already have a server list, we use this for it.
Tub<ServerList> linkedContextServerList;
DISALLOW_COPY_AND_ASSIGN(MockCluster);
};
} // namespace RAMCloud
#endif
| 40.940171 | 80 | 0.741754 |
f0141c9b42085d408382c9afba1807c7db2ea967 | 466 | h | C | Applications/TVPhotos/MSDeleterPlugin-Protocol.h | lechium/tvOS10Headers | f0c99993da6cc502d36fdc5cb4ff90d94b12bf67 | [
"MIT"
] | 4 | 2017-03-23T00:01:54.000Z | 2018-08-04T20:16:32.000Z | Applications/TVPhotos/MSDeleterPlugin-Protocol.h | lechium/tvOS124Headers | 11d1b56dd4c0ffd88b9eac43f87a5fd6f7228475 | [
"MIT"
] | null | null | null | Applications/TVPhotos/MSDeleterPlugin-Protocol.h | lechium/tvOS124Headers | 11d1b56dd4c0ffd88b9eac43f87a5fd6f7228475 | [
"MIT"
] | 4 | 2017-05-14T16:23:26.000Z | 2019-12-21T15:07:59.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "MSDeleterDelegate.h"
@class NSString;
@protocol MSDeleterPlugin <MSDeleterDelegate>
+ (id <MSDeleterPlugin>)deleterPluginForPersonID:(NSString *)arg1;
@optional
- (void)deleterWillDeassignPluginAsDelegateOfDeleter:(id <MSDeleter>)arg1;
- (void)deleterWillAssignPluginAsDelegateOfDeleter:(id <MSDeleter>)arg1;
@end
| 24.526316 | 83 | 0.751073 |
37b2bc1f6e6f85d5c026acd0cdec230679bf0837 | 456 | c | C | samples/simple/entry.c | sjcappella/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | 3 | 2016-01-20T13:01:59.000Z | 2018-03-30T15:27:51.000Z | samples/simple/entry.c | vancaho/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | null | null | null | samples/simple/entry.c | vancaho/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | 1 | 2017-05-27T07:13:53.000Z | 2017-05-27T07:13:53.000Z | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int* i;
int main(int argc, char** argv)
{
int j = 0;
char local[3];
int fd1 = open(argv[1], O_RDONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
read(fd1, local, 3);
if (local[0] < 5) {
j++;
}
if (local[1] < 3) {
j++;
}
if (j == 2) {
i = (int*) malloc(sizeof(int));
}
*i = 2;
return 0;
}
| 15.2 | 76 | 0.530702 |
887f3a90fbe167fd6f1d1c99eba392deeca4f684 | 3,491 | h | C | HiroCamSDK/src/main/cpp/dependence/include/PPCS/PPCS_API.h | shirleyyuqi/UIFySim | 15810480022003f5f84509229ef5acbd47e54172 | [
"Apache-2.0"
] | null | null | null | HiroCamSDK/src/main/cpp/dependence/include/PPCS/PPCS_API.h | shirleyyuqi/UIFySim | 15810480022003f5f84509229ef5acbd47e54172 | [
"Apache-2.0"
] | null | null | null | HiroCamSDK/src/main/cpp/dependence/include/PPCS/PPCS_API.h | shirleyyuqi/UIFySim | 15810480022003f5f84509229ef5acbd47e54172 | [
"Apache-2.0"
] | null | null | null | #ifndef _PPCS_API___INC_H_
#define _PPCS_API___INC_H_
#ifdef WIN32DLL
#ifdef PPPP_API_EXPORTS
#define PPPP_API_API __declspec(dllexport)
#else
#define PPPP_API_API __declspec(dllimport)
#endif
#endif //// #ifdef WIN32DLL
#ifdef LINUX
#include <netinet/in.h>
#define PPPP_API_API
#endif //// #ifdef LINUX
#ifdef _ARC_COMPILER
#include "net_api.h"
#define PPPP_API_API
#endif //// #ifdef _ARC_COMPILER
#include "PPCS_Type.h"
#include "PPCS_Error.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef struct{
CHAR bFlagInternet; // Internet Reachable? 1: YES, 0: NO
CHAR bFlagHostResolved; // P2P Server IP resolved? 1: YES, 0: NO
CHAR bFlagServerHello; // P2P Server Hello? 1: YES, 0: NO
CHAR NAT_Type; // NAT type, 0: Unknow, 1: IP-Restricted Cone type, 2: Port-Restricted Cone type, 3: Symmetric
CHAR MyLanIP[16]; // My LAN IP. If (bFlagInternet==0) || (bFlagHostResolved==0) || (bFlagServerHello==0), MyLanIP will be "0.0.0.0"
CHAR MyWanIP[16]; // My Wan IP. If (bFlagInternet==0) || (bFlagHostResolved==0) || (bFlagServerHello==0), MyWanIP will be "0.0.0.0"
} st_PPCS_NetInfo;
typedef struct{
INT32 Skt; // Sockfd
struct sockaddr_in RemoteAddr; // Remote IP:Port
struct sockaddr_in MyLocalAddr; // My Local IP:Port
struct sockaddr_in MyWanAddr; // My Wan IP:Port
UINT32 ConnectTime; // Connection build in ? Sec Before
CHAR DID[24]; // Device ID
CHAR bCorD; // I am Client or Device, 0: Client, 1: Device
CHAR bMode; // Connection Mode: 0: P2P, 1:Relay Mode
CHAR Reserved[2];
} st_PPCS_Session;
PPPP_API_API UINT32 PPCS_GetAPIVersion(void);
PPPP_API_API INT32 PPCS_QueryDID(const CHAR* DeviceName, CHAR* DID, INT32 DIDBufSize);
PPPP_API_API INT32 PPCS_Initialize(CHAR *Parameter);
PPPP_API_API INT32 PPCS_DeInitialize(void);
PPPP_API_API INT32 PPCS_NetworkDetect(st_PPCS_NetInfo *NetInfo, UINT16 UDP_Port);
PPPP_API_API INT32 PPCS_NetworkDetectByServer(st_PPCS_NetInfo *NetInfo, UINT16 UDP_Port, CHAR *ServerString);
PPPP_API_API INT32 PPCS_Share_Bandwidth(CHAR bOnOff);
PPPP_API_API INT32 PPCS_Listen(const CHAR *MyID, const UINT32 TimeOut_Sec, UINT16 UDP_Port, CHAR bEnableInternet, const CHAR* APILicense);
PPPP_API_API INT32 PPCS_Listen_Break(void);
PPPP_API_API INT32 PPCS_LoginStatus_Check(CHAR* bLoginStatus);
PPPP_API_API INT32 PPCS_Connect(const CHAR *TargetID, CHAR bEnableLanSearch, UINT16 UDP_Port);
PPPP_API_API INT32 PPCS_ConnectByServer(const CHAR *TargetID, CHAR bEnableLanSearch, UINT16 UDP_Port, CHAR *ServerString);
PPPP_API_API INT32 PPCS_Connect_Break();
PPPP_API_API INT32 PPCS_Check(INT32 SessionHandle, st_PPCS_Session *SInfo);
PPPP_API_API INT32 PPCS_Close(INT32 SessionHandle);
PPPP_API_API INT32 PPCS_ForceClose(INT32 SessionHandle);
PPPP_API_API INT32 PPCS_Write(INT32 SessionHandle, UCHAR Channel, CHAR *DataBuf, INT32 DataSizeToWrite);
PPPP_API_API INT32 PPCS_Read(INT32 SessionHandle, UCHAR Channel, CHAR *DataBuf, INT32 *DataSize, UINT32 TimeOut_ms);
PPPP_API_API INT32 PPCS_Check_Buffer(INT32 SessionHandle, UCHAR Channel, UINT32 *WriteSize, UINT32 *ReadSize);
//// Ther following functions are available after ver. 2.0.0
PPPP_API_API INT32 PPCS_PktSend(INT32 SessionHandle, UCHAR Channel, CHAR *PktBuf, INT32 PktSize); //// Available after ver. 2.0.0
PPPP_API_API INT32 PPCS_PktRecv(INT32 SessionHandle, UCHAR Channel, CHAR *PktBuf, INT32 *PktSize, UINT32 TimeOut_ms); //// Available after ver. 2.0.0
#ifdef __cplusplus
}
#endif // __cplusplus
#endif ////#ifndef _PPCS_API___INC_H_ | 45.337662 | 149 | 0.775709 |
0017b5ba0636165905ff24cb7ee19d17670d8241 | 1,096 | h | C | chrome/browser/profiles/profile_android.h | nagineni/chromium-crosswalk | 5725642f1c67d0f97e8613ec1c3e8107ab53fdf8 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 231 | 2015-01-08T09:04:44.000Z | 2021-12-30T03:03:10.000Z | chrome/browser/profiles/profile_android.h | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-12-13T19:44:12.000Z | 2021-12-13T19:44:12.000Z | chrome/browser/profiles/profile_android.h | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 268 | 2015-01-21T05:53:28.000Z | 2022-03-25T22:09:01.000Z | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
#define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/compiler_specific.h"
#include "base/supports_user_data.h"
class Profile;
// Android wrapper around profile that provides safer passage from java and
// back to native.
class ProfileAndroid : public base::SupportsUserData::Data {
public:
static ProfileAndroid* FromProfile(Profile* profile);
static Profile* FromProfileAndroid(jobject obj);
static bool RegisterProfileAndroid(JNIEnv* env);
static jobject GetLastUsedProfile(JNIEnv* env, jclass clazz);
explicit ProfileAndroid(Profile* profile);
virtual ~ProfileAndroid();
base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
private:
Profile* profile_; // weak
base::android::ScopedJavaGlobalRef<jobject> obj_;
};
#endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
| 29.621622 | 75 | 0.788321 |
bb5e87ddde9bea680d08fac7344d9a1487b84f74 | 114,536 | h | C | include/il2cpp/Dpr/Battle/Logic/Handler/Waza.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | 1 | 2022-01-15T20:20:27.000Z | 2022-01-15T20:20:27.000Z | include/il2cpp/Dpr/Battle/Logic/Handler/Waza.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | include/il2cpp/Dpr/Battle/Logic/Handler/Waza.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | #pragma once
#include "il2cpp.h"
Dpr_Battle_Logic_Handler_Waza_HandlerGetFunc_o* Dpr_Battle_Logic_Handler_Waza__getHandlerGetFunc (int32_t waza, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__Add (Dpr_Battle_Logic_EventSystem_o* pEventSystem, Dpr_Battle_Logic_BTL_POKEPARAM_o* poke, int32_t waza, uint32_t subPri, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__canRegister (Dpr_Battle_Logic_EventSystem_o* pEventSystem, uint8_t pokeID, int32_t waza, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__Remove (Dpr_Battle_Logic_EventSystem_o* pEventSystem, Dpr_Battle_Logic_BTL_POKEPARAM_o* poke, int32_t waza, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__RemoveForce (Dpr_Battle_Logic_EventSystem_o* pEventSystem, Dpr_Battle_Logic_BTL_POKEPARAM_o* poke, int32_t waza, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__removeHandlerForce (Dpr_Battle_Logic_EventSystem_o* pEventSystem, uint8_t pokeID, int32_t waza, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__RemoveForceAll (Dpr_Battle_Logic_EventSystem_o* eventSystem, Dpr_Battle_Logic_BTL_POKEPARAM_o* poke, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_checkActStart_isMyWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_IsMyEvent (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint16_t pokeIDLabel, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_ExeCheck2nd_FailOnRaid (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_ExeCheck2nd_FailOnRaidPlayerSide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_ExeCheck2nd_FailOnRaidBoss (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_ExeCheck3rd_FailToG (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_ExeCheck3rd_FailToGWall (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
uint8_t Dpr_Battle_Logic_Handler_Waza__getEventVarTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, int32_t n, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_SetWazaEffectIndex (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t effectIndex, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Texture (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Texture (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TrickRoom (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrickRoom (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Juryoku (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juryoku (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kiribarai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kiribarai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kawarawari (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kawarawari_DmgProc1 (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kawarawari_DmgProcEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kawarawari_DmgDetermine (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__handler_Kawarawari_SkipCheck (Dpr_Battle_Logic_EventFactor_SkipCheckHandlerArgs_o** args, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tobigeri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tobigeri_NoEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Monomane (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Monomane (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Sketch (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sketch (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
int32_t Dpr_Battle_Logic_Handler_Waza__sketch_GetTargetWaza (Dpr_Battle_Logic_BTL_POKEPARAM_o* target, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KonoyubiTomare (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KonoyubiTomare_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KonoyubiTomare_Exe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KonoyubiTomare_TemptTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KonoyubiTomare_TurnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ikarinokona (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ikarinokona_TemptTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KumoNoSu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KumoNoSu_NoEffCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KumoNoSu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KuroiKiri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KuroiKiri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Haneru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Haneru_CheckFail (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Haneru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Oiwai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Oiwai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TeWoTunagu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TeWoTunagu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Noroi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Noroi_WazaParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Noroi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Noroi_ExeCheck3rd_FailToGWall (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Denjiha (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Denjiha (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NayamiNoTane (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NayamiNoTane_NoEff (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NayamiNoTane (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Yumekui (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Yumekui (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TriAttack (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TriAttack (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Nettou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nettou (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_UtakatanoAria (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_UtakatanoAria (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Osyaberi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Osyaberi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Makituku (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Makituku (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Makituku_Str (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__makituku_GetStr (uint16_t* pStrID, int32_t wazano, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Uzusio (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Uzusio_CheckHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Uzusio_Dmg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_IkariNoMaeba (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IkariNoMaeba (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
uint16_t Dpr_Battle_Logic_Handler_Waza__common_CalcFixDamageByDefenderHp (Dpr_Battle_Logic_BTL_POKEPARAM_o* target, uint8_t numerator, uint8_t denominator, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Gamusyara (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Gamusyara_CheckNoEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Gamusyara (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TikyuuNage (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TikyuuNage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Takuwaeru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Takuwaeru_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Takuwaeru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hakidasu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hakidasu_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hakidasu_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hakidasu_Done (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Nomikomu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nomikomu_Ratio (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Counter (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Counter_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Counter_Target (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Counter_CalcDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MilerCoat (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MilerCoat_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MilerCoat_Target (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MilerCoat_CalcDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MetalBurst (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MetalBurst_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MetalBurst_Target (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MetalBurst_CalcDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_Counter_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, int32_t* dmgType, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_Counter_SetTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, int32_t* dmgType, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_Counter_CalcDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, int32_t* dmgType, int32_t* ratio, uint8_t* pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_Counter_GetRec (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, int32_t* dmgType, Dpr_Battle_Logic_BTL_POKEPARAM_WAZADMG_REC_o* rec, uint8_t* pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Totteoki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Totteoki (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ibiki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ibiki_CheckFail_1 (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ibiki_CheckFail_2 (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Fuiuti (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Fuiuti_NoEff (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__handler_Fuiuti_CheckSuccess (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t targetPokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Daibakuhatsu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Daibakuhatsu_ExeStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Daibakuhatsu_DmgDetermine (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Daibakuhatsu_ExeFix (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kiaidame (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kiaidame (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Juden (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juden_Exe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juden_RemoveAllTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juden_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juden_WazaStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Juden_WazaEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HorobiNoUta (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HorobiNoUta_Exe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_YadorigiNoTane (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_YadorigiNoTane_Param (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NekoNiKoban (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NekoNiKoban (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AquaRing (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AquaRing (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Abareru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Abareru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__abareru_Unlock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Abareru_SeqEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Abareru_turnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Sawagu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sawagu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__Sawagu_CureLock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sawagu_SeqEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sawagu_turnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sawagu_CheckSickFail (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sawagu_CheckInemuri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Korogaru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Korogaru_ExeFix (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Korugaru_Avoid (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Korogaru_NoEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Korogaru_SeqEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_Korogaru_Unlock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Korogaru_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TripleKick (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TripleKick (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TripleKick_HitCount (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GyroBall (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GyroBall (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
uint16_t Dpr_Battle_Logic_Handler_Waza__common_CalcAgility (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Revenge (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Revenge (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Jitabata (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Jitabata (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Karagenki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Karagenki_AtkPow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Karagenki_WazaPow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Sippegaesi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sippegaesi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Funka (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Funka (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Siboritoru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Siboritoru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Siomizu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Siomizu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_RenzokuGiri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_RenzokuGiri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Dameosi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dameosi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ketaguri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ketaguri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_WeatherBall (const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__get_WeatherBallParam (Dpr_Battle_Logic_Handler_Waza_WeatherBallParam_o* param, uint8_t weather, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WeatherBall_Type (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WeatherBall_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WeatherBall_ChangeGWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tatumaki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tatumaki_checkHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tatumaki (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kaminari (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kaminari_checkHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kaminari_excuseHitCalc (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kaminari_hitRatio (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Fubuki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Fubuki (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ZettaiReido (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ZettaiReido_hitRatio (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Jisin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Jisin_checkHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Jisin_damage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SabakiNoTubute (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SabakiNoTubute (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MultiAttack (const MethodInfo* method_info);
uint8_t Dpr_Battle_Logic_Handler_Waza__multiAttack_GetType (uint16_t item, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MultiAttack (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MultiAttack_ChangeGWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TechnoBaster (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__technoBaster_GetParam (uint8_t* pType, uint8_t* pEffectIdx, uint16_t item, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TechnoBaster (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TechnoBaster_ChangeGWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MezameruPower (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MezameruPower_Type (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hatakiotosu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hatakiotosu_WazaPow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hatakiotosu_EndHit (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MagicCoat (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicCoat_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicCoat (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicCoat_Wait (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicCoat_Reflect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicCoat_TurnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Dorobou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dorobou_Start (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dorobou (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Trick (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Trick (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Naminori (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Naminori_checkHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Naminori (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Fumituke (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Fumituke_DamegeProc (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Fumituke_HitCheckSkip (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DaiMaxHou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DaiMaxHou_DamegeProc (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Mineuti (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mineuti (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Koraeru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Koraeru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Koraeru_Check (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Koraeru_TurnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Mamoru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_StartSeq (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_ExeFail (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_Core (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__IncrementMamoruCounter (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__mamoru_MsgAfterCritical (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_Dmg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_MsgAfterCritical (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mamoru_Off (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Recycle (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Recycle (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PsycoShift (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PsycoShift (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Itamiwake (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Itamiwake (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__itamiwake_CalcShiftHP (int32_t* pAttackerHP, int32_t* pDefenderHP, Dpr_Battle_Logic_BTL_POKEPARAM_o* pAttacker, Dpr_Battle_Logic_BTL_POKEPARAM_o* pDefender, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Haradaiko (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Haradaiko (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Feint (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Feint_MamoruBreak (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Feint_NoEffCheckBegin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Feint_NoEffCheckEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__SleepGuardSideEffects (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, bool wakeFlag, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__SleepGuardSideEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t attackPokeId, uint8_t targetPokeId, bool wakeFlag, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Feint_AfterDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_feint_proc (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, uint16_t strID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_mamoruBreakAfter (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t attackPokeID, Dpr_Battle_Logic_BTL_POKEPARAM_o* target, uint16_t strID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_mamoruBreak_RemoveSideEff (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, Dpr_Battle_Logic_BTL_POKEPARAM_o* target, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_IsExistGuardTypeSideEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t targetPokeID, bool bIncludeNotCountupType, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_IjigenHall (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IjigenHall_AfterDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TuboWoTuku (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TuboWoTuku (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Nemuru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nemuru_exeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nemuru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Meromero (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Meromero_CheckNoEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Texture2 (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Texture2 (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Encore (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Encore (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Chouhatu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Chouhatu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kanasibari (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kanasibari (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
int32_t Dpr_Battle_Logic_Handler_Waza__kanashibari_GetTargetWaza (Dpr_Battle_Logic_BTL_POKEPARAM_o* target, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Present (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Present_Check (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Present_Fix (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Present_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Fuuin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Fuuin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Alomatherapy (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Alomatherapy_Exe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Alomatherapy (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_IyasiNoSuzu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IyasiNoSuzu_Exe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IyasiNoSuzu_RemoveAllTarget (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IyasiNoSuzu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_CureFriendPokeSick (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t attackerID, bool excludeOutOfWazaTarget, bool canWriteGenFlag, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Okimiyage (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Okimiyage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Urami (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Urami (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_JikoAnji (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_JikoAnji (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HeartSwap (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HeartSwap (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PowerSwap (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PowerSwap (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GuardSwap (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GuardSwap (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PowerTrick (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PowerTrick (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PowerShare (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PowerShare (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GuardShare (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GuardShare (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_LockON (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_LockON (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Dokudoku (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dokudoku (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dokudoku_Done (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Reflector (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Reflector (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HikariNoKabe (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HikariNoKabe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SinpiNoMamori (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SinpiNoMamori (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SiroiKiri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SiroiKiri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Oikaze (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Oikaze (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Makibisi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Makibisi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Dokubisi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Dokubisi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_StealthRock (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_StealthRock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NebaNebaNet (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NebaNebaNet (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_WideGuard (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WideGuard_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WideGuard (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TatamiGaeshi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TatamiGaeshi_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TatamiGaeshi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_SideEffectStdMsg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, int32_t side, int32_t effect, Dpr_Battle_Logic_BTL_SICKCONT_o* cont, uint16_t strID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_SideEffectCore (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, int32_t side, int32_t effect, Dpr_Battle_Logic_BTL_SICKCONT_o* cont, int32_t strType, uint32_t strID, int32_t strArg, bool replaceStrArg0ByExpandSide, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hensin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hensin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MikadukiNoMai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MikadukiNoMai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_IyasiNoNegai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IyasiNoNegai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Negaigoto (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Negaigoto (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Miraiyoti (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Miraiyoti (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Miraiyoti_Decide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_delayAttack (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, uint8_t targetPos, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HametuNoNegai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HametuNoNegai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HametuNoNegai_Decide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ieki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ieki (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Narikiri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Narikiri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TonboGaeri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TonboGaeri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KousokuSpin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KousokuSpin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_BatonTouch (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_BatonTouch (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Teleport (const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__teleport_isQuitBattle (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__teleport_canQuitBattle (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pFailCause, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_ExeCheck_QuitBattle (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_ExeCheck_ChangePokemon (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_QuitBattle (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_ChangePokemon (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Teleport_ExMsg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Nagetukeru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nagetukeru_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nagetukeru_WazaPower (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nagetukeru_DmgProcStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nagetukeru_DmgAfter (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nagetukeru_Done (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DenjiFuyuu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DenjiFuyuu_CheckFail (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DenjiFuyuu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tedasuke (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tedasuke_SkipAvoid (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tedasuke_CheckHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tedasuke_Ready (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__tedasuke_IsSuccess (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tedasuke_WazaPow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tedasuke_TurnCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FukuroDataki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FukuroDataki (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FukuroDataki_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_BTL_POKEPARAM_o* Dpr_Battle_Logic_Handler_Waza__common_FukuroDataki_GetParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t myPokeID, uint8_t idx, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Nekodamasi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Nekodamasi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Deaigasira (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Deaigasira (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AsaNoHizasi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AsaNoHizasi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Sunaatume (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sunaatume (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FlowerHeal (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FlowerHeal (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SoraWoTobu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SoraWoTobu_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ShadowDive (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ShadowDive_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ShadowDive_AfterDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tobihaneru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tobihaneru_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Diving (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Diving_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AnaWoHoru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AnaWoHoru_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SolarBeam (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SolarBeam_TameSkip (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SolarBeam_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SolarBeam_Power (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GodBird (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GodBird_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_RocketZutuki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_RocketZutuki_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tuibamu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tuibamu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hoobaru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hoobaru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hoobaru_Decide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Waruagaki (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Waruagaki_KickBack (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Waruagaki_SeqStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Waruagaki_WazaParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Michidure (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Michidure_CheckFail (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__stickMitidureFactor (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Michidure_Ready (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__removeMitidureFactor (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Michidure_ActStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Michidure_WazaDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Onnen (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__stickOnnenFactor (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__removeOnnenFactor (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Onnen_Ready (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Onnen_WazaDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Onnen_ActStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tiisakunaru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tiisakunaru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Marukunaru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Marukunaru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Haneyasume (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Haneyasume (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KiaiPunch (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KiaiPunch (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_YubiWoFuru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_YubiWoFuru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_YubiWoFuru_Msg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SizenNoTikara (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SizenNoTikara (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SizenNoTikara_Msg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Negoto (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Negoto (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Manekko (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Manekko_CheckParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
int32_t Dpr_Battle_Logic_Handler_Waza__manekko_GetTargetWaza (Dpr_Battle_Logic_BattleEnv_o* pBattleEnv, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GensiNoTikara (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GensiNoTikara (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_BenomShock (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_BenomShock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tatarime (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tatarime (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Acrobat (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Acrobat (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AsistPower (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AsistPower (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HeavyBomber (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HeavyBomber (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HeatStamp (const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ElectBall (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ElectBall (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_EchoVoice (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_EchoVoice (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Katakiuti (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Katakiuti (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ikasama (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ikasama (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_BodyPress (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_BodyPress (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Mizubitasi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Mizubitasi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MahouNoKona (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MahouNoKona (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SimpleBeem (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SimpleBeem (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NakamaDukuri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NakamaDukuri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ClearSmog (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ClearSmog (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Yakitukusu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Yakitukusu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TomoeNage (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TomoeNage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hoeru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hoeru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Utiotosu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Utiotosu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_UtiotosuEffect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t atkPokeID, uint8_t targetPokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_UtiotosuEffect_falldown (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t atkPokeID, uint8_t targetPokeID, Dpr_Battle_Logic_BTL_POKEPARAM_o* bppTarget, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KarawoYaburu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KarawoYaburu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MirrorType (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MirrorType (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_BodyPurge (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_BodyPurge (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PsycoShock (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PsycoShock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NasiKuzusi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NasiKuzusi_CalcDmg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NasiKuzusi_HitCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_WonderRoom (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_WonderRoom (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MagicRoom (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MagicRoom (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Inotigake (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Inotigake_CalcDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Inotigake_CheckDead (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_OsakiniDouzo (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_OsakiniDouzo (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Sakiokuri (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Sakiokuri (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Rinsyou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Rinsyou (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Rinsyou_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FastGuard (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FastGuard (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SideChange (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SideChange (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_CourtChange (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CourtChange (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_InisieNoUta (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_InisieNoUta (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Seityou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Seityou (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FreezeBolt (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FreezeBolt_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FlameSoul (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FlameSoul_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
int32_t Dpr_Battle_Logic_Handler_Waza__GetCombiWazaType (int32_t waza1, int32_t waza2, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_CombiWazaCommon (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_Decide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_TypeMatch (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_Pow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_ChangeEff (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CombiWaza_AfterDmg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Halloween (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Halloween (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Morinonoroi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Morinonoroi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FlowerGuard (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tagayasu_CheckHide (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FlowerGuard (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__common_GuardUpByPokeType (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, uint8_t pokeType, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TodomeBari (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TodomeBari (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KogoeruHadou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KogoeruHadou (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hikkurikaesu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hikkurikaesu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NeraiPunch (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NeraiPunch (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SuteZerifu (const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FlyingPress (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FlyingPress (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FreezDry (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FreezDry (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Souden (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Souden (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GrassField (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GrassField (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MistField (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MistField (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ElecField (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ElecField (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PhychoField (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PhychoField (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_common_GroundSet (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, uint8_t ground, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KingShield (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KingShield (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__kingShield_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KingShield_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KingShield_MsgAfterCritical (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KingShield_DmgReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Blocking (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__Blocking_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Blocking_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Blocking_DmgReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ThousanArrow (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ThousanArrow_CancelFloat (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ThousanArrow_AffEnable (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ThousanArrow_CheckAffine (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ThousanArrow (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HappyTime (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HappyTime (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ZibaSousa (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ZibaSousa (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_BenomTrap (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_BenomTrap (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PlasmaFist (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PlasmaFist (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_FairyLock (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_FairyLock (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Funjin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Funjin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_GeoControl (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_GeoControl_TameStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TrickGuard (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrickGuard (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NeedleGuard (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__needleGuard_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NeedleGuard_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NeedleGuard_DmgReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SouthernWave (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_southernWave (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_IjigenRush (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IjigenRush (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_IjigenRush_AfterDamage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AuraGuruma (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AuraGuruma (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AuraGuruma_Waza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AuraGuruma_ChangeGWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DarkHole (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DarkHole (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tootika (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__tootika_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t* pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tootika_Success (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tootika_DmgReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MezameruDance (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MezameruDance_WazaParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kahundango (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kahundango_ExecuteCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kahundango_RecoverCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kahundango_RecoverFix (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kahundango_Check_Affinity (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_CorePunisher (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_CorePunisher_HitReal (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kagenui (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kagenui_HitReal (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Kuraituku (const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__kuraitukuCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, Dpr_Battle_Logic_BTL_POKEPARAM_o* attack, Dpr_Battle_Logic_BTL_POKEPARAM_o* target, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__kuraitukuSet (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t attackPokeID, uint8_t targetPokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Kuraituku (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TakoGatame (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TakoGatame_NoEffCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_takoGatame (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Zyouka (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Zyouka (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Tikarawosuitoru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Tikarawosuitoru (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Togisumasu (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Togisumasu (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SpeedSwap (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SpeedSwap (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Moetukiru (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Moetukiru_WazaMeltCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Moetukiru_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Moetukiru_DamageProcEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_KutibasiCanon (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_BeforeFight (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_DamageReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_WazaSeqEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_ReplaceWaza (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_Canceled (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_KutibasiCanon_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TrapShell (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrapShell_BeforeFight (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrapShell_DamageProcEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrapShell_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TrapShell_WazaEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Zidanda (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Zidanda_Dmg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_AuroraVeil (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AuroraVeil_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_AuroraVeil (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Saihai (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Saihai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_MeteorDrive (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MeteorDrive_WazaSeqStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_MeteorDrive_WazaSeqEnd (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_ShadowSteal (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_ShadowSteal_DamageProcStart (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_PhotonGeyser (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_PhotonGeyser_WazaParam (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Hanabisenyou (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hanabisenyou_dmg_determine (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Hanabisenyou_no_effect (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__common_HanabisenyouReaction (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DaiWall (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DaiWall (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DaiWall_NoEffectCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_NeraiUti (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NeraiUti_Tempt (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_NeraiUti_Aim (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_HaisuiNoJin (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HaisuiNoJin_ExeCheck (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_HaisuiNoJin (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_SoulBeat (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SoulBeat_CheckExe (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_SoulBeat_Damage (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Ochakai (const MethodInfo* method_info);
bool Dpr_Battle_Logic_Handler_Waza__ochakai_EatNuts (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Ochakai (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DengekiKutibasi (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DengekiKutibasi (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_TarShot (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_TarShot_Str (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_DragonArrow (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DragonArrow_Param (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DragonArrow_Inc (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_DragonArrow_Msg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_InotiNoSizuku (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_InotiNoSizuku_Msg (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
Dpr_Battle_Logic_EventFactor_EventHandlerTable_array* Dpr_Battle_Logic_Handler_Waza__ADD_Newton (const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza__handler_Newton (Dpr_Battle_Logic_EventFactor_EventHandlerArgs_o** args, uint8_t pokeID, const MethodInfo* method_info);
void Dpr_Battle_Logic_Handler_Waza___cctor (const MethodInfo* method_info);
| 152.918558 | 313 | 0.904266 |
afccde32b987044e9c72d0f7a56d617b10dea865 | 1,689 | h | C | Pods/Fuji-SDKLite/FujiUtilities/Source/VHDispatchURLQueuing.h | bhargavat/AW-iOS-Pods | 8ee6ebd2d273e6166031970f2884d8087c535832 | [
"Apache-2.0"
] | null | null | null | Pods/Fuji-SDKLite/FujiUtilities/Source/VHDispatchURLQueuing.h | bhargavat/AW-iOS-Pods | 8ee6ebd2d273e6166031970f2884d8087c535832 | [
"Apache-2.0"
] | null | null | null | Pods/Fuji-SDKLite/FujiUtilities/Source/VHDispatchURLQueuing.h | bhargavat/AW-iOS-Pods | 8ee6ebd2d273e6166031970f2884d8087c535832 | [
"Apache-2.0"
] | null | null | null | //
// VHDispatchURLQueuing.h
//
// Copyright (c) 2012 VMware Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "VHDispatchSerialQueuing.h"
/**
* \brief Abstract serial queue for use with NSURLConnection delegates
*
* Queues conforming to this protocol can allocate NSURLConnections such that they make their delegate
* callbacks on the queue. A typical object using such a queue might have an implementation like this:
*
* - (void)start
* {
* [self.queue enqueue:
* ^{
* self.connection = [self.queue newConnectionWithRequest:self.request
* delegate:self];
* [self.connection start];
* }];
* }
*/
@protocol VHDispatchURLQueuing <VHDispatchSerialQueuing>
/**
* \brief create an NSURLConnection that makes delegate callbacks on the receiver.
*
* This method must be called on the queue. The connection is not started.
*
* \param request The request to be made by the connection.
* \param delegate The connection delegate. Delegate methods will be called on this queue.
*
* \return a newly allocated, un-started connection.
*/
- (NSURLConnection *)newConnectionWithRequest:(NSURLRequest *)request
delegate:(id<NSURLConnectionDelegate>)delegate;
/**
* \brief detach a new queue for an NSURLConnection.
*
* Depending on the queue implementation this may simply return the receiver, or it may create
* an entirely new queue.
*
* \todo This is a "poor-man's" substitute for a proper factory class. Using this technique saves
* introducing three new classes/six files.
*/
- (id<VHDispatchURLQueuing>)detachQueue;
@end
| 31.277778 | 102 | 0.690349 |
a02a2eed1439adad440f5517ef84615ba58959f3 | 5,915 | h | C | conf/conf_LSM303AGR.h | Gateworks/android_hardware_stm | a83b4a2737d3b984e1d8e2d8752682612e68f2ce | [
"Apache-2.0"
] | 29 | 2017-03-23T16:03:23.000Z | 2022-03-04T07:41:32.000Z | conf/conf_LSM303AGR.h | Gateworks/android_hardware_stm | a83b4a2737d3b984e1d8e2d8752682612e68f2ce | [
"Apache-2.0"
] | 3 | 2017-11-19T07:30:25.000Z | 2020-11-09T15:17:12.000Z | conf/conf_LSM303AGR.h | Gateworks/android_hardware_stm | a83b4a2737d3b984e1d8e2d8752682612e68f2ce | [
"Apache-2.0"
] | 17 | 2017-04-20T23:14:49.000Z | 2021-07-22T05:10:34.000Z | /*
* Copyright (C) 2015 STMicroelectronics
* Armando Visconti - Motion MEMS Product Div.
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CONFIGURATION_SENSOR_LSM303AGR_H
#define CONFIGURATION_SENSOR_LSM303AGR_H
#define SENSORS_ACCELEROMETER_ENABLE (1)
#define SENSORS_MAGNETIC_FIELD_ENABLE (1)
#define SENSORS_UNCALIB_MAGNETIC_FIELD_ENABLE (1 & SENSORS_MAGNETIC_FIELD_ENABLE \
& OS_VERSION_ENABLE)
/* ACCELEROMETER SENSOR */
#define SENSOR_ACC_LABEL "LSM303AGR 3-axis Accelerometer"
#define SENSOR_DATANAME_ACCELEROMETER "lsm303agr_acc"
#define ACCEL_DELAY_FILE_NAME "device/pollrate_ms"
#define ACCEL_ENABLE_FILE_NAME "device/enable_device"
#define ACCEL_RANGE_FILE_NAME "device/range"
#define ACCEL_MAX_RANGE 8*GRAVITY_EARTH
#define ACCEL_MAX_ODR 100
#define ACCEL_POWER_CONSUMPTION 0.033f
#define ACCEL_DEFAULT_FULLSCALE 4
/* MAGNETOMETER SENSOR */
#define SENSOR_MAGN_LABEL "LSM303AGR 3-axis Magnetometer Sensor"
#define SENSOR_DATANAME_MAGNETIC_FIELD "lsm303agr_mag"
#define MAGN_DELAY_FILE_NAME "device/pollrate_ms"
#define MAGN_ENABLE_FILE_NAME "device/enable_device"
#define MAGN_RANGE_FILE_NAME "device/full_scale"
#define CALIBRATION_ENABLE 1
#define MAGN_MAX_RANGE 1600.0f
#define MAGN_MAX_ODR 100
#define MAGN_POWER_CONSUMPTION 0.077f
#define MAGN_DEFAULT_FULLSCALE 50
#define MAGN_MIN_ODR 25
/* INEMO_ENGINE SENSOR */
#define ACC_DEFAULT_RANGE 4
#define MAG_DEFAULT_RANGE 50
#define ACC_DEFAULT_DELAY 100
#define MAG_DEFAULT_DELAY 100
/* SENSOR FUSION */
#define LOCAL_EARTH_MAGNETIC_FIELD 50.0f
#define ACC_GBIAS_THRESHOLD 550e-6
#define MAG_GBIAS_THRESHOLD 1200e-6
/*****************************************************************************/
/* EVENT TYPE */
/*****************************************************************************/
#define EVENT_TYPE_ACCEL EV_MSC
#define EVENT_TYPE_MAG EV_MSC
/* Event Type in accelerometer sensor: see input_set_abs_params() function in your input driver */
#define EVENT_TYPE_ACCEL_X MSC_SERIAL
#define EVENT_TYPE_ACCEL_Y MSC_PULSELED
#define EVENT_TYPE_ACCEL_Z MSC_GESTURE
/* Event Type in magnetometer sensor: see input_set_abs_params() function in your input driver */
#define EVENT_TYPE_MAG_X MSC_SERIAL
#define EVENT_TYPE_MAG_Y MSC_PULSELED
#define EVENT_TYPE_MAG_Z MSC_GESTURE
#define EVENT_TYPE_TIME_MSB MSC_SCAN
#define EVENT_TYPE_TIME_LSB MSC_MAX
/*****************************************************************************/
/* AXIS MAPPING */
/*****************************************************************************/
/* In this section you must define the axis mapping for individuate one only coordinate system ENU
*
* Example:
* y' /| z'
* ^ /
* | / You must define this coordinate system (reference system of board)
* | / in accordance to definition of the axis
* |/ definition in sensors.h file
* +----------------------------------------------+---------> x'
* | ^ x |
* | | ^ z |
* | | | |
* | +-----+---> y | |
* | | ACC | <---+-----+ |
* | | | x | GYR | |
* | +-----+ | | |
* | / +-----+ |
* | |/ y ^ /| z / |
* | z | / |/ |
* | |/ y |
* | +-----+---> x |
* | | MAG | |
* | | | |
* | +-----+ |
* | BOARD |
* +----------------------------------------------+
*
* ACCELEROMETER:
*
* board acc | 0 1 0 |
* [x' y' z'] = [x y z] * | 1 0 0 |
* | 0 0 -1 |
*
*
* MAGNETOMETER:
*
* board mag | 1 0 0 |
* [x' y' z'] = [x y z] * | 0 0 1 |
* | 0 0 1 |
*
*/
static short matrix_acc[3][3] = {
{ 1, 0, 0 },
{ 0, -1, 0 },
{ 0, 0, 1 }
};
static short matrix_mag[3][3] = {
{ 1, 0, 0 },
{ 0, -1, 0 },
{ 0, 0, 1 }
};
/*****************************************************************************/
/* DATA CONVERSION */
/*****************************************************************************/
// conversion of acceleration data to SI units (m/s^2)
#define CONVERT_A (GRAVITY_EARTH / 1000000.0f)
#define CONVERT_A_X (CONVERT_A)
#define CONVERT_A_Y (CONVERT_A)
#define CONVERT_A_Z (CONVERT_A)
#define CONVERT_M (1.0f/10000.0f)// 1uTESLA = 10 mGauss
#define CONVERT_M_X (CONVERT_M)
#define CONVERT_M_Y (CONVERT_M)
#define CONVERT_M_Z (CONVERT_M)
#define MAG_EVENT_HAS_TIMESTAMP 1
#define ACC_EVENT_HAS_TIMESTAMP 1
#define NOT_SET_ACC_INITIAL_STATE 1
#define NOT_SET_MAG_INITIAL_STATE 1
#endif /* CONFIGURATION_SENSOR_LSM303AGR_H */
| 37.201258 | 129 | 0.51885 |
48d6db1b14737bf7ff618f6d0dd0729eaea47979 | 6,635 | h | C | SurgSim/Math/MathConvert-inl.h | dbungert/opensurgsim | bd30629f2fd83f823632293959b7654275552fa9 | [
"Apache-2.0"
] | 24 | 2015-01-19T16:18:59.000Z | 2022-03-13T03:29:11.000Z | SurgSim/Math/MathConvert-inl.h | dbungert/opensurgsim | bd30629f2fd83f823632293959b7654275552fa9 | [
"Apache-2.0"
] | 3 | 2018-12-21T14:54:08.000Z | 2022-03-14T12:38:07.000Z | SurgSim/Math/MathConvert-inl.h | dbungert/opensurgsim | bd30629f2fd83f823632293959b7654275552fa9 | [
"Apache-2.0"
] | 8 | 2015-04-10T19:45:36.000Z | 2022-02-02T17:00:59.000Z | // This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_MATH_MATHCONVERT_INL_H
#define SURGSIM_MATH_MATHCONVERT_INL_H
#include <string>
#include "SurgSim/Framework/Log.h"
namespace
{
const std::string rotationPropertyName = "Quaternion";
const std::string translationPropertyName = "Translation";
const std::string serializeLogger = "Serialization";
};
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int Rows, int Cols, int MOpt>
YAML::Node YAML::convert<typename Eigen::Matrix<Type, Rows, Cols, MOpt>>::encode(
const typename Eigen::Matrix<Type, Rows, Cols, MOpt>& rhs)
{
YAML::Node node;
node.SetStyle(YAML::EmitterStyle::Flow);
if (Cols == 1)
{
for (Eigen::Index i = 0; i < rhs.size(); ++i)
{
node.push_back(rhs(i, 0));
}
}
else
{
for (size_t row = 0; row < Rows; ++row)
{
YAML::Node rowNode;
for (size_t col = 0; col < Cols; ++col)
{
rowNode.push_back(rhs.row(row)[col]);
}
node.push_back(rowNode);
}
}
return node;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int Rows, int Cols, int MOpt>
bool YAML::convert<typename Eigen::Matrix<Type, Rows, Cols, MOpt>>::decode(
const Node& node,
typename Eigen::Matrix<Type, Rows, Cols, MOpt>& rhs) //NOLINT
{
if (! node.IsSequence() || node.size() != Rows)
{
return false;
}
if (Cols == 1)
{
for (size_t i = 0; i < node.size(); ++i)
{
try
{
rhs(i, 0) = node[i].as<Type>();
}
catch (YAML::RepresentationException&)
{
rhs(i, 0) = std::numeric_limits<Type>::quiet_NaN();
auto logger = SurgSim::Framework::Logger::getLogger(serializeLogger);
SURGSIM_LOG(logger, WARNING) << "Bad conversion, using #NaN value. For node: " << node;
}
}
}
else
{
for (size_t row = 0; row < node.size(); ++row)
{
YAML::Node rowNode = node[row];
if (!rowNode.IsSequence() || node.size() != Cols)
{
return false;
}
for (size_t col = 0; col < rowNode.size(); ++col)
{
try
{
rhs.row(row)[col] = rowNode[col].as<Type>();
}
catch (YAML::RepresentationException&)
{
rhs.row(row)[col] = std::numeric_limits<Type>::quiet_NaN();
auto logger = SurgSim::Framework::Logger::getLogger(serializeLogger);
SURGSIM_LOG(logger, WARNING) << "Bad conversion, using #NaN value. For node: " << node;
}
}
}
}
return true;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int QOpt>
YAML::Node YAML::convert<typename Eigen::Quaternion<Type, QOpt>>::encode(
const typename Eigen::Quaternion<Type, QOpt>& rhs)
{
return Node(convert<typename Eigen::Matrix<Type, 4, 1, QOpt>>::encode(rhs.coeffs()));
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int QOpt>
bool YAML::convert<typename Eigen::Quaternion<Type, QOpt>>::decode(
const Node& node,
typename Eigen::Quaternion<Type, QOpt>& rhs) //NOLINT
{
bool result = false;
if (node.IsSequence() && node.size() == 4)
{
result = convert<typename Eigen::Matrix<Type, 4, 1, QOpt>>::decode(node, rhs.coeffs());
}
else
{
Eigen::AngleAxis<Type> angleAxis;
result = convert<typename Eigen::AngleAxis<Type>>::decode(node, angleAxis);
if (result)
{
rhs = angleAxis;
}
}
return result;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int Dim, int TMode, int TOptions>
YAML::Node YAML::convert<typename Eigen::Transform<Type, Dim, TMode, TOptions>>::encode(
const typename Eigen::Transform<Type, Dim, TMode, TOptions>& rhs)
{
typedef typename Eigen::Transform<Type, Dim, TMode, TOptions>::LinearMatrixType LinearMatrixType;
LinearMatrixType linear(rhs.linear());
Eigen::Quaternion<Type, TOptions> quaternion(linear);
Eigen::Matrix<Type, Dim, 1, TOptions> translation(rhs.translation());
Node node;
node[rotationPropertyName] = quaternion;
node[translationPropertyName] = translation;
return node;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type, int Dim, int TMode, int TOptions>
bool YAML::convert<typename Eigen::Transform<Type, Dim, TMode, TOptions>>::decode(
const Node& node,
typename Eigen::Transform<Type, Dim, TMode, TOptions>& rhs) //NOLINT
{
bool result = false;
if (node.IsMap())
{
Eigen::Quaternion<Type, TOptions> rotation(Eigen::Quaternion<Type, TOptions>::Identity());
Eigen::Matrix<Type, Dim, 1, TOptions> translation(Eigen::Matrix<Type, Dim, 1, TOptions>::Zero());
if (node[rotationPropertyName].IsDefined())
{
rotation = node[rotationPropertyName].as<Eigen::Quaternion<Type, TOptions>>();
result = true;
}
if (node[translationPropertyName].IsDefined())
{
translation = node[translationPropertyName].as<Eigen::Matrix<Type, Dim, 1, TOptions>>();
result = true;
}
rhs.makeAffine();
rhs.linear() = rotation.matrix();
rhs.translation() = translation;
}
return result;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type>
YAML::Node YAML::convert<typename Eigen::AngleAxis<Type>>::encode(
const typename Eigen::AngleAxis<Type>& rhs)
{
Node node;
node.SetStyle(EmitterStyle::Flow);
node["Angle"] = rhs.angle();
node["Axis"] = convert<typename Eigen::Matrix<Type, 3, 1>>::encode(rhs.axis());
return node;
}
SURGSIM_DOUBLE_SPECIALIZATION
template <class Type>
bool YAML::convert<typename Eigen::AngleAxis<Type>>::decode(
const Node& node,
typename Eigen::AngleAxis<Type>& rhs) //NOLINT
{
bool result = false;
if (node.IsMap() && node["Angle"].IsDefined() && node["Axis"].IsDefined())
{
try
{
rhs.angle() = node["Angle"].as<Type>();
}
catch (RepresentationException&)
{
rhs.angle() = std::numeric_limits<Type>::quiet_NaN();
auto logger = SurgSim::Framework::Logger::getLogger(serializeLogger);
SURGSIM_LOG(logger, WARNING) << "Bad conversion, using #NaN value. For node: " << node;
}
result = convert<typename Eigen::Matrix<Type, 3, 1>>::decode(node["Axis"], rhs.axis());
}
return result;
}
template<class T>
bool YAML::tryConvert(const boost::any& any, YAML::Node* node)
{
if (typeid(T) == any.type())
{
*node = boost::any_cast<T>(any);
return true;
}
return false;
}
#endif // SURGSIM_MATH_MATHCONVERT_INL_H
| 27.417355 | 99 | 0.685456 |
857fa46c1d36f75e080502f256134f33fe8292df | 19,943 | c | C | sys/io/up.c | toto112358/scripts | ce48022e5e2f2dcc208c488791c194e5c1932726 | [
"Unlicense"
] | null | null | null | sys/io/up.c | toto112358/scripts | ce48022e5e2f2dcc208c488791c194e5c1932726 | [
"Unlicense"
] | null | null | null | sys/io/up.c | toto112358/scripts | ce48022e5e2f2dcc208c488791c194e5c1932726 | [
"Unlicense"
] | null | null | null | /*
* UNIBUS SMD disk driver
*
* undone:
* Add bad sector forwarding code
* Check that offset recovery code works
* unibus mapping is suboptimal; if the queue gets long,
* buffered data paths will be underused
*/
#include "sys/param.h"
#include "sys/buf.h"
#include "sys/conf.h"
#include "sys/user.h"
#include "sys/up.h"
#include "sys/ubaddr.h"
#include "sys/subaddr.h"
#include "sys/diskio.h"
#include "sys/file.h"
#define NOUPSEEK 1 /* because emulex doesn't do it right */
/*
* hardware registers
*/
struct updevice
{
unsigned short upcs1; /* control and status register 1 */
short upwc; /* word count register */
unsigned short upba; /* UNIBUS address register */
unsigned short upda; /* desired address register */
unsigned short upcs2; /* control and status register 2 */
unsigned short upds; /* drive status */
unsigned short uper1; /* error register 1 */
unsigned short upas; /* attention summary */
unsigned short upla; /* look ahead */
unsigned short updb; /* data buffer */
unsigned short upmr; /* maintenance */
unsigned short updt; /* drive type */
unsigned short upsn; /* serial number */
unsigned short upof; /* offset register */
unsigned short updc; /* desired cylinder address register */
unsigned short uphr; /* holding register */
unsigned short upmr2; /* maintenance register 2 */
unsigned short uper2; /* error register 2 */
unsigned short upec1; /* burst error bit position */
unsigned short upec2; /* burst error bit pattern */
};
/*
* upcs1
*/
#define UP_SC 0100000 /* special condition */
#define UP_TRE 0040000 /* transfer error */
#define UP_IE 0000100 /* interrupt enable */
#define UP_GO 0000001
#define UP_SEEK 004 /* seek */
#define UP_RECAL 006 /* recalibrate */
#define UP_DCLR 010 /* drive clear */
#define UP_OFFSET 014 /* offset */
#define UP_RTC 016 /* return to center-line */
#define UP_PRESET 020 /* read-in preset */
#define UP_SEARCH 030 /* search */
#define UP_WCOM 060 /* write */
#define UP_RCOM 070 /* read data */
/*
* upcs2
*/
#define UPCS2_NED 0010000 /* nonexistent drive */
#define UPCS2_CLR 0000040 /* controller clear */
#define UPCS2_SEL 0000007 /* unit select */
/*
* upds
*/
#define UPDS_ERR 0040000 /* composite drive error */
#define UPDS_PIP 0020000 /* positioning in progress */
#define UPDS_MOL 0010000 /* medium on line */
#define UPDS_DPR 0000400 /* drive present */
#define UPDS_DRY 0000200 /* drive ready */
#define UPDS_VV 0000100 /* volume valid */
#define UPDS_DREADY (UPDS_DPR|UPDS_DRY|UPDS_MOL|UPDS_VV)
/*
* uper1
*/
#define UPER1_DCK 0100000 /* data check */
#define UPER1_WLE 0004000 /* write lock error */
#define UPER1_ECH 0000100 /* ecc hard error */
/*
* uphr: emulex hack
*/
#define UPHR_MAXCYL 0100027 /* max cyl address */
#define UPHR_MAXTRAK 0100030 /* max track address */
#define UPHR_MAXSECT 0100031 /* max sector address */
/*
* upof
*/
#define UPOF_FMT22 0010000 /* 16 bit format */
/* THE SC21 ACTUALLY JUST IMPLEMENTS ADVANCE/RETARD... */
#define UPOF_P400 0020 /* +400 uinches */
#define UPOF_M400 0220 /* -400 uinches */
#define UPOF_P800 0040 /* +800 uinches */
#define UPOF_M800 0240 /* -800 uinches */
#define UPOF_P1200 0060 /* +1200 uinches */
#define UPOF_M1200 0260 /* -1200 uinches */
#define SECTOR 512 /* size of a hardware sector */
/*
* monstrous size tables
* one per type of drive
*/
struct size
{
daddr_t nblocks;
daddr_t blkoff;
} up_sizes[NUPPART] = {
15884, 0*608, /* A=cyl 0 thru 26 */
33440, 27*608, /* B=cyl 27 thru 81 */
495520, 0*608, /* C=cyl 0 thru 814 */
15884, 562*608, /* D=cyl 562 thru 588 */
55936, 589*608, /* E=cyl 589 thru 680 */
#ifndef NOBADSECT
81376, 681*608, /* F=cyl 681 thru 814 */
153728, 562*608, /* G=cyl 562 thru 814 */
#else
81472, 681*608,
153824, 562*608,
#endif
291346, 82*608, /* H=cyl 82 thru 561 */
}, fj_sizes[8] = {
10240, 0*320, /* A=cyl 0 thru 31 */
20480, 32*320, /* B=cyl 32 thru 95 */
232640, 96*320, /* C=cyl 96 thru 822 */
0, 0*320,
0, 0*320,
0, 0*320,
0, 0*320,
#ifndef NOBADSECT
0, 0*320, /* H=cyl 155 thru 822 */
#else
0, 0*320,
#endif
}, fj3_sizes[8] = {
10240, 0*512, /* A=cyl 0 thru 19 */
20480, 20*512, /* B=cyl 20 thru 59 */
246784, 60*512, /* C=cyl 60 thru 541 */
246784, 542*512, /* D=cyl 542 thru 1024 */
0, 0*512,
0, 0*512,
0, 0*512,
#ifndef NOBADSECT
0, 0*512, /* H=cyl 155 thru 822 */
#else
0, 0*512,
#endif
}, cd_sizes[8] = {
10240, 0*160, /* A=cyl 0 thru 63 */
20480, 64*160, /* B=cyl 64 thru 191 */
100960, 192*160, /* C=cyl 192 thru 822 */
0, 0*160,
0, 0*160,
0, 0*160,
0, 0*160,
#ifndef NOBADSECT
100960, 0*160, /* H=cyl 0 thru 630 */
#else
100960, 0*160,
#endif
}, fj1_sizes[8] = {
1024, 0*256, /* cyl 0 through 3 */
0, 0*256,
0, 0*256,
0, 0*256,
0, 0*256,
0, 0*256,
0, 0*256,
0, 0*256,
};
/*
* tables of per-drive info, mostly sizes of things
* indexed by magic numbers; see uputype
*/
struct upst upst[] = {
32, 19, 3, 4, 32*19, 823, up_sizes, /* 9300/cdc */
/* 9300 actually has 815 cylinders... */
32, 10, 3, 4, 32*10, 823, fj_sizes, /* fujitsu 160m */
32, 5, 3, 4, 32*5, 631, cd_sizes, /* CDC 76 MB */
32, 8, 3, 4, 32*8, 4, fj1_sizes, /* Fixed part of FJ */
32, 16, 3, 4, 32*16, 1024, fj3_sizes, /* fujitsu 330m */
};
unsigned char up_offset[16] = {
UPOF_P400, UPOF_M400, UPOF_P400, UPOF_M400,
UPOF_P800, UPOF_M800, UPOF_P800, UPOF_M800,
UPOF_P1200, UPOF_M1200, UPOF_P1200, UPOF_M1200,
0, 0, 0, 0
};
/*
* things from config
*/
extern int upcnt, sccnt;
extern struct ubaddr scaddr[];
extern struct subaddr upaddr[];
extern struct scctl scctl[];
extern struct updisk updisk[];
extern struct buf upbuf[];
/*
* controller flags, scctl.flags
*/
#define CACTIVE 01 /* xfer in progress */
#define CWAITING 02 /* xfering and timer has ticked */
/*
* unit flags, updisk.flags
*/
#define UACTIVE 01 /* working on this xfer */
#define URXFR 02 /* done with any seeking; ready to roll */
#define UWOL 04 /* waiting for offline drive */
#define UWAITOL 010 /* waiting and timer has ticked */
/*
* device number
* 0100 in the minor device is (temporarily?)
* usurped to indicate bitmapped file systems
* quietly ignore it for now
* when things improve, change the UNIT mask to 037
*/
#define UNIT(d) ((minor(d)>>3) & 027)
#define PART(d) (minor(d) & 07)
/*
* abuse of spare bits of struct buf
*/
#define b_cylin b_resid /* for disksort */
#define b_ubm av_back /* this buffer's map */
int upwstart, upwatch(); /* Have started guardian */
int upwaitdry;
int upopen(), upstrategy(), upread(), upwrite(), upioctl();
struct cdevsw upcdev = cdinit(upopen, nulldev, upread, upwrite, upioctl);
struct bdevsw upbdev = bdinit(upopen, nulldev, upstrategy, 0);
upopen(dev, flag)
int dev, flag;
{
register struct updisk *up;
register struct upst *st;
register int p;
if (upuinit(UNIT(dev)) == 0) {
u.u_error = ENXIO;
return;
}
up = &updisk[UNIT(dev)];
st = &upst[up->type];
p = PART(dev);
if ((up->pinit & (1<<p)) == 0) {
up->nblocks[p] = st->sizes[p].nblocks;
up->blkoff[p] = st->sizes[p].blkoff;
if ((up->blkoff[p] % st->nspc) != 0) {
printf("up minor %d bad blkoff\n", minor(dev));
u.u_error = EINVAL;
return;
}
up->pinit |= (1<<p);
}
}
upuinit(unit)
register int unit;
{
register struct updevice *reg;
register struct updisk *up;
register struct subaddr *ua;
if (unit < 0 || unit > upcnt)
return (0);
ua = &upaddr[unit];
if (ua->ctl < 0)
return (0);
up = &updisk[unit];
if (up->ctl)
return (1);
if (upcinit(ua->ctl) == 0)
return (0);
reg = scctl[ua->ctl].addr;
if ((up->type = uputype(reg, ua->unit)) < 0) {
printf("up%d absent or bad type\n", unit);
return (0);
}
up->unit = ua->unit;
up->ctl = &scctl[ua->ctl];
up->ctl->drives[ua->unit] = up;
return (1);
}
/*
* determine drive type
* very emulex dependent; should look at drive type register too.
* perhaps there should be a way to change it?
* this is called by updump too;
* be prepared to run without memory management
* unit is the hardware unit
* return is an index into upst
*/
int
uputype(reg, unit)
register struct updevice *reg;
int unit;
{
reg->upcs1 = 0; /* conservative */
reg->upcs2 = unit;
if (reg->upcs2&UPCS2_NED) {
reg->upcs1 = UP_DCLR|UP_GO;
return (-1);
}
reg->uphr = UPHR_MAXTRAK;
switch (reg->uphr) {
default:
reg->upcs1 = UP_DCLR|UP_GO;
return (-1);
case 9:
return (unit >= 4 ? 3 : 1); /* fujitsu hack */
case 4:
return (2); /* CDC 76MB hack */
case 7:
return (3); /* Fixed Fujitsu hack */
case 15:
return (4); /* fuji 330m hack */
case 19:
return (0); /* CDC 300 MB hack */
}
}
upcinit(ctl)
int ctl;
{
register struct scctl *sc;
register struct updevice *reg;
if (ctl < 0 || ctl >= sccnt)
return (0);
sc = &scctl[ctl];
if (sc->addr)
return (1);
if ((reg = (struct updevice *)ubaddr(&scaddr[ctl])) == 0
|| ubbadaddr(scaddr[ctl].ubno, ®->upcs1, sizeof(short))) {
printf("sc%d absent\n", ctl);
return (0);
}
reg->upcs2 = UPCS2_CLR;
sc->addr = reg;
sc->ubno = scaddr[ctl].ubno;
if (upwstart == 0) {
timeout(upwatch, (caddr_t)0, HZ);
upwstart++;
}
return (1);
}
upstrategy(bp)
register struct buf *bp;
{
register struct updisk *up;
register struct upst *st;
register int unit;
register int part;
long sz;
int s;
sz = (bp->b_bcount+SECTOR-1)/SECTOR;
unit = UNIT(bp->b_dev);
up = &updisk[unit];
if (up->ctl == 0) {
bp->b_flags |= B_ERROR;
iodone(bp);
return;
}
st = &upst[up->type];
part = PART(bp->b_dev);
if (bp->b_blkno < 0 || bp->b_blkno+sz > up->nblocks[part]) {
if (bp->b_blkno == up->nblocks[part])
bp->b_resid = bp->b_bcount;
else { /* partial read too hard for now */
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
}
iodone(bp);
return;
}
bp->b_cylin = (bp->b_blkno + up->blkoff[part])/st->nspc;
bp->b_ubm = (struct buf *)ubmbuf(up->ctl->ubno, bp, USLP);
s = spl6();
disksort(&up->actf, &up->actl, bp);
if ((up->flags & UACTIVE) == 0) {
upustart(up);
if (up->ctl->actf && (up->ctl->flags & CACTIVE) == 0)
upstart(up->ctl);
}
splx(s);
}
/*
* unit start:
* if there's a block for this drive, start seeking there
*
* up->upcs = UP_IE cancels a pending command in the SC21
* why not up->cs |= UP_IE?
*/
upustart(up)
register struct updisk *up;
{
register struct buf *bp;
register struct updevice *reg;
register struct scctl *sc;
register struct upst *st;
int sn, csn;
int didie = 0;
sc = up->ctl;
if ((bp = up->actf) == NULL)
return (0);
#ifndef NOUPSEEK
if (sc->flags & CACTIVE) { /* can't start seek till xfer done */
sc->softas |= 1<<up->unit;
return (0);
}
#endif
reg = sc->addr;
reg->upcs2 = up->unit;
if ((reg->upds & UPDS_VV) == 0) {
reg->upcs1 = UP_IE|UP_DCLR|UP_GO;
reg->upcs1 = UP_IE|UP_PRESET|UP_GO;
reg->upof = UPOF_FMT22;
didie = 1;
}
if ((reg->upds & (UPDS_DPR|UPDS_MOL)) != (UPDS_DPR|UPDS_MOL)) {
up->flags |= UWOL;
return (didie);
}
if ((up->flags & UACTIVE) == 0) { /* start seek if didn't already */
up->flags |= UACTIVE;
#ifndef NOUPSEEK
st = &upst[up->type];
sn = bp->b_blkno%st->nspc;
sn = (sn + st->nsect - st->sdist) % st->nsect; /* sector to seek to */
csn = sn - (reg->upla>>6);
if (csn < 0)
csn += st->nsect;
if (bp->b_cylin != reg->updc /* seek if off cylinder */
|| csn > st->rdist) { /* or not close enough */
reg->updc = bp->b_cylin;
reg->upda = sn;
reg->upcs1 = UP_IE|UP_SEARCH|UP_GO;
return (1);
}
#endif
}
if ((up->flags & URXFR) == 0) { /* seek done, put on ctl queue */
up->next = NULL;
if (sc->actf == NULL)
sc->actf = up;
else
sc->actl->next = up;
sc->actl = up;
up->flags |= URXFR;
}
return (didie);
}
/*
* Start up a transfer on a drive.
*/
upstart(sc)
register struct scctl *sc;
{
register struct buf *bp;
register struct updisk *up;
register struct updevice *reg;
register struct upst *st;
register c;
uaddr_t uad;
int sn, tn;
loop:
if ((up = sc->actf) == NULL)
return (0);
if ((bp = up->actf) == NULL) {
sc->actf = up->next;
goto loop;
}
sc->flags |= CACTIVE;
st = &upst[up->type];
sn = bp->b_blkno%st->nspc;
tn = sn/st->nsect;
sn %= st->nsect;
reg = sc->addr;
reg->upcs2 = up->unit;
c = 0;
while ((reg->upds&UPDS_DRY) == 0) {
if (++c > 512)
break;
upwaitdry++;
}
if ((reg->upds & UPDS_DREADY) != UPDS_DREADY) {
printf("up%d: not ready", UNIT(bp->b_dev));
if ((reg->upds & UPDS_DREADY) != UPDS_DREADY) {
printf("\n");
sc->flags &=~ (CACTIVE|CWAITING);
sc->errcnt = 0;
up->actf = bp->av_forw;
up->flags &=~ (UACTIVE|URXFR);
bp->b_flags |= B_ERROR;
iodone(bp);
goto loop;
}
printf(" (flakey)\n"); /* inscrutable */
}
reg->updc = bp->b_cylin;
reg->upda = (tn << 8) + sn;
reg->upwc = -bp->b_bcount / sizeof(short);
if (bp->b_flags & B_READ)
c = UP_IE|UP_RCOM|UP_GO;
else
c = UP_IE|UP_WCOM|UP_GO;
bp->b_ubm = (struct buf *)ubinspath(ubmapath(sc->ubno), (ubm_t)bp->b_ubm);
uad = ubadbuf(sc->ubno, bp, (ubm_t)bp->b_ubm);
reg->upba = uad;
reg->upcs1 = c|((uad>>8)&0x300);
return (1);
}
/*
* Handle a disk interrupt.
*/
sc0int(ctl)
int ctl;
{
register struct updevice *reg;
register struct scctl *sc;
register struct updisk *up;
register struct buf *bp;
register int unit, i, as;
int needie;
if (ctl < 0 || ctl >= sccnt) {
printf("sc%d bad intr\n");
return;
}
sc = &scctl[ctl];
if ((reg = sc->addr) == 0) {
printf("sc%d: stray intr\n");
return;
}
needie = 1;
as = (reg->upas & 0377) | sc->softas;
sc->softas = 0;
if ((sc->flags & CACTIVE) == 0) { /* must be a seek */
if (reg->upcs1 & UP_TRE)
reg->upcs1 = UP_TRE;
goto doattn;
}
up = sc->actf;
bp = up->actf;
reg->upcs2 = up->unit;
if ((reg->upds&UPDS_ERR) || (reg->upcs1&UP_TRE)) {
i = 0;
while ((reg->upds & UPDS_DRY) == 0) {
if (++i > 512)
break;
upwaitdry++;
}
if (reg->uper1&UPER1_WLE) {
printf("up%d: write locked\n", UNIT(bp->b_dev));
bp->b_flags |= B_ERROR;
} else if (++sc->errcnt > 27) {
harderr(bp, "up");
printf("cs2=%o er1=%o er2=%o\n",
reg->upcs2&0177777, reg->uper1&0177777, reg->uper2&0177777);
bp->b_flags |= B_ERROR;
} else {
/*
* soft ecc, try to correct
*/
sc->flags &=~ (CACTIVE|CWAITING); /* force retry */
if ((reg->uper1&(UPER1_DCK|UPER1_ECH))==UPER1_DCK)
if (upecc(up))
return; /* probably wrong */
}
/*
* `hard' error. clear and try again
*/
reg->upcs1 = UP_TRE|UP_IE|UP_DCLR|UP_GO;
needie = 0;
if ((sc->errcnt&07) == 4 && (sc->flags & CACTIVE) == 0) {
reg->upcs1 = UP_RECAL|UP_IE|UP_GO;
sc->recal = 0;
goto nextrecal;
}
}
/*
* Advance recalibration finite state machine
* if recalibrate in progress, through
* RECAL
* SEEK
* OFFSET (optional)
* RETRY
*/
switch (sc->recal) {
case 1:
reg->updc = bp->b_cylin;
reg->upcs1 = UP_SEEK|UP_IE|UP_GO;
goto nextrecal;
case 2:
if (sc->errcnt < 16 || (bp->b_flags&B_READ) == 0)
goto donerecal;
reg->upof = up_offset[sc->errcnt & 017] | UPOF_FMT22;
reg->upcs1 = UP_IE|UP_OFFSET|UP_GO;
nextrecal:
sc->recal++;
sc->flags |= CACTIVE;
return;
donerecal:
case 3:
sc->recal = 0;
sc->flags &=~ CACTIVE;
break;
}
if (sc->flags & CACTIVE) { /* `active' means we're done */
if (sc->errcnt >= 16) {
reg->upof = UPOF_FMT22;
reg->upcs1 = UP_RTC|UP_GO|UP_IE;
while (reg->upds & UPDS_PIP)
DELAY(25);
needie = 0;
}
sc->flags &=~ (CACTIVE|CWAITING);
sc->errcnt = 0;
sc->actf = up->next;
up->flags &=~ (UACTIVE|URXFR);
up->actf = bp->av_forw;
bp->b_resid = (-reg->upwc * sizeof(short));
ubmfree(sc->ubno, (ubm_t)bp->b_ubm);
iodone(bp);
if (up->actf)
if (upustart(up))
needie = 0;
}
as |= reg->upas;
as &= ~(1<<up->unit);
doattn:
/*
* Process other units which need attention.
*/
for (unit = 0, i = 1; unit < NSCUP && as; i <<= 1, unit++) {
if ((as & i) == 0)
continue;
as &= ~i;
reg->upas = i;
if ((up = sc->drives[unit]) != NULL && upustart(up))
needie = 0;
}
if (sc->actf && (sc->flags & CACTIVE) == 0)
if (upstart(sc))
needie = 0;
if (needie)
reg->upcs1 = UP_IE; /* why bother? */
}
upread(dev)
dev_t dev;
{
physio(upstrategy, &upbuf[UNIT(dev)], dev, B_READ, minphys);
}
upwrite(dev)
dev_t dev;
{
physio(upstrategy, &upbuf[UNIT(dev)], dev, B_WRITE, minphys);
}
upioctl(dev, cmd, addr, flag)
dev_t dev;
int cmd;
caddr_t addr;
int flag;
{
register struct updisk *up;
long parts[2];
up = &updisk[UNIT(dev)];
switch (cmd) {
case DIOSSIZ:
if ((flag & FWRITE) == 0) {
u.u_error = EBADF;
return;
}
if (copyin(addr, (caddr_t)parts, sizeof(parts)) < 0) {
u.u_error = EFAULT;
return;
}
/*
* why test this? see comments above upstrategy
*/
if ((parts[0] % upst[up->type].nspc) != 0) {
u.u_error = EINVAL;
return;
}
up->blkoff[PART(dev)] = parts[0];
up->nblocks[PART(dev)] = parts[1];
return;
case DIOGSIZ:
parts[0] = up->blkoff[PART(dev)];
parts[1] = up->nblocks[PART(dev)];
if (copyout((caddr_t)parts, addr, sizeof(parts)) < 0)
u.u_error = EFAULT;
return;
default:
u.u_error = ENOTTY;
return;
}
}
/*
* correct an ECC error and restart the transfer
* the error is (upec1-1) bits into the current sector;
* at that point, the bits set in upec2 are wrong.
*
* should be able just to set the GO bit and proceed,
* but emulex insists we do DCLR first, or so the book says,
* because DCK sets ERR in upds
*/
upecc(up)
register struct updisk *up;
{
register struct updevice *reg;
register struct scctl *sc;
register struct buf *bp;
register int i;
int nxf;
unsigned int mask;
uaddr_t uad, lastua;
int xc, xa;
if ((bp = up->actf) == NULL || (sc = up->ctl) == NULL)
panic("upecc");
reg = sc->addr;
ubmflush(sc->ubno, ubmpath((ubm_t)bp->b_ubm));
lastua = reg->upba + ((reg->upcs1&0x300)<<8);
nxf = bp->b_bcount + (reg->upwc * sizeof(short));
i = reg->upec1 - 1; /* -1 makes 0 origin */
uad = lastua - (nxf > SECTOR ? SECTOR : nxf) + ((i&~07)>>3);
mask = reg->upec2;
mask <<= i&07;
for (; uad < lastua && mask; mask >>= 8, uad++)
ubputc(sc->ubno, uad, ubgetc(sc->ubno, uad)^mask);
printf("up%d%o: soft ecc sec %ld\n", UNIT(bp->b_dev), PART(bp->b_dev),
bp->b_blkno + nxf/SECTOR - 1);
sc->flags |= CACTIVE; /* either complete or continuing */
if (reg->upwc == 0)
return (0);
#ifdef notdef
reg->uper1 = 0;
reg->upcs1 |= UP_GO;
#else /* clear wretched emulex error */
xc = reg->updc;
xa = reg->upda;
/* ba, wc undisturbed by DCLR */
reg->upcs1 = UP_TRE|UP_IE|UP_DCLR|UP_GO;
reg->updc = xc;
reg->upda = xa;
reg->upba = lastua;
i = (lastua >> 8) & 0x300;
i |= UP_IE|UP_GO|UP_RCOM;
reg->upcs1 = i;
#endif
return (1);
}
/*
* check for offline drives and hung controllers
*/
upwatch()
{
register struct scctl *sc;
register struct updisk *up;
register struct updevice *reg;
register struct buf *bp;
register int ounit;
register int s;
s = spl6();
timeout(upwatch, (caddr_t)0, 15*HZ);
for (up = &updisk[upcnt-1]; up >= updisk; up--) {
if ((up->flags & UWOL) == 0)
continue;
reg = up->ctl->addr;
ounit = reg->upcs2 & UPCS2_SEL;
reg->upcs2 = up->unit;
if ((reg->upds & (UPDS_DPR|UPDS_MOL)) != (UPDS_DPR|UPDS_MOL)) {
if ((up->flags & UWAITOL) == 0) {
up->flags |= UWAITOL;
reg->upcs2 = ounit;
continue;
}
printf("up%d offline\n", up - updisk);
while ((bp = up->actf) != NULL) {
bp->b_flags |= B_ERROR;
up->actf = bp->av_forw;
ubmfree(up->ctl->ubno, (ubm_t)bp->b_ubm);
iodone(bp);
}
}
up->flags &=~ (UWAITOL|UWOL);
upustart(up);
reg->upcs2 = ounit;
}
for (sc = &scctl[sccnt-1]; sc >= scctl; sc--) {
if (sc->flags & CACTIVE) {
if ((sc->flags & CWAITING) == 0)
sc->flags |= CWAITING;
else {
sc->addr->upcs2 = UPCS2_CLR;
printf("sc%d hung, kicked\n", sc - scctl);
sc->flags &=~ (CWAITING|CACTIVE);
}
}
if (sc->actf && (sc->flags & CACTIVE) == 0)
upstart(sc);
}
splx(s);
}
| 23.297897 | 75 | 0.611392 |
e3198ce5c88efbb2e9d7afc4d6fe9407941b7cef | 1,040 | h | C | src/sort/cpp/sort.h | M3nin0/data-algorithm | dd840873b7efd3698ff6933390df015acb254252 | [
"BSD-2-Clause"
] | 5 | 2019-05-31T01:52:15.000Z | 2021-06-07T19:43:41.000Z | src/sort/cpp/sort.h | M3nin0/data-algorithm | dd840873b7efd3698ff6933390df015acb254252 | [
"BSD-2-Clause"
] | 2 | 2019-09-14T19:18:13.000Z | 2019-10-05T19:34:57.000Z | src/sort/cpp/sort.h | M3nin0/data-algorithm | dd840873b7efd3698ff6933390df015acb254252 | [
"BSD-2-Clause"
] | null | null | null | #ifndef SORT_HEADER
#define SORT_HEADER
void SelectionSort(int elements[], int size) {
for(int i = 0; i < size; i++) {
int min = i;
int actual_element = elements[i];
// Buscando o menor elemento
for(int j = i + 1; j < size; j++)
if (elements[j] < elements[min])
min = j;
elements[i] = elements[min];
elements[min] = actual_element;
}
}
void BubbleSort(int * elements, int size) {
for(int j = 0; j < size - 1; j++) {
for(int i = 0; i < size - 1; i++) {
// Compara os pares (Atual | Próximo)
if (elements[i] > elements[i + 1]) {
int aux = elements[i];
elements[i] = elements[i + 1];
elements[i + 1] = aux;
}
}
}
}
void InsertionSort(int elements[], int size) {
for(int i = 1; i < size; i++) {
int j = i - 1;
int key = elements[i];
while (j >= 0 && elements[j] > key) {
// Movendo para a direita
elements[j + 1] = elements[j];
j -= 1;
}
// O final do loop indica que a posição onde o elemento 'key'
// deve ser inserida no array
elements[j + 1] = key;
}
}
#endif
| 21.666667 | 63 | 0.571154 |
e24e91065999f10587550349b2faef9eb597bf83 | 2,187 | h | C | ThoughtworksWeChat/Extensions/UIScrollView+TWRefresh.h | snmhm1991/ThoughtworksWeChat | f7a8e8e65cad8962a7ec391b47574d7b0066fc17 | [
"MIT"
] | null | null | null | ThoughtworksWeChat/Extensions/UIScrollView+TWRefresh.h | snmhm1991/ThoughtworksWeChat | f7a8e8e65cad8962a7ec391b47574d7b0066fc17 | [
"MIT"
] | null | null | null | ThoughtworksWeChat/Extensions/UIScrollView+TWRefresh.h | snmhm1991/ThoughtworksWeChat | f7a8e8e65cad8962a7ec391b47574d7b0066fc17 | [
"MIT"
] | null | null | null | //
// UIScrollView+TWRefresh.h
// ThoughtworksWeChat
//
// Created by YangFani on 2020/10/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol TWScrollViewRefreshDelegate <NSObject>
@optional
- (void)beginPullToRefreshing:(UIScrollView *)scrollView;
- (void)beginUpToRefresh:(UIScrollView *)scrollView;
- (void)stopUptoRefreshAnimation:(UIScrollView *)scrollView;
- (void)didGetTimeOutSign:(UIScrollView *)scrollView;
@end
@interface TWScrollHeaderView : UIView
@property (strong,nonatomic) UIImageView *refreshView; //刷新图片的ImageView
@property (strong,nonatomic) UIImage *dropImage; //下拉时图片
@property (strong,nonatomic) UIImage *refreshImage; //刷新时旋转图片
@property (assign,nonatomic) float topMargin;
@property (assign,nonatomic) float defaultTopInset; //默认content inset
@property (assign,nonatomic) BOOL isBecomeCircle; //指针变为圆圈
@property (assign,nonatomic) BOOL enablePulltoRefesh; //下拉刷新是否可用
@end
@interface TWScrollFooterView : UIView
@property (assign,nonatomic) BOOL enableUptoRefesh; //上拉刷新是否可用
@property (assign,nonatomic) BOOL isGetMore; //是否正在上拉加载更多
@property (strong,nonatomic) UIActivityIndicatorView * activityView; //上拉刷新时的旋转圆环
@property (strong,nonatomic) UILabel * upLabel; //上拉刷新的文字提示
@property (strong,nonatomic) NSString * footerViewText; //底部显示文本
@property (assign,nonatomic) float defaultBottomInset; //默认底部content inset
@end
@interface UIScrollView (TWRefresh)
- (void)stopAnimation;
- (void)scrollTableToFoot:(BOOL)animated;
- (void)startRefreshing:(BOOL)enableNotify;
- (void)playRefreshAnimation;
- (void)showFooterNoMore;
- (void)showFooterNoMoreAfterAnimationFinished;
- (void)showLoadingMore:(BOOL)isShow;
- (void)loadingFailed;
@property (strong, nonatomic) TWScrollHeaderView *scrollHeaderView;
@property (strong, nonatomic) TWScrollFooterView *scrollFooterView;
@property (weak, nonatomic) id<TWScrollViewRefreshDelegate> refreshDelegate;
@end
NS_ASSUME_NONNULL_END
| 33.646154 | 100 | 0.701875 |
ac3b93d8361fe55aaceb62cf3c59b0e4e69e1bc2 | 1,443 | h | C | src/graphic/color.h | mpinto70/raytracing | 5e3a46257b74a3df1b91fb066d7763b50273bf83 | [
"MIT"
] | null | null | null | src/graphic/color.h | mpinto70/raytracing | 5e3a46257b74a3df1b91fb066d7763b50273bf83 | [
"MIT"
] | null | null | null | src/graphic/color.h | mpinto70/raytracing | 5e3a46257b74a3df1b91fb066d7763b50273bf83 | [
"MIT"
] | null | null | null | #pragma once
#include "geometry/vec3d.h"
#include <algorithm>
#include <type_traits>
namespace graphic {
using geometry::dim_t;
struct color {
int r, g, b;
constexpr color& operator+=(const color& v) noexcept {
r += v.r;
g += v.g;
b += v.b;
return *this;
}
constexpr color& operator-=(const color& v) noexcept {
r -= v.r;
g -= v.g;
b -= v.b;
return *this;
}
constexpr color& operator*=(dim_t s) noexcept {
r = std::max(std::min(int(dim_t(r) * s), 255), 0);
g = std::max(std::min(int(dim_t(g) * s), 255), 0);
b = std::max(std::min(int(dim_t(b) * s), 255), 0);
return *this;
}
constexpr color& operator/=(dim_t s) noexcept {
r = std::max(std::min(int(dim_t(r) / s), 255), 0);
g = std::max(std::min(int(dim_t(g) / s), 255), 0);
b = std::max(std::min(int(dim_t(b) / s), 255), 0);
return *this;
}
};
static_assert(std::is_pod<color>::value);
constexpr color operator+(color u, const color& v) noexcept {
u += v;
return u;
}
constexpr color operator-(color u, const color& v) noexcept {
u -= v;
return u;
}
constexpr color operator*(color v, dim_t s) noexcept {
v *= s;
return v;
}
constexpr color operator*(dim_t s, const color& v) noexcept {
return v * s;
}
constexpr color operator/(color v, dim_t s) noexcept {
v /= s;
return v;
}
}
| 21.537313 | 61 | 0.548164 |
b18b116f0416fe107a9b173d110eea08b1e93d17 | 969 | h | C | file-commander-core/src/favoritelocationslist/cfavoritelocations.h | gusbemacbe/file-commander | 33f73476eb0ff840fe771386dc92b7f4c0250343 | [
"Apache-2.0"
] | 304 | 2015-02-18T01:42:21.000Z | 2022-03-31T03:20:38.000Z | file-commander-core/src/favoritelocationslist/cfavoritelocations.h | gusbemacbe/file-commander | 33f73476eb0ff840fe771386dc92b7f4c0250343 | [
"Apache-2.0"
] | 279 | 2015-03-28T14:48:28.000Z | 2022-03-30T12:26:56.000Z | file-commander-core/src/favoritelocationslist/cfavoritelocations.h | gusbemacbe/file-commander | 33f73476eb0ff840fe771386dc92b7f4c0250343 | [
"Apache-2.0"
] | 56 | 2015-03-24T19:03:00.000Z | 2022-02-24T20:59:10.000Z | #pragma once
#include "compiler/compiler_warnings_control.h"
DISABLE_COMPILER_WARNINGS
#include <QString>
RESTORE_COMPILER_WARNINGS
#include <list>
struct CLocationsCollection
{
explicit CLocationsCollection(const QString& name, const QString& path = QString()): displayName(name), absolutePath(path) {}
QString displayName;
QString absolutePath;
std::list<CLocationsCollection> subLocations;
};
class CFavoriteLocations
{
public:
explicit CFavoriteLocations(const QString& settingsKey);
~CFavoriteLocations();
CFavoriteLocations(const CFavoriteLocations&) = delete;
CFavoriteLocations& operator=(const CFavoriteLocations&) = delete;
std::list<CLocationsCollection>& locations();
void addItem(std::list<CLocationsCollection>& list, const QString& name, const QString& path = QString());
void save();
private:
void load();
private:
const QString _settingsKey;
std::list<CLocationsCollection> _items;
};
| 23.071429 | 127 | 0.75129 |
df71b19dea6a340a2b100645b5dac3db0acc9412 | 4,568 | h | C | Firmware/Program/applications/include.h | sampletea/F4_KS_Airplane | d13e93c80b86554fcdd9432432aa2c8684354b37 | [
"MIT"
] | 9 | 2020-09-12T14:32:53.000Z | 2022-01-28T14:53:34.000Z | Firmware/Program/applications/include.h | Kevincoooool/F4_KS_Airplane | d13e93c80b86554fcdd9432432aa2c8684354b37 | [
"MIT"
] | null | null | null | Firmware/Program/applications/include.h | Kevincoooool/F4_KS_Airplane | d13e93c80b86554fcdd9432432aa2c8684354b37 | [
"MIT"
] | 6 | 2020-07-01T13:36:28.000Z | 2022-03-24T09:11:19.000Z | #ifndef _include_H_
#define _include_H_
#include "math.h"
#include "stm32f4xx.h"
#include "mymath.h"
#include "stdint.h"
#include "loop.h"
#include "drv_usart1.h"
#include "drv_usart2.h"
#include "drv_usart3.h"
#include "drv_uart4.h"
#include "drv_uart5.h"
#include "drv_usart6.h"
#include "drv_spi.h"
#include "drv_nrf24l01.h"
#include "drv_led.h"
#include "drv_spl06.h"
#include "drv_icm20689.h"
//#include "drv_mpu6050.h"
#include "drv_adc.h"
#include "drv_esp8266.h"
#include "bsp_SysTick.h"
#include "malloc.h"
#include "MotionCal.h"
#include "RC.h"
#include "IMU.h"
#include "Control.h"
#include "Param.h"
#include "drv_pwm_out.h"
#include "filter.h"
#include "drv_i2c_soft.h"
#include "drv_spl06.h"
#include "opticalflow.h"
#include "ADRC.h"
#include "PID.h"
#include "RC.h"
#include "Data.h"
#include "height_ctrl.h"
#include "mymath.h"
#include "MotionCal.h"
#include "Alt_Ctrl.h"
#include "Loc_Ctrl.h"
#include "Face_track.h"
#include "mathTool.h"
#include "WIFI_UFO.h"
#include "Voltage.h"
#include "my_usb.h"
#include "AttCtrl.h"
#include "MotorCtrl.h"
#include "Navigate.h"
extern u8 sys_init_ok;
#define HW_TYPE 1
#define HW_VER 3
#define BL_VER 100
#define PT_VER 400
/***************LED GPIO定义******************/
#define RCC_LED_R RCC_APB2Periph_GPIOB
#define GPIO_LED_R GPIOB
#define Pin_LED_R GPIO_Pin_14
#define RCC_LED_G RCC_APB2Periph_GPIOB
#define GPIO_LED_G GPIOB
#define Pin_LED_G GPIO_Pin_13
#define RCC_LED_B RCC_APB2Periph_GPIOB
#define GPIO_LED_B GPIOB
#define Pin_LED_B GPIO_Pin_12
/*********************************************/
#define GYRO_SPI 1 //陀螺仪SPI配置
#define GYRO_CS_GPIO GPIOC
#define GYRO_CS_PIN GPIO_Pin_5
#define BARO_SPI 1 //气压计SPI配置
#define BARO_CS_GPIO GPIOC
#define BARO_CS_PIN GPIO_Pin_4
#define NRF2401_SPI 3 //NRF SPI配置
/**********************************************************************************************************
*SPI引脚及参数配置
**********************************************************************************************************/
#define SPI1_GPIO_MOSI GPIOA
#define SPI1_GPIO_MISO GPIOA
#define SPI1_GPIO_SCK GPIOA
#define SPI1_PINSOURCE_MOSI GPIO_PinSource7
#define SPI1_PINSOURCE_MISO GPIO_PinSource6
#define SPI1_PINSOURCE_SCK GPIO_PinSource5
#define SPI1_PIN_MOSI GPIO_Pin_7
#define SPI1_PIN_MISO GPIO_Pin_6
#define SPI1_PIN_SCK GPIO_Pin_5
#define SPI1_CLOCKDIV SPI_BaudRatePrescaler_8
#define SPI2_GPIO_MOSI GPIOC
#define SPI2_GPIO_MISO GPIOC
#define SPI2_GPIO_SCK GPIOC
#define SPI2_PINSOURCE_MOSI GPIO_PinSource12
#define SPI2_PINSOURCE_MISO GPIO_PinSource11
#define SPI2_PINSOURCE_SCK GPIO_PinSource10
#define SPI2_PIN_MOSI GPIO_Pin_12
#define SPI2_PIN_MISO GPIO_Pin_11
#define SPI2_PIN_SCK GPIO_Pin_10
#define SPI2_CLOCKDIV SPI_BaudRatePrescaler_8
#define SPI3_GPIO_MOSI GPIOC
#define SPI3_GPIO_MISO GPIOC
#define SPI3_GPIO_SCK GPIOC
#define SPI3_PINSOURCE_MOSI GPIO_PinSource12
#define SPI3_PINSOURCE_MISO GPIO_PinSource11
#define SPI3_PINSOURCE_SCK GPIO_PinSource10
#define SPI3_PIN_MOSI GPIO_Pin_12
#define SPI3_PIN_MISO GPIO_Pin_11
#define SPI3_PIN_SCK GPIO_Pin_10
#define SPI3_CLOCKDIV SPI_BaudRatePrescaler_2
/***************UART1 GPIO定义******************/
#define RCC_USART1 RCC_AHB1Periph_GPIOA
#define GPIO_USART1 GPIOA
#define USART1_Pin_TX GPIO_Pin_9
#define USART1_Pin_RX GPIO_Pin_10
/*********************************************/
/***************UART1 GPIO定义******************/
#define RCC_USART2 RCC_AHB1Periph_GPIOA
#define GPIO_USART2 GPIOA
#define USART2_Pin_TX GPIO_Pin_2
#define USART2_Pin_RX GPIO_Pin_3
/*********************************************/
/***************UART3 GPIO定义******************/
#define RCC_USART3 RCC_APB1Periph_GPIOB
#define GPIO_USART3 GPIOB
#define USART3_Pin_TX GPIO_Pin_10
#define USART3_Pin_RX GPIO_Pin_11
/*********************************************/
/***************硬件中断优先级******************/
#define NVIC_USART1_P 1
#define NVIC_USART1_S 1
#define NVIC_USART2_P 2
#define NVIC_USART2_S 1
#define NVIC_USART3_P 3
#define NVIC_USART3_S 1
#define NVIC_UART4_P 3
#define NVIC_UART4_S 1
#define NVIC_UART5_P 3
#define NVIC_UART5_S 1
#define NVIC_USART6_P 4
#define NVIC_USART6_S 1
/***********************************************/
#endif
| 28.911392 | 107 | 0.637259 |
0e82a3f3808ff555d398f05e4adbf89518847996 | 5,578 | h | C | imperative/src/include/megbrain/imperative/utils/stats.h | nero19960329/MegEngine | 4462953fba45bdfb9aaf47b406688206fa5796c3 | [
"Apache-2.0"
] | 1 | 2022-03-21T03:13:45.000Z | 2022-03-21T03:13:45.000Z | imperative/src/include/megbrain/imperative/utils/stats.h | Viktor-Paul/MegEngine | 4462953fba45bdfb9aaf47b406688206fa5796c3 | [
"Apache-2.0"
] | null | null | null | imperative/src/include/megbrain/imperative/utils/stats.h | Viktor-Paul/MegEngine | 4462953fba45bdfb9aaf47b406688206fa5796c3 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <chrono>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
namespace mgb {
namespace imperative {
namespace stats {
#define MGE_ENABLE_STATS 0
class Timer {
public:
using clock_t = std::chrono::system_clock;
private:
clock_t::duration m_duration = clock_t::duration{0};
size_t m_timing = 0;
std::string m_name;
uint64_t m_count = 0;
size_t m_enabled = 1;
bool m_default_enabled = true;
struct TimeScopeRecursive {
Timer& timer;
clock_t::time_point start;
bool released = false;
TimeScopeRecursive(Timer& timer) : timer(timer) {
if (timer.m_enabled && !timer.m_timing++) {
start = clock_t::now();
}
}
~TimeScopeRecursive() { release(); }
void release() {
if (released) {
return;
}
if (timer.m_enabled) {
if (!--timer.m_timing) {
auto duration = (clock_t::now() - start);
timer.m_duration += duration;
}
timer.m_count++;
}
released = true;
}
};
struct EnableScope {
Timer& timer;
bool released = false;
EnableScope(Timer& timer) : timer(timer) { timer.m_enabled++; }
~EnableScope() { release(); }
void release() {
if (released) {
return;
}
timer.m_enabled--;
released = true;
}
};
public:
Timer(std::string name, bool default_enabled = true);
std::string name() { return m_name; }
auto time_scope_recursive() { return TimeScopeRecursive(*this); };
auto enable_scope() { return EnableScope(*this); }
void reset() {
m_duration = clock_t::duration{0};
m_count = 0;
m_enabled = m_default_enabled ? 1 : 0;
}
clock_t::duration get() const { return m_duration; }
uint64_t count() const { return m_count; }
};
} // namespace stats
struct Stats {
struct TimerNode {
std::map<std::string, std::unique_ptr<TimerNode>> children;
stats::Timer* timer = nullptr;
TimerNode() {}
};
static inline TimerNode sm_root;
// register your timers here
// for example:
//
// static inline stats::Timer mytimer;
//
// then use MGE_TIMER_SCOPE(mytimer) to collect durations in your code
static std::pair<long, long> print_node(
std::string name, TimerNode& node, size_t indent = 0) {
auto print_indent = [&] {
for (size_t i = 0; i < indent; ++i) {
printf(" ");
}
};
long ns = 0, count = 0;
if (auto* timer = node.timer) {
print_indent();
printf("%s costs %'ld ns, hits %'ld times\n", name.c_str(),
(long)timer->get().count(), (long)timer->count());
ns = timer->get().count();
count = timer->count();
}
if (!node.children.empty()) {
bool collect_children = node.timer == nullptr;
if (collect_children) {
print_indent();
printf("%s:\n", name.c_str());
}
long ns = 0, count = 0;
for (auto&& child : node.children) {
auto [child_ns, child_count] =
print_node(child.first, *child.second, indent + 4);
if (collect_children) {
ns += child_ns;
count += child_count;
}
}
if (collect_children) {
print_indent();
printf("total costs %'ld ns, hits %'ld times\n", ns, count);
}
}
return {ns, count};
}
static void print() {
for (auto&& child : sm_root.children) {
print_node(child.first, *child.second);
}
}
static void reset() {
auto reset_node = [](TimerNode& node, auto&& reset_node) -> void {
if (auto* timer = node.timer) {
timer->reset();
}
for (auto&& child : node.children) {
reset_node(*child.second, reset_node);
}
};
reset_node(sm_root, reset_node);
}
};
inline stats::Timer::Timer(std::string name, bool default_enabled)
: m_name(name), m_default_enabled(default_enabled) {
std::vector<std::string> terms;
Stats::TimerNode* node = &Stats::sm_root;
while (true) {
auto pos = name.find(".");
if (pos == std::string::npos) {
auto& child = node->children[name];
child = std::make_unique<Stats::TimerNode>();
node = child.get();
node->timer = this;
break;
} else {
auto& child = node->children[name.substr(0, pos)];
if (!child) {
child = std::make_unique<Stats::TimerNode>();
}
node = child.get();
name = name.substr(pos + 1);
}
}
}
#if MGE_ENABLE_STATS
#define MGE_TIMER_SCOPE(name) auto name = Stats::name.time_scope()
#define MGE_TIMER_SCOPE_RELEASE(name) name.release()
#define MGE_TIMER_SCOPE_ENABLE(name) auto name = Stats::name.enable_scope()
#else
#define MGE_TIMER_SCOPE(name) (void)0
#define MGE_TIMER_SCOPE_RELEASE(name) (void)0
#define MGE_TIMER_SCOPE_ENABLE(name) (void)0
#endif
} // namespace imperative
} // namespace mgb
| 27.89 | 76 | 0.52474 |
8a7ee8986713e27e9e60f5e94ecd82cba98009fd | 1,190 | h | C | engine/aer/view/view_interface.h | tcoppex/aer-engine | bd52892d353f395e3de960a50371300a95d4ac95 | [
"MIT"
] | 36 | 2015-08-16T17:17:29.000Z | 2021-07-25T07:28:37.000Z | engine/aer/view/view_interface.h | tcoppex/aer-engine | bd52892d353f395e3de960a50371300a95d4ac95 | [
"MIT"
] | 1 | 2020-06-14T17:38:27.000Z | 2020-06-14T17:38:27.000Z | engine/aer/view/view_interface.h | tcoppex/aer-engine | bd52892d353f395e3de960a50371300a95d4ac95 | [
"MIT"
] | 7 | 2017-11-03T04:01:16.000Z | 2021-03-14T18:49:03.000Z | // -----------------------------------------------------------------------------
// CreativeCommons BY-SA 3.0 2013 <Thibault Coppex>
//
// -----------------------------------------------------------------------------
#ifndef AER_VIEW_VIEW_INTERFACE_H_
#define AER_VIEW_VIEW_INTERFACE_H_
#include "aer/common.h"
namespace aer {
/// + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ +
///
/// [Abstract] location in a 3D space
///
/// + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ +
class Position3DInterface
{
public:
virtual void set_position(const Vector3&) = 0;
virtual const Vector3& position() const = 0;
};
/// + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ +
///
/// [Abstract] View point in a 3D space
///
/// + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ +
class View3DInterface : public Position3DInterface
{
public:
virtual void set_direction(const Vector3& direction) = 0;
virtual void set_target(const Vector3& target) = 0;
virtual const Vector3& direction() const = 0;
virtual const Vector3& up() const = 0;
virtual const Matrix4x4& view_matrix() = 0;
};
} // namespace aer
#endif // AER_VIEW_VIEW_INTERFACE_H_
| 25.869565 | 80 | 0.468908 |
e062d441bebb496784817be2795c5afc7c06cdd8 | 2,627 | h | C | include/slib/crypto/hash.h | emarc99/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 146 | 2017-03-21T07:50:43.000Z | 2022-03-19T03:32:22.000Z | include/slib/crypto/hash.h | Crasader/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 50 | 2017-03-22T04:08:15.000Z | 2019-10-21T16:55:48.000Z | include/slib/crypto/hash.h | Crasader/SLib | 4e492d6c550f845fd1b3f40bf10183097eb0e53c | [
"MIT"
] | 55 | 2017-03-21T07:52:58.000Z | 2021-12-27T13:02:08.000Z | /*
* Copyright (c) 2008-2018 SLIBIO <https://github.com/SLIBIO>
*
* 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 CHECKHEADER_SLIB_CRYPTO_HASH
#define CHECKHEADER_SLIB_CRYPTO_HASH
#include "definition.h"
#include "../core/string.h"
#include "../core/memory.h"
#include "../core/mio.h"
#include "../core/scoped.h"
namespace slib
{
template <class CLASS>
class SLIB_EXPORT CryptoHash
{
public:
void execute(const void* input, sl_size n, void* output)
{
CLASS& h = *((CLASS*)this);
h.start();
h.update(input, n);
h.finish(output);
}
static void hash(const void* input, sl_size n, void* output)
{
CLASS h;
h.start();
h.update(input, n);
h.finish(output);
}
static void hash(const String& s, void* output)
{
hash(s.getData(), s.getLength(), output);
}
static void hash(const Memory& data, void* output)
{
hash(data.getData(), data.getSize(), output);
}
static Memory hash(const void* input, sl_size n)
{
char v[CLASS::HashSize];
hash(input, n, v);
return Memory::create(v, CLASS::HashSize);
}
static Memory hash(const String& s)
{
char v[CLASS::HashSize];
hash(s.getData(), s.getLength(), v);
return Memory::create(v, CLASS::HashSize);
}
static Memory hash(const Memory& data)
{
char v[CLASS::HashSize];
hash(data.getData(), data.getSize(), v);
return Memory::create(v, CLASS::HashSize);
}
void applyMask_MGF1(const void* seed, sl_uint32 sizeSeed, void* target, sl_uint32 sizeTarget);
};
}
#include "detail/hash.inc"
#endif
| 27.364583 | 96 | 0.687857 |
6d8bfc86dce2327cfc19a976953be7d1b3ab7e04 | 2,160 | h | C | ios/Pods/Headers/Public/ReactABI31_0_0/ABI31_0_0RCTBaseTextInputView.h | ThakurKarthik/expo | ed78ed4f07c950184a59422ebd95645253f44e3d | [
"Apache-2.0",
"MIT"
] | 2 | 2019-05-23T20:39:18.000Z | 2019-05-24T14:00:32.000Z | ios/Pods/Headers/Public/ReactABI31_0_0/ABI31_0_0RCTBaseTextInputView.h | ThakurKarthik/expo | ed78ed4f07c950184a59422ebd95645253f44e3d | [
"Apache-2.0",
"MIT"
] | 19 | 2020-04-07T07:36:24.000Z | 2022-03-26T09:32:12.000Z | ios/Pods/Headers/Public/ReactABI31_0_0/ABI31_0_0RCTBaseTextInputView.h | ThakurKarthik/expo | ed78ed4f07c950184a59422ebd95645253f44e3d | [
"Apache-2.0",
"MIT"
] | 1 | 2020-03-01T01:28:59.000Z | 2020-03-01T01:28:59.000Z | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <ReactABI31_0_0/ABI31_0_0RCTView.h>
#import "ABI31_0_0RCTBackedTextInputDelegate.h"
#import "ABI31_0_0RCTBackedTextInputViewProtocol.h"
@class ABI31_0_0RCTBridge;
@class ABI31_0_0RCTEventDispatcher;
@class ABI31_0_0RCTTextAttributes;
@class ABI31_0_0RCTTextSelection;
NS_ASSUME_NONNULL_BEGIN
@interface ABI31_0_0RCTBaseTextInputView : ABI31_0_0RCTView <ABI31_0_0RCTBackedTextInputDelegate>
- (instancetype)initWithBridge:(ABI31_0_0RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
@property (nonatomic, readonly) UIView<ABI31_0_0RCTBackedTextInputViewProtocol> *backedTextInputView;
@property (nonatomic, strong, nullable) ABI31_0_0RCTTextAttributes *textAttributes;
@property (nonatomic, assign) UIEdgeInsets ReactABI31_0_0PaddingInsets;
@property (nonatomic, assign) UIEdgeInsets ReactABI31_0_0BorderInsets;
@property (nonatomic, copy, nullable) ABI31_0_0RCTDirectEventBlock onContentSizeChange;
@property (nonatomic, copy, nullable) ABI31_0_0RCTDirectEventBlock onSelectionChange;
@property (nonatomic, copy, nullable) ABI31_0_0RCTDirectEventBlock onChange;
@property (nonatomic, copy, nullable) ABI31_0_0RCTDirectEventBlock onTextInput;
@property (nonatomic, copy, nullable) ABI31_0_0RCTDirectEventBlock onScroll;
@property (nonatomic, assign) NSInteger mostRecentEventCount;
@property (nonatomic, assign) BOOL blurOnSubmit;
@property (nonatomic, assign) BOOL selectTextOnFocus;
@property (nonatomic, assign) BOOL clearTextOnFocus;
@property (nonatomic, copy) ABI31_0_0RCTTextSelection *selection;
@property (nonatomic, strong, nullable) NSNumber *maxLength;
@property (nonatomic, copy) NSAttributedString *attributedText;
@property (nonatomic, copy) NSString *inputAccessoryViewID;
@property (nonatomic, assign) UIKeyboardType keyboardType;
@end
NS_ASSUME_NONNULL_END
| 39.272727 | 101 | 0.830556 |
33da595314747fb8d1ecfd29135285fefe609ad0 | 1,583 | h | C | inetsrv/iis/iisrearc/iisplus/ulw3/dav_handler.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | inetsrv/iis/iisrearc/iisplus/ulw3/dav_handler.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | inetsrv/iis/iisrearc/iisplus/ulw3/dav_handler.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*++
Copyright (c) 1999-2000 Microsoft Corporation
Module Name:
dav_handler.h
Abstract:
Handler class for DAV
Author:
Taylor Weiss (TaylorW) 01-Feb-1999
Revision History:
--*/
#ifndef _DAV_HANDLER_H_
#define _DAV_HANDLER_H_
#include "isapi_handler.h"
#define DAV_MODULE_NAME L"httpext.dll"
//
// The W3_DAV_HANDLER is essentially just a wrapper for
// the W3_ISAPI_HANDLER. It takes the original target of
// the request URL and submits it to the ISAPI handler
// as if it were script mapped to the DAV ISAPI.
//
class W3_DAV_HANDLER : public W3_ISAPI_HANDLER
{
public:
W3_DAV_HANDLER( W3_CONTEXT * pW3Context )
: W3_ISAPI_HANDLER( pW3Context, NULL )
{
}
WCHAR *
QueryName(
VOID
)
{
return L"DAVHandler";
}
CONTEXT_STATUS
DoWork(
VOID
);
CONTEXT_STATUS
OnCompletion(
DWORD cbCompletion,
DWORD dwCompletionStatus
);
static
HRESULT
W3_DAV_HANDLER::Initialize(
VOID
);
static
VOID
Terminate(
VOID
)
{
}
static
LPCWSTR
QueryDavImage(
VOID
);
private:
//
// Avoid c++ errors
//
W3_DAV_HANDLER( const W3_DAV_HANDLER & )
: W3_ISAPI_HANDLER( NULL, NULL )
{
}
W3_DAV_HANDLER & operator = ( const W3_DAV_HANDLER & ) { return *this; }
};
#endif // _DAV_HANDLER_H_
| 15.989899 | 77 | 0.551485 |
b8981053a02227d12cce61d5c7b0810141cfc6ef | 3,075 | h | C | Utility/BitUtils.h | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | 3 | 2015-12-04T09:16:53.000Z | 2021-05-28T23:22:49.000Z | Utility/BitUtils.h | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | null | null | null | Utility/BitUtils.h | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | 2 | 2015-03-03T05:32:39.000Z | 2015-12-04T09:16:54.000Z | // Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
#pragma once
#include "ArithmeticUtils.h"
#include "../Core/Types.h"
namespace Utility
{
template <typename Type>
inline bool IsPowerOfTwo(Type x)
{
// powers of two should have only 1 bit set... We can check using standard
// bit twiddling check...
return (x & (x - 1)) == 0;
}
// We can use the "bsr" instruction (if it's available) for
// calculating the integer log 2. Let's use the abstractions for
// bsr in ArithmeticUtils.h.
//
// Note that currently the Win32 implementation of bsr has a
// number of conditions, which should optimise out if inlining
// works correctly.
//
// See alternative methods for calculating this via well-known
// bit twiddling web site:
// https://graphics.stanford.edu/~seander/bithacks.html
inline uint32_t IntegerLog2(uint8 x)
{
return xl_bsr1(x);
}
inline uint32_t IntegerLog2(uint16_t x)
{
return xl_bsr2(x);
}
inline uint32_t IntegerLog2(uint32_t x)
{
return xl_bsr4(x);
}
inline uint32_t IntegerLog2(uint64_t x)
{
return xl_bsr8(x);
}
inline uint32_t LeastSignificantBitSet(uint64_t input)
{
// (same as count-trailing-zeroes)
return xl_ctz8(input);
}
template <typename Type>
inline Type CeilToMultiplePow2(Type input, unsigned multiple)
{
// returns "input", or the next largest multiple of the number "multiple"
// Here, we assume "multiple" is a power of 2
assert(IsPowerOfTwo(multiple));
return (input + multiple - 1) & ~(multiple - 1);
}
template <typename Type>
inline Type FloorToMultiplePow2(Type input, unsigned multiple)
{
assert(IsPowerOfTwo(multiple));
return input & ~(multiple - 1);
}
template <typename Type>
inline Type CeilToMultiple(Type input, unsigned multiple)
{
assert(multiple > 0);
return input + multiple - 1 - (input - 1) % multiple;
}
class BitHeap
{
public:
uint32_t Allocate();
uint32_t AllocateNoExpand();
void Allocate(uint32_t value); ///< allocate a specific entry
void Deallocate(uint32_t value);
bool IsAllocated(uint32_t value) const;
void Reserve(uint32_t count);
unsigned FirstUnallocated() const;
unsigned AllocatedCount() const;
BitHeap(unsigned slotCount = 8 * 64);
BitHeap(BitHeap&& moveFrom) = default;
BitHeap& operator=(BitHeap&& moveFrom) = default;
BitHeap(const BitHeap& cloneFrom) = default;
BitHeap& operator=(const BitHeap& cloneFrom) = default;;
~BitHeap();
private:
std::vector<uint64> _heap;
};
}
using namespace Utility;
| 28.472222 | 87 | 0.60748 |
b8bdf7e13d89cdf5a6bfdec7c836abaa24540a0c | 1,212 | h | C | serene-update-assistant-gui/updatercore.h | FascodeNet/serene-update-assistant | 40430867e694ec81843fec48403b648c1dddf782 | [
"MIT"
] | null | null | null | serene-update-assistant-gui/updatercore.h | FascodeNet/serene-update-assistant | 40430867e694ec81843fec48403b648c1dddf782 | [
"MIT"
] | null | null | null | serene-update-assistant-gui/updatercore.h | FascodeNet/serene-update-assistant | 40430867e694ec81843fec48403b648c1dddf782 | [
"MIT"
] | null | null | null | #ifndef UPDATERCORE_H
#define UPDATERCORE_H
#include <string>
#include<fstream>
#include <regex>
#include<iostream>
#include <QString>
#include <curl/curl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QTextEdit>
#include "ansiescapecodehandler.h"
#include "rep_IPC_Serene_source.h"
#define SERENE_PATH "/usr/bin/serene-update-assistant-gui"
class UpdaterCore
{
public:
UpdaterCore();
struct curl_buffer{
char* data;
int size;
};
struct update_info{
QString vername;
QString description;
QString download_update_url;
};
QString app_file_path;
static size_t buffer_w(char* ptr,size_t size,size_t nmemb,void* stream);
static size_t writer_curl(char* ptr,size_t size,size_t nmemb,void* stream);
std::string check_current_ver();
update_info get_update_info();
QString get_json();
bool update(update_info* upinfo,QTextEdit* log_textedit);
bool update_admin(update_info* upinfo);
private:
typedef QList<Utils::FormattedText> FormattedTextList;
};
#endif // UPDATERCORE_H
| 24.734694 | 79 | 0.721947 |
3557e08a282e94dad3ed6011174a2a2658b6f23c | 325 | h | C | BTE/Classes/SelectVC/Controller/BTESearchViewController.h | sophiemarceau/bte_iOS | 3e44be16be9559709e5dfbe24855f929e68832b1 | [
"MIT"
] | 1 | 2022-02-08T06:42:11.000Z | 2022-02-08T06:42:11.000Z | BTE/Classes/SelectVC/Controller/BTESearchViewController.h | sophiemarceau/bte_iOS | 3e44be16be9559709e5dfbe24855f929e68832b1 | [
"MIT"
] | 1 | 2021-11-12T02:04:11.000Z | 2021-11-12T02:04:11.000Z | BTE/Classes/SelectVC/Controller/BTESearchViewController.h | sophiemarceau/bte_iOS | 3e44be16be9559709e5dfbe24855f929e68832b1 | [
"MIT"
] | null | null | null | //
// BTESearchViewController.h
// BTE
//
// Created by wanmeizty on 23/10/18.
// Copyright © 2018年 wangli. All rights reserved.
//
#import "BHBaseController.h"
NS_ASSUME_NONNULL_BEGIN
@interface BTESearchViewController : BHBaseController
@property (strong,nonatomic) NSArray * optionList;
@end
NS_ASSUME_NONNULL_END
| 18.055556 | 53 | 0.763077 |
dece1a3f798c9e18f90741f8953e3f6e8c996146 | 4,178 | h | C | translator/reference.h | wahibium/KFF | 609e5afac8a9477dd1af31eacadbcd5b61530113 | [
"MIT"
] | 11 | 2015-06-08T22:16:47.000Z | 2022-03-19T15:11:14.000Z | translator/reference.h | wahibium/KFF | 609e5afac8a9477dd1af31eacadbcd5b61530113 | [
"MIT"
] | null | null | null | translator/reference.h | wahibium/KFF | 609e5afac8a9477dd1af31eacadbcd5b61530113 | [
"MIT"
] | 4 | 2015-06-12T21:24:47.000Z | 2021-04-23T09:58:33.000Z | #ifndef _REFERENCE_H_
#define _REFERENCE_H_
#include "translator.h"
#include "common.h"
namespace kff {
namespace translator {
class ReferenceTranslator {
private:
// If this flag is on, the Translator replace grid_dim[xyz] to the constant
// value of grid size when it's feasible.
bool flag_constant_grid_size_optimization_;
public:
ReferenceTranslator(const Configuration &config);
virtual ~ReferenceTranslator();
virtual void Translate();
virtual void Optimize();
virtual void SetUp(SgProject *project, TranslationContext *context,
BuilderInterface *rt_builder);
virtual void Finish();
bool flag_constant_grid_size_optimization() const {
return flag_constant_grid_size_optimization_;
}
void set_flag_constant_grid_size_optimization(bool flag) {
flag_constant_grid_size_optimization_ = flag;
}
protected:
bool validate_ast_;
//! Fixes inconsistency in AST.
virtual void FixAST();
//! Validates AST consistency.
/*!
Aborts when validation fails. Checking can be disabled with toggle
variable validate_ast_.
*/
virtual void ValidateASTConsistency();
//virtual ReferenceRuntimeBuilder *builder() {
//return dynamic_cast<ReferenceRuntimeBuilder*>(rt_builder_);
//}
virtual void TranslateKernelDeclaration(SgFunctionDeclaration *node);
virtual void TranslateNew(SgFunctionCallExp *node, GridType *gt);
virtual SgExprListExp *BuildNewArg(GridType *gt, Grid *g,
SgVariableDeclaration *dim_decl,
SgVariableDeclaration *type_info_decl);
virtual void appendNewArgExtra(SgExprListExp *args, Grid *g,
SgVariableDeclaration *dim_decl);
virtual void TranslateGet(SgFunctionCallExp *node,
SgInitializedName *gv,
bool is_kernel,
bool is_periodic);
virtual void TranslateEmit(SgFunctionCallExp *node,
GridEmitAttribute *attr);
virtual void RemoveEmitDummyExp(SgExpression *emit);
virtual void TranslateSet(SgFunctionCallExp *node, SgInitializedName *gv);
virtual void TranslateMap(SgFunctionCallExp *node, StencilMap *s);
//virtual SgFunctionDeclaration *BuildRunKernel(StencilMap *s);
virtual SgFunctionDeclaration *BuildRunInteriorKernel(StencilMap *s) {
return NULL;
}
virtual SgFunctionDeclarationPtrVector BuildRunBoundaryKernel(
StencilMap *s) {
std::vector<SgFunctionDeclaration*> v;
return v;
}
virtual void DefineMapSpecificTypesAndFunctions();
virtual void InsertStencilSpecificType(StencilMap *s,
SgClassDeclaration *type_decl);
virtual void InsertStencilSpecificFunc(StencilMap *s,
SgFunctionDeclaration *func);
virtual void TranslateRun(SgFunctionCallExp *node, Run *run);
/** generate dlopen and dlsym code
* @param[in] run
* @param[in] ref ... function reference '__PSStencilRun_0(1, ...);'
* @param[in] index ... VAR's expression
* @param[in] scope
* @return statement of dlopen and dlsym
*/
virtual SgStatement *GenerateDlopenDlsym(
Run *run, SgFunctionRefExp *ref,
SgExpression *index, SgScopeStatement *scope);
/** generate trial code
* @param[in] run
* @param[in] ref ... function reference '__PSStencilRun_0(1, ...);'
* @return function declaration
*/
virtual SgFunctionDeclaration *GenerateTrial(
Run *run, SgFunctionRefExp *ref);
virtual void TranslateReduceGrid(Reduce *rd);
virtual void TranslateReduceKernel(Reduce *rd);
//! Build a real function for reducing a grid.
/*!
\param rd A reduction of grid.
\return A function declaration for reducing the grid.
*/
virtual SgFunctionDeclaration *BuildReduceGrid(Reduce *rd);
virtual void optimizeConstantSizedGrids();
string grid_create_name_;
#if 0
virtual void TraceStencilRun(Run *run, SgScopeStatement *loop,
SgScopeStatement *cur_scope);
#endif
virtual void FixGridType();
};
} // namespace translator
} // namespace kff
#endif
| 34.816667 | 77 | 0.690761 |
a6f67b820e8735a41c3e08ce109b16253474e7d5 | 304 | h | C | CLPhotoLib/Classes/Lib/ext/UIButton+CLExt.h | ClaudeLi/CLPhotoLib | 378212fe2c49462f2baee36ce90490eb1d558da0 | [
"MIT"
] | 9 | 2016-07-08T10:46:59.000Z | 2020-07-27T08:09:12.000Z | CLPhotoLib/Classes/Lib/ext/UIButton+CLExt.h | ClaudeLi/CLPhotoLib | 378212fe2c49462f2baee36ce90490eb1d558da0 | [
"MIT"
] | 1 | 2020-07-27T08:09:37.000Z | 2020-07-27T08:09:37.000Z | CLPhotoLib/Classes/Lib/ext/UIButton+CLExt.h | ClaudeLi/CLPhotoLib | 378212fe2c49462f2baee36ce90490eb1d558da0 | [
"MIT"
] | null | null | null | //
// UIButton+CLExt.h
// CLPhotoLib
//
// Created by ClaudeLi on 2017/11/2.
// Copyright © 2017年 ClaudeLi. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (CLExt)
- (void)setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left;
@end
| 19 | 106 | 0.713816 |
b8058667603f99bf05d806381ba8e84d3e8f5f9d | 2,225 | h | C | ShortestPathBetweenNodes/func.h | CppProgrammer23/CppAdvancedTopic | 1c7993a3a401631af871ee9677805d75ab4bd65b | [
"Apache-2.0"
] | null | null | null | ShortestPathBetweenNodes/func.h | CppProgrammer23/CppAdvancedTopic | 1c7993a3a401631af871ee9677805d75ab4bd65b | [
"Apache-2.0"
] | null | null | null | ShortestPathBetweenNodes/func.h | CppProgrammer23/CppAdvancedTopic | 1c7993a3a401631af871ee9677805d75ab4bd65b | [
"Apache-2.0"
] | null | null | null | #include <vector>
#include <set>
#include <iostream>
template <typename Vertex, typename Weight>
void shortest_path(
graph<Vertex, Weight> const & g,
Vertex const source,
std::map<Vertex, Weight>& min_distance,
std::map<Vertex, Vertex>& previous)
{
auto const n = g.vertex_count();
auto const verteces = g.verteces();
min_distance.clear();
for (auto const & v : verteces)
min_distance[v] = graph<Vertex, Weight>::Infinity;
min_distance[source] = 0;
previous.clear();
std::set<std::pair<Weight, Vertex> > vertex_queue;
vertex_queue.insert(std::make_pair(min_distance[source], source));
while (!vertex_queue.empty())
{
auto dist = vertex_queue.begin()->first;
auto u = vertex_queue.begin()->second;
vertex_queue.erase(std::begin(vertex_queue));
auto const & neighbors = g.neighbors(u);
for (auto const & neighbor : neighbors)
{
auto v = neighbor.first;
auto w = neighbor.second;
auto dist_via_u = dist + w;
if (dist_via_u < min_distance[v])
{
vertex_queue.erase(std::make_pair(min_distance[v], v));
min_distance[v] = dist_via_u;
previous[v] = u;
vertex_queue.insert(std::make_pair(min_distance[v], v));
}
}
}
}
template <typename Vertex>
void build_path(
std::map<Vertex, Vertex> const & prev, Vertex const v,
std::vector<Vertex> & result)
{
result.push_back(v);
auto pos = prev.find(v);
if (pos == std::end(prev)) return;
build_path(prev, pos->second, result);
}
template <typename Vertex>
std::vector<Vertex> build_path(std::map<Vertex, Vertex> const & prev,
Vertex const v)
{
std::vector<Vertex> result;
build_path(prev, v, result);
std::reverse(std::begin(result), std::end(result));
return result;
}
template <typename Vertex>
void print_path(std::vector<Vertex> const & path)
{
for (size_t i = 0; i < path.size(); ++i)
{
std::cout << path[i];
if (i < path.size() - 1) std::cout << " -> ";
}
}
| 31.338028 | 72 | 0.573933 |
e60a99f7728ee632047bed76730ab31f908bfa9f | 2,613 | c | C | Local/prefixmax.c | nishoknm/CPrograms-HPC | c63f87d0fe06be412f9b88af875f26586f7f940e | [
"Apache-2.0"
] | null | null | null | Local/prefixmax.c | nishoknm/CPrograms-HPC | c63f87d0fe06be412f9b88af875f26586f7f940e | [
"Apache-2.0"
] | null | null | null | Local/prefixmax.c | nishoknm/CPrograms-HPC | c63f87d0fe06be412f9b88af875f26586f7f940e | [
"Apache-2.0"
] | null | null | null | #include "stdio.h"
#include "stdlib.h"
struct node
{
int value, maxval, prefix;
struct node *left;
struct node *right;
};
node* newNode(int value, struct node *left, struct node *right);
node* pairmax(int *arr, int startIndex, int endIndex);
node* prefixmax(int parent, struct node *root);
int maximum(int a, int b);
long upper_power_of_two(long v);
int main()
{
int arr[32];
FILE *myFile;
myFile = fopen("random32.txt", "r");
int i = 0;
int j = 0 ;
fscanf (myFile, "%d", &i);
while (!feof (myFile))
{
arr[j] = i;
j++;
fscanf (myFile, "%d", &i);
}
fclose (myFile);
node *finalmax = pairmax(arr,0,31);
node *finalprefix = prefixmax(0,finalmax);
printf("Final Max is : %d\n", finalmax->value);
return 0;
}
node* pairmax(int *arr, int startIndex, int endIndex)
{
if(endIndex-startIndex == 1)
{
node *left = newNode(arr[startIndex],NULL,NULL);
node *right = newNode(arr[endIndex],NULL,NULL);
node *max = newNode(maximum(arr[startIndex], arr[endIndex]),left,right);
return max;
}
else if (endIndex-startIndex == 0)
{
node *right = newNode(arr[endIndex],NULL,NULL);
return right;
}
int m = upper_power_of_two((endIndex-startIndex)+1);
if( m == (endIndex-startIndex)+1)
{
m = ((endIndex-startIndex)+1)/2;
}
node *leftmax = pairmax(arr,startIndex,startIndex+m-1);
node *rightmax = pairmax(arr,startIndex+m,endIndex);
node *totalmax = newNode(maximum(leftmax->value, rightmax->value),leftmax,rightmax);
return totalmax;
}
node* prefixmax(int parent, struct node *root)
{
if(root->left == NULL && root->right == NULL)
{
root->maxval = maximum(parent, root->value);
printf("Array value : %d and Cumulative max : %d\n",root->value ,root->maxval);
return root;
}
else
{
root->prefix = parent;
prefixmax(root->prefix,root->left);
root->maxval = maximum(parent, root->left->value);
prefixmax(root->maxval,root->right);
}
}
node* newNode(int value, struct node *left, struct node *right)
{
node *curr = (struct node*) malloc(sizeof(struct node));
if(left == NULL){
curr->left = curr->right = NULL;
}
else
{
curr->left = left;
}
if(right == NULL){
curr->right = NULL;
}
else
{
curr->right = right;
}
curr->value = value;
return curr;
}
long upper_power_of_two(long v)
{
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return (v >> 1)+1;
}
int maximum(int a , int b)
{
if(a>b)
{
return a;
}
else
{
return b;
}
} | 21.243902 | 86 | 0.592805 |
52b08a7b52eb9e212f5b85283162c2fd5d77ece5 | 4,940 | h | C | SS_Log_SRC/SS_Log/SS_Log_Server/SSLogOutput.h | johanlantz/headsetpresenter | 39c5e9740f58d66947e689670500fd0e8b7562c3 | [
"MIT"
] | 1 | 2022-02-24T06:04:03.000Z | 2022-02-24T06:04:03.000Z | SS_Log_SRC/SS_Log/SS_Log_Server/SSLogOutput.h | johanlantz/headsetpresenter | 39c5e9740f58d66947e689670500fd0e8b7562c3 | [
"MIT"
] | null | null | null | SS_Log_SRC/SS_Log/SS_Log_Server/SSLogOutput.h | johanlantz/headsetpresenter | 39c5e9740f58d66947e689670500fd0e8b7562c3 | [
"MIT"
] | null | null | null | // ----------------------------------------------------------------------- //
//
// FILENAME: sslogoutput.h
// AUTHOR: Steve Schaneville
// CREATED: 13 Feb 2003, 12:44
//
// PURPOSE:
//
// Copyright (c) 2003
//
// ----------------------------------------------------------------------- //
#ifndef __sslogoutput_h__
#define __sslogoutput_h__
// ------------------[ Pre-Include Defines ]------------------ //
// ------------------[ Include Files ]------------------ //
// ------------------[ Forward Declarations ]------------------ //
class SSLogDestination;
// ------------------[ Macros/Defines ]------------------ //
typedef SS_List<SSLogDestination*> DestList;
typedef SS_List<SSLogDestination*>::Iterator DestListIT;
// ------------------[ Constants/Enumerations ]------------------ //
// ------------------[ Global Variables ]------------------ //
// ------------------[ Global Functions ]------------------ //
VOID CALLBACK TimerProcOutput(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
// ------------------[ Classes ]------------------ //
// ----------------------------------------------------------------------- //
// Class: SSLogOutput
// Author: Steve Schaneville
// Notes:
// ----------------------------------------------------------------------- //
class SSLogOutput
{
public:
// construction, destruction
SSLogOutput ();
virtual ~SSLogOutput ();
// assignment, copy
SSLogOutput (SSLogOutput& rhs);
protected:
// initialization
virtual VOID InitObject ();
public:
// accessor functions
BOOL Dirty ();
VOID Dirty (BOOL bDirty);
UINT TimerID ();
VOID TimerID (UINT nTimerID);
VOID SetMainWindow (CWnd* pWnd);
DestList& DestinationList ();
MsgList& MessageList ();
// utilities
BOOL CreateDispatchTimer ();
BOOL DispatchMessages ();
BOOL PushMessage (LOGMESSAGE* pMsg);
protected:
// accessor functions
INT CurrentDispatchID ();
VOID CurrentDispatchID (INT nCurrentDispatchID);
BOOL UsingWindow ();
VOID UsingWindow (BOOL bUsingWindow);
CWnd* MainWindow ();
// utilities
BOOL InitializeDestinations ();
BOOL CreateDestination (DESTINATION_TYPE nType);
BOOL CurrentlyOutputting ();
VOID CurrentlyOutputting (BOOL bCurrentlyOutputting);
private:
// make sure this operator is not called... our implementation is useless.
SSLogOutput& operator = (SSLogOutput& rhs);
// member variables
BOOL m_bDirty;
UINT m_nTimerID;
BOOL m_bUsingWindow;
DestList m_DestinationList;
MsgList m_MessageList;
INT m_nCurrentDispatchID;
CWnd* m_pMainWnd;
CRITICAL_SECTION m_cs;
BOOL m_bCurrentlyOutputting; // ;)
};
// ----------------------------------------------------------------------- //
// SSLogOutput Inline Functions
// ----------------------------------------------------------------------- //
inline BOOL SSLogOutput::Dirty()
{ return m_bDirty; }
inline VOID SSLogOutput::Dirty(BOOL bDirty)
{ InterlockedExchange( (LPLONG)&m_bDirty, (LONG)bDirty ); }
inline UINT SSLogOutput::TimerID()
{ return m_nTimerID; }
inline VOID SSLogOutput::TimerID(UINT nTimerID)
{ m_nTimerID = nTimerID; }
inline DestList& SSLogOutput::DestinationList()
{ return m_DestinationList; }
inline MsgList& SSLogOutput::MessageList()
{ return m_MessageList; }
inline INT SSLogOutput::CurrentDispatchID()
{ return m_nCurrentDispatchID; }
inline VOID SSLogOutput::CurrentDispatchID(INT nCurrentDispatchID)
{ m_nCurrentDispatchID = nCurrentDispatchID; }
inline CWnd* SSLogOutput::MainWindow()
{ return m_pMainWnd; }
inline VOID SSLogOutput::SetMainWindow(CWnd* pWnd)
{ m_pMainWnd = pWnd; }
inline BOOL SSLogOutput::UsingWindow()
{ return m_bUsingWindow; }
inline VOID SSLogOutput::UsingWindow(BOOL bUsingWindow)
{ m_bUsingWindow = bUsingWindow; }
inline BOOL SSLogOutput::CurrentlyOutputting()
{ return m_bCurrentlyOutputting; }
inline VOID SSLogOutput::CurrentlyOutputting(BOOL bCurrentlyOutputting)
{ m_bCurrentlyOutputting = bCurrentlyOutputting; }
#endif // __sslogoutput_h__
| 31.464968 | 81 | 0.481781 |
da0b56ab17c18e434ffc2181498885e14fe4ab3a | 6,402 | h | C | whisperstreamlib/base/consts.h | cpopescu/whispercast | dd4ee1d4fa2e3436fc2387240eb3f5622749d944 | [
"BSD-3-Clause"
] | null | null | null | whisperstreamlib/base/consts.h | cpopescu/whispercast | dd4ee1d4fa2e3436fc2387240eb3f5622749d944 | [
"BSD-3-Clause"
] | null | null | null | whisperstreamlib/base/consts.h | cpopescu/whispercast | dd4ee1d4fa2e3436fc2387240eb3f5622749d944 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2009, Whispersoft s.r.l.
// 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 Whispersoft s.r.l. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Catalin Popescu
// This contains the definitions for general constants and types
// used throughout the media subsystem.
#ifndef __MEDIA_BASE_CONSTS_H__
#define __MEDIA_BASE_CONSTS_H__
#include <string>
#include <whisperlib/net/base/address.h>
#include <whisperlib/common/base/system.h>
namespace streaming {
// When we read a tag we can return the following codes:
// READ_OK - we read one tag and processed it (may decode one again from
// the element). VALID tag returned.
// READ_NO_DATA - tag unreadable because not enough data available.
// NULL tag returned.
// READ_SKIP - we got an ok tag, but we decided to skip. NULL tag returned.
// READ_CORRUPTED - the in input is corrupted and we cannot recover
// from the error. NULL tag returned.
// READ_EOF - basically we reached the end of the file (or what we
// were supposed to read). NULL tag returned.
enum TagReadStatus {
READ_NO_DATA,
READ_OK,
READ_SKIP,
READ_CORRUPTED,
READ_EOF,
};
const char* TagReadStatusName(TagReadStatus status);
//////////
// TagSplitters and TagSerializers are associated with these types.
enum MediaFormat {
MFORMAT_F4V, // F4V file (or MP4 file)
MFORMAT_FLV, // FLV file
MFORMAT_MP3, // MP3 file
MFORMAT_AAC, // AAC file
MFORMAT_MTS, // MPEG TS, file
MFORMAT_RAW, // raw data, no structure
MFORMAT_INTERNAL, // TODO(cosmin): remove this format if possible
};
// This is not a valid MediaFormat. Used in Requests that
// advertise they accept any incoming format.
extern const MediaFormat kAnyMediaFormat;
const char* MediaFormatName(MediaFormat format);
// file extension correspondence
const char* MediaFormatToExtension(MediaFormat format);
bool MediaFormatFromExtension(const string& ext, MediaFormat* out_format);
// http content type correspondence
const char* MediaFormatToContentType(MediaFormat format);
bool MediaFormatFromContentType(const string& content_type, MediaFormat* out_format);
// small type correspondence
const char* MediaFormatToSmallType(MediaFormat format);
bool MediaFormatFromSmallType(const string& small_type, MediaFormat* out_format);
// utility functions: uses a combination of the above conversion
bool ExtensionToContentType(const string& ext, string* content_type);
//////////
// Here we have the most simple protocol used
// internally to wrap frames from the encoder, in order
// to allow the downstream servers to split the media
// into tags without any knowledge of the actual media structure.
enum ProtocolFlags {
HEADER = 1 << 0,
AUDIO = 1 << 1,
VIDEO = 1 << 2,
METADATA = 1 << 3,
DELTA = 1 << 4,
DISCONTINUITY = 1 << 5,
HAS_TIMESTAMP = 1 << 6,
HAS_MIME_TYPE = 1 << 7,
};
// The frame flags.
typedef uint8 ProtocolFrameFlags;
// The frame length.
typedef int32 ProtocolFrameLength;
// The frame timestamp, in miliseconds.
typedef int32 ProtocolFrameTimeStamp;
// The byte order used by the protocol.
const common::ByteOrder kProtocolByteOrder = common::LILENDIAN;
// The frame header, as a structure.
#pragma pack(push, 0)
struct ProtocolFrameHeader {
ProtocolFrameFlags flags_;
ProtocolFrameLength length_;
ProtocolFrameTimeStamp timestamp_;
ProtocolFrameHeader() : flags_(0), length_(0), timestamp_(0) {}
ProtocolFrameHeader(const ProtocolFrameHeader& other)
: flags_(other.flags_),
length_(other.length_),
timestamp_(other.timestamp_) {}
};
#pragma pack(pop)
// The mime-type of the media encoded by our internal protocol.
static const char kInternalMimeType[] = "media/x-whisper-internal";
// The HTTP header name of the actually encoded mime type.
static const char kInternalHttpHeaderName[] = "X-Whisper-Content-Type";
/////////////////////////////////////////////////////////////////////
static const uint32 kAllFlavours = 0xFFFFFFFF;
static const uint32 kDefaultFlavourId = 0;
static const uint32 kDefaultFlavourMask = (1 << kDefaultFlavourId);
static const uint32 kNumFlavours = 32;
// Flavour manipulation function
// Basically this returns the id of the bit set.. (-1 if no bit or more bits
// are set).
// e.g:
// FlavourId(1) == 0
// FlavourId(128) == 7
// FlavourId(0) == -1
// FlavourId(3) == -1
//
int FlavourId(uint32 mask);
// The flavourId of the rightmost set bit and updates mask to unset that bit
// You can use in a construction:
// while ( flavour_mask ) {
// const int flavour_id = RightmostFlavourId(&flavour_mask);
// * do something w/ flavour_id
// }
inline int RightmostFlavourId(uint32& mask) {
const uint32 new_mask = mask & (mask - 1);
const int ret = FlavourId(mask & ~new_mask);
mask &= new_mask;
return ret;
}
//////////////////////////////////////////////////////////////////////
}
#endif // __MEDIA_BASE_CONSTS_H__
| 35.765363 | 85 | 0.718213 |
f7393c0b1a90c1e7a969f65f4d5b893226469bec | 533 | h | C | Code/Projects/Eld/src/eldtargetmanager.h | xordspar0/eldritch | 895639bbb7ccf72e0e8e7a4c5cf72a7915467679 | [
"Zlib"
] | 4 | 2018-01-31T11:56:52.000Z | 2021-06-27T18:11:23.000Z | Code/Projects/Eld/src/eldtargetmanager.h | xordspar0/eldritch | 895639bbb7ccf72e0e8e7a4c5cf72a7915467679 | [
"Zlib"
] | 11 | 2019-01-04T19:50:48.000Z | 2021-04-26T08:31:45.000Z | Code/Projects/Eld/src/eldtargetmanager.h | xordspar0/eldritch | 895639bbb7ccf72e0e8e7a4c5cf72a7915467679 | [
"Zlib"
] | 4 | 2018-02-27T07:10:51.000Z | 2021-04-22T09:38:13.000Z | #ifndef ELDTARGETMANAGER_H
#define ELDTARGETMANAGER_H
#include "map.h"
#include "hashedstring.h"
class IRenderer;
class IRenderTarget;
class EldTargetManager
{
public:
EldTargetManager( IRenderer* const pRenderer );
~EldTargetManager();
void CreateTargets( const uint DisplayWidth, const uint DisplayHeight );
void ReleaseTargets();
IRenderTarget* GetRenderTarget( const HashedString& Tag ) const;
private:
IRenderer* m_Renderer;
Map<HashedString, IRenderTarget*> m_RenderTargets;
};
#endif // ELDTARGETMANAGER_H
| 19.740741 | 73 | 0.780488 |
ddfb3b6493536daf6a6d0992b2e79136bd1fb520 | 20,504 | c | C | src/client/api/v1/get_message.c | bernardoaraujor/iota.c | 482e0806a4f5933307f82371772e5476a47190af | [
"Apache-2.0"
] | null | null | null | src/client/api/v1/get_message.c | bernardoaraujor/iota.c | 482e0806a4f5933307f82371772e5476a47190af | [
"Apache-2.0"
] | null | null | null | src/client/api/v1/get_message.c | bernardoaraujor/iota.c | 482e0806a4f5933307f82371772e5476a47190af | [
"Apache-2.0"
] | null | null | null | // Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
#include <stdio.h>
#include <stdlib.h>
#include "client/api/json_utils.h"
#include "client/api/v1/get_message.h"
#include "client/network/http.h"
#include "core/utils/iota_str.h"
static const UT_icd ut_tx_intputs_icd = {sizeof(payload_tx_input_t), NULL, NULL, NULL};
static const UT_icd ut_tx_outputs_icd = {sizeof(payload_tx_output_t), NULL, NULL, NULL};
static const UT_icd ut_tx_blocks_icd = {sizeof(payload_unlock_block_t), NULL, NULL, NULL};
static payload_tx_t *payload_tx_new() {
payload_tx_t *tx = (payload_tx_t *)malloc(sizeof(payload_tx_t));
if (tx) {
memset(tx, 0, sizeof(payload_tx_t));
utarray_new(tx->intputs, &ut_tx_intputs_icd);
utarray_new(tx->outputs, &ut_tx_outputs_icd);
utarray_new(tx->unlock_blocks, &ut_tx_blocks_icd);
return tx;
}
return NULL;
}
static void payload_tx_free(payload_tx_t *tx) {
if (tx) {
if (tx->intputs) {
utarray_free(tx->intputs);
}
if (tx->outputs) {
utarray_free(tx->outputs);
}
if (tx->unlock_blocks) {
utarray_free(tx->unlock_blocks);
}
if (tx->payload) {
// TODO
}
free(tx);
}
}
static payload_milestone_t *payload_milestone_new() {
payload_milestone_t *ms = malloc(sizeof(payload_milestone_t));
if (ms) {
utarray_new(ms->signatures, &ut_str_icd);
ms->index = 0;
ms->timestamp = 0;
memset(ms->inclusion_merkle_proof, 0, sizeof(ms->inclusion_merkle_proof));
}
return ms;
}
static void payload_milestone_free(payload_milestone_t *ms) {
if (ms) {
if (ms->signatures) {
utarray_free(ms->signatures);
}
free(ms);
}
}
static payload_index_t *payload_index_new() {
payload_index_t *idx = malloc(sizeof(payload_index_t));
if (idx) {
idx->data = byte_buf_new();
if (idx->data) {
idx->index = byte_buf_new();
if (idx->index) {
return idx;
}
byte_buf_free(idx->data);
free(idx);
return NULL;
}
free(idx);
return NULL;
}
return NULL;
}
static void payload_index_free(payload_index_t *idx) {
if (idx) {
byte_buf_free(idx->data);
byte_buf_free(idx->index);
free(idx);
}
}
static get_message_t *get_message_new() {
get_message_t *msg = malloc(sizeof(get_message_t));
memset(msg->net_id, 0, sizeof(msg->net_id));
memset(msg->parent1, 0, sizeof(msg->parent1));
memset(msg->parent2, 0, sizeof(msg->parent2));
memset(msg->nonce, 0, sizeof(msg->nonce));
msg->payload = NULL;
msg->type = 255; // invalid payload type
return msg;
}
static void get_message_free(get_message_t *msg) {
if (msg) {
switch (msg->type) {
case MSG_PAYLOAD_TRANSACTION:
payload_tx_free((payload_tx_t *)msg->payload);
break;
case MSG_PAYLOAD_MILESTONE:
payload_milestone_free((payload_milestone_t *)msg->payload);
break;
case MSG_PAYLOAD_INDEXATION:
payload_index_free((payload_index_t *)msg->payload);
break;
default:
// do nothing
break;
}
free(msg);
}
}
static int deser_milestone(cJSON *milestone, res_message_t *res) {
char const *const key_index = "index";
char const *const key_timestamp = "timestamp";
char const *const key_inclusion = "inclusionMerkleProof";
char const *const key_signatures = "signatures";
int ret = 0;
payload_milestone_t *ms = payload_milestone_new();
if (ms == NULL) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
return -1;
}
// parsing index
if ((ret = json_get_uint32(milestone, key_index, &ms->index)) != 0) {
printf("[%s:%d]: parsing %s failed\n", __func__, __LINE__, key_index);
ret = -1;
goto end;
}
// parsing timestamp
if ((ret = json_get_uint64(milestone, key_timestamp, &ms->timestamp)) != 0) {
printf("[%s:%d]: parsing %s failed\n", __func__, __LINE__, key_timestamp);
ret = -1;
goto end;
}
// parsing inclusion Merkle proof
if ((ret = json_get_string(milestone, key_inclusion, ms->inclusion_merkle_proof,
sizeof(ms->inclusion_merkle_proof))) != 0) {
printf("[%s:%d]: parsing %s string failed\n", __func__, __LINE__, key_inclusion);
ret = -1;
goto end;
}
// parsing signatures
if ((ret = json_string_array_to_utarray(milestone, key_signatures, ms->signatures)) != 0) {
printf("[%s:%d]: parsing %s array failed\n", __func__, __LINE__, key_signatures);
ret = -1;
}
end:
if (ret != 0) {
payload_milestone_free(ms);
res->u.msg->payload = NULL;
} else {
res->u.msg->payload = (void *)ms;
}
return ret;
}
static int deser_indexation(cJSON *idx_obj, res_message_t *res) {
char const *const key_index = "index";
char const *const key_data = "data";
int ret = 0;
payload_index_t *idx = payload_index_new();
if (idx == NULL) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
return -1;
}
if ((ret = json_get_byte_buf_str(idx_obj, key_index, idx->index)) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_index);
ret = -1;
goto end;
}
if ((ret = json_get_byte_buf_str(idx_obj, key_data, idx->data)) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_data);
ret = -1;
}
end:
if (ret != 0) {
payload_index_free(idx);
res->u.msg->payload = NULL;
} else {
res->u.msg->payload = (void *)idx;
}
return ret;
}
static int deser_tx_inputs(cJSON *essence_obj, payload_tx_t *payload_tx) {
char const *const key_inputs = "inputs";
char const *const key_tx_id = "transactionId";
char const *const key_tx_out_idx = "transactionOutputIndex";
cJSON *in_obj = cJSON_GetObjectItemCaseSensitive(essence_obj, key_inputs);
if (!in_obj) {
printf("[%s:%d]: %s not found in the essence\n", __func__, __LINE__, key_inputs);
return -1;
}
/*
"inputs": [
{
"type": 0,
"transactionId": "2bfbf7463b008c0298103121874f64b59d2b6172154aa14205db2ce0ba553b03",
"transactionOutputIndex": 0
}
],
*/
if (cJSON_IsArray(in_obj)) {
cJSON *elm = NULL;
cJSON_ArrayForEach(elm, in_obj) {
cJSON *tx_id_obj = cJSON_GetObjectItemCaseSensitive(elm, key_tx_id);
cJSON *tx_out_idx = cJSON_GetObjectItemCaseSensitive(elm, key_tx_out_idx);
if (tx_id_obj && tx_out_idx) {
payload_tx_input_t input = {};
char *str = cJSON_GetStringValue(tx_id_obj);
if (str) {
memcpy(input.tx_id, str, sizeof(input.tx_id));
} else {
printf("[%s:%d] encountered non-string array member", __func__, __LINE__);
return -1;
}
if (cJSON_IsNumber(tx_out_idx)) {
input.tx_output_index = tx_out_idx->valueint;
} else {
printf("[%s:%d] %s is not an number\n", __func__, __LINE__, key_tx_out_idx);
return -1;
}
// add the input element to payload
utarray_push_back(payload_tx->intputs, &input);
} else {
printf("[%s:%d] parsing inputs array failed\n", __func__, __LINE__);
return -1;
}
}
} else {
printf("[%s:%d] %s is not an array object\n", __func__, __LINE__, key_inputs);
return -1;
}
return 0;
}
static int deser_tx_outputs(cJSON *essence_obj, payload_tx_t *payload_tx) {
char const *const key_outputs = "outputs";
char const *const key_address = "address";
char const *const key_addr_type = "type";
char const *const key_amount = "amount";
cJSON *out_obj = cJSON_GetObjectItemCaseSensitive(essence_obj, key_outputs);
if (!out_obj) {
printf("[%s:%d]: %s not found in the essence\n", __func__, __LINE__, key_outputs);
return -1;
}
/*
"outputs": [
{ "type": 0,
"address": {
"type": 1,
"address": "ad32258255e7cf927a4833f457f220b7187cf975e82aeee2e23fcae5056ab5f4"
},
"amount": 1000 } ],
*/
if (cJSON_IsArray(out_obj)) {
cJSON *elm = NULL;
cJSON_ArrayForEach(elm, out_obj) {
cJSON *tx_address_obj = cJSON_GetObjectItemCaseSensitive(elm, key_address);
cJSON *tx_amount_obj = cJSON_GetObjectItemCaseSensitive(elm, key_amount);
// check outputs/address and output/amount
if (tx_address_obj && tx_amount_obj) {
cJSON *addr_type = cJSON_GetObjectItemCaseSensitive(tx_address_obj, key_addr_type);
if (addr_type) {
// check outputs/address/type
if (cJSON_IsNumber(addr_type) && addr_type->valueint == 1) {
cJSON *addr = cJSON_GetObjectItemCaseSensitive(tx_address_obj, key_address);
if (cJSON_IsString(addr) && cJSON_IsNumber(tx_amount_obj)) {
payload_tx_output_t output = {};
memcpy(output.address, addr->valuestring, sizeof(output.address));
output.amount = (uint64_t)tx_amount_obj->valuedouble;
// add the output element to payload
utarray_push_back(payload_tx->outputs, &output);
} else {
printf("[%s:%d] address is not a string or ammount is not an number\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] only support ed25519 address\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] parsing address type failed\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] parsing outputs array failed\n", __func__, __LINE__);
return -1;
}
}
} else {
printf("[%s:%d] %s is not an array object\n", __func__, __LINE__, key_outputs);
return -1;
}
return 0;
}
static int deser_tx_blocks(cJSON *blocks_obj, payload_tx_t *payload_tx) {
char const *const key_blocks_sig = "signature";
char const *const key_blocks_pub = "publicKey";
char const *const key_blocks_sig_type = "type";
/*
"unlockBlocks": [{ "type": 0,
"signature": {
"type": 1,
"publicKey": "dd2fb44b9809782af5f31fdbf767a39303365449308f78d6c2652ac9766dbf1a",
"signature":
"e625a71351bbccf87eeaad7e98f6a545306423b2aaf444792a1be8ccfdfe50b358583483c3dbc536b5842eeec381750c6b4495c14932be47c439a1a8ad242606"
}}]
*/
cJSON *elm = NULL;
cJSON_ArrayForEach(elm, blocks_obj) {
cJSON *sig_obj = cJSON_GetObjectItemCaseSensitive(elm, key_blocks_sig);
if (sig_obj) {
cJSON *sig_type = cJSON_GetObjectItemCaseSensitive(sig_obj, key_blocks_sig_type);
if (cJSON_IsNumber(sig_type)) {
if (sig_type->valueint == 1) {
cJSON *pub = cJSON_GetObjectItemCaseSensitive(sig_obj, key_blocks_pub);
cJSON *sig = cJSON_GetObjectItemCaseSensitive(sig_obj, key_blocks_sig);
if (cJSON_IsString(pub) && cJSON_IsString(sig)) {
payload_unlock_block_t block = {};
memcpy(block.pub_key, pub->valuestring, sizeof(block.pub_key));
memcpy(block.signature, sig->valuestring, sizeof(block.signature));
// add to unlockBlocks
utarray_push_back(payload_tx->unlock_blocks, &block);
} else {
printf("[%s:%d] publicKey or signature is not a string\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] only suppport ed25519 signature\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] signature type is not an number\n", __func__, __LINE__);
return -1;
}
} else {
printf("[%s:%d] %s is not found\n", __func__, __LINE__, key_blocks_sig);
return -1;
}
}
return 0;
}
static int deser_transaction(cJSON *tx_obj, res_message_t *res) {
char const *const key_essence = "essence";
char const *const key_payload = "payload";
char const *const key_blocks = "unlockBlocks";
int ret = 0;
payload_tx_t *tx = payload_tx_new();
if (tx == NULL) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
return -1;
}
// parsing essence
cJSON *essence_obj = cJSON_GetObjectItemCaseSensitive(tx_obj, key_essence);
if (essence_obj) {
// inputs array
if ((ret = deser_tx_inputs(essence_obj, tx)) != 0) {
goto end;
}
// outputs array
if ((ret = deser_tx_outputs(essence_obj, tx)) != 0) {
goto end;
}
// payload
cJSON *payload_obj = cJSON_GetObjectItemCaseSensitive(essence_obj, key_payload);
if (!cJSON_IsNull(payload_obj)) {
// TODO;
printf("[%s:%d]: TODO parsing payload in a transaction\n", __func__, __LINE__);
}
// unlock blocks
cJSON *blocks_obj = cJSON_GetObjectItemCaseSensitive(tx_obj, key_blocks);
if (cJSON_IsArray(blocks_obj)) {
ret = deser_tx_blocks(blocks_obj, tx);
} else {
printf("[%s:%d]: %s is not an array object\n", __func__, __LINE__, key_blocks);
ret = -1;
}
} else {
printf("[%s:%d]: %s not found in the message\n", __func__, __LINE__, key_essence);
ret = -1;
}
end:
if (ret != 0) {
payload_tx_free(tx);
res->u.msg->payload = NULL;
} else {
res->u.msg->payload = (void *)tx;
}
return ret;
}
res_message_t *res_message_new() {
res_message_t *msg = malloc(sizeof(res_message_t));
if (msg) {
msg->is_error = false;
return msg;
}
return NULL;
}
void res_message_free(res_message_t *msg) {
if (msg) {
if (msg->is_error) {
res_err_free(msg->u.error);
} else {
get_message_free(msg->u.msg);
}
free(msg);
}
}
int deser_get_message(char const *const j_str, res_message_t *res) {
char const *const key_net = "networkId";
char const *const key_p1_id = "parent1MessageId";
char const *const key_p2_id = "parent2MessageId";
char const *const key_nonce = "nonce";
char const *const key_payload = "payload";
char const *const key_type = "type";
int ret = 0;
cJSON *json_obj = cJSON_Parse(j_str);
if (json_obj == NULL) {
return -1;
}
res_err_t *res_err = deser_error(json_obj);
if (res_err) {
// got an error response
res->is_error = true;
res->u.error = res_err;
goto end;
}
cJSON *data_obj = cJSON_GetObjectItemCaseSensitive(json_obj, key_data);
if (data_obj) {
// new message object
res->u.msg = get_message_new();
if (!res->u.msg) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
ret = -1;
goto end;
}
// network ID
if ((ret = json_get_string(data_obj, key_net, res->u.msg->net_id, sizeof(res->u.msg->net_id))) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_net);
ret = -1;
goto end;
}
// parent1MessageId
if ((ret = json_get_string(data_obj, key_p1_id, res->u.msg->parent1, sizeof(res->u.msg->parent1))) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_p1_id);
ret = -1;
goto end;
}
// parent2MessageId
if ((ret = json_get_string(data_obj, key_p2_id, res->u.msg->parent2, sizeof(res->u.msg->parent2))) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_p2_id);
ret = -1;
goto end;
}
// nonce
if ((ret = json_get_string(data_obj, key_nonce, res->u.msg->nonce, sizeof(res->u.msg->nonce))) != 0) {
printf("[%s:%d]: gets %s json string failed\n", __func__, __LINE__, key_nonce);
ret = -1;
goto end;
}
cJSON *payload = cJSON_GetObjectItemCaseSensitive(data_obj, key_payload);
if (payload) {
if ((ret = json_get_uint32(payload, key_type, &res->u.msg->type) != 0)) {
printf("[%s:%d]: gets %s failed\n", __func__, __LINE__, key_type);
ret = -1;
goto end;
}
switch (res->u.msg->type) {
case MSG_PAYLOAD_TRANSACTION:
deser_transaction(payload, res);
break;
case MSG_PAYLOAD_MILESTONE:
deser_milestone(payload, res);
break;
case MSG_PAYLOAD_INDEXATION:
deser_indexation(payload, res);
break;
default:
// do nothing
break;
}
} else {
printf("[%s:%d]: invalid message: payload not found\n", __func__, __LINE__);
ret = -1;
goto end;
}
}
end:
cJSON_Delete(json_obj);
return ret;
}
int get_message_by_id(iota_client_conf_t const *conf, char const msg_id[], res_message_t *res) {
int ret = 0;
if (conf == NULL || msg_id == NULL || res == NULL) {
// invalid parameters
return -1;
}
if (strlen(msg_id) != 64) {
// invalid output id length
printf("[%s:%d]: invalid output id length: %zu\n", __func__, __LINE__, strlen(msg_id));
return -1;
}
// compose restful api command
iota_str_t *cmd = iota_str_new(conf->url);
if (cmd == NULL) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
return -1;
}
if (iota_str_append(cmd, "api/v1/messages/")) {
printf("[%s:%d]: cmd append failed\n", __func__, __LINE__);
return -1;
}
if (iota_str_append(cmd, msg_id)) {
printf("[%s:%d]: output id append failed\n", __func__, __LINE__);
return -1;
}
// http client configuration
http_client_config_t http_conf = {0};
http_conf.url = cmd->buf;
if (conf->port) {
http_conf.port = conf->port;
}
byte_buf_t *http_res = byte_buf_new();
if (http_res == NULL) {
printf("[%s:%d]: OOM\n", __func__, __LINE__);
ret = -1;
goto done;
}
// send request via http client
long st = 0;
if ((ret = http_client_get(&http_conf, http_res, &st)) == 0) {
byte_buf2str(http_res);
// json deserialization
ret = deser_get_message((char const *const)http_res->data, res);
}
done:
// cleanup command
iota_str_destroy(cmd);
byte_buf_free(http_res);
return ret;
}
size_t get_message_milestone_signature_count(res_message_t const *const res) {
if (res) {
if (!res->is_error && res->u.msg->type == MSG_PAYLOAD_MILESTONE) {
payload_milestone_t *milestone = (payload_milestone_t *)res->u.msg->payload;
return utarray_len(milestone->signatures);
}
}
return 0;
}
char *get_message_milestone_signature(res_message_t const *const res, size_t index) {
if (res) {
if (!res->is_error && res->u.msg->type == MSG_PAYLOAD_MILESTONE) {
payload_milestone_t *milestone = (payload_milestone_t *)res->u.msg->payload;
if (utarray_len(milestone->signatures)) {
char **p = (char **)utarray_eltptr(milestone->signatures, index);
return *p;
}
}
}
return NULL;
}
msg_payload_type_t get_message_payload_type(res_message_t const *const res) {
if (res) {
if (!res->is_error) {
return res->u.msg->type;
}
}
return MSG_PAYLOAD_UNKNOW;
}
size_t payload_tx_inputs_count(payload_tx_t const *const tx) {
if (tx) {
return utarray_len(tx->intputs);
}
return 0;
}
char *payload_tx_inputs_tx_id(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_tx_input_t *input = (payload_tx_input_t *)utarray_eltptr(tx->intputs, index);
if (input) {
return input->tx_id;
}
}
return NULL;
}
uint32_t payload_tx_inputs_tx_output_index(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_tx_input_t *input = (payload_tx_input_t *)utarray_eltptr(tx->intputs, index);
return input->tx_output_index;
}
return 0;
}
size_t payload_tx_outputs_count(payload_tx_t const *const tx) {
if (tx) {
return utarray_len(tx->outputs);
}
return 0;
}
char *payload_tx_outputs_address(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_tx_output_t *out = (payload_tx_output_t *)utarray_eltptr(tx->outputs, index);
if (out) {
return out->address;
}
}
return NULL;
}
uint64_t payload_tx_outputs_amount(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_tx_output_t *out = (payload_tx_output_t *)utarray_eltptr(tx->outputs, index);
if (out) {
return out->amount;
}
}
return 0;
}
size_t payload_tx_blocks_count(payload_tx_t const *const tx) {
if (tx) {
return utarray_len(tx->unlock_blocks);
}
return 0;
}
char *payload_tx_blocks_public_key(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_unlock_block_t *b = (payload_unlock_block_t *)utarray_eltptr(tx->unlock_blocks, index);
if (b) {
return b->pub_key;
}
}
return NULL;
}
char *payload_tx_blocks_signature(payload_tx_t const *const tx, size_t index) {
if (tx) {
payload_unlock_block_t *b = (payload_unlock_block_t *)utarray_eltptr(tx->unlock_blocks, index);
if (b) {
return b->signature;
}
}
return NULL;
}
| 28.398892 | 132 | 0.632803 |
59548dfe62e04011ff03de4bb63c6770b9a9e845 | 2,219 | h | C | interface/src/ui/overlays/ModelOverlay.h | alphaversiond/hifi | 735944c912a29e948a557dbff13e0a1cb71d954e | [
"Apache-2.0"
] | 2 | 2018-05-07T16:12:38.000Z | 2019-04-28T17:32:01.000Z | interface/src/ui/overlays/ModelOverlay.h | alphaversiond/hifi | 735944c912a29e948a557dbff13e0a1cb71d954e | [
"Apache-2.0"
] | null | null | null | interface/src/ui/overlays/ModelOverlay.h | alphaversiond/hifi | 735944c912a29e948a557dbff13e0a1cb71d954e | [
"Apache-2.0"
] | null | null | null | //
// ModelOverlay.h
//
//
// Created by Clement on 6/30/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_ModelOverlay_h
#define hifi_ModelOverlay_h
#include <Model.h>
#include "Volume3DOverlay.h"
class ModelOverlay : public Volume3DOverlay {
Q_OBJECT
public:
static QString const TYPE;
virtual QString getType() const override { return TYPE; }
virtual QString getName() const override;
ModelOverlay();
ModelOverlay(const ModelOverlay* modelOverlay);
virtual void update(float deltatime) override;
virtual void render(RenderArgs* args) override;
void setProperties(const QVariantMap& properties) override;
QVariant getProperty(const QString& property) override;
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance,
BoxFace& face, glm::vec3& surfaceNormal) override;
virtual bool findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction,
float& distance, BoxFace& face, glm::vec3& surfaceNormal, QString& extraInfo) override;
virtual ModelOverlay* createClone() const override;
virtual bool addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction) override;
virtual void removeFromScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction) override;
void locationChanged(bool tellPhysics) override;
float getLoadPriority() const { return _loadPriority; }
protected:
// helper to extract metadata from our Model's rigged joints
template <typename itemType> using mapFunction = std::function<itemType(int jointIndex)>;
template <typename vectorType, typename itemType>
vectorType mapJoints(mapFunction<itemType> function) const;
private:
ModelPointer _model;
QVariantMap _modelTextures;
QUrl _url;
bool _updateModel = { false };
bool _scaleToFit = { false };
float _loadPriority { 0.0f };
};
#endif // hifi_ModelOverlay_h
| 33.621212 | 137 | 0.729608 |
74ee37ee94a32b94a4acf31296dbc24ef8490811 | 19,469 | c | C | src/lui.c | zhaozg/lui | 08694befe287deb7a4c25e865c2184a8c9cd06e1 | [
"MIT"
] | 36 | 2017-02-28T03:12:46.000Z | 2021-11-30T10:49:34.000Z | src/lui.c | zhaozg/lui | 08694befe287deb7a4c25e865c2184a8c9cd06e1 | [
"MIT"
] | 4 | 2018-05-05T17:28:46.000Z | 2019-01-11T05:51:03.000Z | src/lui.c | zhaozg/lui | 08694befe287deb7a4c25e865c2184a8c9cd06e1 | [
"MIT"
] | 2 | 2018-05-06T10:33:33.000Z | 2019-04-28T09:33:50.000Z | #include "lui.h"
static lua_State* _main_L= NULL;
inline static int luaL_checkboolean(lua_State *L, int n)
{
luaL_checktype(L, n, LUA_TBOOLEAN);
return lua_toboolean(L, n);
}
/* make libui object felixble */
struct wrap
{
uiControl *control;
int ref;
};
inline static void* check_object(lua_State *L, int n, const char* cls)
{
void *p = luaL_testudata(L, n, cls);
if (p==NULL)
{
p = auxiliar_checkgroup(L, cls, n);
}
return (((struct wrap*)p)->control);
}
#define UI_RETURN_SELF lua_pushvalue(L, 1); return 1;
#define UI_CREATE_META(t) \
luaL_newmetatable(L, "libui." #t); \
lua_pushstring(L, "__index"); \
lua_newtable(L); \
lua_pushstring(L, "class"); \
lua_pushstring(L, "libui." #t); \
lua_rawset(L, -3); \
luaL_setfuncs(L, meta_ ## t, 0); \
lua_rawset(L, -3); \
lua_pushstring(L, "__gc"); \
lua_pushcfunction(L, l_uigc); \
lua_rawset(L, -3); \
lua_pushstring(L, "__tostring"); \
lua_pushcfunction(L, auxiliar_tostring); \
lua_rawset(L, -3); \
lua_pop(L, 1);
#define UI_CHECK_OBJECT(n, t) \
check_object(L, n, "libui." #t)
#define UI_CREATE_OBJECT(t, c) \
struct wrap *w = lua_newuserdata(L, sizeof(struct wrap)); \
w->control = uiControl(c); \
w->ref = 0; \
luaL_setmetatable(L, "libui." #t);
#define UI_CREATE_OBJECT_REF(t, c) \
struct wrap *w = lua_newuserdata(L, sizeof(struct wrap)); \
w->control = uiControl(c); \
w->ref = 1; \
luaL_setmetatable(L, "libui." #t);
#define UI_SET_GROUP(cls, grp) \
auxiliar_add2group(L, "libui." #cls, "libui." #grp);
#define UI_CHECK_GROUP(n, t) \
auxiliar_checkgroup(L, "libui." #t, n)
#define CREATE_USER_META(t) \
luaL_newmetatable(L, "libui.user." #t); \
lua_pushstring(L, "__index"); \
lua_newtable(L); \
lua_pushstring(L, "class"); \
lua_pushstring(L, "libui.user." #t); \
lua_rawset(L, -3); \
luaL_setfuncs(L, meta_ ## t, 0); \
lua_rawset(L, -3); \
lua_pushstring(L, "__tostring"); \
lua_pushcfunction(L, auxiliar_tostring); \
lua_rawset(L, -3); \
lua_pop(L, 1);
#define CREATE_USER_OBJECT(t, c) \
*(ui ## t**)lua_newuserdata(L, sizeof(ui ## t*)) = c; \
luaL_setmetatable(L, "libui.user." #t);
#define CHECK_USER_OBJECT(n, t) \
*((ui ## t**)luaL_checkudata(L, n, "libui.user." #t ))
/* general libui callback mechanism to lua */
static void create_callback_data(lua_State *L, int n, const char *event)
{
/* Push registery key: userdata pointer to control */
void *control = UI_CHECK_OBJECT(1, Control);
lua_pushlightuserdata(L, control);
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_isnil(L, -1))
{
lua_pop(L, 1);
lua_pushlightuserdata(L, control);
lua_newtable(L);
lua_rawset(L, LUA_REGISTRYINDEX);
lua_pushlightuserdata(L, control);
lua_rawget(L, LUA_REGISTRYINDEX);
}
/* Create table with event/callback data */
lua_pushstring(L, event);
lua_newtable(L);
lua_pushvalue(L, n);
lua_setfield(L, -2, "udata");
lua_pushvalue(L, 2);
lua_setfield(L, -2, "fn");
lua_pushvalue(L, 3);
lua_setfield(L, -2, "data");
lua_rawset(L, -3);
/* Store in registry */
lua_pop(L, 1);
}
static int traceback(lua_State *L)
{
if (!lua_isstring(L, 1)) /* 'message' not a string? */
return 1; /* keep it intact */
lua_pushglobaltable(L);
lua_getfield(L, -1, "debug");
lua_remove(L, -2);
if (!lua_istable(L, -1))
{
lua_pop(L, 1);
return 1;
}
lua_getfield(L, -1, "traceback");
if (!lua_isfunction(L, -1))
{
lua_pop(L, 2);
return 1;
}
lua_pushvalue(L, 1); /* pass error message */
lua_pushinteger(L, 2); /* skip this function and traceback */
lua_call(L, 2, 1); /* call debug.traceback */
return 1;
}
static int callback(lua_State *L, void *control, const char *event)
{
int ret = 0;
int err = 0;
/* Get the traceback function in case of error ,+1 */
lua_pushcfunction(L, traceback);
err = lua_gettop(L);
/* Find table with callback data in registry , +1 */
lua_pushlightuserdata(L, control);
lua_rawget(L, LUA_REGISTRYINDEX);
luaL_checktype(L, -1, LUA_TTABLE);
/* Find table with event, +1 */
lua_pushstring(L, event);
lua_rawget(L, -2);
luaL_checktype(L, -1, LUA_TTABLE);
/* Get function, control userdata and callback data, +3 */
lua_getfield(L, -1, "fn");
luaL_checktype(L, -1, LUA_TFUNCTION);
lua_getfield(L, -2, "udata");
luaL_checktype(L, -1, LUA_TUSERDATA);
lua_getfield(L, -3, "data");
/* Call function */
if (lua_pcall(L, 2, 1, err))
{
luaL_error(L, "InnerException: %s", lua_tostring(L, -1));
lua_pop(L, 1);
}
else
{
if (lua_isboolean(L, -1))
ret = lua_toboolean(L, -1);
else if (!lua_isnoneornil(L, -1))
ret = luaL_checkinteger(L, -1);
lua_pop(L, 1);
}
/* Remove table with given event */
/* Remove table with callback data in registry */
/* Remove the traceback function */
lua_pop(L, 3);
return ret;
}
/* all ui Control should not be gc, we need destroy it manually */
/* garbage collection for libui object */
static int l_uigc(lua_State *L)
{
struct wrap *w = lua_touserdata(L, 1);
uiControl *control = NULL, *parent = NULL;
if(control && w->ref==0 )
{
/*
* uint32_t s = w->control->TypeSignature;
*/
control = w->control;
parent = uiControlParent(control);
if (parent)
{
if (parent->TypeSignature == 0x57696E64)
{
uiWindowSetChild(uiWindow(parent), NULL);
}
if (parent->TypeSignature == 0x47727062)
{
uiGroupSetChild((uiGroup*)uiWindow(parent), NULL);
}
}
uiControlDestroy(control);
w->control = NULL;
}
return 0;
}
/* real code */
#include "enum.c"
#include "lcontrol.c"
#include "larea.c"
#include "lattribute.c"
#include "lattributedstr.c"
#include "lbox.c"
#include "lbutton.c"
#include "lcheckbox.c"
#include "lcolorbutton.c"
#include "lcombobox.c"
#include "ldatetimerpicker.c"
#include "ldraw.c"
#include "lentry.c"
#include "lfontbutton.c"
#include "lform.c"
#include "lgrid.c"
#include "lgroup.c"
#include "limage.c"
#include "llabel.c"
#include "lmenu.c"
#include "lmenuitem.c"
#include "lmultiline.c"
#include "lprogressbar.c"
#include "lradiobuttons.c"
#include "lseparator.c"
#include "lslider.c"
#include "lspinbox.c"
#include "ltab.c"
#include "ltable.c"
#include "lwindow.c"
/* Various top level */
static int l_uiInit(lua_State *L)
{
int ret = 1;
uiInitOptions o;
memset(&o, 0, sizeof(uiInitOptions));
const char *err = uiInit(&o);
if (err)
{
lua_pushnil(L);
lua_pushstring(L, err);
uiFreeInitError(err);
ret = 2;
}
else
lua_pushboolean(L, 1);
return ret;
}
static int l_uiUninit(lua_State *L)
{
uiUninit();
return 0;
}
static int l_uiMain(lua_State *L)
{
uiMain();
return 0;
}
static int l_uiMainStep(lua_State *L)
{
lua_pushboolean(L, uiMainStep(luaL_checkboolean(L, 1)));
return 1;
}
static int l_uiMainSteps(lua_State *L)
{
uiMainSteps();;
return 0;
}
static int l_uiQuit(lua_State *L)
{
uiQuit();
return 0;
}
static int l_uiUserBugCannotSetParentOnToplevel(lua_State *L)
{
uiUserBugCannotSetParentOnToplevel(luaL_checkstring(L, 1));
return 0;
}
static int l_QueueDumpWriter(lua_State* L, const void* p, size_t sz, void* B)
{
(void)L;
luaL_addlstring((luaL_Buffer*) B, (const char*) p, sz);
return 0;
}
static const char* l_QueueThreadDump(lua_State* L, int idx, size_t* l)
{
if (lua_isstring(L, idx))
{
return lua_tolstring(L, idx, l);
}
else
{
const char* buff = NULL;
int top = lua_gettop(L);
luaL_Buffer b;
int test_lua_dump;
luaL_checktype(L, idx, LUA_TFUNCTION);
lua_pushvalue(L, idx);
luaL_buffinit(L, &b);
test_lua_dump = (lua_dump(L, l_QueueDumpWriter, &b, 1) == 0);
if (test_lua_dump)
{
luaL_pushresult(&b);
buff = lua_tolstring(L, -1, l);
}
else
luaL_error(L, "Error: unable to dump given function");
lua_settop(L, top);
return buff;
}
}
typedef struct value_s
{
int type;
union
{
double n;
int i;
struct
{
int l;
char* p;
} s;
void* p;
} v;
} Value;
#define MAX_ARGS_NUM 9
typedef struct QueueArg_s
{
size_t sz;
char *entry;
lua_State *L;
size_t argc;
Value argv[MAX_ARGS_NUM];
} QueueArg;
// This must in main thread
static void l_QueueMain(void *data)
{
int i;
int top = 0;
QueueArg *arg = (QueueArg*)data;
lua_State *L = arg->L;
top = lua_gettop(L);
lua_pushcfunction(L, traceback);
luaL_loadbuffer(L, arg->entry, arg->sz, "=queue");
luaL_checktype(L, -1, LUA_TFUNCTION);
for(i=0; i<arg->argc; i++)
{
Value *val = arg->argv+i;
switch(val->type)
{
case LUA_TBOOLEAN:
lua_pushboolean(L, val->v.i);
break;
case LUA_TNUMBER:
lua_pushnumber(L, val->v.n);
break;
case LUA_TSTRING:
lua_pushlstring(L, val->v.s.p, val->v.s.l);
break;
case LUA_TNIL:
lua_pushnil(L);
break;
}
}
if (lua_pcall(L, arg->argc, 0, top+1))
{
luaL_error(L, lua_tostring(L, -1));
lua_pop(L, 1);
}
/* remove traceback function*/
lua_pop(L, 1);
luaL_argcheck(L, top == lua_gettop(L), 1, "stack not balance");
}
static int l_uiQueueMain(lua_State *L)
{
int i, top;
QueueArg *arg = NULL;
size_t sz;
const char* p;
// check main thread exist
if (_main_L==NULL)
{
luaL_error(L, "Can't access main thread");
return 0;
}
top = lua_gettop(L);
luaL_checktype(L, 1, LUA_TFUNCTION);
arg = malloc(sizeof(QueueArg));
memset(arg, 0, sizeof(QueueArg));
p = l_QueueThreadDump(L, 1, &sz);
arg->entry = malloc(sz+1);
memcpy(arg->entry, p, sz);
arg->entry[sz] = '\0';
arg->sz = sz;
arg->L = _main_L;
arg->argc = (top-1 > MAX_ARGS_NUM) ? MAX_ARGS_NUM : top - 1;
for(i=0; i < arg->argc; i++)
{
int type = lua_type(L, i+2);
Value *val = arg->argv+i;
val->type = type;
luaL_argcheck(L, type==LUA_TBOOLEAN || type==LUA_TNUMBER ||
type==LUA_TSTRING || type==LUA_TNIL,
i+2,
"only accpet nil, boolean, number or string value");
if (val->type==LUA_TBOOLEAN)
{
val->v.i = lua_toboolean(L, i+2);
}
else if(val->type==LUA_TNUMBER)
{
val->v.n = lua_tonumber(L, i+2);
val->type = LUA_TNUMBER;
}
else if(val->type==LUA_TSTRING)
{
p = lua_tolstring(L,i+2, &sz);
val->v.s.l = sz;
val->v.s.p = malloc(sz);
memcpy(val->v.s.p, p, sz);
}
else
val->type = LUA_TNIL;
}
uiQueueMain(l_QueueMain, arg);
return 0;
}
static int on_ShouldQuit(void *data)
{
int ret = 0;
int err = 0;
lua_State *L = data;
/* Get the traceback function in case of error */
lua_pushcfunction(L, traceback);
err = lua_gettop(L);
/* Find table with callback data in registry */
lua_pushlightuserdata(L, (void*)on_ShouldQuit);
lua_gettable(L, LUA_REGISTRYINDEX);
/* Get function, control userdata and callback data */
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, "fn");
luaL_checktype(L, -1, LUA_TFUNCTION);
lua_getfield(L, -2, "data");
/* Call function */
if (lua_pcall(L, 1, 1, err))
{
luaL_error(L, lua_tostring(L, -1));
lua_pop(L, 1);
}
else
{
if (lua_isboolean(L, -1))
ret = lua_toboolean(L, -1);
else if (!lua_isnoneornil(L, -1))
ret = luaL_checkinteger(L, -1);
lua_pop(L, 1);
}
/* Remove table with callback data in registry */
lua_pop(L, 1);
/* Remove the traceback function */
lua_pop(L, 1);
return ret;
}
static int l_uiOnShouldQuit(lua_State *L)
{
uiOnShouldQuit(on_ShouldQuit, L);
/* Push registery key: userdata pointer to control */
lua_pushlightuserdata(L, (void*)on_ShouldQuit);
lua_newtable(L);
lua_pushvalue(L, 1);
lua_setfield(L, -2, "fn");
lua_pushvalue(L, 2);
lua_setfield(L, -2, "data");
/* Store in registry */
lua_settable(L, LUA_REGISTRYINDEX);
return 0;
}
static int l_timer_cb(void *data);
static int l_uiTimer(lua_State *L);
static int l_timer_cb(void *data)
{
int status = 0;
lua_State *L = (lua_State*)data;
lua_pushlightuserdata(L, (void*)l_uiTimer);
lua_rawget(L, LUA_REGISTRYINDEX);
lua_pushlightuserdata(L, (void*)l_timer_cb);
lua_rawget(L, LUA_REGISTRYINDEX);
status = lua_pcall(L, 1, 1, 0);
if(status==0)
{
if (lua_isnumber(L, -1))
status = lua_tointeger(L, -1);
else
status = lua_toboolean(L, -1);
lua_pop(L, 1);
}
else
{
lua_pushfstring(L, "uiTimer callback fail: %s", lua_tostring(L, -1));
lua_remove(L, -2);
lua_error(L);
}
return status;
}
static int l_uiTimer(lua_State *L)
{
int milliseconds = luaL_checkinteger(L, 1);
luaL_checktype(L, 2, LUA_TFUNCTION);
if(lua_isnone(L, 3))
lua_pushnil(L);
lua_pushlightuserdata(L, (void*)l_uiTimer);
lua_pushvalue(L, 2);
lua_rawset(L, LUA_REGISTRYINDEX);
lua_pushlightuserdata(L, (void*)l_timer_cb);
lua_pushvalue(L, 3);
lua_rawset(L, LUA_REGISTRYINDEX);
uiTimer(milliseconds, l_timer_cb, L);
return 0;
}
static struct luaL_Reg lui_table[] =
{
{ "Init", l_uiInit },
{ "Uninit", l_uiUninit },
{ "Main", l_uiMain },
{ "MainStep", l_uiMainStep },
{ "MainSteps", l_uiMainSteps },
{ "Quit", l_uiQuit },
{ "QueueMain", l_uiQueueMain },
{ "OnShouldQuit", l_uiOnShouldQuit },
{
"UserBugCannotSetParentOnTopLevel",
l_uiUserBugCannotSetParentOnToplevel
},
{ "Timer", l_uiTimer },
{ "OpenFile", l_uiOpenFile },
{ "SaveFile", l_uiSaveFile },
{ "MsgBox", l_uiMsgBox },
{ "MsgBoxError", l_uiMsgBoxError },
{ "NewArea", l_uiNewArea },
{ "NewAttribute", l_uiNewAttribute },
{ "NewAttributedString", l_uiNewAttributedString },
{ "NewButton", l_uiNewButton },
{ "NewCheckbox", l_uiNewCheckbox },
{ "NewCombobox", l_uiNewCombobox },
{ "NewColorButton", l_uiNewColorButton },
{ "NewDateTimePicker", l_uiNewDateTimePicker },
{ "NewDatePicker", l_uiNewDatePicker },
{ "NewEditableCombobox", l_uiNewEditableCombobox },
{ "NewEntry", l_uiNewEntry },
{ "NewFontButton", l_uiNewFontButton },
{ "NewForm", l_uiNewForm },
{ "NewGrid", l_uiNewGrid },
{ "NewGroup", l_uiNewGroup },
{ "NewHorizontalBox", l_uiNewHorizontalBox },
{ "NewHorizontalSeparator", l_uiNewHorizontalSeparator },
{ "NewImage", l_uiNewImage },
{ "NewLabel", l_uiNewLabel },
{ "NewMenu", l_uiNewMenu },
{ "NewMultilineEntry", l_uiNewMultilineEntry },
{
"NewNonWrappingMultilineEntry",
l_uiNewNonWrappingMultilineEntry
},
{ "NewOpenTypeFeatures", l_uiNewOpenTypeFeatures },
{ "NewPasswordEntry", l_uiNewPasswordEntry },
{ "NewProgressBar", l_uiNewProgressBar },
{ "NewRadioButtons", l_uiNewRadioButtons },
{ "NewSearchEntry", l_uiNewSearchEntry },
{ "NewSlider", l_uiNewSlider },
{ "NewSpinbox", l_uiNewSpinbox },
{ "NewTimePicker", l_uiNewTimePicker },
{ "NewTab", l_uiNewTab },
{ "NewTable", l_uiNewTable },
{ "NewTableValue", l_uiTableValueNew },
{ "NewTableModelHandler", l_uiNewTableModelHandler },
{
"NewTableTextColumnOptionalParams",
l_uiNewTableTextColumnOptionalParams
},
{ "NewVerticalBox", l_uiNewVerticalBox },
{ "NewVerticalSeparator", l_uiNewVerticalSeparator },
{ "NewWindow", l_uiNewWindow },
{ "NewFontDescriptor", l_uiNewFontDescriptor},
{ "DrawNewAreaHandler", l_uiDrawNewAreaHandler },
{ "DrawNewBrush", l_uiDrawNewBrush },
{ "DrawNewPath", l_uiDrawNewPath },
{ "DrawNewMatrix", l_uiDrawNewMatrix },
{ "DrawNewStrokeParams", l_uiDrawNewStrokeParams },
{ "DrawNewTextLayout", l_uiDrawNewTextLayout },
{ "DrawNewTextLayoutParams",l_uiDrawNewTextLayoutParams },
{ NULL, NULL }
};
LUA_API int luaopen_lui(lua_State *L)
{
UI_CREATE_META(Control)
UI_CREATE_META(Area)
UI_SET_GROUP(Area, Control);
UI_CREATE_META(Box)
UI_SET_GROUP(Box, Control);
UI_CREATE_META(Button)
UI_SET_GROUP(Button, Control);
UI_CREATE_META(Checkbox)
UI_SET_GROUP(Checkbox, Control);
UI_CREATE_META(Combobox)
UI_SET_GROUP(Combobox, Control);
UI_CREATE_META(ColorButton)
UI_SET_GROUP(ColorButton, Control);
UI_CREATE_META(DateTimePicker)
UI_SET_GROUP(DateTimePicker, Control);
UI_CREATE_META(EditableCombobox)
UI_SET_GROUP(EditableCombobox, Control);
UI_CREATE_META(Entry)
UI_SET_GROUP(Entry, Control);
UI_CREATE_META(FontButton)
UI_SET_GROUP(FontButton, Control);
UI_CREATE_META(Form)
UI_SET_GROUP(Form, Control);
UI_CREATE_META(Grid)
UI_SET_GROUP(Grid, Control);
UI_CREATE_META(Group)
UI_SET_GROUP(Group, Control);
UI_CREATE_META(Image)
UI_SET_GROUP(Image, Control);
UI_CREATE_META(Label)
UI_SET_GROUP(Label, Control);
UI_CREATE_META(MenuItem)
UI_SET_GROUP(MenuItem, Control);
UI_CREATE_META(Menu)
UI_SET_GROUP(Menu, Control);
UI_CREATE_META(MultilineEntry)
UI_SET_GROUP(MultilineEntry, Control);
UI_CREATE_META(ProgressBar)
UI_SET_GROUP(ProgressBar, Control);
UI_CREATE_META(RadioButtons)
UI_SET_GROUP(RadioButtons, Control);
UI_CREATE_META(Separator)
UI_SET_GROUP(Separator, Control);
UI_CREATE_META(Slider)
UI_SET_GROUP(Slider, Control);
UI_CREATE_META(Spinbox)
UI_SET_GROUP(Spinbox, Control);
UI_CREATE_META(Tab)
UI_SET_GROUP(Tab, Control);
UI_CREATE_META(Table)
UI_SET_GROUP(Table, Control);
UI_CREATE_META(Window)
UI_SET_GROUP(Window, Control);
CREATE_USER_META(Attribute)
CREATE_USER_META(AttributedString)
CREATE_USER_META(FontDescriptor)
CREATE_USER_META(OpenTypeFeatures)
CREATE_USER_META(TableModel)
CREATE_USER_META(TableModelHandler)
CREATE_USER_META(TableValue)
CREATE_USER_META(TableParams)
/* draw, not finished */
CREATE_DRAWMETA
luaL_newlib(L, lui_table);
l_REG_UI_ENUM(L, lua_gettop(L));
// store as a global variable, to support multi-thread
if (_main_L==NULL)
_main_L = L;
return 1;
}
| 25.786755 | 77 | 0.600647 |
25d6652658d3d75bfd5ba2818c1a02c5b73bc14e | 1,867 | h | C | companyreg/include/alibabacloud/companyreg/model/PhotoInvoiceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-02-02T03:54:39.000Z | 2021-12-13T01:32:55.000Z | companyreg/include/alibabacloud/companyreg/model/PhotoInvoiceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-03-14T07:44:54.000Z | 2021-11-26T07:43:25.000Z | companyreg/include/alibabacloud/companyreg/model/PhotoInvoiceRequest.h | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 69 | 2018-01-22T09:45:52.000Z | 2022-03-28T07:58:38.000Z | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_COMPANYREG_MODEL_PHOTOINVOICEREQUEST_H_
#define ALIBABACLOUD_COMPANYREG_MODEL_PHOTOINVOICEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/companyreg/CompanyregExport.h>
namespace AlibabaCloud
{
namespace Companyreg
{
namespace Model
{
class ALIBABACLOUD_COMPANYREG_EXPORT PhotoInvoiceRequest : public RpcServiceRequest
{
public:
PhotoInvoiceRequest();
~PhotoInvoiceRequest();
int getUploadedNum()const;
void setUploadedNum(int uploadedNum);
std::string getFileUrlList()const;
void setFileUrlList(const std::string& fileUrlList);
long getUploadedStamp()const;
void setUploadedStamp(long uploadedStamp);
std::string getBizId()const;
void setBizId(const std::string& bizId);
std::string getFileUrl()const;
void setFileUrl(const std::string& fileUrl);
bool getIsMobile()const;
void setIsMobile(bool isMobile);
private:
int uploadedNum_;
std::string fileUrlList_;
long uploadedStamp_;
std::string bizId_;
std::string fileUrl_;
bool isMobile_;
};
}
}
}
#endif // !ALIBABACLOUD_COMPANYREG_MODEL_PHOTOINVOICEREQUEST_H_ | 29.634921 | 86 | 0.736476 |
f7a8f734ccde086c2c79f1516f7102e72f886a51 | 1,930 | h | C | core/Core/RealtimeServices/Lockable.h | esayui/mworks | 0522e5afc1e30fdbf1e67cedd196ee50f7924499 | [
"MIT"
] | null | null | null | core/Core/RealtimeServices/Lockable.h | esayui/mworks | 0522e5afc1e30fdbf1e67cedd196ee50f7924499 | [
"MIT"
] | null | null | null | core/Core/RealtimeServices/Lockable.h | esayui/mworks | 0522e5afc1e30fdbf1e67cedd196ee50f7924499 | [
"MIT"
] | null | null | null | /**
* Lockable.h
*
* Description: A thread mutex.
*
* History:
*
* Copyright 2004 MIT. All rights reserved.
*/
#ifndef _LOCKABLE_H
#define _LOCKABLE_H
#include <boost/thread/mutex.hpp>
#include "MWorksMacros.h"
BEGIN_NAMESPACE_MW
// macros for locking gets and sets
#define SAFE_GET(type, A) type result; lock(); result = A; unlock(); return result;
#define SAFE_SET(A, B) lock(); A = B; unlock();
//#define VERBOSE_LOCKING 0
#ifdef VERBOSE_LOCKING
#define M_ISLOCK mdebug("Locking in file %s at line %d", __FILE__, __LINE__); lock();
#define M_HASLOCK(type) mdebug("Locking in file %s at line %d", __FILE__, __LINE__); type->lock();
#define M_ISUNLOCK mdebug("Unlocking in file %s at line %d", __FILE__, __LINE__); unlock();
#define M_HASUNLOCK(type) mdebug("Locking in file %s at line %d", __FILE__, __LINE__); type->unlock();
#else
#define M_ISLOCK lock();
#define M_HASLOCK(type) type->lock();
#define M_ISUNLOCK unlock();
#define M_HASUNLOCK(type) type->unlock();
#endif
class Lockable {
private:
// the mutex to lock on
boost::mutex theMutex;
public:
Lockable() { }
virtual ~Lockable() { }
Lockable(const Lockable &other) {
// Don't attempt to copy the mutex
}
Lockable& operator=(const Lockable &other) {
// Don't attempt to copy the mutex
return (*this);
}
/**
* Locks the mutex.
*/
inline void lock(){
theMutex.lock();
}
/**
* Unlocks the mutex.
*/
inline void unlock(){
theMutex.unlock();
}
friend class Locker;
};
class Locker {
public:
explicit Locker(Lockable &lockable) : theLock(lockable.theMutex) { }
private:
boost::mutex::scoped_lock theLock;
};
END_NAMESPACE_MW
#endif
| 16.637931 | 106 | 0.587565 |
6e4bd9dce74802f87480ffe0e71bc5215da290de | 3,955 | c | C | usdk/sosousdk.c | fengjixuchui/soso | 85df4eb4d6d510161bf3b0eb3cd3564df2d98771 | [
"BSD-2-Clause"
] | null | null | null | usdk/sosousdk.c | fengjixuchui/soso | 85df4eb4d6d510161bf3b0eb3cd3564df2d98771 | [
"BSD-2-Clause"
] | null | null | null | usdk/sosousdk.c | fengjixuchui/soso | 85df4eb4d6d510161bf3b0eb3cd3564df2d98771 | [
"BSD-2-Clause"
] | null | null | null | #include <stdlib.h>
#include <string.h>
#include "sosousdk.h"
#include "../kernel/syscalltable.h"
static int syscall0(int num)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num));
return a;
}
static int syscall1(int num, int p1)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((int)p1));
return a;
}
static int syscall2(int num, int p1, int p2)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((int)p1), "c" ((int)p2));
return a;
}
static int syscall3(int num, int p1, int p2, int p3)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((int)p1), "c" ((int)p2), "d"((int)p3));
return a;
}
static int syscall4(int num, int p1, int p2, int p3, int p4)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((int)p1), "c" ((int)p2), "d" ((int)p3), "S" ((int)p4));
return a;
}
static int syscall5(int num, int p1, int p2, int p3, int p4, int p5)
{
int a;
asm volatile("int $0x80" : "=a" (a) : "0" (num), "b" ((int)p1), "c" ((int)p2), "d" ((int)p3), "S" ((int)p4), "D" ((int)p5));
return a;
}
unsigned int getUptimeMilliseconds()
{
return syscall0(SYS_getUptimeMilliseconds);
}
void sleepMilliseconds(unsigned int ms)
{
syscall1(SYS_sleepMilliseconds, ms);
}
int executeOnTTY(const char *path, char *const argv[], char *const envp[], const char *ttyPath)
{
return syscall4(SYS_executeOnTTY, (int)path, (int)argv, (int)envp, (int)ttyPath);
}
int syscall_ioctl(int fd, int request, void *arg)
{
return syscall3(SYS_ioctl, fd, request, (int)arg);
}
void sendCharacterToTTY(int fd, char c)
{
syscall_ioctl(fd, 0, (void*)(int)c);
}
int syscall_manageMessage(int command, void* message)
{
return syscall2(SYS_manageMessage, command, (int)message);
}
int getMessageQueueCount()
{
return syscall_manageMessage(0, 0);
}
void sendMessage(SosoMessage* message)
{
syscall_manageMessage(1, message);
}
int getNextMessage(SosoMessage* message)
{
return syscall_manageMessage(2, message);
}
int getTTYBufferSize(int fd)
{
return syscall_ioctl(fd, 1, 0);
}
int getTTYBuffer(int fd, TtyUserBuffer* ttyBuffer)
{
return syscall_ioctl(fd, 3, ttyBuffer);
}
int setTTYBuffer(int fd, TtyUserBuffer* ttyBuffer)
{
return syscall_ioctl(fd, 2, ttyBuffer);
}
int getdents(int fd, char *buf, int nbytes)
{
return syscall3(SYS_getdents, fd, (int)buf, nbytes);
}
int execute(const char *path, char *const argv[], char *const envp[])
{
return syscall3(SYS_execute, (int)path, (int)argv, (int)envp);
}
int executep(const char *filename, char *const argv[], char *const envp[])
{
const char* path = getenv("PATH");
if (path)
{
const char* path2 = path;
char* bb = path2;
char single[128];
while (bb != NULL)
{
char* token = strstr(bb, ":");
if (NULL == token)
{
int l = strlen(bb);
if (l > 0)
{
token = bb + l;
}
}
if (token)
{
int len = token - bb;
if (len > 0)
{
strncpy(single, bb, len);
single[len] = '\0';
//printf("%d:[%s]\n", len, single);
strcat(single, "/");
strcat(single, filename);
int result = execute(single, argv, envp);
if (result > 0)
{
return result;
}
}
bb = token + 1;
}
else
{
break;
}
}
}
return -1;
}
int getWorkingDirectory(char *buf, int size)
{
return syscall2(SYS_getWorkingDirectory, (int)buf, size);
}
int setWorkingDirectory(const char *path)
{
return syscall1(SYS_setWorkingDirectory, (int)path);
}
| 21.037234 | 126 | 0.54311 |
91b4a3b80da12bd7cd750afc42cf0f1f17eb3d50 | 111 | c | C | pool/c01/ex05/main.c | rustem-h/C | e65b3e628dcbea89e20859bfd263202db4c53ff6 | [
"MIT"
] | 1 | 2021-08-30T12:38:56.000Z | 2021-08-30T12:38:56.000Z | pool/c01/ex05/main.c | rustem-h/C | e65b3e628dcbea89e20859bfd263202db4c53ff6 | [
"MIT"
] | null | null | null | pool/c01/ex05/main.c | rustem-h/C | e65b3e628dcbea89e20859bfd263202db4c53ff6 | [
"MIT"
] | 1 | 2021-08-11T07:19:32.000Z | 2021-08-11T07:19:32.000Z | #include <unistd.h>
void ft_putstr(char *str);
int main(void)
{
char st[9] = "qwertyuio";
ft_putstr(st);
}
| 11.1 | 26 | 0.648649 |
673f1fd882cec1be660ee0fbe8c7425114351cf9 | 5,715 | h | C | include/b/ref.h | revl/libb | c14ec4a9d549a77be11e584a1ba56208c5568294 | [
"MIT"
] | null | null | null | include/b/ref.h | revl/libb | c14ec4a9d549a77be11e584a1ba56208c5568294 | [
"MIT"
] | null | null | null | include/b/ref.h | revl/libb | c14ec4a9d549a77be11e584a1ba56208c5568294 | [
"MIT"
] | null | null | null | // This file is part of the B library, which is released under the MIT license.
// Copyright (C) 2002-2007, 2016-2020 Damon Revoe <him@revl.org>
// See the file LICENSE for the license terms.
#ifndef B_REF_H
#define B_REF_H
#include "host.h"
B_BEGIN_NAMESPACE
// Smart pointer to instances of classes derived from the 'object' class.
template <class T>
class ref
{
public:
// Constructs a null pointer.
ref();
// Increases the reference count of the object pointed to by 'that'.
ref(const ref& that);
// Initializes this instance with a pointer to an existing object.
ref(T* obj_ptr);
// Initializes this reference using a reference to a subclass.
template <class C>
ref(const ref<C>& that);
// Tests if this is a null pointer.
bool is_null() const;
// Returns a C++ pointer to the controlled object.
T* ptr() const;
// The same as ptr().
operator T*() const;
// Member selection operator.
T* operator ->() const;
// Dereference operator.
T& operator *() const;
// Casts the object pointed to by this smart pointer to the derived
// class 'C' and returns a smart pointer to the resulting object.
//
// Because this method uses 'static_cast' and not 'dynamic_cast',
// it cannot be used if 'T' is a virtual base class of 'C'.
template <class C>
ref<C> cast();
// Various comparison operators.
bool operator ==(const ref& rhs) const;
bool operator ==(T* rhs) const;
bool operator !=(const ref& rhs) const;
bool operator !=(T* rhs) const;
bool operator <(const ref& rhs) const;
bool operator <(T* rhs) const;
bool operator >(const ref& rhs) const;
bool operator >(T* rhs) const;
bool operator <=(const ref& rhs) const;
bool operator <=(T* rhs) const;
bool operator >=(const ref& rhs) const;
bool operator >=(T* rhs) const;
// Switches to a new object. Releases the previously
// controlled object and grabs a reference to the new one.
void assign(T* new_obj);
// Assignment operators.
ref& operator =(const ref& rhs);
ref& operator =(T* new_obj);
template <class C>
ref& operator =(const ref<C>& rhs);
// Switches to a new object without incrementing its
// reference count. Releases the previously controlled object.
void attach(T* new_obj);
// Detaches this smart pointer from the object it points to
// without decrementing the reference count of the object,
// then resets this smart pointer to zero. Returns a C++
// pointer to the detached object.
T* detach();
// Makes this smart pointer instance point to the object
// pointed to by 'that' and vice versa.
void swap(ref& that);
// Releases the controlled object.
~ref();
protected:
T* obj;
};
template <class T>
inline ref<T>::ref() : obj(NULL)
{
}
template <class T>
inline ref<T>::ref(const ref<T>& that)
{
if ((obj = that.ptr()) != NULL)
obj->add_ref();
}
template <class T>
template <class C>
inline ref<T>::ref(const ref<C>& that)
{
if ((obj = that.ptr()) != NULL)
obj->add_ref();
}
template <class T>
inline ref<T>::ref(T* obj_ptr)
{
if ((obj = obj_ptr) != NULL)
obj_ptr->add_ref();
}
template <class T>
inline bool ref<T>::is_null() const
{
return obj == NULL;
}
template <class T>
inline T* ref<T>::ptr() const
{
return obj;
}
template <class T>
inline ref<T>::operator T*() const
{
return obj;
}
template <class T>
inline T* ref<T>::operator ->() const
{
B_ASSERT(obj != NULL);
return obj;
}
template <class T>
inline T& ref<T>::operator *() const
{
return *obj;
}
template <class T>
template <class C>
inline ref<C> ref<T>::cast()
{
return ref<C>(static_cast<C*>(obj));
}
template <class T>
inline bool ref<T>::operator ==(const ref<T>& rhs) const
{
return obj == rhs.obj;
}
template <class T>
inline bool ref<T>::operator ==(T* rhs) const
{
return obj == rhs;
}
template <class T>
inline bool ref<T>::operator !=(const ref<T>& rhs) const
{
return obj != rhs.obj;
}
template <class T>
inline bool ref<T>::operator !=(T* rhs) const
{
return obj != rhs;
}
template <class T>
inline bool ref<T>::operator <(const ref<T>& rhs) const
{
return obj < rhs.obj;
}
template <class T>
inline bool ref<T>::operator <(T* rhs) const
{
return obj < rhs;
}
template <class T>
inline bool ref<T>::operator >(const ref<T>& rhs) const
{
return obj > rhs.obj;
}
template <class T>
inline bool ref<T>::operator >(T* rhs) const
{
return obj > rhs;
}
template <class T>
inline bool ref<T>::operator <=(const ref<T>& rhs) const
{
return obj <= rhs.obj;
}
template <class T>
inline bool ref<T>::operator <=(T* rhs) const
{
return obj <= rhs;
}
template <class T>
inline bool ref<T>::operator >=(const ref<T>& rhs) const
{
return obj >= rhs.obj;
}
template <class T>
inline bool ref<T>::operator >=(T* rhs) const
{
return obj >= rhs;
}
template <class T>
inline void ref<T>::assign(T* new_obj)
{
if (new_obj != NULL)
new_obj->add_ref();
T* old_obj = obj;
obj = new_obj;
if (old_obj != NULL)
old_obj->release();
}
template <class T>
inline ref<T>& ref<T>::operator =(const ref<T>& rhs)
{
assign(rhs.obj);
return *this;
}
template <class T>
inline ref<T>& ref<T>::operator =(T* new_obj)
{
assign(new_obj);
return *this;
}
template <class T>
template <class C>
inline ref<T>& ref<T>::operator =(const ref<C>& rhs)
{
assign(rhs.ptr());
return *this;
}
template <class T>
inline void ref<T>::attach(T* new_obj)
{
if (obj != NULL)
obj->release();
obj = new_obj;
}
template <class T>
inline T* ref<T>::detach()
{
T* this_obj = obj;
obj = NULL;
return this_obj;
}
template <class T>
inline void ref<T>::swap(ref<T>& that)
{
T* this_obj = obj;
obj = that.obj;
that.obj = this_obj;
}
template <class T>
ref<T>::~ref()
{
if (obj != NULL)
obj->release();
}
B_END_NAMESPACE
#endif /* !defined(B_REF_H) */
| 18.028391 | 79 | 0.662117 |
677ff2ddd357de53b666f65fdc1ddebd022a4c90 | 92 | h | C | src/modules/query/intersection.h | thomassangrey/H1B | 7192a8f3c5903d58a834be6e58ab33fe26565725 | [
"MIT"
] | null | null | null | src/modules/query/intersection.h | thomassangrey/H1B | 7192a8f3c5903d58a834be6e58ab33fe26565725 | [
"MIT"
] | null | null | null | src/modules/query/intersection.h | thomassangrey/H1B | 7192a8f3c5903d58a834be6e58ab33fe26565725 | [
"MIT"
] | null | null | null | #include "../utilities/C_arr_L.h"
C_arr_L intersection(C_arr_L temp_array, C_arr_L records); | 46 | 58 | 0.804348 |
bccb8715c8b58286742d662cc2d91132ac3fd8e7 | 3,919 | h | C | src/ftacmp/ifq.tab.cc.h | o-ran-sc/com-gs-lite | 2bc6bde491e4ae54fb54302c052f23a98482eb92 | [
"Apache-2.0"
] | 105 | 2015-01-02T03:41:13.000Z | 2018-10-13T01:32:02.000Z | src/ftacmp/ifq.tab.cc.h | o-ran-sc/com-gs-lite | 2bc6bde491e4ae54fb54302c052f23a98482eb92 | [
"Apache-2.0"
] | 1 | 2015-03-09T17:00:38.000Z | 2015-03-16T20:27:34.000Z | src/ftacmp/ifq.tab.cc.h | o-ran-sc/com-gs-lite | 2bc6bde491e4ae54fb54302c052f23a98482eb92 | [
"Apache-2.0"
] | 28 | 2015-02-23T18:59:03.000Z | 2017-12-20T01:04:57.000Z | /* A Bison parser, made from ifq.y, by GNU bison 1.75. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
#ifndef BISON_IFQ_TAB_CC_H
# define BISON_IFQ_TAB_CC_H
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
NAME = 258,
PRED = 259,
STRING_TOKEN = 260,
INTNUM = 261,
LONGINTNUM = 262,
APPROXNUM = 263,
OR = 264,
AND = 265,
NOT = 266,
SEMICOLON = 267,
LEFTBRACE = 268,
RIGHTBRACE = 269,
BY = 270,
AS = 271,
AGGR = 272,
FROM = 273,
INNER_JOIN = 274,
OUTER_JOIN = 275,
LEFT_OUTER_JOIN = 276,
RIGHT_OUTER_JOIN = 277,
GROUP = 278,
HAVING = 279,
IN = 280,
SELECT = 281,
WHERE = 282,
SUCH = 283,
THAT = 284,
TRUE_V = 285,
FALSE_V = 286,
TIMEVAL_L = 287,
HEX_L = 288,
LHEX_L = 289,
IP_L = 290,
MERGE = 291,
SLACK = 292,
DEFINE_SEC = 293,
PARAM_SEC = 294,
PROTOCOL = 295,
TABLE = 296,
STREAM = 297,
FTA = 298,
OPERATOR = 299,
OPERATOR_VIEW = 300,
FIELDS = 301,
SUBQUERIES = 302,
SELECTION_PUSHDOWN = 303
};
#endif
#define NAME 258
#define PRED 259
#define STRING_TOKEN 260
#define INTNUM 261
#define LONGINTNUM 262
#define APPROXNUM 263
#define OR 264
#define AND 265
#define NOT 266
#define SEMICOLON 267
#define LEFTBRACE 268
#define RIGHTBRACE 269
#define BY 270
#define AS 271
#define AGGR 272
#define FROM 273
#define INNER_JOIN 274
#define OUTER_JOIN 275
#define LEFT_OUTER_JOIN 276
#define RIGHT_OUTER_JOIN 277
#define GROUP 278
#define HAVING 279
#define IN 280
#define SELECT 281
#define WHERE 282
#define SUCH 283
#define THAT 284
#define TRUE_V 285
#define FALSE_V 286
#define TIMEVAL_L 287
#define HEX_L 288
#define LHEX_L 289
#define IP_L 290
#define MERGE 291
#define SLACK 292
#define DEFINE_SEC 293
#define PARAM_SEC 294
#define PROTOCOL 295
#define TABLE 296
#define STREAM 297
#define FTA 298
#define OPERATOR 299
#define OPERATOR_VIEW 300
#define FIELDS 301
#define SUBQUERIES 302
#define SELECTION_PUSHDOWN 303
#ifndef YYSTYPE
#line 35 "ifq.y"
typedef union {
int intval;
double floatval;
char *strval;
int subtok;
/* for FTA definition. */
literal_t *litval;
scalarexp_t *scalarval;
se_list_t *se_listval;
select_list_t *select_listval;
table_exp_t *tblp;
predicate_t *predp;
literal_list_t *lit_l;
tablevar_t *table;
tablevar_list_t *tbl_list;
colref_t *colref;
colref_list_t *clist;
var_defs_t *var_defs;
var_pair_t *var_pair;
gb_t *gb_val;
gb_list_t *gb_list;
query_list_t *q_list;
} yystype;
/* Line 1281 of /usr/local/share/bison/yacc.c. */
#line 164 "ifq.tab.cc.h"
# define YYSTYPE yystype
#endif
extern YYSTYPE IfqParserlval;
#endif /* not BISON_IFQ_TAB_CC_H */
| 22.784884 | 82 | 0.693544 |
7b6fc28a4d8a14c344212434df72339fb13ed16d | 2,460 | h | C | TinyEngine/src/TinyEngine/Renderer/Buffer.h | LongerZrLong/TinyEngine | c5b0d57e9724c765967ce091c503f81673d74986 | [
"Apache-2.0"
] | null | null | null | TinyEngine/src/TinyEngine/Renderer/Buffer.h | LongerZrLong/TinyEngine | c5b0d57e9724c765967ce091c503f81673d74986 | [
"Apache-2.0"
] | null | null | null | TinyEngine/src/TinyEngine/Renderer/Buffer.h | LongerZrLong/TinyEngine | c5b0d57e9724c765967ce091c503f81673d74986 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <memory>
#include <vector>
#include <string>
#include "TinyEngine/Core/Base.h"
namespace TNG {
enum class ShaderDataType
{
None = 0, Float, Float2, Float3, Float4, Mat3, Mat4, Int, Int2, Int3, Int4, Bool
};
unsigned int ShaderDataTypeSize(ShaderDataType type);
unsigned int ShaderDataComponentCount(ShaderDataType type);
struct BufferElement
{
std::string Name;
ShaderDataType Type;
unsigned int Size;
unsigned int Offset;
bool Normalized;
BufferElement(const std::string &name, ShaderDataType type, bool normalized = false)
: Name(name), Type(type), Normalized(normalized), Size(ShaderDataTypeSize(type)), Offset(0)
{
}
};
class BufferLayout
{
public:
BufferLayout() = default;
BufferLayout(std::initializer_list<BufferElement> elements);
const std::vector<BufferElement> &GetElements() const { return m_Elements; }
unsigned int GetStride() const { return m_Stride; }
std::vector<BufferElement>::iterator begin() { return m_Elements.begin(); }
std::vector<BufferElement>::iterator end() { return m_Elements.end(); }
std::vector<BufferElement>::const_iterator begin() const { return m_Elements.begin(); }
std::vector<BufferElement>::const_iterator end() const { return m_Elements.end(); }
private:
// Calculate offset for each element and stride for the whole layout
void CalculateOffsetsAndStride();
private:
std::vector<BufferElement> m_Elements;
unsigned int m_Stride;
};
class VertexBuffer
{
public:
virtual ~VertexBuffer() = default;
static Ref<VertexBuffer> Create(unsigned int size);
static Ref<VertexBuffer> Create(float *vertices, unsigned int size);
virtual void SetData(const void *data, unsigned int size) = 0;
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
virtual void SetLayout(BufferLayout layout) = 0;
virtual const BufferLayout& GetLayout() const = 0 ;
};
class IndexBuffer
{
public:
virtual ~IndexBuffer() = default;
static Ref<IndexBuffer> Create(unsigned int *indices, unsigned int count);
virtual unsigned int GetCount() const = 0;
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
};
} | 27.032967 | 103 | 0.640244 |
c65d24a0af05451ec5ff44fe460abd6e2ff54c0b | 6,363 | h | C | Tutorials/My_Water/src/OceanWave.h | WindyPaper/DiligentSamples | 99f068bd20ea4eab97d12446d2a7378962bc4345 | [
"Apache-2.0"
] | null | null | null | Tutorials/My_Water/src/OceanWave.h | WindyPaper/DiligentSamples | 99f068bd20ea4eab97d12446d2a7378962bc4345 | [
"Apache-2.0"
] | null | null | null | Tutorials/My_Water/src/OceanWave.h | WindyPaper/DiligentSamples | 99f068bd20ea4eab97d12446d2a7378962bc4345 | [
"Apache-2.0"
] | null | null | null | #ifndef _OCEAN_WAVE_H_
#define _OCEAN_WAVE_H_
#include "BasicMath.hpp"
#include "DeviceContext.h"
#include "RefCntAutoPtr.hpp"
#include "RenderDevice.h"
namespace Diligent
{
namespace WaveTextureSpace
{
static const char *WAVEDATA = "WavesData";
static const char *HKSPECTRUM = "H0K";
static const char *GAUSSNOISE = "Noise";
static const char *DXDZ = "DxDz";
static const char *DYDXZ = "DyDxz";
static const char *DYXDYZ = "DyxDyz";
static const char *DXXDZZ = "DxxDzz";
static const char *BUFFERTMP0 = "BufferTmp0";
static const char *BUFFERTMP1 = "BufferTmp1";
static const char *DISPLACEMENT = "Displacement";
static const char *DERIVATIVES = "Derivatives";
static const char *TURBULENCE = "Turbulence";
};
struct HKSpectrumElementParam
{
float scale;
float angle;
float SpreadBlend;
float swell;
float alpha;
float PeakOmega;
float gamma;
float ShortWavesFade;
};
struct WaveDisplaySetting
{
float scale;
float WindSpeed;
float WindDirectionalAngle;
float fetch;
float SpreadBlend;
float swell;
float PeakEnhancement;
float ShortWavesFade;
float g;
float JonswapAlpha(float fetch, float windSpeed)
{
return 0.076f * std::powf(g * fetch / windSpeed / windSpeed, -0.22f);
}
float JonswapPeakFrequency(float fetch, float windSpeed)
{
return 22 * std::powf(windSpeed * fetch / g / g, -0.33f);
}
void ConvertToCSSpectrumElementParam(HKSpectrumElementParam *pOut)
{
pOut->scale = scale;
pOut->angle = WindDirectionalAngle / 180.0 * PI_F;
pOut->SpreadBlend = SpreadBlend;
pOut->swell = clamp(swell, 0.01f, 1.0f);
pOut->alpha = JonswapAlpha(fetch, WindSpeed);
pOut->PeakOmega = JonswapPeakFrequency(fetch, WindSpeed);
pOut->gamma = PeakEnhancement;
pOut->ShortWavesFade = ShortWavesFade;
}
};
struct HKSpectrumGlobalParam
{
float N;
float LengthScale;
float CutoffHigh;
float CutoffLow;
float GravityAcceleration;
float Depth;
float2 Padding;
HKSpectrumGlobalParam()
{
memset(this, 0, sizeof(*this));
}
HKSpectrumGlobalParam(const float n, const float LenScale, const float CutLow, const float CutHigh, const float depth = 500.0f, const float g = 9.81f)
{
N = n;
LengthScale = LenScale;
CutoffLow = CutLow;
CutoffHigh = CutHigh;
Depth = depth;
GravityAcceleration = g;
}
};
struct HKSpectrumBuffer
{
HKSpectrumElementParam SpectrumElementParam[2];
HKSpectrumGlobalParam SpectrumGlobalParam; //only for reverse memory on CPU side.
};
struct IFFTBuffer
{
float Time;
float N;
float Half_N;
float BitNum;
};
struct ResultMergeBuffer
{
float Lambda;
float DeltaTime;
float2 Padding;
};
struct OceanRenderParams
{
HKSpectrumBuffer HKSpectrumParam;
IFFTBuffer IFFTParam;
ResultMergeBuffer MergeParam;
};
struct OceanRenderTextures
{
ITexture *pDisp;
ITexture *pDeriva;
ITexture *pTurb;
};
struct ExportRenderParams
{
OceanRenderTextures OceanRenderTexs[3];
float LengthScales[3];
};
class WaveCascadeData
{
public:
WaveCascadeData(IRenderDevice *pDevice, \
IPipelineState* pHKSpectrumPSO, IPipelineState* pIFFTRowPSO, IPipelineState* pIFFTColumnPSO, IPipelineState* pResultMergePSO, \
ITexture* pGaussNoiseTex);
void Init(const int N, const HKSpectrumGlobalParam ¶m);
void InitTexture(const int N);
void InitBuffer();
void ComputeWave(IDeviceContext *pContext, const OceanRenderParams& params);
OceanRenderTextures GetRenderTexture();
protected:
void ComputeHKSpectrum(IDeviceContext *pContext, const OceanRenderParams& params);
void ComputeIFFT(IDeviceContext *pContext, const OceanRenderParams& params);
void ResultMerge(IDeviceContext *pContext, const OceanRenderParams& params);
void GenerateFullMipmap(IDeviceContext *pContext);
private:
HKSpectrumGlobalParam m_HKScaleCutSpectrumData;
IRenderDevice *m_pDevice;
IPipelineState *m_pHKSpectrumPSO;
IPipelineState *m_pIFFTRowPSO;
IPipelineState *m_pIFFTColumnPSO;
IPipelineState *m_pResultMergePSO;
ITexture *m_pGaussNoiseTex;
RefCntAutoPtr<ITexture> m_apHkSpectrum; //float2
RefCntAutoPtr<ITexture> m_apWaveDataSpectrum; //float4
RefCntAutoPtr<ITexture> m_apDxDz; //float2
RefCntAutoPtr<ITexture> m_apDyDxz; //float2
RefCntAutoPtr<ITexture> m_apDyxDyz; //float2
RefCntAutoPtr<ITexture> m_apDxxDzz; //float2
RefCntAutoPtr<ITexture> m_apBufferTmp0; //float4
RefCntAutoPtr<ITexture> m_apBufferTmp1; //float4
RefCntAutoPtr<ITexture> m_apDisplacement; //float4
//need to generate mipmap
RefCntAutoPtr<ITexture> m_apDerivatives; //float4
RefCntAutoPtr<ITexture> m_apTurbulence; //float4
//Buffer params
RefCntAutoPtr<IBuffer> m_apHKSpectrumParamsBuffer;
RefCntAutoPtr<IBuffer> m_apIFFTParamsBuffer;
RefCntAutoPtr<IBuffer> m_apResultMergeBuffer;
//SRB
RefCntAutoPtr<IShaderResourceBinding> m_apHKSpectrumSRB;
RefCntAutoPtr<IShaderResourceBinding> m_apIFFTRowSRB;
RefCntAutoPtr<IShaderResourceBinding> m_apIFFTColumnSRB;
RefCntAutoPtr<IShaderResourceBinding> m_apResultMergeSRB;
};
class OceanWave
{
public:
OceanWave(const int N, IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
~OceanWave();
void Init(const int N);
void ComputeOceanWave(IDeviceContext *pContext, const OceanRenderParams ¶ms);
ExportRenderParams ExportParamsToShader() const;
protected:
void CreatePSO(IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
void _CreateSpectrumPSO(IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
void _CreateIFFTRowPSO(IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
void _CreateIFFTColumnPSO(IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
void _CreateResultMergePSO(IRenderDevice *pDevice, IShaderSourceInputStreamFactory *pShaderFactory);
private:
int m_N;
float m_LengthScale0, m_LengthScale1, m_LengthScale2;
IRenderDevice *m_pDevice;
WaveCascadeData *m_pCascadeNear;
WaveCascadeData *m_pCascadeMid;
WaveCascadeData *m_pCascadeFar;
RefCntAutoPtr<IPipelineState> m_apHKSpectrumPSO;
RefCntAutoPtr<IPipelineState> m_apIFFTRowPSO;
RefCntAutoPtr<IPipelineState> m_apIFFTColumnPSO;
RefCntAutoPtr<IPipelineState> m_apResultMergePSO;
RefCntAutoPtr<ITexture> m_apGaussNoiseTex;
};
}
#endif
| 25.971429 | 152 | 0.765991 |
4cdf7a1679fce4951c97eaa2b29a8a6eaf71b994 | 2,417 | c | C | libft/ft_printf/src/fpf_apply_flags.c | moannuo/nm-otool | 84912e07fd36b436aa2493ca56aa7fcc3b380942 | [
"MIT"
] | null | null | null | libft/ft_printf/src/fpf_apply_flags.c | moannuo/nm-otool | 84912e07fd36b436aa2493ca56aa7fcc3b380942 | [
"MIT"
] | null | null | null | libft/ft_printf/src/fpf_apply_flags.c | moannuo/nm-otool | 84912e07fd36b436aa2493ca56aa7fcc3b380942 | [
"MIT"
] | 1 | 2018-12-14T20:45:13.000Z | 2018-12-14T20:45:13.000Z | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fpf_apply_flags.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ademenet <ademenet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/04/28 15:23:29 by ademenet #+# #+# */
/* Updated: 2016/05/24 10:45:33 by ademenet ### ########.fr */
/* */
/* ************************************************************************** */
#include "../include/fpf_printf.h"
/*
** Pas de free dans la precision WARNING
** Sub string if 's' or 'S'.
*/
void fpf_precision_string(t_flag *f)
{
if (f->fla[0] == -1)
f->arg = "\0";
else if (f->spe == 'S' || (f->spe == 's' && f->fla[10] == 1))
f->arg = fpf_wstrsub(f->warg, 0, f->fla[0]);
else if (f->spe == 's')
f->arg = fpf_strsub(f->arg, 0, f->fla[0]);
}
/*
** Ajout 0 pour o et O, 0x pour x et p, 0X pour X
*/
void fpf_sharp(t_flag *f)
{
if ((f->fla[2] == 1 && f->arg[0] != '0' && f->fla[0] != -1)
|| f->spe == 'p')
{
if (f->spe == 'o' || f->spe == 'O' || f->spe == 'x' || f->spe == 'X' ||
f->spe == 'p')
{
if ((f->spe == 'x' && f->arg[0] != '0') || f->spe == 'p')
{
fpf_buf('0', f);
fpf_buf('x', f);
}
else if (f->spe == 'X' && f->arg[0] != '0')
{
fpf_buf('0', f);
fpf_buf('X', f);
}
else if ((f->spe == 'o' || f->spe == 'O') &&
f->fla[0] <= fpf_strlen(f->arg))
fpf_buf('0', f);
else if ((f->spe == 'o' || f->spe == 'O') && f->fla[0] == -1)
fpf_buf('0', f);
}
}
}
/*
** Ajoute un espace si flag ' ' OU un signe +/- si flag '+'
** appelle la fonction fpf_sharp
*/
void fpf_space_plus_sharp(t_flag *f)
{
if (f->fla[5] == 1 || f->fla[6] == 1)
{
if (f->spe == 'd' || f->spe == 'D' || f->spe == 'i')
{
if (f->fla[6] == 1 && f->fla[5] == 0 && f->sign != '-')
fpf_buf(' ', f);
if (f->fla[5] == 1 && fpf_isdigit(f->arg[0]) && f->sign == '+')
fpf_buf('+', f);
}
}
if (f->sign == '-')
fpf_buf('-', f);
fpf_sharp(f);
}
| 29.47561 | 80 | 0.318163 |
14f57aed98189ba73d9468308e19e3e02687fd46 | 30,734 | c | C | linux-serial-test.c | purplefishies/linux-serial-test | 1d4e9a75a45d467a0eb555de86b956c09cd43dbf | [
"MIT"
] | null | null | null | linux-serial-test.c | purplefishies/linux-serial-test | 1d4e9a75a45d467a0eb555de86b956c09cd43dbf | [
"MIT"
] | null | null | null | linux-serial-test.c | purplefishies/linux-serial-test | 1d4e9a75a45d467a0eb555de86b956c09cd43dbf | [
"MIT"
] | null | null | null | // SPDX-License-Identifier: MIT
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <signal.h>
#include <poll.h>
#include <unistd.h>
#include <getopt.h>
#include <time.h>
#include <linux/serial.h>
#include <errno.h>
#include <sys/file.h>
static void dump_serial_port_stats(void);
/*
* glibc for MIPS has its own bits/termios.h which does not define
* CMSPAR, so we vampirise the value from the generic bits/termios.h
*/
#ifndef CMSPAR
#define CMSPAR 010000000000
#endif
/*
* Define modem line bits
*/
#ifndef TIOCM_LOOP
#define TIOCM_LOOP 0x8000
#endif
// command line args
typedef struct cmdopts_t
{
int baud ;
char* port ;
int divisor ;
int rx_dump ;
int rx_dump_ascii ;
int tx_detailed ;
int stats ;
int stop_on_error ;
int single_byte ;
int another_byte ;
int rts_cts ;
int two_stop_bit;
int parity ;
int odd_parity ;
int stick_parity ;
int loopback ;
int dump_err ;
int no_rx ;
int no_tx ;
int rx_delay ;
int tx_delay ;
int tx_bytes ;
int tx_time ;
int rx_time ;
int ascii_range ;
int write_after_read ;
int count;
int select;
fd_set sensor_fds;
int timeout;
} cmdopts_t ;
#define START_CLOCK(A)
#define SERIAL_PORT_PROCESS()
cmdopts_t clopts = (cmdopts_t){
.baud = 0,
.port = NULL,
.divisor = 0,
.rx_dump = 0,
.rx_dump_ascii = 0,
.tx_detailed = 0,
.stats = 1,
.stop_on_error = 0,
.single_byte = -1,
.another_byte = -1,
.rts_cts = 0,
.two_stop_bit = 0,
.parity = 0,
.odd_parity = 0,
.stick_parity = 0,
.loopback = 0,
.dump_err = 0,
.no_rx = 0,
.no_tx = 0,
.rx_delay = 0,
.tx_delay = 0,
.tx_bytes = 0,
.tx_time = 0,
.rx_time = 0,
.ascii_range = 0,
.write_after_read = 0,
.select = 0,
.timeout = 1000
};
typedef struct serial_stats_t
{
// Module variables
unsigned char _write_count_value ;
unsigned char _read_count_value ;
int _fd ;
unsigned char* _write_data;
ssize_t _write_size;
// keep our own counts for cases where the driver stats don't work
long long int _write_count ;
long long int _read_count ;
long long int _error_count ;
} serial_stats_t;
serial_stats_t stats = (serial_stats_t){
._write_count_value = 0,
._read_count_value = 0,
._fd = -1,
._write_data = 0,
._write_size = 0,
// keep our own counts for cases where the driver stats don't work
._write_count = 0,
._read_count = 0,
._error_count = 0,
};
typedef enum poll_type_t {
USE_POLL = 0,
USE_SELECT = 1
}poll_type_t ;
typedef union pollselect_t {
struct pollfd poll;
fd_set select;
} pollselect_t;
typedef struct fdselect_t {
pollselect_t ps;
poll_type_t type;
}fdselect_t ;
fdselect_t fdselect;
typedef struct time_stats_t
{
struct timespec start_time;
struct timespec last_stat;
struct timespec last_timeout;
struct timespec last_read;
struct timespec last_write;
struct timespec current;
} time_stats_t;
time_stats_t timing = (time_stats_t){0};
void exit_handler(void)
{
clopts.no_rx = clopts.no_tx = 1;
dump_serial_port_stats();
if (stats._fd >= 0)
{
flock(stats._fd, LOCK_UN);
close(stats._fd);
}
if (clopts.port)
{
free(clopts.port);
clopts.port = NULL;
}
if (stats._write_data)
{
free(stats._write_data);
stats._write_data = NULL;
}
}
static void dump_data(unsigned char * b, int count)
{
printf("%i bytes: ", count);
int i;
for (i=0; i < count; i++) {
printf("%02x ", b[i]);
}
printf("\n");
}
static void dump_data_ascii(unsigned char * b, int count)
{
int i;
for (i=0; i < count; i++) {
printf("%c", b[i]);
}
}
static void set_baud_divisor(int speed, int custom_divisor)
{
// default baud was not found, so try to set a custom divisor
struct serial_struct ss;
int ret;
if (ioctl(stats._fd, TIOCGSERIAL, &ss) < 0) {
ret = -errno;
perror("TIOCGSERIAL failed");
/* exit(ret); */
}
ss.flags = (ss.flags & ~ASYNC_SPD_MASK) | ASYNC_SPD_CUST;
if (custom_divisor) {
ss.custom_divisor = custom_divisor;
} else {
ss.custom_divisor = (ss.baud_base + (speed/2)) / speed;
int closest_speed = ss.baud_base / ss.custom_divisor;
if (closest_speed < speed * 98 / 100 || closest_speed > speed * 102 / 100) {
fprintf(stderr, "Cannot set speed to %d, closest is %d\n", speed, closest_speed);
exit(-EINVAL);
}
printf("closest baud = %i, base = %i, divisor = %i\n", closest_speed, ss.baud_base,
ss.custom_divisor);
}
if (ioctl(stats._fd, TIOCSSERIAL, &ss) < 0) {
ret = -errno;
perror("TIOCSSERIAL failed");
exit(ret);
}
}
static void clear_custom_speed_flag()
{
struct serial_struct ss;
int ret;
if (ioctl(stats._fd, TIOCGSERIAL, &ss) < 0) {
// return silently as some devices do not support TIOCGSERIAL
return;
}
if ((ss.flags & ASYNC_SPD_MASK) != ASYNC_SPD_CUST)
return;
ss.flags &= ~ASYNC_SPD_MASK;
if (ioctl(stats._fd, TIOCSSERIAL, &ss) < 0) {
ret = -errno;
perror("TIOCSSERIAL failed");
exit(ret);
}
}
// converts integer baud to Linux define
static int get_baud(int baud)
{
switch (baud) {
case 9600:
return B9600;
case 19200:
return B19200;
case 38400:
return B38400;
case 57600:
return B57600;
case 115200:
return B115200;
case 230400:
return B230400;
case 460800:
return B460800;
case 500000:
return B500000;
case 576000:
return B576000;
case 921600:
return B921600;
#ifdef B1000000
case 1000000:
return B1000000;
#endif
#ifdef B1152000
case 1152000:
return B1152000;
#endif
#ifdef B1500000
case 1500000:
return B1500000;
#endif
#ifdef B2000000
case 2000000:
return B2000000;
#endif
#ifdef B2500000
case 2500000:
return B2500000;
#endif
#ifdef B3000000
case 3000000:
return B3000000;
#endif
#ifdef B3500000
case 3500000:
return B3500000;
#endif
#ifdef B4000000
case 4000000:
return B4000000;
#endif
default:
return -1;
}
}
void set_modem_lines(int fd, int bits, int mask)
{
int status, ret;
/* if (ioctl(fd, TIOCMGET, &status) < 0) { */
/* ret = -errno; */
/* perror("TIOCMGET failed"); */
/* /\* exit(ret); *\/ */
/* } */
/* status = (status & ~mask) | (bits & mask); */
/* if (ioctl(fd, TIOCMSET, &status) < 0) { */
/* ret = -errno; */
/* perror("TIOCMSET failed"); */
/* /\* exit(ret); *\/ */
/* } */
}
static void display_help(void)
{
printf("Usage: linux-serial-test [OPTION]\n"
"\n"
" -h, --help\n"
" -b, --baud Baud rate, 115200, etc (115200 is default)\n"
" -p, --port Port (/dev/ttyS0, etc) (must be specified)\n"
" -d, --divisor UART Baud rate divisor (can be used to set custom baud rates)\n"
" -R, --rx_dump Dump Rx data (ascii, raw)\n"
/* " -T, --detailed_tx Detailed Tx data\n" */
/* " -s, --stats Dump serial port stats every 5s\n" */
/* " -S, --stop-on-err Stop program if we encounter an error\n" */
/* " -y, --single-byte Send specified byte to the serial port\n" */
/* " -z, --second-byte Send another specified byte to the serial port\n" */
/* " -c, --rts-cts Enable RTS/CTS flow control\n" */
/* " -B, --2-stop-bit Use two stop bits per character\n" */
/* " -P, --parity Use parity bit (odd, even, mark, space)\n" */
" -C, --count Stop after this many bytes has been written\n"
" -k, --loopback Use internal hardware loop back\n"
" -K, --write-follow Write follows the read count (can be used for multi-serial loopback)\n"
" -e, --dump-err Display errors\n"
" -r, --no-rx Don't receive data (can be used to test flow control)\n"
" when serial driver buffer is full\n"
" -t, --no-tx Don't transmit data\n"
" -l, --rx-delay Delay between reading data (ms) (can be used to test flow control)\n"
" -a, --tx-delay Delay between writing data (ms)\n"
" -w, --tx-bytes Number of bytes for each write (default is to repeatedly write 1024 bytes\n"
" until no more are accepted)\n"
" -o, --tx-time Number of seconds to transmit for (defaults to 0, meaning no limit)\n"
" -i, --rx-time Number of seconds to receive for (defaults to 0, meaning no limit)\n"
" -A, --ascii Output bytes range from 32 to 126 (default is 0 to 255)\n"
"\n"
);
}
static void process_command_line(int argc, char * argv[])
{
for (;;)
{
int option_index = 0;
static const char* short_options = "hb:p:d:R:TsSy:z:cBertq:Ql:a:w:o:i:P:kKA";
// clang-format off
static const struct option long_options[] = {
{ "help" , no_argument , 0 , 0 } ,
{ "baud" , required_argument , 0 , 'b' } ,
{ "port" , required_argument , 0 , 'p' } ,
{ "divisor" , required_argument , 0 , 'd' } ,
{ "rx_dump" , required_argument , 0 , 'R' } ,
{ "select" , no_argument , 0 , 'S' } ,
{ "timeout" , required_argument , 0 , 'T' } ,
/* { "detailed_tx" , no_argument , 0 , 'T' } , */
/* { "stats" , no_argument , 0 , 's' } , */
/* { "stop-on-err" , no_argument , 0 , 'S' } , */
/* { "single-byte" , no_argument , 0 , 'y' } , */
/* { "second-byte" , no_argument , 0 , 'z' } , */
/* { "rts-cts" , no_argument , 0 , 'c' } , */
/* { "2-stop-bit" , no_argument , 0 , 'B' } , */
{ "count" , required_argument , 0 , 'C' } ,
{ "parity" , required_argument , 0 , 'P' } ,
{ "loopback" , no_argument , 0 , 'k' } ,
{ "write-follows" , no_argument , 0 , 'K' } ,
{ "dump-err" , no_argument , 0 , 'e' } ,
{ "no-rx" , no_argument , 0 , 'r' } ,
{ "no-tx" , no_argument , 0 , 't' } ,
{ "rx-delay" , required_argument , 0 , 'l' } ,
{ "tx-delay" , required_argument , 0 , 'a' } ,
{ "tx-bytes" , required_argument , 0 , 'w' } ,
{ "tx-time" , required_argument , 0 , 'o' } ,
{ "rx-time" , required_argument , 0 , 'i' } ,
{ "ascii" , no_argument , 0 , 'A' } ,
{ 0 , 0 , 0 , 0 } ,
};
// clang-format on
int c = getopt_long(argc, argv, short_options, long_options, &option_index);
if (c == EOF)
{
break;
}
switch (c)
{
case 0:
case 'h':
display_help();
exit(0);
break;
case 'b':
clopts.baud = atoi(optarg);
break;
case 'p':
clopts.port = strdup(optarg);
break;
case 'd':
clopts.divisor = strtol(optarg, NULL, 0);
break;
case 'R':
clopts.rx_dump = 1;
clopts.rx_dump_ascii = !strcmp(optarg, "ascii");
break;
case 'S':
clopts.select = 1;
break;
/* " -T, --detailed_tx Detailed Tx data\n" */
/* " -s, --stats Dump serial port stats every 5s\n" */
/* " -S, --stop-on-err Stop program if we encounter an error\n" */
/* " -y, --single-byte Send specified byte to the serial port\n" */
/* " -z, --second-byte Send another specified byte to the serial port\n" */
/* " -c, --rts-cts Enable RTS/CTS flow control\n" */
/* " -B, --2-stop-bit Use two stop bits per character\n" */
/* " -P, --parity Use parity bit (odd, even, mark, space)\n" */
case 'T':
clopts.timeout = atoi(optarg);
break;
/* case 's': */
/* clopts.stats = 1; */
/* break; */
/* case 'S': */
/* clopts.stop_on_error = 1; */
/* break; */
/* case 'y': */
/* { */
/* char* endptr; */
/* clopts.single_byte = strtol(optarg, &endptr, 0); */
/* break; */
/* } */
/* case 'z': */
/* { */
/* char* endptr; */
/* clopts.another_byte = strtol(optarg, &endptr, 0); */
/* break; */
/* } */
/* case 'c': */
/* clopts.rts_cts = 1; */
/* break; */
/* case 'B': */
/* clopts .two_stop_bit = 1; */
/* break; */
case 'C':
clopts.count = atoi(optarg);
break;
case 'P':
clopts.parity = 1;
clopts.odd_parity = (!strcmp(optarg, "mark") || !strcmp(optarg, "odd"));
clopts.stick_parity = (!strcmp(optarg, "mark") || !strcmp(optarg, "space"));
break;
case 'k':
clopts.loopback = 1;
break;
case 'K':
clopts.write_after_read = 1;
break;
case 'e':
clopts.dump_err = 1;
break;
case 'r':
clopts.no_rx = 1;
break;
case 't':
clopts.no_tx = 1;
break;
case 'l':
{
char* endptr;
clopts.rx_delay = strtol(optarg, &endptr, 0);
break;
}
case 'a':
{
char* endptr;
clopts.tx_delay = strtol(optarg, &endptr, 0);
break;
}
case 'w':
{
char* endptr;
clopts.tx_bytes = strtol(optarg, &endptr, 0);
break;
}
case 'o':
{
char* endptr;
clopts.tx_time = strtol(optarg, &endptr, 0);
break;
}
case 'i':
{
char* endptr;
clopts.rx_time = strtol(optarg, &endptr, 0);
break;
}
case 'A':
clopts.ascii_range = 1;
break;
}
}
if (clopts.baud && !clopts.divisor)
clopts.baud = get_baud(clopts.baud);
else
clopts.baud = B115200;
if (!clopts.port) {
fprintf(stderr, "ERROR: Port argument required\n");
display_help();
exit(-EINVAL);
}
if (clopts.baud <= 0 || clopts.divisor) {
printf("NOTE: non standard baud rate, trying custom divisor\n");
clopts.baud = B115200;
/* set_baud_divisor(clopts.baud, clopts.divisor); */
}
}
static void dump_serial_port_stats(void)
{
struct serial_icounter_struct icount = { 0 };
printf("%s: count for this session: rx=%lld, tx=%lld, rx err=%lld\n", clopts.port, stats._read_count,
stats._write_count, stats._error_count);
}
static unsigned char next_count_value(unsigned char c)
{
c++;
if (clopts.ascii_range && c == 127)
c = 32;
return c;
}
static void process_read_data(void)
{
unsigned char rb[1024];
int c = read(stats._fd, &rb, sizeof(rb));
if (c > 0) {
if (clopts.rx_dump) {
if (clopts.rx_dump_ascii)
dump_data_ascii(rb, c);
else
dump_data(rb, c);
}
// verify read count is incrementing
int i;
for (i = 0; i < c; i++) {
if (rb[i] != stats._read_count_value) {
if (clopts.dump_err) {
printf("Error, count: %lld, expected %02x, got %02x\n",
stats._read_count + i, stats._read_count_value, rb[i]);
}
stats._error_count++;
if (clopts.stop_on_error) {
dump_serial_port_stats();
exit(-EIO);
}
stats._read_count_value = rb[i];
}
stats._read_count_value = next_count_value(stats._read_count_value);
}
stats._read_count += c;
}
}
void process_write_data(void)
{
ssize_t count = 0;
ssize_t actual_write_size = 0;
int repeat = (clopts.tx_bytes == 0);
do
{
if (clopts.write_after_read == 0) {
actual_write_size = stats._write_size;
} else {
actual_write_size = stats._read_count > stats._write_count ? stats._read_count - stats._write_count : 0;
if (actual_write_size > stats._write_size) {
actual_write_size = stats._write_size;
}
}
if (actual_write_size == 0) {
break;
}
ssize_t i;
for (i = 0; i < actual_write_size; i++) {
stats._write_data[i] = stats._write_count_value;
stats._write_count_value = next_count_value(stats._write_count_value);
}
if ( clopts.no_tx )
break;
ssize_t c = write(stats._fd, stats._write_data, actual_write_size);
if (c < 0) {
if (errno != EAGAIN) {
printf("write failed - errno=%d (%s)\n", errno, strerror(errno));
}
c = 0;
}
count += c;
if (c < actual_write_size) {
stats._write_count_value = stats._write_data[c];
repeat = 0;
} else if ( c == actual_write_size ) {
repeat = 0;
}
} while (repeat);
stats._write_count += count;
if ( clopts.count > 0 && stats._write_count > clopts.count )
clopts.no_tx = 1;
if (clopts.tx_detailed)
printf("wrote %zd bytes\n", count);
}
static void setup_serial_port()
{
struct termios newtio;
struct serial_rs485 rs485;
int ret;
stats._fd = open(clopts.port, O_RDWR | O_NONBLOCK);
if (stats._fd < 0) {
ret = -errno;
perror("Error opening serial port");
exit(ret);
}
/* Lock device file */
if (flock(stats._fd, LOCK_EX | LOCK_NB) < 0) {
ret = -errno;
perror("Error failed to lock device file");
exit(ret);
}
memset(&newtio, 0, sizeof(newtio)); /* clear struct for new port settings */
/* man termios get more info on below settings */
newtio.c_cflag = clopts.baud | CS8 | CLOCAL | CREAD;
if (clopts.rts_cts) {
newtio.c_cflag |= CRTSCTS;
}
if (clopts.two_stop_bit) {
newtio.c_cflag |= CSTOPB;
}
if (clopts.parity) {
newtio.c_cflag |= PARENB;
if (clopts.odd_parity) {
newtio.c_cflag |= PARODD;
}
if (clopts.stick_parity) {
newtio.c_cflag |= CMSPAR;
}
}
newtio.c_iflag = 0;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
// block for up till 128 characters
newtio.c_cc[VMIN] = 128;
// 0.5 seconds read timeout
newtio.c_cc[VTIME] = 5;
/* now clean the modem line and activate the settings for the port */
tcflush(stats._fd, TCIOFLUSH);
tcsetattr(stats._fd,TCSANOW,&newtio);
/* enable/disable rs485 direction control, first check if RS485 is supported */
/* if(ioctl(stats._fd, TIOCGRS485, &rs485) < 0) { */
/* if (clopts.rs485_after_delay >= 0) { */
/* /\* error could be because hardware is missing rs485 support so only print when actually trying to activate it *\/ */
/* perror("Error getting RS-485 mode"); */
/* } */
/* } else { */
/* if (clopts.rs485_after_delay >= 0) { */
/* /\* enable RS485 *\/ */
/* rs485.flags |= SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | */
/* (clopts.rs485_rts_after_send ? SER_RS485_RTS_AFTER_SEND : SER_RS485_RTS_ON_SEND); */
/* rs485.flags &= ~(clopts.rs485_rts_after_send ? SER_RS485_RTS_ON_SEND : SER_RS485_RTS_AFTER_SEND); */
/* rs485.delay_rts_after_send = clopts.rs485_after_delay; */
/* rs485.delay_rts_before_send = clopts.rs485_before_delay; */
/* if(ioctl(stats._fd, TIOCSRS485, &rs485) < 0) { */
/* perror("Error setting RS-485 mode"); */
/* } */
/* } else { */
/* /\* disable RS485 *\/ */
/* rs485.flags &= ~(SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND); */
/* rs485.delay_rts_after_send = 0; */
/* rs485.delay_rts_before_send = 0; */
/* if(ioctl(stats._fd, TIOCSRS485, &rs485) < 0) { */
/* perror("Error setting RS-232 mode"); */
/* } */
/* } */
/* } */
}
static int diff_ms(const struct timespec *t1, const struct timespec *t2)
{
struct timespec diff;
diff.tv_sec = t1->tv_sec - t2->tv_sec;
diff.tv_nsec = t1->tv_nsec - t2->tv_nsec;
if (diff.tv_nsec < 0) {
diff.tv_sec--;
diff.tv_nsec += 1000000000;
}
return (diff.tv_sec * 1000 + diff.tv_nsec/1000000);
}
static int compute_error_count(void)
{
long long int result;
if (clopts.no_rx == 1 || clopts.no_tx == 1)
result = stats._error_count;
else
result = llabs(stats._write_count - stats._read_count) + stats._error_count;
return (result > 125) ? 125 : (int)result;
}
void initialize_stats()
{
set_modem_lines(stats._fd, clopts.loopback ? TIOCM_LOOP : 0, TIOCM_LOOP);
stats._write_size = (clopts.tx_bytes == 0) ? 1024 : clopts.tx_bytes;
stats._write_data = malloc(stats._write_size);
if (stats._write_data == NULL)
{
fprintf(stderr, "ERROR: Memory allocation failed\n");
exit(-ENOMEM);
}
if (clopts.ascii_range)
{
stats._read_count_value = stats._write_count_value = 32;
}
stats._write_size = (clopts.tx_bytes == 0) ? 1024 : clopts.tx_bytes;
stats._write_data = malloc(stats._write_size);
if (stats._write_data == NULL) {
fprintf(stderr, "ERROR: Memory allocation failed\n");
exit(-ENOMEM);
}
if (clopts.ascii_range) {
stats._read_count_value = stats._write_count_value = 32;
}
}
/* void process_results(int retval, struct pollfd *serial_poll) */
void process_results(int retval, fdselect_t *fds)
{
if (retval == -1)
{
if ( fds->type == USE_POLL ) {
perror("poll()");
} else {
perror("select()");
}
}
else if (retval)
{
if( fds->type == USE_POLL )
{
if (fds->ps.poll.revents & POLLIN)
{
if (clopts.rx_delay)
{
// only read if it has been rx-delay ms
// since the last read
if (diff_ms(&timing.current, &timing.last_read) > clopts.rx_delay)
{
process_read_data();
timing.last_read = timing.current;
}
}
else
{
process_read_data();
timing.last_read = timing.current;
}
}
if (fds->ps.poll.revents & POLLOUT)
{
if (clopts.tx_delay)
{
// only write if it has been tx-delay ms
// since the last write
if (diff_ms(&timing.current, &timing.last_write) > clopts.tx_delay)
{
process_write_data();
timing.last_write = timing.current;
}
}
else
{
process_write_data();
timing.last_write = timing.current;
}
}
}
else {
if (clopts.rx_delay)
{
// only read if it has been rx-delay ms
// since the last read
if (diff_ms(&timing.current, &timing.last_read) > clopts.rx_delay)
{
process_read_data();
timing.last_read = timing.current;
}
}
else
{
process_read_data();
timing.last_read = timing.current;
}
}
}
}
void calculate_timing(struct time_stats_t *timing)
{
if (diff_ms(&timing->current, &timing->last_timeout) > 1000)
{
int rx_timeout, tx_timeout;
// Has it been over two seconds since we transmitted or received data?
rx_timeout = (!clopts.no_rx && diff_ms(&timing->current, &timing->last_read) > 2000);
tx_timeout = (!clopts.no_tx && diff_ms(&timing->current, &timing->last_write) > 2000);
// Special case - we don't want to warn about receive
// timeouts at the end of a loopback test (where we are
// no longer transmitting and the receive count equals
// the transmit count).
if (clopts.no_tx && stats._write_count != 0 && stats._write_count == stats._read_count)
{
rx_timeout = 0;
}
if (rx_timeout || tx_timeout)
{
const char* s;
if (rx_timeout)
{
printf("%s: No data received for %.1fs.", clopts.port,
(double)diff_ms(&timing->current, &timing->last_read) / 1000);
s = " ";
}
else
{
s = "";
}
if (tx_timeout)
{
printf("%sNo data transmitted for %.1fs.", s, (double)diff_ms(&timing->current, &timing->last_write) / 1000);
}
printf("\n");
timing->last_timeout = timing->current;
}
}
if (clopts.stats)
{
if (timing->current.tv_sec - timing->last_stat.tv_sec > 5)
{
dump_serial_port_stats();
timing->last_stat = timing->current;
}
}
}
void start_timing(struct time_stats_t *timing)
{
clock_gettime(CLOCK_MONOTONIC, &timing->start_time);
timing->last_stat = timing->start_time;
timing->last_timeout = timing->start_time;
timing->last_read = timing->start_time;
timing->last_write = timing->start_time;
}
void show_stats(fdselect_t *fds)
{
if (fds->type == USE_POLL ) {
if (clopts.tx_time)
{
if (timing.current.tv_sec - timing.start_time.tv_sec >= clopts.tx_time)
{
clopts.tx_time = 0;
clopts.no_tx = 1;
fds->ps.poll.events &= ~POLLOUT;
printf("Stopped transmitting.\n");
}
}
if (clopts.rx_time)
{
if (timing.current.tv_sec - timing.start_time.tv_sec >= clopts.rx_time)
{
clopts.rx_time = 0;
clopts.no_rx = 1;
fds->ps.poll.events &= ~POLLIN;
printf("Stopped receiving.\n");
}
}
} else {
}
}
/* void * */
/* sensor_event_loop(__attribute__((unused)) void *arg) */
/* { */
/* fd_set sensor_fds; */
/* FD_ZERO(&sensor_fds); */
/* /\* for (index = 0; index < sensor_ctl.count; index++) *\/ */
/* /\* { *\/ */
/* /\* if (sensor_ctl.sensor[index].sensor_fd > 0) *\/ */
/* /\* FD_SET(sensor_ctl.sensor[index].sensor_fd, &sensor_fds); *\/ */
/* /\* } *\/ */
/* int fd; */
/* FD_SET( fd, &sensor_fds ); */
/* /\* Waiting. *\/ */
/* /\* ready = select(sensor_ctl.max_fd + 1, &sensor_fds, NULL, NULL, NULL); *\/ */
/* /\* if ((ready == -1) && (errno == EINTR)) *\/ */
/* /\* { *\/ */
/* /\* /\\* Someone rudely interrupted us. Please continue. *\\/ *\/ */
/* /\* continue; *\/ */
/* /\* } *\/ */
/* /\* /\\* Update packet count for SubView logging. *\\/ *\/ */
/* /\* packet_count++; *\/ */
/* /\* for (index = 0; index < sensor_ctl.count; index++) *\/ */
/* /\* { *\/ */
/* /\* if (FD_ISSET(sensor_ctl.sensor[index].sensor_fd, &sensor_fds)) *\/ */
/* /\* { *\/ */
/* /\* (*sensor_ctl.sensor[index].handle_data)( *\/ */
/* /\* sensor_ctl.sensor[index].priv_state, *\/ */
/* /\* packet_count); *\/ */
/* /\* } *\/ */
/* /\* } *\/ */
/* } */
void handler(int sig)
{
clopts.no_rx = 1;
clopts.no_tx = 1;
return ;
}
void setup_fdselect( fdselect_t *fs )
{
fs->type = ( clopts.select ? USE_SELECT : USE_POLL );
if ( fs->type == USE_POLL ) {
fs->ps.poll.fd = stats._fd;
if (!clopts.no_rx) {
fs->ps.poll.events |= POLLIN;
} else {
fs->ps.poll.events &= ~POLLIN;
}
if (!clopts.no_tx) {
fs->ps.poll.events |= POLLOUT;
} else {
fs->ps.poll.events &= ~POLLOUT;
}
} else {
FD_ZERO(&fs->ps.select );
FD_SET( stats._fd, &fs->ps.select );
}
}
int wait_for_events( fdselect_t *fs , int timeout )
{
int retval;
if ( fs->type == USE_POLL ) {
retval = poll(&fs->ps.poll, 1, timeout);
} else {
struct timeval to = (struct timeval){.tv_sec = (timeout/1000 <= 0 ? 1 : timeout/1000) , .tv_usec=0};
FD_ZERO(&fs->ps.select);
FD_SET(stats._fd,&fs->ps.select);
retval = select(FD_SETSIZE,&fs->ps.select, NULL, NULL, &to );
}
return retval;
}
int main(int argc, char * argv[])
{
printf("Linux serial test app\n");
atexit(&exit_handler);
signal(SIGINT, &handler);
process_command_line(argc, argv);
setup_serial_port(clopts.baud);
if (clopts.divisor)
clear_custom_speed_flag();
initialize_stats();
set_modem_lines(stats._fd, clopts.loopback ? TIOCM_LOOP : 0, TIOCM_LOOP);
setup_fdselect( &fdselect ) ;
start_timing( &timing );
while (!(clopts.no_rx && clopts.no_tx)) {
int retval;
if ( clopts.no_tx ) { /* Receiver */
retval = wait_for_events( &fdselect, clopts.timeout );
clock_gettime(CLOCK_MONOTONIC, &timing.current);
process_results( retval, &fdselect );
} else if( clopts.no_rx ) { /* Transmitter */
retval = wait_for_events( &fdselect , clopts.timeout );
process_results( retval, &fdselect );
}
// Has it been at least a second since we reported a timeout?
calculate_timing(&timing);
show_stats(&fdselect);
}
tcdrain(stats._fd);
dump_serial_port_stats();
set_modem_lines(stats._fd, 0, TIOCM_LOOP);
tcflush(stats._fd, TCIOFLUSH);
return compute_error_count();
}
| 28.19633 | 125 | 0.524858 |
2132f9f484f7afcf1e3b6b65194499e377c48d80 | 504 | h | C | 0235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree/cpp_0235/Solution2.h | ooooo-youwillsee/leetcode | 07b273f133c8cf755ea40b3ae9df242ce044823c | [
"MIT"
] | 12 | 2020-03-18T14:36:23.000Z | 2021-12-19T02:24:33.000Z | 0235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree/cpp_0235/Solution2.h | ooooo-youwillsee/leetcode | 07b273f133c8cf755ea40b3ae9df242ce044823c | [
"MIT"
] | null | null | null | 0235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree/cpp_0235/Solution2.h | ooooo-youwillsee/leetcode | 07b273f133c8cf755ea40b3ae9df242ce044823c | [
"MIT"
] | null | null | null | /**
* @author ooooo
* @date 2020/9/27 11:04
*/
#ifndef CPP_0235__SOLUTION2_H_
#define CPP_0235__SOLUTION2_H_
#include "TreeNode.h"
class Solution {
public:
TreeNode *lowestCommonAncestor(TreeNode *root, TreeNode *p, TreeNode *q) {
if (root->val > p->val && root->val > q->val) {
return lowestCommonAncestor(root->left, p, q);
}
if (root->val < p->val && root->val < q->val) {
return lowestCommonAncestor(root->right, p, q);
}
return root;
}
};
#endif //CPP_0235__SOLUTION2_H_
| 19.384615 | 75 | 0.660714 |
abb99d5e0b81defdbe788dd07ef90cf260035f23 | 2,433 | h | C | conex/kkt_assembler.h | ToyotaResearchInstitute/conex | 181a4a9b77d7331464fffc7afc45fe8be29168d2 | [
"MIT"
] | 12 | 2021-02-08T08:02:17.000Z | 2022-01-25T21:53:22.000Z | conex/kkt_assembler.h | ToyotaResearchInstitute/conex | 181a4a9b77d7331464fffc7afc45fe8be29168d2 | [
"MIT"
] | null | null | null | conex/kkt_assembler.h | ToyotaResearchInstitute/conex | 181a4a9b77d7331464fffc7afc45fe8be29168d2 | [
"MIT"
] | 3 | 2020-12-21T16:02:22.000Z | 2021-05-20T11:25:46.000Z | #pragma once
#include <vector>
#include "conex/linear_workspace.h"
#include "conex/supernodal_cholesky_data.h"
#include "conex/constraint.h"
#include "conex/newton_step.h"
#include <Eigen/Dense>
namespace conex {
// For a given clique, manages the transfer of
// densely stored data to supernodal data structure.
class LinearKKTAssemblerBase {
public:
void BindDiagonalBlock(const DiagonalBlock* data);
void BindOffDiagonalBlock(const OffDiagonalBlock* data);
void Reset() {
diag.clear();
off_diag.clear();
scatter_block.clear();
direct_update = false;
}
void UpdateBlocks();
virtual void SetDenseData() = 0;
int NumberOfVariables() { return num_variables_; };
void UpdateNumberOfVariables();
WorkspaceSchurComplement schur_complement_data;
Eigen::VectorXd memory;
protected:
double GetCoeff(int i, int j);
void Increment(const std::vector<int>& r, const std::vector<int>& c,
Eigen::Map<Eigen::MatrixXd>* data);
void Increment(const int* r, int sizer, const int* c, int sizec,
Eigen::Map<Eigen::MatrixXd>* data);
void Set(const int* r, int sizer, const int* c, int sizec,
Eigen::Map<Eigen::MatrixXd>* data);
void Set(const std::vector<int>& r, const std::vector<int>& c,
Eigen::Map<Eigen::MatrixXd>* data);
void SetDiagonalBlock(const std::vector<int>& r,
Eigen::Map<Eigen::MatrixXd>* data);
void Scatter(const int* r, int sizer, const int* c, int sizec, double** data);
int num_variables_;
bool direct_update = false;
std::vector<DiagonalBlock> diag;
std::vector<OffDiagonalBlock> off_diag;
std::vector<OffDiagonalBlock> scatter_block;
virtual ~LinearKKTAssemblerBase(){};
};
class LinearKKTAssembler : public LinearKKTAssemblerBase {
public:
LinearKKTAssembler(int num_variables, Constraint* W) {
workspace_ = W;
num_variables_ = num_variables;
assert(W);
}
virtual void SetDenseData() {
if (workspace_) {
ConstructSchurComplementSystem(workspace_, true, &schur_complement_data);
}
}
LinearKKTAssembler(){};
Constraint* workspace_ = NULL;
};
class LinearKKTAssemblerStatic : public LinearKKTAssemblerBase {
public:
LinearKKTAssemblerStatic(){};
LinearKKTAssemblerStatic(const Eigen::MatrixXd& A) : A_(A) {}
virtual void SetDenseData() override { schur_complement_data.G = A_; }
Eigen::MatrixXd A_;
};
} // namespace conex
| 28.290698 | 80 | 0.701603 |
862675c95aab02997d8cb8345ebec2783ee0333a | 1,007 | h | C | clients/ios-osdk/PPCloak/GenericFrameworkProject/Views/UIRandomWalkMapView/UIRandomWalkMapView.h | fdibernardo/PlusPrivacy | 13086e7afd7340b8ccbab3f38e7511e55477279f | [
"MIT"
] | 27 | 2017-07-25T15:03:02.000Z | 2019-07-16T12:55:20.000Z | clients/ios-osdk/PPCloak/GenericFrameworkProject/Views/UIRandomWalkMapView/UIRandomWalkMapView.h | fdibernardo/PlusPrivacy | 13086e7afd7340b8ccbab3f38e7511e55477279f | [
"MIT"
] | 11 | 2017-08-16T08:41:16.000Z | 2019-10-27T13:39:29.000Z | clients/ios-osdk/PPCloak/GenericFrameworkProject/Views/UIRandomWalkMapView/UIRandomWalkMapView.h | fdibernardo/PlusPrivacy | 13086e7afd7340b8ccbab3f38e7511e55477279f | [
"MIT"
] | 6 | 2017-06-16T08:14:40.000Z | 2021-09-10T13:32:59.000Z | //
// UIRandomWalkMapView.h
// PPCloak
//
// Created by Costin Andronache on 4/7/17.
// Copyright © 2017 RomSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "CloakNibView.h"
#import "RandomWalkGenerator.h"
@interface UIRandomWalkMapViewModel: NSObject
@property (strong, nonatomic) RandomWalkBoundCircle *initialCircle;
@property (strong, nonatomic) NSArray<CLLocation*> *initialLocations;
@property (assign, nonatomic) BOOL editable;
@end
@interface UIRandomWalkMapViewCallbacks : NSObject
@property (strong, nonatomic) void(^onBoundCircleChange)(RandomWalkBoundCircle *newCircle);
@end
@interface UIRandomWalkMapView : CloakNibView
@property (readonly, nonatomic) RandomWalkBoundCircle *currentCircle;
-(void)drawNewLocations:(NSArray<CLLocation*>*)locations;
-(void)setupWithModel:(UIRandomWalkMapViewModel*)model callbacks:(UIRandomWalkMapViewCallbacks*)callbacks;
-(void)displayAsBusy:(BOOL)busy;
-(void)displayPinForLocationAt:(NSInteger)index;
@end
| 28.771429 | 106 | 0.793446 |
3954576999377ce4893ac07d6f3fc5e568ad1c75 | 7,949 | h | C | B2G/gecko/js/src/vm/Xdr.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/js/src/vm/Xdr.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/js/src/vm/Xdr.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=78:
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef Xdr_h___
#define Xdr_h___
#include "jsapi.h"
#include "jsprvtd.h"
#include "jsnum.h"
#include "vm/NumericConversions.h"
namespace js {
/*
* Bytecode version number. Increment the subtrahend whenever JS bytecode
* changes incompatibly.
*
* This version number is XDR'd near the front of xdr bytecode and
* aborts deserialization if there is a mismatch between the current
* and saved versions. If deserialization fails, the data should be
* invalidated if possible.
*/
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 132);
class XDRBuffer {
public:
XDRBuffer(JSContext *cx)
: context(cx), base(NULL), cursor(NULL), limit(NULL) { }
JSContext *cx() const {
return context;
}
void *getData(uint32_t *lengthp) const {
JS_ASSERT(size_t(cursor - base) <= size_t(UINT32_MAX));
*lengthp = uint32_t(cursor - base);
return base;
}
void setData(const void *data, uint32_t length) {
base = static_cast<uint8_t *>(const_cast<void *>(data));
cursor = base;
limit = base + length;
}
const uint8_t *read(size_t n) {
JS_ASSERT(n <= size_t(limit - cursor));
uint8_t *ptr = cursor;
cursor += n;
return ptr;
}
const char *readCString() {
char *ptr = reinterpret_cast<char *>(cursor);
cursor = reinterpret_cast<uint8_t *>(strchr(ptr, '\0')) + 1;
JS_ASSERT(base < cursor);
JS_ASSERT(cursor <= limit);
return ptr;
}
uint8_t *write(size_t n) {
if (n > size_t(limit - cursor)) {
if (!grow(n))
return NULL;
}
uint8_t *ptr = cursor;
cursor += n;
return ptr;
}
static bool isUint32Overflow(size_t n) {
return size_t(-1) > size_t(UINT32_MAX) && n > size_t(UINT32_MAX);
}
void freeBuffer();
private:
bool grow(size_t n);
JSContext *const context;
uint8_t *base;
uint8_t *cursor;
uint8_t *limit;
};
/* We use little-endian byteorder for all encoded data */
#if defined IS_LITTLE_ENDIAN
inline uint32_t
NormalizeByteOrder32(uint32_t x)
{
return x;
}
inline uint16_t
NormalizeByteOrder16(uint16_t x)
{
return x;
}
#elif defined IS_BIG_ENDIAN
inline uint32_t
NormalizeByteOrder32(uint32_t x)
{
return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
}
inline uint16_t
NormalizeByteOrder16(uint16_t x)
{
return (x >> 8) | (x << 8);
}
#else
#error "unknown byte order"
#endif
template <XDRMode mode>
class XDRState {
public:
XDRBuffer buf;
protected:
JSPrincipals *principals;
JSPrincipals *originPrincipals;
XDRState(JSContext *cx)
: buf(cx), principals(NULL), originPrincipals(NULL) {
}
public:
JSContext *cx() const {
return buf.cx();
}
bool codeUint8(uint8_t *n) {
if (mode == XDR_ENCODE) {
uint8_t *ptr = buf.write(sizeof *n);
if (!ptr)
return false;
*ptr = *n;
} else {
*n = *buf.read(sizeof *n);
}
return true;
}
bool codeUint16(uint16_t *n) {
uint16_t tmp;
if (mode == XDR_ENCODE) {
uint8_t *ptr = buf.write(sizeof tmp);
if (!ptr)
return false;
tmp = NormalizeByteOrder16(*n);
memcpy(ptr, &tmp, sizeof tmp);
} else {
memcpy(&tmp, buf.read(sizeof tmp), sizeof tmp);
*n = NormalizeByteOrder16(tmp);
}
return true;
}
bool codeUint32(uint32_t *n) {
uint32_t tmp;
if (mode == XDR_ENCODE) {
uint8_t *ptr = buf.write(sizeof tmp);
if (!ptr)
return false;
tmp = NormalizeByteOrder32(*n);
memcpy(ptr, &tmp, sizeof tmp);
} else {
memcpy(&tmp, buf.read(sizeof tmp), sizeof tmp);
*n = NormalizeByteOrder32(tmp);
}
return true;
}
bool codeUint64(uint64_t *n) {
if (mode == XDR_ENCODE) {
uint8_t *ptr = buf.write(sizeof(*n));
if (!ptr)
return false;
ptr[0] = (*n >> 0) & 0xFF;
ptr[1] = (*n >> 8) & 0xFF;
ptr[2] = (*n >> 16) & 0xFF;
ptr[3] = (*n >> 24) & 0xFF;
ptr[4] = (*n >> 32) & 0xFF;
ptr[5] = (*n >> 40) & 0xFF;
ptr[6] = (*n >> 48) & 0xFF;
ptr[7] = (*n >> 56) & 0xFF;
} else {
const uint8_t *ptr = buf.read(sizeof(*n));
*n = (uint64_t(ptr[0]) << 0) |
(uint64_t(ptr[1]) << 8) |
(uint64_t(ptr[2]) << 16) |
(uint64_t(ptr[3]) << 24) |
(uint64_t(ptr[4]) << 32) |
(uint64_t(ptr[5]) << 40) |
(uint64_t(ptr[6]) << 48) |
(uint64_t(ptr[7]) << 56);
}
return true;
}
bool codeDouble(double *dp) {
union DoublePun {
double d;
uint64_t u;
} pun;
if (mode == XDR_ENCODE)
pun.d = *dp;
if (!codeUint64(&pun.u))
return false;
if (mode == XDR_DECODE)
*dp = pun.d;
return true;
}
bool codeBytes(void *bytes, size_t len) {
if (mode == XDR_ENCODE) {
uint8_t *ptr = buf.write(len);
if (!ptr)
return false;
memcpy(ptr, bytes, len);
} else {
memcpy(bytes, buf.read(len), len);
}
return true;
}
/*
* During encoding the string is written into the buffer together with its
* terminating '\0'. During decoding the method returns a pointer into the
* decoding buffer and the caller must copy the string if it will outlive
* the decoding buffer.
*/
bool codeCString(const char **sp) {
if (mode == XDR_ENCODE) {
size_t n = strlen(*sp) + 1;
uint8_t *ptr = buf.write(n);
if (!ptr)
return false;
memcpy(ptr, *sp, n);
} else {
*sp = buf.readCString();
}
return true;
}
bool codeChars(jschar *chars, size_t nchars);
bool codeFunction(JSMutableHandleObject objp);
bool codeScript(JSMutableHandleScript scriptp);
void initScriptPrincipals(JSScript *script) {
JS_ASSERT(mode == XDR_DECODE);
/* The origin principals must be normalized at this point. */
JS_ASSERT_IF(principals, originPrincipals);
JS_ASSERT(!script->principals);
JS_ASSERT(!script->originPrincipals);
if (principals) {
script->principals = principals;
JS_HoldPrincipals(principals);
}
if (originPrincipals) {
script->originPrincipals = originPrincipals;
JS_HoldPrincipals(originPrincipals);
}
}
};
class XDREncoder : public XDRState<XDR_ENCODE> {
public:
XDREncoder(JSContext *cx)
: XDRState<XDR_ENCODE>(cx) {
}
~XDREncoder() {
buf.freeBuffer();
}
const void *getData(uint32_t *lengthp) const {
return buf.getData(lengthp);
}
void *forgetData(uint32_t *lengthp) {
void *data = buf.getData(lengthp);
buf.setData(NULL, 0);
return data;
}
};
class XDRDecoder : public XDRState<XDR_DECODE> {
public:
XDRDecoder(JSContext *cx, const void *data, uint32_t length,
JSPrincipals *principals, JSPrincipals *originPrincipals);
};
} /* namespace js */
#endif /* Xdr_h___ */
| 25.559486 | 79 | 0.543842 |
0f125ef5c2771e61d5ee52770012a84b403f318f | 3,261 | c | C | image_view.c | RyanMallon/recomprehend | 6cee72636a29b8d0a8a57ad2ef60281ca73b3597 | [
"CC0-1.0"
] | 25 | 2017-02-21T12:02:27.000Z | 2021-09-30T22:18:31.000Z | image_view.c | sev-/recomprehend | 6cee72636a29b8d0a8a57ad2ef60281ca73b3597 | [
"CC0-1.0"
] | 2 | 2019-02-07T16:22:46.000Z | 2019-12-07T04:31:41.000Z | image_view.c | sev-/recomprehend | 6cee72636a29b8d0a8a57ad2ef60281ca73b3597 | [
"CC0-1.0"
] | 3 | 2017-06-11T21:26:59.000Z | 2020-07-23T01:41:48.000Z | /*
* This file is part of Re-Comprehend
*
* Ryan Mallon, 2015, <rmallon@gmail.com>
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to
* the public domain worldwide. This software is distributed without
* any warranty. You should have received a copy of the CC0 Public
* Domain Dedication along with this software. If not, see
*
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*
*/
#include <stdbool.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "image_data.h"
#include "graphics.h"
#include "util.h"
static void usage(const char *progname)
{
printf("%s: [OPTION]... FILENAME INDEX\n", progname);
printf("\nOptions:\n");
printf(" -w, --width=WIDTH Graphics width\n");
printf(" -h, --height=HEIGHT Graphics height\n");
printf(" -c, --clear=COLOR Graphics clear color\n");
printf(" -t, --color-table=INDEX Color table\n");
printf(" -s, --sequence Disable sequence of images\n");
printf(" -p, --pause Wait for keypress after each draw operation\n");
printf(" -f, --floodfill-disable Disable floodfill operation\n");
printf(" -d, --debug Enable debugging\n");
exit(EXIT_FAILURE);
}
int main(int argc, char **argv)
{
struct option long_opts[] = {
{"width", required_argument, 0, 'w'},
{"height", required_argument, 0, 'h'},
{"clear", required_argument, 0, 'c'},
{"color-table", required_argument, 0, 't'},
{"sequence", no_argument, 0, 's'},
{"pause", no_argument, 0, 'p'},
{"floodfill-disable", no_argument, 0, 'f'},
{"debug", no_argument, 0, 'd'},
{"help", no_argument, 0, '?'},
{NULL, 0, 0, 0},
};
const char *short_opts = "w:h:c:t:spfd?";
struct image_data info;
const char *filename;
unsigned index, clear_color = G_COLOR_WHITE,
graphics_width = G_RENDER_WIDTH,
graphics_height = G_RENDER_HEIGHT,
color_table = 0;
bool sequence = false;
int c, opt_index;
while (1) {
c = getopt_long(argc, argv, short_opts, long_opts, &opt_index);
if (c == -1)
break;
switch (c) {
case 'w':
graphics_width = strtoul(optarg, NULL, 0);
break;
case 'h':
graphics_height = strtoul(optarg, NULL, 0);
break;
case 'c':
clear_color = strtoul(optarg, NULL, 0);
break;
case 't':
color_table = strtoul(optarg, NULL, 0);
break;
case 's':
sequence = true;
break;
case 'p':
image_set_draw_flags(IMAGEF_OP_WAIT_KEYPRESS);
break;
case 'f':
image_set_draw_flags(IMAGEF_NO_FLOODFILL);
break;
case 'd':
debug_enable(DEBUG_IMAGE_DRAW);
break;
case '?':
usage(argv[0]);
break;
default:
printf("Invalid option\n");
usage(argv[0]);
break;
}
}
if (optind >= argc || argc - optind != 2)
usage(argv[0]);
filename = argv[optind++];
index = strtoul(argv[optind++], NULL, 0);
g_init(graphics_width, graphics_height);
g_set_color_table(color_table);
comprehend_load_image_file(filename, &info);
while (index < 16) {
g_clear_screen(clear_color);
draw_image(&info, index);
c = getchar();
if (!sequence || c == 'q' || c == 'Q')
break;
index++;
printf("Image %d\n", index);
}
exit(EXIT_SUCCESS);
}
| 23.630435 | 83 | 0.638761 |
c9e3456fc8472ae5302629dbe47effc85828b5d7 | 2,806 | h | C | open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h | mrehman29/open-vm-tools | 03f35e3209b3a73cf8e43a74ac764f22526723a0 | [
"X11"
] | 2 | 2020-07-23T06:01:37.000Z | 2021-02-25T06:48:42.000Z | open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h | mrehman29/open-vm-tools | 03f35e3209b3a73cf8e43a74ac764f22526723a0 | [
"X11"
] | null | null | null | open-vm-tools/common-agent/Cpp/Framework/Framework/include/Xml/XmlUtils/CXmlElement.h | mrehman29/open-vm-tools | 03f35e3209b3a73cf8e43a74ac764f22526723a0 | [
"X11"
] | 1 | 2020-11-11T12:54:06.000Z | 2020-11-11T12:54:06.000Z | /*
* Author: mdonahue
* Created: Dec 3, 2010
*
* Copyright (C) 2010-2016 VMware, Inc. All rights reserved. -- VMware Confidential
*/
#ifndef _CXmlElement_h
#define _CXmlElement_h
#include "Integration/IDocument.h"
#include "Xml/MarkupParser/CMarkupParser.h"
namespace Caf {
CAF_DECLARE_CLASS_AND_SMART_POINTER(CXmlElement);
class XMLUTILS_LINKAGE CXmlElement {
public:
typedef std::map<std::string, std::string> CAttributeCollection;
typedef std::multimap<std::string, SmartPtrCXmlElement> CElementCollection;
typedef std::deque<SmartPtrCXmlElement> COrderedElementCollection;
CAF_DECLARE_SMART_POINTER(CAttributeCollection);
CAF_DECLARE_SMART_POINTER(CElementCollection);
CAF_DECLARE_SMART_POINTER(COrderedElementCollection);
public:
CXmlElement();
virtual ~CXmlElement();
public:
void initialize(const MarkupParser::SmartPtrElement& element, const std::string& path);
MarkupParser::SmartPtrElement getInternalElement();
public: // Read operations
std::string findRequiredAttribute(const std::string& name) const;
std::string findOptionalAttribute(const std::string& name) const;
SmartPtrCXmlElement findRequiredChild(const std::string& name) const;
SmartPtrCXmlElement findOptionalChild(const std::string& name) const;
SmartPtrCElementCollection findRequiredChildren(const std::string& name) const;
SmartPtrCElementCollection findOptionalChildren(const std::string& name) const;
SmartPtrCAttributeCollection getAllAttributes() const;
SmartPtrCElementCollection getAllChildren() const;
SmartPtrCOrderedElementCollection getAllChildrenInOrder() const;
std::string getName() const;
std::string getValue() const;
std::string getCDataValue() const;
std::string getPath() const;
public: // Write operations
void addAttribute(const std::string& name, const std::string& value);
void removeAttribute(const std::string& name);
void setAttribute(const std::string& name, const std::string& value);
SmartPtrCXmlElement createAndAddElement(const std::string& name);
void addChild(const SmartPtrCXmlElement& xmlElement);
void removeChild(const std::string& name);
void setValue(const std::string& value);
void setCDataValue(const std::string& value);
void appendValue(const std::string& value);
void saveToFile(const std::string& filename) const;
std::string saveToString() const;
std::string saveToStringRaw() const;
private:
static const std::string CDATA_BEG;
static const std::string CDATA_END;
private:
bool _isInitialized;
mutable MarkupParser::SmartPtrElement _element;
std::string _path;
private:
static void saveToString(const MarkupParser::SmartPtrElement& element, std::string& xml);
private:
CAF_CM_CREATE;
CAF_CM_CREATE_LOG;
CAF_CM_DECLARE_NOCOPY(CXmlElement);
};
CAF_DECLARE_SMART_POINTER(CXmlElement);
}
#endif /* _CXmlElement_h */
| 31.52809 | 90 | 0.795438 |
84423b8d2cf83015cf3860f55537bf0676791d3d | 1,352 | h | C | StRoot/StTofUtil/StTofSlatCollection.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | 2 | 2018-12-24T19:37:00.000Z | 2022-02-28T06:57:20.000Z | StRoot/StTofUtil/StTofSlatCollection.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | StRoot/StTofUtil/StTofSlatCollection.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | /****************************************************************
* $Id: StTofSlatCollection.h,v 1.2 2015/07/28 22:55:44 smirnovd Exp $
*****************************************************************
* Author: Wei-Ming Zhang, April 2001
* Description: Local TOF slats collection
*
*****************************************************************
* $Log: StTofSlatCollection.h,v $
* Revision 1.2 2015/07/28 22:55:44 smirnovd
* Added cstddef C++ header defining size_t type
*
* Revision 1.1 2003/08/08 00:18:26 geurts
* moved from StTofMaker to StTofUtil
*
*
****************************************************************/
#ifndef ST_TOF_SLAT_COLLECTION_H
#define ST_TOF_SLAT_COLLECTION_H
#include <cstddef>
#include <vector>
#ifndef ST_NO_NAMESPACES
using std::vector;
using std::copy;
#endif
class StTofSlat;
#ifndef ST_NO_DEF_TEMPLATE_ARGS
typedef vector<StTofSlat*> slatVector;
#else
typedef vector<StTofSlat*, allocator<StTofSlat*> > slatVector;
#endif
class StTofSlatCollection {
public:
StTofSlatCollection();
virtual ~StTofSlatCollection();
bool push_back(StTofSlat* slat);
size_t size() const;
StTofSlat* front() const;
StTofSlat* back() const;
StTofSlat* getSlat(size_t index) const;
void clear();
private:
slatVector mSlatVector;
};
#endif
| 26.509804 | 70 | 0.565828 |
8461cf39919dedfd01cc4e4354586419e93ae3b8 | 261 | c | C | d/deku/fortress/grave2-1.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/deku/fortress/grave2-1.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/deku/fortress/grave2-1.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | #include <std.h>
#include "/d/deku/inherits/graveyard.h"
inherit GRAVEYARD;
void create() {
::create();
set_exits(([
"north" : GY_ROOMS +"grave3-1",
"west":GY_ROOMS +"grave2-2",
"south":GY_ROOMS +"grave1-1",
"east" : GY_ROOMS +"grave2"
] ));
}
| 18.642857 | 39 | 0.609195 |
70ef42de4cf3544a6b1ea3bd9d077822ab0fff55 | 111 | h | C | list/snode.h | persuez/MyCLibrary | 477680ba821064226543864a2af2eaa1a9219f05 | [
"MIT"
] | null | null | null | list/snode.h | persuez/MyCLibrary | 477680ba821064226543864a2af2eaa1a9219f05 | [
"MIT"
] | null | null | null | list/snode.h | persuez/MyCLibrary | 477680ba821064226543864a2af2eaa1a9219f05 | [
"MIT"
] | null | null | null | #ifndef NODE_H_
#define NODE_H_
typedef struct SNode{
struct SNode *next;
void *elem;
}SNode;
#endif
| 11.1 | 23 | 0.693694 |
7ec03c1cb187affd6008acb33b0bbb7ab5d13e1d | 612 | h | C | libvig/unverified/sketch.h | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | null | null | null | libvig/unverified/sketch.h | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | null | null | null | libvig/unverified/sketch.h | pmdm56/vigor | 0a65733a2b7bf48fc7d6071ea89c1af36f1cba80 | [
"MIT"
] | 1 | 2022-03-19T13:57:57.000Z | 2022-03-19T13:57:57.000Z | #ifndef _SKETCH_H_INCLUDED_
#include "sketch-util.h"
#include <stdbool.h>
#include <stdint.h>
#include "libvig/verified/map.h"
#include "libvig/verified/vigor-time.h"
struct Sketch;
int sketch_allocate(map_key_hash *kh, uint32_t capacity, uint16_t threshold,
struct Sketch **sketch_out);
void sketch_compute_hashes(struct Sketch *sketch, void *k);
void sketch_refresh(struct Sketch *sketch, vigor_time_t now);
int sketch_fetch(struct Sketch *sketch);
int sketch_touch_buckets(struct Sketch *sketch, vigor_time_t now);
void sketch_expire(struct Sketch *sketch, vigor_time_t time);
#endif | 29.142857 | 76 | 0.769608 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.