text stringlengths 4 6.14k |
|---|
/*
* Copyright (c) 2009, Natacha Porté
* Copyright (c) 2015, Vicent Marti
*
* 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 MARKDOWN_H__
#define MARKDOWN_H__
#include "buffer.h"
#include "autolink.h"
#ifdef __cplusplus
extern "C" {
#endif
/********************
* TYPE DEFINITIONS *
********************/
/* mkd_autolink - type of autolink */
enum mkd_autolink {
MKDA_NOT_AUTOLINK, /* used internally when it is not an autolink*/
MKDA_NORMAL, /* normal http/http/ftp/mailto/etc link */
MKDA_EMAIL, /* e-mail link without explit mailto: */
};
enum mkd_tableflags {
MKD_TABLE_ALIGN_L = 1,
MKD_TABLE_ALIGN_R = 2,
MKD_TABLE_ALIGN_CENTER = 3,
MKD_TABLE_ALIGNMASK = 3,
MKD_TABLE_HEADER = 4
};
enum mkd_extensions {
MKDEXT_NO_INTRA_EMPHASIS = (1 << 0),
MKDEXT_TABLES = (1 << 1),
MKDEXT_FENCED_CODE = (1 << 2),
MKDEXT_AUTOLINK = (1 << 3),
MKDEXT_STRIKETHROUGH = (1 << 4),
MKDEXT_UNDERLINE = (1 << 5),
MKDEXT_SPACE_HEADERS = (1 << 6),
MKDEXT_SUPERSCRIPT = (1 << 7),
MKDEXT_LAX_SPACING = (1 << 8),
MKDEXT_DISABLE_INDENTED_CODE = (1 << 9),
MKDEXT_HIGHLIGHT = (1 << 10),
MKDEXT_FOOTNOTES = (1 << 11),
MKDEXT_QUOTE = (1 << 12),
MKDEXT_NO_MENTION_EMPHASIS = (1 << 13),
MKDEXT_FENCED_CUSTOM = (1 << 14)
};
/* sd_callbacks - functions for rendering parsed data */
struct sd_callbacks {
/* block level callbacks - NULL skips the block */
void (*blockcode)(struct buf *ob, const struct buf *text, const struct buf *lang, void *opaque);
void (*blockcustom)(struct buf *ob, const struct buf *text, const struct buf *type, void *opaque);
void (*blockquote)(struct buf *ob, const struct buf *text, void *opaque);
void (*blockhtml)(struct buf *ob,const struct buf *text, void *opaque);
void (*header)(struct buf *ob, const struct buf *text, int level, void *opaque);
void (*hrule)(struct buf *ob, void *opaque);
void (*list)(struct buf *ob, const struct buf *text, int flags, void *opaque);
void (*listitem)(struct buf *ob, const struct buf *text, int flags, void *opaque);
void (*paragraph)(struct buf *ob, const struct buf *text, void *opaque);
void (*table)(struct buf *ob, const struct buf *header, const struct buf *body, void *opaque);
void (*table_row)(struct buf *ob, const struct buf *text, void *opaque);
void (*table_cell)(struct buf *ob, const struct buf *text, int flags, void *opaque);
void (*footnotes)(struct buf *ob, const struct buf *text, void *opaque);
void (*footnote_def)(struct buf *ob, const struct buf *text, unsigned int num, void *opaque);
/* span level callbacks - NULL or return 0 prints the span verbatim */
int (*autolink)(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque);
int (*codespan)(struct buf *ob, const struct buf *text, void *opaque);
int (*double_emphasis)(struct buf *ob, const struct buf *text, void *opaque);
int (*emphasis)(struct buf *ob, const struct buf *text, void *opaque);
int (*underline)(struct buf *ob, const struct buf *text, void *opaque);
int (*highlight)(struct buf *ob, const struct buf *text, void *opaque);
int (*quote)(struct buf *ob, const struct buf *text, void *opaque);
int (*image)(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *alt, void *opaque);
int (*linebreak)(struct buf *ob, void *opaque);
int (*link)(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque);
int (*raw_html_tag)(struct buf *ob, const struct buf *tag, void *opaque);
int (*triple_emphasis)(struct buf *ob, const struct buf *text, void *opaque);
int (*strikethrough)(struct buf *ob, const struct buf *text, void *opaque);
int (*superscript)(struct buf *ob, const struct buf *text, void *opaque);
int (*footnote_ref)(struct buf *ob, unsigned int num, void *opaque);
/* low level callbacks - NULL copies input directly into the output */
void (*entity)(struct buf *ob, const struct buf *entity, void *opaque);
void (*normal_text)(struct buf *ob, const struct buf *text, void *opaque);
/* header and footer */
void (*doc_header)(struct buf *ob, void *opaque);
void (*doc_footer)(struct buf *ob, void *opaque);
};
struct sd_markdown;
/*********
* FLAGS *
*********/
/* list/listitem flags */
#define MKD_LIST_ORDERED 1
#define MKD_LI_BLOCK 2 /* <li> containing block data */
/**********************
* EXPORTED FUNCTIONS *
**********************/
extern struct sd_markdown *
sd_markdown_new(
unsigned int extensions,
size_t max_nesting,
const struct sd_callbacks *callbacks,
void *opaque);
extern void
sd_markdown_render(struct buf *ob, const uint8_t *document, size_t doc_size, struct sd_markdown *md);
extern void
sd_markdown_free(struct sd_markdown *md);
#ifdef __cplusplus
}
#endif
#endif
|
#include <stdio.h>
#define TWO 2
#define OW "Consistency is the last refuge of the unimagina\
tive. - Oscar Wilde"
#define FOUR TWO*TWO
#define PX printf("%d\n", x)
#define HAL 'z'
#define HAP "Z"
#define SQUARE(x) ((x)*(x))
#define PRINTSQUARE(x) printf("%d is the square of " #x"\n", ((x)*(x)))
#define XNAME(n) x ## n
#define PR(...) printf(__VA_ARGS__)
#define FOO
#ifndef FOO
#error This is some error
#endif
int main(int argc, char *argv[]) {
char *s = HAP;
char c = HAL;
int x = TWO;
int XNAME(1) = 14;
int XNAME(2) = 20;
x = FOUR;
PX;
printf("%s\n", OW);
printf("TWO: OW\n");
PR("%d\n", SQUARE(2));
PRINTSQUARE(3);
printf("%s %s\n", __DATE__, __TIME__);
printf("%s\n", __func__);
return 0;
}
|
#include <util/cominc.h>
#include <util/bst_link.h>
#include <util/math.h>
inline struct bst_link* bst_min(struct bst_link* root) {
if (root == NULL) {
return NULL;
}
while (root->left != NULL) {
root = root->left;
}
return root;
}
inline struct bst_link* bst_max(struct bst_link* root) {
if (root == NULL) {
return NULL;
}
while (root->right != NULL) {
root = root->right;
}
return root;
}
inline struct bst_link* bst_sub_predecessor(struct bst_link* link) {
return bst_max(link->left);
}
inline struct bst_link* bst_sub_successor(struct bst_link* link) {
return bst_min(link->right);
}
inline struct bst_link* bst_rotate_left(struct bst_link* link) {
struct bst_link* right_c = link->right;
/* debug_assert(link != NULL); */
dbg_assert(link->right != NULL);
link->right = right_c->left;
right_c->left = link;
return right_c;
}
inline struct bst_link* bst_rotate_right(struct bst_link* link) {
struct bst_link* left_c = link->left;
dbg_assert(link->left != NULL);
link->left = left_c->right;
left_c->right = link;
return left_c;
}
static int bst_compare_wrap_v(const struct bst_link* lhs, const struct bst_link* rhs, pf_bst_compare_v raw_comp, void* raw_param) {
int raw_result = raw_comp(lhs, rhs, raw_param);
if (raw_result < 0) {
return -1;
}
else if (raw_result > 0) {
return 1;
}
if (lhs < rhs) {
return -1;
}
else if (lhs > rhs) {
return 1;
}
return 0;
}
static int bst_compare_wrap(struct bst_link* a, struct bst_link* b, pf_bst_compare comp) {
int raw_result = comp(a, b);
if (raw_result < 0)
return -1;
else if (raw_result > 0)
return 1;
if (a < b)
return -1;
else if (a > b)
return 1;
return 0;
}
struct bst_link* bst_insert(struct bst_link* root, struct bst_link* n_link, pf_bst_compare comp) {
struct bst_link* fwd = root;
struct bst_link* par = NULL;
int comp_res = 0;
if (root == NULL)
return n_link;
while (fwd != NULL) {
comp_res = bst_compare_wrap(fwd, n_link, comp);
if (comp_res == 0) {
/* the n_link is already in the tree, just return the root */
return root;
}
par = fwd;
fwd = comp_res > 0 ? fwd->right : fwd->left;
}
if (comp_res < 0)
par->left = n_link;
else
par->right = n_link;
return root;
}
struct bst_link* bst_search(struct bst_link* root, void* param, pf_bst_direct direct) {
int dir = direct(root, param);
if (root == NULL) return NULL;
while (dir != 0) {
root = dir > 0 ? root->right : root->left;
dir = direct(root, param);
}
return root;
}
struct bst_link* bst_replace(struct bst_link* cur, struct bst_link* par) {
struct bst_link* replacement = NULL;
dbg_assert(par == NULL ||
(par != NULL && (par->left == cur || par->right == cur)));
if (cur == NULL) return NULL;
if (cur->left == NULL && cur->right == NULL) {
replacement = NULL;
}
else if (cur->left != NULL) {
replacement = cur->left;
}
else if (cur->right != NULL) {
replacement = cur->right;
}
else {
/* two choices, randomly choose one. */
int choose_left = mrand(2);
struct bst_link* leaf_par = cur;
struct bst_link* leaf = NULL;
if (choose_left) {
leaf = leaf_par->left;
while (leaf->right != NULL) {
leaf_par = leaf;
leaf = leaf->right;
}
leaf_par->right = NULL;
}
else {
leaf = leaf_par->right;
while (leaf->left != NULL) {
leaf_par = leaf;
leaf = leaf->left;
}
leaf_par->left = NULL;
}
replacement = leaf;
replacement->left = cur->left;
replacement->right= cur->right;
}
/* we have to reassign the child pointer of par */
if (par != NULL) {
if (par->left == cur)
par->left = replacement;
else
par->right = replacement;
}
return replacement;
}
struct bst_link* bst_remove(struct bst_link* root, struct bst_link* to_rm, pf_bst_compare comp) {
/* first we should navigate to the link to be remove */
struct bst_link* par = NULL;
struct bst_link* fwd = root;
struct bst_link* replace = NULL;
int comp_res;
while (fwd != to_rm) {
comp_res = bst_compare_wrap(fwd, to_rm, comp);
par = fwd;
fwd = comp_res > 0 ? fwd->right : fwd->left;
}
dbg_assert(fwd == to_rm);
replace = bst_replace(fwd, par);
if (to_rm == root) {
/* return the new root */
return replace;
}
return root;
}
struct bst_link* bst_insert_v(struct bst_link* root, struct bst_link* n_link, pf_bst_compare_v comp, void* param) {
return NULL;
}
struct bst_link* bst_remove_v(struct bst_link* root, struct bst_link* n_link, pf_bst_compare_v comp, void* param) {
return NULL;
}
inline struct bstp_link* bstp_predecessor(struct bstp_link* cur) {
return NULL;
}
inline struct bstp_link* bstp_successor(struct bstp_link* root) {
return NULL;
}
inline struct bstp_link* bstp_rotate_left(struct bstp_link* link) {
return NULL;
}
inline struct bstp_link* bstp_rotate_right(struct bstp_link* link) {
return NULL;
}
|
#if !defined(crunk_h)
#define crunk_h
#include <stdio.h>
#include <string>
bool read_crunk_block(FILE *f, std::string &okey, std::string &oinfo, float *&ovalue);
#endif // crunk_h
|
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "math.h"
struct Triplet
{
int e1;
int e2;
int e3;
}t;
void IsAsceding(struct Triplet t)
{
if (t.e1>t.e2)
printf("NO\n");
else if (t.e2>t.e3)
printf("NO\n");
else
printf("YES\n");
}
int main(int argc, char const *argv[])
{
scanf("%d %d %d",&t.e1,&t.e2,&t.e3);
IsAsceding(t);
return 0;
}
|
// Created by John Åkerblom 2012-07-??
#ifndef __INJECT_UTILS_H_DEF__
#define __INJECT_UTILS_H_DEF__
#include <windows.h>
BOOL inject_dll(HANDLE proc, const char *dll_path, DWORD timeout);
#endif |
// $(noheader)
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by oLauncher.rc
//
#define IDI_ICON1 101
#define IDI_APPICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|
// Start with a valid MBR
static uint8_t block_guess[512] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x00, 0x0b, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xf4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa,
};
|
/*
* Copyright (C) 2012
* Dale Weiler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <string.h>
int memcmp(const void *s1, const void *s2, register size_t cnt) {
const unsigned char *s1p = (const unsigned char *) s1;
const unsigned char *s2p = (const unsigned char *) s2;
while (cnt-->0) {
if (*s1p++!=*s2p++)
return (s1p[-1] < s2p[-1])?-1:+1;
}
return 0;
}
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __QUAKE3SHADERMANAGER_H__
#define __QUAKE3SHADERMANAGER_H__
#include "OgreBspPrerequisites.h"
#include "OgreSingleton.h"
#include "OgreResourceManager.h"
#include "OgreQuake3Shader.h"
#include "OgreBlendMode.h"
namespace Ogre {
/** Class for managing Quake3 custom shaders.
Quake3 uses .shader files to define custom shaders, or Materials in Ogre-speak.
When a surface texture is mentioned in a level file, it includes no file extension
meaning that it can either be a standard texture image (+lightmap) if there is only a .jpg or .tga
file, or it may refer to a custom shader if a shader with that name is included in one of the .shader
files in the scripts/ folder. Because there are multiple shaders per file you have to parse all the
.shader files available to know if there is a custom shader available. This class is designed to parse
all the .shader files available and save their settings for future use. </p>
I choose not to set up Material instances for shaders found since they may or may not be used by a level,
so it would be very wasteful to set up Materials since they load texture images for each layer (apart from the
lightmap). Once the usage of a shader is confirmed, a full Material instance can be set up from it.</p>
Because this is a subclass of ScriptLoader, any files mentioned will be searched for in any path or
archive added to the ResourceGroupManager::WORLD_GROUP_NAME group. See ResourceGroupManager for details.
*/
class Quake3ShaderManager : public ScriptLoader, public Singleton<Quake3ShaderManager>, public ResourceAlloc
{
protected:
void parseNewShaderPass(DataStreamPtr& stream, Quake3Shader* pShader);
void parseShaderAttrib( const String& line, Quake3Shader* pShader);
void parseShaderPassAttrib( const String& line, Quake3Shader* pShader, Quake3Shader::Pass* pPass);
SceneBlendFactor convertBlendFunc( const String& q3func);
typedef map<String, Quake3Shader*>::type Quake3ShaderMap;
Quake3ShaderMap mShaderMap;
StringVector mScriptPatterns;
public:
Quake3ShaderManager();
virtual ~Quake3ShaderManager();
/** @copydoc ScriptLoader::getScriptPatterns */
const StringVector& getScriptPatterns(void) const;
/** @copydoc ScriptLoader::parseScript */
void parseScript(DataStreamPtr& stream, const String& groupName);
/** @copydoc ScriptLoader::parseScript */
Real getLoadingOrder(void) const;
/** Create implementation. */
Quake3Shader* create(const String& name);
/** Clear all the current shaders */
void clear(void);
/** Retrieve a Quake3Shader by name */
Quake3Shader* getByName(const String& name);
/** Override standard Singleton retrieval.
@remarks
Why do we do this? Well, it's because the Singleton
implementation is in a .h file, which means it gets compiled
into anybody who includes it. This is needed for the
Singleton template to work, but we actually only want it
compiled into the implementation of the class based on the
Singleton, not all of them. If we don't change this, we get
link errors when trying to use the Singleton-based class from
an outside dll.
@par
This method just delegates to the template version anyway,
but the implementation stays in this single compilation unit,
preventing link errors.
*/
static Quake3ShaderManager& getSingleton(void);
/** Override standard Singleton retrieval.
@remarks
Why do we do this? Well, it's because the Singleton
implementation is in a .h file, which means it gets compiled
into anybody who includes it. This is needed for the
Singleton template to work, but we actually only want it
compiled into the implementation of the class based on the
Singleton, not all of them. If we don't change this, we get
link errors when trying to use the Singleton-based class from
an outside dll.
@par
This method just delegates to the template version anyway,
but the implementation stays in this single compilation unit,
preventing link errors.
*/
static Quake3ShaderManager* getSingletonPtr(void);
};
}
#endif
|
// -*- C++ -*-
//=============================================================================
/**
* @file Flows_T.h
*
* $Id: Flows_T.h 935 2008-12-10 21:47:27Z mitza $
*
* @author Nagarajan Surendran <naga@cs.wustl.edu>
*/
//=============================================================================
#ifndef TAO_AV_FLOWS_T_H
#define TAO_AV_FLOWS_T_H
#include /**/ "ace/pre.h"
#include "orbsvcs/AV/AVStreams_i.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class TAO_FDev
* @brief Implementation of the AV/Streams Flow Device.
* A FlowConnection is used to bind FDevs for flows,
* much like how a StreamCtrl is used to bind MMDevices for streams.
*/
template <class T_Producer, class T_Consumer>
class TAO_FDev :
public virtual POA_AVStreams::FDev,
public virtual TAO_PropertySet
{
public:
/// default constructor
TAO_FDev (void);
/// constructor taking a flowname.
TAO_FDev (const char *flowname);
/// Destructor..
~TAO_FDev (void);
/// set/get the flowname.
/// create a flow producer object.
const char *flowname (void);
void flowname (const char *flowname);
AVStreams::FlowProducer_ptr create_producer (AVStreams::FlowConnection_ptr the_requester,
AVStreams::QoS & the_qos,
CORBA::Boolean_out met_qos,
char *& named_fdev);
/// bridge method for the application to override the producer object
/// creation. Default implementation creates a TAO_FlowProducer.
virtual AVStreams::FlowProducer_ptr make_producer (AVStreams::FlowConnection_ptr the_requester,
AVStreams::QoS & the_qos,
CORBA::Boolean_out met_qos,
char *& named_fdev);
/// create a flow consumer object.
virtual AVStreams::FlowConsumer_ptr create_consumer (AVStreams::FlowConnection_ptr the_requester,
AVStreams::QoS & the_qos,
CORBA::Boolean_out met_qos,
char *& named_fdev);
/// bridge method for the application to override the consumer object
/// creation. Default implementation creates a TAO_FlowConsumer.
virtual AVStreams::FlowConsumer_ptr make_consumer (AVStreams::FlowConnection_ptr the_requester,
AVStreams::QoS & the_qos,
CORBA::Boolean_out met_qos,
char *& named_fdev);
/// bind this FDev with another FDev.
virtual AVStreams::FlowConnection_ptr bind (AVStreams::FDev_ptr peer_device,
AVStreams::QoS & the_qos,
CORBA::Boolean_out is_met);
/// multicast bind is not implemented yet.
virtual AVStreams::FlowConnection_ptr bind_mcast (AVStreams::FDev_ptr first_peer,
AVStreams::QoS & the_qos,
CORBA::Boolean_out is_met);
/// destroys this FDev.
virtual void destroy (AVStreams::FlowEndPoint_ptr the_ep,
const char * fdev_name);
protected:
ACE_DLList <TAO_FlowProducer> producer_list_;
typedef ACE_DLList_Iterator <TAO_FlowProducer> PRODUCER_LIST_ITERATOR;
ACE_DLList <TAO_FlowConsumer> consumer_list_;
typedef ACE_DLList_Iterator <TAO_FlowConsumer> CONSUMER_LIST_ITERATOR;
CORBA::String_var flowname_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "orbsvcs/AV/Flows_T.cpp"
#endif /*ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Flows_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* TAO_AV_FLOWS_T_H */
|
#pragma once
#include "pco-interfaces.h"
#include <engine/pco-core_Pitch.h>
#include <io/cake_Analog.h>
BEGIN_PCO_INTERFACES_NAMESPACE
// Expected Traits content:
// static const byte sNumBits Used for oversampling filter (must be > 10)
// typedef [cake::AnalogPin] AdcPin Pin to be used for ADC readings
template<class Traits>
class ModulationInput
{
public:
inline ModulationInput();
inline ~ModulationInput();
public:
inline void init();
public:
inline void process(pco_core::Pitch& ioPitch);
inline void setRange(pco_core::Pitch& inRange);
private:
typedef cake::Adc::Sample Sample;
cake::AdcOversamplingFilter<Traits::sNumBits> mFilter;
uint16 mRange;
};
END_PCO_INTERFACES_NAMESPACE
#include "interfaces/pco-interfaces_Modulation.hpp"
|
/*
* This file is part of Pwxe, a PHP extension to stop execution
* of writable files.
*
* Author: Varga Bence <vbence@czentral.org>
*/
#ifndef PHP_PWXE_H
#define PHP_PWXE_H 1
#define PHP_PWXE_VERSION "0.1"
#define PHP_PWXE_EXTNAME "PWXE"
extern void pwxe_zend_init(TSRMLS_D);
extern void pwxe_zend_shutdown(TSRMLS_D);
PHP_MINIT_FUNCTION(pwxe);
PHP_MSHUTDOWN_FUNCTION(pwxe);
PHP_RINIT_FUNCTION(pwxe);
PHP_RSHUTDOWN_FUNCTION(pwxe);
PHP_MINFO_FUNCTION(pwxe);
extern zend_module_entry pwxe_module_entry;
#define phpext_pwxe_ptr &pwxe_module_entry
#endif
|
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_ReflCoefToLpc().
* The description header can be found in signal_processing_library.h
*
*/
#include BOSS_WEBRTC_U_common_audio__signal_processing__include__signal_processing_library_h //original-code:"common_audio/signal_processing/include/signal_processing_library.h"
void WebRtcSpl_ReflCoefToLpc(const int16_t *k, int use_order, int16_t *a)
{
int16_t any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
int16_t *aptr, *aptr2, *anyptr;
const int16_t *kptr;
int m, i;
kptr = k;
*a = 4096; // i.e., (Word16_MAX >> 3)+1.
*any = *a;
a[1] = *k >> 3;
for (m = 1; m < use_order; m++)
{
kptr++;
aptr = a;
aptr++;
aptr2 = &a[m];
anyptr = any;
anyptr++;
any[m + 1] = *kptr >> 3;
for (i = 0; i < m; i++)
{
*anyptr = *aptr + (int16_t)((*aptr2 * *kptr) >> 15);
anyptr++;
aptr++;
aptr2--;
}
aptr = a;
anyptr = any;
for (i = 0; i < (m + 2); i++)
{
*aptr = *anyptr;
aptr++;
anyptr++;
}
}
}
|
#pragma once
#include <vector>
#include <mapnik/featureset.hpp>
class CachedFeatureset : public mapnik::Featureset {
public:
CachedFeatureset(mapnik::featureset_ptr fs);
mapnik::feature_ptr next() override;
private:
using cached_features_t = std::vector<mapnik::feature_ptr>;
cached_features_t cached_features_;
const mapnik::featureset_ptr fs_;
cached_features_t::iterator iter_;
bool cached_{false};
};
|
#pragma once
#include <string>
namespace ni {
class FileDesc {
public:
FileDesc(int fd);
FileDesc(const std::string& filePath, int mode);
FileDesc(const FileDesc& source);
FileDesc& operator=(const FileDesc& source);
~FileDesc();
operator int() const;
void close();
bool good() const;
private:
int m_fd;
};
} |
/*
* gpsdclient.h -- common functions for GPSD clients
*
* This file is Copyright (c) 2010 by the GPSD project
* BSD terms apply: see the file COPYING in the distribution root for details.
*
*/
#ifndef _GPSD_GPSDCLIENT_H_
#define _GPSD_GPSDCLIENT_H_
struct exportmethod_t
/* describe an export method */
{
const char *name;
const char *magic;
const char *description;
};
struct fixsource_t
/* describe a data source */
{
char *spec; /* pointer to actual storage */
char *server;
char *port;
char *device;
};
struct exportmethod_t *export_lookup(const char *);
struct exportmethod_t *export_default(void);
void export_list(FILE *);
enum unit {unspecified, imperial, nautical, metric};
enum unit gpsd_units(void);
enum deg_str_type { deg_dd, deg_ddmm, deg_ddmmss };
float true2magnetic(double, double, double);
extern char *deg_to_str( enum deg_str_type type, double f);
extern void gpsd_source_spec(const char *fromstring,
struct fixsource_t *source);
char *maidenhead(double n,double e);
/* this needs to match JSON_DATE_MAX in gpsd.h */
#define CLIENT_DATE_MAX 24
#endif /* _GPSDCLIENT_H_ */
/* gpsdclient.h ends here */
|
//
// Created by Ivan on 14-8-27.
//
//
#import <Foundation/Foundation.h>
@interface UIImageView (SYTheme)
@property(assign, nonatomic) NSInteger stretchLeft; //image 拉伸的参数
@property(assign, nonatomic) NSInteger stretchTop; //image 拉伸的参数
@property(assign, nonatomic) NSInteger highlighted_stretchLeft; //image 拉伸的参数
@property(assign, nonatomic) NSInteger highlighted_stretchTop; //image 拉伸的参数
/**
* @brief 通过设置图片名来给UIImageView设置image 默认开启图片缓存,下同
* @param imageName 图片名字 这个值,必须用上面定义的宏来获取
*/
- (void)setImageWithName:(NSString *)imageName;
/**
* @brief 通过设置图片名来给UIImageView设置image
* @param imageName 图片名字 这个值,必须用上面定义的宏来获取
* @param cache 是否使用图片缓存
*/
- (void)setImageWithName:(NSString *)imageName cache:(BOOL)cache;
/**
* @brief 通过设置图片名来给UIImageView设置image
* @param imageName 图片名字 这个值,必须用上面定义的宏来获取
* @param leftValue 图片拉伸参数
* @param topValue 图片拉伸参数
*/
- (void)setImageWithName:(NSString *)imageName stretchLeft:(NSInteger)leftValue stretchTop:(NSInteger)topValue;
- (void)setImageWithName:(NSString *)imageName stretchLeft:(NSInteger)leftValue stretchTop:(NSInteger)topValue cache:(BOOL)cache;
/**
* @brief 设置高亮image
*/
- (void)setHighlightedImageWithName:(NSString *)imageName stretchLeft:(NSInteger)leftValue stretchTop:(NSInteger)topValue;
- (void)setHighlightedImageWithName:(NSString *)imageName stretchLeft:(NSInteger)leftValue stretchTop:(NSInteger)topValue cache:(BOOL)cache;
@end |
//
// WDeComPayPal.h
// WDeCom
//
// Created by Vrana, Jozef on 23/04/2018.
// Copyright © 2018 Wirecard Technologies GmbH. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for WDeComPayPal.
FOUNDATION_EXPORT double WDeComPayPalVersionNumber;
//! Project version string for WDeComPayPal.
FOUNDATION_EXPORT const unsigned char WDeComPayPalVersionString[];
#import <WDeComPayPal/WDECPayPalPayment.h>
|
#ifndef LIBXAOS_CORE_STRINGS_POOLED_STRING_H
#define LIBXAOS_CORE_STRINGS_POOLED_STRING_H
#include <cstddef>
namespace libxaos {
namespace strings {
// Forward declare StringPool
class StringPool;
/**
* @brief Represents a string in a StringPool.
*
* Represents a pooled string in memory. Does NOT allow user
* construction and is only constructible by StringPool objects. This
* is to ensure that no user can instantiate a PooledString from
* nowhere. (Though comparisons are allowed.)
*/
class PooledString {
//! The StringPool class needs to be a friend of the PooledString
friend class StringPool;
public:
//! Allow direct construction of a nullptr string.
PooledString(nullptr_t);
~PooledString();
PooledString(const PooledString&);
PooledString& operator=(const PooledString&);
PooledString(PooledString&&);
PooledString& operator=(PooledString&&);
//! Allow assigning nullptr to PooledString
PooledString& operator=(nullptr_t);
//! Determines if this PooledString points to a valid string.
inline operator bool() const;
//! Acquires the contents of this PooledString
inline const char* getCharPointer() const;
private:
//! Private constructor for use by the StringPool
explicit PooledString(char*);
//! Raw string pointer referencing to StringPool memory.
char* _string;
};
//! Compares two PooledStrings (Equality)
inline bool operator==(const PooledString&, const PooledString&);
//! Compares two PooledStrings (Inequality)
inline bool operator!=(const PooledString&, const PooledString&);
//! Compares to nullptr (Equality)
inline bool operator==(const PooledString&, nullptr_t);
//! Compares to nullptr (Equality)
inline bool operator==(nullptr_t, const PooledString&);
//! Compares to nullptr (Inequality)
inline bool operator!=(const PooledString&, nullptr_t);
//! Compares to nullptr (Inequality)
inline bool operator!=(nullptr_t, const PooledString&);
}
}
// Bring in inline implementations
#include "PooledString-inl.h"
#endif // LIBXAOS_CORE_STRINGS_POOLED_STRING_H
|
#ifndef FRACTALBUILDER_H
#define FRACTALBUILDER_H
#include <QVector>
#include <QRectF>
#include <QLineF>
#include "Util/channel.h"
/**
* @brief The FractalBuilder class - strategy pattern, calculates lines which we will paint
*/
class FractalBuilder
{
public:
virtual void getFractal(Channel<QLineF>& channel, uint level, QRectF square)=0;
virtual ~FractalBuilder() {}
};
#endif // FRACTALBUILDER_H
|
/*-------------------------------------------------------------------------
This source file is a part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2016 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE
-------------------------------------------------------------------------*/
#ifndef __OgreThreadHeaders_H__
#define __OgreThreadHeaders_H__
#if !defined(NOMINMAX) && defined(_MSC_VER)
# define NOMINMAX // required to stop windows.h messing up std::min
#endif
#if OGRE_THREAD_PROVIDER == 1
#include "OgreThreadHeadersBoost.h"
#elif OGRE_THREAD_PROVIDER == 2
#include "OgreThreadHeadersPoco.h"
#elif OGRE_THREAD_PROVIDER == 3
#include "OgreThreadHeadersTBB.h"
#elif OGRE_THREAD_PROVIDER == 4
#include "OgreThreadHeadersSTD.h"
#endif
#include "OgreThreadDefines.h"
#endif
|
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2007 */
/*-----------------------------------------------------------------------*/
/* This is a stub disk I/O module that acts as front end of the existing */
/* disk I/O modules and attach it to FatFs module with common interface. */
/*-----------------------------------------------------------------------*/
#include "diskio.h"
#include "stm32f10x.h"
#include "bsp_sdio_sdcard.h"
#define BLOCK_SIZE 512 /* Block Size in Bytes */
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
DSTATUS disk_initialize (
BYTE drv /* Physical drive nmuber (0..) */
)
{
SD_Error Status;
/* Supports only single drive */
if (drv)
{
return STA_NOINIT;
}
/*-------------------------- SD Init ----------------------------- */
Status = SD_Init();
if (Status!=SD_OK )
{
return STA_NOINIT;
}
else
{
return RES_OK;
}
}
/*-----------------------------------------------------------------------*/
/* Return Disk Status */
DSTATUS disk_status (
BYTE drv /* Physical drive nmuber (0..) */
)
{
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
DRESULT disk_read (
BYTE drv, /* Physical drive nmuber (0..) */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
BYTE count /* Number of sectors to read (1..255) */
)
{
if (count > 1)
{
SD_ReadMultiBlocks(buff, sector*BLOCK_SIZE, BLOCK_SIZE, count);
/* Check if the Transfer is finished */
SD_WaitReadOperation(); //Ñ»·²éѯdma´«ÊäÊÇ·ñ½áÊø
/* Wait until end of DMA transfer */
while(SD_GetStatus() != SD_TRANSFER_OK);
}
else
{
SD_ReadBlock(buff, sector*BLOCK_SIZE, BLOCK_SIZE);
/* Check if the Transfer is finished */
SD_WaitReadOperation(); //Ñ»·²éѯdma´«ÊäÊÇ·ñ½áÊø
/* Wait until end of DMA transfer */
while(SD_GetStatus() != SD_TRANSFER_OK);
}
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Write Sector(s) */
#if _READONLY == 0
DRESULT disk_write (
BYTE drv, /* Physical drive nmuber (0..) */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
BYTE count /* Number of sectors to write (1..255) */
)
{
if (count > 1)
{
SD_WriteMultiBlocks((uint8_t *)buff, sector*BLOCK_SIZE, BLOCK_SIZE, count);
/* Check if the Transfer is finished */
SD_WaitWriteOperation(); //µÈ´ýdma´«Êä½áÊø
while(SD_GetStatus() != SD_TRANSFER_OK); //µÈ´ýsdioµ½sd¿¨´«Êä½áÊø
}
else
{
SD_WriteBlock((uint8_t *)buff,sector*BLOCK_SIZE, BLOCK_SIZE);
/* Check if the Transfer is finished */
SD_WaitWriteOperation(); //µÈ´ýdma´«Êä½áÊø
while(SD_GetStatus() != SD_TRANSFER_OK); //µÈ´ýsdioµ½sd¿¨´«Êä½áÊø
}
return RES_OK;
}
#endif /* _READONLY */
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
DRESULT disk_ioctl (
BYTE drv, /* Physical drive nmuber (0..) */
BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Get current time */
/*-----------------------------------------------------------------------*/
DWORD get_fattime(void)
{
return 0;
}
|
//
// Stately.h
// Stately
//
// Created by Brian Lambert on 10/4/16.
// See the LICENSE.md file in the project root for license information.
//
#import <Foundation/Foundation.h>
//! Project version number for Stately.
FOUNDATION_EXPORT double StatelyVersionNumber;
//! Project version string for Stately.
FOUNDATION_EXPORT const unsigned char StatelyVersionString[];
|
//
// CCVirtualItemBuilder.hpp
// ee-x
//
// Created by Le Van Kiet on 9/14/18.
//
#ifndef SOOMLA_VIRTUAL_ITEM_BUILDER_HPP
#define SOOMLA_VIRTUAL_ITEM_BUILDER_HPP
#ifdef __cplusplus
#include <optional>
#include <string>
#include "soomla/domain/CCVirtualItem.h"
namespace soomla {
template <class T>
class VirtualItemBuilder {
private:
using Self = VirtualItemBuilder;
public:
VirtualItemBuilder() = default;
~VirtualItemBuilder() = default;
T& setName(const std::string& name);
T& setDescription(const std::string& description);
T& setItemId(const std::string& itemId);
virtual CCVirtualItem* build() const = 0;
protected:
std::string name_; // Optional.
std::string description_; // Optional.
std::optional<std::string> itemId_;
};
} // namespace soomla
#endif // __cplusplus
#endif /* SOOMLA_VIRTUAL_ITEM_BUILDER_HPP */
|
/*
module.h
Container for parsing commandline data and running function on given arguments
Copyright (c) 2013 - 2018 Jason Lee @ calccrypto at gmail.com
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 __COMMAND__
#define __COMMAND__
#include <algorithm>
#include <cctype>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <vector>
namespace module {
class Module{
public:
// Optional arguments with default values
// name -> <explaination, default value>
typedef std::map <std::string, std::pair <std::string, std::string> > Opts;
// optional arguments that default to true and false only
// flags used flip default value
// name -> <explaination, true/false>
typedef std::map <std::string, std::pair <std::string, bool> > Flags;
// function to check arguments and run user defined actions
typedef std::function <int(const std::map <std::string, std::string> &,
const std::map <std::string, bool> &,
std::ostream &,
std::ostream &)> Run;
private:
std::string name; // name of this module, and calling string; no whitespace
std::vector <std::string> positional; // required postional arguments (no default value)
Opts opts; // optional arguments (default value provided)
Flags flags; // boolean arguments (default value provided)
Run run; // function to run
// check for whitespace in names; throws if fail
void check_names_ws() const;
// check if there are any duplicate argument names; throws if fail
void check_duplicate() const;
// unknown arguments are ignored
const char * parse(int argc, char * argv[],
std::map <std::string, std::string> & parsed_args,
std::map <std::string, bool> & parsed_flags) const;
public:
Module() = default; // no default constructor
Module(const Module & cmd);
Module(Module && cmd);
Module(const std::string & n,
const std::vector <std::string> & pos,
const Opts & opts,
const Flags & flag,
const Run & func);
Module & operator=(const Module & cmd);
Module & operator=(Module && cmd);
const std::string & get_name() const; // can only get name out
std::string help(const std::string & indent = "") const; // get help string
// call operator() after setup
int operator()(int argc, char * argv[],
std::ostream & out = std::cout,
std::ostream & err = std::cerr) const;
};
}
#endif
|
//
// Felucia.h
// Felucia
//
// Created by Michał Tynior on 19/10/15.
// Copyright © 2015 Michał Tynior. All rights reserved.
//
@import Foundation;
//! Project version number for Felucia.
FOUNDATION_EXPORT double FeluciaVersionNumber;
//! Project version string for Felucia.
FOUNDATION_EXPORT const unsigned char FeluciaVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Felucia/PublicHeader.h>
|
/*
* imovablestream.h
* Declares a class that represents a movable input window stream
* Created by Andrew Davis
* Created on 7/13/2017
* Open source (MIT license)
*/
//disallow reinclusion
#ifndef CPP_CUR_I_MOVE_STREAM_H
#define CPP_CUR_I_MOVE_STREAM_H
//includes
#include <curses.h>
#include "iwindowstream.h"
#include "../display/window.h"
//namespace declaration
namespace cppcurses {
//class declaration
class imovablestream final : public iwindowstream
{
//public fields and methods
public:
//first constructor - reads from stdscr
imovablestream();
//second constructor - reads from a window
explicit imovablestream(const window* newWin);
//destructor
~imovablestream();
//delete the copy and move constructors
imovablestream(const imovablestream& ims) = delete;
imovablestream(imovablestream&& ims) = delete;
//delete the assignment and move operators
imovablestream& operator=(const imovablestream& src) = delete;
imovablestream& operator=(imovablestream&& src) = delete;
//getter methods
int X() const; //returns the x-coord being read at
int Y() const; //returns the y-coord being read at
//setter methods
void X(int newX); //sets the x-coord to read from
void Y(int newY); //sets the y-coord to read from
//private fields and methods
private:
//methods
std::streambuf::int_type underflow() override; //reads in characters
//fields
int x; //the x-coordinate to read from
int y; //the y-coordinate to read from
};
}
#endif
|
#ifndef FUZZYTERM_H
#define FUZZYTERM_H
//-----------------------------------------------------------------------------
//
// Name: FuzzyTerm.h
//
// Author: Mat Buckland (www.ai-junkie.com)
//
// Desc: abstract class to provide an interface for classes able to be
// used as terms in a fuzzy if-then rule base.
//-----------------------------------------------------------------------------
class FuzzyTerm
{
public:
virtual ~FuzzyTerm(){}
//all terms must implement a virtual constructor
virtual FuzzyTerm* Clone()const = 0;
//retrieves the degree of membership of the term
virtual double GetDOM()const=0;
//clears the degree of membership of the term
virtual void ClearDOM()=0;
//method for updating the DOM of a consequent when a rule fires
virtual void ORwithDOM(double val)=0;
};
#endif |
//
// AppDelegate.h
// Example
//
// Created by Vladimir Angelov on 2/23/14.
// Copyright (c) 2014 Vladimir Angelov. All rights reserved.
//
#import <UIKit/UIKit.h>
@class VLDUserService;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) VLDUserService *userService;
@end
|
//
// IWOAuthResponder.h
// IWOAuth
//
// Copyright (c) 2015 Intuit Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
/*!
* @protocol IWOAuthResponder
*
* @discussion This protocol represents the communication between the IWOAuthManager
* and a deleget/consumer. It handles the communication of the authorization
* status from the IWOAuthManager to the delegate.
*/
@protocol IWOAuthResponder <NSObject>
/*!
* @discussion This method will be called by IWOAuthManager after the OAuth flow has
* completed successfully.
* @param The userEmail address will be passed from IWOAuthManager to this method so
* that this can be used as a unique key to register with the Push Notification
* Gateway.
*/
- (void)authorizationSuccessful:(NSString *)userEmail;
/*!
* @discussion This method will be called by IWOAuthManager if the OAuth flow has
* canceled by the user. If the OAuth flow is canceled, it means that
* we have not completed the OAuth flow and are therefore not able to
* access the user's data.
*/
- (void)authorizationCanceled;
/*!
* @discussion This method will be called by IWOAuthManager when the OAuth flow has
* failed with some error condition.
* @param The NSError object that contains a description of the error condition.
*/
- (void)authorizationFailedWithError:(NSError *)error;
@end
|
#pragma once
#include <stdint.h>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <boost/shared_ptr.hpp>
#include <opencv2/opencv.hpp>
namespace caffe
{
template <typename Dtype>
class Net;
class NetParameter;
};
class Waifu2x
{
public:
enum eWaifu2xError
{
eWaifu2xError_OK = 0,
eWaifu2xError_Cancel,
eWaifu2xError_NotInitialized,
eWaifu2xError_InvalidParameter,
eWaifu2xError_FailedOpenInputFile,
eWaifu2xError_FailedOpenOutputFile,
eWaifu2xError_FailedOpenModelFile,
eWaifu2xError_FailedParseModelFile,
eWaifu2xError_FailedConstructModel,
eWaifu2xError_FailedProcessCaffe,
eWaifu2xError_FailedCudaCheck,
};
enum eWaifu2xCudaError
{
eWaifu2xCudaError_OK = 0,
eWaifu2xCudaError_NotFind,
eWaifu2xCudaError_OldVersion,
};
enum eWaifu2xcuDNNError
{
eWaifu2xcuDNNError_OK = 0,
eWaifu2xcuDNNError_NotFind,
eWaifu2xcuDNNError_OldVersion,
eWaifu2xcuDNNError_CannotCreate,
};
typedef std::function<bool()> waifu2xCancelFunc;
private:
bool is_inited;
// êxÉ·éæÌ
int crop_size;
// êxɽubNª·é©
int batch_size;
// lbgÉüÍ·éæÌTCY
int input_block_size;
// ubNÏ·ãÌoÍTCY
int output_size;
// lbg[NÉüÍ·éæÌTCY(oÍæÌÍlayer_num * 2¾¯¬³Èé)
int block_width_height;
// srcnn.prototxtÅè`³ê½üÍ·éæÌTCY
int original_width_height;
std::string mode;
int noise_level;
double scale_ratio;
std::string model_dir;
std::string process;
int inner_padding;
int outer_padding;
int output_block_size;
int input_plane;
bool isCuda;
boost::shared_ptr<caffe::Net<float>> net_noise;
boost::shared_ptr<caffe::Net<float>> net_scale;
float *input_block;
float *dummy_data;
float *output_block;
private:
static eWaifu2xError LoadMat(cv::Mat &float_image, const std::string &input_file);
static eWaifu2xError LoadMatBySTBI(cv::Mat &float_image, const std::string &input_file);
eWaifu2xError CreateBrightnessImage(const cv::Mat &float_image, cv::Mat &im);
eWaifu2xError PaddingImage(const cv::Mat &input, cv::Mat &output);
eWaifu2xError Zoom2xAndPaddingImage(const cv::Mat &input, cv::Mat &output, cv::Size_<int> &zoom_size);
eWaifu2xError CreateZoomColorImage(const cv::Mat &float_image, const cv::Size_<int> &zoom_size, std::vector<cv::Mat> &cubic_planes);
eWaifu2xError ConstractNet(boost::shared_ptr<caffe::Net<float>> &net, const std::string &model_path, const std::string ¶m_path, const std::string &process);
eWaifu2xError LoadParameterFromJson(boost::shared_ptr<caffe::Net<float>> &net, const std::string &model_path, const std::string ¶m_path);
eWaifu2xError SetParameter(caffe::NetParameter ¶m) const;
eWaifu2xError ReconstructImage(boost::shared_ptr<caffe::Net<float>> net, cv::Mat &im);
eWaifu2xError WriteMat(const cv::Mat &im, const std::string &output_file);
public:
Waifu2x();
~Waifu2x();
static eWaifu2xcuDNNError can_use_cuDNN();
static eWaifu2xCudaError can_use_CUDA();
// mode: noise or scale or noise_scale or auto_scale
// process: cpu or gpu or cudnn
eWaifu2xError init(int argc, char** argv, const std::string &mode, const int noise_level, const double scale_ratio, const std::string &model_dir, const std::string &process,
const int crop_size = 128, const int batch_size = 1);
void destroy();
eWaifu2xError waifu2x(const std::string &input_file, const std::string &output_file,
const waifu2xCancelFunc cancel_func = nullptr);
const std::string& used_process() const;
static cv::Mat LoadMat(const std::string &path);
};
|
//
// IMAccommodationPhotoView.h
// IMMS Manager
//
// Created by Mario Yohanes on 10/8/13.
// Copyright (c) 2013 Mario Yohanes. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface IMAccommodationPhotoView : UIView
@property (nonatomic, strong) NSString *photoPath;
@property (nonatomic, strong) UIImageView *imageView;
- (id)initWithFrame:(CGRect)frame photoPath:(NSString *)photoPath;
- (id)initDefaultPhotoViewWithFrame:(CGRect)frame;
@end
|
#include "common_vector_math.h"
#include <math.h>
uint64_t get_nnz_uint64_array(uint64_t* array, uint64_t no_elements) {
uint64_t nnz, j;
nnz = 0;
for (j = 0; j < no_elements; j++) {
if (array[j] != 0) {
nnz += 1;
}
}
return nnz;
}
VALUE_TYPE calculate_squared_vector_length(VALUE_TYPE *vector, uint64_t dim) {
VALUE_TYPE squared_vector_length;
uint64_t iter;
squared_vector_length = 0;
for(iter = 0; iter < dim; iter++) {
squared_vector_length += vector[iter] * vector[iter];
}
return squared_vector_length;
}
VALUE_TYPE sum_value_array(VALUE_TYPE* array, uint64_t no_elements) {
VALUE_TYPE sum;
uint64_t j;
sum = 0;
#pragma omp parallel for reduction(+:sum)
for (j = 0; j < no_elements; j++) {
sum += array[j];
}
return sum;
}
uint64_t get_nnz_key_array(KEY_TYPE* array, uint64_t no_elements) {
uint64_t nnz, j;
nnz = 0;
for (j = 0; j < no_elements; j++) {
if (array[j] != 0) {
nnz += 1;
}
}
return nnz;
}
VALUE_TYPE lower_bound_euclid(VALUE_TYPE vector_one_length_squared
, VALUE_TYPE vector_two_length_squared) {
return sqrt(value_type_max( vector_one_length_squared
+ vector_two_length_squared
- (2.0 * (sqrt(vector_one_length_squared)
* sqrt(vector_two_length_squared))), 0.0 ));
}
VALUE_TYPE value_type_max(VALUE_TYPE a, VALUE_TYPE b) {
return (a > b) ? a : b;
}
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2011-2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/** This is generated, do not edit by hand. **/
#include <jni.h>
#include "Proxy.h"
namespace titanium {
namespace ui {
class ListViewProxy : public titanium::Proxy
{
public:
explicit ListViewProxy(jobject javaObject);
static void bindProxy(v8::Handle<v8::Object> exports);
static v8::Handle<v8::FunctionTemplate> getProxyTemplate();
static void dispose();
static v8::Persistent<v8::FunctionTemplate> proxyTemplate;
static jclass javaClass;
private:
// Methods -----------------------------------------------------------
static v8::Handle<v8::Value> scrollToItem(const v8::Arguments&);
static v8::Handle<v8::Value> deleteSectionAt(const v8::Arguments&);
static v8::Handle<v8::Value> replaceSectionAt(const v8::Arguments&);
static v8::Handle<v8::Value> insertSectionAt(const v8::Arguments&);
static v8::Handle<v8::Value> getSections(const v8::Arguments&);
static v8::Handle<v8::Value> setSections(const v8::Arguments&);
static v8::Handle<v8::Value> appendSection(const v8::Arguments&);
static v8::Handle<v8::Value> getSectionCount(const v8::Arguments&);
static v8::Handle<v8::Value> addMarker(const v8::Arguments&);
static v8::Handle<v8::Value> setMarker(const v8::Arguments&);
// Dynamic property accessors ----------------------------------------
static v8::Handle<v8::Value> getter_sections(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static void setter_sections(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
static v8::Handle<v8::Value> getter_sectionCount(v8::Local<v8::String> property, const v8::AccessorInfo& info);
};
} // namespace ui
} // titanium
|
/*--------------------------------------------
Created by Sina on 06/29/16.
Copyright (c) 2013 MIT. All rights reserved.
--------------------------------------------*/
#ifndef __MAPP__gcmc__
#define __MAPP__gcmc__
#include "global.h"
#include "mpi_compat.h"
namespace MAPP_NS
{
enum{NOEX_MODE,DEL_MODE,INS_MODE};
enum{MINE_FLAG,INTERACT_FLAG,NONEINTERACT_FLAG};
/*--------------------------------------------
allocation for this constructor has 3 levels:
0. buffers that have constant size during the
life of this object. They are allocated in
constructor and destroyed destructor:
cut_s;
s_lo_ph;
s_hi_ph;
cell_size;
ncells_per_dim;
cell_denom;
icell_coord;
jcell_coord;
nimages_per_dim;
*nimages_per_dim;
ins_s_trials; (!! NOT *ins_s_trials)
rel_neigh_lst_coord;
rel_neigh_lst;
1. buffers whose size are dependent on box
dimensions and domain dimensions:
head_atm;
*ins_s_trials;
ins_cell;
ins_cell_coord;
ins_buff;
ins_cell;
del_lst;
2. buffers whose sizes are decided on fly
del_ids;
--------------------------------------------*/
template<typename> class Vec;
class GCMC
{
private:
protected:
int igas,gas_id,ngas_lcl;
elem_type gas_type;
type0 vol;
//constants
type0 gas_mass,beta,kbT,T,mu,lambda,sigma,z_fac;
int& natms_lcl;
int& natms_ph;
type0 cut;
type0**& cut_sq;
type0 (&s_lo)[__dim__];
type0 (&s_hi)[__dim__];
// size dim
type0 s_buff[__dim__];
type0 vel_buff[__dim__];
type0 cut_s[__dim__];
type0 s_lo_ph[__dim__];
type0 s_hi_ph[__dim__];
int nimages_per_dim[__dim__][2];
type0** s_trials;
int del_idx;
int* del_ids;
int del_ids_sz,del_ids_cpcty;
int max_id;
Vec<type0>* s_vec_p;
class Random* random;
int itrial_atm,ntrial_atms,max_ntrial_atms;
virtual void ins_succ()=0;
virtual void del_succ()=0;
virtual void box_setup();
virtual void box_dismantle();
void add_del_id(int*,int);
int get_new_id();
class DynamicMD*& dynamic;
MPI_Comm& world;
/*************************************************************************/
class AtomsMD*& atoms;
class ForceFieldMD*& ff;
type0 mvv_lcl[__nvoigt__];
#ifdef GCMCDEBUG
type0 tot_delta_u_lcl;
#endif
public:
GCMC(class AtomsMD*&, class ForceFieldMD*&,class DynamicMD*&,elem_type,type0,type0,int);
virtual ~GCMC();
virtual void init();
virtual void fin();
virtual void xchng(bool,int)=0;
virtual void next_iatm()=0;
virtual void next_jatm()=0;
virtual void next_icomm()=0;
virtual void reset_iatm()=0;
virtual void reset_jatm()=0;
virtual void reset_icomm()=0;
int iatm;
int niatms;
elem_type& ielem;
type0* ix;
type0* jx;
int jatm;
elem_type jelem;
type0 rsq;
int xchng_mode;
int dof_diff;
int ngas;
bool im_root;
Vec<int>* tag_vec_p;
int icomm;
type0* lcl_vars;
type0* vars;
MPI_Comm* curr_comm;
int curr_root;
bool root_succ;
type0 mvv[__nvoigt__];
#ifdef GCMCDEBUG
type0 tot_delta_u;
#endif
};
}
#endif
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/*
* Provides a common interface to the ASan (AddressSanitizer) and Valgrind
* functions used to mark memory in certain ways. In detail, the following
* three macros are provided:
*
* MOZ_MAKE_MEM_NOACCESS - Mark memory as unsafe to access (e.g. freed)
* MOZ_MAKE_MEM_UNDEFINED - Mark memory as accessible, with content undefined
* MOZ_MAKE_MEM_DEFINED - Mark memory as accessible, with content defined
*
* With Valgrind in use, these directly map to the three respective Valgrind
* macros. With ASan in use, the NOACCESS macro maps to poisoning the memory,
* while the UNDEFINED/DEFINED macros unpoison memory.
*
* With no memory checker available, all macros expand to the empty statement.
*/
#ifndef mozilla_MemoryChecking_h
#define mozilla_MemoryChecking_h
#if defined(MOZ_VALGRIND)
#include "valgrind/memcheck.h"
#endif
#if defined(MOZ_ASAN) || defined(MOZ_VALGRIND)
#define MOZ_HAVE_MEM_CHECKS 1
#endif
#if defined(MOZ_ASAN)
#include <stddef.h>
#include "mozilla/Types.h"
extern "C" {
/* These definitions are usually provided through the
* sanitizer/asan_interface.h header installed by ASan.
*/
void MOZ_EXPORT
__asan_poison_memory_region(void const volatile *addr, size_t size);
void MOZ_EXPORT
__asan_unpoison_memory_region(void const volatile *addr, size_t size);
#define MOZ_MAKE_MEM_NOACCESS(addr, size) \
__asan_poison_memory_region((addr), (size))
#define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
__asan_unpoison_memory_region((addr), (size))
#define MOZ_MAKE_MEM_DEFINED(addr, size) \
__asan_unpoison_memory_region((addr), (size))
}
#elif defined(MOZ_VALGRIND)
#define MOZ_MAKE_MEM_NOACCESS(addr, size) \
VALGRIND_MAKE_MEM_NOACCESS((addr), (size))
#define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
VALGRIND_MAKE_MEM_UNDEFINED((addr), (size))
#define MOZ_MAKE_MEM_DEFINED(addr, size) \
VALGRIND_MAKE_MEM_DEFINED((addr), (size))
#else
#define MOZ_MAKE_MEM_NOACCESS(addr, size) do {} while (0)
#define MOZ_MAKE_MEM_UNDEFINED(addr, size) do {} while (0)
#define MOZ_MAKE_MEM_DEFINED(addr, size) do {} while (0)
#endif
#endif /* mozilla_MemoryChecking_h */
|
/*
Copyright (C) 2014 Eric Wasylishen
Date: February 2014
License: MIT (see COPYING)
*/
#import <Cocoa/Cocoa.h>
@interface EWTextView : NSTextView
@end
|
#pragma once
#ifndef WIN32 // pretty sure linux and windows are the only OSs ever
#include "platform_interface.h"
#include <string>
struct GLFWwindow;
struct GLFWmonitor;
namespace fd {
class PlatformWindow {
private:
public:
// HWND m_hWnd;
int m_width;
int m_height;
bool m_fullscreen;
bool m_cursorCaptured;
GLFWwindow* m_glfwWindow;
int GetNumDisplays();
void ToggleFullscreenByMonitorName(const char* name);
static GLFWmonitor* GetRiftMonitorByName(const char* name);
void ToggleGlfwFullscreenByMonitorName(const char* name);
void GetWidthHeight(int* outWidth, int* outHeight);
void CaptureCursor(bool capture);
};
} // namespace fd
#endif //n def WIN32
|
#include <stdio.h>
#include "add.h"
#include "sub.h"
#include "mux.h"
#include "div.h"
int main(void)
{
int a = 20;
int b = 10;
printf("a = %d\n", a);
printf("b = %d\n", b);
printf("a + b = %d\n", add(a,b)); //求a b之和
printf("a - b = %d\n", sub(a,b)); //求a b之差
printf("a * b = %d\n", mux(a,b)); //求a b之积
printf("a / b = %d\n", div(a,b)); //求a b之商
return 0;
}
|
// STStateDescription.h
// Copyright (c) 2016 Eden Vidal
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
@import Foundation;
/// Represents a State model. Each state has a title and an unique identifier.
@interface STStateDescription : NSObject
@property (readonly, copy) NSString *title;
@property (readonly, copy) NSUUID *UUID;
/// Returns a new state description with the given title and random UUID
- (instancetype)initWithTitle: (NSString *)title;
/// Returns a new state description from the given dictionary.
/// Expected keys: "title" and "UUID".
- (instancetype)initWithDictionary: (NSDictionary <NSString *, id> *)dictionaryRepresentation;
/// Returns a copy of the current state with the same UUID but different title. You're supposed
/// to replace all copies of the old state with the new one.
- (instancetype)stateByAlteringTitle: (NSString *)title;
/// Returns a new state with random UUID and title equal to the current state's title with " Copy" suffix
- (instancetype)duplicate;
/// Returns a dictionary representation of this state model
- (NSDictionary <NSString *, id> *)dictionaryRepresentation;
@end
|
//
// MMXNavigationController.h
// MathMatch
//
// Created by Kyle O'Brien on 2014.1.21.
// Copyright (c) 2014 Computer Lab. All rights reserved.
//
@interface MMXNavigationController : UINavigationController <UINavigationControllerDelegate>
@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;
@end
|
//
// NSArray+CWAdditions.h
// CWFoundation
//
// Created by Guojiubo on 14-8-30.
// Copyright (c) 2014年 CocoaWind. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (CWAdditions)
/**
* Use isEqualToString: to compare, which is faster than containsObject:
*/
- (BOOL)cw_containsString:(NSString *)string;
@end
|
#ifndef __SOLVING__CLASP_OUTPUT_PARSING_H
#define __SOLVING__CLASP_OUTPUT_PARSING_H
#include <ginkgo/solving/Process.h>
#include <ginkgo/solving/Satisfiability.h>
namespace ginkgo
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ClaspOutputParsing
//
////////////////////////////////////////////////////////////////////////////////////////////////////
float parseForSolvingTime(std::stringstream &claspOutput);
Satisfiability parseForSatisfiability(std::stringstream &claspOutputJson);
bool parseForErrors(std::stringstream &claspOutput);
bool parseForWarnings(std::stringstream &claspOutput);
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif
|
//
// LeftViewController.h
// SlideMenuControllerOC
//
// Created by ChipSea on 16/2/27.
// Copyright © 2016年 pluto-y. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ImageHeaderView.h"
typedef enum : NSInteger{
LeftMenuMain = 0,
LeftMenuSwift,
LeftMenuJava,
LeftMenuGo,
LeftMenuNonMenu
} LeftMenu;
@protocol LeftMenuProtocol <NSObject>
@required
-(void)changeViewController:(LeftMenu) menu;
@end
@interface LeftViewController : UIViewController<LeftMenuProtocol, UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (retain, nonatomic) NSArray *menus;
@property (retain, nonatomic) UIViewController *mainViewControler;
@property (retain, nonatomic) UIViewController *swiftViewController;
@property (retain, nonatomic) UIViewController *javaViewController;
@property (retain, nonatomic) UIViewController *goViewController;
@property (retain, nonatomic) UIViewController *nonMenuViewController;
@property (retain, nonatomic) ImageHeaderView *imageHeaderView;
@end
|
//
// AppDelegate.h
// MHWAlertToLink
//
// Created by 橋本学 on 2016/05/09.
// Copyright © 2016年 MANABU HASHIMOTO WORKS. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef _MATRIX3_H_
#define _MATRIX3_H_
#include <iostream>
#include <assert.h>
/*
COLLUM ORDER:
0 3 6
1 4 7
2 5 8
ROW ORDER
0 1 2
3 4 5
6 7 8
*/
class vec3;
// Row-major order Matrix3x3f
class mat3 {
public:
// Internal data
float m[9];
mat3();
mat3(float identity);
mat3(float a, float b, float c,
float d, float e, float f,
float g, float h, float i);
mat3(vec3 const & v0, vec3 const & v1, vec3 const &);
// Functions
void set(float a, float b, float c,
float d, float e, float f,
float g, float h, float i);
static mat3 transpose(const mat3 & a);
// Static
const static mat3 identity;
const static mat3 zero;
// Operators
const float& operator () (int i, int j) const;
float& operator () (int i, int j);
float & operator[](const size_t index) {
assert(index >= 0 && index < 9 && "Can not access Matrix3 element.");
return m[index];
}
const float & operator[](const size_t index) const {
assert(index >= 0 && index < 9 && "Can not access Matrix3 element.");
return m[index];
}
};
mat3 operator* (mat3 const & a, mat3 const & b);
vec3 operator* (mat3 const & a, vec3 const & v);
#endif |
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebNodeCollection_h
#define WebNodeCollection_h
#include "../platform/WebCommon.h"
namespace WebCore { class HTMLCollection; }
#if BLINK_IMPLEMENTATION
namespace WTF { template <typename T> class PassRefPtr; }
#endif
namespace blink {
class WebNode;
// Provides readonly access to some properties of a DOM node.
class WebNodeCollection {
public:
~WebNodeCollection() { reset(); }
WebNodeCollection() : m_private(0), m_current(0) { }
WebNodeCollection(const WebNodeCollection& n) : m_private(0) { assign(n); }
WebNodeCollection& operator=(const WebNodeCollection& n)
{
assign(n);
return *this;
}
bool isNull() const { return !m_private; }
BLINK_EXPORT void reset();
BLINK_EXPORT void assign(const WebNodeCollection&);
BLINK_EXPORT unsigned length() const;
BLINK_EXPORT WebNode nextItem() const;
BLINK_EXPORT WebNode firstItem() const;
#if BLINK_IMPLEMENTATION
WebNodeCollection(const WTF::PassRefPtr<WebCore::HTMLCollection>&);
#endif
private:
void assign(WebCore::HTMLCollection*);
WebCore::HTMLCollection* m_private;
mutable unsigned m_current;
};
} // namespace blink
#endif
|
//
// UITableViewCell2.h
// ZWUtilityKit
//
// Created by 陈正旺 on 15/3/2.
// Copyright (c) 2015年 zwchen. All rights reserved.
//
/* ------------------------------------------------------
*
* @description:UITableViewCell对象分割线不被遮挡
*
* @update time: 2015-03-02
*
* ------------------------------------------------------*/
#import <UIKit/UIKit.h>
@interface UITableViewCell2 : UITableViewCell
@property (nonatomic, assign)BOOL bSeparatorLineHidden;
@end |
//
// YLActionContext.h
// YLActionContextDemo
//
// Created by IceCreamWu on 2017/5/10.
// Copyright © 2017年 IceCreamWu. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef id(^YLActionContextCallback)(id data);
/*
* YLActionContext暂时只支持一对一的行为,如果注册同一个action则会覆盖掉上个注册
* (需要一对多应该使用NSNotification或者另行支持)
*/
@interface YLActionContext : NSObject
+ (instancetype)actionContext;
- (void)registerAction:(NSString *)action callback:(YLActionContextCallback)callback keyObject:(id)keyObject;
- (void)registerAction:(NSString *)action callback:(YLActionContextCallback)callback;
// keyObject与注册时的keyObject一致才能成功解注册
- (void)unregisterAction:(NSString *)action keyObject:(id)keyObject;
- (void)unregisterAction:(NSString *)action;
- (void)unregisterActionWithKeyObject:(id)keyObject;
- (id)callAction:(NSString *)action data:(id)data;
@end
|
void inc(int* i)
//@ requires integer(i, ?v);
//@ ensures integer(i, v+1);
{
(*i) = (*i) + 1;
}
void address_of_param(int x)
//@ requires true;
//@ ensures true;
{
x = 5;
int* ptr = &x;
inc(ptr);
int z = x;
assert(z == 6);
}
void address_of_local()
//@ requires true;
//@ ensures true;
{
int x = 0;
{
int* ptr = &x;
{
int** ptrptr = &ptr;
inc(*ptrptr);
int z = x;
assert(z == 1);
}
}
return;
//@ int tmp = 0;
}
void test_goto()
//@ requires true;
//@ ensures true;
{
goto end;
{
int x = 5;
int *p = &x;
abort();
}
end:
}
void test_goto2()
//@ requires true;
//@ ensures true;
{
{
int x = 0;
int* ptr = &x;
goto end;
}
end:
}
void test_goto3()
//@ requires true;
//@ ensures true;
{
{
int x = 0;
int* ptr = &x;
goto next;
next:
x = 3;
}
}
void test_break()
//@ requires true;
//@ ensures true;
{
while(true)
//@ invariant true;
{
int x = 0;
int* ptr = &x;
break;
}
}
void test_break2()
//@ requires true;
//@ ensures true;
{
while(true)
//@ requires true;
//@ ensures true;
{
int x = 0;
int* ptr = &x;
break;
}
}
void test_requires_ensures_loop()
//@ requires true;
//@ ensures true;
{
int i = 0;
while(i < 5)
//@ requires i <= 5;
//@ ensures i <= 5;
{
int x = 0;
int* ptr = &x;
i = i + 1;
}
//@ assert i == 5;
}
void destroy(int* i)
//@ requires integer(i, _);
//@ ensures true;
{
//@ assume(false);
}
void dispose_local()
//@ requires true;
//@ ensures true;
{
int x = 0;
destroy(&x);
} //~ should_fail
void destroy_half(int* i)
//@ requires [1/2]integer(i, _);
//@ ensures true;
{
//@ assume(false);
}
void dispose_half_local(int y)
//@ requires true;
//@ ensures true;
{
int x = 0;
destroy_half(&x);
destroy_half(&y);
} //~ should_fail
void dispose_half_local2()
//@ requires true;
//@ ensures true;
{
while(true)
//@ invariant true;
{
int x = 0;
destroy(&x);
} //~ should_fail
}
void break_statement()
//@ requires true;
//@ ensures true;
{
int i = 0;
while(i < 1)
//@ invariant 0<=i && i<=1;
{
int x = 0;
int* ptr = &x;
break;
}
}
//@ predicate nodes(void *head) = head == 0 ? emp : pointer(head, ?next) &*& nodes(next);
void looptrouble()
//@ requires true;
//@ ensures true;
{
void *head = 0;
//@ close nodes(0);
loop:
//@ invariant nodes(head);
{
void *x = head;
//@ assume(&x != 0);
if (head != 0) {
//@ open nodes(head);
//@ pointer_distinct(head, &x);
assert(head != &x); // Unsound! TODO!
//@ close nodes(head);
}
head = &x;
//@ close nodes(head);
goto loop;
} //~ should_fail
}
|
#include<stdio.h>
int main()
{
int a=3,b=4;
printf("a=%d,b=%d\n",a,b);
a= a+b;
b =a-b;
a =a-b;
#if 0
a=a^b;
b=b^a;
a=a^b;
#endif
printf("a=%d,b=%d\n",a,b);
return 0;
}
|
#ifndef __PROJECT_EULER_PROBLEM428_H__
#define __PROJECT_EULER_PROBLEM428_H__
/*
* ProjectEuler/include/c/ProjectEuler/Problem428.h
*
* Necklace of circles
* ===================
* Published on Sunday, 19th May 2013, 01:00 am
*
* Let a, b and c be positive numbers. Let W, X, Y, Z be four collinear points
* where |WX| = a, |XY| = b, |YZ| = c and |WZ| = a + b + c. Let Cin be the
* circle having the diameter XY. Let Cout be the circle having the diameter
* WZ. The triplet (a, b, c) is called a necklace triplet if you can place k
* 3 distinct circles C1, C2, ..., Ck such that: Ci has no common interior
* points with any Cj for 1 i, j k and i j, Ci is tangent to both Cin and
* Cout for 1 i k, Ci is tangent to Ci+1 for 1 i < k, and Ck is tangent to
* C1. For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it
* can be shown that (2, 2, 5) is not. Let T(n) be the number of necklace
* triplets (a, b, c) such that a, b and c are positive integers, and b n. For
* example, T(1) = 9, T(20) = 732 and T(3000) = 438106. Find T(1 000 000
* 000).
*/
# ifdef __cplusplus
extern "C" {
# endif
# ifdef __cplusplus
}
# endif
#endif /* __PROJECT_EULER_PROBLEM428_H__ */
|
//
// HotelMap.h
// iGuidFC
//
// Created by dampier on 15/5/29.
// Copyright (c) 2015年 Artur Mkrtchyan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "ELongHotelData.h"
@interface HotelMap : UIViewController
@property (nonatomic, strong) IBOutlet MKMapView* mapView;
@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
@property (nonatomic, strong) ELongHotelData* hotelXML;
@end
|
#import <UIKit/UIFont.h>
#import <Artsy+UIColors/UIColor+ArtsyColors.h>
#if __has_include(<Artsy+UIFonts/UIFont+ArtsyFonts.h>)
#import <Artsy+UIFonts/UIFont+ArtsyFonts.h>
#endif
#if __has_include(<Artsy+UIFonts/UIFont+OSSArtsyFonts.h>)
#import <Artsy+UIFonts/UIFont+OSSArtsyFonts.h>
#endif
|
//
// StyleKit
//
// Copyright Graphiclife 2013. All Rights Reserved.
//
// The copyright to the computer program(s) herein
// is the property of Graphiclife, Sweden. The
// program(s) may be used and/or copied only with the
// written permission of Graphiclife or in accordance
// with the terms and conditions stipulated in the
// agreement/contract under which the program(s) have
// been supplied. This copyright notice must not be
// removed.
//
#ifndef STYLE_KIT_H
#define STYLE_KIT_H
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
# define SKView UIView
#else
# define SKView NSView
#endif
#define SKStyle(stname, attrs) static inline void sk_style_ ## stname(id target) {\
SKView *superview = [target valueForKey:@"superview"]; (void)superview;\
NSDictionary *d = attrs;\
for ( id key in d )\
{\
[target setValue:d[key] forKey:key];\
}\
}
#define SKStyleExt(stname, parent, attrs) static inline void sk_style_ ## stname(id target) {\
SKView *superview = [target valueForKey:@"superview"]; (void)superview;\
sk_style_ ## parent(target);\
NSDictionary *d = attrs;\
for ( id key in d )\
{\
[target setValue:d[key] forKey:key];\
}\
}
#define SKApply(stname, target) sk_style_ ## stname(target)
#endif |
#ifndef RAID_DISK_STUB_H
#define RAID_DISK_STUB_H
#include "warped.h"
#include "ObjectStub.h"
#include <string>
#include <sstream>
class SimulationObject;
/** The class RAIDDiskStub.
*/
class RAIDDiskStub : public ObjectStub {
public:
RAIDDiskStub(FactoryImplementationBase *owner) : ObjectStub(owner){}
~RAIDDiskStub(){};
std::string &getName() const {
static std::string name("RAIDDisk");
return name;
}
const std::string &getInformation() const {
static std::string info("A Simple RAID Disk Object");
return info;
}
const bool isLocalObject() const {
return true;
}
SimulationObject *createSimulationObject(int numberOfArguments,
std::ostringstream &argumentStream);
};
#endif
|
//
// QRSecondClass.h
// personly
//
// Created by 秦榕 on 2017/5/24.
// Copyright © 2017年 秦榕. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface QRSecondClass : UIView
@property(strong,nonatomic)NSArray* arr2;
@property(strong,nonatomic)NSArray* arr3;
@end
|
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Copyright (c) 2015-2016 Adafruit Industries
// Authors: Tony DiCola, Todd Treece
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.
//
#ifndef ADAFRUITIO_WINC1500_H
#define ADAFRUITIO_WINC1500_H
#if !defined(ARDUINO_SAMD_MKR1000) && defined(ARDUINO_ARCH_SAMD)
#include "Arduino.h"
#include "AdafruitIO.h"
#include "SPI.h"
#include "WiFi101.h"
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
// feather wifi m0
#define WINC_CS 8
#define WINC_IRQ 7
#define WINC_RST 4
#define WINC_EN 2
class AdafruitIO_WINC1500 : public AdafruitIO {
public:
AdafruitIO_WINC1500(const char *user, const char *key, const char *ssid, const char *pass);
AdafruitIO_WINC1500(const __FlashStringHelper *user, const __FlashStringHelper *key, const __FlashStringHelper *ssid, const __FlashStringHelper *pass);
~AdafruitIO_WINC1500();
aio_status_t networkStatus();
protected:
void _connect();
const char *_ssid;
const char *_pass;
WiFiSSLClient *_client;
};
#endif // ARDUINO_ARCH_SAMD
#endif // ADAFRUITIO_WINC1500_H
|
//
// UIImageView+cachedImageRequest.h
// SocialSoccer
//
// Created by Paulo Mendes on 4/10/14.
// Copyright (c) 2014 Movile. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImageView (cachedImageRequest)
- (void)ett_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage;
- (void)ett_setCachedImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage completion:(void (^)(UIImage *image))completion;
@end
|
//
// PPPerfectManager.h
// PerfectPixel-Project
//
// Created by Yuri on 4/30/15.
// Copyright (c) 2015 Yuri Kobets. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class PIXELWindow;
@interface PIXELPerfect : NSObject
@property (nonatomic,strong) PIXELWindow *overlayWindow;
@property (nonatomic,strong) Class recentUsedClass;
@property (nonatomic,assign, getter=isShowingOnStart) BOOL showOnStart;
@property (nonatomic,assign, getter=isImageInverted) BOOL imageInverted;
@property (nonatomic,assign) float imageAlpha;
+ (PIXELPerfect *)shared;
/**
Sets dictionary with keys as `UIViewController class` string and values as corresponding mockup image name
The dictionary with structure @{NSStringFromClass([UIViewController class]) : @"image.png" }
@param classesImagesDict - dictionary with `keys` - NSString of class, `values` - image name
key - NSString representation of UIViewController subclass
value - image name. Note that image should be added to bundle
*/
- (void)setControllersClassesAndImages:(NSDictionary *)classesImagesDict;
/**
Retrieves an image for specific UIViewController subclass
@param aClass the subclass of UIViewController
@return image of corresponding subclass of UIViewController
*/
- (UIImage *)imageForControllerClass:(Class)aClass;
@end
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <IDEKit/NSObject-Protocol.h>
@class DVTDocumentLocation, DVTFilePath, NSURL;
@protocol IDEIndexSymbol;
@protocol IDEIndexSymbolOccurrence <NSObject>
@property(readonly) DVTDocumentLocation *location;
@property(readonly) NSURL *moduleURL;
@property(readonly) DVTFilePath *file;
@property(readonly) long long role;
- (id <IDEIndexSymbol>)containingSymbol;
- (id <IDEIndexSymbol>)correspondingSymbol;
@end
|
/**
* @author J. Santos <jamillo@gmail.com>
* @date November 21, 2016
*/
#ifndef WALKING_DATA_JSON_H
#define WALKING_DATA_JSON_H
#include <json/json.h>
namespace mote
{
class json
{
public:
static void serialize(const Json::Value &json, std::string &msg);
static bool unserialize(char *buffer, unsigned int len, Json::Value &value);
static bool unserialize(const std::string &json, Json::Value &value);
};
}
#endif //WALKING_DATA_JSON_H
|
/*
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.
*/
#import <Foundation/NSObject.h>
#import "NSOutputStream_Printf.h"
@interface Term : NSObject
{
}
- init;
- (void) dealloc;
- (BOOL) isEqual: value;
- (void) printForDebugger: (NSOutputStream *) stream;
@end
|
/************************************************************************************
* The MIT License (MIT) *
* *
* Copyright (c) 2016 Bertrand Martel *
* *
* 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. *
************************************************************************************/
/**
IHciEventFrame.h
HCI event frame
@author Bertrand Martel
@version 1.0
*/
#ifndef IHCIEVENTFRAME_H
#define IHCIEVENTFRAME_H
#include "hci_decoder/IHciFrame.h"
#include "hci_decoder/hci_global.h"
#include "json/json.h"
/**
* @brief IHciEventFrame class
* Interface defining all a generic HCI Event Frame
*
*/
class IHciEventFrame : public virtual IHciFrame{
public:
/**
* @brief getEventCode
* retrieve event code
* @return
*/
EVENT_ENUM getEventCode(){
return event_code;
}
LE_SUBEVENT_ENUM getSubEventCode(){
return subevent_code;
}
void print(){
std::cout << "> " << HCI_PACKET_TYPE_STRING_ENUM.at(HCI_TYPE_EVENT) << " : \n" << toJson(true).data() << std::endl;
}
std::string toJson(bool beautify){
return convert_json_to_string(beautify,toJsonObj());
}
/**
* @brief getPacketType
* retrieve HCI Packet type (HCI_COMMAND / HCI_ACL_DATA / HCI_SCO_DATA / HCI_EVENT)
* @return
*/
HCI_PACKET_TYPE_ENUM getPacketType(){
return HCI_TYPE_EVENT;
}
/**
* @brief getParamterTotalLength
* number in bytes of total parameter length
* @return
*/
uint8_t getParamterTotalLength(){
return parameter_total_length;
}
protected:
void init(Json::Value& output){
Json::Value packet_type;
packet_type["code"] = HCI_TYPE_EVENT;
packet_type["value"] = HCI_PACKET_TYPE_STRING_ENUM.at(HCI_TYPE_EVENT);
output["packet_type"] = packet_type;
Json::Value code;
code["code"] = event_code;
code["value"] = EVENT_STRING_ENUM.at(event_code);
output["event_code"] = code;
output["parameter_total_length"] = parameter_total_length;
}
/*event code*/
EVENT_ENUM event_code;
/*subevent code*/
LE_SUBEVENT_ENUM subevent_code;
/*parameters length*/
uint8_t parameter_total_length;
};
#endif // IHCIEVENTFRAME_H
|
#ifndef __RESOURCE_TEXTURE_LOADER_H__
#define __RESOURCE_TEXTURE_LOADER_H__
#include "ResourceLoader.h"
#include "Resource.h"
#include <vector>
class ResourceTexture;
struct TextureInfo
{
TextureInfo() {};
TextureInfo(const TextureInfo& copy) { id = copy.id; size_x = copy.size_x; size_y = copy.size_y;
};
TextureInfo(unsigned int _id, unsigned int _size_x, unsigned int _size_y) { id = _id; size_x = _size_x; size_y = _size_y; };
unsigned int id = 0;
unsigned int size_x = 0;
unsigned int size_y = 0;
};
class ResourceTextureLoader : public ResourceLoader
{
public:
ResourceTextureLoader();
virtual ~ResourceTextureLoader();
Resource* CreateResource(std::string new_uid);
bool LoadFileToEngine(DecomposedFilePath decomposed_file_path, std::vector<Resource*>& resources);
bool RemoveAssetInfoFromEngine(DecomposedFilePath decomposed_file_path);
void ClearFromGameObject(Resource* resource, GameObject* go);
bool ExportResourceToLibrary(Resource* resource);
bool ImportResourceFromLibrary(DecomposedFilePath decomposed_file_path);
bool LoadAssetIntoScene(DecomposedFilePath decomposed_file_path);
bool IsAssetOnLibrary(DecomposedFilePath d_filepath, std::vector<std::string>& library_files_used);
bool RenameAsset(DecomposedFilePath decomposed_file_path, const char* new_name);
private:
};
#endif |
#ifndef GLOBAL_VALUE_H
#define GLOBAL_VALUE_H
class GlobalValue
{
public:
static GlobalValue *sharedValue();
static void destroy();
public:
bool m_bMusicOn;
private:
static GlobalValue *pValue;
GlobalValue(){ m_bMusicOn = true;}
~GlobalValue(){}
};
#endif //GLOBAL_VALUE_H |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <IDEKit/IDEAlertViewController.h>
@class NSMutableArray, NSPopUpButton, NSSound;
@interface IDESoundAlertViewController : IDEAlertViewController
{
NSPopUpButton *_soundPopUpButton;
NSMutableArray *_recentSounds;
NSSound *_playingSound;
}
- (void).cxx_destruct;
@property(retain) NSPopUpButton *soundPopUpButton; // @synthesize soundPopUpButton=_soundPopUpButton;
- (void)awakeFromNib;
- (void)populatePopUpButton;
- (void)addPathToRecentSounds:(id)arg1;
- (void)chooseSound:(id)arg1;
- (void)selectSound:(id)arg1;
- (void)setAlert:(id)arg1;
@end
|
//
// PCSideMenuPresentationController.h
// Pods
//
// Created by Ryan Fitzgerald on 8/10/16.
//
//
#import <UIKit/UIKit.h>
#import "PCSideMenuTransitionDelegate.h"
@interface PCSideMenuPresentationController : UIPresentationController
@property (nonatomic) PCSideMenuPosition menuPosition;
@property (nonatomic, strong) UIColor *backdropColor;
@end
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject.h"
@class AFVoiceInfo, NSArray, NSObject<OS_dispatch_queue>, NSXPCConnection;
@interface AFSettingsConnection : NSObject
{
NSXPCConnection *_connection;
NSObject<OS_dispatch_queue> *_voicesQueue;
NSArray *_voices;
AFVoiceInfo *_selectedVoice;
}
- (void).cxx_destruct;
- (void)setLanguage:(id)arg1 withCompletion:(id)arg2;
- (void)setLanguage:(id)arg1;
- (void)setOutputVoice:(id)arg1 withCompletion:(id)arg2;
- (void)setOutputVoice:(id)arg1;
- (void)getAvailableVoicesForRecognitionLanguage:(id)arg1 completion:(id)arg2;
- (void)_updateVoicesWithCompletion:(id)arg1;
- (void)_updateVoicesSync;
- (id)_filterVoices:(id)arg1 forLanguage:(id)arg2;
- (id)_voices;
- (void)_setVoices:(id)arg1;
- (void)barrier;
- (void)killDaemon;
- (void)setDictationEnabled:(_Bool)arg1;
- (void)setAssistantEnabled:(_Bool)arg1;
- (void)setActiveAccountIdentifier:(id)arg1;
- (void)deleteAccountWithIdentifier:(id)arg1;
- (void)saveAccount:(id)arg1 setActive:(_Bool)arg2;
- (id)accounts;
- (void)fetchSupportedLanguageCodes:(id)arg1;
- (id)_settingsServiceWithErrorHandler:(id)arg1;
- (id)_settingsService;
- (id)_connection;
- (void)_clearConnection;
- (void)dealloc;
- (id)init;
@end
|
//
// PPVinOcrParserFactory.h
// BlinkIdFramework
//
// Created by Dino on 20/06/16.
// Copyright © 2016 MicroBlink Ltd. All rights reserved.
//
#import "PPOcrParserFactory.h"
PP_CLASS_AVAILABLE_IOS(6.0) @interface PPVinOcrParserFactory : PPOcrParserFactory
@end
|
#include <stdio.h>
#include <string.h>
#include <CoreServices/CoreServices.h>
#include <CoreAudio/CoreAudioTypes.h>
#include <AudioToolbox/AudioToolbox.h>
#include <CoreServices/CoreServices.h>
#define LOG(f,s) fprintf(stderr,f,s);fflush(stderr);
#define QUERY_TEMPLATE "kMDItemContentTypeTree == 'public.audio' && (kMDItemAlbum == '*%s*'wc || kMDItemTitle == '*%s*'wc || kMDItemDisplayName == '*%s*'wc)"
#define kNumberBuffers 3
typedef struct {
AudioStreamBasicDescription mDataFormat;
AudioQueueRef mQueue;
AudioQueueBufferRef mBuffers[kNumberBuffers];
AudioFileID mAudioFile;
UInt32 bufferByteSize;
SInt64 mCurrentPacket;
UInt32 mNumPacketsToRead;
AudioStreamPacketDescription *mPacketDescs;
bool mIsRunning;
} AQPlayerState;
extern AQPlayerState aqData;
typedef struct {
int size;
char** files;
} SearchResults;
extern SearchResults queryResults;
void playFile(const char* filePath);
void free_aqData();
int getFilesForQuery(const char* queryStr);
|
//
// Data.h
// Congstar Counter
//
// Created by Josa Gesell on 10/10/14.
// Copyright (c) 2014 Josa Gesell. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <sqlite3.h>
@class FMDatabase;
@interface Data : NSObject {
// sqlite3 *mySqliteDB;
}
@property (nonatomic) NSInteger ID;
@property (nonatomic) double used;
@property (nonatomic) double total;
@property (nonatomic) NSInteger daysLeft;
@property (nonatomic, strong) NSDate *time;
+ (BOOL) initDatabaseTo: (NSString*)databasePath;
+ (FMDatabase *) database;
+ (NSArray *) findAll;
+ (Data *) findLast;
- (BOOL) save;
- (BOOL) remove;
@end
|
//
// FilesListViewController.h
// ResourceLoader
//
// Created by Artem Meleshko on 1/31/15.
// Copyright (c) 2015 LeshkoApps ( http://leshkoapps.com ). All rights reserved.
//
#import <UIKit/UIKit.h>
@class YDSession;
@protocol FilesListViewControllerDelegate;
@interface FilesListViewController : UIViewController
- (instancetype)initWithSession:(YDSession *)session path:(NSString *)path;
@property (nonatomic, readonly, copy) NSString *path;
@property (nonatomic, readonly, copy) NSArray *entries;
@property (nonatomic, readonly, strong) YDSession *session;
@property (nonatomic, weak)id<FilesListViewControllerDelegate> delegate;
@end
@protocol FilesListViewControllerDelegate <NSObject>
@optional
- (void)filesListController:(FilesListViewController *)vc didSelectFileAtPath:(NSString *)filePath;
@end |
// EdUtils.h
// Guy Simmons, 5th April 1997.
#include "c:\fallen\headers\structs.h"
//#define GAME_SCALE 2560.0
extern SLONG current_element;
extern struct KeyFrameElement *the_elements;
void read_object_name(FILE *file_handle,CBYTE *dest_string);
void load_multi_vue(struct KeyFrameChunk *the_chunk,float scale);
//void load_key_frame_chunks(KeyFrameChunk *the_chunk,CBYTE *vue_name);
void sort_multi_object(struct KeyFrameChunk *the_chunk);
void setup_anim_stuff(void);
void reset_anim_stuff(void);
void load_chunk_texture_info(KeyFrameChunk *the_chunk);
void do_single_shot(UBYTE *screen,UBYTE *palette);
void do_record_frame(UBYTE *screen,UBYTE *palette);
SLONG write_pcx(CBYTE *fname,UBYTE *src,UBYTE *pal);
void editor_show_work_screen(ULONG flags);
void editor_show_work_window(ULONG flags);
//---------------------------------------------------------------
inline UWORD calc_lights(SLONG x,SLONG y,SLONG z,struct SVector *p_vect)
{
#ifdef EDITOR
SLONG dx,dy,dz,dist;
SLONG lx,ly,lz;
ULONG c0;
SLONG total=0;
lx=p_vect->X+x;
ly=p_vect->Y+y;
lz=p_vect->Z+z;
for(c0=1;c0<next_d_light;c0++)
{
dx=abs(lx-d_lights[c0].X);
dy=abs(ly-d_lights[c0].Y);
dz=abs(lz-d_lights[c0].Z);
// dist=QDIST3(dx,dy,dz);
dist=dx*dx+dy*dy+dz*dz;
if(dist==0)
dist=1;
if(dist<(256<<11))
total+=(d_lights[c0].Intensity<<11)/dist;
}
return((UWORD)total);
#else
return ( 0 );
#endif
}
//---------------------------------------------------------------
|
// SLFunctions.h
//
// Copyright (c) 2014 Antti Laitala (https://github.com/anlaital)
//
// 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.
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, SLPrimitiveDataType) {
/** Property is not a primitive data type. */
SLPrimitiveDataTypeNone,
/** Property is `char`. */
SLPrimitiveDataTypeChar,
/** Property is `unsigned char`. */
SLPrimitiveDataTypeUnsignedChar,
/** Property is `short`. */
SLPrimitiveDataTypeShort,
/** Property is `unsigned short`. */
SLPrimitiveDataTypeUnsignedShort,
/** Property is `int`. */
SLPrimitiveDataTypeInt,
/** Property is `unsigned int`. */
SLPrimitiveDataTypeUnsignedInt,
/** Property is `long`. */
SLPrimitiveDataTypeLong,
/** Property is `unsigned long`. */
SLPrimitiveDataTypeUnsignedLong,
/** Property is `long long`. */
SLPrimitiveDataTypeLongLong,
/** Property is `unsigned long long`. */
SLPrimitiveDataTypeUnsignedLongLong,
/** Property is `float`. */
SLPrimitiveDataTypeFloat,
/** Property is `double`. */
SLPrimitiveDataTypeDouble,
/** Property is `id`. */
SLPrimitiveDataTypeId
};
@interface SLObjectProperty : NSObject
/** Name of the property. */
@property (nonatomic, readonly) NSString *name;
/** The property is read-only (`readonly`). */
@property (nonatomic, readonly, getter = isReadonly) BOOL readonly;
/** The property is atomic (`atomic`). */
@property (nonatomic, readonly, getter = isAtomic) BOOL atomic;
/** The property is a copy of the value last assigned (`copy`). */
@property (nonatomic, readonly) BOOL copiesValue;
/** The property is a reference to the value last assigned (`retain`). */
@property (nonatomic, readonly) BOOL retainsValue;
/** The property is dynamic (`@dynamic`). */
@property (nonatomic, readonly, getter = isDynamic) BOOL dynamic;
/** The property is a weak reference (`__weak`). */
@property (nonatomic, readonly, getter = isWeak) BOOL weak;
/** Selector of the custom setter method or nil if none. */
@property (nonatomic, readonly) SEL customSetter;
/** Selector of the custom getter method or nil if none. */
@property (nonatomic, readonly) SEL customGetter;
/** Primitive data type as defined by `SLPrimitiveDataType`. `SLPrimitiveDataTypeNone` if not a primitive data type. */
@property (nonatomic, readonly) SLPrimitiveDataType primitiveDataType;
/** Class data type or nil if none. */
@property (nonatomic, readonly) Class classDataType;
/** Names of the protocols implemented by the property or nil if none. */
@property (nonatomic, readonly) NSArray *protocolNames;
@end
@interface SLFunctions : NSObject
/** Returns the current system uptime in seconds or -1 if it cannot be determined. */
+ (time_t)uptime;
/** Returns the properties for the given class as wrapped by `SLObjectProperty`. This does not return properties inherited from super classes. */
+ (NSArray *)propertiesForClass:(Class)aClass;
/** Returns the properties for `class` and all its super classes up to `baseClass`. If `class` is not a descendand of `baseClass`, then all properties are returned. */
+ (NSArray *)propertiesForClass:(Class)aClass recursivelyUpToClass:(Class)baseClass;
@end
|
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "utils.h"
rgb_pixel int2RgbPixel(const int value) {
int r = (value & 0x00FF0000) >> 16;
int g = (value & 0x0000FF00) >> 8;
int b = value & 0x000000FF;
return rgb2RgbPixel(r, g, b);
}
int rgbPixel2Int(const rgb_pixel value) {
return rgb2Int((unsigned char) value.r, (unsigned char) value.g, (unsigned char) value.b);
}
int rgb2Int(const int r, const int g, const int b) {
int tr = (r << 16) & 0x00FF0000;
int tg = (g << 8) & 0x0000FF00;
int tb = b & 0x000000FF;
return 0xFF000000 | tr | tg | tb; // 100 % alpha
}
rgb_pixel rgb2RgbPixel(const int r, const int g, const int b) {
rgb_pixel p;
p.r = (unsigned char) r;
p.g = (unsigned char) g;
p.b = (unsigned char) b;
return p;
}
void plotInt2Ppm(char * fileName, int width, int height, int ** data) {
FILE *fp = fopen(fileName, "wb");
unsigned char color[3];
fprintf(fp, "P6\n%d %d\n%d\n", width, height, MAX_PIXEL_VAL);
for (int j = 0; j < height; ++j) {
for (int i = 0; i < width; ++i) {
color[0] = int2RgbPixel(data[j][i]).r;
color[1] = int2RgbPixel(data[j][i]).g;
color[2] = int2RgbPixel(data[j][i]).b;
fwrite(color, sizeof(unsigned char), 3, fp);
}
}
fclose(fp);
}
void plotRgbPixel2Ppm(char * fileName, int width, int height, rgb_pixel ** data) {
FILE *fp = fopen(fileName, "wb");
unsigned char color[3];
fprintf(fp, "P6\n%d %d\n%d\n", width, height, MAX_PIXEL_VAL);
for (int j = 0; j < height; ++j) {
for (int i = 0; i < width; ++i) {
color[0] = data[j][i].r;
color[1] = data[j][i].g;
color[2] = data[j][i].b;
fwrite(color, sizeof(unsigned char), 3, fp);
}
}
fclose(fp);
}
|
//
// EmptyStateView.h
// ListingBot
//
// Created by Andrew Robinson on 9/4/15.
// Copyright (c) 2015 Robinson Bros. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface EmptyStateView : UIView <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *addItem;
@property (weak, nonatomic) IBOutlet UILabel *quantityLabel;
@property (weak, nonatomic) IBOutlet UIView *itemView;
@end
|
#include "../emdns.h"
#ifdef _WIN32
#include <winsock2.h>
#include <IPHlpApi.h>
#include <WS2tcpip.h>
#include <string.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "iphlpapi.lib")
#define MDNS_PORT 5353
#define IPV4_MCAST 0xE00000FB
static unsigned char g_ipv6_mcast[16] = {0xFF, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFB};
int emdns_bind4(struct in_addr interface_addr, struct sockaddr_in *send_addr) {
WSADATA wsa_data;
WSAStartup(MAKEWORD(2, 2), &wsa_data);
int fd = (int) socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
return -1;
}
DWORD reuseaddr = 1;
DWORD hops = 255;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*) &reuseaddr, sizeof(reuseaddr))) {
goto err;
}
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*) &hops, sizeof(hops))) {
goto err;
}
struct sockaddr_in sab = {0};
sab.sin_family = AF_INET;
sab.sin_port = ntohs(MDNS_PORT);
sab.sin_addr.s_addr = ntohl(INADDR_ANY);
if (bind(fd, (struct sockaddr*) &sab, sizeof(sab))) {
goto err;
}
struct ip_mreq req = {0};
req.imr_multiaddr.s_addr = htonl(IPV4_MCAST);
req.imr_interface = interface_addr;
if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*) &req, sizeof(req))) {
goto err;
}
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*) &interface_addr, sizeof(interface_addr))) {
goto err;
}
memset(send_addr, 0, sizeof(*send_addr));
send_addr->sin_family = AF_INET;
send_addr->sin_port = htons(MDNS_PORT);
send_addr->sin_addr.s_addr = htonl(IPV4_MCAST);
return fd;
err:
closesocket(fd);
return -1;
}
int emdns_bind6(int interface_id, struct sockaddr_in6 *send_addr) {
WSADATA wsa_data;
WSAStartup(MAKEWORD(2,2), &wsa_data);
int fd = (int) socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
return -1;
}
DWORD reuseaddr = 1;
DWORD v6only = 1;
DWORD hops = 255;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*) &reuseaddr, sizeof(reuseaddr))) {
goto err;
}
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*) &v6only, sizeof(v6only))) {
goto err;
}
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char*) &hops, sizeof(hops))) {
goto err;
}
struct sockaddr_in6 sab = {0};
sab.sin6_family = AF_INET6;
sab.sin6_port = ntohs(MDNS_PORT);
memcpy(&sab.sin6_addr, &in6addr_any, sizeof(sab.sin6_addr));
if (bind(fd, (struct sockaddr*) &sab, sizeof(sab))) {
goto err;
}
struct ipv6_mreq req = {0};
req.ipv6mr_interface = interface_id;
memcpy(&req.ipv6mr_multiaddr, &g_ipv6_mcast, sizeof(g_ipv6_mcast));
if (setsockopt(fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char*) &req, sizeof(req))) {
goto err;
}
DWORD dwinterface = interface_id;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, (char*) &dwinterface, sizeof(dwinterface))) {
goto err;
}
memset(send_addr, 0, sizeof(*send_addr));
send_addr->sin6_family = AF_INET6;
send_addr->sin6_port = htons(MDNS_PORT);
memcpy(&send_addr->sin6_addr, &g_ipv6_mcast, sizeof(g_ipv6_mcast));
return fd;
err:
closesocket(fd);
return -1;
}
#define MAX_IP6 16
int emdns_lookup_interfaces(void *udata, emdns_ifcb cb) {
struct in6_addr ip6[MAX_IP6];
int ret = 0;
unsigned long bufsz = 256 * 1024;
IP_ADAPTER_ADDRESSES *buf = (IP_ADAPTER_ADDRESSES*) malloc(bufsz);
if (GetAdaptersAddresses(AF_UNSPEC, 0, 0, buf, &bufsz)) {
ret = -1;
}
for (IP_ADAPTER_ADDRESSES *addr = buf; addr != NULL && !ret; addr = addr->Next) {
switch (addr->IfType) {
case IF_TYPE_ETHERNET_CSMACD:
case IF_TYPE_PPP:
case IF_TYPE_SOFTWARE_LOOPBACK:
case IF_TYPE_IEEE80211: {
struct emdns_interface iface = {0};
for (IP_ADAPTER_UNICAST_ADDRESS *a = addr->FirstUnicastAddress; a != NULL; a = a->Next) {
switch (a->Address.lpSockaddr->sa_family) {
case AF_INET: {
struct sockaddr_in *sa = (struct sockaddr_in*) a->Address.lpSockaddr;
iface.ip4 = &sa->sin_addr;
}
break;
case AF_INET6:
if (iface.ip6_num < MAX_IP6) {
struct sockaddr_in6 *sa = (struct sockaddr_in6*) a->Address.lpSockaddr;
memcpy(&ip6[iface.ip6_num++], &sa->sin6_addr, sizeof(sa->sin6_addr));
}
break;
}
}
iface.name = addr->FriendlyName;
iface.description = addr->Description;
iface.id = addr->IfIndex;
iface.ip6 = ip6;
ret = cb(udata, &iface);
}
break;
}
}
free(buf);
return ret;
}
#endif
|
#include <assert.h>
#include <string.h>
#include "dict.h"
#include "dictglobal.h"
static int streq(const char* s1, const char* s2, size_t len) {
if (s1 == s2)
return 1;
if (s1 == NULL || s2 == NULL)
return 0;
return strncmp(s1, s2, len) == 0;
}
int main() {
unsigned long d1, d2, d3;
assert(dict_size(dict_global()) == 0);
d1 = dict_new();
dict_insert(d1, "k0", "a");
assert(streq(dict_find(d1, "k0"), "a", 2));
dict_insert(d1, "k1", "aa");
assert(streq(dict_find(d1, "k1"), "aa", 3));
assert(dict_size(d1) == 2);
dict_remove(d1, "k1");
assert(dict_find(d1, "k1") == NULL);
assert(streq(dict_find(d1, "k0"), "a", 2));
assert(dict_size(d1) == 1);
dict_insert(d1, "k0", NULL);
assert(streq(dict_find(d1, "k0"), "a", 2));
assert(dict_size(d1) == 1);
dict_insert(d1, NULL, NULL);
assert(dict_size(d1) == 1);
dict_remove(d1, "k1");
assert(dict_size(d1) == 1);
dict_delete(d1);
dict_insert(d1, "k0", "b");
assert(dict_size(d1) == 0);
assert(dict_find(d1, "k0") == NULL);
d2 = dict_new();
d3 = dict_new();
dict_insert(d2, "k0", "c");
dict_insert(d2, "k1", "cc");
dict_insert(d2, "k2", "ccc");
dict_copy(d2, d3);
assert(dict_size(d3) == 3);
dict_clear(d3);
assert(dict_size(d3) == 0);
dict_insert(dict_global(), "g0", "d");
assert(dict_size(dict_global()) == 1);
assert(streq(dict_find(d1, "g0"), "d", 2));
dict_delete(dict_global());
assert(dict_size(dict_global()) == 1);
dict_clear(dict_global());
return 0;
}
|
//
// OHAlertView.h
// AliSoftware
//
// Created by Olivier on 30/12/10.
// Copyright 2010 AliSoftware. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, OHAlertViewStyle) {
OHAlertViewStyleDefault = 0,
OHAlertViewStyleSecureTextInput,
OHAlertViewStylePlainTextInput,
OHAlertViewStyleLoginAndPasswordInput,
OHAlertViewStyleEmailAndPasswordInput, // same as previous but with email keyboard for login
};
@interface OHAlertView : NSObject
typedef void(^OHAlertViewButtonHandler)(OHAlertView* alert, NSInteger buttonIndex);
typedef BOOL (^OHAlertViewShouldEnableFirstOtherButton)(OHAlertView *alert);
@property (nonatomic, assign) OHAlertViewStyle alertViewStyle;
@property (nonatomic, copy) OHAlertViewShouldEnableFirstOtherButton shouldEnableFirstButton;
@property(nonatomic,readonly) NSInteger numberOfButtons;
@property(nonatomic,readonly) NSInteger cancelButtonIndex;
@property(nonatomic,readonly) NSInteger firstOtherButtonIndex;
/////////////////////////////////////////////////////////////////////////////
#pragma mark - Commodity Constructors
/**
* Create and immediately display an AlertView.
*
* @param title The title of the AlertView (see UIAlertView)
* @param message The message of the AlertView (see UIAlertView)
* @param cancelButtonTitle The title for the "cancel" button (see UIAlertView)
* @param otherButtonTitles A NSArray of NSStrings containing titles for the other buttons (see UIAlertView)
* @param handler The block that will be executed when the user taps on a button. This block takes:
* - The OHAlertView as its first parameter, useful to get the firstOtherButtonIndex from it for example
* - The NSInteger as its second parameter, representing the index of the button that has been tapped
*/
+(void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelButton:(NSString *)cancelButtonTitle
otherButtons:(NSArray *)otherButtonTitles
buttonHandler:(OHAlertViewButtonHandler)handler;
/**
* Create and immediately display an AlertView with an alert style.
*
* @param title The title of the AlertView (see UIAlertView)
* @param message The message of the AlertView (see UIAlertView)
* @param alertStyle The stlye of the AlertView (see UIAlertView)
* @param cancelButtonTitle The title for the "cancel" button (see UIAlertView)
* @param otherButtonTitles A NSArray of NSStrings containing titles for the other buttons (see UIAlertView)
* @param handler The block that will be executed when the user taps on a button. This block takes:
* - The OHAlertView as its first parameter, useful to get the firstOtherButtonIndex from it for example
* - The NSInteger as its second parameter, representing the index of the button that has been tapped
*/
+(void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
alertStyle:(OHAlertViewStyle)alertStyle
cancelButton:(NSString *)cancelButtonTitle
otherButtons:(NSArray *)otherButtonTitles
buttonHandler:(OHAlertViewButtonHandler)handler;
/**
* Create and immediately display an AlertView with only one button.
*
* @param title The title of the AlertView (see UIAlertView)
* @param message The message of the AlertView (see UIAlertView)
* @param dismissButtonTitle The title for the only button, acting as a "cancel" button
*
* @note This is a commodity method, equivalent of calling
* `showAlertWithTitle:cancelButton:otherButtons:buttonHandler:` with `otherButtons`
* and `buttonHandler` set to `nil`.
* @note This method has no OHAlertViewButtonHandler parameter as it is intended to be used
* to display simply informational alerts.
*/
+(void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
dismissButton:(NSString *)dismissButtonTitle;
#pragma mark - Instance Methods
/**
* Create a new AlertView. Designed initializer.
*
* @param title The title of the AlertView (see UIAlertView)
* @param message The message of the AlertView (see UIAlertView)
* @param cancelButtonTitle The title for the "cancel" button (see UIAlertView)
* @param otherButtonTitles A NSArray of NSStrings containing titles for the other buttons (see UIAlertView)
* @param handler The block that will be executed when the user taps on a button. This block takes:
* - The OHAlertView as its first parameter, useful to get the firstOtherButtonIndex from it for example
* - The NSInteger as its second parameter, representing the index of the button that has been tapped
* @return The newly created AlertView. use the -show method of UIAlertView then to display it on screen.
*/
-(instancetype)initWithTitle:(NSString *)title
message:(NSString *)message
cancelButton:(NSString *)cancelButtonTitle
otherButtons:(NSArray *)otherButtonTitles
buttonHandler:(OHAlertViewButtonHandler)handler;
/**
* Retrieve a text field at an index.
*
* The field at index 0 will be the first text field (the single field or the login field), the field at index 1 will be the password field.
*
* @note raises NSRangeException when textFieldIndex is out-of-bounds.
*
*/
-(UITextField*)textFieldAtIndex:(NSInteger)index;
/**
* Display the alert on screen.
*/
-(void)show;
@end
|
#import "TKSTableViewCell.h"
#import "TKSTaxiHeaderCellVM.h"
@interface TKSTaxiHeaderCell : TKSTableViewCell <TKSTaxiHeaderCellVM *>
@end
|
#include "types.h"
#include "x86.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
return fork();
}
int
sys_exit(void)
{
exit();
return 0; // not reached
}
int
sys_wait(void)
{
return wait();
}
int
sys_kill(void)
{
int pid;
if(argint(0, &pid) < 0)
return -1;
return kill(pid);
}
int
sys_getpid(void)
{
return proc->pid;
}
int
sys_sbrk(void)
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = proc->sz;
if(growproc(n) < 0)
return -1;
return addr;
}
int
sys_sleep(void)
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
if(proc->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
uint xticks;
acquire(&tickslock);
xticks = ticks;
release(&tickslock);
return xticks;
}
int
sys_random(void)
{
acquire(&randlock);
seed = seed * rand_a + rand_c;
release(&randlock);
return seed;
}
int
sys_random_init(int _seed)
{
acquire(&randlock);
seed = _seed;
release(&randlock);
return 0;
}
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "SBStarkLauncherViewController.h"
#import "SBStarkKnobLauncherCellDelegate-Protocol.h"
#import "UIGestureRecognizerDelegate-Protocol.h"
#import "UITableViewDataSource-Protocol.h"
#import "UITableViewDelegate-Protocol.h"
@class SBIcon, UINavigationBar, UITableView;
@interface SBStarkKnobLauncherViewController : SBStarkLauncherViewController <UITableViewDataSource, UITableViewDelegate, UIGestureRecognizerDelegate, SBStarkKnobLauncherCellDelegate>
{
UITableView *_tableView;
UINavigationBar *_navBar;
SBIcon *_lastHighlightedIcon;
}
- (_Bool)starkKnobLauncherCellDisplaysBadges:(id)arg1;
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2;
- (id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2;
- (_Bool)iconShowsDisclosureIndicator:(id)arg1;
- (long long)tableView:(id)arg1 numberOfRowsInSection:(long long)arg2;
- (void)viewDidAppear:(_Bool)arg1;
- (void)viewWillAppear:(_Bool)arg1;
- (void)viewWillLayoutSubviews;
- (void)loadView;
- (void)relayoutIcons;
- (id)prefixFakeIcons;
- (_Bool)obscuresControlBar;
- (_Bool)hidesAutomatically;
- (id)_rowIndexPathForIcon:(id)arg1;
- (void)_launchIcon:(id)arg1;
- (void)dealloc;
@end
|
#include "kr_flow.h"
T_KRFlow *kr_flow_construct(T_KRParam *ptParam, T_KRModule *ptModule)
{
//TODO:this is a dummy now
T_KRFlow *ptFlow = kr_calloc(sizeof(*ptFlow));
if (ptFlow == NULL) {
KR_LOG(KR_LOGERROR, "kr_calloc ptFlow failed!");
return NULL;
}
ptFlow->tConstructTime = kr_param_load_time(ptParam);
return ptFlow;
}
void kr_flow_destruct(T_KRFlow *ptFlow)
{
if (ptFlow) {
kr_free(ptFlow);
}
}
void kr_flow_init(T_KRFlow *ptFlow)
{
//TODO:this is a dummy now
}
int kr_flow_check(T_KRFlow *ptFlow, T_KRParam *ptParam)
{
/*check item table*/
if (ptFlow->tConstructTime != kr_param_load_time(ptParam)) {
KR_LOG(KR_LOGDEBUG, "reload ...[%ld][%ld]",
ptFlow->tConstructTime, kr_param_load_time(ptParam));
//FIXME:
}
return 0;
}
int kr_flow_process(T_KRFlow *ptFlow, T_KRContext *ptContext)
{
//TODO:this is a dummy now
return 0;
}
|
#ifndef LUAGLUE_APPLYTUPLE_GLUEOBJSPTRCONSTFUNC_H_GUARD
#define LUAGLUE_APPLYTUPLE_GLUEOBJSPTRCONSTFUNC_H_GUARD
/**
* LuaGlueTypeValue<shared_ptr> const Function Tuple Argument Unpacking
*
* This recursive template unpacks the tuple parameters into
* variadic template arguments until we reach the count of 0 where the function
* is called with the correct parameters
*
* @tparam N Number of tuple arguments to unroll
*
* @ingroup g_util_tuple
*/
template < int N >
struct apply_glueobj_sptr_constfunc
{
template < typename T, typename R, typename... ArgsF, typename... ArgsT, typename... Args >
static R applyTuple(LuaGlueBase *g, lua_State *s, LuaGlueTypeValue<std::shared_ptr<T>> &pObj,
R (T::*f)( ArgsF... ) const,
const std::tuple<ArgsT...> &t,
Args&&... args )
{
const static int argCount = sizeof...(ArgsT);
//typedef typename std::remove_reference<decltype(std::get<N-1>(t))>::type ltype_const;
//typedef typename std::remove_const<ltype_const>::type ltype;
typedef typename std::remove_const<decltype(std::get<N-1>(t))>::type ltype;
return apply_glueobj_sptr_constfunc<N-1>::applyTuple(g, s, pObj, f, std::forward<decltype(t)>(t), stack<ltype>::get(g, s, -(argCount-N+1)), std::forward<Args>(args)... );
}
};
//-----------------------------------------------------------------------------
/**
* LuaGlueTypeValue<shared_ptr> Function Tuple Argument Unpacking End Point
*
* This recursive template unpacks the tuple parameters into
* variadic template arguments until we reach the count of 0 where the function
* is called with the correct parameters
*
* @ingroup g_util_tuple
*/
template <>
struct apply_glueobj_sptr_constfunc<0>
{
template < typename T, typename R, typename... ArgsF, typename... ArgsT, typename... Args >
static R applyTuple(LuaGlueBase *, lua_State *, LuaGlueTypeValue<std::shared_ptr<T>> &pObj,
R (T::*f)( ArgsF... ) const,
const std::tuple<ArgsT...> &/* t */,
Args&&... args )
{
LG_Debug("glueobj<shared_ptr> call!");
return (pObj.ptr()->*f)( std::forward<Args>(args)... );
}
};
//-----------------------------------------------------------------------------
/**
* LuaGlueTypeValue<shared_ptr> Function Call Forwarding Using Tuple Pack Parameters
*/
// Actual apply function
template < typename T, typename R, typename... ArgsF, typename... ArgsT >
R applyTuple(LuaGlueBase *g, lua_State *s, LuaGlueTypeValue<std::shared_ptr<T>> &pObj,
R (T::*f)( ArgsF... ) const,
const std::tuple<ArgsT...> &t )
{
return apply_glueobj_sptr_constfunc<sizeof...(ArgsT)>::applyTuple(g, s, pObj, f, std::forward<decltype(t)>(t) );
}
#endif /* LUAGLUE_APPLYTUPLE_GLUEOBJSPTRCONSTFUNC_H_GUARD */
|
int getColumnValue(
struct qryData *query,
char *inputFileName,
long offset,
int columnIndex
) {
FILE *inputFile = NULL;
char *output = NULL;
size_t strSize = 0;
int currentColumn = 0;
struct inputTable table;
int gotColumn;
MAC_YIELD
if(inputSeek(query, inputFileName, &offset, &inputFile) == EXIT_FAILURE) {
return EXIT_FAILURE;
}
table.fileStream = inputFile;
table.fileEncoding = query->CMD_ENCODING;
table.cpIndex = table.arrLength = 0;
/* initalise the "get a codepoint" data structures */
getNextCodepoint(&table);
/* get the text of the specified csv column (if available). */
/* if it's not available we'll return an empty string */
for(;
currentColumn != columnIndex &&
(gotColumn = getCsvColumn(&table, NULL, NULL, NULL, NULL, TRUE, query->newLine)) == TRUE;
currentColumn++
) {
/* get next column */
}
if(gotColumn) {
getCsvColumn(&table, &output, &strSize, NULL, NULL, TRUE, query->newLine);
}
if(output) {
/* output the value */
fputsEncoded(output, query);
/* free the string memory */
freeAndZero(output);
}
if(query->outputFile == stdout) {
fputsEncoded(query->newLine, query);
}
/* close the input file and return */
fclose(inputFile);
return EXIT_SUCCESS;
}
|
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCOBJECT_H__
#define __CCOBJECT_H__
#include "platform/CCPlatformMacros.h"
NS_CC_BEGIN
/**
* @addtogroup base_nodes
* @{
*/
class CCZone;
class CCObject;
class CCNode;
class CCEvent;
class CC_DLL CCCopying
{
public:
virtual CCObject* copyWithZone(CCZone* pZone);
};
class CC_DLL CCObject : public CCCopying
{
public:
// object id, CCScriptSupport need public m_uID
unsigned int m_uID;
// Lua reference id
int m_nLuaID;
protected:
// count of references
unsigned int m_uReference;
// is the object autoreleased
bool m_bManaged;
public:
CCObject(void);
virtual ~CCObject(void);
void release(void);
void retain(void);
CCObject* autorelease(void);
CCObject* copy(void);
bool isSingleReference(void);
unsigned int retainCount(void);
virtual bool isEqual(const CCObject* pObject);
virtual void update(float dt) {CC_UNUSED_PARAM(dt);};
friend class CCAutoreleasePool;
};
typedef void (CCObject::*SEL_SCHEDULE)(float);
typedef void (CCObject::*SEL_CallFunc)();
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
typedef void (CCObject::*SEL_CallFuncND)(CCNode*, void*);
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
typedef void (CCObject::*SEL_MenuHandler)(CCObject*);
typedef void (CCObject::*SEL_EventHandler)(CCEvent*);
typedef int (CCObject::*SEL_Compare)(CCObject*);
#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(&_SELECTOR)
#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR)
#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR)
#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR)
#define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR)
#define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR)
#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR)
#define compare_selector(_SELECTOR) (SEL_Compare)(&_SELECTOR)
// end of base_nodes group
/// @}
NS_CC_END
#endif // __CCOBJECT_H__
|
#pragma once
#include "CHash.h"
class CMD4 : public CHash
{
public:
CMD4();
virtual ~CMD4();
private:
inline DWORD F(DWORD x, DWORD y, DWORD z) { return ((x & y) | (~x & z)); }
inline DWORD G(DWORD x, DWORD y, DWORD z) { return ((x & y) | (x & z) | (y & z)); }
inline DWORD H(DWORD x, DWORD y, DWORD z) { return (x ^ y ^ z); }
virtual void _hashBlock(const BYTE *pbBlock);
virtual void _padBlock(const BYTE *pbBlock, const QWORD qwLength);
virtual void _finalize(BYTE *pbHash);
DWORD h[4];
static const DWORD shift[];
static const DWORD k[];
}; |
#pragma once
#include <d3d9.h>
#include "GameResource.h"
#include "vector"
using namespace std;
class VertexBufferResource : public GameResource
{
public:
// ctor & dtor
VertexBufferResource();
// GameResource
virtual bool InitResource(LPDIRECT3DDEVICE9 d3dDevice) override;
virtual void ReleaseResource() override;
// Methods
void LoadResource(LPDIRECT3DDEVICE9 d3dDevice, const wstring& source);
inline LPDIRECT3DVERTEXBUFFER9 GetVertexBuffer() { return mVB; }
void SetVertexBufferData(UINT vertexSize, UINT numVertices, DWORD vertexFormat, void* vertexData);
UINT GetVertexStride() { return mVertexSize; }
UINT GetNumVertices() { return mNumVertices; }
DWORD GetVertexFormat() { return mVertexFormat; }
private:
LPDIRECT3DVERTEXBUFFER9 mVB;
UINT mVertexSize;
UINT mNumVertices;
DWORD mVertexFormat;
vector<BYTE> mVertexData;
}; |
//
// DisableLibraryValidation.c
// DisableLibraryValidation
//
// Created by Oliver Kuckertz on 15.07.17.
// Copyright © 2017 Oliver Kuckertz. All rights reserved.
//
#include <mach/mach_types.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <IOKit/IOLib.h> // for IOLog
#include <i386/proc_reg.h> // for get_cr0/set_cr0
#define dbgprintf(STR, ...) \
IOLog("DisableLibraryValidation: " STR "\n", ## __VA_ARGS__);
kern_return_t DisableLibraryValidation_start(kmod_info_t * ki, void *d);
kern_return_t DisableLibraryValidation_stop(kmod_info_t *ki, void *d);
int cs_require_lv(struct proc *);
static const uint8_t patch[] = { 0x48, 0x31, 0xC0 /* XOR RAX,RAX */, 0xC3 /* RET */ };
static uint8_t backup[sizeof(patch)];
static
int cli(void)
{
unsigned long flags;
asm volatile ("pushf; pop %0; cli;" : "=r" (flags));
return !!(flags & EFL_IF);
}
static
void sti(void)
{
asm volatile ("sti; nop;");
}
kern_return_t DisableLibraryValidation_start(kmod_info_t * ki, void *d)
{
dbgprintf("disabling library validation");
// disable interrupts and kernel write protection
int intrflag = cli();
uintptr_t cr0 = get_cr0();
set_cr0(cr0 & ~CR0_WP);
// replace code
memcpy(backup, (void *)cs_require_lv, sizeof(patch));
memcpy((void *)cs_require_lv, patch, sizeof(patch));
// enable kernel write protection and interrupts
set_cr0(cr0);
if (intrflag)
sti();
// validate result
if (cs_require_lv(NULL) == 0) {
return KERN_SUCCESS;
}
else {
dbgprintf("validation failed (and it's a wonder that your machine has not panicked)");
return KERN_FAILURE;
}
}
kern_return_t DisableLibraryValidation_stop(kmod_info_t *ki, void *d)
{
dbgprintf("enabling library validation (unload)");
// disable interrupts and kernel write protection
int intrflag = cli();
uintptr_t cr0 = get_cr0();
set_cr0(cr0 & ~CR0_WP);
// replace code
memcpy((void *)cs_require_lv, backup, sizeof(patch));
// enable kernel write protection and interrupts
set_cr0(cr0);
if (intrflag)
sti();
return KERN_SUCCESS;
}
|
#include <stdio.h>
#include "wich.h"
#include "refcounting.h"
int
main(int ____c, char *____v[])
{
setup_error_handlers();
ENTER();
VECTOR(x);
VECTOR(y);
x = Vector_new((double[]) {
1, 2, 3}, 3);
REF((void *)x.vector);
y = PVector_copy(x);
REF((void *)y.vector);
set_ith(y, 1 - 1, 4);
print_vector(x);
EXIT();
return 0;
}
|
#IFNDEF PARSER_H_
#define PARSER_H
#include <QSyntaxHighlighter>
#include <QWidget>
#include <QWidgets>
class Parser: public QWidget
{
Q_OBJECT
public:
explicit Parser(QWidget *parent = nullptr);
public slots:
};
#endif
|
//-----------------------------------------------------------------------------
// MurmurHash2, by Austin Appleby
// Note - This code makes a few assumptions about how your machine behaves -
// 1. We can read a 4-byte value from any address without crashing
// 2. sizeof(int) == 4
// And it has a few limitations -
// 1. It will not work incrementally.
// 2. It will not produce the same results on little-endian and big-endian
// machines.
unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
{
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
const unsigned int m = 0x5bd1e995;
const int r = 24;
// Initialize the hash to a 'random' value
unsigned int h = seed ^ len;
// Mix 4 bytes at a time into the hash
const unsigned char * data = (const unsigned char *)key;
while(len >= 4)
{
unsigned int k = *(unsigned int *)data;
k *= m;
k ^= k >> r;
k *= m;
h *= m;
h ^= k;
data += 4;
len -= 4;
}
// Handle the last few bytes of the input array
switch(len)
{
case 3: h ^= data[2] << 16;
case 2: h ^= data[1] << 8;
case 1: h ^= data[0];
h *= m;
};
// Do a few final mixes of the hash to ensure the last few
// bytes are well-incorporated.
h ^= h >> 13;
h *= m;
h ^= h >> 15;
return h;
}
|
// Copyright (c) 2011 Seiya Tokui <beam.web@gmail.com>. All Rights Reserved.
// This source code is distributed under MIT License in LICENSE file.
#ifndef ELOG_GET_TIME_POSIX_H_
#define ELOG_GET_TIME_POSIX_H_
#include <sys/time.h>
namespace LOG {
inline double GetTimeSec() {
timeval tv;
gettimeofday(&tv, 0);
return tv.tv_sec + tv.tv_usec * 1e-6;
}
} // namespace LOG
#endif // ELOG_GET_TIME_POSIX_H_
|
#include <stdio.h>
#include <string.h>
#include "PCIE.h"
#if defined(__GNUC__)
#include <dlfcn.h> // dlopen/dlclsoe for linxu
#else
#define dlopen(x,y) ::LoadLibrary(x)
#define dlclose ::FreeLibrary
#define dlsym ::GetProcAddress
#define dlerror() "LoadLibrary failed"
#endif //
LPPCIE_Open PCIE_Open;
LPPCIE_Close PCIE_Close;
LPPCIE_Read32 PCIE_Read32;
LPPCIE_Write32 PCIE_Write32;
LPPCIE_Read16 PCIE_Read16;
LPPCIE_Write16 PCIE_Write16;
LPPCIE_Read8 PCIE_Read8;
LPPCIE_Write8 PCIE_Write8;
LPPCIE_DmaWrite PCIE_DmaWrite;
LPPCIE_DmaRead PCIE_DmaRead;
LPPCIE_DmaFifoWrite PCIE_DmaFifoWrite;
LPPCIE_DmaFifoRead PCIE_DmaFifoRead;
void QueryModualName(char szName[]){
#if defined(__GNUC__)
strcpy(szName, "./terasic_pcie_qsys.so");
#else
// windows
//check OS
BOOL bIsWow64 = FALSE;
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( GetModuleHandle("kernel32"),"IsWow64Process");
if (NULL != fnIsWow64Process)
{
fnIsWow64Process(GetCurrentProcess(),&bIsWow64);
}
if(bIsWow64)
{
strcpy(szName, "TERASIC_PCIE_QSYSx64.DLL");
}
else
{
strcpy(szName, "TERASIC_PCIE_QSYS.DLL");
}
#endif
}
void *PCIE_Load(void){
BOOL bSuccess = TRUE;
void *lib_handle;
char szName[256];
QueryModualName(szName);
lib_handle = dlopen(szName, RTLD_NOW);
if (!lib_handle){
printf("Load %s error: %s\r\n", szName, dlerror());
bSuccess = FALSE;
}
if(bSuccess){
PCIE_Open = dlsym(lib_handle, "PCIE_Open");
PCIE_Close = dlsym(lib_handle, "PCIE_Close");
PCIE_Read32 = dlsym(lib_handle, "PCIE_Read32");
PCIE_Write32 = dlsym(lib_handle, "PCIE_Write32");
PCIE_Read16 = dlsym(lib_handle, "PCIE_Read16");
PCIE_Write16 = dlsym(lib_handle, "PCIE_Write16");
PCIE_Read8 = dlsym(lib_handle, "PCIE_Read8");
PCIE_Write8 = dlsym(lib_handle, "PCIE_Write8");
PCIE_DmaWrite = dlsym(lib_handle, "PCIE_DmaWrite");
PCIE_DmaRead = dlsym(lib_handle, "PCIE_DmaRead");
PCIE_DmaFifoWrite = dlsym(lib_handle, "PCIE_DmaFifoWrite");
PCIE_DmaFifoRead = dlsym(lib_handle, "PCIE_DmaFifoRead");
if (!PCIE_Open || !PCIE_Close ||
!PCIE_Read32 || !PCIE_Write32 ||
!PCIE_Read16 || !PCIE_Write16 ||
!PCIE_Read8 || !PCIE_Write8 ||
!PCIE_DmaWrite || !PCIE_DmaRead ||
!PCIE_DmaFifoWrite || !PCIE_DmaFifoRead
)
bSuccess = FALSE;
if (!bSuccess){
dlclose(lib_handle);
lib_handle = 0;
}
}
return lib_handle;
}
void PCIE_Unload(void *lib_handle){
dlclose(lib_handle);
}
|
#ifndef _commandmgr_h_
#define _commandmgr_h_
#include <queue>
#include "tokenizer.h"
#include "gamecommand.h"
class ActorParams;
class ItemParams;
typedef std::queue<GameCommand*> GameCommandQueue;
class CommandMgr
{
public:
// returns singleton instance
static CommandMgr& Instance() { static CommandMgr instance; return instance; };
~CommandMgr();
void SetMode(const CommandMode::Type mode);
void LoadItemStartupScript();
void LoadGameStartupScript();
void LoadMapScript(const std::string& mapname);
void LoadEventScript(const int eventnum);
void LoadActorScript(const int actornum);
void LoadConsoleScript();
void AddCommandFromToken();
void AddCommandManually(GameCommand* pGC);
void GoToNextEnd();
bool HasActiveCommands() const;
std::string GetEventScriptName(const unsigned int scriptnum);
void Update(const float ticks);
ActorParams* GetActorParams();
ItemParams* GetItemParams();
void CreateActor();
void CreateItem();
private:
CommandMgr();
CommandMgr(const CommandMgr& rhs);
CommandMgr& operator=(const CommandMgr& rhs);
void LoadScript(const std::string& scriptname);
GameCommandQueue m_comQueue;
GameCommand* m_pCurrCommand;
Tokenizer m_tokenizer;
Token m_token;
CommandMode::Type m_mode;
ActorParams* m_pActorParams;
ItemParams* m_pItemParams;
};
#endif //_commandmgr_h_ |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@interface EditImageReport : NSObject
{
}
+ (void)EditImageReportOverallSendingEditedImage:(unsigned int)arg1 withAllImage:(unsigned int)arg2 fromScene:(unsigned int)arg3;
+ (void)EditImageReportSingleSendBehavior:(id)arg1 isOriginal:(unsigned int)arg2 fromScene:(unsigned int)arg3;
+ (void)EditImageReportClickBehavior:(unsigned int)arg1 fromScene:(unsigned int)arg2;
@end
|
#ifndef ZEPHYR_MAKE_UNIQUE_H
#define ZEPHYR_MAKE_UNIQUE_H
#include <memory>
#include <type_traits>
#include <utility>
namespace zephyr
{
template <typename T, typename... Args>
std::unique_ptr<T> make_unique_helper(std::false_type, Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <typename T, typename... Args>
std::unique_ptr<T> make_unique_helper(std::true_type, Args&&... args)
{
static_assert(std::extent<T>::value == 0,
"make_unique<T[N]>() is forbidden, please use make_unique<T[]>().");
typedef typename std::remove_extent<T>::type U;
return std::unique_ptr<T>(new U[sizeof...(Args)]{std::forward<Args>(args)...});
}
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
return make_unique_helper<T>(std::is_array<T>(), std::forward<Args>(args)...);
}
}
#endif
|
//
// BottomCollectionViewCell.h
// 乐趣做
//
// Created by 王新伟 on 2017/5/16.
// Copyright © 2017年 王新伟. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ShopListModel.h"
#import "HotListModel.h"
@interface BottomCollectionViewCell : UICollectionViewCell
/**传商家model*/
@property (nonatomic,strong) ShopListModel * shopListModel;
/**传热门模型*/
@property (nonatomic, strong) HotListModel * hotListModel;
/***/
@property (nonatomic, strong) UIViewController *superVC;
-(instancetype)initWithFrame:(CGRect)frame;
@end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.